创建teradata的表语法:
create table <DBname>.<Tablename>
as
select * from <DBname>.<Tablename>
with data;
以类似的方式,我们如何在Spark SQL中创建一个表?
在Spark SQL中也几乎相同。
示例:
CREATE TABLE tablename
STORED AS PARQUET LOCATION 'some/location/incase/of/external/table'
AS
SELECT *
FROM source_table
WHERE 1=1
正则表达式:(高级)
CREATE [TEMPORARY] [EXTERNAL] TABLE [IF NOT EXISTS] [db_name.]table_name
[(col_name data_type [COMMENT col_comment], ...)]
[COMMENT table_comment]
[
[ROW FORMAT row_format]
[STORED AS file_format]
]
[LOCATION path_to_save]
[AS select_statement]
btw,Spark支持更多的Hive语法和功能。您可以在此处引用ctas doc