Name
CREATE
Synopsis
CREATE DATABASEdbname
CREATE TABLEname
(field_name
field_type
, ... ) CREATE INDEXname
ONtable
(column
, ... ) CREATE FUNCTIONname
RETURNSvalues
SONAMElibrary
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 ...
Get MySQL and mSQL now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.