<?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: Neeraj Kumar</title>
    <description>The latest articles on DEV Community by Neeraj Kumar (@neeraj1997dev).</description>
    <link>https://dev.to/neeraj1997dev</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%2F935406%2F330de826-b195-4c51-a6fe-8211c60508cc.png</url>
      <title>DEV Community: Neeraj Kumar</title>
      <link>https://dev.to/neeraj1997dev</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/neeraj1997dev"/>
    <language>en</language>
    <item>
      <title>Day 2: Advanced SQL Preparation Guide</title>
      <dc:creator>Neeraj Kumar</dc:creator>
      <pubDate>Thu, 05 Feb 2026 01:30:08 +0000</pubDate>
      <link>https://dev.to/neeraj1997dev/day-2-advanced-sql-preparation-guide-4p85</link>
      <guid>https://dev.to/neeraj1997dev/day-2-advanced-sql-preparation-guide-4p85</guid>
      <description>&lt;h2&gt;
  
  
  Objectives
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Select and download suitable datasets&lt;/li&gt;
&lt;li&gt;Set up PostgreSQL environment&lt;/li&gt;
&lt;li&gt;Practice basic queries as foundation&lt;/li&gt;
&lt;li&gt;Prepare for CTEs, window functions, and query optimization&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Part 1: Dataset Selection
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Recommended Datasets
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Dataset 1: E-commerce Sales Data (Primary)
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Source:&lt;/strong&gt; Kaggle - "Superstore Sales Dataset"&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;URL:&lt;/strong&gt; &lt;a href="https://www.kaggle.com/datasets/vivek468/superstore-dataset-final" rel="noopener noreferrer"&gt;https://www.kaggle.com/datasets/vivek468/superstore-dataset-final&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Why it's ideal:&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;Multiple tables (orders, customers, products)&lt;/li&gt;
&lt;li&gt;Time-series data (perfect for window functions)&lt;/li&gt;
&lt;li&gt;Sales metrics (great for aggregations and CTEs)&lt;/li&gt;
&lt;li&gt;~10,000 rows (manageable size)&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Key columns:&lt;/strong&gt; Order ID, Customer ID, Product, Category, Sales, Profit, Quantity, Order Date, Ship Date&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Advanced SQL use cases:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Running totals and moving averages (window functions)&lt;/li&gt;
&lt;li&gt;Customer cohort analysis (CTEs)&lt;/li&gt;
&lt;li&gt;Sales ranking by region/category (RANK, DENSE_RANK)&lt;/li&gt;
&lt;li&gt;Year-over-year comparisons&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Dataset 2: Employee/HR Data (Secondary)
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Source:&lt;/strong&gt; Kaggle - "HR Analytics Dataset"&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;URL:&lt;/strong&gt; &lt;a href="https://www.kaggle.com/datasets/pavansubhasht/ibm-hr-analytics-attrition-dataset" rel="noopener noreferrer"&gt;https://www.kaggle.com/datasets/pavansubhasht/ibm-hr-analytics-attrition-dataset&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Why it's useful:&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;Employee hierarchy (good for recursive CTEs)&lt;/li&gt;
&lt;li&gt;Salary and performance data&lt;/li&gt;
&lt;li&gt;Attrition tracking&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Advanced SQL use cases:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Employee tenure analysis&lt;/li&gt;
&lt;li&gt;Salary percentiles by department&lt;/li&gt;
&lt;li&gt;Retention rate calculations&lt;/li&gt;
&lt;li&gt;Manager-employee relationships&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Alternative Dataset Options:
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Option A: COVID-19 Data&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Source:&lt;/strong&gt; Our World in Data&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;URL:&lt;/strong&gt; &lt;a href="https://github.com/owid/covid-19-data/tree/master/public/data" rel="noopener noreferrer"&gt;https://github.com/owid/covid-19-data/tree/master/public/data&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Time-series perfect for window functions&lt;/li&gt;
&lt;li&gt;Country comparisons&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Option B: Airbnb Listings&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Source:&lt;/strong&gt; Inside Airbnb&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;URL:&lt;/strong&gt; &lt;a href="http://insideairbnb.com/get-the-data/" rel="noopener noreferrer"&gt;http://insideairbnb.com/get-the-data/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Price analysis, availability patterns&lt;/li&gt;
&lt;li&gt;Geographic data for spatial queries&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Part 2: PostgreSQL Setup
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Installation
&lt;/h3&gt;

&lt;h4&gt;
  
  
  On macOS:
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Using Homebrew&lt;/span&gt;
brew &lt;span class="nb"&gt;install &lt;/span&gt;postgresql@15

&lt;span class="c"&gt;# Start PostgreSQL service&lt;/span&gt;
brew services start postgresql@15

&lt;span class="c"&gt;# Verify installation&lt;/span&gt;
psql &lt;span class="nt"&gt;--version&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  On Ubuntu/Debian:
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Update package list&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt update

&lt;span class="c"&gt;# Install PostgreSQL&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt &lt;span class="nb"&gt;install &lt;/span&gt;postgresql postgresql-contrib

&lt;span class="c"&gt;# Start service&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl start postgresql
&lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl &lt;span class="nb"&gt;enable &lt;/span&gt;postgresql

&lt;span class="c"&gt;# Switch to postgres user&lt;/span&gt;
&lt;span class="nb"&gt;sudo&lt;/span&gt; &lt;span class="nt"&gt;-u&lt;/span&gt; postgres psql
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  On Windows:
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;Download installer from: &lt;a href="https://www.postgresql.org/download/windows/" rel="noopener noreferrer"&gt;https://www.postgresql.org/download/windows/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Run the installer (includes pgAdmin 4)&lt;/li&gt;
&lt;li&gt;Remember your superuser password&lt;/li&gt;
&lt;li&gt;Add PostgreSQL bin to PATH&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Initial Configuration
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="c1"&gt;-- Connect to PostgreSQL&lt;/span&gt;
&lt;span class="n"&gt;psql&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;U&lt;/span&gt; &lt;span class="n"&gt;postgres&lt;/span&gt;

&lt;span class="c1"&gt;-- Create a database for practice&lt;/span&gt;
&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;DATABASE&lt;/span&gt; &lt;span class="n"&gt;data_engineering_practice&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;-- Connect to the new database&lt;/span&gt;
&lt;span class="err"&gt;\&lt;/span&gt;&lt;span class="k"&gt;c&lt;/span&gt; &lt;span class="n"&gt;data_engineering_practice&lt;/span&gt;

&lt;span class="c1"&gt;-- Create a user (optional)&lt;/span&gt;
&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;USER&lt;/span&gt; &lt;span class="n"&gt;data_engineer&lt;/span&gt; &lt;span class="k"&gt;WITH&lt;/span&gt; &lt;span class="n"&gt;PASSWORD&lt;/span&gt; &lt;span class="s1"&gt;'your_password'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;GRANT&lt;/span&gt; &lt;span class="k"&gt;ALL&lt;/span&gt; &lt;span class="k"&gt;PRIVILEGES&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="k"&gt;DATABASE&lt;/span&gt; &lt;span class="n"&gt;data_engineering_practice&lt;/span&gt; &lt;span class="k"&gt;TO&lt;/span&gt; &lt;span class="n"&gt;data_engineer&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Useful PostgreSQL Commands
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="c1"&gt;-- List all databases&lt;/span&gt;
&lt;span class="err"&gt;\&lt;/span&gt;&lt;span class="n"&gt;l&lt;/span&gt;

&lt;span class="c1"&gt;-- List all tables in current database&lt;/span&gt;
&lt;span class="err"&gt;\&lt;/span&gt;&lt;span class="n"&gt;dt&lt;/span&gt;

&lt;span class="c1"&gt;-- Describe table structure&lt;/span&gt;
&lt;span class="err"&gt;\&lt;/span&gt;&lt;span class="n"&gt;d&lt;/span&gt; &lt;span class="k"&gt;table_name&lt;/span&gt;

&lt;span class="c1"&gt;-- List all schemas&lt;/span&gt;
&lt;span class="err"&gt;\&lt;/span&gt;&lt;span class="n"&gt;dn&lt;/span&gt;

&lt;span class="c1"&gt;-- Quit psql&lt;/span&gt;
&lt;span class="err"&gt;\&lt;/span&gt;&lt;span class="n"&gt;q&lt;/span&gt;

&lt;span class="c1"&gt;-- Execute SQL from file&lt;/span&gt;
&lt;span class="err"&gt;\&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="k"&gt;to&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;file&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;sql&lt;/span&gt;

&lt;span class="c1"&gt;-- Show query execution time&lt;/span&gt;
&lt;span class="err"&gt;\&lt;/span&gt;&lt;span class="n"&gt;timing&lt;/span&gt; &lt;span class="k"&gt;on&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Part 3: Loading Your Data
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Method 1: Using COPY (Fastest for CSV)
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="c1"&gt;-- Create table structure first&lt;/span&gt;
&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;TABLE&lt;/span&gt; &lt;span class="n"&gt;superstore_sales&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;row_id&lt;/span&gt; &lt;span class="nb"&gt;SERIAL&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="n"&gt;order_id&lt;/span&gt; &lt;span class="nb"&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="n"&gt;order_date&lt;/span&gt; &lt;span class="nb"&gt;DATE&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;ship_date&lt;/span&gt; &lt;span class="nb"&gt;DATE&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;ship_mode&lt;/span&gt; &lt;span class="nb"&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="n"&gt;customer_id&lt;/span&gt; &lt;span class="nb"&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="n"&gt;customer_name&lt;/span&gt; &lt;span class="nb"&gt;VARCHAR&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="n"&gt;segment&lt;/span&gt; &lt;span class="nb"&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="n"&gt;country&lt;/span&gt; &lt;span class="nb"&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="n"&gt;city&lt;/span&gt; &lt;span class="nb"&gt;VARCHAR&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="k"&gt;state&lt;/span&gt; &lt;span class="nb"&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="n"&gt;postal_code&lt;/span&gt; &lt;span class="nb"&gt;VARCHAR&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="n"&gt;region&lt;/span&gt; &lt;span class="nb"&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="n"&gt;product_id&lt;/span&gt; &lt;span class="nb"&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="n"&gt;category&lt;/span&gt; &lt;span class="nb"&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="n"&gt;sub_category&lt;/span&gt; &lt;span class="nb"&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="n"&gt;product_name&lt;/span&gt; &lt;span class="nb"&gt;VARCHAR&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;255&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="n"&gt;sales&lt;/span&gt; &lt;span class="nb"&gt;DECIMAL&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;10&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="n"&gt;quantity&lt;/span&gt; &lt;span class="nb"&gt;INTEGER&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;discount&lt;/span&gt; &lt;span class="nb"&gt;DECIMAL&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;2&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="n"&gt;profit&lt;/span&gt; &lt;span class="nb"&gt;DECIMAL&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;10&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="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;-- Load CSV data&lt;/span&gt;
&lt;span class="k"&gt;COPY&lt;/span&gt; &lt;span class="n"&gt;superstore_sales&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;order_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;order_date&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;ship_date&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;ship_mode&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
                      &lt;span class="n"&gt;customer_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;customer_name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;segment&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;country&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
                      &lt;span class="n"&gt;city&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;state&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;postal_code&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;region&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;product_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
                      &lt;span class="n"&gt;category&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;sub_category&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;product_name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;sales&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
                      &lt;span class="n"&gt;quantity&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;discount&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;profit&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="s1"&gt;'/path/to/superstore.csv'&lt;/span&gt;
&lt;span class="k"&gt;DELIMITER&lt;/span&gt; &lt;span class="s1"&gt;','&lt;/span&gt;
&lt;span class="n"&gt;CSV&lt;/span&gt; &lt;span class="n"&gt;HEADER&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Method 2: Using pgAdmin GUI
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Right-click on table → Import/Export&lt;/li&gt;
&lt;li&gt;Select file and format&lt;/li&gt;
&lt;li&gt;Map columns&lt;/li&gt;
&lt;li&gt;Import&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Method 3: Using Python (for data cleaning)
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;pandas&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;sqlalchemy&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;create_engine&lt;/span&gt;

&lt;span class="c1"&gt;# Read and clean data
&lt;/span&gt;&lt;span class="n"&gt;df&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;read_csv&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;superstore.csv&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Connect to PostgreSQL
&lt;/span&gt;&lt;span class="n"&gt;engine&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;create_engine&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;postgresql://username:password@localhost:5432/data_engineering_practice&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Load to database
&lt;/span&gt;&lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;to_sql&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;superstore_sales&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;engine&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;if_exists&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;replace&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;index&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;False&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Part 4: Basic SQL Practice Queries
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Query Set 1: Basic SELECT and Filtering
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="c1"&gt;-- 1. View first 10 rows&lt;/span&gt;
&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;superstore_sales&lt;/span&gt; &lt;span class="k"&gt;LIMIT&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;-- 2. Count total orders&lt;/span&gt;
&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="k"&gt;COUNT&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;DISTINCT&lt;/span&gt; &lt;span class="n"&gt;order_id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;total_orders&lt;/span&gt; 
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;superstore_sales&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;-- 3. Filter by category&lt;/span&gt;
&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;superstore_sales&lt;/span&gt; 
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;category&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'Technology'&lt;/span&gt; 
&lt;span class="k"&gt;LIMIT&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;-- 4. Multiple conditions&lt;/span&gt;
&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;customer_name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;sales&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;profit&lt;/span&gt; 
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;superstore_sales&lt;/span&gt; 
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;region&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'West'&lt;/span&gt; 
  &lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="n"&gt;sales&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt; 
  &lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="n"&gt;order_date&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="s1"&gt;'2017-01-01'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;-- 5. Pattern matching&lt;/span&gt;
&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="k"&gt;DISTINCT&lt;/span&gt; &lt;span class="n"&gt;product_name&lt;/span&gt; 
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;superstore_sales&lt;/span&gt; 
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;product_name&lt;/span&gt; &lt;span class="k"&gt;LIKE&lt;/span&gt; &lt;span class="s1"&gt;'%Chair%'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Query Set 2: Aggregations
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="c1"&gt;-- 6. Total sales by category&lt;/span&gt;
&lt;span class="k"&gt;SELECT&lt;/span&gt; 
    &lt;span class="n"&gt;category&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="k"&gt;SUM&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sales&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;total_sales&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="k"&gt;SUM&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;profit&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;total_profit&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="k"&gt;COUNT&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;order_count&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;superstore_sales&lt;/span&gt;
&lt;span class="k"&gt;GROUP&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;category&lt;/span&gt;
&lt;span class="k"&gt;ORDER&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;total_sales&lt;/span&gt; &lt;span class="k"&gt;DESC&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;-- 7. Average discount by segment&lt;/span&gt;
&lt;span class="k"&gt;SELECT&lt;/span&gt; 
    &lt;span class="n"&gt;segment&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="k"&gt;AVG&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;discount&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;avg_discount&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="k"&gt;MIN&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;discount&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;min_discount&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="k"&gt;MAX&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;discount&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;max_discount&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;superstore_sales&lt;/span&gt;
&lt;span class="k"&gt;GROUP&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;segment&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;-- 8. Monthly sales trend&lt;/span&gt;
&lt;span class="k"&gt;SELECT&lt;/span&gt; 
    &lt;span class="n"&gt;DATE_TRUNC&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'month'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;order_date&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="k"&gt;month&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="k"&gt;SUM&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sales&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;monthly_sales&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="k"&gt;COUNT&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;DISTINCT&lt;/span&gt; &lt;span class="n"&gt;order_id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;order_count&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;superstore_sales&lt;/span&gt;
&lt;span class="k"&gt;GROUP&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;DATE_TRUNC&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'month'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;order_date&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;ORDER&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="k"&gt;month&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;-- 9. HAVING clause&lt;/span&gt;
&lt;span class="k"&gt;SELECT&lt;/span&gt; 
    &lt;span class="n"&gt;customer_name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="k"&gt;SUM&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sales&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;total_spent&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;superstore_sales&lt;/span&gt;
&lt;span class="k"&gt;GROUP&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;customer_name&lt;/span&gt;
&lt;span class="k"&gt;HAVING&lt;/span&gt; &lt;span class="k"&gt;SUM&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sales&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;5000&lt;/span&gt;
&lt;span class="k"&gt;ORDER&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;total_spent&lt;/span&gt; &lt;span class="k"&gt;DESC&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Query Set 3: JOIN Preparation
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="c1"&gt;-- Create dimension tables for practice&lt;/span&gt;

&lt;span class="c1"&gt;-- Customer dimension&lt;/span&gt;
&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;TABLE&lt;/span&gt; &lt;span class="n"&gt;customers&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt;
&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="k"&gt;DISTINCT&lt;/span&gt;
    &lt;span class="n"&gt;customer_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;customer_name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;segment&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;country&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;city&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="k"&gt;state&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;region&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;superstore_sales&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;-- Product dimension&lt;/span&gt;
&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;TABLE&lt;/span&gt; &lt;span class="n"&gt;products&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt;
&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="k"&gt;DISTINCT&lt;/span&gt;
    &lt;span class="n"&gt;product_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;product_name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;category&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;sub_category&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;superstore_sales&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;-- Fact table (orders)&lt;/span&gt;
&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;TABLE&lt;/span&gt; &lt;span class="n"&gt;orders&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt;
&lt;span class="k"&gt;SELECT&lt;/span&gt; 
    &lt;span class="n"&gt;row_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;order_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;order_date&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;ship_date&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;ship_mode&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;customer_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;product_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;sales&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;quantity&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;discount&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;profit&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;superstore_sales&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;-- 10. INNER JOIN&lt;/span&gt;
&lt;span class="k"&gt;SELECT&lt;/span&gt; 
    &lt;span class="n"&gt;o&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;order_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="k"&gt;c&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;customer_name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;product_name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;o&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;sales&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;orders&lt;/span&gt; &lt;span class="n"&gt;o&lt;/span&gt;
&lt;span class="k"&gt;INNER&lt;/span&gt; &lt;span class="k"&gt;JOIN&lt;/span&gt; &lt;span class="n"&gt;customers&lt;/span&gt; &lt;span class="k"&gt;c&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;o&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;customer_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;c&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;customer_id&lt;/span&gt;
&lt;span class="k"&gt;INNER&lt;/span&gt; &lt;span class="k"&gt;JOIN&lt;/span&gt; &lt;span class="n"&gt;products&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;o&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;product_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;product_id&lt;/span&gt;
&lt;span class="k"&gt;LIMIT&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;-- 11. LEFT JOIN with NULL check&lt;/span&gt;
&lt;span class="k"&gt;SELECT&lt;/span&gt; 
    &lt;span class="k"&gt;c&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;customer_name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="k"&gt;COUNT&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;o&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;order_id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;order_count&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;COALESCE&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;SUM&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;o&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;sales&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;total_sales&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;customers&lt;/span&gt; &lt;span class="k"&gt;c&lt;/span&gt;
&lt;span class="k"&gt;LEFT&lt;/span&gt; &lt;span class="k"&gt;JOIN&lt;/span&gt; &lt;span class="n"&gt;orders&lt;/span&gt; &lt;span class="n"&gt;o&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="k"&gt;c&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;customer_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;o&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;customer_id&lt;/span&gt;
&lt;span class="k"&gt;GROUP&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="k"&gt;c&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;customer_name&lt;/span&gt;
&lt;span class="k"&gt;ORDER&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;order_count&lt;/span&gt; &lt;span class="k"&gt;DESC&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Query Set 4: Subqueries (Foundation for CTEs)
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="c1"&gt;-- 12. Subquery in WHERE&lt;/span&gt;
&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;superstore_sales&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;sales&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="k"&gt;AVG&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sales&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;superstore_sales&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;-- 13. Subquery in FROM&lt;/span&gt;
&lt;span class="k"&gt;SELECT&lt;/span&gt; 
    &lt;span class="n"&gt;category&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;avg_sales&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="k"&gt;CASE&lt;/span&gt; 
        &lt;span class="k"&gt;WHEN&lt;/span&gt; &lt;span class="n"&gt;avg_sales&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;overall_avg&lt;/span&gt; &lt;span class="k"&gt;THEN&lt;/span&gt; &lt;span class="s1"&gt;'Above Average'&lt;/span&gt;
        &lt;span class="k"&gt;ELSE&lt;/span&gt; &lt;span class="s1"&gt;'Below Average'&lt;/span&gt;
    &lt;span class="k"&gt;END&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;performance&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="k"&gt;SELECT&lt;/span&gt; 
        &lt;span class="n"&gt;category&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="k"&gt;AVG&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sales&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;avg_sales&lt;/span&gt;
    &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;superstore_sales&lt;/span&gt;
    &lt;span class="k"&gt;GROUP&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;category&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;cat_avg&lt;/span&gt;
&lt;span class="k"&gt;CROSS&lt;/span&gt; &lt;span class="k"&gt;JOIN&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="k"&gt;AVG&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sales&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;overall_avg&lt;/span&gt; 
    &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;superstore_sales&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;overall&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;-- 14. Correlated subquery&lt;/span&gt;
&lt;span class="k"&gt;SELECT&lt;/span&gt; 
    &lt;span class="n"&gt;s1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;category&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;s1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;product_name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;s1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;sales&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;superstore_sales&lt;/span&gt; &lt;span class="n"&gt;s1&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;s1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;sales&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="k"&gt;MAX&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;s2&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;sales&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;superstore_sales&lt;/span&gt; &lt;span class="n"&gt;s2&lt;/span&gt;
    &lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;s2&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;category&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;s1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;category&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Part 5: Preview of Advanced Concepts
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Window Functions Teaser
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="c1"&gt;-- Running total of sales over time&lt;/span&gt;
&lt;span class="k"&gt;SELECT&lt;/span&gt; 
    &lt;span class="n"&gt;order_date&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;sales&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="k"&gt;SUM&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sales&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;OVER&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;ORDER&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;order_date&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;running_total&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;superstore_sales&lt;/span&gt;
&lt;span class="k"&gt;ORDER&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;order_date&lt;/span&gt;
&lt;span class="k"&gt;LIMIT&lt;/span&gt; &lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;-- Rank products by sales within each category&lt;/span&gt;
&lt;span class="k"&gt;SELECT&lt;/span&gt; 
    &lt;span class="n"&gt;category&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;product_name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="k"&gt;SUM&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sales&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;total_sales&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;RANK&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="n"&gt;OVER&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;PARTITION&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;category&lt;/span&gt; &lt;span class="k"&gt;ORDER&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="k"&gt;SUM&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sales&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;DESC&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;rank_in_category&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;superstore_sales&lt;/span&gt;
&lt;span class="k"&gt;GROUP&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;category&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;product_name&lt;/span&gt;
&lt;span class="k"&gt;ORDER&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;category&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;rank_in_category&lt;/span&gt;
&lt;span class="k"&gt;LIMIT&lt;/span&gt; &lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  CTEs (Common Table Expressions) Teaser
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="c1"&gt;-- Using WITH clause&lt;/span&gt;
&lt;span class="k"&gt;WITH&lt;/span&gt; &lt;span class="n"&gt;monthly_sales&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="k"&gt;SELECT&lt;/span&gt; 
        &lt;span class="n"&gt;DATE_TRUNC&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'month'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;order_date&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="k"&gt;month&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="k"&gt;SUM&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sales&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;total_sales&lt;/span&gt;
    &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;superstore_sales&lt;/span&gt;
    &lt;span class="k"&gt;GROUP&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;DATE_TRUNC&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'month'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;order_date&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;SELECT&lt;/span&gt; 
    &lt;span class="k"&gt;month&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;total_sales&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;LAG&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;total_sales&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;OVER&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;ORDER&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="k"&gt;month&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;previous_month&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;total_sales&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;LAG&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;total_sales&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;OVER&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;ORDER&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="k"&gt;month&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;month_over_month_change&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;monthly_sales&lt;/span&gt;
&lt;span class="k"&gt;ORDER&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="k"&gt;month&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Part 6: Practice Exercises
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Exercise 1: Data Exploration
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;How many unique customers are there?&lt;/li&gt;
&lt;li&gt;What date range does the dataset cover?&lt;/li&gt;
&lt;li&gt;Which region has the highest total sales?&lt;/li&gt;
&lt;li&gt;What's the average order value?&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Exercise 2: Business Questions
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Find the top 10 customers by total profit&lt;/li&gt;
&lt;li&gt;Which product category has the highest profit margin?&lt;/li&gt;
&lt;li&gt;What's the average delivery time (ship_date - order_date)?&lt;/li&gt;
&lt;li&gt;Which month had the highest sales in 2017?&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Exercise 3: Complex Queries
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Find customers who made purchases in all four regions&lt;/li&gt;
&lt;li&gt;Calculate the percentage of sales each category contributes&lt;/li&gt;
&lt;li&gt;Find products that were never discounted&lt;/li&gt;
&lt;li&gt;Identify customers whose average order value is above the overall average&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Exercise 4: Data Quality Checks
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="c1"&gt;-- Check for NULL values&lt;/span&gt;
&lt;span class="k"&gt;SELECT&lt;/span&gt; 
    &lt;span class="k"&gt;COUNT&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;total_rows&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="k"&gt;COUNT&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;order_id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;non_null_orders&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="k"&gt;COUNT&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;customer_id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;non_null_customers&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="k"&gt;COUNT&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sales&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;non_null_sales&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;superstore_sales&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;-- Check for duplicates&lt;/span&gt;
&lt;span class="k"&gt;SELECT&lt;/span&gt; 
    &lt;span class="n"&gt;order_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
    &lt;span class="n"&gt;product_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
    &lt;span class="k"&gt;COUNT&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; 
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;superstore_sales&lt;/span&gt;
&lt;span class="k"&gt;GROUP&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;order_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;product_id&lt;/span&gt;
&lt;span class="k"&gt;HAVING&lt;/span&gt; &lt;span class="k"&gt;COUNT&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;-- Check data ranges&lt;/span&gt;
&lt;span class="k"&gt;SELECT&lt;/span&gt; 
    &lt;span class="k"&gt;MIN&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;order_date&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;earliest_order&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="k"&gt;MAX&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;order_date&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;latest_order&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="k"&gt;MIN&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sales&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;min_sale&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="k"&gt;MAX&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sales&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;max_sale&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="k"&gt;AVG&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sales&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;avg_sale&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;superstore_sales&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Part 7: Performance Tips
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Creating Indexes
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="c1"&gt;-- Create indexes on frequently queried columns&lt;/span&gt;
&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;INDEX&lt;/span&gt; &lt;span class="n"&gt;idx_order_date&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;superstore_sales&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;order_date&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;INDEX&lt;/span&gt; &lt;span class="n"&gt;idx_customer_id&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;superstore_sales&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;customer_id&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;INDEX&lt;/span&gt; &lt;span class="n"&gt;idx_category&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;superstore_sales&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;category&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;INDEX&lt;/span&gt; &lt;span class="n"&gt;idx_region&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;superstore_sales&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;region&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;-- Composite index for common query patterns&lt;/span&gt;
&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;INDEX&lt;/span&gt; &lt;span class="n"&gt;idx_customer_date&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;superstore_sales&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;customer_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;order_date&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  EXPLAIN and Query Analysis
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="c1"&gt;-- See query execution plan&lt;/span&gt;
&lt;span class="k"&gt;EXPLAIN&lt;/span&gt; &lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;superstore_sales&lt;/span&gt; &lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;order_date&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'2017-01-01'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;-- See actual execution stats&lt;/span&gt;
&lt;span class="k"&gt;EXPLAIN&lt;/span&gt; &lt;span class="k"&gt;ANALYZE&lt;/span&gt; 
&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;category&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;SUM&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sales&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; 
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;superstore_sales&lt;/span&gt; 
&lt;span class="k"&gt;GROUP&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;category&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Part 8: Next Steps Checklist
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;[ ] Install PostgreSQL&lt;/li&gt;
&lt;li&gt;[ ] Download 1-2 datasets from recommended sources&lt;/li&gt;
&lt;li&gt;[ ] Create database and load data&lt;/li&gt;
&lt;li&gt;[ ] Complete all basic query exercises&lt;/li&gt;
&lt;li&gt;[ ] Create indexes on key columns&lt;/li&gt;
&lt;li&gt;[ ] Try the window function and CTE teasers&lt;/li&gt;
&lt;li&gt;[ ] Document any questions for the advanced session&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Resources
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Documentation
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;PostgreSQL Official Docs: &lt;a href="https://www.postgresql.org/docs/" rel="noopener noreferrer"&gt;https://www.postgresql.org/docs/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;PostgreSQL Tutorial: &lt;a href="https://www.postgresqltutorial.com/" rel="noopener noreferrer"&gt;https://www.postgresqltutorial.com/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Mode Analytics SQL Tutorial: &lt;a href="https://mode.com/sql-tutorial/" rel="noopener noreferrer"&gt;https://mode.com/sql-tutorial/&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Practice Platforms
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;SQLZoo: &lt;a href="https://sqlzoo.net/" rel="noopener noreferrer"&gt;https://sqlzoo.net/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;LeetCode SQL: &lt;a href="https://leetcode.com/problemset/database/" rel="noopener noreferrer"&gt;https://leetcode.com/problemset/database/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;HackerRank SQL: &lt;a href="https://www.hackerrank.com/domains/sql" rel="noopener noreferrer"&gt;https://www.hackerrank.com/domains/sql&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Tools
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;pgAdmin: PostgreSQL GUI client&lt;/li&gt;
&lt;li&gt;DBeaver: Universal database tool&lt;/li&gt;
&lt;li&gt;DataGrip: JetBrains SQL IDE&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Quick Reference Card
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="c1"&gt;-- CONNECTION&lt;/span&gt;
&lt;span class="n"&gt;psql&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;U&lt;/span&gt; &lt;span class="n"&gt;username&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;d&lt;/span&gt; &lt;span class="n"&gt;database_name&lt;/span&gt;

&lt;span class="c1"&gt;-- COMMON AGGREGATES&lt;/span&gt;
&lt;span class="k"&gt;COUNT&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; &lt;span class="k"&gt;SUM&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; &lt;span class="k"&gt;AVG&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; &lt;span class="k"&gt;MIN&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; &lt;span class="k"&gt;MAX&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="c1"&gt;-- DATE FUNCTIONS&lt;/span&gt;
&lt;span class="n"&gt;DATE_TRUNC&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'month'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;date_column&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;EXTRACT&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;YEAR&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;date_column&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;AGE&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;date1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;date2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;-- STRING FUNCTIONS&lt;/span&gt;
&lt;span class="n"&gt;CONCAT&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; &lt;span class="k"&gt;UPPER&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; &lt;span class="k"&gt;LOWER&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; &lt;span class="k"&gt;SUBSTRING&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="k"&gt;LIKE&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;ILIKE&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;case&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="k"&gt;insensitive&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;-- CONDITIONAL&lt;/span&gt;
&lt;span class="k"&gt;CASE&lt;/span&gt; &lt;span class="k"&gt;WHEN&lt;/span&gt; &lt;span class="p"&gt;...&lt;/span&gt; &lt;span class="k"&gt;THEN&lt;/span&gt; &lt;span class="p"&gt;...&lt;/span&gt; &lt;span class="k"&gt;ELSE&lt;/span&gt; &lt;span class="p"&gt;...&lt;/span&gt; &lt;span class="k"&gt;END&lt;/span&gt;
&lt;span class="n"&gt;COALESCE&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;value1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;value2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;NULLIF&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;value1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;value2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;-- GROUPING&lt;/span&gt;
&lt;span class="k"&gt;GROUP&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;HAVING&lt;/span&gt;
&lt;span class="k"&gt;GROUP&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="k"&gt;ROLLUP&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;CUBE&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;GROUPING&lt;/span&gt; &lt;span class="k"&gt;SETS&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Good luck with your Day 2 preparation! 🚀&lt;/p&gt;

</description>
      <category>dataengineering</category>
      <category>sql</category>
    </item>
    <item>
      <title>Data Engineering Fundamentals &amp; Roadmap (2026 Edition)</title>
      <dc:creator>Neeraj Kumar</dc:creator>
      <pubDate>Wed, 04 Feb 2026 02:07:36 +0000</pubDate>
      <link>https://dev.to/neeraj1997dev/data-engineering-fundamentals-roadmap-2026-edition-26b9</link>
      <guid>https://dev.to/neeraj1997dev/data-engineering-fundamentals-roadmap-2026-edition-26b9</guid>
      <description>&lt;h2&gt;
  
  
  📌 Today's Objective
&lt;/h2&gt;

&lt;p&gt;Build a strong understanding of data engineering fundamentals, its scope, and a clear career roadmap for aspiring data engineers.&lt;/p&gt;




&lt;h2&gt;
  
  
  🔍 1. What is Data Engineering?
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Definition:&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Data Engineering is the practice of designing, building, and maintaining systems that collect, store, process, and analyze data at scale.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key Differentiators:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Data Science&lt;/strong&gt; → Asking questions from data and building models&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Data Engineering&lt;/strong&gt; → Building the infrastructure for data to flow reliably&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Data Analytics&lt;/strong&gt; → Transforming data into actionable business insights&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🎯 2. The Data Engineering Hierarchy of Needs
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;       ┌─────────────────────┐
       │   Data Products     │ ← Machine Learning, Analytics, BI
       └─────────────────────┘
                ↓
       ┌─────────────────────┐
       │   Analytics / ML    │ ← Aggregations, Training, Predictions
       └─────────────────────┘
                ↓
       ┌─────────────────────┐
       │    Transform        │ ← Cleaning, Enrichment, Validation
       └─────────────────────┘
                ↓
       ┌─────────────────────┐
       │      Store          │ ← Databases, Data Lakes, Warehouses
       └─────────────────────┘
                ↓
       ┌─────────────────────┐
       │      Move           │ ← Pipelines, Ingestion, ETL/ELT
       └─────────────────────┘
                ↓
       ┌─────────────────────┐
       │     Collect         │ ← APIs, Databases, Streaming, Files
       └─────────────────────┘
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  ⚙️ 3. Core Pillars of Data Engineering
&lt;/h2&gt;

&lt;h3&gt;
  
  
  A. Data Storage &amp;amp; Databases
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;OLTP Databases:&lt;/strong&gt; PostgreSQL, MySQL, SQL Server&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;OLAP Databases:&lt;/strong&gt; ClickHouse, Apache Druid, DuckDB&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Data Warehouses:&lt;/strong&gt; Snowflake, BigQuery, Redshift, Databricks SQL&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Data Lakes:&lt;/strong&gt; Amazon S3, Azure Data Lake Storage (ADLS) with Delta Lake, Apache Iceberg, Apache Hudi&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;NoSQL:&lt;/strong&gt; MongoDB, Cassandra, DynamoDB, Redis&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  B. Data Processing
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Batch Processing:&lt;/strong&gt; Apache Spark, AWS Glue, Google Dataflow, Databricks&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Stream Processing:&lt;/strong&gt; Apache Kafka, Apache Flink, Spark Streaming, AWS Kinesis&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Orchestration:&lt;/strong&gt; Apache Airflow, Dagster, Prefect, Mage&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  C. Data Modeling
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Star Schema &amp;amp; Snowflake Schema&lt;/strong&gt; (dimensional modeling)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Data Vault 2.0&lt;/strong&gt; (enterprise data warehousing)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Medallion Architecture&lt;/strong&gt; (Bronze → Silver → Gold layers)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;One Big Table (OBT)&lt;/strong&gt; approach for analytics&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  D. Infrastructure &amp;amp; DevOps
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Cloud Platforms:&lt;/strong&gt; AWS, Azure, GCP&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Infrastructure as Code (IaC):&lt;/strong&gt; Terraform, Pulumi, CloudFormation&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Containers:&lt;/strong&gt; Docker, Kubernetes&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;CI/CD:&lt;/strong&gt; GitHub Actions, Jenkins, GitLab CI, CircleCI&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  📊 4. Data Engineer Role Types
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Role Type&lt;/th&gt;
&lt;th&gt;Focus Area&lt;/th&gt;
&lt;th&gt;Key Technologies&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Pipeline Engineer&lt;/td&gt;
&lt;td&gt;ETL/ELT, Data Movement&lt;/td&gt;
&lt;td&gt;Airflow, dbt, Fivetran, Airbyte&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Platform Engineer&lt;/td&gt;
&lt;td&gt;Infrastructure &amp;amp; Tooling&lt;/td&gt;
&lt;td&gt;Kubernetes, Terraform, AWS/GCP&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Analytics Engineer&lt;/td&gt;
&lt;td&gt;Data Modeling &amp;amp; Transformation&lt;/td&gt;
&lt;td&gt;SQL, dbt, Looker, Tableau&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;MLOps Engineer&lt;/td&gt;
&lt;td&gt;ML Pipelines &amp;amp; Serving&lt;/td&gt;
&lt;td&gt;Kubeflow, MLflow, SageMaker, Vertex AI&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  🎯 5. 30-Day Learning Roadmap
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Week 1: Foundations
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Day 1:&lt;/strong&gt; Core Concepts &amp;amp; Roadmap Overview&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Day 2:&lt;/strong&gt; Advanced SQL (CTEs, Window Functions, Optimization)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Day 3:&lt;/strong&gt; Python for Data Engineering (Pandas, APIs, Data Structures)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Day 4:&lt;/strong&gt; Linux &amp;amp; Shell Scripting Basics&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Day 5:&lt;/strong&gt; Git &amp;amp; Version Control Best Practices&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Day 6:&lt;/strong&gt; Docker Fundamentals &amp;amp; Containerization&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Day 7:&lt;/strong&gt; Cloud Basics (AWS/GCP/Azure Introduction)&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Week 2: Storage &amp;amp; Processing
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Days 8-9:&lt;/strong&gt; Databases, Data Warehousing, and Data Lakes&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Days 10-11:&lt;/strong&gt; PySpark &amp;amp; Batch Processing&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Days 12-14:&lt;/strong&gt; Kafka &amp;amp; Real-time Streaming Basics&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Week 3: Orchestration &amp;amp; Pipelines
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Days 15-16:&lt;/strong&gt; ETL vs ELT Patterns&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Days 17-19:&lt;/strong&gt; Apache Airflow (Basics → Advanced DAGs)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Days 20-21:&lt;/strong&gt; dbt &amp;amp; Modern Data Stack Integration&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Day 21:&lt;/strong&gt; Data Quality, Monitoring &amp;amp; Alerting (Great Expectations, Soda)&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Week 4: Advanced Topics &amp;amp; Projects
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Days 22-23:&lt;/strong&gt; Data Modeling &amp;amp; Query Optimization&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Days 24-25:&lt;/strong&gt; Cost Optimization &amp;amp; Infrastructure as Code&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Days 26-27:&lt;/strong&gt; CI/CD for Data Pipelines&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Days 28-30:&lt;/strong&gt; End-to-End Project &amp;amp; Interview Preparation&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  💼 6. Industry Expectations (Entry-Level)
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Technical Skills
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;SQL:&lt;/strong&gt; Window functions, CTEs, query optimization, indexing strategies&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Python:&lt;/strong&gt; Pandas, data manipulation, API integration, OOP concepts&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cloud:&lt;/strong&gt; S3, IAM, Lambda/Cloud Functions, basic networking&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Big Data:&lt;/strong&gt; Spark fundamentals, distributed computing concepts&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Version Control:&lt;/strong&gt; Git workflows, branching strategies, pull requests&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Conceptual Knowledge
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Data modeling principles and normalization&lt;/li&gt;
&lt;li&gt;ETL/ELT pipeline design patterns&lt;/li&gt;
&lt;li&gt;Data quality and testing frameworks&lt;/li&gt;
&lt;li&gt;Distributed systems fundamentals&lt;/li&gt;
&lt;li&gt;Data governance and security basics&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  ✅ 7. Day 1 Action Items
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Immediate Setup
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;[ ] Install Python 3.10+ (latest stable version)&lt;/li&gt;
&lt;li&gt;[ ] Install Docker Desktop&lt;/li&gt;
&lt;li&gt;[ ] Create GitHub account and configure SSH keys&lt;/li&gt;
&lt;li&gt;[ ] Set up VS Code with extensions: Python, Docker, SQL, GitLens&lt;/li&gt;
&lt;li&gt;[ ] Install PostgreSQL locally or use Docker&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Learning &amp;amp; Career Positioning
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;[ ] Watch: "What is Data Engineering?" overview (15-20 mins)&lt;/li&gt;
&lt;li&gt;[ ] Read: &lt;em&gt;Fundamentals of Data Engineering&lt;/em&gt; – Chapter 1&lt;/li&gt;
&lt;li&gt;[ ] Update LinkedIn headline: "Aspiring Data Engineer | Learning Python, SQL &amp;amp; Cloud"&lt;/li&gt;
&lt;li&gt;[ ] Follow 5 data engineering professionals on LinkedIn/Twitter&lt;/li&gt;
&lt;li&gt;[ ] Join data engineering communities: Data Engineering Slack, Reddit r/dataengineering&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Documentation
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;[ ] Create &lt;code&gt;/data-engineering-30days&lt;/code&gt; project folder&lt;/li&gt;
&lt;li&gt;[ ] Start Day 1 learning notes in Markdown format&lt;/li&gt;
&lt;li&gt;[ ] Initialize Git repository with proper &lt;code&gt;.gitignore&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;[ ] Set up a learning journal template&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  📚 8. Recommended Resources
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Free Learning Platforms
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Courses:&lt;/strong&gt; DataCamp Data Engineer Track, Coursera Data Engineering, freeCodeCamp&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Books:&lt;/strong&gt; 

&lt;ul&gt;
&lt;li&gt;
&lt;em&gt;Fundamentals of Data Engineering&lt;/em&gt; by Joe Reis &amp;amp; Matt Housley&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Designing Data-Intensive Applications&lt;/em&gt; by Martin Kleppmann&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;strong&gt;Practice:&lt;/strong&gt; LeetCode (SQL), HackerRank (Python), StrataScratch&lt;/li&gt;

&lt;/ul&gt;

&lt;h3&gt;
  
  
  Certifications (Optional but Valuable)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;AWS Certified Data Analytics – Specialty&lt;/li&gt;
&lt;li&gt;Google Professional Data Engineer&lt;/li&gt;
&lt;li&gt;Azure Data Engineer Associate (DP-203)&lt;/li&gt;
&lt;li&gt;Databricks Certified Data Engineer Associate&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Communities &amp;amp; Blogs
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Seattle Data Guy (YouTube)&lt;/li&gt;
&lt;li&gt;Data Engineering Weekly Newsletter&lt;/li&gt;
&lt;li&gt;Locally Optimistic Blog&lt;/li&gt;
&lt;li&gt;dbt Community Slack&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🚨 9. Common Pitfalls to Avoid
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Tool obsession over fundamentals&lt;/strong&gt; – Master SQL and Python first&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Ignoring SQL&lt;/strong&gt; – Still represents 70%+ of daily work&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Delaying cloud platform learning&lt;/strong&gt; – Cloud skills are essential today&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Theory without projects&lt;/strong&gt; – Build real pipelines, not just tutorials&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Learning in isolation&lt;/strong&gt; – Engage with communities and seek feedback&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Skipping data modeling&lt;/strong&gt; – Understanding schemas is crucial&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  📈 10. Success Metrics
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Week&lt;/th&gt;
&lt;th&gt;Target Outcome&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Week 1&lt;/td&gt;
&lt;td&gt;Local development environment, strong SQL &amp;amp; Python&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Week 2&lt;/td&gt;
&lt;td&gt;First ETL pipeline with cloud storage integration&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Week 3&lt;/td&gt;
&lt;td&gt;Orchestrated Airflow pipeline with data quality checks&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Week 4&lt;/td&gt;
&lt;td&gt;Deployed end-to-end project with GitHub portfolio&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  ➡️ Next Steps (Day 2)
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Complete all Day 1 action items&lt;/li&gt;
&lt;li&gt;Prepare for Advanced SQL session (CTEs, window functions, query optimization)&lt;/li&gt;
&lt;li&gt;Select 1–2 datasets from Kaggle, Google Dataset Search, or public APIs&lt;/li&gt;
&lt;li&gt;Set up PostgreSQL and practice basic queries&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  💡 Key Takeaway
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;"Data engineering isn't about knowing every tool—it's about understanding which tool solves which problem and why."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Remember:&lt;/strong&gt; Consistency beats intensity.&lt;br&gt;&lt;br&gt;
&lt;strong&gt;2 focused hours daily &amp;gt; 8 hours of weekend cramming.&lt;/strong&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  📅 Document Version
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Last Updated:&lt;/strong&gt; February 2026&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Next Review:&lt;/strong&gt; May 2026&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Maintained By:&lt;/strong&gt; Neeraj Kumar&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;strong&gt;Good luck on your data engineering journey! 🚀&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>career</category>
      <category>dataengineering</category>
      <category>learning</category>
    </item>
    <item>
      <title>golang</title>
      <dc:creator>Neeraj Kumar</dc:creator>
      <pubDate>Wed, 04 Dec 2024 02:20:03 +0000</pubDate>
      <link>https://dev.to/neeraj1997dev/golang-49pn</link>
      <guid>https://dev.to/neeraj1997dev/golang-49pn</guid>
      <description></description>
      <category>go</category>
    </item>
    <item>
      <title>Two Sum Problem’ on LeetCode</title>
      <dc:creator>Neeraj Kumar</dc:creator>
      <pubDate>Tue, 12 Nov 2024 18:20:38 +0000</pubDate>
      <link>https://dev.to/neeraj1997dev/two-sum-problem-on-leetcode-dpe</link>
      <guid>https://dev.to/neeraj1997dev/two-sum-problem-on-leetcode-dpe</guid>
      <description>&lt;p&gt;Problem Description&lt;br&gt;
Given an array of integers nums and an integer target, return the indices of the two numbers that add up to the target.&lt;/p&gt;

&lt;p&gt;Go Function Signature:&lt;br&gt;
&lt;code&gt;func twoSum(nums []int, target int) []int&lt;/code&gt;&lt;br&gt;
Example 1:&lt;br&gt;
Input: nums = [2,7,11,15], target = 9&lt;br&gt;
Output: [0,1]&lt;br&gt;
Explanation: Because nums[0] + nums[1] == 9, we return [0, 1].&lt;br&gt;
Example 2:&lt;/p&gt;

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

&lt;p&gt;nput: nums = [3,3], target = 6&lt;br&gt;
Output: [0,1]&lt;br&gt;
Solution 1: Brute Force Approach&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Solution 1: Brute-Force Approach (Nested Loops)&lt;/strong&gt;&lt;br&gt;
In this approach, you check each pair of elements to see if they sum up to the target. This involves iterating through the array with two nested loops.&lt;/p&gt;

&lt;p&gt;Code&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;func twoSum(nums []int, target int) []int {
    for i := 0; i &amp;lt; len(nums); i++ {
        for j := i + 1; j &amp;lt; len(nums); j++ {
            if nums[i] + nums[j] == target {
                return []int{i, j}
            }
        }
    }
    return nil
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Complexity Analysis&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Solution 2: Two-Pass Hash Table&lt;/strong&gt;&lt;br&gt;
This solution improves on the brute-force approach by using a hash map to store each element's value and index in the first pass. In the second pass, you check if the complement (i.e., target - num) exists in the hash map.&lt;/p&gt;

&lt;p&gt;Code&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;func twoSum(nums []int, target int) []int {
    numMap := make(map[int]int)
    // First pass: populate the map with each element's index
    for i, num := range nums {
        numMap[num] = i
    }
    // Second pass: check for the complement
    for i, num := range nums {
        if j, ok := numMap[target - num]; ok &amp;amp;&amp;amp; i != j {
            return []int{i, j}
        }
    }
    return nil
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Solution 3: One-Pass Hash Table (Optimal Solution)&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;This approach combines both insertion and lookup in a single pass. As you iterate through the array, you:&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Check if the complement (i.e., target - num) exists in the hash map.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If the complement is found, return the indices.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If not, add the current element and its index to the hash map for future lookups.&lt;br&gt;
Code&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;func twoSum(nums []int, target int) []int {
    numMap := make(map[int]int)
    for i, num := range nums {
        if j, ok := numMap[target - num]; ok {
            return []int{j, i}
        }
        numMap[num] = i
    }
    return nil
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Complexity Analysis&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;em&gt;Time Complexity&lt;/em&gt;: &lt;strong&gt;𝑂(𝑛)&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Only one pass through the array is required, making this 
approach linear in time complexity.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;&lt;em&gt;Space Complexity&lt;/em&gt;:&lt;strong&gt;o(n)&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The hash map stores each element and its index.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;Pros and Cons&lt;/em&gt;&lt;br&gt;
&lt;strong&gt;Pros&lt;/strong&gt;: The most efficient approach for time complexity, with a clean and compact implementation.&lt;br&gt;
&lt;strong&gt;Cons&lt;/strong&gt;: None, as it achieves optimal time and space complexity for this problem.&lt;/p&gt;

</description>
      <category>go</category>
      <category>leetcode</category>
      <category>dsa</category>
    </item>
    <item>
      <title>Work with Apache Kafka in Spring Boot</title>
      <dc:creator>Neeraj Kumar</dc:creator>
      <pubDate>Sat, 31 Aug 2024 19:07:03 +0000</pubDate>
      <link>https://dev.to/neeraj1997dev/work-with-apache-kafka-in-spring-boot-1jg5</link>
      <guid>https://dev.to/neeraj1997dev/work-with-apache-kafka-in-spring-boot-1jg5</guid>
      <description>&lt;p&gt;&lt;strong&gt;Step 1: Create a New Spring Boot Starter Project&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;creating a new Spring Boot Starter Project using STS. While configuring the project, select Spring Web, Spring for Apache Kafka, and Spring Boot DevTools as dependencies&lt;/em&gt;&lt;br&gt;
&lt;strong&gt;Step 2: Enable Kafka in the Main Class&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To integrate Apache Kafka with Spring Boot,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;package com.dev.spring.kafka;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.kafka.annotation.EnableKafka;

@SpringBootApplication
@EnableKafka
public class SpringBoot2ApacheKafkaTestApplication {
    public static void main(String[] args) {
        SpringApplication.run(SpringBoot2ApacheKafkaTestApplication.class, args);
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 3: Create a Custom MessageRepository Class&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Next, create a MessageRepository class to store incoming messages.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;package com.dev.spring.kafka.message.repository;

import java.util.ArrayList;
import java.util.List;
import org.springframework.stereotype.Component;

@Component
public class MessageRepository {

    private List&amp;lt;String&amp;gt; list = new ArrayList&amp;lt;&amp;gt;();

    public void addMessage(String message) {
        list.add(message);
    }

    public String getAllMessages() {
        return list.toString();
    }
}

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 4: Create a MessageProducer Class&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Create a MessageProducer class to send messages to the Kafka topic.&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;package com.dev.spring.kafka.sender;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.stereotype.Component;

@Component
public class MessageProducer {

    private Logger log = LoggerFactory.getLogger(MessageProducer.class);

    @Autowired 
    private KafkaTemplate&amp;lt;String, String&amp;gt; kafkaTemplate;

    @Value("${myapp.kafka.topic}")
    private String topic;

    public void sendMessage(String message) {
        log.info("MESSAGE SENT FROM PRODUCER END -&amp;gt; " + message);
        kafkaTemplate.send(topic, message);
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 5: Create a MessageConsumer Class&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Now, create a MessageConsumer class to consume messages from the Kafka topic.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;package com.dev.spring.kafka.consumer;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Component;
import com.dev.spring.kafka.message.repository.MessageRepository;

@Component
public class MessageConsumer {

    private Logger log = LoggerFactory.getLogger(MessageConsumer.class);

    @Autowired
    private MessageRepository messageRepo;

    @KafkaListener(topics = "${myapp.kafka.topic}", groupId = "xyz")
    public void consume(String message) {
        log.info("MESSAGE RECEIVED AT CONSUMER END -&amp;gt; " + message);
        messageRepo.addMessage(message);
    }
}

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 6: Create a KafkaRestController Class&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Finally, create a KafkaRestController class to handle REST requests for sending and retrieving messages.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;package com.dev.spring.kafka.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.dev.spring.kafka.message.repository.MessageRepository;
import com.dev.spring.kafka.sender.MessageProducer;

@RestController
public class KafkaRestController {

    @Autowired
    private MessageProducer producer;

    @Autowired
    private MessageRepository messageRepo;

    // Send message to Kafka
    @GetMapping("/send")
    public String sendMsg(@RequestParam("msg") String message) {
        producer.sendMessage(message);
        return "'" + message + "' sent successfully!";
    }

    // Read all messages
    @GetMapping("/getAll")
    public String getAllMessages() {
        return messageRepo.getAllMessages();
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Step 7: Create the application.yml File&lt;/p&gt;

&lt;p&gt;Lastly, configure your application by creating an application.yml&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;server:
  port: 9090

spring:
  kafka:
    producer:
      bootstrap-servers: localhost:9092
      key-serializer: org.apache.kafka.common.serialization.StringSerializer
      value-serializer: org.apache.kafka.common.serialization.StringSerializer

    consumer:
      bootstrap-servers: localhost:9092
      key-deserializer: org.apache.kafka.common.serialization.StringDeserializer
      value-deserializer: org.apache.kafka.common.serialization.StringDeserializer

myapp:
  kafka:
    topic: myKafkaTest
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>kafka</category>
      <category>sts</category>
      <category>springboot</category>
    </item>
    <item>
      <title>Kubernetes Cluster Step By Step</title>
      <dc:creator>Neeraj Kumar</dc:creator>
      <pubDate>Mon, 01 Jan 2024 13:31:28 +0000</pubDate>
      <link>https://dev.to/neeraj1997dev/kubernetes-cluster-step-by-step-5940</link>
      <guid>https://dev.to/neeraj1997dev/kubernetes-cluster-step-by-step-5940</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;A Kubernetes cluster is a group of nodes or machines running together. At the highest level of Kubernetes, there are two types of servers: a Master node and Worker nodes. These servers can be either Virtual Machines (VMs) or physical servers (Bare metal). Together, these servers form a Kubernetes cluster, and they are controlled by the services that make up the Control Plane.&lt;/p&gt;
&lt;/blockquote&gt;

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

&lt;ul&gt;
&lt;li&gt;    &lt;strong&gt;Choose a Cloud Provider&lt;/strong&gt;:
    Popular choices include AWS, Google Cloud Platform (GCP), Microsoft Azure, and others.
    Alternatively, you can use on-premises solutions like VMware or tools like Minikube for local development.&lt;/li&gt;
&lt;/ul&gt;




&lt;ul&gt;
&lt;li&gt;    &lt;strong&gt;Install Necessary Tools&lt;/strong&gt;:
    kubectl: Kubernetes command-line tool
    kubeadm, kubelet, and kubernetes-cni: Install these on each cluster node.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Step 1: Provision the Infrastructure&lt;/strong&gt;&lt;br&gt;
On Cloud Providers:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Create VM instances or nodes based on your chosen provider.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Ensure that each node has a compatible OS (Ubuntu, CentOS, etc.).
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;On-Premises or Local:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Set up physical or virtual machines.
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Ensure network connectivity between nodes.
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Step 2: Install Docker (or Another Container Runtime)&lt;/strong&gt;&lt;br&gt;
Install Docker on each node or use an alternative container runtime:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# For Ubuntu
sudo apt update
sudo apt install docker.io
sudo systemctl enable --now docker

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 3: Install kubeadm, kubelet, and kubectl&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# For Ubuntu
sudo apt-get update &amp;amp;&amp;amp; sudo apt-get install -y apt-transport-https curl
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list
sudo apt-get update
sudo apt-get install -y kubelet kubeadm kubectl
sudo systemctl enable --now kubelet

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 4: Initialize the Master Node&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo kubeadm init --pod-network-cidr=10.244.0.0/16

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 5: Set Up Cluster Networking&lt;/strong&gt;&lt;br&gt;
Choose a network plugin for your cluster. For example, Calico or Flannel. Install the chosen plugin on the master node:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl apply -f https://docs.projectcalico.org/manifests/calico.yaml

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 6: Join Worker Nodes&lt;/strong&gt;&lt;br&gt;
run the kubeadm join command provided at the end of the master node initialization.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo kubeadm join &amp;lt;master-node-ip&amp;gt;:&amp;lt;master-node-port&amp;gt; --token &amp;lt;token&amp;gt; --discovery-token-ca-cert-hash &amp;lt;hash&amp;gt;

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 7: Verify Cluster Setup&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;On the master node, run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl get nodes
kubectl get pods --all-namespaces

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 8: Deploy an Application&lt;/strong&gt;&lt;br&gt;
Deploy a sample application to test your cluster:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl create deployment nginx --image=nginx
kubectl expose deployment nginx --port=80 --type=NodePort

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 9: Access Your Application&lt;/strong&gt;&lt;br&gt;
Retrieve the NodePort and access the deployed application:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl get svc

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

&lt;/div&gt;



&lt;p&gt;Visit &lt;a href="http://node-ip:node-port" rel="noopener noreferrer"&gt;http://node-ip:node-port&lt;/a&gt; in your web browser.&lt;/p&gt;

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

</description>
      <category>kubernetes</category>
      <category>docker</category>
    </item>
    <item>
      <title>Pagination in Golang and MongoDB</title>
      <dc:creator>Neeraj Kumar</dc:creator>
      <pubDate>Wed, 23 Aug 2023 19:02:23 +0000</pubDate>
      <link>https://dev.to/neeraj1997dev/pagination-in-golang-and-mongodb-3l63</link>
      <guid>https://dev.to/neeraj1997dev/pagination-in-golang-and-mongodb-3l63</guid>
      <description>&lt;p&gt;MongoDB is a document based data store and hence pagination is one of the most common use case of it. So when do you paginate the response? The answer is pretty neat; you paginate whenever you want to process result in chunks. Some common scenarios are&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Batch processing&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Showing huge set of results on user interfac&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Paginating on client and server side are both really very expensive and should not be considered. Hence pagination is generally handled at database level and databases are optimized for such needs to&lt;/p&gt;

&lt;p&gt;&lt;code&gt;2 approaches through which you can easily paginate your MongoDB responses. Sample Document&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; {
        "_id" : ObjectId("6936d17263623919cd5145db"),
        "name" : "Neeraj Kumar",
        "age" : 25
    }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Approach 1: Using cursor.skip and cursor.limit&lt;/strong&gt;&lt;br&gt;
MongoDB cursor has two methods that makes paging easy; they are&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;cursor.skip()&lt;/li&gt;
&lt;li&gt;cursor.limit()&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;skip(n) will skip n documents from the cursor while limit(n) will cap the number of documents to be returned from the cursor. Thus combination of two naturally paginates the response.&lt;br&gt;
&lt;code&gt;In Mongo Shell your pagination code looks something like&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; // Page 1
    db.students.find().limit(10)

    // Page 2
    db.students.find().skip(10).limit(10)

    // Page 3
    db.students.find().skip(10).limit(10)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;implement pagination:&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;func GetPagination(limit, page int) error {
  ctx, cancel := context.WithTimeout(context.Background(), 12*time.Second)
  defer cancel()
   coll := o.db.Database(mongoDatabaseName).Collection(offerCollectionName)

   l := int64(limit)
     skip := int64(page * limit - limit)
     fOpt := options.FindOptions{Limit: &amp;amp;l, Skip: &amp;amp;skip}

     curr, err := coll.Find(ctx, bson.D{{}}, &amp;amp;fOpt)
   if err != nil {
      return result, err
   }

   for curr.Next(ctx) {
      var el Offer
      if err := curr.Decode(&amp;amp;el); err != nil {
         log.Println(err)
      }

      result = append(result, el)
   }

   return result, nil
}


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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Approach 2: Using _id and limit&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This approach will make effective use of default index on _id and nature of ObjectId. I bet you didn’t know that a Mongodb ObjectId is a 12 byte structure containing&lt;/p&gt;

&lt;p&gt;Using this property of ObjectId and also taking into consideration the fact that _id is always indexed, we can devise following approach for pagination:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Fetch a page of documents from database&lt;/li&gt;
&lt;li&gt;Get the document id of the last document of the page&lt;/li&gt;
&lt;li&gt;Retrieve documents greater than that id
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    // Page 1
    db.students.find().limit(10)

    // Page 2
    last_id = ...  # logic to get last_id
    db.students.find({'_id': {'$gt': last_id}}).limit(10)

    // Page 3
    last_id = ... # logic to get last_id
    db.students.find({'_id': {'$gt': last_id}}).limit(10)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;func GetPagination(limit, page int)  error {
    ctx, cancel := context.WithTimeout(context.Background(), 12*time.Second)
  defer cancel()

   coll := o.db.Database(mongoDatabaseName).Collection(offerCollectionName)
   ctx, _ := context.WithTimeout(context.Background(), contextTimeout)

   curr, err := coll.Find(ctx, bson.D{{}}, newMongoPaginate(limit,page).getPaginatedOpts())
   if err != nil {
      return result, err
   }

   for curr.Next(ctx) {
      var el Offer
      if err := curr.Decode(&amp;amp;el); err != nil {
         log.Println(err)
      }

      result = append(result, el)
   }

   return result, nil
}

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

&lt;/div&gt;



</description>
      <category>go</category>
    </item>
    <item>
      <title>Hello World in Golang</title>
      <dc:creator>Neeraj Kumar</dc:creator>
      <pubDate>Sat, 25 Feb 2023 18:05:11 +0000</pubDate>
      <link>https://dev.to/neeraj1997dev/hello-world-in-golang-2hke</link>
      <guid>https://dev.to/neeraj1997dev/hello-world-in-golang-2hke</guid>
      <description>&lt;ul&gt;
&lt;li&gt; First add the package &lt;strong&gt;main&lt;/strong&gt; in your program:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;package main
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;Every Go file must start with a package name statement. Packages provide code encapsulation and reuse. The name of the package here is main.&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;After adding main package import &lt;strong&gt;“fmt”&lt;/strong&gt; package in your program:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import(
"fmt"
)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;Import the fmt package, which will be used to print text to the standard output in the main function.&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Now write the code in the main function to print hello world in Go language:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;func main() {  
    fmt.Println("Hello World") 
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;func main():&lt;/strong&gt; &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;The main function is a special function that is the entry point of a Go program. The main function must be included in the main package. { and } denote the start and end of the main function.&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;fmt.Println(“Hello World”):&lt;/strong&gt; &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;The Println function in the fmt package is used to print text to standard output.&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>ai</category>
      <category>opensource</category>
      <category>discuss</category>
      <category>career</category>
    </item>
    <item>
      <title>Introduction and Installation</title>
      <dc:creator>Neeraj Kumar</dc:creator>
      <pubDate>Fri, 24 Feb 2023 19:08:22 +0000</pubDate>
      <link>https://dev.to/neeraj1997dev/introduction-and-installation-4e38</link>
      <guid>https://dev.to/neeraj1997dev/introduction-and-installation-4e38</guid>
      <description>&lt;p&gt;&lt;strong&gt;&lt;em&gt;What is golang ?&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
Golang (Go) is a statically and compiled language created by google.&lt;br&gt;
Go is mostly used to develop highly scalable and fast web apps.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Benefits of using go for your rest api&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;There are so many programming languages to choose from when you want to make a rest api.Python(flask),node or even java. However go has some benefits which makes it a good choice whenever you are making a rest api.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;some of the benefits of using go:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Quick compilation and execution speed.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;its very easy and fast to learn -go has a very simple &lt;br&gt;
syntax.This makes it very easy to learn.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Lightweight goroutines that support concurrency.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Extensive and very well documented built-in libraries.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Why learn Golang?&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
Now you still might be asking why should I learn Golang with all the other alternatives out there.&lt;br&gt;
list of some of the pros of the Go programming language:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Simple syntax&lt;/em&gt; - Go has concise and straightforward syntax that makes writing readable and maintainable code easy.&lt;br&gt;
Compiled language&lt;br&gt;
&lt;em&gt;Static linking&lt;/em&gt; - The compiler supports static linking which means you can statically link your project into one massive binary and then simply deploy it to the cloud or a server.&lt;br&gt;
&lt;em&gt;Open source&lt;/em&gt; - Go is open-source so you can read the source code and contribute to the repository.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Installing / Updating Go&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
If you’re updating a previously installed Go version, you must first delete the older one:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo rm -r /usr/local/go&lt;/code&gt;&lt;br&gt;
Download the latest version of Go archive from &lt;a href="https://golang.org/dl/" rel="noopener noreferrer"&gt;https://golang.org/dl/&lt;/a&gt; and extract it:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo tar -C /usr/local -xzf go1.7.1.linux-amd64.tar.gz&lt;/code&gt;&lt;br&gt;
Note: some people use the Go version manager (GVM) to install and set up Go, a tool similar to NVM which I highly recommend for Node.js, but for Go I prefer to set up everything myself.&lt;/p&gt;

&lt;p&gt;Next, set the PATH environment variables by adding the following to .bashrc:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;export PATH=$PATH:/usr/local/go/bin&lt;br&gt;
export GOPATH=$HOME/go&lt;/code&gt;&lt;br&gt;
Here I use home/neeraj/go as my workspace (which is $HOME/go), but feel free to change it according to your preference.&lt;/p&gt;

&lt;p&gt;And, create your workspace:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;mkdir -p ~/go/src/github.com/neeraj&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.linkedin.com/company/go-discussions/" rel="noopener noreferrer"&gt;Golang Study Point&lt;/a&gt;&lt;/p&gt;

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

</description>
      <category>go</category>
    </item>
    <item>
      <title>How to Use the Call, Apply, and Bind Functions in JavaScript .</title>
      <dc:creator>Neeraj Kumar</dc:creator>
      <pubDate>Sun, 08 Jan 2023 17:08:00 +0000</pubDate>
      <link>https://dev.to/neeraj1997dev/how-to-use-the-call-apply-and-bind-functions-in-javascript--o7</link>
      <guid>https://dev.to/neeraj1997dev/how-to-use-the-call-apply-and-bind-functions-in-javascript--o7</guid>
      <description>&lt;p&gt;Both  call  and  apply  invoke a function. Their only difference is that  call  accepts arguments in a comma-separated fashion while  apply  requires arguments to be passed as an array or an array-like object.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Call ( )&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Call invokes the function immediately and allows you to pass in arguments one by one.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Call() Syntax&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function.call(thisArg, arg1, agr2, ...)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Call() Parameters&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The call() method can take two parameters:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;thisArg - The thisArg is the object that the this object references inside the function func.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;arg1, ... argN (optional) - Arguments for the function func.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;Note: By default, in a function this refers to the global object i.e, window in web browsers and global in node.js.&lt;/code&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;call() Return Values&lt;/strong&gt;&lt;br&gt;
Returns the result obtained from calling the function with the specified this value and arguments.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;Note: By using call(), we can use the functions belonging to one object to be assigned and called for a different object.&lt;/code&gt;&lt;/strong&gt;&lt;/p&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let lastName = { name: 'Yadav' };
function fullName(greeting){
  console.log(`${greeting}${this.name}`)
}
fullName('Neeraj')
fullName.call(lastName,"Neeraj")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let name =  {
    firstname : "Neeraj",
    lastname : "Kumar",
}
fullDetails =function(home){
    console.log(this.firstname + " " + this.lastname +", " + home)
}

fullDetails.call(name,"Bihar")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;the first argument e.g name inside call method is always a reference to (this) variable and latter will be function variable&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Apply ( )&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;The apply() method calls a function with the passed this keyword value and arguments provided in the form of an array.&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;apply invokes the function on given context and allows to pass arguments as an array&lt;/code&gt;&lt;br&gt;
The apply() method is similar to call(). The difference is that the apply() method accepts an array of arguments instead of comma separated values.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;apply() Syntax&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function.apply(thisArg, [argumentsArr])
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;apply() Parameters&lt;/strong&gt;&lt;br&gt;
The apply() method can take two parameters:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;thisArg - The value of this which is provided while calling func.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;argsArray (optional) - An array containing the arguments to the functio&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Example1: Append two Arrays&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let backend = ["Neeraj", "Shashank", "Ramesh"];
let frontend = ["Parveen", "Ashish"];

// appending 
console.log(backend.push.apply(backend, frontend))
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;bind()&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;bind returns a new function by setting the provided context, and allows to pass arguments one by one&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;The bind() method allows an object to borrow a method from another object without copying.&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;bind() Syntax&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;func.bind(thisArg, arg1, ... argN)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;bind() Parameters&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The bind() can take two parameters:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;thisArg - The value provided as this parameter for func.&lt;/li&gt;
&lt;li&gt;arg1, ... argN (optional) - The value of arguments present inside func.
&lt;code&gt;
Notes: If thisArg is not specified, the this of the executing scope is treated as thisArg.&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;bind() Return Value&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Returns a copy of the given function with the specified this value, and initial arguments (if provided).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// object definition
const student1 = {
  name: "Neeraj",
  introduction: function (score) {
    console.log(this.name + "scored " + score + " in an exam.");
  },
};

// object definition
const student2 = {
  name: "Sonu",
};

let result = student1.introduction.bind(student2, 95);

// invoking result() function
result(); 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;Call and Apply are interchangeable. You can decide whether it’s easier to send in an array or a comma separated list of arguments. Bind is different. It always returns a new function.&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/Neeraj1997-dev/javaScript_Interview_questions2023" rel="noopener noreferrer"&gt;javascript interview questions&lt;/a&gt;&lt;/p&gt;

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

&lt;p&gt;Thanks for reading.&lt;/p&gt;

</description>
      <category>aws</category>
      <category>cloud</category>
    </item>
    <item>
      <title>Fibonacci Sequence in(JS and Golang)</title>
      <dc:creator>Neeraj Kumar</dc:creator>
      <pubDate>Sat, 10 Dec 2022 19:43:04 +0000</pubDate>
      <link>https://dev.to/neeraj1997dev/fibonacci-sequence-injs-and-golang-33e4</link>
      <guid>https://dev.to/neeraj1997dev/fibonacci-sequence-injs-and-golang-33e4</guid>
      <description>&lt;p&gt;The Fibonacci sequence is the integer sequence where the first two terms are 0 and 1. After that, the next term is defined as the sum of the previous two terms.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, ...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Fibonacci number using the following formula:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Fibonacci(n)=Fibonacci(n-1)+Fibonacci(n-2)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Fibonacci Series Up to n Terms(&lt;strong&gt;JS&lt;/strong&gt;)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const number = parseInt(prompt('Enter the number of terms: '));
let n1 = 0, n2 = 1, nextTerm;

console.log('Fibonacci Series:');

for (let i = 1; i &amp;lt;= number; i++) {
    console.log(n1);
    nextTerm = n1 + n2;
    n1 = n2;
    n2 = nextTerm;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Fibonacci Series Up to n Terms(&lt;strong&gt;Golang&lt;/strong&gt;)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;package main

import (
  "fmt"
)

func Fibonacci(n int) {

  var n3, n1, n2 int = 0, 0, 1

  for i := 1; i &amp;lt;= n; i++ {

    fmt.Println(n1)

    n3 = n1 + n2

    n1 = n2

    n2 = n3

  }
}

func main() {

    Fibonacci(10)

  }


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

&lt;/div&gt;



&lt;p&gt;Using Recursion(&lt;strong&gt;Golang&lt;/strong&gt;)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;package main

import (
  "fmt"
)

func Fibonacci(n int) int {

  if n &amp;lt;= 1 {

    return n

  }

  return Fibonacci(n-1) + Fibonacci(n-2)

}

func main() {

  for i := 1; i &amp;lt;= 10; i = i + 1{

    fmt.Println(Fibonacci(i))

  }

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

&lt;/div&gt;



&lt;p&gt;Fibonacci Sequence Up to a Certain Number(&lt;strong&gt;JS&lt;/strong&gt;)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const number = parseInt(prompt('Enter a positive number: '));
let n1 = 0, n2 = 1, nextTerm;

console.log('Fibonacci Series:');
console.log(n1); // print 0
console.log(n2); // print 1

nextTerm = n1 + n2;

while (nextTerm &amp;lt;= number) {

    // print the next term
    console.log(nextTerm);

    n1 = n2;
    n2 = nextTerm;
    nextTerm = n1 + n2;
}

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

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>Find the Factorial of a Number(JS AND Golang)</title>
      <dc:creator>Neeraj Kumar</dc:creator>
      <pubDate>Sat, 10 Dec 2022 12:02:38 +0000</pubDate>
      <link>https://dev.to/neeraj1997dev/find-the-factorial-of-a-numberjs-and-golang-24jp</link>
      <guid>https://dev.to/neeraj1997dev/find-the-factorial-of-a-numberjs-and-golang-24jp</guid>
      <description>&lt;p&gt;factorial of a non-negative integer n, denoted by n!, is the product of all positive integers less than or equal to n. example:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;5! = 5 * 4 * 3 * 2 * 1 = 120&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;simple method: 1(&lt;strong&gt;JS&lt;/strong&gt;)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function factorial(number) {
  let result = 1;

  for (let i = 2; i &amp;lt;= number; i += 1) {
    result *= i;
  }

  return result;
}
console.log(factorial(5))
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;simple method: 1(&lt;strong&gt;Golang&lt;/strong&gt;)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var factVal uint64 = 1 // uint64 is the set of all unsigned 64-bit integers. 
var i int = 1
var n int

func factorial(n int) uint64 {   
    if(n &amp;lt; 0){
        fmt.Print("Factorial of negative number doesn't exist.")    
    }else{        
        for i:=1; i&amp;lt;=n; i++ {
            factVal *= uint64(i) 
        }   
    }    
    return factVal 
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;method:(&lt;strong&gt;Using Recursion in JS&lt;/strong&gt;)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function factorialRecursive(number) {
  return number &amp;gt; 1 ? number * factorialRecursive(number - 1) : 1;
}
console.log(factorialRecursive(5))
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;method:(&lt;strong&gt;Using Recursion in Golang&lt;/strong&gt;)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;func factorial(n int) int {
    if n == 0 {
        return 1
    }
    return n * factorial(n-1)
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
    </item>
  </channel>
</rss>
