I'm trying to delete data from a table in MySQL, but before I execute the command I want to make sure that I am doing it right. I'm looking to delete all rows with a storeID > 5000000 and cannot match to any item in the deals table. Below is my query:
DELETE FROM stores s
LEFT JOIN deals sd
ON s.storeID = sd.store_ID
WHERE storeID > 5000000
AND sd.dealID IS NULL;
Will the above query only delete the rows in the stores table and not affect the deals table?