这是MSSql版本的 没有多大智慧的成分,但是字段还不少
create table [User]
(
ID int identity(1,1) primary key,
Account varchar(16) unique not null,
Password varchar(48) not null,
Question nvarchar(50),
Answer nvarchar(50)
)
go
create table [Group]
(
ID int identity(1,1) primary key,
[Name] nvarchar(10),
UserID int foreign key references [User](ID)
)
go
create table [Card]
(
ID int identity(1,1) primary key,
[Name] nvarchar(10),
Nickname nvarchar(10),
Gender nvarchar(1),
QQ_MSN varchar(50),
UsedCellphone varchar(30),
StandCellphone varchar(30),
PHS varchar(30),
Work_phone varchar(30),
Home_phone varchar(30),
Other_phone varchar(30),
CommonMail varchar(50),
StandMail varchar(50),
CompanyZip varchar(10),
CompanyCountry nvarchar(20),
CompanyProvince nvarchar(20),
CompanyCity nvarchar(20),
CompanyStreet nvarchar(20),
ResidentialZip varchar(10),
ResidentialCountry nvarchar(20),
ResidentialProvince nvarchar(20),
ResidentialCity nvarchar(20),
ResidentialStreet nvarchar(20),
OtherZip varchar(10),
OtherCountry nvarchar(20),
OtherProvince nvarchar(20),
OtherCity nvarchar(20),
OtherStreet nvarchar(20),
CompanyName nvarchar(20),
UnderTheIndustry nvarchar(20),
DepartmentName nvarchar(15),
JobTitle nvarchar(10),
Birthday datetime,
Notes nvarchar(50),
GroupID int default(0)--foreign key references [Group](ID)
,UserID int foreign key references [User](ID)
)
这是MSAccess版本
create table [User]
(
ID autoincrement(1,1) primary key,
Account varchar(16) unique not null,
Password varchar(48) not null,
Question text(50),
Answer text(50)
)
create table [Group]
(
ID autoincrement(1,1) primary key,
[Name] text(10),
UserID int,
Constraint [FK_UserID] foreign key (UserID) references [User]
)
create table [Card]
(
ID autoincrement(1,1) primary key,
[Name] text(10),
Nickname text(10),
Gender text(1),
QQ_MSN varchar(50),
UsedCellphone varchar(30),
StandCellphone varchar(30),
PHS varchar(30),
Work_phone varchar(30),
Home_phone varchar(30),
Other_phone varchar(30),
CommonMail varchar(50),
StandMail varchar(50),
CompanyZip varchar(10),
CompanyCountry text(20),
CompanyProvince text(20),
CompanyCity text(20),
CompanyStreet text(20),
ResidentialZip varchar(10),
ResidentialCountry text(20),
ResidentialProvince text(20),
ResidentialCity text(20),
ResidentialStreet text(20),
OtherZip varchar(10),
OtherCountry text(20),
OtherProvince text(20),
OtherCity text(20),
OtherStreet text(20),
CompanyName text(20),
UnderTheIndustry text(20),
DepartmentName text(15),
JobTitle text(10),
Birthday datetime,
Notes text(50),
GroupID int,
UserID int,
Constraint FK_UserID foreign key (UserID) references User
)
找不到怎么写默认值(Card.GroupID 默认值为0)
代码都是人工的
access相关的
http://access911.net
access中的Constraint 主外键,默认值,check等
http://office.microsoft.com/zh-cn/access/HA012314372052.aspx
access字段类型
http://www.linux-cn.com/html/database/Access/20070523/41799.html
create table [User]
(
ID int identity(1,1) primary key,
Account varchar(16) unique not null,
Password varchar(48) not null,
Question nvarchar(50),
Answer nvarchar(50)
)
go
create table [Group]
(
ID int identity(1,1) primary key,
[Name] nvarchar(10),
UserID int foreign key references [User](ID)
)
go
create table [Card]
(
ID int identity(1,1) primary key,
[Name] nvarchar(10),
Nickname nvarchar(10),
Gender nvarchar(1),
QQ_MSN varchar(50),
UsedCellphone varchar(30),
StandCellphone varchar(30),
PHS varchar(30),
Work_phone varchar(30),
Home_phone varchar(30),
Other_phone varchar(30),
CommonMail varchar(50),
StandMail varchar(50),
CompanyZip varchar(10),
CompanyCountry nvarchar(20),
CompanyProvince nvarchar(20),
CompanyCity nvarchar(20),
CompanyStreet nvarchar(20),
ResidentialZip varchar(10),
ResidentialCountry nvarchar(20),
ResidentialProvince nvarchar(20),
ResidentialCity nvarchar(20),
ResidentialStreet nvarchar(20),
OtherZip varchar(10),
OtherCountry nvarchar(20),
OtherProvince nvarchar(20),
OtherCity nvarchar(20),
OtherStreet nvarchar(20),
CompanyName nvarchar(20),
UnderTheIndustry nvarchar(20),
DepartmentName nvarchar(15),
JobTitle nvarchar(10),
Birthday datetime,
Notes nvarchar(50),
GroupID int default(0)--foreign key references [Group](ID)
,UserID int foreign key references [User](ID)
)
create table [User]
(
ID autoincrement(1,1) primary key,
Account varchar(16) unique not null,
Password varchar(48) not null,
Question text(50),
Answer text(50)
)
create table [Group]
(
ID autoincrement(1,1) primary key,
[Name] text(10),
UserID int,
Constraint [FK_UserID] foreign key (UserID) references [User]
)
create table [Card]
(
ID autoincrement(1,1) primary key,
[Name] text(10),
Nickname text(10),
Gender text(1),
QQ_MSN varchar(50),
UsedCellphone varchar(30),
StandCellphone varchar(30),
PHS varchar(30),
Work_phone varchar(30),
Home_phone varchar(30),
Other_phone varchar(30),
CommonMail varchar(50),
StandMail varchar(50),
CompanyZip varchar(10),
CompanyCountry text(20),
CompanyProvince text(20),
CompanyCity text(20),
CompanyStreet text(20),
ResidentialZip varchar(10),
ResidentialCountry text(20),
ResidentialProvince text(20),
ResidentialCity text(20),
ResidentialStreet text(20),
OtherZip varchar(10),
OtherCountry text(20),
OtherProvince text(20),
OtherCity text(20),
OtherStreet text(20),
CompanyName text(20),
UnderTheIndustry text(20),
DepartmentName text(15),
JobTitle text(10),
Birthday datetime,
Notes text(50),
GroupID int,
UserID int,
Constraint FK_UserID foreign key (UserID) references User
)
代码都是人工的
access相关的
http://access911.net
access中的Constraint 主外键,默认值,check等
http://office.microsoft.com/zh-cn/access/HA012314372052.aspx
access字段类型
http://www.linux-cn.com/html/database/Access/20070523/41799.html