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 Getting Data from a Database Your First SQL Statement

Download Link for the databases

Can you please add a download link for the databases in the download link?

2 Answers

Steven Parker
Steven Parker
215,954 Points

I've never seen any of the playground databases provided for downloading. But this particular database is small enough that you could easily re-create it by copy/pasting the columns from the playground. You could paste into "insert" statements or perhaps into a spreadsheet that you could export.

A few years ago I posted a method for converting a larger database more directly in an answer to this other question. But it's a bit tricky, and probably not worth the effort for this small data set.

Ben McMahan
Ben McMahan
7,313 Points

Here is the SQL to add the data to the books table. Note that id is the primary key and auto-incrementing (Google if you aren't familiar with those terms)

-- Dumping data for table `books`

INSERT INTO `books` (`id`, `title`, `author`, `genre`, `first_published`) VALUES
(1, 'Harry Potter and the Philosopher\'s Stone', 'J.K. Rowling', 'Fantasy', 1997),
(2, 'Harry Potter and the Chamber of Secrets', 'J.K. Rowling', 'Fantasy', 1998),
(3, 'Harry Potter and the Prisoner of Azkaban', 'J.K. Rowling', 'Fantasy', 1999),
(4, 'Harry Potter and the Goblet of Fire', 'J.K. Rowling', 'Fantasy', 2000),
(5, '   Harry Potter and the Order of the Phoenix', 'J.K. Rowling', 'Fantasy', 2003),
(6, 'Harry Potter and the Half-Blood Prince', 'J.K. Rowling', 'Fantasy', 2005),
(7, 'Harry Potter and the Deathly Hallows', 'J.K. Rowling', 'Fantasy', 2007),
(8, 'A Brief History of Time', 'Stephen King', 'Non Fiction', 1988),
(9, 'The Universe in a Nutshell', 'Stephen King', 'Non Fiction', 2001),
(10, 'Frankenstein', 'Mary Shelley', 'Horror', 1818),
(11, 'The Martian', 'Andy Weir', 'Science Fiction', 2014),
(12, 'Ready Player One', 'Ernest Cline', 'Science Fiction', 2011),
(13, 'Armada', 'Ernest Cline', 'Science Fiction', 2015),
(14, 'Pride and Prejudice', 'Jane Austen', 'Classic', 1813),
(15, 'Emma', 'Jane Austen', 'Classic', 1815);