1 查找关键字
select * from keywords ;
2 创建数据库表
create table myvertica_table( a int , b varchar(30)) ;
插入表数据
insert into myvertica_table(1 , 'hello vertica') ;
3 整除 与 除
select 5/4 ; ----1.25
select 5//4 ; -----1
Mathematical operators are provided for many data types.
| Operator | Description | Example | Result |
|---|---|---|---|
! | Factorial | 5 ! | 120 |
+ | Addition | 2 + 3 | 5 |
– | Subtraction | 2 – 3 | –1 |
* | Multiplication | 2 * 3 | 6 |
/ | Division (integer division produces NUMERIC results). | 4 / 2 | 2.00... |
// | With integer division, returns an INTEGER rather than a NUMERIC. | 117.32 // 2.5 | 46 |
% | Modulo (remainder). For details, see | 5 % 4 | 1 |
^ | Exponentiation | 2.0 ^ 3.0 | 8 |
|/ | Square root | |/ 25.0 | 5 |
||/ | Cube root | ||/ 27.0 | 3 |
!! | Factorial (prefix operator) | !! 5 | 120 |
@ | Absolute value | @ -5.0 | 5 |
4 科学计数法 与二进制
SELECT NUMERIC '1e10';
SELECT NUMERIC '1p10';
5 字符串 强显
select
6
X'<hexadecimal digits>' B'<binary digits>'
|
| Specifies hexadecimal digits. The <hexadecimal digits> string must be enclosed in single quotes ('). |
|
| Specifies binary digits. The <binary digits> string must be enclosed in single quotes ('). |
=> SELECT X'abcd'; ?column? ---------- \253\315 (1 row)
=> SELECT B'101100'; ?column? ---------- , (1 row)
7 in 的用法
=> SELECT * FROM t11 WHERE (col1, col2) IN ((2,3), (6,7)) ORDER BY pk; pk | col1 | col2 | SKIP_ME_FLAG ----+------+------+-------------- 1 | 2 | 3 | t 5 | 6 | 7 | t