创建数据表

一、使用sql语句创建数据表

1、学生表

use StudentManageDB
go
if exists(select * from sysobjects where name='Students')
drop table Students
go
create table Students
(
    StudentId int identity(10000,1),--学号
    StudentName varchar(20) not null,--姓名
    Gender char(2) not null,--性别
    Birthday datetime not null,--出生日期
    StudentIdNo numeric(18,0) not null,--身份证号
    Age int not null,--年龄
    PhoneNumber varchar(50),--电话号码
    StudentAddress varchar(200),--地址
    ClassId int not null--班级
)
go

 2、班级表

if exists(select * from sysobjects where name='StudentClass')
drop table StudentClass
go
create table StudentClass
(
    ClassId int primary key,--班级编号
    ClassName varchar(30) not null--班级名称
)
go

 

3、成绩表

if exists(select * from sysobjects where name='ScoreList')
drop table ScoreList
go
create table ScoreList
(
    Id int identity(1,1) primary key,
    StudentId int not null,--学生外键
    CSharp int null,
    SQLServer int null,
    UpdateTime datetime not null--更新时间
)
go

 

4、管理员表

--创建管理员表
if exists(select * from sysobjects where name='Admins')
drop table Admins
go
create table Admins
(
    LoginId int identity(10000,1) primary key,
    LoginPwd varchar(20) not null,--登陆密码
    AdminName varchar(20) not null
)
go

 

posted @ 2019-11-04 08:12  徐林俊  阅读(177)  评论(0编辑  收藏  举报