Home  >  Article  >  Database  >  ALTER TABLE ADD 增加多个字段 外键约束

ALTER TABLE ADD 增加多个字段 外键约束

WBOY
WBOYOriginal
2016-06-07 17:44:383753browse

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

,网站空间,香港服务器租用,香港服务器租用
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn