0

I keep getting a syntax error, but I'm new to SQL and I am having trouble locating the error. I have reviewed multiple articles with no luck in solving my problem

CREATE TABLE 'stock_prices' (
'price_date' DATE NOT NULL,    
'minute_time' DATETIME NOT NULL,
'ticker' VARCHAR(20) NOT NULL,
'open_price' DECIMAL(15,6) NULL DEFAULT NULL,
'high_price' DECIMAL(15,6) NULL DEFAULT NULL,
'low_price' DECIMAL(15,6) NULL DEFAULT NULL,
'close_price' DECIMAL(15,6) NULL DEFAULT NULL,                                  
'total_volume' BIGINT(20) NOT NULL,                                             
'total_quantity' INT(11) NULL DEFAULT NULL,                                     
'total_trade_count' INT(11) NOT NULL,                                           
PRIMARY KEY ('ticker'))ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

Error:

ERROR 1064 (42000): 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 ''stock_data' ( 'price_date' DATE NOT NULL,
'minute_time' DATETIME NOT NULL,
'tic' at line 1
Michael Bianconi
  • 5,072
  • 1
  • 10
  • 25

1 Answers1

2

Change the quotes:

CREATE TABLE stock_prices ( `price_date` DATE NOT NULL, 
  `minute_time` DATETIME NOT NULL,
  `ticker` VARCHAR(20), 
  `open_price` DECIMAL(15,6) NULL DEFAULT NULL,
  `high_price` DECIMAL(15,6) NULL DEFAULT NULL,
  `low_price` DECIMAL(15,6) NULL DEFAULT NULL,
  `close_price` DECIMAL(15,6) NULL DEFAULT NULL,
  `total_volume` BIGINT(20) NOT NULL,
  `total_quantity` INT(11) NULL DEFAULT NULL,
  `total_trade_count` INT(11) NOT NULL, 
  PRIMARY KEY (`ticker`)) 
ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
The Impaler
  • 45,731
  • 9
  • 39
  • 76
GSBYBF
  • 160
  • 3