| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245 |
- [
- {
- "name": "Sample: Salary Analysis",
- "desc": "Top salary 2007 above $100k, Salary growth (sorted) from 2007-08",
- "type": "2",
- "dialects": ["postgresql", "mysql", "presto"],
- "data": {
- "query": {
- "query": "SELECT sample_07.description, sample_07.salary\r\nFROM\r\n sample_07\r\nWHERE\r\n( sample_07.salary > 100000)\r\nORDER BY sample_07.salary DESC\r\nLIMIT 1000;\n\n\nSELECT s07.description, s07.salary, s08.salary,\r\n s08.salary - s07.salary\r\nFROM\r\n sample_07 s07 JOIN sample_08 s08\r\nON ( s07.code = s08.code)\r\nWHERE\r\n s07.salary < s08.salary\r\nORDER BY s08.salary-s07.salary DESC\r\nLIMIT 1000;\n\n\n",
- "type": 0,
- "email_notify": false,
- "is_parameterized": false,
- "database": "default"
- },
- "functions": [],
- "VERSION": "0.4.1",
- "file_resources": [],
- "settings": []
- }
- },
- {
- "name": "Sample: Top salary",
- "desc": "Top salary 2007 above $100k",
- "type": "0",
- "data": {
- "query": {
- "query": "SELECT sample_07.description, sample_07.salary\r\nFROM\r\n sample_07\r\nWHERE\r\n( sample_07.salary > 100000)\r\nORDER BY sample_07.salary DESC\r\nLIMIT 1000",
- "type": 0,
- "email_notify": false,
- "is_parameterized": false,
- "database": "default"
- },
- "functions": [],
- "VERSION": "0.4.1",
- "file_resources": [],
- "settings": []
- }
- },
- {
- "name": "Sample: Salary growth",
- "desc": "Salary growth (sorted) from 2007-08",
- "type": "0",
- "data": {
- "query": {
- "query": "SELECT s07.description, s07.salary, s08.salary,\r\n s08.salary - s07.salary\r\nFROM\r\n sample_07 s07 JOIN sample_08 s08\r\nON ( s07.code = s08.code)\r\nWHERE\r\n s07.salary < s08.salary\r\nORDER BY s08.salary-s07.salary DESC\r\nLIMIT 1000",
- "type": 0,
- "email_notify": false,
- "is_parameterized": false,
- "database": "default"
- },
- "functions": [],
- "VERSION": "0.4.1",
- "file_resources": [],
- "settings": []
- }
- },
- {
- "name": "Sample: Job loss",
- "desc": "Job loss among the top earners 2007-08",
- "type": "0",
- "data": {
- "query": {
- "query": "SELECT s07.description, s07.total_emp, s08.total_emp, s07.salary\r\nFROM\r\n sample_07 s07 JOIN \r\n sample_08 s08\r\nON ( s07.code = s08.code )\r\nWHERE\r\n( s07.total_emp > s08.total_emp\r\n AND s07.salary > 100000 )\r\nORDER BY s07.salary DESC\nLIMIT 1000",
- "type": 0,
- "email_notify": false,
- "is_parameterized": false,
- "database": "default"
- },
- "functions": [],
- "VERSION": "0.4.1",
- "file_resources": [],
- "settings": []
- }
- },
- {
- "name": "Sample: Customers",
- "desc": "Email Survey Opt-Ins, Customers for Shipping ZIP Code, Total Amount per Order",
- "type": "0",
- "data": {
- "query": {
- "query": "-- Get email survey opt-in values for all customers\nSELECT\r\n c.id,\r\n c.name,\r\n c.email_preferences.categories.surveys\r\nFROM customers c;\n\n\n\n-- Select customers for a given shipping ZIP Code\nSELECT\r\n customers.id,\r\n customers.name\r\nFROM customers\r\nWHERE customers.addresses['shipping'].zip_code = '76710';\n\n\n\n-- Compute total amount per order for all customers\nSELECT\r\n c.id AS customer_id,\r\n c.name AS customer_name,\r\n ords.order_id AS order_id,\r\n SUM(order_items.price * order_items.qty) AS total_amount\r\nFROM\r\n customers c\r\nLATERAL VIEW EXPLODE(c.orders) o AS ords\r\nLATERAL VIEW EXPLODE(ords.items) i AS order_items\r\nGROUP BY c.id, c.name, ords.order_id;",
- "type": 0,
- "email_notify": false,
- "is_parameterized": false,
- "database": "default"
- },
- "functions": [],
- "VERSION": "0.4.1",
- "file_resources": [],
- "settings": []
- }
- },
- {
- "name": "Sample: Top salary",
- "desc": "Top salary 2007 above $100k",
- "type": "1",
- "data": {
- "query": {
- "query": "SELECT sample_07.description, sample_07.salary\r\nFROM\r\n sample_07\r\nWHERE\r\n( sample_07.salary > 100000)\r\nORDER BY sample_07.salary DESC\r\nLIMIT 1000",
- "type": 1,
- "email_notify": false,
- "is_parameterized": false,
- "database": "default"
- },
- "functions": [],
- "VERSION": "0.4.1",
- "file_resources": [],
- "settings": []
- }
- },
- {
- "name": "Sample: Salary growth",
- "desc": "Salary growth (sorted) from 2007-08",
- "type": "1",
- "data": {
- "query": {
- "query": "SELECT s07.description, s07.salary, s08.salary,\r\n s08.salary - s07.salary\r\nFROM\r\n sample_07 s07 JOIN sample_08 s08\r\nON ( s07.code = s08.code)\r\nWHERE\r\n s07.salary < s08.salary\r\nORDER BY s08.salary-s07.salary DESC\r\nLIMIT 1000",
- "type": 1,
- "email_notify": false,
- "is_parameterized": false,
- "database": "default"
- },
- "functions": [],
- "VERSION": "0.4.1",
- "file_resources": [],
- "settings": []
- }
- },
- {
- "name": "Sample: Job loss",
- "desc": "Job loss among the top earners 2007-08",
- "type": "1",
- "data": {
- "query": {
- "query": "SELECT s07.description, s07.total_emp, s08.total_emp, s07.salary\r\nFROM\r\n sample_07 s07 JOIN \r\n sample_08 s08\r\nON ( s07.code = s08.code )\r\nWHERE\r\n( s07.total_emp > s08.total_emp\r\n AND s07.salary > 100000 )\r\nORDER BY s07.salary DESC\nLIMIT 1000",
- "type": 0,
- "email_notify": false,
- "is_parameterized": false,
- "database": "default"
- },
- "functions": [],
- "VERSION": "0.4.1",
- "file_resources": [],
- "settings": []
- }
- },
- {
- "name": "Sample: Customers",
- "desc": "Email Survey Opt-Ins, Customers for Shipping ZIP Code, Total Amount per Order",
- "type": "1",
- "data": {
- "query": {
- "query": "-- Get email survey opt-in values for all customers \nSELECT\r\n c.id,\r\n c.name,\r\n c.email_preferences.categories.surveys\r\nFROM customers c;\n\n\n\n-- Select customers for a given shipping ZIP Code\nSELECT\r\n c.id,\r\n c.name\r\nFROM customers c, c.addresses a\r\nWHERE a.key = 'shipping' and a.zip_code = '76710';\n\n\n\n-- Compute total amount per order for all customers\nSELECT\r\n c.id AS customer_id,\r\n c.name AS customer_name,\r\n o.order_id,\r\n v.total\r\nFROM\r\n customers c,\r\n c.orders o,\r\n (SELECT SUM(price * qty) total FROM o.items) v;",
- "type": 1,
- "email_notify": false,
- "is_parameterized": false,
- "database": "default"
- },
- "functions": [],
- "VERSION": "0.4.1",
- "file_resources": [],
- "settings": []
- }
- },
- {
- "name": "Airline Flight Data",
- "desc": "One time flights data analysis - ORC format",
- "dialects": ["hive"],
- "type": "0",
- "auto_load_only": true,
- "data": {
- "query": {
- "query": "-- Query 1\r\n\r\nWITH flightpath AS (\r\nSELECT\r\na.uniquecarrier auq,\r\na.flightnum afn,\r\nb.uniquecarrier buq,\r\nb.flightnum bfn,\r\nc.uniquecarrier cuq,\r\nc.flightnum cfn,\r\na.origin a_origin,\r\na.dest a_dest,\r\nb.dest b_dest,\r\nc.dest c_dest,\r\na.year,\r\na.month,\r\na.dayofmonth adom,\r\nb.dayofmonth bdom,\r\nc.dayofmonth cdom,\r\na.deptime adt,\r\na.arrtime aat,\r\nb.deptime bdt,\r\nb.arrtime bat,\r\nc.deptime cdt,\r\nc.arrtime cat,\r\na.tailnum a_tailnum,\r\nb.tailnum b_tailnum,\r\nc.tailnum c_tailnum,\r\nc.arrtime - a.deptime flighttime\r\nFROM\r\nflights A,\r\nflights B,\r\nflights C\r\nWHERE\r\n1 = 1\r\nAND b.year = a.year\r\nAND c.year = a.year\r\nAND b.month = a.month\r\nAND c.month = a.month\r\nAND a.dest = b.origin\r\nAND b.dest = c.origin\r\n)\r\nSELECT\r\nfp.*\r\nFROM\r\nflightpath fp\r\nWHERE\r\n1 = 1\r\nAND a_origin = 'JFK'\r\nAND (\r\na_dest = 'LAS'\r\nOR b_dest = 'LAS'\r\nOR c_dest = 'LAS'\r\n)\r\nAND year = 2000\r\nAND month = 1\r\nAND adom = bdom\r\nAND bdom = cdom\r\nAND floor(bdt / 100) - floor(aat / 100) > 1\r\nAND floor(bdt / 100) - floor(aat / 100) < 3\r\nORDER BY\r\nflighttime desc\r\n;\r\n\r\n\r\n-- Query 2\r\n\r\nSELECT flights.month month, avg(flights.depdelay) avgdelay\r\nFROM flights\r\nLEFT JOIN planes ON flights.tailnum = planes.tailnum\r\nWHERE planes.manufacturer LIKE 'AIRBUS%'\r\nAND flights.origin = 'JFK'\r\nGROUP BY flights.month\r\nORDER BY flights.month\r\n;\r\n\r\n\r\n-- Query 3\r\n\r\nSELECT airport,\r\norigin,\r\ncity,\r\ncountry,\r\nflightnum,\r\ndeptime,\r\ndepdelay\r\nFROM airports\r\nLEFT JOIN flights ON airports.iata=flights.origin\r\nWHERE flights.origin='SFO'\r\nAND month=8\r\nAND dayofmonth=6\r\nORDER BY deptime ASC\r\n;\r\n\r\n\r\n-- Query 4\r\n\r\nSELECT month,\r\ncount(*),\r\navg(depdelay),\r\nmax(depdelay),\r\navg(taxiout),\r\navg(cancelled),\r\navg(weatherdelay),\r\nmax(weatherdelay),\r\navg(nasdelay),\r\nmax(nasdelay),\r\navg(securitydelay),\r\nmax(securitydelay),\r\navg(lateaircraftdelay),\r\nmax(lateaircraftdelay),\r\navg(airtime),\r\navg(actualelapsedtime),\r\navg(distance)\r\nFROM flights\r\nGROUP BY month\r\nORDER BY month\r\n;\r\n\r\n\r\n-- Query 5\r\n-- Select airport with highest avg delay\r\n\r\nSELECT origin,\r\navg(depdelay+weatherdelay+lateaircraftdelay) AS total_delay_avg\r\nFROM flights\r\nWHERE depdelay IS NOT NULL and weatherdelay IS NOT NULL and lateaircraftdelay IS NOT NULL\r\nGROUP BY origin\r\nORDER BY total_delay_avg DESC\r\n;\r\n\r\n\r\n-- Query 6\r\n-- Select delays by month at that airport with highest avg delays\r\n\r\nSELECT month,\r\navg(depdelay+weatherdelay+lateaircraftdelay) AS total_delay_avg\r\nFROM flights\r\nWHERE origin='GCC'\r\nAND depdelay IS NOT NULL\r\nAND weatherdelay IS NOT NULL\r\nAND lateaircraftdelay IS NOT NULL\r\nGROUP BY month\r\nORDER BY total_delay_avg DESC\r\n;\r\n\r\n\r\n-- Query 7\r\n-- Get number of flights with delays that are too long\r\n\r\nSELECT count(flightnum)\r\nFROM flights\r\nWHERE depdelay >\r\n(SELECT 3*stddev(depdelay)\r\nFROM flights_s3)\r\nAND weatherdelay >\r\n(SELECT 3*stddev(weatherdelay)\r\nFROM flights_s3)\r\nAND lateaircraftdelay >\r\n(SELECT 3*stddev(lateaircraftdelay)\r\nFROM flights_s3)\r\n;\r\n\r\n\r\n-- Query 8\r\n-- Get number of flights with delays that are too long\r\n\r\nSELECT count(flightnum)\r\nFROM flights\r\nWHERE depdelay >\r\n(SELECT 3*stddev(depdelay)\r\nFROM flights)\r\nAND weatherdelay >\r\n(SELECT 3*stddev(weatherdelay)\r\nFROM flights)\r\nAND lateaircraftdelay >\r\n(SELECT 3*stddev(lateaircraftdelay)\r\nFROM flights)\r\n;\r\n\r\n\r\n-- Query 9\r\n-- Select several combinations of two delay type columns and total_delay to see which combinations of \r\n-- two delay factors are most likely to lead to the highest delay\r\n\r\nSELECT flightnum,\r\norigin,\r\n(depdelay+weatherdelay) AS dep_and_weather,\r\n(depdelay+lateaircraftdelay) AS dep_and_late_arrival,\r\n(weatherdelay+lateaircraftdelay) AS weather_and_late_arrival,\r\n(depdelay+weatherdelay+lateaircraftdelay) AS total_delay\r\nFROM flights\r\nWHERE depdelay IS NOT NULL\r\nAND weatherdelay IS NOT NULL\r\nAND lateaircraftdelay IS NOT NULL\r\n;\r\n",
- "type": 0,
- "email_notify": false,
- "is_parameterized": false,
- "database": "airline_ontime_orc"
- },
- "functions": [],
- "VERSION": "0.4.1",
- "file_resources": [],
- "settings": []
- }
- },
- {
- "name": "Airline Flight Data",
- "desc": "One time flights data analysis - Parquet format",
- "dialects": ["hive"],
- "type": "0",
- "auto_load_only": true,
- "data": {
- "query": {
- "query": "-- Query 1\r\n\r\nWITH flightpath AS (\r\nSELECT\r\na.uniquecarrier auq,\r\na.flightnum afn,\r\nb.uniquecarrier buq,\r\nb.flightnum bfn,\r\nc.uniquecarrier cuq,\r\nc.flightnum cfn,\r\na.origin a_origin,\r\na.dest a_dest,\r\nb.dest b_dest,\r\nc.dest c_dest,\r\na.year,\r\na.month,\r\na.dayofmonth adom,\r\nb.dayofmonth bdom,\r\nc.dayofmonth cdom,\r\na.deptime adt,\r\na.arrtime aat,\r\nb.deptime bdt,\r\nb.arrtime bat,\r\nc.deptime cdt,\r\nc.arrtime cat,\r\na.tailnum a_tailnum,\r\nb.tailnum b_tailnum,\r\nc.tailnum c_tailnum,\r\nc.arrtime - a.deptime flighttime\r\nFROM\r\nflights A,\r\nflights B,\r\nflights C\r\nWHERE\r\n1 = 1\r\nAND b.year = a.year\r\nAND c.year = a.year\r\nAND b.month = a.month\r\nAND c.month = a.month\r\nAND a.dest = b.origin\r\nAND b.dest = c.origin\r\n)\r\nSELECT\r\nfp.*\r\nFROM\r\nflightpath fp\r\nWHERE\r\n1 = 1\r\nAND a_origin = 'JFK'\r\nAND (\r\na_dest = 'LAS'\r\nOR b_dest = 'LAS'\r\nOR c_dest = 'LAS'\r\n)\r\nAND year = 2000\r\nAND month = 1\r\nAND adom = bdom\r\nAND bdom = cdom\r\nAND floor(bdt / 100) - floor(aat / 100) > 1\r\nAND floor(bdt / 100) - floor(aat / 100) < 3\r\nORDER BY\r\nflighttime desc\r\n;\r\n\r\n\r\n-- Query 2\r\n\r\nSELECT flights.month month, avg(flights.depdelay) avgdelay\r\nFROM flights\r\nLEFT JOIN planes ON flights.tailnum = planes.tailnum\r\nWHERE planes.manufacturer LIKE 'AIRBUS%'\r\nAND flights.origin = 'JFK'\r\nGROUP BY flights.month\r\nORDER BY flights.month\r\n;\r\n\r\n\r\n-- Query 3\r\n\r\nSELECT airport,\r\norigin,\r\ncity,\r\ncountry,\r\nflightnum,\r\ndeptime,\r\ndepdelay\r\nFROM airports\r\nLEFT JOIN flights ON airports.iata=flights.origin\r\nWHERE flights.origin='SFO'\r\nAND month=8\r\nAND dayofmonth=6\r\nORDER BY deptime ASC\r\n;\r\n\r\n\r\n-- Query 4\r\n\r\nSELECT month,\r\ncount(*),\r\navg(depdelay),\r\nmax(depdelay),\r\navg(taxiout),\r\navg(cancelled),\r\navg(weatherdelay),\r\nmax(weatherdelay),\r\navg(nasdelay),\r\nmax(nasdelay),\r\navg(securitydelay),\r\nmax(securitydelay),\r\navg(lateaircraftdelay),\r\nmax(lateaircraftdelay),\r\navg(airtime),\r\navg(actualelapsedtime),\r\navg(distance)\r\nFROM flights\r\nGROUP BY month\r\nORDER BY month\r\n;\r\n\r\n\r\n-- Query 5\r\n-- Select airport with highest avg delay\r\n\r\nSELECT origin,\r\navg(depdelay+weatherdelay+lateaircraftdelay) AS total_delay_avg\r\nFROM flights\r\nWHERE depdelay IS NOT NULL and weatherdelay IS NOT NULL and lateaircraftdelay IS NOT NULL\r\nGROUP BY origin\r\nORDER BY total_delay_avg DESC\r\n;\r\n\r\n\r\n-- Query 6\r\n-- Select delays by month at that airport with highest avg delays\r\n\r\nSELECT month,\r\navg(depdelay+weatherdelay+lateaircraftdelay) AS total_delay_avg\r\nFROM flights\r\nWHERE origin='GCC'\r\nAND depdelay IS NOT NULL\r\nAND weatherdelay IS NOT NULL\r\nAND lateaircraftdelay IS NOT NULL\r\nGROUP BY month\r\nORDER BY total_delay_avg DESC\r\n;\r\n\r\n\r\n-- Query 7\r\n-- Get number of flights with delays that are too long\r\n\r\nSELECT count(flightnum)\r\nFROM flights\r\nWHERE depdelay >\r\n(SELECT 3*stddev(depdelay)\r\nFROM flights_s3)\r\nAND weatherdelay >\r\n(SELECT 3*stddev(weatherdelay)\r\nFROM flights_s3)\r\nAND lateaircraftdelay >\r\n(SELECT 3*stddev(lateaircraftdelay)\r\nFROM flights_s3)\r\n;\r\n\r\n\r\n-- Query 8\r\n-- Get number of flights with delays that are too long\r\n\r\nSELECT count(flightnum)\r\nFROM flights\r\nWHERE depdelay >\r\n(SELECT 3*stddev(depdelay)\r\nFROM flights)\r\nAND weatherdelay >\r\n(SELECT 3*stddev(weatherdelay)\r\nFROM flights)\r\nAND lateaircraftdelay >\r\n(SELECT 3*stddev(lateaircraftdelay)\r\nFROM flights)\r\n;\r\n\r\n\r\n-- Query 9\r\n-- Select several combinations of two delay type columns and total_delay to see which combinations of \r\n-- two delay factors are most likely to lead to the highest delay\r\n\r\nSELECT flightnum,\r\norigin,\r\n(depdelay+weatherdelay) AS dep_and_weather,\r\n(depdelay+lateaircraftdelay) AS dep_and_late_arrival,\r\n(weatherdelay+lateaircraftdelay) AS weather_and_late_arrival,\r\n(depdelay+weatherdelay+lateaircraftdelay) AS total_delay\r\nFROM flights\r\nWHERE depdelay IS NOT NULL\r\nAND weatherdelay IS NOT NULL\r\nAND lateaircraftdelay IS NOT NULL\r\n;\r\n",
- "type": 0,
- "email_notify": false,
- "is_parameterized": false,
- "database": "airline_ontime_parquet"
- },
- "functions": [],
- "VERSION": "0.4.1",
- "file_resources": [],
- "settings": []
- }
- },
- {
- "name": "Airline Flight Data",
- "desc": "One time flights data analysis - Parquet format",
- "dialects": ["impala"],
- "type": "1",
- "auto_load_only": true,
- "data": {
- "query": {
- "query": "-- Query 1\r\n\r\nWITH flightpath AS (\r\nSELECT\r\na.uniquecarrier auq,\r\na.flightnum afn,\r\nb.uniquecarrier buq,\r\nb.flightnum bfn,\r\nc.uniquecarrier cuq,\r\nc.flightnum cfn,\r\na.origin a_origin,\r\na.dest a_dest,\r\nb.dest b_dest,\r\nc.dest c_dest,\r\na.year,\r\na.month,\r\na.dayofmonth adom,\r\nb.dayofmonth bdom,\r\nc.dayofmonth cdom,\r\na.deptime adt,\r\na.arrtime aat,\r\nb.deptime bdt,\r\nb.arrtime bat,\r\nc.deptime cdt,\r\nc.arrtime cat,\r\na.tailnum a_tailnum,\r\nb.tailnum b_tailnum,\r\nc.tailnum c_tailnum,\r\nc.arrtime - a.deptime flighttime\r\nFROM\r\nflights A,\r\nflights B,\r\nflights C\r\nWHERE\r\n1 = 1\r\nAND b.year = a.year\r\nAND c.year = a.year\r\nAND b.month = a.month\r\nAND c.month = a.month\r\nAND a.dest = b.origin\r\nAND b.dest = c.origin\r\n)\r\nSELECT\r\nfp.*\r\nFROM\r\nflightpath fp\r\nWHERE\r\n1 = 1\r\nAND a_origin = 'JFK'\r\nAND (\r\na_dest = 'LAS'\r\nOR b_dest = 'LAS'\r\nOR c_dest = 'LAS'\r\n)\r\nAND year = 2000\r\nAND month = 1\r\nAND adom = bdom\r\nAND bdom = cdom\r\nAND floor(bdt / 100) - floor(aat / 100) > 1\r\nAND floor(bdt / 100) - floor(aat / 100) < 3\r\nORDER BY\r\nflighttime desc\r\n;\r\n\r\n\r\n-- Query 2\r\n\r\nSELECT flights.month month, avg(flights.depdelay) avgdelay\r\nFROM flights\r\nLEFT JOIN planes ON flights.tailnum = planes.tailnum\r\nWHERE planes.manufacturer LIKE 'AIRBUS%'\r\nAND flights.origin = 'JFK'\r\nGROUP BY flights.month\r\nORDER BY flights.month\r\n;\r\n\r\n\r\n-- Query 3\r\n\r\nSELECT airport,\r\norigin,\r\ncity,\r\ncountry,\r\nflightnum,\r\ndeptime,\r\ndepdelay\r\nFROM airports\r\nLEFT JOIN flights ON airports.iata=flights.origin\r\nWHERE flights.origin='SFO'\r\nAND month=8\r\nAND dayofmonth=6\r\nORDER BY deptime ASC\r\n;\r\n\r\n\r\n-- Query 4\r\n\r\nSELECT month,\r\ncount(*),\r\navg(depdelay),\r\nmax(depdelay),\r\navg(taxiout),\r\navg(cancelled),\r\navg(weatherdelay),\r\nmax(weatherdelay),\r\navg(nasdelay),\r\nmax(nasdelay),\r\navg(securitydelay),\r\nmax(securitydelay),\r\navg(lateaircraftdelay),\r\nmax(lateaircraftdelay),\r\navg(airtime),\r\navg(actualelapsedtime),\r\navg(distance)\r\nFROM flights\r\nGROUP BY month\r\nORDER BY month\r\n;\r\n\r\n\r\n-- Query 5\r\n-- Select airport with highest avg delay\r\n\r\nSELECT origin,\r\navg(depdelay+weatherdelay+lateaircraftdelay) AS total_delay_avg\r\nFROM flights\r\nWHERE depdelay IS NOT NULL and weatherdelay IS NOT NULL and lateaircraftdelay IS NOT NULL\r\nGROUP BY origin\r\nORDER BY total_delay_avg DESC\r\n;\r\n\r\n\r\n-- Query 6\r\n-- Select delays by month at that airport with highest avg delays\r\n\r\nSELECT month,\r\navg(depdelay+weatherdelay+lateaircraftdelay) AS total_delay_avg\r\nFROM flights\r\nWHERE origin='GCC'\r\nAND depdelay IS NOT NULL\r\nAND weatherdelay IS NOT NULL\r\nAND lateaircraftdelay IS NOT NULL\r\nGROUP BY month\r\nORDER BY total_delay_avg DESC\r\n;\r\n\r\n\r\n-- Query 7\r\n-- Get number of flights with delays that are too long\r\n\r\nSELECT count(flightnum)\r\nFROM flights\r\nWHERE depdelay >\r\n(SELECT 3*stddev(depdelay)\r\nFROM flights_s3)\r\nAND weatherdelay >\r\n(SELECT 3*stddev(weatherdelay)\r\nFROM flights_s3)\r\nAND lateaircraftdelay >\r\n(SELECT 3*stddev(lateaircraftdelay)\r\nFROM flights_s3)\r\n;\r\n\r\n\r\n-- Query 8\r\n-- Get number of flights with delays that are too long\r\n\r\nSELECT count(flightnum)\r\nFROM flights\r\nWHERE depdelay >\r\n(SELECT 3*stddev(depdelay)\r\nFROM flights)\r\nAND weatherdelay >\r\n(SELECT 3*stddev(weatherdelay)\r\nFROM flights)\r\nAND lateaircraftdelay >\r\n(SELECT 3*stddev(lateaircraftdelay)\r\nFROM flights)\r\n;\r\n\r\n\r\n-- Query 9\r\n-- Select several combinations of two delay type columns and total_delay to see which combinations of \r\n-- two delay factors are most likely to lead to the highest delay\r\n\r\nSELECT flightnum,\r\norigin,\r\n(depdelay+weatherdelay) AS dep_and_weather,\r\n(depdelay+lateaircraftdelay) AS dep_and_late_arrival,\r\n(weatherdelay+lateaircraftdelay) AS weather_and_late_arrival,\r\n(depdelay+weatherdelay+lateaircraftdelay) AS total_delay\r\nFROM flights\r\nWHERE depdelay IS NOT NULL\r\nAND weatherdelay IS NOT NULL\r\nAND lateaircraftdelay IS NOT NULL\r\n;\r\n",
- "type": 0,
- "email_notify": false,
- "is_parameterized": false,
- "database": "airline_ontime_parquet"
- },
- "functions": [],
- "VERSION": "0.4.1",
- "file_resources": [],
- "settings": []
- }
- },
- {
- "name": "US City Population",
- "desc": "Small samples of number of inhabitants in some US cities",
- "dialects": ["phoenix"],
- "type": "2",
- "auto_load_only": false,
- "data": {
- "query": {
- "query": "\nSELECT\n state as \"State\",\n count(city) as \"City Count\",\n sum(population) as \"Population Sum\"\nFROM\n us_population\nGROUP BY\n state\nORDER BY\n sum(population) DESC\n;",
- "type": 0,
- "email_notify": false,
- "is_parameterized": false,
- "database": ""
- },
- "functions": [],
- "VERSION": "0.4.1",
- "file_resources": [],
- "settings": []
- }
- }
- ]
|