-
Notifications
You must be signed in to change notification settings - Fork 2
/
foobar.emp.phoenix.sql
24 lines (21 loc) · 1.24 KB
/
foobar.emp.phoenix.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
create schema if NOT EXISTS foobar;
CREATE TABLE IF NOT EXISTS foobar.emp (
pk INTEGER NOT NULL PRIMARY KEY,
name VARCHAR,
age INTEGER,
gender VARCHAR,
boss VARCHAR,
email VARCHAR
) compression='snappy',UPDATE_CACHE_FREQUENCY=30000, COLUMN_ENCODED_BYTES=0;
CREATE SEQUENCE emp_id;
UPSERT INTO foobar.EMP VALUES( NEXT VALUE FOR emp_id, 'alice', 31, 'M', 'dave', '[email protected]');
UPSERT INTO foobar.EMP VALUES( NEXT VALUE FOR emp_id, 'bob', 28, 'M', 'dave', '[email protected]');
UPSERT INTO foobar.EMP VALUES( NEXT VALUE FOR emp_id, 'candy', 31, 'M', 'dave', '[email protected]');
UPSERT INTO foobar.EMP VALUES( NEXT VALUE FOR emp_id, 'dave', 31, 'M', 'george', '[email protected]');
CREATE INDEX emp_idx0 ON foobar.emp(age DESC) include (name,boss) async;
CREATE INDEX emp_idx1 ON foobar.emp(name DESC) include (gender,boss) async;
CREATE INDEX emp_idx2 ON foobar.emp(name DESC, email) include (age,boss) async;
UPSERT INTO foobar.EMP VALUES( NEXT VALUE FOR emp_id, 'edword', 0, 'M', 'dave', '[email protected]');
UPSERT INTO foobar.EMP VALUES( NEXT VALUE FOR emp_id, 'ford', 1, 'M', 'dave', '[email protected]');
UPSERT INTO foobar.EMP VALUES( NEXT VALUE FOR emp_id, 'george', 255, 'M', 'dave', '[email protected]');
SELECT * FROM foobar.EMP;