This page covers some fundamental basics for using SQL in Polypheny.
In SQL, an identifier is a name given to a database object. Identifiers in Polypheny must adhere to the following rules:
- Naming: Identifiers should start with a letter and can only contain letters, digits, and underscores.
- Case Sensitivity: Case sensitivity depends on the namespace. The default is not case-sensitive. For instance,
Employeewould refer to the same object.
- Reserved Keywords: If an identifier name clashes with a reserved keyword, the name needs to be quoted. Quoted identifiers, such as
"user", start and end with double quotes.
In Polypheny, operator and function names are always case-insensitive. This means that
SeLect, and so on, are treated as the same.
Strings in Polypheny are enclosed within single quotes (
'). If you need to use a single quote within a string, it must be escaped by doubling it. For example,
INSERT INTO test VALUES (1, 'A single quote '' needs to be doubled')
will insert the string:
A single quote ' needs to be doubled
You can access entities (like tables or views) from a different namespace by prefixing the identifier with the namespace name, separated by a dot. For example, if there’s a table
employee in namespace
hr, you could refer to it as
SELECT queries do not require a
FROM clause. This is contrary to standard SQL where a
FROM clause is typically mandatory. In such cases, Polypheny would return a pseudo table with a single row.
For example, the following is a valid query in Polypheny:
This would return a pseudo table with a single row and a single column containing the value