0% found this document useful (0 votes)
202 views140 pages

DBMS (2m, 5m, 10m)

The document discusses various database concepts including: 1. Class diagrams describe system classes, attributes, methods and relationships between objects. 2. Data dictionaries provide metadata about data elements. 3. SQL is used to store, manipulate and retrieve relational database data. 4. DDL commands like create, drop and alter are used for data definition. 5. Distributed databases are used in applications like social networks and online gaming.

Uploaded by

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

DBMS (2m, 5m, 10m)

The document discusses various database concepts including: 1. Class diagrams describe system classes, attributes, methods and relationships between objects. 2. Data dictionaries provide metadata about data elements. 3. SQL is used to store, manipulate and retrieve relational database data. 4. DDL commands like create, drop and alter are used for data definition. 5. Distributed databases are used in applications like social networks and online gaming.

Uploaded by

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

2marks

Nov 2016
1.) Query processor
The query processor is the subcomponent of the data server that
processes SQL requests. 

2.) Data independence (Nov 2016,20)


The separation of data structure from the application program used to
access it is known as data independence.

3.) List the common costs from introducing a dbms

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.

5.) Class diagram (Nov 2016,19,20)


A class diagram in the Unified Modeling Language (UML) is a type of
static structure diagram that describes the structure of a system by
showing the system's classes, their attributes, operations (or methods),
and the relationships among objects.
6.) Composite key
A primary key having two or more attributes is called composite key. It
is a combination of two or more columns.

7.) ORDER BY clause


ORDER BY clause is used to sort the fetched data in either ascending or
descending according to one or more columns.

8.) What are controls on Forms


• Forms are built using controls, consists of any object placed on the
form

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 .

10.) Roles of DBA


• Install and upgrade DBMS
• Create user accounts and monitor security
• Manage backup and recovery of the database
• Monitor the database performance
• Plan upgrades and additional capacity

(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

11.) What is meant by physical security


Concerned with physically protecting the computing resources and
preparing for physical disasters that damage equipment or data

(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.

12.) What are objects


A database object in a relational database is a data structure used to
either store or reference data. The most common object that people
interact with is the table. Other objects are indexes, stored procedures,
sequences, views and many more.

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.

2.)Data dictionary (Nov 2017,19)


A Data Dictionary is a collection of names, definitions, and attributes
about data elements that are being used or captured in a database,
information system, or part of a research project. A Data Dictionary also
provides metadata about data elements.

3.) Normal forms


• The stage at which a table is organized is known as its normal form (or
a stage of normalization).
• There are three stages of normal forms are known as first normal
form (or 1NF), second normal form (or 2NF), and third normal form (or
3NF).

4.)Attribute (Nov 2017,18)


• An attribute refers to a database component, such as a table. It also
may refer to a database field.
• Attributes describe the instances in the column of a database.

5.) General form of CREATE TABLE command


• 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));

6.) How do you Testing queries

7.)DML (Nov 2017,18)


DML - Data Manipulation Language
 SELECT
 INSERT
 UPDATE
 DELETE
8.) Null value (Nov 2017,18)
NULL is the term used to represent a missing value. A NULL value in a
table is a value in a field that appears to be blank.
A field with a NULL value is a field with no value. It is very important to
understand that a NULL value is different than a zero value or a field
that contains spaces

9.) Super key (Nov 2017,18)


The set of attributes that can uniquely identify a tuple is known as
Super Key.

10.) Entity (Nov 2017,18)


Entity in DBMS can be a real-world object with an existence, For
example, in a College database, the entities can be Professor, Students,
Courses, etc.

11.) Database system applications


• Railway Reservation System
• Airline Reservation System
• Library Management System
• Banking
• Education Sector
• Social Media Sites
• Online Shopping

12.) Use of data privacy (Nov 2019, 20)


 Data Privacy governs how data is collected, shared and used.
 Privacy means up to what extent a user can access the data
Nov 2018
1.) Entity (Nov 2017,18)
Entity in DBMS can be a real-world object with an existence, For
example, in a College database, the entities can be Professor, Students,
Courses, etc.

2.) Class diagram (Nov 2016,19,20)


A class diagram in the Unified Modeling Language (UML) is a type of
static structure diagram that describes the structure of a system by
showing the system's classes, their attributes, operations (or methods),
and the relationships among objects.

3.) Null value (Nov 2017,18)


NULL is the term used to represent a missing value. A NULL value in a
table is a value in a field that appears to be blank.
A field with a NULL value is a field with no value. It is very important to
understand that a NULL value is different than a zero value or a field
that contains spaces

4.) Define Database Management System(DBMS) (Nov 2019)


A Database Management System (DBMS) is software designed to store,
retrieve, define, and manage data in a database.

5.) DML (Nov 2017,18)


DML - Data Manipulation Language
 SELECT
 INSERT
 UPDATE
 DELETE
6.) Super key (Nov 2017,18)
The set of attributes that can uniquely identify a tuple is known as
Super Key.

7.) Foreign key 


A Foreign Key is a database key that is used to link two tables together.

8.) Integrity constraint


• Integrity constraints are a set of rules. It is used to maintain the
quality of information.
• Integrity constraints ensure that the data insertion, updating, and
other processes have to be performed in such a way that data integrity
is not affected.
• Thus, integrity constraint is used to guard against accidental damage
to the database.

9.) Purpose of ALTER TABLE command


• ALTER TABLE command is used to add, modify, or drop/delete
columns in a table.
• ALTER TABLE command is also used to rename a table.

10.) Attribute (Nov 2017,18)


• An attribute refers to a database component, such as a table. It also
may refer to a database field.
• Attributes describe the instances in the column of a database.

11.) Duties of Database Administrators


• Performance Monitoring
• Database Tuning
• Troubleshooting
• Database Backup and Recovery
• Security
• Authentication

12.) Database planning


It is the management activities that permit the stages of the database
system development life cycle to be realized as efficiently and
effectively as possible.

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.

2.) Class diagram (Nov 2016,18,19,20)


A class diagram in the Unified Modeling Language (UML) is a type of
static structure diagram that describes the structure of a system by
showing the system's classes, their attributes, operations (or methods),
and the relationships among objects.

3.) Data dictionary (Nov 2017,19)


A Data Dictionary is a collection of names, definitions, and attributes
about data elements that are being used or captured in a database,
information system, or part of a research project. A Data Dictionary also
provides metadata about data elements.

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

5.) DDL commands (Nov 2019, 20)


DDL - Data Definition Language.
• Create
• Drop
• Alter
• Truncate
• Rename

6.) What are outer joins


Outer join is classified into 3 types:
• Left Outer Join
• Right Outer Join
• Full Outer Join

7.)Tabular forms
Tabular is arranged in a table, with rows and columns. Sports statistics
are usually presented in a tabular format.

8.) Define Internet


The Internet is a vast network that connects computers all over the
world. Through the Internet, people can share information and
communicate from anywhere with an Internet connection.

9.) User interface features


Modern windows-based applications have several user interface
features
• Designed to standardize the look and feel of application
• Make your application relatively easy to use
• Important Three features

1. Menus
2. Toolbars
3. Help system

10.) Distributing applications (Applications of Distrusted database)


Social networks, mobile systems, online banking, and online gaming
(e.g. multiplayer systems) also use efficient distributed systems.
Additional areas of application for distributed computing include e-
learning platforms, artificial intelligence, and e-commerce.

11.)Advantages of object oriented database


• Complex data and a wider variety of data types compared to MySQL
data types.
• Easy to save and retrieve data quickly.
• Seamless integration with object-oriented programming languages.
• Easier to model the advanced real world problems.
• Extensible with custom data types.

12.) Client system


Client Systems means the information technology infrastructure and
networks of Client, whether operated directly by Client or through the
use of Third Party services or resources.
Nov 2020
1.) What is meant by Database Engine?
A database engine (or storage engine) is the underlying software
component that a database management system (DBMS) uses to
create, read, update and delete (CRUD) data from a database.

2.) Write a note on: Data Independence. (Nov 2016,20)


The separation of data structure from the application program used to
access it is known as data independence.

3.) What are Class diagrams? (Nov 2016, 19, 20)


A class diagram in the Unified Modeling Language (UML) is a type of
static structure diagram that describes the structure of a system by
showing the system's classes, their attributes, operations (or methods),
and the relationships among objects.

4.) Define: Integrity


Integrity means that the data is accurate and consistent in the
database. 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.

5.) Write a note on: GROUP by command.

The GROUP BY clause is used to group the result-set by one or more


columns. It is often with aggregate functions.
6.) List all DDL Commands. (Nov 2019, 20)
• Create
• Drop
• Alter
• Truncate
• Rename

7.) Write a note on: Web notes.


The Web-based database management system is one of the essential
parts of DBMS and is used to store web application data. A web-based
Database management system is used to handle those databases that
are having data regarding E-commerce, E-business, blogs, e-mail, and
other online applications.

8.) What are Linked Forms?


Several data forms have links to other data forms that provide a more
specific data entry view. When you access a linked form, the point of
view (POV) from the parent form is carried forward into the linked
form. You do not need to specify the POV for the linked forms.

9.) Write a note on: User Interface.


A database management system (DBMS) interface is a user interface
which allows for the ability to input queries to a database without
using the query language itself.

10.) Define: Reports


Reports are generally used to present summarized data.

Types of Report
 Tabular and level report
 Group and subtotal Report
 Graphs

11.) What are Threats?


It results in corrupted data leading to incorrect decisions.

12.) Define: Data Privacy. (Nov 2017, 20)


 Data Privacy governs how data is collected, shared and used.
 Privacy means up to what extent a user can access the data

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

14.) Data types(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.

Character/String Data type


• char - It has a maximum length of 8000 characters. It contains Fixed-
length non-unicode characters.
• varchar - It has a maximum length of 8000 characters. It contains
variable-length non-unicode characters.
• text - It has a maximum length of 2,147,483,647 characters. It
contains variable-length non-unicode characters.

Date Data type


• date - It is used to store the year, month, and days value.
• time - It is used to store the hour, minute, and second values.
• timestamp - It stores the year, month, day, hour, minute, and the
second value.

Binary Data type


• Binary - It has a maximum length of 8000 bytes. It contains fixed-
length binary data.

• varbinary - It has a maximum length of 8000 bytes. It contains


variable-length binary data.

• image - It has a maximum length of 2,147,483,647 bytes. It contains


variable-length binary data.
15.) Subtotals and GROUP BY clause (Nov 2016,17,18)

The GROUP BY clause is used to group the result-set by one or more


columns. It is often with aggregate functions.

Syntax:
SELECT column_name, function_name(column_name)
FROM table_name
WHERE condition
GROUP BY column_name
ORDER BY column1, column2;

Example :
Student

Roll Stud name Department Mark

101 Sanju CSE 75

102 Srinu ECE 89

103 Elakkiyaa IT 76

104 Esther CSE 87

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

16.) Basic types of forms with example


The Four basic types of forms
• Tabular Forms
• Single-Row or Columnar Forms
• Subform
• Switchboard Forms

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

17.) Basic reports types (Nov 2016,17,18)


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.
• 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.

18.) Table operations


Three major categories of operations affect tables
• Data retrieval
• Data store
• Reorganizing/ Pack the database

Data retrieval :
• Three types of data retrieval
                    ▪︎Read the entire table
                    ▪︎Read the next row in a sequence
                    ▪︎Find and retrieve an arbitrary row

• Critical problem involving lookups


                    ▪︎Any time you build a query, two types of random lookups
come into play
                                ▪︎First joining two table requery the database to
match the values one table with those in a second table
                                 ▪︎Second, any time that is imposed a condition with
the WHERE statement, the DBMS are asked to find rows that match
that conditie

• Query performance is directly related to how fast the database can


perfom lookups and match the data requested.
Data Store :
• Three basic operations involved with storing data
                    ▪︎Inserting a new row
                    ▪︎Deleting a row
                    ▪︎Modifying the data in a row

Reorganize / Pack the database :


• Two basic operations
                    ▪︎Remove deleted rows
                    ▪︎Recover unused space

• Two complication exists


                    ▪︎Take several hours for the command to process large
databases
                    ▪︎Few systems require that all users be logged off the DBMS
before the administrator can run the command

19.) Object-oriented database (Nov 2016,20)


An object-oriented database is a collection of object-oriented
programming and relational database. There are various items which
are created using object-oriented programming languages like C++, Java
which can be stored in relational databases, but object-oriented
databases are well-suited for those items.

An object-oriented database is organized around objects rather than


actions, and data rather than logic. For example, a multimedia record in
a relational database can be a definable data object, as opposed to an
alphanumeric value.
Nov 2017
13.) Advantages of Database Management System (Nov 2017, 20)
A Database Management System (DBMS) is software designed to store,
retrieve, define, and manage data in a database.

Advantages of Database Management System :


• Reducing Data Redundancy
The file based data management systems contained multiple files that
were stored in many different locations in a system or even across
multiple systems. Because of this, there were sometimes multiple
copies of the same file which lead to data redundancy. 
• Sharing of Data :
In a database, the users of the database can share the data among
themselves. There are various levels of authorisation to access the data,
and consequently the data can only be shared based on the correct
authorisation protocols being followed. 
Many remote users can also access the database simultaneously and
share the data between themselves.

• 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.

14.)Basic types of events occur in database environment (Nov


2017,18)
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

• User Interface Events :


                   ▪︎Events that trigger some action Example : User clicking on
an icon to send a purchase order to a supplier

15.) GROUP BY and HAVING clause (Nov 2016,17)


GROUP BY Clause :
The GROUP BY clause is used to group the result-set by one or more
columns. It is often with aggregate functions.

Syntax:
SELECT column_name, function_name(column_name)
FROM table_name
WHERE condition
GROUP BY column_name
ORDER BY column1, column2;

Example :
Student

Roll Stud name Department Mark

101 Sanju CSE 75

102 Srinu ECE 89

103 Elakkiyaa IT 76
104 Esther CSE 87

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

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

Roll Stud name Department Mark

101 Sanju CSE 75

102 Srinu ECE 89

103 Elakkiyaa IT 76

104 Esther CSE 87

105 Kavin It 79

Display the department name having more than or equal to 2


students
SQL> SELECT Dept, count(*) FROM Student
GROUP BY Dept
HAVING COUNT(Id) >=2;

Department Count
IT 2

CSE 2

16.) Explain about concept of subqueries


A subquery is a query within another query. It is also called as an Inner
query or a Nested query.
Syntax :
SELECT column_list FROM table_name
WHERE column_name OPERATOR
( SELECT column_list FROM table_name [ WHERE condition ] );

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

17.) 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.

• Single-Row or Columnar Forms :


A single-row form displays data for one row at a time. The goal is to
display every column. Its greatest feature is that the designer can
display the data at any location on the form. It is useful for designing a
form like a traditional paper form.

• 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.) User defined functions with example (Nov 2017,18).


User Defined Functions : 
SQL Server allows us to create our functions called as user defined
functions in SQL Server. For example, if we want to perform some
complex calculations, then we can place them in a separate function,
and store it in the database. Whenever we need the calculation, we can
call it. There are two types of SQL user defined functions:

• Scalar Function : It is a function that returns a single value. Generally,


we have to define the function body between BEGIN … END block, but
for inline scalar function, you can omit them. We can use any SQL data
type as the return type except text, image, ntext, cursor, and
timestamp.

• Table Valued Functions : It is a user defined function in SQL Server


that returns a table.

• 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

The syntax the SQL Server User defined functions or UDF is

CREATE FUNCTION Function_Name(@Parameter_Name Data_type,

.... @Parameter_Name Data_type

RETURNS Data_Type

AS

BEGIN

-- Function Body

RETURN Data

END

Advantages of User Defined Functions in SQL Server


• User defined functions in SQL Server prevent us from writing the
same logic multiple times.

• Within the Database, you can create the function once, and call
it n number of times.

• SQL user defined functions reduce the compilation time of query by


catching the execution plan and reusing them.

• This user defined functions can help us to separate the complex


calculations from the regular query so that we can understand and
debug the query quicker and better.

• It reduces the network traffic because of its cache plan

• SQL Server Functions also used in WHERE Clause as well. By this, we


can limit the number of rows sent to the client.

19.) Advantages of Distrusted 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 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

14.) Basic types of events occur in database environment (Nov


2017,18)
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

• User Interface Events :


                   ▪︎Events that trigger some action Example : User clicking on
an icon to send a purchase order to a supplier

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.

Alter command is used to Alter the structure of the database.


Syntax
ALTER TABLE table_name ADD column_name datatype;

The basic syntax of an ALTER TABLE command to add a New Column in


an existing table.

16.) Aggregate function (Nov 2017,18)


The following are the most commonly used SQL aggregate functions:

• AVG() – calculates the average of a set of values.


Syntax :
SELECT AVG(column_name)
FROM table_name
WHERE condition;

• COUNT() – counts rows in a specified table or view.


Syntax :
SELECT COUNT(column_name)
FROM table_name
WHERE condition;

• MIN – gets the minimum value in a set of values.


Syntax :
SELECT MIN(column_name)
FROM table_name
WHERE condition;

• MAX() – gets the maximum value in a set of values.


Syntax :
SELECT MAX(column_name)
FROM table_name
WHERE condition;

• SUM() – calculates the sum of values.


Syntax :
SELECT SUM(column_name)
FROM table_name
WHERE condition;

17.) Data storage methods : ((5)Nov 2018,(10)20)


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

18.) User defined functions with example (Nov 2017,18).


User Defined Functions : 
SQL Server allows us to create our functions called as user defined
functions in SQL Server. For example, if we want to perform some
complex calculations, then we can place them in a separate function,
and store it in the database. Whenever we need the calculation, we can
call it. There are two types of SQL user defined functions:

• Scalar Function : It is a function that returns a single value. Generally,


we have to define the function body between BEGIN … END block, but
for inline scalar function, you can omit them. We can use any SQL data
type as the return type except text, image, ntext, cursor, and
timestamp.
• Table Valued Functions : It is a user defined function in SQL Server
that returns a table.

• 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

The syntax the SQL Server User defined functions or UDF is

CREATE FUNCTION Function_Name(@Parameter_Name Data_type,

.... @Parameter_Name Data_type

RETURNS Data_Type

AS

BEGIN

-- Function Body

RETURN Data

END

Advantages of User Defined Functions in SQL Server


• User defined functions in SQL Server prevent us from writing the
same logic multiple times.
• Within the Database, you can create the function once, and call
it n number of times.

• SQL user defined functions reduce the compilation time of query by


catching the execution plan and reusing them.

• This user defined functions can help us to separate the complex


calculations from the regular query so that we can understand and
debug the query quicker and better.

• It reduces the network traffic because of its cache plan

• SQL Server Functions also used in WHERE Clause as well. By this, we


can limit the number of rows sent to the client.

19.) Security and privacy issues in database


Security issues :
• Stolen database backups
• Data leaks
• Broken databases
• SQL injections
• Database inconsistencies

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.

• As per the database security, the encryption secures or protects the


data which is there in the database. Even if there occurs a data breach
then also the data will remain constant with no loss of data anymore.

• 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.

Character/String Data type


• char - It has a maximum length of 8000 characters. It contains Fixed-
length non-unicode characters.
• varchar - It has a maximum length of 8000 characters. It contains
variable-length non-unicode characters.
• text - It has a maximum length of 2,147,483,647 characters. It
contains variable-length non-unicode characters.

Date Data type


• date - It is used to store the year, month, and days value.
• time - It is used to store the hour, minute, and second values.
• timestamp - It stores the year, month, day, hour, minute, and the
second value.

Binary Data type


• Binary - It has a maximum length of 8000 bytes. It contains fixed-
length binary data.

• varbinary - It has a maximum length of 8000 bytes. It contains


variable-length binary data.

• image - It has a maximum length of 2,147,483,647 bytes. It contains


variable-length binary data.

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

• User Interface Events :


                   ▪︎Events that trigger some action Example : User clicking on
an icon to send a purchase order to a supplier

15.) GROUP BY command (Nov 2016,19)


The GROUP BY clause is used to group the result-set by one or more
columns. It is often with aggregate functions.
Syntax:
SELECT column_name, function_name(column_name)
FROM table_name
WHERE condition
GROUP BY column_name
ORDER BY column1, column2;

Example :
Student

Roll Stud name Department Mark

101 Sanju CSE 75

102 Srinu ECE 89

103 Elakkiyaa IT 76

104 Esther CSE 87

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

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

Combine into subqueries


• Use cut - and - paste techniques to avoid errors
• Check for correlated subqueries

Test Sample Data


• Identify different cases
• Check final query and subqueries
• Verify calculations

Test SELECT queries before executing UPDATE queries


17.) Effective design of Forms (Nov 2018,19)
Effective Design of forms and Report :
The most important concept to remember when designing forms and
reports is to understand that they are the primary concert of the user.
The key of effective design is to determine the needs of the user. As a
designer, you talk with to learn what they want to accomplish. Then
you use your experience to provide features that make the form more
useful. Researchers in human factors have developed several guidelines
to help you design forms. Some factors are:
• User Control: match user task, Respond to user control and event
User customization.
• Consistency: Layout, design, and color, action.
• Feedback: Method( Visual, text, Audio, Graphics)
• Forgiveness: Correction of errors, Confirmation on delete and
updates.
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.

• Single-Row or Columnar Forms :-


A single-row form displays data for one row at a time. The goal is to
display every column. Its greatest feature is that the designer can
display the data at any location on the form. It is useful for designing a
form like a traditional paper form.

• 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

• You are working on a system for a bank


• A customer goes to the ATM and instructs it to transfer $1,000 from
saving to a checking account balance
• This simple transaction require two step

1. subtracting the money from the


savings account balance
2. adding the money to the checking
account balance

• The code to create this transaction will require two update to the
database

1. One UPDATE command to decrease the balance in savings


2. UPDATE command to increase the balance in the checking account

• Consider what would happen if a machine crashed between these


two operation.
• The money has already been subtracted from the savings account,
but it will not be added to the checking account - Lost
• Consider performing the addition to checking first, but then the
customer ends up with extra money and the bank loses
                  ▪︎Both the changes must be made successfully

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.

Advantages of Database Management System :


• Reducing Data Redundancy
The file based data management systems contained multiple files that
were stored in many different locations in a system or even across
multiple systems. Because of this, there were sometimes multiple
copies of the same file which lead to data redundancy. 
• Sharing of Data :
In a database, the users of the database can share the data among
themselves. There are various levels of authorisation to access the data,
and consequently the data can only be shared based on the correct
authorisation protocols being followed. 
Many remote users can also access the database simultaneously and
share the data between themselves.

• 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.

14.) Write short notes on First and second Normal forms


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

In the above table, Course is a multi-valued attribute so it is not in 1NF. 


Below Table is in 1NF as there is no multi-valued attribute:  

ID    Name    Courses


-----------------------------------
1       A              c1
1       A              c2
2       E              c3
3       M             c2
3       M             c3

Second normal form :


A table is said to be 2NF if both the following conditions hold :
 Table is in 1NF
 No partial dependency

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.

It is used to extract only those records that fulfill a specified condition.

WHERE clause is used to specify/apply any condition while retrieving,


updating or deleting data from a table. This clause is used mostly with
SELECT , UPDATE and DELETE query.

16.) Write short notes on: Joining many tables.


Joins :
Join query is used to retrieve data from multiple tables. A query can
contain zero, one, or multiple JOIN operations

Types of JOINS :
• (INNER) JOIN
• LEFT (OUTER) JOIN
• RIGHT (OUTER) JOIN
• FULL (OUTER) JOIN

Consider the following two tables

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;

Roll Sname Mark Faculty_Name


103 Eyuva 67 Keerthi
103 Eyuva 67 Manju
102 Srinu 89 Sangeetha
104 Sanju 50 Sagana

 LEFT (OUTER) JOIN :


Return all records from the left table, and the matched records from
the right table
  

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;

Roll Sname Mark Faculty_Name


101 Elak 75 Null
102 Srinu 89 Sangeetha
103 Eyuva 67 Keerthi
103 Eyuva 67 Manju
104 Sanju 50 Sagana
105 Kavin 86 Null
106 Charan 95 Null
107 Ashok 55 Null

 RIGHT (OUTER) JOIN :


Return all records from the right table, and the matched records
from the left table

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;

Roll Sname Mark Faculty_Name


103 Eyuva 67 Keerthi
103 Eyuva 67 Manju
102 Srinu 89 Sangeetha
104 Sanju 50 Sagana

 FULL (OUTER) JOIN :


Return all records when there is a match in either left or right table

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;

Roll Sname Mark Faculty_Name


101 Elak 75 Null
102 Srinu 89 Sangeetha
103 Eyuva 67 Keerthi
103 Eyuva 67 Manju
104 Sanju 50 Sagana
105 Kavin 86 Null
106 Charan 95 Null
107 Ashok 55 Null
103 Eyuva 67 Keerthi
103 Eyuva 67 Manju
102 Srinu 89 Sangeetha
104 Sanju 50 Sagana

17.) Discuss about Programs to Retrieve and Save data.


Programs to Retrieve and Save Data
Basic Approaches
The two basic approaches to embed SQL into procedural language
1. Uses code and variables to build an SQL statement
2. Use code to examine an SQL query one row at a time

Building SQL statements with Code


Three common situations arise where custom SQL code is needed to
build
• Changing Data
UPDATE command is used

• Inserting or Copying Data


INSERT command in used

• Deleting Data
DELETE command is used

18.) Write short notes on: Form Events.


Forms Events :
Form Event is an Event that can occur within a form
Example
• Open
• Close
• Load
• Unload
• Resize
• Activate
• Deactivate
• GotFocus
• LostFocus
• Current
• Timer
Event categories :
Event category Events Occur when

Close A user or code opens,


Window events Load resizes, or closes a
Open form or report
Resize
Unload

Activate Objects receiver or


Focus events Deactivate lose the focus, or
Enter become active or
Exit inactive.
Got
Focus
Lost

Data events AfterDelConfirm A user or code enters,


AfterInsert deletes, or changes
AfterUpdate, data in a form or
BeforeDelConfirm control, or moves the
BeforeInsert focus from one record
BeforeUpdate to another.
Change
Current
Delete
NotInList
Updated

Move events Click A user performs a


DblClick mouse action, such as
MouseDown clicking or double-
MouseMove clicking.
MouseUp

Keyboard events KeyDown A user types on the


KeyPress keyboard, or keys are
Keyup sent using the
SendKeys action or
the SendKeys
statement.

Print events Format A report is being


NoData printed, or is being
Page formatted for
Print printing.
Retreat

Filter events ApplyFilter A user creates or


Filter applies a filter to a
form.
Microsoft Access or
Error and Timing ErroTimer the Jet database
events engine encounters an
error, or a specified
time interval passes.

19.) Discuss about Object Oriented Database. (Nov 2016,20)


An object-oriented database is a collection of object-oriented
programming and relational database. There are various items which
are created using object-oriented programming languages like C++, Java
which can be stored in relational databases, but object-oriented
databases are well-suited for those items.

An object-oriented database is organized around objects rather than


actions, and data rather than logic. For example, a multimedia record in
a relational database can be a definable data object, as opposed to an
alphanumeric value.
10marks
Nov 2016
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

In the above table, Course is a multi-valued attribute so it is not in 1NF. 

Below Table is in 1NF as there is no multi-valued attribute:  

ID    Name    Courses


-----------------------------------
1       A              c1
1       A              c2
2       E              c3
3       M             c2
3       M             c3

Second normal form :


A table is said to be 2NF if both the following conditions hold :
 Table is in 1NF
 No partial dependency

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.

 A relation is in third normal form if it holds atleast one of the


following conditions for every non-trivial function dependency X
→ Y.
• X is a super key.
• Y is a prime attribute, i.e., each element of Y is part of some
candidate key.

Example :

EMPLOYEE_DETAIL table :

EMPLOYEE table :
EMPLOYEE_ZIP table :
21.) DML and DDL commands with example

DML - Data Manipulation Language


 SELECT
 INSERT
 UPDATE
 DELETE

SELECT : It is used to retrieve data from a database.

INSERT : It is used to insert data into a table.

UPDATE: It is used to update existing data within a table.

DELETE : It is used to delete records from a database table.

Example :
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);

--DELETE
Delete from Grocery where Quantity=1 And MRP>=100;

--UPDATE
update Grocery set Quantity=2, Total=120 where Items='Atta';

DDL - Data Definition Language


• Create
• Drop
• Alter
• Truncate
• Rename
CREATE : It is used to create a new table in the database.

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.

RENAME : Renaming the database objects

--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;

22.) Procedural Languages used in DBMS


Traditional programming language such as
• BASIC
• COBOL
• C++
• JAVA
• Logic Elements
• Variables
• Computations
• Standard functions
• Debug
• Output
• Input
• Conditions
• Loops
• Arrays

• 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

23.) User interface features


User Interface Features :
• Modern windows-based applications have several user interface
features
• Designed to standardize the look and feel of application
• Make your application relatively easy to use
• Important Three features

1. Menus - List of options displayed at the top of the application

2. Toolbars - Consists of a set of icons or buttons that perform common


tasks

3. Help system - Crucial component of any application


24.) What are distributed database explain with example.
A distributed database is a collection of multiple interconnected
databases, which are spread physically across various locations that
communicate via a computer network.

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.

• A distributed database incorporates transaction processing, but it is


not synonymous with a transaction processing system.

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.

Character/String Data type


• char - It has a maximum length of 8000 characters. It contains Fixed-
length non-unicode characters.
• varchar - It has a maximum length of 8000 characters. It contains
variable-length non-unicode characters.
• text - It has a maximum length of 2,147,483,647 characters. It
contains variable-length non-unicode characters.

Date Data type


• date - It is used to store the year, month, and days value.
• time - It is used to store the hour, minute, and second values.
• timestamp - It stores the year, month, day, hour, minute, and the
second value.

Binary Data type


• Binary - It has a maximum length of 8000 bytes. It contains fixed-
length binary data.

• varbinary - It has a maximum length of 8000 bytes. It contains


variable-length binary data.

• image - It has a maximum length of 2,147,483,647 bytes. It contains


variable-length binary data.

21.) Aggregate functions with example (Nov 2017,18)


The following are the most commonly used SQL aggregate functions:

• AVG() – calculates the average of a set of values.


Syntax :
SELECT AVG(column_name)
FROM table_name
WHERE condition;

• COUNT() – counts rows in a specified table or view.


Syntax :
SELECT COUNT(column_name)
FROM table_name
WHERE condition;

• MIN – gets the minimum value in a set of values.


Syntax :
SELECT MIN(column_name)
FROM table_name
WHERE condition;

• MAX() – gets the maximum value in a set of values.


Syntax :
SELECT MAX(column_name)
FROM table_name
WHERE condition;

• SUM() – calculates the sum of values.


Syntax :
SELECT SUM(column_name)
FROM table_name
WHERE condition;

22.) Report types in detail (Nov 2016,17)


Reports :
Reports are generally used to present summarized data.

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.

23.) Effective design of Reports and forms (Nov 2017,18,19)

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

Effective Design of forms and Report :


The most important concept to remember when designing forms and
reports is to understand that they are the primary concert of the user.
The key of effective design is to determine the needs of the user. As a
designer, you talk with to learn what they want to accomplish. Then
you use your experience to provide features that make the form more
useful. Researchers in human factors have developed several guidelines
to help you design forms. Some factors are:
• User Control: match user task, Respond to user control and event
User customization.
• Consistency: Layout, design, and color, action.
• Feedback: Method( Visual, text, Audio, Graphics)
• Forgiveness: Correction of errors, Confirmation on delete and
updates.

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.

• Single-Row or Columnar Forms :-


A single-row form displays data for one row at a time. The goal is to
display every column. Its greatest feature is that the designer can
display the data at any location on the form. It is useful for designing a
form like a traditional paper form.
• 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 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.

25.) Client/Server system (Nov 2017,18)


Client/server is developed to deal with various computing
environments that have a large number of computers and servers
connected together via a network. In this architecture, a Client is a user
machine which provides the user interface and local processing
capabilities. When any client requires additional functionality like
database access, it can connect to Server that is capable of providing
the functionality needed by the client. Basically Server is a machine that
provides services to the Client i.e user machine.

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

• Back-up and Recovery possible


As all the data is stored on server
               ▪︎Easy to make a back-up and recover the data casily and
efficiently 

• 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

In the above table, Course is a multi-valued attribute so it is not in 1NF. 

Below Table is in 1NF as there is no multi-valued attribute:  

ID    Name    Courses


-----------------------------------
1       A              c1
1       A              c2
2       E              c3
3       M             c2
3       M             c3

Second normal form :


• In the 2NF, relational must be in 1NF.
• In the second normal form, all non-key attributes are fully functional
dependent on the primary key
• No partial dependency

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.

• A relation is in third normal form if it holds atleast one of the


following conditions for every non-trivial function dependency X → Y.
• X is a super key.
• Y is a prime attribute, i.e., each element of Y is part of some candidate
key.

Example :

EMPLOYEE_DETAIL table :
EMPLOYEE table :

EMPLOYEE_ZIP table :
21.) Data manipulation commands (Nov 2016,18,19)

DML - Data Manipulation Language


 SELECT
 INSERT
 UPDATE
 DELETE

SELECT : It is used to retrieve data from a database.

INSERT : It is used to insert data into a table.

UPDATE: It is used to update existing data within a table.

DELETE : It is used to delete records from a database table.

Example :
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);
--DELETE
Delete from Grocery where Quantity=1 And MRP>=100;

--UPDATE
update Grocery set Quantity=2, Total=120 where Items='Atta';

22.) Effective designs of Forms and Reports


(Nov 2017,18,19)
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

Effective Design of forms and Report :


The most important concept to remember when designing forms and
reports is to understand that they are the primary concert of the user.
The key of effective design is to determine the needs of the user. As a
designer, you talk with to learn what they want to accomplish. Then
you use your experience to provide features that make the form more
useful. Researchers in human factors have developed several guidelines
to help you design forms. Some factors are:
• User Control: match user task, Respond to user control and event
User customization.
• Consistency: Layout, design, and color, action.
• Feedback: Method( Visual, text, Audio, Graphics)
• Forgiveness: Correction of errors, Confirmation on delete and
updates.

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.

• Single-Row or Columnar Forms :-


A single-row form displays data for one row at a time. The goal is to
display every column. Its greatest feature is that the designer can
display the data at any location on the form. It is useful for designing a
form like a traditional paper form.

• 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.

• 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.

23.) Report types (Nov 2016,17,18)


Reports :
Reports are generally used to present summarized data.

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.

24.) Client/server database (Nov 2017,18)


Client/server is developed to deal with various computing
environments that have a large number of computers and servers
connected together via a network. In this architecture, a Client is a user
machine which provides the user interface and local processing
capabilities. When any client requires additional functionality like
database access, it can connect to Server that is capable of providing
the functionality needed by the client. Basically Server is a machine that
provides services to the Client i.e user machine.

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

• Back-up and Recovery possible


As all the data is stored on server
               ▪︎Easy to make a back-up and recover the data casily and
efficiently 

• 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

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.

 A relation is in third normal form if it holds atleast one of the


following conditions for every non-trivial function dependency X
→ Y.
• X is a super key.
• Y is a prime attribute, i.e., each element of Y is part of some
candidate key.

Example :

EMPLOYEE_DETAIL table :
EMPLOYEE table :

EMPLOYEE_ZIP table :
Fourth normal form (4NF) :

• It must be in 3NF/ BCNF (Boyce Codd Normal Form)


• It contains no multi-valued dependencies
For a dependency A → B, if for a single value of A, multiple values of B
exists, then the relation will be a multi-valued dependency.
Example :
STUDENT

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.

In the STUDENT relation, a student with STU_ID, 21 contains two


courses, Computer and Math and two hobbies, Dancing and Singing. So
there is a Multi-valued dependency on STU_ID, which leads to
unnecessary repetition of data.

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)

DML - Data Manipulation Language


 SELECT
 INSERT
 UPDATE
 DELETE

SELECT : It is used to retrieve data from a database.


INSERT : It is used to insert data into a table.

UPDATE: It is used to update existing data within a table.

DELETE : It is used to delete records from a database table.

Example :
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);

--DELETE
Delete from Grocery where Quantity=1 And MRP>=100;

--UPDATE
update Grocery set Quantity=2, Total=120 where Items='Atta';

22.) Error handling

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

• On Error GOTO label Statement


The most common version that directs access to specific error handy
routine

• On Error Resume Next command


Command is used when you prefer to ignore error or to test them after
each primary operation

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

                   ▪︎Could start an infinite loop: A bad line generates an error,


and the error routine jumps back to try the line again, which generates
a new error and so on

• 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.

23.) Data clustering and Partitioning


Data clustering :
Data clustering is the process of grouping the commonly accessed data
into clusters of similar data

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

21.) Describe the various types of Joins with examples.


Joins :
Join query is used to retrieve data from multiple tables. A query can
contain zero, one, or multiple JOIN operations

Types of JOINS :
• (INNER) JOIN
• LEFT (OUTER) JOIN
• RIGHT (OUTER) JOIN
• FULL (OUTER) JOIN

Consider the following two tables

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;

Roll Sname Mark Faculty_Name


103 Eyuva 67 Keerthi
103 Eyuva 67 Manju
102 Srinu 89 Sangeetha
104 Sanju 50 Sagana

 LEFT (OUTER) JOIN :


Return all records from the left table, and the matched records from
the right table

  

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;

Roll Sname Mark Faculty_Name


101 Elak 75 Null
102 Srinu 89 Sangeetha
103 Eyuva 67 Keerthi
103 Eyuva 67 Manju
104 Sanju 50 Sagana
105 Kavin 86 Null
106 Charan 95 Null
107 Ashok 55 Null

 RIGHT (OUTER) JOIN :


Return all records from the right table, and the matched records
from the left table

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;

Roll Sname Mark Faculty_Name


103 Eyuva 67 Keerthi
103 Eyuva 67 Manju
102 Srinu 89 Sangeetha
104 Sanju 50 Sagana

 FULL (OUTER) JOIN :


Return all records when there is a match in either left or right table
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;

Roll Sname Mark Faculty_Name


101 Elak 75 Null
102 Srinu 89 Sangeetha
103 Eyuva 67 Keerthi
103 Eyuva 67 Manju
104 Sanju 50 Sagana
105 Kavin 86 Null
106 Charan 95 Null
107 Ashok 55 Null
103 Eyuva 67 Keerthi
103 Eyuva 67 Manju
102 Srinu 89 Sangeetha
104 Sanju 50 Sagana

22.) Explain the windows controls used in designing of Reports and


Forms.

23.) Describe about Data Storage Methods. ((5)Nov 2018,(10)20)


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

24.) Explain about database development stages.

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

2.) Class diagram to normalized tables :

Unit - 2

3.) 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

4.) Sub queries


1. Definition (1mark)
Query within a query
2. Structure :
Query1(Query2)
Query1- Outer Query-select/insert/delete
Query2-Inner Query - select
3. Example :
Ex 1 : Select * from acd where regno=(select
regno from per where name=’priyadharshini’)

Ex 2 : Delete from acd where regno =(select regno


from per where name=(select name from ext
where ext_act=’sports')

4. Execution pattern (1mark)


● Execute the inner query
● Supply the output of the inner query to outer
query
● Execute the outer query
5. Types of Subquery :
● Nested subquery - subquery within another
subquery
● Correlated subquery -Reference one or more columns in the
outer SQL
Statement : The subquery is known as a correlated subquery because
the subquery is related to the outer
SQL statement :
● Multi row subquery - inner query will return
more than one row
● Multi column subquery - inner query will
return more than one column
● Single row subquery - inner query will return
only one row
6. Subquery operators :
= - single row
Relational operators, Not, in, all, any - multi row
Ex:
Select regno, grade from acd where regno in
(select regno from per where age>20)
34,56,78,92
All - 4 grade
Any - randomly one person
In - multiple input - single output
Not in - other than this 4 grade

5.) 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

Combine into subqueries


• Use cut - and - paste techniques to avoid errors
• Check for correlated subqueries

Test Sample Data


• Identify different cases
• Check final query and subqueries
• Verify calculations

Test SELECT queries before executing UPDATE queries

6.) DDL & DML Commands


DML - Data Manipulation Language
 SELECT
 INSERT
 UPDATE
 DELETE

SELECT : It is used to retrieve data from a database.

INSERT : It is used to insert data into a table.

UPDATE: It is used to update existing data within a table.

DELETE : It is used to delete records from a database table.


Example :
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);

--DELETE
Delete from Grocery where Quantity=1 And MRP>=100;

--UPDATE
update Grocery set Quantity=2, Total=120 where Items='Atta';

DDL - Data Definition Language


• Create
• Drop
• Alter
• Truncate
• Rename
CREATE : It is used to create a new table in the database.

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.

RENAME : Renaming the database objects

--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;
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

Effective Design of forms and Report :


The most important concept to remember when designing forms and
reports is to understand that they are the primary concert of the user.
The key of effective design is to determine the needs of the user. As a
designer, you talk with to learn what they want to accomplish. Then
you use your experience to provide features that make the form more
useful. Researchers in human factors have developed several guidelines
to help you design forms. Some factors are:
• User Control: match user task, Respond to user control and event
User customization.
• Consistency: Layout, design, and color, action.
• Feedback: Method( Visual, text, Audio, Graphics)
• Forgiveness: Correction of errors, Confirmation on delete and
updates.

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.

• Single-Row or Columnar Forms :-


A single-row form displays data for one row at a time. The goal is to
display every column. Its greatest feature is that the designer can
display the data at any location on the form. It is useful for designing a
form like a traditional paper form.

• 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.

• 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.

8.) 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.

• Single-Row or Columnar Forms :


A single-row form displays data for one row at a time. The goal is to
display every column. Its greatest feature is that the designer can
display the data at any location on the form. It is useful for designing a
form like a traditional paper form.

• 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.

9.) Procedural language


Traditional programming language such as
• BASIC
• COBOL
• C++
• JAVA
• Logic Elements
• Variables
• Computations
• Standard functions
• Debug
• Output
• Input
• Conditions
• Loops
• Arrays

• 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

10.) Program to retrieve save data


Programs to Retrieve and Save Data
Basic Approaches
The two basic approaches to embed SQL into procedural language
1. Uses code and variables to build an SQL statement
2. Use code to examine an SQL query one row at a time

Building SQL statements with Code


Three common situations arise where custom SQL code is needed to
build
• Changing Data
UPDATE command is used

• Inserting or Copying Data


INSERT command in used

• 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

• Restoring database from backup tapes


▪︎DBMS loads the most recent snapshot data
▪︎Examines the transactions
▪︎Completed transactions are rolled forward 
▪︎Changes are rewritten to the data tables
▪︎If the backup occurred in the middle of the transaction and the
transaction was not completed
▪︎DBMS will roll back
                    ▪︎Remove the initial changes and restart the transaction

• Perform Backups on a regular schedule


▪︎Revise the schedule when the database records is changed
▪︎Every changes is recorded in transaction log
▪︎DBA has to monitor the space on the transaction log
           ▪︎Too Full
                          • Backup has to run earlier than scheduled
                   ▪︎Schedule should be changed on frequent Backup
• Store the Backup tapes in offsite
• Copy and move snapshot and journal logs offsite atleast once a day
14.) Distributed database
A distributed database is a collection of multiple interconnected
databases, which are spread physically across various locations that
communicate via a computer network.

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.

• A distributed database incorporates transaction processing, but it is


not synonymous with a transaction processing system.

15.) Client/server database


Client/Server system :
• Popular system of distributing data on networks
• Consists of two parts
1. Client systems :
▪︎Personal computers / Smaller computers act as clients
▪︎Hold data that is used by the individual

2.  Server systems :


▪︎Machines with multiuser operating systems act as server
▪︎Hold software and data that will be shared by the users

• All the shared data is first transferred to a server


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

• Back-up and Recovery possible


As all the data is stored on server
               ▪︎Easy to make a back-up and recover the data casily and
efficiently 
• 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

(OR)

Client/server is developed to deal with various computing


environments that have a large number of computers and servers
connected together via a network. In this architecture, a Client is a user
machine which provides the user interface and local processing
capabilities. When any client requires additional functionality like
database access, it can connect to Server that is capable of providing
the functionality needed by the client. Basically Server is a machine that
provides services to the Client i.e user machine.
16.) Object-oriented database
An object-oriented database is a collection of object-oriented
programming and relational database. There are various items which
are created using object-oriented programming languages like C++, Java
which can be stored in relational databases, but object-oriented
databases are well-suited for those items.

An object-oriented database is organized around objects rather than


actions, and data rather than logic. For example, a multimedia record in
a relational database can be a definable data object, as opposed to an
alphanumeric value.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy