Question: DTCC, Recently Asked Online Assessments in 2026 | SQL UNION Query | Recursive Function Tracing
0
Entering edit mode

Question 1: List Customer and Product Without Sale (SQL)

Problem Statement: Using the UNION operator, in one list return all customers who do not have an invoice and all products that were not sold.

For each customer without an invoice, return:

  • the string customer
  • the customer id
  • the customer_name

For each product without an invoice, return:

  • the string product
  • the product id
  • the product_name

The columns must be in the order shown, but row order does not matter.

Table Definitions (Schema Snippet):

  • Table: customer
    • id (int, PK)
    • customer_name (varchar)
    • city_id (int)
    • customer_address (varchar)
    • contact_person (varchar)
    • email (varchar)
    • phone (varchar)
  • Table: product
    • id (int, PK)
    • sku (varchar)

(Note: The query will also require joining against aninvoiceand aninvoice_itemtable to filter out those with existing sales)

ADD COMMENTlink 7 days ago Sarthak • 10

Login before adding your answer.

Similar Posts
Loading Similar Posts