How to remove random rows from kdb table?

How to delete the first 10 rows from kdb table? I want to remove only the first 10 rows returned from:

select [10] from mytable 

I tried using delete with index i, but the number of rows is not decreasing:

 count mytable 2201784 delete from mytable where i < 10 count mytable 2201784 

Also, the delete operator returns a few lines of my Q console, not sure what it is.

+4
source share
3 answers

If you want to remove a place from a table, you must reference it by name.

 delete from `mytable where i < 10 

Alternatively reassign:

 mytable:delete from mytable where i<10 

When you start delete from mytable where i<10 it returns the table with the changes made, but does not apply them to mytable stored in memory.

http://code.kx.com/q/cookbook/faq/#how-do-i-delete-rows-from-a-table

Http://code.kx.com resources answer many questions regarding the daily use of kdb.

+5
source

you can use the drop _ operator in the table and have 10 as an argument LHS mytable: 10 _mytable

+3
source
 delete from mytable where i<10 
0
source

Source: https://habr.com/ru/post/1484393/


All Articles