100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
CSC 345 Lab 5-1 Exam | Questions with Verified Answers $12.99   Add to cart

Exam (elaborations)

CSC 345 Lab 5-1 Exam | Questions with Verified Answers

 2 views  0 purchase
  • Course
  • CSC 345
  • Institution
  • CSC 345

CSC 345 Lab 5-1 Exam | Questions with Verified Answers Task 1: For each invoice, list the invoice number and invoice date along with the ID, first name, and last name of the customer for which the invoice was created. SELECT INVOICE_NUM, INVOICE_DATE, CUSTOMER.CUST_ID, FIRST_NAME, LAST_NAME FROM...

[Show more]

Preview 2 out of 5  pages

  • October 10, 2024
  • 5
  • 2024/2025
  • Exam (elaborations)
  • Questions & answers
  • CSC 345
  • CSC 345
avatar-seller
Jumuja
CSC 345 Lab 5-1



Task 1: For each invoice, list the invoice number and invoice date along with the ID,
first name, and last name of the customer for which the invoice was created.
SELECT INVOICE_NUM, INVOICE_DATE, CUSTOMER.CUST_ID, FIRST_NAME,
LAST_NAME
FROM INVOICES, CUSTOMER
WHERE INVOICES.CUST_ID = CUSTOMER.CUST_ID;

Task 2: For each invoice placed on November 15, 2021, list the invoice number along
with the ID, first name, and last name of the customer for which the invoice was created.
SELECT INVOICE_NUM, CUSTOMER.CUST_ID, FIRST_NAME, LAST_NAME
FROM INVOICES, CUSTOMER
WHERE (INVOICES.CUST_ID = CUSTOMER.CUST_ID) AND (INVOICE_DATE =
"2021-11-15");
Task 3: For each invoice, list the invoice number, invoice date, item ID, quantity
ordered, and quoted price for each invoice line that makes up the invoice.
SELECT INVOICES.INVOICE_NUM, INVOICE_DATE, ITEM_ID, QUANTITY,
QUOTED_PRICE
FROM INVOICES, INVOICE_LINE
WHERE (INVOICES.INVOICE_NUM = INVOICE_LINE.INVOICE_NUM);

Task 4: Use the IN operator to find the ID, first name, and last name of each customer
for which as invoice was created on November 15, 2021.
SELECT CUST_ID, FIRST_NAME, LAST_NAME
FROM CUSTOMER
WHERE CUST_ID IN (SELECT CUST_ID
FROM INVOICES
WHERE INVOICE_DATE = "2021-11-15");

Task 5: Repeat Task 4, but this time use the EXISTS operator in your answer.
SELECT CUST_ID, FIRST_NAME, LAST_NAME
FROM CUSTOMER
WHERE EXISTS (SELECT *
FROM INVOICES
WHERE (INVOICES.CUST_ID = CUSTOMER.CUST_ID)
AND (INVOICE_DATE = "2021-11-15"));

Task 6: Find the ID, first name, and last name of each customer for which an invoice
was not created on November 15, 2021.
SELECT CUST_ID, FIRST_NAME, LAST_NAME
FROM CUSTOMER

, WHERE CUST_ID IN (SELECT CUST_ID
FROM INVOICES
WHERE INVOICE_DATE <> "2021-11-15");

Task 7: For each invoice, list the invoice number, invoice date, item ID, description, and
category for each item that makes up the invoice.
SELECT INVOICES.INVOICE_NUM, INVOICE_DATE, ITEM.ITEM_ID, DESCRIPTION,
CATEGORY
FROM INVOICES, INVOICE_LINE, ITEM
WHERE (INVOICES.INVOICE_NUM = INVOICE_LINE.INVOICE_NUM)
AND (INVOICE_LINE.ITEM_ID = ITEM.ITEM_ID);

Task 8: Repeat Task 7, but this time order the rows by category and then by invoice
number.
SELECT INVOICES.INVOICE_NUM, INVOICE_DATE, ITEM.ITEM_ID, DESCRIPTION,
CATEGORY
FROM INVOICES, INVOICE_LINE, ITEM
WHERE (INVOICES.INVOICE_NUM = INVOICE_LINE.INVOICE_NUM)
AND (INVOICE_LINE.ITEM_ID = ITEM.ITEM_ID)
ORDER BY CATEGORY, INVOICE_NUM;

Task 9: Use a subquery to find the sales rep ID, first name, and last name of each sales
rep who represents at least one customer with a credit limit of $500. List each sales rep
only once in the results.
SELECT REP_ID, FIRST_NAME, LAST_NAME
FROM SALES_REP
WHERE EXISTS (SELECT * FROM CUSTOMER
WHERE CREDIT_LIMIT = 500
AND CUSTOMER.REP_ID = SALES_REP.REP_ID)

Task 10: Repeat Task 9, but this time do not use a subquery.
SELECT SALES_REP.REP_ID, SALES_REP.FIRST_NAME,
SALES_REP.LAST_NAME
FROM SALES_REP, CUSTOMER
WHERE CUSTOMER.REP_ID = SALES_REP.REP_ID AND CREDIT_LIMIT = 500;

Task 11: Find the ID, first name, and last name of each customer that currently has an
invoice on file for Wild Bird Food (25 lb).
SELECT CUST_ID, FIRST_NAME, LAST_NAME
FROM CUSTOMER
WHERE CUST_ID IN (SELECT CUST_ID
FROM INVOICES
WHERE INVOICE_NUM IN (SELECT INVOICE_NUM
FROM INVOICE_LINE
WHERE ITEM_ID = "KH81"));

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.

Quick and easy check-out

Quick and easy check-out

You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.

Focus on what matters

Focus on what matters

Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!

Frequently asked questions

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

Satisfaction guarantee: how does it work?

Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.

Who am I buying these notes from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller Jumuja. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy these notes for $12.99. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

80630 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy study notes for 14 years now

Start selling
$12.99
  • (0)
  Add to cart