Skip to content

delete

Delete rows or columns from a table, entries from a dictionary, or objects from a namespace

delete from texp [where pw] delete ps from texp

delete is a qSQL query template and varies from regular q syntax

For the Delete operator !, see Functional SQL

Table rows

Where

  • texp is a table
  • pw is a condition

deletes from t rows matching pw.

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

Where

  • texp is a table
  • ps a list of column names

deletes from t columns ps.

q)show delete n from table
a
-
a
b
c

Dictionary entries

Where

  • texp is a dictionary
  • ps a list of keys to it

deletes from texp 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.

qSQL

Namespace objects

Where

  • texp is a namespace
  • ps a 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$()

qSQL

DevOps Borat on delete