Home >Database >Mysql Tutorial >ALTER TABLE ADD 增加多个字段 外键约束
ALTER TABLE ADD 增加多个字段 外键约束 TABLE_USER( ( 1 , 1 ) NOT NULL , , LAST_UPDATED_BY NVARCHAR ( 15 ), LAST_UPDATED_DATE DATETIME , CONSTRAINT USER_PK PRIMARY KEY ( USER_ID )); TABLE_USER ADD DEPARTMENT_ID ,COMPANY_ID ,TEMP_COL NVARCHAR
ALTER TABLE ADD 增加多个字段 外键约束
TABLE_USER ( (1,1) NOT NULL, , LAST_UPDATED_BY NVARCHAR(15), LAST_UPDATED_DATE DATETIME, CONSTRAINT USER_PK PRIMARY KEY (USER_ID) ); TABLE_USER ADD DEPARTMENT_ID ,COMPANY_ID ,TEMP_COL NVARCHAR(10) ; TABLE_USER (DEPARTMENT_ID) REFERENCES TABLE_DEPARTMENT(DEPARTMENT_ID) ,CONSTRAINT USER_COMPANY_FK FOREIGN KEY(COMPANY_ID) REFERENCES TABLE_COMPANY(COMPANY_ID) ; TABLE_USER DROP COLUMN TEMP_COL;
posted on
Powered by:
博客园
Copyright © freeliver54