在直线中使用 hive 和使用简单select
查询时,我想在列名中返回没有表名的表作为默认值。
例子
数据
以简单表(TutorialsPoint)为例:
CREATE TABLE IF NOT EXISTS employee ( eid int, name String,
salary String, destination String)
COMMENT 'Employee details'
ROW FORMAT DELIMITED
FIELDS TERMINATED BY '\t'
LINES TERMINATED BY '\n'
STORED AS TEXTFILE;
SELECT
查询返回:
SELECT * FROM employee;
+---------------+----------------+------------------+-----------------------+--+
| employee.eid | employee.name | employee.salary | employee.destination |
+---------------+----------------+------------------+-----------------------+--+
+---------------+----------------+------------------+-----------------------+--+
期望的结果
使用以下方法可以达到预期的结果AS
:
SELECT eid AS eid, name AS name, salary AS salary,
destination AS destination FROM employee;
+------+-------+---------+--------------+--+
| eid | name | salary | destination |
+------+-------+---------+--------------+--+
+------+-------+---------+--------------+--+
问题
我想避免AS
每次运行select
查询时都键入并返回列名中没有表名的结果作为默认行为。