OR QBE Operators

Learn to use the _or QBE operator to filter specific data from the car racing dataset through simple examples.

To perform a logical OR operation between two or more predicates, you can enclose each of the predicate in the curly braces, and provide them as values to an array for the _or operator.

Example 3-12 _or Operator

SELECT JSON_SERIALIZE(data PRETTY) AS data FROM GRAPHQL('
    driver (
        check: {
            _or: [
                {name: "Oscar Piastri"},
                {name: "Max Verstappen"}
            ]
        }
    ){
        id: driver_id
        name
        points
    }
');
In the above code example, the specified details of the driver table are retrieved when atleast one of the two conditions specified in the _or clause are met. In this case, you are checking driver's name is either "Oscar Piastri" or "Max Verstappen".
DATA                                                                           
--------------------------------------------------------------------------------
{                                                                              
  "id" : 105,                                                                  
  "name" : "Max Verstappen",                                                   
  "points" : 456                                                               
}                                                                              
                                                                                 
{                                                                              
  "id" : 102,                                                                  
  "name" : "Oscar Piastri",                                                    
  "points" : 384                                                               
}                                                                              
                                                                                 
 
2 rows selected.