0% found this document useful (0 votes)
4 views

SQL Query Fro University Database

The document outlines a series of SQL queries related to instructor and department data management, including operations like dropping tables, modifying columns, and retrieving specific information about instructors and courses. It covers various conditions for filtering data, such as salary thresholds and department names, as well as aggregate functions like average and distinct counts. Additionally, it addresses the need for both modification and retrieval of data across different semesters and departments.
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)
4 views

SQL Query Fro University Database

The document outlines a series of SQL queries related to instructor and department data management, including operations like dropping tables, modifying columns, and retrieving specific information about instructors and courses. It covers various conditions for filtering data, such as salary thresholds and department names, as well as aggregate functions like average and distinct counts. Additionally, it addresses the need for both modification and retrieval of data across different semesters and departments.
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
You are on page 1/ 2

Sql query

1. Drop table, delete table data.

2. Add column to table, drop column from table.

3. Find the department names of all Instructor. i) distinct department ,ii)also with duplicate

4. Give 10% salary raise of each Instructor

5. Find the names of all Instructor in the computer.sci department who have salary greater than 70000.

6.Retrive the names of all Instructor, along with their department names and building name

7. Find the names of Instructor who have thought some course.

8. Find the names of Instructor who have thought some course in the computer science department

9. Query for all Instructor in the university who have thought some course, find their names and the
course id of all courses they thought.

10. List the names of all Instructor along with the titles of courses that they teach.

11.Find the names of all instructors whose salary is greater than at least one instructor in the biology
department

12.find the names of all departments whose building name includes the substring ‘watson’

13.matches all string beginning with “ab%cd” and “ab\cd”

14.finde the names and salary name asceding and salary descending

15.find the names with salary between 90000 and 10000;(using arithmetic and between)

16.Find the instructor names and the courses they thought for all instructors in the biology department
who have thought some course.

17.finde the set of all courses thought either in fall 2009 or in spring 2010 ,or both(keeping duplicate
and removing deuplicate)

18. finde the set of all courses thought in the fall 2009 as well as spring 2010 .(without keeping duplicate
and keeping duplicate)

19. finde the set of all courses thought in the fall 2009 semester but not in the spring 2010 .(without
keeping duplicate and keeping duplicate)

20.find the average salary in the comp.sci department

21.Find the number of instructor in each department who teaches a course in the spring 2010
semester.(87)

22.Find only those department where the average salary is more than 42000
23.For each course section offered in 2009, find the average total credits(tot_cred) of all students
enrolled in the section, if the section had at least 2 students

24.Find all the courses thought in the both the fall 2009 and spring 2010 semester.

25. Find all the courses thought in the both the fall 2009 semester but not in spring 2010 semester.

26.selects the names of instructor whose names are neighter “mozarat” nor “einstein”

27.find the total number of distinct students who have taken course sections thought by the instructor
with ID 110011

28.find the names of all instructors whose salary is greater than at least one instructor in the biology
department(using >some)

29.find the names of all instructor that have a salary value greater than that of each instructor in the
biology department(>all using)

30. finde the departments that have highest average salary.

31.find the all courses taught in both the fall 2009 and spring 2010 semester.(93)

32.find all courses that were offered at most once in 2009

33.find the all courses that were offered at least twice in 2009

34.find the average instructor salaries of those departments where the average salary is greater than
42000.

35.find the maximum across all departments of the total salary at each department(96).

36.find all departments where the total salary is greater than the average of the total salary at all
departments.(using with and other way)

37.modification ,delete,insertion,update

38. SELECT name,salary,tb FROM instructor,( SELECT avg(salary) as tb from instructor WHERE
dept_name='physics' ) ty WHERE dept_name='physics'

You might also like