Required SQL statements (vii) String functions, Time functions

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.