delete¶
Delete rows or columns from a table, entries from a dictionary, or objects from a namespace
delete from x
delete from x where pw
delete ps from x
delete is a qSQL query template and varies from regular q syntax
For the Delete operator !, see
Functional SQL
Table rows¶
delete from x
delete from x where pw
Where
xis a tablepwis a condition
deletes from x rows matching pw, or all rows if where pw not specified.
q)show table: ([] a: `a`b`c; n: 1 2 3)
a n
---
a 1
b 2
c 3
q)show delete from table where a = `c
a n
---
a 1
b 2
Attributes may or may not be dropped: reapply or remove as needed
Table columns¶
delete from x
delete ps from x
Where
xis a tablepsa list of column names
deletes from x columns ps or all columns if ps not specified.
q)show delete n from table
a
-
a
b
c
Dictionary entries¶
delete from x
delete ps from x
Where
xis a dictionarypsa list of keys to it
deletes from x entries for ps.
q)show d:`a`b`c!til 3
a| 0
b| 1
c| 2
q)delete b from `d
`d
q)d
a| 0
c| 2
Cond is not supported inside q-SQL expressions
Enclose in a lambda or use Vector Conditional instead.
Namespace objects¶
delete from x
delete ps from x
Where
xis a namespacepsa symbol atom or vector of name/s defined in it
deletes the named objects from the namespace.
q)a:1
q)\v
,`a
q)delete a from `.
`.
q)\v
`symbol$()