0% found this document useful (0 votes)
2 views2 pages

Raju

This document provides a series of SQL queries related to a 'Teacher' database for a class assignment in Information Technology. It includes commands for selecting, inserting, updating, and deleting records, as well as altering the table structure. The queries cover various scenarios such as filtering by department, gender, and salary, as well as sorting and displaying data in different orders.

Uploaded by

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

Raju

This document provides a series of SQL queries related to a 'Teacher' database for a class assignment in Information Technology. It includes commands for selecting, inserting, updating, and deleting records, as well as altering the table structure. The queries cover various scenarios such as filtering by department, gender, and salary, as well as sorting and displaying data in different orders.

Uploaded by

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

ST.

TERESA SCHOOL
SUBJECT: INFORMATION TECHNOLOGY (402)
Class : X
Revision Database Development Assignment –III (ANSWER KEY)

Student Name:___________________ Section:__________

Table : Teacher

1) To show all information about the teacher of history department.


Select * from Teacher where Dept=’History”;

2) To list the names of female teachers who are in Maths department


Select Name from Teacher where Dept=”Maths” AND Gender=’F’ ;

3) To list names of all teachers with their date of joining in descending order.
Select Name, DOJ from Teacher Order By DOJ desc ;

4) To display teachers name, age department and salary for male teacher only
Select Name, Age, Dept, Sal from Teacher where Gender=’M’;

5) To insert a new row in the teacher table with the following data:
9,”raja”,26,”computer”,13/05/95,2300,”m”.
Insert into Teacher values(9,”raja”,26,”computer”,”13/05/95”,2300,”m”);

6) To show all information about the teachers in this table


Select * from Teacher ;

7) Display name and age in ascending order using age


Select Name, Age from Teacher order by Age ;

8) Display all record whose gender is female


Select * from Teacher where Gender=’F’;

9) Display all name from department of History and Maths .


Select Name from Teacher where Dept=’History’ OR Dept=’Maths’ ;
10) Display age between 35 to 50
Select Age from Teacher where Age between 35 and 50 ;

11) Update age by 2 where age is greater than 40.


UPDATE Teacher SET Age=Age+2 where Age>40 ;

12) Add a new Column Promotion of char(1) type


Alter table Teacher ADD Promotion char(1) ;

13) Display name and age in descending order.


Select Name, Age from Teacher Order By Age DESC ;

14) Display Teacher Names who are either in Computer or Maths.


Select Name from Teacher where Dept=”Computer” OR Dept=”Maths” ;

15) Delete all those records whose Sal is more than 5000 and are a Male Teacher.
Delete from Teacher where Sal>5000 AND Gender=’M’ ;

16) Delete entire records of the table.


Delete from Teacher;
17) Delete the table Teacher.
DROP Table Teacher ;
18) Statement to see structure of table Student.
DESC Teacher ;
19) Write Statement to create above table Teacher.
CREATE TABLE Teacher (SN integer, Name Char(20), Age Integer, Dept Char(20), DOJ
date, Sal Integer, Gender Char(1));
20) Modify a Column Name from char(15) to char(20);
Alter table Teacher MODIFY Name char(20) ;

21) Remove a column Promotion from above table


Alter table Teacher MODIFY Name char(20) ;
22) Display Name and age of teachers who are female
Select Name, age from Teacher where Gender=”F” ;

23) Display all the records in ascending order of DOJ


Select * from Teacher order by DOJ asc ;

24) Display the entire computer department teacher name in ascending order of Sal.
Select Name from Teacher where Dept=”Computer” order by Sal asc ;

25) Display all records that are getting salary more than 10000 and also in Maths Department.
Select * from Teacher where Sal>10000 AND Dept=”Maths” ;

You might also like