I'm developing a system that make use of national ID one of "identifying record" is it a good idea to embed nat_id in all the tables to make query easier? What are the downsides of doing so? I just want to get opinions from people here in SO because I might miss something important.
Using National ID as Primary Key
649 Views Asked by Random Joe AtThere are 2 best solutions below
nvogel
On
Whether national ID would make a good key or not depends largely on your requirements. Is it a requirement to record national ID as part of the business process and that users/employees/whoever are uniquely identified in that way? Are you legally entitled to ask people for that information? Are they obliged to disclose their national ID to you? If yes to all these then it probably makes good sense for you to make it a key in the database.
Make sure you understand any standards for the national IDs that you'll need to support. E.g. length, data type, any check digits and whether there are legacy codes or other special purpose codes in use that may not match the expected rules.
If there are privacy concerns and you don't need to retrieve the actual ID from the database then you could store a secure hash of the national ID instead.
Related Questions in POSTGRESQL
- Why does adding a JOIN completely modify the query planner behaviour?
- When dealing with databases, does adding a different table when we can use a simple hash a good thing?
- Aggregate and count in PostgreSQL
- Rails HABTM: Select everything a that a record 'has'
- Trigger using data from inserted row
- Select results where joined table contains records with an attribute, but without another
- DB candidate as CouchDB/Schema replacement
- How do I properly add data in SQLAlchemy?
- Postgres in Conda Environment (Ubuntu 14.04)
- How to customize the output of the Postgres Pseudo Encrypt function?
- Split a large query (2 days) into pieces to increase the speed in Postgres
- Why does pg_search prefix not work like I expect?
- extracting meta info from a table psql using information_schema
- How to query a table in the database and copy it's data into one one?
- Update a table using info from a second table and a condition from a third table in Postgresql
Related Questions in DATABASE-DESIGN
- Big data with spatial queries/indexing
- Unique hash/index for time interval
- Best practices for creating a huge SQL table
- Database Design: How should I store user's news preferences in MySQL database?
- Is it recommended to use Node.js for an online room booking web application?
- Storing multiple item settings in database
- Which column type for storing the year field in a table with rows of yearly data
- Best way to setup a i8n in a database
- Database normalization for electricity monitoring system
- Database Design: Unique Billing Assocation
- Is it always a bad practice to have circular relationships in your database design
- One column maps to mutiple columns from different table
- Replicating tables within the database
- mysql one translates table vs multiple translate table
- Nosql database design for complex querying
Related Questions in PRIMARY-KEY
- How to get primary key value with Entity Framework Core
- Showing MYSQL table columns with key types and reference
- MySQL: Using natural primary index or adding surrogate when tables are given
- Is it necessary to use an integer ID for the Country table when the name is already univocal?
- Entity Framework Code First from database not adding Key attribute
- Adding primary key to some exising tables in a database
- Finding primary key given relation and functional dependencies
- How to set "auto insert" foreign key value by using SQL Server?
- Python Pandas to_sql, how to create a table with a primary key?
- How to add a (primary) key to an existing table using SAP HANA
- creating a unique column in Linux (more like an sql primary key?)
- MySQL: is primary key unique by default?
- Is it possible to set an EF6 model's primary key value?
- php to return id using Scope_identity
- Include foreign key in composite primary key in Code-First Entity Framework
Related Questions in RDBMS
- Hierarchical RDBMS Query spanning across multiple tables with in clause
- Why I can't perform this simple insert operation? How can I solve this date format issue?
- How to import only new data by using Sqoop?
- Making relational algebra equations in a sample database
- adding a where condition for one criteria in sql query
- What happens to sql views, if database is moved to another server
- Why I can't perform this insert query if a specific field value is set to null?
- Star schema role in the Pentaho Mondrian OLAP server
- Can Rails deal with DB uniqueness without index?
- Max. number of subqueries with WHERE clause in MySQL
- How to maintain author order in database of citations
- What is the difference between a Technical key and a Surrogate key?
- Why django group by wrong field? annotate()
- mysql: Get combination of data from multiple table by passing multiple value
- How to organize data in document based stores?
Related Questions in NATURAL-KEY
- MySQL: Using natural primary index or adding surrogate when tables are given
- Why doesn't @NaturalId create a unique constraint in the database?
- Email address as resource identifier in a REST API
- Phalcon PHP: Update a primary natural key
- What are some good candidate keys for ‘person’?
- Django fixtures primary key error, need natural keys solution
- Must Django ManyToManyField association tables have a surrogate key?
- Filtering by natural key?
- Get_by_natural_key throwing AttributeError?
- Relational database design question - Surrogate-key or Natural-key?
- Hibernate: bug when mapping a reference to an alternative/natural key column of a sub table?
- Why would one consider using Surrogate keys vs Natural with ON UPDATE CASCADE?
- Unique identifiers for users
- Django deserialization of a natural key that contains another natural key
- @NaturalId only valid on root entity (or its @MappedSuperclasses), using Natural Id in Joined, Multiple Table Inheritance
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
As suggested by @Oded, there may be legal and privacy implications (that very much depends on your country).
One example of a privacy issue is that in some countries the person's date of birth -- and in some countries their gender -- is part of their national ID number. Replicating that into every table in your schema might not be a great idea, since it will make it hard to restrict access to this information.
On top of that, there are several purely technical concerns:
I would use a surrogate primary key, and would store the national ID as an attribute.