Using SELECT expressions
So far, you have used the most basic SELECT query of this pattern:
SELECT * FROM <table_name>;
This query pulls all rows from a single table. For each row, all columns are displayed. This can be used to check what data exists in the table. However, selecting all columns blindly is usually not necessary and can cause significant performance issues. Many times, you can specify the list of columns by replacing the * sign with a list of column names, such as the following:
SELECT product_id, model, base_msrp FROM products;
This will return the product_id, model, and base_msrp information of all the products in this table. You can arrange the columns in any order, regardless of the order in the table definition. PostgreSQL will display the columns based on the order in the SELECT statement:
product_id |         model         | base_msrp
-------...