Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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

SQL create database 2nd question in 1st challenge

"Update the SQL statement to include the keywords to make sure the server doesn't error if it already exists."

Anyone have this solution? I know Im overthinking it--I just want to get through this one, as I have passed all the other challenges in this section.

3 Answers

Ken Alger
STAFF
Ken Alger
Treehouse Teacher

Debbie;

If you take a look at the video around the 4:30 mark Mr. Chalkley covers the usage of IF NOT EXISTS.

Happy coding,

Ken

Thank you-- I was WAY over-thinking it.

CREATE SCHEMA IF NOT EXISTS movie_db;

DATABASE FOUNDATIONS

Challenge Task 1 of 2 Write the SQL statement to create a database called movie_db.

CREATE SCHEMA MOVIE_DB;

Challenge Task 2 of 2 Update the SQL statement to include the keywords to make sure the server doesn't error if it already exists.

CREATE SCHEMA IF NOT EXISTS movie_db;