Oxibase supports a comprehensive set of SQL operators for building expressions in SELECT, WHERE, HAVING, and other clauses.
Comparison Operators
Operator
Description
Example
=
Equal
WHERE id = 5
<> or !=
Not equal
WHERE status <> 'deleted'
<
Less than
WHERE price < 100
<=
Less than or equal
WHERE age <= 65
>
Greater than
WHERE score > 90
>=
Greater than or equal
WHERE date >= '2024-01-01'
Logical Operators
Operator
Description
Example
AND
Both conditions true
WHERE a > 1 AND b < 10
OR
Either condition true
WHERE status = 'active' OR status = 'pending'
NOT
Negates a condition
WHERE NOT deleted
Arithmetic Operators
Operator
Description
Example
+
Addition
SELECT price + tax
-
Subtraction
SELECT total - discount
*
Multiplication
SELECT quantity * price
/
Division
SELECT total / count
%
Modulo (remainder)
SELECT id % 10
Bitwise Operators
Operator
Description
Example
&
Bitwise AND
SELECT flags & 0x0F
\|
Bitwise OR
SELECT flags \| 0x10
^
Bitwise XOR
SELECT a ^ b
~
Bitwise NOT
SELECT ~flags
<<
Left shift
SELECT 1 << 4 (returns 16)
>>
Right shift
SELECT 16 >> 2 (returns 4)
String Operators
Concatenation
-- Using || operatorSELECTfirst_name||' '||last_nameASfull_nameFROMusers;-- Using CONCAT functionSELECTCONCAT(first_name,' ',last_name)ASfull_nameFROMusers;
Pattern Matching
LIKE (Case-Sensitive)
-- % matches any sequence of charactersSELECT*FROMproductsWHEREnameLIKE'Apple%';-- Starts with 'Apple'SELECT*FROMproductsWHEREnameLIKE'%Phone';-- Ends with 'Phone'SELECT*FROMproductsWHEREnameLIKE'%Pro%';-- Contains 'Pro'-- _ matches any single characterSELECT*FROMproductsWHEREcodeLIKE'A_C';-- Matches 'ABC', 'A1C', etc.
ILIKE (Case-Insensitive)
-- Same as LIKE but ignores caseSELECT*FROMproductsWHEREnameILIKE'apple%';-- Matches 'Apple', 'APPLE', 'apple'SELECT*FROMusersWHEREemailILIKE'%@gmail.com';
GLOB (Shell-Style Patterns)
-- * matches any sequence of characters (like % in LIKE)SELECT*FROMfilesWHEREnameGLOB'*.txt';-- ? matches any single character (like _ in LIKE)SELECT*FROMfilesWHEREnameGLOB'file?.dat';-- [...] matches any character in the setSELECT*FROMfilesWHEREnameGLOB'[abc]*';
REGEXP (Regular Expressions)
-- Full regex pattern matchingSELECT*FROMlogsWHEREmessageREGEXP'error|warning';SELECT*FROMusersWHEREemailREGEXP'^[a-z]+@[a-z]+\.[a-z]+$';SELECT*FROMdataWHEREvalueREGEXP'[0-9]{3}-[0-9]{4}';
Range Operators
BETWEEN
-- Inclusive range checkSELECT*FROMproductsWHEREpriceBETWEEN10AND100;-- Equivalent to:SELECT*FROMproductsWHEREprice>=10ANDprice<=100;-- Works with datesSELECT*FROMordersWHEREorder_dateBETWEEN'2024-01-01'AND'2024-12-31';-- NOT BETWEENSELECT*FROMproductsWHEREpriceNOTBETWEEN10AND100;
IN
-- Check if value is in a listSELECT*FROMproductsWHEREcategoryIN('Electronics','Computers','Phones');-- With numbersSELECT*FROMordersWHEREstatus_idIN(1,2,3);-- NOT INSELECT*FROMproductsWHEREcategoryNOTIN('Discontinued','Archived');-- With subquerySELECT*FROMcustomersWHEREidIN(SELECTcustomer_idFROMordersWHEREtotal>1000);
NULL Operators
-- Check for NULLSELECT*FROMusersWHEREdeleted_atISNULL;-- Check for NOT NULLSELECT*FROMusersWHEREemailISNOTNULL;-- Note: = and <> don't work with NULLSELECT*FROMusersWHEREvalue=NULL;-- Always returns no rows!SELECT*FROMusersWHEREvalueISNULL;-- Correct way
-- Without parentheses: AND has higher precedence than ORSELECT*FROMproductsWHEREcategory='A'ORcategory='B'ANDprice>100;-- Equivalent to: category = 'A' OR (category = 'B' AND price > 100)-- With parentheses: explicit groupingSELECT*FROMproductsWHERE(category='A'ORcategory='B')ANDprice>100;
-- Check if specific bit is setSELECT*FROMpermissionsWHERE(flags&0x04)=0x04;-- Check bit 2-- Set a bitUPDATEpermissionsSETflags=flags|0x04WHEREuser_id=1;-- Clear a bitUPDATEpermissionsSETflags=flags&~0x04WHEREuser_id=1;