使用子查詢建立表

2021-07-09 03:56:09 字數 831 閱讀 9125

使用子查詢建立表 

create table myemp as select * from emp; 

create table myemp as select * from emp where deptno=10; 

create table myemp as select * from emp 1=2; 

新增字段 

alter table student add age number(5); 

、修改字段 

alter table student modify age number(10); alter table table2 rename column result to result2; 

12.5、刪除字段 

alter table student drop column age; 

12.6、清空表中資料 

truncate table student; 

正常情況下刪除資料,如果發現刪除錯了,則可以通過rollback回滾。如果使用了截斷表,則表示所有的資料不可恢復了.所以速度很快(更詳細的說明可檢視oracle體系結構) 

12.7、刪除表 

drop table student; 

12.8、重新命名表 

rename student to student1; 

、insert 語句 

表間資料拷貝 insert into dept1(id, name) select deptno, dname from dept;

分享到: 

imp和exp命令 | 

如何修改wampserver中mysql資料庫的空密碼

SQL使用子查詢 聯結表 建立高階聯結

利用子查詢進行過濾select cust name,cust contact from customers where cust id in select cust id from orders where order num in select order num from orderitems ...

子查詢 聯結表 建立高階聯結 組合查詢

巢狀在其他查詢中的查詢 利用子查詢過濾select cust id from orders where order num in select order num from orderitems where prod id tnt2 作為計算字段使用子查詢select cust name,cust ...

MySQL 使用查詢結果建立表

mysql不支援 select into new table name from old table name 替代方法 1 create table new table name select from old table name select into new table name from ...