Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: Store in one database column an array is a bad practice.

Re: Store in one database column an array is a bad practice.

From: stephen booth <stephenbooth.uk_at_gmail.com>
Date: Thu, 18 Aug 2005 17:09:51 +0100
Message-ID: <687bf9c40508180909aaf259f@mail.gmail.com>


Another possible example that comes to mind is students enrollment on courses. Imagine you run a college (as in UK style FE college not a US University), that college runs a number of courses each of which has a unique code. You have a number of students enrolling, each student doing zero[*] or more courses, each of which has a unique code. So you have a students table and a courses table. To show the enrollments you need to provide a link between the two.

You could do this with an Enrollements table that consists of a pair of columns, student_code and course_code, which link via foriegn keys to the students and courses tables.

Alternatively you could add an array column to the students table which holds the course codes for the courses that they're enrolled on.  If they're not enrolled on any courses then it's null.

[*] Here in the UK (I assume elsewhere as well) it's not unusual for a large number of students to be signed up with the college but not enrol on any courses. This entitles them to use the college faccilities (library, canteen, creche, IT equipment AV equipment &c) at student rates, very useful for people who want to self study on a subject.

Stephen

--
http://www.freelists.org/webpage/oracle-l
Received on Thu Aug 18 2005 - 11:16:36 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US