sql

Parameters:
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

Command Usage

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)

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
Example Select Statements
sql select="*"

sql select="id,name, version"
sql select="max(name) as maxName"
Example Where Statements
sql where="a like "%top"

sql where="a > 5"
sql where="a <> 5"
sql where="a <> 5 and b <> ''"
Example Order By Statements
sql orderby="a"

sql orderby="a, b"
sql orderby="a desc, b asc"
Example Limit/Offset Statements
sql limit=1

// offset 1 limit 5
sql limit=1,5
Advanced piping
sql data=[{a:1,b:2},{a:3,b:4},{a:5,b:6}] where="a > 1" | printTable

╔═══╤═══╗
║ a │ b ║
╠═══╪═══╣
║ 3 │ 4 ║
╟───┼───╢
║ 5 │ 6 ║
╚═══╧═══╝