0% found this document useful (0 votes)
196 views64 pages

DBMS Lab Manual: Employee Database Queries

The document outlines a case study involving the creation and management of employee and banking databases, including SQL queries for data manipulation and retrieval. It details the structure of tables such as Employee, EmpSalary, Account, and Loan, along with example data entries and various SQL queries to perform operations like displaying employee details, calculating salaries, and summarizing account information. Additionally, it provides explanations for each query to clarify their purpose and expected outcomes.
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)
196 views64 pages

DBMS Lab Manual: Employee Database Queries

The document outlines a case study involving the creation and management of employee and banking databases, including SQL queries for data manipulation and retrieval. It details the structure of tables such as Employee, EmpSalary, Account, and Loan, along with example data entries and various SQL queries to perform operations like displaying employee details, calculating salaries, and summarizing account information. Additionally, it provides explanations for each query to clarify their purpose and expected outcomes.
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

SMT.

KUMUDBEN DARBAR COLLEGE OF COMM,SCI AND MANAGEMENT STUDIES,VIJAYAPUR

Case Study 1:
(Select clause, Arithmetic Operators)
Database: Employee
1. Create the following tables with suitable constraints and insert tuples.

Table Name-Employee

Emp_Id Last_Name Hire_Date Address City


First_Name
1001 Raghav Patel 11-May-06 83 first Belagavi
street
1002 Mohini Rathi 25-Feb-08 842 Vine Athani
Ave
1012 Sham Pujari 12-Sep-05 33 Elm St. Mysore
1015 Kriti Dev 19-Dec-06 11 Red Belagavi
Road
1016 Sarath Sharma 22-Aug-07 440 MG New Delhi
Road
1020 Monika Gupta 07-Jun-08 9 Bandra Mumbai

Table Name- EmpSalary


Emp_Id Salary Benefits Designation
1001 10000 3000 Manager
1002 8000 1200 Salesman
1012 20000 5000 Director
1015 6500 1300 Clerk
1016 6000 1000 Clerk
1020 8000 1200 Salesman

Write queries for the following


1. Display FIRSTNAME, LASTNAME, ADDRESS, and CITY of all employees living in PARIS.
2. Display the content of the employee table in descending order of FIRSTNAME
3. Select the FIRSTNAME and SALARY of the salesman
4. To display the FIRSTNAME, LASTNAME, AND TOTAL SALARY of all employees from the table
EMPLOYEE and EMPSALARY. Where TOTAL SALARY is calculated as SALARY+BENEFITS
5. List the Names of employees, who are more than 1 year old in the organization
6. Count the number of distinct DESIGNATION from EMPSALARY
7. List the employees whose names have exactly 6 characters
8. Add new column PHONE_NO to EMPLOYEE and update the records
9. List employee names, who have joined before 15-Jun-08 and after 16-Jun-07
10. Generate Salary slip with Name, Salary, Benefits, HRA-50%, DA-30%, PF-12%, Calculate gross.
Order the result in descending order of the gross.

Prepared by:Sachinkumar Bagewadi MCA DBMS LAB MANUAL Page 1


[Link] DARBAR COLLEGE OF COMM,SCI AND MANAGEMENT STUDIES,VIJAYAPUR

Solution For Case study1:

Table Creation:

[Link]

CREATE TABLE Employee

Emp_Id INT PRIMARY KEY,

First_Name VARCHAR(50),

Last_Name VARCHAR(50),

Hire_Date VARCHAR(50),

Address VARCHAR(100),

City VARCHAR(50)

);

[Link]

CREATE TABLE EmpSalary

Emp_Id INT PRIMARY KEY,

Salary DECIMAL(10, 2),

Benefits DECIMAL(10, 2),

Designation VARCHAR(50)

);

Prepared by:Sachinkumar Bagewadi MCA DBMS LAB MANUAL Page 2


[Link] DARBAR COLLEGE OF COMM,SCI AND MANAGEMENT STUDIES,VIJAYAPUR

Insetion:

INSERT INTO Employee VALUES

(1001, 'Raghav', 'Patel', '2006-05-11', '83 first street', 'Belagavi'),

(1002, 'Mohini', 'Rathi', '2008-02-25', '842 Vine Ave', 'Athani'),

(1012, 'Sham', 'Pujari', '2005-09-12', '33 Elm St.', 'Mysore'),

(1015, 'Kriti', 'Dev', '2006-12-19', '11 Red Road', 'Belagavi'),

(1016, 'Sarath', 'Sharma', '2007-08-22', '440 MG Road', 'New Delhi'),

(1020, 'Monika', 'Gupta', '2008-06-07', '9 Bandra', 'Mumbai');

INSERT INTO EmpSalary VALUES

(1001, 10000, 3000, 'Manager'),

(1002, 8000, 1200, 'Salesman'),

(1012, 20000, 5000, 'Director'),

(1015, 6500, 1300, 'Clerk'),

(1016, 6000, 1000, 'Clerk'),

(1020, 8000, 1200, 'Salesman');

Prepared by:Sachinkumar Bagewadi MCA DBMS LAB MANUAL Page 3


[Link] DARBAR COLLEGE OF COMM,SCI AND MANAGEMENT STUDIES,VIJAYAPUR

Write queries for the following


1. Display FIRSTNAME, LASTNAME, ADDRESS, and CITY of all employees living in PARIS.

Query:

SELECT First_Name, Last_Name, Address, City

FROM Employee

WHERE City = 'Paris';

This query retrieves the specified columns for any employees whose city is 'Paris.

2. Display the content of the employee table in descending order of FIRSTNAME

Query:

SELECT *

FROM Employee

ORDER BY First_Name DESC;

This query selects all columns from the Employee table and orders the results by the First_Name column in
descending order.

3. Select the FIRSTNAME and SALARY of the salesman


Query:

SELECT e.First_Name, [Link]

FROM Employee e

JOIN EmpSalary es ON e.Emp_Id = es.Emp_Id

WHERE [Link] = 'Salesman';

This query retrieves the First_Name and Salary of employees who have the designation "Salesman" by
joining the two tables on the Emp_Id column.

Prepared by:Sachinkumar Bagewadi MCA DBMS LAB MANUAL Page 4


[Link] DARBAR COLLEGE OF COMM,SCI AND MANAGEMENT STUDIES,VIJAYAPUR

4. To display the FIRSTNAME, LASTNAME, AND TOTAL SALARY of all employees from the table
EMPLOYEE and EMPSALARY. Where TOTAL SALARY is calculated as SALARY+BENEFITS
Query:

SELECT e.First_Name, e.Last_Name, ([Link] + [Link]) AS Total_Salary

FROM Employee e

JOIN EmpSalary es ON e.Emp_Id = es.Emp_Id;

Explanation:

 This query selects the First_Name and Last_Name from the Employee table.
 It calculates the Total_Salary by adding Salary and Benefits from the EmpSalary table.
 The two tables are joined using the Emp_Id column.

5. List the Names of employees, who are more than 1 year old in the organization
Query:

SELECT First_Name, Last_Name

FROM Employee

WHERE Hire_Date < DATEADD(YEAR, -1, GETDATE());

Explanation:

 First_Name and Last_Name are selected from the Employee table.


 The WHERE clause checks if the Hire_Date is earlier than one year ago from the current date.
 DATEADD(YEAR, -1, GETDATE()) subtracts one year from the current date. (Note: This syntax is for
SQL Server. For other databases, the function might differ; for example, in MySQL, you would use NOW()
- INTERVAL 1 YEAR).

6. Count the number of distinct DESIGNATION from EMPSALARY


Query:

SELECT COUNT(DISTINCT Designation) AS Distinct_Designations

FROM EmpSalary;

Explanation:

 COUNT(DISTINCT Designation) counts the unique values in the Designation column.


 The result will be returned with the alias Distinct_Designations.

This query will give you the total number of unique designations present in the EmpSalary table.

Prepared by:Sachinkumar Bagewadi MCA DBMS LAB MANUAL Page 5


[Link] DARBAR COLLEGE OF COMM,SCI AND MANAGEMENT STUDIES,VIJAYAPUR

7. List the employees whose names have exactly 6 characters


Query:

SELECT *

FROM Employee

WHERE LENGTH(First_Name) = 6;

8. Add new column PHONE_NO to EMPLOYEE and update the records


Query:

Step 1: Alter the Employee table to add the PHONE_NO column

This SQL statement adds a new column PHONE_NO to the Employee table:

ALTER TABLE Employee

ADD PHONE_NO VARCHAR(15);

Step 2: Update the Employee table with phone numbers

UPDATE Employee

SET PHONE_NO = '9876543210'

WHERE Emp_Id = 1001;

UPDATE Employee

SET PHONE_NO = '9123456789'

WHERE Emp_Id = 1002;

UPDATE Employee

SET PHONE_NO = '9988776655'

WHERE Emp_Id = 1012;

Prepared by:Sachinkumar Bagewadi MCA DBMS LAB MANUAL Page 6


[Link] DARBAR COLLEGE OF COMM,SCI AND MANAGEMENT STUDIES,VIJAYAPUR

UPDATE Employee

SET PHONE_NO = '9871234560'

WHERE Emp_Id = 1015;

UPDATE Employee

SET PHONE_NO = '9567894321'

WHERE Emp_Id = 1016;

UPDATE Employee

SET PHONE_NO = '9321654789'

WHERE Emp_Id = 1020;

After updating the records, you can check the changes with:

SELECT * FROM Employee;

9. List employee names, who have joined before 15-Jun-08 and after 16-Jun-07
Query:

SELECT First_Name, Last_Name

FROM Employee

WHERE Hire_Date < '2008-06-15'

AND Hire_Date > '2007-06-16';

Explanation:

 Hire_Date < '2008-06-15': Employees who joined before June 15, 2008.
 Hire_Date > '2007-06-16': Employees who joined after June 16, 2007.

Prepared by:Sachinkumar Bagewadi MCA DBMS LAB MANUAL Page 7


[Link] DARBAR COLLEGE OF COMM,SCI AND MANAGEMENT STUDIES,VIJAYAPUR

10. Generate Salary slip with Name, Salary, Benefits, HRA-50%, DA-30%, PF-12%, Calculate gross.
Order the result in descending order of the gross.
Query:

SELECT

E.First_Name || ' ' || E.Last_Name AS Employee_Name,

[Link],

[Link],

(0.50 * [Link]) AS HRA,

(0.30 * [Link]) AS DA,

(0.12 * [Link]) AS PF,

([Link] + [Link] + (0.50 * [Link]) + (0.30 * [Link]) - (0.12 * [Link])) AS


Gross_Salary

FROM

Employee E

JOIN

Employee_Details D

ON

E.Emp_Id = D.Emp_Id

ORDER BY

Gross_Salary DESC;

Explanation:

 E.First_Name || ' ' || E.Last_Name: Concatenates the first and last names to create the full
name of the employee.
 HRA, DA, and PF: These are calculated using percentages of the salary.
 Gross Salary: This is calculated by adding Salary, Benefits, HRA, DA, and subtracting PF.
 ORDER BY Gross_Salary DESC: This orders the result in descending order of the gross salary.

Prepared by:Sachinkumar Bagewadi MCA DBMS LAB MANUAL Page 8


[Link] DARBAR COLLEGE OF COMM,SCI AND MANAGEMENT STUDIES,VIJAYAPUR

Case Study 2

Prepared by:Sachinkumar Bagewadi MCA DBMS LAB MANUAL Page 9


[Link] DARBAR COLLEGE OF COMM,SCI AND MANAGEMENT STUDIES,VIJAYAPUR

1)Account

CREATE TABLE Account (

Account_No VARCHAR(15) PRIMARY KEY,

Cust_Name VARCHAR(50) NOT NULL,

Branch_ID VARCHAR(10) NOT NULL

);

INSERT INTO Account VALUES

('AE0012856', 'Reena', 'SB002'),

('AE1185698', 'Akhil', 'SB001'),

('AE1203996', 'Daniel', 'SB004'),

('AE1225889', 'Roy', 'SB002'),

('AE8532166', 'Sowparnika', 'SB003'),

('AE8552266', 'Anil', 'SB003'),

('AE1003996', 'Saathwik', 'SB004'),

('AE1100996', 'Swarna', 'SB002');

2)Branch

CREATE TABLE Branch (

Branch_ID VARCHAR(10) PRIMARY KEY,

Branch_Name VARCHAR(50) NOT NULL,

Branch_City VARCHAR(50) NOT NULL


Prepared by:Sachinkumar Bagewadi MCA DBMS LAB MANUAL Page 10
[Link] DARBAR COLLEGE OF COMM,SCI AND MANAGEMENT STUDIES,VIJAYAPUR

);

INSERT INTO Branch VALUES

('SB001', 'Malleshwaram', 'Bangalore'),

('SB002', 'MG Road', 'Bangalore'),

('SB003', 'MG Road', 'Mysore'),

('SB004', 'Jainagar', 'Mysore');

3) Depositor

CREATE TABLE Account_Balance (

Account_No VARCHAR(15) PRIMARY KEY,

Branch_ID VARCHAR(10) NOT NULL,

Balance DECIMAL(15, 2) NOT NULL,

FOREIGN KEY (Branch_ID) REFERENCES Branch(Branch_ID),

FOREIGN KEY (Account_No) REFERENCES Account(Account_No)

);

INSERT INTO Account_Balance VALUES

('AE0012856', 'SB002', 12000),

('AE1203996', 'SB004', 58900),

('AE8532166', 'SB003', 40000),

('AE1225889', 'SB002', 150000);

Prepared by:Sachinkumar Bagewadi MCA DBMS LAB MANUAL Page 11


[Link] DARBAR COLLEGE OF COMM,SCI AND MANAGEMENT STUDIES,VIJAYAPUR

4)Loan

CREATE TABLE Loan (

Account_No VARCHAR(15) PRIMARY KEY,

Branch_ID VARCHAR(10) NOT NULL,

Balance DECIMAL(15, 2) NOT NULL,

FOREIGN KEY (Branch_ID) REFERENCES Branch(Branch_ID),

FOREIGN KEY (Account_No) REFERENCES Account(Account_No)

);

INSERT INTO Loan VALUES

('AE1185698', 'SB001', 102000),

('AE8552266', 'SB003', 40000),

('AE1003996', 'SB004', 15000),

('AE1100996', 'SB002', 100000);

Query:
1. Display the Total Number of accounts present in each branch.

SELECT Branch_ID, COUNT(*) AS Total_Accounts

FROM Account

GROUP BY Branch_ID;

Explanation:

 SELECT Branch_ID, COUNT(*) AS Total_Accounts: Selects the Branch_ID and calculates the
total number of accounts for each branch.
 FROM Account: Specifies the Account table as the source of data.

Prepared by:Sachinkumar Bagewadi MCA DBMS LAB MANUAL Page 12


[Link] DARBAR COLLEGE OF COMM,SCI AND MANAGEMENT STUDIES,VIJAYAPUR

 GROUP BY Branch_ID: Groups the accounts by Branch_ID, so the COUNT() function will count
the number of accounts for each branch.

2)
Display max , min loan amount present in each city.
Display the Total Loan amount in each branch
SELECT Branch_ID, SUM(Balance) AS Total_Loan_Amount
FROM Loan
GROUP BY Branch_ID;

Explanation:

 SELECT Branch_ID, SUM(Balance) AS Total_Loan_Amount: Selects the Branch_ID and


calculates the total loan amount for each branch using the SUM() function.
 FROM Loan: Specifies the Loan table as the source of data.
 GROUP BY Branch_ID: Groups the results by Branch_ID, so the SUM() function will calculate
the total loan amount for each branch.

3) Display the Total deposited amount in each branch by descending order.


SELECT Branch_ID, SUM(Balance) AS Total_Deposited_Amount
FROM Account_Balance
GROUP BY Branch_ID
ORDER BY Total_Deposited_Amount DESC;

Explanation:

 SELECT Branch_ID, SUM(Balance) AS Total_Deposited_Amount: Selects the Branch_ID


and calculates the total deposited amount for each branch using the SUM() function.
 FROM Account_Balance: Specifies the Account_Balance table as the source of data.
 GROUP BY Branch_ID: Groups the results by Branch_ID so that the SUM() function calculates
the total deposits for each branch.
 ORDER BY Total_Deposited_Amount DESC: Sorts the result in descending order of the total
deposited amount.

4) Display max , min loan amount present in each city.


SELECT b.Branch_City,
MAX([Link]) AS Max_Loan_Amount,
MIN([Link]) AS Min_Loan_Amount
FROM Loan l
JOIN Branch b ON l.Branch_ID = b.Branch_ID
GROUP BY b.Branch_City;

Prepared by:Sachinkumar Bagewadi MCA DBMS LAB MANUAL Page 13


[Link] DARBAR COLLEGE OF COMM,SCI AND MANAGEMENT STUDIES,VIJAYAPUR

Explanation:

 SELECT b.Branch_City: This selects the city from the Branch table.
 MAX([Link]) AS Max_Loan_Amount: This calculates the maximum loan amount from the
Loan table for each city.
 MIN([Link]) AS Min_Loan_Amount: This calculates the minimum loan amount from the
Loan table for each city.
 FROM Loan l: Specifies that the data is being selected from the Loan table, aliased as l.
 JOIN Branch b ON l.Branch_ID = b.Branch_ID: Joins the Loan table with the Branch table
on the Branch_ID column, allowing access to the city information.
 GROUP BY b.Branch_City: Groups the results by each city, so that the MAX() and MIN()
functions can operate within each group.

5) Display average amount deposited in each branch, each city.

1. Display Average Amount Deposited in Each Branch


SELECT Branch_ID, AVG(Balance) AS Average_Deposited_Amount
FROM Account_Balance
GROUP BY Branch_ID;

2. Display Average Amount Deposited in Each City


SELECT b.Branch_City, AVG([Link]) AS Average_Deposited_Amount
FROM Account_Balance ab
JOIN Branch b ON ab.Branch_ID = b.Branch_ID
GROUP BY b.Branch_City;

Explanation:

 Average Amount Deposited in Each Branch:


o SELECT Branch_ID, AVG(Balance) AS Average_Deposited_Amount: Selects the
Branch_ID and calculates the average balance for that branch.
o FROM Account_Balance: Specifies the source table.
o GROUP BY Branch_ID: Groups the results by Branch_ID so that the AVG() function
calculates the average for each branch.
 Average Amount Deposited in Each City:
o SELECT b.Branch_City, AVG([Link]) AS Average_Deposited_Amount: Selects
the city and calculates the average balance for that city.
o FROM Account_Balance ab: Specifies the source table with an alias.
o JOIN Branch b ON ab.Branch_ID = b.Branch_ID: Joins the Account_Balance table
with the Branch table to link deposits with their respective cities.
o GROUP BY b.Branch_City: Groups the results by city so that the average is calculated
for each one.

Prepared by:Sachinkumar Bagewadi MCA DBMS LAB MANUAL Page 14


[Link] DARBAR COLLEGE OF COMM,SCI AND MANAGEMENT STUDIES,VIJAYAPUR

6) Display maximum of loan amount in each branch where the balance is more than 25000.

SELECT l.Branch_ID, MAX([Link]) AS Max_Loan_Amount


FROM Loan l
WHERE [Link] > 25000
GROUP BY l.Branch_ID;

Explanation:

 SELECT l.Branch_ID, MAX([Link]) AS Max_Loan_Amount: Selects the Branch_ID and


calculates the maximum loan balance for that branch.
 FROM Loan l: Specifies that the data is being selected from the Loan table, with l as an alias for
easier reference.
 WHERE [Link] > 25000: Filters the results to include only those loans with a balance greater
than 25,000.
 GROUP BY l.Branch_ID: Groups the results by each branch, allowing the MAX() function to
calculate the maximum loan for each branch.

7)Display Total Number of accounts present in each city.

SELECT b.Branch_City, COUNT(a.Account_No) AS Total_Accounts

FROM Account a

JOIN Branch b ON a.Branch_ID = b.Branch_ID

GROUP BY b.Branch_City;

Explanation:

 SELECT b.Branch_City, COUNT(a.Account_No) AS Total_Accounts: Selects the city from


the Branch table and counts the total number of accounts (Account_No) associated with each
city.
 FROM Account a: Specifies that the data is coming from the Account table, with a as an alias.
 JOIN Branch b ON a.Branch_ID = b.Branch_ID: Joins the Account table with the Branch
table using Branch_ID, allowing access to city information.
 GROUP BY b.Branch_City: Groups the result by Branch_City so that the COUNT() function
calculates the number of accounts for each city.

8)Display all customer details in ascending order of branch_id.

SELECT Account_No, Cust_Name, Branch_ID


FROM Account
ORDER BY Branch_ID ASC;

Prepared by:Sachinkumar Bagewadi MCA DBMS LAB MANUAL Page 15


[Link] DARBAR COLLEGE OF COMM,SCI AND MANAGEMENT STUDIES,VIJAYAPUR

Explanation:

 SELECT Account_No, Cust_Name, Branch_ID: Selects the account number, customer name,
and branch ID from the Account table.
 FROM Account: Specifies that the data is being selected from the Account table.
 ORDER BY Branch_ID ASC: Orders the result in ascending order based on Branch_ID. The ASC
keyword sorts the branches in ascending order (it is also the default if you omit ASC).

9) Update Balance to 26000 where account_no=AE1003996.

UPDATE Account_Balance
SET Balance = 26000
WHERE Account_No = 'AE1003996';

Explanation:

 UPDATE Account_Balance: Specifies the table where the update will occur.
 SET Balance = 26000: Sets the Balance field to 26000 for the specified account.
 WHERE Account_No = 'AE1003996': Ensures that only the record with Account_No =
'AE1003996' is updated.

10)Display Customer Names with their branch Name

SELECT a.Cust_Name, b.Branch_Name


FROM Account a
JOIN Branch b ON a.Branch_ID = b.Branch_ID;

Explanation:

 SELECT a.Cust_Name, b.Branch_Name: Selects the customer names from the Account table
and branch names from the Branch table.
 FROM Account a: Specifies that the data is being selected from the Account table, using a as an
alias.
 JOIN Branch b ON a.Branch_ID = b.Branch_ID: Joins the Account table with the Branch
table on the Branch_ID to get the associated branch name for each customer.

Prepared by:Sachinkumar Bagewadi MCA DBMS LAB MANUAL Page 16


[Link] DARBAR COLLEGE OF COMM,SCI AND MANAGEMENT STUDIES,VIJAYAPUR

Write queries for the following

1. To show Book name, Author name and price of books of First Publ. publisher

2. Display Book id, Book name and publisher of books having quantity more than 8 and price less than
500

3. Select Book id, book name, author name of books which is published by other than ERP publishers
and price between 300 to 700

4. Generate a Bill with Book_id, Book_name, Publisher, Price, Quantity, 4% of VAT “Total”

5. Display book details with book id‟s C0001, F0001, T0002, F0002 (Hint: use IN operator)

6. Display Book list other than, type Novel and Fiction

7. Display book details with the author name starting with letter “A”

8. Display book details with the author name starting with letter “T” and ending with “S”

Prepared by:Sachinkumar Bagewadi MCA DBMS LAB MANUAL Page 17


[Link] DARBAR COLLEGE OF COMM,SCI AND MANAGEMENT STUDIES,VIJAYAPUR

9. Select Book_Id, Book_Name, Author Name, Quantity Issued where Books.Books_Id =


Issued.Book_Id

10. List the book_name, Author_name, Price. In ascending order of Book_name and then in descending
order of price.

Solution:

Table:Books:

CREATE TABLE Books (

Book_Id VARCHAR(10) PRIMARY KEY,

Book_Name VARCHAR(255) NOT NULL,

Author_Name VARCHAR(255) NOT NULL,

Publishers VARCHAR(255) NOT NULL,

Price DECIMAL(10, 2) NOT NULL,

Type VARCHAR(50) NOT NULL,

Quantity INT NOT NULL

);

Insertion:

INSERT INTO Books VALUES ('C0001', 'The Klone and I', 'Lata Kappor', 'EPP', 355.00, 'Novel', 5),

('F0001', 'The Tears', 'William Hopkins', 'First Publ', 650.00, 'Fiction', 20),

('T0001', 'My First C++', 'Brain & Brooke', 'ERP', 350.00, 'Text', 10),

('T0002', 'C++ Brainwork’s', 'A.W. Rossaine', 'TDH', 350.00, 'Text', 15),

('F0002', 'Thunderbolts', 'Ana Roberts', 'First Publ.', 750.00, 'Fiction', 5);

Table: Issued:

CREATE TABLE Issued (

Book_Id VARCHAR(10),

Quantity_Issued INT NOT NULL,

Prepared by:Sachinkumar Bagewadi MCA DBMS LAB MANUAL Page 18


[Link] DARBAR COLLEGE OF COMM,SCI AND MANAGEMENT STUDIES,VIJAYAPUR

PRIMARY KEY (Book_Id),

FOREIGN KEY (Book_Id) REFERENCES Books(Book_Id)

);

Insertion:

INSERT INTO Issued VALUES ('T0001', 4),

('C0001', 5),

('F0001', 2),

('T0002', 5),

('F0002', 8);

Query:

1. To show Book name, Author name and price of books of First Publ. publisher

SELECT Book_Name, Author_Name,

Price FROM Books

WHERE Publishers = 'First Publ';

2. Display Book id, Book name and publisher of books having quantity more than 8 and price less
than 500

SELECT Book_Id, Book_Name,

Publishers FROM Books

WHERE Quantity > 8 AND Price < 500;

3. Select Book id, book name, author name of books which is published by other than ERP
publishers and price between 300 to 700.

SELECT Book_Id, Book_Name,

Author_Name FROM Books

WHERE Publishers != 'ERP' AND Price BETWEEN 300 AND 700;

Prepared by:Sachinkumar Bagewadi MCA DBMS LAB MANUAL Page 19


[Link] DARBAR COLLEGE OF COMM,SCI AND MANAGEMENT STUDIES,VIJAYAPUR

4. Generate a Bill with Book_id, Book_name, Publisher, Price, Quantity, 4% of VAT “Total”.

SELECT Book_Id,

Book_Name,

Publishers,

Price,

Quantity,

Price * Quantity AS Total_Before_VAT,

(Price * Quantity * 0.04) AS VAT,

(Price * Quantity * 1.04) AS Total_After_VAT

FROM Books;

Explanation:

 Total_Before_VAT: The total price before VAT (Price multiplied by Quantity).


 VAT: The calculated VAT (4% of the total before VAT).
 Total_After_VAT: The total price after adding the VAT.

This will return a bill with all the requested information for each book in the database

5. Display book details with book id‟s C0001, F0001, T0002, F0002 (Hint: use IN operator)

SELECT * FROM Books

WHERE Book_Id IN ('C0001', 'F0001', 'T0002', 'F0002');

6. Display Book list other than, type Novel and Fiction.

SELECT * FROM Books

WHERE Type NOT IN ('Novel', 'Fiction');

Prepared by:Sachinkumar Bagewadi MCA DBMS LAB MANUAL Page 20


[Link] DARBAR COLLEGE OF COMM,SCI AND MANAGEMENT STUDIES,VIJAYAPUR

7. Display book details with the author name starting with letter “A”

SELECT * FROM Books

WHERE Author_Name LIKE 'A%';

8. Display book details with the author name starting with letter “T” and ending with “S”

SELECT * FROM Books


WHERE Author_Name LIKE 'T%s';

9. Select Book_Id, Book_Name, Author Name, Quantity Issued where Books.Books_Id =


Issued.Book_Id

SELECT Books.Book_Id,

Books.Book_Name,

Books.Author_Name,

Issued.Quantity_Issued FROM Books JOIN Issued ON Books.Book_Id = Issued.Book_Id;

10. List the book_name, Author_name, Price. In ascending order of Book_name and then in
descending order of price.

SELECT Book_Name,

Author_Name,

Price FROM Books ORDER BY Book_Name ASC,

Price DESC;

Prepared by:Sachinkumar Bagewadi MCA DBMS LAB MANUAL Page 21


[Link] DARBAR COLLEGE OF COMM,SCI AND MANAGEMENT STUDIES,VIJAYAPUR

Write queries for the following

1. Select all students from Physics and Computer Science

2. Select students common in Physics and Computer Science

3. Display all student details those are studying in the second year

4. Display students who are studying both Physics and computer science in the second year

5. Display the students studying only physics

6. Display the students studying only Computer Science

7. Select all students having PMCs combination

8. Select all students having a BCA combination

9. Select all students studying in the Third year

10. Rename table Computer Science to CS

Prepared by:Sachinkumar Bagewadi MCA DBMS LAB MANUAL Page 22


[Link] DARBAR COLLEGE OF COMM,SCI AND MANAGEMENT STUDIES,VIJAYAPUR

Solution:

Table: Physics

CREATE TABLE Physics (

Regno VARCHAR(10) PRIMARY KEY,

Name VARCHAR(50),

Year VARCHAR(10),

Combination VARCHAR(10)

);

Insertion:

INSERT INTO Physics VALUES

('AJ00325', 'Ashwin', 'First', 'PCM'),

('AJ00225', 'Swaroop', 'Second', 'PMCs'),

('AJ00385', 'Sarika', 'Third', 'PME'),

('AJ00388', 'Rupa', 'First', 'PMCs');

Table – Computer Science

CREATE TABLE Computer_Science (

Regno VARCHAR(10) PRIMARY KEY,

Name VARCHAR(50),

Year VARCHAR(10),

Combination VARCHAR(10)

);

Prepared by:Sachinkumar Bagewadi MCA DBMS LAB MANUAL Page 23


[Link] DARBAR COLLEGE OF COMM,SCI AND MANAGEMENT STUDIES,VIJAYAPUR

Insertion:

INSERT INTO Computer_Science VALUES

('AJ00225', 'Swaroop', 'Second', 'PMCs'),

('AJ00296', 'Tejas', 'Second', 'BCA'),

('AJ00112', 'Geeta', 'First', 'BCA'),

('AJ00388', 'Rupa', 'First', 'PMCs');

QUERY:
1. Select all students from Physics and Computer Science

SELECT * FROM Physics UNION SELECT * FROM ComputerScience;

2. Select students common in Physics and Computer Science

SELECT [Link], [Link], [Link], [Link]


FROM Physics p
INNER JOIN ComputerScience c ON [Link] = [Link];

3. Display all student details those are studying in the second year

SELECT * FROM Physics


WHERE Year = 'Second'
UNION
SELECT * FROM ComputerScience
WHERE Year = 'Second';

4. Display students who are studying both Physics and computer science in the second year
SELECT [Link], [Link], [Link], [Link]
FROM Physics p
INNER JOIN ComputerScience c ON [Link] = [Link]
WHERE [Link] = 'Second' AND [Link] = 'Second';

Prepared by:Sachinkumar Bagewadi MCA DBMS LAB MANUAL Page 24


[Link] DARBAR COLLEGE OF COMM,SCI AND MANAGEMENT STUDIES,VIJAYAPUR

5. Display the students studying only physics

SELECT [Link], [Link], [Link], [Link]


FROM Physics p
LEFT JOIN ComputerScience c ON [Link] = [Link]
WHERE [Link] IS NULL;

6. Display the students studying only Computer Science


SELECT [Link], [Link], [Link], [Link]
FROM ComputerScience c
LEFT JOIN Physics p ON [Link] = [Link]
WHERE [Link] IS NULL;

7. Select all students having PMCs combination


SELECT * FROM Physics
WHERE Combination = 'PMCs'
UNION
SELECT * FROM ComputerScience
WHERE Combination = 'PMCs';

8. Select all students having a BCA combination


SELECT * FROM Physics
WHERE Combination = 'BCA'
UNION
SELECT * FROM ComputerScience
WHERE Combination = 'BCA';

9. Select all students studying in the Third year


SELECT * FROM Physics
WHERE Year = 'Third'
UNION
SELECT * FROM ComputerScience
WHERE Year = 'Third';

10. Rename table Computer Science to CS


ALTER TABLE ComputerScience
RENAME TO CS;

Prepared by:Sachinkumar Bagewadi MCA DBMS LAB MANUAL Page 25


[Link] DARBAR COLLEGE OF COMM,SCI AND MANAGEMENT STUDIES,VIJAYAPUR

Prepared by:Sachinkumar Bagewadi MCA DBMS LAB MANUAL Page 26


Part A
1. Word Processor assignment to demonstrate usage of Page Setup, Page
Background and Paragraph option of Page Layout tab by writing the
description about Computer and its characteristics.

Step 1: Open a Word Processor (e.g., Microsoft


Word)Step 2: Page Setup

1. Go to the “Page Layout” tab at the top of your Word Processor.


2. Click on “Margins” in the Page Setup group, then select a preset
marginsize (e.g., Normal or Narrow).
3. Click on “Orientation” and choose Portrait (default) or
Landscape,depending on your preference.
4. Click on “Size” and select A4 or any other preferred paper size.

Step 3: Page Background

1. In the “Page Layout” tab, go to the Page Background group.


2. Click on Page Color and select a light color for the background(optional).
3. Click on Watermark to add a simple watermark (e.g.,
“Draft” or “Confidential”), or create a custom one.
4. Click on Page Borders to add borders around the page. Choose the
borderstyle, width, and color you like.

Step 4: Paragraph Formatting

1. Go to the “Paragraph” group in the Page Layout tab.


2. Click on the small arrow in the bottom-right corner of the group
to openthe Paragraph dialog box.
3. Set Alignment to Justify for a clean, professional look (optional: use
Leftor Center if preferred).
4. Set the Indentation (left and right) to 0.5 inches if needed.
5. Set Line Spacing to 1.5 or double for better readability.
Step 5: Write Description About Computer and its CharacteristicsTitle:
Computer and Its Characteristics

Format the title using bold and a larger font size (e.g., 16pt)

A computer is an electronic device that processes data and performs various


tasks based on the instructions provided. Computers have become essential in
our daily lives due to their versatility and efficiency.

Characteristics of a Computer:

1. Speed: Computers can perform millions of calculations per


second,making them incredibly fast at processing tasks.

2. Accuracy: Computers produce accurate results as they follow


instructionsexactly as they are programmed.

3. Storage Capacity: Computers can store vast amounts of data in


differenttypes of memory, such as hard drives, SSDs, or cloud
storage.

4. Automation: Once programmed, computers can


perform tasks automatically without human
intervention.

5. Versatility: Computers can be used for various purposes, such as


gaming,education, communication, and business.

6. Connectivity: Modern computers are capable of connecting to


theinternet, enabling communication, research, and online
activities.

Step 6: Adjust Page Layout for Better Presentation

1. Go back to the “Page Layout” tab and adjust any settings like
margins or orientation if needed.
2. Use the “Indent” options in the Paragraph group to indent the characteristics.
3. Adjust the line spacing again if needed, using the “Paragraph” dialog box.
2. Word Processor assignment to demonstrate Bullets and Numbering,
Headers and footers.

Step 1: Open a Word Processor (e.g., Microsoft


Word)Step 2: Set Up Bullets and Numbering

1. Go to the “Home” tab on the top of the Word Processor.


2. To create Bulleted lists:
Write the heading "Benefits of Using Computers" (or any
heading you prefer).
Below the heading, type a list of points. For example:Fast
processing of data.
Easy access to
information. Automation
of repetitive tasks.
Highlight the list of points.
In the “Paragraph” group, click the Bullets button (a small round
dot icon). This will add bullets to each point in your list.
3. To create Numbered lists:
After writing the bulleted list, leave a space and type "Examples
ofComputer Applications" (as another heading).
Below this heading, type another list of points. For example:
1. Word Processing
2. Spreadsheets
3. Graphic Design
Highlight this list and, in the Paragraph group, click the Numbering
button (a 1, 2, 3 icon). This will convert the text into a numbered list.
Step 3: Insert Headers
1. Go to the “Insert” tab on the top of the Word Processor.
2. Click on “Header” in the Header & Footer group.
3. Select a header style from the options available (for example, a
simple or blank header).
4. In the header section at the top of the page, type a title for your document,such as

“Computer Assignment”.

5. You can also add your name or the date in the header by clicking
indifferent areas of the header.
6. After entering the text, click on “Close Header and Footer” in
the to pright corner, or simply double-click in the main body of
the document.

Step 4: Insert Footers

1. Go back to the “Insert” tab.


2. Click on “Footer” in the Header & Footer group.
3. Choose a footer style (for example, "Blank" or "Bold Numbers").
4. In the footer section at the bottom of the page, type text like “PageNumber”
or “Confidential” if you want.
5. To add automatic page numbers:
Click on “Page Number” in the Header & Footer group.
Select where you want the page number to appear (e.g., Bottom of
thepage, Centered).
6. Once done, click on “Close Header and Footer” or double-click
outsidethe footer area.
Step 5: Write a Brief Description to Demonstrate the WorkTitle:

Benefits of Using Computers

Write this as a heading using bold and a larger font (e.g., 16pt).

Computers provide numerous benefits in everyday life and in various fields


like business, education, and personal use. Some of the key benefits include:

Benefits of Using Computers:


Fast processing of data
Easy access to information
Automation of repetitive tasks
Enhanced communication through emails and social media

Examples of Computer Applications:

1. Word Processing
2. Spreadsheets
3. Graphic Design
4. Video Editing

Step 6: Finalize the Document

1. Review the bullets and numbering for consistency.


2. Check the header and footer to ensure they appear correctly on everypage.
3. Save your document.
3. Creatinga timetable using a word processor is a great way to demonstrate
the use of tables and encryption. Below, I’ll outline the steps to create a
timetable and explain how you can encrypt it.

Steps to Create a Timetable in a Word Processor

1. Open a Word Processor:


o Use Microsoft Word.
2. Insert a Table:
o In Microsoft Word:
 Go to the Insert tab.
 Click on Table, then select the number of rows and columns you
need (e.g., 5 days x 8 periods).
3. Design the Timetable:
o Label the first row with the days of the week (e.g., Monday, Tuesday, etc.).
o Label the first column with the periods (e.g., Period 1, Period 2, etc.).
o Fill in the cells with the subjects or activities scheduled for each period.
4. Format the Table:
o Adjust the cell sizes, font, and colors to make it visually appealing.
o You can also add borders or shading for clarity.
5. Add a Title:
o Above the table, insert a title (e.g., "Weekly Timetable") and format it
accordingly.

Example Timetable Layout

Period Monday Tuesday Wednesd Thursda


ay y
Period 1 DBMS C DBMS C
Period 2 C C# C C#
Period 3 C Lab WEB C Lab WEB
Period 4 Java BI Java BI
Period 5 C++ DAA C++ DAA
Period 6 Java lab DS Java lab DS

Encrypting the Timetable

To secure your timetable, you can encrypt it. The method varies based on the word
processor you are using.

1. In Microsoft Word:
o Go to the File menu and select Info.
o Click on Protect Document and then choose Encrypt with Password.
o Enter a password and click OK
5. Create a power-point presentation with minimum 5 slides and demonstrate
the following. a) Layout option b) Insertion of date, time and slide numbers c)
Insertion of Symbols

Step 1: Open PowerPoint

1. Launch Microsoft PowerPoint.


2. Select "Blank Presentation" or a suitable template.

Step 2: Create Your Slides

 Layout Option:
 Go to layout option
 Use a "Two Content" layout for slide.
 Add tille on your slid

 Insert Date and Slide Number:


o Go to the "Insert" tab.
o Click on "Header & Footer."
o Check "Date and time," select "Update automatically," and check "Slide number."
o Click "Apply to All" to insert them on all slides.

 Insertion of Symbols
o Go to symbol option
o Click on symbol select any one and apply it
OUTPUT:
[Link] a power point presentation with 5 slides and demonstrate a)themes
b)transition and c)animation

Step 1: Open PowerPoint

1. Launch Microsoft PowerPoint.


2. Select "Blank Presentation" or choose a template that fits your topic.

Step 2: Create Your Slides

Slide 1: Title Slide

 Add Title and Subtitle:


o Click on the title box and type your main title (e.g., "Exploring
the Power of Themes").
o Click on the subtitle box and type a subtitle (e.g., "Understanding
Transitions and Animations").
 Apply Theme:
o Go to the "Design" tab and select a theme that suits your topic.
 Add Animation:
o Click on the title, go to the "Animations" tab, and choose "Fade In."

 Transition:
o Go to the "Transitions" tab and select "Morph" or "Fade."

Output:
[Link] Processor assignment to design a pamphlet for the advertisement
of your college features by making use of Picture ,ClipArt , Shapes and
WordArt options.
Step 1: Open a New Document

1. Launch Microsoft Word.


2. Select “Blank Document.”

Step 2: Set Up the Page

1. Margins: Go to the “Layout” tab, click on “Margins,” and choose “Narrow” for more
space.
2. Orientation: Under the “Layout” tab, click on “Orientation” and select
“Landscape” for a wider pamphlet.

Step 3: Design the Pamphlet Layout

1. Columns:
o Go to the “Layout” tab, click on “Columns,” and select “Three” to create
a tri-fold pamphlet layout.
2. Guidelines: You can insert a shape (like a rectangle) to mark where the folds
will be, then delete it later.

Step 4: Add Content

1. Headings and Text:


o Use WordArt for the title (e.g., “Welcome to [Your College Name]”):
 Go to the “Insert” tab, select “WordArt,” and choose a style.
Type your text and format it as needed.
o Add other headings for sections like “Academics,” “Campus Life,”
“Facilities,” etc., using standard text formatting.
2. Body Text:
o Use regular text for descriptions. Keep it concise and informative.

Step 5: Insert Pictures and ClipArt

1. Images:
o To insert pictures of your college, go to the “Insert” tab and click on
“Pictures.” Choose images from your device.
o Resize and position images appropriately within each column.
2. ClipArt:
o To add ClipArt, go to “Insert” > “Online Pictures” or “Icons”
depending on your version of Word.
o Search for relevant images (like graduation caps or books) and insert them.

Step 6: Add Shapes

1. Shapes for Emphasis:


o Use shapes to highlight key features (e.g., a star or circle around important
points).
o Go to “Insert” > “Shapes,” select a shape, and draw it on your
pamphlet. Format the fill and outline as desired.

Output:

3
Series 1
Series 2
Category 1
Category 2
Category 3
Category 4
Series 3
0
Series 1
[Link] DARBAR COLLEGE OF COMM,SCI AND MANAGEMENT STUDIES,VIJAYAPUR

8. Create
a power-point presentation with minimum 5 slides and
demonstrate the following. a) Rehearse Timings b) Narrations c) Slide
Sorter

Step 1: Rehearse Timings

1. Rehearse Your Presentation:


o Go to the "Slide Show" tab.
o Click on "Rehearse Timings."
o Practice your presentation while timing yourself. Click to
move to the next slide when ready.
o Save the timings when finished.

Step 2: Add Narrations

1. Record Your Narration:


o Go to the "Slide Show" tab.
o Click on "Record Narration."
o Follow the prompts to record your voice for each slide. You
can review and re-record if necessary.

Step 3: Use Slide Sorter

1. Access Slide Sorter:


o Go to the "View" tab and select "Slide Sorter."
o Here, you can see all slides at once. Drag to rearrange them as needed.
o Save your changes after organizing the slides.

OFFICE AUTOMATION -LAB MANUAL Page 12


[Link] DARBAR COLLEGE OF COMM,SCI AND MANAGEMENT STUDIES,VIJAYAPUR

PART B
[Link] sheet assignment to create a pay slip to generate salary of employee with the
following details.

EMPN_NO BASIC DA HRA GROSS PF NET_SALARY


11 2000 2000 500 =B2+C2+D2 =B2*12% =E2-F2
22 6000 300 500

Example Calculations:

For Employee 11:

 Gross Salary: = 2000 (Basic) +2000 (DA) + 5000 (HRA) = 4500


 Provident Fund (PF): = 20,000 (Basic) * 12% = 240
 Net Salary: = 27,000 (Gross Salary) - 2,400 (PF) = 4260

OFFICE AUTOMATION -LAB MANUAL Page 13


[Link] DARBAR COLLEGE OF COMM,SCI AND MANAGEMENT STUDIES,VIJAYAPUR

[Link] sheet Assignment to create SSLC results of 10 students and demonstrate charts.
Use the following details SNO, NAME, KAN, HIND, ENG, MAT, SCI, SOC,
TOTAL, AVG, MIN, MAX, RESULT, and GRADE.

S\ NA K HI EN M S S TOT A M M RES GRA


N ME A ND G AT CI O AL V IN A ULT DE
O N C G X
01 pra 80 75 80 85 90 80
mod

3. Formulas to Calculate Data:

In Excel or Google Sheets, you can use formulas to calculate TOTAL, AVG, MIN,
MAX, RESULT, and GRADE.

 TOTAL: Sum of marks in all subjects:


o Formula for Total: =SUM(C2:H2) (Assuming row 2 has the first student's
marks)
 AVG: Average marks of the student:
o Formula for Average: =AVERAGE(C2:H2)
 MIN: Minimum marks across all subjects:
o Formula for Minimum: =MIN(C2:H2)
 MAX: Maximum marks across all subjects:
o Formula for Maximum: =MAX(C2:H2)
 RESULT: If the student has failed in any subject, the result will be "FAIL".
Otherwise, it will be "PASS". You can use an IF function:
o Formula for Result: =IF(MIN(C2:H2) < 35, "FAIL", "PASS") (assuming 35
is the minimum passing mark per subject)

GRADE: Based on the average marks, you can assign grades:

 Formula for Grade:

OFFICE AUTOMATION -LAB MANUAL Page 14


[Link] DARBAR COLLEGE OF COMM,SCI AND MANAGEMENT STUDIES,VIJAYAPUR

excel
Copy code
=IF(I2 >= 90, "A+",
IF(I2 >= 80, "A",
IF(I2 >= 70, "B+",
IF(I2 >= 60, "B", "C"))))

OFFICE AUTOMATION -LAB MANUAL Page 15


[Link] DARBAR COLLEGE OF COMM,SCI AND MANAGEMENT STUDIES,VIJAYAPUR

3. Spread sheet assignment to generate bill and to demonstrate various statistical


functions with the following details GRAIN ITEM, UNITS (KG), PRICE, AMOUNT,
GRADE.

GRAIN PRICE (per


UNITS (KG) AMOUNT GRADE
ITEM KG)
Wheat 50 20 formula A

3. Formula for Amount (D Column):

To calculate the total amount for each grain item, use the formula:

Amount (D2) = Units (B2) × Price (C2)

 In cell D2, enter the formula:


=B2*C2

Formula for GRADE

=IF(D2>=1000,"A", IF(D2>=500,"B","C"))

[Link] the following in Spread sheet as directed


a. Create a note pad file as per the following fields:
[Link]. name Sub1 Sub2 Sub3 Sub4 Sub5 total % grade
b. Import this notepad file into Spread sheet using „data from text option.
c. Calculate total marks obtained and percentage.
d. Grade is calculated as,
i. If %>=90, then grade A
ii. If %>=80 and <90, then grade B
iii. If %>=70 and <80, then grade C
iv. If %>=60 and <70, then grade D
v. If %<60, then grade F

OFFICE AUTOMATION -LAB MANUAL Page 16


[Link] DARBAR COLLEGE OF COMM,SCI AND MANAGEMENT STUDIES,VIJAYAPUR

Step 1: Create the Notepad File

1. Open Notepad (or any basic text editor).


2. Enter the following data structure, including headers for [Link]., Name, marks for
subjects (Sub1, Sub2, Sub3, Sub4, Sub5), Total, %, and Grade:

[Link]. Name Sub1 Sub2 Sub3 Sub4 Sub5 Total % Grade


1 Alice 85 90 78 88 92 0 0 0
2 Bob 70 75 65 80 78 0 0 0
3 Charlie 60 65 70 72 68 0 0 0
4 Dave 50 55 60 58 65 0 0 0
5 Eve 95 90 92 85 91 0 0 0

Step 2: Import the Notepad File into the Spreadsheet

1. Open Excel (or Google Sheets).


2. Import the data:

Step 3: Calculate the Total Marks and Percentage

=SUM(C2:G2)

Step 4:Calculate the Percentage:

=H2/500*100

Step 4: Calculate the Grade Based on Percentage

=IF(I2>=90, "A", IF(I2>=80, "B", IF(I2>=70, "C", IF(I2>=60, "D", "F"))))

[Link] various levels of Sorting and Filtering methods of Data by using

OFFICE AUTOMATION -LAB MANUAL Page 17


[Link] DARBAR COLLEGE OF COMM,SCI AND MANAGEMENT STUDIES,VIJAYAPUR

the following details. Slno Item Name Rate Quantity Amount Discount (10%)
Final Amount

Step 1: Create the Data Structure

First, let’s create the table with the following columns:

[Link]. Item Name Rate Quantity Amount Discount (10%) Final Amount
1 Apples 2 10 20 2 18
2 Bananas 1.5 15 22.5 2.25 20.25
3 Grapes 3 5 15 1.5 13.5
4 Oranges 2.5 8 20 2 18
5 Mangoes 5 4 20 2 18
Formula Amount:
=C2*D2

Discount (10%):
=D2*0.1

Final Amount:
=D2-E2

Step 3: Sorting Data:

Go to the Data tab.


Click on Sort.
Choose to sort by the Item Name column (Column B), and select either A to Z
(ascending) or Z to A (descending).

Sort by Rate (Numerically):

Go to the Data tab.


Click on Sort.
Choose to sort by Rate (Column C), and select either Smallest to Largest or Largest
to Smallest.

[Link] conditional formatting in spread sheet as directed by referring the below

OFFICE AUTOMATION -LAB MANUAL Page 18


[Link] DARBAR COLLEGE OF COMM,SCI AND MANAGEMENT STUDIES,VIJAYAPUR

example.
a)Create an attendance spread sheet for minimum 10 students.
b)Mark P for present and A for absent for respective dates.
c)Apply formula to calculate “No. of classes attended” and “Attendance Percentage” of
every student.
Apply conditional formatting to highlight a student if “Attendance Percentage” is less
than 75%.

No. of
Classes Attendan
USN Name Date 1 Date 2 - Date N Attende ce
d Percentag
e
123 XYZ P A P P 3 75%
456 ABC P A A P 2 50%

Step 1: Create the Attendance Spreadsheet

1. Open Excel or Google Sheets and create a new spreadsheet.


2. Set up the columns as follows:

US Nam Date Date Date Date Date Date [Link]


N e 1 2 3 4 5 6 s Attended Percentag
e
123 XYZ P A P P A P 0
456 ABC P A A P A P 0
789 DEF A P P A P P 0
101 GHI P P P A A P 0
112 JKL A P A P P A 0
131 MN P P A P P P 0
O
415 PQR P P P P P P 0
161 STU A A P P A A 0
718 VW P P A A P P 0
X
920 YZA A A P P A A 0

Calculate "No. of Classes Attended" Formula

OFFICE AUTOMATION -LAB MANUAL Page 19


[Link] DARBAR COLLEGE OF COMM,SCI AND MANAGEMENT STUDIES,VIJAYAPUR

=COUNTIF(C2:H2, "P")

Calculate "Attendance Percentage" Formula:

=I2/6

OFFICE AUTOMATION -LAB MANUAL Page 20


SMT. KUMUDBEN DARBAR COLLEGE OF COMMERCE,SCIENCE &
MANAGEMENT STUDIES,VIJAYAPUR
1. Write a C program to read radius of a circle and to find and display area
and circumference
2. Write a c program to read Principal amount, Time and Rate and calculate
Simple Interest.
3. Program to read three numbers and display the largest of the three
4. Write a program to find HCF (GCD) of two numbers.
5. Write a program to demonstrate basic mathematical library functions
defined in math.h
6. Write a program that accepts a number n and prints all prime numbers
between 1 to n.
7. Write a program to read and concatenate two strings without using library
function
8. Write a program to swap (interchange) two numbers without using a
temporary variable.
9. Write a program to read a string and find the length of a string without
using built in function.
[Link] a program to generate and display first n values in the Fibonacci
sequence using recursive function.
[Link] a program to check and display if a number is prime by defining
isprime( ) function.
[Link] a recursive function calculates factorial of a given integer, n.
[Link] a program to read percentage of marks and to display appropriate
message specifying class obtained. (demonstration of Switch Case
statement)
14. Write a program to print sum of even numbers and sum of odd numbers
from array of integers which are to be inputted.
[Link] a C program to create array of structure which stores Roll No, Name
and Average marks of students. Accept n students data and print it in proper
format.

C Programming Lab -SEPBCAP1.6-BCA I Semester Praveen Badami Page 1


SMT. KUMUDBEN DARBAR COLLEGE OF COMMERCE,SCIENCE &
MANAGEMENT STUDIES,VIJAYAPUR
1. Write a C program to read radius of a circle and to find and display area
and circumference

C Programming Lab -SEPBCAP1.6-BCA I Semester Praveen Badami Page 2


SMT. KUMUDBEN DARBAR COLLEGE OF COMMERCE,SCIENCE &
MANAGEMENT STUDIES,VIJAYAPUR
2. Write a c program to read Principal amount, Time and Rate and calculate
Simple Interest.

C Programming Lab -SEPBCAP1.6-BCA I Semester Praveen Badami Page 3


SMT. KUMUDBEN DARBAR COLLEGE OF COMMERCE,SCIENCE &
MANAGEMENT STUDIES,VIJAYAPUR
3. Program to read three numbers and display the largest of the three

C Programming Lab -SEPBCAP1.6-BCA I Semester Praveen Badami Page 4


SMT. KUMUDBEN DARBAR COLLEGE OF COMMERCE,SCIENCE &
MANAGEMENT STUDIES,VIJAYAPUR
4. Write a program to find HCF (GCD) of two numbers.

C Programming Lab -SEPBCAP1.6-BCA I Semester Praveen Badami Page 5


SMT. KUMUDBEN DARBAR COLLEGE OF COMMERCE,SCIENCE &
MANAGEMENT STUDIES,VIJAYAPUR
5. Write a program to demonstrate basic mathematical library functions
defined in math.h

C Programming Lab -SEPBCAP1.6-BCA I Semester Praveen Badami Page 6


SMT. KUMUDBEN DARBAR COLLEGE OF COMMERCE,SCIENCE &
MANAGEMENT STUDIES,VIJAYAPUR
6. Write a program that accepts a number n and prints all prime numbers
between 1 to n.

C Programming Lab -SEPBCAP1.6-BCA I Semester Praveen Badami Page 7


SMT. KUMUDBEN DARBAR COLLEGE OF COMMERCE,SCIENCE &
MANAGEMENT STUDIES,VIJAYAPUR
7. Write a program to read and concatenate two strings without using library
function

C Programming Lab -SEPBCAP1.6-BCA I Semester Praveen Badami Page 8


SMT. KUMUDBEN DARBAR COLLEGE OF COMMERCE,SCIENCE &
MANAGEMENT STUDIES,VIJAYAPUR
8. Write a program to swap (interchange) two numbers without using a
temporary variable.

C Programming Lab -SEPBCAP1.6-BCA I Semester Praveen Badami Page 9


SMT. KUMUDBEN DARBAR COLLEGE OF COMMERCE,SCIENCE &
MANAGEMENT STUDIES,VIJAYAPUR
9. Write a program to read a string and find the length of a string without using
built in function.

C Programming Lab -SEPBCAP1.6-BCA I Semester Praveen Badami Page 10


SMT. KUMUDBEN DARBAR COLLEGE OF COMMERCE,SCIENCE &
MANAGEMENT STUDIES,VIJAYAPUR
10. Write a program to generate and display first n values in the Fibonacci
sequence using recursive function.

C Programming Lab -SEPBCAP1.6-BCA I Semester Praveen Badami Page 11


SMT. KUMUDBEN DARBAR COLLEGE OF COMMERCE,SCIENCE &
MANAGEMENT STUDIES,VIJAYAPUR
11. Write a program to check and display if a number is prime by defining
isprime( ) function.

C Programming Lab -SEPBCAP1.6-BCA I Semester Praveen Badami Page 12


SMT. KUMUDBEN DARBAR COLLEGE OF COMMERCE,SCIENCE &
MANAGEMENT STUDIES,VIJAYAPUR

12. Write a recursive function calculates factorial of a given integer, n.

C Programming Lab -SEPBCAP1.6-BCA I Semester Praveen Badami Page 13


SMT. KUMUDBEN DARBAR COLLEGE OF COMMERCE,SCIENCE &
MANAGEMENT STUDIES,VIJAYAPUR

13. Write a program to read percentage of marks and to display appropriate


message specifying class obtained. (demonstration of Switch Case statement)

C Programming Lab -SEPBCAP1.6-BCA I Semester Praveen Badami Page 14


SMT. KUMUDBEN DARBAR COLLEGE OF COMMERCE,SCIENCE &
MANAGEMENT STUDIES,VIJAYAPUR

C Programming Lab -SEPBCAP1.6-BCA I Semester Praveen Badami Page 15


SMT. KUMUDBEN DARBAR COLLEGE OF COMMERCE,SCIENCE &
MANAGEMENT STUDIES,VIJAYAPUR
14. Write a program to print sum of even numbers and sum of odd numbers from
array of integers which are to be inputted.

C Programming Lab -SEPBCAP1.6-BCA I Semester Praveen Badami Page 16


SMT. KUMUDBEN DARBAR COLLEGE OF COMMERCE,SCIENCE &
MANAGEMENT STUDIES,VIJAYAPUR

[Link] a C program to create array of structure which stores Roll No, Name and
Average marks of students. Accept n students data and print it in proper format.

C Programming Lab -SEPBCAP1.6-BCA I Semester Praveen Badami Page 17


SMT. KUMUDBEN DARBAR COLLEGE OF COMMERCE,SCIENCE &
MANAGEMENT STUDIES,VIJAYAPUR

END

C Programming Lab -SEPBCAP1.6-BCA I Semester Praveen Badami Page 18

You might also like