# # #. Using Functions in Query statements
@1. round (D1,D2) is used to round the number D1 to indicate the number of digits D2 after the decimal point (D2 does not write by default is 0)
@2. trunc (D1,D2) intercept the method of de-tail
@3. Date function sysdate
Select Sysdate from dual; ----Get the current time of the system
@4. Subtraction of date data, resulting in a number of days difference between two dates less than one day in decimal notation
@5. Months_between (d1,d2) get D1, d2 two date data difference between the month decimal representation
@6. Calculate the point in time before D2 months add_months (D1,D2) D1 as the date function D2 for the number of months
@7. Calculate the last day of this month Last_day (sysdate) from dual;
@8. Conversion function To_char (date data, format) converts date data into character data
Select To_char (sysdate, ' Yyyy-mm-dd hh24:mi:ss ') from dual;
Conversion function to_date () converts string data to date data in the specified format
@9. function coalesce (parameter list) returns the last value in the parameter list of the first non-null parameter in the argument list is usually a constant
The @10.case statement is the branch statement in the data that corresponds to the switch-case statement in Java
@11.decode function * *
The decode () function is a function in Oracle that is equivalent to a case-when statement in the same way as a case statement. The Decode function syntax is as follows: Decode (judging condition, match 1, value 1, match 2, value 2, ..., default value) The meaning is: if the condition = match 1, then the reusing return value 1 to determine the condition = match 2, then Reusing return value 2
Learn SQL Diary (ii)