Structure of a SELECT query

Let's start with a simple example.

We will use the sample database of a car web portal, which was mentioned in previous chapters. Assuming you have already installed a PostgreSQL server on your local machine and you have superuser access to the database, navigate to the directory where the schema.sql file is located and execute the following command to create the sample database:

> psql -h localhost -d postgres -f schema.sql CREATE ROLEpsql:schema.sql:3: NOTICE: database "car_portal" does not exist, skippingDROP DATABASECREATE DATABASEpsql (11.0)You are now connected to database "car_portal" as user "postgres".CREATE SCHEMASETSETCREATE TABLE...

The output might be different depending on the operating system and ...

Get Learning PostgreSQL 11 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.