Re: How would i do this?

Поиск
Список
Период
Сортировка
От Mike Arace
Тема Re: How would i do this?
Дата
Msg-id F235M8RYpDWbvws2OhY00000007@hotmail.com
обсуждение исходный текст
Ответ на How would i do this?  (John Hughes <johughes@shaw.ca>)
Список pgsql-general
As I'm sure you've seen there are about a million ways to do this :)

Personally, I'd start by looking at the relationships between the different
objects here.  Ask some questions, such as "is ther more than one teacher
per class?" and "do the students get assignments, or do the classes get
assignments?"  Figure out the different relationships of your "things," in
terms of many-to-one, one-to-one, and many-to-many.

In this case I'm making these assumptions:

one teacher per class
many students per class, but students can have multiple classes
many assignments per class, and they "belong" to the classes

and it would seem like class is really the central thing here.  Your class
table would have a reference to a teacher id in this case, assignments would
have a reference to a class id, and students would be tied to classes by an
5th associational table which would simply have student and class ids on it.

If you want to track student performance on the assignments, you would need
still another table, which would associate student ids, assignment ids
(assuming they are unique), and grades (or whatever your performance
indicator is).

Databases are all about relationships.  If you want to learn this quickly I
highly recommend bruce's postgresql book.  He is a very talented teacher,
and gets you up and running without wasting words.

Regards,
Mike

>I am new to DB programming, so im not too sure about how to implement my
>DB.
>
>Here is what i need: a DB with tables of:
>
>1. Students.
>2. Classes
>3. Teachers
>4. Assignments
>
>Each teacher can be assigned a class, which is compromised of a list of
>students. Each class can be given assignments.
>
>Coming from a programming background, I could do this in c++ very easily. I
>actually started inmplementing it in a similar fasion: each student class
>teacher ect would have a uniqe id in the database, and, for example, a
>class would include an array of integer student id's.
>
>This seems really error prone, and not very efficient.
>
>what is a better implementation?



_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com


В списке pgsql-general по дате отправления:

Предыдущее
От: wsheldah@lexmark.com
Дата:
Сообщение: Re: How would i do this?
Следующее
От: Vince Vielhaber
Дата:
Сообщение: Re: How would i do this?