delete
delete, keyword
The delete statement removes a secondary dimension from a table.
table Products = with
[| as Product, as Category |]
[| "Tomato", "Fresh" |]
[| "Ships", "Dry" |]
[| "Apple", "Dry" |]
table Categories[c] = by Products.Category
delete Products.c
// 'where' has no effect on 'Products' as dimension 'c' has been removed
where c == "Fresh"
show table "Products" with // 3 lines displayed
Products.Product
Products.Category
This outputs the following table:
| Product | Category |
|---|---|
| Tomato | Fresh |
| Ships | Dry |
| Apple | Dry |
delete can also remove regular columns, which is useful before operations that depend on all columns (for example union) or to drop heavy columns before enforcing small.
table Products = with
[| as Id, as Label, as Color |]
[| 10, "Hat", "red" |]
[| 12, "Shirt", "blue" |]
delete Products.Label
show table "Products" with Products.Id, Products.Color
This outputs the following table:
| Id | Color |
|---|---|
| 10 | red |
| 12 | blue |