Literals play a crucial role in enhancing the accuracy of data representation and optimizing system efficiency. See the following subsections for the introduction of various types of literals.
Value expressions are used in a variety of contexts, such as in the target list of the SELECT command, as new column values in INSERT or UPDATE, or in search conditions in a number of commands. The result of a value expression is sometimes called a scalar, to distinguish it from the result of a table expression (which is a table).
A generated column is a special column that is always computed from other columns. In RisingWave, you can create a generated column when creating a table or source.
The FROM clause specifies the source of the data on which the query should operate. Logically, the FROM clause is where the query starts execution. It can contain a single table, a combination of multiple joined tables, or another SELECT query inside a subquery node.
GROUP BY clause
The GROUP BY clause groups rows in a table with identical data, thus eliminating redundancy in the output and aggregates that apply to these groups.
The HAVING clause is optional and eliminates group rows that do not satisfy a given condition. HAVING is similar to the WHERE clause, but WHERE occurs before the grouping, and HAVING occurs after.
LIMIT is an output modifier. Logically it is applied at the end of the query, and the LIMIT clause restricts the number of rows fetched.
In RisingWave, the VALUES clause is used to generate one or more rows of data as a table expression. It is commonly used in SQL queries to create temporary tables or to insert data into a table.
The WHERE clause specifies any conditions or filters to apply to your data. This allows you to select only a specific subset of the data. The WHERE clause is used right after the FROM clause.
The WITH clause provides a way to write supplemental statements for a larger query. These statements, also known as Common Table Expressions or CTEs, can be viewed as defining temporary tables that exist just for one query.
WITH ORDINALITY clause
The WITH ORDINALITY clause can be used with set functions in the FROM clause of a query. An additional integer column will be added to the table, which numbers the rows returned by the function, starting from 1. By default, the generated column is named ordinality.