Index design on SQL

Instead of using Tools > Index Design:

How can Index Design be added in this code ?
sSQL = _
“CREATE TABLE” & " " & “”“Table_Product”"" & " " & “(” & _
“”“ProductCode”"" & " " & VARCHAR(10) & " " & “PRIMARY KEY” & “,” & " " & _
“”“ProductGroup”"" & " " & “VARCHAR(10)” & “,” & " " & _
“”“ProductName”"" & " " & “VARCHAR(100)” & _
“)”

Fedora 34 Workstation Official Edition
Base - Embedded Firebird
LibreOffice Community
Version: 7.1.5.2
Build ID: 10(Build:2)
CPU threads: 4
OS: Linux 5.13
UI render: default
VCL: gtk3
Locale: en-US (en_US.UTF-8); UI: en-US
Calc: threaded

You find the documentation of the embedded HSQLDB version 1.8 here:
http://www.hsqldb.org/doc/1.8/guide/ch09.html

May be you want something like this:

ALTER TABLE  "Person" ADD CONSTRAINT "UniqNames" UNIQUE ("Surname","Forename","BirthDate")

makes a person a unique person by its surname, forname and birth date.

p.s. unfortunately, your screenshot cuts off the status bar, so we can’t see which database we are talking about.

1 Like

I use embedded Firebird.
I 'd like to push query with every table to run fast.
And from this question, adding Index Design into a table can really accelerate.

Firebird is documented as well.

1 Like

HSQLDB and Firebird will work with the same code here:

[CONSTRAINT "Name of Constraint"]
UNIQUE ( "Field 1" [,"Field 2"...] )

So, for your example:

CONSTRAINT "PDG" UNIQUE ("ProductGroup")

And this is a part of the Firebrid 2.5 Descriptions:

USING
[ASC[ENDING] | DESC[ENDING]] INDEX indexname

So you have to add

USING ASC INDEX "PDG"
1 Like

Thank you.
The SQL language is really different from menu, Tools > Index Design.
The result:


Screenshot from 2021-08-28 23-09-31

One last question, please.
Is the Execute SQL Statement panel in MS Windows expandable ?
In Linux, it is narrow and can’t be expanded.

Could only test it under Linux/KDE:
You could change the width and the height of the dialog only by the window manager. Click on the title of the window with right mouse button and have a look what the window manager on your system supports.

1 Like