<?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: Faith</title>
    <description>The latest articles on DEV Community by Faith (@faith_ondiege_6e7c59f9ac3).</description>
    <link>https://dev.to/faith_ondiege_6e7c59f9ac3</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4070902%2F8d1235a0-90d6-4424-83c9-1079d6a34c7a.png</url>
      <title>DEV Community: Faith</title>
      <link>https://dev.to/faith_ondiege_6e7c59f9ac3</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/faith_ondiege_6e7c59f9ac3"/>
    <language>en</language>
    <item>
      <title>Filtering Data in SQL: A Beginner’s Guide to WHERE using AND, OR, LIKE and Friends</title>
      <dc:creator>Faith</dc:creator>
      <pubDate>Tue, 27 Oct 2026 16:43:58 +0000</pubDate>
      <link>https://dev.to/faith_ondiege_6e7c59f9ac3/filtering-data-in-sql-a-beginnersguide-to-where-using-and-or-like-and-friends-10na</link>
      <guid>https://dev.to/faith_ondiege_6e7c59f9ac3/filtering-data-in-sql-a-beginnersguide-to-where-using-and-or-like-and-friends-10na</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;As they say SQL is the backbone or foundation of data not really sure which one it is but, all that to say SQL forms a crucial part in data and data projects. At the moment there is tans and tans of data being produced all the time, increasing the scope of work for any data professional. Hence the need for filtering and that why we need the &lt;strong&gt;WHERE&lt;/strong&gt; clause in SQL alongside its partners that make work easier and bearable. &lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;WHERE&lt;/strong&gt; clause is used to filter rows based on one or more conditions. It ensures that queries return or modify only the required records.&lt;/p&gt;

&lt;p&gt;Filters data based on specified conditions.&lt;br&gt;
Used with SELECT, UPDATE and DELETE statements.&lt;br&gt;
Works with comparison and logical operators.&lt;/p&gt;
&lt;h2&gt;
  
  
  Filtering using WHERE
&lt;/h2&gt;
&lt;h3&gt;
  
  
  Comparison Operators
&lt;/h3&gt;

&lt;p&gt;They come in handy when comparing two values and filters the result set based on a specific condition as well as help check for equality, range, or inequality&lt;br&gt;
Make SQL queries powerful and precise&lt;br&gt;
They include: =, &amp;gt;, &amp;lt;, &amp;gt;=, &amp;lt;=, &amp;lt;&amp;gt;&lt;/p&gt;

&lt;p&gt;Syntax&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT * FROM TABLE_NAME 
WHERE ATTRIBUTE CONDITION_OPERATOR GIVEN_VALUE;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Examples from our fictional hospital dataset:&lt;/p&gt;

&lt;p&gt;Listing all patients from Kisumu county. ( = , equal to )&lt;br&gt;
&lt;code&gt;select * from patients where county ='Kisumu';&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;ListIng all patients who are not in the General department. ( &amp;lt;&amp;gt; or != , note equal to)&lt;br&gt;
&lt;code&gt;select * from patients where department &amp;lt;&amp;gt; 'General';&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Showing the first name, department and bill amount of patients whose bill is greater than 100,000.&lt;br&gt;
&lt;code&gt;select  first_name, department, bill_amount from patients where bill_amount &amp;gt; 100000;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Showing patients aged 18 or younger. ( &amp;lt;= , less than)&lt;br&gt;
&lt;code&gt;select * from patients where age &amp;lt;= 18;&lt;br&gt;
&lt;/code&gt;&lt;br&gt;
Lising patients admitted on or after 1 April 2026. ( &amp;gt;= on a date)&lt;br&gt;
&lt;code&gt;select * from patients where admission_date &amp;gt;= '2026-04-01';&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;All these examples demonstrate comparison of one variable from another in the same column. &lt;/p&gt;

&lt;h3&gt;
  
  
  Logical operators AND, IN and BETWEEN
&lt;/h3&gt;

&lt;p&gt;Used to test conditions in queries, returning results as TRUE, FALSE or UNKNOWN. They help in combining, negating and comparing conditions, enabling precise data retrieval and filtering. i.e IN,&lt;/p&gt;

&lt;h3&gt;
  
  
  AND Operator
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;AND&lt;/strong&gt; combines multiple conditions in an SQL query and returns only the records that satisfy all the specified conditions.&lt;/p&gt;

&lt;p&gt;Example: Listing female patients in the Maternity department. ( AND )&lt;br&gt;
&lt;code&gt;select * from patients where gender = 'Female' and department = 'Maternity';&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Output:&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fsx3w2k6a07brstrqg2dj.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fsx3w2k6a07brstrqg2dj.png" alt=" " width="800" height="156"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  NOT Operator
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;NOT&lt;/strong&gt; is used to reverse the result of a condition, returning TRUE when the condition is FALSE. It is typically used to exclude records that match a specific condition, making it useful for filtering out unwanted data.&lt;/p&gt;

&lt;p&gt;An example would be,&lt;br&gt;
Listing patients who are not in Cardiology, Orthopedics or Emergency.&lt;/p&gt;

&lt;p&gt;Query&lt;br&gt;
&lt;code&gt;select * from patients where department not in  ( 'Cardiology');&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Output&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fz7j0ilz6izq8mn0lrcoh.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fz7j0ilz6izq8mn0lrcoh.png" alt=" " width="550" height="288"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  OR Operator
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;OR&lt;/strong&gt; combines multiple conditions in a SQL query and returns TRUE if at least one of the conditions is satisfied. It is ideal for situations where you want to retrieve records that meet any of several possible conditions.&lt;/p&gt;

&lt;p&gt;Example: Listing patients from Nairobi or Mombasa, written with OR .&lt;br&gt;
&lt;code&gt;select * from patients where county = 'Mombasa' or county ='Nairobi';&lt;br&gt;
&lt;/code&gt;&lt;br&gt;
Output&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fosfmn658ienwmews3tdf.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fosfmn658ienwmews3tdf.png" alt=" " width="434" height="132"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Range/List
&lt;/h2&gt;

&lt;h3&gt;
  
  
  IN Operator
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;IN&lt;/strong&gt; checks whether a value matches any value in a specified list, providing a concise alternative to multiple OR conditions.&lt;/p&gt;

&lt;p&gt;Example: Listing patients covered by SHA, AAR or Britam. &lt;br&gt;
&lt;code&gt;select * from patients where insurance in('SHA', 'AAR', 'Britam');&lt;br&gt;
&lt;/code&gt;&lt;br&gt;
Output:&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F1g9hcuaxhdcaod3mdlar.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F1g9hcuaxhdcaod3mdlar.png" alt=" " width="409" height="221"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  BETWEEN OPERATOR
&lt;/h3&gt;

&lt;p&gt;BETWEEN in SQL checks whether a value lies within a specified range, including both the lower and upper limits.&lt;/p&gt;

&lt;p&gt;Example&lt;br&gt;
Listing patients who are not aged between 18 and 60. &lt;br&gt;
&lt;code&gt;select * from patients where age not between 18 and 60;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Output&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F7h7nza4pgbbnrmh01xz3.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F7h7nza4pgbbnrmh01xz3.png" alt=" " width="565" height="118"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Query&lt;br&gt;
Listing patients who are not in Cardiology, Orthopedics or Emergency. &lt;br&gt;
&lt;code&gt;select * from patients where department not in  ( 'Cardiology');&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Output&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fqmqmvz6q7d8q37n1b1ov.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fqmqmvz6q7d8q37n1b1ov.png" alt=" " width="563" height="268"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  NULL
&lt;/h3&gt;

&lt;p&gt;If a field in a table is optional, it is possible to insert or update a record without adding any value to this field. This way, the field will be saved with a &lt;em&gt;NULL&lt;/em&gt; value.&lt;/p&gt;

&lt;p&gt;A &lt;em&gt;NULL&lt;/em&gt; value represents an unknown, missing, or inapplicable data in a database field. It is not a value itself, but a placeholder to indicate the absence of data.&lt;/p&gt;

&lt;h3&gt;
  
  
  IS NULL Syntax
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT column_names
FROM table_name
WHERE column_name IS NULL;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Example: Listing patients with no email address. &lt;br&gt;
&lt;code&gt;select * from patients where email is null;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Output&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F2s290m9fl94cvqttmlek.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F2s290m9fl94cvqttmlek.png" alt=" " width="640" height="164"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  IS NOT NULL Syntax
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT column_names
FROM table_name
WHERE column_name IS NOT NULL;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Example Listing the first name, last name and insurance of patients who have insurance. (&lt;br&gt;
&lt;code&gt;select  first_name, last_name, insurance from patients where insurance is not null;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Output&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Frcifhjbiwzmvb58kysqh.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Frcifhjbiwzmvb58kysqh.png" alt=" " width="463" height="279"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;h4&gt;
  
  
  LIKE and ILIKE
&lt;/h4&gt;

&lt;p&gt;PostgreSQL is a case-sensitive language in order to make it a case-insensitive language during pattern matching we make use of the ILIKE operator.&lt;/p&gt;

&lt;p&gt;ILIKE operator works the same way as a LIKE operator but makes the language case-insensitive. Both the operators are used for pattern matching in PostgreSQL.&lt;/p&gt;

&lt;p&gt;Example Listing patients whose first name starts with K.&lt;br&gt;
&lt;code&gt;select * from patients where first_name like 'K%';&lt;/code&gt;&lt;br&gt;
Gives this Output&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fxoqma2h82xjp1ph59tkp.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fxoqma2h82xjp1ph59tkp.png" alt=" " width="627" height="70"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;While&lt;br&gt;
&lt;code&gt;select * from patients where first_name like 'k%';&lt;/code&gt;&lt;br&gt;
Returns zero rows as there are no rows where the &lt;em&gt;first_name&lt;/em&gt; starts with lowercase &lt;em&gt;k&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;Instead we can use this query;&lt;br&gt;
&lt;code&gt;select * from patients where first_name ilike 'k%';&lt;/code&gt;&lt;br&gt;
As it returns the same number of columns as the first query we tried.&lt;br&gt;
&lt;code&gt;select * from patients where first_name like 'K%';&lt;/code&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F94brqw8hgurbml1y1tfs.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F94brqw8hgurbml1y1tfs.png" alt=" " width="627" height="70"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>sql</category>
      <category>clauses</category>
      <category>postgressql</category>
      <category>dbeaver</category>
    </item>
    <item>
      <title>Exploring Window Functions, Joins, Subqueries and CTEs in SQL</title>
      <dc:creator>Faith</dc:creator>
      <pubDate>Sun, 18 Oct 2026 09:34:01 +0000</pubDate>
      <link>https://dev.to/faith_ondiege_6e7c59f9ac3/exploring-window-functions-joins-subqueries-and-ctes-in-sql-30h4</link>
      <guid>https://dev.to/faith_ondiege_6e7c59f9ac3/exploring-window-functions-joins-subqueries-and-ctes-in-sql-30h4</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;As I explore databases and &lt;strong&gt;SQL&lt;/strong&gt; as part of my learning curve in becoming a data analyst. It is inevitable to learn about &lt;strong&gt;Functions&lt;/strong&gt; in SQL. Today, I land at exploring Window Functions, Joins, Subqueries and Common Table Expressions. These functions and tools come in handy when writing queries that are necessary in answering pertinent questions using data. I'll be using a fictional Hospital Data set to demonstrate the said functions and methods.&lt;/p&gt;

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

&lt;p&gt;SQL window functions allow performing calculations across a set of rows that are related to the current row, without collapsing the result into a single value. They are commonly used for tasks like aggregates, rankings and running totals. The OVER clause defines the “window” of rows for the calculation. &lt;/p&gt;

&lt;p&gt;PARTITION BY: It divides the data into groups using &lt;em&gt;Partition by&lt;/em&gt;.&lt;br&gt;
ORDER BY: It specifies the order of rows within each group using &lt;em&gt;order by&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;With this, functions such as SUM(), AVG(), ROW_NUMBER(), RANK() and DENSE_RANK() can be applied in a controlled way.&lt;/p&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT column_name1, 
       window_function(column_name2) 
       OVER ([PARTITION BY column_name3] [ORDER BY column_name4]) AS new_column
FROM table_name;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;window_function: Function used for calculation/ranking&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;column_name1: Column(s) to display&lt;/li&gt;
&lt;li&gt;column_name2: Function column&lt;/li&gt;
&lt;li&gt;column_name3: PARTITION BY column&lt;/li&gt;
&lt;li&gt;column_name4: ORDER BY column&lt;/li&gt;
&lt;li&gt;new_column: Result alias&lt;/li&gt;
&lt;li&gt;table_name: Source table&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;SQL window functions are mainly of two types: aggregate window functions and ranking window functions.&lt;/p&gt;

&lt;h4&gt;
  
  
  Aggregate Window Functions
&lt;/h4&gt;

&lt;p&gt;Aggregate window functions calculate aggregates over a window of rows while retaining individual rows. Common aggregate functions include:&lt;/p&gt;

&lt;p&gt;SUM(): Sums values within multiple rows.&lt;br&gt;
AVG(): Calculates the average value a window&lt;br&gt;
COUNT(): Counts the rows within a window.&lt;br&gt;
MAX(): Returns the maximum value in the window.&lt;br&gt;
MIN(): Returns the minimum value in the window.&lt;/p&gt;

&lt;p&gt;Example: Using AVG(), we will calculate the average hospital bill along side different insurance providers.&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 patient_id, ward_id, insurance_provider, total_bill_kes,
       AVG(total_bill_kes) OVER (
           PARTITION BY insurance_provider
       ) AS avg_bill
FROM visits;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output:&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fl6d76i54zkb0ktr3lryw.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fl6d76i54zkb0ktr3lryw.png" alt=" " width="798" height="423"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This average value is displayed for each patient belonging to the same &lt;em&gt;insurance_provider&lt;/em&gt;.&lt;/p&gt;

&lt;h4&gt;
  
  
  Ranking Window Functions
&lt;/h4&gt;

&lt;p&gt;These functions provide rankings of rows within a partition based on specific criteria. Common ranking functions include:&lt;/p&gt;

&lt;p&gt;RANK(): Assigns ranks to rows, skipping ranks for duplicates.&lt;br&gt;
DENSE_RANK(): Assigns ranks to rows without skipping rank numbers for duplicates.&lt;br&gt;
ROW_NUMBER(): Assigns a unique number to each row in the result set.&lt;br&gt;
PERCENT_RANK(): Shows the relative rank of a row as a percentage between 0 and 1.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;RANK() Function&lt;/strong&gt; are used to assign ranks to rows within a group based on a specific order. Ranking functions are commonly used to organize and analyze data. Some common ranking functions include:&lt;/p&gt;

&lt;p&gt;Example: Using RANK(), we will rank &lt;em&gt;payment_method _by _total_bill&lt;/em&gt;, allowing gaps in ranks when total_bills are equal.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT patient_id, total_bill_kes, payment_method,
       RANK() OVER (
           PARTITION BY payment_method
           ORDER BY total_bill_kes DESC
       ) AS bill_rank
FROM visits;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;output:&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fa0aeptxa33rnkn2d103m.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fa0aeptxa33rnkn2d103m.png" alt=" " width="612" height="408"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;DENSE RANK()&lt;/strong&gt; gives the same rank to rows with equal values. It then continues with the next number without skipping, keeping the ranking sequence continuous.&lt;br&gt;
DENSE_RANK() works like RANK(), but it ensures the ranking sequence has no gaps.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;ROW NUMBER()&lt;/strong&gt; Function gives a unique number to each row in the result set. It increments by 1 for every row, even if values are the same, so no two rows have the same number.&lt;/p&gt;

&lt;p&gt;Example: Using ROW_NUMBER(), we will assign a unique number to each row based on years_of_experience order.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;--Rownumber()
SELECT doctor_name, doctor_gender, doctor_specialty, doctor_experience_years,
       ROW_NUMBER() OVER (
           PARTITION BY doctor_specialty
           ORDER BY doctor_experience_years DESC
       ) AS experience_row_no
FROM doctors;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;output:&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fxvqflfgdjyqvvjh42bgf.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fxvqflfgdjyqvvjh42bgf.png" alt=" " width="798" height="206"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;PERCENT RANK()&lt;/strong&gt; shows where a row stands compared to others in the same group.&lt;/p&gt;

&lt;h3&gt;
  
  
  SQL Joins
&lt;/h3&gt;

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

&lt;ul&gt;
&lt;li&gt;Matching records using common columns.&lt;/li&gt;
&lt;li&gt;Improving data analysis by combining related information.&lt;/li&gt;
&lt;li&gt;Creating meaningful result sets from separate tables.z&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  INNER JOIN
&lt;/h4&gt;

&lt;p&gt;INNER JOIN is used to retrieve rows where matching values exist in both tables. It helps in:&lt;/p&gt;

&lt;p&gt;Combining records based on a related column.&lt;br&gt;
Returning only matching rows from both tables.&lt;br&gt;
Excluding non-matching data from the result set.&lt;br&gt;
Ensuring accurate data relationships between tables.&lt;/p&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT A.column1, A.column2, B.column1, ...
FROM tableA AS A
INNER JOIN tableB AS B
ON A.matching_column = B.matching_column;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Example of INNER JOIN:&lt;/p&gt;

&lt;p&gt;To find doctors with patients with follow up needs.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT A.doctor_id, A.follow_up_required
FROM visits AS A
INNER JOIN doctors AS B
ON A.doctor_id = B.doctor_id;

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

&lt;/div&gt;



&lt;p&gt;output:&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fkg461zv7qzxmnxikynli.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fkg461zv7qzxmnxikynli.png" alt=" " width="384" height="422"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  LEFT JOIN
&lt;/h4&gt;

&lt;p&gt;LEFT JOIN is used to retrieve all rows from the left table and matching rows from the right table. It helps in:&lt;/p&gt;

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

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT A.column1, A.column2, B.column1, ...
FROM tableA AS A
LEFT JOIN tableB AS B
ON A.matching_column = B.matching_column;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, the LEFT JOIN retrieves all rows from the patients table and the matching rows from the visits table based on the patient_id column.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;select A.patient_id, A.patient_name, A.county
from patients as A
left join visits as B
on A.patient_id = B.patient_id;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;output:&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fmsrzsi00vj5tkychwmjw.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fmsrzsi00vj5tkychwmjw.png" alt=" " width="467" height="421"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  RIGHT JOIN
&lt;/h4&gt;

&lt;p&gt;RIGHT JOIN is used to retrieve all rows from the right table and the matching rows from the left table. It helps in:&lt;/p&gt;

&lt;p&gt;Returning all records from the right-side table.&lt;br&gt;
Showing matching data from the left-side table.&lt;br&gt;
Displaying NULL values where no match exists in the left table.&lt;br&gt;
Performing outer joins, also known as RIGHT OUTER JOIN.&lt;/p&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT A.column1, A.column2, B.column1, ...
FROM tableA AS A
RIGHT JOIN tableB AS B
ON A.matching_column = B.matching_column;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;select A.diagnosis_id, A.diagnosis_name, B.total_bill_kes
from diagnosis as A
left join visits as B
on A.diagnosis_id = B.diagnosis_id;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;output:&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Feqpxayi91em5qorqgx7d.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Feqpxayi91em5qorqgx7d.png" alt=" " width="532" height="422"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  FULL JOIN
&lt;/h4&gt;

&lt;p&gt;FULL JOIN is used to combine the results of both LEFT JOIN and RIGHT JOIN. It helps in:&lt;/p&gt;

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

&lt;p&gt;Syntax:&lt;br&gt;
SELECT A.column1, A.column2, B.column1, ...&lt;br&gt;
FROM tableA AS A&lt;br&gt;
FULL JOIN tableB AS B&lt;br&gt;
ON A.matching_column = B.matching_column;&lt;/p&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;select A.procedure_id, A.procedure_name, B.patient_id, B.total_bill_kes
from procedures as A
left join visits as B
on A.procedure_id = B.procedure_id;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Full join combines the contents of both the procedures table as well as the &lt;em&gt;visits&lt;/em&gt;  table connecting the two tables with a common column &lt;em&gt;procedure_id.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;output:&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F015gz5u1fjr9xd6rzual.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F015gz5u1fjr9xd6rzual.png" alt=" " width="650" height="407"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Self Join
&lt;/h4&gt;

&lt;p&gt;Self-join allows us to join a table itself. It is useful when a user wants to compare the data (rows) within the same table.&lt;/p&gt;

&lt;h4&gt;
  
  
  Cross Join
&lt;/h4&gt;

&lt;p&gt;Cross join allows us to join each and every row of both the tables. It is similar to the cartesian product that joins all the rows&lt;/p&gt;

&lt;h4&gt;
  
  
  Common Table Expression (CTE) in SQL
&lt;/h4&gt;

&lt;p&gt;A Common Table Expression (CTE) is a temporary result set in SQL that you can reference within a single query. CTEs simplify complex queries, make them easier to read and can be reused multiple times within the same query. It is used for:&lt;/p&gt;

&lt;p&gt;Performing recursive operations, such as traversing hierarchical data.&lt;br&gt;
Breaking down multi-step calculations into manageable parts.&lt;br&gt;
Replacing nested subqueries in complex data retrieval tasks.&lt;br&gt;
Consider our visits table containing patient visits details such as visit_id, patient_id, diagnosis_id, total_bill_kes and patient_satisfaction_score. We will use this table to demonstrate Common Table Expression (CTE) examples.&lt;/p&gt;

&lt;p&gt;Example: Calculate Average bill by patient admission type&lt;br&gt;
This example uses a CTE to find the average bill of the different admission types the patients were under, making the query simpler and easier to read.&lt;/p&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;WITH cte_name AS (
    SELECT query
)
SELECT *
FROM cte_name;

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

&lt;/div&gt;



&lt;p&gt;cte_name: A unique name for the CTE expression.&lt;br&gt;
query: A valid SQL query that returns a result set, which will be treated as a virtual table within the main query.&lt;br&gt;
SELECT: The main query that can reference the CTE by its name.&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;WITH avg_total_bill_kes AS (
    SELECT admission_type, AVG(total_bill_kes) AS avg_bill
    FROM visits
    GROUP BY admission_type
)
SELECT *
FROM avg_total_bill_kes;

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

&lt;/div&gt;



&lt;p&gt;Output:&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F57o9b5pcnxzxptq3580v.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F57o9b5pcnxzxptq3580v.png" alt=" " width="439" height="208"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The WITH clause defines a CTE named &lt;em&gt;avg_total_bill_kes&lt;/em&gt;.&lt;br&gt;
The main query references this CTE to retrieve the average bill for each admission type.&lt;/p&gt;
&lt;h4&gt;
  
  
  Recursive Common Table Expression
&lt;/h4&gt;

&lt;p&gt;A recursive CTE references itself to retrieve hierarchical data, such as employee-manager relationships. Use MAXRECURSION to prevent infinite loops. It consist of two parts:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Anchor member&lt;/strong&gt;: The initial query that selects the base case (e.g., top-level managers).&lt;br&gt;
Recursive member: The query that references the CTE itself, pulling the next level of data.&lt;/p&gt;
&lt;h4&gt;
  
  
  Uses of CTEs
&lt;/h4&gt;

&lt;p&gt;CTEs (Common Table Expressions) help simplify and organize complex SQL queries.&lt;/p&gt;

&lt;p&gt;Breaks complex queries into small, reusable parts.&lt;br&gt;
Makes queries easier to read and understand.&lt;br&gt;
Helps work with hierarchical data using recursion.&lt;br&gt;
Limitations&lt;br&gt;
While useful, CTEs come with a few practical constraints.&lt;/p&gt;

&lt;p&gt;Temporary: A CTE works only while the query runs, then it disappears.&lt;br&gt;
Performance: On very large data, CTEs can be slower if reused many times.&lt;br&gt;
Restrictions: Some databases limit using CTEs with INSERT, UPDATE or DELETE.&lt;/p&gt;
&lt;h4&gt;
  
  
  CTE vs. Subqueries
&lt;/h4&gt;

&lt;p&gt;CTE Can be referenced multiple times while Subqueries are typically used once.&lt;br&gt;
CTE Improves readability for complex queries. Subqueries can become difficult to read when nested.&lt;br&gt;
CTEs are Optimized for multiple references. On the other hand, subqueries may be less efficient for repeated operations.&lt;/p&gt;
&lt;h3&gt;
  
  
  SQL Subquery
&lt;/h3&gt;

&lt;p&gt;A subquery in SQL is a query nested inside another SQL query. It allows complex filtering, aggregation and data manipulation by using the result of one query inside another. They are an essential tool when we need to perform operations like:&lt;/p&gt;

&lt;p&gt;Apply aggregate functions like SUM, COUNT or AVG dynamically.&lt;br&gt;
Update data using values from other tables.&lt;br&gt;
Delete rows based on conditions returned by another query.&lt;/p&gt;

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

&lt;p&gt;SELECT * FROM visits&lt;br&gt;
WHERE total_bill_kes &amp;gt;  ( SELECT AVG(total_bill_kes) FROM visits );&lt;/p&gt;

&lt;p&gt;output:&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fmu9b47cjw83ghaacu62f.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fmu9b47cjw83ghaacu62f.png" alt=" " width="799" height="271"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  SQL Clauses for Subqueries
&lt;/h3&gt;

&lt;p&gt;Clauses that can be used with subqueries are:&lt;/p&gt;

&lt;p&gt;Filters rows in the outer query based on the results returned by the WHERE clause.&lt;br&gt;
Treats the subquery as a temporary (derived) table that can be queried like a normal table using the FROM clause.&lt;br&gt;
Filters grouped or aggregated results using values produced by the HAVING clause.&lt;/p&gt;
&lt;h3&gt;
  
  
  Single-Row Subquery
&lt;/h3&gt;

&lt;p&gt;A single-row subquery is a subquery that returns only one value.&lt;/p&gt;

&lt;p&gt;Returns exactly one row as the result.&lt;br&gt;
Commonly used with comparison operators such as =, &amp;gt;, &amp;lt;&lt;br&gt;
Example:&lt;/p&gt;

&lt;p&gt;SELECT * FROM patients&lt;br&gt;
WHERE patient_age = (SELECT MAX(patient_age) FROM patients);&lt;/p&gt;
&lt;h3&gt;
  
  
  Multi-Row Subquery
&lt;/h3&gt;

&lt;p&gt;A multi-row subquery is a subquery that returns more than one value.&lt;/p&gt;

&lt;p&gt;Returns multiple rows as the result.&lt;br&gt;
Requires operators that can handle multiple values, such as IN, ANY or ALL&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;-- Multi-Row Subquery
SELECT * FROM patients
WHERE patient_id IN (SELECT patient_id FROM patients WHERE county = 'Nairobi');
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;output:&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fwsu7ga6fhftoafpjsj48.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fwsu7ga6fhftoafpjsj48.png" alt=" " width="800" height="132"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Correlated Subquery&lt;br&gt;
A correlated subquery is a subquery that depends on the outer query for its values.&lt;/p&gt;

&lt;p&gt;A dependent subquery: it references columns from the outer query.&lt;br&gt;
Executed once for each row of the outer query, making it slower for large datasets.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT A.patient_id, A.patient_name
FROM patients A
WHERE A.patient_age &amp;gt; (SELECT AVG(patient_age) 
                  FROM patients
                  WHERE patient_id = patient_id);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;output:&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fa0e7n89t02qicxqehmhs.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fa0e7n89t02qicxqehmhs.png" alt=" " width="442" height="379"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Fetching Data Using Subquery in WHERE Clause
&lt;/h4&gt;

&lt;p&gt;This example uses a subquery in the WHERE clause. The inner query finds roll numbers of students in Section 'A' and the outer query displays their details from the Student table.&lt;/p&gt;

&lt;h3&gt;
  
  
  Scalar Subqueries
&lt;/h3&gt;

&lt;p&gt;When a subquery returns only a single data value, which will be a single row with single column, then it is called a Scalar subquery.&lt;/p&gt;

&lt;h3&gt;
  
  
  Nested Subqueries
&lt;/h3&gt;

&lt;p&gt;When there are SQL SELECT queries inside a Subquery then it can be called Nested Subqueries. There can be upto 32 levels of nested queries in a single Outer or Main SQL Query statement.&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 * from visits Where patient_id IN (Select patient_id from patients where patient_age &amp;gt; 
(Select patient_id from patients where patient_id=10));

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

&lt;/div&gt;



&lt;p&gt;output:&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4o4nlu5jwwrmdr1z17in.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4o4nlu5jwwrmdr1z17in.png" alt=" " width="799" height="305"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Benefits of Using Subqueries in SQL Server
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Helps to avoid Code duplication
&lt;/h4&gt;

&lt;p&gt;Subqueries are useful in avoiding Code duplication or not repeating complex logic in multiple places. This reduces the risk of errors and improves code maintainability.&lt;/p&gt;

&lt;h4&gt;
  
  
  Subqueries improve Code Readability
&lt;/h4&gt;

&lt;p&gt;Subqueries can break large code and complex logic into easy to understand and more manageable code blocks.&lt;/p&gt;

&lt;h4&gt;
  
  
  Useful to perform Complex calculations or data manipulations
&lt;/h4&gt;

&lt;p&gt;Subqueries can be used to perform complex calculations or logic by dividing a single statement query into subqueries to get data from different tables or calculating aggregate values based on dynamic business cases.&lt;/p&gt;

&lt;h4&gt;
  
  
  Helps increase Flexibility
&lt;/h4&gt;

&lt;p&gt;Subqueries can be used to filter data dynamically based on the result from other queries, which provides greater flexibility.&lt;/p&gt;

&lt;p&gt;Provides data retrieval from multiple tables&lt;br&gt;
Subqueries are useful when we need to combine data from multiple tables in a single query.&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;Subqueries and functions are an important part of data analysis and querying. Here are a few thing I have taken note &lt;br&gt;
While using Window Function Partition carefully: Without Partition by, the whole table is treated as one group.&lt;br&gt;
Check Order by : It controls the calculation order in the window.&lt;br&gt;
Optimize performance: Window functions can be slow on large datasets; use indexes if needed.&lt;/p&gt;

&lt;p&gt;As for JOINS We can also write JOIN instead of INNER JOIN.  JOIN is same as INNER JOIN. Same case for LEFT OUTER JOIN and RIGHT OUTER JOIN instead of LEFT JOIN or RIGHT JOIN, we can use JOIN, since they are the same.&lt;/p&gt;

&lt;p&gt;Some databases such as MySQL does not support FULL OUTER JOIN. To get the same result, you can simulate it using a UNION of a LEFT JOIN and a RIGHT JOIN.&lt;/p&gt;

&lt;p&gt;All in all there is no end to learning, everyday as I practice I learn something and or refine my skills. Which is excepted. Sometimes the weight of what lies ahead can be heavy but as long as I am building skills day by day that is what matters.&lt;/p&gt;

</description>
      <category>sql</category>
      <category>dbeaver</category>
      <category>postgressql</category>
      <category>windowfunctions</category>
    </item>
    <item>
      <title>JCars Logistics Power BI project.</title>
      <dc:creator>Faith</dc:creator>
      <pubDate>Sun, 27 Sep 2026 12:00:47 +0000</pubDate>
      <link>https://dev.to/faith_ondiege_6e7c59f9ac3/jcars-logistics-power-bi-project-45i6</link>
      <guid>https://dev.to/faith_ondiege_6e7c59f9ac3/jcars-logistics-power-bi-project-45i6</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;JCars Logistics is a fictional business that imports, sells, and delivers vehicles to customers across different regions in Kenya. We have a dataset that contains information about its sales transactions, vehicles, customers, branches, sales representatives, payments, deliveries, logistics costs, returns, cancellations, and customer experiences. &lt;br&gt;
It operates a diverse network with 276 orders across 10 sales representatives, 14 branches, and 272 car makes serving 276 unique customers. &lt;br&gt;
Using this dataset, I have &lt;strong&gt;cleaned&lt;/strong&gt;, &lt;strong&gt;analyzed&lt;/strong&gt;, &lt;strong&gt;modeled&lt;/strong&gt; and finally prepared an &lt;strong&gt;excecutive dashboard&lt;/strong&gt; on the performance and status of the business in terms of different metrics, all of this in &lt;strong&gt;PowerBI&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Data Cleaning
&lt;/h2&gt;

&lt;p&gt;While the business demonstrates operational scale, critical data quality issues and operational challenges require immediate attention to ensure sustainable growth and accurate performance measurement. The presented data was so messy with numerous inconsistencies and blanks through out most of the columns.&lt;/p&gt;

&lt;h4&gt;
  
  
  Inconsistent formatting
&lt;/h4&gt;

&lt;p&gt;This format gave me the most headache, starting us strong is formatting, most columns had variables written in different formats. The order ID column having mixed numbers and varied alphabets eg LC1000, LCL1001, ORD1004. All of which have to be standardized in order to proceed with analysis. The different Date columns proved the most inconsistent with some dates being numerical figures for instance. The currency for revenue, unit cost and delivery fees were in different currencies and numeric formats.&lt;br&gt;
other text columns contain numeric data such as 3 cars. Finally, different naming conventions. Example: "Toyota," "toyota," "TOYOTA," "Toyta" treated as different car makes&lt;br&gt;
Example: "Rift Valley," "RIFT VALLEY," "Rift-Valley," "rift valley," "Riftvalley" counted as separate regions&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fvcjihuv8f7t7sgj3vcbe.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fvcjihuv8f7t7sgj3vcbe.png" alt=" " width="800" height="458"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Cleaning this data, involved manual formulas due to the many discrepancies, mostly including &lt;strong&gt;Replacing Values&lt;/strong&gt; and &lt;strong&gt;Errors&lt;/strong&gt; in &lt;strong&gt;Power Query&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Data Modelling
&lt;/h3&gt;

&lt;p&gt;After cleaning my data, I created relationships on power query connecting my &lt;strong&gt;fact table&lt;/strong&gt; to the ** 7 dimension tables** namely: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Dim Customers &lt;/li&gt;
&lt;li&gt;Dim Sales Rep&lt;/li&gt;
&lt;li&gt;Dim Car Qualities&lt;/li&gt;
&lt;li&gt;Dim Location&lt;/li&gt;
&lt;li&gt;Dim Lead Source&lt;/li&gt;
&lt;li&gt;Dim Dates&lt;/li&gt;
&lt;li&gt;Dim Payments&lt;/li&gt;
&lt;/ul&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fd7ynvgubr9uhb3b2mjmp.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fd7ynvgubr9uhb3b2mjmp.png" alt=" " width="800" height="600"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;On Power Query, I created the Dimension Tables by &lt;strong&gt;referencing&lt;/strong&gt; my clean data instead of &lt;strong&gt;Duplicating&lt;/strong&gt;. Thereafter I selected only the columns I needed in the particular tables and removed other columns. To only retain unique values in my dimension tables I &lt;strong&gt;removed duplicates&lt;/strong&gt; and created new Indexes.&lt;br&gt;
The new Indexes acted as my &lt;strong&gt;Primary Key&lt;/strong&gt; In my created Dim Tables for all the tables I created since none was provided in the flat table that was provided.&lt;br&gt;
In order, to create &lt;em&gt;relationships&lt;/em&gt; between the Fact table and the Dimension tables. I merged the Fact table with every dimension table with the corresponding common Column, thereafter doing away with the other columns and retaining the foreign key in the fact table.&lt;br&gt;
I maintained a &lt;strong&gt;Left Outer join&lt;/strong&gt; since I used the Fact table as my left table and the dimension tables as the table on the right. &lt;br&gt;
Six of the relationships created were many to one, with only one, Customers Table having One to One cardinality, since the number of customers matched the number of transactions. Mapping the specific columns from both tables together. &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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F1ey7z9uv43rkn4xkr5yi.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F1ey7z9uv43rkn4xkr5yi.png" alt=" " width="695" height="625"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Luckily having created the relationships the right way after so many attempts, Power BI picked up on the relationship, so I did not have to do it manually.&lt;/p&gt;

&lt;h3&gt;
  
  
  Dashboard
&lt;/h3&gt;

&lt;h3&gt;
  
  
  Recommendations and Business Insights
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;To uphold Data Governance measures, standardization of all data entry mechanisms is necessary by:&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;Replace free-text fields with dropdown selections where possible&lt;/li&gt;
&lt;li&gt;Implement validation rules that reject non-standard entries and variables&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt; Audit historical data:
Run de-duplication scripts on region, car make, and branch names
Reconcile currency entries (establish single currency or documented conversion rates)&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;Flag and correct negative values and #VALUE! errors&lt;/li&gt;
&lt;li&gt;System implementation:&lt;/li&gt;
&lt;li&gt;Deploy data quality rules in point-of-entry systems&lt;/li&gt;
&lt;li&gt;Establish monthly data audits&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Key Findings
&lt;/h4&gt;

&lt;p&gt;Phone-based leads outperform by generating higher ratings &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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fhp7sl2maiys36of5j3v8.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fhp7sl2maiys36of5j3v8.png" alt=" " width="577" height="392"&gt;&lt;/a&gt;&lt;br&gt;
Payment status showed that a whooping 55%of the cars being fully paid.&lt;/p&gt;

&lt;p&gt;Prado TX  had the most revenue recorded of 135B.&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fhyt0peb3svtzd8sdwlvi.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fhyt0peb3svtzd8sdwlvi.png" alt=" " width="800" height="455"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Toyota as a brand, dominates with 20% of all orders, as compared to other car brands.&lt;br&gt;
As for the Sales Representatives, Faith Achieng records the most units sold as Grace Njeri records the most profit of 35M.&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F6jx59m1yle8jl579cbhr.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F6jx59m1yle8jl579cbhr.png" alt=" " width="467" height="350"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Diesel and Hybrid supremacy: Both fuel types generate 4.0+ average satisfaction, significantly exceeding petrol (3.1-3.85)&lt;br&gt;
Petrol dominance but mediocrity: ~47% of order volume but lowest satisfaction metric commodity market with undifferentiated product&lt;br&gt;
EV emerging market: Only 3 orders but environmental trends and government incentives will drive growth&lt;/p&gt;

&lt;p&gt;Referral returns: High-expectation customers referred by existing buyers who learn vehicle has issues&lt;br&gt;
Instagram returns: Young demographic with higher return rates, possibly due to online purchase impulse or photo-reality mismatch&lt;br&gt;
Corporate Tender: Large-volume orders with complex negotiations may lead to specification mismatches&lt;/p&gt;

&lt;h3&gt;
  
  
  CONCLUSION
&lt;/h3&gt;

&lt;p&gt;JCars operates a substantial business with 276 orders, 276 customers, and 10 sales representatives across 14 branches. However, the organization faces critical challenges across data quality, payment collection, operational delivery, and sales performance consistency.&lt;br&gt;
The immediate priority is implementing standardized data governance without it, all performance metrics remain suspect. Simultaneously, urgent intervention is required for Nairobi HQ's 37.5% return rate, Mombasa Port Yard's operational failures, and the concerning 18.5% payment cancellation rate.&lt;/p&gt;

&lt;p&gt;The organization has strong underlying assets (high-volume branch network, competent sales leaders like Grace Njeri, quality products like Nissan. Focused execution on these recommendations will lead to exponential growth.&lt;/p&gt;

</description>
      <category>powerbi</category>
      <category>dashboarding</category>
      <category>datacleaning</category>
      <category>analytics</category>
    </item>
    <item>
      <title>Data Modelling, Relationships &amp; Joins</title>
      <dc:creator>Faith</dc:creator>
      <pubDate>Sat, 12 Sep 2026 12:52:11 +0000</pubDate>
      <link>https://dev.to/faith_ondiege_6e7c59f9ac3/data-modelling-relationships-joins-he4</link>
      <guid>https://dev.to/faith_ondiege_6e7c59f9ac3/data-modelling-relationships-joins-he4</guid>
      <description>&lt;h3&gt;
  
  
  Data Modelling in Power BI
&lt;/h3&gt;

&lt;p&gt;Data modeling is the process of analyzing and defining all the different data types a business collects and produces, as well as the relationships between those bits of data. By using text, symbols, and diagrams, data modeling concepts create visual representations of data as it’s captured, stored, and used at the business. &lt;br&gt;
As business determines how data is used and when, the data modeling process becomes an exercise in understanding and clarifying data requirements.&lt;/p&gt;

&lt;p&gt;By modeling data, you can document what types of data you have, how you use it, and the data management requirements surrounding its usage, protection, and governance. The benefits of data modeling include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Creating a structure for collaboration between different teams.&lt;/li&gt;
&lt;li&gt;Revealing opportunities for improving business processes by defining data needs and uses.&lt;/li&gt;
&lt;li&gt;Saving time and money on IT and process investments through appropriate planning.&lt;/li&gt;
&lt;li&gt;Reducing errors (and error-prone redundant data entry) while improving data integrity.&lt;/li&gt;
&lt;li&gt;Increasing the speed and performance of data retrieval and analytics by planning for capacity and growth.&lt;/li&gt;
&lt;li&gt;Setting and tracking target key performance indicators tailored to your business objectives.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Types of Schemas
&lt;/h4&gt;

&lt;p&gt;A snowflake schema is another way of organizing data. In a schema, dimension tables are split into smaller sub-dimensions to keep data more organized and detailed, just like snowflakes in a large lake.&lt;/p&gt;

&lt;h4&gt;
  
  
  Star Schema
&lt;/h4&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F04o18lo8q440dyli0gnu.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F04o18lo8q440dyli0gnu.png" alt=" " width="493" height="362"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Structure&lt;/strong&gt;: A star schema resembles a star with a central fact table containing transactional data (e.g., sales data) surrounded by dimension tables (e.g., product details, customer information, time hierarchy ). These dimension tables are connected to the fact table through foreign keys.&lt;br&gt;
&lt;strong&gt;Focus&lt;/strong&gt;: Optimized for analytical workloads. The pre-aggregated data and clear relationships between tables enable efficient querying and analysis of trends and patterns.&lt;br&gt;
&lt;strong&gt;Pros&lt;/strong&gt;: Fast and efficient for complex analytical queries, reduces redundancy compared to fully flat tables, simplifies data modeling for data warehouses.&lt;br&gt;
&lt;strong&gt;Cons&lt;/strong&gt;: Might not be ideal for storing highly granular data or handling frequent schema changes, can be less efficient for operational tasks like real-time data updates.&lt;/p&gt;

&lt;h4&gt;
  
  
  Flat tables
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Structure&lt;/strong&gt;: Flat tables store all relevant data points for an entity (e.g., a product) within a single table, often with numerous columns to represent various attributes. This approach prioritizes ease of data access and flexibility.&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fcty4w60wp2kzzhxsfm7h.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fcty4w60wp2kzzhxsfm7h.png" alt=" " width="454" height="558"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Focus&lt;/strong&gt;: Optimized for operational tasks and handling large volumes of detailed data. The denormalized structure allows for faster reads and writes of individual entities.&lt;br&gt;
&lt;strong&gt;Pros&lt;/strong&gt;: Simpler data access for specific entities, efficient for writes and reads of detailed data, can be flexible to accommodate schema changes.&lt;br&gt;
&lt;strong&gt;Cons&lt;/strong&gt;: Can lead to significant data redundancy, potentially slower for complex analytical queries that require joins across multiple tables, requires careful management to avoid data inconsistency.&lt;/p&gt;

&lt;h4&gt;
  
  
  Snowflake Schema
&lt;/h4&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Flvfr6mdqe3h8cwi3cmoq.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Flvfr6mdqe3h8cwi3cmoq.png" alt=" " width="773" height="522"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Structure&lt;/strong&gt; Snowflake Schema is also a type of multidimensional model used for data warehouses. In the snowflake schema, the fact tables, dimension tables and sub-dimension tables are included. This schema forms a snowflake structure with fact tables, dimension tables and sub-dimension tables&lt;br&gt;
&lt;strong&gt;Focus&lt;/strong&gt; Best for Flexibility and Data Integrity: If we need to handle large datasets with multiple levels of hierarchy and a high degree of normalization, the Snowflake Schema offers greater flexibility. It’s perfect for maintaining data integrity across complex datasets.&lt;br&gt;
&lt;strong&gt;Pros&lt;/strong&gt; : Ideal for large organizations dealing with large, normalized datasets or those with frequent updates, like customer or inventory management systems. It minimizes redundancy and improves storage efficiency.&lt;br&gt;
Storage Considerations: Snowflake is more storage-efficient due to its normalized structure, making it a great choice for scenarios with complex, high-volume data.&lt;/p&gt;

&lt;h3&gt;
  
  
  Fact Tables and Dimension Tables
&lt;/h3&gt;

&lt;p&gt;In data warehousing, fact tables and dimension tables are key components of star or snowflake schemas. Fact tables store numeric data like sales or order amounts and include foreign keys linking to dimension tables. Dimension tables provide context with descriptive details like product names or customer demographics. The main difference between Fact or Reality table and the Dimension table is that dimension table contains attributes on that measures are taken actually table. Below are the main differences between the two:&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fps079oo0p2wwux4f43ht.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fps079oo0p2wwux4f43ht.png" alt=" " width="703" height="543"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Relationships in Power BI
&lt;/h3&gt;

&lt;p&gt;A model relationship propagates filters applied on the column of one model table to a different model table. Filters will propagate so long as there's a relationship path to follow, which can involve propagation to multiple tables.&lt;/p&gt;

&lt;p&gt;Relationship paths are deterministic, meaning that filters are always propagated in the same way and without random variation. Relationships can, however, be disabled, or have filter context modified by model calculations that use particular Data Analysis Expressions (DAX) functions.&lt;/p&gt;

&lt;h4&gt;
  
  
  Cardinality
&lt;/h4&gt;

&lt;p&gt;Each model relationship is defined by a cardinality type. There are three cardinality type options, representing the data characteristics of the "from" and "to" related columns. The "one" side means the column contains unique values; the "many" side means the column can contain duplicate values.&lt;/p&gt;

&lt;p&gt;The three) options, together with their shorthand notations, are described in the following list:&lt;/p&gt;

&lt;p&gt;One-to-many (1:*)&lt;br&gt;
One-to-one (1:1)&lt;br&gt;
Many-to-many (:)&lt;/p&gt;

&lt;p&gt;When you create a relationship in Power BI Desktop, the designer automatically detects and sets the cardinality type. Power BI Desktop queries the model to know which columns contain unique values. For import models, it uses internal storage statistics; for DirectQuery models it sends profiling queries to the data source. Sometimes, however, Power BI Desktop can get it wrong. It can get it wrong when tables are yet to be loaded with data, or because columns that you expect to contain duplicate values currently contain unique values. In either case, you can update the cardinality type as long as any "one" side columns contain unique values (or the table is yet to be loaded with rows of data).&lt;/p&gt;

&lt;h4&gt;
  
  
  One-to-many (and many-to-one) cardinality
&lt;/h4&gt;

&lt;p&gt;The one-to-many and many-to-one cardinality options are essentially the same, and they're also the most common cardinality types.&lt;/p&gt;

&lt;p&gt;When you configure a one-to-many or many-to-one relationship, choose the one that matches the order in which you related the columns. Consider how you would configure the relationship from the Product table to the Sales table by using the ProductID column found in each table. The cardinality type would be one-to-many, as the ProductID column in the Product table contains unique values. If you related the tables in the reverse direction, Sales to Product, then the cardinality would be many-to-one.&lt;/p&gt;

&lt;h4&gt;
  
  
  One-to-one cardinality
&lt;/h4&gt;

&lt;p&gt;A one-to-one relationship means both columns contain unique values. This cardinality type isn't common, and it likely represents a suboptimal model design because of the storage of redundant data.&lt;/p&gt;

&lt;h4&gt;
  
  
  Many-to-many cardinality
&lt;/h4&gt;

&lt;p&gt;A many-to-many relationship means both columns can contain duplicate values. This cardinality type is infrequently used. It's typically useful when designing complex model requirements. You can use it to relate many-to-many facts or to relate higher grain facts. For example, when sales target facts are stored at product category level and the product dimension table is stored at product level.&lt;/p&gt;

&lt;h3&gt;
  
  
  Filter Direction
&lt;/h3&gt;

&lt;h3&gt;
  
  
  Relationship Filters
&lt;/h3&gt;

&lt;p&gt;In Power BI, when two tables are connected, filters can flow between them to control which data is visible in visuals. This flow is determined by the filter direction in the relationship settings.&lt;/p&gt;

&lt;p&gt;There are two types:&lt;/p&gt;

&lt;h3&gt;
  
  
  Single-direction filter:
&lt;/h3&gt;

&lt;p&gt;Allows filter context to flow from one table to another (most common).&lt;br&gt;
Bi-directional filter: Allows filter context to flow in both directions between connected tables.&lt;br&gt;
Single-Direction Filters&lt;br&gt;
Best For:&lt;br&gt;
Star schema models (fact and dimension tables)&lt;br&gt;
Maintaining predictable filter behavior&lt;br&gt;
Optimizing model performance&lt;br&gt;
In a star schema, filter direction should typically flow from the dimension tables (e.g., Customers, Products) to the fact tables (e.g., Sales, Transactions). This setup reflects how users usually analyze data: e.g., sales by customer, not customers by sale.&lt;/p&gt;

&lt;p&gt;Example:&lt;br&gt;
You have a Sales table and a Products table. You want to filter sales by product category. The relationship should allow filters to flow from Products to Sales (one-to-many).&lt;/p&gt;

&lt;h3&gt;
  
  
  Bi-Directional Filters
&lt;/h3&gt;

&lt;p&gt;Use with Caution:&lt;br&gt;
Complex reporting scenarios&lt;br&gt;
Many-to-many relationships&lt;br&gt;
Role-based security (RLS) configurations&lt;br&gt;
Bi-directional filtering lets two tables filter each other. While powerful, it can cause:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Ambiguous relationships&lt;/strong&gt;&lt;br&gt;
Unexpected results in visuals&lt;br&gt;
Performance degradation, especially on large datasets&lt;br&gt;
Example:&lt;br&gt;
Imagine you have a Sales table and a Regions table, but not every sale is assigned to a region. A bi-directional filter might seem helpful, but it can lead to wrong totals or slow down the report.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Best Practices&lt;/strong&gt;&lt;br&gt;
Default to Single Direction&lt;br&gt;
It’s simpler, faster, and more stable in most cases.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Use Bi-Directional Filters Sparingly&lt;/strong&gt;&lt;br&gt;
Only when absolutely necessary, and understand the impact on model performance.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Consider Using DAX Instead&lt;/strong&gt;&lt;br&gt;
Functions like USERELATIONSHIP() or CROSSFILTER() can give you more control without needing a full bi-directional relationship.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Watch Out for Ambiguity&lt;/strong&gt;&lt;br&gt;
If Power BI warns you about ambiguous paths — check your filter directions. Simplify relationships where possible.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Common Mistakes to Avoid&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Using bi-directional filters to fix visuals instead of fixing the data model&lt;/li&gt;
&lt;li&gt;Forgetting to evaluate performance after enabling both-direction filters&lt;/li&gt;
&lt;li&gt;Not testing RLS impact when filter directions change&lt;/li&gt;
&lt;li&gt;Creating circular filter paths, which Power BI won’t allow&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Joins in Power Query
&lt;/h3&gt;

&lt;p&gt;Allows you to combine data from different sources, offering comprehensive insights. Here’s an overview of the most common merge options in Power Query, explained with simple analogies and real-life examples.&lt;/p&gt;

&lt;h4&gt;
  
  
  Join Types
&lt;/h4&gt;

&lt;p&gt;Now we will go into the different types of join functions Power Query has made available to us&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Left Outer Join&lt;/strong&gt; (All from first, matching from second)&lt;br&gt;
• Analogy: Imagine you’re planning a wedding. You have a guest list (Table 1), and then you collect RSVPs (Table 2). A left outer join ensures that everyone from your guest list (Table 1) will be included, even if they didn’t RSVP. For those who did RSVP, you’ll also have their response.&lt;br&gt;
• Practical Example: In a company, if you have a list of all employees (Table 1) and another list of their completed training sessions (Table 2), a left outer join shows all employees, whether or not they have completed any training (Table 2).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Right Outer Join&lt;/strong&gt; (All from second, matching from first)&lt;br&gt;
• Analogy: Now, you’re only interested in the RSVPs (Table 2). You still want to know if they were on the original guest list (Table 1), but you also want to include people who RSVP’d without being invited. A right outer join shows you all RSVPs, whether or not they were on the guest list.&lt;br&gt;
• Practical Example: If you have a list of all customers who placed orders (Table 2) and another list of all potential customers (Table 1), a right outer join will show all customers who placed orders, even if they weren’t on the original prospect list.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Full Outer Join&lt;/strong&gt; (All rows from both)&lt;br&gt;
• Analogy: Now you want to see both your guest list and RSVPs entirely. You want to know who was invited and who RSVP’d, and also see if anyone RSVP’d who wasn’t on your list. A full outer join shows all the data from both tables, matching where possible and leaving blanks where there are no matches.&lt;br&gt;
• Practical Example: If you have a list of products sold (Table 1) and a list of products in inventory (Table 2), a full outer join will give you all products, both sold and in inventory, even if some products were sold but are not in inventory and vice versa.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Inner Join&lt;/strong&gt; (Only matching rows)&lt;br&gt;
• Analogy: You’re only interested in the people who were on your guest list and RSVP’d. If someone was invited but didn’t RSVP, or RSVP’d without being on the guest list, you don’t want to see them. An inner join only shows rows that exist in both tables.&lt;br&gt;
• Practical Example: If you have a list of current employees (Table 1) and a list of people who completed mandatory training (Table 2), an inner join will show only those who are both current employees and have completed the training.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Left Anti Join&lt;/strong&gt; (Rows only in first)&lt;br&gt;
• Analogy: You want to see who was on your guest list but didn’t RSVP. A left anti join shows only the people who are in Table 1 (your guest list) but have no matching record in Table 2 (RSVPs).&lt;br&gt;
• Practical Example: If you have a list of all employees (Table 1) and another list of those who completed training (Table 2), a left anti join will show you the employees who haven’t completed the training.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Right Anti Join&lt;/strong&gt; (Rows only in second)&lt;br&gt;
• Analogy: Now you want to see who RSVP’d but wasn’t on the original guest list. A right anti join shows only the people who are in Table 2 (RSVPs) but have no match in Table 1 (the guest list).&lt;br&gt;
• Practical Example: If you have a list of employees who signed up for a training session (Table 2) but weren’t originally required to take the training (Table 1), a right anti join will show you the unexpected attendees.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Key Insights&lt;/strong&gt;:&lt;br&gt;
• Use left outer join to retain all the data from the first table and match as much as you can from the second.&lt;br&gt;
• Use right outer join to retain all the data from the second table and match as much as you can from the first.&lt;br&gt;
• Use full outer join to combine everything from both tables, regardless of matching.&lt;br&gt;
• Use inner join when you only care about data that exists in both tables.&lt;br&gt;
• Use left anti join and right anti join to find rows that exist only in one of the tables but not both.&lt;/p&gt;

&lt;h2&gt;
  
  
  Power Query Joins vs Power BI Relationships
&lt;/h2&gt;

&lt;p&gt;Performance&lt;br&gt;
One of the distinguishing features of a reporting system is the performance of it. If you are building a reporting system, and the loading the report takes five minutes, then what is the benefit of this report over doing it in the operational system? because it would have taken that much in the operational system anyway!&lt;/p&gt;

&lt;p&gt;When you build a reporting system, you should target creating reports that load fast. Having extra relationships, doesn’t help with the performance. The DAX queries behind the scene would be longer.&lt;/p&gt;

&lt;p&gt;Another big deterministic of a good reporting model is the ability to make it easy-to-understand for data visualizers. If a data visualizer have 500 tables in a model all inter-related, anyone would have a hard time to understand the model.&lt;/p&gt;

&lt;p&gt;Relationships come with a cost of complexity. You might need a both-directional relationship sometimes, or you might get into the problem of having an inactive relationship and trying to resolve that. Less relationship means fewer problems of this type when it is unnecessary.&lt;/p&gt;

&lt;h2&gt;
  
  
  Recommended Power BI Model
&lt;/h2&gt;

&lt;p&gt;You should not have tons of relationships, and you should not create one big table with everything in it. The recommended thing is to design a totally different schema. A new layout of tables and relationships. Something that is different from the operating system’s database. Something that helps to get the best of both worlds.&lt;/p&gt;

&lt;p&gt;This model, has many names; dimensional model, star schema, data warehouse etc. Through the process of creating this model, you combine some of the tables (dimensions), and keep some of them to be connected through the relationships (dimension to fact table relationships).&lt;/p&gt;

&lt;p&gt;What if you don’t have a reference table that you can use as a dimension? what if there are only mapping tables in your data source? Many, have faced the same challenges. If you don’t have a reference table, you can create them from your mapping tables.&lt;br&gt;
Just because you can load all the tables into the model and then create relationship, it doesn’t mean it is the best thing to do. Just because you can merge all the tables using Power Query, it doesn’t mean you should do it.&lt;/p&gt;

&lt;p&gt;Power BI modeling starts with a pen and paper. This is very important that you start your modeling by a pen and paper. Yes, no tools or services needed. Just a pen and paper. You need to draw the dimensional model, the layout of the tables. You need to list fields in your dimension and fact tables. All of these are much better to be done using a pen and paper. You can then take the next step of implementing it using Power BI.&lt;/p&gt;

&lt;p&gt;A good model should consider many things. It should first start with the requirement. How are you going to build a database diagram of a reporting system, when you don’t know what values should be shown in the report?&lt;/p&gt;

&lt;p&gt;A good model also requires an understanding of the existing data, and how that data can be transformed into the star-schema model.&lt;/p&gt;

&lt;p&gt;Don’t build your model on this rule that; this is the format that I get data, so can’t really do much about it. This is wrong! You need to transform that format.&lt;/p&gt;

&lt;p&gt;My report works just fine, why bother?&lt;br&gt;
Why bothering if your report is running just fine? or if it doesn’t have any performance problems? Do you really need to think about the model if you got only a few tables and everything works as it should? Why spending time on something that the users won’t see?&lt;/p&gt;

&lt;p&gt;Yes, you need to work on your model. If you didn’t do that from the beginning of your implementation, do it now. Your model gets bigger and bigger every time. You will have more tables, more relationships, bigger challenges.&lt;/p&gt;

&lt;p&gt;Building a proper data model is like building a base for a 100 stories building. would you first build the 100 stories and then come and fortify the base?! of course not. You should do it as soon as possible, or your whole building might collapse at some point.&lt;/p&gt;

&lt;p&gt;Your Power BI data model is your world. It is up to you to decide in which world you want to live in. Would you prefer to have a model that is too complicated that every time someone asks for a change it ends up with hours and often days of work because it is not designed in the way it should? Or do you prefer to build a model that is a high performance, simple, easy to change, and simple to integrate? That is your choice; your model, your world.&lt;/p&gt;

</description>
      <category>powerbi</category>
      <category>schemas</category>
      <category>datamodelling</category>
      <category>powerquery</category>
    </item>
    <item>
      <title>Data Analysis and Reporting Using Excel</title>
      <dc:creator>Faith</dc:creator>
      <pubDate>Fri, 04 Sep 2026 21:14:31 +0000</pubDate>
      <link>https://dev.to/faith_ondiege_6e7c59f9ac3/data-analysis-and-reporting-using-excel-3fhl</link>
      <guid>https://dev.to/faith_ondiege_6e7c59f9ac3/data-analysis-and-reporting-using-excel-3fhl</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;As part of my Data Science course at &lt;strong&gt;LuxDevHQ&lt;/strong&gt; we covered Excel as our first tool. It seemed unnecessary to me at first but the more we covered the more I realized I didn't know as much as is required of me as a data professional. Moreover, I was impressed by the capabilities of Excel, beyond what I normally used it for as a Finance professional who never got structured Excel training.&lt;br&gt;
I used &lt;a href="https://github.com/LuxDevHQ/LuxDevHQ-Data-Science-Guide/blob/main/Projects/Week%201%20Excel%20Project/Excel_jumia_dataset.csv" rel="noopener noreferrer"&gt;Jumia Discount Dataset&lt;/a&gt; for my analysis. Practised everything we covered for the last two weeks from &lt;strong&gt;data cleaning&lt;/strong&gt;, &lt;strong&gt;analysis&lt;/strong&gt;, &lt;strong&gt;pivot tables&lt;/strong&gt;, &lt;strong&gt;charts&lt;/strong&gt; to &lt;strong&gt;dashboarding&lt;/strong&gt;.&lt;/p&gt;
&lt;h3&gt;
  
  
  Importing
&lt;/h3&gt;

&lt;p&gt;Below is the process I used to import the data after downloading it on my machine.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Open a blank workbook.&lt;/li&gt;
&lt;li&gt;Select Data &amp;gt; Get Data &amp;gt; From Text/CSV.&lt;/li&gt;
&lt;li&gt;Choose Excel_jumia_dataset.csv and verify that the comma delimiter is detected.&lt;/li&gt;
&lt;li&gt;Load the source into Raw_Data.&lt;/li&gt;
&lt;li&gt;Duplicate the query or sheet before cleaning and load the result into Cleaned_Data.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;
  
  
  Data Cleaning
&lt;/h2&gt;

&lt;p&gt;I first of all had to scan through the entire data to see what it contains and maybe spot mistakes that could be easily corrected. Started off with obvious errors that I tabulated for tracking as shown below:&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fn0yx55fnwf6chso5huhp.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fn0yx55fnwf6chso5huhp.png" alt=" " width="799" height="311"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To avoid being overwhelmed with scattered data, I created these worksheets in my &lt;strong&gt;workbook&lt;/strong&gt; for different purposes during the project;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;em&gt;Raw_Data&lt;/em&gt; — an original copy of the CSV;&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Cleaned_Data&lt;/em&gt; — cleaned fields, derived columns, and an Excel Table;&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Analysis&lt;/em&gt; — descriptive statistics, correlation, and ranked product tables;&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Pivot_Tables&lt;/em&gt; — all PivotTables that support the visuals;&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Dashboard&lt;/em&gt; — KPIs, charts, slicers&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Data_Dictionary&lt;/em&gt; — field definitions, a cleaning log.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Among others that I realized I needed along the way for further analysis and insights that bore the names of the specific metrics I analyzed.&lt;/p&gt;
&lt;h3&gt;
  
  
  Analysis
&lt;/h3&gt;

&lt;p&gt;Analyzing data seems a bit easy when you are being taught or when someone else is doing it, its only when you do it that you appreciate the logic that goes into this process. Found out that I need to add some columns to enable analysis on my part, which was a bummer who knew that trick, I didn't, anyway we live we learn. &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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F9bj8h7hj4cke5ojque1i.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F9bj8h7hj4cke5ojque1i.png" alt=" " width="799" height="407"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I realized I wasn't going anywhere without additional columns in my data since I had only a few columns to work with and by themselves they weren't going to be of much help. I created the &lt;em&gt;Price Category&lt;/em&gt;, &lt;em&gt;Discount Status&lt;/em&gt;, &lt;em&gt;Review Status&lt;/em&gt;, and &lt;em&gt;Ratings Status&lt;/em&gt; columns, that came in handy especially when I created &lt;strong&gt;pivot tables&lt;/strong&gt; to summarize data for insights and recommendations. Maintained my options between 2 to 4 categories in each newly created column. &lt;br&gt;
Applied the &lt;strong&gt;Nested IFs&lt;/strong&gt; and &lt;strong&gt;ISBLANK&lt;/strong&gt; formula to create my categories as indicated here;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Price Category =IF([@[Current price]]&amp;lt;500,"Economical",IF([@[Current price]]&amp;lt;=1000,"Affordable","High Cost"))

Discount Status =IF([@Discount]&amp;lt;20%,"Low Discount",IF([@Discount]&amp;lt;=40%,"Medium Discount","High Discount"))

Review Status =IF(ISBLANK([@Review]),"No Review", IF([@Review]&amp;lt;10,"Poor Review",IF([@Review]&amp;lt;=20,"Good Review","Excellent Review")))

Ratings Status = =IF(ISBLANK([@Ratings]),"Not Rated",IF([@Ratings]&amp;lt;3,"Poor Review",IF([@Ratings]&amp;lt;=4.5,"Average","Excellent")))
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The thing with the analysis part there is no right way or wrong way to do it there is only how you choose to do it, I found this method to be the most straight forward and fast since I am also training to ensure I use the least amount time possible to create a report start to finish.&lt;/p&gt;

&lt;h3&gt;
  
  
  Pivot Tables and Charts
&lt;/h3&gt;

&lt;p&gt;After creating necessary columns and coming to the conclusion that my analyzed data is sufficient for drawing inference I proceeded to create Pivot tables based on some objectives:&lt;/p&gt;

&lt;h4&gt;
  
  
  which products may need a different pricing or marketing strategy
&lt;/h4&gt;

&lt;p&gt;On the pivot table for this category, I placed the product and price on the &lt;strong&gt;rows field&lt;/strong&gt; but made sure to group by 500, then added &lt;em&gt;Average of Review&lt;/em&gt; to the &lt;strong&gt;values field&lt;/strong&gt; and finally, Rating status to the columns as well as a slicer  for the rating status.&lt;/p&gt;

&lt;p&gt;As for the other Pivot tables, I was a bit experimental, tried different variables in different field until I found was fitting to what I intended to represent.&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fzpmimn9u46f2jszwuxh3.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fzpmimn9u46f2jszwuxh3.png" alt=" " width="800" height="413"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Used two bar charts, two column chart and a pie chart for the visualization. Created a bar and column chart interchangeably on data that represented a numerical variable along side a categorical variable. For instance, when I needed to visualize the relationship between product pricing and review:&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fzjbzcpp26kxeuvqi02rl.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fzjbzcpp26kxeuvqi02rl.png" alt=" " width="776" height="452"&gt;&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fnnw3btq0239xuxtjl7r6.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fnnw3btq0239xuxtjl7r6.png" alt=" " width="799" height="379"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Dashboard
&lt;/h3&gt;

&lt;p&gt;Finally the dashboard!&lt;br&gt;
Made the KPI's and the charts form the analysis I made on the data. My dashboard includes what I thought is of importance from the data I analyzed, sure you don't have to include every chart made, It should only have that which is essential to the stakeholders and maybe what they wish to know or what you wish to communicate as an analyst. &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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fmjwcvvq64a73x3wtkn0i.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fmjwcvvq64a73x3wtkn0i.png" alt=" " width="800" height="334"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Recommendation and Insights
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Do Larger Discounts Drive More Reviews?
&lt;/h4&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ftu7z5xuekyc77xw7ahvz.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ftu7z5xuekyc77xw7ahvz.png" alt=" " width="309" height="167"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;From the data it seems as though higher discount drive more review as shown in the figure. High discounts which were discounts ranging from 41%-100%, but the highest recorded discount was 64%, so essentially the discount range from 41%-64% generated 30 reviews, which is the highest of the three categories.&lt;br&gt;
This suggests that aggressive discounting can build customer trust or volume.&lt;/p&gt;

&lt;h4&gt;
  
  
  Do Highly Rated Products Attract More Engagement?
&lt;/h4&gt;

&lt;p&gt;Yes, but the gap is modest.&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F87uc3u5li8f44rl5vf3v.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F87uc3u5li8f44rl5vf3v.png" alt=" " width="800" height="152"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Excellent-rated products lead in reviews, but interestingly, poorly-rated products carry the highest average discount (43%), suggesting discounts may be used to compensate for weak ratings, rather than reflecting genuine value.&lt;/p&gt;

&lt;h4&gt;
  
  
  Do Price and Rating Move Together?
&lt;/h4&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fmg89ukf1gtgcvpanv1j2.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fmg89ukf1gtgcvpanv1j2.png" alt=" " width="559" height="229"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;There's a gentle positive relationship between price and rating. However, not sufficient for us to make an inference form this data only.&lt;/p&gt;

&lt;h4&gt;
  
  
  Best Performing Products (Ratings + Reviews)
&lt;/h4&gt;

&lt;p&gt;The standout performers combining both high ratings and strong review counts:&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fck7ownee85iqj81pt6z9.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fck7ownee85iqj81pt6z9.png" alt=" " width="799" height="317"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Products Needing a Strategy Rethink
&lt;/h4&gt;

&lt;p&gt;20 products have zero ratings and zero reviews. These span all price categories and carry discounts averaging ~38%, which clearly isn't working.&lt;/p&gt;

&lt;p&gt;another category would be the products with the lowest reviews and ratings such as:&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fuylchny2sex27fgfetg3.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fuylchny2sex27fgfetg3.png" alt=" " width="799" height="334"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Recommended actions:&lt;/p&gt;

&lt;p&gt;Run targeted campaigns to seed initial reviews&lt;br&gt;
Consider bundling with top-performing products&lt;br&gt;
Reassess whether the product-market fit is right before deepening discounts further.&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;This will serve as my lesson learnt from the whole process as I have gained one or two tips for later.&lt;br&gt;
It seems like a ton of work but I believe it gets easier with time, so I will hold on to that. As long as something works use that, don't go over your head trying to remember what you learnt to apply it, and always remember you can consult, no man is an Island we all need each other at some point.&lt;/p&gt;

</description>
      <category>dataanalytics</category>
      <category>pivottables</category>
      <category>excel</category>
      <category>reporting</category>
    </item>
    <item>
      <title>Getting Started with Excel for Data Analytics: From Basics to Data Cleaning.</title>
      <dc:creator>Faith</dc:creator>
      <pubDate>Sun, 30 Aug 2026 14:23:33 +0000</pubDate>
      <link>https://dev.to/faith_ondiege_6e7c59f9ac3/getting-started-with-excel-for-data-analytics-from-basics-to-data-cleaning-4pd6</link>
      <guid>https://dev.to/faith_ondiege_6e7c59f9ac3/getting-started-with-excel-for-data-analytics-from-basics-to-data-cleaning-4pd6</guid>
      <description>&lt;p&gt;I just came to the realization that &lt;strong&gt;Microsoft Excel&lt;/strong&gt; is one of the most commonly tools used at the workplace. Not for anything else but for data analysis. I have never thought of it this way. Given my background in Finance, we use Excel for bragging rights depending on how many formulas you created and run on excel to make your your financial models run.&lt;/p&gt;

&lt;h2&gt;
  
  
  Data Cleaning
&lt;/h2&gt;

&lt;p&gt;Before any analysis, most data requires to be cleaned or adjusted in a way that it is easily used for any analytical work. Data collection sometimes comes with variant responses that make it hard to use the data as it is. Making it necessary to clean data before usage. A really cool tool I learnt this week was &lt;strong&gt;Data Validation&lt;/strong&gt;. This helps restrict the type of feedback you get per column making it easier when you use the data later. An example would be to restrict product categories that one can enter or maximum and minimum limits. Enforcing it is a easy as: &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Selecting the necessary cells &lt;/li&gt;
&lt;li&gt;On the ribbon, click &lt;strong&gt;Data&lt;/strong&gt; then &lt;strong&gt;Data Validation&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Under &lt;strong&gt;Allow&lt;/strong&gt;, select &lt;strong&gt;List&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;In &lt;strong&gt;Source&lt;/strong&gt;, type values separated by commas&lt;/li&gt;
&lt;li&gt;Click OK&lt;/li&gt;
&lt;/ol&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fzkfuws2k2k4v5ryxjvpl.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fzkfuws2k2k4v5ryxjvpl.png" alt=" " width="799" height="412"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Applied Data Validation on the Employee column Validation to ensure that only whole numbers are allowed after removing duplicates from the dataset.&lt;/p&gt;

&lt;h2&gt;
  
  
  Filtering
&lt;/h2&gt;

&lt;p&gt;Another important tool in Excel has to be filtering, thinking of it now I should have started with this one.&lt;br&gt;
This gives an over view of how the data looks like, if you actually need to apply changes to the data or leave it as it and so on. I believe it is impossible to use excel especially when interacting with &lt;strong&gt;tons of data&lt;/strong&gt; and not use filtering. &lt;br&gt;
It's like a sneak peek of the data displaying only the rows that meet criteria while the rest stay hidden.&lt;/p&gt;

&lt;p&gt;How do we exactly do that:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Click anywhere in the dataset&lt;/li&gt;
&lt;li&gt;On the Home tab, go to Sort and Filter, Filter&lt;/li&gt;
&lt;li&gt;Click on a dropdown on the header row&lt;/li&gt;
&lt;li&gt;Choose the values to show or use&lt;/li&gt;
&lt;/ol&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ftax0q30kblt4aoq8l8lx.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ftax0q30kblt4aoq8l8lx.png" alt=" " width="800" height="445"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Before I realized that some columns have entries that are wrongly spelt and written, I filtered my data to see that and replaced the entries with what aligned with the options available.&lt;/p&gt;

&lt;h2&gt;
  
  
  Data Formatting and Cleaning
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Number formatting
&lt;/h3&gt;

&lt;p&gt;This function of Excel would come in handy when you probably are trying to perform a mathematical operation but it just wouldn't work. Chances are the formatting isn't appropriate of the data type. A hint that would help to determine if the formatting is appropriate is; numerical data aligns to the right while text to the left. However, this sometimes isn't enough.&lt;/p&gt;

&lt;p&gt;Let's now get to how it is done:&lt;/p&gt;

&lt;h4&gt;
  
  
  Percentage formatting
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;Select cells&lt;/li&gt;
&lt;li&gt;Home &amp;gt; Number group&amp;gt; Click % symbol&lt;/li&gt;
&lt;li&gt;Numbers convert to %&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;
  
  
  Currency formatting steps
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;Select the cells with numbers&lt;/li&gt;
&lt;li&gt;Home tab &amp;gt; Number group&lt;/li&gt;
&lt;li&gt;Click the dropdown arrow on the number format box&lt;/li&gt;
&lt;li&gt;Select Currency or Accounting&lt;/li&gt;
&lt;li&gt;Change the currency by clicking the small dialog launcher&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;A simpler way to do it on the Home tab to go to the number segment and click on the drop down on the bottom right and any changes can be made from there&lt;/p&gt;

&lt;h2&gt;
  
  
  Conditional Formatting
&lt;/h2&gt;

&lt;p&gt;This is a useful tool especially if you need to pay attention to a &lt;strong&gt;criterion&lt;/strong&gt; or a group of data. It highlights cells automatically based on the rules set, helping with locating with trends and that which you wish.&lt;br&gt;
An example is when handling credit data and if the loan is way past due time, conditional formatting can be used to categories the different classes of default.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Go to Home &amp;gt; Conditional Formatting &lt;/li&gt;
&lt;li&gt;Choose a rule type: &lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;Highlight Cell Rules (Greater than, Less than) &lt;/li&gt;
&lt;li&gt;Top/Bottom Rules &lt;/li&gt;
&lt;li&gt;Data Bars, Color Scales, Icon Sets&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;For example, select Highlight Cell Rules &amp;gt; Less Than &lt;/li&gt;
&lt;li&gt;Enter a value &lt;/li&gt;
&lt;li&gt;Choose a formatting style (e.g., green fill) &lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;OK&lt;/strong&gt; &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;There is so much that one can do when it comes to data analysis. However, I have focused on the ones that I use a lot more, but on the contrary they don't seem to be that obvious such as removing duplicates and data sorting.&lt;br&gt;
Hope this makes data analysis on Excel a bit lighter and faster for you as it did for me. &lt;br&gt;
On a lighter note, I would always recommend videos incase anything isn't clear, practice does it better than any other way.&lt;/p&gt;

</description>
      <category>analytics</category>
      <category>data</category>
    </item>
    <item>
      <title>My First GitHub Project: From a Local Folder to GitHub Using Git and SSH</title>
      <dc:creator>Faith</dc:creator>
      <pubDate>Sat, 22 Aug 2026 17:29:53 +0000</pubDate>
      <link>https://dev.to/faith_ondiege_6e7c59f9ac3/my-first-github-project-from-a-local-folder-to-github-using-git-and-ssh-5g6o</link>
      <guid>https://dev.to/faith_ondiege_6e7c59f9ac3/my-first-github-project-from-a-local-folder-to-github-using-git-and-ssh-5g6o</guid>
      <description>&lt;p&gt;It took me to set up &lt;strong&gt;my Git&lt;/strong&gt; and &lt;strong&gt;GitHub&lt;/strong&gt; to realize how technology is sometimes not that straight forward at least for beginners. I mean setting up an account should be the easiest part of technology right? However Git and GitHub are packaged differently, forcing us to bear the brunt of its's convolution.&lt;/p&gt;

&lt;p&gt;I'll break down the process to make it ingestible without intimidating a soul, because this too shall pass. Later, we will look back and be astonished of how something simple got our necks on a chokehold.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Installation
&lt;/h2&gt;

&lt;p&gt;First things first, you have to set up a GitHub account on GitHub and then download git and Git Bash. I'll share a more detailed guide of this process don't worry. Git Bash is sort of the terminal that we'll use to write our commands while connecting our git to Git Bash. Git runs locally and keeps track of changes during the project while GitHub is an online version that does the same. Depending on your &lt;strong&gt;Operating System&lt;/strong&gt; there are different ways to download Git. Alternatively, VS Code can be used to push your projects to GitHub and that's what we'll focus on, since its the simplest one. At this point I'm assuming we have a project that needs pushing to GitHub. &lt;/p&gt;

&lt;h2&gt;
  
  
  2. Creating a folder locally
&lt;/h2&gt;

&lt;p&gt;There are shortcuts to create and edit files using Git Bash when doing projects and I thought it best to include them here for posterity and experiment as well.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;em&gt;mkdir&lt;/em&gt;  makes a directory/creates a folder eg mkdir &lt;strong&gt;Analytics Project&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Make sure not to include space on the name of the folder, use hyphens or underscore instead. Alternatively, enclose the name of the folder in quotation marks if spaces are used in naming the folder, then and add the your data set into the folder created.&lt;/p&gt;

&lt;p&gt;These commands are useful in Git Bash depending on which stage of the process you are in.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;em&gt;cd&lt;/em&gt;  changes to another directory (cd "Analytics Project')
&lt;em&gt;cd/path/to/your/repository&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;cd&lt;/em&gt; .. takes you back to previous directory&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;ls&lt;/em&gt; lists down what's in the folder&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;rm&lt;/em&gt; deletes document in the folder&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;rm -r&lt;/em&gt; deletes the folder in the folder&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Creating a README file
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;em&gt;touch&lt;/em&gt; creates a &lt;strong&gt;README&lt;/strong&gt; document (touch README.md) &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A readme file is important for  documenting the process of a project. It usually acts as a contact point with anyone interacting with the your digital product. &lt;/p&gt;

&lt;p&gt;On Git bash or terminal, access the folder cd &lt;em&gt;Analytics Project&lt;/em&gt; &lt;/p&gt;

&lt;p&gt;To edit content in README.md file, we'll use the command &lt;strong&gt;echo&lt;/strong&gt; "Analytics Project" &amp;gt;README.md &lt;br&gt;
To check what is written, we'll use the command &lt;strong&gt;cat&lt;/strong&gt; README.md&lt;br&gt;
&lt;strong&gt;Nano&lt;/strong&gt; can be used to simplify editing. This has to be my preferred method of editing as it is the easiest to use, especially when you are a beginner. &lt;br&gt;
Running the command nano README.md will make a text editor appear where in we shall edit our content.&lt;br&gt;
To Save content, press &lt;strong&gt;Control + O&lt;/strong&gt;, &lt;br&gt;
Press Enter Key to confirm the file, then press Control + X to exit._&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Git Configuration
&lt;/h2&gt;

&lt;p&gt;This is probably the simplest part of this process after creating a GitHub account. On Git Bash, check user name user email by running&lt;/p&gt;

&lt;p&gt;&lt;code&gt;git config --global --list&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;If the account that exists isn't yours or you'd like to use a different one we can overwrite the existing account by using&lt;/p&gt;

&lt;p&gt;&lt;code&gt;git config --global user.name "YourGitHub Profile Name"&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Then you'll be prompted to add a passphrase which is basically a password, it's advisable not to write one incase you forget it. So just *&lt;em&gt;ENTER *&lt;/em&gt; to move to the next step.&lt;/p&gt;

&lt;p&gt;Incase you'd like to change your branch from master to main run;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;git config --global init.defaultBranch main&lt;/code&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Key Generation using SSH
&lt;/h3&gt;

&lt;p&gt;In this part we'll be generating a SSH key that we'll use to connect our Git and GitHub. SSH helps us with security because our computer needs a secure way to prove to GitHub that it is authorized to access our GitHub account&lt;br&gt;
SSH stands for: Secure Shell&lt;br&gt;
With SSH authentication, you create a pair of cryptographic keys.&lt;br&gt;
GitHub requires the public key to be added to your account, while the corresponding private key stays on our computer. Now, this is where things a bit technical.&lt;/p&gt;

&lt;p&gt;When we generate an SSH key, you will normally get 2 keys:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;id_ed25519     - private key&lt;/li&gt;
&lt;li&gt;id_ed25519.pub - Public key&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;But, I'd like us to generate a public key using a shortcut:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;ssh-keygen -t ed25519 -C "your_email@example.com"&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Then a prompt to overwrite will appear, write "y" meaning yes and press Enter. If you chose to have a password input, if you didn't press Enter then run&lt;/p&gt;

&lt;p&gt;&lt;code&gt;clip &amp;lt; /c/Users/user/.ssh/id_ed25519.pub&lt;/code&gt; to save they public key in a file.&lt;/p&gt;

&lt;h4&gt;
  
  
  Testing
&lt;/h4&gt;

&lt;p&gt;We've already generated a key, now we use an IDE in this case VS Code to push our project to GitHub.&lt;/p&gt;

&lt;p&gt;To confirm if we've connected our Git to GitHub using the SSH Key that we have generated. Go to Git Bash terminal and run&lt;br&gt;
&lt;code&gt;ssh -T git@github.com&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;There shouldn't be any problem with this but if anything isn't seeming right, you can always Chat GPT.&lt;/p&gt;

&lt;p&gt;Okay now let's copy our generated key to GitHub&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Open your GitHub account&lt;/li&gt;
&lt;li&gt;Go to settings&lt;/li&gt;
&lt;li&gt;Click SSH and GPG&lt;/li&gt;
&lt;li&gt;Delete and add new or simply add the generated key if there are no keys yet&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;
  
  
  Using VS Code
&lt;/h4&gt;

&lt;p&gt;You can create a folder or choose a folder through VS Code.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Go to file&lt;/li&gt;
&lt;li&gt;Open your folder containing your project&lt;/li&gt;
&lt;li&gt;select your folder&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;
  
  
  Connecting Git to GitHub
&lt;/h4&gt;

&lt;p&gt;Now we'll configure GitHub by;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Clicking Source control on the left side &lt;/li&gt;
&lt;li&gt;Choose Manage work trust&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Initialize repository - this is the equivalent of &lt;strong&gt;git innit&lt;/strong&gt; when using Git Bash. It creates a hidden .Git directory which contains information that our Git uses to track the developments and changes.&lt;br&gt;
Initializing the repository allows our project folder to become a Git Repository.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Add change - this is a write up of the content you would like to indicate in present tense eg "Add Dataset". This is analogous to writing &lt;strong&gt;git commit -m " "&lt;/strong&gt;, while using terminal or Git Bash. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Against commit on the far right click the drop down and choose commit and sync. Comparable to this is &lt;strong&gt;git push origin main&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;After pushing our project to GitHub, you can run command &lt;strong&gt;Git status&lt;/strong&gt; to confirm everything is as you wanted it to be and maybe adjust accordingly.&lt;/p&gt;

&lt;p&gt;From here you'll see a number of prompts, only click "Always", "Add remote", "Publish Branch", "Allow- if configuring for the first time."&lt;/p&gt;

&lt;p&gt;Lastly, choose a browser of your choice and authorize access remembering to chose between creating a &lt;strong&gt;public&lt;/strong&gt; or &lt;strong&gt;private&lt;/strong&gt; &lt;strong&gt;key&lt;/strong&gt; depending on your choice and preference, Sign in and viola, The project is posted on GitHub. &lt;/p&gt;

&lt;p&gt;Something to note the name of the repository will bear the name of the folder used.&lt;/p&gt;

&lt;h4&gt;
  
  
  Conclusion
&lt;/h4&gt;

&lt;p&gt;That's it imagine, there are other ways to push your projects to GitHub if that's something you are interested in , be sure to find that out, there's also a lot more to know in GitHub and GitHub Configuration but baby steps, right? That's all for today all and the best at pushing your projects on GitHub.&lt;/p&gt;

</description>
      <category>git</category>
      <category>github</category>
      <category>gitbash</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Build A Calculator Using Python</title>
      <dc:creator>Faith</dc:creator>
      <pubDate>Mon, 10 Aug 2026 17:41:52 +0000</pubDate>
      <link>https://dev.to/faith_ondiege_6e7c59f9ac3/build-a-calculator-using-python-2f57</link>
      <guid>https://dev.to/faith_ondiege_6e7c59f9ac3/build-a-calculator-using-python-2f57</guid>
      <description>&lt;h1&gt;
  
  
  Using Loops
&lt;/h1&gt;

&lt;p&gt;This has to be the easiest way to apply your &lt;strong&gt;python&lt;/strong&gt; skills after learning the basics. The best and only way to learn anything is through rolling your sleeves and practicing, python for this case is no exception. Just like any other rookie, I did really struggle with what to start with given some projects online are quoted "beginner" but ended up not being beginner friendly to me. &lt;br&gt;
Yeah, I know this project is not all that, but it helps retain the concepts learnt and keeps the spark alive, at least it does for me.&lt;/p&gt;

&lt;h3&gt;
  
  
  Lines of Code
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;===== Advanced Calculator =====&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Basic: +, -, *, /&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Adv: power (^) and Modulus (%)&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Sci: sqrt, log&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Trig: sin, cos, tan&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# get the operator
&lt;/span&gt;&lt;span class="n"&gt;op&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;input&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;Enter Operator: &lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Binary operations
&lt;/span&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;op&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;+&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;-&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;*&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;/&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;^&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;%&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]:&lt;/span&gt;
    &lt;span class="n"&gt;num1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;float&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;input&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Enter 1st num: &lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
    &lt;span class="n"&gt;num2&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;float&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;input&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Enter 2nd num: &lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;op&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;+&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;result: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;num1&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;num2&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;elif&lt;/span&gt; &lt;span class="n"&gt;op&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;-&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;result: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;num1&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;num2&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;elif&lt;/span&gt; &lt;span class="n"&gt;op&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;*&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;result: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;num1&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;num2&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;elif&lt;/span&gt; &lt;span class="n"&gt;op&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;/&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;result: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;num1&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="n"&gt;num2&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;elif&lt;/span&gt; &lt;span class="n"&gt;op&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;^&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;result: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;pow&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;num1&lt;/span&gt; &lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;num2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;elif&lt;/span&gt; &lt;span class="n"&gt;op&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;%&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;result: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;num1&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="n"&gt;num2&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This are lines of code that can be used to explore loops in python because theory alone doesn't cut it. The first part of the code, the one consisting of print() at the beginning, are an explanation of the arithmetic operators used, you don't really need to have it.&lt;/p&gt;

</description>
      <category>python</category>
      <category>rookie</category>
      <category>programming</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
