What is the difference between single and double quotes in SQL?

前端 未结 6 1614
故里飘歌
故里飘歌 2020-11-22 07:30

What is the difference between single quotes and double quotes in SQL?

6条回答
  •  遥遥无期
    2020-11-22 08:04

    Single quotes delimit a string constant or a date/time constant.

    Double quotes delimit identifiers for e.g. table names or column names. This is generally only necessary when your identifier doesn't fit the rules for simple identifiers.

    See also:

    • Do different databases use different name quote?

    You can make MySQL use double-quotes per the ANSI standard:

    SET GLOBAL SQL_MODE=ANSI_QUOTES
    

    You can make Microsoft SQL Server use double-quotes per the ANSI standard:

    SET QUOTED_IDENTIFIER ON
    

提交回复
热议问题