SQL 语法记录

xiaoxiao2021-02-27  339

1、高效清空表数据: truncate table

2、当a=b 返回null: nullif(a,b) 

3、简单的数据分页方法:select * from table order by col offset 5 rows fetch next 3 rows only

4、select choose(0, 'A','B','C')

5、月底:select EOMONTH(getdate())   ,EOMONTH(getdate() ,1) 

6、错位比较:select lag(cola,1,null) over (order by colb)  from  table ,lead反向

7、重复运行10次

select getdate() go 10

转载请注明原文地址: https://www.6miu.com/read-8350.html

最新回复(0)