<?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: Sharmila devi</title>
    <description>The latest articles on DEV Community by Sharmila devi (@sharmi_sabari_09).</description>
    <link>https://dev.to/sharmi_sabari_09</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%2F3838551%2F3a35463d-3f6a-40c2-8b24-dbc0cc84172b.png</url>
      <title>DEV Community: Sharmila devi</title>
      <link>https://dev.to/sharmi_sabari_09</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sharmi_sabari_09"/>
    <language>en</language>
    <item>
      <title>Reverse a Linked List</title>
      <dc:creator>Sharmila devi</dc:creator>
      <pubDate>Sun, 29 Mar 2026 06:22:39 +0000</pubDate>
      <link>https://dev.to/sharmi_sabari_09/reverse-a-linked-list-1d49</link>
      <guid>https://dev.to/sharmi_sabari_09/reverse-a-linked-list-1d49</guid>
      <description>&lt;p&gt;Problem Statement&lt;br&gt;
Given the head of a singly linked list, reverse the list and return the new head.&lt;/p&gt;

&lt;p&gt;Example&lt;br&gt;
Input&lt;br&gt;
1 -&amp;gt; 2 -&amp;gt; 3 -&amp;gt; 4 -&amp;gt; 5&lt;br&gt;
Output&lt;br&gt;
5 -&amp;gt; 4 -&amp;gt; 3 -&amp;gt; 2 -&amp;gt; 1&lt;/p&gt;

&lt;p&gt;Approach 1 Iterative Method&lt;br&gt;
Reverse the links of the list one by one.&lt;/p&gt;

&lt;p&gt;Steps&lt;br&gt;
1 Initialize three pointers previous as None, current as head, next as None&lt;br&gt;
2 Traverse the list&lt;br&gt;
3 Store next node&lt;br&gt;
4 Reverse current node link&lt;br&gt;
5 Move previous and current one step forward&lt;br&gt;
6 Repeat until current becomes None&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;Code&lt;/span&gt;
&lt;span class="n"&gt;python&lt;/span&gt; &lt;span class="nb"&gt;id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;ll1&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;ListNode&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;init&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;val&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;next&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;None&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;val&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;val&lt;/span&gt;
&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;next&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;next&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;reverseList&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;head&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
&lt;span class="n"&gt;prev&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="bp"&gt;None&lt;/span&gt;
&lt;span class="n"&gt;curr&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;head&lt;/span&gt;

&lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="n"&gt;curr&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;next_node&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;curr&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;next&lt;/span&gt;
    &lt;span class="n"&gt;curr&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;next&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;prev&lt;/span&gt;
    &lt;span class="n"&gt;prev&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;curr&lt;/span&gt;
    &lt;span class="n"&gt;curr&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;next_node&lt;/span&gt;

&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;prev&lt;/span&gt;


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

&lt;/div&gt;



&lt;p&gt;Approach 2 Recursive Method&lt;/p&gt;

&lt;p&gt;Reverse the list using recursion.&lt;/p&gt;

&lt;h1&gt;
  
  
  Code
&lt;/h1&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;python&lt;/span&gt; &lt;span class="nb"&gt;id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;ll2&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;reverseList&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;head&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;head&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;head&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;next&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;head&lt;/span&gt;

    &lt;span class="n"&gt;new_head&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;reverseList&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;head&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;next&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="n"&gt;head&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;next&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;next&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;head&lt;/span&gt;
    &lt;span class="n"&gt;head&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;next&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="bp"&gt;None&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;new_head&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Explanation:&lt;br&gt;
In the iterative method, we reverse the direction of pointers step by step.&lt;br&gt;
In the recursive method, we reverse the rest of the list and then fix the current node.&lt;/p&gt;

&lt;p&gt;Expected Output&lt;br&gt;
Input&lt;br&gt;
1 -&amp;gt; 2 -&amp;gt; 3 -&amp;gt; 4 -&amp;gt; 5&lt;br&gt;
Output&lt;br&gt;
5 -&amp;gt; 4 -&amp;gt; 3 -&amp;gt; 2 -&amp;gt; 1&lt;/p&gt;

&lt;p&gt;Conclusion&lt;br&gt;
Reversing a linked list is a fundamental problem that helps in understanding pointers and data structures. It is frequently asked in coding interviews.&lt;br&gt;
Practice both iterative and recursive methods to strengthen your understanding.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Reverse the array</title>
      <dc:creator>Sharmila devi</dc:creator>
      <pubDate>Sun, 29 Mar 2026 06:17:21 +0000</pubDate>
      <link>https://dev.to/sharmi_sabari_09/reverse-the-array-2bdl</link>
      <guid>https://dev.to/sharmi_sabari_09/reverse-the-array-2bdl</guid>
      <description>&lt;p&gt;&lt;strong&gt;Problem&lt;/strong&gt;&lt;br&gt;
Reverse an array arr[]. Reversing means the first element becomes last, the second becomes second-last, and so on.&lt;/p&gt;

&lt;p&gt;Example 1:&lt;br&gt;
Input: arr = [1, 4, 3, 2, 6, 5]&lt;br&gt;
Output: [5, 6, 2, 3, 4, 1]&lt;/p&gt;

&lt;p&gt;Example 2:&lt;br&gt;
Input: arr = [4, 5, 1, 2]&lt;br&gt;
Output: [2, 1, 5, 4]&lt;/p&gt;

&lt;p&gt;Approaches&lt;br&gt;
Using Two Pointers (O(n) time, O(1) space)&lt;br&gt;
Swap elements from start and end until you reach the middle.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;reverse_array&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
&lt;span class="n"&gt;left&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;right&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nf"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
&lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="n"&gt;left&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;right&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
&lt;span class="n"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;left&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="n"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;right&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;right&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="n"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;left&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="n"&gt;left&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
&lt;span class="n"&gt;right&lt;/span&gt; &lt;span class="o"&gt;-=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;

&lt;span class="n"&gt;arr&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="nf"&gt;reverse_array&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;


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

&lt;/div&gt;



&lt;p&gt;Output:&lt;br&gt;
[5, 6, 2, 3, 4, 1]&lt;/p&gt;

&lt;p&gt;Swapping Elements by Index (O(n) time, O(1) space)&lt;br&gt;
Iterate through the first half and swap with corresponding elements from the end.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;reverse_array&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
&lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nf"&gt;range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="o"&gt;//&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
&lt;span class="n"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="n"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="n"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="n"&gt;arr&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="nf"&gt;reverse_array&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;


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

&lt;/div&gt;



&lt;p&gt;Output:&lt;br&gt;
[5, 6, 2, 3, 4, 1]&lt;/p&gt;

&lt;p&gt;Using Inbuilt Method (O(n) time, O(1) space) def reverse_array(arr):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;reverse&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="n"&gt;arr&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="nf"&gt;reverse_array&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

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

&lt;/div&gt;



&lt;p&gt;Output:&lt;br&gt;
[5, 6, 2, 3, 4, 1]&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Alter Tables</title>
      <dc:creator>Sharmila devi</dc:creator>
      <pubDate>Sun, 29 Mar 2026 06:10:57 +0000</pubDate>
      <link>https://dev.to/sharmi_sabari_09/alter-tables-15f</link>
      <guid>https://dev.to/sharmi_sabari_09/alter-tables-15f</guid>
      <description>&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Make email NOT NULL in customers&lt;br&gt;
ALTER TABLE customers&lt;br&gt;
ALTER COLUMN email SET NOT NULL;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Make username UNIQUE in users&lt;br&gt;
ALTER TABLE users&lt;br&gt;
ADD CONSTRAINT unique_username UNIQUE (username);&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Add CHECK (price &amp;gt; 0) in products&lt;br&gt;
ALTER TABLE products&lt;br&gt;
ADD CONSTRAINT price_check CHECK (price &amp;gt; 0);&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Set default 'pending' in orders&lt;br&gt;
ALTER TABLE orders&lt;br&gt;
ALTER COLUMN status SET DEFAULT 'pending';&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Add salary column in employees&lt;br&gt;
ALTER TABLE employees&lt;br&gt;
ADD COLUMN salary INT NOT NULL CHECK (salary &amp;gt; 10000);&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Modify foreign key with ON DELETE CASCADE&lt;br&gt;
First drop old constraint (name may vary)&lt;br&gt;
ALTER TABLE employees&lt;br&gt;
DROP CONSTRAINT employees_department_id_fkey;&lt;br&gt;
Then add new one&lt;br&gt;
ALTER TABLE employees&lt;br&gt;
ADD CONSTRAINT fk_department&lt;br&gt;
FOREIGN KEY (department_id)&lt;br&gt;
REFERENCES departments(id)&lt;br&gt;
ON DELETE CASCADE;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Remove CHECK constraint from accounts&lt;br&gt;
First find constraint name, then:&lt;br&gt;
ALTER TABLE accounts&lt;br&gt;
DROP CONSTRAINT accounts_balance_check;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Add UNIQUE (user_id, transaction_id) in payments&lt;br&gt;
ALTER TABLE payments&lt;br&gt;
ADD CONSTRAINT unique_payment UNIQUE (user_id, transaction_id);&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>database</category>
      <category>postgres</category>
      <category>sql</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Create Tables</title>
      <dc:creator>Sharmila devi</dc:creator>
      <pubDate>Sun, 29 Mar 2026 06:06:26 +0000</pubDate>
      <link>https://dev.to/sharmi_sabari_09/create-tables-1bjj</link>
      <guid>https://dev.to/sharmi_sabari_09/create-tables-1bjj</guid>
      <description>&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Students table (id unique)&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;/li&gt;
&lt;li&gt;&lt;p&gt;Employees table (name &amp;amp; email not null)&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;/li&gt;
&lt;li&gt;&lt;p&gt;Users table (username &amp;amp; email unique)&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;/li&gt;
&lt;li&gt;&lt;p&gt;Products table (price &amp;gt; 0, stock ≥ 0)&lt;br&gt;
CREATE TABLE products (&lt;br&gt;
id SERIAL PRIMARY KEY,&lt;br&gt;
name TEXT,&lt;br&gt;
price DECIMAL CHECK (price &amp;gt; 0),&lt;br&gt;
stock INT CHECK (stock &amp;gt;= 0)&lt;br&gt;
);&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Orders table (default + timestamp)&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;/li&gt;
&lt;li&gt;&lt;p&gt;Accounts table&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;/li&gt;
&lt;li&gt;&lt;p&gt;Enrollments table (unique combination)&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;/li&gt;
&lt;li&gt;&lt;p&gt;Departments &amp;amp; Employees (foreign key)&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;/li&gt;
&lt;/ol&gt;

&lt;p&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;ol&gt;
&lt;li&gt;Foreign key with cascade
CREATE TABLE departments (
id SERIAL PRIMARY KEY,
name TEXT
);&lt;/li&gt;
&lt;/ol&gt;

&lt;p&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>Idempotency Situation</title>
      <dc:creator>Sharmila devi</dc:creator>
      <pubDate>Sun, 29 Mar 2026 06:04:10 +0000</pubDate>
      <link>https://dev.to/sharmi_sabari_09/idempotency-situation-38g6</link>
      <guid>https://dev.to/sharmi_sabari_09/idempotency-situation-38g6</guid>
      <description>&lt;p&gt;When I build a wallet system, I realized one common issue — same request can happen multiple times. This usually happens because of network retry or user clicking twice.&lt;/p&gt;

&lt;p&gt;This is where Idempotency becomes important.&lt;br&gt;
My Situation&lt;br&gt;
Let’s say:&lt;br&gt;
Alice → ₹1000&lt;br&gt;
Bob → ₹500&lt;br&gt;
I send ₹200 from Alice to Bob.&lt;/p&gt;

&lt;p&gt;First Transfer&lt;br&gt;
UPDATE accounts SET balance = balance - 200 WHERE name = 'Alice';&lt;br&gt;
UPDATE accounts SET balance = balance + 200 WHERE name = 'Bob';&lt;/p&gt;

&lt;p&gt;Now:&lt;br&gt;
Alice → ₹800&lt;br&gt;
Bob → ₹700&lt;br&gt;
Same Request Happens Again&lt;/p&gt;

&lt;p&gt;Due to retry, the same query runs again:&lt;br&gt;
UPDATE accounts SET balance = balance - 200 WHERE name = 'Alice';&lt;br&gt;
UPDATE accounts SET balance = balance + 200 WHERE name = 'Bob';&lt;/p&gt;

&lt;p&gt;Now:&lt;br&gt;
Alice → ₹600&lt;br&gt;
Bob → ₹900&lt;/p&gt;

&lt;p&gt;Money transferred twice&lt;br&gt;
What I Observed&lt;br&gt;
Database allows the same operation again&lt;br&gt;
No automatic prevention&lt;br&gt;
Duplicate transaction happens&lt;br&gt;
Problem&lt;/p&gt;

&lt;p&gt;Same request = executed multiple times&lt;br&gt;
Balance becomes incorrect&lt;/p&gt;

&lt;p&gt;How Real Systems Solve This&lt;br&gt;
In real systems, I use an Idempotency Key.&lt;br&gt;
Example:&lt;br&gt;
txn_001&lt;br&gt;
Before processing, I check:&lt;br&gt;
“Is this transaction already done?”&lt;/p&gt;

&lt;p&gt;Simple Logic&lt;br&gt;
IF transaction_id exists&lt;br&gt;
    DO NOTHING&lt;br&gt;
ELSE&lt;br&gt;
    PROCESS transaction&lt;br&gt;
Final Result&lt;br&gt;
First request → success&lt;br&gt;
Duplicate request → ignored&lt;/p&gt;

&lt;p&gt;No double deduction&lt;br&gt;
 Balance stays correct&lt;/p&gt;

&lt;p&gt;Simple Idea&lt;br&gt;
Same request should not change result again&lt;/p&gt;

&lt;p&gt;Conclusion&lt;br&gt;
Without idempotency:&lt;br&gt;
Duplicate transactions happen&lt;br&gt;
Money gets deducted multiple times&lt;/p&gt;

&lt;p&gt;With idempotency:&lt;br&gt;
Only one transaction is processed&lt;br&gt;
System stays safe&lt;/p&gt;

&lt;p&gt;So I remember it like this:&lt;br&gt;
Even if request repeats, result should happen only once.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Durability</title>
      <dc:creator>Sharmila devi</dc:creator>
      <pubDate>Sun, 29 Mar 2026 05:59:58 +0000</pubDate>
      <link>https://dev.to/sharmi_sabari_09/durability-1gl6</link>
      <guid>https://dev.to/sharmi_sabari_09/durability-1gl6</guid>
      <description>&lt;p&gt;When I build a wallet system, I want to make sure that once money is transferred, it should never be lost. This is called Durability.&lt;/p&gt;

&lt;p&gt;What Durability Means&lt;br&gt;
Once I COMMIT a transaction, it is permanently saved&lt;br&gt;
Even if the system crashes, data will still be there&lt;br&gt;
Example Transfer&lt;br&gt;
BEGIN;&lt;br&gt;
UPDATE accounts SET balance = balance - 200 WHERE name = 'Alice';&lt;br&gt;
UPDATE accounts SET balance = balance + 200 WHERE name = 'Bob';&lt;br&gt;
COMMIT;&lt;/p&gt;

&lt;p&gt;After this:&lt;br&gt;
Alice → ₹800&lt;br&gt;
Bob → ₹700&lt;br&gt;
After Crash / Restart&lt;/p&gt;

&lt;p&gt;Even if the database restarts, when I check again:&lt;br&gt;
SELECT * FROM accounts;&lt;br&gt;
I still see the updated balance.&lt;br&gt;
Data is safe&lt;/p&gt;

&lt;p&gt;Simple Idea&lt;br&gt;
If COMMIT happens → data is saved forever&lt;br&gt;
If not → changes are not saved&lt;/p&gt;

&lt;p&gt;Conclusion&lt;br&gt;
Durability ensures:&lt;/p&gt;

&lt;p&gt;No data loss&lt;br&gt;
Data stays permanent&lt;/p&gt;

&lt;p&gt;So I remember it like this:&lt;br&gt;
Once committed, it will never be lost.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Consistency</title>
      <dc:creator>Sharmila devi</dc:creator>
      <pubDate>Sun, 29 Mar 2026 05:56:36 +0000</pubDate>
      <link>https://dev.to/sharmi_sabari_09/consistency-2ej5</link>
      <guid>https://dev.to/sharmi_sabari_09/consistency-2ej5</guid>
      <description>&lt;p&gt;When I build a wallet system like PhonePe or GPay, I make sure the data is always correct. This is called Consistency in ACID.&lt;/p&gt;

&lt;p&gt;What Consistency Means&lt;br&gt;
Consistency means:&lt;br&gt;
Data should always follow rules&lt;br&gt;
No invalid data should be stored&lt;/p&gt;

&lt;p&gt;My 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;/p&gt;

&lt;p&gt;Here, I added:&lt;br&gt;
CHECK (balance &amp;gt;= 0) → balance should never be negative&lt;/p&gt;

&lt;p&gt;Dummy Data:&lt;br&gt;
INSERT INTO accounts (name, balance)&lt;br&gt;
VALUES&lt;br&gt;
('Alice', 1000),&lt;br&gt;
('Bob', 500);&lt;br&gt;
Testing the Rules&lt;br&gt;
Try to make balance negative&lt;br&gt;
UPDATE accounts&lt;br&gt;
SET balance = -100&lt;br&gt;
WHERE name = 'Alice';&lt;/p&gt;

&lt;p&gt;This will fail&lt;br&gt;
Reason: database rule (CHECK constraint)&lt;/p&gt;

&lt;p&gt;Try to deduct more money&lt;br&gt;
UPDATE accounts&lt;br&gt;
SET balance = balance - 2000&lt;br&gt;
WHERE name = 'Alice';&lt;/p&gt;

&lt;p&gt;This will also fail&lt;br&gt;
Because balance becomes negative&lt;/p&gt;

&lt;p&gt;What I Understand&lt;br&gt;
Database itself blocks wrong data&lt;br&gt;
It keeps balance valid&lt;br&gt;
This is Consistency&lt;br&gt;
Simple Idea&lt;/p&gt;

&lt;p&gt;Database ensures rules&lt;br&gt;
Data always stays correct&lt;/p&gt;

&lt;p&gt;Conclusion&lt;br&gt;
Consistency makes sure:&lt;/p&gt;

&lt;p&gt;No negative balance&lt;br&gt;
No wrong updates&lt;/p&gt;

&lt;p&gt;So I remember it like this:&lt;br&gt;
Data should always be valid before and after any operation.&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>database</category>
      <category>postgres</category>
      <category>sql</category>
    </item>
    <item>
      <title>Atomicity - Design a Reliable Wallet Transfer System with ACID Guarantees</title>
      <dc:creator>Sharmila devi</dc:creator>
      <pubDate>Sun, 29 Mar 2026 05:49:28 +0000</pubDate>
      <link>https://dev.to/sharmi_sabari_09/atomicity-design-a-reliable-wallet-transfer-system-with-acid-guarantees-4j2b</link>
      <guid>https://dev.to/sharmi_sabari_09/atomicity-design-a-reliable-wallet-transfer-system-with-acid-guarantees-4j2b</guid>
      <description>&lt;p&gt;Atomicity – Reliable Wallet Transfer with ACID (Simple)&lt;/p&gt;

&lt;p&gt;When I learned about ACID properties, the one I understood first was Atomicity. It is very simple — it means all or nothing.&lt;/p&gt;

&lt;p&gt;I can explain this using a wallet transfer example.&lt;/p&gt;

&lt;p&gt;What I am trying to do&lt;/p&gt;

&lt;p&gt;Let’s say:&lt;/p&gt;

&lt;p&gt;Wallet A has ₹1000&lt;br&gt;
Wallet B has ₹500&lt;br&gt;
I want to send ₹200&lt;/p&gt;

&lt;p&gt;So internally, two things should happen:&lt;/p&gt;

&lt;p&gt;₹200 should be deducted from Wallet A&lt;br&gt;
₹200 should be added to Wallet B&lt;br&gt;
The Problem&lt;/p&gt;

&lt;p&gt;If only one step happens, it becomes a big issue.&lt;/p&gt;

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

&lt;p&gt;Money is deducted from A&lt;br&gt;
But not added to B&lt;/p&gt;

&lt;p&gt;Now ₹200 is lost. This is not acceptable in real applications.&lt;/p&gt;

&lt;p&gt;How I Solve This&lt;/p&gt;

&lt;p&gt;To avoid this, I use a database transaction.&lt;/p&gt;

&lt;p&gt;BEGIN;&lt;/p&gt;

&lt;p&gt;UPDATE wallet SET balance = balance - 200 WHERE id = 'A';&lt;br&gt;
UPDATE wallet SET balance = balance + 200 WHERE id = 'B';&lt;/p&gt;

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

&lt;p&gt;If everything works fine → COMMIT&lt;/p&gt;

&lt;p&gt;If any error happens in between →&lt;/p&gt;

&lt;p&gt;ROLLBACK;&lt;br&gt;
This cancels all changes and keeps the data safe.&lt;/p&gt;

&lt;p&gt;Why Atomicity is Important&lt;br&gt;
No money loss&lt;br&gt;
No partial updates&lt;br&gt;
System stays correct&lt;br&gt;
Simple Idea&lt;br&gt;
Transfer is one single action, not two separate steps&lt;/p&gt;

&lt;p&gt;Conclusion&lt;br&gt;
When I design a wallet system, I always use Atomicity to make it reliable.&lt;br&gt;
Because in payments, even a small mistake can cause big problems.&lt;br&gt;
So I always remember:&lt;br&gt;
Either everything happens or nothing happens.&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>database</category>
      <category>sql</category>
      <category>systemdesign</category>
    </item>
    <item>
      <title>32 - Filter Assignments</title>
      <dc:creator>Sharmila devi</dc:creator>
      <pubDate>Sun, 29 Mar 2026 05:41:27 +0000</pubDate>
      <link>https://dev.to/sharmi_sabari_09/32-filter-assignments-3po2</link>
      <guid>https://dev.to/sharmi_sabari_09/32-filter-assignments-3po2</guid>
      <description>&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Movies where special_features is NULL&lt;br&gt;
SELECT * FROM film&lt;br&gt;
WHERE special_features IS NULL;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Movies where rental duration &amp;gt; 7 days&lt;br&gt;
SELECT * FROM film&lt;br&gt;
WHERE rental_duration &amp;gt; 7;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Movies with rental rate = 4.99 and replacement cost &amp;gt; 20&lt;br&gt;
SELECT * FROM film&lt;br&gt;
WHERE rental_rate = 4.99&lt;br&gt;
AND replacement_cost &amp;gt; 20;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Movies with rental rate = 0.99 OR rating = 'PG-13'&lt;br&gt;
SELECT * FROM film&lt;br&gt;
WHERE rental_rate = 0.99&lt;br&gt;
OR rating = 'PG-13';&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;First 5 movies sorted by title&lt;br&gt;
SELECT * FROM film&lt;br&gt;
ORDER BY title ASC&lt;br&gt;
LIMIT 5;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Skip first 10, get next 3 highest replacement cost&lt;br&gt;
SELECT * FROM film&lt;br&gt;
ORDER BY replacement_cost DESC&lt;br&gt;
LIMIT 3 OFFSET 10;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Movies with rating G, PG, PG-13&lt;br&gt;
SELECT * FROM film&lt;br&gt;
WHERE rating IN ('G', 'PG', 'PG-13');&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Movies with rental rate between 2 and 4&lt;br&gt;
SELECT * FROM film&lt;br&gt;
WHERE rental_rate BETWEEN 2 AND 4;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Movies with title starting with 'The'&lt;br&gt;
SELECT * FROM film&lt;br&gt;
WHERE title LIKE 'The%';&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;First 10 movies with conditions&lt;br&gt;
SELECT * FROM film&lt;br&gt;
WHERE rental_rate IN (2.99, 4.99)&lt;br&gt;
AND rating = 'R'&lt;br&gt;
AND title LIKE '%Love%'&lt;br&gt;
LIMIT 10;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Movies where title contains %&lt;br&gt;
SELECT * FROM film&lt;br&gt;
WHERE title LIKE '%\%%' ESCAPE '\';&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Movies where title contains _&lt;br&gt;
SELECT * FROM film&lt;br&gt;
WHERE title LIKE '%_%' ESCAPE '\';&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Titles start with A or B and end with s&lt;br&gt;
SELECT * FROM film&lt;br&gt;
WHERE (title LIKE 'A%' OR title LIKE 'B%')&lt;br&gt;
AND title LIKE '%s';&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Titles containing Man, Men, or Woman&lt;br&gt;
SELECT * FROM film&lt;br&gt;
WHERE title LIKE '%Man%'&lt;br&gt;
OR title LIKE '%Men%'&lt;br&gt;
OR title LIKE '%Woman%';&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Titles containing digits&lt;br&gt;
SELECT * FROM film&lt;br&gt;
WHERE title ~ '[0-9]';&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Titles containing backslash ()&lt;br&gt;
SELECT * FROM film&lt;br&gt;
WHERE title LIKE '%\%';&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Titles containing Love or Hate&lt;br&gt;
SELECT * FROM film&lt;br&gt;
WHERE title LIKE '%Love%'&lt;br&gt;
OR title LIKE '%Hate%';&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;First 5 movies ending with er, or, ar&lt;br&gt;
SELECT * FROM film&lt;br&gt;
WHERE title LIKE '%er'&lt;br&gt;
OR title LIKE '%or'&lt;br&gt;
OR title LIKE '%ar'&lt;br&gt;
LIMIT 5;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

</description>
    </item>
    <item>
      <title>Setup a DNS hosted zone in Route53 in AWS.</title>
      <dc:creator>Sharmila devi</dc:creator>
      <pubDate>Sun, 29 Mar 2026 05:32:12 +0000</pubDate>
      <link>https://dev.to/sharmi_sabari_09/setup-a-dns-hosted-zone-in-route53-in-aws-4mjd</link>
      <guid>https://dev.to/sharmi_sabari_09/setup-a-dns-hosted-zone-in-route53-in-aws-4mjd</guid>
      <description>&lt;p&gt;When I tried to connect my domain name to my server, I used Route 53 in AWS. At first, I thought it would be difficult, but it was actually simple when I followed the steps.&lt;/p&gt;

&lt;p&gt;First, I logged into the AWS console and opened Route 53. Then I clicked on Hosted Zones and selected Create Hosted Zone.&lt;/p&gt;

&lt;p&gt;Next, I entered my domain name (like mywebsite.com) and selected Public Hosted Zone. Then I clicked create.&lt;/p&gt;

&lt;p&gt;After creating it, I saw some default records like NS and SOA. I understood that the NS records are important because they tell where my domain is managed.&lt;/p&gt;

&lt;p&gt;If my domain was bought from somewhere else (like GoDaddy), I went there and updated the Name Servers with the ones given in Route 53. This step connects my domain to AWS.&lt;br&gt;
Then I created a new record. I clicked on Create Record and added an A record.&lt;/p&gt;

&lt;p&gt;In that:&lt;br&gt;
I gave a name (like www)&lt;br&gt;
Selected type as A&lt;br&gt;
Entered my EC2 public IP address&lt;/p&gt;

&lt;p&gt;Then I saved it.&lt;/p&gt;

&lt;p&gt;After some time, I opened my domain in the browser, and it started working.&lt;br&gt;
So in simple words, I created a hosted zone, updated name servers, and connected my domain to my server.&lt;br&gt;
This is how I set up a DNS hosted zone in Route 53 in a simple way.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Create a simple EC2 instance and run a webserver and access it from outside.</title>
      <dc:creator>Sharmila devi</dc:creator>
      <pubDate>Sun, 29 Mar 2026 05:24:35 +0000</pubDate>
      <link>https://dev.to/sharmi_sabari_09/create-a-simple-ec2-instance-and-run-a-webserver-and-access-it-from-outside-3mj9</link>
      <guid>https://dev.to/sharmi_sabari_09/create-a-simple-ec2-instance-and-run-a-webserver-and-access-it-from-outside-3mj9</guid>
      <description>&lt;p&gt;&lt;strong&gt;Creating a Simple EC2 Instance and Running a Web Server&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Whenever I started learning AWS, one of the first things I tried was creating an EC2 instance and hosting a simple web server. At first, it felt confusing, but when I did it step by step, it became very easy. Let me explain how I did it in a simple way.&lt;/p&gt;

&lt;p&gt;First, I logged into the AWS Management Console. After that, I searched for EC2 and opened the EC2 dashboard. From there, I clicked on Launch Instance to create a new virtual machine.&lt;/p&gt;

&lt;p&gt;Next, I gave a name to my instance and selected an Amazon Linux AMI. Then I chose a small instance type like t2.micro because it is free tier eligible.&lt;/p&gt;

&lt;p&gt;After that, I created a key pair. This is important because it helps me connect to the instance securely. I downloaded the key file and saved it safely.&lt;/p&gt;

&lt;p&gt;Then, I configured the network settings. Here I made an important change — I allowed HTTP (port 80) traffic so that I can access my web server from outside. Without this step, the website will not open in the browser.&lt;/p&gt;

&lt;p&gt;Once everything was set, I clicked on Launch Instance. Within a few seconds, my EC2 instance was up and running.&lt;/p&gt;

&lt;p&gt;Now I wanted to install a web server. For that, I connected to my instance using SSH. After connecting, I ran some simple commands to install Apache:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;yum update &lt;span class="nt"&gt;-y&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;yum &lt;span class="nb"&gt;install &lt;/span&gt;httpd &lt;span class="nt"&gt;-y&lt;/span&gt;

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

&lt;/div&gt;



&lt;p&gt;Then I started the web server:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl start httpd


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

&lt;/div&gt;



&lt;p&gt;To make sure it runs even after restart, I enabled it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl &lt;span class="nb"&gt;enable &lt;/span&gt;httpd


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

&lt;/div&gt;



&lt;p&gt;After that, I created a simple HTML page:&lt;/p&gt;

&lt;p&gt;echo "Hello from my EC2 server!" | sudo tee /var/www/html/index.html&lt;/p&gt;

&lt;p&gt;Now everything was ready. Finally, I copied the Public IP address of my EC2 instance and pasted it into my browser.&lt;/p&gt;

&lt;p&gt;When I pressed enter, I could see my web page showing the message. That moment made me really happy because my server was now accessible from anywhere.&lt;/p&gt;

&lt;p&gt;So in simple terms, I created a server in the cloud, installed a web server, and accessed it using a public IP.&lt;/p&gt;

&lt;p&gt;This is how I learned to launch an EC2 instance and host a basic web server in AWS.&lt;/p&gt;

</description>
      <category>aws</category>
      <category>beginners</category>
      <category>cloud</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Write a blog on how DNS resolver is happening.</title>
      <dc:creator>Sharmila devi</dc:creator>
      <pubDate>Sun, 29 Mar 2026 05:20:29 +0000</pubDate>
      <link>https://dev.to/sharmi_sabari_09/write-a-blog-on-how-dns-resolver-is-happening-3f3o</link>
      <guid>https://dev.to/sharmi_sabari_09/write-a-blog-on-how-dns-resolver-is-happening-3f3o</guid>
      <description>&lt;p&gt;&lt;strong&gt;How DNS Resolver Works (In My Words)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Whenever I type a website name like google.com in my browser, I used to think it directly opens the site. But actually, there is a small process happening behind the scenes called DNS resolving. Let me explain it in a simple way based on how I understand it.&lt;/p&gt;

&lt;p&gt;First, when I enter the website name, my browser doesn’t know where that website is stored. Because computers don’t understand names like google.com, they only understand IP addresses.&lt;/p&gt;

&lt;p&gt;So my browser starts by checking if it already knows the IP address. It looks into something called cache (stored memory). This can be:&lt;/p&gt;

&lt;p&gt;Browser cache&lt;br&gt;
System cache&lt;/p&gt;

&lt;p&gt;If the IP address is already there, then the website opens quickly without doing anything else.&lt;/p&gt;

&lt;p&gt;If the IP is not found, then the real DNS resolving process starts.&lt;/p&gt;

&lt;p&gt;My request goes to something called a DNS resolver. Usually, this is provided by my internet service provider (ISP). The resolver’s job is to find the correct IP address for the website I asked.&lt;/p&gt;

&lt;p&gt;Now the resolver doesn’t know the answer directly, so it asks other servers step by step:&lt;/p&gt;

&lt;p&gt;First, it contacts the Root Server. This server doesn’t give the exact IP, but it tells where to find the next level.&lt;/p&gt;

&lt;p&gt;Next, it goes to the Top-Level Domain (TLD) server. For example, if I typed .com, it goes to the .com server. This server again doesn’t give the full answer but points to the next server.&lt;/p&gt;

&lt;p&gt;After that, the resolver contacts the Authoritative Name Server. This is the final place where the actual IP address of the website is stored. This server gives the correct IP address.&lt;/p&gt;

&lt;p&gt;Now the resolver gets the IP and sends it back to my browser. Also, it stores this IP in cache for some time, so next time it will be faster.&lt;/p&gt;

&lt;p&gt;Finally, my browser uses this IP address to connect to the server and load the website.&lt;/p&gt;

&lt;p&gt;Even though this process involves multiple steps, it happens very fast, in just milliseconds. That’s why I feel like the website opens instantly.&lt;/p&gt;

&lt;p&gt;This is how DNS resolving works whenever I search for any website on the internet.&lt;/p&gt;

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