0

I have an sql statement that looks like this: SELECT name FROM companies WHERE name = government;

But then the error says this: Unknown column 'government' in 'where clause',

enter image description here

But anyway, why is this happening? I've been stuck on it for 30 minutes and simply putting SELECT name FROM companies will work (no error).

GMB
  • 216,147
  • 25
  • 84
  • 135
SirSpeciam
  • 169
  • 10

2 Answers2

3

You want to compare a column against a literal string - for this, you need to surround the string with single quotes, otherwise the database takes it as a column name. So:

SELECT name FROM companies WHERE name = 'government';
GMB
  • 216,147
  • 25
  • 84
  • 135
0

You need to put quotes ' around government

SELECT 
    name 
FROM companies 
WHERE name = 'government';
zealous
  • 7,336
  • 4
  • 16
  • 36