Kitties & Owners: An Emotional Understanding of SQL Relations

Once, there was a Bad Owner.

Bad Owner had one kitty named Sad Kitty.

Bad Owner used to pet Sad Kitty with his cruel, unfeeling robot arm.

Bad Owner did not care about Sad Kitty.

But Sad Kitty was well aware of Bad Owner.

Many unhappy years passed, until one day, Bad Owner read the ancient documentation — and realized that the nature of his true self is id, and that his id is 1 with THE JOIN TABLE.

“All hail THE JOIN TABLE, which is one with all ids: both kitties_id and owners_id!” cried Bad Owner.

In his catharsis, Bad Owner realized that Sad Kitty, too, had an id, and that together they were 1 through THE JOIN TABLE.

Bad Owner began to care about Sad Kitty, and to realize just how bad of an owner he’d been. Bad Owner cried out again: “Sad Kitty, I am so sorry I pet you with my robot arm! You are free now, to be with any owner you choose! Please — go!”

And Bad Owner cast out his robot arm so that it could never pet kitties again.

And Bad Owner became Good Owner

When Sad Kitty realized he was free — he became Happy Kitty.

Happy Kitty cut all ties with his former owner, knowing that even though he couldn’t change the past (at least in sqlite3), he could at least move on…

… and go be with any owner he liked!

Good Owner didn’t mind being alone for a while. He needed time to reflect.

But gradually, kitties from all over the database learned of the Good Owner’s transformation, and came to say hello!

So many kitties came to visit that Good Owner became Crazy Cat Man

Crazy Cat Man had changed so much that even Happy Kitty started coming to visit again.

Now, Crazy Cat Man always remembers that through THE JOIN TABLE, kitties and owners alike have ids.

*2 Left Outer Joins were needed to show Simone (kitty) and Anton (owner), as SQLite does not allow Right Outer Joins

Some kitties and owners have yet to meet! Isn’t life exciting?

Amen.