Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Development Tools Database Foundations Creating Tables and Manipulating Data with SQL Creating a Database

IF NOT EXISTS - Not working

I'm trying to accomplish task two and I don't know what I'm missing.

create_db.sql
CREATE SCHEMA movie_db;
CREATE DATABASE IF NOT EXISTS movie_db;

3 Answers

Jason Anders
MOD
Jason Anders
Treehouse Moderator 145,860 Points

Hey Judy,

Your code is correct, just duplicated (and the code checker is fussy).

The second task wants you to modify the code you wrote in the first task, so the finished code for Task 2 will be just one line of code in the window. If you delete the first line there, the code will pass.

Incidentally, either SCHEMA or DATABASE will work for both / either question.

Hope that helps. Keep Coding! :)

Oh!!! I understand what you're saying. Hold on. Let me try it.

It worked!! Thanks for clarifying that for me.

You just need to update your first statement to check if the schema exists or not.

CREATE SCHEMA IF NOT EXISTS movie_db;

I tried it but it but it's still not working.