Hi everyone I am new to StackOverflow and SQL. I am not sure how to phrase the title so google was not very helpful.
I am doing a simple SELECT query:
SELECT * FROM Department WHERE DepartmentName = "Controller's Office"
I would like to return all results that has DepartmentName of “Controller’s Office”. The name itself has a single quotation that must not be removed(because boss said so). Using single quotation marks does not work. and returns an error:
Invalid column name 'Controller's Office'.
How can i do the query so that it works? If you are doing anything complicated please explain because i am new thanks!
Most variants of SQL (you don’t specify what you are using) will let you escape single quotes using another single quote:
Double quotes (in most of the variants of SQL that I know) are used to delimit identifiers (column and table names) that contain characters that are not otherwise valid in an identifier’s name.