SELECT keywords/syntax Flashcards
(32 cards)
Represents any sequence of zero or more characters
%
Represents any single character
_
Match any from a list of values. If characters or dates are used in the list, they must be
enclosed in single quotation marks (‘ ‘)
IN
Year with 4 digits
%Y
Year with 2 digits
%y
Abbreviated month name in the current locale
(Jan, Feb, …)
%b
Full month name in current locale
%M
Month with 2 digits
%m
Hour with 2 digits between 00-23
%H
Hour with 2 digits (01-12)
%h
Abbreviated weekday name in the current
locale
%a
Minute with 2 digits.
%i
Seconds with 2 digits
%s
Day with English suffix (1st, 2nd, …)
%D
Day with 2 digits
%d
Day of the year (001-366)
%j
Day of the week (0 = Sunday)
%w
Time in 12-hour format, followed by AM/PM;
Short for ‘%I:%i:%S %p’
%r
AM/PM according to the current locale
%p
Time in 24-hour format. Short for
‘%H:%i:%S’.
%T
A literal % character.
%%
formats the date value using the specified format
DATE_FORMAT(date, format)
returns a date based on the given string and format; the format
of the string should be the same as the indicated format
STR_TO_DATE(string, format)
gets the difference of date1 and date2
DATEDIFF(date1, date2)