enter image description hereThe Horse
table has the following columns:
ID - integer, auto increment, primary key
RegisteredName - variable-length string
Breed - variable-length string - must be one of the following: Egyptian Arab, Holsteiner, Quarter Horse, Paint, Saddlebred
Height - decimal number (must be between 10.0 and 20.0)
BirthDate - date,` must be on or after Jan 1, 2015
Insert the following data into the Horse
table.
This is my code for query:
-- Your SQL statements goes here
INSERT INTO Horse (RegisteredName, Breed, Height, BirthDate)
VALUES ('Babe', 'Quarter Horse', 15.3, '2015-02-10'),
('Independence', 'Holsteiner', 16.0, '2017-03-13'),
('Ellie', 'Saddlebred', 15.0, '2016-12-22'),
(NULL, 'Egyptian Arab', 14.9, '2019-10-12');
I get errors when trying to execute this code.
SELECT *
FROM Horse;
CodePudding user response:
It is impossible to answer your question without knowing what errors you get and what version of SQL you use. Also, please format your SQL statements with code tags so that they are easier to read; you do so by putting three backticks ` around the code.
CodePudding user response:
The Horse table has the following columns:
ID - integer, auto increment, primary key
RegisteredName - variable-length string
Breed - variable-length string,
must be one of the following: Egyptian Arab,
Holsteiner, Quarter Horse, Paint, Saddlebred
Height - decimal number,
must be between 10.0 and 20.0
BirthDate - date,
must be on or after Jan 1, 2015 Insert the following data into the Horse table:
This is my code for query:
-- Your SQL statements goes here INSERT INTO Horse (RegisteredName, Breed, Height, BirthDate) VALUES('Babe','Quarter Horse', 15.3, '2015-02-10'), ('Independence', 'Holsteiner', 16.0, '2017-03-13'), ('Ellie', 'Saddlebred', 15.0, '2016-12-22'), (NULL, 'Egyptian Arab', 14.9, '2019-10-12');
Instead of doing this i think you should put height value in qoutes because its a string type try this query and let me know
INSERT INTO Horse (RegisteredName, Breed, Height, BirthDate) VALUES('Babe','Quarter Horse', '15.3', '2015-02-10'), ('Independence', 'Holsteiner', '16.0', '2017-03-13'), ('Ellie', 'Saddlebred', '15.0', '2016-12-22'), (NULL, 'Egyptian Arab', '14.9', '2019-10-12');