diff options
Diffstat (limited to 'docs/Dealing-with-SQL-files.md')
| -rw-r--r-- | docs/Dealing-with-SQL-files.md | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/docs/Dealing-with-SQL-files.md b/docs/Dealing-with-SQL-files.md index 69a97f2..ded1f9d 100644 --- a/docs/Dealing-with-SQL-files.md +++ b/docs/Dealing-with-SQL-files.md @@ -42,6 +42,22 @@ INSERT INTO `table_1` VALUES (3000, ...); ``` +### DELETE + +Bad: + +```sql +DELETE FROM `table_1` WHERE `entry` = 1000; +DELETE FROM `table_1` WHERE `entry` = 2000; +DELETE FROM `table_1` WHERE `entry` = 3000; +``` + +Good: + +```sql +DELETE FROM `table_1` WHERE `entry` IN (1000, 2000, 3000); +``` + ### UPDATE Bad: @@ -58,7 +74,7 @@ Good: UPDATE `table_1` SET `field_1` = 'someValue' WHERE `entry` IN (1000, 2000, 3000); ``` -#### Flags +### Flags For flags (2^) columns, when you remove or add a flag, it is better not to override the existing value as flags are combined values. @@ -77,22 +93,6 @@ UPDATE `table_1` SET `field_1` = `field_1` ^ 128 WHERE `entry` = 1000; This way, you will make sure that your query will only affect that specific flag, leaving all the other flags unchanged. -### DELETE - -Bad: - -```sql -DELETE FROM `table_1` WHERE `entry` = 1000; -DELETE FROM `table_1` WHERE `entry` = 2000; -DELETE FROM `table_1` WHERE `entry` = 3000; -``` - -Good: - -```sql -DELETE FROM `table_1` WHERE `entry` IN (1000, 2000, 3000); -``` - ## How to create an sql update file This kind of procedure is pretty simple and allow not only developers, but also testers, to avoid multiple import of the same queries. |
