1、創(chuàng)建數(shù)據(jù)庫
2、刪除數(shù)據(jù)庫
3、備份SQL Server
--- 創(chuàng)建 備份數(shù)據(jù)的 device
USE master
EXEC sp_addumpdevice disk , testBack , c:\mssql7backup\MyNwind_1.dat
--- 開始 備份
BACKUP DATABASE pubs TO testBack
4、創(chuàng)建新表
create table tabname(col1 type1 [not null] [primary key],col2 type2 [not null],..)
根據(jù)已有的表創(chuàng)建新表:
使用舊表創(chuàng)建新表:
select * into table_new from table_old
僅適用于Oracle:
create table tab_new as select col1,col2… from tab_old definition only
5、刪除新表
6、增加一個(gè)列,刪除一個(gè)列
增加列:alter table tabname add column col type
刪除列:alter table tabname drop column colname
注:DB2中列加上后數(shù)據(jù)類型也不能改變,唯一能改變的是增加varchar類型的長(zhǎng)度。
7、添加/刪除主鍵