创建数据表
一、使用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
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步