-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
145 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
|
||
-- Import wiz load data | ||
attach database ":memory:" as loader_area; | ||
|
||
.mode csv | ||
.separator ; | ||
.import C:/giorgi/nttdata/std_cost_2014.csv std_cost | ||
-- select * from std_cost; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
-- RType SQL Boot script | ||
-- | ||
.print "> RType 2017 setup..." | ||
create table if not exists rtype( | ||
key text unique, | ||
value text); | ||
|
||
-- delete from rtype; | ||
insert or ignore into rtype values('version',0.1); | ||
insert or ignore into rtype values('product_name','RType'); | ||
-- Default FK regexp | ||
insert or ignore into rtype values('fk_regexp','.*_ID'); | ||
|
||
attach database ":memory:" as fk_validator; | ||
|
||
-- Demo table | ||
create table if not exists person( | ||
person_id integer primary key autoincrement, | ||
name text, | ||
surname text | ||
); | ||
|
||
create table if not exists car( | ||
car_id integer primary key autoincrement, | ||
owber_person_id integer, | ||
model text, | ||
year integer); | ||
|
||
|
||
-- Select RANK EMULATION | ||
/* | ||
SELECT Products.Product, | ||
DENSE_RANK() OVER (ORDER BY Products.Code DESC) AS Rank | ||
FROM Products; | ||
In SQLite: | ||
SELECT Product, | ||
(SELECT COUNT()+1 FROM ( | ||
SELECT DISTINCT Code FROM Products AS t WHERE Code < Products.Code) | ||
) AS Rank | ||
FROM Products; | ||
*/ | ||
.print ">> Demo table ok" | ||
|
||
.print ">>> Emitting json configuration" | ||
--json_object('rtype_dump', | ||
-- json_set('{"a":2,"c":4}', '$.c', json_array(97,96)) → '{"a":2,"c":[97,96]}' | ||
select json_set('{"config": "cfg"}','$.config',C.X) from | ||
(select json_group_object(key,value) AS X from rtype | ||
order by key) C; | ||
|
||
select * from rtype; | ||
-- .dump | ||
|
||
-- .mode cvs | ||
-- .separator ; | ||
-- .import |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters