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.
Bu egzersiz
Creating PostgreSQL Databases
kursunun bir parçasıdırEgzersiz talimatları
- Imagine that you are currently using the
poddatabase described in previous lessons. Create a table namedusers(to represent listeners of podcasts on the platform) to thepoddatabase such that it is added to thepublicschema.
Uygulamalı interaktif egzersiz
Bu örnek kodu tamamlayarak bu egzersizi bitirin.
-- 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
);