IniziaInizia gratis

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.

Questo esercizio fa parte del corso

Creating PostgreSQL Databases

Visualizza il corso

Istruzioni dell'esercizio

  • Imagine that you are currently using the pod database described in previous lessons. Create a table named users (to represent listeners of podcasts on the platform) to the pod database such that it is added to the public schema.

Esercizio pratico interattivo

Prova a risolvere questo esercizio completando il codice di esempio.

-- 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
);
Modifica ed esegui il codice