SELECT CONVERT(varchar(100), GETDATE(), 23) AS  日期
  结果:2017-01-05
 
  select ISNULL(price,'0.0')   FROM table  
  将表中为null的值变成0.0
 
  
  select * from [DBData].[dbo].[T_Student] where [Name]='LILEI'
  等效于:
    select * from [DBData].[dbo].[T_Student] where [Name]='lilei'
  
  
  select [Name],MAX(Score),AVG(Score) FROM [DBData].[dbo].[T_Student] group by Name order by Name
 
  注意:聚合函数忽略空值数据
 
 
SQL中常用函数
 
 
SQL中开窗函数OVER():
作用:
1、为每条数据显示聚合信息(聚合函数);
2、为每条数据提供分组的聚合函数结果(聚合函数() over(PARTITION BY 字段)  as 别名);
3、与排名函数一起使用 (ROW_NUMBER() over(order by 字段) as 别名)

相关文章:

  • 2022-01-13
  • 2021-05-17
  • 2021-08-31
猜你喜欢
  • 2021-12-20
  • 2022-01-16
  • 2022-03-05
  • 2021-11-08
  • 2021-08-12
  • 2021-12-08
  • 2022-01-01
相关资源
相似解决方案