Connecting Tech Pros Worldwide Help | Site Map

creating table for rails

  #1  
Old June 20th, 2007, 08:45 AM
Thufir
Guest
 
Posts: n/a
I'm working from <http://www.oracle.com/technology/pub/articles/haefel-
oracle-ruby.html>, would like to adapt the SQL for MySQL, please. Yes, I
know, that's oracle wheras I'm using MySQL. This website happens to be
the best rails tutorial I can find for my purposes, and I'd like to
follow along with it.

Here's what's happening:



[thufir@localhost ~]$
[thufir@localhost ~]$ mysql -u feeds -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 20 to server version: 5.0.27

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql>
mysql>
mysql>
mysql>
mysql>
mysqlshow databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| Comic |
| Legacy |
| dummy |
| dummy_development |
| feeds |
| mysql |
| test |
+--------------------+
8 rows in set (0.01 sec)

mysql>
mysqluse Comic;
Database changed
mysql>
mysqlshow tables;
Empty set (0.00 sec)

mysql>
mysqlCREATE TABLE comics (
-idNUMBER(10) NOT NULL,
-titleVARCHAR2(60),
-issueNUMBER(4),
-publisherVARCHAR2(60),
-PRIMARY KEY (id)
-);
ERROR 1064 (42000): You have an error in your SQL syntax; check the
manual that corresponds to your MySQL server version for the right syntax
to use near '(10) NOT NULL,
titleVARCHAR2(60),
issueNUMBER(4),
publisherVARCHAR2(60),
PRIMARY' at line 2
mysql>
mysqlquit
Bye
[thufir@localhost ~]$
[thufir@localhost ~]$ date
Wed Jun 20 08:36:58 BST 2007
[thufir@localhost ~]$
[thufir@localhost ~]$




thanks,

Thufir

  #2  
Old June 20th, 2007, 07:25 PM
Jeff North
Guest
 
Posts: n/a

re: creating table for rails


On Wed, 20 Jun 2007 07:41:01 GMT, in mailing.database.mysql Thufir
<hawat.thufir@gmail.com>
<hS4ei.40861$NV3.16873@pd7urf2nowrote:
Quote:
>| I'm working from <http://www.oracle.com/technology/pub/articles/haefel-
>| oracle-ruby.html>, would like to adapt the SQL for MySQL, please. Yes, I
>| know, that's oracle wheras I'm using MySQL. This website happens to be
>| the best rails tutorial I can find for my purposes, and I'd like to
>| follow along with it.
>|
>| Here's what's happening:
[snip]
Quote:
>| mysqlCREATE TABLE comics (
>| -idNUMBER(10) NOT NULL,
>| -titleVARCHAR2(60),
>| -issueNUMBER(4),
>| -publisherVARCHAR2(60),
>| -PRIMARY KEY (id)
>| -);
CREATE TABLE comics (
id int(10) NOT NULL,
title varchar(60),
issue smallint(4),
publisher varchar(60),
PRIMARY KEY (id)
) ENGINE=MyISAM;
Quote:
>| ERROR 1064 (42000): You have an error in your SQL syntax; check the
>| manual that corresponds to your MySQL server version for the right syntax
>| to use near '(10) NOT NULL,
>| titleVARCHAR2(60),
>| issueNUMBER(4),
>| publisherVARCHAR2(60),
>| PRIMARY' at line 2
>| mysql>
>| mysqlquit
[snip]
---------------------------------------------------------------
jnorthau@yourpantsyahoo.com.au : Remove your pants to reply
---------------------------------------------------------------
  #3  
Old June 21st, 2007, 05:35 AM
Thufir
Guest
 
Posts: n/a

re: creating table for rails


On Jun 20, 7:17 pm, Jeff North <jnort...@yahoo.com.auwrote:
Quote:
On Wed, 20 Jun 2007 07:41:01 GMT, in mailing.database.mysql Thufir
<hawat.thu...@gmail.com>
>
<hS4ei.40861$NV3.16873@pd7urf2nowrote:
Quote:
| I'm working from <http://www.oracle.com/technology/pub/articles/haefel-
| oracle-ruby.html>, would like to adapt the SQL for MySQL, please.
[...]
Quote:
CREATE TABLE comics (
id int(10) NOT NULL,
title varchar(60),
issue smallint(4),
publisher varchar(60),
PRIMARY KEY (id)
) ENGINE=MyISAM;
[...]


thanks :)


-Thufir

Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
Redefining an auto-generated primary key constraint name danielbuus@gmail.com answers 9 January 10th, 2007 11:35 AM
Web developer wanted in Johannesburg me_jasper answers 1 December 8th, 2006 01:55 PM
String vs Numeric Type Victor Mehta answers 54 December 5th, 2005 02:35 PM