# Manage catalogs, databases, and tables

Browse, create, and maintain catalogs, databases, and tables in a target workspace. [Manage file storage](volumes-folders-files.md) handles volumes and files.

## Prerequisites

For common calling rules, first read [Prepare to call an API](../../api-call-basics.md).

Prepare access for the target workspace. You need a target catalog before creating a database and a target database before creating a table. Before starting, use the browse and detail actions below to obtain required resource IDs.

## Call sequence

1. Browse accessible catalogs, databases, and tables to decide whether to use an existing hierarchy or create new resources. Save the IDs needed for later operations. Use the relevant read actions to inspect system databases, tables in a database, table overviews, or full paths when needed.
2. To create a hierarchy, create the catalog first, then create a database in that catalog, and finally create a table in the target database.
3. To read or verify data, get table information first, then preview or retrieve data as required.
4. After an update, get the corresponding details to confirm current information. Before truncating or deleting, confirm the target object; query the object or data again afterward to confirm the result.

## API operations

### Browse the resource hierarchy

| What you need to do | API operation | Use it when |
| --- | --- | --- |
| Browse catalogs, databases, volumes, and tables | [Browse the resource catalog](../../../../reference/api/ai-studio/resource-center/catalog/browse-catalog.md) | Select existing resources or before creating new resources. |
| Query catalogs | [List Catalogs](../../../../reference/api/ai-studio/resource-center/catalog/list-catalogs.md) | Select a target catalog. |
| Query catalog details | [Get Catalog details](../../../../reference/api/ai-studio/resource-center/catalog/get-catalog.md) | Confirm current information for a target catalog. |
| Query databases | [List databases](../../../../reference/api/ai-studio/resource-center/catalog/list-databases.md) | Select a target database. |
| Query database details | [Get database details](../../../../reference/api/ai-studio/resource-center/catalog/get-database.md) | Confirm a target database. |
| Query objects in a database | [List database objects](../../../../reference/api/ai-studio/resource-center/catalog/list-database-objects.md) | Browse volumes, tables, and operators in a database. |
| View system databases | [Get the system tree](../../../../reference/api/ai-studio/resource-center/catalog/get-system-tree.md) | Read system databases and their hierarchy. |
| View tables in a database | [List database tables](../../../../reference/api/ai-studio/resource-center/catalog/list-database-table-leaves.md) | Obtain tables under a specified database. |

### Create and maintain catalogs and databases

| What you need to do | API operation | Use it when |
| --- | --- | --- |
| Create a catalog | [Create a Catalog](../../../../reference/api/ai-studio/resource-center/catalog/create-catalog.md) | Create a parent catalog and obtain its ID for later database creation. |
| Update a catalog | [Update a Catalog](../../../../reference/api/ai-studio/resource-center/catalog/update-catalog.md) | Modify an existing catalog. |
| Delete a catalog | [Delete a Catalog](../../../../reference/api/ai-studio/resource-center/catalog/delete-catalog.md) | You have handled lower-level objects. |
| View catalog references | [List Catalog references](../../../../reference/api/ai-studio/resource-center/catalog/list-catalog-references.md) | Check references before changing or deleting a catalog. |
| Create a database | [Create a database](../../../../reference/api/ai-studio/resource-center/catalog/create-database.md) | You identified the parent catalog. |
| Update a database | [Update a database](../../../../reference/api/ai-studio/resource-center/catalog/update-database.md) | Modify an existing database. |
| Delete a database | [Delete a database](../../../../reference/api/ai-studio/resource-center/catalog/delete-database.md) | You confirmed that the database is not used by a publication or subscription. |

### Manage tables and table data

| What you need to do | API operation | Use it when |
| --- | --- | --- |
| Check whether a table exists | [Check whether a table exists](../../../../reference/api/ai-studio/resource-center/catalog/check-table-exists.md) | Confirm a target table before creating or referencing it. |
| Create a table | [Create a table](../../../../reference/api/ai-studio/resource-center/catalog/create-table.md) | You identified the target database. |
| Query table information | [Get table information](../../../../reference/api/ai-studio/resource-center/catalog/get-table.md) | Confirm table definition and current information. |
| Batch query table information | [Batch get table information](../../../../reference/api/ai-studio/resource-center/catalog/batch-get-table-info.md) | Read information for several known tables at once. |
| View a table overview | [Get a table overview](../../../../reference/api/ai-studio/resource-center/catalog/get-table-overview.md) | View an aggregated current overview of a table. |
| View the full table path | [Get the full table path](../../../../reference/api/ai-studio/resource-center/catalog/get-table-full-path.md) | Confirm a table's full resource-hierarchy path. |
| Query table data | [Get table data](../../../../reference/api/ai-studio/resource-center/catalog/get-table-data.md) | Read sampled data from a table. |
| Preview table data | [Preview table data](../../../../reference/api/ai-studio/resource-center/catalog/preview-table-data.md) | Inspect table data first. |
| Download table data | [Download table data](../../../../reference/api/ai-studio/resource-center/catalog/download-table-data.md) | Obtain downloaded table data. |
| Run NL2SQL | [Run NL2SQL](../../../../reference/api/ai-studio/resource-center/catalog/run-nl2sql.md) | Convert a natural-language request to SQL and run it. |
| Truncate a table | [Truncate a table](../../../../reference/api/ai-studio/resource-center/catalog/truncate-table.md) | Delete all data while retaining the table definition after confirming the target table. |
| Delete a table | [Delete a table](../../../../reference/api/ai-studio/resource-center/catalog/delete-table.md) | Delete a table and its data after confirming the target. |
| Query table references | [List table references](../../../../reference/api/ai-studio/resource-center/catalog/list-table-references.md) | Check references before changing or deleting a table. |

## Confirm the result

After creation or an update, get details for the corresponding catalog, database, or table to confirm the object used for later operations. Preview or sample-query data before reading it. After truncation, query table data again to confirm that content is cleared; after deletion, use the hierarchy or object list to confirm that the target no longer appears.

## Limitations and notes

- Deleting a catalog is irreversible; handle lower-level objects first.
- Before deleting a database, confirm it is not used by a publication or subscription.
- Truncating a table removes all data while retaining its definition and is irreversible. Deleting a table removes the table and its data.
- A table-data query returns 100 rows by default when no explicit row count is supplied.

## Next steps

- [Manage file storage](volumes-folders-files.md)
- [Data publishing and subscription](data-publications-subscriptions.md)
