Home > OS >  Can ' ' and " " be use interchangeably in SQL?
Can ' ' and " " be use interchangeably in SQL?

Time:09-15

SELECT
*
FROM 
project_id
WHERE
Genre = 'Comedy'


SELECT
*
FROM
project_id
WHERE
Genre "Comedy"

CodePudding user response:

No. Single quotes are for string literals. Double are for column names and any other identifiers.

SELECT
    "user name" AS username, -- double quotes because the column name has a space
FROM table
WHERE status = 'active'

CodePudding user response:

'' = for string values "" = identifiers '' works at any database and some programs will concatenate with "" which can be a trouble at some point.

  •  Tags:  
  • sql
  • Related