Mysql query | Sololearn: Learn to code for FREE!

+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");

8/30/2020 1:35:03 AM

Vrushti Patel

3 Answers

New Answer

+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" https://discuss.codecademy.com/t/whats-the-difference-between-single-quote-and-double-quote-in-sql-query/268730

+2

+1

insert into Bookings('user_id',....'purpose')values(......); we use backquote not single or double quotes to indicate the columns of a table.