Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[hotfix] [docs]Fix miss semicolon on SELECT & WHERE clause example sql #25673

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions docs/content/docs/dev/table/sql/queries/select.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,31 +35,31 @@ SELECT select_list FROM table_expression [ WHERE boolean_expression ]
The `table_expression` refers to any source of data. It could be an existing table, view, `VALUES`, or `VALUE` clause, the joined results of multiple existing tables, or a subquery. Assuming that the table is available in the catalog, the following would read all rows from `Orders`.

```sql
SELECT * FROM Orders
SELECT * FROM Orders;
```

The `select_list` specification `*` means the query will resolve all columns. However, usage of `*` is discouraged in production because it makes queries less robust to catalog changes. Instead, a `select_list` can specify a subset of available columns or make calculations using said columns. For example, if `Orders` has columns named `order_id`, `price`, and `tax` you could write the following query:

```sql
SELECT order_id, price + tax FROM Orders
SELECT order_id, price + tax FROM Orders;
```

Queries can also consume from inline data using the `VALUES` clause. Each tuple corresponds to one row and an alias may be provided to assign names to each column.

```sql
SELECT order_id, price FROM (VALUES (1, 2.0), (2, 3.1)) AS t (order_id, price)
SELECT order_id, price FROM (VALUES (1, 2.0), (2, 3.1)) AS t (order_id, price);
```

Rows can be filtered based on a `WHERE` clause.

```sql
SELECT price + tax FROM Orders WHERE id = 10
SELECT price + tax FROM Orders WHERE id = 10;
```

Additionally, built-in and [user-defined scalar functions]({{< ref "docs/dev/table/functions/udfs" >}}) can be invoked on the columns of a single row. User-defined functions must be registered in a catalog before use.

```sql
SELECT PRETTY_PRINT(order_id) FROM Orders
SELECT PRETTY_PRINT(order_id) FROM Orders;
```

{{< top >}}