General functions of the database (mathematical functions, String functions, other functions)

Source: Internet
Author: User
Tags mathematical functions

2--Mathematical function 3 Select CEILING (COUNT (*)/5.0) from news--take the smallest integer greater than the result 4 select floor (COUNT (*)/5.0) from news--take the maximum integer less than the result 5 sel ECT SQRT (2)--Value open square 6 Select ROUND (3.45645,2) 7 Select ABS (-5): Absolute value function, take the absolute value of this number, can be applied to some chaotic values in the database of the addition and subtraction operations. 8 9--string function LOWER (' RGFRG ')--uppercase letters changed to lowercase letter by select LOWER (' Ggfgrt ')--lowercase letters to uppercase letters, select LTRIM ()--remove left word spaces lattice sel ECT RTRIM ()--Remove the right-hand space of the string, select Left (title,5) from news--the length of the string to intercept from a column (title,5) from news--a string from the right side of a column. Select SUBSTRING (title,3,5) from news--to intercept several characters from the first few characters of a column. Select REVERSE (Title) from News- -Flip a column select CHARINDEX (' China ', title) from News--the query target content does not appear in the specified area and appears in the location of the Select REPLACE (Title, ' China ', ' us ') from news--the replacement string. Example searches for keywords and significantly selects STUFF (title,3,4, ' Chine ') from News22 other functions (RAND () CEILING)--randomly generated numbers between 1 The range of random numbers can be multiplied by the number of select LEN (' Chine ')--take a string length of GETDATE ()--Gets the current time. Select year (sbirthday) from student--time of year Select Month (sbirthday) from student--date Time month (Sbirthday) from student3--take time daysElect datepart (Yy,sbirthday) from student4--Yy,mm,dd, respectively, represents the date of the year, and the select cast (' 123 ' as int)--Converts the string 

General functions of the database (mathematical functions, String functions, other 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.