<?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>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>
