-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi, all --

I have tables for clients, instructors, places (rooms), and classtypes,
and finally a schedule where these come together.  I'd like to make sure
that a client isn't being double-scheduled (two classes at once), or an
instructor isn't being double-booked (two private students in the same
time slot) -- basically the same person (client or instructor) at the
same time, though it also applies for rooms.

Given a table like

  create table schedule
  (
    # ID number
    id smallint not null default 0 auto_increment primary key ,
    client smallint ,   # references client.id
    class smallint ,    # references classtypes.id
    place smallint ,    # references places.id
    instr smallint ,    # references personnel.id
    time datetime       # when
  ) ;

I could, for every insert, check

  select * from schedule where client = '1' and time = '...' ;

to make sure the client isn't being booked twice, or

  select * from schedule where instr = '1' and time = '...' ;

to make sure the instructor isn't double-booked, but that seems like it
would get awfully slow as the table grows...  Is this the sort of thing
where a temporary table is advised, or should I define a reverse table
that shows each instructor and his/her bookings, or what?


TIA & HAND & Happy Holidays

:-D
- -- 
David T-G                      * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, "Science and Health"
http://www.justpickone.org/davidtg/    Shpx gur Pbzzhavpngvbaf Qrprapl Npg!

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (FreeBSD)

iD8DBQE+DaQNGb7uCXufRwARAg6qAJ4vjNsp5EfoQLJRKJdw0MhMx56fygCbBX7H
MVGjrhB5RczZ5f6UAFf6bmk=
=VSZ0
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to