Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

SID SUR NAM GEN GRID?NUMF F NUM F NAME Write SQL queries for a given tables 1. S

ID: 3700951 • Letter: S

Question

SID SUR NAM GEN GRID?NUMF F NUM F NAME Write SQL queries for a given tables 1. Select the names of faculties and the amount of students in every faculty (including faculties without registered students) 2. Select the names of faculties and students' surnames in one column. 3. Select faculty with the biggest amount of male students 4. Select t groups with amount of students that greater than in group with ID 123 5. Select the list of students from group "RDB11 6. Count students who names starts with "A"

Explanation / Answer

1.

Select F_Name,count(S_ID) from Faculties inner join Students on Faculties.F_Num = Students.Num_F group by F_Name;

2.

Select concat(F_Name,SUR) from Faculties inner join Students on Faculties.F_Num = Students.Num_F group by F_Name;

3.

Select F_Name from Faculties inner join Students on Faculties.F_Num = Students.Num_F group by F_Name having count(S_ID) = (Select max(count(S_ID) from Students group by Num_F where GEN = 'Male');

4.

Select GR_ID,count(S_ID) from Students group by GR_ID having count(S_ID) > (Select count(S_ID) from Students where GR_ID = 123);

5.

Select * from Students where GR_ID = 'RDB11';

6.

Select count(S_ID) from Students where NAM LIKE 'A%';

Do ask if any doubt. Please upvote.