----- Original Message ----- 
From: "Khashan" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, April 01, 2004 1:04 PM
Subject: Create Table Syntax


>
> I am looking at the syntax for creating table( section 6.5.3 of the
manual):
>
> CREATE [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name
[(create_definition,...)] [table_options] [select_statement]
>
>
>
> and:
>
> create_definition:
>
>   part-1 (<- inserted by me for reference)
>
>   col_name type [NOT NULL | NULL] etc...[reference_definition]
>
>  part-2 (<- inserted by me for reference)
>
>   | PRIMARY KEY (index_col_name,...)
>
>   | KEY [index_name] (index_col_name,...)
>
>   | INDEX [index_name] (index_col_name,...)
>
>   | UNIQUE [INDEX] [index_name] (index_col_name,...)
>
>   | FULLTEXT [INDEX] [index_name] (index_col_name,...)
>
>   | [CONSTRAINT symbol] FOREIGN KEY ..   [reference_definition]
>
>   | CHECK (expr)
>
>
>
> The syntax suggests that for each column, in addition to specifying
part-1, I can specify any or all of the options in part-2 ???.
>
> 1- Is this true.
>
>
Yes.
>
> 2- Can I specify the options in part-2 after I defined all my columns. I
have used things like:
>
> CREATE TABLE animals (
>
>              id MEDIUMINT NOT NULL AUTO_INCREMENT,
>
>              name CHAR(30) NOT NULL,
>
>              PRIMARY KEY (id)
>
>              );
>
Yes, this is the way a CREATE TABLE normally looks: after each column
name/datatype/null specification ("part 1" in your terminology) come the
various attributes that further define the column ("part 2" in your
terminology). A given column can have one or more of these attributes.

Rhino


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to