Your question is Pandas Conditional Labeling. Start with the requirements and the one table on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Impact Analytics is preparing workforce profile data for an internal segmentation report. Write a PostgreSQL query that classifies each profile according to age.
Write a SQL query to return every profile's id, original age, and a new age_group column. The age_group must be major when age is greater than 18. Otherwise, it must be minor. Treat ages of exactly 18, negative test values, and NULL ages as minor because they do not satisfy the greater-than condition.
CASE WHEN expression to create age_group.id in ascending order.| Column | Type | Description |
|---|---|---|
| idPK | INTEGER | Unique workforce profile identifier |
| age | INTEGER | Profile age, which may be NULL |