Unique data

Introduction to SQL with AI

Jasmin Ludolf

Senior Data Science Content Developer

Business questions

$$

What are our product names?

Where are our customers from?

How many products do we have?

How many countries do we work with?

Person sitting on a laptop with an upwards chart and rocket

Introduction to SQL with AI

An impractical approach

SELECT product_name, category
FROM products;
|product_name|category |
|------------|---------|
|Laptop      |Computing|
|Desktop     |Computing|
|Gaming      |Computing|
...
Introduction to SQL with AI

Introducing DISTINCT: implied prompt

Prompt: What categories are in the products table?

SELECT DISTINCT category
FROM products;
|         category         |
|--------------------------|
|Audio                     |
|Computing                 |
|Home Climate & Air Quality|
|Laundry & Cleaning        |
|Kitchen Appliances        |
|Gaming                    |
|Mobile & Accessories      |
|Smart Home                |
|Office Equipment          |
Introduction to SQL with AI

Introducing DISTINCT: direct prompt

Prompt: What different product categories do we sell?

SELECT DISTINCT category
FROM products;
|         category         |
|--------------------------|
|Audio                     |
|Computing                 |
|Home Climate & Air Quality|
|Laundry & Cleaning        |
|Kitchen Appliances        |
|Gaming                    |
|Mobile & Accessories      |
|Smart Home                |
|Office Equipment          |
Introduction to SQL with AI

Unique pairs

Prompt: What unique combinations of category and product name do we have?

SELECT DISTINCT product_name, category
FROM products;
|product_name        |      category      |
|--------------------|--------------------|
|Dishwasher          |Kitchen Appliances  |
|Wireless Mouse      |Computing           |
|Gaming Console      |Gaming              |
|Bluetooth Headphones|Mobile & Accessories|
|Refrigerator        |Kitchen Appliances  |
...
Introduction to SQL with AI

In industry

      What suppliers do we work with in each region?

Retail and HR industry illustrations

                                                                              What job titles exist in our company?

Introduction to SQL with AI

The DISTINCT tool

$$

  • Words to signal the DISTINCT keyword:
    • "unique"
    • "different"
    • "distinct"

$$

  • What categories are in the table?

$$

Happy person working on a laptop

Introduction to SQL with AI

Let's practice!

Introduction to SQL with AI

Preparing Video For Download...