Hi,
On Fri, Feb 09, 2001 at 05:51:08PM +0530, Suresh Kumar R wrote:
> In this table the entries would look like this:
>
> student_id hour_of_day day_of_week week_of_course
>
> 1 1 1 1
> 6 1 1 1
> 14 1 1 1
>
> Thus the table will have as many identical rows except in one column
> as there are absentees in particular session. My doubt is isnt it
> reduntant and is there any other ways of doing things without this
> redundancy?
You are right in general. And you can move last 3 fields to another
table, add id column and insert student_id and chunk_id into the
absence table. But I would not go this way unless you want to use those
chunks somewhere else.
If you don't want to use 3 fields you can replace them by calculated
numeric value. For example:
time_chunk = hour_of_day + day_of_week * 100 + week_of_course * 10000
In my opinion, it will give you another advantage. Instead of
select * from absence where hour_of_day = 1 and day_of_week = 1
you will write
select * from absence where time_chunk = 101
I am calling it an advanantage because as far as I understood MySQL is not
efficient in where clauses at least sometimes.
> On Fri, Feb 09, 2001 at 09:26:49AM -0000, Russell King wrote:
> > From: Suresh Kumar R <[EMAIL PROTECTED]>
> >
> > > I want to have the absentee list of students per hour_of_day
> > per day for a week, done for the entire course.
> > >
> > > One possibility I thought was to create a table with date and
> > each hour of the day as columns, then each cell would have to
> > have variable number of student roll nos who are absent for that
> > particular hour and I dont know how I can enter an array of
> > numnbers.
Never go this way (excuse me please for so strong phrase). What if
you want to detail your absence to half an hour, quarter of hour,
minutes. Ok, if you are not convinced yet... to seconds :-)
In my personal experience, you never know :-) So, please, don't tell
me: "I will never go this way!"
> > I think the best method to deal with this is just have a single
> > table containing :
> >
> > student_id int
> > hour_of_day int
> > day_of_week int
> > week_of_course int
> >
> > One assumes a student is present for all classes.
> >
> > If a student is absent, an entry is made in the table, recording
> > the student's number, and the time/day/week they are absent.
The bottom line from my point of view is the solution is quite good,
but I would consider a formula instead of last 3 fields.
Hope it helps.
--
Lumberer.
---------------------------------------------------------------------
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