|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
Alter table needs help
I'm trying to add a field to an existing table. I would like this field to be a foreign key to another table not yet created. When I follow the code in my book I get an error on the adding of the field. Here is what code I'm using.
mysql> ALTER TABLE joke ADD author_id AFTER joke_date; ERROR 1064: You have an error in your SQL syntax near 'AFTER joke_date' at line 1 Thanks for any help. |
|
#2
|
|||
|
|||
|
RE: Alter table needs help
You've gop the right idea, but you need to specify the column type, and any other attributes, just as you do when creating a table. Try something like this:
Code:
mysql> ALTER TABLE joke ADD author_id TINYINT NOT NULL DEFAULT 0 AFTER id; |
![]() |
| Viewing: Codewalkers Forums > Other Technologies > Database Help > Alter table needs help |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|