首页 > 其他 > 详细

创建数据表

时间:2019-11-04 09:44:16      阅读:76      评论:0      收藏:0      [点我收藏+]

一、使用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

 

创建数据表

原文:https://www.cnblogs.com/xulinjun/p/11790232.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!