MySQL function explanation (MySQL function encyclopedia) _mysql

Source: Internet
Author: User
Tags local time modifiers month name ord rtrim file permissions
For operations on string positions, the first position is marked as 1.
ASCII (str)
Returns the ASCII code value of the leftmost character of the string str. If Str is an empty string, returns 0. If STR is NULL, returns NULL.
Mysql> Select ASCII (' 2 ');
-> 50
Mysql> Select ASCII (2);
-> 50
Mysql> Select ASCII (' DX ');
-> 100
You can also see the Ord () function.
ORD (str)
If the string str leftmost character is a multibyte character, by using the format (the *256+ (the second byte ASCII code)) [*256+third byte ASCII code ...] Returns the ASCII code value of the character to return the multibyte character code. If the leftmost character is not a multibyte character. Returns the same value returned with the ASCII () function.
Mysql> Select ORD (' 2 ');
-> 50
CONV (N,from_base,to_base)
Transforms a number between different numeric bases. Returns a string number for the number n, from the From_base base transformation to the to_base base, or null if any argument is null. Parameter n is interpreted as an integer, but can be specified as an integer or a string. The minimum base is 2 and the largest base is 36. If To_base is a negative number, n is considered to be a signed digit, otherwise n is treated as unsigned. Conv work with 64-bit precision.
Mysql> Select CONV ("a", 16,2);
-> ' 1010 '
Mysql> Select CONV ("6E", 18,8);
-> ' 172 '
Mysql> Select CONV ( -17,10,-18);
-> '-h '
Mysql> Select CONV (10+ "ten" + ' +0xa,10,10 ');
-> ' 40 '
BIN (N)
Returns a string representation of the binary value N, where n is a long integer (BIGINT) number, which is equivalent to Conv (n,10,2). If n is null, returns NULL.
Mysql> Select BIN (12);
-> ' 1100 '
OCT (N)
Returns the representation of a string of octal value N, where n is a long integer number, which is equivalent to Conv (n,10,8). If n is null, returns NULL.
Mysql> Select OCT (12);
-> ' 14 '
HEX (N)
Returns the hexadecimal value n the representation of a string, where n is a long integer (BIGINT) number, which is equivalent to Conv (n,10,16). If n is null, returns NULL.
Mysql> Select HEX (255);
-> ' FF '
CHAR (N,...)
CHAR () interprets the argument as an integer and returns a string consisting of the ASCII code characters of these integers. The null value is skipped.
Mysql> Select CHAR (77,121,83,81, ' 76 ');
-> ' MySQL '
Mysql> Select CHAR (77,77.3, ' 77.3 ');
-> ' MMM '
CONCAT (STR1,STR2,...)
Returns a string from the argument's link. Returns null if any argument is null. can have more than 2 parameters. A numeric parameter is transformed into an equivalent string form.
Mysql> Select CONCAT (' My ', ' S ', ' QL ');
-> ' MySQL '
Mysql> Select CONCAT (' My ', NULL, ' QL ');
-> NULL
Mysql> Select CONCAT (14.3);
-> ' 14.3 '
LENGTH (str)
 
Octet_length (str)
 
Char_length (str)
 
Character_length (str)
Returns the length of the string str.
Mysql> Select LENGTH (' text ');
-> 4
Mysql> Select Octet_length (' text ');
-> 4
Note that for multibyte characters, its char_length () is evaluated only once.
LOCATE (SUBSTR,STR)
 
POSITION (substr in str)
Returns the substring substr the first occurrence of the string str, if SUBSTR is not inside STR, returns 0.
Mysql> Select LOCATE (' Bar ', ' Foobarbar ');
-> 4
Mysql> Select LOCATE (' Xbar ', ' foobar ');
-> 0
The function is multiple-byte reliable.
LOCATE (Substr,str,pos)
Returns the substring substr the position of the first occurrence of the string str, starting at the location POS. If SUBSTR is not inside STR, return 0.
Mysql> Select LOCATE (' Bar ', ' Foobarbar ', 5);
-> 7
This function is multibyte-reliable.
INSTR (STR,SUBSTR)
Returns the position of the substring substr the first occurrence in string str. This is the same as the locate () with 2 parameter forms, except that the parameters are reversed.
Mysql> Select INSTR (' Foobarbar ', ' Bar ');
-> 4
Mysql> Select INSTR (' Xbar ', ' foobar ');
-> 0
This function is multibyte-reliable.
Lpad (STR,LEN,PADSTR)
Returns the string str, and the left is filled with a string padstr until Str is len characters long.
Mysql> Select Lpad (' Hi ', 4, '?? ');
-> '?? Hi
Rpad (STR,LEN,PADSTR)
Returns the string str, and the right is filled with a string padstr until Str is len characters long.
Mysql> Select Rpad (' Hi ', 5, '? ');
-> ' Hi??? '
Left (Str,len)
Returns the leftmost Len character of the string str.
Mysql> Select Left (' Foobarbar ', 5);
-> ' Fooba '
The function is multiple-byte reliable.
Right (Str,len)
Returns the rightmost Len character of the string str.
Mysql> Select Right (' Foobarbar ', 4);
-> ' Rbar '
The function is multiple-byte reliable.
SUBSTRING (Str,pos,len)
 
SUBSTRING (str from POS for Len)
 
MID (Str,pos,len)
Returns a substring of Len characters from String str, starting at position pos. The variant form using from is the ANSI SQL92 syntax.
Mysql> Select SUBSTRING (' quadratically ', 5,6);
-> ' Ratica '
The function is multiple-byte reliable.
SUBSTRING (Str,pos)
 
SUBSTRING (str from POS)
Returns a substring from the starting position of string Str.
Mysql> Select SUBSTRING (' quadratically ', 5);
-> ' ratically '
Mysql> Select SUBSTRING (' Foobarbar ' from 4);
-> ' Barbar '
The function is multiple-byte reliable.
Substring_index (Str,delim,count)
Returns a substring of Delim after the occurrence of the delimiter from the count of string str. If Count is a positive number, returns all characters from the last separator to the left (from the left). If count is a negative number, returns the last separator to all characters on the right (from the right).
Mysql> Select Substring_index (' www.mysql.com ', '. ', 2);
-> ' Www.mysql '
Mysql> Select Substring_index (' www.mysql.com ', '. ',-2);
-> ' mysql.com '
This function is reliable for multiple bytes.
LTRIM (str)
Returns the string str whose preceding space character was deleted.
Mysql> Select LTRIM (' Barbar ');
-> ' Barbar '
RTRIM (str)
Returns the string str whose trailing space character has been deleted.
Mysql> Select RTRIM (' Barbar ');
-> ' Barbar '
This function is reliable for multiple bytes.
TRIM ([[BOTH | Lea
DING | Trailing] [REMSTR] from] str)
Returns the string str with all of its remstr prefixes or suffixes removed. If no modifiers both, leading, or trailing are given, the both is assumed. If the REMSTR is not specified, the space is deleted.
Mysql> Select TRIM (' Bar ');
-> ' Bar '
Mysql> Select TRIM (Leading ' x ' from ' xxxbarxxx ');
-> ' barxxx '
Mysql> Select TRIM (BOTH ' x ' from ' xxxbarxxx ');
-> ' Bar '
Mysql> Select TRIM (Trailing ' xyz ' from ' barxxyz ');
-> ' Barx '
This function is reliable for multiple bytes.
SOUNDEX (str)
Returns a homonym string for str. The 2 strings that sound "roughly the same" should have the same homonym string. A "standard" homonym string length is 4 characters, but the SOUNDEX () function returns an arbitrarily long string. You can use SUBSTRING () in the results to get a "standard" of the homophonic string. All non-numeric alphabetic characters are ignored in the given string. All characters outside A-Z are treated as vowels.
Mysql> Select SOUNDEX (' Hello ');
-> ' H400 '
Mysql> Select SOUNDEX (' quadratically ');
-> ' Q36324 '
Space (N)
Returns a string consisting of n white space characters.
Mysql> Select space (6);
-> '
REPLACE (STR,FROM_STR,TO_STR)
Returns the string str, where all occurrences of the string from_str are replaced by string to_str.
Mysql> Select REPLACE (' www.mysql.com ', ' w ', ' Ww ');
-> ' WwWwWw.mysql.com '
This function is reliable for multiple bytes.
REPEAT (Str,count)
Returns a string of string str that is repeated counttimes times. If Count <= 0, returns an empty string. Returns null if STR or count is null.
Mysql> Select REPEAT (' MySQL ', 3);
-> ' Mysqlmysqlmysql '
REVERSE (str)
Returns the string str of the reversed character order.
Mysql> Select REVERSE (' abc ');
-> ' CBA '
This function is reliable for multiple bytes.
INSERT (STR,POS,LEN,NEWSTR)
Returns the string str, the substring at the beginning of the position Pos and the Len character long substring is replaced by the string newstr.
Mysql> Select INSERT (' Quadratic ', 3, 4, ' What ');
-> ' quwhattic '
This function is reliable for multiple bytes.
ELT (N,STR1,STR2,STR3,...)
If n= 1, return str1, if n= 2, return str2, and so on. Returns NULL if n is less than 1 or greater than the number of arguments. ELT () is a field () inverse operation.
Mysql> Select ELT (1, ' ej ', ' Heja ', ' Hej ', ' foo ');
-> ' EJ '
Mysql> Select ELT (4, ' ej ', ' Heja ', ' Hej ', ' foo ');
-> ' foo '
FIELD (STR,STR1,STR2,STR3,...)
Back to Str in str1, str2, STR3, ... The index of the manifest. If STR is not found, return 0. FIELD () is an ELT () inverse operation.
Mysql> Select FIELD (' EJ ', ' Hej ', ' ej ', ' Heja ', ' Hej ', ' foo ');
-> 2
Mysql> Select FIELD (' fo ', ' Hej ', ' ej ', ' Heja ', ' Hej ', ' foo ');
-> 0
Find_in_set (Str,strlist)
If string str returns a value of 1 to N in the table strlist composed of n substrings. A string table is a string consisting of "," separated substrings. If the first argument is a constant string and the second argument is a column of type set, the Find_in_set () function is optimized and the bitwise operation is used! If STR is not inside the strlist or if Strlist is an empty string, return 0. Returns null if any one of the arguments is null. If the first argument contains a "," the function will not work correctly.
mysql> SELECT find_in_set (' B ', ' a,b,c,d ');
-> 2
Make_set (BITS,STR1,STR2,...)
Returns a collection containing a string of substrings separated by the "," character, consisting of a string of corresponding bits in the bits collection. STR1 corresponds to bit 0,str2 corresponding bit 1, and so on. In str1, str2, ... The null string in is not added to the result.
Mysql> SELECT make_set (1, ' A ', ' B ', ' C ');
-> ' a '
Mysql> SELECT make_set (1 | 4, ' hello ', ' nice ', ' world ');
-> ' Hello,world '
mysql> SELECT make_set (0, ' a ', ' B ', ' C ');
-> '
Export_set (Bits,on,off,[separator,[number_of_bits]])
Returns a string, where you get an "on" string for each bit in "bits", and you get a "off" string for each reset (reset) bit. Each string is delimited by "separator" (Default ",") and Only "Number_of_bits" (default 64) bits of "bits" are used.
Mysql> Select Export_set (5, ' Y ', ' N ', ', ', ', ', ', ', 4)
-> Y,n,y,n
LCASE (str)
 
LOWER (str)
Returns the string str, which changes all characters to lowercase according to the current character set mapping (default is Iso-8859-1 Latin1). This function is reliable for multiple bytes.
Mysql> Select LCASE (' quadratically ');
-> ' quadratically '
UCASE (str)
 
UPPER (str)
Returns the string str, which changes all characters to uppercase according to the current character set mapping (default is Iso-8859-1 Latin1). This function is reliable for multiple bytes.
Mysql> Select UCASE (' Hej ');
-> ' HEJ '
This function is reliable for multiple bytes.
Load_file (file_name)
Reads the file and returns the contents of the file as a string. Files must be on the server, you must specify the full pathname to the file, and you must have file permissions. The file must all content be readable and less than max_allowed_packet. The function returns null if the file does not exist or because one of the above reasons cannot be read out.
Mysql> UPDATE table_name
SET blob_column=load_file ("/tmp/picture")
WHERE id=1;
MySQL automatically transforms numbers into strings when necessary, and vice versa:
Mysql> Select 1+ "1";
-> 2
Mysql> SELECT CONCAT (2, ' test ');
-> ' 2 test '
If you want to explicitly transform a number into a string, pass it as a parameter to Concat ().
If the string function provides a binary string as a parameter, the resulting string is also a binary string. A number that is transformed into a string is treated as a binary string. This only affects the comparison

MySQL Time function Usage collection

Here is an example of using a date function. The following query selects all records and its date_col value is within the last 30 days:
Mysql> SELECT something from table
WHERE To_days (now ())-To_days (Date_col) <= 30;
DayOfWeek (date)
Returns the week index of date (1= Sunday, 2 = Monday, ...). 7= Saturday). These index values correspond to ODBC standards.
Mysql> Select DayOfWeek (' 1998-02-03 ');
-> 3
Weekday (date)
Returns the week index of date (0= Monday, 1 = Tuesday, ...). 6= Sunday).
Mysql> Select Weekday (' 1997-10-04 22:23:00 ');
-> 5
Mysql> Select Weekday (' 1997-11-05 ');
-> 2
DayOfMonth (date)
Returns the date in the month of date, in the range 1 through 31.
Mysql> Select DayOfMonth (' 1998-02-03 ');
-> 3
DayOfYear (date)
Returns the number of days in a year, in the range of 1 to 366.
Mysql> Select DayOfYear (' 1998-02-03 ');
-> 34
MONTH (date)
Returns the month of date, ranging from 1 to 12.
Mysql> Select MONTH (' 1998-02-03 ');
-> 2
Dayname (date)
Returns the name of the week of date.
Mysql> Select Dayname ("1998-02-05");
-> ' Thursday '
MonthName (date)
Returns the month name of the date.
Mysql> Select MonthName ("1998-02-05");
-> ' February '
Quarter (date)
Returns the quarter of date one year, ranging from 1 to 4.
Mysql> Select quarter (' 98-04-01 ');
-> 2
WEEK (date)

WEEK (Date,first)
For Sunday is the first day of the week, there is a single parameter that returns the week number of date, ranging from 0 to 52. 2 Parameter Form week () allows you to specify whether the week starts in Sunday or Monday. If the second argument is 0, the week begins in Sunday, if the second parameter is 1, starting from Monday.
Mysql> Select WEEK (' 1998-02-20 ');
-> 7
Mysql> Select WEEK (' 1998-02-20 ', 0);
-> 7
Mysql> Select WEEK (' 1998-02-20 ', 1);
-> 8
Year (date)
Returns the year of date, ranging from 1000 to 9999.
Mysql> Select year (' 98-02-03 ');
-> 1998
HOUR (Time)
Returns the hour of time, ranging from 0 to 23.
Mysql> Select HOUR (' 10:05:03 ');
-> 10
MINUTE (Time)
Returns the minutes of time, ranging from 0 to 59.
Mysql> Select MINUTE (' 98-02-03 10:05:03 ');
-> 5
SECOND (Time)
The number of seconds to return time, ranging from 0 to 59.
Mysql> Select SECOND (' 10:05:03 ');
-> 3
Period_add (P,n)
Increase n months to phase p (in format Yymm or yyyymm). Returns a value in YYYYMM format. Note that the phase parameter p is not a date value.
Mysql> Select Period_add (9801,2);
-> 199803
Period_diff (P1,P2)
Returns the number of months between periods P1 and P2, P1 and P2 should be in a format yymm or yyyymm. Note that the time parameter P1 and P2 are not date values.
Mysql> Select Period_diff (9802,199703);
-> 11
Date_add (Date,interval expr type)

Date_sub (Date,interval expr type)

Adddate (Date,interval expr type)

Subdate (Date,interval expr type)
These functions perform date operations. For MySQL 3.22, they are new. Adddate () and subdate () are synonyms for Date_add () and Date_sub ().
In MySQL 3.23, you can use + and-instead of Date_add () and Date_sub (). (see example) date is a specified start date
datetime or Date value, expr is an expression that specifies an interval value that is added to the start date or subtracted from the start date, and expr is a string;
A "-" start represents a negative interval. Type is a keyword that indicates how an expression should be interpreted. EXTRACT (type from date) function from date
Returns the "type" interval in the The following table shows how type and expr parameters are associated: the desired expr format for type value meaning
SECOND seconds SECONDS
MINUTE minutes MINUTES
HOUR Time HOURS
Day days
MONTH Month MONTHS
Year YEARS
Minute_second minute and second "Minutes:seconds"
Hour_minute hour and Minute "hours:minutes"
Day_hour Day and Hour "days HOURS"
Year_month year and month "Years-months"
Hour_second hours, minutes, "HOURS:MINUTES:SECONDS"
Day_minute day, hour, minute "Days Hours:minutes"
Day_second day, hour, minute, second "days HOURS:MINUTES:SECONDS"
MySQL allows any punctuation separator in the expr format. Indicates that the suggested separator is displayed. If the date parameter is a date value and your calculation contains only the year, month, and day portions (that is, there is no time part), the result is a date value. Otherwise, the result is a datetime value.
mysql> Select "1997-12-31 23:59:59" + INTERVAL 1 SECOND;
-> 1998-01-01 00:00:00
mysql> SELECT INTERVAL 1 day + "1997-12-31";
-> 1998-01-01
mysql> Select "1998-01-01"-INTERVAL 1 SECOND;
-> 1997-12-31 23:59:59
mysql> SELECT date_add ("1997-12-31 23:59:59",
INTERVAL 1 SECOND);
-> 1998-01-01 00:00:00
mysql> SELECT date_add ("1997-12-31 23:59:59",
INTERVAL 1 day);
-> 1998-01-01 23:59:59
mysql> SELECT date_add ("1997-12-31 23:59:59",
INTERVAL "1:1" minute_second);
-> 1998-01-01 00:01:00
mysql> SELECT date_sub ("1998-01-01 00:00:00",
INTERVAL "1 1:1:1" day_second);
-> 1997-12-30 22:58:59
mysql> SELECT date_add ("1998-01-01 00:00:00",
INTERVAL "-1" day_hour);
-> 1997-12-30 14:00:00
mysql> SELECT date_sub ("1998-01-02", INTERVAL);
-> 1997-12-02
Mysql> SELECT EXTRACT (year from "1999-07-02");
-> 1999
Mysql> SELECT EXTRACT (year_month from "1999-07-02 01:02:03");
-> 199907
Mysql> SELECT EXTRACT (day_minute from "1999-07-02 01:02:03");
-> 20102
If you specify an interval value that is too short (excluding the desired interval for the type keyword), MySQL assumes that you have omitted the leftmost portion of the interval value. For example, if you specify that a type is Day_second, the value expr is expected to have the day, hour, minute, and second portions. If you specify a value like "1:10", MySQL assumes that the days and hours are partly missing and that the value represents minutes and seconds. In other words, the "1:10" Day_second is interpreted as equivalent to the "1:10" Minute_second, which is two justified by the way that MySQL interprets the time value as a passing period rather than as a day's time. If you use a date that is not exactly correct, the result is null. If you add month, year_month or year and the result date is greater than the maximum number of days for the new month, the day is adjusted with the largest day in the crescent moon.
Mysql> Select Date_add (' 1998-01-30 ', Interval 1 month);
-> 1998-02-28
Note that from the previous example the words interval and type keywords are not case-sensitive.
  
To_days (date)
Gives a date dated, returning a number of days (from 0 years).
Mysql> Select To_days (950501);
-> 728779
Mysql> Select To_days (' 1997-10-07 ');
-> 729669
To_days ()
Does not intend to use the value before Gregory (1582) occurs.
From_days (N)
Gives a number of days N, returning a date value.
Mysql> Select From_days (729669);
-> ' 1997-10-07 '
Date_format (Date,format)
Formats the date value based on the format string. The following modifiers can be used in the format string:%m month name (January ...). December)
%w Week name (Sunday ...) Saturday)
%d The date of the month with English prefix (1st, 2nd, 3rd, and so on). )
%Y years, numbers, 4-bit
%y years, numbers, 2-bit
%a name of the week (Sun ...) Sat)
Days in%d months, numbers (00 ...). 31)
%e the number of days in the month, numbers (0 ...). 31)
%m Month, number (01 ...) 12)
%c month, number (1 ...). 12)
%b abbreviated month name (...) DEC)
%j the number of days in a year (001 ...). 366)
%H hours (00 .....) 23)
%k hours (0 .....) 23)
%h hours (01 .....) 12)
%I Hours (01 .....) 12)
%l hours (1 .....) 12)
%i minutes, Number (00 .....) 59)
%r time, 12 hours (Hh:mm:ss [ap]m)
%T time, 24 hours (HH:MM:SS)
%s seconds (00 ...). 59)
%s seconds (00 ...). 59)
%p am or PM
%w the number of days in one weeks (0=sunday ...). 6=saturday)
%u weeks (0 .....) 52), here Sunday is the first day of the week
%u weeks (0 .....) 52), here Monday is the first day of the week
Percent% of a text "%".
All other characters do not interpret are copied into the result.
Mysql> Select Date_format (' 1997-10-04 22:23:00 ', '%w%m%Y ');
-> ' Saturday October 1997 '
Mysql> Select Date_format (' 1997-10-04 22:23:00 ', '%h:%i:%s ');
-> ' 22:23:00 '
Mysql> Select Date_format (' 1997-10-04 22:23:00 ',
'%d%y%a%d%m%b%j ');
-> ' 4th Sat Oct 277 '
Mysql> Select Date_format (' 1997-10-04 22:23:00 ',
'%H%k%I%r%T%s%w ');
-> ' 10:23:00 PM 22:23:00 00 6 '
In MySQL3.23,% is required before formatting modifiers. In the earlier version of MySQL,% is optional.
Time_format (Time,format)
This is used like the Date_format () function above, but the format string can contain only those formatting modifiers that handle hours, minutes, and seconds. Other modifiers produce a null value or 0.
  
Curdate ()

Current_date
Returns the Today date value in ' Yyyy-mm-dd ' or YYYYMMDD format, depending on whether the function is used in a string or a numeric context.
Mysql> select Curdate ();
-> ' 1997-12-15 '
Mysql> Select curdate () + 0;
-> 19971215
Curtime ()

Current_time
Returns the current time value in ' HH:MM:SS ' or HHMMSS format, depending on whether the function is used in a string or in the context of a number.
Mysql> select Curtime ();
-> ' 23:50:26 '
Mysql> Select Curtime () + 0;
-> 235026
Now ()

Sysdate ()

Current_timestamp
Returns the current date and time in the ' Yyyy-mm-dd HH:MM:SS ' or YYYYMMDDHHMMSS format, depending on whether the function is used in a string or in the context of a number.
Mysql> Select Now ();
-> ' 1997-12-15 23:50:26 '
Mysql> Select now () + 0;
-> 19971215235026
Unix_timestamp ()

Unix_timestamp (date)
Returns a UNIX timestamp (the number of seconds since ' 1970-01-01 00:00:00 ' GMT) if no parameter calls are invoked. If Unix_timestamp () is invoked with a date parameter, it returns the number of seconds that start from ' 1970-01-01 00:00:00 ' GMT. Date can be a date string, a DateTime string, a timestamp, or a number of local time in YYMMDD or YYYYMMDD format.
Mysql> select Unix_timestamp ();
-> 882226357
Mysql> Select Unix_timestamp (' 1997-10-04 22:23:00 ');
-> 875996580
When Unix_timestamp is used in a timestamp column, the function will accept the value directly, without the implied "String-to-unix-timestamp" transformation.
From_unixtime (Unix_timestamp)
Returns the value represented by the Unix_timestamp parameter in ' Yyyy-mm-dd HH:MM:SS ' or YYYYMMDDHHMMSS format, depending on whether the function is used in a string or a numeric context.
Mysql> Select From_unixtime (875996580);
-> ' 1997-10-04 22:23:00 '
Mysql> Select From_unixtime (875996580) + 0;
-> 19971004222300
From_unixtime (Unix_timestamp,format)
Returns a String representing the Unix time token, formatted according to the format string. FORMAT can contain the same modifiers as the entries listed in the Date_format () function.
Mysql> Select From_unixtime (Unix_timestamp (),
'%Y%d%m%h:%i:%s%x ');
-> ' 1997 23rd December 03:43:30 X '
Sec_to_time (seconds)
Returns the seconds parameter, changing to hours, minutes, and seconds, and the value is formatted as ' HH:MM:SS ' or HHMMSS, depending on whether the function is used in a string or in a numeric context.
Mysql> Select Sec_to_time (2378);
-> ' 00:39:38 '
Mysql> Select Sec_to_time (2378) + 0;
-> 3938
Time_to_sec (Time)
Returns the time parameter, converted to seconds.
Mysql> Select Time_to_sec (' 22:23:00 ');
-> 80580
Mysql> Select Time_to_sec (' 00:39:38 ');
-> 2378
MySQL Fetch system function:
Select Curtime ();
Select curdate ():
Select sysdate ():
Select Now ();
Related Article

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.