Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Here the sql script SQL SQRIPT DROP TABLE Student; DROP TABLE WasteDisposal; DROP TABLE Waste; DROP TABLE ProductRedemption; DROP TABLE Feedback; DROP TABLE FeedbackParticipation; DROP

image text in transcribed

image text in transcribed

Here the sql script SQL SQRIPT DROP TABLE Student; DROP TABLE WasteDisposal; DROP TABLE Waste; DROP TABLE ProductRedemption; DROP TABLE Feedback; DROP TABLE FeedbackParticipation; DROP TABLE GardenCatalog; DROP TABLE Category; CREATE TABLE Student ( MatricNo int not null, FName varchar(75), LName varchar(75) Gender char(1), LevelOfStudy int, PhoneNo varchar(15) Email varchar(50) EarnedPoints int, PRIMARY KEY (MatricNo) ); CREATE TABLE Waste ( Type varchar(25) not null, RewardEarned int, PRIMARY KEY (Type) ); CREATE TABLE WasteDisposal ( RecordNo int not nul
FOREIGN KEY (MatricNo) references Student(MatricNo) ); CREATE TABLE ProductRedemption ( RedemptionNo varchar(6) not null, MatricNo int, RedDate date, RedTime time, ProductName varchar(25), UsedPoints int, PRIMARY KEY(RedemptionNo), FOREIGN KEY(MatricNo) references Student(MatricNo) ); CREATE TABLE GardenCatalog ( ProductName varchar(25), Availability char(3), Quantity int, RequiredPoints int, PRIMARY KEY(ProductNo) ); CREATE TABLE Feedback ( FeedbackNo varchar(6) not null, MatricNo int, PRIMARY KEY(FeedbackNo), FOREIGN KEY(MatricNo) references Student(Matric No) ); CREATE TABLE F
CREATE TABLE FeedbackParticipation ( MatricNo int not null, CategoryNo varchar(2) not null, GivenScore int, PRIMARY KEY (MatricNo, CategoryNo) ); CREATE TABLE Category ( CategoryNo varchar(2) not null, Name varchar(50) PRIMARY KEY (CategoryNo) );
1. Write any five (5) SQL queries of your own but you must include the use of joins and functions. Example of SQL queries are given below: a. Show all the year 1 students, waste disposal details, and reward points details. Show ONLY the student ID, student name, deposit ID, date, time, type, quantity, before and after reward points. b. Show all the product redemption details that have used up for more than 500 reward points between May 2022 and April 2022. Show ONLY the redemption ID, date, time, product redeemed, quantity, before and after reward points. c. Find the top TEN (10) students with the MOST number of recycled waste that were disposed (referring to the quantities of recycled items and not the number of deposits made) between May 2022 and April 2022. d. Based on the feedback evaluation forms, list all evaluation ID and its total score (by adding up the individual score in each of the evaluation categories) and sort these records in descending order. ER/EER DIAGRAM

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions