<?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>DEV Community: Pavithra Sai</title>
    <description>The latest articles on DEV Community by Pavithra Sai (@sai_cf536f1c0eefb673310c5).</description>
    <link>https://dev.to/sai_cf536f1c0eefb673310c5</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%2F3542918%2Fe21845b3-eb52-4626-83b4-b7b8e90b535a.png</url>
      <title>DEV Community: Pavithra Sai</title>
      <link>https://dev.to/sai_cf536f1c0eefb673310c5</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sai_cf536f1c0eefb673310c5"/>
    <language>en</language>
    <item>
      <title>DES Encryption Explained Simply</title>
      <dc:creator>Pavithra Sai</dc:creator>
      <pubDate>Tue, 06 Jan 2026 15:35:23 +0000</pubDate>
      <link>https://dev.to/sai_cf536f1c0eefb673310c5/des-encryption-explained-simply-54af</link>
      <guid>https://dev.to/sai_cf536f1c0eefb673310c5/des-encryption-explained-simply-54af</guid>
      <description>&lt;h2&gt;
  
  
  &lt;strong&gt;INTRODUCTION&lt;/strong&gt;
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Cryptography is used everywhere today — from passwords to secure messages.
One of the earliest and most popular encryption algorithms is DES
(Data Encryption Standard).

In this blog, I will explain DES in a very simple way,
using easy language, screenshots from code, and clear diagrams.
Even beginners can understand how DES works.

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  &lt;strong&gt;WHAT IS DES?&lt;/strong&gt;
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;DES (Data Encryption Standard) is a symmetric key encryption algorithm.
This means the same secret key is used for both encryption and decryption.

DES was developed in the 1970s and works on fixed-size data blocks.
Even though DES is no longer considered secure today,
it is very important to understand it for learning cryptography basics.

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  &lt;strong&gt;BASIC DETAILS OF DES&lt;/strong&gt;
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;• Type: Symmetric key encryption  
• Block size: 64 bits  
• Key size: 56 bits  
• Number of rounds: 16  

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  &lt;strong&gt;HOW DES WORKS&lt;/strong&gt;
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;DES works by repeatedly mixing the data using a secret key.
The input text is split into two halves and processed for 16 rounds.
Each round increases confusion and diffusion,
making the encrypted data difficult to understand without the key.

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  &lt;strong&gt;STEP-BY-STEP WORKING OF DES&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Plain Text Input&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;DES takes 64 bits of plain text as input.
This text is divided into two equal halves:
Left (32 bits) and Right (32 bits).

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&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%2F4alygk352z3ki1bgybow.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%2F4alygk352z3ki1bgybow.png" alt=" " width="373" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;One DES Round&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Each DES round follows the same pattern:

1. The Right part is processed using a function called f().
2. The output of f() is XORed with the Left part.
3. The Left and Right parts are swapped.

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Formula&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;New Left  = Old Right
New Right = Old Left XOR f(Old Right, Key)

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&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%2Fhr0d0sd797obiskhhbta.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%2Fhr0d0sd797obiskhhbta.png" alt=" " width="800" height="469"&gt;&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;Why 16 Rounds&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;DES repeats the same process 16 times.
Each round increases security by mixing the data further.
After 16 rounds, the final output becomes the cipher text.

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  &lt;strong&gt;ENCRYPTION PROCESS&lt;/strong&gt;
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Below is a simple demonstration of DES encryption.
The same plain text and key always produce the same cipher text.

&lt;/code&gt;&lt;/pre&gt;

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

&lt;h2&gt;
  
  
  &lt;strong&gt;DECRYPTION PROCESS&lt;/strong&gt;
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;DES decryption uses the same algorithm in reverse order.
The same secret key is required to recover the original plain text.

&lt;/code&gt;&lt;/pre&gt;

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

&lt;h2&gt;
  
  
  &lt;strong&gt;ENCRYPTION vs DECRYPTION&lt;/strong&gt;
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;| Feature | Encryption      | Decryption      |
|         |                 |                 |
| Input   | Plain Text      | Cipher Text     |
| Key     | Same Secret Key | Same Secret Key |
| Output  | Cipher Text     | Plain Text      |

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  &lt;strong&gt;LIMITATIONS OF DES&lt;/strong&gt;
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;• Small key size (56 bits)
• Vulnerable to brute-force attacks
• No longer secure for modern applications

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  &lt;strong&gt;DES vs MODERN ALGORITHMS&lt;/strong&gt;
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Due to its weaknesses, DES has been replaced by stronger algorithms like AES.
However, DES is still widely taught for understanding
the foundations of encryption systems.

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  &lt;strong&gt;CONCLUSION&lt;/strong&gt;
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;DES is a classic encryption algorithm that helps beginners
understand how block ciphers work.
While it should not be used in real-world security today,
learning DES provides a strong base for understanding modern cryptography.

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>des</category>
      <category>encryption</category>
      <category>decryption</category>
      <category>cryptography</category>
    </item>
    <item>
      <title>Polly – Amazon Polly Convert Text into Natural Speech Using AWS</title>
      <dc:creator>Pavithra Sai</dc:creator>
      <pubDate>Thu, 18 Dec 2025 16:42:29 +0000</pubDate>
      <link>https://dev.to/sai_cf536f1c0eefb673310c5/amazon-polly-convert-text-into-natural-speech-using-aws-ndf</link>
      <guid>https://dev.to/sai_cf536f1c0eefb673310c5/amazon-polly-convert-text-into-natural-speech-using-aws-ndf</guid>
      <description>&lt;h2&gt;
  
  
  Description:
&lt;/h2&gt;

&lt;p&gt;Learn how Amazon Polly, an AWS service, converts text into lifelike speech using artificial intelligence.&lt;br&gt;
&lt;strong&gt;tags:&lt;/strong&gt; aws, cloud, ai, devops&lt;/p&gt;

&lt;h2&gt;
  
  
  Amazon Polly – Text to Speech Made Easy
&lt;/h2&gt;

&lt;p&gt;In modern applications, voice-based interaction is becoming very common.&lt;br&gt;&lt;br&gt;
From virtual assistants to accessibility tools, speech plays a major role.&lt;br&gt;&lt;br&gt;
&lt;strong&gt;Amazon Polly&lt;/strong&gt; is an AWS service that helps convert &lt;strong&gt;text into natural-sounding speech&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Amazon Polly?
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Amazon Polly&lt;/strong&gt; is a &lt;strong&gt;Text-to-Speech (TTS)&lt;/strong&gt; service provided by &lt;strong&gt;Amazon Web Services (AWS)&lt;/strong&gt;.&lt;br&gt;&lt;br&gt;
It uses advanced &lt;strong&gt;machine learning and deep learning&lt;/strong&gt; technologies to generate realistic human voices.&lt;/p&gt;

&lt;p&gt;With Polly, developers can easily add &lt;strong&gt;speech capability&lt;/strong&gt; to their applications.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Use Amazon Polly?
&lt;/h2&gt;

&lt;p&gt;Traditional voice recording:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Time-consuming &lt;/li&gt;
&lt;li&gt;Difficult to update &lt;/li&gt;
&lt;li&gt;Not scalable &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;With Amazon Polly:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;No manual voice recording&lt;/li&gt;
&lt;li&gt;Multiple languages &amp;amp; voices&lt;/li&gt;
&lt;li&gt;Scalable &amp;amp; fast&lt;/li&gt;
&lt;li&gt;Pay only for what you use&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  How Amazon Polly Works
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Input text is provided to Polly&lt;/li&gt;
&lt;li&gt;Select language and voice&lt;/li&gt;
&lt;li&gt;Polly converts text into speech&lt;/li&gt;
&lt;li&gt;Output is an audio file (MP3, WAV, etc.)&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Key Features of Amazon Polly
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Supports &lt;strong&gt;30+ languages&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Multiple &lt;strong&gt;male &amp;amp; female voices&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Neural Text-to-Speech (NTTS)&lt;/li&gt;
&lt;li&gt;Real-time and batch processing&lt;/li&gt;
&lt;li&gt;Supports SSML (Speech Synthesis Markup Language)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Real-Time Use Cases
&lt;/h2&gt;

&lt;p&gt;Amazon Polly is widely used in:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Voice assistants&lt;/li&gt;
&lt;li&gt;E-learning platforms&lt;/li&gt;
&lt;li&gt;Accessibility applications&lt;/li&gt;
&lt;li&gt;News readers&lt;/li&gt;
&lt;li&gt;IVR systems&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Amazon Polly in AWS Ecosystem
&lt;/h2&gt;

&lt;p&gt;Amazon Polly integrates well with:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;AWS Lambda&lt;/li&gt;
&lt;li&gt;Amazon S3&lt;/li&gt;
&lt;li&gt;Amazon Transcribe&lt;/li&gt;
&lt;li&gt;Amazon Lex&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This makes it ideal for &lt;strong&gt;serverless and AI-based applications&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Advantages of Amazon Polly
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Improves user experience&lt;/li&gt;
&lt;li&gt;Easy to integrate using AWS SDKs&lt;/li&gt;
&lt;li&gt;No infrastructure management&lt;/li&gt;
&lt;li&gt;Highly reliable and scalable&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Limitations
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Requires internet connectivity&lt;/li&gt;
&lt;li&gt;Cost depends on characters processed&lt;/li&gt;
&lt;li&gt;Advanced voices cost slightly more&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Amazon Polly is a powerful AWS service that brings &lt;strong&gt;voice to applications&lt;/strong&gt;.&lt;br&gt;&lt;br&gt;
It helps developers build interactive, accessible, and intelligent systems with minimal effort.&lt;/p&gt;

&lt;p&gt;For anyone exploring &lt;strong&gt;AWS, Cloud, or AI services&lt;/strong&gt;, Amazon Polly is worth learning.&lt;/p&gt;

&lt;p&gt;My sincere thanks to &lt;a class="mentioned-user" href="https://dev.to/santhoshnc"&gt;@santhoshnc&lt;/a&gt; for giving this assignment, which helped me learn about Amazon Polly and AWS services.&lt;/p&gt;

&lt;h2&gt;
  
  
  🔗 References
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://docs.aws.amazon.com/polly/" rel="noopener noreferrer"&gt;Amazon Polly – Official AWS Documentation&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
    <item>
      <title>Packer in DevOps – Build Once, Deploy Anywhere</title>
      <dc:creator>Pavithra Sai</dc:creator>
      <pubDate>Thu, 18 Dec 2025 16:12:50 +0000</pubDate>
      <link>https://dev.to/sai_cf536f1c0eefb673310c5/packer-in-devops-build-once-deploy-anywhere-28oe</link>
      <guid>https://dev.to/sai_cf536f1c0eefb673310c5/packer-in-devops-build-once-deploy-anywhere-28oe</guid>
      <description>&lt;h2&gt;
  
  
  Description:
&lt;/h2&gt;

&lt;p&gt;Learn how HashiCorp Packer helps DevOps engineers automate machine image creation for cloud and CI/CD pipelines. &lt;br&gt;
In DevOps, consistency and automation are very important.&lt;br&gt;&lt;br&gt;
Manual server setup often leads to errors and time waste.&lt;br&gt;&lt;br&gt;
This is where &lt;strong&gt;Packer&lt;/strong&gt; helps us.&lt;br&gt;
&lt;strong&gt;Tags:&lt;/strong&gt; devops, packer, cloud, automation&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Console Link:&lt;/strong&gt; &lt;a href="https://developer.hashicorp.com/packer" rel="noopener noreferrer"&gt;Official Packer Documentation&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Packer?
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Packer&lt;/strong&gt; is an open-source tool developed by &lt;strong&gt;HashiCorp&lt;/strong&gt;.&lt;br&gt;&lt;br&gt;
It is used to create &lt;strong&gt;machine images automatically&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Using Packer, we can build:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;AWS AMIs&lt;/li&gt;
&lt;li&gt;Azure VM Images&lt;/li&gt;
&lt;li&gt;Google Cloud Images&lt;/li&gt;
&lt;li&gt;Docker Images&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Once an image is built, it can be reused anywhere.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Do We Need Packer?
&lt;/h2&gt;

&lt;p&gt;Traditional approach:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Manual server configuration &lt;/li&gt;
&lt;li&gt;Configuration mismatch &lt;/li&gt;
&lt;li&gt;Slow deployments &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;With Packer:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt; Consistent images&lt;/li&gt;
&lt;li&gt; Faster provisioning&lt;/li&gt;
&lt;li&gt; Automation friendly&lt;/li&gt;
&lt;li&gt; Works well with CI/CD&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  How Packer Works
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Write a Packer configuration file (&lt;code&gt;.pkr.hcl&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;Choose a base OS image&lt;/li&gt;
&lt;li&gt;Use provisioners (Shell, Ansible, etc.)&lt;/li&gt;
&lt;li&gt;Run &lt;code&gt;packer build&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Get a ready-to-use image&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Real-Time Example
&lt;/h2&gt;

&lt;p&gt;Imagine launching multiple EC2 instances with the same software.&lt;/p&gt;

&lt;p&gt;Without Packer:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Manual setup for every server&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;With Packer:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Build AMI once&lt;/li&gt;
&lt;li&gt;Launch multiple EC2 instances instantly&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  🙏 Acknowledgement
&lt;/h2&gt;

&lt;p&gt;I would like to sincerely thank &lt;a class="mentioned-user" href="https://dev.to/santhoshnc"&gt;@santhoshnc&lt;/a&gt; for giving this assignment.&lt;br&gt;&lt;br&gt;
This task helped me explore &lt;strong&gt;Packer as a DevOps tool&lt;/strong&gt; and understand how image automation plays a crucial role in real-world DevOps workflows.&lt;/p&gt;

&lt;p&gt;The assignment motivated me to learn beyond theory and apply concepts practically.&lt;br&gt;&lt;br&gt;
Thank you, sir, for the guidance and encouragement.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sample Packer Configuration
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
hcl
source "amazon-ebs" "example" {
  region        = "ap-south-1"
  instance_type = "t2.micro"
  ami_name      = "packer-demo-ami"
  source_ami    = "ami-xxxxxxxx"
  ssh_username  = "ubuntu"
}

build {
  sources = ["source.amazon-ebs.example"]

  provisioner "shell" {
    inline = [
      "sudo apt update",
      "sudo apt install nginx -y"
    ]
  }
}




&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>automation</category>
      <category>cloud</category>
      <category>devops</category>
    </item>
    <item>
      <title>MongoDB - Blog</title>
      <dc:creator>Pavithra Sai</dc:creator>
      <pubDate>Fri, 03 Oct 2025 10:35:09 +0000</pubDate>
      <link>https://dev.to/sai_cf536f1c0eefb673310c5/mongodb-blog-mm9</link>
      <guid>https://dev.to/sai_cf536f1c0eefb673310c5/mongodb-blog-mm9</guid>
      <description>&lt;h2&gt;
  
  
  Hands-On CRUD Operations in MongoDB Using a Student Schema
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;MongoDB is a popular NoSQL database that stores data in flexible, JSON-like documents rather than traditional tables. In this tutorial, we’ll explore CRUD operations (Create, Read, Update, Delete) using a simple college student schema. By the end, you’ll be comfortable performing these operations in MongoDB Atlas.&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%2F4eka8y9vo1p3o4x2b8ni.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%2F4eka8y9vo1p3o4x2b8ni.png" alt=" " width="800" height="380"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Student Schema&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Each student document follows this structure:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "student_id": "S001",
  "name": "Santhosh",
  "age": 20,
  "department": "CSBS",
  "year": 2,
  "cgpa": 9
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We will use a collection called students to store these documents.&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%2F9bim47zmwf19jkqtuqkm.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%2F9bim47zmwf19jkqtuqkm.png" alt=" " width="800" height="379"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  1️⃣ Create (Insert) Students
&lt;/h2&gt;

&lt;p&gt;We’ll insert 5 student records into the students collection.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  { "student_id": "S001", "name": "Santhosh", "age": 20, "department": "CSBS", "year": 2, "cgpa": 9 },
  { "student_id": "S002", "name": "Kiran", "age": 21, "department": "CSE", "year": 3, "cgpa": 8.5 },
  { "student_id": "S003", "name": "Anita", "age": 19, "department": "ECE", "year": 2, "cgpa": 7.8 },
  { "student_id": "S004", "name": "Ramesh", "age": 22, "department": "CSE", "year": 3, "cgpa": 8.2 },
  { "student_id": "S005", "name": "Priya", "age": 20, "department": "CSBS", "year": 1, "cgpa": 9.1 }
]);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;💡 Tip:&lt;/strong&gt; insertMany() allows inserting multiple documents in one &lt;br&gt;
command.&lt;/p&gt;
&lt;h2&gt;
  
  
  2️⃣ Read (Query) Students
&lt;/h2&gt;

&lt;p&gt;Display all students:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;db.students.find().pretty();
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&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%2F17g3wy2bsngcaf6yqs8e.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%2F17g3wy2bsngcaf6yqs8e.png" alt=" " width="800" height="380"&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%2Ftsr8qdshfhleb7m8o12s.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%2Ftsr8qdshfhleb7m8o12s.png" alt=" " width="800" height="382"&gt;&lt;/a&gt;&lt;br&gt;
&lt;code&gt;&lt;br&gt;
Find students with CGPA &amp;gt; 8:&lt;br&gt;
&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;db.students.find({ "cgpa": { $gt: 8 } });
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;&lt;br&gt;
Find students in the Computer Science department (CSE):&lt;br&gt;
&lt;/code&gt;&lt;code&gt;db.students.find({ "department": "CSE" });&lt;br&gt;
&lt;/code&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%2Fn6nc9oebshfdh4glhscr.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%2Fn6nc9oebshfdh4glhscr.png" alt=" " width="800" height="380"&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%2Fkqwm2z48mkcuy9w06rss.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%2Fkqwm2z48mkcuy9w06rss.png" alt=" " width="800" height="386"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  3️⃣ Update Students
&lt;/h2&gt;

&lt;p&gt;Update CGPA of a specific student (S002):&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;code&gt;&lt;br&gt;
db.students.updateOne(&lt;br&gt;
  { "student_id": "S002" },&lt;br&gt;
  { $set: { "cgpa": 9 } }&lt;br&gt;
);&lt;br&gt;
&lt;/code&gt;&lt;code&gt;&lt;/code&gt;&lt;br&gt;
Increase year of all 3rd-year students by 1:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;`&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;code&gt;&lt;/code&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%2Fznikkkduiaotbb48070u.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%2Fznikkkduiaotbb48070u.png" alt=" " width="800" height="384"&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%2F3zjkwdfhrd4a1exwdquh.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%2F3zjkwdfhrd4a1exwdquh.png" alt=" " width="800" height="378"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;💡 Tip:&lt;/strong&gt; $set updates a field, while $inc increments numerical values.&lt;/p&gt;

&lt;h2&gt;
  
  
  4️⃣ Delete Students
&lt;/h2&gt;

&lt;p&gt;Delete a student by student_id (S003):&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;code&gt;&lt;br&gt;
db.students.deleteOne({ "student_id": "S003" });&lt;br&gt;
&lt;/code&gt;&lt;code&gt;&lt;/code&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%2Fnpo5tovbijcmwddm9mf6.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%2Fnpo5tovbijcmwddm9mf6.png" alt=" " width="800" height="384"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Delete all students with CGPA &amp;lt; 7.5:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;code&gt;&lt;br&gt;
db.students.deleteMany({ "cgpa": { $lt: 7.5 } });&lt;br&gt;
&lt;/code&gt;&lt;code&gt;&lt;/code&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%2Fd7oo6hderprxdpek9wbz.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%2Fd7oo6hderprxdpek9wbz.png" alt=" " width="800" height="377"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;In this tutorial, we explored how to create, read, update, and delete student records in MongoDB using a simple schema. MongoDB Atlas makes database management interactive and easy, giving us hands-on experience with real-world operations.&lt;/p&gt;

&lt;h2&gt;
  
  
  Final Collection Sample
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;code&gt;&lt;br&gt;
[{ "student_id": "S002", "name": "Kiran", "age": 21, "department": "CSE", "year": 3, "cgpa": 8.5 },&lt;br&gt;
  { "student_id": "S003", "name": "Anita", "age": 19, "department": "ECE", "year": 2, "cgpa": 7.8 },&lt;br&gt;
  { "student_id": "S004", "name": "Ramesh", "age": 22, "department": "CSE", "year": 3, "cgpa": 8.2 }]&lt;br&gt;
&lt;/code&gt;&lt;code&gt;&lt;/code&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%2F9la08wbuodx5kz82761g.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%2F9la08wbuodx5kz82761g.png" alt=" " width="800" height="385"&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%2Ffl5238lso879yezsstj7.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%2Ffl5238lso879yezsstj7.png" alt=" " width="800" height="377"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;📌 Deliverables for this assignment&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;MongoDB queries (insert, find, update, delete)&lt;/li&gt;
&lt;li&gt;Screenshots of query execution in MongoDB Atlas&lt;/li&gt;
&lt;li&gt;Export of the final students collection as JSON/CSV&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Special thanks to &lt;a class="mentioned-user" href="https://dev.to/santhoshnc"&gt;@santhoshnc&lt;/a&gt; Sir for guiding and encouraging me throughout this assignment. Your mentorship made learning MongoDB hands-on and enjoyable! 🙏&lt;/p&gt;

</description>
      <category>mongodb</category>
      <category>dbms</category>
      <category>webdev</category>
      <category>programming</category>
    </item>
    <item>
      <title>Indexing, Hashing &amp; Query Optimization</title>
      <dc:creator>Pavithra Sai</dc:creator>
      <pubDate>Fri, 03 Oct 2025 07:44:14 +0000</pubDate>
      <link>https://dev.to/sai_cf536f1c0eefb673310c5/indexing-hashing-query-optimization-1d78</link>
      <guid>https://dev.to/sai_cf536f1c0eefb673310c5/indexing-hashing-query-optimization-1d78</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Efficient data retrieval is critical in database management. Indexing and query optimization help reduce query execution time, especially for large datasets. In this blog, I demonstrate the use of B-Tree, B+ Tree, and Hash-based indexing in Oracle SQL through a simple Students table.&lt;br&gt;
I also showcase queries that benefit from these indexes. This is part of my database assignments, and I want to acknowledge my mentor Santhosh Sir for guidance and encouragement.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1: Creating the Students Table&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;We start by creating a Students table with the following fields:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;roll_no (Primary Key)&lt;/li&gt;
&lt;li&gt;name (Student name)&lt;/li&gt;
&lt;li&gt;dept (Department)&lt;/li&gt;
&lt;li&gt;cgpa (Cumulative GPA)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;CREATE TABLE Students (&lt;br&gt;
    roll_no NUMBER PRIMARY KEY,&lt;br&gt;
    name VARCHAR2(50),&lt;br&gt;
    dept VARCHAR2(20),&lt;br&gt;
    cgpa NUMBER(3,2)&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%2Fic7vararl9hqpo44xoux.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%2Fic7vararl9hqpo44xoux.png" alt=" " width="800" height="441"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 2: Inserting Sample Data&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;We insert 20 student records into the table:&lt;/p&gt;

&lt;p&gt;INSERT INTO Students VALUES (101, 'Alice', 'CSBS', 9.1);&lt;br&gt;
INSERT INTO Students VALUES (102, 'Bob', 'ECE', 7.8);&lt;br&gt;
INSERT INTO Students VALUES (103, 'Charlie', 'MECH', 8.5);&lt;br&gt;
INSERT INTO Students VALUES (104, 'David', 'CSBS', 6.9);&lt;br&gt;
INSERT INTO Students VALUES (105, 'Eva', 'CIVIL', 8.2);&lt;br&gt;
INSERT INTO Students VALUES (106, 'Frank', 'ECE', 7.5);&lt;br&gt;
INSERT INTO Students VALUES (107, 'Grace', 'CSBS', 9.0);&lt;br&gt;
INSERT INTO Students VALUES (108, 'Hannah', 'MECH', 8.1);&lt;br&gt;
INSERT INTO Students VALUES (109, 'Ian', 'CIVIL', 7.6);&lt;br&gt;
INSERT INTO Students VALUES (110, 'Jack', 'CSBS', 8.8);&lt;br&gt;
INSERT INTO Students VALUES (111, 'Kiran', 'ECE', 7.9);&lt;br&gt;
INSERT INTO Students VALUES (112, 'Lina', 'MECH', 8.4);&lt;br&gt;
INSERT INTO Students VALUES (113, 'Mona', 'CSBS', 9.2);&lt;br&gt;
INSERT INTO Students VALUES (114, 'Nina', 'CIVIL', 8.0);&lt;br&gt;
INSERT INTO Students VALUES (115, 'Oscar', 'ECE', 6.8);&lt;br&gt;
INSERT INTO Students VALUES (116, 'Paul', 'MECH', 7.7);&lt;br&gt;
INSERT INTO Students VALUES (117, 'Quinn', 'CSBS', 8.9);&lt;br&gt;
INSERT INTO Students VALUES (118, 'Rita', 'CIVIL', 7.5);&lt;br&gt;
INSERT INTO Students VALUES (119, 'Steve', 'ECE', 8.3);&lt;br&gt;
INSERT INTO Students VALUES (120, 'Tina', 'MECH', 8.6);&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%2Fk8i0ehwfor4qrdv4orne.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%2Fk8i0ehwfor4qrdv4orne.png" alt=" " width="800" height="439"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 3: B-Tree Index on roll_no&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Since roll_no is the primary key, Oracle automatically creates a B-Tree index on this column. This ensures efficient retrieval for queries like:&lt;/p&gt;

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

&lt;p&gt;&lt;strong&gt;Step 4: B+ Tree Index on cgpa&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;For range queries like cgpa &amp;gt; 8.0, a B+ Tree index is ideal. Oracle automatically uses B+ Tree indexing for normal indexes, so we create:&lt;/p&gt;

&lt;p&gt;CREATE INDEX idx_cgpa ON Students(cgpa);&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%2Fe5gjnd7boi0v7jl80t9j.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%2Fe5gjnd7boi0v7jl80t9j.png" alt=" " width="800" height="437"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;SELECT * FROM Students&lt;br&gt;
WHERE cgpa &amp;gt; 8.0&lt;br&gt;
ORDER BY cgpa DESC;&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%2Fwck9zyu37n1c7w79ypy5.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%2Fwck9zyu37n1c7w79ypy5.png" alt=" " width="800" height="447"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 5: Hash Index on dept (Simulated)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Oracle does not support direct hash indexes like some other databases, but we can simulate it using a normal index:&lt;/p&gt;

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

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

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

&lt;p&gt;Through this assignment, I observed:&lt;br&gt;
Primary Key automatically creates a B-Tree index → no need to manually create.&lt;/p&gt;

&lt;p&gt;B+ Tree index is perfect for range queries (e.g., cgpa &amp;gt; 8.0).&lt;br&gt;
Hash indexes (or equality-based indexes) optimize retrieval for categorical fields like dept.&lt;br&gt;
Indexing and query optimization are crucial for efficient data retrieval, especially in large databases.&lt;/p&gt;

&lt;p&gt;I sincerely thank &lt;a class="mentioned-user" href="https://dev.to/santhoshnc"&gt;@santhoshnc&lt;/a&gt; Sir for his guidance, assignments, and encouragement, which helped me understand indexing and query optimization in Oracle SQL.&lt;/p&gt;

</description>
      <category>dbms</category>
      <category>hashing</category>
      <category>webdev</category>
      <category>programming</category>
    </item>
    <item>
      <title>Transactions, Deadlocks &amp; Log Based Recovery</title>
      <dc:creator>Pavithra Sai</dc:creator>
      <pubDate>Fri, 03 Oct 2025 07:15:23 +0000</pubDate>
      <link>https://dev.to/sai_cf536f1c0eefb673310c5/transactions-deadlocks-log-based-recovery-52mp</link>
      <guid>https://dev.to/sai_cf536f1c0eefb673310c5/transactions-deadlocks-log-based-recovery-52mp</guid>
      <description>&lt;h2&gt;
  
  
  Transactions, Deadlocks &amp;amp; Log-Based Recovery – Hands-on SQL Demo
&lt;/h2&gt;

&lt;p&gt;**Databases are powerful because they ensure data integrity even when multiple users access the system at the same time. This is managed through transactions, deadlock detection, and log-based recovery.&lt;/p&gt;

&lt;p&gt;In this blog, I demonstrate these concepts using a single Accounts table in Oracle Live SQL.**&lt;/p&gt;

&lt;h2&gt;
  
  
  📌 Schema Setup
&lt;/h2&gt;

&lt;p&gt;We first create a table to simulate account balances:&lt;br&gt;
CREATE TABLE Accounts (&lt;br&gt;
    acc_no INT PRIMARY KEY,&lt;br&gt;
    name VARCHAR2(50),&lt;br&gt;
    balance INT&lt;br&gt;
);&lt;/p&gt;

&lt;p&gt;INSERT INTO Accounts VALUES (1, 'Alice', 1000);&lt;br&gt;
INSERT INTO Accounts VALUES (2, 'Bob', 1500);&lt;br&gt;
INSERT INTO Accounts VALUES (3, 'Charlie', 2000);&lt;/p&gt;

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

&lt;h2&gt;
  
  
  1️⃣ Transaction – Atomicity &amp;amp; Rollback
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Goal:&lt;/strong&gt; Transfer ₹500 from Alice to Bob. Rollback before commit to ensure no partial update.&lt;br&gt;
-- Start transaction&lt;br&gt;
UPDATE Accounts&lt;br&gt;
SET balance = balance - 500&lt;br&gt;
WHERE name = 'Alice';&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;-- Rollback the transaction&lt;br&gt;
ROLLBACK;&lt;/p&gt;

&lt;p&gt;-- Check balances (should be unchanged)&lt;br&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%2Fth4gq6m4iblpcczxs5lv.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%2Fth4gq6m4iblpcczxs5lv.png" alt=" " width="800" height="492"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;✅ Balances remain:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Alice → 1000&lt;br&gt;
Bob → 1500&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Lesson:&lt;/strong&gt; Atomicity ensures that either all operations in a transaction succeed, or none do.&lt;/p&gt;

&lt;h2&gt;
  
  
  2️⃣ Deadlock Simulation
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Goal:&lt;/strong&gt; Simulate a deadlock between two sessions.&lt;br&gt;
&lt;strong&gt;Session 1:&lt;/strong&gt; Lock Alice’s account and try to update Bob’s.&lt;br&gt;
&lt;strong&gt;Session 2:&lt;/strong&gt; Lock Bob’s account and try to update Alice’s.&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%2Funchr4wkym83ncjsb4qr.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%2Funchr4wkym83ncjsb4qr.png" alt=" " width="800" height="445"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;🔥 Oracle detects &lt;strong&gt;circular wait&lt;/strong&gt; → deadlock → one session is rolled back automatically.&lt;br&gt;
&lt;strong&gt;Lesson:&lt;/strong&gt; Deadlocks can occur when two transactions wait on each other’s locks. DBMS automatically resolves them.&lt;/p&gt;

&lt;h2&gt;
  
  
  3️⃣ Log-Based Recovery
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Goal:&lt;/strong&gt; Show that updates are tracked for recovery using logs.&lt;br&gt;
-- Start transaction&lt;br&gt;
UPDATE Accounts SET balance = balance + 1000 WHERE name = 'Alice';&lt;/p&gt;

&lt;p&gt;-- Rollback&lt;br&gt;
ROLLBACK;&lt;/p&gt;

&lt;p&gt;-- Verify&lt;br&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%2Fzs8kuvh4zsddbku756gn.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%2Fzs8kuvh4zsddbku756gn.png" alt=" " width="800" height="443"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;✅ Even after rollback, balances are restored, demonstrating undo capability via internal logs.&lt;br&gt;
&lt;strong&gt;Note:&lt;/strong&gt; In Oracle Live SQL, redo/undo logs are internal. The rollback proves that log-based recovery works.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🎯 Summary&lt;/strong&gt;&lt;br&gt;
Through these demos, I explored:&lt;br&gt;
✅ Atomicity &amp;amp; Rollback – all-or-nothing transactions&lt;br&gt;
✅ Deadlocks – isolation and conflict resolution&lt;br&gt;
✅ Log-Based Recovery – durability and undo operations&lt;/p&gt;

&lt;p&gt;Special thanks to &lt;a class="mentioned-user" href="https://dev.to/santhoshnc"&gt;@santhoshnc&lt;/a&gt; Sir for guiding us to try these experiments hands-on in Oracle Live SQL.&lt;/p&gt;

</description>
      <category>oracle</category>
      <category>database</category>
      <category>tutorial</category>
      <category>sql</category>
    </item>
    <item>
      <title>ACID Properties &amp; SQL Transactions</title>
      <dc:creator>Pavithra Sai</dc:creator>
      <pubDate>Thu, 02 Oct 2025 19:21:38 +0000</pubDate>
      <link>https://dev.to/sai_cf536f1c0eefb673310c5/acid-properties-sql-transactions-bi5</link>
      <guid>https://dev.to/sai_cf536f1c0eefb673310c5/acid-properties-sql-transactions-bi5</guid>
      <description>&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;This post walks through creating an Accounts table, inserting seed data, updating balances with transactions, and demonstrating a CHECK constraint violation. It also ties each step to ACID properties with clear visuals.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What you’ll learn&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create/insert into an Accounts table and verify results with SELECT&lt;/li&gt;
&lt;li&gt;Run UPDATE + COMMIT cycles and validate row changes&lt;/li&gt;
&lt;li&gt;Trigger and understand a CHECK constraint error for data integrity&lt;/li&gt;
&lt;li&gt;Map each step to ACID: Atomicity, Consistency, Isolation, Durability&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  1) Setup: create and insert
&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%2Fxris9wn5iztdcpxxqwxv.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%2Fxris9wn5iztdcpxxqwxv.png" alt=" " width="800" height="427"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;CREATE TABLE Accounts (&lt;br&gt;
  acc_no   NUMBER PRIMARY KEY,&lt;br&gt;
  name     VARCHAR2(50) NOT NULL,&lt;br&gt;
  balance  NUMBER(12,2) CONSTRAINT chk_balance CHECK (balance &amp;gt;= 0)&lt;br&gt;
);&lt;/p&gt;

&lt;p&gt;INSERT INTO Accounts (acc_no, name, balance) VALUES (101, 'Alice', 4000);&lt;br&gt;
INSERT INTO Accounts (acc_no, name, balance) VALUES (102, 'Bob',   4000);&lt;br&gt;
INSERT INTO Accounts (acc_no, name, balance) VALUES (103, 'Charlie', 2000);&lt;br&gt;
COMMIT;&lt;/p&gt;

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

&lt;h2&gt;
  
  
  2) Transactions: update and commit
&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%2Ffdc3nhoy8rtb9tgjpf7f.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%2Ffdc3nhoy8rtb9tgjpf7f.png" alt=" " width="800" height="451"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;-- Apply bonus to 101 and 102&lt;br&gt;
UPDATE Accounts SET balance = balance + 1000 WHERE acc_no = 101;&lt;br&gt;
UPDATE Accounts SET balance = balance + 1000 WHERE acc_no = 102;&lt;br&gt;
COMMIT;&lt;/p&gt;

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

&lt;h2&gt;
  
  
  3) Quick verification: single account
&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%2Fvazivkwnc89mg2u5gg72.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%2Fvazivkwnc89mg2u5gg72.png" alt=" " width="800" height="441"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;SELECT balance FROM Accounts WHERE acc_no = 101;&lt;/p&gt;

&lt;h2&gt;
  
  
  4) Constraint demo: negative balance (expected error)
&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%2Fwas6f1tlmxe7h4shs3m7.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%2Fwas6f1tlmxe7h4shs3m7.png" alt=" " width="800" height="445"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;-- Integrity check: should fail&lt;br&gt;
INSERT INTO Accounts (acc_no, name, balance) VALUES (104, 'David', -500);&lt;/p&gt;

&lt;h2&gt;
  
  
  ACID refresher with visuals
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Atomicity:&lt;/strong&gt; A transaction is all‑or‑nothing—either the whole unit commits or none persists.&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%2F3xxifjsvs4zkk27am9xz.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%2F3xxifjsvs4zkk27am9xz.png" alt=" " width="800" height="438"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Consistency:&lt;/strong&gt; Only valid states reach the database; constraints enforce rules at the boundary. &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%2Fj1qpqityvcuezv2spe6c.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%2Fj1qpqityvcuezv2spe6c.png" alt=" " width="800" height="445"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Isolation:&lt;/strong&gt; Concurrent work shouldn’t interfere; each transaction sees a consistent snapshot.&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%2Flq61uw2v3sl12cdq8ig0.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%2Flq61uw2v3sl12cdq8ig0.png" alt=" " width="800" height="441"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Durability&lt;/strong&gt;: After COMMIT, data survives failures and session ends.&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%2F1y0winxvrkhycxlk6lf1.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%2F1y0winxvrkhycxlk6lf1.png" alt=" " width="800" height="451"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;-- Create + seed&lt;br&gt;
CREATE TABLE Accounts (&lt;br&gt;
  acc_no   NUMBER PRIMARY KEY,&lt;br&gt;
  name     VARCHAR2(50) NOT NULL,&lt;br&gt;
  balance  NUMBER(12,2) CONSTRAINT chk_balance CHECK (balance &amp;gt;= 0)&lt;br&gt;
);&lt;/p&gt;

&lt;p&gt;INSERT INTO Accounts (acc_no, name, balance) VALUES (101, 'Alice', 4000);&lt;br&gt;
INSERT INTO Accounts (acc_no, name, balance) VALUES (102, 'Bob',   4000);&lt;br&gt;
INSERT INTO Accounts (acc_no, name, balance) VALUES (103, 'Charlie', 2000);&lt;br&gt;
COMMIT;&lt;/p&gt;

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

&lt;p&gt;-- Updates&lt;br&gt;
UPDATE Accounts SET balance = balance + 1000 WHERE acc_no = 101;&lt;br&gt;
UPDATE Accounts SET balance = balance + 1000 WHERE acc_no = 102;&lt;br&gt;
COMMIT;&lt;/p&gt;

&lt;p&gt;-- Verifications&lt;br&gt;
SELECT balance FROM Accounts WHERE acc_no = 101;&lt;br&gt;
SELECT * FROM Accounts;&lt;/p&gt;

&lt;p&gt;-- Constraint violation demo (will error)&lt;br&gt;
INSERT INTO Accounts (acc_no, name, balance) VALUES (104, 'David', -500);&lt;/p&gt;

&lt;h2&gt;
  
  
  Credits
&lt;/h2&gt;

&lt;p&gt;Thank you, &lt;a class="mentioned-user" href="https://dev.to/santhoshnc"&gt;@santhoshnc&lt;/a&gt; Sir, for the assignment and guidance—this write‑up is the direct result of that mentorship.&lt;/p&gt;

</description>
      <category>database</category>
      <category>tutorial</category>
      <category>beginners</category>
      <category>sql</category>
    </item>
    <item>
      <title>Cursor &amp; Trigger</title>
      <dc:creator>Pavithra Sai</dc:creator>
      <pubDate>Thu, 02 Oct 2025 18:29:31 +0000</pubDate>
      <link>https://dev.to/sai_cf536f1c0eefb673310c5/cursor-trigger-5hgp</link>
      <guid>https://dev.to/sai_cf536f1c0eefb673310c5/cursor-trigger-5hgp</guid>
      <description>&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;A quick walkthrough of Oracle Live SQL practice: creating a table, printing output with SERVEROUTPUT, iterating a cursor, and building an AFTER INSERT trigger to log into an audit table, with screenshots and runnable snippets.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What this post covers&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create and seed an Employee table&lt;/li&gt;
&lt;li&gt;Use SET SERVEROUTPUT ON for DBMS_OUTPUT in Live SQL&lt;/li&gt;
&lt;li&gt;Loop over rows using a cursor and print names to the script output pane&lt;/li&gt;
&lt;li&gt;Write a simple auditing trigger for student inserts and verify audit rows
## 1) Create table + sample data&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;CREATE TABLE Employee (&lt;br&gt;
  EmployeeID INT PRIMARY KEY,&lt;br&gt;
  Name VARCHAR2(50),&lt;br&gt;
  Salary NUMBER(10,2)&lt;br&gt;
);&lt;/p&gt;

&lt;p&gt;INSERT INTO Employee VALUES (1, 'Alice', 60000);&lt;br&gt;
INSERT INTO Employee VALUES (2, 'Bob',   45000);&lt;br&gt;
INSERT INTO Employee VALUES (3, 'Charlie', 75000);&lt;br&gt;
INSERT INTO Employee VALUES (4, 'David', 50000);&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%2Fbo72f884x25qp9gc6it4.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%2Fbo72f884x25qp9gc6it4.png" alt=" " width="800" height="434"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  2) Print output with DBMS_OUTPUT
&lt;/h2&gt;

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

&lt;p&gt;DECLARE&lt;br&gt;
  v_count NUMBER;&lt;br&gt;
BEGIN&lt;br&gt;
  SELECT COUNT(*) INTO v_count FROM Employee;&lt;br&gt;
  DBMS_OUTPUT.PUT_LINE('Rows in Employee: ' || v_count);&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%2Fszvk83xbat473yiyizg0.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%2Fszvk83xbat473yiyizg0.png" alt=" " width="800" height="439"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  3) Cursor demo: list high earners
&lt;/h2&gt;

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

&lt;p&gt;DECLARE&lt;br&gt;
  CURSOR c_emp IS&lt;br&gt;
    SELECT Name FROM Employee WHERE Salary &amp;gt; 50000 ORDER BY Salary DESC;&lt;/p&gt;

&lt;p&gt;v_name Employee.Name%TYPE;&lt;br&gt;
BEGIN&lt;br&gt;
  OPEN c_emp;&lt;br&gt;
  LOOP&lt;br&gt;
    FETCH c_emp INTO v_name;&lt;br&gt;
    EXIT WHEN c_emp%NOTFOUND;&lt;br&gt;
    DBMS_OUTPUT.PUT_LINE(v_name);&lt;br&gt;
  END LOOP;&lt;br&gt;
  CLOSE c_emp;&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%2Fbebur109rf64ujw8d1fv.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%2Fbebur109rf64ujw8d1fv.png" alt=" " width="800" height="437"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  4) Build a simple audit trigger
&lt;/h2&gt;

&lt;p&gt;-- Base tables&lt;br&gt;
CREATE TABLE Students (&lt;br&gt;
  StudentID NUMBER PRIMARY KEY,&lt;br&gt;
  Name      VARCHAR2(50)&lt;br&gt;
);&lt;/p&gt;

&lt;p&gt;CREATE TABLE Student_Audit (&lt;br&gt;
  AuditID     NUMBER GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,&lt;br&gt;
  StudentID   NUMBER,&lt;br&gt;
  StudentName VARCHAR2(50),&lt;br&gt;
  Action      VARCHAR2(20),&lt;br&gt;
  ActionDate  DATE&lt;br&gt;
);&lt;/p&gt;

&lt;p&gt;-- AFTER INSERT row-level trigger to capture inserts&lt;br&gt;
CREATE OR REPLACE TRIGGER trg_students_ins_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, Action, ActionDate)&lt;br&gt;
  VALUES (:NEW.StudentID, :NEW.Name, 'Inserted', SYSDATE);&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%2Fcd6fy4vif0r8t9rakpb6.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%2Fcd6fy4vif0r8t9rakpb6.png" alt=" " width="800" height="440"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Dev.to formatting tips&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use fenced code blocks with language hints like 

```
&lt;/li&gt;
&lt;/ul&gt;

&lt;ul&gt;
&lt;li&gt;Keep one blank line before and after code blocks for clean rendering in Markdown-based editors like Dev.to.&lt;/li&gt;
&lt;li&gt;If showing code that itself contains backticks, use a longer fence (four or more backticks) to avoid premature closing in Markdown processors.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This post is dedicated to &lt;a class="mentioned-user" href="https://dev.to/santhoshnc"&gt;@santhoshnc&lt;/a&gt; Sir thank you for the assignment and continuous support.&lt;/p&gt;

</description>
      <category>database</category>
      <category>sql</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Database Normalization</title>
      <dc:creator>Pavithra Sai</dc:creator>
      <pubDate>Thu, 02 Oct 2025 17:33:23 +0000</pubDate>
      <link>https://dev.to/sai_cf536f1c0eefb673310c5/database-normalization-1np3</link>
      <guid>https://dev.to/sai_cf536f1c0eefb673310c5/database-normalization-1np3</guid>
      <description>&lt;p&gt;&lt;strong&gt;Normalizing a Student-Course schema step-by-step and validating with JOIN outputs&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Introduction&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;This post shows how a simple Student–Course dataset was modeled in Oracle Live SQL and normalized from 1NF → 2NF → 3NF, ending with a clean junction table and a working JOIN query result. The screenshots are added to illustrate each milestone and the final output table. Special thanks to Santhosh sir for assigning and guiding this exercise.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;What problem I solved&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Started with a single wide table mixing student, course, and instructor details, which risks redundancy and update anomalies.&lt;/p&gt;

&lt;p&gt;Applied normalization to split data into well-structured tables and enforce referential integrity.&lt;/p&gt;

&lt;p&gt;Verified with INSERT and SELECT … JOIN to ensure the design works end-to-end.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;1NF: Single wide table&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Created an initial table StudentCourse1NF with columns: StudentID, StudentName, CourseID, CourseName, Instructor, InstructorPhone.&lt;br&gt;
&lt;strong&gt;Goal at this stage:&lt;/strong&gt; ensure atomic values in each cell and a primary identifier present.&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%2F5ing59v24us03jk3nwyn.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%2F5ing59v24us03jk3nwyn.png" alt=" " width="800" height="429"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;2NF: Remove partial dependencies&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Identified that non-key attributes like StudentName depend on StudentID, while CourseName/Instructor details depend on CourseID, causing partial dependency on a composite key.&lt;/p&gt;

&lt;p&gt;Split into base entity tables: Students(StudentID, StudentName) and Courses(CourseID, CourseName, Instructor, InstructorPhone).&lt;br&gt;
Created a pure relationship table StudentCourse1NF_New or StudentCourses with keys only (StudentID, CourseID).&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%2Fk05dlyj4rz58bchsegyw.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%2Fk05dlyj4rz58bchsegyw.png" alt=" " width="800" height="436"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;3NF: Remove transitive dependencies&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Ensured instructor details belong with Courses, not with Students–Courses mapping, avoiding transitive dependencies via CourseID.&lt;br&gt;
Declared composite primary key on StudentCourses(StudentID, CourseID) and foreign keys referencing Students and Courses.&lt;br&gt;
This guarantees each fact lives in exactly one place, preventing update anomalies.&lt;/p&gt;

&lt;p&gt;DDL snippets used&lt;/p&gt;

&lt;p&gt;Students&lt;/p&gt;

&lt;p&gt;CREATE TABLE Students (&lt;/p&gt;

&lt;p&gt;StudentID VARCHAR2(10) PRIMARY KEY,&lt;/p&gt;

&lt;p&gt;StudentName VARCHAR2(50)&lt;/p&gt;

&lt;p&gt;);&lt;/p&gt;

&lt;p&gt;Courses&lt;/p&gt;

&lt;p&gt;CREATE TABLE Courses (&lt;/p&gt;

&lt;p&gt;CourseID VARCHAR2(10) PRIMARY KEY,&lt;/p&gt;

&lt;p&gt;CourseName VARCHAR2(50),&lt;/p&gt;

&lt;p&gt;Instructor VARCHAR2(50),&lt;/p&gt;

&lt;p&gt;InstructorPhone VARCHAR2(15)&lt;/p&gt;

&lt;p&gt;);&lt;/p&gt;

&lt;p&gt;StudentCourses (junction)&lt;/p&gt;

&lt;p&gt;CREATE TABLE StudentCourses (&lt;/p&gt;

&lt;p&gt;StudentID VARCHAR2(10),&lt;/p&gt;

&lt;p&gt;CourseID VARCHAR2(10),&lt;/p&gt;

&lt;p&gt;PRIMARY KEY (StudentID, CourseID),&lt;/p&gt;

&lt;p&gt;FOREIGN KEY (StudentID) REFERENCES Students(StudentID),&lt;/p&gt;

&lt;p&gt;FOREIGN KEY (CourseID) REFERENCES Courses(CourseID)&lt;/p&gt;

&lt;p&gt;);&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Sample data&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;INSERT INTO Students VALUES ('S01','Kiran');&lt;/p&gt;

&lt;p&gt;INSERT INTO Students VALUES ('S02','Arjun');&lt;/p&gt;

&lt;p&gt;INSERT INTO Students VALUES ('S03','Priya');&lt;/p&gt;

&lt;p&gt;INSERT INTO Courses VALUES ('C101','DBMS',1); // or include instructor fields per your design&lt;/p&gt;

&lt;p&gt;INSERT INTO StudentCourses VALUES ('S01','C101');&lt;/p&gt;

&lt;p&gt;Continue adding rows to cover multiple students and courses.&lt;/p&gt;

&lt;p&gt;*&lt;em&gt;Validation query&lt;br&gt;
*&lt;/em&gt;&lt;br&gt;
SELECT s.StudentName, c.CourseName, i.InstructorName&lt;/p&gt;

&lt;p&gt;FROM StudentCourses sc&lt;/p&gt;

&lt;p&gt;JOIN Students s ON sc.StudentID = s.StudentID&lt;/p&gt;

&lt;p&gt;JOIN Courses c ON sc.CourseID = c.CourseID&lt;/p&gt;

&lt;p&gt;JOIN Instructors i ON c.InstructorID = i.InstructorID; // if you separated 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%2F2xygpaljsr56gpxpknx5.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%2F2xygpaljsr56gpxpknx5.png" alt=" " width="800" height="431"&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%2Fxl7vbwjopilkyecxpr26.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%2Fxl7vbwjopilkyecxpr26.png" alt=" " width="800" height="432"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What the screenshots show&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1NF image:&lt;/strong&gt; The initial table creation for denormalized structure.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2NF image:&lt;/strong&gt; Refactoring tables and creating entity tables.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3NF image:&lt;/strong&gt; Final DDL with keys and foreign keys in Oracle Live SQL.&lt;/p&gt;

&lt;p&gt;Final output image: Query result proving the relationships and data integrity.&lt;/p&gt;

&lt;h2&gt;
  
  
  Key takeaways
&lt;/h2&gt;

&lt;p&gt;Use a junction table for many-to-many Student–Course relationships.&lt;/p&gt;

&lt;p&gt;Keep attributes with the entity they truly describe to avoid redundancy.&lt;/p&gt;

&lt;p&gt;Composite PK on (StudentID, CourseID) plus FKs gives strong integrity.&lt;/p&gt;

&lt;p&gt;Always validate by inserting data and running JOINs to see real results.&lt;/p&gt;

&lt;p&gt;A sincere thanks to &lt;a class="mentioned-user" href="https://dev.to/santhoshnc"&gt;@santhoshnc&lt;/a&gt; sir for giving this assignment and motivating the step-by-step approach. Your guidance made normalization concepts much clearer in practice.&lt;/p&gt;

</description>
      <category>dbms</category>
      <category>oracle</category>
      <category>sql</category>
    </item>
  </channel>
</rss>
