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

Top Page

Reply to this message
Author: Damian Brasher
Date:  
To: Hampshire LUG Discussion List
Subject: Re: [Hampshire] [OT] BaB Soton Uni register MySQL script
Jim Nicholson wrote:
> To add a mac address, you must have an attendee, and you cannot delete
> an attendee if there are any mac addresses referring to it.


Thanks, I see that, apart from the comma at PRIMARY KEY (id), now removed
and MySQL complains about AUTO_INCREMENT not being a primary key so I
changed that from mac to id in table macs, that won't matter.

Jacqui wrote:
>vc(50) for email address is often too short - consider vc(200)


150, compromise...

CREATE DATABASE bab_register;

USE bab_register;

DROP TABLE IF EXISTS attendee;
CREATE TABLE attendee (
        id              INT NOT NULL AUTO_INCREMENT,
        forename        VARCHAR(50) NOT NULL,
        surname         VARCHAR(50) NOT NULL,
        email           VARCHAR(150),
        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 (
        id              INT NOT NULL AUTO_INCREMENT,
        attendee_id     INT NOT NULL,
        mac             VARCHAR(50) NOT NULL,
                        PRIMARY KEY (id),
                        FOREIGN KEY (attendee_id) REFERENCES attendee (id)
) COMMENT "MAC Address entries, more than one per attendee";



http://www.diap.org.uk - distributed backup volume management system.

--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.