Using BearDB SQL
The SQL parser used in BearDB is designed to recognize most of the ANSI SQL syntax. As this project is still in development, there are some features of the SQL grammar which have not been completed or released at this time.
The following sections provide details on all the supported features of the SQL grammar.
BearDB SQL query grammar
The SQL engine in BearDB parses queries with the same rules as most other relational databases, such as the following:
- Duplicate white space in the query body is ignored. Multiple spaces, tabs, or linefeed characters are allowed in all SQL statements. Note that when using INSERT, UPDATE, or WHERE, data values are used as expressed in the query.
It should be noted that at least one space is required between each word in the sql query.
- SQL keywords are not case-sensitive. The use of
CREATE TABLEis the same as
Create Table. SQL keywords can have mixed-case as well.
- Table names, column names, and data values are case-sensitive.
- SQL Functions are case-sensitive, and must always be in UPPER CASE as documented.
- Quoted values can use single-quotes or double-quotes. The only requirement for quotes is that a value is enclosed in the same type of quote. Using quotes such as the following are valid:
"This is a value"
'This is a value'
Using mixed quote values is not valid:
"This is a value'
- To use a quote in a sql value, enclose the value in the 'other' type of quote, such as follows:
"Value with 'quotes'"
'Value with "quotes"'
There are a few features of the BearDB SQL engine which are different than other relational databases, such as the following:
- Comments in the SQL query are not supported in this release. This will be supported in a subsequent release.
- Table names must be comprised of the characters a-z, A-Z, 0-9, - (hyphen), and _ (underscore). The first character of a table name cannot be a numeric value.
- Column names must be comprised of the characters a-z, A-Z, 0-9, - (hyphen), and _ (underscore). The first character of a column name cannot be a numeric value.
- There is one database with BearDB, so no database name qualifier is required. The database can hold an unlimited number of tables.
Most other features of SQL are supported.