- 10
- 0
- 约 5页
- 2016-09-30 发布于贵州
- 举报
SQL Serer表与列别名,计算列等等的说明和例子
语句所用表说明
第一章:
1.select 语句中使用列别名
在select 语句中使用列别名的例子中利用的表是学生表(studenttable),学生表中有字段
studentid(学生学号) 从1开始自动增长1,主键,不可以为空。
studentname(学生姓名)不可以为空。
studentsex(学生性别)唯一约束,只能为男或者女,不可以为空。
studentage(学生年龄)唯一约束,年龄范围在10-35之间,不可以为空。
在select语句中使用列别名有四种使用方法:
(1)用as关键字
例:select studentid as 学号 from studenttale where studentname = ‘值’
(2)用双引号
例:select studentid “学号” from studenttable where studentname = ‘值’
(3)用单引号
例:select studentid ‘学号’ from studenttable where studentname =’值’
(4)不带引号
例:select studentid 学号 from studenttable where studentname =’值’
2.select 语句中使用计算列
在select语句中使用计算列利用的表是商品表(commoditytabl
原创力文档

文档评论(0)