Jump to content

Hi guys! :)

 

I'm doing exercises in my PHP and SQL book and need to make a Pet Catalog so i created a DB called petCatalog and the book provides me with the following SQL query: 

CREATE TABLE Pet (    petID	INT(5)	SERIAL,    petName	VARCHAR(25)	NOT NULL,    petType VARCHAR(25) NOT NULL,    PetDescription	VARCHAR(225),    price	DECIMAL(9,2),    pix		CHAR(15)	NOT NULL DEFAULT "na.gif",PRIMARY KEY(petID) );

but the book says that if i use PHPMyAdmin instead of SERIAL i need to define BIGINT NOT NULL AUTO_INCREMENT, and so my code is

CREATE TABLE Pet (    petID	INT(5)	BIGINT NOT NULL AUTO_INCREMENT,    petName	VARCHAR(25)	NOT NULL,    petType VARCHAR(25) NOT NULL,    PetDescription	VARCHAR(225),    price	DECIMAL(9,2),    pix		CHAR(15)	NOT NULL DEFAULT "na.gif",PRIMARY KEY(petID) );

But PHPMyAdmin gives me the following error: "#1064 - 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 'BIGINT NOT NULL AUTO_INCREMENT,

    petName    VARCHAR(25)    NOT NULL,
    petType ' at line 2"

 

What is wrong with my SQL Query? 

 

Thanks!

 

[CPU: AMD FX-6100 @3.3GHz ] [MoBo: Asrock 970 Extreme4] [GPU: Gigabyte 770 OC ] [RAM: 8GB] [sSD: 64gb for OS] [PSU: 550Watt Be Quiet!] [HDD: 1TB] [CPU cooler: Be Quiet! Shadow Rock Pro Sr1]  -Did i solve your question/problem? Please click 'Marked Solved'-

Link to comment
https://linustechtips.com/topic/287674-what-is-wrong-with-this-sql-query/
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×