008tesdatabase Doct
008tesdatabase Doct
SCHOOL OF COMPUTING
Database GROUPE ASSIGNMENENT
SECTION-1
NAME ID
ARDON UGR/
CREATE TABLE department (
dept_name VARCHAR(20),
building VARCHAR(15),
budget MONEY,
);
course_id VARCHAR(7),
title VARCHAR(50),
credits NUMERIC(2,0),
);
ID VARCHAR(5),
dept_name VARCHAR(20),
);
course_id VARCHAR(8),
sec_id VARCHAR(8),
building VARCHAR(15),
room_number VARCHAR(7),
time_slot_id VARCHAR(4),
);
ID VARCHAR (5),
year NUMERIC(4,0),
);
1.
SELECT name
FROM instructor;
2.
FROM instructor;
3.
FROM instructor;
4.
Find the names of all instructors in the Computer Science department who have salary greater than
$70,000.
SELECT name
FROM instructor
5.
Retrieve the names of all instructors, along with their department names and department building
names.
6.
For all instructors in the university who have taught some course, find their names and the course ID of
all courses they taught.
7.
Find the names of all instructors who earn more than the lowest paid instructor in the Information
Systems department.
SELECT name
FROM instructor
SELECT MIN(salary)
FROM instructor
);
8.
SELECT name
FROM instructor
FROM instructor
9.
SELECT *
FROM instructor
10.
Find the names of instructors with salary amounts between $10,000 and $20,000.
SELECT name
FROM instructor
11.
Find all instructors who appear in the instructor relation with null values for salary. SQL
SELECT *
FROM instructor
12.
SELECT AVG(salary)
FROM instructor;
13.
SELECT AVG(salary)
FROM instructor
14.
Find the total number of instructors who teach a course in the Spring 2016 semester.
FROM instructor
GROUP BY dept_name;
16.
Retrieve only those departments where the average salary of the instructors is more than $45,000.
SELECT dept_name
FROM instructor
GROUP BY dept_name
17.
Suppose that annual salary increases are being made, and salaries of all instructors are to be increased
by 5 percent.
UPDATE instructor
18.
How about if a salary increase is to be paid only to instructors with salary of less than $20,000.
UPDATE instructor
19.
Let us now suppose that all instructors with salary over $100,000 receive a 3 percent raise, whereas all
others receive a 5 percent raise.
UPDATE instructor
18.
How about if a salary increase is to be paid only to instructors with salary of less than $20,000.
UPDATE instructor
19.
Let us now suppose that all instructors with salary over $100,000 receive a 3 percent raise, whereas all
others receive
a 5 percent raise.
UPDATE instructor
SET salary =
CASE
END;