---
title: "SQL Query for All Tables and Fields in an Oracle Db"  
description: "SQL Query for All Tables and Fields in an Oracle Db"  
author: "Utpal Vishwas"  
published: 2023-07-17  
updated: 2023-07-18  
canonical: https://www.mindstick.com/forum/159126/sql-query-for-all-tables-and-fields-in-an-oracle-db  
category: "oracle"  
tags: ["database", "database table", "oracle"]  
reading_time: 2 minutes  

---

# SQL Query for All Tables and Fields in an Oracle Db

[SQL Query](https://www.mindstick.com/forum/529/rename-table-name-and-column-name-using-sql-query) for All [Tables](https://www.mindstick.com/articles/336597/introduction-of-html-tables-for-web-development) and [Fields](https://www.mindstick.com/interview/23496/what-are-tables-and-fields) in an [Oracle](https://www.mindstick.com/articles/13016/alter-table-statement-or-command-in-oracle) Db

## Replies

### Reply by Aryan Kumar

Sure, here are some [SQL](https://www.mindstick.com/articles/13115/types-of-keys-in-sql-or-oracle-database) queries for all tables and fields in an Oracle database:

SQL

```plaintext
-- List all tables in the database.
SELECT table_name
FROM all_tables;

-- List all tables in the current user's schema.
SELECT table_name
FROM user_tables;

-- List all tables in the database, including the owner of the table.
SELECT table_name, owner
FROM all_tables;

-- List all tables in the database, including the owner of the table and the data type of each column.
SELECT table_name, owner, column_name, data_type
FROM all_tab_cols;

-- List all tables in the database, including the owner of the table, the data type of each column, and the default value for each column.
SELECT table_name, owner, column_name, data_type, default_value
FROM all_tab_cols;
```

To run these queries, you will need to connect to the Oracle database using a tool like SQL*Plus. Once you are connected, you can run the [query](https://www.mindstick.com/blog/202/sub-query-in-sqlserver) by typing it into the SQL*Plus prompt.

For example, to run the first query above, you would type the following into the SQL*Plus prompt:

SQL

```plaintext
SELECT table_name
FROM all_tables;
```

This would return a list of all tables in the database.


---

Original Source: https://www.mindstick.com/forum/159126/sql-query-for-all-tables-and-fields-in-an-oracle-db

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
