Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the expressions in SQLite

2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

Most people don't understand the knowledge points of this article "What are the expressions in SQLite", so Xiaobian summarizes the following contents for everyone. The contents are detailed, the steps are clear, and they have certain reference value. I hope everyone can gain something after reading this article. Let's take a look at this article "What are the expressions in SQLite".

SQLite is a C library that implements a small, fast, self-contained, highly reliable, full-featured SQL database engine. SQLite is the most commonly used database engine in the world. SQLite is built into all phones and most computers, and bundled into countless other apps that people use every day.

syntax

Suppose the basic syntax of a SELECT statement is as follows:

SELECT column1, column2, columnNFROM table_nameWHERE [CONDITION | EXPRESSION];

There are different types of SQLite expressions, explained as follows:

SQLite Boolean expressions

SQLite Boolean expressions fetch data based on matching a single value. The syntax is as follows:

SELECT column1, column2, columnNFROM table_nameWHERE SINGLE VALUE MATCHING EXPRESSION;

Suppose the COMPANY table has the following records:

ID NAME AGE ADDRESS SALARY---------- ---------- ---------- ---------- ----------1 Paul 32 California 20000.02 Allen 25 Texas 15000.03 Teddy 23 Norway 20000.04 Mark 25 Rich-Mond 65000.05 David 27 Texas 85000.06 Kim 22 South-Hall 45000.07 James 24 Houston 10000.0

The following example demonstrates the use of SQLite Boolean expressions:

sqlite> SELECT * FROM COMPANY WHERE SALARY = 10000;ID NAME AGE ADDRESS SALARY---------- ---------- ---------- ---------- ----------4 James 24 Houston 10000.0 SQLite Numerical Expressions

These expressions are used to perform any mathematical operation in the query. The syntax is as follows:

SELECT numerical_expression as OPERATION_NAME[FROM table_name WHERE CONDITION] ;

Here, numerical_expression is used for mathematical expressions or any formula. The following example demonstrates the use of SQLite numeric expressions:

sqlite> SELECT (15 + 6) AS ADDITIONADDITION = 21

There are several built-in functions, such as avg(), sum(), count(), and so on, that perform what are called aggregate data calculations for a table or a particular table column.

sqlite> SELECT COUNT(*) AS "RECORDS" FROM COMPANY;RECORDS = 7SQLite Date Expression

Date expressions return the current system date and time values and are used for various data operations.

sqlite> SELECT CURRENT_TIMESTAMP;CURRENT_TIMESTAMP = 2013-03-17 10:43:35 The above is about the content of this article, I believe everyone has a certain understanding, I hope the content shared by Xiaobian is helpful to everyone, if you want to know more related knowledge content, please pay attention to the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report