Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
20 views3 pages

Lecture 3 Database Schema Architecture

The document provides an overview of Database Schema Architecture, categorizing it into three levels: Conceptual Schema, Physical Schema, and External Schema. It explains the components of a database schema, including tables, keys, constraints, and indexes, and emphasizes the importance of a well-designed schema for efficient data management. Examples are provided to illustrate each schema level and its function within a database.

Uploaded by

ihassank8
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views3 pages

Lecture 3 Database Schema Architecture

The document provides an overview of Database Schema Architecture, categorizing it into three levels: Conceptual Schema, Physical Schema, and External Schema. It explains the components of a database schema, including tables, keys, constraints, and indexes, and emphasizes the importance of a well-designed schema for efficient data management. Examples are provided to illustrate each schema level and its function within a database.

Uploaded by

ihassank8
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Lecture on Database Schema Architecture

Introduction to Database Schema Architecture

A database schema is the blueprint of a database that defines how data is organized, stored, and
accessed. It consists of tables, fields, relationships, constraints, and rules that ensure data integrity. The
Database Schema Architecture is categorized into three levels based on the ANSI/SPARC architecture
model:

1. Conceptual Schema (Logical Level)

2. Physical Schema (Storage Level)

3. External Schema (View Level)

1. Conceptual Schema (Logical Level)

Represents the overall structure of the database.

Defines entities, attributes, and relationships.

Independent of physical storage.

Helps in understanding how data is logically related.

Example of Conceptual Schema

Consider a university database with the following entities:

Student (StudentID, Name, Age, Address, CourseID)

Course (CourseID, CourseName, Credits)

Enrollment (EnrollmentID, StudentID, CourseID, EnrollmentDate)

A conceptual schema can be represented using an Entity-Relationship Diagram (ERD):

(Student) --- (Enrollment) --- (Course)


2. Physical Schema (Storage Level)

Defines how data is physically stored on disk.

Includes details like indexes, partitions, storage engines, and file organization.

Directly affects the performance and scalability of the database.

Example of Physical Schema

Consider the Student table stored in a relational database:

CREATE TABLE Student (

StudentID INT PRIMARY KEY,

Name VARCHAR(50),

Age INT,

Address TEXT,

CourseID INT,

FOREIGN KEY (CourseID) REFERENCES Course(CourseID)

) ENGINE=InnoDB;

The PRIMARY KEY (StudentID) uniquely identifies each student.

FOREIGN KEY (CourseID) ensures referential integrity.

ENGINE=InnoDB specifies the storage engine used.

3. External Schema (View Level)

Defines how users interact with the database.

Different users can have different views of the same database.

Improves data security by restricting access to sensitive data.

Example of External Schema (View)

A university admin may need access to all student details, but a student should only see their own
records. This can be achieved using SQL Views:

CREATE VIEW StudentView AS

SELECT StudentID, Name, Age, CourseID FROM Student;


A student querying StudentView will see only selected columns.

Database Schema Components

1. Tables

Core building blocks of a database.

Store data in rows and columns.

2. Keys

Primary Key (PK): Uniquely identifies a record.

Foreign Key (FK): Establishes relationships between tables.

3. Constraints

NOT NULL: Ensures a column cannot be empty.

UNIQUE: Ensures unique values in a column.

CHECK: Restricts allowed values.

DEFAULT: Assigns a default value.

4. Indexes

Improve search performance by speeding up queries.

Example:

CREATE INDEX idx_student_name ON Student(Name);

Summary

Conceptual Schema: Defines the logical structure.

Physical Schema: Defines how data is stored.

External Schema: Defines user-specific views.

Tables, Keys, Constraints, and Indexes are essential components.

Final Thought

A well-designed database schema ensures efficient data storage, retrieval, and integrity, making it a
crucial aspect of database management.

You might also like