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

(singke) #1

VERSION()


Returns the server version as a string.
Example:
SELECT VERSION()
Results:


"3.22.23b"

WEEK(date [, start])


Returns the week number given in the date argument. The optional parameter start indicates on which day
the week starts. If 0 is used, the week starts on Sunday. If 1 is used, the week starts on Monday.
Example:
SELECT WEEK('2000-04-29')
Result:


17
Example:
SELECT WEEK('2000-04-29', 1)
Result:

17

WEEKDAY(date)


Returns the index for the day of the week given in the argument. The following list identifies the index to use
for the corresponding weekday.


0 = Monday

1 = Tuesday

2 = Wednesday

3 = Thursday

4 = Friday

5 = Saturday

6 = Sunday
Example:
SELECT WEEKDAY('2000-01-27')
Result:

3—Corresponds to the Thursday index

YEAR(date)


Returns the year given in date.
Example:
SELECT MINUTE YEAR('00-01-27')
Result:


2000

Appendix C: Answers to Exercises


Day 1



  1. Compare the prices of several other databases that have the same feature set as
    MySQL. These would include SQL Server, Oracle, Adaptive Server and DB2. See
    how much MySQL is really worth.

Free download pdf