---
schema_version: "1"
id: b8a35a698a6a44527d19c377d79801815b1afb49e4b6158c1d5bf1a6c00b1bb2
title: LEFT
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/data-cloud/data-cloud-query-guide/references/data-cloud-sql-reference/scalar-func/string-func/left.md
canonical_url: https://developer.salesforce.com/docs/data/data-cloud-query-guide/references/dc-sql-reference/left.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: c4d7be4196b3d99d38c53e1db9585240587a46c72f54f34b9c62adf27adc48be
products:
  - Data 360 Query Guide
  - Data 360 Developer Documentation
---
# `LEFT`

**Applies to:** ✅ Data 360 SQL ✅ Tableau Hyper API

Returns the first _n_ characters from a string.

## Syntax

```sql
left(<string>, <n>)
```

## Arguments

### Required

- `<string>`: The source string.
- `<n>`: The number of characters to return. When negative, returns all but the last |_n_| characters.

## Returns

Returns a text value that contains the leftmost characters.

## Considerations

- When _n_ is negative, returns all but the last |_n_| characters.
- If _n_ exceeds string length, returns the entire string.

## Examples

### Get First Characters

Extract the first two characters.

```sql
SELECT left('abcde', 2) AS result;
```

Returns `'ab'`.

## Related Documentation

- [String Types](https://developer.salesforce.com/docs/data/data-cloud-query-guide/datatype/string.md)
