Term Confusion!

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
cashflowtips
Forum Newbie
Posts: 22
Joined: Tue Jul 31, 2007 11:06 pm

Term Confusion!

Post by cashflowtips »

i want to create a table using mysql by following the example given in a book but i facing this problem...

Code: Select all

CREATE TABLE user_session {
"id"SERIAL PRIMARY KEY NOT NULL
}
what i dont understand is what does it mean by SERIAL PRIMARY KEY? so, what kind of datatype use for id?
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Re: Term Confusion!

Post by onion2k »

cashflowtips wrote:i want to create a table using mysql by following the example given in a book but i facing this problem...

Code: Select all

CREATE TABLE user_session {
"id"SERIAL PRIMARY KEY NOT NULL
}
what i dont understand is what does it mean by SERIAL PRIMARY KEY? so, what kind of datatype use for id?
Serial used to be an alias for an auto incrementing BIGINT field. It's a Postgresql feature that MySQL added for compatibility. It's not mentioned in the MySQL manual any more though so I guess it's been dropped.
cashflowtips
Forum Newbie
Posts: 22
Joined: Tue Jul 31, 2007 11:06 pm

Post by cashflowtips »

so, can i use this "SERIAL" in normal MySQL...? how?
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Post by onion2k »

cashflowtips wrote:so, can i use this "SERIAL" in normal MySQL...? how?
I wouldn't recommend using it even if the alias is still available. Define your tables properly using the data types set out in the MySQL manual.
cashflowtips
Forum Newbie
Posts: 22
Joined: Tue Jul 31, 2007 11:06 pm

Post by cashflowtips »

can u give me some example bcoz i never use postgresql before... from wut i notice, the command to connect to table is using pg_connect,pg_query and etc which i believed stand for postgresql... so how can i change it so that i can be used in normal mysql?
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Post by onion2k »

There's millions of examples of how to use PHP with MySQL online. Use Google to find some. Better yet, use the PHP manual.

PS. We have a rule about using AOL speak (u, bcoz, wut). Don't use it.
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Post by califdon »

cashflowtips wrote:can u give me some example bcoz i never use postgresql before... from wut i notice, the command to connect to table is using pg_connect,pg_query and etc which i believed stand for postgresql... so how can i change it so that i can be used in normal mysql?
MySQL and Postgresql are two entirely different database engines, with their own variations of SQL language. Don't mix them up! Use one or the other!
Post Reply