create database MC120203207
create table employee
(
id varchar (15) not null,
Name nvarchar (50) not null,
Address nvarchar (75) not null,
DoB date not null,
primary key(id)
);
create table Payroll
(
id varchar (10)not null,
Allowances float not null,
Msalary float not null,
References employee(id),
primary key(id)
);
create table Hourly
(
id varchar (10)not null,
HourlyRate float not null,
References employee(id),
primary key (id)
);
Create Table Projects
(
id varchar (10) not null,
Code int (10) not null,
Description varchar (50) not null,
primary key (code)
);
Insert into employee (id, name, address, DoB) values ('MC120203207', 'Aurang Zeb Khan', 'Bannu', 27-02-1980)
Insert into employee (id, name, address, DoB) values ('BC120201875', 'Alam Zeb Khan', 'Bannu', 02-08-1992)
有在查詢一個問題,請大家幫忙解決它......它顯示的信息SQL查詢錯誤有助於解決
消息142,級別15,狀態2,0行
'TABLE'約束定義的語法不正確。Msg 142,Level 15,State 2,Line 0
定義'TABLE'約束的語法不正確。
你沒有定義任何** **列在'Payroll'或'Hourly'引用'employee.id'!嘗試:'僱員VARCHAR(15)引用員工(ID)' – 2015-02-11 06:09:18