Microsoft Word - Sam's Teach Yourself MySQL in 21 Days - SAMS.doc

(singke) #1
27

DAYOFWEEK(date)


Returns the index of the day of the week that is given in the argument. See the following list for the correct
index for the corresponding day.


1 = Sunday

2 = Monday

3 = Tuesday

4 = Wednesday

5 = Thursday

6 = Friday

7 = Saturday
Example:
SELECT DAYOFWEEK('2000-01-27')
Result:

5—Corresponds to the Thursday index.

DAYOFYEAR(date)


Returns the day of the year for date. This is the Julian date.
Example:
SELECT DAYOFYEAR('2000-01-27')
Result:


27
Example:
SELECT DAYOFYEAR('2000-04-23')
Result:

114

DECODE(binary_string, encrypt_string)


Returns the decrypted results of the binary string. The encrypt_string must be the same string
used in the encryption process.


DEGREES(x)


Returns the value of x given in radians as degrees. See also RADIANS().
Example:
SELECT DEGREES(4.345)
Result:


248.950162

ELT(X, a, b, c, ...)


Returns the string whose position in the argument list matches X. See FIELD().
Example:
SELECT ELT(3, "Sam", "Ken", "Mark", "Scott")
Result:


"Mark"

ENCODE(word, encrypt_string)


Returns an encrypted binary string based on the encrypt_string. See DECODE().
Example:
SELECT ENCODE('tacobell', 'taco')
Result:

Free download pdf