Why does T-SQL think a an item is a column name?

150 Views Asked by At

Note: I am just starting with SQL/T-SQL and I am not searching for a more elegant solution, just for a fix.

So I'm trying to use the Stack Exchange Data Explorer to count how many times a badge has been awarded. My query goes something like this:

SELECT COUNT(Id)
FROM Badges
WHERE Name = "Scholar"

The results should be the number of times the Badge has been awarded. It, however, returns this error:

Line 3: Invalid column name 'Scholar'.
1

There are 1 best solutions below

0
Lenroy Yeung On BEST ANSWER

Replace double quote to single quote

SELECT COUNT(Id)
FROM Badges
WHERE Name = 'Scholar'