Introduction to SQL with AI
Jasmin Ludolf
Senior Data Science Content Developer
$$
SELECT
: what to showFROM
: where to lookQuery:
SELECT product_name
FROM products;
Result set:
|product_name|
|------------|
| Laptop |
| Desktop |
| Gaming |
...
Prompt: What are the product names?
SELECT product_name
FROM products;
|product_name|
|------------|
| Laptop |
| Desktop |
| Gaming |
...
Prompt: Show the product_name field from the products table
SELECT product_name
FROM products;
|product_name|
|------------|
| Laptop |
| Desktop |
| Gaming |
...
Prompt: Show me everything from the products table
SELECT product_id, product_name, category, unit_price, unit_cost
FROM product;
|product_id|product_name|category |unit_price|unit_cost|
|----------|------------|---------|----------|---------|
|100 |Laptop |Computing|649.99 |420 |
|101 |Desktop |Computing|749.99 |480 |
|102 |Gaming |Computing|1099.99 |800 |
|103 |Mouse |Computing|19.99 |8 |
...
Prompt: Show me everything from the products table
SELECT *
FROM product;
|product_id|product_name|category |unit_price|unit_cost|
|----------|------------|---------|----------|---------|
|100 |Laptop |Computing|649.99 |420 |
|101 |Desktop |Computing|749.99 |480 |
|102 |Gaming |Computing|1099.99 |800 |
|103 |Mouse |Computing|19.99 |8 |
...
*
wildcard: "select all"*
for quick explorationPrompt: Show the name and category for each product
SELECT product_name, category
FROM products;
|product_name|category |
|------------|---------|
| Laptop |Computing|
| Desktop |Computing|
| Gaming |Computing|
...
$$
Introduction to SQL with AI