Re: Is mysql a RDBMS ?

From: Heikki Tuuri <Heikki.Tuuri_at_innodb.com>
Date: Sun, 24 Aug 2003 17:59:33 GMT
Message-ID: <9272b.354$yu.1_at_read3.inet.fi>


Hi!

"Bob Badour" <bbadour_at_golden.net> kirjoitti viestissä news:Vj52b.593$q25.72766566_at_mantis.golden.net...
> "Heikki Tuuri" <Heikki.Tuuri_at_innodb.com> wrote in message
> news:0d12b.203$yu.178_at_read3.inet.fi...
> > Morten,
> >
> > "Morten Gulbrandsen" <Morten.Gulbrandsen_at_rwth-aachen.de> kirjoitti
> viestissä
> > news:60ca69db.0308210016.822e230_at_posting.google.com...
> > > Hello,
...
> > > From Elmasri:
> > >
> > > To qualify as a genuine relational DBMS,
> > > a system must have at least the following properties:
> > >
> > > 1.) It must store data as relations such that each column is
> > > independently identified by its column name and the ordering of rows
> > > is immaterial.
> >
> > This holds for MySQL.

>

> Are you saying that the following works with MySQL?
>

> select somecharfield name, someintfield id
> from sometable
> union
> select anotherintfield id, anothercharfield name
> from someothertable
> ;

Hmm... Elmasri and Navathe say that 'each column is independently identified by its column name'. Now we can ask if they mean that the ordering of columns in a UNION expression should be irrelevant.

In SQL (see http://www.contrib.andrew.cmu.edu/~shadow/sql/sql1992.txt) we associate an ordering to the columns of a table, as well as the name of the column. Ok, if Elmasri and Navathe mean that the ordering of columns in an expression should not matter, then SQL does not satisfy 1.).

In SQL we think that an n-ary 'multiset' M consists of (1) an injection from {1, 2, ..., n} to the set of possible column names and (2) a set of tuples of the form (k, a1, a2, ..., an). Here k is a natural number > 0 which tells how many times the tuple (a1, a2, ..., an) occurs in the multiset, and each ai is an element from a basic set determined by the data type of the ith column.

In mathematics, we can define a relation as a set of mappings N -> A, where N is a set of column names and A is some set or class. Then the ordering of columns really does not matter in a union of two relations.

> > > 2.) The operations available to the user, as well as those used
> > > internally by the system, should be true relational operations; that
> > > is, they should be able to generate new relations from old relations.
> >
> > This holds for MySQL.

>

> Consider the following relation, AB:
>

> A B
> = =
> 1 1
> 1 2
> 1 3
>

> Are you saying that the following statement results in a relation in
MySQL?
>

> select A
> from AB
> ;

If we define a 'relation' as a set like in mathematics, and not as a 'multiset' like in SQL, then the above is not a 'relation'. You have to add DISTINCT to get a mathematical relation.

But if we define a 'relation' as a multiset, then the above is a 'relation'. This is also relevant in 1.): SQL databases allow the storing of multisets. But nothing prevents using SQL to store only relations in the mathematical sense. And you must add the DISTINCT keyword to your queries to make sure that SQL's operations produce only relations in the mathematical sense. I think this is the reason why there has not been much need to replace SQL by a mathematical relation language. You can use SQL in a way which produces only mathematical relations.

The DISTINCT operation can be quite costly in some cases. SQL allows you not to use it, while a mathematical relation query language would always need to apply it.

Chris Date claims that the concept of a multiset is confusing, and having only mathematical relations in a database query language would allow for more query optimization. But I believe most real-world SQL queries produce only mathematical relations, and we can apply all the optimizations present with mathematical relations. One can also argue that a multiset is a natural way to model the real world. For example, in quantum mechanics, electrons can be indistinguishable. That is similar to having in a table two rows with the exact same column values.

> > > 3.) The system must support at least one variant of the JOIN
> > > operation.
> >
> > This holds for MySQL.
>
> Well, 1 out of 3 is better than none, I guess.

Anyone know how Elmasri and Navathe define a 'relation' in their book? Do they say that some SQL databases, like DB2 or Oracle are 'RDBMS'?

Best regards,

Heikki Tuuri
Innobase Oy
http://www.innodb.com
Foreign keys, transactions, and row level locking for MySQL InnoDB Hot Backup - a non-free hot backup tool for MySQL Received on Sun Aug 24 2003 - 19:59:33 CEST

Original text of this message