Use Data Manipulation Language (DML) to add, retrieve, update and manipulate data. The Cinchy DML statements covered on this page are:
Use the SELECT
statement to select data from a database. The data returned is stored in a result table, called the result-set.
Note: Table name requires domain prefix.
You can create a query that will produce a nested JSON by wrapping it in an outer SELECT
statement, such as in the example below.
Note that you should set the return type to Single Value (First Column of First Row).
Use an INSERT statement to add new rows to a table or view. You can also include a SELECT statement to identify that another table or view contains the data for the new row or rows.
The table name requires the domain prefix.
Use the UPDATE statement to change the data in a table. The UPDATE statement modifies zero or more rows of a table, depending on how many rows meet the search condition specified in the WHERE clause. You can also use an UPDATE
statement to specify the values to be updated in a single row. To do this, specify the constants, host variables, expressions, DEFAULT, or NULL. Specify NULL to remove a value from a row's column (without removing the row).
The table name requires the domain prefix.
Use the DELETE statement to remove entire rows from a table. The number of rows deleted depends on how many rows match the search condition specified in the WHERE statement.
The table name requires the domain prefix.
Use the IF statement to execute a condition. If the condition is satisfied, then the Boolean expressions returns TRUE value. The optional ELSE keyword introduces another statement that executes when the IF condition isn't satisfied and returns FALSE value.
Use the DECLARE statement to declare a variable.
Use the SET
variable to assign a value to a variable.
The Cinchy Query Language (CQL) statements group into two (2) categories:
Data Manipulation Language (DML) - Use DML to add, retrieve, update and manipulate data. For example, insert, update, delete.
Data Definition Language (DDL) - Use DDL to create a database schema and define constraints. For example, create a table and alter a table.
List of available DML statements:
List of available DDL statements:
DDL is used to create a database schema and define constraints. The Cinchy DDL functions covered on this page are:
The following tables provide the data type(s) that a Cinchy Data Type translates to in the database:
Number | Text | Date |
---|---|---|
The CREATE TABLE statement is used to create a new table in a database.
The column parameters specify the names of the columns of the table. The datatype parameter specifies the data type the column can hold (such as varchar, char, int, date).
Syntax
Example
The ALTER TABLE statement is used to add, delete, or modify columns in an existing table.
The ALTER TABLE statement is also used to add and drop various constraints on an existing table.
Syntax
Example
The DROP TABLE statement is used to drop an existing table in a database.
Syntax
Example
In SQL, a view is a virtual table based on the result-set of an SQL statement.
A view has rows and columns, taken from fields of an original table and presents them with a different structure and organization. This is useful when only some columns of a table may be relevant to a user, so they don't have to see information from other columns that may be irrelevant to them.
SQL functions and the WHERE statement can be added to a view to present the data as if the data was coming from one single table.
Syntax
Example
Modifies a previously created view, including indexed views. ALTER VIEW doesn't affect dependent stored procedures or triggers and doesn't change permissions.
Syntax
Example
Use the DROP VIEW command to delete a view.
Syntax
Example
The CREATE INDEX statement is used to create indexes in tables.
Syntax
Example
The DROP INDEX statement is used to delete an index on a table.
Syntax
Example
Binary | Yes/No |
---|---|
Int
NVarChar
DateTime
BigInt
VarChar
Date
Decimal
Char
Float
NChar
Money
NText
Numeric
Text
Real
SmallInt
SmallMoney
TinyInt
VarBinary
Bit