Wednesday, June 29, 2011

Recent Lessons on Databases

To the technically indoctrinated,
  1. It is an important and elegant feature of relations that the tuples within them have not top-to-bottom ordering. This is because tuples are mathematical sets, and sets have no order. It is from relations that relational databases take their name; the tables and views within a relational database are just special cases of relations.
  2. Concatenating a number and a string of characters produces a string of characters. This resulting string supports the operations valid for strings, not for numbers. If one is to sort it, one will sort it in lexicographic order and "101 Dalmatians" will always precede "3 Musketeers" in a non-decreasing sort.
  3. In fact, distinguishing the "101" and the "3"  within their strings violates "First Normal Form", according to which the attributes of a tuple must be atomic.
For points 1 and 3, see any good introduction to relational databases, for example C.J. Date's Introduction to Database Systems.

To those not technically indoctrinated,
  1.  If I didn't want it in order, why would I have ordered it before I gave it to you?
  2. Of course 3 is less than 101.
  3. First Normal Form?
I must say that Microsoft has learned about point 2, I'd bet through hard experience; if you have MP3s of "12 Days of Christmas" , "100 Bottles of Beer on the Wall" , and "4 Green Fields" in a directory, Windows Explorer will display them in numeric order when it orders by name.

I must also say, as the technically indoctrinated one in this particular back-and-forth, I was grateful to the other party for her independently deciding to zero-pad the numbers of items, which resolved the problem.

No comments:

Post a Comment