---
title: "SQLTables"
language: "en"
type: "Symbol"
summary: "SQLTables[conn] returns the SQLTable objects for each table in an SQL connection. SQLTables[conn, table] returns objects for tables matching table."
canonical_url: "https://reference.wolfram.com/language/DatabaseLink/ref/SQLTables.html"
source: "Wolfram Language Documentation"
related_guides: 
  - 
    title: "DatabaseLink SQL Operations"
    link: "https://reference.wolfram.com/language/DatabaseLink/guide/SQLDatabaseOperations.en.md"
  - 
    title: "DatabaseLink Tables and Data"
    link: "https://reference.wolfram.com/language/DatabaseLink/guide/DatabaseInformation.en.md"
related_functions: 
  - 
    title: "SQLTable"
    link: "https://reference.wolfram.com/language/DatabaseLink/ref/SQLTable.en.md"
  - 
    title: "SQLTableNames"
    link: "https://reference.wolfram.com/language/DatabaseLink/ref/SQLTableNames.en.md"
  - 
    title: "SQLTableInformation"
    link: "https://reference.wolfram.com/language/DatabaseLink/ref/SQLTableInformation.en.md"
  - 
    title: "SQLTableTypeNames"
    link: "https://reference.wolfram.com/language/DatabaseLink/ref/SQLTableTypeNames.en.md"
  - 
    title: "SQLCreateTable"
    link: "https://reference.wolfram.com/language/DatabaseLink/ref/SQLCreateTable.en.md"
related_tutorials: 
  - 
    title: "DatabaseLink User Guide"
    link: "https://reference.wolfram.com/language/DatabaseLink/tutorial/Overview.en.md"
  - 
    title: "Table Structure in DatabaseLink User Guide"
    link: "https://reference.wolfram.com/language/DatabaseLink/tutorial/TableStructure.en.md"
  - 
    title: "Creating Tables in DatabaseLink User Guide"
    link: "https://reference.wolfram.com/language/DatabaseLink/tutorial/CreatingTables.en.md"
---
## DatabaseLink\`

# SQLTables

SQLTables[conn] returns the SQLTable objects for each table in an SQL connection.

SQLTables[conn, table] returns objects for tables matching table.

## Details and Options

* To use ``SQLTables``, you first need to load [*DatabaseLink*](https://reference.wolfram.com/language/DatabaseLink/guide/SQLDatabaseOperations.en.md) using ``Needs["DatabaseLink`"]``.

* The following options can be given:

|              |         |                         |
| ------------ | ------- | ----------------------- |
| "Catalog"    | None    | database catalog to use |
| "Schema"     | None    | database schema to use  |
| "TableType"  | "TABLE" | type of table to return |

## Examples (2)

### Basic Examples (1)

```wl
In[1]:= Needs["DatabaseLink`"]
```

If you find that the examples in this section do not work as shown, you may need to install or restore the example database with the ``"DatabaseLink`DatabaseExamples`"`` package, as described in [Using the Example Databases](https://reference.wolfram.com/language/DatabaseLink/tutorial/UsingTheExampleDatabases.en.md).

```wl
In[2]:= conn = OpenSQLConnection["publisher"];
```

List all the tables:

```wl
In[3]:= SQLTables[conn]

Out[3]= {SQLTable["AUTHORS", "TableType" -> "TABLE"], SQLTable["EDITORS", "TableType" -> "TABLE"], SQLTable["PUBLISHERS", "TableType" -> "TABLE"], SQLTable["ROYSCHED", "TableType" -> "TABLE"], SQLTable["SALES", "TableType" -> "TABLE"], SQLTable["SALESDETAILS", "TableType" -> "TABLE"], SQLTable["TITLEAUTHORS", "TableType" -> "TABLE"], SQLTable["TITLEDITORS", "TableType" -> "TABLE"], SQLTable["TITLES", "TableType" -> "TABLE"]}
```

Get a specific table by name:

```wl
In[4]:= SQLTables[conn, "AUTHORS"]

Out[4]= {SQLTable["AUTHORS", "TableType" -> "TABLE"]}
```

Get the tables that match a pattern:

```wl
In[5]:= SQLTables[conn, "TITLE%"]

Out[5]= {SQLTable["TITLEAUTHORS", "TableType" -> "TABLE"], SQLTable["TITLEDITORS", "TableType" -> "TABLE"], SQLTable["TITLES", "TableType" -> "TABLE"]}

In[6]:= CloseSQLConnection[conn];
```

If you find that the examples in this section do not work as shown, you may need to install or restore the example database with the ``"DatabaseLink`DatabaseExamples`"`` package, as described in [Using the Example Databases](https://reference.wolfram.com/language/DatabaseLink/tutorial/UsingTheExampleDatabases.en.md).

### Options (1)

#### "TableType" (1)

```wl
In[1]:= Needs["DatabaseLink`"]
```

Get all types of tables in a data source:

```wl
In[2]:= conn = OpenSQLConnection["publisher"];

In[3]:= SQLTables[conn, "TableType" -> SQLTableTypeNames[conn]]

Out[3]= {SQLTable["ADMINISTRABLE_ROLE_AUTHORIZATIONS", "TableType" -> "SYSTEM TABLE"], SQLTable["APPLICABLE_ROLES", "TableType" -> "SYSTEM TABLE"], SQLTable["ASSERTIONS", "TableType" -> "SYSTEM TABLE"], SQLTable["AUTHORIZATIONS", "TableType" -> "SYSTEM TAB ... > "TABLE"], SQLTable["SALES", "TableType" -> "TABLE"], SQLTable["SALESDETAILS", "TableType" -> "TABLE"], SQLTable["TITLEAUTHORS", "TableType" -> "TABLE"], SQLTable["TITLEDITORS", "TableType" -> "TABLE"], SQLTable["TITLES", "TableType" -> "TABLE"]}

In[4]:= CloseSQLConnection[conn];
```

## See Also

* [SQLTable](https://reference.wolfram.com/language/DatabaseLink/ref/SQLTable.en.md)
* [SQLTableNames](https://reference.wolfram.com/language/DatabaseLink/ref/SQLTableNames.en.md)
* [SQLTableInformation](https://reference.wolfram.com/language/DatabaseLink/ref/SQLTableInformation.en.md)
* [SQLTableTypeNames](https://reference.wolfram.com/language/DatabaseLink/ref/SQLTableTypeNames.en.md)
* [SQLCreateTable](https://reference.wolfram.com/language/DatabaseLink/ref/SQLCreateTable.en.md)

## Tech Notes

* [*DatabaseLink* User Guide](https://reference.wolfram.com/language/DatabaseLink/tutorial/Overview.en.md)
* [Table Structure in *DatabaseLink* User Guide](https://reference.wolfram.com/language/DatabaseLink/tutorial/TableStructure.en.md)
* [Creating Tables in *DatabaseLink* User Guide](https://reference.wolfram.com/language/DatabaseLink/tutorial/CreatingTables.en.md)

## Related Guides

* [DatabaseLink SQL Operations](https://reference.wolfram.com/language/DatabaseLink/guide/SQLDatabaseOperations.en.md)
* [DatabaseLink Tables and Data](https://reference.wolfram.com/language/DatabaseLink/guide/DatabaseInformation.en.md)