instruction stringclasses 1 value | input stringlengths 50 201 | output_str stringlengths 98 320 |
|---|---|---|
Parse this Snowflake SQL statement into its structured JSON AST representation. | WITH sub AS (SELECT * FROM events WHERE price IS NOT NULL) SELECT sub.price, COUNT(*) AS cnt FROM sub JOIN events ON sub.price = events.price GROUP BY sub.price; | {"with":{"sub":{"select":["*"],"from":"events","where":"price IS NOT NULL"}},"select":[{"column":"sub.price"},{"agg":"count","column":"*","as":"cnt"}],"from":{"table":"sub"},"joins":[{"type":"INNER JOIN","table":"events","on":"sub.price = events.price"}],"group_by":["sub.price"]} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | SELECT IFF(price > 19,'Y','A') AS price_flag FROM products; | {"select":[{"function":"iff","cond":"price > 19,'Y','A'","true":"Y","false":"A","as":"price_flag"}],"from":"products"} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | SELECT employees.category, departments.order_date FROM employees INNER JOIN departments ON employees.category = departments.order_date; | {"select":[{"column":"employees.category"},{"column":"departments.order_date"}],"from":"employees","joins":[{"type":"INNER JOIN","table":"departments","on":"employees.category = departments.order_date"}]} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | SELECT v.value:quantity::STRING AS quantity_str FROM products, LATERAL FLATTEN(input => products.data) v; | {"select":[{"expr":"v.value:quantity::STRING","as":"quantity_str"}],"from":{"table":"products","flatten":"data"}} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | WITH sub AS (SELECT * FROM shipments WHERE rating IS NOT NULL) SELECT sub.rating, COUNT(*) AS cnt FROM sub JOIN shipments ON sub.rating = shipments.rating GROUP BY sub.rating; | {"with":{"sub":{"select":["*"],"from":"shipments","where":"rating IS NOT NULL"}},"select":[{"column":"sub.rating"},{"agg":"count","column":"*","as":"cnt"}],"from":{"table":"sub"},"joins":[{"type":"INNER JOIN","table":"shipments","on":"sub.rating = shipments.rating"}],"group_by":["sub.rating"]} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | SELECT IFF(amount > 38,'N','A') AS amount_flag FROM departments; | {"select":[{"function":"iff","cond":"amount > 38,'N','A'","true":"N","false":"A","as":"amount_flag"}],"from":"departments"} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | SELECT * FROM sales PIVOT (SUM(amount) FOR region IN ('NA','EU','APAC')); | {"select":["*"],"from":"sales","pivot":{"agg":"sum","column":"amount","for":"region","in":["NA","EU","APAC"]}} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | SELECT customers.region, payments.user_id FROM customers RIGHT JOIN payments ON customers.region = payments.user_id; | {"select":[{"column":"customers.region"},{"column":"payments.user_id"}],"from":"customers","joins":[{"type":"RIGHT JOIN","table":"payments","on":"customers.region = payments.user_id"}]} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | SELECT *, RANK() OVER (PARTITION BY rating ORDER BY amount DESC) AS rank_rating FROM orders QUALIFY rank_rating <= 5; | {"select":["*"],"from":"orders","window":{"function":"rank","partition_by":["rating"],"order_by":[{"column":"amount","order":"DESC"}],"alias":"rank_rating"},"qualify":"rank_rating <= 5"} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | SELECT *, RANK() OVER (PARTITION BY quantity ORDER BY order_date DESC) AS rank_quantity FROM events QUALIFY rank_quantity <= 5; | {"select":["*"],"from":"events","window":{"function":"rank","partition_by":["quantity"],"order_by":[{"column":"order_date","order":"DESC"}],"alias":"rank_quantity"},"qualify":"rank_quantity <= 5"} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | SELECT IFF(price > 62,'Y','A') AS price_flag FROM orders; | {"select":[{"function":"iff","cond":"price > 62,'Y','A'","true":"Y","false":"A","as":"price_flag"}],"from":"orders"} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | SELECT * FROM sales PIVOT (SUM(amount) FOR region IN ('NA','EU','APAC')); | {"select":["*"],"from":"sales","pivot":{"agg":"sum","column":"amount","for":"region","in":["NA","EU","APAC"]}} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | SELECT *, RANK() OVER (PARTITION BY rating ORDER BY amount DESC) AS rank_rating FROM reviews QUALIFY rank_rating <= 5; | {"select":["*"],"from":"reviews","window":{"function":"rank","partition_by":["rating"],"order_by":[{"column":"amount","order":"DESC"}],"alias":"rank_rating"},"qualify":"rank_rating <= 5"} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | SELECT amount FROM products UNION SELECT amount FROM sales; | {"operator":"UNION","queries":[{"select":["amount"],"from":"products"},{"select":["amount"],"from":"sales"}]} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | SELECT * FROM sales PIVOT (SUM(amount) FOR region IN ('NA','EU','APAC')); | {"select":["*"],"from":"sales","pivot":{"agg":"sum","column":"amount","for":"region","in":["NA","EU","APAC"]}} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | SELECT order_date, SUM(order_date) AS total_order_date FROM payments WHERE order_date > 725 GROUP BY order_date ORDER BY total_order_date DESC LIMIT 8; | {"select":[{"column":"order_date"},{"agg":"sum","column":"order_date","as":"total_order_date"}],"from":"payments","where":"order_date > 725","group_by":["order_date"],"order_by":[{"column":"total_order_date","order":"DESC"}],"limit":8} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | SELECT payments.order_date, departments.order_date FROM payments LEFT JOIN departments ON payments.order_date = departments.order_date; | {"select":[{"column":"payments.order_date"},{"column":"departments.order_date"}],"from":"payments","joins":[{"type":"LEFT JOIN","table":"departments","on":"payments.order_date = departments.order_date"}]} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | SELECT IFF(price > 3,'N','B') AS price_flag FROM events; | {"select":[{"function":"iff","cond":"price > 3,'N','B'","true":"N","false":"B","as":"price_flag"}],"from":"events"} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | SELECT region FROM shipments UNION SELECT region FROM sales; | {"operator":"UNION","queries":[{"select":["region"],"from":"shipments"},{"select":["region"],"from":"sales"}]} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | SELECT IFF(order_date > 25,'Y','A') AS order_date_flag FROM shipments; | {"select":[{"function":"iff","cond":"order_date > 25,'Y','A'","true":"Y","false":"A","as":"order_date_flag"}],"from":"shipments"} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | SELECT IFF(category > 68,'N','B') AS category_flag FROM reviews; | {"select":[{"function":"iff","cond":"category > 68,'N','B'","true":"N","false":"B","as":"category_flag"}],"from":"reviews"} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | SELECT IFF(order_date > 79,'Y','A') AS order_date_flag FROM customers; | {"select":[{"function":"iff","cond":"order_date > 79,'Y','A'","true":"Y","false":"A","as":"order_date_flag"}],"from":"customers"} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | SELECT v.value:category::STRING AS category_str FROM shipments, LATERAL FLATTEN(input => shipments.info) v; | {"select":[{"expr":"v.value:category::STRING","as":"category_str"}],"from":{"table":"shipments","flatten":"info"}} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | SELECT v.value:quantity::STRING AS quantity_str FROM departments, LATERAL FLATTEN(input => departments.payload) v; | {"select":[{"expr":"v.value:quantity::STRING","as":"quantity_str"}],"from":{"table":"departments","flatten":"payload"}} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | WITH sub AS (SELECT * FROM customers WHERE quantity IS NOT NULL) SELECT sub.quantity, COUNT(*) AS cnt FROM sub JOIN customers ON sub.quantity = customers.quantity GROUP BY sub.quantity; | {"with":{"sub":{"select":["*"],"from":"customers","where":"quantity IS NOT NULL"}},"select":[{"column":"sub.quantity"},{"agg":"count","column":"*","as":"cnt"}],"from":{"table":"sub"},"joins":[{"type":"INNER JOIN","table":"customers","on":"sub.quantity = customers.quantity"}],"group_by":["sub.quantity"]} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | SELECT event_time, SUM(event_time) AS total_event_time FROM employees WHERE event_time > 593 GROUP BY event_time ORDER BY total_event_time DESC LIMIT 99; | {"select":[{"column":"event_time"},{"agg":"sum","column":"event_time","as":"total_event_time"}],"from":"employees","where":"event_time > 593","group_by":["event_time"],"order_by":[{"column":"total_event_time","order":"DESC"}],"limit":99} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | SELECT * FROM sales PIVOT (SUM(amount) FOR region IN ('NA','EU','APAC')); | {"select":["*"],"from":"sales","pivot":{"agg":"sum","column":"amount","for":"region","in":["NA","EU","APAC"]}} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | SELECT event_time FROM shipments INTERSECT SELECT event_time FROM sales; | {"operator":"INTERSECT","queries":[{"select":["event_time"],"from":"shipments"},{"select":["event_time"],"from":"sales"}]} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | SELECT sales.region, reviews.amount FROM sales LEFT JOIN reviews ON sales.region = reviews.amount; | {"select":[{"column":"sales.region"},{"column":"reviews.amount"}],"from":"sales","joins":[{"type":"LEFT JOIN","table":"reviews","on":"sales.region = reviews.amount"}]} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | SELECT *, RANK() OVER (PARTITION BY amount ORDER BY id DESC) AS rank_amount FROM employees QUALIFY rank_amount <= 5; | {"select":["*"],"from":"employees","window":{"function":"rank","partition_by":["amount"],"order_by":[{"column":"id","order":"DESC"}],"alias":"rank_amount"},"qualify":"rank_amount <= 5"} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | SELECT CASE WHEN region < 50 THEN 'Low' WHEN region < 100 THEN 'Mid' ELSE 'High' END AS level FROM events; | {"select":[{"case":[{"when":"region < 50","then":"Low"},{"when":"region < 100","then":"Mid"}],"else":"High","as":"level"}],"from":"events"} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | SELECT category, SUM(category) AS total_category FROM reviews WHERE category > 241 GROUP BY category ORDER BY total_category DESC LIMIT 94; | {"select":[{"column":"category"},{"agg":"sum","column":"category","as":"total_category"}],"from":"reviews","where":"category > 241","group_by":["category"],"order_by":[{"column":"total_category","order":"DESC"}],"limit":94} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | SELECT event_time, SUM(event_time) AS total_event_time FROM events WHERE event_time > 288 GROUP BY event_time ORDER BY total_event_time DESC LIMIT 42; | {"select":[{"column":"event_time"},{"agg":"sum","column":"event_time","as":"total_event_time"}],"from":"events","where":"event_time > 288","group_by":["event_time"],"order_by":[{"column":"total_event_time","order":"DESC"}],"limit":42} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | SELECT category, SUM(category) AS total_category FROM payments WHERE category > 79 GROUP BY category ORDER BY total_category DESC LIMIT 75; | {"select":[{"column":"category"},{"agg":"sum","column":"category","as":"total_category"}],"from":"payments","where":"category > 79","group_by":["category"],"order_by":[{"column":"total_category","order":"DESC"}],"limit":75} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | SELECT amount FROM departments INTERSECT SELECT amount FROM reviews; | {"operator":"INTERSECT","queries":[{"select":["amount"],"from":"departments"},{"select":["amount"],"from":"reviews"}]} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | SELECT order_date FROM customers INTERSECT SELECT order_date FROM departments; | {"operator":"INTERSECT","queries":[{"select":["order_date"],"from":"customers"},{"select":["order_date"],"from":"departments"}]} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | SELECT IFF(order_date > 34,'Y','B') AS order_date_flag FROM payments; | {"select":[{"function":"iff","cond":"order_date > 34,'Y','B'","true":"Y","false":"B","as":"order_date_flag"}],"from":"payments"} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | WITH sub AS (SELECT * FROM products WHERE region IS NOT NULL) SELECT sub.region, COUNT(*) AS cnt FROM sub JOIN products ON sub.region = products.region GROUP BY sub.region; | {"with":{"sub":{"select":["*"],"from":"products","where":"region IS NOT NULL"}},"select":[{"column":"sub.region"},{"agg":"count","column":"*","as":"cnt"}],"from":{"table":"sub"},"joins":[{"type":"INNER JOIN","table":"products","on":"sub.region = products.region"}],"group_by":["sub.region"]} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | SELECT region FROM sales INTERSECT SELECT region FROM payments; | {"operator":"INTERSECT","queries":[{"select":["region"],"from":"sales"},{"select":["region"],"from":"payments"}]} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | SELECT region FROM products INTERSECT SELECT region FROM customers; | {"operator":"INTERSECT","queries":[{"select":["region"],"from":"products"},{"select":["region"],"from":"customers"}]} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | SELECT * FROM sales PIVOT (SUM(amount) FOR region IN ('NA','EU','APAC')); | {"select":["*"],"from":"sales","pivot":{"agg":"sum","column":"amount","for":"region","in":["NA","EU","APAC"]}} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | SELECT products.id, events.id FROM products FULL JOIN events ON products.id = events.id; | {"select":[{"column":"products.id"},{"column":"events.id"}],"from":"products","joins":[{"type":"FULL JOIN","table":"events","on":"products.id = events.id"}]} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | SELECT order_date, SUM(order_date) AS total_order_date FROM shipments WHERE order_date > 613 GROUP BY order_date ORDER BY total_order_date DESC LIMIT 76; | {"select":[{"column":"order_date"},{"agg":"sum","column":"order_date","as":"total_order_date"}],"from":"shipments","where":"order_date > 613","group_by":["order_date"],"order_by":[{"column":"total_order_date","order":"DESC"}],"limit":76} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | SELECT reviews.price, events.category FROM reviews LEFT JOIN events ON reviews.price = events.category; | {"select":[{"column":"reviews.price"},{"column":"events.category"}],"from":"reviews","joins":[{"type":"LEFT JOIN","table":"events","on":"reviews.price = events.category"}]} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | SELECT * FROM sales PIVOT (SUM(amount) FOR region IN ('NA','EU','APAC')); | {"select":["*"],"from":"sales","pivot":{"agg":"sum","column":"amount","for":"region","in":["NA","EU","APAC"]}} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | SELECT v.value:order_date::STRING AS order_date_str FROM payments, LATERAL FLATTEN(input => payments.data) v; | {"select":[{"expr":"v.value:order_date::STRING","as":"order_date_str"}],"from":{"table":"payments","flatten":"data"}} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | SELECT rating FROM products UNION SELECT rating FROM events; | {"operator":"UNION","queries":[{"select":["rating"],"from":"products"},{"select":["rating"],"from":"events"}]} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | SELECT *, RANK() OVER (PARTITION BY price ORDER BY amount DESC) AS rank_price FROM sales QUALIFY rank_price <= 5; | {"select":["*"],"from":"sales","window":{"function":"rank","partition_by":["price"],"order_by":[{"column":"amount","order":"DESC"}],"alias":"rank_price"},"qualify":"rank_price <= 5"} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | SELECT * FROM sales PIVOT (SUM(amount) FOR region IN ('NA','EU','APAC')); | {"select":["*"],"from":"sales","pivot":{"agg":"sum","column":"amount","for":"region","in":["NA","EU","APAC"]}} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | SELECT quantity, SUM(quantity) AS total_quantity FROM customers WHERE quantity > 885 GROUP BY quantity ORDER BY total_quantity DESC LIMIT 78; | {"select":[{"column":"quantity"},{"agg":"sum","column":"quantity","as":"total_quantity"}],"from":"customers","where":"quantity > 885","group_by":["quantity"],"order_by":[{"column":"total_quantity","order":"DESC"}],"limit":78} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | SELECT IFF(price > 6,'Y','A') AS price_flag FROM sales; | {"select":[{"function":"iff","cond":"price > 6,'Y','A'","true":"Y","false":"A","as":"price_flag"}],"from":"sales"} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | SELECT * FROM sales PIVOT (SUM(amount) FOR region IN ('NA','EU','APAC')); | {"select":["*"],"from":"sales","pivot":{"agg":"sum","column":"amount","for":"region","in":["NA","EU","APAC"]}} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | SELECT v.value:id::STRING AS id_str FROM events, LATERAL FLATTEN(input => events.data) v; | {"select":[{"expr":"v.value:id::STRING","as":"id_str"}],"from":{"table":"events","flatten":"data"}} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | WITH sub AS (SELECT * FROM products WHERE category IS NOT NULL) SELECT sub.category, COUNT(*) AS cnt FROM sub JOIN products ON sub.category = products.category GROUP BY sub.category; | {"with":{"sub":{"select":["*"],"from":"products","where":"category IS NOT NULL"}},"select":[{"column":"sub.category"},{"agg":"count","column":"*","as":"cnt"}],"from":{"table":"sub"},"joins":[{"type":"INNER JOIN","table":"products","on":"sub.category = products.category"}],"group_by":["sub.category"]} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | WITH sub AS (SELECT * FROM products WHERE rating IS NOT NULL) SELECT sub.rating, COUNT(*) AS cnt FROM sub JOIN products ON sub.rating = products.rating GROUP BY sub.rating; | {"with":{"sub":{"select":["*"],"from":"products","where":"rating IS NOT NULL"}},"select":[{"column":"sub.rating"},{"agg":"count","column":"*","as":"cnt"}],"from":{"table":"sub"},"joins":[{"type":"INNER JOIN","table":"products","on":"sub.rating = products.rating"}],"group_by":["sub.rating"]} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | SELECT CASE WHEN region < 50 THEN 'Low' WHEN region < 100 THEN 'Mid' ELSE 'High' END AS level FROM payments; | {"select":[{"case":[{"when":"region < 50","then":"Low"},{"when":"region < 100","then":"Mid"}],"else":"High","as":"level"}],"from":"payments"} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | SELECT CASE WHEN id < 50 THEN 'Low' WHEN id < 100 THEN 'Mid' ELSE 'High' END AS level FROM products; | {"select":[{"case":[{"when":"id < 50","then":"Low"},{"when":"id < 100","then":"Mid"}],"else":"High","as":"level"}],"from":"products"} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | SELECT CASE WHEN quantity < 50 THEN 'Low' WHEN quantity < 100 THEN 'Mid' ELSE 'High' END AS level FROM customers; | {"select":[{"case":[{"when":"quantity < 50","then":"Low"},{"when":"quantity < 100","then":"Mid"}],"else":"High","as":"level"}],"from":"customers"} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | SELECT v.value:order_date::STRING AS order_date_str FROM shipments, LATERAL FLATTEN(input => shipments.info) v; | {"select":[{"expr":"v.value:order_date::STRING","as":"order_date_str"}],"from":{"table":"shipments","flatten":"info"}} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | SELECT IFF(order_date > 93,'Y','B') AS order_date_flag FROM shipments; | {"select":[{"function":"iff","cond":"order_date > 93,'Y','B'","true":"Y","false":"B","as":"order_date_flag"}],"from":"shipments"} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | SELECT IFF(order_date > 92,'N','B') AS order_date_flag FROM payments; | {"select":[{"function":"iff","cond":"order_date > 92,'N','B'","true":"N","false":"B","as":"order_date_flag"}],"from":"payments"} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | WITH sub AS (SELECT * FROM customers WHERE region IS NOT NULL) SELECT sub.region, COUNT(*) AS cnt FROM sub JOIN customers ON sub.region = customers.region GROUP BY sub.region; | {"with":{"sub":{"select":["*"],"from":"customers","where":"region IS NOT NULL"}},"select":[{"column":"sub.region"},{"agg":"count","column":"*","as":"cnt"}],"from":{"table":"sub"},"joins":[{"type":"INNER JOIN","table":"customers","on":"sub.region = customers.region"}],"group_by":["sub.region"]} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | SELECT employees.price, reviews.quantity FROM employees INNER JOIN reviews ON employees.price = reviews.quantity; | {"select":[{"column":"employees.price"},{"column":"reviews.quantity"}],"from":"employees","joins":[{"type":"INNER JOIN","table":"reviews","on":"employees.price = reviews.quantity"}]} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | SELECT CASE WHEN price < 50 THEN 'Low' WHEN price < 100 THEN 'Mid' ELSE 'High' END AS level FROM events; | {"select":[{"case":[{"when":"price < 50","then":"Low"},{"when":"price < 100","then":"Mid"}],"else":"High","as":"level"}],"from":"events"} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | SELECT * FROM sales PIVOT (SUM(amount) FOR region IN ('NA','EU','APAC')); | {"select":["*"],"from":"sales","pivot":{"agg":"sum","column":"amount","for":"region","in":["NA","EU","APAC"]}} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | WITH sub AS (SELECT * FROM products WHERE quantity IS NOT NULL) SELECT sub.quantity, COUNT(*) AS cnt FROM sub JOIN products ON sub.quantity = products.quantity GROUP BY sub.quantity; | {"with":{"sub":{"select":["*"],"from":"products","where":"quantity IS NOT NULL"}},"select":[{"column":"sub.quantity"},{"agg":"count","column":"*","as":"cnt"}],"from":{"table":"sub"},"joins":[{"type":"INNER JOIN","table":"products","on":"sub.quantity = products.quantity"}],"group_by":["sub.quantity"]} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | SELECT order_date FROM events UNION SELECT order_date FROM customers; | {"operator":"UNION","queries":[{"select":["order_date"],"from":"events"},{"select":["order_date"],"from":"customers"}]} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | SELECT IFF(category > 3,'N','B') AS category_flag FROM payments; | {"select":[{"function":"iff","cond":"category > 3,'N','B'","true":"N","false":"B","as":"category_flag"}],"from":"payments"} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | SELECT id, SUM(id) AS total_id FROM orders WHERE id > 970 GROUP BY id ORDER BY total_id DESC LIMIT 98; | {"select":[{"column":"id"},{"agg":"sum","column":"id","as":"total_id"}],"from":"orders","where":"id > 970","group_by":["id"],"order_by":[{"column":"total_id","order":"DESC"}],"limit":98} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | SELECT CASE WHEN user_id < 50 THEN 'Low' WHEN user_id < 100 THEN 'Mid' ELSE 'High' END AS level FROM sales; | {"select":[{"case":[{"when":"user_id < 50","then":"Low"},{"when":"user_id < 100","then":"Mid"}],"else":"High","as":"level"}],"from":"sales"} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | SELECT quantity FROM departments INTERSECT SELECT quantity FROM payments; | {"operator":"INTERSECT","queries":[{"select":["quantity"],"from":"departments"},{"select":["quantity"],"from":"payments"}]} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | SELECT id FROM reviews INTERSECT SELECT id FROM shipments; | {"operator":"INTERSECT","queries":[{"select":["id"],"from":"reviews"},{"select":["id"],"from":"shipments"}]} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | SELECT v.value:order_date::STRING AS order_date_str FROM customers, LATERAL FLATTEN(input => customers.info) v; | {"select":[{"expr":"v.value:order_date::STRING","as":"order_date_str"}],"from":{"table":"customers","flatten":"info"}} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | SELECT rating FROM sales UNION SELECT rating FROM orders; | {"operator":"UNION","queries":[{"select":["rating"],"from":"sales"},{"select":["rating"],"from":"orders"}]} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | SELECT rating FROM sales UNION SELECT rating FROM payments; | {"operator":"UNION","queries":[{"select":["rating"],"from":"sales"},{"select":["rating"],"from":"payments"}]} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | SELECT v.value:amount::STRING AS amount_str FROM employees, LATERAL FLATTEN(input => employees.info) v; | {"select":[{"expr":"v.value:amount::STRING","as":"amount_str"}],"from":{"table":"employees","flatten":"info"}} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | SELECT *, RANK() OVER (PARTITION BY id ORDER BY order_date DESC) AS rank_id FROM departments QUALIFY rank_id <= 5; | {"select":["*"],"from":"departments","window":{"function":"rank","partition_by":["id"],"order_by":[{"column":"order_date","order":"DESC"}],"alias":"rank_id"},"qualify":"rank_id <= 5"} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | SELECT v.value:event_time::STRING AS event_time_str FROM sales, LATERAL FLATTEN(input => sales.info) v; | {"select":[{"expr":"v.value:event_time::STRING","as":"event_time_str"}],"from":{"table":"sales","flatten":"info"}} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | SELECT CASE WHEN user_id < 50 THEN 'Low' WHEN user_id < 100 THEN 'Mid' ELSE 'High' END AS level FROM departments; | {"select":[{"case":[{"when":"user_id < 50","then":"Low"},{"when":"user_id < 100","then":"Mid"}],"else":"High","as":"level"}],"from":"departments"} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | SELECT CASE WHEN price < 50 THEN 'Low' WHEN price < 100 THEN 'Mid' ELSE 'High' END AS level FROM payments; | {"select":[{"case":[{"when":"price < 50","then":"Low"},{"when":"price < 100","then":"Mid"}],"else":"High","as":"level"}],"from":"payments"} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | SELECT *, RANK() OVER (PARTITION BY id ORDER BY amount DESC) AS rank_id FROM events QUALIFY rank_id <= 5; | {"select":["*"],"from":"events","window":{"function":"rank","partition_by":["id"],"order_by":[{"column":"amount","order":"DESC"}],"alias":"rank_id"},"qualify":"rank_id <= 5"} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | SELECT * FROM sales PIVOT (SUM(amount) FOR region IN ('NA','EU','APAC')); | {"select":["*"],"from":"sales","pivot":{"agg":"sum","column":"amount","for":"region","in":["NA","EU","APAC"]}} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | SELECT *, RANK() OVER (PARTITION BY amount ORDER BY price DESC) AS rank_amount FROM shipments QUALIFY rank_amount <= 5; | {"select":["*"],"from":"shipments","window":{"function":"rank","partition_by":["amount"],"order_by":[{"column":"price","order":"DESC"}],"alias":"rank_amount"},"qualify":"rank_amount <= 5"} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | SELECT id FROM orders INTERSECT SELECT id FROM reviews; | {"operator":"INTERSECT","queries":[{"select":["id"],"from":"orders"},{"select":["id"],"from":"reviews"}]} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | SELECT price, SUM(price) AS total_price FROM shipments WHERE price > 710 GROUP BY price ORDER BY total_price DESC LIMIT 26; | {"select":[{"column":"price"},{"agg":"sum","column":"price","as":"total_price"}],"from":"shipments","where":"price > 710","group_by":["price"],"order_by":[{"column":"total_price","order":"DESC"}],"limit":26} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | SELECT region FROM departments UNION SELECT region FROM events; | {"operator":"UNION","queries":[{"select":["region"],"from":"departments"},{"select":["region"],"from":"events"}]} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | SELECT CASE WHEN quantity < 50 THEN 'Low' WHEN quantity < 100 THEN 'Mid' ELSE 'High' END AS level FROM departments; | {"select":[{"case":[{"when":"quantity < 50","then":"Low"},{"when":"quantity < 100","then":"Mid"}],"else":"High","as":"level"}],"from":"departments"} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | SELECT event_time FROM employees INTERSECT SELECT event_time FROM payments; | {"operator":"INTERSECT","queries":[{"select":["event_time"],"from":"employees"},{"select":["event_time"],"from":"payments"}]} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | SELECT *, RANK() OVER (PARTITION BY id ORDER BY event_time DESC) AS rank_id FROM orders QUALIFY rank_id <= 5; | {"select":["*"],"from":"orders","window":{"function":"rank","partition_by":["id"],"order_by":[{"column":"event_time","order":"DESC"}],"alias":"rank_id"},"qualify":"rank_id <= 5"} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | SELECT v.value:order_date::STRING AS order_date_str FROM departments, LATERAL FLATTEN(input => departments.info) v; | {"select":[{"expr":"v.value:order_date::STRING","as":"order_date_str"}],"from":{"table":"departments","flatten":"info"}} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | SELECT *, RANK() OVER (PARTITION BY category ORDER BY quantity DESC) AS rank_category FROM employees QUALIFY rank_category <= 5; | {"select":["*"],"from":"employees","window":{"function":"rank","partition_by":["category"],"order_by":[{"column":"quantity","order":"DESC"}],"alias":"rank_category"},"qualify":"rank_category <= 5"} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | SELECT products.region, events.order_date FROM products LEFT JOIN events ON products.region = events.order_date; | {"select":[{"column":"products.region"},{"column":"events.order_date"}],"from":"products","joins":[{"type":"LEFT JOIN","table":"events","on":"products.region = events.order_date"}]} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | SELECT rating FROM events UNION SELECT rating FROM sales; | {"operator":"UNION","queries":[{"select":["rating"],"from":"events"},{"select":["rating"],"from":"sales"}]} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | SELECT event_time FROM products UNION SELECT event_time FROM events; | {"operator":"UNION","queries":[{"select":["event_time"],"from":"products"},{"select":["event_time"],"from":"events"}]} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | SELECT * FROM sales PIVOT (SUM(amount) FOR region IN ('NA','EU','APAC')); | {"select":["*"],"from":"sales","pivot":{"agg":"sum","column":"amount","for":"region","in":["NA","EU","APAC"]}} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | SELECT events.price, sales.rating FROM events INNER JOIN sales ON events.price = sales.rating; | {"select":[{"column":"events.price"},{"column":"sales.rating"}],"from":"events","joins":[{"type":"INNER JOIN","table":"sales","on":"events.price = sales.rating"}]} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | SELECT v.value:amount::STRING AS amount_str FROM orders, LATERAL FLATTEN(input => orders.payload) v; | {"select":[{"expr":"v.value:amount::STRING","as":"amount_str"}],"from":{"table":"orders","flatten":"payload"}} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | SELECT CASE WHEN quantity < 50 THEN 'Low' WHEN quantity < 100 THEN 'Mid' ELSE 'High' END AS level FROM sales; | {"select":[{"case":[{"when":"quantity < 50","then":"Low"},{"when":"quantity < 100","then":"Mid"}],"else":"High","as":"level"}],"from":"sales"} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | SELECT CASE WHEN price < 50 THEN 'Low' WHEN price < 100 THEN 'Mid' ELSE 'High' END AS level FROM products; | {"select":[{"case":[{"when":"price < 50","then":"Low"},{"when":"price < 100","then":"Mid"}],"else":"High","as":"level"}],"from":"products"} |
Parse this Snowflake SQL statement into its structured JSON AST representation. | SELECT *, RANK() OVER (PARTITION BY region ORDER BY id DESC) AS rank_region FROM employees QUALIFY rank_region <= 5; | {"select":["*"],"from":"employees","window":{"function":"rank","partition_by":["region"],"order_by":[{"column":"id","order":"DESC"}],"alias":"rank_region"},"qualify":"rank_region <= 5"} |
End of preview. Expand
in Data Studio
No dataset card yet
- Downloads last month
- 7