Using MySQL 5.5, I am able to execute the CREATE TABLE and INSERT queries individually but when I put them in a .sql script I receive the following error twice:
ERROR 1064 (42000): You have an error in your SQL syntax;
I tried to use the GO statement as recommended here (SQL script doesnt work but individual queries work) but no luck.
Here's my now working script thanks to comments:
-- Create the table
CREATE TABLE person (
id INTEGER PRIMARY KEY,
first_name TEXT,
last_name TEXT,
age INTEGER
);
-- Populate the table
INSERT INTO person
(id, first_name, last_name, age)
VALUES
(0, 'Zed', 'Shaw', 37),
(1, 'Terry', 'Berry', 42),
(2, 'Tyler', 'Brown', 25),
(3, 'Frank', 'Smith', 100);
Thanks for your help!
Here's the complete error message:
mysql> SOURCE ~/code/Learn-SQL-The-Hard-Way/Exercise-12-Destroying-And-Altering-Tables/recreate-person-table.sql
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 '--Create the table
CREATE TABLE person (
id INTEGER PRIMARY KEY,
first_n' at line 1
ERROR:
No query specified
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 '--Populate the table
INSERT INTO person
(id, first_name, last_name, age)
VALUES
' at line 1
GOis not for MySQL, isn't that something for MSSQL?