Re: [Hampshire] [OT] BaB Soton Uni register MySQL script

Top Page
Author: Chris Smith
Date:  
To: lug, Hampshire LUG Discussion List
Subject: Re: [Hampshire] [OT] BaB Soton Uni register MySQL script

Reply to this message
gpg: failed to create temporary file '/var/lib/lurker/.#lk0x58097100.hantslug.org.uk.6649': Permission denied
gpg: keyblock resource '/var/lib/lurker/pubring.gpg': Permission denied
gpg: Signature made Tue Jan 13 12:09:01 2009 GMT
gpg: using DSA key 11BEF6408586B4B2
gpg: Can't check signature: No public key
Damian Brasher wrote:
>
> I have just put together a MySQL script as I'm about to start filling in
> the BaB meeting register DB for my own use (printed copy for security).
> Here is the script for the DB, I'm about to add a PHP front end to it and
> add data. Any thoughts? I'll make the front end available Saturday for
> further discussion. I use XAMPP so it is network visible from within ECS
> (with an htaccess password).
>

[snip]
>
> DROP TABLE IF EXISTS attendee;
> CREATE TABLE attendee (
>         forename        VARCHAR(50) NOT NULL,
>         surname         VARCHAR(50) NOT NULL,
>         email           VARCHAR(50),
>         member          ENUM('yes','no') NOT NULL,
>         new_attendee    ENUM('yes','no') NOT NULL,
>         mac             VARCHAR(50),
>                         PRIMARY KEY (forename, surname),
>                         FOREIGN KEY (mac) REFERENCES macs (mac)
> ) COMMENT "HLUG BaB meeting register Southampton Uni (ECS)";

>
> DROP TABLE IF EXISTS macs;
> CREATE TABLE macs (
>         mac             VARCHAR(50) NOT NULL,
>                         PRIMARY KEY (mac)
> ) COMMENT "MAC Address entries";


Three problems I can see:
1. using forename and surname for the attendee key will fail if two
people have the same name;
2. MAC address data is duplicated unnecessarily; and
3. it only allows one MAC address to be associated with an attendee.

I would do the following:

CREATE TABLE attendee (
        id              INT NOT NULL,
        forename        VARCHAR(50) NOT NULL,
        surname         VARCHAR(50) NOT NULL,
        email           VARCHAR(50),
        member          ENUM('yes','no') NOT NULL,
        new_attendee    ENUM('yes','no') NOT NULL,
                        PRIMARY KEY (id)
) COMMENT "HLUG BaB meeting register Southampton Uni (ECS)";


DROP TABLE IF EXISTS macs;
CREATE TABLE macs (
        attendee_id     INT NOT NULL,
        mac             VARCHAR(50) NOT NULL,
                        PRIMARY KEY (attendee_id, mac)
) COMMENT "MAC Address entries";


Chris
--
Chris Smith <cjs94@???>