Skip to content

Rotate Database Table

Imagine I have a database table that has the following format: ╔══════════════════════╗ ║ Name Quarter Sales ║ ╠══════════════════════╣ ║ Joe Q1 700 ║ ║ Joe Q2 650 ║ ║ Joe Q3 …

SQL: Efficient way to count and group results by like value

I have a table that looks like this: What is the most efficient way to query it and return the following ? I was thinking to use case when statements but it seems messy. Answer In Presto you can split the delimited list into an array, then unnest the array. This gives you one record per element in each list.

Row Value Comparison Alternatives?

I’m working in a C# SQLite library (SQLite-net) that doesn’t seem to support row value comparisons like this: I get an error message at the first comma. Is there a long form way of doing the same comparison that could be compatible with older SQLite implementations? I’m no expert in SQL but …