AI ile Orta Düzey SQL Sorgulama
Jasmin Ludolf
Senior Data Science Content Developer
|duration|
|--------|
|123 |
|110 |
|151 |
...
"Kısa", "Standart", "Epik" olarak kategorize edin
duration > 90: evet veya hayır
Koşullu mantık kullanın

İpucu: Filmleri 90 dakikanın altındaysa Kısa, 150'nin altındaysa Standart, aksi takdirde Epik olarak kategorize edin
SELECT
id,
title,
duration,
CASE
WHEN duration < 90 THEN 'Short'
WHEN duration < 150 THEN 'Standard'
ELSE 'Epic'
END AS film_category
FROM films;
İpucu: Filmleri 90 dakikanın altındaysa Kısa, 150'nin altındaysa Standart, aksi takdirde Epik olarak kategorize edin
SELECT
id,
title,
duration,
CASE
WHEN duration < 150 THEN 'Standard'
WHEN duration < 90 THEN 'Short'
ELSE 'Epic'
END AS film_category
FROM films;
$$
İpucu: Filmleri 90 dakikanın altındaysa Kısa, 90 ile 149 dakika arasındaysa Standart, 150 dakika veya daha fazlaysa Epik, aksi takdirde bilinmeyen olarak kategorize edin
SELECT
id,
title,
duration,
CASE
WHEN duration < 90 THEN 'Short'
WHEN duration BETWEEN 90 AND 149 THEN 'Standard'
WHEN duration >= 150 THEN 'Epic'
ELSE 'Unknown'
END AS category
FROM films;
$$
|id|title |duration|category|
|--|------------------------------------------------|--------|--------|
|1 |Intolerance: Love's Struggle Throughout the Ages|123 |Standard|
|2 |Over the Hill to the Poorhouse |110 |Standard|
|3 |The Big Parade |151 |Epic |
|4 |Metropolis |145 |Standard|
...
|id |title |duration|category|
|----|-------|--------|--------|
|4396|Destiny| |Unknown |
...
İpucu: NULL süreleri kaldırın
SELECT id, title, duration, CASE WHEN duration < 90 THEN 'Short' WHEN duration BETWEEN 90 AND 149 THEN 'Standard' WHEN duration >= 150 THEN 'Epic' ELSE 'Unknown' END AS category FROM filmsWHERE duration IS NOT NULL;
$$
$$
$$

AI ile Orta Düzey SQL Sorgulama