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

These are SQL questions. Here is the table reference to them: CREATE TABLE custo

ID: 1715021 • Letter: T

Question

These are SQL questions. Here is the table reference to them:

CREATE TABLE customer
(cust_id       CHAR(4) PRIMARY KEY,
cust_name       VARCHAR2(30),
cust_street       VARCHAR2(20),
cust_city       VARCHAR2(20),
cust_state       CHAR(2),
cust_zip       CHAR(5),
cust_balance       DECIMAL(8,2),
cust_limit       DECIMAL(8,2),
rep_id           CHAR(3) CONSTRAINT rep_id_fk REFERENCES rep(rep_id) );

1. Display the sales representative’s id and the sum of the balances of all customers represented by each of these sales representatives. Group and order the display by the sales representative ids.

2. Display the sales representative’s id and the sum of the balances of all customers represented by each of these sales representatives, but limit the result to those sales representatives whose sum is more than $12,000.

Explanation / Answer

1. ANSWER: SELECT REP_ID, SUM(CUST_BALANCE) FROM CUSTOMER GROUP BY REP_ID ORDER BY REP_ID;

2. ANSWER: SELECT REP_ID, SUM(CUST_BALANCE) FROM CUSTOMER WHERE SUM(CUST_BALANCE) > 12000

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