Name | Type | Required | Default | Hint |
data | string | true | The text to process with table like data in it | |
select | string | false | A SQL list of column names, eg. "name,version" | |
where | string | false | A SQL where filter used in a query of queries, eg. "name like '%My%'" | |
orderby | string | false | A SQL order by used in a query of queries, eg. "name asc,version desc" | |
limit | string | false | A SQL limit/offset used in a query of queries, eg. "5 or 5,10 (eg. offset 5 limit 10)" | |
headerNames | string | false | An list of column headers to use instead of the default |
SQL query command for filtering table like data. This command will automatically
format any table like data into a query object that can be queried against
JSON data can be passed in the first param or piped into the command:
// (arrays or array of arrays, are given automatic column names)Example Select Statements
sql data=[[1,2],[3,4]] select=col_1
#extensionlist | sql select=id,name
cat myfile.json | sql select=id,name where="name like '%sql%'" orderby=name limit=3
sql select="*"Example Where Statements
sql select="id,name, version"
sql select="max(name) as maxName"
sql where="a like "%top"Example Order By Statements
sql where="a > 5"
sql where="a <> 5"
sql where="a <> 5 and b <> ''"
sql orderby="a"Example Limit/Offset Statements
sql orderby="a, b"
sql orderby="a desc, b asc"
sql limit=1Advanced piping
// offset 1 limit 5
sql limit=1,5
sql data=[{a:1,b:2},{a:3,b:4},{a:5,b:6}] where="a > 1" | printTable
╔═══╤═══╗
║ a │ b ║
╠═══╪═══╣
║ 3 │ 4 ║
╟───┼───╢
║ 5 │ 6 ║
╚═══╧═══╝