Database Management
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesDatabase Management

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
You don't need a fax machine to get faxes. Get a fax-to-email fax number from CallWave. Try it free.
  #1  
Old June 3rd, 2003, 03:19 PM
nooch nooch is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Location: Wakefield UK
Posts: 7 nooch User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Database Design


I'm having difficulty linking some tables together. Basically the database is being hosted on MS SQL, but is still in design stage so any alterations can still be made. I need to link the following tables:


Students - This table holds information about the students attending a college. Each student is given a unique identifier.

Staff - Holds information about the staff, contains a unique identifier for each staff member

Assignments - Holds information about assignments, has unique identifier for each assignment.

Courses - Holds information about courses, has unique identifier for each course.

Progress - This holds information about each student's progress of each assignment. This is also used by the staff to mark assignments, and used by the college intranet to display to students which assignments are currently unfinished.

Now, many students can study on many courses. Many staff can teach on many courses. Each course contains many assignments.

Course=---=Students
Course=---=Staff
Course----=Assignments

Which is easy enough. However, the database is going to be used to create a more intricate information system, as part of mainly an ASP intranet system. So we need to some how add the progress table to the existing design so we can pull the following information from the database easily...

So from the database we need to:
  • display new assignments for students (if any) that staff submit
  • find out which course the student is studying, so we can direct the student to appropriate information
  • display student names for a staff member for individual courses that that they study on, as well as all courses
  • and also some other minor queries, but these are not majorly important.
If someone could suggest how we would go about relating the tables together to provide a solution that we can easily query and get the information above, we would really appreciate it, because we are stumped

Thanks in advance,

Daniel Thompson

Reply With Quote
  #2  
Old June 3rd, 2003, 04:08 PM
Set Set is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2003
Location: Oslo, Norway
Posts: 11 Set User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Hi Daniel!

I fail to see what is difficult about this. Of course you know that a many-many relationship means a new table, so in reality you have seven tables: Students, staff, assignments, courses, studentcourses, staffcourses and progress (which you could also think of as a many-many relationship between students and assignments - or will "progress" contain several records for each student for each assignment?)

I've been so lucky that I've never had to work with MS SQL, but here is how I would have joined your tables to answer your specific questions in Firebird:

Quote:
display new assignments for students (if any) that staff submit


Assuming 'new assignments' to be assignments dated within the last week, the SQL could be as follows:

SELECT whatever
FROM STUDENTS S
JOIN STUDENTCOURSES SC ON S.ID = SC.STUDENTSID
JOIN PROGRESS P ON P.COURSEID = SC.COURSEID
JOIN ASSIGNMENTS A ON A.ID = P.ASSIGNMENTSID
WHERE A.ASSIGNMENTSDATE >= CURRENT_DATE - 7

then you could add whatever you want to the where clause, e.g. if you only want information for a particular student. One thing that your model lacks, is if you want to link assignments to a particular lecturer. If you only want one lecturer as responsible for an assignment, you can of course add this to the assignments table, or if you want all that is involved in teaching the course to be responsible, you could just leave your model as is. However, if you want one or more specific lecturers to be responsible, you would have to add yet another table ASSIGNMENTSTAFF.

Quote:
find out which course the student is studying, so we can direct the student to appropriate information


This one is even simpler, just do

SELECT whatever
FROM STUDENTS S
JOIN STUDENTCOURSES SC ON S.ID = SC.STUDENTSID
JOIN COURSES C ON C.ID = CS.COURSEID
WHERE S.STUDENTNAME = :NAME

Quote:
display student names for a staff member for individual courses that that they study on, as well as all courses


Here, the main problem is to understand what you're after. I'll interpret this as one lecturer wondering who will attend his courses.

SELECT C.COURSENAME, S.STUDENTNAME
FROM STUDENTS S
JOIN STUDENTCOURSES SC ON SC.ID = S.STUDENTSID
JOIN STAFFCOURSES SFC ON SFC.COURSEID = SC.COURSEID
JOIN COURSES C ON C.ID = SC.COURSEID
JOIN STAFF SF ON SF.ID = SFC.STAFFID
WHERE SF.NAME = :STAFFNAME
ORDER BY C.COURSENAME, S.STUDENTNAME

Did I understand your questions correctly, or did I just add to your confusion?

Set

Reply With Quote
  #3  
Old June 3rd, 2003, 04:15 PM
Set Set is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2003
Location: Oslo, Norway
Posts: 11 Set User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
In my first SQL part, I messed it up. Here's how I meant it to be:

SELECT whatever
FROM STUDENTS S
JOIN STUDENTCOURSES SC ON S.ID = SC.STUDENTSID
JOIN COURSE C ON C.ID = SC.COURSEID
JOIN ASSIGNMENTS A ON A.COURSEID = C.ID
WHERE A.ASSIGNMENTSDATE >= CURRENT_DATE - 7

Reply With Quote
  #4  
Old June 3rd, 2003, 04:32 PM
nooch nooch is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Location: Wakefield UK
Posts: 7 nooch User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Right i think i see where you are coming from. In my first design i had it so that:

Staff---TeachesOn---Courses
Students---StudysOn---Courses

(Staff and Students)---Progress=---Assignments

...progress would contain StaffID and StudentID to link staff to a particular Assignment, and therefore a student who is undertaking this assignment.

So do i have the same idea as yours here? If so i think that would work, it just all seems so complicated to me.

It's part of an assignment at college believe it or not, to create a database structure and then a VB and ASP front end. Got a trial copy of MS SQL to make it easier, seen as tho i'm using VB and ASP. Plus the VB front end will be used on a PC that i can't install a new ODBC to, so that's why i chose MS SQL over MySQL or another.

I think i understand now. Would it be easier to execute the SQL in VB/ASP or would it make more sense to create views and extract values from there into VB/ASP?

Reply With Quote
  #5  
Old June 3rd, 2003, 04:33 PM
nooch nooch is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Location: Wakefield UK
Posts: 7 nooch User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
missed a bit. Must explain that in my design i had Assignments linked to courses through the tables 'TeachesOn' and 'StudysOn'

Reply With Quote
  #6  
Old June 3rd, 2003, 04:41 PM
nooch nooch is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Location: Wakefield UK
Posts: 7 nooch User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
thought i would also attach this rather messy relationship diagram. This is my initial design, but i wasn't sure about it. Are there any recommendations anyone could make for it?

-- note this jpg is around 97k
Attached Images
File Type: jpg relationship.jpg (97.9 KB, 213 views)

Reply With Quote
  #7  
Old June 4th, 2003, 08:54 AM
Set Set is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2003
Location: Oslo, Norway
Posts: 11 Set User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I thought each assignment would be part of a course and that you simply had a courseid field in your assignments table.

As for the progress table, I can understand that it is a many to many relationship between assignments and students, but I don't understand why you want to add staff into the equation. Surely, it is the progress of the student you are interested in, not the progress of the staff in creating the assignment?

Sounds like a fair college assignment. When I studied at UMIST (Manchester) donkeysyears ago, we had a group project where we had to design and partially implement a flight information system covering everything from booking a flight to assigning seats on the plane.

I don't know anything about VB/ASP and cannot help you out on that bit. I don't see this as all that complicated, but in Firebird I guess I would have chosen between

-SQL directly on the tables
-stored procedures
-views

If it was something that seems error prone and that possibly have to be written several times, I guess a stored procedure would have been the best way to go. Using views may also hide some complexity, just make sure that it doesn't decrease performance too much.

Set

Reply With Quote
  #8  
Old June 4th, 2003, 06:28 PM
nooch nooch is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Location: Wakefield UK
Posts: 7 nooch User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Well the college assignment is my final big project to create a scenario and analyise the subject to develop a suitable solution. In this case i chose the college system, as the one at college is totally unorganised. Mind you, i don't think mine will be much better!

Well basically, the origional specification is to design a datastructure that will house information about the whole college. The staff table is needed, because the staff will create (and mark) the assignments, and therefore need input and output on the progress table.

Can you explain the confussion with the many to many errors? i created the relationship in Microsoft Access origionally, so it automatically created what it thought was best, what should it be?

thanks again,

Danny

Reply With Quote
  #9  
Old June 5th, 2003, 01:12 PM
Set Set is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2003
Location: Oslo, Norway
Posts: 11 Set User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Ah, I just discovered your attachment...

A bit confusing in that some places do say whether it is one or many, whereas it is left out elsewhere, but I guess this is just some additional things to complain about for us that try to avoid Microsoft except for Windows (I'm not yet on Linux).

The question is what the progress table really is. Let's see... Assignments is related to TeachesOn through M:1, hence each assignment is associated with one particular lecturer. Each assignment can have several progress records, but it is not evident whether this is one record for each student or if one student can have several records for each assignment. From the fields mentioned, I would say that progress probably only contains one record for each student per assignment, i.e. more of a StudentAssignmentsResult table than a Progress table (I assumed 'progress' would contain assessment or reports at various stages of the assignment)? And then the staff that grades the assignment may or may not be the same person as the one who made the assignment (if it is always the same person as wrote the assignment, then there is no need for StaffID in the progress table)? It makes sense! Though looking closer I do find a couple of things I do not understand:

1) I do not understand why you have CourseID in your 'progress' table. You already know that through your one-to-many relationships from Courses->TeachesOn->Assignments->Progress.

2) Is the relationship between StudysOn and Assignments really 1:M? Sorry, but I think it is M:M requiring another table... (or, probably preferrably, just drop this one link - it definitely does not make any sense to link StudysOn and TeachesOn to the same field).

3) I assume the relationship between StaffNames and Progress and between StudentDe and Progress to be 1:M. Basically, I expect the Progress table to be a M:M relationship between StudentsDe and Assignments with only the added fields as attributes.

Make sure you document those things that your model doesn't explicitly say. E.g. your model does not say that you can only have a record in 'progress' if you 'studyon' a 'course' for which the 'assignment' was made or whether a 'staff' person in 'progress' has to be associated with the 'course' the 'assignment' is part of.

I never intended to suggest you drop your staff table, just that with my erroneous impression of what 'progress' contained it seemed more sensible to have two tables - one for studentsprogress and one for staffprogress.

Assuming this will end up as a system which several people and machines will update simultaneously, I recommend you to stay away from desktop databases like Access or Paradox and rather go for some proper client/server-databases. I don't know MS SQL Server beyond having heard negative things about it, but it is at least a client/server database so it ought to manage. Alternatively, Firebird or PostgreSQL are good alternatives that are free (price have nothing to do with quality, Firebird is better than it's licensed alternative InterBase), and I think Oracle have some decent licensing options for studying (though Oracle does require quite a bit of database administration). Don't choose MySQL, it doesn't handle transactions properly.

Good luck in creating a great system for the college in Wakefield (or do you study somewhere else, I've never even heard of Wakefield before)!

Now I have to go and buy myself some groceries before the shop closes!

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesDatabase Management > Database Design


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five "checkpoints" for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway