首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

6.sql server 中distinct,and,between and的用法

2012-11-20 
六.sql server 中distinct,and,between and的用法以tb_Teachers_info教师信息表为例 :Distinct意思为不同

六.sql server 中distinct,and,between and的用法

以tb_Teachers_info教师信息表为例 :

6.sql server 中distinct,and,between and的用法

Distinct意思为不同的 , 语句格式SELECT DISTINCT "栏位名" 
FROM "表格名"

1.      从教师信息表中选择不同姓名的教师姓名

SQL 语句:select distinct TeachersNamefromtb_Teachers_info;

输出结果:

6.sql server 中distinct,and,between and的用法

从上述例子中不难看出distinct是排除 相同的教师姓名

                                 ‘ and’  是表示一个并列条件,即匹配and前后的两个条件才行

2.      从教师信息表中选出姓名为’Joe’并且来自美国的教师信息

SQL 语句:select*fromtb_Teachers_info where  TeachersName='Joe'and City='American';

输出结果:

6.sql server 中distinct,and,between and的用法

3.      从教师信息表中选出年龄在23-24之间的老师信息

SQL 语句: select *from tb_Teachers_infowhereTeachersAgebetween 23and24;

输出结果:

6.sql server 中distinct,and,between and的用法

下一节  Sql  server alias(别名)的用法


热点排行