Connecting Tech Pros Worldwide Help | Site Map

best/commont practice orgainzing users. db for each or id in table??

 
LinkBack Thread Tools Search this Thread
  #1  
Old July 17th, 2005, 04:56 AM
John Pastrovick
Guest
 
Posts: n/a
Default best/commont practice orgainzing users. db for each or id in table??

I am not sure what the most effective way to organize a db for users
is.
I have 40 users (teachers) and 20 tables (grades, assignments,
students, etc).
Each needs access to its OWN grades, assignemnts, etc.


NOW I am not sure how to orgainize users in the DB. Right now I have
the code for 1 user and need to adapt it to several users.

1. A user id in each table and the same db for all users.?

OR

2. A different db with its own set of tables (same names) for each
user.?


Option 1. would be easier for me because it would only involve adding
an id to a the connection string in the include. Option 2, would
require modifying query strings throughout the code in the
application.

However I heard that ISPs usually limit the number of dbases per Mysql
server (don't know why).
On the other hand the dbase per user approach seems to me more
efficient since the number of records in a table is greatly reduced
and each user has access only to its own db.

What is best/common practice in this situation having in mind that the
number of users is limited to around 40 if that makes any diffrence at
all.


Thanks

  #2  
Old July 17th, 2005, 04:57 AM
Geoff Berrow
Guest
 
Posts: n/a
Default Re: best/commont practice orgainzing users. db for each or id in table??

I noticed that Message-ID:
<a21852f1.0404222225.6fb2ca85@posting.google.com > from John Pastrovick
contained the following:
[color=blue]
>I am not sure what the most effective way to organize a db for users
>is.
>I have 40 users (teachers) and 20 tables (grades, assignments,
>students, etc).
>Each needs access to its OWN grades, assignemnts, etc.
>
>NOW I am not sure how to orgainize users in the DB. Right now I have
>the code for 1 user and need to adapt it to several users.
>
>1. A user id in each table and the same db for all users.?
>
>OR
>
>2. A different db with its own set of tables (same names) for each
>user.?[/color]

If you are not sure it suggests to me that your database may not be
properly normalised (ie to 3rd normal form).

Consider.

One teacher can have many students. So the students table can have a
field containing the teacher id. It is easy then to get a list of
students for a particular teacher. However, if one student can have
more than one teacher you cannot use this method. But proper
normalisation is essential to effectively organise your database, reduce
redundancy etc..

This isn't really on topic here and you need to check a database group
or do some research on normalisation.
--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
  #3  
Old July 17th, 2005, 04:57 AM
.:Ninja
Guest
 
Posts: n/a
Default Re: best/commont practice orgainzing users. db for each or id in table??

John Pastrovick wrote:
[color=blue]
> I am not sure what the most effective way to organize a db for users
> is.
> I have 40 users (teachers) and 20 tables (grades, assignments,
> students, etc).
> Each needs access to its OWN grades, assignemnts, etc.
>
>
> NOW I am not sure how to orgainize users in the DB. Right now I have
> the code for 1 user and need to adapt it to several users.[/color]

The user table should have an id field (unique, index, whatever). Then this
field must map to a corresponding field in each of the other tables. That
way, you know that a particular entry in for instance the grades table,
belongs to a specific entry in the user table. You can then use a JOIN
statement in SQL to quickly amalgamate all the data into a temporary table
that you can iterate over to list all the entries. This is what the term
"relational" refers to in "relational database".

..:Albe

--
http://www.ninja.up.ac.za
  #4  
Old July 17th, 2005, 04:57 AM
Chung Leong
Guest
 
Posts: n/a
Default Re: best/commont practice orgainzing users. db for each or id in table??

"Geoff Berrow" <blthecat@ckdog.co.uk> wrote in message
news:dlfh80hp2814pp503ncklpkgsuk792tkuk@4ax.com...[color=blue]
>
> One teacher can have many students. So the students table can have a
> field containing the teacher id. It is easy then to get a list of
> students for a particular teacher. However, if one student can have
> more than one teacher you cannot use this method. But proper
> normalisation is essential to effectively organise your database, reduce
> redundancy etc..[/color]

From a data integrity point of view, yes, the schema is flawed. But from a
administrative point of view, I think it's quite reasonable. If we normalize
the database as you said, then who becomes responsible for consolidated
student information? Clearly you would need someone who oversees all the
students. And getting this person to perform this task could be politically
sticky.

I would go with option 2, since it requires the least amount of code change.
Having separate databases also eliminates the possibility of one teacher
modifying the data of another. I don't see the database limit as an issue,
since such a system should never be hosted on a shared server in the first
place. It would be too easy for students to break in and alter their grades.
All they had to do is get an account at the same ISP.


  #5  
Old July 17th, 2005, 04:57 AM
Geoff Berrow
Guest
 
Posts: n/a
Default Re: best/commont practice orgainzing users. db for each or id in table??

I noticed that Message-ID: <CtOdnS3G9fquTxTdRVn-hw@comcast.com> from
Chung Leong contained the following:
[color=blue]
>"Geoff Berrow" <blthecat@ckdog.co.uk> wrote in message
>news:dlfh80hp2814pp503ncklpkgsuk792tkuk@4ax.com.. .[color=green]
>>
>> One teacher can have many students. So the students table can have a
>> field containing the teacher id. It is easy then to get a list of
>> students for a particular teacher. However, if one student can have
>> more than one teacher you cannot use this method. But proper
>> normalisation is essential to effectively organise your database, reduce
>> redundancy etc..[/color]
>
>From a data integrity point of view, yes, the schema is flawed. But from a
>administrative point of view, I think it's quite reasonable. If we normalize
>the database as you said, then who becomes responsible for consolidated
>student information? Clearly you would need someone who oversees all the
>students. And getting this person to perform this task could be politically
>sticky.
>
>I would go with option 2, since it requires the least amount of code change.
>Having separate databases also eliminates the possibility of one teacher
>modifying the data of another.[/color]

Chung, you normally post a lot of good stuff but I think you are
completely wrong here. Look at the subject line. best/common practice

I'm about to go to work in a large community college. It has many
thousands of students and hundreds of lecturers. Avoiding redundancy
for such a database would be a major consideration.

Student information (such as address, telephone number), in particular
needs to be centrally organised since it can change frequently, even for
a relatively small number of students.

If there is a problem with one teacher modifying the data of another
then suitable privileges will have to be built in.

Finally, how is the college going to amalgamate all the data from all
its students if everything is stored in individual unrelated database?
--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
  #6  
Old July 17th, 2005, 04:58 AM
Chung Leong
Guest
 
Posts: n/a
Default Re: best/commont practice orgainzing users. db for each or id in table??

"Geoff Berrow" <blthecat@ckdog.co.uk> wrote in message
news:ln5k80dgph1r3jocgbcv652vreouo7a8v4@4ax.com...[color=blue]
>
> Chung, you normally post a lot of good stuff but I think you are
> completely wrong here. Look at the subject line. best/common practice
>
> I'm about to go to work in a large community college. It has many
> thousands of students and hundreds of lecturers. Avoiding redundancy
> for such a database would be a major consideration.[/color]

I'm just offering a second opinion, that's all. There are best practices in
theory, and then there is the all important mandate of meeting real life
requirments. If normalization of the database implies the establishment of a
managerial role that you know no one is going to fill, then maybe
normalization no such a good idea.


 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.