PostgreSQL查詢數據(基本查詢)
阿新 • • 發佈:2018-09-19
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查詢數據(基本查詢)