Name
CREATE
Synopsis
CREATE DATABASEdbnameCREATE TABLEname(field_namefield_type, ... ) CREATE INDEXnameONtable(column, ... ) CREATE FUNCTIONnameRETURNSvaluesSONAMElibrary
Creates new database elements (or entirely new databases). This statement is used to create databases, tables, and user defined functions (UDFs).
The CREATE INDEX
statement is provided for compatibility
with other implementations of SQL. In older versions of SQL this
statement does nothing. As of 3.22, this statement is equivalent to
the ALTER TABLE ADD INDEX statement. To perform
the CREATE INDEX statement, you must have
INDEX privileges for the table in question.
The CREATE DATABASE
statement creates an
entirely new, empty database. This is equivalent to running the
mysqladmin create utility. As with running
mysqladmin, you must be the administrative user
for MySQL (usually root or
mysql) to perform this statement.
The CREATE FUNCTION
statement allows MySQL
statements to access precompiled executable functions. These
functions can perform practically any operation, since they are
designed and implemented by the user. The return value of the
function can be STRING, for character data;
REAL, for floating point numbers; or
INTEGER for integer numbers. MySQL will translate
the return value of the C function to the indicated type. The library
file that contains the function must be a standard shared library
that MySQL can dynamically link into the server.
The CREATE TABLE
statement defines the structure ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access