<?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: Naveens K</title>
    <description>The latest articles on DEV Community by Naveens K (@naveens_k_403279738dbcab6).</description>
    <link>https://dev.to/naveens_k_403279738dbcab6</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%2F3449050%2Ff3ce2c47-17b6-49c2-a216-7204b41bdbf4.png</url>
      <title>DEV Community: Naveens K</title>
      <link>https://dev.to/naveens_k_403279738dbcab6</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/naveens_k_403279738dbcab6"/>
    <language>en</language>
    <item>
      <title>AWS Neptune: Where Data Relationships Actually Make Sense</title>
      <dc:creator>Naveens K</dc:creator>
      <pubDate>Thu, 18 Dec 2025 14:44:14 +0000</pubDate>
      <link>https://dev.to/naveens_k_403279738dbcab6/aws-neptune-where-data-relationships-actually-make-sense-311n</link>
      <guid>https://dev.to/naveens_k_403279738dbcab6/aws-neptune-where-data-relationships-actually-make-sense-311n</guid>
      <description>&lt;h2&gt;
  
  
  Overview
&lt;/h2&gt;

&lt;p&gt;AWS Neptune is a fully managed &lt;strong&gt;graph database&lt;/strong&gt; service designed for workloads where relationships matter more than rows. If you try to force social networks, fraud detection, or recommendation engines into a relational database, you’ll hit performance walls fast. Neptune exists to solve that exact problem using graph models, not SQL gymnastics.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;It supports two graph paradigms:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Property Graph (&lt;strong&gt;Gremlin&lt;/strong&gt;)&lt;/li&gt;
&lt;li&gt;RDF / Semantic Graph (&lt;strong&gt;SPARQL&lt;/strong&gt;)&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;Fully managed (&lt;strong&gt;no OS, patching, backups, or replication babysitting&lt;/strong&gt;)&lt;/li&gt;
&lt;li&gt;High performance graph queries (&lt;strong&gt;milliseconds at scale&lt;/strong&gt;)&lt;/li&gt;
&lt;li&gt;Supports &lt;strong&gt;Gremlin, SPARQL, and openCypher&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Built-in high availability with up to &lt;strong&gt;15 read replicas&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Continuous backups to S3 and &lt;strong&gt;point-in-time&lt;/strong&gt; recovery&lt;/li&gt;
&lt;li&gt;Encryption at rest (&lt;strong&gt;KMS&lt;/strong&gt;) and in transit (&lt;strong&gt;TLS&lt;/strong&gt;)&lt;/li&gt;
&lt;li&gt;Integrates with &lt;code&gt;IAM&lt;/code&gt;, &lt;code&gt;VPC&lt;/code&gt;, &lt;code&gt;CloudWatch&lt;/code&gt;, and &lt;code&gt;CloudTrail&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Database&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Specialized Databases → &lt;strong&gt;Graph Database&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Part of &lt;strong&gt;Data &amp;amp; Analytics&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;Design phase: Choosing the right data model for &lt;strong&gt;relationship-heavy systems&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Build phase: &lt;strong&gt;Backend services query&lt;/strong&gt; Neptune instead of relational DBs&lt;/li&gt;
&lt;li&gt;Deploy phase: Provisioned via &lt;strong&gt;&lt;code&gt;CloudFormation&lt;/code&gt;, CDK, or &lt;code&gt;Terraform&lt;/code&gt;&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Operate phase: Monitoring with&lt;code&gt;CloudWatch&lt;/code&gt;, scaling via read replicas&lt;/li&gt;
&lt;li&gt;DevSecOps: &lt;code&gt;IAM-based&lt;/code&gt; access, &lt;code&gt;VPC&lt;/code&gt; isolation, encryption, audit logs&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;Query Languages:&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Gremlin&lt;/strong&gt; (&lt;code&gt;Apache TinkerPop&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;SPARQL&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;openCypher&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;SDK / Access:&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;AWS SDKs (&lt;code&gt;Java&lt;/code&gt;, &lt;code&gt;Python&lt;/code&gt;, &lt;code&gt;JavaScript&lt;/code&gt;,&lt;code&gt;Go&lt;/code&gt;, etc.)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;HTTP(S)&lt;/code&gt; endpoints &lt;/li&gt;
&lt;li&gt;Gremlin drivers and SPARQL clients&lt;/li&gt;
&lt;/ol&gt;

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

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Instance-based pricing&lt;/strong&gt; (pay for DB instance size and hours used)&lt;/li&gt;
&lt;li&gt;Storage billed per &lt;strong&gt;GB/month&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;I/O operations billed separately&lt;/li&gt;
&lt;li&gt;Backup storage beyond free limit is charged&lt;/li&gt;
&lt;li&gt;No free tier worth mentioning for real workloads
Translation: powerful but expensive. Use it only when graph queries are a hard requirement.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>performance</category>
      <category>database</category>
      <category>architecture</category>
      <category>aws</category>
    </item>
    <item>
      <title>NuGet: The Backbone of .NET Dependency Management</title>
      <dc:creator>Naveens K</dc:creator>
      <pubDate>Thu, 18 Dec 2025 14:24:54 +0000</pubDate>
      <link>https://dev.to/naveens_k_403279738dbcab6/nuget-the-backbone-of-net-dependency-management-3927</link>
      <guid>https://dev.to/naveens_k_403279738dbcab6/nuget-the-backbone-of-net-dependency-management-3927</guid>
      <description>&lt;h2&gt;
  
  
  Overview of the Tool
&lt;/h2&gt;

&lt;p&gt;NuGet is the &lt;strong&gt;official package manager for the .NET ecosystem&lt;/strong&gt;. Its only job is to find, install, update, and manage dependencies for .NET projects. If you’re building anything in .NET.&lt;/p&gt;

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

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Centralized package repository (nuget.org)&lt;/strong&gt; with hundreds of thousands of libraries&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Dependency resolution&lt;/strong&gt; (handles transitive dependencies automatically)&lt;/li&gt;
&lt;li&gt;Versioning support (semantic versioning, locking, rollback)&lt;/li&gt;
&lt;li&gt;CLI (&lt;code&gt;nuget&lt;/code&gt;, &lt;code&gt;dotnet add package&lt;/code&gt;) and IDE integration (Visual Studio)&lt;/li&gt;
&lt;li&gt;Private package feeds (&lt;strong&gt;Azure Artifacts, GitHub Packages, Nexus, Artifactory&lt;/strong&gt;)&lt;/li&gt;
&lt;li&gt;Package signing and &lt;strong&gt;vulnerability metadata&lt;/strong&gt; (basic but improving)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  How It Fits into DevOps / DevSecOps
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;DevOps:&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;Used in CI/CD pipelines to restore dependencies (&lt;code&gt;dotnet restore&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;Ensures consistent builds across environments&lt;/li&gt;
&lt;li&gt;Works with artifact repositories for internal packages&lt;/li&gt;
&lt;li&gt;&lt;p&gt;DevSecOps:&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Supports signed packages to reduce supply-chain attacks&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Integrates with vulnerability scanners (&lt;strong&gt;Dependabot, Snyk, GitHub Advanced Security&lt;/strong&gt;)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Can enforce approved/internal packages via private feeds&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Programming Language
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Primarily C# / .NET&lt;/li&gt;
&lt;li&gt;Supports all .NET languages: C#, F#, VB.NET&lt;/li&gt;
&lt;li&gt;Built on the .NET platform&lt;/li&gt;
&lt;li&gt;Parent Company: &lt;strong&gt;Microsoft&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Open Source Platform:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;MIT License&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Enterprise features come indirectly via paid tools (&lt;strong&gt;Azure DevOps, GitHub Enterprise, Artifactory&lt;/strong&gt;), not NuGet itself&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>devops</category>
      <category>dotnet</category>
      <category>tooling</category>
    </item>
    <item>
      <title>CRUD OPERATIONS IN MONGODB</title>
      <dc:creator>Naveens K</dc:creator>
      <pubDate>Fri, 03 Oct 2025 09:21:06 +0000</pubDate>
      <link>https://dev.to/naveens_k_403279738dbcab6/crud-operations-in-mongodb-4fkd</link>
      <guid>https://dev.to/naveens_k_403279738dbcab6/crud-operations-in-mongodb-4fkd</guid>
      <description>&lt;h2&gt;
  
  
  INTRODUCTION
&lt;/h2&gt;

&lt;p&gt;MongoDB is one of the most popular NoSQL databases, widely used for its flexibility and scalability. Unlike relational databases, MongoDB stores data in collections as JSON-like documents.&lt;/p&gt;

&lt;p&gt;In this blog, we’ll perform CRUD (Create, Read, Update, Delete) operations on a simple college student schema to understand MongoDB basics hands-on.&lt;/p&gt;

&lt;p&gt;Here we are using MongoDB Shell for scripting in MongoDB Compass&lt;br&gt;
run all the commands in MongoDB Shell. this will work great.&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%2Fpjyt88t4xym6z0tpn44x.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%2Fpjyt88t4xym6z0tpn44x.png" alt=" " width="800" height="459"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0nticl6dduhragxhmpbo.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%2F0nticl6dduhragxhmpbo.png" alt=" " width="800" height="459"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Student Schema&lt;/strong&gt;&lt;br&gt;
We’ll use a collection called &lt;code&gt;students&lt;/code&gt;, and each document follows this basic 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;&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%2Fh15mi7gi7mvxpy2401hk.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%2Fh15mi7gi7mvxpy2401hk.png" alt=" " width="800" height="459"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Create (Insert)
&lt;/h2&gt;

&lt;p&gt;Inserting 5 student records:&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.insertMany([
  {
    "student_id": "S001",
    "name": "Santhosh",
    "age": 20,
    "department": "CSBS",
    "year": 2,
    "cgpa": 9
  },
  {
    "student_id": "S002",
    "name": "Kavya",
    "age": 21,
    "department": "CSE",
    "year": 3,
    "cgpa": 8.5
  },
  {
    "student_id": "S003",
    "name": "Arun",
    "age": 19,
    "department": "ECE",
    "year": 1,
    "cgpa": 7.8
  },
  {
    "student_id": "S004",
    "name": "Priya",
    "age": 22,
    "department": "CSE",
    "year": 4,
    "cgpa": 9.2
  },
  {
    "student_id": "S005",
    "name": "Vignesh",
    "age": 20,
    "department": "MECH",
    "year": 2,
    "cgpa": 6.9
  }
])
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will create 5 documents in the &lt;code&gt;students&lt;/code&gt; collection.&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%2Fwcalknt48vx31xbg2c92.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%2Fwcalknt48vx31xbg2c92.png" alt=" " width="800" height="459"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fufuue7ixi9bya4sax7gd.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%2Fufuue7ixi9bya4sax7gd.png" alt=" " width="800" height="459"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Read (Query)
&lt;/h2&gt;

&lt;p&gt;Display all student records:&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()
&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%2Fkm3f8epdihfsp53fgu2y.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%2Fkm3f8epdihfsp53fgu2y.png" alt=" " width="800" height="459"&gt;&lt;/a&gt;&lt;/p&gt;

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

&lt;p&gt;Find students belonging to the Computer Science department:&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({ department: "CSE" })
&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%2Fqdtdh4ati2keqozb48t1.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%2Fqdtdh4ati2keqozb48t1.png" alt=" " width="800" height="459"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Update
&lt;/h2&gt;

&lt;p&gt;Update the CGPA of a specific student (say &lt;code&gt;S002&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.updateOne(
  { student_id: "S002" },
  { $set: { cgpa: 9.1 } }
)
&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%2Fs0v1jfmsxkzhefu0ppfq.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%2Fs0v1jfmsxkzhefu0ppfq.png" alt=" " width="800" height="459"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Increase the year of study for all 3rd year students by 1:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;db.students.updateMany(
  { year: 3 },
  { $inc: { year: 1 } }
)
&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%2Fd6qwkqqt8pepk0hpn0s7.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%2Fd6qwkqqt8pepk0hpn0s7.png" alt=" " width="800" height="459"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Delete
&lt;/h2&gt;

&lt;p&gt;Delete one student record by &lt;code&gt;student_id&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.deleteOne({ student_id: "S005" })
&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%2Fk3gqjkd7ayhj2lk8y5fx.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%2Fk3gqjkd7ayhj2lk8y5fx.png" alt=" " width="800" height="459"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Delete all students having CGPA &amp;lt; 7.5:&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.deleteMany({ cgpa: { $lt: 7.5 } })
&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%2Fbjad5zpy629oj51cbmvj.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%2Fbjad5zpy629oj51cbmvj.png" alt=" " width="800" height="459"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Deliverables
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;MongoDB queries (provided above)&lt;/li&gt;
&lt;li&gt;Screenshots of execution results from MongoDB Atlas / Compass (to be added when you run them).&lt;/li&gt;
&lt;li&gt;Export final students collection as JSON/CSV&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;We’ve successfully performed CRUD operations in MongoDB using a simple student schema. This hands-on exercise gives a clear picture of how MongoDB works with JSON-like documents.&lt;/p&gt;

</description>
      <category>mongodb</category>
      <category>database</category>
      <category>data</category>
      <category>coding</category>
    </item>
    <item>
      <title>Indexing, Hashing &amp; Query Optimization in SQL</title>
      <dc:creator>Naveens K</dc:creator>
      <pubDate>Fri, 03 Oct 2025 07:42:26 +0000</pubDate>
      <link>https://dev.to/naveens_k_403279738dbcab6/indexing-hashing-query-optimization-in-sql-5886</link>
      <guid>https://dev.to/naveens_k_403279738dbcab6/indexing-hashing-query-optimization-in-sql-5886</guid>
      <description>&lt;h2&gt;
  
  
  Intro
&lt;/h2&gt;

&lt;p&gt;When working with large databases, retrieving data efficiently becomes a big challenge. SQL provides indexing and hashing techniques to speed up query execution. In this blog, we’ll explore B-Tree, B+ Tree, and Hash indexes with hands-on SQL examples using a &lt;code&gt;Students&lt;/code&gt; table.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Create the Students Table&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;CREATE TABLE Students (
    roll_no INT PRIMARY KEY,
    name VARCHAR(50),
    dept VARCHAR(20),
    cgpa DECIMAL(3,2)
);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Insert Sample Records&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;INSERT INTO Students VALUES
(101, 'Aarav', 'CSBS', 8.5),
(102, 'Meera', 'ECE', 7.2),
(103, 'Rohan', 'MECH', 6.9),
(104, 'Sita', 'CIVIL', 8.1),
(105, 'Vikram', 'CSE', 9.0),
(106, 'Priya', 'IT', 8.3),
(107, 'Arjun', 'CSBS', 7.5),
(108, 'Neha', 'ECE', 8.7),
(109, 'Kiran', 'CSE', 6.8),
(110, 'Rahul', 'CSBS', 9.2),
(111, 'Sneha', 'MECH', 7.9),
(112, 'Dev', 'CIVIL', 8.4),
(113, 'Pooja', 'CSE', 7.3),
(114, 'Varun', 'IT', 8.6),
(115, 'Isha', 'ECE', 9.1),
(116, 'Nikhil', 'MECH', 7.6),
(117, 'Ritu', 'CIVIL', 6.5),
(118, 'Sameer', 'CSE', 8.8),
(119, 'Tina', 'CSBS', 7.8),
(120, 'Yash', 'IT', 9.3);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now we have 20 student records.&lt;/p&gt;

&lt;h2&gt;
  
  
  Create a B-Tree Index on &lt;code&gt;roll_no&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;B-Tree indexes are default in most RDBMS. They make searching on primary/unique columns faster.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CREATE INDEX idx_rollno_btree ON Students(roll_no);
&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%2Fr93z2oie4sbywrwstarh.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%2Fr93z2oie4sbywrwstarh.png" alt=" " width="800" height="159"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The DBMS uses the B-Tree index to find roll_no = 110 quickly without scanning the whole table.&lt;/p&gt;

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

&lt;p&gt;B+ Trees are widely used for range queries.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CREATE INDEX idx_cgpa_bplustree ON Students(cgpa);
&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%2F15tdznjjuxq8wsgfym9q.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%2F15tdznjjuxq8wsgfym9q.png" alt=" " width="800" height="117"&gt;&lt;/a&gt;&lt;br&gt;
Instead of checking each row, the B+ Tree index helps to traverse efficiently for CGPA values greater than 8.5 .&lt;/p&gt;
&lt;h2&gt;
  
  
  Create a Hash Index on &lt;code&gt;dept&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;Hash indexes are best for equality lookups (e.g., = condition).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CREATE INDEX idx_dept_hash ON Students(dept) USING HASH;
&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%2Fk8h4oxsibffr8uvs8ohf.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%2Fk8h4oxsibffr8uvs8ohf.png" alt=" " width="800" height="173"&gt;&lt;/a&gt;&lt;/p&gt;

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

&lt;ul&gt;
&lt;li&gt;Without indexes → Full Table Scan (slow for large datasets).&lt;/li&gt;
&lt;li&gt;With indexes → Optimized Execution Plan (quick lookup).&lt;/li&gt;
&lt;li&gt;Use EXPLAIN to check whether your query uses the index.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Final Thoughts&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;B-Tree Index → Best for unique lookups &amp;amp; ordering.&lt;/li&gt;
&lt;li&gt;B+ Tree Index → Best for range queries.&lt;/li&gt;
&lt;li&gt;Hash Index → Best for equality lookups.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;By using indexes wisely, we can reduce query execution time drastically in real-world applications.&lt;/p&gt;

</description>
      <category>database</category>
      <category>performance</category>
      <category>algorithms</category>
      <category>sql</category>
    </item>
    <item>
      <title>Transactions, Deadlocks &amp; Log Based Recovery in SQL</title>
      <dc:creator>Naveens K</dc:creator>
      <pubDate>Fri, 03 Oct 2025 05:44:33 +0000</pubDate>
      <link>https://dev.to/naveens_k_403279738dbcab6/transactions-deadlocks-log-based-recovery-in-sql-5cdj</link>
      <guid>https://dev.to/naveens_k_403279738dbcab6/transactions-deadlocks-log-based-recovery-in-sql-5cdj</guid>
      <description>&lt;h2&gt;
  
  
  Intro
&lt;/h2&gt;

&lt;p&gt;In this blog, let’s explore three very important database concepts: Transactions, Deadlocks, and Log-Based Recovery. We’ll be using a simple &lt;code&gt;Accounts&lt;/code&gt; table and running SQL queries to demonstrate these in action.&lt;/p&gt;

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

&lt;p&gt;First, let’s create a table &lt;code&gt;Accounts&lt;/code&gt; and insert some sample data.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CREATE TABLE Accounts (
    acc_no INT PRIMARY KEY,
    name VARCHAR(50),
    balance INT
);

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

&lt;/div&gt;



&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;acc_no&lt;/th&gt;
&lt;th&gt;name&lt;/th&gt;
&lt;th&gt;balance&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;Alice&lt;/td&gt;
&lt;td&gt;1000&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;Bob&lt;/td&gt;
&lt;td&gt;1500&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;Charlie&lt;/td&gt;
&lt;td&gt;2000&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Transaction – Atomicity &amp;amp; Rollback
&lt;/h2&gt;

&lt;p&gt;Transactions are all-or-nothing operations. Either all changes are applied (commit) or none (rollback).&lt;/p&gt;

&lt;p&gt;Let’s try transferring 500 from Alice to Bob but roll it back before committing.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;-- Start transaction
START TRANSACTION;

-- Deduct from Alice
UPDATE Accounts SET balance = balance - 500 WHERE name = 'Alice';

-- Add to Bob
UPDATE Accounts SET balance = balance + 500 WHERE name = 'Bob';

-- Check balances before rollback
SELECT * FROM Accounts;

-- Rollback transaction
ROLLBACK;

-- Check balances after rollback
SELECT * FROM Accounts;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Result: Alice still has 1000, Bob has 1500.&lt;br&gt;
No partial update happened – this is Atomicity.&lt;/p&gt;
&lt;h2&gt;
  
  
  Deadlock Simulation
&lt;/h2&gt;

&lt;p&gt;Deadlocks happen when two transactions are waiting for each other’s resources.&lt;/p&gt;

&lt;p&gt;We’ll simulate this using two sessions:&lt;/p&gt;
&lt;h2&gt;
  
  
  Session 1
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;START TRANSACTION;
-- Lock Bob
UPDATE Accounts SET balance = balance - 50 WHERE name = 'Bob';

-- Now try updating Alice (but Alice is locked by Session 1)
UPDATE Accounts SET balance = balance + 50 WHERE name = 'Alice';
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;At this point, both sessions are waiting for each other → Deadlock occurs.&lt;br&gt;
The database will detect this automatically and kill one transaction, rolling it back.&lt;/p&gt;
&lt;h2&gt;
  
  
  Log-Based Recovery
&lt;/h2&gt;

&lt;p&gt;Databases maintain logs (like binary log in MySQL or WAL in PostgreSQL) to ensure durability and recovery.&lt;/p&gt;

&lt;p&gt;Let’s test this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;-- Start transaction
START TRANSACTION;

-- Update a record
UPDATE Accounts SET balance = balance + 200 WHERE name = 'Charlie';

-- Rollback
ROLLBACK;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Even though the update was rolled back, the log will record both the update and the undo operation.&lt;br&gt;
This ensures that if the system crashes, recovery can undo uncommitted transactions and redo committed ones.&lt;/p&gt;

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

&lt;ul&gt;
&lt;li&gt;Atomicity: All or nothing – rollback prevents partial updates.&lt;/li&gt;
&lt;li&gt;Deadlock: Two transactions waiting for each other’s lock → system resolves it.&lt;/li&gt;
&lt;li&gt;Log-Based Recovery: Every change is logged so the DB can recover from crashes.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>acid</category>
      <category>deadlock</category>
      <category>logging</category>
      <category>sql</category>
    </item>
    <item>
      <title>Understanding ACID Properties in SQL Transactions</title>
      <dc:creator>Naveens K</dc:creator>
      <pubDate>Fri, 03 Oct 2025 04:26:08 +0000</pubDate>
      <link>https://dev.to/naveens_k_403279738dbcab6/understanding-acid-properties-in-sql-transactions-4f5n</link>
      <guid>https://dev.to/naveens_k_403279738dbcab6/understanding-acid-properties-in-sql-transactions-4f5n</guid>
      <description>&lt;h2&gt;
  
  
  Intro
&lt;/h2&gt;

&lt;p&gt;When working with databases, data integrity is everything. Imagine transferring money from one account to another — you wouldn’t want money to disappear or double by mistake, right?&lt;/p&gt;

&lt;p&gt;That’s where ACID properties come in. They ensure our transactions are reliable, safe, and consistent, even when things go wrong.&lt;/p&gt;

&lt;p&gt;In this blog, let’s break down ACID with SQL examples using a simple &lt;code&gt;Accounts&lt;/code&gt; table.&lt;/p&gt;

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

&lt;p&gt;ACID stands for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Atomicity → All or nothing (no partial transactions).&lt;/li&gt;
&lt;li&gt;Consistency → Data must remain valid before and after a transaction.&lt;/li&gt;
&lt;li&gt;Isolation → Transactions run independently of each other.&lt;/li&gt;
&lt;li&gt;Durability → Once committed, changes are permanent (even after crash).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Setting up a Table&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;We’ll create an &lt;code&gt;Accounts&lt;/code&gt; table with a balance check to avoid negative values.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CREATE TABLE Accounts (
    acc_no INT PRIMARY KEY,
    name VARCHAR(50),
    balance INT CHECK (balance &amp;gt;= 0) -- ensures no negative balance
);

INSERT INTO Accounts VALUES
(101, 'Santhosh', 5000),
(102, 'Ganges', 3000),
(103, 'Rakshanth', 7000),
(104, 'Jaswant', 6000);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Atomicity
&lt;/h2&gt;

&lt;p&gt;Atomicity ensures that either the entire transaction happens or nothing happens.&lt;/p&gt;

&lt;p&gt;Example: Money transfer (Rollback midway)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;START TRANSACTION;

-- Deduct ₹1000 from Alice
UPDATE Accounts SET balance = balance - 1000 WHERE acc_no = 101;

-- Add ₹1000 to Bob
UPDATE Accounts SET balance = balance + 1000 WHERE acc_no = 102;

-- Oops! Something went wrong
ROLLBACK;

-- Check balances (should remain unchanged)
SELECT * FROM Accounts;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Since we rolled back, no changes were applied. That’s Atomicity in action!&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Consistency
&lt;/h2&gt;

&lt;p&gt;Consistency ensures that a transaction brings the database from one valid state to another.&lt;/p&gt;

&lt;p&gt;Example: Insert a record with negative balance&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;INSERT INTO Accounts VALUES (104, 'Naveens', -500);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This fails because of our &lt;code&gt;CHECK (balance &amp;gt;= 0)&lt;/code&gt; constraint.&lt;br&gt;
The database remains valid → Consistency maintained.&lt;/p&gt;
&lt;h2&gt;
  
  
  Isolation
&lt;/h2&gt;

&lt;p&gt;Isolation ensures that transactions don’t interfere with each other.&lt;/p&gt;

&lt;p&gt;Imagine two sessions running at the same time:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Session 1:&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;START TRANSACTION;
UPDATE Accounts SET balance = balance - 2000 WHERE acc_no = 103;
-- Don’t commit yet
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Session 2:&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;SELECT * FROM Accounts WHERE acc_no = 103;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;On READ COMMITTED → Session 2 sees old balance.&lt;/li&gt;
&lt;li&gt;On READ UNCOMMITTED → Session 2 may see uncommitted changes (dirty read).&lt;/li&gt;
&lt;li&gt;On SERIALIZABLE → Session 2 waits until Session 1 commits.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Different isolation levels decide how much transactions can "see" each other’s work.&lt;/p&gt;

&lt;h2&gt;
  
  
  Durability
&lt;/h2&gt;

&lt;p&gt;Durability ensures that once a transaction is committed, it survives crashes.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;START TRANSACTION;
UPDATE Accounts SET balance = balance + 500 WHERE acc_no = 102;
COMMIT;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now restart your database and run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT * FROM Accounts WHERE acc_no = 102;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You’ll still see the updated balance.&lt;br&gt;
That’s Durability — committed data is permanent.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Final Thoughts&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The ACID properties are the backbone of reliable databases.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Atomicity → No partial updates&lt;/li&gt;
&lt;li&gt;Consistency → Always valid data&lt;/li&gt;
&lt;li&gt;Isolation → Independent transactions&lt;/li&gt;
&lt;li&gt;Durability → Permanent changes&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So next time you run a SQL transaction, remember: ACID is silently ensuring your data stays safe, even if things go wrong.&lt;/p&gt;

</description>
      <category>database</category>
      <category>architecture</category>
      <category>beginners</category>
      <category>sql</category>
    </item>
    <item>
      <title>Understanding Cursors &amp; Triggers in DBMS</title>
      <dc:creator>Naveens K</dc:creator>
      <pubDate>Fri, 03 Oct 2025 03:23:22 +0000</pubDate>
      <link>https://dev.to/naveens_k_403279738dbcab6/understanding-cursors-triggers-in-dbms-29oa</link>
      <guid>https://dev.to/naveens_k_403279738dbcab6/understanding-cursors-triggers-in-dbms-29oa</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Databases are the backbone of almost every software application today. From banking systems to e-commerce sites, managing and manipulating data efficiently is crucial. While SQL gives us powerful tools for querying and updating data, there are advanced features in DBMS like Cursors and Triggers that allow us to handle complex situations with ease.&lt;/p&gt;

&lt;p&gt;In this blog, we will explore:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What Cursors are, why we need them, and how to use them.&lt;/li&gt;
&lt;li&gt;What Triggers are, how they help automate actions, and practical examples.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Cursors in DBMS
&lt;/h2&gt;

&lt;p&gt;What is a Cursor?&lt;/p&gt;

&lt;p&gt;A Cursor in DBMS is a database object that allows us to fetch and process query results row by row. Normally, SQL works with sets of data all at once, but sometimes we need to handle each row individually. That’s where cursors come in.&lt;/p&gt;

&lt;p&gt;Think of it like a pointer that moves through the rows of a result set one at a time.&lt;/p&gt;

&lt;p&gt;Why Use Cursors?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;When we need row-by-row processing.&lt;/li&gt;
&lt;li&gt;To perform custom logic on each record.&lt;/li&gt;
&lt;li&gt;To store results temporarily and use them later.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Example: Cursor for High Salary Employees&lt;/strong&gt;&lt;br&gt;
Suppose we have an &lt;code&gt;Employee&lt;/code&gt; table:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CREATE TABLE Employee (
    emp_id INT PRIMARY KEY,
    emp_name VARCHAR(100),
    salary DECIMAL(10,2)
);

INSERT INTO Employee VALUES
(1, 'Bob Smith', 60000),
(2, 'Charlie Brown', 55000),
(3, 'Edward Wilson', 75000),
(4, 'Fiona Davis', 52000),
(5, 'Hannah Lee', 60000);
(6,'naveens',67000);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, let’s create a stored procedure with a cursor that selects employees earning more than 50,000.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;DELIMITER $$

CREATE PROCEDURE get_high_salary_employees()
BEGIN
    DECLARE done INT DEFAULT 0;
    DECLARE v_emp_name VARCHAR(100);

    DECLARE emp_cursor CURSOR FOR
        SELECT emp_name FROM Employee WHERE salary &amp;gt; 50000;

    DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1;

    CREATE TABLE IF NOT EXISTS high_salary_emp(emp_name VARCHAR(100));
    TRUNCATE TABLE high_salary_emp;

    OPEN emp_cursor;

    read_loop: LOOP
        FETCH emp_cursor INTO v_emp_name;
        IF done = 1 THEN
            LEAVE read_loop;
        END IF;
        INSERT INTO high_salary_emp VALUES (v_emp_name);
    END LOOP;

    CLOSE emp_cursor;

    SELECT * FROM high_salary_emp;
END$$

DELIMITER ;

CALL get_high_salary_employees();
&lt;/code&gt;&lt;/pre&gt;

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

&lt;p&gt;This shows how a cursor fetches each row one by one and stores it into another table.&lt;/p&gt;

&lt;h2&gt;
  
  
  Triggers in DBMS
&lt;/h2&gt;

&lt;p&gt;A Trigger is a special type of stored program that automatically executes when a specific event occurs in a table. Events can be:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;INSERT&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;UPDATE&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;DELETE&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In simple words, triggers are rules that fire automatically when data changes.&lt;/p&gt;

&lt;p&gt;Why Use Triggers?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;To maintain data integrity.&lt;/li&gt;
&lt;li&gt;To automatically log changes.&lt;/li&gt;
&lt;li&gt;To enforce business rules.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Example 1: AFTER INSERT Trigger (Audit Log)
&lt;/h2&gt;

&lt;p&gt;We want to keep track of all new employees added. So, we create an audit table:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CREATE TABLE Employee_Audit (
    audit_id INT AUTO_INCREMENT PRIMARY KEY,
    emp_id INT,
    emp_name VARCHAR(100),
    salary DECIMAL(10,2),
    action_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, the trigger:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;DELIMITER $$

CREATE TRIGGER after_employee_insert
AFTER INSERT ON Employee
FOR EACH ROW
BEGIN
    INSERT INTO Employee_Audit (emp_id, emp_name, salary)
    VALUES (NEW.emp_id, NEW.emp_name, NEW.salary);
END$$

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

&lt;/div&gt;



&lt;p&gt;Test it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;INSERT INTO Employee VALUES (34, 'Meera', 72000);

SELECT * FROM Employee_Audit;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output shows Meera automatically logged in Employee_Audit.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftkfxzi43iw01oq29skcd.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%2Ftkfxzi43iw01oq29skcd.png" alt=" " width="490" height="89"&gt;&lt;/a&gt;&lt;/p&gt;

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

&lt;ul&gt;
&lt;li&gt;Cursors let us handle query results row by row, useful for special operations.&lt;/li&gt;
&lt;li&gt;Triggers allow us to automatically enforce rules or log changes when data is inserted, updated, or deleted.&lt;/li&gt;
&lt;li&gt;Together, they give DBMS more power, automation, and data integrity.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>dbms</category>
      <category>powerautomate</category>
      <category>cursors</category>
      <category>data</category>
    </item>
    <item>
      <title>Demystifying Normalization in RDBMS: From 1NF to 3NF</title>
      <dc:creator>Naveens K</dc:creator>
      <pubDate>Thu, 02 Oct 2025 11:15:36 +0000</pubDate>
      <link>https://dev.to/naveens_k_403279738dbcab6/demystifying-normalization-in-rdbms-from-1nf-to-3nf-1835</link>
      <guid>https://dev.to/naveens_k_403279738dbcab6/demystifying-normalization-in-rdbms-from-1nf-to-3nf-1835</guid>
      <description>&lt;p&gt;Hi everyone! I’m really excited to share my learnings in RDBMS through this blog. As someone who is learning and exploring RDBMS concepts, I decided to write down my understanding in the simplest way possible so that anyone—especially beginners like me—can easily follow along. Today, let’s begin with one of the most important topics: Normalization.&lt;/p&gt;

&lt;h2&gt;
  
  
  Normalization--&amp;gt;
&lt;/h2&gt;

&lt;p&gt;Normalization is the process of organizing data in a database to reduce redundancy and improve data integrity.&lt;/p&gt;

&lt;p&gt;In simple words: It ensures your data is stored in the right place, without unnecessary duplication.&lt;/p&gt;

&lt;h2&gt;
  
  
  First Normalization Form(1NF)
&lt;/h2&gt;

&lt;p&gt;For example: instead of storing a multiple phone number for a single person in the same column of the table breakdown the single table into two and through connecting the any of the attributes together to ensure the 1NF and to get the desired output use Joins &lt;br&gt;
let we dive into the example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;drop table if exists students_non1NF;
create table students_non1NF(
    student_id INT,
    student_name VARCHAR(20),
    phone_no VARCHAR(100)
)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Insert Values:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;INSERT INTO students_non1NF(student_id,student_name,phone_no) VALUES 
(1, 'jaswant','1234567890,0986235162'),
(2,'santhosh','7185689465,8643851084'),
(3,'rakshanth','3486512964,6853264273'),
(4,'ganges','6153956426,6426492386')
&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%2Ffy7jl9zz46y2p2xrukth.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%2Ffy7jl9zz46y2p2xrukth.png" alt=" " width="437" height="306"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This table is not in First normalization from why because in column &lt;code&gt;phone _no&lt;/code&gt; has two phone numbers in the single field&lt;/p&gt;

&lt;p&gt;To avoid this problem we split the single table into two&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;DROP TABLE if EXISTS students;
CREATE TABLE students(
    student_id INT,
    student_name VARCHAR(100),
    PRIMARY KEY(student_id)
);
 CREATE TABLE student_phone(
    student_id INT,
    phone_no VARCHAR(100),
    PRIMARY KEY (student_id, phone_no),
    FOREIGN KEY (student_id) REFERENCES students(student_id)
);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And the insert values are:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;INSERT INTO students (student_id,student_name) values (1, 'jaswant'),(2,'santhosh'),(3,'rakshanth'),
(4,'ganges');
INSERT INTO student_phone(student_id,phone_no) values (1,'1234567890'),
(1,'0986235162'),(2,'7185689465'),(2,'8643851084'),(3,'3486512964'),(3,'6853264273'),(4,'6153956426'),(4,'6426492386');
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;the output is:&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%2Fi9n9alur7djuwtababbe.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%2Fi9n9alur7djuwtababbe.png" alt=" " width="223" height="203"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frmg2c8zecjwedr5m3nbc.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%2Frmg2c8zecjwedr5m3nbc.png" alt=" " width="229" height="342"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Boom..!!!!&lt;br&gt;
The problem solved now we able to give the multiple numbers for the same people and it will not violate the 1NF&lt;br&gt;
to see the output then we use Join Query:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT s.student_id,
       s.student_name,
       p.phone_no
FROM students s
LEFT JOIN student_phone p
ON s.student_id = p.student_id;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And the output is:&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%2Ff2dc10drmhg5n984orri.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%2Ff2dc10drmhg5n984orri.png" alt=" " width="338" height="327"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Second Normalization Form(2NF)
&lt;/h2&gt;

&lt;p&gt;The Second Normal Form (2NF) builds on the foundation of 1NF and takes the process of organizing data one step further. A table is said to be in 2NF if it is already in 1NF and all non-key attributes are fully dependent on the entire primary key. This mainly applies when a table has a composite primary key (a primary key made up of two or more columns). If some non-key attributes depend only on part of that composite key instead of the whole key, it creates what we call a partial dependency, and this violates 2NF. For example, if we have a table where the primary key is a combination of StudentID and CourseID, and we also store the InstructorName, then InstructorName depends only on CourseID and not on the full key. To fix this, we separate the data into two tables—one for the student-course mapping and another for the course-instructor details. By doing this, we eliminate partial dependency, making the database more structured&lt;/p&gt;

&lt;p&gt;Now let we see the table without 2NF:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; CREATE TABLE Enrollment_2nonNF(
     student_id INT,
     course_id INT,
     course_name VARCHAR(200),
     instructor VARCHAR(200),
     PRIMARY KEY (student_id,course_id)
 )
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And the insert values are:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;INSERT INTO Enrollment_2nonNF(student_id,course_id,course_name,instructor) VALUES 
(1,101,'Intro to SQL','Jorn'),
(2,101,'Intro to SQL','Jorn'),
(1,102,'Intro to JAVA','smith');
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The output is :&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%2Fsq6qtjc83jjv9jikpp6e.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%2Fsq6qtjc83jjv9jikpp6e.png" alt=" " width="384" height="152"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here the &lt;code&gt;instructor&lt;/code&gt; column is dependent on &lt;code&gt;course_id&lt;/code&gt;&lt;br&gt;
to avoid this problem let we breakdown the table into two which one is for holding &lt;code&gt;student_id&lt;/code&gt;, and &lt;code&gt;course_id&lt;/code&gt; and the another one for holding &lt;code&gt;course_id&lt;/code&gt;, &lt;code&gt;course_name&lt;/code&gt; and &lt;code&gt;instructor&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;drop table if exists Courses;
CREATE TABLE Courses(
    course_id INT,
    course_name VARCHAR(200),
    instructor VARCHAR(200),
    PRIMARY KEY (course_id)


);
drop table if exists Enrollment;
CREATE TABLE Enrollment(
    student_id INT ,
    course_id INT ,
    PRIMARY KEY(student_id,course_id),
    FOREIGN KEY (course_id) REFERENCES Courses(course_id)
);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;INSERT INTO Courses (course_id, course_name, instructor) VALUES
(101,"Intro to SQL",'Jorn'),
(102,'Intro to JAVA','smith');
INSERT INTO Enrollment (student_id,course_id) VALUES 
(1,101),
(2,101),
(1,102);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The join query is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT e.student_id , c.Course_id, c.course_name, c.instructor 
from Enrollment e LEFT JOIN Courses c ON e.course_id = c.course_id;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;the output is:&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%2Fieqqdnu1q2gzwnta8uei.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%2Fieqqdnu1q2gzwnta8uei.png" alt=" " width="391" height="144"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Third Normalization Form(3NF)
&lt;/h2&gt;

&lt;p&gt;The Third Normal Form (3NF) is the next step after 2NF, and its goal is to eliminate what is known as transitive dependency. A table is said to be in 3NF if it is already in 2NF and every non-key attribute depends only on the primary key, not on another non-key attribute. In simpler terms, no column should give information about another column unless it is through the primary key. For example, consider a table with course_id, course_name, instructor, and instructor_office. Here, instructor_office depends on instructor, which means it is indirectly dependent on course_id. This violates 3NF. To fix this, we split the table into two: one for course details (course_id, course_name, instructor) and another for Instructor details (instructor, instructor_office). By doing this, every non-key attribute now depends only on the primary key, and we remove unnecessary dependencies. Achieving 3NF ensures that the data is well-organized, reduces redundancy even further, and makes the database easier to maintain and scale.&lt;/p&gt;

&lt;p&gt;The table without 3NF look like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CREATE TABLE courses_Non3NF(
    course_id INT PRIMARY KEY,
    course_name VARCHAR(100),
    instructor VARCHAR(100),
    instructor_office VARCHAR(100)
);


INSERT INTO courses_Non3NF(course_id,course_name,instructor,instructor_office) VALUES 
(101, 'Intro to SQL','DR.Jorn' , 'Room 101'),
(102, 'Intro to JAVA','DR. Smith' , 'Room 102');
&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%2Fhmh9x3jw9yr61biu3h0w.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%2Fhmh9x3jw9yr61biu3h0w.png" alt=" " width="445" height="97"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As we already discussed now we split the table into two and the code like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CREATE TABLE Insturctors(
    instructor VARCHAR(100) PRIMARY KEY,
    instructor_office VARCHAR(100)
);
CREATE TABLE courses1(
    course_id INT PRIMARY KEY,
    course_name VARCHAR(100),
    instructor VARCHAR(100),
    FOREIGN KEY (instructor) REFERENCES Insturctors(instructor)
);

INSERT INTO Insturctors (instructor,instructor_office) VALUES 
('DR.jorn' , 'Room 101'),
('DR.smith' , 'Room 102');

INSERT INTO courses1(course_id,course_name,instructor) VALUES 
(101, 'Intro to SQL','DR.jorn' ),
(102, 'Intro to JAVA','DR.smith');
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And the join query is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;select c.course_id, c.course_name , i.instructor, i.instructor_office 
from courses1 c LEFT JOIN Insturctors i ON c.instructor = i.instructor;
&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%2Fdphi6lodg1xs8z7xjrfg.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%2Fdphi6lodg1xs8z7xjrfg.png" alt=" " width="441" height="102"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Super..!!, these are the concepts and practical learnings in 1NF, 2NF and 3NF and beyond that we have BCNF, 4NF and 5NF these three are not very much usable even if you eager to learn these three normalization forms please search in internet you will easily understood the things  &lt;/p&gt;

</description>
      <category>dbms</category>
      <category>data</category>
      <category>sql</category>
      <category>normalization</category>
    </item>
    <item>
      <title>College Student and Course Management System using SQL (Oracle)</title>
      <dc:creator>Naveens K</dc:creator>
      <pubDate>Fri, 22 Aug 2025 17:35:22 +0000</pubDate>
      <link>https://dev.to/naveens_k_403279738dbcab6/college-student-and-course-management-system-using-sql-oracle-4ofa</link>
      <guid>https://dev.to/naveens_k_403279738dbcab6/college-student-and-course-management-system-using-sql-oracle-4ofa</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;This is a simple, basic SQL project that demonstrates how to design and manage a small College Management System.&lt;/p&gt;

&lt;p&gt;The idea is to create a database that stores information about:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Students (their details and department)&lt;/li&gt;
&lt;li&gt;Courses (subjects offered)&lt;/li&gt;
&lt;li&gt;Faculty (professors teaching in departments)&lt;/li&gt;
&lt;li&gt;Enrollments (which student takes which course, along with grades)&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;Although this is a small-scale project, it reflects how real-world college databases are structured.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Why is this project useful?&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Helps beginners understand how relational databases work.&lt;/li&gt;
&lt;li&gt;Shows how different entities (students, courses, faculty) are linked through relationships.&lt;/li&gt;
&lt;li&gt;Demonstrates SQL features like constraints, joins, views, and stored procedures.&lt;/li&gt;
&lt;li&gt;Can be easily extended into a bigger college portal system (with attendance, GPA calculation, reports, etc.).&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;In short, this project is a foundation exercise that not only strengthens SQL skills but also gives a taste of how databases are applied in &lt;strong&gt;real educational institutions.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Database Design – Tables and Purpose
&lt;/h2&gt;

&lt;p&gt;In this project, we created four main tables: &lt;strong&gt;Students, Courses, Enrollments, and Faculty.&lt;/strong&gt;&lt;br&gt;
Each table represents an important entity in a college system.&lt;br&gt;
&lt;strong&gt;1. Students Table&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;CREATE TABLE Students (
    StudentID NUMBER PRIMARY KEY,
    Name VARCHAR2(50) NOT NULL,
    Dept VARCHAR2(30),
    DOB DATE,
    Email VARCHAR2(50) UNIQUE
);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;ul&gt;
&lt;li&gt;Stores basic information about students like &lt;strong&gt;name, department, date of birth, and email.&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;StudentID&lt;/code&gt; acts as a primary key so that every student is uniquely identified.&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;Email&lt;/code&gt; field is marked as &lt;code&gt;UNIQUE&lt;/code&gt;, ensuring no two students have the same email&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;How to define primary keys for unique identification.&lt;/li&gt;
&lt;li&gt;How to enforce data integrity using &lt;code&gt;NOT NULL&lt;/code&gt; and &lt;code&gt;UNIQUE&lt;/code&gt; constraints.&lt;/li&gt;
&lt;li&gt;How to handle different data types (&lt;code&gt;VARCHAR2&lt;/code&gt; for text, &lt;code&gt;DATE&lt;/code&gt; for birthdate).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;2. Course Table&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;CREATE TABLE Courses (
    CourseID NUMBER PRIMARY KEY,
    CourseName VARCHAR2(50) NOT NULL,
    Credits NUMBER(2)
);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;ul&gt;
&lt;li&gt;Stores all courses offered by the institution.&lt;/li&gt;
&lt;li&gt;Each course has an &lt;strong&gt;ID, name, and credits.&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;CourseID&lt;/code&gt; uniquely identifies each course.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;Designing a table that holds course catalog information.&lt;/li&gt;
&lt;li&gt;Adding constraints like &lt;code&gt;NOT NULL&lt;/code&gt; for required fields.&lt;/li&gt;
&lt;li&gt;Understanding numeric columns (credits between 1–5).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;3. Enrollments Table&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;CREATE TABLE Enrollments (
    EnrollID NUMBER PRIMARY KEY,
    StudentID NUMBER REFERENCES Students(StudentID),
    CourseID NUMBER REFERENCES Courses(CourseID),
    Grade VARCHAR2(2)
);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;ul&gt;
&lt;li&gt;Acts as a bridge table between Students and Courses.&lt;/li&gt;
&lt;li&gt;Stores which student is enrolled in which course, along with their grade.&lt;/li&gt;
&lt;li&gt;Uses foreign keys to connect to &lt;code&gt;Students&lt;/code&gt; and &lt;code&gt;Courses&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;How to create &lt;strong&gt;relationships&lt;/strong&gt; between tables.&lt;/li&gt;
&lt;li&gt;Use of foreign keys for maintaining referential integrity.&lt;/li&gt;
&lt;li&gt;Handling &lt;strong&gt;many-to-many relationships&lt;/strong&gt; (one student can enroll in many courses, one course can have many students).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;4. Faculty Table&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;CREATE TABLE Faculty (
    FacultyId NUMBER PRIMARY KEY,
    FacultyName VARCHAR2(50) NOT NULL,
    Dept VARCHAR2(50),
    Email VARCHAR2(50) UNIQUE
);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;ul&gt;
&lt;li&gt;Stores details of faculty members (professors).&lt;/li&gt;
&lt;li&gt;Each faculty is linked to a &lt;strong&gt;department&lt;/strong&gt; and has a &lt;strong&gt;unique email.&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;Designing another entity in the college system.&lt;/li&gt;
&lt;li&gt;Importance of &lt;strong&gt;uniqueness&lt;/strong&gt; (faculty emails).&lt;/li&gt;
&lt;li&gt;Setting up &lt;strong&gt;department-wise grouping&lt;/strong&gt; of faculty for future queries.&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;By creating these tables, we learn:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;How to &lt;strong&gt;design normalized tables&lt;/strong&gt; for real-world entities.&lt;/li&gt;
&lt;li&gt;How to apply constraints (&lt;code&gt;Primary Key&lt;/code&gt;, &lt;code&gt;Unique&lt;/code&gt;, &lt;code&gt;Not Null&lt;/code&gt;, &lt;code&gt;Foreign Key&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;How to connect multiple tables to &lt;strong&gt;model real-world relationships.&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Inserting Data into Tables
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1. Insert Data into Students&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;INSERT INTO Students (StudentID, Name, Dept, DOB, Email) VALUES
(1, 'Rahul Sharma', 'Computer Science', DATE '2002-05-14', 'rahul.sharma@example.com');

INSERT INTO Students (StudentID, Name, Dept, DOB, Email) VALUES
(2, 'Priya Singh', 'Mechanical', DATE '2001-08-21', 'priya.singh@example.com');

INSERT INTO Students (StudentID, Name, Dept, DOB, Email) VALUES
(3, 'Amit Verma', 'Electronics', DATE '2003-01-10', 'amit.verma@example.com');
&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%2Fo1zrgon30cvc3rj0llex.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%2Fo1zrgon30cvc3rj0llex.png" alt=" " width="800" height="141"&gt;&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;2. Insert Data into Courses&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;INSERT INTO Courses (CourseID, CourseName, Credits) VALUES
(104, 'Database Systems', 5);

INSERT INTO Courses (CourseID, CourseName, Credits) VALUES
(101, 'Operating Systems', 4);

INSERT INTO Courses (CourseID, CourseName, Credits) VALUES
(102, 'Thermodynamics', 3);
&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%2F5n9a6izgm0r3x4ljc1n5.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%2F5n9a6izgm0r3x4ljc1n5.png" alt=" " width="792" height="206"&gt;&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;3. Insert Data into Enrollments&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;INSERT INTO Enrollments (EnrollID, StudentID, CourseID, Grade) VALUES
(1001, 1, 101, 'A');

INSERT INTO Enrollments (EnrollID, StudentID, CourseID, Grade) VALUES
(1002, 2, 103, 'B');

INSERT INTO Enrollments (EnrollID, StudentID, CourseID, Grade) VALUES
(1003, 3, 102, 'A');
&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%2F7z9p5fma4hy57j7wclvl.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%2F7z9p5fma4hy57j7wclvl.png" alt=" " width="800" height="153"&gt;&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;4. Insert Data into Faculty&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;INSERT INTO Faculty (FacultyId, FacultyName, Dept, Email) VALUES
(201, 'Dr. Neha Kapoor', 'Computer Science', 'neha.kapoor@example.com');

INSERT INTO Faculty (FacultyId, FacultyName, Dept, Email) VALUES
(202, 'Dr. Rajesh Iyer', 'Mechanical', 'rajesh.iyer@example.com');

INSERT INTO Faculty (FacultyId, FacultyName, Dept, Email) VALUES
(203, 'Dr. Sunita Rao', 'Electronics', 'sunita.rao@example.com');
&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%2Frngxlvn5cl0smb62chk8.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%2Frngxlvn5cl0smb62chk8.png" alt=" " width="800" height="161"&gt;&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;Purpose:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;To design a &lt;strong&gt;basic but realistic database&lt;/strong&gt; that represents a college management system.&lt;/li&gt;
&lt;li&gt;To define the main entities — &lt;strong&gt;Students, Courses, Enrollments, and Faculty&lt;/strong&gt; — and establish relationships among them.&lt;/li&gt;
&lt;li&gt;To insert &lt;strong&gt;sample records&lt;/strong&gt; so the database is ready for practicing queries and analysis.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Database Design Principles&lt;/strong&gt; – understanding how to model real-world entities (like students and courses) as database tables.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Constraints for Data Integrity&lt;/strong&gt; – applying &lt;strong&gt;Primary Keys, Unique Keys, Not Null, and Foreign Keys&lt;/strong&gt; to avoid duplicate or invalid data.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Relationships in Databases&lt;/strong&gt; – creating &lt;strong&gt;one-to-many and many-to-many relationships&lt;/strong&gt; (via Enrollments).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Data Insertion&lt;/strong&gt; – learning how to insert records correctly, including handling dates, text fields, and numeric constraints.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Normalization Basics&lt;/strong&gt; – separating data into different tables instead of storing everything in one, which avoids redundancy and makes queries more efficient.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;blockquote&gt;
&lt;p&gt;In short, this phase helps us move from theory to practice:&lt;br&gt;
we don’t just define tables, but also fill them with meaningful data that mirrors a real college environment, preparing the ground for more advanced SQL queries and procedures.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;h2&gt;
  
  
  Queries and Learnings
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1. Display Students with Uppercase Names and Email Length&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;SELECT UPPER(Name) AS StudentName, LENGTH(Email) AS EmailLength
FROM Students;
&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%2Fffmh7tjp55ppeehdqtmq.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%2Fffmh7tjp55ppeehdqtmq.png" alt=" " width="577" height="200"&gt;&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;Purpose:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Converts all student names to uppercase.&lt;/li&gt;
&lt;li&gt;Shows the length of each student’s email address.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;Use of &lt;strong&gt;string functions&lt;/strong&gt; (&lt;code&gt;UPPER&lt;/code&gt;, &lt;code&gt;LENGTH&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;How SQL can transform and analyze text data.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;2. Find Average Credits and Total Enrollments&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;SELECT 
   (SELECT AVG(CREDITS) FROM Courses) AS AvgCredits,
   (SELECT COUNT(DISTINCT EnrollID) FROM Enrollments) AS TotalEnrolledStudents
FROM dual;
&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%2F0p0hvm1tfn2tawf4nh53.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%2F0p0hvm1tfn2tawf4nh53.png" alt=" " width="582" height="96"&gt;&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;Purpose:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Finds the average credits across all courses.&lt;/li&gt;
&lt;li&gt;Counts how many students are enrolled overall.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;Use of &lt;strong&gt;aggregate functions&lt;/strong&gt; (&lt;code&gt;AVG&lt;/code&gt;, &lt;code&gt;COUNT&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;Writing &lt;strong&gt;subqueries&lt;/strong&gt; inside a SELECT.&lt;/li&gt;
&lt;li&gt;Using &lt;code&gt;DUAL&lt;/code&gt; (special table in Oracle for single-row queries).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;3. List Students with Their Courses and Grades&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;SELECT s.Name, c.CourseName, e.Grade
FROM Students s
JOIN Enrollments e ON s.StudentID = e.StudentID
JOIN Courses c ON e.CourseID = c.CourseID;
&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%2F1s3nlc29nclmv0i5wue0.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%2F1s3nlc29nclmv0i5wue0.png" alt=" " width="798" height="213"&gt;&lt;/a&gt;&lt;/p&gt;

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

&lt;ul&gt;
&lt;li&gt;Displays each student along with the &lt;strong&gt;course they enrolled in and their grade.&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;How to use &lt;strong&gt;INNER JOIN&lt;/strong&gt; to combine multiple tables.&lt;/li&gt;
&lt;li&gt;Understanding &lt;strong&gt;relationships&lt;/strong&gt; (Students ↔ Enrollments ↔ Courses).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;4. Department-Wise Student Count (Only if &amp;gt;2 Students)&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;SELECT Dept, COUNT(*) AS StudentCount
FROM Students
GROUP BY Dept
HAVING COUNT(*) &amp;gt; 2;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;ul&gt;
&lt;li&gt;Groups students by department.&lt;/li&gt;
&lt;li&gt;Shows only departments having &lt;strong&gt;more than 2 students.&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;Difference between &lt;code&gt;WHERE&lt;/code&gt; and &lt;code&gt;HAVING&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;How to use &lt;strong&gt;GROUP BY&lt;/strong&gt; with aggregate functions.&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;With these queries, we are able to:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Analyze text and numeric data.&lt;/li&gt;
&lt;li&gt;Use joins to link tables.&lt;/li&gt;
&lt;li&gt;Work with &lt;strong&gt;aggregate functions&lt;/strong&gt; for reporting.&lt;/li&gt;
&lt;li&gt;Apply &lt;strong&gt;filtering&lt;/strong&gt; at both row-level (&lt;code&gt;WHERE&lt;/code&gt;) and group-level (&lt;code&gt;HAVING&lt;/code&gt;).&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Views &amp;amp; Stored Procedures
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1. Creating a View: &lt;code&gt;StudentCoursesView&lt;/code&gt;&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;CREATE OR REPLACE VIEW StudentCoursesView AS
SELECT s.Name AS StudentName, c.CourseName, e.Grade
FROM Students s
JOIN Enrollments e ON s.StudentID = e.StudentID
JOIN Courses c ON c.CourseID = e.CourseID;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;ul&gt;
&lt;li&gt;A &lt;strong&gt;view&lt;/strong&gt; is like a virtual table that stores the result of a query.&lt;/li&gt;
&lt;li&gt;Instead of writing the long JOIN query every time, we can just select from the view.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;Views improve &lt;strong&gt;readability&lt;/strong&gt; and &lt;strong&gt;reusability&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Good for &lt;strong&gt;reporting&lt;/strong&gt;, since they provide a simplified version of complex joins.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Example Usage:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT * FROM StudentCoursesView;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;This directly shows all students with their enrolled courses and grades.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;2. Creating a Stored Procedure: &lt;code&gt;UpdateGrade&lt;/code&gt;&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;CREATE OR REPLACE PROCEDURE UpdateGrade (
    p_StudentID IN NUMBER,
    p_CourseID IN NUMBER,
    p_NewGrade IN VARCHAR2
) AS
BEGIN
    UPDATE Enrollments
    SET Grade = p_NewGrade
    WHERE StudentID = p_StudentID AND CourseID = p_CourseID;
    COMMIT;
END;
/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;ul&gt;
&lt;li&gt;A &lt;strong&gt;stored procedure&lt;/strong&gt; is a block of SQL code that can be executed with parameters.&lt;/li&gt;
&lt;li&gt;Here, we use it to &lt;strong&gt;update a student’s grade&lt;/strong&gt; in a course.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;How to create reusable &lt;strong&gt;PL/SQL procedures.&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Passing parameters (&lt;code&gt;IN&lt;/code&gt;) to make updates dynamic.&lt;/li&gt;
&lt;li&gt;Importance of &lt;code&gt;COMMIT&lt;/code&gt; to save changes permanently.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Example Usage:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;EXEC UpdateGrade(1, 101, 'B+');
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;This updates Rahul Sharma’s grade in Database Systems to B+.&lt;/p&gt;

&lt;p&gt;With Views &amp;amp; Procedures, we learn how to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Simplify repeated queries&lt;/strong&gt; using views.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Automate updates and tasks&lt;/strong&gt; using stored procedures.&lt;/li&gt;
&lt;li&gt;Combine SQL with &lt;strong&gt;PL/SQL programming&lt;/strong&gt; concepts for more flexibility.&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Complete Code:
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CREATE TABLE Students (
    StudentID NUMBER PRIMARY KEY,
    Name VARCHAR2(50) NOT NULL,
    Dept VARCHAR2(30),
    DOB DATE,
    Email VARCHAR2(50) UNIQUE
);

SELECT * FROM STUDENTS;

CREATE TABLE Courses (
    CourseID NUMBER PRIMARY KEY,
    CourseName VARCHAR2(50) NOT NULL,
    Credits NUMBER(2)
);

SELECT * FROM COURSES;

CREATE TABLE Enrollments (
    EnrollID NUMBER PRIMARY KEY,
    StudentID NUMBER REFERENCES Students(StudentID),
    CourseID NUMBER REFERENCES Courses(CourseID),
    Grade CHAR(2)
);

CREATE TABLE Faculty (
    FacultyId NUMBER PRIMARY KEY,
    FacultyName VARCHAR2(50) NOT NULL,
    Dept VARCHAR2(50),
    Email VARCHAR2(50) UNIQUE
);



-- Students
INSERT INTO Students (StudentID, Name, Dept, DOB, Email) VALUES
(1, 'Rahul Sharma', 'Computer Science', DATE '2002-05-14', 'rahul.sharma@example.com');
INSERT INTO Students (StudentID, Name, Dept, DOB, Email) VALUES
(2, 'Priya Singh', 'Mechanical', DATE '2001-08-21', 'priya.singh@example.com');
INSERT INTO Students (StudentID, Name, Dept, DOB, Email) VALUES
(3, 'Amit Verma', 'Electronics', DATE '2003-01-10', 'amit.verma@example.com');

-- Courses
INSERT INTO Courses (CourseID, CourseName, Credits) VALUES
(101, 'Database Systems', 5);
INSERT INTO Courses (CourseID, CourseName, Credits) VALUES
(102, 'Operating Systems', 5);
INSERT INTO Courses (CourseID, CourseName, Credits) VALUES
(103, 'Thermodynamics', 5);

-- Enrollments
INSERT INTO Enrollments (EnrollID, StudentID, CourseID, Grade) VALUES
(1001, 1, 101, 'A');
INSERT INTO Enrollments (EnrollID, StudentID, CourseID, Grade) VALUES
(1002, 2, 103, 'B');
INSERT INTO Enrollments (EnrollID, StudentID, CourseID, Grade) VALUES
(1003, 3, 102, 'A');

-- Faculty
INSERT INTO Faculty (FacultyId, FacultyName, Dept, Email) VALUES
(201, 'Dr. Neha Kapoor', 'Computer Science', 'neha.kapoor@example.com');
INSERT INTO Faculty (FacultyId, FacultyName, Dept, Email) VALUES
(202, 'Dr. Rajesh Iyer', 'Mechanical', 'rajesh.iyer@example.com');
INSERT INTO Faculty (FacultyId, FacultyName, Dept, Email) VALUES
(203, 'Dr. Sunita Rao', 'Electronics', 'sunita.rao@example.com');

SELECT * FROM FACULTY ;

ALTER TABLE Students ADD PhoneNo VARCHAR2(10);

ALTER TABLE Courses ADD CONSTRAINT chk_credits CHECK (Credits BETWEEN 1 AND 5);


SELECT UPPER(Name) AS StudentName , LENGTH(Email) as EmailLength  FROM Students;

SELECT (SELECT AVG(CREDITS) FROM COURSES) AS AvgCredits ,(SELECT COUNT(DISTINCT ENROLLID) FROM ENROLLMENTS) AS TotalEnrolledStudents FROM dual; 

-- List all students along with the courses they are enrolled in (Student Name, Course Name, Grade).
SELECT s.Name, c.CourseName, e.Grade
FROM Students s
JOIN Enrollments e ON s.StudentID = e.StudentID
JOIN Courses c ON e.CourseID = c.CourseID;

-- Show each department and the count of students. Display only those departments with more than 2 students.

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

-- List all students along with the courses they are enrolled in (Student Name, Course Name, Grade).
SELECT s.Name, c.CourseName, e.Grade
FROM Students s
JOIN Enrollments e ON s.StudentID = e.StudentID
JOIN Courses c ON e.CourseID = c.CourseID;

-- Show each department and the count of students. Display only those departments with more than 2 students.

SELECT Dept, COUNT(*) AS StudentCount
FROM Students


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


CREATE OR REPLACE PROCEDURE UpdateGrade (
p_StudentID IN NUMBER,
p_CourseID IN NUMBER,
p_NewGrade IN CHAR
) AS
BEGIN
UPDATE Enrollments
SET Grade = p_NewGrade
WHERE StudentID = p_StudentID AND CourseID = p_CourseID;
COMMIT;
END;
/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






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

&lt;p&gt;This project was a &lt;strong&gt;simple, beginner-friendly implementation&lt;/strong&gt; of a College Management System using SQL.&lt;/p&gt;

&lt;p&gt;We designed and implemented four key entities:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Students&lt;/strong&gt; – storing student details.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Courses&lt;/strong&gt; – listing subjects with &lt;strong&gt;credits.&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Enrollments&lt;/strong&gt; – linking students to their &lt;strong&gt;courses&lt;/strong&gt; and &lt;strong&gt;grades.&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Faculty&lt;/strong&gt; – storing professor details.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We also:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Inserted &lt;strong&gt;sample data&lt;/strong&gt; to simulate a real college environment.&lt;/li&gt;
&lt;li&gt;Wrote &lt;strong&gt;queries&lt;/strong&gt; to analyze and extract useful information.&lt;/li&gt;
&lt;li&gt;Created a view for &lt;strong&gt;simplified reporting.&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Built a &lt;strong&gt;stored procedure to dynamically update grades.&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Learnings Recap
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;How to design &lt;strong&gt;normalized tables&lt;/strong&gt; with &lt;code&gt;primary&lt;/code&gt; &amp;amp; &lt;code&gt;foreign key&lt;/code&gt;'s.&lt;/li&gt;
&lt;li&gt;How to use &lt;strong&gt;constraints&lt;/strong&gt; (&lt;code&gt;unique&lt;/code&gt;, &lt;code&gt;not null&lt;/code&gt;,&lt;code&gt;check&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;Writing queries with &lt;strong&gt;joins, aggregates, and group filters.&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Using views for &lt;strong&gt;simplified queries.&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Creating procedures to &lt;strong&gt;automate tasks.&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Future Improvements
&lt;/h2&gt;

&lt;p&gt;Although this is a basic project, it can be extended with:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Attendance tracking&lt;/strong&gt; (students’ daily presence).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Faculty-course mapping&lt;/strong&gt; (which professor teaches which course).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;GPA/CGPA&lt;/strong&gt; calculation functions.&lt;/li&gt;
&lt;li&gt;Triggers to &lt;strong&gt;automatically update data&lt;/strong&gt; (like grade-based performance status).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;More analytics reports&lt;/strong&gt; (top students, most popular courses, etc.).&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;With this, we’ve shown how SQL can be used to build a &lt;strong&gt;realistic mini-database system&lt;/strong&gt; that models everyday college operations.&lt;br&gt;
Even though it’s simple, the same principles can be scaled up to design larger &lt;strong&gt;student management systems, portals, or ERP solutions.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>sqlserver</category>
      <category>sql</category>
      <category>oracle</category>
      <category>database</category>
    </item>
    <item>
      <title>College Student and Course Management System using SQL (Oracle)</title>
      <dc:creator>Naveens K</dc:creator>
      <pubDate>Fri, 22 Aug 2025 17:35:22 +0000</pubDate>
      <link>https://dev.to/naveens_k_403279738dbcab6/college-student-and-course-management-system-using-sql-oracle-408h</link>
      <guid>https://dev.to/naveens_k_403279738dbcab6/college-student-and-course-management-system-using-sql-oracle-408h</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;This is a simple, basic SQL project that demonstrates how to design and manage a small College Management System.&lt;/p&gt;

&lt;p&gt;The idea is to create a database that stores information about:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Students (their details and department)&lt;/li&gt;
&lt;li&gt;Courses (subjects offered)&lt;/li&gt;
&lt;li&gt;Faculty (professors teaching in departments)&lt;/li&gt;
&lt;li&gt;Enrollments (which student takes which course, along with grades)&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;Although this is a small-scale project, it reflects how real-world college databases are structured.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Why is this project useful?&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Helps beginners understand how relational databases work.&lt;/li&gt;
&lt;li&gt;Shows how different entities (students, courses, faculty) are linked through relationships.&lt;/li&gt;
&lt;li&gt;Demonstrates SQL features like constraints, joins, views, and stored procedures.&lt;/li&gt;
&lt;li&gt;Can be easily extended into a bigger college portal system (with attendance, GPA calculation, reports, etc.).&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;In short, this project is a foundation exercise that not only strengthens SQL skills but also gives a taste of how databases are applied in &lt;strong&gt;real educational institutions.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Database Design – Tables and Purpose
&lt;/h2&gt;

&lt;p&gt;In this project, we created four main tables: &lt;strong&gt;Students, Courses, Enrollments, and Faculty.&lt;/strong&gt;&lt;br&gt;
Each table represents an important entity in a college system.&lt;br&gt;
&lt;strong&gt;1. Students Table&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;CREATE TABLE Students (
    StudentID NUMBER PRIMARY KEY,
    Name VARCHAR2(50) NOT NULL,
    Dept VARCHAR2(30),
    DOB DATE,
    Email VARCHAR2(50) UNIQUE
);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;ul&gt;
&lt;li&gt;Stores basic information about students like &lt;strong&gt;name, department, date of birth, and email.&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;StudentID&lt;/code&gt; acts as a primary key so that every student is uniquely identified.&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;Email&lt;/code&gt; field is marked as &lt;code&gt;UNIQUE&lt;/code&gt;, ensuring no two students have the same email&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;How to define primary keys for unique identification.&lt;/li&gt;
&lt;li&gt;How to enforce data integrity using &lt;code&gt;NOT NULL&lt;/code&gt; and &lt;code&gt;UNIQUE&lt;/code&gt; constraints.&lt;/li&gt;
&lt;li&gt;How to handle different data types (&lt;code&gt;VARCHAR2&lt;/code&gt; for text, &lt;code&gt;DATE&lt;/code&gt; for birthdate).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;2. Course Table&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;CREATE TABLE Courses (
    CourseID NUMBER PRIMARY KEY,
    CourseName VARCHAR2(50) NOT NULL,
    Credits NUMBER(2)
);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;ul&gt;
&lt;li&gt;Stores all courses offered by the institution.&lt;/li&gt;
&lt;li&gt;Each course has an &lt;strong&gt;ID, name, and credits.&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;CourseID&lt;/code&gt; uniquely identifies each course.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;Designing a table that holds course catalog information.&lt;/li&gt;
&lt;li&gt;Adding constraints like &lt;code&gt;NOT NULL&lt;/code&gt; for required fields.&lt;/li&gt;
&lt;li&gt;Understanding numeric columns (credits between 1–5).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;3. Enrollments Table&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;CREATE TABLE Enrollments (
    EnrollID NUMBER PRIMARY KEY,
    StudentID NUMBER REFERENCES Students(StudentID),
    CourseID NUMBER REFERENCES Courses(CourseID),
    Grade VARCHAR2(2)
);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;ul&gt;
&lt;li&gt;Acts as a bridge table between Students and Courses.&lt;/li&gt;
&lt;li&gt;Stores which student is enrolled in which course, along with their grade.&lt;/li&gt;
&lt;li&gt;Uses foreign keys to connect to &lt;code&gt;Students&lt;/code&gt; and &lt;code&gt;Courses&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;How to create &lt;strong&gt;relationships&lt;/strong&gt; between tables.&lt;/li&gt;
&lt;li&gt;Use of foreign keys for maintaining referential integrity.&lt;/li&gt;
&lt;li&gt;Handling &lt;strong&gt;many-to-many relationships&lt;/strong&gt; (one student can enroll in many courses, one course can have many students).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;4. Faculty Table&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;CREATE TABLE Faculty (
    FacultyId NUMBER PRIMARY KEY,
    FacultyName VARCHAR2(50) NOT NULL,
    Dept VARCHAR2(50),
    Email VARCHAR2(50) UNIQUE
);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;ul&gt;
&lt;li&gt;Stores details of faculty members (professors).&lt;/li&gt;
&lt;li&gt;Each faculty is linked to a &lt;strong&gt;department&lt;/strong&gt; and has a &lt;strong&gt;unique email.&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;Designing another entity in the college system.&lt;/li&gt;
&lt;li&gt;Importance of &lt;strong&gt;uniqueness&lt;/strong&gt; (faculty emails).&lt;/li&gt;
&lt;li&gt;Setting up &lt;strong&gt;department-wise grouping&lt;/strong&gt; of faculty for future queries.&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;By creating these tables, we learn:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;How to &lt;strong&gt;design normalized tables&lt;/strong&gt; for real-world entities.&lt;/li&gt;
&lt;li&gt;How to apply constraints (&lt;code&gt;Primary Key&lt;/code&gt;, &lt;code&gt;Unique&lt;/code&gt;, &lt;code&gt;Not Null&lt;/code&gt;, &lt;code&gt;Foreign Key&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;How to connect multiple tables to &lt;strong&gt;model real-world relationships.&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Inserting Data into Tables
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1. Insert Data into Students&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;INSERT INTO Students (StudentID, Name, Dept, DOB, Email) VALUES
(1, 'Rahul Sharma', 'Computer Science', DATE '2002-05-14', 'rahul.sharma@example.com');

INSERT INTO Students (StudentID, Name, Dept, DOB, Email) VALUES
(2, 'Priya Singh', 'Mechanical', DATE '2001-08-21', 'priya.singh@example.com');

INSERT INTO Students (StudentID, Name, Dept, DOB, Email) VALUES
(3, 'Amit Verma', 'Electronics', DATE '2003-01-10', 'amit.verma@example.com');
&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%2Fo1zrgon30cvc3rj0llex.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%2Fo1zrgon30cvc3rj0llex.png" alt=" " width="800" height="141"&gt;&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;2. Insert Data into Courses&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;INSERT INTO Courses (CourseID, CourseName, Credits) VALUES
(104, 'Database Systems', 5);

INSERT INTO Courses (CourseID, CourseName, Credits) VALUES
(101, 'Operating Systems', 4);

INSERT INTO Courses (CourseID, CourseName, Credits) VALUES
(102, 'Thermodynamics', 3);
&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%2F5n9a6izgm0r3x4ljc1n5.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%2F5n9a6izgm0r3x4ljc1n5.png" alt=" " width="792" height="206"&gt;&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;3. Insert Data into Enrollments&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;INSERT INTO Enrollments (EnrollID, StudentID, CourseID, Grade) VALUES
(1001, 1, 101, 'A');

INSERT INTO Enrollments (EnrollID, StudentID, CourseID, Grade) VALUES
(1002, 2, 103, 'B');

INSERT INTO Enrollments (EnrollID, StudentID, CourseID, Grade) VALUES
(1003, 3, 102, 'A');
&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%2F7z9p5fma4hy57j7wclvl.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%2F7z9p5fma4hy57j7wclvl.png" alt=" " width="800" height="153"&gt;&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;4. Insert Data into Faculty&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;INSERT INTO Faculty (FacultyId, FacultyName, Dept, Email) VALUES
(201, 'Dr. Neha Kapoor', 'Computer Science', 'neha.kapoor@example.com');

INSERT INTO Faculty (FacultyId, FacultyName, Dept, Email) VALUES
(202, 'Dr. Rajesh Iyer', 'Mechanical', 'rajesh.iyer@example.com');

INSERT INTO Faculty (FacultyId, FacultyName, Dept, Email) VALUES
(203, 'Dr. Sunita Rao', 'Electronics', 'sunita.rao@example.com');
&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%2Frngxlvn5cl0smb62chk8.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%2Frngxlvn5cl0smb62chk8.png" alt=" " width="800" height="161"&gt;&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;Purpose:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;To design a &lt;strong&gt;basic but realistic database&lt;/strong&gt; that represents a college management system.&lt;/li&gt;
&lt;li&gt;To define the main entities — &lt;strong&gt;Students, Courses, Enrollments, and Faculty&lt;/strong&gt; — and establish relationships among them.&lt;/li&gt;
&lt;li&gt;To insert &lt;strong&gt;sample records&lt;/strong&gt; so the database is ready for practicing queries and analysis.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Database Design Principles&lt;/strong&gt; – understanding how to model real-world entities (like students and courses) as database tables.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Constraints for Data Integrity&lt;/strong&gt; – applying &lt;strong&gt;Primary Keys, Unique Keys, Not Null, and Foreign Keys&lt;/strong&gt; to avoid duplicate or invalid data.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Relationships in Databases&lt;/strong&gt; – creating &lt;strong&gt;one-to-many and many-to-many relationships&lt;/strong&gt; (via Enrollments).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Data Insertion&lt;/strong&gt; – learning how to insert records correctly, including handling dates, text fields, and numeric constraints.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Normalization Basics&lt;/strong&gt; – separating data into different tables instead of storing everything in one, which avoids redundancy and makes queries more efficient.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;blockquote&gt;
&lt;p&gt;In short, this phase helps us move from theory to practice:&lt;br&gt;
we don’t just define tables, but also fill them with meaningful data that mirrors a real college environment, preparing the ground for more advanced SQL queries and procedures.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;h2&gt;
  
  
  Queries and Learnings
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1. Display Students with Uppercase Names and Email Length&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;SELECT UPPER(Name) AS StudentName, LENGTH(Email) AS EmailLength
FROM Students;
&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%2Fffmh7tjp55ppeehdqtmq.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%2Fffmh7tjp55ppeehdqtmq.png" alt=" " width="577" height="200"&gt;&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;Purpose:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Converts all student names to uppercase.&lt;/li&gt;
&lt;li&gt;Shows the length of each student’s email address.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;Use of &lt;strong&gt;string functions&lt;/strong&gt; (&lt;code&gt;UPPER&lt;/code&gt;, &lt;code&gt;LENGTH&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;How SQL can transform and analyze text data.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;2. Find Average Credits and Total Enrollments&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;SELECT 
   (SELECT AVG(CREDITS) FROM Courses) AS AvgCredits,
   (SELECT COUNT(DISTINCT EnrollID) FROM Enrollments) AS TotalEnrolledStudents
FROM dual;
&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%2F0p0hvm1tfn2tawf4nh53.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%2F0p0hvm1tfn2tawf4nh53.png" alt=" " width="582" height="96"&gt;&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;Purpose:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Finds the average credits across all courses.&lt;/li&gt;
&lt;li&gt;Counts how many students are enrolled overall.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;Use of &lt;strong&gt;aggregate functions&lt;/strong&gt; (&lt;code&gt;AVG&lt;/code&gt;, &lt;code&gt;COUNT&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;Writing &lt;strong&gt;subqueries&lt;/strong&gt; inside a SELECT.&lt;/li&gt;
&lt;li&gt;Using &lt;code&gt;DUAL&lt;/code&gt; (special table in Oracle for single-row queries).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;3. List Students with Their Courses and Grades&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;SELECT s.Name, c.CourseName, e.Grade
FROM Students s
JOIN Enrollments e ON s.StudentID = e.StudentID
JOIN Courses c ON e.CourseID = c.CourseID;
&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%2F1s3nlc29nclmv0i5wue0.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%2F1s3nlc29nclmv0i5wue0.png" alt=" " width="798" height="213"&gt;&lt;/a&gt;&lt;/p&gt;

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

&lt;ul&gt;
&lt;li&gt;Displays each student along with the &lt;strong&gt;course they enrolled in and their grade.&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;How to use &lt;strong&gt;INNER JOIN&lt;/strong&gt; to combine multiple tables.&lt;/li&gt;
&lt;li&gt;Understanding &lt;strong&gt;relationships&lt;/strong&gt; (Students ↔ Enrollments ↔ Courses).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;4. Department-Wise Student Count (Only if &amp;gt;2 Students)&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;SELECT Dept, COUNT(*) AS StudentCount
FROM Students
GROUP BY Dept
HAVING COUNT(*) &amp;gt; 2;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;ul&gt;
&lt;li&gt;Groups students by department.&lt;/li&gt;
&lt;li&gt;Shows only departments having &lt;strong&gt;more than 2 students.&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;Difference between &lt;code&gt;WHERE&lt;/code&gt; and &lt;code&gt;HAVING&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;How to use &lt;strong&gt;GROUP BY&lt;/strong&gt; with aggregate functions.&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;With these queries, we are able to:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Analyze text and numeric data.&lt;/li&gt;
&lt;li&gt;Use joins to link tables.&lt;/li&gt;
&lt;li&gt;Work with &lt;strong&gt;aggregate functions&lt;/strong&gt; for reporting.&lt;/li&gt;
&lt;li&gt;Apply &lt;strong&gt;filtering&lt;/strong&gt; at both row-level (&lt;code&gt;WHERE&lt;/code&gt;) and group-level (&lt;code&gt;HAVING&lt;/code&gt;).&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Views &amp;amp; Stored Procedures
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1. Creating a View: &lt;code&gt;StudentCoursesView&lt;/code&gt;&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;CREATE OR REPLACE VIEW StudentCoursesView AS
SELECT s.Name AS StudentName, c.CourseName, e.Grade
FROM Students s
JOIN Enrollments e ON s.StudentID = e.StudentID
JOIN Courses c ON c.CourseID = e.CourseID;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;ul&gt;
&lt;li&gt;A &lt;strong&gt;view&lt;/strong&gt; is like a virtual table that stores the result of a query.&lt;/li&gt;
&lt;li&gt;Instead of writing the long JOIN query every time, we can just select from the view.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;Views improve &lt;strong&gt;readability&lt;/strong&gt; and &lt;strong&gt;reusability&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Good for &lt;strong&gt;reporting&lt;/strong&gt;, since they provide a simplified version of complex joins.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Example Usage:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT * FROM StudentCoursesView;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;This directly shows all students with their enrolled courses and grades.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;2. Creating a Stored Procedure: &lt;code&gt;UpdateGrade&lt;/code&gt;&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;CREATE OR REPLACE PROCEDURE UpdateGrade (
    p_StudentID IN NUMBER,
    p_CourseID IN NUMBER,
    p_NewGrade IN VARCHAR2
) AS
BEGIN
    UPDATE Enrollments
    SET Grade = p_NewGrade
    WHERE StudentID = p_StudentID AND CourseID = p_CourseID;
    COMMIT;
END;
/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;ul&gt;
&lt;li&gt;A &lt;strong&gt;stored procedure&lt;/strong&gt; is a block of SQL code that can be executed with parameters.&lt;/li&gt;
&lt;li&gt;Here, we use it to &lt;strong&gt;update a student’s grade&lt;/strong&gt; in a course.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;How to create reusable &lt;strong&gt;PL/SQL procedures.&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Passing parameters (&lt;code&gt;IN&lt;/code&gt;) to make updates dynamic.&lt;/li&gt;
&lt;li&gt;Importance of &lt;code&gt;COMMIT&lt;/code&gt; to save changes permanently.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Example Usage:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;EXEC UpdateGrade(1, 101, 'B+');
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;This updates Rahul Sharma’s grade in Database Systems to B+.&lt;/p&gt;

&lt;p&gt;With Views &amp;amp; Procedures, we learn how to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Simplify repeated queries&lt;/strong&gt; using views.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Automate updates and tasks&lt;/strong&gt; using stored procedures.&lt;/li&gt;
&lt;li&gt;Combine SQL with &lt;strong&gt;PL/SQL programming&lt;/strong&gt; concepts for more flexibility.&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Complete Code:
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CREATE TABLE Students (
    StudentID NUMBER PRIMARY KEY,
    Name VARCHAR2(50) NOT NULL,
    Dept VARCHAR2(30),
    DOB DATE,
    Email VARCHAR2(50) UNIQUE
);

SELECT * FROM STUDENTS;

CREATE TABLE Courses (
    CourseID NUMBER PRIMARY KEY,
    CourseName VARCHAR2(50) NOT NULL,
    Credits NUMBER(2)
);

SELECT * FROM COURSES;

CREATE TABLE Enrollments (
    EnrollID NUMBER PRIMARY KEY,
    StudentID NUMBER REFERENCES Students(StudentID),
    CourseID NUMBER REFERENCES Courses(CourseID),
    Grade CHAR(2)
);

CREATE TABLE Faculty (
    FacultyId NUMBER PRIMARY KEY,
    FacultyName VARCHAR2(50) NOT NULL,
    Dept VARCHAR2(50),
    Email VARCHAR2(50) UNIQUE
);



-- Students
INSERT INTO Students (StudentID, Name, Dept, DOB, Email) VALUES
(1, 'Rahul Sharma', 'Computer Science', DATE '2002-05-14', 'rahul.sharma@example.com');
INSERT INTO Students (StudentID, Name, Dept, DOB, Email) VALUES
(2, 'Priya Singh', 'Mechanical', DATE '2001-08-21', 'priya.singh@example.com');
INSERT INTO Students (StudentID, Name, Dept, DOB, Email) VALUES
(3, 'Amit Verma', 'Electronics', DATE '2003-01-10', 'amit.verma@example.com');

-- Courses
INSERT INTO Courses (CourseID, CourseName, Credits) VALUES
(101, 'Database Systems', 5);
INSERT INTO Courses (CourseID, CourseName, Credits) VALUES
(102, 'Operating Systems', 5);
INSERT INTO Courses (CourseID, CourseName, Credits) VALUES
(103, 'Thermodynamics', 5);

-- Enrollments
INSERT INTO Enrollments (EnrollID, StudentID, CourseID, Grade) VALUES
(1001, 1, 101, 'A');
INSERT INTO Enrollments (EnrollID, StudentID, CourseID, Grade) VALUES
(1002, 2, 103, 'B');
INSERT INTO Enrollments (EnrollID, StudentID, CourseID, Grade) VALUES
(1003, 3, 102, 'A');

-- Faculty
INSERT INTO Faculty (FacultyId, FacultyName, Dept, Email) VALUES
(201, 'Dr. Neha Kapoor', 'Computer Science', 'neha.kapoor@example.com');
INSERT INTO Faculty (FacultyId, FacultyName, Dept, Email) VALUES
(202, 'Dr. Rajesh Iyer', 'Mechanical', 'rajesh.iyer@example.com');
INSERT INTO Faculty (FacultyId, FacultyName, Dept, Email) VALUES
(203, 'Dr. Sunita Rao', 'Electronics', 'sunita.rao@example.com');

SELECT * FROM FACULTY ;

ALTER TABLE Students ADD PhoneNo VARCHAR2(10);

ALTER TABLE Courses ADD CONSTRAINT chk_credits CHECK (Credits BETWEEN 1 AND 5);


SELECT UPPER(Name) AS StudentName , LENGTH(Email) as EmailLength  FROM Students;

SELECT (SELECT AVG(CREDITS) FROM COURSES) AS AvgCredits ,(SELECT COUNT(DISTINCT ENROLLID) FROM ENROLLMENTS) AS TotalEnrolledStudents FROM dual; 

-- List all students along with the courses they are enrolled in (Student Name, Course Name, Grade).
SELECT s.Name, c.CourseName, e.Grade
FROM Students s
JOIN Enrollments e ON s.StudentID = e.StudentID
JOIN Courses c ON e.CourseID = c.CourseID;

-- Show each department and the count of students. Display only those departments with more than 2 students.

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

-- List all students along with the courses they are enrolled in (Student Name, Course Name, Grade).
SELECT s.Name, c.CourseName, e.Grade
FROM Students s
JOIN Enrollments e ON s.StudentID = e.StudentID
JOIN Courses c ON e.CourseID = c.CourseID;

-- Show each department and the count of students. Display only those departments with more than 2 students.

SELECT Dept, COUNT(*) AS StudentCount
FROM Students


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


CREATE OR REPLACE PROCEDURE UpdateGrade (
p_StudentID IN NUMBER,
p_CourseID IN NUMBER,
p_NewGrade IN CHAR
) AS
BEGIN
UPDATE Enrollments
SET Grade = p_NewGrade
WHERE StudentID = p_StudentID AND CourseID = p_CourseID;
COMMIT;
END;
/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






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

&lt;p&gt;This project was a &lt;strong&gt;simple, beginner-friendly implementation&lt;/strong&gt; of a College Management System using SQL.&lt;/p&gt;

&lt;p&gt;We designed and implemented four key entities:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Students&lt;/strong&gt; – storing student details.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Courses&lt;/strong&gt; – listing subjects with &lt;strong&gt;credits.&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Enrollments&lt;/strong&gt; – linking students to their &lt;strong&gt;courses&lt;/strong&gt; and &lt;strong&gt;grades.&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Faculty&lt;/strong&gt; – storing professor details.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We also:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Inserted &lt;strong&gt;sample data&lt;/strong&gt; to simulate a real college environment.&lt;/li&gt;
&lt;li&gt;Wrote &lt;strong&gt;queries&lt;/strong&gt; to analyze and extract useful information.&lt;/li&gt;
&lt;li&gt;Created a view for &lt;strong&gt;simplified reporting.&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Built a &lt;strong&gt;stored procedure to dynamically update grades.&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Learnings Recap
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;How to design &lt;strong&gt;normalized tables&lt;/strong&gt; with &lt;code&gt;primary&lt;/code&gt; &amp;amp; &lt;code&gt;foreign key&lt;/code&gt;'s.&lt;/li&gt;
&lt;li&gt;How to use &lt;strong&gt;constraints&lt;/strong&gt; (&lt;code&gt;unique&lt;/code&gt;, &lt;code&gt;not null&lt;/code&gt;,&lt;code&gt;check&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;Writing queries with &lt;strong&gt;joins, aggregates, and group filters.&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Using views for** simplified queries.**&lt;/li&gt;
&lt;li&gt;Creating procedures to &lt;strong&gt;automate tasks.&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Future Improvements
&lt;/h2&gt;

&lt;p&gt;Although this is a basic project, it can be extended with:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Attendance tracking&lt;/strong&gt; (students’ daily presence).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Faculty-course mapping&lt;/strong&gt; (which professor teaches which course).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;GPA/CGPA&lt;/strong&gt; calculation functions.&lt;/li&gt;
&lt;li&gt;Triggers to &lt;strong&gt;automatically update data&lt;/strong&gt; (like grade-based performance status).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;More analytics reports&lt;/strong&gt; (top students, most popular courses, etc.).&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;With this, we’ve shown how SQL can be used to build a &lt;strong&gt;realistic mini-database system&lt;/strong&gt; that models everyday college operations.&lt;br&gt;
Even though it’s simple, the same principles can be scaled up to design larger &lt;strong&gt;student management systems, portals, or ERP solutions.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

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