DBMS (2m, 5m, 10m)
DBMS (2m, 5m, 10m)
Nov 2016
1.) Query processor
The query processor is the subcomponent of the data server that
processes SQL requests.
4.) What are the different types of relationships occur among entities?
List them.
There are 3 types of relationships occur among entities.
• One-to-One Relationship
• One-to-Many or Many-to-One Relationship.
• Many-to-Many Relationship.
Common controls
• Text labels
• Text box for data entry
• Option buttons
• Pictures
• List boxes
9.) Transactions
A transaction is defined as a set of changes that must all be made
together .
(OR)
• Provide centralized control over the data
• Sets data definition standards for ensuring
▪︎Consistent Formats
▪︎Naming Conventions
• Act as data and database advocate
▪︎Application Ideas
▪︎Decision Support
▪︎Strategic uses
• Coordinate data integrity, security and control
(OR)
Physical security is the protection of personnel, hardware, software,
networks and data from physical actions and events that could cause
serious loss or damage to an enterprise, agency or institution. This
includes protection from fire, flood, natural disasters, burglary, theft,
vandalism and terrorism.
Nov 2017
1.) Class
A class describes the contents of the objects that belong to it: it
describes an aggregate of data fields (called instance variables), and
defines the operations (called methods). object: an object is an element
(or instance) of a class; objects have the behaviors of their class.
Syntax
create table table_name (
column1 datatype,
column2 datatype,
column3 datatype,
....
);
Example :
create table Grocery (
Items varchar(25),
Quantity number (5),
MRP number(5),
Total number(10));
Nov 2019
1.) Define DBMS (Nov 2018,19)
A Database Management System (DBMS) is software designed to store,
retrieve, define, and manage data in a database.
4.) SQL
SQL is Structured Query Language, which is a computer language for
storing, manipulating and retrieving data stored in a relational
database.
7.)Tabular forms
Tabular is arranged in a table, with rows and columns. Sports statistics
are usually presented in a tabular format.
1. Menus
2. Toolbars
3. Help system
Types of Report
Tabular and level report
Group and subtotal Report
Graphs
5marks
Nov 2016
13.) Database engine and Data dictionary in the components of DBMS
Database Engine :
• Heart of DBMS
• Responsible for
▪︎Storing
▪︎Retrieving
▪︎Updating the data
• Responsible for enforcing business rules regarding the data
• Stand-alone component that can be purchased and used as an
independent software module
Data Dictionary :
• Holds the definition of all the data tables
• Tasks
▪︎Describes the type of data that is being stored
▪︎Allows the DBMS to keep track of the data
▪︎Helps developers and users find the data they need
Syntax:
SELECT column_name, function_name(column_name)
FROM table_name
WHERE condition
GROUP BY column_name
ORDER BY column1, column2;
Example :
Student
103 Elakkiyaa IT 76
105 Kavin It 79
Display the number of students in each department
SQL> SELECT Dept, count(*) FROM Student
GROUP BY Dept
Department Count
IT 2
ECE 1
CSE 2
Tabular Forms :
• Displays the data in columns and rows from a table or query
• Can be used as a sub form and is rarely used as a stand-alone form.
Example
▪︎Microsoft Access provides an even simpler version of form
called a datasheet
Single-Row or Columnar Forms :
• Single-row form displays data for one row at a time
• Goal
▪︎To display every column
• Greatest feature
▪︎Designer can display the data at any location on the form
• Useful for designing a form like a traditional paper form
• Requires navigation controls that enable the user to scroll backward
and forward through the rows of data
• User can locate the locate the particular row of data based on the
values in row
Subform Forms :
• Subform
▪︎A datasheet (or tabular form) embedded on the main form
• Displays the data from two tables that have a one-to-many
relationship
• Subform contents are linked to the main form through a common
column
• Subforms can be
▪︎Independent
▪︎Separate box on the main form
▪︎Nested Each subform lies inside another
Switchboard Forms :
• Provides overall structure of an application
• Directs the user to other form and report in the application
• Contains image and reflect the style of the company
• Pictures can be inserted as the background images
• Individual controls can be used as buttons to open another form
• Important Features
▪︎Command Button
▪︎When a user selects the button, the corresponding
form or report is opened
▪︎Form should match the user's task
Types of Report :
• Tabular and level report
It is basically means printing column of data like output of query in
tabular reports, data are presented in tabular forms .Example grade
sheets of all students.
• Group and subtotal Report
The most common types of report is based on groups and compute,
subtotals common example may be printing receipt or a bills.
• Graphs
Graphs on reports are similar to graphs on forms. Graphs gives
comparison of different record. Example of graph may be pi-chart, bar-
chart, etc.
Data retrieval :
• Three types of data retrieval
▪︎Read the entire table
▪︎Read the next row in a sequence
▪︎Find and retrieve an arbitrary row
• Data Integrity
Data integrity means that the data is accurate and consistent in the
database. Data Integrity is very important as there are multiple
databases in a DBMS. All of these databases contain data that is visible
to multiple users. So it is necessary to ensure that the data is correct
and consistent in all the databases and for all the users.
• Data Security
Data Security is vital concept in a database. Only authorised users
should be allowed to access the database and their identity should be
authenticated using a username and password. Unauthorised users
should not be allowed to access the database under any circumstances
as it violates the integrity constraints.
• Privacy
The privacy rule in a database means only the authorized users can
access a database according to its privacy constraints. There are levels
of database access and a user can only view the data he is allowed to.
For example - In social networking sites, access constraints are different
for different accounts a user may want to access.
• Data Consistency
Data consistency is ensured in a database because there is no data
redundancy. All data appears consistently across the database and the
data is same for all the users viewing the database. Moreover, any
changes made to the database are immediately reflected to all the
users and there is no data inconsistency.
Basic Types :
• Business Events
▪︎Events that trigger some function
Example : Sale triggering a reduction in inventory.
• Alert Events
▪︎Events that signal some alert on data changes
Example : An inventory that drops below a preset level which triggers a
new purchase order
Syntax:
SELECT column_name, function_name(column_name)
FROM table_name
WHERE condition
GROUP BY column_name
ORDER BY column1, column2;
Example :
Student
103 Elakkiyaa IT 76
104 Esther CSE 87
105 Kavin It 79
Department Count
IT 2
ECE 1
CSE 2
HAVING Clause :
The HAVING clause is used to filter the records returned by GROUP BY
statement.
Syntax :
SELECT column_name, aggregate function(column_name)
FROM table_name
[WHERE condition]
GROUP BY column_name
HAVING condition;
Example :
Student
103 Elakkiyaa IT 76
105 Kavin It 79
Department Count
IT 2
CSE 2
Example :
Consider the following two tables
STUDENT
Roll Sname Departmen Address Mark
t
101 Elak IT Chennai 87
102 Srinu ECE Madurai 67
103 Sanju EEE Chennai 91
104 Kavin CSE Trichy 56
105 Geetha ECE Madurai 69
106 Sudha IT Trichy 84
107 Yamini CsE Theni 65
FACULTY
Faculty_ID S_ID Faculty_Name
F02 105 Keerthi
F00 103 Manju
F01 102 Sangeetha
F03 104 Sagana
Display the Student name of the faculty whose name starts with M
SQL >
SELECT *FROM STUDENT
WHERE Roll = ( SELECT S_ID from FACULTY WHERE Faculty _Name
LIKE'M%’);
103 Sanju EEE Chennai 91
• Tabular Forms :
One of the simplest forms is the tabular forms, which displays the
columns and rows from a table or query. It can be used as a sub form
and is rarely used as a stand-alone form. Microsoft Access provides an
even simpler version of form called a datasheet.
• Subform Forms :
A subform is usually a datasheet (or tabular form) embedded on the
main form. A subform generally shows a one-to-many relationship.
• Switchboard :
It provides overall structure of an application. It directs the user to
other form & report in the application. It often contains image and
reflect the style of the company.
• Inline Table valued Functions : This function returns a table data type
based on a single SELECT Statement
Syntax of User Defined Functions in SQL Server
RETURNS Data_Type
AS
BEGIN
-- Function Body
RETURN Data
END
• Within the Database, you can create the function once, and call
it n number of times.
Nov 2018
13.) Components of Database Management System ((5)Nov 2018,
(10)20)
• Database Engine
• Data Dictionary
• Query Processor
• Report Writer
• Forms Generator
• ApplicationGenerator
• Communication and Integration
• Security
Database Engine :
• Heart of DBMS
• Responsible for
▪︎Storing
▪︎Retrieving
▪︎Updating the data
• Responsible for enforcing business rules regarding the data
• Stand-alone component that can be purchased and used as an
independent software module
Data Dictionary :
• Holds the definition of all the data tables
• Tasks
▪︎Describes the type of data that is being stored
▪︎Allows the DBMS to keep track of the data
▪︎Helps developers and users find the data they need
Query Processor :
• Enables developers and users to store and retrieve data
• Only connection on the database
• Most of the transaction runs through query processor
• Quires are derived from questions, user questions
Report writer :
• Report : Used to explore summaries of the data in some types of
reports •
• Report writer : Enables you to produce a complex report in a short
time
• To run a Report
▪︎Database engine, data dictionary query processor and
report writer are needed
Forms Generater :
• Helps the developer to create input forms
Basic Types :
• Business Events
▪︎Events that trigger some function
Example : Sale triggering a reduction in inventory.
• Alert Events
▪︎Events that signal some alert on data changes
Example : An inventory that drops below a preset level which triggers a
new purchase order
15.) How can create, modify and query tables using SQL
• CREATE TABLE :
The CREATE TABLE statement is used to create a new table in a
database
Syntax
create table table_name (
column1 datatype,
column2 datatype,
column3 datatype,
....
);
Example :
create table Grocery (
Items varchar(25),
Quantity number (5),
MRP number(5),
Total number(10));
• MODIFY TABLE :
ALTER TABLE command is used to add, delete or modify columns in an
existing table. We should also use the ALTER TABLE command to add
and drop various constraints on an existing table.
Sequential Storage :
• Store records into tables in the sequential orderbased on the primary
key values of each records
Uses :
• Useful when data is always retrieved in a fixed order
• Useful when the file contains a lot of common date
• Backup or transporting data to different system.
Advantage :
• Ease of access to the next record
• Fast and efficient search when there is large volumes of data
Disadvantage :
• Inefficient for random access
• Difficult to maintain
Indexes :
• Common indexing mechanism used to speed up access to desired
data
• An Index file consists of records (called index entries) of the form
• Linked lists
• B+ -Tree
Direct or Hashed :
• Hash function is used to calculate the address of the block to store
the records
• Hash function can be any simple or comples mathematical funstion .
• If the hash function is generated on key column, then that column is
callod hash key
• If hash function is generated on non-key column, then the column is
hash colum
Advantage :
• Extremely fast for finding and storing random data
• No space overbead as index method
Disadvantage :
• No provision for sequential retrieval of data
• Method set aside storage space for the data
• Inline Table valued Functions : This function returns a table data type
based on a single SELECT Statement
Syntax of User Defined Functions in SQL Server
RETURNS Data_Type
AS
BEGIN
-- Function Body
RETURN Data
END
Privacy issues :
• Nowadays all the networks are becoming more and more open to
outsiders. So the information may be duplicated and it is losing the
security and privacy.
• Many IT experts suggested adding a few more security levels or layers
to the existing security system. But they all failed in doing so.
• Not all the organizations are using the database encryption because
they need to face some challenges while using the database encryption.
• In the process of encryption, there may be a need to use the key and
this process is called the Encryption Key Management.
Nov 2019
13.) Data types in Dbms (Nov 2016,17,19)
Numerical Data type
• int - It is used to specify an integer value.
• smallint - It is used to specify small integer value.
• bit - It has the number of bits to store.
• decimal - It specifies a numeric value that can have a decimal number.
• numeric - It is used to specify a numeric value.
14.) Events
Events :
Events are actions that are dependent on time. It is important in
building a system and can involve complicated interactions.
Basic Types :
• Business Events
▪︎Events that trigger some function
Example : Sale triggering a reduction in inventory.
• Alert Events
▪︎Events that signal some alert on data changes
Example : An inventory that drops below a preset level which triggers a
new purchase order
Example :
Student
103 Elakkiyaa IT 76
105 Kavin It 79
Department Count
IT 2
ECE 1
CSE 2
16.)Testing queries
Steps to build Quality Queries
• Break complex queries (subquery) into smaller pieces
• Examine and Test each subquery
• Check the SQL
• Look at the data
• Check Computations
• Tabular Forms :-
One of the simplest forms is the tabular forms, which displays the
columns and rows from a table or query. It can be used as a sub form
and is rarely used as a stand-alone form. Microsoft Access provides an
even simpler version of form called a datasheet.
• Subform Forms :-
A subform is usually a datasheet (or tabular form) embedded on the
main form. A subform generally shows a one-to-many relationship.
• Switchboard :-
It provides overall structure of an application. It directs the user to
other form & report in the application. It often contains image and
reflect the style of the company.
18.) Transactions
Transactions :
A transaction is defined as a set of changes that must all be made
together
Example :
Consider the following example
• The code to create this transaction will require two update to the
database
Solution
• Mark the start and end of the transaction inside your code
• When the computer sees the starting mark, first write the changes to
a log file
• When it reaches the end mark, makes the actual changes to the data
tables
• If something goes wrong before the changes are complete
▪︎when the DBMS restarts, it examines the log file and
complete the incomplete transactions
19.) Advantages of Distributed database
(Nov 2017,19)
• In a distributed database, data can be stored in different systems like
personal computers, servers, mainframes, etc.
• A user doesn’t know where the data is located physically. Database
presents the data to the user as if it were located locally.
• Database can be accessed over different networks.
• Data can be joined and updated from different tables which are
located on different machines.
• Even if a system fails the integrity of the distributed database is
maintained.
• A distributed database is secure.
• Faster data access. End users often work with only a locally stored
subset of the company’s data.
• Faster data processing. A distributed database system spreads out the
systems workload by processing data at several sites.
• Growth facilitation. New sites can be added to the network without
affecting the operations of other sites.
Nov 2020
13.) Discuss the advantages of DBMS. (Nov 2017, 20)
A Database Management System (DBMS) is software designed to store,
retrieve, define, and manage data in a database.
• Data Integrity
Data integrity means that the data is accurate and consistent in the
database. Data Integrity is very important as there are multiple
databases in a DBMS. All of these databases contain data that is visible
to multiple users. So it is necessary to ensure that the data is correct
and consistent in all the databases and for all the users.
• Data Security
Data Security is vital concept in a database. Only authorised users
should be allowed to access the database and their identity should be
authenticated using a username and password. Unauthorised users
should not be allowed to access the database under any circumstances
as it violates the integrity constraints.
• Privacy
The privacy rule in a database means only the authorized users can
access a database according to its privacy constraints. There are levels
of database access and a user can only view the data he is allowed to.
For example - In social networking sites, access constraints are different
for different accounts a user may want to access.
• Backup and Recovery
Database Management System automatically takes care of backup and
recovery. The users don't need to backup data periodically because this
is taken care of by the DBMS. Moreover, it also restores the database
after a crash or system failure to its previous condition.
• Data Consistency
Data consistency is ensured in a database because there is no data
redundancy. All data appears consistently across the database and the
data is same for all the users viewing the database. Moreover, any
changes made to the database are immediately reflected to all the
users and there is no data inconsistency.
Example :
ID Name Courses
-----------------------------------
1 A c1, c2
2 E c3
3 M c2, c3
Example :
TEACHER table
To convert the given table into 2NF, we decompose it into two tables:
TEACHER_DETAIL table :
TEACHER_SUBJECT table :
15.) Discuss the benefits of WHERE Clause.
The WHERE clause is used to filter records.
Types of JOINS :
• (INNER) JOIN
• LEFT (OUTER) JOIN
• RIGHT (OUTER) JOIN
• FULL (OUTER) JOIN
STUDENT
Roll Sname Departmen Address Mark
t
101 Elak IT Chennai 75
102 Srinu ECE Madurai 89
103 Eyuva EEE Chennai 67
104 Sanju CSE Trichy 50
105 Kavin ECE Madurai 86
106 Charan IT Trichy 95
107 Ashok CSE Theni 55
FACULTY
Faculty_ID S_ID Faculty_Name
F02 103 Keerthi
F00 103 Manju
F01 102 Sangeetha
F03 104 Sagana
INNER JOIN :
The INNER JOIN keyword returns records that have matching values
in both tables.
Syntax :
SELECT column_names
FROM table_name1 INNER JOIN table_name2
ON column_name1= column_name2
WHERE condition
Example :
Join the above two tables using the INNER JOIN as follows
SQL>
SELECT Roll, SName, Mark, Faculty_Name
FROM Student INNER JOIN Faculty
ON Student.Roll = Faculty.S_ID;
Syntax :
SELECT column_names
FROM table_name1 LEFT JOIN table_name2
ON column_name1 = column_name2
WHERE condition
Example :
Join the above two tables using the INNER JOIN as follows
SQL>
SELECT Roll, SName, Mark, Faculty_Name
FROM Student LEFT JOIN Faculty
ON Student.Roll = Faculty.S_ID;
Syntax :
SELECT column_names
FROM table_name1 RIGHT JOIN table_name2
ON column_name1 = column_name2
WHERE condition
Example :
Join the above two tables using the INNER JOIN as follows
SQL>
SELECT Roll, SName, Mark, Faculty_Name
FROM Student RIGHT JOIN Faculty
ON Student.Roll = Faculty.S_ID;
Syntax :
SELECT column_names
FROM table_name1 FULL JOIN table_name2
ON column_name1 = column_name2
WHERE condition
Example :
Join the above two tables using the INNER JOIN as follows
SQL>
SELECT Roll, SName, Mark, Faculty_Name
FROM Student INNER JOIN Faculty
ON Student.Roll = Faculty.S_ID;
• Deleting Data
DELETE command is used
Example :
ID Name Courses
-----------------------------------
1 A c1, c2
2 E c3
3 M c2, c3
Example :
TEACHER table
To convert the given table into 2NF, we decompose it into two tables:
TEACHER_DETAIL table :
TEACHER_SUBJECT table :
Third normal form :
A table is said to be 3NF if both the following conditions hold :
Table must be in 2NF
Eliminate Transitive functional dependency of non-prime
attribute on any super key
3NF is used to reduce the data duplication. It is also used to
achieve the data integrity.
Example :
EMPLOYEE_DETAIL table :
EMPLOYEE table :
EMPLOYEE_ZIP table :
21.) DML and DDL commands with example
Example :
create table Grocery (
Items varchar(25),
Quantity number (5),
MRP number(5),
Total number(10));
--DELETE
Delete from Grocery where Quantity=1 And MRP>=100;
--UPDATE
update Grocery set Quantity=2, Total=120 where Items='Atta';
DROP : It is used to delete both the structure and record stored in the
table.
TRUNCATE : It is used to delete all the rows from the table and free the
space containing the table.
--CREATE
create table Grocery (
Items varchar(25),
Quantity number (5),
MRP number(5),
Total number(10));
Insert into Grocery values ('Sugar', 2, 50, 100);
Insert into Grocery values ('Atta', 1, 60, 60);
Insert into Grocery values ('Almond', 2, 190, 380);
Insert into Grocery values ('Cashew', 1, 240, 240);
--ALTER
Alter Table Grocery add Tax number
--TRUNCATE
Truncate table Grocery
--DROP
Drop table Grocery
--RENAME
RENAME Grocery To Grocery_List;
• Key to programming
▪︎Understand the logic
▪︎Purpose of the key elements
• Programming reduces to two components
▪︎Represent the structure of the program and use of the
programming elements to solve the underlying problem
Syntax :
Represent the specific commands and features in a programming
language
Features :
• Databases in the collection are logically interrelated with each other.
Often they represent a single logical database.
• Data is physically stored across multiple sites. Data in each site can be
managed by a DBMS independent of the other sites.
• The processors in the sites are connected via a network. They do not
have any multiprocessor configuration.
Nov 2017
20.)Data types with example (Nov 2016,17,19)
Numerical Data type
• int - It is used to specify an integer value.
• smallint - It is used to specify small integer value.
• bit - It has the number of bits to store.
• decimal - It specifies a numeric value that can have a decimal number.
• numeric - It is used to specify a numeric value.
Types of Report
• Tabular and level report :
It is basically means printing column of data like output of query in
tabular reports, data are presented in tabular forms .
Example : Grade sheet of all students
• Group and subtotal Report :
The most common types of report is based on groups and compute,
subtotals.
Example : Printing a receipt or a Bill
• Graphs :
Graphs on reports are similar to graphs on forms. Graphs gives
comparison of different record.
Example : Pi-chart, bar-chart.
Form Layout :-
Individual forms or windows are your primary means of communication
with people who use your application. Forms are used to collect data,
display results and organize the overall system. Several standard
layouts are provided by the DBMS to simplify the development of many
common forms. Normally we will be working with four basic types of
form.
• Tabular Forms :-
One of the simplest forms is the tabular forms, which displays the
columns and rows from a table or query. It can be used as a sub form
and is rarely used as a stand-alone form. Microsoft Access provides an
even simpler version of form called a datasheet.
• Switchboard :-
It provides overall structure of an application. It directs the user to
other form & report in the application. It often contains image and
reflect the style of the company.
Report :
Several issue are involve in designing report as in the development of
form, you and users need to determine the content and layout of
reports. Issues in designing report are:
a. Report usage and user need.
b. Report layout choice like tabular, subgroup, chart, etc.
c. Paper size
d. How often it is generated.
e. Even that triggers report.
f. How large is the report.
g. Colors
h. Security control, etc.
Types of Report
• Tabular and level report :
It is basically means printing column of data like output of query in
tabular reports, data are presented in tabular forms .
Example : Grade sheet of all students
• Group and subtotal Report :
The most common types of report is based on groups and compute,
subtotals.
Example : Printing a receipt or a Bill
• Graphs :
Graphs on reports are similar to graphs on forms. Graphs gives
comparison of different record.
Example : Pi-chart, bar-chart.
Advantages
• Centralization
Centralized control such as Access rights and resource allocation is
done by Servers
• Proper Management
All the files are stored at the same place
▪︎File management becomes easy
• Upgradation
Changes can be made easily by just upgrading the server
• Scalability
New resources and systems can be added by making necessary changes
in server
Nov 2018
20.) 1st, 2nd and 3rd normal form with example (Nov 2016,18)
First normal form :
• There are only Single Valued Attributes.
• Attribute Domain does not change.
• There is a unique name for every Attribute/Column.
• The order in which data is stored does not matter.
Example :
ID Name Courses
-----------------------------------
1 A c1, c2
2 E c3
3 M c2, c3
Example :
TEACHER table
To convert the given table into 2NF, we decompose it into two tables:
TEACHER_DETAIL table :
TEACHER_SUBJECT table :
Third normal form :
• A relation will be in 3NF if it is in 2NF and not contain any transitive
partial dependency.
• 3NF is used to reduce the data duplication. It is also used to achieve
the data integrity.
• If there is no transitive dependency for non-prime attributes, then the
relation must be in third normal form.
Example :
EMPLOYEE_DETAIL table :
EMPLOYEE table :
EMPLOYEE_ZIP table :
21.) Data manipulation commands (Nov 2016,18,19)
Example :
create table Grocery (
Items varchar(25),
Quantity number (5),
MRP number(5),
Total number(10));
--UPDATE
update Grocery set Quantity=2, Total=120 where Items='Atta';
Form Layout :-
Individual forms or windows are your primary means of communication
with people who use your application. Forms are used to collect data,
display results and organize the overall system. Several standard
layouts are provided by the DBMS to simplify the development of many
common forms. Normally we will be working with four basic types of
form.
• Tabular Forms :-
One of the simplest forms is the tabular forms, which displays the
columns and rows from a table or query. It can be used as a sub form
and is rarely used as a stand-alone form. Microsoft Access provides an
even simpler version of form called a datasheet.
• Subform Forms :-
A subform is usually a datasheet (or tabular form) embedded on the
main form. A subform generally shows a one-to-many relationship.
• Switchboard :-
It provides overall structure of an application. It directs the user to
other form & report in the application. It often contains image and
reflect the style of the company.
Report :
Several issue are involve in designing report as in the development of
form, you and users need to determine the content and layout of
reports. Issues in designing report are:
a. Report usage and user need.
b. Report layout choice like tabular, subgroup, chart, etc.
c. Paper size
d. How often it is generated.
e. Even that triggers report.
f. How large is the report.
g. Colors
h. Security control, etc.
Types of Report
• Tabular and level report :
It is basically means printing column of data like output of query in
tabular reports, data are presented in tabular forms .Example grade
sheets of all students.
• Graphs :
Graphs on reports are similar to graphs on forms. Graphs gives
comparison of different record. Example of graph may be pi-chart, bar-
chart, etc.
Types of Report
• Tabular and level report :
It is basically means printing column of data like output of query in
tabular reports, data are presented in tabular forms .
Example : Grade sheet of all students
• Group and subtotal Report :
The most common types of report is based on groups and compute,
subtotals.
Example : Printing a receipt or a Bill
• Graphs :
Graphs on reports are similar to graphs on forms. Graphs gives
comparison of different record.
Example : Pi-chart, bar-chart.
Advantages
• Centralization
Centralized control such as Access rights and resource allocation is
done by Servers
• Proper Management
All the files are stored at the same place
▪︎File management becomes easy
• Upgradation
Changes can be made easily by just upgrading the server
• Scalability
New resources and systems can be added by making necessary changes
in server
Nov 2019
20.) Third & Fourth normal form with example
Example :
EMPLOYEE_DETAIL table :
EMPLOYEE table :
EMPLOYEE_ZIP table :
Fourth normal form (4NF) :
The given STUDENT table is in 3NF, but the COURSE and HOBBY are
two independent entity. Hence, there is no relationship between
COURSE and HOBBY.
So to make the above table into 4NF, we can decompose it into two
tables:
STUDENT_COURSE
STUDENT_HOBBY
21.) Data manipulation commands (Nov 2016,18,19)
Example :
create table Grocery (
Items varchar(25),
Quantity number (5),
MRP number(5),
Total number(10));
--DELETE
Delete from Grocery where Quantity=1 And MRP>=100;
--UPDATE
update Grocery set Quantity=2, Total=120 where Items='Atta';
Error Handling :
Error handling routines can become quite sophisticated. Error handling
is controlled with two primary functions
• ON ERROR statement
• RESUME
On Error Statement :
The On Error statement tells access where to go if an error occurs
Resume Statement :
The Resume statement has three primary options
• Resume
▪︎Tells access to go back and try to re-execute the line that
generated the error
• Resume Label
▪︎A jump command that redirects the computer to a specific
location
• Resume Next
▪︎Instructs the computer to skip to the line immediately
following the one that generated the error.
Advantages :
• Fault telerance : Because there is more than one server or instance
for users to connect to clustering offers an alternative, in the event of
individual server failure
• Load balancing : The clustering feature is usually set up to allow users
to be automatically allocated to the server with the least load
Data Partitioning :
Data Partitioning is the database process where very large tables are
divided into multiple smaller parts.
Goal :
• Easy maintenance of large tables
• Reduce the overall response time to read and load data for particular
SQL operationm
▪︎Query that access the data run faster
Types :
• Horizontal partitioning
• Vertical partitioning
24.) Three-Tier Client/Server model
• The 3-Tier architecture contains another layer between the client and
server. In this architecture, client can't directly communicate with the
server.
• The application on the client-end interacts with an application server
which further communicates with the database system.
• End user has no idea about the existence A relation will be in 3NF if it
is in 2NF and not contain any transitive partial dependency.
Nov 2020
20.) Explain the components of a Database
Management System. ((5)Nov 2018,(10)20)
• Database Engine
• Data Dictionary
• Query Processor
• Report Writer
• Forms Generator
• ApplicationGenerator
• Communication and Integration
• Security
Database Engine :
• Heart of DBMS
• Responsible for
▪︎Storing
▪︎Retrieving
▪︎Updating the data
• Responsible for enforcing business rules regarding the data
• Stand-alone component that can be purchased and used as an
independent software module
Data Dictionary :
• Holds the definition of all the data tables
• Tasks
▪︎Describes the type of data that is being stored
▪︎Allows the DBMS to keep track of the data
▪︎Helps developers and users find the data they need
Query Processor :
• Enables developers and users to store and retrieve data
• Only connection on the database
• Most of the transaction runs through query processor
• Quires are derived from questions, user questions
Report writer :
• Report : Used to explore summaries of the data in some types of
reports •
• Report writer : Enables you to produce a complex report in a short
time
• To run a Report
▪︎Database engine, data dictionary query processor and
report writer are needed
Forms Generater :
• Helps the developer to create input forms
Types of JOINS :
• (INNER) JOIN
• LEFT (OUTER) JOIN
• RIGHT (OUTER) JOIN
• FULL (OUTER) JOIN
STUDENT
Roll Sname Departmen Address Mark
t
101 Elak IT Chennai 75
102 Srinu ECE Madurai 89
103 Eyuva EEE Chennai 67
104 Sanju CSE Trichy 50
105 Kavin ECE Madurai 86
106 Charan IT Trichy 95
107 Ashok CSE Theni 55
FACULTY
Faculty_ID S_ID Faculty_Name
F02 103 Keerthi
F00 103 Manju
F01 102 Sangeetha
F03 104 Sagana
INNER JOIN :
The INNER JOIN keyword returns records that have matching values
in both tables.
Syntax :
SELECT column_names
FROM table_name1 INNER JOIN table_name2
ON column_name1= column_name2
WHERE condition
Example :
Join the above two tables using the INNER JOIN as follows
SQL>
SELECT Roll, SName, Mark, Faculty_Name
FROM Student INNER JOIN Faculty
ON Student.Roll = Faculty.S_ID;
Syntax :
SELECT column_names
FROM table_name1 LEFT JOIN table_name2
ON column_name1 = column_name2
WHERE condition
Example :
Join the above two tables using the INNER JOIN as follows
SQL>
SELECT Roll, SName, Mark, Faculty_Name
FROM Student LEFT JOIN Faculty
ON Student.Roll = Faculty.S_ID;
Syntax :
SELECT column_names
FROM table_name1 RIGHT JOIN table_name2
ON column_name1 = column_name2
WHERE condition
Example :
Join the above two tables using the INNER JOIN as follows
SQL>
SELECT Roll, SName, Mark, Faculty_Name
FROM Student RIGHT JOIN Faculty
ON Student.Roll = Faculty.S_ID;
Example :
Join the above two tables using the INNER JOIN as follows
SQL>
SELECT Roll, SName, Mark, Faculty_Name
FROM Student INNER JOIN Faculty
ON Student.Roll = Faculty.S_ID;
Sequential Storage :
• Store records into tables in the sequential orderbased on the primary
key values of each records
Uses :
• Useful when data is always retrieved in a fixed order
• Useful when the file contains a lot of common date
• Backup or transporting data to different system.
Advantage :
• Ease of access to the next record
• Fast and efficient search when there is large volumes of data
Disadvantage :
• Inefficient for random access
• Difficult to maintain
Indexes :
• Common indexing mechanism used to speed up access to desired
data
• An Index file consists of records (called index entries) of the form
• Linked lists
• B+ -Tree
Direct or Hashed :
• Hash function is used to calculate the address of the block to store
the records
• Hash function can be any simple or comples mathematical funstion .
• If the hash function is generated on key column, then that column is
callod hash key
• If hash function is generated on non-key column, then the column is
hash colum
Advantage :
• Extremely fast for finding and storing random data
• No space overbead as index method
Disadvantage :
• No provision for sequential retrieval of data
• Method set aside storage space for the data
Important Questions
Unit - 1
1.) Components of DBMS :
Database Engine
• Data Dictionary
• Query Processor
• Report Writer
• Forms Generator
• ApplicationGenerator
• Communication and Integration
• Security
Database Engine :
• Heart of DBMS
• Responsible for
▪︎Storing
▪︎Retrieving
▪︎Updating the data
• Responsible for enforcing business rules regarding the data
• Stand-alone component that can be purchased and used as an
independent software module
Data Dictionary :
• Holds the definition of all the data tables
• Tasks
▪︎Describes the type of data that is being stored
▪︎Allows the DBMS to keep track of the data
▪︎Helps developers and users find the data they need
Query Processor :
• Enables developers and users to store and retrieve data
• Only connection on the database
• Most of the transaction runs through query processor
• Quires are derived from questions, user questions
Report writer :
• Report : Used to explore summaries of the data in some types of
reports •
• Report writer : Enables you to produce a complex report in a short
time
• To run a Report
▪︎Database engine, data dictionary query processor and
report writer are needed
Forms Generater :
• Helps the developer to create input forms
Unit - 2
--DELETE
Delete from Grocery where Quantity=1 And MRP>=100;
--UPDATE
update Grocery set Quantity=2, Total=120 where Items='Atta';
DROP : It is used to delete both the structure and record stored in the
table.
ALTER : It is used to alter the structure of the database.
TRUNCATE : It is used to delete all the rows from the table and free the
space containing the table.
--CREATE
create table Grocery (
Items varchar(25),
Quantity number (5),
MRP number(5),
Total number(10));
--ALTER
Alter Table Grocery add Tax number
--TRUNCATE
Truncate table Grocery
--DROP
Drop table Grocery
--RENAME
RENAME Grocery To Grocery_List;
Unit - 3
7.) Effective designs of forms and reports
Introduction to Form and Report :
Forms and reports are an important part of
the database application. Designer use them to create an integrated
application, making it easier for user to perform their task. Decision
maker and clerical workers use from and report on a daily basis.
Normally forms were used as input and report were used to display
result. Now a day forms are also used to display result, Basic use of
forms are:
• Collect data
• Display query data
• Display analysis and computation result
• Switch board
• Direct manipulation of object like Graphics
Form Layout :-
Individual forms or windows are your primary means of communication
with people who use your application. Forms are used to collect data,
display results and organize the overall system. Several standard
layouts are provided by the DBMS to simplify the development of many
common forms. Normally we will be working with four basic types of
form.
• Tabular Forms :-
One of the simplest forms is the tabular forms, which displays the
columns and rows from a table or query. It can be used as a sub form
and is rarely used as a stand-alone form. Microsoft Access provides an
even simpler version of form called a datasheet.
• Subform Forms :-
A subform is usually a datasheet (or tabular form) embedded on the
main form. A subform generally shows a one-to-many relationship.
• Switchboard :-
It provides overall structure of an application. It directs the user to
other form & report in the application. It often contains image and
reflect the style of the company.
Report :
Several issue are involve in designing report as in the development of
form, you and users need to determine the content and layout of
reports. Issues in designing report are:
a. Report usage and user need.
b. Report layout choice like tabular, subgroup, chart, etc.
c. Paper size
d. How often it is generated.
e. Even that triggers report.
f. How large is the report.
g. Colors
h. Security control, etc.
Types of Report
• Tabular and level report :
It is basically means printing column of data like output of query in
tabular reports, data are presented in tabular forms .Example grade
sheets of all students.
• Graphs :
Graphs on reports are similar to graphs on forms. Graphs gives
comparison of different record. Example of graph may be pi-chart, bar-
chart, etc.
• Tabular Forms :
One of the simplest forms is the tabular forms, which displays the
columns and rows from a table or query. It can be used as a sub form
and is rarely used as a stand-alone form. Microsoft Access provides an
even simpler version of form called a datasheet.
• Subform Forms :
A subform is usually a datasheet (or tabular form) embedded on the
main form. A subform generally shows a one-to-many relationship.
• Switchboard :
It provides overall structure of an application. It directs the user to
other form & report in the application. It often contains image and
reflect the style of the company.
• Key to programming
▪︎Understand the logic
▪︎Purpose of the key elements
• Programming reduces to two components
▪︎Represent the structure of the program and use of the
programming elements to solve the underlying problem
Syntax :
Represent the specific commands and features in a programming
language
• Deleting Data
DELETE command is used
Unit - 4
11.) Data storage methods
Three primary methods to store data tables
• Sequential Storage
• Indexes
• Direct or Hashed
Sequential Storage :
• Store records into tables in the sequential orderbased on the primary
key values of each records
Uses :
• Useful when data is always retrieved in a fixed order
• Useful when the file contains a lot of common date
• Backup or transporting data to different system.
Advantage :
• Ease of access to the next record
• Fast and efficient search when there is large volumes of data
Disadvantage :
• Inefficient for random access
• Difficult to maintain
Indexes :
• Common indexing mechanism used to speed up access to desired
data
• An Index file consists of records (called index entries) of the form
• Linked lists
• B+ -Tree
Direct or Hashed :
• Hash function is used to calculate the address of the block to store
the records
• Hash function can be any simple or comples mathematical funstion .
• If the hash function is generated on key column, then that column is
callod hash key
• If hash function is generated on non-key column, then the column is
hash colum
Advantage :
• Extremely fast for finding and storing random data
• No space overbead as index method
Disadvantage :
• No provision for sequential retrieval of data
• Method set aside storage space for the data
Unit - 5
12.) Database administration
13.) Backup and Recovery
• DBMS takes a snapshot of the tables
▪︎Snapshot represents the status of a table at one instant in time
Features :
• Databases in the collection are logically interrelated with each other.
Often they represent a single logical database.
• Data is physically stored across multiple sites. Data in each site can be
managed by a DBMS independent of the other sites.
• The processors in the sites are connected via a network. They do not
have any multiprocessor configuration.
• A distributed database is not a loosely connected file system.
• Centralization
Centralized control such as Access rights and resource allocation is
done by Servers
• Proper Management
All the files are stored at the same place
▪︎File management becomes easy
• Scalability
New resources and systems can be added by making necessary changes
in server
(OR)