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. 

 

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)

             );

P.S. I am trying to auto generate the create statement with any of the options  and 
want to make sure that the statement is solid before it is sent to the server. 

 

Thank you all in advance.

 


Do you Yahoo!?
Yahoo! Mail - More reliable, more storage, less spam

Reply via email to