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

(singke) #1
Example:
SHOW COLUMNS FROM Meet_A_Geek.Customers
SHOW PROCESSLIST

UNLOCK TABLE


table_name or UNLOCK TABLE


This command releases all locks held by the client.

UPDATE


[LOW_PRIORITY] table_name SET column_name = value [WHERE criteria] [LIMIT n]
The UPDATE statement allows the user to edit the values contained in a database.
The optional LOW_PRIORITY keyword causes the UPDATE to occur only when the table is not in use.


Example:
UPDATE Customers SET First_Name = "Geoff" WHERE Customer_ID = 12

USE


database name
The USE statement causes the named database to be the active database. Other databases are still
accessible using the dot (databasename.tablename) format.


Example:
USE Meet_A_Geek

Appendix B: Current MySQL Functions


Overview


This appendix contains a list of current MySQL functions that can be performed within an SQL SELECT
statement. The functions are in alphabetical order, followed by a brief description and an example. There
cannot be any whitespace between the function and the parenthesis.


ABS(x)


Returns the absolute value of x.
Example:
SELECT ABS(-2)
Result:


2

ACOS(x)


Returns the arc cosine of x. Returns NULL if x is not between –1 and 1.
Example:
SELECT ACOS(–0.653644)
Result:


2.283186

ADDDATE(date, INTERVAL interval expression)


Returns the result of the date plus the interval expression. Returns NULL if the given date is not a true date.
This function is the same as DATE_ADD().
Possible INTERVALs:
YEAR, DAY, HOUR, MINUTE, SECOND
Example:
SELECT ADDDATE("1969-04-29", INTERVAL 1 YEAR)
SELECT ADDDATE("1969-04-29", INTERVAL 1 DAY)
SELECT ADDDATE("1969-04-29", INTERVAL 40 DAY)
Results:
"1970-04-29"
"1969-04-30"
"1969-06-08"

Free download pdf