## Learning SQL at an early age

Pete Finnegan blogged about becoming a dad a few days back and Gary Myers followed up with his version of an SQL Primer for a toddler.

This got me thinking of how the child subjected to this may react .

As having SQL read out loud even with pictures from the result set may not really be all that enjoyable for a new born or even at four years of age, maybe the first reaction would be.

``drop function dad;``

After a restore of dad and some time passes by, the age where parents tells a small child no to everything fun will be on them. While parents rarely understand this, fun is defined as playing with sharp knifes or walking close to the edge of a canyon.

``alter user child quota unlimited on dangerous_activities;``

Later on when trying to do enough homework to please mom&dad and have enough time to hang out with friends seems like an impossible equation.

``alter table child parallel (degree 2);``

Of course when it is time to go to collage the natural command will be.

``alter user child quota unlimited on college_fund;``

Rather than asking the church to take care of the practicalities of getting married, the following statement may be used.

``````merge into my_stuff
using (select *
from your_stuff)
on (a.stuff_id = b.stuff_id)
when matched then
(update my_stuff set a.stuff_value = a.stuff_value + b.stuff_value)
when not matched then
(insert into my_stuff values(b.stuff_id, b.stuff_value);

drop table your_stuff purge;
rename table my_stuff to our_stuff;﻿``````

After the marriage they will of course soon realize that there is a constraint between the tables what_she_wants and what_he_wants. He will also have to learn the value of the constant yes_dear if he is to avoid the “drop function marriage; alter table our_stuff to your_stuff;” combo.

An alternative to this is of course if the wedding still is held in church that the force fed geek answers the question “do you take this…” with a confident “COMMIT”. That may cause the question to be repeated enough times that our geek decides that the only safe solution is to “ROLLBACK”.

The honey-do list would of course be implemented with AQ and the “you never” list as a read from the exception queue. The retry count would however have to be set very high to allow an adequate amount of nagging. This nagging function could be implemented as a scheduled job that kicks off every fifth minute.

When it is time to find a job, it can be simplified to:

``dbms_job.submit('BEGIN SLEEP_FOREVER; END;');``

That could of course lead to the manager saying this during a performance evaluation

``dbms.job.BROKEN;``

If the performance doesn’t improve, and how could it with an endless sleep, the manager will eventually be forced to:

``dbms_job.REMOVE;``

While unemployed our geek may have time to extend the family and that is of course easiest done by:

``````create user child;
alter user child quota unlimited on sleep;
alter user child quota unlimited on wake_parents_often;``````

Enough childish geek humor? I guess that is more than enough and few will have read through it all. Oh well, I had fun while writing it.