SQLServer简单数据库表的建立

本文介绍了一个用于学生信息管理的数据库表创建过程。该表包括学号、姓名、性别等字段,利用SQL Server的批处理命令GO来提高执行效率。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

use StudentManagement
go 
if exists(select * from sysobjects where name = 'Students')
drop table Students
go
create table Students
(
StudentId int identity(10000,1) primary key,--自动标识列,系统自动生成,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(500),
ClassId int not null


)

go


简单说明:go是批处理的标志,表示SQLserver将这些SQL语句编译成一个执行单元,提高执行效率。go是SQLServer的批处理命令,只有代码编辑器才能识别并处理,编辑其他应用程序就不能使用该命令。由于每个批处理之间是独立的,因此,在一个批处理出现错误时,并不影响其他批处理中SQL代码的执行。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值