Database Reference
In-Depth Information
You can use the SHOW command to list the tables in either the current
databaseorotherdatabases.The DESCRIBE commandcanalsobeusedwith
tables:
SHOW TABLES;
SHOW TABLES IN default;
DESCRIBE MsBigData.customer;
NOTE
You might have noticed that no primary or foreign keys are defined on
these tables, nor any NOT NULL or other column constraints. Hive
doesn't support these options because it doesn't have any way to
enforce constraints on the data. In a relational system, these
constraints help enforce data quality and consistency and are generally
enforced when the data is inserted into a table (schema on write). Hive
doesn't control the data, so it can't enforce the constraints.
Tables can be removed by using the DROP TABLE command, and renamed
using the ALTER TABLE statement. Columns can be renamed or have their
types changed using CHANGE COLUMN , and they can be added or deleted
using ADD COLUMNS and REPLACE COLUMNS , respectively. Replacing
columns deletes any column not included in the new column list:
DROP TABLE MsBigData.customer2;
ALTER TABLE customer RENAME TO customer_backup;
ALTER TABLE customer_backup
CHANGE COLUMN name fullname STRING;
ALTER TABLE customer_backup
ADD COLUMNS (
country STRING);
ALTER TABLE customer_backup
REPLACE COLUMNS (
name STRING,
city STRING,
state STRING,
Search WWH ::




Custom Search