<?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: Sam Guantai</title>
    <description>The latest articles on DEV Community by Sam Guantai (@sguantai).</description>
    <link>https://dev.to/sguantai</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%2F3971856%2F976b084a-ac9f-4193-9ebb-8902a3f9119d.png</url>
      <title>DEV Community: Sam Guantai</title>
      <link>https://dev.to/sguantai</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sguantai"/>
    <language>en</language>
    <item>
      <title>SQL Subqueries vs CTEs: Which, When and Why</title>
      <dc:creator>Sam Guantai</dc:creator>
      <pubDate>Tue, 15 Sep 2026 12:16:18 +0000</pubDate>
      <link>https://dev.to/sguantai/sql-subqueries-vs-ctes-which-when-and-why-418h</link>
      <guid>https://dev.to/sguantai/sql-subqueries-vs-ctes-which-when-and-why-418h</guid>
      <description>&lt;p&gt;Inside you there are two wolves, one wants to use a subquery and the other prefers a CTE. Both are SQL developers, and neither will stop arguing about which one is better. Today we will discuss which wolf to feed (depending on the situation).&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;What Are Subqueries?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;A subquery is a query nested inside another query. It usually runs first and its result gets used by the outer query either as a value to compare against, a list to check against or a table to select from.&lt;/p&gt;

&lt;p&gt;Subqueries can show up in a few places: the WHERE clause, the SELECT list, the FROM clause, or even inside another subquery.&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%2Fpo2b9yd654hy53ta3i91.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%2Fpo2b9yd654hy53ta3i91.png" alt=" " width="478" height="77"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The 'select avg(score)' in the WHERE clause is the subquery in this case and runs first.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;What Are CTEs?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;A Common Table Expression (WITH ... AS (...)) sets up a temporary, named result at the top of your query, which you can then use like a table further down. It's basically a subquery you pull out and give a name to, which makes longer queries much easier to read.&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%2F9rpk970ikw6thf9bvjm6.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%2F9rpk970ikw6thf9bvjm6.png" alt=" " width="485" height="137"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Differences between Subqueries and CTEs&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Subquery&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Named? - No, it's just embedded inline.&lt;/li&gt;
&lt;li&gt;Reuse -   Has to be rewritten if you need it more than once.&lt;/li&gt;
&lt;li&gt;Readability - Gets messy once you nest subqueries inside subqueries.
&lt;/li&gt;
&lt;li&gt;Where it can go -   WHERE, SELECT, FROM, or nested in another subquery.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;Common Table Expressions&lt;/strong&gt;&lt;/em&gt; &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Named? - Yes, you give it a name with WITH.&lt;/li&gt;
&lt;li&gt;Reuse - Defined once, can be referenced multiple times in the same query.&lt;/li&gt;
&lt;li&gt;Readability - Reads top-to-bottom as separate, labeled steps.&lt;/li&gt;
&lt;li&gt;Where it can go   - Defined once at the top, used anywhere in the main query below it.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In short, subqueries are fine for a quick, one-off check. CTEs are worth it once a query has more than one logical step and you want to name and follow each one.&lt;/p&gt;

&lt;h2&gt;
  
  
  Practical Examples: Why One Over the Other
&lt;/h2&gt;

&lt;p&gt;Each example below is a case where the subquery and CTE aren't just two ways of writing the same thing , one is actually a better fit, whether that's for speed or for readability.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Comparing every row against one single value&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Sometimes you need to compare every row against one specific value pulled from the same table. In our case we want to find everyone that beat Felix's score in the first test.&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%2Fjp1xxzak1v9smzwk1hq9.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%2Fjp1xxzak1v9smzwk1hq9.png" alt=" " width="716" height="307"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The plain subquery is shorter and works fine if you're only using the value once. The CTE is preferable if you need felix_score more than once in the same query (if you also want a score - felix_score as different column) naming it once avoids repeating the same subquery. For a single comparison, go with the subquery. Once you need that value more than once, pull it into a CTE.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Personal best score (correlated subquery vs. pre-aggregated CTE)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This is called a correlated subquery because the inner query refers back to the outer query's row (qs.member_id in our example). That means it re-runs once for every row in the outer query, not just once overall.&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%2Fwz6j7wbt404bt0hsni4f.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%2Fwz6j7wbt404bt0hsni4f.png" alt=" " width="638" height="288"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is the best case for when picking a CTE is the best option over a subquery. The correlated subquery reruns its max-score lookup for every single row  which is barely noticeable on a small table such as ours  but as the data sets get bigger the operation get considerably slower. The CTE calculates every member's best score in one pass with GROUP BY, then joins the results back thus one calculation is done instead of many.&lt;/p&gt;

&lt;h2&gt;
  
  
  Wrapping Up
&lt;/h2&gt;

&lt;p&gt;Three clear signs it's time to switch from a subquery to a CTE: you've written a correlated subquery that reruns for every row (pre-aggregate it instead), you're repeating the same subquery more than once in a query (name it once instead), or your query has several logical steps you want to keep readable. Outside of those cases, a short, one-time subquery is often the simpler choice.&lt;/p&gt;

</description>
      <category>backend</category>
      <category>database</category>
      <category>programming</category>
      <category>sql</category>
    </item>
    <item>
      <title>SQL JOINS Explained</title>
      <dc:creator>Sam Guantai</dc:creator>
      <pubDate>Tue, 15 Sep 2026 10:21:03 +0000</pubDate>
      <link>https://dev.to/sguantai/sql-joins-explained-4jn6</link>
      <guid>https://dev.to/sguantai/sql-joins-explained-4jn6</guid>
      <description>&lt;p&gt;Running into Joins can be one of the most daunting and confusing parts for anyone new to SQL. In this articles we will explore what they are, what types exist, when to use them and why they matter. Lets dive in,&lt;/p&gt;

&lt;h2&gt;
  
  
  What Are Joins?
&lt;/h2&gt;

&lt;p&gt;A join combines rows from two or more tables based on a related column between them. Relational databases like PostreSQL split data into separate tables to avoid duplication , so joins are how you stitch that data back together when you need it.&lt;/p&gt;

&lt;p&gt;For example, you might have a customers table and an orders table. Each order has a customer id that points back to a row in customers. A join lets you show each order along with the customer's name even though that information lives in two different tables.&lt;/p&gt;

&lt;p&gt;For our examples we will make two tables; &lt;br&gt;
A customers 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%2Fw9chek71pm0twlhuvjnw.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%2Fw9chek71pm0twlhuvjnw.png" alt=" " width="375" height="196"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;An orders 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%2Feg23a0gaz2p9bugbrks7.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%2Feg23a0gaz2p9bugbrks7.png" alt=" " width="483" height="203"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Types of Joins
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1. INNER JOIN&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Returns only the rows that have matching values in both tables. This is the default join type and the one you'll use most often.&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%2F1o95qdoa9fxz0cnkzlhu.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%2F1o95qdoa9fxz0cnkzlhu.png" alt=" " width="537" height="260"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You will notice that Charlie disappears (no orders) and order 4 disappears (no matching customer). Only rows present on &lt;strong&gt;both&lt;/strong&gt; sides survive.&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 and matching rows from the right table. If there's no match, the right side is filled with NULL.&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%2Fxbqs4zg4q91pfisv70pg.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%2Fxbqs4zg4q91pfisv70pg.png" alt=" " width="432" height="254"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this case Charlie shows up even though he has no orders.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. RIGHT JOIN (RIGHT OUTER JOIN)&lt;/strong&gt;&lt;br&gt;
This works as the reverse of the left join and returns all rows from the right table, plus matching rows from the left. Non-matches on the left become NULL.&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%2Fnz4vy8s2x86dk1jjd4it.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%2Fnz4vy8s2x86dk1jjd4it.png" alt=" " width="403" height="240"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Order 4 (Monitor) shows up with a NULL customer name, since customer_id = 5 doesn't exist.&lt;/p&gt;

&lt;p&gt;In a realistic setting, RIGHT JOIN is used far less often than LEFT JOIN  as most people just swap the table order and use LEFT JOIN instead, since it reads more naturally.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. FULL JOIN (FULL OUTER JOIN)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Returns all rows from both tables, matching where possible and filling NULL where there's no match on either side.&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%2Fsmmrk80mu1iug17876vr.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%2Fsmmrk80mu1iug17876vr.png" alt=" " width="416" height="269"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This gives you the complete picture where everyone and everything is matched where possible.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. CROSS JOIN&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Returns the Cartesian product of two tables. Every row from the first table paired with every row from the second. No ON clause is needed (or used).&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%2Fcd9i1apdhy77s6wgr7oh.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%2Fcd9i1apdhy77s6wgr7oh.png" alt=" " width="423" height="273"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is mostly useful for generating combinations. For example, a catalogue where every product size needs to be paired with every color available.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;6. SELF JOIN&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This is a table joined to itself. It is most commonly used for hierarchical or comparative data. For example an employees table where each row has a manager id pointing to another row in the same table.&lt;/p&gt;

&lt;h2&gt;
  
  
  So in summary
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;INNER JOIN&lt;/strong&gt;&lt;/em&gt;   -    You only want records that exist in both tables; orders that have a valid customer.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;LEFT JOIN&lt;/strong&gt;&lt;/em&gt;    -  You want everything from your "main" table, even if there's no related data; all customers, including ones who haven't ordered anything yet.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;RIGHT JOIN&lt;/strong&gt;&lt;/em&gt;   -    Rare in practice; usually rewritten as a LEFT JOIN with tables swapped.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;FULL JOIN&lt;/strong&gt;&lt;/em&gt;    -    You need to see unmatched records from both sides; auditing data to find empty rows on either side.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;CROSS JOIN&lt;/strong&gt;&lt;/em&gt;   -    You deliberately need every combination of two sets.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;SELF JOIN&lt;/strong&gt;&lt;/em&gt;    -    Your table references itself; organization charts  "who reports to whom."&lt;/p&gt;

&lt;h2&gt;
  
  
  Wrapping Up
&lt;/h2&gt;

&lt;p&gt;Joins are the backbone of relational SQL. The best way to really internalize these examples is to do them for yourself, load in a couple of small tables like the ones above and run these queries. Seeing it all come together based on the JOIN used really helps to simplify the concept and the use cases become obvious.&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>database</category>
      <category>sql</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Introduction to SQL</title>
      <dc:creator>Sam Guantai</dc:creator>
      <pubDate>Mon, 20 Jul 2026 00:33:36 +0000</pubDate>
      <link>https://dev.to/sguantai/introduction-to-sql-3mmj</link>
      <guid>https://dev.to/sguantai/introduction-to-sql-3mmj</guid>
      <description>&lt;p&gt;Starting SQL can feel daunting. It might seem like an entirely new language being thrown at you, but after approaching the core ideas it becomes relatively simple to understand. Lets start with a few definitions.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Server&lt;/strong&gt; - This is the actual software process (like PostgreSQL or MySQL) running on a machine.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Database&lt;/strong&gt; - It's an organized collection of data structured to be easily accessed, managed, and updated.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Schema&lt;/strong&gt; - an organizational layer within a database, used to group related tables together.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Data&lt;/strong&gt; - This is raw, unorganized facts and figures and can come in various formats such as numbers, text or images&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;DBMS (Database Management System)&lt;/strong&gt; - is the software that enables users to create, manage, and interact with databases. 
Some of the most common relational DBMS options you'll encounter are:
MySQL,
PostgreSQL,
Microsoft SQL Server&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  So What Is SQL Anyway?
&lt;/h2&gt;

&lt;p&gt;SQL (Structured Query Language) is a standard language used to communicate with relational databases. Put simply, it's how we talk to a database  and how we ask it to store, change, or hand back information.&lt;br&gt;
It is further divided into sub-languages based on the exact action needed to be performed on the database. In this article we will tackle the three first and most basic sub-languages&lt;/p&gt;

&lt;h3&gt;
  
  
  DDL - Data Definition Language
&lt;/h3&gt;

&lt;p&gt;DDL commands deal with the structure of the database. This includes creating, changing or deleting the table.&lt;br&gt;
Key commands: CREATE, ALTER, DROP&lt;/p&gt;

&lt;h3&gt;
  
  
  DML - Data Manipulation Language
&lt;/h3&gt;

&lt;p&gt;DML commands deal with the records inside the database. They modify the data without changing the structure of the table itself.&lt;br&gt;
Key commands: INSERT, UPDATE, DELETE&lt;/p&gt;

&lt;h3&gt;
  
  
  DQL - Data Query Language
&lt;/h3&gt;

&lt;p&gt;DQL command deals with reading the data inside the database. It ask questions of the data without changing anything about the data or the structure of the database.&lt;br&gt;
Key command:  SELECT&lt;/p&gt;

&lt;h2&gt;
  
  
  Data Types
&lt;/h2&gt;

&lt;p&gt;Every column in a table needs a defined data type, this decides what kind of value that column can hold. Picking the right one keeps your data both accurate and efficient.&lt;/p&gt;

&lt;h3&gt;
  
  
  Numbers
&lt;/h3&gt;

&lt;p&gt;INT — a whole number&lt;br&gt;
NUMERIC / DECIMAL — numbers with fixed decimal places (useful for prices, where rounding errors are unacceptable)&lt;br&gt;
SERIAL — a number PostgreSQL generates automatically for you, usually used for IDs&lt;/p&gt;

&lt;h3&gt;
  
  
  Text
&lt;/h3&gt;

&lt;p&gt;CHAR(n) — for text that is always exactly n characters (e.g., a 10-digit phone number stored as a fixed-length code)&lt;br&gt;
VARCHAR(n) — for text up to n characters (variable length, up to a maximum of n)&lt;br&gt;
TEXT — for text with no fixed length limit&lt;/p&gt;

&lt;h3&gt;
  
  
  Date &amp;amp; Time
&lt;/h3&gt;

&lt;p&gt;DATE — stores a date only&lt;br&gt;
TIME — stores a time only&lt;br&gt;
TIMESTAMP — stores both date and time together&lt;/p&gt;

&lt;h3&gt;
  
  
  Boolean
&lt;/h3&gt;

&lt;p&gt;BOOLEAN — only two possible values: true or false&lt;/p&gt;

&lt;h2&gt;
  
  
  Constraints
&lt;/h2&gt;

&lt;p&gt;Constraints are rules applied to columns or tables to limit the type of data that can be inserted, updated, or deleted. They're your first line of defense against messy, inconsistent data.&lt;/p&gt;

&lt;p&gt;NOT NULL — the column can never be left empty&lt;br&gt;
DEFAULT(value) — if nothing is given, this value is used automatically&lt;br&gt;
UNIQUE — no two rows may share the same value in this column (e.g., two customers can't share one email address)&lt;br&gt;
PRIMARY KEY — uniquely identifies each row in a table; it's essentially a combination of NOT NULL and UNIQUE&lt;br&gt;
FOREIGN KEY — a column whose values must already exist as a primary key somewhere else; this is how tables link to each other&lt;br&gt;
CHECK — a custom rule the value must pass, e.g., price &amp;gt; 0&lt;/p&gt;

&lt;h2&gt;
  
  
  Building A School Database
&lt;/h2&gt;

&lt;p&gt;Lets build a database including what we have learned and exploring new ideas in querying, filtering and updating.&lt;/p&gt;

&lt;h3&gt;
  
  
  Creating the table
&lt;/h3&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%2Fgknjq1162fdzkpuz1062.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%2Fgknjq1162fdzkpuz1062.png" alt=" " width="358" height="43"&gt;&lt;/a&gt;&lt;br&gt;
The SET SEARCH_PATH command ensures the data we input is sent to the relevant schema. Alternatively you can refer to the schema every time you reference the table you're working on e.g FROM greenwood_academy.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%2Fm31enih10fwbhne8ft6j.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%2Fm31enih10fwbhne8ft6j.png" alt=" " width="505" height="148"&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%2Fx00nyj4dxblfo2wasg6x.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%2Fx00nyj4dxblfo2wasg6x.png" alt=" " width="361" height="122"&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%2Fle81tsgh16k7e7pld7yw.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%2Fle81tsgh16k7e7pld7yw.png" alt=" " width="409" height="131"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Altering the table
&lt;/h3&gt;

&lt;p&gt;Tables are rarely perfect on the first try. ALTER TABLE is DDL's way of letting you change a table's structure without dropping and recreating it.&lt;/p&gt;

&lt;p&gt;Adding a column - the school forgot to capture phone numbers: &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%2F2h6zkava3x7uujuhxfhc.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%2F2h6zkava3x7uujuhxfhc.png" alt=" " width="334" height="45"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Renaming a column - if credit should really be called credit_hours: &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%2Fb2hi8wd9n6ac3n6h6s4s.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%2Fb2hi8wd9n6ac3n6h6s4s.png" alt=" " width="319" height="49"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Dropping a column - if phone_number turns out not to be needed after all:&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%2Ft2hyuq5117xl0g6s3tw1.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%2Ft2hyuq5117xl0g6s3tw1.png" alt=" " width="310" height="43"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Fixing and Removing Data
&lt;/h3&gt;

&lt;p&gt;Once rows exist, DML gives you three tools: INSERT to input the values, UPDATE to correct existing rows and DELETE to remove them.&lt;/p&gt;

&lt;p&gt;INSERT adds the values to the table following the constraints put while building the tables.&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%2Fgp6iz6oz73v8y91u8t1m.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%2Fgp6iz6oz73v8y91u8t1m.png" alt=" " width="785" height="391"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;UPDATE changes the value of one or more columns in rows that match a condition:&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%2Fym8jk1x0hip10snwle73.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%2Fym8jk1x0hip10snwle73.png" alt=" " width="309" height="54"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;DELETE removes whole rows that match a condition:&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%2Fg1jpqwwz8q5wdi88e475.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%2Fg1jpqwwz8q5wdi88e475.png" alt=" " width="299" height="34"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Disclaimer&lt;/strong&gt;:The WHERE clause is doing critical work in every one of these statements. Leave it off an UPDATE or DELETE, and you'll change or remove every row in the table. Always double-check your WHERE clause before running either of these.&lt;/p&gt;

&lt;h3&gt;
  
  
  Filtering Rows with WHERE
&lt;/h3&gt;

&lt;p&gt;WHERE is how you narrow a SELECT down to only the rows you care about, using comparison operators (=, !=, &amp;gt;, &amp;lt;, &amp;gt;=, &amp;lt;=) and logical operators (AND, OR, NOT) to combine conditions.&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%2Fxfh4qidxg72eqpiwebk1.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%2Fxfh4qidxg72eqpiwebk1.png" alt=" " width="800" height="351"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;AND narrows your results (every condition must hold), while OR widens them (any condition can hold), mixing the two up is one of the most common beginner mistakes in SQL.&lt;/p&gt;

&lt;h3&gt;
  
  
  Range, Membership, and Pattern Matching
&lt;/h3&gt;

&lt;p&gt;Beyond basic comparisons, SQL gives you a few operators purpose-built for common filtering patterns.&lt;/p&gt;

&lt;p&gt;BETWEEN checks whether a value falls within an inclusive range. This mostly used for both numbers and dates:&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%2Fzfsful0jghjbl7zj6czl.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%2Fzfsful0jghjbl7zj6czl.png" alt=" " width="735" height="165"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;IN and NOT IN check membership against a list of values, saving you from writing a long chain of OR conditions:&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%2Fadbmbqs77r7jhm2faxkf.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%2Fadbmbqs77r7jhm2faxkf.png" alt=" " width="718" height="183"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;LIKE matches text patterns using % as a wildcard for any number of characters:&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%2Fv52oe2pyzizbrdj40ma0.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%2Fv52oe2pyzizbrdj40ma0.png" alt=" " width="800" height="167"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Note the % on both sides of 'Studies' in that last query: %Studies% matches the word anywhere in the name, while %Studies (with only a leading %) would only match names that end in "Studies"&lt;/p&gt;

&lt;h3&gt;
  
  
  Summarizing Data with COUNT
&lt;/h3&gt;

&lt;p&gt;COUNT is an aggregate function — instead of returning individual rows, it returns a single number summarizing how many rows matched. Giving the result a readable alias with AS (like form3_students) makes the output much easier to interpret than a column literally named count.&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%2Fzulukxt68amtdut4g506.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%2Fzulukxt68amtdut4g506.png" alt=" " width="570" height="175"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Adding Conditional Logic with CASE WHEN
&lt;/h3&gt;

&lt;p&gt;Sometimes you want a query to label rows based on a condition, without writing separate queries for each case. CASE WHEN works like an if/else chain, evaluated top to bottom for each row, and lets you create a new derived column right inside your SELECT.&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%2Fn4ip39xwi4jctpnd7etl.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%2Fn4ip39xwi4jctpnd7etl.png" alt=" " width="800" height="445"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Something to note from the above examples, CASE WHEN checks conditions in order and stops at the first match, so put your most specific conditions first (marks &amp;gt;= 80 is checked before marks &amp;gt;= 60).&lt;/p&gt;

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

&lt;p&gt;SQL can feel like a lot of new vocabulary at first, but it boils down to a few core ideas: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A server hosts databases, which are organized into schemas.&lt;/li&gt;
&lt;li&gt;A DBMS is the software managing all of this.&lt;/li&gt;
&lt;li&gt;SQL is how you talk to it, split into sub-languages including DDL (structure), DML (data changes) and DQL (reading data).&lt;/li&gt;
&lt;li&gt;Data types define what a column can hold, and constraints define what values are actually allowed in.&lt;/li&gt;
&lt;li&gt;ALTER TABLE lets a schema evolve after tables already exist by adding, renaming, or dropping columns.&lt;/li&gt;
&lt;li&gt;UPDATE and DELETE modify or remove existing rows, always guided by a WHERE clause.&lt;/li&gt;
&lt;li&gt;WHERE, combined with comparison and logical operators, is how you filter a SELECT down to exactly the rows you need.&lt;/li&gt;
&lt;li&gt;BETWEEN, IN/NOT IN, and LIKE handle ranges, lists, and text patterns.&lt;/li&gt;
&lt;li&gt;COUNT summarizes matching rows into a single number, and CASE WHEN lets a query label rows with its own conditional logic.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;With just CREATE TABLE, INSERT, and SELECT, you already have enough to build and query a real relational database — and with ALTER TABLE, UPDATE, DELETE, WHERE, and CASE WHEN in your toolkit, you can maintain that database and ask real questions of it.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Connecting SQL Databases to Power BI</title>
      <dc:creator>Sam Guantai</dc:creator>
      <pubDate>Mon, 06 Jul 2026 00:09:33 +0000</pubDate>
      <link>https://dev.to/sguantai/connecting-sql-databases-to-power-bi-2k9l</link>
      <guid>https://dev.to/sguantai/connecting-sql-databases-to-power-bi-2k9l</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;In any organization, Data is one of the most important assets. With Power BI we are able to turn the raw information into useful and actionable insights. By connecting SQL databases to Power BI, businesses can seamlessly access, analyze, and visualize data stored in their relational databases without the need for manual exports or complex reporting processes. Thus this integration process is an important skill for a data analyst to have. In this article, we'll explore how to connect SQL databases to Power BI and the different connection options available.&lt;/p&gt;

&lt;h3&gt;
  
  
  a few prerequisites
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;PostgreSQL installed and running &lt;/li&gt;
&lt;li&gt;An Aiven account with a running PostgreSQL stream.&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%2F0hr6vgdoywu81r8xx65b.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%2F0hr6vgdoywu81r8xx65b.png" alt=" " width="797" height="116"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;DBeaver - An open source, data management tool&lt;/li&gt;
&lt;li&gt;PowerBI Desktop&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Local Database
&lt;/h2&gt;

&lt;p&gt;This is a storage system that exists on your device or a local network as opposed to a remote cloud server&lt;/p&gt;

&lt;h3&gt;
  
  
  Step One
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Open DBeaver, Click on &lt;strong&gt;Database&lt;/strong&gt; and establish a new database connection (PostgreSQL).&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%2F9mcqqg4uvnhimnz7gcs2.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%2F9mcqqg4uvnhimnz7gcs2.png" alt=" " width="699" height="401"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Fill in the required information.&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%2Fe1yymttpudej05g83ujo.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%2Fe1yymttpudej05g83ujo.png" alt=" " width="555" height="606"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Ensure you test the connection before finishing. Any errors can be detected and fixed at this point.&lt;/li&gt;
&lt;li&gt;Inside the new database you can create a new schema where the imported data will go.
&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%2Fmmy1d5qadicpgkwz6h70.png" alt=" " width="497" height="684"&gt;
&lt;/li&gt;
&lt;li&gt;Select &lt;strong&gt;Input file(s)&lt;/strong&gt; then &lt;strong&gt;Browse&lt;/strong&gt;. Find the relevant data on your device and then click &lt;strong&gt;Proceed&lt;/strong&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%2Fpb24n8krly6xqnm82qx4.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%2Fpb24n8krly6xqnm82qx4.png" alt=" " width="800" height="513"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Step Two
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Launch Power BI&lt;/li&gt;
&lt;li&gt;Go to &lt;strong&gt;Home&lt;/strong&gt;, then &lt;strong&gt;Get Data&lt;/strong&gt; &amp;gt; &lt;strong&gt;More...&lt;/strong&gt; &amp;gt; &lt;strong&gt;Database&lt;/strong&gt; and select &lt;strong&gt;PostgreSQL database&lt;/strong&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%2F78zfu8otnf2rk3wyfcsw.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%2F78zfu8otnf2rk3wyfcsw.png" alt=" " width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You will be prompted to fill in the Server and database details.&lt;/li&gt;
&lt;li&gt;Enter your Username and password when prompted and connect. &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%2Fl16ux6ej3j7piagiinpc.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%2Fl16ux6ej3j7piagiinpc.png" alt=" " width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Preview your data and load it into Power BI.&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%2Fvcd85qc21l47aa6qqqlx.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%2Fvcd85qc21l47aa6qqqlx.png" alt=" " width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Cloud-Based SQL Database
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Step One
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;In this case you will repeat all the steps as you did with the local database but the details required when setting up a new connection will be sourced from Aiven. &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%2Fjypu5dvvpmg81scfukt6.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%2Fjypu5dvvpmg81scfukt6.png" alt=" " width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Follow the same steps from the Local database section to create and import the data.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Step Two
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Download the CA certificate provided in the Aiven account.&lt;/li&gt;
&lt;li&gt;Go to your search bar and find the manage user certificates.&lt;/li&gt;
&lt;li&gt;Follow these steps; &lt;strong&gt;Trusted Root Certification&lt;/strong&gt; &amp;gt; &lt;strong&gt;Certificates&lt;/strong&gt; (right click) &amp;gt; &lt;strong&gt;Import&lt;/strong&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%2Fhma5lfsci58u1v94h2hd.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%2Fhma5lfsci58u1v94h2hd.png" alt=" " width="632" height="454"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Browse your files and find the certificate.&lt;/li&gt;
&lt;li&gt;Press next on the wizard prompts till the end and Finish&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%2F24oeim7x2gd3b5l6edgn.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%2F24oeim7x2gd3b5l6edgn.png" alt=" " width="592" height="528"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Step Three
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Launch Power BI&lt;/li&gt;
&lt;li&gt;Go to &lt;strong&gt;Home&lt;/strong&gt;, then &lt;strong&gt;Get Data&lt;/strong&gt; &amp;gt; &lt;strong&gt;More...&lt;/strong&gt; &amp;gt; &lt;strong&gt;Database&lt;/strong&gt; and select &lt;strong&gt;PostgreSQL database&lt;/strong&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%2Fc04zrkct98vtce8i5xp4.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%2Fc04zrkct98vtce8i5xp4.png" alt=" " width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Enter the connection details from Aiven&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%2Fztaur6ib1p3vt06ju142.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%2Fztaur6ib1p3vt06ju142.png" alt=" " width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Enter your Username and Password.&lt;/li&gt;
&lt;li&gt;Select the table you want and proceed with cleaning or analysis.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;And its that simple! As data continues to grow in importance, leveraging SQL databases and Power BI together provides a powerful foundation for effective analytics and reduces instances of error that is common when manually handling data.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Exploring Excel.</title>
      <dc:creator>Sam Guantai</dc:creator>
      <pubDate>Sat, 06 Jun 2026 22:38:55 +0000</pubDate>
      <link>https://dev.to/sguantai/exploring-excel-5bh</link>
      <guid>https://dev.to/sguantai/exploring-excel-5bh</guid>
      <description>&lt;p&gt;Microsoft Excel is a spreadsheet application used to organize, calculate, analyze, and visualize data. It allows users to store large amounts of information in rows and columns, perform calculations using formulas, and create charts and reports. In most computerized workplaces worldwide, Excel is far and away the most used application. A relatively low barrier of entry means that even the most green of workers can learn to at the very least use it as a tool for organizing company data.&lt;/p&gt;

&lt;h2&gt;
  
  
  Excel in real world data analytics
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;A majority of small to mid sized businesses rely on the insight provided by the data analyzed through Excel. A small workforce is able to analyze large amounts of data that would otherwise require a large workforce or take immense amounts of time. With the correct formulas and visualization tools the data can be used to provide a better picture into trends and even performance of employees or products that the business handles.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The IF function is particularly useful in this area because it allows businesses to automatically categorize or evaluate data based on specific conditions. For example, a company could use:&lt;/p&gt;

&lt;p&gt;=IF(B2&amp;gt;=1000,"Target Met","Target Not Met") &lt;/p&gt;

&lt;p&gt;to quickly determine whether a salesperson has achieved their sales target. This saves time, reduces errors, and makes it easier to identify areas that need attention.&lt;/p&gt;

&lt;p&gt;-Excel is one of the most widely used tools for financial reporting and budgeting in businesses of all sizes. Accountants and financial analysts use it to record income and expenses, create detailed budgets, calculate profits and losses, and prepare financial statements. By organizing financial data into spreadsheets, companies can easily track where money is being spent and compare actual results against planned budgets.&lt;/p&gt;

&lt;p&gt;The SUM function is particularly useful for accountants who need to balance the books and ensure that all expenses are accurately recorded. For example, if employee salaries are listed in Column B and utility expenses are listed in Column D, an accountant can calculate the total spending on both categories using the formula:&lt;/p&gt;

&lt;p&gt;=SUM(B2:B20,D2:D20)&lt;/p&gt;

&lt;p&gt;This formula adds together all salary and utility expenses for the accounting period, providing a combined total. By comparing this total against the company's budget or revenue, the accountant can quickly assess whether spending is within acceptable limits and identify any discrepancies that may require further investigation.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Marketing teams use Excel to evaluate the success of advertising campaigns and promotional activities. Data such as website visits, social media engagement, customer responses, and sales conversions can be organized and analyzed in spreadsheets. By identifying which campaigns generate the best results, marketers can focus their resources on the most effective strategies and improve future campaigns.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Conditional Formatting is particularly useful in marketing analysis because it allows important trends and performance indicators to stand out visually. For example, a marketing manager tracking campaign conversion rates could highlight high-performing campaigns in green and low-performing ones in red.&lt;/p&gt;

&lt;h2&gt;
  
  
  Thoughts one week in...
&lt;/h2&gt;

&lt;p&gt;As a person who had only used Excel a handful of times before it has been quite an adventure to discover exactly how powerful a little green app on most computers can be. A single worksheet can tell the entire story of an enterprise and what seemed like a daunting amount of data can be analyzed and meaningfully presented in only a few, properly executed commands. I'm quite excited to see how much improvement I can notice in my own analysis in the coming weeks.&lt;/p&gt;

</description>
      <category>analytics</category>
      <category>data</category>
      <category>microsoft</category>
      <category>productivity</category>
    </item>
  </channel>
</rss>
