Query Ocient
General SQL Syntax
SQL Syntax Conventions
syntax conventions the {{ocient}} documentation uses the following conventions for defining sql statements in syntax blocks, unless otherwise noted syntax symbol definition example keyword sql statement names, sql statement option names, stored procedure names, utility names, utility flags, and other sql keywords are in uppercase select from \<my table> limit 100; select, from, and limit are all sql keywords for that reason, they are in uppercase {} curly braces indicate that you must choose at least one of the enclosed options do not include the curly braces in your sql statement insert into table name \[( col1 \[, col2 ] \[, ] ) ] { \<select statement> | values ( \[ val1 \[, val2] \[, ] ) } this syntax example has two options to define what data to add using insert into either provide specific values, or use an embedded select query these options are enclosed in curly braces because the user must use one of these options to successfully run an insert into sql statement \[] brackets mean the enclosed functionality is optional, not necessary to run the specified sql statement do not include the brackets in your sql query when used with a list of options, the brackets mean that you can choose one of the listed options create cluster \[ if not exists ] cluster name ( \<create definition> \[, ] ) this syntax example encloses if not exists in brackets because it is optional for running the create cluster sql statement | the vertical pipe acts as a delimiter for option lists, meaning you can select only one of the options explain \[ proto | json | debug ] \<query> this example shows three options that the explain sql statement can use the vertical pipe indicates that each option is exclusive, meaning only one can be used \[ , ] the ellipsis means you can choose to add as many of the indicated options or parameters as you like, separating your choices with commas to be typed as part of the sql statement insert into \<table name> \[ ( \<column name> \[, ] ) ] \<query> the insert into statement uses the ellipsis \[, ] to indicate that an infinite number of additional \<column name> values can be specified \<syntax subsection> for complex syntax blocks, portions are set apart with angle brackets <> to denote there is a separate subsection for a particular portion of the syntax syntax blocks with these subsections usually include complicated options that might distract from the core functionality of the syntax of the sql statement the names of syntax subsection are written in lowercase with underscores between the words in the syntax block, the = symbol signifies the subsection create table \[ if not exists | or replace ] table name \[ (\<create definition> \[, ] ) ] \[ \[ with ] \<create option> \[, ] ] \[ as (query) ] \<create definition> = \<column definition> | \<index definition> \<create option> = storagespace storage space name | segmentsize segment value | redundancy segment part (redundancy scheme) | streamloader properties streamloader json | clustering \[key | index] clustering index (clustering column \[, ]) | index index name (index column \[, ]) \[ using index type ] \<column definition> = column name \[ data type ] \[ \<column constraint> \[, ] ] \<index definition> = \[ clustering ] key index name (index column \[, ] ) \<column constraint> = time key bucket(bucket value \[, day, hour, minute, second ]) | \[ not ] null | default literal | comment comment | compression gdc \[(compression value), existing schema name] | max size (size value) | \[ no ] compression \[ compression scheme ] in this example, create table uses subsections for complex options, such as its column definition, options, and column constraints including all of these in one block would be difficult for a user to parse, especially if their goal was only to create a basic table note that each subsection is defined with the name of the subsection in angle brackets followed by = rules for column and table names names for tables and columns in ocient have the following rules names must begin with an alphabet letter names can contain letters, numbers, and underscores column names enclosed in double quotes can contain any characters except for newlines and carriage returns to use double quotation in a name, put two double quotation marks back to back unless names are enclosed in double quotes, they are treated as case insensitive related links sql reference docid\ ulddmgdefqwa9p 2dqlz data control language (dcl) statement reference docid 7jq6fizrghsmuumsa4qiq data definition language (ddl) statement reference docid\ wcqh0qqpm0gvf2x0gyzrq