Computer Science

Saman has been entrusted with the management of Law University Database. He needs to access some information from FACULTY and COURSES tables for a survey analysis. Help him extract the following information by writing the desired SQL queries as mentioned below.

Table: FACULTY

F_IDFNameLNameHire_DateSalary
102AmitMishra12-10-199812000
103NitinVyas24-12-19948000
104RakshitSoni18-5-200114000
105RashmiMalhotra11-9-200411000
106SulekhaSrivastava5-6-200610000

Table: COURSES

C_IDF_IDCNameFees
C21102Grid Computing40000
C22106System Design16000
C23104Computer Security8000
C24106Human Biology15000
C25102Computer Network20000
C26105Visual Basic6000

(I) To display complete details (from both the tables) of those Faculties whose salary is less than 12000.

(II) To display the details of courses whose fees is in the range of 20000 to 50000 (both values included).

(III) To increase the fees of all courses by 500 which have "Computer" in their Course names.

(IV)

(A) To display names (FName and LName) of faculty taking System Design.

OR

(B) To display the Cartesian Product of these two tables.

SQL Joins & Grouping

2 Likes

Answer

(I)

SELECT * FROM FACULTY, COURSES 
WHERE Salary < 12000 AND FACULTY.F_ID = COURSES.F_ID;

(II)

SELECT * 
FROM COURSES 
WHERE Fees BETWEEN 20000 AND 50000;

(III)

UPDATE COURSES
SET Fees = Fees + 500
WHERE CName LIKE '%Computer%';

(IV)

(A)

SELECT FName, LName 
FROM FACULTY, COURSES 
WHERE CName = 'System Design' AND
FACULTY.F_ID = COURSES.F_ID;

OR

(B)

SELECT * 
FROM FACULTY, COURSES;

Answered By

3 Likes


Related Questions