0% found this document useful (0 votes)
5 views47 pages

4. Practical File

The document outlines practical exercises for creating and managing databases in MS Access, covering various topics such as table design, form creation, query design, and SQL operations. Each practical includes specific instructions for creating tables with defined fields and properties, entering records, and performing queries or SQL commands. The exercises span multiple applications including student information, vehicle registration, library management, citizen data, bank accounts, school attendance, hospital patient records, employee information, and cricket statistics.

Uploaded by

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

4. Practical File

The document outlines practical exercises for creating and managing databases in MS Access, covering various topics such as table design, form creation, query design, and SQL operations. Each practical includes specific instructions for creating tables with defined fields and properties, entering records, and performing queries or SQL commands. The exercises span multiple applications including student information, vehicle registration, library management, citizen data, bank accounts, school attendance, hospital patient records, employee information, and cricket statistics.

Uploaded by

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

Practical 1 (Table Design, Data Types and Field

Properties)
Create a database in MS-Access of Student Information
 Create table STUDENT, the fields are as follows:
SID, Name, Class, Address, CNIC, City, Email, DOB and set the following properties
1. Set SID as primary Key and set caption property for ‘SID as ‘Student Identity’.
2. Set field size of name up to 50 characters and set it as ‘not null’.
3. Produce a list of available values using look up wizard in the field class.
4. Give CNIC short text data type and apply input mask as 00000-0000000-0
5. Give default value in the city as ‘Karachi’.
6. Apply no duplication on Email.
7. Apply ‘medium date’ format to DOB.
8. Enter 5 Records in the table.

 Create table STUDENT, the fields are as follows:


SID, Name, Class, Address, CNIC, City, Email, DOB and set the following
properties

Student Name: Hasnain Aslam – XI – AKU EB Page 1 of 47 XI Computer CS Practical File


 Set SID as primary Key and set caption property for ‘SID as ‘Student Identity’.

 Set field size of name up to 50 characters and set it as ‘not null’.

Student Name: Hasnain Aslam – XI – AKU EB Page 2 of 47 XI Computer CS Practical File


 Produce a list of available values using look up wizard in the field class.

 Give CNIC short text data type and apply input mask as 00000-0000000-0

Student Name: Hasnain Aslam – XI – AKU EB Page 3 of 47 XI Computer CS Practical File


 Give default value in the city as ‘Karachi’.

 Apply no duplication on Email.

Student Name: Hasnain Aslam – XI – AKU EB Page 4 of 47 XI Computer CS Practical File


 Apply ‘medium date’ format to DOB.

 Enter 5 Records in the table.

Student Name: Hasnain Aslam – XI – AKU EB Page 5 of 47 XI Computer CS Practical File


Practical 2 (Form Wizard and Form Design)
Create a database in MS-Access for a Vehicle database

 Create table Vehicle (RegNo, BrandName, Model, Color)


 Create a form using wizard.
 Edit the form in design view
 Apply a caption in it “Vehicle Registration Form” in Red Color.
 Write “Government of Pakistan” as sub heading.
 Change the label colors of all fields as “sea green” and label text color as “white”.
 Apply line thickness of text boxes by 4 points with black color.
 Enter 5 Records in the table using form.

 Create table Vehicle (RegNo, BrandName, Model, Color)

Student Name: Hasnain Aslam – XI – AKU EB Page 6 of 47 XI Computer CS Practical File


 Create a form using wizard.

 Edit the form in design view

Student Name: Hasnain Aslam – XI – AKU EB Page 7 of 47 XI Computer CS Practical File


 Apply a caption in it “Vehicle Registration Form” in Red Color.

 Write “Government of Pakistan” as sub heading.

Student Name: Hasnain Aslam – XI – AKU EB Page 8 of 47 XI Computer CS Practical File


 Change the label colors of all fields as “sea green” and label text color as “white”.

 Apply line thickness of text boxes by 4 points with black color.

Student Name: Hasnain Aslam – XI – AKU EB Page 9 of 47 XI Computer CS Practical File


 Enter 5 Records in the table using form.

Student Name: Hasnain Aslam – XI – AKU EB Page 10 of 47 XI Computer CS Practical File


Practical 3 (Query Design, Sorting and Applying Criteria)

Create a database of Library


 Create table books (Book_Id, Title, Publisher Name, Author Name, issued) with suitable
data types.
 Create a suitable primary key and input 5 different records.
 Create a query in design view for the following:
 Display a list of books sorted by Title in ascending order.
 Display a list of books, published by other than Dogar Brothers/Majeed Sons.
 Display a list of books where there is no Author Name.
 Display a list of books where Authors’ name starts with ‘M’ and issued is ‘Yes’.

 Create table books (Book_Id, Title, Publisher Name, Author Name, issued) with suitable
data types.

Student Name: Hasnain Aslam – XI – AKU EB Page 11 of 47 XI Computer CS Practical File


 Create a suitable primary key and input 5 different records.

 Create a query in design view for the following:

Student Name: Hasnain Aslam – XI – AKU EB Page 12 of 47 XI Computer CS Practical File


 Display a list of books sorted by Title in ascending order.

 Display a list of books, published by other than Dogar Brothers/Majeed Sons.

Student Name: Hasnain Aslam – XI – AKU EB Page 13 of 47 XI Computer CS Practical File


 Display a list of books where there is no Author Name.

 Display a list of books where Authors’ name starts with ‘M’ and issued is ‘Yes’.

Student Name: Hasnain Aslam – XI – AKU EB Page 14 of 47 XI Computer CS Practical File


Practical 4 (Create; Alter, Drop Table Using SQL)

Create a database in MS-Access for Citizens.

 Create table Citizens (CNIC, Name, DOB, Address, Phone, Email) taking suitable data
types using CREATE statement. Set CNIC as Primary Key and Name as Not Null.
 Insert 4 records in the table using insert statement.
 Change the structure of the table using ALTER statement and add field of city and
country.
 Open the table in data sheet view and enter cities and countries.
 Remove the field of country using DROP statement.
 Enter two more records in the table using datasheet view.
 Write SQL statement to delete the table.

Student Name: Hasnain Aslam – XI – AKU EB Page 15 of 47 XI Computer CS Practical File


 Create table Citizens (CNIC, Name, DOB, Address, Phone, Email) taking suitable data
types using CREATE statement. Set CNIC as Primary Key and Name as Not Null.

 Insert 4 records in the table using insert statement.

Student Name: Hasnain Aslam – XI – AKU EB Page 16 of 47 XI Computer CS Practical File


 Change the structure of the table using ALTER statement and add field of city and
country.

 Open the table in data sheet view and enter cities and countries.

Student Name: Hasnain Aslam – XI – AKU EB Page 17 of 47 XI Computer CS Practical File


 Remove the field of country using DROP statement.

 Enter two more records in the table using datasheet view.

Student Name: Hasnain Aslam – XI – AKU EB Page 18 of 47 XI Computer CS Practical File


 Write SQL statement to delete the table.

Student Name: Hasnain Aslam – XI – AKU EB Page 19 of 47 XI Computer CS Practical File


Practical 5 (One-to-One Relationship)

Create a database in MS-Access of Bank Accounts.

 Create 1st table ACCOUNT(AccNo, Acc_Title, Acc_Address, Acc_Phone, Acc_Email)


 Create 2nd table STATUS (StatusID, AccNo, Acc_Status, Balance) with suitable data
types.
 Create one to one relationship between the tables.
 Enter 5 Records from parent table to child table.

 Create 1st table ACCOUNT(AccNo, Acc_Title, Acc_Address, Acc_Phone, Acc_Email)

Student Name: Hasnain Aslam – XI – AKU EB Page 20 of 47 XI Computer CS Practical File


 Create 2nd table STATUS (StatusID, AccNo, Acc_Status, Balance) with suitable data
types.

 Create one to one relationship between the tables.

Student Name: Hasnain Aslam – XI – AKU EB Page 21 of 47 XI Computer CS Practical File


 Enter 5 Records from parent table to child table.

Student Name: Hasnain Aslam – XI – AKU EB Page 22 of 47 XI Computer CS Practical File


Practical 6 (One-to-Many Relationship)

Create a database in MS-Access for school.


 Create 1st table student (SID, Name, Class, CellNo, Email)
 Create 2nd table Attendance (AID, SID, Month Name, Year, Working Days, Present
Days)
 Create one-to-many relationship between the tables.
 Enter 5 Records in the table student and related 2 records for each parent record in
attendance table.

 Create 1st table student (SID, Name, Class, CellNo, Email)

Student Name: Hasnain Aslam – XI – AKU EB Page 23 of 47 XI Computer CS Practical File


 Create 2nd table Attendance (AID, SID, Month Name, Year, Working Days, Present
Days)

 Create one-to-many relationship between the tables.

Student Name: Hasnain Aslam – XI – AKU EB Page 24 of 47 XI Computer CS Practical File


 Enter 5 Records in the table student and related 2 records for each parent record in
attendance table.

Student Name: Hasnain Aslam – XI – AKU EB Page 25 of 47 XI Computer CS Practical File


Practical 7 (Query Design View)
Create a database in MS Access for Hospital

1. Create table Patient (Patient_Id, Patient Name, Gender, DOB, Diagnosis, Prescription,
Doctor Name, DOT) with appropriate data types and suitable primary key & enter 10
records.
2. Create queries in design view the following names and purposes:
 TB Patients: Displays the records of male patients who have TB diagnosed.
 Started by M: Display the name and gender of male patients whose names are started
by ‘M’.
 Fever Patients: Display the records of patients who are having Dengue, Malaria or
Typhoid.
 2016 to 2018 Patients: Display the records of patients who were treated during
1/01/2016 to 1/01/2018.
 55 Years Old Females: Display the record of females who are older than 55 years on
12/12/2018.
 Without Prescription: Display the records of all the patients who have not prescribed any
medicine.
 Other than Dr. Ahmed: Display the list of patients who are not treated by Dr. Ahmed.

Student Name: Hasnain Aslam – XI – AKU EB Page 26 of 47 XI Computer CS Practical File


1. Create table Patient (Patient_Id, Patient Name, Gender, DOB, Diagnosis,
Prescription, Doctor Name, DOT) with appropriate data types and suitable primary
key & enter 10 records.

2. Create queries in design view the following names and purposes:

 TB Patients: Displays the records of male patients who have TB diagnosed.

Student Name: Hasnain Aslam – XI – AKU EB Page 27 of 47 XI Computer CS Practical File


 Started by M: Display the name and gender of male patients whose names are started
by ‘M’.

 Fever Patients: Display the records of patients who are having Dengue, Malaria or
Typhoid

Student Name: Hasnain Aslam – XI – AKU EB Page 28 of 47 XI Computer CS Practical File


 2016 to 2018 Patients: Display the records of patients who were treated during
1/01/2016 to 1/01/2018.

 55 Years Old Females: Display the record of females who are older than 55
years on 12/12/201

Student Name: Hasnain Aslam – XI – AKU EB Page 29 of 47 XI Computer CS Practical File


 Without Prescription: Display the records of all the patients who have not
prescribed any medicine.

 Other than Dr. Ahmed: Display the list of patients who are not treated by Dr.
Ahmed

Student Name: Hasnain Aslam – XI – AKU EB Page 30 of 47 XI Computer CS Practical File


Practical 8 (SQL DML Select and Delete)
Create a database in MS Access of Employee Information
 Create table Employee (EID, Name, Gender, DOB, Department, Designation,
JoiningDate, and Email) with appropriate data types and suitable primary key.
 Create queries in design view the following names and purposes:
1. Marketing Supervisors: Displays the records of ‘marketing’ department where
designation is ‘Supervisor’
2. Started by M: Display the name of male employees whose names are started by ‘M’.
3. Clerks and Salesman: Display the records of employees who are Clerk/ Salesman
4. 2009 to 2011 Employees: Display the records of employees who joined during 1/01/2009
to 1/01/2011.
5. Age 25 Years: Display the record of female employees who are older than 25 years on
2/28/2015.
6. Without Emails: Display the records of all the employees who have no email address.
7. Other than Finance: Display the list of employees who do not belong to ‘Finance’
department.
8. Delete record from table whose employee ID is 6.

 Create table Employee (EID, Name, Gender, DOB, Department, Designation,


JoiningDate, and Email) with appropriate data types and suitable primary key.

Student Name: Hasnain Aslam – XI – AKU EB Page 31 of 47 XI Computer CS Practical File


 Create queries in design view the following names and purposes:
1. Marketing Supervisors: Displays the records of ‘marketing’ department where
designation is ‘Supervisor’

2. Started by M: Display the name of male employees whose names are started by ‘M’.

Student Name: Hasnain Aslam – XI – AKU EB Page 32 of 47 XI Computer CS Practical File


3. Clerks and Salesman: Display the records of employees who are Clerk/ Salesman

4. 2009 to 2011 Employees: Display the records of employees who joined during 1/01/2009
to 1/01/2011.

Student Name: Hasnain Aslam – XI – AKU EB Page 33 of 47 XI Computer CS Practical File


5. Age 25 Years: Display the record of female employees who are older than 25 years on
2/28/2015.

6. Without Emails: Display the records of all the employees who have no email address.

Student Name: Hasnain Aslam – XI – AKU EB Page 34 of 47 XI Computer CS Practical File


7. Other than Finance: Display the list of employees who do not belong to ‘Finance’
department.

8. Delete record from table whose employee ID is 6.

Student Name: Hasnain Aslam – XI – AKU EB Page 35 of 47 XI Computer CS Practical File


Practical 9 (SQL DML Insert and Update)

Create a database in MS Access for Cricket


 Create table SCORE (Player_Id, Player_Name, Runs, Balls) with suitable data types and
primary key.
 Enter at least five records using insert statement.
 Run SQL query to update the runs and ball of the player whose Player_Id is 452.
 Run SQL query to update the name of the player from Yousuf Yuhana to Muhammad
Yousuf.

 Create table SCORE (Player_Id, Player_Name, Runs, Balls) with suitable data types and
primary key.

Student Name: Hasnain Aslam – XI – AKU EB Page 36 of 47 XI Computer CS Practical File


 Enter at least five records using insert statement.

 Run SQL query to update the runs and ball of the player whose Player_Id is 452.

Student Name: Hasnain Aslam – XI – AKU EB Page 37 of 47 XI Computer CS Practical File


 Run SQL query to update the name of the player from Yousuf Yuhana to Muhammad
Yousuf.

Student Name: Hasnain Aslam – XI – AKU EB Page 38 of 47 XI Computer CS Practical File


Practical 10 (Calculated Fields using SQL)

Create a payroll database.


 Create 1st table Employee (Emp_ID,Name, Address)
 Create 2nd table Salary (SID,Emp_ID, Month, Year, Basic Pay)
 Create Relationship one to many between the tables and enter five records.
 Create Query Salary Detail (Emp_ID, Name, Month, Basic Pay, Medical Allowance,
Convince Allowance, House Rent Allowance, Tax, Gross Pay, Net Pay) as given below:
Medical Allowance=10% of Basic Pay, House Rent Allowance=15% of Basic Pay, Gross
Pay= Basic Pay + Medical Allowance + House Rent Allowance, Tax=3% of Gross Pay,
Net Pay=Gross Pay-Tax

 Create 1st table Employee (Emp_ID,Name, Address)

Student Name: Hasnain Aslam – XI – AKU EB Page 39 of 47 XI Computer CS Practical File


 Create 2nd table Salary (SID,Emp_ID, Month, Year, Basic Pay)

 Create Relationship one to many between the tables and enter five records.

Student Name: Hasnain Aslam – XI – AKU EB Page 40 of 47 XI Computer CS Practical File


 Create Query Salary Detail (Emp_ID, Name, Month, Basic Pay, Medical Allowance,
Convince Allowance, House Rent Allowance, Tax, Gross Pay, Net Pay) as given below:
Medical Allowance=10% of Basic Pay, House Rent Allowance=15% of Basic Pay, Gross
Pay= Basic Pay + Medical Allowance + House Rent Allowance, Tax=3% of Gross Pay,
Net Pay=Gross Pay-Tax

Student Name: Hasnain Aslam – XI – AKU EB Page 41 of 47 XI Computer CS Practical File


Practical 11 (Forms in Design View)

Create a database in MS Access for Student Result


 Create table Marks (SID, Name, Math, Computer, Physics, English, Urdu).
 Set a suitable primary key and enter five records.
 Create form Students’ Marks in design view.
o Apply a caption in it “Student Results” in Red Color.
o Write “Aga Khan Higher Secondary School” as sub heading.
o Change the label colors of all fields as “sea green” and label text color as “white”.
o Apply line thickness of text boxes by 4 points with black color.
 Save the changes and enter three more records using form.

 Create table Marks (SID, Name, Math, Computer, Physics, English, Urdu).

Student Name: Hasnain Aslam – XI – AKU EB Page 42 of 47 XI Computer CS Practical File


 Set a suitable primary key and enter five records.

 Create form Students’ Marks in design view.


o Apply a caption in it “Student Results” in Red Color.
o Write “Aga Khan Higher Secondary School” as sub heading.
o Change the label colors of all fields as “sea green” and label text color as “white”.
o Apply line thickness of text boxes by 4 points with black color.

Student Name: Hasnain Aslam – XI – AKU EB Page 43 of 47 XI Computer CS Practical File


 Save the changes and enter three more records using form.

Student Name: Hasnain Aslam – XI – AKU EB Page 44 of 47 XI Computer CS Practical File


Practical 12 (Reports Using Wizard)

Create a Database of Expenditure


 Create table Expense (Family No, Conveyance, Foods, Clothing, Rent, Education)
 Create a query having all above fields as well Total Expense using following formula:
Total Expense = Conveyance + Foods + Clothing + Rent + Education
 Enter at least ten records in the table.
 Create report using wizards with columnar layout and portrait orientation.
 Print report.

 Create table Expense (Family No, Conveyance, Foods, Clothing, Rent, Education)

Student Name: Hasnain Aslam – XI – AKU EB Page 45 of 47 XI Computer CS Practical File


 Create a query having all above fields as well Total Expense using following formula:
Total Expense = Conveyance + Foods + Clothing + Rent + Education

 Enter at least ten records in the table.

Student Name: Hasnain Aslam – XI – AKU EB Page 46 of 47 XI Computer CS Practical File


 Create report using wizards with columnar layout and portrait orientation.

 Print report.

Student Name: Hasnain Aslam – XI – AKU EB Page 47 of 47 XI Computer CS Practical File

You might also like