...

/

Loading and Querying the Database

Loading and Querying the Database

Explore the imported Chinook dataset with SQL queries.

Chinook database

We’ll be doing four tasks in this section.

  1. Import the Chinook database in PostgreSQL using pgloader. First, we need to start the PostgreSQL service by using the following command:
Press + to interact
service postgresql start

Use the following command to run the upcoming commands as the PostgreSQL superuser.

Press + to interact
su - postgres

Note: The Chinook database is already created for you.

  1. Log in to the database. To use the psql, type the following command in the terminal:
Press + to interact
psql

Use the following command to log in to the Chinook database:

Press + to interact
\c chinook
  1. Now, that the dataset is loaded, list the relations in the Chinook database using the following command:
Press + to interact
\dt
  1. The next task is to see the details of any table in the Chinook database. We’ll see the details of the track table using the following command:
Press + to interact
\d track

Click “Click to connect…” in the following terminal to start.

Terminal 1
Terminal
Loading...

Tip: Press the up and down arrow keys to move between the rows and q to ...