diff options
| author | Kitzunu <24550914+Kitzunu@users.noreply.github.com> | 2020-05-13 19:39:13 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-05-13 19:39:13 +0200 |
| commit | 7048c66f61258b0110158bc8868a8e198f1a2a7c (patch) | |
| tree | d9001eb6a4283779283d56b72371a3076e8ee65f /docs/Dealing-with-SQL-files.md | |
| parent | 3eb6b77e754033d609e4819cda549d3927b9d1c9 (diff) | |
| download | wiki-7048c66f61258b0110158bc8868a8e198f1a2a7c.tar.gz wiki-7048c66f61258b0110158bc8868a8e198f1a2a7c.tar.bz2 wiki-7048c66f61258b0110158bc8868a8e198f1a2a7c.zip | |
fix(SQL): Update files concerning SQL (#224)
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. |
