The $select
parameter is similar to a SELECT
in SQL. It allows expressions and aliases, as well as aggregations when using
$group
.
For example, to retrieve only the location
and magnitude
fields for our earthquakes, set $select
equal to their field names, separated by a comma (,
):
https://soda.demo.socrata.com/resource/4tka-6guv.json?$select=location, magnitude
You can also create column aliases just like you could do in SQL. For example, to alias magnitude
to richter
, provide a select of magnitude AS 'richter'
:
https://soda.demo.socrata.com/resource/4tka-6guv.json?$select=location, magnitude AS richter
You can also use SoQL functions and operators to modify the output of a SODA query. For example, to convert the depth
from meters to feet, by multiplying it by 3.28:
https://soda.demo.socrata.com/resource/4tka-6guv.json?$select=location, depth * 3.28 AS depth_feet
For a full listing of the functions available by datatype, check out the datatype-specific documentation.