sql
stringlengths 6
1.05M
|
---|
<reponame>duberg/annette-sphera
use annette_sphera;
DESCRIBE TABLES;
select * from core_user_tenants;
select * from core_tenant_user_roles;
|
<reponame>BasilLiao/dtriMES<filename>dtriMES/src/main/resources/import.sql
--system_config
INSERT INTO system_config(sc_id, sc_g_id, sc_g_name, sc_name, sc_value)VALUES (1, 1, 'FTP_PLT', 'IP', '10.1.89.72');
INSERT INTO system_config(sc_id, sc_g_id, sc_g_name, sc_name, sc_value)VALUES (2, 1, 'FTP_PLT', 'PORT', '21');
INSERT INTO system_config(sc_id, sc_g_id, sc_g_name, sc_name, sc_value)VALUES (3, 1, 'FTP_PLT', 'PATH', '/PMS_LOG/');
INSERT INTO system_config(sc_id, sc_g_id, sc_g_name, sc_name, sc_value)VALUES (4, 1, 'FTP_PLT', 'PATH_BACKUP', '/PMS_LOG_BACKUP/');
INSERT INTO system_config(sc_id, sc_g_id, sc_g_name, sc_name, sc_value)VALUES (5, 1, 'FTP_PLT', 'ACCOUNT', 'burn');
INSERT INTO system_config(sc_id, sc_g_id, sc_g_name, sc_name, sc_value)VALUES (6, 1, 'FTP_PLT', 'PASSWORD', '<PASSWORD>');
INSERT INTO system_config(sc_id, sc_g_id, sc_g_name, sc_name, sc_value)VALUES (7, 2, 'E_MAIL_PROXY', '帳號', '<EMAIL>');
INSERT INTO system_config(sc_id, sc_g_id, sc_g_name, sc_name, sc_value)VALUES (8, 2, 'E_MAIL_PROXY', '密碼', '123MES');
INSERT INTO system_config(sc_id, sc_g_id, sc_g_name, sc_name, sc_value)VALUES (9, 2, 'E_MAIL_PROXY', '協定', 'POST');
INSERT INTO system_config(sc_id, sc_g_id, sc_g_name, sc_name, sc_value)VALUES (10, 3, 'FTP_DATA_BKUP', 'IP', '10.1.90.10');
INSERT INTO system_config(sc_id, sc_g_id, sc_g_name, sc_name, sc_value)VALUES (11, 3, 'FTP_DATA_BKUP', 'FTP_PORT', '21');
INSERT INTO system_config(sc_id, sc_g_id, sc_g_name, sc_name, sc_value)VALUES (12, 3, 'FTP_DATA_BKUP', 'ACCOUNT', 'pm_bom_server');
INSERT INTO system_config(sc_id, sc_g_id, sc_g_name, sc_name, sc_value)VALUES (13, 3, 'FTP_DATA_BKUP', 'PASSWORD', '<PASSWORD>');
INSERT INTO system_config(sc_id, sc_g_id, sc_g_name, sc_name, sc_value)VALUES (14, 3, 'FTP_DATA_BKUP', 'PATH', '/PM_BOM_DBBackup/');
INSERT INTO system_config(sc_id, sc_g_id, sc_g_name, sc_name, sc_value)VALUES (15, 4, 'DATA_BKUP', 'FOLDER_NAME', '\WebAppBackupDatabase\');
INSERT INTO system_config(sc_id, sc_g_id, sc_g_name, sc_name, sc_value)VALUES (16, 4, 'DATA_BKUP', 'FILE_NAME', 'dtrimes_backup');
INSERT INTO system_config(sc_id, sc_g_id, sc_g_name, sc_name, sc_value)VALUES (17, 4, 'DATA_BKUP', 'PG_DUMP', 'C:\Program Files\PostgreSQL\10\bin\pg_dump.exe');
INSERT INTO system_config(sc_id, sc_g_id, sc_g_name, sc_name, sc_value)VALUES (18, 4, 'DATA_BKUP', 'DB_NAME', 'postgres://dbadmin:12345@localhost/dtrimes');
INSERT INTO system_config(sc_id, sc_g_id, sc_g_name, sc_name, sc_value)VALUES (19, 4, 'DATA_BKUP', 'DB_PORT', '5432');
SELECT setval('public.system_config_seq', 19, true);
DROP sequence IF EXISTS SYSTEM_CONFIG_G_SEQ CASCADE;
create sequence SYSTEM_CONFIG_G_SEQ start with 5 increment by 1;
--system_permission
--無權限
INSERT INTO system_permission(sp_id, sp_g_id, sp_type, sp_g_name, sp_permission, sys_sort, sp_name, sp_control,sys_header)VALUES (1, 0,0, '無', '0000000000', 0, 'Title_Group', '',true);
--系統管理
INSERT INTO system_permission(sp_id, sp_g_id, sp_type, sp_g_name, sp_permission, sys_sort, sys_status, sp_name, sp_control)VALUES (2, 1,1, '系統管理', '0001001111', 1001, 2, '設定-參數設定', 'system_config.basil');
INSERT INTO system_permission(sp_id, sp_g_id, sp_type, sp_g_name, sp_permission, sys_sort, sys_status, sp_name, sp_control)VALUES (3, 1,1, '系統管理', '0001001111', 1002, 2, '設定-單元管理', 'system_permission.basil');
INSERT INTO system_permission(sp_id, sp_g_id, sp_type, sp_g_name, sp_permission, sys_sort, sp_name, sp_control)VALUES (4, 1,1, '系統管理', '0001001111', 1003, '設定-群組管理', 'system_group.basil');
INSERT INTO system_permission(sp_id, sp_g_id, sp_type, sp_g_name, sp_permission, sys_sort, sp_name, sp_control)VALUES (5, 1,1, '系統管理', '0001001111', 1004, '設定-帳號管理', 'system_user.basil');
INSERT INTO system_permission(sp_id, sp_g_id, sp_type, sp_g_name, sp_permission, sys_sort, sp_name, sp_control)VALUES (6, 1,0, '系統管理', '0001001111', 1005, '通用-人員待命', 'system_standby.basil');
--個人功能
INSERT INTO system_permission(sp_id, sp_g_id, sp_type, sp_g_name, sp_permission, sys_sort, sp_name, sp_control)VALUES (7, 2,1, '個人設定', '0001001101', 1101, '設定-帳號參數', 'own_config.basil');
INSERT INTO system_permission(sp_id, sp_g_id, sp_type, sp_g_name, sp_permission, sys_sort, sp_name, sp_control)VALUES (8, 2,0, '個人設定', '0001001101', 1102, '通用-帳號資料', 'own_user.basil');
INSERT INTO system_permission(sp_id, sp_g_id, sp_type, sp_g_name, sp_permission, sys_sort, sp_name, sp_control)VALUES (9, 2,0, '個人設定', '0001000001', 1103, '通用-首頁', 'index.basil');
--產品製程
INSERT INTO system_permission(sp_id, sp_g_id, sp_type, sp_g_name, sp_permission, sys_sort, sp_name, sp_control)VALUES (10, 3,1, '產品製程', '0001001101', 1201, '設定-產品SN-規則', 'production_sn.basil');
INSERT INTO system_permission(sp_id, sp_g_id, sp_type, sp_g_name, sp_permission, sys_sort, sp_name, sp_control)VALUES (11, 3,1, '產品製程', '0001001101', 1202, '設定-料件SN-類型', 'production_config.basil');
INSERT INTO system_permission(sp_id, sp_g_id, sp_type, sp_g_name, sp_permission, sys_sort, sp_name, sp_control)VALUES (12, 3,0, '產品製程', '0001001101', 1203, '通用-料件SN-關聯紀錄', 'production_body.basil');
INSERT INTO system_permission(sp_id, sp_g_id, sp_type, sp_g_name, sp_permission, sys_sort, sp_name, sp_control)VALUES (13, 3,0, '產品製程', '0001001101', 1204, '通用-製令單', 'production_header.basil');
INSERT INTO system_permission(sp_id, sp_g_id, sp_type, sp_g_name, sp_permission, sys_sort, sp_name, sp_control)VALUES (14, 3,0, '產品製程', '0001001101', 1205, '通用-製令單-規格', 'production_records.basil');
INSERT INTO system_permission(sp_id, sp_g_id, sp_type, sp_g_name, sp_permission, sys_sort, sp_name, sp_control)VALUES (15, 3,0, '產品製程', '0001001111', 1206, '通用-製令單-即時進度', 'production_schedule.basil');
--工作站
--遺棄--INSERT INTO system_permission(sp_id, sp_g_id, sp_type, sp_g_name, sp_permission, sys_sort, sp_name, sp_control)VALUES (17, 4,1, '工作站', '0001001101', 1301, '設定-料件SN類型', 'workstation_item.basil');
INSERT INTO system_permission(sp_id, sp_g_id, sp_type, sp_g_name, sp_permission, sys_sort, sp_name, sp_control)VALUES (16, 4,1, '工作站', '0001001101', 1302, '設定-工作站-名稱設定', 'workstation_config.basil');
INSERT INTO system_permission(sp_id, sp_g_id, sp_type, sp_g_name, sp_permission, sys_sort, sp_name, sp_control)VALUES (18, 4,1, '工作站', '0001001101', 1303, '設定-工作站-綁定-SN', 'workstation.basil');
INSERT INTO system_permission(sp_id, sp_g_id, sp_type, sp_g_name, sp_permission, sys_sort, sp_name, sp_control)VALUES (19, 4,1, '工作站', '0001001101', 1304, '設定-工作站-流程管理', 'workstation_program.basil');
INSERT INTO system_permission(sp_id, sp_g_id, sp_type, sp_g_name, sp_permission, sys_sort, sp_name, sp_control)VALUES (20, 4,0, '工作站', '0001001101', 1305, '通用-工作站', 'workstation_work.basil');
INSERT INTO system_permission(sp_id, sp_g_id, sp_type, sp_g_name, sp_permission, sys_sort, sp_name, sp_control)VALUES (21, 4,0, '工作站', '0001001101', 1306, '通用-工作站-重工登記', 'workstation_repeat.basil');
INSERT INTO system_permission(sp_id, sp_g_id, sp_type, sp_g_name, sp_permission, sys_sort, sp_name, sp_control)VALUES (22, 4,0, '工作站', '0001001101', 1307, '通用-工作站-拆解登記', 'workstation_disassemble.basil');
INSERT INTO system_permission(sp_id, sp_g_id, sp_type, sp_g_name, sp_permission, sys_sort, sp_name, sp_control)VALUES (23, 4,0, '工作站', '0001001101', 1308, '通用-SN補單', 'workstation_snadd.basil');
--工時績效
INSERT INTO system_permission(sp_id, sp_g_id, sp_type, sp_g_name, sp_permission, sys_sort, sp_name, sp_control)VALUES (24, 5,1, '工作紀錄', '0001001101', 1401, '設定-作業類型', 'work_type.basil');
INSERT INTO system_permission(sp_id, sp_g_id, sp_type, sp_g_name, sp_permission, sys_sort, sp_name, sp_control)VALUES (25, 5,0, '工作紀錄', '0001001101', 1402, '通用-工時登記', 'work_hours.basil');
--維修區
INSERT INTO system_permission(sp_id, sp_g_id, sp_type, sp_g_name, sp_permission, sys_sort, sp_name, sp_control)VALUES (26, 6,1, '產品維修', '0001001101', 1501, '設定-不良代碼', 'maintain_code.basil');
SELECT setval('public.system_permission_seq', 24, true);
DROP sequence IF EXISTS SYSTEM_PERMISSION_G_SEQ CASCADE;
create sequence SYSTEM_PERMISSION_G_SEQ start with 7 increment by 1;
--system_group(sg_permission[特殊3(512),特殊2(256),特殊1(128),訪問(64),下載(32),上傳(16),新增(8),修改(4),刪除(2),查詢(1)])
----admin
INSERT INTO system_group(sg_id, sg_g_id, sg_name, sg_permission, sg_sp_id,sys_sort,sys_header) VALUES (1,1, '系統管理者', '0000000000', 1,0,true);
INSERT INTO system_group(sg_id, sg_g_id, sg_name, sg_permission, sg_sp_id,sys_sort) VALUES (2,1, '系統管理者', '1111111111', 2,1001);
INSERT INTO system_group(sg_id, sg_g_id, sg_name, sg_permission, sg_sp_id,sys_sort) VALUES (3,1, '系統管理者', '1111111111', 3,1002);
INSERT INTO system_group(sg_id, sg_g_id, sg_name, sg_permission, sg_sp_id,sys_sort) VALUES (4,1, '系統管理者', '0001111111', 4,1003);
INSERT INTO system_group(sg_id, sg_g_id, sg_name, sg_permission, sg_sp_id,sys_sort) VALUES (5,1, '系統管理者', '1111111111', 5,1004);
INSERT INTO system_group(sg_id, sg_g_id, sg_name, sg_permission, sg_sp_id,sys_sort) VALUES (6,1, '系統管理者', '1111111111', 6,1005);
INSERT INTO system_group(sg_id, sg_g_id, sg_name, sg_permission, sg_sp_id,sys_sort) VALUES (7,1, '系統管理者', '1111111111', 7,1006);
INSERT INTO system_group(sg_id, sg_g_id, sg_name, sg_permission, sg_sp_id,sys_sort) VALUES (8,1, '系統管理者', '1111111111', 8,1101);
INSERT INTO system_group(sg_id, sg_g_id, sg_name, sg_permission, sg_sp_id,sys_sort) VALUES (9,1, '系統管理者', '1111111111', 9,1102);
INSERT INTO system_group(sg_id, sg_g_id, sg_name, sg_permission, sg_sp_id,sys_sort) VALUES (10,1, '系統管理者', '1111111111', 10,1103);
INSERT INTO system_group(sg_id, sg_g_id, sg_name, sg_permission, sg_sp_id,sys_sort) VALUES (11,1, '系統管理者', '1111111111', 11,1201);
INSERT INTO system_group(sg_id, sg_g_id, sg_name, sg_permission, sg_sp_id,sys_sort) VALUES (12,1, '系統管理者', '1111111111', 12,1202);
INSERT INTO system_group(sg_id, sg_g_id, sg_name, sg_permission, sg_sp_id,sys_sort) VALUES (13,1, '系統管理者', '1111111111', 13,1203);
INSERT INTO system_group(sg_id, sg_g_id, sg_name, sg_permission, sg_sp_id,sys_sort) VALUES (14,1, '系統管理者', '1111111111', 14,1204);
INSERT INTO system_group(sg_id, sg_g_id, sg_name, sg_permission, sg_sp_id,sys_sort) VALUES (15,1, '系統管理者', '1111111111', 15,1205);
INSERT INTO system_group(sg_id, sg_g_id, sg_name, sg_permission, sg_sp_id,sys_sort) VALUES (16,1, '系統管理者', '1111111111', 16,1301);
--INSERT INTO system_group(sg_id, sg_g_id, sg_name, sg_permission, sg_sp_id,sys_sort) VALUES (17,1, '系統管理者', '1111111111', 17,1302);
INSERT INTO system_group(sg_id, sg_g_id, sg_name, sg_permission, sg_sp_id,sys_sort) VALUES (18,1, '系統管理者', '1111111111', 18,1303);
INSERT INTO system_group(sg_id, sg_g_id, sg_name, sg_permission, sg_sp_id,sys_sort) VALUES (19,1, '系統管理者', '1111111111', 19,1304);
INSERT INTO system_group(sg_id, sg_g_id, sg_name, sg_permission, sg_sp_id,sys_sort) VALUES (20,1, '系統管理者', '1111111111', 20,1305);
INSERT INTO system_group(sg_id, sg_g_id, sg_name, sg_permission, sg_sp_id,sys_sort) VALUES (21,1, '系統管理者', '1111111111', 21,1306);
INSERT INTO system_group(sg_id, sg_g_id, sg_name, sg_permission, sg_sp_id,sys_sort) VALUES (22,1, '系統管理者', '1111111111', 22,1401);
INSERT INTO system_group(sg_id, sg_g_id, sg_name, sg_permission, sg_sp_id,sys_sort) VALUES (23,1, '系統管理者', '1111111111', 23,1402);
INSERT INTO system_group(sg_id, sg_g_id, sg_name, sg_permission, sg_sp_id,sys_sort) VALUES (24,1, '系統管理者', '1111111111', 24,1501);
----user
INSERT INTO system_group(sg_id, sg_g_id, sg_name, sg_permission, sg_sp_id,sys_sort,sys_header) VALUES (25,2, '一般使用者', '0000000000', 1,0,true);
INSERT INTO system_group(sg_id, sg_g_id, sg_name, sg_permission, sg_sp_id,sys_sort) VALUES (26,2, '一般使用者', '0001000001', 8,1101);
INSERT INTO system_group(sg_id, sg_g_id, sg_name, sg_permission, sg_sp_id,sys_sort) VALUES (27,2, '一般使用者', '0001000001', 9,1102);
INSERT INTO system_group(sg_id, sg_g_id, sg_name, sg_permission, sg_sp_id,sys_sort) VALUES (28,2, '一般使用者', '0001000001', 10,1103);
SELECT setval('public.system_group_seq', 28, true);
DROP sequence IF EXISTS SYSTEM_GROUP_G_SEQ CASCADE;
create sequence SYSTEM_GROUP_G_SEQ start with 3 increment by 1;
--system_user
INSERT INTO system_user(su_id,su_account, su_e_name, su_email, su_name, su_password, su_position,su_sg_g_id) VALUES (1,'admin','Admin_en', '<EMAIL>', 'Admin', '$2a$10$2tt8kwMSweSbTY/Jx1T9HuWcmrHzy50fZuOJWm/XORjJEOtpIoUdy', '超級管理者',1 );
INSERT INTO system_user(su_id,su_account, su_e_name, su_email, su_name, su_password, su_position,su_sg_g_id) VALUES (2,'user','User_en', '<EMAIL>', 'User', '$2a$10$2tt8kwMSweSbTY/Jx1T9HuWcmrHzy50fZuOJWm/XORjJEOtpIoUdy', '一般使用者',2);
SELECT setval('public.system_user_seq', 2, true);
----production_records
INSERT INTO production_records(pr_id, pr_bom_id, pr_c_from,pr_c_name,pr_s_sn, pr_e_sn,pr_s_b_sn, pr_e_b_sn, pr_order_id, pr_p_model,pr_p_quantity,pr_p_ok_quantity,pr_b_item, pr_s_item) VALUES ('A44654-A654', '91-363-G100001', '測試-生產注意事項','MAYA(Isreal)', 'no_sn0000n000','no_sn0000n000','no_sn0000n000','no_sn0000n000','測試-訂單編號(OP-2021042001)', 'DT363GL',3,0, '{"CPU":i600,"RAM":"4G"}','{"M/B 版本":"R5.6.P","ECN":"D6B"}');
INSERT INTO production_records(pr_id, pr_bom_id, pr_c_from,pr_c_name,pr_s_sn, pr_e_sn,pr_s_b_sn, pr_e_b_sn, pr_order_id, pr_p_model,pr_p_quantity,pr_p_ok_quantity,pr_b_item, pr_s_item) VALUES ('A511-210204004', '92-363-G100001', '測試-生產注意事項','MAYA(Isreal)', 'no_sn0000n000','no_sn0000n000','no_sn0000n000','no_sn0000n000','測試-訂單編號(OP-2021042002)', 'DT363GL',7,0, '{"CPU":i700,"RAM":"4G"}','{"M/B 版本":"R5.7.P","ECN":"D6B"}');
INSERT INTO production_records(pr_id, pr_bom_id, pr_c_from,pr_c_name,pr_s_sn, pr_e_sn,pr_s_b_sn, pr_e_b_sn, pr_order_id, pr_p_model,pr_p_quantity,pr_p_ok_quantity,pr_b_item, pr_s_item) VALUES ('A513-123456799', '93-363-G100001', '測試-生產注意事項','MAYA(Isreal)', 'A13W1CC140300','A13W1CC140306','A13W1CC140300','A13W1CC140306','測試-訂單編號(OP-2021042002)', 'DT363GL',7,0, '{"CPU":i800,"RAM":"4G"}','{"M/B 版本":"R5.8.P","ECN":"D6B"}');
--production_header
INSERT INTO production_header(ph_id,ph_pb_g_id,ph_type, ph_pr_id, ph_schedule, ph_wp_id, sys_header, sys_ver) VALUES (1,1,'A511_no_sn', 'A44654-A654', '', 1, true, 0);
INSERT INTO production_header(ph_id,ph_pb_g_id,ph_type, ph_pr_id, ph_schedule, ph_wp_id, sys_header, sys_ver) VALUES (2,1,'A511_no_sn', 'A511-210204004', '', 2, true, 0);
INSERT INTO production_header(ph_id,ph_pb_g_id,ph_type, ph_pr_id, ph_schedule, ph_wp_id, sys_header, sys_ver) VALUES (3,3,'A511_has_sn', 'A513-123456799', '', 1, true, 0);
SELECT setval('public.production_header_seq', 3, true);
DROP sequence IF EXISTS PRODUCTION_HEADER_G_SEQ CASCADE;
create sequence PRODUCTION_HEADER_G_SEQ start with 4 increment by 1;
----production_body
INSERT INTO production_body(pb_id,pb_g_id, sys_ver, pb_value01, pb_value02 ,pb_value03 ,pb_value04 ,pb_value05 ,pb_value06 ,pb_value07,pb_value08,pb_value09,pb_sn,pb_b_sn, sys_header,pb_w_name01,pb_w_name02,pb_w_name03,pb_w_name04,pb_w_name05,pb_w_name06,pb_w_name07,pb_w_name08) VALUES ( 0,0, 0,'MB(UUID)' ,'LAN1 MAC' ,'LAN2 MAC' ,'WIFI MAC' ,'NVRAM MAC','IMEI','ECN','EC','BIOS','','', true,'PCB_processing','PCB_burnin','PCB_function_test','Assembly','Burnin','T1','T2','Package');
INSERT INTO production_body(pb_id,pb_g_id, sys_ver, pb_sn,pb_b_sn, sys_header, pb_schedule) VALUES ( 1,1, 0,'no_sn' , 'no_sn' , false, '');
INSERT INTO production_body(pb_id,pb_g_id, sys_ver, pb_sn,pb_b_sn, sys_header, pb_schedule,pb_value01) VALUES ( 5,3, 0,'A13W1CC140300' , 'A13W1CC140300' , false, '{"1":{"name":"PCB_processing","type":"N"},"5":{"name":"PCB_function_test","type":"N"}}','主版號21');
INSERT INTO production_body(pb_id,pb_g_id, sys_ver, pb_sn,pb_b_sn, sys_header, pb_schedule,pb_value01) VALUES ( 6,3, 0,'A13W1CC140301' , 'A13W1CC140301' , false, '{"1":{"name":"PCB_processing","type":"N"},"5":{"name":"PCB_function_test","type":"N"}}','主版號22');
INSERT INTO production_body(pb_id,pb_g_id, sys_ver, pb_sn,pb_b_sn, sys_header, pb_schedule,pb_value01,pb_l_text) VALUES ( 7,3, 0, 'A13W1CC140302' ,'A13W1CC140302' , false, '{"1":{"name":"PCB_processing","type":"N"},"5":{"name":"PCB_function_test","type":"N"}}','主版號23','999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999');
INSERT INTO production_body(pb_id,pb_g_id, sys_ver, pb_sn,pb_b_sn, sys_header, pb_schedule,pb_value01) VALUES ( 8,3, 0, 'A13W1CC140303' ,'A13W1CC140303' , false, '{"1":{"name":"PCB_processing","type":"N"},"5":{"name":"PCB_function_test","type":"N"}}','主版號24');
INSERT INTO production_body(pb_id,pb_g_id, sys_ver, pb_sn,pb_b_sn, sys_header, pb_schedule,pb_value01) VALUES ( 9,3, 0, 'A13W1CC140304' ,'A13W1CC140304' , false, '{"1":{"name":"PCB_processing","type":"N"},"5":{"name":"PCB_function_test","type":"N"}}','主版號25');
INSERT INTO production_body(pb_id,pb_g_id, sys_ver, pb_sn,pb_b_sn, sys_header, pb_schedule,pb_value01) VALUES ( 10,3, 0, 'A13W1CC140305' ,'A13W1CC140305' , false, '{"1":{"name":"PCB_processing","type":"N"},"5":{"name":"PCB_function_test","type":"N"}}','主版號26');
INSERT INTO production_body(pb_id,pb_g_id, sys_ver, pb_sn,pb_b_sn, sys_header, pb_schedule,pb_value01) VALUES ( 11,3, 0, 'A13W1CC140306' ,'A13W1CC140306' , false, '{"1":{"name":"PCB_processing","type":"N"},"5":{"name":"PCB_function_test","type":"N"}}','主版號27');
SELECT setval('public.production_body_seq', 11, true);
DROP sequence IF EXISTS PRODUCTION_BODY_G_SEQ CASCADE;
create sequence PRODUCTION_BODY_G_SEQ start with 4 increment by 1;
--workstation_item 'MB(UUID)' ,'LAN1 MAC' ,'LAN2 MAC'
INSERT INTO workstation_item(wi_id,sys_header, wi_pb_cell, wi_pb_value)VALUES (0, true,'Group' , 'Group');
INSERT INTO workstation_item(wi_id,sys_header, wi_pb_cell, wi_pb_value)VALUES (1, false,'pb_value01' , 'MB(UUID)');
INSERT INTO workstation_item(wi_id,sys_header, wi_pb_cell, wi_pb_value)VALUES (2, false,'pb_value02' , 'LAN1 MAC');
INSERT INTO workstation_item(wi_id,sys_header, wi_pb_cell, wi_pb_value)VALUES (3, false,'pb_value03' , 'LAN2 MAC');
INSERT INTO workstation_item(wi_id,sys_header, wi_pb_cell, wi_pb_value)VALUES (4, false,'pb_value04' , 'WIFI MAC');
INSERT INTO workstation_item(wi_id,sys_header, wi_pb_cell, wi_pb_value)VALUES (5, false,'pb_value05' , 'NVRAM MAC');
INSERT INTO workstation_item(wi_id,sys_header, wi_pb_cell, wi_pb_value)VALUES (6, false,'pb_value06' , 'IMEI');
INSERT INTO workstation_item(wi_id,sys_header, wi_pb_cell, wi_pb_value)VALUES (7, false,'pb_value07' , 'ECN');
INSERT INTO workstation_item(wi_id,sys_header, wi_pb_cell, wi_pb_value)VALUES (8, false,'pb_value08' , 'EC');
INSERT INTO workstation_item(wi_id,sys_header, wi_pb_cell, wi_pb_value)VALUES (9, false,'pb_value09' , 'BIOS');
SELECT setval('public.workstation_item_seq', 9, true);
--workstation
INSERT INTO workstation(w_id, sys_header, w_c_name, w_g_id, w_pb_name,w_pb_cell, w_sg_name,w_sg_id, w_i_id)VALUES (0, true, 'Group', 0, 'Group','','', 0, 0);
INSERT INTO workstation(w_id, sys_header, w_c_name, w_g_id, w_pb_name,w_pb_cell, w_sg_name,w_sg_id, w_i_id)VALUES (1, true, 'BC088', 1, 'PCB_processing','pb_w_name01','系統管理者', 1, 0);
INSERT INTO workstation(w_id, sys_header, w_c_name, w_g_id, w_pb_name,w_pb_cell, w_sg_name,w_sg_id, w_i_id)VALUES (2, false, 'BC088', 1, 'PCB_processing','pb_w_name01','系統管理者', 1, 1);
INSERT INTO workstation(w_id, sys_header, w_c_name, w_g_id, w_pb_name,w_pb_cell, w_sg_name,w_sg_id, w_i_id)VALUES (3, false, 'BC088', 1, 'PCB_processing','pb_w_name01','系統管理者', 1, 2);
INSERT INTO workstation(w_id, sys_header, w_c_name, w_g_id, w_pb_name,w_pb_cell, w_sg_name,w_sg_id, w_i_id)VALUES (4, false, 'BC088', 1, 'PCB_processing','pb_w_name01','系統管理者', 1, 3);
INSERT INTO workstation(w_id, sys_header, w_c_name, w_g_id, w_pb_name,w_pb_cell, w_sg_name,w_sg_id, w_i_id)VALUES (5, true, 'BC099', 2, 'PCB_function_test','pb_w_name03','系統管理者', 1, 0);
INSERT INTO workstation(w_id, sys_header, w_c_name, w_g_id, w_pb_name,w_pb_cell, w_sg_name,w_sg_id, w_i_id)VALUES (6, false, 'BC099', 2, 'PCB_function_test','pb_w_name03','系統管理者', 1, 1);
INSERT INTO workstation(w_id, sys_header, w_c_name, w_g_id, w_pb_name,w_pb_cell, w_sg_name,w_sg_id, w_i_id)VALUES (7, false, 'BC099', 2, 'PCB_function_test','pb_w_name03','系統管理者', 1, 2);
SELECT setval('public.workstation_seq', 7, true);
DROP sequence IF EXISTS WORKSTATION_G_SEQ CASCADE;
create sequence WORKSTATION_G_SEQ start with 3 increment by 1;
--workstation_program
INSERT INTO workstation_program(wp_id,wp_g_id,wp_w_g_id, wp_c_name, wp_name, sys_sort,sys_header) VALUES (1,1,0,'WP999', '測試-PCB+TEST站程序', 0,true);
INSERT INTO workstation_program(wp_id,wp_g_id,wp_w_g_id, wp_c_name, wp_name, sys_sort,sys_header) VALUES (2,1,1,'WP999', '測試-PCB+TEST站程序', 1,false);
INSERT INTO workstation_program(wp_id,wp_g_id,wp_w_g_id, wp_c_name, wp_name, sys_sort,sys_header) VALUES (3,1,2,'WP999', '測試-PCB+TEST站程序', 2,false);
INSERT INTO workstation_program(wp_id,wp_g_id,wp_w_g_id, wp_c_name, wp_name, sys_sort,sys_header) VALUES (4,2,0,'WP888', '測試-TEST站程序', 0,true);
INSERT INTO workstation_program(wp_id,wp_g_id,wp_w_g_id, wp_c_name , wp_name, sys_sort,sys_header) VALUES (5,2,1,'WP888', '測試-TEST站程序', 1,false);
SELECT setval('public.workstation_program_seq', 5, true);
DROP sequence IF EXISTS WORKSTATION_PROGRAM_G_SEQ CASCADE;
create sequence WORKSTATION_PROGRAM_G_SEQ start with 3 increment by 1;
--production_sn
INSERT INTO production_sn(ps_id, ps_g_id, ps_g_name, ps_name, ps_value,sys_header)VALUES (1, 1, '機種別', '', '',true);
INSERT INTO production_sn(ps_id, ps_g_id, ps_g_name, ps_name, ps_value,sys_header)VALUES (2, 1, '機種別', 'NO(SN)', 'no_',false);
INSERT INTO production_sn(ps_id, ps_g_id, ps_g_name, ps_name, ps_value,sys_header)VALUES (3, 1, '機種別', '136BU', 'AAA',false);
INSERT INTO production_sn(ps_id, ps_g_id, ps_g_name, ps_name, ps_value,sys_header)VALUES (4, 2, '生產廠別', '', '',true);
INSERT INTO production_sn(ps_id, ps_g_id, ps_g_name, ps_name, ps_value,sys_header)VALUES (5, 2, '生產廠別', 'NO(SN)', 's',false);
INSERT INTO production_sn(ps_id, ps_g_id, ps_g_name, ps_name, ps_value,sys_header)VALUES (6, 2, '生產廠別', 'Beijing', 'B',false);
INSERT INTO production_sn(ps_id, ps_g_id, ps_g_name, ps_name, ps_value,sys_header)VALUES (7, 3, '保固期限', '', '',true);
INSERT INTO production_sn(ps_id, ps_g_id, ps_g_name, ps_name, ps_value,sys_header)VALUES (8, 3, '保固期限', 'NO(SN)', 'n',false);
INSERT INTO production_sn(ps_id, ps_g_id, ps_g_name, ps_name, ps_value,sys_header)VALUES (9, 3, '保固期限', '1_year', '1',false);
INSERT INTO production_sn(ps_id, ps_g_id, ps_g_name, ps_name, ps_value,sys_header)VALUES (10, 4, '生產年周', '', '',true);
INSERT INTO production_sn(ps_id, ps_g_id, ps_g_name, ps_name, ps_value,sys_header)VALUES (11, 4, '生產年周', '[YYWW]', '2118',false);
INSERT INTO production_sn(ps_id, ps_g_id, ps_g_name, ps_name, ps_value,sys_header)VALUES (12, 5, 'Panel廠商(面板)', '', '',true);
INSERT INTO production_sn(ps_id, ps_g_id, ps_g_name, ps_name, ps_value,sys_header)VALUES (13, 5, 'Panel廠商(面板)','NO(SN)', 'n',false);
INSERT INTO production_sn(ps_id, ps_g_id, ps_g_name, ps_name, ps_value,sys_header)VALUES (14, 5, 'Panel廠商(面板)','AGL', 'A',false);
INSERT INTO production_sn(ps_id, ps_g_id, ps_g_name, ps_name, ps_value,sys_header)VALUES (15, 6, '流水號', '', '',true);
INSERT INTO production_sn(ps_id, ps_g_id, ps_g_name, ps_name, ps_value,sys_header)VALUES (16, 6, '流水號', '[000]', '346',false);
SELECT setval('public.production_sn_seq', 16, true);
DROP sequence IF EXISTS PRODUCTION_SN_G_SEQ CASCADE;
create sequence PRODUCTION_SN_G_SEQ start with 7 increment by 1;
--維修code
INSERT INTO maintain_code(mc_id, mc_g_id, mc_g_name, mc_name, mc_value,sys_header)VALUES (1, 1, '電池', '', 'EC',true);
INSERT INTO maintain_code(mc_id, mc_g_id, mc_g_name, mc_name, mc_value,sys_header)VALUES (2, 1, '電池', '冒煙', 'EC001',false);
INSERT INTO maintain_code(mc_id, mc_g_id, mc_g_name, mc_name, mc_value,sys_header)VALUES (3, 1, '電池', '浸水', 'EC002',false);
INSERT INTO maintain_code(mc_id, mc_g_id, mc_g_name, mc_name, mc_value,sys_header)VALUES (4, 1, '電池', '長香菇', 'EC003',false);
INSERT INTO maintain_code(mc_id, mc_g_id, mc_g_name, mc_name, mc_value,sys_header)VALUES (5, 2, '螢幕', '', 'EA',true);
INSERT INTO maintain_code(mc_id, mc_g_id, mc_g_name, mc_name, mc_value,sys_header)VALUES (6, 2, '螢幕', '不亮', 'EA001',false);
INSERT INTO maintain_code(mc_id, mc_g_id, mc_g_name, mc_name, mc_value,sys_header)VALUES (7, 2, '螢幕', '很亮', 'EA002',false);
INSERT INTO maintain_code(mc_id, mc_g_id, mc_g_name, mc_name, mc_value,sys_header)VALUES (8, 2, '螢幕', '一下亮一下不亮', 'EA003',false);
SELECT setval('public.maintain_code_seq', 8, true);
DROP sequence IF EXISTS MAINTAIN_CODE_G_SEQ CASCADE;
create sequence MAINTAIN_CODE_G_SEQ start with 3 increment by 1;
--工作類型
INSERT INTO work_type(wt_id,wt_name)VALUES (0,'Title_Group');
INSERT INTO work_type(wt_id,wt_name)VALUES (1,'前板組裝');
INSERT INTO work_type(wt_id,wt_name)VALUES (2,'後板組裝');
INSERT INTO work_type(wt_id,wt_name)VALUES (3,'其他');
INSERT INTO work_type(wt_id,wt_name)VALUES (4,'電池組裝');
SELECT setval('public.work_type_seq', 4, true);
--工時登記
INSERT INTO public.work_hours(wh_id, wh_account, wh_do, wh_nb, wh_pr_id, wh_wt_id,sys_header,sys_status)VALUES (1, '', '', 0, 'A44654-A654', 0,true,2);
INSERT INTO public.work_hours(wh_id, wh_account, wh_do, wh_nb, wh_pr_id, wh_wt_id,sys_status)VALUES (2, 'admin', '測1試做事', 1, 'A44654-A654', 1,2);
INSERT INTO public.work_hours(wh_id, wh_account, wh_do, wh_nb, wh_pr_id, wh_wt_id,sys_status)VALUES (3, 'admin', '測2試做事', 2, 'A44654-A654', 2,2);
INSERT INTO public.work_hours(wh_id, wh_account, wh_do, wh_nb, wh_pr_id, wh_wt_id,sys_status)VALUES (4, 'admin', '測3試做事', 2, 'A44654-A654', 3,2);
INSERT INTO public.work_hours(wh_id, wh_account, wh_do, wh_nb, wh_pr_id, wh_wt_id,sys_header,sys_status)VALUES (5, '', '', 0, 'A511-210204004', 0,true,2);
INSERT INTO public.work_hours(wh_id, wh_account, wh_do, wh_nb, wh_pr_id, wh_wt_id,sys_status)VALUES (6, 'admin', '測1試做事', 1, 'A511-210204004', 1,2);
INSERT INTO public.work_hours(wh_id, wh_account, wh_do, wh_nb, wh_pr_id, wh_wt_id,sys_status)VALUES (7, 'admin', '測2試做事', 2, 'A511-210204004', 2,2);
INSERT INTO public.work_hours(wh_id, wh_account, wh_do, wh_nb, wh_pr_id, wh_wt_id,sys_status)VALUES (8, 'admin', '測3試做事', 2, 'A511-210204004', 3,2);
SELECT setval('public.work_hours_seq', 8, true);
|
<filename>cinema/db/scripts/update_001.sql
create table if not exists cinema_places (
id serial primary key not null,
row int not null,
place_number int not null,
price int not null
);
create table if not exists cinema_accounts (
id serial primary key not null,
name varchar(100) not null,
phone_number varchar(50) not null,
id_place int references cinema_places(id),
CONSTRAINT id_place_unique UNIQUE (id_place)
); |
--
-- Licensed to the Apache Software Foundation (ASF) under one or more
-- contributor license agreements. See the NOTICE file distributed with
-- this work for additional information regarding copyright ownership.
-- The ASF licenses this file to You under the Apache License, Version 2.0
-- (the "License"); you may not use this file except in compliance with
-- the License. You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
--
--test to make sure WAIT state is displayed when lock table is printed
connect 'wombat;user=c1' AS C1;
create procedure c1.sleep(t INTEGER) dynamic result sets 0 language java external name 'java.lang.Thread.sleep' parameter style java;
create table c1.account (a int primary key not null, b int);
autocommit off;
insert into c1.account values (0, 1);
insert into c1.account values (1, 1);
insert into c1.account values (2, 1);
--setting to -1 (wait for ever to handle timing issues in the test)
call SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY('derby.locks.waitTimeout', '-1');
commit ;
-- call sleep once now we don't have a timing problem later
call c1.sleep(200);
update c1.account set b = b + 11;
connect 'wombat;user=c2' AS C2;
autocommit off;
async C2S1 'update c1.account set b = b + 11';
set connection C1;
call c1.sleep(200);
select state from syscs_diag.lock_table order by state;
commit;
call SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY('derby.locks.waitTimeout', '180');
commit;
set connection c2 ;
wait for C2S1;
select state from syscs_diag.lock_table order by state;
commit;
|
-- This file and its contents are licensed under the Apache License 2.0.
-- Please see the included NOTICE for copyright information and
-- LICENSE-APACHE for a copy of the license.
\set TEST_DBNAME_2 :TEST_DBNAME _2
\c :TEST_DBNAME :ROLE_SUPERUSER
-- start bgw since they are stopped for tests by default
SELECT _timescaledb_internal.start_background_workers();
CREATE DATABASE :TEST_DBNAME_2;
\c :TEST_DBNAME_2 :ROLE_SUPERUSER
\ir include/bgw_launcher_utils.sql
-- When we've connected to test db 2, we should be able to see the cluster launcher
-- and the scheduler for test db in pg_stat_activity
-- but test db 2 shouldn't have a scheduler because ext not created yet
SELECT wait_worker_counts(1,1,0,0);
-- Now create the extension in test db 2
SET client_min_messages = ERROR;
CREATE EXTENSION timescaledb CASCADE;
RESET client_min_messages;
SELECT wait_worker_counts(1,1,1,0);
DROP DATABASE :TEST_DBNAME;
-- Now the db_scheduler for test db should have disappeared
SELECT wait_worker_counts(1,0,1,0);
-- Now let's restart the scheduler in test db 2 and make sure our backend_start changed
SELECT backend_start as orig_backend_start
FROM pg_stat_activity
WHERE application_name = 'TimescaleDB Background Worker Scheduler'
AND datname = :'TEST_DBNAME_2' \gset
-- We'll do this in a txn so that we can see that the worker locks on our txn before continuing
BEGIN;
SELECT _timescaledb_internal.restart_background_workers();
SELECT wait_worker_counts(1,0,1,0);
SELECT (backend_start > :'orig_backend_start'::timestamptz) backend_start_changed,
(wait_event = 'virtualxid') wait_event_changed
FROM pg_stat_activity
WHERE application_name = 'TimescaleDB Background Worker Scheduler'
AND datname = :'TEST_DBNAME_2';
COMMIT;
SELECT wait_worker_counts(1,0,1,0);
SELECT (wait_event IS DISTINCT FROM 'virtualxid') wait_event_changed
FROM pg_stat_activity
WHERE application_name = 'TimescaleDB Background Worker Scheduler'
AND datname = :'TEST_DBNAME_2';
-- Test stop
SELECT _timescaledb_internal.stop_background_workers();
SELECT wait_worker_counts(1,0,0,0);
-- Make sure it doesn't break if we stop twice in a row
SELECT _timescaledb_internal.stop_background_workers();
SELECT wait_worker_counts(1,0,0,0);
-- test start
SELECT _timescaledb_internal.start_background_workers();
SELECT wait_worker_counts(1,0,1,0);
-- make sure start is idempotent
SELECT backend_start as orig_backend_start
FROM pg_stat_activity
WHERE application_name = 'TimescaleDB Background Worker Scheduler'
AND datname = :'TEST_DBNAME_2' \gset
-- Since we're doing idempotency tests, we're also going to exercise our queue and start 20 times
SELECT _timescaledb_internal.start_background_workers() as start_background_workers, * FROM generate_series(1,20);
-- Here we're waiting to see if something shows up in pg_stat_activity,
-- so we have to condition our loop in the opposite way. We'll only wait
-- half a second in total as well so that tests don't take too long.
CREATE FUNCTION wait_equals(TIMESTAMPTZ, TEXT) RETURNS BOOLEAN LANGUAGE PLPGSQL AS
$BODY$
DECLARE
r BOOLEAN;
BEGIN
FOR i in 1..5
LOOP
SELECT (backend_start = $1::timestamptz) backend_start_unchanged
FROM pg_stat_activity
WHERE application_name = 'TimescaleDB Background Worker Scheduler'
AND datname = $2 into r;
if(r) THEN
PERFORM pg_sleep(0.1);
PERFORM pg_stat_clear_snapshot();
ELSE
RETURN FALSE;
END IF;
END LOOP;
RETURN TRUE;
END
$BODY$;
select wait_equals(:'orig_backend_start', :'TEST_DBNAME_2');
-- Make sure restart starts a worker even if it is stopped
SELECT _timescaledb_internal.stop_background_workers();
SELECT wait_worker_counts(1,0,0,0);
SELECT _timescaledb_internal.restart_background_workers();
SELECT wait_worker_counts(1,0,1,0);
-- Make sure drop extension statement restarts the worker and on rollback it keeps running
-- Now let's restart the scheduler and make sure our backend_start changed
SELECT backend_start as orig_backend_start
FROM pg_stat_activity
WHERE application_name = 'TimescaleDB Background Worker Scheduler'
AND datname = :'TEST_DBNAME_2' \gset
BEGIN;
DROP EXTENSION timescaledb;
SELECT wait_worker_counts(1,0,1,0);
ROLLBACK;
CREATE FUNCTION wait_greater(TIMESTAMPTZ,TEXT) RETURNS BOOLEAN LANGUAGE PLPGSQL AS
$BODY$
DECLARE
r BOOLEAN;
BEGIN
FOR i in 1..10
LOOP
SELECT (backend_start > $1::timestamptz) backend_start_changed
FROM pg_stat_activity
WHERE application_name = 'TimescaleDB Background Worker Scheduler'
AND datname = $2 into r;
if(NOT r) THEN
PERFORM pg_sleep(0.1);
PERFORM pg_stat_clear_snapshot();
ELSE
RETURN TRUE;
END IF;
END LOOP;
RETURN FALSE;
END
$BODY$;
SELECT wait_greater(:'orig_backend_start',:'TEST_DBNAME_2');
-- Make sure canceling the launcher backend causes a restart of schedulers
SELECT backend_start as orig_backend_start
FROM pg_stat_activity
WHERE application_name = 'TimescaleDB Background Worker Scheduler'
AND datname = :'TEST_DBNAME_2' \gset
SELECT coalesce(
(SELECT pg_cancel_backend(pid) FROM pg_stat_activity WHERE application_name = 'TimescaleDB Background Worker Launcher'),
(SELECT current_setting('server_version_num')::int < 100000));
SELECT wait_worker_counts(1,0,1,0);
SELECT ((current_setting('server_version_num')::int < 100000) OR wait_greater(:'orig_backend_start', :'TEST_DBNAME_2')) as wait_greater;
-- Make sure running pre_restore function stops background workers
SELECT timescaledb_pre_restore();
SELECT wait_worker_counts(1,0,0,0);
-- Make sure a restart with restoring on first starts the background worker
BEGIN;
SELECT _timescaledb_internal.restart_background_workers();
SELECT wait_worker_counts(1,0,1,0);
COMMIT;
-- Then the worker dies when it sees that restoring is on after the txn commits
SELECT wait_worker_counts(1,0,0,0);
--And post_restore starts them
BEGIN;
SELECT timescaledb_post_restore();
SELECT wait_worker_counts(1,0,1,0);
COMMIT;
-- And they stay started
SELECT wait_worker_counts(1,0,1,0);
-- Make sure dropping the extension means that the scheduler is stopped
BEGIN;
DROP EXTENSION timescaledb;
COMMIT;
SELECT wait_worker_counts(1,0,0,0);
-- Test that background workers are stopped with DROP OWNED
ALTER ROLE :ROLE_DEFAULT_PERM_USER WITH SUPERUSER;
\c :TEST_DBNAME_2 :ROLE_DEFAULT_PERM_USER
SET client_min_messages = ERROR;
CREATE EXTENSION timescaledb CASCADE;
RESET client_min_messages;
-- Make sure there is 1 launcher and 1 bgw in test db 2
SELECT wait_worker_counts(launcher_ct=>1, scheduler1_ct=> 0, scheduler2_ct=>1, template1_ct=>0);
-- drop a non-owner of the extension results in no change to worker counts
DROP OWNED BY :ROLE_DEFAULT_PERM_USER_2;
SELECT wait_worker_counts(launcher_ct=>1, scheduler1_ct=> 0, scheduler2_ct=>1, template1_ct=>0);
-- drop of owner of extension results in extension drop and a stop to the bgw
DROP OWNED BY :ROLE_DEFAULT_PERM_USER;
-- The worker in test db 2 is dead. Note that 0s are respected
SELECT wait_worker_counts(launcher_ct=>1, scheduler1_ct=>0, scheduler2_ct=>0, template1_ct=>0);
\c :TEST_DBNAME_2 :ROLE_SUPERUSER
ALTER ROLE :ROLE_DEFAULT_PERM_USER WITH NOSUPERUSER;
-- Connect to the template1 database
\c template1
\ir include/bgw_launcher_utils.sql
BEGIN;
-- Then create extension there in a txn and make sure we see a scheduler start
SET client_min_messages = ERROR;
CREATE EXTENSION timescaledb CASCADE;
RESET client_min_messages;
SELECT wait_worker_counts(1,0,0,1);
COMMIT;
-- End our transaction and it should immediately exit because it's a template database.
SELECT wait_worker_counts(1,0,0,0);
-- Clean up the template database, removing our test utilities etc
\ir include/bgw_launcher_utils_cleanup.sql
\c :TEST_DBNAME_2
-- Now try creating a DB from a template with the extension already installed.
-- Make sure we see a scheduler start.
CREATE DATABASE :TEST_DBNAME;
SELECT wait_worker_counts(1,1,0,0);
DROP DATABASE :TEST_DBNAME;
-- Now make sure that there's no race between create database and create extension.
-- Although to be honest, this race probably wouldn't manifest in this test.
\c template1
DROP EXTENSION timescaledb;
\c :TEST_DBNAME_2
CREATE DATABASE :TEST_DBNAME;
\c :TEST_DBNAME
SET client_min_messages = ERROR;
CREATE EXTENSION timescaledb;
RESET client_min_messages;
\c :TEST_DBNAME_2
SELECT wait_worker_counts(1,1,0,0);
-- test rename database
CREATE DATABASE db_rename_test;
\c db_rename_test :ROLE_SUPERUSER
SET client_min_messages=error;
CREATE EXTENSION timescaledb;
\c :TEST_DBNAME_2 :ROLE_SUPERUSER
SELECT wait_for_bgw_scheduler('db_rename_test');
ALTER DATABASE db_rename_test RENAME TO db_rename_test2;
DROP DATABASE db_rename_test2;
-- test create database with timescaledb database as template
SELECT wait_for_bgw_scheduler(:'TEST_DBNAME');
CREATE DATABASE db_from_template WITH TEMPLATE :TEST_DBNAME;
SELECT wait_for_bgw_scheduler(:'TEST_DBNAME');
DROP DATABASE db_from_template;
-- test alter database set tablespace
SET client_min_messages TO error;
DROP TABLESPACE IF EXISTS tablespace1;
RESET client_min_messages;
CREATE TABLESPACE tablespace1 OWNER :ROLE_DEFAULT_PERM_USER LOCATION :TEST_TABLESPACE1_PATH;
SELECT wait_for_bgw_scheduler(:'TEST_DBNAME');
ALTER DATABASE :TEST_DBNAME SET TABLESPACE tablespace1;
-- clean up additional database
\c :TEST_DBNAME :ROLE_SUPERUSER
DROP DATABASE :TEST_DBNAME_2;
|
/****** Object: View [dbo].[V_Protein_Collection_List_Report] ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[V_Protein_Collection_List_Report]
AS
SELECT LookupQ.ID,
LookupQ.[Name],
CASE
WHEN ISNULL(Org.OG_organismDBName, '') = LookupQ.[Name] THEN
CASE
WHEN ISNULL(LookupQ.[Description], '') = '' THEN 'PREFERRED'
ELSE 'PREFERRED: ' + LookupQ.[Description]
END
ELSE LookupQ.[Description]
END AS [Description],
LookupQ.[Organism Name],
LookupQ.[State],
LookupQ.Entries,
LookupQ.Residues,
CASE
WHEN IntStandardOrContaminant > 0 THEN NULL
ELSE PCU.Job_Usage_Count_Last12Months
END AS [Usage Last 12 Months],
CASE
WHEN IntStandardOrContaminant > 0 THEN NULL
ELSE PCU.Job_Usage_Count
END AS [Usage All Years],
CASE
WHEN IntStandardOrContaminant > 0 THEN NULL
ELSE SUBSTRING(CONVERT(varchar(32), dbo.GetDateWithoutTime(PCU.Most_Recently_Used), 120), 1, 10)
END AS [Most Recent Usage],
LookupQ.[Type],
LookupQ.[Source]
FROM ( SELECT [Name],
[Type],
[Description],
[Source],
Entries,
Residues,
IntStandardOrContaminant,
ID,
CASE
WHEN IntStandardOrContaminant > 0 THEN ''
ELSE Organism_Name
END AS [Organism Name],
[State]
FROM ( SELECT [Filename] As [Name],
[Type],
[Description],
[Source],
NumProteins As Entries,
NumResidues As Residues,
CASE
WHEN [Type] IN ('Internal_Standard', 'contaminant', 'old_contaminant') THEN 1 ELSE 0 END AS IntStandardOrContaminant,
Organism_Name,
Protein_Collection_ID As ID,
State_Name As [State]
FROM S_V_Protein_Collections_by_Organism
) AS CP
) AS LookupQ
LEFT JOIN dbo.T_Organisms Org
ON LookupQ.[Organism Name] = Org.OG_Name
LEFT OUTER JOIN T_Protein_Collection_Usage PCU
ON LookupQ.ID = PCU.Protein_Collection_ID
GROUP BY LookupQ.ID, LookupQ.[Name], LookupQ.[Description], LookupQ.[Organism Name],
LookupQ.[State], LookupQ.Entries, LookupQ.Residues,
PCU.Job_Usage_Count_Last12Months, PCU.Job_Usage_Count,
PCU.Most_Recently_Used, LookupQ.[Type], LookupQ.[Source],
LookupQ.IntStandardOrContaminant, Org.OG_organismDBName
GO
GRANT VIEW DEFINITION ON [dbo].[V_Protein_Collection_List_Report] TO [DDL_Viewer] AS [dbo]
GO
|
<reponame>TarkTech/Dapper-Extensions
DROP TABLE DB2ADMIN.FOOTABLE;
CREATE TABLE DB2ADMIN.FOOTABLE (
FOOID INT NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1, NO CACHE) PRIMARY KEY,
"FIRST" NVARCHAR(50),
"LAST" NVARCHAR(50),
BIRTHDATE DATE
); |
CREATE VIEW view1 AS
SELECT metadata_test_table.afield,
metadata_test_table.bfield
FROM metadata_test_table;
GO |
<reponame>justin-atwell/hedera-mirror-node
CREATE USER ${api-user} WITH
LOGIN
NOCREATEDB
NOCREATEROLE
NOINHERIT
NOREPLICATION
CONNECTION LIMIT -1
PASSWORD '${<PASSWORD>}';
CREATE SEQUENCE s_transaction_types_seq;
CREATE SEQUENCE s_record_files_seq;
CREATE SEQUENCE s_transactions_seq;
CREATE SEQUENCE s_entities_seq;
CREATE SEQUENCE s_transaction_results_seq;
CREATE SEQUENCE s_account_balances_seq;
CREATE SEQUENCE s_events_id_seq;
CREATE TABLE t_transaction_types (
id INTEGER PRIMARY KEY NOT NULL DEFAULT nextval('s_transaction_types_seq')
,proto_id INTEGER
,name VARCHAR(30)
);
INSERT INTO t_transaction_types (proto_id, name) values (-1,'UNKNOWN');
INSERT INTO t_transaction_types (proto_id, name) values (1,'CRYPTOTRANSFER');
INSERT INTO t_transaction_types (proto_id, name) values (2,'CRYPTOUPDATEACCOUNT');
INSERT INTO t_transaction_types (proto_id, name) values (3,'CRYPTODELETE');
INSERT INTO t_transaction_types (proto_id, name) values (4,'CRYPTOADDCLAIM');
INSERT INTO t_transaction_types (proto_id, name) values (5,'CRYPTODELETECLAIM');
INSERT INTO t_transaction_types (proto_id, name) values (6,'CONTRACTCALL');
INSERT INTO t_transaction_types (proto_id, name) values (7,'CONTRACTCREATEINSTANCE');
INSERT INTO t_transaction_types (proto_id, name) values (8,'CONTRACTUPDATEINSTANCE');
INSERT INTO t_transaction_types (proto_id, name) values (9,'FILECREATE');
INSERT INTO t_transaction_types (proto_id, name) values (10,'FILEAPPEND');
INSERT INTO t_transaction_types (proto_id, name) values (11,'FILEUPDATE');
INSERT INTO t_transaction_types (proto_id, name) values (12,'FILEDELETE');
INSERT INTO t_transaction_types (proto_id, name) values (27,'CRYPTOCREATEACCOUNT');
INSERT INTO t_transaction_types (proto_id, name) values (28,'SYSTEMDELETE');
INSERT INTO t_transaction_types (proto_id, name) values (29,'SYSTEMUNDELETE');
INSERT INTO t_transaction_types (proto_id, name) values (30,'CONTRACTDELETEINSTANCE');
CREATE TABLE t_transaction_results (
id INTEGER PRIMARY KEY NOT NULL DEFAULT nextval('s_transaction_results_seq')
,proto_id INTEGER
,result VARCHAR(100)
);
INSERT INTO t_transaction_results (result, proto_id) VALUES ('not_known_to_db', -1);
INSERT INTO t_transaction_results (result, proto_id) VALUES ('OK', 0);
INSERT INTO t_transaction_results (result, proto_id) VALUES ('INVALID_TRANSACTION',1);
INSERT INTO t_transaction_results (result, proto_id) VALUES ('PAYER_ACCOUNT_NOT_FOUND',2);
INSERT INTO t_transaction_results (result, proto_id) VALUES ('INVALID_NODE_ACCOUNT',3);
INSERT INTO t_transaction_results (result, proto_id) VALUES ('TRANSACTION_EXPIRED',4);
INSERT INTO t_transaction_results (result, proto_id) VALUES ('INVALID_TRANSACTION_START',5);
INSERT INTO t_transaction_results (result, proto_id) VALUES ('INVALID_TRANSACTION_DURATION',6);
INSERT INTO t_transaction_results (result, proto_id) VALUES ('INVALID_SIGNATURE',7);
INSERT INTO t_transaction_results (result, proto_id) VALUES ('MEMO_TOO_LONG',8);
INSERT INTO t_transaction_results (result, proto_id) VALUES ('INSUFFICIENT_TX_FEE',9);
INSERT INTO t_transaction_results (result, proto_id) VALUES ('INSUFFICIENT_PAYER_BALANCE',10);
INSERT INTO t_transaction_results (result, proto_id) VALUES ('DUPLICATE_TRANSACTION',11);
INSERT INTO t_transaction_results (result, proto_id) VALUES ('BUSY',12);
INSERT INTO t_transaction_results (result, proto_id) VALUES ('NOT_SUPPORTED',13);
INSERT INTO t_transaction_results (result, proto_id) VALUES ('INVALID_FILE_ID',14);
INSERT INTO t_transaction_results (result, proto_id) VALUES ('INVALID_ACCOUNT_ID',15);
INSERT INTO t_transaction_results (result, proto_id) VALUES ('INVALID_CONTRACT_ID',16);
INSERT INTO t_transaction_results (result, proto_id) VALUES ('INVALID_TRANSACTION_ID',17);
INSERT INTO t_transaction_results (result, proto_id) VALUES ('RECEIPT_NOT_FOUND',18);
INSERT INTO t_transaction_results (result, proto_id) VALUES ('RECORD_NOT_FOUND',19);
INSERT INTO t_transaction_results (result, proto_id) VALUES ('INVALID_SOLIDITY_ID',20);
INSERT INTO t_transaction_results (result, proto_id) VALUES ('UNKNOWN',21);
INSERT INTO t_transaction_results (result, proto_id) VALUES ('SUCCESS',22);
INSERT INTO t_transaction_results (result, proto_id) VALUES ('FAIL_INVALID',23);
INSERT INTO t_transaction_results (result, proto_id) VALUES ('FAIL_FEE',24);
INSERT INTO t_transaction_results (result, proto_id) VALUES ('FAIL_BALANCE',25);
INSERT INTO t_transaction_results (result, proto_id) VALUES ('KEY_REQUIRED',26);
INSERT INTO t_transaction_results (result, proto_id) VALUES ('BAD_ENCODING',27);
INSERT INTO t_transaction_results (result, proto_id) VALUES ('INSUFFICIENT_ACCOUNT_BALANCE',28);
INSERT INTO t_transaction_results (result, proto_id) VALUES ('INVALID_SOLIDITY_ADDRESS',29);
INSERT INTO t_transaction_results (result, proto_id) VALUES ('INSUFFICIENT_GAS',30);
INSERT INTO t_transaction_results (result, proto_id) VALUES ('CONTRACT_SIZE_LIMIT_EXCEEDED',31);
INSERT INTO t_transaction_results (result, proto_id) VALUES ('LOCAL_CALL_MODIFICATION_EXCEPTION',32);
INSERT INTO t_transaction_results (result, proto_id) VALUES ('CONTRACT_REVERT_EXECUTED',33);
INSERT INTO t_transaction_results (result, proto_id) VALUES ('CONTRACT_EXECUTION_EXCEPTION',34);
INSERT INTO t_transaction_results (result, proto_id) VALUES ('INVALID_RECEIVING_NODE_ACCOUNT',35);
INSERT INTO t_transaction_results (result, proto_id) VALUES ('MISSING_QUERY_HEADER',36);
INSERT INTO t_transaction_results (result, proto_id) VALUES ('ACCOUNT_UPDATE_FAILED',37);
INSERT INTO t_transaction_results (result, proto_id) VALUES ('INVALID_KEY_ENCODING',38);
INSERT INTO t_transaction_results (result, proto_id) VALUES ('NULL_SOLIDITY_ADDRESS',39);
INSERT INTO t_transaction_results (result, proto_id) VALUES ('CONTRACT_UPDATE_FAILED',40);
INSERT INTO t_transaction_results (result, proto_id) VALUES ('INVALID_QUERY_HEADER',41);
INSERT INTO t_transaction_results (result, proto_id) VALUES ('INVALID_FEE_SUBMITTED',42);
INSERT INTO t_transaction_results (result, proto_id) VALUES ('INVALID_PAYER_SIGNATURE',43);
INSERT INTO t_transaction_results (result, proto_id) VALUES ('KEY_NOT_PROVIDED',44);
INSERT INTO t_transaction_results (result, proto_id) VALUES ('INVALID_EXPIRATION_TIME',45);
INSERT INTO t_transaction_results (result, proto_id) VALUES ('NO_WACL_KEY',46);
INSERT INTO t_transaction_results (result, proto_id) VALUES ('FILE_CONTENT_EMPTY',47);
INSERT INTO t_transaction_results (result, proto_id) VALUES ('INVALID_ACCOUNT_AMOUNTS',48);
INSERT INTO t_transaction_results (result, proto_id) VALUES ('EMPTY_TRANSACTION_BODY',49);
INSERT INTO t_transaction_results (result, proto_id) VALUES ('INVALID_TRANSACTION_BODY',50);
INSERT INTO t_transaction_results (result, proto_id) VALUES ('INVALID_SIGNATURE_TYPE_MISMATCHING_KEY',51);
INSERT INTO t_transaction_results (result, proto_id) VALUES ('INVALID_SIGNATURE_COUNT_MISMATCHING_KEY',52);
INSERT INTO t_transaction_results (result, proto_id) VALUES ('EMPTY_CLAIM_BODY',53);
INSERT INTO t_transaction_results (result, proto_id) VALUES ('EMPTY_CLAIM_HASH',54);
INSERT INTO t_transaction_results (result, proto_id) VALUES ('EMPTY_CLAIM_KEYS',55);
INSERT INTO t_transaction_results (result, proto_id) VALUES ('INVALID_CLAIM_HASH_SIZE',56);
INSERT INTO t_transaction_results (result, proto_id) VALUES ('EMPTY_QUERY_BODY',57);
INSERT INTO t_transaction_results (result, proto_id) VALUES ('EMPTY_CLAIM_QUERY',58);
INSERT INTO t_transaction_results (result, proto_id) VALUES ('CLAIM_NOT_FOUND',59);
INSERT INTO t_transaction_results (result, proto_id) VALUES ('ACCOUNT_ID_DOES_NOT_EXIST',60);
INSERT INTO t_transaction_results (result, proto_id) VALUES ('CLAIM_ALREADY_EXISTS',61);
INSERT INTO t_transaction_results (result, proto_id) VALUES ('INVALID_FILE_WACL',62);
INSERT INTO t_transaction_results (result, proto_id) VALUES ('SERIALIZATION_FAILED',63);
INSERT INTO t_transaction_results (result, proto_id) VALUES ('TRANSACTION_OVERSIZE',64);
INSERT INTO t_transaction_results (result, proto_id) VALUES ('TRANSACTION_TOO_MANY_LAYERS',65);
INSERT INTO t_transaction_results (result, proto_id) VALUES ('CONTRACT_DELETED',66);
INSERT INTO t_transaction_results (result, proto_id) VALUES ('PLATFORM_NOT_ACTIVE',67);
INSERT INTO t_transaction_results (result, proto_id) VALUES ('KEY_PREFIX_MISMATCH',68);
INSERT INTO t_transaction_results (result, proto_id) VALUES ('PLATFORM_TRANSACTION_NOT_CREATED',69);
INSERT INTO t_transaction_results (result, proto_id) VALUES ('INVALID_RENEWAL_PERIOD',70);
INSERT INTO t_transaction_results (result, proto_id) VALUES ('INVALID_PAYER_ACCOUNT_ID',71);
INSERT INTO t_transaction_results (result, proto_id) VALUES ('ACCOUNT_DELETED',72);
INSERT INTO t_transaction_results (result, proto_id) VALUES ('FILE_DELETED',73);
INSERT INTO t_transaction_results (result, proto_id) VALUES ('ACCOUNT_REPEATED_IN_ACCOUNT_AMOUNTS',74);
INSERT INTO t_transaction_results (result, proto_id) VALUES ('SETTING_NEGATIVE_ACCOUNT_BALANCE',75);
INSERT INTO t_transaction_results (result, proto_id) VALUES ('OBTAINER_REQUIRED',76);
INSERT INTO t_transaction_results (result, proto_id) VALUES ('OBTAINER_SAME_CONTRACT_ID',77);
INSERT INTO t_transaction_results (result, proto_id) VALUES ('OBTAINER_DOES_NOT_EXIST',78);
INSERT INTO t_transaction_results (result, proto_id) VALUES ('MODIFYING_IMMUTABLE_CONTRACT',79);
INSERT INTO t_transaction_results (result, proto_id) VALUES ('FILE_SYSTEM_EXCEPTION',80);
INSERT INTO t_transaction_results (result, proto_id) VALUES ('AUTORENEW_DURATION_NOT_IN_RANGE',81);
INSERT INTO t_transaction_results (result, proto_id) VALUES ('ERROR_DECODING_BYTESTRING',82);
INSERT INTO t_transaction_results (result, proto_id) VALUES ('CONTRACT_FILE_EMPTY',83);
INSERT INTO t_transaction_results (result, proto_id) VALUES ('CONTRACT_BYTECODE_EMPTY',84);
INSERT INTO t_transaction_results (result, proto_id) VALUES ('INVALID_INITIAL_BALANCE',85);
INSERT INTO t_transaction_results (result, proto_id) VALUES ('INVALID_RECEIVE_RECORD_THRESHOLD',86);
INSERT INTO t_transaction_results (result, proto_id) VALUES ('INVALID_SEND_RECORD_THRESHOLD',87);
INSERT INTO t_transaction_results (result, proto_id) VALUES ('ACCOUNT_IS_NOT_GENESIS_ACCOUNT',88);
CREATE TABLE t_record_files (
id BIGINT PRIMARY KEY NOT NULL DEFAULT nextval('s_record_files_seq')
,name VARCHAR(250) NOT NULL
,load_start BIGINT
,load_end BIGINT
,file_hash VARCHAR(96)
,prev_hash VARCHAR(96)
);
CREATE TABLE t_entity_types (
id INT PRIMARY KEY NOT NULL
,name VARCHAR(8)
);
INSERT INTO t_entity_types (id, name) VALUES (1, 'account');
INSERT INTO t_entity_types (id, name) VALUES (2, 'contract');
INSERT INTO t_entity_types (id, name) VALUES (3, 'file');
CREATE TABLE t_entities (
id BIGINT PRIMARY KEY NOT NULL DEFAULT nextval('s_entities_seq')
,entity_num BIGINT NOT NULL
,entity_realm BIGINT NOT NULL
,entity_shard BIGINT NOT NULL
,fk_entity_type_id INT NOT NULL
,exp_time_seconds BIGINT
,exp_time_nanos BIGINT
,auto_renew_period BIGINT
,admin_key BYTEA
,key BYTEA
,fk_prox_acc_id BIGINT
,deleted BOOLEAN DEFAULT false
,balance BIGINT
);
CREATE TABLE t_account_balance_refresh_time (
seconds BIGINT NOT NULL
,nanos BIGINT NOT NULL
);
INSERT INTO t_account_balance_refresh_time
VALUES (0,0);
CREATE TABLE t_account_balances (
id BIGINT PRIMARY KEY NOT NULL DEFAULT nextval('s_account_balances_seq')
,shard BIGINT NOT NULL
,realm BIGINT NOT NULL
,num BIGINT NOT NULL
,balance BIGINT NOT NULL
);
CREATE TABLE t_account_balance_history (
snapshot_time TIMESTAMP NOT NULL
,seconds BIGINT NOT NULL
,nanos BIGINT NOT NULL
,balance BIGINT NOT NULL
,fk_balance_id BIGINT NOT NULL
);
CREATE TABLE t_transactions (
id BIGINT PRIMARY KEY NOT NULL DEFAULT nextval('s_transactions_seq')
,fk_node_acc_id BIGINT NOT NULL
,memo BYTEA
,vs_seconds BIGINT NOT NULL
,vs_nanos INT
,fk_trans_type_id INT
,fk_result_id INT
,consensus_seconds BIGINT NULL
,consensus_nanos BIGINT NULL
,fk_payer_acc_id BIGINT NOT NULL
,charged_tx_fee BIGINT
,initial_balance BIGINT DEFAULT 0
,fk_cud_entity_id BIGINT
,fk_rec_file_id BIGINT NOT NULL
);
CREATE TABLE t_cryptotransferlists (
fk_trans_id BIGINT NOT NULL
,account_id BIGINT NOT NULL
,amount BIGINT NOT NULL
);
CREATE TABLE t_file_data (
fk_trans_id BIGINT NOT NULL
,file_data BYTEA
);
CREATE TABLE t_contract_result (
fk_trans_id BIGINT NOT NULL
,function_params BYTEA
,gas_supplied BIGINT
,call_result BYTEA
,gas_used BIGINT
);
CREATE TABLE t_livehashes (
fk_trans_id BIGINT NOT NULL
,livehash BYTEA
);
CREATE TABLE t_events
(
id BIGINT NOT NULL DEFAULT nextval('s_events_id_seq')
,consensus_order BIGINT NOT NULL
,creator_node_id BIGINT NOT NULL
,creator_seq BIGINT NOT NULL
,other_node_id BIGINT
,other_seq BIGINT
,signature BYTEA NOT NULL
,hash BYTEA NOT NULL
,self_parent_id BIGINT
,other_parent_id BIGINT
,self_parent_hash BYTEA
,other_parent_hash BYTEA
,self_parent_generation BIGINT
,other_parent_generation BIGINT
,generation BIGINT NOT NULL
,created_timestamp_ns BIGINT NOT NULL
,consensus_timestamp_ns BIGINT NOT NULL
,latency_ns BIGINT NOT NULL
,txs_bytes_count INTEGER NOT NULL
,platform_tx_count INTEGER NOT NULL
,app_tx_count INTEGER NOT NULL
);
-- CONSTRAINTS
-- t_entities
ALTER TABLE t_entities ADD CONSTRAINT fk_ent_type_id FOREIGN KEY (fk_entity_type_id) REFERENCES t_entity_types (id) ON DELETE CASCADE ON UPDATE CASCADE;
--t_account_balance_history
ALTER TABLE t_account_balance_history ADD CONSTRAINT fk_acc_bal_id FOREIGN KEY (fk_balance_id) REFERENCES t_account_balances (id) ON DELETE CASCADE ON UPDATE CASCADE;
-- t_transactions
ALTER TABLE t_transactions ADD CONSTRAINT fk_trans_type_id FOREIGN KEY (fk_trans_type_id) REFERENCES t_transaction_types (id) ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE t_transactions ADD CONSTRAINT fk_node_account_id FOREIGN KEY (fk_node_acc_id) REFERENCES t_entities (id) ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE t_transactions ADD CONSTRAINT fk_payer_account_id FOREIGN KEY (fk_payer_acc_id) REFERENCES t_entities (id) ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE t_transactions ADD CONSTRAINT fk_cud_entity_id FOREIGN KEY (fk_cud_entity_id) REFERENCES t_entities (id) ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE t_transactions ADD CONSTRAINT fk_result_id FOREIGN KEY (fk_result_id) REFERENCES t_transaction_results (id) ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE t_transactions ADD CONSTRAINT fk_rec_file_id FOREIGN KEY (fk_rec_file_id) REFERENCES t_record_files (id) ON DELETE CASCADE ON UPDATE CASCADE;
-- t_cryptotransferlists
ALTER TABLE t_cryptotransferlists ADD CONSTRAINT fk_ctl_tx_id FOREIGN KEY (fk_trans_id) REFERENCES t_transactions (id) ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE t_cryptotransferlists ADD CONSTRAINT fk_ctl_account_id FOREIGN KEY (account_id) REFERENCES t_entities (id) ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE t_cryptotransferlists ADD CONSTRAINT fk_ctl_acc_id FOREIGN KEY (account_id) REFERENCES t_entities (id) ON DELETE CASCADE ON UPDATE CASCADE;
-- t_file_data
ALTER TABLE t_file_data ADD CONSTRAINT fk_fd_tx_id FOREIGN KEY (fk_trans_id) REFERENCES t_transactions (id) ON DELETE CASCADE ON UPDATE CASCADE;
-- t_contract_result
ALTER TABLE t_contract_result ADD CONSTRAINT fk_cr_tx_id FOREIGN KEY (fk_trans_id) REFERENCES t_transactions (id) ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE t_livehashes ADD CONSTRAINT fk_cd_tx_id FOREIGN KEY (fk_trans_id) REFERENCES t_transactions (id) ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE t_events ADD CONSTRAINT pk_events_id PRIMARY KEY (id);
ALTER TABLE t_events ADD CONSTRAINT fk_events_self_parent_id FOREIGN KEY (self_parent_id) REFERENCES t_events (id);
ALTER TABLE t_events ADD CONSTRAINT fk_events_other_parent_id FOREIGN KEY (other_parent_id) REFERENCES t_events (id);
-- INDICES
-- t_transactions
CREATE INDEX idx_t_transactions_id ON t_transactions (id);
CREATE INDEX idx_t_transactions_seconds ON t_transactions (vs_seconds);
CREATE UNIQUE INDEX idx_t_transactions_transaction_id_unq ON t_transactions (vs_seconds, vs_nanos, fk_payer_acc_id);
CREATE INDEX idx_t_transactions_payer_id ON t_transactions (fk_payer_acc_id);
CREATE INDEX idx_t_transactions_node_account ON t_transactions (fk_node_acc_id);
CREATE INDEX idx_t_transactions_crud_entity ON t_transactions (fk_cud_entity_id);
CREATE INDEX idx_t_transactions_rec_file ON t_transactions (fk_rec_file_id);
-- t_cryptotransferlists
CREATE INDEX idx_cryptotransferslist_tx_id ON t_cryptotransferlists (fk_trans_id);
CREATE INDEX idx_cryptotransferlist_account ON t_cryptotransferlists (account_id);
CREATE INDEX idx_t_cryptotransferlist_amount ON t_cryptotransferlists (amount);
CREATE INDEX idx_t_cryptotransferlist_tx_id_account ON t_cryptotransferlists (fk_trans_id, account_id);
-- t_record_files
CREATE UNIQUE INDEX idx_t_record_files_name ON t_record_files (name);
CREATE UNIQUE INDEX idx_file_data_hash_unq ON t_record_files (file_hash);
CREATE INDEX idx_file_data_prev_hash_unq ON t_record_files (prev_hash);
--t_account_balance_history
CREATE UNIQUE INDEX t_acc_bal_hist_unique ON t_account_balance_history (seconds, fk_balance_id);
CREATE UNIQUE INDEX t_acc_bal_hist_unique2 ON t_account_balance_history (snapshot_time, seconds, fk_balance_id);
CREATE INDEX t_acc_bal_hist_sec ON t_account_balance_history (seconds);
--t_account_balances
CREATE UNIQUE INDEX idx_t_account_bal_unq ON t_account_balances (shard, realm, num);
CREATE INDEX idx_t_account_bal_id_num ON t_account_balances (id, num);
CREATE UNIQUE INDEX idx_t_account_bal_unq2 ON t_account_balances (id, shard, realm, num);
--t_entities
CREATE UNIQUE INDEX idx_t_entities_unq ON t_entities (entity_shard, entity_realm, entity_num, fk_entity_type_id);
CREATE INDEX idx_t_entities_id_num ON t_entities (id, entity_num);
CREATE INDEX idx_t_entities_id_num_id ON t_entities (id, entity_num, fk_entity_type_id);
CREATE INDEX idx_t_entities_id ON t_entities (id);
--t_transaction_types
CREATE INDEX idx_t_trans_type_id ON t_transaction_types (id);
CREATE UNIQUE INDEX idx_t_trans_type_unq ON t_transaction_types (proto_id, name);
-- t_file_data
CREATE INDEX idx_file_data_tx_id ON t_file_data (fk_trans_id);
-- t_contract_result
CREATE INDEX idx_contract_result_tx_id ON t_contract_result (fk_trans_id);
CREATE INDEX idx_livehash_tx_id ON t_livehashes (fk_trans_id);
--t_transaction_results
CREATE INDEX idx_t_trans_result_id ON t_transaction_results (id);
CREATE UNIQUE INDEX idx_t_trans_result_unq ON t_transaction_results (proto_id, result);
CREATE OR REPLACE VIEW v_entities AS
SELECT e.id, e.entity_num, et.name AS type
FROM t_entities e
, t_entity_types et
WHERE e.fk_entity_type_id = et.id;
GRANT USAGE ON SCHEMA public TO ${db-user};
GRANT CONNECT ON DATABASE ${db-name} TO ${db-user};
GRANT ALL PRIVILEGES ON DATABASE ${db-name} TO ${db-user};
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO ${db-user};
GRANT ALL ON t_record_files TO ${db-user};
GRANT ALL ON t_transactions TO ${db-user};
GRANT ALL ON t_cryptotransferlists TO ${db-user};
GRANT ALL ON t_transaction_types TO ${db-user};
GRANT ALL ON t_entities TO ${db-user};
GRANT ALL ON t_account_balance_history TO ${db-user};
GRANT ALL ON t_account_balances TO ${db-user};
GRANT ALL ON t_account_balance_refresh_time to ${db-user};
GRANT ALL ON t_file_data TO ${db-user};
GRANT ALL ON t_contract_result TO ${db-user};
GRANT ALL ON t_livehashes TO ${db-user};
GRANT ALL ON t_transaction_results TO ${db-user};
GRANT ALL ON t_entity_types TO ${db-user};
GRANT ALL ON t_events TO ${db-user};
GRANT ALL ON s_transaction_types_seq TO ${db-user};
GRANT ALL ON s_record_files_seq TO ${db-user};
GRANT ALL ON s_transactions_seq TO ${db-user};
GRANT ALL ON s_entities_seq TO ${db-user};
GRANT ALL ON s_transaction_results_seq TO ${db-user};
GRANT ALL ON s_account_balances_seq TO ${db-user};
GRANT ALL ON s_events_id_seq TO ${db-user};
GRANT ALL ON v_entities to ${db-user};
GRANT SELECT ON t_record_files TO ${api-user};
GRANT SELECT ON t_transactions TO ${api-user};
GRANT SELECT ON t_cryptotransferlists TO ${api-user};
GRANT SELECT ON t_transaction_types TO ${api-user};
GRANT SELECT ON t_entities TO ${api-user};
GRANT SELECT ON t_account_balance_refresh_time to ${api-user};
GRANT SELECT ON t_account_balance_history TO ${api-user};
GRANT SELECT ON t_account_balances TO ${api-user};
GRANT SELECT ON t_file_data TO ${api-user};
GRANT SELECT ON t_contract_result TO ${api-user};
GRANT SELECT ON t_livehashes TO ${api-user};
GRANT SELECT ON t_transaction_results TO ${api-user};
GRANT SELECT ON t_entity_types TO ${api-user};
GRANT SELECT ON t_events TO ${api-user};
GRANT SELECT ON v_entities TO ${api-user};
|
-- Basic query
SELECT * FROM artist_data WHERE artist_data.artist_data::text like '%One%';
EXPLAIN ANALYZE SELECT * FROM artist_data WHERE artist_data.artist_data::text like '%One%';
-- Runs in ~25ms
DROP INDEX IF EXISTS fts_artist_data;
CREATE INDEX fts_artist_data ON artist_data USING GIN (jsonb_to_tsvector('english', artist_data, '["all"]'));
-- Now use the INDEX
SELECT * FROM artist_data WHERE to_tsvector('english', artist_data) @@ to_tsquery('one');
EXPLAIN ANALYZE SELECT * FROM artist_data WHERE jsonb_to_tsvector('english', artist_data, '["all"]') @@ to_tsquery('one');
-- Runs in 0.176ms
-- Speedup query
SELECT round(25 / 0.176, 2) || 'x';
-- 142.05x faster on just 200 rows
|
-- This SQL code was generated by sklearn2sql (development version).
-- Copyright 2018
-- Model : CaretClassifier_naive_bayes
-- Dataset : FourClass_10
-- Database : teradata
-- This SQL code can contain one or more statements, to be executed in the order they appear in this file.
-- Model deployment code
WITH centered_data AS
(SELECT "ADS"."KEY" AS "KEY", CAST("ADS"."Feature_0" AS DOUBLE PRECISION) - CAST(0.121972324020858 AS DOUBLE PRECISION) AS "Feature_0_0", CAST("ADS"."Feature_1" AS DOUBLE PRECISION) - CAST(-0.204209064143351 AS DOUBLE PRECISION) AS "Feature_1_0", CAST("ADS"."Feature_2" AS DOUBLE PRECISION) - CAST(-0.178668022966001 AS DOUBLE PRECISION) AS "Feature_2_0", CAST("ADS"."Feature_3" AS DOUBLE PRECISION) - CAST(-0.338489162809258 AS DOUBLE PRECISION) AS "Feature_3_0", CAST("ADS"."Feature_4" AS DOUBLE PRECISION) - CAST(0.692046433348698 AS DOUBLE PRECISION) AS "Feature_4_0", CAST("ADS"."Feature_5" AS DOUBLE PRECISION) - CAST(-0.232889543871415 AS DOUBLE PRECISION) AS "Feature_5_0", CAST("ADS"."Feature_6" AS DOUBLE PRECISION) - CAST(0.148905014543641 AS DOUBLE PRECISION) AS "Feature_6_0", CAST("ADS"."Feature_7" AS DOUBLE PRECISION) - CAST(0.344261465699857 AS DOUBLE PRECISION) AS "Feature_7_0", CAST("ADS"."Feature_8" AS DOUBLE PRECISION) - CAST(0.481062539936806 AS DOUBLE PRECISION) AS "Feature_8_0", CAST("ADS"."Feature_9" AS DOUBLE PRECISION) - CAST(0.210725722984837 AS DOUBLE PRECISION) AS "Feature_9_0", CAST("ADS"."Feature_0" AS DOUBLE PRECISION) - CAST(-0.055804457113659 AS DOUBLE PRECISION) AS "Feature_0_1", CAST("ADS"."Feature_1" AS DOUBLE PRECISION) - CAST(1.11642415634566 AS DOUBLE PRECISION) AS "Feature_1_1", CAST("ADS"."Feature_2" AS DOUBLE PRECISION) - CAST(1.23209126669488 AS DOUBLE PRECISION) AS "Feature_2_1", CAST("ADS"."Feature_3" AS DOUBLE PRECISION) - CAST(2.85620117640919 AS DOUBLE PRECISION) AS "Feature_3_1", CAST("ADS"."Feature_4" AS DOUBLE PRECISION) - CAST(-0.194677735407704 AS DOUBLE PRECISION) AS "Feature_4_1", CAST("ADS"."Feature_5" AS DOUBLE PRECISION) - CAST(-0.308859790178418 AS DOUBLE PRECISION) AS "Feature_5_1", CAST("ADS"."Feature_6" AS DOUBLE PRECISION) - CAST(-1.20900090932447 AS DOUBLE PRECISION) AS "Feature_6_1", CAST("ADS"."Feature_7" AS DOUBLE PRECISION) - CAST(1.22543376941976 AS DOUBLE PRECISION) AS "Feature_7_1", CAST("ADS"."Feature_8" AS DOUBLE PRECISION) - CAST(-0.216885934061671 AS DOUBLE PRECISION) AS "Feature_8_1", CAST("ADS"."Feature_9" AS DOUBLE PRECISION) - CAST(0.046430005146285 AS DOUBLE PRECISION) AS "Feature_9_1", CAST("ADS"."Feature_0" AS DOUBLE PRECISION) - CAST(0.040527414301685 AS DOUBLE PRECISION) AS "Feature_0_2", CAST("ADS"."Feature_1" AS DOUBLE PRECISION) - CAST(-0.201696366889481 AS DOUBLE PRECISION) AS "Feature_1_2", CAST("ADS"."Feature_2" AS DOUBLE PRECISION) - CAST(-1.06566022235318 AS DOUBLE PRECISION) AS "Feature_2_2", CAST("ADS"."Feature_3" AS DOUBLE PRECISION) - CAST(-0.933951975193257 AS DOUBLE PRECISION) AS "Feature_3_2", CAST("ADS"."Feature_4" AS DOUBLE PRECISION) - CAST(-0.927385394883359 AS DOUBLE PRECISION) AS "Feature_4_2", CAST("ADS"."Feature_5" AS DOUBLE PRECISION) - CAST(0.180750853837477 AS DOUBLE PRECISION) AS "Feature_5_2", CAST("ADS"."Feature_6" AS DOUBLE PRECISION) - CAST(0.336730803418236 AS DOUBLE PRECISION) AS "Feature_6_2", CAST("ADS"."Feature_7" AS DOUBLE PRECISION) - CAST(-0.040979081558846 AS DOUBLE PRECISION) AS "Feature_7_2", CAST("ADS"."Feature_8" AS DOUBLE PRECISION) - CAST(0.269658006083996 AS DOUBLE PRECISION) AS "Feature_8_2", CAST("ADS"."Feature_9" AS DOUBLE PRECISION) - CAST(0.141874980635683 AS DOUBLE PRECISION) AS "Feature_9_2", CAST("ADS"."Feature_0" AS DOUBLE PRECISION) - CAST(-0.100101406053577 AS DOUBLE PRECISION) AS "Feature_0_3", CAST("ADS"."Feature_1" AS DOUBLE PRECISION) - CAST(1.57268477686706 AS DOUBLE PRECISION) AS "Feature_1_3", CAST("ADS"."Feature_2" AS DOUBLE PRECISION) - CAST(0.150504658168055 AS DOUBLE PRECISION) AS "Feature_2_3", CAST("ADS"."Feature_3" AS DOUBLE PRECISION) - CAST(1.33301715352184 AS DOUBLE PRECISION) AS "Feature_3_3", CAST("ADS"."Feature_4" AS DOUBLE PRECISION) - CAST(-1.12073454974409 AS DOUBLE PRECISION) AS "Feature_4_3", CAST("ADS"."Feature_5" AS DOUBLE PRECISION) - CAST(0.152478854097818 AS DOUBLE PRECISION) AS "Feature_5_3", CAST("ADS"."Feature_6" AS DOUBLE PRECISION) - CAST(-0.412825101797143 AS DOUBLE PRECISION) AS "Feature_6_3", CAST("ADS"."Feature_7" AS DOUBLE PRECISION) - CAST(-0.824909406091562 AS DOUBLE PRECISION) AS "Feature_7_3", CAST("ADS"."Feature_8" AS DOUBLE PRECISION) - CAST(-0.378046056889971 AS DOUBLE PRECISION) AS "Feature_8_3", CAST("ADS"."Feature_9" AS DOUBLE PRECISION) - CAST(0.074850109232539 AS DOUBLE PRECISION) AS "Feature_9_3"
FROM "FourClass_10" AS "ADS"),
dummy_cte AS
(SELECT CAST(0.0 AS DOUBLE PRECISION) AS "X"),
"NaiveBayes_data" AS
(SELECT "Values"."KEY" AS "KEY", "Values"."Feature" AS "Feature", "Values".log_proba_0 AS log_proba_0, "Values".log_proba_1 AS log_proba_1, "Values".log_proba_2 AS log_proba_2, "Values".log_proba_3 AS log_proba_3
FROM (SELECT centered_data."KEY" AS "KEY", 0 AS "Feature", CAST(-0.5 AS DOUBLE PRECISION) * CAST(2.336726644896774 AS DOUBLE PRECISION) - (CAST(0.5 AS DOUBLE PRECISION) * centered_data."Feature_0_0" * centered_data."Feature_0_0") / CAST(1.646825636880112 AS DOUBLE PRECISION) AS log_proba_0, CAST(-0.5 AS DOUBLE PRECISION) * CAST(1.59365503707913 AS DOUBLE PRECISION) - (CAST(0.5 AS DOUBLE PRECISION) * centered_data."Feature_0_1" * centered_data."Feature_0_1") / CAST(0.78331369633857 AS DOUBLE PRECISION) AS log_proba_1, CAST(-0.5 AS DOUBLE PRECISION) * CAST(1.7827605907593 AS DOUBLE PRECISION) - (CAST(0.5 AS DOUBLE PRECISION) * centered_data."Feature_0_2" * centered_data."Feature_0_2") / CAST(0.94637491190065 AS DOUBLE PRECISION) AS log_proba_2, CAST(-0.5 AS DOUBLE PRECISION) * CAST(1.522011109908515 AS DOUBLE PRECISION) - (CAST(0.5 AS DOUBLE PRECISION) * centered_data."Feature_0_3" * centered_data."Feature_0_3") / CAST(0.729157182397466 AS DOUBLE PRECISION) AS log_proba_3
FROM centered_data, dummy_cte UNION ALL SELECT centered_data."KEY" AS "KEY", 1 AS "Feature", CAST(-0.5 AS DOUBLE PRECISION) * CAST(2.155885224686969 AS DOUBLE PRECISION) - (CAST(0.5 AS DOUBLE PRECISION) * centered_data."Feature_1_0" * centered_data."Feature_1_0") / CAST(1.374387473816397 AS DOUBLE PRECISION) AS log_proba_0, CAST(-0.5 AS DOUBLE PRECISION) * CAST(1.956078302897248 AS DOUBLE PRECISION) - (CAST(0.5 AS DOUBLE PRECISION) * centered_data."Feature_1_1" * centered_data."Feature_1_1") / CAST(1.125470574325888 AS DOUBLE PRECISION) AS log_proba_1, CAST(-0.5 AS DOUBLE PRECISION) * CAST(2.66869282040259 AS DOUBLE PRECISION) - (CAST(0.5 AS DOUBLE PRECISION) * centered_data."Feature_1_2" * centered_data."Feature_1_2") / CAST(2.295190287441592 AS DOUBLE PRECISION) AS log_proba_2, CAST(-0.5 AS DOUBLE PRECISION) * CAST(1.540820746493154 AS DOUBLE PRECISION) - (CAST(0.5 AS DOUBLE PRECISION) * centered_data."Feature_1_3" * centered_data."Feature_1_3") / CAST(0.743002165363858 AS DOUBLE PRECISION) AS log_proba_3
FROM centered_data, dummy_cte UNION ALL SELECT centered_data."KEY" AS "KEY", 2 AS "Feature", CAST(-0.5 AS DOUBLE PRECISION) * CAST(2.007948613285439 AS DOUBLE PRECISION) - (CAST(0.5 AS DOUBLE PRECISION) * centered_data."Feature_2_0" * centered_data."Feature_2_0") / CAST(1.18538965921353 AS DOUBLE PRECISION) AS log_proba_0, CAST(-0.5 AS DOUBLE PRECISION) * CAST(2.649880820292136 AS DOUBLE PRECISION) - (CAST(0.5 AS DOUBLE PRECISION) * centered_data."Feature_2_1" * centered_data."Feature_2_1") / CAST(2.252416756757137 AS DOUBLE PRECISION) AS log_proba_1, CAST(-0.5 AS DOUBLE PRECISION) * CAST(2.152035363784177 AS DOUBLE PRECISION) - (CAST(0.5 AS DOUBLE PRECISION) * centered_data."Feature_2_2" * centered_data."Feature_2_2") / CAST(1.36910644535087 AS DOUBLE PRECISION) AS log_proba_2, CAST(-0.5 AS DOUBLE PRECISION) * CAST(2.380892273396306 AS DOUBLE PRECISION) - (CAST(0.5 AS DOUBLE PRECISION) * centered_data."Feature_2_3" * centered_data."Feature_2_3") / CAST(1.721188786426537 AS DOUBLE PRECISION) AS log_proba_3
FROM centered_data, dummy_cte UNION ALL SELECT centered_data."KEY" AS "KEY", 3 AS "Feature", CAST(-0.5 AS DOUBLE PRECISION) * CAST(1.681116380151328 AS DOUBLE PRECISION) - (CAST(0.5 AS DOUBLE PRECISION) * centered_data."Feature_3_0" * centered_data."Feature_3_0") / CAST(0.854908625721148 AS DOUBLE PRECISION) AS log_proba_0, CAST(-0.5 AS DOUBLE PRECISION) * CAST(2.930357019144103 AS DOUBLE PRECISION) - (CAST(0.5 AS DOUBLE PRECISION) * centered_data."Feature_3_1" * centered_data."Feature_3_1") / CAST(2.981659285387584 AS DOUBLE PRECISION) AS log_proba_1, CAST(-0.5 AS DOUBLE PRECISION) * CAST(3.725546951999224 AS DOUBLE PRECISION) - (CAST(0.5 AS DOUBLE PRECISION) * centered_data."Feature_3_2" * centered_data."Feature_3_2") / CAST(6.603962750454359 AS DOUBLE PRECISION) AS log_proba_2, CAST(-0.5 AS DOUBLE PRECISION) * CAST(2.963098899701464 AS DOUBLE PRECISION) - (CAST(0.5 AS DOUBLE PRECISION) * centered_data."Feature_3_3" * centered_data."Feature_3_3") / CAST(3.080900219356419 AS DOUBLE PRECISION) AS log_proba_3
FROM centered_data, dummy_cte UNION ALL SELECT centered_data."KEY" AS "KEY", 4 AS "Feature", CAST(-0.5 AS DOUBLE PRECISION) * CAST(1.700375979279688 AS DOUBLE PRECISION) - (CAST(0.5 AS DOUBLE PRECISION) * centered_data."Feature_4_0" * centered_data."Feature_4_0") / CAST(0.871533402526833 AS DOUBLE PRECISION) AS log_proba_0, CAST(-0.5 AS DOUBLE PRECISION) * CAST(2.951671473054602 AS DOUBLE PRECISION) - (CAST(0.5 AS DOUBLE PRECISION) * centered_data."Feature_4_1" * centered_data."Feature_4_1") / CAST(3.045893855366248 AS DOUBLE PRECISION) AS log_proba_1, CAST(-0.5 AS DOUBLE PRECISION) * CAST(2.32242558806214 AS DOUBLE PRECISION) - (CAST(0.5 AS DOUBLE PRECISION) * centered_data."Feature_4_2" * centered_data."Feature_4_2") / CAST(1.623441894500743 AS DOUBLE PRECISION) AS log_proba_2, CAST(-0.5 AS DOUBLE PRECISION) * CAST(1.482621699581746 AS DOUBLE PRECISION) - (CAST(0.5 AS DOUBLE PRECISION) * centered_data."Feature_4_3" * centered_data."Feature_4_3") / CAST(0.700994409631374 AS DOUBLE PRECISION) AS log_proba_3
FROM centered_data, dummy_cte UNION ALL SELECT centered_data."KEY" AS "KEY", 5 AS "Feature", CAST(-0.5 AS DOUBLE PRECISION) * CAST(0.647838723416054 AS DOUBLE PRECISION) - (CAST(0.5 AS DOUBLE PRECISION) * centered_data."Feature_5_0" * centered_data."Feature_5_0") / CAST(0.304209599536445 AS DOUBLE PRECISION) AS log_proba_0, CAST(-0.5 AS DOUBLE PRECISION) * CAST(1.774848227942035 AS DOUBLE PRECISION) - (CAST(0.5 AS DOUBLE PRECISION) * centered_data."Feature_5_1" * centered_data."Feature_5_1") / CAST(0.938916396388897 AS DOUBLE PRECISION) AS log_proba_1, CAST(-0.5 AS DOUBLE PRECISION) * CAST(2.186530704693101 AS DOUBLE PRECISION) - (CAST(0.5 AS DOUBLE PRECISION) * centered_data."Feature_5_2" * centered_data."Feature_5_2") / CAST(1.417158255960732 AS DOUBLE PRECISION) AS log_proba_2, CAST(-0.5 AS DOUBLE PRECISION) * CAST(1.750558994135033 AS DOUBLE PRECISION) - (CAST(0.5 AS DOUBLE PRECISION) * centered_data."Feature_5_3" * centered_data."Feature_5_3") / CAST(0.916385572429716 AS DOUBLE PRECISION) AS log_proba_3
FROM centered_data, dummy_cte UNION ALL SELECT centered_data."KEY" AS "KEY", 6 AS "Feature", CAST(-0.5 AS DOUBLE PRECISION) * CAST(0.656415974501675 AS DOUBLE PRECISION) - (CAST(0.5 AS DOUBLE PRECISION) * centered_data."Feature_6_0" * centered_data."Feature_6_0") / CAST(0.306830103950802 AS DOUBLE PRECISION) AS log_proba_0, CAST(-0.5 AS DOUBLE PRECISION) * CAST(1.512331986858799 AS DOUBLE PRECISION) - (CAST(0.5 AS DOUBLE PRECISION) * centered_data."Feature_6_1" * centered_data."Feature_6_1") / CAST(0.722133626073063 AS DOUBLE PRECISION) AS log_proba_1, CAST(-0.5 AS DOUBLE PRECISION) * CAST(2.044125028668244 AS DOUBLE PRECISION) - (CAST(0.5 AS DOUBLE PRECISION) * centered_data."Feature_6_2" * centered_data."Feature_6_2") / CAST(1.229057926193645 AS DOUBLE PRECISION) AS log_proba_2, CAST(-0.5 AS DOUBLE PRECISION) * CAST(1.271177736304952 AS DOUBLE PRECISION) - (CAST(0.5 AS DOUBLE PRECISION) * centered_data."Feature_6_3" * centered_data."Feature_6_3") / CAST(0.567395135418651 AS DOUBLE PRECISION) AS log_proba_3
FROM centered_data, dummy_cte UNION ALL SELECT centered_data."KEY" AS "KEY", 7 AS "Feature", CAST(-0.5 AS DOUBLE PRECISION) * CAST(2.569394267339252 AS DOUBLE PRECISION) - (CAST(0.5 AS DOUBLE PRECISION) * centered_data."Feature_7_0" * centered_data."Feature_7_0") / CAST(2.078231311422663 AS DOUBLE PRECISION) AS log_proba_0, CAST(-0.5 AS DOUBLE PRECISION) * CAST(2.01411134912328 AS DOUBLE PRECISION) - (CAST(0.5 AS DOUBLE PRECISION) * centered_data."Feature_7_1" * centered_data."Feature_7_1") / CAST(1.192717459003307 AS DOUBLE PRECISION) AS log_proba_1, CAST(-0.5 AS DOUBLE PRECISION) * CAST(3.251531726731955 AS DOUBLE PRECISION) - (CAST(0.5 AS DOUBLE PRECISION) * centered_data."Feature_7_2" * centered_data."Feature_7_2") / CAST(4.110952117023496 AS DOUBLE PRECISION) AS log_proba_2, CAST(-0.5 AS DOUBLE PRECISION) * CAST(1.948477857211092 AS DOUBLE PRECISION) - (CAST(0.5 AS DOUBLE PRECISION) * centered_data."Feature_7_3" * centered_data."Feature_7_3") / CAST(1.116948921556201 AS DOUBLE PRECISION) AS log_proba_3
FROM centered_data, dummy_cte UNION ALL SELECT centered_data."KEY" AS "KEY", 8 AS "Feature", CAST(-0.5 AS DOUBLE PRECISION) * CAST(2.035562992888368 AS DOUBLE PRECISION) - (CAST(0.5 AS DOUBLE PRECISION) * centered_data."Feature_8_0" * centered_data."Feature_8_0") / CAST(1.218579610124935 AS DOUBLE PRECISION) AS log_proba_0, CAST(-0.5 AS DOUBLE PRECISION) * CAST(2.003516864867477 AS DOUBLE PRECISION) - (CAST(0.5 AS DOUBLE PRECISION) * centered_data."Feature_8_1" * centered_data."Feature_8_1") / CAST(1.18014793404937 AS DOUBLE PRECISION) AS log_proba_1, CAST(-0.5 AS DOUBLE PRECISION) * CAST(1.166981512149118 AS DOUBLE PRECISION) - (CAST(0.5 AS DOUBLE PRECISION) * centered_data."Feature_8_2" * centered_data."Feature_8_2") / CAST(0.511250520128068 AS DOUBLE PRECISION) AS log_proba_2, CAST(-0.5 AS DOUBLE PRECISION) * CAST(2.555333012872624 AS DOUBLE PRECISION) - (CAST(0.5 AS DOUBLE PRECISION) * centered_data."Feature_8_3" * centered_data."Feature_8_3") / CAST(2.049213265293986 AS DOUBLE PRECISION) AS log_proba_3
FROM centered_data, dummy_cte UNION ALL SELECT centered_data."KEY" AS "KEY", 9 AS "Feature", CAST(-0.5 AS DOUBLE PRECISION) * CAST(2.067827849858662 AS DOUBLE PRECISION) - (CAST(0.5 AS DOUBLE PRECISION) * centered_data."Feature_9_0" * centered_data."Feature_9_0") / CAST(1.258538067502608 AS DOUBLE PRECISION) AS log_proba_0, CAST(-0.5 AS DOUBLE PRECISION) * CAST(1.683173994348639 AS DOUBLE PRECISION) - (CAST(0.5 AS DOUBLE PRECISION) * centered_data."Feature_9_1" * centered_data."Feature_9_1") / CAST(0.856669508834617 AS DOUBLE PRECISION) AS log_proba_1, CAST(-0.5 AS DOUBLE PRECISION) * CAST(1.828783646076225 AS DOUBLE PRECISION) - (CAST(0.5 AS DOUBLE PRECISION) * centered_data."Feature_9_2" * centered_data."Feature_9_2") / CAST(0.990947799775011 AS DOUBLE PRECISION) AS log_proba_2, CAST(-0.5 AS DOUBLE PRECISION) * CAST(1.701471047491986 AS DOUBLE PRECISION) - (CAST(0.5 AS DOUBLE PRECISION) * centered_data."Feature_9_3" * centered_data."Feature_9_3") / CAST(0.872488313802963 AS DOUBLE PRECISION) AS log_proba_3
FROM centered_data, dummy_cte) AS "Values"),
"NaiveBayes_Scores" AS
(SELECT nb_sums."KEY" AS "KEY", nb_sums."Score_0" AS "Score_0", nb_sums."Score_1" AS "Score_1", nb_sums."Score_2" AS "Score_2", nb_sums."Score_3" AS "Score_3"
FROM (SELECT "NaiveBayes_data"."KEY" AS "KEY", CAST(-1.491654876777717 AS DOUBLE PRECISION) + sum("NaiveBayes_data".log_proba_0) AS "Score_0", CAST(-1.38629436111989 AS DOUBLE PRECISION) + sum("NaiveBayes_data".log_proba_1) AS "Score_1", CAST(-1.38629436111989 AS DOUBLE PRECISION) + sum("NaiveBayes_data".log_proba_2) AS "Score_2", CAST(-1.290984181315566 AS DOUBLE PRECISION) + sum("NaiveBayes_data".log_proba_3) AS "Score_3"
FROM "NaiveBayes_data" GROUP BY "NaiveBayes_data"."KEY") AS nb_sums),
orig_cte AS
(SELECT "NaiveBayes_Scores"."KEY" AS "KEY", "NaiveBayes_Scores"."Score_0" AS "Score_0", "NaiveBayes_Scores"."Score_1" AS "Score_1", "NaiveBayes_Scores"."Score_2" AS "Score_2", "NaiveBayes_Scores"."Score_3" AS "Score_3", CAST(NULL AS DOUBLE PRECISION) AS "Proba_0", CAST(NULL AS DOUBLE PRECISION) AS "Proba_1", CAST(NULL AS DOUBLE PRECISION) AS "Proba_2", CAST(NULL AS DOUBLE PRECISION) AS "Proba_3", CAST(NULL AS DOUBLE PRECISION) AS "LogProba_0", CAST(NULL AS DOUBLE PRECISION) AS "LogProba_1", CAST(NULL AS DOUBLE PRECISION) AS "LogProba_2", CAST(NULL AS DOUBLE PRECISION) AS "LogProba_3", CAST(NULL AS BIGINT) AS "Decision", CAST(NULL AS DOUBLE PRECISION) AS "DecisionProba"
FROM "NaiveBayes_Scores"),
score_class_union AS
(SELECT scu."KEY_u" AS "KEY_u", scu."class" AS "class", scu."LogProba" AS "LogProba", scu."Proba" AS "Proba", scu."Score" AS "Score"
FROM (SELECT orig_cte."KEY" AS "KEY_u", 0 AS "class", orig_cte."LogProba_0" AS "LogProba", orig_cte."Proba_0" AS "Proba", orig_cte."Score_0" AS "Score"
FROM orig_cte UNION ALL SELECT orig_cte."KEY" AS "KEY_u", 1 AS "class", orig_cte."LogProba_1" AS "LogProba", orig_cte."Proba_1" AS "Proba", orig_cte."Score_1" AS "Score"
FROM orig_cte UNION ALL SELECT orig_cte."KEY" AS "KEY_u", 2 AS "class", orig_cte."LogProba_2" AS "LogProba", orig_cte."Proba_2" AS "Proba", orig_cte."Score_2" AS "Score"
FROM orig_cte UNION ALL SELECT orig_cte."KEY" AS "KEY_u", 3 AS "class", orig_cte."LogProba_3" AS "LogProba", orig_cte."Proba_3" AS "Proba", orig_cte."Score_3" AS "Score"
FROM orig_cte) AS scu),
score_max AS
(SELECT orig_cte."KEY" AS "KEY", orig_cte."Score_0" AS "Score_0", orig_cte."Score_1" AS "Score_1", orig_cte."Score_2" AS "Score_2", orig_cte."Score_3" AS "Score_3", orig_cte."Proba_0" AS "Proba_0", orig_cte."Proba_1" AS "Proba_1", orig_cte."Proba_2" AS "Proba_2", orig_cte."Proba_3" AS "Proba_3", orig_cte."LogProba_0" AS "LogProba_0", orig_cte."LogProba_1" AS "LogProba_1", orig_cte."LogProba_2" AS "LogProba_2", orig_cte."LogProba_3" AS "LogProba_3", orig_cte."Decision" AS "Decision", orig_cte."DecisionProba" AS "DecisionProba", max_select."KEY_m" AS "KEY_m", max_select."max_Score" AS "max_Score"
FROM orig_cte LEFT OUTER JOIN (SELECT score_class_union."KEY_u" AS "KEY_m", max(score_class_union."Score") AS "max_Score"
FROM score_class_union GROUP BY score_class_union."KEY_u") AS max_select ON orig_cte."KEY" = max_select."KEY_m"),
score_soft_max_deltas AS
(SELECT score_max."KEY" AS "KEY", score_max."Score_0" AS "Score_0", score_max."Score_1" AS "Score_1", score_max."Score_2" AS "Score_2", score_max."Score_3" AS "Score_3", score_max."Proba_0" AS "Proba_0", score_max."Proba_1" AS "Proba_1", score_max."Proba_2" AS "Proba_2", score_max."Proba_3" AS "Proba_3", score_max."LogProba_0" AS "LogProba_0", score_max."LogProba_1" AS "LogProba_1", score_max."LogProba_2" AS "LogProba_2", score_max."LogProba_3" AS "LogProba_3", score_max."Decision" AS "Decision", score_max."DecisionProba" AS "DecisionProba", score_max."KEY_m" AS "KEY_m", score_max."max_Score" AS "max_Score", exp(greatest(CAST(-100.0 AS DOUBLE PRECISION), score_max."Score_0" - score_max."max_Score")) AS "exp_delta_Score_0", exp(greatest(CAST(-100.0 AS DOUBLE PRECISION), score_max."Score_1" - score_max."max_Score")) AS "exp_delta_Score_1", exp(greatest(CAST(-100.0 AS DOUBLE PRECISION), score_max."Score_2" - score_max."max_Score")) AS "exp_delta_Score_2", exp(greatest(CAST(-100.0 AS DOUBLE PRECISION), score_max."Score_3" - score_max."max_Score")) AS "exp_delta_Score_3"
FROM score_max),
score_class_union_soft AS
(SELECT soft_scu."KEY" AS "KEY", soft_scu."class" AS "class", soft_scu."exp_delta_Score" AS "exp_delta_Score"
FROM (SELECT score_soft_max_deltas."KEY" AS "KEY", 0 AS "class", score_soft_max_deltas."exp_delta_Score_0" AS "exp_delta_Score"
FROM score_soft_max_deltas UNION ALL SELECT score_soft_max_deltas."KEY" AS "KEY", 1 AS "class", score_soft_max_deltas."exp_delta_Score_1" AS "exp_delta_Score"
FROM score_soft_max_deltas UNION ALL SELECT score_soft_max_deltas."KEY" AS "KEY", 2 AS "class", score_soft_max_deltas."exp_delta_Score_2" AS "exp_delta_Score"
FROM score_soft_max_deltas UNION ALL SELECT score_soft_max_deltas."KEY" AS "KEY", 3 AS "class", score_soft_max_deltas."exp_delta_Score_3" AS "exp_delta_Score"
FROM score_soft_max_deltas) AS soft_scu),
score_soft_max AS
(SELECT score_soft_max_deltas."KEY" AS "KEY", score_soft_max_deltas."Score_0" AS "Score_0", score_soft_max_deltas."Score_1" AS "Score_1", score_soft_max_deltas."Score_2" AS "Score_2", score_soft_max_deltas."Score_3" AS "Score_3", score_soft_max_deltas."Proba_0" AS "Proba_0", score_soft_max_deltas."Proba_1" AS "Proba_1", score_soft_max_deltas."Proba_2" AS "Proba_2", score_soft_max_deltas."Proba_3" AS "Proba_3", score_soft_max_deltas."LogProba_0" AS "LogProba_0", score_soft_max_deltas."LogProba_1" AS "LogProba_1", score_soft_max_deltas."LogProba_2" AS "LogProba_2", score_soft_max_deltas."LogProba_3" AS "LogProba_3", score_soft_max_deltas."Decision" AS "Decision", score_soft_max_deltas."DecisionProba" AS "DecisionProba", score_soft_max_deltas."KEY_m" AS "KEY_m", score_soft_max_deltas."max_Score" AS "max_Score", score_soft_max_deltas."exp_delta_Score_0" AS "exp_delta_Score_0", score_soft_max_deltas."exp_delta_Score_1" AS "exp_delta_Score_1", score_soft_max_deltas."exp_delta_Score_2" AS "exp_delta_Score_2", score_soft_max_deltas."exp_delta_Score_3" AS "exp_delta_Score_3", sum_exp_t."KEY_sum" AS "KEY_sum", sum_exp_t."sum_ExpDeltaScore" AS "sum_ExpDeltaScore"
FROM score_soft_max_deltas LEFT OUTER JOIN (SELECT score_class_union_soft."KEY" AS "KEY_sum", sum(score_class_union_soft."exp_delta_Score") AS "sum_ExpDeltaScore"
FROM score_class_union_soft GROUP BY score_class_union_soft."KEY") AS sum_exp_t ON score_soft_max_deltas."KEY" = sum_exp_t."KEY_sum"),
union_with_max AS
(SELECT score_class_union."KEY_u" AS "KEY_u", score_class_union."class" AS "class", score_class_union."LogProba" AS "LogProba", score_class_union."Proba" AS "Proba", score_class_union."Score" AS "Score", score_soft_max."KEY" AS "KEY", score_soft_max."Score_0" AS "Score_0", score_soft_max."Score_1" AS "Score_1", score_soft_max."Score_2" AS "Score_2", score_soft_max."Score_3" AS "Score_3", score_soft_max."Proba_0" AS "Proba_0", score_soft_max."Proba_1" AS "Proba_1", score_soft_max."Proba_2" AS "Proba_2", score_soft_max."Proba_3" AS "Proba_3", score_soft_max."LogProba_0" AS "LogProba_0", score_soft_max."LogProba_1" AS "LogProba_1", score_soft_max."LogProba_2" AS "LogProba_2", score_soft_max."LogProba_3" AS "LogProba_3", score_soft_max."Decision" AS "Decision", score_soft_max."DecisionProba" AS "DecisionProba", score_soft_max."KEY_m" AS "KEY_m", score_soft_max."max_Score" AS "max_Score", score_soft_max."exp_delta_Score_0" AS "exp_delta_Score_0", score_soft_max."exp_delta_Score_1" AS "exp_delta_Score_1", score_soft_max."exp_delta_Score_2" AS "exp_delta_Score_2", score_soft_max."exp_delta_Score_3" AS "exp_delta_Score_3", score_soft_max."KEY_sum" AS "KEY_sum", score_soft_max."sum_ExpDeltaScore" AS "sum_ExpDeltaScore"
FROM score_class_union LEFT OUTER JOIN score_soft_max ON score_class_union."KEY_u" = score_soft_max."KEY"),
arg_max_cte AS
(SELECT score_soft_max."KEY" AS "KEY", score_soft_max."Score_0" AS "Score_0", score_soft_max."Score_1" AS "Score_1", score_soft_max."Score_2" AS "Score_2", score_soft_max."Score_3" AS "Score_3", score_soft_max."Proba_0" AS "Proba_0", score_soft_max."Proba_1" AS "Proba_1", score_soft_max."Proba_2" AS "Proba_2", score_soft_max."Proba_3" AS "Proba_3", score_soft_max."LogProba_0" AS "LogProba_0", score_soft_max."LogProba_1" AS "LogProba_1", score_soft_max."LogProba_2" AS "LogProba_2", score_soft_max."LogProba_3" AS "LogProba_3", score_soft_max."Decision" AS "Decision", score_soft_max."DecisionProba" AS "DecisionProba", score_soft_max."KEY_m" AS "KEY_m", score_soft_max."max_Score" AS "max_Score", score_soft_max."exp_delta_Score_0" AS "exp_delta_Score_0", score_soft_max."exp_delta_Score_1" AS "exp_delta_Score_1", score_soft_max."exp_delta_Score_2" AS "exp_delta_Score_2", score_soft_max."exp_delta_Score_3" AS "exp_delta_Score_3", score_soft_max."KEY_sum" AS "KEY_sum", score_soft_max."sum_ExpDeltaScore" AS "sum_ExpDeltaScore", "arg_max_t_Score"."KEY_Score" AS "KEY_Score", "arg_max_t_Score"."arg_max_Score" AS "arg_max_Score", soft_max_comp."KEY_softmax" AS "KEY_softmax", soft_max_comp."SoftProba_0" AS "SoftProba_0", soft_max_comp."SoftProba_1" AS "SoftProba_1", soft_max_comp."SoftProba_2" AS "SoftProba_2", soft_max_comp."SoftProba_3" AS "SoftProba_3"
FROM score_soft_max LEFT OUTER JOIN (SELECT union_with_max."KEY" AS "KEY_Score", max(union_with_max."class") AS "arg_max_Score"
FROM union_with_max
WHERE union_with_max."max_Score" <= union_with_max."Score" GROUP BY union_with_max."KEY") AS "arg_max_t_Score" ON score_soft_max."KEY" = "arg_max_t_Score"."KEY_Score" LEFT OUTER JOIN (SELECT score_soft_max."KEY" AS "KEY_softmax", score_soft_max."exp_delta_Score_0" / score_soft_max."sum_ExpDeltaScore" AS "SoftProba_0", score_soft_max."exp_delta_Score_1" / score_soft_max."sum_ExpDeltaScore" AS "SoftProba_1", score_soft_max."exp_delta_Score_2" / score_soft_max."sum_ExpDeltaScore" AS "SoftProba_2", score_soft_max."exp_delta_Score_3" / score_soft_max."sum_ExpDeltaScore" AS "SoftProba_3"
FROM score_soft_max) AS soft_max_comp ON soft_max_comp."KEY_softmax" = "arg_max_t_Score"."KEY_Score")
SELECT arg_max_cte."KEY" AS "KEY", CAST(NULL AS DOUBLE PRECISION) AS "Score_0", CAST(NULL AS DOUBLE PRECISION) AS "Score_1", CAST(NULL AS DOUBLE PRECISION) AS "Score_2", CAST(NULL AS DOUBLE PRECISION) AS "Score_3", arg_max_cte."SoftProba_0" AS "Proba_0", arg_max_cte."SoftProba_1" AS "Proba_1", arg_max_cte."SoftProba_2" AS "Proba_2", arg_max_cte."SoftProba_3" AS "Proba_3", CASE WHEN (arg_max_cte."SoftProba_0" IS NULL OR arg_max_cte."SoftProba_0" > CAST(0.0 AS DOUBLE PRECISION)) THEN ln(arg_max_cte."SoftProba_0") ELSE -1.79769313486231e+308 END AS "LogProba_0", CASE WHEN (arg_max_cte."SoftProba_1" IS NULL OR arg_max_cte."SoftProba_1" > CAST(0.0 AS DOUBLE PRECISION)) THEN ln(arg_max_cte."SoftProba_1") ELSE -1.79769313486231e+308 END AS "LogProba_1", CASE WHEN (arg_max_cte."SoftProba_2" IS NULL OR arg_max_cte."SoftProba_2" > CAST(0.0 AS DOUBLE PRECISION)) THEN ln(arg_max_cte."SoftProba_2") ELSE -1.79769313486231e+308 END AS "LogProba_2", CASE WHEN (arg_max_cte."SoftProba_3" IS NULL OR arg_max_cte."SoftProba_3" > CAST(0.0 AS DOUBLE PRECISION)) THEN ln(arg_max_cte."SoftProba_3") ELSE -1.79769313486231e+308 END AS "LogProba_3", arg_max_cte."arg_max_Score" AS "Decision", greatest(arg_max_cte."SoftProba_0", arg_max_cte."SoftProba_1", arg_max_cte."SoftProba_2", arg_max_cte."SoftProba_3") AS "DecisionProba"
FROM arg_max_cte |
<filename>medium/_05_err_x/cases/alter24.sql
autocommit off;
create class foo
(attr_name string default '10');
alter class foo modify attr_name string default 10;
rollback work;
rollback;
|
<filename>sql/_13_issues/_12_2h/cases/bug_bts_7308.sql<gh_stars>1-10
--TEST: [Analytic Functions] Returned number of rows is incorrect when row_number() function is selected in ANY/SOME expression.
drop table if exists foo;
create table foo(a int primary key, b int, c smallint);
insert into foo values(1, 2, 100);
insert into foo values(2, 3, 200);
insert into foo values(3, 1, 300);
insert into foo values(4, 3, 200);
insert into foo values(5, 1, 100);
select a, b, c from foo where a = any(select row_number() over(partition by b order by a) row_num from foo) order by 1;
select a, b, c from foo where a = some(select row_number() over(partition by b order by a) row_num from foo) order by 1;
select a, b, c from foo where a = all(select row_number() over(partition by b order by a) row_num from foo) order by 1;
drop table foo;
|
<filename>migrations/013_unpack_import_row.sql
DROP function unpack_import_row CASCADE;
CREATE OR REPLACE FUNCTION public.unpack_import_row(arg_id uuid)
RETURNS void
LANGUAGE plpgsql
AS $function$
DECLARE
_rec record;
BEGIN
SELECT INTO _rec imports.data_json, imports.id FROM imports WHERE imports.id = arg_id;
IF _rec.data_json IS NOT NULL THEN
INSERT INTO data_staging(data, data_source_id, import_id)
SELECT value, imports.data_source_id, imports.id
FROM jsonb_array_elements((SELECT data_json from imports WHERE imports.id = _rec.id))
CROSS JOIN imports WHERE imports.id = _rec.id;
END IF;
RETURn;
END;
$function$
|
<filename>PhpLogger.sql<gh_stars>0
CREATE TABLE `PhpLogger` (
`id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
`priority` varchar(55) DEFAULT NULL,
`log` text,
`date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; |
CREATE PROCEDURE [dbo].[uspNegotiationStatusDelete]
@StatusID uniqueidentifier
AS
SET NOCOUNT ON
SET XACT_ABORT ON
BEGIN TRAN
DELETE
FROM [dbo].[NegotiationStatus]
WHERE [StatusID] = @StatusID
COMMIT |
-- MySQL dump 10.13 Distrib 5.7.17, for Win64 (x86_64)
--
-- Host: localhost Database: taojin_bot
-- ------------------------------------------------------
-- Server version 5.5.5-10.1.31-MariaDB
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `taojin_current_log`
--
DROP TABLE IF EXISTS `taojin_current_log`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `taojin_current_log` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`wx_bot` varchar(255) CHARACTER SET utf8 NOT NULL COMMENT '微信机器人',
`username` varchar(255) CHARACTER SET utf8 NOT NULL DEFAULT '0' COMMENT 'æçŽ°äºº',
`amount` float(11,2) NOT NULL DEFAULT '1.00' COMMENT 'æçް金é¢',
`create_time` int(11) NOT NULL COMMENT 'æçŽ°æ—¶é—´',
`puid` varchar(255) CHARACTER SET utf8 NOT NULL,
`bot_puid` varchar(255) CHARACTER SET utf8 NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 CHECKSUM=1 DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `taojin_get_orders`
--
DROP TABLE IF EXISTS `taojin_get_orders`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `taojin_get_orders` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`order_id` bigint(20) NOT NULL COMMENT '订单id',
`good_id` bigint(20) NOT NULL COMMENT '商品id',
`good_name` varchar(255) NOT NULL COMMENT '商品名称',
`good_price` float NOT NULL COMMENT '商品单价',
`good_num` int(11) NOT NULL COMMENT '商品数量',
`order_price` float NOT NULL COMMENT '订单付款价格',
`order_status` tinyint(1) NOT NULL COMMENT '订单状态, ''订单结算'': 1, ''订单付款'': 2, ''订单失效'': 3, ''订单成功'': 4 5 售后',
`order_source` tinyint(1) NOT NULL COMMENT '订单来源',
`order_commission` float NOT NULL DEFAULT '0' COMMENT '订单佣金',
`create_time` varchar(50) NOT NULL COMMENT '订单创建时间',
`settlement_time` varchar(50) DEFAULT NULL COMMENT '订单结算时间',
`bot_puid` varchar(100) NOT NULL COMMENT '机器人puid',
`pdd_order_id` varchar(100) DEFAULT NULL COMMENT '拼多多id',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=298 DEFAULT CHARSET=utf8 CHECKSUM=1 DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `taojin_good_info`
--
DROP TABLE IF EXISTS `taojin_good_info`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `taojin_good_info` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`wx_bot` varchar(255) CHARACTER SET utf8 NOT NULL,
`skuid` bigint(20) NOT NULL COMMENT 'skuid',
`title` varchar(255) CHARACTER SET utf8 NOT NULL COMMENT '商品title',
`image` varchar(255) CHARACTER SET utf8 NOT NULL COMMENT '商品图片',
`price` float NOT NULL COMMENT '商品原价',
`rebate` float NOT NULL COMMENT '返利价格',
`yhq_price` int(11) NOT NULL DEFAULT '0' COMMENT '优惠券价格',
`coupon_price` float NOT NULL DEFAULT '0' COMMENT '券后价',
`shoturl` varchar(255) CHARACTER SET utf8 NOT NULL COMMENT '商品购买链接',
`shotcouponurl` varchar(255) CHARACTER SET utf8 NOT NULL DEFAULT '0' COMMENT '优惠券链接',
`status` tinyint(1) NOT NULL COMMENT '商品状态,1 未发送,2 已发送',
`create_time` int(11) NOT NULL,
`bot_puid` varchar(255) CHARACTER SET utf8 NOT NULL COMMENT '机器人puid',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 CHECKSUM=1 DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `taojin_group_message`
--
DROP TABLE IF EXISTS `taojin_group_message`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `taojin_group_message` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`username` varchar(255) CHARACTER SET utf8 NOT NULL COMMENT '机器人名称',
`groupid` varchar(255) CHARACTER SET utf8 NOT NULL COMMENT '群id',
`groupname` varchar(255) CHARACTER SET utf8 NOT NULL COMMENT '群名称',
`create_time` int(11) NOT NULL,
`bot_puid` varchar(255) CHARACTER SET utf8 NOT NULL COMMENT '机器人puid',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=latin1 CHECKSUM=1 DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `taojin_order`
--
DROP TABLE IF EXISTS `taojin_order`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `taojin_order` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`wx_bot` varchar(255) CHARACTER SET utf8 NOT NULL,
`username` varchar(255) CHARACTER SET utf8 NOT NULL COMMENT '用户å',
`order_id` char(32) CHARACTER SET utf8 NOT NULL COMMENT '订å•å·',
`status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '1 未完成 2 已完成 3 错误的订单',
`completion_time` varchar(50) NOT NULL,
`order_source` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'è®¢å•æ¥æºï¼š1,京东 2,淘å®',
`puid` varchar(255) CHARACTER SET utf8 NOT NULL,
`bot_puid` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
`pdd_order_id` varchar(100) CHARACTER SET utf8 DEFAULT NULL,
`order_price` float DEFAULT NULL COMMENT '订单金额',
`total_commission_rate` float DEFAULT NULL COMMENT '佣金比例',
`total_commission_fee` float DEFAULT NULL COMMENT '用户返利',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1 CHECKSUM=1 DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `taojin_order_info`
--
DROP TABLE IF EXISTS `taojin_order_info`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `taojin_order_info` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`bot_puid` varchar(255) NOT NULL,
`skuid` int(32) NOT NULL COMMENT '商品skuid',
`order_id` int(32) NOT NULL,
`type` tinyint(1) NOT NULL COMMENT '类型,1 京东 2 淘宝',
`create_time` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `taojin_proxy_info`
--
DROP TABLE IF EXISTS `taojin_proxy_info`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `taojin_proxy_info` (
`id` int(11) NOT NULL,
`wx_bot` varchar(255) CHARACTER SET utf8 NOT NULL,
`realname` varchar(32) CHARACTER SET utf8 DEFAULT NULL COMMENT '代ç†äººå§“å',
`wx_bot_number` varchar(32) CHARACTER SET utf8 NOT NULL COMMENT '机器人的微信å·',
`jd_username` int(11) NOT NULL COMMENT '京东è”盟账å·',
`jd_password` varchar(255) CHARACTER SET utf8 NOT NULL COMMENT '京东è”盟密ç ',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `taojin_query_record`
--
DROP TABLE IF EXISTS `taojin_query_record`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `taojin_query_record` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`wx_bot` varchar(255) CHARACTER SET utf8 NOT NULL COMMENT '微信机器人',
`skuid` varchar(100) CHARACTER SET utf8 NOT NULL,
`good_title` varchar(255) CHARACTER SET utf8 NOT NULL,
`good_price` decimal(10,2) NOT NULL,
`good_coupon` int(10) DEFAULT NULL,
`username` varchar(255) CHARACTER SET utf8 NOT NULL,
`create_time` int(11) NOT NULL,
`puid` varchar(255) CHARACTER SET utf8 NOT NULL COMMENT '用户puid',
`bot_puid` varchar(255) CHARACTER SET utf8 NOT NULL COMMENT '机器人puid',
`chatroom` varchar(255) CHARACTER SET utf8 DEFAULT NULL COMMENT '群聊昵称',
`type` tinyint(1) NOT NULL COMMENT '1京东 2 淘宝 3 拼多多',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 CHECKSUM=1 DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `taojin_rebate_log`
--
DROP TABLE IF EXISTS `taojin_rebate_log`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `taojin_rebate_log` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
`bot_puid` varchar(255) CHARACTER SET utf8 NOT NULL COMMENT '机器人的puid',
`wx_bot` varchar(255) CHARACTER SET utf8 NOT NULL COMMENT '机器人',
`username` varchar(255) CHARACTER SET utf8 NOT NULL COMMENT '用户',
`rebate_amount` float(11,2) NOT NULL,
`type` tinyint(1) NOT NULL COMMENT '返利类型:1æ·»åŠ æœºå™¨äººè¿”åˆ©ï¼Œ2邀请人返利,3,è´ç‰©è¿”利,4邀请人è´ç‰©è¿”利',
`create_time` int(11) NOT NULL COMMENT '创建时间',
`puid` varchar(255) CHARACTER SET utf8 NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1 CHECKSUM=1 DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `taojin_user_info`
--
DROP TABLE IF EXISTS `taojin_user_info`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `taojin_user_info` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`wx_bot` varchar(255) NOT NULL COMMENT '机器人',
`puid` varchar(255) NOT NULL COMMENT '用户唯一标示',
`sex` tinyint(1) NOT NULL DEFAULT '1' COMMENT '性别 1男 2女',
`nickname` varchar(255) NOT NULL COMMENT '用户昵称',
`lnivt_code` varchar(255) NOT NULL DEFAULT '0' COMMENT '邀请码',
`total_rebate_amount` float(11,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '总返利金额',
`jd_rebate_amount` float(11,2) NOT NULL DEFAULT '0.00' COMMENT '京东返利金额',
`taobao_rebate_amount` float(11,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '淘宝返利金额',
`withdrawals_amount` float(11,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '可提现金额',
`save_money` float(11,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '累计总金额',
`order_quantity` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '订单总数',
`jd_order_quantity` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '京东订单总数',
`taobao_order_quantity` int(11) NOT NULL DEFAULT '0' COMMENT '淘宝订单总数',
`jd_completed_order` int(11) NOT NULL DEFAULT '0' COMMENT '京东订单完成数量',
`taobao_completed_order` int(11) NOT NULL DEFAULT '0' COMMENT '淘宝订单完成数量',
`jd_unfinished_order` int(11) NOT NULL DEFAULT '0' COMMENT '京东未完成订单数',
`lnivter` varchar(255) NOT NULL DEFAULT '0' COMMENT '邀请人',
`taobao_unfinished_order` int(11) NOT NULL DEFAULT '0' COMMENT '淘宝未完成订单数',
`friends_rebate` float(11,2) NOT NULL DEFAULT '0.00' COMMENT '好友返利',
`friends_number` int(11) NOT NULL DEFAULT '0' COMMENT '好友数量 (邀请过的人数)',
`create_time` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
`update_time` int(11) DEFAULT NULL COMMENT '修改时间',
`remarkname` varchar(255) NOT NULL COMMENT '用户备注',
`bot_puid` varchar(255) NOT NULL COMMENT '机器人的puid',
`pdd_rebate_amount` float(11,2) NOT NULL DEFAULT '0.00' COMMENT '拼多多返利金额',
`pdd_order_quantity` int(11) NOT NULL DEFAULT '0' COMMENT '拼多多订单总数',
`pdd_completed_order` int(11) NOT NULL DEFAULT '0' COMMENT '拼多多订单完成数量',
`pdd_unfinished_order` int(11) NOT NULL DEFAULT '0' COMMENT '拼多多订单未完成数量',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 CHECKSUM=1 DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2018-08-20 16:36:37
|
use EconomicNews;
if not exists (select * from sysobjects where name='Currency' and xtype='U')
create table Currency (
id int not null identity primary key,
[name] nvarchar(100)
) |
<gh_stars>0
-- phpMyAdmin SQL Dump
-- version 4.9.0.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Sep 01, 2019 at 12:02 PM
-- Server version: 10.3.16-MariaDB
-- PHP Version: 7.3.6
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `video_manager`
--
-- --------------------------------------------------------
--
-- Table structure for table `categories`
--
CREATE TABLE `categories` (
`id` bigint(20) UNSIGNED NOT NULL,
`catName` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `categories`
--
INSERT INTO `categories` (`id`, `catName`, `created_at`, `updated_at`) VALUES
(13, 'Programming', '2019-08-28 00:12:44', '2019-08-28 00:12:44'),
(14, 'Laravel', '2019-08-28 00:12:44', '2019-08-28 00:12:44'),
(15, 'Bangla', '2019-08-28 03:22:03', '2019-08-28 03:22:03'),
(16, 'Sports', '2019-08-28 03:31:54', '2019-08-28 03:31:54'),
(17, 'Islamic', '2019-08-28 03:35:13', '2019-08-28 03:35:13'),
(18, 'Masjid', '2019-08-28 03:37:35', '2019-08-28 03:37:35'),
(19, 'React', '2019-08-28 04:05:37', '2019-08-28 04:05:37'),
(20, 'Coding', '2019-08-31 09:24:20', '2019-08-31 09:24:20'),
(21, 'Jahangir', '2019-08-31 10:02:31', '2019-08-31 10:02:31'),
(22, 'News', '2019-08-31 10:07:36', '2019-08-31 10:07:36'),
(23, 'new', '2019-09-01 00:51:32', '2019-09-01 00:51:32'),
(24, 'new Islamic', '2019-09-01 00:54:08', '2019-09-01 00:54:08'),
(25, '<NAME>', '2019-09-01 03:24:50', '2019-09-01 03:24:50'),
(26, 'Documentary', '2019-09-01 03:27:41', '2019-09-01 03:27:41'),
(27, 'Talk Show', '2019-09-01 03:54:38', '2019-09-01 03:54:38'),
(28, 'Politics', '2019-09-01 03:55:16', '2019-09-01 03:55:16');
-- --------------------------------------------------------
--
-- Table structure for table `category_video`
--
CREATE TABLE `category_video` (
`id` bigint(20) UNSIGNED NOT NULL,
`category_id` bigint(20) UNSIGNED NOT NULL,
`video_id` bigint(20) UNSIGNED NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `category_video`
--
INSERT INTO `category_video` (`id`, `category_id`, `video_id`, `created_at`, `updated_at`) VALUES
(40, 19, 36, NULL, NULL),
(41, 13, 36, NULL, NULL),
(58, 15, 42, NULL, NULL),
(59, 27, 42, NULL, NULL),
(60, 28, 42, NULL, NULL),
(61, 27, 43, NULL, NULL),
(62, 15, 43, NULL, NULL),
(63, 15, 44, NULL, NULL),
(64, 26, 44, NULL, NULL),
(65, 16, 45, NULL, NULL);
-- --------------------------------------------------------
--
-- Table structure for table `migrations`
--
CREATE TABLE `migrations` (
`id` int(10) UNSIGNED NOT NULL,
`migration` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`batch` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `migrations`
--
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES
(1, '2014_10_12_000000_create_users_table', 1),
(2, '2014_10_12_100000_create_password_resets_table', 1),
(3, '2016_06_01_000001_create_oauth_auth_codes_table', 1),
(4, '2016_06_01_000002_create_oauth_access_tokens_table', 1),
(5, '2016_06_01_000003_create_oauth_refresh_tokens_table', 1),
(6, '2016_06_01_000004_create_oauth_clients_table', 1),
(7, '2016_06_01_000005_create_oauth_personal_access_clients_table', 1),
(8, '2019_08_25_135328_create_video_lists_table', 2),
(9, '2019_08_26_050722_create_categories_table', 3),
(10, '2019_08_26_104156_create_videos_table', 4),
(11, '2019_08_27_053232_create_category_video_table', 4);
-- --------------------------------------------------------
--
-- Table structure for table `oauth_access_tokens`
--
CREATE TABLE `oauth_access_tokens` (
`id` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
`user_id` bigint(20) DEFAULT NULL,
`client_id` int(10) UNSIGNED NOT NULL,
`name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`scopes` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`revoked` tinyint(1) NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
`expires_at` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `oauth_access_tokens`
--
INSERT INTO `oauth_access_tokens` (`id`, `user_id`, `client_id`, `name`, `scopes`, `revoked`, `created_at`, `updated_at`, `expires_at`) VALUES
('11c3317aa10aaff4e7899466e3549d461db1917c94ca8f04a1295d6b998ef895dba34789b36180df', 3, 1, 'MyApp', '[]', 0, '2019-08-28 03:19:42', '2019-08-28 03:19:42', '2020-08-28 09:19:42'),
('139a9861c48f789d0a4a8473aca3d02b36113ad1fe3a9450630b9ab9a27db5b9e6e31ea99f0c3177', 3, 1, 'MyApp', '[]', 0, '2019-08-26 21:21:07', '2019-08-26 21:21:07', '2020-08-27 03:21:07'),
('2d13c28bf68997200bcd5cd7d8e48acd524879f6650a724eaccb320c0e239bef8104bfe11d0aad6a', 3, 1, 'MyApp', '[]', 0, '2019-08-26 21:26:46', '2019-08-26 21:26:46', '2020-08-27 03:26:46'),
('48984ae7d239bf72ddc6060d534c6372c9b0d4fe04dfe693856d6e23caca2d394d162e16bb9e9798', 3, 1, 'MyApp', '[]', 0, '2019-08-28 00:02:23', '2019-08-28 00:02:23', '2020-08-28 06:02:23'),
('50acbd90b6751b4af2f0ba2a5adec3c49913b974aa7c1d9136edf88e34cc5497dc3155188d9f86f1', 3, 1, 'MyApp', '[]', 0, '2019-08-26 02:54:35', '2019-08-26 02:54:35', '2020-08-26 08:54:35'),
('52d118a637fc02db770c182b78c1c7e0d72151f6bf7dab0c816ef4be7c86444ca2b7dd445fbee157', 3, 1, 'MyApp', '[]', 0, '2019-08-26 20:44:26', '2019-08-26 20:44:26', '2020-08-27 02:44:26'),
('5370e937976f2c853a33c273471fe86bc8f8b085fe0e1964a149b2b7e3d5858b44af34516ef3457c', 3, 1, 'MyApp', '[]', 0, '2019-08-26 08:20:05', '2019-08-26 08:20:05', '2020-08-26 14:20:05'),
('57844835ad4b87b21f61af0e8ff4199a5c996a2a8a934f23bbd33d46c780fca012d09d12a9d2c8e9', 3, 1, 'MyApp', '[]', 0, '2019-08-26 02:45:10', '2019-08-26 02:45:10', '2020-08-26 08:45:10'),
('613fc5d36a172a8d1176b5eeacb5ad5460ed0832ef7f35766e24cdf5be55787cf2c9cb5fad822eda', 3, 1, 'MyApp', '[]', 0, '2019-08-26 18:36:02', '2019-08-26 18:36:02', '2020-08-27 00:36:02'),
('6c577ae57cdc60af718ee4c66376b5644b6e763cc2d04abfa07c2cae298cbac15d18681d26223107', 3, 1, 'MyApp', '[]', 0, '2019-08-26 07:23:59', '2019-08-26 07:23:59', '2020-08-26 13:23:59'),
('739399061b0ba7a68a830b526e44c2d5c3102e1b25d8bdabb663054550e45dc3d32923a977bc8c65', 3, 1, 'MyApp', '[]', 0, '2019-08-26 09:05:28', '2019-08-26 09:05:28', '2020-08-26 15:05:28'),
('779ce4f92de01371d764ace9ebec7cb45d8bf45ce3200ac1f9508cd6f399ca30943a1eaf8afae8a1', 3, 1, 'MyApp', '[]', 0, '2019-08-25 06:14:16', '2019-08-25 06:14:16', '2020-08-25 12:14:16'),
('78ef7ddb54995c4fafe37e03eb66b28a566d3a7273feb454023d850642ec7a7a30d1ddb7187b86f7', 3, 1, 'MyApp', '[]', 0, '2019-08-26 03:05:54', '2019-08-26 03:05:54', '2020-08-26 09:05:54'),
('795c0703e71670eea00daf8498230c9c481cf6cc2f62fa642fefd57d1f391db47e1b7545cd0fabcd', 3, 1, 'MyApp', '[]', 0, '2019-08-26 20:02:31', '2019-08-26 20:02:31', '2020-08-27 02:02:31'),
('7a142a00c3ceee1ec762202e1e1bfa63d15f650f97c50e6ce6004cf1c5a2309dad377f4eae974046', 3, 1, 'MyApp', '[]', 0, '2019-08-26 02:36:30', '2019-08-26 02:36:30', '2020-08-26 08:36:30'),
('7bef1adadf7ff1aef041cb40b3391598e406e580708ca2b67fc9db0c4ca3000e8bae33c977ca6155', 3, 1, 'MyApp', '[]', 0, '2019-08-26 19:58:23', '2019-08-26 19:58:23', '2020-08-27 01:58:23'),
('7c277c2caca1f63788104d658378815a95a6feb4bee87ba405435599a262560928f397e103e00fdb', 3, 1, 'MyApp', '[]', 0, '2019-08-26 20:02:51', '2019-08-26 20:02:51', '2020-08-27 02:02:51'),
('7f0b611a8b515fe7aab0df38818f2118c876313c58d4bb82b7014cdb4989ba282d213580ee3cd601', 3, 1, 'MyApp', '[]', 0, '2019-08-25 06:08:24', '2019-08-25 06:08:24', '2020-08-25 12:08:24'),
('8359c789103b50d26114a290ed86cfe15748cdc679e3c55628a3ecd51cb5ef8649b0dbbf0e871b8e', 3, 1, 'MyApp', '[]', 0, '2019-08-26 07:24:10', '2019-08-26 07:24:10', '2020-08-26 13:24:10'),
('8ade81fd480b3f78f03848e996e532618888812213b0ef1933be494a5c91aa94dee207cf48a61c52', 3, 1, 'MyApp', '[]', 0, '2019-08-26 08:20:16', '2019-08-26 08:20:16', '2020-08-26 14:20:16'),
('8b20a99ab8e99858fa42697441d002a6bee6a0a508f4c4868593ed838cf0d6833287f6523431bf60', 3, 1, 'MyApp', '[]', 0, '2019-08-26 08:20:41', '2019-08-26 08:20:41', '2020-08-26 14:20:41'),
('8e36be232dd217bb665faa395a0ead86e6558668be35635f91a81f2e122ebbba5ed92f8cebf0f28e', 1, 1, 'MyApp', '[]', 0, '2019-08-25 05:08:30', '2019-08-25 05:08:30', '2020-08-25 11:08:30'),
('90a36af958490bae3ac8ae057a0cf3c12ba588cf5b92c9dc1270fdac72a86cf61a17aff8c870a72f', 3, 1, 'MyApp', '[]', 0, '2019-08-26 09:07:39', '2019-08-26 09:07:39', '2020-08-26 15:07:39'),
('96e0fd3a42109a16e29482d8f109be16f68d53c81b8ecd49b1c0110539cdd8980e420be2c5fa9e5e', 3, 1, 'MyApp', '[]', 0, '2019-08-26 03:07:37', '2019-08-26 03:07:37', '2020-08-26 09:07:37'),
('a0f0c4fe576c0d9669838b7ca4b41b5616c1f85c7bd6ab50d7b6bdbd97bcf1bbea22978e7e997c20', 3, 1, 'MyApp', '[]', 0, '2019-08-26 20:41:44', '2019-08-26 20:41:44', '2020-08-27 02:41:44'),
('a6fe6e41b09317ec9bf3bcc53b4da519fc93f4eba0c2c9deb16fc557164650c27a49b61bc4635299', 3, 1, 'MyApp', '[]', 0, '2019-08-26 08:05:07', '2019-08-26 08:05:07', '2020-08-26 14:05:07'),
('cb7f8d379c745911485be8ddb2d3639ca2b0d821ba79bed764b64d3f0274f244c8ecf549788e1b58', 3, 1, 'MyApp', '[]', 0, '2019-08-31 07:50:07', '2019-08-31 07:50:07', '2020-08-31 13:50:07'),
('cca2897318108967ef796888a0bb684e54eef43351345a4ccdaf1f6ff4cf57ffcc7d201e9617267f', 3, 1, 'MyApp', '[]', 0, '2019-08-28 04:25:51', '2019-08-28 04:25:51', '2020-08-28 10:25:51'),
('d2a063eecd229c77bf6efb430315411b765cbdcde02e308b4f52217f2b7ab13ac9928a6047a28852', 3, 1, 'MyApp', '[]', 0, '2019-08-26 02:47:00', '2019-08-26 02:47:00', '2020-08-26 08:47:00'),
('da95a712de6dcd8161a5c14cc08843ad6a6eb0757cef8f457a1203e73647cfb08597f4c53c4d2dea', 3, 1, 'MyApp', '[]', 0, '2019-08-29 03:08:44', '2019-08-29 03:08:44', '2020-08-29 09:08:44'),
('dbb0203c377212fb587e9fce468f2aa62bf3f30f69b203eceb48fc6b109056b149f038474663155e', 3, 1, 'MyApp', '[]', 0, '2019-08-26 02:56:18', '2019-08-26 02:56:18', '2020-08-26 08:56:18'),
('dfdbdd7defba53ca903fcff916ece8d9c5083af5f19b0f85c5210f3f468f7f3710911ddd33d37471', 2, 1, 'MyApp', '[]', 0, '2019-08-25 05:28:19', '2019-08-25 05:28:19', '2020-08-25 11:28:19'),
('e295caf3afee7ecd097a0c72e239c7fc5859f1a5d140c3db1e11a90afe5bafd1d122637765b0eaf6', 3, 1, 'MyApp', '[]', 0, '2019-08-28 03:07:40', '2019-08-28 03:07:40', '2020-08-28 09:07:40'),
('e64da39d650cd43d2d10328ef9f53bea488ab88e05d3a6f785a70b61fe96714c311023b8b024294f', 3, 1, 'MyApp', '[]', 0, '2019-08-26 20:44:10', '2019-08-26 20:44:10', '2020-08-27 02:44:10');
-- --------------------------------------------------------
--
-- Table structure for table `oauth_auth_codes`
--
CREATE TABLE `oauth_auth_codes` (
`id` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
`user_id` bigint(20) NOT NULL,
`client_id` int(10) UNSIGNED NOT NULL,
`scopes` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`revoked` tinyint(1) NOT NULL,
`expires_at` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `oauth_clients`
--
CREATE TABLE `oauth_clients` (
`id` int(10) UNSIGNED NOT NULL,
`user_id` bigint(20) DEFAULT NULL,
`name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`secret` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
`redirect` text COLLATE utf8mb4_unicode_ci NOT NULL,
`personal_access_client` tinyint(1) NOT NULL,
`password_client` tinyint(1) NOT NULL,
`revoked` tinyint(1) NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `oauth_clients`
--
INSERT INTO `oauth_clients` (`id`, `user_id`, `name`, `secret`, `redirect`, `personal_access_client`, `password_client`, `revoked`, `created_at`, `updated_at`) VALUES
(1, NULL, 'Video Manager Personal Access Client', 'mlTiRnElLZP5dF96gAR5aC0lJ2YaZDEjXU9FOcCn', 'http://localhost', 1, 0, 0, '2019-08-25 03:31:21', '2019-08-25 03:31:21'),
(2, NULL, 'Video Manager Password Grant Client', 'lGNXkYhmWwlIoTYuyIhcCHO42KRWqrT85ODLgfyH', 'http://localhost', 0, 1, 0, '2019-08-25 03:31:21', '2019-08-25 03:31:21');
-- --------------------------------------------------------
--
-- Table structure for table `oauth_personal_access_clients`
--
CREATE TABLE `oauth_personal_access_clients` (
`id` int(10) UNSIGNED NOT NULL,
`client_id` int(10) UNSIGNED NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `oauth_personal_access_clients`
--
INSERT INTO `oauth_personal_access_clients` (`id`, `client_id`, `created_at`, `updated_at`) VALUES
(1, 1, '2019-08-25 03:31:21', '2019-08-25 03:31:21');
-- --------------------------------------------------------
--
-- Table structure for table `oauth_refresh_tokens`
--
CREATE TABLE `oauth_refresh_tokens` (
`id` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
`access_token_id` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
`revoked` tinyint(1) NOT NULL,
`expires_at` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `password_resets`
--
CREATE TABLE `password_resets` (
`email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`token` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
CREATE TABLE `users` (
`id` bigint(20) UNSIGNED NOT NULL,
`name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`email_verified_at` timestamp NULL DEFAULT NULL,
`password` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`remember_token` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `users`
--
INSERT INTO `users` (`id`, `name`, `email`, `email_verified_at`, `password`, `remember_token`, `created_at`, `updated_at`) VALUES
(1, 'Akib', '<EMAIL>', NULL, '$2y$10$CY39vDY1RVFs0fMF8FOfg.PUH7jtLyVwAF.TVTwbLe9J7U3v70LUi', NULL, '2019-08-25 05:08:29', '2019-08-25 05:08:29'),
(2, 'arnab', '<EMAIL>', NULL, '$2y$10$h6VtbQzWe5Cog9NvjVlibOnFdg5yH7o/5xPCWxDmyS8N6OSv9.dIy', NULL, '2019-08-25 05:28:18', '2019-08-25 05:28:18'),
(3, 'arif', '<EMAIL>', NULL, '$2y$10$9F3ACPy0FMERRX5/LrjnvOiT1LZ.Xj5izZ/vaH/x8T4vMpxJXtuJu', NULL, '2019-08-25 06:08:24', '2019-08-25 06:08:24');
-- --------------------------------------------------------
--
-- Table structure for table `videos`
--
CREATE TABLE `videos` (
`id` bigint(20) UNSIGNED NOT NULL,
`title` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`link` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `videos`
--
INSERT INTO `videos` (`id`, `title`, `link`, `created_at`, `updated_at`) VALUES
(36, 'What is React e', 'https://www.youtube.com/embed/N3AkSS5hXMA', '2019-08-28 04:05:37', '2019-08-28 04:05:37'),
(42, 'Bangla Tv talk show Edited', 'https://www.youtube.com/embed/9s29lKO9rFU', '2019-09-01 03:54:38', '2019-09-01 03:54:38'),
(43, 'Dbc news talk show', 'https://www.youtube.com/embed/8j-OfWvpVP0', '2019-09-01 03:57:11', '2019-09-01 03:57:11'),
(44, 'Life struggles of shepherds at Bathan', 'https://www.youtube.com/embed/Adazw-c7JXg', '2019-09-01 03:58:01', '2019-09-01 03:58:01'),
(45, '<NAME>', 'https://www.youtube.com/embed/2mh_ZICm-EU', '2019-09-01 03:59:04', '2019-09-01 03:59:04');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `categories`
--
ALTER TABLE `categories`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `category_video`
--
ALTER TABLE `category_video`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `migrations`
--
ALTER TABLE `migrations`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `oauth_access_tokens`
--
ALTER TABLE `oauth_access_tokens`
ADD PRIMARY KEY (`id`),
ADD KEY `oauth_access_tokens_user_id_index` (`user_id`);
--
-- Indexes for table `oauth_auth_codes`
--
ALTER TABLE `oauth_auth_codes`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `oauth_clients`
--
ALTER TABLE `oauth_clients`
ADD PRIMARY KEY (`id`),
ADD KEY `oauth_clients_user_id_index` (`user_id`);
--
-- Indexes for table `oauth_personal_access_clients`
--
ALTER TABLE `oauth_personal_access_clients`
ADD PRIMARY KEY (`id`),
ADD KEY `oauth_personal_access_clients_client_id_index` (`client_id`);
--
-- Indexes for table `oauth_refresh_tokens`
--
ALTER TABLE `oauth_refresh_tokens`
ADD PRIMARY KEY (`id`),
ADD KEY `oauth_refresh_tokens_access_token_id_index` (`access_token_id`);
--
-- Indexes for table `password_resets`
--
ALTER TABLE `password_resets`
ADD KEY `password_resets_email_index` (`email`);
--
-- Indexes for table `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `users_email_unique` (`email`);
--
-- Indexes for table `videos`
--
ALTER TABLE `videos`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `categories`
--
ALTER TABLE `categories`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=29;
--
-- AUTO_INCREMENT for table `category_video`
--
ALTER TABLE `category_video`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=66;
--
-- AUTO_INCREMENT for table `migrations`
--
ALTER TABLE `migrations`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12;
--
-- AUTO_INCREMENT for table `oauth_clients`
--
ALTER TABLE `oauth_clients`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `oauth_personal_access_clients`
--
ALTER TABLE `oauth_personal_access_clients`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT for table `videos`
--
ALTER TABLE `videos`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=46;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
CREATE DATABASE app_pos;
CREATE TABLE user(
id_user int not null PRIMARY KEY auto_increment,
email VARCHAR
(30) not null,
nama VARCHAR
(30),
password VARCHAR
(200),
image text,
jenis_kelamin VARCHAR
(10),
alamat VARCHAR
(50),
no_telp VARCHAR
(15),
tanggal_lahir date,
agama VARCHAR
(15),
level int
(1),
is_active int
(1),
token VARCHAR
(200),
date_created int,
);
CREATE TABLE pelanggan(
id_pelanggan int not null PRIMARY KEY auto_increment,
nama_pelanggan VARCHAR
(20),
no_telp VARCHAR
(15),
is_active tinyint default 1
);
CREATE TABLE jenis_barang(
id_jenis_barang int not null PRIMARY KEY auto_increment,
jenis_barang VARCHAR
(20),
is_active tinyint default 1
);
CREATE TABLE satuan(
id_satuan int not null PRIMARY KEY auto_increment,
satuan_barang VARCHAR
(20),
is_active tinyint default 1
);
CREATE TABLE supplier(
id_supplier int not null PRIMARY KEY auto_increment,
nama_supplier VARCHAR
(20),
no_telp VARCHAR
(15),
alamat VARCHAR
(30),
keterangan VARCHAR
(30),
is_active tinyint default 1
);
CREATE TABLE barang(
id_barang int NOT NULL PRIMARY KEY auto_increment,
nomor_barang int not null,
barcode VARCHAR
(100),
nama_barang VARCHAR
(30),
harga_barang int,
stock int DEFAULT 0,
jenis_barang_id int NOT NULL,
satuan_id int NOT NULL,
is_active tinyint default 1
FOREIGN KEY
(jenis_barang_id) REFERENCES jenis_barang
(id_jenis_barang),
FOREIGN KEY
(satuan_id) REFERENCES satuan
(id_satuan)
);
|
<filename>DB_SQL/init_data/data_app_role.sql
INSERT INTO APP_ROLE (CODE, DESC) VALUES ('ROLE_ADMIN', 'Administrator');
INSERT INTO APP_ROLE (CODE, DESC) VALUES ('ROLE_APPLIER', 'Applier');
INSERT INTO APP_ROLE (CODE, DESC) VALUES ('ROLE_CONFIRMER', 'Confirmer');
INSERT INTO APP_ROLE (CODE, DESC) VALUES ('ROLE_HR', 'HR');
|
<reponame>gunterkoenigsmann/linguist
DECLARE @myid uniqueidentifier = NEWID();
SELECT CONVERT(char(255), @myid) AS 'char';
DECLARE @ID nvarchar(max) = N'0E984725-C51C-4BF4-9960-E1C80E27ABA0wrong';
SELECT @ID, CONVERT(uniqueidentifier, @ID) AS TruncatedValue;
|
CREATE TABLE `notificacao` (
`NOTI_ID` INT NOT NULL AUTO_INCREMENT COMMENT 'Identificador da notificacao',
`NOTI_CD_USU` VARCHAR(30) NOT NULL COMMENT 'Username do usuario',
`NOTI_CD` VARCHAR(200) NOT NULL DEFAULT 0 COMMENT 'Token para notificacao',
PRIMARY KEY (`NOTI_ID`),
INDEX `FK_NOTI_USU_CD` (`NOTI_CD_USU` ASC),
UNIQUE INDEX `UK_NOTI_CD` (`NOTI_CD` ASC)
)
COMMENT = 'Armazena os tokens de notificação relativos aos usuários'; |
-- Issue #1262
SELECT {{ var('passed_through_cli') }}
|
<filename>SQLServer/Working/SQLOutputInstanceUsersAndRolesGenerationScript.sql
/****************************************************************
SQL Server: Script that runs against an instance and creates a
re-usable script to generate all users logins and roles for all
Databases
This Script Generates A script to Create all Logins, Server Roles
,DB Users, and DB roles on a SQL Server
Running this Script will create a script which can be used to recreate
all Logins and Server Roles for each Database
****************************************************************/
SET NOCOUNT ON
DECLARE
@sql nvarchar(max)
, @Line int = 1
, @max int = 0
, @@CurDB nvarchar(100) = ''
CREATE TABLE #SQL
(
Idx int IDENTITY
,xSQL nvarchar(max)
)
INSERT INTO #SQL
( xSQL
)
SELECT
'IF NOT EXISTS (SELECT * FROM sys.server_principals WHERE name = N'''
+ QUOTENAME(name) + ''')
' + ' CREATE LOGIN ' + QUOTENAME(name) + ' WITH PASSWORD='
+ sys.fn_varbintohexstr(password_hash) + ' HASHED, SID='
+ sys.fn_varbintohexstr(sid) + ', ' + 'DEFAULT_DATABASE='
+ QUOTENAME(COALESCE(default_database_name , 'master'))
+ ', DEFAULT_LANGUAGE='
+ QUOTENAME(COALESCE(default_language_name , 'us_english'))
+ ', CHECK_EXPIRATION=' + CASE is_expiration_checked
WHEN 1 THEN 'ON'
ELSE 'OFF'
END + ', CHECK_POLICY='
+ CASE is_policy_checked
WHEN 1 THEN 'ON'
ELSE 'OFF'
END + '
Go
'
FROM
sys.sql_logins
WHERE
name <> 'sa'
INSERT INTO #SQL
( xSQL
)
SELECT
'IF NOT EXISTS (SELECT * FROM sys.server_principals WHERE name = N'''
+ QUOTENAME(name) + ''')
' + ' CREATE LOGIN ' + QUOTENAME(name) + ' FROM WINDOWS WITH '
+ 'DEFAULT_DATABASE='
+ QUOTENAME(COALESCE(default_database_name , 'master'))
+ ', DEFAULT_LANGUAGE='
+ QUOTENAME(COALESCE(default_language_name , 'us_english'))
+ ';
Go
'
FROM
sys.server_principals
WHERE
type IN ( 'U' , 'G' )
AND name NOT IN ( 'BUILTIN\Administrators' ,
'NT AUTHORITY\SYSTEM' );
PRINT '/*****************************************************************************************/'
PRINT '/*************************************** Create Logins ***********************************/'
PRINT '/*****************************************************************************************/'
SELECT
@Max = MAX(idx)
FROM
#SQL
WHILE @Line <= @max
BEGIN
SELECT
@sql = xSql
FROM
#SQL AS s
WHERE
idx = @Line
PRINT @sql
SET @line = @line + 1
END
DROP TABLE #SQL
CREATE TABLE #SQL2
(
Idx int IDENTITY
,xSQL nvarchar(max)
)
INSERT INTO #SQL2
( xSQL
)
SELECT
'EXEC sp_addsrvrolemember ' + QUOTENAME(L.name) + ', '
+ QUOTENAME(R.name) + ';
GO
'
FROM
sys.server_principals L
JOIN sys.server_role_members RM
ON L.principal_id = RM.member_principal_id
JOIN sys.server_principals R
ON RM.role_principal_id = R.principal_id
WHERE
L.type IN ( 'U' , 'G' , 'S' )
AND L.name NOT IN ( 'BUILTIN\Administrators' ,
'NT AUTHORITY\SYSTEM' , 'sa' );
PRINT '/*****************************************************************************************/'
PRINT '/******************************Add Server Role Members *******************************/'
PRINT '/*****************************************************************************************/'
SELECT
@Max = MAX(idx)
FROM
#SQL2
SET @line = 1
WHILE @Line <= @max
BEGIN
SELECT
@sql = xSql
FROM
#SQL2 AS s
WHERE
idx = @Line
PRINT @sql
SET @line = @line + 1
END
DROP TABLE #SQL2
PRINT '/*****************************************************************************************/'
PRINT '/*****************Add User and Roles membership to Indivdual Databases********************/'
PRINT '/*****************************************************************************************/'
--Drop Table #Db
CREATE TABLE #Db
(
idx int IDENTITY
,DBName nvarchar(100)
);
INSERT INTO #Db
SELECT
name
FROM
master.dbo.sysdatabases
WHERE
name NOT IN ( 'Master' , 'Model' , 'msdb' , 'tempdb' )
ORDER BY
name;
SELECT
@Max = MAX(idx)
FROM
#Db
SET @line = 1
--Select * from #Db
--Exec sp_executesql @SQL
WHILE @line <= @Max
BEGIN
SELECT
@@CurDB = DBName
FROM
#Db
WHERE
idx = @line
SET @SQL = 'Use ' + @@CurDB + '
Declare @@Script NVarChar(4000) = ''''
DECLARE cur CURSOR FOR
Select ''Use ' + @@CurDB + ';
Go
IF NOT EXISTS (SELECT * FROM sys.database_principals WHERE name = N'''''' +
mp.[name] + '''''')
CREATE USER ['' + mp.[name] + ''] FOR LOGIN ['' +mp.[name] + ''] WITH DEFAULT_SCHEMA=[dbo]; ''+ CHAR(13)+CHAR(10) +
''GO'' + CHAR(13)+CHAR(10) +
''EXEC sp_addrolemember N'''''' + rp.name + '''''', N''''['' + mp.[name] + '']'''';
Go''
FROM sys.database_role_members a
INNER JOIN sys.database_principals rp ON rp.principal_id = a.role_principal_id
INNER JOIN sys.database_principals AS mp ON mp.principal_id = a.member_principal_id
OPEN cur
FETCH NEXT FROM cur INTO @@Script;
WHILE @@FETCH_STATUS = 0
BEGIN
PRINT @@Script
FETCH NEXT FROM cur INTO @@Script;
END
CLOSE cur;
DEALLOCATE cur;';
--Print @SQL
Exec sp_executesql @SQL;
--Set @@Script = ''
SET @Line = @Line + 1
END
DROP TABLE #Db |
CREATE DATABASE `ci_contact_book`;
USE `ci_contact_book`;
CREATE TABLE `contact_list` (
`id` int(10) PRIMARY KEY AUTO_INCREMENT NOT NULL,
`phone_number` char(15) NOT NULL,
`name` varchar(30) NOT NULL,
`gender` enum('male','female') NOT NULL,
`email` varchar(50) NOT NULL,
`address` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT INTO `contact_list` (`id`, `phone_number`, `name`, `gender`, `email`, `address`) VALUES
(1, '0861239123611', 'SimpleCodz', 'female', '<EMAIL>', 'Indonesia'),
(2, '0812671657112', '<NAME>', 'female', '<EMAIL>', 'Okinawa'); |
<reponame>arashz/next-prisma
-- RedefineTables
PRAGMA foreign_keys=OFF;
CREATE TABLE "new_Contact" (
"id" TEXT NOT NULL PRIMARY KEY,
"firstName" TEXT NOT NULL,
"lastName" TEXT NOT NULL,
"email" TEXT NOT NULL,
"avatar" TEXT NOT NULL DEFAULT ''
);
INSERT INTO "new_Contact" ("id", "firstName", "lastName", "email") SELECT "id", "firstName", "lastName", "email" FROM "Contact";
DROP TABLE "Contact";
ALTER TABLE "new_Contact" RENAME TO "Contact";
PRAGMA foreign_key_check;
PRAGMA foreign_keys=ON;
|
<reponame>metas-fresh/fresh
-- 2021-12-18T11:53:28.541Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,580404,0,'IsForceProcessedAsync',TO_TIMESTAMP('2021-12-18 13:53:28','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','Force async processing','Force async processing',TO_TIMESTAMP('2021-12-18 13:53:28','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2021-12-18T11:53:28.546Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, CommitWarning,Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName,WEBUI_NameBrowse,WEBUI_NameNew,WEBUI_NameNewBreadcrumb, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,IsActive) SELECT l.AD_Language, t.AD_Element_ID, t.CommitWarning,t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName,t.WEBUI_NameBrowse,t.WEBUI_NameNew,t.WEBUI_NameNewBreadcrumb, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,'Y' FROM AD_Language l, AD_Element t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y' OR l.IsBaseLanguage='Y') AND t.AD_Element_ID=580404 AND NOT EXISTS (SELECT 1 FROM AD_Element_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Element_ID=t.AD_Element_ID)
;
-- 2021-12-18T11:55:33.891Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,DDL_NoForeignKey,DefaultValue,EntityType,FacetFilterSeqNo,FieldLength,IsActive,IsAdvancedText,IsAllowLogging,IsAlwaysUpdateable,IsAutoApplyValidationRule,IsAutocomplete,IsCalculated,IsDimension,IsDLMPartitionBoundary,IsEncrypted,IsExcludeFromZoomTargets,IsFacetFilter,IsForceIncludeInGeneratedModel,IsGenericZoomKeyColumn,IsGenericZoomOrigin,IsIdentifier,IsKey,IsLazyLoading,IsMandatory,IsParent,IsSelectionColumn,IsShowFilterIncrementButtons,IsShowFilterInline,IsStaleable,IsSyncDatabase,IsTranslated,IsUpdateable,IsUseDocSequence,MaxFacetsToFetch,Name,SelectionColumnSeqNo,SeqNo,Updated,UpdatedBy,Version) VALUES (0,578967,580404,0,20,541635,'IsForceProcessedAsync',TO_TIMESTAMP('2021-12-18 13:55:33','YYYY-MM-DD HH24:MI:SS'),100,'N','N','D',0,1,'Y','N','Y','N','N','N','N','N','N','N','Y','N','N','N','N','N','N','N','Y','N','N','N','N','N','N','N','Y','N',0,'Force async processing',0,0,TO_TIMESTAMP('2021-12-18 13:55:33','YYYY-MM-DD HH24:MI:SS'),100,0)
;
-- 2021-12-18T11:55:33.899Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,IsActive) SELECT l.AD_Language, t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,'Y' FROM AD_Language l, AD_Column t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y') AND t.AD_Column_ID=578967 AND NOT EXISTS (SELECT 1 FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- 2021-12-18T11:55:33.973Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_Column_Translation_From_AD_Element(580404)
;
-- 2021-12-18T11:55:36.967Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ SELECT public.db_alter_table('API_Audit_Config','ALTER TABLE public.API_Audit_Config ADD COLUMN IsForceProcessedAsync CHAR(1) DEFAULT ''N'' CHECK (IsForceProcessedAsync IN (''Y'',''N'')) NOT NULL')
;
|
UPDATE M_PriceList_Version
SET Processed='Y' -- set prexisting PLVs to processed
WHERE M_PriceList_Version_ID IN (
SELECT --c.NAme, pl.Name, plv.Name,
plv.M_PriceList_Version_ID
FROM C_Flatrate_Conditions c
JOIN M_PriceList pl ON pl.M_PricingSystem_ID=c.M_PricingSystem_ID
JOIN M_PriceList_Version plv ON plv.M_PriceList_ID=pl.M_PriceList_ID
WHERE c.Type_Conditions='QualityBsd'
);
|
-- Copyright 2004-2019 H2 Group. Multiple-Licensed under the MPL 2.0,
-- and the EPL 1.0 (http://h2database.com/html/license.html).
-- Initial Developer: H2 Group
--
select bitand(null, 1) vn, bitand(1, null) vn1, bitand(null, null) vn2, bitand(3, 6) e2;
> VN VN1 VN2 E2
> ---- ---- ---- --
> null null null 2
> rows: 1
|
<reponame>mnm678/social-network-privacy-lab
CREATE TABLE IF NOT EXISTS User (
id integer primary key autoincrement,
username text unique,
password <PASSWORD>,
gender text default null,
image text default "none",
age integer default null,
phone text default null,
fav_color text default null,
interests text default null,
hometown text default null,
permissions integer default 222222,
requests text default "[]"
);
CREATE TABLE IF NOT EXISTS Friend (
id integer primary key autoincrement,
f1 integer not null,
f2 integer not null,
foreign key (f1) references User(id),
foreign key (f2) references User(id),
constraint friendship unique (f1, f2)
);
|
SELECT
"created_at",
"id",
"client_id",
"user_id",
"token_id",
"api_key_id",
"type",
"subject",
"data",
"status_code"
FROM
sso.audit_table
WHERE
"id" = $1
|
SET IDENTITY_INSERT dbo.Exercises ON
alter table dbo.Exercises add Type varchar;
SET IDENTITY_INSERT dbo.Exercises OFF
|
CREATE TABLE customer(c_custkey int primary key, c_name varchar(25), c_address varchar(40), c_nationkey int references nation(n_nationkey), c_phone varchar(15), c_acctbal double precision, c_mktsegment varchar(10), c_comment varchar(117));
CREATE INDEX customer_name_index ON customer(c_name); |
DELETE FROM invitation;
DELETE FROM identities WHERE id = 'd9161547-5263-4c83-a729-e39ff088978e';
DELETE FROM resource WHERE resource_id = 'c6a2ee2e-7ec6-4c04-ae7e-5ff8c36b28b9';
DELETE FROM identities WHERE id = 'c62d77b2-194c-47d0-8bbf-b1308576876d';
DELETE FROM resource WHERE resource_id = '682752ae-e03b-4d74-8b9a-e1d09f618ca5'; |
<gh_stars>1-10
CREATE TABLE acars_live (
acars_live_id serial,
ident varchar(10) NULL,
registration varchar(10) NULL,
label varchar(10) NULL,
block_id integer NULL,
msg_no varchar(10) NULL,
message text NULL,
date timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
decode text null,
PRIMARY KEY (acars_live_id)
);
|
<reponame>GuanEr15/Second-hand-market-on-campus
-- MySQL dump 10.16 Distrib 10.1.32-MariaDB, for Win32 (AMD64)
--
-- Host: localhost Database: db_boot_base
-- ------------------------------------------------------
-- Server version 10.1.32-MariaDB
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `ylrc_database_bak`
--
DROP TABLE IF EXISTS `ylrc_database_bak`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ylrc_database_bak` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`create_time` datetime NOT NULL,
`update_time` datetime NOT NULL,
`filename` varchar(32) NOT NULL,
`filepath` varchar(128) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `ylrc_database_bak`
--
LOCK TABLES `ylrc_database_bak` WRITE;
/*!40000 ALTER TABLE `ylrc_database_bak` DISABLE KEYS */;
INSERT INTO `ylrc_database_bak` VALUES (10,'2020-03-22 19:36:47','2020-03-22 19:36:47','db_boot_base_20200322193647.sql','D:/workspace_devloper/baseproject/base/src/main/resources/backup/'),(11,'2020-03-22 19:37:06','2020-03-22 19:37:06','db_boot_base_20200322193706.sql','D:/workspace_devloper/baseproject/base/src/main/resources/backup/');
/*!40000 ALTER TABLE `ylrc_database_bak` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `ylrc_menu`
--
DROP TABLE IF EXISTS `ylrc_menu`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ylrc_menu` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`create_time` datetime NOT NULL,
`update_time` datetime NOT NULL,
`name` varchar(18) NOT NULL,
`url` varchar(128) DEFAULT NULL,
`icon` varchar(32) DEFAULT NULL,
`sort` int(11) NOT NULL,
`parent_id` bigint(20) DEFAULT NULL,
`is_bitton` bit(1) NOT NULL,
`is_show` bit(1) NOT NULL,
PRIMARY KEY (`id`),
KEY `FKsbtnjocfrq29e8taxdwo21gic` (`parent_id`),
CONSTRAINT `FKsbtnjocfrq29e8taxdwo21gic` FOREIGN KEY (`parent_id`) REFERENCES `ylrc_menu` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=27 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `ylrc_menu`
--
LOCK TABLES `ylrc_menu` WRITE;
/*!40000 ALTER TABLE `ylrc_menu` DISABLE KEYS */;
INSERT INTO `ylrc_menu` VALUES (2,'2020-03-14 14:26:03','2020-03-14 18:24:53','系统设置','','mdi-settings',0,NULL,'\0',''),(3,'2020-03-14 16:58:55','2020-03-14 18:26:02','菜单管理','/menu/list','mdi-view-list',1,2,'\0',''),(5,'2020-03-14 17:04:44','2020-03-14 18:27:53','新增','/menu/add','mdi-plus',2,3,'\0',''),(7,'2020-03-14 17:07:43','2020-03-15 12:11:25','角色管理','/role/list','mdi-account-settings-variant',5,2,'\0',''),(8,'2020-03-14 18:28:48','2020-03-21 22:04:45','编辑','edit(\'/menu/edit\')','mdi-grease-pencil',3,3,'',''),(9,'2020-03-14 18:30:00','2020-03-21 22:08:20','删除','del(\'/menu/delete\')','mdi-close',4,3,'',''),(10,'2020-03-15 12:12:00','2020-03-15 12:12:00','添加','/role/add','mdi-account-plus',6,7,'\0',''),(11,'2020-03-15 12:12:36','2020-03-21 22:10:45','编辑','edit(\'/role/edit\')','mdi-account-edit',7,7,'',''),(12,'2020-03-15 12:13:19','2020-03-21 22:15:27','删除','del(\'/role/delete\')','mdi-account-remove',8,7,'',''),(13,'2020-03-15 12:14:52','2020-03-15 12:17:00','用户管理','/user/list','mdi-account-multiple',9,2,'\0',''),(14,'2020-03-15 12:15:22','2020-03-15 12:17:27','添加','/user/add','mdi-account-plus',10,13,'\0',''),(15,'2020-03-16 17:18:14','2020-03-21 22:11:19','编辑','edit(\'/user/edit\')','mdi-account-edit',11,13,'',''),(16,'2020-03-16 17:19:01','2020-03-21 22:15:36','删除','del(\'/user/delete\')','mdi-account-remove',12,13,'',''),(19,'2020-03-22 11:24:36','2020-03-22 11:26:00','上传图片','/upload/upload_photo','mdi-arrow-up-bold-circle',0,13,'\0','\0'),(20,'2020-03-22 14:09:35','2020-03-22 14:09:47','日志管理','/system/operator_log_list','mdi-tag-multiple',13,2,'\0',''),(21,'2020-03-22 14:11:39','2020-03-22 14:11:39','删除','del(\'/system/delete_operator_log\')','mdi-tag-remove',14,20,'',''),(22,'2020-03-22 14:12:57','2020-03-22 14:46:55','清空日志','delAll(\'/system/delete_all_operator_log\')','mdi-delete-circle',15,20,'',''),(23,'2020-03-22 14:46:40','2020-03-22 14:47:09','数据备份','/database_bak/list','mdi-database',16,2,'\0',''),(24,'2020-03-22 14:48:07','2020-03-22 15:13:41','备份','add(\'/database_bak/add\')','mdi-database-plus',17,23,'',''),(25,'2020-03-22 14:49:03','2020-03-22 14:49:03','删除','del(\'/database_bak/delete\')','mdi-database-minus',18,23,'',''),(26,'2020-03-22 19:36:20','2020-03-22 19:36:20','还原','restore(\'/database_bak/restore\')','mdi-database-minus',19,23,'','');
/*!40000 ALTER TABLE `ylrc_menu` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `ylrc_operater_log`
--
DROP TABLE IF EXISTS `ylrc_operater_log`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ylrc_operater_log` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`create_time` datetime NOT NULL,
`update_time` datetime NOT NULL,
`content` varchar(1024) NOT NULL,
`operator` varchar(18) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=198 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `ylrc_operater_log`
--
LOCK TABLES `ylrc_operater_log` WRITE;
/*!40000 ALTER TABLE `ylrc_operater_log` DISABLE KEYS */;
INSERT INTO `ylrc_operater_log` VALUES (167,'2020-03-22 14:46:40','2020-03-22 14:46:40','添加菜单信息【Menu [name=数据备份, parent=Menu [name=null, parent=null, url=null, icon=null, sort=0, isButton=false, isShow=true], url=/database_bak/list, icon=mdi-database, sort=14, isButton=false, isShow=true]】','猿来入此'),(169,'2020-03-22 14:47:09','2020-03-22 14:47:09','编辑菜单信息【Menu [name=数据备份, parent=Menu [name=null, parent=null, url=null, icon=null, sort=0, isButton=false, isShow=true], url=/database_bak/list, icon=mdi-database, sort=16, isButton=false, isShow=true]】','猿来入此'),(170,'2020-03-22 14:48:07','2020-03-22 14:48:07','添加菜单信息【Menu [name=备份, parent=Menu [name=null, parent=null, url=null, icon=null, sort=0, isButton=false, isShow=true], url=/database_bak/add, icon=mdi-database-plus, sort=17, isButton=true, isShow=true]】','猿来入此'),(171,'2020-03-22 14:49:03','2020-03-22 14:49:03','添加菜单信息【Menu [name=删除, parent=Menu [name=null, parent=null, url=null, icon=null, sort=0, isButton=false, isShow=true], url=del(\'/database_bak/delete\'), icon=mdi-database-minus, sort=18, isButton=true, isShow=true]】','猿来入此'),(172,'2020-03-22 14:49:22','2020-03-22 14:49:22','编辑角色【超级管理员】','猿来入此'),(173,'2020-03-22 14:58:14','2020-03-22 14:58:14','用户【猿来入此】于【2020-03-22 14:58:13】登录系统!','猿来入此'),(174,'2020-03-22 15:09:49','2020-03-22 15:09:49','用户【猿来入此】于【2020-03-22 15:09:49】登录系统!','猿来入此'),(175,'2020-03-22 15:11:09','2020-03-22 15:11:09','用户【猿来入此】于【2020-03-22 15:11:08】登录系统!','猿来入此'),(176,'2020-03-22 15:13:41','2020-03-22 15:13:41','编辑菜单信息【Menu [name=备份, parent=Menu [name=null, parent=null, url=null, icon=null, sort=0, isButton=false, isShow=true], url=add(\'/database_bak/add\'), icon=mdi-database-plus, sort=17, isButton=true, isShow=true]】','猿来入此'),(177,'2020-03-22 16:16:31','2020-03-22 16:16:31','用户【猿来入此】于【2020-03-22 16:16:31】登录系统!','猿来入此'),(178,'2020-03-22 16:31:23','2020-03-22 16:31:23','用户【猿来入此】于【2020-03-22 16:31:23】登录系统!','猿来入此'),(179,'2020-03-22 16:56:25','2020-03-22 16:56:25','用户【猿来入此】于【2020-03-22 16:56:25】登录系统!','猿来入此'),(180,'2020-03-22 17:00:42','2020-03-22 17:00:42','用户【猿来入此】于【2020-03-22 17:00:42】登录系统!','猿来入此'),(181,'2020-03-22 17:13:01','2020-03-22 17:13:01','数据库成功备份,备份文件信息:DatabaseBak [filename=db_boot_base_20200322.sql, filepath=D:/workspace_devloper/baseproject/base/src/main/resources/backup/]','猿来入此'),(182,'2020-03-22 17:15:04','2020-03-22 17:15:04','数据库成功备份,备份文件信息:DatabaseBak [filename=db_boot_base_20200322171504.sql, filepath=D:/workspace_devloper/baseproject/base/src/main/resources/backup/]','猿来入此'),(183,'2020-03-22 17:15:14','2020-03-22 17:15:14','数据库成功备份,备份文件信息:DatabaseBak [filename=db_boot_base_20200322171514.sql, filepath=D:/workspace_devloper/baseproject/base/src/main/resources/backup/]','猿来入此'),(184,'2020-03-22 17:21:02','2020-03-22 17:21:02','用户【猿来入此】于【2020-03-22 17:21:02】登录系统!','猿来入此'),(185,'2020-03-22 17:21:15','2020-03-22 17:21:15','添加角色【dsadsasadsa】','猿来入此'),(186,'2020-03-22 18:09:55','2020-03-22 18:09:55','数据库成功备份,备份文件信息:DatabaseBak [filename=db_boot_base_20200322180955.sql, filepath=D:/workspace_devloper/baseproject/base/src/main/resources/backup/]','猿来入此'),(187,'2020-03-22 18:59:16','2020-03-22 18:59:16','数据库成功备份,备份文件信息:DatabaseBak [filename=db_boot_base_20200322185916.sql, filepath=D:/workspace_devloper/baseproject/base/src/main/resources/backup/]','猿来入此'),(188,'2020-03-22 18:59:41','2020-03-22 18:59:41','数据库成功还原,还原文件信息:DatabaseBak [filename=db_boot_base_20200322180955.sql, filepath=D:/workspace_devloper/baseproject/base/src/main/resources/backup/]','猿来入此'),(189,'2020-03-22 19:12:03','2020-03-22 19:12:03','数据库成功备份,备份文件信息:DatabaseBak [filename=db_boot_base_20200322191203.sql, filepath=D:/workspace_devloper/baseproject/base/src/main/resources/backup/]','猿来入此'),(190,'2020-03-22 19:12:59','2020-03-22 19:12:59','数据库成功还原,还原文件信息:DatabaseBak [filename=db_boot_base_20200322191203.sql, filepath=D:/workspace_devloper/baseproject/base/src/main/resources/backup/]','猿来入此'),(191,'2020-03-22 19:35:07','2020-03-22 19:35:07','用户【猿来入此】于【2020-03-22 19:35:07】登录系统!','猿来入此'),(192,'2020-03-22 19:35:21','2020-03-22 19:35:21','数据库成功备份,备份文件信息:DatabaseBak [filename=db_boot_base_20200322193521.sql, filepath=D:/workspace_devloper/baseproject/base/src/main/resources/backup/]','猿来入此'),(193,'2020-03-22 19:36:20','2020-03-22 19:36:20','添加菜单信息【Menu [name=还原, parent=Menu [name=null, parent=null, url=null, icon=null, sort=0, isButton=false, isShow=true], url=restore(\'/database_bak/restore\'), icon=mdi-database-minus, sort=19, isButton=true, isShow=true]】','猿来入此'),(194,'2020-03-22 19:36:34','2020-03-22 19:36:34','编辑角色【超级管理员】','猿来入此'),(195,'2020-03-22 19:36:47','2020-03-22 19:36:47','数据库成功备份,备份文件信息:DatabaseBak [filename=db_boot_base_20200322193647.sql, filepath=D:/workspace_devloper/baseproject/base/src/main/resources/backup/]','猿来入此'),(196,'2020-03-22 19:37:01','2020-03-22 19:37:01','用户【猿来入此】于【2020-03-22 19:37:01】登录系统!','猿来入此'),(197,'2020-03-22 19:37:06','2020-03-22 19:37:06','数据库成功备份,备份文件信息:DatabaseBak [filename=db_boot_base_20200322193706.sql, filepath=D:/workspace_devloper/baseproject/base/src/main/resources/backup/]','猿来入此');
/*!40000 ALTER TABLE `ylrc_operater_log` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `ylrc_role`
--
DROP TABLE IF EXISTS `ylrc_role`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ylrc_role` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`create_time` datetime NOT NULL,
`update_time` datetime NOT NULL,
`name` varchar(18) NOT NULL,
`remark` varchar(128) DEFAULT NULL,
`status` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `ylrc_role`
--
LOCK TABLES `ylrc_role` WRITE;
/*!40000 ALTER TABLE `ylrc_role` DISABLE KEYS */;
INSERT INTO `ylrc_role` VALUES (1,'2020-03-15 13:16:38','2020-03-22 19:36:34','超级管理员','超级管理员拥有最高权限。',1),(2,'2020-03-15 13:18:57','2020-03-21 22:18:43','普通管理员','普通管理员只有部分权限',1),(4,'2020-03-21 20:11:00','2020-03-21 22:20:57','测试角色','sadsa',1),(7,'2020-03-22 17:21:15','2020-03-22 17:21:15','dsadsasadsa','',1);
/*!40000 ALTER TABLE `ylrc_role` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `ylrc_role_authorities`
--
DROP TABLE IF EXISTS `ylrc_role_authorities`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ylrc_role_authorities` (
`role_id` bigint(20) NOT NULL,
`authorities_id` bigint(20) NOT NULL,
KEY `<KEY>` (`authorities_id`),
KEY `FK<KEY>` (`role_id`),
CONSTRAINT `FKg3xdaexmr0x1qx8omhvjtk46d` FOREIGN KEY (`role_id`) REFERENCES `ylrc_role` (`id`),
CONSTRAINT `FKhj7ap1o1cjrl7enr9arf5f2qp` FOREIGN KEY (`authorities_id`) REFERENCES `ylrc_menu` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `ylrc_role_authorities`
--
LOCK TABLES `ylrc_role_authorities` WRITE;
/*!40000 ALTER TABLE `ylrc_role_authorities` DISABLE KEYS */;
INSERT INTO `ylrc_role_authorities` VALUES (2,2),(2,3),(2,5),(2,7),(2,11),(2,13),(2,16),(4,2),(4,13),(4,15),(7,2),(7,3),(7,5),(7,8),(7,9),(1,2),(1,3),(1,5),(1,8),(1,9),(1,7),(1,10),(1,11),(1,12),(1,13),(1,14),(1,15),(1,16),(1,19),(1,20),(1,21),(1,22),(1,23),(1,24),(1,25),(1,26);
/*!40000 ALTER TABLE `ylrc_role_authorities` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `ylrc_user`
--
DROP TABLE IF EXISTS `ylrc_user`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ylrc_user` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`create_time` datetime NOT NULL,
`update_time` datetime NOT NULL,
`email` varchar(32) DEFAULT NULL,
`head_pic` varchar(128) DEFAULT NULL,
`mobile` varchar(12) DEFAULT NULL,
`password` varchar(32) NOT NULL,
`sex` int(11) DEFAULT NULL,
`status` int(11) DEFAULT NULL,
`username` varchar(18) NOT NULL,
`role_id` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `UK_btsosjytrl4hu7fnm1intcpo8` (`username`),
KEY `FKg09b8o67eu61st68rv6nk8npj` (`role_id`),
CONSTRAINT `FKg09b8o67eu61st68rv6nk8npj` FOREIGN KEY (`role_id`) REFERENCES `ylrc_role` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `ylrc_user`
--
LOCK TABLES `ylrc_user` WRITE;
/*!40000 ALTER TABLE `ylrc_user` DISABLE KEYS */;
INSERT INTO `ylrc_user` VALUES (1,'2020-03-18 19:18:53','2020-03-22 12:43:54','<EMAIL>','20200322/1584850135123.jpg','13356565656','123456',1,1,'猿来入此',1),(2,'2020-03-18 19:20:36','2020-03-21 22:18:55','<EMAIL>','20200318/1584530412075.jpg','13918655656','123456',1,1,'测试账号',2),(4,'2020-03-20 20:35:21','2020-03-22 11:28:56','dsadsa','20200322/1584847734134.jpg','dsadsa','aaaa',1,1,'aaaa',4),(5,'2020-03-20 20:42:19','2020-03-22 12:01:59','','20200322/1584849717074.jpg','','dsadsa',1,1,'sadsasa',1);
/*!40000 ALTER TABLE `ylrc_user` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2020-03-22 19:37:06
|
<gh_stars>10-100
BEGIN;
DROP TABLE IF EXISTS data;
COMMIT;
|
<gh_stars>1-10
create database querydsl;
create database querydsl2;
create user querydsl with password '<PASSWORD>';
grant all privileges on database querydsl to querydsl;
grant all privileges on database querydsl2 to querydsl;
|
SHOW server_version;
--
-- create partitioned ao table
--
CREATE TABLE p_ao_table (id integer, name text) WITH (appendonly=true) DISTRIBUTED BY (id) PARTITION BY RANGE(id) (START(1) END(3) EVERY(1));
INSERT INTO p_ao_table VALUES (1, 'Jane');
INSERT INTO p_ao_table VALUES (2, 'John');
--
-- create partitioned ao table with multiple segfiles
--
CREATE TABLE p_ao_table_with_multiple_segfiles (id int, name text) WITH (appendonly=true) DISTRIBUTED BY (id)
PARTITION BY RANGE (id)
SUBPARTITION BY LIST (name)
SUBPARTITION TEMPLATE (
SUBPARTITION jane VALUES ('Jane'),
SUBPARTITION john VALUES ('John'),
DEFAULT SUBPARTITION other_names )
(START (1) END (2) EVERY (1),
DEFAULT PARTITION other_ids);
-- use multiple sessions to create multiple segfiles
1:CREATE INDEX p_ao_name_index ON p_ao_table_with_multiple_segfiles(name);
1:BEGIN;
1:INSERT INTO p_ao_table_with_multiple_segfiles VALUES (1, 'Jane');
1:INSERT INTO p_ao_table_with_multiple_segfiles VALUES (2, 'Jane');
2:BEGIN;
2:INSERT INTO p_ao_table_with_multiple_segfiles VALUES (1, 'Jane');
2:INSERT INTO p_ao_table_with_multiple_segfiles VALUES (2, 'Jane');
2:INSERT INTO p_ao_table_with_multiple_segfiles VALUES (4, 'Andy');
1:END;
2:END;
-- ensure that we can correctly upgrade tables with dropped or deleted tuples
UPDATE p_ao_table_with_multiple_segfiles SET name='Carolyn' WHERE name='Andy';
INSERT INTO p_ao_table_with_multiple_segfiles VALUES (5, 'Bob');
DELETE FROM p_ao_table_with_multiple_segfiles WHERE id=5;
-- current customer workaround to upgrade tables with indexes is to drop and recreate.
DROP INDEX p_ao_name_index;
DROP INDEX p_ao_name_index_1_prt_2;
DROP INDEX p_ao_name_index_1_prt_other_ids;
DROP INDEX p_ao_name_index_1_prt_2_2_prt_jane;
DROP INDEX p_ao_name_index_1_prt_2_2_prt_john;
DROP INDEX p_ao_name_index_1_prt_2_2_prt_other_names;
DROP INDEX p_ao_name_index_1_prt_other_ids_2_prt_jane;
DROP INDEX p_ao_name_index_1_prt_other_ids_2_prt_john;
DROP INDEX p_ao_name_index_1_prt_other_ids_2_prt_other_names;
|
<reponame>guofengrichard/gpdb
-- @gucs gp_create_table_random_default_distribution=off
set time zone PST8PDT;
select * from public.ao_table1 order by 1;
select count(*) from heap_table3;
select count(*) from mixed_part01;
|
CREATE TABLE heap_gist (id INTEGER,property BOX,filler VARCHAR DEFAULT 'This is here just to take up space so that we use more pages of data and sequential scans take a lot more time. Located on the Eastern coast of Japan, the six nuclear power reactors at Daiichi are boiling water reactors. A massive earthquake on 11 March disabled off-site power to the plant and triggered the automatic shutdown of the three operating reactors') DISTRIBUTED BY (id);
INSERT INTO heap_gist (id, property) VALUES (1, '( (0,0), (1,1) )');
INSERT INTO heap_gist (id, property) VALUES (2, '( (0,0), (2,2) )');
INSERT INTO heap_gist (id, property) VALUES (3, '( (0,0), (3,3) )');
INSERT INTO heap_gist (id, property) VALUES (4, '( (0,0), (4,4) )');
INSERT INTO heap_gist (id,property) select id+2, property from heap_gist;
INSERT INTO heap_gist (id,property) select id+2, property from heap_gist;
CREATE INDEX heap_idx5 ON heap_gist USING GiST (property);
|
insert into habit (name,code) values
('Aquatic','AQU'),
('Cactus','CAC'),
('Climber, Deciduous','CLI_D'),
('Climber, Evergreen','CLI_E'),
('Epiphyte','EPI'),
('Fern','FER'),
('Grass','GRASS'),
('Ground Cover, Deciduous','GCV_D'),
('Ground Cover, Evergreen (broadleaved)','GCV_E'),
('Ground Cover, Coniferous','GCV_C'),
('Habit unknown (not found)','UNK'),
('Hemiparasite','HEM'),
('Herbaceous, Withering','HER_D'),
('Herbaceous, Evergreen','HER_E'),
('Herbaceous, Annual','HER_A'),
('Herbaceous, Biennial','HER_B'),
('Herbaceous, Perennial','HER_P'),
('Herbaceous, Monocarpic Perennial','HER_M'),
('Liana','LIA'),
('Palm','PAL'),
('Parasite','PAR'),
('Saprophyte','SAP'),
('Shrub, Deciduous','SHR_D'),
('Shrub, Evergreen (broadleaved)','SHR_E'),
('Shrub, Coniferous','SHR_C'),
('Shrub,leafless','S_LFL'),
('Shrub or Tree, Deciduous','S/T_D'),
('Shrub or Tree, Evergreen','S/T_E'),
('Shrub or Tree, Coniferous','S/T_C'),
('Shrub or Tree','S/T'),
('Subshrub','SUB_S'),
('Tree, Deciduous','TRE_D'),
('Tree, Evergreen (broadleaved)','TRE_E'),
('Tree, Coniferous','TRE_C'),
('Tree, Conifer Deciduous','TR_CD'),
('Vine','VIN'),
('Wetland Plant','WET');
|
-- @testpoint:opengauss关键字unlock(非保留),作为角色名
--关键字不带引号-成功
drop role if exists unlock;
create role unlock with password '<PASSWORD>' valid until '2020-12-31';
drop role unlock;
--关键字带双引号-成功
drop role if exists "unlock";
create role "unlock" with password '<PASSWORD>' valid until '2020-12-31';
drop role "unlock";
--关键字带单引号-合理报错
drop role if exists 'unlock';
create role 'unlock' with password '<PASSWORD>' valid until '2020-12-31';
--关键字带反引号-合理报错
drop role if exists `unlock`;
create role `unlock` with password '<PASSWORD>' valid until '2020-12-31';
|
TRUNCATE `ecommerce`.`langues`;
TRUNCATE `ecommerce`.`editeurs`;
TRUNCATE `ecommerce`.`roles_auteurs`;
INSERT INTO `langues` (`id_langue`, `nom_langue`) VALUES (NULL, 'français'), (NULL, 'anglais');
INSERT INTO `editeurs` (`id_editeur`, `nom_editeur`) VALUES (NULL, 'POCKET'), (NULL, '<NAME>'), (NULL, 'Le Livre de Poche'), (NULL, 'Gallimard'), (NULL, 'Les Editions Persée');
INSERT INTO `roles_auteurs` (`id_role`, `role`) VALUES (NULL, 'auteur'), (NULL, 'traducteur'); |
<reponame>todorkrastev/softuni-software-engineering
USE `sss`;
INSERT INTO `products_stores`(`product_id`, `store_id`)
SELECT p.`id`, 1 FROM `products` AS p
WHERE p.`id` NOT IN (SELECT `product_id` FROM `products_stores` AS ps); |
USE [DEPQ]
GO
/****** Object: StoredProcedure [dbo].[spGetMin] Script Date: 1/9/2018 12:29:25 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE procedure [dbo].[spGetMin]
as
with cte as (
select top(1) id, priorityLevel, content
from Dequeue with (rowlock, readpast)
where priorityLevel = (select min(priorityLevel) from Dequeue)
order by id)
insert into History (id, priorityLevel, content, operation)
select id, priorityLevel, content, 'Peek' from cte;
with cte as (
select top(1) id, priorityLevel, content
from Dequeue with (rowlock, readpast)
where priorityLevel = (select min(priorityLevel) from Dequeue)
order by id)
select priorityLevel, content
from cte
GO
|
<reponame>sankichi92/ridgepole
DROP TABLE IF EXISTS list_partitions_p0;
DROP TABLE IF EXISTS list_partitions_p1;
DROP TABLE IF EXISTS list_partitions;
DROP TABLE IF EXISTS range_partitions_p0;
DROP TABLE IF EXISTS range_partitions_p1;
DROP TABLE IF EXISTS range_partitions;
CREATE TABLE list_partitions (id integer not null, logdate date not null) PARTITION BY LIST (id);
CREATE TABLE list_partitions_p0 PARTITION OF list_partitions FOR VALUES IN(1);
CREATE TABLE list_partitions_p1 PARTITION OF list_partitions FOR VALUES IN(2,3);
CREATE TABLE range_partitions (id integer not null, logdate date not null) PARTITION BY RANGE (logdate);
CREATE TABLE range_partitions_p0 PARTITION OF range_partitions FOR VALUES FROM (MINVALUE) TO ('2021-01-01');
CREATE TABLE range_partitions_p1 PARTITION OF range_partitions FOR VALUES FROM ('2021-01-01') TO ('2022-01-01');
|
-- phpMyAdmin SQL Dump
-- version 4.8.2
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Oct 15, 2018 at 08:09 AM
-- Server version: 10.1.28-MariaDB
-- PHP Version: 5.6.37
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `influencer_hub`
--
-- --------------------------------------------------------
--
-- Table structure for table `error_log`
--
CREATE TABLE `error_log` (
`id` int(10) UNSIGNED NOT NULL,
`message` text COLLATE utf8_unicode_ci NOT NULL,
`counter` int(11) NOT NULL DEFAULT '0',
`is_sent` tinyint(1) NOT NULL DEFAULT '0',
`environment` varchar(10) COLLATE utf8_unicode_ci NOT NULL,
`route_name` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
`route_action` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`request_uri` varchar(500) COLLATE utf8_unicode_ci NOT NULL,
`request_method` varchar(10) COLLATE utf8_unicode_ci NOT NULL,
`response_code` varchar(3) COLLATE utf8_unicode_ci NOT NULL,
`request_input` text COLLATE utf8_unicode_ci NOT NULL,
`auth_user` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`sent_at` timestamp NULL DEFAULT NULL,
`stacktrace` text COLLATE utf8_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data for table `error_log`
--
--
-- Indexes for table `error_log`
--
ALTER TABLE `error_log`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `error_log`
--
ALTER TABLE `error_log`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
<filename>sql/yjbb/600143.sql
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600143',@CutoffDate = N'2017-09-30',@EPS = N'0.1685',@EPSDeduct = N'0',@Revenue = N'165.86亿',@RevenueYoy = N'33.00',@RevenueQoq = N'-2.54',@Profit = N'4.58亿',@ProfitYoy = N'-25.76',@ProfiltQoq = N'94.33',@NAVPerUnit = N'3.6207',@ROE = N'4.68',@CashPerUnit = N'-0.3158',@GrossProfitRate = N'13.55',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2017-10-31'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600143',@CutoffDate = N'2017-09-30',@EPS = N'0.1685',@EPSDeduct = N'0',@Revenue = N'165.86亿',@RevenueYoy = N'33.00',@RevenueQoq = N'-2.54',@Profit = N'4.58亿',@ProfitYoy = N'-25.76',@ProfiltQoq = N'94.33',@NAVPerUnit = N'3.6207',@ROE = N'4.68',@CashPerUnit = N'-0.3158',@GrossProfitRate = N'13.55',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2017-10-31'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600143',@CutoffDate = N'2017-03-31',@EPS = N'0.0468',@EPSDeduct = N'0',@Revenue = N'53.89亿',@RevenueYoy = N'44.50',@RevenueQoq = N'-2.38',@Profit = N'1.27亿',@ProfitYoy = N'-48.92',@ProfiltQoq = N'5.42',@NAVPerUnit = N'3.6009',@ROE = N'1.31',@CashPerUnit = N'-0.4214',@GrossProfitRate = N'13.07',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2017-04-25'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600143',@CutoffDate = N'2016-12-31',@EPS = N'0.288',@EPSDeduct = N'0.2262',@Revenue = N'179.91亿',@RevenueYoy = N'14.72',@RevenueQoq = N'21.73',@Profit = N'7.37亿',@ProfitYoy = N'3.59',@ProfiltQoq = N'-27.23',@NAVPerUnit = N'3.5524',@ROE = N'8.62',@CashPerUnit = N'0.2875',@GrossProfitRate = N'17.41',@Distribution = N'10派1',@DividenRate = N'1.85',@AnnounceDate = N'2017-04-25'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600143',@CutoffDate = N'2017-06-30',@EPS = N'0.0881',@EPSDeduct = N'0.0502',@Revenue = N'110.60亿',@RevenueYoy = N'39.36',@RevenueQoq = N'5.22',@Profit = N'2.39亿',@ProfitYoy = N'-46.90',@ProfiltQoq = N'-11.62',@NAVPerUnit = N'3.5431',@ROE = N'2.45',@CashPerUnit = N'-0.5132',@GrossProfitRate = N'12.73',@Distribution = N'不分配不转增',@DividenRate = N'-',@AnnounceDate = N'2017-08-29'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600143',@CutoffDate = N'2016-09-30',@EPS = N'0.2409',@EPSDeduct = N'0',@Revenue = N'124.71亿',@RevenueYoy = N'8.54',@RevenueQoq = N'7.80',@Profit = N'6.17亿',@ProfitYoy = N'13.31',@ProfiltQoq = N'-18.03',@NAVPerUnit = N'3.3992',@ROE = N'7.21',@CashPerUnit = N'0.4194',@GrossProfitRate = N'17.89',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2017-10-31'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600143',@CutoffDate = N'2015-12-31',@EPS = N'0.28',@EPSDeduct = N'0.2108',@Revenue = N'156.82亿',@RevenueYoy = N'-2.56',@RevenueQoq = N'9.08',@Profit = N'7.12亿',@ProfitYoy = N'42.81',@ProfiltQoq = N'37.47',@NAVPerUnit = N'3.2538',@ROE = N'8.77',@CashPerUnit = N'0.5937',@GrossProfitRate = N'16.49',@Distribution = N'10派1',@DividenRate = N'1.61',@AnnounceDate = N'2017-04-25'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600143',@CutoffDate = N'2015-09-30',@EPS = N'0.2126',@EPSDeduct = N'0',@Revenue = N'114.89亿',@RevenueYoy = N'-1.28',@RevenueQoq = N'-6.86',@Profit = N'5.44亿',@ProfitYoy = N'19.19',@ProfiltQoq = N'-42.57',@NAVPerUnit = N'3.2335',@ROE = N'6.66',@CashPerUnit = N'0.2880',@GrossProfitRate = N'16.22',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2016-10-19'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600143',@CutoffDate = N'2015-06-30',@EPS = N'0.165',@EPSDeduct = N'0.1434',@Revenue = N'76.46亿',@RevenueYoy = N'2.05',@RevenueQoq = N'17.28',@Profit = N'4.22亿',@ProfitYoy = N'34.17',@ProfiltQoq = N'0.85',@NAVPerUnit = N'3.1912',@ROE = N'5.15',@CashPerUnit = N'0.2212',@GrossProfitRate = N'16.56',@Distribution = N'不分配不转增',@DividenRate = N'-',@AnnounceDate = N'2016-08-16'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600143',@CutoffDate = N'2015-03-31',@EPS = N'0.0822',@EPSDeduct = N'0',@Revenue = N'35.19亿',@RevenueYoy = N'5.44',@RevenueQoq = N'-21.01',@Profit = N'2.10亿',@ProfitYoy = N'37.90',@ProfiltQoq = N'403.92',@NAVPerUnit = N'3.2054',@ROE = N'2.60',@CashPerUnit = N'0.0523',@GrossProfitRate = N'17.87',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2016-04-26'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600143',@CutoffDate = N'2014-12-31',@EPS = N'0.19',@EPSDeduct = N'0.1601',@Revenue = N'160.94亿',@RevenueYoy = N'11.56',@RevenueQoq = N'7.45',@Profit = N'4.98亿',@ProfitYoy = N'-33.99',@ProfiltQoq = N'-70.56',@NAVPerUnit = N'3.1197',@ROE = N'6.34',@CashPerUnit = N'0.3922',@GrossProfitRate = N'14.34',@Distribution = N'10派1',@DividenRate = N'0.73',@AnnounceDate = N'2016-04-26'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600143',@CutoffDate = N'2016-06-30',@EPS = N'0.1762',@EPSDeduct = N'0.1514',@Revenue = N'79.36亿',@RevenueYoy = N'3.79',@RevenueQoq = N'12.79',@Profit = N'4.51亿',@ProfitYoy = N'6.76',@ProfiltQoq = N'-18.77',@NAVPerUnit = N'3.3311',@ROE = N'5.27',@CashPerUnit = N'0.2694',@GrossProfitRate = N'18.24',@Distribution = N'不分配不转增',@DividenRate = N'-',@AnnounceDate = N'2017-08-29'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600143',@CutoffDate = N'2016-03-31',@EPS = N'0.0972',@EPSDeduct = N'0',@Revenue = N'37.29亿',@RevenueYoy = N'5.98',@RevenueQoq = N'-11.05',@Profit = N'2.49亿',@ProfitYoy = N'18.32',@ProfiltQoq = N'48.60',@NAVPerUnit = N'3.3508',@ROE = N'2.94',@CashPerUnit = N'0.1057',@GrossProfitRate = N'19.05',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2017-04-25'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600143',@CutoffDate = N'2014-03-31',@EPS = N'0.06',@EPSDeduct = N'0',@Revenue = N'33.37亿',@RevenueYoy = N'10.51',@RevenueQoq = N'-16.24',@Profit = N'1.53亿',@ProfitYoy = N'-23.76',@ProfiltQoq = N'11.26',@NAVPerUnit = N'3.0791',@ROE = N'1.95',@CashPerUnit = N'-0.0214',@GrossProfitRate = N'14.72',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2015-04-21'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600143',@CutoffDate = N'2013-12-31',@EPS = N'0.29',@EPSDeduct = N'0.23',@Revenue = N'144.26亿',@RevenueYoy = N'17.86',@RevenueQoq = N'6.08',@Profit = N'7.55亿',@ProfitYoy = N'-2.82',@ProfiltQoq = N'-31.70',@NAVPerUnit = N'2.9624',@ROE = N'9.51',@CashPerUnit = N'0.2441',@GrossProfitRate = N'15.00',@Distribution = N'10派1',@DividenRate = N'2.33',@AnnounceDate = N'2015-04-21'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600143',@CutoffDate = N'2014-06-30',@EPS = N'0.12',@EPSDeduct = N'0.1',@Revenue = N'74.92亿',@RevenueYoy = N'12.08',@RevenueQoq = N'24.49',@Profit = N'3.15亿',@ProfitYoy = N'-24.53',@ProfiltQoq = N'6.43',@NAVPerUnit = N'3.0485',@ROE = N'3.98',@CashPerUnit = N'0.1965',@GrossProfitRate = N'14.64',@Distribution = N'不分配不转增',@DividenRate = N'-',@AnnounceDate = N'2015-08-11'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600143',@CutoffDate = N'2013-03-31',@EPS = N'0.08',@EPSDeduct = N'0.06',@Revenue = N'30.20亿',@RevenueYoy = N'10.34',@RevenueQoq = N'-10.58',@Profit = N'2.00亿',@ProfitYoy = N'31.72',@ProfiltQoq = N'18.62',@NAVPerUnit = N'3.0564',@ROE = N'2.52',@CashPerUnit = N'0.0176',@GrossProfitRate = N'16.56',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2014-04-29'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600143',@CutoffDate = N'2012-12-31',@EPS = N'0.3',@EPSDeduct = N'0.25',@Revenue = N'122.40亿',@RevenueYoy = N'6.00',@RevenueQoq = N'19.48',@Profit = N'7.77亿',@ProfitYoy = N'-18.58',@ProfiltQoq = N'-19.88',@NAVPerUnit = N'2.9699',@ROE = N'10.85',@CashPerUnit = N'0.0760',@GrossProfitRate = N'17.75',@Distribution = N'10派2',@DividenRate = N'4.08',@AnnounceDate = N'2014-04-29'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600143',@CutoffDate = N'2012-09-30',@EPS = N'0.24',@EPSDeduct = N'0.21',@Revenue = N'88.63亿',@RevenueYoy = N'1.15',@RevenueQoq = N'-14.31',@Profit = N'6.08亿',@ProfitYoy = N'-25.07',@ProfiltQoq = N'-14.37',@NAVPerUnit = N'2.9206',@ROE = N'8.69',@CashPerUnit = N'0.0677',@GrossProfitRate = N'18.11',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2013-10-25'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600143',@CutoffDate = N'2012-06-30',@EPS = N'0.16',@EPSDeduct = N'0.14',@Revenue = N'60.36亿',@RevenueYoy = N'2.51',@RevenueQoq = N'20.52',@Profit = N'3.98亿',@ProfitYoy = N'-29.90',@ProfiltQoq = N'61.87',@NAVPerUnit = N'2.8247',@ROE = N'5.93',@CashPerUnit = N'-0.0528',@GrossProfitRate = N'17.48',@Distribution = N'不分配不转增',@DividenRate = N'-',@AnnounceDate = N'2013-08-06'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600143',@CutoffDate = N'2013-06-30',@EPS = N'0.16',@EPSDeduct = N'0.13',@Revenue = N'66.85亿',@RevenueYoy = N'10.75',@RevenueQoq = N'21.35',@Profit = N'4.17亿',@ProfitYoy = N'4.89',@ProfiltQoq = N'8.54',@NAVPerUnit = N'2.9495',@ROE = N'5.18',@CashPerUnit = N'0.0651',@GrossProfitRate = N'15.47',@Distribution = N'不分配不转增',@DividenRate = N'-',@AnnounceDate = N'2014-08-26'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600143',@CutoffDate = N'2012-03-31',@EPS = N'0.06',@EPSDeduct = N'0.09',@Revenue = N'27.37亿',@RevenueYoy = N'2.44',@RevenueQoq = N'-1.72',@Profit = N'1.52亿',@ProfitYoy = N'-52.62',@ProfiltQoq = N'5.81',@NAVPerUnit = N'4.6448',@ROE = N'2.59',@CashPerUnit = N'0.1266',@GrossProfitRate = N'16.39',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2013-04-23'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600143',@CutoffDate = N'2011-12-31',@EPS = N'0.43',@EPSDeduct = N'0.3',@Revenue = N'115.47亿',@RevenueYoy = N'12.74',@RevenueQoq = N'-3.09',@Profit = N'9.54亿',@ProfitYoy = N'65.18',@ProfiltQoq = N'-41.26',@NAVPerUnit = N'3.2397',@ROE = N'23.67',@CashPerUnit = N'0.3458',@GrossProfitRate = N'18.66',@Distribution = N'10转3送3派3',@DividenRate = N'5.24',@AnnounceDate = N'2013-04-23'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600143',@CutoffDate = N'2011-09-30',@EPS = N'0.36',@EPSDeduct = N'0.4',@Revenue = N'87.62亿',@RevenueYoy = N'19.67',@RevenueQoq = N'-10.65',@Profit = N'8.12亿',@ProfitYoy = N'92.78',@ProfiltQoq = N'28.20',@NAVPerUnit = N'3.0700',@ROE = N'21.24',@CashPerUnit = N'0.1255',@GrossProfitRate = N'18.50',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2012-10-31'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600143',@CutoffDate = N'2011-06-30',@EPS = N'0.25',@EPSDeduct = N'0.24',@Revenue = N'58.88亿',@RevenueYoy = N'25.71',@RevenueQoq = N'20.37',@Profit = N'5.67亿',@ProfitYoy = N'192.59',@ProfiltQoq = N'-49.40',@NAVPerUnit = N'2.8500',@ROE = N'15.32',@CashPerUnit = N'0.2791',@GrossProfitRate = N'17.78',@Distribution = N'不分配不转增',@DividenRate = N'-',@AnnounceDate = N'2012-08-29'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600143',@CutoffDate = N'2011-03-31',@EPS = N'0.23',@EPSDeduct = N'0.12',@Revenue = N'26.72亿',@RevenueYoy = N'31.83',@RevenueQoq = N'-8.51',@Profit = N'3.21亿',@ProfitYoy = N'502.48',@ProfiltQoq = N'139.53',@NAVPerUnit = N'2.6200',@ROE = N'10.44',@CashPerUnit = N'-0.0266',@GrossProfitRate = N'15.89',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2012-04-28'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600143',@CutoffDate = N'2010-12-31',@EPS = N'0.41',@EPSDeduct = N'0.18',@Revenue = N'102.42亿',@RevenueYoy = N'44.01',@RevenueQoq = N'10.74',@Profit = N'5.78亿',@ProfitYoy = N'102.10',@ProfiltQoq = N'-30.76',@NAVPerUnit = N'2.4477',@ROE = N'17.48',@CashPerUnit = N'0.4114',@GrossProfitRate = N'14.85',@Distribution = N'10派1',@DividenRate = N'0.61',@AnnounceDate = N'2012-04-28'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600143',@CutoffDate = N'2010-09-30',@EPS = N'0.3',@EPSDeduct = N'0.25',@Revenue = N'73.22亿',@RevenueYoy = N'53.43',@RevenueQoq = N'-0.74',@Profit = N'4.21亿',@ProfitYoy = N'92.95',@ProfiltQoq = N'72.90',@NAVPerUnit = N'2.3400',@ROE = N'12.91',@CashPerUnit = N'0.0176',@GrossProfitRate = N'14.33',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2011-10-28'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600143',@CutoffDate = N'2010-06-30',@EPS = N'0.14',@EPSDeduct = N'0.11',@Revenue = N'46.84亿',@RevenueYoy = N'67.90',@RevenueQoq = N'31.10',@Profit = N'1.94亿',@ProfitYoy = N'45.81',@ProfiltQoq = N'110.10',@NAVPerUnit = N'2.1800',@ROE = N'6.28',@CashPerUnit = N'-0.0835',@GrossProfitRate = N'13.11',@Distribution = N'不分配不转增',@DividenRate = N'-',@AnnounceDate = N'2011-07-19'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600143',@CutoffDate = N'2010-03-31',@EPS = N'0.04',@EPSDeduct = N'0.04',@Revenue = N'20.27亿',@RevenueYoy = N'81.77',@RevenueQoq = N'-13.40',@Profit = N'6252.43万',@ProfitYoy = N'8.87',@ProfiltQoq = N'-7.97',@NAVPerUnit = N'2.1800',@ROE = N'2.07',@CashPerUnit = N'0.1568',@GrossProfitRate = N'12.46',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2011-04-26'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600143',@CutoffDate = N'2009-12-31',@EPS = N'0.2',@EPSDeduct = N'0.19',@Revenue = N'71.12亿',@RevenueYoy = N'-0.78',@RevenueQoq = N'18.08',@Profit = N'2.86亿',@ProfitYoy = N'-3.24',@ProfiltQoq = N'-20.28',@NAVPerUnit = N'2.1400',@ROE = N'9.82',@CashPerUnit = N'0.2632',@GrossProfitRate = N'15.67',@Distribution = N'10派1',@DividenRate = N'1.18',@AnnounceDate = N'2011-03-01'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600143',@CutoffDate = N'2009-09-30',@EPS = N'0.16',@EPSDeduct = N'0.15',@Revenue = N'47.72亿',@RevenueYoy = N'-19.12',@RevenueQoq = N'18.35',@Profit = N'2.18亿',@ProfitYoy = N'-42.18',@ProfiltQoq = N'12.81',@NAVPerUnit = N'2.0900',@ROE = N'-',@CashPerUnit = N'0.2944',@GrossProfitRate = N'13.32',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2010-10-30'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600143',@CutoffDate = N'2009-06-30',@EPS = N'0.1',@EPSDeduct = N'0.09',@Revenue = N'27.90亿',@RevenueYoy = N'-24.18',@RevenueQoq = N'50.20',@Profit = N'1.33亿',@ProfitYoy = N'-40.89',@ProfiltQoq = N'31.55',@NAVPerUnit = N'2.0300',@ROE = N'4.57',@CashPerUnit = N'0.3539',@GrossProfitRate = N'13.41',@Distribution = N'不分配不转增',@DividenRate = N'-',@AnnounceDate = N'2010-08-19'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600143',@CutoffDate = N'2009-03-31',@EPS = N'0.04',@EPSDeduct = N'0.04',@Revenue = N'11.15亿',@RevenueYoy = N'-24.75',@RevenueQoq = N'-12.08',@Profit = N'5743.00万',@ProfitYoy = N'-34.88',@ProfiltQoq = N'170.33',@NAVPerUnit = N'2.0800',@ROE = N'-',@CashPerUnit = N'0.1200',@GrossProfitRate = N'15.21',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2010-04-28'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600143',@CutoffDate = N'2008-12-31',@EPS = N'0.21',@EPSDeduct = N'0.14',@Revenue = N'71.68亿',@RevenueYoy = N'11.60',@RevenueQoq = N'-42.87',@Profit = N'2.96亿',@ProfitYoy = N'-25.42',@ProfiltQoq = N'-155.99',@NAVPerUnit = N'2.0400',@ROE = N'8.28',@CashPerUnit = N'-0.0784',@GrossProfitRate = N'13.73',@Distribution = N'10派1',@DividenRate = N'1.07',@AnnounceDate = N'2010-04-28'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600143',@CutoffDate = N'2008-09-30',@EPS = N'0.28',@EPSDeduct = N'0.26',@Revenue = N'59.00亿',@RevenueYoy = N'31.05',@RevenueQoq = N'1.02',@Profit = N'3.77亿',@ProfitYoy = N'51.36',@ProfiltQoq = N'6.65',@NAVPerUnit = N'2.1700',@ROE = N'-',@CashPerUnit = N'-0.0050',@GrossProfitRate = N'14.47',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2009-10-23'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600143',@CutoffDate = N'2008-06-30',@EPS = N'0.16',@EPSDeduct = N'0.3',@Revenue = N'36.80亿',@RevenueYoy = N'31.98',@RevenueQoq = N'48.33',@Profit = N'2.25亿',@ProfitYoy = N'11.21',@ProfiltQoq = N'55.06',@NAVPerUnit = N'4.1000',@ROE = N'8.53',@CashPerUnit = N'0.0200',@GrossProfitRate = N'13.76',@Distribution = N'10转10',@DividenRate = N'-',@AnnounceDate = N'2009-08-19'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600143',@CutoffDate = N'2008-03-31',@EPS = N'0.06',@EPSDeduct = N'0.11',@Revenue = N'14.82亿',@RevenueYoy = N'27.26',@RevenueQoq = N'-22.88',@Profit = N'8819.30万',@ProfitYoy = N'25.84',@ProfiltQoq = N'-40.08',@NAVPerUnit = N'3.9500',@ROE = N'-',@CashPerUnit = N'-0.4721',@GrossProfitRate = N'14.05',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2009-04-29'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600143',@CutoffDate = N'2007-12-31',@EPS = N'0.31',@EPSDeduct = N'0.52',@Revenue = N'64.23亿',@RevenueYoy = N'38.03',@RevenueQoq = N'12.09',@Profit = N'3.97亿',@ProfitYoy = N'56.51',@ProfiltQoq = N'212.79',@NAVPerUnit = N'3.8000',@ROE = N'22.20',@CashPerUnit = N'-1.2882',@GrossProfitRate = N'14.15',@Distribution = N'10派1.9962',@DividenRate = N'0.94',@AnnounceDate = N'2009-04-08'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600143',@CutoffDate = N'2007-09-30',@EPS = N'0.19',@EPSDeduct = N'0.33',@Revenue = N'45.02亿',@RevenueYoy = N'37.88',@RevenueQoq = N'5.57',@Profit = N'2.49亿',@ProfitYoy = N'24.36',@ProfiltQoq = N'-64.40',@NAVPerUnit = N'3.5500',@ROE = N'-',@CashPerUnit = N'-0.7817',@GrossProfitRate = N'13.83',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2008-10-28'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600143',@CutoffDate = N'2007-06-30',@EPS = N'0.32',@EPSDeduct = N'0.28',@Revenue = N'27.88亿',@RevenueYoy = N'37.23',@RevenueQoq = N'39.44',@Profit = N'2.02亿',@ProfitYoy = N'65.13',@ProfiltQoq = N'88.62',@NAVPerUnit = N'2.1400',@ROE = N'15.52',@CashPerUnit = N'0.1691',@GrossProfitRate = N'13.42',@Distribution = N'不分配不转增',@DividenRate = N'-',@AnnounceDate = N'2008-08-20'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600143',@CutoffDate = N'2007-03-31',@EPS = N'0.11',@EPSDeduct = N'0.1',@Revenue = N'11.64亿',@RevenueYoy = N'36.15',@RevenueQoq = N'-16.14',@Profit = N'7008.53万',@ProfitYoy = N'48.26',@ProfiltQoq = N'32.58',@NAVPerUnit = N'1.9200',@ROE = N'5.48',@CashPerUnit = N'0.1002',@GrossProfitRate = N'12.78',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2008-04-29'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600143',@CutoffDate = N'2006-12-31',@EPS = N'0.4',@EPSDeduct = N'0.37',@Revenue = N'46.54亿',@RevenueYoy = N'34.70',@RevenueQoq = N'12.55',@Profit = N'2.53亿',@ProfitYoy = N'54.93',@ProfiltQoq = N'-32.22',@NAVPerUnit = N'3.9000',@ROE = N'28.08',@CashPerUnit = N'0.7635',@GrossProfitRate = N'12.43',@Distribution = N'10转8送2派3',@DividenRate = N'0.90',@AnnounceDate = N'2008-03-12'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600143',@CutoffDate = N'2006-09-30',@EPS = N'0.31',@EPSDeduct = N'0',@Revenue = N'32.65亿',@RevenueYoy = N'32.22',@RevenueQoq = N'4.85',@Profit = N'2.00亿',@ProfitYoy = N'91.29',@ProfiltQoq = N'3.68',@NAVPerUnit = N'3.6000',@ROE = N'-',@CashPerUnit = N'-0.0846',@GrossProfitRate = N'12.74',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2007-10-20'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600143',@CutoffDate = N'2006-06-30',@EPS = N'0.19',@EPSDeduct = N'0',@Revenue = N'20.32亿',@RevenueYoy = N'31.89',@RevenueQoq = N'37.57',@Profit = N'1.23亿',@ProfitYoy = N'69.26',@ProfiltQoq = N'59.15',@NAVPerUnit = N'3.3100',@ROE = N'12.05',@CashPerUnit = N'-0.1813',@GrossProfitRate = N'12.23',@Distribution = N'不分配不转增',@DividenRate = N'-',@AnnounceDate = N'2007-08-11'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600143',@CutoffDate = N'2006-03-31',@EPS = N'0.0742',@EPSDeduct = N'0',@Revenue = N'8.55亿',@RevenueYoy = N'30.70',@RevenueQoq = N'-13.21',@Profit = N'4727.06万',@ProfitYoy = N'34.19',@ProfiltQoq = N'-19.51',@NAVPerUnit = N'4.3600',@ROE = N'-',@CashPerUnit = N'-0.5265',@GrossProfitRate = N'12.33',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2007-04-24'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600143',@CutoffDate = N'2005-12-31',@EPS = N'0.81',@EPSDeduct = N'0.24',@Revenue = N'34.55亿',@RevenueYoy = N'44.46',@RevenueQoq = N'6.06',@Profit = N'1.64亿',@ProfitYoy = N'56.26',@ProfiltQoq = N'81.06',@NAVPerUnit = N'4.1500',@ROE = N'18.41',@CashPerUnit = N'0.4397',@GrossProfitRate = N'10.35',@Distribution = N'10转4派0.5',@DividenRate = N'0.31',@AnnounceDate = N'2007-02-14'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600143',@CutoffDate = N'2005-09-30',@EPS = N'0',@EPSDeduct = N'0',@Revenue = N'24.69亿',@RevenueYoy = N'52.17',@RevenueQoq = N'4.85',@Profit = N'1.05亿',@ProfitYoy = N'59.33',@ProfiltQoq = N'-12.69',@NAVPerUnit = N'3.8900',@ROE = N'-',@CashPerUnit = N'0.0700',@GrossProfitRate = N'10.29',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2006-10-20'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600143',@CutoffDate = N'2005-06-30',@EPS = N'0.41',@EPSDeduct = N'0',@Revenue = N'15.40亿',@RevenueYoy = N'59.77',@RevenueQoq = N'35.43',@Profit = N'7237.55万',@ProfitYoy = N'72.53',@ProfiltQoq = N'5.45',@NAVPerUnit = N'3.8000',@ROE = N'8.38',@CashPerUnit = N'0.0450',@GrossProfitRate = N'10.93',@Distribution = N'不分配不转增',@DividenRate = N'-',@AnnounceDate = N'2006-07-28'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600143',@CutoffDate = N'2014-09-30',@EPS = N'0.18',@EPSDeduct = N'0',@Revenue = N'116.39亿',@RevenueYoy = N'11.47',@RevenueQoq = N'-0.21',@Profit = N'4.57亿',@ProfitYoy = N'-26.10',@ProfiltQoq = N'-12.66',@NAVPerUnit = N'3.1104',@ROE = N'5.72',@CashPerUnit = N'0.3224',@GrossProfitRate = N'14.48',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2015-10-22'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600143',@CutoffDate = N'2013-09-30',@EPS = N'0.24',@EPSDeduct = N'0',@Revenue = N'104.41亿',@RevenueYoy = N'17.81',@RevenueQoq = N'2.49',@Profit = N'6.18亿',@ProfitYoy = N'1.59',@ProfiltQoq = N'-7.56',@NAVPerUnit = N'3.0139',@ROE = N'7.73',@CashPerUnit = N'0.1112',@GrossProfitRate = N'15.22',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2014-10-28' |
<reponame>polypheny-db/Polypheny-Client<filename>src/main/resources/tpch/population/queries/q6.sql<gh_stars>1-10
-- (Q6) Forecasting Revenue Change Query
-- tables: tpch_lineitem
SELECT
sum(l_extendedprice * l_discount) AS revenue
FROM
tpch_lineitem
WHERE
l_shipdate >= DATE '1994-01-01'
AND l_shipdate < DATE '1994-01-01' + INTERVAL '1' YEAR
AND l_discount BETWEEN decimal '0.06' - decimal '0.01' AND decimal '0.06' + decimal '0.01'
AND l_quantity < 24 |
<filename>lokalutvikling/postgres-init/fpabakus.sql<gh_stars>1-10
CREATE DATABASE fpabakus_unit;
CREATE USER fpabakus_unit WITH PASSWORD '<PASSWORD>';
GRANT ALL PRIVILEGES ON DATABASE fpabakus_unit TO fpabakus_unit;
CREATE DATABASE fpabakus;
CREATE USER fpabakus WITH PASSWORD '<PASSWORD>';
GRANT ALL PRIVILEGES ON DATABASE fpabakus TO fpabakus;
|
<filename>source/types/campaign_history_typ_set.sql
CREATE TYPE campaign_history_typ_set AS TABLE OF campaign_history_typ
/ |
CREATE TABLE [dbo].[ModuleOwnership] (
[Id] INT IDENTITY (1, 1) NOT NULL,
[PersonId] INT NULL,
[GroupId] INT NULL,
[ModuleId] INT NOT NULL,
[OwnedShare] FLOAT (53) DEFAULT ((1)) NOT NULL
CONSTRAINT [PK_ModuleOwnership] PRIMARY KEY CLUSTERED ([Id] ASC),
CONSTRAINT [FK_ModuleOwnership_Group] FOREIGN KEY ([GroupId]) REFERENCES [dbo].[Group] ([Id]),
CONSTRAINT [FK_ModuleOwnership_Module] FOREIGN KEY ([ModuleId]) REFERENCES [dbo].[Module] ([Id]) ON DELETE CASCADE,
CONSTRAINT [FK_ModuleOwnership_Person] FOREIGN KEY ([PersonId]) REFERENCES [dbo].[Person] ([Id])
);
GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'Owning person (if null, an Organisation must own it)', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'ModuleOwnership', @level2type = N'COLUMN', @level2name = N'PersonId';
GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'Owning organisation (if null, a Person must own it)', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'ModuleOwnership', @level2type = N'COLUMN', @level2name = N'GroupId';
GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'The ownerships share as 1/this value.', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'ModuleOwnership', @level2type = N'COLUMN', @level2name = N'OwnedShare';
GO
CREATE NONCLUSTERED INDEX [IX_ModuleOwnership_PersonId]
ON [dbo].[ModuleOwnership]([PersonId] ASC);
GO
CREATE NONCLUSTERED INDEX [IX_ModuleOwnership_ModuleId]
ON [dbo].[ModuleOwnership]([ModuleId] ASC);
GO
CREATE NONCLUSTERED INDEX [IX_ModuleOwnership_GroupId]
ON [dbo].[ModuleOwnership]([GroupId] ASC);
|
// Keyspace
DROP KEYSPACE IF EXISTS busshaming;
CREATE KEYSPACE busshaming
WITH replication = {'class': 'SimpleStrategy', 'replication_factor' : 1};
USE busshaming;
//
DROP TABLE IF EXISTS TransportFeed;
DROP TABLE IF EXISTS Route;
DROP TABLE IF EXISTS Trip;
DROP TABLE IF EXISTS Run;
CREATE TABLE TransportFeed (
feed_uuid uuid,
feed_url text,
city text,
state text,
country text,
PRIMARY KEY (feed_uuid)
);
CREATE TABLE Route (
feed_uuid uuid,
agency_id text,
route_id text,
short_name text,
long_name text,
description text,
route_type int,
color text,
text_color text,
PRIMARY KEY (feed_uuid, route_id)
);
// A trip on the schedule
CREATE TABLE Trip (
trip_uuid uuid,
feed_uuid uuid,
route_id text,
trip_id text,
direction int,
day_of_week int,
trip_headsign text,
start_time text,
PRIMARY KEY ((feed_uuid, route_id), day_of_week, start_time, trip_id),
);
CREATE TABLE Run (
trip_uuid uuid,
year int,
avg_delay int,
std_dev int,
max_delay int,
on_time int,
stop_count int,
early_count int,
late_count int,
very_late_count int,
ridiculous_count int,
start_date date,
stop_times Map<text, time>,
delays Map<text, int>,
PRIMARY KEY ((trip_uuid, year), start_date)
);
|
-- file:hs_standby_allowed.sql ln:45 expect:true
start transaction
|
--liquibase formatted sql
--changeset vrafael:framework_20200229_Generators_06_dboTypeProcedureInline logicalFilePath:path-independent splitStatements:true stripComments:false endDelimiter:\nGO runOnChange:true
SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
GO
--------- framework "RecordSQL" v2 (https://github.com/vrafael/recordsql-database) ---------
--получение исполняемой процедуры по типу
CREATE OR ALTER FUNCTION [dbo].[TypeProcedureInline]
(
@TypeID bigint
,@Operation dbo.string --Set/Get/Find/Del
)
RETURNS TABLE
AS
RETURN
(
SELECT TOP (1)
NULL as ProcedureID --ToDo идентификатор процедуры
,CONCAT(N'[', ss.[name], N'].[', sp.[name], N']') as ProcedureName
,t.ID as OwnerTypeID
FROM dbo.DirectoryOwnersInline(@TypeID, N'Type', 1) t
JOIN dbo.TDirectory dt ON dt.ID = t.ID
JOIN sys.procedures sp ON sp.name = CONCAT(dt.Tag, @Operation) --ToDo переделать на внешние ссылки с CASE = Operation
JOIN sys.schemas ss ON ss.schema_id = sp.schema_id
AND ss.name = N'dbo'
ORDER BY t.Lvl
)
--SELECT * FROM dbo.TypeProcedureInline(3, N'Set') |
<gh_stars>0
# --- Created by Ebean DDL
# To stop Ebean DDL generation, remove this comment and start using Evolutions
# --- !Ups
create table person (
id serial not null,
username varchar(255),
password varchar(255),
constraint pk_person primary key (id)
);
create table restaurant (
id serial not null,
name varchar(255),
location varchar(255),
constraint pk_restaurant primary key (id)
);
create table review (
id serial not null,
text varchar(255),
rating bigint not null,
person_id integer,
restaurant_id integer,
constraint pk_review primary key (id)
);
create table tag (
review_id integer,
text varchar(255)
);
create table vote (
person_id integer,
review_id integer,
created_at timestamptz
);
create index ix_review_person_id on review (person_id);
alter table review add constraint fk_review_person_id foreign key (person_id) references person (id) on delete restrict on update restrict;
create index ix_review_restaurant_id on review (restaurant_id);
alter table review add constraint fk_review_restaurant_id foreign key (restaurant_id) references restaurant (id) on delete restrict on update restrict;
create index ix_tag_review_id on tag (review_id);
alter table tag add constraint fk_tag_review_id foreign key (review_id) references review (id) on delete restrict on update restrict;
create index ix_vote_person_id on vote (person_id);
alter table vote add constraint fk_vote_person_id foreign key (person_id) references person (id) on delete restrict on update restrict;
create index ix_vote_review_id on vote (review_id);
alter table vote add constraint fk_vote_review_id foreign key (review_id) references review (id) on delete restrict on update restrict;
# --- !Downs
alter table if exists review drop constraint if exists fk_review_person_id;
drop index if exists ix_review_person_id;
alter table if exists review drop constraint if exists fk_review_restaurant_id;
drop index if exists ix_review_restaurant_id;
alter table if exists tag drop constraint if exists fk_tag_review_id;
drop index if exists ix_tag_review_id;
alter table if exists vote drop constraint if exists fk_vote_person_id;
drop index if exists ix_vote_person_id;
alter table if exists vote drop constraint if exists fk_vote_review_id;
drop index if exists ix_vote_review_id;
drop table if exists person cascade;
drop table if exists restaurant cascade;
drop table if exists review cascade;
drop table if exists tag cascade;
drop table if exists vote cascade;
|
<filename>impl/videofaces-mysql/schema.sql
CREATE SCHEMA IF NOT EXISTS videofaces;
USE videofaces;
CREATE TABLE IF NOT EXISTS users(
id varchar(50),
email varchar(50),
password_hash text,
name text,
TOKEN text,
visits int,
PRIMARY KEY(id)
);
-- Para búsquedas con email
CREATE INDEX user_email_idx ON users (email);
-- CUIDADO!! AÑADO UN USUARIO PARA PROBAR, PASSWORD: "<PASSWORD>"
INSERT INTO users VALUES ("ddd", "<EMAIL>", "<PASSWORD>", "<PASSWORD>", "TOKEN", 0);
-- Vídeos
CREATE TABLE IF NOT EXISTS videos(
id varchar(50),
userid varchar(50),
date text,
filename text,
process_status int, -- 0: processing, 1: processed
videodata LONGBLOB,
PRIMARY KEY(id),
FOREIGN KEY (userid) REFERENCES users(id)
);
-- Faces
CREATE TABLE IF NOT EXISTS faces(
id varchar(50),
videoid varchar(50),
imagedata BLOB, -- image data restricted to 64kb
PRIMARY KEY(id),
FOREIGN KEY (videoid) REFERENCES videos(id)
);
|
<reponame>smith750/kc
DELIMITER /
INSERT INTO SEQ_SPONSOR_FORMS VALUES(NULL)
/
INSERT INTO SPONSOR_FORMS (SPONSOR_FORM_ID,SPONSOR_CODE,PACKAGE_NUMBER,PACKAGE_NAME,UPDATE_USER,UPDATE_TIMESTAMP,OBJ_ID,VER_NBR)
VALUES ((SELECT (MAX(ID)) FROM SEQ_SPONSOR_FORMS),'009800',2,'Generic Printing Forms (Coeus 4.x)','admin',NOW(),UUID(),1)
/
INSERT INTO SEQ_SPONSOR_FORMS VALUES(NULL)
/
INSERT INTO SPONSOR_FORMS (SPONSOR_FORM_ID,SPONSOR_CODE,PACKAGE_NUMBER,PACKAGE_NAME,UPDATE_USER,UPDATE_TIMESTAMP,OBJ_ID,VER_NBR)
VALUES ((SELECT (MAX(ID)) FROM SEQ_SPONSOR_FORMS),'000340',5,'NIH 398 package (Coeus 4.0)','admin',NOW(),UUID(),1)
/
INSERT INTO SEQ_SPONSOR_FORMS VALUES(NULL)
/
INSERT INTO SPONSOR_FORMS (SPONSOR_FORM_ID,SPONSOR_CODE,PACKAGE_NUMBER,PACKAGE_NAME,UPDATE_USER,UPDATE_TIMESTAMP,OBJ_ID,VER_NBR)
VALUES ((SELECT (MAX(ID)) FROM SEQ_SPONSOR_FORMS),'000340',6,'NIH 2590 package (Coeus 4.0)','admin',NOW(),UUID(),1)
/
INSERT INTO SEQ_SPONSOR_FORMS VALUES(NULL)
/
INSERT INTO SPONSOR_FORMS (SPONSOR_FORM_ID,SPONSOR_CODE,PACKAGE_NUMBER,PACKAGE_NAME,UPDATE_USER,UPDATE_TIMESTAMP,OBJ_ID,VER_NBR)
VALUES ((SELECT (MAX(ID)) FROM SEQ_SPONSOR_FORMS),'000340',1,'NIH 398 package (Coeus 3.8)','admin',NOW(),UUID(),1)
/
INSERT INTO SEQ_SPONSOR_FORMS VALUES(NULL)
/
INSERT INTO SPONSOR_FORMS (SPONSOR_FORM_ID,SPONSOR_CODE,PACKAGE_NUMBER,PACKAGE_NAME,UPDATE_USER,UPDATE_TIMESTAMP,OBJ_ID,VER_NBR)
VALUES ((SELECT (MAX(ID)) FROM SEQ_SPONSOR_FORMS),'009800',1,'Generic Printing Forms','admin',NOW(),UUID(),1)
/
INSERT INTO SEQ_SPONSOR_FORMS VALUES(NULL)
/
INSERT INTO SPONSOR_FORMS (SPONSOR_FORM_ID,SPONSOR_CODE,PACKAGE_NUMBER,PACKAGE_NAME,UPDATE_USER,UPDATE_TIMESTAMP,OBJ_ID,VER_NBR)
VALUES ((SELECT (MAX(ID)) FROM SEQ_SPONSOR_FORMS),'999999',1,'294 Subcontracting Report For Individual Contracts','admin',NOW(),UUID(),1)
/
INSERT INTO SEQ_SPONSOR_FORMS VALUES(NULL)
/
INSERT INTO SPONSOR_FORMS (SPONSOR_FORM_ID,SPONSOR_CODE,PACKAGE_NUMBER,PACKAGE_NAME,UPDATE_USER,UPDATE_TIMESTAMP,OBJ_ID,VER_NBR)
VALUES ((SELECT (MAX(ID)) FROM SEQ_SPONSOR_FORMS),'000500',2,'NSF Forms (Coeus 3.8)','admin',NOW(),UUID(),1)
/
INSERT INTO SEQ_SPONSOR_FORMS VALUES(NULL)
/
INSERT INTO SPONSOR_FORMS (SPONSOR_FORM_ID,SPONSOR_CODE,PACKAGE_NUMBER,PACKAGE_NAME,UPDATE_USER,UPDATE_TIMESTAMP,OBJ_ID,VER_NBR)
VALUES ((SELECT (MAX(ID)) FROM SEQ_SPONSOR_FORMS),'000340',2,'NIH 2590 package (Coeus 3.8)','admin',NOW(),UUID(),1)
/
INSERT INTO SEQ_SPONSOR_FORMS VALUES(NULL)
/
INSERT INTO SPONSOR_FORMS (SPONSOR_FORM_ID,SPONSOR_CODE,PACKAGE_NUMBER,PACKAGE_NAME,UPDATE_USER,UPDATE_TIMESTAMP,OBJ_ID,VER_NBR)
VALUES ((SELECT (MAX(ID)) FROM SEQ_SPONSOR_FORMS),'000500',1,'NSF forms (Coeus 4.0)','admin',NOW(),UUID(),1)
/
INSERT INTO SEQ_SPONSOR_FORMS VALUES(NULL)
/
INSERT INTO SPONSOR_FORMS (SPONSOR_FORM_ID,SPONSOR_CODE,PACKAGE_NUMBER,PACKAGE_NAME,UPDATE_USER,UPDATE_TIMESTAMP,OBJ_ID,VER_NBR)
VALUES ((SELECT (MAX(ID)) FROM SEQ_SPONSOR_FORMS),'999999',2,'295 Summary Subcontracting Report','admin',NOW(),UUID(),1)
/
DELIMITER ;
|
--$Id$--
alter table REPORT_REPORT alter column REPORT_TYPE integer null;
alter table REPORT_TEMPLATE alter column TEMPLATE_FILE_ID uniqueidentifier null;
|
/*
Navicat MySQL Data Transfer
Source Server : localhost
Source Server Version : 50617
Source Host : localhost:3306
Source Database : workflow
Target Server Type : MYSQL
Target Server Version : 50617
File Encoding : 65001
Date: 2015-11-30 18:24:36
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for tc_organization
-- ----------------------------
DROP TABLE IF EXISTS `tc_organization`;
CREATE TABLE `tc_organization` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`name` varchar(255) DEFAULT NULL COMMENT '组织名称',
`parent_id` int(11) unsigned DEFAULT '0' COMMENT '上级ID',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='机构表';
-- ----------------------------
-- Records of tc_organization
-- ----------------------------
-- ----------------------------
-- Table structure for tc_task
-- ----------------------------
DROP TABLE IF EXISTS `tc_task`;
CREATE TABLE `tc_task` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`task_name` varchar(255) NOT NULL COMMENT '任务名称',
`description` varchar(255) DEFAULT NULL COMMENT '任务详情',
`target` text COMMENT '目标计划',
`created_id` int(11) unsigned DEFAULT '0' COMMENT '创建者ID',
`creat_time` int(11) NOT NULL COMMENT '创建时间',
`start_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '设置开始时间',
`end_time` int(11) NOT NULL COMMENT '设置结束时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='任务表';
-- ----------------------------
-- Records of tc_task
-- ----------------------------
-- ----------------------------
-- Table structure for tc_task_execute
-- ----------------------------
DROP TABLE IF EXISTS `tc_task_execute`;
CREATE TABLE `tc_task_execute` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`task_id` int(11) NOT NULL COMMENT '任务ID',
`exec_id` int(11) DEFAULT '0' COMMENT '执行者ID',
`task_statu` tinyint(1) DEFAULT '1' COMMENT '任务执行状态',
`progress` varchar(255) DEFAULT NULL COMMENT '执行进度',
`note` text COMMENT '注释',
`created_id` int(11) unsigned DEFAULT '0' COMMENT '创建者ID或分发者ID',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='任务执行者映射表';
-- ----------------------------
-- Records of tc_task_execute
-- ----------------------------
-- ----------------------------
-- Table structure for tc_user
-- ----------------------------
DROP TABLE IF EXISTS `tc_user`;
CREATE TABLE `tc_user` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`name` varchar(255) DEFAULT NULL COMMENT '用户名称',
`phone` varchar(11) DEFAULT '1' COMMENT '手机号码',
`email` varchar(255) DEFAULT '0' COMMENT '用户邮箱',
`bush_statu` varchar(255) DEFAULT '空闲' COMMENT '忙碌状态',
`org_id` int(11) unsigned DEFAULT '0' COMMENT '组织ID',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='用户基础表';
-- ----------------------------
-- Records of tc_user
-- ----------------------------
-- ----------------------------
-- Table structure for tc_user_admin
-- ----------------------------
DROP TABLE IF EXISTS `tc_user_admin`;
CREATE TABLE `tc_user_admin` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`username` varchar(255) DEFAULT NULL COMMENT '账号',
`password` varchar(32) NOT NULL COMMENT '密码',
`state` tinyint(1) unsigned DEFAULT '1' COMMENT '管理员状态:1:生效,0失效',
`lost_count` int(3) DEFAULT '0' COMMENT '一天内登录失败次数',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='后台表';
-- ----------------------------
-- Records of tc_user_admin
-- ----------------------------
|
<reponame>Kast0rTr0y/ao<gh_stars>1-10
ALTER TABLE PUBLIC.person ADD CONSTRAINT fk_person_companyid FOREIGN KEY (companyID) REFERENCES PUBLIC.company(id) |
<reponame>addstone/derby<gh_stars>100-1000
--
-- Licensed to the Apache Software Foundation (ASF) under one or more
-- contributor license agreements. See the NOTICE file distributed with
-- this work for additional information regarding copyright ownership.
-- The ASF licenses this file to You under the Apache License, Version 2.0
-- (the "License"); you may not use this file except in compliance with
-- the License. You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
--
--------------------------------------------------------------------------------
-- Test multi user lock interaction under isolation level 2. default isolation
-- level has been set as a property to serializable.
--------------------------------------------------------------------------------
run resource '/org/apache/derbyTesting/functionTests/tests/store/createTestProcedures.subsql';
call SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY('derby.storage.pageSize', '4096');
autocommit off;
-- by default, holdability of ResultSet objects created using this Connection object is true. Following will set it to false for this connection.
NoHoldForConnection;
--------------------------------------------------------------------------------
-- Test 0: verify isolation level by seeing if a read lock is released or not.
--------------------------------------------------------------------------------
connect 'wombat' as scanner;
-- by default, holdability of ResultSet objects created using this Connection object is true. Following will set it to false for this connection.
NoHoldForConnection;
connect 'wombat' as writer;
-- by default, holdability of ResultSet objects created using this Connection object is true. Following will set it to false for this connection.
NoHoldForConnection;
-- set up
set connection scanner;
autocommit off;
create table test_0 (a int);
insert into test_0 values (1);
commit;
set connection writer;
autocommit off;
-- isolation 2 scanner should release read lock on table after statement.
set connection scanner;
select * from test_0;
-- writer should be able to insert into table - scanner released read lock.
set connection writer;
insert into test_0 values (2);
-- scanner will now block on uncommitted insert, and get lock timeout
set connection scanner;
select * from test_0;
commit;
-- commit writer - releasing all locks.
set connection writer;
commit;
-- scanner will now see 2 rows
set connection scanner;
select * from test_0;
commit;
-- cleanup
set connection scanner;
drop table test_0;
commit;
disconnect;
set connection writer;
disconnect;
--------------------------------------------------------------------------------
-- Test 1: make sure a leaf root growing get's the right lock.
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-- Test setup - create a 1 page btree, with the page ready to split.
--------------------------------------------------------------------------------
connect 'wombat' as scanner;
-- by default, holdability of ResultSet objects created using this Connection object is true. Following will set it to false for this connection.
NoHoldForConnection;
connect 'wombat' as rootgrower;
-- by default, holdability of ResultSet objects created using this Connection object is true. Following will set it to false for this connection.
NoHoldForConnection;
set connection scanner;
autocommit off;
create table a (a varchar(1200), b varchar(1000)) ;
insert into a values (PADSTRING('a',1200), PADSTRING('a',1000));
insert into a values (PADSTRING('b',1200), PADSTRING('b',1000));
insert into a values (PADSTRING('c',1200), PADSTRING('c',1000));
create index a_idx on a (a) ;
commit;
set connection rootgrower;
autocommit off;
commit;
--------------------------------------------------------------------------------
-- Set up scanner to be doing a row locked covered scan on the index.
--------------------------------------------------------------------------------
set connection scanner;
autocommit off;
CALL SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY('derby.language.bulkFetchDefault','1');
get cursor scan_cursor as
'select a from a where a >= PADSTRING(''a'',1200) and a < PADSTRING(''c'',1200) ';
call SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY('derby.language.bulkFetchDefault', '16');
next scan_cursor;
--------------------------------------------------------------------------------
-- Before DERBY-2991 the attempt to split the root would time out because the
-- scan had locked the first page.
--------------------------------------------------------------------------------
set connection rootgrower;
autocommit off;
insert into a values (PADSTRING('d',1200), PADSTRING('d',1000));
rollback;
--------------------------------------------------------------------------------
-- The scan should continue unaffected.
--------------------------------------------------------------------------------
set connection scanner;
next scan_cursor;
next scan_cursor;
--------------------------------------------------------------------------------
-- This insert will block on the previous key lock of the scanner.
--------------------------------------------------------------------------------
set connection rootgrower;
insert into a values (PADSTRING('ab',1200), PADSTRING('ab',1000));
--------------------------------------------------------------------------------
-- Now the grow root should be allowed (note that cursor scan has locks
-- on the leaf page being grown - just not the scan lock).
-- (Scan locks are no longer used after DERBY-2991.)
--------------------------------------------------------------------------------
set connection rootgrower;
insert into a values (PADSTRING('d',1200), PADSTRING('d',1000));
select a from a;
--------------------------------------------------------------------------------
-- cleanup.
--------------------------------------------------------------------------------
set connection rootgrower;
commit;
disconnect;
set connection scanner;
commit;
drop table a;
commit;
disconnect;
--------------------------------------------------------------------------------
-- Test 2: make sure previous key locks are gotten correctly.
--------------------------------------------------------------------------------
connect 'wombat' as client_1;
-- by default, holdability of ResultSet objects created using this Connection object is true. Following will set it to false for this connection.
NoHoldForConnection;
connect 'wombat' as client_2;
-- by default, holdability of ResultSet objects created using this Connection object is true. Following will set it to false for this connection.
NoHoldForConnection;
set connection client_1;
autocommit off;
create table a (a varchar(1000), b varchar(1000)) ;
create unique index a_idx on a (a) ;
insert into a values (PADSTRING('b',1000), PADSTRING('b',1000));
insert into a values (PADSTRING('c',1000), PADSTRING('c',1000));
insert into a values (PADSTRING('e',1000), PADSTRING('e',1000));
insert into a values (PADSTRING('f',1000), PADSTRING('f',1000));
insert into a values (PADSTRING('g',1000), PADSTRING('g',1000));
commit;
set connection client_2;
autocommit off;
--------------------------------------------------------------------------------
-- client 1 will get exclusive locks on 'c'.
--------------------------------------------------------------------------------
set connection client_1;
update a set b = 'new value' where a > 'b' and a <= 'd';
-- run resource '/org/apache/derbyTesting/functionTests/tests/store/LockTableQuery.subsql';
set connection client_2;
--------------------------------------------------------------------------------
-- the following will not time out, the insert
-- will get a previous key insert lock which will not conflict with the
-- non-insert read-committed exclusive lock on 'c'.
--------------------------------------------------------------------------------
insert into a values (PADSTRING('d',1000), PADSTRING('d',1000));
--------------------------------------------------------------------------------
-- the following should NOT cause a time out
--------------------------------------------------------------------------------
insert into a values (PADSTRING('a',1000), PADSTRING('a',1000));
--------------------------------------------------------------------------------
-- the following will block because it is a unique index, and the insert is of
-- the same row being locked by client_1
--------------------------------------------------------------------------------
insert into a values (PADSTRING('c',1000), PADSTRING('c',1000));
-- run resource '/org/apache/derbyTesting/functionTests/tests/store/LockTableQuery.subsql';
--------------------------------------------------------------------------------
-- cleanup.
--------------------------------------------------------------------------------
set connection client_1;
select * from a;
commit;
set connection client_2;
commit;
select * from a;
drop table a;
commit;
--------------------------------------------------------------------------------
-- Test 3: make sure an exact key insert into unique key index blocks.
--------------------------------------------------------------------------------
set connection client_1;
autocommit off;
create table a (a varchar(1000), b varchar(1000)) ;
create unique index a_idx on a (a) ;
commit;
insert into a values (PADSTRING('b',1000), PADSTRING('b',1000));
set connection client_2;
autocommit off;
--------------------------------------------------------------------------------
-- the following should cause a time out, as the previous
-- key lock will conflict with client_1's lock on 'b'
--------------------------------------------------------------------------------
insert into a values (PADSTRING('b',1000), PADSTRING('b',1000));
--------------------------------------------------------------------------------
-- Test 4: make sure that row lock wait in a heap scan works
--------------------------------------------------------------------------------
set connection client_1;
autocommit off;
create table test_4 (a int, b varchar(1000), c varchar(1000)) ;
commit;
set connection client_2;
autocommit off;
commit;
-- client_1 will get a single row lock in the heap.
set connection client_1;
insert into test_4 values (1, PADSTRING('a',1000), PADSTRING('b',1000));
-- client_2 scans table, blocking on a row lock on the client_1 insert row,
-- will get timeout message.
set connection client_2;
select * from test_4;
-- release the insert lock.
set connection client_1;
commit;
-- reader should be able to see row now.
set connection client_2;
select * from test_4;
commit;
-- cleanup
set connection client_1;
drop table test_4;
commit;
--------------------------------------------------------------------------------
-- Test 5: make sure a that a group fetch through a secondary index correctly
-- handles a row that is deleted after it has read a row from the index
-- but before it has read the row from the base table.
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-- Test setup - create a 1 page btre, with the page ready to split.
--------------------------------------------------------------------------------
connect 'wombat' as scanner;
-- by default, holdability of ResultSet objects created using this Connection object is true. Following will set it to false for this connection.
NoHoldForConnection;
connect 'wombat' as deleter;
-- by default, holdability of ResultSet objects created using this Connection object is true. Following will set it to false for this connection.
NoHoldForConnection;
set connection scanner;
autocommit off;
create table test_5 (a int, a2 int, b varchar(1000), c varchar(1000)) ;
insert into test_5 values (1, 10, PADSTRING('a',1000), PADSTRING('a',1000));
insert into test_5 values (2, 20, PADSTRING('b',1000), PADSTRING('b',1000));
insert into test_5 values (3, 30, PADSTRING('c',1000), PADSTRING('c',1000));
insert into test_5 values (4, 40, PADSTRING('d',1000), PADSTRING('d',1000));
insert into test_5 values (5, 50, PADSTRING('e',1000), PADSTRING('e',1000));
insert into test_5 values (6, 60, PADSTRING('f',1000), PADSTRING('f',1000));
create index test_5_idx on test_5 (a);
commit;
set connection deleter;
autocommit off;
commit;
--------------------------------------------------------------------------------
-- Set up scanner to be doing a row locked index to base row scan on the index.
-- By using group fetch it will read and release locks on multiple rows from
-- the index and save away row pointers from the index.
--------------------------------------------------------------------------------
set connection scanner;
CALL SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY('derby.language.bulkFetchDefault','10');
get cursor scan_cursor as
'select a, a2 from test_5 where a > 1 ';
call SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY('derby.language.bulkFetchDefault', '16');
-- because of group locking will get locks on 1, 2, 3, 4, and 5 and then will
-- release the locks on 1, 2, 3, and 4. The last one is released on close or
-- on next call emptying the cursor.
next scan_cursor;
--------------------------------------------------------------------------------
-- Delete a row that the scanner has looked at but not reported back to the
-- caller.
--------------------------------------------------------------------------------
set connection deleter;
delete from test_5 where a = 4;
--------------------------------------------------------------------------------
-- The scan will requalify rows when it goes to the base table, thus it will
-- see 3, but block when it gets to the key of deleted row (4).
--------------------------------------------------------------------------------
set connection scanner;
next scan_cursor;
next scan_cursor;
-- commit the delete
set connection deleter;
commit;
-- scanner should see 1,2,3,4,6
set connection scanner;
close scan_cursor;
select a,b from test_5;
--------------------------------------------------------------------------------
-- cleanup.
--------------------------------------------------------------------------------
set connection deleter;
commit;
disconnect;
set connection scanner;
commit;
drop table test_5;
commit;
disconnect;
--------------------------------------------------------------------------------
-- Test 6: make sure a that heap scans which cross page boundaries release
-- locks correctly.
--------------------------------------------------------------------------------
-- Test setup - create a heap with one row per page.
connect 'wombat' as scanner;
-- by default, holdability of ResultSet objects created using this Connection object is true. Following will set it to false for this connection.
NoHoldForConnection;
connect 'wombat' as deleter;
-- by default, holdability of ResultSet objects created using this Connection object is true. Following will set it to false for this connection.
NoHoldForConnection;
set connection scanner;
autocommit off;
create table test_6 (a int, a2 int, b varchar(2000), c varchar(2000)) ;
insert into test_6 values (1, 10, PADSTRING('a',2000), PADSTRING('a',2000));
insert into test_6 values (2, 20, PADSTRING('b',2000), PADSTRING('b',2000));
insert into test_6 values (3, 30, PADSTRING('c',2000), PADSTRING('c',2000));
insert into test_6 values (4, 40, PADSTRING('d',2000), PADSTRING('d',2000));
insert into test_6 values (5, 50, PADSTRING('e',2000), PADSTRING('e',2000));
create index test_6_idx on test_6 (a);
commit;
set connection deleter;
autocommit off;
commit;
--------------------------------------------------------------------------------
-- Set up scanner to be doing a row locked index to base row scan on the index.
-- By using group fetch it will read and release locks on multiple rows from
-- the index and save away row pointers from the index.
--------------------------------------------------------------------------------
set connection scanner;
get cursor scan_cursor as
'select a, a2 from test_6';
next scan_cursor;
next scan_cursor;
next scan_cursor;
next scan_cursor;
next scan_cursor;
--------------------------------------------------------------------------------
-- Delete all rows that the scanner has looked at, and should have released the
-- lock on.
--------------------------------------------------------------------------------
set connection deleter;
delete from test_6 where a = 1;
delete from test_6 where a = 2;
delete from test_6 where a = 3;
delete from test_6 where a = 4;
--------------------------------------------------------------------------------
-- The scan should either block on the delete or continue and not return the
-- the deleted row.
--------------------------------------------------------------------------------
set connection scanner;
next scan_cursor;
close scan_cursor;
-- commit the delete
set connection deleter;
delete from test_6 where a = 5;
commit;
-- scanner should see no rows.
set connection scanner;
select a,b from test_6;
--------------------------------------------------------------------------------
-- cleanup.
--------------------------------------------------------------------------------
set connection deleter;
commit;
disconnect;
set connection scanner;
commit;
drop table test_6;
commit;
disconnect;
--------------------------------------------------------------------------------
-- Test 7: make sure that 2 heap cursor scans in same transaction work (at one
-- point there was a problem where releasing locks in one of the cursors
-- released locks in the other cursor).
--------------------------------------------------------------------------------
-- Test setup - create a heap with one row per page.
connect 'wombat' as scanner;
-- by default, holdability of ResultSet objects created using this Connection object is true. Following will set it to false for this connection.
NoHoldForConnection;
connect 'wombat' as deleter;
-- by default, holdability of ResultSet objects created using this Connection object is true. Following will set it to false for this connection.
NoHoldForConnection;
--------------------------------------------------------------------------------
-- HEAP SCAN
--------------------------------------------------------------------------------
set connection scanner;
autocommit off;
create table test_7 (a int, a2 int, b varchar(2000), c varchar(2000)) ;
insert into test_7 values (1, 10, PADSTRING('a',2000), PADSTRING('a',2000));
insert into test_7 values (2, 20, PADSTRING('b',2000), PADSTRING('b',2000));
insert into test_7 values (3, 30, PADSTRING('c',2000), PADSTRING('c',2000));
insert into test_7 values (4, 40, PADSTRING('d',2000), PADSTRING('d',2000));
insert into test_7 values (5, 50, PADSTRING('e',2000), PADSTRING('e',2000));
commit;
set connection deleter;
autocommit off;
commit;
-- Set up scanner to be doing a row locked heap scan, going one row at a time.
set connection scanner;
CALL SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY('derby.language.bulkFetchDefault','1');
get cursor scan_cursor_1 as
'select a, a2 from test_7';
get cursor scan_cursor_2 as
'select a, a2 from test_7';
call SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY('derby.language.bulkFetchDefault', '16');
next scan_cursor_1;
next scan_cursor_1;
next scan_cursor_1;
next scan_cursor_1;
next scan_cursor_1;
next scan_cursor_2;
close scan_cursor_2;
-- Get exclusive table lock on test_7. Should fail with table cannot be locked.
set connection deleter;
lock table test_7 in exclusive mode;
-- release all read locks, by moving the cursor past all the rows.
set connection scanner;
next scan_cursor_1;
close scan_cursor_1;
-- Get exclusive table lock on test_7. Now that both scan closed this should
-- work.
set connection deleter;
delete from test_7;
commit;
-- scanner should see no rows.
set connection scanner;
select a,b from test_7;
commit;
--------------------------------------------------------------------------------
-- cleanup.
--------------------------------------------------------------------------------
set connection deleter;
commit;
disconnect;
set connection scanner;
commit;
drop table test_7;
commit;
disconnect;
--------------------------------------------------------------------------------
-- Test 8: Exercise post commit cases, force the code through the path, no easy
-- way to make sure the post commit work is actually doing something.
-- All these case were run with lock debugging by hand to make sure the
-- right thing was happening:
--
-- 8.1 - heap post commit successfully gets table X lock and cleans up.
-- 8.2 - heap post commit can't get table X lock, so gives up and let's
-- client continue on with work.
-- 8.3 - btree post commit successfully gets table X lock and cleans up.
-- 8.4 - btree post commit can't get table X lock, so gives up and let's
-- client continue on with work.
-- client continue on with work.
--
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-- 8.1 setup
--------------------------------------------------------------------------------
set connection client_1;
create table test_8 (a int, a2 int, b varchar(2000), c char(10))
;
create index test_8_idx on test_8 (a);
insert into test_8 values (1, 10, PADSTRING('a',2000), 'test 8.1');
insert into test_8 values (2, 20, PADSTRING('b',2000), 'test 8.1');
insert into test_8 values (3, 30, PADSTRING('c',2000), 'test 8.1');
insert into test_8 values (4, 40, PADSTRING('d',2000), 'test 8.1');
insert into test_8 values (5, 50, PADSTRING('e',2000), 'test 8.1');
commit;
--------------------------------------------------------------------------------
-- 8.1 test - simply delete rows from table, heap post commit will run and
-- reclaim all pages.
--------------------------------------------------------------------------------
set connection client_1;
delete from test_8;
commit;
select a from test_8;
commit;
--------------------------------------------------------------------------------
-- 8.2 setup
--------------------------------------------------------------------------------
drop table test_8;
create table test_8 (a int, a2 int, b varchar(1000), c char(10))
;
create index test_8_idx on test_8 (a);
insert into test_8 values (1, 10, PADSTRING('a',1000), 'test 8.2');
insert into test_8 values (2, 20, PADSTRING('b',1000), 'test 8.2');
insert into test_8 values (3, 30, PADSTRING('c',1000), 'test 8.2');
insert into test_8 values (4, 40, PADSTRING('d',1000), 'test 8.2');
insert into test_8 values (5, 50, PADSTRING('e',1000), 'test 8.2');
commit;
--------------------------------------------------------------------------------
-- 8.2 test - client 1 holds row lock which will prevent client 2 post commit.
--------------------------------------------------------------------------------
set connection client_1;
insert into test_8 values (6, 60, PADSTRING('a',1000), 'test 8.2');
set connection client_2;
delete from test_8 where a < 5;
commit;
set connection client_1;
select a from test_8;
commit;
set connection client_2;
select a from test_8;
commit;
--------------------------------------------------------------------------------
-- 8.3 setup
--------------------------------------------------------------------------------
drop table test_8;
create table test_8 (a int, a2 int, b varchar(1500), c char(10));
create index test_8_idx on test_8 (a, b)
;
insert into test_8 values (1, 10, PADSTRING('a',1500), 'test 8.3');
insert into test_8 values (2, 20, PADSTRING('b',1500), 'test 8.3');
insert into test_8 values (3, 30, PADSTRING('c',1500), 'test 8.3');
insert into test_8 values (4, 40, PADSTRING('d',1500), 'test 8.3');
insert into test_8 values (5, 50, PADSTRING('e',1500), 'test 8.3');
commit;
--------------------------------------------------------------------------------
-- 8.3 test - simply delete rows from index table, btree post commit will run
-- and reclaim all pages.
--------------------------------------------------------------------------------
set connection client_1;
delete from test_8;
commit;
select a from test_8;
commit;
--------------------------------------------------------------------------------
-- 8.4 setup
--------------------------------------------------------------------------------
drop table test_8;
create table test_8 (a int, a2 int, b varchar(1500), c char(10)) ;
create index test_8_idx1 on test_8 (a);
create index test_8_idx2 on test_8 (a, b)
;
insert into test_8 values (1, 10, PADSTRING('a',1500), 'test 8.4');
insert into test_8 values (2, 20, PADSTRING('b',1500), 'test 8.4');
insert into test_8 values (3, 30, PADSTRING('c',1500), 'test 8.4');
insert into test_8 values (4, 40, PADSTRING('d',1500), 'test 8.4');
insert into test_8 values (5, 50, PADSTRING('e',1500), 'test 8.4');
commit;
--------------------------------------------------------------------------------
-- 8.4 test - client 1 holds row lock which will prevent client 2 post commit.
--------------------------------------------------------------------------------
set connection client_1;
insert into test_8 values (6, 60, PADSTRING('a',1500), 'test 8.4');
set connection client_2;
delete from test_8 where a < 5;
commit;
set connection client_1;
select a from test_8;
commit;
set connection client_2;
select a from test_8;
commit;
--------------------------------------------------------------------------------
-- cleanup.
--------------------------------------------------------------------------------
set connection client_1;
drop table test_8;
commit;
disconnect;
set connection client_2;
commit;
disconnect;
--------------------------------------------------------------------------------
-- Test 9: Make sure scan positioning in the beginning of a unique scan
-- properly gets the scan lock to block with splits.
-- (Scan locks are no longer used after DERBY-2991.)
--
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-- 9.1 setup
--------------------------------------------------------------------------------
connect 'wombat' as scanner;
-- by default, holdability of ResultSet objects created using this Connection object is true. Following will set it to false for this connection.
NoHoldForConnection;
autocommit off;
commit;
connect 'wombat' as splitter;
-- by default, holdability of ResultSet objects created using this Connection object is true. Following will set it to false for this connection.
NoHoldForConnection;
autocommit off;
commit;
set connection scanner;
create table test_9 (a int, a2 int, b varchar(1000), c char(10))
;
insert into test_9 values (5, 50, PADSTRING('e',1000), 'test 9.1');
insert into test_9 values (4, 40, PADSTRING('d',1000), 'test 9.1');
insert into test_9 values (3, 30, PADSTRING('c',1000), 'test 9.1');
insert into test_9 values (2, 20, PADSTRING('b',1000), 'test 9.1');
insert into test_9 values (1, 10, PADSTRING('a',1000), 'test 9.1');
create unique index test_9_idx on test_9 (b) ;
commit;
--------------------------------------------------------------------------------
-- 9.1 test - open a cursor for update on table, and make sure splitter waits
-- on the scan position.
--------------------------------------------------------------------------------
set connection scanner;
CALL SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY('derby.language.bulkFetchDefault','1');
get cursor scan_cursor as
'select b from test_9 where b >= ''a'' ';
call SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY('derby.language.bulkFetchDefault', '16');
next scan_cursor;
next scan_cursor;
-- the following will get a couple of rows and then block on the split.
set connection splitter;
insert into test_9 values (0, 10, PADSTRING('aa',1000), 'test 9.1');
commit;
insert into test_9 values (0, 10, PADSTRING('ab',1000), 'test 9.1');
commit;
-- insert ahead in the cursor to make sure we pick it up later.
-- This would time out before DERBY-2991.
insert into test_9 values (0, 10, PADSTRING('dd',1000), 'test 9.1');
rollback;
set connection scanner;
next scan_cursor;
next scan_cursor;
next scan_cursor;
next scan_cursor;
commit;
--------------------------------------------------------------------------------
-- cleanup.
--------------------------------------------------------------------------------
set connection scanner;
drop table test_9;
commit;
disconnect;
set connection splitter;
commit;
disconnect;
--------------------------------------------------------------------------------
-- Test 10: Make sure a ddl does not block the lock table vti.
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-- 10 setup
--------------------------------------------------------------------------------
connect 'wombat' as ddl;
-- by default, holdability of ResultSet objects created using this Connection object is true. Following will set it to false for this connection.
NoHoldForConnection;
autocommit off;
commit;
connect 'wombat' as locktable;
-- by default, holdability of ResultSet objects created using this Connection object is true. Following will set it to false for this connection.
NoHoldForConnection;
autocommit off;
commit;
set connection ddl;
run resource '/org/apache/derbyTesting/functionTests/tests/store/LockTableQuery.subsql';
commit;
--------------------------------------------------------------------------------
-- 10 test - do ddl in one connection and look at lock table in another
-- connection.
--------------------------------------------------------------------------------
set connection ddl;
create table test_10 (a int, a2 int, b varchar(1000), c char(10))
;
insert into test_10 values (4, 40, PADSTRING('d',1000), 'test 9.1');
insert into test_10 values (3, 30, PADSTRING('c',1000), 'test 9.1');
insert into test_10 values (2, 20, PADSTRING('b',1000), 'test 9.1');
insert into test_10 values (1, 10, PADSTRING('a',1000), 'test 9.1');
set connection locktable;
-- this should not block on the other thread.
select * from lock_table order by tabname, type desc, mode, cnt, lockname;
commit;
--------------------------------------------------------------------------------
-- cleanup.
--------------------------------------------------------------------------------
set connection ddl;
drop table test_10;
commit;
disconnect;
set connection locktable;
commit;
disconnect;
--------------------------------------------------------------------------------
-- Test 11: test update locks
--------------------------------------------------------------------------------
connect 'wombat' as t11scanner;
-- by default, holdability of ResultSet objects created using this Connection object is true. Following will set it to false for this connection.
NoHoldForConnection;
connect 'wombat' as t11updater;
-- by default, holdability of ResultSet objects created using this Connection object is true. Following will set it to false for this connection.
NoHoldForConnection;
connect 'wombat' as t11writer;
-- by default, holdability of ResultSet objects created using this Connection object is true. Following will set it to false for this connection.
NoHoldForConnection;
-- set up
set connection t11updater;
autocommit off;
create table test_11 (a int, b int);
insert into test_11 values (1,1);
insert into test_11 values (2,2);
insert into test_11 values (8,8);
create index test11_idx on test_11 (a);
commit;
select * from lock_table order by tabname, type desc, mode, cnt, lockname;
--
--==================================================
-- t11updater gets an update lock on row where a=1
--==================================================
get cursor update_cursor as
'select b from test_11 where a=1 for update of b';
select * from lock_table order by tabname, type desc, mode, cnt, lockname;
next update_cursor;
select * from lock_table order by tabname, type desc, mode, cnt, lockname;
set connection t11scanner;
autocommit off;
--
--------------------------------------------------
-- try to scan the table, readers are compatible with update lock.
--------------------------------------------------
select * from test_11;
select * from lock_table order by tabname, type desc, mode, cnt, lockname;
--
--------------------------------------------------
-- try to update the table, should timeout
--------------------------------------------------
update test_11 set b=99 where a = 1;
--
--------------------------------------------------
-- try to update the table, should go through
--------------------------------------------------
update test_11 set b=99 where a = 8;
select * from lock_table order by tabname, type desc, mode, cnt, lockname;
commit;
select * from lock_table order by tabname, type desc, mode, cnt, lockname;
--
--------------------------------------------------
-- try to get an update lock
--------------------------------------------------
get cursor update_cursor2 as
'select b from test_11 where a=1 for update of b';
select * from lock_table order by tabname, type desc, mode, cnt, lockname;
--
--------------------------------------------------
-- should timeout (other transaction has a shared lock on this row)
--------------------------------------------------
next update_cursor2;
select * from lock_table order by tabname, type desc, mode, cnt, lockname;
--
--------------------------------------------------
-- should succeed (no other transaction has a shared lock on this row)
--------------------------------------------------
get cursor update_cursor3 as
'select b from test_11 where a=8 for update of b';
select type, cnt, mode, tabname, lockname, state from lock_table2 order by tabname, type desc, mode, cnt, lockname;
next update_cursor3;
select * from lock_table order by tabname, type desc, mode, cnt, lockname;
commit;
close update_cursor2;
close update_cursor3;
set connection t11updater;
commit;
close update_cursor;
set connection t11scanner;
select * from lock_table order by tabname, type desc, mode, cnt, lockname;
--
--==================================================
-- t11scanner gets a read lock
--==================================================
select b from test_11 where a=1;
select * from lock_table order by tabname, type desc, mode, cnt, lockname;
--
--------------------------------------------------
-- should succeed (can get an update lock if there is already a shared lock)
--------------------------------------------------
set connection t11updater;
get cursor update_cursor as
'select b from test_11 where a=1 for update of b';
next update_cursor;
select * from lock_table order by tabname, type desc, mode, cnt, lockname;
commit;
close update_cursor;
set connection t11scanner;
commit;
--
--==================================================
-- t11writer gets a write lock
--==================================================
set connection t11writer;
autocommit off;
update test_11 set b=77 where a=2;
select * from lock_table order by tabname, type desc, mode, cnt, lockname;
set connection t11updater;
get cursor update_cursor as
'select b from test_11 where a=2 for update of b';
select * from lock_table order by tabname, type desc, mode, cnt, lockname;
--
----------------------------------------------------
-- should timeout
----------------------------------------------------
next update_cursor;
--------------------------------------------------------------------------------
-- cleanup.
--------------------------------------------------------------------------------
set connection t11updater;
close update_cursor;
drop table test_11;
commit;
disconnect;
set connection t11scanner;
disconnect;
set connection t11writer;
disconnect;
exit;
|
<reponame>cb-deepak/pgcodekeeper
-- handler
CREATE FOREIGN DATA WRAPPER test_fdw_1
HANDLER handler_function_1;
-- null handler
CREATE FOREIGN DATA WRAPPER test_fdw_11;
-- validator
CREATE FOREIGN DATA WRAPPER test_fdw_2
VALIDATOR fdw_test_validator_1;
-- null validator
CREATE FOREIGN DATA WRAPPER test_fdw_21;
--options
CREATE FOREIGN DATA WRAPPER test_fdw_0 OPTIONS (debug 'true');
CREATE FOREIGN DATA WRAPPER test_fdw_3 OPTIONS (dbname 'newdb', port '5432');
--OWNER--
CREATE FOREIGN DATA WRAPPER test_fdw_4;
ALTER FOREIGN DATA WRAPPER test_fdw_4 OWNER TO khazieva_gr;
|
-- predictability
SET synchronous_commit = on;
SELECT 'init' FROM pg_create_logical_replication_slot('regression_slot', 'test_decoding');
CREATE SEQUENCE test_sequence;
-- test the sequence changes by several nextval() calls
SELECT nextval('test_sequence');
SELECT nextval('test_sequence');
SELECT nextval('test_sequence');
SELECT nextval('test_sequence');
-- test the sequence changes by several ALTER commands
ALTER SEQUENCE test_sequence INCREMENT BY 10;
SELECT nextval('test_sequence');
ALTER SEQUENCE test_sequence START WITH 3000;
ALTER SEQUENCE test_sequence MAXVALUE 10000;
ALTER SEQUENCE test_sequence RESTART WITH 4000;
SELECT nextval('test_sequence');
-- test the sequence changes by several setval() calls
SELECT setval('test_sequence', 3500);
SELECT nextval('test_sequence');
SELECT setval('test_sequence', 3500, true);
SELECT nextval('test_sequence');
SELECT setval('test_sequence', 3500, false);
SELECT nextval('test_sequence');
-- show results and drop sequence
SELECT data FROM pg_logical_slot_get_changes('regression_slot', NULL, NULL, 'include-xids', '0', 'skip-empty-xacts', '1');
DROP SEQUENCE test_sequence;
-- rollback on sequence creation and update
BEGIN;
CREATE SEQUENCE test_sequence;
CREATE TABLE test_table (a INT);
SELECT nextval('test_sequence');
SELECT nextval('test_sequence');
SELECT nextval('test_sequence');
SELECT setval('test_sequence', 3000);
SELECT nextval('test_sequence');
SELECT nextval('test_sequence');
SELECT nextval('test_sequence');
ALTER SEQUENCE test_sequence RESTART WITH 6000;
INSERT INTO test_table VALUES( (SELECT nextval('test_sequence')) );
SELECT nextval('test_sequence');
ROLLBACK;
SELECT data FROM pg_logical_slot_get_changes('regression_slot', NULL, NULL, 'include-xids', '0', 'skip-empty-xacts', '1');
-- rollback on table creation with serial column
BEGIN;
CREATE TABLE test_table (a SERIAL, b INT);
INSERT INTO test_table (b) VALUES (100);
INSERT INTO test_table (b) VALUES (200);
INSERT INTO test_table (b) VALUES (300);
SELECT setval('test_table_a_seq', 3000);
INSERT INTO test_table (b) VALUES (400);
INSERT INTO test_table (b) VALUES (500);
INSERT INTO test_table (b) VALUES (600);
ALTER SEQUENCE test_table_a_seq RESTART WITH 6000;
INSERT INTO test_table (b) VALUES (700);
INSERT INTO test_table (b) VALUES (800);
INSERT INTO test_table (b) VALUES (900);
ROLLBACK;
SELECT data FROM pg_logical_slot_get_changes('regression_slot', NULL, NULL, 'include-xids', '0', 'skip-empty-xacts', '1');
-- rollback on table with serial column
CREATE TABLE test_table (a SERIAL, b INT);
BEGIN;
INSERT INTO test_table (b) VALUES (100);
INSERT INTO test_table (b) VALUES (200);
INSERT INTO test_table (b) VALUES (300);
SELECT setval('test_table_a_seq', 3000);
INSERT INTO test_table (b) VALUES (400);
INSERT INTO test_table (b) VALUES (500);
INSERT INTO test_table (b) VALUES (600);
ALTER SEQUENCE test_table_a_seq RESTART WITH 6000;
INSERT INTO test_table (b) VALUES (700);
INSERT INTO test_table (b) VALUES (800);
INSERT INTO test_table (b) VALUES (900);
ROLLBACK;
-- check table and sequence values after rollback
SELECT * from test_table_a_seq;
SELECT nextval('test_table_a_seq');
DROP TABLE test_table;
SELECT data FROM pg_logical_slot_get_changes('regression_slot', NULL, NULL, 'include-xids', '0', 'skip-empty-xacts', '1');
-- savepoint test on table with serial column
BEGIN;
CREATE TABLE test_table (a SERIAL, b INT);
INSERT INTO test_table (b) VALUES (100);
INSERT INTO test_table (b) VALUES (200);
SAVEPOINT a;
INSERT INTO test_table (b) VALUES (300);
ROLLBACK TO SAVEPOINT a;
DROP TABLE test_table;
COMMIT;
SELECT data FROM pg_logical_slot_get_changes('regression_slot', NULL, NULL, 'include-xids', '0', 'skip-empty-xacts', '1');
-- savepoint test on table with serial column
BEGIN;
CREATE SEQUENCE test_sequence;
SELECT nextval('test_sequence');
SELECT setval('test_sequence', 3000);
SELECT nextval('test_sequence');
SAVEPOINT a;
ALTER SEQUENCE test_sequence START WITH 7000;
SELECT setval('test_sequence', 5000);
ROLLBACK TO SAVEPOINT a;
SELECT * FROM test_sequence;
DROP SEQUENCE test_sequence;
COMMIT;
SELECT data FROM pg_logical_slot_get_changes('regression_slot', NULL, NULL, 'include-xids', '0', 'skip-empty-xacts', '1');
SELECT pg_drop_replication_slot('regression_slot');
|
<reponame>lanling1213/lanlin
DROP TABLE IF EXISTS `wy_message_data`; |
-- @testpoint:opengauss关键字profile(非保留),作为模式名
--关键字不带引号-成功
drop schema if exists profile;
create schema profile;
drop schema profile;
--关键字带双引号-成功
drop schema if exists "profile";
create schema "profile";
drop schema "profile";
--关键字带单引号-合理报错
drop schema if exists 'profile';
--关键字带反引号-合理报错
drop schema if exists `profile`;
|
<reponame>launchql/utils<gh_stars>0
-- Revert schemas/uuids/procedures/trigger_set_uuid_seed from pg
BEGIN;
DROP FUNCTION uuids.trigger_set_uuid_seed;
COMMIT;
|
<reponame>TrevorTWX/code_athlon_2018<filename>db/seed.sql<gh_stars>0
INSERT INTO TimeEntrances (timeslot) VALUES ("8:00 to 8:05");
INSERT INTO TimeEntrances (timeslot) VALUES ("8:05 to 8:10");
INSERT INTO TimeEntrances (timeslot) VALUES ("8:10 to 8:15");
INSERT INTO TimeEntrances (timeslot) VALUES ("8:15 to 8:20");
INSERT INTO TimeEntrances (timeslot) VALUES ("8:20 to 8:25");
INSERT INTO TimeEntrances (timeslot) VALUES ("8:25 to 8:30");
INSERT INTO TimeEntrances (timeslot) VALUES ("8:30 to 8:35");
INSERT INTO TimeEntrances (timeslot) VALUES ("8:35 to 8:40");
INSERT INTO TimeEntrances (timeslot) VALUES ("8:40 to 8:45");
INSERT INTO TimeEntrances (timeslot) VALUES ("8:45 to 8:50");
INSERT INTO TimeEntrances (timeslot) VALUES ("8:50 to 8:55");
INSERT INTO TimeEntrances (timeslot) VALUES ("8:55 to 9:00");
INSERT INTO TimeEntrances (timeslot) VALUES ("Rest of the day");
|
<gh_stars>0
-- phpMyAdmin SQL Dump
-- version 4.7.4
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1:3306
-- Generation Time: May 22, 2018 at 10:25 AM
-- Server version: 5.7.19
-- PHP Version: 5.6.31
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+10:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `assignment2`
--
DROP DATABASE IF EXISTS `assignment2`;
CREATE DATABASE IF NOT EXISTS `assignment2` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;
USE `assignment2`;
# Privileges for `assignment2User`@`localhost`
GRANT USAGE ON *.* TO 'assignment2User'@'localhost';
GRANT ALL PRIVILEGES ON `assignment2`.* TO 'assignment2User'@'localhost'
IDENTIFIED BY 'Lk8i0TMA3JQdysko'
WITH GRANT OPTION ;
-- --------------------------------------------------------
--
-- Table structure for table `game`
--
DROP TABLE IF EXISTS `game`;
CREATE TABLE IF NOT EXISTS `game` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(150) NOT NULL,
`image_url` varchar(150) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `game`
--
INSERT INTO `game` (`id`, `name`, `image_url`) VALUES
(1, 'Overwatch', 'images/overwatch.jpg'),
(2, 'World of Warcraft', 'images/wow.jpg'),
(3, 'Heroes of the Storm', 'images/hots.jpg'),
(4, 'Hearthstone', 'images/hearthstone.jpg');
-- --------------------------------------------------------
--
-- Table structure for table `review`
--
DROP TABLE IF EXISTS `review`;
CREATE TABLE IF NOT EXISTS `review` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`game_id` int(11) NOT NULL,
`reviewer_name` varchar(50) NOT NULL,
`review` varchar(255) NOT NULL,
`rating` int(11) NOT NULL,
PRIMARY KEY (`id`),
KEY `game_id` (`game_id`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `review`
--
INSERT INTO `review` (`id`, `game_id`, `reviewer_name`, `review`, `rating`) VALUES
(1, 1, 'Jaydon', 'This is a very fun game.', 5),
(2, 1, 'Matthew', 'HotS is better.', 3),
(3, 2, 'Jaydon', 'Lots of Fun!', 5),
(4, 2, 'Matthew', 'This game is old.', 3),
(5, 3, 'Matthew', 'Best game in the World.', 5),
(6, 3, 'Jaydon', 'Overwatch is better', 3),
(7, 4, 'Jaydon', 'I fell asleep writing my other review.', 2),
(8, 4, 'Matthew', 'Good mobile game to play when out and about.', 4);
--
-- Constraints for dumped tables
--
--
-- Constraints for table `review`
--
ALTER TABLE `review`
ADD CONSTRAINT `review_ibfk_1` FOREIGN KEY (`game_id`) REFERENCES `game` (`id`);
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
IF EXISTS (SELECT * FROM sys.objects WHERE name = 'Game')
DROP TABLE Inventory.Game
GO
CREATE TABLE Inventory.Game
(
Id UNIQUEIDENTIFIER NOT NULL,
CreatedOn DATETIMEOFFSET NULL,
CreatedBy_Id UNIQUEIDENTIFIER NULL,
LastModifiedOn DATETIMEOFFSET NULL,
LastModifiedBy_Id UNIQUEIDENTIFIER NULL,
Name NVARCHAR(255) NOT NULL,
)
ALTER TABLE Inventory.Game
ADD PRIMARY KEY (Id) |
<gh_stars>0
CREATE TABLE `system_project`
(
`project_id` bigint NOT NULL auto_increment,
`project_name` varchar(200) NOT NULL COMMENT '项目名',
`project_code` varchar(200) NOT NULL COMMENT '项目编号',
PRIMARY KEY (`project_id`),
CONSTRAINT `system_project_project_code_uindex` UNIQUE (`project_code`)
);
CREATE TABLE `system_app`
(
`app_id` bigint NOT NULL auto_increment,
`app_name` varchar(200) NOT NULL COMMENT '应用名',
`app_code` varchar(200) NOT NULL COMMENT '应用编码',
`app_project_id` bigint NOT NULL COMMENT '项目id(外键)',
PRIMARY KEY (`app_id`),
CONSTRAINT `system_app_app_code_uindex` UNIQUE (`app_code`),
CONSTRAINT `system_app_project_id_fk` FOREIGN KEY (`app_project_id`) REFERENCES `system_project` (`project_id`)
);
CREATE TABLE `system_env`
(
`env_id` bigint NOT NULL auto_increment,
`env_name` varchar(200) NOT NULL COMMENT '环境名',
`env_code` varchar(200) NOT NULL COMMENT '环境编号',
`env_project_id` bigint NOT NULL COMMENT '项目id(外键)',
PRIMARY KEY (`env_id`),
CONSTRAINT `system_env_env_code_uindex` UNIQUE (`env_code`),
CONSTRAINT `system_env_project_id_fk` FOREIGN KEY (`env_project_id`) REFERENCES `system_project` (`project_id`)
);
CREATE TABLE `system_config`
(
`config_id` bigint NOT NULL auto_increment,
`config_name` varchar(200) NOT NULL COMMENT '配置名',
`config_env_id` bigint NOT NULL COMMENT '环境id(外键)',
PRIMARY KEY (`config_id`),
CONSTRAINT `system_config_env_id_fk` FOREIGN KEY (`config_env_id`) REFERENCES `system_env` (`env_id`)
);
CREATE TABLE `system_property`
(
`property_id` bigint NOT NULL auto_increment,
`property_key` varchar(200) NOT NULL COMMENT '属性名',
`property_value` varchar(2000) DEFAULT NULL COMMENT '属性值',
`property_type` varchar(50) DEFAULT NULL COMMENT 'STRING,INTEGER,BOOLEAN',
`property_config_id` bigint NOT NULL COMMENT '配置id(外键)',
PRIMARY KEY (`property_id`),
CONSTRAINT `system_property_config_id_fk` FOREIGN KEY (`property_config_id`) REFERENCES `system_config` (`config_id`)
);
CREATE TABLE `relationship_app_config`
(
`relationship_app_id` bigint NOT NULL,
`relationship_config_id` bigint NOT NULL,
PRIMARY KEY (`relationship_app_id`, `relationship_config_id`),
CONSTRAINT `relationship_app_config_app_id_fk` FOREIGN KEY (`relationship_app_id`) REFERENCES `system_app` (`app_id`),
CONSTRAINT `relationship_app_config_config_id_fk` FOREIGN KEY (`relationship_config_id`) REFERENCES `system_config` (`config_id`)
); |
SELECT
qtd.id as hide_id,
qtd.lft as hide_lft,
qtd.rgt as hide_rgt,
qtd.name as Name,
(
SELECT COUNT(*)
FROM tickets
WHERE created_at
BETWEEN CURDATE() - INTERVAL DAYOFWEEK(CURDATE())+6 DAY
AND CURDATE() - INTERVAL DAYOFWEEK(CURDATE())-1 DAY
AND dept_id = qtd.id
AND deleted_at IS NULL
) AS Created,
(
SELECT COUNT(*)
FROM depts td
LEFT JOIN tickets t ON td.id = t.dept_id
WHERE t.created_at
BETWEEN CURDATE() - INTERVAL DAYOFWEEK(CURDATE())+6 DAY
AND CURDATE() - INTERVAL DAYOFWEEK(CURDATE())-1 DAY
AND t.deleted_at IS NULL
) AS hide_total_created,
(
SELECT COUNT(*)
FROM tickets
WHERE closed_at
BETWEEN CURDATE() - INTERVAL DAYOFWEEK(CURDATE())+6 DAY
AND CURDATE() - INTERVAL DAYOFWEEK(CURDATE())-1 DAY
AND dept_id = qtd.id
AND deleted_at IS NULL
) AS Closed,
(
SELECT COUNT(*)
FROM depts td
LEFT JOIN tickets t ON td.id = t.dept_id
WHERE t.closed_at
BETWEEN CURDATE() - INTERVAL DAYOFWEEK(CURDATE())+6 DAY
AND CURDATE() - INTERVAL DAYOFWEEK(CURDATE())-1 DAY
AND t.deleted_at IS NULL
) AS hide_total_closed,
(
SELECT COUNT(*)
FROM tickets
WHERE (
closed_at > CURDATE() - INTERVAL DAYOFWEEK(CURDATE())-1 DAY
OR closed_at IS NULL
)
AND dept_id = qtd.id
AND deleted_at IS NULL
) AS 'Open/Closed',
(
SELECT COUNT(*)
FROM tickets t
LEFT JOIN depts td ON td.id = t.dept_id
WHERE t.created_at < CURDATE() - INTERVAL DAYOFWEEK(CURDATE())-1 DAY
AND (
t.closed_at > CURDATE() - INTERVAL DAYOFWEEK(CURDATE())-1 DAY
OR t.closed_at IS NULL
)
AND t.deleted_at IS NULL
) AS hide_total_open_new,
SUM(
CASE
WHEN qta.created_at
BETWEEN CURDATE() - INTERVAL DAYOFWEEK(CURDATE())+6 DAY
AND CURDATE() - INTERVAL DAYOFWEEK(CURDATE())-1 DAY
AND qta.deleted_at IS NULL
THEN qta.time_spent
ELSE
0
END
) AS 'Time Spent',
(
SELECT SUM(ta.time_spent)
FROM ticket_actions ta
LEFT JOIN tickets t ON t.id = ta.ticket_id
LEFT JOIN depts td ON td.id = t.dept_id
WHERE ta.created_at
BETWEEN CURDATE() - INTERVAL DAYOFWEEK(CURDATE())+6 DAY
AND CURDATE() - INTERVAL DAYOFWEEK(CURDATE())-1 DAY
AND ta.deleted_at IS NULL
) AS hide_total_worked_hrs
FROM depts AS qtd
LEFT OUTER JOIN tickets AS qt ON qtd.id = qt.dept_id
LEFT JOIN ticket_actions qta ON qta.ticket_id = qt.id
GROUP BY qtd.id
ORDER BY qtd.lft ASC; |
<gh_stars>1-10
CREATE DATABASE IF NOT EXISTS `tshirt-mockup` /*!40100 DEFAULT CHARACTER SET utf8 */;
USE `tshirt-mockup`;
-- MySQL dump 10.13 Distrib 5.6.23, for Win64 (x86_64)
--
-- Host: 127.0.0.1 Database: tshirt-mockup
-- ------------------------------------------------------
-- Server version 5.5.41-log
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `addresses`
--
DROP TABLE IF EXISTS `addresses`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `addresses` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`street` varchar(45) DEFAULT NULL,
`city` varchar(45) DEFAULT NULL,
`state` varchar(2) DEFAULT NULL,
`zipcode` int(11) DEFAULT NULL,
`created_at` datetime DEFAULT NULL,
`updated_at` datetime DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=28 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `addresses`
--
LOCK TABLES `addresses` WRITE;
/*!40000 ALTER TABLE `addresses` DISABLE KEYS */;
INSERT INTO `addresses` VALUES (1,'1234 Main Street','Los Angeles','CA',91607,NULL,NULL),(24,'4567 Oak Street','Newtown','FL',90001,NULL,NULL),(25,'3456 1st Street','Austin','TX',90001,NULL,NULL),(26,'817 N. Vine Street','Hollywood','CA',90000,NULL,NULL),(27,'633 Canoga Ave','Woodland Hills','CA',91111,NULL,NULL);
/*!40000 ALTER TABLE `addresses` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `categories`
--
DROP TABLE IF EXISTS `categories`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `categories` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(45) DEFAULT NULL,
`description` text,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `categories`
--
LOCK TABLES `categories` WRITE;
/*!40000 ALTER TABLE `categories` DISABLE KEYS */;
/*!40000 ALTER TABLE `categories` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `categories_has_products`
--
DROP TABLE IF EXISTS `categories_has_products`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `categories_has_products` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`category_id` int(11) NOT NULL,
`product_id` int(11) NOT NULL,
PRIMARY KEY (`id`,`category_id`,`product_id`),
KEY `fk_categories_has_products_products1_idx` (`product_id`),
KEY `fk_categories_has_products_categories1_idx` (`category_id`),
CONSTRAINT `fk_categories_has_products_categories1` FOREIGN KEY (`category_id`) REFERENCES `categories` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_categories_has_products_products1` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `categories_has_products`
--
LOCK TABLES `categories_has_products` WRITE;
/*!40000 ALTER TABLE `categories_has_products` DISABLE KEYS */;
/*!40000 ALTER TABLE `categories_has_products` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `inventories`
--
DROP TABLE IF EXISTS `inventories`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `inventories` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`small_w` int(11) DEFAULT NULL,
`medium_w` int(11) DEFAULT NULL,
`large_w` int(11) DEFAULT NULL,
`xlarge_w` int(11) DEFAULT NULL,
`small_m` int(11) DEFAULT NULL,
`medium_m` int(11) DEFAULT NULL,
`large_m` int(11) DEFAULT NULL,
`xlarge_m` int(11) DEFAULT NULL,
`created_at` datetime DEFAULT NULL,
`updated_at` datetime DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `inventories`
--
LOCK TABLES `inventories` WRITE;
/*!40000 ALTER TABLE `inventories` DISABLE KEYS */;
INSERT INTO `inventories` VALUES (1,100,100,100,100,100,100,100,100,'2016-02-25 11:24:00','2016-02-25 11:24:00'),(2,111,111,111,111,111,111,111,111,'2016-02-25 11:26:00','2016-02-25 11:26:00'),(3,222,222,222,222,222,222,222,222,'2016-02-25 11:26:00','2016-02-25 11:26:00'),(4,44,44,44,44,44,44,44,44,'2016-02-25 11:26:00','2016-02-25 11:26:00'),(5,100,100,100,100,100,100,100,100,'2016-02-28 21:51:20','2016-02-28 21:51:20'),(6,100,100,100,100,100,100,100,100,'2016-02-28 21:51:20','2016-02-28 21:51:20'),(7,100,100,100,100,100,100,100,100,'2016-02-28 21:51:21','2016-02-28 21:51:21'),(8,100,100,100,100,100,100,100,100,'2016-02-28 21:51:21','2016-02-28 21:51:21'),(9,100,100,100,100,100,100,100,100,'2016-02-28 21:51:21','2016-02-28 21:51:21'),(10,100,100,100,100,100,100,100,100,'2016-02-28 21:51:21','2016-02-28 21:51:21'),(11,100,100,100,100,100,100,100,100,'2016-02-28 22:14:28','2016-02-28 22:14:28');
/*!40000 ALTER TABLE `inventories` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `orders`
--
DROP TABLE IF EXISTS `orders`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `orders` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`tracking_num` varchar(45) DEFAULT NULL,
`user_id` int(11) NOT NULL,
`addresses_id` int(11) NOT NULL,
`created_at` datetime DEFAULT NULL,
`updated_at` datetime DEFAULT NULL,
`transaction_id` varchar(45) DEFAULT NULL,
`paid` tinyint(4) DEFAULT NULL,
`price` decimal(5,2) DEFAULT NULL,
PRIMARY KEY (`id`,`user_id`,`addresses_id`),
KEY `fk_orders_users1_idx` (`user_id`),
KEY `fk_orders_addresses1_idx` (`addresses_id`),
CONSTRAINT `fk_orders_users1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=28 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `orders`
--
LOCK TABLES `orders` WRITE;
/*!40000 ALTER TABLE `orders` DISABLE KEYS */;
INSERT INTO `orders` VALUES (24,'0',6,24,'2016-03-02 22:53:09','2016-03-02 22:53:09','ch_17khu5E9uRZbbBoewo19PZgH',1,32.00),(25,'0',6,25,'2016-03-02 22:53:42','2016-03-02 22:53:42','ch_17khucE9uRZbbBoe9rBL591e',1,52.00),(26,'0',7,26,'2016-03-02 23:03:47','2016-03-02 23:03:47','ch_17ki4ME9uRZbbBoesWctQQop',1,66.00),(27,'0',10,27,'2016-03-02 23:47:18','2016-03-02 23:47:18','ch_17kikUE9uRZbbBoeKmT1l6cH',1,78.00);
/*!40000 ALTER TABLE `orders` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `payment`
--
DROP TABLE IF EXISTS `payment`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `payment` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`transaction_id` varchar(45) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `payment`
--
LOCK TABLES `payment` WRITE;
/*!40000 ALTER TABLE `payment` DISABLE KEYS */;
/*!40000 ALTER TABLE `payment` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `products`
--
DROP TABLE IF EXISTS `products`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `products` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(45) DEFAULT NULL,
`description` text,
`price` decimal(5,2) DEFAULT NULL,
`sale` tinyint(1) DEFAULT NULL,
`size` varchar(45) DEFAULT NULL,
`created_at` datetime DEFAULT NULL,
`updated_at` datetime DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=24 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `products`
--
LOCK TABLES `products` WRITE;
/*!40000 ALTER TABLE `products` DISABLE KEYS */;
INSERT INTO `products` VALUES (1,'Red Belt','A super lucky red shirt, for the lucky Red Belt graduates',19.98,NULL,NULL,'2016-02-25 11:24:00','2016-02-25 11:24:00'),(2,'White Belt','A simple shirt, with a white-belt ninja.',9.99,NULL,NULL,'2016-02-25 11:24:00','2016-02-25 11:24:00'),(3,'Mystery Shirt','What could this shirt be??',999.97,NULL,NULL,'2016-02-25 11:24:00','2016-02-25 11:24:00'),(4,'Coding Dojo','An amazing black CodingDojo black shirt! Perfect for Coding Dojo alumni!',19.99,NULL,NULL,'2016-02-25 11:24:00','2016-02-25 11:24:00'),(5,'Honey Badger Don\'t Care','What does a honey badger do? Well, they certainly don\'t care. Show off your honey badger attitude with this lovely black shirt.',19.99,NULL,NULL,'2016-02-28 21:58:03','2016-02-28 21:58:03'),(6,'I\'m on the Ninja Diet','Ninja turtles are known for their stealth, humor, and love of pizza. Do you love pizza? Then you should love this shirt.',24.99,NULL,NULL,'2016-02-28 21:58:03','2016-02-28 21:58:03'),(7,'#TeamEduardo','Show the world who your favorite coding master is by wearing this trendy green shirt!',29.99,NULL,NULL,'2016-02-28 21:58:03','2016-02-28 21:58:03'),(8,'#TeamLance','Show the world who your favorite coding master is by wearing this trendy blue shirt!',29.99,NULL,NULL,'2016-02-28 21:58:04','2016-02-28 21:58:04'),(9,'#TeamChris','Show the world who your favorite coding master is by wearing this trendy red shirt!',29.99,NULL,NULL,'2016-02-28 21:58:04','2016-02-28 21:58:04'),(10,'#TeamKelvin','Show the world who your favorite coding master is by wearing this trendy black shirt!',29.99,NULL,NULL,'2016-02-28 21:58:04','2016-02-28 21:58:04'),(11,'Yellow Belt','The Yellow belt is earned for the first exam taken at the Dojo. Why not put the Yellow Belt ninja on a bright blue shirt?',12.99,NULL,NULL,'2016-02-28 22:15:48','2016-02-28 22:15:48'),(12,'Ninja, Please','Ninja, please! Wear your sass on your shirt with this cool white tee!',14.49,NULL,NULL,'2016-03-03 19:28:00','2016-03-03 19:28:00');
/*!40000 ALTER TABLE `products` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `products_has_orders`
--
DROP TABLE IF EXISTS `products_has_orders`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `products_has_orders` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`product_id` int(11) NOT NULL,
`order_id` int(11) NOT NULL,
`qty` int(11) DEFAULT NULL,
`size` varchar(45) DEFAULT NULL,
PRIMARY KEY (`id`,`product_id`,`order_id`),
KEY `fk_products_has_orders_products1_idx` (`product_id`),
KEY `fk_products_has_orders_orders1_idx` (`order_id`),
CONSTRAINT `fk_products_has_orders_products1` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=32 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `products_has_orders`
--
LOCK TABLES `products_has_orders` WRITE;
/*!40000 ALTER TABLE `products_has_orders` DISABLE KEYS */;
INSERT INTO `products_has_orders` VALUES (23,1,24,1,'small_w'),(24,2,24,1,'medium_m'),(25,1,24,1,'xlarge_w'),(26,1,25,1,'small_w'),(27,3,26,1,'small_w'),(28,2,26,2,'medium_w'),(29,1,26,4,'large_m'),(30,1,27,1,'small_w'),(31,2,27,1,'small_w');
/*!40000 ALTER TABLE `products_has_orders` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `users`
--
DROP TABLE IF EXISTS `users`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `users` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`first_name` varchar(45) DEFAULT NULL,
`last_name` varchar(45) DEFAULT NULL,
`email` varchar(255) DEFAULT NULL,
`password` varchar(45) DEFAULT NULL,
`is_admin` tinyint(1) DEFAULT NULL,
`created_at` datetime DEFAULT NULL,
`updated_at` datetime DEFAULT NULL,
`customer_id` varchar(45) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `users`
--
LOCK TABLES `users` WRITE;
/*!40000 ALTER TABLE `users` DISABLE KEYS */;
INSERT INTO `users` VALUES (1,'Pete','Kang','<EMAIL>','<PASSWORD>',1,'2016-02-10 18:45:24',NULL,NULL),(6,'David','Macias','<EMAIL>','<PASSWORD>',1,'2016-03-01 22:07:48','2016-03-01 13:32:46','cus_80LoxefHaaIcnT'),(7,'David','Macias','<EMAIL>','<PASSWORD>',0,'2016-03-02 04:43:49','2016-03-01 19:44:20','cus_80Roucd1Ed6HKy'),(9,'Fake','User','<EMAIL>','5f4dcc3b5aa765d61d8327deb882cf99',0,'2016-03-02 08:35:25','2016-03-01 23:36:41','cus_80VYMyjVbsKUZv'),(10,'Johnny','User','<EMAIL>','5f4dcc3b5aa765d61d8327deb882cf99',0,'2016-03-02 23:46:47','2016-03-02 14:47:17','cus_80kEkaH4yPfqUN'),(11,'Samir','Sam','<EMAIL>','5f4dcc3b5aa765d61d8327deb882cf99',0,'2016-03-04 16:53:46','2016-03-04 16:53:46','0');
/*!40000 ALTER TABLE `users` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2016-03-04 12:20:05
|
<reponame>IndyHurt/poi-stats<gh_stars>1-10
-- Create a table of stadium polygons that are larger than 2000 square meters
drop table if exists stadium_polygons;
create table stadium_polygons as select osm_id, name, building, landuse, leisure, sport, tags, way from planet_osm_polygon where (osm_id > 0 and way_area > 2000) and (leisure = 'stadium' or building = 'stadium');
-- Create a table of stadium polygons that are larger than 2000 square meters new or modified since post
drop table if exists stadium_polygons_new;
create table stadium_polygons_new as select osm_id, name, building, landuse, leisure, sport, tags, way from planet_osm_polygon where (osm_id > 0 and way_area > 2000) and (leisure = 'stadium' or building = 'stadium') and osm_timestamp > '2016-02-04 14:00:00-08';
-- Create a table of parking polygons
drop table if exists parking_polygons;
create table parking_polygons as select osm_id, name, landuse, amenity, tags, way from planet_osm_polygon where osm_id > 0 and amenity = 'parking';
-- Create a table of parking polygons new or modified since post
drop table if exists parking_polygons_new;
create table parking_polygons_new as select osm_id, name, landuse, amenity, tags, way from planet_osm_polygon where osm_id > 0 and amenity = 'parking' and osm_timestamp > '2016-02-04 14:00:00-08';
-- Create a table of parking aisles
drop table if exists parking_aisles;
create table parking_aisles as select osm_id, name, amenity, highway, service, tags, way from planet_osm_line where osm_id > 0 and service = 'parking_aisle';
-- Create a table of parking aisles new or modified since post
drop table if exists parking_aisles_new;
create table parking_aisles_new as select osm_id, name, amenity, highway, service, tags, way from planet_osm_line where osm_id > 0 and service = 'parking_aisle' and osm_timestamp > '2016-02-04 14:00:00-08';
-- Create indices to speed up queries
analyze parking_polygons;
analyze stadium_polygons;
create index parking_polygons_gist_idx on parking_polygons using gist(way);
create index parking_aisles_gist_idx on parking_aisles using gist(way);
-- Create indices to speed up queries for new or modified since post
analyze parking_polygons_new;
analyze stadium_polygons_new;
create index parking_polygons_gist_idx_new on parking_polygons_new using gist(way);
create index parking_aisles_gist_idx_new on parking_aisles_new using gist(way);
-- Create a table of stadiums that do not have any parking polygons within 100 meters (about 330 ft)
drop table if exists stadiums_without_nearby_parking;
create table stadiums_without_nearby_parking as
SELECT stadium_polygons.name as stadium_name, parking_polygons.name as parking_name
FROM stadium_polygons LEFT JOIN parking_polygons
ON ST_DWithin(stadium_polygons.way, parking_polygons.way, 100)
WHERE parking_polygons.osm_id IS NULL;
-- Create a table of stadiums that do not have any parking polygons within 100 meters (about 330 ft) considering new or modified since post
drop table if exists stadiums_without_nearby_parking_new;
create table stadiums_without_nearby_parking_new as
SELECT stadium_polygons_new.name as stadium_name_new, parking_polygons_new.name as parking_name_new
FROM stadium_polygons_new LEFT JOIN parking_polygons_new
ON ST_DWithin(stadium_polygons_new.way, parking_polygons_new.way, 100)
WHERE parking_polygons_new.osm_id IS NULL;
-- Create a table of stadiums that do not have any parking polygons with parking aisles within 100 meters (about 330 ft)
drop table if exists stadiums_without_nearby_parking_aisles;
create table stadiums_without_nearby_parking_aisles as
SELECT stadium_polygons.name as stadium_name, parking_aisles.name as parking_aisle_name
FROM stadium_polygons LEFT JOIN parking_aisles
ON ST_DWithin(stadium_polygons.way, parking_aisles.way, 100)
WHERE parking_aisles.osm_id IS NULL;
-- Create a table of stadiums that do not have any parking polygons with parking aisles within 100 meters (about 330 ft) considering new or modified since post
drop table if exists stadiums_without_nearby_parking_aisles_new;
create table stadiums_without_nearby_parking_aisles_new as
SELECT stadium_polygons_new.name as stadium_name_new, parking_aisles_new.name as parking_aisle_name_new
FROM stadium_polygons_new LEFT JOIN parking_aisles_new
ON ST_DWithin(stadium_polygons_new.way, parking_aisles_new.way, 100)
WHERE parking_aisles_new.osm_id IS NULL;
-- Create a table of parking polygon counts near stadiums that have been added or edited since the post
drop table if exists stadiums_new_parking;
create table stadiums_new_parking as
SELECT count(*) as new_stadium_parking
FROM stadium_polygons LEFT JOIN parking_polygons_new
ON ST_DWithin(stadium_polygons.way, parking_polygons_new.way, 100)
WHERE parking_polygons_new.osm_id IS NOT NULL;
-- Create a table of parking aisle counts near stadiums that have been added or edited since the post
drop table if exists stadiums_new_parking_aisles;
create table stadiums_new_parking_aisles as
SELECT count(*) as new_stadium_parking_aisles
FROM stadium_polygons LEFT JOIN parking_aisles_new
ON ST_DWithin(stadium_polygons.way, parking_aisles_new.way, 100)
WHERE parking_aisles_new.osm_id IS NOT NULL;
-- Create a table to store the number of stadiums and percentages with parking and parking aisles
drop table if exists stadium_eval;
create table stadium_eval (query_name text, value real);
insert into stadium_eval (query_name, value) values ('stadium_polygons', (select count (*) from stadium_polygons));
insert into stadium_eval (query_name, value) values ('stadium_without_parking_nearby', (select count(*) from stadiums_without_nearby_parking));
insert into stadium_eval (query_name, value) values ('stadium_without_parking_aisles_nearby', (select count(*) from stadiums_without_nearby_parking_aisles));
insert into stadium_eval (query_name, value) values ('stadium_with_nearby_parking_pct', ((1 -(select value from stadium_eval where query_name = 'stadium_without_parking_nearby')/(select value from stadium_eval where query_name = 'stadium_polygons'))*100));
insert into stadium_eval (query_name, value) values ('stadium_with_nearby_parking_aisles_pct', ((1 -(select value from stadium_eval where query_name = 'stadium_without_parking_aisles_nearby')/(select value from stadium_eval where query_name = 'stadium_polygons'))*100));
insert into stadium_eval (query_name, value) values ('stadium_polygons_new', (select count (*) from stadium_polygons_new));
insert into stadium_eval (query_name, value) values ('stadium_without_parking_nearby_new', (select count(*) from stadiums_without_nearby_parking_new));
insert into stadium_eval (query_name, value) values ('stadium_without_parking_aisles_nearby_new', (select count(*) from stadiums_without_nearby_parking_aisles_new));
insert into stadium_eval (query_name, value) values ('stadium_with_nearby_parking_pct_new', ((1 -(select value from stadium_eval where query_name = 'stadium_without_parking_nearby_new')/(select value from stadium_eval where query_name = 'stadium_polygons_new'))*100));
insert into stadium_eval (query_name, value) values ('stadium_with_nearby_parking_aisles_pct_new', ((1 -(select value from stadium_eval where query_name = 'stadium_without_parking_aisles_nearby_new')/(select value from stadium_eval where query_name = 'stadium_polygons_new'))*100));
insert into stadium_eval (query_name, value) values ('stadiums_new_parking', (select new_stadium_parking from stadiums_new_parking));
insert into stadium_eval (query_name, value) values ('stadiums_new_parking_aisles', (select new_stadium_parking_aisles from stadiums_new_parking_aisles));
select * from stadium_eval; |
DROP VIEW rpt_purchase_by_currency ;
DROP VIEW rpt_purchase_by_currency_date ;
CREATE OR REPLACE VIEW rpt_purchase_by_currency AS
SELECT
assets.code,
purchase.charge_currency,
sum(transactions.amount) as total_charge,
avg(transactions.amount) as average_charge,
count(purchase.id) as num_purchases,
min(transactions.amount) as smallest_charge,
max(transactions.amount) as largest_charge,
sum(purchase.quantity) as amount,
count(distinct user_id) as num_buyers
FROM
purchase
INNER JOIN transactions USING (id)
INNER JOIN assets ON (asset_id = assets.id)
WHERE
state_id = 2
GROUP BY
code, charge_currency;
CREATE OR REPLACE VIEW rpt_purchase_by_currency_date AS
SELECT
assets.code,
charge_currency,
to_char(transactions.transaction_time, 'yyyy-MM-dd') as date,
sum(amount) as total_charge,
avg(amount) as average_charge,
count(purchase.id) as num_purchases,
min(amount) as smallest_charge,
max(amount) as largest_charge,
sum(quantity) as amount,
count(distinct user_id) as num_buyers
FROM
purchase
INNER JOIN transactions USING (id)
INNER JOIN assets ON (asset_id = assets.id)
WHERE
state_id = 2
GROUP BY
code, charge_currency, date
ORDER BY
date;
|
Create Table dbo.SiteSettings
(
Id Int Identity(1, 1) Primary Key Not Null,
ShowMenu1 Bit Default(0), -- false : 숨김, true(1) : 보임
ShowMenu2 Bit Default(0),
ShowMenu3 Bit Default(0),
ShowMenu4 Bit Default(0),
ShowMenu5 Bit Default(0),
ShowMenu6 Bit Default(0),
ShowMenu7 Bit Default(0)
)
Go
|
<filename>databases/req-ta-learning.sql
-- phpMyAdmin SQL Dump
-- version 5.1.0
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Apr 10, 2021 at 04:43 AM
-- Server version: 10.4.18-MariaDB
-- PHP Version: 7.4.16
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `req-ta-learning`
--
-- --------------------------------------------------------
--
-- Table structure for table `data_guru`
--
CREATE TABLE `data_guru` (
`id_guru` int(11) NOT NULL,
`id_profile` int(11) NOT NULL,
`nama_lengkap` varchar(75) NOT NULL,
`gender` enum('L','P') DEFAULT NULL,
`asal_sekolah` varchar(75) NOT NULL,
`penddikan` varchar(75) DEFAULT NULL,
`email` varchar(75) NOT NULL,
`telp` varchar(15) NOT NULL,
`foto` varchar(60) DEFAULT NULL,
`created_at` datetime NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `data_kuis_jawaban`
--
CREATE TABLE `data_kuis_jawaban` (
`id_kuis_jawaban` int(11) NOT NULL,
`id_kuis_soal` int(11) NOT NULL,
`isi` varchar(250) NOT NULL,
`media_jawaban` varchar(75) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `data_kuis_soal`
--
CREATE TABLE `data_kuis_soal` (
`id_kuis_soal` int(11) NOT NULL,
`id_materi` int(11) NOT NULL,
`id_profile` int(11) NOT NULL,
`soal` text NOT NULL,
`media` varchar(75) DEFAULT NULL,
`poin` int(11) NOT NULL,
`jawaban` enum('a','b','c','d','e') NOT NULL,
`created_at` datetime DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `data_materi`
--
CREATE TABLE `data_materi` (
`id_materi` int(11) NOT NULL,
`id_guru_mapel` int(11) NOT NULL,
`judul` varchar(50) NOT NULL,
`deskripsi` text NOT NULL,
`media` varchar(75) DEFAULT NULL,
`tanggal` datetime NOT NULL,
`materi_status` enum('draft','publish') NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `data_materi_komentar`
--
CREATE TABLE `data_materi_komentar` (
`id_komentar` int(11) NOT NULL,
`id_profile` int(11) NOT NULL,
`komentar` varchar(250) NOT NULL,
`created_at` datetime NOT NULL DEFAULT current_timestamp(),
`id_materi` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `data_materi_waktuakses`
--
CREATE TABLE `data_materi_waktuakses` (
`id_materi_waktuakses` int(11) NOT NULL,
`id_materi` int(11) NOT NULL,
`id_siswa` int(11) NOT NULL,
`waktu` int(11) NOT NULL,
`created_at` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `data_rekap_jawaban`
--
CREATE TABLE `data_rekap_jawaban` (
`id_rekapjawaban` int(11) NOT NULL,
`id_siswa` int(11) NOT NULL,
`id_kuis_soal` int(11) NOT NULL,
`id_kuis_jawaban` int(11) NOT NULL,
`created_at` datetime NOT NULL DEFAULT current_timestamp(),
`media` varchar(75) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `data_siswa`
--
CREATE TABLE `data_siswa` (
`id_siswa` int(11) NOT NULL,
`id_profile` int(11) NOT NULL,
`nama_lengkap` varchar(75) NOT NULL,
`gender` enum('L','P') NOT NULL,
`domisili` varchar(120) NOT NULL,
`tanggal_lahir` date NOT NULL,
`email` varchar(75) NOT NULL,
`telp` varchar(15) NOT NULL,
`alamat` varchar(100) NOT NULL,
`pendidikan_sekarang` enum('SD','SMP','SMA','Universitas','Umum') NOT NULL,
`asal_sekolah` varchar(75) NOT NULL,
`foto` varchar(75) NOT NULL,
`created_at` datetime NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `guru_mapel`
--
CREATE TABLE `guru_mapel` (
`id_guru_mapel` int(11) NOT NULL,
`id_guru` int(11) NOT NULL,
`id_mapel_kategori` int(11) NOT NULL,
`id_mapel_subkategori` int(11) NOT NULL,
`status` enum('aktif','nonaktif') NOT NULL,
`created_at` datetime NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `mapel_kategori`
--
CREATE TABLE `mapel_kategori` (
`id_mapel_kategori` int(11) NOT NULL,
`nama` varchar(50) NOT NULL,
`status` enum('aktif','nonaktif') NOT NULL,
`created_at` datetime NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `mapel_subkategori`
--
CREATE TABLE `mapel_subkategori` (
`id_mapel_subkategori` int(11) NOT NULL,
`id_mapel_kategori` int(11) NOT NULL,
`name` varchar(75) NOT NULL,
`status` enum('aktif','nonaktif') NOT NULL,
`created_at` datetime NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `profile`
--
CREATE TABLE `profile` (
`id_profile` int(11) NOT NULL,
`username` varchar(64) NOT NULL,
`password` varchar(70) NOT NULL,
`hak_akses` enum('superadmin','guru','siswa') NOT NULL,
`status_akun` enum('aktif','nonaktif') NOT NULL,
`status_2fa` enum('aktif','nonaktif') NOT NULL,
`code_2fa` varchar(6) DEFAULT NULL,
`last_logged` datetime NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Indexes for dumped tables
--
--
-- Indexes for table `data_guru`
--
ALTER TABLE `data_guru`
ADD PRIMARY KEY (`id_guru`,`asal_sekolah`),
ADD KEY `id_profile` (`id_profile`);
--
-- Indexes for table `data_kuis_jawaban`
--
ALTER TABLE `data_kuis_jawaban`
ADD PRIMARY KEY (`id_kuis_jawaban`),
ADD KEY `id_kuis_soal` (`id_kuis_soal`);
--
-- Indexes for table `data_kuis_soal`
--
ALTER TABLE `data_kuis_soal`
ADD PRIMARY KEY (`id_kuis_soal`),
ADD KEY `id_profile` (`id_profile`),
ADD KEY `id_materi` (`id_materi`);
--
-- Indexes for table `data_materi`
--
ALTER TABLE `data_materi`
ADD PRIMARY KEY (`id_materi`),
ADD KEY `id_guru_mapel` (`id_guru_mapel`);
--
-- Indexes for table `data_materi_komentar`
--
ALTER TABLE `data_materi_komentar`
ADD PRIMARY KEY (`id_komentar`),
ADD KEY `id_profile` (`id_profile`),
ADD KEY `id_materi` (`id_materi`);
--
-- Indexes for table `data_materi_waktuakses`
--
ALTER TABLE `data_materi_waktuakses`
ADD PRIMARY KEY (`id_materi_waktuakses`),
ADD KEY `id_materi` (`id_materi`),
ADD KEY `id_siswa` (`id_siswa`),
ADD KEY `waktu` (`waktu`);
--
-- Indexes for table `data_rekap_jawaban`
--
ALTER TABLE `data_rekap_jawaban`
ADD PRIMARY KEY (`id_rekapjawaban`),
ADD KEY `id_kuis_soal` (`id_kuis_soal`),
ADD KEY `id_kuis_jawaban` (`id_kuis_jawaban`),
ADD KEY `id_siswa` (`id_siswa`);
--
-- Indexes for table `data_siswa`
--
ALTER TABLE `data_siswa`
ADD PRIMARY KEY (`id_siswa`),
ADD KEY `id_profile` (`id_profile`);
--
-- Indexes for table `guru_mapel`
--
ALTER TABLE `guru_mapel`
ADD PRIMARY KEY (`id_guru_mapel`),
ADD KEY `id_guru` (`id_guru`),
ADD KEY `id_mapel_kategori` (`id_mapel_kategori`),
ADD KEY `id_mapel_subkategori` (`id_mapel_subkategori`);
--
-- Indexes for table `mapel_kategori`
--
ALTER TABLE `mapel_kategori`
ADD PRIMARY KEY (`id_mapel_kategori`);
--
-- Indexes for table `mapel_subkategori`
--
ALTER TABLE `mapel_subkategori`
ADD PRIMARY KEY (`id_mapel_subkategori`),
ADD KEY `id_mapel_kategori` (`id_mapel_kategori`);
--
-- Indexes for table `profile`
--
ALTER TABLE `profile`
ADD PRIMARY KEY (`id_profile`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `data_guru`
--
ALTER TABLE `data_guru`
MODIFY `id_guru` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `data_kuis_jawaban`
--
ALTER TABLE `data_kuis_jawaban`
MODIFY `id_kuis_jawaban` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `data_kuis_soal`
--
ALTER TABLE `data_kuis_soal`
MODIFY `id_kuis_soal` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `data_materi`
--
ALTER TABLE `data_materi`
MODIFY `id_materi` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `data_materi_komentar`
--
ALTER TABLE `data_materi_komentar`
MODIFY `id_komentar` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `data_materi_waktuakses`
--
ALTER TABLE `data_materi_waktuakses`
MODIFY `id_materi_waktuakses` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `data_rekap_jawaban`
--
ALTER TABLE `data_rekap_jawaban`
MODIFY `id_rekapjawaban` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `data_siswa`
--
ALTER TABLE `data_siswa`
MODIFY `id_siswa` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `guru_mapel`
--
ALTER TABLE `guru_mapel`
MODIFY `id_guru_mapel` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `mapel_kategori`
--
ALTER TABLE `mapel_kategori`
MODIFY `id_mapel_kategori` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `mapel_subkategori`
--
ALTER TABLE `mapel_subkategori`
MODIFY `id_mapel_subkategori` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `profile`
--
ALTER TABLE `profile`
MODIFY `id_profile` int(11) NOT NULL AUTO_INCREMENT;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `data_guru`
--
ALTER TABLE `data_guru`
ADD CONSTRAINT `data_guru_ibfk_1` FOREIGN KEY (`id_profile`) REFERENCES `profile` (`id_profile`);
--
-- Constraints for table `data_materi_komentar`
--
ALTER TABLE `data_materi_komentar`
ADD CONSTRAINT `data_materi_komentar_ibfk_1` FOREIGN KEY (`id_profile`) REFERENCES `profile` (`id_profile`);
--
-- Constraints for table `data_siswa`
--
ALTER TABLE `data_siswa`
ADD CONSTRAINT `data_siswa_ibfk_1` FOREIGN KEY (`id_profile`) REFERENCES `profile` (`id_profile`);
--
-- Constraints for table `guru_mapel`
--
ALTER TABLE `guru_mapel`
ADD CONSTRAINT `guru_mapel_ibfk_1` FOREIGN KEY (`id_mapel_kategori`) REFERENCES `mapel_kategori` (`id_mapel_kategori`);
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
\echo # filling table data.team (3)
COPY data.team (nickname,updated_at,created_at) FROM STDIN (ENCODING 'utf-8', FREEZE ON);
bright-fog 2016-12-27 15:00:00 2016-12-27 14:55:50
damp-pond 2016-12-27 15:00:00 2016-12-27 12:00:00
hazy-mountain 2016-12-27 15:00:00 2016-12-27 12:00:00
\.
-- Add users to teeams
UPDATE data.user SET team_nickname = 'bright-fog' WHERE id=1;
UPDATE data.user SET team_nickname = 'hazy-mountain' WHERE id=2;
UPDATE data.user SET team_nickname = 'bright-fog' WHERE id=3;
-- analyze modified tables
ANALYZE data.team;
|
-- file:cluster.sql ln:235 expect:true
DROP TABLE clstr_4
|
CREATE INDEX "IDX_TAXONOMY_SCIENTIFICNAMEID" ON "TAXONOMY" ("SCIENTIFICNAMEID")
|
library OpioidCDSREC10 version '2.0.0'
using FHIR version '4.0.0'
include FHIRHelpers version '4.0.0' called FHIRHelpers
include OpioidCDSCommon version '2.0.0' called Common
include OpioidCDSRoutines version '2.0.0' called Routines
/*
** Recommendation #10
** When prescribing opioids for chronic pain, providers should use urine drug
** testing before starting opioid therapy and consider urine drug testing at
** least annually to assess for prescribed medications as well as other controlled
** prescription drugs and illicit drugs (recommendation category: B, evidence type: 4)
**
** When
** Provider is prescribing an opioid analgesic with ambulatory misuse potential in the outpatient setting
** Prescription is for treating chronic pain.
** Opioid review is useful for this patient:
** Patient is 18 or over
** Patient does not have findings indicating limited life expectancy
** Patient does not have orders for therapies indicating end of life care
** Patient is not undergoing active cancer treatment:
** Patient has had at least 2 encounters within the past year with any diagnosis of cancer
** Urine drug screening has not been performed in last 12 months
** Then
** Recommend urine drug screening
** Will perform urine screening
** Not for chronic pain management, snooze 3 months
** N/A - see comment, snooze 3 months
**
*/
// META: Plan Definition: http://fhir.org/guides/cdc/opioid-cds-r4/PlanDefinition/opioid-cds-10
parameter ContextPrescriptions List<MedicationRequest>
context Patient
define "Lookback Year":
Interval[Today() - 12 months - 1 days, Today() - 1 day]
define "Chronic Pain Opioid Analgesic with Ambulatory Misuse Potential Prescriptions":
( Common."Is Opioid Analgesic with Ambulatory Misuse Potential?"( ContextPrescriptions ) ) AmbulatoryOpioidPrescription
where Routines."Is Chronic Pain Prescription?"( AmbulatoryOpioidPrescription )
define "Patient Is Being Prescribed Opioid Analgesic with Ambulatory Misuse Potential":
exists( "Chronic Pain Opioid Analgesic with Ambulatory Misuse Potential Prescriptions" )
define "Is Recommendation Applicable?":
"Inclusion Criteria"
and not "Exclusion Criteria"
define "Inclusion Criteria":
"Patient Is Being Prescribed Opioid Analgesic with Ambulatory Misuse Potential"
and Routines."Is Opioid Review Useful?"
and not "Patient had Urine Screening in Last 12 Months"
define "Exclusion Criteria":
Common."End of Life Assessment"
define "Patient had Urine Screening in Last 12 Months":
exists( "Urine Screenings during the Last 12 Months" )
define "Urine Screenings during the Last 12 Months":
(
[Observation: "code" in Common."Non-opioid drug urine screening"] IllicitDrugScreen
where date from IllicitDrugScreen.effective in day of "Lookback Year"
)
union
(
[Observation: "code" in Common."Opioid drug urine screening"] OpioidDrugScreen
where date from OpioidDrugScreen.effective in day of "Lookback Year"
)
define "No Screening In Last 12 Months Indicator":
if "Is Recommendation Applicable?"
then 'warning'
else null
define "No Screening In Last 12 Months Summary":
if "Is Recommendation Applicable?"
then 'Annual Urine Screening Check'
else null
define "No Screening In Last 12 Months Detail":
if "Is Recommendation Applicable?"
then 'Patients on opioid therapy should have a urine drug test performed every 12 months.'
else null
|
<filename>usr/share/roundcube/SQL/mysql/2013052500.sql<gh_stars>10-100
CREATE TABLE `cache_shared` (
`cache_key` varchar(255) /*!40101 CHARACTER SET ascii COLLATE ascii_general_ci */ NOT NULL,
`created` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
`data` longtext NOT NULL,
INDEX `created_index` (`created`),
INDEX `cache_key_index` (`cache_key`)
) /*!40000 ENGINE=INNODB */ /*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */;
|
<reponame>bobheadlabs/sourcegraph
-- Some docs here
CREATE INDEX CONCURRENTLY IF NOT EXISTS idx ON tbl(col1, col2, col3);
|
ALTER TABLE "selfservice_recovery_flows" DROP CONSTRAINT "selfservice_recovery_flows_nid_fk_idx"; |
<gh_stars>1000+
--
-- insert...on conflict on constraint
--
CREATE TABLE tab (i int PRIMARY KEY, j int CONSTRAINT tab_j_constraint UNIQUE);
CREATE UNIQUE INDEX ON tab (j);
CREATE UNIQUE INDEX tab_idx ON tab (j);
-- Insert some data
INSERT INTO tab VALUES (1, 1);
INSERT INTO tab VALUES (200, 200);
-- Use generated constraint name for primary key.
INSERT INTO tab VALUES (1, 7) ON CONFLICT ON CONSTRAINT tab_pkey DO UPDATE
SET j = tab.j + excluded.j;
-- Use select to verify result.
SELECT * FROM tab;
-- Use system generated name for unique index.
INSERT INTO tab VALUES (1, 200) ON CONFLICT ON CONSTRAINT tab_j_idx DO UPDATE
SET j = tab.j + excluded.j;
-- Error: Name of index is not a constraint name.
INSERT INTO tab VALUES (1, 1) ON CONFLICT ON CONSTRAINT tab_idx DO NOTHING;
-- Use conflict for unique column
INSERT INTO tab VALUES (1, 200) ON CONFLICT (j) DO UPDATE
SET j = tab.j + excluded.j;
-- Use SELECT to verify result.
SELECT * FROM tab;
-- Use conflict for unique constraint - noop
INSERT INTO tab VALUES (1, 400) ON CONFLICT ON CONSTRAINT tab_j_constraint DO NOTHING;
-- Use SELECT to verify result.
SELECT * FROM tab;
-- Use conflict for unique constraint - update
INSERT INTO tab VALUES (1, 400) ON CONFLICT ON CONSTRAINT tab_j_constraint DO UPDATE
SET j = tab.j + excluded.j;
-- Use SELECT to verify result.
SELECT * FROM tab;
|
SET pgroonga.enable_wal = yes;
CREATE TABLE memos (
content text
);
INSERT INTO memos
SELECT clock_timestamp()::text
FROM generate_series(1, 50000);
CREATE INDEX pgrn_memos_index ON memos USING PGroonga (content);
SELECT pgroonga_wal_truncate();
DROP TABLE memos;
|
<reponame>Zhaojia2019/cubrid-testcases
--TEST: [Multi-table Update] Select result is incorrect after updating 2 hash partition tables.
create table t1(id int, phone varchar(20))
partition by hash(id) partitions 5;
create table t2(id int , name varchar(20))
partition by hash(id) partitions 5;
insert into t1 values(1,'111-1111'), (2,'222-2222'), (3, '333-3333'), (4, '444-4444'), (5, '555-5555');
insert into t2 values(1,'George'),(2,'Laura'),(3,'Max'), (7, 'aaa'), (8, 'bbb');
update t1, t2 set t1.id=100, t2.id=200 where t1.id=t2.id;
select * from t2 order by 1, 2;
select * from t2 where id=200 order by 1, 2;
select * from t1 where id=100 order by 1, 2;
update t1, t2 set t1.phone='updated', t2.name='updated' where t1.id != t2.id and t1.id < 100 and t2.id < 100;
select * from t2 order by 1, 2;
select * from t2 where id=200 order by 1, 2;
select * from t1 where id=100 order by 1, 2;
select * from t2 where name='updated' order by 1, 2;
select * from t1 where phone='updated' order by 1, 2;
drop t1;
drop t2;
|
<reponame>Leonard107/repositorio-padrao
--
-- The contents of this file are subject to the license and copyright
-- detailed in the LICENSE and NOTICE files at the root of the source
-- tree and available online at
--
-- http://www.dspace.org/license/
--
------------------------------------------------------
-- DS-3024 Invent "permanent" groups
------------------------------------------------------
ALTER TABLE epersongroup
ADD (permanent BOOLEAN DEFAULT false);
UPDATE epersongroup SET permanent = true
WHERE uuid IN (
SELECT dspace_object_id
FROM metadataschemaregistry AS s
JOIN metadatafieldregistry AS f
ON (s.metadata_schema_id = f.metadata_schema_id)
JOIN metadatavalue AS v
ON (f.metadata_field_id = v.metadata_field_id)
WHERE s.short_id = 'dc'
AND f.element = 'title'
AND f.qualifier IS NULL
AND v.text_value IN ('Administrator', 'Anonymous')
);
|
<reponame>Dynee/pygendata
create table os_network_true_coverage_pro_stg (
report_start_date text encoding dict(16),
report_end_date text encoding dict(16),
network_name_mapped text encoding dict(8),
parent_location text encoding dict(16),
id text encoding dict,
level_used integer,
avail_impact double,
avail_contribution double,
avail_performance double,
avail_importance double,
avail_performance_diff_vs_target double,
avail_performance_target double,
lte_enbl_dev_avg_signal_2g double,
lte_enbl_dev_avg_signal_3g double,
lte_enbl_dev_avg_rsrp double,
lte_enbl_dev_avg_rsrq double,
lte_enbl_dev_avg_rssnr double,
lte_enbl_dev_rows_2g_share double,
lte_enbl_dev_rows_3g_share double,
lte_enbl_dev_rows_lte_share double,
lte_enbl_dev_rows_no_signal_share double,
latitude double,
longitude double
); |
<gh_stars>0
CREATE OR REPLACE FUNCTION public.kartoza_evaluate_building_admin() RETURNS VARCHAR
LANGUAGE plpgsql
AS $$
BEGIN
UPDATE osm_buildings
SET
district_id = d.dc_code
FROM
district d
WHERE st_within(geometry, d.geom);
RETURN 'OK';
END
$$;
|
<reponame>AGarraffa/employee-tracker<filename>db/seeds.sql
INSERT INTO department (name)
VALUES ("Plumbing"),
("Adventuring"),
("Spice Harvesting"),
("Legal");
INSERT INTO role (title, salary, dept_id)
VALUES ("Plumber", 75000.00, 1),
("Princess", 500000.00, 1),
("Toadstool", 50000.00, 1),
("Party Leader", 200000.00, 2),
("Fighter", 90000.00, 2),
("Wizard", 100000.00, 2),
("Thief", 65000.00, 2),
("Cleric", 80000.00, 2),
("Duke", 400000.00, 3),
("Baron", 400000.00, 3),
("Heir", 150000.00, 3),
("Emperor", 1000000.00, 3),
("Defense Attorney", 200000.00, 4),
("Prosecuter", 200000.00, 4),
("Legal Assistant", 50000.00, 4);
INSERT INTO employee (first_name, last_name, role_id, manager_id, is_manager)
VALUES ("Mario", "Mario", 1, 3, 0),
("Luigi", "Mario", 1, 3, 0),
("Princess", "Peach", 2, 3, 1),
("Toad", "Stool", 3, 3, 0),
("Dungeon", "Master", 4, 5, 1),
("Punchy", "McThrowdown", 5, 5, 0),
("Steve", "Castsalot", 6, 5, 0),
("Sneaky", "Nothingtoseehere", 7, 5, 0),
("Sir", "Overlyrighteous", 8, 5, 0),
("Leto", "Atreides", 9, 13, 1),
("Paul", "Atreides", 11, 10, 0),
("Vladimir", "Harkonnen", 10, 13, 1),
("Shaddam", "Corrino", 12, 13, 1),
("Phoenix", "Wright", 13, 14, 1),
("Mia", "Fey", 15, 14, 0),
("Miles", "Edgeworth", 14, 16, 1),
("Maya", "Fey", 15, 16, 0); |
-- phpMyAdmin SQL Dump
-- version 4.7.4
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Jul 20, 2019 at 04:23 PM
-- Server version: 10.1.26-MariaDB
-- PHP Version: 7.1.9
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `raline`
--
DELIMITER $$
--
-- Procedures
--
CREATE DEFINER=`root`@`localhost` PROCEDURE `log_user_aktif` (IN `username` VARCHAR(255), IN `activity` VARCHAR(255), IN `tanggal` VARCHAR(255)) NO SQL
BEGIN
INSERT INTO `log_user` VALUES(username,tanggal,activity);
END$$
--
-- Functions
--
CREATE DEFINER=`root`@`localhost` FUNCTION `hitung_kkm_siswa` () RETURNS INT(11) return (SELECT COUNT(*)
AS jumlah_siswa_kkm
FROM nilai
WHERE k3>80 AND k4>80)$$
CREATE DEFINER=`root`@`localhost` FUNCTION `hitung_nilai` () RETURNS INT(11) NO SQL
RETURN(SELECT COUNT(*) FROM nilai WHERE k3>80 and k4>85)$$
DELIMITER ;
-- --------------------------------------------------------
--
-- Table structure for table `absen`
--
CREATE TABLE `absen` (
`nis` int(7) NOT NULL,
`id_raport` int(11) NOT NULL,
`alpha` int(2) NOT NULL,
`sakit` int(2) NOT NULL,
`izin` int(2) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `absen`
--
INSERT INTO `absen` (`nis`, `id_raport`, `alpha`, `sakit`, `izin`) VALUES
(1605097, 1, 0, 3, 1),
(1605099, 3, 2, 3, 1),
(1605101, 0, 1, 2, 2),
(1605105, 7, 1, 3, 0);
-- --------------------------------------------------------
--
-- Table structure for table `catatan_walikelas`
--
CREATE TABLE `catatan_walikelas` (
`nis` int(7) NOT NULL,
`id_raport` int(11) NOT NULL,
`semester` int(2) NOT NULL,
`tahun_akademik` varchar(10) NOT NULL,
`keterangan` varchar(500) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `catatan_walikelas`
--
INSERT INTO `catatan_walikelas` (`nis`, `id_raport`, `semester`, `tahun_akademik`, `keterangan`) VALUES
(1605097, 1, 6, '2019/2020', 'sangat hebat'),
(1605099, 3, 6, '2019/2020', 'ppppaaaaaaaaaaaaaa'),
(1605105, 7, 6, '2019/2020', 'Fakhri keren banget. Ia mahasiswa yang tidak sopan.');
-- --------------------------------------------------------
--
-- Table structure for table `deskripsi1`
--
CREATE TABLE `deskripsi1` (
`nis` int(7) NOT NULL,
`predikat_sosial` varchar(2) NOT NULL,
`deskripsi_sosial` varchar(300) NOT NULL,
`deskripsi_spiritual` varchar(300) NOT NULL,
`predikat_spiritual` varchar(2) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `deskripsi1`
--
INSERT INTO `deskripsi1` (`nis`, `predikat_sosial`, `deskripsi_sosial`, `deskripsi_spiritual`, `predikat_spiritual`) VALUES
(1605097, 'SB', 'Sikap Ananda secara umum sangat baik. Memiliki sikap jujur, santun, peduli, gotong royong dan percaya diri. ', 'Sikap Ananda secara umum sangat baik. Terbiasa dalam sholat dzuhur secara berjamaah, memberi dan menjawab salam dan berdoa kepada Allah.', 'SB');
-- --------------------------------------------------------
--
-- Table structure for table `deskripsik3`
--
CREATE TABLE `deskripsik3` (
`nis` int(7) NOT NULL,
`id_mapel` int(10) NOT NULL,
`deskripsi_k3` varchar(200) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `deskripsik3`
--
INSERT INTO `deskripsik3` (`nis`, `id_mapel`, `deskripsi_k3`) VALUES
(1605097, 2, 'Sudah mulai berkembang dalam memahami dan menganalisis hadits tentang niat, penciptaan manusia dan larangan mengamalkan ibadah yang tidak ada dalilnya '),
(1605097, 3, 'Sudah mulai berkembang dalam memahami dan menganalisis '),
(1605097, 7, 'Sudah berkembang dalam memahami makna Syahadat '),
(1605097, 8, 'Sudah berkembang dalam memahami dan mempraktekkan Makharijul huruf dan sifat-sifatnya, serta hukum Nun mati dan Tanwin'),
(1605097, 5, 'Sudah berkembang dalam memahami makna Syahadat Laailaha illallahu beserta syarat -syaratnya dan dalil - dalilnya. '),
(1605097, 4, 'Sudah mulai berkembang dalam memahami dan menganalisis'),
(1605097, 6, 'Sudah berkembang dalam memahami makna Syahadat'),
(1605097, 9, 'Sudah berkembang dalam memahami makna Syahadat '),
(1605097, 10, 'Sudah berkembang dalam menjelaskan keutamaan umat islam,defenisi sahabat dan ahlulbait '),
(1605097, 13, 'Mulai memahami fungsi sosial, struktur teks, dan unsur kebahasaan teks interaksi transaksional lisan dan tulis yang melibatkan tindakan memberi dan meminta informasi terkait jati diri dan hubungan kel'),
(1605097, 14, 'Cukup baik dalam memahami persamaan dan pertidaksamaan nilai mutlak, SPLTV dan fungsi'),
(1605097, 15, 'Mulai meningkat dalam mengidentifikasi pengaruh hindhu budha di indonesia dan peninggalannya'),
(1605097, 16, 'Mulai meningkat memahami menggambar dua dimensi '),
(1605097, 17, 'Baik dalam memahami dan mempraktikkan permainan bola besar, permainan bola kecil, atletik, dan kebugaran jasmani'),
(1605097, 18, 'Mulai meningkat memahami pelajaran menggambar dua dimensi '),
(1605097, 19, 'Ananda baik dalam memahami nilai dan norma sosial dan interaksi sosial dalam dinamika kehidupan sosial '),
(1605097, 20, 'Ananda baik dalam memahami nilai dan norma sosial dan interaksi sosial dalam dinamika kehidupan sosial '),
(1605097, 21, 'Ananda baik dalam memahami nilai dan norma sosial dan interaksi sosial dalam dinamika kehidupan sosial '),
(1605097, 22, 'Ananda baik dalam memahami nilai dan norma sosial dan interaksi sosial dalam dinamika kehidupan sosial '),
(1605097, 25, 'Sudah cukup berkembang dalam memahami dan menganalisis kaidah penulisan huruf hamzah dan alif '),
(1605097, 26, 'Sudah berkembang dalam memahami makna teks serta kosa- kata bahasa arab yang berkaitan tentang berbakti kepada kedua orang tua.'),
(1605097, 27, 'Sangat terampil dalam menghapal Juz 1'),
(1605097, 28, 'Cukup memahami penerapkan prinsip penjumlahan vektor sebidang (misalnya perpindahan) dan Menganalisis besaran-besaran fisis pada gerak lurus dengan kecepatan konstan (tetap) dan gerak lurus dengan per'),
(1605097, 29, 'Sudah baik dalam memahami ruang lingkup biologi, menerapkan metode ilmiah, mengidentifikasi keanekaragaman hayati, memahami virus dan peranannya serta mampu menerapkan prinsip klasifikasi makhluk hid'),
(1605097, 30, 'Cukup baik dalam memahami struktur atom berdasarkan teori atom Bohr dan teori mekanika kuantum, menganalisis hubungan konfigurasi elektron dan diagram orbital untuk menentukan letak unsur dalam tabel'),
(1605097, 31, 'Cukup baik dalam memahami persamaan dan pertidaksamaan nilai mutlak, SPLTV dan fungsi'),
(1605097, 11, 'sudah berkembang dalam memahami hakekat warga negara dan kependudukan serta batas batas wilayah indonesia'),
(1605097, 12, 'Kemampuan sudah meningkat dalam mengidentifikasi teks eksposisi, meningkat dalam mengidentifikasikan teks observasi anekdot'),
(1605097, 1, 'Sudah Berkembang tentang Kemampuan Berthoharoh secara tertulis '),
(1605097, 23, 'Sudah cukup berkembang dalam memahami dan menganalisis kaidah penulisan huruf hamzah dan alif ');
-- --------------------------------------------------------
--
-- Table structure for table `deskripsik4`
--
CREATE TABLE `deskripsik4` (
`nis` int(7) NOT NULL,
`id_mapel` int(7) NOT NULL,
`deskripsi_k4` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `deskripsik4`
--
INSERT INTO `deskripsik4` (`nis`, `id_mapel`, `deskripsi_k4`) VALUES
(1605097, 1, 'Meningkat tentang Kemampuan Berthoharoh secara peraktek'),
(1605097, 2, 'Sudah memiliki peningkatan yang baik dalam memahami matan hadits dan mengaplikasikannya'),
(1605097, 4, 'Sudah memiliki peningkatan yang baik dalam memahami'),
(1605097, 6, 'Sudah memiliki peningkatan yang baik dalam memahami'),
(1605097, 3, 'Sudah memiliki peningkatan yang baik dalam memahami matan hadits dan mengaplikasikannya'),
(1605097, 5, 'Sudah berkembang dan terampil dalam merealisasikan makna Syahadat Laailaha illallahu beserta syarat '),
(1605097, 7, 'Sudah berkembang dan terampil dalam merealisasikan '),
(1605097, 8, 'Sudah berkembang dalam memahami dan mempraktekkan Makharijul huruf dan sifat-sifatnya, serta hukum N'),
(1605097, 9, 'Sudah berkembang dalam memahami dan mempraktekkan'),
(1605097, 11, 'Sudah berkembang dalam mengidentifikasi penerapan sila pancasila '),
(1605097, 12, 'Sudah berkembang dalam menulis teks eksposisi '),
(1605097, 31, 'Terampil sangat baik dalam memahami persamaan dan perttidaksasmaan nilai mutlak, SPLTV dan fungsi '),
(1605097, 30, 'Terampil mengolah dan menganalisis struktur atom berdasarkan teori atom Bohr dan teori mekanika kuan'),
(1605097, 14, 'Terampil sangat baik dalam memahami persamaan dan perttidaksasmaan nilai mutlak, SPLTV dan fungsi '),
(1605097, 15, 'Sudah berkembang dalam menuliskan peninggalan masa hindhu buddha '),
(1605097, 16, 'Mulai meningkat terampil melukis di atas kain dan terampil melukis di atas kain dengan baik '),
(1605097, 17, 'Cukup terampil dalam memahami dan mempraktikkan permainan bola besar, permainan bola kecil, atletik,'),
(1605097, 18, 'Meningkat terampil menggambar dua dimensi dan sangat terampil menggambarkannya dengan baik '),
(1605097, 19, 'Ananda cukup terampil dalam memahami nilai dan norma sosial dan interaksi sosial dalam dinamika kehi'),
(1605097, 20, 'Sudah berkembang dan terampil dalam mengolah dan membuat kalimat bahasa arab dengan benar yang berka'),
(1605097, 21, 'Sudah berkembang dan terampil dalam mengolah dan membuat kalimat bahasa arab dengan benar yang berka'),
(1605097, 22, 'sangat hebat'),
(1605097, 25, 'Sudah berkembang dan terampil dalam mengolah dan membuat kalimat bahasa arab dengan benar yang berka'),
(1605097, 26, 'Sudah berkembang dan terampil dalammembaca dan menerjemahkan teks bahasa arab yang berkaitan tentang'),
(1605097, 27, 'Sangat terampil dalam menghapal Juz 1 '),
(1605097, 28, 'Sangat terampil dalam merancang percobaan untuk menentukan resultan vektor sebidang (misalnya perpin'),
(1605097, 29, 'Sangat terampil dalam menyajikan hasil observasi mengenai keanekaragaman hayati, ciri umum protista '),
(1605097, 30, 'Terampil mengolah dan menganalisis struktur atom berdasarkan teori atom Bohr dan teori mekanika kuan'),
(1605097, 31, 'Terampil sangat baik dalam memahami persamaan dan perttidaksasmaan nilai mutlak, SPLTV dan fungsi '),
(1605097, 10, 'Sangat terampil dalam menghafalkan mandzumah '),
(1605097, 13, 'Ananda mulai terampil menyusun teks interaksi transaksional lisan dan tulis pendek dan sederhana ya'),
(1605097, 23, 'Sudah berkembang dalam memahami dan mempraktekkan Makharijul huruf dan sifat-sifatnya, serta hukum N');
-- --------------------------------------------------------
--
-- Stand-in structure for view `detail_ekstra`
-- (See below for the actual view)
--
CREATE TABLE `detail_ekstra` (
`kkm` varchar(2)
,`nis` int(7)
,`predikat` varchar(2)
,`id_mapel` int(10)
,`k3` varchar(2)
,`k4` varchar(2)
,`deskripsi_k3` varchar(200)
,`deskripsi_k4` varchar(100)
);
-- --------------------------------------------------------
--
-- Stand-in structure for view `detail_nilai`
-- (See below for the actual view)
--
CREATE TABLE `detail_nilai` (
`nama` varchar(100)
,`kelas` varchar(5)
,`semester` int(2)
,`k3` varchar(2)
,`k4` varchar(2)
);
-- --------------------------------------------------------
--
-- Table structure for table `ekskul`
--
CREATE TABLE `ekskul` (
`id_ekskul` int(11) NOT NULL,
`nama_eks` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `ekskul`
--
INSERT INTO `ekskul` (`id_ekskul`, `nama_eks`) VALUES
(1, '<NAME>'),
(2, 'RENANG'),
(3, '<NAME>'),
(4, 'TAKLIM'),
(5, 'JURNALISTIK'),
(6, '<NAME>'),
(7, '<NAME>'),
(8, 'FUTSAL'),
(9, 'PRAMUKA');
-- --------------------------------------------------------
--
-- Table structure for table `extra`
--
CREATE TABLE `extra` (
`nis` int(7) NOT NULL,
`deskripsi_ex` varchar(300) NOT NULL,
`id_ekskul` int(11) NOT NULL,
`nilai_ex` varchar(2) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `extra`
--
INSERT INTO `extra` (`nis`, `deskripsi_ex`, `id_ekskul`, `nilai_ex`) VALUES
(1605097, 'blblbl', 1, 'A');
-- --------------------------------------------------------
--
-- Table structure for table `guru`
--
CREATE TABLE `guru` (
`nip` int(10) NOT NULL,
`id_mapel` int(10) NOT NULL,
`nama` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `guru`
--
INSERT INTO `guru` (`nip`, `id_mapel`, `nama`) VALUES
(27561002, 2, '<NAME>'),
(27561003, 3, '<NAME>'),
(27561004, 4, '<NAME>'),
(27561005, 5, 'MUHARRIZ'),
(27561006, 6, '<NAME>'),
(27561007, 7, '<NAME>'),
(27561008, 8, 'JACKIE'),
(27561010, 10, '<NAME>');
-- --------------------------------------------------------
--
-- Table structure for table `kelas`
--
CREATE TABLE `kelas` (
`kelas` varchar(2) NOT NULL,
`nip_walikelas` int(10) NOT NULL,
`id_raport` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `log_nilai`
--
CREATE TABLE `log_nilai` (
`id` int(11) NOT NULL,
`nis` varchar(7) NOT NULL,
`keterangan` varchar(30) NOT NULL,
`waktu` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `log_nilai`
--
INSERT INTO `log_nilai` (`id`, `nis`, `keterangan`, `waktu`) VALUES
(0, '1605097', 'Data di update', '2019-07-15 20:23:53'),
(1, '1605097', 'Data Dihapus', '2019-07-09 00:55:19'),
(2, '1605097', 'Tambah data', '2019-07-09 00:55:37'),
(3, '1605097', 'Data di update', '2019-07-09 00:55:45'),
(4, '1605097', 'Tambah data', '2019-07-09 14:11:24'),
(5, '1605097', 'Data di update', '2019-07-09 14:11:31'),
(6, '1605098', 'Tambah data', '2019-07-09 14:31:25'),
(7, '1605098', 'Tambah data', '2019-07-09 14:32:11'),
(8, '1605098', 'Tambah data', '2019-07-09 14:32:38'),
(9, '1605098', 'Tambah data', '2019-07-09 14:33:07'),
(10, '1605099', 'Tambah data', '2019-07-09 14:34:30'),
(11, '1605099', 'Tambah data', '2019-07-09 14:35:12'),
(12, '1605097', 'Tambah data', '2019-07-09 15:05:09'),
(13, '1605097', 'Tambah data', '2019-07-09 15:15:32'),
(14, '1605097', 'Data di update', '2019-07-09 15:15:43'),
(15, '1605097', 'Data Dihapus', '2019-07-09 15:15:47'),
(16, '1605100', 'Tambah data', '2019-07-09 15:26:10'),
(17, '1605100', 'Data di update', '2019-07-09 15:26:20'),
(18, '1605097', 'Tambah data', '2019-07-09 15:26:55'),
(19, '1605097', 'Data di update', '2019-07-13 22:02:06');
-- --------------------------------------------------------
--
-- Table structure for table `log_siswa`
--
CREATE TABLE `log_siswa` (
`id` int(11) NOT NULL,
`nis` varchar(7) NOT NULL,
`Keterangan` varchar(50) NOT NULL,
`waktu` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `log_siswa`
--
INSERT INTO `log_siswa` (`id`, `nis`, `Keterangan`, `waktu`) VALUES
(0, '1705198', 'Data di update', '2019-07-16 13:55:36'),
(1, '1616161', 'Tambah data', '2019-07-04 21:17:21'),
(2, '1616161', 'Data Berhasil di update', '2019-07-04 21:18:15'),
(3, '1717171', 'Data Dihapus', '2019-07-04 21:18:19');
-- --------------------------------------------------------
--
-- Table structure for table `log_user`
--
CREATE TABLE `log_user` (
`username` varchar(255) NOT NULL,
`tanggal` datetime NOT NULL,
`activity` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `log_user`
--
INSERT INTO `log_user` (`username`, `tanggal`, `activity`) VALUES
('admin', '0000-00-00 00:00:00', 'login'),
('Jackie', '2019-07-08 09:27:44', 'login'),
('Jackie', '2019-07-08 09:29:25', 'login'),
('Jackie', '2019-07-08 09:30:07', 'login'),
('Jackie', '2019-07-08 09:34:19', 'login'),
('Jackie', '2019-07-08 09:35:31', 'login'),
('Jackie', '2019-07-08 09:36:29', 'login'),
('Jackie', '2019-07-08 10:13:58', 'logout'),
('Jackie', '2019-07-08 10:14:11', 'login'),
('Jackie', '2019-07-08 10:36:17', 'logout'),
('Jackie', '2019-07-08 10:36:52', 'login'),
('Jackie', '2019-07-08 10:37:25', 'logout'),
('Jackie', '2019-07-08 10:38:14', 'login'),
('Jackie', '2019-07-08 10:38:23', 'logout'),
('Jackie', '2019-07-08 10:38:30', 'login'),
('Jackie', '2019-07-08 10:39:06', 'logout'),
('admin', '2019-07-08 10:40:56', 'login'),
('admin', '2019-07-08 11:11:02', 'logout'),
('Jackie', '2019-07-08 11:13:54', 'login'),
('Jackie', '2019-07-08 11:13:59', 'logout'),
('Jackie', '2019-07-08 11:14:04', 'login'),
('Jackie', '2019-07-08 11:14:43', 'logout'),
('Jackie', '2019-07-08 11:14:51', 'login'),
('Jackie', '2019-07-08 11:38:23', 'logout'),
('Jackie', '2019-07-08 11:38:51', 'login'),
('Jackie', '2019-07-08 11:57:21', 'logout'),
('admin', '2019-07-08 11:57:27', 'login'),
('admin', '2019-07-08 12:00:00', 'login'),
('Admin', '2019-07-08 12:00:29', 'login'),
('admin', '2019-07-08 12:03:47', 'logout'),
('Admin', '2019-07-08 12:09:19', 'login'),
('admin', '2019-07-08 12:09:53', 'logout'),
('admin', '2019-07-08 12:09:58', 'login'),
('admin', '2019-07-08 12:11:27', 'logout'),
('', '2019-07-08 12:11:27', 'logout'),
('admin', '2019-07-08 12:11:33', 'login'),
('admin', '2019-07-08 12:33:12', 'logout'),
('Jackie', '2019-07-08 14:14:05', 'login'),
('Jackie', '2019-07-08 19:42:02', 'logout'),
('Admin', '2019-07-08 19:42:17', 'login'),
('admin', '2019-07-08 19:43:14', 'logout'),
('Jackie', '2019-07-08 19:43:36', 'login'),
('Jackie', '2019-07-08 19:43:45', 'logout'),
('Admin', '2019-07-08 19:44:13', 'login'),
('admin', '2019-07-08 19:44:38', 'logout'),
('Jackie', '2019-07-08 19:55:09', 'login'),
('Jackie', '2019-07-08 19:58:48', 'logout'),
('admin', '2019-07-08 22:30:26', 'login'),
('admin', '2019-07-09 03:19:45', 'login'),
('admin', '2019-07-09 03:22:40', 'logout'),
('Jackie', '2019-07-09 03:22:51', 'login'),
('Jackie', '2019-07-09 03:26:57', 'logout'),
('Admin', '2019-07-09 03:36:50', 'login'),
('admin', '2019-07-09 05:21:41', 'logout'),
('admin', '2019-07-09 05:21:45', 'login'),
('admin', '2019-07-09 05:21:55', 'logout'),
('Jackie', '2019-07-09 05:22:21', 'login'),
('Jackie', '2019-07-09 06:19:02', 'logout'),
('admin', '2019-07-09 06:19:24', 'login'),
('admin', '2019-07-09 06:30:09', 'login'),
('admin', '2019-07-09 06:30:23', 'logout'),
('Jackie', '2019-07-09 06:30:28', 'login'),
('Jackie', '2019-07-09 06:30:41', 'logout'),
('admin', '2019-07-09 06:33:11', 'login'),
('admin', '2019-07-09 07:36:28', 'logout'),
('admin', '2019-07-09 07:36:39', 'login'),
('admin', '2019-07-09 09:10:23', 'logout'),
('Jackie', '2019-07-09 09:10:51', 'login'),
('Jackie', '2019-07-09 09:11:41', 'logout'),
('Admin', '2019-07-09 09:11:46', 'login'),
('admin', '2019-07-09 09:12:39', 'logout'),
('Jackie', '2019-07-09 09:21:03', 'login'),
('Jackie', '2019-07-09 09:47:42', 'logout'),
('Admin', '2019-07-09 09:48:01', 'login'),
('admin', '2019-07-09 09:48:45', 'logout'),
('Jackie', '2019-07-09 09:48:50', 'login'),
('Jackie', '2019-07-09 09:50:19', 'logout'),
('Admin', '2019-07-09 09:50:29', 'login'),
('admin', '2019-07-09 09:50:46', 'logout'),
('Jackie', '2019-07-09 09:51:01', 'login'),
('Jackie', '2019-07-09 09:51:33', 'logout'),
('admin', '2019-07-09 09:52:07', 'login'),
('admin', '2019-07-09 09:53:05', 'logout'),
('Jackie', '2019-07-09 09:53:20', 'login'),
('Jackie', '2019-07-09 09:53:42', 'logout'),
('admin', '2019-07-09 09:53:50', 'login'),
('admin', '2019-07-09 10:02:32', 'logout'),
('Fakhirah', '2019-07-09 10:04:16', 'login'),
('Fakhirah', '2019-07-09 10:07:06', 'logout'),
('Ibnu', '2019-07-09 10:07:43', 'login'),
('Ibnu', '2019-07-09 10:09:01', 'logout'),
('adminbaru', '2019-07-09 10:10:44', 'login'),
('adminbaru', '2019-07-09 10:11:27', 'logout'),
('adminbaru', '2019-07-09 10:13:02', 'login'),
('adminbaru', '2019-07-09 10:14:38', 'logout'),
('Ibnu', '2019-07-09 10:14:52', 'login'),
('Ibnu', '2019-07-09 10:16:25', 'logout'),
('adminbaru', '2019-07-09 10:16:32', 'login'),
('adminbaru', '2019-07-09 10:17:10', 'logout'),
('Jackie', '2019-07-09 10:25:21', 'login'),
('Jackie', '2019-07-13 16:50:39', 'login'),
('Jackie', '2019-07-13 17:00:35', 'logout'),
('Jackie', '2019-07-13 17:00:46', 'login'),
('jackie', '2019-07-15 15:21:47', 'login'),
('Jackie', '2019-07-15 15:21:51', 'logout'),
('adminbaru', '2019-07-15 15:21:59', 'login'),
('Jackie', '2019-07-15 15:23:43', 'login'),
('Jackie', '2019-07-15 15:57:47', 'logout'),
('admin', '2019-07-15 15:57:54', 'login'),
('admin', '2019-07-15 16:03:51', 'logout'),
('jackie', '2019-07-15 16:03:56', 'login'),
('jackie', '2019-07-16 08:52:13', 'login'),
('Jackie', '2019-07-16 09:08:55', 'login'),
('Jackie', '2019-07-16 09:34:46', 'logout'),
('admin', '2019-07-16 09:34:51', 'login'),
('jackie', '2019-07-16 13:37:00', 'login'),
('admin', '2019-07-17 14:18:17', 'login'),
('admin', '2019-07-17 14:22:59', 'logout'),
('jackie', '2019-07-17 14:23:10', 'login'),
('jackie', '2019-07-17 16:15:51', 'login'),
('Jackie', '2019-07-17 16:40:49', 'logout'),
('jackie', '2019-07-17 16:40:54', 'login'),
('Jackie', '2019-07-17 16:44:23', 'logout'),
('admin', '2019-07-17 16:44:28', 'login'),
('admin', '2019-07-17 17:34:14', 'logout'),
('jackie', '2019-07-17 17:34:25', 'login'),
('admin', '2019-07-17 21:37:18', 'login'),
('admin', '2019-07-17 21:37:38', 'logout'),
('jackie', '2019-07-17 21:37:46', 'login'),
('Jackie', '2019-07-17 21:59:27', 'logout'),
('admin', '2019-07-17 21:59:34', 'login'),
('admin', '2019-07-17 22:11:37', 'logout'),
('jackie', '2019-07-17 22:11:46', 'login'),
('jackie', '2019-07-17 22:14:44', 'login'),
('jackie', '2019-07-18 06:06:01', 'login'),
('jackie', '2019-07-18 07:19:56', 'login'),
('Jackie', '2019-07-18 09:44:51', 'logout'),
('admin', '2019-07-18 09:44:56', 'login'),
('jackie', '2019-07-18 10:10:52', 'login'),
('jackie', '2019-07-18 10:46:17', 'login'),
('admin', '2019-07-18 10:48:14', 'login'),
('jackie', '2019-07-18 10:50:03', 'login'),
('admin', '2019-07-18 10:50:44', 'login'),
('jackie', '2019-07-18 11:09:12', 'login'),
('admin', '2019-07-18 11:09:56', 'login'),
('admin', '2019-07-18 13:38:15', 'login'),
('admin', '2019-07-18 13:46:09', 'logout'),
('jackie', '2019-07-18 13:46:14', 'login'),
('Jackie', '2019-07-18 15:15:19', 'logout'),
('jackie', '2019-07-18 15:18:05', 'login'),
('jackie', '2019-07-18 15:21:39', 'login'),
('jackie', '2019-07-18 18:42:06', 'login'),
('Jackie', '2019-07-18 20:02:20', 'logout'),
('admin', '2019-07-18 20:02:31', 'login'),
('admin', '2019-07-18 20:02:56', 'logout'),
('jackie', '2019-07-18 20:03:01', 'login'),
('Jackie', '2019-07-18 20:03:19', 'logout'),
('admin', '2019-07-18 20:03:29', 'login'),
('jackie', '2019-07-18 20:04:27', 'login'),
('admin', '2019-07-18 20:05:21', 'login'),
('jackie', '2019-07-19 07:33:27', 'login'),
('Jackie', '2019-07-19 07:36:47', 'logout'),
('admin', '2019-07-19 07:36:52', 'login'),
('jackie', '2019-07-19 07:38:36', 'login'),
('admin', '2019-07-19 07:42:17', 'login'),
('jackie', '2019-07-19 08:25:05', 'login'),
('Jackie', '2019-07-19 08:39:56', 'logout'),
('admin', '2019-07-19 08:40:01', 'login'),
('admin', '2019-07-19 09:00:33', 'logout'),
('jackie', '2019-07-19 09:00:37', 'login'),
('Jackie', '2019-07-19 09:02:03', 'logout'),
('admin', '2019-07-19 09:02:09', 'login'),
('jackie', '2019-07-19 09:02:48', 'login'),
('admin', '2019-07-19 09:04:35', 'login'),
('admin', '2019-07-19 09:19:27', 'logout'),
('jackie', '2019-07-19 09:26:23', 'login'),
('Jackie', '2019-07-19 09:30:06', 'logout'),
('admin', '2019-07-19 09:30:10', 'login'),
('admin', '2019-07-19 09:31:25', 'logout'),
('jackie', '2019-07-19 09:31:29', 'login'),
('Jackie', '2019-07-19 09:34:42', 'logout'),
('admin', '2019-07-19 09:34:47', 'login'),
('jackie', '2019-07-19 09:35:53', 'login'),
('admin', '2019-07-19 09:37:22', 'login'),
('admin', '2019-07-19 09:48:43', 'logout'),
('jackie', '2019-07-19 09:48:51', 'login'),
('admin', '2019-07-19 09:51:50', 'login'),
('admin', '2019-07-19 09:58:34', 'logout'),
('jackie', '2019-07-19 09:58:41', 'login'),
('admin', '2019-07-19 09:59:20', 'login'),
('admin', '2019-07-19 10:00:16', 'logout'),
('jackie', '2019-07-19 10:00:27', 'login'),
('jackie', '2019-07-19 10:01:29', 'login'),
('Jackie', '2019-07-19 10:01:32', 'logout'),
('admin', '2019-07-19 10:01:36', 'login'),
('admin', '2019-07-19 10:03:08', 'logout'),
('jackie', '2019-07-19 10:03:17', 'login'),
('admin', '2019-07-19 10:04:03', 'login'),
('admin', '2019-07-19 10:04:39', 'logout'),
('jackie', '2019-07-19 10:04:47', 'login'),
('Jackie', '2019-07-19 10:08:50', 'logout'),
('admin', '2019-07-19 10:08:56', 'login'),
('admin', '2019-07-19 10:10:38', 'logout'),
('jackie', '2019-07-19 10:10:50', 'login'),
('Jackie', '2019-07-19 10:38:38', 'logout'),
('admin', '2019-07-19 10:38:46', 'login'),
('admin', '2019-07-19 10:41:11', 'logout'),
('jackie', '2019-07-19 10:41:17', 'login'),
('Jackie', '2019-07-19 10:41:22', 'logout'),
('jackie', '2019-07-19 10:41:36', 'login'),
('Jackie', '2019-07-19 10:41:57', 'logout'),
('admin', '2019-07-19 10:42:05', 'login'),
('jackie', '2019-07-19 10:45:13', 'login'),
('admin', '2019-07-19 10:46:27', 'login'),
('admin', '2019-07-19 10:47:26', 'logout'),
('jackie', '2019-07-19 10:47:34', 'login'),
('Jackie', '2019-07-19 10:55:19', 'logout'),
('admin', '2019-07-19 10:55:27', 'login'),
('admin', '2019-07-19 11:05:16', 'logout'),
('jackie', '2019-07-19 11:05:23', 'login'),
('Jackie', '2019-07-19 11:16:10', 'logout'),
('admin', '2019-07-19 11:16:20', 'login'),
('admin', '2019-07-19 11:30:21', 'login'),
('admin', '2019-07-19 11:44:43', 'logout'),
('jackie', '2019-07-19 11:44:55', 'login'),
('jackie', '2019-07-19 16:31:11', 'login'),
('Jackie', '2019-07-19 17:03:54', 'logout'),
('admin', '2019-07-19 17:04:00', 'login'),
('admin', '2019-07-19 17:23:18', 'logout'),
('admin', '2019-07-19 17:23:22', 'login'),
('admin', '2019-07-19 17:31:09', 'logout'),
('jackie', '2019-07-19 17:31:17', 'login'),
('jackie', '2019-07-19 18:00:21', 'login'),
('jackie', '2019-07-19 18:17:12', 'login'),
('Jackie', '2019-07-19 19:57:03', 'logout'),
('admin', '2019-07-19 19:57:11', 'login'),
('jackie', '2019-07-20 06:18:29', 'login'),
('Jackie', '2019-07-20 06:18:34', 'logout'),
('admin', '2019-07-20 06:18:38', 'login'),
('admin', '2019-07-20 07:06:18', 'logout'),
('jackie', '2019-07-20 07:06:25', 'login'),
('admin', '2019-07-20 08:19:30', 'login'),
('admin', '2019-07-20 08:20:09', 'logout'),
('jackie', '2019-07-20 08:20:20', 'login'),
('admin', '2019-07-20 09:54:55', 'login'),
('admin', '2019-07-20 09:55:58', 'logout'),
('jackie', '2019-07-20 09:56:07', 'login'),
('Jackie', '2019-07-20 10:01:45', 'logout'),
('admin', '2019-07-20 10:01:50', 'login'),
('jackie', '2019-07-20 10:07:24', 'login'),
('admin', '2019-07-20 10:38:04', 'login'),
('admin', '2019-07-20 10:38:13', 'logout'),
('jackie', '2019-07-20 10:38:25', 'login'),
('Jackie', '2019-07-20 10:44:26', 'logout'),
('admin', '2019-07-20 10:44:35', 'login'),
('admin', '2019-07-20 15:38:51', 'login'),
('admin', '2019-07-20 15:49:15', 'logout'),
('jackie', '2019-07-20 15:49:22', 'login'),
('admin', '2019-07-20 15:55:14', 'login');
-- --------------------------------------------------------
--
-- Table structure for table `mata_pelajaran`
--
CREATE TABLE `mata_pelajaran` (
`id_mapel` int(10) NOT NULL,
`mapel` varchar(30) NOT NULL,
`kkm` varchar(2) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `mata_pelajaran`
--
INSERT INTO `mata_pelajaran` (`id_mapel`, `mapel`, `kkm`) VALUES
(1, 'Fiqih', '70'),
(2, 'Hadist', '70'),
(3, 'Tafsir', '70'),
(4, '<NAME>', '70'),
(5, 'Aqidah', '70'),
(6, '<NAME>', '70'),
(7, '<NAME>', '70'),
(8, 'Tajwid', '70'),
(9, 'Manhaj', '70'),
(10, 'Akhlak', '70'),
(11, 'PKN', '75'),
(12, 'Bahasa Indonesia', '75'),
(13, 'Bahasa Inggris', '75'),
(14, 'Matematika Wajib', '75'),
(15, 'Sejarah', '75'),
(16, 'Seni Budaya', '75'),
(17, '<NAME>', '75'),
(18, 'Keterampilan', '75'),
(19, 'IPS', '75'),
(20, 'Nahwu', '70'),
(21, 'Sharaf', '70'),
(22, 'Muhadatsah', '70'),
(23, 'Balaghan', '70'),
(25, '<NAME>', '70'),
(26, 'Muthola\'ah', '70'),
(27, 'Tahfiz', '70'),
(28, 'Fisika', '75'),
(29, 'Biologi', '75'),
(30, 'Kimia', '75'),
(31, 'Matematika Peminatan', '75');
-- --------------------------------------------------------
--
-- Table structure for table `nilai`
--
CREATE TABLE `nilai` (
`nis` int(7) NOT NULL,
`id_mapel` int(10) NOT NULL,
`id_raport` int(11) NOT NULL,
`k3` varchar(2) NOT NULL,
`k4` varchar(2) NOT NULL,
`predikat` varchar(2) NOT NULL,
`nilai_ekstra` int(2) NOT NULL,
`tahun_akademik` varchar(10) NOT NULL,
`semester` int(2) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `nilai`
--
INSERT INTO `nilai` (`nis`, `id_mapel`, `id_raport`, `k3`, `k4`, `predikat`, `nilai_ekstra`, `tahun_akademik`, `semester`) VALUES
(1605097, 1, 0, '81', '87', 'B', 0, '2020', 6),
(1605097, 2, 0, '87', '87', 'B', 0, '2020', 6),
(1605097, 3, 0, '88', '89', 'B', 0, '2020', 6),
(1605097, 4, 0, '97', '88', 'SB', 0, '2020', 6),
(1605097, 5, 0, '86', '86', 'B', 0, '2020', 6),
(1605097, 6, 0, '88', '78', 'B', 0, '2020', 6),
(1605097, 7, 0, '89', '88', 'B', 0, '2020', 6),
(1605097, 8, 0, '88', '87', 'B', 0, '2020', 6),
(1605097, 9, 0, '88', '87', 'B', 0, '2020', 6),
(1605097, 10, 0, '87', '88', 'B', 0, '2020', 6),
(1605097, 11, 0, '87', '82', 'B', 0, '2020', 6),
(1605097, 12, 0, '88', '83', 'B', 0, '2020', 6),
(1605097, 13, 0, '81', '82', 'B', 0, '2020', 6),
(1605097, 14, 0, '88', '84', 'B', 0, '2020', 6),
(1605097, 15, 0, '79', '83', 'C', 0, '2020', 6),
(1605097, 16, 0, '77', '78', 'C', 0, '2020', 6),
(1605097, 17, 0, '87', '88', 'B', 0, '2020', 6),
(1605097, 18, 0, '88', '88', 'B', 0, '2020', 6),
(1605097, 19, 0, '88', '87', 'B', 0, '2020', 6),
(1605097, 20, 0, '78', '87', 'C', 0, '2020', 6),
(1605097, 21, 0, '87', '78', 'B', 0, '2020', 6),
(1605097, 22, 0, '77', '78', 'C', 0, '2020', 6),
(1605097, 23, 0, '88', '89', 'B', 0, '2020', 6),
(1605097, 25, 0, '88', '76', 'B', 0, '2020', 6),
(1605097, 26, 0, '88', '81', 'SB', 0, '2020', 6),
(1605097, 27, 0, '88', '78', 'B', 0, '2020', 6),
(1605097, 28, 0, '77', '88', 'C', 0, '2020', 6),
(1605097, 29, 0, '88', '89', 'B', 0, '2020', 6),
(1605097, 30, 0, '88', '77', 'B', 0, '2020', 6),
(1605097, 31, 0, '77', '88', 'C', 0, '2020', 6);
-- --------------------------------------------------------
--
-- Table structure for table `predikat2`
--
CREATE TABLE `predikat2` (
`nis` int(7) NOT NULL,
`kegiatan2` varchar(200) NOT NULL,
`keterangan2` varchar(200) NOT NULL,
`catatan_khusus2` varchar(200) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `predikat3`
--
CREATE TABLE `predikat3` (
`nis` int(7) NOT NULL,
`kegiatan3` varchar(200) NOT NULL,
`keterangan3` varchar(200) NOT NULL,
`catatan_khusus3` varchar(200) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `prestasi`
--
CREATE TABLE `prestasi` (
`nis` int(7) NOT NULL,
`ekskul` varchar(200) NOT NULL,
`ikut_serta` varchar(200) NOT NULL,
`catatan_khusus` varchar(200) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `prestasi`
--
INSERT INTO `prestasi` (`nis`, `ekskul`, `ikut_serta`, `catatan_khusus`) VALUES
(1605097, 'Fl2sn', 'juara', 'Hebat'),
(1605099, 'hebat', 'hebat', 'hebat');
-- --------------------------------------------------------
--
-- Table structure for table `siswa`
--
CREATE TABLE `siswa` (
`nis` int(7) NOT NULL,
`nisn` varchar(11) NOT NULL,
`nama` varchar(100) NOT NULL,
`kelas` varchar(5) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `siswa`
--
INSERT INTO `siswa` (`nis`, `nisn`, `nama`, `kelas`) VALUES
(1605097, '0004773512', '<NAME>', 'XII B'),
(1605099, '0029749962', '<NAME>', 'XII B'),
(1605100, '0011351718', 'FITRANUDDIN', 'XII B'),
(1605101, '0004294878', '<NAME>', 'XII B'),
(1605103, '0017897952', '<NAME>', 'XII B'),
(1605105, '0013855812', '<NAME>', 'XII B'),
(1605107, '0012471736', '<NAME>', 'XII B'),
(1605108, '0013577982', '<NAME>', 'XII B'),
(1605109, '0018387343', '<NAME>', 'XII B'),
(1605110, '0040291504', '<NAME>', 'XII B'),
(1605111, '0014355168', '<NAME>', 'XII B'),
(1605112, '0014351793', '<NAME>', 'XII B'),
(1605113, '0012179110', '<NAME>', 'XII B'),
(1678071, '99999004467', 'IBNU', 'XII B');
-- --------------------------------------------------------
--
-- Table structure for table `user`
--
CREATE TABLE `user` (
`id` int(255) NOT NULL,
`username` varchar(100) NOT NULL,
`password` varchar(100) NOT NULL,
`nama` varchar(100) NOT NULL,
`jabatan` varchar(100) NOT NULL,
`status` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `user`
--
INSERT INTO `user` (`id`, `username`, `password`, `nama`, `jabatan`, `status`) VALUES
(4, 'yayak', '$2y$10$aXtI0jvNM8lw/SfvBGLah.T1ovxiib/YDw/RC7W65/ThObJf/5BNO', 'yayak', 'Guru', 'inactive'),
(5, 'Ibnu', '$2y$10$/zOd6iWyLD4I3P0qxuuVEOlyLekwV6oDagbsoO1p.wwu4K85YBVwa', 'Ibnu Maulana', 'Guru', 'inactive'),
(7, 'admin', '$2y$10$DaxECXa3.GNcLwPC.NiSwOL8utYt4yNLyHyOQKL1ux7i/VGY4D3D2', 'admin', 'admin', 'inactive'),
(8, 'Jackie', '$2y$10$3FwgKH7HYsc3I5.D57Erwefr9HbpdT4oGuzSt0Qzj0o2T3a6sk0Za', '<NAME>', 'Guru', 'inactive');
-- --------------------------------------------------------
--
-- Stand-in structure for view `v_detail_nilai`
-- (See below for the actual view)
--
CREATE TABLE `v_detail_nilai` (
`nis` int(7)
,`nama` varchar(100)
,`kelas` varchar(5)
,`semester` int(2)
,`k3` varchar(2)
,`k4` varchar(2)
);
-- --------------------------------------------------------
--
-- Structure for view `detail_ekstra`
--
DROP TABLE IF EXISTS `detail_ekstra`;
CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `detail_ekstra` AS select `mata_pelajaran`.`kkm` AS `kkm`,`nilai`.`nis` AS `nis`,`nilai`.`predikat` AS `predikat`,`nilai`.`id_mapel` AS `id_mapel`,`nilai`.`k3` AS `k3`,`nilai`.`k4` AS `k4`,`deskripsik3`.`deskripsi_k3` AS `deskripsi_k3`,`deskripsik4`.`deskripsi_k4` AS `deskripsi_k4` from (((`nilai` join `deskripsik4`) join `deskripsik3`) join `mata_pelajaran` on(((`nilai`.`nis` = `deskripsik4`.`nis`) and (`nilai`.`nis` = `deskripsik3`.`nis`) and (`deskripsik4`.`id_mapel` = `deskripsik3`.`id_mapel`) and (`nilai`.`id_mapel` = `deskripsik4`.`id_mapel`) and (`nilai`.`id_mapel` = `deskripsik3`.`id_mapel`) and (`mata_pelajaran`.`id_mapel` = `deskripsik3`.`id_mapel`) and (`deskripsik4`.`id_mapel` = `mata_pelajaran`.`id_mapel`) and (`mata_pelajaran`.`id_mapel` = `nilai`.`id_mapel`)))) order by `nilai`.`id_mapel` ;
-- --------------------------------------------------------
--
-- Structure for view `detail_nilai`
--
DROP TABLE IF EXISTS `detail_nilai`;
CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `detail_nilai` AS select `s`.`nama` AS `nama`,`s`.`kelas` AS `kelas`,`n`.`semester` AS `semester`,`n`.`k3` AS `k3`,`n`.`k4` AS `k4` from (`siswa` `s` join `nilai` `n`) where (`s`.`nis` = `n`.`nis`) ;
-- --------------------------------------------------------
--
-- Structure for view `v_detail_nilai`
--
DROP TABLE IF EXISTS `v_detail_nilai`;
CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v_detail_nilai` AS select `siswa`.`nis` AS `nis`,`siswa`.`nama` AS `nama`,`siswa`.`kelas` AS `kelas`,`nilai`.`semester` AS `semester`,`nilai`.`k3` AS `k3`,`nilai`.`k4` AS `k4` from (`siswa` join `nilai` on((`siswa`.`nis` = `nilai`.`nis`))) ;
--
-- Indexes for dumped tables
--
--
-- Indexes for table `absen`
--
ALTER TABLE `absen`
ADD PRIMARY KEY (`nis`),
ADD KEY `id_raport` (`id_raport`);
--
-- Indexes for table `catatan_walikelas`
--
ALTER TABLE `catatan_walikelas`
ADD KEY `id_raport` (`id_raport`),
ADD KEY `nis` (`nis`);
--
-- Indexes for table `deskripsi1`
--
ALTER TABLE `deskripsi1`
ADD KEY `nis` (`nis`);
--
-- Indexes for table `deskripsik3`
--
ALTER TABLE `deskripsik3`
ADD KEY `nis` (`nis`);
--
-- Indexes for table `deskripsik4`
--
ALTER TABLE `deskripsik4`
ADD KEY `nis` (`nis`);
--
-- Indexes for table `ekskul`
--
ALTER TABLE `ekskul`
ADD PRIMARY KEY (`id_ekskul`);
--
-- Indexes for table `extra`
--
ALTER TABLE `extra`
ADD KEY `nis` (`nis`),
ADD KEY `id_ekskul` (`id_ekskul`);
--
-- Indexes for table `guru`
--
ALTER TABLE `guru`
ADD PRIMARY KEY (`nip`),
ADD KEY `id_mapel` (`id_mapel`);
--
-- Indexes for table `kelas`
--
ALTER TABLE `kelas`
ADD KEY `id_raport` (`id_raport`),
ADD KEY `kelas` (`kelas`);
--
-- Indexes for table `log_nilai`
--
ALTER TABLE `log_nilai`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `log_siswa`
--
ALTER TABLE `log_siswa`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `mata_pelajaran`
--
ALTER TABLE `mata_pelajaran`
ADD PRIMARY KEY (`id_mapel`);
--
-- Indexes for table `nilai`
--
ALTER TABLE `nilai`
ADD KEY `id_raport` (`id_raport`),
ADD KEY `nis` (`nis`);
--
-- Indexes for table `predikat2`
--
ALTER TABLE `predikat2`
ADD PRIMARY KEY (`nis`);
--
-- Indexes for table `predikat3`
--
ALTER TABLE `predikat3`
ADD PRIMARY KEY (`nis`);
--
-- Indexes for table `prestasi`
--
ALTER TABLE `prestasi`
ADD PRIMARY KEY (`nis`);
--
-- Indexes for table `siswa`
--
ALTER TABLE `siswa`
ADD PRIMARY KEY (`nis`),
ADD KEY `kelas` (`kelas`);
--
-- Indexes for table `user`
--
ALTER TABLE `user`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `ekskul`
--
ALTER TABLE `ekskul`
MODIFY `id_ekskul` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;
--
-- AUTO_INCREMENT for table `log_nilai`
--
ALTER TABLE `log_nilai`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=20;
--
-- AUTO_INCREMENT for table `log_siswa`
--
ALTER TABLE `log_siswa`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT for table `mata_pelajaran`
--
ALTER TABLE `mata_pelajaran`
MODIFY `id_mapel` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=32;
--
-- AUTO_INCREMENT for table `user`
--
ALTER TABLE `user`
MODIFY `id` int(255) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `absen`
--
ALTER TABLE `absen`
ADD CONSTRAINT `absen_ibfk_1` FOREIGN KEY (`nis`) REFERENCES `siswa` (`nis`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `catatan_walikelas`
--
ALTER TABLE `catatan_walikelas`
ADD CONSTRAINT `catatan_walikelas_ibfk_1` FOREIGN KEY (`nis`) REFERENCES `siswa` (`nis`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `deskripsi1`
--
ALTER TABLE `deskripsi1`
ADD CONSTRAINT `deskripsi1_ibfk_1` FOREIGN KEY (`nis`) REFERENCES `siswa` (`nis`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `deskripsik3`
--
ALTER TABLE `deskripsik3`
ADD CONSTRAINT `deskripsik3_ibfk_1` FOREIGN KEY (`nis`) REFERENCES `siswa` (`nis`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `deskripsik4`
--
ALTER TABLE `deskripsik4`
ADD CONSTRAINT `deskripsik4_ibfk_1` FOREIGN KEY (`nis`) REFERENCES `siswa` (`nis`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `extra`
--
ALTER TABLE `extra`
ADD CONSTRAINT `extra_ibfk_1` FOREIGN KEY (`nis`) REFERENCES `siswa` (`nis`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `extra_ibfk_2` FOREIGN KEY (`id_ekskul`) REFERENCES `ekskul` (`id_ekskul`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `guru`
--
ALTER TABLE `guru`
ADD CONSTRAINT `guru_ibfk_1` FOREIGN KEY (`id_mapel`) REFERENCES `mata_pelajaran` (`id_mapel`) ON UPDATE CASCADE;
--
-- Constraints for table `kelas`
--
ALTER TABLE `kelas`
ADD CONSTRAINT `kelas_ibfk_1` FOREIGN KEY (`kelas`) REFERENCES `siswa` (`kelas`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `predikat2`
--
ALTER TABLE `predikat2`
ADD CONSTRAINT `predikat2_ibfk_1` FOREIGN KEY (`nis`) REFERENCES `siswa` (`nis`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `predikat3`
--
ALTER TABLE `predikat3`
ADD CONSTRAINT `predikat3_ibfk_1` FOREIGN KEY (`nis`) REFERENCES `siswa` (`nis`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `prestasi`
--
ALTER TABLE `prestasi`
ADD CONSTRAINT `prestasi_ibfk_1` FOREIGN KEY (`nis`) REFERENCES `siswa` (`nis`) ON DELETE CASCADE ON UPDATE CASCADE;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
/* **************************************
*********** Strong Entities **********
**************************************
*/
-- Removed AUTO_INCREMENT
--DROP TABLE Customer CASCADE CONSTRAINTS;
CREATE TABLE Customer (
customerID NUMBER(10) NOT NULL,
fName VARCHAR2(20) NOT NULL,
mName VARCHAR2(20),
lName VARCHAR2(20) NOT NULL,
phone NUMBER(10) UNIQUE,
email VARCHAR2(60) NOT NULL UNIQUE,
street VARCHAR2(50) NOT NULL,
city VARCHAR2(20) NOT NULL,
state CHAR(2) NOT NULL,
zip CHAR(5) NOT NULL,
CONSTRAINT customer_pk PRIMARY KEY (customerID));
--DROP TABLE Payment CASCADE CONSTRAINTS;
CREATE TABLE Payment(
paymentID NUMBER(6) NOT NULL,
paymentType VARCHAR2(6) NOT NULL
CHECK (paymentType in ('Debit', 'Credit')),
paymentDigits NUMBER(4) NOT NULL,
paymentCompany VARCHAR2(16) NOT NULL,
CHECK (paymentCompany in ('Visa','AMEX', 'Mastercard', 'Bank of America', 'Capital One')),
CONSTRAINT payment_pk PRIMARY KEY (paymentID));
-- Removed AUTO_INCREMENT
--DROP TABLE Product CASCADE CONSTRAINTS;
CREATE TABLE Product(
productID NUMBER(10) NOT NULL,
productName VARCHAR2(50) NOT NULL,
productDescription VARCHAR2(50),
productQuantity NUMBER(3) NOT NULL,
productPrice NUMBER(6,2) NOT NULL,
productSection VARCHAR2(5) NOT NULL
CHECK (productSection IN ('Women','Men', 'Kids')),
productColor VARCHAR2(30) NOT NULL,
productCollection VARCHAR2(30),
productCategory VARCHAR2(30) NOT NULL,
CONSTRAINT product_pk PRIMARY KEY (productID));
-- Removed AUTO INCREMENT
--DROP TABLE Orders CASCADE CONSTRAINTS;
CREATE TABLE Orders(
orderID NUMBER(10) NOT NULL,
shippingCost NUMBER(6,2),
orderTimestamp DATE,
customerID NUMBER(10) NOT NULL,
paymentID NUMBER(6),
CONSTRAINT orders_pk PRIMARY KEY (orderID),
CONSTRAINT orders_fk1 FOREIGN KEY (customerID) REFERENCES Customer (customerID) ON DELETE CASCADE,
CONSTRAINT orders_fk2 FOREIGN KEY (paymentID) REFERENCES Payment(paymentID) ON DELETE SET NULL);
/* **************************************
*********** Weak Entities ************
**************************************
*/
--DROP TABLE Shipment CASCADE CONSTRAINTS;
CREATE TABLE Shipment(
trackingNo VARCHAR2(15) NOT NULL,
orderID NUMBER(10) NOT NULL,
street VARCHAR2(20) NOT NULL,
city VARCHAR2(20) NOT NULL,
state CHAR(2) NOT NULL,
zip CHAR(5) NOT NULL,
shippingCompany VARCHAR2(20) NOT NULL,
CONSTRAINT shipment_pk PRIMARY KEY (trackingNo, orderID),
CONSTRAINT shipmemt_fk FOREIGN KEY (orderID) REFERENCES Orders (orderID) ON DELETE CASCADE);
--DROP TABLE LineItem CASCADE CONSTRAINTS;
CREATE TABLE LineItem (
line# NUMBER(2) NOT NULL,
orderID NUMBER(10) NOT NULL,
quantity NUMBER(1) DEFAULT 1 NOT NULL,
discount NUMBER(6,2) NOT NULL,
productID NUMBER(10) NOT NULL,
CONSTRAINT lineItem_pk PRIMARY KEY (line#, orderID),
CONSTRAINT lineItem_fk1 FOREIGN KEY (orderID) REFERENCES Orders(orderID) ON DELETE CASCADE,
CONSTRAINT lineItem_fk2 FOREIGN KEY (productID) REFERENCES Product(productID) ON DELETE CASCADE);
/* **************************************
*********** Many-to-Many ************
**************************************
*/
--DROP TABLE Returns CASCADE CONSTRAINTS;
CREATE TABLE Returns(
orderID NUMBER(10) NOT NULL,
productID NUMBER(10) NOT NULL,
returnDate DATE NOT NULL,
quantity NUMBER(2) NOT NULL,
CONSTRAINT returns_pk PRIMARY KEY (orderID, productID),
CONSTRAINT returns_fk1 FOREIGN KEY (orderID) REFERENCES Orders (orderID) ON DELETE CASCADE,
CONSTRAINT returns_fk2 FOREIGN KEY (productID) REFERENCES Product(productID) ON DELETE CASCADE);
--DROP TABLE Cart CASCADE CONSTRAINTS;
CREATE TABLE Cart (
customerID NUMBER(10) NOT NULL,
productID NUMBER(10) NOT NULL,
quantity NUMBER(1) DEFAULT 1,
CONSTRAINT cart_pk PRIMARY KEY (customerID, productID),
CONSTRAINT cart_fk1 FOREIGN KEY (customerID) REFERENCES Customer(customerID) ON DELETE CASCADE,
CONSTRAINT cart_fk2 FOREIGN KEY (productID) REFERENCES Product(productID) ON DELETE CASCADE);
/* **************************************
*********** Sub-classes **************
**************************************
*/
--DROP TABLE Shoes cascade CONSTRAINTS;
CREATE TABLE Shoes(
shoesID NUMBER(10) NOT NULL,
usSize NUMBER(3,1) NOT NULL,
euSize NUMBER(3,1) NOT NULL,
CONSTRAINT shoes_pk PRIMARY KEY (shoesID),
CONSTRAINT shoes_fk FOREIGN KEY (shoesID) REFERENCES Product(productID) ON DELETE CASCADE);
--DROP TABLE Top cascade CONSTRAINTS;
CREATE TABLE Top(
topID NUMBER(10) NOT NULL,
topFit VARCHAR2(7) NOT NULL
CHECK(topFit IN ('Regular', 'Tall')),
topSize VARCHAR2(10) NOT NULL
CHECK(topSize IN ('S', 'M', 'L', 'XL', 'XXL', '3XL')),
topType VARCHAR2(11) NOT NULL
CHECK(topType IN ('T-shirt', 'Long Sleeve', 'Polo Shirt', 'Sweatshirt', 'Sleeveless')),
CONSTRAINT top_fk FOREIGN KEY (topID) REFERENCES Product(productID) ON DELETE CASCADE,
CONSTRAINT top_pk PRIMARY KEY (topID));
--DROP TABLE Bottom cascade CONSTRAINTS;
CREATE TABLE Bottom(
bottomID NUMBER(10) NOT NULL,
bottomFit VARCHAR2(7) NOT NULL
CHECK(bottomFit IN ('Regular', 'Tall')),
bottomSize VARCHAR2(10) NOT NULL
CHECK(bottomSize IN ('S', 'M', 'L', 'XL', 'XXL', '3XL')),
bottomType VARCHAR2(11) NOT NULL
CHECK(bottomType IN ('Sweatpants', 'Leggings', 'Pants', 'Shorts')),
CONSTRAINT bottom_fk FOREIGN KEY (bottomID) REFERENCES Product(productID) ON DELETE CASCADE,
CONSTRAINT bottom_pk PRIMARY KEY (bottomID));
/* **************************************
************** Grants ****************
**************************************
*/
GRANT SELECT ON Customer to PUBLIC;
GRANT SELECT ON Cart to PUBLIC;
GRANT SELECT ON Orders to PUBLIC;
GRANT SELECT ON Payment to PUBLIC;
GRANT SELECT ON Shipment to PUBLIC;
GRANT SELECT ON LineItem to PUBLIC;
GRANT SELECT ON Product to PUBLIC;
GRANT SELECT ON Shoes to PUBLIC;
GRANT SELECT ON Top to PUBLIC;
GRANT SELECT ON Bottom to PUBLIC;
GRANT SELECT ON Returns to PUBLIC;
COMMIT;
|
<filename>oauth2/routine.sql
--------------------------------------------------------------------------------
-- AddProvider -----------------------------------------------------------------
--------------------------------------------------------------------------------
CREATE OR REPLACE FUNCTION AddProvider (
pType char,
pCode text,
pName text DEFAULT null
) RETURNS integer
AS $$
DECLARE
nId integer;
BEGIN
IF session_user <> 'kernel' THEN
IF NOT IsUserRole(GetGroup('administrator')) THEN
PERFORM AccessDenied();
END IF;
END IF;
INSERT INTO oauth2.provider (type, code, name) VALUES (pType, pCode, pName)
RETURNING Id INTO nId;
RETURN nId;
END;
$$ LANGUAGE plpgsql
SECURITY DEFINER
SET search_path = kernel, pg_temp;
--------------------------------------------------------------------------------
-- FUNCTION GetProvider --------------------------------------------------------
--------------------------------------------------------------------------------
CREATE OR REPLACE FUNCTION GetProvider (
pCode text
) RETURNS integer
AS $$
SELECT id FROM oauth2.provider WHERE code = pCode;
$$ LANGUAGE sql
SECURITY DEFINER
SET search_path = kernel, pg_temp;
--------------------------------------------------------------------------------
-- FUNCTION GetProviderCode ----------------------------------------------------
--------------------------------------------------------------------------------
CREATE OR REPLACE FUNCTION GetProviderCode (
pId integer
) RETURNS text
AS $$
SELECT code FROM oauth2.provider WHERE id = pId;
$$ LANGUAGE sql
SECURITY DEFINER
SET search_path = kernel, pg_temp;
--------------------------------------------------------------------------------
-- FUNCTION GetProviderType ----------------------------------------------------
--------------------------------------------------------------------------------
CREATE OR REPLACE FUNCTION GetProviderType (
pId integer
) RETURNS char
AS $$
SELECT type FROM oauth2.provider WHERE id = pId;
$$ LANGUAGE sql
SECURITY DEFINER
SET search_path = kernel, pg_temp;
--------------------------------------------------------------------------------
-- AddApplication --------------------------------------------------------------
--------------------------------------------------------------------------------
CREATE OR REPLACE FUNCTION AddApplication (
pType char,
pCode text,
pName text DEFAULT null
) RETURNS integer
AS $$
DECLARE
nId integer;
BEGIN
IF session_user <> 'kernel' THEN
IF NOT IsUserRole(GetGroup('administrator')) THEN
PERFORM AccessDenied();
END IF;
END IF;
INSERT INTO oauth2.application (type, code, name) VALUES (pType, pCode, pName)
RETURNING Id INTO nId;
RETURN nId;
END;
$$ LANGUAGE plpgsql
SECURITY DEFINER
SET search_path = kernel, pg_temp;
--------------------------------------------------------------------------------
-- FUNCTION GetApplication -----------------------------------------------------
--------------------------------------------------------------------------------
CREATE OR REPLACE FUNCTION GetApplication (
pCode text
) RETURNS integer
AS $$
SELECT id FROM oauth2.application WHERE code = pCode;
$$ LANGUAGE sql
SECURITY DEFINER
SET search_path = kernel, pg_temp;
--------------------------------------------------------------------------------
-- FUNCTION GetApplicationCode -------------------------------------------------
--------------------------------------------------------------------------------
CREATE OR REPLACE FUNCTION GetApplicationCode (
pId integer
) RETURNS text
AS $$
SELECT code FROM oauth2.application WHERE id = pId;
$$ LANGUAGE sql
SECURITY DEFINER
SET search_path = kernel, pg_temp;
--------------------------------------------------------------------------------
-- AddIssuer -------------------------------------------------------------------
--------------------------------------------------------------------------------
CREATE OR REPLACE FUNCTION AddIssuer (
pProvider integer,
pCode text,
pName text
) RETURNS integer
AS $$
DECLARE
nId integer;
BEGIN
IF session_user <> 'kernel' THEN
IF NOT IsUserRole(GetGroup('administrator')) THEN
PERFORM AccessDenied();
END IF;
END IF;
INSERT INTO oauth2.issuer (provider, code, name) VALUES (pProvider, pCode, pName)
RETURNING Id INTO nId;
RETURN nId;
END;
$$ LANGUAGE plpgsql
SECURITY DEFINER
SET search_path = kernel, pg_temp;
--------------------------------------------------------------------------------
-- FUNCTION GetIssuer ----------------------------------------------------------
--------------------------------------------------------------------------------
CREATE OR REPLACE FUNCTION GetIssuer (
pCode text
) RETURNS integer
AS $$
SELECT id FROM oauth2.issuer WHERE code = pCode;
$$ LANGUAGE sql
SECURITY DEFINER
SET search_path = kernel, pg_temp;
--------------------------------------------------------------------------------
-- FUNCTION GetIssuerCode ------------------------------------------------------
--------------------------------------------------------------------------------
CREATE OR REPLACE FUNCTION GetIssuerCode (
pId integer
) RETURNS text
AS $$
SELECT code FROM oauth2.issuer WHERE id = pId;
$$ LANGUAGE sql
SECURITY DEFINER
SET search_path = kernel, pg_temp;
--------------------------------------------------------------------------------
-- AddAlgorithm ----------------------------------------------------------------
--------------------------------------------------------------------------------
CREATE OR REPLACE FUNCTION AddAlgorithm (
pCode text,
pName text
) RETURNS integer
AS $$
DECLARE
nId integer;
BEGIN
IF session_user <> 'kernel' THEN
IF NOT IsUserRole(GetGroup('administrator')) THEN
PERFORM AccessDenied();
END IF;
END IF;
INSERT INTO oauth2.algorithm (code, name) VALUES (pCode, pName)
RETURNING Id INTO nId;
RETURN nId;
END;
$$ LANGUAGE plpgsql
SECURITY DEFINER
SET search_path = kernel, pg_temp;
--------------------------------------------------------------------------------
-- FUNCTION GetAlgorithm -------------------------------------------------------
--------------------------------------------------------------------------------
CREATE OR REPLACE FUNCTION GetAlgorithm (
pCode text
) RETURNS integer
AS $$
SELECT id FROM oauth2.algorithm WHERE code = pCode;
$$ LANGUAGE sql
SECURITY DEFINER
SET search_path = kernel, pg_temp;
--------------------------------------------------------------------------------
-- FUNCTION GetAlgorithmCode ---------------------------------------------------
--------------------------------------------------------------------------------
CREATE OR REPLACE FUNCTION GetAlgorithmCode (
pId integer
) RETURNS text
AS $$
SELECT code FROM oauth2.algorithm WHERE id = pId;
$$ LANGUAGE sql
SECURITY DEFINER
SET search_path = kernel, pg_temp;
--------------------------------------------------------------------------------
-- FUNCTION GetAlgorithmName ---------------------------------------------------
--------------------------------------------------------------------------------
CREATE OR REPLACE FUNCTION GetAlgorithmName (
pId integer
) RETURNS text
AS $$
SELECT name FROM oauth2.algorithm WHERE id = pId;
$$ LANGUAGE sql
SECURITY DEFINER
SET search_path = kernel, pg_temp;
--------------------------------------------------------------------------------
-- CreateAudience --------------------------------------------------------------
--------------------------------------------------------------------------------
CREATE OR REPLACE FUNCTION CreateAudience (
pProvider integer,
pApplication integer,
pAlgorithm integer,
pCode text,
pSecret text,
pName text DEFAULT null
) RETURNS integer
AS $$
DECLARE
nId integer;
BEGIN
IF session_user <> 'kernel' THEN
IF NOT IsUserRole(GetGroup('administrator')) THEN
PERFORM AccessDenied();
END IF;
END IF;
INSERT INTO oauth2.audience (provider, application, algorithm, code, secret, hash, name)
VALUES (pProvider, pApplication, pAlgorithm, pCode, pSecret, crypt(pSecret, gen_salt('md5')), pName)
RETURNING Id INTO nId;
RETURN nId;
END;
$$ LANGUAGE plpgsql
SECURITY DEFINER
SET search_path = kernel, pg_temp;
--------------------------------------------------------------------------------
-- FUNCTION GetAudience --------------------------------------------------------
--------------------------------------------------------------------------------
CREATE OR REPLACE FUNCTION GetAudience (
pCode text
) RETURNS integer
AS $$
SELECT id FROM oauth2.audience WHERE code = pCode;
$$ LANGUAGE sql
SECURITY DEFINER
SET search_path = kernel, pg_temp;
--------------------------------------------------------------------------------
-- FUNCTION GetAudienceCode ----------------------------------------------------
--------------------------------------------------------------------------------
CREATE OR REPLACE FUNCTION GetAudienceCode (
pId integer
) RETURNS text
AS $$
SELECT code FROM oauth2.audience WHERE id = pId;
$$ LANGUAGE sql
SECURITY DEFINER
SET search_path = kernel, pg_temp;
|
<reponame>saturn72/data-structure
-- CreateTable
CREATE TABLE `AvosetGoOnline` (
`id` VARCHAR(191) NOT NULL,
`comment` TINYTEXT NULL,
`createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
`name` VARCHAR(255) NOT NULL,
`updatedAt` DATETIME(3) NULL,
`url` TINYTEXT NOT NULL,
`websocketUri` TINYTEXT NULL,
UNIQUE INDEX `AvosetGoOnline_name_key`(`name`),
PRIMARY KEY (`id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
-----------------------------------------------------------------
-- Updates Table
-----------------------------------------------------------------
CREATE TABLE Updates (
ScriptName NVARCHAR(256) NOT NULL
);
-----------------------------------------------------------------
-- Events Table
-----------------------------------------------------------------
CREATE TABLE Events (
Id INT NOT NULL,
[Name] NVARCHAR(15) NOT NULL,
StartDate SMALLDATETIME NOT NULL,
EndDate SMALLDATETIME NOT NULL,
CONSTRAINT Events_PK PRIMARY KEY ( Id )
);
-----------------------------------------------------------------
-- SponsorLevels Table
-----------------------------------------------------------------
CREATE TABLE SponsorLevels (
Id INT IDENTITY(1,1) NOT NULL,
DisplayOrder INT NOT NULL,
[Name] NVARCHAR(24) NOT NULL,
Cost INT NOT NULL,
DisplayInEmails BIT NOT NULL,
DisplayInSidebar BIT NOT NULL,
DisplayLink BIT NOT NULL,
TimeOnScreen INT NOT NULL,
Tickets INT NOT NULL,
Discount INT NOT NULL,
PreConEmail BIT NOT NULL,
MidConEmail BIT NOT NULL,
PostConEmail BIT NOT NULL,
CONSTRAINT SponsorLevels_PK PRIMARY KEY NONCLUSTERED ( Id ),
CONSTRAINT SponsorLevels_CI UNIQUE CLUSTERED ( DisplayOrder )
);
-----------------------------------------------------------------
-- Companies Table
-----------------------------------------------------------------
CREATE TABLE Companies (
Id INT IDENTITY(1,1) NOT NULL,
[Name] NVARCHAR(50) NOT NULL,
[Address] NVARCHAR(200) NOT NULL,
Phone VARCHAR(20) NOT NULL,
Website VARCHAR(100) NOT NULL,
Twitter NVARCHAR(20) NULL,
CONSTRAINT Companies_PK PRIMARY KEY ( Id )
);
GO
-----------------------------------------------------------------
-- Sponsors Table
-----------------------------------------------------------------
CREATE TABLE Sponsors (
Id INT IDENTITY(1,1) NOT NULL,
EventId INT NOT NULL,
CompanyId INT NOT NULL,
SponsorLevelId INT NOT NULL,
CONSTRAINT Sponsors_PK PRIMARY KEY ( Id ),
CONSTRAINT Sponsors_Events_FK FOREIGN KEY ( EventId ) REFERENCES Events ( Id ) ON UPDATE CASCADE ON DELETE CASCADE,
CONSTRAINT Sponsors_Companies_FK FOREIGN KEY ( CompanyId ) REFERENCES Companies ( Id ) ON UPDATE CASCADE ON DELETE CASCADE,
CONSTRAINT Sponsors_SponsorLevels_FK FOREIGN KEY ( SponsorLevelId ) REFERENCES SponsorLevels ( Id ) ON UPDATE CASCADE ON DELETE CASCADE
);
|
-- 2020-07-07T12:35:02.025Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Val_Rule (AD_Client_ID,AD_Org_ID,AD_Val_Rule_ID,Code,Created,CreatedBy,EntityType,IsActive,Name,Type,Updated,UpdatedBy) VALUES (0,0,540507,'ESR_Import.IsProcessed=''Y'' AND ESR_Import.IsReconciled=''N''',TO_TIMESTAMP('2020-07-07 15:35:01','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','ESR_Import_EligibleToBeReconciliatedWithBankStatement','S',TO_TIMESTAMP('2020-07-07 15:35:01','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2020-07-07T12:35:22.805Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Para SET AD_Val_Rule_ID=540507,Updated=TO_TIMESTAMP('2020-07-07 15:35:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=541763
;
-- 2020-07-14T13:26:35.743Z
-- URL zum Konzept
UPDATE AD_Val_Rule SET Code='ESR_Import.IsReconciled=''N''',Updated=TO_TIMESTAMP('2020-07-14 16:26:35','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=540507
;
|
-- Function: "de.metas.handlingunits".huattributeinfo(numeric, varchar)
-- DROP FUNCTION IF EXISTS "de.metas.handlingunits".huattributeinfo(numeric, varchar);
CREATE OR REPLACE FUNCTION "de.metas.handlingunits".huattributeinfo(p_m_hu_id numeric, m_attribute_value varchar)
RETURNS character varying AS
$$
SELECT
(
a.Value
|| '(' || a.Name || ')'
|| ', Value: ' || COALESCE(hua.Value::VARCHAR, '')
|| ', ValueNumber: ' || COALESCE(hua.ValueNumber::VARCHAR, '')
|| ', ValueInitial: ' || COALESCE(hua.ValueInitial::VARCHAR, '')
|| ', ValueNumberInitial: ' || COALESCE(hua.ValueNumberInitial::VARCHAR, '')
) AS huAttributeInfo
FROM M_HU hu
INNER JOIN M_HU_Attribute hua ON hua.M_HU_ID=hu.M_HU_ID
INNER JOIN M_Attribute a ON a.M_Attribute_ID=hua.M_Attribute_ID
WHERE hu.M_HU_ID=$1 AND a.Value=$2;
$$
LANGUAGE SQL STABLE
COST 100;
COMMENT ON FUNCTION "de.metas.handlingunits".huattributeinfo(numeric, varchar) IS 'fresh 06936: Track attribute values of given HU ID and M_Attribute.Value - i.e HU ID "1000000" and Attribute value "WeightNet"'
|
Subsets and Splits