Does anyone have any good scenarios for teaching relational databases and SQL? All the examples I can find are either trivial or have improbable domain constraints (like full name being unique).
I'm especially trying to find some good examples for normalisation: tables that don't immediately fit 3NF and BCNF. At the moment I'm using a different problem for each level.
Of course, I'd also love good examples of badly designed databases, but it's a bit distracting until the fundamentals have been mastered.
Thanks, some nice examples. I've marked the student/class one as the answer as I think it's the best so far, but if anyone wants to contribute some more, please do.
The first is an RDBMS, or a relational database management system. Examples of RDBMSs include SQL Server, MySQL, and PostgreSQL. The second and most important tool is SQL (structured query language). This is the language we use to define the tables, columns, indexes, and other artifacts in our database.
The database belongs to its future users, not its creator, so design with them in mind. Stay away from shortcuts, abbreviations, or plurals. Use consistent naming conventions. Don't reinvent the wheel or make things difficult for those who may need to modify the database at some point, which will certainly happen.
I seem to remember student / class as being a classic, you can put grades in there as well to make it a bit more complex.
Student can atted many classes
Classes have many students
For eachclass a student attends they can have a grade
Initially you can do this in one table and denormalise to three.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With