MySQL Statements

This is an alphabetical listing of our documentation of MySQL statements. This is provided as a quick way to get to the documentation page when you know on which SQL statement you need information. The more popular SQL statements are highlighted with blue text for the heading.

This MySQL statement may be used to change the contents of a db.opt file, which contains the default CHARACTER SET and COLLATE values.
page views: 4,530;
category: Database & Table Schema Statements
Use this MySQL statement to delete a given database along with all its tables and data.
page views: 13,502;
category: Database & Table Schema Statements
There is no summary of this document.
parent: SELECT;
related resources: 6;
page views: 4,906;
category: Data Manipulation
Use this MySQL statement to alter an existing scheduled MySQL event.
page views: 5,777;
category: Stored Routines
This MySQL statement deletes an event.
page views: 2,978;
category: Stored Routines
There is no summary of this document.
parent: SELECT;
page views: 3,415;
category: Data Manipulation
This MySQL statement changes the characteristics of an existing user-defined function.
page views: 11,197;
category: Stored Routines
DROP FUNCTION
Use this MySQL statement to delete a user-defined function.
page views: 2,887;
category: Stored Routines
This MySQL statement, the SELECT is used to retrieve and display data from tables within a MySQL database.
parent: SELECT;
page views: 6,950;
category: Data Manipulation
This MySQL statement changes the characteristics of an existing stored procedure.
page views: 21,092;
category: Stored Routines
DROP INDEX
This MySQL statement deletes a given index from a MySQL table.
page views: 2,768;
category: Database & Table Schema Statements
This MySQL statement sets a system or user variable for global or session use.
page views: 3,991;
category: Data Manipulation
This MySQL statement may be used to change the contents of a db.opt file, which contains the default CHARACTER SET and COLLATE values.
page views: 3,874;
category: Database & Table Schema Statements
This MySQL statement deletes a prepared statement.
page views: 3,513;
category: Stored Routines
This MySQL statement skips the given number of events from the master.
page views: 3,640;
category: Replication
ALTER SERVER
Use this MySQL statement with the FEDERATED storage engine to change the connection parameters of a server created with CREATE SERVER.
page views: 2,881;
category: Database & Table Schema Statements
DROP PROCEDURE
This MySQL statement deletes a stored procedure.
page views: 2,871;
category: Stored Routines
SET PASSWORD
Use this MySQL statement to change the password for a user account.
page views: 2,728;
category: User & Security Statements
After you've created a table, use this MySQL statement to change the structure of a table.
sub-documents: 12;
related resources: 3;
page views: 8,008;
category: Database & Table Schema Statements
This MySQL statement can be used with the FEDERATED storage engine to delete a given server that was created with CREATE SERVER.
page views: 2,974;
category: Database & Table Schema Statements
This MySQL statement enables or disables binary logging of SQL statements for the current connection.
page views: 5,986;
category: Replication
The ADD FULLTEXT clause of the ALTER TABLE statement adds an index on a TEXT column within an existing MyISAM table in MySQL.
parent: ALTER TABLE;
related resources: 3;
page views: 34,564;
category: Database & Table Schema Statements
Use this MySQL statement to delete a MySQL table from a database, including its data.
page views: 3,460;
category: Database & Table Schema Statements
Use this MySQL statement to set an isolation level for the current transaction, for a transaction that's about to be started, or globally.
page views: 3,770;
category: Transactions
This ADD clause of the MySQL statement ALTER TABLE is used to add a SPATIAL index to a MySQL table.
parent: ALTER TABLE;
related resources: 3;
page views: 5,381;
category: Database & Table Schema Statements
This MySQL statement deletes a trigger.
page views: 5,040;
category: Stored Routines
SHOW BINARY LOGS
This MySQL statement displays a list of binary logs created by the master MySQL server in the filesystem directory.
page views: 2,812;
category: Replication
Use the ADD INDEX clause of the ALTER TABLE statement to add an index to a MySQL table.
parent: ALTER TABLE;
related resources: 3;
page views: 4,485;
category: Database & Table Schema Statements
If a user has no privileges at all—meaning, after you've revoke all of a user's privileges with the REVOKE statement—you can use this statement to then remove a user from the M
page views: 8,301;
category: User & Security Statements
This MySQL statement displays the events in a binary log file.
page views: 7,562;
category: Replication
These clauses of the MySQL statement, ALTER TABLE add columns to a MySQL table.
parent: ALTER TABLE;
related resources: 3;
page views: 5,549;
category: Database & Table Schema Statements
DROP VIEW
This MySQL statement deletes a view. Multiple views may be given in a comma-separated list.
page views: 2,805;
category: Database & Table Schema Statements
This MySQL statement will show all of the character sets (e.g., latin1, utf8) installed on the server.
page views: 5,473;
category: Database & Table Schema Statements
These ADD clauses of the MySQL statement ALTER TABLE add foreign keys and references to MySQL tables that use the storage engine, InnoDB in MySQL.
parent: ALTER TABLE;
related resources: 3;
page views: 18,133;
category: Database & Table Schema Statements
EXECUTE
This MySQL statement executes a user-defined prepared statement.
page views: 2,764;
category: Stored Routines
Use this MySQL statement to list all of the collation character sets.
page views: 3,579;
category: Database & Table Schema Statements
These clauses of the MySQL statement, ALTER TABLE are used to alter an existing column in a MySQL table.
parent: ALTER TABLE;
related resources: 3;
page views: 9,127;
category: Database & Table Schema Statements
Use this MySQL statement to display information about the columns of a given table or the handling of a SELECT statement.
page views: 3,347;
category: Data Manipulation
With this MySQL statement you can display the columns for a table: their datatype, whether they're indexed, default value, etc..
page views: 5,815;
category: Database & Table Schema Statements
The DROP clause of the MySQL statement, ALTER TABLE removes a given column from a MySQL table and delete the column's
parent: ALTER TABLE;
related resources: 3;
page views: 4,886;
category: Database & Table Schema Statements
FETCH
A cursor is similar to a MySQL table or a view: it represents, within a procedure, a results set that is retrieved one row at a time using this MySQL statement.
page views: 2,875;
category: Stored Routines
This MySQL statement just displays the CREATE DATABASE statement for creating the MySQL database given—which isn't very useful for most developers.
page views: 4,757;
category: Database & Table Schema Statements
These clauses of the MySQL statement, ALTER TABLE are used to delete indexes in a MySQL table.
parent: ALTER TABLE;
related resources: 3;
page views: 26,040;
category: Database & Table Schema Statements
Use this MySQL statement to clear temporary caches in MySQL.
page views: 4,158;
category: Table & Server Admin
This MySQL statement displays an SQL statement that can be used to create an event like the one given.
page views: 3,102;
category: Stored Routines
These clauses of the MySQL statement, ALTER TABLE can be used to change a variety of MySQL table properties.
parent: ALTER TABLE;
related resources: 3;
page views: 4,139;
category: Database & Table Schema Statements
This is probably the most used SQL statement for creating users and granting them privileges in MySQL.
sub-documents: 3;
page views: 5,150;
category: User & Security Statements
This MySQL statement displays an SQL statement that can be used to create a function like the one given.
page views: 3,025;
category: Stored Routines
These clauses of the MySQL statement, ALTER TABLE are used to change the properties of MySQL tables that are partitioned.
parent: ALTER TABLE;
page views: 5,153;
category: Database & Table Schema Statements
There is no summary of this document.
parent: GRANT;
page views: 5,962;
category: User & Security Statements
This MySQL statement displays an SQL statement that can be used to create a stored procedure like the one given.
page views: 3,439;
category: Stored Routines
These table partition clauses for the MySQL statement, ALTER TABLE may be used to add or remove partitions in a MySQL table.
parent: ALTER TABLE;
page views: 28,729;
category: Database & Table Schema Statements
This page contains a list of user privileges that may be granted or revoked.
parent: GRANT;
page views: 5,749;
category: User & Security Statements
This MySQL statement displays an SQL statement that can be used to create a MySQL table like the one named. The results may be copied and used with another MySQL database.
page views: 3,445;
category: Database & Table Schema Statements
This page lists all of the table options that can be set with the ALTER TABLE statement for altering a MySQL table.
parent: ALTER TABLE;
page views: 12,218;
category: Database & Table Schema Statements
There is no summary of this document.
parent: GRANT;
page views: 5,917;
category: User & Security Statements
SHOW CREATE VIEW
Use this MySQL statement to display an SQL statement that can be used to create a view like the one named.
page views: 2,856;
category: Database & Table Schema Statements
There is not an ALTER TRIGGER statement in MySQL at this time.
page views: 13,901;
category: Stored Routines
A handle provides direct access to a table, as opposed to working from a results set.
page views: 6,411;
category: Data Manipulation
This MySQL statement displays the list of databases on the server. The keyword DATABASE has become synomymous with SCHEMA.
page views: 3,803;
category: Database & Table Schema Statements
Use this MySQL statement to change a view, which are created with CREATE VIEW, of course.
page views: 10,045;
category: Database & Table Schema Statements
HELP
This MySQL statement can be used to access built-in documentation.
page views: 2,664;
category: Other Statements
SHOW ENGINE
Use this MySQL statement to display details of the status of a given storage engine.
page views: 2,599;
category: Table & Server Admin
Use this MySQL statement to store information that can be useful later when the MySQL optimizer chooses the order for consulting indexes during a query.
page views: 4,427;
category: Table & Server Admin
This MySQL statement is used to add rows of data to a table. It has a few primary syntax with many options.
sub-documents: 4;
related resources: 5;
page views: 6,004;
category: Data Manipulation
Use this MySQL statement to list the storage engines (types of tables) available for the installation of MySQL you're using.
page views: 3,064;
category: Table & Server Admin
BACKUP TABLE
This MySQL statement makes a backup copy of a MyISAM table. However, it has been deprecated because it does not work reliably.
page views: 2,907;
category: Table & Server Admin
This syntax of the MySQL statement, INSERT is used to insert rows of data into a table based on the results of a
parent: INSERT;
related resources: 5;
page views: 4,740;
category: Data Manipulation
SHOW ERRORS
Use this MySQL statement to display error messages for the previous SQL statement.
page views: 2,838;
category: Data Manipulation
Use this MySQL statement to start a transaction.
page views: 3,094;
category: Transactions
This format of the MySQL statement, INSERT allows one SQL statement to insert multiple rows into a MySQL table.
parent: INSERT;
related resources: 5;
page views: 56,167;
category: Data Manipulation
SHOW EVENTS
This MySQL statement displays a list of scheduled events on the server.
page views: 2,769;
category: Stored Routines
Use this combination of MySQL statements to start and end the steps that are part of a stored procedure or trigger.
page views: 3,852;
category: Stored Routines
Use this variant of the MySQL statement, INSERT to add only one row of data into a MySQL table per statement.
parent: INSERT;
related resources: 5;
page views: 4,115;
category: Data Manipulation
This MySQL statement displays the internal code of a function.
page views: 4,482;
category: Stored Routines
CACHE INDEX
This MySQL statement tells MySQL to cache the given indexes to a specific index cache, which can be created with the SET GLOBAL statement. This MySQL statement is used only on MyISAM tables.
page views: 2,940;
category: Table & Server Admin
Use this MySQL statement to terminate a client connection to MySQL. You can use the SHOW PROCESSLIST statement to obtain a connection thread identifier for use in this statement.
page views: 3,056;
category: Table & Server Admin
SHOW FUNCTION STATUS
This MySQL statement displays information on user-defined functions.
page views: 2,883;
category: Stored Routines
CALL
Use this MySQL statement to call a stored procedure.
page views: 2,959;
category: Stored Routines
This MySQL statement has been deprecated and will be removed from future releases of MySQL.
page views: 5,008;
category: Replication
SHOW GRANTS
This MySQL statement displays the GRANT statement for a given user.
page views: 2,899;
category: User & Security Statements
This MySQL statement changes the settings on a slave server related to the master server and replication.
page views: 3,233;
category: Replication
This MySQL statement can be used to import organized data from a text file into a table in MySQL. The file can be either on the server or on the client.
page views: 16,063;
category: Data Manipulation
This MySQL statement displays information about the indexes for a MySQL table.
page views: 4,712;
category: Database & Table Schema Statements
CHECK TABLE
Use this MySQL statement to check tables for errors; as of version 5.1.9 of MySQL, it works with the MyISAM, InnoDB, ARCHIVE, and CSV storage engines.
page views: 2,967;
category: Table & Server Admin
Use this MySQL statement to preload a table's index into a given key cache for a MyISAM table.
page views: 4,485;
category: Other Statements
This MySQL statement displays a list of binary logs created by the master MySQL server in the filesystem directory.
page views: 3,059;
category: Replication
This MySQL statement returns a MyISAM table's live checksum value, a value that can be optionally maintained to improve a table's repairability.
page views: 3,900;
category: Table & Server Admin
LOAD TABLE...FROM MASTER
This MySQL statement has been deprecated and will be removed from future releases of MySQL since it has many problems.
page views: 2,681;
category: Replication
SHOW MASTER STATUS
This MySQL statement displays information on the status of the binary log file that is being used currently on the master MySQL server.
page views: 2,955;
category: Replication
CLOSE
This MySQL statement closes a cursor that has been declared within the current routine and has been opened using the OPEN statement.
page views: 2,703;
category: Stored Routines
Use this MySQL statement to lock the given tables for exclusive use by the current connection thread.
page views: 4,001;
category: Table & Server Admin
Use this MySQL statement to display a list of tables that are open; that is to say, in the table cache. The list does not include any temporary tables.
page views: 8,247;
category: Table & Server Admin
Use this MySQL statement to commit transactions, which are SQL statements that have changed data and that have been entered into MySQL but not yet saved.
page views: 3,560;
category: Transactions
This function is useful to synchronize MySQL master and slave server logging.
page views: 3,337;
category: Replication
Use this MySQL statement to display a list of plugins on the server.
page views: 2,990;
category: Table & Server Admin
This MySQL statement creates a new database with the name given. There's not much to it.
page views: 6,540;
category: Database & Table Schema Statements
This page our MySQL documentation relates to MySQL Subqueries, in particular, subqueries which involve multiple fields or return multiple fields in the resu
page views: 15,093;
category: Sub-Queries
SHOW PRIVILEGES
This MySQL statement provides a list of privileges available, along with the context of each one (e.g., server administration) and a description. The output is not based on the user.
page views: 2,680;
category: User & Security Statements
Use this MySQL statement to schedule the execution of an SQL statement at a specific time and date.
page views: 7,858;
category: Stored Routines
OPEN
This MySQL statement opens a cursor that has been declared within the current routine.
page views: 2,854;
category: Stored Routines
This MySQL statement displays the internal code of a stored procedure.
page views: 3,436;
category: Stored Routines
A user-defined function is in essence a set of MySQL statements that may be called as a unit, processing any data it's given in its parameters and returning a value to the caller of the function.
page views: 6,631;
category: Stored Routines
Use this MySQL statement to optimize the data contained in a table. Optimization is useful when many rows have been deleted from a table.
page views: 3,156;
category: Table & Server Admin
This MySQL statement displays information on stored procedures.
page views: 2,996;
category: Stored Routines
Use this MySQL statement to add an index to a MySQL table after it has been created.
page views: 3,113;
category: Database & Table Schema Statements
PREPARE
This MySQL statement creates a prepared statement.
page views: 2,925;
category: Stored Routines
This statement displays a list of connection threads running on the MySQL server. You'll need this if one of them is locked and slowing down the system.
page views: 2,977;
category: Table & Server Admin
These clauses of the CREATE INDEX statement can be used to create FULLTEXT indexes in a MySQL table.
parent: CREATE TABLE;
page views: 3,749;
category: Database & Table Schema Statements
This MySQL statement deletes the binary logs from a master server.
page views: 3,364;
category: Replication
SHOW SCHEMAS
This MySQL statement is synonymous with SHOW DATABASES. See the description of that statement for more information and examples.
page views: 2,625;
category: Table & Server Admin
There is no summary of this document.
parent: CREATE TABLE;
page views: 4,707;
category: Database & Table Schema Statements
This MySQL statement instructs the server to release a savepoint named earlier with the SAVEPOINT statement for the current transaction.
page views: 3,169;
category: Transactions
This MySQL statement displays a list of slave servers for the master server.
page views: 3,992;
category: Replication
These clauses of the CREATE INDEX statement can be used to create UNIQUE indexes in a MySQL table.
parent: CREATE TABLE;
page views: 4,550;
category: Database & Table Schema Statements
This MySQL statement does what it says: it will rename a database to whatever name you give it, provided it doesn't already exist.
page views: 4,127;
category: Database & Table Schema Statements
SHOW SLAVE STATUS
This MySQL statement displays information on the slave thread.
page views: 2,906;
category: Replication
A procedure, also known as a stored procedure, is set of MySQL statements stored on the MySQL server and called as a unit, processing any data it's given in its parameters.
page views: 6,828;
category: Stored Routines
If for some reason you want to rename an existing MySQL table, use this MySQL statement. It's the easiest way.
page views: 5,135;
category: Database & Table Schema Statements
This MySQL statement displays status information and variables from the server.
page views: 3,220;
category: Table & Server Admin
This MySQL statement is synonymous with CREATE DATABASE.
page views: 43,698;
category: Database & Table Schema Statements
If a MySQL administrator simply wants to change the user name or the host of an existing MySQL user account, but not the user account's privileges, an administrator can use this MySQL statement to
page views: 5,938;
category: User & Security Statements
This MySQL statement displays status information on a set of tables from a database.
page views: 22,177;
category: Table & Server Admin
You can use this MySQL statement with the FEDERATED storage engine to set the connection parameters.
page views: 3,953;
category: Database & Table Schema Statements
Use this MySQL statement to repair corrupted MyISAM tables.
page views: 3,536;
category: Table & Server Admin
SHOW TABLE STATUS
This MySQL statement displays status information on a set of tables from a database.
page views: 2,936;
category: Table & Server Admin
This is one of the primary MySQL statements that a MySQL developer will use when first setting up a database. It's used to create MySQL tables, to which data will later be added.
sub-documents: 11;
page views: 5,174;
category: Database & Table Schema Statements
This MySQL statement to insert new rows of data and to replace existing rows where the PRIMARY KEY or UNIQUE index key is the same as the new record being inserted.
page views: 3,934;
category: Data Manipulation
This MySQL statement displays a list of MySQL tables and views. To distinguish between MySQL tables and views, add the FULL keyword.
page views: 3,225;
category: Database & Table Schema Statements
There is no summary of this document.
parent: CREATE TABLE;
page views: 23,134;
category: Database & Table Schema Statements
Use this MySQL statement to reset certain server settings and log files.
page views: 3,132;
category: User & Security Statements
This MySQL statement displays a list of triggers on the server.
page views: 7,860;
category: Stored Routines
There is no summary of this document.
parent: CREATE TABLE;
page views: 8,498;
category: Database & Table Schema Statements
RESET
Use this MySQL statement to reset certain server settings and log files.
page views: 2,636;
category: User & Security Statements
This MySQL statement displays the system variables for the MySQL server.
page views: 3,480;
category: Table & Server Admin
There is no summary of this document.
parent: CREATE TABLE;
page views: 46,644;
category: Database & Table Schema Statements
RESET MASTER
This MySQL statement deletes all the binary log files on the master server.
page views: 2,886;
category: Replication
If you were looking for this MySQL statement and can't find it anywhere else, I'm not surprise. Click on this one and you'll see why.
page views: 3,054;
category: Database & Table Schema Statements
There is no summary of this document.
parent: CREATE TABLE;
page views: 10,198;
category: Database & Table Schema Statements
RESET SLAVE
Use this MySQL statement within or after the RESET MASTER statement that sets the binary logging index back to 1.
page views: 2,784;
category: Replication
Use this MySQL statement to display warning messages, error messages, and notes for previous SQL statements for the current session.
page views: 3,684;
category: Data Manipulation
There is no summary of this document.
parent: CREATE TABLE;
page views: 5,793;
category: Database & Table Schema Statements
RESTORE TABLE
This MySQL statement restores a table that was saved to the filesystem by the BACKUP TABLE statement, which is deprecated.
page views: 2,618;
category: Table & Server Admin
This page our MySQL documentation relates to sub-queries which involve a single field or return a single field in the results of the inner query.
page views: 3,769;
category: Sub-Queries
There is no summary of this document.
parent: CREATE TABLE;
page views: 3,837;
category: Database & Table Schema Statements
This page our MySQL documentation relates to MySQL Subqueries, in particular, subqueries which return a results set from the inner query.
page views: 4,352;
category: Sub-Queries
Use this MySQL statement to start a slave server.
page views: 4,521;
category: Replication
There is no summary of this document.
parent: CREATE TABLE;
page views: 9,007;
category: Database & Table Schema Statements
This MySQL statement is used to easily revoke speciified privileges from a user without necessarily revoking all privileges or having to drop a user and create the user again with less privileges.
page views: 4,380;
category: User & Security Statements
Use this MySQL statement to start a transaction.
page views: 4,208;
category: Transactions
These options are used to set the maximum and minimum rows of a MySQL table, respectively. Use the SHOW CREATE TABLE statement to see the results.
parent: CREATE TABLE;
page views: 5,084;
category: Database & Table Schema Statements
Use this MySQL statement with transactional tables to reverse transactions that have not yet been committed.
page views: 3,297;
category: Transactions
STOP SLAVE
This MySQL statement stops the slave server threads.
page views: 2,663;
category: Replication
Triggers are actions to be taken when a user requests a change to data in MySQL.
page views: 5,184;
category: Stored Routines
This MySQL statement instructs the server to reverse SQL statements for the current transaction back to a point marked in the transaction by the SAVEPOINT statement.
page views: 25,292;
category: Transactions
TRUNCATE
Use this MySQL statement to delete the contents of a table rapidly.
page views: 2,888;
category: Data Manipulation
This MySQL statement is fairly straightforward: it's used to create a user, but doesn't allow privileges to be granted with it. For that, you would use the GRANT statement.
page views: 3,366;
category: User & Security Statements
Use this MySQL statement to identify a point in a transaction to which SQL statements may potentially be undone later.
page views: 3,407;
category: Transactions
Use this MySQL statement to unlock tables that were locked by the current connection thread with the LOCK TABLES statement.
page views: 3,074;
category: Table & Server Admin
Use this MySQL statement to create a view, which is a preset query, stored in a database. In certain situations a view can be useful for improved security.
page views: 7,560;
category: Database & Table Schema Statements
To retrieve and display data from tables within a database, use this MySQL statement. It also has more than one syntax and many options—it also allows for sub-queries.
sub-documents: 7;
related resources: 6;
page views: 6,054;
category: Data Manipulation
If you want to change data in a table or just in some rows—even one row only—use this MySQL statement. Click on the heading here for more details.
sub-documents: 2;
page views: 5,649;
category: Data Manipulation
This MySQL statement declares local variables and other items related to routines.
page views: 4,648;
category: Stored Routines
There is no summary of this document.
parent: SELECT;
related resources: 6;
page views: 4,205;
category: Data Manipulation
This syntax of the MySQL statement, UPDATE, available as of version 4.0.4 of MySQL, allows for multiple MySQL tables to be updated or referenced in one MySQL statement.
parent: UPDATE;
page views: 6,460;
category: Data Manipulation
Use this MySQL statement to delete rows of data from a given table. Be careful with this one: there's basically no UNDO statement.
page views: 5,973;
category: Data Manipulation
There is no summary of this document.
parent: SELECT;
related resources: 6;
page views: 12,603;
category: Data Manipulation
This page of our MySQL documentation relates to the MySQL statement, UPDATE, in particular, updating a single table, as opposed to
parent: UPDATE;
page views: 4,900;
category: Data Manipulation
DELIMITER
This MySQL statement changes the delimiter (terminating character) of SQL statements from the default of a semi-colon to another character.
page views: 2,664;
category: Stored Routines
There is no summary of this document.
parent: SELECT;
related resources: 6;
page views: 3,434;
category: Data Manipulation
USE
This MySQL statement sets the default database MySQL is to use for the current session.
page views: 2,803;
category: Other Statements
This MySQL statement displays information about the columns of a given MySQL table.
page views: 5,359;
category: Database & Table Schema Statements
There is no summary of this document.
parent: SELECT;
related resources: 6;
page views: 4,392;
category: Data Manipulation
This MySQL statement is used for XA distributed transactions.
page views: 4,455;
category: Other Statements
DO
This MySQL statement suppresses the display of an expression's results. I can't think of much point to this one. Please let me know you can.
page views: 2,904;
category: Data Manipulation