Database Management System or DBMS CS619 Viva Notes
Database Management System or DBMS CS619 Viva Notes
Final Project
CS619 VIVA
Preparation
Notes
We will Also
Have a Project Discussion,
if needed then?
Contact with me.
0300-8959571
Mahar Waqas PHP Developer 0300-8959571
Users
A typical DBMS has users with different rights and
permissions who use it for different purposes. Some users
retrieve data and some back it up. The users of a DBMS can be
broadly categorized as follows −
Mahar Waqas PHP Developer 0300-8959571
• End Users − End users are those who actually reap the
benefits of having a DBMS. End users can range from
simple viewers who pay attention to the logs or market
rates to sophisticated users such as business analysts.
Mahar Waqas PHP Developer 0300-8959571
Keys
Super Key
Super key is a set of one or more than one keys that can be used
to identify a record uniquely in a table. Example: Primary
key, Unique key, Alternate key are subset of Super Keys.
Candidate Key
Primary Key
Alternate key
Composite/Compound Key
Unique Key
Foreign Key
SQL Overview
SQL Commands:
The standard SQL commands to interact with relational
databases are CREATE, SELECT, INSERT, UPDATE,
DELETE and
Mahar Waqas PHP Developer 0300-8959571
Command Description
CREATE
Creates new databases, tables and views from RDBMS.
For example −
For example−
For example−
DELETE
DROP
TRUNCATE
It Removes all rows from a table, but the table structures and
its columns, constraints, indexes remains.
• SELECT/FROM/WHERE
• INSERT INTO/VALUES
• UPDATE/SET/WHERE
• DELETE FROM/WHERE
These basic constructs allow database programmers and users
to enter data and information into the database and retrieve
efficiently using a number of filter options.
SELECT/FROM/WHERE
• SELECT − This is one of the fundamental query command of
SQL. It is similar to the projection operation of relational
Mahar Waqas PHP Developer 0300-8959571
For example −
Select author_name
From book_author
Where age > 50;
This command will yield the names of authors from the
relation book_authorwhose age is greater than 50.
INSERT INTO/VALUES
This command is used for inserting values into the rows of a
table (relation).
Syntax−
INSERT INTO table (column1 [, column2, column3 ... ]) VALUES
(value1 [, value2, value3 ... ])
Or
Syntax −
DELETE FROM
tutorialspoints WHERE Author="unknown";
Mahar Waqas PHP Developer 0300-8959571
CRUD Operations
C stand for
create R stand
for read
U stand for update
D stand for delete
Normalization
If a database design is not perfect, it may contain anomalies,
which are like a bad dream for any database administrator.
Managing a database with anomalies is next to impossible.
Anomalies
Update Anomalies
Delete Anomalies
Insert Anomalies
Mahar Waqas PHP Developer 0300-8959571
Insert Anomalies
An Insert Anomaly occurs when certain attributes cannot be
inserted into the database without the presence of other
attributes.
For example this is the converse of delete anomaly - we can't
add a new course unless we have at least one student enrolled
on the course.
Delete Anomalies
Update Anomalies
Data Integrity
Domain constraints
Entity integrity
Column constraints
User-defined integrity constraints
Referential integrity
The data analysis stage will identify the requirements of these.
Domain Constraints
Column Constraints
During the data analysis phase, business rules will identify any
column constraints. For example, a salary cannot be negative; an
employee number must be in the range 1000 - 2000, etc.
UserDefined Integrity Constraints
Notation
R1 θ R2
R1 and R2 are relations having attributes (A1, A2, .., An) and
(B1,
B2,.. ,Bn) such that the attributes don’t have anything in
common, that is R1 ∩ R2 = Φ.
Equijoin
When Theta join uses only equality comparison operator, it is
said to be equijoin. The above example corresponds to equijoin.
Natural Join ( )
Natural join does not use any comparison operator. It does not
concatenate the way a Cartesian product does. We can perform
a
Natural Join only if there is at least one common attribute that
exists between two relations. In addition, the attributes must
have the same name and domain.
Theta Join, Equijoin, and Natural Join are called inner joins.
An inner join includes only those tuples with matching
attributes and
the rest are discarded in the resulting relation. Therefore, we
need to use outer joins to include all the tuples from the
participating relations in the resulting relation. There are three
kinds of outer joins − left outer join, right outer join, and full
outer join.
Indexing
Mahar Waqas PHP Developer 0300-8959571