[FIXED] MySQL Workbench Error Code 1054 for Invalid Column Even When I Have the Corresponding Column Name

Issue

I am having an issue with MySQL Community Server Workbench. I input this command on MySQL File Queries and get this error

Command:

use CIA_DATA;

SELECT * FROM new_table;

SELECT Country, GDP, Electricity;
FROM new_table;
WHERE GDP < 4000;
ORDER BY Electricity;

select now(); database();

Error: 22:03:14 SELECT Country, GDP, Electricity LIMIT 0, 50000 Error Code: 1054. Unknown column 'Country' in 'field list' 0.000 sec

Please let me know what mistakes I have made. Keep in mind that my Result Grid has these field names/columns: Water, Sanitation, GDP, Life, Underweight, Literacy, Electricity, Country

Thanks


Solution

Sorry for the short comment, but I used my tablet and hate virtual keyboards.

Semicolons separate instructions. So you have to rewrite the code to:

SELECT Country, GDP, Electricity
FROM new_table
WHERE GDP < 4000
ORDER BY Electricity;

select now(), database();


Answered By - Wiimm
Answer Checked By - Marie Seifert (sql.easybugfix Admin)

Related Posts

Post a Comment