TiDB Cloud Logo
TiDB LogoSign up for free
Time range
-- It is a particularly resource-intensive analytical query.
-- The events table generates an average of 1.8 million records per day.
SELECT (
      COUNT(CASE WHEN event_type = 'purchase' THEN 1 ELSE NULL END) /
      COUNT(CASE WHEN event_type = 'view' THEN 1 ELSE NULL END)
  ) AS bought_rate
FROM events
WHERE event_time >= '${start_time}'
    AND event_time <= '${end_time}'
MySQL RDS
your results will display here
TiDB Logo
TiDB Cloud Serverless
your results will display here

Copyright © PingCAP 2024.