0% found this document useful (0 votes)
6 views1 page

Teacher SQL Solutions

The document provides a series of SQL queries related to a Teacher table. It includes commands to display teachers by department, filter by gender, order by date of joining, count salaries, insert new records, and calculate minimum and total salaries. Each query is designed to extract specific information from the Teacher database.

Uploaded by

breakevenwrld
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)
6 views1 page

Teacher SQL Solutions

The document provides a series of SQL queries related to a Teacher table. It includes commands to display teachers by department, filter by gender, order by date of joining, count salaries, insert new records, and calculate minimum and total salaries. Each query is designed to extract specific information from the Teacher database.

Uploaded by

breakevenwrld
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

SQL Queries – Teacher Table

a) Display all teachers from Computer department


SELECT * FROM Teacher WHERE Department = 'Computer';

b) Female teachers in History department


SELECT Name FROM Teacher WHERE Department='History' AND Sex='F';

c) Teachers ordered by Date of Joining


SELECT Name, Dateofjoining FROM Teacher ORDER BY Dateofjoining ASC;

d) Name, department and salary of female teachers


SELECT Name, Department, Salary FROM Teacher WHERE Sex='F';

e) Count teachers earning less than 10000


SELECT COUNT(*) FROM Teacher WHERE Salary < 10000;

f) Insert new record


INSERT INTO Teacher VALUES (8,'Mersa','Computer','2000-01-01',12000,'M');

g) Minimum distinct salary


SELECT MIN(DISTINCT Salary) FROM Teacher;

h) Total salary of History department


SELECT SUM(Salary) FROM Teacher WHERE Department='History';

You might also like