a year ago
PIVOT and VALUE support in SQL queries for more concise results 🎯
PIVOT tables in SQL queries
PIVOT helps you transform your unique data results into more meaningful table-valued expressions. For certain queries, the syntax PIVOT provides is more readable and easier to interpret than the syntax that may otherwise be specified in SELECT * FROM ... statements.
Retrieve only "values" with SELECT VALUE
- Standard SELECT statement returns a map list containing the data column information and the values in that column.
Example:
SELECT name FROM ... returns "name": "values of name" as a list of key-value map.
- SELECT VALUE, on the other hand, returns only the values within the key-value map, omitting the key.
Example:
SELECT VALUE name FROM ... returns "values of name" as a list.