Skip to main content

Table operations

In seekdb, you can modify the row format, block size, and character set of a table, and rename a table.

Modify the row format

The syntax for modifying the row format is as follows:

ALTER TABLE table_name ROW_FORMAT = {DEFAULT | DYNAMIC | FIXED | COMPRESSED | REDUNDANT | COMPACT};

The syntax for modifying the row format is as follows:

ALTER TABLE t1 ROW_FORMAT = COMPRESSED;
Query OK, 0 rows affected (0.001 sec)

Modify the block size

The syntax for modifying the block size is as follows:

ALTER TABLE table_name BLOCK_SIZE = value;

Here is an example of modifying the block size:

ALTER TABLE t1 BLOCK_SIZE = 1024;
Query OK, 0 rows affected (0.002 sec)

Change the character set

The syntax for changing the character set is as follows:

ALTER TABLE table_name CONVERT TO CHARACTER SET charset_name;

Here is an example of changing the character set:

ALTER TABLE test_collation CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;
Query OK, 0 rows affected (0.003 sec)

Rename a table

The syntax for renaming a table is as follows:

ALTER TABLE old_tbl_name RENAME TO new_tbl_name;

Here is an example of renaming a table:

ALTER TABLE t1 RENAME TO t2;
Query OK, 0 rows affected (0.008 sec)