DBMS Notes Unit 1&2
DBMS Notes Unit 1&2
3. Banking
All thousands of transactions possible just because of DBMS that manages all the bank
transactions.
6. Military
One can easily search for all the information about anyone within seconds with the help of
DBMS.
7. Online Shopping
Purchase information, invoice bills, and payment, all of these are done with the help of DBMS.
9. Agriculture
DBMS can be used to maintain the record of crops, machinery, fertilizers, and livestock. One can
keep each record of everything used in agriculture using DBMS.
A Historical Perspective
Database Management Systems (DBMS) have been around for several decades, and their history
can be traced back to the early 1960s. In the early days, computer systems were designed to
manage data in a hierarchical or navigational manner, where data was stored in a tree-like
structure. This method of storing data was inefficient and difficult to use, as it required a lot of
manual effort to access and manage the data.
In the late 1960s, The first general-purpose DBMS, designed by Charles Bachman, was called
the Integrated Data Store (IDS) which was based on network data model for which he was
received the Turing Award (The most prestigious award which is equivalent to Nobel prize in
the field of Computer Science.).
In the late 1970s, Mr Edgar Codd proposed a new data representation framework called
the Relational Database Model. Mr Edgar Codd won the 1981 Turing Award for his seminal
work. This model was based on the concept of a table, with rows representing individual records
and columns representing individual fields within those records. The relational model allowed
for more efficient storage and retrieval of data and was easier to use than the hierarchical or
navigational models.
In the late 1980s IBM developed the Structured Query Language (SQL) for relational
databases, as a part of R project. This system was designed to manage large amounts of data and
was used primarily in corporate and government applications. SQL was adopted by the American
National Standards Institute (ANSI) and International Organization for Standardization (ISO).
In the 1980s, several new DBMS products were introduced, including Oracle, Sybase, and
Microsoft SQL Server. These systems were designed to be more user-friendly and to support
more advanced data modeling and query languages.
In the 1990s, object-oriented DBMS (OODBMS) emerged, which were designed to store and
manage complex data structures, such as multimedia and other types of non-traditional data.
These systems were initially popular in research and academic environments, but their adoption
was limited in the commercial sector.
In the 1991, Microsoft ships MS access, a personal DBMS and that displaces all other personal
DBMS products.
In the 1997, XML applied to database processing. Many vendors begin to integrate XML into
DBMS products.
In the 2000s, web-based applications and cloud computing became more popular, and DBMS
systems began to adapt to these new technologies. New DBMS systems were developed to
support distributed and web-based applications, including NoSQL databases such as MongoDB
and Cassandra.
Today, DBMS systems continue to evolve, with an emphasis on scalability, performance, and
support for cloud-based applications. Some of the most popular DBMS systems in use today
include Oracle, Microsoft SQL Server, MySQL, PostgreSQL, and MongoDB.
File Systems versus a DBMS
A file system is a technique of arranging the files in a storage devices like a hard disk, pen drive,
DVD, etc. It helps you to organizes the data and allows easy retrieval of files when they are
required. A file system enables you to handle the way of reading and writing data to the storage
medium. It is directly installed into the computer with the Operating systems such as Windows
and Linux.
What is DBMS?
Database Management System (DBMS) is a software for storing and retrieving user’s data while
considering appropriate security measures. It consists of a group of programs that manipulate the
database. The DBMS accepts the request for data from an application and instructs the DBMS
engine to provide the specific data. In large systems, a DBMS helps users and other third-party
software to store and retrieve data.
Each application has its data file so, the same data may have to be recorded and stored
many times.
Data dependence in the file processing system are data-dependent, but, the problem is
incompatible with file format.
Limited data sharing.
The problem with security.
Time-consuming.
It allows you to maintain the record of the big firm having a large number of items.
Required lots of labor work to do.
DataModel
A data model is a collection of high-level data description constructs that hide many low-level
storage details. A DBMS allows a user to define the data to be stored in terms of a data model.
The data models can be classified into different categories:
1. Hierarchical Model
2. Network Model
3. Entity-Relationship Model
4. Relational Model
5. Object-Based Data Model
6. Semi-structured Data model
1. Hierarchical Model
Hierarchical Model was the first DBMS model. This model organises the data in the hierarchical
tree structure.
The hierarchy starts from the root which has root data and then it expands in the form of a tree
adding child node to the parent node. This model easily represents some of the real-world
relationships like food recipes, sitemap of a website etc.
Depicts a set of one-to-many (1:M) relationships
2. Network Model
This model is an extension of the hierarchical model, the only difference is that a record can have
more than one parent. It replaces the hierarchical tree with a graph.
The network model was created to represent complex data relationships more effectively when
compared to hierarchical models, to improve database performance and standards.
Depicts both one-to-many (1:M) and many-to-many (M:N) relationships.
3. Entity-Relationship Model
An ER model is the logical representation of data as objects and relationships among them.
These objects are known as entities, and relationship is an association among these entities.
Entity-Relationship Model Components
1. Entities − It is a real-world thing which can be a person, place, or even a concept. For
Example: Department, Admin, Courses, Teachers, Students, Building, etc are some of the
entities of a School Management System.
2. Attributes − An entity which contains a real-world property called an attribute. For
Example: The entity employee has the property like employee id, salary, age, etc.
3. Relationship − Relationship tells how two attributes are related. For Example: Employee
works for a department.
An entity has a real-world property called attribute and these attributes are defined by a set of
values called domain.
The relational model uses a collection of tables to represent both data and the relationships.
Tables are also known as relations. Each table has multiple columns represent as attributes,
Attributes are the properties which define a relation. Each row of the table represents as Tuple,
Tuple is one piece of information.
Tables: relations are saved in the table format. A table has two properties rows and
columns
Attribute: columns represent as attributes
Tuple: A Row represent as Tuple
Relation Schema: A relation schema represents the name of the relation with its
attributes.
Degree: The total number of attributes which in the relation is called the degree of the
relation.
Cardinality: Total number of rows present in the Table.
Column: The column represents the set of values for a specific attribute.
Relation instance: The set of tuples of a relation at a particular instance of time is called
as relation instance.
Relational model requires powerful hardware and large data storage devices.
May lead to slower processing time.
Poorly designed systems lead to poor implementation of database systems.
The complex real world problems are represented as objects with different attributes. In Object
Oriented Data Model, data and their relationships are contained in a single structure which is
referred as object. All objects have multiple relationships between them. Basically, it is
combination of Object Oriented programming and Relational Database Model.
Reduced Maintenance
Real-World Modeling
Improved Reliability and Flexibility
High Code Reusability
The semi-structured data model permits the specification of data where individual data items of
same type may have different sets of attributes. The Extensible Markup Language (XML) is
widely used to represent semistructured data model.
Example” We take two tables emp At a moment, what is the value of the database
table and dept [Link] schema is called [Link] t=8 A.M
Name 1 A 5000 d1
Salary 2 B 2000 d2
Dept 3
Dept_id C
dname 3000
This corresponds to the variable The value of the variable in a program at a point in
declaration of a programming time corresponds to an instance of the database
Database Schema Database Instance
language. schema.
Data Independence
1. External views
2. External API or programs
Any change made will be absorbed by the mapping between external and conceptual levels.
1. Query Processor :
It interprets the requests (queries) received from end user via an application program
into instructions. It also executes the user request which is received from the DML
compiler.
DML Compiler –
It processes the DML statements into low level instruction (machine language), so that
they can be executed.
DDL Interpreter –
It processes the DDL statements into a set of table containing meta data (data about
data).
Query Optimizer –
It executes the instruction generated by DML Compiler.
2. Storage Manager :
Storage Manager is a program that provides an interface between the data stored in the
database and the queries received. It is also known as Database Control System. It
maintains the consistency and integrity of the database by applying the constraints and
executes the DCL statements. It is responsible for updating, storing, deleting, and
retrieving data in the database.
It contains the following components –
Authorization Manager –
It ensures role-based access control, i.e,. checks whether the particular person is
privileged to perform the requested operation or not.
Integrity Manager –
It checks the integrity constraints when the database is modified.
Transaction Manager –
It controls concurrent access by performing the operations in a scheduled way that it
receives the transaction. Thus, it ensures that the database remains in the consistent
state before and after the execution of a transaction.
File Manager –
It manages the file space and the data structure used to represent information in the
database.
Buffer Manager –
It is responsible for cache memory and the transfer of data between the secondary
storage and main memory.
3. Disk Storage :
It contains the following components –
Data Files –
It stores the data.
Data Dictionary –
It contains the information about the structure of any database object. It is the
repository of information that governs the metadata.
Indices –
It provides faster retrieval of data item.
Introduction to Database Design:
Database Design
Database design is the organization of data according to a database model. Properly designed
databases are easy to maintain, improves data consistency.
The database design process can be divided into six steps. The ER model(Entity Relationship
model) is most relevant to the first three steps.
1. Requirement analysis
2. Conceptual database design
3. Logical database design
4. Schema refinement
5. Physical database design
6. Application and security design
1. Requirement analysis
It is necessary to understand what data need to be stored in the database, what
applications must be built, what are all those operations that are frequently used by the
system.
The requirement analysis is an informal process and it requires proper communication
with user groups.
There are several methods for organizing and presenting information gathered in this
step. Some automated tools can also be used for this purpose.
2. Conceptual database design
The information gathered, is used to develop a high-level description of the data to be
stored in the database
This is a steps in which E-R Model i.e. Entity Relationship model is built.
The goal of this design is to create a simple description of data that matches with the
requirements of users.
3. Logical database design
This is a step in which ER model in converted to relational database schema, sometimes
called as the logical schema in the relational data model.
4. Schema refinement
In this step, relational database schema is analyzed to identify the potential problems
and to refine it.
The schema refinement can be done with the help of normalizing and restructuring the
relations.
5. Physical database design
The design of database is refined further.
This step may simply involve building indexes on tables and clustering tables, redesign
of parts of the database schema obtained from the earlier design steps.
6. Application and security design
Using design methodologies like UML(Unified Modeling Language) try to address the
complete software design of the database can be accomplished.
The role of each entity in every process must be reflected in the application task.
For each role, there must be the provision for accessing and prohibiting some part of
database.
Thus some access rules must be enforced on the application(which is accessing the
database) to protect the security features.
ER Diagrams
Introduction of ER Model
The Entity Relational Model is a model for identifying entities to be represented in the database
and representation of how those entities are related. The ER data model specifies enterprise
schema that represents the overall logical structure of a database graphically.
The Entity Relationship Diagram explains the relationship among the entities present in the
database. ER models are used to model real-world objects like a person, a car, or a company and
the relation between these real-world objects. In short, the ER Diagram is the structural format of
the database.
ER diagrams are used to represent the E-R model in a database, which makes them easy to
convert into relations (tables).
ER diagrams provide the purpose of real-world modeling of objects which makes them
intently useful.
ER diagrams require no technical knowledge and no hardware support.
These diagrams are very easy to understand and easy to create even for a naive user.
It gives a standard solution for visualizing the data logically.
ER Model is used to model the logical view of the system from a data perspective which consists
of these symbols:
Rectangles: Rectangles represent Entities in the ER Model.
Ellipses: Ellipses represent Attributes in the ER Model.
Diamond: Diamonds represent Relationships among Entities.
Lines: Lines represent attributes to entities and entity sets with other relationship types.
Double Ellipse: Double Ellipses represent Multi-Valued Attributes.
Double Rectangle: Double Rectangle represents a Weak Entity.
Entities
An entity is a “thing” or “object” in the real world. An entity contains attributes, which
describe that entity. So anything about which we store information is called an entity. Entities
are recorded in the database and must be distinguishable, i.e., easily recognized from the
group.
For example: A student, An employee, or bank a/c, etc. all are entities.
Kinds of Entity:
1. Tangible Entity:
It is an entity in DBMS, which is a physical object that we can touch or see. In simple words, an
entity that has a physical existence in the real world is called a tangible entity.
For example, in a database, a table represents a tangible entity because it contains a physical
object that we can see and touch in the real world. It includes colleges, bank lockers, mobiles,
cars, watches, pens, paintings, etc.
2. Intangible Entity:
It is an entity in DBMS, which is a non-physical object that we cannot see or touch. In simple
words, an entity that does not have any physical existence in the real world is known as an
intangible entity.
For example, a bank account logically exists, but we cannot see or touch it.
Entity Sets
An entity set is a collection of similar types of entities that share the same attributes.
A strong entity set is an entity set that contains sufficient attributes to uniquely identify
all its entities.
In other words, a primary key exists for a strong entity set.
Primary key of a strong entity set is represented by underlining it.
Symbols Used-
In this ER diagram,
Two strong entity sets “Student” and “Course” are related to each other.
Student ID and Student name are the attributes of entity set “Student”.
Student ID is the primary key using which any student can be identified uniquely.
Course ID and Course name are the attributes of entity set “Course”.
Course ID is the primary key using which any course can be identified uniquely.
Double line between Student and relationship set signifies total participation.
It suggests that each student must be enrolled in at least one course.
Single line between Course and relationship set signifies partial participation.
It suggests that there might exist some courses for which no enrollments are made.
A weak entity set is an entity set that does not contain sufficient attributes to uniquely
identify its entities.
In other words, a primary key does not exist for a weak entity set.
However, it contains a partial key called as a discriminator.
Discriminator can identify a group of entities from the entity set.
Discriminator is represented by underlining with a dashed line.
NOTE-
The combination of discriminator and primary key of the strong entity set makes it
possible to uniquely identify all entities of the weak entity set.
Thus, this combination serves as a primary key for the weak entity set.
Clearly, this primary key is not formed by the weak entity set completely.
Symbols Used-
Example-
In this ER diagram,
One strong entity set “Building” and one weak entity set “Apartment” are related to
each other.
Strong entity set “Building” has building number as its primary key.
Door number is the discriminator of the weak entity set “Apartment”.
This is because door number alone can not identify an apartment uniquely as there may
be several other buildings having the same door number.
Double line between Apartment and relationship set signifies total participation.
It suggests that each apartment must be present in at least one building.
Single line between Building and relationship set signifies partial participation.
It suggests that there might exist some buildings which has no apartment.
Note:
Weak entity always has total participation but Strong entity may not have total
participation.
Attributes
Types of Attributes-
1. Simple attributes
2. Composite attributes
3. Single valued attributes
4. Multi valued attributes
5. Derived attributes
6. Key attributes
1. Simple Attributes-
Simple attributes are those attributes which can not be divided further.
2. Composite Attributes-
Composite attributes are those attributes which are composed of many other simple attributes.
Single valued attributes are those attributes which can take only one value for a given entity from
an entity set.
Multi valued attributes are those attributes which can take more than one value for a given entity
from an entity set.
5. Derived Attributes-
Derived attributes are those attributes which can be derived from other attribute(s).
6. Key Attributes-
Key attributes are those attributes which can identify an entity uniquely in an entity set.
Relationships
A relationship is used to describe the relation between entities. Diamond or rhombus is used to
represent the relationship.
Relationship Sets
Relationship Set-
Example-
The number of entity sets that participate in a relationship set is termed as the degree of that
relationship set. Thus,
On the basis of degree of a relationship set, a relationship set can be classified into the following
types-
Unary relationship set is a relationship set where only one entity set participates in a relationship
set.
Example-
One person is married to only one person
2. Binary Relationship Set-
Binary relationship set is a relationship set where two entity sets participate in a relationship set.
Example-
Student is enrolled in a Course
Ternary relationship set is a relationship set where three entity sets participate in a relationship
set.
Example-
N-ary relationship set is a relationship set where ‘n’ entity sets participate in a relationship set.
Cardinality:
The number of times an entity of an entity set participates in a relationship set is known
as cardinality. Cardinality can be of different types:
1. One to One
2. One to Many
3. Many to One
4. Many to Many
When more than one instances of an entity is associated with more than one
instances of another entity then it is called many to many relationship. For
example, a can be assigned to many projects and a project
can be assigned to many students.
As the complexity of data increased, it became more and more difficult to use the traditional ER
Model for database modelling. Hence some Additional Features were made to the existing ER
Model to make it able to handle the complex applications better.
Hence, Three new concepts were added to the existing ER Model, they were:
Generalization
Specialization
Aggregration
Some entities have relationships that form hierarchies. For instance, Employee can be an hourly
employee or contracted employee.
In this relationship hierarchies, some entities can act as superclass and some other entities can act
as subclass.
Superclass: An entity type that represents a general concept at a high level, is called superclass.
Subclass: An entity type that represents a specific concept at lower levels, is called subclass.
The subclass is said to inherit from superclass. When a subclass inherits from one or more
superclasses, it inherits all their attributes. In addition to the inherited attributes, a subclass can
also define its own specific attributes.
The symbol used for specialization/ Generalization is
Generalization
Generalization is the process of extracting common properties from a set of entities and create a
generalized entity from it. It is a bottom-up approach in which two or more entities can be
generalized to a higher level entity if they have some attributes in common.
In generalization, a number of entities are brought together into one generalized entity based on
their similar characteristics. For example, pigeon, house sparrow, crow and dove can all be
generalized as Birds.
STUDENT and FACULTY can be generalized to a higher level entity called PERSON as shown
in Figure 1. In this case, common attributes like P_NAME, P_ADD become part of higher entity
(PERSON) and specialized attributes like S_FEE become part of specialized entity (STUDENT).
Specialization
In aggregation, the relation between two entities is treated as a single entity. In aggregation,
relationship with its corresponding entities is aggregated into a higher level entity.
For example: Center entity offers the Course entity act as a single entity in the relationship
which is in a relationship with another entity visitor. In the real world, if a visitor visits a
coaching center then he will never enquiry about the Course only or just about the Center instead
he will ask the enquiry about both.
Conceptual Design With the ER Model
Requirements gathering − The first step in conceptual database design is to gather the
business requirements from the stakeholders. This involves identifying the data elements,
relationships, and constraints that are essential to the organization's business
requirements.
Entity-relationship modeling − The second step in conceptual database design is to
create an entity-relationship (ER) model, which represents the entities, attributes, and
relationships between the entities. The ER model is a graphical representation of the data
elements and their relationships.
Normalization − The third step in conceptual database design is to normalize the ER
model, which ensures that the data is organized efficiently and reduces data redundancy
Review and feedback − The fourth step in conceptual database design is to review the
ER model with the stakeholders and incorporate their feedback into the design.
Design choices:
Need for further refining the schema: Relational schema obtained from ER diagram is a good
first step. But ER design subjective & can’t express certain constraints; so this relational schema
may need refinement.
Entity vs. Attribute
Works_In2 does not allow an employee to work in a department for two or more periods.
Similar to the problem of wanting to record several addresses for an employee: we want to
record several values of the descriptive attributes for each instance of this relationship.
First ER diagram OK if a manager gets a separate discretionary budget for each dept.
What if a manager gets a discretionary budget that covers all managed depts?
Redundancy of dbudget, which is stored for each dept managed by the manager.
Tables: relations are saved in the table format. A table has two properties rows and
columns
Attribute: columns represent as attributes
Tuple: A Row represent as Tuple
Relation Schema: A relation schema represents the name of the relation with its
attributes.
Degree: The total number of attributes which in the relation is called the degree of the
relation.
Cardinality: Total number of rows present in the Table.
Column: The column represents the set of values for a specific attribute.
Relation instance: The set of tuples of a relation at a particular instance of time is
called as relation instance.
Relational model requires powerful hardware and large data storage devices.
May lead to slower processing time.
Poorly designed systems lead to poor implementation of database systems.
Domain Constraint
Entity Integer Constraint
Referential Integrity Constraint
Key Constraints
Domain Constraint
A domain constraint is a restriction on the values that can be stored in a column.
Strings, character, time, integer, currency, date etc. Are examples of the data type of
domain constraints.
example, if you have a column for "age" domain integrity constraints in DBMS would
ensure that only integer values can be entered into that column. This ensures that only
valid data is entered into the database.
Key Constraints
A key constraint is a rule that defines how data in a column(s) can be stored in a table.
A key is composed of one or more columns whose values uniquely identify each row in
the table. There are several different types of key constraints in DBMS, each with its
own specific purpose.
1. Unique Key
A unique key refers to a column or a set of columns that identify every record uniquely
in a table. All the values in this key would have to be unique. values of a unique key
won’t allow duplicate values and it is only capable of having one null value.
Syntax in Mysql
Syntax in Mysql
2. Primary Key
The primary key refers to a column of a table that helps us identify all the records
uniquely present in that table. Any table can consist of only a single primary key
constraint. values of a primary key won’t allow null value or a duplicate values.
Syntax in Mysql
3. Foreign Key
We use a foreign key to establish relationships between two available tables. The
foreign key would require every value present in a column/set of columns to match the
referential table’s primary key. A foreign key helps us to maintain data as well as
referential integrity.
Syntax in Mysql
4. Composite Key
The composite key refers to a set of multiple attributes that help us uniquely identify
every tuple present in a table. The attributes present in a set may not be unique
whenever we consider them separately. Thus, when we take them all together, it will
ensure total uniqueness.
Syntax in Mysql
5. Super Key
A super key refers to the set of all those keys that help us uniquely identify all the rows
present in a table. It means that all of these columns present in a table that can identify
the columns of that table uniquely act as the super keys.
6. Candidate Key
The candidate keys refer to those attributes that identify rows uniquely in a table. In a
table, we select the primary key from a candidate key. Thus, a candidate key has similar
properties as that of the primary keys that we have explained above. In a table, there
can be multiple candidate keys.
7. Alternate Key
As we have stated above, any table can consist of multiple choices for the primary key.
But, it can only choose one. Thus, all those keys that did not become a primary key are
known as alternate keys.
CHECK Constraint
The CHECK constraint is used to limit the value range that can be placed in a column. If
you define a CHECK constraint on a column it will allow only certain values for this
column. If you define a CHECK constraint on a table it can limit the values in certain
columns based on values in other columns in the row.
Syntax in Mysql
Example:
DEFAULT Constraint
The DEFAULT constraint is used to set a default value for a column. The default value
will be added to all new records, if no other value is specified.
The DEFAULT constraint can also be used to insert system date, by using functions like
GETDATE().
Syntax in Mysql
Example:
Integrity Constraints are specified when a relation is created and enforced when a
relation is modified. The impact of domain, PRIMARY KEY, and UNIQUE constraints is
straightforward: If an insert, delete, or update command causes a violation, it is rejected.
Every potential Integrity violation is generally checked at the end of each SQL statement
execution, although it can be deferred until the end of the transaction executing the
statement.
On the other hand, insertions of Students tuples do not violate referential integrity, and
deletions of Students tuples could cause violations.
SQL provides several alternative ways to handle foreign key violations. We must
consider three basic questions:
1. What should we do if an Enrolled row is inserted, with a student_id column
value that does not appear in any row of the Students table?
In this case, the INSERT command is simply rejected.
☑ Disallow the deletion of the Students row if an Enrolled row refers to it.
Syntax in Mysql
CREATE TABLE table_name (
column1 datatype,
column2 datatype,
column3 datatype,
....
FOREIGN KEY (column) REFERENCES table_name1(column) ON DELETE NO
ACTION
);
☑ Set the studid column to the sid of some (existing) 'default' student, for every
Enrolled row that refers to the deleted Students row.
Syntax in Mysql
CREATE TABLE table_name (
column1 datatype,
column2 datatype,
column3 datatype,
....
FOREIGN KEY (column) REFERENCES table_name1(column) ON DELETE SET
DEFAULT
);
If you want to select all the fields available in the table, use the following syntax:
Syntax in Mysql
The symbol ´*´ means that we retain all fields of selected tuples in the result.
We can retrieve rows corresponding to students who are younger than 18 withthe
following SQL query:
Example:
In addition to selecting a subset of tuples, a query can extract a subset of the fields of
each selected tuple. we can compute the student_id and First_name of students who
are younger than 18 with the following query:
Example:
SQL Aliases
Aliases are the temporary names given to tables or columns. An alias is created with
the AS keyword.
Alias Column Syntax in Mysql
SELECT column_name(s)
FROM table_name AS alias_name;
Example:
Example:
Views in DBMS
A view is a table whose rows are not explicitly stored, a view is a virtual table based on
the result-set of an SQL statement. A view can contain all rows of a table or select rows
from a table. A view can be created from one or many tables which depends on the
written SQL query to create a view.
A view is generated to show the information that the end-user requests the data
according to specified needs rather than complete information of the table.
Using Views, we can join multiple tables into a single virtual table.
Views hide data complexity.
In the database, views take less space than tables for storing data because the
database contains only the view definition.
Views indicate the subset of that data, which is contained in the tables of the database.
Creating Views
Database views are created using the CREATE VIEW statement. Views can be created
from a single table, multiple tables or another view.
To create a view, a user must have the appropriate system privilege according to the
specific implementation.
Syntax in Mysql
Example:
Updating a View
A view can be updated with the CREATE OR REPLACE VIEW statement.
Syntax in Mysql
The following SQL adds the "Mobile" column to the "Students_CSE" view:
Example:
Example:
Example:
Querying a View
We can query the view as follows
Syntax in Mysql
Example:
Dropping a View
In order to delete a view in a database, we can use the DROP VIEW statement.
Syntax in Mysql
Example: