<?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: rapidlashes</title>
    <description>The latest articles on DEV Community by rapidlashes (@rapidlashes).</description>
    <link>https://dev.to/rapidlashes</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%2F3971438%2Fa7c6e511-7ac4-44c0-8fb0-db7c7f9892ad.png</url>
      <title>DEV Community: rapidlashes</title>
      <link>https://dev.to/rapidlashes</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/rapidlashes"/>
    <language>en</language>
    <item>
      <title>SQL Operations in a nutshell :</title>
      <dc:creator>rapidlashes</dc:creator>
      <pubDate>Thu, 17 Sep 2026 11:35:59 +0000</pubDate>
      <link>https://dev.to/rapidlashes/sql-operations-in-a-nutshell--51fh</link>
      <guid>https://dev.to/rapidlashes/sql-operations-in-a-nutshell--51fh</guid>
      <description>&lt;p&gt;Congratulations, we now have worked on retrieving data. Next step is now how to work on that data to produce ready to use output. In this article we will basically cover how to transform, calculate and reshape data directly inside a querry rather than pulling those raw values and working with them on a separate platform.&lt;br&gt;
We have different SQL Operations:  &lt;strong&gt;Arithmetic&lt;/strong&gt;, &lt;strong&gt;string&lt;/strong&gt;, &lt;strong&gt;date&lt;/strong&gt;, &lt;strong&gt;conditional&lt;/strong&gt; and &lt;strong&gt;Aggregate&lt;/strong&gt; Operations.&lt;/p&gt;
&lt;h2&gt;
  
  
  Arithmetic Operations
&lt;/h2&gt;

&lt;p&gt;SQL supports standard mathematical operations in a &lt;code&gt;select&lt;/code&gt; statement&lt;br&gt;
syntax:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;product_name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;price&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;quantity&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;price&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;quantity&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;line_total&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;order_items&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;line_total is a column we have made in our &lt;code&gt;select&lt;/code&gt; query to find the total price of each item ordered.&lt;br&gt;
Arithmetic operations are also used for :&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Applying discounts or tax - &lt;code&gt;price * 0.16&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;computing differences - &lt;code&gt;Revenue - cost_price&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;product_name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;price&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;price&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;9&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;discounted_price&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;products&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  String Operations
&lt;/h2&gt;

&lt;p&gt;String operations clean up, combine, or reformat text data.&lt;br&gt;
common string functions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;UPPER()&lt;/code&gt; / &lt;code&gt;LOWER()&lt;/code&gt; — change cases&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;TRIM()&lt;/code&gt; — remove leading/trailing whitespace&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;LENGTH()&lt;/code&gt; — get the number of characters&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;SUBSTRING()&lt;/code&gt; — extract part of a string&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;REPLACE()&lt;/code&gt; — swap out text&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;initcap()&lt;/code&gt; - Changes the cases of the begining of every word to upper case. In another language is putting words into proper cases.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;CONCAT&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;first_name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;' '&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;last_name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;full_name&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;customers&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;update&lt;/span&gt; &lt;span class="n"&gt;tembo&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;tembo_staging&lt;/span&gt;
&lt;span class="k"&gt;set&lt;/span&gt; &lt;span class="n"&gt;guest_name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;initcap&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;trim&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;guest_name&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;span class="k"&gt;where&lt;/span&gt; &lt;span class="n"&gt;guest_name&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="n"&gt;initcap&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;trim&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;guest_name&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;What the above code does:&lt;br&gt;
It is updating the table &lt;strong&gt;tembo_staging&lt;/strong&gt; specifically the column &lt;strong&gt;guest_name&lt;/strong&gt; by telling SQL to look through the values of that column, find all those values that are not trimmed and properly cased and trim them first before properly casing them hence the &lt;code&gt;trim()&lt;/code&gt; inside the &lt;code&gt;inticap()&lt;/code&gt; function.&lt;/p&gt;
&lt;h2&gt;
  
  
  Aggregate Operations
&lt;/h2&gt;

&lt;p&gt;Aggregate functions collapse many rows into a single summary value, and are almost always paired with &lt;code&gt;GROUP BY&lt;/code&gt;.&lt;br&gt;
Core aggregate functions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;COUNT()&lt;/code&gt; — number of rows&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;SUM()&lt;/code&gt; — total of a numeric column&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;AVG()&lt;/code&gt; — average value&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;MIN()&lt;/code&gt; / &lt;code&gt;MAX()&lt;/code&gt; — smallest/largest value&lt;/li&gt;
&lt;/ul&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;product_category&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;AVG&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;price&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;avg_price&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;COUNT&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;total_products&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;products&lt;/span&gt;
&lt;span class="k"&gt;GROUP&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;product_category&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Conditional Operations with CASE WHEN
&lt;/h2&gt;

&lt;p&gt;CASE lets you build if/else logic directly into a query, turning raw values into categories, labels, or flags without needing a separate processing step.&lt;br&gt;
syntax:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;order_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;total&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="k"&gt;CASE&lt;/span&gt;
    &lt;span class="k"&gt;WHEN&lt;/span&gt; &lt;span class="n"&gt;total&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;500&lt;/span&gt; &lt;span class="k"&gt;THEN&lt;/span&gt; &lt;span class="s1"&gt;'Large'&lt;/span&gt;
    &lt;span class="k"&gt;WHEN&lt;/span&gt; &lt;span class="n"&gt;total&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt; &lt;span class="k"&gt;THEN&lt;/span&gt; &lt;span class="s1"&gt;'Medium'&lt;/span&gt;
    &lt;span class="k"&gt;ELSE&lt;/span&gt; &lt;span class="s1"&gt;'Small'&lt;/span&gt;
  &lt;span class="k"&gt;END&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;order_size&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;orders&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;order_size&lt;/strong&gt; will be a column on it's own, that &lt;strong&gt;categorises&lt;/strong&gt; the orders by the &lt;strong&gt;total&lt;/strong&gt; price.&lt;/p&gt;

&lt;p&gt;We can also use a &lt;code&gt;case when&lt;/code&gt; statement inside aggregates for conditional counting or summing eg,&lt;br&gt;
syntax:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt;
  &lt;span class="k"&gt;COUNT&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;CASE&lt;/span&gt; &lt;span class="k"&gt;WHEN&lt;/span&gt; &lt;span class="n"&gt;status&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'shipped'&lt;/span&gt; &lt;span class="k"&gt;THEN&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="k"&gt;END&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;shipped_orders&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="k"&gt;COUNT&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;CASE&lt;/span&gt; &lt;span class="k"&gt;WHEN&lt;/span&gt; &lt;span class="n"&gt;status&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'cancelled'&lt;/span&gt; &lt;span class="k"&gt;THEN&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="k"&gt;END&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;cancelled_orders&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;orders&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;cancelled_orders&lt;/strong&gt; and &lt;strong&gt;shipped_orders&lt;/strong&gt; are columns of their own derived from the orders table.The values inside are the number of orders that were cancelled and shipped respectively.&lt;/p&gt;

&lt;h2&gt;
  
  
  Date Operations
&lt;/h2&gt;

&lt;p&gt;Dates come with their own set of operations, since they need to be compared, calculated on, and formatted differently from plain numbers or text.&lt;br&gt;
syntax:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;order_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;order_date&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;CURRENT_DATE&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;order_date&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;days_since_order&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;orders&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The values i the column days_since_order will be in days&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 sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;orders&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;order_date&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="k"&gt;CURRENT_DATE&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;INTERVAL&lt;/span&gt; &lt;span class="s1"&gt;'30 days'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;INTERVAL&lt;/code&gt; on it's own is a date function. Here we are filtering by recent activity.&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 sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;order_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;EXTRACT&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;MONTH&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;order_date&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;order_month&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;orders&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;EXTRACT&lt;/code&gt; is also a date function used to extracting parts of a date eg months, days or years.&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 sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;TO_CHAR&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;order_date&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'YYYY-MM'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;order_month&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;orders&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;TO_CHAR&lt;/code&gt; converts the date value to a readable text string/ text , however you like to call it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;NOTE&lt;/strong&gt;: Some date functions differe for different databases. The above examples are for Postgres Database. You will need to check more on the same once we move past the basics.&lt;/p&gt;

&lt;h3&gt;
  
  
  Combining them all
&lt;/h3&gt;

&lt;p&gt;In a real data set you will mostly find yourself in a postion where you will have to combine all these functions into one querry to answer a certain business question.&lt;br&gt;
syntax:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt;
  &lt;span class="n"&gt;TO_CHAR&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;order_date&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'YYYY-MM'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="k"&gt;month&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="k"&gt;COUNT&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;total_orders&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="k"&gt;SUM&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;total&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;total_revenue&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;ROUND&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;AVG&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;total&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;avg_order_value&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;orders&lt;/span&gt;
&lt;span class="k"&gt;GROUP&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;TO_CHAR&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;order_date&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'YYYY-MM'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;ORDER&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="k"&gt;month&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In layman's language, im trying to find the total number of orders and total revenue for each month, but I want my &lt;strong&gt;month&lt;/strong&gt; column to be in the format &lt;code&gt;2024 March&lt;/code&gt; for instance, and I want the table to be ordered from the earliest date to the latest.&lt;/p&gt;

&lt;h3&gt;
  
  
  To summarise...
&lt;/h3&gt;

&lt;p&gt;You move from just retrieving data to generating insights from that data, that is the whole point of SQL operations.&lt;/p&gt;

&lt;p&gt;Once comfortable with that, you can move to the next step which are subquerries and CTE's then to window functions.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>programming</category>
      <category>productivity</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Next step:Filtering and joins</title>
      <dc:creator>rapidlashes</dc:creator>
      <pubDate>Mon, 14 Sep 2026 14:12:30 +0000</pubDate>
      <link>https://dev.to/rapidlashes/next-stepfiltering-and-joins-45l2</link>
      <guid>https://dev.to/rapidlashes/next-stepfiltering-and-joins-45l2</guid>
      <description>&lt;p&gt;Once you are comfortable with basic &lt;code&gt;select&lt;/code&gt; statements, your next step is now combining data using &lt;strong&gt;joins&lt;/strong&gt; and narrowing it down(fitering) to exactly what you need using statements like &lt;code&gt;order by&lt;/code&gt; , &lt;code&gt;group by&lt;/code&gt; and the sort.&lt;/p&gt;

&lt;h2&gt;
  
  
  JOINS
&lt;/h2&gt;

&lt;p&gt;You can have multiple tables in your database eg &lt;strong&gt;Customers&lt;/strong&gt; table and &lt;strong&gt;orders&lt;/strong&gt; table both from the same parent data. Now &lt;strong&gt;customers&lt;/strong&gt; table holds customers info while &lt;strong&gt;orders&lt;/strong&gt; table hold orders info from your parent data. A data analyst can pull related data between the two tables using the &lt;strong&gt;joins&lt;/strong&gt; operations in an sql querry.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;NOTE&lt;/strong&gt;: for this to happen , there has to be a common column between the two tables. We'll dive deep into that when we get to the syntax part.&lt;/p&gt;

&lt;p&gt;Now there are 5 major joins in sql:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. INNER JOIN&lt;/strong&gt;&lt;br&gt;
Returns only rows that have a match in both 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 sql"&gt;&lt;code&gt;&lt;span class="k"&gt;select&lt;/span&gt; &lt;span class="k"&gt;c&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;o&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;product_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;o&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;quantity&lt;/span&gt; 
&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;duka&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;duka_customers&lt;/span&gt; &lt;span class="k"&gt;c&lt;/span&gt;
&lt;span class="k"&gt;inner&lt;/span&gt; &lt;span class="k"&gt;join&lt;/span&gt; &lt;span class="n"&gt;duka&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;duka_orders&lt;/span&gt; &lt;span class="n"&gt;o&lt;/span&gt;
&lt;span class="k"&gt;on&lt;/span&gt; &lt;span class="k"&gt;c&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;customer_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;o&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;customer_id&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We have 2 tables sharing a common column &lt;strong&gt;customer_id&lt;/strong&gt;. The column &lt;strong&gt;name&lt;/strong&gt; comes from the table &lt;strong&gt;duka_customers&lt;/strong&gt;. &lt;br&gt;
You can tell that from the alias &lt;strong&gt;c&lt;/strong&gt;, while &lt;strong&gt;product_id&lt;/strong&gt; and &lt;strong&gt;quantity&lt;/strong&gt; come from the table &lt;strong&gt;duka_orders&lt;/strong&gt;.&lt;br&gt;
An Alias is like a pointer here to show you which column comes from which table.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. LEFT JOIN(LEFT OUTER JOIN)&lt;/strong&gt;&lt;br&gt;
Returns all rows from the left table plus matching data from the right table. Rows with no match get NULL for the right table's columns.&lt;br&gt;
syntax:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;select&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;product_name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;o&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;order_id&lt;/span&gt; 
&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;duka&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;duka_products&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt;
&lt;span class="k"&gt;left&lt;/span&gt; &lt;span class="k"&gt;join&lt;/span&gt; &lt;span class="n"&gt;duka&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;duka_orders&lt;/span&gt; &lt;span class="n"&gt;o&lt;/span&gt; &lt;span class="k"&gt;on&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;product_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;o&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;product_id&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;From the syntax above , we are basically trying to see all the products from the table duka_products along side their order_ids from the table duka_orders.&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%2F97ralf3qp6zqqv1ijtex.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%2F97ralf3qp6zqqv1ijtex.png" alt=" " width="440" height="695"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. RIGHT JOIN(RIGHT OUTER JOIN)&lt;/strong&gt;&lt;br&gt;
The mirror image of a LEFT JOIN — returns all rows from the right table, with matches from the left table where available.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. FULL OUTER JOIN&lt;/strong&gt;&lt;br&gt;
Returns all rows from both tables, matching where possible and filling with NULL where there's no match on either side. Useful for spotting mismatches between two datasets.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. SELF JOIN&lt;/strong&gt;&lt;br&gt;
A table joined to itself — common for hierarchical data, like employees and their managers stored in the same table.&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%2Fdlns309r59es8vqex4a1.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%2Fdlns309r59es8vqex4a1.PNG" alt=" " width="689" height="218"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is the original 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 sql"&gt;&lt;code&gt;&lt;span class="k"&gt;select&lt;/span&gt;
&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;employee_name&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;employee&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="n"&gt;m&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;employee_name&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;manager&lt;/span&gt;
&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="k"&gt;public&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Company&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;
&lt;span class="k"&gt;left&lt;/span&gt; &lt;span class="k"&gt;join&lt;/span&gt; &lt;span class="k"&gt;public&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Company&lt;/span&gt; &lt;span class="n"&gt;m&lt;/span&gt; &lt;span class="k"&gt;on&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;manager_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;m&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;employee_id&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&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%2Fko8ilwlknscziulmw9tn.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%2Fko8ilwlknscziulmw9tn.PNG" alt=" " width="395" height="209"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is the table after running the self join querry above.&lt;/p&gt;

&lt;h2&gt;
  
  
  FILTERING
&lt;/h2&gt;

&lt;p&gt;A &lt;code&gt;where&lt;/code&gt; clause comes a long way when you want to narrow down your results. Let's take a look at this syntax we had used earlier.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;select&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;product_name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;o&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;order_id&lt;/span&gt; 
&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;duka&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;duka_products&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt;
&lt;span class="k"&gt;left&lt;/span&gt; &lt;span class="k"&gt;join&lt;/span&gt; &lt;span class="n"&gt;duka&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;duka_orders&lt;/span&gt; &lt;span class="n"&gt;o&lt;/span&gt; &lt;span class="k"&gt;on&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;product_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;o&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;product_id&lt;/span&gt;
&lt;span class="k"&gt;where&lt;/span&gt; &lt;span class="n"&gt;o&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;order_id&lt;/span&gt; &lt;span class="k"&gt;is&lt;/span&gt; &lt;span class="k"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Without the &lt;strong&gt;where&lt;/strong&gt; clause, all product names will be returned alongside their order_ids, but after the where clause, only the products whose order_ids are NULLS will be returned.&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%2Fil0lfs2evj25l599ckt8.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%2Fil0lfs2evj25l599ckt8.png" alt=" " width="484" height="310"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;NOTE&lt;/strong&gt;: notice how we have used &lt;code&gt;is NULL&lt;/code&gt; instead of &lt;code&gt;= NULL&lt;/code&gt;&lt;br&gt;
to identify NULLS. A simple explanation is, NULL is &lt;strong&gt;not&lt;/strong&gt; a value, it is a &lt;strong&gt;place holder&lt;/strong&gt; to show you that a certain value is missing.&lt;/p&gt;
&lt;h4&gt;
  
  
  Common filtering tools:
&lt;/h4&gt;

&lt;p&gt;&lt;code&gt;AND&lt;/code&gt; / &lt;code&gt;OR&lt;/code&gt; — combine multiple conditions&lt;br&gt;
&lt;code&gt;NOT&lt;/code&gt; — negate a condition&lt;br&gt;
&lt;code&gt;IN&lt;/code&gt; — match against a list of values&lt;br&gt;
&lt;code&gt;BETWEEN&lt;/code&gt; — match a range&lt;br&gt;
&lt;code&gt;LIKE&lt;/code&gt; — pattern matching with wildcards (% for any characters, _ for a single character)&lt;br&gt;
&lt;code&gt;IS NULL&lt;/code&gt; / &lt;code&gt;IS NOT NULL&lt;/code&gt; — check for missing values&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 sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;customers&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;country&lt;/span&gt; &lt;span class="k"&gt;IN&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'Kenya'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'Nigeria'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'Ghana'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="n"&gt;email&lt;/span&gt; &lt;span class="k"&gt;IS&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="k"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;HAVING — filtering after aggregation&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;WHERE can't filter on aggregate results (like a COUNT or SUM), because those values don't exist until after grouping. That's where HAVING comes in:&lt;br&gt;
syntax:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;customer_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;COUNT&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;order_count&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;orders&lt;/span&gt;
&lt;span class="k"&gt;GROUP&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;customer_id&lt;/span&gt;
&lt;span class="k"&gt;HAVING&lt;/span&gt; &lt;span class="k"&gt;COUNT&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This returns customers with more than 5 orders. You cant say &lt;code&gt;where count(*) &amp;gt; 5&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;To conclude...&lt;/strong&gt;&lt;br&gt;
This is should be your Step no. 2 in learning SQL after understanding the basics including the command categories. The Next part will now be Operations to help you transform and calculate the data.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>programming</category>
      <category>productivity</category>
      <category>beginners</category>
    </item>
    <item>
      <title>NO idea where to start learning SQL?</title>
      <dc:creator>rapidlashes</dc:creator>
      <pubDate>Sun, 13 Sep 2026 19:30:18 +0000</pubDate>
      <link>https://dev.to/rapidlashes/no-idea-where-to-start-learning-sql-4nh6</link>
      <guid>https://dev.to/rapidlashes/no-idea-where-to-start-learning-sql-4nh6</guid>
      <description>&lt;p&gt;This article is a beginner friendly guide that gets you started into learning SQL as a programming language. &lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Relational databases store data in tabular form, often referred to as structured data. The alternative is Unrelational databases. Now SQL is simply the programming language that enables you to do so. SQL stands for &lt;strong&gt;Structured Querry Language&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Basics
&lt;/h2&gt;

&lt;p&gt;To understand a Structured Querry Language , these 4 concepts should come in mind:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Tables&lt;/strong&gt; - data organized into rows and columns, similar to a spreadsheet eg Customer's table&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;rows&lt;/strong&gt; - a single record in a table eg a specific name,'Ahmed' &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;columns&lt;/strong&gt; - a single attribute or field eg customer_name&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Databases&lt;/strong&gt; - A Database is like a house that stores the organised data electronically making it easier and safer to find, retrieve and modify the data.This is usually done by the help of a software. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Schemas&lt;/strong&gt; - The data in our database is grouped in schemas. &lt;br&gt;
Think of it as a cabinet that holds your data in tables, views and rules acting as a blueprint on how your data will be organised.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To illustrate more , check the image 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%2F8osaw7ef99unz2saogbv.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%2F8osaw7ef99unz2saogbv.png" alt=" " width="800" height="572"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The icons  are &lt;strong&gt;SQL databases&lt;/strong&gt;  and &lt;strong&gt;Dbeaver&lt;/strong&gt; is the software .&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%2Ft8j9qwnvqhm4m8h2e2ge.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%2Ft8j9qwnvqhm4m8h2e2ge.png" alt=" " width="447" height="381"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;tembo&lt;/strong&gt; and &lt;strong&gt;public&lt;/strong&gt; are schemas, while &lt;strong&gt;tembo_production&lt;/strong&gt; and &lt;strong&gt;tembo_staging&lt;/strong&gt; are tables inside the schema &lt;strong&gt;tembo&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  SQL command categories:
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;DDL&lt;/strong&gt; - Data Definition Language
Defines and modifies the structure of the database itself: tables, schemas, and constraints.&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;create&lt;/code&gt; - building a new table or a database&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;alter&lt;/code&gt; - changing an existing table's structure&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;drop&lt;/code&gt; - deleting a table or databbase entirely&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;truncate&lt;/code&gt; - deleting the content inside a table but maintainging the structure&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A data engineer setting up a new pipeline will lean on DDL to create the tables that will hold incoming data, and adjust them with ALTER as requirements change.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;DQL&lt;/strong&gt; - Data Querry Language&lt;br&gt;
Is used to retrieve data without changing it. Common key word is &lt;code&gt;select&lt;/code&gt;.&lt;br&gt;
A data analyst spends most of their day writing DQL (SELECT) queries — pulling metrics, building reports, and answering ad hoc business questions.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;TCL&lt;/strong&gt; - Transaction Control Language&lt;br&gt;
Manages groups of changes as a single unit, ensuring consistency of data&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;commit&lt;/code&gt; - save all changes made in a transaction&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;rollback&lt;/code&gt; - undo changes made in a transaction&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;savepoint&lt;/code&gt; - set a point within a transaction to roll back to, without undoing everything&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now a common question will be what is a &lt;strong&gt;transaction&lt;/strong&gt;.&lt;br&gt;
Well a &lt;strong&gt;transaction&lt;/strong&gt; is like a single unit of work made up of one or more operations eg deleting, updating, writting data that either completes or fails.&lt;/p&gt;

&lt;p&gt;Think of it as an all or nothing rule. All steps work, changes are &lt;strong&gt;saved&lt;/strong&gt; but if a single step doesnt, all previous changes are &lt;strong&gt;undone&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;In systems handling money or critical records, TCL ensures that a group of related changes either all happen or none do. For instance, transferring funds between two bank accounts involves debiting one and crediting another — &lt;code&gt;COMMIT&lt;/code&gt; only fires once both steps succeed, and a failure triggers a &lt;code&gt;rollback&lt;/code&gt; so the data never ends up half-updated.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;DML&lt;/strong&gt; - Data Manipulation Language
Used for working with the data inside a table.&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;insert&lt;/code&gt; - adding new rows&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;delete&lt;/code&gt; - removing rows&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;update&lt;/code&gt; - modifying exisiting rows&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;An application connected to the database uses DML constantly in the background: every time a user signs up, places an order, or updates their profile, the app runs &lt;code&gt;INSERT&lt;/code&gt;, &lt;code&gt;UPDATE&lt;/code&gt;, or &lt;code&gt;DELETE&lt;/code&gt; statements.&lt;/p&gt;

&lt;p&gt;5.&lt;strong&gt;DCL&lt;/strong&gt; - Data Control Language&lt;br&gt;
Basically manages who can do what.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;grant&lt;/code&gt; - gives a user permission to perform a certain action&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;revoke&lt;/code&gt; - takes the permission away&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A database administrator (DBA) uses DCL to control who has access to sensitive tables — for example, granting an analyst read-only access while restricting &lt;code&gt;DELETE&lt;/code&gt; permissions to a small team.&lt;/p&gt;
&lt;h3&gt;
  
  
  Getting started on queries
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;select&lt;/code&gt; statement is where all sql work begins.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;select&lt;/span&gt; &lt;span class="n"&gt;first_name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;last_name&lt;/span&gt;
&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;customers&lt;/span&gt;
&lt;span class="k"&gt;where&lt;/span&gt; &lt;span class="n"&gt;county&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'Mombasa'&lt;/span&gt;
&lt;span class="k"&gt;order&lt;/span&gt; &lt;span class="k"&gt;by&lt;/span&gt; &lt;span class="n"&gt;age&lt;/span&gt; &lt;span class="k"&gt;desc&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;first_name&lt;/strong&gt;, &lt;strong&gt;last_name&lt;/strong&gt;, &lt;strong&gt;county&lt;/strong&gt;, &lt;strong&gt;age&lt;/strong&gt; are all columns in our table.&lt;br&gt;
The table name is called &lt;strong&gt;customers&lt;/strong&gt;, while '&lt;strong&gt;Mombasa&lt;/strong&gt;' is a value in the column &lt;strong&gt;county&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The example above is a simple sql querry just to get you started as a beginner, once you have mastered these concepts, next thing you will dive into is filtering and operations , and joins.&lt;/p&gt;

</description>
      <category>programming</category>
      <category>productivity</category>
      <category>beginners</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Connecting Power BI to a Database: A Complete Guide</title>
      <dc:creator>rapidlashes</dc:creator>
      <pubDate>Wed, 08 Jul 2026 18:04:28 +0000</pubDate>
      <link>https://dev.to/rapidlashes/connecting-power-bi-to-local-and-cloud-databases-in-aiven-a-complete-guide-5ha0</link>
      <guid>https://dev.to/rapidlashes/connecting-power-bi-to-local-and-cloud-databases-in-aiven-a-complete-guide-5ha0</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;You are data analyst in an organisation working on a large volume of data. Your company stores that data in a postgres SQL database for instance and you need to access that data and analyze it using the tool of your choice like Power BI, Tableau, Looker Studio etc, then you have to find a way to connect that visualization tool to the database to access that data.&lt;/p&gt;

&lt;p&gt;Your data can be stored in a local database server or in a cloud managed platfrom like Aiven. Whichever the case, the guide below shows you how to connect to both.&lt;/p&gt;

&lt;h3&gt;
  
  
  Prerequsites
&lt;/h3&gt;

&lt;p&gt;Before connecting your power BI to these databases ensure you have;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;An Active Aiven account&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A running service in Aiven, in our case Postgres SQL database service&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A running postgres SQL database hosted locally&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Power BI installed in your desktop &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  1. Connecting power BI to a local postgres SQL database
&lt;/h2&gt;

&lt;p&gt;The process is straight forward, but first  , you will need a tool like Dbeaver, a software that enables you to store and organise your data and also allows you to connect to not only one but multiple databases.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1&lt;/strong&gt;-open your dbeaver &lt;br&gt;
press Cntrl+shift+N  to open a new database connection in our case Postgres SQL &lt;/p&gt;

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

&lt;p&gt;&lt;strong&gt;Step 2&lt;/strong&gt;-Input your connection password and press okay , you can test the connection to see if it is valid, then press okay&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%2Fok6i5jwhlgh61pleecmd.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%2Fok6i5jwhlgh61pleecmd.png" alt=" " width="" height=""&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%2F6dn4yb3cclgg8h5n4rve.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%2F6dn4yb3cclgg8h5n4rve.png" alt=" " width="800" height="806"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 3&lt;/strong&gt;-Right click on your connection name, and on the drop down click connect, make sure your connection name has a green tick&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%2Fixez7briwmh5btsu38mv.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%2Fixez7briwmh5btsu38mv.png" alt=" " width="606" height="383"&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%2Fdgujjfbdrl9ldr8uwsc2.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%2Fdgujjfbdrl9ldr8uwsc2.png" alt=" " width="" height=""&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%2Fd71rq5z504ty62gw0e8a.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%2Fd71rq5z504ty62gw0e8a.png" alt=" " width="602" height="376"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once you have established that connection, you can now manually add your data from your machine to the database&lt;br&gt;
&lt;strong&gt;Step 1&lt;/strong&gt;-go to your database&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%2Fg5pljfc2zmzyz8ovzbry.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%2Fg5pljfc2zmzyz8ovzbry.png" alt=" " width="597" height="632"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 2&lt;/strong&gt;-Import data&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%2Fkc23z1hmtpl1g160divt.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%2Fkc23z1hmtpl1g160divt.png" alt=" " width="800" height="818"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 3&lt;/strong&gt;- choose the type of data&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%2Fp85bvo1ksr9b1xt0pjco.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%2Fp85bvo1ksr9b1xt0pjco.png" alt=" " width="800" height="434"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 4&lt;/strong&gt;-Browse from your local files&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%2Fpmlw3aafxkwt4rge0u0j.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%2Fpmlw3aafxkwt4rge0u0j.png" alt=" " width="799" height="408"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now launch your power BI , got to home , click Get Data , go to databases and choose postgres SQL database.&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%2Ffhphlb15ooerpcrnwoeg.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%2Ffhphlb15ooerpcrnwoeg.png" alt=" " width="800" height="528"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You will then be prompted to enter your connection details for the local postgres SQL you just created&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%2F8x1agkafjw23p3vs0io8.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%2F8x1agkafjw23p3vs0io8.png" alt=" " width="799" height="501"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;click connect, from your navigator page, you can now select the files you want to work on directly from your database.&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%2Fwyqcca0z47c9fsvi4eob.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%2Fwyqcca0z47c9fsvi4eob.png" alt=" " width="800" height="604"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Connecting Power BI to a cloud-based postgres database in Aiven
&lt;/h2&gt;

&lt;p&gt;Unlike a local PostgreSQL installation, Aiven databases are hosted securely in the cloud. Every connection is encrypted using SSL.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why SSL matters
&lt;/h3&gt;

&lt;p&gt;When Power BI connects to an Aiven PostgreSQL database, your data travels across the internet.&lt;/p&gt;

&lt;p&gt;Without SSL:&lt;/p&gt;

&lt;p&gt;Data could potentially be intercepted.&lt;br&gt;
Credentials might be exposed.&lt;br&gt;
Connections are vulnerable to man-in-the-middle attacks.&lt;/p&gt;

&lt;p&gt;With SSL enabled:&lt;/p&gt;

&lt;p&gt;Data is encrypted.&lt;br&gt;
Passwords remain protected.&lt;br&gt;
Power BI verifies that it is communicating with the legitimate Aiven server.&lt;/p&gt;

&lt;h3&gt;
  
  
  Downloading and configuring the SSL certificate
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Step 1&lt;/strong&gt;-Open your Aiven Postgres SQL service, make sure it's running&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%2Fz5j9yugjtj5logq27orb.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%2Fz5j9yugjtj5logq27orb.png" alt=" " width="800" height="269"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 2&lt;/strong&gt;- download the CA certificate&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%2Fg7dzhuz4z0wgcxfwgap6.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%2Fg7dzhuz4z0wgcxfwgap6.png" alt=" " width="800" height="331"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 3&lt;/strong&gt;- open windows, go to manage user certificates, Trusted Root certification&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%2F60uocmy4zju2ma08e3l9.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%2F60uocmy4zju2ma08e3l9.png" alt=" " width="800" height="562"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 4&lt;/strong&gt;- Right click on the drop down certifcates, all tasks, then import data. You will then browse from your local files where your certificate is stored &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%2Fcpiy33hmwtmor55pdixc.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%2Fcpiy33hmwtmor55pdixc.png" alt=" " width="800" height="662"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Connecting to your power BI&lt;/strong&gt;&lt;br&gt;
The process is more or less the same with the local Postgres SQL. Your connection details are in your Aiven postgres SQL service.The server box details are (hostname:port) while the rest of the details are input directly.&lt;/p&gt;

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

&lt;p&gt;Connecting Power BI to PostgreSQL is a straightforward process whether your database is hosted locally or in the cloud&lt;br&gt;
The key distinction when connecting to Aiven is the use of SSL/TLS encryption.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>tutorial</category>
      <category>programming</category>
      <category>reviews</category>
    </item>
    <item>
      <title>POWER BI RELATIONSHIPS, SCHEMAS AND JOINS.</title>
      <dc:creator>rapidlashes</dc:creator>
      <pubDate>Thu, 02 Jul 2026 14:51:37 +0000</pubDate>
      <link>https://dev.to/rapidlashes/power-bi-relationships-schemas-and-joins-4bdi</link>
      <guid>https://dev.to/rapidlashes/power-bi-relationships-schemas-and-joins-4bdi</guid>
      <description>&lt;h2&gt;
  
  
  Understanding the concepts
&lt;/h2&gt;

&lt;p&gt;Relationships, schemas and joins in power BI are key concepts in understanding data structures in power BI&lt;/p&gt;

&lt;h1&gt;
  
  
  relationships
&lt;/h1&gt;

&lt;p&gt;Are basically connections between tables in power BI that shows how a data in one table is related to a data in another table.&lt;/p&gt;

&lt;h3&gt;
  
  
  cardinality:
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;one to one&lt;/strong&gt; -each value appears once in the two tables eg;&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%2Fs7zvntmxak40niyyl0qk.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%2Fs7zvntmxak40niyyl0qk.png" alt=" " width="520" height="90"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;one to many&lt;/strong&gt;-one value in one table appears many times in another table&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%2Fph5vffjx6fjb9vgg16uv.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%2Fph5vffjx6fjb9vgg16uv.png" alt=" " width="369" height="157"&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%2F1ftd0klikvznf80oubsl.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%2F1ftd0klikvznf80oubsl.png" alt=" " width="381" height="130"&gt;&lt;/a&gt;&lt;br&gt;
this basically means Fatma has placed multiple orders&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;many to many&lt;/strong&gt;- multiple values in one table can appear multiple times in another table. A simplified example is a data table for students performance in a school where we find that one student can take many subjects and also one subject can be taken by multiple students.&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%2F7mh9980va2afof5x122i.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%2F7mh9980va2afof5x122i.png" alt=" " width="754" height="201"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Primary keys and Foreign keys
&lt;/h2&gt;

&lt;p&gt;A primary keys is a column that acts as a unique identifier in a table while a foreign key is a column that basically referrences a primary key in another table.&lt;br&gt;
From the above table explaining the one to many relationship of a schema, we can conclude that the customerID column is a primary key in the customer's table while the same column acts as a foreign key in the Order table.&lt;/p&gt;

&lt;h2&gt;
  
  
  Schemas/data structure/data blueprint
&lt;/h2&gt;

&lt;p&gt;This is a  model/ structure in which your data sits on. As you feed more data into your table, a schema is how your data will be arranged in your &lt;code&gt;.pbix&lt;/code&gt; file.&lt;br&gt;
To understand this concept, you have to first understand the two types of tables involved in your &lt;code&gt;.pbix&lt;/code&gt; file namely;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;dimensional tables&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;fact tables&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For instance you are working on a table of raw data containing thousands of rows. As a data analyst it is your duty to prepare the data in such a way that it becomes easier to analyse , understand and interpret. One large table can be broken down into multiple tables that are interconnected with each other. &lt;br&gt;
Dimensional tables will contain primary keys while a fact table will house those primary keys as foreign keys in it.&lt;br&gt;
A good example is on the above tow tables explaining the one to many relationships. We can conclude that the Customer's table is a dimensional table while the Order table is a fact table.&lt;br&gt;
There are 2 types of schemas:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Star schema-&lt;/strong&gt; has one fact table and several dimensional tables&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%2F5mv5kkynyjt30ku89no4.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%2F5mv5kkynyjt30ku89no4.png" alt=" " width="799" height="406"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;snowflake schema&lt;/strong&gt;- has one fact table, several dimensional tables and sub dimensional tables&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%2F8sqs59p55uetrd6fko3l.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%2F8sqs59p55uetrd6fko3l.png" alt=" " width="800" height="402"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Joins
&lt;/h2&gt;

&lt;p&gt;This is a function in your power BI platfrom that now you will use to merge these dimensional and subdimensional tables into one large meaningfull flat table.It is used in power query when transforming your data.&lt;br&gt;
There are types of joins:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Full outer join&lt;/strong&gt;- combines all values from both tables&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;right outer join&lt;/strong&gt;-combines all values from the second table and matching values from the first table&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;left outer join&lt;/strong&gt;-combines all values from the first table and matching values from the second table.(&lt;em&gt;&lt;strong&gt;note&lt;/strong&gt;&lt;/em&gt;: the arrangement of the table depends entirely on the analyst) &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;-** inner join**-combines only matching values from the  columns of the two tables(dimensional and fact tables)&lt;/p&gt;

&lt;h3&gt;
  
  
  Antijoins
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;left Antijoin will only select rows that are in the first table only and are missing in the second table&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Right Antijoin only selects rows in the second table alone and are missing in the first&lt;/p&gt;&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%2Fkvrd1bi1shpul4vt99jm.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%2Fkvrd1bi1shpul4vt99jm.png" alt=" " width="714" height="441"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;Key take aways:&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Schemas are used to break down tables&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Joins are used to merge your tables&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Antijoins cant be used to merge tables&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Foreign keys are in fact tables, in their dimensional tables they are primary keys&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Primary keys are unique in their tables&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>ai</category>
      <category>beginners</category>
      <category>reviews</category>
      <category>opensource</category>
    </item>
    <item>
      <title>Why Excel....</title>
      <dc:creator>rapidlashes</dc:creator>
      <pubDate>Sat, 06 Jun 2026 17:04:28 +0000</pubDate>
      <link>https://dev.to/rapidlashes/why-excel-2ame</link>
      <guid>https://dev.to/rapidlashes/why-excel-2ame</guid>
      <description>&lt;p&gt;&lt;strong&gt;What is excel&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Let's say for instance you are running a garage business and you have been spending a lot of money in operations which does not tally the income cash flow from the business, and you are looking to see which department uses a large percentage of the daily operational cost of the business. &lt;/p&gt;

&lt;p&gt;You obviously need a tool to analyse that cost, from money used in transportation to money spent in procurement of spare parts and garage work tools. &lt;/p&gt;

&lt;p&gt;Excel with its features can give you the best platform to analyse that cost enabling you to make decisions that will help you cut down on expenses while still maximising profits.&lt;/p&gt;

&lt;p&gt;What makes it stand out is , its a tool you can use for free and by far the easiest one to achieve mastery.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;definitions&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Excel is basically a tool provided by Microsoft to help you analyse and store data. The data can be in numeric form or text form or even Pictorial form in some cases.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Applications&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Now from the above introduction we have seen one way we can use excel spreadsheets, by analysing a company's operational cost in comparison to the company's income cash flow. &lt;/p&gt;

&lt;p&gt;Another instance we can use an excel spreadsheet still in a business set up is analysing which products sale the most. &lt;br&gt;
In a business like running a spare shop for instance, you end up selling a variety of spare parts but not all products sale at the same rate.&lt;br&gt;
Excel will help you identify fast moving products from the slow moving ones and the dead stocks therefore enabling you to make the best decisions before procuring spare parts.&lt;/p&gt;

&lt;p&gt;Another application where excel can be essential for use is analysing an employee's work performance and using that data to handle payroll. One can analyse aggregates like hours of work, hire date, years of experience and project completion time to derive rational decisions on whether to increase or decrease an employee's salary.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Features&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Excel has a wide variety of features and functions that enable the user to work efficiently. Tools like conditional formatting allow one to point out and highlight a specific cell or cells that satisfy certain conditions like for instance duplicate values or text.&lt;/p&gt;

&lt;p&gt;There are also a wide variety of numeric functions that can help one find the Sum, Mode or Average of a numeric data set.Such functions are useful in accounting. &lt;/p&gt;

&lt;p&gt;Another feature which is a basic one but very essential is the one that allows you to convert any type of data in a certain cell to a format of your liking, for instance, a numeric data can be converted to a currency of one's choice.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;In conclusion...&lt;/strong&gt;&lt;br&gt;
When youre trying to find simplicity and efficiency all in one entity, excel is what you get.&lt;/p&gt;

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