XII C Language & Database Practical Guide
XII C Language & Database Practical Guide
Ghori (Lecturer)
CLASS XII
ROLL NO 15559
EMAIL HasanKhan@[Link]
CONTACT 02136320000
SESSION 2020-2021
Certificate
TABLE OF CONTENTS
[Link]. Practical Page
No.
Part-1 C-Language Practical 5 – 58
1 Leap Year 6–8
2 Marks sheet 9 – 12
3 Table of inputted number 13 – 15
4 Factorial of inputted number 16 – 18
5 Inputting three numbers and finds greatest among the 19 – 22
three
6 Area and Volume Calculating program 23 – 26
7 Shatranjh (Chess/Check/Draught) Board 27 – 28
8 ASCII codes 30 – 31
9 Print name Ten(10) Times 33 – 36
10 Prime number checking program 37 – 39
11 Escape Sequences 40 – 43
12 Switch case 44 – 46
13 Pattern Printing Program 47 – 49
14 Function for summing two numbers passed as arguments 50 - 53
15 Payroll of Employee 54 – 58
Part-1 C-Language
Start
Let factorial=1
Let counter=num
No
IF
makYear%4= 0
Yes
Stop
Step1: BEGIN
Step2:DECLARE makYear AS integer
Step2: WRITE “Enter any year to check whether it’s LEAP year or
NOT? "
Step3: READ, makYear
Step4: IF (makYear%4)=1 THEN
WRITE “Given year “,makYear,” is LEAP year”
ELSE
WRITE “Given year ”,makYear,” ISN’T leap year”
Step5: READ a character
Step6:END
clrscr();
// below code is for showing heading of the output
printf("\n\t\t______________________________");
printf("\n\t\tThis is sample Practical No.01");
printf("\n\t\t~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
printf("\n\t Enter any year to check whether it's LEAP year or NOT? ");
scanf("%d",&makYear);
if(givenYear%4==0)
{printf("\n\t Given year %d is LEAP year",makYear);}
else
{printf("\n\t Given year %d ISN'T leap year",makYear);}
Yes
Yes
NO
Test
INPUT marks(counter) IF percentage<33
Yes
PRINT “FAIL”
Let percentage=total*100.0/500
A Stop
#include <stdio.h>
#include <conio.h>
int marks[5],total,counter;
float percentage;
// varible declaration.
clrscr();
// below code is for showing heading of the output
printf("\n\t\t______________________________");
printf("\n\t\tThis is sample Practical No.02");
printf("\n\t\t~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
total=0;percentage=1.0;
for(counter=0;counter<5;counter++)
{
printf("\n\t Enter Subject [%d] marks? ",counter+1);
scanf("%d",&marks[counter]);
total+=marks[counter];
}
percentage=total*100.0/500;
for(counter=0;counter<5;counter++)
{
printf("\n\t Subject[%d] marks= %d",counter+1,marks[counter]);
}
printf("\n\n\t\tTotal= %d out of 500",total);
printf("\n\n\t\tPercentage= %.2f\n\n\t\t\t",percentage);
if(percentage<33)
{printf("FAIL");}
else
{printf("PASS");}
Subject[1] marks= 70
Subject[2] marks= 60
Subject[3] marks= 80
Subject[4] marks= 90
Subject[5] marks= 100
PASS
**************************************************************************/
INPUT makNumber
Let makMultiple=1
No
Test For
makMultiple < 12
Yes
PRINT
makNumber,”*”,makMultiple,”=”,
(makNumber*makMultiple)
Let makMultiple =
makMultiple+1
Stop
Step1: BEGIN
Step2:DECLARE makNumber,makMultiple as integer
Step3: WRITE “Enter any number to generate it’s table? "
Step4: READ makNumber
Step5: FOR makMultiple=1 TO 12 STEP 1
Step6: WRITE
makNumber,”*”,makMultiple,”=”,(makNumber*makMultiple)
Step7: NEXT makMultiple
Step8: READ character
Step9: END
#include <stdio.h>
#include <conio.h>
Let factorial=1
Let counter=num
No
Test
For counter>= 1
Yes
Stop
Step1: BEGIN
Step2:DECLARE counter,factorial,num AS long integer
Step2: WRITE “Enter Number for Factorial? "
Step3: READ num
Step4: SET factorial=1
Step5: SET counter=factorial
Step7: FOR counter=factorial down to 2 STEP=-1
Step8: SET factorial=factorial*counter
Step9: NEXT counter
Step10:WRITE “Factorial of”, num, “ = " ,factorial
Step11:END
#include <stdio.h>
#include <conio.h>
int inputtedNumber,factorial;
// variable declaration.
Yes
INPUT “Enter Number2? “ PRINT mgNum2 ”is GREATEST
,mgNum2 among all three inputted”
No Test Stop
IF mgNum1 >
mgNum2
Yes
Test No
IF mgNum1 >
mgNum3
Yes
PRINT mgNum1 ”is GREATEST
among all three inputted”
if(mgNum1>mgNum2)
{ // body of outer-most if statement.
if(mgNum1>mgNumb3)
{ // body of inner if statement.
printf("\n\t\t number1=[%d] is GREATEST among all three inputted Numbers",mgNum1);
}
else
{ // else of inner if.
printf("\n\t\t number3=[%d] is GREATEST among all three inputted Numbers",mgNum3);
}
}
else if(mgNum2>=mgNum3)
{ // else-if of outer-most if statement.
printf("\n\t\t number2=[%d] is GREATEST among all three inputted Numbers",mgNum2);
}
else
{ // else of outer-most if statement.
printf("\n\t\t number3=[%d] is GREATEST among all three inputted Numbers",mgNum3);
}
Let areaOfTriangle =
(1.0/2.0)*base*height
#include <stdio.h>
#include <conio.h>
#include <math.h>
#define pi 3.14
float areaOfTriangle,volumeOfSphere; // variable declaration.
int radius,base,height;
void main(void) // main function.
{ // start of-(sof) body of main function.
clrscr();
// below code is for showing heading of the output
printf("\n\t\t______________________________");
printf("\n\t\tThis is sample Practical No.06");
printf("\n\t\t~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
areaOfTriangle=(1.0/2.0*base*height);
volumeOfSphere= 4.0/3*pi*pow(radius,3);
***********************************************************************/
Let mgRow=1
Let mgCol = mgCol + 1
4
5
2
Yes 1
Let mgCol=1
Stop
No Test
2 For mgCol <= 8
Yes
No Test
IF (mgRow+mgCol)
mod 2 = 0
Yes
PRINT “ “
3
PRINT “██”
3
#include <stdio.h>
#include <conio.h>
int mgRow,mgColumn; // variable declaration.
if((mgRow+mgColumn)%2==0)
printf(" ");
else
printf("██"); // Ascii code of █ is 219 can also be used.
} // end of for columnCounter loop.
Start
Let mgAsciiCode=32
No Test For
Stop mgAsciiCode <=
127
Yes
PRINT “Character is
“,char(mgAsciiCode),” (code= “,
mgAsciiCode , ”)”
Step1: BEGIN
Step2: DECLARE mgAsciiCode AS integer
Step3: FOR mgAsciiCode=32 to 127 Step=1
Step4: WRITE “Character is “,char(mgAsciiCode),” (code= “,
mgAsciiCode , ”)”
Step5: READ character
Step6: END
#include <stdio.h>
#include <conio.h>
***********************************************************************/
Start
Let numOfTimes=1
Step1: BEGIN
Step2: DECLARE Dim makName(20) AS character, numOfTimes
as integer
Step3: WRITE “Enter your name ? “
Step4: READ makName
Step5: FOR numOfTimes=1 to 10 Step=1
Step6: WRITE “Your Name”, makName , “ is printed“,
numOfTimes, “ times
Step7: READ character
Step8: END
#include <stdio.h>
#include <conio.h>
Let divisor=makNum/2
Stop
Test
1 For divisor >= 2
Let flag=1
Test
IF flag = 0
#include <stdio.h>
#include <conio.h>
for(divisor=number/2;divisor>=2;divisor--)
{
if(number%divisor==0) {flag=1;printf("%d absolutely divide %d",divisor,number); break;}
}
***********************************************************************/
Step1: BEGIN
Step2: DECLARE mgName AS String, makAlphabet AS Character,
age AS integer, height AS Real number
Step3: WRITE “Enter your name? "
Step4: READ mgName
Step5: WRITE “Enter your favorite English alphabet?”
Step6: READ makAlphabet
Step7: WRITE “Enter your age (5-100 etc)? "
Step8: READ age
Step9: WRITE ”Enter your height (5.4/6.0 etc)? "
Step10: READ height
Step11: WRITE “Your Name is ”,mgName
Step12: WRITE “you like English alphabet “,makAlphabet
Step13: WRITE ”you are “,age, “ years old”
Step14: WRITE “ and “,height, “ feet tall."
Step15: END
#include <stdio.h>
#include <conio.h>
Let makRow=1
3
4 Stop
No Test
2 For makCol <= 8
Yes
Yes
Test case
No
(makRow+makCol)
mod 2 = 0
Yes
PRINT “ “
3
PRINT “██”
3
#include <stdio.h>
#include <conio.h>
int makRow,makCol,result; // variable declaration.
switch(result)
{ // start of switch(result) body.
case 0:printf(" ");break;
default:printf("%c%c",219,219); // Ascii code of █ is 219 can also be used.
} // end of switch(result)-statement .
***********************************************************************/
Start
Let makRow=1
Test No
For makRow <=5 Stop
Yes
Let makCol=1
No Test
For makCol <= 2
makRow
Yes
PRINT “*“ Let makCol = makCol + 1
Step1: BEGIN
Step2: DECLARE makRow,makCol,result AS integer
Step3: FOR makRow=1 TO 5 STEP=+1
Step4: WRITELINE
Step5: FOR makCol=1 TO makRow STEP=+1
Step6: WRITE “ * “
Step7: NEXT makCol
Step8: NEXT makRow
Step9: READ character
Step10: END
#include <stdio.h>
#include <conio.h>
int makRow,makCol;
; // variable declaration.
for(makRow=1;makCol<=5;makRow++)
{
printf("\n\t\t\t"); // printing line and tab gap on screen.
for(makCol=1;makCol<=makRow;makCol++)
{
printf(" *");
} // end of for makCol loop.
} // end of for makRow loop.
getch(); // pause screen till any button is pressed.
} // end of-(eof) body of main function.
/************************ OUTPUT *************************************
_______________________________
This is sample Practical No.13
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*
**
***
****
*****
***********************************************************************/
Start
makSum1(number1,number2)
Calling Sub-process
makSum1(number1 ,
number2)
Stop Start
Stop
#include <stdio.h>
#include <conio.h>
sum1(number1,number2); // calling sum1 function & passing number1 & number2 to it.
Enter Number2 ? 6
Sum of 7 + 6 = 13
***********************************************************************/
Let medicalAllowance =
RETURN percentageCalculator(mgB
(amount*percent/100.0) AS asicPay, 25)
Real number
Let conveyanceAllowance=
percentageCalculator(mgB
asicPay, 20)
Stop
Let houseRent =
percentageCalculator(mgB
asicPay, 45)
Let gpFund =
percentageCalculator(mgB
asicPay, 7)
AAA
AAA
Stop
allowance as 20% and house rent 45 % of basic pay and deduction of GP fund 7% of basic
pay
#include <stdio.h>
#include <conio.h>
float mgBasicPay,medicalAllowance,conveyanceAllowance,houseRent,gpFund,grossPay,netPay;
// variable declaration.
medicalAllowance=percentageCalculator(mgBasicPay,25);
conveyanceAllowance=percentageCalculator(mgBasicPay,20);
houseRent=percentageCalculator(mgBasicPay,45);
gpFund=percentageCalculator(mgBasicPay,7);
grossPay=mgBasicPay+medicalAllowance+conveyanceAllowance+houseRent;
netPay=grossPay-gpFund;
Part-2 Databases
Practical No.1
Queries
1. Assign primary key to a suitable column.
[Link] 5 records
3. Dispay all records having same Department
4. List all the records with designation Lecturer.
Procedure
Switching on Computer
1- Switch on your computer. Wait till the operation system “Windows” let you give access to
interact with the computer.
3-Use Mouse click “Search Bar”, type “Microsoft Office Access” in it with the help of computer
keyboard to search and open MS-Access.
Creating Database
4-Point Mouse Cursor to Blank Database, it will be highlighted then click it with mouse.
5- New panel at right hand side will be open, point your mouse cursor to the file name location,
type new name “TeacherDatabase” there then click “Create” button.
9- Use mouse to point the cell below “Data Type”, select there “Auto Number” from the
available “combo box” option list.
10- Use mouse to point the next cell present under “Description” heading, type the description
whatever you want to write for your future reference or let it remain empty.
11- Repeat above steps till all the remaining fields (TeacherName, Designation, Department)
with “data types” and “description” are properly typed into the corresponding cell of Database
Design Window. Always use “Text” data type for fields like [Name, Address, Contact, Email
etc.], “AutoNumber” for automatic assignment of numbers. “Numeric” for fields on which
calculation are performed, “Currency” for fields like [wages, salary], “Date” for fields which are
supposed to store dates, “Hyperlink” for fields holding [websites / urls etc.], “OLE Object” for
picture, photographs, “Yes/No” for status showing field, “Attachment” for external files,
“Memo” for descriptive fields.”Lookup Wizard” for foreign fields from other tables of the
database.
12-
Requirement#1- Assigning Primary Key to the suitable field i.e “FacultyId”
which can be capable of identifying each record uniquely. If it is already assigned by computer
then no need to re-assign it.
14
Requirement#2- Entering Five(5) Records
Queries Design
15-With the help of mouse click “Create”, then point and left click “Query Design”.
17- “Show table” panel will be open, select ” Table” tab from “Table/Query/Both”.
Point and double left click the desired tables from available list of tables, to add these
tables then left click “cross/close” present on top-right hand side of the panel, to close
it.
18- Select field name from the available list of “combo-box”, which you want to display
or manipulate. Table name of that particular field will automatically be added after your
selection of field. Mention the criteria if you want. Uncheck the ”CheckBox” if you don’t
want to display this field.
19- Do repeat above step number 19 for each and every field, you want more to display
or manipulate until you complete all desired field entries
20- Now in the “criteria” cell of field “Department” enter the contents “Computer
Science” to create the query of “all records having same department” and then Left click
the “Cross/Close” button to close the Query Panel, left click “Yes” Button to save the
Query1 with the new name “TeacherQuery1”, again left click “Ok” Button. You can
save query with your desired name as well.
21- Repeat from above step number 17 to 21 for creating remaining queries, just
remove the contents of criteria cell, as per your requirement i.e. remove the contents
Output
Practical No.2
Queries
1. Assign primary key to a suitable column.
[Link] 5 records
3. Dispay all records
4. Search record with StudentID.
Procedure
Switching on Computer
1- Switch on your computer. Wait till the operation system “Windows” let you give access to
interact with the computer.
3-Use Mouse click “Search Bar”, type “Microsoft Office Access” in it with the help of computer
keyboard to search and open MS-Access.
Creating Database
4-Point Mouse Cursor to Blank Database, it will be highlighted then click it with mouse.
5- New panel at right hand side will be open, point your mouse cursor to the file name location,
type new name “StudentDatabase” there then click “Create” button.
9- Use mouse to point the cell below “Data Type”, select there “Auto Number” from the
available “combo box” option list.
10- Use mouse to point the next cell present under “Description” heading, type the description
whatever you want to write for your future reference or let it remain empty.
11- Repeat above steps till all the remaining fields (StudentName, Address, Cellno) with “data
types” and “description” are properly typed into the corresponding cell of Database Design
Window. Always use “Text” data type for fields like [Name, Address, Contact, Email etc.],
“AutoNumber” for automatic assignment of numbers. “Numeric” for fields on which
calculation are performed, “Currency” for fields like [wages, salary], “Date” for fields which are
supposed to store dates, “Hyperlink” for fields holding [websites / urls etc.], “OLE Object” for
picture, photographs, “Yes/No” for status showing field, “Attachment” for external files,
“Memo” for descriptive fields.”Lookup Wizard” for foreign fields from other tables of the
database.
12-
Requirement#1- Assigning Primary Key to the suitable field i.e “StudentId”
which can be capable of identifying each record uniquely. If it is already assigned by computer
then no need to re-assign it.
Queries Design
15-With the help of mouse click “Create”, then point and left click “Query Design”.
17- “Show table” panel will be open, select ” Table” tab from “Table/Query/Both”.
Point and double left click the desired tables from available list of tables, to add these
tables then left click “cross/close” present on top-right hand side of the panel, to close
it.
18- Select field name from the available list of “combo-box”, which you want to display
or manipulate. Table name of that particular field will automatically be added after your
selection of field. Mention the criteria if you want. Uncheck the ”CheckBox” if you don’t
want to display this field.
19- Do repeat above step number 19 for each and every field, you want more to display
or manipulate until you complete all desired field entries
20- Now in the “criteria” cell of field “StudentId” enter the contents “[Enter Student
Id?]” to create the query of “Showing student record by Student Id” and then Left click
the “Cross/Close” button to close the Query Panel, left click “Yes” Button to save the
Query1 with the new name “Student By ID”, again left click “Ok” Button. You can save
query with your desired name as well.
21- Repeat from above step number 17 to 21 for creating remaining queries, just
remove/change the contents of criteria cell, as per your requirement.
Output
Requirement#3- Showing all Five(5) Records
Practical No.3
Queries
1. Assign primary key to StudentId.
[Link] 5 records
3. Display all records of Female students
4. List all the records of students
Procedure
Switching on Computer
1- Switch on your computer. Wait till the operation system “Windows” let you give access to
interact with the computer.
3-Use Mouse click “Search Bar”, type “Microsoft Office Access” in it with the help of computer
keyboard to search and open MS-Access.
Creating Database
4-Point Mouse Cursor to Blank Database, it will be highlighted then click it with mouse.
5- New panel at right hand side will be open, point your mouse cursor to the file name location,
type new name “StudentsDatabase” there then click “Create” button.
9- Use mouse to point the cell below “Data Type”, select there “Auto Number” from the
available “combo box” option list.
10- Use mouse to point the next cell present under “Description” heading, type the description
whatever you want to write for your future reference or let it remain empty.
11- Repeat above steps till all the remaining fields (StudentName, Class, Group, Gender) with
“data types” and “description” are properly typed into the corresponding cell of Database
Design Window. Always use “Text” data type for fields like [Name, Address, Contact, Email
etc.], “AutoNumber” for automatic assignment of numbers. “Numeric” for fields on which
calculation are performed, “Currency” for fields like [wages, salary], “Date” for fields which are
supposed to store dates, “Hyperlink” for fields holding [websites / urls etc.], “OLE Object” for
picture, photographs, “Yes/No” for status showing field, “Attachment” for external files,
“Memo” for descriptive fields.”Lookup Wizard” for foreign fields from other tables of the
database.
12-
Requirement#1- Assigning Primary Key to the suitable field i.e “StudentID”
which can be capable of identifying each record uniquely. If it is already assigned by computer
then no need to re-assign it.
Queries Design
15-With the help of mouse click “Create”, then point and left click “Query Design”.
17- “Show table” panel will be open, select ” Table” tab from “Table/Query/Both”.
Point and double left click the desired tables from available list of tables, to add these
tables then left click “cross/close” present on top-right hand side of the panel, to close
it.
18- Select field name from the available list of “combo-box”, which you want to display
or manipulate. Table name of that particular field will automatically be added after your
selection of field. Mention the criteria if you want. Uncheck the ”CheckBox” if you don’t
want to display this field.
19- Do repeat above step number 19 for each and every field, you want more to display
or manipulate until you complete all desired field entries
20- Now in the “criteria” cell of field “Gender” enter the contents “Female” to create
the query of “all female records” and then Left click the “Cross/Close” button to close
the Query Panel, left click “Yes” Button to save the Query1 with the new name
“FemaleStudents”, again left click “Ok” Button. You can save query with your desired
name as well.
21- Repeat from above step number 17 to 21 for creating remaining queries, just
remove/change the contents of criteria cell, as per your requirement.
Output
Practical No.4
Queries
1. Assign primary key to a suitable column.
[Link] 5 records
3. Add a column Balance
4. Update the column Balance.
Procedure
Switching on Computer
1- Switch on your computer. Wait till the operation system “Windows” let you give access to
interact with the computer.
3-Use Mouse click “Search Bar”, type “Microsoft Office Access” in it with the help of computer
keyboard to search and open MS-Access.
Creating Database
4-Point Mouse Cursor to Blank Database, it will be highlighted then click it with mouse.
5- New panel at right hand side will be open, point your mouse cursor to the file name location,
type new name “MyBankDatabase” there then click “Create” button.
9- Use mouse to point the cell below “Data Type”, select there “Auto Number” from the
available “combo box” option list.
10- Use mouse to point the next cell present under “Description” heading, type the description
whatever you want to write for your future reference or let it remain empty.
11- Repeat above steps till all the remaining fields (AccountName, Credit, Debit) with “data
types” and “description” are properly typed into the corresponding cell of Database Design
Window. Always use “Text” data type for fields like [Name, Address, Contact, Email etc.],
“AutoNumber” for automatic assignment of numbers. “Numeric” for fields on which
calculation are performed, “Currency” for fields like [wages, salary], “Date” for fields which are
supposed to store dates, “Hyperlink” for fields holding [websites / urls etc.], “OLE Object” for
picture, photographs, “Yes/No” for status showing field, “Attachment” for external files,
“Memo” for descriptive fields.”Lookup Wizard” for foreign fields from other tables of the
database.
12-
Requirement#1- Assigning Primary Key to the suitable field i.e “AccountNo”
which can be capable of identifying each record uniquely. If it is already assigned by computer
then no need to re-assign it.
Queries Design
15-With the help of mouse click “Create”, then point and left click “Query Design”.
17- “Show table” panel will be open, select ” Table” tab from “Table/Query/Both”.
Point and double left click the desired tables from available list of tables, to add these
tables then left click “cross/close” present on top-right hand side of the panel, to close
it.
18- Select field name from the available list of “combo-box”, which you want to display
or manipulate. Table name of that particular field will automatically be added after your
selection of field. Mention the criteria if you want. Uncheck the ”CheckBox” if you don’t
want to display this field.
19- Do repeat above step number 19 for each and every field, you want more to display
or manipulate until you complete all desired field entries
20- Now add new column “Balance” in the query “MyBank Query” in “design view”.
Write like this “Balance:[Credit]*[Debit]” in the Field corresponding cell to make it
calculated field to create the query of “all records show balance” and then Left click the
“Cross/Close” button to close the Query Panel, left click “Yes” Button to save the
Query1 with the new name “MyBank Query”, again left click “Ok” Button. You can save
query with your desired name as well.
21- Repeat from above step number 17 to 21 for creating remaining queries, just
remove the contents of criteria cell, as per your requirement.
Output
Requirement#3- Inserting Balance Column
Practical No.5
Queries
1. Assign primary key to a suitable column.
[Link] 5 records
3. Dispay all books which are not for lending
4. Find list of books issued.
Procedure
Switching on Computer
1- Switch on your computer. Wait till the operation system “Windows” let you give access to
interact with the computer.
3-Use Mouse click “Search Bar”, type “Microsoft Office Access” in it with the help of computer
keyboard to search and open MS-Access.
Creating Database
4-Point Mouse Cursor to Blank Database, it will be highlighted then click it with mouse.
5- New panel at right hand side will be open, point your mouse cursor to the file name location,
type new name “LibraryDatabase” there then click “Create” button.
9- Use mouse to point the cell below “Data Type”, select there “Auto Number” from the
available “combo box” option list.
10- Use mouse to point the next cell present under “Description” heading, type the description
whatever you want to write for your future reference or let it remain empty.
11- Repeat above steps till all the remaining fields (BookName, Reference, Issued) with “data
types” and “description” are properly typed into the corresponding cell of Database Design
Window. Always use “Text” data type for fields like [Name, Address, Contact, Email etc.],
“AutoNumber” for automatic assignment of numbers. “Numeric” for fields on which
calculation are performed, “Currency” for fields like [wages, salary], “Date” for fields which are
supposed to store dates, “Hyperlink” for fields holding [websites / urls etc.], “OLE Object” for
picture, photographs, “Yes/No” for status showing field, “Attachment” for external files,
“Memo” for descriptive fields.”Lookup Wizard” for foreign fields from other tables of the
database.
12-
Requirement#1- Assigning Primary Key to the suitable field i.e “BookId” which
can be capable of identifying each record uniquely. If it is already assigned by computer then no
need to re-assign it.
Queries Design
15-With the help of mouse click “Create”, then point and left click “Query Design”.
17- “Show table” panel will be open, select ” Table” tab from “Table/Query/Both”.
Point and double left click the desired tables from available list of tables, to add these
tables then left click “cross/close” present on top-right hand side of the panel, to close
it.
18- Select field name from the available list of “combo-box”, which you want to display
or manipulate. Table name of that particular field will automatically be added after your
selection of field. Mention the criteria if you want. Uncheck the ”CheckBox” if you don’t
want to display this field.
19- Do repeat above step number 19 for each and every field, you want more to display
or manipulate until you complete all desired field entries
20- Now in the “criteria” cell of field “Reference” enter the contents “Yes” to create the
query of “all books not for lending (Reference Books)” and then Left click the
“Cross/Close” button to close the Query Panel, left click “Yes” Button to save the
Query1 with the new name “Reference Books(Not for Lending)”, again left click “Ok”
Button. You can save query with your desired name as well.
21- Repeat from above step number 17 to 21 for creating remaining queries, just
remove/change the contents of criteria cell, as per your requirement.
Output
Practical No.6
Queries
1. Assign primary key to a suitable column.
[Link] 5 records
3. Display particular record by EmployeeId
4. Display those records who have the same Address.
Procedure
Switching on Computer
1- Switch on your computer. Wait till the operation system “Windows” let you give access to
interact with the computer.
3-Use Mouse click “Search Bar”, type “Microsoft Office Access” in it with the help of computer
keyboard to search and open MS-Access.
Creating Database
4-Point Mouse Cursor to Blank Database, it will be highlighted then click it with mouse.
5- New panel at right hand side will be open, point your mouse cursor to the file name location,
type new name “EmployeeDatabase” there then click “Create” button.
9- Use mouse to point the cell below “Data Type”, select there “Auto Number” from the
available “combo box” option list.
10- Use mouse to point the next cell present under “Description” heading, type the description
whatever you want to write for your future reference or let it remain empty.
11- Repeat above steps till all the remaining fields (EmployeeName, Address, Postcode,
DateHired) with “data types” and “description” are properly typed into the corresponding cell
of Database Design Window. Always use “Text” data type for fields like [Name, Address,
Contact, Email etc.], “AutoNumber” for automatic assignment of numbers. “Numeric” for fields
on which calculation are performed, “Currency” for fields like [wages, salary], “Date” for fields
which are supposed to store dates, “Hyperlink” for fields holding [websites / urls etc.], “OLE
Object” for picture, photographs, “Yes/No” for status showing field, “Attachment” for external
files, “Memo” for descriptive fields.”Lookup Wizard” for foreign fields from other tables of the
database.
12-
Requirement#1- Assigning Primary Key to the suitable field i.e “EmployeeID”
which can be capable of identifying each record uniquely. If it is already assigned by computer
then no need to re-assign it.
Queries Design
15-With the help of mouse click “Create”, then point and left click “Query Design”.
17- “Show table” panel will be open, select ” Table” tab from “Table/Query/Both”.
Point and double left click the desired tables from available list of tables, to add these
tables then left click “cross/close” present on top-right hand side of the panel, to close
it.
18- Select field name from the available list of “combo-box”, which you want to display
or manipulate. Table name of that particular field will automatically be added after your
selection of field. Mention the criteria if you want. Uncheck the ”CheckBox” if you don’t
want to display this field.
19- Do repeat above step number 19 for each and every field, you want more to display
or manipulate until you complete all desired field entries
20- Now in the “criteria” cell of field “EmployeeID” enter the contents “[Enter
EmployeeID?]” to create the query of “Display Particular Record by Employee ID” and
then Left click the “Cross/Close” button to close the Query Panel, left click “Yes” Button
to save the Query1 with the new name “Employees By ID”, again left click “Ok” Button.
You can save query with your desired name as well.
21- Now in the “criteria” cell of field “Address” enter the contents “Like * Gulshan-e-
Iqbal Karachi” to create the query of “Records having same address” and then Left click
the “Cross/Close” button to close the Query Panel, left click “Yes” Button to save the
Query1 with the new name “Employees By Address”, again left click “Ok” Button. You
can save query with your desired name as well.
22- Repeat from above step number 17 to 21 for creating remaining queries, just
remove the contents of criteria cell, as per your requirement.
Output
Requirement#3. Display particular record by EmployeeId
Practical No.7
Queries
1. Input 5 records
2. Search the desired AccountNo
3. Delete the desired AccountNo
4. Update desired AccountId.
Procedure
Switching on Computer
1- Switch on your computer. Wait till the operation system “Windows” let you give access to
interact with the computer.
3-Use Mouse click “Search Bar”, type “Microsoft Office Access” in it with the help of computer
keyboard to search and open MS-Access.
Creating Database
4-Point Mouse Cursor to Blank Database, it will be highlighted then click it with mouse.
5- New panel at right hand side will be open, point your mouse cursor to the file name location,
type new name “BankAccountDatabase” there then click “Create” button.
9- Use mouse to point the cell below “Data Type”, select there “Auto Number” from the
available “combo box” option list.
10- Use mouse to point the next cell present under “Description” heading, type the description
whatever you want to write for your future reference or let it remain empty.
11- Repeat above steps till all the remaining fields (AccountName, HolderAddress, Contact,
Email) with “data types” and “description” are properly typed into the corresponding cell of
Database Design Window. Always use “Text” data type for fields like [Name, Address, Contact,
Email etc.], “AutoNumber” for automatic assignment of numbers. “Numeric” for fields on
which calculation are performed, “Currency” for fields like [wages, salary], “Date” for fields
which are supposed to store dates, “Hyperlink” for fields holding [websites / urls etc.], “OLE
Object” for picture, photographs, “Yes/No” for status showing field, “Attachment” for external
files, “Memo” for descriptive fields.”Lookup Wizard” for foreign fields from other tables of the
database.
12- Repeat steps 6 to 11 for “AccountStatus” Table having fields (AccountNo as Foreign Key
from BankAccount Table, AccountStatus)
13-
Assigning Primary Key to the suitable field i.e “AccountNo” in “BankAccount” table as
well as in “Account Status” table which can be capable of identifying each record uniquely.
Queries Design
16-With the help of mouse click “Create”, then point and left click “Query Design”.
17- “Show table” panel will be open, select ” Table” tab from “Table/Query/Both”.
Point and double left click the desired tables from available list of tables, to add these
tables then left click “cross/close” present on top-right hand side of the panel, to close
it.
18- Select field name from the available list of “combo-box”, which you want to display
or manipulate. Table name of that particular field will automatically be added after your
selection of field. Mention the criteria if you want. Uncheck the ”CheckBox” if you don’t
want to display this field.
20- Now in the “criteria” cell of field “AccountNo”, table “BankAccount” enter the
contents “[BankAccount].[givenAccount]” to create the query of “all records having
same department” and then Left click the “Cross/Close” button to close the Query
Panel, left click “Yes” Button to save the Query1 with the new name “BankRecord
Display By Id”, again left click “Ok” Button. You can save query with your desired name
as well.
21- Repeat from above step number 17 to 21 for creating remaining queries, just
remove the contents of criteria cell, as per your requirement.
Output
Requirement#2-Search Account by ID