•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the Database Design section within the Web Development category of DaniWeb, a massive community of 456,479 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,756 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Database Design advertiser: Programming Forums
Views: 1616 | Replies: 2 | Solved
•
•
Join Date: May 2007
Posts: 2
Reputation:
Rep Power: 0
Solved Threads: 0
I was wondering if anyone could offer a solution to this database design problem. I have very little experience with relational databases in Access. I have only used databases just to get easy data, but now it is starting to get complicated. I read a little on relational database design, but I keep coming into roadblocks with this one. In Access, you can only assign 1 primary key, so I assign this key to the autonumber column because in my other tables it is impossible for me to not have duplicate values.
See, the app I am creating is an online grade book for teachers. Each teacher has several classes, each class has a number of students, each student has a number of assignments, each assignment has a category (homework, classwork, tests, etc.), each assignment has a grade.
This app allows teachers to create a class. The program generates a unique class ID. Then the teacher enters each student one at a time, and the program generates a unique student ID. All four pieces of data are entered into the database.
What I have done is created the following tables. Following the table is the columns, and a small snippet of how it is set up as an example.
Table 1 (Roster): ID--TeacherID--ClassID---StudentID
1 123 234 567
2 123 234 678
3 123 234 789
4 123 235 987
5 123 235 876
6 124 236 567
7 124 236 678
8 124 237 789
9 124 237 987
Notice how each teacher 123, 124 may have the same students but in different classes.
Table 2 (Scores): ID--StudentID--AssignmentID--Score
1 567 000 89
2 678 000 98
3 789 000 90
4 567 001 90
5 678 001 78
6 789 001 85
This table records the student's grade to a particular assignmentID. Not having duplicate values is also not possible, that is why I have the ID column. This table is probably the largest because it records every students scores for each assignment they have done.
Table 3 (Weight): ID--ClassID--CategoryID--Assignment--AssignmentID
1 234 Homework p. 64 000
2 234 Classwork p. 78 001
3 235 Homework p. 34 003
4 235 Homework p. 64 078
5 236 Test Spelling 089
6 237 Classwork p. 120 034
7 237 Test Vocab 064
This table records the assignments teachers give their students, the category, and the classID associated with the assignment. Each assignment is given a unique ID because teachers might give an assignment the same name. So in this table ID and AssignmentID are unique.
The problem I am having is how to write a particular SQL command.
With the tables above, how can I get all the grades for each student in a particular class. I will place this data in a datatable and store it in a dataset and it will be displayed as follows:
Class 234
StudentID "p. 64" "p.78"
567 89 90
678 98 78
789 90 85
Basically, how do I join these tables efficiently, and did I design this database correctly? Any other suggestions on how to solve this problem will be greatly appreciated.
See, the app I am creating is an online grade book for teachers. Each teacher has several classes, each class has a number of students, each student has a number of assignments, each assignment has a category (homework, classwork, tests, etc.), each assignment has a grade.
This app allows teachers to create a class. The program generates a unique class ID. Then the teacher enters each student one at a time, and the program generates a unique student ID. All four pieces of data are entered into the database.
What I have done is created the following tables. Following the table is the columns, and a small snippet of how it is set up as an example.
Table 1 (Roster): ID--TeacherID--ClassID---StudentID
1 123 234 567
2 123 234 678
3 123 234 789
4 123 235 987
5 123 235 876
6 124 236 567
7 124 236 678
8 124 237 789
9 124 237 987
Notice how each teacher 123, 124 may have the same students but in different classes.
Table 2 (Scores): ID--StudentID--AssignmentID--Score
1 567 000 89
2 678 000 98
3 789 000 90
4 567 001 90
5 678 001 78
6 789 001 85
This table records the student's grade to a particular assignmentID. Not having duplicate values is also not possible, that is why I have the ID column. This table is probably the largest because it records every students scores for each assignment they have done.
Table 3 (Weight): ID--ClassID--CategoryID--Assignment--AssignmentID
1 234 Homework p. 64 000
2 234 Classwork p. 78 001
3 235 Homework p. 34 003
4 235 Homework p. 64 078
5 236 Test Spelling 089
6 237 Classwork p. 120 034
7 237 Test Vocab 064
This table records the assignments teachers give their students, the category, and the classID associated with the assignment. Each assignment is given a unique ID because teachers might give an assignment the same name. So in this table ID and AssignmentID are unique.
The problem I am having is how to write a particular SQL command.
With the tables above, how can I get all the grades for each student in a particular class. I will place this data in a datatable and store it in a dataset and it will be displayed as follows:
Class 234
StudentID "p. 64" "p.78"
567 89 90
678 98 78
789 90 85
Basically, how do I join these tables efficiently, and did I design this database correctly? Any other suggestions on how to solve this problem will be greatly appreciated.
Last edited by Juwar : May 31st, 2007 at 10:48 pm. Reason: formatting issues
•
•
•
•
•
•
•
•
DaniWeb Database Design Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- Help on General Best Practices for Table/Database Design (Database Design)
- frustrated newbie needs help (C++)
- Unified Modelling Language or Data Flow Diagram (Legacy and Other Languages)
- Best Offer For Web Design and Development (Post your Resume)
- How do you integrate a database w/web design? best solution for online catalogue? (Database Design)
- Program design tools (C++)
Other Threads in the Database Design Forum
- Previous Thread: 2NF and Multi-candidate Keys
- Next Thread: Database design regarding two 'linking' tables



Threaded Mode