Databasen - Revisited

Paul Makepeace paulm at paulm.com
Wed Oct 18 23:05:47 BST 2006


On 10/18/06, Matt Sergeant <msergeant at messagelabs.com> wrote:

> Q: What is wrong with the following setup:
>
> CREATE TABLE Month (
>    id INTEGER PRIMARY KEY,
>    name VARCHAR(16),
>    shortname VARCHAR(3)
> );
>
> INSERT INTO Month VALUES (1, "January", "Jan");
> ...
>
> There are lots of fairly obvious right answers (localisation would be
> one obvious one), but most people won't get the fact that the primary
> key index is a bad thing,

I'm gonna chime in with everyone else and say I think this question is
simply not presenting the candidate with an opportunity to give the
answer you want.

Without seeing the rest of the schema there's simply no way to know
whether an integer is useful as a means of getting the data, or how
it's used.

Why use VARCHARs if performance is so critical? CHARs produce fixed
length fields that can be treated as records. That uppercase Month is
more of a worry to me - shows the candidate hasn't had to deal with
real life cases where case is a nightmare with DBs.


Paul


More information about the london.pm mailing list