CREATE-TABLE — Create a database table.Function
name
The name of the table as a string, symbol or SQL expression.
database
A database object which defaults to *default-database*.
description
A list.
constraints
A string, a list of strings or NIL
.
transactions
A Boolean. The default value is T
.
Creates a table called name
, which
may be a string, symbol or SQL table identifier, in
database
which defaults to
*default-database*. description
is a list whose elements are lists containing the attribute
names, types, and other constraints such as not-null or
primary-key for each column in the table.
constraints
is a string representing an
SQL table constraint expression or a list of such strings.
With MySQL databases, if transactions
is T
an InnoDB table is created which supports transactions.
(create-table [foo] '(([id] integer) ([height] float) ([name] (string 24)) ([comments] text))) => (table-exists-p [foo]) => T (create-table [foo] '(([bar] integer :not-null :unique :primary-key) ([baz] string :not-null :unique))) => (table-exists-p [foo]) => T (create-table [foo] '(([bar] integer :not-null) ([baz] string :not-null)) :constraints '("UNIQUE (bar,baz)" "PRIMARY KEY (bar)")) => (table-exists-p [foo]) => T