Command
psql -c "SELECT * FROM tablename;"
Explanation
Executes a given SQL query directly from the command line.
Examples
Query all rows from users table
psql -c "SELECT * FROM users;"
psql -c "SELECT * FROM tablename;"
Executes a given SQL query directly from the command line.
Query all rows from users table
psql -c "SELECT * FROM users;"