Table Of Contents

6.4. Alter table

6.4.1. Synopsis

 ALTER TABLE { <entries> | <find_expression> } [, ... ] ADD
   { <column_name> <data_type> }
   [, ... ]

find_expression ::=
  FIND ( { <tag_expression> | NOT <tag_expression> } [ AND ... ] )

tag_expression ::=
  TAG = 'tag_name'

6.4.2. Description

ALTER TABLE will modify one or more tables in a QuasarDB cluster by adding columns with the specified schema. The statement is transactional.

6.4.3. Parameters

table_name
The name of the table to be modified. Can be alphanumeric, but is not allowed to start with a number.
find_expression
When your tables are tagged, you can use inline key/value lookups to perform your query over multiple tables. To match all tables that have the tag “stocks”, you can use FIND(tag='stocks' AND type=ts).
column_name
The name of a column to be added to the table. Can be alphanumeric, but is not allowed to start with a number.
data_type
The data type to be associated with the column. Can be any of INT64, DOUBLE, BLOB or TIMESTAMP.

6.4.4. Examples

Add a single column to an existing table:

ALTER TABLE example ADD my_int INT64

Add multiple columns to an existing table:

ALTER TABLE example ADD my_int INT64, my_double DOUBLE, my_blob BLOB, my_ts TIMESTAMP
arrow_backPrevious
6.3. Drop table
Next arrow_forward
6.5. Show tables