2

Please, understand my question first.

So, I have been thinking is there any difference if I use double quote (") for string in SQL coding and not single quote (')?

Watch this video (from 2:30) from Khan Academy to better understand my question. https://www.khanacademy.org/computing/computer-programming/sql/sql-basics/pt/creating-a-table-and-inserting-data

I am not using double quote anywhere else it is just for string and for inserting data into table.

So, what is the problem with it ?

I expect logical answer from the expert SQL Coder. Thanks in advance.

enter image description here

enter image description here

Shuvongkor
  • 333
  • 4
  • 10
  • 1
    I would use single quote as it makes your SQL compatible with Sql Server. Not sure what the ANSI standard is, if it is single quote then hands down that would be my choice. – Joe C Feb 27 '19 at 20:14
  • 1
    The ANSI SQL standards define doubles quotes as database object names delimiters, while single quotes are dedicated to string literals – PM 77-1 Feb 27 '19 at 20:16
  • A few more details are [with this answer](https://stackoverflow.com/questions/1992314/what-is-the-difference-between-single-and-double-quotes-in-sql) – danblack Feb 27 '19 at 20:16
  • The expert SQL coder did not get my point, I already know the difference, but I am just not sure what is the problem of using double quote for inserting data into a table. Why no one gets it ? – Shuvongkor Feb 27 '19 at 20:32

1 Answers1

3

Single quotes in Sql Vs Double quotes in sql could have seem like a char vs string in other languages.

But, in sql there is as such no difference between the two. It is the general standard to use single qoutes. There are some cases though we require double-qoutes as well i guess it depends on the requirement also

For instance, If you use variable to store then in order to differentiate the two you can store in double qoutes and use the other in single qoutes.

Himanshu
  • 3,830
  • 2
  • 10
  • 29
  • I am not using double quote anywhere else it is just for string and for inserting data into table. So, any problem with it. – Shuvongkor Feb 27 '19 at 20:37
  • Theres no problem with that it will work. But, it is just that you should follow general conventional method usage which is single qoutes – Himanshu Feb 28 '19 at 05:27
  • I know that I just want to know what is the problem. I mean what error will occur? – Shuvongkor Feb 28 '19 at 08:56