CH 8 1st Year (Nouman) Database Development
CH 8 1st Year (Nouman) Database Development
SHORT QUESTIONS
“A collection of programs that enables user to store, modify and extract information
from a database is called DBMS.”
There are three types of database management system which are used commonly.
These are:
Microsoft Access
SQL Server
Open Office Base
1
The modules partition the system design or code. Some typical examples of modules are: whole programs or
applications. software libraries. classes, in an object-oriented language such as Java.
2
Open source software (OSS) is software that is distributed with its source code, making it available for use,
modification, and distribution with its original rights.
3
A wizard is a piece of software that simplifies complicated tasks, or instructs a user about how to complete a task
4
Interactive database management (IDM) provides complete data editing at the time of initial data entry when
information is ‘fresh at hand’. IDM continuously checks all variables for acceptability, completeness, and
consistency
In the following figure the data which the customer form is showing is retrieved from
database table where actual data is stored.
User can enter the record of new customer and click on insert record which will enter
the data into database.
Tables
Data is stored in tables. A table is a set of rows (records) and columns (fields).
Queries
Queries are used to retrieve specific data from database.
Forms
User can use from to enter, edit, display and modify data in the database
Reports
Reports are used to organize or summarize data so that user can print it or view it
on the screen
Right click on the table that we want to set the primary key and then click Design
View on the shortcut menu.
Select the field that we want to use as the primary key e.g. CustomerID
On the design tab, in the tools group, click primary key as shown in figure below:
A key appears to the left of the field that we specified as the primary key as shown
below:
A report can be run at any time and will always reflect the current data in the database.
Reports are generally created for printouts ( )چھاپ کر نکال ہوا ورقbut they can also be
viewed on the screen, exported to another program, or sent through an email message.
Each row in a table is referred to as a record which represents one entity instance. Each
record consists of one or more fields. Fields correspond to the columns in the table. For
example, if there is a table named as employee, then each row will contain a record of
different employee and each field of row contain different type of information of an
employee. Such as, first name, last name, address and so on.
Each Fields has specific data type i.e. numeric, text, date or time or some other type.
Example:
2. Query:
Query is a statement that extracts information from the database.
Queries are used to retrieve specific data from a single table or multiple tables. The data
user want to see is usually spread across several tables and queries allow user to view it
in a single datasheet. User can retrieve subset of rows (records) as well as subsets of
columns. Certain queries are updatable, means they can edit the data in the table.
Select query
Action query
a. Select query:
A select query simply retrieves the data and makes it available for use. The results can
be viewed on screen, print it out or copy it to the clipboard.
b. Action query:
As its name implies it is used to perform different actions with data. Action can be used
to create new tables, add data to existing tables, update data or delete data.
In this example:
Click on the Create tab in the ribbon at the top of the screen and then Click on
the Query Design button in the Queries group.
Show Table Dialogue box containing tables name will appear. Double click on
each table which you want to include in query.
Select the field names which you want to appear in query.
In the bottom window, all the information about query is given i.e. which fields
are included in query and from which table. You can also specify the criteria
After this save and run query to get the required result.
Forms contain controls such as Labels, Textboxes, Combo boxes, List and Command
buttons etc. Forms are used to:
In the following figure the data the customer form is showing is retrieved from database
table where actual data is stored.
User can enter the record of new customer and click on insert record which will enter
the data into database.
Example:
4. Reports:
A report is a database object. Report is used to organize or summarize data so that user
can print it or view it on the screen. It is an effective way of presenting data using
attractive layout () َوضع َقطع.
A report can be run at any time and will always reflect the current data in the database.
Reports are generally created for printouts ( )چھاپ کر نکال ہوا ورقbut they can also be
viewed on the screen, exported to another program, or sent through an email message.
Report is displayed in figure below:
Text:
It the default data type used in MS access. It used for entering text or combinations of
text and numbers. The maximum size of text field is 255 characters.
Memo:
It is also used for entering text but of larger amounts. It can store up to 65,536
characters. So, it can be used for descriptive ( )وضاحتیtext ( متن,)لکھائی.
Number:
This data type is used for storing numbers. Various numeric subtypes are also available
in the Field’s Property Pane of Table Design window.
Auto number:
An AutoNumber filed is a numeric (Long Integer) value. Access automatically fills this
field with a number when user enters new record. First record of AutoNumber field is
assigned value 1. Access increments the AutoNumber field of last record by 1 to assign it
to new record. Its storage space is up to 4 bytes.
Currency:
This data type is used for amount of currency. Currency is written is special way with
specific comma and decimal positions. So, this field automatically adjusts comma and
decimal to their correct positions. It can hold up to 15 digits with dollar ($) sign and 4
decimal places. Its storage space is up to 8 bytes.
Date/Time:
This field is used to enter date and time, separately or in combination. Its storage space
is up to 8 bytes.
OLE object:
An OLE (Object Linking and Embedding) can store, pictures, audio, video or other objects
such as word document or Excel spreadsheet that is created in another program. Its
storage space is up to 1 GB.
Hyperlink:
It is used for hyperlinks. Hyperlink is a path (link) of another document or a web
address. A hyperlink address has 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
website, and the text that is displayed as the tooltip.
Datasheet view
In Datasheet view, we build a table by entering field names and setting data
types manually. All we have to do is to click and type.
Table templates
Table templates are pre-made tables that meet several common business needs.
For example, the Assets table template contains many of the fields, such as Item
and Purchase Date etc.
Design view.
Design view lets user control every field and property in the table.
Creating a database:
First we will create database. The procedure of creating database is explained below:
By default the table name is Table1. Change the table name according to
database requirement.
Click Ok. The table is saved and created in datasheet view.
Add the fields to the table. For example, in the figure below fields of
Customer_ID, Customer_Name, Custome_City, Credit_limit etc. are added.
Creating forms:
Forms are created in Access by using several automatic tools for creating forms. These
tools are located in the Forms group on the top Create tab in the Ribbon. It is shown as
under:
The Form option is used to make a basic form. It shows a single record at a time.
The Split form option creates a form showing one record on top and includes the
Datasheet view of the entire source table on the bottom.
The Multiple Items option creates a form that shows all records at once. These
records look similar to the source table in Datasheet view.
The Form Wizard creates form by the process of creating more customized
forms.
Creating relationships:
Relationship between two tables is created in following steps:
Click on Database Tools tab in the Ribbon and then click the Relationships
command. It is shown in figure below:
Now Relationship map is displayed that contains all the tables as shown below:
For creating relationships move the mouse pointer to the primary key of first
table and drag and drop it to the foreign key of another table. Like in figure
below, Customer ID is the primary key in Customers table and foreign key in
Orders table.
Here we drag the Customer_ID of customer table by pressing the left mouse
button and release onto the Customer_ID of Orders table by releasing the left
mouse button.
Then the Edit Relationships dialog box appears, as shown below:
Select
Update
Delete
Select Query:
The select query is the simplest and most common type of query available in MS-Acess.
This query is used to select and display data from either one or more tables depending
upon the requirement.
Query can be created by using Query Wizard and also by Design view. But the basic
steps are same. These are as follows:
Delete Query:
The delete query is used to remove one or more rows of data from a relational database
table. It uses Where clause to determine the criteria of query. In delete query:
Or
One-to-may relationship is that relationship in which one row of a table can be linked
with many rows of another table.
In the example explained here Customers entity type is making one – to – many
relationship with Orders entity type. It is to express that one customer can place many
orders.
Click on Database Tools tab in the Ribbon and then click the Relationships
command as shown in figure below:
ii) _____ is a window that displays data for viewing, entering and editing information.
vii) Which key is used to create one to many relationship between tables?
viii)________ is used to display data in an organized manner so that users can print it.