您的位置:首页 > 博客中心 > 数据库 >

数据库2014年6月10日11:13:10

时间:2022-03-10 17:33

SQL语句创建数据库:

create table student(id int not null primary key
,number nvarchar not null
,name nvarchar not null
,brithday DateTime default getdate()
, adress nvarchar )

创建一个学生表,主键为id,not null 表示不为空,default getdate()表示设定默认值为当前时间。

空值处理函数:select isnull (Name,‘佚名‘) as 姓名 from Employee---Name列中有null则变为佚名处理。

局部变量:先声明再赋值---declare @变量名 数据类型;-------declare @name nvarchar(50)。赋值有两种方式【1】set @变量名=值--------用于普通赋值。【2】 select @变量名=值--------用于从表中查询到数据并赋值---------select @name=title from book where id=2!

全局变量:系统变量,全局变量必须以@@作为前缀,比如@@version(SQL Server的版本)-----全局变量由系统定义和维护,我们只能读取,不能修改全局变量的值。--------@@identity,最后一次插入的标识值(SQLhelper有其使用)。

SQL server中的if else语句:

gxlsystem.com,布布扣

 

 

数据库2014年6月10日11:13:10,布布扣,bubuko.com

热门排行

今日推荐

热门手游