Data tellen

Introductie tot SQL-query's met AI

Jasmin Ludolf

Senior Data Science Content Developer

De COUNT-functie

Prompt: Hoeveel producten hebben we?

SELECT COUNT(*) AS total_count
FROM products;
|total_count|
|-----------|
|50         |
Introductie tot SQL-query's met AI

De COUNT-functie

Prompt: Hoeveel producten hebben we?

SELECT COUNT(*)
FROM products;
|?count?|
|-------|
|50     |
Introductie tot SQL-query's met AI

De COUNT-functie

Prompt: Tel het aantal rijen in de productentabel

SELECT COUNT(*) AS total_count
FROM products;
|total_count|
|-----------|
|50         |
Introductie tot SQL-query's met AI

Records of waarden tellen

Prompt: Hoeveel producten hebben we?

SELECT COUNT(*) AS total_count
FROM products;
|total_count|
|-----------|
|50         |
  • Telt elke record in de tabel

Prompt: Hoeveel productnamen hebben we?

SELECT COUNT(product_name) AS product_count
FROM products;
|product_count|
|-------------|
|49           |
  • Telt alleen records met een waarde
Introductie tot SQL-query's met AI

Unieke waarden tellen

Prompt: Hoeveel verschillende categorieën verkopen we?

SELECT COUNT(DISTINCT category) AS unique_categories
FROM products;
|unique_categories|
|-----------------|
|9                |
Introductie tot SQL-query's met AI

Samenvatting

$$

  • Voor COUNT(*):
    • "Hoeveel records" of "hoeveel rijen"
  • Voor COUNT(veld):
    • "Hoeveel productnamen" of "hoeveel klanten"
  • "Verschillende," "unieke," of "distinct" toevoegen geeft DISTINCT

Persoon aan tafel met laptop

Introductie tot SQL-query's met AI

Laten we oefenen!

Introductie tot SQL-query's met AI

Preparing Video For Download...