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?

Upvotes: 0

Views: 61

Answers (2)

user330315
user330315

Reputation:

'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";

Upvotes: 2

VietnamDataEngineer
VietnamDataEngineer

Reputation: 171

SELECT * FROM Restaurants -> You can view all column

Upvotes: 0

Related Questions