What the difference in the following to query ?
FROM COMPANY WHERE ADDRESS GLOB '*-*';
FROM COMPANY WHERE ADDRESS LIKE '%-%';
I know unlike LIKE operator, GLOB is case sensitive. Is it the only difference ?
SQLite GLOB operator is used to match only text values against a pattern using wildcards. If the search expression can be matched to the pattern expression, the GLOB operator will return true, which is 1. Unlike LIKE operator, GLOB is case sensitive and it follows syntax of UNIX for specifying THE following wildcards.
The SQLite LIKE condition allows wildcards to be used in the WHERE clause of a SELECT, INSERT, UPDATE, or DELETE statement. This allows you to perform pattern matching.
Overview of SQLite IIF() function In practice, you use the IIF() function to add the if-else logic to queries to form more flexible queries.
For one thing, databases vary considerably in how they handle text; for example, while some databases are case-sensitive by default (e.g. Sqlite, PostgreSQL), others are case-insensitive (SQL Server, MySQL).
Other difference that GLOB you can use it as regular expression i.e. : to select fields which end with number use GLOB '*[0-9]'
to select fields which doesn't contain any number use GLOB '[^0-9]
The documentation says:
The GLOB operator is similar to LIKE but uses the Unix file globbing syntax for its wildcards. Also, GLOB is case sensitive, unlike LIKE.
And that's it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With