Explore with division
In exploring a new database, it can be unclear what the data means and how columns are related to each other.
What information does the unanswered_pct column in the stackoverflow table contain? Is it the percent of questions with the tag that are unanswered (unanswered ?s with tag/all ?s with tag)? Or is it something else, such as the percent of all unanswered questions on the site with the tag (unanswered ?s with tag/all unanswered ?s)?
Divide unanswered_count (unanswered ?s with tag) by question_count (all ?s with tag) to see if the value matches that of unanswered_pct to determine the answer.
Latihan ini adalah bagian dari kursus
Exploratory Data Analysis in SQL
Petunjuk latihan
- Exclude rows where
question_countis 0 to avoid a divide by zero error. - Limit the result to 10 rows.
Latihan interaktif praktis
Cobalah latihan ini dengan menyelesaikan kode contoh berikut.
-- Divide unanswered_count by question_count
SELECT ___/___::___ AS computed_pct,
-- What are you comparing the above quantity to?
___
FROM stackoverflow
-- Select rows where question_count is not 0
WHERE ___ ___ ___
___ ___;