Im going to create database.there are few table in that db.
I need to know what is the best ;
add more column to table or use separate table rather than add more column

Recommended Answers

All 5 Replies

Hi Sadun89,

This all depends on what you're trying to do with your database. Depending on the information provided in the tables, you can choose whether or not to add a table or a column. If you provide more info, we should be able to help you better.

Thanks seslie...
Actually i need just simple answer..
Thinks like that...If we need to record more data into table what you going to do??
put all record into same(related) group.. or divied its into groups(tables) as much as posible.?

What is your way..?

Hey Sadun89,

you're welcome. Let me use this example. I want to create a student result management system. I have a student table, which contains columns like;
Student_Id(PK), Registration_No, First Name, Last Name and Age.

I have another table called student_subjects, where i have ;
Subject_Id(PK), Name, Teacher

I have yet another table for student_results, where I have;
result_Id(PK), Student_Id(FK), Subject_Id(FK)

It wouldnt be good design to have this all muddled up into one table. So dividing it into tables serves us better.

So, what if you have to choose whether a subject is active or not for a term/semester? You could decide to have another table that has ;
SubjectStatus_Id(PK), Subject_Id(FK), Status (Bad Practice)

Or you could simply just add another column to the student_subjects table
Subject_Id(PK), Name, Teacher, **Status **

Try to read up on "Normalization" for more information

I hope i helped out a bit.

Thanks seslie,
I'm very sorry for delay replay, but anyway this asnwer help me to understand about my situation
lol ;-)

While most database designs benefit from normalization, there are some scenarios where you would not want or need to split your fields across multiple tables. More information would be needed to provide more feedback.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.