MySQL Forums
Forum List  »  Newbie

Re: alter table .... add constraint
Posted by: Vinood Chuhan
Date: April 17, 2012 03:08AM

the following script is not working for me can anyone provide me working script ??



ALTER [IGNORE] TABLE tbl_sdf2
alter_specification [, alter_specification] ...

alter_specification:
table_options
| ADD [COLUMN] col_name column_definition
[FIRST | AFTER col_sdf3 ]
| ADD [COLUMN] (col_name column_definition,...)
| ADD {INDEX|KEY} [index_sdf4]
[index_type] (index_col_sdf5,...)
| ADD [CONSTRAINT [symbol]] PRIMARY KEY
[index_type] (index_col_sdf5,...)
| ADD [CONSTRAINT [symbol]]
UNIQUE [INDEX|KEY] [index_sdf6]
[index_type] (index_col_sdf5,...)
| ADD [FULLTEXT|SPATIAL] [INDEX|KEY] [index_sdf6]
(index_col_name,...)
| ADD [CONSTRAINT [symbol]]
FOREIGN KEY [index_name] (index_col_sdf5,...)
reference_definition
| ALTER [COLUMN] col_name {SET DEFAULT literal | DROP DEFAULT}
| CHANGE [COLUMN] old_col_name new_col_name column_definition
[FIRST|AFTER col_name]
| MODIFY [COLUMN] col_name column_definition
[FIRST | AFTER col_name]
| DROP [COLUMN] col_name
| DROP PRIMARY KEY
| DROP {INDEX|KEY} index_name
| DROP FOREIGN KEY fk_symbol
| DISABLE KEYS
| ENABLE KEYS
| RENAME [TO] new_tbl_name
| ORDER BY col_name [, col_name] ...
| CONVERT TO CHARACTER SET charset_name [COLLATE collation_name]
| [DEFAULT] CHARACTER SET [=] charset_name [COLLATE [=] collation_name]
| DISCARD TABLESPACE
| IMPORT TABLESPACE

index_col_name:
col_name [(length)] [ASC | DESC]

index_type:
USING {BTREE | HASH}

table_options:
table_option [[,] table_option]

Options: ReplyQuote


Subject
Written By
Posted
Re: alter table .... add constraint
April 17, 2012 03:08AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.