SQLite using Tutorial 11 expressions

Source: Internet
Author: User
Tags sqlite

SqliteAn expression

An expression is a combination of one or more values, operators, and SQL functions that evaluate values.

SQL expressions are similar to formulas and are written in the query language. You can also use a specific dataset to query the database.

Grammar

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

SELECT column1, column2,[|  EXPRESSION];      

There are different types of SQLite expressions, specifically explained below:

SQLite-Boolean expression

The Boolean expression of SQLite obtains data on the basis of matching a single value. The syntax is as follows:

SELECT column1, column2, COLUMNN from table_name WHERE single VALUE matchting EXPRESSION;  

Suppose the company table has the following records:

ID          NAME        age         ADDRESS     SALARY----------  ----------  ----------  ----------  ---- ------1           Paul          California  20000.02           Allen          Texas       15000.03           Teddy       at          Norway      20000.04           Mark          rich-mond   65000.05           David          Texas       85000.06           Kim          south-hall  45000.07           James          Houston     10000.0

The following example demonstrates the use of a SQLite Boolean expression:

SQLite>*=10000;  ID NAME Age ADDRESS SALARY--------------------------------------------------4  JamesHouston10000.0            
SQLite-Numeric expression

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

As  operation_name[fromtable_name WHERE CONDITION];    

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

SQLite>(6 +)=       

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

SQLite> Select COUNT(*)"RECORDS"  from company; =7       
SQLite-Date Expression

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

SQLite>  SELECT current_timestamp;  =-Geneva--       : 

SQLite using Tutorial 11 expressions

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.