Magtanong at makakuha ng eksaktong mga sagot sa IDNStudy.com. Makakuha ng impormasyon mula sa aming mga eksperto, na nagbibigay ng detalyadong sagot sa lahat ng iyong mga tanong.

what is employee number data type​

Sagot :

Answer:

Hi thank me later

Explanation:

There are several roles for a primary key. They provide indexing to an entity so that it can be searched easily. Also they ensure that the data is not duplicated.

Primary key should always be stable. In general, there can be use cases to update employee ID. So, it is ideal to have couple of keys.

First you can have a key called 'id' which can be int. Having a numeric id will also improve the efficiency of indexing.

Have a String / varchar data type column for empId. This can be extracted from various entity attributes like Dept Id, org id, first name etc. This gives you flexibility to update the empId in case of any requests.

Note: Make sure you are not exposing the id (the serial type primary key) through the APIs. This makes your data predictable if attacker gets access to your API.

Your business logic should use id for computations. The users should only refer to the empId for API calls.

For advanced usage - Replace serial type with a GUID value. The problem with serial type is that, you'll end up with similar sequences in all your tables. This can cause subtle bugs in your code.

For example, a small mistake in your code can end up deleting your records in other tables as there is always a chance for having data for a given id in the mistaken table.

Hope this helps!!