我正在尝试使用两个表创建一个模式,稍后会向它们查询/添加数据。我正在使用StackExchange Data Explorer“T-SQL”:http://data.stackexchange.com/stackoverflow/query/new
以下是要求:
客户表:
unique account id,
Fname
Lname
create date
CustomerStatus 表(status
将说明待处理,有效或已取消):
unique record id
unique account id
string value named Status,
create date
其他要求:
这是我到目前为止所做的:
CREATE TABLE CUSTOMERS
(
ID INT NOT NULL,
FNAME VARCHAR (20) NOT NULL,
LNAME VARCHAR (20) NOT NULL,
)
CREATE TABLE CustomerStatus
(
recordID INT NOT NULL,
ID INT NOT NULL,
STATUS VARCHAR (10) NOT NULL,
)
答案 0 :(得分:0)
你不能在data explorer上这样做。
rextester演示:http://rextester.com/MOH19608
create table Customers(
id int not null identity(1,1) primary key,
fname varchar (20) not null,
lname varchar (20) not null,
);
create table CustomerStatus(
recordid int not null identity(1,1),
id int not null references Customers(id),
[status] varchar (10) not null,
);