The CREATE TABLE
statement uses a slightly different syntax as documented in HSQLDB. You will need to execute the following in Tools
→ SQL
:
CREATE TABLE TableA (
Field1 INT PRIMARY KEY,
Field2 DATE DEFAULT CURRENT_DATE
)
The above SQL query will create a permanent table that you can use to store new data, and the default value for Field2
in all new rows will be the current date at the time the row is created. This is not the usual way to create tables in Base.
On the other hand, here is a SELECT
query that uses the NOW()
function to display a new column alongside the columns of the TableA
above:
SELECT "FIELD1", "FIELD2", NOW( ) "func_now"
FROM "TABLEA"
The output is as follows (with a little sample data in TableA
):
Unlike the CREATE
statement, this SELECT
statement creates only a temporary, unstored output. The SELECT
statement can be run through the Base query builder (View
→ Switch Design View On/Off
)
(if this addressed your question, please accept the answer)