languageEnglish

Select from dual in SQL / Hive

visibility 1,460 comment 0 access_time 3 years ago

In Oracle database, you can select from dual table if you only want to return a one row result set. In many other databases, the query engine supports select directly from constant values without specifying a table name. 

In Hive, there is no system table named Dual. However you can directly created table name Dual.

Alternatively, you can also directly query from constant values or built-in functions without specifying a table name.

Code snippet

CREATE TABLE DUAL(Dummy VARCHAR(1));
INSERT INTO DUAL VALUES ('X');
SELECT CURRENT_DATE from DUAL;
SELECT CURRENT_DATE;
info Last modified by Raymond 3 years ago copyright This page is subject to Site terms.

Subscribe newsletter

Please log in or register to comment.

account_circle Log in person_add Register

Log in with external accounts

More from Kontext

visibility 7
thumb_up 0
access_time 9 days ago
Apache Hive 3.1.2 Installation on Linux Guide
visibility 3237
thumb_up 1
access_time 9 months ago