下列与修改表结构相关的命令是( )。
A.INSERT
B.ALTER
C.UPDATE
D.CREATE
参考答案:B
解析: 修改表结构的命令是ALTER TABLE,该命令有3种格式。
①ALTER TABLE TableName1 ADD I ALTER[COLUMN]FieldName1
FieldTvpe[(nFieldWidth[nPrecismn])][NULL I NOT NULL]
[CHECK 1 Expression1[ERROR cMessageTextL1][DEFAULTeExpression1]
[PRIMARYKEYKEY | UNIQUE]
[REFERENC:ES TableName2[TAG TagName]]
②ALTERTABLE TableNamel ALTER[COLUMN]FieldName2[NULL| NOT NULL]
[SET DELAULT eExpression2][SET CHECK 1Expression2[ERRORcMessageText2]
[DROP DEFAULT][DROP CHECK]
③ALTER TABLE TableName1[DROP[COLUMN]FieldName3]
[SET CHECK 1 Expression3[ERROR cMessageText3]]
[DROP CHECK]
[ADD PRIMARY KEY eExpression3 TAG TagName2[FOR1Expression4]]
[DROP PRIMARY KEY)
[ADD UNIQUE eExpression4[TAG TagName3[FOR 1Expressions]]]
[DROP UNIQUE TAG TagName4]
[ADD FOREIGN KEY[eExpression5]TAG TagName4[FOR 1Expression6]
REFERENCES TableName2[TAG TagNames]]
[DROP FOREIGN KEY TAG TagName6[SAVE]]
[RENAME COLUMN FieldName4 TO FieldName5]