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

(singke) #1

DELETE


[LOW PRIORITY] FROM table_name WHERE conditions [LIMIT n]
The delete command deletes values from a given table based on the conditions expressed in the WHERE
clause. The DELETE statement has the following optional parameters:
ƒ LOW_PRIORITY Delays the deletion until the table is not in use
ƒ LIMIT X Limits the number of deletions to X


Example:
DELETE FROM Customers WHERE Customer_ID = 3

To delete all rows from a table without actually dropping the table, use the following command:
DELETE FROM Customers

DESCRIBE


table_name [column_name]


This statement will show a detailed definition of the columns in a table.

To see a description of all the columns in a table, use the following:
DESCRIBE Customers

To see a description of a specific column, use
DESCRIBE Customers Customer_ID

DROP DATABASE


[IF EXISTS] database_name
The DROP DATABASE statement will delete a database. There are no warnings or questions, so be
careful when you issue this statement.


Example:
DROP DATABASE Meet_A_Geek

DROP FUNCTION


function_name
Deletes a user-defined function from the func table in the mysql database. See CREATE FUNCTION.


DROP INDEX


index_name ON table_name


This statement will delete a given index on a specific table.

Example:
DROP INDEX idx_cust_id ON Customers

DROP TABLE [IF EXISTS]


table_name [, table_name] ...
This statement will delete the specified table. Again, with all DROP and DELETE statements, be careful,
there are no warnings or hesitations.


Example:
DROP TABLE Customers

EXPLAIN


{select_statement or table_name}
This command will display the query plan for the select clause. It displays the same results as the SHOW.
See SHOW.


Example:
EXPLAIN SELECT C.First_Name
FROM Customers AS C, Orders as O
WHERE C.Customer_ID = O.Customer_ID

FLUSH


flush_option[, flush_option] ...


This statement will clear the cache MySQL uses. The possible options are
Free download pdf