Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Good examples for teaching database design [closed]

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.

like image 817
Mark Avatar asked Feb 02 '09 16:02

Mark


People also ask

What is the example of database design?

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.

What is the best practice for database design?

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.


1 Answers

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.

like image 83
Jeremy French Avatar answered Sep 22 '22 10:09

Jeremy French