• 0

Database design.


Question

My question is about database design.

Most of the times we need to create a table that contains a field that would hold only numbers as its contents, like employeeID, studentRollno, etc. what would be the ideal choice of the datatype ... should it be a integer or a text type.

Some say that we shouldnt use numeric types for fields that wont be needed in calculations like the one i mentioned above.

Any reasons for selecting such fields as numeric or non-numeric

Moreover what if these fields are meant to be used as primarykey or foriegn keys.

Thanx

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

If you mean only for an id (primary key)... then it makes no difference. I suppose that integers would be better cos the machine is quicker with numbers.... but it also depends on which database implementation you are using.

Peeeeeeeeeeeez

Link to comment
Share on other sites

  • 0

Use numbers as much as possible. The db engine is way slower on text fields when matching/searching, also text fields dont allow maths operations on it.

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.