0% found this document useful (0 votes)
70 views

Database Schema Instances

The document discusses database schemas, which define the logical structure of a database. There are three types of database schemas: physical schemas specify how data is physically stored; logical schemas define logical constraints and relationships between tables; view schemas describe how end users interact with the database. The schema represents the organization of data and relationships but does not contain the data itself. It provides a structured format for storing and retrieving data from the database.

Uploaded by

Saad
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
70 views

Database Schema Instances

The document discusses database schemas, which define the logical structure of a database. There are three types of database schemas: physical schemas specify how data is physically stored; logical schemas define logical constraints and relationships between tables; view schemas describe how end users interact with the database. The schema represents the organization of data and relationships but does not contain the data itself. It provides a structured format for storing and retrieving data from the database.

Uploaded by

Saad
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Database Environment

Database Schema
A database schema is a structure that represents the logical storage of the data in
a database. It represents the organization of data and provides information about the
relationships between the tables in a given database. In this topic, we will understand
more about database schema and its types. Before understanding database schema, lets
first understand what a Database is.

What is Database?
A database

is a place to store information. It can store the simplest data, such as a list of people as well as
the most complex data. The database stores the information in a well-structured format.

What is Database Schema?


o A database schema is the logical representation of a database, which shows how
the data is stored logically in the entire database. It contains list of attributes and
instruction that informs the database engine that how the data is organized and
how the elements are related to each other.
o A database schema contains schema objects that may include tables, fields,
packages, views, relationships, primary key, foreign key,
o In actual, the data is physically stored in files that may be in unstructured form,
but to retrieve it and use it, we need to put it in a structured form. To do this, a
database schema is used. It provides knowledge about how the data is organized
in a database and how it is associated with other data.
o The schema does not physically contain the data itself; instead, it gives
information about the shape of data and how it can be related to other
tables or models.
o A database schema object includes the following:
o Consistent formatting for all data entries.
o Database objects and unique keys for all data entries.
o Tables with multiple columns, and each column contains its name and
datatype.
o The complexity & the size of the schema vary as per the size of the project. It
helps developers to easily manage and structure the database before coding it.
o The given diagram is an example of a database schema. It contains three tables,
their data types. This also represents the relationships between the tables and
primary keys as well as foreign keys.
Types of Database Schema
The database schema is divided into three types, which are:

1. Logical Schema
2. Physical Schema
3. View Schema

1. Physical Database Schema


A physical database schema specifies how the data is stored physically on a storage
system or disk storage in the form of Files and Indices. Designing a database at the
physical level is called a physical schema.

2. Logical Database Schema


The Logical database schema specifies all the logical constraints that need to be applied
to the stored data. It defines the views, integrity constraints, and table. Here the
term integrity constraints define the set of rules that are used by DBMS (Database
Management System)

to maintain the quality for insertion & update the data. The logical schema represents how the
data is stored in the form of tables and how the attributes of a table are linked together.
At this level, programmers and administrators work, and the implementation of the data
structure is hidden at this level.

Various tools are used to create a logical database schema, and these tools demonstrate
the relationships between the component of your data; this process is called ER
modelling.

The ER modelling stands for entity-relationship modelling, which specifies the


relationships between different entities.

We can understand it with an example of a basic commerce application. Below is the


schema diagram, the simple ER model representing the logical flow of transaction in a
commerce application.

In the given example, the Ids are given in each circle, and these Ids are primary key &
foreign keys.

The primary key is used to uniquely identify the entry in a document or record. The Ids
of the upper three circles are the primary keys.

The Foreign key is used as the primary key for other tables. The FK represent the
foreign key in the diagram. It relates one table to another table.
3. View Schema
The view level design of a database is known as view schema. This schema generally
describes the end-user interaction with the database systems.

Difference between the Physical and Logical Database Schema

Physical database schema Logical Database schema

It does not include the attributes. It includes the attributes.

It contains both primary & secondary Keys. It also contains both primary & secondary keys.

It contains the table name. It contains the names of the tables.

It contains the column names and their data It does not contain any column name o
types. datatype.

Database Instance or Database Schema is the same?


The terms database schema and database instances are related to each other &
sometimes confusing to be used as the same thing. But both are different from each
other.

1. Instances: 
Instances are the collection of information stored at a particular moment. The
instances can be changed by certain CRUD operations as like addition, deletion
of data. It may be noted that any search query will not make any kind of
changes in the instances. 
Example – 
Let’s say a table teacher in our database whose name is School, suppose the
table has 50 records so the instance of the database has 50 records for now
and tomorrow we are going to add another fifty records so tomorrow the
instance have total 100 records. This is called an instance. 

2. Schema: 
Schema is the overall description of the database. The basic structure of how
the data will be stored in the database is called schema. 
 
Above given is the schema of the table teacher. 
Difference between Schema and Instance: 
Schema Instance

It is the collection of information stored in


It is the overall description of the database. a database at a particular moment.

Data in instances can be changed using


Schema is same for whole database. addition, deletion, updation.

Does not change Frequently. Changes Frequently.

Defines the basic structure of the database i.e It is the set of Information stored at a
how the data will be stored in the database. particular time.

You might also like