Creating Databases
Overview
In this lab we will create two databases in PostgreSQL.
Download the files
- Click on these links to download the two .sql files to your virtual machine
-
Open each file in pgAdmin (or your preferred PostgreSQL client), and review the contents before executing them.
-
Each script starts with a
CREATE DATABASEstatement. PostgreSQL doesn't let you create a database and then use it in the same script/connection, so for each file:- Run just the first line (
CREATE DATABASE pubs;/CREATE DATABASE sports_joins;) while connected to any existing database. - Refresh the server's list of databases, then open a new query tool connected to the database you just created.
- Run the rest of the script in that connection to create the tables and load the data.
- Run just the first line (
-
Refresh the schemas and look at the databases / tables that have been created.