Limiting results

Introduction to SQL with AI

Jasmin Ludolf

Senior Data Science Content Developer

LIMIT

$$

  • Controls how many records are returned
  • Faster queries
  • Useful with large tables
Introduction to SQL with AI

LIMIT

Prompt: Show me the first five products from the products table

Introduction to SQL with AI

LIMIT

Prompt: Show me the first five products from the products table

SELECT product_name
FROM products
LIMIT 5;
|product_name|
|------------|
|      Laptop|
|     Desktop|
|      Gaming|
|       Mouse|
|    Keyboard|
  • Use for: exploring unfamiliar data, or testing logic and ideas
Introduction to SQL with AI

SQL flavors

PostgreSQL

SELECT product_name
FROM products
LIMIT 5;
|product_name|
|------------|
|      Laptop|
|     Desktop|
|      Gaming|
|       Mouse|
|    Keyboard|

SQL Server

SELECT TOP 5 product_name
FROM products;
|product_name|
|------------|
|      Laptop|
|     Desktop|
|      Gaming|
|       Mouse|
|    Keyboard|
Introduction to SQL with AI

SQL flavors

Prompt: Show me the first 2 customers using SQL Server

SELECT TOP 2 name
FROM customer;
|name    |
|--------|
|Madison |
|Giovanni|

$$

  • AI handles differences for us

$$

  • AI assistant may know the flavor

$$

  • Can ask AI to convert flavors
Introduction to SQL with AI

Learning flavors

Person with laptop and a bright bulb above their head

  • Differences are minor
  • Concepts and logic the same across flavors
  • Use AI to work with different flavors
Introduction to SQL with AI

Let's practice!

Introduction to SQL with AI

Preparing Video For Download...