<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Saifulhaq S</title>
    <description>The latest articles on Forem by Saifulhaq S (@saifulhaq).</description>
    <link>https://forem.com/saifulhaq</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3448284%2Fea9e6460-96c3-49e5-b25f-cb72ebdd5660.jpeg</url>
      <title>Forem: Saifulhaq S</title>
      <link>https://forem.com/saifulhaq</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/saifulhaq"/>
    <language>en</language>
    <item>
      <title>🚀 MongoDB CRUD Operations with a Student Schema</title>
      <dc:creator>Saifulhaq S</dc:creator>
      <pubDate>Wed, 08 Oct 2025 10:15:00 +0000</pubDate>
      <link>https://forem.com/saifulhaq/mongodb-crud-operations-with-a-student-schema-55h3</link>
      <guid>https://forem.com/saifulhaq/mongodb-crud-operations-with-a-student-schema-55h3</guid>
      <description>&lt;p&gt;In this post, we’ll explore how to perform CRUD (Create, Read, Update, Delete) operations in MongoDB using a simple college student schema.&lt;br&gt;
📌 Student Schema&lt;br&gt;
Collection: students&lt;br&gt;
Each student document follows this structure:&lt;br&gt;
{&lt;br&gt;
  "student_id": "S001",&lt;br&gt;
  "name": "Santhosh",&lt;br&gt;
  "age": 20,&lt;br&gt;
  "department": "CSBS",&lt;br&gt;
  "year": 2,&lt;br&gt;
  "cgpa": 9&lt;br&gt;
}&lt;br&gt;
1️⃣ Create (Insert)&lt;br&gt;
Insert at least 5 student records:&lt;br&gt;
db.students.insertMany([&lt;br&gt;
  { "student_id": "S001", "name": "Santhosh", "age": 20, "department": "CSBS", "year": 2, "cgpa": 9 },&lt;br&gt;
  { "student_id": "S002", "name": "Priya", "age": 19, "department": "CSE", "year": 1, "cgpa": 8.5 },&lt;br&gt;
  { "student_id": "S003", "name": "Arun", "age": 21, "department": "ECE", "year": 3, "cgpa": 7.8 },&lt;br&gt;
  { "student_id": "S004", "name": "Meena", "age": 20, "department": "IT", "year": 2, "cgpa": 9.2 },&lt;br&gt;
  { "student_id": "S005", "name": "Ravi", "age": 22, "department": "CSBS", "year": 3, "cgpa": 6.9 }&lt;br&gt;
]);&lt;/p&gt;

&lt;p&gt;2️⃣ Read (Query)&lt;br&gt;
👉 Display all student records:&lt;br&gt;
db.students.find({});&lt;br&gt;
👉 Find all students with CGPA &amp;gt; 8:&lt;br&gt;
db.students.find({ cgpa: { $gt: 8 } });&lt;br&gt;
👉 Find students belonging to the Computer Science department:&lt;br&gt;
db.students.find({ department: "CSBS" });&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh8i79pz8evtjv0cgepvh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh8i79pz8evtjv0cgepvh.png" alt=" " width="800" height="440"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg36t8mcuclexuk11zdnh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg36t8mcuclexuk11zdnh.png" alt=" " width="800" height="440"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2tm3sceeg83jsbjxxw91.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2tm3sceeg83jsbjxxw91.png" alt=" " width="800" height="440"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;3️⃣ Update&lt;br&gt;
👉 Update the CGPA of a specific student (say S002):&lt;br&gt;
db.students.updateOne(&lt;br&gt;
  { student_id: "S002" },&lt;br&gt;
  { $set: { cgpa: 9.0 } }&lt;br&gt;
);&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frnyyvsu0tmib2wd8hq39.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frnyyvsu0tmib2wd8hq39.png" alt=" " width="800" height="440"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmqedvanxqpki9lq2z5lp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmqedvanxqpki9lq2z5lp.png" alt=" " width="800" height="440"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;👉 Increase the year of study for all 3rd year students by 1:&lt;br&gt;
db.students.updateMany(&lt;br&gt;
  { year: 3 },&lt;br&gt;
  { $inc: { year: 1 } }&lt;br&gt;
);&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff4svja6ckenzpfo69th9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff4svja6ckenzpfo69th9.png" alt=" " width="800" height="401"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjs0xulqs09g41gtr530b.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjs0xulqs09g41gtr530b.png" alt=" " width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;4️⃣ Delete&lt;/p&gt;

&lt;p&gt;👉 Delete one student record by student_id:&lt;br&gt;
db.students.deleteOne({ student_id: "S005" });&lt;/p&gt;

&lt;p&gt;👉 Delete all students having CGPA &amp;lt; 7.5:&lt;br&gt;
db.students.deleteMany({ cgpa: { $lt: 7.5 } });&lt;br&gt;
📸 Deliverables&lt;br&gt;
MongoDB queries ✅&lt;br&gt;
Screenshots of execution results from MongoDB Atlas ✅&lt;br&gt;
Export of final students collection as JSON/CSV ✅&lt;/p&gt;

&lt;p&gt;🚀 Conclusion&lt;br&gt;
With just a few lines of MongoDB queries, we performed CRUD operations on our students collection. This hands-on exercise demonstrates how easy and powerful MongoDB is for handling structured JSON-like documents.&lt;br&gt;
Would love to hear your feedback or see how you adapt this schema for your own use cases! 💡&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Indexing, Hashing &amp; Query Optimization in Databases</title>
      <dc:creator>Saifulhaq S</dc:creator>
      <pubDate>Wed, 08 Oct 2025 03:36:40 +0000</pubDate>
      <link>https://forem.com/saifulhaq/indexing-hashing-query-optimization-in-databases-o8p</link>
      <guid>https://forem.com/saifulhaq/indexing-hashing-query-optimization-in-databases-o8p</guid>
      <description>&lt;p&gt;When working with databases, simply storing data isn’t enough — efficient retrieval is essential. As your dataset scales to thousands or millions of entries, poorly optimized queries can slow down your system. Techniques like indexing and hashing are crucial tools to speed up lookups, just like the index section of a book helps you find topics quickly.&lt;/p&gt;

&lt;p&gt;Let’s break down how these work, the differences between them, and when to use each.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F31xmjco3ymebgup3ei9c.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F31xmjco3ymebgup3ei9c.webp" alt=" " width="800" height="636"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;⸻&lt;/p&gt;

&lt;p&gt;What Is an Index?&lt;/p&gt;

&lt;p&gt;An index is a specialized data structure that accelerates access to rows in a database table. Rather than scanning every record to satisfy a query, the database can use the index to “jump” directly to likely matches.&lt;/p&gt;

&lt;p&gt;You can think of it like the index pages in a textbook: they don’t contain the whole content, but lead you to exactly where certain topics are discussed.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj8g4gszqws2dqj38fwq4.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj8g4gszqws2dqj38fwq4.webp" alt=" " width="614" height="715"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Types of Indexes&lt;br&gt;
    • Primary index: Automatically generated on the primary key column.&lt;br&gt;
    • Secondary index: Created by the user (or DBA) on non-primary columns to speed up queries.&lt;br&gt;
    • Clustering index: Controls how data is physically ordered on storage media.&lt;br&gt;
    • Non-clustering (or non-clustered) index: A separate data structure that points to the actual data without rearranging it.&lt;/p&gt;

&lt;p&gt;B-Tree and B+Tree Indexing&lt;/p&gt;

&lt;p&gt;Modern databases often use B-Tree or B+Tree structures:&lt;br&gt;
    • In B-Tree, both internal and leaf nodes may hold keys and pointers.&lt;br&gt;
    • In B+Tree, internal nodes only keep keys, and all actual data pointers reside in leaf nodes.&lt;br&gt;
    • Leaf nodes in a B+Tree are typically linked in sequence, making range queries (e.g. “between”) efficient.&lt;/p&gt;

&lt;p&gt;These tree structures balance depth and breadth so that lookup, insert, and delete operations remain comparatively fast.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa5tyd55glo7gatyuv3y4.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa5tyd55glo7gatyuv3y4.webp" alt=" " width="800" height="656"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;⸻&lt;/p&gt;

&lt;p&gt;Hash Indexing&lt;/p&gt;

&lt;p&gt;A hash index works differently. It applies a hash function to the key value and uses the resulting hash to determine which “bucket” the record belongs to.&lt;br&gt;
    • Strengths: Ideal for exact-match queries like column = constant.&lt;br&gt;
    • Weaknesses: Poor for range-based queries (BETWEEN, &amp;lt;, &amp;gt;, etc.) and sorting operations.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5o2o2cfwdnk3chejbyqr.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5o2o2cfwdnk3chejbyqr.webp" alt=" " width="800" height="644"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Because hashing effectively scatters data across buckets without inherent order, it’s not useful when query patterns involve ordering or searching within ranges.&lt;/p&gt;

&lt;p&gt;❌ Not good for:&lt;br&gt;
Range-based queries or sorting operations (like BETWEEN, &amp;lt;, &amp;gt;).&lt;/p&gt;

&lt;p&gt;📘 Use Case: When your application frequently runs exact-match lookups.&lt;/p&gt;

&lt;p&gt;🧾 Example: Students Table&lt;/p&gt;

&lt;p&gt;Let’s create a sample table to see how indexing helps:&lt;/p&gt;

&lt;p&gt;CREATE TABLE Students (&lt;br&gt;
roll_no INT PRIMARY KEY,&lt;br&gt;
name VARCHAR(100),&lt;br&gt;
age INT,&lt;br&gt;
grade CHAR(1)&lt;br&gt;
);&lt;/p&gt;

&lt;p&gt;Step 1: Create Indexes&lt;br&gt;
-- B-Tree index (default)&lt;br&gt;
CREATE INDEX idx_roll_btree ON Students (roll_no);&lt;/p&gt;

&lt;p&gt;-- Hash index (if supported by your DBMS)&lt;br&gt;
CREATE INDEX idx_roll_hash ON Students USING HASH (roll_no);&lt;/p&gt;

&lt;p&gt;Step 2: Run Queries&lt;br&gt;
-- Equality check (best for hash or B-tree)&lt;br&gt;
SELECT * FROM Students WHERE roll_no = 50;&lt;/p&gt;

&lt;p&gt;-- Range query (best for B-tree or B+Tree)&lt;br&gt;
SELECT * FROM Students WHERE roll_no BETWEEN 10 AND 100;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm8hr6n7udbxsh3cenwju.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm8hr6n7udbxsh3cenwju.webp" alt=" " width="800" height="667"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;👉 The B-Tree index handles both cases efficiently,&lt;br&gt;
while the hash index excels only in equality lookups.&lt;/p&gt;

&lt;p&gt;📊 When to Use Which Index&lt;br&gt;
Use Case Best Index Reason&lt;br&gt;
Equality lookups (=) Hash or B-Tree Hash is fastest for exact matches&lt;br&gt;
Range queries B-Tree / B+Tree Maintains sorted order&lt;br&gt;
Sequential access B+Tree Linked leaf nodes improve performance&lt;br&gt;
Memory optimization Minimal indexing Too many indexes slow down inserts/updates&lt;br&gt;
⚠️ Important Considerations&lt;/p&gt;

&lt;p&gt;Storage Overhead: Every index consumes additional space.&lt;/p&gt;

&lt;p&gt;Write Performance: More indexes = slower INSERT, UPDATE, DELETE.&lt;/p&gt;

&lt;p&gt;Low-Cardinality Columns: Avoid indexing columns with few unique values (e.g., gender, status).&lt;/p&gt;

&lt;p&gt;Maintenance: Indexes can fragment over time and may need rebuilding.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fi63bit2aec40kokas7sk.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fi63bit2aec40kokas7sk.webp" alt=" " width="800" height="670"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;🧠 Query Optimization&lt;/p&gt;

&lt;p&gt;Indexes are one of the most effective tools for query optimization.&lt;br&gt;
But you can combine them with:&lt;/p&gt;

&lt;p&gt;Query planning: Use EXPLAIN to analyze how queries execute.&lt;/p&gt;

&lt;p&gt;Proper filtering: Avoid SELECT *; fetch only what’s needed.&lt;/p&gt;

&lt;p&gt;Composite indexes: Combine multiple columns in one index for common query patterns.&lt;/p&gt;

&lt;p&gt;✅ Summary&lt;br&gt;
Concept Description&lt;br&gt;
Indexing Data structure for faster lookups&lt;br&gt;
B-Tree / B+Tree Supports ordering and range queries&lt;br&gt;
Hash Indexing Best for equality checks&lt;br&gt;
Query Optimization Uses indexes and execution plans for efficiency&lt;br&gt;
🚀 Final Thoughts&lt;/p&gt;

&lt;p&gt;Efficient indexing and query design are what make large-scale applications fast and reliable.&lt;br&gt;
Understanding how and when to use B-Tree or Hash indexes can significantly improve your database performance.&lt;/p&gt;

&lt;p&gt;Start small — analyze your queries, create the right indexes, and monitor performance.&lt;br&gt;
A few thoughtful indexes can turn your slowest queries into instant results.&lt;/p&gt;

</description>
      <category>algorithms</category>
      <category>database</category>
      <category>performance</category>
    </item>
    <item>
      <title>🚀 Indexing, Hashing &amp; Query Optimization in SQL (with Examples)</title>
      <dc:creator>Saifulhaq S</dc:creator>
      <pubDate>Mon, 06 Oct 2025 09:38:00 +0000</pubDate>
      <link>https://forem.com/saifulhaq/indexing-hashing-query-optimization-in-sql-with-examples-39hm</link>
      <guid>https://forem.com/saifulhaq/indexing-hashing-query-optimization-in-sql-with-examples-39hm</guid>
      <description>&lt;p&gt;Database performance is a critical aspect of any application. Indexing, hashing, and query optimization techniques help speed up data retrieval and reduce execution time.&lt;br&gt;
In this post, we’ll explore B-Tree, B+ Tree, and Hash indexing using a Students table.&lt;/p&gt;

&lt;p&gt;📌 Step 1: Create the Students Table&lt;/p&gt;

&lt;p&gt;CREATE TABLE Students (&lt;br&gt;
    roll_no INT PRIMARY KEY,&lt;br&gt;
    name VARCHAR(50),&lt;br&gt;
    dept VARCHAR(20),&lt;br&gt;
    cgpa DECIMAL(3,2)&lt;br&gt;
);&lt;/p&gt;

&lt;p&gt;📌 Step 2: Insert Sample Records&lt;/p&gt;

&lt;p&gt;INSERT INTO Students (roll_no, name, dept, cgpa) VALUES&lt;br&gt;
(101, 'Arun', 'CSE', 8.5),&lt;br&gt;
(102, 'Priya', 'IT', 7.9),&lt;br&gt;
(103, 'Ravi', 'CSBS', 8.2),&lt;br&gt;
(104, 'Sneha', 'ECE', 9.1),&lt;br&gt;
(105, 'Karthik', 'EEE', 6.8),&lt;br&gt;
(106, 'Divya', 'CSE', 7.5),&lt;br&gt;
(107, 'Vikram', 'CSBS', 8.8),&lt;br&gt;
(108, 'Meena', 'IT', 9.0),&lt;br&gt;
(109, 'Hari', 'CSE', 7.2),&lt;br&gt;
(110, 'Nisha', 'CSBS', 8.6),&lt;br&gt;
(111, 'Suresh', 'ECE', 7.4),&lt;br&gt;
(112, 'Lavanya', 'IT', 8.9),&lt;br&gt;
(113, 'Manoj', 'EEE', 6.5),&lt;br&gt;
(114, 'Geetha', 'CSE', 8.1),&lt;br&gt;
(115, 'Ramesh', 'CSBS', 7.8),&lt;br&gt;
(116, 'Anitha', 'IT', 8.4),&lt;br&gt;
(117, 'Saravanan', 'ECE', 9.2),&lt;br&gt;
(118, 'Preethi', 'CSE', 8.7),&lt;br&gt;
(119, 'Ajay', 'CSBS', 7.3),&lt;br&gt;
(120, 'Deepa', 'EEE', 8.0);&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd9nonji9zlh23vsrbjhv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd9nonji9zlh23vsrbjhv.png" alt=" " width="800" height="456"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;📌 Step 3: Create a B-Tree Index on roll_no&lt;/p&gt;

&lt;p&gt;CREATE INDEX idx_name ON Students(name);&lt;/p&gt;

&lt;p&gt;📌 Step 4: Query with B-Tree Index&lt;/p&gt;

&lt;p&gt;SELECT * FROM Students WHERE roll_no = 110;&lt;/p&gt;

&lt;p&gt;📌 Step 5: Create a B+ Tree Index on cgpa&lt;/p&gt;

&lt;p&gt;CREATE INDEX idx_cgpa ON Students(cgpa);&lt;/p&gt;

&lt;p&gt;📌 Step 6: Query with B+ Tree Index&lt;/p&gt;

&lt;p&gt;SELECT * FROM Students WHERE cgpa &amp;gt; 8.0;&lt;/p&gt;

&lt;p&gt;📌 Step 7: Create a Hash Index on dept&lt;/p&gt;

&lt;p&gt;CREATE INDEX idx_dept ON Students(dept) USING HASH;&lt;/p&gt;

&lt;p&gt;📌 Step 8: Query with Hash Index&lt;/p&gt;

&lt;p&gt;SELECT * FROM Students WHERE dept = 'CSBS';&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F48pzdzzof5tf3dpcxqe0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F48pzdzzof5tf3dpcxqe0.png" alt=" " width="800" height="456"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>database</category>
      <category>algorithms</category>
      <category>performance</category>
      <category>sql</category>
    </item>
    <item>
      <title>Cursor + Trigger</title>
      <dc:creator>Saifulhaq S</dc:creator>
      <pubDate>Mon, 06 Oct 2025 04:42:07 +0000</pubDate>
      <link>https://forem.com/saifulhaq/cursor-trigger-4l4c</link>
      <guid>https://forem.com/saifulhaq/cursor-trigger-4l4c</guid>
      <description>&lt;p&gt;🚀 Using Cursor and Trigger in SQL (with Examples)&lt;br&gt;
In SQL, cursors and triggers are powerful features that allow you to process queries row by row and automate actions when data changes. Let’s learn how to use them with practical examples.&lt;/p&gt;

&lt;p&gt;🔹 Cursor Example: Employees with Salary &amp;gt; 50,000&lt;br&gt;
We want to display employee names whose salary is greater than 50,000 using a cursor.&lt;/p&gt;

&lt;p&gt;Step 1: Employee Table&lt;br&gt;
CREATE TABLE Employee (&lt;br&gt;
    EmpID INT PRIMARY KEY,&lt;br&gt;
    EmpName VARCHAR(50),&lt;br&gt;
    Salary DECIMAL(10,2)&lt;br&gt;
);&lt;/p&gt;

&lt;p&gt;-- Sample Data&lt;br&gt;
INSERT INTO Employee VALUES (1, 'John', 60000);&lt;br&gt;
INSERT INTO Employee VALUES (2, 'Alice', 45000);&lt;br&gt;
INSERT INTO Employee VALUES (3, 'Bob', 75000);&lt;br&gt;
INSERT INTO Employee VALUES (4, 'Emma', 52000);&lt;/p&gt;

&lt;p&gt;Step 2: Cursor with Condition&lt;/p&gt;

&lt;p&gt;SET SERVEROUTPUT ON;&lt;/p&gt;

&lt;p&gt;DECLARE&lt;br&gt;
    v_EmpName Employee.EmpName%TYPE;   -- variable to hold employee name&lt;br&gt;
    CURSOR emp_cursor IS&lt;br&gt;
        SELECT EmpName FROM Employee WHERE Salary &amp;gt; 50000;&lt;br&gt;
BEGIN&lt;br&gt;
    OPEN emp_cursor;&lt;br&gt;
    LOOP&lt;br&gt;
        FETCH emp_cursor INTO v_EmpName;&lt;br&gt;
        EXIT WHEN emp_cursor%NOTFOUND;&lt;br&gt;
        DBMS_OUTPUT.PUT_LINE('Employee Name: ' || v_EmpName);&lt;br&gt;
    END LOOP;&lt;br&gt;
    CLOSE emp_cursor;&lt;br&gt;
END;&lt;br&gt;
/&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftaa35vpfkgaas3see87a.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftaa35vpfkgaas3see87a.png" alt=" " width="800" height="456"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;🔹 Trigger Example: AFTER INSERT on Student Table&lt;br&gt;
Whenever a new student is added, we want to log it automatically into an audit table.&lt;/p&gt;

&lt;p&gt;Step 1: Create Student &amp;amp; Audit Tables&lt;/p&gt;

&lt;p&gt;CREATE TABLE Students ( StudentID INT PRIMARY KEY, StudentName VARCHAR(50), Department VARCHAR(50) ); &lt;/p&gt;

&lt;p&gt;CREATE TABLE Student_Audit ( AuditID INT IDENTITY(1,1) PRIMARY KEY, StudentID INT, ActionTime DATETIME, ActionPerformed VARCHAR(50) );&lt;/p&gt;

&lt;p&gt;Step 2: AFTER INSERT Trigger&lt;/p&gt;

&lt;p&gt;CREATE OR REPLACE TRIGGER trg_AfterInsert_Student&lt;br&gt;
AFTER INSERT ON Students&lt;br&gt;
FOR EACH ROW&lt;br&gt;
BEGIN&lt;br&gt;
    INSERT INTO Student_Audit (StudentID, ActionTime, ActionPerformed)&lt;br&gt;
    VALUES (:NEW.StudentID, SYSTIMESTAMP, 'INSERT');&lt;br&gt;
END;&lt;br&gt;
/&lt;/p&gt;

&lt;p&gt;Step 3: Test the Trigger&lt;/p&gt;

&lt;p&gt;INSERT INTO Students VALUES (1, 'Mike', 'CSE');&lt;br&gt;
INSERT INTO Students VALUES (2, 'Sophia', 'IT');&lt;/p&gt;

&lt;p&gt;SELECT * FROM Student_Audit;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frj446ai65r4olo21xa2r.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frj446ai65r4olo21xa2r.png" alt=" " width="800" height="456"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;🎯 Conclusion&lt;br&gt;
Cursor lets us fetch data row by row and apply conditions.&lt;br&gt;
Trigger automates actions after an event (INSERT/UPDATE/DELETE).&lt;br&gt;
Together, they help in data processing and auditing in real-time.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>NORMALISATION</title>
      <dc:creator>Saifulhaq S</dc:creator>
      <pubDate>Mon, 06 Oct 2025 03:57:40 +0000</pubDate>
      <link>https://forem.com/saifulhaq/normalisation-37cf</link>
      <guid>https://forem.com/saifulhaq/normalisation-37cf</guid>
      <description>&lt;p&gt;Understanding Normalization with SQL – 1NF, 2NF, 3NF&lt;br&gt;
When working with databases, we often face redundancy, inconsistency, and anomalies. Normalization helps solve these issues by organizing data into well-structured tables.&lt;/p&gt;

&lt;p&gt;📌 Base Table (Unnormalized Data)&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjdi30ari2qlgbomn7r7y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjdi30ari2qlgbomn7r7y.png" alt=" " width="800" height="253"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;🔎 Anomalies Identified&lt;br&gt;
Insertion: Cannot add a new course unless a student registers.&lt;br&gt;
Update: Changing instructor name requires multiple updates.&lt;br&gt;
Deletion: Deleting a student may remove course data too.&lt;/p&gt;

&lt;p&gt;✅ First Normal Form (1NF)&lt;br&gt;
We ensure atomic values and primary keys.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff4r47in2p5wx5le96kzm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff4r47in2p5wx5le96kzm.png" alt=" " width="800" height="501"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fht8nk8z9asayctjobqdn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fht8nk8z9asayctjobqdn.png" alt=" " width="800" height="455"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;✅ Second Normal Form (2NF)&lt;br&gt;
We remove partial dependencies by separating Students and Courses.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Foz8v19oac78rb0gfhtvz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Foz8v19oac78rb0gfhtvz.png" alt=" " width="800" height="455"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fetkp64e3o33vwkrgnc9a.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fetkp64e3o33vwkrgnc9a.png" alt=" " width="800" height="455"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvtwn65leau4t5fh28fjp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvtwn65leau4t5fh28fjp.png" alt=" " width="800" height="455"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;✅ Third Normal Form (3NF)&lt;br&gt;
We remove transitive dependencies by separating Instructors.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcvdbca8womzr4exqdl7l.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcvdbca8womzr4exqdl7l.png" alt=" " width="800" height="455"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb91zysw1eiov515twtm1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb91zysw1eiov515twtm1.png" alt=" " width="800" height="455"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fllnfvrnatjsmuicv2lle.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fllnfvrnatjsmuicv2lle.png" alt=" " width="800" height="455"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqhdaiqawgpa98jw2dyym.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqhdaiqawgpa98jw2dyym.png" alt=" " width="800" height="455"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;📥 Sample Data Insertions&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fapnbic6uglz0d2xphok6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fapnbic6uglz0d2xphok6.png" alt=" " width="800" height="455"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzp9mgqkk3padt6w4ko03.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzp9mgqkk3padt6w4ko03.png" alt=" " width="800" height="455"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fizilak2n67vh7tj24woa.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fizilak2n67vh7tj24woa.png" alt=" " width="800" height="455"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjzbfxbd02u3k8throg9p.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjzbfxbd02u3k8throg9p.png" alt=" " width="800" height="455"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;🔗 Query with JOINs&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxdlo0gg2ak50xiijhjev.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxdlo0gg2ak50xiijhjev.png" alt=" " width="800" height="455"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;🎯 Conclusion&lt;br&gt;
By applying 1NF → 2NF → 3NF, we eliminated redundancy, prevented anomalies, and achieved a clean database design. This structured design makes querying and maintenance much easier.&lt;/p&gt;

</description>
      <category>database</category>
      <category>tutorial</category>
      <category>beginners</category>
      <category>sql</category>
    </item>
    <item>
      <title>Getting Started with SQL: My First Hands-On Experience</title>
      <dc:creator>Saifulhaq S</dc:creator>
      <pubDate>Wed, 20 Aug 2025 16:38:16 +0000</pubDate>
      <link>https://forem.com/saifulhaq/getting-started-with-sql-my-first-hands-on-experience-348g</link>
      <guid>https://forem.com/saifulhaq/getting-started-with-sql-my-first-hands-on-experience-348g</guid>
      <description>&lt;p&gt;Over the past few days, I started learning SQL (Structured Query Language) and performed some of the most essential operations that every beginner should know. Databases power almost every application we use today, and SQL is the language that helps us communicate with them.&lt;br&gt;
I practiced queries on a simple Students–Courses database and here’s what I tried:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Creating Tables (DDL)
I started with the CREATE TABLE command to define the structure of my tables. For example:
CREATE TABLE Faculty (
FacultyID INT PRIMARY KEY,
FacultyName VARCHAR2(100) NOT NULL,
Dept VARCHAR2(50),
Email VARCHAR2(100) UNIQUE
);
This helped me understand how to set primary keys, constraints, and column types.&lt;/li&gt;
&lt;li&gt;Inserting Data (DML)
Next, I used the INSERT INTO statement to add records into my tables. For example, I added some students into different departments.
INSERT INTO Students (StudentID, Name, Dept, DOB, Email)
VALUES (1, 'Saifulhaq', 'CSBS', TO_DATE('13-12-2006','DD-MM-YYYY'), '&lt;a href="mailto:itsaifulhaq@gmail.com"&gt;itsaifulhaq@gmail.com&lt;/a&gt;');&lt;/li&gt;
&lt;li&gt;Altering Tables
I learned how to modify table structures using the ALTER TABLE command. For instance, I added a phone number column:
ALTER TABLE Students
ADD PhoneNo VARCHAR2(10);&lt;/li&gt;
&lt;li&gt;Using Functions in SELECT
I also explored SQL functions to manipulate and display data. Example:
SELECT UPPER(Name) AS StudentName,
   LENGTH(Email) AS EmailLength
FROM Students;
This query shows student names in uppercase and calculates the length of their email IDs.&lt;/li&gt;
&lt;li&gt;Aggregate Functions
SQL makes it easy to calculate statistics. I tried:
SELECT AVG(Credits) AS AvgCredits FROM Courses;
SELECT COUNT(*) AS TotalStudents FROM Students;&lt;/li&gt;
&lt;li&gt;Joins
Finally, I experimented with joins to combine data from multiple tables:
SELECT s.Name, c.CourseName, e.Grade
FROM Students s
JOIN Enrollments e ON s.StudentID = e.StudentID
JOIN Courses c ON e.CourseID = c.CourseID;
This lists all students with the courses they’re enrolled in and their grades.
Final Thoughts 💡
Writing and executing these SQL queries gave me a solid understanding of how relational databases work. It’s one thing to learn the theory, but actually running queries and seeing the results makes it click much faster.
I’ll be sharing more of my learning journey soon — especially as I explore advanced SQL queries and dive deeper into database design.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Thank you &lt;a class="mentioned-user" href="https://dev.to/santhoshnc"&gt;@santhoshnc&lt;/a&gt; sir for your valuable guidance...&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fggbbwhx19h39l7gnfcyi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fggbbwhx19h39l7gnfcyi.png" alt=" " width="800" height="457"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdypfkrs0wgpftzvd5acf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdypfkrs0wgpftzvd5acf.png" alt=" " width="800" height="457"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzdmwdmydlygnrnu3srqb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzdmwdmydlygnrnu3srqb.png" alt=" " width="800" height="457"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnl3lgoz8e8o4mxzak6m5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnl3lgoz8e8o4mxzak6m5.png" alt=" " width="800" height="457"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fezrsfbe1qytbvt9p284j.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fezrsfbe1qytbvt9p284j.png" alt=" " width="800" height="457"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fee5n01vs1rbupo1qrety.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fee5n01vs1rbupo1qrety.png" alt=" " width="800" height="457"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0uchntudp7xli863yhxw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0uchntudp7xli863yhxw.png" alt=" " width="800" height="457"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9uoabh1uuts1sg3sj9ii.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9uoabh1uuts1sg3sj9ii.png" alt=" " width="800" height="457"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
