<?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: srivishal</title>
    <description>The latest articles on Forem by srivishal (@srivishal_b2975898351fa2b).</description>
    <link>https://forem.com/srivishal_b2975898351fa2b</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%2F3449179%2F6590acff-ea4c-490c-8c80-7ac6d21fcfc6.webp</url>
      <title>Forem: srivishal</title>
      <link>https://forem.com/srivishal_b2975898351fa2b</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/srivishal_b2975898351fa2b"/>
    <language>en</language>
    <item>
      <title>Transactions, Deadlocks &amp; Log Based Recovery</title>
      <dc:creator>srivishal</dc:creator>
      <pubDate>Sun, 05 Oct 2025 19:52:23 +0000</pubDate>
      <link>https://forem.com/srivishal_b2975898351fa2b/transactions-deadlocks-log-based-recovery-55a</link>
      <guid>https://forem.com/srivishal_b2975898351fa2b/transactions-deadlocks-log-based-recovery-55a</guid>
      <description>&lt;p&gt;Managing database transactions safely is crucial to ensure data integrity and prevent issues like partial updates or deadlocks. In this tutorial, we’ll explore transactions, deadlocks, and log-based recovery using a simple Accounts table.&lt;/p&gt;

&lt;p&gt;First, let’s create a sample table&lt;br&gt;
CREATE TABLE Accounts (&lt;br&gt;
acc_no INT PRIMARY KEY,&lt;br&gt;
name VARCHAR(50),&lt;br&gt;
balance INT&lt;br&gt;
);&lt;/p&gt;

&lt;p&gt;INSERT INTO Accounts VALUES&lt;br&gt;
(1, 'Alice', 1000),&lt;br&gt;
(2, 'Bob', 1500),&lt;br&gt;
(3, 'Charlie', 2000);&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%2Fg0n68j1xbaq63a1c0jvc.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%2Fg0n68j1xbaq63a1c0jvc.png" alt=" " width="800" height="493"&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%2Fbpmg4y1sn23xvbvjwjjl.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%2Fbpmg4y1sn23xvbvjwjjl.png" alt=" " width="800" height="511"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;*Transaction – Atomicity &amp;amp; Rollback&lt;br&gt;
*&lt;br&gt;
Suppose we want to transfer 500 from Alice to Bob. Using a transaction ensures that either both operations succeed or none.&lt;/p&gt;

&lt;p&gt;START TRANSACTION;&lt;/p&gt;

&lt;p&gt;UPDATE Accounts&lt;br&gt;
SET balance = balance - 500&lt;br&gt;
WHERE name = 'Alice';&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%2F9wikgmn52ufba4m45o3t.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%2F9wikgmn52ufba4m45o3t.png" alt=" " width="800" height="508"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;ROLLBACK;&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%2Fonekni0m4306bvnguixj.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%2Fonekni0m4306bvnguixj.png" alt=" " width="800" height="492"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;UPDATE Accounts&lt;br&gt;
SET balance = balance + 500&lt;br&gt;
WHERE name = 'Bob';&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%2F7hshc0keqvcyr6jfgm78.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%2F7hshc0keqvcyr6jfgm78.png" alt=" " width="800" height="489"&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%2F3i76e8rjvcua6pcnjinp.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%2F3i76e8rjvcua6pcnjinp.png" alt=" " width="788" height="769"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Deadlock Simulation&lt;/p&gt;

&lt;p&gt;Deadlocks occur when two transactions block each other waiting for resources.&lt;/p&gt;

&lt;p&gt;START TRANSACTION;&lt;br&gt;
SELECT * FROM Accounts WHERE name='Alice' FOR UPDATE;&lt;br&gt;
UPDATE Accounts SET balance = balance + 100 WHERE name='Bob';&lt;/p&gt;

&lt;p&gt;START TRANSACTION;&lt;br&gt;
SELECT * FROM Accounts WHERE name='Bob' FOR UPDATE;&lt;br&gt;
UPDATE Accounts SET balance = balance - 100 WHERE name='Alice';&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%2Fof81xabn6fs6k8zxkg0n.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%2Fof81xabn6fs6k8zxkg0n.png" alt=" " width="800" height="484"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;RESULT&lt;br&gt;
ERROR 1213 (40001): Deadlock found when trying to get lock; try restarting transaction&lt;/p&gt;

&lt;p&gt;Log-Based Recovery&lt;/p&gt;

&lt;p&gt;Modern DBMS (MySQL/PostgreSQL) automatically maintain transaction logs. These logs help undo changes if a transaction fails.&lt;/p&gt;

&lt;p&gt;UPDATE Accounts SET balance = balance - 300 WHERE name='Alice';&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%2Ftba9goh4w2wyayqu4t1i.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%2Ftba9goh4w2wyayqu4t1i.png" alt=" " width="800" height="579"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;SELECT * FROM Accounts;&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%2Fziozcol2ut35sobrgmf3.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%2Fziozcol2ut35sobrgmf3.png" alt=" " width="800" height="693"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Log-based recovery ensures that undo operations are possible. Even if the database crashes, the system can restore a consistent state.&lt;/p&gt;

&lt;p&gt;Summary:&lt;/p&gt;

&lt;p&gt;Transactions guarantee atomicity; either all operations succeed or none.&lt;/p&gt;

&lt;p&gt;Deadlocks occur when transactions block each other; they must be handled with care.&lt;/p&gt;

&lt;p&gt;Log-based recovery ensures durability and recoverability.&lt;/p&gt;

</description>
      <category>database</category>
      <category>sql</category>
      <category>programming</category>
      <category>beginners</category>
    </item>
    <item>
      <title>ACID PROPERTIES</title>
      <dc:creator>srivishal</dc:creator>
      <pubDate>Sun, 05 Oct 2025 19:42:16 +0000</pubDate>
      <link>https://forem.com/srivishal_b2975898351fa2b/acid-properties-551h</link>
      <guid>https://forem.com/srivishal_b2975898351fa2b/acid-properties-551h</guid>
      <description>&lt;p&gt;Databases power almost every application we use daily—from banking systems to e-commerce platforms. To ensure data remains reliable, databases follow the ACID principles: Atomicity, Consistency, Isolation, and Durability.&lt;/p&gt;

&lt;p&gt;In this blog, we’ll demonstrate ACID properties with SQL transactions using a simple Loan Management example.&lt;/p&gt;

&lt;p&gt;Step 1: Setup the Schema&lt;/p&gt;

&lt;p&gt;We’ll create a Loans table that stores customer loan detail&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%2Fxrl93hw03j55wp3bswtz.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%2Fxrl93hw03j55wp3bswtz.png" alt=" " width="800" height="493"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Enter the values to be inserted in the table&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%2Fdu9y180b9mceqbvg34bm.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%2Fdu9y180b9mceqbvg34bm.png" alt=" " width="800" height="493"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Check the result&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%2F3dfrhvlf90hv1dk3hb7m.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%2F3dfrhvlf90hv1dk3hb7m.png" alt=" " width="800" height="495"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;ATOMICITY&lt;br&gt;
All operations in a transaction must succeed or none should.&lt;/p&gt;

&lt;p&gt;Update and roll back&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%2F3q61pl6as8o0j7mcsnvq.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%2F3q61pl6as8o0j7mcsnvq.png" alt=" " width="800" height="564"&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%2F1voes6oxixfki2ymnr30.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%2F1voes6oxixfki2ymnr30.png" alt=" " width="800" height="536"&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%2Fjes07dysbznrosi7gzo8.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%2Fjes07dysbznrosi7gzo8.png" alt=" " width="800" height="523"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Atomicity ensures no partial updates happen.&lt;/p&gt;

&lt;p&gt;Consistency&lt;/p&gt;

&lt;p&gt;Transactions must bring the database from one valid state to another. Invalid data should not enter the system.&lt;/p&gt;

&lt;p&gt;Alter&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%2Fmer3yhqebe3y694pae9v.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%2Fmer3yhqebe3y694pae9v.png" alt=" " width="800" height="546"&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%2F4pn73ajuqno5sumch4c8.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%2F4pn73ajuqno5sumch4c8.png" alt=" " width="800" height="541"&gt;&lt;/a&gt;&lt;br&gt;
Consistency ensures only valid data enters the database.&lt;/p&gt;

&lt;p&gt;Isolation&lt;/p&gt;

&lt;p&gt;Concurrent transactions should not affect each other’s intermediate results.&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%2F099qyg3lwbbel0tdyc4k.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%2F099qyg3lwbbel0tdyc4k.png" alt=" " width="800" height="505"&gt;&lt;/a&gt;&lt;br&gt;
Isolation prevents dirty reads between transactions.&lt;/p&gt;

&lt;p&gt;Durability&lt;/p&gt;

&lt;p&gt;Once a transaction is committed, the changes must persist—even if the database crashes.&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%2Fv27c3vimzv5uepule1it.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%2Fv27c3vimzv5uepule1it.png" alt=" " width="800" height="563"&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%2Fw6365ocdawnmvobfiv1e.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%2Fw6365ocdawnmvobfiv1e.png" alt=" " width="800" height="556"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Durability guarantees committed data survives restarts.&lt;/p&gt;

&lt;p&gt;Key Takeaways&lt;/p&gt;

&lt;p&gt;Atomicity → All or nothing.&lt;br&gt;
Consistency → Data always valid.&lt;br&gt;
Isolation → Transactions don’t interfere.&lt;br&gt;
Durability → Data persists after commit.&lt;br&gt;
By applying ACID principles, databases remain reliable, fault-tolerant, and consistent even in high-concurrency environments like banking systems.&lt;/p&gt;

</description>
      <category>sql</category>
      <category>webdev</category>
      <category>programming</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Indexing, Hashing, and Query</title>
      <dc:creator>srivishal</dc:creator>
      <pubDate>Sun, 05 Oct 2025 18:35:29 +0000</pubDate>
      <link>https://forem.com/srivishal_b2975898351fa2b/indexing-hashing-and-query-177m</link>
      <guid>https://forem.com/srivishal_b2975898351fa2b/indexing-hashing-and-query-177m</guid>
      <description>&lt;p&gt;Indexing involves creating a data structure (an index) that stores a small, ordered subset of data from a table, along with pointers to the full data records. When a query is executed, the DBMS can use this index to quickly locate the relevant data without scanning the entire table.&lt;/p&gt;

&lt;p&gt;Hashing uses a hash function to directly map data values to their physical storage locations on disk. Instead of traversing an index structure, the hash function calculates the address of the data based on its value.&lt;/p&gt;

&lt;p&gt;Create a table&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%2Fenuhvwhgg32spkwknhfb.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%2Fenuhvwhgg32spkwknhfb.png" alt=" " width="800" height="583"&gt;&lt;/a&gt;&lt;br&gt;
INSERT INTO Students VALUES&lt;br&gt;
(101, 'Arun', 'CSBS', 8.5),&lt;br&gt;
(102, 'Mathan', 'ECE', 8.8),&lt;br&gt;
(103, 'Karthik', 'MECH', 6.9),&lt;br&gt;
(104, 'Hareesh', 'CSE', 9.1),&lt;br&gt;
(105, 'Ravi', 'EEE', 7.2),&lt;br&gt;
(106, 'Srivishal', 'CSBS', 8.8),&lt;br&gt;
(107, 'Vignesh', 'IT', 8.0),&lt;br&gt;
(108, 'Harish', 'CSE', 9.3),&lt;br&gt;
(109, 'Deepak', 'ECE', 7.5),&lt;br&gt;
(110, 'Nidheesh', 'CSBS', 9.0),&lt;br&gt;
(111, 'Pradeep', 'MECH', 6.8),&lt;br&gt;
(112, 'Lokhitha', 'EEE', 7.6),&lt;br&gt;
(113, 'Raj', 'CSBS', 8.7),&lt;br&gt;
(114, 'Divya', 'IT', 8.4),&lt;br&gt;
(115, 'Saravanan', 'CSE', 9.2),&lt;br&gt;
(116, 'Monika', 'ECE', 7.9),&lt;br&gt;
(117, 'Ganesh', 'MECH', 6.7),&lt;br&gt;
(118, 'Kavya', 'CSBS', 9.1),&lt;br&gt;
(119, 'Surya', 'EEE', 7.3),&lt;br&gt;
(120, 'Anitha', 'IT', 8.2);&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%2Fp1n0ph2jw80yns0dv5r9.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%2Fp1n0ph2jw80yns0dv5r9.png" alt=" " width="598" height="699"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Create a B-Tree Index on roll_no&lt;br&gt;
CREATE INDEX idx_rollno ON Students(roll_no);&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%2Fogmwpqt7vsx1jr6jlyub.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%2Fogmwpqt7vsx1jr6jlyub.png" alt=" " width="712" height="556"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Query Using B-Tree Index&lt;/p&gt;

&lt;p&gt;SELECT * FROM Students WHERE roll_no = 110;&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%2Frezeqrxsfuwmkefworzm.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%2Frezeqrxsfuwmkefworzm.png" alt=" " width="800" height="586"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Create a B+ Tree Index on cgpa&lt;/p&gt;

&lt;p&gt;SELECT * FROM Students WHERE cgpa &amp;gt; 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%2Fupgegxvqalf8ap4is8hv.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%2Fupgegxvqalf8ap4is8hv.png" alt=" " width="800" height="640"&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%2Fx1q1t7e7mq49pu9idydg.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%2Fx1q1t7e7mq49pu9idydg.png" alt=" " width="800" height="657"&gt;&lt;/a&gt;&lt;br&gt;
Query Using 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%2Fmtbkgu8d61253a1nc8ud.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%2Fmtbkgu8d61253a1nc8ud.png" alt=" " width="800" height="654"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Indexing is generally preferred for queries involving range searches, sorting, or when frequent data modifications occur, as it offers more flexibility.&lt;br&gt;
Hashing is highly effective for exact-match queries (equality searches) and when the primary goal is fast, direct access to individual records.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>DBMS ATLAS STUDENT SCHEMA</title>
      <dc:creator>srivishal</dc:creator>
      <pubDate>Sun, 05 Oct 2025 18:25:45 +0000</pubDate>
      <link>https://forem.com/srivishal_b2975898351fa2b/dbms-atlas-student-schema-3og7</link>
      <guid>https://forem.com/srivishal_b2975898351fa2b/dbms-atlas-student-schema-3og7</guid>
      <description>&lt;p&gt;In this blog, We’ll walk through &lt;strong&gt;CRUD&lt;/strong&gt; operations (&lt;strong&gt;Create, Read, Update, Delete&lt;/strong&gt;) in MongoDB using a simple example: a student database. We’ll insert student details, query them, update academic information, and even delete records.&lt;/p&gt;

&lt;p&gt;To make it more exciting, we’ll run these queries directly on &lt;strong&gt;MongoDB Atlas Cluster&lt;/strong&gt; (cloud-based MongoDB). Along the way, I’ll include screenshots of my MongoDB Atlas dashboard and outputs so you can follow along visually.&lt;br&gt;
Outcome:-&lt;/p&gt;

&lt;p&gt;How to insert multiple documents into a collection&lt;br&gt;
How to read and filter records using queries&lt;br&gt;
How to update documents (single &amp;amp; multiple)&lt;br&gt;
How to delete documents based on conditions&lt;br&gt;
How CRUD fits into real-world development&lt;br&gt;
&lt;strong&gt;Create (Insert):-&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Insert at least 5 student records into the students collection.&lt;/p&gt;

&lt;p&gt;We cannot start by inserting 5 student records into our students collection together. We can create each student as separate document.&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%2F3zv5et2jyzgvou04ezd3.jpg" 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%2F3zv5et2jyzgvou04ezd3.jpg" alt=" " width="800" height="451"&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%2Fjkyglk0tw3bt82mgl0ou.jpg" 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%2Fjkyglk0tw3bt82mgl0ou.jpg" alt=" " width="800" height="451"&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%2Fddd2s2solxze84fnohx2.jpg" 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%2Fddd2s2solxze84fnohx2.jpg" alt=" " width="800" height="451"&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%2Frpo9myx1l6p88vctk3wi.jpg" 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%2Frpo9myx1l6p88vctk3wi.jpg" alt=" " width="800" height="451"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;READ(QUERY)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Find all students with CGPA &amp;gt; 8.&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%2Fdn45z8hvv8m5n26j20zk.jpg" 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%2Fdn45z8hvv8m5n26j20zk.jpg" alt=" " width="800" height="451"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Update the CGPA of a specific student.&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%2F1id4y1xevs0sff6sz7tz.jpg" 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%2F1id4y1xevs0sff6sz7tz.jpg" alt=" " width="800" height="451"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Delete:-&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Delete one student record by student_id.&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%2Flpvngq258wt1a9uj9uf3.jpg" 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%2Flpvngq258wt1a9uj9uf3.jpg" alt=" " width="800" height="451"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion:-&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In this blog, we explored how to perform CRUD operations in MongoDB using a real-world example of a student database. Starting from inserting records, querying based on conditions, updating multiple documents, and finally deleting specific records – we’ve covered the foundation of working with MongoDB.&lt;/p&gt;

&lt;p&gt;CRUD operations form the building blocks of every application, whether you’re managing users in a website, products in an e-commerce app, or students in a college system.&lt;/p&gt;

</description>
      <category>database</category>
      <category>mongodb</category>
      <category>cloud</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>CURSOR AND TRIGGER</title>
      <dc:creator>srivishal</dc:creator>
      <pubDate>Sun, 05 Oct 2025 17:58:54 +0000</pubDate>
      <link>https://forem.com/srivishal_b2975898351fa2b/cursor-and-trigger-4clj</link>
      <guid>https://forem.com/srivishal_b2975898351fa2b/cursor-and-trigger-4clj</guid>
      <description>&lt;p&gt;A cursor in a Database Management System (DBMS) is a special control structure that enables traversal over the records in a result set obtained by executing a query. Unlike traditional SQL statements that operate on the entire set of rows simultaneously, a cursor allows row-by-row retrieval and processing of data. This makes it particularly useful when fine-grained, sequential manipulation of query results is required, such as performing conditional checks, applying calculations, or handling complex business logic on each individual row.&lt;/p&gt;

&lt;p&gt;CREATE TABLE Employee (&lt;br&gt;
EmpID INT PRIMARY KEY,&lt;br&gt;
EmpName VARCHAR(50),&lt;br&gt;
Salary INT&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%2F9n7zf2hojrukc1iv4izx.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%2F9n7zf2hojrukc1iv4izx.png" alt=" " width="800" height="630"&gt;&lt;/a&gt;&lt;br&gt;
INSERT INTO Employee VALUES&lt;br&gt;
(1, 'Arjun', 45000),&lt;br&gt;
(2, 'Priya', 60000),&lt;br&gt;
(3, 'Kiran', 75000),&lt;br&gt;
(4, 'Meera', 48000),&lt;br&gt;
(5, 'Rahul', 90000);&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%2F0al3v6vbhbl2jfrlzr8h.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%2F0al3v6vbhbl2jfrlzr8h.png" alt=" " width="800" height="631"&gt;&lt;/a&gt;&lt;br&gt;
OUTPUT&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%2Fsqigawch8kq8zqj3jjve.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%2Fsqigawch8kq8zqj3jjve.png" alt=" " width="800" height="630"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Cursor Code (Employees with Salary &amp;gt; 50,000)&lt;/strong&gt;&lt;br&gt;
DECLARE&lt;br&gt;
CURSOR high_salary_cursor IS&lt;br&gt;
SELECT EmpName FROM Employee WHERE Salary &amp;gt; 50000;&lt;br&gt;
v_name Employee.EmpName%TYPE;&lt;br&gt;
BEGIN&lt;br&gt;
OPEN high_salary_cursor;&lt;br&gt;
LOOP&lt;br&gt;
FETCH high_salary_cursor INTO v_name;&lt;br&gt;
EXIT WHEN high_salary_cursor%NOTFOUND;&lt;br&gt;
DBMS_OUTPUT.PUT_LINE('Employee: ' || v_name);&lt;br&gt;
END LOOP;&lt;br&gt;
CLOSE high_salary_cursor;&lt;br&gt;
END;&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%2Ftzjaxc8fprt6veba34ad.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%2Ftzjaxc8fprt6veba34ad.png" alt=" " width="800" height="642"&gt;&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;Trigger Example (AFTER INSERT Trigger)&lt;/strong&gt;&lt;br&gt;
Create Student and Audit Tables&lt;br&gt;
CREATE TABLE Studt (&lt;br&gt;
StudentID VARCHAR(10) PRIMARY KEY,&lt;br&gt;
StudentName VARCHAR(50)&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%2F4xt3nb390c5c1a75tnzc.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%2F4xt3nb390c5c1a75tnzc.png" alt=" " width="800" height="597"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;CREATE TABLE Student_Audit (&lt;br&gt;
AuditID INT GENERATED ALWAYS AS IDENTITY PRIMARY KEY,&lt;br&gt;
StudentID VARCHAR(10),&lt;br&gt;
StudentName VARCHAR(50),&lt;br&gt;
ActionDate TIMESTAMP DEFAULT CURRENT_TIMESTAMP&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%2Fwo7p0il46scuufvjgj06.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%2Fwo7p0il46scuufvjgj06.png" alt=" " width="800" height="630"&gt;&lt;/a&gt;&lt;br&gt;
Create AFTER INSERT Trigger&lt;br&gt;
CREATE OR REPLACE TRIGGER student_insert_audit&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, StudentName)&lt;br&gt;
VALUES (:NEW.StudentID, :NEW.StudentName);&lt;br&gt;
END;&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%2Fj3q7llx6r830d1iw82yr.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%2Fj3q7llx6r830d1iw82yr.png" alt=" " width="800" height="640"&gt;&lt;/a&gt;&lt;br&gt;
Insert Data into Studt&lt;br&gt;
INSERT INTO Students VALUES ('S01', 'Arjun');&lt;br&gt;
INSERT INTO Students VALUES ('S02', 'Priya');&lt;br&gt;
INSERT INTO Students VALUES ('S03', 'Kiran');&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%2Fvj36pw47jl5zugie1ew2.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%2Fvj36pw47jl5zugie1ew2.png" alt=" " width="800" height="215"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>database</category>
      <category>sql</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>NORMALIZATION</title>
      <dc:creator>srivishal</dc:creator>
      <pubDate>Sun, 05 Oct 2025 17:33:20 +0000</pubDate>
      <link>https://forem.com/srivishal_b2975898351fa2b/normalization-gnp</link>
      <guid>https://forem.com/srivishal_b2975898351fa2b/normalization-gnp</guid>
      <description>&lt;p&gt;&lt;strong&gt;Guide to Database Normalization (1NF → 3NF)&lt;/strong&gt;&lt;br&gt;
Normalization is the art of organizing data efficiently — avoiding redundancy and ensuring consistency.&lt;br&gt;
In this post, we’ll break down how to transform an unorganized student-course dataset into its 1NF, 2NF, and 3NF forms step by step with SQL code and outputs.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Identify Anomalies&lt;/strong&gt;&lt;br&gt;
Insertion anomaly:&lt;br&gt;
Can’t insert a new course unless a student enrolls.&lt;/p&gt;

&lt;p&gt;Update anomaly:&lt;br&gt;
If Dr. Kumar’s phone number changes, we must update multiple rows.&lt;/p&gt;

&lt;p&gt;Deletion anomaly:&lt;br&gt;
If student S02 drops the course, we lose info about the DBMS course entirely.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Raw Table — 1NF (First Normal Form)&lt;/strong&gt;&lt;br&gt;
In the beginning, everything lives in one big table — students, courses, instructors, and even phone numbers.&lt;br&gt;
Creation of table&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%2Fegx6ong7ltx4k4i8dbw9.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%2Fegx6ong7ltx4k4i8dbw9.png" alt=" " width="800" height="628"&gt;&lt;/a&gt;&lt;br&gt;
Insertion of 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%2Ferotoo27e6h1nyx1lwtd.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%2Ferotoo27e6h1nyx1lwtd.png" alt=" " width="800" height="626"&gt;&lt;/a&gt;&lt;br&gt;
Output&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%2F90yade3ptrj3lmb01shc.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%2F90yade3ptrj3lmb01shc.png" alt=" " width="800" height="599"&gt;&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;2NF (Second Normal Form)&lt;/strong&gt;&lt;br&gt;
To fix redundancy, we break our data into four tables:&lt;br&gt;
Create separate tables for Students, Courses, Instructors, Studentcourses.&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%2Fxf5h72ddrb0g6is7l89s.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%2Fxf5h72ddrb0g6is7l89s.png" alt=" " width="800" height="596"&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%2Fqkpye0znuk0k0ohkkfno.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%2Fqkpye0znuk0k0ohkkfno.png" alt=" " width="800" height="631"&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%2F0rz0ians0ra2tqs3um7t.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%2F0rz0ians0ra2tqs3um7t.png" alt=" " width="800" height="652"&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%2Fks8v3ne8xzn90hw7v9o1.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%2Fks8v3ne8xzn90hw7v9o1.png" alt=" " width="800" height="664"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Insertion of values&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%2F4utksy1kp3yb40qe9z7b.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%2F4utksy1kp3yb40qe9z7b.png" alt=" " width="800" height="630"&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%2Fir5zlkrix72nay9zaht9.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%2Fir5zlkrix72nay9zaht9.png" alt=" " width="800" height="658"&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%2Fdd752ydji7ohh4a7qgzq.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%2Fdd752ydji7ohh4a7qgzq.png" alt=" " width="800" height="551"&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%2Fc7zkvub1op9z3zt63n0p.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%2Fc7zkvub1op9z3zt63n0p.png" alt=" " width="800" height="637"&gt;&lt;/a&gt;&lt;br&gt;
Output&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%2F7h9wpg1rqw2e32yta890.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%2F7h9wpg1rqw2e32yta890.png" alt=" " width="656" height="655"&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%2Fdty02d51yvfdnh9jntq9.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%2Fdty02d51yvfdnh9jntq9.png" alt=" " width="617" height="628"&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%2Fxu8vr42r4ut8y97estlm.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%2Fxu8vr42r4ut8y97estlm.png" alt=" " width="614" height="650"&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%2Fzjqt2nil6ar0h9622we2.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%2Fzjqt2nil6ar0h9622we2.png" alt=" " width="533" height="644"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Convert to 3NF (Third Normal Form)&lt;/strong&gt;&lt;br&gt;
Remove transitive dependency (non-key attributes shouldn’t depend on other non-keys).&lt;/p&gt;

&lt;p&gt;👉 In our case, the InstructorPhone depends on Instructor, not directly on Course.&lt;br&gt;
So we already separated Instructors, which makes this 3NF compliant.&lt;/p&gt;

&lt;p&gt;Final tables in 3NF:&lt;/p&gt;

&lt;p&gt;Students(StudentID, StudentName)&lt;br&gt;
Instructors(Instructor, InstructorPhone)&lt;br&gt;
Courses(CourseID, CourseName, Instructor)&lt;br&gt;
StudentCourses(StudentID, CourseID)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;JOIN: Combine Everything&lt;/strong&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%2Fldk8u2s0ltgr9w0cz4xz.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%2Fldk8u2s0ltgr9w0cz4xz.png" alt=" " width="800" height="610"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why Normalization Matters&lt;/strong&gt;&lt;br&gt;
Prevents data redundancy&lt;br&gt;
Improves data consistency&lt;br&gt;
Makes updates easier and safer&lt;br&gt;
Ensures relational integrity&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key Takeaway&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Database normalization is not just a theory — it’s what keeps your database organized, clean, and scalable.&lt;br&gt;
Every efficient application you use today, from Instagram to banking apps, relies on normalized relational databases underneath.&lt;/p&gt;

</description>
      <category>database</category>
      <category>sql</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>College Student &amp; Course Management System</title>
      <dc:creator>srivishal</dc:creator>
      <pubDate>Thu, 21 Aug 2025 05:20:22 +0000</pubDate>
      <link>https://forem.com/srivishal_b2975898351fa2b/college-student-course-management-system-3alo</link>
      <guid>https://forem.com/srivishal_b2975898351fa2b/college-student-course-management-system-3alo</guid>
      <description>&lt;p&gt;As a beginner in software development, I wanted to explore how technology can simplify college life. In this blog, I’ll share my project on a College Student &amp;amp; Course Management System, where I learned how to manage student details, course enrollments, and department records using SQL and basic programming concepts. This project not only improved my coding skills but also helped me understand how real-world systems are designed to make administration easier.&lt;/p&gt;

&lt;h2&gt;
  
  
  CREATE TABLE
&lt;/h2&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%2Fo2hcp1f66pqbttksf8vc.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%2Fo2hcp1f66pqbttksf8vc.png" alt=" " width="800" height="451"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  ALTER TABLE
&lt;/h2&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%2Fpw6n9hf123px18j00831.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%2Fpw6n9hf123px18j00831.png" alt=" " width="800" height="451"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  SELECT
&lt;/h2&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%2Feegn9r5unrdeabb0n681.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%2Feegn9r5unrdeabb0n681.png" alt=" " width="800" height="451"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  INSERT TABLE
&lt;/h2&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%2F80o72ydhga2h7vm76u0o.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%2F80o72ydhga2h7vm76u0o.png" alt=" " width="800" height="451"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  GROUP BY HAVING
&lt;/h2&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%2Fg5ty819myamq6sspkqpz.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%2Fg5ty819myamq6sspkqpz.png" alt=" " width="800" height="451"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>database</category>
    </item>
  </channel>
</rss>
