CREATE DATABASE Syntax

CREATE {DATABASE | SCHEMA} [IF NOT EXISTS] db_name [create_specification] … create_specification: [DEFAULT] CHARACTER SET [=] charset_name | [DEFAULT] COLLATE [=] collation_name CREATE DATABASE creates a database with the given name. To use this statement, you need the CREATE [688] privilege for the database. CREATE SCHEMA is a synonym for CREATE DATABASE. An error occurs if […]

What is MySQL

MySQL, the most popular Open Source SQL database management system, is developed, distributed, and supported by Oracle Corporation. The MySQL Web site (http://www.mysql.com/) provides the latest information about MySQL software. • MySQL is a database management system A database is a structured collection of data. It may be anything from a simple shopping list to […]

ALTER EVENT Syntax

ALTER [DEFINER = { user | CURRENT_USER }] EVENT event_name [ON SCHEDULE schedule] [ON COMPLETION [NOT] PRESERVE] [RENAME TO new_event_name] [ENABLE | DISABLE | DISABLE ON SLAVE] [COMMENT ‘comment’] [DO event_body] The ALTER EVENT statement changes one or more of the characteristics of an existing event without the need to drop and recreate it. The […]

ALTER SERVER Syntax

ALTER SERVER server_name OPTIONS (option [, option] …) Alters the server information for server_name, adjusting any of the options permitted in the CREATE SERVER statement. The corresponding fields in the mysql.servers table are updated accordingly. This statement requires the SUPER [691] privilege. For example, to update the USER option: ALTER SERVER s OPTIONS (USER ‘sally’); […]

ALTER DATABASE Syntax

ALTER {DATABASE | SCHEMA} [db_name] alter_specification … ALTER {DATABASE | SCHEMA} db_name UPGRADE DATA DIRECTORY NAME alter_specification: [DEFAULT] CHARACTER SET [=] charset_name | [DEFAULT] COLLATE [=] collation_name ALTER DATABASE enables you to change the overall characteristics of a database. These characteristics are stored in the db.opt file in the database directory. To use ALTER DATABASE, […]

ALTER FUNCTION Syntax

ALTER FUNCTION func_name [characteristic …] characteristic: COMMENT ‘string’ | LANGUAGE SQL | { CONTAINS SQL | NO SQL | READS SQL DATA | MODIFIES SQL DATA } | SQL SECURITY { DEFINER | INVOKER } This statement can be used to change the characteristics of a stored function. More than one change may be specified […]

ALTER VIEW Syntax

ALTER [ALGORITHM = {UNDEFINED | MERGE | TEMPTABLE}] [DEFINER = { user | CURRENT_USER }] [SQL SECURITY { DEFINER | INVOKER }] VIEW view_name [(column_list)] AS select_statement [WITH [CASCADED | LOCAL] CHECK OPTION] This statement changes the definition of a view, which must exist. The syntax is similar to that for CREATE VIEW and the […]

ALTER PROCEDURE Syntax

ALTER PROCEDURE proc_name [characteristic …] characteristic: COMMENT ‘string’ | LANGUAGE SQL | { CONTAINS SQL | NO SQL | READS SQL DATA | MODIFIES SQL DATA } | SQL SECURITY { DEFINER | INVOKER } This statement can be used to change the characteristics of a stored procedure. More than one change may be specified […]

ALTER TABLE Syntax

ALTER [IGNORE] TABLE tbl_name [alter_specification [, alter_specification] …] [partition_options] alter_specification: table_options | ADD [COLUMN] col_name column_definition [FIRST | AFTER col_name ] | ADD [COLUMN] (col_name column_definition,…) | ADD {INDEX|KEY} [index_name] [index_type] (index_col_name,…) [index_option] … | ADD [CONSTRAINT [symbol]] PRIMARY KEY [index_type] (index_col_name,…) [index_option] … | ADD [CONSTRAINT [symbol]] UNIQUE [INDEX|KEY] [index_name] [index_type] (index_col_name,…) [index_option] … […]