شرح صفوف ومحتوى الفقرة
قبل تنفيذ أي عملية UPDATE أو DELETE على بيانات هامة، طبّق دائماً قاعدة الفحص المسبق بأمر SELECT: اكتب أولاً استعلام SELECT بنفس شرط WHERE للتحقق بصرياً من السجل المستهدف، ثم حوّل الأمر إلى UPDATE أو DELETE بعد التأكد التام:
SQL
-- Step 1: Preview the exact target row with SELECT
SELECT product_id, sku_code, title, unit_price
FROM products
WHERE product_id = 109;
-- Step 2: Execute the targeted DELETE with the verified key
DELETE FROM products
WHERE product_id = 109;