-
去掉NULL的显示,列前加isnull(column name, '')查看全部
-
2代表的意思是按照第二个name(column列),来进行排列
查看全部 -
SELECT<table fields list>- FROM<table names list> WHERE<row constraints specification> GROUP BY<grouping specification>集合运算时需要添加的一些定义 HAVING<grouping selection specification>针对集合运算做出限制条件 ORDER BY<order rules specification>排序
查看全部 -
关系数据库查看全部
-
primary keys和foreign keys
查看全部 -
关系型数据库框架
查看全部 -
自由转换queries大小写
Edit-Advanced
查看全部 -
技巧-显示Line Number
查看全部 -
1、count 计数
2、distinct 去重
count(distinct(SalesPersonID))
3、avg 求平均,max\min\sum
4、点击某一行,注释选中行,添加--
5、普通column和max(column)连用,要使用 group by,否则出错
group by按指定的规则将数据分组。
6、having 与avg函数连用,不可与普通column连用,普通条件放在where后面
查看全部 -
1、where 有条件的从表中选取数据
select 列名 from 表名 where 列 运算符 值
运算符:=、>、<、>=、<=
字符型varchar加'',int型不用
2、and 运算符(连接的条件同时满足)
and 可在 where 子语句中把两个及以上的条件结合起来
A and B and C,between '2015-08-01' and '1/1/2016'--2种年月日的表示
or 运算符(连接的条件满足其一即可)
3、Where语句中使用like “%”“_”通配符
%模糊查询,where name like'%mountain%',前后可以有字符的name
where name like'mountain%',前面无字符的name
_模糊搜索 ,where name like'_ountain%'
4、in或者not in
where name in(属性一,属性二,属性三...),查询出满足3种属性的数据
where class not in ('H') -- 另一种用法<> 'H'(不等于H)
5、is null或者is not null
where size is not null
6、and和or同时使用时,and优先级高,先执行and语句再执行or语句
可以把or语句放在()中,优先级高于and
查看全部 -
1、默认正序排列,asc-正序,desc-倒序
2、order by 2表示按照select中的第个条件默认排序
3、isnull(行名,'') 目的是使值为null的元组在查询结果中以空白显示
4、as关键字:给表列起别名
5、+关键字:将列与字符串连接起来
6、算术表达式:+、-、*、/
小时工资*8h*5days*52weeks=年薪
Topic6中---round(rate*40*52,1),1表示小数点后四舍五入保留1位
----round(rate*40*52,0),0表示小数点后四舍五入直接进位到个位
算数运算符中()优先级最高
7、
查看全部 -
下载AdventureWorks2012.bak,数据还原为mdf文件
数据库右键-还原数据库-设备中选择bak文件-确定
查看全部 -
查询前先执行:use 数据库名 go
或者先选择数据库,再按F5或Execute
查看全部 -
SQL查询语句
查看全部 -
主键和外键
一个表的主键是某个表的外键
另一表的外键是某个表的主键
查看全部
举报