Home > database >  Database table, on A field A set A code, why set A key?
Database table, on A field A set A code, why set A key?

Time:10-04

At the same time there is A key and A code won't waste of space?

CodePudding user response:

Didn't understand the building in expressing what mean;

Might as well put your build table statements posted;

CodePudding user response:

The create table student_information
(
Student_key number,
Student_code number,
.
)

At the work table, it is necessary for something at the same time set up relevant KEY and CODE two fields?

CodePudding user response:

reference 1st floor wmxcn2000 response:
didn't understand what the original poster in expressing meaning;

Might as well put your build table statements posted;

The create table student_information
(
Student_key number,
Student_code number,
.
)

At the work table, it is necessary for something at the same time set up relevant KEY and CODE two fields?

CodePudding user response:

This is necessary;

For example:
Student_key this field, have nothing to do with the business, can be a on the column, usually set the primary key;
Student_code is student id, this is related to the business; Is generated according to certain rules, can be set to a unique index;

In normal times when communicating with people, often hear people say to "primary key is best not to use the business data" in this way, say is this meaning.

PS: in fact, in the actual do data design, use only one code is also a lot;

CodePudding user response:

There are a lot of dictionary tables are designed so that, for other tables can be better used, address space, etc.
Such as gender, process state, etc

CodePudding user response:

After you met, you will know the building Lord, if it is only a single classification does not necessary, if there are multiple classification is needed

CodePudding user response:

Code corresponding to a list
Key corresponding to another table, maybe things are different,
  • Related