16
2022 10
3
17
2022 11
3
18
2023 3
6
Zoom
Picture 6.1
Question 7:
Write a query to display GenreID, GenreName, NumberOfMaleMembers,NumberOfFemale Members, corresponding to each book genre, where
NumberOfMaleMembers and NumberOfFemaleMembers are respectively the number of distinct male members and female members who have borrowed in the year 2020 (based on
8 of 8
Paper No: 2
LoanDate) books belonging to each book genre. Note that all book genres must be displayed in the results as in the following figure.
GenrelD GenreName
NumberOfMaleMembers
NumberOfFemaleMembers
1
1
Science Fiction 6
2
2
2
Fantasy
4
1
3 3
Mystery
3
2
4
4
Thriller
0
0
5
5
Romance
9
7
6
6
Historical Fiction 1
4
7
7
Biography
2
1
8
8
Horror
2
1
9 9
Adventure
4
3
10 10
Poetry
4
2
Picture 7.1
Question 8:
Create a stored procedure named insertMember with @memberID int, @memberNamenvarchar(100), @address nvarchar(200), @email nvarchar(100),@sex nvarchar(20),@birthDate date as input parameters of the procedure. The stored procedure attempts to insert a new member into the table Members, but only if a member with the same MemberID does not already exists:
+ 75%
Close