Basic usage of SQLite 2

Source: Internet
Author: User
Tags arithmetic arithmetic operators bitwise bitwise operators logical operators sqlite

There are several types of sqlite operators, arithmetic operators, comparison operators, logical operators, bitwise operators

1, arithmetic operators

Arithmetic operators mainly have +-*,% (take-out) This is very simple, for example, to achieve such an effect requires the format of the row output. Mode line

SQLite>Select3;  - % 3 = 2 SQLite >

2, Comparison operators

Comparison operators, as long as the basic knowledge of the language learned, is nothing more than >, <, ==,!=, <> (unequal),>=,<=,!< (not less than),!> (not greater than), this is actually very simple, give an example on the line

SQLite>Select*fromwhere>2; ID     name        Age        -- ---  ----------  ----------3      cc                  sqlite >

3, logical operators

Logical operators SQLite But there are a lot of

This requires an example.

 sqlite>  select  *  from  student where  ID ==  1  and  Name ==   -- ----------------------- 1  aa 23   >  
 sqlite>  select  *  from  student where  ID between  2  and        3  ;id name Age   -- ----------------------- 2  bb 12  3  cc 45   >  
 sqlite>  select  *  from  student where  ID in  (2 , 3   -- ----------------------- 2  BB 12  3  cc 45   SQLite  >  
 sqlite>  select  *  from  student where  ID not  in  (2 , Span style= "color: #800000; Font-weight:bold; " >3   -- ----------------------- 1  AA 23   SQLite  >  
 sqlite>  select  *  from  student where  name like  "B%  "; ID name age -- ---------------------------- Span style= "color: #800000; Font-weight:bold; "        >2  bb 12   SQLite  >  
SQLite>Select*fromwherenotbetween2  and 3 ID        name       age----------  ----------  ----------1            AA @                  sqlite>

4, bitwise operator

operator Description Example
& If both are present in two operands, the binary and operator copies one to the result. (A & B) will be 12, i.e. 0000 1100
| If it exists in either operand, the binary OR operator copies one into the result. (A | B) will get 61, i.e. 0011 1101
~ The binary complement operator is a unary operator with a "flip" bit effect. (~a) will get-61, which is 1100 0011,2 of the complement form, signed binary number.
<< Binary left shift operator. The value of the left operand moves the number of digits specified by the right operand to the left. A << 2 will get 240, which is 1111 0000
>> Binary right-shift operator. The value of the left operand moves the right operand to the specified number of digits. A >> 2 will get 15, which is 0000 1111

Basic usage of SQLite 2

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.