Get the App
SLTechnology News&Howtos  ›  Database  › 

How to use wildcards in the SELECT clause in SQLite

Shulou Source: shulou.com Published: 2022-05-31 12:32:46 09月26日 Update

The editor would like to share with you how to use wildcards in the SELECT clause in SQLite. I hope you will get something after reading this article. Let's discuss it together.

The SELECT clause in SQLite uses wildcards

Two wildcards, * and table_name.*, are supported in the SELECT clause. Where the * wildcard outputs all user-defined columns of each source table in the FROM clause. For example, the following SQL statement outputs all user-defined columns for Students.

SELECT * FROM Students

Run the program, and the execution effect is shown in figure 3.5.

Figure 3.5 * wildcard

Table_name.* can be used to specify the name of the table where the output column is located, where the output columns are user-defined. Although both * and table_name.* wildcards can output multiple columns, neither of them will output automatically generated ROWID columns. If you want to output both ROWID and user-defined columns, you need to specify the ROWID column manually. The syntax is as follows:

SELECT ROWID, * FROM table_name

For example, the following SQL statement outputs all the columns in the Students table, including the automatically generated ROWID column.

SELECT ROWID,* FROM Students

Run the program, and the execution effect is shown in figure 3.6.

Figure 3.6 outputs all columns

Note: wildcards cannot use column aliases because they usually return multiple columns.

After reading this article, I believe you have some understanding of "how to use wildcards in SELECT clauses in SQLite". If you want to know more about it, you are welcome to follow the industry information channel. Thank you for reading!

Tags: Output wildcards clauses users effects programs articles automatically generated statements facets such as figure generation run two aliases at the same time name finished form location Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Linux macOS Docker vpn Xiaomi