# Table and column capitalization

When working with CARTO, how your table and column names are handled depends on two factors: your data warehouse provider and how you access the data.

## How you access data matters

| Access method                                                      | How identifiers are handled                                                      |
| ------------------------------------------------------------------ | -------------------------------------------------------------------------------- |
| **Table sources** (Data Explorer, Builder table source, Workflows) | CARTO handles quoting automatically, but has limitations with non-standard names |
| **SQL Query sources** (Builder SQL editor)                         | You control quoting — full flexibility but requires knowledge of provider rules  |

## Provider-specific rules

Each data warehouse treats unquoted identifiers differently:

| Provider       | Default behavior           | Quote character     |
| -------------- | -------------------------- | ------------------- |
| **BigQuery**   | Case-sensitive (unchanged) | `` ` `` (backticks) |
| **Snowflake**  | Converted to UPPERCASE     | `"` (double quotes) |
| **PostgreSQL** | Converted to lowercase     | `"` (double quotes) |
| **Redshift**   | Converted to lowercase     | `"` (double quotes) |
| **Databricks** | Case-insensitive           | `` ` `` (backticks) |
| **Oracle**     | Converted to UPPERCASE     | `"` (double quotes) |

## Known limitations with table sources

When loading **tables** in Data Explorer, Builder (table source), or Workflows, certain column naming patterns are not fully supported.

### **Unsupported patterns**

| Provider          | Unsupported pattern                          | Example                   | Workaround                                           |
| ----------------- | -------------------------------------------- | ------------------------- | ---------------------------------------------------- |
| **Snowflake**     | Lowercase column names (created with quotes) | `"myColumn"`, `"revenue"` | Use SQL Query source, or rename columns to UPPERCASE |
| **Oracle**        | Lowercase column names (created with quotes) | `"myColumn"`, `"revenue"` | Use SQL Query source, or rename columns to UPPERCASE |
| **PostgreSQL**    | Uppercase column names (created with quotes) | `"MyColumn"`, `"Revenue"` | Use SQL Query source, or rename columns to lowercase |
| **All providers** | Columns with special characters              | `my-column`, `my column`  | Use SQL Query source, or rename columns              |
| **All providers** | SQL reserved words as column names           | `select`, `from`, `where` | Use SQL Query source, or rename columns              |

{% hint style="warning" %}
**Why this happens:** When you create a column with quotes in your warehouse (e.g., `"myColumn"` in Snowflake), the warehouse preserves that exact casing. However, when CARTO builds queries for table sources, it may not apply the required quoting for these edge cases.
{% endhint %}

## Using SQL Query sources

SQL Query sources give you full control over identifier quoting. Use the appropriate quote character for your warehouse:

### Snowflake

Double quotes preserve lowercase or mixed case:

```sql
SELECT "myColumn", "Revenue_2024" FROM "MySchema"."SalesData"
```

### PostgreSQL and Redshift

Double quotes preserve uppercase or mixed case:

```sql
SELECT "MyColumn", "Revenue_2024" FROM "public"."SalesData"
```

### BigQuery

Backticks for all identifiers; case is always preserved:

```sql
SELECT myColumn, Revenue_2024 FROM `project.dataset.SalesData`
```

### Databricks

Backticks for special characters; case doesn't matter:

```sql
SELECT myColumn FROM `my-catalog`.schema.sales_data
```

### Oracle

Double quotes preserve lowercase or mixed case:

```sql
SELECT "myColumn", "Revenue_2024" FROM SCHEMA_NAME."SalesData"
```

## Best practices

To ensure compatibility across all CARTO features, use naming conventions that match your provider's default behavior:

{% hint style="info" %}
**Recommended naming conventions**
{% endhint %}

| Provider                  | Recommended naming                    |
| ------------------------- | ------------------------------------- |
| **Snowflake**             | `UPPERCASE` or `UPPER_SNAKE_CASE`     |
| **PostgreSQL / Redshift** | `lowercase` or `snake_case`           |
| **BigQuery**              | Any consistent style (case-sensitive) |
| **Databricks**            | Any style (`snake_case` recommended)  |
| **Oracle**                | `UPPERCASE` or `UPPER_SNAKE_CASE`     |

**General guidelines:**

* Use `snake_case` with letters matching your provider's default (uppercase for Snowflake and Oracle, lowercase for PostgreSQL)
* Avoid spaces, hyphens, and special characters in names
* Avoid SQL reserved words (`select`, `from`, `where`, `order`, `group`, etc.)
* If you must use non-standard names, access the data via SQL Query source

## Troubleshooting

| Error                                                 | Likely cause                                          | Solution                                               |
| ----------------------------------------------------- | ----------------------------------------------------- | ------------------------------------------------------ |
| "Column not found" in Snowflake                       | Column was created with lowercase (quoted)            | Use SQL Query source with proper quoting: `"myColumn"` |
| "Column does not exist" in PostgreSQL                 | Column was created with uppercase (quoted)            | Use SQL Query source with proper quoting: `"MyColumn"` |
| "ORA-00904: invalid identifier" in Oracle             | Column was created with lowercase (quoted)            | Use SQL Query source with proper quoting: `"myColumn"` |
| Table loads but some columns missing                  | Column names use reserved words or special characters | Use SQL Query source                                   |
| Works in warehouse console, fails in CARTO table view | Non-standard identifier naming                        | Use SQL Query source instead                           |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.carto.com/carto-user-manual/maps/data-sources/table-and-column-capitalization.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
