SingleStore : Alter tables

>

SingleStore : Alter tables

This tutorials will explain how to alter tables in SingleStore. This alteration may not be limited to addition of new column, drop existing column or rename column.



➠ Restrictions on altering a table
➠ Table for Examples: Lets create below table for demonstrating alter commands.

CREATE ROWSTORE TABLE singlestoreAlterTest_Rowstore
(  
  emp_no INTEGER,
  emp_name VARCHAR(50),
  job_title VARCHAR(30),
  manager_id INTEGER,
  hire_date Date,
  salary DECIMAL(18,2),
  commission DECIMAL(18,2),
  dept_no INTEGER,
  SHARD KEY (emp_no),
  KEY (dept_no)
);


CREATE TABLE singlestoreAlterTest_Columnstore
(  
  emp_no INTEGER,
  emp_name VARCHAR(50),
  job_title VARCHAR(30),
  manager_id INTEGER,
  hire_date Date,
  salary DECIMAL(18,2),
  commission DECIMAL(18,2),
  dept_no INTEGER,
  SHARD KEY (emp_no),
  KEY (dept_no) USING CLUSTERED COLUMNSTORE
);


➠ Various examples of altering tables in SingleStore