# `SUBSTR`

**Applies to:** ✅ Data 360 SQL ✅ Tableau Hyper API

Extracts a substring from a string.

## Syntax

```sql
substr(<string>, <start> [, count])
```

## Arguments

### Required

- `<string>`: The source string.
- `<start>`: The starting position (1-based).

### Optional

- `count`: The number of characters to extract.

## Returns

Returns a text value containing the extracted substring.

## Considerations

- Same as `substring(string from start for count)` but with comma-separated arguments.
- Position indexing is 1-based.

## Examples

### Extract Substring

Extract two characters starting at position three.

```sql
SELECT substr('alphabet', 3, 2) AS result;
```

Returns `'ph'`.

## Related Documentation

- [String Types](/docs/data/data-cloud-query-guide/references/dc-sql-reference/string.md)
