views:

78

answers:

4

I Can place data in single table ,other option is , i can use two table for the same information??? what is better using one table or two??? which will give me best performance???

table-tblschool name address Principal NAME PRINCIPAL MOBILE ADMIN NAME ADMIN MOBILE

Here in abhove table one school will have one admin and one principle ,so should i go for a different table or one table.

+1  A: 

Since this is a pretty vague question, there's only a vague answer at this point. Depends on. ;) No, I'd suggest that you get into a little reading about database normalization and see where this leads you to.

Start here: WikePedia on DB normalization

KB22
+7  A: 

I recommend looking at Database Normalization. It will give a little bit of perspective.

A very brief intro from wiki as follows (1NF-5NF):

  • First normal form (1NF) - Table faithfully represents a relation and has no repeating groups
  • Second normal form (2NF) - No non-prime attribute in the table is functionally dependent on a part (proper subset) of a candidate key
  • Third normal form (3NF) - Every non-prime attribute is non-transitively dependent on every key of the table
  • Fourth normal form (4NF) - Every non-trivial multivalued dependency in the table is a dependency on a superkey
  • Fifth normal form (5NF) - Every non-trivial join dependency in the table is implied by the superkeys of the table
Kyle Rozendo
+2  A: 

It's very much dependant on the data that you're putting in the table. If some of it can be repeated, then it's better to split that into a different table. Likewise if there are particular relationships.

I am, personally, of the opinion that zero-or-one relationships belong in seperate tables, also. But this isn't the case always, as some people don't mind nulls too much.

Jimmeh
+1  A: 

most of the times ,yes...depends upon requirement

hrishi