Home     All Posts     Feed     Contact Search

Marketplace

Teacher Of The Year 2008

Posted on April 12, 2010.
Teacher Of The Year 2008Database second opinion needed!?

I am in the midst of creating a database that will be held simultaneously at a site that I build for a primary school. I'm not too good with relationships and database design that I have not had much practice in the past. If someone is particularly good with this, I would be grateful if you could read the following explanation of what I need to do, and give me some advice on what could be changed, etc. Thank you!

Tables
--------------
Mysql> create table year_group (
-> Int not null auto_increment primary key year_group_ID,
- Varchar year_group_name> (7))

Mysql> create table class (
-> Int id not null auto_increment primary key,
- Class_name varchar> (4)
-> Year_group int
-> Foreign key (year_group) references year_group (year_group_ID));

Mysql> create table teacher (
-> Int id not null auto_increment primary key,
- Prefix varchar> (4)
- Name varchar> (15)
- Name varchar> (15)
- Username varchar> (20) NOT NULL,
- Email_address varchar> (20)
-> Class_ID int
-> Year_group int
-> Foreign key (class_ID) references class (id)
-> Foreign key (year_group) references year_group (year_group_ID));

Mysql> create table student (
-> Int id not null auto_increment primary key,
- Name varchar> (15)
- Name varchar> (15)
- Username varchar> (20) NOT NULL,
-> Int parent_id,
-> Class_ID int
-> Teacher_ID int
-> Year_group int
-> Foreign key (parent_id) references parent (id)
-> Foreign key (class_ID) references class (id)
-> Foreign key (teacher_ID) teacher references (id)
-> Foreign key (year_group) references year_group (year_group_ID));

Mysql> create table parent (
-> Int not null auto_increment parent_id primary key,
- Name varchar> (15)
- Name varchar> (15)
-> Contact_no varchar (11)
- Username varchar> (20) NOT NULL,
-> Foreign key (parent_id) references student (id));

I tried my best to standardization, but I'ma little confused, I noticed when selecting all of the age table, there are many values in year_group_name that most of the class 1 belongs to the group a year?

Can we see any major problems with what I did?

Cheers!

Ps I also need to create a table to store the information about user login user name, password, privileges? Is that correct?

When I design databases, I always try to ask questions of the form "X can have more than one Y" and then you see how the database handles that. For example, a parent can have more than one student. Yes, and you can plan handles fine since parent is in a separate table may be linked to several students.

How about a student can have more than one class per year_group. Since you are talking about a primary school that is not absolutely necessary, but if it was you have a problem. Your students have a direct link
table class using class_ID so that each student can have only one class. If you need to solve this problem you must create an additional table which links students in classrooms

You can also delete class_ID the teacher and put a teacher_ID in class because it is a more logical structure. I would also remove the student from teacher_ID you get teacher_ID class, the student is in. If you leave teacher_ID students and the teacher for a class of changes you need to upgrade in classes and all students.

Yes, you would probably want to have a connection table too. If everyone.

Share |

Comments

There are no comments.

Leave a Comment

Your Name
Your Email
Comments
Human Check. Type 7026.

Popular
Pencil Grippers
Notebook Service Manual
Notebook Optical Mouse
Learn Pencil Sketching
Special Education Teacher Job Description
School Half Term
Pencil Sketches Of People
Drawing Super Heroes

Network
Brawlers.org
Druggy.net
astronautic.org
Schtick Spot
Hemp Camp
Fitness Clothing
Casual Clothing
Clothing Scene
Formal Clothes
Ready Clothes
Jewelry Corporation
Feet Backs