Getting view error while creating a view

Screen Link:

My Code:

DROP VIEW IF EXISTS chinook.customer_gt_90_dollars;

CREATE VIEW chinook.customer_gt_90_dollars AS
    SELECT c.* from chinook.customer as c
    INNER JOIN chinook.invoice i on c.customer_id=i.customer_id
    GROUP BY i.customer_id
    HAVING SUM(i.total)>90;
    
SELECT * from chinook.customer_gt_90_dollars;

What I expected to happen:
Not creating view

What actually happened:
Getting the error always in spite of dropping the view for both tables :
chinook.customer_gt_90_dollars
chinook.customer_usa

(sqlite3.OperationalError) table customer_usa already exists
[SQL: CREATE VIEW chinook.customer_usa AS       SELECT * FROM chinook.customer      WHERE country = "USA";]
(Background on this error at: http://sqlalche.me/e/13/e3q8)

Hi @charulagarwal,

Please delete all the code from your mission screen and run the following code (which is practically DROP + the code from solution). Important: after you insert this code, press the button Submit Answer instead of Run Code.

DROP VIEW chinook.customer_gt_90_dollars;
CREATE VIEW chinook.customer_gt_90_dollars AS 
    SELECT
        c.*
    FROM chinook.invoice i
    INNER JOIN chinook.customer c ON i.customer_id = c.customer_id
    GROUP BY 1
    HAVING SUM(i.total) > 90;
SELECT * FROM chinook.customer_gt_90_dollars;

If this approach doesn’t work, then delete the first row from the code above (meaning that you’re not going to drop anything this time) and press again Submit Answer (here it’s also important, don’t press Run Code).

2 Likes

I had the same problem. Why does DQ allow this issue to persist? Personally I find it quite frustrating to spend so much time trying to study and learn the material, then have the app add on more time and confusion by bugging like this. I understand integrating the ‘answer checking’ feature with a web application is another layer of complexity over simply click-through, so I forgive, but this issue is now months old and not resolved. Isn’t this their area of expertise?

I get a similar problem, and am not able to drop the view, as I still get the same “view already exists” error when using a DROP command. I believe this is a bug