Creating a Table
To create a table, use the following SQL CREATE TABLE syntax:
CREATE TABLE myTable
By default, columns are created that allow NULL values.
The CREATE TABLE syntax in BearDB does not support the concept of a default values.
BearDB recognizes the following data types:
Data types are not case-sensitive and can be expressed in any case.
Data Types are validated and are required to meet the following criteria:
- varchar(x), char(x): Variable length character data. Both char and varchar will allow any number of characters up to (x). The max value for the number of characters is an integer value of 2147483647
- integer: A positive or negative integer value, from -2147483647 to 2147483647. Lack of a leading sign character is considered a positive value, and a leading hyphen sign character is considered a negative value.
- double: A positive or negative double value. 16 numeric characters are supported to the left of the decimal place, and up to 305 characters to the right of the decimal.
- decimal: A positive or negative decimal value. 16 numeric characters are supported to the left of the decimal place, and up to 305 characters to the right of the decimal.
- datetime: A representation of a point in time, inclusive of both date and time components. In SQL queries a datetime is expressed using one of the following strings for March 24, 2011 at 7:24PM.:
'03-24-2011 07:24:00 PM'
'03/24/2011 07:24:00 PM'All parts of the datetime string are required, including the
pmdesignator. If the time component is not relevant then use zeros for the time value. The datetime values in a sql query do not have to be quoted.
- boolean: A data type representing either true or false. In SQL queries a boolean is expressed as the lower-case values
- autonumber: The autonumber data type allows for an integer-based value to be used whenever data is inserted into a table. The value starts at 1 and increments by a value of 1 for each SQL INSERT. If an autonumber value is specified in an INSERT statement, it will be ignored and the next number in the sequence will be inserted. If an autonumber value is specified in an UPDATE statement, it will be ignored and the value will not be updated.
Joins, Sql functions, aggregates, and table aliases are not supported when using CREATE TABLE.
The rules for table and column names are described as follows:
- 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.
BearDB is delivered with some system tables. These system tables are not allowed to be created with the CREATE TABLE syntax.
When using CREATE TABLE there is no need to specify any Indexes. Indexes will be supported in a future release of BearDB.