[help] With Mysql Please

I have some Q. and I can not find it in the book! I hope if some one can help me with it.

1. Create a report of the days the students were absent sort sort them by day, and rerun sorted by sex

2. you have discovered that on event 6 and 8 that the scores for the student 17 and 18 got reversed. Correct the mistake.

3. show what tables our server supports?

and one you know please help.

thank you in adviace

#156739

Post the database schema so I can see what it looks like please.

#156842

there is no data its just equation any data will work

#156901

Well it looks to me that you copied those questions directly out of a textbook where there would be some helpful background info but I'll give it a go anyway, test out my own knowledge sort of thing!

1.

Hmm, I'd have the students given an ID number as column names with a date column as so:

| DATE    | STUDENT_1 | STUDENT_2 |etc....
+---------+--------------+--------------+
|25/06/04|      Y          |         N        |

That way you can keep adding dates to the table, inserting a 'Y' if present and an 'N' if not.

Query to find dates a student was absent:

SELECT student_1 FROM tablename WHERE student_1 = 'N' ORDER BY date ASC;

Hope this helps, it's not a very good method, but then beggars can't be choosers. I'm not doing the rest of it because I'm tired and want to go to bed and you should do your own homework.

EDIT

--------------

In fact, looking at it, this layout and my code there really sucks. Post the database schema. That means the column names within the table. I don't need the table contents, just the column names. I'm quite grumpy now I've read your other post that you seem to be asking us to do your assignment.

#157006

thank you so much for your help but this one for Q. number 1? because its missing the (and rerun sorted by sex) but thank you again

#157055

Originally posted by Ludge@May 5 2004, 09:32 PM

EDIT

--------------

In fact, looking at it, this layout and my code there really sucks. Post the database schema. That means the column names within the table. I don't need the table contents, just the column names. I'm quite grumpy now I've read your other post that you seem to be asking us to do your assignment.

Do what I said above and I might be able to help some more. If you want the students sex, make a table with all their details in, then join it with the attendance table in your query.

#157349

Originally posted by Ludge@May 6 2004, 03:21 AM

If you want the students sex, make a table ...  then join it

loving the out of context stuff... :P

#157356

ok, abut the sex I beleive its 'M' for male and 'F' for female

#157461

Originally posted by ~Ayman~@May 6 2004, 03:19 PM

ok, abut the sex I beleive its 'M' for male and 'F' for female

oh will someone please help me explain things to this muppet!

I want to know what the database looks like. What are the column headings? I do not, repeat: do not care about the data within it. If you don't get it this time, then I suggest you go ask them on the alt.php newspgroup and hope they have more patience than me.

#157586

Originally posted by Ludge@May 6 2004, 06:18 PM

oh will someone please help me explain things to this muppet!

All I want is

First_name, Last_name, student_id, student_sex, score.

because I have the same test and I'm looking for the same answer.

#157590

And you are Ayman under a different name? Why?

If not, I wasn't referring to you.

anyway, thanks for the info. Is there already a table for attendance? If yes, please post it.

If you use two tables, one with the student info, and one with attendance you do this:

SELECT * FROM info, attendance WHERE info.student_id = 'id here' AND attendance.student_id = 'N' ORDER BY attendance.date ASC

This will give a list of all rows where a student (chosen by id number) was absent ordered by date ascending. It's untested but should work.

For the other bits, you'll have to help yourself as I don't have time any more. try the mySQL manual.

#157710

thank you for your help and about the rest of the Q. I will find some sites.

thank you again

#158011