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.

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
216,148 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.


Nicolas Hampton
Nicolas Hampton
44,625 Points

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.