1. 程式人生 > >PostgreSQL查詢數據(基本查詢)

PostgreSQL查詢數據(基本查詢)

bsp update pan tab rim val nbsp serial use

原料:數據表

技術分享圖片
create table "SysUser"(
    "UserId" serial,                  --用戶Id,自增
    "UserName" character varying(50), --用戶名
    "Pwd" character varying(50),      --密碼
        "Status" smallint,                --狀態 
    primary key("UserId")             --設置UserId主鍵
)
View Code

1.添加數據

  語法:insert into table (column1, column2, column3,...columnN) values (value1, value2, value3,...valueN)

insert into "SysUser"("UserName","Pwd")values(username1,123456);
insert into "SysUser"("UserName","Pwd")values(username2,123456);
insert into "SysUser"("UserName","Pwd")values(username3,123456);
insert into "SysUser"("UserName","Pwd")values(username4,123456);

數據輸出

技術分享圖片

2.修改數據

  語法:update table set column1 = value1, column2 = value2...., columnN = valueN where [condition]

update "SysUser" set "Status"=1 where "UserId"=3;

數據輸出

技術分享圖片

3.刪除數據

  語法:delete from table where [condition];

delete from "SysUser" where "UserId"=3;

數據輸出

技術分享圖片

PostgreSQL查詢數據(基本查詢)