Testing and Evaluation
Course Content Specification
Describe and exemplify testing:
SQL operations work correctly at this level
Evaluate solution at this level in terms of:
fitness for purpose
accuracy of output
Testing
Just like in Software Development it is important to test the results of your queries. Just because you get some output does not mean you should accept it as correct. Likewise sometimes a query may generate 0 rows as a result.
Looking at the Source Data
If you go into the Browse tab in phpMyAdmin for a table you can look at the source data. That will allow you to look at the data that is in the table. You can then manually calculate your results.
The Browse tab allows us to see the amount of records and all of the source data in the table. Based on the data above if we searched for the amount of different Hard Drives we stock we would expect 3 results.
Filtering records in a Table
It is possible for you to apply a temporary filter to a database table in phpMyAdmin to only view records relevant to ones you are concerned with. The screenshots below show the results before and after a filter is applied.
Other Tests
You can always test your database by:
Attempting to enter duplicate data for primary keys as entity integrity should ensure that each primary key is unique.
Entering data for foreign keys that don't exist, which would break referential integrity, as every foreign key value has to exist in the other table.
Testing validation using a wide range of test data.
Evaluation
Once you have tested your query just as in Software Development it is important that you evaluate whether you have met all of the requirements. So for example if you were meant to produce:
But produced:
Then you will not have met the requirements as you have not used an ALIAS to format the result appropriately.