Write a SQL query to find the top three highest-performing Applied Materials manufacturing tools per day based on sensor uptime, handling ties appropriately.
Use valid sensor readings only, and define daily uptime as total uptime seconds divided by total monitored seconds for each tool. Include only active tools. Ties should share the same rank, so a day may return more than three tools.
Output
- One row per qualifying tool and day with columns
day, tool_id, tool_name, site_name, uptime_pct, and performance_rank.
- Include only ranks 1 through 3, ordered by day, rank, decreasing uptime percentage, and tool ID.