In my spare time, if I’m not working on data, blogging about data, or thinking about data, I take ballet lessons. Dance makes my brain work in different ways, it’s challenging, and who wouldn’t like to dance like a ballerina?
As I was having a hard time switching off from work this week, I thought: a ballet lesson would be a great way to discuss database concepts.
Here’s what I mean.
If you’ve never attended a ballet class, it generally begins with a warm-up at the barre.
Our teacher is a PRIMARY KEY. She identifies all ‘rows’ in the class and is NOT NULL. We rely on her for entity integrity. A teacher from the Jazz class usually visits our class and she is the FOREIGN KEY. Our referential integrity is maintained by her.
Each person lines up at the barre in order. Everyone prefers their own spot, so this is the same order every time. We have a clustered index.
Then we begin our exercises at the barre. After completing the first position, we move on to the second and third. By the time we get to third position, we are prepared to move on to more challenging exercises. Our data is considered ‘normalised’ once it reaches the third normal form.
As with the data normalisation procedures, these exercises are built upon each other, are based on formal rules, and form the foundation of the art.
After barre, everyone goes to the centre. We work in groups where everyone takes turns working through exercises. For our solo performances, DISTINCT, we come out one at a time.
We get an INNER JOIN when we begin to practice our combinations with a partner from the class next door.
The final part of the class is the rehearsal for the next performance. In the BEGIN TRANSACTION stage, we debate ideas around music and what might look good.
We COMMIT if we’re happy with what we’ve come up with, and if not, we ROLLBACK.
Our class ends with a curtsy and then a TRUNCATE. We’ll be back next time to INSERT, UPDATE, and SELECT with all our jargon.