String Functions1. Case conversion--upper converted to uppercase--lower convert to lowercase select upper (' AsaR ') 2. Length--len number of words--datalength bytes 3. Space before and after removal-- RTrim Remove the right space--ltrim remove the left Space 4. String intercept--left (' string ', 15) intercept 15 bytes from the left--right (' string ', 15) intercept 15 bytes from the right start--substring (' string ', 5,5) starts at the 5th byte on the left and intercepts 5 bytes of 5. Replace--replace (' You ', ' You ', ' me ') to replace you with us
Time Function1. Get current date--getdate () 2.1 days after--dateadd (Day,100,getdate ()) 3. Time difference function--dateiff (year, ' 1990/10/11 ', GETDATE ()) 4. Query Date--year (time) Gets the year--month (time) Gets the month--day (time) Gets the day ————————————————--calculates the number of births in each year select years (birthday), COUNT (* From table group by year ([birthday]) 5. Gets the year, month, day, time, minute, and second of the date datepart (years, date)datepart (month, date) datepart (day, date) datepart (hour, date) datepart (minute, date) datepart (second, date)
Required SQL statements (vii) String functions, Time functions