I am trying to understand the schema and when entries are made in certain tables. Two tables in particular are interesting - tests and test_changes. It seems that tests.id and test_changes.test_id hold similar data - the test ID of the execution. Yet, I am not able to reconcile the numbers.
Here are the queries I am using:
select count(*) from tests; # 2425683 select count(*) from test_changes; # 21298 select count(*) from tests inner join test_changes on tests.id = test_changes.test_id; # 21298 # so all test IDs from test_changes are present in tests select count(*) from tests where id not in (select test_id from test_changes); # 2410918
I understand test_changes has the entries for comments as well but the rows for common test_id values is confusing me. How are these 2 tables related to each other? When does an entry make its way into either or both tables? When an entry is deleted from one, is it also deleted from the other?
Appreciate any help.