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

I\'m having trouble writing with my writing a query for SQL In the following que

ID: 3921213 • Letter: I

Question

I'm having trouble writing with my writing a query for SQL

In the following questions, by "local", I mean in the zip codes that begin with 93933, 93901, 93905, 93955, or 93906.

2. For each of the local zip codes, and each of the candidates, show the number of contributions (if at least one contribution was made). Order by zip code and then number of contributions.

the schema looks like

CREATE TABLE candidate
(
cand_id   varchar(12) primary key,
name   varchar(12)
);

(
contbr_id   integer primary key,
name       varchar(20),
city     varchar(40),
street   varchar(40),
zip       varchar(20),
employer   varchar(60),
occupation   varchar(40)
);

CREATE TABLE contribution
(
contb_id   integer primary key,
cand_id   varchar(12),
contbr_id   varchar(12),
amount   numeric(6,2),
date       varchar(20),
election_type varchar(20),
tran_id   varchar(20)
);

Explanation / Answer

SELECT conut(contbr_id)
FROM candidate
Where cand_id ( Select cand_id
       From contribution
       group by cand_id
       Having conut(contbr_id)> 0
order by conut(contbr_id)
   )
Order By zip

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote