<?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: Saranya R</title>
    <description>The latest articles on DEV Community by Saranya R (@s_a_r_a).</description>
    <link>https://dev.to/s_a_r_a</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%2F3837375%2Fccdc9514-2cb4-41cf-81d2-aa0cca574571.jpeg</url>
      <title>DEV Community: Saranya R</title>
      <link>https://dev.to/s_a_r_a</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/s_a_r_a"/>
    <language>en</language>
    <item>
      <title>Alter Tables</title>
      <dc:creator>Saranya R</dc:creator>
      <pubDate>Sun, 29 Mar 2026 09:53:43 +0000</pubDate>
      <link>https://dev.to/s_a_r_a/alter-tables-408i</link>
      <guid>https://dev.to/s_a_r_a/alter-tables-408i</guid>
      <description>&lt;p&gt;1) You have a table customers with a column email that currently allows NULL values. Modify the table so that future entries must always have an email.&lt;/p&gt;

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

&lt;p&gt;2) In the users table, ensure that the username column is unique across all records using an ALTER statement.&lt;/p&gt;

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

&lt;p&gt;3) In the products table, enforce that price must always be greater than 0 using an ALTER command.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Answer:&lt;/strong&gt;&lt;br&gt;
ALTER TABLE products&lt;br&gt;
ADD CONSTRAINT price_check CHECK (price &amp;gt; 0);&lt;/p&gt;

&lt;p&gt;4) Modify the orders table so that the status column defaults to 'pending' if no value is provided during insertion.&lt;/p&gt;

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

&lt;p&gt;5) Alter the employees table by adding a new column salary such that&lt;/p&gt;

&lt;p&gt;It cannot be NULL&lt;/p&gt;

&lt;p&gt;It must always be greater than 10,000&lt;/p&gt;

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

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;add column:&lt;br&gt;
ALTER TABLE employees&lt;br&gt;
ADD COLUMN salary INT;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;applying conditions:&lt;br&gt;
ALTER TABLE employees&lt;br&gt;
ALTER COLUMN salary SET NOT NULL;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;ALTER TABLE employees&lt;br&gt;
ADD CONSTRAINT salary_check CHECK (salary &amp;gt; 10000);&lt;/p&gt;

&lt;p&gt;6) Modify the foreign key constraint between employees and departments so that when a department is deleted, all related employees are automatically removed.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Answer:&lt;/strong&gt;&lt;br&gt;
ALTER TABLE employees&lt;br&gt;
ADD CONSTRAINT employees_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;7) In the accounts table, remove an existing CHECK constraint that enforces balance &amp;gt;= 0.&lt;/p&gt;

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

&lt;p&gt;8) In the payments table, ensure that the combination of user_id and transaction_id is unique using an ALTER TABLE statement.&lt;/p&gt;

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

</description>
      <category>database</category>
      <category>postgres</category>
      <category>sql</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Create Tables</title>
      <dc:creator>Saranya R</dc:creator>
      <pubDate>Sun, 29 Mar 2026 09:43:42 +0000</pubDate>
      <link>https://dev.to/s_a_r_a/create-tables-19in</link>
      <guid>https://dev.to/s_a_r_a/create-tables-19in</guid>
      <description>&lt;p&gt;1) Create a table called students where each student has an id, name, and age. Ensure that the id uniquely identifies each student.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Answer:&lt;/strong&gt;&lt;br&gt;
CREATE TABLE students (&lt;br&gt;
  id SERIAL PRIMARY KEY,&lt;br&gt;
  name TEXT,&lt;br&gt;
  age INT&lt;br&gt;
);&lt;/p&gt;

&lt;p&gt;2) Create a table employees where name and email cannot be empty, but phone_number can be optional.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Answer:&lt;/strong&gt;&lt;br&gt;
CREATE TABLE employees (&lt;br&gt;
  id SERIAL PRIMARY KEY,&lt;br&gt;
  name TEXT NOT NULL,&lt;br&gt;
  email TEXT NOT NULL,&lt;br&gt;
  phone_number TEXT&lt;br&gt;
);&lt;/p&gt;

&lt;p&gt;3) Create a table users where both username and email must be unique across all records.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Answer:&lt;/strong&gt;&lt;br&gt;
CREATE TABLE users (&lt;br&gt;
  id SERIAL PRIMARY KEY,&lt;br&gt;
  username TEXT UNIQUE,&lt;br&gt;
  email TEXT UNIQUE&lt;br&gt;
);&lt;/p&gt;

&lt;p&gt;4) Create a table products where price must always be greater than 0 and stock cannot be negative.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Answer:&lt;/strong&gt;&lt;br&gt;
CREATE TABLE products (&lt;br&gt;
  id SERIAL PRIMARY KEY,&lt;br&gt;
  name TEXT,&lt;br&gt;
  price INT CHECK (price &amp;gt; 0),&lt;br&gt;
  stock INT CHECK (stock &amp;gt;= 0)&lt;br&gt;
);&lt;/p&gt;

&lt;p&gt;5) Create a table orders where status should default to 'pending' if no value is provided, and created_at should store the current timestamp automatically.&lt;/p&gt;

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

&lt;p&gt;6) Create a table accounts where&lt;br&gt;
account_number must be unique and not null&lt;br&gt;
balance must always be greater than or equal to 0&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Answer:&lt;/strong&gt;&lt;br&gt;
CREATE TABLE accounts (&lt;br&gt;
  id SERIAL PRIMARY KEY,&lt;br&gt;
  account_number TEXT UNIQUE NOT NULL,&lt;br&gt;
  balance INT CHECK (balance &amp;gt;= 0)&lt;br&gt;
);&lt;/p&gt;

&lt;p&gt;7) Create a table enrollments where a student can enroll in multiple courses, but the combination of student_id and course_id must be unique.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Answer:&lt;/strong&gt;&lt;br&gt;
CREATE TABLE enrollments (&lt;br&gt;
  student_id INT,&lt;br&gt;
  course_id INT,&lt;br&gt;
  PRIMARY KEY (student_id, course_id)&lt;br&gt;
);&lt;/p&gt;

&lt;p&gt;8) Create two tables:&lt;br&gt;
departments with id and name&lt;br&gt;
employees with id, name, and department_id&lt;br&gt;
Ensure that department_id in employees must exist in departments.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Answer:&lt;/strong&gt;&lt;br&gt;
Table 1:&lt;br&gt;
CREATE TABLE departments (&lt;br&gt;
  id SERIAL PRIMARY KEY,&lt;br&gt;
  name TEXT&lt;br&gt;
);&lt;/p&gt;

&lt;p&gt;Table 2:&lt;br&gt;
CREATE TABLE employees (&lt;br&gt;
  id SERIAL PRIMARY KEY,&lt;br&gt;
  name TEXT,&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;9) Modify the previous foreign key example so that:&lt;/p&gt;

&lt;p&gt;When a department is deleted, all related employees are also deleted&lt;/p&gt;

&lt;p&gt;When a department ID is updated, it reflects in the employees table&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Answer:&lt;/strong&gt;&lt;br&gt;
Table 1:&lt;br&gt;
CREATE TABLE departments (&lt;br&gt;
  id SERIAL PRIMARY KEY,&lt;br&gt;
  name TEXT&lt;br&gt;
);&lt;/p&gt;

&lt;p&gt;Table 2:&lt;br&gt;
CREATE TABLE employees (&lt;br&gt;
  id SERIAL PRIMARY KEY,&lt;br&gt;
  name TEXT,&lt;br&gt;
  department_id INT,&lt;br&gt;
  FOREIGN KEY (department_id)&lt;br&gt;
    REFERENCES departments(id)&lt;br&gt;
    ON DELETE CASCADE&lt;br&gt;
    ON UPDATE CASCADE&lt;br&gt;
);&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Design a Reliable Wallet Transfer System with ACID Guarantees pt - 4 (Durability)</title>
      <dc:creator>Saranya R</dc:creator>
      <pubDate>Sun, 29 Mar 2026 09:26:29 +0000</pubDate>
      <link>https://dev.to/s_a_r_a/design-a-reliable-wallet-transfer-system-with-acid-guarantees-pt-4-durability-1mhi</link>
      <guid>https://dev.to/s_a_r_a/design-a-reliable-wallet-transfer-system-with-acid-guarantees-pt-4-durability-1mhi</guid>
      <description>&lt;p&gt;&lt;strong&gt;Durability&lt;/strong&gt; – ensures that once a transaction is successfully committed, its changes are permanently stored in the database, even in case of system failures.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;the accounts table:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;CREATE TABLE accounts (&lt;br&gt;
  id SERIAL PRIMARY KEY,&lt;br&gt;
  name TEXT NOT NULL,&lt;br&gt;
  balance INT NOT NULL CHECK (balance &amp;gt;= 0),&lt;br&gt;
  last_updated TIMESTAMP DEFAULT CURRENT_TIMESTAMP&lt;br&gt;
);&lt;br&gt;
     the accounts table is created successfully&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Then the dummy data is added to the table&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;INSERT INTO accounts (name, balance) VALUES ('Alice', 1000), ('Bob', 500);&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Now the initial balance in both accounts are Alice = 1000 &amp;amp; Bob = 500&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;To test if durability works properly, perform a transaction and commit it&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;After COMMIT:&lt;br&gt;
Alice’s balance becomes 800&lt;br&gt;
the change is permanently saved&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;To verify durability, even if the system crashes immediately after commit:&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;When the database restarts, Alice’s balance should be 800&lt;br&gt;
the committed transaction should not be lost&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If the committed data persists after restart or failure, then durability works properly&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If the system restores the database to the last committed state and does not lose committed changes, durability is maintained&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Durability is maintained through mechanisms like write-ahead logging (WAL), disk storage, and crash recovery&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Durability guarantees that once a transaction is committed, its effects are permanent and survive any subsequent failures&lt;/p&gt;

</description>
      <category>database</category>
      <category>postgres</category>
      <category>sql</category>
      <category>systemdesign</category>
    </item>
    <item>
      <title>Design a Reliable Wallet Transfer System with ACID Guarantees pt - 3 (Isolation)</title>
      <dc:creator>Saranya R</dc:creator>
      <pubDate>Sun, 29 Mar 2026 09:07:42 +0000</pubDate>
      <link>https://dev.to/s_a_r_a/design-a-reliable-wallet-transfer-system-with-acid-guarantees-pt-3-isolation-417l</link>
      <guid>https://dev.to/s_a_r_a/design-a-reliable-wallet-transfer-system-with-acid-guarantees-pt-3-isolation-417l</guid>
      <description>&lt;p&gt;&lt;strong&gt;Isolation&lt;/strong&gt; – ensures that multiple transactions execute independently without interfering with each other, even when running concurrently.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;the accounts table: &lt;br&gt;
CREATE TABLE accounts (&lt;br&gt;
id SERIAL PRIMARY KEY,&lt;br&gt;
name TEXT NOT NULL,&lt;br&gt;
balance INT NOT NULL CHECK (balance &amp;gt;= 0),&lt;br&gt;
last_updated TIMESTAMP DEFAULT CURRENT_TIMESTAMP&lt;br&gt;
);&lt;br&gt;
 the accounts table is created successfully.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;then the dummy data is added to the table&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;INSERT INTO accounts (name, balance) VALUES ('Alice', 1000), ('Bob', 500);&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Now the initial balance in both accounts are Alice = 1000 &amp;amp; Bob = 500&lt;/li&gt;
&lt;li&gt;To test if isolation works properly, simulate two concurrent transactions:&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Transaction 1:&lt;/strong&gt;&lt;br&gt;
BEGIN;&lt;br&gt;
UPDATE accounts&lt;br&gt;
SET balance = balance - 500&lt;br&gt;
WHERE name = 'Alice';&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Transaction 2&lt;/strong&gt; (runs at the same time):&lt;br&gt;
BEGIN;&lt;br&gt;
UPDATE accounts&lt;br&gt;
SET balance = balance - 700&lt;br&gt;
WHERE name = 'Alice';&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Without isolation:&lt;/strong&gt;&lt;br&gt;
both transactions may read the same initial balance (1000)&lt;br&gt;
both updates may proceed based on outdated data&lt;br&gt;
this can lead to incorrect final balance (race condition)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;With proper isolation:&lt;/strong&gt;&lt;br&gt;
one transaction is executed or completed before the other affects the same data&lt;br&gt;
the second transaction will either wait or see the updated value&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;inconsistent updates are prevented&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If the database prevents both transactions from interfering with each other and maintains correct results, then isolation works properly&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Isolation is maintained through mechanisms like optimistic and pessimistic locks &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Isolation guarantees that concurrent transactions do not affect each other's execution and the database remains reliable under parallel operations&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>database</category>
      <category>postgres</category>
      <category>sql</category>
      <category>systemdesign</category>
    </item>
    <item>
      <title>Create a simple EC2 instance and run a webserver and access it from outside.</title>
      <dc:creator>Saranya R</dc:creator>
      <pubDate>Sun, 29 Mar 2026 08:32:42 +0000</pubDate>
      <link>https://dev.to/s_a_r_a/create-a-simple-ec2-instance-and-run-a-webserver-and-access-it-from-outside-4ndp</link>
      <guid>https://dev.to/s_a_r_a/create-a-simple-ec2-instance-and-run-a-webserver-and-access-it-from-outside-4ndp</guid>
      <description>&lt;h2&gt;
  
  
  Step 1: Launch an EC2 Instance
&lt;/h2&gt;

&lt;p&gt;1.1. Log in to the AWS Management Console.&lt;br&gt;
1.2. Navigate to EC2 Dashboard → Launch Instance.&lt;br&gt;
1.3. Choose an Amazon Machine Image (AMI), e.g., Amazon Linux 2.&lt;br&gt;
1.4. Select an instance type (e.g., t2.micro for free tier).&lt;br&gt;
1.5. Configure instance details and add storage (default is fine).&lt;br&gt;
1.6. Configure Security Group:&lt;br&gt;
  1.6.1. Allow SSH (port 22) from your IP.&lt;br&gt;
  1.6.2. Allow HTTP (port 80) from anywhere (0.0.0.0/0).&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: Connect to Your Instance
&lt;/h2&gt;

&lt;p&gt;2.1. Open terminal.&lt;br&gt;
2.2. Run:&lt;br&gt;
   2.2.1. ssh -i your-key.pem ec2-user@&lt;br&gt;
2.3. Replace  with the instance’s public IP from the EC2 dashboard.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3: Install a Webserver
&lt;/h2&gt;

&lt;p&gt;3.1. Update packages:&lt;br&gt;
   sudo yum update -y&lt;br&gt;
   Install Apache (httpd):&lt;br&gt;
   sudo yum install -y httpd&lt;br&gt;
3.2. Start the service:&lt;br&gt;
   sudo systemctl start httpd&lt;br&gt;
   sudo systemctl enable httpd&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 4: Deploy a Simple Webpage
&lt;/h2&gt;

&lt;p&gt;4.1. Navigate to the web root:&lt;br&gt;
   cd /var/www/html&lt;br&gt;
4.2. Create an index.html file:&lt;br&gt;
   echo "&lt;/p&gt;
&lt;h1&gt;Hello from EC2 Webserver!&lt;/h1&gt;" | sudo tee index.html
&lt;h2&gt;
  
  
  Step 5: Access from Outside
&lt;/h2&gt;

&lt;p&gt;5.1. Copy the Public IPv4 address of your EC2 instance.&lt;br&gt;
5.2. Open a browser and enter:&lt;br&gt;
    http://&lt;br&gt;
5.3. You should see your custom webpage.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Design a Reliable Wallet Transfer System with ACID Guarantees pt - 2 (Consistency)</title>
      <dc:creator>Saranya R</dc:creator>
      <pubDate>Thu, 26 Mar 2026 18:44:35 +0000</pubDate>
      <link>https://dev.to/s_a_r_a/design-a-reliable-wallet-transfer-system-with-acid-guarantees-pt-2-consistency-5e8g</link>
      <guid>https://dev.to/s_a_r_a/design-a-reliable-wallet-transfer-system-with-acid-guarantees-pt-2-consistency-5e8g</guid>
      <description>&lt;p&gt;&lt;strong&gt;Consistency&lt;/strong&gt; - ensures the database always moves from one valid state to another while follow the rules, constraint, etc&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;the accounts table: CREATE TABLE accounts ( id SERIAL PRIMARY KEY, name TEXT NOT NULL, balance INT NOT NULL CHECK (balance &amp;gt;= 0), last_updated TIMESTAMP DEFAULT CURRENT_TIMESTAMP );&lt;br&gt;
the accounts table is created successfully&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;then the dummy data is added to the table&lt;br&gt;
INSERT INTO accounts (name, balance) VALUES ('Alice', 1000), ('Bob', 500);&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Now the initial balance in both accounts are Alice=1000 &amp;amp; Bob=500&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;to try test if the consistency(balance &amp;gt;= 0) works properly &lt;br&gt;
UPDATE accounts&lt;br&gt;
SET balance = -100&lt;br&gt;
WHERE name = 'Alice';&lt;br&gt;
the above query will throw an error, and the update will be rejected.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;to try test if a amt more than balance can be deducted&lt;br&gt;
BEGIN;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&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;br&gt;
   If query fails because resulting balance would be negative then consistency works properly&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Consistency&lt;/strong&gt; is maintained through two layers:
Database-Level Constraints
Application / Transaction Logic &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Consistency&lt;/strong&gt; guarantees that every transaction respects the rules of the system.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Design a Reliable Wallet Transfer System with ACID Guarantees pt - 1 (Atomicity)</title>
      <dc:creator>Saranya R</dc:creator>
      <pubDate>Thu, 26 Mar 2026 18:33:59 +0000</pubDate>
      <link>https://dev.to/s_a_r_a/design-a-reliable-wallet-transfer-system-with-acid-guaranteespt-1-atomicity-4i14</link>
      <guid>https://dev.to/s_a_r_a/design-a-reliable-wallet-transfer-system-with-acid-guaranteespt-1-atomicity-4i14</guid>
      <description>&lt;p&gt;&lt;strong&gt;Atomicity&lt;/strong&gt; - A transaction is treated as an all-or-nothing operation which means if any one of the step fails the transaction rollsback and starts from start&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;the accounts table: 
CREATE TABLE accounts (
 id SERIAL PRIMARY KEY,
 name TEXT NOT NULL,
 balance INT NOT NULL CHECK (balance &amp;gt;= 0),
 last_updated TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;the accounts table is created successfully&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;then the dummy data is added to the table&lt;br&gt;
  INSERT INTO accounts (name, balance) VALUES ('Alice', 1000), ('Bob', 500);&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Now the initial balance in both accounts are Alice=1000 &amp;amp; Bob=500&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Now a Successful transaction is simulated&lt;br&gt;
BEGIN;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;UPDATE accounts&lt;br&gt;
SET balance = balance - 200&lt;br&gt;
WHERE name = 'Alice' AND balance &amp;gt;= 200;&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;ul&gt;
&lt;li&gt;&lt;p&gt;the balance in both accounts are Alice=800 &amp;amp; Bob=700&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Now a Unsuccessful transaction is simulated&lt;br&gt;
BEGIN;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;//wrong col name&lt;br&gt;
UPDATE accounts&lt;br&gt;
SET balance = balance + 200&lt;br&gt;
WHERE username = 'Bob';&lt;/p&gt;

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

&lt;ul&gt;
&lt;li&gt;The second query fails hence transaction is not made
the balance remains the same (Alice=1000 &amp;amp; Bob=500)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In a wallet system, &lt;strong&gt;Atomicity&lt;/strong&gt; ensures that money is never deducted without being credited. If any part of the transaction fails, the system restores the original state, maintaining consistency and trust&lt;/p&gt;

</description>
      <category>database</category>
      <category>postgres</category>
      <category>sql</category>
      <category>systemdesign</category>
    </item>
    <item>
      <title>how DNS resolver is happening.</title>
      <dc:creator>Saranya R</dc:creator>
      <pubDate>Thu, 26 Mar 2026 18:09:15 +0000</pubDate>
      <link>https://dev.to/s_a_r_a/how-dns-resolver-is-happening-43mp</link>
      <guid>https://dev.to/s_a_r_a/how-dns-resolver-is-happening-43mp</guid>
      <description>&lt;p&gt;How DNS Resolution Works: From URL to Website&lt;/p&gt;

&lt;p&gt;When you type a website URL into your browser, a process happens in milliseconds to connect you to the server.&lt;/p&gt;

&lt;p&gt;Step by step process:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Step 1: User Enters URL&lt;br&gt;
the desired domain is entered&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Step 2: Browser Cache Check&lt;br&gt;
Browser first checks if it already knows the IP address from a previous request then the process stops here.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Step 3: OS Cache Check&lt;br&gt;
If the browser does not have the record, the operating system checks its local DNS cache.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Step 4: Query to DNS Resolver&lt;br&gt;
If no cached result exists, the request is sent to a DNS resolver (ISP).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Step 5: Resolver Queries Root Server&lt;br&gt;
The resolver asks a root name server, The root server responds with the address of the TLD server for .com.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Step 6: Resolver Queries TLD Server&lt;br&gt;
The resolver then asks the .com TLD server, The TLD server responds with the authoritative name server for that domain.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Step 7: Resolver Queries Authoritative Server&lt;br&gt;
The resolver asks the authoritative server, The authoritative server responds with the correct IP address.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Step 8: Response Returned to Client&lt;br&gt;
The resolver sends the IP address back to your browser.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Step 9: Browser Connects to Server&lt;br&gt;
Now that the browser knows the IP address, it sends an HTTP/HTTPS request to the web server, and the website loads.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;All these steps happen a few milliseconds but still a server can process request from all across the globe&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>networking</category>
      <category>tutorial</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Different sorting methodologies</title>
      <dc:creator>Saranya R</dc:creator>
      <pubDate>Thu, 26 Mar 2026 17:46:57 +0000</pubDate>
      <link>https://dev.to/s_a_r_a/different-sorting-methodologies-57in</link>
      <guid>https://dev.to/s_a_r_a/different-sorting-methodologies-57in</guid>
      <description>&lt;h2&gt;
  
  
  Sorting Methodologies
&lt;/h2&gt;

&lt;p&gt;Sorting is process of arranging elements in a specific order to facilitate efficient searching, retrieval, and analysis of data.&lt;/p&gt;




&lt;h2&gt;
  
  
  Squares of a Sorted Array
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Problem:&lt;/strong&gt; Given a sorted array that may include negative numbers, return a new array of the squares in sorted order.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Approach:&lt;/strong&gt; Use a two-pointer technique. Compare values from both ends of the array, place the larger square at the end of the result array, and move inward.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key Point:&lt;/strong&gt;&lt;br&gt;
Sorting is avoided entirely by leveraging the structure of the input array.&lt;/p&gt;




&lt;h2&gt;
  
  
  Merge Two Sorted Linked Lists
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Problem:&lt;/strong&gt; Merge two sorted linked lists into a single sorted list.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Approach:&lt;/strong&gt; Use a dummy node and two pointers. Compare nodes from both lists and attach the smaller one to the result.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key Point:&lt;/strong&gt;&lt;br&gt;
This is efficient merging of already sorted data.&lt;/p&gt;




&lt;h2&gt;
  
  
  First and Last Occurrence in a Sorted Array
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Problem:&lt;/strong&gt; Find the first and last positions of a target value in a sorted array.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Approach:&lt;/strong&gt; Perform binary search twice — once to find the left boundary and once to find the right boundary.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key Point:&lt;/strong&gt;&lt;br&gt;
Sorting enables precise searching instead of scanning the entire array.&lt;/p&gt;




&lt;h2&gt;
  
  
  Search in Rotated Sorted Array
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Problem:&lt;/strong&gt; Search for a target value in a rotated sorted array.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Approach:&lt;/strong&gt; Use a modified binary search. At each step, determine which half is sorted and decide if the target lies within that half.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key Point:&lt;/strong&gt;&lt;br&gt;
Even when the array is rotated, partial ordering provides enough structure for efficient search.&lt;/p&gt;




&lt;h2&gt;
  
  
  Majority Element
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Problem:&lt;/strong&gt; Find the element that appears more than floor(n/2) times.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Approach:&lt;/strong&gt; Use the Boyer–Moore Voting Algorithm to track a candidate and adjust its count.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key Point:&lt;/strong&gt;&lt;br&gt;
Sorting is unnecessary. A linear-time algorithm solves the problem optimally.&lt;/p&gt;




&lt;h2&gt;
  
  
  Reverse and Deduplicate Linked Lists
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Approach:&lt;/strong&gt; Iteratively reverse pointers to flip the list.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Reverse Linked List:&lt;br&gt;
Approach:&lt;/strong&gt; Iteratively reverse pointers to flip the list.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Remove Duplicates:&lt;br&gt;
Approach:&lt;/strong&gt; Traverse the sorted list and skip adjacent duplicate nodes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key Point:&lt;/strong&gt;&lt;br&gt;
Sorting ensures duplicates are adjacent, making removal straightforward.&lt;/p&gt;




&lt;h2&gt;
  
  
  Sort a Linked List
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Problem:&lt;/strong&gt; Sort a linked list efficiently.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Approach:&lt;/strong&gt; Use merge sort. Split the list using slow and fast pointers, recursively sort each half, and merge them.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key Point:&lt;/strong&gt;&lt;br&gt;
Merge sort is preferred for linked lists because it does not require random access.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Leetcode Two sum problem</title>
      <dc:creator>Saranya R</dc:creator>
      <pubDate>Thu, 26 Mar 2026 16:36:01 +0000</pubDate>
      <link>https://dev.to/s_a_r_a/leetcode-two-sum-problem-gmg</link>
      <guid>https://dev.to/s_a_r_a/leetcode-two-sum-problem-gmg</guid>
      <description>&lt;h2&gt;
  
  
  1. Two Sum
&lt;/h2&gt;

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

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

&lt;ul&gt;
&lt;li&gt;seen keeps track of numbers we’ve already visited and their indices.&lt;/li&gt;
&lt;li&gt;For each num, we calculate complement = target-num.&lt;/li&gt;
&lt;li&gt;If the complement is already in seen, we return the pair of indices.&lt;/li&gt;
&lt;li&gt;Otherwise, we store the current number with its index.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  167. Two Sum II - Input Array Is Sorted
&lt;/h2&gt;

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

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

&lt;ul&gt;
&lt;li&gt;Start with two pointers &lt;strong&gt;left&lt;/strong&gt; at the beginning, &lt;strong&gt;right&lt;/strong&gt; at the end.&lt;/li&gt;
&lt;li&gt;Compute the sum of the two numbers.&lt;/li&gt;
&lt;li&gt;If the sum equals the target, return their indices. - If the sum is too small, move left forward to increase the sum.&lt;/li&gt;
&lt;li&gt;If the sum is too large, move right backward to decrease the sum.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>algorithms</category>
      <category>dsa</category>
      <category>interview</category>
      <category>leetcode</category>
    </item>
    <item>
      <title>Setup a DNS hosted zone in Route53 in AWS.</title>
      <dc:creator>Saranya R</dc:creator>
      <pubDate>Wed, 25 Mar 2026 18:09:39 +0000</pubDate>
      <link>https://dev.to/s_a_r_a/setup-a-dns-hosted-zone-in-route53-in-aws-1585</link>
      <guid>https://dev.to/s_a_r_a/setup-a-dns-hosted-zone-in-route53-in-aws-1585</guid>
      <description>&lt;p&gt;&lt;strong&gt;Step 1: Open Route 53&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Log in to AWS Console&lt;/li&gt;
&lt;li&gt;Search for Route 53&lt;/li&gt;
&lt;li&gt;Click Hosted Zones&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Step 2: Create a Hosted Zone&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Click Create hosted zone&lt;/li&gt;
&lt;li&gt;Enter:
Domain name (e.g., MyWebsite.com)&lt;/li&gt;
&lt;li&gt;Type: Public hosted zone
Click Create&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;AWS will automatically create default records:&lt;br&gt;
    - NS (Name Server)&lt;br&gt;
    - SOA (Start of Authority)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 3: Update Name Servers&lt;/strong&gt;&lt;br&gt;
After creating the hosted zone:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Copy the NS records from Route 53&lt;/li&gt;
&lt;li&gt;Go to domain registrar&lt;/li&gt;
&lt;li&gt;Replace existing name servers with AWS name servers&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This connects your domain to AWS&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 4: Add DNS Records&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Now you can map your domain to resources.&lt;/li&gt;
&lt;li&gt;Example: Point domain to a server
 Click Create record
 Choose:
   Record type: A
   Value: Your server IP
  Save&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Example: Connect to AWS services&lt;br&gt;
EC2 → A record&lt;br&gt;
Load Balancer → Alias record&lt;br&gt;
S3 static website → Alias record&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 5: Verify Setup&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Wait for DNS propagation (few minutes to 48 hours)&lt;/li&gt;
&lt;li&gt;Open your domain in a browser&lt;/li&gt;
&lt;li&gt;It points to my resource &lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>aws</category>
      <category>beginners</category>
      <category>networking</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>How a request originates from cllient and reaches the server ?</title>
      <dc:creator>Saranya R</dc:creator>
      <pubDate>Wed, 25 Mar 2026 17:58:43 +0000</pubDate>
      <link>https://dev.to/s_a_r_a/how-a-request-originates-from-cllient-and-reaches-the-server--30i3</link>
      <guid>https://dev.to/s_a_r_a/how-a-request-originates-from-cllient-and-reaches-the-server--30i3</guid>
      <description>&lt;p&gt;&lt;strong&gt;FLOW:&lt;/strong&gt; &lt;br&gt;
User &amp;gt; DNS &amp;gt; Connection Setup &amp;gt; Secure Connection &amp;gt; Request &amp;gt; Server &amp;gt; Response &amp;gt; Browser&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. User Action&lt;/strong&gt;&lt;br&gt;
user type a URL or click a link. The browser prepares a request.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. DNS Lookup&lt;/strong&gt;&lt;br&gt;
The domain name (google.com) is converted into the IP address of the domain.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Connection Setup&lt;/strong&gt;&lt;br&gt;
A TCP connection is established between client and server for reliable and secure connection.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Secure Connection (HTTPS)&lt;/strong&gt;&lt;br&gt;
If the site uses HTTPS, a secure (encrypted) connection is created.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. HTTP Request&lt;/strong&gt;&lt;br&gt;
The browser sends a request (GET, POST, PUT) to the server.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;6. Server Processing&lt;/strong&gt;&lt;br&gt;
The server processes the request and interacts with the database.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;7. HTTP Response&lt;/strong&gt;&lt;br&gt;
The server sends back a response (HTML, JSON, etc.) for the request sent.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;8. Browser Rendering&lt;/strong&gt;&lt;br&gt;
The browser displays the result as a webpage.&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>computerscience</category>
      <category>networking</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
