Syntax
Table of Contents
The Katzebase SQL (KBSQL) is very similar to T-SQL. Each statement is self-terminating and does not require delimiters or terminators. It can be used to create and alter objects, schema and indexes. Create, read and delete data. Execute procedures and functions, evaluate engine state and perform various calculations.
The statements are broken down into two types (1) DML or (data manipulation language) which is for selecting, updating, inserting and deleting data and (2) DDL or (data definition language) which are used for modifying database "objects" like schema, procedures and indexes.
That's really it for the basics. There are certainly more advanced topics such as index analysis, partitioning and system functions, but those are addressed in individual topics.
SELECT * FROM WordList:WordSELECT
Id, Text, LanguageId
FROM
WordList:WordSELECT
Id, Text, LanguageId
FROM
WordList:Word
WHERE
Text = 'Dog'INSERT INTO WordList:Word
(
Text = 'Sarah',
LanguageId = 1
)You can repeat as many of these sets as you like. Notice that the fields can vary per-set.
INSERT INTO WordList:Word
(
Id = 0,
Text = 'Sarah',
LanguageId = 1
),
(
Id = 1,
Text = 'Brightman'
)UPDATE
WordList:Word
SET
Text = 'Neward',
LanguageId = 2
WHERE
Id = 0EXEC WordList:Word:CreateAndGetWord('Neward')DELETE FROM
WordList:Word
WHERE
Text = 'Neward'CREATE SCEHMA WordList:DefinitionsFor more information, see PageSize.
CREATE SCEHMA WordList:Definitions WITH (PageSize = 10000)DROP SCEHMA WordList:DefinitionsCREATE PROCEDURE CreateAndGetWord
(
@Word as string
) ON WordList:Word AS
(
INSERT INTO WordList:Word
(
Text = @Word,
GUID = Guid(),
LanguageId = 1
)
SELECT * FROM WordList:Word WHERE Text = @Word
DELETE FROM WordList:Word WHERE Text = @Word
)CREATE INDEX IX_Word_Text(
LanguageId,
Text
) ON WordList:WordFor more information, see partitions and Rebuild_Index.
CREATE INDEX IX_Word_Text(
LanguageId,
Text
) ON WordList:Word WITH(Partitions = 1000)DROP INDEX IX_Word_Text ON WordList:WordHome
The home page
SQL :: Alter Schema
Schemas are containers for other database objects.
SQL :: Create Index
Creates an index to speed up read operations.
SQL :: PageSize
Defines the size of a schema page.
SQL :: Partitions
Partitions are applicable to indexes and define the number of pieces the index will be split into.
SQL :: Rebuild Index
Rebuilds an index with a different set of parameters.
SQL::Keywords
A breakdown of all high-level statements available via the query handler.