Table operations include modifying row formats, block sizes, converting character sets, and renaming tables.
Modify row format
The syntax for modifying row format is as follows:
ALTER TABLE table_name ROW_FORMAT = {DEFAULT | DYNAMIC | FIXED | COMPRESSED | REDUNDANT | COMPACT};
The syntax for modifying row format is as follows:
obclient> ALTER TABLE t1 ROW_FORMAT = COMPRESSED;
Query OK, 0 rows affected
Modify block size
The syntax for modifying the block size is as follows:
ALTER TABLE table_name BLOCK_SIZE = value;
The following example shows how to modify the block size:
obclient> ALTER TABLE t1 BLOCK_SIZE = 1024;
Query OK, 0 rows affected
Convert character sets
The syntax for converting character sets is as follows:
ALTER TABLE table_name CONVERT TO CHARACTER SET charset_name;
An example of converting character sets is as follows:
obclient> ALTER TABLE test_collation CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;
Query OK, 0 rows affected
Rename a table
The syntax for renaming a table is as follows:
ALTER TABLE old_tbl_name RENAME TO new_tbl_name;
The following example shows how to rename a table:
obclient> ALTER TABLE t1 RENAME TO t2;
Query OK, 0 rows affected