I new to SQL but I have been practicing JOIN a bit. I want to check if all the records from another table(small_table
) has been included in my current table(base_table
).
For example:
SELECT * FROM base_table WHERE year = 2015 AND month = 3 AND day = 4
will return to me a set of records based on todays date. small_table
is the same structure. I want to return the count of a INNER JOIN
(compared on all columns) and see if it equals the number of records in small_table
. This will prove that every row/record from small_table
is included in base_table
based on todays date.
I don't need to use JOIN
but it is simply the first method I thought of. I am open to other methods. I am having trouble creating this query.
A = SELECT * FROM small_table;
B = SELECT * FROM base_table WHERE year = 2015 AND month = 3 AND day = 4;
SELECT COUNT(*) FROM A INNER JOIN B;