Schemac
Enhance your Data Teams' Performance
Intuitive UI
Explore your database with our powerful yet simple interface, designed for both technical and non-technical users.
What are the columns related to total cost?
TOTALCOST_LTCANDCM: Includes long-term care and case management.
TOTALCOST_WITHOPDP: Includes ontario public drug program costs.
Calculate the average total cost for the top 1% of users in each region and age group, while also including a breakdown of their ltc and opdp costs.
WITH TopUsers AS ( SELECT USER_ID, OH_REGION_NAME, AGEGROUP, TOTALCOST_WITHLTC, TOTALCOST_LTCANDCM, TOTALCOST_WITHOPDP, NTILE(100) OVER (ORDER BY TOTALCOST_WITHLTC DESC) AS PercentileRank FROM All_Users_File ), RegionAgeGroupCosts AS ( SELECT OH_REGION_NAME, AGEGROUP, AVG(TOTALCOST_WITHLTC) AS AvgTotalCost, SUM(TOTALCOST_LTCANDCM) AS TotalLTCAndCM, SUM(TOTALCOST_WITHOPDP) AS TotalOPDP, COUNT(USER_ID) AS UserCount FROM TopUsers WHERE PercentileRank = 1 -- Top 1% of users GROUP BY OH_REGION_NAME, AGEGROUP ) SELECT R.OH_REGION_NAME AS Region, R.AGEGROUP AS AgeGroup, R.AvgTotalCost, R.TotalLTCAndCM, R.TotalOPDP, R.UserCount FROM RegionAgeGroupCosts R ORDER BY R.AvgTotalCost DESC;
This query identifies the top 1% of users by cost, then groups them by region and age to calculate averages and totals of different cost categories.
Simple, Effective Responses
Ask questions about your data in plain English and get immediate answers from our AI assistant.
Powerful, Cost-Effective Models
Our custom fine-tuned models are based on the most recent DeepSeek architecture, delivering exceptional performance at a fraction of the cost of comparable solutions.
Fast, Customizable Integration
Our models and application can be hosted anywhere, and integrate with nearly any database and existing infrastructure, and satisfy any data compliance requirements.