It is possible to set restrictions on the database side.
For example, foreign key constraints, string length constraints, type constraints, and so on.
So I have a question.
Do you think it makes sense for the program to set the same restrictions again?
For example, in a function that saves in a column with a foreign key constraint, the program (non-database) side confirms "whether a" value "exists in the externally referenced table" and provides an if branch. Etc.
Is it unnecessary because the processing will increase?
If i think you need it, please tell us about the scenarios and benefits you will need.
Answer # 1
If you think you need it, please tell us about the scenarios and benefits you will need.
You can leave the integrity process to the database side, but the error returned when it failsDatabase errorIf you try to detect "which value is exceeded", handling is troublesome.
If only the API is provided, it is possible to divide it as "the responsibility for not throwing out-of-range values lies with the API caller", but in the case of a Web system that draws the input form by itself, an error will occur in the input form. In order to correctly understand "where failed" when redrawing, it is better to check the consistency before throwing it to the DB.
Answer # 2
DB foreign key constraints have a strong meaning of master management by normalization.
For the purpose of validation, I think it makes sense to apply appropriate processing on the program side.
Answer # 3
hola soy PERU, estoy de acuerdo.
- mysql - about database design
- mysql - about the database
- mysql - about database structure and how to hold data
- about database design
- django - about database design
- mysql - question about how to count sql
- about the implementation of php pagination
- c # - about the implementation of shotguns
- mysql - about docker error
- mysql - database settings are required for building sns sites! ??
- mysql - about the setting to connect to the db in docker from the sql client
- mysql - please tell me an example of db design with transition status
- mysql - does this mean that the information cannot be registered in the database?
- php - please tell me about freeing mysql memory
- about errors when connecting to mysql (codeigniter, xdebug, mysql)
- mysql + sqlalchemy, about relations
- i want to register the id in the database with 0 padding using mysql
- mysql - about data extraction method
- mysql - "database seeding completed successfully" is displayed using seeder, but it is not inserted in the db
- php : How to organize relations between tables and data storage in this case?
- mysql : SQL Take the value of one column if the second is empty
- mysql : Sorting table by date from the SQL connected table
- mysql : How to get recordings from the adjacent table Laravel in one request
- Add Outback Right MySQL
- mysql : Assigning multiple values to one table field
- php : Finding similar string
- mysql : SQL trigger should check whether there is a table
- Deleting records in MySQL by number of records
- mysql : Time