Oracle(2)-----DML语句

 

思维导图

一.Insert语句

    语句格式:

insert into tablename (column1,column2.....) 
values [(column1,column2..... ) | 子查询语句 ]

    直接插入数据,可以选择插入一列或者多列

insert into study (ID,name ,age,dream) values (100,'xiaohao',12,'study');

    也可以插入子查询语句,也可以选择插入一列,多列,或者所有列,但是,子查询数据必须符合规范。

insert into student2 (sno,sname,ssex) (select sno,sname,ssex from student where sno=109);

二.update语句

    语句格式:

update tablename 
set [column1=?,column2=?..... | (column1,column2....)=(子查询语句)] 
where 条件

    直接更新数据

update student2 set sno=111,sname='xiaohao',ssex='男' where sno=101;

    使用子查询语句

update student2 set (sno,sname,ssex)=(select sno,sname,ssex from student where sno = 103) where sno=111;

三.delete语句

语句格式:

delete from tablename
where 条件

示例

delete from student2 where sno = 103;

猜你喜欢

转载自blog.csdn.net/zh328271057/article/details/81156625