码迷,mamicode.com
首页 > 其他好文 > 详细

创建数据表

时间:2019-11-04 09:59:01      阅读:102      评论:0      收藏:0      [点我收藏+]

标签:nbsp   address   学生   号码   ber   objects   use   char   min   

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

 

创建数据表

标签:nbsp   address   学生   号码   ber   objects   use   char   min   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!