sql語句之表增刪改操作

2021-07-28 06:05:22 字數 436 閱讀 6187

1)插入資料:

insert  into 表名 (列名,列名,列名) values(值,值,值);

例: 向emp表中插入一條資料;

insert into emp (id,name,***)   values  (1,'劉備','男');

2)修改資料:

修改表中所有的記錄:update  表名  set  列名='值';

符合修改條件的記錄:update  表名  set  列名='值', where id=1;      (修改id為1的某列) 

修改表中多個列:           update  表名  set  列名='值', 列名='值' where id=2;

3)刪除資料:

刪除表中所有資料:delete from 表名;

刪除部分行資訊:delete from 表名 where id=1;

SQL語句 增刪改

程式設計要求use test wyy db guet goset nocount on begin 此處寫第一題的sql語句 insert into student sno,sname,s sage,sdept values 07002 lucy f 21 ma end go begin 此處寫第二...

sql語句3 增刪改

ps 以dept emp表為例 1 新增資料 insert into表名稱 列名1,列名2,values 值1,值2,insert into dept deptid deptname deptnum deptdesc values null,技術部 20,技術 主鍵deptid為自增列,故無需新增具...

SQL 增刪改查語句

建立表 create table create table student id intnot null unique identity 1000,1 unique 唯一識別符號約束 identity 自增 name nvarchar 20 not null char 2 check in 男 女 ...