SQL Query: UDB Databases

You are here:
← All Topics


udbsql is a method of quering the data in any of your UDB databases. It allows you to quickly and efficiently explore data that has been loaded into and distributed in a UDB database, and is written in a user friendly, SQL-like language.

The udbsql command structure consists of a select statement to define which columns are desired and what operations you want to perform on them, a from statement telling udbsql which UDB database and table|vector|variable to pull the data from, and a series of filtering and ordering options to modify how the data is output.

udbsql supports the following types of sql statements:

  • Select Statement Specifications: column_name(s), *, count(column_name), count(*), count(distinct column_name)
  • From Statement Specifications: database_name:table_name|vector_name|variable_name
  • Output Modification Options: where column_name operator value, limit number, group by column_name, order by column_name



Command     Arguments          Description
udbsql [--help || -h] Query data in a UDB database using simple sql-like statements
[--verbose || -v]
[--list || -l]

-v, --verbose verbosely list aq_udb command to execute
-l, --list list aq_udb command without execution



Query Format:

select [column_name] | [*] from [database_name]:[table_name | vector_name | variable_name] where ... order by ... limit ...

select count(distinct [column_name] | [*]) from [database_name]:[table_name | vector_name | variable_name] where ...

select [column_name], count(*) from [database_name]:[table_name | vector_name | variable_name] where ... group by [column_name]


The first query format above is a "select" query.
The second and third query formats above are "count" queries.

1. Group By is NOT supported for SELECT queries.
2. Order By is NOT supported for COUNT queries.
3. Limit is NOT supported for COUNT queries.
4. Order By, Limit, or Group By can only be used when there is no DISTINCT in COUNT queries.




select * from udb_databasename:tablename
select count(*) from udb_databasename:tablename
SELECT ... FROM database:tableA WHERE pkey_A IN (SELECT pkey_B FROM [database:]tableB WHERE ...) ...


select col2, col4 from udb_databasename:tablename


select * from udb_databasename:tablename limit 10


select * from udb_databasename:tablename where filterspec


select * from udb_databasename:tablename order by col


select count(distinct col1), count(distinct col2), count(*) from udb_databasename:tablename


select count(*) from udb_databasename:tablename group by col1 col2