日期:2014-05-17 浏览次数:20417 次
create table dept
(
dept_ID int primary key,
dept_address nvarchar(50)
)
create table emp
(
emp_ID int primary key constraint FK_emp_constraint not null,
emp_name nvarchar(10) not null,
emp_sex nvarchar(1),
emp_age int,
emp_salary int check (emp_salary>100 and emp_salary<350),
dept_ID int constraint FK_dept_constraint foreign key references dept(dept_ID)
)
INSERT INTO dbo.dept
( dept_ID, dept_address )
VALUES ( 1, -- dept_ID - int
N'aa' -- dept_address - nvarchar(50)
)
INSERT dbo.emp
( emp_ID ,
emp_name ,
emp_sex ,
emp_age ,
emp_salary ,
dept_ID