sqlserver創建表


 1 --創建學員信息數據表
 2 use StudentManageDB
 3 go
 4  if exists(select * from sysobjects where name='Students')
 5 drop table Students
 6 go
 7 create table Students
 8 (
 9     StudentId int identity(10000,1),--學號
10     StudentName varchar(20) not null,--姓名
11     Gender char(2) not null,--性別
12     Birthday datetime not null,--出生日期
13     StudentIdNo numeric(18,0) not null,--身份證號
14     Age int not null,--年齡
15     PhoneNumber varchar(50),
16     StudentAddress varchar(500),
17     ClassId int  not null   --班級外鍵
18 )
19 go
20 --創建班級表
21 if exists(select * from sysobjects where name='StudentClass')
22 drop table StudentClass
23 go
24 create table StudentClass
25 (
26     ClassId int primary key,--班級編號
27     ClassName varchar(20) not null
28 )
29 go
30 --創建成績表
31 if exists(select * from sysobjects where name='ScoreList')
32 drop table ScoreList
33 go
34 create table ScoreList
35 (
36     Id int identity(1,1) primary key,
37     StudentId int not null,--學號外鍵
38     CSharp int null,
39     SQLServer int null,
40     UpdateTime datetime not null--更新時間
41 )
42 go
43 --創建管理員表
44 if exists(select * from sysobjects where name='Admins')
45 drop table Admins
46 go
47 create table Admins
48 (
49     LoignId int identity(1000,1) primary key,
50     LoginPwd varchar(20) not null,--登錄密碼
51     AdminName varchar(20) not null
52 )
53 go

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM