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

Dbms Final

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

Dbms Final

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

1)What is Database?

A)An organized, consistent, and logical collection of data that can easily be
updated, accessed, and managed. Database mostly
contains sets of tables or objects which consist of records and fields.

Database Object-->Anything created using command is a database object.


-----------------------------------------------------------------------------------
---------------------------------------------
2)What is DBMS?
A)A set of Applications or programms that enable user to create and maintain a
database.DBMS provides an interface for performing
various operations such as inserting, deleting, updating, etc. into a database.

DBMS helps a user to overcome problems like data inconsistency, data redundancy.
-----------------------------------------------------------------------------------
---------------------------------------------
3)Advantages of DBMS?
A)1)Data Sharing-->Data which is stored in database can be shared by multiple
users.
2)Integrity Constraints-->It allows storing of data in an organized and refined
manner.
3)Controlling redundancy in tables-->The same piece of data dosent exists in
multiple places.
4)Data Independence-->Allow changing the data structure without altering the
composition of any of the other running programs.
5)Provides backup and recovery facility-->automatically create the backup of the
data and restore the data in the database.
6)Data Security--->Authentication,Encryption are the tools used

-----------------------------------------------------------------------------------
----------------------------------------------
4)Explain different languages present in DBMS?
A)
1)DDL(Data Definition Language):Commands which are required to define the database.
Ex:craete--->create table.
drop--->including data and table will delete.
alter-->modify the table by adding attributes.
truncate--->only data/tuples will be deleted in table.

2)DML(Data Manipulation Language):Commands which are required to manipulate the


data present in the database.
Ex:INSERT-->NEW ROW TO TABLE
UPDATE--->UPDATE DATA
Delete--->delete particular row in table
commit--->save the operations untill done.
3)DCL(Data Control Language):Commands which are required to deal with the user
permissions and controls of the database system.
Ex:grant--->giving rights to access data dfrom database by databae administartor
revoke-->granted permisions removed form user by DBA when the user doesnt want that
permisiions.
4)TCL(Transaction Control Language):Commands which are required to deal with the
transaction of the database.
Ex:COMMIT, ROLLBACK, and SAVEPOINT.
-----------------------------------------------------------------------------------
----------------------------------------------
5)Mention the issues with traditional file-based systems that make DBMS a better
choice?
A)1)No indexing in Traditionla file based system,it makes the user to move entire
page to get te required data.
2)Redundancy(Duplicates) and Inconsistency.(Changing one of them lead to change the
entire file.)
3)Accesing is hard,because it is in unorganised way.
4)Integrity check, data isolation, atomicity, security etc.
-----------------------------------------------------------------------------------
----------------------------------------------
6)What is meant by ACID properties in DBMS?
A)
A-->Atomic(All Changes to the data must be perfromed successfully or not.)
C-->Consistency(Data must be consistent state before and after the transaction)
I-->Isolated(No other process can chnage the data while the transaction is
running)
D-->Durable()

Atomicity:The concept of either executing the whole query or executing nothing at


all.
Consistency:Data remains safe before and after the transaction.
Isolated:Every Transaction is occuring independently on others.
Durable:Data is not lost in case of system failure or restart.

-----------------------------------------------------------------------------------
----------------------------------------------
7)Are NULL values in a database the same as that of blank space or zero?
A)No, a NULL value is very different from that of zero and blank space.NULL Value
represents a value that is assigned, unknown,
unavailable, or not applicable and blank space which represents a character and
zero represents a number.
-----------------------------------------------------------------------------------
----------------------------------------------
8)What is meant by Data Warehousing?
A)The process of collecting, extracting, transforming, and loading data from
multiple sources and storing them into one database.
It is a central repository where data flows from transactional systems and other
relational databases and is used for data
analytics.
-----------------------------------------------------------------------------------
----------------------------------------------
9)Explain different levels of data abstraction in a DBMS.
A)Data Abstraction-->Process of hiding irrelevant Data.It has 3
levels(Physical,Conceptual,External)
Physical-->This level consists of data storage descriptions and the details of this
level are hidden from system admins, developers, and users.

Conceptual-->developers and admins work and it determines what data is stored in


the database and what is the relationship
between the data points.

External--->only part of the database hides the details of the table schema and its
physical storage from the users.
A view is a virtual table created by selecting fields from one or more tables
present in the database.
-----------------------------------------------------------------------------------
----------------------------------------------
10)What is meant by an entity-relationship (E-R) model?
A)ER Model is a diagrammatic approach to a database design where real-world objects
are represented as entities and relationships between them.

Entity->A real-world object having attributes(Characteristics of the object).


Entity Set-->A set of all the entities present in a specific entity type in a
database.
-----------------------------------------------------------------------------------
----------------------------------------------
11)Explain different types of relationships amongst tables in a DBMS.
A)
1)One to One Relationship:A relationship is applied when a particular row in table
X is linked to a singular row in table Y.
Ex:One person as one passport.

2)One to Many Relationship:A relationship is applied when a single row in table X


is related to many rows in table Y.
Ex:One customer has many accounts.

3)Many to Many Relationship:A relationship is applied when multiple rows in table X


can be linked to multiple rows in table Y.
Ex:Many customers buy many products.

4)Many to one:A relationship is applied when many rows in table X is related to one
rows in table Y.
Ex:Many students in one college.
-----------------------------------------------------------------------------------
----------------------------------------------
12)Explain the difference between intension and extension in a database.
A)
1)Intension: It is a database schema is used to define the database and is
specified during the design of the database and remains same.

2)Extension:The measure of the number of tuples present in the database at any


given point in time.
It is also the snapshot of the database and its value keeps changing as and when
the tuples are created, updated, or destroyed
in a database.
-----------------------------------------------------------------------------------
----------------------------------------------
13) Explain the difference between the DELETE and TRUNCATE command in a DBMS.
A)DELETE:It is used to delete rows from a table based on the condition provided by
the WHERE clause.
it only remove the particular column and chnace to rollback,becuase the log are
recorded.

Truncate:It is used to remove complete data from a table in a database.It removes


complete data and rollback is possible.
-----------------------------------------------------------------------------------
----------------------------------------------
14)What is a lock. Explain the major difference between a shared lock and an
exclusive lock during a transaction in a database.
A)A lock is used to protect a shared piece of data from getting updated by two or
more database users at the same time.
When a single user or session has acquired a lock then no other user or session can
modify that data until the lock is released.

Shared Lock:It is required for reading a data item and many transactions may hold a
lock on the same data item in a shared lock.
Multiple transactions are allowed to read the data items in a shared lock.

Exclusive lock: A lock on any transaction that is about to perform a write


operation. This type of lock doesn’t allow more than
one transaction and hence prevents any inconsistency in the database.
-----------------------------------------------------------------------------------
----------------------------------------------
15)What is meant by normalization and denormalization?
A)
Normalization:It is a process of reducing redundancy by organizing the data into
multiple tables.It leads to better usage of
disk spaces and makes it easier to maintain the integrity of the database.

Denormalization: It is the reverse process of normalization as it combines


normalized tables into a single table so that data
retrieval becomes faster. JOIN operation allows us to create a denormalized form of
the data.
-----------------------------------------------------------------------------------
----------------------------------------------
16)Normalization
A)
Conceptual Design--->entities and relationships(ER diagram)
Logical Design--->validate model using normalization
Physical Design--->Implement on DBMS.

Logical Design
Split Data into multiple table--->no data is lost,Useful info can be easily
reconstitued

Mofification anomolies:
Update--->redudancy(repition of data)
deletion----->if we dlt last element the entire data is deleted.
Insertion--->violates entitiy integrity(primary key--->it dosent null)

Problems without normalization


-------------------------------
Redudancy-->repitition of data

Ex:Student table lo hod,branch and ph number of college andatiki same appudu


redudacy antaru
Issues:
Increase size of database
Insertion Anomoly--->inserting redudnt data for new row is called insertion
anomoly.
Ex:Insering new student to student table having same branch,hod,and ph nuber of
college
Deletion Anomoly--->When the last student info is deleted in the row the branch
info is deleted(no other place can have the info of branch).
Updation Anamoly---->when new hod is joined we need to update the every row in the
table

Noramlaization
----------------------------
Divide and Rule
Divide the data into separate table/Independent entiites and relate them using the
comon Attribute(Branch)

Ex:Main table--->Student(name,branch,hod,phnumber)
Studet table divided into 2 tables

table 1---->name,branch
table 2----->branch,hod,phnumber.

Def:A Process of organizing the data in table to avoid data


redudancy,insertion,deletion and updation anomoly.

There are 1 to 5 normal forms&&Boyce-Codd Normal Form(BCNF)

First Normal Form


---------------------------
1)Eliminating repeting groups in single table
2)Create separte tables
3)Identify each set of related data with a primary key.

4 rules:
1)Attribute/column can have only single value.
2)Value in column should be the same domain
3)All the column names are unique
4)Order is not mattered.

Second Normal Form


----------------------------------
For a table to be in second normal form it should be in the first normal form.
It should not have Partial Dependency.

Functinal Dependecy:If the info is sotred in the table can uniquely determine
another info in the same table
By using functinal dependency we can obtain the value of another attribute from
given attribute.

Partial dependency:When a composite attribute is functionally dependent on part of


a candidate key.

It exists only when for a composite primary key any attribute in the table depends
on
part of primary key but not the complete primary key.

Third Normal Form


-------------------------------
Transitive dependency--->An Indirect RelationShip between values in te same table
that causes a functinal dependency(retrieve the vlaues of partiular attribute using
the given attribute)

For a table to be in Third normal form it should be in the Second normal form.
It should not have Transitive Dependency.(A-->B--->C)

To remove the transitive dependecy take out the columsn which causes
transitive dependecy and make it a separate table.

Candidate Key--->set of attributes helps us to identify a touple.(no redudancy)

Ex:Course Table--->{so,courseno,coursename}

Super key--->set of attributes helps us to identify a touple.

Ex:Student Table--->{Sno},{Sno,Sname}

Primary key--->By using primary key we can retrieve the data


Ex:Studnet table--->{student_Sid}

Boyce-Codd Normal Form


----------------------------------------
It should be in the 3NF and every functonal dependency x-->y,x should be the super
key of the table.

Conditions:
--->table must be in 3r normal form(no transitive dependecy)
--->And for each functinal dependency (X-->Y) X should be a super key.

4th noraml form:


-----------------------------------
--->It is in Boyce-Codd Normal Form
--->Dosent have Multi Valued Dependecy.

Multi Valued Depenecy:

1. For a dependency A → B, if for a single value of A, multiple value of B exists,


then the table may have multi- valued dependency.
2 .Table contains atleast 3 values to have a multi-Valued Dependency.
3 . R(A,B,C) if there is a mutli valued dependecy between A and B tHEN
B and C are indepedent of each other.

5th Normal Form(PROJECT-JOIN normal Form):


------------------------------------------------------------------------
1.It is in 4th Normal Form
2.It dosent have any join dependency.

Dosent implemnet in real life.

Join dependency:

When a table is divided to remove redudancy and after that if we want to


join the table should not loose records nor craet new records.
-----------------------------------------------------------------------------------
-------------------------------------------------------------
17)Explain different types of keys in a database.
A)
1)Primary Key--->An attributes which is used to uniquely identify every row/tuple.
2)Unique Key-->It is similar to the primary key except that primary keys don’t
allow NULL values in the column but unique keys
allow them.
3)Candidate Key--->It is a set of properties that can uniquely identify a
table.Each table may have multiple candidate keys. One
key amongst all candidate keys can be chosen as a primary key.
4)Super Key:It defines a set of attributes that can uniquely identify a tuple.
Candidate key and primary key are subsets of the super key.
5)Foreign Key:An attribute that can only take the values present in one table
common to the attribute present in another table.
6)Composite Key:It is a combination of two or more columns that can uniquely
identify each tuple in a table.
7)Unique Key – It is unique for all the records of the table. Once assigned, its
value cannot be changed i.e. it is
non-updatable. It may have a NULL value.
-----------------------------------------------------------------------------------
-------------------------------------------------------------
18)Explain the difference between a 2-tier and 3-tier architecture in a DBMS?
A)
2 tier:application at client
EX:Social media
3 tier:client communiactes with the server
Ex:Putty,SQL server.

centralized server--->one to few crores(mnc usage)


client server--->single server executes work of many machine(singel owner)
paralele databse--->crore shared memory,shared disk.(memory sharing)
distributed--->Semantic heterogeneity is when database schema or datasets for the
same domain are developed by independent parties,

Two tier--->application with user and it connects to database(instagram)


three tier--->application with user coomunictaes with server and server connects to
database.(putty)
-----------------------------------------------------------------------------------
-------------------------------------------------------------
19)What is RDMS?
A)A database management system that is based on the relational model.(Table,
Record/Tuple/Row, Field, and Column/Attribute)

properties:
1)Values are atomic.
2)All of the values in a column have the same data type.
3)Each row is unique.
4)The sequence of columns is insignificant.
5)The sequence of rows is insignificant.
6)Each column has a unique name.
7)Integrity(Accurate) constraints maintain data consistency across multiple tables.
-----------------------------------------------------------------------------------
-------------------------------------------------------------
20)Difference between vertical and horizontal scaling
A)Vertical Scaling-->Increase the capacity of a single machine and increase its
throughput.
Horizontal Scaling-->Adding more instances of machines without first implementing
improvements to existing specifications.
-----------------------------------------------------------------------------------
-------------------------------------------------------------
21)What is sharding?
A)Splitting and storing a single logical dataset in multiple databases. By
distributing the data among multiple machines,
a cluster of database systems can store larger dataset and handle additional
requests.
-----------------------------------------------------------------------------------
-------------------------------------------------------------
22)Indexing in DBMS
A)It is used to locate and access the data in a database table quickly.
-----------------------------------------------------------------------------------
-------------------------------------------------------------
23) Conflict Serializability in DBMS.
A)Serializability--->Helps us to check which schedules are serializable.
A serializable schedule is the one that always leaves the database in consistent
state.

A schedule is called conflict serializability if after swapping of non-conflicting


operations, it can transform into a serial
schedule. The schedule will be a conflict serializable if it is conflict equivalent
to a serial schedule.
-----------------------------------------------------------------------------------
-------------------------------------------------------------
24)What is CCP ? (Concurrency Control Protocols)
A)A procedure that is required for controlling concurrent execution of the
operations that take place on a database.

The concurrency control protocols ensure the ACID and serializability of the
concurrent execution of the database transactions.

Lock Based Concurrency Control Protocol


Timestamp Concurrency Control Protocol
Validation Based Concurrency Control Protocol
-----------------------------------------------------------------------------------
-------------------------------------------------------------

You might also like