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 SQL Basics Finding the Data You Want Review & Practice with SQL Playgrounds

Khalil Al-Rashid
Khalil Al-Rashid
Courses Plus Student 933 Points

Downloading This Database?

Is it possible to download this database which is available in this course? and how?

3 Answers

Steven Parker
Steven Parker
228,991 Points

So you think it would be fun playing with a list of 13,076 actors (there's not much else in there)?

OK, then, here's the trick. Use your browser and save the playground page (as HTML code). Inside the code, there's a <script> section where the variable window.APP_DATA is being assigned to a JSON object with (among other things) the SQL statements to create the tables and populate them with the data. This element is named initializerSql. Now you know why it takes a good while for the playground page to load!

You'll need to do a little editing to prepare the SQL, such as:

  • removing all the HTML outside the <script> section
  • removing the extra JSON elements
  • converting sequences of "\n" into real line endings
  • converting escaped quotes (\") into plain quotes (")
  • converting accents (`) into single quotes (') - unless your DB likes them

Once you've done all that, you can run the SQL into your favorite DB engine to create your duplicate database.


I don't believe so Khalil, but from what I can tell there's not really much of an advantage to doing so.

Or copy and paste in a spreadsheet application and export as CSV? Then the trick is getting all the right types on import into the database application of your choice.