I have two table (one small, one huge) that use the same unique key, but not the same columns.
I need to bring two columns from the big table into the small table but only for the keys that exist in the small table.
When I query against it, I use an INNER JOIN
SELECT * FROM my_bigtable AS big
INNER JOIN my_smalltable AS small ON big.key = small.key;
Works great. But now I've added two columns (fname,lname) the small table. The big table has these columns, I want to pull the entries in these columns for reflected keys and put them in the columns of the small table.
INSERT INTO my_smalltable AS small
SELECT FNAME,LNAME FROM my_bigtable AS big
WHERE big.FNAME = small.FNAME
AND big.LNAME = small.LNAME;
Is this going to only bring the records for the Unique Keys that exist in the small table to the small table or will it bring EVERYTHING from the big table into the small table, regardless if the unique key exists in the small table?