Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
123 views

Database Management System

This document contains an assignment submitted by Salman Ahmed to his professor at Khulna University of Engineering and Technology on the topic of database management systems. It includes definitions of a database, database management system, the major types of databases (relational, hierarchical, network, object-oriented), and explanations for why database systems are needed.

Uploaded by

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

Database Management System

This document contains an assignment submitted by Salman Ahmed to his professor at Khulna University of Engineering and Technology on the topic of database management systems. It includes definitions of a database, database management system, the major types of databases (relational, hierarchical, network, object-oriented), and explanations for why database systems are needed.

Uploaded by

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

KHULNA UNIVERSITY OF ENGINEERING AND TECHNOLOGY,

KHULNA

Department of Electronics and Communication Engineering

CSE 3209 : Database System

An assignment on,

Database Management System

Submitted to :

Md. Abdus Salim Mollah

Assistant Professor, Department of CSE

Khulna University of Engineering & Technology

Submitted by :

Salman Ahmed

Roll : 1709050

Department of Electronics & Communication Engineering

Khulna University of Engineering & Technology


What is database?

A database is an electronic system that allows data to be stored, easily accessed, manipulated


and updated.  A database is made up of two components mainly, data and a meaningful
method for accessing and manipulating data, which is known as database management system.
Databases are quite similar to spreadsheets as they are mostly made up of tables which contain
rows and columns like a spreadsheet. A database needs to be hosted or created on some
special database platform, some of the famous Database platforms are:

 PostgreSQL
 MySQL
 Microsoft Access
 SQLite

What is database management system?

A database management system is a software used to perform different operations,


like addition, access, updating, and deletion of the data. It acts as the backbone of a database
and makes using a database a cakewalk as it makes access and management of data a lot
easier.

Mainly a DBMS manipulates the data itself, the data format, field names, record structure and
file structure. It defines rules to validate and manipulate the data. DBMS are set up on specific
data handling concepts, as the practice of administrating a database evolves. The earliest
databases only handled individual single pieces of specially formatted data. Today’s more
evolved systems can handle different kinds of less formatted data and tie them together in more
elaborate ways.

What are the major types of database? Describe them.

Databases can be classified into four major types:

 Relational database
 Hierarchical database
 Network database
 Object-oriented database
Relational Database

The first thing to know is that database which we deal with the most, like SQL, is based
upon Relational Databases. The easiest way to put relational databases is: They store data in
form of tables which are related to each other.

For a further understanding, the relational database model works on the concept of storing data
where data is represented by tuples, grouped into relations. It may occur to you what are tuples,
so let’s look at what exactly are tuples:

In mathematics, a tuple is defined as a finite-ordered list of elements. To define in a simple


language, a tuple is actually a row in the table of the database. Each row in a table represents a
set of related data, and every row in the table has the same structure. While the rows actually
contain data in a related fashion, the columns actually contain data of a similar kind ,i.e., data in
a column is always of a similar kind.

So, we may see that storing the data in form of a table, we have two major attributes, rows and
columns.

As you can see in the example below which show the relational database for a library.

In this example, the two tables are connected by the Book No, which acts as a key between the
two tables. Here you can see the two tables are related to each other or share a relation defined
using Book No.

Each table is related to a certain type of data and thus a table relates all the various data types
present inside it. Each data type actually defines a certain new column and thus a new property
is given to the table. The table relates or combines all the columns present in the table to each
other and thus the data too. This leads to the fact that certain times tables are termed
as “relations” also.
Hierarchical Database

The Hierarchical databases are actually databases which follow a tree-like structure. Just
imagine a family hierarchy tree, maybe of an Ameoba-like family, i.e., one parent dividing into
multiple children. It may look like the picture below:

Network Database

Network databases are similar to Hierarchical ones, the only difference is one child is connected
to many parents. Just take a look at the example of an E-Commerce company, where the
children, Seller, and Customer both share common child Product.

Object-oriented Database

We saw that RDBMS actually stores values in form of tables, but what if we make a separate
table for each book? This is what Object-Oriented Database is:
What are the differences between database and database management system? 

Category Database DBMS

In a database
Besides computers, databases management system
can even be maintained in (DBMS), all the records
1 physical ledgers, books or are maintained only on a
. Storage papers. computer.

The retrieval of information from We can retrieve the data


the databases can be done from the database
manually, through queries or by management system
2 Data using programs (C, C++, Java through queries written in
. Retrieval etc.). SQL.

As a computer system is
As databases can be handled involved in a database
manually or via computers, when management system, the
3 SQL is not used to retrieve retrieval of information is
. Speed information, it can be very slow. very quick.

4 Access The databases are not designed The database


. for a large number of people management system is
who can access data at the designed for a large
same time, rather it is designed number of people who can
Category Database DBMS

for a very small number of


people (preferably few people)
who access data at different access the data at the
times. same time.

In the database
management system
(DBMS), a lot of
information can be
In case of the databases, very changed at one time (as it
5 Data less information can be modified can have many users
. Manipulation at a time. using it at the same time).

The database
management system
(DBMS) ensures that the
The databases do not ensure data will always be
6 Backup and that the data will be available available even after
. Recovery after failure arises. system failures.

Why do we need a database system?

A database is typically designed so that it is easy to store and access information. A good
database is much needed to any company or organization. This is because the database stores
all the pertinent details about the company such as employee records, transactional records,
salary details etc. The various reasons a database is important are −

1) Processing Queries and Object Management:

In traditional file systems, we cannot store data in the form of objects. In practical-world
applications, data is stored in objects and not files. So in a file system, some application
software maps the data stored in files to objects so that can be used further.
We can directly store data in the form of objects in a database management system. Application
level code needs to be written to handle, store and scan through the data in a file system
whereas a DBMS gives us the ability to query the database.

2) Controlling redundancy and inconsistency:


Redundancy refers to repeated instances of the same data. A database system provides
redundancy control whereas in a file system, same data may be stored multiple times. For
example, if a student is studying two different educational programs in the same college, say
,Engineering and History, then his information such as the phone number and address may be
stored multiple times, once in Engineering dept and the other in History dept. Therefore, it
increases time taken to access and store data. This may also lead to inconsistent data states in
both places. A DBMS uses data normalization to avoid redundancy and duplicates.

3) Efficient memory management and indexing:

DBMS makes complex memory management easy to handle. In file systems, files are indexed
in place of objects so query operations require entire file scans whereas in a DBMS , object
indexing takes place efficiently through database schema based on any attribute of the data or a
data-property. This helps in fast retrieval of data based on the indexed attribute.

4) Concurrency control and transaction management:

Several applications allow user to simultaneously access data. This may lead to inconsistency
in data in case files are used. A DBMS provides mechanisms to deal with this kind of data
inconsistency while allowing users to access data concurrently. A DBMS
implements ACID(atomicity, durability, isolation, consistency) properties to ensure efficient
transaction management without data corruption.

5) Access Control and ease in accessing data:

A DBMS can grant access to various users and determine which part and how much of the data
can they access from the database thus removing redundancy. Otherwise in file system,
separate files have to be created for each user containing the amount of data that they can
access. Moreover, if a user has to extract specific data, then he needs a code/application to
process that task in case of file system, e.g. Suppose a manager needs a list of all employees
having salary greater than X. Then we need to write business logic for the same in case data is
stored in files. In case of DBMS, it provides easy access of data through queries,
(e.g., SELECT queries) and whole logic need not be rewritten. Users can specify exactly what
they want to extract out of the data.

6) Integrity constraints: 
Data stored in databases must satisfy integrity constraints. For example, Consider a database
schema consisting of the various educational programs offered by a university such
as(B.Tech/M.Tech/B.Sc/M.Sc/BCA/MCA) etc. Then we have a schema of students enrolled in
these programs. A DBMS ensures that it is only out of one of the programs offered schema ,
that the student is enrolled in, i.e. Not anything out of the blue. Hence, database integrity is
preserved.

How can we modify a database?

We can modify a database by inserting or updating or deleting a data from the database.

 Insertion: To insert data into a relation, we either specify a tuple to be inserted or write a query
whose result is a set of tuples to be inserted. Obviously, the attribute values for inserted tuples
must be members of the corresponding attribute’s domain. Similarly, tuples inserted must have
the correct number of attributes.

 Deletion: A delete request is expressed in much the same way as a query. We can delete only
whole tuples; we cannot delete values on only particular attributes. Note that a delete
command operates on only one relation. If we want to delete tuples from several relations, we
must use one delete command for each relation.

 Updates: In certain situations, we may wish to change a value in a tuple without changing all
values in the tuple. For this purpose, the update statement can be used. As we could for insert
and delete, we can choose the tuples to be updated by using a query. In general, the where
clause of the update statement may contain any construct legal in the where clause of the select
statement (including nested selects). As with insert and delete, a nested select within an update
statement may reference the relation that is being updated.

What are types of keys in Database Management System?

There are mainly seven different types of Keys in DBMS and each key has it’s different
functionality:

 Super Key -  A super key is a group of single or multiple keys which identifies rows in a
table.

 Primary Key -  is a column or group of columns in a table that uniquely identify every
row in that table.
 Candidate Key -  is a set of attributes that uniquely identify tuples in a table. Candidate
Key is a super key with no repeated attributes.

 Alternate Key -  is a column or group of columns in a table that uniquely identify every
row in that table.

 Foreign Key -  is a column that creates a relationship between two tables. The purpose
of Foreign keys is to maintain data integrity and allow navigation between two different
instances of an entity.

 Compound Key -  has two or more attributes that allow you to uniquely recognize a
specific record. It is possible that each column may not be unique by itself within the
database.

 Composite Key -  An artificial key which aims to uniquely identify each record is called a
surrogate key. These kind of key are unique because they are created when you don't
have any natural primary key.

 Surrogate Key -  An artificial key which aims to uniquely identify each record is called a
surrogate key. These kind of key are unique because they are created when you don't
have any natural primary key.

What do you mean by Super key?

A super key is a group of single or multiple keys which identifies rows in a table. A Super key
may have additional attributes that are not needed for unique identification.

Example:

Student ID Roll Number Name

9812345098 1709069 Salman

9876512345 1709420 Roslyn

199937890 1709999 James

In the above-given example, Student ID and Roll number name are super keys.

What is Primary Key?


PRIMARY KEY is a column or group of columns in a table that uniquely identify every row in
that table. The Primary Key can't be a duplicate meaning the same value can't appear more
than once in the table. A table cannot have more than one primary key.

Rules for defining Primary key:

 Two rows can't have the same primary key value

 It must for every row to have a primary key value.

 The primary key field cannot be null.

 The value in a primary key column can never be modified or updated if any foreign key
refers to that primary key.

Example:

In the following example, <code>StudID</code> is a Primary Key.

StudID Roll No First Name LastName Email

1 11 Tom Price abc@gmail.com

2 12 Nick Wright xyz@gmail.com

3 13 Dana Natan mno@yahoo.com

What is Candidate Key?

CANDIDATE KEY is a set of attributes that uniquely identify tuples in a table. Candidate Key is
a super key with no repeated attributes. The Primary key should be selected from the candidate
keys. Every table must have at least a single candidate key. A table can have multiple candidate
keys but only a single primary key.

Properties of Candidate key:

 It must contain unique values

 Candidate key may have multiple attributes

 Must not contain null values

 It should contain minimum fields to ensure uniqueness

 Uniquely identify each record in a table


Example: In the given table Stud ID, Roll No, and email are candidate keys which help us to
uniquely identify the student record in the table.

StudID Roll No First Name LastName Email

1 11 Tom Price abc@gmail.com

2 12 Nick Wright xyz@gmail.com

3 13 Dana Natan mno@yahoo.com

What is the Foreign key?

FOREIGN KEY is a column that creates a relationship between two tables. The purpose of
Foreign keys is to maintain data integrity and allow navigation between two different instances
of an entity. It acts as a cross-reference between two tables as it references the primary key of
another table.

Example:

DeptCode DeptName

001 Science

002 English

005 Computer

Teacher ID Fname Lname

B002 David Warner

B017 Sara Joseph

B009 Mike Brunton

In this key in DBMS example, we have two table, teach and department in a school. However,
there is no way to see which search work in which department.
In this table, adding the foreign key in Deptcode to the Teacher name, we can create a
relationship between the two tables.

Teacher ID DeptCode Fname Lname

B002 002 David Warner

B017 002 Sara Joseph

B009 001 Mike Brunton

This concept is also known as Referential Integrity.

What is Alternate key or Secondary key?

ALTERNATE KEYS is a column or group of columns in a table that uniquely identify every row
in that table. A table can have multiple choices for a primary key but only one can be set as the
primary key. All the keys which are not primary key are called an Alternate Key.

Example:

In this table, StudID, Roll No, Email are qualified to become a primary key. But since StudID is
the primary key, Roll No, Email becomes the alternative key.

StudID Roll No First Name LastName Email

1 11 Tom Price abc@gmail.com

2 12 Nick Wright xyz@gmail.com

3 13 Dana Natan mno@yahoo.com

What is Functional Dependency?

Functional Dependency (FD) is a constraint that determines the relation of one attribute to
another attribute in a Database Management System (DBMS). Functional Dependency helps to
maintain the quality of data in the database. It plays a vital role to find the difference between
good and bad database design.

A functional dependency is denoted by an arrow "→". The functional dependency of X on Y is


represented by X → Y. Let's understand Functional Dependency in DBMS with example.

Example:

Employee number Employee Name Salary City

1 Dana 50000 San Francisco

2 Francis 38000 London

3 Andrew 25000 Tokyo

In this example, if we know the value of Employee number, we can obtain Employee Name, city,
salary, etc. By this, we can say that the city, Employee Name, and salary are functionally
depended on Employee number.

What are the rules of Functional Dependencies?

Below are the Three most important rules for Functional Dependency in Database:

 Reflexive rule –. If X is a set of attributes and Y is_subset_of X, then X holds a value of


Y.

 Augmentation rule: When x -> y holds, and c is attribute set, then ac -> bc also holds.
That is adding attributes which do not change the basic dependencies.

 Transitivity rule: This rule is very much similar to the transitive rule in algebra if x -> y
holds and y -> z holds, then x -> z also holds. X -> y is called as functionally that
determines y.

What are the types of Functional Dependencies in DBMS? Describe them.

There are mainly four types of Functional Dependency in DBMS. Following are the types of
Functional Dependencies in DBMS:
 Multi-valued Dependency
 Trivial Functional Dependency
 Non-Trivial Functional Dependency
 Transitive Dependency

1. Multi-valued Functional Dependency

In Multivalued functional dependency, entities of the dependent set are not dependent on each
other.
i.e. If a → {b, c} and there exists no functional dependency between b and c, then it is called
a multivalued functional dependency.

For example,

roll_no name agethe 

42 abc 17the 

43 pqr 18

44 xyz 18

45 abc 19

Here, roll_no → {name, age} is a multivalued functional dependency, since the


dependents name & age are not dependent on each other(i.e. name → age or age → name
doesn’t exist !)

2. Trivial Functional Dependency

In Trivial Functional Dependency, a dependent is always a subset of the determinant.


i.e. If X → Y and Y is the subset of X, then it is called trivial functional dependency

For example,
Nam
Roll_no e Age

42 abc 17

43 pqr 18

44 xyz 18

Here, {roll_no, name} → name is a trivial functional dependency, since the dependent name is a


subset of determinant set {roll_no, name}
Similarly, roll_no → roll_no is also an example of trivial functional dependency. 

3. Non-trivial Functional Dependency

In Non-trivial functional dependency, the dependent is strictly not a subset of the determinant.
i.e. If X → Y and Y is not a subset of X, then it is called Non-trivial functional dependency.

For example,

Roll_n
o Name Age

42 abc 17

43 pqr 18

44 xyz 18

Here, roll_no → name is a non-trivial functional dependency, since the dependent name is not a


subset of determinant roll_no
Similarly, {roll_no, name} → age is also a non-trivial functional dependency, since age is not a
subset of {roll_no, name} 

4. Transitive Functional Dependency

In transitive functional dependency, dependent is indirectly dependent on determinant.


i.e. If a → b & b → c, then according to axiom of transitivity, a → c. This is a transitive functional
dependency  
For example,

enrol_no name dept building_no

42 abc CO 4

43 pqr EC 2

44 xyz IT 1

45 abc EC 2

Here, enrol_no → dept and dept → building_no, 


Hence, according to the axiom of transitivity, enrol_no → building_no is a valid functional
dependency. This is an indirect functional dependency, hence called Transitive functional
dependency.

What are the advantages of Functional Dependency?

The advantages of functional dependency are given below:

1. It avoids data redundancy. Therefore, same data do not repeat at multiple locations in that database.

2. It helps to maintain the quality of data in the database.

3. It helps to define meanings and constraints of database.

4. It helps to identify bad designs. 5. It helps to find facts regarding the database design.

What are Armstrong’s Axioms rule and Inference rule?

Armstrong’s Axioms rule : If F is a set of functional dependencies then the closure of F, denoted as F+ ,
is the set of all functional dependencies logically implied by F. Armstrong's Axioms are a set of rules, that
when applied repeatedly, generates a closure of functional dependencies.

• Reflexive rule − If alpha is a set of attributes and beta is a subset of alpha, then alpha holds beta.

• Augmentation rule − If a → b holds and y is attribute set, then ay → by also holds. That is adding
attributes in dependencies, does not change the basic dependencies.
• Transitivity rule − Same as transitive rule in algebra, if a → b holds and b → c holds, then a → c also
holds. a → b is called as a functionally that determines b.

Armstrong’s Inference rule: Union if X →Y and X → Z then X →YZ Pseudotransitivity if X →Y and WY → Z


then WX → Z Decomposition if X →YZ and X →Y then X → Z

What is Normalization?

Normalization is a database design technique that reduces data redundancy and eliminates
undesirable characteristics like insertion, update and deletion anomalies. Normalization rules
divides larger tables into smaller tables and links them using relationships. The purpose of
normalization in SQL is to eliminate redundant data and ensure data is stored logically.

What are the types of database normal forms?

There are six kinds of normal form.

Such as:

1. 1NF

2. 2NF

3. 3NF

4. BCNF

5. 4NF

6. 5NF.
1. First Normal Form(1NF)

The table or relation is said to be in First Normal Form if it does not contain any multi-valued or
composite attributes. So the table or relation should contain only single-valued attributes for
fulfilling the condition for First Normal Form.

Let us take the example of the STUDENT table as below:

Roll Name Subject

19 Rajesh Math, Science

23 Supriya History, English

32 Zack Geography

The above table is not in First Normal Form as this contains the multi-valued attribute. The
below table is transformed into the First Normal Form as it contains only atomic values.

Roll Name Subject

19 Rajesh Math

19 Rajesh Science

23 Supriya History

23 Supriya English

32 Zack Geography

2. Second Normal Form(2NF)


A relation or table to be in Second Normal Form should be in First Normal Form and it should
not hold any partial dependency. So in Second Normal Form, the table should not contain any
non-prime attribute depending upon the proper subset of any candidate key.

Let us consider the STUDENT table as cited previously as below:

Roll Name Subject

19 Rajesh Math

19 Rajesh Science

23 Supriya History

23 Supriya English

32 Zack Geography

The above table needs to be broken into two tables as below to make it Second Normal Form
compliant.

STUDENT

Roll Name

19 Rajesh

23 Supriya

32 Zack

SUBJECT_DETAIL
Roll Subject

19 Math

19 Science

23 History

23 English

32 Geography

The functional dependency from the table ‘STUDENT’ is removed and the column Subject in
‘SUBJECT_DETAIL’ is fully dependent on the primary key ‘Roll’.

3. Third Normal Form(3NF)

A table is in Third Normal Form if it is in Second Normal Form and there should not be any
transitive dependency for the non-prime attributes.

So for every non-trivial functional dependency A->B, if any of the two conditions is true from the
below, the relation is said to be in Third Normal Form.

1. A is a super key.

2. B is a prime attribute where each element of B is part of any candidate key.

Let us consider the table ‘EMPLOYEE’ as below:

EMP_ID EMP_NAME EMP_DEPT EMP_STATE EMP_


COUNTRY

289 Mike Sales Florida U.S.

378 Sameer Finance Maharashtra India

989 Nicki Marketing Texas U.S.

The candidate key in the above table is EMP_ID and the functional dependency set is EMP_ID-
>EMP_NAME, EMP_ID->EMP_DEPT, EMP_ID->EMP_STATE, EMP_STATE ->
EMP_COUNTRY. The EMP_COUNTRY is transitively dependent upon EMP_STATE. So we
need to break the above table to two tables as below for transforming it to the Third Normal
Form.

EMPLOYEE:

EMP_ID EMP_NAME EMP_DEPT EMP_STATE

289 Mike Sales Florida

378 Sameer Finance Maharashtra

989 Nicki Marketing Texas

STATE_COUNTRY:

EMP_STATE EMP_ COUNTRY

Florida U.S.

Maharashtra India

Texas U.S.

The EMP_STATE becomes the primary key in the above table and the transitive dependency is
removed.
4. Boyce-Codd Normal Form(BCNF)

For a table to be in Boyce-Codd Normal Form, it should be in Third Normal Form and for every
functional dependency A->B, A is the super key in the table.

EMP_DEPT table:

ID COUNTRY DEPARTMENT DEPT_TYPE DEPT_NO

9890 India Marketing M098 045

11090 US Finance F0567 023

12390 India Sales S1002 012

The functional dependency for the above table is: ID -> COUNTRY, DEPARTMENT ->
{DEPT_TYPE, DEPT_NO}. {ID, DEPARTMENT} is the candidate key. To transform the above
table to BCNF, we have to break it into three tables as below:

EMP_COUNTRY:

ID COUNTRY

9890 India

11090 US

12390 India

DEPT_DETAILS:
DEPARTMENT DEPT_TYPE DEPT_NO

Marketing M098 045

Finance F0567 023

Sales S1002 012

EMP_DEPARTMENT_MAP:

ID DEPARTMENT

9890 Marketing

11090 Finance

12390 Sales

The functional dependency for the above is ID -> EMP_COUNTRY, DEPARTMENT->


{DEPT_TYPE, DEPT_NO}. The candidate keys for the tables EMP_COUNTRY,
DEPT_DETAILS and EMP_DEPARTMENT_MAP are ID, DEPARTMENT and {ID,
DEPARTMENT}.

What are the goals of normalization?

The goals of normalization are given below:


 It is used to remove the duplicate data and database anomalies from the relational table.

 Normalization helps to reduce redundancy and complexity by examining new data types
used in the table.

 It is helpful to divide the large database table into smaller tables and link them using
relationship.

 It avoids duplicate data or no repeating groups into a table.

 It reduces the chances for anomalies to occur in a database.

What are the advantages of Normalization?

Below are the advantages of Normalization:

 Redundant data gets removed efficiently.

 Improved data quality and flexibility in database designing.

 The improved overall organization of data in the database.

 Data is consistent and logically stored in the database.

What are the problems without normalization?

Let us consider a table with student id, student name, student address and subject opted.

1. Updating Anomaly: To update address of a student who occurs twice or more than twice
in a table, we will have to update student address column in all the rows, else data will become
inconsistent.

2. Insertion Anomaly: Let us consider for a new admission, we have a student id, name and
address of a student but if student has not opted for any subjects yes then we have to insert null
there, leading to insertion anomaly.

3. Deletion Anomaly: If one student id has only one subject and temporarily he drops it,
when we delete that row, entire student record will be deleted along with it.

What is Functional Decomposition?


Functional decomposition corresponds to the various functional relationships as how the original
complex business function was developed. It mainly focuses on how the overall functionality is
developed and its interaction between various components. Large or complex functionalities are
more easily understood when broken down into pieces using functional decomposition.

Types of Decomposition are:

1. Lossless Decomposition

o If the information is not lost from the relation that is decomposed, then the
decomposition will be lossless.

o The lossless decomposition guarantees that the join of relations will result in the same
relation as it was decomposed.

o The relation is said to be lossless decomposition if natural joins of all the decomposition
give the original relation.

2. Dependency Preserving

o It is an important constraint of the database.

o In the dependency preservation, at least one decomposed table must satisfy every
dependency.

o If a relation R is decomposed into relation R1 and R2, then the dependencies of R either
must be a part of R1 or R2 or must be derivable from the combination of functional
dependencies of R1 and R2.

o For example, suppose there is a relation R (A, B, C, D) with functional dependency set
(A->BC). The relational R is decomposed into R1(ABC) and R2(AD) which is
dependency preserving because FD A->BC is a part of relation R1(ABC).

What are the features of functional decomposition?

1. Functional decomposition breaks down a large, complex process into an array of similar,
simpler units or tasks, fostering better understanding of the overall process.

2. A functional decomposition diagram contains the whole function or project along with all of
the necessary sub- tasks needed to complete it.

3. Functional decomposition is a problem solving tool used in several contexts, from business
and industry to computer programming.
What is the algorithm to test whether a functional decomposition is loss-less or
not?

Determining Whether Decomposition Is Lossless or Lossy-

Consider a relation R is decomposed into two sub relations R1 and R2.

Then,

 If all the following conditions satisfy, then the decomposition is lossless.


 If any of these conditions fail, then the decomposition is lossy.

Condition 01:

Union of both the sub relations must contain all the attributes that are present in the original
relation R.

Thus, R1 ∪ R2 = R

Condition 02:

 Intersection of both the sub relations must not be null.


 In other words, there must be some common attribute which is present in both the sub
relations.

Thus, R1 ∩ R2 ≠ ∅

Condition 03:

Intersection of both the sub relations must be a super key of either R1 or R2 or both.

Thus, R1 ∩ R2 = Super key of R1 or R2

What is Database Schema?

A database schema represents the logical configuration of all or part of a relational database. It
can exist both as a visual representation and as a set of formulas known as integrity constraints
that govern a database. These formulas are expressed in a data definition language, such as
SQL. As part of a data dictionary, a database schema indicates how the entities that make up
the database relate to one another, including tables, views, stored procedures, and more.
There are two main kinds of database schema:

1. A logical database schema conveys the logical constraints that apply to the stored data. It
may define integrity constraints, views, and tables.

2. A physical database schema lays out how data is stored physically on a storage system in
terms of files and indices.

A database schema is used to outline the architecture of a database, and it will help ensure the
following:

 Consistent formatting of data entries

 All record entries have a unique primary key

 No important data is omitted

What is relation schema?

In databases, relational schema may refer to

 a database schema, in the relational paradigm


 a (single) relation schema
 Database schema. The term "schema" refers to the organization of data as blueprint of
how the database is constructed (divided into database tables in the case of relational
databases). The formal definition of a database schema is a set of formulas (sentences)
called integrity constraints imposed on a database.

Explain Instance vs Schema of DBMS.

A schema is the outline of a database. It is represented in a graphic format, like our example
from earlier. Schemas do not contain any data.One way to think about a schema is that it is a
blueprint for a database. The database hasn’t been built yet—or is still being built—and the
blueprint guides the development team in creating the database.

A database instance is a hosted version of a database. For instance, the Career Karma blog
has a database instance that stores all of our posts, such as this article. Database instances
can change over time as their contents change, whereas database schemas usually remain the
same.

With that said, a database schema may be updated as new features are requested for a
software project. Making changes to a schema typically involves the work of both developers
and database administrators. Developers will produce the requirements for a change to a
database, and database administrators will implement those changes.
What is Data Model?

Explain it and it’s variations. Data Model is the modeling of the data description, data semantics,
and consistency constraints of the data. It provides the conceptual tools for describing the
design of a database at each level of data abstraction. There are four types of data models.

1. Relational Data Model: This type of model designs the data in the form of rows
and columns within a table. Thus, a relational model uses tables for representing
data and in-between relationships. Tables are also called relations. This type of
model designs the data in the form of rows and columns within a table. Thus, a
relational model uses tables for representing data and in-between relationships.
Tables are also called relations.

2. Entity-Relationship data Model: It 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. It was widely used in
database designing. A set of attributes describe the entities. For example,
student name, student id describes the 'student' entity.

3. Object Based Data Model: An extension of the ER model with notions of


functions, encapsulation, and object identity, as well. This model supports a rich
type system that includes structured and collection types.

4. Semi-structured Data Models: This type of data model is different from the
other three data models. The semi-structured data model allows the data
specifications at places where the individual data items of the same type may
have different attributes sets. The Extensible Markup Language, also known as
XML, is widely used for representing the semi-structured data. Although XML
was initially designed for including the markup information to the text document, it
gains importance because of its application in the exchange of data.

What do you know about SQL?

SQL is Structured Query Language, which is a computer language for storing, manipulating and
retrieving data stored in a relational database.

SQL is the standard language for Relational Database System. All the Relational Database
Management Systems (RDMS) like MySQL, MS Access, Oracle, Sybase, Informix, Postgres
and SQL Server use SQL as their standard database language.
Also, they are using different dialects, such as –

• MS SQL Server using T-SQL,

• Oracle using PL/SQL,

• MS Access version of SQL is called JET SQL (native format) etc.

Why do we use SQL?

SQL is widely popular because it offers the following advantages –

 Allows users to access data in the relational database management systems.


 Allows users to describe the data.
 Allows users to define the data in a database and manipulate that data.
 Allows to embed within other languages using SQL modules, libraries & precompilers.
 Allows users to create and drop databases and tables.
 Allows users to create view, stored procedure, functions in a database.
 Allows users to set permissions on tables, procedures and views.

What is query language?

A query language is a specialized programming language for searching and changing the
contents of a database. Query language (QL) refers to any computer programming language
that requests and retrieves data from database and information systems by sending queries. It
works on user entered structured and formal programming command based queries to find and
extract data from host databases.

If we talk about normal queries we fire on the database they should be correct and in a well-
defined structure which means they should follow a proper syntax if the syntax or query is wrong
definitely we will get an error and due to that our application or calculation definitely going to
stop. So to overcome this problem QBE was introduced. QBE stands for Query by Example and
it was developed in 1970 by Moshe Zloof at IBM.

It is a graphical query language where we get a user interface and then we fill some required
fields to get our proper result.

In SQL we will get an error if the query is not correct but in the case of QBE if the query is wrong
either we get a wrong answer or the query will not be going to execute but we will never get any
error.
What are the types of Query language?

There are four types of query language.

Such as:

1. Data Definition Language.

2. Data Manipulation Language.

3. Data Control Language.

4. Transaction Control Language.

What are the fundamental operations of relational algebra? Also describe select and
project operations.

The fundamental operations of relational algebra are given bellow:

1. Select. 2. Project. 3. Union. 4. Set different. 5. Cartesian product. 6. Rename.

Select operation:

The select operation is used to choose a subset of the tuples from a relation that satisfies a
selection condition. One can consider the select operation to be a filter that keeps only those
tuples that satisfy a qualifying condition. Alternatively, we can consider the select operation to
restrict the tuples in a relation to only those tuples that satisfy the condition. The select
operation can also be visualized as a horizontal partition of the relation into two sets of tuples-
those tuples that satisfy the condition and are selected, and those tuples that do notsatisfy the
condition and are discarded.

Project operation:

If we think of a relation as a table, the select operation chooses some of the rows from the table
while discarding other rows. The project operation, on the other hand, selects certain columns
from the table and discards the other columns. If we are interested in only certain attributes of a
relation, we use the project operation to project the relation over these attributes only.
Therefore, the result of the project operation can be visualized as a vertical position of the
relation into two relations: one has the needed columns, and the other contains the discarded
columns.
References

 https://www.bytenap.com/what-is-a-database-why-do-we-need-it/

 https://careerkarma.com/blog/database-schema/

 https://www.tutorialride.com/dbms/database-decomposition.htm

 https://hackr.io/blog/dbms-normalization

 https://www.guru99.com/database-normalization.html

 https://www.geeksforgeeks.org/types-of-functional-dependencies-in-dbms/

 https://www.tutorialspoint.com/difference-between-super-key-and-candidate-key

You might also like