First page  -  Tutorials  -  Quick tips  -  Info  -  Contact me
Go to sodadb

Tutorial: use advanced search queries

by Derek on June 3, 2012

With Soadb you can use advanced SQL-like queries. It looks a bit daunting at first glance,
but bear with me, it’s much easier than you might think. And the rewards are high.

Within Sodadb, you can use AND, OR, BETWEEN, REGEXP, wildcards, greater and smaller than and LIKE. And: you can save those queries, to be used later by clicking the save search button. To get the saved queries, click the blue arrow in the searchfield.

Okay, let’s start.

Using AND – OR

For instance you have these fields:
First name – Last name – Address

When writing a query, make sure to encapsulate your fieldnames with ##.
This way Sodadb knows you’ve entered a fieldname. Some examples:

Query: All people with first name Derek or Otto
#first name# = ‘Derek’ OR #first name# = ‘Otto’

Query: All people with first name Derek and last name Brown
#first name# = ‘Derek’ AND #last name# = ‘Brown’

Single quote and !=

Query: All people with last name O’Connel (a single quote in name)
#last name# = ‘O\’Connel’

Query: All people except Derek
#first name# != ‘Derek’

Using greater or smaller than

For instance you have these fields:
Number of CDs – Artist – Albums

Query: All Artist with more then 5 records
#Number of CDs# > ’5′

Query: All Artist with less then 5 records
#Number of CDs# < '5'

Using REGEXP

For instance you have these fields:
Name – Birth day

Query: All people who’s birthday is on the 5th
#Birth day# REGEXP ’05-..-….’


There is an exception to this: When you selected Date at field type, the searchformat is always yyyy-mm-dd. Even if it shows otherwise (for example another date format or the use of slashes (/)) in your records. So in this case your query is:
#Birth day# REGEXP ‘….-..-05′

Query: All people who’s birthday is in December
#Birth day# REGEXP ‘..-12-….’

Using BETWEEN

Search with BETWEEN. Say you have a database like this:
First name – Last name – Age

Query: All Persons between 6-10 years old
#Age# BETWEEN 6 AND 10

Using Wildcards

For instance you have these fields:
Object – Color

With this data
Clock – Dark Green
Wallpaper – Light Green
Couch – Red
Table – Greenish

Query: All green objects
#Color# LIKE ‘%Green%’

Comments are closed.