Problem · Database
Test Execution Success Rate
Problem statement
The table test_results stores test-result strings. Compare values case-insensitively.
trueis a successful valid result.falseis an unsuccessful valid result.nulland strings containing only whitespace are ignored.
Return one column, success_rate, equal to 100 * true_count / valid_count, rounded to two decimal places. If valid_count is 0, return 0.00. An exact halfway value rounds up.
Input table
| Column | Meaning |
|---|---|
result_position | One-based input position |
result_value | Case-insensitive test-result string |
Table schema
MySQLPostgreSQLPandas
Use the same input data with any supported language. Open the Schema tab in the editor to see the generated SQL setup or Pandas DataFrames.
test_results
One row per test execution result.
| Column | Type | Nullable | Description |
|---|---|---|---|
| result_positionPK | Integer | No | — |
| result_value | Text | No | — |
Expected result
Your query or function must return these columns.
| Column | Type | Nullable | Description |
|---|---|---|---|
| success_rate | Decimal | No | Percentage rounded to two decimal places. |
Row order: must match exactly. Numeric tolerance: 0.
Constraints
- The
test_resultstable has between1and10^5rows. result_positionis unique and non-null.result_valueis non-null and is a case variant oftrue,false, ornull, or it contains only whitespace.