oracle數據庫操縱語言DML
阿新 • • 發佈:2018-05-29
word delete nag 刪除 column not oracl update 全部
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_nameas 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_name1using 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);
oracle數據庫操縱語言DML