From b9c48af6faca1d21b142235de48a4d7ef5a321fb Mon Sep 17 00:00:00 2001 From: Gultask <100873791+Gultask@users.noreply.github.com> Date: Thu, 5 Jan 2023 16:11:15 -0300 Subject: Adds details for better DELETE queries in sql-standards.md (#850) * Add specification to DELETE queries * Update sql-standards.md * Update sql-standards.md * Update sql-standards.md * Update sql-standards.md --- docs/sql-standards.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'docs') diff --git a/docs/sql-standards.md b/docs/sql-standards.md index 42e24a2..b97c76b 100644 --- a/docs/sql-standards.md +++ b/docs/sql-standards.md @@ -32,6 +32,21 @@ DELETE FROM `creature_loot_template` WHERE `entry` = 3 AND `item` = 884; INSERT INTO `creature_loot_template` (`Entry`, `Item`, `Reference`, `Chance`, `QuestRequired`, `LootMode`, `GroupId`, `MinCount`, `MaxCount`, `Comment`) VALUES (3, 884, 0, 40, 1, 1, 0, 1, 1, 'Comment'); ``` +--- + +When performing DELETE queries, always specify more than one field. In particular, specify at least one primary key present in the table and another accompanying field. + +Wrong: + +```sql +DELETE FROM `creature_loot_template` WHERE `item` = 884; +``` + +Correct: + +```sql +DELETE FROM `creature_loot_template` WHERE `entry` = 3 AND `item` = 884; +``` ### UPDATE -- cgit