Jump to content
Larry Ullman's Book Forums

Sql Tables Chpt 7 Problem With Orders Table


Recommended Posts

Hi

 

I am trying to create the orders table and I am using MAMP - I copied your tables exactly from your downloaded file ex2 SQL SQL. but the only table that won't work is the orders table:

 

CREATE TABLE `orders` (

`id` int(10) unsigned NOT NULL AUTO_INCREMENT,

`customer_id` int(10) unsigned NOT NULL,

`total` decimal(7,2) unsigned DEFAULT NULL,

`shipping` decimal(5,2) unsigned NOT NULL,

`credit_card_number` mediumint(4) unsigned NOT NULL,

`order_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,

PRIMARY KEY (`id`),

KEY `customer_id` (`customer_id`),

KEY `order_date` (`order_date`)

) ENGINE=InnoDB DEFAULT CHARSET=utf8;

 

It won't accept the total column for some reason - pls help

Link to comment
Share on other sites

Not sure what to tell you, e-mazed, but I just fired up XAMPP on Windows, made a sample DB, and copied your table creation SQL code into phpMyAdmin, and it created the table without any problems.

 

There must be a conflict with something else, because the syntax itself seems fine.

Link to comment
Share on other sites

Thanks - i am completely lost on this one - Just so i am following the same path as you - I created a database called ecommerces2 - then at the top i have a structure tab - followed by a SQL tab - in that tab I dumped the above code and selected "go" - when i do that i am returned with this

#1146 - Table 'ecommerces2.orders' doesn't exist

Link to comment
Share on other sites

Hi

 

I am trying to create the orders table and I am using MAMP - I copied your tables exactly from your downloaded file ex2 SQL SQL. but the only table that won't work is the orders table:

 

CREATE TABLE `orders` (

`id` int(10) unsigned NOT NULL AUTO_INCREMENT,

`customer_id` int(10) unsigned NOT NULL,

`total` decimal(7,2) unsigned DEFAULT NULL,

`shipping` decimal(5,2) unsigned NOT NULL,

`credit_card_number` mediumint(4) unsigned NOT NULL,

`order_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,

PRIMARY KEY (`id`),

KEY `customer_id` (`customer_id`),

KEY `order_date` (`order_date`)

) ENGINE=InnoDB DEFAULT CHARSET=utf8;

 

It won't accept the total column for some reason - pls help

 

Try removing the backticks from the SQL code then run it through phpmyadmin.

Link to comment
Share on other sites

 Share

×
×
  • Create New...