> Folks, this is funny.
>
> I've been using Oracle for several months, and started teaching myself
MySQL
> since last weekend. I'm currently using the MySQL version 3.23.49

You might want to go get the latest if you can (4.0.14).

> I found something really interesting: In Oracle, I have to create the
> Foreign Key in order to join 2 tables. It's quite different when I deal
with
> MySQL. I can join two tables without creating the Foreign Key. ----- Is
this
> Normal? Before learning MySQL, I thought both MySQL and Orcle use
Structural
> Query Language, which should be the same. But, now I know I'm wrong.

You are using MyISAM tables - the default. There are a few issues with this
table type:

1) Table level locking. Update a single row in a table locks the whole thing
2) No commit/rollback. Make a mistake updating a record, and you can't
rollback
3) No foreign keys.

At the end of your table definition, you just add "TYPE=INNODB"; for
example,

CREATE TABLE parent
(
    parent_prim_key INTEGER(10) NOT NULL PRIMARY KEY,
    ....
) TYPE=INNODB;

CREATE TABLE child
(
    child_prim_key INTEGER(10) NOT NULL PRIMARY KEY,
    parent_prim_key INTEGER(10) NOT NULL,
    ...
) TYPE=INNODB;

ALTER TABLE child ADD CONSTRAINT FOREIGN KEY (parent_prim_key) REFERENCES
parent (parent_prim_key);

> Also, when I insert data to a table in MySQL, the values can be enclosed
by
> single quotes, like 'alan', In Oracle, NO WAY, you have to use double
> quotes, like "alan".

Oracle is really fussy - ' is the only string-delimiter. If you have a ' in
the middle of a string (for example, 'Barry's') then you need to escape
the ' between the y and the s, and you end up with 'Barry''s', which is
messy. MySQL recognizes a variety of wrappers around a string. If you are
moving data
from Oracle to MySQL, you can just wrap strings in "" and dump them into
MySQL.

> It seems I really should get a MySQL book. Which one is the best?

The docs are quite good for MySQL. Paul DuBois' MySQL, Second Edition is
good if you want a bit more depth, plus insight into the programming
interfaces. If you are doing an Oracle->MySQL migration, then the MySQL
Cookbook will be helpful.

David

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to