Re: Database introduction
Date: Tue, 28 Jan 2014 20:26:37 -0500
Message-Id: <20140128202637.5227c00b.jklowden_at_speakeasy.net>
On Mon, 27 Jan 2014 13:56:04 +0100
> Unfortunately I can't grasp division in a relational database..
Division is harder than multiplication. We learn it later in school,
and it takes more cycles for a CPU. It's the basis for cryptography,
and after 30 years SQL DBMSs still can't do it.
I find the easiest way to think about it is as what it is: the inverse
of multiplication. Given any product
insert into C select * from A cross join B
division produces
It doesn't come up a lot in my experience but, like any tool, when you
need it you really need it.
The examples I remember involve whether a canonical set has been met.
Say you have a type of task that consists of steps A, B, and C.
As each step is done for each actual task, you add a row for the task
and the step
insert into status values (task_id, 'A')
Then eventually you want a list of completed tasks. That is, you want
task_id = status ÷ task_types.step
Max <maxfalsa_at_despammed.com> wrote:
A = C ÷ B
and
B = C ÷ A
insert into task_types
values ( ( 1, 'A' ), (2, 'B'), (3, 'C') )
SQL version left as exercise for the reader!
HTH. --jkl Received on Wed Jan 29 2014 - 02:26:37 CET