DDL
鏂板緩琛細(xì)
create table 琛ㄥ悕
(
涓婚敭瀛楁 number(15) PRIMARY KEY ,
瀛楁1 nVarChar2(50) default '榛樿鍊? null /not null,
瀛楁2 number(30) null ,
)
鎴?/strong>
create table 琛ㄥ悕
(
涓婚敭瀛楁 number(15) not null ,
瀛楁1 nVarChar2(50) default '榛樿鍊? null /not null,
瀛楁2 number(30) null
)
澧炲姞涓婚敭綰︽潫
alter table 琛ㄥ悕
add constraint 涓婚敭鍚?nbsp;primary key (瀛楁鍚?;
鍒犻櫎琛細(xì)
drop table [琛ㄥ悕]
鏂板瀛楁錛?/strong>
ALTER TABLE 琛ㄥ悕 ADD瀛楁鍚?span style="font-size: 10pt; font-family: 'Courier New'; color: black; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: white; background-position: initial initial; background-repeat: initial initial; ">
鏂板澶氫釜瀛楁
ALTER TABLE 琛ㄥ悕
ADD(
瀛楁1 鏁版嵁綾誨瀷 default ‘榛樿鍊?span style="font-size: 10pt; font-family: 'Courier New'; color: black; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: white; background-position: initial initial; background-repeat: initial initial; ">’ null/not null,
瀛楁2 鏁版嵁綾誨瀷 default ‘榛樿鍊?span style="font-size: 10pt; font-family: 'Courier New'; color: black; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: white; background-position: initial initial; background-repeat: initial initial; ">’ null/not null,
…
瀛楁n 鏁版嵁綾誨瀷 default ‘榛樿鍊?span style="font-size: 10pt; font-family: 'Courier New'; color: black; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: white; background-position: initial initial; background-repeat: initial initial; ">’ null/not null,
)
鍒犻櫎瀛楁錛?/strong>
ALTER TABLE [琛ㄥ悕] DROP COLUMN [瀛楁鍚峕
淇敼瀛楁錛?/strong>
ALTER TABLE [琛ㄥ悕] ALTER COLUMN [瀛楁鍚峕 NVARCHAR (50) NULL
淇敼澶氫釜瀛楁
ALTER TABLE 琛ㄥ悕 modify(瀛楁1 default 'Y', 瀛楁2 default 'Y' null)
娉ㄦ剰錛氬鏋滆〃鐨勫瓧孌靛凡緇忔槸鍙互涓虹┖錛岄偅涔堜笉鑳介噸澶嶈緗負(fù)鍙互涓虹┖銆?br />
鏂板緩娉ㄩ噴
琛細(xì)comment on table 琛ㄥ悕 is '娉ㄩ噴';
瀛楁錛?nbsp; comment on column [鐢ㄦ埛鍚峕.琛ㄥ悕.瀛楁鍚?nbsp;is '娉ㄩ噴';
鍙傝冿細(xì)http://blog.csdn.net/liguihan88/archive/2008/09/30/3002403.aspx
DML
鎻掑叆鏁版嵁錛?/strong>
INSERT INTO [琛ㄥ悕] (瀛楁1,瀛楁2) VALUES (100,'51WINDOWS.NET')
鍒犻櫎鏁版嵁錛?/strong>
DELETE FROM [琛ㄥ悕] WHERE [瀛楁鍚峕>100
鏇存柊鏁版嵁錛?/strong>
UPDATE [琛ㄥ悕] SET [瀛楁1] = 200,[瀛楁2] = '51WINDOWS.NET' WHERE [瀛楁3] = 'HAIWA'
鍏朵粬
鏌ユ暟鎹簱鏌愪釜琛ㄧ殑鏌愪釜瀛楁鏄惁瀛樺湪
SELECT *
FROM Dba_Tab_Columns
WHERE table_name = 'TABLE_NAME'
AND column_name = 'COLUMN_NAME'
娉ㄦ剰琛ㄥ悕鍜屽瓧孌靛悕涓瀹氬ぇ灝忥紝鍚﹀垯鏌ユ壘涓嶅埌