PostgreSQL and IMDb
We will use the CLI (command line interface) of PostgreSQL to import our first database. You can download and install PostgreSQL directly from the official website Links to an external site.. The database we will use is a snapshot imdb_dump.sql.zip of the IMDb (Internet Movie Database). Make sure that the imdb_dump.sql file is unzipped and located in your working directory. Make sure postgres there is a registered postgres user (needed by the IMDb database). Then, start the CLI with the default database, create the IMDb database, connect to it, and finally import the sql file.
$ createuser -s postgres
$ psql -U postgres
2021-11-08 10:00:56
psql (14.0)
Type "help" for help.
postgres=# CREATE DATABASE imdb;
CREATE DATABASE
postgres=# \c imdb
You are now connected to database "imdb" as user "postgres".
imdb=# \i imdb_dump.sql;
The final command should take about 1 minute to execute, you’ll see that it creates tables and copies data into them. Once it is done you can exit the CLI with the exit command or run queries on the database.