Re: How would i do this?

Поиск
Список
Период
Сортировка
От Vince Vielhaber
Тема Re: How would i do this?
Дата
Msg-id Pine.BSF.4.40.0112111522440.96989-100000@paprika.michvhf.com
обсуждение исходный текст
Ответ на How would i do this?  (John Hughes <johughes@shaw.ca>)
Список pgsql-general
On Tue, 11 Dec 2001, John Hughes wrote:

> 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?

Don't think array.  Look at it from the other direction.

Each class has a name (prog101) a room#, teacherid, etc.  and a class id.
Each student has a name, etc. and the id of the class they're taking.

Then:  select name from student where classid = 4;

Where 4 could be the id for prog101.

That's the REALLY simplified version, but you get the idea.


Vince.
--
==========================================================================
Vince Vielhaber -- KA8CSH    email: vev@michvhf.com    http://www.pop4.net
         56K Nationwide Dialup from $16.00/mo at Pop4 Networking
        Online Campground Directory    http://www.camping-usa.com
       Online Giftshop Superstore    http://www.cloudninegifts.com
==========================================================================




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

Предыдущее
От: "Andrew Snow"
Дата:
Сообщение: Re: How would i do this?
Следующее
От: David A Dickson
Дата:
Сообщение: Re: How would i do this?