C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
SQLite GLOB Clause (Operator)The SQLite GLOB operator matches only text values against a pattern by using wildcards. When the search expression is matched with the pattern expression, the GLOB operator will return true which is 1. The GLOB operator follows syntax of UNIX for specifying THE following wildcards.
Syntax: Syntax for asterisk sign: SELECT FROM table_name WHERE column GLOB 'XXXX*' or SELECT FROM table_name WHERE column GLOB '*XXXX*' Syntax for question mark: SELECT FROM table_name WHERE column GLOB 'XXXX?' or SELECT FROM table_name WHERE column GLOB '?XXXX' or SELECT FROM table_name WHERE column GLOB '?XXXX?' or SELECT FROM table_name WHERE column GLOB '????' Example: We have a table named "STUDENT" having following data: In these examples the WHERE statement having different BLOB clause with '*' and '?' operators:
Example1: Select all records from "STUDENT" table where AGE start with 2: SELECT * FROM STUDENT WHERE AGE GLOB '2*'; Output: Example2: Select all records from table "STUDENT" where FEES start with 2: SELECT * FROM STUDENT WHERE FEES GLOB '2*'; Output:
Next TopicSQLite Limit Clause
|