XII Class-IT(802)
PRACTICAL FILE
2025-26
SUBMITTED BY:
Write your name
Class - Section
Submitted To:
SWAPAN KAPURIA Dr. VANDANA TANDON
(PGT. Comp. Sc.) (PRINCIPAL)
ACKNOWLEDGEMENT
I wish to express my deep sense of gratitude and indebtedness to our learned
teacher Swapan Kapuria, PGT COMPUTER SCIENCE, Kamal Model Sr. Sec. School for
his invaluable help, advice and guidance in the preparation of this file.
I am also greatly indebted to our Principal Dr. Vandana Tandon and school authorities
for providing me with the facilities and requisite laboratory conditions for making
this practical file.
I also extend my thanks to Gourav Sir, Lab Engineer, my classmates and friends who
helped me to complete this practical file successfully.
[Name of Student]
CERTIFICATE
This is to certify that [Name of Student], student of Class XII,
Kamal Model Sr. Sec. School has completed the PRACTICAL FILE
during the academic year 2022-23 towards partial fulfilment of
credit for the IT (802) practical evaluation of CBSE and submitted
satisfactory report, as compiled in the following pages, under my
supervision.
Swapan Kapuria
PGT Computer Sc.
Kamal Model Sr. Sec. School
JAVA
Q10. Create a class BookTesr under a package helloworldjava declare an object book1 of class Book and also initialize its data
members title, author, publisher, genre and price. Also write a function display() to print all the data members of class Book.
Q.11 Write code to create a class Datainput under a package hellowworldjava to input your name, age and print your name
and age after 5 years.
v
I.
II.
GRADE CALCULATOR
SQL
Q1. Create a database say School in mysql?
Q2. How to go to a particular database say school?
3. Create a table Dept having fields Deptno as int type, Dname as varchar type and Loc Varchar
type. Consider Deptno as primary key.
4. Insert record in Dept table
5. Create a table Employ having following details:
Q6. Display structure of the table Employee
Q7. Insert 5 records in Employee table
8. Display all the records in employee table
9. Display Eno, Ename from employee table only for Gents Employee
10. Display those ename whose salary between 40000 to 60000 both inclusive.
11. Display those record whose name starts with A
12. Display those Ename whose name 3rd char is r.
13. Display all the records in ascending order of Ename
14. Display those records in Descending order of Fees
15. Add a column City in table Employee
16. Delete column City.
17. Display Gender wise Number of employees
18. Display all the records whose salary is Null
19. Make Deptno as Foreign key
20. Display all the records of dept table
21. Display Eno, Ename, Salary, Deptno, Dname
22. Display Eno, Ename, Salary, Deptno, dname for those employee who gets salary more than
50000.
23. Display those employees who joined after 01.01.2011
24. Delete those records who earn 0(zero)
25. Increase salary of all employees by 30%
Solution of the above Queries
Q1. Create a database say School in mysql?
Ans:
mysql> create database school;
Query OK, 1 row affected (0.03 sec)
Q2. How to go to a particular database say school?
Ans:
mysql> use school;
Database changed
mysql>
3. Create a table Dept having fields Deptno as int type, Dname as varchar type and Loc
Varchar type. Consider Deptno as primary key.
Ans:
mysql> create table dept(
-> deptno int primary key,
-> dname varchar(15),
-> Loc varchar(10)
-> );
Query OK, 0 rows affected (0.09 sec)
4. Insert record in Dept table
ANS:
mysql> insert into dept values(10, 'Sales', 'Delhi');
Query OK, 1 row affected (0.02 sec)
mysql> insert into dept values(20, 'HR', 'Pune');
Query OK, 1 row affected (0.00 sec)
mysql> insert into dept values(30, 'PURCHASE', 'AGRA');
Query OK, 1 row affected (0.00 sec)
5. Create a table Employee having following details:
Table name: Employee
Field Name Data type Length Constraint
Eno Integer Primary key
Ename Varchar 15 Not Null
Gender Char 1
Doj Date
Salary Decimal 10,2
Deptno int Foreign key
Ans:
mysql> Create table employee(
-> eno int primary key,
-> Gender char(1),
-> Doj date,
-> Salary decimal(10,2),
-> deptno int,
-> ename varchar(20),
-> Foreign key (deptno) references dept(deptno)
-> );
Query OK, 0 rows affected (0.08 sec)
Q6. Display structure of the table Employee
mysql> desc employee;
Q7. Insert 5 records in Employee table
Ans:
mysql> insert into employee values(2, 'F', '2001-02-23', 60000, 30);
Query OK, 1 row affected (0.01 sec)
mysql> insert into employee values(3, 'M', '2003-02-23', 70000, 20);
Query OK, 1 row affected (0.00 sec)
8. Display all the records in employee table
mysql> select * from employee;
+-----+--------+------------+----------+--------+
| eno | Gender | Doj | Salary | deptno |
+-----+--------+------------+----------+--------+
| 1|M | 2002-03-01 | 50000.00 | 10 |
| 2|F | 2001-02-23 | 60000.00 | 30 |
| 3|M | 2003-02-23 | 70000.00 | 20 |
+-----+--------+------------+----------+--------+
3 rows in set (0.00 sec)
9. Display Eno, Ename from employee table only for Gents Employee
mysql> select eno, ename from employee where gender='M';
+-----+--------+
| eno | ename |
+-----+--------+
| 1 | Badal |
| 3 | Aditya |
+-----+--------+
2 rows in set (0.00 sec)
10. Display those ename whose salary between 40000 to 60000 both inclusive.
mysql> select ename from employee where salary between 40000 and 60000;
+----------+
| ename |
+----------+
| Badal |
| Hanshika |
+----------+
2 rows in set (0.00 sec)
11. Display those record whose name starts with A
mysql> select * from employee where ename like 'A%';
+-----+--------+------------+----------+--------+--------+
| eno | Gender | Doj | Salary | deptno | ename |
+-----+--------+------------+----------+--------+--------+
| 3|M | 2003-02-23 | 70000.00 | 20 | Aditya |
+-----+--------+------------+----------+--------+--------+
1 row in set (0.00 sec)
12. Display those Ename whose name 3rd char is r.
mysql> select * from employee where ename like '__r%';
+-----+--------+------------+--------+--------+-------+
| eno | Gender | Doj | Salary | deptno | ename |
+-----+--------+------------+--------+--------+-------+
| 6|M | 2000-01-01 | 0.00 | 20 | Varun |
+-----+--------+------------+--------+--------+-------+
1 row in set (0.00 sec)
13. Display all the records in ascending order of Ename
mysql> select * from employee order by ename asc;
+-----+--------+------------+----------+--------+----------+
| eno | Gender | Doj | Salary | deptno | ename |
+-----+--------+------------+----------+--------+----------+
| 3|M | 2003-02-23 | 70000.00 | 20 | Aditya |
| 1|M | 2002-03-01 | 50000.00 | 10 | Badal |
| 2|F | 2001-02-23 | 60000.00 | 30 | Hanshika |
| 6|M | 2000-01-01 | 0.00 | 20 | Varun |
+-----+--------+------------+----------+--------+----------+
4 rows in set (0.00 sec)
14. Display those records in Descending order of Salary
mysql> select * from employee order by salary desc;
+-----+--------+------------+----------+--------+----------+
| eno | Gender | Doj | Salary | deptno | ename |
+-----+--------+------------+----------+--------+----------+
| 3|M | 2003-02-23 | 70000.00 | 20 | Aditya |
| 2|F | 2001-02-23 | 60000.00 | 30 | Hanshika |
| 1|M | 2002-03-01 | 50000.00 | 10 | Badal |
| 6|M | 2000-01-01 | 0.00 | 20 | Varun |
+-----+--------+------------+----------+--------+----------+
4 rows in set (0.00 sec)
15. Add a column City in table Employee
mysql> alter table employee add city varchar(20);
Query OK, 0 rows affected (0.11 sec)
Records: 0 Duplicates: 0 Warnings: 0
mysql> desc employee;
+--------+---------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+--------+---------------+------+-----+---------+-------+
| eno | int | NO | PRI | NULL | |
| Gender | char(1) | YES | | NULL | |
| Doj | date | YES | | NULL | |
| Salary | decimal(10,2) | YES | | NULL | |
| deptno | int | YES | MUL | NULL | |
| ename | varchar(20) | YES | | NULL | |
| city | varchar(20) | YES | | NULL | |
+--------+---------------+------+-----+---------+-------+
7 rows in set (0.02 sec)
16. Delete column City.
mysql> alter table employee drop city;
Query OK, 0 rows affected (0.14 sec)
Records: 0 Duplicates: 0 Warnings: 0
mysql> desc employee;
17. Display Gender wise Number of employees
mysql> select count(*), gender from employee group by Gender;
+----------+--------+
| count(*) | gender |
+----------+--------+
| 3|M |
| 1|F |
+----------+--------+
2 rows in set (0.00 sec)
18. Display all the records whose salary is Null
mysql> select * from employee where salary is Null;
+-----+--------+------------+--------+--------+--------+
| eno | Gender | Doj | Salary | deptno | ename |
+-----+--------+------------+--------+--------+--------+
| 4|M | 2001-02-09 | NULL | 10 | Varsha |
+-----+--------+------------+--------+--------+--------+
1 row in set (0.00 sec)
19. Make Deptno as Foreign key
mysql> alter table employee add foreign key (deptno) references dept(deptno);
Query OK, 5 rows affected (0.19 sec)
Records: 5 Duplicates: 0 Warnings: 0
20. Display all the records of dept table
mysql> select * from dept;
+--------+----------+-------+
| deptno | dname | Loc |
+--------+----------+-------+
| 10 | Sales | Delhi |
| 20 | HR | Pune |
| 30 | PURCHASE | AGRA |
+--------+----------+-------+
3 rows in set (0.00 sec)
21. Display Eno, Ename, Salary, Deptno, Dname
mysql> select eno, ename, salary , dept.deptno, dname from employee, dept where
employee.deptno=dept.deptno;
22. Display Eno, Ename, Salary, Deptno, dname for those employee who gets salary more than
50000.
23. Display those employees who joined after 01.01.2011
24. Delete those records who earn 0(zero)
mysql> delete from employee where salary=0;
Query OK, 1 row affected (0.01 sec)
mysql> select * from employee;
25. Increase salary of all employee by 30%
Ans: Update employee set salary =salary + 0.30*salary;