testsAndMisc/python_pkg/sql_drills/fixtures/12_concat_percent/DOCS-task.md
Krzysztof kuhy Rudnicki ee78ae44cc
Some checks are pending
dependency freshness / dependencies on newest stable (push) Waiting to run
md-naming / markdown naming convention (push) Waiting to run
Pre-commit checks / pre-commit (${{ matrix.group }}) (mypy, mypy) (push) Waiting to run
Pre-commit checks / pre-commit (${{ matrix.group }}) (pylint, pylint) (push) Waiting to run
Pre-commit checks / pre-commit (${{ matrix.group }}) (rest, ) (push) Waiting to run
Pre-commit checks / pre-commit (${{ matrix.group }}) (shellcheck, shellcheck) (push) Waiting to run
Python tests / test (push) Waiting to run
repo-contract / repo contract (push) Waiting to run
Shell tests / shell-tests (push) Waiting to run
Shell tests / lib-tests (push) Waiting to run
Shell tests / arch-tests (push) Waiting to run
Add sql_drills MySQL exact-match harness
Docker mysql:8.0.33 container, judge-style output grading, 12 original drills with live-verified references kept in tests only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WzxdWZewj4WS5X6AZyjWDp
2026-11-01 21:13:18 +01:00

515 B

CONCAT and percentage formatting

poll_votes has the vote count per option for several polls. For each option print its share of its own poll's votes with one decimal.

Output columns (no header): poll_id, then text like Red: 42.9%.

  • Order by poll_id, then votes descending, then option name ascending.
  • A share of exactly 50 prints 50.0% and zero prints 0.0%.
  • Trap: ROUND(x, 1) keeps the trailing .0 only on a DECIMAL, so do the arithmetic in decimal, not by dividing integers with DIV.