# Toy Databases for Class Examples/Homeworks

I am familiar with the Northwind database and Chinook database as good toy databases for allowing students to practice writing queries. Are there other databases in a similar vein that are available? I want something with a sensible real-world data model and enough data to be interesting.

In particular, I'm interested in databases that can be downloaded/built from a set of SQL statements in a script - building the tables, adding the foreign key relationships, inserting the data, etc. That way, students can add data under the constraints of the database (e.g., foreign keys). Thus, I am looking for databases that are downloadable in formats compatible with major RDBMS implementations (e.g., MS SQL Server, MySQL, SQLite). This differentiates this question from the previous question regarding datasets, which focuses on flat files, or databases available as flat file.

I stil think this is basically a duplicate of this question: Good datasets for intro CS courses?

You're asking for a database of interesting data. The other question is asking about interesting data. The only thing you need to do to get from the answers in that question to the answers to your question is to write a little bit of processing code that outputs the data in a format that's compatible with a database.

In other words, you're going to have to massage the data. This might require writing a program that calls an API to get data, and then outputs that data to .sql files or more basic .csv files or something. Then the students would take those files and work with them to create their databases.

I think as soon as you accept the fact that you're going to have to massage the data, you'll open yourself up to a lot of cool data sets. I think restricting yourself to data that's already in the exact format you need is very limiting, and isn't how things work in the real world. In the real world, data is always in the wrong format. You always have to convert it to something you can use.

Stop looking for data in the format you want it in. Start looking for interesting data, and then figure out how to get it in the format you want it in.

• I understand your point, and @Ben I. made the same one when I posted this question. But, there's a lot more to a database than just the data (e.g., constraints on attributes, primary/foreign key relationships). I am certainly fine massaging data - I am no stranger to that - but it would be nice to also not need to go through and add all of these different DB-specific components/guess what the designer had intended for their dataset. I want students to be able to manipulate the data and see these things in action (e.g., delete a primary key, see it cascade to foreign key tuples). – cryptic_star Nov 16 '17 at 11:05
• @cryptic_star Adding those restrictions is part of the massage process I'm talking about. The chances of you finding a data set in exactly the format you want is very low. My point is that you should just put it into the format you want yourself, and stop trying to find perfectly formatted data. You'll open yourself up to a lot of cool data sets if you think about it that way. – Kevin Workman Nov 16 '17 at 16:42
• I understand, and I might very well end up going that route in the future. But, clearly there are at least two such datasets (linked in my original question), so I think the question is valid and hope others might contribute what they can find. I simply find myself in an unexpected position of needing such a set of data ASAP differing from the two above. – cryptic_star Nov 16 '17 at 17:28

Look into demo instances for real products that run on various databases. I see more of sqlserver, oracle, and db2 in enterprise apps.

Download some free demo instances of Openmaint, Maximo, redmine, or other apps that are backed by a serious database,.

You can check out the WorldWideImporters db (from Microsoft):

https://github.com/Microsoft/sql-server-samples/releases/tag/wide-world-importers-v1.0

Or the AdventureWorks db (from Microsoft as well):