第九章

SELECT TOP 1000 [Id]
      ,[StudentNo]
      ,[SubjectId]
      ,[StudentResult]
      ,[ExamDate]
  FROM [MySchool].[dbo].[Result]
  select ExamDate,GETDATE()as 日期 from dbo.Result
  select ExamDate, DATEADD(mm,4, GETDATE()) as 日期 from dbo.Result
  select ExamDate,datediff(mm,2013-09-13, GETDATE()) as 数 from dbo.Result
  select ExamDate, datename(dw,GETDATE())as 日期 from dbo.Result
  select ExamDate,DATEPART(day, GETDATE())from dbo.Result
  数学函数:
  select RAND()as 随机数,ABS(-43)as 绝对值,CEILING(5.666666)as 向下取最小整数,FLOOR(43.6)as 向上取整,
         POWER(5,3)as 幂值,ROUND(43.643,2)as 四舍五入指定位数,SIGN(-1)as 返回,sqrt(4)
  系统函数:
  select  convert(varchar(5),12345)as返回字符串型,CURRENT_USER,datalength('我'), host_name(),USER_NAME(1)   


 

FROM [MySchool].[dbo].[Student]
  select StudentName from dbo.Student
  where  Sex='女'
  select StudentName as 姓名 ,Address as 住址 from dbo.Student
  where Sex='男' 
  select StudentName as 姓名,GradeId as 年级 from dbo.Student
  where Email is null
  select BornDate as 日期,Address as 地址 from dbo.Student
  where  BornDate='1995-01-22 00:00:00.000' and GradeId='1'
  


 

你可能感兴趣的:(第九章)