oracle数据库操纵语言DML
oracle数据库操纵语言:DML 添加数据: (1)直接添加数据: insert into table_name(column_name1,column_name2,...) values(data1,data2...); (2)通过其他数据表添加(目标表已存在): insert into table_name(column_name1,column_name2,...) select column_name1,column_name2... from table_name2; (3)添加数据同时创建表(目标表待创建): create table table_name as select column_name1,column_name2,...from source_table; 修改数据: update table_name set column_name1=data1,column_name2=data2,... [where condition]; 删除表中数据: (1)条件删除: delete from table_name [where condition]; (2)全部删除: truncate table table_name; 同时修改和添加: merge [into] table_name1 using table_name2 on (condition) when matched then merge_update_clause when not matched then merge_insert_clause; (1)省略增加的语句 merge into login using managerinfo on (login.login_id = managerinfo.managerid) when matched then update set login.loginname = managerinfo.loginname; (2)省略修改的语句 merge into login on(login.login_id=managerinfo.managerid) when not matched then insert values(managerinfo.loginname,managerinfo.password,managerinfo.managerid); (3)增加和修改同时进行 merge into login using managerinfo on(login.login_id = managerinfo.managerid) when matched then update set login.loginname = managerinfo.loginname when not matched then insert values(managerinfo.loginname,managerinfo.password,managerinfo.managerid);
学如逆水行舟,不进则退