Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
156 changes: 154 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,154 @@
# sql-queries-and-dbms
A complete collection of **SQL queries** and **DBMS concepts** for beginners to advanced learners. This repository is designed to help students, developers, and interview aspirants master **Database Management Systems (DBMS)** and **SQL** efficiently.
# 🗄️ SQL Queries and DBMS

A complete collection of **SQL queries** and **DBMS concepts** for beginners to advanced learners.
This repository is designed to help students, developers, and interview aspirants master **Database Management Systems (DBMS)** and **SQL** efficiently.

---

## 📌 Features

- 📚 Well-structured DBMS notes
- 🧠 Important SQL queries (basic to advanced)
- ⚡ Real-world examples
- 🎯 Interview-focused questions
- 📝 Easy-to-understand explanations

---

## 📂 Repository Structure
sql-queries-and-dbms/
├── basics/
│ ├── create_database.sql
│ ├── create_table.sql
│ └── insert_data.sql
├── queries/
│ ├── select_queries.sql
│ ├── where_clause.sql
│ ├── joins.sql
│ ├── group_by.sql
│ └── subqueries.sql
├── advanced/
│ ├── views.sql
│ ├── indexes.sql
│ ├── triggers.sql
│ └── stored_procedures.sql
└── notes/
└── dbms_theory.md

Comment on lines +18 to +41
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: Verify the directory structure and files mentioned in README

# Check if documented directories exist
echo "Checking directories..."
for dir in basics queries advanced notes; do
  if [ -d "$dir" ]; then
    echo "$dir/ exists"
  else
    echo "$dir/ missing"
  fi
done

echo -e "\nChecking SQL files..."
# Check specific files mentioned in README
files=(
  "basics/create_database.sql"
  "basics/create_table.sql"
  "basics/insert_data.sql"
  "queries/select_queries.sql"
  "queries/where_clause.sql"
  "queries/joins.sql"
  "queries/group_by.sql"
  "queries/subqueries.sql"
  "advanced/views.sql"
  "advanced/indexes.sql"
  "advanced/triggers.sql"
  "advanced/stored_procedures.sql"
  "notes/dbms_theory.md"
)

for file in "${files[@]}"; do
  if [ -f "$file" ]; then
    echo "$file exists"
  else
    echo "$file missing"
  fi
done

Repository: Ronit049/sql-queries-and-dbms

Length of output: 625


Remove or update the documented directory structure—none of the listed directories and SQL files exist in the repository.

The repository structure section documents 4 directories and 13 SQL files that do not exist in the codebase. Either add the documented files and directories or update the README to match the actual repository structure.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@README.md` around lines 18 - 41, The README's "## 📂 Repository Structure"
block documents directories and files (e.g., basics/, queries/, advanced/,
notes/, create_database.sql, select_queries.sql, views.sql, dbms_theory.md) that
do not exist; either create the missing directories and SQL/docs to match that
listing or update the README to reflect the actual repository contents—edit the
"## 📂 Repository Structure" section to remove or replace nonexistent entries
with the real top-level folders and files, ensuring the listed names match
current repository symbols (directory names and file names) exactly.

---

## 🧑‍💻 Topics Covered

### 🔹 DBMS Concepts
- Database & DBMS Introduction
- ER Model
- Normalization
- Keys (Primary, Foreign, Candidate)
- Transactions & ACID Properties
- Indexing

### 🔹 SQL Commands

#### 📌 DDL (Data Definition Language)
- `CREATE`
- `ALTER`
- `DROP`
- `TRUNCATE`

#### 📌 DML (Data Manipulation Language)
- `INSERT`
- `UPDATE`
- `DELETE`

#### 📌 DQL (Data Query Language)
- `SELECT`
- `WHERE`
- `ORDER BY`
- `GROUP BY`
- `HAVING`

#### 📌 DCL (Data Control Language)
- `GRANT`
- `REVOKE`

#### 📌 TCL (Transaction Control Language)
- `COMMIT`
- `ROLLBACK`
- `SAVEPOINT`

---

## ⚡ Sample Queries

```sql
-- Create Table
CREATE TABLE students (
id INT PRIMARY KEY,
name VARCHAR(50),
age INT
);

-- Insert Data
INSERT INTO students VALUES (1, 'Rahul', 20);

-- Select Data
SELECT * FROM students;

-- Where Clause
SELECT * FROM students WHERE age > 18;

---
```
Comment on lines +87 to +105
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Fix the code block formatting.

The --- separator on line 104 is incorrectly placed inside the SQL code block. It should be outside the code fence.

📝 Proposed fix
 -- Where Clause
 SELECT * FROM students WHERE age > 18;
-
----

+---

</details>

<!-- suggestion_start -->

<details>
<summary>📝 Committable suggestion</summary>

> ‼️ **IMPORTANT**
> Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

```suggestion

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@README.md` around lines 87 - 105, Move the '---' separator out of the SQL
code fence: close the sql code block immediately after the last SQL statement
(the SELECT ... WHERE age > 18; block that follows CREATE TABLE students /
INSERT INTO students / SELECT * FROM students), i.e. add the closing ``` right
after the final semicolon, then put the '---' on its own line after that fence
so the separator is no longer inside the ```sql code block.


## 🚀 How to Use
1. Clone the repository
```
git clone https://github.com/your-username/sql-queries-and-dbms.git
```
Comment on lines +109 to +111
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Replace the placeholder with the actual username.

Line 110 contains a placeholder your-username that must be replaced with the actual GitHub username Ronit049 to provide a working clone URL. Additionally, the code block should specify bash as the language.

🔧 Proposed fix
-1. Clone the repository
-```
-git clone https://github.com/your-username/sql-queries-and-dbms.git
-```
+1. Clone the repository
+```bash
+git clone https://github.com/Ronit049/sql-queries-and-dbms.git
+```
🧰 Tools
🪛 markdownlint-cli2 (0.21.0)

[warning] 109-109: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@README.md` around lines 109 - 111, Replace the placeholder GitHub username in
the README clone instruction: update the git clone line that currently contains
"your-username" to use "Ronit049" (the working URL) and mark the fenced code
block as bash; also convert that snippet into a brief step header like "1. Clone
the repository" followed by the fenced bash block so readers see the command and
language correctly (locate the existing git clone snippet in README.md to make
the change).

2. Open SQL files in your preferred DBMS (MySQL, PostgreSQL, etc.)
3. Practice queries and modify them
---
🛠️ Tools Supported
MySQL
PostgreSQL
SQLite
Oracle
---
Comment on lines +115 to +120
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Fix heading style and add list formatting.

The heading uses inconsistent style (setext underline instead of atx ##), and the list items lack proper markdown bullet formatting. As per static analysis, expected heading style is atx.

📋 Proposed fix
----
-🛠️ Tools Supported
-MySQL
-PostgreSQL
-SQLite
-Oracle
+
+## 🛠️ Tools Supported
+
+- MySQL
+- PostgreSQL
+- SQLite
+- Oracle
+
 ---
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
🛠️ Tools Supported
MySQL
PostgreSQL
SQLite
Oracle
---
## 🛠️ Tools Supported
- MySQL
- PostgreSQL
- SQLite
- Oracle
---
🧰 Tools
🪛 markdownlint-cli2 (0.21.0)

[warning] 115-115: Heading style
Expected: atx; Actual: setext

(MD003, heading-style)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@README.md` around lines 115 - 120, Change the "Tools Supported" section to
use an ATX-style heading and proper Markdown list items: replace the setext
underline heading with "## Tools Supported" and convert the bare tool names
(MySQL, PostgreSQL, SQLite, Oracle) into a bulleted list (e.g., prefix each with
"- " or "* "), and remove the stray "---" horizontal rule if it's not needed;
update the header text "Tools Supported" and the list entries accordingly in
README.md.

🎯 Who Is This For?
👨‍🎓 Students learning DBMS
💼 Interview preparation
👨‍💻 Beginner to intermediate developers
📊 Anyone interested in databases
---
Comment on lines +121 to +126
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Fix heading style and add list formatting.

Similar to the previous section, this heading uses inconsistent style and the list items lack proper markdown bullets. As per static analysis, expected heading style is atx.

📋 Proposed fix
----
-🎯 Who Is This For?
-👨‍🎓 Students learning DBMS
-💼 Interview preparation
-👨‍💻 Beginner to intermediate developers
-📊 Anyone interested in databases
+
+## 🎯 Who Is This For?
+
+- 👨‍🎓 Students learning DBMS
+- 💼 Interview preparation
+- 👨‍💻 Beginner to intermediate developers
+- 📊 Anyone interested in databases
+
 ---
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
🎯 Who Is This For?
👨‍🎓 Students learning DBMS
💼 Interview preparation
👨‍💻 Beginner to intermediate developers
📊 Anyone interested in databases
---
## 🎯 Who Is This For?
- 👨‍🎓 Students learning DBMS
- 💼 Interview preparation
- 👨‍💻 Beginner to intermediate developers
- 📊 Anyone interested in databases
---
🧰 Tools
🪛 markdownlint-cli2 (0.21.0)

[warning] 121-121: Heading style
Expected: atx; Actual: setext

(MD003, heading-style)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@README.md` around lines 121 - 126, Change the section header "Who Is This
For?" to an ATX-style heading (e.g., prefixed with ## or ###) and convert the
following lines ("Students learning DBMS", "Interview preparation", "Beginner to
intermediate developers", "Anyone interested in databases") into a proper
Markdown unordered list using "-" or "*" bullets; update the header and list in
the same block so the section matches the expected heading style and list
formatting.

🤝 Contributing

Contributions are welcome!
Feel free to fork this repo and submit a pull request.
---
⭐ Support

If you find this repository helpful, please ⭐ star it!
---
📧 Contact

Created by Ronit Raj
📌 Feel free to connect and collaborate!
---
📜 License

This project is open-source and available under the MIT License.

Comment on lines +127 to +144
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: Verify LICENSE file exists for the MIT License claim

if [ -f "LICENSE" ] || [ -f "LICENSE.md" ] || [ -f "LICENSE.txt" ]; then
  echo "✓ LICENSE file found"
  ls -la LICENSE* 2>/dev/null
else
  echo "✗ LICENSE file missing - consider adding one for MIT License claim"
fi

Repository: Ronit049/sql-queries-and-dbms

Length of output: 150


🏁 Script executed:

# Check the exact formatting of lines 127-144 and surrounding context in README.md
sed -n '120,150p' README.md | cat -n

Repository: Ronit049/sql-queries-and-dbms

Length of output: 916


🏁 Script executed:

# Search for all heading patterns in README.md
rg '^#+|^[^#].+\n-{3,}' README.md -A 1 -B 1 | head -100

Repository: Ronit049/sql-queries-and-dbms

Length of output: 264


🏁 Script executed:

# Check heading patterns - find lines with ## or underlines with dashes
head -150 README.md | tail -50

Repository: Ronit049/sql-queries-and-dbms

Length of output: 1039


🏁 Script executed:

# Get the entire README.md to see all heading patterns
wc -l README.md

Repository: Ronit049/sql-queries-and-dbms

Length of output: 86


🏁 Script executed:

# Get the entire README.md file to analyze heading styles
cat README.md

Repository: Ronit049/sql-queries-and-dbms

Length of output: 2835


Fix heading style inconsistencies for consistency.

The file uses atx-style headings (##) in the early sections but switches to setext-style (underlined with ---) for later sections. Convert all remaining setext-style headings to atx-style to maintain consistency throughout.

📋 Proposed fix for heading styles
---
+## 🛠️ Tools Supported
-🛠️ Tools Supported
 MySQL
 PostgreSQL
 SQLite
 Oracle
+
 ---
-🎯 Who Is This For?
+## 🎯 Who Is This For?
 👨‍🎓 Students learning DBMS
 💼 Interview preparation
 👨‍💻 Beginner to intermediate developers
 📊 Anyone interested in databases
+
 ---
-🤝 Contributing
+## 🤝 Contributing
 
 Contributions are welcome!
 Feel free to fork this repo and submit a pull request.
+
 ---
-⭐ Support
+## ⭐ Support
 
 If you find this repository helpful, please ⭐ star it!
+
 ---
-📧 Contact
+## 📧 Contact
 
 Created by Ronit Raj
 📌 Feel free to connect and collaborate!
+
 ---
-📜 License
+## 📜 License
 
 This project is open-source and available under the MIT License.
🧰 Tools
🪛 LanguageTool

[style] ~129-~129: Consider using a less common alternative to make your writing sound more unique and professional.
Context: ...ontributing Contributions are welcome! Feel free to fork this repo and submit a pull reques...

(FEEL_FREE_TO_STYLE_ME)


[style] ~139-~139: Using many exclamation marks might seem excessive (in this case: 3 exclamation marks for a text that’s 1927 characters long)
Context: ... 📌 Feel free to connect and collaborate! --- 📜 License This project is open-so...

(EN_EXCESSIVE_EXCLAMATION)

🪛 markdownlint-cli2 (0.21.0)

[warning] 129-129: Heading style
Expected: atx; Actual: setext

(MD003, heading-style)


[warning] 134-134: Heading style
Expected: atx; Actual: setext

(MD003, heading-style)


[warning] 138-138: Heading style
Expected: atx; Actual: setext

(MD003, heading-style)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@README.md` around lines 127 - 144, Convert the setext-style underlined
headings (the lines with --- after the text) to atx-style headings (prefix with
##) so all sections use the same heading style; update the headings for
"Contributing", "Support", "Contact", and "License" (and any other similar
underlined sections) to use "## Contributing", "## Support", "## Contact", "##
License" respectively and remove the trailing underline lines.

---
```
If you want next level 🚀
I can:
- Add **50+ real interview SQL questions**
- Add **mini project (student DB / e-commerce DB)**
- Make this repo **stand out on your resume + LinkedIn**

Just tell me 👍
```
Comment on lines +145 to +154
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Remove unnecessary code fence wrapper.

Lines 146-154 are wrapped in a code block without a specified language. This content is a call-to-action message and should be formatted as regular markdown rather than being enclosed in code fences for better visual presentation.

🎨 Proposed fix
 ---
-```
-If you want next level 🚀  
+
+## 🚀 Take It to the Next Level
+
 I can:
 - Add **50+ real interview SQL questions**
 - Add **mini project (student DB / e-commerce DB)**
 - Make this repo **stand out on your resume + LinkedIn**
 
 Just tell me 👍
-```
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
---
```
If you want next level 🚀
I can:
- Add **50+ real interview SQL questions**
- Add **mini project (student DB / e-commerce DB)**
- Make this repo **stand out on your resume + LinkedIn**
Just tell me 👍
```
---
## 🚀 Take It to the Next Level
I can:
- Add **50+ real interview SQL questions**
- Add **mini project (student DB / e-commerce DB)**
- Make this repo **stand out on your resume + LinkedIn**
Just tell me 👍
🧰 Tools
🪛 markdownlint-cli2 (0.21.0)

[warning] 146-146: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@README.md` around lines 145 - 154, Remove the unnecessary triple-backtick
code fence around the call-to-action block in README.md and convert it to normal
markdown: delete the opening and closing ``` markers, add the suggested heading
"## 🚀 Take It to the Next Level" above the paragraph, and keep the existing
bullet list and closing line ("Just tell me 👍") as regular markdown so the CTA
renders properly instead of as a code block.