<?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: Mahek Rathod</title>
    <description>The latest articles on DEV Community by Mahek Rathod (@mahek_rathod_6137282bf899).</description>
    <link>https://dev.to/mahek_rathod_6137282bf899</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.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4260628%2F4508038c-8e86-434d-8d5c-3e2884756803.png</url>
      <title>DEV Community: Mahek Rathod</title>
      <link>https://dev.to/mahek_rathod_6137282bf899</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mahek_rathod_6137282bf899"/>
    <language>en</language>
    <item>
      <title>What Is a SQL JOIN? A Simple Guide for Beginners</title>
      <dc:creator>Mahek Rathod</dc:creator>
      <pubDate>Mon, 23 Nov 2026 12:52:57 +0000</pubDate>
      <link>https://dev.to/mahek_rathod_6137282bf899/what-is-a-sql-join-a-simple-guide-for-beginners-3o2m</link>
      <guid>https://dev.to/mahek_rathod_6137282bf899/what-is-a-sql-join-a-simple-guide-for-beginners-3o2m</guid>
      <description>&lt;p&gt;When working with databases, information is often stored in different tables. For example, a company may keep customer details in one table and order details in another.&lt;/p&gt;

&lt;p&gt;But what if we want to see customer names along with their orders? Do we need to check both tables separately?&lt;/p&gt;

&lt;p&gt;No! SQL provides a useful feature called &lt;strong&gt;JOIN&lt;/strong&gt; that helps combine information from multiple tables.&lt;/p&gt;

&lt;p&gt;Let's understand SQL JOINs with simple examples.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Is a SQL JOIN?
&lt;/h2&gt;

&lt;p&gt;A SQL JOIN is used to combine data from two or more tables based on a related column.&lt;/p&gt;

&lt;p&gt;For example, imagine we have two tables.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Customers Table&lt;/strong&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Customer_ID&lt;/th&gt;
&lt;th&gt;Name&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;Rahul&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;Priya&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;Amit&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Orders Table&lt;/strong&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Order_ID&lt;/th&gt;
&lt;th&gt;Customer_ID&lt;/th&gt;
&lt;th&gt;Product&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;101&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;Laptop&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;102&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;Mobile&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;103&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;Headphones&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Both tables have a common column called Customer_ID.&lt;/p&gt;

&lt;p&gt;Using a SQL JOIN, we can combine these tables and find out which customer purchased which product.&lt;/p&gt;

&lt;h2&gt;
  
  
  Types of SQL JOINs
&lt;/h2&gt;

&lt;p&gt;There are four commonly used types of SQL JOINs.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. INNER JOIN
&lt;/h3&gt;

&lt;p&gt;INNER JOIN returns only the records that have matching values in both tables.&lt;/p&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="nc"&gt;Customers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;Orders&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Product&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="nc"&gt;Customers&lt;/span&gt;
&lt;span class="k"&gt;INNER&lt;/span&gt; &lt;span class="k"&gt;JOIN&lt;/span&gt; &lt;span class="nc"&gt;Orders&lt;/span&gt;
&lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="nc"&gt;Customers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Customer_ID&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Orders&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Customer_ID&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This query displays the names of customers who have placed orders along with their purchased products.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. LEFT JOIN
&lt;/h3&gt;

&lt;p&gt;LEFT JOIN returns all records from the left table and matching records from the right table.&lt;/p&gt;

&lt;p&gt;If there is no match, the result from the right table will show NULL.&lt;/p&gt;

&lt;p&gt;It is useful when you want to see all customers, including those who have not placed any orders.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. RIGHT JOIN
&lt;/h3&gt;

&lt;p&gt;RIGHT JOIN returns all records from the right table and matching records from the left table.&lt;/p&gt;

&lt;p&gt;If there is no match, the missing values from the left table appear as NULL.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. FULL OUTER JOIN
&lt;/h3&gt;

&lt;p&gt;FULL OUTER JOIN returns all records from both tables.&lt;/p&gt;

&lt;p&gt;It includes matching records as well as records that do not have a match in the other table.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Are SQL JOINs Important?
&lt;/h2&gt;

&lt;p&gt;SQL JOINs are useful because they help us:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Combine information from different tables.&lt;/li&gt;
&lt;li&gt;Find customer and order details together.&lt;/li&gt;
&lt;li&gt;Analyse business information.&lt;/li&gt;
&lt;li&gt;Generate reports.&lt;/li&gt;
&lt;li&gt;Work with large databases more easily.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;They are commonly used in Data Analytics, banking, e-commerce, and software development.&lt;/p&gt;

&lt;h2&gt;
  
  
  Frequently Asked Questions
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Is SQL JOIN difficult to learn?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;No. Beginners can understand JOINs by practising with small tables and simple examples.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Which SQL JOIN is most commonly used?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;INNER JOIN and LEFT JOIN are commonly used in everyday database queries.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Can we join more than two tables in SQL?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Yes. SQL allows you to join multiple tables using related columns.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What happens when there is no matching record?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The result depends on the JOIN type. For example, LEFT JOIN keeps all records from the left table and shows NULL for unmatched right-table values.&lt;/p&gt;

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

&lt;p&gt;SQL JOIN is an important concept that helps combine information stored in different database tables. Understanding INNER JOIN, LEFT JOIN, RIGHT JOIN, and FULL OUTER JOIN makes working with databases much easier.&lt;/p&gt;

&lt;p&gt;If you are learning SQL for the first time, practise each JOIN using sample tables. Once you understand how they work, you will find it easier to write queries and analyse data.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Suggested SEO Keywords:&lt;/strong&gt; What Is SQL JOIN, SQL JOIN Explained, Types of SQL JOIN, INNER JOIN, LEFT JOIN, RIGHT JOIN, FULL OUTER JOIN, SQL JOIN Examples, SQL for Beginners.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>webdev</category>
      <category>programming</category>
      <category>productivity</category>
    </item>
    <item>
      <title>What Is a Primary Key in SQL? A Simple Guide for Beginners</title>
      <dc:creator>Mahek Rathod</dc:creator>
      <pubDate>Mon, 23 Nov 2026 12:50:01 +0000</pubDate>
      <link>https://dev.to/mahek_rathod_6137282bf899/what-is-a-primary-key-in-sql-a-simple-guide-for-beginners-4j94</link>
      <guid>https://dev.to/mahek_rathod_6137282bf899/what-is-a-primary-key-in-sql-a-simple-guide-for-beginners-4j94</guid>
      <description>&lt;p&gt;When working with databases, we often store information about students, employees, customers, and products. But how do we identify each record separately, especially when many people have the same name?&lt;/p&gt;

&lt;p&gt;This is where a &lt;strong&gt;Primary Key in SQL&lt;/strong&gt; becomes important.&lt;/p&gt;

&lt;p&gt;A primary key helps identify each record in a database table uniquely. Let's understand what it means with simple examples.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Is a Primary Key in SQL?
&lt;/h2&gt;

&lt;p&gt;A primary key is a column, or a combination of columns, that uniquely identifies every row in a database table.&lt;/p&gt;

&lt;p&gt;In simple words, it works like an ID number. Every record has its own unique value, making it easier to find and manage information.&lt;/p&gt;

&lt;p&gt;For example, imagine a student database:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Student_ID&lt;/th&gt;
&lt;th&gt;Name&lt;/th&gt;
&lt;th&gt;Age&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;101&lt;/td&gt;
&lt;td&gt;Rahul&lt;/td&gt;
&lt;td&gt;22&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;102&lt;/td&gt;
&lt;td&gt;Priya&lt;/td&gt;
&lt;td&gt;21&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;103&lt;/td&gt;
&lt;td&gt;Amit&lt;/td&gt;
&lt;td&gt;23&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Here, Student_ID is the primary key because every student has a different ID.&lt;/p&gt;

&lt;p&gt;Even if two students have the same name, their Student_ID values will be different.&lt;/p&gt;

&lt;h2&gt;
  
  
  Rules of a Primary Key
&lt;/h2&gt;

&lt;p&gt;A primary key follows a few important rules:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Unique Values:&lt;/strong&gt; Every record must have a different primary key value.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No NULL Values:&lt;/strong&gt; A primary key cannot contain empty or NULL values.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Only One Primary Key:&lt;/strong&gt; A table can have only one primary key constraint.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Multiple Columns:&lt;/strong&gt; A primary key can contain more than one column. This is called a composite primary key.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  How to Create a Primary Key in SQL?
&lt;/h2&gt;

&lt;p&gt;You can create a primary key while creating a database table.&lt;/p&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;TABLE&lt;/span&gt; &lt;span class="nc"&gt;Students&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="nc"&gt;Student_ID&lt;/span&gt; &lt;span class="kt"&gt;INT&lt;/span&gt; &lt;span class="k"&gt;PRIMARY&lt;/span&gt; &lt;span class="k"&gt;KEY&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nc"&gt;Name&lt;/span&gt; &lt;span class="kt"&gt;VARCHAR&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nc"&gt;Age&lt;/span&gt; &lt;span class="kt"&gt;INT&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, Student_ID is defined as the primary key.&lt;/p&gt;

&lt;p&gt;This means every student must have a unique ID.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Is a Primary Key Important?
&lt;/h2&gt;

&lt;p&gt;Primary keys play an important role in database management.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Identifies Records:&lt;/strong&gt; Helps identify individual rows easily.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Avoids Duplicate IDs:&lt;/strong&gt; Prevents the same key value from being entered twice.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Connects Tables:&lt;/strong&gt; Helps create relationships between different tables.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Improves Data Management:&lt;/strong&gt; Makes it easier to search, update, and manage records.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Difference Between Primary Key and Foreign Key
&lt;/h2&gt;

&lt;p&gt;Beginners often confuse primary keys with foreign keys.&lt;/p&gt;

&lt;p&gt;The difference is simple:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Primary Key:&lt;/strong&gt; Uniquely identifies a record in its own table.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Foreign Key:&lt;/strong&gt; Refers to a key in another table and helps establish a relationship between tables.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example, a Students table may have Student_ID as its primary key. A Fees table can use Student_ID as a foreign key to connect fee records with students.&lt;/p&gt;

&lt;h2&gt;
  
  
  Frequently Asked Questions
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Can a primary key contain duplicate values?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;No. Every primary key value must be unique.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Can a primary key be NULL?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;No. A primary key cannot contain NULL values.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Can a table have two primary keys?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A table can have only one primary key constraint, but that key can consist of multiple columns.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Is a primary key important in SQL?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Yes. It helps identify records and maintain relationships between database tables.&lt;/p&gt;

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

&lt;p&gt;A primary key is one of the most important concepts in SQL and database management. It helps uniquely identify records, avoid duplicate key values, and connect different tables.&lt;/p&gt;

&lt;p&gt;If you are learning SQL, understanding primary keys is a good starting point before moving on to foreign keys, SQL JOINs, and database relationships.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Suggested SEO Keywords:&lt;/strong&gt; Primary Key in SQL, What Is a Primary Key, SQL Primary Key Explained, Primary Key Examples, Database Primary Key, SQL for Beginners.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>webdev</category>
      <category>programming</category>
      <category>productivity</category>
    </item>
  </channel>
</rss>
