What is
DATABASE?
A database is an integrated collection of data that is shared
by all organizational users. It is a large collection of data in a computer
system, organized so that it can be expanded, updated and retrieved rapidly for
various users. In the database management approach, data records are
consolidate into database that can be accessed by many different application
programs. Important software packagers called a database management system
(DBMS) serves as software interface between users and database. This helps
users easily access the records in a database. Thus, database management
involves the use of database are created, interrogated, and maintained to
provide information needed by end user and their organization.
According to “Mar.in (1981)”,” A data base is a shared
collection of interrelated data designed to meet the needs of multiple types of
end users”
Database has two properties
- It is integrated 2. It is shared
By integrated we mean that previously distinct data files
have been logically organized to eliminate redundancy and facilitate data
access. By shared we mean that all the qualified users in the organization have
access to the same data for use in a variety of activities.
A database is not only shared by multiple users but it is
perceived differently by different users.
The data stored in a database is independent of the
application program using it and of the type of secondary storage devices on
which it is stored.
WHY USE
ELECTRONIC DATABASE
We use electronic database to use, store, retrieved,
processed, and communicate data electronically.
Electronic Database management reduces the duplication of
data and integrates data so that they can be accessed by multiple programs and
users. Programs are not depending on the data and type of secondary storage
devices. Users are providing with an inquiry/response and reporting capabilities
that allow them to easily obtain information they need. Information thy needed
with out having to write computer program. The integrity and security of the
data store in database can e increased. Since access to data and modifications
of database are controls by database management software, a data dictionary and
database administrator function.
TABLES AND
RELATION
TABLE
A table is a collection of data. Tables organize data in
columns (called fields) and rows (called records).
RELATION
The relation is an association between common fields (column)
in two tables.
TAYPES OF
RELATION (ASSOCIATION)
ONE-TO-ONE
RELATION
A one to one association from A to B means that for the
specified period of time for a given value a there is associated a one and only
one values of B. It can be represented as:
|Roll No| −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−→
|Name|
We represent one to one association with a single −−−→ headed
arrow.
Suppose we have tow data items REG-NO of students and
STUENT-NAME. A one to one association from data items REG-NO o data item
STUDENTS NAME means that for specified period of time, the given value of
REG-NO has one and only one value of STUDENT-NAME associated with it.
|Student
Name| −−−−−−−−−−−−−−−−−→|Reg-No|
ONE TO MANY
RELATION:
These states that for a given value of A there will be many
value of B associated with it.
|Deptt:|−−−−−−−−−−−−−→−−−−−→|Employees|
In the above fig we have tow data item Deptt: and Employee. A
one to many association from the data item Deptt: to data item employee means
that a Department has many employee. Double headed arrows represent a one to
many associations.
MANY –TO
–MANY
It states that at any given times there exist more than on
values of B associated with the given value of a, and also for given value of b
there are associated many value of A.
|Student|←−−←−−−−−−−−−−→−−−→−−|Teacher|
In the fig we have two data items student and teacher. Many
students have many teachers.
DATABASE
FEATURE
ATTRIBUTE,
CHARACTER, FIELD, RECORD, FILES, TUPLES
ENTITY: Any thing
about which we can store data is called entity. For example student, city, books,
college, board etc
a-Attribute:
The characteristic of an entity or the column of a table is called
attribute. For example a student attribute are roll no, name, age, color etc
b-Character:
The smallest piece of information is called character. There are three
type characters
1-
Numeric that is from 0 to 9
2-
Alphabetic that is from A-Z capital or small a to z
3-
Special character that + - = , ‘ ; : “ < > ? / .
( { [ ] ) * etc
c-Field The
combination of related character is called field that is name, address, city
name, ph-no, age, roll-no, price, item etc, for example Peshawar, Pakistan,
2300, 20 years etc.
d-Record The
combination of related field is called record that is payroll record for a
person. Student admission record for a student etc
For example student record
R-No Name Age Qualification Address
1 XYZ 23 B.Com Swabi
2 ABC 24 D.Com Peshawar
In above example R-No, Name, Age, Qualification and Address
are field.
e-Files: The
combination of related record is called file. The combination of below two
record stored in a file stud- rec is file.
R-No Name Age Qualification Address
1 XYZ 23 B.Com Swabi
2 ABC 24 D.Com Peshawar
f-Tuples: the row of
a table is called tuple
KEY,
PRIMARY KEY, FOREIGN KEY, COMPOSITE KEY
- Key: A key is data item used to identify a record.
- Primary Key:
It is key or data item that
uniquely identifies record. Primary key is an identifier. For example a student
number would be the primary key for student records.
- Secondary key:
A secondary key is data item that
normally does not uniquely identify a record not identifier a number of records
in set that share the same property for example data item COURSE might be used
as a secondary key for STUDENT record.
Iv. Foreign Key:
It is primary key field in one table while
used as a foreign key in another table. It is used for linking two tables.
Example:
Table 1: costumer number, cname,
caddress, phone,(here customer no is a primary key).
Table 2: loaned, amount, data of
issue, customer no (here loaned is primary key and customer no a foreign key).
v- Composite Key/ Concatenate Key
A primary key that consists of two
or more attribute is known as composite key. For example the following relation
uses two fields. Registration No and subject to identify each tuple. This is an
example of composite key.
Composite
Key
↓−−−−−−−−−−−−−−↓
Registration No
|
Subjects
|
Marks
|
1
|
IT-I
|
89
|
3
|
Islamiyat
|
34
|
2
|
IT-II
|
87
|
2
|
A/C
|
89
|
REFERENTIAL INTEGRITY
Referential integrity is a
constraint on foreign key. It states that if a foreign exists in a relation,
the foreign key value must match the primary key value of some tuples in its
parent relation. Referential integrity is uses to ensure that relationships
between records in related tables are valid and that you don’t accidentally
delete or change related data.
USE OF WILD CARDS
Wildcard characters as placeholders
for other characters when you are specifying a value you wan to find and know
only part of the value.
To find values that starts with a
specific letter or matches a certain pattern.
In a Microsoft Access database,
you can use the following characters in the Find and Replace dialog
boxes, or in queries, commands, and expressions, to find such
things as field values, records, or file names.
Character
|
Usage
|
Example
|
*
|
Matches any number of characters. It can be used as the
first or last character in the character string.
|
Wh* finds
what, white, and why.
|
?
|
Matches any single alphabetic character.
|
B?II finds
ball, bell, and bill
|
[]
|
Matches any single character within the brackets.
|
B[ae]II find
ball and bell but not bill
|
!
|
Matches any character not in the brackets.
|
b[!ae]II finds
bill and bull but not bell
|
-
|
Matches any one of a range of characters. You must specify
the range in ascending order (A to Z. not Z to A).
|
b[a-c]d finds
bad.
bbd. And bed
|
#
|
Matches any single numeric character.
|
1#3 finds
103, 113, 123
|