SQLite 基础14

2021-12-01 17:30:49 浏览数 (1)

位运算符

代码语言:javascript复制
sqlite> .mode line
sqlite> select 6|5;
  6|5 = 7
sqlite> select 6&5;
  6&5 = 4
sqlite> select (~6);
 (~6) = -7
sqlite> select (6 << 2 );
(6 << 2 ) = 24
sqlite> select (6 >>1);
(6 >>1) = 3
sqlite> 

表达式

代码语言:javascript复制
sqlite> SELECT ( 22   34 ) AS ADDITION;
ADDITION  
----------
56        
sqlite> SELECT COUNT(*) AS "RECORDS" FROM COMPANY;
RECORDS   
----------
7         
sqlite> SELECT CURRENT_TIMESTAMP;
CURRENT_TIMESTAMP  
-------------------
2016-03-14 06:46:16
sqlite>

UPDATE

代码语言:javascript复制
sqlite> select * from COMPANY;
id          name        age         address     salary    
----------  ----------  ----------  ----------  ----------
1           Paul        32          California  20000.0   
2           Allen       25          Texas       15000.0   
3           Teddy       23          Norway      20000.0   
4           Mark        25          Rich-Mond   65000.0   
5           David       27          Texas       85000.0   
6           Kim         22          South-Hall  45000.0   
7           James       24          Houston     10000.0   
sqlite> UPDATE COMPANY SET ADDRESS = 'Texas' WHERE ID = 6;
sqlite> select * from company where id=6;
id          name        age         address     salary    
----------  ----------  ----------  ----------  ----------
6           Kim         22          Texas       45000.0   
sqlite> UPDATE COMPANY SET ADDRESS = 'test' ,SALARY =10;        
sqlite> select * from COMPANY;
id          name        age         address     salary    
----------  ----------  ----------  ----------  ----------
1           Paul        32          test        10.0      
2           Allen       25          test        10.0      
3           Teddy       23          test        10.0      
4           Mark        25          test        10.0      
5           David       27          test        10.0      
6           Kim         22          test        10.0      
7           James       24          test        10.0      
sqlite> 

0 人点赞