Consider the following tables FACULTY and COURSES. Write SQL commands for the statements (i) to (v) and give outputs for SQL queries (vi) to (viii) i) To display details of those Faculties whose salary is greater than 12000ii) To display the details of courses whose fees is in the range of 15000 to 50000 (both values included). iii) To increase the fees of all courses by 500. iv) To display details of those courses which are taught by ‘Sulekha’. v) To display name of the Faculty whose salary is maximum. vi) Select COUNT(DISTINCT F_ID) from COURSES; vii) Select MIN(Salary) from FACULTY,COURSES where COURSES.C_ID = FACULTY.F_ID; viii) Select SUM(Fees) from courses Group By F_ID having count(*) > 1; ix) Select Fname, Lname from FACULTY Where Lname like “M%”;
Attachments:
Answers
Answered by
15
i) select * from faculty
where salary > 12000 ;
ii) select cname from courses
where fees between 15001 and 50001 ;
iii) update courses
set fees = fees + 500 ;
iv) select c_id, f_id , cname , fees
from faculty F , courses C
where F.f_id = C.f_id
and fname = " sulekha " ;
v) select fname from faculty
where salary = 16000 ;
vi)
102
106
104
105
107
vii) 8000
viii) 91000
ix) see the output in the attachment
note: you can also write the code of (v) by using max function.
output of vi), vii), viii) are correct and its output can also written as given in attachments.
codes of i), ii) , iii) iv), v) can also be written in another way.
where salary > 12000 ;
ii) select cname from courses
where fees between 15001 and 50001 ;
iii) update courses
set fees = fees + 500 ;
iv) select c_id, f_id , cname , fees
from faculty F , courses C
where F.f_id = C.f_id
and fname = " sulekha " ;
v) select fname from faculty
where salary = 16000 ;
vi)
102
106
104
105
107
vii) 8000
viii) 91000
ix) see the output in the attachment
note: you can also write the code of (v) by using max function.
output of vi), vii), viii) are correct and its output can also written as given in attachments.
codes of i), ii) , iii) iv), v) can also be written in another way.
Attachments:
Similar questions
Physics,
6 months ago
Hindi,
6 months ago
Science,
6 months ago
Social Sciences,
11 months ago
Computer Science,
11 months ago
Biology,
1 year ago
Biology,
1 year ago