<?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: Poorvika N</title>
    <description>The latest articles on DEV Community by Poorvika N (@poorvika_n).</description>
    <link>https://dev.to/poorvika_n</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%2F3449147%2Fbb6af846-568b-414a-94bc-d09181eb9172.png</url>
      <title>DEV Community: Poorvika N</title>
      <link>https://dev.to/poorvika_n</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/poorvika_n"/>
    <language>en</language>
    <item>
      <title>🚀 AWS CodePipeline – Automating CI/CD in AWS Cloud</title>
      <dc:creator>Poorvika N</dc:creator>
      <pubDate>Thu, 18 Dec 2025 17:10:48 +0000</pubDate>
      <link>https://dev.to/poorvika_n/aws-codepipeline-automating-cicd-in-aws-cloud-mnp</link>
      <guid>https://dev.to/poorvika_n/aws-codepipeline-automating-cicd-in-aws-cloud-mnp</guid>
      <description>&lt;ul&gt;
&lt;li&gt;AWS CodePipeline is an AWS service used to automate software release processes&lt;/li&gt;
&lt;li&gt;It helps teams deliver applications faster, safer, and more consistently&lt;/li&gt;
&lt;li&gt;Eliminates manual deployment errors and improves efficiency&lt;/li&gt;
&lt;li&gt;Plays a key role in modern DevOps practices&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  🔍 Service Overview
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;AWS CodePipeline is a fully managed CI/CD service&lt;/li&gt;
&lt;li&gt;Automatically builds, tests, and deploys applications&lt;/li&gt;
&lt;li&gt;Triggers pipeline execution whenever source code changes&lt;/li&gt;
&lt;li&gt;Pipelines are divided into stages like:&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;Source&lt;/li&gt;
&lt;li&gt;Build&lt;/li&gt;
&lt;li&gt;Test &lt;/li&gt;
&lt;li&gt;Deploy&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;AWS manages infrastructure, scaling, and availability&lt;/li&gt;
&lt;li&gt;Developers can focus on coding instead of managing servers&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  ⚙️ Key Features
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Fully managed CI/CD orchestration service&lt;/li&gt;
&lt;li&gt;Automates build, test, and deployment workflows&lt;/li&gt;
&lt;li&gt;Supports multiple source providers like AWS CodeCommit, GitHub, and Bitbucket&lt;/li&gt;
&lt;li&gt;Seamlessly integrates with AWS CodeBuild, CodeDeploy, Elastic Beanstalk, and CloudFormation&lt;/li&gt;
&lt;li&gt;Provides a visual pipeline view for monitoring execution status&lt;/li&gt;
&lt;li&gt;Event-driven architecture that triggers pipelines automatically on code changes&lt;/li&gt;
&lt;li&gt;Secure access and permission management using AWS IAM roles&lt;/li&gt;
&lt;li&gt;Supports parallel execution and custom approval stages&lt;/li&gt;
&lt;li&gt;Highly scalable, reliable, and fault-tolerant&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  ☁️ AWS Category / Cloud Domain
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;AWS Category:&lt;/strong&gt; Developer Tools&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Cloud Domain:&lt;/strong&gt;DevOps / Continuous Integration &amp;amp; Continuous Delivery (CI/CD)&lt;/p&gt;

&lt;p&gt;AWS CodePipeline belongs to the Developer Tools category, which focuses on automating and simplifying application development and deployment processes.&lt;/p&gt;

&lt;h2&gt;
  
  
  🔄 Where It Fits in the Cloud / DevOps Lifecycle
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;AWS CodePipeline is at the core of the DevOps lifecycle, enabling continuous automation and feedback:&lt;/li&gt;
&lt;li&gt;Source Stage – Fetches the latest code from repositories like GitHub or CodeCommit&lt;/li&gt;
&lt;li&gt;Build Stage – Compiles source code, runs unit tests, and generates build artifacts&lt;/li&gt;
&lt;li&gt;Test Stage – Executes automated tests to ensure quality and stability&lt;/li&gt;
&lt;li&gt;Approval Stage (Optional) – Allows manual review before deployment&lt;/li&gt;
&lt;li&gt;Deploy Stage – Deploys applications to services like EC2, Lambda, ECS, or Elastic Beanstalk&lt;/li&gt;
&lt;li&gt;By automating these stages, CodePipeline helps reduce deployment failures, improves release frequency, and ensures faster feedback loops.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  💻 Programming Language / Access Methods
&lt;/h2&gt;

&lt;p&gt;AWS CodePipeline supports multiple access methods, making it flexible for different teams and workflows:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;AWS Management Console – User-friendly web interface&lt;/li&gt;
&lt;li&gt;AWS Command Line Interface (CLI)&lt;/li&gt;
&lt;li&gt;AWS SDKs, including:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Python (Boto3)&lt;/p&gt;

&lt;p&gt;Java&lt;/p&gt;

&lt;p&gt;JavaScript (Node.js)&lt;/p&gt;

&lt;p&gt;C#&lt;/p&gt;

&lt;p&gt;Go&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;REST APIs&lt;/li&gt;
&lt;li&gt;Infrastructure as Code (IaC) using:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;AWS CloudFormation&lt;/p&gt;

&lt;p&gt;AWS Cloud Development Kit (CDK)&lt;/p&gt;

&lt;p&gt;This allows developers to manage pipelines programmatically and integrate them into automated workflows.&lt;/p&gt;

&lt;h2&gt;
  
  
  💰 Pricing Model
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;AWS CodePipeline follows a simple and transparent pay-as-you-go pricing model:&lt;/li&gt;
&lt;li&gt;Charged per active pipeline per month&lt;/li&gt;
&lt;li&gt;No upfront fees or long-term contracts&lt;/li&gt;
&lt;li&gt;Costs remain predictable as pipelines scale&lt;/li&gt;
&lt;li&gt;Additional charges may apply for related services such as:&lt;/li&gt;
&lt;li&gt;AWS CodeBuild&lt;/li&gt;
&lt;li&gt;Amazon S3&lt;/li&gt;
&lt;li&gt;Amazon EC2&lt;/li&gt;
&lt;li&gt;AWS Free Tier includes limited usage for new users&lt;/li&gt;
&lt;li&gt;This pricing model makes it suitable for both students and enterprises.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  📌 Real-World Use Case Example
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;A web application team uses GitHub as their source repository. Whenever a developer pushes new code:&lt;/li&gt;
&lt;li&gt;CodePipeline automatically pulls the code&lt;/li&gt;
&lt;li&gt;CodeBuild compiles and tests the application&lt;/li&gt;
&lt;li&gt;CodeDeploy deploys the updated version to EC2 instances&lt;/li&gt;
&lt;li&gt;The entire process completes without manual intervention&lt;/li&gt;
&lt;li&gt;This ensures faster releases, fewer errors, and consistent deployments.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;AWS CodePipeline is a powerful and essential DevOps service that simplifies CI/CD automation in the AWS cloud. By automating the software delivery lifecycle, it helps organizations achieve faster deployment cycles, improved reliability, and better collaboration between development and operations teams. For students and professionals learning AWS Cloud Driven DevOps, CodePipeline provides a strong foundation in modern CI/CD practices.&lt;/p&gt;

</description>
      <category>aws</category>
      <category>awscodepipeline</category>
      <category>awscloud</category>
    </item>
    <item>
      <title>🔧 Puppet: Automating Infrastructure as Code in DevSecOps</title>
      <dc:creator>Poorvika N</dc:creator>
      <pubDate>Thu, 18 Dec 2025 16:41:56 +0000</pubDate>
      <link>https://dev.to/poorvika_n/puppet-automating-infrastructure-as-code-in-devsecops-5eeg</link>
      <guid>https://dev.to/poorvika_n/puppet-automating-infrastructure-as-code-in-devsecops-5eeg</guid>
      <description>&lt;ul&gt;
&lt;li&gt;Modern cloud-driven DevOps environments require automation to handle large-scale infrastructure efficiently.&lt;/li&gt;
&lt;li&gt;Manual infrastructure management is time-consuming, error-prone, and difficult to scale.&lt;/li&gt;
&lt;li&gt;Configuration management tools help automate infrastructure operations and maintain consistency.&lt;/li&gt;
&lt;li&gt;Puppet is one of the most widely used configuration management tools in DevOps.&lt;/li&gt;
&lt;li&gt;In the DevSecOps Periodic Table, Puppet is listed as Element 61.&lt;/li&gt;
&lt;li&gt;Its position highlights its importance in infrastructure automation and security-focused DevOps practices.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Overview of Puppet
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Puppet is a configuration management and infrastructure automation tool.&lt;/li&gt;
&lt;li&gt;It helps organizations define, deploy, and manage infrastructure in a consistent and repeatable manner.&lt;/li&gt;
&lt;li&gt;Administrators write code to describe the desired state of systems instead of configuring servers manually.&lt;/li&gt;
&lt;li&gt;Puppet continuously monitors systems and ensures they remain in the defined desired state.&lt;/li&gt;
&lt;li&gt;It follows a declarative approach, focusing on what the system should look like rather than how to configure it.&lt;/li&gt;
&lt;li&gt;This approach reduces human errors and improves system reliability and stability.&lt;/li&gt;
&lt;li&gt;Puppet is widely used in:
Cloud environments
Data centers
Hybrid infrastructures&lt;/li&gt;
&lt;li&gt;It efficiently manages servers, applications, and services at scale.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Key Features of Puppet
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1. Infrastructure as Code (IaC)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Puppet enables teams to manage infrastructure using code, making configurations version-controlled, auditable, and repeatable. This aligns infrastructure management with software development best practices.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Automated Configuration Management&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Puppet automatically enforces system configurations across multiple machines, ensuring consistency. If any configuration drifts from the desired state, Puppet detects and corrects it automatically.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Declarative Language&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Using Puppet’s Domain Specific Language (DSL), users describe the desired system state. Puppet handles the implementation details internally, simplifying complex configurations.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Scalability&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Puppet is designed to manage thousands of nodes efficiently, making it suitable for large enterprise environments as well as growing cloud infrastructures.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. Compliance and Reporting&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Puppet provides reporting and auditing capabilities that help organizations meet security and compliance requirements. This is especially valuable in regulated industries.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;6. Agent-Based Architecture&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Puppet uses a client-server model where agents run on managed nodes and periodically communicate with a Puppet server to apply configurations.&lt;/p&gt;

&lt;h2&gt;
  
  
  How Puppet Fits into DevOps and DevSecOps
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Role in DevOps:&lt;/strong&gt;&lt;br&gt;
In DevOps practices, Puppet helps automate infrastructure provisioning and configuration, enabling faster and more reliable deployments. By eliminating manual setup, Puppet reduces deployment time, minimizes configuration errors, and supports continuous integration and continuous delivery (CI/CD) pipelines.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Role in DevSecOps:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In DevSecOps, security is integrated throughout the development lifecycle. Puppet supports DevSecOps by:&lt;/p&gt;

&lt;p&gt;Enforcing security baselines and system hardening&lt;/p&gt;

&lt;p&gt;Applying patches and updates consistently&lt;/p&gt;

&lt;p&gt;Ensuring compliance with organizational security policies&lt;/p&gt;

&lt;p&gt;Detecting and correcting configuration drift that could introduce vulnerabilities&lt;/p&gt;

&lt;p&gt;By embedding security rules directly into infrastructure code, Puppet ensures that security is automated and not treated as an afterthought.&lt;/p&gt;

&lt;h2&gt;
  
  
  Programming Language Used in Puppet
&lt;/h2&gt;

&lt;p&gt;Puppet uses a Domain Specific Language (DSL) designed specifically for configuration management. This DSL is simple, readable, and declarative, making it accessible even to users with limited programming experience.&lt;/p&gt;

&lt;p&gt;Internally, Puppet is built using Ruby, which provides flexibility and extensibility to the tool. Knowledge of Ruby is beneficial for advanced Puppet usage, such as writing custom modules.&lt;/p&gt;

&lt;h2&gt;
  
  
  Parent Company of Puppet
&lt;/h2&gt;

&lt;p&gt;Puppet is developed and maintained by Puppet, Inc., a company founded in 2005. Puppet, Inc. focuses on infrastructure automation and has contributed significantly to the evolution of DevOps and DevSecOps practices worldwide.&lt;/p&gt;

&lt;h2&gt;
  
  
  Open Source or Paid
&lt;/h2&gt;

&lt;p&gt;Puppet offers both open-source and commercial versions:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Puppet Open Source:&lt;/strong&gt; Free to use, suitable for individuals, students, and small teams.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Puppet Enterprise:&lt;/strong&gt; A paid version that includes advanced features such as enhanced reporting, role-based access control, and enterprise-grade support.&lt;/p&gt;

&lt;p&gt;This dual model allows users to start with the open-source version and scale to enterprise features as organizational needs grow.&lt;/p&gt;

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

&lt;p&gt;Puppet (61) plays a vital role in the DevSecOps ecosystem by enabling automated, secure, and scalable infrastructure management. Its ability to enforce consistency, integrate security practices, and support Infrastructure as Code makes it an essential tool for modern DevOps teams. As organizations increasingly adopt cloud and hybrid environments, tools like Puppet continue to be critical in achieving reliable and secure software delivery.&lt;/p&gt;

</description>
      <category>devops</category>
      <category>devsecops</category>
      <category>puppet</category>
      <category>configurationmanagement</category>
    </item>
    <item>
      <title>MongoDB in Action: Building a Smart Student Database with CRUD Operations</title>
      <dc:creator>Poorvika N</dc:creator>
      <pubDate>Wed, 08 Oct 2025 17:58:55 +0000</pubDate>
      <link>https://dev.to/poorvika_n/mongodb-in-action-building-a-smart-student-database-with-crud-operations-2420</link>
      <guid>https://dev.to/poorvika_n/mongodb-in-action-building-a-smart-student-database-with-crud-operations-2420</guid>
      <description>&lt;p&gt;MongoDB is a leading NoSQL database widely used for cloud-native and scalable applications. Unlike relational databases with rigid schemas, it stores data in flexible JSON-like documents, making it easy to model real-world entities such as students in a college database.&lt;/p&gt;

&lt;p&gt;At its core, MongoDB supports CRUD operations — Create, Read, Update, and Delete — to add, retrieve, modify, and remove data.&lt;/p&gt;

&lt;p&gt;In this blog, we’ll perform CRUD operations on a student database schema by:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Inserting multiple student records&lt;/li&gt;
&lt;li&gt;Querying and filtering data&lt;/li&gt;
&lt;li&gt;Updating details like CGPA and year&lt;/li&gt;
&lt;li&gt;Deleting records with conditions&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We’ll use MongoDB Atlas, the cloud-hosted service, for hands-on practice. By the end, you’ll have practical experience managing data in MongoDB — an essential skill for modern development.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🧱 Schema – Collection: students&lt;/strong&gt;&lt;br&gt;
Each student record (document) follows this structure:&lt;/p&gt;

&lt;p&gt;{&lt;br&gt;
"student_id": "ST001",&lt;br&gt;
"name": "Aarav",&lt;br&gt;
"age": 20,&lt;br&gt;
"department": "AI &amp;amp; DS",&lt;br&gt;
"year": 2,&lt;br&gt;
"cgpa": 8.9&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;⚙️ 1️⃣ CREATE (INSERT)&lt;/strong&gt;&lt;br&gt;
In MongoDB Atlas → Collections → Insert Document&lt;/p&gt;

&lt;p&gt;{&lt;br&gt;
"student_id": "ST001",&lt;br&gt;
"name": "Aarav",&lt;br&gt;
"age": 20,&lt;br&gt;
"department": "AI &amp;amp; DS",&lt;br&gt;
"year": 2,&lt;br&gt;
"cgpa": 8.9&lt;br&gt;
},&lt;br&gt;
{&lt;br&gt;
"student_id": "ST002",&lt;br&gt;
"name": "Diya",&lt;br&gt;
"age": 19,&lt;br&gt;
"department": "CSE",&lt;br&gt;
"year": 1,&lt;br&gt;
"cgpa": 9.2&lt;br&gt;
},&lt;br&gt;
{&lt;br&gt;
"student_id": "ST003",&lt;br&gt;
"name": "Rahul",&lt;br&gt;
"age": 21,&lt;br&gt;
"department": "ECE",&lt;br&gt;
"year": 3,&lt;br&gt;
"cgpa": 7.8&lt;br&gt;
},&lt;br&gt;
{&lt;br&gt;
"student_id": "ST004",&lt;br&gt;
"name": "Meera",&lt;br&gt;
"age": 20,&lt;br&gt;
"department": "IT",&lt;br&gt;
"year": 2,&lt;br&gt;
"cgpa": 9.5&lt;br&gt;
},&lt;br&gt;
{&lt;br&gt;
"student_id": "ST005",&lt;br&gt;
"name": "Vikram",&lt;br&gt;
"age": 22,&lt;br&gt;
"department": "MECH",&lt;br&gt;
"year": 3,&lt;br&gt;
"cgpa": 6.9&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%2Foyrocg2hnuctkkmm18gm.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%2Foyrocg2hnuctkkmm18gm.png" alt=" " width="748" height="338"&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%2Frvjh17mmexw1rt0333gp.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%2Frvjh17mmexw1rt0333gp.png" alt=" " width="777" height="328"&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%2Fm5q0yaz0lhb3dxtqad3k.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%2Fm5q0yaz0lhb3dxtqad3k.png" alt=" " width="782" height="317"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;✅ Result in Atlas:&lt;/strong&gt;&lt;br&gt;
Inserted 5 documents successfully.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🔍 2️⃣ READ (QUERY)&lt;/strong&gt;&lt;br&gt;
Run the following queries&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;(a) Display all student records&lt;/strong&gt;&lt;br&gt;
find()&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;(b) Find all students with CGPA &amp;gt; 8&lt;/strong&gt;&lt;br&gt;
({ cgpa: { $gt: 8 } })&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;(c) Find students belonging to Computer Science departments&lt;/strong&gt;&lt;br&gt;
({ department: { $in: ["CSE", "AI &amp;amp; DS"] } })&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%2Fyewm2z6dg6kccem33epk.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%2Fyewm2z6dg6kccem33epk.png" alt=" " width="800" height="293"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;📊 This helps identify top performers or department-based groups easily.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;✏️ 3️⃣ UPDATE (MODIFY RECORDS)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;(a) Update CGPA of a specific student&lt;/strong&gt;&lt;br&gt;
{ student_id: "ST002" },&lt;br&gt;
{ $set: { cgpa: 9.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%2Fdhysym8qjojk4i30h9ek.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%2Fdhysym8qjojk4i30h9ek.png" alt=" " width="800" height="342"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;✅ Matched 1 document, modified 1 document.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;(b) Increase the year of study for all 3rd-year students by 1&lt;/strong&gt;&lt;br&gt;
{ year: 3 },&lt;br&gt;
{ $inc: { year: 1 } }&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%2Fi13n8irw807wi1yujgj1.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%2Fi13n8irw807wi1yujgj1.png" alt=" " width="800" height="288"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;💡 $inc automatically increments numerical fields — perfect for promotions or increments.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🗑️ 4️⃣ DELETE (REMOVE RECORDS)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;(a) Delete one student by ID&lt;/strong&gt;&lt;br&gt;
({ student_id: "ST005" })&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%2Fkj5jka6mqxt3ged6rfq7.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%2Fkj5jka6mqxt3ged6rfq7.png" alt=" " width="800" height="248"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;OUTPUT:&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%2Ffdxpbiqkpddtz06z9ggo.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%2Ffdxpbiqkpddtz06z9ggo.png" alt=" " width="800" height="96"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;(b) Delete all students with CGPA &amp;lt; 7.5&lt;/strong&gt;&lt;br&gt;
({ cgpa: { $lt: 7.5 } })&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%2Fmhtnd58zlr2qtf8a4bed.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%2Fmhtnd58zlr2qtf8a4bed.png" alt=" " width="800" height="148"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;OUTPUT:&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%2F3ddq7rl5vaaeqacsyeiq.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%2F3ddq7rl5vaaeqacsyeiq.png" alt=" " width="800" height="112"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;🧹 Removes low-performing or outdated records, keeping your data clean.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🎓 Learning Outcomes&lt;/strong&gt;&lt;br&gt;
By performing these CRUD operations, you’ll learn to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Work with MongoDB Atlas Cloud Interface&lt;/li&gt;
&lt;li&gt;Write and execute basic MongoDB queries&lt;/li&gt;
&lt;li&gt;Update and delete data safely&lt;/li&gt;
&lt;li&gt;Export and visualize your collections&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>beginners</category>
      <category>tutorial</category>
      <category>mongodb</category>
      <category>database</category>
    </item>
    <item>
      <title>💾 Transactions, Deadlocks &amp; Log-Based Recovery in Oracle SQL</title>
      <dc:creator>Poorvika N</dc:creator>
      <pubDate>Wed, 08 Oct 2025 12:26:30 +0000</pubDate>
      <link>https://dev.to/poorvika_n/transactions-deadlocks-log-based-recovery-in-oracle-sql-dhp</link>
      <guid>https://dev.to/poorvika_n/transactions-deadlocks-log-based-recovery-in-oracle-sql-dhp</guid>
      <description>&lt;p&gt;We will explore key DBMS concepts: Transactions, Deadlocks, and Log-Based Recovery using an Accounts table in Oracle SQL.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1️⃣ Schema Setup&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;CODE:&lt;/p&gt;

&lt;p&gt;BEGIN&lt;br&gt;
   EXECUTE IMMEDIATE 'DROP TABLE Accounts';&lt;br&gt;
EXCEPTION&lt;br&gt;
   WHEN OTHERS THEN&lt;br&gt;
      IF SQLCODE != -942 THEN&lt;br&gt;
         RAISE;&lt;br&gt;
      END IF;&lt;br&gt;
END;&lt;br&gt;
/&lt;/p&gt;

&lt;p&gt;CREATE TABLE Accounts (&lt;br&gt;
    acc_no NUMBER PRIMARY KEY,&lt;br&gt;
    name VARCHAR2(50),&lt;br&gt;
    balance NUMBER&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%2Fkvzei3i1jq9i6s1lqalr.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%2Fkvzei3i1jq9i6s1lqalr.png" alt=" " width="800" height="574"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Explanation:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;NUMBER is used for numeric columns in Oracle.&lt;/li&gt;
&lt;li&gt;VARCHAR2 is used for text columns.&lt;/li&gt;
&lt;li&gt;COMMIT finalizes the inserts so other sessions can see the data.&lt;/li&gt;
&lt;li&gt;After this, the Accounts table has three accounts with initial balances.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;2️⃣ Transaction – Atomicity &amp;amp; Rollback&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;CODE:&lt;/p&gt;

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

&lt;p&gt;&lt;strong&gt;Explanation&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Oracle automatically starts a transaction with any DML statement.&lt;/li&gt;
&lt;li&gt;Atomicity ensures that either all updates succeed or none do.&lt;/li&gt;
&lt;li&gt;ROLLBACK cancels changes.&lt;/li&gt;
&lt;li&gt;After rollback, balances of Alice and Bob remain unchanged, ensuring data consistency.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;3️⃣ Deadlock Simulation&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Session 1:&lt;/p&gt;

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

&lt;p&gt;Session 2:&lt;/p&gt;

&lt;p&gt;UPDATE Accounts SET balance = balance + 100 WHERE name = 'Bob';&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%2Faivwft1pwvkrwa6jo2v6.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%2Faivwft1pwvkrwa6jo2v6.png" alt=" " width="800" height="544"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Explanation&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Session 1 locks Alice’s account.&lt;/li&gt;
&lt;li&gt;Session 2 locks Bob’s account.&lt;/li&gt;
&lt;li&gt;When each session tries to update the other’s locked row, Oracle detects a deadlock.&lt;/li&gt;
&lt;li&gt;Oracle automatically rolls back one transaction to resolve the deadlock.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;4️⃣ Log-Based Recovery&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;CODE:&lt;/p&gt;

&lt;p&gt;UPDATE Accounts SET balance = 2500 WHERE name = 'Charlie';&lt;br&gt;
ROLLBACK;&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%2F9yu2gt5du9265ouins7p.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%2F9yu2gt5du9265ouins7p.png" alt=" " width="800" height="521"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Explanation&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Oracle writes all changes to redo logs.&lt;/li&gt;
&lt;li&gt;When we ROLLBACK, Oracle uses the logs to undo changes.&lt;/li&gt;
&lt;li&gt;This ensures the database stays consistent even if a failure occurs.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>dbms</category>
      <category>programming</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Database Magic: Automating Tasks with Cursor and Trigger✨</title>
      <dc:creator>Poorvika N</dc:creator>
      <pubDate>Wed, 08 Oct 2025 11:12:39 +0000</pubDate>
      <link>https://dev.to/poorvika_n/database-magic-automating-tasks-with-cursor-and-trigger-kp5</link>
      <guid>https://dev.to/poorvika_n/database-magic-automating-tasks-with-cursor-and-trigger-kp5</guid>
      <description>&lt;h2&gt;
  
  
  🔹 Cursor:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;A cursor in SQL is used to retrieve and process rows one by one from a result set.&lt;/li&gt;
&lt;li&gt;It is mainly used when we want to perform operations row-by-row instead of all at once.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Example Use Case:&lt;/strong&gt;&lt;br&gt;
Display employee names whose salary &amp;gt; 50,000 by processing each record individually.&lt;/p&gt;

&lt;h2&gt;
  
  
  🔹 Trigger:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;A trigger is a stored program that is automatically executed in response to certain events (like INSERT, UPDATE, or DELETE) on a table.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Example Use Case:&lt;/strong&gt;&lt;br&gt;
When a new student is inserted into the Students table, automatically insert a record in the Student_Audit table to log the registration.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1️⃣ Cursor: Process Cursor with Condition&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Problem Statement:&lt;/p&gt;

&lt;p&gt;We want to iterate through all employees whose salary &amp;gt; 50,000 and print or log their names (or do something per-employee).&lt;/p&gt;

&lt;p&gt;CODE:&lt;/p&gt;

&lt;p&gt;CREATE TABLE Employee (&lt;br&gt;
  EmpID INT PRIMARY KEY,&lt;br&gt;
  EmpName VARCHAR(100),&lt;br&gt;
  Salary DECIMAL(18,2)&lt;br&gt;
);&lt;/p&gt;

&lt;p&gt;INSERT INTO Employee (EmpID, EmpName, Salary) VALUES&lt;br&gt;
  (1, 'Alice', 60000),&lt;br&gt;
  (2, 'Bob', 48000),&lt;br&gt;
  (3, 'Charlie', 75000),&lt;br&gt;
  (4, 'David', 50000),&lt;br&gt;
  (5, 'Eve', 90000);&lt;/p&gt;

&lt;p&gt;DECLARE @vEmpName VARCHAR(100);&lt;br&gt;
DECLARE @vSalary DECIMAL(18,2);&lt;/p&gt;

&lt;p&gt;DECLARE EmployeeCursor CURSOR FOR&lt;br&gt;
  SELECT EmpName, Salary&lt;br&gt;
  FROM Employee&lt;br&gt;
  WHERE Salary &amp;gt; 50000;&lt;/p&gt;

&lt;p&gt;OPEN EmployeeCursor;&lt;/p&gt;

&lt;p&gt;FETCH NEXT FROM EmployeeCursor INTO @vEmpName, @vSalary;&lt;/p&gt;

&lt;p&gt;WHILE @@FETCH_STATUS = 0&lt;br&gt;
BEGIN&lt;br&gt;
  PRINT 'Employee: ' + @vEmpName + ', Salary = ' + CAST(@vSalary AS VARCHAR(20));&lt;/p&gt;

&lt;p&gt;FETCH NEXT FROM EmployeeCursor INTO @vEmpName, @vSalary;&lt;br&gt;
END;&lt;/p&gt;

&lt;p&gt;CLOSE EmployeeCursor;&lt;br&gt;
DEALLOCATE EmployeeCursor;&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%2Fe3bqm8dx1rbs8zyf1219.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%2Fe3bqm8dx1rbs8zyf1219.png" alt=" " width="800" height="330"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Explanation:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;We create a cursor EmployeeCursor selecting EmpName, Salary for those employees whose salary &amp;gt; 50,000.&lt;/li&gt;
&lt;li&gt;OPEN the cursor, then FETCH NEXT row by row into variables.&lt;/li&gt;
&lt;li&gt;@@FETCH_STATUS = 0 means the fetch succeeded.&lt;/li&gt;
&lt;li&gt;Inside the loop, we do whatever per-employee logic (here just PRINT).&lt;/li&gt;
&lt;li&gt;Finally, CLOSE and DEALLOCATE to free resources.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;2️⃣ Trigger: AFTER INSERT Trigger on Student → Audit Log&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Problem Statement:&lt;/p&gt;

&lt;p&gt;Whenever a new student is inserted into the Student table, automatically insert a row into Student_Audit to log that registration (e.g. with timestamp, action, etc.).&lt;/p&gt;

&lt;p&gt;CODE:&lt;/p&gt;

&lt;p&gt;CREATE TABLE Student (&lt;br&gt;
  StudentID INT PRIMARY KEY,&lt;br&gt;
  StudentName VARCHAR(100),&lt;br&gt;
  Department VARCHAR(100),&lt;br&gt;
  YearOfStudy INT,&lt;br&gt;
  CGPA DECIMAL(4,2)&lt;br&gt;
);&lt;br&gt;
GO&lt;br&gt;
CREATE TABLE Student_Audit (&lt;br&gt;
  AuditID INT IDENTITY(1,1) PRIMARY KEY,&lt;br&gt;
  StudentID INT,&lt;br&gt;
  StudentName VARCHAR(100),&lt;br&gt;
  Action VARCHAR(20),&lt;br&gt;
  ActionTime DATETIME&lt;br&gt;
);&lt;br&gt;
GO&lt;br&gt;
CREATE TRIGGER trg_AfterStudentInsert&lt;br&gt;
ON Student&lt;br&gt;
AFTER INSERT&lt;br&gt;
AS&lt;br&gt;
BEGIN&lt;br&gt;
    SET NOCOUNT ON;&lt;br&gt;
    INSERT INTO Student_Audit (StudentID, StudentName, Action, ActionTime)&lt;br&gt;
    SELECT i.StudentID, i.StudentName, 'INSERT', GETDATE()&lt;br&gt;
    FROM inserted AS i;&lt;br&gt;
END;&lt;br&gt;
GO&lt;br&gt;
INSERT INTO Student (StudentID, StudentName, Department, YearOfStudy, CGPA)&lt;br&gt;
VALUES (101, 'Rahul', 'CSE', 1, 9.2);&lt;/p&gt;

&lt;p&gt;INSERT INTO Student (StudentID, StudentName, Department, YearOfStudy, CGPA)&lt;br&gt;
VALUES (102, 'Sita', 'ECE', 2, 8.8);&lt;br&gt;
GO&lt;br&gt;
SELECT * FROM Student_Audit;&lt;br&gt;
GO&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%2Fortn2fmq4bk3grn0q42g.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%2Fortn2fmq4bk3grn0q42g.png" alt=" " width="800" height="415"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Explanation:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The AFTER INSERT trigger fires after the row(s) are inserted into Student.&lt;/li&gt;
&lt;li&gt;The trigger uses the inserted pseudo-table (available in SQL Server) to get the newly inserted rows.&lt;/li&gt;
&lt;li&gt;For each inserted row, it inserts a corresponding log row in Student_Audit with columns like Action = 'INSERT' and current timestamp.&lt;/li&gt;
&lt;li&gt;So you always have a record of new students inserted.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>sql</category>
      <category>database</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>ACID Properties</title>
      <dc:creator>Poorvika N</dc:creator>
      <pubDate>Mon, 06 Oct 2025 16:52:34 +0000</pubDate>
      <link>https://dev.to/poorvika_n/acid-properties-4cf</link>
      <guid>https://dev.to/poorvika_n/acid-properties-4cf</guid>
      <description>&lt;h2&gt;
  
  
  Atomicity in Database Transactions
&lt;/h2&gt;

&lt;p&gt;Atomicity is the “all or nothing” property of a database transaction.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It ensures that a transaction — which may include multiple SQL statements — is treated as a single indivisible unit of work.&lt;/li&gt;
&lt;li&gt;That means either all operations of the transaction succeed, or none of them do.&lt;/li&gt;
&lt;li&gt;If any part of the transaction fails (due to error, power loss, or system crash), the database rolls back to its previous stable state — ensuring that no partial updates occur.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;1. Create a table Accounts(acc_no INT PRIMARY KEY, name VARCHAR(50), balance INT). Insert 3 sample rows.&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%2Flqsi8pc08ltqsx8eeywo.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%2Flqsi8pc08ltqsx8eeywo.png" alt=" " width="800" height="541"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Atomicity: Start a transaction that transfers money. Rollback midway → ensure no partial update remains.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Atomicity ensures all operations in a transaction succeed or none do.&lt;/p&gt;

&lt;p&gt;Example: Transfer ₹1000 from Ravi → Priya and rollback midway&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%2F8cuxlxj8etple2jloesy.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%2F8cuxlxj8etple2jloesy.png" alt=" " width="800" height="510"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Result: No partial transfer — both balances remain same (proving Atomicity).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Consistency: Try inserting a record with negative balance → should be rejected.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Consistency ensures that data integrity rules (constraints) are not violated.&lt;/p&gt;

&lt;p&gt;Example: Try inserting a record with negative balance&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%2Fnyfnlrrgm8evfylrdwva.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%2Fnyfnlrrgm8evfylrdwva.png" alt=" " width="730" height="785"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This will fail because of the CHECK (balance &amp;gt;= 0) constraint.&lt;br&gt;
Result: Database remains in a consistent state.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Isolation: Run two sessions at once – one updating, the other reading → observe isolation.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Isolation ensures that concurrent transactions do not interfere with each other.&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%2Fvrxiftr8j9gh4vfekxoc.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%2Fvrxiftr8j9gh4vfekxoc.png" alt=" " width="800" height="580"&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%2Fogjp30lmzhpohh5oqb84.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%2Fogjp30lmzhpohh5oqb84.png" alt=" " width="800" height="473"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Depending on isolation level:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;READ UNCOMMITTED → Session 2 might see uncommitted data (dirty read)&lt;/li&gt;
&lt;li&gt;READ COMMITTED (default) → Session 2 sees only committed data&lt;/li&gt;
&lt;li&gt;REPEATABLE READ / SERIALIZABLE → Session 2 waits or reads the old value until Session 1 commits Result: Each session’s visibility depends on the isolation level — proving isolation behavior.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;5. Durability: Commit a transaction → restart DB → ensure data persists.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Durability ensures that once a transaction is committed, changes are permanent, even after a crash or restart.&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%2F00558ljlasvckv2igrxe.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%2F00558ljlasvckv2igrxe.png" alt=" " width="800" height="706"&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%2Fl7wr5d1gs3mdi9qqo23q.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%2Fl7wr5d1gs3mdi9qqo23q.png" alt=" " width="800" height="490"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Result: The updated balance remains — showing durability.&lt;/p&gt;

</description>
      <category>database</category>
      <category>sql</category>
      <category>architecture</category>
    </item>
    <item>
      <title>NORMALIZATION</title>
      <dc:creator>Poorvika N</dc:creator>
      <pubDate>Mon, 06 Oct 2025 15:57:37 +0000</pubDate>
      <link>https://dev.to/poorvika_n/normalization-2p64</link>
      <guid>https://dev.to/poorvika_n/normalization-2p64</guid>
      <description>&lt;h2&gt;
  
  
  Define Normalization?
&lt;/h2&gt;

&lt;p&gt;Normalization is a process in database design used to organize data efficiently. The main goal is to minimize redundancy (repeated data) and avoid inconsistencies. It ensures that each piece of data is stored only once, making the database more reliable and easier to maintain.&lt;/p&gt;

&lt;p&gt;In practice, normalization involves breaking a large, complex table into smaller, simpler tables and linking them using foreign keys. This structure allows data to be stored logically while preserving relationships between tables.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why is Normalization Needed?
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Normalization provides several key benefits:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Eliminates Data Duplication – Storing data only once reduces redundancy, preventing unnecessary repetition.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Ensures Data Consistency – Updating a single value automatically updates it everywhere it’s used, maintaining accuracy.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Simplifies Data Updates and Maintenance – Smaller, organized tables are easier to modify without errors.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Saves Storage Space – Avoiding repeated data reduces the storage needed.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Improves Query Performance – Structured data helps the database retrieve information faster.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Normal Forms
&lt;/h2&gt;

&lt;p&gt;Normalization is done in stages, called normal forms. Each stage fixes certain types of problems in the data.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;First Normal Form (1NF)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A table is in 1NF if each column contains atomic (indivisible) values.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Repeating groups or arrays are not allowed.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Each record (row) must be unique, usually ensured by a primary key.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Second Normal Form (2NF)&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;A table is in 2NF if it is in 1NF and no non-key attribute depends on part of a composite key.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Eliminates partial dependency, ensuring that non-key data depends on the whole primary key.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Third Normal Form (3NF)&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;A table is in 3NF if it is in 2NF and no non-key attribute depends on another non-key attribute.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Eliminates transitive dependency.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Boyce-Codd Normal Form (BCNF)&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A stricter version of 3NF.&lt;/li&gt;
&lt;li&gt;Every determinant must be a candidate key.&lt;/li&gt;
&lt;li&gt;Helps remove rare anomalies not covered by 3NF.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Fourth Normal Form (4NF)&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Addresses multi-valued dependencies.&lt;/li&gt;
&lt;li&gt;Ensures that if one attribute depends on another, it doesn’t repeat unnecessarily with other independent attributes.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Fifth Normal Form (5NF)&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Deals with join dependencies.&lt;/li&gt;
&lt;li&gt;Ensures data can be reconstructed from smaller tables without redundancy.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We shall use the following data as the starting point:&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%2Fx93j7zfh4t957qsg05y4.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%2Fx93j7zfh4t957qsg05y4.png" alt=" " width="800" height="226"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Identify anomalies (insertion, update, deletion) in this table.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;🔸 Insertion Anomaly&lt;/p&gt;

&lt;p&gt;We can’t add a new course until at least one student registers for it, because all course data is mixed with student data.&lt;/p&gt;

&lt;p&gt;e.g., Can’t add a new course C104 – ML – Dr. Sharma without a student.&lt;/p&gt;

&lt;p&gt;🔸 Update Anomaly&lt;/p&gt;

&lt;p&gt;If an instructor’s phone number changes, it must be updated in multiple rows.&lt;/p&gt;

&lt;p&gt;e.g., Dr. Kumar’s phone number appears twice.&lt;/p&gt;

&lt;p&gt;🔸 Deletion Anomaly&lt;/p&gt;

&lt;p&gt;If all students drop DBMS, deleting those rows also deletes Dr. Kumar and the course DBMS information.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Convert the table to 1NF and write the SQL CREATE TABLE statement for it.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;✅ The table already satisfies 1NF because:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;All values are atomic.&lt;/li&gt;
&lt;li&gt;Each row is unique (based on StudentID + CourseID).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We’ll explicitly define a composite primary key (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%2Facembgcc13ftg0u2uebx.jpeg" 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%2Facembgcc13ftg0u2uebx.jpeg" alt=" " width="800" height="492"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Convert the table to 2NF and write SQL CREATE TABLE statements for the resulting tables, including primary keys.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In the current table:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;StudentName depends only on StudentID&lt;/li&gt;
&lt;li&gt;CourseName, Instructor, and InstructorPhone depend only on CourseID&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So we separate Student and Course information.&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%2F6bfjcyoerw5lp0grai9d.jpeg" 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%2F6bfjcyoerw5lp0grai9d.jpeg" alt=" " width="800" height="517"&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%2Fp24afhtorms05k6pi7hc.jpeg" 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%2Fp24afhtorms05k6pi7hc.jpeg" alt=" " width="794" height="519"&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%2Fgzcxwi8ghhbsnsqz3d2y.jpeg" 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%2Fgzcxwi8ghhbsnsqz3d2y.jpeg" alt=" " width="782" height="523"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Convert the table to 3NF and write SQL CREATE TABLE statements, including foreign keys.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Here, in Courses, InstructorPhone depends on Instructor, not on CourseID.&lt;/p&gt;

&lt;p&gt;So we separate instructor details into a new 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%2Fazw2a2267y62wqgigv3l.jpeg" 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%2Fazw2a2267y62wqgigv3l.jpeg" alt=" " width="800" height="517"&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%2Fq7mhrvteqscevfv0zqjx.jpeg" 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%2Fq7mhrvteqscevfv0zqjx.jpeg" alt=" " width="790" height="511"&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%2Fpt0ydtnt3gqnftx37v33.jpeg" 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%2Fpt0ydtnt3gqnftx37v33.jpeg" alt=" " width="800" height="499"&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%2Fumk4l73ot9nkhe4qbj4e.jpeg" 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%2Fumk4l73ot9nkhe4qbj4e.jpeg" alt=" " width="782" height="523"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. Insert the sample data into the normalized tables using INSERT INTO statements.&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%2Fc3ibdua9wk036z26fmpu.jpeg" 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%2Fc3ibdua9wk036z26fmpu.jpeg" alt=" " width="784" 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%2Fuj58z9xtt95wfwlxk447.jpeg" 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%2Fuj58z9xtt95wfwlxk447.jpeg" alt=" " width="774" height="514"&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%2Fuxdsmbhftt8141voqyde.jpeg" 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%2Fuxdsmbhftt8141voqyde.jpeg" alt=" " width="793" height="527"&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%2Ft1w3mrhpwcj5822ve9sv.jpeg" 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%2Ft1w3mrhpwcj5822ve9sv.jpeg" alt=" " width="800" height="549"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;6. Write a query to list all students along with their courses and instructor names using JOINs.&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%2Fxgxj78x0nhcuyob63x4c.jpeg" 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%2Fxgxj78x0nhcuyob63x4c.jpeg" alt=" " width="800" height="560"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>design</category>
      <category>database</category>
      <category>computerscience</category>
    </item>
    <item>
      <title>Indexing, Hashing &amp; Query Optimization</title>
      <dc:creator>Poorvika N</dc:creator>
      <pubDate>Mon, 06 Oct 2025 14:30:56 +0000</pubDate>
      <link>https://dev.to/poorvika_n/indexing-hashing-query-optimization-31ij</link>
      <guid>https://dev.to/poorvika_n/indexing-hashing-query-optimization-31ij</guid>
      <description>&lt;p&gt;&lt;strong&gt;Indexing&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Indexing is a method used to speed up the retrieval of data from a database. It works by creating a separate structure (called an index) that allows the database to find records quickly without scanning the entire table.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Common types of indexes include:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;B-Tree Index – ideal for search operations and sorting data.&lt;/p&gt;

&lt;p&gt;B+ Tree Index – optimized for queries that involve ranges.&lt;/p&gt;

&lt;p&gt;Hash Index – best suited for exact match searches.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Hashing&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Hashing involves applying a hash function to a key (such as a department name) to generate a hash value, which directly points to the location of the record.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It provides fast access for equality searches.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It is not efficient for range queries, since hash values do not maintain any order.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




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

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Query optimization is the process of determining the most efficient way to run a database query.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The query optimizer examines indexes, join methods, and conditions.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The goal is to reduce execution time and improve overall performance.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  1. Create a table Students with fields (roll_no, name, dept, cgpa)
&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%2F1zbmb06p4v60nh7ix6a4.jpeg" 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%2F1zbmb06p4v60nh7ix6a4.jpeg" alt=" " width="616" height="510"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Insert at least 20 sample records.
&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%2F9x7izw9svrp1k0qq7dg0.jpeg" 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%2F9x7izw9svrp1k0qq7dg0.jpeg" alt=" " width="619" height="505"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Create a B-Tree index on the roll_no column of the Students 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%2Fbeoqjufj8bllb5ez8ljz.jpeg" 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%2Fbeoqjufj8bllb5ez8ljz.jpeg" alt=" " width="800" height="519"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Execute a query to fetch the details of a student with roll_no = 110.
&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%2F1ee1bmeogy950j606tg6.jpeg" 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%2F1ee1bmeogy950j606tg6.jpeg" alt=" " width="800" height="497"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;h2&gt;
  
  
  5. Create a B+ Tree index on the cgpa column of the Students 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%2Ft13exq3mfcc9hwd826v9.jpeg" 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%2Ft13exq3mfcc9hwd826v9.jpeg" alt=" " width="719" height="89"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Write a query to display all students with cgpa &amp;gt; 8.0.
&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%2Fh3st1aqqhke3d0b6k9fa.jpeg" 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%2Fh3st1aqqhke3d0b6k9fa.jpeg" alt=" " width="800" height="606"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  7. Create a Hash index on the dept column of the Students 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%2Fvusc6tzbfmnvc1fytlgw.jpeg" 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%2Fvusc6tzbfmnvc1fytlgw.jpeg" alt=" " width="565" height="87"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  8. Run a query to retrieve all students from the 'CSBS' department.
&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%2Fna6oqo9h7p50wm9z437r.jpeg" 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%2Fna6oqo9h7p50wm9z437r.jpeg" alt=" " width="800" height="582"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>algorithms</category>
      <category>database</category>
      <category>performance</category>
    </item>
    <item>
      <title>COLLEGE STUDENT &amp; COURSE MANAGEMENT SYSTEM</title>
      <dc:creator>Poorvika N</dc:creator>
      <pubDate>Thu, 21 Aug 2025 17:33:39 +0000</pubDate>
      <link>https://dev.to/poorvika_n/college-student-course-management-system-j4f</link>
      <guid>https://dev.to/poorvika_n/college-student-course-management-system-j4f</guid>
      <description>&lt;p&gt;&lt;strong&gt;Introduction:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In this blog, we explore the design and implementation of a College Student &amp;amp; Course Management System using Oracle SQL on the LiveSQL platform. The system highlights how different SQL operations can be applied to manage and organize academic data including students, courses, faculty, and enrollments.&lt;/p&gt;

&lt;p&gt;The project mainly focuses on:&lt;br&gt;
=&amp;gt;Creating tables to represent different entities.&lt;br&gt;
=&amp;gt;Inserting records to populate the database with sample data. =&amp;gt;Applying constraints to maintain accuracy and consistency.&lt;br&gt;
=&amp;gt;Running queries with functions, aggregates, joins, and group operations.&lt;br&gt;
=&amp;gt;Building a view for simplified access to combined data.&lt;br&gt;
=&amp;gt;Writing a stored procedure to handle automated updates.&lt;/p&gt;

&lt;p&gt;By implementing this system, we get a clear understanding of how SQL can be used in a real-world college scenario to handle tasks such as student course registrations, faculty records, grade management, and department-level statistics.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;SCHEMA DESIGN FOR COLLEGE MANAGEMENT SYSTEM:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The designed database has four core tables: Students, Courses, Enrollments, and Faculty.&lt;br&gt;
Each table holds specific information and is connected through primary and foreign keys to maintain proper relationships.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Students Table&lt;/strong&gt;&lt;br&gt;
CREATE TABLE Students (&lt;br&gt;
StudentID NUMBER PRIMARY KEY,&lt;br&gt;
Name VARCHAR2(50) NOT NULL,&lt;br&gt;
Dept VARCHAR2(30),&lt;br&gt;
DOB DATE,&lt;br&gt;
Email VARCHAR2(50) UNIQUE&lt;br&gt;
);&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Courses Table&lt;/strong&gt;&lt;br&gt;
CREATE TABLE Courses (&lt;br&gt;
CourseID NUMBER PRIMARY KEY,&lt;br&gt;
CourseName VARCHAR2(50) NOT NULL,&lt;br&gt;
Credits NUMBER(2)&lt;br&gt;
);&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Enrollments Table&lt;/strong&gt;&lt;br&gt;
CREATE TABLE Enrollments (&lt;br&gt;
EnrollID NUMBER PRIMARY KEY,&lt;br&gt;
StudentID NUMBER REFERENCES Students(StudentID),&lt;br&gt;
CourseID NUMBER REFERENCES Courses(CourseID),&lt;br&gt;
Grade CHAR(2)&lt;br&gt;
);&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. DDL – Create a Table&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;=&amp;gt; DDL defines the structure of database objects (tables, views, indexes).&lt;br&gt;
=&amp;gt; We created a Faculty table with FacultyID, FacultyName, Dept, and Email.&lt;/p&gt;

&lt;p&gt;CREATE TABLE Faculty (&lt;br&gt;
    FacultyID NUMBER PRIMARY KEY,&lt;br&gt;
    FacultyName VARCHAR2(50) NOT NULL,&lt;br&gt;
    Dept VARCHAR2(30),&lt;br&gt;
    Email VARCHAR2(50) UNIQUE&lt;br&gt;
);&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. DML – Insert Data&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;=&amp;gt; DDML (Data Manipulation Language) is used to add, update, delete, or fetch records in a table.&lt;br&gt;
=&amp;gt; We inserted 3 faculty members (Dr. Neha Sharma, Dr. Rajeev Nair, Dr. Meena Reddy) into the Faculty table using INSERT INTO.&lt;/p&gt;

&lt;p&gt;INSERT INTO Faculty (FacultyID, FacultyName, Dept, Email)&lt;br&gt;
VALUES (1, 'Dr. Neha Sharma', 'CSE', '&lt;a href="mailto:neha.sharma@college.com"&gt;neha.sharma@college.com&lt;/a&gt;');&lt;/p&gt;

&lt;p&gt;INSERT INTO Faculty (FacultyID, FacultyName, Dept, Email)&lt;br&gt;
VALUES (2, 'Dr. Rajeev Nair', 'ECE', '&lt;a href="mailto:rajeev.nair@college.com"&gt;rajeev.nair@college.com&lt;/a&gt;');&lt;/p&gt;

&lt;p&gt;INSERT INTO Faculty (FacultyID, FacultyName, Dept, Email)&lt;br&gt;
VALUES (3, 'Dr. Meena Reddy', 'MECH', '&lt;a href="mailto:meena.reddy@college.com"&gt;meena.reddy@college.com&lt;/a&gt;');&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. ALTER Table – Add Column&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;=&amp;gt; ALTER modifies the structure of an existing table (add/modify/drop columns).&lt;br&gt;
=&amp;gt; We added a new column PhoneNo in the Students table.&lt;/p&gt;

&lt;p&gt;ALTER TABLE Students&lt;br&gt;
ADD PhoneNo NUMBER(10);&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Defining Constraints&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;=&amp;gt; Constraints enforce rules on data to maintain integrity (like N NULL, UNIQUE, CHECK).&lt;br&gt;
=&amp;gt; We applied a CHECK constraint so that Credits in Courses must be between 1 and 5.&lt;/p&gt;

&lt;p&gt;ALTER TABLE Courses&lt;br&gt;
MODIFY (Credits CONSTRAINT chk_credits CHECK (Credits BETWEEN 1 AND 5));&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. SELECT with Functions&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;=&amp;gt; Functions in SELECT perform operations like text conversion, length calculation, etc.&lt;br&gt;
=&amp;gt; We displayed student names in uppercase and showed the length of their email IDs.&lt;/p&gt;

&lt;p&gt;SELECT Name, UPPER(Name) AS UpperName, LENGTH(Email) AS EmailLength &lt;br&gt;
FROM Students;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;6. Aggregate Functions&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;=&amp;gt; Aggregate functions are used to perform calculations on a set of values and return a single result. Common functions include AVG, COUNT, SUM, MIN, and MAX. They are often used in reporting and analysis.&lt;br&gt;
=&amp;gt; SELECT AVG(Credits) AS Avg_Credits FROM Courses; → calculated the average credits of all courses.&lt;br&gt;
=&amp;gt; SELECT COUNT(*) AS Total_Students FROM Students; → counted the total number of students in the Students table.&lt;/p&gt;

&lt;p&gt;SELECT AVG(Credits) AS Avg_Credits&lt;br&gt;
FROM Courses;&lt;/p&gt;

&lt;p&gt;SELECT COUNT(*) AS Total_Students&lt;br&gt;
FROM Students;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;7. JOIN Operation&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;=&amp;gt; JOIN combines related data from multiple tables using common keys.&lt;br&gt;
=&amp;gt; We listed students with the courses they are enrolled in and their grades.&lt;/p&gt;

&lt;p&gt;SELECT s.Name AS StudentName, c.CourseName, e.Grade&lt;br&gt;
FROM Students s&lt;br&gt;
JOIN Enrollments e ON s.StudentID = e.StudentID&lt;br&gt;
JOIN Courses c ON e.CourseID = c.CourseID;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;8. GROUP BY with HAVING&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;=&amp;gt; GROUP BY groups rows based on column values, and HAVING filters groups.&lt;br&gt;
=&amp;gt; We grouped students by department and displayed only departments with more than 2 students.&lt;/p&gt;

&lt;p&gt;SELECT Dept, COUNT( * ) AS StudentCount&lt;br&gt;
FROM Students&lt;br&gt;
GROUP BY Dept&lt;br&gt;
HAVING COUNT(*) &amp;gt; 2;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;9. Views&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;=&amp;gt; A View is a virtual table created from a query for easier data access.&lt;br&gt;
=&amp;gt; We created StudentCoursesView to show StudentName, CourseName, and Grade.&lt;/p&gt;

&lt;p&gt;CREATE OR REPLACE VIEW StudentCoursesView AS&lt;br&gt;
SELECT s.Name AS StudentName, c.CourseName, e.Grade&lt;br&gt;
FROM Students s&lt;br&gt;
JOIN Enrollments e ON s.StudentID = e.StudentID&lt;br&gt;
JOIN Courses c ON e.CourseID = c.CourseID;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;10. Stored Procedure&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;=&amp;gt; A Stored Procedure is a saved block of SQL statements that can be executed when needed.&lt;br&gt;
=&amp;gt; We wrote UpdateGrade procedure to update a student’s grade in Enrollments.&lt;/p&gt;

&lt;p&gt;CREATE OR REPLACE PROCEDURE UpdateGrade (&lt;br&gt;
    p_StudentID IN NUMBER,&lt;br&gt;
    p_CourseID IN NUMBER,&lt;br&gt;
    p_NewGrade IN CHAR&lt;br&gt;
) AS&lt;br&gt;
BEGIN&lt;br&gt;
    UPDATE Enrollments&lt;br&gt;
    SET Grade = p_NewGrade&lt;br&gt;
    WHERE StudentID = p_StudentID AND CourseID = p_CourseID;&lt;br&gt;
    COMMIT;&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%2Fdee649nx5q15l1f0y08h.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%2Fdee649nx5q15l1f0y08h.png" alt=" " width="800" height="341"&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%2F6ywufnirzp786frr3uut.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%2F6ywufnirzp786frr3uut.png" alt=" " width="800" height="340"&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%2Fi2oeidgejhor71jysmqo.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%2Fi2oeidgejhor71jysmqo.png" alt=" " width="800" height="338"&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%2F1blww7nuwjdm9uu40h1c.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%2F1blww7nuwjdm9uu40h1c.png" alt=" " width="800" height="338"&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%2Fjohktdlmqo5hhwfdr3vg.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%2Fjohktdlmqo5hhwfdr3vg.png" alt=" " width="800" height="335"&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%2Fb62wagtiy1pk5pjilm6t.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%2Fb62wagtiy1pk5pjilm6t.png" alt=" " width="800" height="339"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>sql</category>
      <category>database</category>
      <category>oracle</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
