generated from jackyzha0/quartz
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Affected files: content/.obsidian/plugins/recent-files-obsidian/data.json content/.obsidian/workspace.json content/postgresql/PostgreSQL Conflict.md content/postgresql/PostgreSQL Constraints.md content/postgresql/PostgreSQL Delete.md content/postgresql/PostgreSQL Insert and Import.md content/postgresql/PostgreSQL Sequence and UUID.md content/postgresql/PostgreSQL Update.md content/postgresql/PostgreSQL.md
- Loading branch information
Showing
9 changed files
with
96 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
draft: false | ||
date: 2024-05-18 17:48 | ||
tags: | ||
- postgres | ||
--- | ||
|
||
|
||
|
||
```sql | ||
ON CONFLICT (id) DO NOTHING; | ||
ON CONFLICT (id) DO UPDATE SET email = EXCLUDED.email; | ||
ON CONFLICT (id) DO UPDATE SET email = EXCLUDED.email, gender = EXCLUDED.gender; | ||
``` | ||
|
||
|
||
|
||
|
||
> [!info] References | ||
> - [Learn PostgreSQL Tutorial - Full Course for Beginners (youtube.com)](https://www.youtube.com/watch?v=qw--VYLpxG4) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,22 @@ | ||
--- | ||
draft: false | ||
date: 2024-05-16 18:17 | ||
date: 2024-05-18 17:47 | ||
tags: | ||
- postgres | ||
--- | ||
|
||
To delete all records in your table: | ||
|
||
```sql | ||
DELETE FROM person; | ||
``` | ||
|
||
To delete one or more records using conditions: | ||
|
||
```sql | ||
DELETE FROM person WHERE id = 1; | ||
``` | ||
|
||
|
||
|
||
|
||
> [!info] References | ||
> - [Learn PostgreSQL Tutorial - Full Course for Beginners (youtube.com)](https://www.youtube.com/watch?v=qw--VYLpxG4) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,15 @@ | ||
--- | ||
draft: false | ||
date: 2024-05-16 18:16 | ||
date: 2024-05-18 17:47 | ||
tags: | ||
- postgres | ||
--- | ||
|
||
To update a single record in the database, use the following SQL statement: | ||
|
||
```sql | ||
UPDATE person SET first_name = 'Omar', last_name = 'Montana' WHERE id = 2011; | ||
``` | ||
```sql | ||
ON CONFLICT (id) DO NOTHING; | ||
ON CONFLICT (id) DO UPDATE SET email = EXCLUDED.email; | ||
ON CONFLICT (id) DO UPDATE SET email = EXCLUDED.email, gender = EXCLUDED.gender; | ||
``` | ||
|
||
|
||
|
||
|
||
> [!info] References | ||
> - [Learn PostgreSQL Tutorial - Full Course for Beginners (youtube.com)](https://www.youtube.com/watch?v=qw--VYLpxG4) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters