SitePoint Sponsor |
|
User Tag List
Results 1 to 10 of 10
Thread: SQL Problem
-
Jun 4, 2006, 05:34 #1
- Join Date
- Aug 2004
- Location
- Port Sunlight
- Posts
- 815
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
SQL Problem
Hi,
I am trying out this tutorial:
http://www.rails4days.pwp.blueyonder...Rails4Days.pdf
CREATE TABLE 'categories' (
'id' smallint(5) unsigned NOT NULL auto_increment,
'category' varchar(20) NOT NULL default '',
'created_on' timestamp(14) NOT NULL,
'updated_on' timestamp(14) NOT NULL,
PRIMARY KEY ('id'),
UNIQUE KEY 'category_key' ('category')
) TYPE=MyISAM COMMENT='List of categories';
It gives me an error, saying SQL execution error # 1064.
Anyone know why?
-
Jun 4, 2006, 05:52 #2
If you're using a version of MySQL greater than 4.1 you have to use ENGINE=MyISAM, not TYPE.
-
Jun 4, 2006, 05:57 #3
- Join Date
- Aug 2004
- Location
- Port Sunlight
- Posts
- 815
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
ok, however it is still giving me an error:
I have attached a screenshot.
Also, I wasn't sure if this should have gone in MySQL or Ruby, because it was a ruby tutorial, I thought it may have gone there.
-
Jun 4, 2006, 06:16 #4
- Join Date
- Aug 2005
- Posts
- 986
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Try a migration:
Code:create_table :categories do |t| t.column :category, :string t.column :created_on, :datetime t.column :updated_on, :datetime end
-
Jun 4, 2006, 06:22 #5
- Join Date
- Aug 2004
- Location
- Port Sunlight
- Posts
- 815
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
What's a migration?
Also I would like to use this SQL, because i'm following a tutorial and I don't really want to sidestep it,
-
Jun 4, 2006, 08:20 #6
Originally Posted by NickToye
-
Jun 4, 2006, 08:49 #7
- Join Date
- Aug 2004
- Location
- Port Sunlight
- Posts
- 815
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Yeah, so its a more simplified way of creating SQL, or a more Rails/Ruby native way of creating data.
Is that right?
-
Jun 4, 2006, 09:32 #8
Originally Posted by NickToye
-
Jun 4, 2006, 09:37 #9
- Join Date
- Aug 2004
- Location
- Port Sunlight
- Posts
- 815
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
It looks good, I like the fact that it makes logical sense too.
-
Jun 4, 2006, 09:42 #10
- Join Date
- May 2003
- Location
- London, On.
- Posts
- 1,127
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Which IDE are you using btw? Looks sharp
Bookmarks