<?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: Abinaya Dhanraj</title>
    <description>The latest articles on DEV Community by Abinaya Dhanraj (@abinaya_dhanraj).</description>
    <link>https://dev.to/abinaya_dhanraj</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%2F3837952%2Fa507b94e-0026-4f49-b0d8-a312b5a11b5c.jpg</url>
      <title>DEV Community: Abinaya Dhanraj</title>
      <link>https://dev.to/abinaya_dhanraj</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/abinaya_dhanraj"/>
    <language>en</language>
    <item>
      <title>Understanding ALTER TABLE with Constraints in SQL</title>
      <dc:creator>Abinaya Dhanraj</dc:creator>
      <pubDate>Sun, 29 Mar 2026 02:55:29 +0000</pubDate>
      <link>https://dev.to/abinaya_dhanraj/understanding-alter-table-with-constraints-in-sql-68c</link>
      <guid>https://dev.to/abinaya_dhanraj/understanding-alter-table-with-constraints-in-sql-68c</guid>
      <description>&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%2Fs3g4usbri4rb41sjaaaa.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%2Fs3g4usbri4rb41sjaaaa.png" alt=" " width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;_&lt;em&gt;In this task, I worked on modifying existing tables using ALTER TABLE. This helped me understand how to update table structure after it has already been created. I learned how to add constraints, change column properties, and manage relationships between tables.&lt;br&gt;
_&lt;/em&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Modifying customers table&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Query:&lt;/p&gt;

&lt;p&gt;ALTER TABLE customers&lt;br&gt;
ALTER COLUMN email SET NOT NULL;&lt;/p&gt;

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

&lt;p&gt;In this query, I modified the email column so that it cannot store NULL values. This ensures that every customer must have an email in future entries.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Adding UNIQUE constraint in users table&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Query:&lt;/p&gt;

&lt;p&gt;ALTER TABLE users&lt;br&gt;
ADD CONSTRAINT unique_username UNIQUE (username);&lt;/p&gt;

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

&lt;p&gt;Here, I added a UNIQUE constraint to the username column. This ensures that no two users can have the same username, which helps avoid duplicate records.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Adding CHECK constraint in products table&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Query:&lt;/p&gt;

&lt;p&gt;ALTER TABLE products&lt;br&gt;
ADD CONSTRAINT check_price_positive CHECK (price &amp;gt; 0);&lt;/p&gt;

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

&lt;p&gt;In this query, I added a CHECK condition to make sure that the price is always greater than 0. This prevents invalid values like zero or negative prices.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Setting DEFAULT value in orders table&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Query:&lt;/p&gt;

&lt;p&gt;ALTER TABLE orders&lt;br&gt;
ALTER COLUMN status SET DEFAULT 'pending';&lt;/p&gt;

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

&lt;p&gt;Here, I set a default value for the status column. If no value is provided while inserting data, it will automatically be set to 'pending'.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Adding salary column in employees table&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Query:&lt;/p&gt;

&lt;p&gt;ALTER TABLE employees&lt;br&gt;
ADD COLUMN salary DECIMAL(10,2) NOT NULL CHECK (salary &amp;gt; 10000);&lt;/p&gt;

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

&lt;p&gt;In this query, I added a new column called salary. It cannot be NULL and must always be greater than 10000. This ensures that all employees have a valid salary value.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Modifying foreign key with cascade&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Query:&lt;/p&gt;

&lt;p&gt;ALTER TABLE employees_dept&lt;br&gt;
DROP CONSTRAINT employees_dept_department_id_fkey;&lt;/p&gt;

&lt;p&gt;ALTER TABLE employees_dept&lt;br&gt;
ADD CONSTRAINT employees_dept_department_id_fkey&lt;br&gt;
FOREIGN KEY (department_id)&lt;br&gt;
REFERENCES departments(id)&lt;br&gt;
ON DELETE CASCADE;&lt;/p&gt;

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

&lt;p&gt;Here, I modified the foreign key constraint. When a department is deleted, all related employees will also be deleted automatically. This helps maintain consistency in the database.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Removing CHECK constraint in accounts table&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Query:&lt;/p&gt;

&lt;p&gt;ALTER TABLE accounts&lt;br&gt;
DROP CONSTRAINT accounts_balance_check;&lt;/p&gt;

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

&lt;p&gt;In this query, I removed the CHECK constraint that was enforcing balance to be greater than or equal to 0. After removing it, the table will allow any value for balance.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Adding composite UNIQUE constraint in payments table&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Query:&lt;/p&gt;

&lt;p&gt;ALTER TABLE payments&lt;br&gt;
ADD CONSTRAINT unique_user_transaction UNIQUE (user_id, transaction_id);&lt;/p&gt;

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

&lt;p&gt;Here, I added a composite UNIQUE constraint on user_id and transaction_id. This ensures that the same transaction cannot be repeated for the same user.&lt;/p&gt;

&lt;p&gt;Conclude with :&lt;/p&gt;

&lt;p&gt;Through this task, I understood how ALTER TABLE helps in modifying existing tables. It allows adding, removing, and updating constraints based on new requirements.This made me realize that database design is not fixed and can be updated when needed, but changes should be done carefully to maintain data consistency.&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>database</category>
      <category>sql</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Understanding SQL Table Creation with Constraints Introduction</title>
      <dc:creator>Abinaya Dhanraj</dc:creator>
      <pubDate>Sun, 29 Mar 2026 02:47:48 +0000</pubDate>
      <link>https://dev.to/abinaya_dhanraj/understanding-sql-table-creation-with-constraintsintroduction-1c8</link>
      <guid>https://dev.to/abinaya_dhanraj/understanding-sql-table-creation-with-constraintsintroduction-1c8</guid>
      <description>&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%2Fjkneywh3qhbm6hdwlvak.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%2Fjkneywh3qhbm6hdwlvak.png" alt=" " width="800" height="450"&gt;&lt;/a&gt;&lt;br&gt;
_&lt;em&gt;In this task, I created different tables in SQL by applying various constraints. While writing these queries, I focused on understanding why each constraint is used and how it helps in maintaining proper data in the database.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;_&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Students Table&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Query:&lt;/p&gt;

&lt;p&gt;CREATE TABLE students (&lt;br&gt;
    id SERIAL PRIMARY KEY,&lt;br&gt;
    name VARCHAR(100),&lt;br&gt;
    age INT&lt;br&gt;
);&lt;/p&gt;

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

&lt;p&gt;In this table, I created three columns: id, name, and age. The id is defined as a primary key, which means each record will have a unique identifier. I used SERIAL so that the id is automatically generated. This avoids duplication and makes it easier to identify each student.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Employees Table&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Query:&lt;/p&gt;

&lt;p&gt;CREATE TABLE employees (&lt;br&gt;
    id SERIAL PRIMARY KEY,&lt;br&gt;
    name VARCHAR(100) NOT NULL,&lt;br&gt;
    email VARCHAR(100) NOT NULL,&lt;br&gt;
    phone_number VARCHAR(15)&lt;br&gt;
);&lt;/p&gt;

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

&lt;p&gt;In this table, name and email are marked as NOT NULL, which means these fields cannot be left empty. The phone_number is optional, so it can have null values. This ensures that important details are always stored.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Users Table&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Query:&lt;/p&gt;

&lt;p&gt;CREATE TABLE users (&lt;br&gt;
    id SERIAL PRIMARY KEY,&lt;br&gt;
    username VARCHAR(50) UNIQUE,&lt;br&gt;
    email VARCHAR(100) UNIQUE&lt;br&gt;
);&lt;/p&gt;

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

&lt;p&gt;Here, I used UNIQUE for both username and email. This ensures that no two users can have the same username or email. It helps prevent duplicate entries and maintains consistency.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Products Table&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Query:&lt;/p&gt;

&lt;p&gt;CREATE TABLE products (&lt;br&gt;
    id SERIAL PRIMARY KEY,&lt;br&gt;
    name VARCHAR(100),&lt;br&gt;
    price DECIMAL(10,2) CHECK (price &amp;gt; 0),&lt;br&gt;
    stock INT CHECK (stock &amp;gt;= 0)&lt;br&gt;
);&lt;/p&gt;

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

&lt;p&gt;In this table, I used CHECK constraints to control the values. The price must be greater than zero, and stock must be zero or more. This prevents invalid data like negative stock or incorrect pricing.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Orders Table&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Query:&lt;/p&gt;

&lt;p&gt;CREATE TABLE orders (&lt;br&gt;
    id SERIAL PRIMARY KEY,&lt;br&gt;
    status VARCHAR(20) DEFAULT 'pending',&lt;br&gt;
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP&lt;br&gt;
);&lt;/p&gt;

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

&lt;p&gt;In this table, I used default values. If no status is given, it will automatically be set to 'pending'. The created_at column stores the current timestamp, which helps in tracking when the order was created.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Accounts Table&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Query:&lt;/p&gt;

&lt;p&gt;CREATE TABLE accounts (&lt;br&gt;
    id SERIAL PRIMARY KEY,&lt;br&gt;
    account_number VARCHAR(20) UNIQUE NOT NULL,&lt;br&gt;
    balance DECIMAL(10,2) CHECK (balance &amp;gt;= 0)&lt;br&gt;
);&lt;/p&gt;

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

&lt;p&gt;Here, account_number is both UNIQUE and NOT NULL, so every account must have a unique value and it cannot be empty. The balance is restricted using a CHECK condition to ensure it is not negative.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Enrollments Table&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Query:&lt;/p&gt;

&lt;p&gt;CREATE TABLE enrollments (&lt;br&gt;
    student_id INT,&lt;br&gt;
    course_id INT,&lt;br&gt;
    UNIQUE (student_id, course_id)&lt;br&gt;
);&lt;/p&gt;

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

&lt;p&gt;In this table, I used a combination of student_id and course_id as UNIQUE. This means a student cannot enroll in the same course more than once, but can enroll in different courses.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Departments and Employees (Foreign Key)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Query:&lt;/p&gt;

&lt;p&gt;CREATE TABLE departments (&lt;br&gt;
    id SERIAL PRIMARY KEY,&lt;br&gt;
    name VARCHAR(100)&lt;br&gt;
);&lt;/p&gt;

&lt;p&gt;CREATE TABLE employees_dept (&lt;br&gt;
    id SERIAL PRIMARY KEY,&lt;br&gt;
    name VARCHAR(100),&lt;br&gt;
    department_id INT,&lt;br&gt;
    FOREIGN KEY (department_id) REFERENCES departments(id)&lt;br&gt;
);&lt;/p&gt;

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

&lt;p&gt;Here, I created two tables. The employees table has a foreign key called department_id, which refers to the id in the departments table. This ensures that every employee is linked to a valid department.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Foreign Key with Cascade&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Query:&lt;/p&gt;

&lt;p&gt;CREATE TABLE departments_cascade (&lt;br&gt;
    id SERIAL PRIMARY KEY,&lt;br&gt;
    name VARCHAR(100)&lt;br&gt;
);&lt;/p&gt;

&lt;p&gt;CREATE TABLE employees_cascade (&lt;br&gt;
    id SERIAL PRIMARY KEY,&lt;br&gt;
    name VARCHAR(100),&lt;br&gt;
    department_id INT,&lt;br&gt;
    FOREIGN KEY (department_id)&lt;br&gt;
        REFERENCES departments_cascade(id)&lt;br&gt;
        ON DELETE CASCADE&lt;br&gt;
        ON UPDATE CASCADE&lt;br&gt;
);&lt;/p&gt;

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

&lt;p&gt;In this case, I added cascade options. When a department is deleted, all related employees are also deleted automatically. When a department id is updated, the change is reflected in the employees table. This helps maintain consistency without manual updates.&lt;/p&gt;

&lt;p&gt;I conclude with :&lt;/p&gt;

&lt;p&gt;From this task, I understood that constraints play an important role in maintaining correct and meaningful data. Each constraint serves a specific purpose, such as avoiding duplicates, preventing invalid values, and maintaining relationships between tables.&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>database</category>
      <category>postgres</category>
      <category>sql</category>
    </item>
    <item>
      <title>CREATING AN EC2 Instance and Running a Web Server</title>
      <dc:creator>Abinaya Dhanraj</dc:creator>
      <pubDate>Wed, 25 Mar 2026 14:08:30 +0000</pubDate>
      <link>https://dev.to/abinaya_dhanraj/creating-an-ec2-instance-and-running-a-web-server-28ld</link>
      <guid>https://dev.to/abinaya_dhanraj/creating-an-ec2-instance-and-running-a-web-server-28ld</guid>
      <description>&lt;p&gt;Title: Creating an EC2 Instance and Running a Web Server&lt;/p&gt;

&lt;p&gt;In this task, I created a virtual server using Amazon Web Services and hosted a simple web server so I can access it from outside.&lt;/p&gt;

&lt;p&gt;I used Amazon EC2 for this.&lt;/p&gt;

&lt;p&gt;What is EC2&lt;/p&gt;

&lt;p&gt;EC2 stands for Elastic Compute Cloud. It allows us to create virtual machines in the cloud and run applications on them.&lt;/p&gt;

&lt;p&gt;Step 1: Launch EC2 instance&lt;/p&gt;

&lt;p&gt;First, I logged into AWS console.&lt;/p&gt;

&lt;p&gt;Then I went to EC2 service and clicked Launch Instance.&lt;/p&gt;

&lt;p&gt;I entered the following details&lt;/p&gt;

&lt;p&gt;Instance name as my-server&lt;br&gt;
Selected Amazon Linux image&lt;br&gt;
Instance type as t2.micro&lt;br&gt;
Created a new key pair for login&lt;/p&gt;

&lt;p&gt;Step 2: Configure network&lt;/p&gt;

&lt;p&gt;I allowed HTTP traffic so that I can access the web server from browser.&lt;/p&gt;

&lt;p&gt;In security group settings, I added&lt;/p&gt;

&lt;p&gt;Type HTTP&lt;br&gt;
Port 80&lt;br&gt;
Source Anywhere&lt;/p&gt;

&lt;p&gt;This step is important, otherwise the site will not open.&lt;/p&gt;

&lt;p&gt;Step 3: Launch instance&lt;/p&gt;

&lt;p&gt;After configuring everything, I launched the instance.&lt;/p&gt;

&lt;p&gt;Then I waited until the instance state became running.&lt;/p&gt;

&lt;p&gt;Step 4: Connect to instance&lt;/p&gt;

&lt;p&gt;I connected to the instance using SSH.&lt;/p&gt;

&lt;p&gt;Using terminal, I used the key pair file to login.&lt;/p&gt;

&lt;p&gt;Step 5: Install web server&lt;/p&gt;

&lt;p&gt;After connecting, I installed a web server.&lt;/p&gt;

&lt;p&gt;Command&lt;br&gt;
sudo yum install httpd -y&lt;/p&gt;

&lt;p&gt;Then I started the service&lt;/p&gt;

&lt;p&gt;sudo systemctl start httpd&lt;/p&gt;

&lt;p&gt;Also enabled it&lt;/p&gt;

&lt;p&gt;sudo systemctl enable httpd&lt;/p&gt;

&lt;p&gt;Step 6: Add simple webpage&lt;/p&gt;

&lt;p&gt;I created a simple HTML file.&lt;/p&gt;

&lt;p&gt;Command&lt;br&gt;
echo Hello this is my first server &amp;gt; /var/www/html/index.html&lt;/p&gt;

&lt;p&gt;Step 7: Access from browser&lt;/p&gt;

&lt;p&gt;Now I copied the public IP of the instance.&lt;/p&gt;

&lt;p&gt;In browser, I entered the IP.&lt;/p&gt;

&lt;p&gt;The webpage opened and showed my message.&lt;/p&gt;

&lt;p&gt;What I understood&lt;/p&gt;

&lt;p&gt;EC2 allows us to create servers easily.&lt;/p&gt;

&lt;p&gt;Security group controls access like a firewall.&lt;/p&gt;

&lt;p&gt;Web server like httpd is used to serve webpages.&lt;/p&gt;

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

&lt;p&gt;By using EC2, I was able to create a server, run a web application, and access it from outside using a public IP. This is the basic idea behind hosting websites in the cloud.&lt;/p&gt;

</description>
      <category>aws</category>
      <category>beginners</category>
      <category>cloud</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Understanding IP Address and Subnet</title>
      <dc:creator>Abinaya Dhanraj</dc:creator>
      <pubDate>Wed, 25 Mar 2026 14:05:02 +0000</pubDate>
      <link>https://dev.to/abinaya_dhanraj/understanding-ip-address-and-subnet-3o51</link>
      <guid>https://dev.to/abinaya_dhanraj/understanding-ip-address-and-subnet-3o51</guid>
      <description>&lt;p&gt;Title: Understanding IP Address and Subnet in Simple Terms&lt;/p&gt;

&lt;p&gt;In this blog, I am explaining what an IP address is and what subnet means, in a simple way based on what I understood.&lt;/p&gt;

&lt;p&gt;What is an IP address&lt;/p&gt;

&lt;p&gt;An IP address is a unique number given to every device connected to a network. It is used to identify and communicate between devices.&lt;/p&gt;

&lt;p&gt;Just like how a house has an address, every system on the internet has an IP address.&lt;/p&gt;

&lt;p&gt;Example of an IP address&lt;br&gt;
192.168.1.1&lt;/p&gt;

&lt;p&gt;This is called IPv4 format.&lt;/p&gt;

&lt;p&gt;Types of IP address&lt;/p&gt;

&lt;p&gt;There are mainly two types&lt;/p&gt;

&lt;p&gt;Public IP address&lt;br&gt;
This is used on the internet and is unique globally&lt;/p&gt;

&lt;p&gt;Private IP address&lt;br&gt;
This is used inside local networks like home or office&lt;/p&gt;

&lt;p&gt;Example of private IP&lt;br&gt;
192.168.x.x&lt;br&gt;
10.x.x.x&lt;/p&gt;

&lt;p&gt;Structure of IP address&lt;/p&gt;

&lt;p&gt;An IPv4 address has 4 parts separated by dots.&lt;/p&gt;

&lt;p&gt;Example&lt;br&gt;
192.168.1.10&lt;/p&gt;

&lt;p&gt;Each part can have values from 0 to 255.&lt;/p&gt;

&lt;p&gt;What is subnet&lt;/p&gt;

&lt;p&gt;Subnet means dividing a large network into smaller networks.&lt;/p&gt;

&lt;p&gt;Instead of managing one big network, we split it into smaller parts for better control and performance.&lt;/p&gt;

&lt;p&gt;Why subnet is used&lt;/p&gt;

&lt;p&gt;To reduce network traffic&lt;br&gt;
To improve security&lt;br&gt;
To organize networks properly&lt;/p&gt;

&lt;p&gt;Subnet mask&lt;/p&gt;

&lt;p&gt;Subnet mask is used to identify which part of the IP address is network and which part is host.&lt;/p&gt;

&lt;p&gt;Example&lt;br&gt;
IP address: 192.168.1.10&lt;br&gt;
Subnet mask: 255.255.255.0&lt;/p&gt;

&lt;p&gt;Here&lt;br&gt;
192.168.1 is network part&lt;br&gt;
10 is host part&lt;/p&gt;

&lt;p&gt;CIDR notation&lt;/p&gt;

&lt;p&gt;Subnet can also be written using CIDR format.&lt;/p&gt;

&lt;p&gt;Example&lt;br&gt;
192.168.1.0/24&lt;/p&gt;

&lt;p&gt;Here /24 means first 24 bits are for network.&lt;/p&gt;

&lt;p&gt;Example of subnetting&lt;/p&gt;

&lt;p&gt;If I have a network 192.168.1.0/24, it has 256 IP addresses.&lt;/p&gt;

&lt;p&gt;Range&lt;br&gt;
192.168.1.0 to 192.168.1.255&lt;/p&gt;

&lt;p&gt;Now I can split this into smaller subnets like&lt;/p&gt;

&lt;p&gt;192.168.1.0/25&lt;br&gt;
192.168.1.128/25&lt;/p&gt;

&lt;p&gt;Each subnet will have fewer IPs.&lt;/p&gt;

&lt;p&gt;What I understood&lt;/p&gt;

&lt;p&gt;IP address is used to identify devices in a network.&lt;/p&gt;

&lt;p&gt;Subnet helps in dividing networks into smaller manageable parts.&lt;/p&gt;

&lt;p&gt;Both are important for networking and cloud services.&lt;/p&gt;

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

&lt;p&gt;IP address and subnet are basic concepts in networking. Understanding them helps in working with systems, servers, and cloud platforms more effectively&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>learning</category>
      <category>networking</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Setting up a DNS Hosted Zone in Amazon Route 53</title>
      <dc:creator>Abinaya Dhanraj</dc:creator>
      <pubDate>Wed, 25 Mar 2026 14:00:50 +0000</pubDate>
      <link>https://dev.to/abinaya_dhanraj/setting-up-a-dns-hosted-zone-in-amazon-route-53-4aap</link>
      <guid>https://dev.to/abinaya_dhanraj/setting-up-a-dns-hosted-zone-in-amazon-route-53-4aap</guid>
      <description>&lt;p&gt;Title: Setting up a DNS Hosted Zone in Amazon Route 53&lt;/p&gt;

&lt;p&gt;In this task, I am setting up a hosted zone in Amazon Web Services using Amazon Route 53. This helps in managing DNS records for a domain.&lt;/p&gt;

&lt;p&gt;What is a hosted zone&lt;/p&gt;

&lt;p&gt;A hosted zone is a container for DNS records. It stores information about how domain names are mapped to IP addresses.&lt;/p&gt;

&lt;p&gt;There are two types&lt;br&gt;
Public hosted zone for internet access&lt;br&gt;
Private hosted zone for internal use inside a VPC&lt;/p&gt;

&lt;p&gt;Here I am creating a public hosted zone.&lt;/p&gt;

&lt;p&gt;Step 1: Login to AWS&lt;/p&gt;

&lt;p&gt;First, I logged into the AWS Management Console.&lt;/p&gt;

&lt;p&gt;Then I searched for Route 53 in the services section.&lt;/p&gt;

&lt;p&gt;Step 2: Open Hosted Zones&lt;/p&gt;

&lt;p&gt;Inside Route 53, I selected Hosted Zones.&lt;/p&gt;

&lt;p&gt;Then I clicked on Create Hosted Zone.&lt;/p&gt;

&lt;p&gt;Step 3: Enter domain details&lt;/p&gt;

&lt;p&gt;I entered my domain name like example.com.&lt;/p&gt;

&lt;p&gt;Then I selected Public Hosted Zone.&lt;/p&gt;

&lt;p&gt;After that, I clicked Create Hosted Zone.&lt;/p&gt;

&lt;p&gt;Step 4: Hosted zone created&lt;/p&gt;

&lt;p&gt;Now AWS created the hosted zone.&lt;/p&gt;

&lt;p&gt;Inside it, I can see default records like&lt;/p&gt;

&lt;p&gt;NS record&lt;br&gt;
SOA record&lt;/p&gt;

&lt;p&gt;These are automatically created by AWS.&lt;/p&gt;

&lt;p&gt;NS record contains name servers provided by AWS.&lt;br&gt;
SOA record contains domain authority details.&lt;/p&gt;

&lt;p&gt;Step 5: Add DNS record&lt;/p&gt;

&lt;p&gt;Now I added a new record.&lt;/p&gt;

&lt;p&gt;I clicked Create Record.&lt;/p&gt;

&lt;p&gt;Then I entered&lt;/p&gt;

&lt;p&gt;Record name like www&lt;br&gt;
Record type as A&lt;br&gt;
Value as IP address of my server&lt;/p&gt;

&lt;p&gt;Then I saved the record.&lt;/p&gt;

&lt;p&gt;Step 6: Update name servers&lt;/p&gt;

&lt;p&gt;To make this work, I copied the NS records from Route 53.&lt;/p&gt;

&lt;p&gt;Then I went to my domain registrar and replaced the existing name servers with these AWS name servers.&lt;/p&gt;

&lt;p&gt;This step connects my domain to Route 53.&lt;/p&gt;

&lt;p&gt;Step 7: Testing&lt;/p&gt;

&lt;p&gt;After some time, I tested the domain in browser.&lt;/p&gt;

&lt;p&gt;Now the domain is resolving to the IP address I configured.&lt;/p&gt;

&lt;p&gt;What I understood&lt;/p&gt;

&lt;p&gt;Route 53 helps in mapping domain names to IP addresses.&lt;/p&gt;

&lt;p&gt;Hosted zone is where all DNS records are stored.&lt;/p&gt;

&lt;p&gt;NS records are important to connect domain with AWS.&lt;/p&gt;

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

&lt;p&gt;Setting up a hosted zone in Route 53 is simple and important for managing DNS. It allows us to control how users reach our application using domain names instead of IP addresses.&lt;/p&gt;

</description>
      <category>aws</category>
      <category>beginners</category>
      <category>networking</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>How a Request Travels from Client to Server</title>
      <dc:creator>Abinaya Dhanraj</dc:creator>
      <pubDate>Wed, 25 Mar 2026 13:57:57 +0000</pubDate>
      <link>https://dev.to/abinaya_dhanraj/how-a-request-travels-from-client-to-server-1kek</link>
      <guid>https://dev.to/abinaya_dhanraj/how-a-request-travels-from-client-to-server-1kek</guid>
      <description>&lt;p&gt;Title: How a Request Travels from Client to Server&lt;/p&gt;

&lt;p&gt;Whenever I open a website or click something in an app, a request is sent from my device to a server. This happens very fast, but there are multiple steps involved. In this blog, I am explaining how a request starts from the client and finally reaches the server.&lt;/p&gt;

&lt;p&gt;What is a client and server&lt;/p&gt;

&lt;p&gt;Client means the user side, like my mobile, laptop, or browser.&lt;br&gt;
Server is a system that stores data and responds to requests.&lt;/p&gt;

&lt;p&gt;Step 1: User action&lt;/p&gt;

&lt;p&gt;The process starts when I do some action like typing a URL in the browser or clicking a button.&lt;/p&gt;

&lt;p&gt;Example: I type amazon.com in the browser.&lt;/p&gt;

&lt;p&gt;Step 2: DNS resolution&lt;/p&gt;

&lt;p&gt;The browser cannot understand amazon.com directly. It needs an IP address. So it asks the DNS system to convert the domain name into an IP address.&lt;/p&gt;

&lt;p&gt;After this step, the browser gets something like 54.x.x.x.&lt;/p&gt;

&lt;p&gt;Step 3: Creating the request&lt;/p&gt;

&lt;p&gt;Now the browser prepares an HTTP request.&lt;/p&gt;

&lt;p&gt;This request contains method like GET or POST ,URL, headers&lt;br&gt;
sometimes body data&lt;/p&gt;

&lt;p&gt;Example: If I just open a website, it sends a GET request.&lt;/p&gt;

&lt;p&gt;Step 4: TCP connection&lt;/p&gt;

&lt;p&gt;Before sending the request, a connection must be established with the server.&lt;/p&gt;

&lt;p&gt;This is done using TCP handshake.&lt;/p&gt;

&lt;p&gt;Client sends SYN&lt;br&gt;
Server replies with SYN-ACK&lt;br&gt;
Client sends ACK&lt;/p&gt;

&lt;p&gt;Now the connection is established.&lt;/p&gt;

&lt;p&gt;Step 5: Sending the request&lt;/p&gt;

&lt;p&gt;After connection is ready, the HTTP request is sent through the network.The request travels through routers and different networks on the internet.&lt;/p&gt;

&lt;p&gt;Step 6: Reaching the server&lt;/p&gt;

&lt;p&gt;The request finally reaches the server using the IP address.&lt;/p&gt;

&lt;p&gt;The server receives the request and processes it.&lt;/p&gt;

&lt;p&gt;It may fetch data from database run some logic prepare a response&lt;/p&gt;

&lt;p&gt;Step 7: Server sends response&lt;/p&gt;

&lt;p&gt;After processing, the server sends back an HTTP response.&lt;/p&gt;

&lt;p&gt;This response contains status code like 200, 404 headers response body like HTML or JSON&lt;/p&gt;

&lt;p&gt;Step 8: Client receives response&lt;/p&gt;

&lt;p&gt;The browser receives the response.&lt;/p&gt;

&lt;p&gt;If it is a webpage, it renders the HTML and shows it on the screen.&lt;/p&gt;

&lt;p&gt;If it is API data, it processes it accordingly.&lt;/p&gt;

&lt;p&gt;Step 9: Connection close or reuse&lt;/p&gt;

&lt;p&gt;After response, the connection may be closed or reused for further requests.&lt;/p&gt;

&lt;p&gt;What I understood&lt;/p&gt;

&lt;p&gt;A simple click or typing a URL involves many steps like DNS lookup, connection setup, request sending, and response receiving.Even though it looks simple, many systems work together to make it happen.&lt;/p&gt;

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

&lt;p&gt;The journey from client to server is an important concept in networking. Understanding this helps in learning web development, APIs, and system design in a better way.&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>networking</category>
      <category>tutorial</category>
      <category>webdev</category>
    </item>
    <item>
      <title>DNS</title>
      <dc:creator>Abinaya Dhanraj</dc:creator>
      <pubDate>Wed, 25 Mar 2026 13:52:21 +0000</pubDate>
      <link>https://dev.to/abinaya_dhanraj/dns-1c94</link>
      <guid>https://dev.to/abinaya_dhanraj/dns-1c94</guid>
      <description>&lt;p&gt;Title: How DNS Resolver Works in Simple Steps&lt;/p&gt;

&lt;p&gt;Whenever we open a website like google.com, we don’t actually know its IP address. But computers need IP addresses to communicate. So there is a process that happens behind the scenes to convert the domain name into an IP address. This process is called DNS resolution.&lt;/p&gt;

&lt;p&gt;First, what is DNS&lt;/p&gt;

&lt;p&gt;DNS stands for Domain Name System. It works like a phonebook of the internet. Instead of remembering numbers like 142.250.190.78, we just use names like google.com.&lt;/p&gt;

&lt;p&gt;Now I will explain step by step what happens when I type a website in the browser&lt;/p&gt;

&lt;p&gt;Step 1: Request from browser&lt;/p&gt;

&lt;p&gt;When I type google.com in the browser, the browser first checks if it already knows the IP address.&lt;/p&gt;

&lt;p&gt;It looks in browser cache. If found, it uses that directly.&lt;/p&gt;

&lt;p&gt;If not found, it goes to the next step.&lt;/p&gt;

&lt;p&gt;Step 2: OS cache check&lt;/p&gt;

&lt;p&gt;The request goes to the operating system. It also checks its own cache.&lt;/p&gt;

&lt;p&gt;If the IP is already stored, it returns it.&lt;/p&gt;

&lt;p&gt;If not, then it goes to DNS resolver.&lt;/p&gt;

&lt;p&gt;Step 3: DNS Resolver&lt;/p&gt;

&lt;p&gt;DNS resolver is usually provided by the internet service provider.&lt;/p&gt;

&lt;p&gt;Its job is to find the IP address for the domain.&lt;/p&gt;

&lt;p&gt;If it already has the answer cached, it returns immediately.&lt;/p&gt;

&lt;p&gt;If not, it starts asking other DNS servers.&lt;/p&gt;

&lt;p&gt;Step 4: Root server&lt;/p&gt;

&lt;p&gt;The resolver first contacts the root DNS server.&lt;/p&gt;

&lt;p&gt;Root server does not know the exact IP, but it knows where to find the next level.&lt;/p&gt;

&lt;p&gt;It tells the resolver to go to the TLD server.&lt;/p&gt;

&lt;p&gt;Step 5: TLD server&lt;/p&gt;

&lt;p&gt;TLD means Top Level Domain like .com, .org.&lt;/p&gt;

&lt;p&gt;The resolver asks the .com server for google.com.&lt;/p&gt;

&lt;p&gt;The TLD server responds with the address of the authoritative name server.&lt;/p&gt;

&lt;p&gt;Step 6: Authoritative server&lt;/p&gt;

&lt;p&gt;Now the resolver contacts the authoritative DNS server.&lt;/p&gt;

&lt;p&gt;This server has the actual IP address of google.com.&lt;/p&gt;

&lt;p&gt;It returns the IP address.&lt;/p&gt;

&lt;p&gt;Step 7: Response back&lt;/p&gt;

&lt;p&gt;The resolver sends this IP address back to the browser.&lt;/p&gt;

&lt;p&gt;The browser now uses this IP to connect to the actual web server.&lt;/p&gt;

&lt;p&gt;Step 8: Website loads&lt;/p&gt;

&lt;p&gt;Finally, the browser sends HTTP request to that IP and the website loads.&lt;/p&gt;

&lt;p&gt;Caching&lt;/p&gt;

&lt;p&gt;At every step, caching is used.&lt;/p&gt;

&lt;p&gt;Browser cache&lt;br&gt;
OS cache&lt;br&gt;
DNS resolver cache&lt;/p&gt;

&lt;p&gt;This makes future requests faster.&lt;/p&gt;

&lt;p&gt;What I understood&lt;/p&gt;

&lt;p&gt;DNS resolver acts like a middle person. It does not always know the answer, but it knows how to find it step by step.&lt;/p&gt;

&lt;p&gt;This process happens very fast, usually in milliseconds, so we don’t notice it.&lt;/p&gt;

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

&lt;p&gt;DNS resolution is an important part of how the internet works. Without it, we would have to remember IP addresses for every website. It makes the internet easy to use by converting names into IP addresses automatically&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>networking</category>
      <category>tutorial</category>
      <category>webdev</category>
    </item>
    <item>
      <title>ATOMICITY</title>
      <dc:creator>Abinaya Dhanraj</dc:creator>
      <pubDate>Wed, 25 Mar 2026 13:48:16 +0000</pubDate>
      <link>https://dev.to/abinaya_dhanraj/atomicity-159m</link>
      <guid>https://dev.to/abinaya_dhanraj/atomicity-159m</guid>
      <description>&lt;p&gt;In this task I am checking atomicity. That means a transaction should either fully complete or not happen at all.&lt;/p&gt;

&lt;p&gt;First I check the initial data.&lt;/p&gt;

&lt;p&gt;Query&lt;br&gt;
select * from accounts;&lt;/p&gt;

&lt;p&gt;Here I see Alice has 1000 and Bob has 500.&lt;/p&gt;

&lt;p&gt;Now I perform a correct transfer.&lt;/p&gt;

&lt;p&gt;Query&lt;br&gt;
begin;&lt;/p&gt;

&lt;p&gt;update accounts&lt;br&gt;
set balance = balance - 300&lt;br&gt;
where name = 'Alice';&lt;/p&gt;

&lt;p&gt;update accounts&lt;br&gt;
set balance = balance + 300&lt;br&gt;
where name = 'Bob';&lt;/p&gt;

&lt;p&gt;commit;&lt;/p&gt;

&lt;p&gt;Here I deducted 300 from Alice and added 300 to Bob in the same transaction.&lt;/p&gt;

&lt;p&gt;Now I check the data.&lt;/p&gt;

&lt;p&gt;Query&lt;br&gt;
select * from accounts;&lt;/p&gt;

&lt;p&gt;Now Alice has 700 and Bob has 800. So both operations happened successfully.&lt;/p&gt;

&lt;p&gt;Now I test what happens if something goes wrong after deducting money.&lt;/p&gt;

&lt;p&gt;Query&lt;br&gt;
begin;&lt;/p&gt;

&lt;p&gt;update accounts&lt;br&gt;
set balance = balance - 200&lt;br&gt;
where name = 'Alice';&lt;/p&gt;

&lt;p&gt;Now I introduce an error. I write a wrong column name.&lt;/p&gt;

&lt;p&gt;update accounts&lt;br&gt;
set bal = balance + 200&lt;br&gt;
where name = 'Bob';&lt;/p&gt;

&lt;p&gt;commit;&lt;/p&gt;

&lt;p&gt;Here the second query fails because column bal does not exist.&lt;/p&gt;

&lt;p&gt;Now I check the data again.&lt;/p&gt;

&lt;p&gt;Query&lt;br&gt;
select * from accounts;&lt;/p&gt;

&lt;p&gt;I can see that Alice balance is still 700 and not reduced to 500.&lt;/p&gt;

&lt;p&gt;This means even though the first update worked, it was not saved because the transaction failed.&lt;/p&gt;

&lt;p&gt;The database automatically rolled back everything.&lt;/p&gt;

&lt;p&gt;Now I try another case where I manually rollback.&lt;/p&gt;

&lt;p&gt;Query&lt;br&gt;
begin;&lt;/p&gt;

&lt;p&gt;update accounts&lt;br&gt;
set balance = balance - 100&lt;br&gt;
where name = 'Alice';&lt;/p&gt;

&lt;p&gt;rollback;&lt;/p&gt;

&lt;p&gt;Now I check again.&lt;/p&gt;

&lt;p&gt;Query&lt;br&gt;
select * from accounts;&lt;/p&gt;

&lt;p&gt;Alice balance is still 700. So rollback cancelled the change.&lt;/p&gt;

&lt;p&gt;From this I understand atomicity clearly.&lt;/p&gt;

&lt;p&gt;If all queries succeed and commit is given, changes are saved.&lt;br&gt;
If any query fails, the entire transaction is cancelled.&lt;br&gt;
No partial update will happen.&lt;/p&gt;

&lt;p&gt;So in a wallet system, this is very important.&lt;/p&gt;

&lt;p&gt;If money is deducted but not added to the receiver, it will cause loss.&lt;br&gt;
Atomicity makes sure both actions happen together or not at all.&lt;/p&gt;

&lt;p&gt;Finally what I understood is&lt;/p&gt;

&lt;p&gt;Transaction works like one unit&lt;br&gt;
Either everything inside it is saved&lt;br&gt;
Or nothing is saved&lt;/p&gt;

&lt;p&gt;This ensures safe money transfer without inconsistency.&lt;/p&gt;

</description>
      <category>computerscience</category>
      <category>database</category>
      <category>sql</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>DURABILITY</title>
      <dc:creator>Abinaya Dhanraj</dc:creator>
      <pubDate>Wed, 25 Mar 2026 13:42:23 +0000</pubDate>
      <link>https://dev.to/abinaya_dhanraj/durability-556e</link>
      <guid>https://dev.to/abinaya_dhanraj/durability-556e</guid>
      <description>&lt;p&gt;For this task, I am trying to understand durability. That means once a transaction is committed, the data should not be lost even if the system crashes.&lt;/p&gt;

&lt;p&gt;First I check the current data in the table.&lt;/p&gt;

&lt;p&gt;Query&lt;br&gt;
select * from accounts;&lt;/p&gt;

&lt;p&gt;Here I can see Alice has 1000 and Bob has 500.&lt;/p&gt;

&lt;p&gt;Now I perform a money transfer from Alice to Bob.&lt;/p&gt;

&lt;p&gt;Query&lt;br&gt;
begin;&lt;/p&gt;

&lt;p&gt;update accounts&lt;br&gt;
set balance = balance - 200&lt;br&gt;
where name = 'Alice';&lt;/p&gt;

&lt;p&gt;update accounts&lt;br&gt;
set balance = balance + 200&lt;br&gt;
where name = 'Bob';&lt;/p&gt;

&lt;p&gt;commit;&lt;/p&gt;

&lt;p&gt;Here I started a transaction, deducted 200 from Alice and added 200 to Bob, and then committed it.&lt;/p&gt;

&lt;p&gt;After commit, the changes are saved permanently.&lt;/p&gt;

&lt;p&gt;Now I check the data again.&lt;/p&gt;

&lt;p&gt;Query&lt;br&gt;
select * from accounts;&lt;/p&gt;

&lt;p&gt;Now I can see Alice has 800 and Bob has 700. This confirms that the transaction is successful.&lt;/p&gt;

&lt;p&gt;Next step is to simulate a system crash or restart. In real scenario, this means database stops and starts again.&lt;/p&gt;

&lt;p&gt;After reconnecting, I again run the same select query.&lt;/p&gt;

&lt;p&gt;Query&lt;br&gt;
select * from accounts;&lt;/p&gt;

&lt;p&gt;I can still see Alice has 800 and Bob has 700.&lt;/p&gt;

&lt;p&gt;So even after restart, the data is not lost.&lt;/p&gt;

&lt;p&gt;From this I understand that once commit is done, the database permanently stores the data.&lt;/p&gt;

&lt;p&gt;This is called durability.&lt;/p&gt;

&lt;p&gt;Now I think about two situations.&lt;/p&gt;

&lt;p&gt;If failure happens before commit&lt;br&gt;
In this case, transaction is not completed. So PostgreSQL will rollback the changes automatically. Data will remain same as before.&lt;/p&gt;

&lt;p&gt;If failure happens after commit&lt;br&gt;
In this case, even if system crashes, the committed data will not be lost. When database restarts, it will restore the committed changes.&lt;/p&gt;

&lt;p&gt;This is possible because PostgreSQL stores changes in logs internally before confirming commit. So even if crash happens, it can recover the data.&lt;/p&gt;

&lt;p&gt;So finally what I understood is&lt;/p&gt;

&lt;p&gt;Once commit is executed, the data is safe and will not be lost.&lt;br&gt;
If commit is not done, changes will not be saved.&lt;/p&gt;

&lt;p&gt;This ensures durability in the system and avoids data loss in applications like payment systems.&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>database</category>
      <category>sql</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>IDEMPOTENCY</title>
      <dc:creator>Abinaya Dhanraj</dc:creator>
      <pubDate>Wed, 25 Mar 2026 13:38:06 +0000</pubDate>
      <link>https://dev.to/abinaya_dhanraj/idempotency-3cm8</link>
      <guid>https://dev.to/abinaya_dhanraj/idempotency-3cm8</guid>
      <description>&lt;p&gt;For this task, I am trying to understand what happens when the same transaction runs more than one time. In real systems, this can happen if the network is slow or the request is sent again.&lt;/p&gt;

&lt;p&gt;First I check the current balance in the accounts table.&lt;/p&gt;

&lt;p&gt;Query&lt;br&gt;
select star from accounts;&lt;/p&gt;

&lt;p&gt;Here I am just viewing the data. For example, Alice has 1000 and Bob has 500.&lt;/p&gt;

&lt;p&gt;Now I try to do a money transfer from Alice to Bob.&lt;/p&gt;

&lt;p&gt;Query&lt;br&gt;
begin;&lt;/p&gt;

&lt;p&gt;update accounts&lt;br&gt;
set balance = balance - 300&lt;br&gt;
where name = 'Alice';&lt;/p&gt;

&lt;p&gt;update accounts&lt;br&gt;
set balance = balance + 300&lt;br&gt;
where name = 'Bob';&lt;/p&gt;

&lt;p&gt;commit;&lt;/p&gt;

&lt;p&gt;Here what I am doing is deducting 300 from Alice and adding it to Bob. After commit, the transaction is saved.&lt;/p&gt;

&lt;p&gt;Now Alice will have 700 and Bob will have 800.&lt;/p&gt;

&lt;p&gt;Now I repeat the same transaction again.&lt;/p&gt;

&lt;p&gt;Query&lt;br&gt;
begin;&lt;/p&gt;

&lt;p&gt;update accounts&lt;br&gt;
set balance = balance - 300&lt;br&gt;
where name = 'Alice';&lt;/p&gt;

&lt;p&gt;update accounts&lt;br&gt;
set balance = balance + 300&lt;br&gt;
where name = 'Bob';&lt;/p&gt;

&lt;p&gt;commit;&lt;/p&gt;

&lt;p&gt;Here I am running the same transfer again. The database does not stop me. So again 300 is deducted from Alice and added to Bob.&lt;/p&gt;

&lt;p&gt;Now Alice becomes 400 and Bob becomes 1100.&lt;/p&gt;

&lt;p&gt;From this, I understand that the system is allowing the same transaction to happen multiple times. It is not checking whether this transfer was already done before.&lt;/p&gt;

&lt;p&gt;This means the operation is not idempotent. Because running it again changes the result again.&lt;/p&gt;

&lt;p&gt;Now I try one more case where balance can go negative.&lt;/p&gt;

&lt;p&gt;Query&lt;br&gt;
begin;&lt;/p&gt;

&lt;p&gt;update accounts&lt;br&gt;
set balance = balance - 2000&lt;br&gt;
where name = 'Alice';&lt;/p&gt;

&lt;p&gt;commit;&lt;/p&gt;

&lt;p&gt;Here I am trying to deduct more than available balance. Since there is a check constraint balance greater than or equal to zero, PostgreSQL will throw an error and will not allow this update.&lt;/p&gt;

&lt;p&gt;So I understand that this rule is enforced by the database itself.&lt;/p&gt;

&lt;p&gt;But duplicate transaction is not prevented by database. That should be handled by application logic.&lt;/p&gt;

&lt;p&gt;In real systems, they use something called transaction id. Each request will have a unique id. Before processing, system will check if that id is already used. If yes, it will not process again.&lt;/p&gt;

&lt;p&gt;So finally what I understood is&lt;/p&gt;

&lt;p&gt;Database handles rules like balance should not be negative using constraints.&lt;/p&gt;

&lt;p&gt;But problems like duplicate transactions must be handled by the application or transaction design.&lt;/p&gt;

</description>
      <category>backend</category>
      <category>database</category>
      <category>sql</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>CONSISTENCY</title>
      <dc:creator>Abinaya Dhanraj</dc:creator>
      <pubDate>Wed, 25 Mar 2026 13:29:12 +0000</pubDate>
      <link>https://dev.to/abinaya_dhanraj/consistency-2j5</link>
      <guid>https://dev.to/abinaya_dhanraj/consistency-2j5</guid>
      <description>&lt;p&gt;Step 1: Check initial data&lt;br&gt;
SELECT * FROM accounts;&lt;/p&gt;

&lt;p&gt;Explanation:&lt;br&gt;
Alice has 1000 and Bob has 500.&lt;br&gt;
Both balances are valid (not negative).&lt;/p&gt;

&lt;p&gt;Step 2: Try to make balance negative directly&lt;br&gt;
UPDATE accounts&lt;br&gt;
SET balance = -100&lt;br&gt;
WHERE name = 'Alice';&lt;/p&gt;

&lt;p&gt;Explanation:&lt;br&gt;
Here I am directly trying to set a negative balance.&lt;/p&gt;

&lt;p&gt;What happens:&lt;br&gt;
Query fails&lt;/p&gt;

&lt;p&gt;Reason:&lt;br&gt;
There is a constraint CHECK (balance &amp;gt;= 0)&lt;/p&gt;

&lt;p&gt;So database itself prevents invalid data.&lt;/p&gt;

&lt;p&gt;Step 3: Deduct more than available balance&lt;br&gt;
UPDATE accounts&lt;br&gt;
SET balance = balance - 1500&lt;br&gt;
WHERE name = 'Alice';&lt;/p&gt;

&lt;p&gt;Explanation:&lt;br&gt;
Alice has only 1000 but I tried to deduct 1500.&lt;/p&gt;

&lt;p&gt;What happens:&lt;br&gt;
Query fails&lt;/p&gt;

&lt;p&gt;Reason:&lt;br&gt;
Result becomes negative, so CHECK constraint blocks it&lt;/p&gt;

&lt;p&gt;Step 4: Valid deduction&lt;br&gt;
UPDATE accounts&lt;br&gt;
SET balance = balance - 500&lt;br&gt;
WHERE name = 'Alice';&lt;/p&gt;

&lt;p&gt;Explanation:&lt;br&gt;
This works because balance remains positive.&lt;/p&gt;

&lt;p&gt;Step 5: Using transaction (important case)&lt;br&gt;
BEGIN;&lt;/p&gt;

&lt;p&gt;UPDATE accounts&lt;br&gt;
SET balance = balance - 1200&lt;br&gt;
WHERE name = 'Alice';&lt;/p&gt;

&lt;p&gt;COMMIT;&lt;/p&gt;

&lt;p&gt;Explanation:&lt;br&gt;
Here also it fails before commit.&lt;/p&gt;

&lt;p&gt;What happens:&lt;br&gt;
Transaction does not complete&lt;/p&gt;

&lt;p&gt;Reason:&lt;br&gt;
Constraint is checked during update&lt;/p&gt;

&lt;p&gt;Step 6: Application-level check (manual condition)&lt;br&gt;
UPDATE accounts&lt;br&gt;
SET balance = balance - 1200&lt;br&gt;
WHERE name = 'Alice'&lt;br&gt;
AND balance &amp;gt;= 1200;&lt;/p&gt;

&lt;p&gt;Explanation:&lt;br&gt;
Here I added a condition to avoid wrong deduction.&lt;/p&gt;

&lt;p&gt;What happens:&lt;br&gt;
No rows updated&lt;/p&gt;

&lt;p&gt;Reason:&lt;br&gt;
Condition fails, so query is safe&lt;/p&gt;

&lt;p&gt;Final Understanding&lt;br&gt;
Database constraint (CHECK balance &amp;gt;= 0) prevents invalid data&lt;br&gt;
It stops negative values automatically&lt;br&gt;
This is schema-level protection&lt;/p&gt;

&lt;p&gt;But,&lt;/p&gt;

&lt;p&gt;Checking enough balance before deduction should also be handled in query or application&lt;br&gt;
Otherwise transaction may fail&lt;/p&gt;

&lt;p&gt;I tested different updates and observed that database constraints prevent negative balances. I also understood that some validations should be handled in queries or application logic to avoid errors.&lt;/p&gt;

</description>
      <category>postgres</category>
      <category>beginners</category>
      <category>basic</category>
    </item>
    <item>
      <title>ISOLATION</title>
      <dc:creator>Abinaya Dhanraj</dc:creator>
      <pubDate>Wed, 25 Mar 2026 13:23:33 +0000</pubDate>
      <link>https://dev.to/abinaya_dhanraj/isolation-5hdh</link>
      <guid>https://dev.to/abinaya_dhanraj/isolation-5hdh</guid>
      <description>&lt;p&gt;Initial Check&lt;br&gt;
SELECT * FROM accounts;&lt;/p&gt;

&lt;p&gt;Explanation:&lt;br&gt;
I checked the initial data.&lt;br&gt;
Alice has 1000 and Bob has 500.&lt;/p&gt;

&lt;p&gt;Case 1: READ COMMITTED (default)&lt;br&gt;
Session 1&lt;br&gt;
BEGIN;&lt;/p&gt;

&lt;p&gt;UPDATE accounts&lt;br&gt;
SET balance = balance - 800&lt;br&gt;
WHERE name = 'Alice';&lt;/p&gt;

&lt;p&gt;Explanation:&lt;br&gt;
I started a transaction and deducted 800 from Alice.&lt;br&gt;
I did not commit, so this change is temporary.&lt;/p&gt;

&lt;p&gt;Session 2&lt;br&gt;
BEGIN;&lt;/p&gt;

&lt;p&gt;SELECT balance &lt;br&gt;
FROM accounts &lt;br&gt;
WHERE name = 'Alice';&lt;/p&gt;

&lt;p&gt;Explanation:&lt;br&gt;
I checked Alice’s balance in another session.&lt;br&gt;
It still shows 1000.&lt;/p&gt;

&lt;p&gt;What should happen:&lt;br&gt;
It should show old value&lt;/p&gt;

&lt;p&gt;What should not happen:&lt;br&gt;
It should not show updated value (200)&lt;/p&gt;

&lt;p&gt;Reason:&lt;br&gt;
Uncommitted data is not visible&lt;/p&gt;

&lt;p&gt;Session 2 tries update&lt;br&gt;
UPDATE accounts&lt;br&gt;
SET balance = balance - 500&lt;br&gt;
WHERE name = 'Alice';&lt;/p&gt;

&lt;p&gt;Explanation:&lt;br&gt;
This query does not run immediately. It waits.&lt;/p&gt;

&lt;p&gt;What should happen:&lt;br&gt;
It should wait&lt;/p&gt;

&lt;p&gt;What should not happen:&lt;br&gt;
It should not update instantly&lt;/p&gt;

&lt;p&gt;Reason:&lt;br&gt;
Row is locked by session 1&lt;/p&gt;

&lt;p&gt;Session 1 commit&lt;br&gt;
COMMIT;&lt;/p&gt;

&lt;p&gt;Explanation:&lt;br&gt;
Now the change becomes permanent.&lt;br&gt;
Session 2 will now continue.&lt;/p&gt;

&lt;p&gt;Session 2 commit&lt;br&gt;
COMMIT;&lt;/p&gt;

&lt;p&gt;Explanation:&lt;br&gt;
Second transaction also completes.&lt;/p&gt;

&lt;p&gt;Case 2: REPEATABLE READ&lt;br&gt;
Session 1&lt;br&gt;
BEGIN ISOLATION LEVEL REPEATABLE READ;&lt;/p&gt;

&lt;p&gt;UPDATE accounts&lt;br&gt;
SET balance = balance - 300&lt;br&gt;
WHERE name = 'Alice';&lt;br&gt;
Session 2&lt;br&gt;
BEGIN ISOLATION LEVEL REPEATABLE READ;&lt;/p&gt;

&lt;p&gt;SELECT balance &lt;br&gt;
FROM accounts &lt;br&gt;
WHERE name = 'Alice';&lt;/p&gt;

&lt;p&gt;Explanation:&lt;br&gt;
Session 2 reads the balance once.&lt;br&gt;
Even if session 1 commits later, this value does not change.&lt;/p&gt;

&lt;p&gt;What should happen:&lt;br&gt;
Same value should be seen inside transaction&lt;/p&gt;

&lt;p&gt;What should not happen:&lt;br&gt;
Value should not change in same transaction&lt;/p&gt;

&lt;p&gt;Reason:&lt;br&gt;
Data must remain consistent&lt;/p&gt;

&lt;p&gt;Case 3: SERIALIZABLE&lt;br&gt;
Session 1&lt;br&gt;
BEGIN ISOLATION LEVEL SERIALIZABLE;&lt;/p&gt;

&lt;p&gt;UPDATE accounts&lt;br&gt;
SET balance = balance - 200&lt;br&gt;
WHERE name = 'Alice';&lt;br&gt;
Session 2&lt;br&gt;
BEGIN ISOLATION LEVEL SERIALIZABLE;&lt;/p&gt;

&lt;p&gt;UPDATE accounts&lt;br&gt;
SET balance = balance - 200&lt;br&gt;
WHERE name = 'Alice';&lt;br&gt;
Commit&lt;br&gt;
COMMIT;&lt;/p&gt;

&lt;p&gt;Explanation:&lt;br&gt;
When both try to update same data, one may fail.&lt;/p&gt;

&lt;p&gt;What should happen:&lt;br&gt;
One transaction may give error&lt;/p&gt;

&lt;p&gt;What should not happen:&lt;br&gt;
Both should not succeed if it causes wrong balance&lt;/p&gt;

&lt;p&gt;Reason:&lt;br&gt;
Database avoids conflicts&lt;/p&gt;

&lt;p&gt;Final understanding&lt;/p&gt;

&lt;p&gt;In this experiment, I understood that transactions and isolation levels help to control concurrent operations.&lt;br&gt;
They prevent reading wrong data and avoid incorrect balance updates.&lt;br&gt;
This is important for systems like payment apps where accuracy is very important****&lt;/p&gt;

</description>
      <category>postgres</category>
      <category>beginners</category>
      <category>queries</category>
      <category>isolation</category>
    </item>
  </channel>
</rss>
