在数据课程库中,课程表中周次的数据课程是通过开始周次和结束周次字段记录的,如何拆分成多条记录?

简单的数据查询: select 加字段名字 from 表位置对查询结果进行排序:select 字段名 from 表位置 order by需要排序的字段名(按照单词英文首字母)(加一个desc就是倒叙)先按照第一次字段排完序,再按照第二个字段排序 :select 字段名 from 表位置order by字段名1 asc ,字段名2desc(字段顺序会影响排序顺序)名字短前面,名字长后面:len() 这个关键字可以计算出有多少个字符select 字段名 from 表位置order by len(字段1) asc查询限制语句,例如查找10行:关键字topselect top 10 字段名 from 表位置 (查找10行)select top 10 percent 字段名 from 表位置 (查找百分之10)order by查询最贵的10行升序:select top 10 字段名 from 表位置order by list_price查询最贵的10行时,把最后一行都查询出来:select top 10 with ties 字段名 from表位置 order by list_priceOffset Fetch语句可以查询几条到几条:查找1-10行时:select top 10 字段名 from 表位置order by list_priceoffset 0 rows//从第1行开始 第一页fetch next 10 rows only查找11-20行时第二页:select top 10 字段名 from 表位置order by list_priceoffset 10 rows//从第11行开始fetch next 10 rows only公式:select 字段名 from 表位置order by 字段名offset (页-1)*10 rowsfetch next 10 rows only去重复distinct:select distinct 加字段名字 from 表位置orderf by 字段名(先排序出来)筛选一下字段不为空的信息:select*from 表位置where 字段 is not nullwhere phone=’1321523’//也可以直接查信息where 字段名=‘dsfsdf’ and 字段名=‘sdjf’//查询两种//数字可以用运算符and和or 或者 and的优先级比or的要大:select* from 表Where 字段<=3000 or 字段>=5000 and 字段2=2017Where 字段<=3000 or (字段>=5000 and 字段2=2017)//默认是这样的,因为and优先级高Where (字段<=3000 or 字段>=5000 )and 字段2=2017查找数值信息 in 关键字:select *from 表名where 字段名字 in(111,111)模糊查询 like:select *from 表名where 字段名 like’a%’where 字段名 like’_a%’ //第二个是字母awhere 字段名 like’__’ //单单查询两个字母where 字段名 like’[abcde]%’ ,[a-c] //匹配abcde中的其全部任意字符查找不是abc的where 字段名 not like’[a-c]%’where 字段名 like’[^a-c]%’ 两种写法}

我要回帖

更多关于 数据课程 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信