Schema

A schema is the logical structure of a database, defining tables, columns, relationships, constraints, and indexes.

Explanation:

  • A schema organizes how data is stored in a database.
  • It includes definitions of tables, views, triggers, functions, and permissions.
  • A database can have multiple schemas, each with its own set of tables and objects.

Example Schema Definition in SQL:

sqlCopyEditCREATE SCHEMA School;
CREATE TABLE School.Students (
    student_id INT PRIMARY KEY,
    name VARCHAR(50),
    age INT
);

Here, we created a schema named School and a table Students within it.