The public schema
The public
schema of a PostgreSQL database is created by default when a new database is created. All users by default have access to this schema unless this access is explicitly restricted. When a database is going to be used by a single user and does not have complex groupings of data objects beyond what can naturally be supported by an object-relational database, the public
schema will usually suffice. No additional schemas need to be added to such a database. This exercise will help to reinforce the idea that the public
schema can be ignored in most basic usage of PostgreSQL.
Este ejercicio forma parte del curso
Creating PostgreSQL Databases
Instrucciones del ejercicio
- Imagine that you are currently using the
pod
database described in previous lessons. Create a table namedusers
(to represent listeners of podcasts on the platform) to thepod
database such that it is added to thepublic
schema.
Ejercicio interactivo práctico
Prueba este ejercicio completando el código de muestra.
-- Add users table to the public schema for the pod database
___ ___ ___ (
id serial PRIMARY KEY,
first_name TEXT NOT NULL,
last_name TEXT NOT NULL,
email TEXT NOT NULL,
hashed_password CHAR(72) NOT NULL
);