JOIN Tables Here are the Database Tables I am presented Here is my Question It l
ID: 672191 • Letter: J
Question
JOIN Tables
Here are the Database Tables I am presented
Here is my Question
It looks as if I have to join CUSTOMER, SALE, ITEM, and PRODUCT to get my answer. I am at a loss on this one. The PRODUCT.ProdCategory contains the cameras, lenses, and filters and the SALE.SaleDate contains the year that needs to be checked against. I did create a query that showed me who bought in 2014 but not 2015 and is below.
SELECT a.SaleCustID as a, b.SaleCustID as b from
(SELECT DISTINCT SaleCustID
FROM SALE
WHERE SaleDate LIKE ('%2014%')) a
LEFT OUTER join
(SELECT DISTINCT SaleCustID
FROM SALE
WHERE SaleDate LIKE ('%2015%')) b
ON a.SaleCustID = b.SaleCustID
WHERE b.SaleCustID IS NULL;
I was able to get my results using just the SALE table but since I need the names of customers and also products they bouught this is where I would need to pull the other tables in. Any help is appreciated.
Explanation / Answer
using System;
namespace oops
{
class customer
{
// Member Variables
public int CustID;
public string Name;
public string Address;
//constuctor for initializing fields
customer()
{
CustID=1101;
Name="Tom";
Address="USA";
}
//method for displaying customer records (functionality)
public void displayData()
{
Console.WriteLine("Customer="+CustID);
Console.WriteLine("Name="+Name);
Console.WriteLine("Address="+Address);
}
// Code for entry point
}
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.