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

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

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

6条回答
  •  忘了有多久
    2020-11-22 08:08

    In ANSI SQL, double quotes quote object names (e.g. tables) which allows them to contain characters not otherwise permitted, or be the same as reserved words (Avoid this, really).

    Single quotes are for strings.

    However, MySQL is oblivious to the standard (unless its SQL_MODE is changed) and allows them to be used interchangably for strings.

    Moreover, Sybase and Microsoft also use square brackets for identifier quoting.

    So it's a bit vendor specific.

    Other databases such as Postgres and IBM actually adhere to the ansi standard :)

提交回复
热议问题