mysql - Im getting an error when creating my database (#1064) -


i trying create database using phpmyadmin keep on getting error

#1064 - have error in sql syntax; check manual corresponds mysql server version right syntax use near ') not null,first name varchar(30) not null,last name varchar(30) not' @ line 3

im using tomcat version 8.0. below query executing

create table `cs485_lab5`.`orders` (     `item number` varchar(20) not null,      `price` double(10) not null,      `first name` varchar(30) not null,      `last name` varchar(30) not null,      `shipping address` varchar(50) not null,      `credit card` varchar(20) not null,      `ccn` int(16) not null,      primary key (`credit card`) ) engine = innodb; 

don't specify length double. also, if designing table, don't put spaces in column names. use names don't need escaping. having use escape characters clutters queries unnecessarily.

so:

create table orders (     `itemnumber` varchar(20) not null,      `price` double not null,      `firstname` varchar(30) not null,      `lastname` varchar(30) not null,      `shippingaddress` varchar(50) not null,      `creditcard` varchar(20) not null,      `ccn` int(16) not null,      primary key (`creditcard`) ) engine = innodb; 

here sql fiddle.


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -