I am attempting to create tables for a MySQL database, but I am having some syntactical issues. It would seem that syntax checking is behaving differently between tables for some reason. While I've gotten all the other tables to go through, the table, 'stock' doesn't seem to be working, despite seeming to use the same syntax patterns.
CREATE TABLE users (
user_id SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT,
username VARCHAR(30) NOT NULL,
password CHAR(41) NOT NULL,
date_joined DATETIME NOT NULL,
funds DOUBLE UNSIGNED NOT NULL,
PRIMARY KEY(user_id),
UNIQUE KEY(username)
);
CREATE TABLE owned_stocks (
id SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT,
user_id SMALLINT UNSIGNED NOT NULL,
paid_price DOUBLE UNSIGNED NOT NULL,
quantity MEDIUMINT UNSIGNED NOT NULL,
purchase_date DATETIME NOT NULL,
PRIMARY KEY(id)
);
CREATE TABLE tracking_stocks (
ticker VARCHAR(5) NOT NULL,
user_id SMALLINT UNSIGNED NOT NULL,
PRIMARY KEY(ticker)
);
CREATE TABLE stocks (
ticker VARCHAR(5) NOT NULL,
last DOUBLE UNSIGNED NOT NULL,
high DOUBLE UNSIGNED NOT NULL,
low DOUBLE UNSIGNED NOT NULL,
company_name VARCHAR(30) NOT NULL,
last_updated INT UNSIGNED NOT NULL,
change DOUBLE NOT NULL,
percent_change DOUBLE NOT NULL,
PRIMARY KEY(ticker)
);
Am I just missing a really obvious syntactical issue?
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 'change DOUBLE NOT NULL, percent_change DOUBLE NOT NULL, last
DOUBLE' at line 4