<?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>Forem: Samuel Wachira</title>
    <description>The latest articles on Forem by Samuel Wachira (@samwel_sam).</description>
    <link>https://forem.com/samwel_sam</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%2F2188467%2F487b4c84-ca94-4d75-b693-c0954f55d73c.png</url>
      <title>Forem: Samuel Wachira</title>
      <link>https://forem.com/samwel_sam</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/samwel_sam"/>
    <language>en</language>
    <item>
      <title>HOW TO CONNECT POWER BI TO A SQL DATABASES</title>
      <dc:creator>Samuel Wachira</dc:creator>
      <pubDate>Wed, 25 Mar 2026 09:29:33 +0000</pubDate>
      <link>https://forem.com/samwel_sam/how-to-connect-power-bi-to-a-sql-databases-16ka</link>
      <guid>https://forem.com/samwel_sam/how-to-connect-power-bi-to-a-sql-databases-16ka</guid>
      <description>&lt;h2&gt;
  
  
  &lt;strong&gt;1. Introduction to Power BI and SQL Databases&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;In today's data-driven business environment, organization's generate enormous volumes of information every day. i.e from sales transactions to inventory movements and financial records. To make sense of this data, it requires powerful tools that connect to where data lives, transforms it into a usable shape and present it through visualization that decision-makers can act on. Power Bi, developed by Microsoft is one of the most widely used adopted platforms for exactly this purpose.&lt;/p&gt;

&lt;p&gt;Power BI is a cloud-based business intelligence and data visualization service that enables analysts to connect hundreds of data sources, build interactive dashboards and share reports across organizations.&lt;br&gt;
It is available as free desktop application (Power BI Desktop), a cloud-hosted service(Power BI service) and a mobile application making it accessible to analysts working in all environments.&lt;/p&gt;

&lt;p&gt;&lt;u&gt;What is Power BI used For&lt;/u&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Sales analysis by tracking performance by region, product line or individual representative.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Executive dashboard that summarizes KPIs such as revenue, customer acquisition costs and profit margin.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Financial reporting by building profit and loss statements and cash flow summaries from accounting systems.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;u&gt;Why Companies Connect Power Bi to Databases&lt;/u&gt;&lt;br&gt;
While Power Bi can load data from Excel spreadsheets, CSV files and web API's, the majority of enterprise data resides in relational databases. Connecting Power Bi directly to databases give analysts access to live authoritative data rather than outdated extracts and allows dashboards to refresh automatically on a schedule.&lt;/p&gt;

&lt;p&gt;SQL databases are important in this context because they are backbone of most business information systems. Customer records, transactional sales data and inventory tables are always mostly stored in relational databases such as PostgreSQL, Microsoft SQL server or MySQL.&lt;/p&gt;

&lt;p&gt;SQL databases enforces data integrity through primary keys, foreign keys and constraints, scale efficiently to million rows and allows complex analytical queries to run close to where data is stored.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Connecting Power BI to a local PostgreSQL Database&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;PostgreSQL is a powerful open source relational database widely used by developers, data engineers and analysts. &lt;/p&gt;

&lt;p&gt;If your organization runs PostgreSQL on a local server or your own machine during development, Power Bi Desktop can connect to it in the following steps:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Step 1: Open and launch Power Bi Desktop from the windows Start menu.&lt;/em&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%2Fa02pjzh6vc1teozqukfp.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%2Fa02pjzh6vc1teozqukfp.png" alt=" " width="800" height="428"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Step 2: Open the Get Data Dialog&lt;/em&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%2Fsr8u9ozvq4q825wpkcwi.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%2Fsr8u9ozvq4q825wpkcwi.png" alt=" " width="800" height="380"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Step 3: In the Get Data dialog, select PostgreSQL Database and click connect.&lt;/em&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%2Fi0puy9zabvcia4p49rke.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%2Fi0puy9zabvcia4p49rke.png" alt=" " width="349" height="625"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Step 4: The PostgreSQL connection dialog will appear and enter the Server and Database Name.&lt;/em&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%2F332qazfgyairk4uw8xs8.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%2F332qazfgyairk4uw8xs8.png" alt=" " width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Step 5 : Provide credentials and click connect.&lt;/em&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%2Fkazjp6zykf8a1lxoix41.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%2Fkazjp6zykf8a1lxoix41.png" alt=" " width="800" height="328"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Step 6: A Navigator window will open showing all tables in your database. Select the checkboxes and load tables into Power Bi&lt;/em&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%2Fa90x1nf5anpzqntciyxm.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%2Fa90x1nf5anpzqntciyxm.png" alt=" " width="578" height="699"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Connecting Power Bi to a Cloud Database(Aiven PostgreSQL)&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Aiven is a managed cloud database platform that hos PostgreSQL on major cloud providers including AWS, Google Cloud and Microsoft Azure.&lt;/p&gt;

&lt;p&gt;Aiven is commonly used because it handles server provisioning, automated backups and security hardening.&lt;/p&gt;

&lt;p&gt;Connecting Power Bi to an Aiven PostgreSQL follows the following steps:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Step 1 : Obtaining Connection details from Aiven&lt;/em&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%2Fxalhw8ok1hqj58usymqp.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%2Fxalhw8ok1hqj58usymqp.png" alt=" " width="800" height="422"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Step 2: Downloading the SSL Certificate.&lt;/em&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%2Fz58f99d3ok8yz9mxhj0l.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%2Fz58f99d3ok8yz9mxhj0l.png" alt=" " width="727" height="136"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;SSL Certificate(Secure Socket Layer Certificate) allows Power Bi to verify that is connecting to the genuine Aiven server and not fraud or fake.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Step 3: Entering Aiven Details in Power Bi.&lt;/em&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%2Ffuxg6wh5nji5sbkx271t.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%2Ffuxg6wh5nji5sbkx271t.png" alt=" " width="800" height="395"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Step 4: Load your tables and build a data model.&lt;/em&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%2Fehl6fmia3uglx3k5cm9s.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%2Fehl6fmia3uglx3k5cm9s.png" alt=" " width="800" height="196"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;u&gt;Understanding data model&lt;/u&gt;&lt;br&gt;
Power BI needs to understand how tables relate to one another so that calculations can correctly join data across them. &lt;br&gt;
This is called data modelling, it is related to the concept of primary and foreign keys in SQL.&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%2Fwz0osmc9abjfg9calvb1.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%2Fwz0osmc9abjfg9calvb1.png" alt=" " width="800" height="577"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Why SQL Skills Matters&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;SQL remains one of the most valuable skills a business intelligence professionals can possess.&lt;br&gt;
It helps in:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Retrieving targeted data
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;select&lt;/span&gt; &lt;span class="n"&gt;first_name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;last_name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;membership_status&lt;/span&gt;
&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;customers&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Results:&lt;br&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%2Ftksx2kuf6l188c1kiq6c.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%2Ftksx2kuf6l188c1kiq6c.png" alt=" " width="800" height="524"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Filtering Datasets
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;select&lt;/span&gt; &lt;span class="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;price&lt;/span&gt;
&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;products&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;'Electronics'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Results:&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%2Fb87zahbkabr2js7k177t.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%2Fb87zahbkabr2js7k177t.png" alt=" " width="800" height="359"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Performing aggregations
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;select&lt;/span&gt; &lt;span class="n"&gt;product_id&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;quantity_sold&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_quantity_sold&lt;/span&gt;
&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;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;product_id&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Results:&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%2F0yw41fz2l2ro7dgqeqbi.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%2F0yw41fz2l2ro7dgqeqbi.png" alt=" " width="527" height="534"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Preparing data before building dashboards
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CREATE TABLE customers (
    customer_id INT PRIMARY KEY,
    first_name VARCHAR(50),
    last_name VARCHAR(50),
    email VARCHAR(100),
    phone_number VARCHAR(50),
    registration_date DATE,
    membership_status VARCHAR(10)
);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Results:&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%2Fwuumfwingsaaizy8pn5w.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%2Fwuumfwingsaaizy8pn5w.png" alt=" " width="800" height="239"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;CONCLUSION&lt;/strong&gt;&lt;br&gt;
Power BI is a transformative tool for business intelligence, but its true power is unlocked when connected to the structured data that lives in SQL databases. Whether you are working with a local PostgreSQL instance during development or a fully-managed cloud database on Aiven, the connection process is straightforward once you understand the parameters involved.&lt;/p&gt;

&lt;p&gt;Loading tables such as customers, products, sales, and inventory into Power BI is only the first step. Building a meaningful data model is what enables Power BI to answer cross-domain business questions accurately. &lt;/p&gt;

&lt;p&gt;The combination of Power BI proficiency and SQL knowledge is one of the most valuable skill sets a data professional can develop.&lt;/p&gt;

&lt;p&gt;Happy reading!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>SQL JOINS AND WINDOW FUNCTIONS WITH CASE EXAMPLE</title>
      <dc:creator>Samuel Wachira</dc:creator>
      <pubDate>Tue, 03 Mar 2026 18:47:36 +0000</pubDate>
      <link>https://forem.com/samwel_sam/sql-joins-and-window-functions-with-case-example-8ce</link>
      <guid>https://forem.com/samwel_sam/sql-joins-and-window-functions-with-case-example-8ce</guid>
      <description>&lt;h2&gt;
  
  
  &lt;strong&gt;SQL JOINS&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;When working with relational databases, data is often split across multiple tables. SQL Joins is used to combine data from two or more tables based on related column into one result.&lt;br&gt;
It helps in:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Matching records using related columns.&lt;/li&gt;
&lt;li&gt;Retrieving connected data from multiple tables.&lt;/li&gt;
&lt;li&gt;Improving data analysis by combining related information.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Types of SQL Joins&lt;/strong&gt;&lt;br&gt;
SQL joins are categorized into different types based on how rows from two tables are matched and combined.&lt;br&gt;
For this article, we will use two tables. i.e &lt;/p&gt;

&lt;p&gt;&lt;u&gt;STUDENT TABLE and COURSE TABLE&lt;/u&gt;&lt;/p&gt;

&lt;p&gt;For &lt;code&gt;Student table&lt;/code&gt;, we create the table first, then we Insert values as shown below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CREATE TABLE Students (
    Student_ID INT PRIMARY KEY,
    First_name VARCHAR(50) NOT NULL,
    Last_name VARCHAR(50) NOT NULL,
    Gender CHAR(1),
    Email VARCHAR(100) UNIQUE
);

INSERT INTO Students (Student_ID,First_name, Last_name, Email, Gender)
VALUES 
(201,'Alice', 'Johnson', 'alice.j@university.com', 'F'),
(202,'Robert', 'Smith', 'rob.smith@college.edu', 'M'),
(203,'Elena', 'Rossi', 'e.rossi@academy.net', 'F'),
(204,'Kenji', 'Sato', 'kenji.s@global.org', 'M'),
(205,'Zara', 'Khan', 'z.khan@tech.edu', 'O');
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Result:&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%2F2iyhwx1nlfitw65eeh2l.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%2F2iyhwx1nlfitw65eeh2l.png" alt=" " width="800" height="240"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For &lt;code&gt;Course table&lt;/code&gt;, we create the table first, then we Insert Values as shown below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CREATE TABLE Courses (
    Course_ID INT PRIMARY KEY,
    Student_ID INT,
    Full_name VARCHAR(100),
    Last_name VARCHAR(50),
    Course VARCHAR(50),
    FOREIGN KEY (Student_ID) REFERENCES Students(Student_ID)
);

INSERT INTO Courses (Course_ID, Student_ID, Full_name, Last_name, Course)
VALUES 
(1001, 201, 'Alice Johnson', 'Johnson', 'Data Science'),
(1002, 202, 'Robert Smith', 'Smith', 'Graphic Design'),
(1003, 203, 'Elena Rossi', 'Rossi', 'Architecture'),
(1004, 204, 'Kenji Sato', 'Sato', 'Artificial Intelligence'),
(1005, 205, 'Zara Khan', 'Khan', 'Cyber Security');
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Result:&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%2Fesew5qegdoy3n1b0gwn1.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%2Fesew5qegdoy3n1b0gwn1.png" alt=" " width="800" height="188"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;SQL Inner Join&lt;/strong&gt;
It is used to retrieve rows where matching values exist in both tables.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Consider the two tables, Students and Course, which share a common column Student_ID.&lt;/p&gt;

&lt;p&gt;Using &lt;code&gt;SQL inner Join,&lt;/code&gt; we combine data from these tables based on their relationship, allowing us to retrieve meaningful information like student details along with their enrolled courses. &lt;/p&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT 
    Students.Student_ID, 
    Students.First_name, 
    Students.Last_name, 
    Students.Email, 
    Courses.Course
FROM Students
INNER JOIN Courses ON Students.Student_ID = Courses.Student_ID;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Result:&lt;br&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%2Filaji8awhghwkxxc76u8.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%2Filaji8awhghwkxxc76u8.png" alt=" " width="800" height="212"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This helps in:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Combining records based on related column.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Returning only matching rows from both tables.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Excluding non-matching data from the result set.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;2.&lt;strong&gt;SQL Left Join&lt;/strong&gt;&lt;br&gt;
It is used  to retrieve all rows from the left table(Students) and matching rows from the right table(Course).&lt;/p&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT 
    Students.Student_ID, 
    Students.First_name, 
    Students.Last_name, 
    Courses.Course
FROM Students
LEFT JOIN Courses ON Students.Student_ID = Courses.Student_ID;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Result:&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%2Fhzih8sn8d19dfye3s43h.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%2Fhzih8sn8d19dfye3s43h.png" alt=" " width="800" height="268"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This helps in:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Returning all records from the left table.&lt;/li&gt;
&lt;li&gt;Showing matching data from the right table.&lt;/li&gt;
&lt;li&gt;Displaying NULL values where no match exists in the right table.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;3.&lt;strong&gt;SQL Right Join&lt;/strong&gt;&lt;br&gt;
It is used to retrieve all rows from the right table(Course) and matching rows from the left table(Students).&lt;/p&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT 
    Students.Student_ID, 
    Students.First_name, 
    Students.Last_name, 
    Courses.Course_ID,
    Courses.Course
FROM Students
RIGHT JOIN Courses ON Students.Student_ID = Courses.Student_ID;

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

&lt;/div&gt;



&lt;p&gt;Result:&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%2Fiqlkiotsg9zji7n5y9l2.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%2Fiqlkiotsg9zji7n5y9l2.png" alt=" " width="800" height="212"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This helps in:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Returning all records from the right table.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Showing matching data from the left table.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Displaying NULL values where no match exists in the left table.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;4.&lt;strong&gt;SQL Full Join&lt;/strong&gt;&lt;br&gt;
Its is used to combine the results of both &lt;code&gt;right join&lt;/code&gt; and &lt;code&gt;left join&lt;/code&gt;.&lt;/p&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT 
    Students.Student_ID, 
    Students.First_name, 
    Courses.Course_ID,
    Courses.Course
FROM Students
FULL JOIN Courses ON Students.Student_ID = Courses.Student_ID;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Result:&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%2F5q5111c6tr5877ssgnzf.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%2F5q5111c6tr5877ssgnzf.png" alt=" " width="800" height="262"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This helps in:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Returning all rows from both tables.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Displaying NULL values where no match exists in either table.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Providing complete data from both sides of the join.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;5.&lt;strong&gt;SQL Natural Join&lt;/strong&gt;&lt;br&gt;
It is a type of Inner Join that automatically joins two tables based on columns that have  the same name and data type in both tables.&lt;/p&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT Student_Id,First_name,Last_name,gender,course_id,course
FROM Students
NATURAL JOIN Courses;

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

&lt;/div&gt;



&lt;p&gt;Result:&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%2F65qk2epllmi812bkiwi9.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%2F65qk2epllmi812bkiwi9.png" alt=" " width="800" height="181"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Summary&lt;/strong&gt;&lt;br&gt;
By combining rows from multiple tables based on related columns, SQL joins allows you to transform fragmented data into a comprehensive and actionable result.&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%2Fv445674a7xwfkljvqas4.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%2Fv445674a7xwfkljvqas4.png" alt=" " width="800" height="333"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  &lt;strong&gt;SQL Window Functions&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;It is a set of SQL Functions that allows you to perform calculations over a set of rows without needing to group by each row.&lt;br&gt;
To explain window function, we must understand its syntax. The basic syntax is as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;window_function_name([ALL] expression)     
OVER (    
    [partition_defintion]    
    [order_definition]   
)  
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;window_function&lt;/code&gt;-This indicates the name of our window function.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;Over()&lt;/code&gt;- It contains two expression. i.e. partition by and order by clauses which are responsible for dividing rows  into partitions in relation to given criteria before performing calculations.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;Partition by&lt;/code&gt; -This divides up our rows into partitions  based on the given criteria.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;Order by&lt;/code&gt; -It is used to determine the order of values based on each partition.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Types of Windows Functions&lt;/strong&gt;&lt;br&gt;
There are three different types of SQL window functions. They include:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Aggregate Window function: This allows to perform operations on set of rows within a window. e.g. SUM(),MAX(),MIN(),AVG() or COUNT().&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Ranking Window Function: This helps to ranks the rows within a given window. e.g. RANK(),DENSE_RANK() or ROW_NUMBER().&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;3.Value Window Function(): This combines multiple operations into one. Can be found through LAG(),LEAD(),FIRST_VALUE() among others.&lt;/p&gt;

&lt;p&gt;We are going to create a table in our database called  employee_salary to perform SQL Window functions.&lt;/p&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
CREATE TABLE employee_salary (
  employee_id SERIAL PRIMARY KEY,
  employee_name VARCHAR(30),
  department VARCHAR(40),
  salary INT
);

INSERT INTO employee_salary VALUES (1, 'Sam', 'IT', 5000);
INSERT INTO employee_salary VALUES (2, 'Sarah', 'Finance', 6000);
INSERT INTO employee_salary VALUES (3, 'Michael', 'HR', 5500);
INSERT INTO employee_salary VALUES (4, 'Emily', 'Marketing', 5200);
INSERT INTO employee_salary VALUES (5, 'David', 'IT', 4800);
INSERT INTO employee_salary VALUES (6, 'Rose', 'Finance', 6100);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Result:&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%2Fje4n1lxajewyrayig33t.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%2Fje4n1lxajewyrayig33t.png" alt=" " width="800" height="279"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Using Aggregate Window Function&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;To compare the highest and lowest salary from all records, we will use Max() and MIN() function respectively.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT employee_name,department,salary, 
MAX(Salary) OVER() as highest_salary,
MIN(Salary) OVER() as lowest_salary
FROM employee_salary;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Result:&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%2Fstk0pdx83wnxpkr4j8xz.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%2Fstk0pdx83wnxpkr4j8xz.png" alt=" " width="800" height="197"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;To calculate the average salary within each department, we will use the AVG() function.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT employee_name, department,salary,
AVG(Salary) over(PARTITION BY department) as avg_salary
FROM employee_salary;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Result:&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%2Fdwnj7tycrw33sont7nc5.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%2Fdwnj7tycrw33sont7nc5.png" alt=" " width="800" height="273"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Using Ranking Window Function&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Using ROW_NUMBER(), we will assign a unique number to each row based on salary order.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT employee_name, Department, Salary,
       ROW_NUMBER() OVER(PARTITION BY Department ORDER BY Salary DESC) AS emp_row_no
FROM employee_salary  ;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Result:&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%2F0dd1rl0xxxj3y8v4tz32.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%2F0dd1rl0xxxj3y8v4tz32.png" alt=" " width="800" height="268"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Using RANK(), we will rank employees within their department based on salary in descending order.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT *,
RANK() OVER(PARTITION BY department ORDER BY salary DESC) AS department_rank
FROM employee_salary;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Result:&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%2F35w20vub8g5apbxfjlr0.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%2F35w20vub8g5apbxfjlr0.png" alt=" " width="800" height="183"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Using DENSE_RANK(), we will rank employees by salary without skipping ranks.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT employee_name, Department, Salary,
       DENSE_RANK() OVER(PARTITION BY Department ORDER BY Salary DESC) AS emp_dense_rank
FROM employee_salary ;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Result:&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%2Fzkpksoo2c1knleowa8m9.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%2Fzkpksoo2c1knleowa8m9.png" alt=" " width="800" height="256"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Using PERCENT_RANK(), we will find the relative salary position of each employee within a department.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT employee_name, Department, Salary,
       PERCENT_RANK() OVER(PARTITION BY Department ORDER BY Salary DESC) AS emp_percent_rank
FROM employee_salary;

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

&lt;/div&gt;



&lt;p&gt;Result:&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%2Fvi9e9pqqg2da1a5iey6q.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%2Fvi9e9pqqg2da1a5iey6q.png" alt=" " width="800" height="209"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Using Value Window Function&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Using LAG(), we will get employee's previous salary within their department.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT*,
    LAG(salary) OVER(PARTITION BY department ORDER BY employee_id) AS previous_salary
FROM employee_salary;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Result:&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%2F3pqlilprqe23r28ez3yw.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%2F3pqlilprqe23r28ez3yw.png" alt=" " width="800" height="198"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Summary&lt;/strong&gt;&lt;br&gt;
SQL Window functions are powerful tools that allow for complex calculations and analysis without the need for subqueries or complex joins. &lt;br&gt;
They provide flexibility with partitioning and order clauses, enabling data access from multiple rows to calculate aggregates, rank rows and perform various tasks within groups more efficiently.&lt;/p&gt;

</description>
      <category>sql</category>
      <category>lux</category>
      <category>programming</category>
      <category>database</category>
    </item>
    <item>
      <title>How Analysts Translate Messy Data, DAX, and Dashboards into Action Using Power BI.</title>
      <dc:creator>Samuel Wachira</dc:creator>
      <pubDate>Fri, 13 Feb 2026 09:39:23 +0000</pubDate>
      <link>https://forem.com/samwel_sam/how-analysts-translate-messy-data-dax-and-dashboards-into-action-using-power-bi-1k0i</link>
      <guid>https://forem.com/samwel_sam/how-analysts-translate-messy-data-dax-and-dashboards-into-action-using-power-bi-1k0i</guid>
      <description>&lt;p&gt;&lt;strong&gt;Introduction&lt;/strong&gt;&lt;br&gt;
In the real world, data is rarely clean, complete or analysis ready. Analysts are often handed messy spreadsheets, inconsistent databases and incomplete records and still expected to produce clear insights that drive decisions. Power BI plays a critical role in this journey by helping analysts transform raw data into structured models, write intelligent DAX calculations and deliver interactive dashboards that turn complexity into clarity.&lt;/p&gt;

&lt;p&gt;This article explains how analysts move from messy data to actionable insights, focusing on data preparation, DAX, and dashboard design.&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%2Fzrc0bs7zrx0klm2oi8qo.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%2Fzrc0bs7zrx0klm2oi8qo.png" alt=" " width="794" height="878"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. From Messy Data to Structured Information&lt;br&gt;
Common Data Challenges&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Before analysis even begins, analysts deal with issues such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Missing or duplicate records&lt;/li&gt;
&lt;li&gt;Inconsistent naming (e.g., “Jan”, “January”, “01”)&lt;/li&gt;
&lt;li&gt;Mixed data types (numbers stored as text)&lt;/li&gt;
&lt;li&gt;Multiple data sources with no common key&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Left unresolved, these issues lead to inaccurate reports and misleading conclusions.&lt;/p&gt;

&lt;p&gt;&lt;u&gt;&lt;strong&gt;Data Cleaning with Power Query&lt;/strong&gt;&lt;/u&gt;&lt;/p&gt;

&lt;p&gt;Power BI’s Power Query Editor is where analysts fix data problems. Typical transformations include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Removing duplicates and null values&lt;/li&gt;
&lt;li&gt;Splitting and merging columns&lt;/li&gt;
&lt;li&gt;Standardizing formats (dates, currency, text case)&lt;/li&gt;
&lt;li&gt;Creating calculated columns for categorization&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This step ensures that data is reliable, consistent, and analysis-ready before modeling begins.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Data Modeling: Building the Foundation for Analysis&lt;br&gt;
Fact and Dimension Tables&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Analysts structure cleaned data into:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Fact tables – contain measurable values (sales, revenue, quantities)&lt;/li&gt;
&lt;li&gt;Dimension tables – contain descriptive attributes (date, product, customer, region)
This separation simplifies calculations and improves performance.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;u&gt;Star Schema in Practice&lt;/u&gt;&lt;br&gt;
Most Power BI models follow a star schema, where:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A central fact table connects to multiple dimension tables&lt;/li&gt;
&lt;li&gt;Relationships are one-to-many&lt;/li&gt;
&lt;li&gt;Filters flow from dimensions to facts
A good model makes DAX formulas simpler and dashboards faster.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;3. DAX: Turning Data into Meaning&lt;/strong&gt;&lt;br&gt;
What Is DAX?&lt;br&gt;
Data Analysis Expressions (DAX) is the formula language used in Power BI to create:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Measures (dynamic calculations)&lt;/li&gt;
&lt;li&gt;Calculated columns&lt;/li&gt;
&lt;li&gt;Time-intelligence logic
DAX allows analysts to move beyond static totals to context-aware insights.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Key DAX Concepts Analysts Use:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Measures vs Calculated Columns&lt;/li&gt;
&lt;li&gt;Measures respond to filters and slicers, making them ideal for dashboards.&lt;/li&gt;
&lt;li&gt;Filter Context &amp;amp; Row Context.&lt;/li&gt;
&lt;li&gt;Determines how and when calculations are evaluated.&lt;/li&gt;
&lt;li&gt;Time Intelligence&lt;/li&gt;
&lt;li&gt;Enables Year-to-Date (YTD), Month-over-Month (MoM), and Year-over-Year (YoY) analysis.
Example use cases:&lt;/li&gt;
&lt;li&gt;Total Sales by selected region&lt;/li&gt;
&lt;li&gt;Revenue growth compared to last year&lt;/li&gt;
&lt;li&gt;Average order value per customer segment
Without DAX, dashboards would be static and far less insightful.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;4. Dashboards: From Numbers to Decisions&lt;br&gt;
Designing for Action&lt;/strong&gt;&lt;br&gt;
Effective dashboards are not about showing everything but they focus on what matters. Analysts:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Highlight KPIs (Revenue, Growth, Profit Margin)&lt;/li&gt;
&lt;li&gt;Use charts that match the question being asked&lt;/li&gt;
&lt;li&gt;Apply filters and slicers for interactivity&lt;/li&gt;
&lt;li&gt;Storytelling with Data&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Good dashboards answer questions such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What is happening?&lt;/li&gt;
&lt;li&gt;Why is it happening?&lt;/li&gt;
&lt;li&gt;What should we do next?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;By combining visuals, DAX measures, and clean models, analysts guide decision-makers toward clear actions, not just observations.&lt;br&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%2Fw978jmjog45ij3zw4h8a.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%2Fw978jmjog45ij3zw4h8a.png" alt=" " width="794" height="482"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5.Performance and Accuracy Matter&lt;/strong&gt;&lt;br&gt;
Poor modeling or inefficient DAX can cause:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Slow report loading&lt;/li&gt;
&lt;li&gt;Incorrect totals&lt;/li&gt;
&lt;li&gt;Confusing visuals&lt;/li&gt;
&lt;li&gt;Experienced analysts optimize by:&lt;/li&gt;
&lt;li&gt;Reducing unnecessary columns&lt;/li&gt;
&lt;li&gt;Using measures instead of calculated columns where possible&lt;/li&gt;
&lt;li&gt;Writing efficient DAX expressions
This ensures dashboards remain fast, scalable, and trustworthy.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;br&gt;
Translating messy data into actionable insights is both a technical and analytical skill. Using Power BI, analysts clean and shape raw data, design strong data models, apply powerful DAX calculations and present insights through intuitive dashboards. The result is not just reports but decision-ready intelligence that helps organizations act with confidence.&lt;/p&gt;

</description>
      <category>powerfuldevs</category>
      <category>luxdev</category>
      <category>programming</category>
      <category>learning</category>
    </item>
    <item>
      <title>Schemas and Data Modelling in Power BI</title>
      <dc:creator>Samuel Wachira</dc:creator>
      <pubDate>Mon, 02 Feb 2026 17:45:16 +0000</pubDate>
      <link>https://forem.com/samwel_sam/schemas-and-data-modelling-in-power-bi-2bdd</link>
      <guid>https://forem.com/samwel_sam/schemas-and-data-modelling-in-power-bi-2bdd</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Data modelling is one of the most critical aspects of building effective Power BI solutions. A well-designed data model ensures fast report performance, accurate calculations and meaningful insights for decision-makers. &lt;br&gt;
Power BI relies heavily on how data is structured, relate and optimized before any visuals are created. &lt;br&gt;
We will explore schemas and data modelling in Power BI; focusing on star schema, snowflake schema, fact and dimension tables, relationships and why good modelling is essential for performance and accurate reporting.&lt;/p&gt;

&lt;h2&gt;
  
  
  Data Modelling in Power BI
&lt;/h2&gt;

&lt;p&gt;Data modelling refers to the process of organizing data into tables, defining relationships between them and structuring the data in a way that supports efficient analysis. In Power BI, the data model directly affects:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Query performance&lt;/li&gt;
&lt;li&gt;DAX calculation accuracy&lt;/li&gt;
&lt;li&gt;Simplicity of report design&lt;/li&gt;
&lt;li&gt;Scalability of reports as data grows&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  1. Fact and Dimension Tables
&lt;/h2&gt;

&lt;h3&gt;
  
  
  a) Fact Tables
&lt;/h3&gt;

&lt;p&gt;A fact table stores quantitative, measurable data that businesses want to analyze. These values are often numeric and can be aggregated.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Characteristics of fact tables:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Contain metrics (e.g. Sales Amount, Quantity, Revenue)&lt;/li&gt;
&lt;li&gt;Usually very large&lt;/li&gt;
&lt;li&gt;Contain foreign keys linking to dimension tables&lt;/li&gt;
&lt;li&gt;Represent business events (sales, transactions, clicks)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;FactSales&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;SaleID&lt;/li&gt;
&lt;li&gt;DateKey&lt;/li&gt;
&lt;li&gt;ProductKey&lt;/li&gt;
&lt;li&gt;CustomerKey&lt;/li&gt;
&lt;li&gt;SalesAmount&lt;/li&gt;
&lt;li&gt;Quantity&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  b) Dimension Tables
&lt;/h3&gt;

&lt;p&gt;A dimension table provides descriptive context for facts. These tables answer questions like &lt;em&gt;who, what, where, and when&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Characteristics of dimension tables:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Contain descriptive attributes&lt;/li&gt;
&lt;li&gt;Smaller than fact tables&lt;/li&gt;
&lt;li&gt;Used for filtering, grouping, and slicing data&lt;/li&gt;
&lt;li&gt;Have primary keys referenced by fact tables&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;DimProduct&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;ProductKey&lt;/li&gt;
&lt;li&gt;ProductName&lt;/li&gt;
&lt;li&gt;Category&lt;/li&gt;
&lt;li&gt;Brand&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  2. Star Schema
&lt;/h2&gt;

&lt;p&gt;A star schema is a data modelling structure where a central fact table is connected directly to multiple dimension tables, forming a star-like layout.&lt;/p&gt;

&lt;h3&gt;
  
  
  Structure
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;One central fact table&lt;/li&gt;
&lt;li&gt;Multiple dimension tables&lt;/li&gt;
&lt;li&gt;One-to-many relationships from dimensions to fact&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Advantages
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;High performance:&lt;/strong&gt; Optimized for Power BI’s VertiPaq engine.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Simple relationships:&lt;/strong&gt; Easier to understand and maintain.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Accurate DAX calculations:&lt;/strong&gt; Fewer ambiguous filter paths.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Better user experience:&lt;/strong&gt; Business users can easily navigate fields.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Example
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;DimDate      DimCustomer     DimProduct
    \             |              /
              FactSales
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Why Power BI Prefers Star Schema
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Reduces model complexity&lt;/li&gt;
&lt;li&gt;Minimizes relationship issues&lt;/li&gt;
&lt;li&gt;Improves query execution speed&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  3. Snowflake Schema
&lt;/h2&gt;

&lt;p&gt;A snowflake schema is a variation of the star schema where dimension tables are normalized into multiple related tables.&lt;/p&gt;

&lt;h3&gt;
  
  
  Structure
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Fact table connects to dimension tables&lt;/li&gt;
&lt;li&gt;Dimension tables further connect to sub-dimension tables&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Example
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;FactSales
   |
DimProduct
   |
DimCategory
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Advantages
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Reduced data redundancy&lt;/li&gt;
&lt;li&gt;Better storage efficiency in some databases&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Disadvantages
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Slower performance due to extra joins&lt;/li&gt;
&lt;li&gt;More complex DAX calculations&lt;/li&gt;
&lt;li&gt;Harder for report users to understand&lt;/li&gt;
&lt;li&gt;Increased risk of incorrect filtering&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Power BI Recommendation
&lt;/h3&gt;

&lt;p&gt;Snowflake schemas are not ideal in Power BI. It is usually best to denormalize snowflake dimensions into flat dimension tables and convert them into a star schema.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Relationships in Power BI
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Types of Relationships
&lt;/h3&gt;

&lt;p&gt;Power BI supports several relationship types:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;One-to-Many (1:*)&lt;/strong&gt; – Most common and recommended&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Many-to-Many (:)&lt;/strong&gt; – Use cautiously&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;One-to-One (1:1)&lt;/strong&gt; – Rare&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Relationship Direction
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Single-direction filtering (recommended)&lt;/li&gt;
&lt;li&gt;Both-direction filtering (use only when necessary)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Poor relationship design can cause:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Incorrect totals&lt;/li&gt;
&lt;li&gt;Ambiguous filter paths&lt;/li&gt;
&lt;li&gt;Performance degradation&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Why Good Data Modelling Is Critical
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Performance Optimization
&lt;/h3&gt;

&lt;p&gt;A clean star schema:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Reduces memory usage&lt;/li&gt;
&lt;li&gt;Speeds up report loading&lt;/li&gt;
&lt;li&gt;Improves interaction responsiveness&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  2. Accurate Reporting
&lt;/h3&gt;

&lt;p&gt;Proper relationships ensure:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Correct aggregations&lt;/li&gt;
&lt;li&gt;Accurate filters and slicers&lt;/li&gt;
&lt;li&gt;Reliable DAX calculations&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  3. Simpler DAX
&lt;/h3&gt;

&lt;p&gt;Well-structured models:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Reduce complex DAX logic&lt;/li&gt;
&lt;li&gt;Prevent calculation errors&lt;/li&gt;
&lt;li&gt;Improve maintainability&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  4. Scalability
&lt;/h3&gt;

&lt;p&gt;Good models can handle:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Growing datasets&lt;/li&gt;
&lt;li&gt;Additional dimensions&lt;/li&gt;
&lt;li&gt;New business requirements without redesign&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  5. Better User Experience
&lt;/h3&gt;

&lt;p&gt;Business users can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Easily understand fields&lt;/li&gt;
&lt;li&gt;Build reports without confusion&lt;/li&gt;
&lt;li&gt;Trust the numbers presented&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Best Practices for Power BI Data Modelling
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Use star schema whenever possible.&lt;/li&gt;
&lt;li&gt;Keep fact tables numeric and transactional.&lt;/li&gt;
&lt;li&gt;Flatten dimension tables.&lt;/li&gt;
&lt;li&gt;Avoid many-to-many relationships unless necessary&lt;/li&gt;
&lt;li&gt;Use single-direction filtering&lt;/li&gt;
&lt;li&gt;Hide technical keys from report view&lt;/li&gt;
&lt;li&gt;Rename fields with business-friendly names&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;Schemas and data modelling form the foundation of effective Power BI solutions. The star schema supported by clearly defined fact and dimension tables and well-managed relationships, delivers optimal performance, accurate reporting and maintainable models. While snowflake schemas may be suitable in traditional databases.&lt;br&gt;
Power BI performs best with simplified, denormalized star models. Investing time in good data modelling is essential for building scalable, reliable, and high-performing Power BI reports.&lt;/p&gt;

</description>
      <category>programming</category>
      <category>powerfuldevs</category>
      <category>luxdev</category>
    </item>
    <item>
      <title>Introduction to Linux for Data Engineers</title>
      <dc:creator>Samuel Wachira</dc:creator>
      <pubDate>Mon, 26 Jan 2026 19:20:04 +0000</pubDate>
      <link>https://forem.com/samwel_sam/introduction-to-linux-for-data-engineers-2i08</link>
      <guid>https://forem.com/samwel_sam/introduction-to-linux-for-data-engineers-2i08</guid>
      <description>&lt;h2&gt;
  
  
  1. Why Linux is Important for Data Engineers
&lt;/h2&gt;

&lt;p&gt;Most data engineering work happens on servers and cloud platforms and almost all of them run Linux. Whether you are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Deploying databases&lt;/li&gt;
&lt;li&gt;Running ETL pipelines&lt;/li&gt;
&lt;li&gt;Managing cloud virtual machines&lt;/li&gt;
&lt;li&gt;Using tools like Hadoop, Spark, Airflow or Docker&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You will interact with a Linux terminal.&lt;/p&gt;

&lt;p&gt;Linux is important for data engineers because:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It is stable and efficient for servers&lt;/li&gt;
&lt;li&gt;It gives powerful command-line tools for automation&lt;/li&gt;
&lt;li&gt;Most data tools are built for Linux first&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I.e.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;If you work with data infrastructure, you will eventually work with Linux.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  2. Understanding the Linux Terminal
&lt;/h2&gt;

&lt;p&gt;The terminal is a text-based interface where you type commands to interact with the system.&lt;/p&gt;

&lt;p&gt;When you open a terminal, you might see something like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;samwel@ubuntu-server:~$
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This means:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;samwel&lt;/code&gt; → your username&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;ubuntu-server&lt;/code&gt; → computer name&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;~&lt;/code&gt; → home directory&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;$&lt;/code&gt; → ready for command input&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  3. Basic Linux Commands
&lt;/h2&gt;

&lt;h3&gt;
  
  
  📁 Check current directory
&lt;/h3&gt;



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

&lt;/div&gt;



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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/home/samwel
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  📂 List files
&lt;/h3&gt;



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

&lt;/div&gt;



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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;data.csv  scripts  logs
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  📁 Create a new folder
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mkdir projects
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  📄 Create an empty file
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;touch pipeline.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  📖 View file contents
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cat data.csv
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  🗑️ Remove a file
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;rm old_data.csv
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  🌍 Download data from the web
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;wget https://example.com/data.csv
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  🔗 Connect to a remote server
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ssh user@192.165.1.10
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is common in data engineering when working with cloud servers.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Editing Files in Linux: Nano vs Vi
&lt;/h2&gt;

&lt;p&gt;Data engineers often edit:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Configuration files&lt;/li&gt;
&lt;li&gt;Python scripts&lt;/li&gt;
&lt;li&gt;SQL files&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Two popular terminal editors are &lt;strong&gt;Nano&lt;/strong&gt; and &lt;strong&gt;Vi&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Using Nano
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Open or create a file:
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;nano script.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Terminal view:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; GNU nano 6.2              script.py

 print("Hello Data Engineering!")

^X Exit   ^O Save   ^K Cut   ^U Paste
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Actions:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Press &lt;code&gt;CTRL + O&lt;/code&gt; → Save&lt;/li&gt;
&lt;li&gt;Press &lt;code&gt;ENTER&lt;/code&gt; to confirm&lt;/li&gt;
&lt;li&gt;Press &lt;code&gt;CTRL + X&lt;/code&gt; → Exit&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Nano is simple and perfect for beginners.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Using Vi
&lt;/h2&gt;

&lt;p&gt;Vi is faster but has modes.&lt;/p&gt;

&lt;h3&gt;
  
  
  Open a file:
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;vi script.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Vi Modes:
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Mode&lt;/th&gt;
&lt;th&gt;Purpose&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Normal&lt;/td&gt;
&lt;td&gt;Navigation&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Insert&lt;/td&gt;
&lt;td&gt;Typing text&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Command&lt;/td&gt;
&lt;td&gt;Saving and quitting&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  ➤ Enter Insert Mode
&lt;/h3&gt;

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

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

&lt;/div&gt;



&lt;p&gt;Now type:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;print("Hello from Vi Editor")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  ➤ Save and Exit
&lt;/h3&gt;

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

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

&lt;/div&gt;



&lt;p&gt;Then type:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;:wq
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Press ENTER.&lt;/p&gt;

&lt;p&gt;Meaning:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;:w&lt;/code&gt; → write (save)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;:q&lt;/code&gt; → quit&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  ➤ Exit without saving
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;:q!
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  7. Why These Skills Matter for Data Engineers
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Editing configuration files on servers&lt;/li&gt;
&lt;li&gt;Writing Python ETL scripts remotely&lt;/li&gt;
&lt;li&gt;Managing cron jobs for scheduled pipelines&lt;/li&gt;
&lt;li&gt;Fixing errors directly in cloud terminals&lt;/li&gt;
&lt;li&gt;Deploying database services&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Mastering Linux editing tools saves time and prevents mistakes.&lt;/p&gt;

&lt;h2&gt;
  
  
  8. Summary
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Concept&lt;/th&gt;
&lt;th&gt;Key Point&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Linux&lt;/td&gt;
&lt;td&gt;Core operating system for data infrastructure&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Terminal&lt;/td&gt;
&lt;td&gt;Command-based system control&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Basic Commands&lt;/td&gt;
&lt;td&gt;Navigate, create, delete, download files&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Nano&lt;/td&gt;
&lt;td&gt;Easy editor for beginners&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Vi&lt;/td&gt;
&lt;td&gt;Advanced editor used on servers&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Practical Use&lt;/td&gt;
&lt;td&gt;Editing scripts and configs directly on servers&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;Linux may look scary at first, but once you practice basic commands and text editing, it becomes natural. For data engineers, Linux is  is a daily working environment.&lt;/p&gt;

</description>
      <category>programming</category>
      <category>dataengineering</category>
      <category>luxacademy</category>
    </item>
    <item>
      <title>Git &amp; GitHub for Beginners: A Simple Guide to Version Control</title>
      <dc:creator>Samuel Wachira</dc:creator>
      <pubDate>Sun, 18 Jan 2026 11:09:39 +0000</pubDate>
      <link>https://forem.com/samwel_sam/git-github-for-beginners-a-simple-guide-to-version-control-333b</link>
      <guid>https://forem.com/samwel_sam/git-github-for-beginners-a-simple-guide-to-version-control-333b</guid>
      <description>&lt;p&gt;If you are learning programming, sooner or later you will hear about &lt;strong&gt;Git&lt;/strong&gt; and &lt;strong&gt;GitHub&lt;/strong&gt;. At first, they may sound confusing but once you understand the basics, they become essential tools in every developer’s workflow.&lt;/p&gt;

&lt;p&gt;In this article, you will learn:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What Git is and why version control matters&lt;/li&gt;
&lt;li&gt;How to push code to GitHub&lt;/li&gt;
&lt;li&gt;How to pull code from GitHub&lt;/li&gt;
&lt;li&gt;How to track changes using Git&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let’s go step by step.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Git?
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Git&lt;/strong&gt; is a &lt;strong&gt;version control system&lt;/strong&gt;.&lt;br&gt;
It helps you track changes in your code over time.&lt;/p&gt;

&lt;p&gt;Think of Git like a &lt;strong&gt;time machine for your project&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You can save versions of your code&lt;/li&gt;
&lt;li&gt;Go back to previous versions if something breaks&lt;/li&gt;
&lt;li&gt;See who changed what and when&lt;/li&gt;
&lt;li&gt;Work with other developers without overwriting each other’s work
Git runs &lt;strong&gt;locally&lt;/strong&gt; on your computer.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Why Version Control is Important
&lt;/h2&gt;

&lt;p&gt;Imagine this situation:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You are working on a project.&lt;/li&gt;
&lt;li&gt;You make changes.&lt;/li&gt;
&lt;li&gt;Suddenly, your code stops working.&lt;/li&gt;
&lt;li&gt;You wish you could go back to yesterday’s working version.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Without version control:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You would have to manually copy folders.&lt;/li&gt;
&lt;li&gt;You might lose working code.&lt;/li&gt;
&lt;li&gt;Collaboration becomes messy.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;With Git:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Every saved version is stored safely&lt;/li&gt;
&lt;li&gt;You can experiment without fear&lt;/li&gt;
&lt;li&gt;Teams can work together smoothly&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That is why version control is essential in real-world development.&lt;/p&gt;
&lt;h2&gt;
  
  
  What is GitHub?
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;GitHub&lt;/strong&gt; is an &lt;strong&gt;online platform&lt;/strong&gt; that stores Git repositories.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Git - tool on your computer&lt;/li&gt;
&lt;li&gt;GitHub - cloud storage for your Git projects&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It allows:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Backup of your projects online&lt;/li&gt;
&lt;li&gt;Sharing code with others&lt;/li&gt;
&lt;li&gt;Collaboration on open-source projects&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Installing Git
&lt;/h2&gt;

&lt;p&gt;Download Git from:&lt;br&gt;
&lt;a href="https://git-scm.com/" rel="noopener noreferrer"&gt;https://git-scm.com/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After installation, verify:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git &lt;span class="nt"&gt;--version&lt;/span&gt;

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

&lt;/div&gt;



&lt;h2&gt;
  
  
  Basic Git Setup
&lt;/h2&gt;

&lt;p&gt;Before using Git, set your username and email:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git config &lt;span class="nt"&gt;--global&lt;/span&gt; user.name &lt;span class="s2"&gt;"Your Name"&lt;/span&gt;
git config &lt;span class="nt"&gt;--global&lt;/span&gt; user.email &lt;span class="s2"&gt;"youremail@example.com"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  How to Track Changes Using Git
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Step 1: Initialize Git in your project
&lt;/h3&gt;

&lt;p&gt;Inside your project folder:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git init
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This creates a hidden &lt;code&gt;.git&lt;/code&gt; folder — your local repository.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 2: Check file status
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git status
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This shows:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Which files are new&lt;/li&gt;
&lt;li&gt;Which files were modified&lt;/li&gt;
&lt;li&gt;Which files are ready to commit&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Step 3: Add files to staging
&lt;/h3&gt;

&lt;p&gt;To track a file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git add filename
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or add everything:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git add &lt;span class="nb"&gt;.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 4: Commit changes
&lt;/h3&gt;

&lt;p&gt;A commit saves a snapshot of your project.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git commit &lt;span class="nt"&gt;-m&lt;/span&gt; &lt;span class="s2"&gt;"Added homepage layout"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each commit has:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A unique ID&lt;/li&gt;
&lt;li&gt;A message describing the change&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Step 5: View commit history
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git log
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  How to Push Code to GitHub
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Step 1: Create a repository on GitHub
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Go to &lt;a href="https://github.com" rel="noopener noreferrer"&gt;https://github.com&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;New Repository&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Give it a name&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Create Repository&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Step 2: Connect local Git to GitHub
&lt;/h3&gt;

&lt;p&gt;Copy the repository URL from GitHub, then run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git remote add origin https://github.com/yourusername/your-repo.git
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 3: Push your code
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git branch &lt;span class="nt"&gt;-M&lt;/span&gt; main
git push &lt;span class="nt"&gt;-u&lt;/span&gt; origin main
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now your project is uploaded to GitHub 🎉&lt;/p&gt;

&lt;h2&gt;
  
  
  How to Pull Code from GitHub
&lt;/h2&gt;

&lt;p&gt;If you want to download updates from GitHub to your computer:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git pull origin main
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This fetches the latest changes and merges them into your local project.&lt;/p&gt;

&lt;h2&gt;
  
  
  Bonus: Cloning a GitHub Repository
&lt;/h2&gt;

&lt;p&gt;If a project already exists on GitHub, you can copy it to your computer:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone https://github.com/username/repository.git
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Common Git Workflow
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Make changes to code&lt;/li&gt;
&lt;li&gt;&lt;code&gt;git status&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;git add .&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;git commit -m "message"&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;git push&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Repeat 🚀&lt;/p&gt;

&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;Git and GitHub may seem complex at first, but once you practice the basic commands, they become second nature.&lt;br&gt;
They help you:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Keep your code safe&lt;/li&gt;
&lt;li&gt;Work confidently&lt;/li&gt;
&lt;li&gt;Collaborate professionally
If you are serious about software development, mastering Git is a must.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Quick Command Summary
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git init
git status
git add &lt;span class="nb"&gt;.&lt;/span&gt;
git commit &lt;span class="nt"&gt;-m&lt;/span&gt; &lt;span class="s2"&gt;"message"&lt;/span&gt;
git push
git pull
git clone
git log
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>programming</category>
      <category>luxdevhq</category>
    </item>
  </channel>
</rss>
