From a299cbc9b312faf4c15efb60345b72d12ba2999c Mon Sep 17 00:00:00 2001 From: Afan Shaikh Date: Sun, 10 Nov 2024 21:25:06 +0530 Subject: [PATCH] Fixed Deletion of records in SQL S3.4 --- .../Practical Exam/SQL/.obsidian/app.json | 1 + .../SQL/.obsidian/appearance.json | 1 + .../SQL/.obsidian/core-plugins.json | 30 ++++ .../SQL/.obsidian/workspace.json | 167 ++++++++++++++++++ .../Practical Exam/SQL/S3 - SQL Queries.md | 10 ++ 5 files changed, 209 insertions(+) create mode 100644 Practical/Practical Exam/SQL/.obsidian/app.json create mode 100644 Practical/Practical Exam/SQL/.obsidian/appearance.json create mode 100644 Practical/Practical Exam/SQL/.obsidian/core-plugins.json create mode 100644 Practical/Practical Exam/SQL/.obsidian/workspace.json diff --git a/Practical/Practical Exam/SQL/.obsidian/app.json b/Practical/Practical Exam/SQL/.obsidian/app.json new file mode 100644 index 0000000..9e26dfe --- /dev/null +++ b/Practical/Practical Exam/SQL/.obsidian/app.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/Practical/Practical Exam/SQL/.obsidian/appearance.json b/Practical/Practical Exam/SQL/.obsidian/appearance.json new file mode 100644 index 0000000..9e26dfe --- /dev/null +++ b/Practical/Practical Exam/SQL/.obsidian/appearance.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/Practical/Practical Exam/SQL/.obsidian/core-plugins.json b/Practical/Practical Exam/SQL/.obsidian/core-plugins.json new file mode 100644 index 0000000..436f43c --- /dev/null +++ b/Practical/Practical Exam/SQL/.obsidian/core-plugins.json @@ -0,0 +1,30 @@ +{ + "file-explorer": true, + "global-search": true, + "switcher": true, + "graph": true, + "backlink": true, + "canvas": true, + "outgoing-link": true, + "tag-pane": true, + "properties": false, + "page-preview": true, + "daily-notes": true, + "templates": true, + "note-composer": true, + "command-palette": true, + "slash-command": false, + "editor-status": true, + "bookmarks": true, + "markdown-importer": false, + "zk-prefixer": false, + "random-note": false, + "outline": true, + "word-count": true, + "slides": false, + "audio-recorder": false, + "workspaces": false, + "file-recovery": true, + "publish": false, + "sync": false +} \ No newline at end of file diff --git a/Practical/Practical Exam/SQL/.obsidian/workspace.json b/Practical/Practical Exam/SQL/.obsidian/workspace.json new file mode 100644 index 0000000..4d61414 --- /dev/null +++ b/Practical/Practical Exam/SQL/.obsidian/workspace.json @@ -0,0 +1,167 @@ +{ + "main": { + "id": "deda6ca9cabf39ec", + "type": "split", + "children": [ + { + "id": "528762701c5cb7c9", + "type": "tabs", + "children": [ + { + "id": "9e917ff803915418", + "type": "leaf", + "state": { + "type": "markdown", + "state": { + "file": "S3 - SQL Queries.md", + "mode": "source", + "source": false + }, + "icon": "lucide-file", + "title": "S3 - SQL Queries" + } + } + ] + } + ], + "direction": "vertical" + }, + "left": { + "id": "e71c05071f449586", + "type": "split", + "children": [ + { + "id": "de6e67028318fa69", + "type": "tabs", + "children": [ + { + "id": "d81d4f98ce4bb78a", + "type": "leaf", + "state": { + "type": "file-explorer", + "state": { + "sortOrder": "alphabetical" + }, + "icon": "lucide-folder-closed", + "title": "Files" + } + }, + { + "id": "b53077d766d63e54", + "type": "leaf", + "state": { + "type": "search", + "state": { + "query": "", + "matchingCase": false, + "explainSearch": false, + "collapseAll": false, + "extraContext": false, + "sortOrder": "alphabetical" + }, + "icon": "lucide-search", + "title": "Search" + } + }, + { + "id": "78e9321bb79969d8", + "type": "leaf", + "state": { + "type": "bookmarks", + "state": {}, + "icon": "lucide-bookmark", + "title": "Bookmarks" + } + } + ] + } + ], + "direction": "horizontal", + "width": 300 + }, + "right": { + "id": "74524ce0837f7d47", + "type": "split", + "children": [ + { + "id": "15f80a64187c7b98", + "type": "tabs", + "children": [ + { + "id": "b56984fac1fac746", + "type": "leaf", + "state": { + "type": "backlink", + "state": { + "file": "S3 - SQL Queries.md", + "collapseAll": false, + "extraContext": false, + "sortOrder": "alphabetical", + "showSearch": false, + "searchQuery": "", + "backlinkCollapsed": false, + "unlinkedCollapsed": true + }, + "icon": "links-coming-in", + "title": "Backlinks for S3 - SQL Queries" + } + }, + { + "id": "561beefc80815ab4", + "type": "leaf", + "state": { + "type": "outgoing-link", + "state": { + "file": "S3 - SQL Queries.md", + "linksCollapsed": false, + "unlinkedCollapsed": true + }, + "icon": "links-going-out", + "title": "Outgoing links from S3 - SQL Queries" + } + }, + { + "id": "f48d09a595ea27cd", + "type": "leaf", + "state": { + "type": "tag", + "state": { + "sortOrder": "frequency", + "useHierarchy": true + }, + "icon": "lucide-tags", + "title": "Tags" + } + }, + { + "id": "d43cad33bdc85f3a", + "type": "leaf", + "state": { + "type": "outline", + "state": { + "file": "S3 - SQL Queries.md" + }, + "icon": "lucide-list", + "title": "Outline of S3 - SQL Queries" + } + } + ] + } + ], + "direction": "horizontal", + "width": 300, + "collapsed": true + }, + "left-ribbon": { + "hiddenItems": { + "switcher:Open quick switcher": false, + "graph:Open graph view": false, + "canvas:Create new canvas": false, + "daily-notes:Open today's daily note": false, + "templates:Insert template": false, + "command-palette:Open command palette": false + } + }, + "active": "9e917ff803915418", + "lastOpenFiles": [] +} \ No newline at end of file diff --git a/Practical/Practical Exam/SQL/S3 - SQL Queries.md b/Practical/Practical Exam/SQL/S3 - SQL Queries.md index 296acf5..779440e 100644 --- a/Practical/Practical Exam/SQL/S3 - SQL Queries.md +++ b/Practical/Practical Exam/SQL/S3 - SQL Queries.md @@ -151,6 +151,16 @@ SELECT SUM(amount) FROM Loan; ``` 4. Delete all loans with loan amount between 1300 and 1500. +- Delete the dependent records first(due to foreign key constraints): +```sql +DELETE FROM Borrower +WHERE loan_no IN ( + SELECT loan_no + FROM Loan + WHERE amount BETWEEN 1300 AND 1500 +); +``` +- Now delete the Loan table Records: ```sql DELETE FROM Loan WHERE amount BETWEEN 1300 AND 1500;