Schema
In the context of databases, a schema refers to the logical structure or blueprint that defines the organization, relationships, and constraints of a database system. It provides a framework for organizing and representing the data stored within the database.

Public schemas The public schema is the default location for objects when no schema is specified explicitly. The public schema is accessible to all users and roles in the database by default
A schema typically includes:
-
Tables
-
Relationships: Schemas define how tables are related to each other through relationships. Relationships establish connections between tables based on common columns, allowing the database to retrieve related data from multiple tables when necessary. Common relationship types include one-to-one, one-to-many, and many-to-many.
-
Constraints: Constraints enforce rules and conditions on the data stored in the database, ensuring data integrity and consistency. Examples of constraints include primary keys (uniquely identify each row in a table), foreign keys (establish relationships between tables), and check constraints (validate data based on specified conditions).

-
Views, Procedures, and Functions: Schemas can also include views, procedures, and functions. Views are virtual tables that present data from one or more tables in a predefined manner. Procedures and functions are executable blocks of code that perform specific operations on the data or provide reusable functionality.