SQLite Forum

Check Contraints
Login
You could, as one example, compile-in or load the REGEXP extension found in the ext\\misc directory <https://www.sqlite.org/src/dir?ci=tip&name=ext/misc> and use the following CREATE TABLE statement:

```
create table Vehicle
(
    Vin         text not null primary key,
    Odometer    integer not null,
    check (Vin regexp '^[A-Z0-9]+$')
);
```

LIKE (or GLOB) will not work since the wildcard (%, _, *, ?) match any character so the LIKE expression that you gave will match any sequence of characters that contains one upper-case letter or number within it (assuming you have set case sensitive like).

The regular expression above will match a string entirely composed only of one or more uppercase letters or numbers.