Mysql query | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Mysql query

I used double quotes on date and time in my query and my professor is saying that date and time needs single quote. Would a double quote give an error? INSERT INTO Bookings ( user_id, room_id, date, start, end, purpose) VALUES ( 5, 20, "2020-08-26","7:00 PM", "9:00 PM", "CS 215 final exam");

30th Aug 2020, 1:35 AM
Vrushti Patel
Vrushti Patel - avatar
2 Answers
+ 2
It probably won't produce an error, but double quotes is not typical SQL convention. "Single quotes are used to indicate the beginning and end of a string in SQL. Double quotes generally aren't used in SQL, but that can vary from database to database. Stick to using single quotes"
30th Aug 2020, 1:55 AM
Steven M
Steven M - avatar
+ 1
insert into Bookings('user_id',....'purpose')values(......); we use backquote not single or double quotes to indicate the columns of a table.
30th Aug 2020, 9:53 AM
HBhZ_C - avatar