In MySQL statements are used to work with database tables, rows and columns, or in other words to manipulate and query data entries.
Here is the list of MySQL statements:
| STATEMENT | DESCRIPTION |
|---|---|
| ADD | Adds columns, data types, indexes etc... |
| ALTER EVENT | Modifies existing event |
| ALTER TABLE | Modifies existing table |
| ALTER VIEW | Modifies a view |
| ANALYZE TABLE | Analyzes and stored key distribution for a table |
| AT...INTERVAL...EVERY...STARTS...ENDS | In combination with TIMESTAMPS it selects the interval of an event |
| BEGIN...END | Defines beginning and end of a statement inside a delimiter |
| CALL | Calls a procedure |
| CASE...WHEN...THEN...ELSE...END CASE | Executes statement or statements when the main condition is met, otherwise follows the ELSE code |
| CHECK TABLE | Check a table for errors |
| CLOSE | Closes cursor in a stored procedure |
| CREATE DATABASE | Creates a new database |
| CREATE EVENT...ON SCHEDULE | Creates an event that may be a one-time or recurrent; ON SCHEDULE defines the schedule of occurrence |
| CREATE FUNCTION | Creates a new function |
| CREATE PROCEDURE | Creates a new procedure |
| CREATE TABLE | Creates a new table |
| CREATE...TRIGGER...BEFORE|AFTER...ON | Creates a trigger before or after the specified table |
| CREATE USER | Creates a new account in database |
| CREATE VIEW | Creates a new view |
| COMMIT | Permanently executes a created transaction |
| DECLARE | Declares variables, or a cursor in a stored procedure |
| DECLARE...CONTINUE | Continues a procedure after an error was thrown |
| DECLARE...CURSOR FOR | In combination with the DECLARE statemement, it declares the cursor in a stored procedure |
| DECLARE...EXIT | Exits a procedure after an error was thrown |
| DECLARE...HANDLER...FOR | Declares what to execute if a cursor is not found |
| DELETE | Deletes rows (data) from specified column(s) |
| DELIMITER | Replaces previous delimiter with a new one |
| DO | Executes an event that has been scheduled |
| DROP | Drops (removes ,deletes) a database from the server (or a table from database) with all its data (data is permanently deleted) |
| DROP COLUMN | Deletes a specified column from the table |
| EXECUTE | Executes custom prepared statements |
| FETCH...INTO | Fetches the next row and moves cursor to next result set |
| GRANT | Grants some or all privileges for an user account |
| GRANT USAGE ON...TO | Grants privileges for a database'a user account |
| IF...THEN...ELSEIF...ELSE...END IF | Executes a statement or statements when a condition is met, otherwise it executes code that follows ELSEIF or ELSE conditions |
| INSERT INTO | Used to insert a new row into an existing table |
| LOAD DATE INFILE... | Reads data from a text file and imports data to the database |
| MODIFY | May be used to change specified characteristics of a column data type |
| OPEN | Opens a cursor in a stored procedure |
| OPTIMIZE TABLE | Reorganize and optimize a given table's data and associated index fields |
| PREPARE | Used for preparing customized statements |
| RENAME TO | Renames a column to the given name |
| REPAIR TABLE | Tries to repair the specified table (success not guaranteed) |
| REPLACE INTO | Replacing old rows with new ones or inserts new rows |
| REPLACE VIEW | Replaces specified view with another one |
| RESIGNAL | Re-signals the error within an error handling code and is used for troubleshooting |
| REVOKE | REVOKE ALL | Revokes some or all privileges for a user |
| ROLLBACK | Rollbacks (cancels) the transaction that was already initiated |
| SELECT | Used to retrieve data from specified columns |
| SELECT...INTO OUTFILE... | Outputs data from database to an external file |
| SET autocommit | Enables or disables automaric COMMIT function |
| SET GLOBAL | Sets global event ON or OFF |
| SET PASSWORD | Sets the password for a database account |
| SHOW | Let's us view currently existing databases on the server |
| SHOW CREATE PROCEDURE | Displays a source code of a stored procedure |
| SHOW CREATE VIEW | Displays definition of a created view |
| SHOW PROCEDURE STATUS | Shows listed stored procedures and their statuses |
| SHOW PROCESSLIST | Shows the status of the event process |
| SIGNAL SQLSTATE | Returns the error message that appeared during code execution |
| START TRANSACTION | Initiates a transaction |
| UPDATE | Updates (modifies) column(s) values with given replacement values |
| USE | Allows us to switch from database to database during runtime |
| TRUNCATE TABLE | Deletes data from existing table |
Comments
No comments have been made yet.
Please login to leave a comment. Login now