DBMS (1 - 5 Units)
DBMS (1 - 5 Units)
UNIT I :
UNIT II :
Query Basics - Computation Using Queries - Subtotals and GROUP BY Command - Queries
with Multiple Tables - Subqueries - Joins - DDL & DML - Testing Queries.
UNIT III :
Effective Design of Forms and Reports - Form Layout - Creating Forms - Graphical Objects -
Reports - Procedural Languages - Data on Forms - Programs to Retrieve and Save Data -
Error Handling.
UNIT IV :
UNIT V :
Text:
References:
UNIT – I
9. What is meant by Data Dictionary or Data repository? (NOV. 2011, NOV .2012,
NOV.2015, APR. 2012)
The Data Dictionary holds the definitions of all the data tables. It describes the
type of data being stored. It allows the DBMS to keep track of the data. It helps developers
and users to find the data they need.
10. What are the basic components of a DBMS? (NOV. 2012, APR. 2016)
The basic components of DBMS are
Data Base Engine
Data Dictionary
Query Processor
Report Writer
Forms Generator
Application Generator
Communication and Integration
Security
11. What is meant by first Normal Form? (NOV .2012, APR. 2016)
When a table has no repeating groups it is said to be in first Normal form (1NF).For
each cell in a table there can be only one value, it cannot be decomposed into smaller pieces.
14. What are the primary data types used in Business Applications? (NOV. 2014)
The primary data types used in Business Application are Text, Number, Date and
Time, Interval, Image, auto number.
Enforcement of standards:
DBMS is responsible for efficient data storage and retrieval , concurrency and data
security.
Ease of Application Development:
Once data structure is defined , the tools like report writer, forms generator and query
language makes it faster and easier to develop business applications.
Uniform security, privacy and Integrity:
The focus on data and careful design enable database systems to avoid the problems.
Data Independence:
The separation of the data definition from the program is known as data
independence. It enables to change the data definition with out altering the program.
2.Write short notes on The Feasibility Study:(APR. 2012,APR. 2015, 2016, NOV.2014)
Need:
If the project involve critical areas within the organization , require expensive
hardware , require substantial development time the formal feasibility study is
undertaken.
Goal:
The goal of a Feasibility Study is to determine whether a proposed project is worth
pursuing.
Fundamental categories:
Cost
Potential benefit
Cost:
Benefits:
Cost Savings:
The cost can be saved by maintaining the software ,fewer errors, less data maintenance, less
user training.
Increased value
The value can be increased by better access to data,better decisions, better
communication, more timely reports, faster reaction to change,new products and services.
Strategic advantages:
The strategic advantage is occurred by locking out of competitors.
3. Describe briefly on first and second normal forms with examples(APR. 2012)
1st Normal Form
A database is in first normal form if it satisfies the following conditions:
Contains only atomic values
There are no repeating groups
An atomic value is a value that cannot be divided. For example, in the table shown below, the
values in the [Color] column in the first row can be divided into "red" and "green", hence
[TABLE_PRODUCT] is not in 1NF.
A repeating group means that a table contains two or more columns that are closely related.
1st Normal Form Example
Consider the following example:
This table is not in first normal form because the [Color] column can contain multiple values.
For example, the first row includes values "red" and "green."
To bring this table to first normal form, we split the table into two tables and now we have
the resulting tables:
Now first normal form is satisfied, as the columns on each table all hold just one value.
2nd Normal Form Definition
A database is in second normal form if it satisfies the following conditions:
It is in first normal form
All non-key attributes are fully functional dependent on the primary key
A table that is in 1st normal form and contains only a single key as the primary key is
automatically in 2nd normal form.
2nd Normal Form Example
Consider the following example:
This table has a composite primary key [Customer ID, Store ID]. The non-key attribute is
[Purchase Location]. In this case, [Purchase Location] only depends on [Store ID], which is
only part of the primary key. Therefore, this table does not satisfy second normal form.
To bring this table to second normal form, we break the table into two tables, and now we
have the following:
What we have done is to remove the partial functional dependency that we initially had.
Now, in the table [TABLE_STORE], the column [Purchase Location] is fully dependent on
the primary key of that table, which is [Store ID].
This table has a composite primary key [Customer ID, Store ID]. The non-key attribute is
[Purchase Location]. In this case, [Purchase Location] only depends on [Store ID], which is
only part of the primary key. Therefore, this table does not satisfy second normal form.
To bring this table to second normal form, we break the table into two tables, and now we
have the following:
What we have done is to remove the partial functional dependency that we initially had.
Now, in the table [TABLE_STORE], the column [Purchase Location] is fully dependent on
the primary key of that table, which is [Store ID].
customer 1 * sale
Here the relation shows the one to many relationship between customer and sale
tables. The asterisk(*) represents many.
* *
Employee Tasks
This shows the many to many relationship between the employee and the tasks
table.
Customer Salesperson
1
1 *
order
*
1
*
orderitem
1
*
Item
Here the numbers indicate the relationships. Each customer can place many orders , but a
given order can come from only one customer.
Employee
*
* *
Component product
N-ary Associations:
Employee
name
Product
Component ProductID
Assembly
Comp id Type
Type Name
Name
Assembly
EmployeeID
CompID
ProductID
Aggregation:
UML defined some special technique of association called Aggregation or Collection.
This is indicated by a small diamond on the association line next to the class that is the
aggregate. This can be shown as
Sale Item
Employee
Composition: cost
Composition is a stronger aggregate association that arise most often. In a
composition, the individual items become a new object. The individual classes are separated
and marked with a filled diamond.
Wheels
Bicycle Rims
Size
Crank
Model Type
Item id
Stem
Item id
Weight
Generalization:
Generalization is a common association that arises in business settings. This generates
a class hierarchy. The most general description is given at the top and the specific classes are
derived from it.
A small unfilled triangle is used to indicate a generalization relationship. An
important characteristics of generalization is that lower level classes inherit the properties and
methods of the classes above. It can be shown as
Animal
DateBorn
Name
Gender
Mammal
fish
Spider
Litter size
Fresh Water
Venomous
Tail Length
Scale Condition
Habitat
claws
Reflexive Associations:
A reflexive Association is a relationship from one class back to itself. It arises in
business that requires special handling. This can be shown as
manager
worker
Employee
Participation Constraints
Total Participation − each entity is involved in the relationship. Total participation
is represented by double lines.
Partial participation − Not all entities are involved in the relationship. Partial
participation is represented by single lines.
10. Write short notes on Data type (NOV. 2015, NOV .2012)
The data types are
*Text
*Numbers
* Date and Time
* Binary objects
* computed values
*User defined data types
Text:
Text data type is used for characters. It is limited to 255 characters.
Fixed Length Strings take up the amount of space we allocate and useful to improve in short
strings. Variable Length Strings are stored so that they take space as needed for the data.
Memo or note columns is used to hold Variable length text data. It is used for long comments
or short reports.
Numbers:
Numbers is for numeric data. It is of Integers and floating Point.
Integers cannot hold fractions and store 2 or 4 bytes of data. Floating Point include fractional
values and store 4 or 8 bytes. Most systems support long integers and double precision
floating point values.
Data and Time:
All database need a special data type for dates and time. Most system combine the
two in one domain and some provide two separate definitions.
It is stored as single numbers, and as integers that count the number of days from
some basic date.
Binary Object:
A relatively new domain is a separate category for objects or binary large objects. It
enables to store any type of object created by the computer. It can hold images and files from
other software packages.
Computed Values:
The business attributes can be computed using computing values. The UML notation
is used to proceed the name with a slash (/) and then describe the computation in a note.
User Defined Types:
We can build our own domain as a combination of existing types. Any time we want
to use the data we can pass all values to our code.
11. What are events? How they are describe in a database design? (NOV. 2011)
Events are actions that are independent of time. It is a component of modern database
systems. There are three types of events occur in a database environment.
Business events trigger some function, such as sale triggering a reduction in inventory.
Data changes events gives some alert, such as inventory that drops below a present level,
which triggers a new purchase order.
User Interface events that trigger some action .such as user clicking on an icon to send a
purchase order to a supplier.
UML provide several diagrams to illustrate events.
Collaboration diagram:
An interaction diagram that shows, for one system event described by one use case,
how a group of objects collaborate with one another. It is useful for recording business
processes and events.
Sequence diagram:
Complex user interface events can be displayed in the sequence diagrams.
Process diagram:
For complex chain of events we draw a process diagram. The combined model can be shown
as
Inventory
Order Subtract (prod, Qty sold)
Subtract
Analyse
Analyse
Ship order
Reorder (product, quantity)
Purchase
Reorder
MVD is the dependency where one attribute value is potentially a 'multi-valued fact'
about another. Consider the table
In this example, 'Address' is a multi-valued fact 'Customer Name' and the converse is
also true.
For example, the attribute 'Address' takes on the two values 'New Delhi' and
'Amritsar'for the single 'Customer_Name' value 'Raj'. The attribute
'Customer_Name' takes on the values 'Raj' and 'Suneet' for the single 'address; value
'Amritsar'.
3..Describe the class diagram ,Association details.(NOV. 2014)
A class Diagram is a visual model of the classes and associations in an organization. The
basic features are class names (entities) in boxes and associations (relationships) connecting
them.
The properties of class name or entities are included in the boxes. The associations
or the relationships have several options.(1) The maximum number of objects that can be
related and (2) The minimum number of objects must be included
Customer Salesperson
1
1 *
order
*
1
*
orderitem
1
*
Item
Here the numbers indicate the relationships. Each customer can place many orders , but a
given order can come from only one customer.
Employee
*
* *
Component product
N-ary Associations:
Employee
name
Product
Component ProductID
Assembly
Comp id Type
Type Name
Name
Assembly
EmployeeID
CompID
ProductID
Aggregation:
UML defined some special technique of association called Aggregation or Collection.
This is indicated by a small diamond on the association line next to the class that is the
aggregate. This can be shown as
Sale Item
Employee cost
Composition:
Composition is a stronger aggregate association that arise most often. In a
composition , the individual items become a new object. The individual classes are separated
and marked with a filled diamond.
Wheels
Bicycle Rims
Size
Crank
Model Type
Item id
Stem
Item id
Weight
Generalization:
Generalization is a common association that arises in business settings. This generates
a class hierarchy. The most general description is given at the top and the specific classes are
derived from it.
A small unfilled triangle is used to indicate a generalization relationship. An
important characteristics of generalization is that lower level classes inherit the properties and
methods of the classes above. It can be shown as
Animal
DateBorn
Name
Gender
Mammal
fish
Spider
Litter size
Fresh Water
Venomous
Tail Length
Scale Condition
Habitat
claws
Reflexive Associations:
A reflexive Association is a relationship from one class back to itself. It arises in
business that requires special handling. This can be shown as
worker
Employee manager
This table is not in first normal form because the [Color] column can contain multiple values.
For example, the first row includes values "red" and "green."
To bring this table to first normal form, we split the table into two tables and now we have
the resulting tables:
Now first normal form is satisfied, as the columns on each table all hold just one value.
2nd Normal Form Definition
A database is in second normal form if it satisfies the following conditions:
It is in first normal form
All non-key attributes are fully functional dependent on the primary key
A table that is in 1st normal form and contains only a single key as the primary key is
automatically in 2nd normal form.
2nd Normal Form Example
Consider the following example:
This table has a composite primary key [Customer ID, Store ID]. The non-key attribute is
[Purchase Location]. In this case, [Purchase Location] only depends on [Store ID], which is
only part of the primary key. Therefore, this table does not satisfy second normal form.
To bring this table to second normal form, we break the table into two tables, and now we
have the following:
What we have done is to remove the partial functional dependency that we initially had.
Now, in the table [TABLE_STORE], the column [Purchase Location] is fully dependent on
the primary key of that table, which is [Store ID].
3rd Normal Form Definition
A database is in third normal form if it satisfies the following conditions:
It is in second normal form
There is no transitive functional dependency
By transitive functional dependency, we mean we have the following relationships in the
table: A is functionally dependent on B, and B is functionally dependent on C. In this case, C
is transitively dependent on A via B.
3rd Normal Form Example
Consider the following example:
In the table able, [Book ID] determines [Genre ID], and [Genre ID] determines [Genre Type].
Therefore, [Book ID] determines [Genre Type] via [Genre ID] and we have transitive
functional dependency, and this structure does not satisfy third normal form.
To bring this table to third normal form, we split the table into two as follows:
Now all non-key attributes are fully functional dependent only on the primary key. In
[TABLE_BOOK], both [Genre ID] and [Price] are only dependent on [Book ID]. In
[TABLE_GENRE], [Genre Type] is only dependent on [Genre ID].
UNIT – II
PART - A
Question & Answers for Two marks:
1. What is a primary key? (APR. 2012, NOV. 2015)
A primary key is a special relational database table column (or combination of
columns) designated to uniquely identify all table records.
A primary key’s main features are:
It must contain a unique value for each row of data.
It cannot contain null values.
SELECT DISTINCT column_name,column_name
FROM table_name;
Example :
SELECT DISTINCT BTITLE FROM BOOK;
3. What basic aggregation functions are available in the SELECT command?
(APR. 2012, APR. 2014)
2. Locating Mismatches
Example:
7. What is the basic structure of the SQL SELECT command? (APR. 2013)
The SELECT statement is used to reteive data from a database.
Basic Structure:
Example:
SELECT ISBN,Btitle FROM Book;
Syntax:
SAVEPOINT savepoint_name;
ROLLBACK TO savpoint_name;
Example:
Sql>SAVEPOINT SP1;
savepoint created
13. Write the differences between DDL and DML. (APR. 2015)
DDL-Data Defintion Language provides commands that can be used to
create,modify and delete database objects.
DML-Data Manipulation Language provides commands that can be used to
access and manipulate the data,(ie) to retrieve, insert, delete and update data in a
database.
14. How to create a table? Give one example. (APR. 2015)
The CREATE TABLE command is used to define a new relation,its attributes
and its data types, constraints can also be specified on it.
Syntax:
Example:
CREATE TABLE Book(ISBN VARCHAR2(10) PRIMARY KEY,
Btitle VARCHAR2(15),category VARCHAR2(10));
PART – B
Question & Answers for Five marks:
A query is a request for information from a database. There are three general
methods for posing queries:
a) What output we want to see?
b) What constraints are given?
c) How are the tables joined?
Single Table:
Table consists of rows and columns. There are things to be in table.
a) What a table?
b) What conditions are given?
c) What do you want to see?
Example:
Example:
2. DISTINCT keyword:
This keyword is used to eliminate the duplicate tuples from the relation. This
command is used in SELECT command.
Example:
3. Boolean Algebra:
The DBMS uses Boolean Algebra to evaluate the conditions that consists of
multiple clauses. The clauses are connected by the operators AND, OR & NOT.
Example:
SELECT * from Book where Btitle = ‘C++’ AND price >= 150;
4. De Morgan’s law:
The useful technique for simplifying the complex query by using De
Morgans’s law.
5. BETWEEN Operator:
The BETWEEN comparison operator in query basic used to simplify the
condition in where clause that specifies the numeric values based on rangers.
Example :
2. Write Short Notes on: DDL Statements. (APR. 2012, NOV. 2012, NOV.2013,
NOV. 2014)
DDL-Data Defintion Language provides commands that can be used to
create,modify and delete database objects. Common DDL statements are
CREATE, ALTER, and DROP.
(i) CREATE TABLE Command:
The CREATE TABLE command is used to define a new relation,its
attributes and its data types, constraints can also be specified on it.
Syntax:
CREATE TABLE table_name(<attribute 1> <datatype1> [constraint]-----
<attribute n> <datatype2>[constraint]);
Example:
CREATE TABLE Book(ISBN VARCHAR2(10) PRIMARY KEY,
Btitle VARCHAR2(15),category VARCHAR2(10));
DESCRIBE Command:
This command is used to view the structure of the table.
Syntax:
Example:
ALTER TABLE Book ADD(price NUMBER(6,2));
2. Modifying an attribute:
It can be used to change either datatype or size or both.
Syntax:
Example:
ALTER TABLE Book MODIFY(Btitle VARCHAR2(20));
Syntax:
Example:
DROP TABLE Book;
All the tuples stored in ‘Book’ relation is permanently removed and cannot be
recovered.
Example:
DROP TABLE Book CASCADE;
Example:
DROP TABLE Book RESTRICT;
3. What are SQL DML statements? Explain with examples. (APR. 2012, APR.
2014)
DML-Data Manipulation Language provides commands that can be used to
access and manipulate the data,(ie) to retrieve, insert, delete and update data in a
database.
(i) INSERT Commnd:
This command adds a single tuple at a time in a relation.
Syntax:
Example:
INSERT INTO Book values(‘&ISBN’,’&Btile’,&price);
(or)
INSERT INTO Book values(‘001-987-760-9’,’DBMS’,100);
(ii)DELETE Command:
This command is used to remove tuples, which are no required as a part of a
relation. Tuples can be deleted from only one relation at a time.
Syntax:
DELETE FROM <table_name> [WHERE
Clause];
The WHERE Clause is used to specify the tuples to be deleted.If the WHERE
Clause is omitted, all the tuples of a relation are deleted.
Example:
DELETE FROM Book WHERE Btitle=’C++’;
Here ‘SET Clause’ -- specifies the attributes to be modified and the new values to
be assigned to them.
‘WHERE Clause’ – Specify the tuples for which the attributes are to be
modified otherwise all the tuples in the relation will be modified.
Example:
UPDATE Book SET price=price + 0.10 * price where Btitle = ‘DBMS’;
Syntax:
Example:
SELECT ISBN,Btitle,price FROM Book;
(or)
SELECT * FROM Book;
Here * denote ‘all attributes of the relation’ has to be retrieved.
Example :
The command to calculate the average price for each category of Book in the
book relation can be specified as
HAVING clause
Conditions can also be placed on groups using HAVING clause. More than
one condition can be specified in this clause using logical operators.
Example:
The command to retrieve the book categories for which the number of books
published is less than 5 can be specified as
The SUM and AVG functions works for numeric values only, whereas other
functions can work for numeric as well as non-numeric values, like strings, date,
time etc.
Example 1: To find the average price of only text books, the command can be
specified as
Example 2: To find the maximum price of book belonging to the Novel category,
the command can be specified as
SELECT MAX (PRICE) FROM BOOK WHERE CATEGORY = ‘Novel’;
Example 5: To find the number of non-null values in the attribute (Btitle), in duplicate values
are to be eliminated, the DISTINCT keyword can be used and the command can be specified
as
PART - C
Question & Answers for Ten marks:
1. Explain the computation using queries with suitable examples. (NOV. 2012,
NOV. 2013, APR. 2016)
The SELECT command can be used to perform numeric, arithmetic and
aggregate operations to compute the data stored in a relation.
Example for arithmetic operation:
(=, < >, ≤, ≥) and Logical operators (AND, OR NOT) with the help of
WHERE clause command.
Example :
Aggregate operations:
Basic aggregation functions are available in the SELECT command are
MIN returns the smallest value in a given column
Example 1: To find the average price of only text books, the command can be
specified as
Example 2: To find the maximum price of book belonging to the Novel category,
the command can be specified as
Example :
The command to retrieve ISBN Btitle and catergory of book with minimum price
can be specified as
SELECT ISBN, Btitle, category from Book WHERE price = (SELECT min(price)
from Book;
Operators in subqueries:
SQL provides four useful operators that are generally used with
subqueries. They are
1. ANY 2. ALL 3. EXISTS . 4. IN
1. ANY operator:
It compares a value with any of the values in a list or returned by the
subquery. This operator returns false value if the subquery returns no tuple.
Example:
The command to retrieve detals of books with price equal to any of the books
belonging to ‘Novel’ category as
SELECT ISBN, Btitle, price from Book WHERE price = Any (SELECT price
from Book WHERE category = ‘Novel’);
2. IN operator:
It can be used to compare a single value to the set of multiple values.
Example:
The command to retrieve the data of books belonging to category with page count
> 300 as
SELECT * from Book WHERE category IN (SELECT category from Book
WHERE pagecount >300);
3. ALL operator:
It compares a value to every value in a list returned by the subquery.
The command to retrieve details of books with price > the price of all the books
belonging to ‘Textbook’ category.
SELECT ISBN, Btitle, price form Book WHERE price > ALL (SELECT price
from Book WHERE category = ‘Textbook’);
4. EXIT operator:
It evaluates to true if a subquery returns at least one tuple as a result
otherwise it returns false value.
Examplle:
The command to retrieve the details of publishers having at least one book
published as
SELECT PID, Pname, address from publisher WHERE exists (SELECT * from
Book WHERE Publisher. PID = Book.PID);
3. Explain various Joins with examples. (NOV. 2015, APR. 2014, APR. 2016)
The join operation is one of the most useful and commonly used operations to
extract information from two or more relations. There are four types of joins.
They are
1. Equi-Join query:
The join query in which tuples are concatenated on the basis of the equality
condition is known as Equi-join.
Example:
To retrieve details of both book and publishers, where PID attribute in both the
relations has identical values can be specified as
The resultant relation of this query consists of two columns for the attribute PID
having identical values from ‘Book” and publisher.
Joining tables:
The Inner Join operation combines two tables using a key field,they
have in common.
Example :
Consider two relational schemas and its attributes list,
Customer{CID,Cname} & Order{CID,EID}
Example:
Let us consider the 4 relational schemas to be join.
The 4 relational schemas are Animal,SaleAnimal,Sale and Customer and its
attributes are
Animal{AID,name,category}
SaleAnimal{SID,AID,saleprice}
Sale{SID,saledate,EID,CID}
Customer{CID,phone,Fname,Lname}
UNIT III
Question & Answers for Two marks:
1.What are the basic properties for forms? (APR.2012,2014)
Data : the first category (data) relates to the source of data
Integrity : a second set of properties refers to data integrity Format: the third level of
properties controls the display of the form
Other properties: popup menus, menu bar, help
● Tabular forms
● Single row forms
● Sub forms
● Switchboard form
3.List the basic human factors design elements (APR. 2013)
There are some basic human factors design elements that system designers should
incorporate in their applications. They are
● User control
● Consistency
● Clarity
● Aesthetics
● Feedback
● Forgiveness
● Tabular report
● Label report
● Groups and subtotal
● Labels and graphs
● Columns/subgroups
● Charts/graphs
● Subform which displays data from two tables that have a onetomany relationship
● A subform is usually a tabular form embedded on the form
● The main form muat be a single row form, and the subform should be a tabular view
8.Write down the primary functions for error handling (APR. 2015)
When you create execute a PL/SQL, there are lots of chances to get an error. Sp, as a good
PL/SQL developer we have those error to avoid the termination of the PL/SQL program.
This technique is called exception handling.
● Switchboard forms or menus which direct the user to other forms and reports in the
application
● Switchboard or menu forms provide the overall structure to an application
● The switchboard form often contains images , and the design reflects the style of the
company
● Most database system enables to create forms that have multiple subforms
● The subforms can be either independent as separate boxes on the main form or nested
where each subform lies inside other
● Subform contents are linked to the main form through a common column.
● Tabular report
● Label report
● Groups or subtotals
● Graphs
● Procedural language is the generic term used for a traditional programming language.
● It specifies the sequence of a set of commands
● Every procedural language contains its own set of elements
14. What are the basic form types (Nov2012)
Four basic types of forms are
Tabular forms
● Common controls include simple text labels, text boxes for data entry, option buttons,
pictures and list boxes.
16.why would you need to use procedural code when SQL is so powerful? (Nov2014)
PL/SQL is used when we required some procedural features like conditional statements
or iteration loop for processing. In PL/SQL we can retrieve data from tables using select
statement and apply it into some variables. When we are using PL/SQL for writing codes in
SQL forms we cannot use DDL statement luke create table, create view etc….
PART-B
Question & Answers for Five marks:
1. Write short notes on procedural languages?(APR. 2016,-2012)
PROCEDURAL LANGUAGE
Procedural language is the generic term used for a traditional programming
language.it specifies the sequence of a set of commands. Every procedural language
contains its own set of elements.
Programming contains two basic components,
logic
programming logic explains the way in which the problem is solved on the structure of
the program.
syntax
syntax refers to the commands and features in the programming language.
variables, computations, standard functions, debug, output, input, loops and arrays.
PL/SQL
PL/SQL is used when we required some procedural features like conditional statement or
iteration loop for processing. In PL/SQL we can retrieve data from tables using select
statement and apply it into some variables. When we are using PL/SQL for writing codes in
SQL forms, we cannot use DDL statement like , create view, create table etc…
Structure of PL/SQL
Syntax:
Declare
<declaration section>
Begin
<body of the program(execution part)>
End
Declare variables
Syntax to declare variables,
< var -name><var type>
Example
We required a variable to store the student mark, in this case we can declare a variable
named student_ mark as numeric variable.
Here is the syntax,
Student_ mark number;
Initializing variable
When you declare a variable you can do initialize it with default value like below,
Declare
In some cases we may require a variable’s data type same as what we have in the table. In
that case we can declare a variable using % type like below
Example
<variable name ><table name ><column name> % type;
Declare
Student_ name tbl student. Name% type;
Syntax to execute the PL/SQL
Sql> @filename
Conditional statement
Like any other programming language we have conditional statement
On PL/SQL also to make some decision based on the conditions,
If<condition>then
<true section>
Else
<false section>
End if
Begin
Select mark1 into stu mark1 from tblname where name=’yogha’;
If(stu_ mark1>100 or stu_ mark<0)then
Raise upper_ limit then
Print(‘invalid mark_ mark should be between 0 to 100’);
end;
when a user defined exception is used in a program, t should be declared at a declared
section. Since upper limit is a user defined exception we have to indicate to the PL/SQL
compiler, when it has to be raised. This is done using the statement,
raise upper_ limit
4.Explain any three controls on form.(APR. 2013)
Labels controls and text boxes
The label is plain text that cannot be changed directly by the user.
Label box creates a field for displaying text. These labels are only for displaying
predefined text. Entries cannot be made in these fields
The text box is used to display data from the data base and to enter the new values.
Text boxes are fields in which the user can enter text. in a form, text boxes displays
data or allow for new data input.
A control that retrieves and stores data in a table is called a bound control because
any data that is changed is automatically stored in the table
Command button
Command buttons have only one function: when the user clicks, an event will be
triggered and some actions will be performed.
Printing a report or running a custom program’
Command button are the main components of switch board forms, where they are
used to open related forms
Check boxes and option buttons:
These controls enable users to select from choice of options.
The option button group was designed for mutually exclusive choices
Option button is used to select only one choice out of several choices
It is denoted by
Check boxes are used during multiple selections.
It is used to select two or more choices out of several choices
7. Explain the human factors design elements for effective design of reports and forms?
(Nov. 2014)
There are some human factor design elements that system designers should transport in their
applications. They are,
User control
With current operating systems, the primary factor is that the users not the programmer and
not the application should always have control. For example do not expect users to enter data
in a particular sequence.
responds to the events or triggers by performing calculations, retrieving or storing data, and
offering new choices. Whenever possible, provide options for user customization,
Examples: changing the display features such as color, typeface, or size
Consistency
To ensure consistency, there are two factors
At the beginning of the application establish a design standard and basic template for
all designers to use
Toward the end of the application development always go back and check for
consistency
Clarity
Clarity means keeping the application simple and well organized. If the application has
multiple forms and reports organize them according to user tasks. It helps to have a clear
purpose for an application and to make sure the design enhances that purpose. Use precise
terminology, avoid jargon and stick with terms that are used within the organization.
Aesthetics
The goal is to use color and design to enhance the forms and reports’
Feedback
Uses of feedback include accepting input, acknowledging changes of data, highliting
completion of a task, or signifying the start or completion of some event
Forgiveness
Designers should provide the users with the possibility of,
Anticipation and corrections of errors and confirmation of deletions and updates
Backup and recovery of data
● Base table/query
● Filters
● sort
Integrity : a second set of properties refers to data integrity
● edits
● additions,deletions
● locks
Format: the third level of properties controls the display of the form
● captions
● scrpll bars
● record selections
● navigation buttons
● size and centering
● background pictures
● colors
● tab order
Graphical features
lines and boxes are often used to create a three dimensional effect for other controls by
adding shadding or highlighting
graphics pachage is used to display image or texture as background in the database
column, then set the picture property of the form to the name of the image file
combo and list boxes
the combo box and list box are usefuk controls in most database applications.
The purpose of these controls is to display a list of items from which the user can choose one
value
Combo box is a combination of drop down or list box.
List box allows the user to select one or more items from a list combined with a
static,multiple line text box
The user clicks inside the box on an item to select it, sometimes in combination with the
shift key or control key in order to make multiple selections
Charts
Charts are also one of the type of control that can be placed on a forms or reports
The first step in creating the chart is to understand with the user exactly what type of data and
what type of chart will be needed. Then build a new sql query that collect the data to be
displayed on the chart
The chart control places the chart on the form and specifices the individual attributes
like type of chart, axis, scale, and colors
Two basic type of chart are used on database forms and reports
The basic concept of improving the user interface is that the application should
reflect the way the user works.
Designing a system that truly reflects the needs of the user requires careful
thought observation and creativity.
You should also study other applications for clues on how to improve your
own project
The first step in designing tell overall application is to identify the various user and
outline the tasks that will be performed with the application.
Designers have learned that some common elements can be used in a many
application.The main menu or switchboard form is an elements that many
developers like to use.
The two primary reasons for identifying each user are (1) to maintain
appropriate security controls and (2) to customize the application for each user
group.
A menu is simply a list of choices that perform some action when selected by the
user. Most menus are hierarchical; that is, detailed choices are presented under a few
keywords.
Oracle and SQL, server support a special type of event. Data triggersare
procedures
that are executed when a command attempts to alter the database itself. For example
you could
create a procedure that is run whenever.
A ‘form event’ is an events that can occur within a form. Events occur for forms
when opening or closing a form, move between forms, or works with data on a form.
Form events returns a numeric value identifying the type of from events that has
occurred. We will use form events form within a form a objects method.
Report is a summarization of data. Report writers are good at formatting data for
common
reports.
Some reports are difficult to create with a report writer, for the we need
specialized
output controls, such as standard generalized makeup language (SGML).
Creating reports with programming is time-consuming, since it is difficult to
modify the code letter.
PART-B
Question & Answers for Five marks:
1. WRITE A SHORT ON CUSTOM REPORT (NOV. 2011,APR. 2012)
Custom reports are reports that you design for a specific purpose and save that
you can generate are report in that custom format at any time you desire. You create
new custom report any time you define a new report or after you modify an existing
custom report. Once you create report, you can recall and use it any time you are in
the report window.
You create a custom report simply by defining a report as you normally would, then
selecting the save button in the report window. The save custom report dialog box
appears allowing you to save your reports. The new report is added to the custom
report name list in the report window. You can then select and run the custom report
at any time.
Form modules contains collection of objects such as windows, blocks, canvas, items,
and event based PL/SQL code. The form modules consists of the components such as
blocks, canvas-views, items, window, PL/SQL code, Triggers, Alerts, and LOV has
and attached libraries Transactions are a group of database commands which are to
be treated as asingle atomic event. Transactions are maintained using the two-phase
commit system. The commit statement in SQL marks the finals step in the processing
of a database transactions. The alternative is to utilize the ROLLBACK command to
cancel the proposed database changes. External events occur at the interface or screen
level.
Second:surveillance and notification system can be put in place, such as lighting, heat
sensors,
Smoke detectors, intrusion detectors, rom accidents, alarms, and cameras.
LOGICAL SECURITY:-
It consists of software safeguards for an organizations ‘s system,
including user identification and password access, authentication access
rights and authority
Levels.
These measures are to ensure that only authorized users are able to
perform action or access information in network or a workstation.
It is a subset of computer security.
User interface design has one identifying characteristic that separates, it form
design areas the principal concern is with the user of the system, not the constraints
of the hardware. This leads us to a common mindset for a UI designer the UI
designer must primarily consider the human factor when designing system.
How not to design:-
Avoid during things just because you have to do know them.
Make your design be driver by requirements.
The event we are going to concentrate on for this tip are form events and, in
particular, the events that occur when a form is opened. A ‘form event’ is an event
that occur within a form. Each occur for forms when opening or closing a form, move
between forms, or work data on a form. Form events returns a numeric value
identifying the type of form events that has just occurred. We will use form within a
form or object method.
When we first open a form, the following events occur in this order:
Open->load->resize->activate->current
Unload->deactivate->close
For objects that receive mouse events, the events occur in this order:
Mousedown->mouseup->click->dblclick
When we double-click a command button, the following events occur in this order:
Mousedown->mouseup->click->dblclick->mouseup->click
Microsoft access:-
Application format
Standard mde file
Encrypted mde file
PART-C
The user interface is the view of a database interface that is seeing by the user.
User interface are often graphical or at least partly graphical. The three features of
User interface are
Menus
Toolbars
Help system
Menu:-
A menu is a list of commands or option available to users. Most menus are hierarchical.
Menus are often displayed from a menu bar. A list of labeled menu categories
located near
The top of a window. A context menu drops down when user rights click on an
objects or
Window region.
Creating menus:-
Benefit of menus:-
Toolbar:-
The toolbar is a set of icons or buttons that are part of a software. A toolbar
Typically paced directly under the menu bar. When the user clicks a toolbar button.
A predefine operation is executed. Toolbar are drag able which means user
can drag
Them into any place on the application window.
Creating toolbars:-
Icons in toolbars:-
Help:-
The first and most important step in creating a help file is to understand what
Information user will need.
The help system may consist of number of html pages. There are many types of file
Formats for being file they are:
Chm-> Microsoft compressed html, help. The chm file is a set of web
pages written in a subset of html. The chm file has a hypertext table of
contents.
Hlp-> Microsoft win help hlp is a properly format for help that can be
displayed by the Microsoft help browser.
Pdf-> printable or portable document format. The pdf file encapsulates
the text, fonts, image and graphics that compose the document.
Rtf or doc-> rigid text format and dco->Microsoft word text processor
are able
To read and write rtf document. Microsoft word document contains text,
fonts and images.
Txt-> clients text file, txt is a computer file which contains only ordinary
textual characters with essentially no formatting. The main disadvantage
of using txt files are no graphics, formatting or navigation.
Context sensitive help-> context sensitive help van be implemented
using tool tips. It provide description of a complete a topic from the help
file.
As much as possible you should use report writer to display the final
report creating reports with programming is time-consuming,
additionally, it is difficult to modify the code later.
If you need to know the characteristics and capabilities of the output
devices. Modern printer support multiple typefaces and various graphics
capabilities. These
Features provide detailed control over the output but significantly
increase the time it takes to program the report.
The first step is to create a query that provide the data on the report. It is
best to use SQL, to join all needed tables. Then you write a program that
starts at the top of the query and examines each row. Your code must
identify the breaks for each group. You should also keep track of the
number of lines so that you can identify the end of the page.
UNIT – V
Question & Answers for Two marks:
1. What is the role of a database administrator? (APR. 2012)
A file server is a computer responsible for the central storage and management
of data files so that other computers on the same network can access the files.
A file server allows users to share information over a network without having to
physically transfer files by floppy diskette or some other external storage device.
In a computer system we have primary and secondary memory storage. Primary memory
storage devices - RAM is a volatile memory which stores disk buffer, active logs, and other
related data of a database.
We can create a copy of primary memory in the database with all the logs and buffers,
and are copied periodically into database. So in case of any failure, we will not lose
all the data. We can recover the data till the point it is last copied to the database.
Analysis. Model the application from the perspective of the real world .
Design. Decide how to build the application from the analysis model.
Implementation. Write the actual database and programming code.
Data conversion. Populate the application database with available data.
Testing. Ensure that the application is suitable for actual use.
Training. Help users master the new application.
Maintenance. Preserve the soundness of the application over the long term.
In the Oracle client/server architecture, the database application and the database are
separated into two parts: a front-end or client portion, and a back-end or server
portion.
The client executes the database application that accesses database information and
interacts with a user through the keyboard, screen, and pointing device such as a
mouse.
The server executes the Oracle software and handles the functions required for
concurrent, shared data access to an Oracle database.
Improved performance
Efficiency
Extensibility (addition of new nodes)
Transparency of distribution
Viruses
Untested
User error
Operator error
Computer misuse
A Disaster plan is a complete list of the steps that the IS department will take if the
disaster hits the information system.
The plan details who is in charge, what steps everyone will take, list contact numbers
etc.
Object oriented databases are also called Object Database Management Systems
(ODBMS).
Object databases store objects rather than data such as integers, strings or real
numbers.
Objects are used in object oriented languages such as Smalltalk, C++, Java, and
others.
PART - B
Question & Answers for Five marks:
A transaction can be defined as a group of tasks. A single task is the minimum processing
unit which cannot be divided further.
ACID Properties
A transaction is a very small unit of a program and it may contain several lowlevel tasks. A
transaction in a database system must maintain Atomicity,Consistency, Isolation,
and Durability − commonly known as ACID properties − in order to ensure accuracy,
completeness, and data integrity.
Atomicity − This property states that a transaction must be treated as an atomic unit,
that is, either all of its operations are executed or none. There must be no state in a
database where a transaction is left partially completed. States should be defined
either before the execution of the transaction or after the execution/abortion/failure of
the transaction.
Consistency − The database must remain in a consistent state after any transaction. No
transaction should have any adverse effect on the data residing in the database. If the
database was in a consistent state before the execution of a transaction, it must remain
consistent after the execution of the transaction as well.
Durability − The database should be durable enough to hold all its latest updates even
if the system fails or restarts. If a transaction updates a chunk of data in a database and
commits, then the database will hold the modified data. If a transaction commits but
the system fails before the data could be written on to the disk, then that data will be
updated once the system springs back into action.
States of Transactions
A transaction in a database can be in one of the following states −
Active − In this state, the transaction is being executed. This is the initial state of
every transaction.
Partially Committed − When a transaction executes its final operation, it is said to be
in a partially committed state.
Failed − A transaction is said to be in a failed state if any of the checks made by the
database recovery system fails. A failed transaction can no longer proceed further.
Aborted − If any of the checks fails and the transaction has reached a failed state, then
the recovery manager rolls back all its write operations on the database to bring the
database back to its original state where it was prior to the execution of the
transaction. Transactions in this state are called aborted. The database recovery
module can select one of the two operations after a transaction aborts −
o Re-start the transaction
o Kill the transaction
Committed − If a transaction executes all its operations successfully, it is said to be
committed. All its effects are now permanently established on the database system.
Isolation − In a database system where more than one transaction are being executed
simultaneously and in parallel, the property of isolation states that all the transactions
will be carried out and executed as if it is the only transaction in the system. No
transaction will affect the existence of any other transaction.
1. Banking
2. Airlines
3. Universities
4. Manufacturing and selling
5. Human resources
The roles of a DBA vary from organization to organization. But the following list shows the
primary activities that many DBAs are charged with:
Back up and recover the database.
Install and configure Oracle software.
Create new databases.
Design the database schema and create any necessary database objects.
Formulate optimal application SQL.
Ensure database security is implemented to safeguard the data.
Work closely with application developers and system administrators to ensure all
database needs are being met.
Apply patches or upgrades to the database as needed.
Creating a basic table involves naming the table and defining its columns and each column's
data type.
The SQL CREATE TABLE statement is used to create a new table.
Syntax:
Basic syntax of CREATE TABLE statement is as follows:
CREATE TABLE table_name(
column1 datatype,
column2 datatype,
column3 datatype,
.....
columnN datatype,
PRIMARY KEY( one or more columns )
);
CREATE TABLE is the keyword telling the database system what you want to do. The
unique name or identifier for the table follows the CREATE TABLE statement.
Then in brackets comes the list defining each column in the table and what sort of data type it
is. The syntax becomes clearer with an example below.
A copy of an existing table can be created using a combination of the CREATE TABLE
statement and the SELECT statement.
Example:
Following is an example, which creates a CUSTOMERS table with ID as primary key and
NOT NULL are the constraints showing that these fields can not be NULL while creating
records in this table:
SQL> CREATE TABLE CUSTOMERS(
ID INT NOT NULL,
NAME VARCHAR (20) NOT NULL,
AGE INT NOT NULL,
ADDRESS CHAR (25) ,
SALARY DECIMAL (18, 2),
PRIMARY KEY (ID)
);
You can verify if your table has been created successfully by looking at the message
displayed by the SQL server, otherwise you can use DESC command as follows:
SQL>DESC CUSTOMERS;
Field Type Null Key Default extra
ID Int(11) No Pri
NAME Varchar(20) No
AGE Int(11) No
ADRESS Char(25) Yes NULL
SALARY Decimal(18,2) yes NULL
Now, you have CUSTOMERS table available in your database which you can use to store
required information related to customers.
Privacy: the right of individuals to have some control over information about themselves
protected by laws in many countriesthese laws can vary significantly Right to privacy can be
protected by the database management system
Accidental Security Threats
User errors
User unintentionally requests object or operation for which he/she should not be
authorized
Communications system errors
User sent a message that should be sent to another user
system connects a user to a session that belongs to another user with different access
privileges
OS errors
Accidentally overwrites files and destroys part of database
Fetches the wrong files and sends them to the user
Fails to erase files that should be erased
Deliberate Security Threats
Sources
User intentionally gains unauthorized access and/or performs unauthorized operations
on the database for personal gain
Disgruntled employee who is familiar with the organization's computer system seeks
revenge (terminated employees are especially dangerous)
Industrial spies seek information for competitors
Methods
Wiretapping of communication lines
Electronic eavesdropping-picking up electronic signals
Reading display screens or printouts left unsupervised
Impersonating authorized users or users with greater access
Writing programs to bypass the DBMS and access database data directly
Writing applications programs that perform unauthorized operations
Deriving information about hidden data by clever querying
Removing physical storage devices from the computer facility
Making copies of stored files without going through the DBMS
Bribing, blackmailing or influencing authorized users to obtain information or
damage the database
Security Plan
Should begin with physical security measures for the building-physical barriers, control
access, require badges, sign-in etc.
Should have more physical security for the computer facilities-e.g. locked door
Additional security control for database
Authentication
User authentication - verifying the identity of users
Operating system uses user profiles, user ids, passwords, authentication procedures,
badges, keys, or physical characteristics of the user
Additional authentication can be required to access the database-additional user ID,
PW
User Profiles
System has a user profile for each id, giving information about the user
Stored profiles should be kept secure, possibly in encrypted form
Profile normally includes a password, allegedly known only to the user
Passwords should be kept secret and changed frequently
System should never display passwords at sign-in time
Horizontal partitioning
Horizontal partitioning divides a table into multiple tables. Each table then contains
the same number of columns, but fewer rows.
For example, a table that contains 1 billion rows could be partitioned horizontally into
12 tables, with each smaller table representing one month of data for a specific year.
Any queries requiring data for a specific month only reference the appropriate table.
Determining how to partition the tables horizontally depends on how data is analyzed.
You should partition the tables so that queries reference as few tables as possible.
Otherwise, excessive UNION queries, used to merge the tables logically at query
time, can affect performance.
Vertical partioning
Vertical partitioning divides a table into multiple tables that contain fewer columns. The two
types of vertical partitioning are normalization and row splitting:
Normalization is the standard database process of removing redundant columns from
a table and putting them in secondary tables that are linked to the primary table by
primary key and foreign key relationships.
Row splitting divides the original table vertically into tables with fewer columns.
Each logical row in a split table matches the same logical row in the other tables as
identified by a UNIQUE KEY column that is identical in all of the partitioned tables.
For example, joining the row with ID 712 from each split table re-creates the original
row.
Stages of Development
Software development consists of a sequence of stages. The following subsections elaborate
on each stage:
Analysis. Model the application from the perspective of the real world
Design. Decide how to build the application from the analysis model
Implementation. Write the actual database and programming code
Data conversion. Populate the application database with available data.
Testing. Ensure that the application is suitable for actual use.
Training. Help users master the new application.
Maintenance. Preserve the soundness of the application over the long term.
Analysis
Modeling is the focus of analysis. Analysis prepares a model of the application from the
perspective of the real world. During analysis, you specify what must be done, not how it
should be done. Analysis is a difficult task in its own right, and developers must fully
understand it before addressing the additional complexities of design.
The preparation of a model and architecture must be interleaved for complex applications.
The architecture helps to establish a model's scope. In turn, modeling reveals important issues
of strategy to resolve. Thus, there is much interplay between the construction of a model and
the model's architecture, and they must happen together.
During analysis, developers consider the available inputs and resolve ambiguities. Often,
business experts are not sure of the precise requirements, and must refine them in tandem
with software development. Modeling quickens the convergence between developers and
business experts because it is much faster to work with multiple iterations of models than
with code. Models highlight omissions and inconsistencies so that they can be resolved.
Design
During design, the focus shifts from an emphasis on the real world to techniques for realizing
the application. Developers address how a problem is to be solved, but they don't descend
into the fine details of the target database and programming language. Thus, during design,
developers should convert a model to relational database tables, for example; but they should
defer the idiosyncrasies of a specific database manager, such as Oracle.
The first step of design is to devise an architecture. For complex problems, you must
coordinate the development of an architecture with an analysis model. Next, you choose a
specific data management approach—whether to use simple files (which suffice for some
applications), a database manager, or possibly something else. Developers then determine the
data structures and algorithms that will realize the model from analysis.
Implementation
Implementation is the stage of writing the actual code. it is at this point that developers must
deal with the nuances of the specific database manager and programming languages that are
being used to construct the system. Developers should take the design model and drive it into
the database structure. Once they establish a sound database, they can write programming
logic and build a user interface. Tools can generate the code for creating an empty database.
Data Conversion
Data conversion adds existing data to a database. Data conversion is often an intricate task;
source databases can be difficult to understand. In addition, the source data structure rarely
matches the target data structure. Many source databases have data flaws that must be
repaired.
Testing
After implementation, the system is complete, but it must be carefully tested before it can be
commissioned for actual use. Hopefully, the ideas that inspired the original project were
nurtured through the previous stages by the use of models. Testers once again look at the
original business requirements and verify that the system delivers the proper functionality.
Testing can also uncover accidental errors (bugs) that were introduced. If an application runs
on multiple hardware and operating system platforms, it should be tested on all of them.
Training
An organization must train users so that it can benefit fully from an application. Training
accelerates users on the software learning curve.
Maintenance
Once development is complete and a system has been deployed, it must be maintained for
continued success. There are several kinds of maintenance. Bugs that remain in the original
system will gradually appear during use and must be fixed. A successful application will also
trigger requests for enhancements, and a long-lived application will occasionally have to be
restructured.
Clustering, in the context of databases, refers to the ability of several servers or instances to
connect to a single database. An instance is the collection of memory and processes that
interacts with a database, which is the set of physical files that actually store data.
Clustering offers two major advantages, especially in high-volume database environments:
Fault tolerance: 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.
Clustering takes different forms, depending on how the data is stored and allocated resources.
The first type is known as the shared-nothing architecture. In this clustering mode, each
node/server is fully independent, so there is no single point of contention. An example of this
would be when a company has multiple data centers for a single website. With many servers
across the globe, no single server is a “master.” Shared-nothing is also known as “database
sharding.”
OUTPUT:
My text goes in paragraphs.
Result Page 1 2
HTML Query
form Templ
Form.html ate
Program
+ Code code
DBMS
Web Server
<body>
<form id="form1" runat="server">
Data <asp:Label ID="PageTitleLabel" runat="server" …
<asp:SqlDataSource ID="CustomerSqlDataSource“
DeleteCommand="DELETE FROM [Customer] …
Data Object
SelectCommand="SELECT [CustomerID], …
Web Browser
UpdateCommand="UPDATE [Customer] SET… Customers
<DeleteParameters>
<asp:Parameter Name="CustomerID" Type="Int32" /> CustomerID 1653
Jones
</DeleteParameters> LastNameMary
FirstName
<asp:FormView ID="CustomersFormView" runat="server“…
DataSourceID="CustomerSqlDataSource">
…
… Save
</asp:FormView> CSS Style Sheet
.PageTitle
</form> {
</body> font-weight: bold;
font-size: larger;
text-align: center;
} 30
PART – C
1. Menu-Based Interfaces for Web Clients or Browsing :These interfaces present the user with
lists of options, called menus, that lead the user through the formulation of a request. Menus
do away with the need to memorize the specific commands and syntax of a query language;
rather, the query is composed step by step by picking options from a menu that is displayed
by the system. Pull-down menus are a very popular technique in Web-based user interfaces.
They are also often used in browsing interfaces, which allow a user to look through the
contents of a database in an exploratory and unstructured manner.
2. Forms-Based Interfaces : A forms-based interface displays a form to each user. Users can fill
out all of the form entries to insert new data, or they fill out only certain entries, in which
case the DBMS will retrieve matching data for the remaining entries. Forms are usually
designed and programmed for naive users as interfaces to canned transactions. Many DBMSs
have forms specification languages, which are special languages that help programmers
specify such forms. Some systems have utilities that define a form by letting the end user
interactively construct a sample form on the screen.
3. Graphical User Interfaces : A graphical interface (CUI) typically displays a schema to the
user in diagrammatic form. The user can then specify a query by manipulating the diagram.
In many cases, CUIs utilize both menus and forms. Most CUIs use a pointing device, such as
a mouse, to pick certain parts of the displayed schema diagram.
4. Natural Language Interfaces : These interfaces accept requests written in English or some
other language and attempt to "understand" them. A natural language interface usually has its
own "schema," which is similar to the database conceptual schema, as well as a dictionary of
important words. The natural language interface refers to the words in its schema, as well as
to the set of standard words in its dictionary, to interpret the request. If the interpretation is
successful, the interface generates a high-level query corresponding to the natural language
request and submits it to the DBMS for processing; otherwise, a dialogue is started with the
user to clarify the request.
5. Interfaces for Parametri c Users : Parametric users, such as bank tellers, often have a small set
of operations that they must perform repeatedly. Systems analysts and programmers design
and implement a special interface for each known class of naive users. Usually, a small set of
abbreviated commands is included, with the goal of minimizing the number of keystrokes
required for each request.
6. Interfaces for the DBA : Most database systems contain privileged commands that can be
used only by the DBA's staff. These include commands for creating accounts, setting system
parameters, granting account authorization, changing a schema, and reorganizing the storage
structures of a database.
3. Describe the three primary data storage methods. (NOV.2014, APR. 2014,APR-
2016,APR. 2012 )
Databases are stored in file formats, which contain records. At physical level, the
actual data is stored in electromagnetic format on some device. These storage devices can be
broadly categorized into three types −
Primary Storage − The memory storage that is directly accessible to the CPU comes under
this category. CPU's internal memory (registers), fast memory (cache), and main memory
(RAM) are directly accessible to the CPU, as they are all placed on the motherboard or CPU
chipset. This storage is typically very small, ultra-fast, and volatile. Primary storage requires
continuous power supply in order to maintain its state. In case of a power failure, all its data
is lost.
Secondary Storage − Secondary storage devices are used to store data for future use or as
backup. Secondary storage includes memory devices that are not a part of the CPU chipset or
motherboard, for example, magnetic disks, optical disks (DVD, CD, etc.), hard disks, flash
drives, and magnetic tapes.
Tertiary Storage − Tertiary storage is used to store huge volumes of data. Since such storage
devices are external to the computer system, they are the slowest in speed. These storage
devices are mostly used to take the back up of an entire system. Optical disks and magnetic
tapes are widely used as tertiary storage.
Memory Hierarchy
A computer system has a well-defined hierarchy of memory. A CPU has direct access to it
main memory as well as its inbuilt registers. The access time of the main memory is
obviously less than the CPU speed. To minimize this speed mismatch, cache memory is
introduced. Cache memory provides the fastest access time and it contains data that is most
frequently accessed by the CPU.
The memory with the fastest access is the costliest one. Larger storage devices offer slow
speed and they are less expensive, however they can store huge volumes of data as compared
to CPU registers or cache memory.
Magnetic Disks
Hard disk drives are the most common secondary storage devices in present computer
systems. These are called magnetic disks because they use the concept of magnetization to
store information. Hard disks consist of metal disks coated with magnetizable material. These
disks are placed vertically on a spindle. A read/write head moves in between the disks and is
used to magnetize or de-magnetize the spot under it. A magnetized spot can be recognized as
0 (zero) or 1 (one).
Hard disks are formatted in a well-defined order to store data efficiently. A hard disk plate
has many concentric circles on it, called tracks. Every track is further divided into sectors. A
sector on a hard disk typically stores 512 bytes of data.
Redundant Array of Independent Disks
RAID or Redundant Array of Independent Disks, is a technology to connect multiple
secondary storage devices and use them as a single storage media.
RAID consists of an array of disks in which multiple disks are connected together to achieve
different goals. RAID levels define the use of disk arrays.
RAID 0
In this level, a striped array of disks is implemented. The data is broken down into blocks and
the blocks are distributed among disks. Each disk receives a block of data to write/read in
parallel. It enhances the speed and performance of the storage device. There is no parity and
backup in Level 0.
RAID 1
RAID 1 uses mirroring techniques. When data is sent to a RAID controller, it sends a copy of
data to all the disks in the array. RAID level 1 is also calledmirroring and provides 100%
redundancy in case of a failure.
RAID 2
RAID 2 records Error Correction Code using Hamming distance for its data, striped on
different disks. Like level 0, each data bit in a word is recorded on a separate disk and ECC
codes of the data words are stored on a different set disks. Due to its complex structure and
high cost, RAID 2 is not commercially available.
RAID 3
RAID 3 stripes the data onto multiple disks. The parity bit generated for data word is stored
on a different disk. This technique makes it to overcome single disk failures.
RAID 4
In this level, an entire block of data is written onto data disks and then the parity is generated
and stored on a different disk. Note that level 3 uses byte-level striping, whereas level 4 uses
block-level striping. Both level 3 and level 4 require at least three disks to implement RAID.
RAID 5
RAID 5 writes whole data blocks onto different disks, but the parity bits generated for data
block stripe are distributed among all the data disks rather than storing them on a different
dedicated disk.
RAID 6
RAID 6 is an extension of level 5. In this level, two independent parities are generated and
stored in distributed fashion among multiple disks. Two parities provide additional fault
tolerance. This level requires at least four disk drives to implement RAID.
10 MARKS
Primary Storage − The memory storage that is directly accessible to the CPU comes
under this category. CPU's internal memory (registers), fast memory (cache), and main
memory (RAM) are directly accessible to the CPU, as they are all placed on the
motherboard or CPU chipset. This storage is typically very small, ultra-fast, and
volatile. Primary storage requires continuous power supply in order to maintain its
state. In case of a power failure, all its data is lost.
Secondary Storage − Secondary storage devices are used to store data for future use or
as backup. Secondary storage includes memory devices that are not a part of the CPU
chipset or motherboard, for example, magnetic disks, optical disks (DVD, CD, etc.),
hard disks, flash drives, and magnetic tapes.
Tertiary Storage − Tertiary storage is used to store huge volumes of data. Since such
storage devices are external to the computer system, they are the slowest in speed. These
storage devices are mostly used to take the back up of an entire system. Optical disks
and magnetic tapes are widely used as tertiary storage.
Memory Hierarchy
A computer system has a well-defined hierarchy of memory. A CPU has direct access to
it main memory as well as its inbuilt registers. The access time of the main memory is
obviously less than the CPU speed. To minimize this speed mismatch, cache memory is
introduced. Cache memory provides the fastest access time and it contains data that is
most frequently accessed by the CPU.
The memory with the fastest access is the costliest one. Larger storage devices offer slow
speed and they are less expensive, however they can store huge volumes of data as
compared to CPU registers or cache memory.
Magnetic Disks
Hard disk drives are the most common secondary storage devices in present computer
systems. These are called magnetic disks because they use the concept of magnetization
to store information. Hard disks consist of metal disks coated with magnetizable
material. These disks are placed vertically on a spindle. A read/write head moves in
between the disks and is used to magnetize or de-magnetize the spot under it. A
magnetized spot can be recognized as 0 (zero) or 1 (one).
Hard disks are formatted in a well-defined order to store data efficiently. A hard disk
plate has many concentric circles on it, called tracks. Every track is further divided
into sectors. A sector on a hard disk typically stores 512 bytes of data.
Redundant Array of Independent Disks
RAID or Redundant Array of Independent Disks, is a technology to connect multiple
secondary storage devices and use them as a single storage media.
RAID consists of an array of disks in which multiple disks are connected together to
achieve different goals. RAID levels define the use of disk arrays.
RAID 0
In this level, a striped array of disks is implemented. The data is broken down into
blocks and the blocks are distributed among disks. Each disk receives a block of data to
write/read in parallel. It enhances the speed and performance of the storage device.
There is no parity and backup in Level 0.
RAID 1
RAID 1 uses mirroring techniques. When data is sent to a RAID controller, it sends a
copy of data to all the disks in the array. RAID level 1 is also calledmirroring and
provides 100% redundancy in case of a failure.
RAID 2
RAID 2 records Error Correction Code using Hamming distance for its data, striped on
different disks. Like level 0, each data bit in a word is recorded on a separate disk and
ECC codes of the data words are stored on a different set disks. Due to its complex
structure and high cost, RAID 2 is not commercially available.
RAID 3
RAID 3 stripes the data onto multiple disks. The parity bit generated for data word is
stored on a different disk. This technique makes it to overcome single disk failures.
RAID 4
In this level, an entire block of data is written onto data disks and then the parity is
generated and stored on a different disk. Note that level 3 uses byte-level striping,
whereas level 4 uses block-level striping. Both level 3 and level 4 require at least three
disks to implement RAID.
RAID 5
RAID 5 writes whole data blocks onto different disks, but the parity bits generated for
data block stripe are distributed among all the data disks rather than storing them on a
different dedicated disk.
RAID 6
RAID 6 is an extension of level 5. In this level, two independent parities are generated
and stored in distributed fashion among multiple disks. Two parities provide additional
fault tolerance. This level requires at least four disk drives to implement RAID.
Two-tier Client / Server architecture is used for User Interface program and
Application Programs that runs on client side. An interface called ODBC(Open
Database Connectivity) provides an API that allow client side program to call the dbms.
Most DBMS vendors provide ODBC drivers. A client program may connect to several
DBMS's. In this architecture some variation of client is also possible for example in
some DBMS's more functionality is transferred to the client including data dictionary,
optimization etc. Such clients are called Data server.
Three-tier Client / Server database architecture is commonly used architecture for web
applications. Intermediate layer called Application server or Web Server stores the web
connectivity software and the business logic (constraints) part of application used to
access the right amount of data from the database server. This layer acts like medium
for sending partially processed data between the database server and the client.
Database administration:-
Database administration is a complex, often thankless chore. The collection of links on
this page will help you keep your DBMS humming along at peak performance.
It consists of technical aspect creating and running the database. The basic task is
performance monitoring, backup and recovery and assigning and controlling security.
Database administrations are trained in detail to installing, configuring and operating
the DBMS.
Database administrator (DBA)
A DBA is a complex software package. Installing, running and upgrading a DBMS are
not trivial task. Even with personal computer based system, this task can be required
the service of fulltime person. Every data requires the service of a DBA which position
is generally staff who is trained in the administration of the particular DBMS.
Or
A database administrator (DBA) directs or performs all activities related to maintaining
a successful database environment. Responsibilities include designing, implementing,
and maintaining the database system; establishing policies and procedures pertaining to
the management, security, maintenance, and use of the database management system;
and training employees in database management and use. A DBA is usually expected to
have experience with one or more of the major database management products, such as
Structured Query Language, SAP, and Oracle-based database management software.
DBA task
o Install & upgrade DBMS
o Create user account and monitor security
o Manage backup and recovery of the database
o Monitor and the tune the database performance
o Co-ordinate with DBMS vender and plan for changes
o Maintains DBMS- specific information’s for developer
General tasks
Installation, configuration, upgrade, and migration
Although system administrators are generally responsible for the hardware and
operating system on a given server, installation of the database software is typically up
to the DBA. This job role requires knowledge of the hardware prerequisites for an
efficient database server, and communicating those requirements to the system
administrator.
Database security
Because databases centralize the storage of data, they are attractive targets for hackers
and even curious employees. The DBA must understand the particular security model
that the database product uses and how to use it effectively to control access to the data.
The three basic security tasks are authentication (setting up user accounts to control
log-ins to the database), authorization (setting permissions on various parts of the
database), and auditing (tracking who did what with the database). The auditing task is
particularly important currently, as regulatory laws like Sarbanes-Oxley and HIPAA
have reporting requirements that must be met.
Storage and capacity planning
The primary purpose of a database is to store and retrieve data, so planning how much
disk storage will be required and monitoring available disk space are key DBA
responsibilities. Watching growth trends are important so that the DBA can advise
management on long-term capacity plans.
Troubleshooting
When things do go wrong with the database server, the DBA needs to know how to
quickly ascertain the problem and to correct it without losing data or making the
situation worse.
b. Database design
The basic goals of the design stage are to identify the user needs and design the
appropriate data tables. Data normalization is the primary database related activity in
this state. The final table definition will also provide better estimates of the storage
requirement.
c. Data implementations
Define standard for application programming. Development of the application and user
interface is the major step. Determine the overall looks and feels of application
programming standard and testing procedure are defined.
d. Database operation and maintains
Once the database is place in operation the DBA performs most of the management
task. The primary tasks are
a. monitor usage & security
b. performs backup and recovery
c. support the users
DBMS QUESTIONS-NOVEMBER
2 MARKS
Viruses
Untested
User error
Operator error
Computer misuse
A Disaster plan is a complete list of the steps that the IS department will take if
the disaster hits the information system.
The plan details who is in charge, what steps everyone will take, list contact
numbers etc.
5 MARKS
Horizontal partitioning
Horizontal partitioning divides a table into multiple tables. Each table then
contains the same number of columns, but fewer rows.
For example, a table that contains 1 billion rows could be partitioned
horizontally into 12 tables, with each smaller table representing one month of
data for a specific year. Any queries requiring data for a specific month only
reference the appropriate table.
Determining how to partition the tables horizontally depends on how data is
analyzed. You should partition the tables so that queries reference as few tables
as possible. Otherwise, excessive UNION queries, used to merge the tables
logically at query time, can affect performance.
Vertical partioning
Vertical partitioning divides a table into multiple tables that contain fewer columns.
The two types of vertical partitioning are normalization and row splitting:
Normalization is the standard database process of removing redundant columns
from a table and putting them in secondary tables that are linked to the primary
table by primary key and foreign key relationships.
Row splitting divides the original table vertically into tables with fewer columns.
Each logical row in a split table matches the same logical row in the other tables
as identified by a UNIQUE KEY column that is identical in all of the partitioned
tables. For example, joining the row with ID 712 from each split table re-creates
the original row.
Stages of Development
Software development consists of a sequence of stages. The following subsections
elaborate on each stage:
Analysis. Model the application from the perspective of the real world
Design. Decide how to build the application from the analysis model
Implementation. Write the actual database and programming code
Data conversion. Populate the application database with available data.
Testing. Ensure that the application is suitable for actual use.
Training. Help users master the new application.
Maintenance. Preserve the soundness of the application over the long term.
Analysis
Modeling is the focus of analysis. Analysis prepares a model of the application from the
perspective of the real world. During analysis, you specify what must be done, not how it
should be done. Analysis is a difficult task in its own right, and developers must fully
understand it before addressing the additional complexities of design.
The preparation of a model and architecture must be interleaved for complex
applications. The architecture helps to establish a model's scope. In turn, modeling
reveals important issues of strategy to resolve. Thus, there is much interplay between
the construction of a model and the model's architecture, and they must happen
together.
During analysis, developers consider the available inputs and resolve ambiguities.
Often, business experts are not sure of the precise requirements, and must refine them
in tandem with software development. Modeling quickens the convergence between
developers and business experts because it is much faster to work with multiple
iterations of models than with code. Models highlight omissions and inconsistencies so
that they can be resolved.
Design
During design, the focus shifts from an emphasis on the real world to techniques for
realizing the application. Developers address how a problem is to be solved, but they
don't descend into the fine details of the target database and programming language.
Thus, during design, developers should convert a model to relational database tables,
for example; but they should defer the idiosyncrasies of a specific database manager,
such as Oracle.
The first step of design is to devise an architecture. For complex problems, you must
coordinate the development of an architecture with an analysis model. Next, you choose
a specific data management approach—whether to use simple files (which suffice for
some applications), a database manager, or possibly something else. Developers then
determine the data structures and algorithms that will realize the model from analysis.
Implementation
Implementation is the stage of writing the actual code. it is at this point that developers
must deal with the nuances of the specific database manager and programming
languages that are being used to construct the system. Developers should take the
design model and drive it into the database structure. Once they establish a sound
database, they can write programming logic and build a user interface. Tools can
generate the code for creating an empty database.
Data Conversion
Data conversion adds existing data to a database. Data conversion is often an intricate
task; source databases can be difficult to understand. In addition, the source data
structure rarely matches the target data structure. Many source databases have data
flaws that must be repaired.
Testing
After implementation, the system is complete, but it must be carefully tested before it
can be commissioned for actual use. Hopefully, the ideas that inspired the original
project were nurtured through the previous stages by the use of models. Testers once
again look at the original business requirements and verify that the system delivers the
proper functionality. Testing can also uncover accidental errors (bugs) that were
introduced. If an application runs on multiple hardware and operating system
platforms, it should be tested on all of them.
Training
An organization must train users so that it can benefit fully from an application.
Training accelerates users on the software learning curve.
Maintenance
Once development is complete and a system has been deployed, it must be maintained
for continued success. There are several kinds of maintenance. Bugs that remain in the
original system will gradually appear during use and must be fixed. A successful
application will also trigger requests for enhancements, and a long-lived application will
occasionally have to be restructured.
Fault tolerance: 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.
Clustering takes different forms, depending on how the data is stored and allocated
resources. The first type is known as the shared-nothing architecture. In this clustering
mode, each node/server is fully independent, so there is no single point of contention. An
example of this would be when a company has multiple data centers for a single website.
With many servers across the globe, no single server is a “master.” Shared-nothing is
also known as “database sharding.”
19. Describe the client/server database. NOV-13
Two-tier Client / Server architecture is used for User Interface program and
Application Programs that runs on client side. An interface called ODBC(Open
Database Connectivity) provides an API that allow client side program to call the dbms.
Most DBMS vendors provide ODBC drivers. A client program may connect to several
DBMS's. In this architecture some variation of client is also possible for example in
some DBMS's more functionality is transferred to the client including data dictionary,
optimization etc. Such clients are called Data server.
DATA BACKUP
In a computer system we have primary and secondary memory storage. Primary
memory storage devices - RAM is a volatile memory which stores disk buffer, active
logs, and other related data of a database. It stores all the recent transactions and the
results too. When a query is fired, the database first fetches in the primary memory for
the data, if it does not exist there, then it moves to the secondary memory to fetch the
record. Fetching the record from primary memory is always faster than secondary
memory. What happens if the primary memory crashes? All the data in the primary
memory is lost and we cannot recover the database.
In such cases, we can follow any one the following steps so that data in the primary
memory are not lost.
We can create a copy of primary memory in the database with all the logs and buffers,
and are copied periodically into database. So in case of any failure, we will not lose all
the data. We can recover the data till the point it is last copied to the database.
We can have checkpoints created at several places so that data is copied to the database.
Suppose the secondary memory itself crashes. What happens to the data stored in it?
All the data are lost and we cannot recover. We have to think of some alternative
solution for this because we cannot afford for loss of data in huge database.
There are three methods used to back up the data in the secondary memory, so that it
can be recovered if there is any failure.
Remote Backup: - Database copy is created and stored in the remote network. This
database is periodically updated with the current database so that it will be in sync with
data and other details. This remote database can be updated manually called offline
backup. It can be backed up online where the data is updated at current and remote
database simultaneously. In this case, as soon as there is a failure of current database,
system automatically switches to the remote database and starts functioning. The user
will not know that there was a failure.
In the second method, database is copied to memory devices like magnetic tapes and
kept at secured place. If there is any failure, the data would be copied from these tapes
to bring the database up.
As the database grows, it is an overhead to backup whole database. Hence only the log
files are backed up at regular intervals. These log files will have all the information
about the transaction being made. So seeing these log files, database can be recovered.
In this method log files are backed up at regular intervals, and database is backed up
once in a week.
There are two types of data backup – physical data backup and Logical data backup.
The physical data backup includes physical files like data files, log files, control files,
redo- undo logs etc. They are the foundation of the recovery mechanism in the database
as they provide the minute details about the transactions and modification to the
database
Logical backup includes backup of logical data like tables, views, procedures, functions
etc. Logical data backup alone is not sufficient to recover the database as they provide
only the structural information. The physical data back actually provides the minute
details about the database and is very much important for recovery.
RECOVERY
A database is a very huge system with lots of data and transaction. The transaction in
the database is executed at each seconds of time and is very critical to the database. If
there is any failure or crash while executing the transaction, then it expected that no
data is lost. It is necessary to revert the changes of transaction to previously committed
point. There are various techniques to recover the data depending on the type of failure
or crash.
Transaction Failure: - This is the condition in the transaction where a
transaction cannot execute it further. This type of failure affects only few
tables or processes. The failure can be because of logical errors in the code or
because of system errors like deadlock or unavailability of system resources to
execute the transactions.
Disk Failure: - these are the issues with hard disks like formation of bad sectors,
disk head crash, unavailability of disk etc.
Creating a basic table involves naming the table and defining its columns and each
column's data type.
The SQL CREATE TABLE statement is used to create a new table.
Syntax:
Basic syntax of CREATE TABLE statement is as follows:
CREATE TABLE table_name(
column1 datatype,
column2 datatype,
column3 datatype,
.....
columnN datatype,
PRIMARY KEY( one or more columns )
);
CREATE TABLE is the keyword telling the database system what you want to do. The
unique name or identifier for the table follows the CREATE TABLE statement.
Then in brackets comes the list defining each column in the table and what sort of data
type it is. The syntax becomes clearer with an example below.
A copy of an existing table can be created using a combination of the CREATE TABLE
statement and the SELECT statement.
Example:
Following is an example, which creates a CUSTOMERS table with ID as primary key
and NOT NULL are the constraints showing that these fields can not be NULL while
creating records in this table:
SQL> CREATE TABLE CUSTOMERS(
ID INT NOT NULL,
NAME VARCHAR (20) NOT NULL,
AGE INT NOT NULL,
ADDRESS CHAR (25) ,
SALARY DECIMAL (18, 2),
PRIMARY KEY (ID)
);
You can verify if your table has been created successfully by looking at the message
displayed by the SQL server, otherwise you can use DESC command as follows:
SQL>DESC CUSTOMERS;
Field Type Null Key Default extra
ID Int(11) No Pri
NAME Varchar(20) No
AGE Int(11) No
ADRESS Char(25) Yes NULL
SALARY Decimal(18,2) yes NULL
Now, you have CUSTOMERS table available in your database which you can use to
store required information related to customers.
In the Oracle client/server architecture, the database application and the
database are separated into two parts: a front-end or client portion, and a back-
end or server portion.
The client executes the database application that accesses database information
and interacts with a user through the keyboard, screen, and pointing device such
as a mouse.
The server executes the Oracle software and handles the functions required for
concurrent, shared data access to an Oracle database.
TWO-TIER CLIENT / SERVER
Two-tier Client / Server architecture is used for User Interface program and
Application Programs that runs on client side. An interface called ODBC(Open
Database Connectivity) provides an API that allow client side program to call the dbms.
Most DBMS vendors provide ODBC drivers. A client program may connect to several
DBMS's. In this architecture some variation of client is also possible for example in
some DBMS's more functionality is transferred to the client including data dictionary,
optimization etc. Such clients are called Data server.
Three-tier Client / Server database architecture is commonly used architecture for web
applications. Intermediate layer called Application server or Web Server stores the web
connectivity software and the business logic (constraints) part of application used to
access the right amount of data from the database server. This layer acts like medium
for sending partially processed data between the database server and the client.
10 MARKS
7. Menu-Based Interfaces for Web Clients or Browsing :These interfaces present the user
with lists of options, called menus, that lead the user through the formulation of a
request. Menus do away with the need to memorize the specific commands and syntax
of a query language; rather, the query is composed step by step by picking options from
a menu that is displayed by the system. Pull-down menus are a very popular technique
in Web-based user interfaces. They are also often used in browsing interfaces, which
allow a user to look through the contents of a database in an exploratory and
unstructured manner.
8. Forms-Based Interfaces : A forms-based interface displays a form to each user. Users
can fill out all of the form entries to insert new data, or they fill out only certain entries,
in which case the DBMS will retrieve matching data for the remaining entries. Forms
are usually designed and programmed for naive users as interfaces to canned
transactions. Many DBMSs have forms specification languages, which are special
languages that help programmers specify such forms. Some systems have utilities that
define a form by letting the end user interactively construct a sample form on the
screen.
9. Graphical User Interfaces : A graphical interface (CUI) typically displays a schema to
the user in diagrammatic form. The user can then specify a query by manipulating the
diagram. In many cases, CUIs utilize both menus and forms. Most CUIs use a pointing
device, such as a mouse, to pick certain parts of the displayed schema diagram.
10. Natural Language Interfaces : These interfaces accept requests written in English or
some other language and attempt to "understand" them. A natural language interface
usually has its own "schema," which is similar to the database conceptual schema, as
well as a dictionary of important words. The natural language interface refers to the
words in its schema, as well as to the set of standard words in its dictionary, to interpret
the request. If the interpretation is successful, the interface generates a high-level query
corresponding to the natural language request and submits it to the DBMS for
processing; otherwise, a dialogue is started with the user to clarify the request.
11. Interfaces for Parametri c Users : Parametric users, such as bank tellers, often have a
small set of operations that they must perform repeatedly. Systems analysts and
programmers design and implement a special interface for each known class of naive
users. Usually, a small set of abbreviated commands is included, with the goal of
minimizing the number of keystrokes required for each request.
12. Interfaces for the DBA : Most database systems contain privileged commands that can
be used only by the DBA's staff. These include commands for creating accounts, setting
system parameters, granting account authorization, changing a schema, and
reorganizing the storage structures of a database.
13. Menu-Based Interfaces for Web Clients or Browsing :These interfaces present the user
with lists of options, called menus, that lead the user through the formulation of a
request. Menus do away with the need to memorize the specific commands and syntax
of a query language; rather, the query is composed step by step by picking options from
a menu that is displayed by the system. Pull-down menus are a very popular technique
in Web-based user interfaces. They are also often used in browsing interfaces, which
allow a user to look through the contents of a database in an exploratory and
unstructured manner.
14. Forms-Based Interfaces : A forms-based interface displays a form to each user. Users
can fill out all of the form entries to insert new data, or they fill out only certain entries,
in which case the DBMS will retrieve matching data for the remaining entries. Forms
are usually designed and programmed for naive users as interfaces to canned
transactions. Many DBMSs have forms specification languages, which are special
languages that help programmers specify such forms. Some systems have utilities that
define a form by letting the end user interactively construct a sample form on the
screen.
15. Graphical User Interfaces : A graphical interface (CUI) typically displays a schema to
the user in diagrammatic form. The user can then specify a query by manipulating the
diagram. In many cases, CUIs utilize both menus and forms. Most CUIs use a pointing
device, such as a mouse, to pick certain parts of the displayed schema diagram.
16. Natural Language Interfaces : These interfaces accept requests written in English or
some other language and attempt to "understand" them. A natural language interface
usually has its own "schema," which is similar to the database conceptual schema, as
well as a dictionary of important words. The natural language interface refers to the
words in its schema, as well as to the set of standard words in its dictionary, to interpret
the request. If the interpretation is successful, the interface generates a high-level query
corresponding to the natural language request and submits it to the DBMS for
processing; otherwise, a dialogue is started with the user to clarify the request.
17. Interfaces for Parametri c Users : Parametric users, such as bank tellers, often have a
small set of operations that they must perform repeatedly. Systems analysts and
programmers design and implement a special interface for each known class of naive
users. Usually, a small set of abbreviated commands is included, with the goal of
minimizing the number of keystrokes required for each request.
18. Interfaces for the DBA : Most database systems contain privileged commands that can
be used only by the DBA's staff. These include commands for creating accounts, setting
system parameters, granting account authorization, changing a schema, and
reorganizing the storage structures of a database.
Stages of Development
Software development consists of a sequence of stages. The following subsections
elaborate on each stage:
Analysis. Model the application from the perspective of the real world
Design. Decide how to build the application from the analysis model
Implementation. Write the actual database and programming code
Data conversion. Populate the application database with available data.
Testing. Ensure that the application is suitable for actual use.
Training. Help users master the new application.
Maintenance. Preserve the soundness of the application over the long term.
Analysis
Modeling is the focus of analysis. Analysis prepares a model of the application from the
perspective of the real world. During analysis, you specify what must be done, not how it
should be done. Analysis is a difficult task in its own right, and developers must fully
understand it before addressing the additional complexities of design.
During analysis, developers consider the available inputs and resolve ambiguities.
Often, business experts are not sure of the precise requirements, and must refine them
in tandem with software development. Modeling quickens the convergence between
developers and business experts because it is much faster to work with multiple
iterations of models than with code. Models highlight omissions and inconsistencies so
that they can be resolved.
Design
During design, the focus shifts from an emphasis on the real world to techniques for
realizing the application. Developers address how a problem is to be solved, but they
don't descend into the fine details of the target database and programming language.
Thus, during design, developers should convert a model to relational database tables,
for example; but they should defer the idiosyncrasies of a specific database manager,
such as Oracle.
The first step of design is to devise an architecture. For complex problems, you must
coordinate the development of an architecture with an analysis model. Next, you choose
a specific data management approach—whether to use simple files (which suffice for
some applications), a database manager, or possibly something else. Developers then
determine the data structures and algorithms that will realize the model from analysis.
Implementation
Implementation is the stage of writing the actual code. it is at this point that developers
must deal with the nuances of the specific database manager and programming
languages that are being used to construct the system. Developers should take the
design model and drive it into the database structure. Once they establish a sound
database, they can write programming logic and build a user interface. Tools can
generate the code for creating an empty database.
Data Conversion
Data conversion adds existing data to a database. Data conversion is often an intricate
task; source databases can be difficult to understand. In addition, the source data
structure rarely matches the target data structure. Many source databases have data
flaws that must be repaired.
Testing
After implementation, the system is complete, but it must be carefully tested before it
can be commissioned for actual use. Hopefully, the ideas that inspired the original
project were nurtured through the previous stages by the use of models. Testers once
again look at the original business requirements and verify that the system delivers the
proper functionality. Testing can also uncover accidental errors (bugs) that were
introduced. If an application runs on multiple hardware and operating system
platforms, it should be tested on all of them.
Training
An organization must train users so that it can benefit fully from an application.
Training accelerates users on the software learning curve.
Maintenance
Once development is complete and a system has been deployed, it must be maintained
for continued success. There are several kinds of maintenance. Bugs that remain in the
original system will gradually appear during use and must be fixed. A successful
application will also trigger requests for enhancements, and a long-lived application will
occasionally have to be restructured.
Databases are stored in file formats, which contain records. At physical level, the actual
data is stored in electromagnetic format on some device. These storage devices can be
broadly categorized into three types −
Primary Storage − The memory storage that is directly accessible to the CPU comes
under this category. CPU's internal memory (registers), fast memory (cache), and main
memory (RAM) are directly accessible to the CPU, as they are all placed on the
motherboard or CPU chipset. This storage is typically very small, ultra-fast, and
volatile. Primary storage requires continuous power supply in order to maintain its
state. In case of a power failure, all its data is lost.
Secondary Storage − Secondary storage devices are used to store data for future use or
as backup. Secondary storage includes memory devices that are not a part of the CPU
chipset or motherboard, for example, magnetic disks, optical disks (DVD, CD, etc.),
hard disks, flash drives, and magnetic tapes.
Tertiary Storage − Tertiary storage is used to store huge volumes of data. Since such
storage devices are external to the computer system, they are the slowest in speed. These
storage devices are mostly used to take the back up of an entire system. Optical disks
and magnetic tapes are widely used as tertiary storage.
Memory Hierarchy
A computer system has a well-defined hierarchy of memory. A CPU has direct access to
it main memory as well as its inbuilt registers. The access time of the main memory is
obviously less than the CPU speed. To minimize this speed mismatch, cache memory is
introduced. Cache memory provides the fastest access time and it contains data that is
most frequently accessed by the CPU.
The memory with the fastest access is the costliest one. Larger storage devices offer slow
speed and they are less expensive, however they can store huge volumes of data as
compared to CPU registers or cache memory.
Magnetic Disks
Hard disk drives are the most common secondary storage devices in present computer
systems. These are called magnetic disks because they use the concept of magnetization
to store information. Hard disks consist of metal disks coated with magnetizable
material. These disks are placed vertically on a spindle. A read/write head moves in
between the disks and is used to magnetize or de-magnetize the spot under it. A
magnetized spot can be recognized as 0 (zero) or 1 (one).
Hard disks are formatted in a well-defined order to store data efficiently. A hard disk
plate has many concentric circles on it, called tracks. Every track is further divided
into sectors. A sector on a hard disk typically stores 512 bytes of data.
Redundant Array of Independent Disks
RAID or Redundant Array of Independent Disks, is a technology to connect multiple
secondary storage devices and use them as a single storage media.
RAID consists of an array of disks in which multiple disks are connected together to
achieve different goals. RAID levels define the use of disk arrays.
RAID 0
In this level, a striped array of disks is implemented. The data is broken down into
blocks and the blocks are distributed among disks. Each disk receives a block of data to
write/read in parallel. It enhances the speed and performance of the storage device.
There is no parity and backup in Level 0.
RAID 1
RAID 1 uses mirroring techniques. When data is sent to a RAID controller, it sends a
copy of data to all the disks in the array. RAID level 1 is also calledmirroring and
provides 100% redundancy in case of a failure.
RAID 2
RAID 2 records Error Correction Code using Hamming distance for its data, striped on
different disks. Like level 0, each data bit in a word is recorded on a separate disk and
ECC codes of the data words are stored on a different set disks. Due to its complex
structure and high cost, RAID 2 is not commercially available.
RAID 3
RAID 3 stripes the data onto multiple disks. The parity bit generated for data word is
stored on a different disk. This technique makes it to overcome single disk failures.
RAID 4
In this level, an entire block of data is written onto data disks and then the parity is
generated and stored on a different disk. Note that level 3 uses byte-level striping,
whereas level 4 uses block-level striping. Both level 3 and level 4 require at least three
disks to implement RAID.
RAID 5
RAID 5 writes whole data blocks onto different disks, but the parity bits generated for
data block stripe are distributed among all the data disks rather than storing them on a
different dedicated disk.
RAID 6
RAID 6 is an extension of level 5. In this level, two independent parities are generated
and stored in distributed fashion among multiple disks. Two parities provide additional
fault tolerance. This level requires at least four disk drives to implement RAID.
DATA CLUSTERING
Clustering, in the context of databases, refers to the ability of several servers or
instances to connect to a single database. An instance is the collection of memory and
processes that interacts with a database, which is the set of physical files that actually
store data.
Clustering offers two major advantages, especially in high-volume database
environments:
Fault tolerance: 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.
Clustering takes different forms, depending on how the data is stored and allocated
resources. The first type is known as the shared-nothing architecture. In this clustering
mode, each node/server is fully independent, so there is no single point of contention. An
example of this would be when a company has multiple data centers for a single website.
With many servers across the globe, no single server is a “master.” Shared-nothing is
also known as “database sharding.”
DATA PARTIONING
Partitioning a database improves performance and simplifies maintenance.
By splitting a large table into smaller, individual tables, queries that access only
a fraction of the data can run faster because there is less data to scan.
Maintenance tasks, such as rebuilding indexes or backing up a table, can run
more quickly.
Horizontal partitioning
Horizontal partitioning divides a table into multiple tables. Each table then
contains the same number of columns, but fewer rows.
For example, a table that contains 1 billion rows could be partitioned
horizontally into 12 tables, with each smaller table representing one month of
data for a specific year. Any queries requiring data for a specific month only
reference the appropriate table.
Determining how to partition the tables horizontally depends on how data is
analyzed. You should partition the tables so that queries reference as few tables
as possible. Otherwise, excessive UNION queries, used to merge the tables
logically at query time, can affect performance.
Vertical partioning
Vertical partitioning divides a table into multiple tables that contain fewer columns.
The two types of vertical partitioning are normalization and row splitting:
Normalization is the standard database process of removing redundant columns
from a table and putting them in secondary tables that are linked to the primary
table by primary key and foreign key relationships.
Row splitting divides the original table vertically into tables with fewer columns.
Each logical row in a split table matches the same logical row in the other tables
as identified by a UNIQUE KEY column that is identical in all of the partitioned
tables. For example, joining the row with ID 712 from each split table re-creates
the original row.
Stages of Development
Software development consists of a sequence of stages. The following subsections
elaborate on each stage:
Analysis. Model the application from the perspective of the real world
Design. Decide how to build the application from the analysis model
Implementation. Write the actual database and programming code
Data conversion. Populate the application database with available data.
Testing. Ensure that the application is suitable for actual use.
Training. Help users master the new application.
Maintenance. Preserve the soundness of the application over the long term.
Analysis
Modeling is the focus of analysis. Analysis prepares a model of the application from the
perspective of the real world. During analysis, you specify what must be done, not how it
should be done. Analysis is a difficult task in its own right, and developers must fully
understand it before addressing the additional complexities of design.
During analysis, developers consider the available inputs and resolve ambiguities.
Often, business experts are not sure of the precise requirements, and must refine them
in tandem with software development. Modeling quickens the convergence between
developers and business experts because it is much faster to work with multiple
iterations of models than with code. Models highlight omissions and inconsistencies so
that they can be resolved.
Design
During design, the focus shifts from an emphasis on the real world to techniques for
realizing the application. Developers address how a problem is to be solved, but they
don't descend into the fine details of the target database and programming language.
Thus, during design, developers should convert a model to relational database tables,
for example; but they should defer the idiosyncrasies of a specific database manager,
such as Oracle.
The first step of design is to devise an architecture. For complex problems, you must
coordinate the development of an architecture with an analysis model. Next, you choose
a specific data management approach—whether to use simple files (which suffice for
some applications), a database manager, or possibly something else. Developers then
determine the data structures and algorithms that will realize the model from analysis.
Implementation
Implementation is the stage of writing the actual code. it is at this point that developers
must deal with the nuances of the specific database manager and programming
languages that are being used to construct the system. Developers should take the
design model and drive it into the database structure. Once they establish a sound
database, they can write programming logic and build a user interface. Tools can
generate the code for creating an empty database.
Data Conversion
Data conversion adds existing data to a database. Data conversion is often an intricate
task; source databases can be difficult to understand. In addition, the source data
structure rarely matches the target data structure. Many source databases have data
flaws that must be repaired.
Testing
After implementation, the system is complete, but it must be carefully tested before it
can be commissioned for actual use. Hopefully, the ideas that inspired the original
project were nurtured through the previous stages by the use of models. Testers once
again look at the original business requirements and verify that the system delivers the
proper functionality. Testing can also uncover accidental errors (bugs) that were
introduced. If an application runs on multiple hardware and operating system
platforms, it should be tested on all of them.
Training
An organization must train users so that it can benefit fully from an application.
Training accelerates users on the software learning curve.
Maintenance
Once development is complete and a system has been deployed, it must be maintained
for continued success. There are several kinds of maintenance. Bugs that remain in the
original system will gradually appear during use and must be fixed. A successful
application will also trigger requests for enhancements, and a long-lived application will
occasionally have to be restructured.