a. Create the CUSTOMER_2 table. Hint: to create the CUSTOMER table, you may use:
ID: 3558007 • Letter: A
Question
a. Create the CUSTOMER_2 table.
Hint: to create the CUSTOMER table, you may use:
CREATE TABLE CUSTOMER (
CUST_NUM NUMBER PRIMARY KEY,
CUST_LNAME VARCHAR(20),
CUST_FNAME VARCHAR(20),
CUST_BALANCE NUMBER);
b. Insert the data into the CUSTOMER_2 table created in part a.
Hint: to insert data into the CUSTOMER_2 table, you may use:
INSERT INTO CUSTOMER VALUES(1000 ,'Smith' ,'Jeanne' ,1050.11);
INSERT INTO CUSTOMER VALUES(1001 ,'Ortega' ,'Juan' ,840.92);
c. Write the query that will generate only the records that are unique to the CUSTOMER table.
d. Write a query to show the invoice number, the customer number, the customer name , for all invoices in the INVOICE table with an invoice amount of $500 or more.
Hint: You may assume that the customers are from the CUSTOMER table and not the CUSTOMER_2 table.
Explanation / Answer
Ans a.) CREATE TABLE CUSTOMER_2 (
CUST_NUM NUMBER PRIMARY KEY,
CUST_LNAME VARCHAR(20),
CUST_FNAME VARCHAR(20),
CUST_BALANCE NUMBER);
Ans b.) INSERT INTO CUSTOMER_2 VALUES(10 ,'Agarwal' ,'Manish' ,5550.1);
Ans c.) SELECT DISTINCT CUST_NUM, CUST_LNAME, CUST_FNAME, CUST_BALANCE FROM CUSTOMER;
Ans d.) SELECT INVOICE_NUM,CUST_NUM,CUST_LNAME,CUST_FNAME FROM INVOICE,CUSTOMER WHERE INVOICE_AMT>=500;
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.