Database Reference
In-Depth Information
CREATE [EXTERNAL] TABLE [IF NOT EXISTS]
[db_name.]table_name
[(col_namedata_type [COMMENT 'col_comment'],
...)]
[COMMENT 'table_comment']
[PARTITIONED BY
(col_namedata_type [COMMENT 'col_comment'], ...)
]
[ [ROW FORMAT row_format] [STORED AS
file_format] ]
[LOCATION 'hdfs_path']
data_type
: primitive_type
primitive_type
:TINYINT | SMALLINT | INT | BIGINT |
BOOLEAN
| FLOAT | DOUBLE | STRING | TIMESTAMP
row_format
: DELIMITED [FIELDS TERMINATED BY 'char'
[ESCAPED BY 'char']]
[LINES TERMINATED BY 'char']
file_format:
: PARQUETFILE | SEQUENCEFILE | TEXTFILE |
RCFILE
When a new table is created based on some other table, the LIKE clause is used.
There are many places on the internet to learn about the CREATE TABLE SQL state-
ment.
The CREATE EXTERNAL TABLE statement
While using the CREATE EXTERNAL TABLE syntax, the newly created table points
to an existing data file on HDFS. Using this statement, the file data is not imported
from the existing data file on HDFS to the new table; instead the new table points to
the data file on HDFS while the new table is empty. When external is not defined, the
data is copied to the new table so the table itself has the data. The process to query
the data does not change and still remains the same.
Search WWH ::




Custom Search