Help me : SQL
Sure, I was stuck on this code Coach for a long time can't figure out the mistake Code : Insert into garage (ID ,Make,Model,ProdYear) Values (6,'Mercedes-Benz','G 63', 2020), (7,'Porche', 'panamera', 2020); Select * from Garage
6/26/2022 3:42:15 PM
Hrithika Reddy
9 Answers
New AnswerI have just tried it and this works (last line is not necessary): INSERT INTO Garage (id, Make, model, prodyear) VALUES (6, 'Mercedes-Benz', 'G 63', 2020), (7, 'Porsche', 'Panamera', 2020 ); SELECT * from Garage ORDER BY id;
Thanks paul Jayakrishna DaGD bot and Ipang ! Ive got it ! Thx so much. Make sure to read my codes
Use insert for single colomn entry.. Separate that into two instructions for clarity..
insert into garage (ID ,Make,Model,ProdYear) Values(6,'Mercedes-Benz','G 63', 2020); insert into garage values (7,'Porche', 'panamera', 2020) ; select * from garage ; edit: Hrithika Reddy make sure your column names correct... if it is in orderly , and all values mentioned then don't need to specify column names.. as shown in second way.. actually what is error showing, can you mention?
Idk what language you're using but if you want to insert many it looks like this (Python btw) c.executemany(f"INSERT INTO {language} VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", data) The questions marks represent the items you want to insert, the data is a list of the items I wanna insert. I probably worded it wrong so I'll probably just send you a video link of how SQLITE3 works
Check and recheck whether all the values you insert are exactly as shown in the task instruction. A small typo or different letter case matters.