SQL Cumulative Project


#1

Hi team! I’m working on the SQL Cumulative Project in the data science track and I’m getting an error for step 4.

EXERCISE: https://www.codecademy.com/paths/data-science/tracks/sql-intermediate/modules/dspath-sql-cumulative-project/projects/cadcademy-milestone

Step 4 says Your lab thinks that data in patients table could be organized better. They want their inactive patients in a separate table from now on. Make a table called inactive_patients and transfer all inactive patients into this table. This new table should have columns identical to the patients table. Look up CREATE AS in Google and try to use it to help you.

So I wrote the following code

CREATE TABLE inactive_patients
AS (SELECT * 
    FROM patients 
    WHERE Status = "inactive");

DELETE FROM patients 
WHERE Status = "inactive";

The error I’m getting is a syntax error.
Error: near line 26: near “(”: syntax error.

The following code portion is all of the code that is in my project

SELECT * 
FROM recommended_values 
LIMIT 5;

SELECT *
FROM panels 
LIMIT 5;

SELECT * 
FROM patients
LIMIT 5;

DELETE FROM panels 
WHERE ID = 'ID';

SELECT * FROM panels LIMIT 5;

UPDATE patients 
SET Status = "active" 
WHERE ID = 7;

SELECT * 
FROM patients 
WHERE ID = 7;

CREATE TABLE inactive_patients
AS (SELECT * 
    FROM patients 
    WHERE Status = "inactive");

DELETE FROM patients 
WHERE Status = "inactive";

#2

This was solved in the linked thread.

Solution