This topic describes commands for partitioned tables.
Classification | Command for partitioned tables | Description |
---|---|---|
Creation | CREATE TABLE... PARTITION BY | Creates a partitioned table. |
CREATE TABLE ... PARTITION BY HASH | Creates a hash partitioned table for which the number of partitions is specified. | |
Change | ALTER TABLE...ADD PARTITION | Adds a partition to an existing partitioned table. |
ALTER TABLE...ADD SUBPARTITION | Adds a subpartition to an existing subpartitioned partition. | |
ALTER TABLE...EXCHANGE PARTITION | Swaps an existing table with a partition or a subpartition. | |
ALTER TABLE...MOVE PARTITION | Moves a partition or a subpartition to a different tablespace. | |
ALTER TABLE...RENAME PARTITION | Renames a table partition. | |
ALTER TABLE...SPLIT PARTITION | Divides a partition into two partitions and redistributes the content of the partition between the new partitions. | |
ALTER TABLE...SPLIT SUBPARTITION | Divides a subpartition into two subpartitions and redistributes the content of the subpartition between the new subpartitions. | |
ALTER TABLE…MERGE PARTITION | Merges two partitions into a new partition that has the content of the original two partitions. | |
ALTER TABLE...MERGE SUBPARTITION | Merges two subpartitions into a new subpartition that has the content of the two original two subpartitions. | |
Deletion | ALTER TABLE... DROP PARTITION | Deletes a partition structure and the data that is stored in the partition. |
ALTER TABLE... DROP SUBPARTITION | Deletes a subpartition structure and the data that is stored in the subpartition. | |
ALTER TABLE...TRUNCATE PARTITION | Removes the data from a specified partition but leaves the partition structure intact. | |
ALTER TABLE...TRUNCATE SUBPARTITION | Removes all the data from a specified subpartition but leaves the subpartition structure intact. | |
DROP TABLE | Deletes a schema and the data that is stored in the table. | |
TRUNCATE TABLE | Removes all the data from a table and retains the schema. | |
Query | Query a specified partition | Queries a specified partition or subpartition. |