Java Knowledge Summary-13

Source: Internet
Author: User
Tags benchmark month name natural logarithm square root value of pi

Set @aa = 77; Defines a variable AA value is 77 (when used directly @aa)
Select 7+8; Perform a simple arithmetic operation
Select @aa >78; The comparison is 1 false is 0
Select 66<>55 Test 66 is equal to 55;
Select @aa is not null; Test whether the variable AA is empty;
SEELCT @aa in (all in a) test whether the variable AA is in (
Select ' yyyy ' like '%yy_% ' tests whether two strings match
Process Control:
Select ' yyy ' regexp '/**/; Test whether a string conforms to a regular expression
Select BINARY "A" = "a"; Force a string to be a binary string this is an easy way to force columns to compare case-sensitive.
Select Ifnull (@ww, ' is null '); Ifnull (EXPR1,EXPR2) If EXPR1 is not Null,ifnull () returns EXPR1, otherwise it returns EXPR2.
>> Right Shift operation Select 4>>2; (<<)
Select if (@yy is not NULL, ' isn't null ', ' is null '); if (EXPR1,EXPR2,EXPR3) if Expr1 is true (expr1<>0 and Expr1<>null), then if () returns EXPR2, otherwise it returns EXPR3
Select Case @yy When 1 then was 1 ' when 2 Then ' was 2 ' else ' unknow ' end; Equivalent to Swatch


Mathematical:
Select ABS (-5); Absolute
sign (x) returns the symbol for the parameter, 1, 0, or 1, depending on whether X is negative, 0, or positive.
Select mod (5,3); Balance 5 to 3 (% is also applicable)
*************
Floor (X) returns the maximum integer value to force the rounding
CEILING (x) returns the smallest integer value that is not less than X. Force rounding
ROUND (X,a) Rounding A is the number of decimal digits after the operation
EXP (x) returns the X-square of the value E (the base of the natural logarithm).
Log (x) returns the natural logarithm of X
Power (x, y) returns the Y power of the value X.
Day
SQRT (x) returns the square root of a non-negative X.
Pi () returns the value of Pi (pi).
COS (x) returns the cosine of x, where x is given in radians.
SIN (x) returns the sinusoidal value of x, given in radians.
DEGREES (x) returns the parameter X, which is the angle from the radian transformation.
RADIANS (x) returns parameter x, converted from angle to radians
TRUNCATE (x,d) returns the number X, truncated to D decimal. If D is 0, select truncate (PI (), 2);

String:
ASCII (str) returns the ASCII code value of the leftmost character of the string str if passing in a string, only the value of the first character is returned
ORD (str) returns the ASCII value, or, if it is a non-ASCII character, a number is returned by a certain algorithm
Bin (number) returns the binary form of the numbers
HEX (N) returns the 16 binary form of the number
CHAR (N,...) CHAR () interprets the parameter as an integer and returns a string consisting of the ASCII code characters of these integers null skipped
Select CONCAT (' My ', ' S ', ' QL '); Compose a string
Length (str) returns the lengths of the strings
POSITION (substr in str) returns a substring substr the first occurrence of the string str (starting at 1), if SUBSTR is not inside STR, returns 0.
LOCATE (substr,str,pos) returns a substring substr the first occurrence of the string str, starting at position pos. If the substr is not inside STR, return 0.
Rpad (STR,LEN,PADSTR) returns the string str, and the right side is filled with a string padstr until Str is len characters long.
Left (Str,len) returns the leftmost Len character of the string str.
Right (Str,len) returns the rightmost Len character of the string str.
MID (Str,pos,len) returns a Len character substring from the string str, starting at position Pos
SUBSTRING (' AAA ', 1) substring (' AAA ' from 1) remove a substring from the string position 1 to the end
Make_set (BITS,STR1,STR2,...) returns a collection that consists of a string of substrings separated by "," characters, consisting of a string of corresponding bits in the bits collection.
UPPER (str)-converts all strings to uppercase characters

Date function:
Current_date returns today's date value in ' Yyyy-mm-dd ' or YYYYMMDD format,
Current_time returns the current time value in ' HH:MM:SS ' or HHMMSS format
Now ( /sysdate ()/current_timestamp returns the current time with ' Yyyy-mm-dd HH:MM:SS '
sec_to_time (seconds) returns the seconds parameter, changing to hours, minutes and seconds, with the value ' HH: Mm:ss ' or HHMMSS formatted, converts the seconds to time division seconds
Time_to_sec (time) to return the time parameter, converted to seconds.
***********
DAYOFWEEK (date) Select DAYOFWEEK (' 2017-8-9 '); Returns a date day of the week Index
Unix_timestamp () returns a UNIX timestamp (from ' 1970-01-01 00:00:00 ' GMT start of the number of seconds. The
DayOfMonth () return date (1-31)
DayOfYear (date) returns the number of days in a year, in the range of 1 to 366.
Month (date) returns the months of date with a range of 1 to
MONTHNAME (date) that returns the month name of date. For example: February February
QUARTER (date) returns the quarter of a date year, ranging from 1 to 4.
Year (date) returns the years of date, ranging from 1000 to 9999.
HOUR (Time) Select HOUR (' 10:05:03 '); Returns the hour of time, ranging from 0 to 23.
MINUTE (time) returns the minute of time, ranging from 0 to 59. The number of seconds that
SECOND (time) returns time, ranging from 0 to 59.


MySQL system functions:
If EXISTS exists
Show Processlist; Show All connections
Kill thread_id kills a thread with the kill thread_id command.
Select version (); Get the system version number
Desc Describe display information for a table
Select BENCHMARK (1000000,encode ("Hello", "Goodbye")); The BENCHMARK (count,expr) BENCHMARK () function repeats counttimes execution expression expr, which can be used to time how fast the MySQL processing expression is. The result value is always 0

#--*/* * Comment syntax--annotation style requires you to have at least one space after that!

CREATE [AGGREGATE] FUNCTION function_name RETURNS {string| real| INTEGER}
SONAME Shared_library_name

DROP FUNCTION function_name
Custom Function functions

Java Knowledge Summary-13

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.