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

Databases Creating and Modifying Database Tables Creating and Modifying Database Tables Creating the Ticket Holders Table

Why would we drop the table each time we are adding data?

This seems like it would confuse someone. Wouldn't the best process be to have another query where we run the insert commands and don't drop the table every time we make a change to our data?

1 Answer

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi there, Colton Shaw! This is actually a fairly common pattern in the SQL world especially when we are testing during development of an application. You may have a script that you want to run many times and during the development you may have accidentally changed a constraint, or purposefully changed a constraint. It's helpful when you have a script that you want to be able to run an infinite number of times to create that table without causing errors.

I might suggest this stackoverflow answer

Hope this helps! :sparkles: