VIEWS / MYSQL Hi, I need some help checking mysql queries, any help would be gre
ID: 3916820 • Letter: V
Question
VIEWS / MYSQL
Hi, I need some help checking mysql queries, any help would be greatly appreciated:
Create a view named customer_address that shows the shipping for each customer.
This view should return these columns from the CUSTOMER table: customer_id, email_address,
last_name, and first_name. This view should return these columns from the ADDRESS table:
ship_line1, ship_line2, ship_city, ship_state, and ship_zip. Write a SELECT statement that
returns these columns from the customer_address view: customer_id, last_name, first_name,
ship_city and ship_state.
/* Write an SQL statement that updates the customer table using the customer_address
view you created in query 1. Set the first line of the shipping address to “1990 Westwood Blvd.”
for the customer with an ID of 11119. */
Create a view that lists the product ID and product name for each product along with the
first name and phone number of the person to contact if the product needs to be reordered.
Name the view reorder_info.
Write a SELECT statement that returns all the columns from the reorder_info view.
Explanation / Answer
If you have any doubts, please give me comment...
CREATE VIEW customer_address AS
SELECT customer_id, email_address, last_name, first_name, ship_line1, ship_line2, ship_city, ship_state, ship_zip
FROM CUSTOMER C, ADDRESS A
WHERE C.shipping_address_id = A.address_id;
SELECT customer_id, last_name, first_name, ship_city, ship_state
FROM customer_address;
UPDATE customer_address SET shipping_line1 ='1990 Westwood Blvd.' WHERE customer_id = 11119;
CREATE VIEW reorder_info AS
SELECT product_id, product_name, contact_fname, phone
FROM PRODUCT P, VENDOR V
WHERE P.vendor_id = V.vendor_id;
SELECT * FROM reorder_info;
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.