Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Help! Doing MYSQL and keep getting this error code: Error Code: 1146. Table \'my

ID: 3712416 • Letter: H

Question

Help! Doing MYSQL and keep getting this error code: Error Code: 1146. Table 'my_guitar_shop.   ' doesn't exist 0.000 sec

Here is my code:

USE my_guitar_shop;

CREATE OR REPLACE VIEW customer_addresses AS

SELECT customer_id, email_address, last_name, first_name, bill_line1, bill_line2, bill_city, bill_state, bill_zip, ship_line1, ship_line2, ship_city, ship_state, ship_zip

FROM customers c

JOIN addresses ba ON c.billing_address_id = ba.address_id,    

JOIN addresses sa ON c.shipping_address_id = sa.address_id ORDER BY last_name, first_name;

Explanation / Answer

From above code I could see that only problem is that you have an extra comma before last JOIN statement.

JOIN addresses ba ON c.billing_address_id = ba.address_id,    

JOIN addresses sa ON c.shipping_address_id = sa.address_id ORDER BY last_name, first_name;

If you remove that comma and I assume you already have definition of tables it should work fine.

Also I assume you are woking on mysql terminal. Let me know if you are using other means of coding with definition of all tables used.

Here is corrected code

USE my_guitar_shop;

CREATE OR REPLACE VIEW customer_addresses AS

SELECT customer_id, email_address, last_name, first_name, bill_line1, bill_line2, bill_city, bill_state, bill_zip, ship_line1, ship_line2, ship_city, ship_state, ship_zip

FROM customers c

JOIN addresses ba ON c.billing_address_id = ba.address_id   

JOIN addresses sa ON c.shipping_address_id = sa.address_id ORDER BY last_name, first_name;

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote