Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]
Created on 03-01-2017 04:49 AM - edited 09-16-2022 04:10 AM
'Show tables' displays all the tables within Hive. Show databases displays all the database name.
How can I see database and tables exists inside same database?
e.g.
Database, table
db1, table1
db1,table2
db2,table1
Created 03-01-2017 05:01 AM
If you have permissions to query the Hive metastore database directly, you could:
[root@hadoop01 ~]# mysql -u hive -p
Enter password:
mysql> USE hive;
Database changed
mysql> SELECT
-> name AS db_name,
-> tbl_name
-> FROM TBLS
-> INNER JOIN DBS
-> ON TBLS.DB_ID = DBS.DB_ID;
+----------+-------------------+
| db_name | tbl_name |
+----------+-------------------+
| medicaid | physician_compare |
| medicaid | sample |
| medicaid | sample_orc |
+----------+-------------------+
3 rows in set (0.00 sec)
Created 03-01-2017 05:01 AM
If you have permissions to query the Hive metastore database directly, you could:
[root@hadoop01 ~]# mysql -u hive -p
Enter password:
mysql> USE hive;
Database changed
mysql> SELECT
-> name AS db_name,
-> tbl_name
-> FROM TBLS
-> INNER JOIN DBS
-> ON TBLS.DB_ID = DBS.DB_ID;
+----------+-------------------+
| db_name | tbl_name |
+----------+-------------------+
| medicaid | physician_compare |
| medicaid | sample |
| medicaid | sample_orc |
+----------+-------------------+
3 rows in set (0.00 sec)
Created 03-01-2017 05:06 AM
hive> USE DB1;
Now, commands such as SHOW TABLES, will list the tables in this database DB1