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

Database

The document provides a comprehensive overview of data management concepts, including definitions of records, files, and databases, as well as various types of files and database models. It discusses the roles and functions of Database Management Systems (DBMS), including their objectives, advantages, and disadvantages. Additionally, it covers fundamental database concepts such as relations, views, indexes, and the responsibilities of a data administrator.

Uploaded by

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

Database

The document provides a comprehensive overview of data management concepts, including definitions of records, files, and databases, as well as various types of files and database models. It discusses the roles and functions of Database Management Systems (DBMS), including their objectives, advantages, and disadvantages. Additionally, it covers fundamental database concepts such as relations, views, indexes, and the responsibilities of a data administrator.

Uploaded by

danialahmed473
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

Record : A collection of related fields (facts about something) treated as a single unit

 Class XII – Computer Science – is called a record. Let us see one student’s biographic information (record) :
Roll Number 13-3101
Notes Student Name Muhammad Saleem
Class XI
 Practicals File : A collection of related records treated as a single unit is called a file or a data
set. Records of all the students together, make a file.

Q : 01-02-02 : Explain Types of File from Usage Point of View ?


 Chapter 01 : Data Basics Answer :
Master File : These are the latest updated files which never become empty, ever since
1.1 Overview they are created. They maintain information that remains constant over a long period
of time.
Q : 01-01-01 : Define Data, Information and Explain Operations on Transaction File : Files in which data prior to the stage of processing is recorded. It
Data ? may be temporary file, retained till the master file is updated.
Answer : Backup File : Permanent files, for the purpose of protection of vital data.
Data : Data is a collection of facts, figures and statistics - related to an object, that can
be processed to produce a meaningful information. Q : 01-02-03 : Explain Types of File from Functional Point of View
Information : The manipulated and processed data is called information e.g., the ?
percentage of students results. It is an output of a certain process. Answer :
Operations : Manipulation of data (after capturing from different sources) to achieve Program Files : These files contain the software instructions i.e. source program files
the required objectives and results. For this purpose, a software (program) is used to and executable files. The source program files may have the extension as .cpp and the
process raw data which is converted to meaningful information. executable files as .exe.
These are categorized into three basic activities : Data Files : These files contain data and are created by the software being used. A few
Data Capturing : Data must be recorded or captured in some form before it can of these are : Word Processor .doc, .rtf (document), Spread Sheet .xls and .wks
be processed. (worksheet), Video files .avi, .mpg etc.
Data Manipulation : The following operations may then be performed on the
gathered data. Q : 01-02-04 : Explain Types of File from Storage (File
Classifying : Organizing data into classes /groups. Items may be assigned Organization) Point of View ?
predetermined codes, they can be numeric, alphabetic or alphanumeric. Answer :
Calculations : Arithmetic manipulation of the data. File Organization (Storage Point of View) :
Sorting : Data is arranged in logical sequence (numerically or Sequential Files : Files are stored or created on the storage media in the order the
alphabetically). records are entered i.e., one after another in the sequence.
Summarizing : Masses of data are reduced to a more concise and usable Direct or Random Files : These files reside on the storage media according to the
form. address which is calculated against the value of the key field of the record.
Managing The Output Results : Once the data is captured & manipulated it Indexed Sequential : The key field of the records (in a file) are stored separately
may be : along with the address of each record. These require relatively more space on the
Storing and Retrieval : Data is retained for future reference. Accessing / storage media but the processing is as fast as random / direct files.
fetching the stored data and / or information is the Retrieve Activity.
Communication and Reproduction : Data may be transferred from one 1.3 Databases
location or operation to another, for further processing. It is sometimes
necessary to copy or to make duplicate of data, called Reproduction. Q : 01-03-01 : Define & Explain Database ?
Answer :
1.2 Traditional File System Database : A database is a collection of logically related data sets or files. For
example;
Q : 01-02-01 : Define and Explain Record and File ? A bank may have separate files for its clients i.e.
Answer :

1 2
Savings A/C
Automobile loan
Personal loan
Clients biographic information etc.
The bank’s clients / customer database would include records from each of these files.
Using a series of programs, data for any client may be added, retrieved or updated
depending upon the activity at a particular time. The user of the database normally has
following facilities :
Adding new, blank files to the database.
Relational Model : Collection of simple files/Relations (Entities), each of which has
Inserting new data into the existing files.
no structural or physical connection like hierarchical or network systems. The various
Retrieving data from existing files.
entities possess the interrelationships as depicted by a network like diagram but these
Updating data in existing files.
relationships are based on the data content of the entities involved.
Deleting data from existing files.
Removing existing files, empty or otherwise from the database.

Q : 01-03-02 : Explain Database Objectives ?


Answer :
Data Integration : Information is coordinated from different files and operated on a
single file.
Data Integrity : If a data item is contained in more than one file, then all files must be
updated if that item is changed.
Data Interdependence : When the format of a file is changed, then all the programs 1.4 Database Management System
have to be changed. However, a database allows the organization of data to be
changed without the need to re-program. It allows programs to be modified without re- Q : 01-03-03 : Describe Database Management System (DBMS) and
organization of data. state Objectives of DBMS ?
Answer :
Q : 01-03-03 : Explain Various Types of Database Models ? Database Management System (DBMS) : The data management system (a collection
Answer : of programs) which is used for storing and manipulating databases is called database
Hierarchical Model : This Model has the general shape or appearance of an management system (DBMS). DBMS software (database manager) controls the
Organizational Chart. A node on the chart, is subordinate at the next highest level, just overall structure of a database and access to the data itself.
as on an organizational chart, an employee reports to only boss. Objectives of Database Management System (DBMS) :
Share Ability : Different people and processes must be able to use the same data at
the same time.
Availability : Both the data and DBMS must be easily accessible to the users.
Evolvability : The ability of the DBMS to change in response to growing user needs
and advancing technology.
Database Integrity : Since data is shared among multiple users, adequate integrity
control measures must be maintained.

Q : 01-03-03 : Describe Advantages of Database Management


System (DBMS) ?
Network Model : Similar to Hierarchical model but subordinate entities, depicted by
Answer :
arrows on the network diagram, may participate in as many subordinate relationships
Advantages of Database Systems :
as desired.
Data Independence : Application programs are not aware of the physical
implementation of the data sets. The DBMS sits in between the application programs
and the actual data sets that make up the database.
Support Complex Data Relationships : Fairly complex structures can be designed

3 4
which allow various ways to logically access the data. the query is in the form of a sentence or English-like command i.e., SELECT,
Sophisticated Data Security Features : Provide enhanced security mechanisms for DELETE, CREATE, MODIFY, UPDATE and INSERT commands.
access to data. Data base security mechanisms typically go much further in adding Report Generator : A report generator is a program that is used to produce an on-
more extensive security features. screen or printed document from the database. The report format can be specified in
Data Base Backup / Recovery : Provide sophisticated backup / recovery mechanism. advance i.e., row headings, column headings, page headers etc. Even the non-experts
Backup / Recovery capabilities often distinguish between true DBMS and a software can create very useful and attractive reports by using this facility.
package that only claims this facility. Access Security : By using this facility, the database administrators can assign
Advanced Capabilities : DBMS normally have advance access capability for on-line specific access privileges for the users of the databases.
and ad-hoc reporting capabilities. Backup and Recovery : It is an important feature available in almost all the DBMS
programs. By using this feature, we are able to have the backup of our data and can
Q : 01-03-03 : Describe Disadvantages of Database Management later, use it to reinstate it in case of data failure, corruption or loss.
System (DBMS) ?
Answer :
Disadvantages of Database Systems :
Require additional System Overhead : Additional overhead is required to access
data, in case of doing some simple jobs; like reading and processing a tape file, which
might take a little time and resources to do the job. If we have to do it on DBMS, it is
like “requiring too much to do too little”.
Additional Training Required for Training of Staff : Application programmers
require a sort of precise training to code efficient programs that will run under a
DBMS.
Problems can multiply in selecting a wrong type of Database Environment : A
later change in structure, forced by changing requirements, can be costly in terms of
conversion and testing of existing programs.
Data must be considered a Corporate Resource : The data in a company’s database
no longer belong to one organization alone. One organization normally has the
primary responsibility for creating a database, many can share the same data across
applications.
A Need of a Dictionary : To share data across application systems, the internal data
contents of a company’s databases need to be documented in a consistent manner, thus
another overhead on the DBMS.

Q : 01-03-03 : Describe Features of Database Management System


(DBMS) ?
Answer :
Features of a DBMS :
Data Dictionary : Some databases have a data dictionary, a procedures document or
disk file that stores the data definitions or a description of the structure of data used in
the database. The data dictionary may monitor the data being entered to make sure it
conforms to the data definition rules i.e., file names, field names, field sizes, data
types etc. It may be used for data access authorization for the database users.
Utilities : The DBMS utilities are the sofiware programs that are used to maintain the
database by manipulating the data, records and ifies. Some programs are also used for
backup and recovery procedures of the databases.
Query Language : Normally, SQL (Structured Query Language) is used for creating
table structures, entering data into them and retrieving/updating the selected records,
based on the particular criteria and format indicated, within the databases. Typically,

5 6
Q : 02-03-02 : Describe Properties of Relation ?
 Chapter 02 : Basic Concepts & Terminology of Answer :
Databases Properties of Relation : A Relation or a Table which is the basis of a Relational
DBMS, by definition must have certain inherent characteristics that form the basic for
2.1 Overview its underlying strength and flexibility. Because of these features, an application
implemented by using such a system is much more flexible and can be easily modified
Q : 02-01-01 : Define Field, Record and File ? when alterations or enhancements to the underlying data base take place. These
Answer : characteristics are :
Field : A field is a unit of data consisting of one or more characters i.e., Roll Number, No Duplicate Rows Exist : No two rows can be identical. Why to put two rows
Student Name, Grade etc. (records) for the same entity (i.e. person). It will also violate the definition of what a
Record : A collection of related data items treated as a single unit is called a record. relation represents, as it says by definition that their must be a unique key for each row
File : A collection of related records treated as a single unit is called a file or a data in a relation / table.
set. The Order of Rows is Insignificant : There is no ordering or sequencing of the rows
in the tables. The relational implementation of the tables support all required access
2.2 Attributes, Rows and Tables mechanism i.e., it is not necessary to sequence the rows according to the key field.
The Order of Columns is Insignificant : Again, the order of the columns/attributes
Q : 02-02-01 : Define Data Elements, Records, Files or Datasets and in defining a relation/table has no significance. The later insertions of the columns are
Databases ? made at end of the existing columns by the system itself. The system acquires the data
Answer : (of columns) by their names.
Data Elements : The fields or data items in databases are termed as data items, items, Columns / Attributes are all Elemental or Atomic : All the intersections of Rows
attributes or columns in database structures. and Columns must have a nulls are inserted by the system at the time of column,
Records : Records in file management structures are termed as rows or tuples in which should immediately be replaced by zeros / spaces valid values for that particular
database structures. column.
Files or Datasets : Files or Datasets in databases are termed as tables relations or data
objects in database structures. 2.4 Views
Database : The collection of tables with some traditional files and some other
necessary data objects is termed as a database. Q : 02-04-01 : Describe Views ?
Answer :
2.3 Relation or Table Views : Views are created by using SQL, which is a powerful database language, used
for data definition and data manipulation purposes. The purpose of using views is
Q : 02-03-01 : Define Relation or Table and describe Entity ? purely to keep the data safe and secure from un-authorized and illegal users. The
Answer : views provide the descriptions of relations that are not stored, but constructed as
Relation or Table : A two dimensional array or table of data containing descriptive needed from stored relations. To create a view, normally the following CREATE SQL
information about an entity. The entity must have a unique identifier, which is command is used :
composed of a combination of one or more attributes, and each attribute must have CREATE VIEW STUDENT_VIEW_01 AS
one and only one value. It is appropriate to define the word Entity here. SELECT STUDENT_NO, STUDENT_NAME,
Entity : An entity is any thing about which you want to keep information in the STUDENT_ADDRESS
database: Let us consider an example of “Student Information System”, which has FROM STUDENT
entities like student, teacher, course list, scholarships, time-tabling. Thus, the entities WHERE STUDENT_GENDER_CD = “M”;
involved in this case are the same and the entity “student” can be defined in the form This will create a view from the STUDENT table for only male students, which can be
of database modeling : used by the users according to the authorization given to them, leaving the original
STUDENT (STUDENT_NO, STUDENT_NAME, STUDENT_GENDER_CD, table aside, safe and secure.
STUDENT_BIRTH_DATE, STUDENT_ADDRESS, STUDENT_TEL_NO)
From the above given definition of entity, we can easily construct a two- dimensional 2.5 Indexes
array or a relation by converting all the attributes in the brackets into columns of the
array. Q : 02-05-01 : Describe Indexes ?
Answer :

7 8
Indexes : It is another table created by the system developer / DBA containing the key the computer systems, but instead, he should be aware of the installed software he
attributes of the table for which the Index is created. It has a very vital role in the intends to use.
database management systems, especially in RDBMS. The important associations
defined in the system make use of this. It helps the system run smooth and fast. 2.8 The Data Administrator

2.6 Keys Q : 02-08-01 : Define The Data Administrator ?


Answer :
Q : 02-06-01 : Define Key ? Describe Types of Keys ? The Data Administrator : A data administrator (DA) is responsible for the entire data
Answer : of an organization. He normally develops the overall functional requirements for the
Key : A key is a single or combination of one or more fields and its purpose is to databases being used m the office. He shares in developing the logical design for each
point/retrieve the data rows from the tables, according to the requirement. Keys are database. He should control and manage the databases, establish the data standards,
defined in the relations / tables to access or sequence the stored data fast and smooth supervise the data distribution within the organization and communicate with the users
or to create the links between them. when necessary. He should also participate in developing the data dictionary, prepare
Types of Keys : documentation and conduct user training where needed. Normally, the Data
Primary Key : In a relation, the attribute (column) or a combination of attributes Administrator serves as a bridge between users and data processing staff.
(columns) that uniquely identifies a row or a record. STUDENT_NO is the attribute
that uniquely identifies each student and thus can be used as a Primary key. On the 2.9 The Database Administrator
other hand, STUDENT_NAME is normally not unique, so it can not be used as a
primary key. Q : 02-09-01 : Define The Database Administrator ?
Secondary Key : A secondary key is non-unique field that is used as a Answer :
secondary(alternate) key. We can scan the records from the table using secondary key. The Database Administrator (DBA) : A database administrator (DBA) is
Candidate Key / Alternate Key : Sometimes, it is unclear which field to select as the responsible for the design, implementation, operation, management and maintenance
primary key. There might exist some additional field (or combination of fields) that of the database. He / She must be technically expert on the overall intricacies of the
also have the uniqueness property. These keys can be termed as Candidate keys or database and DBMS. He is supposed to plan, coordinate and carry out a variety of jobs
Alternate keys. during all phases of the database projects. He must possess the technical skills because
Composite / Concatenate Key : These keys consists of two or more data elements or he has to work on the complex software and hardware issues involved and to solve the
attributes. Invariably, these are the same as Candidate / Alternate keys except that of problems of the system and application experts in the organization. He is also
uniqueness requirement. In order to make it unique, assign STATUS or another responsible to make sure the database access rights, to safeguard its security and to
attribute. maintain and fine-tune the database functionality.
Sort / Control Key : A Sort / Control key is used to physically sequence the stored
date according to our need. Multiple attributes can be used as sort fields.
Foreign Key : A foreign key is an attribute in a table whose values must match a
primary key in another table. The table in which the foreign key is found is called as
dependent table and to which it refers is called as parent table.
Important Note : Foreign key relationships are the basis for establishing 1:1 or 1:M
relationships across the Relations / Tables in a Relational Database Management
System (RDBMS).

2.7 The User

Q : 02-07-01 : Define User ?


Answer :
User : The user or end-user is simply a person who uses the computers for his specific
need. He might have a moderate knowledge of computers, computer science and
information technology, and his need to use the computers may be entertainment,
education, or professional tasks. He does not need to know the in-depth knowledge of

9 10
Cardinality : Whether some occurrence(s) of object-1 are related to some
 Chapter 03 : Database Design Process occurrence(s) of object-2. It is expressed as one or many. A relationships can be One
to One, One to Many, Many to Many, Recursive and None.
3.1 Overview
Modality : It defines the nature of the relationship :
Optional …….. represented by 0
Q : 03-01-01 : Define Feasibility Study, Requirements Analysis,
Mandatory …….. represented by 1
Project Planning and Data Analysis ?
Consider two objects Customer and Repair Action in a Workshop environment :
Answer :
Feasibility Study : This is also called preliminary investigation of the required
database. It involves the area identification and selection i.e. which area or aspect is to
be selected to start with. After the project is selected, it is allocated a specific find and
a proper planning is chalked out for its practical implementation. Side by side, a
proper market analysis is also worked out.
Requirements Analysis : During this activity, the requirements are gathered i.e. the
possible inputs for the database and the required functionality out of it. The users
precisely narrate their needs of the database and the possible domain and restrictions
are also chalked out.
Project Planning : A proper schedule is laid down to accomplish this activity. All the
cost factors are taken into consideration i.e., the salaries of team members, theft
logistics involved, other trivial expenses (such as marriage gifts, insurances etc) and
hardware costs.
Data Analysis : This is an important analysis aspect while designing a database. It
involves :
Data Flow Diagrams (DFD)
Decision Tables A simple Data Model can be drawn from the above as :
Decision Trees

3.2 Data Modeling

Q : 03-02-01 : Describe Ingredients of Data Modeling ?


Q : 03-02-01 : Describe Entities / Objects, Attributes , Relationships, By connecting all the Data Objects along with their Relationships in the above
Cardinality, Modality and ERD (Entity Relationship Diagram) ? manner, an ERD (Entity Relationship Diagram) is constructed.
Answer :
Ingredients of Data Modeling :
Entities / Objects : [A data entity / object is anything that is participating in the
system. It is always properly identifiable] i.e., a TEACHER, a STUDENT, an
AEROPLANE.
Attributes : [Attributes define the objects, describe their characteristics and in some
cases, make references to other objects(s)] i.e., attributes for a TEACHER could be:
Teacher Name, Gender, Last Degree, Appointment Date, Pay Scale, Nationality,
Telephone No. etc.
Relationships : [The relationship indicates how the Entities/Objects are Connected or
Related to each other]. The Data objects are related / connected to one another in
different ways. Important to note are :
All the relationships define the relevant connections between both objects.
All the relationships are bi-directional.
We have to consider only the relevant relationship (in the context of the
requirement).
11 12
3.3 Database Design Q : 03-03-02 : Explain Conceptual (Logical) Database Design ?
Q : 03-03-01 : Describe major objective of Database Design ? Answer :
Explain Database Development process with diagram ? Conceptual (Logical) Database Design : [The process of mapping the conceptual
Answer : data models (from analysis) to structures that are specific to the target DBMS]. If the
Major Objective of Database Design : [To map the conceptual data model to an target environment is a relational DBMS, then the conceptual data models are mapped
implementation model that a particular DBMS can process with performance that is to normalized relations. Diagram below presents an overview of logical design process
acceptable to all users throughout the organization]. Today, database users require :
information that is complete and up-to-date and they expect to be able to access this Conceptual Data Model
information quickly and easily. The Database Development process in diagram : (E-R Diagram)

13 14
Answer :
Physical Database Design : [To implement the database as a set of stored records,
files, indexes and other data structures that will provide adequate performance and
ensure database integrity, security and recoverability].
There are three major inputs to Physical database design :
Logical Database Structures : Developed during logical database design i.e.,
the Normalized Relations.
User Processing Requirements : The size and frequency of use of the Data-
Base, response time, security, backup, recovery etc.
Characteristics of the DBMS and other components of the computer Operating
environment.

Q : 03-03-04 : Explain Components of Physical Database Design ?


Answer :
Components of Physical Database Design :
Data Volume and Usage Analysis : To estimate the size or volume and the usage
patterns of the database. Estimates of database size are used to select Physical storage
devices and estimate the costs of storage. Estimates of usage paths or patterns are used
to select the file organization and access methods, to plan for the use of indexes and to
plan a strategy for data distribution.
Data Distribution Strategy : Many organizations today have distributed computing
networks. For these organizations, a significant problem in physical database design is
Represent Entities : Each entity type in the E-R diagram is represented as a relation deciding at which nodes (or sites) in the network to physically locate the data. Basic
in the Relational View or Data Model. The identifier of the entity type becomes the data Distribution Strategies are :
Primary key of the relation, and other attributes of the entity type become non-key Centralized : All data are located at a single site. It is fairly easy to do but it has
attributes of the relation. at least three disadvantages :
Represent Relationships : Each relationship in an E-R diagram must be represented Data are not readily accessible at remote sites. Data communication costs
in the relational model. It depends on its nature. For example, in some cases, we may be high.
represent a relationship by making the primary key of one relation a foreign key of The database system fails totally when the central system fails.
another relation. In other cases, we create a separate relation to represent a Partitioned : The database is divided into partitions (fragments). Each partition
relationship. is assigned to a particular site. Major advantage of this is that data is moved
Merge the Relations : In some cases, there may be redundant relations (that is, two or closer to local users and so is more accessable.
more relations that describe the same entity type). They must be merged to remove the Replicated : Full copy of database is assigned to more than one site in the
redundancy. This process is also known as View Integration. Suppose we have one network. This approach maximizes local access but creates update problems,
relation as : since each database change must be reliably processed and synchronized at all
EMPLOYEE1(EMPNO , NAME, ADDRESS, PHONE) of the sites.
And another relation as : Hybrid : In this strategy, the database is partitioned into critical and non-critical
EMPLOYEE2(EMPNO, ENAME, EMP-ADDR, EMP-JOBCODE, EMP-DOB) fragments. Non-critical fragments are stored at only one site, while critical
Since the two relations have the same primary key they describe the same entity and fragments are stored at multiple sites.
may be merged into one relation. The result of merging the relations is the following File Organization : A technique for physically arranging the records of a file on
relation. secondary storage devices. For selecting a file organization, the system designer must
EMPLOYEE(EMPNO , NAME, ADDRESS, PHONE, EMPJOB-CODE, EMP-DOB). recognize several constraints, including the physical characteristics of the secondary
Normalize the Relations : The relations that are created in step (i) and (ii) may have storage devices, available operating systems and file management software, and user
unnecessary redundancy and may be subject to anomalies (or errors) when they are needs for storing and accessing data. Following is the criteria for selecting file
updated. Normalization is the process that refines the relations to avoid these organizations :
problems. Fact access for retrieval.
Q : 03-03-03 : Explain Physical Database Design ?

15 16
High throughput for processing transactions.
Efficient use of storage space.
 Chapter 04 : Data Integrity and Normalization
Protection from failure or data loss.
4.1 Overview
Minimizing need for re-organization.
Accommodating growth.
Q : 04-01-01 : Explain Data Integrity ?
Security from un-authorized use.
Answer :
Indexes : An index is a table that is used to determine the location of rows in a table (
Data Integrity : Database integrity refers to the correctness and consistency of data. It
or tables) that satis1’ some condition. They may be created on primary key, secondary
is another form of database protection. While it is related to security and precision, it
key, foreign key etc.
has some broader implications as well. Security involves protecting the data from
Integrity Constraints : Database integrity refers to the correctness and consistency of
unauthorized operations, while integrity is concerned with the quality of data itself.
data. It is another form of database protection. While it is related to security and
Integrity is usually expressed in terms of certain constraints which are the consistency
precision, it has some broader implications. Security involves protecting the data from
rules that the database is not permitted to violate. Following two are the most
unauthorized operations, while integrity is concerned with the quality of data itself
important constraints in relational databases :
Integrity is usually expressed in terms of certain constraints which are the consistency
Entity Integrity : It is a constraint on primary values that states that no
rules that the database is not permitted to violate.
attribute of a primary key should contain nulls.
Referential Integrity : It is a constraint on foreign key values that states
3.4 Implementation
that if a foreign key exists in a relation, then either the foreign key value
must match the primary key value of some tuple in its home relation or
Q : 03-04-01 : Explain Database Implementation Phase ?
the foreign key value must be completely null.
Answer :
Database Implementation Phase : The builder or the database administrator
Q : 04-01-02 : Explain Normalization ?
normally requires a server computer which will be linked with hundreds and
Answer :
thousands of computer users who would want to share and interact with the server
Normalization : [It is the process of converting complex data structures into simple
(database). For this purpose, the DBA might need the services of network
and stable data structures. It is based on the analysis of functional dependence].
administrators to connect the users with the server. The users are normally given the
[Normalization is a technique for reviewing the entity / attribute lists to ensure that
authorizations / permissions defined by their respective managers so that they can
attributes are stored “where they belong to”. It is the basis for a relational data base
perform the authorized tasks while using the database facilities. In distributed
system]. In practice, it is simply an applied common sense. More formally stated, [it is
computing environment, the database servers and users might be thousands of
the process of analyzing the dependencies of attributes within entities. Attributes for
kilometers apart, so a lot of expensive telecommunication links are required to
each entity are checked consecutively against three sets of rules, making adjustments
perform the designated tasks. NADRA and CRICKINFO are some of the typical
when necessary to put the entity in First, Second and Third normal form].
examples of this type of databases.
“A functional dependency is a particular relationship between two attributes. For any
relation R, attribute B is functionally dependent on attribute A if, for every valid
instance of A, that value of A uniquely determines the value of B” The functional
dependence of B on A is represented by an arrow. An attribute may be functionally
dependent on two or more attributes rather than a single attribute. There may be some
hidden problems as :
Synonyms : A synonym is created when two different names are Used for the same
information (attribute). If an attribute resides in more than one entity, make sure that
all entities use the same attribute name.
Homonyms : A homonym is created when same name is used for Two different
attributes. Redundant Information : Storing the same information in two different
ways or forms if only one attribute can serve the purpose.
Mutually Exclusive Data : Mutually exclusive data exists when attributes occur whose values can
be expressed as “YES/NO” indicators, can not all be true for any single entity.
Normalization is often accomplished in steps, each of which corresponds to a normal
form. It can be graphically expressed as :

17 18
Q : 04-01-04 : Explain Second Normal Form (2 NF) ?
Answer :
Second Normal Form (2 NF) : [A relation is in second normal form NF (2 NF) if it is
in 1 NF and every non-key attribute is fully functionally dependent on the primary
key].
Second Definition : “To be in 2 NF, every non-key attribute must depend on
the key and all parts of the key”.
Necessary & Sufficient Conditions : A table (relation) will be in 2NF if any of
the following conditions apply :
The primary key consists of only one attribute.
No non-key attributes exist in the relation.
Q : 04-01-03 : Define Normalization and Normal Form ? Every non-key attribute is functionally dependant on the full set of
Explain First Normal Form (1 NF) ? primary key attributes.
Answer :
Normalization : [It is the process of converting complex data structures into simple Consider table STUDENT in shorthand notation :
and stable data structures. It is based on the analysis of functional dependence]. STUDENT(STUD-ID,NAME,DEPT,MONFEE,CRSNO,CDTE)
[Normalization is a technique for reviewing the entity / attribute lists to ensure that The functional dependencies in this relation are the as follows :
attributes are stored “where they belong to”. It is the basis for a relational data base STUD-ID NAME, DEPT, MONFEE
system]. STUD-ID,CRSNO CDTE
Normal Form : A Normal Form is a state of a relation that can be determined by The primary key in ii above is the composite key :
applying simple rules, regarding dependencies (or relationship between attributes), to STUD-ID + CRSNO.
that relation. Therefore, the non-key attributes NAME,DEPT and MONFEE are
First Normal Form (1 NF) : “A relation R is in First Normal Form if and only if all functionally dependent on part of the primary key (STUD-ID) but not on
underlying domains contain atomic values only”. CRSNO.
Relation : The Pre-Requisite is that “A relation has always a primary key Partial Functional Dependency : [A partial functional dependency exists when
associated with it”. one or more non-key attributes (such as NAME) are functionally dependant on
Unique Identification Key : All entities must have a key, composed of a part (but not all) of the primary key].
combination of one or more attributes which uniquely identify one Anomalies : The partial functional dependency creates redundancy in the table,
occurrence of the entity. which results in certain anomalies when the table is updated :
No Repeating Groups : For any single occurrence of an entity, each Insertion Anomaly : To insert a row for the table, we must provide the
attribute must have one and only one value or “An attribute must have no values for both STUDENT-ID (Primary Key) and COURSE-NO (Not
REPEATING GROUPS”. Primary Key).
Step-1 : Whenever repeating groups occur, the repeating Attribute must be Deletion Anomaly : If we delete a row for one student, we lose the
removed and placed “Where it Belongs”, under the entity that it describes. information that the student completed a course on a particular date.
Step-2 : Next, study the relationship of where the Repeating attribute came Modification Anomaly : If a students monthly fee changes, we must
from, and where the Attribute went to. Determine if the From-To Relationship record the change in multiple rows (for students, who have completed
is 1:M or M:N. more than one course).

19 20
Important Note : To convert a relation to 2 NF, we decompose the relation Insertion Anomaly : A new salesman (Abid), assigned to the North region can not be
(having redundant data) into two relations that satisfy one of the conditions entered until a customer has been assigned to that salesman (since a value of
described above. Now, by splitting the relation, we will get two relations. This CUSTNO must be provided to insert a row in the table(relation).
step is done to get rid of the redundant data. Anomalies are removed at the end Deletion Anomaly. If customer number 6837 is deleted from the relation, we lose the
of 2 NF. information that salesman Khalid is assigned to the east region.
Modification Anomaly : If salesman Ahmad is assigned to the east region, several
Q : 04-01-05 : Explain Third Normal Form (3 NF) and rows must be
Transitive Dependency ? changed to reflect the fact (two rows in this case).
Answer : These anomalies arise as a result of the transitive dependency. This problem (the
Third Normal Form (3 NF) : [A relation is in third normal form (3 NF) if it is in 2 transitive dependency) can be removed by de-composing the relation SALES into two
NF and no transitive dependencies exist]. relations as shown below:
Transitive Dependency : [It is a functional dependency in a relation between two or
more non-key attributes].
Third Normal Form (3 NF) – Second Definition : A more precise definition for 3
NF is :
“A non-key attribute must not depend on any other non-key attribute” or “if a non- key
attribute’s value can be obtained simply by knowing the value of another non-key
attribute, the relation is not in
3 NF. The Anomalies, Insertion Anomaly, Deletion Anomaly and Modification
Anomaly must be related with example data. These anomalies arise as a result of the and
transitive dependency. This problem (the transitive dependency) can be removed by
de-composing the a relation into two relations.

Consider a relation as follows:


SALES(CUSTNO, NAME, SALESMAN, REGION). Where CUSTNO is the primary
key.
The following functional dependencies exist in the relation. SALE1 (CUSTNO, NAME, SALMAN)
(a) CUSTNO NAME,SALESMAN SMAN (SALESMAN, REGION)
(b) SALESMAN Region (since each salesman is assigned a unique Now, both the relations (SALE1 and SMAN) are in 3 NF, since no transitive
region). dependency exists. We can verify that the anomalies that existed is SALES are not
Notice that SALES is in 2 NF, because the primary key consists of a single attribute present in SALE1 and SMAN.
(CUSTNO). However, there is a transitive dependency, because REGION is Note : SALESMAN which is the determinant in the transitive dependency in SALES,
functionally dependent on SALESMAN which in turn is functionally dependent on became the primary key in SMAN. SALESMAN is also a foreign key in SALE1.
CUSTNO. As a result, there are update anomalies in relation.

The Anomalies

21 22
Q : 05-04-01 : Describe MS Access Database Components ?
 Chapter 05 : Introduction To Microsoft Access Answer :
Microsoft Access Database Components : MS-Access database consists of various
5.1 Overview
components called the objects. The database objects are used to store data and to
retrieve data from database. The major database objects are :
Q : 05-01-01 : Describe MS Access ? Describe Benefits of MS
Tables : The most important object of a database is a Table. The data is stored
Access ?
in tables of database. A table is a collection of related data organized in rows
Answer :
and, columns. Each row consist a record, and each record consists of columns.
Microsoft Access : Microsoft Access is one of the most popular and powerful DBMS.
The row is divided into columns called field containing different data values of
It has many built in features to assist you in constructing database and viewing
a particular record. A relational database may contain multiple tables, which are
information. MS Access is much more involved and is a more genuine DBMS than
identified by unique names. This is the fundamental property of a relational
other programs such as Microsoft Works. Microsoft Access is a Relational Database
database.
Management System (RDBMS) that you can use to store and manipulate large amount
Queries : Query is a statement that extracts specific information from database.
of information. It is easy to understand and its graphical interface, helps to create
It is created by specifying the fields to display from a table or another query. It
queries, forms, and reports. In other words, even inexperienced programmers can use
is more flexible way of selecting, filtering and sorting records. The user can also
MS Access to turn a stack of invoices, a card file of customer names, a ledger, and an
change data in the database that fulfils certain criteria. In addition, queries allow
inventory list into a relational database that makes entering, updating, and reporting
to perform calculations of different fields. The output of a query is also
information as easy as clicking a button.
displayed in the form of a table and can also be used as source of records for
Benefits of Microsoft Access : MS-Access offers more than just pretty interface for
Forms and Reports. The query allows you to view and analyze data in many
learning how to manage data. Benefits of MS Access are :
different ways. Technically, a query is a stored question or request. You design
Sample Databases : It includes sample database applications to assist you learn
a query in design view to extract certain information from the database. The
about real-world tables, forms, queries, and reports, and how they are
information appears in Datasheet which looks exactly like Datasheet view for a
interconnected to form a database management system.
table. The difference between a datasheet for a table and a datasheet for a query
Wizard : It makes very easy to create a database. You can choose from several
is that the query’s datasheet can combine information from multiple tables.
examples of databases in the Database Wizard for such storage uses as contact
Forms : The Form object of database is used to enter data into databases, edit
information, inventory control, a ledger, and so on. You can create and then
data and view data from database. You can add, update, and delete records in
modi1r these databases to meet your own needs.
your table by using a form. Form provide :
Keys to Understand The Structure : After you have decided how to create and
An easy method for entering and editing data in tables. Thus the user does not
relate tables, you can easily view all the relationships in the database with the
have to work directly with tables.
graphical interface in the Relationship Window. This makes one of the toughest
Facilities to display data retrieved from database tables.
parts of relational database design much easier and more manageable.
Most of the DBMSs provide the facility to create Forms. The application
Microsoft Office Integration : You can use access with Word, Excel, and other
programmer creates the user interface by designing the Forms. In this way arid
office application to create mail merges, charts, and other helpful uses for your
Reports, the users can perform different operations on the database very easily.
data.
Reports : The Report object of database is used to retrieve and present data in a
Easier Programming : You can use relatively simple code with macros to
formatted way. The Report can be printed. Some reports are simply a list of the
automate repeated tasks, or you can try more complex and flexible code with
records in the database, one record after the other. Most of the popular DBMS
VBA. Access provides graphical shortcuts and hints to help writing easier code.
provide this facility. The output of the query can also be given as input source to
Common Standards : It uses standards that help applications scale up to work
Reports.
within larger environments. Access uses objects and SQL (Structure Query
The Difference Between The Forms and Report :
Language) to make its code from the adaptable to other applications.
Forms are used to enter data into database, change data and view data of
Redundancy : MS-Access allows you to store, retrieve, sort, analyze, and print
databases.
information contained in the database. Data may be manipulated without data
Reports are used to retrieve the data from database and present it on screen in a
redundancy by defining relationships between sets of data. Databases are often
predefined format. Reports do not allow user to change data or to enter data into
used for product data. Redundancy means duplication of data in multiple files. It
database.
wastes the storage media of computer.

5.4 Database Objects


23 24
The number of record in a relation is called the cardinality of the relation. The
cardinality of a relation changes as new records are added or existing records are
 Chapter 06 : Tables and Queries deleted, e.g. a table with 50 records has a cardinality of 50.
6.1 Overview
Q : 06-01-04 : Define Basic Term used in Database ?
Answer :
Q : 06-01-01 : Describe MS Access ? Describe Benefits of MS
A Basic Terminology
Access ?
A database is a collection of related data (or record).
Answer :
An object is a component in the database such as a table, macro.
Microsoft Access
A table is a group of related data organized in fields (columns) and records (rows). By
In a relational database the data is stored in tables. The TABLE or RELATION is a
using a common field in two tables, the data can be linked. Many tables can be stored
fundamental concept of relational databases. It is foundation of every Relational
in a single database.
Database Management System.
A field is a column in a table and defines a data type for a set of values in the table.
Tables are grids that store information in a database similar to the way an Excel
For example a mailing list table might include fields for first name, last name, address,
worksheet stores information in a workbook. Access provides three ways to create a
city, state, zip code, and telephone number.
table for which there are icons in the Database Window. Double-click on any of the
A record is a row in a table and is a set of values defined by fields. In a mailing list
icons to create a table. Every database consists of one or more tables which store data.
table, each record would contain the data for one person as specified by the
Each table has its own unique name and consists of columns and rows. It is a very
intersecting fields.
convenient way to store information. The columns in a table (also called table fields)
Design View provides the tools for creating field in a table.
have their own unique names and have a pre-defined data type. The field can be a
Datasheet View allows you to update, edit, and delete information from a Table.
primary key, an index defined on it and it can have certain default value. The table
columns describe the data types, whereas the table rows contain the actual data.
Q : 06-01-05 : Describe MS Access IDE ?
Answer :
Q : 06-01-02 : Describe Characteristics of Database Tables ?
Access IDE
Answer :
IDE stand for Integrated Development Environment. It is an interface that is used to
Characteristics of Tables
create a database. An IDE makes the using of database simple, manageable for end
The tables of a relational database have following characteristics:
users who may not have a complicate programming knowledge of the database
1. Each cell of the table contains only one value.
system.
2. Each colunm has a distinct name, which is the name of the attribute (field) it
Microsoft Access is an example of a database management system. The access IDE
represents.
simplifies the task of creating, designing good-looking screens with features (i.e. text
3. The order of the columns is immaterial.
boxes, list boxes, button, dialog boxes etc.). It provides the facilities for searching,
4. Each row represents a record.
sorting, and retrieving the data.
5. Each row is distinct; there are no duplicate rows.
6. The order of rows is immaterial.
Q : 06-01-06 : Describe Data Types in MS Access ?
7. Using a separate table for each entity means that you store that data only once,
Answer :
which makes your database more efficient, and reduces data entry errors. Tables
Data Types in MS Access
form the foundation of an Access database structure.
Before you start creating a new table in Access, you first consider how you want to
break down the information you are organizing into smaller units of data in the table.
Q : 06-01-03 : Describe Degree and Cardinality of Relation or Table
Dividing the data into units of information is the process of determining the fields.
?
Each field will be assigned a unique field name. Each field is also assigned a data
Answer :
type. Following are the data types available in MS Access :
Degree of a Relation or Table
Text - The default type, text type allows any combination of letters and numbers up to
The number of fields in a relation is called the degree of a table. Once the table has
a maximum of 255 characters per field record.
been created, its degree usually dose not changes, e.g. a table with five fields has a
Memo - A text type that can store more than 64,000 characters and is used for detailed
degree of 5.
descriptive fields.
Number — This data type is used to store numbers that are used in mathematical
Cardinality of a Relation or Table
calculations. Several number field sizes are available.

25 26
Date / Time - A Date, Time, or combination of both can be specified in this field. Update Queries : An update query makes changes to a gr of records in one or
Currency - Monetary values that can be set up to automatically include a dollar sign more tables.
($) and correct decimal and comma positions. Append Queries : An append query adds a group of records from one or more
Auto Number - When a new record is created, Access will automatically assign a tables to the end of one or more tables.
unique integer to the record in this field. Crosstab Queries : There are crosstab queries to calculate and restructure data
Yes / No - Use this option for True / False, Yes / No, On / Off, or other values that for easier analysis of your data. Crosstab queries calculate a sum, average,
must be only one of two choices. count, or other type computation for data. These queries are grouped by two
OLE Object - An OLE (Object Linking and Embedding) object is a sound, picture, or types of information, one down the left side of the datasheet and another across
other object such as a Word document or Excel spreadsheet that is created in another the top.
program. Use this data type to embed an OLE object or link to the object in the Parameter Query
database. A parameter query is a query that when run displays its own dialog and prompting you
Hyper link - A hyperlink will link to a website, or another location in tbe database. A for information. Parameter queries are also used as the basis for forms and reports.
hyperlink address have up to four parts: the text that is displayed in the field; the path
to a file or URL; a sub-address which is a location in the file or page in the web site;
and the text that is displayed as the tool-tip.

Q : 06-01-07 : Describe Query in MS Access ?


Answer :
Query in MS Access
Query mean question or inquiry. The questions like statements that are to retrieve data
form one or more database tables are called queries. It is a powerful and flexible way
of selecting, filtering and sorting records.
Queries select records from one or more tables in a database; these selected records
can be viewed, analyzed, and sorted on a common datasheet. The resulting collection
of records, called a dynaset (short for dynamic subset), is saved as a database object
and can therefore be easily used in future.
The query will be updated whenever the original tables are updated. Types of queries
are select queries that extract data from tables based on specified values, find d queries
that display records with duplicate values for one or more of the specified fields, and
find unmatched queries display records from one table that do not have corresponding
values in a second table.

Q : 06-01-08 : Explain Types of Query in MS Access ?


Answer :
Types of Queries
There are five types of query : Select queries, Action queries, Crosstab queries,
Parameter queries and SQL queries.
Select Queries
A select query gathers, collates and presents information in usable forms. It retrieves
data from one or more tables and displays the results in a datasheet where you can
update the records. You can also use a select query to group records and calculate
sums, counts, averages, and other types of totals.
Action Queries
An action query makes changes in specified records of an existing table, or creates a
new table. There are four types of action queries:
Delete Queries : A delete query deletes a group of records from one or more
tables.

27 28
Linking objects from another database will create a link to an object in another
database while not copying the table to the current database. The latest object data will
 Chapter 07 : Forms and Reports be retrieved every time we access the link.
7.1 Overview

Q : 07-01-01 : Describe Form in MS Access ?


Answer :
Microsoft Access Form
Access Form creates the user interface to your table. Although you can use Datasheet
to perform many of the same functions as forms, Forms are used as an alternative way
to enter data into a database table. It provides a different way of viewing table data.
Access enables us to create forms that can be used to enter, view, and print data.
The Form is constructed from a collection of individual design elements called
controls or control objects. Controls are the components we see in the windows dialog
boxes of the access and other windows applications like buttons, check boxes. We use
text boxes to enter and edit data, labels to hold field names and object frame to display
graphics. A Form Wizard is provided to assist in the construction of forms.

Q : 07-01-02 : Describe Types of Form in MS Access ?


Answer :
Microsoft Access Form - Types
Four types of forms can be created. These include single-column (displaying one
record at a time in a vertical format), tabular (displaying multiple records in a row-
and-column format), main / sub form (combining the single-form and tabular formats
into one form), and graph.

Q : 07-01-03 : Describe Sub Form in MS Access ?


Answer :
Microsoft Access – Sub Form
A sub-form is a form that is placed in a parent form, called the main form. Sub forms
are particularly useful to display data from tables and queries that have one-to-many
relationships.

Q : 07-01-04 : Describe Reports in MS Access ?


Answer :
Microsoft Access – Reports
Presentation of processed data obtained from a database is called report. The report
can be displayed on the screen, printed on the paper or saved on the disk for later
retrieval. The main uses of reports :
To display information obtained from a database.
To display result of a query.
To produce output according to the needs of the user.

Q : 07-01-05 : Describe Object Linking in MS Access ?


Answer :
Microsoft Access – Object Linking

29 30

You might also like