Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I have two SQL questions tables are shown above. I am not sure about the answer for first question could I get some help please?

image text in transcribed

I have two SQL questions tables are shown above. I am not sure about the answer for first question could I get some help please? Thanks.

1.Give a SQL query that lists all products that have been purchased by a customer in California. SELECT Product FROM Product, Invoice, LineItem, Customer WHERE Product.Product_Code = LineItem.Product_Code AND LineItem.Invoice_Number = Invoice.Invoice_Number AND Invoice.Customer_Number = Customer.Customer_Number= AND Customer.Customer_Number = Product.Customer_Number AND Customer.State = 'CA'

SELECT Customer.Customer_Number, Customer.State, Product.Description, Product.Price, LineItem.Quantity FROM Customer Customer.Customer_Number JOIN LineItem AND Customer.State ='CA';

2. Give a SQL query that lists all line items that are part of invoice number 11731. SELECT * FROM LineItem WHERE Invoice_Number = '11731'

Invoice Lineltem Invoice_ Customer_ Invoice_ Product Payment Quantity Number INTEGER 11731 11732 11733 Number INTEGER 3175 3176 3175 Number INTEGER 11731 11731 11731 11732 11733 11733 Code CHAR(7) 116-064 257-535 643-119 116-064 116-064 643-119 DECIMAL (10, 2) INTEGER 249.50 Product 10 Price DECIMAL (10, 2) 24.95 29.95 19.99 Product_Co de Description 2 CHAR (7) 116-064 257-535 643-119 VARCHAR (40) Toaster Hair dryer Car vacuum Customer Customer City Address VARCHAR (40) 100 Main Street State CHAR (2) CA MI Zip CHAR(5) 98765 45066 Name Number INTEGER 3175 3176 VARCHAR (40) VARCHAR (30) Sam's Small Appliances Anytown Electronics Unlimited 1175 Liberty AvePleasantville Figure 8 A Sample Database

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Practical Oracle8I Building Efficient Databases

Authors: Jonathan Lewis

1st Edition

0201715848, 978-0201715842

More Books

Students also viewed these Databases questions

Question

What are some tools and techniques used for vulnerability scanning.

Answered: 1 week ago