Home > database >  MySQL Workbench Error Code 1054 for Invalid Column Even When I Have the Corresponding Column Name
MySQL Workbench Error Code 1054 for Invalid Column Even When I Have the Corresponding Column Name

Time:07-17

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

CodePudding user response:

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();
  • Related