sqlpostgresqlquoted-identifier

displaying column names instead of data from psql terminal


I connect to the remote ubuntu 20.04 computer from the terminal with ssh, connect to the database that I have installed on the postgres user, and I want to see the data in a column with psql commands. I am not displaying the data, but the columns as much as the number of data.

The codes I write:

SELECT 'Name' FROM "Restaurants";

The result:

enter image description here

How can I view the datas?


Solution

  • 'Name' is a string constant, identifiers (column names) must be enclosed in double quotes (the same you did with the table name)

    SELECT "Name" FROM "Restaurants";