(i)Define the following query by using Query-By-Example (QBE) Find all the teams
ID: 3714177 • Letter: #
Question
(i)Define the following query by using Query-By-Example (QBE) Find all the teams, show their TEAMID, TEAMNAME, total home score in their home game. The result should be sorted by the TEAMID in descending order. Since there is a number of teams did not play any home game yet, it is reasonable that there are missing records in the resultant table. To ease for you to complete this question, the 1st column was filled for you. [796] ?QBE TEAMID TEAMNAME ? HOMESCOREOfSum 7 Sonics b Suns 5 Knights 4 Panthers 3 Eagles 2 Motors 1 Riders 2 Field: Table: Total: Sort: Show: TEAMID TEAM WHERE Criteria: RECORD HOME Or:Explanation / Answer
SQL Query
create table Test(teamid integer, teamname varchar(100),score integer);
insert into Test(teamid, teamname,score) values(7,"sonics",1);
insert into Test(teamid, teamname,score) values(6,"suns",3);
insert into Test(teamid, teamname,score) values(5,"knights",4);
insert into Test(teamid, teamname,score) values(4,"Panthers",1);
insert into Test(teamid, teamname,score) values(3,"Eagles",2);
insert into Test(teamid, teamname,score) values(2,"Motors",5);
insert into Test(teamid, teamname,score) values(1,"Riders",2);
select teamid,teamname,score from Test order by teamid desc;
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.