Reputation: 892
I am currently doing a SQL assignment but a certain task has mentioned that we need to implement validation and verification for our tables in the database which we created.
However we did not learn anything about this topic and after googling for hours I only found the check constraints which you can give in the create table statement.
Please mention some of the TECHNIQUES of validation and verification for a SQL table or database.
Upvotes: 4
Views: 10802
Reputation: 613
You need to differentiate validation
and verification
. Suppose we follow the concepts in Formal Verification.
Validation: "Are we trying to make the right thing?", i.e., is the product specified to the user's actual needs
Verification: "Have we made what we were trying to make?", i.e., does the product conform to the specifications?
First, we need definitions of both under your specific scenario. For example, we have a table schema which saves the employee information in a company:
Employee
ID | Name | Age | Salary
Say, every employee has a unique ID (which could never be zero). Then we could define a row with ID=0
is an invalid record. (to the user's needs)
After we insert all records to the table, we shouldn't have any rows with ID=0
. We could verify with a query SELECT * from Employee WHERE ID=0
, which should have no rows returned. (did we make it?)
Upvotes: 1
Reputation: 12704
Usually you validate by running some sort of test on the data.
There are different layers through which data passes and there are different types of tests.
If you consider the following system layers:
You can do data validation at any of these layers, with following differences
You can consider following to be validation tests (validation types):
Upvotes: 10
Reputation: 84
You need to make sure that the schema you created which was based on the specifications from the teacher, actually does the job. Validation is the process whereby you test something using another means. So...write a small validation program that try to insert bad data. Make a few test cases. Once your schema design has passed the validation it can be said to be verified or validated.
Upvotes: 2