Skip to content
Snippets Groups Projects
Unverified Commit 00ac183e authored by Alex Yarosh's avatar Alex Yarosh Committed by GitHub
Browse files

docs: warnings about question marks (#44920)

* question marks

* remove all question mark notes except about json
parent 06c0218c
No related branches found
No related tags found
No related merge requests found
......@@ -44,6 +44,12 @@ Questions asked using SQL can be saved, downloaded, converted to models, and add
You can also [refer to models and saved questions][ref-models] in your SQL queries.
## Use `??` instead of `?` operator
If you're using the `?` JSON operator in PostgreSQL, use the equivalent `??` operator instead.
This is due to limitations of JDBC that interprets a single question mark `?` as a parameter placeholder.
## Format SQL queries
You can format your SQL queries by clicking on the "document" icon in the editor sidebar.
......
......@@ -9,6 +9,7 @@ redirect_from:
For an introduction to expressions, check out the [overview of custom expressions][expressions].
- [Aggregations](#aggregations)
- [Average](#average)
- [Count](#count)
- [CountIf](./expressions/countif.md)
......@@ -26,7 +27,9 @@ For an introduction to expressions, check out the [overview of custom expression
- [Variance](#variance)
- Functions
- [Logical functions](#logical-functions)
- [between](#between)
- [case](./expressions/case.md)
- [coalesce](./expressions/coalesce.md)
......@@ -34,6 +37,7 @@ For an introduction to expressions, check out the [overview of custom expression
- [notnull](#notnull)
- [Math functions](#math-functions)
- [abs](#abs)
- [ceil](#ceil)
- [exp](#exp)
......@@ -44,6 +48,7 @@ For an introduction to expressions, check out the [overview of custom expression
- [sqrt](#sqrt)
- [String functions](#string-functions)
- [concat](./expressions/concat.md)
- [contains](#contains)
- [doesNotContain](#doesnotcontain)
......@@ -62,6 +67,7 @@ For an introduction to expressions, check out the [overview of custom expression
- [upper](#upper)
- [Date functions](#date-functions)
- [convertTimezone](./expressions/converttimezone.md)
- [datetimeAdd](./expressions/datetimeadd.md)
- [datetimeDiff](./expressions/datetimediff.md)
......@@ -228,6 +234,7 @@ Related: [StandardDeviation](#standarddeviation), [Average](#average).
Function expressions apply to each individual value. They can be used to alter or filter values in a column, or create new, custom columns.
## Logical functions
Logical functions determine if a condition is satisfied or determine what value to return based on a condition.
### between
......@@ -277,6 +284,7 @@ Example: `notnull([Tax])` would return true if there is a value present in the c
Related: [isnull](#isnull), [notempty](#notempty)
## Math functions
Math functions implement common mathematical operations.
### abs
......@@ -360,6 +368,7 @@ Databases that don't support `sqrt`: SQLite.
Related: [Power](#power).
## String functions
String functions manipulate or validate string data.
### [concat](./expressions/concat.md)
......@@ -400,24 +409,23 @@ Syntax: `doesNotContain(string1, string2)` for case-sensitive match.
Example: `doesNotContain([Status], "Class")`. If `Status` were "Classified", the expression would return `false`.
Related: [contains](#contains), [regexextract](#regexextract).
Related: [contains](#contains), [regexextract](#regexextract).
### endsWith
Returns true if the end of the text matches the comparison text.
Performs case-sensitive match by default.
Performs case-sensitive match by default.
You can pass an optional parameter `"case-insensitive"` to perform a case-insensitive match.
Syntax: `endsWith(text, comparison)` for case-sensitive match.
`endsWith(text, comparison, "case-insensitive")` for case-insensitive match.
`endsWith(text, comparison, "case-insensitive")` for case-insensitive match.
Example: `endsWith([Appetite], "hungry")`
Related: [startsWith](#startswith), [contains](#contains), [doesNotContain](#doesnotcontain).
### [isempty](./expressions/isempty.md)
Returns true if a _string column_ contains an empty string or is null. Calling this function on a non-string column will cause an error. You can use [isnull](#isnull) for non-string columns.
......@@ -464,10 +472,8 @@ Syntax: `notempty(column)`
Example: `notempty([Feedback])` would return true if `Feedback` contains a value that isn't the empty string (`''`).
Related: [isempty](#isempty), [isnull](#isnull), [notnull](#notnull)
### [regexextract](./expressions/regexextract.md)
Extracts matching substrings according to a regular expression.
......@@ -505,15 +511,14 @@ You can pass an optional parameter `"case-insensitive"` to perform a case-insens
Syntax: `startsWith(text, comparison)` for case-sensitive match.
`startsWith(text, comparison, "case-insensitive")` for case-insensitive match.
`startsWith(text, comparison, "case-insensitive")` for case-insensitive match.
Example: `startsWith([Course Name], "Computer Science")` would return true for course names that began with "Computer Science", like "Computer Science 101: An introduction".
It would return false for "Computer **s**cience 201: Data structures" because the case of "science" does not match the case in the comparison text.
It would return false for "Computer **s**cience 201: Data structures" because the case of "science" does not match the case in the comparison text.
`startsWith([Course Name], "Computer Science", "case-insensitive")` would return true for both "Computer Science 101: An introduction" and "Computer science 201: Data structures".
Related: [endsWith](#endswith), [contains](#contains), [doesNotContain](#doesnotcontain).
### [substring](./expressions/substring.md)
......@@ -543,6 +548,7 @@ Syntax: `upper(text)`.
Example: `upper([Status])`. If status were "hyper", `upper("hyper")` would return "HYPER".
## Date functions
Date functions manipulate, extract, or create date and time values.
### [convertTimezone](./expressions/converttimezone.md)
......@@ -736,13 +742,14 @@ See [Offset](./expressions/offset.md).
## Limitations
- [Aggregation expressions](#aggregations) can only be used in the **Summarize** section of the query builder.
- [Aggregation expressions](#aggregations) can only be used in the **Summarize** section of the query builder.
- Functions that return a boolean value, like [isempty](#isempty) or [contains](#contains), cannot be used to create a custom column. To create a custom column based on one of these functions, you must combine them with another function, like `case`.
For example, to create a new custom column that contains `true` if `[Title]` contain `'Wallet'`, you can use the custom expression
```
case(contains([Title], 'Wallet'), true, false)
```
For example, to create a new custom column that contains `true` if `[Title]` contain `'Wallet'`, you can use the custom expression
```
case(contains([Title], 'Wallet'), true, false)
```
### Database limitations
......
......@@ -12,7 +12,7 @@ You can also skip to the [complete list of expressions][expression-list].
## Custom expressions to create filters, metrics, and custom columns
To use custom expression, create a __Custom Column__ (where the custom expression is used as a Field Formula to calculate values for the new column), or click on __Filter__ or __Summarize__ and select __Custom Expression__.
To use custom expression, create a **Custom Column** (where the custom expression is used as a Field Formula to calculate values for the new column), or click on **Filter** or **Summarize** and select **Custom Expression**.
When using the query builder, you can use expressions to create new:
......
......@@ -24,6 +24,10 @@ title: Troubleshooting SQL questions
For some common error messages, see [error messages](./error-message.md).
## Working with JSON in SQL
Using the `?` operator for working with JSON in SQL may cause queries to fail. On PostgreSQL, you can use `??` instead.
## Are you still stuck?
If you can’t solve your problem using the troubleshooting guides:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment