CREATE TABLE [CommandName](
  [NameId] INTEGER PRIMARY KEY,
  [Name] NVARCHAR(25) NOT NULL COLLATE NOCASE,
  [OrdValue] SMALLINT NOT NULL,
  [Group] BOOLEAN DEFAULT 0,
  [Short_Title] NVARCHAR(80) COLLATE NOCASE,
  [Long_Title] NVARCHAR(255) COLLATE NOCASE,
  [Description] NVARCHAR(2550) COLLATE NOCASE,
  [Help_URL] NVARCHAR(255) COLLATE NOCASE,
  [Comment] NVARCHAR(255) COLLATE NOCASE,
  [Tags] NVARCHAR(255) COLLATE NOCASE,
  [Icon] INTEGER DEFAULT (-1),
  [Image] INTEGER DEFAULT (-1),
  [Level] INTEGER DEFAULT 1,
  [Attribs] INTEGER DEFAULT 0,
  [Disable_Boreholes] BOOLEAN DEFAULT 0,
  [Flyout] BOOLEAN DEFAULT 0,
  [Modal] BOOLEAN DEFAULT 0,
  [RCL_Able] BOOLEAN DEFAULT 0,
  [Spatial_Filters] BOOLEAN DEFAULT 0,
  [Close_Fin] BOOLEAN DEFAULT 0,
  [Time_Filters] BOOLEAN DEFAULT 0,
  [Strat_Rules] BOOLEAN DEFAULT 0,
  [Log2D] BOOLEAN DEFAULT 0,
  [Log3D] BOOLEAN DEFAULT 0,
  [Section] BOOLEAN DEFAULT 0,
  [ProSection] BOOLEAN DEFAULT 0,
  [Profile] BOOLEAN DEFAULT 0,
  [Fence] BOOLEAN DEFAULT 0
  );

CREATE TABLE [Sample](
  [SampleId] INTEGER PRIMARY KEY,
  [Name] NVARCHAR(80) NOT NULL COLLATE NOCASE,
  [NameId] INTEGER REFERENCES [CommandName]([NameId]));

CREATE TABLE [Video](
  [VideoId] INTEGER PRIMARY KEY,
  [Name] NVARCHAR(80) NOT NULL COLLATE NOCASE,
  [NameId] INTEGER REFERENCES [CommandName]([NameId]));

CREATE UNIQUE INDEX [Name_IX] ON [CommandName]([Name] ASC);

CREATE INDEX [OrdValue_IX] ON [CommandName]([OrdValue] ASC);

CREATE INDEX [Sample_IX] ON [Sample]([Name] COLLATE [NOCASE] ASC);

CREATE INDEX [Sample_NameId] ON [Sample]([NameId] ASC);

CREATE INDEX [Video_IX] ON [Video]([Name] COLLATE [NOCASE] ASC);

CREATE INDEX [Video_NameId] ON [Video]([NameId] ASC);
