sql
stringlengths
6
1.05M
<reponame>Zorin95670/project-template-api GRANT CONNECT ON DATABASE PROJECT_NAME_db TO PROJECT_NAME; GRANT USAGE ON SCHEMA public TO PROJECT_NAME; GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO PROJECT_NAME; GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA public TO PROJECT_NAME; CREATE EXTENSION IF NOT EXISTS pgcrypto;
<reponame>MassStreetUniversity/tutorial-transact-sql USE AdventureWorks2016 DECLARE @FirstName NVARCHAR(20) SET @FirstName = 'Bob'
<gh_stars>100-1000 /***************************************************************************************/ -- STORED PROCEDURE -- DeleteDeletedInstance -- -- DESCRIPTION -- Removes a deleted instance from the DeletedInstance table -- -- PARAMETERS -- @studyInstanceUid -- * The study instance UID. -- @seriesInstanceUid -- * The series instance UID. -- @sopInstanceUid -- * The SOP instance UID. -- @watermark -- * The watermark of the entry /***************************************************************************************/ CREATE OR ALTER PROCEDURE dbo.DeleteDeletedInstance( @studyInstanceUid VARCHAR(64), @seriesInstanceUid VARCHAR(64), @sopInstanceUid VARCHAR(64), @watermark BIGINT ) AS SET NOCOUNT ON DELETE FROM dbo.DeletedInstance WHERE StudyInstanceUid = @studyInstanceUid AND SeriesInstanceUid = @seriesInstanceUid AND SopInstanceUid = @sopInstanceUid AND Watermark = @watermark
USE [perpetuumsa] GO ---------------------------------- -- Metis balance updates -- Date modified: 2021/03/15 ---------------------------------- DROP TABLE IF EXISTS #AGG_VALS; CREATE TABLE #AGG_VALS( defName VARCHAR(100), fieldName VARCHAR(100), fieldValue float ); INSERT INTO #AGG_VALS (defName, fieldName, fieldValue) VALUES ('def_metis_head', 'locked_targets_max', 6), ('def_metis_head', 'sensor_strength', 95), ('def_metis_head', 'detection_strength', 80), ('def_metis_head', 'stealth_strength', 105); PRINT N'UPDATE AGG VALUES'; MERGE [dbo].[aggregatevalues] a USING #AGG_VALS v ON a.definition = (SELECT TOP 1 definition FROM entitydefaults WHERE definitionname=v.defName) AND a.field = (SELECT TOP 1 id FROM aggregatefields WHERE name=v.fieldName) WHEN MATCHED THEN UPDATE SET value=v.fieldValue; DROP TABLE IF EXISTS #AGG_VALS; PRINT N'UPDATED METIS BOT STATS'; GO USE [perpetuumsa] GO ---------------------------------- -- Metis Bonus reversed bug -- Date modified: 2021/04/03 ---------------------------------- DROP TABLE IF EXISTS #BONUS; CREATE TABLE #BONUS( defName VARCHAR(100), bonusField VARCHAR(100), bonusSkill VARCHAR(100), bonusAmount FLOAT ); INSERT INTO #BONUS (defName, bonusField, bonusSkill, bonusAmount) VALUES ('def_metis_head', 'reactor_radiation_modifier', 'ext_indy_role_specialist', -0.03); PRINT N'UPDATE [chassisbonus]'; MERGE [dbo].[chassisbonus] a USING #BONUS v ON a.definition = (SELECT TOP 1 definition FROM entitydefaults WHERE definitionname=v.defName) AND a.targetpropertyID = (SELECT TOP 1 id FROM aggregatefields WHERE name=v.bonusField) AND a.extension = (SELECT TOP 1 extensionid FROM extensions WHERE extensionname=v.bonusSkill) WHEN MATCHED THEN UPDATE SET bonus=v.bonusAmount; DROP TABLE IF EXISTS #BONUS; PRINT N'UPDATED METIS BOT Bonuses'; GO
<reponame>BaiShaoqi/geospatial -- NULL raster SELECT ST_AsText(ST_Envelope(NULL::raster)); -- width and height of zero SELECT ST_AsText(ST_Envelope(ST_MakeEmptyRaster(0, 0, 0, 0, 1, -1, 0, 0, 0))); -- width of zero SELECT ST_AsText(ST_Envelope(ST_MakeEmptyRaster(0, 9, 0, 0, 1, -1, 0, 0, 0))); -- height of zero SELECT ST_AsText(ST_Envelope(ST_MakeEmptyRaster(9, 0, 0, 0, 1, -1, 0, 0, 0))); -- normal raster SELECT ST_AsText(ST_Envelope(ST_MakeEmptyRaster(9, 9, 0, 0, 1, -1, 0, 0, 0)));
<reponame>kubasedziel/Nethos DROP TABLE IF EXISTS KONTRAHENT ; DROP TABLE IF EXISTS CONTRACTOR ; DROP TABLE IF EXISTS KONTO_BANKOWE; DROP TABLE IF EXISTS ACCOUNT; DROP SEQUENCE IF EXISTS kontrahent_seq; DROP SEQUENCE IF EXISTS contractor_seq; DROP SEQUENCE IF EXISTS konto_bankowe_seq; DROP SEQUENCE IF EXISTS account_seq; CREATE SEQUENCE contractor_seq MINVALUE 1 START WITH 1 INCREMENT BY 1 NOCACHE NOCYCLE; CREATE SEQUENCE account_seq MINVALUE 1 START WITH 1 INCREMENT BY 1 NOCACHE NOCYCLE; CREATE TABLE CONTRACTOR ( id INT DEFAULT nextval('contractor_seq') NOT NULL PRIMARY KEY, name VARCHAR(100) NOT NULL, nip VARCHAR(11) NOT NULL ); CREATE TABLE ACCOUNT ( id INT DEFAULT nextval('account_seq') NOT NULL PRIMARY KEY, contractor_id INT, number VARCHAR(26) NOT NULL, active INT NOT NULL, default_account INT NOT NULL, virtual INT NOT NULL, verification_state INT, verification_date TIMESTAMP ); INSERT INTO CONTRACTOR (name,nip) VALUES ('<NAME> i <NAME>','5840900085'), ('LYRECO POLSKA S.A.','5212711056'), ('ZPM TS Sp. z o.o.','9571077874'), ('Merida Sp. z o.o.','8990024020'), ('<NAME>', '7272445205'); INSERT INTO ACCOUNT (contractor_id,number,active,default_account,virtual,verification_state,verification_date) VALUES (1,'30124012681111001062586774',1,1,0,1,'2019-01-01 01:02:03'), (2,'18124011121111001000261358',1,1,0,null,null), (3,'30124012681111001062586774',1,1,0,null,null), (3,'96109010980000000141228877',1,0,0,null,null), (3,'73124012681111001063102816',1,0,0,null,null), (3,'92109010980000000140296488',1,0,0,null,null), (3,'24124012681111001067852236',1,0,0,null,null), (4,'13103012890000000088620003',1,1,0,null,null), (4,'92820010216218150742731348',0,1,0,null,null), (4,'82150021659665252748870318',0,1,0,null,null), (4,'75124056868389315074760969',0,1,1,null,null), (4,'37130010493110949241487155',0,1,0,null,null), (4,'48909610149341085785996968',0,0,1,null,null), (5,'17114000001527010928203867',1,1,0,null,null), (5,'17114000001527010928201111',1,0,0,null,null);
<gh_stars>1-10 USE light_db; INSERT INTO users (avatar_src, first_name, last_name, email, user_desc, user_password, user_venmo, user_location) VALUES ("https://avatars0.githubusercontent.com/u/59098488?v=4&s=200", "Rachel", "Murray", "<EMAIL>", "dcbeergoddess", "password", <PASSWORD>", "Washington, DC"), ("https://avatars0.githubusercontent.com/u/47487767?v=4&s=200", "William", "Rave", "<EMAIL>", "test", "test", "@test", "Rockville"), ("https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcRxFTfDWP1_UzRnpPSdI4Ue5ZZ-0uHLAuiJt-w5YtNjM2VMcZW0&usqp=CAU/200x200","Nicholas", "Cage","<EMAIL>","Bees!","password","<PASSWORD>!","<PASSWORD>"), ("https://avatars3.githubusercontent.com/u/444729?v=4&s=200","Gary", "Almes", "<EMAIL>","Dammit Dan.","password","<PASSWORD>","<PASSWORD>"), ("https://avatars0.githubusercontent.com/u/60627197?v=4&s=200", "Jenelle", "Langford", "<EMAIL>","test","test","venmo","Virgnia"), ("https://avatars2.githubusercontent.com/u/50913521?v=4&s=200","Dan", "Rosenbaum", "<EMAIL>","You aren't getting any money Gary","password","<PASSWORD>","<PASSWORD>"); INSERT INTO workers (requests, skills, user_id) VALUES ("website", "drinking", 1), ("Foreign Key explanation","Pyromania", 2), ("Bees!","Bees!", 3); INSERT INTO coders (speciality, tech_skills, github, user_id) VALUES ("Web Development", "Full-Stack", "garytalmes", 4), ("Web Development", "CSS", "jenellelangford", 5); INSERT INTO patrons (user_id) VALUES (6);
CREATE OR REPLACE FUNCTION z_blocking.drop_old_partitions(p_table_base_name text, p_drop_timestamp timestamp with time zone) RETURNS void AS $$ DECLARE l_week_to_drop text := to_char(p_drop_timestamp, 'YYYYIW'); l_sql text; l_table_to_drop text; c record; BEGIN l_table_to_drop := format('%s_%s', p_table_base_name, l_week_to_drop); l_sql := format('select table_name from information_schema.tables where table_schema = ''%s'' and table_name <= ''%s'' and table_name like ''%s\_%%''', 'z_blocking', l_table_to_drop, p_table_base_name); FOR c in EXECUTE l_sql LOOP l_sql := 'drop table if exists '|| c.table_name; RAISE WARNING 'dropping %', c.table_name; EXECUTE l_sql; END LOOP; END; $$ language plpgsql; CREATE OR REPLACE FUNCTION z_blocking.blocking_locks_insert_trigger() RETURNS TRIGGER AS $$ DECLARE l_table_name text := 'blocking_locks'; l_table_full_name text := 'z_blocking.blocking_locks'; l_partition_key text := 'bl_timestamp'; l_weeks_to_keep interval := '4 weeks'; l_partition_full_name text; l_sql text; l_partition_week text; l_date_check_lower timestamp; l_date_check_upper timestamp; l_table_to_drop text; BEGIN l_partition_week := to_char(NEW.bl_timestamp, 'YYYYIW'); l_date_check_lower = date_trunc('week', NEW.bl_timestamp); l_date_check_upper = date_trunc('week', NEW.bl_timestamp) + '1 week'::interval; l_partition_full_name := format('z_blocking.%s_%s', l_table_name, l_partition_week); IF NOT EXISTS (SELECT 1 FROM pg_tables WHERE tablename = l_table_name||'_'||l_partition_week AND schemaname = 'z_blocking') THEN l_sql := format('CREATE TABLE %s (LIKE %s INCLUDING ALL) INHERITS (%s)', l_partition_full_name, l_table_full_name, l_table_full_name); --RAISE WARNING '%', l_sql; EXECUTE l_sql; l_sql := format('ALTER TABLE %s ADD CONSTRAINT date_range CHECK (%s >= ''%s'' AND %s < ''%s'')', l_partition_full_name, l_partition_key, l_date_check_lower, l_partition_key, l_date_check_upper); --RAISE WARNING '%', l_sql; EXECUTE l_sql; -- cleanup. keeping 4 weekly partitions PERFORM z_blocking.drop_old_partitions(l_table_name, l_date_check_lower - l_weeks_to_keep); END IF; l_sql := 'INSERT INTO '|| l_partition_full_name ||' SELECT (' || quote_literal( NEW ) || '::'||l_table_full_name || ').*' ; EXECUTE l_sql; RETURN NULL; END; $$ LANGUAGE plpgsql; DROP TRIGGER IF EXISTS blocking_locks_part_ins ON z_blocking.blocking_locks; CREATE TRIGGER blocking_locks_part_ins BEFORE INSERT ON z_blocking.blocking_locks FOR EACH ROW EXECUTE PROCEDURE z_blocking.blocking_locks_insert_trigger(); CREATE OR REPLACE FUNCTION z_blocking.blocking_processes_insert_trigger() RETURNS TRIGGER AS $$ DECLARE l_table_name text := 'blocking_processes'; l_table_full_name text := 'z_blocking.blocking_processes'; l_partition_key text := 'bp_timestamp'; l_weeks_to_keep interval := '4 weeks'; l_partition_full_name text; l_sql text; l_partition_week text; l_date_check_lower timestamp; l_date_check_upper timestamp; l_table_to_drop text; BEGIN l_partition_week := to_char(NEW.bp_timestamp, 'YYYYIW'); l_date_check_lower = date_trunc('week', NEW.bp_timestamp); l_date_check_upper = date_trunc('week', NEW.bp_timestamp) + '1 week'::interval; l_partition_full_name := format('z_blocking.%s_%s', l_table_name, l_partition_week); IF NOT EXISTS (SELECT 1 FROM pg_tables WHERE tablename = l_table_name||'_'||l_partition_week AND schemaname = 'z_blocking') THEN l_sql := format('CREATE TABLE %s (LIKE %s INCLUDING ALL) INHERITS (%s)', l_partition_full_name, l_table_full_name, l_table_full_name); --RAISE WARNING '%', l_sql; EXECUTE l_sql; l_sql := format('ALTER TABLE %s ADD CONSTRAINT date_range CHECK (%s >= ''%s'' AND %s < ''%s'')', l_partition_full_name, l_partition_key, l_date_check_lower, l_partition_key, l_date_check_upper); --RAISE WARNING '%', l_sql; EXECUTE l_sql; -- cleanup. keeping 4 weekly partitions PERFORM z_blocking.drop_old_partitions(l_table_name, l_date_check_lower - l_weeks_to_keep); END IF; l_sql := 'INSERT INTO '|| l_partition_full_name ||' SELECT (' || quote_literal( NEW ) || '::'||l_table_full_name || ').*' ; EXECUTE l_sql; RETURN NULL; END; $$ LANGUAGE plpgsql; DROP TRIGGER IF EXISTS blocking_processes_part_ins ON z_blocking.blocking_processes; CREATE TRIGGER blocking_processes_part_ins BEFORE INSERT ON z_blocking.blocking_processes FOR EACH ROW EXECUTE PROCEDURE z_blocking.blocking_processes_insert_trigger();
DROP PROCEDURE cayenne_tst_out_proc
<filename>chen-mybatis/src/main/resources/user.sql -- -------------------------------------------------------- -- 主机: 127.0.0.1 -- 服务器版本: 10.4.17-MariaDB - mariadb.org binary distribution -- 服务器操作系统: Win64 -- HeidiSQL 版本: 11.2.0.6213 -- -------------------------------------------------------- /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET NAMES utf8 */; /*!50503 SET NAMES utf8mb4 */; /*!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 */; -- 导出 test 的数据库结构 CREATE DATABASE IF NOT EXISTS `test` /*!40100 DEFAULT CHARACTER SET latin1 */; USE `test`; -- 导出 表 test.user 结构 CREATE TABLE IF NOT EXISTS `user` ( `id` varchar(50) DEFAULT NULL, `username` varchar(50) DEFAULT NULL, `password` varchar(50) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- 正在导出表 test.user 的数据:~1 rows (大约) /*!40000 ALTER TABLE `user` DISABLE KEYS */; INSERT INTO `user` (`id`, `username`, `password`) VALUES ('1', '<PASSWORD>', '<PASSWORD>'); /*!40000 ALTER TABLE `user` ENABLE KEYS */; /*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */; /*!40014 SET FOREIGN_KEY_CHECKS=IFNULL(@OLD_FOREIGN_KEY_CHECKS, 1) */; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40111 SET SQL_NOTES=IFNULL(@OLD_SQL_NOTES, 1) */;
<gh_stars>0 -- Usersdb clear truncate user_db.user_system; delete from user_db.users where id > 0; alter table user_db.users auto_increment = 1; -- Usersdb insert insert into user_db.users values (1, '<NAME>','+380665544259', '<EMAIL>', 14 ), (2, '<NAME>','+380664658465', '<EMAIL>', 15 ), (3, '<NAME>','+380666548465', '<EMAIL>', 16 ), (4, '<NAME>','+380661321548', '<EMAIL>', 17 ); insert into user_db.user_system values (1, 'Chrome', '172.16.17.32', now() ), (2, 'Safari', '172.16.31.10', now()), (3, 'Mozilla', '172.16.31.10', now()), (4, 'Chrome', '192.168.127.12', now()); -- Usersdb select select * from user_db.users; select * from user_db.user_system; select user_db.users.id, name, phone, email, hour, ip, brouser, time from user_db.users inner join user_db.user_system on (user_db.user_system.user = user_db.users.id)
<filename>vertica-user-ddl.sql CREATE OR REPLACE VIEW public.user_ddl AS ( -- create roles SELECT 0 as grant_order, name principal_name, 'CREATE ROLE "' || name || '"' || ';' AS sql, 'NONE' as object_type, 'NONE' as object_name FROM roles ) UNION ALL ( -- create users based on -- account lock -- grace period -- idle session timeout -- max connection -- memory cap -- profile -- resource pool -- run time cap -- search path -- temp space cap SELECT 1 AS step, user_name, 'CREATE USER "' || user_name || '"' || DECODE(is_locked, TRUE, ' ACCOUNT LOCK', '') || DECODE( grace_period, 'undefined', '', ' GRACEPERIOD ''' || grace_period || '''' ) || DECODE( idle_session_timeout, 'unlimited', '', ' IDLESESSIONTIMEOUT ''' || idle_session_timeout || '''' ) || DECODE( max_connections, 'unlimited', '', ' MAXCONNECTIONS ' || max_connections || ' ON ' || connection_limit_mode ) || DECODE( memory_cap_kb, 'unlimited', '', ' MEMORYCAP ''' || memory_cap_kb || 'K''' ) || DECODE( profile_name, 'default', '', ' PROFILE ' || profile_name ) || DECODE( resource_pool, 'general', '', ' RESOURCE POOL ' || resource_pool ) || DECODE( run_time_cap, 'unlimited', '', ' RUNTIMECAP ''' || run_time_cap || '''' ) || DECODE( search_path, '', '', ' SEARCH_PATH ' || search_path ) || DECODE( temp_space_cap_kb, 'unlimited', '', ' TEMPSPACECAP ''' || temp_space_cap_kb || 'K''' ) || ';' AS sql, 'NONE' as object_type, 'NONE' as object_name FROM users ) UNION ALL ( -- grant access to -- resource pool -- storage location -- client authentication -- database -- library -- procedures -- procedure type -- procedure_argument_types -- role -- table -- view SELECT 2, grantee, 'GRANT ' || REPLACE( TRIM( BOTH ' ' FROM words ), '*', '' ) || CASE WHEN object_type = 'RESOURCEPOOL' THEN ' ON RESOURCE POOL ' WHEN object_type = 'STORAGELOCATION' THEN ' ON STORAGE LOCATION ' WHEN object_type = 'CLIENTAUTHENTICATION' THEN 'AUTHENTICATION ' WHEN object_type IN ( 'DATABASE', 'LIBRARY', 'MODEL', 'SEQUENCE', 'SCHEMA' ) THEN ' ON ' || object_type || ' ' WHEN object_type = 'PROCEDURE' THEN ( SELECT ' ON ' || CASE REPLACE(procedure_type, 'User Defined ', '') WHEN 'Transform' THEN 'TRANSFORM FUNCTION ' WHEN 'Aggregate' THEN 'AGGREGATE FUNCTION ' WHEN 'Analytic' THEN 'ANALYTIC FUNCTION ' ELSE UPPER(REPLACE(procedure_type, 'User Defined ', '')) || ' ' END FROM vs_procedures WHERE proc_oid = object_id ) WHEN object_type = 'ROLE' THEN '' ELSE ' ON ' END || NVL2(object_schema, object_schema || '.', '') || object_name || CASE WHEN object_type = 'PROCEDURE' THEN ( SELECT DECODE( procedure_argument_types, '', '()', '(' || procedure_argument_types || ')' ) FROM vs_procedures WHERE proc_oid = object_id ) ELSE '' END || ' TO ' || grantee || CASE WHEN INSTR(words, '*') > 0 THEN ' WITH GRANT OPTION' ELSE '' END || ';', object_type, object_name FROM ( SELECT grantee, object_type, object_schema, object_name, object_id, v_txtindex.StringTokenizerDelim( DECODE( privileges_description, '', ',', privileges_description ), ',' ) OVER ( PARTITION BY grantee, object_type, object_schema, object_name, object_id ) FROM grants ) foo ORDER BY CASE REPLACE( TRIM( BOTH ' ' FROM words ), '*', '' ) WHEN 'USAGE' THEN 1 ELSE 2 END ) UNION ALL ( -- grant default roles SELECT 3, -- Default ROLEs user_name, 'ALTER USER "' || user_name || '"' || DECODE( default_roles, '', '', ' DEFAULT ROLE ' || REPLACE(default_roles, '*', '') ) || ';', 'NONE' as object_type, 'NONE' as object_name FROM users WHERE default_roles <> '' ) UNION ALL ( -- grant admin options options SELECT 4, user_name, 'GRANT ' || REPLACE( TRIM( BOTH ' ' FROM words ), '*', '' ) || ' TO ' || user_name || ' WITH ADMIN OPTION;', 'NONE' as object_type, 'NONE' as object_name FROM ( SELECT user_name, v_txtindex.StringTokenizerDelim(DECODE(all_roles, '', ',', all_roles), ',') OVER (PARTITION BY user_name) FROM users WHERE all_roles <> '' ) foo WHERE INSTR(words, '*') > 0 ) UNION ALL ( -- grant schema priveleges select 5, 'public', 'ALTER SCHEMA ' || name || ' DEFAULT ' || CASE WHEN defaultinheritprivileges THEN ' INCLUDE PRIVILEGES' ELSE ' EXCLUDE PRIVILEGES ;' END, 'SCHEMA', name from vs_schemata ) UNION ALL ( -- grant inherit priveleges for database select 6, 'public', 'ALTER DATABASE ' || database_name || ' SET disableinheritedprivileges = ' || current_value || ';', 'DATABASE', database_name from vs_configuration_parameters cross join databases where parameter_name ilike 'DisableInheritedPrivileges' ) UNION ALL ( -- table priveleges inheritence SELECT 7, 'public', 'ALTER TABLE ' || table_schema || '.' || table_name || CASE WHEN inheritprivileges THEN ' INCLUDE PRIVILEGES ;' ELSE ' EXCLUDE PRIVILEGES ;' END, 'TABLE' as object_type, table_schema || '.' || table_name as object_name from v_internal.vs_tables join v_catalog.tables on (table_id = oid) ) UNION ALL ( -- view priveleges inheritence SELECT 8, 'public', 'ALTER VIEW ' || table_schema || '.' || table_name || CASE WHEN inherit_privileges THEN ' INCLUDE PRIVILEGES ;' ELSE ' EXCLUDE PRIVILEGES ; ' END, 'TABLE' as object_type, table_schema || '.' || table_name as object_name from v_catalog.views ) UNION ALL ( -- change owner for tables select 9, owner_name, 'ALTER TABLE ' || table_schema || '.' || table_name || ' OWNER TO ' || owner_name || ';', 'TABLE', table_schema || '.' || table_name from v_catalog.tables ) UNION ALL ( -- change owner for views select 10, owner_name, 'ALTER VIEW ' || table_schema || '.' || table_name || ' OWNER TO ' || owner_name || ';', 'TABLE', table_schema || '.' || table_name from v_catalog.views );
<gh_stars>1-10 ALTER TABLE test_location ADD COLUMN enabled boolean; ALTER TABLE test_location ALTER COLUMN street_address_1 DROP NOT NULL; ALTER TABLE test_location ALTER COLUMN street_address_2 DROP NOT NULL; ALTER TABLE test_location ALTER COLUMN city DROP NOT NULL; ALTER TABLE test_location ALTER COLUMN postal_code DROP NOT NULL;
SELECT 'database atomic tests'; DROP DATABASE IF EXISTS test1601_detach_permanently_atomic; CREATE DATABASE test1601_detach_permanently_atomic Engine=Atomic; create table test1601_detach_permanently_atomic.test_name_reuse (number UInt64) engine=MergeTree order by tuple(); INSERT INTO test1601_detach_permanently_atomic.test_name_reuse SELECT * FROM numbers(100); DETACH table test1601_detach_permanently_atomic.test_name_reuse PERMANENTLY; SELECT 'can not create table with same name as detached permanently'; create table test1601_detach_permanently_atomic.test_name_reuse (number UInt64) engine=MergeTree order by tuple(); -- { serverError 57 } SELECT 'can not detach twice'; DETACH table test1601_detach_permanently_atomic.test_name_reuse PERMANENTLY; -- { serverError 60 } DETACH table test1601_detach_permanently_atomic.test_name_reuse; -- { serverError 60 } SELECT 'can not drop detached'; drop table test1601_detach_permanently_atomic.test_name_reuse; -- { serverError 60 } create table test1601_detach_permanently_atomic.test_name_rename_attempt (number UInt64) engine=MergeTree order by tuple(); SELECT 'can not replace with the other table'; RENAME TABLE test1601_detach_permanently_atomic.test_name_rename_attempt TO test1601_detach_permanently_atomic.test_name_reuse; -- { serverError 57 } EXCHANGE TABLES test1601_detach_permanently_atomic.test_name_rename_attempt AND test1601_detach_permanently_atomic.test_name_reuse; -- { serverError 60 } SELECT 'can still show the create statement'; SHOW CREATE TABLE test1601_detach_permanently_atomic.test_name_reuse FORMAT Vertical; SELECT 'can not attach with bad uuid'; ATTACH TABLE test1601_detach_permanently_atomic.test_name_reuse UUID '00000000-0000-0000-0000-000000000001' (`number` UInt64 ) ENGINE = MergeTree ORDER BY tuple() SETTINGS index_granularity = 8192 ; -- { serverError 57 } SELECT 'can attach with short syntax'; ATTACH TABLE test1601_detach_permanently_atomic.test_name_reuse; SELECT count() FROM test1601_detach_permanently_atomic.test_name_reuse; DETACH table test1601_detach_permanently_atomic.test_name_reuse; SELECT 'can not detach permanently the table which is already detached (temporary)'; DETACH table test1601_detach_permanently_atomic.test_name_reuse PERMANENTLY; -- { serverError 60 } DETACH DATABASE test1601_detach_permanently_atomic; ATTACH DATABASE test1601_detach_permanently_atomic; SELECT count() FROM test1601_detach_permanently_atomic.test_name_reuse; SELECT 'After database reattachement the table is back (it was detached temporary)'; SELECT 'And we can detach it permanently'; DETACH table test1601_detach_permanently_atomic.test_name_reuse PERMANENTLY; DETACH DATABASE test1601_detach_permanently_atomic; ATTACH DATABASE test1601_detach_permanently_atomic; SELECT 'After database reattachement the table is still absent (it was detached permamently)'; SELECT 'And we can not detach it permanently'; DETACH table test1601_detach_permanently_atomic.test_name_reuse PERMANENTLY; -- { serverError 60 } SELECT 'But we can attach it back'; ATTACH TABLE test1601_detach_permanently_atomic.test_name_reuse; SELECT 'And detach permanently again to check how database drop will behave'; DETACH table test1601_detach_permanently_atomic.test_name_reuse PERMANENTLY; SELECT 'DROP database'; DROP DATABASE test1601_detach_permanently_atomic SYNC; SELECT '-----------------------'; SELECT 'database ordinary tests'; DROP DATABASE IF EXISTS test1601_detach_permanently_ordinary; CREATE DATABASE test1601_detach_permanently_ordinary Engine=Ordinary; create table test1601_detach_permanently_ordinary.test_name_reuse (number UInt64) engine=MergeTree order by tuple(); INSERT INTO test1601_detach_permanently_ordinary.test_name_reuse SELECT * FROM numbers(100); DETACH table test1601_detach_permanently_ordinary.test_name_reuse PERMANENTLY; SELECT 'can not create table with same name as detached permanently'; create table test1601_detach_permanently_ordinary.test_name_reuse (number UInt64) engine=MergeTree order by tuple(); -- { serverError 57 } SELECT 'can not detach twice'; DETACH table test1601_detach_permanently_ordinary.test_name_reuse PERMANENTLY; -- { serverError 60 } DETACH table test1601_detach_permanently_ordinary.test_name_reuse; -- { serverError 60 } SELECT 'can not drop detached'; drop table test1601_detach_permanently_ordinary.test_name_reuse; -- { serverError 60 } create table test1601_detach_permanently_ordinary.test_name_rename_attempt (number UInt64) engine=MergeTree order by tuple(); SELECT 'can not replace with the other table'; RENAME TABLE test1601_detach_permanently_ordinary.test_name_rename_attempt TO test1601_detach_permanently_ordinary.test_name_reuse; -- { serverError 57 } SELECT 'can still show the create statement'; SHOW CREATE TABLE test1601_detach_permanently_ordinary.test_name_reuse FORMAT Vertical; SELECT 'can attach with full syntax'; ATTACH TABLE test1601_detach_permanently_ordinary.test_name_reuse (`number` UInt64 ) ENGINE = MergeTree ORDER BY tuple() SETTINGS index_granularity = 8192; DETACH table test1601_detach_permanently_ordinary.test_name_reuse PERMANENTLY; SELECT 'can attach with short syntax'; ATTACH TABLE test1601_detach_permanently_ordinary.test_name_reuse; DETACH table test1601_detach_permanently_ordinary.test_name_reuse; SELECT 'can not detach permanently the table which is already detached (temporary)'; DETACH table test1601_detach_permanently_ordinary.test_name_reuse PERMANENTLY; -- { serverError 60 } DETACH DATABASE test1601_detach_permanently_ordinary; ATTACH DATABASE test1601_detach_permanently_ordinary; SELECT 'After database reattachement the table is back (it was detached temporary)'; SELECT 'And we can detach it permanently'; DETACH table test1601_detach_permanently_ordinary.test_name_reuse PERMANENTLY; DETACH DATABASE test1601_detach_permanently_ordinary; ATTACH DATABASE test1601_detach_permanently_ordinary; SELECT 'After database reattachement the table is still absent (it was detached permamently)'; SELECT 'And we can not detach it permanently'; DETACH table test1601_detach_permanently_ordinary.test_name_reuse PERMANENTLY; -- { serverError 60 } SELECT 'But we can attach it back'; ATTACH TABLE test1601_detach_permanently_ordinary.test_name_reuse; SELECT 'And detach permanently again to check how database drop will behave'; DETACH table test1601_detach_permanently_ordinary.test_name_reuse PERMANENTLY; SELECT 'DROP database - Directory not empty error, but database detached'; DROP DATABASE test1601_detach_permanently_ordinary; -- { serverError 1001 } ATTACH DATABASE test1601_detach_permanently_ordinary; ATTACH TABLE test1601_detach_permanently_ordinary.test_name_reuse; DROP TABLE test1601_detach_permanently_ordinary.test_name_reuse; SELECT 'DROP database - now success'; DROP DATABASE test1601_detach_permanently_ordinary; SELECT '-----------------------'; SELECT 'database lazy tests'; DROP DATABASE IF EXISTS test1601_detach_permanently_lazy; CREATE DATABASE test1601_detach_permanently_lazy Engine=Lazy(10); create table test1601_detach_permanently_lazy.test_name_reuse (number UInt64) engine=Log; INSERT INTO test1601_detach_permanently_lazy.test_name_reuse SELECT * FROM numbers(100); DETACH table test1601_detach_permanently_lazy.test_name_reuse PERMANENTLY; SELECT 'can not create table with same name as detached permanently'; create table test1601_detach_permanently_lazy.test_name_reuse (number UInt64) engine=Log; -- { serverError 57 } SELECT 'can not detach twice'; DETACH table test1601_detach_permanently_lazy.test_name_reuse PERMANENTLY; -- { serverError 60 } DETACH table test1601_detach_permanently_lazy.test_name_reuse; -- { serverError 60 } SELECT 'can not drop detached'; drop table test1601_detach_permanently_lazy.test_name_reuse; -- { serverError 60 } create table test1601_detach_permanently_lazy.test_name_rename_attempt (number UInt64) engine=Log; SELECT 'can not replace with the other table'; RENAME TABLE test1601_detach_permanently_lazy.test_name_rename_attempt TO test1601_detach_permanently_lazy.test_name_reuse; -- { serverError 57 } SELECT 'can still show the create statement'; SHOW CREATE TABLE test1601_detach_permanently_lazy.test_name_reuse FORMAT Vertical; SELECT 'can attach with full syntax'; ATTACH TABLE test1601_detach_permanently_lazy.test_name_reuse (`number` UInt64 ) ENGINE = Log; DETACH table test1601_detach_permanently_lazy.test_name_reuse PERMANENTLY; SELECT 'can attach with short syntax'; ATTACH TABLE test1601_detach_permanently_lazy.test_name_reuse; DETACH table test1601_detach_permanently_lazy.test_name_reuse; SELECT 'can not detach permanently the table which is already detached (temporary)'; DETACH table test1601_detach_permanently_lazy.test_name_reuse PERMANENTLY; -- { serverError 60 } DETACH DATABASE test1601_detach_permanently_lazy; ATTACH DATABASE test1601_detach_permanently_lazy; SELECT 'After database reattachement the table is back (it was detached temporary)'; SELECT 'And we can detach it permanently'; DETACH table test1601_detach_permanently_lazy.test_name_reuse PERMANENTLY; DETACH DATABASE test1601_detach_permanently_lazy; ATTACH DATABASE test1601_detach_permanently_lazy; SELECT 'After database reattachement the table is still absent (it was detached permamently)'; SELECT 'And we can not detach it permanently'; DETACH table test1601_detach_permanently_lazy.test_name_reuse PERMANENTLY; -- { serverError 60 } SELECT 'But we can attach it back'; ATTACH TABLE test1601_detach_permanently_lazy.test_name_reuse; SELECT 'And detach permanently again to check how database drop will behave'; DETACH table test1601_detach_permanently_lazy.test_name_reuse PERMANENTLY; SELECT 'DROP database - Directory not empty error, but database deteched'; DROP DATABASE test1601_detach_permanently_lazy; -- { serverError 1001 } ATTACH DATABASE test1601_detach_permanently_lazy; ATTACH TABLE test1601_detach_permanently_lazy.test_name_reuse; DROP TABLE test1601_detach_permanently_lazy.test_name_reuse; SELECT 'DROP database - now success'; DROP DATABASE test1601_detach_permanently_lazy;
-- SQL script to populate database with test data INSERT INTO users (email, password) VALUES ('<EMAIL>', <PASSWORD>');
<filename>tc-springboot-junit5/src/test/resources/import.sql INSERT INTO Team VALUES (1, 'Manchester United'); INSERT INTO Team VALUES (2, 'Atlético de Madrid'); INSERT INTO Player VALUES (1, 'Paul', 'Pogba', 1); INSERT INTO Player VALUES (2, 'Antoine', 'Griezmann', 2);
<gh_stars>10-100 drop table if exists {db}.{table_destination}
-- create table and test "||" and "+" operator and dorp table at last create table dummy(a string, b string); insert into dummy values ( 'Korea', 'Plaza Hotel' ); insert into dummy values ( 'Korea', 'Lotte Hotel' ); insert into dummy values ( 'Japan', 'dummy' ); select a || ' ' || b from dummy order by 1; select a + ' ' + b from dummy order by 1; select a || 123 || 'test' from dummy order by 1; drop table dummy;
-- @testpoint:opengauss关键字standalone(非保留),作为角色名 --关键字不带引号-成功 drop role if exists standalone; create role standalone with password '<PASSWORD>' valid until '2020-12-31'; drop role standalone; --关键字带双引号-成功 drop role if exists "standalone"; create role "standalone" with password '<PASSWORD>' valid until '2020-12-31'; drop role "standalone"; --关键字带单引号-合理报错 drop role if exists 'standalone'; create role 'standalone' with password '<PASSWORD>' valid until '2020-12-31'; --关键字带反引号-合理报错 drop role if exists `standalone`; create role `standalone` with password '<PASSWORD>' valid until '2020-12-31';
-- @testpoint: 创建临时表的外键约束,引用普通表,合理报错 -- @modify at: 2020-11-24 --建表1 drop table if exists table_032; create table table_032 ( id int not null , primary key (id) ); --建表2 drop table if exists table_032_bak; create table table_032_bak( id_number int not null , primary key(id_number) ); --创建临时表,报错 drop table if exists temp_table_032; create temporary table temp_table_032( id_number int not null, cloth_id int references table_032_bak(id_number), user_id int references table_032(id) ); --删表 drop table table_032; drop table table_032_bak;
WITH x AS ( -- map molecule names to formula/charge, with count of distinct formulas SELECT p.id, p.bigg_id, p.name, m.formula, m.charge, count(1) AS repeat FROM component p INNER JOIN compartmentalized_component cc ON p.id = cc.component_id INNER JOIN model_compartmentalized_component m ON m.compartmentalized_component_id = cc.id GROUP BY p.id, p.bigg_id, p.name, m.formula, m.charge ORDER BY p.name ASC, m.formula ASC ), y AS ( -- grab total entries for molecule names SELECT x.id, sum(x.repeat) AS total FROM x GROUP BY x.id ) -- when name has formula at end, strip off formula SELECT x.bigg_id, trim(regexp_replace(x.name, x.formula || '$', '')) AS name, x.formula, x.charge FROM x INNER JOIN y ON x.id = y.id WHERE -- skip blank formulas x.formula <> '' -- skip obvious placeholder formulas like 'R', 'X', 'Z' -- or where more than 3 lowercase letters in a row AND x.formula !~ '[RXZ][A-Z0-9]*$' AND x.formula !~ '[a-z]{3}' GROUP BY x.bigg_id, x.name, x.formula, x.charge, x.repeat, y.total -- throw out anything without supermajority agreement on formula HAVING x.repeat/y.total > 0.66 ORDER BY x.name ASC, x.formula ASC ;
<filename>odev1.sql 1. film tablosunda bulunan title ve description sütunlarındaki verileri sıralayınız. select title, description from film; 2. film tablosunda bulunan tüm sütunlardaki verileri film uzunluğu (length) 60 dan büyük VE 75 ten küçük olma koşullarıyla sıralayınız. select * from film where length>60 and length<75; 3. film tablosunda bulunan tüm sütunlardaki verileri rental_rate 0.99 VE replacement_cost 12.99 VEYA 28.99 olma koşullarıyla sıralayınız. select * from film where rental_rate=0.99 and (replecement=12.99 or replecement=28.99) 4. customer tablosunda bulunan first_name sütunundaki değeri 'Mary' olan müşterinin last_name sütunundaki değeri nedir? select last_name from customer where first_name='Mary' 5. film tablosundaki uzunluğu(length) 50 ten büyük OLMAYIP aynı zamanda rental_rate değeri 2.99 veya 4.99 OLMAYAN verileri sıralayınız. select * from film where length<= 50 and (rental_rate=! 2.99 or rental_rate=! 4.99)
<reponame>markashleybell/Picklr CREATE TABLE IF NOT EXISTS users ( id INTEGER PRIMARY KEY, access_token BLOB, delta_cursor TEXT ); CREATE TABLE IF NOT EXISTS files ( id INTEGER PRIMARY KEY AUTOINCREMENT, date_added DATETIME DEFAULT CURRENT_TIMESTAMP, sharekey TEXT UNIQUE NOT NULL, path TEXT UNIQUE NOT NULL, description TEXT, tags TEXT, user_id INTEGER NOT NULL, FOREIGN KEY(user_id) REFERENCES users(id) ); CREATE TABLE IF NOT EXISTS tags ( id INTEGER PRIMARY KEY AUTOINCREMENT, tag TEXT UNIQUE NOT NULL, user_id INTEGER NOT NULL, FOREIGN KEY(user_id) REFERENCES users(id) ); CREATE TABLE IF NOT EXISTS tags_files ( tag_id INTEGER NOT NULL, file_id INTEGER NOT NULL, FOREIGN KEY(tag_id) REFERENCES tags(id), FOREIGN KEY(file_id) REFERENCES files(id), PRIMARY KEY(tag_id, file_id) ); CREATE TABLE IF NOT EXISTS tasks ( id INTEGER PRIMARY KEY AUTOINCREMENT, delta_cursor TEXT NOT NULL, path TEXT NOT NULL, type INTEGER NOT NULL, user_id INTEGER NOT NULL, FOREIGN KEY(user_id) REFERENCES users(id) );
<reponame>alexs0ff/remboard<filename>Server/Romontinka.Server.DataLayer.EntityFramework/Resources/DomainDeploy.sql --Типы заказа DECLARE @message VARCHAR(255) BEGIN TRAN BEGIN TRY INSERT INTO dbo.OrderKind ( Title, UserDomainID ) SELECT 'Ремонт', '{0}' UNION ALL SELECT 'Гарантия', '{0}' go --Статусы INSERT INTO [dbo].[OrderStatus] ([Title] ,[StatusKindID], [UserDomainID] ) SELECT 'Новый', 1, '{0}' UNION ALL SELECT 'На исполнении', 2, '{0}' UNION ALL SELECT 'На согласовании', 3, '{0}' UNION ALL SELECT 'Ждет запчасть', 3, '{0}' UNION ALL SELECT 'Исполненные', 4, '{0}' UNION ALL SELECT 'Закрыт', 5, '{0}' GO --Емкость для номеров заказа доменов INSERT INTO [dbo].[OrderCapacity] ( [UserDomainID] ,[OrderNumber] ) SELECT '{0}', 1 GO INSERT INTO [dbo].[CustomReport] ( [Title], [DocumentKindID], [UserDomainID], [HtmlContent] ) SELECT 'Гарантийная', 1, '{0}', '{1}' UNION ALL SELECT 'приемная', 1, '{0}', '{2}' UNION ALL SELECT 'товарный чек', 1, '{0}', '{3}' UPDATE u SET u.PasswordHash = d.PasswordHash FROM dbo.[User] AS u INNER JOIN dbo.UserDomain AS d ON u.UserDomainID = d.UserDomainID WHERE d.UserDomainID = '{0}' INSERT INTO [dbo].[Branch] ( [Title] ,[Address] ,[LegalName] ,[UserDomainID] ) SELECT [Trademark] ,[Address] ,[LegalName] ,[UserDomainID] FROM [dbo].[UserDomain] WHERE [UserDomainID] = '{0}' UPDATE UserDomain SET IsActive = 1 WHERE UserDomainID = '{0}' COMMIT TRAN END TRY BEGIN CATCH SET @message = ERROR_MESSAGE() ROLLBACK TRAN RAISERROR(@message, 16, 1); END CATCH
<filename>database/mecScript.sql -- MySQL Script generated by MySQL Workbench -- Fri Apr 17 03:18:14 2020 -- Model: Modelo PSPC Version: 1.0 -- Este es el modelo de base de datos para el sistema que utilizara el Proyecto Sector Productivo Cultural. -- MySQL Workbench Forward Engineering SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0; SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0; SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION'; -- ----------------------------------------------------- -- Schema mec -- ----------------------------------------------------- -- ----------------------------------------------------- -- Schema mec -- ----------------------------------------------------- CREATE SCHEMA IF NOT EXISTS `mec` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_spanish_ci ; USE `mec` ; -- ----------------------------------------------------- -- Table `mec`.`barrios` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `mec`.`barrios` ( `id` TINYINT(2) UNSIGNED NOT NULL AUTO_INCREMENT, `descripcion` VARCHAR(60) CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_spanish_ci' NOT NULL, PRIMARY KEY (`id`), UNIQUE INDEX `descripcion_UNIQUE` (`descripcion` ASC)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `mec`.`calles` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `mec`.`calles` ( `id` TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT, `descripcion` VARCHAR(40) CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_spanish_ci' NOT NULL, PRIMARY KEY (`id`), UNIQUE INDEX `descripcion_UNIQUE` (`descripcion` ASC), UNIQUE INDEX `id_UNIQUE` (`id` ASC)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `mec`.`cuadras` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `mec`.`cuadras` ( `id` TINYINT(2) UNSIGNED NOT NULL AUTO_INCREMENT, `descripcion` VARCHAR(2) CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_spanish_ci' NOT NULL, PRIMARY KEY (`id`), UNIQUE INDEX `descripcion_UNIQUE` (`descripcion` ASC)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `mec`.`direcciones` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `mec`.`direcciones` ( `id` INT UNSIGNED NOT NULL AUTO_INCREMENT, `barrio_id` TINYINT(2) UNSIGNED NULL, `chacra` VARCHAR(10) CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_spanish_ci' NULL, `cuadra_id` TINYINT(2) UNSIGNED NULL, `sector` VARCHAR(20) CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_spanish_ci' NULL, `calle_id` TINYINT(3) UNSIGNED NULL, `altura` VARCHAR(6) CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_spanish_ci' NULL, `casa` VARCHAR(4) CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_spanish_ci' NULL, `departamento` VARCHAR(4) CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_spanish_ci' NULL, `piso` TINYINT(2) UNSIGNED NULL, `codigoPlus` VARCHAR(7) CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_spanish_ci' NULL, PRIMARY KEY (`id`), INDEX `fk_direcciones_barrios1_idx` (`barrio_id` ASC), INDEX `direcciones_calles` (`calle_id` ASC), INDEX `fk_direcciones_cuadras1_idx` (`cuadra_id` ASC), CONSTRAINT `fk_direcciones_barrios1` FOREIGN KEY (`barrio_id`) REFERENCES `mec`.`barrios` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `direcciones_calles` FOREIGN KEY (`calle_id`) REFERENCES `mec`.`calles` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_direcciones_cuadras1` FOREIGN KEY (`cuadra_id`) REFERENCES `mec`.`cuadras` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION); -- ----------------------------------------------------- -- Table `mec`.`paises` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `mec`.`paises` ( `id` TINYINT(1) UNSIGNED NOT NULL AUTO_INCREMENT, `descripcion` VARCHAR(10) CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_spanish_ci' NOT NULL, PRIMARY KEY (`id`), UNIQUE INDEX `descripcion_UNIQUE` (`descripcion` ASC)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `mec`.`provincias` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `mec`.`provincias` ( `id` TINYINT(1) UNSIGNED NOT NULL AUTO_INCREMENT, `descripcion` VARCHAR(18) CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_spanish_ci' NOT NULL, `pais_id` TINYINT(1) UNSIGNED NOT NULL, PRIMARY KEY (`id`), UNIQUE INDEX `descripcion_UNIQUE` (`descripcion` ASC), INDEX `fk_provincias_paises1_idx` (`pais_id` ASC), CONSTRAINT `fk_provincias_paises1` FOREIGN KEY (`pais_id`) REFERENCES `mec`.`paises` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `mec`.`departamentos` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `mec`.`departamentos` ( `id` TINYINT(1) UNSIGNED NOT NULL AUTO_INCREMENT, `descripcion` VARCHAR(18) CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_spanish_ci' NOT NULL, `provincia_id` TINYINT(1) UNSIGNED NOT NULL, PRIMARY KEY (`id`), UNIQUE INDEX `descripcion_UNIQUE` (`descripcion` ASC), INDEX `fk_departamentos_provincias1_idx` (`provincia_id` ASC), CONSTRAINT `fk_departamentos_provincias1` FOREIGN KEY (`provincia_id`) REFERENCES `mec`.`provincias` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `mec`.`municipios` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `mec`.`municipios` ( `id` TINYINT(2) UNSIGNED NOT NULL, `descripcion` VARCHAR(30) CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_spanish_ci' NOT NULL, `departamento_id` TINYINT(1) UNSIGNED NOT NULL, PRIMARY KEY (`id`), UNIQUE INDEX `id_UNIQUE` (`id` ASC), UNIQUE INDEX `descripcion_UNIQUE` (`descripcion` ASC), INDEX `fk_municipios_departamentos1_idx` (`departamento_id` ASC), CONSTRAINT `fk_municipios_departamentos1` FOREIGN KEY (`departamento_id`) REFERENCES `mec`.`departamentos` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `mec`.`contactos` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `mec`.`contactos` ( `id` INT UNSIGNED NOT NULL AUTO_INCREMENT, `direccion_id` INT UNSIGNED NOT NULL, `municipio_id` TINYINT(2) UNSIGNED NOT NULL, `telefono1` VARCHAR(20) CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_spanish_ci' NULL, `telefono2` VARCHAR(20) CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_spanish_ci' NULL, `correo1` VARCHAR(60) CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_spanish_ci' NULL, `correo2` VARCHAR(60) CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_spanish_ci' NULL, `created_at` TIMESTAMP NULL, `updated_at` TIMESTAMP NULL, PRIMARY KEY (`id`), INDEX `direccion_id` (`direccion_id` ASC), CONSTRAINT `direccion_id` FOREIGN KEY (`direccion_id`) REFERENCES `mec`.`direcciones` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_contactos_municipios1` FOREIGN KEY (`municipio_id`) REFERENCES `mec`.`municipios` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION); -- ----------------------------------------------------- -- Table `mec`.`generos` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `mec`.`generos` ( `id` TINYINT(2) UNSIGNED NOT NULL AUTO_INCREMENT, `descripcion` VARCHAR(30) CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_spanish_ci' NOT NULL, PRIMARY KEY (`id`), UNIQUE INDEX `descripcion_UNIQUE` (`descripcion` ASC)); -- ----------------------------------------------------- -- Table `mec`.`personas` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `mec`.`personas` ( `id` INT UNSIGNED NOT NULL AUTO_INCREMENT, `apellido` VARCHAR(120) CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_spanish_ci' NOT NULL, `nombre` VARCHAR(120) NOT NULL, `nacimiento_id` DATE NOT NULL, `estado` TINYINT UNSIGNED NOT NULL, `contacto_id` INT UNSIGNED NULL, `genero_id` TINYINT(2) UNSIGNED NOT NULL, `created_at` TIMESTAMP NULL, `updated_at` TIMESTAMP NULL, PRIMARY KEY (`id`), INDEX `personas_contactos` (`contacto_id` ASC), INDEX `personas_generos` (`genero_id` ASC), CONSTRAINT `contacto_id` FOREIGN KEY (`contacto_id`) REFERENCES `mec`.`contactos` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `genero_id` FOREIGN KEY (`genero_id`) REFERENCES `mec`.`generos` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION); -- ----------------------------------------------------- -- Table `mec`.`dominios` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `mec`.`dominios` ( `id` TINYINT(1) UNSIGNED NOT NULL AUTO_INCREMENT, `descripcion` VARCHAR(60) CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_spanish_ci' NOT NULL COMMENT 'Dominios culturales\nEquipamientos y materiales de apoyo de dominios culturales\nDominios transversales\nDominios relacionados\nEquipamientos y materiales de apoyo de dominios relacionados', PRIMARY KEY (`id`), UNIQUE INDEX `descripcion_UNIQUE` (`descripcion` ASC)); -- ----------------------------------------------------- -- Table `mec`.`funciones` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `mec`.`funciones` ( `id` TINYINT(2) UNSIGNED NOT NULL AUTO_INCREMENT, `descripcion` VARCHAR(30) CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_spanish_ci' NOT NULL COMMENT 'Creación\nDifusión\nExhibición/Transmisión\nArchivística/Preservación\nConsumo/Participación\nProducción\nEducación/Capacitación\nProducción, difusión', PRIMARY KEY (`id`), UNIQUE INDEX `descripcion_UNIQUE` (`descripcion` ASC)); -- ----------------------------------------------------- -- Table `mec`.`arreglos` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `mec`.`arreglos` ( `id` TINYINT(2) UNSIGNED NOT NULL AUTO_INCREMENT, `descripcion` VARCHAR(12) CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_spanish_ci' NOT NULL COMMENT 'CIIU4, CPC2, SA07, SITC4, CIUO08, ICATUS', PRIMARY KEY (`id`), UNIQUE INDEX `descripcion_UNIQUE` (`descripcion` ASC)); -- ----------------------------------------------------- -- Table `mec`.`ambitos` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `mec`.`ambitos` ( `id` TINYINT(2) UNSIGNED NOT NULL AUTO_INCREMENT, `descripcion` VARCHAR(45) CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_spanish_ci' NOT NULL COMMENT 'Patrimonio Cultural y Natural\nPresentaciones Artísticas y Celebraciones\nArtes Visuales y Artesanías\nLibros y Prensa\nMedios Audiovisuales e Interactivos\nDiseño y Servicios Creativos\nEducación Cultural\nPatrimonio Inmaterial\nTurismo\nDeportes y recreación', PRIMARY KEY (`id`), UNIQUE INDEX `descripcion_UNIQUE` (`descripcion` ASC)); -- ----------------------------------------------------- -- Table `mec`.`denominaciones` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `mec`.`denominaciones` ( `id` TINYINT(2) UNSIGNED NOT NULL AUTO_INCREMENT, `descripcion` VARCHAR(45) CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_spanish_ci' NOT NULL COMMENT 'Antigüedades\nInstrumentos musicales\nMedios grabados\nPinturas\nOtras artes visuales\nArtesanías\nJoyas\nFotografía\nLibros\nDiarios\nOtros materiales impresos\nFilmes y videos\n_ _ _ _ _ _ _ _ _\nArquitectura y diseño\nCelebración\nMúsica\nAudiovisuales\nComputadoras y equipamientos relacionados\nDeportes\nDeportes y recreación\nJuegos de azar', PRIMARY KEY (`id`), UNIQUE INDEX `descripcion_UNIQUE` (`descripcion` ASC)); -- ----------------------------------------------------- -- Table `mec`.`subdominios` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `mec`.`subdominios` ( `id` INT UNSIGNED NOT NULL AUTO_INCREMENT, `ambito_id` TINYINT(2) UNSIGNED NOT NULL, `dominio_id` TINYINT(1) UNSIGNED NOT NULL, `denominacion_id` TINYINT(2) UNSIGNED NULL, PRIMARY KEY (`id`), INDEX `ambito_id` (`ambito_id` ASC), INDEX `dominio_id` (`dominio_id` ASC), INDEX `denominacion_id` (`denominacion_id` ASC), CONSTRAINT `subdominios_ambitos` FOREIGN KEY (`ambito_id`) REFERENCES `mec`.`ambitos` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `subdominios_dominios` FOREIGN KEY (`dominio_id`) REFERENCES `mec`.`dominios` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `subdominios_denominaciones` FOREIGN KEY (`denominacion_id`) REFERENCES `mec`.`denominaciones` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION); -- ----------------------------------------------------- -- Table `mec`.`categorias` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `mec`.`categorias` ( `id` INT UNSIGNED NOT NULL AUTO_INCREMENT, `codigo` VARCHAR(6) CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_spanish_ci' NOT NULL, `descripcion` VARCHAR(355) CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_spanish_ci' NOT NULL, `nota` VARCHAR(1110) CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_spanish_ci' NULL, `arreglo_id` TINYINT(2) UNSIGNED NOT NULL, `subdominio_id` INT UNSIGNED NOT NULL, `funcion_id` TINYINT(2) UNSIGNED NULL, PRIMARY KEY (`id`), INDEX `arreglo_id` (`arreglo_id` ASC), INDEX `subdominio_id` (`subdominio_id` ASC), INDEX `funcion_id` (`funcion_id` ASC), CONSTRAINT `categorias_arreglos` FOREIGN KEY (`arreglo_id`) REFERENCES `mec`.`arreglos` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `categorias_subdominios` FOREIGN KEY (`subdominio_id`) REFERENCES `mec`.`subdominios` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `categorias_funciones` FOREIGN KEY (`funcion_id`) REFERENCES `mec`.`funciones` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION); -- ----------------------------------------------------- -- Table `mec`.`organizaciones` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `mec`.`organizaciones` ( `id` SMALLINT(3) UNSIGNED NOT NULL AUTO_INCREMENT, `descripcion` VARCHAR(60) CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_spanish_ci' NOT NULL, `contacto_id` INT UNSIGNED NOT NULL, `created_at` TIMESTAMP NULL, `updated_at` TIMESTAMP NULL, PRIMARY KEY (`id`), UNIQUE INDEX `descripcion_UNIQUE` (`descripcion` ASC), INDEX `contacto_id` (`contacto_id` ASC), CONSTRAINT `organizaciones_contactos` FOREIGN KEY (`contacto_id`) REFERENCES `mec`.`contactos` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION); -- ----------------------------------------------------- -- Table `mec`.`clasificaciones` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `mec`.`clasificaciones` ( `id` INT UNSIGNED NOT NULL AUTO_INCREMENT, `persona_id` INT UNSIGNED NULL, `organizacion_id` SMALLINT(3) UNSIGNED NULL, `categoria_id` INT UNSIGNED NOT NULL, `created_at` TIMESTAMP NULL, `updated_at` TIMESTAMP NULL, PRIMARY KEY (`id`), INDEX `persona_id` (`persona_id` ASC), INDEX `organizacion_id` (`organizacion_id` ASC), INDEX `categoria_id` (`categoria_id` ASC), CONSTRAINT `clasificaciones_personas` FOREIGN KEY (`persona_id`) REFERENCES `mec`.`personas` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `clasificaciones_organizaciones` FOREIGN KEY (`organizacion_id`) REFERENCES `mec`.`organizaciones` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `clasificaciones_categorias` FOREIGN KEY (`categoria_id`) REFERENCES `mec`.`categorias` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION); -- ----------------------------------------------------- -- Table `mec`.`visitas` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `mec`.`visitas` ( `id` TINYINT(1) UNSIGNED NOT NULL AUTO_INCREMENT, `numero` TINYINT(1) UNSIGNED NOT NULL COMMENT 'Si es la primer visita, la segunda, tercera, cuarta o quinta.', PRIMARY KEY (`id`), UNIQUE INDEX `numero_UNIQUE` (`numero` ASC)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `mec`.`otros` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `mec`.`otros` ( `id` TINYINT(2) UNSIGNED NOT NULL AUTO_INCREMENT, `descripcion` VARCHAR(45) CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_spanish_ci' NOT NULL COMMENT 'En el caso de la que eleccion sea la\n07 Otros (esp.) ___________________________\nEn este espacio se describira ese otros', PRIMARY KEY (`id`), UNIQUE INDEX `numero_UNIQUE` (`descripcion` ASC)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `mec`.`resultados` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `mec`.`resultados` ( `id` TINYINT(1) UNSIGNED NOT NULL AUTO_INCREMENT, `descripcion` VARCHAR(45) CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_spanish_ci' NOT NULL COMMENT 'Entrevista completa\nEntrevista incompleta\nEntrevista aplazada\nAusentes temporales\nSe negó a dar información\nInformante inadecuado\nOtros (esp.) ___________________________', `otros_id` TINYINT(2) UNSIGNED NULL COMMENT 'En caso de que sea otro, aqui se especifica. este campo puede ser null', PRIMARY KEY (`id`), UNIQUE INDEX `numero_UNIQUE` (`descripcion` ASC), INDEX `otros_id` (`otros_id` ASC), CONSTRAINT `resultados_otros` FOREIGN KEY (`otros_id`) REFERENCES `mec`.`otros` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `mec`.`cabeceras` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `mec`.`cabeceras` ( `id` INT UNSIGNED NOT NULL AUTO_INCREMENT, `nombre_entidad` VARCHAR(45) NOT NULL, `visita_id` TINYINT(1) UNSIGNED NOT NULL, `fecha` DATE NOT NULL, `persona_id` INT UNSIGNED NOT NULL COMMENT 'persona_id son los datos del entrevistador, esto remplaza al campo \'nombre_del_entrevistador\'', `hora_inicio` TIME NOT NULL, `hora_final` TIME NULL, `duracion` TIME NULL, `resultado_id` TINYINT(1) UNSIGNED NULL, `created_at` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP, `updated_at` TIMESTAMP NULL, PRIMARY KEY (`id`), INDEX `visita_id` (`visita_id` ASC), INDEX `resultado_id` (`resultado_id` ASC), INDEX `cabeceras_personas_idx` (`persona_id` ASC), CONSTRAINT `encuestas_visitas` FOREIGN KEY (`visita_id`) REFERENCES `mec`.`visitas` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `encuestas_resultados` FOREIGN KEY (`resultado_id`) REFERENCES `mec`.`resultados` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `cabeceras_personas` FOREIGN KEY (`persona_id`) REFERENCES `mec`.`personas` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB COMMENT = 'file:///E:/cultura/Cuestionario.pdf'; -- ----------------------------------------------------- -- Table `mec`.`preguntas` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `mec`.`preguntas` ( `id` INT UNSIGNED NOT NULL AUTO_INCREMENT, `categoria_id` INT UNSIGNED NULL COMMENT 'para acceder a la codificacion de ICATUS que es para las encuestas de uso de tiempo', `descripcion` VARCHAR(90) CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_spanish_ci' NOT NULL, PRIMARY KEY (`id`), INDEX `categoria_id` (`categoria_id` ASC), UNIQUE INDEX `descripcion_UNIQUE` (`descripcion` ASC), CONSTRAINT `preguntas_categorias` FOREIGN KEY (`categoria_id`) REFERENCES `mec`.`categorias` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `mec`.`respuestas` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `mec`.`respuestas` ( `id` INT UNSIGNED NOT NULL AUTO_INCREMENT, `descripcion` VARCHAR(45) CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_spanish_ci' NOT NULL, PRIMARY KEY (`id`), UNIQUE INDEX `descripcion_UNIQUE` (`descripcion` ASC)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `mec`.`encuestas` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `mec`.`encuestas` ( `id` INT UNSIGNED NOT NULL AUTO_INCREMENT, `cabecera_id` INT UNSIGNED NOT NULL, `pregunta_id` INT UNSIGNED NOT NULL, `respuesta_id` INT UNSIGNED NOT NULL, PRIMARY KEY (`id`), INDEX `encuestas_cabeceras_idx` (`cabecera_id` ASC), INDEX `encuestas_preguntas_idx` (`pregunta_id` ASC), INDEX `encuestas_respuestas_idx` (`respuesta_id` ASC), CONSTRAINT `encuestas_cabeceras` FOREIGN KEY (`cabecera_id`) REFERENCES `mec`.`cabeceras` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `encuestas_preguntas` FOREIGN KEY (`pregunta_id`) REFERENCES `mec`.`preguntas` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `encuestas_respuestas` FOREIGN KEY (`respuesta_id`) REFERENCES `mec`.`respuestas` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; SET SQL_MODE=@OLD_SQL_MODE; SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
<gh_stars>0 DROP VIEW IF EXISTS `summary`; CREATE VIEW `summary` AS SELECT all_variants_ext.gene as gene, all_variants_ext.aa_orig as aa_orig, all_variants_ext.aa_var as aa_var, all_variants_ext.aa_num as aa_num, all_variants_ext.sub_domain as sub_domain, all_variants_ext.domain as domain, all_variants_ext.variant as Variant, /*--gnomADv2.1.1*/ gnomadv2.chromosome as gnomadv2_chromosome, gnomadv2.position as gnomadv2_position, gnomadv2.allele_ref as gnomadv2_allele_ref, gnomadv2.allele_alt as gnomadv2_allele_alt, gnomadv2.qual as gnomadv2_qual, gnomadv2.filters as gnomadv2_filters, gnomadv2.vartype as gnomadv2_vartype, gnomadv2.gene as gnomadv2_gene, gnomadv2.transcript_consequence as gnomadv2_transcript_consequence, gnomadv2.protein_consequence as gnomadv2_protein_consequence, gnomadv2.codon_num as gnomadv2_codon_num, gnomadv2.ref_aa as gnomadv2_ref_aa, gnomadv2.alt_aa as gnomadv2_alt_aa, gnomadv2.FS as gnomadv2_FS, gnomadv2.MQRankSum as gnomadv2_MQRankSum, gnomadv2.InbreedingCoeff as gnomadv2_InbreedingCoeff, gnomadv2.ReadPosRankSum as gnomadv2_ReadPosRankSum, gnomadv2.VQSLOD as gnomadv2_VQSLOD, gnomadv2.QD as gnomadv2_QD, gnomadv2.DP as gnomadv2_DP, gnomadv2.BaseQRankSum as gnomadv2_BaseQRankSum, gnomadv2.MQ as gnomadv2_MQ, gnomadv2.ClippingRankSum as gnomadv2_ClippingRankSum, gnomadv2.rf_tp_probability as gnomadv2_rf_tp_probability, gnomadv2.pab_max as gnomadv2_pab_max, gnomadv2.AC as gnomadv2_AC, gnomadv2.AN as gnomadv2_AN, gnomadv2.non_neuro_AC as gnomadv2_non_neuro_AC, gnomadv2.non_neuro_AN as gnomadv2_non_neuro_AN, gnomadv2.non_cancer_AC as gnomadv2_non_cancer_AC, gnomadv2.non_cancer_AN as gnomadv2_non_cancer_AN, gnomadv2.non_topmed_AC as gnomadv2_non_topmed_AC, gnomadv2.non_topmed_AN as gnomadv2_non_topmed_AN, gnomadv2.controls_AC as gnomadv2_controls_AC, gnomadv2.controls_AN as gnomadv2_controls_AN, gnomadv2.source as gnomadv2_source, /*--ClinVar*/ clinvarsumdna.Gene as clinvar_Gene, clinvarsumdna.cDNA as clinvar_cDNA, clinvarsumdna.aaNum as clinvar_aaNum, clinvarsumdna.RefSeq as clinvar_RefSeq, clinvarsumdna.clinvar_DateCreated, clinvarsumdna.clinvar_CountObs, clinvarsumdna.clinvar_AlleleSource, clinvarsumdna.clinvar_TestingMethod, clinvarsumdna.clinvar_OrgName, clinvarsumdna.clinvar_OrgName, clinvarsumdna.clinvar_AffectedStatus, clinvarsumdna.clinvar_Phenotype, /*--Glutamate*/ /*--wt*/ oosumglu.wt_n_oocytes as wt_n_rec_glu, oosumglu.wt_n_fit as wt_n_fit_glu, oosumglu.wt_date_rec_count as wt_n_date_glu, oosumglu.wt_avg_logec50 as wt_avg_logEC50_glu, oosumglu.wt_std_logec50 as wt_std_logEC50_glu, oosumglu.wt_avg_hillslope as wt_avg_hillslope_glu, oosumglu.wt_std_hillslope as wt_std_hillslope_glu, oosumglu.wt_avg_ymin as wt_avg_ymin_glu, oosumglu.wt_std_ymin as wt_std_ymin_glu, oosumglu.wt_avg_ymax as wt_avg_ymax_glu, oosumglu.wt_std_ymax as wt_std_ymax_glu, oosumglu.wt_avg_logm5p5_glu, oosumglu.wt_std_logm5p5_glu, oosumglu.wt_avg_i as wt_avg_i_glu, oosumglu.wt_std_i as wt_std_i_glu, /*--var*/ oosumglu.var_n_oocytes as var_n_rec_glu, oosumglu.var_n_fit as var_n_fit_glu, oosumglu.var_date_rec_count as var_n_date_glu, oosumglu.var_avg_logec50 as var_avg_logEC50_glu, oosumglu.var_std_logec50 as var_std_logEC50_glu, oosumglu.var_avg_hillslope as var_avg_hillslope_glu, oosumglu.var_std_hillslope as var_std_hillslope_glu, oosumglu.var_avg_ymin as var_avg_ymin_glu, oosumglu.var_std_ymin as var_std_ymin_glu, oosumglu.var_avg_ymax as var_avg_ymax_glu, oosumglu.var_std_ymax as var_std_ymax_glu, oosumglu.var_avg_logm5p5_glu, oosumglu.var_std_logm5p5_glu, oosumglu.var_avg_i as var_avg_i_glu, oosumglu.var_std_i as var_std_i_glu, /*--Glycine*/ /*--wt*/ oosumgly.wt_n_oocytes as wt_n_rec_gly, oosumgly.wt_n_fit as wt_n_fit_gly, oosumgly.wt_date_rec_count as wt_n_frogs_gly, oosumgly.wt_avg_logec50 as wt_avg_logEC50_gly, oosumgly.wt_std_logec50 as wt_std_logEC50_gly, oosumgly.wt_avg_hillslope as wt_avg_hillslope_gly, oosumgly.wt_std_hillslope as wt_std_hillslope_gly, oosumgly.wt_avg_ymin as wt_avg_ymin_gly, oosumgly.wt_std_ymin as wt_std_ymin_gly, oosumgly.wt_avg_ymax as wt_avg_ymax_gly, oosumgly.wt_std_ymax as wt_std_ymax_gly, oosumgly.wt_avg_logm6_gly, oosumgly.wt_std_logm6_gly, oosumgly.wt_avg_i as wt_avg_i_gly, oosumgly.wt_std_i as wt_std_i_gly, /*--var*/ oosumgly.var_n_oocytes as var_n_rec_gly, oosumgly.var_n_fit as var_n_fit_gly, oosumgly.var_date_rec_count as var_n_date_gly, oosumgly.var_avg_logec50 as var_avg_logEC50_gly, oosumgly.var_std_logec50 as var_std_logEC50_gly, oosumgly.var_avg_hillslope as var_avg_hillslope_gly, oosumgly.var_std_hillslope as var_std_hillslope_gly, oosumgly.var_avg_ymin as var_avg_ymin_gly, oosumgly.var_std_ymin as var_std_ymin_gly, oosumgly.var_avg_ymax as var_avg_ymax_gly, oosumgly.var_std_ymax as var_std_ymax_gly, oosumgly.var_avg_logm6_gly, oosumgly.var_std_logm6_gly, oosumgly.var_avg_i as var_avg_i_gly, oosumgly.var_std_i as var_std_i_gly, /*--pH*/ /*--wt*/ oosumph.wt_n_oocytes as wt_n_rec_ph, oosumph.wt_date_rec_count as wt_n_date_ph, oosumph.wt_avg_pH_per_inhib as wt_avg_logm6p8_ph, oosumph.wt_std_pH_per_inhib as wt_std_logm6p8_ph, oosumph.wt_avg_i as wt_avg_i_ph, oosumph.wt_std_i as wt_std_i_ph, /*--var*/ oosumph.var_n_oocytes as var_n_rec_ph, oosumph.var_date_rec_count as var_n_date_ph, oosumph.var_avg_pH_per_inhib as var_avg_logm6p8_ph, oosumph.var_std_pH_per_inhib as var_std_logm6p8_ph, oosumph.var_avg_i as var_avg_i_ph, oosumph.var_std_i as var_std_i_ph, /*--Magnesium*/ /*--wt*/ oosummg.wt_n_oocytes as wt_n_rec_mg, oosummg.wt_n_fit as wt_n_fit_mg, oosummg.wt_date_rec_count as wt_n_date_mg, oosummg.wt_avg_logec50 as wt_avg_logIC50_mg, oosummg.wt_std_logec50 as wt_std_logIC50_mg, oosummg.wt_avg_hillslope as wt_avg_hillslope_mg, oosummg.wt_std_hillslope as wt_std_hillslope_mg, oosummg.wt_avg_ymin as wt_avg_ymin_mg, oosummg.wt_std_ymin as wt_std_ymin_mg, oosummg.wt_avg_ymax as wt_avg_ymax_mg, oosummg.wt_std_ymax as wt_std_ymax_mg, oosummg.wt_avg_logm4p5_mg, oosummg.wt_std_logm4p5_mg, oosummg.wt_avg_i as wt_avg_i_mg, oosummg.wt_std_i as wt_std_i_mg, /*--var*/ oosummg.var_n_oocytes as var_n_rec_mg, oosummg.var_n_fit as var_n_fit_mg, oosummg.var_date_rec_count as var_n_date_mg, oosummg.var_avg_logec50 as var_avg_logIC50_mg, oosummg.var_std_logec50 as var_std_logIC50_mg, oosummg.var_avg_hillslope as var_avg_hillslope_mg, oosummg.var_std_hillslope as var_std_hillslope_mg, oosummg.var_avg_ymin as var_avg_ymin_mg, oosummg.var_std_ymin as var_std_ymin_mg, oosummg.var_avg_ymax as var_avg_ymax_mg, oosummg.var_std_ymax as var_std_ymax_mg, oosummg.var_avg_logm4p5_mg, oosummg.var_std_logm4p5_mg, oosummg.var_avg_i as var_avg_i_mg, oosummg.var_std_i as var_std_i_mg, /*--Zinc*/ /*--wt*/ oosumzn.wt_n_oocytes as wt_n_rec_zn, oosumzn.wt_n_fit as wt_n_fit_zn, oosumzn.wt_date_rec_count as wt_n_date_zn, oosumzn.wt_avg_logec50 as wt_avg_logIC50_zn, oosumzn.wt_std_logec50 as wt_std_logIC50_zn, oosumzn.wt_avg_hillslope as wt_avg_hillslope_zn, oosumzn.wt_std_hillslope as wt_std_hillslope_zn, oosumzn.wt_avg_ymin as wt_avg_ymin_zn, oosumzn.wt_std_ymin as wt_std_ymin_zn, oosumzn.wt_avg_ymax as wt_avg_ymax_zn, oosumzn.wt_std_ymax as wt_std_ymax_zn, oosumzn.wt_avg_logm8_zn, oosumzn.wt_std_logm8_zn, oosumzn.wt_avg_logm6p5_zn, oosumzn.wt_std_logm6p5_zn, oosumzn.wt_avg_i as wt_avg_i_zn, oosumzn.wt_std_i as wt_std_i_zn, /*--var*/ oosumzn.var_n_oocytes as var_n_rec_zn, oosumzn.var_n_fit as var_n_fit_zn, oosumzn.var_date_rec_count as var_n_date_zn, oosumzn.var_avg_logec50 as var_avg_logIC50_zn, oosumzn.var_std_logec50 as var_std_logIC50_zn, oosumzn.var_avg_hillslope as var_avg_hillslope_zn, oosumzn.var_std_hillslope as var_std_hillslope_zn, oosumzn.var_avg_ymin as var_avg_ymin_zn, oosumzn.var_std_ymin as var_std_ymin_zn, oosumzn.var_avg_ymax as var_avg_ymax_zn, oosumzn.var_std_ymax as var_std_ymax_zn, oosumzn.var_avg_logm8_zn, oosumzn.var_std_logm8_zn, oosumzn.var_avg_logm6p5_zn, oosumzn.var_std_logm6p5_zn, oosumzn.var_avg_i as var_avg_i_zn, oosumzn.var_std_i as var_std_i_zn FROM all_variants_ext LEFT JOIN oosumglu ON oosumglu.Variant = all_variants_ext.variant LEFT JOIN oosumgly ON oosumgly.Variant = all_variants_ext.variant LEFT JOIN oosumph ON oosumph.Variant = all_variants_ext.variant LEFT JOIN oosummg ON oosummg.Variant = all_variants_ext.variant LEFT JOIN oosumzn ON oosumzn.Variant = all_variants_ext.variant LEFT JOIN gnomadv2 ON gnomadv2.Variant = all_variants_ext.variant LEFT JOIN clinvarsumdna ON clinvarsumdna.Variant = all_variants_ext.variant
prompt Importing table t_migraciones... set feedback off set define off insert into t_migraciones (ID_MIGRACION, DESCRIPCION) values ('mig_000021', 'Retornar club favorito en datos del usuario.'); prompt Done.
<filename>rest-bridge.sql<gh_stars>0 -- phpMyAdmin SQL Dump -- version 5.1.1 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Waktu pembuatan: 14 Jun 2021 pada 04.25 -- Versi server: 10.4.19-MariaDB -- Versi PHP: 7.4.20 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: `rest-bridge` -- -- -------------------------------------------------------- -- -- Struktur dari tabel `failed_jobs` -- CREATE TABLE `failed_jobs` ( `id` bigint(20) UNSIGNED NOT NULL, `uuid` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `connection` text COLLATE utf8mb4_unicode_ci NOT NULL, `queue` text COLLATE utf8mb4_unicode_ci NOT NULL, `payload` longtext COLLATE utf8mb4_unicode_ci NOT NULL, `exception` longtext COLLATE utf8mb4_unicode_ci NOT NULL, `failed_at` timestamp NOT NULL DEFAULT current_timestamp() ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -------------------------------------------------------- -- -- Struktur dari tabel `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 untuk tabel `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_19_000000_create_failed_jobs_table', 1), (9, '2021_06_13_055256_add_google_id_column', 2), (10, '2021_06_13_064433_password_user_nullable', 3), (11, '2021_06_13_085057_add_facebook_id_column', 4), (12, '2021_06_13_091619_change_unique_email_user', 5), (13, '2021_06_14_021452_add_status_position_table_user', 6); -- -------------------------------------------------------- -- -- Struktur dari tabel `oauth_access_tokens` -- CREATE TABLE `oauth_access_tokens` ( `id` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL, `user_id` bigint(20) UNSIGNED DEFAULT NULL, `client_id` bigint(20) 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 untuk tabel `oauth_access_tokens` -- INSERT INTO `oauth_access_tokens` (`id`, `user_id`, `client_id`, `name`, `scopes`, `revoked`, `created_at`, `updated_at`, `expires_at`) VALUES ('<KEY>', 2, 1, 'nApp', '[]', 0, '2021-06-13 01:49:47', '2021-06-13 01:49:47', '2022-06-13 08:49:47'), ('<KEY>', 1, 1, 'nApp', '[]', 0, '2021-06-12 20:53:04', '2021-06-12 20:53:04', '2022-06-13 03:53:04'), ('628036621e30b29105819c3c5644709952097a68be8aa86942018dd584d142d1044b1a7dc1ee20ae', 7, 1, 'nApp', '[]', 0, '2021-06-13 02:41:29', '2021-06-13 02:41:29', '2022-06-13 09:41:29'), ('6f520b379eccef5dd06356506e8111723bfdc0c3676a12c1d0f6d2c64f9736c9e43483aad0f69f35', 2, 1, 'nApp', '[]', 0, '2021-06-12 23:42:30', '2021-06-12 23:42:30', '2022-06-13 06:42:30'), ('6f63d36ecd3222032665fbdf6c53e2450646dc19750af15de03e090a048181db39d3667c094bca60', 7, 1, 'nApp', '[]', 0, '2021-06-13 02:17:05', '2021-06-13 02:17:05', '2022-06-13 09:17:05'), ('990412383cb18e5b4debb44c32b3d7f60a5a0b33a76f182e7319e0ee3c33630deb1a8f8e3fd81715', 1, 1, 'nApp', '[]', 0, '2021-06-12 10:58:55', '2021-06-12 10:58:55', '2022-06-12 17:58:55'), ('a3a9c97a6c32089d560122ec661b3d4ced5466335af83253f3e3654c3d4afdbf4de068be0f3806fe', 5, 1, 'nApp', '[]', 0, '2021-06-13 01:50:09', '2021-06-13 01:50:09', '2022-06-13 08:50:09'), ('a8b6007bbaf06bd4dff15f38fcd7aadccdc754bde276240fddc79d45380b229869a17ac567847fb6', 1, 1, 'nApp', '[]', 0, '2021-06-13 19:23:20', '2021-06-13 19:23:20', '2022-06-14 02:23:20'), ('cf75c2be45f5460d7d0a17db5073754d8f6389062e88ab62fe2a7df42095ab78bf2d7dfdb65bdd3d', 1, 1, 'nApp', '[]', 0, '2021-06-12 11:00:42', '2021-06-12 11:00:42', '2022-06-12 18:00:42'), ('d9f7b77d926432c5fcfc44b0ca3573185497ecd903e1b5bae808763dd036c2af21ee6195aeabc959', 2, 1, 'nApp', '[]', 0, '2021-06-12 23:35:28', '2021-06-12 23:35:28', '2022-06-13 06:35:28'), ('dd8f803bae13ab6629ec833fad955290cf43ed8a65c12f91f4b90112e7e56a4b86c570ac7a73398c', 3, 1, 'nApp', '[]', 0, '2021-06-12 23:46:39', '2021-06-12 23:46:39', '2022-06-13 06:46:39'), ('eb95e2b61ba75aab9b897ddf6678d331da8dd78585a3d81109c5adf2e580be44918c090769399c84', 4, 1, 'nApp', '[]', 0, '2021-06-12 23:48:30', '2021-06-12 23:48:30', '2022-06-13 06:48:30'), ('f01bd20686100d9cc6da20e92c50059fe28b07adcdd1636f7ee275a6c36758ffb8333c0f3c28712f', 3, 1, 'nApp', '[]', 0, '2021-06-13 02:41:07', '2021-06-13 02:41:07', '2022-06-13 09:41:07'); -- -------------------------------------------------------- -- -- Struktur dari tabel `oauth_auth_codes` -- CREATE TABLE `oauth_auth_codes` ( `id` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL, `user_id` bigint(20) UNSIGNED NOT NULL, `client_id` bigint(20) 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; -- -------------------------------------------------------- -- -- Struktur dari tabel `oauth_clients` -- CREATE TABLE `oauth_clients` ( `id` bigint(20) UNSIGNED NOT NULL, `user_id` bigint(20) UNSIGNED DEFAULT NULL, `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `secret` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `provider` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT 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 untuk tabel `oauth_clients` -- INSERT INTO `oauth_clients` (`id`, `user_id`, `name`, `secret`, `provider`, `redirect`, `personal_access_client`, `password_client`, `revoked`, `created_at`, `updated_at`) VALUES (1, NULL, 'Laravel Personal Access Client', 'vqvTFnxJq8B2wn2J8ygLdJTZZmgPMitxwS1Btq8v', NULL, 'http://localhost', 1, 0, 0, '2021-06-12 10:41:00', '2021-06-12 10:41:00'), (2, NULL, 'Laravel Password Grant Client', 'Gv3W5ulnp9HE19OBIkYL8toKJGacZQIKbcHLQg6P', 'users', 'http://localhost', 0, 1, 0, '2021-06-12 10:41:00', '2021-06-12 10:41:00'); -- -------------------------------------------------------- -- -- Struktur dari tabel `oauth_personal_access_clients` -- CREATE TABLE `oauth_personal_access_clients` ( `id` bigint(20) UNSIGNED NOT NULL, `client_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 untuk tabel `oauth_personal_access_clients` -- INSERT INTO `oauth_personal_access_clients` (`id`, `client_id`, `created_at`, `updated_at`) VALUES (1, 1, '2021-06-12 10:41:00', '2021-06-12 10:41:00'); -- -------------------------------------------------------- -- -- Struktur dari tabel `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; -- -------------------------------------------------------- -- -- Struktur dari tabel `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; -- -------------------------------------------------------- -- -- Struktur dari tabel `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 DEFAULT NULL, `remember_token` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL, `google_id` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `facebook_id` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `status` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'active', `position` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data untuk tabel `users` -- INSERT INTO `users` (`id`, `name`, `email`, `email_verified_at`, `password`, `remember_token`, `created_at`, `updated_at`, `google_id`, `facebook_id`, `status`, `position`) VALUES (1, 'harby', '<EMAIL>', NULL, '$2y$10$.UWDth8Rg2S.WpDZsSdStelvWpRIint99p2sjlbzK80jOnzMHq/Gm', NULL, '2021-06-12 10:58:55', '2021-06-12 10:58:55', NULL, NULL, 'inactive', NULL), (2, '<NAME>', '<EMAIL>', NULL, '$2y$10$pXNFmjWAh64.2JoxziqdOuJUzgLIxmTTNHr4dYtcWYI7Fa2XPd6pq', NULL, '2021-06-12 23:35:27', '2021-06-12 23:35:27', '109028330454631534657', NULL, 'active', NULL), (3, '<NAME>', '<EMAIL>', NULL, NULL, NULL, '2021-06-12 23:46:39', '2021-06-12 23:46:39', '111128048662922311927', NULL, 'active', NULL), (4, '<NAME>', '<EMAIL>', NULL, NULL, NULL, '2021-06-12 23:48:30', '2021-06-12 23:48:30', '100505606344362901405', NULL, 'active', NULL), (5, 'getuk kelapa', '<EMAIL>', NULL, NULL, NULL, '2021-06-13 01:50:08', '2021-06-13 01:50:08', '103541940426668991121', NULL, 'active', NULL), (7, 'Harby', '<EMAIL>', NULL, NULL, NULL, '2021-06-13 02:17:05', '2021-06-13 02:17:05', NULL, '4679671322046057', 'active', NULL); -- -- Indexes for dumped tables -- -- -- Indeks untuk tabel `failed_jobs` -- ALTER TABLE `failed_jobs` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `failed_jobs_uuid_unique` (`uuid`); -- -- Indeks untuk tabel `migrations` -- ALTER TABLE `migrations` ADD PRIMARY KEY (`id`); -- -- Indeks untuk tabel `oauth_access_tokens` -- ALTER TABLE `oauth_access_tokens` ADD PRIMARY KEY (`id`), ADD KEY `oauth_access_tokens_user_id_index` (`user_id`); -- -- Indeks untuk tabel `oauth_auth_codes` -- ALTER TABLE `oauth_auth_codes` ADD PRIMARY KEY (`id`), ADD KEY `oauth_auth_codes_user_id_index` (`user_id`); -- -- Indeks untuk tabel `oauth_clients` -- ALTER TABLE `oauth_clients` ADD PRIMARY KEY (`id`), ADD KEY `oauth_clients_user_id_index` (`user_id`); -- -- Indeks untuk tabel `oauth_personal_access_clients` -- ALTER TABLE `oauth_personal_access_clients` ADD PRIMARY KEY (`id`); -- -- Indeks untuk tabel `oauth_refresh_tokens` -- ALTER TABLE `oauth_refresh_tokens` ADD PRIMARY KEY (`id`), ADD KEY `oauth_refresh_tokens_access_token_id_index` (`access_token_id`); -- -- Indeks untuk tabel `password_resets` -- ALTER TABLE `password_resets` ADD KEY `password_resets_email_index` (`email`); -- -- Indeks untuk tabel `users` -- ALTER TABLE `users` ADD PRIMARY KEY (`id`); -- -- AUTO_INCREMENT untuk tabel yang dibuang -- -- -- AUTO_INCREMENT untuk tabel `failed_jobs` -- ALTER TABLE `failed_jobs` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT untuk tabel `migrations` -- ALTER TABLE `migrations` MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=14; -- -- AUTO_INCREMENT untuk tabel `oauth_clients` -- ALTER TABLE `oauth_clients` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3; -- -- AUTO_INCREMENT untuk tabel `oauth_personal_access_clients` -- ALTER TABLE `oauth_personal_access_clients` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; -- -- AUTO_INCREMENT untuk tabel `users` -- ALTER TABLE `users` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8; 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 */;
<gh_stars>1-10 -- phpMyAdmin SQL Dump -- version 4.0.10deb1 -- http://www.phpmyadmin.net -- -- Host: localhost -- Generation Time: Jan 12, 2016 at 05:35 PM -- Server version: 5.5.46-0ubuntu0.14.04.2 -- PHP Version: 5.5.9-1ubuntu4.14 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; 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 utf8 */; -- -- Database: `calvin` -- -- -------------------------------------------------------- -- -- Table structure for table `media` -- CREATE TABLE IF NOT EXISTS `media` ( `id` int(11) NOT NULL AUTO_INCREMENT, `url` varchar(2000) NOT NULL, `tweet_id` bigint(20) NOT NULL, `path` text NOT NULL, PRIMARY KEY (`id`), KEY `tweet_id` (`tweet_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=2768 ; -- -------------------------------------------------------- -- -- Table structure for table `tweet` -- CREATE TABLE IF NOT EXISTS `tweet` ( `id` bigint(20) NOT NULL, `text` varchar(1400) NOT NULL, `created_at` datetime NOT NULL, `inserted_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!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 */;
SET DEFINE OFF; ALTER TABLE AFW_13_ETAPE_TUTRL ADD ( CONSTRAINT AFW_13_ETAPE_TUTRL_PK PRIMARY KEY (SEQNC) ENABLE VALIDATE) /
<reponame>vient/proctf-2019 create database bb owner postgres; \c bb create extension pgcrypto;
<filename>Labs/Lab3.sql -- Lab 3 -- Total not between 1 to 100 SELECT * FROM SALES WHERE TOTAL_AMOUNT NOT BETWEEN 1 and 100; -- qunatity has value 20/2/10 SELECT * FROM SALES WHERE QUANTITY IN(20,2,10); -- product name starts with MOB SELECT * FROM PRODUCT WHERE PRODUCT_NAME LIKE 'MOB%'; SELECT * FROM PRODUCT WHERE PRODUCT_NAME LIKE 'Mob%'; -- TOTAL AMOUNT > 50,100 & 200 SELECT * FROM SALES WHERE TOTAL_AMOUNT > ANY(50,100,200); -- product color null SELECT * FROM PRODUCT WHERE COLOR IS NULL; -- Total > 100 & quantity <20; SELECT * FROM SALES WHERE TOTAL_AMOUNT>100 and QUANTITY<20;
<gh_stars>1-10 -- 数据字典表 DROP TABLE IF EXISTS `dictionary`; CREATE TABLE `dictionary` ( `id` bigint(20) unsigned AUTO_INCREMENT COMMENT 'id', `key_name` varchar(255) NOT NULL COMMENT '字典键名', `key` varchar(255) NOT NULL COMMENT '字典键', `value_name` varchar(255) NOT NULL COMMENT '字典值名', `value_slug` varchar(255) NOT NULL COMMENT '字典值别名', `value` text COMMENT '字典值', `enabled` tinyint(1) unsigned NOT NULL COMMENT '是否启用(0=否,1=是,默认=0)', `dictionary_category_id` bigint(20) unsigned NOT NULL COMMENT '字典分类 id', `sort` bigint(20) unsigned DEFAULT 0 COMMENT '排序', `remark` varchar(255) DEFAULT '' COMMENT '备注', `gmt_modified` datetime DEFAULT NULL COMMENT '更新时间', `gmt_created` datetime DEFAULT NULL COMMENT '创建时间', PRIMARY KEY (`id`) ) ENGINE = INNODB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci AUTO_INCREMENT = 1 ROW_FORMAT = DYNAMIC COMMENT = '数据字典表';
CREATE TABLE IF NOT EXISTS projects ( pro_id SERIAL PRIMARY KEY, name VARCHAR(100) NOT NULL, insert_date TIMESTAMP NOT NULL DEFAULT now(), update_date TIMESTAMP NOT NULL DEFAULT now() ); COMMENT ON COLUMN projects.pro_id IS 'Primary key.'; COMMENT ON COLUMN projects.name IS 'Project name'; COMMENT ON COLUMN projects.insert_date IS 'Creation date of this row.'; COMMENT ON COLUMN projects.update_date IS 'Last update date of this row.';
<filename>scripts/20151211-173049.sql drop table if exists subscriptions; create table subscriptions ( id text primary key, user_id text not null references users, publication text not null check(util.lower_non_empty_trimmed_string(publication)), unique(user_id, publication) ); comment on table subscriptions is ' Keeps track of things the user has subscribed to (like a daily email) '; select audit.setup('public', 'subscriptions');
<filename>sql/schema.sql<gh_stars>10-100 CREATE DATABASE hackthis; USE hackthis; /* USERS */ CREATE TABLE IF NOT EXISTS users ( `user_id` int(7) NOT NULL AUTO_INCREMENT, `username` varchar(32) NOT NULL, `password` varchar(64), `old_password` tinyint(1) NOT NULL DEFAULT 0, `oauth_id` int(7), `email` varchar(128) NOT NULL, `verified` tinyint(1) NOT NULL DEFAULT 0, `score` mediumint(6) NOT NULL DEFAULT 0, `g_auth` tinyint(1), `g_secret` varchar(255), PRIMARY KEY (`user_id`), UNIQUE KEY (`username`), UNIQUE KEY (`email`) ) ENGINE=InnoDB; CREATE TABLE IF NOT EXISTS users_oauth ( id int(7) AUTO_INCREMENT, uid varchar(128), provider enum('facebook','twitter'), PRIMARY KEY (`id`), UNIQUE (`uid`, `provider`) ) ENGINE=InnoDB; CREATE TABLE IF NOT EXISTS users_levels ( `user_id` int(7) NOT NULL, `level_id` tinyint(3) UNSIGNED NOT NULL, `started` timestamp DEFAULT CURRENT_TIMESTAMP, `completed` timestamp, `attempts` smallint(3) UNSIGNED DEFAULT 0, PRIMARY KEY (`user_id`, `level_id`), FOREIGN KEY (`user_id`) REFERENCES users (`user_id`) -- Level constraint added later ) ENGINE=InnoDB; CREATE TABLE IF NOT EXISTS users_levels_data ( `user_id` int(7) NOT NULL, `level_id` tinyint(3) UNSIGNED NOT NULL, `data` text, `time` timestamp DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`user_id`, `level_id`), FOREIGN KEY (`user_id`) REFERENCES users (`user_id`) -- Level constraint added later ) ENGINE=InnoDB; CREATE TABLE IF NOT EXISTS users_profile ( `user_id` int(7) NOT NULL, `name` varchar(32), `show_name` tinyint(1) DEFAULT 1, `img` varchar(32), `gravatar` tinyint(1) DEFAULT 0, `country` tinyint(3) UNSIGNED, `dob` DATE, `show_dob` tinyint(1) DEFAULT 0, `gender` enum('male','female','alien'), `show_gender` tinyint(1) DEFAULT 0, `show_email` tinyint(1) DEFAULT 0, `website` text, `about` text, `forum_signature` text, `show_online` tinyint(1) DEFAULT 1, `show_leaderboard` tinyint(1) DEFAULT 1, PRIMARY KEY (`user_id`), FOREIGN KEY (`user_id`) REFERENCES users (`user_id`), INDEX (`show_online`), INDEX (`show_leaderboard`) ) ENGINE=InnoDB; /* * Assigns users different privileges for site sections * Default of 1 indicates accesses, 0 being no access * Values above 1 indicated extended privileges */ CREATE TABLE IF NOT EXISTS users_priv ( `user_id` int(7) NOT NULL, `site_priv` tinyint(1) NOT NULL DEFAULT 1, `pm_priv` tinyint(1) NOT NULL DEFAULT 1, `forum_priv` tinyint(1) NOT NULL DEFAULT 1, `pub_priv` tinyint(1) NOT NULL DEFAULT 1, PRIMARY KEY (`user_id`), FOREIGN KEY (`user_id`) REFERENCES users (`user_id`) ) ENGINE=InnoDB; /* * Stores the relationship between different users * status shows if the relationship has been accepted * or denied by friend_id */ CREATE TABLE IF NOT EXISTS users_friends ( `user_id` int(7) NOT NULL, `friend_id` int(7) NOT NULL, `status` tinyint(1) NOT NULL DEFAULT 0, `time` timestamp DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`user_id`, `friend_id`), FOREIGN KEY (`user_id`) REFERENCES users (`user_id`), FOREIGN KEY (`friend_id`) REFERENCES users (`user_id`) ) ENGINE=InnoDB; /* * Remove the ability for blocked_id from contacting * user_id via any communication channel */ CREATE TABLE IF NOT EXISTS users_blocks ( `user_id` int(7) NOT NULL, `blocked_id` int(7) NOT NULL, `time` timestamp DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`user_id`, `blocked_id`), FOREIGN KEY (`user_id`) REFERENCES users (`user_id`), FOREIGN KEY (`blocked_id`) REFERENCES users (`user_id`) ) ENGINE=InnoDB; CREATE TABLE IF NOT EXISTS users_activity ( `user_id` int(7) NOT NULL, `joined` timestamp DEFAULT CURRENT_TIMESTAMP, `last_active` timestamp, `last_login` timestamp, `current_login` timestamp, `login_count` int(5) DEFAULT 0, `consecutive` int(4) DEFAULT 0, `consecutive_most` int(4) DEFAULT 0, `days` int(5) DEFAULT 0, PRIMARY KEY (`user_id`), FOREIGN KEY (`user_id`) REFERENCES users (`user_id`) ) ENGINE=InnoDB; /* * Notification types: * see https://github.com/HackThis/hackthis.co.uk/wiki/Database#notification-types */ CREATE TABLE IF NOT EXISTS users_notifications ( `notification_id` int(6) NOT NULL AUTO_INCREMENT, `user_id` int(7) NOT NULL, `type` enum('friend','friend_accepted', 'medal','forum_post','forum_mention','comment_reply','comment_mention','article', 'mod_contact', 'mod_report') NOT NULL, `from_id` int(7), `item_id` int(7), `time` timestamp DEFAULT CURRENT_TIMESTAMP, `seen` tinyint(1) DEFAULT 0, PRIMARY KEY (`notification_id`), FOREIGN KEY (`user_id`) REFERENCES users (`user_id`) ) ENGINE=InnoDB; /* * Feed types: * see https://github.com/HackThis/hackthis.co.uk/wiki/Database#feed-types */ CREATE TABLE IF NOT EXISTS users_feed ( `feed_id` int(6) NOT NULL AUTO_INCREMENT, `user_id` int(7) NOT NULL, `type` enum('join','level','friend','medal','thread','forum_post','karma','comment','favourite','article','image') NOT NULL, `item_id` int(7), `time` timestamp DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`feed_id`), FOREIGN KEY (`user_id`) REFERENCES users (`user_id`) ) ENGINE=InnoDB; CREATE TABLE IF NOT EXISTS users_data ( `data_id` int(4) NOT NULL AUTO_INCREMENT, `user_id` int(7) NOT NULL, `type` varchar(32) NOT NULL, `value` varchar(64) NOT NULL, `extra` text, `time` timestamp DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`data_id`), FOREIGN KEY (`user_id`) REFERENCES users (`user_id`), UNIQUE (`type`, `value`) ) ENGINE=InnoDB; CREATE TABLE IF NOT EXISTS `users_donations` ( `user_id` int(7) DEFAULT NULL, `amount` decimal(6,2) DEFAULT NULL, `time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `id` text NOT NULL, KEY `user_id` (`user_id`) ) ENGINE=InnoDB; CREATE TABLE IF NOT EXISTS users_settings ( `user_id` int(7) NOT NULL, `email_pm` tinyint(1) NOT NULL DEFAULT 1, `email_forum_reply` tinyint(1) NOT NULL DEFAULT 1, `email_forum_mention` tinyint(1) NOT NULL DEFAULT 1, `email_friend` tinyint(1) NOT NULL DEFAULT 1, `email_news` tinyint(1) NOT NULL DEFAULT 1, PRIMARY KEY (`user_id`), FOREIGN KEY (`user_id`) REFERENCES users (`user_id`) ) ENGINE=InnoDB; CREATE TABLE IF NOT EXISTS users_registration ( `user_id` int(7) NOT NULL, `ip` bigint(12) NOT NULL, `time` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`user_id`) ) ENGINE=InnoDB; /* MEDALS */ CREATE TABLE IF NOT EXISTS medals_colours ( `colour_id` tinyint(1) NOT NULL AUTO_INCREMENT, `reward` int(4) NOT NULL DEFAULT 0, `colour` varchar(6) NOT NULL, PRIMARY KEY (`colour_id`) ) ENGINE=InnoDB; CREATE TABLE IF NOT EXISTS medals ( `medal_id` tinyint(3) UNSIGNED NOT NULL AUTO_INCREMENT, `label` varchar(16) NOT NULL, `colour_id` tinyint(1) NOT NULL, `description` text NOT NULL, PRIMARY KEY (`medal_id`), FOREIGN KEY (`colour_id`) REFERENCES medals_colours (`colour_id`) ) ENGINE=InnoDB; CREATE TABLE IF NOT EXISTS users_medals ( `user_id` int(7) NOT NULL, `medal_id` tinyint(3) UNSIGNED NOT NULL, `time` timestamp DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`user_id`, `medal_id`), FOREIGN KEY (`user_id`) REFERENCES users (`user_id`), FOREIGN KEY (`medal_id`) REFERENCES medals (`medal_id`) ) ENGINE=InnoDB; /* LEVELS */ CREATE TABLE IF NOT EXISTS levels_groups ( `title` varchar(16), `order` tinyint(1), PRIMARY KEY (`title`) ) ENGINE=InnoDB; CREATE TABLE IF NOT EXISTS levels ( `level_id` tinyint(3) UNSIGNED NOT NULL AUTO_INCREMENT, `name` varchar(8) NOT NULL, `group` varchar(16) NOT NULL, PRIMARY KEY (`level_id`), UNIQUE (`name`, `group`), FOREIGN KEY (`group`) REFERENCES levels_groups (`title`) ) ENGINE=InnoDB; CREATE TABLE IF NOT EXISTS levels_data ( `level_id` tinyint(3) UNSIGNED NOT NULL AUTO_INCREMENT, `key` enum('author', 'reward', 'form', 'answer', 'articles', 'hint', 'description', 'solution', 'code', 'uptime') NOT NULL, `value` text NOT NULL, PRIMARY KEY (`level_id`, `key`), FOREIGN KEY (`level_id`) REFERENCES levels (`level_id`) ) ENGINE=InnoDB; ALTER TABLE users_levels ADD FOREIGN KEY (`level_id`) REFERENCES levels (`level_id`); ALTER TABLE users_levels_data ADD FOREIGN KEY (`level_id`) REFERENCES levels (`level_id`); /* MESSAGES */ CREATE TABLE IF NOT EXISTS pm ( `pm_id` int(7) NOT NULL AUTO_INCREMENT, `title` varchar(64) NOT NULL, PRIMARY KEY (`pm_id`) ) ENGINE=InnoDB; CREATE TABLE IF NOT EXISTS pm_messages ( `message_id` int(7) NOT NULL AUTO_INCREMENT, `pm_id` int(7) NOT NULL, `user_id` int(7), `message` text NOT NULL, `time` timestamp DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`message_id`), FOREIGN KEY (`pm_id`) REFERENCES pm (`pm_id`), FOREIGN KEY (`user_id`) REFERENCES users (`user_id`) ) ENGINE=InnoDB; CREATE TABLE IF NOT EXISTS pm_users ( `pm_id` int(7) NOT NULL, `user_id` int(7) NOT NULL, `seen` timestamp NULL DEFAULT NULL, `deleted` timestamp NULL DEFAULT NULL, PRIMARY KEY (`pm_id`, `user_id`), FOREIGN KEY (`pm_id`) REFERENCES pm (`pm_id`), FOREIGN KEY (`user_id`) REFERENCES users (`user_id`) ) ENGINE=InnoDB; /* FORUM */ CREATE TABLE IF NOT EXISTS forum_sections ( `section_id` int(3) NOT NULL AUTO_INCREMENT, `parent_id` int(3), `title` varchar(32), `slug` varchar(255), `description` text, `priv_level` tinyint(3) UNSIGNED NULL DEFAULT NULL, PRIMARY KEY (`section_id`), UNIQUE (`slug`) ) ENGINE=InnoDB; CREATE TABLE IF NOT EXISTS forum_threads ( `thread_id` int(6) NOT NULL AUTO_INCREMENT, `section_id` int(3) NOT NULL, `title` varchar(128) NOT NULL, `slug` varchar(255), `owner` int(7), `deleted` tinyint(1) DEFAULT 0, `closed` tinyint(1) DEFAULT 0, `sticky` tinyint(1) DEFAULT 0, PRIMARY KEY (`thread_id`), UNIQUE (`slug`), FOREIGN KEY (`owner`) REFERENCES users (`user_id`), FOREIGN KEY (`section_id`) REFERENCES forum_sections (`section_id`) ) ENGINE=InnoDB; CREATE TABLE IF NOT EXISTS forum_posts ( `post_id` int(6) NOT NULL AUTO_INCREMENT, `thread_id` int(6) NOT NULL, `body` TEXT NOT NULL, `author` int(7), `posted` timestamp DEFAULT CURRENT_TIMESTAMP, `updated` timestamp, `deleted` tinyint(1) DEFAULT 0, PRIMARY KEY (`post_id`), FOREIGN KEY (`author`) REFERENCES users (`user_id`), FOREIGN KEY (`thread_id`) REFERENCES forum_threads (`thread_id`) ) ENGINE=InnoDB; CREATE TABLE IF NOT EXISTS forum_posts_audit ( `audit_id` int(7) NOT NULL AUTO_INCREMENT, `post_id` int(6) NOT NULL, `field` varchar(32) NOT NULL, `old_value` TEXT NOT NULL, `new_value` TEXT NOT NULL, `time` timestamp DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`audit_id`,`post_id`,`field`)-- , -- FOREIGN KEY (`user_id`) REFERENCES users (`user_id`) -- TODO: Provide the ability to get the user id from within the trigger. ) ENGINE=InnoDB; CREATE TABLE IF NOT EXISTS forum_posts_flags ( `flag_id` int(6) NOT NULL AUTO_INCREMENT, `post_id` int(6) NOT NULL, `user_id` int(7), `reason` tinyint(1) NOT NULL, `details` TEXT, `time` timestamp DEFAULT CURRENT_TIMESTAMP, `response` tinyint(1) DEFAULT 0, PRIMARY KEY (`flag_id`), FOREIGN KEY (`user_id`) REFERENCES users (`user_id`), FOREIGN KEY (`post_id`) REFERENCES forum_posts (`post_id`) ) ENGINE=InnoDB; CREATE TABLE IF NOT EXISTS forum_users ( `user_id` int(7) NOT NULL, `thread_id` int(6) NOT NULL, `viewed` timestamp DEFAULT CURRENT_TIMESTAMP, `watching` tinyint(1) DEFAULT 0, PRIMARY KEY (`user_id`, `thread_id`), FOREIGN KEY (`user_id`) REFERENCES users (`user_id`), FOREIGN KEY (`thread_id`) REFERENCES forum_threads (`thread_id`) ) ENGINE=InnoDB; CREATE TABLE IF NOT EXISTS users_forum ( `user_id` int(7) NOT NULL, `post_id` int(6) NOT NULL, `karma` tinyint(1) DEFAULT 0, `time` timestamp DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`user_id`, `post_id`), FOREIGN KEY (`user_id`) REFERENCES users (`user_id`), FOREIGN KEY (`post_id`) REFERENCES forum_posts (`post_id`) ) ENGINE=InnoDB; /* ARTICLES */ CREATE TABLE IF NOT EXISTS articles_categories ( `category_id` int(3) NOT NULL AUTO_INCREMENT, `parent_id` int(3), `title` varchar(32), `slug` varchar(255), PRIMARY KEY (`category_id`), UNIQUE (`slug`) ) ENGINE=InnoDB; -- TODO: Timestamps man TIME!! CREATE TABLE IF NOT EXISTS articles ( `article_id` int(6) NOT NULL AUTO_INCREMENT, `user_id` int(7), `title` varchar(128) NOT NULL, `slug` varchar(255) NOT NULL, `category_id` int(3) NOT NULL, `body` TEXT NOT NULL, `thumbnail` varchar(64), `submitted` timestamp DEFAULT CURRENT_TIMESTAMP, `updated` timestamp, `views` int(5) DEFAULT 0, PRIMARY KEY (`article_id`), UNIQUE (`slug`), FOREIGN KEY (`user_id`) REFERENCES users (`user_id`), FOREIGN KEY (`category_id`) REFERENCES articles_categories (`category_id`) ) ENGINE=InnoDB; CREATE TABLE IF NOT EXISTS articles_draft ( `article_id` int(6) NOT NULL AUTO_INCREMENT, `user_id` int(7) NOT NULL, `title` varchar(128) NOT NULL, `category_id` int(3) NOT NULL, `body` TEXT NOT NULL, `time` timestamp DEFAULT CURRENT_TIMESTAMP, `note` TEXT, PRIMARY KEY (`article_id`), FOREIGN KEY (`user_id`) REFERENCES users (`user_id`), FOREIGN KEY (`category_id`) REFERENCES articles_categories (`category_id`) ) ENGINE=InnoDB; CREATE TABLE IF NOT EXISTS articles_audit ( `audit_id` int(7) NOT NULL AUTO_INCREMENT, `article_id` int(6) NOT NULL, `draft` tinyint(1) NOT NULL, `field` varchar(32) NOT NULL, `old_value` TEXT NOT NULL, `new_value` TEXT NOT NULL, `time` timestamp DEFAULT CURRENT_TIMESTAMP, `user_id` int(7) NOT NULL, `comment` TEXT NULL, PRIMARY KEY (`audit_id`,`article_id`,`draft`,`field`)-- , -- FOREIGN KEY (`user_id`) REFERENCES users (`user_id`) -- TODO: Provide the ability to get the user id from within the trigger. ) ENGINE=InnoDB; CREATE TABLE IF NOT EXISTS articles_comments ( `comment_id` int(6) NOT NULL AUTO_INCREMENT, `article_id` int(6) NOT NULL, `user_id` int(7), `parent_id` int(6) NOT NULL DEFAULT 0, `comment` text NOT NULL, `reported` tinyint(1), -- Number of times this comment has been reported `deleted` int(7), `time` timestamp DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`comment_id`), FOREIGN KEY (`article_id`) REFERENCES articles (`article_id`), FOREIGN KEY (`user_id`) REFERENCES users (`user_id`) ) ENGINE=InnoDB; CREATE TABLE IF NOT EXISTS articles_favourites ( `article_id` int(6) NOT NULL, `user_id` int(7) NOT NULL, `time` timestamp DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`article_id`, `user_id`), FOREIGN KEY (`article_id`) REFERENCES articles (`article_id`), FOREIGN KEY (`user_id`) REFERENCES users (`user_id`) ) ENGINE=InnoDB; CREATE TABLE IF NOT EXISTS home_ticker ( `id` int(6) NOT NULL AUTO_INCREMENT, `source` varchar(32) NOT NULL, `text` varchar(256) NOT NULL, `url` text NOT NULL, `user_id` int(7) NOT NULL, `status` tinyint(1) DEFAULT 0, `time` timestamp DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`), FOREIGN KEY (`user_id`) REFERENCES users (`user_id`) ) ENGINE=InnoDB; CREATE TABLE IF NOT EXISTS home_ticker_votes ( `ticker_id` int(6) NOT NULL, `user_id` int(7) NOT NULL, PRIMARY KEY (`ticker_id`, `user_id`), FOREIGN KEY (`ticker_id`) REFERENCES home_ticker (`id`), FOREIGN KEY (`user_id`) REFERENCES users (`user_id`) ) ENGINE=InnoDB; /* MODERATOR TABLES */ CREATE TABLE IF NOT EXISTS mod_reports ( `report_id` int(6) NOT NULL AUTO_INCREMENT, `user_id` int(7) NOT NULL, `type` enum('comment', 'article', 'user', 'forum', 'forum_thread', 'level') NOT NULL, `about` int(7) NOT NULL, `subject` varchar(64), `body` text, `visible` tinyint(1) DEFAULT 1, `time` timestamp DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`report_id`), FOREIGN KEY (`user_id`) REFERENCES users (`user_id`) ) ENGINE=InnoDB; CREATE TABLE IF NOT EXISTS mod_contact ( `message_id` int(6) NOT NULL AUTO_INCREMENT, `parent_id` int(6), `user_id` int(7) NOT NULL, `from` varchar(128), `body` text, `javascript` tinyint(1) DEFAULT NULL, `browser` varchar(32) DEFAULT NULL, `sent` timestamp DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`message_id`) ) ENGINE=InnoDB; /* EMAIL TABLES */ CREATE TABLE IF NOT EXISTS email_queue ( `email_id` int(6) NOT NULL AUTO_INCREMENT, `user_id` int(7) DEFAULT NULL, `recipient` varchar(128) NOT NULL, `type` enum('password', 'ticket_reply', 'forum_mention', 'forum_reply', 'friend', 'pm', 'email_confirmation', 'digest') NOT NULL, `data` text NOT NULL, `sent` timestamp DEFAULT CURRENT_TIMESTAMP, `status` tinyint(1) DEFAULT 0, -- 0 waiting, 1 sending, 2 sent, 3+ error (error * 3mins = wait) PRIMARY KEY (`email_id`), FOREIGN KEY (`user_id`) REFERENCES users (`user_id`) ) ENGINE=InnoDB; /* API */ CREATE TABLE IF NOT EXISTS `api_clients` ( `client_id` int(3) NOT NULL AUTO_INCREMENT, `user_id` int(7) DEFAULT NULL, `identifier` text NOT NULL, `domain` text NOT NULL, `key` varchar(64) NOT NULL, `privileges` text NOT NULL, PRIMARY KEY (`client_id`), UNIQUE KEY `secret_key` (`key`) ) ENGINE=InnoDB; /* IRC LOGS */ CREATE TABLE IF NOT EXISTS `irc_stats` ( `nick` varchar(64) NOT NULL, `lines` int(5) NOT NULL, `words` int(8) NOT NULL, `chars` int(10) NOT NULL, `time` timestamp DEFAULT CURRENT_TIMESTAMP, `username` varchar(35) NOT NULL, PRIMARY KEY (`nick`) ) ENGINE=MyISAM; CREATE TABLE IF NOT EXISTS `irc_logs` ( `log_id` int(11) NOT NULL AUTO_INCREMENT, `nick` varchar(64) NOT NULL, `channel` varchar(25) NOT NULL, `log` text NOT NULL, `time` timestamp DEFAULT CURRENT_TIMESTAMP, `removed` int(1) NOT NULL, PRIMARY KEY (`log_id`) ) ENGINE=MyISAM; /* TRIGGERS */ delimiter $$ -- USERS DROP TRIGGER IF EXISTS insert_user$$ CREATE TRIGGER insert_user AFTER INSERT ON users FOR EACH ROW BEGIN INSERT INTO users_activity (`user_id`) VALUES (NEW.user_id); CALL user_feed(NEW.user_id, 'join', NULL); END$$ DROP TRIGGER IF EXISTS update_user$$ CREATE TRIGGER update_user BEFORE UPDATE ON users FOR EACH ROW BEGIN IF OLD.email <> NEW.email THEN SET NEW.verified = 0; END IF; END$$ DROP TRIGGER IF EXISTS delete_user$$ CREATE TRIGGER delete_user BEFORE DELETE ON users FOR EACH ROW BEGIN DELETE FROM users_oauth WHERE OLD.oauth_id = id; DELETE FROM users_profile WHERE OLD.user_id = user_id; DELETE FROM users_priv WHERE OLD.user_id = user_id; DELETE FROM users_friends WHERE OLD.user_id = user_id OR OLD.user_id = friend_id; DELETE FROM users_blocks WHERE OLD.user_id = user_id OR OLD.user_id = blocked_id; DELETE FROM users_activity WHERE OLD.user_id = user_id; DELETE FROM users_notifications WHERE OLD.user_id = user_id OR OLD.user_id = from_id; DELETE FROM users_medals WHERE OLD.user_id = user_id; DELETE FROM users_levels WHERE OLD.user_id = user_id; DELETE FROM users_levels_data WHERE OLD.user_id = user_id; DELETE FROM users_data WHERE OLD.user_id = user_id; DELETE FROM mod_reports WHERE OLD.user_id = user_id; DELETE FROM articles_favourites WHERE OLD.user_id = user_id; DELETE FROM articles_draft WHERE OLD.user_id = user_id; DELETE FROM users_forum WHERE OLD.user_id = user_id; DELETE FROM forum_users WHERE OLD.user_id = user_id; DELETE FROM pm_users WHERE OLD.user_id = user_id; DELETE FROM users_feed WHERE OLD.user_id = user_id; DELETE FROM users_settings WHERE OLD.user_id = user_id; DELETE FROM home_ticker WHERE OLD.user_id = user_id; DELETE FROM email_queue WHERE OLD.user_id = user_id; -- Add other tables to be removed. -- Update other contributions to NULL so they aren't lost UPDATE users_donations SET user_id = NULL WHERE user_id = OLD.user_id; UPDATE articles_comments SET user_id = NULL WHERE user_id = OLD.user_id; UPDATE articles SET user_id = NULL WHERE user_id = OLD.user_id; UPDATE forum_posts SET author = NULL WHERE author = OLD.user_id; UPDATE forum_threads SET owner = NULL WHERE owner = OLD.user_id; UPDATE pm_messages SET user_id = NULL WHERE user_id = OLD.user_id; END$$ -- NOTIFICATIONS DROP PROCEDURE IF EXISTS user_notify$$ CREATE PROCEDURE user_notify(user_id INT, type TEXT, from_id INT, item_id INT) BEGIN INSERT INTO users_notifications (`user_id`, `type`, `from_id`, `item_id`) VALUES (user_id, type, from_id, item_id); END$$ DROP PROCEDURE IF EXISTS user_notify_remove$$ CREATE PROCEDURE user_notify_remove(_user_id INT, _type TEXT, _from_id INT, _item_id INT) BEGIN IF _item_id IS NULL THEN DELETE FROM users_notifications WHERE `user_id` = _user_id AND `type` = _type AND `from_id` = _from_id LIMIT 1; ELSE DELETE FROM users_notifications WHERE `user_id` = _user_id AND `type` = _type AND `from_id` = _from_id AND `item_id` = _item_id LIMIT 1; END IF; END$$ DROP PROCEDURE IF EXISTS user_feed$$ CREATE PROCEDURE user_feed(user_id INT, type TEXT, item_id INT) BEGIN INSERT INTO users_feed (`user_id`, `type`, `item_id`) VALUES (user_id, type, item_id); END$$ DROP PROCEDURE IF EXISTS user_feed_remove$$ CREATE PROCEDURE user_feed_remove(_user_id INT, _type TEXT, _item_id INT) BEGIN DELETE FROM users_feed WHERE `user_id` = _user_id AND `type` = _type AND `item_id` = _item_id LIMIT 1; END$$ -- When a user completes a level and an item is added to users_levels -- Give user the relevant score and add to users feed DROP TRIGGER IF EXISTS insert_user_level$$ CREATE TRIGGER insert_user_level AFTER INSERT ON users_levels FOR EACH ROW BEGIN DECLARE REWARD INT; IF NEW.completed > 0 THEN CALL user_feed(NEW.user_id, 'level', NEW.level_id); SET REWARD = (SELECT `value` FROM `levels_data` WHERE level_id = NEW.level_id AND `key` = 'reward' LIMIT 1); UPDATE users SET score = score + REWARD WHERE user_id = NEW.user_id LIMIT 1; END IF; END$$ DROP TRIGGER IF EXISTS update_user_level$$ CREATE TRIGGER update_user_level AFTER UPDATE ON users_levels FOR EACH ROW BEGIN DECLARE REWARD INT; IF NEW.completed > 0 THEN CALL user_feed(NEW.user_id, 'level', NEW.level_id); SET REWARD = (SELECT `value` FROM `levels_data` WHERE level_id = NEW.level_id AND `key` = 'reward' LIMIT 1); UPDATE users SET score = score + REWARD WHERE user_id = NEW.user_id LIMIT 1; END IF; END$$ DROP TRIGGER IF EXISTS delete_user_level$$ CREATE TRIGGER delete_user_level AFTER DELETE ON users_levels FOR EACH ROW BEGIN DECLARE REWARD INT; DECLARE _e INT; DECLARE CONTINUE HANDLER FOR 1442 SET _e = 1; SET REWARD = (SELECT `value` FROM `levels_data` WHERE level_id = OLD.level_id AND `key` = 'reward' LIMIT 1); UPDATE users SET score = score - REWARD WHERE user_id = OLD.user_id LIMIT 1; CALL user_feed_remove(OLD.user_id, 'level', OLD.level_id); END$$ -- Update users scores when the reward given for a level is altered DROP TRIGGER IF EXISTS update_levels_data$$ CREATE TRIGGER update_levels_data AFTER UPDATE ON levels_data FOR EACH ROW BEGIN IF NEW.key = 'reward' THEN UPDATE users JOIN users_levels ON users.user_id = users_levels.user_id SET users.score = users.score - OLD.value + NEW.value WHERE users_levels.level_id = NEW.level_id AND users_levels.completed > 0; END IF; END$$ DROP TRIGGER IF EXISTS insert_friend_before$$ CREATE TRIGGER insert_friend_before BEFORE INSERT ON users_friends FOR EACH ROW BEGIN declare alreadyexists integer; SELECT count(*) > 0 into alreadyexists FROM users_friends WHERE user_id = NEW.friend_id AND friend_id = NEW.user_id; IF alreadyexists = 1 THEN SELECT `erroorororororor` INTO alreadyexists FROM users_friends; END IF; END$$ DROP TRIGGER IF EXISTS insert_friend$$ CREATE TRIGGER insert_friend AFTER INSERT ON users_friends FOR EACH ROW BEGIN CALL user_notify(NEW.friend_id, 'friend', NEW.user_id, null); END$$ DROP TRIGGER IF EXISTS update_friend$$ CREATE TRIGGER update_friend AFTER UPDATE ON users_friends FOR EACH ROW BEGIN IF NEW.status = 1 THEN -- Alert user who sent request CALL user_notify(NEW.user_id, 'friend_accepted', NEW.friend_id, null); -- Add to both users feeds CALL user_feed(NEW.user_id, 'friend', NEW.friend_id); CALL user_feed(NEW.friend_id, 'friend', NEW.user_id); END IF; END$$ DROP TRIGGER IF EXISTS delete_friend$$ CREATE TRIGGER delete_friend AFTER DELETE ON users_friends FOR EACH ROW BEGIN CALL user_notify_remove(OLD.friend_id, 'friend', OLD.user_id, null); CALL user_notify_remove(OLD.user_id, 'friend_accepted', OLD.friend_id, null); CALL user_feed_remove(OLD.user_id, 'friend', OLD.friend_id); CALL user_feed_remove(OLD.friend_id, 'friend', OLD.user_id); END$$ -- MEDALS DROP TRIGGER IF EXISTS insert_medal$$ CREATE TRIGGER insert_medal AFTER INSERT ON users_medals FOR EACH ROW BEGIN DECLARE REWARD INT; SET REWARD = (SELECT medals_colours.reward FROM `medals` INNER JOIN `medals_colours` on medals.colour_id = medals_colours.colour_id WHERE medals.medal_id = NEW.medal_id LIMIT 1); UPDATE users SET score = score + REWARD WHERE user_id = NEW.user_id LIMIT 1; CALL user_notify(NEW.user_id, 'medal', null, NEW.medal_id); CALL user_feed(NEW.user_id, 'medal', NEW.medal_id); END$$ DROP TRIGGER IF EXISTS delete_medal$$ CREATE TRIGGER delete_medal AFTER DELETE ON users_medals FOR EACH ROW BEGIN DECLARE REWARD INT; DECLARE _e INT; DECLARE CONTINUE HANDLER FOR 1442 SET _e = 1; SET REWARD = (SELECT medals_colours.reward FROM `medals` INNER JOIN `medals_colours` on medals.colour_id = medals_colours.colour_id WHERE medals.medal_id = OLD.medal_id LIMIT 1); UPDATE users SET score = score - REWARD WHERE user_id = OLD.user_id LIMIT 1; CALL user_feed_remove(OLD.user_id, 'medal', OLD.medal_id); END$$ DROP TRIGGER IF EXISTS update_medal_reward$$ create trigger update_medal_reward after update on medals_colours for each row begin DECLARE done INT DEFAULT FALSE; DECLARE colour_count int; DECLARE user_id_fetch int; DECLARE reward INT; DECLARE reward_recal int ; DECLARE cur CURSOR FOR select um.user_id, count(*) as total from users_medals um join medals m on m.medal_id = um.medal_id where m.colour_id = new.colour_id group by um.user_id; DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; SET reward = OLD.reward - NEW.reward; OPEN cur; update_loop: LOOP FETCH cur INTO user_id_fetch,colour_count; IF done THEN LEAVE update_loop; END IF; set reward_recal = colour_count*reward ; update users SET score = score - reward_recal where user_id = user_id_fetch ; END LOOP; CLOSE cur; end ; $$ -- FORUM DROP TRIGGER IF EXISTS insert_forum_post$$ CREATE TRIGGER insert_forum_post AFTER INSERT ON forum_posts FOR EACH ROW BEGIN CALL user_feed(NEW.author, 'forum_post', NEW.post_id); END$$ DROP TRIGGER IF EXISTS delete_forum_post$$ CREATE TRIGGER delete_forum_post BEFORE DELETE ON forum_posts FOR EACH ROW BEGIN DELETE FROM users_forum WHERE post_id = OLD.post_id; END$$ DROP TRIGGER IF EXISTS forum_posts_update_audit$$ CREATE TRIGGER forum_posts_update_audit BEFORE UPDATE ON forum_posts FOR EACH ROW BEGIN IF OLD.body <> NEW.body THEN INSERT INTO forum_posts_audit (post_id, field, old_value, new_value) VALUES(NEW.post_id, 'body', OLD.body, NEW.body); END IF; END$$ DROP TRIGGER IF EXISTS delete_forum_thread$$ CREATE TRIGGER delete_forum_thread BEFORE DELETE ON forum_threads FOR EACH ROW BEGIN DELETE FROM forum_posts WHERE thread_id = OLD.thread_id; DELETE FROM forum_users WHERE thread_id = OLD.thread_id; END$$ DROP TRIGGER IF EXISTS update_forum_thread$$ CREATE TRIGGER update_forum_thread AFTER UPDATE ON forum_threads FOR EACH ROW BEGIN IF NEW.deleted = 1 THEN UPDATE forum_posts SET deleted = 1 WHERE thread_id = OLD.thread_id; END IF; END$$ -- ARTICLES DROP TRIGGER IF EXISTS insert_article$$ CREATE TRIGGER insert_article AFTER INSERT ON articles FOR EACH ROW BEGIN CALL user_notify(NEW.user_id, 'article', null, NEW.article_id); CALL user_feed(NEW.user_id, 'article', NEW.article_id); END$$ -- TODO: Pull the user id and a comment made to the new version. DROP TRIGGER IF EXISTS articles_draft_update_audit$$ CREATE TRIGGER articles_draft_update_audit BEFORE UPDATE ON articles_draft FOR EACH ROW BEGIN IF OLD.body <> NEW.body THEN INSERT INTO articles_audit (article_id, draft, field, old_value, new_value) VALUES(NEW.article_id, 1, 'body', OLD.body, NEW.body); END IF; IF OLD.category_id <> NEW.category_id THEN -- Get the string title of the category from the cat id. SET @old_cat = (SELECT title FROM articles_categories WHERE category_id = OLD.category_id); SET @new_cat = (SELECT title FROM articles_categories WHERE category_id = NEW.category_id); INSERT INTO articles_audit (article_id, draft, field, old_value, new_value) VALUES(NEW.article_id, 1, 'category_id', @old_cat, @new_cat); END IF; IF OLD.title <> NEW.title THEN INSERT INTO articles_audit (article_id, draft, field, old_value, new_value) VALUES(NEW.article_id, 1, 'title', OLD.title, NEW.title); END IF; END$$ DROP TRIGGER IF EXISTS articles_update_audit$$ CREATE TRIGGER articles_update_audit BEFORE UPDATE ON articles FOR EACH ROW BEGIN IF OLD.title <> NEW.title THEN INSERT INTO articles_audit (article_id, draft, field, old_value, new_value) VALUES(NEW.article_id, 0, 'title', OLD.title, NEW.title); END IF; IF OLD.slug <> NEW.slug THEN INSERT INTO articles_audit (article_id, draft, field, old_value, new_value) VALUES(NEW.article_id, 0, 'slug', OLD.slug, NEW.slug); END IF; IF OLD.category_id <> NEW.category_id THEN -- Get the string title of the category from the cat id. SET @old_cat = (SELECT title FROM articles_categories WHERE category_id = OLD.category_id); SET @new_cat = (SELECT title FROM articles_categories WHERE category_id = NEW.category_id); INSERT INTO articles_audit (article_id, draft, field, old_value, new_value) VALUES(NEW.article_id, 0, 'category_id', @old_cat, @new_cat); END IF; IF OLD.body <> NEW.body THEN INSERT INTO articles_audit (article_id, draft, field, old_value, new_value) VALUES(NEW.article_id, 0, 'body', OLD.body, NEW.body); END IF; IF OLD.thumbnail <> NEW.thumbnail THEN INSERT INTO articles_audit (article_id, draft, field, old_value, new_value) VALUES(NEW.article_id, 0, 'thumbnail', OLD.thumbnail, NEW.thumbnail); END IF; END$$ DROP TRIGGER IF EXISTS insert_article_categories$$ CREATE TRIGGER insert_article_categories BEFORE INSERT ON articles_categories FOR EACH ROW BEGIN IF NEW.parent_id IS NOT NULL THEN SET NEW.slug = CONCAT_WS('/', (SELECT `slug` FROM articles_categories WHERE category_id = NEW.parent_id), NEW.slug); END IF; END$$ DROP TRIGGER IF EXISTS insert_article_comment$$ CREATE TRIGGER insert_article_comment AFTER INSERT ON articles_comments FOR EACH ROW BEGIN CALL user_feed(NEW.user_id, 'comment', NEW.comment_id); END$$ DROP TRIGGER IF EXISTS delete_article_comment$$ CREATE TRIGGER delete_article_comment AFTER UPDATE ON articles_comments FOR EACH ROW BEGIN IF NEW.deleted IS NOT NULL THEN CALL user_feed_remove(OLD.user_id, 'comment', OLD.comment_id); END IF; END$$ DROP TRIGGER IF EXISTS insert_article_favourites$$ CREATE TRIGGER insert_article_favourites AFTER INSERT ON articles_favourites FOR EACH ROW BEGIN CALL user_feed(NEW.user_id, 'favourite', NEW.article_id); END$$ DROP TRIGGER IF EXISTS delete_article_favourites$$ CREATE TRIGGER delete_article_favourites AFTER DELETE ON articles_favourites FOR EACH ROW BEGIN CALL user_feed_remove(OLD.user_id, 'favourite', OLD.article_id); END$$ -- Ticker DROP TRIGGER IF EXISTS delete_home_ticker$$ CREATE TRIGGER delete_home_ticker BEFORE DELETE ON home_ticker FOR EACH ROW BEGIN DELETE FROM home_ticker_votes WHERE ticker_id = OLD.id; END$$ $$ delimiter ;
<reponame>Geodan/plv8_geo<filename>src/earcut.sql<gh_stars>10-100 /** earcut **/ DROP FUNCTION IF EXISTS plv8.earcut(geom JSONB); CREATE OR REPLACE FUNCTION plv8.earcut(geom JSONB) RETURNS JSONB immutable language plv8 as $$ var startT = new Date(); var data = earcut.flatten(geom.coordinates); var result = earcut(data.vertices); var endT = new Date(); //plv8.elog(NOTICE, 'CalcTime: ' + (endT - startT) / 1000); var triangles = []; for (i = 0; i < result.length; i++) { var index = result[i]; triangles.push([data.vertices[index * data.dimensions], data.vertices[index * data.dimensions + 1]]); } var returnval = { "type": "MultiPolygon", "coordinates": [] }; for (i = 0; triangles && i < triangles.length; i += 3) { let triangle = [triangles.slice(i, i + 3)]; triangle[0].push(triangle[0][0]); returnval.coordinates.push(triangle); } return returnval; $$; /* TEST: WITH poly AS ( SELECT ST_GeomFromText('POLYGON((-71.1031880899493 42.3152774590236, -71.1031627617667 42.3152960829043,-71.102923838298 42.3149156848307, -71.1023097974109 42.3151969047397,-71.1019285062273 42.3147384934248, -71.102505233663 42.3144722937587,-71.10277487471 42.3141658254797, -71.103113945163 42.3142739188902,-71.10324876416 42.31402489987, -71.1033002961013 42.3140393340215,-71.1033488797549 42.3139495090772, -71.103396240451 42.3138632439557,-71.1041521907712 42.3141153348029, -71.1041411411543 42.3141545014533,-71.1041287795912 42.3142114839058, -71.1041188134329 42.3142693656241,-71.1041112482575 42.3143272556118, -71.1041072845732 42.3143851580048,-71.1041057218871 42.3144430686681, -71.1041065602059 42.3145009876017,-71.1041097995362 42.3145589148055, -71.1041166403905 42.3146168544148,-71.1041258822717 42.3146748022936, -71.1041375307579 42.3147318674446,-71.1041492906949 42.3147711126569, -71.1041598612795 42.314808571739,-71.1042515013869 42.3151287620809, -71.1041173835118 42.3150739481917,-71.1040809891419 42.3151344119048, -71.1040438678912 42.3151191367447,-71.1040194562988 42.3151832057859, -71.1038734225584 42.3151140942995,-71.1038446938243 42.3151006300338, -71.1038315271889 42.315094347535,-71.1037393329282 42.315054824985, -71.1035447555574 42.3152608696313,-71.1033436658644 42.3151648370544, -71.1032580383161 42.3152269126061,-71.103223066939 42.3152517403219, -71.1031880899493 42.3152774590236))',4326) geom ) ,earcut AS ( --15 ms SELECT plv8.earcut(ST_AsGeoJson(geom)::JSONB) FROM poly ), tesselate AS ( --26 ms SELECT ST_Tesselate(geom) FROM poly ) SELECT count(*) from earcut; */
<reponame>ago1024/servergen<filename>src/main/resources/org/gotti/wurmunlimited/servergen/pack/db/insertwurmplayers.sql<gh_stars>0 BEGIN TRANSACTION; /* No players are created on install */ COMMIT;
<filename>oracle_script/recompile_invalids.sql set echo off set heading off set feedback off set pagesize 0 set linesize 120 set verify off spool ./recompile_script.sql select distinct 'ALTER '|| object_type || ' ' || object_name || ' compile;' from user_objects where object_type in ('FUNCTION','PROCEDURE','PACKAGE') and status <> 'VALID' / spool off; set echo on set feedback on spool hdb_recompiles.out @./recompile_script.sql spool off exit;
BEGIN TRY CREATE INDEX [IndexSubjectsHierarchy] ON [dbo].Subjects (hierarchy) END TRY BEGIN CATCH END CATCH
<reponame>azavea/pfb<gh_stars>1-10 ---------------------------------------- -- INPUTS -- location: neighborhood -- :nb_boundary_buffer psql var must be set before running this script, -- e.g. psql -v nb_boundary_buffer=11000 -f connected_census_blocks_recreation.sql ---------------------------------------- DROP TABLE IF EXISTS generated.neighborhood_connected_census_blocks_recreation; CREATE TABLE generated.neighborhood_connected_census_blocks_recreation ( id SERIAL PRIMARY KEY, source_blockid10 VARCHAR(15), target_path_id INT, low_stress BOOLEAN, low_stress_cost INT, high_stress BOOLEAN, high_stress_cost INT ); INSERT INTO generated.neighborhood_connected_census_blocks_recreation ( source_blockid10, target_school_id, low_stress, high_stress ) SELECT blocks.blockid10, paths.path_id, 'f'::BOOLEAN, 't'::BOOLEAN FROM neighborhood_census_blocks blocks, neighborhood_paths paths WHERE EXISTS ( SELECT 1 FROM neighborhood_zip_codes zips WHERE ST_Intersects(blocks.geom,zips.geom) AND zips.zip_code = '02138' ) AND blocks.geom <#> paths.geom < :nb_boundary_buffer AND EXISTS ( SELECT 1 FROM neighborhood_census_block_roads source_br, neighborhood_ways target_r, neighborhood_reachable_roads_high_stress hs WHERE blocks.blockid10 = source_br.blockid10 AND paths.path_id = target_r.path_id AND hs.base_road = source_br.road_id AND hs.target_road = target_r.road_id AND paths.path_length > 15840 --path at least 3 mi long AND paths.bbox_length > 10560 --extent of path at least 2 mi long ); -- block pair index CREATE INDEX idx_neighborhood_blockschoolpairs ON neighborhood_connected_census_blocks_recreation (source_blockid10,target_school_id); ANALYZE neighborhood_connected_census_blocks_recreation (source_blockid10,target_school_id); -- low stress UPDATE neighborhood_connected_census_blocks_recreation SET low_stress = 't'::BOOLEAN WHERE EXISTS ( SELECT 1 FROM neighborhood_census_block_roads source_br, neighborhood_school_roads target_sr, neighborhood_reachable_roads_low_stress ls WHERE source_blockid10 = source_br.blockid10 AND target_school_id = target_sr.school_id AND ls.base_road = source_br.road_id AND ls.target_road = target_sr.road_id ) AND ( SELECT MIN(total_cost) FROM neighborhood_census_block_roads source_br, neighborhood_school_roads target_sr, neighborhood_reachable_roads_low_stress ls WHERE source_blockid10 = source_br.blockid10 AND target_school_id = target_sr.school_id AND ls.base_road = source_br.road_id AND ls.target_road = target_sr.road_id )::FLOAT / COALESCE(( SELECT MIN(total_cost) + 1 FROM neighborhood_census_block_roads source_br, neighborhood_school_roads target_sr, neighborhood_reachable_roads_high_stress hs WHERE source_blockid10 = source_br.blockid10 AND target_school_id = target_sr.school_id AND hs.base_road = source_br.road_id AND hs.target_road = target_sr.road_id ), :nb_boundary_buffer) <= 1.3; -- stress index CREATE INDEX idx_neighborhood_blockschl_lstress ON neighborhood_connected_census_blocks_recreation (low_stress); CREATE INDEX idx_neighborhood_blockschl_hstress ON neighborhood_connected_census_blocks_recreation (high_stress); ANALYZE neighborhood_connected_census_blocks_recreation (low_stress,high_stress);
-- up:begin create table def ( id integer primary key not null ); insert into def values (4), (5), (6); -- up:end -- down:begin drop table def; -- down:end
WITH items AS (SELECT * FROM account_levelisations WHERE account_levelisations.levelisation_id = $id), active_items AS (SELECT * FROM items WHERE state = 'Success' AND is_accepted = TRUE) SELECT levelisations.id AS "id", (SELECT COUNT(items.id)::int FROM items) AS "totalCount", (SELECT SUM(active_items.export_payment) FROM active_items) AS "fitTotalExportPayment" FROM levelisations WHERE levelisations.id = $id
<reponame>PEMOHT/yii2_work -- phpMyAdmin SQL Dump -- version 4.7.3 -- https://www.phpmyadmin.net/ -- -- Хост: 127.0.0.1:3306 -- Время создания: Авг 23 2017 г., 21:08 -- Версия сервера: 5.6.37 -- Версия PHP: 5.6.31 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 */; -- -- База данных: `yii2_test` -- -- -------------------------------------------------------- -- -- Структура таблицы `work` -- CREATE TABLE `work` ( `id` int(64) NOT NULL, `title` varchar(255) NOT NULL, `author` varchar(256) NOT NULL, `date_creation` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `article` text NOT NULL, `image` varchar(1024) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Индексы сохранённых таблиц -- -- -- Индексы таблицы `work` -- ALTER TABLE `work` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `title` (`title`); -- -- AUTO_INCREMENT для сохранённых таблиц -- -- -- AUTO_INCREMENT для таблицы `work` -- ALTER TABLE `work` MODIFY `id` int(64) NOT NULL AUTO_INCREMENT;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 TABLE PART ( P_PARTKEY INT8, P_NAME VARCHAR(55), P_MFGR CHAR(25), P_BRAND CHAR(10), P_TYPE VARCHAR(25), P_SIZE INTEGER8, P_CONTAINER CHAR(10), P_RETAILPRICE FLOAT8, P_COMMENT VARCHAR(23) ); CREATE TABLE SUPPLIER ( S_SUPPKEY INT8, S_NAME CHAR(25), S_ADDRESS VARCHAR(40), S_NATIONKEY INTEGER8 NOT NULL, -- references N_NATIONKEY S_PHONE CHAR(15), S_ACCTBAL FLOAT8, S_COMMENT VARCHAR(101) ); CREATE TABLE PARTSUPP ( PS_PARTKEY INTEGER8 NOT NULL, -- references P_PARTKEY PS_SUPPKEY INTEGER8 NOT NULL, -- references S_SUPPKEY PS_AVAILQTY INTEGER8, PS_SUPPLYCOST FLOAT8, PS_COMMENT VARCHAR(199) ); CREATE TABLE CUSTOMER ( C_CUSTKEY INT8, C_NAME VARCHAR(25), C_ADDRESS VARCHAR(40), C_NATIONKEY INTEGER8 NOT NULL, -- references N_NATIONKEY C_PHONE CHAR(15), C_ACCTBAL FLOAT8, C_MKTSEGMENT CHAR(10), C_COMMENT VARCHAR(117) ); CREATE TABLE ORDERS ( O_ORDERKEY INT8, O_CUSTKEY INTEGER8 NOT NULL, -- references C_CUSTKEY O_ORDERSTATUS CHAR(1), O_TOTALPRICE FLOAT8, O_ORDERDATE DATE, O_ORDERPRIORITY CHAR(15), O_CLERK CHAR(15), O_SHIPPRIORITY INTEGER8, O_COMMENT VARCHAR(79) ); CREATE TABLE LINEITEM ( L_ORDERKEY INTEGER8 NOT NULL, -- references O_ORDERKEY L_PARTKEY INTEGER8 NOT NULL, -- references P_PARTKEY (compound fk to PARTSUPP) L_SUPPKEY INTEGER8 NOT NULL, -- references S_SUPPKEY (compound fk to PARTSUPP) L_LINENUMBER INTEGER8, L_QUANTITY FLOAT8, L_EXTENDEDPRICE FLOAT8, L_DISCOUNT FLOAT8, L_TAX FLOAT8, L_RETURNFLAG CHAR(1), L_LINESTATUS CHAR(1), L_SHIPDATE DATE, L_COMMITDATE DATE, L_RECEIPTDATE DATE, L_SHIPINSTRUCT CHAR(25), L_SHIPMODE CHAR(10), L_COMMENT VARCHAR(44) ); CREATE TABLE NATION ( N_NATIONKEY INT8, N_NAME CHAR(25), N_REGIONKEY INTEGER8 NOT NULL, -- references R_REGIONKEY N_COMMENT VARCHAR(152) ); CREATE TABLE REGION ( R_REGIONKEY INT8, R_NAME CHAR(25), R_COMMENT VARCHAR(152) );
<gh_stars>1-10 --Test vclass using object alteration CREATE CLASS that01; ALTER CLASS that01 ADD ATTRIBUTE njs1 character(10) NOT NULL, bu_that21 character(1) NOT NULL, nswaa_nthat character(2), qbwk_that character(1) NOT NULL, swat_n_that character(8), lie_that character(8), zwmu_h_that character(1), ahx character(1), ipbwk_that character varying(2) NOT NULL, izok_zthat character(1), izok_uthat character varying(2), nswaa_uthat character(1) NOT NULL, niensh_nthat character(2) NOT NULL, bu_that2 character(10) NOT NULL, opdwth_dt timestamp NOT NULL, opdwth_that character varying(20) NOT NULL, nswaa_mthat character varying(30), bwk_that character varying(50) NOT NULL, bbwk_that character varying(50), qv_mthat character varying(30) NOT NULL, hmu_bwk_that character varying(50), liuj_that character varying(3000), uewdh character varying(2), bqok_nthat character(2) NOT NULL, ehws_uthat character varying(2); create UNIQUE index that01_pk on that01(njs1, bu_that21); create INDEX that01_x2 ON that01(bu_that21,uewdh,nswaa_nthat,njs1); CREATE VCLASS test02; ALTER VCLASS test02 ADD ATTRIBUTE njs1 CHARACTER(10), bu_that2 CHARACTER(10), gy_gtest CHARACTER(2), gy_ctest CHARACTER(2), uewdh CHARACTER VARYING(2), hg_ctest CHARACTER(4), sjg_test CHARACTER VARYING(20), bjg_test CHARACTER VARYING(20), bjgg_test CHARACTER VARYING(20), nswaa_nthat CHARACTER(2), juya_ctest CHARACTER(1), nswaa_mthat CHARACTER VARYING(30), qbwk_that CHARACTER(1), bqok_nthat CHARACTER(2), swat_n_that CHARACTER(8), bwk_that CHARACTER VARYING(50), bbwk_that CHARACTER VARYING(50), qv_mthat CHARACTER VARYING(30), zwmu_h_that CHARACTER(1), lie_that CHARACTER(8), ahx CHARACTER(1), ipbwk_that CHARACTER VARYING(2), study_test CHARACTER VARYING(2), izok_zthat CHARACTER(1), izok_uthat CHARACTER VARYING(2), opdwth_dt TIMESTAMP, opdwth_that CHARACTER VARYING(20); ALTER VCLASS test02 ADD QUERY SELECT njs1, bu_that2, '06', '', ehws_uthat, '0685', '', '', '', nswaa_nthat, '1', nswaa_mthat, qbwk_that, bqok_nthat, swat_n_that, bwk_that, bbwk_that, qv_mthat, zwmu_h_that, lie_that, ahx, ipbwk_that, '', izok_zthat, izok_uthat, opdwth_dt, opdwth_that FROM that01 WHERE bu_that21 = '4'; INSERT INTO that01 (njs1,bu_that21,nswaa_nthat,qbwk_that,swat_n_that,lie_that,zwmu_h_that,AHX,ipbwk_that,izok_zthat,izok_uthat, nswaa_uthat,niensh_nthat,bu_that2,OPDWTH_DT,opdwth_that,nswaa_mthat,bwk_that,bbwk_that,qv_mthat,HMU_bwk_that,liuj_that,UEWDH,bqok_nthat, ehws_uthat ) values ( '2006000008','4','01','1','20060302','','1','2','99','Y','1','1','01','B100000680',timestamp'17:31:48 PM 05/01/2006','9910011000000','7z3mXnXSWW0Yos4dgUjBAQ==','LIWdtEPiEmuPv1kvFLELiA==','','XsyaWSD7ULboAFxJaTUzcQ==','',NULL,'1','01','1' ) ; INSERT INTO that01 (njs1,bu_that21,nswaa_nthat,qbwk_that,swat_n_that,lie_that,zwmu_h_that,AHX,ipbwk_that,izok_zthat,izok_uthat,nswaa_uthat,niensh_nthat,bu_that2,OPDWTH_DT,opdwth_that,nswaa_mthat,bwk_that,bbwk_that,qv_mthat,HMU_bwk_that,liuj_that,UEWDH,bqok_nthat,ehws_uthat ) values ('2006000006','4','01','1','20060302','19990202','1','2','99','Y','3','1','01','B100000680',timestamp'21:58:41 PM 05/01/2006','9910011000000','8gUVKgNJrYzfYNv3E3/6kg==','mNPIEAeOvtFXKEROyz8GBw==','','e8hc7dFyVP5NQyFhl460xg==','','','3','01','3' ) ; INSERT INTO that01 (njs1,bu_that21,nswaa_nthat,qbwk_that,swat_n_that,lie_that,zwmu_h_that,AHX,ipbwk_that,izok_zthat,izok_uthat,nswaa_uthat,niensh_nthat,bu_that2,OPDWTH_DT,opdwth_that,nswaa_mthat,bwk_that,bbwk_that,qv_mthat,HMU_bwk_that,liuj_that,UEWDH,bqok_nthat,ehws_uthat ) values ('2005000031','4','02','1','20050301','','1','1','99','N','7','1','01','B100000680',timestamp'18:47:57 PM 11/04/2005','9910011000000','yLGMSeeCxfKaHBgQk5Plag==','yjlCzwtJCZUOMOVhas09Zw==','','b7a4pTBbVOdeVL6h10xNgA==','',NULL,'7','01','3' ) ; INSERT INTO that01 (njs1,bu_that21,nswaa_nthat,qbwk_that,swat_n_that,lie_that,zwmu_h_that,AHX,ipbwk_that,izok_zthat,izok_uthat,nswaa_uthat,niensh_nthat,bu_that2,OPDWTH_DT,opdwth_that,nswaa_mthat,bwk_that,bbwk_that,qv_mthat,HMU_bwk_that,liuj_that,UEWDH,bqok_nthat,ehws_uthat ) values ('2005000032','4','02','1','20050301','','1','2','99','N','7','1','01','B100000680',timestamp'18:47:57 PM 11/04/2005','9910011000000','ys2vY5RcUR1480A23OybHg==','SGl7qUcwyBuK99sb+2A1Ww==','','kBEFmuBDunZ3wuLMEOnDKQ==','',NULL,'7','01','2' ) ; INSERT INTO that01 (njs1,bu_that21,nswaa_nthat,qbwk_that,swat_n_that,lie_that,zwmu_h_that,AHX,ipbwk_that,izok_zthat,izok_uthat,nswaa_uthat,niensh_nthat,bu_that2,OPDWTH_DT,opdwth_that,nswaa_mthat,bwk_that,bbwk_that,qv_mthat,HMU_bwk_that,liuj_that,UEWDH,bqok_nthat,ehws_uthat ) values ('2005000002','4','01','1','20050301','','1','1','99','N','1','1','01','B100000680',timestamp'19:41:40 PM 11/03/2005','9910011000000','8gUVKgNJrYzfYNv3E3/6kg==','xe2Q9J/XvJcf7UWGVvU6NA==','','b7a4pTBbVOdeVL6h10xNgA==','',NULL,'1','01','1' ) ; INSERT INTO that01 (njs1,bu_that21,nswaa_nthat,qbwk_that,swat_n_that,lie_that,zwmu_h_that,AHX,ipbwk_that,izok_zthat,izok_uthat,nswaa_uthat,niensh_nthat,bu_that2,OPDWTH_DT,opdwth_that,nswaa_mthat,bwk_that,bbwk_that,qv_mthat,HMU_bwk_that,liuj_that,UEWDH,bqok_nthat,ehws_uthat ) values ('2005000001','4','01','1','20050301','','1','2','99','N','1','1','01','B100000680',timestamp'19:41:40 PM 11/03/2005','9910011000000','xz6iE68b0ltnc5Pf/6cv0w==','0HoeFLA87LaKLncGHzjJpw==','','kBEFmuBDunZ3wuLMEOnDKQ==','',NULL,'1','01','1' ) ; INSERT INTO that01 (njs1,bu_that21,nswaa_nthat,qbwk_that,swat_n_that,lie_that,zwmu_h_that,AHX,ipbwk_that,izok_zthat,izok_uthat,nswaa_uthat,niensh_nthat,bu_that2,OPDWTH_DT,opdwth_that,nswaa_mthat,bwk_that,bbwk_that,qv_mthat,HMU_bwk_that,liuj_that,UEWDH,bqok_nthat,ehws_uthat ) values ('2005000003','4','01','1','20050301','','1','2','99','N','1','1','01','B100000680',timestamp'19:41:40 PM 11/03/2005','9910011000000','yLGMSeeCxfKaHBgQk5Plag==','DtKKWQ2UDM9ttCDkv3I38w==','','kBEFmuBDunZ3wuLMEOnDKQ==','',NULL,'1','01','1' ) ; INSERT INTO that01 (njs1,bu_that21,nswaa_nthat,qbwk_that,swat_n_that,lie_that,zwmu_h_that,AHX,ipbwk_that,izok_zthat,izok_uthat,nswaa_uthat,niensh_nthat,bu_that2,OPDWTH_DT,opdwth_that,nswaa_mthat,bwk_that,bbwk_that,qv_mthat,HMU_bwk_that,liuj_that,UEWDH,bqok_nthat,ehws_uthat ) values ('2005000004','4','01','1','20050301','','1','1','99','N','1','1','01','B100000680',timestamp'19:41:40 PM 11/03/2005','9910011000000','ys2vY5RcUR1480A23OybHg==','UCFbVJ3fUgScuEvLrwjxSA==','','wY86rx4b3MZA+gErJ1ubtA==','',NULL,'1','01','1' ) ; INSERT INTO that01 (njs1,bu_that21,nswaa_nthat,qbwk_that,swat_n_that,lie_that,zwmu_h_that,AHX,ipbwk_that,izok_zthat,izok_uthat,nswaa_uthat,niensh_nthat,bu_that2,OPDWTH_DT,opdwth_that,nswaa_mthat,bwk_that,bbwk_that,qv_mthat,HMU_bwk_that,liuj_that,UEWDH,bqok_nthat,ehws_uthat ) values ('2005000006','4','02','1','20050301','','1','1','99','N','1','1','01','B100000680',timestamp'19:42:58 PM 11/03/2005','9910011000000','8gUVKgNJrYzfYNv3E3/6kg==','mkM6WdI5pf2MBqCoAqSdzw==','','b7a4pTBbVOdeVL6h10xNgA==','',NULL,'1','01','1' ) ; INSERT INTO that01 (njs1,bu_that21,nswaa_nthat,qbwk_that,swat_n_that,lie_that,zwmu_h_that,AHX,ipbwk_that,izok_zthat,izok_uthat,nswaa_uthat,niensh_nthat,bu_that2,OPDWTH_DT,opdwth_that,nswaa_mthat,bwk_that,bbwk_that,qv_mthat,HMU_bwk_that,liuj_that,UEWDH,bqok_nthat,ehws_uthat ) values ('2005000005','4','02','1','20050301','','1','2','99','N','1','1','01','B100000680',timestamp'19:42:58 PM 11/03/2005','9910011000000','xz6iE68b0ltnc5Pf/6cv0w==','5Tb5vHiS1yLwM3XY/ZKA/w==','','kBEFmuBDunZ3wuLMEOnDKQ==','',NULL,'1','01','1' ) ; INSERT INTO that01 (njs1,bu_that21,nswaa_nthat,qbwk_that,swat_n_that,lie_that,zwmu_h_that,AHX,ipbwk_that,izok_zthat,izok_uthat,nswaa_uthat,niensh_nthat,bu_that2,OPDWTH_DT,opdwth_that,nswaa_mthat,bwk_that,bbwk_that,qv_mthat,HMU_bwk_that,liuj_that,UEWDH,bqok_nthat,ehws_uthat ) values ('2005000007','4','02','1','20050301','','1','2','99','N','1','1','01','B100000680',timestamp'19:42:58 PM 11/03/2005','9910011000000','yLGMSeeCxfKaHBgQk5Plag==','Bh8+bZdfJ1eZd2tAtI+CrQ==','','kBEFmuBDunZ3wuLMEOnDKQ==','',NULL,'1','01','1' ) ; INSERT INTO that01 (njs1,bu_that21,nswaa_nthat,qbwk_that,swat_n_that,lie_that,zwmu_h_that,AHX,ipbwk_that,izok_zthat,izok_uthat,nswaa_uthat,niensh_nthat,bu_that2,OPDWTH_DT,opdwth_that,nswaa_mthat,bwk_that,bbwk_that,qv_mthat,HMU_bwk_that,liuj_that,UEWDH,bqok_nthat,ehws_uthat ) values ('2005000008','4','02','1','20050301','','1','1','99','N','1','1','01','B100000680',timestamp'19:42:58 PM 11/03/2005','9910011000000','ys2vY5RcUR1480A23OybHg==','NwGHRThs5n2nTBqF7SW+yA==','','b7a4pTBbVOdeVL6h10xNgA==','',NULL,'1','01','1' ) ; INSERT INTO that01 (njs1,bu_that21,nswaa_nthat,qbwk_that,swat_n_that,lie_that,zwmu_h_that,AHX,ipbwk_that,izok_zthat,izok_uthat,nswaa_uthat,niensh_nthat,bu_that2,OPDWTH_DT,opdwth_that,nswaa_mthat,bwk_that,bbwk_that,qv_mthat,HMU_bwk_that,liuj_that,UEWDH,bqok_nthat,ehws_uthat ) values ('2005000009','4','01','1','20050301','','1','2','99','N','7','1','01','B100000680',timestamp'19:44:28 PM 11/03/2005','9910011000000','xz6iE68b0ltnc5Pf/6cv0w==','dSzMnTKRYMRzj3pcgCa8yA==','','kBEFmuBDunZ3wuLMEOnDKQ==','',NULL,'7','01','1' ) ; INSERT INTO that01 (njs1,bu_that21,nswaa_nthat,qbwk_that,swat_n_that,lie_that,zwmu_h_that,AHX,ipbwk_that,izok_zthat,izok_uthat,nswaa_uthat,niensh_nthat,bu_that2,OPDWTH_DT,opdwth_that,nswaa_mthat,bwk_that,bbwk_that,qv_mthat,HMU_bwk_that,liuj_that,UEWDH,bqok_nthat,ehws_uthat ) values ('2005000010','4','01','1','20040301','','1','1','99','N','7','1','01','B100000680',timestamp'19:44:28 PM 11/03/2005','9910011000000','8gUVKgNJrYzfYNv3E3/6kg==','haPl/fHbM+cyi39cvSraAg==','','wY86rx4b3MZA+gErJ1ubtA==','',NULL,'7','01','2' ) ; INSERT INTO that01 (njs1,bu_that21,nswaa_nthat,qbwk_that,swat_n_that,lie_that,zwmu_h_that,AHX,ipbwk_that,izok_zthat,izok_uthat,nswaa_uthat,niensh_nthat,bu_that2,OPDWTH_DT,opdwth_that,nswaa_mthat,bwk_that,bbwk_that,qv_mthat,HMU_bwk_that,liuj_that,UEWDH,bqok_nthat,ehws_uthat ) values ('2005000011','4','01','1','20030301','','1','2','99','N','7','1','01','B100000680',timestamp'19:44:28 PM 11/03/2005','9910011000000','yLGMSeeCxfKaHBgQk5Plag==','Lz7biWn9xcqxqgrVx4MfCw==','','kBEFmuBDunZ3wuLMEOnDKQ==','',NULL,'7','01','3' ) ; INSERT INTO that01 (njs1,bu_that21,nswaa_nthat,qbwk_that,swat_n_that,lie_that,zwmu_h_that,AHX,ipbwk_that,izok_zthat,izok_uthat,nswaa_uthat,niensh_nthat,bu_that2,OPDWTH_DT,opdwth_that,nswaa_mthat,bwk_that,bbwk_that,qv_mthat,HMU_bwk_that,liuj_that,UEWDH,bqok_nthat,ehws_uthat ) values ('2005000019','4','02','1','20040301','','1','1','99','N','2','1','01','B100000680',timestamp'19:07:20 PM 11/04/2005','9910011000000','ys2vY5RcUR1480A23OybHg==','jmk6xaSFIUmSdhROIyukMA==','','b7a4pTBbVOdeVL6h10xNgA==','',NULL,'2','01','2' ) ; INSERT INTO that01 (njs1,bu_that21,nswaa_nthat,qbwk_that,swat_n_that,lie_that,zwmu_h_that,AHX,ipbwk_that,izok_zthat,izok_uthat,nswaa_uthat,niensh_nthat,bu_that2,OPDWTH_DT,opdwth_that,nswaa_mthat,bwk_that,bbwk_that,qv_mthat,HMU_bwk_that,liuj_that,UEWDH,bqok_nthat,ehws_uthat ) values ('2005000022','4','01','2','20060215','','1','1','99','N','3','1','01','B100000680',timestamp'10:27:13 AM 02/09/2006','066501','8gUVKgNJrYzfYNv3E3/6kg==','uAVzbB2F/PwAxYcfsJ91/g==','','b7a4pTBbVOdeVL6h10xNgA==','',NULL,'3','18','3' ) ; INSERT INTO that01 (njs1,bu_that21,nswaa_nthat,qbwk_that,swat_n_that,lie_that,zwmu_h_that,AHX,ipbwk_that,izok_zthat,izok_uthat,nswaa_uthat,niensh_nthat,bu_that2,OPDWTH_DT,opdwth_that,nswaa_mthat,bwk_that,bbwk_that,qv_mthat,HMU_bwk_that,liuj_that,UEWDH,bqok_nthat,ehws_uthat ) values ('2005000021','4','01','2','20060215','','1','2','99','N','3','1','01','B100000680',timestamp'10:27:13 AM 02/09/2006','066501','xz6iE68b0ltnc5Pf/6cv0w==','0Nizmmju+yDCugr4EnIiTg==','','kBEFmuBDunZ3wuLMEOnDKQ==','',NULL,'3','18','3' ) ; INSERT INTO that01 (njs1,bu_that21,nswaa_nthat,qbwk_that,swat_n_that,lie_that,zwmu_h_that,AHX,ipbwk_that,izok_zthat,izok_uthat,nswaa_uthat,niensh_nthat,bu_that2,OPDWTH_DT,opdwth_that,nswaa_mthat,bwk_that,bbwk_that,qv_mthat,HMU_bwk_that,liuj_that,UEWDH,bqok_nthat,ehws_uthat ) values ('2005000023','4','01','2','20060215','','1','1','99','N','3','1','01','B100000680',timestamp'10:27:13 AM 02/09/2006','066501','yLGMSeeCxfKaHBgQk5Plag==','Xu41mKUUc9Y0K2jDhUWFtw==','','b7a4pTBbVOdeVL6h10xNgA==','',NULL,'3','18','3' ) ; INSERT INTO that01 (njs1,bu_that21,nswaa_nthat,qbwk_that,swat_n_that,lie_that,zwmu_h_that,AHX,ipbwk_that,izok_zthat,izok_uthat,nswaa_uthat,niensh_nthat,bu_that2,OPDWTH_DT,opdwth_that,nswaa_mthat,bwk_that,bbwk_that,qv_mthat,HMU_bwk_that,liuj_that,UEWDH,bqok_nthat,ehws_uthat ) values ('2005000024','4','01','2','20060215','','1','2','99','N','3','1','01','B100000680',timestamp'10:27:13 AM 02/09/2006','066501','ys2vY5RcUR1480A23OybHg==','MHZGHM/xIuftauRv7BobfA==','','kBEFmuBDunZ3wuLMEOnDKQ==','',NULL,'3','18','3' ) ; INSERT INTO that01 (njs1,bu_that21,nswaa_nthat,qbwk_that,swat_n_that,lie_that,zwmu_h_that,AHX,ipbwk_that,izok_zthat,izok_uthat,nswaa_uthat,niensh_nthat,bu_that2,OPDWTH_DT,opdwth_that,nswaa_mthat,bwk_that,bbwk_that,qv_mthat,HMU_bwk_that,liuj_that,UEWDH,bqok_nthat,ehws_uthat ) values ('2005000026','4','02','2','20060215','','1','1','99','N','3','1','01','B100000680',timestamp'10:27:13 AM 02/09/2006','066501','8gUVKgNJrYzfYNv3E3/6kg==','3bcdZ0QU4OoIgxM/neB09g==','','b7a4pTBbVOdeVL6h10xNgA==','',NULL,'3','18','3' ) ; INSERT INTO that01 (njs1,bu_that21,nswaa_nthat,qbwk_that,swat_n_that,lie_that,zwmu_h_that,AHX,ipbwk_that,izok_zthat,izok_uthat,nswaa_uthat,niensh_nthat,bu_that2,OPDWTH_DT,opdwth_that,nswaa_mthat,bwk_that,bbwk_that,qv_mthat,HMU_bwk_that,liuj_that,UEWDH,bqok_nthat,ehws_uthat ) values ('2005000025','4','02','2','20060215','','1','1','99','N','3','1','01','B100000680',timestamp'10:27:13 AM 02/09/2006','066501','xz6iE68b0ltnc5Pf/6cv0w==','0Nizmmju+yDCugr4EnIiTg==','','b7a4pTBbVOdeVL6h10xNgA==','',NULL,'3','18','3' ) ; INSERT INTO that01 (njs1,bu_that21,nswaa_nthat,qbwk_that,swat_n_that,lie_that,zwmu_h_that,AHX,ipbwk_that,izok_zthat,izok_uthat,nswaa_uthat,niensh_nthat,bu_that2,OPDWTH_DT,opdwth_that,nswaa_mthat,bwk_that,bbwk_that,qv_mthat,HMU_bwk_that,liuj_that,UEWDH,bqok_nthat,ehws_uthat ) values ('2005000027','4','02','2','20060215','','1','1','99','N','3','1','01','B100000680',timestamp'10:27:13 AM 02/09/2006','066501','yLGMSeeCxfKaHBgQk5Plag==','gh8TK9N7jJzERpg6o+JYcQ==','','b7a4pTBbVOdeVL6h10xNgA==','',NULL,'3','18','3' ) ; INSERT INTO that01 (njs1,bu_that21,nswaa_nthat,qbwk_that,swat_n_that,lie_that,zwmu_h_that,AHX,ipbwk_that,izok_zthat,izok_uthat,nswaa_uthat,niensh_nthat,bu_that2,OPDWTH_DT,opdwth_that,nswaa_mthat,bwk_that,bbwk_that,qv_mthat,HMU_bwk_that,liuj_that,UEWDH,bqok_nthat,ehws_uthat ) values ('2005000028','4','02','2','20060215','','1','2','99','N','3','1','01','B100000680',timestamp'10:27:13 AM 02/09/2006','066501','ys2vY5RcUR1480A23OybHg==','5DXMTmspuTvkCKNCg9UbDA==','','kBEFmuBDunZ3wuLMEOnDKQ==','',NULL,'3','18','3' ) ; INSERT INTO that01 (njs1,bu_that21,nswaa_nthat,qbwk_that,swat_n_that,lie_that,zwmu_h_that,AHX,ipbwk_that,izok_zthat,izok_uthat,nswaa_uthat,niensh_nthat,bu_that2,OPDWTH_DT,opdwth_that,nswaa_mthat,bwk_that,bbwk_that,qv_mthat,HMU_bwk_that,liuj_that,UEWDH,bqok_nthat,ehws_uthat ) values ('2005000029','4','02','1','20050301','','1','2','99','N','7','1','01','B100000680',timestamp'18:47:57 PM 11/04/2005','9910011000000','xz6iE68b0ltnc5Pf/6cv0w==','L6BJwNzXbay1vFE8VPfU5A==','','kBEFmuBDunZ3wuLMEOnDKQ==','',NULL,'7','01','1' ) ; INSERT INTO that01 (njs1,bu_that21,nswaa_nthat,qbwk_that,swat_n_that,lie_that,zwmu_h_that,AHX,ipbwk_that,izok_zthat,izok_uthat,nswaa_uthat,niensh_nthat,bu_that2,OPDWTH_DT,opdwth_that,nswaa_mthat,bwk_that,bbwk_that,qv_mthat,HMU_bwk_that,liuj_that,UEWDH,bqok_nthat,ehws_uthat ) values ('2005000030','4','02','1','20050301','','1','1','99','N','7','1','01','B100000680',timestamp'18:47:57 PM 11/04/2005','9910011000000','8gUVKgNJrYzfYNv3E3/6kg==','lW5rgfyDR3m0AA21pPfkPg==','','b7a4pTBbVOdeVL6h10xNgA==','',NULL,'7','01','1' ) ; INSERT INTO that01 (njs1,bu_that21,nswaa_nthat,qbwk_that,swat_n_that,lie_that,zwmu_h_that,AHX,ipbwk_that,izok_zthat,izok_uthat,nswaa_uthat,niensh_nthat,bu_that2,OPDWTH_DT,opdwth_that,nswaa_mthat,bwk_that,bbwk_that,qv_mthat,HMU_bwk_that,liuj_that,UEWDH,bqok_nthat,ehws_uthat ) values ('2005000012','4','01','1','20040301','','1','1','99','N','2','1','01','B100000680',timestamp'19:05:46 PM 11/04/2005','9910011000000','8gUVKgNJrYzfYNv3E3/6kg==','KMTxWan/O81uWrOUMTMZ/A==','','b7a4pTBbVOdeVL6h10xNgA==','',NULL,'2','01','2' ) ; INSERT INTO that01 (njs1,bu_that21,nswaa_nthat,qbwk_that,swat_n_that,lie_that,zwmu_h_that,AHX,ipbwk_that,izok_zthat,izok_uthat,nswaa_uthat,niensh_nthat,bu_that2,OPDWTH_DT,opdwth_that,nswaa_mthat,bwk_that,bbwk_that,qv_mthat,HMU_bwk_that,liuj_that,UEWDH,bqok_nthat,ehws_uthat ) values ('2005000013','4','01','1','20040301','','1','2','99','N','2','1','01','B100000680',timestamp'19:06:00 PM 11/04/2005','9910011000000','yLGMSeeCxfKaHBgQk5Plag==','P4zDcX6uIUDOkn7XeAYcew==','','kBEFmuBDunZ3wuLMEOnDKQ==','',NULL,'2','01','2' ) ; INSERT INTO that01 (njs1,bu_that21,nswaa_nthat,qbwk_that,swat_n_that,lie_that,zwmu_h_that,AHX,ipbwk_that,izok_zthat,izok_uthat,nswaa_uthat,niensh_nthat,bu_that2,OPDWTH_DT,opdwth_that,nswaa_mthat,bwk_that,bbwk_that,qv_mthat,HMU_bwk_that,liuj_that,UEWDH,bqok_nthat,ehws_uthat ) values ('2005000015','4','01','1','20040301','','1','2','99','N','2','1','01','B100000680',timestamp'19:06:13 PM 11/04/2005','9910011000000','ys2vY5RcUR1480A23OybHg==','cy1c8D1S2RlvyEz71UBy/w==','','kBEFmuBDunZ3wuLMEOnDKQ==','',NULL,'2','01','2' ) ; INSERT INTO that01 (njs1,bu_that21,nswaa_nthat,qbwk_that,swat_n_that,lie_that,zwmu_h_that,AHX,ipbwk_that,izok_zthat,izok_uthat,nswaa_uthat,niensh_nthat,bu_that2,OPDWTH_DT,opdwth_that,nswaa_mthat,bwk_that,bbwk_that,qv_mthat,HMU_bwk_that,liuj_that,UEWDH,bqok_nthat,ehws_uthat ) values ('2005000016','4','01','1','20040301','','1','2','99','N','2','1','01','B100000680',timestamp'19:05:32 PM 11/04/2005','9910011000000','xz6iE68b0ltnc5Pf/6cv0w==','VjU1gcq1pFv0hoyZZAE3uQ==','','kBEFmuBDunZ3wuLMEOnDKQ==','',NULL,'2','01','2' ) ; INSERT INTO that01 (njs1,bu_that21,nswaa_nthat,qbwk_that,swat_n_that,lie_that,zwmu_h_that,AHX,ipbwk_that,izok_zthat,izok_uthat,nswaa_uthat,niensh_nthat,bu_that2,OPDWTH_DT,opdwth_that,nswaa_mthat,bwk_that,bbwk_that,qv_mthat,HMU_bwk_that,liuj_that,UEWDH,bqok_nthat,ehws_uthat ) values ('2005000018','4','02','1','20040301','','1','1','99','N','2','1','01','B100000680',timestamp'19:06:45 PM 11/04/2005','9910011000000','8gUVKgNJrYzfYNv3E3/6kg==','XJPOlbvunEtAIyrUz47bGA==','','b7a4pTBbVOdeVL6h10xNgA==','',NULL,'2','01','2' ) ; INSERT INTO that01 (njs1,bu_that21,nswaa_nthat,qbwk_that,swat_n_that,lie_that,zwmu_h_that,AHX,ipbwk_that,izok_zthat,izok_uthat,nswaa_uthat,niensh_nthat,bu_that2,OPDWTH_DT,opdwth_that,nswaa_mthat,bwk_that,bbwk_that,qv_mthat,HMU_bwk_that,liuj_that,UEWDH,bqok_nthat,ehws_uthat ) values ('2005000017','4','02','1','20040301','','1','2','99','N','2','1','01','B100000680',timestamp'19:06:32 PM 11/04/2005','9910011000000','xz6iE68b0ltnc5Pf/6cv0w==','PwGsb8iumB4zfjqhivsf/Q==','','kBEFmuBDunZ3wuLMEOnDKQ==','',NULL,'2','01','2' ) ; INSERT INTO that01 (njs1,bu_that21,nswaa_nthat,qbwk_that,swat_n_that,lie_that,zwmu_h_that,AHX,ipbwk_that,izok_zthat,izok_uthat,nswaa_uthat,niensh_nthat,bu_that2,OPDWTH_DT,opdwth_that,nswaa_mthat,bwk_that,bbwk_that,qv_mthat,HMU_bwk_that,liuj_that,UEWDH,bqok_nthat,ehws_uthat ) values ('2005000020','4','02','1','20040301','','1','1','99','N','2','1','01','B100000680',timestamp'19:06:56 PM 11/04/2005','9910011000000','yLGMSeeCxfKaHBgQk5Plag==','VKG2LCu0SAhEluISKgT0kg==','','b7a4pTBbVOdeVL6h10xNgA==','',NULL,'2','01','2' ) ; INSERT INTO that01 (njs1,bu_that21,nswaa_nthat,qbwk_that,swat_n_that,lie_that,zwmu_h_that,AHX,ipbwk_that,izok_zthat,izok_uthat,nswaa_uthat,niensh_nthat,bu_that2,OPDWTH_DT,opdwth_that,nswaa_mthat,bwk_that,bbwk_that,qv_mthat,HMU_bwk_that,liuj_that,UEWDH,bqok_nthat,ehws_uthat ) values ('2006000003','4','01','1','20060302','','1','1','99','Y','1','1','01','B100000680',timestamp'17:31:48 PM 05/01/2006','9910011000000','yLGMSeeCxfKaHBgQk5Plag==','SEAApaq33HLBvqakBRV0YA==','','Z/iT5L5rSInbiZeN0T3DYQ==','',NULL,'1','01','1' ) ; INSERT INTO that01 (njs1,bu_that21,nswaa_nthat,qbwk_that,swat_n_that,lie_that,zwmu_h_that,AHX,ipbwk_that,izok_zthat,izok_uthat,nswaa_uthat,niensh_nthat,bu_that2,OPDWTH_DT,opdwth_that,nswaa_mthat,bwk_that,bbwk_that,qv_mthat,HMU_bwk_that,liuj_that,UEWDH,bqok_nthat,ehws_uthat ) values ('2006000004','4','01','1','20060302','','1','2','99','Y','1','1','01','B100000680',timestamp'17:31:48 PM 05/01/2006','9910011000000','ys2vY5RcUR1480A23OybHg==','gTms/MoOcTynaVBQrCgZjQ==','','5cFDJzVxys9t+EF6Rho34Q==','',NULL,'1','01','1' ) ; INSERT INTO that01 (njs1,bu_that21,nswaa_nthat,qbwk_that,swat_n_that,lie_that,zwmu_h_that,AHX,ipbwk_that,izok_zthat,izok_uthat,nswaa_uthat,niensh_nthat,bu_that2,OPDWTH_DT,opdwth_that,nswaa_mthat,bwk_that,bbwk_that,qv_mthat,HMU_bwk_that,liuj_that,UEWDH,bqok_nthat,ehws_uthat ) values ('2006000005','4','01','1','20060302','','1','1','99','Y','1','1','01','B100000680',timestamp'17:31:48 PM 05/01/2006','9910011000000','LHfobt2W8+0jJVL/mBACTw==','DGviZZPfrJra1w0hR1y+xg==','','8/MAJApMyIO6YjjNN8Gokg==','',NULL,'1','01','1' ) ; INSERT INTO that01 (njs1,bu_that21,nswaa_nthat,qbwk_that,swat_n_that,lie_that,zwmu_h_that,AHX,ipbwk_that,izok_zthat,izok_uthat,nswaa_uthat,niensh_nthat,bu_that2,OPDWTH_DT,opdwth_that,nswaa_mthat,bwk_that,bbwk_that,qv_mthat,HMU_bwk_that,liuj_that,UEWDH,bqok_nthat,ehws_uthat ) values ('2006000007','4','01','1','20060302','','1','1','99','Y','1','1','01','B100000680',timestamp'17:31:48 PM 05/01/2006','9910011000000','PYHaamHCC8h5b9fUmCFMww==','hVLSb3aUsTmTxSkxBvQx7w==','','3GwQGY6COBBBCHmz7NFFZw==','',NULL,'1','01','1' ) ; INSERT INTO that01 (njs1,bu_that21,nswaa_nthat,qbwk_that,swat_n_that,lie_that,zwmu_h_that,AHX,ipbwk_that,izok_zthat,izok_uthat,nswaa_uthat,niensh_nthat,bu_that2,OPDWTH_DT,opdwth_that,nswaa_mthat,bwk_that,bbwk_that,qv_mthat,HMU_bwk_that,liuj_that,UEWDH,bqok_nthat,ehws_uthat ) values ('2005000033','4','01','1','20060317','','1','1','99','Y','3','1','01','B100000680',timestamp'10:27:13 AM 02/09/2006','066501','h9FHBQHeundsMI1/Asaq1A==','333sBznHXQyBQnOW1B6Axw==','','nE9gxR8QXKeHFDSknNKObw==','',NULL,'1','06','3' ) ; INSERT INTO that01 (njs1,bu_that21,nswaa_nthat,qbwk_that,swat_n_that,lie_that,zwmu_h_that,AHX,ipbwk_that,izok_zthat,izok_uthat,nswaa_uthat,niensh_nthat,bu_that2,OPDWTH_DT,opdwth_that,nswaa_mthat,bwk_that,bbwk_that,qv_mthat,HMU_bwk_that,liuj_that,UEWDH,bqok_nthat,ehws_uthat ) values ('2006000002','4','01','1','20030304','19990101',NULL,'2','01','N',NULL,'1','01','B100000680',timestamp'17:12:40 PM 05/01/2006','9910011000000','8gUVKgNJrYzfYNv3E3/6kg==','PkoJJYX2ZKwvLH7EvXQsMg==','','mCWlO6g02DSOISH2tLLyoQ==',NULL,'','1','01','1' ) ; INSERT INTO that01 (njs1,bu_that21,nswaa_nthat,qbwk_that,swat_n_that,lie_that,zwmu_h_that,AHX,ipbwk_that,izok_zthat,izok_uthat,nswaa_uthat,niensh_nthat,bu_that2,OPDWTH_DT,opdwth_that,nswaa_mthat,bwk_that,bbwk_that,qv_mthat,HMU_bwk_that,liuj_that,UEWDH,bqok_nthat,ehws_uthat ) values ('2006000009','4','01','1','20060321','','1','2','99','Y','1','1','01','B100000680',timestamp'17:31:48 PM 05/01/2006','9910011000000','pqRPXAgcw3EDZYU2gC1J9A==','l7gxTGqlRhQpkF0t/H8JZg==','','kBEFmuBDunZ3wuLMEOnDKQ==','',NULL,'1','04','1' ) ; INSERT INTO that01 (njs1,bu_that21,nswaa_nthat,qbwk_that,swat_n_that,lie_that,zwmu_h_that,AHX,ipbwk_that,izok_zthat,izok_uthat,nswaa_uthat,niensh_nthat,bu_that2,OPDWTH_DT,opdwth_that,nswaa_mthat,bwk_that,bbwk_that,qv_mthat,HMU_bwk_that,liuj_that,UEWDH,bqok_nthat,ehws_uthat ) values ('2006000010','4','01','1','20060320','19990202','1','2','99','Y','3','1','01','B100000680',timestamp'21:58:23 PM 05/01/2006','9910011000000','xz6iE68b0ltnc5Pf/6cv0w==','we19iUioyIsFZOTqEh7WGA==','','WzEn4wlP1X3bF2P2K4859w==','','','3','01','3' ) ; INSERT INTO that01 (njs1,bu_that21,nswaa_nthat,qbwk_that,swat_n_that,lie_that,zwmu_h_that,AHX,ipbwk_that,izok_zthat,izok_uthat,nswaa_uthat,niensh_nthat,bu_that2,OPDWTH_DT,opdwth_that,nswaa_mthat,bwk_that,bbwk_that,qv_mthat,HMU_bwk_that,liuj_that,UEWDH,bqok_nthat,ehws_uthat ) values ('2006000013','4','01','1','20060303','','1','2','99','Y','2','1','01','B100000680',timestamp'17:31:48 PM 05/01/2006','9910011000000','xz6iE68b0ltnc5Pf/6cv0w==','NzVGf+D+ecOU6bx4jQzVRQ==','','7mNwxtHUCEw6jvZsZbrdzA==','',NULL,'2','01','2' ) ; INSERT INTO that01 (njs1,bu_that21,nswaa_nthat,qbwk_that,swat_n_that,lie_that,zwmu_h_that,AHX,ipbwk_that,izok_zthat,izok_uthat,nswaa_uthat,niensh_nthat,bu_that2,OPDWTH_DT,opdwth_that,nswaa_mthat,bwk_that,bbwk_that,qv_mthat,HMU_bwk_that,liuj_that,UEWDH,bqok_nthat,ehws_uthat ) values ('2006000001','4','01','1','20060302','','1','1','99','Y','1','1','01','B100000680',timestamp'17:31:48 PM 05/01/2006','9910011000000','xz6iE68b0ltnc5Pf/6cv0w==','333sBznHXQyBQnOW1B6Axw==','','nE9gxR8QXKeHFDSknNKObw==','',NULL,'1','01','1' ) ; SELECT * FROM ( SELECT a.juya_ctest, a.hg_ctest FROM test02 a WHERE A.bu_that2 = 'B100000680' AND A.UEWDH = '3' AND A.qbwk_that = '1' )LEVEL1; SELECT * FROM ( SELECT trim(a.juya_ctest) juya_ctest, trim(a.hg_ctest) hg_ctest FROM test02 a WHERE A.bu_that2 = 'B100000680' AND A.UEWDH = '3' AND A.qbwk_that = '1' )LEVEL1; SELECT a.juya_ctest, a.hg_ctest FROM test02 a WHERE A.bu_that2 = 'B100000680' AND A.UEWDH = '3' AND A.qbwk_that = '1'; drop table that01; drop view test02;
-- @testpoint: 给表中插入数据,再创建视图 -- @modified at: 2020-11-18 --建表 drop table if exists table_view_002 cascade ; create table table_view_002( c_id int, c_integer integer, c_real real,c_float float, c_double integer, c_decimal decimal(38), c_number number(38),c_number1 number,c_number2 number(20,10),c_numeric numeric(38), c_char char(50) default null, c_varchar varchar(20), c_varchar2 varchar2(4000), c_clob clob, c_raw raw(20),c_blob blob, c_timestamp timestamp ); --插入数据 insert into table_view_002 values(1,0,3.14,1.0002,3.55555,5,7887.656,0,0.111111,3.1415926,'dghg','jjj','pokj99','ywgdghghhgghe','deadbeef','010101101',to_timestamp('2019-01-03 14:58:54.000000','yyyy-mm-dd hh24:mi:ss.ffffff')); insert into table_view_002 values(10,0,3.14,1.0002,3.55555,5,78847.656,0,0.111111,3.1415926,'dtgfghg','jjj','pok测试j99','ywgdghghhgghe','deadbeef','010101101',to_timestamp('2019-01-03 14:58:54.000000','yyyy-mm-dd hh24:mi:ss.ffffff')); --查询 select count(*)from table_view_002; --创建视图 create or replace view temp_view_002 as select c_id,c_double,c_varchar from table_view_002; --查看视图 select count(*) from temp_view_002; --删除视图 drop view temp_view_002; --删表 drop table table_view_002;
-- test parallel select r_memory_parallel(20); select r_memory_parallel(20); select r_memory_parallel(20); select r_memory_parallel(20); select r_memory_parallel(20); -- test on QE select count(r_memory_parallel(num)) from NUM_OF_LOOPS_R;
select C.customer_name from Customer C,Borrower B,Loan L,Branch BB where C.customer_name = B.customer_name and B.loan_number = L.loan_number and L.branch_name = BB.branch_name and BB.branch_city = C.customer_city;
-- Gemeindegrenzen INSERT INTO live.dm01vch24lv95dgemeindegrenzen_gemnachfuehrung SELECT * FROM stage.dm01vch24lv95dgemeindegrenzen_gemnachfuehrung; INSERT INTO live.dm01vch24lv95dgemeindegrenzen_gemeinde SELECT * FROM stage.dm01vch24lv95dgemeindegrenzen_gemeinde; INSERT INTO live.dm01vch24lv95dgemeindegrenzen_gemeindegrenze SELECT * FROM stage.dm01vch24lv95dgemeindegrenzen_gemeindegrenze; -- Liegenschaften INSERT INTO live.dm01vch24lv95dliegenschaften_lsnachfuehrung SELECT * FROM stage.dm01vch24lv95dliegenschaften_lsnachfuehrung; INSERT INTO live.dm01vch24lv95dliegenschaften_grundstueck SELECT * FROM stage.dm01vch24lv95dliegenschaften_grundstueck; INSERT INTO live.dm01vch24lv95dliegenschaften_liegenschaft SELECT * FROM stage.dm01vch24lv95dliegenschaften_liegenschaft; INSERT INTO live.dm01vch24lv95dliegenschaften_selbstrecht SELECT * FROM stage.dm01vch24lv95dliegenschaften_selbstrecht; INSERT INTO live.dm01vch24lv95dliegenschaften_bergwerk SELECT * FROM stage.dm01vch24lv95dliegenschaften_bergwerk; -- Gebäudeadressen INSERT INTO live.dm01vch24lv95dgebaeudeadressen_gebnachfuehrung SELECT * FROM stage.dm01vch24lv95dgebaeudeadressen_gebnachfuehrung; INSERT INTO live.dm01vch24lv95dgebaeudeadressen_lokalisation SELECT * FROM stage.dm01vch24lv95dgebaeudeadressen_lokalisation; INSERT INTO live.dm01vch24lv95dgebaeudeadressen_lokalisationsname SELECT * FROM stage.dm01vch24lv95dgebaeudeadressen_lokalisationsname; INSERT INTO live.dm01vch24lv95dgebaeudeadressen_gebaeudeeingang SELECT * FROM stage.dm01vch24lv95dgebaeudeadressen_gebaeudeeingang; -- Bodenbedeckung INSERT INTO live.dm01vch24lv95dbodenbedeckung_bbnachfuehrung SELECT * FROM stage.dm01vch24lv95dbodenbedeckung_bbnachfuehrung; INSERT INTO live.dm01vch24lv95dbodenbedeckung_gebaeudenummer SELECT * FROM stage.dm01vch24lv95dbodenbedeckung_gebaeudenummer; INSERT INTO live.dm01vch24lv95dbodenbedeckung_projgebaeudenummer SELECT * FROM stage.dm01vch24lv95dbodenbedeckung_projgebaeudenummer; INSERT INTO live.dm01vch24lv95dbodenbedeckung_boflaeche SELECT * FROM stage.dm01vch24lv95dbodenbedeckung_boflaeche; INSERT INTO live.dm01vch24lv95dbodenbedeckung_projboflaeche SELECT * FROM stage.dm01vch24lv95dbodenbedeckung_projboflaeche; -- Einzelobjekte INSERT INTO live.dm01vch24lv95deinzelobjekte_eonachfuehrung SELECT * FROM stage.dm01vch24lv95deinzelobjekte_eonachfuehrung; INSERT INTO live.dm01vch24lv95deinzelobjekte_einzelobjekt SELECT * FROM stage.dm01vch24lv95deinzelobjekte_einzelobjekt; INSERT INTO live.dm01vch24lv95deinzelobjekte_flaechenelement SELECT * FROM stage.dm01vch24lv95deinzelobjekte_flaechenelement; INSERT INTO live.dm01vch24lv95deinzelobjekte_objektnummer SELECT * FROM stage.dm01vch24lv95deinzelobjekte_objektnummer; -- Nomenklatur INSERT INTO live.dm01vch24lv95dnomenklatur_nknachfuehrung SELECT * FROM stage.dm01vch24lv95dnomenklatur_nknachfuehrung; INSERT INTO live.dm01vch24lv95dnomenklatur_flurname SELECT * FROM stage.dm01vch24lv95dnomenklatur_flurname;
CREATE DATABASE db_topicos_especiais_de_informatica ENCODING 'UTF8' TEMPLATE template0;
<gh_stars>0 CREATE DATABASE IF NOT EXISTS `ambeyo_neet` /*!40100 DEFAULT CHARACTER SET utf8 */; USE `ambeyo_neet`; -- MySQL dump 10.13 Distrib 5.7.17, for Win64 (x86_64) -- -- Host: localhost Database: ambeyo_neet -- ------------------------------------------------------ -- Server version 5.7.20-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 `migrations` -- DROP TABLE IF EXISTS `migrations`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `migrations` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `migration` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `batch` int(11) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `migrations` -- LOCK TABLES `migrations` WRITE; /*!40000 ALTER TABLE `migrations` DISABLE KEYS */; INSERT INTO `migrations` VALUES (1,'2014_10_12_000000_create_users_table',1),(2,'2014_10_12_100000_create_password_resets_table',1); /*!40000 ALTER TABLE `migrations` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `password_resets` -- DROP TABLE IF EXISTS `password_resets`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; 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, KEY `password_resets_email_index` (`email`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `password_resets` -- LOCK TABLES `password_resets` WRITE; /*!40000 ALTER TABLE `password_resets` DISABLE KEYS */; INSERT INTO `password_resets` VALUES ('<EMAIL>','$2y$10$s/722POkVSMaBaZCwLnao.QPn1S16A4qcLATxK.u8DjC.TUYw/ZIW','2018-03-11 04:55:27'); /*!40000 ALTER TABLE `password_resets` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `tbl_answer` -- DROP TABLE IF EXISTS `tbl_answer`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `tbl_answer` ( `Id` int(11) NOT NULL AUTO_INCREMENT, `question_id` int(11) DEFAULT NULL, `choices` varchar(10) DEFAULT NULL, `answer` text, `right_answer` varchar(10) DEFAULT '0', `status` tinyint(4) DEFAULT '0', `updated_at` datetime DEFAULT NULL, `created_at` datetime DEFAULT NULL, PRIMARY KEY (`Id`) ) ENGINE=InnoDB AUTO_INCREMENT=86 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `tbl_answer` -- LOCK TABLES `tbl_answer` WRITE; /*!40000 ALTER TABLE `tbl_answer` DISABLE KEYS */; INSERT INTO `tbl_answer` VALUES (72,NULL,NULL,'When $a \\ne 0$, there are two solutions to \\(ax^2 + bx + c = 0\\) and they are\n$$x = {-b \\pm \\sqrt{b^2-4ac} \\over 2a}.$$','0',0,'2018-04-13 12:16:04','2018-04-13 12:16:04'),(73,NULL,NULL,'sasd sad sad asd asd asd asd asd asd sad asd asd asd asd asd sa d','0',0,'2018-04-13 12:16:48','2018-04-13 12:16:48'),(74,NULL,NULL,'sad','0',0,'2018-04-13 12:19:17','2018-04-13 12:19:17'),(75,NULL,NULL,'sad','0',0,'2018-04-13 12:19:17','2018-04-13 12:19:17'),(76,NULL,NULL,'sadas','0',0,'2018-04-13 12:19:17','2018-04-13 12:19:17'),(77,NULL,NULL,'sadas','0',0,'2018-04-13 12:19:18','2018-04-13 12:19:18'),(78,NULL,NULL,'sadas','0',0,'2018-04-13 12:19:18','2018-04-13 12:19:18'),(79,NULL,NULL,'sada','0',0,'2018-04-13 12:19:18','2018-04-13 12:19:18'),(80,NULL,NULL,'sad','0',0,'2018-04-13 12:19:18','2018-04-13 12:19:18'),(81,NULL,NULL,'sa','0',0,'2018-04-13 12:19:18','2018-04-13 12:19:18'),(82,NULL,NULL,'s','0',0,'2018-04-13 12:19:19','2018-04-13 12:19:19'),(83,NULL,NULL,NULL,'0',0,'2018-04-13 12:19:19','2018-04-13 12:19:19'),(84,NULL,NULL,'When $a \\ne 0$, there are two solutions to \\(ax^2 + bx + c = 0\\) and they are\n$$x = {-b \\pm \\sqrt{b^2-4ac} \\over 2a}.$$','0',0,'2018-04-13 12:42:34','2018-04-13 12:42:34'),(85,NULL,NULL,'When $a \\ne 0$, there are two solutions to \\(ax^2 + bx + c = 0\\) and they are\n$$x = {-b \\pm \\sqrt{b^2-4ac} \\over 2a}.$$','0',0,'2018-04-13 12:42:34','2018-04-13 12:42:34'); /*!40000 ALTER TABLE `tbl_answer` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `tbl_question` -- DROP TABLE IF EXISTS `tbl_question`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `tbl_question` ( `Id` int(11) NOT NULL AUTO_INCREMENT, `subject_id` int(11) DEFAULT NULL, `category_id` int(11) DEFAULT NULL, `question` longtext, `status` tinyint(4) DEFAULT '0', `updated_at` datetime DEFAULT NULL, `created_at` datetime DEFAULT NULL, PRIMARY KEY (`Id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `tbl_question` -- LOCK TABLES `tbl_question` WRITE; /*!40000 ALTER TABLE `tbl_question` DISABLE KEYS */; /*!40000 ALTER TABLE `tbl_question` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `tbl_sub_topics` -- DROP TABLE IF EXISTS `tbl_sub_topics`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `tbl_sub_topics` ( `Id` int(11) NOT NULL AUTO_INCREMENT, `topic_uid` int(11) DEFAULT NULL, `sub_topic_name` text, `status` tinyint(4) DEFAULT NULL, `created_at` datetime DEFAULT NULL, `updated_at` datetime DEFAULT NULL, PRIMARY KEY (`Id`) ) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `tbl_sub_topics` -- LOCK TABLES `tbl_sub_topics` WRITE; /*!40000 ALTER TABLE `tbl_sub_topics` DISABLE KEYS */; INSERT INTO `tbl_sub_topics` VALUES (3,1,'Integer pretium quam et nisi finibus, ut interdum mi posuere. Maecenas eget fermentum lorem. Maecenas vitae ex ligula',1,'2018-04-12 08:09:44','2018-04-12 13:09:44'),(4,1,'Test 2 checking...',1,'2018-04-12 09:09:44','2018-04-13 11:48:08'),(6,4,'Test 4 example',1,'2018-04-12 11:09:44','2018-04-12 14:23:38'),(7,1,'test area',1,'2018-04-12 12:09:44','2018-04-12 13:09:44'),(8,1,'example page for this function xxx',1,'2018-04-12 13:10:36','2018-04-12 14:05:14'); /*!40000 ALTER TABLE `tbl_sub_topics` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `tbl_subjects` -- DROP TABLE IF EXISTS `tbl_subjects`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `tbl_subjects` ( `Id` int(11) NOT NULL AUTO_INCREMENT, `subject_code` varchar(45) DEFAULT NULL, `subject_name` varchar(45) DEFAULT NULL, `status` tinyint(4) DEFAULT NULL, `created_at` datetime DEFAULT NULL, `updated_at` datetime DEFAULT NULL, PRIMARY KEY (`Id`) ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `tbl_subjects` -- LOCK TABLES `tbl_subjects` WRITE; /*!40000 ALTER TABLE `tbl_subjects` DISABLE KEYS */; INSERT INTO `tbl_subjects` VALUES (2,'BIO','Biology',1,'2018-04-10 10:58:02','2018-04-10 11:02:07'),(3,'CHE','Chemistry',1,'2018-04-10 11:02:37','2018-04-10 11:02:37'),(4,'PHY','Physics',1,'2018-04-10 11:13:44','2018-04-10 11:13:44'); /*!40000 ALTER TABLE `tbl_subjects` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `tbl_syllabus` -- DROP TABLE IF EXISTS `tbl_syllabus`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `tbl_syllabus` ( `Id` int(11) NOT NULL AUTO_INCREMENT, `class_number` varchar(45) DEFAULT NULL, `status` tinyint(4) DEFAULT NULL COMMENT '0 = Not Active\n1 = Active', `created_at` datetime DEFAULT NULL, `updated_at` datetime DEFAULT NULL, PRIMARY KEY (`Id`) ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `tbl_syllabus` -- LOCK TABLES `tbl_syllabus` WRITE; /*!40000 ALTER TABLE `tbl_syllabus` DISABLE KEYS */; INSERT INTO `tbl_syllabus` VALUES (1,'CLASS XI',1,NULL,NULL),(2,'CLASS XII',1,NULL,NULL); /*!40000 ALTER TABLE `tbl_syllabus` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `tbl_topics` -- DROP TABLE IF EXISTS `tbl_topics`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `tbl_topics` ( `Id` int(11) NOT NULL AUTO_INCREMENT, `subject_uid` int(11) DEFAULT NULL, `syllabus_uid` int(11) DEFAULT NULL, `unit_number` varchar(45) DEFAULT NULL, `topic_name` varchar(100) DEFAULT NULL, `status` tinyint(4) DEFAULT NULL COMMENT '0 = Not Active\n1 = Active', `created_at` datetime DEFAULT NULL, `updated_at` datetime DEFAULT NULL, PRIMARY KEY (`Id`) ) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `tbl_topics` -- LOCK TABLES `tbl_topics` WRITE; /*!40000 ALTER TABLE `tbl_topics` DISABLE KEYS */; INSERT INTO `tbl_topics` VALUES (1,3,1,'UNIT I','Some Basic Concepts of Chemistry',1,NULL,NULL),(2,3,1,'UNIT II','Structure of Atom',1,NULL,NULL),(3,2,1,'UNIT III','Classification of Elements and Periodicity in Properties',1,NULL,NULL),(4,4,2,'UNIT IV','Chemical Bonding and Molecular Structure',1,'2018-04-11 14:37:03','2018-04-12 06:27:53'),(15,2,1,'22','asd',1,'2018-04-13 11:52:38','2018-04-13 11:52:38'),(16,2,1,'asd','sad',1,'2018-04-13 11:54:04','2018-04-13 11:54:04'); /*!40000 ALTER TABLE `tbl_topics` 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(10) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `email` varchar(255) COLLATE utf8mb4_unicode_ci NOT 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, PRIMARY KEY (`id`), UNIQUE KEY `users_email_unique` (`email`) ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!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,'charles','<EMAIL>','123','2',NULL,NULL),(2,'<NAME>','<EMAIL>','$2y$10$CvB2lpt/HPOgFaohAL.AZ.tMLbMO/weBrLEyKlSfFUzFxfQv537Ai','qnY6ViEmb1QEmsdP3iez5ZvB4OVBUg13OOBYQez1EJLlKTivBQOb9k2MA6Wi','2018-03-11 04:55:04','2018-03-11 04:55:04'),(3,'March','<EMAIL>','$2y$10$xJ94NwkxUVsRY2K8mph/du701.Z9gpAo5jf1oaVjpE8B6qLPclTnK','LAMGsWzUvJGu6otkt6zjrdkVqaKWBKGDuL8CopBHiuwaxg3WgQ1xpuC9XCMb','2018-04-10 02:40:48','2018-04-10 02:40:48'); /*!40000 ALTER TABLE `users` ENABLE KEYS */; UNLOCK TABLES; -- -- Dumping events for database 'ambeyo_neet' -- -- -- Dumping routines for database 'ambeyo_neet' -- /*!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-04-13 22:44:58
use [$(IntrajobDatabase)] GO if object_id('[Rulebase].[DV_Get_Cases]','p') is not null drop procedure [Rulebase].[DV_Get_Cases] GO -- ===================================================================================================== -- Generated by Data Dictionary Version 1.0.0.0 -- Date: 12 September 2016 10:58 -- Profile: Test Harness Calculation -- Rulebase Version: ILR Derived Variables 1617, Drop 000, Version 1617.03 -- ===================================================================================================== create procedure [Rulebase].[DV_Get_Cases] as begin set nocount on select CaseData from [Rulebase].[DV_Cases] end GO if object_id('[Rulebase].[DV_Insert_Cases]','p') is not null drop procedure [Rulebase].[DV_Insert_Cases] GO -- ===================================================================================================== -- Generated by Data Dictionary Version 1.0.0.0 -- Date: 12 September 2016 10:58 -- Profile: Test Harness Calculation -- Rulebase Version: ILR Derived Variables 1617, Drop 000, Version 1617.03 -- ===================================================================================================== create procedure [Rulebase].[DV_Insert_Cases] as begin set nocount on insert into [Rulebase].[DV_Cases] ( [LearnRefNumber], CaseData ) select ControllingTable.[LearnRefNumber], convert(xml, ( select [Org_Details].[ThirdSector] as [@ThirdSector], [LearningProvider].[UKPRN] as [@UKPRN], ( select [Learner].[DateOfBirth] as [@DateOfBirth], [EFA_Learner].[FundLine] as [@EFA_CalcFundingLineType], [EFA_Learner].[StartFund] as [@EFA_CalcStartFunding], [EFA_Learner].[ThresholdDays] as [@EFA_CalcThresholdDays], [Learner].[Ethnicity] as [@Ethnicity], [Learner].[LearnRefNumber] as [@LearnRefNumber], [Learner].[LLDDHealthProb] as [@LLDDHealthProb], [Learner].[PlanEEPHours] as [@PlanEEPHours], [Learner].[PlanLearnHours] as [@PlanLearnHours], [Learner].[PrevLearnRefNumber] as [@PrevLearnRefNumber], [Learner].[PrevUKPRN] as [@PrevUKPRN], [Learner].[PriorAttain] as [@PriorAttain], [Learner].[ULN] as [@ULN], ( select [LearnerEmploymentStatus].[DateEmpStatApp] as [@DateEmpStatApp], [LearnerEmploymentStatus].[EmpId] as [@EmpId], [LearnerEmploymentStatus].[EmpStat] as [@EmpStat], [LearnerEmploymentStatus].[EmpStatMon_BSI] as [@EmpStatMon_BSI], [LearnerEmploymentStatus].[EmpStatMon_EII] as [@EmpStatMon_EII], [LearnerEmploymentStatus].[EmpStatMon_LOE] as [@EmpStatMon_LOE], [LearnerEmploymentStatus].[EmpStatMon_LOU] as [@EmpStatMon_LOU], [LearnerEmploymentStatus].[EmpStatMon_PEI] as [@EmpStatMon_PEI], [LearnerEmploymentStatus].[EmpStatMon_SEI] as [@EmpStatMon_SEI], [LearnerEmploymentStatus].[EmpStatMon_SEM] as [@EmpStatMon_SEM] from [Valid].[LearnerEmploymentStatus] where [LearnerEmploymentStatus].[LearnRefNumber] = [Learner].[LearnRefNumber] for xml path ('LearnerEmploymentStatus'), type ), ( select [ContactPreference].[ContPrefCode] as [@ContPrefCode], [ContactPreference].[ContPrefType] as [@ContPrefType] from [Valid].[ContactPreference] where [ContactPreference].[LearnRefNumber] = [Learner].[LearnRefNumber] for xml path ('ContactPreference'), type ), ( select [LearningDelivery].[AimSeqNumber] as [@AimSeqNumber], [LearningDelivery].[AimType] as [@AimType], [ALB_LearningDelivery].[FundLine] as [@ALB_CalcFundingLineType], [ALB_LearningDelivery].[FundStart] as [@ALB_CalcStartFunding], [LearningDelivery].[CompStatus] as [@CompStatus], [LARS_LearningDelivery].[CreditBasedFwkType] as [@CreditBasedFwkType], [LARS_LearningDelivery].[EnglandFEHEStatus] as [@EnglandFEHEStatus], [LARS_FrameworkAims].[FrameworkComponentType] as [@FrameworkComponentType], [LearningDelivery].[FundModel] as [@FundModel], [LearningDelivery].[FworkCode] as [@FworkCode], [LearningDelivery].[LearnActEndDate] as [@LearnActEndDate], [LearningDelivery].[LearnAimRef] as [@LearnAimRef], [LARS_LearningDelivery].[LearnAimRefType] as [@LearnAimRefType], [LearningDelivery].[LearnPlanEndDate] as [@LearnPlanEndDate], [LearningDelivery].[LearnStartDate] as [@LearnStartDate], [LearningDelivery].[LrnDelFAM_ADL] as [@LrnDelFAM_ADL], [LearningDelivery].[LrnDelFAM_EEF] as [@LrnDelFAM_EEF], [LearningDelivery].[LrnDelFAM_FFI] as [@LrnDelFAM_FFI], [LearningDelivery].[LrnDelFAM_LDM1] as [@LrnDelFAM_LDM1], [LearningDelivery].[LrnDelFAM_LDM2] as [@LrnDelFAM_LDM2], [LearningDelivery].[LrnDelFAM_LDM3] as [@LrnDelFAM_LDM3], [LearningDelivery].[LrnDelFAM_LDM4] as [@LrnDelFAM_LDM4], [LearningDelivery].[LrnDelFAM_RES] as [@LrnDelFAM_RES], [LearningDelivery].[LrnDelFAM_SOF] as [@LrnDelFAM_SOF], [LearningDelivery].[LrnDelFAM_SPP] as [@LrnDelFAM_SPP], [LARS_LearningDelivery].[NotionalNVQLevel] as [@NotionalNVQLevel], [LARS_LearningDelivery].[NotionalNVQLevelv2] as [@NotionalNVQLevelv2], [LearningDelivery].[OrigLearnStartDate] as [@OrigLearnStartDate], [LearningDelivery].[Outcome] as [@Outcome], [LearningDelivery].[OutGrade] as [@OutGrade], [LearningDelivery].[ProgType] as [@ProgType], [LearningDelivery].[PwayCode] as [@PwayCode], [LARS_LearningDelivery].[RegulatedCreditValue] as [@RegulatedCreditValue], [LARS_Section96].[Section96Valid16to18] as [@Section96Valid16to18], [LARS_LearningDelivery].[SectorSubjectAreaTier1] as [@SectorSubjectAreaTier1], [LARS_LearningDelivery].[SectorSubjectAreaTier2] as [@SectorSubjectAreaTier2], [SFA_LearningDelivery].[FundLine] as [@SFA_CalcFundingLineType], [SFA_LearningDelivery].[LargeEmployerSFAFctr] as [@SFA_CalcLargeEmpFactor], [SFA_LearningDelivery].[FundStart] as [@SFA_CalcStartFunding], [SFA_LearningDelivery].[ThresholdDays] as [@SFA_CalcThresholdDays], [LearningDelivery].[WithdrawReason] as [@WithdrawReason], ( select [LearningDeliveryFAM].[LearnDelFAMCode] as [@LearnDelFAMCode], [LearningDeliveryFAM].[LearnDelFAMDateFrom] as [@LearnDelFAMDateFrom], [LearningDeliveryFAM].[LearnDelFAMDateTo] as [@LearnDelFAMDateTo], [LearningDeliveryFAM].[LearnDelFAMType] as [@LearnDelFAMType] from [Valid].[LearningDeliveryFAM] where [LearningDeliveryFAM].[LearnRefNumber] = [LearningDelivery].[LearnRefNumber] and [LearningDeliveryFAM].[AimSeqNumber] = [LearningDelivery].[AimSeqNumber] for xml path ('LearningDeliveryFAM'), type ), ( select [LARS_AnnualValue].[BasicSkills] as [@BasicSkills], [LARS_AnnualValue].[BasicSkillsParticipation] as [@BasicSkillsParticipation], [LARS_AnnualValue].[BasicSkillsType] as [@BasicSkillsType], [LARS_AnnualValue].[EffectiveFrom] as [@EffectiveFrom], [LARS_AnnualValue].[EffectiveTo] as [@EffectiveTo], [LARS_AnnualValue].[FullLevel2EntitlementCategory] as [@FullLevel2EntitlementCategory], [LARS_AnnualValue].[FullLevel2Percent] as [@FullLevel2Percent], [LARS_AnnualValue].[FullLevel3EntitlementCategory] as [@FullLevel3EntitlementCategory], [LARS_AnnualValue].[FullLevel3Percent] as [@FullLevel3Percent], [LARS_AnnualValue].[SfaApprovalStatus] as [@SFAApprovalStatus] from [$(LARS)].[$(LARS_Schema)].[LARS_AnnualValue] where [LARS_AnnualValue].[LearnAimRef]=[LearningDelivery].[LearnAimRef] for xml path ('LARSAnnualValue'), type ), ( select [LearningDeliveryHE].[TYPEYR] as [@TYPEYR] from [Valid].[LearningDeliveryHE] where [LearningDeliveryHE].[LearnRefNumber] = [LearningDelivery].[LearnRefNumber] and [LearningDeliveryHE].[AimSeqNumber] = [LearningDelivery].[AimSeqNumber] for xml path ('LearningDeliveryHE'), type ), ( select [LARS_Validity].[ValidityCategory] as [@ValidityCategory], [LARS_Validity].[EndDate] as [@ValidityEndDate], [LARS_Validity].[LastNewStartDate] as [@ValidityLastNewStartDate], [LARS_Validity].[StartDate] as [@ValidityStartDate] from [$(LARS)].[$(LARS_Schema)].[LARS_Validity] where [LARS_Validity].[LearnAimRef]=[LearningDelivery].[LearnAimRef] for xml path ('LearningDeliveryLARSValidity'), type ) from [Valid].[LearningDelivery] left join [$(SourceDatabase)].[$(SourceDatabase_Schema)].[ALB_LearningDelivery] on [ALB_LearningDelivery].[LearnRefNumber]=[LearningDelivery].[LearnRefNumber] and [ALB_LearningDelivery].[AimSeqNumber]=[LearningDelivery].[AimSeqNumber] left join [$(LARS)].[$(LARS_Schema)].[LARS_LearningDelivery] on [LARS_LearningDelivery].[LearnAimRef]=[LearningDelivery].[LearnAimRef] left join [$(LARS)].[$(LARS_Schema)].[LARS_FrameworkAims] on [LARS_FrameworkAims].[FworkCode]=[LearningDelivery].[FworkCode] and [LARS_FrameworkAims].[ProgType]=[LearningDelivery].[ProgType] and [LARS_FrameworkAims].[PwayCode]=[LearningDelivery].[PwayCode] and [LARS_FrameworkAims].[LearnAimRef]=[LearningDelivery].[LearnAimRef] left join [$(LARS)].[$(LARS_Schema)].[LARS_Section96] on [LARS_Section96].[LearnAimRef]=[LearningDelivery].[LearnAimRef] left join [$(SourceDatabase)].[$(SourceDatabase_Schema)].[SFA_LearningDelivery] on [SFA_LearningDelivery].[LearnRefNumber]=[LearningDelivery].[LearnRefNumber] and [SFA_LearningDelivery].[AimSeqNumber]=[LearningDelivery].[AimSeqNumber] where [LearningDelivery].[LearnRefNumber] = [Learner].[LearnRefNumber] for xml path ('LearningDelivery'), type ), ( select [LLDDandHealthProblem].[LLDDCat] as [@LLDDCat], [LLDDandHealthProblem].[PrimaryLLDD] as [@PrimaryLLDD] from [Valid].[LLDDandHealthProblem] where [LLDDandHealthProblem].[LearnRefNumber] = [Learner].[LearnRefNumber] for xml path ('LLDDandHealthProblem'), type ) from [Valid].[Learner] left join [Rulebase].[EFA_Learner] on [EFA_Learner].[LearnRefNumber]=[Learner].[LearnRefNumber] where [Learner].[LearnRefNumber] = [ControllingTable].[LearnRefNumber] for xml path ('Learner'), type ) from [Valid].[LearningProvider] left join [$(Org)].[$(Org_Schema)].[Org_Details] on [Org_Details].[UKPRN]=[LearningProvider].[UKPRN] for xml path ('global'), type ) ) from [Valid].[Learner] ControllingTable end GO if object_id('[Rulebase].[DV_Insert_global]','p') is not null drop procedure [Rulebase].[DV_Insert_global] GO -- ===================================================================================================== -- Generated by Data Dictionary Version 1.0.0.0 -- Date: 12 September 2016 10:58 -- Profile: Test Harness Calculation -- Rulebase Version: ILR Derived Variables 1617, Drop 000, Version 1617.03 -- ===================================================================================================== create procedure [Rulebase].[DV_Insert_global] ( @UKPRN int, @RulebaseVersion varchar(10) ) as begin set nocount on insert into [Rulebase].[DV_global] values ( @UKPRN, @RulebaseVersion ) end go if object_id('[Rulebase].[DV_Insert_Learner]','p') is not null drop procedure [Rulebase].[DV_Insert_Learner] GO -- ===================================================================================================== -- Generated by Data Dictionary Version 1.0.0.0 -- Date: 12 September 2016 10:58 -- Profile: Test Harness Calculation -- Rulebase Version: ILR Derived Variables 1617, Drop 000, Version 1617.03 -- ===================================================================================================== create procedure [Rulebase].[DV_Insert_Learner] ( @LearnRefNumber varchar(12), @Learn_3rdSector int, @Learn_Active int, @Learn_ActiveJan int, @Learn_ActiveNov int, @Learn_ActiveOct int, @Learn_Age31Aug int, @Learn_BasicSkill int, @Learn_EmpStatFDL int, @Learn_EmpStatPrior int, @Learn_FirstFullLevel2 int, @Learn_FirstFullLevel2Ach int, @Learn_FirstFullLevel3 int, @Learn_FirstFullLevel3Ach int, @Learn_FullLevel2 int, @Learn_FullLevel2Ach int, @Learn_FullLevel3 int, @Learn_FullLevel3Ach int, @Learn_FundAgency int, @Learn_FundingSource int, @Learn_FundPrvYr int, @Learn_ILAcMonth1 int, @Learn_ILAcMonth10 int, @Learn_ILAcMonth11 int, @Learn_ILAcMonth12 int, @Learn_ILAcMonth2 int, @Learn_ILAcMonth3 int, @Learn_ILAcMonth4 int, @Learn_ILAcMonth5 int, @Learn_ILAcMonth6 int, @Learn_ILAcMonth7 int, @Learn_ILAcMonth8 int, @Learn_ILAcMonth9 int, @Learn_ILCurrAcYr int, @Learn_LargeEmployer int, @Learn_LenEmp int, @Learn_LenUnemp int, @Learn_LrnAimRecords int, @Learn_ModeAttPlanHrs int, @Learn_NotionLev int, @Learn_NotionLevV2 int, @Learn_OLASS int, @Learn_PrefMethContact int, @Learn_PrimaryLLDD int, @Learn_PriorEducationStatus int, @Learn_UnempBenFDL int, @Learn_UnempBenPrior int, @Learn_Uplift1516EFA decimal(6,5), @Learn_Uplift1516SFA decimal(6,5) ) as begin set nocount on insert into [Rulebase].[DV_Learner] values ( @LearnRefNumber, @Learn_3rdSector, @Learn_Active, @Learn_ActiveJan, @Learn_ActiveNov, @Learn_ActiveOct, @Learn_Age31Aug, @Learn_BasicSkill, @Learn_EmpStatFDL, @Learn_EmpStatPrior, @Learn_FirstFullLevel2, @Learn_FirstFullLevel2Ach, @Learn_FirstFullLevel3, @Learn_FirstFullLevel3Ach, @Learn_FullLevel2, @Learn_FullLevel2Ach, @Learn_FullLevel3, @Learn_FullLevel3Ach, @Learn_FundAgency, @Learn_FundingSource, @Learn_FundPrvYr, @Learn_ILAcMonth1, @Learn_ILAcMonth10, @Learn_ILAcMonth11, @Learn_ILAcMonth12, @Learn_ILAcMonth2, @Learn_ILAcMonth3, @Learn_ILAcMonth4, @Learn_ILAcMonth5, @Learn_ILAcMonth6, @Learn_ILAcMonth7, @Learn_ILAcMonth8, @Learn_ILAcMonth9, @Learn_ILCurrAcYr, @Learn_LargeEmployer, @Learn_LenEmp, @Learn_LenUnemp, @Learn_LrnAimRecords, @Learn_ModeAttPlanHrs, @Learn_NotionLev, @Learn_NotionLevV2, @Learn_OLASS, @Learn_PrefMethContact, @Learn_PrimaryLLDD, @Learn_PriorEducationStatus, @Learn_UnempBenFDL, @Learn_UnempBenPrior, @Learn_Uplift1516EFA, @Learn_Uplift1516SFA ) end go if object_id('[Rulebase].[DV_Insert_LearningDelivery]','p') is not null drop procedure [Rulebase].[DV_Insert_LearningDelivery] GO -- ===================================================================================================== -- Generated by Data Dictionary Version 1.0.0.0 -- Date: 12 September 2016 10:58 -- Profile: Test Harness Calculation -- Rulebase Version: ILR Derived Variables 1617, Drop 000, Version 1617.03 -- ===================================================================================================== create procedure [Rulebase].[DV_Insert_LearningDelivery] ( @LearnRefNumber varchar(12), @AimSeqNumber int, @LearnDel_AccToApp int, @LearnDel_AccToAppEmpDate date, @LearnDel_AccToAppEmpStat int, @LearnDel_AchFullLevel2Pct decimal(5,2), @LearnDel_AchFullLevel3Pct decimal(5,2), @LearnDel_Achieved int, @LearnDel_AchievedIY int, @LearnDel_AcMonthYTD varchar(2), @LearnDel_ActDaysILAfterCurrAcYr int, @LearnDel_ActDaysILCurrAcYr int, @LearnDel_ActEndDateOnAfterJan1 int, @LearnDel_ActEndDateOnAfterNov1 int, @LearnDel_ActEndDateOnAfterOct1 int, @LearnDel_ActiveIY int, @LearnDel_ActiveJan int, @LearnDel_ActiveNov int, @LearnDel_ActiveOct int, @LearnDel_ActTotalDaysIL int, @LearnDel_AdvLoan int, @LearnDel_AgeAimOrigStart int, @LearnDel_AgeAtStart int, @LearnDel_App int, @LearnDel_App1618Fund int, @LearnDel_App1925Fund int, @LearnDel_AppAimType int, @LearnDel_AppKnowl int, @LearnDel_AppMainAim int, @LearnDel_AppNonFund int, @LearnDel_BasicSkills int, @LearnDel_BasicSkillsParticipation int, @LearnDel_BasicSkillsType int, @LearnDel_CarryIn int, @LearnDel_ClassRm int, @LearnDel_CompAimApp int, @LearnDel_CompAimProg int, @LearnDel_Completed int, @LearnDel_CompletedIY int, @LearnDel_CompleteFullLevel2Pct decimal(5,2), @LearnDel_CompleteFullLevel3Pct decimal(5,2), @LearnDel_EFACoreAim int, @LearnDel_Emp6MonthAimStart int, @LearnDel_Emp6MonthProgStart int, @LearnDel_EmpDateBeforeFDL date, @LearnDel_EmpDatePriorFDL date, @LearnDel_EmpID int, @LearnDel_Employed int, @LearnDel_EmpStatFDL int, @LearnDel_EmpStatPrior int, @LearnDel_EmpStatPriorFDL int, @LearnDel_EnhanAppFund int, @LearnDel_FullLevel2AchPct decimal(5,2), @LearnDel_FullLevel2ContPct decimal(5,2), @LearnDel_FullLevel3AchPct decimal(5,2), @LearnDel_FullLevel3ContPct decimal(5,2), @LearnDel_FuncSkills int, @LearnDel_FundAgency int, @LearnDel_FundingLineType varchar(100), @LearnDel_FundingSource int, @LearnDel_FundPrvYr int, @LearnDel_FundStart int, @LearnDel_GCE int, @LearnDel_GCSE int, @LearnDel_ILAcMonth1 int, @LearnDel_ILAcMonth10 int, @LearnDel_ILAcMonth11 int, @LearnDel_ILAcMonth12 int, @LearnDel_ILAcMonth2 int, @LearnDel_ILAcMonth3 int, @LearnDel_ILAcMonth4 int, @LearnDel_ILAcMonth5 int, @LearnDel_ILAcMonth6 int, @LearnDel_ILAcMonth7 int, @LearnDel_ILAcMonth8 int, @LearnDel_ILAcMonth9 int, @LearnDel_ILCurrAcYr int, @LearnDel_IYActEndDate date, @LearnDel_IYPlanEndDate date, @LearnDel_IYStartDate date, @LearnDel_KeySkills int, @LearnDel_LargeEmpDiscountId int, @LearnDel_LargeEmployer int, @LearnDel_LastEmpDate date, @LearnDel_LeaveMonth int, @LearnDel_LenEmp int, @LearnDel_LenUnemp int, @LearnDel_LoanBursFund int, @LearnDel_NotionLevel int, @LearnDel_NotionLevelV2 int, @LearnDel_NumHEDatasets int, @LearnDel_OccupAim int, @LearnDel_OLASS int, @LearnDel_OLASSCom int, @LearnDel_OLASSCus int, @LearnDel_OrigStartDate date, @LearnDel_PlanDaysILAfterCurrAcYr int, @LearnDel_PlanDaysILCurrAcYr int, @LearnDel_PlanEndBeforeAug1 int, @LearnDel_PlanEndOnAfterJan1 int, @LearnDel_PlanEndOnAfterNov1 int, @LearnDel_PlanEndOnAfterOct1 int, @LearnDel_PlanTotalDaysIL int, @LearnDel_PriorEducationStatus int, @LearnDel_Prog int, @LearnDel_ProgAimAch int, @LearnDel_ProgAimApp int, @LearnDel_ProgCompleted int, @LearnDel_ProgCompletedIY int, @LearnDel_ProgStartDate date, @LearnDel_QCF int, @LearnDel_QCFCert int, @LearnDel_QCFDipl int, @LearnDel_QCFType int, @LearnDel_RegAim int, @LearnDel_SecSubAreaTier1 varchar(3), @LearnDel_SecSubAreaTier2 varchar(5), @LearnDel_SFAApproved int, @LearnDel_SourceFundEFA int, @LearnDel_SourceFundSFA int, @LearnDel_StartBeforeApr1 int, @LearnDel_StartBeforeAug1 int, @LearnDel_StartBeforeDec1 int, @LearnDel_StartBeforeFeb1 int, @LearnDel_StartBeforeJan1 int, @LearnDel_StartBeforeJun1 int, @LearnDel_StartBeforeMar1 int, @LearnDel_StartBeforeMay1 int, @LearnDel_StartBeforeNov1 int, @LearnDel_StartBeforeOct1 int, @LearnDel_StartBeforeSep1 int, @LearnDel_StartIY int, @LearnDel_StartJan1 int, @LearnDel_StartMonth int, @LearnDel_StartNov1 int, @LearnDel_StartOct1 int, @LearnDel_SuccRateStat int, @LearnDel_TrainAimType int, @LearnDel_TransferDiffProvider int, @LearnDel_TransferDiffProviderGovStrat int, @LearnDel_TransferProvider int, @LearnDel_UfIProv int, @LearnDel_UnempBenFDL int, @LearnDel_UnempBenPrior int, @LearnDel_Withdrawn int, @LearnDel_WorkplaceLocPostcode varchar(8), @Prog_AccToApp int, @Prog_Achieved int, @Prog_AchievedIY int, @Prog_ActEndDate date, @Prog_ActiveIY int, @Prog_AgeAtStart int, @Prog_EarliestAim int, @Prog_Employed int, @Prog_FundPrvYr int, @Prog_ILCurrAcYear int, @Prog_LatestAim int, @Prog_SourceFundEFA int, @Prog_SourceFundSFA int ) as begin set nocount on insert into [Rulebase].[DV_LearningDelivery] values ( @LearnRefNumber, @AimSeqNumber, @LearnDel_AccToApp, @LearnDel_AccToAppEmpDate, @LearnDel_AccToAppEmpStat, @LearnDel_AchFullLevel2Pct, @LearnDel_AchFullLevel3Pct, @LearnDel_Achieved, @LearnDel_AchievedIY, @LearnDel_AcMonthYTD, @LearnDel_ActDaysILAfterCurrAcYr, @LearnDel_ActDaysILCurrAcYr, @LearnDel_ActEndDateOnAfterJan1, @LearnDel_ActEndDateOnAfterNov1, @LearnDel_ActEndDateOnAfterOct1, @LearnDel_ActiveIY, @LearnDel_ActiveJan, @LearnDel_ActiveNov, @LearnDel_ActiveOct, @LearnDel_ActTotalDaysIL, @LearnDel_AdvLoan, @LearnDel_AgeAimOrigStart, @LearnDel_AgeAtStart, @LearnDel_App, @LearnDel_App1618Fund, @LearnDel_App1925Fund, @LearnDel_AppAimType, @LearnDel_AppKnowl, @LearnDel_AppMainAim, @LearnDel_AppNonFund, @LearnDel_BasicSkills, @LearnDel_BasicSkillsParticipation, @LearnDel_BasicSkillsType, @LearnDel_CarryIn, @LearnDel_ClassRm, @LearnDel_CompAimApp, @LearnDel_CompAimProg, @LearnDel_Completed, @LearnDel_CompletedIY, @LearnDel_CompleteFullLevel2Pct, @LearnDel_CompleteFullLevel3Pct, @LearnDel_EFACoreAim, @LearnDel_Emp6MonthAimStart, @LearnDel_Emp6MonthProgStart, @LearnDel_EmpDateBeforeFDL, @LearnDel_EmpDatePriorFDL, @LearnDel_EmpID, @LearnDel_Employed, @LearnDel_EmpStatFDL, @LearnDel_EmpStatPrior, @LearnDel_EmpStatPriorFDL, @LearnDel_EnhanAppFund, @LearnDel_FullLevel2AchPct, @LearnDel_FullLevel2ContPct, @LearnDel_FullLevel3AchPct, @LearnDel_FullLevel3ContPct, @LearnDel_FuncSkills, @LearnDel_FundAgency, @LearnDel_FundingLineType, @LearnDel_FundingSource, @LearnDel_FundPrvYr, @LearnDel_FundStart, @LearnDel_GCE, @LearnDel_GCSE, @LearnDel_ILAcMonth1, @LearnDel_ILAcMonth10, @LearnDel_ILAcMonth11, @LearnDel_ILAcMonth12, @LearnDel_ILAcMonth2, @LearnDel_ILAcMonth3, @LearnDel_ILAcMonth4, @LearnDel_ILAcMonth5, @LearnDel_ILAcMonth6, @LearnDel_ILAcMonth7, @LearnDel_ILAcMonth8, @LearnDel_ILAcMonth9, @LearnDel_ILCurrAcYr, @LearnDel_IYActEndDate, @LearnDel_IYPlanEndDate, @LearnDel_IYStartDate, @LearnDel_KeySkills, @LearnDel_LargeEmpDiscountId, @LearnDel_LargeEmployer, @LearnDel_LastEmpDate, @LearnDel_LeaveMonth, @LearnDel_LenEmp, @LearnDel_LenUnemp, @LearnDel_LoanBursFund, @LearnDel_NotionLevel, @LearnDel_NotionLevelV2, @LearnDel_NumHEDatasets, @LearnDel_OccupAim, @LearnDel_OLASS, @LearnDel_OLASSCom, @LearnDel_OLASSCus, @LearnDel_OrigStartDate, @LearnDel_PlanDaysILAfterCurrAcYr, @LearnDel_PlanDaysILCurrAcYr, @LearnDel_PlanEndBeforeAug1, @LearnDel_PlanEndOnAfterJan1, @LearnDel_PlanEndOnAfterNov1, @LearnDel_PlanEndOnAfterOct1, @LearnDel_PlanTotalDaysIL, @LearnDel_PriorEducationStatus, @LearnDel_Prog, @LearnDel_ProgAimAch, @LearnDel_ProgAimApp, @LearnDel_ProgCompleted, @LearnDel_ProgCompletedIY, @LearnDel_ProgStartDate, @LearnDel_QCF, @LearnDel_QCFCert, @LearnDel_QCFDipl, @LearnDel_QCFType, @LearnDel_RegAim, @LearnDel_SecSubAreaTier1, @LearnDel_SecSubAreaTier2, @LearnDel_SFAApproved, @LearnDel_SourceFundEFA, @LearnDel_SourceFundSFA, @LearnDel_StartBeforeApr1, @LearnDel_StartBeforeAug1, @LearnDel_StartBeforeDec1, @LearnDel_StartBeforeFeb1, @LearnDel_StartBeforeJan1, @LearnDel_StartBeforeJun1, @LearnDel_StartBeforeMar1, @LearnDel_StartBeforeMay1, @LearnDel_StartBeforeNov1, @LearnDel_StartBeforeOct1, @LearnDel_StartBeforeSep1, @LearnDel_StartIY, @LearnDel_StartJan1, @LearnDel_StartMonth, @LearnDel_StartNov1, @LearnDel_StartOct1, @LearnDel_SuccRateStat, @LearnDel_TrainAimType, @LearnDel_TransferDiffProvider, @LearnDel_TransferDiffProviderGovStrat, @LearnDel_TransferProvider, @LearnDel_UfIProv, @LearnDel_UnempBenFDL, @LearnDel_UnempBenPrior, @LearnDel_Withdrawn, @LearnDel_WorkplaceLocPostcode, @Prog_AccToApp, @Prog_Achieved, @Prog_AchievedIY, @Prog_ActEndDate, @Prog_ActiveIY, @Prog_AgeAtStart, @Prog_EarliestAim, @Prog_Employed, @Prog_FundPrvYr, @Prog_ILCurrAcYear, @Prog_LatestAim, @Prog_SourceFundEFA, @Prog_SourceFundSFA ) end go
CREATE TABLE sectors ( id INTEGER PRIMARY KEY, name STRING (60) );
<reponame>christophanneser/Bao-for-Presto SELECT b1.name, count(*) FROM site AS s, so_user AS u1, tag AS t1, tag_question AS tq1, question AS q1, badge AS b1, account AS acc WHERE s.site_id = u1.site_id AND s.site_id = b1.site_id AND s.site_id = t1.site_id AND s.site_id = tq1.site_id AND s.site_id = q1.site_id AND t1.id = tq1.tag_id AND q1.id = tq1.question_id AND q1.owner_user_id = u1.id AND acc.id = u1.account_id AND b1.user_id = u1.id AND (q1.score >= 0) AND (q1.score <= 1000) AND (s.site_name in ('stackoverflow', 'superuser')) AND (t1.name in ('android-glide', 'compilation', 'core-animation', 'crash-dumps', 'invoke', 'jackson', 'kivy', 'network-shares', 'pdfbox', 'servicebus', 'windows-phone-8.1')) AND (LOWER(acc.website_url) LIKE ('%en')) GROUP BY b1.name ORDER BY COUNT(*) DESC LIMIT 100
<gh_stars>0 -- -- Use this SQL script to pay publishers monthly -- select pi.`Name` AS `UserName`, pi.Email AS `Email`, GROUP_CONCAT(piash.`AdName`), CONCAT('$', ROUND(sum(piash.`Revenue`), 2)) AS `RevenueNet`, FORMAT(sum(piash.`Impressions`), 0) AS `TotalImpressions`, FORMAT(sum(piash.`Requests`), 0) AS `TotalRequests` from `PublisherImpressionsAndSpendHourly` piash inner join PublisherInfo pi on piash.PublisherInfoID = pi.PublisherInfoID where piash.DateCreated >= '2015-02-01 00:00:00' and piash.DateCreated < '2015-03-01 00:00:00' -- and pi.`Name` = 'username' and piash.Revenue != 0 group by pi.`Name`
CREATE TABLE IF NOT EXISTS {{envExecution}}.controle_ok (id_source text COLLATE pg_catalog."C", id integer, date_integration text COLLATE pg_catalog."C", id_norme text COLLATE pg_catalog."C", periodicite text COLLATE pg_catalog."C", validite text COLLATE pg_catalog."C") WITH (autovacuum_enabled = false, toast.autovacuum_enabled = false); CREATE TABLE IF NOT EXISTS {{envExecution}}.controle_ok_todo (id_source text COLLATE pg_catalog."C", id integer, date_integration text COLLATE pg_catalog."C", id_norme text COLLATE pg_catalog."C", periodicite text COLLATE pg_catalog."C", validite text COLLATE pg_catalog."C") WITH (autovacuum_enabled = false, toast.autovacuum_enabled = false); CREATE TABLE IF NOT EXISTS {{envExecution}}.controle_ko (id_source text COLLATE pg_catalog."C", id integer, date_integration text COLLATE pg_catalog."C", id_norme text COLLATE pg_catalog."C", periodicite text COLLATE pg_catalog."C", validite text COLLATE pg_catalog."C") WITH (autovacuum_enabled = false, toast.autovacuum_enabled = false);
<gh_stars>100-1000 -- randexpr1.test -- -- db eval {SELECT +(abs(~+13+(abs(t1.c)/abs(t1.c | coalesce((select t1.a from t1 where (select min(t1.c) from t1)<>(abs(t1.f | coalesce((select c from t1 where b=17),f)-b)/abs(coalesce((select max(d-t1.e) from t1 where not exists(select 1 from t1 where t1.e in (select f from t1 union select t1.d from t1))),19)*e+19)) or t1.a in (select 13 from t1 union select t1.d from t1) and (b)<= -t1.f),11))))/abs(e)) FROM t1 WHERE t1.e<>coalesce((select case 17 when f then coalesce((select max(t1.c) from t1 where coalesce((select coalesce((select ~e from t1 where not 17<=e | 17),11)+t1.d+t1.e from t1 where (e>=f or (not t1.e>=t1.a or e between f and t1.f))),t1.b) not in (13,17,c) or t1.a> -t1.d),19) else t1.c end from t1 where (not 17 not in (t1.b,11,b) and f>=t1.f) or 19<=t1.f),d)-11} SELECT +(abs(~+13+(abs(t1.c)/abs(t1.c | coalesce((select t1.a from t1 where (select min(t1.c) from t1)<>(abs(t1.f | coalesce((select c from t1 where b=17),f)-b)/abs(coalesce((select max(d-t1.e) from t1 where not exists(select 1 from t1 where t1.e in (select f from t1 union select t1.d from t1))),19)*e+19)) or t1.a in (select 13 from t1 union select t1.d from t1) and (b)<= -t1.f),11))))/abs(e)) FROM t1 WHERE t1.e<>coalesce((select case 17 when f then coalesce((select max(t1.c) from t1 where coalesce((select coalesce((select ~e from t1 where not 17<=e | 17),11)+t1.d+t1.e from t1 where (e>=f or (not t1.e>=t1.a or e between f and t1.f))),t1.b) not in (13,17,c) or t1.a> -t1.d),19) else t1.c end from t1 where (not 17 not in (t1.b,11,b) and f>=t1.f) or 19<=t1.f),d)-11
<reponame>CodingChipmunks/DBSecondAssignment -- Admin -- Generate Test Data. -- These test accounts are used in the creation of new Media/Reviews/Ratings INSERT INTO Account (Name, User, Pass) VALUES ("MrFoo", "Foo", "Foo"); INSERT INTO Account (Name, User, Pass) VALUES ("MrsBar", "Bar", "Bar"); INSERT INTO Account (Name, User, Pass) VALUES ("Alice", "AUser", "APass"); INSERT INTO Account (Name, User, Pass) VALUES ("Bob", "BUser", "BPass"); -- Use this account to log in during development, it has no preset reviews/ratings. INSERT INTO Account (Name, User, Pass) VALUES ("User42", "User", "Password"); -- Adding some Albums to database. CALL AddMedia("Foo", "Foo", "Rosenrot", "2009", "Rammstyle", 120, 1, @pkid); CALL AddCreator("Foo", "Foo", "Rammstein", @pkid); CALL MakeReview("Bar", "Bar", "Excellent!", "With deep flavor and class...", @pkid); CALL MakeReview("Foo", "Foo", "Supberb.", "Very Good. Such Wack.", @pkid); CALL MakeReview("AUser", "APass", "Naaa?", "Sorry, not feeling it..", @pkid); CALL MakeReview("Buser", "BPass", "Alright", "Could have used more SQL..", @pkid); CALL Rate(@pkid, "BUser", "BPass", 2); CALL Rate(@pkid, "AUser", "APass", 5); CALL AddMedia("Bar", "Bar", "Reise, Reise", "2006", "Rammstyle", 120, 1, @pkid); CALL AddCreator("Foo", "Foo", "Rammstein", @pkid); CALL MakeReview("Bar", "Bar", "Extraordinary!", "This album.. !!!", @pkid); CALL MakeReview("Foo", "Foo", "Awesome.", "Can NOT have enough.", @pkid); CALL MakeReview("AUser", "APass", "Eeeh", "i dunn get it.", @pkid); CALL MakeReview("Buser", "BPass", "Okay", "Better than their last..", @pkid); CALL Rate(@pkid, "BUser", "BPass", 4); CALL Rate(@pkid, "AUser", "APass", 1); CALL AddMedia("Bar", "Bar", "Imagine", "2006", "Lennstyle", 120, 1, @pkid); CALL AddCreator("Foo", "Foo", "<NAME>", @pkid); CALL MakeReview("Bar", "Bar", "Its good", "I liked this album.", @pkid); CALL Rate(@pkid, "BUser", "BPass", 2); CALL Rate(@pkid, "AUser", "APass", 3); CALL AddMedia("Bar", "Bar", "Taylor Swift^2", "2012", "New Stuff", 120, 1, @pkid); CALL AddCreator("Foo", "Foo", "Swift", @pkid); CALL AddCreator("Foo", "Foo", "Go", @pkid); CALL AddCreator("Foo", "Foo", "Erlang", @pkid); CALL MakeReview("Bar", "Bar", "Dont Know", "Rammstein def better.", @pkid); CALL MakeReview("Foo", "Foo", "Mediocre", "Nothing new here.", @pkid); CALL MakeReview("AUser", "APass", "^2 ?", "What does it even mean??.", @pkid); CALL Rate(@pkid, "BUser", "BPass", 2); CALL Rate(@pkid, "AUser", "APass", 1); CALL AddMedia("AUser", "APass", "Chipmunks", "2014", "Chipcore", 120, 1, @pkid); CALL AddCreator("Foo", "Foo", "Alvin", @pkid); CALL AddCreator("Foo", "Foo", "Simon", @pkid); CALL AddCreator("Foo", "Foo", "Theodore", @pkid); CALL AddMedia("BUser", "BPass", "Chipmunks: REMIXED", "2014", "Chipcore", 120, 1, @pkid); CALL AddCreator("Foo", "Foo", "Lysette", @pkid); CALL AddCreator("Foo", "Foo", "Aniela", @pkid); -- Adding some movies CALL AddMedia("Bar", "Bar", "The Fellowship", "2004", "Fantasy", 120, 2, @pkid); CALL AddCreator("Foo", "Foo", "<NAME>", @pkid); CALL MakeReview("Bar", "Bar", "One.. ", ".. To rule them all!", @pkid); CALL MakeReview("Foo", "Foo", "Yes", "Will watch again.", @pkid); CALL MakeReview("AUser", "APass", "Unsure", "Too many orcs..", @pkid); CALL MakeReview("Buser", "BPass", "Alright", "Not enough elves..", @pkid); CALL Rate(@pkid, "BUser", "BPass", 5); CALL Rate(@pkid, "AUser", "APass", 5); CALL AddMedia("AUser", "APass", "Two Towers", "2006", "Fantasy", 120, 2, @pkid); CALL AddCreator("Foo", "Foo", "<NAME>", @pkid); CALL MakeReview("Bar", "Bar", "No! Gollum!", "Go away gollum!!", @pkid); CALL MakeReview("Foo", "Foo", "Doom.", "Frodo is doomed.", @pkid); CALL MakeReview("AUser", "APass", "Ents?", "Moving trees? Silly.", @pkid); CALL Rate(@pkid, "BUser", "BPass", 4); CALL Rate(@pkid, "AUser", "APass", 5); CALL AddMedia("Bar", "Bar", "Return of the King", "2008", "Fantasy", 120, 2, @pkid); CALL AddCreator("Foo", "Foo", "<NAME>", @pkid); CALL MakeReview("Bar", "Bar", "By Galadriel!", "This is the End!", @pkid); CALL MakeReview("Foo", "Foo", "Yes", "Will watch again.", @pkid); CALL MakeReview("AUser", "APass", "Unsure", "Too many orcs..", @pkid); CALL MakeReview("Buser", "BPass", "Alright", "Not enough elves..", @pkid); CALL Rate(@pkid, "BUser", "BPass", 5); CALL Rate(@pkid, "AUser", "APass", 5); CALL AddMedia("Foo", "Foo", "Hobbit", "2013", "Fantasy", 120, 2, @pkid); CALL AddCreator("Foo", "Foo", "<NAME>", @pkid); CALL MakeReview("Bar", "Bar", "Hobbits!", "Hobbits Everywhere!", @pkid); CALL MakeReview("Foo", "Foo", "Elves!", "Elves Everywhere!", @pkid); CALL Rate(@pkid, "BUser", "BPass", 3); CALL Rate(@pkid, "AUser", "APass", 5); CALL AddMedia("AUser", "APass", "Hobbit: The Desolation of Smaug", "2014", "Fantasy", 120, 2, @pkid); CALL AddCreator("Foo", "Foo", "<NAME>", @pkid); CALL MakeReview("Buser", "BPass", "Smaug", "He the dragon yo.", @pkid); CALL Rate(@pkid, "BUser", "BPass", 3); CALL Rate(@pkid, "AUser", "APass", 5); CALL AddMedia("AUser", "APass", "Hobbit: Battle of the Five Armies", "2015", "Fantasy", 120, 2, @pkid); CALL AddCreator("Foo", "Foo", "<NAME>", @pkid); CALL MakeReview("Buser", "BPass", "Go Hobbit", "Yay Hobbits. Yay.", @pkid); CALL Rate(@pkid, "BUser", "BPass", 4); CALL Rate(@pkid, "AUser", "APass", 5); -- Adding some books CALL AddMedia("AUser", "APass", "Dragon Reborn", "1993", "Fantasy", 120, 3, @pkid); CALL AddCreator("Foo", "Foo", "<NAME>", @pkid); CALL MakeReview("Bar", "Bar", "Amazing!", "Featuring a compelling story..", @pkid); CALL MakeReview("Foo", "Foo", "Really!?", "The Dragon Is Reborn??", @pkid); CALL MakeReview("AUser", "APass", "Perfection", "Its in the pages..", @pkid); CALL MakeReview("Buser", "BPass", "Need.", "Lost my copy. :(", @pkid); CALL Rate(@pkid, "BUser", "BPass", 5); CALL Rate(@pkid, "AUser", "APass", 5); CALL AddMedia("AUser", "APass", "The Path of Light", "1997", "Fantasy", 120, 3, @pkid); CALL AddCreator("Foo", "Foo", "<NAME>", @pkid); CALL AddCreator("Foo", "Foo", "<NAME>", @pkid); CALL MakeReview("Bar", "Bar", "What Now?", "Got stuck in the nether..", @pkid); CALL MakeReview("Foo", "Foo", "The Light.. !?", ".. It burnsss!", @pkid); CALL Rate(@pkid, "BUser", "BPass", 5); CALL Rate(@pkid, "AUser", "APass", 5); CALL AddMedia("BUser", "BPass", "Thief Althalus", "2000", "Fantasy", 120, 3, @pkid); CALL AddCreator("Foo", "Foo", "<NAME>", @pkid); CALL AddCreator("Foo", "Foo", "<NAME>", @pkid); CALL MakeReview("Foo", "Foo", "Superior.", "The best, very good.", @pkid); CALL MakeReview("AUser", "APass", "TL;DR", "Sorry, too many pages in book!", @pkid); CALL MakeReview("Buser", "BPass", "A Good Read", "Can Recommend.", @pkid); CALL Rate(@pkid, "BUser", "BPass", 4); CALL Rate(@pkid, "AUser", "APass", 5);
<filename>CCDB/database/main_db/character/instance_reset.sql /*!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 */; DROP TABLE IF EXISTS `instance_reset`; CREATE TABLE `instance_reset` ( `mapid` smallint(5) unsigned NOT NULL DEFAULT '0', `difficulty` tinyint(3) unsigned NOT NULL DEFAULT '0', `resettime` int(10) unsigned NOT NULL DEFAULT '0', PRIMARY KEY (`mapid`,`difficulty`), KEY `difficulty` (`difficulty`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; LOCK TABLES `instance_reset` WRITE; /*!40000 ALTER TABLE `instance_reset` DISABLE KEYS */; INSERT INTO `instance_reset` VALUES (33,1,1322452800),(36,1,1322452800),(249,0,1322884800),(249,1,1322884800),(269,1,1322452800),(409,0,1322884800),(469,0,1322884800),(509,0,1322539200),(531,0,1322884800),(532,0,1322884800),(533,0,1322884800),(533,1,1322884800),(534,0,1322884800),(540,1,1322452800),(542,1,1322452800),(543,1,1322452800),(544,0,1322884800),(545,1,1322452800),(546,1,1322452800),(547,1,1322452800),(548,0,1322884800),(550,0,1322884800),(552,1,1322452800),(553,1,1322452800),(554,1,1322452800),(555,1,1322452800),(556,1,1322452800),(557,1,1322452800),(558,1,1322452800),(560,1,1322452800),(564,0,1322884800),(565,0,1322884800),(568,0,1322539200),(574,1,1322452800),(575,1,1322452800),(576,1,1322452800),(578,1,1322452800),(580,0,1322884800),(585,1,1322452800),(595,1,1322452800),(598,1,1322452800),(599,1,1322452800),(600,1,1322452800),(601,1,1322452800),(602,1,1322452800),(603,0,1322884800),(603,1,1322884800),(604,1,1322452800),(608,1,1322452800),(615,0,1322884800),(615,1,1322884800),(616,0,1322884800),(616,1,1322884800),(619,1,1322452800),(624,0,1322884800),(624,1,1322884800),(631,0,1322884800),(631,1,1322884800),(631,2,1322884800),(631,3,1322884800),(632,1,1322452800),(643,1,1322452800),(644,1,1322452800),(645,1,1322452800),(649,0,1322884800),(649,1,1322884800),(649,2,1322884800),(649,3,1322884800),(650,1,1322452800),(657,1,1322452800),(658,1,1322452800),(668,1,1322452800),(669,0,1322884800),(669,1,1322884800),(669,2,1322884800),(669,3,1322884800),(670,1,1322452800),(671,0,1322884800),(671,1,1322884800),(671,2,1322884800),(671,3,1322884800),(724,0,1322884800),(724,1,1322884800),(724,2,1322884800),(724,3,1322884800),(725,1,1322452800),(754,0,1322884800),(754,1,1322884800),(754,2,1322884800),(754,3,1322884800),(755,1,1322452800),(757,0,1322884800),(757,1,1322884800); /*!40000 ALTER TABLE `instance_reset` 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 */;
<gh_stars>0 select * from cashier_bill where date_format(date_created, '%Y-%m') = '2016-08'; select * from cashier_bill_payment where date_format(date_created, '%Y-%m') = '2016-08'; select * from cashier_bill_payment_attribute order by bill_payment_id desc; select * from cashier_payment_mode_attribute_type; select * from cashier_payment_mode; select * from cashier_bill_payment_attribute where value_reference like '%marira%' or value_reference like '%marira%' order by bill_payment_id desc; select * from cashier_bill_payment_attribute where value_reference like '%kijabe%' or value_reference like '%kijabe%' order by bill_payment_id desc; select * from cashier_bill_payment_attribute where payment_mode_attribute_type_id = 3; select * from cashier_bill_payment_attribute where bill_payment_id = 62513;
<filename>rest-api-start/src/test/resources/cql/create-schema.cql DROP KEYSPACE IF EXISTS tuto_rest_api; CREATE KEYSPACE tuto_rest_api WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 }; use tuto_rest_api; DROP TABLE IF EXISTS comments_by_video; CREATE TABLE comments_by_video ( videoid uuid, commentid timeuuid, userid uuid, comment text, PRIMARY KEY ((videoid), commentid) ) WITH CLUSTERING ORDER BY (commentid DESC); CREATE TABLE IF NOT EXISTS comments_by_user ( userid uuid, commentid timeuuid, videoid uuid, comment text, PRIMARY KEY ((userid), commentid) ) WITH CLUSTERING ORDER BY (commentid DESC); truncate comments_by_user; truncate comments_by_video;
<gh_stars>1-10 select count(1) as x from `{{ book_sales_table }}`
<reponame>UAMS-DBMI/PosdaTools<gh_stars>1-10 -- Name: DistinctVisibleSeriesByCollectionSite -- Schema: posda_files -- Columns: ['series_instance_uid', 'dicom_file_type', 'modality', 'count'] -- Args: ['project_name', 'site_name'] -- Tags: ['by_collection', 'find_series', 'compare_collection_site', 'search_series', 'edit_files', 'simple_phi', 'dciodvfy', 'ctp_details', 'select_for_phi', 'visual_review_selection'] -- Description: Get Series in A Collection, site with dicom_file_type, modality, and sop_count -- select distinct series_instance_uid, dicom_file_type, modality, count(distinct file_id) from file_series natural join dicom_file natural join ctp_file where project_name = ? and site_name = ? and visibility is null group by series_instance_uid, dicom_file_type, modality
<gh_stars>0 DROP FUNCTION IF EXISTS CHECK_CALENDAR_DATE; DELIMITER $$ CREATE FUNCTION `CHECK_CALENDAR_DATE`(`currentDate` DATE) RETURNS tinyint(1) BEGIN DECLARE total INT(11) UNSIGNED; DECLARE total_result INT(11) UNSIGNED; SELECT COUNT(calendar_date) INTO total_result FROM `calendar_table` WHERE YEAR(calendar_date) = YEAR(currentDate) LIMIT 1; SET @total = CAST(total_result AS UNSIGNED); IF (@total = 0) THEN CALL FillCalendar(DATE_FORMAT(NOW(),'%Y-01-01'), DATE_FORMAT(NOW(),'%Y-12-31')); END IF; RETURN IF(@total, FALSE, TRUE); END$$ DELIMITER ;
<reponame>guibv/sqlp<filename>tests/v6_pc_isql/sdl009.sql -- MODULE SDL009 -- SQL Test Suite, V6.0, Interactive SQL, sdl009.sql -- 59-byte ID -- TEd Version # -- AUTHORIZATION SULLIVAN SELECT USER FROM HU.ECCO; -- RERUN if USER value does not match preceding AUTHORIZATION comment -- date_time print -- TEST:0145 Fully Qualified Column Spec.! SELECT HU.STAFF.EMPNUM,EMPNAME,HOURS,USER FROM HU.STAFF,HU.WORKS WHERE HU.STAFF.EMPNUM='E1' AND PNUM='P3'; -- PASS:0145 If STAFF.EMPNAME = 'Alice', USER = 'SULLIVAN', HOURS =80? -- END TEST >>> 0145 <<< END TEST -- *************************************************////END-OF-MODULE
create table ad ( pk int(11) AUTO_INCREMENT, col_int_nokey int(11) , col_int_key int(11) , col_date_key date default sysdate, col_date_nokey date default '2011-01-01', col_time_key time default '09:10:10', col_time_nokey time default '09:10:11', col_datetime_key datetime default '2011-01-01 09:10:11', col_datetime_nokey datetime default systimestamp, col_varchar_key varchar(1), col_varchar_nokey varchar(1) default '5', primary key(pk,col_int_nokey) ) partition by range (col_int_nokey) ( partition p400 values less than (400), partition p800 values less than (800), partition pmax values less than MAXVALUE ); insert into ad(pk,col_int_nokey) values(10000,10000); update ad inner join ad__p__pmax as newtable on ad.col_int_nokey=newtable.col_int_nokey set ad.pk=ad.pk+10000; select pk,col_int_nokey from ad; insert into ad(pk,col_int_nokey,col_int_key) values(1,10001,3); insert into ad(pk,col_int_nokey,col_int_key) values(2,1,3); select pk,col_int_nokey,col_int_key from ad; update ad inner join ad__p__pmax as newtable on ad.col_int_key=newtable.col_int_key set ad.pk=ad.pk+10000; select pk,col_int_nokey,col_int_key from ad; drop ad;
ALTER TABLE `auction` ADD COLUMN `enchantgrade` tinyint unsigned NOT NULL default '0'; ALTER TABLE `cart_inventory` ADD COLUMN `enchantgrade` tinyint unsigned NOT NULL default '0'; ALTER TABLE `guild_storage` ADD COLUMN `enchantgrade` tinyint unsigned NOT NULL default '0'; ALTER TABLE `guild_storage_log` ADD COLUMN `enchantgrade` tinyint unsigned NOT NULL default '0'; ALTER TABLE `inventory` ADD COLUMN `enchantgrade` tinyint unsigned NOT NULL default '0'; ALTER TABLE `mail_attachments` ADD COLUMN `enchantgrade` tinyint unsigned NOT NULL default '0'; ALTER TABLE `storage` ADD COLUMN `enchantgrade` tinyint unsigned NOT NULL default '0';
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600189',@CutoffDate = N'2017-09-30',@EPS = N'-0.3',@EPSDeduct = N'0',@Revenue = N'1.80亿',@RevenueYoy = N'-35.73',@RevenueQoq = N'2.28',@Profit = N'-9268.12万',@ProfitYoy = N'-339.03',@ProfiltQoq = N'-248.65',@NAVPerUnit = N'4.2424',@ROE = N'-6.82',@CashPerUnit = N'-0.2778',@GrossProfitRate = N'26.23',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2017-10-27' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600189',@CutoffDate = N'2017-09-30',@EPS = N'-0.3',@EPSDeduct = N'0',@Revenue = N'1.80亿',@RevenueYoy = N'-35.73',@RevenueQoq = N'2.28',@Profit = N'-9268.12万',@ProfitYoy = N'-339.03',@ProfiltQoq = N'-248.65',@NAVPerUnit = N'4.2424',@ROE = N'-6.82',@CashPerUnit = N'-0.2778',@GrossProfitRate = N'26.23',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2017-10-27' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600189',@CutoffDate = N'2017-06-30',@EPS = N'-0.12',@EPSDeduct = N'-0.36',@Revenue = N'1.06亿',@RevenueYoy = N'-40.80',@RevenueQoq = N'106.31',@Profit = N'-3639.26万',@ProfitYoy = N'-160.75',@ProfiltQoq = N'150.99',@NAVPerUnit = N'4.4237',@ROE = N'-2.62',@CashPerUnit = N'-0.2807',@GrossProfitRate = N'24.24',@Distribution = N'不分配不转增',@DividenRate = N'-',@AnnounceDate = N'2017-07-29' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600189',@CutoffDate = N'2016-09-30',@EPS = N'0.12',@EPSDeduct = N'0',@Revenue = N'2.80亿',@RevenueYoy = N'-76.08',@RevenueQoq = N'21.18',@Profit = N'3877.39万',@ProfitYoy = N'143.60',@ProfiltQoq = N'38.25',@NAVPerUnit = N'4.5723',@ROE = N'2.88',@CashPerUnit = N'-1.1194',@GrossProfitRate = N'24.88',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2017-10-27' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600189',@CutoffDate = N'2016-06-30',@EPS = N'0.19',@EPSDeduct = N'-0.27',@Revenue = N'1.80亿',@RevenueYoy = N'-77.20',@RevenueQoq = N'-15.33',@Profit = N'5991.00万',@ProfitYoy = N'333.94',@ProfiltQoq = N'-136.36',@NAVPerUnit = N'4.6404',@ROE = N'4.41',@CashPerUnit = N'-1.2081',@GrossProfitRate = N'23.68',@Distribution = N'不分配不转增',@DividenRate = N'-',@AnnounceDate = N'2017-07-29' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600189',@CutoffDate = N'2016-03-31',@EPS = N'0.3',@EPSDeduct = N'0',@Revenue = N'9735.01万',@RevenueYoy = N'-70.47',@RevenueQoq = N'-49.80',@Profit = N'9413.64万',@ProfitYoy = N'306.98',@ProfiltQoq = N'-29.56',@NAVPerUnit = N'4.8007',@ROE = N'6.85',@CashPerUnit = N'-0.6924',@GrossProfitRate = N'17.67',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2017-04-18' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600189',@CutoffDate = N'2017-03-31',@EPS = N'-0.24',@EPSDeduct = N'0',@Revenue = N'3474.34万',@RevenueYoy = N'-64.31',@RevenueQoq = N'-66.71',@Profit = N'-7425.80万',@ProfitYoy = N'-178.88',@ProfiltQoq = N'-174.43',@NAVPerUnit = N'4.2897',@ROE = N'-5.00',@CashPerUnit = N'-0.4434',@GrossProfitRate = N'16.46',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2017-04-18' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600189',@CutoffDate = N'2015-06-30',@EPS = N'-0.08',@EPSDeduct = N'-0.07',@Revenue = N'7.96亿',@RevenueYoy = N'21.02',@RevenueQoq = N'37.79',@Profit = N'-2560.93万',@ProfitYoy = N'-1157.19',@ProfiltQoq = N'143.69',@NAVPerUnit = N'4.0736',@ROE = N'-1.97',@CashPerUnit = N'-0.0980',@GrossProfitRate = N'28.63',@Distribution = N'不分配不转增',@DividenRate = N'-',@AnnounceDate = N'2016-08-25' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600189',@CutoffDate = N'2015-03-31',@EPS = N'-0.15',@EPSDeduct = N'0',@Revenue = N'3.35亿',@RevenueYoy = N'4.97',@RevenueQoq = N'-29.19',@Profit = N'-4548.14万',@ProfitYoy = N'-86.19',@ProfiltQoq = N'-755.70',@NAVPerUnit = N'4.0823',@ROE = N'-3.52',@CashPerUnit = N'-0.5020',@GrossProfitRate = N'30.17',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2016-04-30' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600189',@CutoffDate = N'2014-12-31',@EPS = N'0.03',@EPSDeduct = N'-0.08',@Revenue = N'14.97亿',@RevenueYoy = N'5.83',@RevenueQoq = N'38.66',@Profit = N'1060.68万',@ProfitYoy = N'-74.23',@ProfiltQoq = N'455.75',@NAVPerUnit = N'4.2288',@ROE = N'0.80',@CashPerUnit = N'0.0124',@GrossProfitRate = N'24.67',@Distribution = N'10派1',@DividenRate = N'0.93',@AnnounceDate = N'2016-04-30' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600189',@CutoffDate = N'2014-09-30',@EPS = N'0.01',@EPSDeduct = N'0',@Revenue = N'10.25亿',@RevenueYoy = N'2.55',@RevenueQoq = N'-5.77',@Profit = N'367.05万',@ProfitYoy = N'-72.05',@ProfiltQoq = N'-95.35',@NAVPerUnit = N'4.2063',@ROE = N'0.27',@CashPerUnit = N'-0.3932',@GrossProfitRate = N'17.91',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2015-10-29' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600189',@CutoffDate = N'2014-06-30',@EPS = N'0.01',@EPSDeduct = N'-0.03',@Revenue = N'6.84亿',@RevenueYoy = N'5.43',@RevenueQoq = N'12.36',@Profit = N'242.24万',@ProfitYoy = N'-77.63',@ProfiltQoq = N'209.92',@NAVPerUnit = N'4.2023',@ROE = N'0.18',@CashPerUnit = N'-0.4047',@GrossProfitRate = N'18.97',@Distribution = N'不分配不转增',@DividenRate = N'-',@AnnounceDate = N'2015-08-21' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600189',@CutoffDate = N'2016-12-31',@EPS = N'0.04',@EPSDeduct = N'-0.76',@Revenue = N'3.84亿',@RevenueYoy = N'-71.51',@RevenueQoq = N'4.49',@Profit = N'1171.52万',@ProfitYoy = N'-73.80',@ProfiltQoq = N'-28.02',@NAVPerUnit = N'4.5288',@ROE = N'0.84',@CashPerUnit = N'-0.1708',@GrossProfitRate = N'32.61',@Distribution = N'不分配不转增',@DividenRate = N'-',@AnnounceDate = N'2017-04-18' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600189',@CutoffDate = N'2015-12-31',@EPS = N'0.14',@EPSDeduct = N'-0.61',@Revenue = N'13.75亿',@RevenueYoy = N'-4.90',@RevenueQoq = N'-49.59',@Profit = N'4470.64万',@ProfitYoy = N'321.49',@ProfiltQoq = N'311.04',@NAVPerUnit = N'4.2757',@ROE = N'3.39',@CashPerUnit = N'0.5034',@GrossProfitRate = N'24.62',@Distribution = N'10派0.5',@DividenRate = N'0.41',@AnnounceDate = N'2017-04-18' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600189',@CutoffDate = N'2015-09-30',@EPS = N'-0.29',@EPSDeduct = N'0',@Revenue = N'11.81亿',@RevenueYoy = N'19.30',@RevenueQoq = N'-16.58',@Profit = N'-8893.41万',@ProfitYoy = N'-2522.94',@ProfiltQoq = N'-418.66',@NAVPerUnit = N'3.8693',@ROE = N'-0.07',@CashPerUnit = N'0.1317',@GrossProfitRate = N'26.46',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2016-10-25' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600189',@CutoffDate = N'2014-03-31',@EPS = N'-0.08',@EPSDeduct = N'0',@Revenue = N'3.22亿',@RevenueYoy = N'42.53',@RevenueQoq = N'-21.64',@Profit = N'-2442.71万',@ProfitYoy = N'24.67',@ProfiltQoq = N'-187.18',@NAVPerUnit = N'4.2171',@ROE = N'-1.85',@CashPerUnit = N'-0.1822',@GrossProfitRate = N'20.76',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2015-04-23' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600189',@CutoffDate = N'2013-12-31',@EPS = N'0.13',@EPSDeduct = N'0.07',@Revenue = N'14.28亿',@RevenueYoy = N'4.57',@RevenueQoq = N'15.65',@Profit = N'4115.34万',@ProfitYoy = N'4.98',@ProfiltQoq = N'1114.36',@NAVPerUnit = N'4.2958',@ROE = N'3.11',@CashPerUnit = N'0.3836',@GrossProfitRate = N'18.74',@Distribution = N'10派1',@DividenRate = N'1.43',@AnnounceDate = N'2015-04-23' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600189',@CutoffDate = N'2013-09-30',@EPS = N'0.04',@EPSDeduct = N'-0.04',@Revenue = N'10.17亿',@RevenueYoy = N'7.15',@RevenueQoq = N'-18.31',@Profit = N'1313.44万',@ProfitYoy = N'122.03',@ProfiltQoq = N'-94.67',@NAVPerUnit = N'4.1987',@ROE = N'0.99',@CashPerUnit = N'-0.3637',@GrossProfitRate = N'17.25',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2014-10-24' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600189',@CutoffDate = N'2013-06-30',@EPS = N'0.03',@EPSDeduct = N'0.01',@Revenue = N'6.62亿',@RevenueYoy = N'10.38',@RevenueQoq = N'91.65',@Profit = N'1082.70万',@ProfitYoy = N'123.19',@ProfiltQoq = N'233.39',@NAVPerUnit = N'4.1912',@ROE = N'0.82',@CashPerUnit = N'0.0615',@GrossProfitRate = N'19.76',@Distribution = N'不分配不转增',@DividenRate = N'-',@AnnounceDate = N'2014-08-15' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600189',@CutoffDate = N'2013-03-31',@EPS = N'-0.1',@EPSDeduct = N'-0.1',@Revenue = N'2.27亿',@RevenueYoy = N'2.84',@RevenueQoq = N'-42.91',@Profit = N'-3242.71万',@ProfitYoy = N'-79.63',@ProfiltQoq = N'-132.81',@NAVPerUnit = N'4.1519',@ROE = N'-2.48',@CashPerUnit = N'-0.5395',@GrossProfitRate = N'19.84',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2014-04-22' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600189',@CutoffDate = N'2012-12-31',@EPS = N'0.13',@EPSDeduct = N'-0.38',@Revenue = N'12.89亿',@RevenueYoy = N'-16.98',@RevenueQoq = N'19.76',@Profit = N'3919.93万',@ProfitYoy = N'-48.53',@ProfiltQoq = N'864.02',@NAVPerUnit = N'4.2564',@ROE = N'2.95',@CashPerUnit = N'-0.8018',@GrossProfitRate = N'17.67',@Distribution = N'10派1',@DividenRate = N'1.35',@AnnounceDate = N'2014-04-22' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600189',@CutoffDate = N'2012-09-30',@EPS = N'-0.19',@EPSDeduct = N'-0.35',@Revenue = N'8.92亿',@RevenueYoy = N'-21.53',@RevenueQoq = N'-3.95',@Profit = N'-5962.80万',@ProfitYoy = N'-330.71',@ProfiltQoq = N'54.84',@NAVPerUnit = N'3.9381',@ROE = N'-4.54',@CashPerUnit = N'-0.8105',@GrossProfitRate = N'14.73',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2013-10-26' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600189',@CutoffDate = N'2012-06-30',@EPS = N'-0.15',@EPSDeduct = N'-0.29',@Revenue = N'5.60亿',@RevenueYoy = N'-26.20',@RevenueQoq = N'61.28',@Profit = N'-4669.28万',@ProfitYoy = N'-263.14',@ProfiltQoq = N'-58.65',@NAVPerUnit = N'3.9798',@ROE = N'-3.53',@CashPerUnit = N'-0.5091',@GrossProfitRate = N'14.27',@Distribution = N'不分配不转增',@DividenRate = N'-',@AnnounceDate = N'2013-08-24' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600189',@CutoffDate = N'2012-03-31',@EPS = N'-0.06',@EPSDeduct = N'-0.14',@Revenue = N'2.14亿',@RevenueYoy = N'-34.13',@RevenueQoq = N'-47.26',@Profit = N'-1805.26万',@ProfitYoy = N'-112.33',@ProfiltQoq = N'-135.88',@NAVPerUnit = N'4.2720',@ROE = N'-1.35',@CashPerUnit = N'-0.4482',@GrossProfitRate = N'20.12',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2013-04-27' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600189',@CutoffDate = N'2011-12-31',@EPS = N'0.25',@EPSDeduct = N'-0.05',@Revenue = N'15.43亿',@RevenueYoy = N'9.36',@RevenueQoq = N'7.53',@Profit = N'7615.60万',@ProfitYoy = N'45.55',@ProfiltQoq = N'1913.01',@NAVPerUnit = N'4.3301',@ROE = N'5.77',@CashPerUnit = N'0.0176',@GrossProfitRate = N'19.64',@Distribution = N'10派2',@DividenRate = N'3.44',@AnnounceDate = N'2013-04-27' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600189',@CutoffDate = N'2011-09-30',@EPS = N'0.08',@EPSDeduct = N'-0.1',@Revenue = N'11.36亿',@RevenueYoy = N'14.45',@RevenueQoq = N'-12.80',@Profit = N'2584.59万',@ProfitYoy = N'-19.71',@ProfiltQoq = N'-107.47',@NAVPerUnit = N'4.1600',@ROE = N'1.97',@CashPerUnit = N'-0.5321',@GrossProfitRate = N'19.38',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2012-10-29' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600189',@CutoffDate = N'2011-06-30',@EPS = N'0.09',@EPSDeduct = N'0.02',@Revenue = N'7.59亿',@RevenueYoy = N'14.54',@RevenueQoq = N'33.19',@Profit = N'2862.09万',@ProfitYoy = N'0.99',@ProfiltQoq = N'536.64',@NAVPerUnit = N'4.1700',@ROE = N'2.18',@CashPerUnit = N'-0.2142',@GrossProfitRate = N'22.25',@Distribution = N'不分配不转增',@DividenRate = N'-',@AnnounceDate = N'2012-08-21' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600189',@CutoffDate = N'2011-03-31',@EPS = N'-0.03',@EPSDeduct = N'-0.03',@Revenue = N'3.25亿',@RevenueYoy = N'14.48',@RevenueQoq = N'-22.11',@Profit = N'-850.20万',@ProfitYoy = N'-213.32',@ProfiltQoq = N'-142.24',@NAVPerUnit = N'4.1500',@ROE = N'-0.66',@CashPerUnit = N'-0.1796',@GrossProfitRate = N'24.20',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2012-04-19' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600189',@CutoffDate = N'2010-12-31',@EPS = N'0.17',@EPSDeduct = N'0.17',@Revenue = N'14.11亿',@RevenueYoy = N'10.74',@RevenueQoq = N'26.31',@Profit = N'5232.17万',@ProfitYoy = N'351.56',@ProfiltQoq = N'422.42',@NAVPerUnit = N'4.1803',@ROE = N'4.06',@CashPerUnit = N'-0.9306',@GrossProfitRate = N'22.27',@Distribution = N'10派1',@DividenRate = N'0.96',@AnnounceDate = N'2012-04-19' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600189',@CutoffDate = N'2010-09-30',@EPS = N'0.1',@EPSDeduct = N'0.11',@Revenue = N'9.93亿',@RevenueYoy = N'10.74',@RevenueQoq = N'-12.56',@Profit = N'3219.21万',@ProfitYoy = N'338.09',@ProfiltQoq = N'-81.51',@NAVPerUnit = N'4.1200',@ROE = N'2.49',@CashPerUnit = N'-1.2241',@GrossProfitRate = N'21.93',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2011-10-27' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600189',@CutoffDate = N'2010-06-30',@EPS = N'0.09',@EPSDeduct = N'0.09',@Revenue = N'6.62亿',@RevenueYoy = N'23.38',@RevenueQoq = N'33.07',@Profit = N'2833.90万',@ProfitYoy = N'218.11',@ProfiltQoq = N'177.72',@NAVPerUnit = N'4.1000',@ROE = N'2.20',@CashPerUnit = N'-0.0452',@GrossProfitRate = N'22.80',@Distribution = N'不分配不转增',@DividenRate = N'-',@AnnounceDate = N'2011-07-30' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600189',@CutoffDate = N'2010-03-31',@EPS = N'0.02',@EPSDeduct = N'0.02',@Revenue = N'2.84亿',@RevenueYoy = N'37.11',@RevenueQoq = N'-24.64',@Profit = N'750.26万',@ProfitYoy = N'147.60',@ProfiltQoq = N'-70.12',@NAVPerUnit = N'4.1400',@ROE = N'0.59',@CashPerUnit = N'-0.1362',@GrossProfitRate = N'22.74',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2011-04-15' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600189',@CutoffDate = N'2009-12-31',@EPS = N'0.04',@EPSDeduct = N'0.03',@Revenue = N'12.74亿',@RevenueYoy = N'-22.71',@RevenueQoq = N'4.78',@Profit = N'1158.70万',@ProfitYoy = N'-73.05',@ProfiltQoq = N'139.74',@NAVPerUnit = N'4.1100',@ROE = N'0.89',@CashPerUnit = N'0.6920',@GrossProfitRate = N'20.96',@Distribution = N'10派1',@DividenRate = N'1.24',@AnnounceDate = N'2011-04-15' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600189',@CutoffDate = N'2009-09-30',@EPS = N'-0.04',@EPSDeduct = N'-0.04',@Revenue = N'8.97亿',@RevenueYoy = N'-27.11',@RevenueQoq = N'9.21',@Profit = N'-1352.11万',@ProfitYoy = N'-135.05',@ProfiltQoq = N'227.23',@NAVPerUnit = N'4.0800',@ROE = N'-',@CashPerUnit = N'0.2040',@GrossProfitRate = N'21.91',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2010-10-30' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600189',@CutoffDate = N'2009-06-30',@EPS = N'-0.08',@EPSDeduct = N'-0.07',@Revenue = N'5.37亿',@RevenueYoy = N'-35.36',@RevenueQoq = N'59.00',@Profit = N'-2399.39万',@ProfitYoy = N'-187.65',@ProfiltQoq = N'47.78',@NAVPerUnit = N'4.1500',@ROE = N'-1.85',@CashPerUnit = N'0.0351',@GrossProfitRate = N'22.23',@Distribution = N'不分配不转增',@DividenRate = N'-',@AnnounceDate = N'2010-08-27' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600189',@CutoffDate = N'2009-03-31',@EPS = N'-0.05',@EPSDeduct = N'-0.05',@Revenue = N'2.07亿',@RevenueYoy = N'-43.60',@RevenueQoq = N'-50.39',@Profit = N'-1576.23万',@ProfitYoy = N'-433.30',@ProfiltQoq = N'-457.26',@NAVPerUnit = N'4.1700',@ROE = N'-',@CashPerUnit = N'-0.1050',@GrossProfitRate = N'28.82',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2010-04-24' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600189',@CutoffDate = N'2008-12-31',@EPS = N'0.14',@EPSDeduct = N'0.14',@Revenue = N'16.48亿',@RevenueYoy = N'5.13',@RevenueQoq = N'4.50',@Profit = N'4299.14万',@ProfitYoy = N'-10.70',@ProfiltQoq = N'-60.62',@NAVPerUnit = N'4.2200',@ROE = N'3.10',@CashPerUnit = N'0.0510',@GrossProfitRate = N'22.29',@Distribution = N'10派1',@DividenRate = N'1.20',@AnnounceDate = N'2010-04-02' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600189',@CutoffDate = N'2008-09-30',@EPS = N'0.12',@EPSDeduct = N'0.134',@Revenue = N'12.30亿',@RevenueYoy = N'7.58',@RevenueQoq = N'-13.64',@Profit = N'3857.94万',@ProfitYoy = N'2.73',@ProfiltQoq = N'-50.53',@NAVPerUnit = N'4.2000',@ROE = N'-',@CashPerUnit = N'-0.2312',@GrossProfitRate = N'21.11',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2009-10-24' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600189',@CutoffDate = N'2008-06-30',@EPS = N'0.09',@EPSDeduct = N'0.091',@Revenue = N'8.30亿',@RevenueYoy = N'14.25',@RevenueQoq = N'25.98',@Profit = N'2737.56万',@ProfitYoy = N'47.57',@ProfiltQoq = N'378.87',@NAVPerUnit = N'4.1600',@ROE = N'2.09',@CashPerUnit = N'-0.1903',@GrossProfitRate = N'21.74',@Distribution = N'不分配不转增',@DividenRate = N'-',@AnnounceDate = N'2009-08-13' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600189',@CutoffDate = N'2007-06-30',@EPS = N'0.06',@EPSDeduct = N'0.06',@Revenue = N'7.27亿',@RevenueYoy = N'19.99',@RevenueQoq = N'20.88',@Profit = N'1855.04万',@ProfitYoy = N'-26.01',@ProfiltQoq = N'-33.11',@NAVPerUnit = N'4.2900',@ROE = N'1.45',@CashPerUnit = N'-0.0987',@GrossProfitRate = N'24.76',@Distribution = N'不分配不转增',@DividenRate = N'-',@AnnounceDate = N'2008-08-25' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600189',@CutoffDate = N'2007-03-31',@EPS = N'0.035',@EPSDeduct = N'0',@Revenue = N'3.29亿',@RevenueYoy = N'19.00',@RevenueQoq = N'-16.14',@Profit = N'1089.34万',@ProfitYoy = N'-19.21',@ProfiltQoq = N'-38.87',@NAVPerUnit = N'4.2600',@ROE = N'-',@CashPerUnit = N'-0.1931',@GrossProfitRate = N'26.95',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2008-04-19' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600189',@CutoffDate = N'2006-12-31',@EPS = N'0.19',@EPSDeduct = N'0.19',@Revenue = N'13.38亿',@RevenueYoy = N'14.68',@RevenueQoq = N'15.36',@Profit = N'6001.44万',@ProfitYoy = N'-22.10',@ProfiltQoq = N'21.04',@NAVPerUnit = N'4.2200',@ROE = N'4.95',@CashPerUnit = N'0.5986',@GrossProfitRate = N'22.47',@Distribution = N'不分配不转增',@DividenRate = N'-',@AnnounceDate = N'2008-03-28' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600189',@CutoffDate = N'2006-09-30',@EPS = N'0.13',@EPSDeduct = N'0',@Revenue = N'9.46亿',@RevenueYoy = N'7.04',@RevenueQoq = N'3.32',@Profit = N'4128.96万',@ProfitYoy = N'-43.46',@ProfiltQoq = N'32.77',@NAVPerUnit = N'4.1700',@ROE = N'-',@CashPerUnit = N'0.0614',@GrossProfitRate = N'24.06',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2007-10-16' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600189',@CutoffDate = N'2008-03-31',@EPS = N'0.02',@EPSDeduct = N'0.012',@Revenue = N'3.67亿',@RevenueYoy = N'11.68',@RevenueQoq = N'-13.35',@Profit = N'472.91万',@ProfitYoy = N'-56.59',@ProfiltQoq = N'-52.88',@NAVPerUnit = N'4.1900',@ROE = N'-',@CashPerUnit = N'-0.1992',@GrossProfitRate = N'21.97',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2009-04-25' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600189',@CutoffDate = N'2006-06-30',@EPS = N'0.08',@EPSDeduct = N'0',@Revenue = N'6.06亿',@RevenueYoy = N'4.97',@RevenueQoq = N'19.05',@Profit = N'2581.99万',@ProfitYoy = N'-48.59',@ProfiltQoq = N'-17.76',@NAVPerUnit = N'4.1200',@ROE = N'1.92',@CashPerUnit = N'0.0657',@GrossProfitRate = N'25.92',@Distribution = N'不分配不转增',@DividenRate = N'-',@AnnounceDate = N'2007-08-14' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600189',@CutoffDate = N'2006-03-31',@EPS = N'0.046',@EPSDeduct = N'0',@Revenue = N'2.77亿',@RevenueYoy = N'14.13',@RevenueQoq = N'-2.36',@Profit = N'1416.80万',@ProfitYoy = N'-27.99',@ProfiltQoq = N'253.38',@NAVPerUnit = N'4.3800',@ROE = N'-',@CashPerUnit = N'-0.0924',@GrossProfitRate = N'27.91',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2007-04-18' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600189',@CutoffDate = N'2007-09-30',@EPS = N'0.121',@EPSDeduct = N'0.13',@Revenue = N'11.44亿',@RevenueYoy = N'20.90',@RevenueQoq = N'4.77',@Profit = N'3755.45万',@ProfitYoy = N'-7.71',@ProfiltQoq = N'148.19',@NAVPerUnit = N'4.3500',@ROE = N'-',@CashPerUnit = N'-0.0118',@GrossProfitRate = N'23.10',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2008-10-25' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600189',@CutoffDate = N'2005-12-31',@EPS = N'0.25',@EPSDeduct = N'0',@Revenue = N'11.67亿',@RevenueYoy = N'4.16',@RevenueQoq = N'-7.64',@Profit = N'7703.76万',@ProfitYoy = N'-22.81',@ProfiltQoq = N'-82.42',@NAVPerUnit = N'4.3300',@ROE = N'5.79',@CashPerUnit = N'0.1779',@GrossProfitRate = N'24.98',@Distribution = N'10派3',@DividenRate = N'7.09',@AnnounceDate = N'2007-03-28' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600189',@CutoffDate = N'2007-12-31',@EPS = N'0.16',@EPSDeduct = N'0.15',@Revenue = N'15.68亿',@RevenueYoy = N'17.14',@RevenueQoq = N'1.76',@Profit = N'4814.34万',@ProfitYoy = N'-19.78',@ProfiltQoq = N'-47.19',@NAVPerUnit = N'4.1700',@ROE = N'3.79',@CashPerUnit = N'0.3756',@GrossProfitRate = N'22.39',@Distribution = N'10派1',@DividenRate = N'1.09',@AnnounceDate = N'2009-04-25' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600189',@CutoffDate = N'2005-06-30',@EPS = N'0.16',@EPSDeduct = N'0',@Revenue = N'5.77亿',@RevenueYoy = N'5.85',@RevenueQoq = N'38.18',@Profit = N'5022.10万',@ProfitYoy = N'-1.16',@ProfiltQoq = N'55.25',@NAVPerUnit = N'4.2500',@ROE = N'3.62',@CashPerUnit = N'-0.2130',@GrossProfitRate = N'25.38',@Distribution = N'不分配不转增',@DividenRate = N'-',@AnnounceDate = N'2006-08-18' EXEC [EST].[Proc_yjbb_Ins] @Code = N'600189',@CutoffDate = N'2005-09-30',@EPS = N'0',@EPSDeduct = N'0',@Revenue = N'8.84亿',@RevenueYoy = N'2.08',@RevenueQoq = N'-8.41',@Profit = N'7302.83万',@ProfitYoy = N'-6.78',@ProfiltQoq = N'-25.33',@NAVPerUnit = N'4.3300',@ROE = N'-',@CashPerUnit = N'-0.2152',@GrossProfitRate = N'25.04',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2006-10-14'
<reponame>DebashishSau/online_food_ordering_system -- phpMyAdmin SQL Dump -- version 5.1.0 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Generation Time: May 02, 2021 at 02:12 PM -- Server version: 10.4.18-MariaDB -- PHP Version: 8.0.3 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: `online food ordering system 3` -- -- -------------------------------------------------------- -- -- Table structure for table `cart` -- CREATE TABLE `cart` ( `id` int(11) NOT NULL, `qty` int(25) NOT NULL, `cid` int(11) NOT NULL, `pid` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `cart` -- INSERT INTO `cart` (`id`, `qty`, `cid`, `pid`) VALUES (1, 10, 1, 25), (169, 9, 5, 28); -- -------------------------------------------------------- -- -- Table structure for table `customer` -- CREATE TABLE `customer` ( `cid` int(11) NOT NULL, `name` varchar(30) NOT NULL, `email` varchar(30) NOT NULL, `pwd` varchar(100) NOT NULL, `phonenumber` int(10) NOT NULL, `address` text NOT NULL, `img` varchar(200) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `customer` -- INSERT INTO `customer` (`cid`, `name`, `email`, `pwd`, `phonenumber`, `address`, `img`) VALUES (1, '<NAME>', '<EMAIL>', <PASSWORD>', 1226248366, 'abc mumbai', 'profilpic/1575574781_chef-2.jpg'), (2, '<NAME>', '<EMAIL>', <PASSWORD>', 2147483647, 'xyz surat', 'profilpic/1575632563_chef-3.jpg'), (3, '<NAME>', '<EMAIL>', <PASSWORD>', 2147483647, 'begusarai', 'profilpic/1575719736_32.jpg'), (4, '<NAME>', '<EMAIL>', <PASSWORD>', 2147483647, 'puducherry', 'profilpic/default-avatar.jpg'), (5, 'Swapnanil ', '<EMAIL>', 'helloworld', 666666, 'dubai', 'progiler.jpg'); -- -------------------------------------------------------- -- -- Table structure for table `employee` -- CREATE TABLE `employee` ( `eid` int(11) NOT NULL, `name` varchar(30) NOT NULL, `phno` int(10) NOT NULL, `email` varchar(32) NOT NULL, `password` varchar(120) NOT NULL, `type` varchar(50) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `employee` -- INSERT INTO `employee` (`eid`, `name`, `phno`, `email`, `password`, `type`) VALUES (1, 'admin', 2147483647, '<EMAIL>', <PASSWORD>', 'admin'), (2, 'ghazi', 2147483647, '<EMAIL>', <PASSWORD>', 'employe'), (3, 'aman', 2147483647, '<EMAIL>', <PASSWORD>', 'admin'), (4, 'debs', 2147483647, '<EMAIL>', <PASSWORD>', 'employe'); -- -------------------------------------------------------- -- -- Table structure for table `myorders` -- CREATE TABLE `myorders` ( `oid` int(11) NOT NULL, `qty` int(25) NOT NULL, `status` int(11) NOT NULL, `pid` int(11) NOT NULL, `cid` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `myorders` -- INSERT INTO `myorders` (`oid`, `qty`, `status`, `pid`, `cid`) VALUES (1, 10, 1, 25, 1), (97, 9, 0, 28, 5); -- -------------------------------------------------------- -- -- Table structure for table `product` -- CREATE TABLE `product` ( `pid` int(11) NOT NULL, `name` varchar(120) NOT NULL, `description` text NOT NULL, `price` int(10) NOT NULL, `file` text NOT NULL, `type` varchar(20) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `product` -- INSERT INTO `product` (`pid`, `name`, `description`, `price`, `file`, `type`) VALUES (25, 'Mutton Whopper Double Patty', 'Two much mutton as delicious flame-grilled patties, farm-fresh veggies and mayo is what makes this Mutton Double Whopper a feast for the beast.', 389, '1575672841_63.jpg', 'breakfast'), (26, 'Chicken Whopper Double Patty', 'Our signature Whopper with 7 layers between the buns. Flame Grilled chicken Double Patty, fresh onion, crispy lettuce, juicy tomatoes, tangy gherkins, creamy and smoky sauces with xxl buns. It’s Not A Burger, it’s a Whopper.', 219, '1575673264_47.jpg', 'breakfast'), (27, 'Mutton Whopper', 'Flame grilled signature Mutton patty Whopper', 259, '1575673319_25.jpg', 'breakfast'), (28, 'Veg Whopper Combo', 'Our signature Whopper with 7 layers between the buns. Extra crunchy veg Patty, fresh onion, crispy lettuce, juicy tomatoes, tangy gherkins, creamy and smoky sauces with xxl buns. It’s Not A Burger, it’s a Whopper + Fries + Pepsi', 276, '1575673361_61.jpg', 'lunch'), (29, 'Fiery Chicken - Combo', ' Too Hot to Handle. Our Spicy & Crunchy Chicken Patty topped with crispy lettuce, juicy tomatoes and creamy sauce with our unique corn dust buns. An indulgent treat from our Kings Collection! Comes with fries + Pepsi', 306, '1575673417_62.jpg', 'lunch'), (31, 'Lite Whopper Jr Veg Combo', 'Our signature Whopper with 7 layers between the buns in a convenient size. Extra crunchy veg Patty, fresh onion, crispy lettuce, juicy tomatoes, tangy gherkins, creamy and smoky sauces. Comes with Fries + Pepsi', 236, '1575673511_63.jpg', 'lunch'), (32, 'Mutton Whopper - Combo', 'Make room for our fully loaded Whopper with a juicy, flame-grilled Mutton Patty, tangy pickles, fresh veggies, mayo and ketchup served in fresh 5\" buns. Comes with Fries + Exclusive Pepsi can.', 386, '1575673945_42.jfif', 'breakfast'), (33, 'Cheese Melt down combo', 'Cheese oozing spicy veg patty, veggies and creamy sauce. An indulgent treat from our Kings Collection! Comes with Fries + Pepsi', 296, '1575673983_42.jfif', 'breakfast'); -- -------------------------------------------------------- -- -- Table structure for table `vehicle` -- CREATE TABLE `vehicle` ( `vid` int(10) UNSIGNED NOT NULL, `oid` int(11) NOT NULL, `status` int(2) NOT NULL, `regnumber` varchar(50) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `vehicle` -- INSERT INTO `vehicle` (`vid`, `oid`, `status`, `regnumber`) VALUES (1, 1, 1, 'fsffs2332'), (3, 97, 1, 'gsd2323'); -- -- Indexes for dumped tables -- -- -- Indexes for table `cart` -- ALTER TABLE `cart` ADD PRIMARY KEY (`id`), ADD KEY `cid` (`cid`), ADD KEY `pid` (`pid`); -- -- Indexes for table `customer` -- ALTER TABLE `customer` ADD PRIMARY KEY (`cid`); -- -- Indexes for table `employee` -- ALTER TABLE `employee` ADD PRIMARY KEY (`eid`); -- -- Indexes for table `myorders` -- ALTER TABLE `myorders` ADD PRIMARY KEY (`oid`), ADD KEY `pid` (`pid`), ADD KEY `cid` (`cid`); -- -- Indexes for table `product` -- ALTER TABLE `product` ADD PRIMARY KEY (`pid`); -- -- Indexes for table `vehicle` -- ALTER TABLE `vehicle` ADD PRIMARY KEY (`vid`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `cart` -- ALTER TABLE `cart` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=170; -- -- AUTO_INCREMENT for table `customer` -- ALTER TABLE `customer` MODIFY `cid` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6; -- -- AUTO_INCREMENT for table `employee` -- ALTER TABLE `employee` MODIFY `eid` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=22; -- -- AUTO_INCREMENT for table `myorders` -- ALTER TABLE `myorders` MODIFY `oid` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=98; -- -- AUTO_INCREMENT for table `product` -- ALTER TABLE `product` MODIFY `pid` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=40; -- -- AUTO_INCREMENT for table `vehicle` -- ALTER TABLE `vehicle` MODIFY `vid` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; -- -- Constraints for dumped tables -- -- -- Constraints for table `cart` -- ALTER TABLE `cart` ADD CONSTRAINT `cart_ibfk_1` FOREIGN KEY (`cid`) REFERENCES `customer` (`cid`) ON UPDATE CASCADE, ADD CONSTRAINT `cart_ibfk_2` FOREIGN KEY (`pid`) REFERENCES `product` (`pid`) ON UPDATE CASCADE; -- -- Constraints for table `myorders` -- ALTER TABLE `myorders` ADD CONSTRAINT `myorders_ibfk_1` FOREIGN KEY (`pid`) REFERENCES `cart` (`pid`), ADD CONSTRAINT `myorders_ibfk_2` FOREIGN KEY (`cid`) REFERENCES `cart` (`cid`); -- -- Constraints for table `vehicle` -- ALTER TABLE `vehicle` ADD CONSTRAINT `vehicle_ibfk_1` FOREIGN KEY (`oid`) REFERENCES `myorders` (`oid`); 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 */;
<gh_stars>0 insert into debt (debt_id, expiry_date, main_debt, user_id) values (1, '2018-02-27 06:47:19', 861.35, 1); insert into debt (debt_id, expiry_date, main_debt, user_id) values (2, '2020-06-10 04:42:42', 1286.94, 2); insert into debt (debt_id, expiry_date, main_debt, user_id) values (3, '2021-01-21 20:34:35', 607.36, 3); insert into debt (debt_id, expiry_date, main_debt, user_id) values (4, '2017-06-17 05:43:07', 788.34, 4); insert into debt (debt_id, expiry_date, main_debt, user_id) values (5, '2015-09-03 18:59:04', 1455.27, 5);
-- phpMyAdmin SQL Dump -- version 4.2.12deb2+deb8u1 -- http://www.phpmyadmin.net -- -- Client : localhost -- Généré le : Mer 23 Mars 2016 à 00:12 -- Version du serveur : 5.5.47-0+deb8u1 -- Version de PHP : 5.6.17-0+deb8u1 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; 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 utf8 */; -- -- Base de données : `website` -- -- -------------------------------------------------------- -- -- Structure de la table `project` -- CREATE TABLE IF NOT EXISTS `project` ( `id` int(11) NOT NULL, `visible` tinyint(1) NOT NULL, `date` date NOT NULL, `thumbnail` varchar(255) NOT NULL ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1; -- -- Contenu de la table `project` -- INSERT INTO `project` (`id`, `visible`, `date`, `thumbnail`) VALUES (1, 1, '2016-03-22', 'pathImg'); -- -- Index pour les tables exportées -- -- -- Index pour la table `project` -- ALTER TABLE `project` ADD PRIMARY KEY (`id`); -- -- AUTO_INCREMENT pour les tables exportées -- -- -- AUTO_INCREMENT pour la table `project` -- ALTER TABLE `project` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=2; /*!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 TABLE AIRPLANES ( AIRPLANE_ID INT PRIMARY KEY, AIRPLANE_MODEL_ID INT, CONSTRAINT FK_AIRMDL_ID FOREIGN KEY(AIRPLANE_MODEL_ID) REFERENCES AIRPLANE_MODELS(AIRPLANE_MODEL_ID) ); CREATE SEQUENCE SEQ_AIRP_ID;
<gh_stars>0 `id` int(11), # you know, the id `style` `cord_length` `cord_position` `mount` `notes` `total_options_price` `total_price` `stringing_notes` `stringing_type` `actual_height_feet` `actual_linear_feet` `actual_square_feet` `adjusted_height` `adjusted_height_feet` `adjusted_linear_feet` `adjusted_square_feet` `adjusted_width` `fabric_color` `fabric_name` `fabric_upcharge` `fabric_width` `fabric_color3` `fabric_color4` `fabric_type3` `fabric_type4` `lining` `lining_color` `lining_width` # MANUFACTURING VALUES # The following are a series of multipliers, divisors or additions made to fabric as # dictated by how much fabric the style consumes. Also, those ending in "inv" exist # because often there is an upcharge to the customer of fabric. I.e, it may take 6 # yards of fabric to make, but they will upcharge to 8 yards due to difficulty. `cut_length_add` `cut_length_formula` `double_tuk_panels` `headerboard_depth` `height_to_soft_casuals` `length` `length_plus` `length_plus_calc` `length_times` `line_feet_height` `line_feet_width` `mfg_length` `mfg_mod_length` `outer_rings` `panel_count` `panels` `panels_for_double_tuk` `panels_for_triple_tuk` `panels_spacing_difference` `panels_count` `panels_display` `panels_pacing` `panels_spacing_adjusted` `panels_spacing_values` `panels_skirt_pointer` `repeat` `return` `ring_notes` `ring_type` `rings_count` `rings_divisor` `rings_pacing` `rush_charge` `rush_order` `shade_number` `shade_price` `shade_value` `soft_fold_space_amount` `tassel_calc` `tassel_color` `tdbu_deduction` `tdbu_deduction_clutch` `tdbu_deduction_cord_lock` `tdbu_deduction_motorized` `top_panel_spacing` `triple_tuk_panels` `width` `width_plus` `width_plus_calc` `width_times` `width_minus_outer_rings` `width_plus_return` `widths` `wood_size` `wood_size_ticket` `wood_ticket_text` `wood_width` `yardage` `lining` # PROBABLY NOT USED `current_invoice` `options_compilation` `options_concat` `options_price_summary` `duplicate_record_compilation` `hardware_concat` `lining_constant` `panelssum` `total_options_count` `label_text` `label_text_company_name` `number` `side_mark` `seamstress_notes` `stylecode`
-- More JOIN operations Tutorial -- 1. List the films where the yr is 1962 [Show id, title]: SELECT id, title FROM movie WHERE yr = 1962 -- 2. Give year of 'Citizen Kane': SELECT yr FROM movie WHERE title = 'Citizen Kane' -- 3. List all of the Star Trek movies, include the id, title and yr (all of these movies include the words Star Trek in the title). Order results by year: SELECT id, title, yr FROM movie WHERE title LIKE '%Star Trek%' ORDER BY yr -- 4. What id number does the actor '<NAME>' have? SELECT id FROM actor WHERE name = '<NAME>' -- 5. What is the id of the film 'Casablanca': SELECT id FROM movie WHERE title = 'Casablanca' -- 6. Obtain the cast list for 'Casablanca': SELECT name FROM actor JOIN casting ON (actor.id = casting.actorid) WHERE movieid = 11768 -- 7. Obtain the cast list for the film 'Alien': SELECT name FROM actor JOIN casting ON (actor.id = casting.actorid) JOIN movie ON (casting.movieid = movie.id) WHERE title = 'Alien' -- 8. List the films in which '<NAME>' has appeared: SELECT title FROM movie JOIN casting ON (movie.id = casting.movieid) JOIN actor ON (casting.actorid = actor.id) WHERE name = '<NAME>' -- 9. List the films where '<NAME>' has appeared - but not in the starring role: SELECT title FROM movie JOIN casting ON (movie.id = casting.movieid) JOIN actor ON (casting.actorid = actor.id) WHERE name = '<NAME>' AND ord != 1 -- 10. List the films together with the leading star for all 1962 films: SELECT title, name FROM movie JOIN casting ON (movie.id = casting.movieid) JOIN actor ON (casting.actorid = actor.id) WHERE yr = 1962 AND ord = 1 -- 11. Which were the busiest years for '<NAME>', show the year and the number of movies he made each year for any year in which he made more than 2 movies: SELECT yr, COUNT(title) FROM movie JOIN casting ON (movie.id = casting.movieid) JOIN actor ON (casting.actorid = actor.id) WHERE name = '<NAME>' GROUP BY yr HAVING COUNT(title) > 2 -- 12. List the film title and the leading actor for all of the films '<NAME>' played in: SELECT title, name FROM movie JOIN casting ON (movie.id = casting.movieid) JOIN actor ON (casting.actorid = actor.id) WHERE ord = 1 AND movie.id IN ( SELECT movieid FROM casting WHERE actorid = ( SELECT id FROM actor WHERE name = '<NAME>' ) ) -- 13. Obtain a list, in alphabetical order, of actors who've had at least 15 starring roles: SELECT name FROM casting JOIN actor ON (casting.actorid = actor.id) WHERE ord = 1 GROUP BY name HAVING COUNT(ord) > 14 -- 14. List the films released in the year 1978 ordered by the number of actors in the cast, then by title: SELECT title, COUNT(*) FROM movie JOIN casting ON (movie.id = casting.movieid) WHERE yr = 1978 GROUP BY title ORDER BY COUNT(*) DESC, title -- 15. List all the people who have worked with '<NAME>': SELECT name FROM actor JOIN casting ON (actor.id = casting.actorid) JOIN movie ON (casting.movieid = movie.id) WHERE name != '<NAME>' AND movie.id IN ( SELECT movieid FROM casting WHERE actorid = ( SELECT id FROM actor WHERE name = '<NAME>' ) )
<reponame>lgcarrier/AFW SET DEFINE OFF; ALTER TABLE AFW_11_ENTIT ADD ( CONSTRAINT AFW_11_ENTIT_FK2 FOREIGN KEY (REF_ATRIB_ENTIT_SUPR) REFERENCES AFW_11_ATRIB_ENTIT (SEQNC) ON DELETE SET NULL DISABLE NOVALIDATE) /
<gh_stars>1-10 ALTER TABLE sample.sample_unit ADD UNIQUE (sample_unit_ref, sample_summary_fk);
-- Inserir valores em uma tabela. INSERT INTO TABELA (COLUNAS) VALUES (VALORES);
USE exploration GO SET NOCOUNT ON GO DROP TABLE IF EXISTS PRODUCT GO CREATE TABLE PRODUCT ( ID char(1), MAXIMUM_PAGE_CAPACITY varchar(8000) ) GO insert into PRODUCT (ID, MAXIMUM_PAGE_CAPACITY) values ('1', replicate('A', 1000)) insert into PRODUCT (ID, MAXIMUM_PAGE_CAPACITY) values ('2', replicate('B', 4000)) insert into PRODUCT (ID, MAXIMUM_PAGE_CAPACITY) values ('3', replicate('C', 8000)) update PRODUCT set MAXIMUM_PAGE_CAPACITY = replicate('A', 8000) where ID = '1' GO select index_type_desc, page_count, record_count, forwarded_record_count from sys.dm_db_index_physical_stats(db_id(), object_id('PRODUCT'), null, null, 'detailed') select %%lockres%%, ID from PRODUCT declare @page int select top 1 @page = allocated_page_page_id from sys.dm_db_database_page_allocations(DB_ID(), OBJECT_ID(N'PRODUCT', N'U'), 0, NULL, N'DETAILED') where page_type_desc='DATA_PAGE' order by allocated_page_page_id DBCC IND('exploration', 'PRODUCT', -1) DBCC TRACEON(3604) DBCC PAGE('exploration', 1, @page, 3)
DROP TABLE IF EXISTS article_identifiables; DROP TABLE IF EXISTS articles; DROP TABLE IF EXISTS contenttree_contentnode; DROP TABLE IF EXISTS contenttrees; DROP TABLE IF EXISTS contentnode_identifiables; DROP TABLE IF EXISTS contentnode_contentnode; DROP TABLE IF EXISTS contentnodes; DROP TABLE IF EXISTS digitalobject_fileresources; DROP TABLE IF EXISTS digitalobjects; DROP TABLE IF EXISTS entities; DROP TABLE IF EXISTS fileresources_video; DROP TABLE IF EXISTS fileresources_image; DROP TABLE IF EXISTS fileresources_audio; DROP TABLE IF EXISTS fileresources; DROP TABLE IF EXISTS webpage_identifiables; DROP TABLE IF EXISTS webpage_webpage; DROP TABLE IF EXISTS website_webpage; DROP TABLE IF EXISTS webpages; DROP TABLE IF EXISTS websites; DROP TABLE IF EXISTS identifiables; ALTER TABLE IF EXISTS new_article_fileresources RENAME TO article_fileresources; ALTER TABLE IF EXISTS new_articles RENAME TO articles; ALTER TABLE IF EXISTS new_contentnode_contentnodes RENAME TO contentnode_contentnodes; ALTER TABLE IF EXISTS new_contentnode_entities RENAME TO contentnode_entities; ALTER TABLE IF EXISTS new_contentnode_fileresources RENAME TO contentnode_fileresources; ALTER TABLE IF EXISTS new_contentnodes RENAME TO contentnodes; ALTER TABLE IF EXISTS new_contenttree_contentnodes RENAME TO contenttree_contentnodes; ALTER TABLE IF EXISTS new_contenttrees RENAME TO contenttrees; ALTER TABLE IF EXISTS new_digitalobject_fileresources RENAME TO digitalobject_fileresources; ALTER TABLE IF EXISTS new_digitalobjects RENAME TO digitalobjects; ALTER TABLE IF EXISTS new_entities RENAME TO entities; ALTER TABLE IF EXISTS new_fileresources RENAME TO fileresources; ALTER TABLE IF EXISTS new_fileresources_audio RENAME TO fileresources_audio; ALTER TABLE IF EXISTS new_fileresources_image RENAME TO fileresources_image; ALTER TABLE IF EXISTS new_fileresources_video RENAME TO fileresources_video; ALTER TABLE IF EXISTS new_identifiables RENAME TO identifiables; ALTER TABLE IF EXISTS new_webpage_fileresources RENAME TO webpage_fileresources; ALTER TABLE IF EXISTS new_webpage_webpages RENAME TO webpage_webpages; ALTER TABLE IF EXISTS new_webpages RENAME TO webpages; ALTER TABLE IF EXISTS new_website_webpages RENAME TO website_webpages; ALTER TABLE IF EXISTS new_websites RENAME TO websites;
ALTER TABLE places DROP COLUMN osm_id; ALTER TABLE places DROP COLUMN osm_level; CREATE UNIQUE INDEX places_name_idx ON places (place_name);
set define off verify off feedback off whenever sqlerror exit sql.sqlcode rollback -------------------------------------------------------------------------------- -- -- ORACLE Application Express (APEX) export file -- -- You should run the script connected to SQL*Plus as the Oracle user -- APEX_050000 or as the owner (parsing schema) of the application. -- -- NOTE: Calls to apex_application_install override the defaults below. -- -------------------------------------------------------------------------------- begin wwv_flow_api.import_begin ( p_version_yyyy_mm_dd=>'2013.01.01' ,p_release=>'5.0.0.00.31' ,p_default_workspace_id=>1731201623220696 ,p_default_application_id=>101 ,p_default_owner=>'PLAYGROUND' ); end; / prompt --application/ui_types begin null; end; / prompt --application/shared_components/plugins/region_type/test_plugin begin wwv_flow_api.create_plugin( p_id=>wwv_flow_api.id(5386300325350760) ,p_plugin_type=>'REGION TYPE' ,p_name=>'TEST_PLUGIN' ,p_display_name=>'Test Plugin' ,p_supported_ui_types=>'DESKTOP' ,p_substitute_attributes=>true ,p_subscribe_plugin_settings=>true ,p_version_identifier=>'1.0' ); end; / begin wwv_flow_api.import_end(p_auto_install_sup_obj => nvl(wwv_flow_application_install.get_auto_install_sup_obj, false), p_is_component_import => true); commit; end; / set verify on feedback on define on prompt ...done
<gh_stars>1000+ DECLARE test CURSOR FOR SELECT 1;
-- generate fake sales event from PL/SQL DECLARE l_event JSON := JSON(); l_now TIMESTAMP := SYSTIMESTAMP AT TIME ZONE 'utc'; BEGIN l_event.put('id', 0); l_event.put('trans_dt', TO_CHAR(l_now, 'YYYY-MM-DD"T"HH24:MI:SS"Z"')); l_event.put('product', 'Product A'); l_event.put('region', 'West'); l_event.put('units', 11); l_event.put('price', 8.99); webmq.publish('http://tavendo.de/webmq/demo/dashboard#onsale', l_event); END; / -- direct insert into sales table, triggering publication of event INSERT INTO sales (id, trans_dt, product, region, units, price) VALUES (sales_id.nextval, SYSTIMESTAMP AT TIME ZONE 'utc', 'Product A', 'West', 11, 8.99); COMMIT; /
<reponame>proshantokuet/test<filename>opensrp-web/src/main/resources/scripts/child-nutrition-report.sql CREATE OR REPLACE FUNCTION report.get_child_nutrition_report_by_location(_start_date text, _end_date text, _parent_loc_id integer, _location_tag text, _parent_loc_tag text, _location_name text) RETURNS TABLE(locationorprovider text, childrenvisited19to36 integer, immunizedchildren18to36 integer, ncdpackage integer, adolescentpackage integer, iycfpackage integer, breastfeedin1hour integer, breastfeedin24hour integer, complementaryfoodat7months integer, pushtikonainlast24hour integer) LANGUAGE plpgsql AS $function$ declare child_follow_up RECORD; package RECORD; vaccination RECORD; begin create temporary table child_follow_up ( location_name text, children_visited_19_to_36 int, breast_feed_in_1_hour int, breast_feed_in_24_hour int, complementary_food_at_7_months int, pushtikona_in_last_24_hour int )on commit drop; create temporary table package ( location_name text, ncd_package int, iycf_package int, adolescent_package int )on commit drop; create temporary table vaccination ( location_name text, immunized_children_18_to_36 int )on commit drop; for child_follow_up in with child_nutrition as ( select m.country, m.division, m.district, m.city_corporation_upazila, m.breast_feeding_time::int, (extract (year from age(s.date_created, m.birthdate))*12 + extract (month from age(s.date_created, m.birthdate))) age_in_months, s.breast_feed_in_24hr, s.nutrients_in_24hr, s.solid_food_month::int solid_food_month from report.service s join report."member" m on m.base_entity_id = s.base_entity_id where s.event_type = 'Child Followup' and s.date_created between _start_date::date and _end_date::date and ( case when _parent_loc_tag = 'division' then m.division = _location_name when _parent_loc_tag = 'district' then m.district = _location_name when _parent_loc_tag = 'city_corporation_upazila' then m.city_corporation_upazila = _location_name else m.country = _location_name end ) ) select case when _location_tag = 'division' then division when _location_tag = 'district' then district else city_corporation_upazila end as location_name, sum(case when age_in_months >= 19 and age_in_months < 36 then 1 else 0 end) children_visited_19_to_36, sum(case when nutrients_in_24hr = 'Yes' then 1 else 0 end) pushtikona_in_last_24_hour, sum(case when breast_feed_in_24hr = 'Yes' then 1 else 0 end) breast_feed_in_24_hour, sum(case when solid_food_month = 7 then 1 else 0 end) complementary_food_at_7_months, sum(case when breast_feeding_time = 1 then 1 else 0 end) breast_feed_in_1_hour from child_nutrition group by location_name loop insert into child_follow_up ( location_name, children_visited_19_to_36, breast_feed_in_1_hour, breast_feed_in_24_hour, complementary_food_at_7_months, pushtikona_in_last_24_hour ) values ( child_follow_up.location_name, child_follow_up.children_visited_19_to_36, child_follow_up.breast_feed_in_1_hour, child_follow_up.breast_feed_in_24_hour, child_follow_up.complementary_food_at_7_months, child_follow_up.pushtikona_in_last_24_hour ); end loop; for package in with package as ( select s.event_type, m.country, m.division, m.district, m.city_corporation_upazila from report.service s join report."member" m on m.base_entity_id = s.base_entity_id where s.date_created between _start_date::date and _end_date::date and (event_type = 'IYCF package' or event_type = 'NCD package' or event_type = 'Adolescent package') and ( case when _parent_loc_tag = 'division' then m.division = _location_name when _parent_loc_tag = 'district' then m.district = _location_name when _parent_loc_tag = 'city_corporation_upazila' then m.city_corporation_upazila = _location_name else m.country = _location_name end ) ) select case when _location_tag = 'division' then division when _location_tag = 'district' then district else city_corporation_upazila end as location_name, sum(case when event_type = 'NCD package' then 1 else 0 end) ncd_package, sum(case when event_type = 'IYCF package' then 1 else 0 end) iycf_package, sum(case when event_type = 'Adolescent package' then 1 else 0 end) adolescent_package from package group by location_name loop insert into package ( location_name, ncd_package, iycf_package, adolescent_package ) values ( package.location_name, package.ncd_package, package.iycf_package, package.adolescent_package ); end loop; for vaccination in with vaccination as ( select row_number() over(partition by s.base_entity_id) ranking, m.country, m.division, m.district, m.city_corporation_upazila from report.service s join report."member" m on m.base_entity_id = s.base_entity_id where event_type = 'Vaccination' and s.date_created <= _end_date::date and (extract (year from age(_start_date::date, m.birthdate))* 12 + extract (month from age(_start_date::date, m.birthdate))) < 36 and (extract (year from age(_end_date::date, m.birthdate))* 12 + extract (month from age(_end_date::date, m.birthdate))) >= 18 and ( case when _parent_loc_tag = 'division' then m.division = _location_name when _parent_loc_tag = 'district' then m.district = _location_name when _parent_loc_tag = 'city_corporation_upazila' then m.city_corporation_upazila = _location_name else m.country = _location_name end ) ) select case when _location_tag = 'division' then division when _location_tag = 'district' then district else city_corporation_upazila end as location_name, count(*) immunized_children_18_to_36 from vaccination where ranking = 13 group by location_name loop insert into vaccination ( location_name, immunized_children_18_to_36 ) values ( vaccination.location_name, vaccination.immunized_children_18_to_36 ); end loop; return query select split_part(l.name, ':', 1) location_name, coalesce(cf.children_visited_19_to_36, 0), coalesce(v.immunized_children_18_to_36, 0), coalesce(p.ncd_package, 0), coalesce(p.adolescent_package, 0), coalesce(p.iycf_package, 0), coalesce(cf.breast_feed_in_1_hour, 0), coalesce(cf.breast_feed_in_24_hour, 0), coalesce(cf.complementary_food_at_7_months, 0), coalesce(cf.pushtikona_in_last_24_hour, 0) from child_follow_up cf full outer join package p on p.location_name = cf.location_name full outer join vaccination v on v.location_name = cf.location_name right join core.location l on split_part(l.name, ':', 1) = cf.location_name where l.parent_location_id = _parent_loc_id; end; $function$ ; CREATE OR REPLACE FUNCTION report.get_child_nutrition_report_by_sk(_start_date text, _end_date text, _sk_ids text[]) RETURNS TABLE(locationorprovider text, childrenvisited19to36 integer, immunizedchildren18to36 integer, ncdpackage integer, adolescentpackage integer, iycfpackage integer, breastfeedin1hour integer, breastfeedin24hour integer, complementaryfoodat7months integer, pushtikonainlast24hour integer) LANGUAGE plpgsql AS $function$ declare child_follow_up RECORD; package RECORD; vaccination RECORD; begin create temporary table child_follow_up ( provider_id text, children_visited_19_to_36 int, breast_feed_in_1_hour int, breast_feed_in_24_hour int, complementary_food_at_7_months int, pushtikona_in_last_24_hour int )on commit drop; create temporary table package ( provider_id text, ncd_package int, iycf_package int, adolescent_package int )on commit drop; create temporary table vaccination ( provider_id text, immunized_children_18_to_36 int )on commit drop; for child_follow_up in with child_nutrition as ( select s.provider_id, m.breast_feeding_time::int, (extract (year from age(s.date_created, m.birthdate))*12 + extract (month from age(s.date_created, m.birthdate))) age_in_months, s.breast_feed_in_24hr, s.nutrients_in_24hr, s.solid_food_month::int solid_food_month from report.service s join report."member" m on m.base_entity_id = s.base_entity_id where s.event_type = 'Child Followup' and s.date_created between _start_date::date and _end_date::date and s.provider_id = any(_sk_ids) ) select provider_id, sum(case when age_in_months >= 19 and age_in_months < 36 then 1 else 0 end) children_visited_19_to_36, sum(case when nutrients_in_24hr = 'Yes' then 1 else 0 end) pushtikona_in_last_24_hour, sum(case when breast_feed_in_24hr = 'Yes' then 1 else 0 end) breast_feed_in_24_hour, sum(case when solid_food_month = 7 then 1 else 0 end) complementary_food_at_7_months, sum(case when breast_feeding_time = 1 then 1 else 0 end) breast_feed_in_1_hour from child_nutrition group by provider_id loop insert into child_follow_up ( provider_id, children_visited_19_to_36, breast_feed_in_1_hour, breast_feed_in_24_hour, complementary_food_at_7_months, pushtikona_in_last_24_hour ) values ( child_follow_up.provider_id, child_follow_up.children_visited_19_to_36, child_follow_up.breast_feed_in_1_hour, child_follow_up.breast_feed_in_24_hour, child_follow_up.complementary_food_at_7_months, child_follow_up.pushtikona_in_last_24_hour ); end loop; for package in with package as ( select s.event_type, s.provider_id from report.service s where s.date_created between _start_date::date and _end_date::date and (s.event_type = 'IYCF package' or s.event_type = 'NCD package' or s.event_type = 'Adolescent package') and s.provider_id = any(_sk_ids) ) select provider_id, sum(case when event_type = 'NCD package' then 1 else 0 end) ncd_package, sum(case when event_type = 'IYCF package' then 1 else 0 end) iycf_package, sum(case when event_type = 'Adolescent package' then 1 else 0 end) adolescent_package from package group by provider_id loop insert into package ( provider_id, ncd_package, iycf_package, adolescent_package ) values ( package.provider_id, package.ncd_package, package.iycf_package, package.adolescent_package ); end loop; for vaccination in with vaccination as ( select row_number() over(partition by s.base_entity_id) ranking, s.provider_id from report.service s join report."member" m on m.base_entity_id = s.base_entity_id where s.event_type = 'Vaccination' and s.date_created <= _end_date::date and (extract (year from age(_start_date::date, m.birthdate))* 12 + extract (month from age(_start_date::date, m.birthdate))) < 36 and (extract (year from age(_end_date::date, m.birthdate))* 12 + extract (month from age(_end_date::date, m.birthdate))) >= 18 and s.provider_id = any(_sk_ids) ) select provider_id, count(*) immunized_children_18_to_36 from vaccination where ranking = 13 group by provider_id loop insert into vaccination ( provider_id, immunized_children_18_to_36 ) values ( vaccination.provider_id, vaccination.immunized_children_18_to_36 ); end loop; return query select u.first_name || '(' || u.username || ')', coalesce(cf.children_visited_19_to_36, 0), coalesce(v.immunized_children_18_to_36, 0), coalesce(p.ncd_package, 0), coalesce(p.adolescent_package, 0), coalesce(p.iycf_package, 0), coalesce(cf.breast_feed_in_1_hour, 0), coalesce(cf.breast_feed_in_24_hour, 0), coalesce(cf.complementary_food_at_7_months, 0), coalesce(cf.pushtikona_in_last_24_hour, 0) from child_follow_up cf full outer join package p on p.provider_id = cf.provider_id full outer join vaccination v on v.provider_id = cf.provider_id right join core.users u on u.username = cf.provider_id where u.username = any(_sk_ids); end; $function$ ;
<filename>target/scala-2.11/classes/evolutions/default/1.sql # --- Created by Ebean DDL # To stop Ebean DDL generation, remove this comment and start using Evolutions # --- !Ups create table item ( id integer not null, sale_event_id varchar(255), seller_name varchar(255), item_name varchar(255), price varchar(255), minimum_price varchar(255), location varchar(255), description varchar(255), transaction_id varchar(255), quantity integer, photo varchar(255), constraint pk_item primary key (id)) ; create table sale_event ( id varchar(255) not null, user_id varchar(255), name varchar(255), address varchar(255), start_date varchar(255), end_date varchar(255), item_count integer, closed boolean, constraint pk_sale_event primary key (id)) ; create table transaction ( id varchar(255) not null, sale_event_id varchar(255), user_name varchar(255), date varchar(255), total double, constraint pk_transaction primary key (id)) ; create table user ( email varchar(255) not null, name varchar(255), password varchar(255), address varchar(255), hobby varchar(255), job varchar(255), islocked boolean, login_time integer, authority varchar(255), sale_event_id varchar(255), constraint pk_user primary key (email)) ; create table user_sale_event ( user_email varchar(255) not null, sale_event_id varchar(255) not null, constraint pk_user_sale_event primary key (user_email, sale_event_id)) ; create sequence item_seq; create sequence sale_event_seq; create sequence transaction_seq; create sequence user_seq; alter table user_sale_event add constraint fk_user_sale_event_user_01 foreign key (user_email) references user (email) on delete restrict on update restrict; alter table user_sale_event add constraint fk_user_sale_event_sale_event_02 foreign key (sale_event_id) references sale_event (id) on delete restrict on update restrict; # --- !Downs SET REFERENTIAL_INTEGRITY FALSE; drop table if exists item; drop table if exists sale_event; drop table if exists transaction; drop table if exists user; drop table if exists user_sale_event; SET REFERENTIAL_INTEGRITY TRUE; drop sequence if exists item_seq; drop sequence if exists sale_event_seq; drop sequence if exists transaction_seq; drop sequence if exists user_seq;
set serveroutput on DECLARE a CENTROS.IDCENTRO%TYPE; BEGIN SELECT MAX(IDCENTRO) INTO a FROM CENTROS; DELETE FROM CENTROS WHERE IDCENTRO = a; IF SQL%FOUND THEN COMMIT; DBMS_OUTPUT.PUT_LINE('Borrado el centro: '||a); ELSE DBMS_OUTPUT.PUT_LINE('No existe el centro: '||a); END IF; END; SELECT * FROM CENTROS; BEGIN borrar_centro(2,1); END; UPDATE TRABAJADOR SET IDCENTRO = 62 WHERE IDCENTRO = 1;
<gh_stars>1-10 ALTER TABLE orgs DROP COLUMN "slack_webhook_url";
--1084. Sales Analysis III -- --Table: Product -- --+--------------+---------+ --| Column Name | Type | --+--------------+---------+ --| product_id | int | --| product_name | varchar | --| unit_price | int | --+--------------+---------+ --product_id is the primary key of this table. --Table: Sales -- --+-------------+---------+ --| Column Name | Type | --+-------------+---------+ --| seller_id | int | --| product_id | int | --| buyer_id | int | --| sale_date | date | --| quantity | int | --| price | int | --+------ ------+---------+ --This table has no primary key, it can have repeated rows. --product_id is a foreign key to Product table. -- -- --Write an SQL query that reports the products that were only sold in spring 2019. That is, between 2019-01-01 and 2019-03-31 inclusive. -- --The query result format is in the following example: -- --Product table: --+------------+--------------+------------+ --| product_id | product_name | unit_price | --+------------+--------------+------------+ --| 1 | S8 | 1000 | --| 2 | G4 | 800 | --| 3 | iPhone | 1400 | --+------------+--------------+------------+ -- --Sales table: --+-----------+------------+----------+------------+----------+-------+ --| seller_id | product_id | buyer_id | sale_date | quantity | price | --+-----------+------------+----------+------------+----------+-------+ --| 1 | 1 | 1 | 2019-01-21 | 2 | 2000 | --| 1 | 2 | 2 | 2019-02-17 | 1 | 800 | --| 2 | 2 | 3 | 2019-06-02 | 1 | 800 | --| 3 | 3 | 4 | 2019-05-13 | 2 | 2800 | --+-----------+------------+----------+------------+----------+-------+ -- --Result table: --+-------------+--------------+ --| product_id | product_name | --+-------------+--------------+ --| 1 | S8 | --+-------------+--------------+ --The product with id 1 was only sold in spring 2019 while the other two were sold after. --# Write your MySQL query statement below select s.product_id, p.product_name from Sales s join Product p using(product_id) group by product_id having min(s.sale_date) >= '2019-01-01' and max(s.sale_date) <= '2019-03-31 ';
<gh_stars>1000+ ALTER TABLE vizier_cluster DROP COLUMN cluster_name, DROP COLUMN cluster_version, DROP COLUMN cluster_uid;
<filename>packaging/dbscripts/create_tables.sql CREATE TABLE history_configuration ( var_name VARCHAR(50) NOT NULL, var_value VARCHAR(255), var_datetime TIMESTAMP WITH TIME ZONE, CONSTRAINT PK_history_configuration PRIMARY KEY(var_name) ) ; CREATE TABLE enum_translator ( enum_type VARCHAR(40) NOT NULL, enum_key SMALLINT NOT NULL, language_code VARCHAR(40) NOT NULL, value TEXT NOT NULL, CONSTRAINT PK_enums PRIMARY KEY(enum_type,enum_key,language_code) ) ; CREATE SEQUENCE configuration_seq INCREMENT BY 1 START WITH 1; CREATE TABLE datacenter_configuration ( history_id INTEGER DEFAULT NEXTVAL('configuration_seq') PRIMARY KEY NOT NULL, datacenter_id UUID NOT NULL, datacenter_name VARCHAR(40) NOT NULL, datacenter_description VARCHAR(4000) NOT NULL, storage_type SMALLINT NOT NULL, create_date TIMESTAMP WITH TIME ZONE, update_date TIMESTAMP WITH TIME ZONE, delete_date TIMESTAMP WITH TIME ZONE ) ; CREATE INDEX datacenter_configuration_datacenter_id_idx ON datacenter_configuration(datacenter_id); CREATE SEQUENCE datacenter_history_seq1 INCREMENT BY 1 START WITH 1; CREATE TABLE datacenter_samples_history ( history_id INTEGER DEFAULT NEXTVAL('datacenter_history_seq1') primary key NOT NULL, history_datetime TIMESTAMP WITH TIME ZONE NOT NULL, datacenter_id UUID NOT NULL, datacenter_status SMALLINT NOT NULL, minutes_in_status DECIMAL(7,2) NOT NULL DEFAULT 1, datacenter_configuration_version INTEGER NOT NULL REFERENCES datacenter_configuration (history_id) ) ; CREATE INDEX IDX_datacenter_history_datetime_samples ON datacenter_samples_history (history_datetime); CREATE INDEX IDX_datacenter_configuration_version_samples ON datacenter_samples_history (datacenter_configuration_version); CREATE INDEX datacenter_samples_history_datacenter_id_idx ON datacenter_samples_history(datacenter_id); CREATE SEQUENCE datacenter_history_seq2 INCREMENT BY 1 START WITH 1; CREATE TABLE datacenter_hourly_history ( history_id INTEGER DEFAULT NEXTVAL('datacenter_history_seq2') primary key NOT NULL, history_datetime TIMESTAMP WITH TIME ZONE NOT NULL, datacenter_id UUID NOT NULL, datacenter_status SMALLINT NOT NULL, minutes_in_status DECIMAL(7,2) NOT NULL DEFAULT 1, datacenter_configuration_version INTEGER NOT NULL REFERENCES datacenter_configuration (history_id) ) ; CREATE INDEX IDX_datacenter_history_datetime_hourly ON datacenter_hourly_history (history_datetime); CREATE INDEX IDX_datacenter_configuration_version_hourly ON datacenter_hourly_history (datacenter_configuration_version); CREATE INDEX datacenter_hourly_history_datacenter_id_idx ON datacenter_hourly_history(datacenter_id); CREATE SEQUENCE datacenter_history_seq3 INCREMENT BY 1 START WITH 1; CREATE TABLE datacenter_daily_history ( history_id INTEGER DEFAULT NEXTVAL('datacenter_history_seq3') primary key NOT NULL, history_datetime DATE NOT NULL, datacenter_id UUID NOT NULL, datacenter_status SMALLINT NOT NULL, minutes_in_status DECIMAL(7,2) NOT NULL DEFAULT 1, datacenter_configuration_version INTEGER NOT NULL REFERENCES datacenter_configuration (history_id) ) ; CREATE INDEX IDX_datacenter_history_datetime_daily ON datacenter_daily_history (history_datetime); CREATE INDEX IDX_datacenter_configuration_version_daily ON datacenter_daily_history (datacenter_configuration_version); CREATE INDEX datacenter_daily_history_datacenter_id_idx ON datacenter_daily_history(datacenter_id); CREATE TABLE storage_domain_configuration ( history_id INTEGER DEFAULT NEXTVAL('configuration_seq') PRIMARY KEY NOT NULL, storage_domain_id UUID NOT NULL, storage_domain_name VARCHAR(250) NOT NULL, storage_domain_type SMALLINT NOT NULL, storage_type SMALLINT NOT NULL, create_date TIMESTAMP WITH TIME ZONE, update_date TIMESTAMP WITH TIME ZONE, delete_date TIMESTAMP WITH TIME ZONE ) ; CREATE INDEX storage_domain_configuration_storage_domain_id_idx ON storage_domain_configuration(storage_domain_id); CREATE SEQUENCE datacenter_storage_domain_map_seq INCREMENT BY 1 START WITH 1; CREATE TABLE datacenter_storage_domain_map ( history_id INTEGER DEFAULT NEXTVAL('datacenter_storage_domain_map_seq') PRIMARY KEY NOT NULL, storage_domain_id UUID NOT NULL, datacenter_id UUID NOT NULL, attach_date TIMESTAMP WITH TIME ZONE NOT NULL, detach_date TIMESTAMP WITH TIME ZONE ) ; CREATE INDEX datacenter_storage_domain_map_storage_domain_id_idx ON datacenter_storage_domain_map(storage_domain_id); CREATE INDEX datacenter_storage_domain_map_datacenter_id_idx ON datacenter_storage_domain_map(datacenter_id); CREATE SEQUENCE storage_domain_history_seq1 INCREMENT BY 1 START WITH 1; CREATE TABLE storage_domain_samples_history ( history_id INTEGER DEFAULT NEXTVAL('storage_domain_history_seq1') primary key NOT NULL, history_datetime TIMESTAMP WITH TIME ZONE NOT NULL, storage_domain_id UUID NOT NULL, available_disk_size_gb INTEGER, used_disk_size_gb INTEGER, storage_configuration_version INTEGER REFERENCES storage_domain_configuration (history_id) ) ; CREATE INDEX IDX_storage_history_datetime_samples ON storage_domain_samples_history (history_datetime); CREATE INDEX IDX_storage_configuration_version_samples ON storage_domain_samples_history (storage_configuration_version); CREATE INDEX storage_domain_samples_history_storage_domain_id_idx ON storage_domain_samples_history(storage_domain_id); CREATE SEQUENCE storage_domain_history_seq2 INCREMENT BY 1 START WITH 1; CREATE TABLE storage_domain_hourly_history ( history_id INTEGER DEFAULT NEXTVAL('storage_domain_history_seq2') primary key NOT NULL, history_datetime TIMESTAMP WITH TIME ZONE NOT NULL, storage_domain_id UUID NOT NULL, available_disk_size_gb INTEGER, used_disk_size_gb INTEGER, storage_configuration_version INTEGER REFERENCES storage_domain_configuration (history_id) ) ; CREATE INDEX IDX_storage_history_datetime_hourly ON storage_domain_hourly_history (history_datetime); CREATE INDEX IDX_storage_configuration_version_hourly ON storage_domain_hourly_history (storage_configuration_version); CREATE INDEX storage_domain_hourly_history_storage_domain_id_idx ON storage_domain_hourly_history(storage_domain_id); CREATE SEQUENCE storage_domain_history_seq3 INCREMENT BY 1 START WITH 1; CREATE TABLE storage_domain_daily_history ( history_id INTEGER DEFAULT NEXTVAL('storage_domain_history_seq3') primary key NOT NULL, history_datetime DATE NOT NULL, storage_domain_id UUID NOT NULL, available_disk_size_gb INTEGER, used_disk_size_gb INTEGER, storage_configuration_version INTEGER REFERENCES storage_domain_configuration (history_id) ) ; CREATE INDEX IDX_storage_domain_history_datetime_daily ON storage_domain_daily_history (history_datetime); CREATE INDEX IDX_storage_configuration_version_daily ON storage_domain_daily_history (storage_configuration_version); CREATE INDEX storage_domain_daily_history_storage_domain_id_idx ON storage_domain_daily_history(storage_domain_id); CREATE TABLE cluster_configuration ( history_id INTEGER DEFAULT NEXTVAL('configuration_seq') PRIMARY KEY NOT NULL, cluster_id UUID NOT NULL, cluster_name VARCHAR(40) NOT NULL, cluster_description VARCHAR(4000), datacenter_id UUID, cpu_name VARCHAR(255), compatibility_version VARCHAR(40) NOT NULL DEFAULT '2.2', datacenter_configuration_version INTEGER REFERENCES datacenter_configuration (history_id), create_date TIMESTAMP WITH TIME ZONE, update_date TIMESTAMP WITH TIME ZONE, delete_date TIMESTAMP WITH TIME ZONE ) ; CREATE INDEX cluster_configuration_cluster_id_idx ON cluster_configuration(cluster_id); CREATE INDEX cluster_configuration_datacenter_id_idx ON cluster_configuration(datacenter_id); CREATE TABLE host_configuration ( history_id INTEGER DEFAULT NEXTVAL('configuration_seq') PRIMARY KEY NOT NULL, host_id UUID NOT NULL, host_unique_id VARCHAR(128), host_name VARCHAR(255) NOT NULL, cluster_id UUID NOT NULL, host_type SMALLINT NOT NULL DEFAULT 0, fqdn_or_ip VARCHAR(255) NOT NULL, memory_size_mb INTEGER, swap_size_mb INTEGER, cpu_model VARCHAR(255), number_of_cores SMALLINT, host_os VARCHAR(255), kernel_version VARCHAR(255), kvm_version VARCHAR(255), vdsm_version VARCHAR(40), vdsm_port INTEGER NOT NULL, cluster_configuration_version INTEGER REFERENCES cluster_configuration (history_id), create_date TIMESTAMP WITH TIME ZONE, update_date TIMESTAMP WITH TIME ZONE, delete_date TIMESTAMP WITH TIME ZONE, number_of_sockets SMALLINT, cpu_speed_mh DECIMAL(18,0) ) ; CREATE INDEX host_configuration_host_id_idx ON host_configuration(host_id); CREATE INDEX host_configuration_cluster_id_idx ON host_configuration(cluster_id); CREATE SEQUENCE host_history_seq1 INCREMENT BY 1 START WITH 1; CREATE TABLE host_samples_history ( history_id INTEGER DEFAULT NEXTVAL('host_history_seq1') primary key NOT NULL, history_datetime TIMESTAMP WITH TIME ZONE NOT NULL, host_id UUID NOT NULL, host_status SMALLINT NOT NULL, minutes_in_status DECIMAL(7,2) NOT NULL DEFAULT 1, memory_usage_percent SMALLINT DEFAULT 0, cpu_usage_percent SMALLINT, ksm_cpu_percent SMALLINT DEFAULT 0, active_vms SMALLINT DEFAULT 0, total_vms SMALLINT DEFAULT 0, total_vms_vcpus INTEGER DEFAULT 0, cpu_load INTEGER DEFAULT 0, system_cpu_usage_percent SMALLINT DEFAULT 0, user_cpu_usage_percent SMALLINT DEFAULT 0, swap_used_mb INTEGER, host_configuration_version INTEGER REFERENCES host_configuration (history_id) ) ; CREATE INDEX IDX_host_history_datetime_samples ON host_samples_history (history_datetime); CREATE INDEX IDX_host_configuration_version_samples ON host_samples_history (host_configuration_version); CREATE INDEX host_samples_history_host_id_idx ON host_samples_history(host_id); CREATE SEQUENCE host_history_seq2 INCREMENT BY 1 START WITH 1; CREATE TABLE host_hourly_history ( history_id INTEGER DEFAULT NEXTVAL('host_history_seq2') primary key NOT NULL, history_datetime TIMESTAMP WITH TIME ZONE NOT NULL, host_id UUID NOT NULL, host_status SMALLINT NOT NULL, minutes_in_status DECIMAL(7,2) NOT NULL DEFAULT 1, memory_usage_percent SMALLINT DEFAULT 0, max_memory_usage SMALLINT, cpu_usage_percent SMALLINT, max_cpu_usage SMALLINT, ksm_cpu_percent SMALLINT DEFAULT 0, max_ksm_cpu_percent SMALLINT DEFAULT 0, active_vms SMALLINT DEFAULT 0, max_active_vms SMALLINT DEFAULT 0, total_vms SMALLINT DEFAULT 0, max_total_vms SMALLINT DEFAULT 0, total_vms_vcpus INTEGER DEFAULT 0, max_total_vms_vcpus INTEGER DEFAULT 0, cpu_load INTEGER DEFAULT 0, max_cpu_load INTEGER DEFAULT 0, system_cpu_usage_percent SMALLINT DEFAULT 0, max_system_cpu_usage_percent SMALLINT DEFAULT 0, user_cpu_usage_percent SMALLINT DEFAULT 0, max_user_cpu_usage_percent SMALLINT DEFAULT 0, swap_used_mb INTEGER, max_swap_used_mb INTEGER, host_configuration_version INTEGER REFERENCES host_configuration (history_id) ) ; CREATE INDEX IDX_host_history_datetime_hourly ON host_hourly_history (history_datetime); CREATE INDEX IDX_host_configuration_version_hourly ON host_hourly_history (host_configuration_version); CREATE INDEX host_hourly_history_host_id_idx ON host_hourly_history(host_id); CREATE SEQUENCE host_history_seq3 INCREMENT BY 1 START WITH 1; CREATE TABLE host_daily_history ( history_id INTEGER DEFAULT NEXTVAL('host_history_seq3') primary key NOT NULL, history_datetime DATE NOT NULL, host_id UUID NOT NULL, host_status SMALLINT NOT NULL, minutes_in_status DECIMAL(7,2) NOT NULL DEFAULT 1, memory_usage_percent SMALLINT DEFAULT 0, max_memory_usage SMALLINT, cpu_usage_percent SMALLINT, max_cpu_usage SMALLINT, ksm_cpu_percent SMALLINT DEFAULT 0, max_ksm_cpu_percent SMALLINT DEFAULT 0, active_vms SMALLINT DEFAULT 0, max_active_vms SMALLINT DEFAULT 0, total_vms SMALLINT DEFAULT 0, max_total_vms SMALLINT DEFAULT 0, total_vms_vcpus INTEGER DEFAULT 0, max_total_vms_vcpus INTEGER DEFAULT 0, cpu_load INTEGER DEFAULT 0, max_cpu_load INTEGER DEFAULT 0, system_cpu_usage_percent SMALLINT DEFAULT 0, max_system_cpu_usage_percent SMALLINT DEFAULT 0, user_cpu_usage_percent SMALLINT DEFAULT 0, max_user_cpu_usage_percent SMALLINT DEFAULT 0, swap_used_mb INTEGER, max_swap_used_mb INTEGER, host_configuration_version INTEGER REFERENCES host_configuration (history_id) ) ; CREATE INDEX IDX_host_history_datetime_daily ON host_daily_history (history_datetime); CREATE INDEX IDX_host_configuration_version_daily ON host_daily_history (host_configuration_version); CREATE INDEX host_daily_history_host_id_idx ON host_daily_history(host_id); CREATE TABLE host_interface_configuration ( history_id INTEGER DEFAULT NEXTVAL('configuration_seq') PRIMARY KEY NOT NULL, host_interface_id UUID NOT NULL, host_interface_name VARCHAR(50) NOT NULL, host_id UUID NOT NULL, host_interface_type SMALLINT, host_interface_speed_bps INTEGER, mac_address VARCHAR(59), network_name VARCHAR(50), ip_address VARCHAR(20), gateway VARCHAR(20), bond BOOLEAN, bond_name VARCHAR(50), vlan_id INTEGER, host_configuration_version INTEGER REFERENCES host_configuration (history_id), create_date TIMESTAMP WITH TIME ZONE, update_date TIMESTAMP WITH TIME ZONE, delete_date TIMESTAMP WITH TIME ZONE ) ; CREATE INDEX host_interface_configuration_host_interface_id_idx ON host_interface_configuration(host_interface_id); CREATE INDEX host_interface_configuration_host_id_idx ON host_interface_configuration(host_id); CREATE SEQUENCE host_interface_history_seq1 INCREMENT BY 1 START WITH 1; CREATE TABLE host_interface_samples_history ( history_id INTEGER DEFAULT NEXTVAL('host_interface_history_seq1') primary key NOT NULL, history_datetime TIMESTAMP WITH TIME ZONE NOT NULL, host_interface_id UUID NOT NULL, receive_rate_percent SMALLINT, transmit_rate_percent SMALLINT, host_interface_configuration_version INTEGER REFERENCES host_interface_configuration (history_id) ) ; CREATE INDEX IDX_host_interface_history_datetime_samples ON host_interface_samples_history (history_datetime); CREATE INDEX IDX_host_interface_configuration_version_samples ON host_interface_samples_history (host_interface_configuration_version); CREATE INDEX host_interface_samples_history_host_interface_id_idx ON host_interface_samples_history(host_interface_id); CREATE SEQUENCE host_interface_history_seq2 INCREMENT BY 1 START WITH 1; CREATE TABLE host_interface_hourly_history ( history_id INTEGER DEFAULT NEXTVAL('host_interface_history_seq2') primary key NOT NULL, history_datetime TIMESTAMP WITH TIME ZONE NOT NULL, host_interface_id UUID NOT NULL, receive_rate_percent SMALLINT, max_receive_rate_percent SMALLINT, transmit_rate_percent SMALLINT, max_transmit_rate_percent SMALLINT, host_interface_configuration_version INTEGER REFERENCES host_interface_configuration (history_id) ) ; CREATE INDEX IDX_host_interface_history_datetime_hourly ON host_interface_hourly_history (history_datetime); CREATE INDEX IDX_host_interface_configuration_version_hourly ON host_interface_hourly_history (host_interface_configuration_version); CREATE INDEX host_interface_hourly_history_host_interface_id_idx ON host_interface_hourly_history(host_interface_id); CREATE SEQUENCE host_interface_history_seq3 INCREMENT BY 1 START WITH 1; CREATE TABLE host_interface_daily_history ( history_id INTEGER DEFAULT NEXTVAL('host_interface_history_seq3') primary key NOT NULL, history_datetime DATE NOT NULL, host_interface_id UUID NOT NULL, receive_rate_percent SMALLINT, max_receive_rate_percent SMALLINT, transmit_rate_percent SMALLINT, max_transmit_rate_percent SMALLINT, host_interface_configuration_version INTEGER REFERENCES host_interface_configuration (history_id) ) ; CREATE INDEX IDX_host_interface_history_datetime_daily ON host_interface_daily_history (history_datetime); CREATE INDEX IDX_host_interface_configuration_version_daily ON host_interface_daily_history (host_interface_configuration_version); CREATE INDEX host_interface_daily_history_host_interface_id_idx ON host_interface_daily_history(host_interface_id); CREATE TABLE vm_configuration ( history_id INTEGER DEFAULT NEXTVAL('configuration_seq') PRIMARY KEY NOT NULL, vm_id UUID NOT NULL, vm_name VARCHAR(255) NOT NULL, vm_description VARCHAR(4000), vm_type SMALLINT, cluster_id UUID NOT NULL, template_id UUID NOT NULL, template_name VARCHAR(255), cpu_per_socket SMALLINT, number_of_sockets SMALLINT, memory_size_mb INTEGER, operating_system SMALLINT NOT NULL DEFAULT 0, ad_domain VARCHAR(40), default_host UUID, high_availability BOOLEAN, initialized BOOLEAN, stateless BOOLEAN, fail_back BOOLEAN, auto_suspend BOOLEAN DEFAULT false, usb_policy SMALLINT, time_zone VARCHAR(40), cluster_configuration_version INTEGER REFERENCES cluster_configuration (history_id), default_host_configuration_version INTEGER REFERENCES host_configuration (history_id), create_date TIMESTAMP WITH TIME ZONE, update_date TIMESTAMP WITH TIME ZONE, delete_date TIMESTAMP WITH TIME ZONE ) ; CREATE INDEX vm_configuration_vm_id_idx ON vm_configuration(vm_id); CREATE INDEX vm_configuration_cluster_id_idx ON vm_configuration(cluster_id); CREATE SEQUENCE disk_vm_device_history_seq INCREMENT BY 1 START WITH 1; CREATE TABLE vm_device_history ( history_id INTEGER DEFAULT NEXTVAL('disk_vm_device_history_seq') PRIMARY KEY NOT NULL, vm_id uuid NOT NULL, device_id uuid NOT NULL, type character varying(30) NOT NULL, address character varying(255) NOT NULL, is_managed boolean NOT NULL DEFAULT false, is_plugged boolean, is_readonly boolean NOT NULL DEFAULT false, vm_configuration_version INTEGER, device_configuration_version INTEGER, create_date TIMESTAMP WITH TIME ZONE NOT NULL, update_date TIMESTAMP WITH TIME ZONE, delete_date TIMESTAMP WITH TIME ZONE ) ; CREATE INDEX IDX_vm_device_history_vm_id_type ON vm_device_history (vm_id, type); CREATE SEQUENCE vm_history_seq1 INCREMENT BY 1 START WITH 1; CREATE TABLE vm_samples_history ( history_id INTEGER DEFAULT NEXTVAL('vm_history_seq1') primary key NOT NULL, history_datetime TIMESTAMP WITH TIME ZONE NOT NULL, vm_id UUID NOT NULL, vm_status SMALLINT NOT NULL, minutes_in_status DECIMAL(7,2) NOT NULL DEFAULT 1, cpu_usage_percent SMALLINT DEFAULT 0, memory_usage_percent SMALLINT DEFAULT 0, user_cpu_usage_percent SMALLINT DEFAULT 0, system_cpu_usage_percent SMALLINT DEFAULT 0, vm_ip VARCHAR(255), current_user_name VARCHAR(255), currently_running_on_host UUID, vm_configuration_version INTEGER REFERENCES vm_configuration (history_id), current_host_configuration_version INTEGER REFERENCES host_configuration (history_id) ) ; CREATE INDEX IDX_vm_history_datetime_samples ON vm_samples_history (history_datetime); CREATE INDEX IDX_vm_configuration_version_samples ON vm_samples_history (vm_configuration_version); CREATE INDEX IDX_vm_current_host_configuration_samples ON vm_samples_history (current_host_configuration_version); CREATE INDEX vm_samples_history_vm_id_idx ON vm_samples_history(vm_id); CREATE SEQUENCE vm_history_seq2 INCREMENT BY 1 START WITH 1; CREATE TABLE vm_hourly_history ( history_id INTEGER DEFAULT NEXTVAL('vm_history_seq2') primary key NOT NULL, history_datetime TIMESTAMP WITH TIME ZONE NOT NULL, vm_id UUID NOT NULL, vm_status SMALLINT NOT NULL, minutes_in_status DECIMAL(7,2) NOT NULL DEFAULT 1, cpu_usage_percent SMALLINT DEFAULT 0, max_cpu_usage SMALLINT, memory_usage_percent SMALLINT DEFAULT 0, max_memory_usage SMALLINT, user_cpu_usage_percent SMALLINT DEFAULT 0, max_user_cpu_usage_percent SMALLINT DEFAULT 0, system_cpu_usage_percent SMALLINT DEFAULT 0, max_system_cpu_usage_percent SMALLINT DEFAULT 0, vm_ip VARCHAR(255), current_user_name VARCHAR(255), currently_running_on_host UUID, vm_configuration_version INTEGER REFERENCES vm_configuration (history_id), current_host_configuration_version INTEGER REFERENCES host_configuration (history_id) ) ; CREATE INDEX IDX_vm_history_datetime_hourly ON vm_hourly_history (history_datetime); CREATE INDEX IDX_vm_configuration_version_hourly ON vm_hourly_history (vm_configuration_version); CREATE INDEX IDX_vm_current_host_configuration_hourly ON vm_hourly_history (current_host_configuration_version); CREATE INDEX vm_hourly_history_vm_id_idx ON vm_hourly_history(vm_id); CREATE SEQUENCE vm_history_seq3 INCREMENT BY 1 START WITH 1; CREATE TABLE vm_daily_history ( history_id INTEGER DEFAULT NEXTVAL('vm_history_seq3') primary key NOT NULL, history_datetime DATE NOT NULL, vm_id UUID NOT NULL, vm_status SMALLINT NOT NULL, minutes_in_status DECIMAL(7,2) NOT NULL DEFAULT 1, cpu_usage_percent SMALLINT DEFAULT 0, max_cpu_usage SMALLINT, memory_usage_percent SMALLINT DEFAULT 0, max_memory_usage SMALLINT, user_cpu_usage_percent SMALLINT DEFAULT 0, max_user_cpu_usage_percent SMALLINT DEFAULT 0, system_cpu_usage_percent SMALLINT DEFAULT 0, max_system_cpu_usage_percent SMALLINT DEFAULT 0, vm_ip VARCHAR(255), current_user_name VARCHAR(255), currently_running_on_host UUID, vm_configuration_version INTEGER REFERENCES vm_configuration (history_id), current_host_configuration_version INTEGER REFERENCES host_configuration (history_id) ) ; CREATE INDEX IDX_vm_history_datetime_daily ON vm_daily_history (history_datetime); CREATE INDEX IDX_vm_configuration_version_daily ON vm_daily_history (vm_configuration_version); CREATE INDEX IDX_vm_current_host_configuration_daily ON vm_daily_history (current_host_configuration_version); CREATE INDEX vm_daily_history_vm_id_idx ON vm_daily_history(vm_id); CREATE TABLE vm_interface_configuration ( history_id INTEGER DEFAULT NEXTVAL('configuration_seq') PRIMARY KEY NOT NULL, vm_interface_id UUID NOT NULL, vm_interface_name VARCHAR(50) NOT NULL, vm_id UUID, vm_interface_type SMALLINT, vm_interface_speed_bps INTEGER, mac_address VARCHAR(20), network_name VARCHAR(50), vm_configuration_version INTEGER REFERENCES vm_configuration (history_id), create_date TIMESTAMP WITH TIME ZONE, update_date TIMESTAMP WITH TIME ZONE, delete_date TIMESTAMP WITH TIME ZONE ) ; CREATE INDEX vm_interface_configuration_vm_interface_id_idx ON vm_interface_configuration(vm_interface_id); CREATE INDEX vm_interface_configuration_vm_id_idx ON vm_interface_configuration(vm_id); CREATE SEQUENCE vm_interface_history_seq1 INCREMENT BY 1 START WITH 1; CREATE TABLE vm_interface_samples_history ( history_id INTEGER DEFAULT NEXTVAL('vm_interface_history_seq1') primary key NOT NULL, history_datetime TIMESTAMP WITH TIME ZONE NOT NULL, vm_interface_id UUID NOT NULL, receive_rate_percent SMALLINT, transmit_rate_percent SMALLINT, vm_interface_configuration_version INTEGER REFERENCES vm_interface_configuration (history_id) ) ; CREATE INDEX IDX_vm_interface_history_datetime_samples ON vm_interface_samples_history(history_datetime); CREATE INDEX IDX_vm_interface_configuration_version_samples ON vm_interface_samples_history(vm_interface_configuration_version); CREATE INDEX vm_interface_samples_history_vm_interface_id_idx ON vm_interface_samples_history(vm_interface_id); CREATE SEQUENCE vm_interface_history_seq2 INCREMENT BY 1 START WITH 1; CREATE TABLE vm_interface_hourly_history ( history_id INTEGER DEFAULT NEXTVAL('vm_interface_history_seq2') primary key NOT NULL, history_datetime TIMESTAMP WITH TIME ZONE NOT NULL, vm_interface_id UUID NOT NULL, receive_rate_percent SMALLINT, max_receive_rate_percent SMALLINT, transmit_rate_percent SMALLINT, max_transmit_rate_percent SMALLINT, vm_interface_configuration_version INTEGER REFERENCES vm_interface_configuration (history_id) ) ; CREATE INDEX IDX_vm_interface_history_datetime_hourly ON vm_interface_hourly_history(history_datetime); CREATE INDEX IDX_vm_interface_configuration_version_hourly ON vm_interface_hourly_history(vm_interface_configuration_version); CREATE INDEX vm_interface_hourly_history_vm_interface_id_idx ON vm_interface_hourly_history(vm_interface_id); CREATE SEQUENCE vm_interface_history_seq3 INCREMENT BY 1 START WITH 1; CREATE TABLE vm_interface_daily_history ( history_id INTEGER DEFAULT NEXTVAL('vm_interface_history_seq3') primary key NOT NULL, history_datetime DATE NOT NULL, vm_interface_id UUID NOT NULL, receive_rate_percent SMALLINT, max_receive_rate_percent SMALLINT, transmit_rate_percent SMALLINT, max_transmit_rate_percent SMALLINT, vm_interface_configuration_version INTEGER REFERENCES vm_interface_configuration (history_id) ) ; CREATE INDEX IDX_vm_interface_history_datetime_daily ON vm_interface_daily_history(history_datetime); CREATE INDEX IDX_vm_interface_configuration_version_daily ON vm_interface_daily_history(vm_interface_configuration_version); CREATE INDEX vm_interface_daily_history_vm_interface_id_idx ON vm_interface_daily_history(vm_interface_id); CREATE TABLE vm_disk_configuration ( history_id INTEGER DEFAULT NEXTVAL('configuration_seq') PRIMARY KEY NOT NULL, image_id UUID NOT NULL, storage_domain_id UUID, vm_internal_drive_mapping SMALLINT, vm_disk_description VARCHAR(4000), vm_disk_size_mb INTEGER, vm_disk_type SMALLINT, vm_disk_format SMALLINT, vm_disk_interface SMALLINT, create_date TIMESTAMP WITH TIME ZONE, update_date TIMESTAMP WITH TIME ZONE, delete_date TIMESTAMP WITH TIME ZONE, vm_disk_id UUID, vm_disk_name VARCHAR(255), is_shared BOOLEAN ) ; CREATE INDEX vm_disk_configuration_vm_disk_id_idx ON vm_disk_configuration(image_id); CREATE INDEX vm_disk_configuration_storage_domain_id_idx ON vm_disk_configuration(storage_domain_id); CREATE SEQUENCE vm_disk_history_seq1 INCREMENT BY 1 START WITH 1; CREATE TABLE vm_disk_samples_history ( history_id INTEGER DEFAULT NEXTVAL('vm_disk_history_seq1') primary key NOT NULL, history_datetime TIMESTAMP WITH TIME ZONE NOT NULL, image_id UUID NOT NULL, vm_disk_status SMALLINT, minutes_in_status DECIMAL(7,2) NOT NULL DEFAULT 1, vm_disk_actual_size_mb INTEGER NOT NULL, read_rate_bytes_per_second INTEGER, read_latency_seconds DECIMAL(18,9), write_rate_bytes_per_second INTEGER, write_latency_seconds DECIMAL(18,9), flush_latency_seconds DECIMAL(18,9), vm_disk_configuration_version INTEGER REFERENCES vm_disk_configuration (history_id), vm_disk_id UUID ) ; CREATE INDEX IDX_vm_disk_history_datetime_samples ON vm_disk_samples_history (history_datetime); CREATE INDEX IDX_vm_disk_configuration_version_samples ON vm_disk_samples_history (vm_disk_configuration_version); CREATE INDEX vm_disk_samples_history_vm_disk_id_idx ON vm_disk_samples_history(image_id); CREATE SEQUENCE vm_disk_history_seq2 INCREMENT BY 1 START WITH 1; CREATE TABLE vm_disk_hourly_history ( history_id INTEGER DEFAULT NEXTVAL('vm_disk_history_seq2') primary key NOT NULL, history_datetime TIMESTAMP WITH TIME ZONE NOT NULL, image_id UUID NOT NULL, vm_disk_status SMALLINT, minutes_in_status DECIMAL(7,2) NOT NULL DEFAULT 1, vm_disk_actual_size_mb INTEGER NOT NULL, read_rate_bytes_per_second INTEGER, max_read_rate_bytes_per_second INTEGER, read_latency_seconds DECIMAL(18,9), max_read_latency_seconds DECIMAL(18,9), write_rate_bytes_per_second INTEGER, max_write_rate_bytes_per_second INTEGER, write_latency_seconds DECIMAL(18,9), max_write_latency_seconds DECIMAL(18,9), flush_latency_seconds DECIMAL(18,9), max_flush_latency_seconds DECIMAL(18,9), vm_disk_configuration_version INTEGER REFERENCES vm_disk_configuration (history_id), vm_disk_id UUID ) ; CREATE INDEX IDX_vm_disk_history_datetime_hourly ON vm_disk_hourly_history (history_datetime); CREATE INDEX IDX_vm_disk_configuration_version_hourly ON vm_disk_hourly_history (vm_disk_configuration_version); CREATE INDEX vm_disk_hourly_history_vm_disk_id_idx ON vm_disk_hourly_history(image_id); CREATE SEQUENCE vm_disk_history_seq3 INCREMENT BY 1 START WITH 1; CREATE TABLE vm_disk_daily_history ( history_id INTEGER DEFAULT NEXTVAL('vm_disk_history_seq3') primary key NOT NULL, history_datetime DATE NOT NULL, image_id UUID NOT NULL, vm_disk_status SMALLINT, minutes_in_status DECIMAL(7,2) NOT NULL DEFAULT 1, vm_disk_actual_size_mb INTEGER NOT NULL, read_rate_bytes_per_second INTEGER, max_read_rate_bytes_per_second INTEGER, read_latency_seconds DECIMAL(18,9), max_read_latency_seconds DECIMAL(18,9), write_rate_bytes_per_second INTEGER, max_write_rate_bytes_per_second INTEGER, write_latency_seconds DECIMAL(18,9), max_write_latency_seconds DECIMAL(18,9), flush_latency_seconds DECIMAL(18,9), max_flush_latency_seconds DECIMAL(18,9), vm_disk_configuration_version INTEGER REFERENCES vm_disk_configuration (history_id), vm_disk_id UUID ) ; CREATE INDEX IDX_vm_disk_history_datetime_daily ON vm_disk_daily_history (history_datetime); CREATE INDEX IDX_vm_disk_configuration_version_daily ON vm_disk_daily_history (vm_disk_configuration_version); CREATE INDEX vm_disk_daily_history_vm_disk_id_idx ON vm_disk_daily_history(image_id); CREATE SEQUENCE vm_disks_usage_history_seq1 INCREMENT BY 1 START WITH 1; CREATE TABLE vm_disks_usage_samples_history ( history_id INTEGER DEFAULT NEXTVAL('vm_disks_usage_history_seq1') PRIMARY KEY NOT NULL, history_datetime TIMESTAMP WITH TIME ZONE NOT NULL, vm_id UUID NOT NULL, disks_usage TEXT ) ; CREATE INDEX IDX_disks_usage_history_datetime_samples ON vm_disks_usage_samples_history (history_datetime); CREATE INDEX IDX_disks_usage_vm_id_samples ON vm_disks_usage_samples_history (vm_id); CREATE SEQUENCE vm_disks_usage_history_seq2 INCREMENT BY 1 START WITH 1; CREATE TABLE vm_disks_usage_hourly_history ( history_id INTEGER DEFAULT NEXTVAL('vm_disks_usage_history_seq2') PRIMARY KEY NOT NULL, history_datetime TIMESTAMP WITH TIME ZONE NOT NULL, vm_id UUID NOT NULL, disks_usage TEXT ) ; CREATE INDEX IDX_disks_usage_history_datetime_hourly ON vm_disks_usage_hourly_history (history_datetime); CREATE INDEX IDX_disks_usage_vm_id_hourly ON vm_disks_usage_hourly_history (vm_id); CREATE SEQUENCE vm_disks_usage_history_seq3 INCREMENT BY 1 START WITH 1; CREATE TABLE vm_disks_usage_daily_history ( history_id INTEGER DEFAULT NEXTVAL('vm_disks_usage_history_seq3') PRIMARY KEY NOT NULL, history_datetime TIMESTAMP WITH TIME ZONE NOT NULL, vm_id UUID NOT NULL, disks_usage TEXT ) ; CREATE INDEX IDX_disks_usage_history_datetime_daily ON vm_disks_usage_daily_history (history_datetime); CREATE INDEX IDX_disks_usage_vm_id_daily ON vm_disks_usage_daily_history (vm_id); CREATE SEQUENCE disk_vm_map_seq INCREMENT BY 1 START WITH 1; CREATE TABLE disks_vm_map ( history_id INTEGER DEFAULT NEXTVAL('disk_vm_map_seq') PRIMARY KEY NOT NULL, vm_disk_id UUID NOT NULL, vm_id UUID NOT NULL, attach_date TIMESTAMP WITH TIME ZONE NOT NULL, detach_date TIMESTAMP WITH TIME ZONE ) ; CREATE INDEX disks_vm_map_vm_disk_id_idx ON disks_vm_map(vm_disk_id); CREATE INDEX disks_vm_map_vm_id_idx ON disks_vm_map(vm_id); CREATE TABLE tag_details ( history_id INTEGER DEFAULT NEXTVAL('configuration_seq') PRIMARY KEY NOT NULL, tag_id UUID NOT NULL, tag_name VARCHAR(50) NOT NULL, tag_description VARCHAR(4000), tag_path VARCHAR(4000) NOT NULL, tag_level SMALLINT NOT NULL, create_date TIMESTAMP WITH TIME ZONE NOT NULL, update_date TIMESTAMP WITH TIME ZONE, delete_date TIMESTAMP WITH TIME ZONE ) ; CREATE INDEX tag_details_tag_id_idx ON tag_details(tag_id); CREATE INDEX tag_details_tag_path_idx ON tag_details(tag_path); CREATE INDEX tag_details_tag_level_idx ON tag_details(tag_level); CREATE SEQUENCE tag_relations_history_seq INCREMENT BY 1 START WITH 1; CREATE TABLE tag_relations_history ( history_id INTEGER NOT NULL DEFAULT NEXTVAL('tag_relations_history_seq') PRIMARY KEY NOT NULL, entity_id UUID NOT NULL, entity_type SMALLINT NOT NULL, parent_id UUID, attach_date TIMESTAMP WITH TIME ZONE NOT NULL, detach_date TIMESTAMP WITH TIME ZONE ) ; CREATE INDEX IX_tag_relations_history ON tag_relations_history(entity_id,attach_date); CREATE INDEX IX_tag_relations_history_1 ON tag_relations_history(entity_type); CREATE INDEX tag_relations_history_parent_id_idx ON tag_relations_history(parent_id); CREATE TABLE calendar ( the_datetime TIMESTAMP without time zone PRIMARY KEY NOT NULL, the_date date NOT NULL, the_year smallint NOT NULL, the_month smallint NOT NULL, month_name character varying(9) NOT NULL, the_day smallint NOT NULL, day_name character varying(9) NOT NULL, the_hour time without time zone NOT NULL ) ; CREATE INDEX calendar_table_index ON calendar (the_date); ALTER TABLE calendar CLUSTER ON calendar_table_index; CREATE SEQUENCE schema_version_seq INCREMENT BY 1 START WITH 1; CREATE TABLE schema_version ( id INTEGER DEFAULT NEXTVAL('schema_version_seq') NOT NULL, "version" varchar(10) NOT NULL, script varchar(255) NOT NULL, checksum varchar(128), installed_by varchar(30) NOT NULL, started_at timestamp DEFAULT now(), ended_at timestamp , state character varying(15) NOT NULL, "current" boolean NOT NULL, "comment" text NULL default '', CONSTRAINT schema_version_primary_key PRIMARY KEY (id) );
<reponame>ankushlt/testsigma DROP TABLE IF EXISTS `test_case_results`; CREATE TABLE `test_case_results` ( `id` BIGINT(20) NOT NULL AUTO_INCREMENT, `test_case_id` BIGINT(20) NOT NULL, `test_plan_result_id` BIGINT(20), `test_device_result_id` BIGINT(20) NOT NULL, `suite_id` BIGINT(20) DEFAULT NULL, `iteration` VARCHAR(250) DEFAULT NULL, `result` VARCHAR(100) DEFAULT NULL, `status` VARCHAR(100) DEFAULT 'STATUS_CREATED', `is_step_group` INT(1) DEFAULT NULL, `message` TEXT, `start_time` TIMESTAMP NULL DEFAULT NULL, `end_time` TIMESTAMP NULL DEFAULT NULL, `duration` BIGINT(20) DEFAULT NULL, `suite_result_id` BIGINT(20), `parent_id` BIGINT(20), `test_data_set_name` VARCHAR(1000) DEFAULT NULL, `order_id` BIGINT(20), `type` INT(4), `test_case_status` VARCHAR(255), `priority` INT(4), `test_data_details` JSON DEFAULT NULL, `is_data_driven` BIT(1), `test_data_id` BIGINT(20), `test_case_details` json DEFAULT NULL, `started` BIT(1), `total_count` BIGINT(20) DEFAULT 0, `failed_count` BIGINT(20) DEFAULT 0, `passed_count` BIGINT(20) DEFAULT 0, `aborted_count` BIGINT(20) DEFAULT 0, `stopped_count` BIGINT(20) DEFAULT 0, `not_executed_count` BIGINT(20) DEFAULT 0, `queued_count` BIGINT(20) DEFAULT 0, `is_visually_passed` BIT(1) DEFAULT NULL, `session_id` VARCHAR(256) DEFAULT NULL, `re_run_parent_id` BIGINT(20) DEFAULT NULL, `platform_assets_endpoint_url` TEXT DEFAULT NULL, `created_date` DATETIME DEFAULT CURRENT_TIMESTAMP, `updated_date` DATETIME DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (id), KEY `index_test_case_results_on_test_device_result_id` (`test_device_result_id`), KEY `index_test_case_results_on_env_run_id_and_suite_result_id` (`test_device_result_id`, `suite_result_id`), KEY `index_test_case_results_on_test_plan_result_id` (test_plan_result_id), KEY `index_test_case_results_on_parent_id` (`parent_id`), KEY `index_test_case_results_on_suite_result_id` (`suite_result_id`), KEY `index_test_case_results_on_result` (`result`), KEY `index_test_case_results_on_iteration` (`iteration`), KEY `index_test_case_results_on_test_case_id` (`test_case_id`), KEY `index_test_case_results_on_re_run_parent_id` (`re_run_parent_id`), CONSTRAINT `fk_env_run_id_in_test_case_results_to_test_device_results` FOREIGN KEY (`test_device_result_id`) REFERENCES `test_device_results` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT `fk_test_data_id_in_test_case_results_to_test_data` FOREIGN KEY (test_data_id) REFERENCES `test_data` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `fk_test_plan_result_id_in_test_case_results_to_test_plan_results` FOREIGN KEY (`test_plan_result_id`) REFERENCES `test_plan_results` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT `fk_suite_result_id_in_test_case_results_to_test_suite_results` FOREIGN KEY (`suite_result_id`) REFERENCES `test_suite_results` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION ) ENGINE = InnoDB AUTO_INCREMENT = 5 DEFAULT CHARSET = utf8 COLLATE utf8_unicode_ci;
ALTER TABLE `am_trait` ADD COLUMN `label` varchar(255) NULL COMMENT '名称';
<reponame>stroonsN/livehelperchat<filename>lhc_web/doc/update_db/update_120.sql CREATE TABLE `lh_admin_theme` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(100) NOT NULL, `static_content` longtext NOT NULL, `static_js_content` longtext NOT NULL, `static_css_content` longtext NOT NULL, `header_content` text NOT NULL, `header_css` text NOT NULL, PRIMARY KEY (`id`) ) DEFAULT CHARSET=utf8; INSERT INTO `lh_chat_config` (`identifier`, `value`, `type`, `explain`, `hidden`) VALUES ('default_admin_theme_id', '0', 0, 'Default admin theme', 1);
CREATE TABLE users ( id INTEGER NOT NULL PRIMARY KEY, ws_id INTEGER NOT NULL, uuid VARCHAR(36), admin BOOLEAN NOT NULL DEFAULT 0, login VARCHAR(64), passw VARCHAR(64), points INTEGER NOT NULL, connected BOOLEAN NOT NULL DEFAULT 0, playing BOOLEAN NOT NULL DEFAULT 0 );
<gh_stars>10-100 select extract(epoch from now())::int - (extract(epoch from now())::int % $1), jsonb_build_object( 'datname', d.datname::text, 'size', pg_catalog.pg_database_size(d.datname)::bigint, 'age', age(s.datfrozenxid)::bigint, 'numbackends', d.numbackends, 'xact_commit', d.xact_commit, 'xact_rollback', d.xact_rollback, 'blks_read', d.blks_read, 'blks_hit', d.blks_hit, 'tup_returned', d.tup_returned, 'tup_fetched', d.tup_fetched, 'tup_inserted', d.tup_inserted, 'tup_updated', d.tup_updated, 'tup_deleted', d.tup_deleted, 'conflicts', d.conflicts, 'temp_files', d.temp_files, 'temp_bytes', d.temp_bytes, 'deadlocks', d.deadlocks, 'blk_read_time', d.blk_read_time, 'blk_write_time', d.blk_write_time ) as result from pg_catalog.pg_stat_database d inner join pg_catalog.pg_database s on s.datname = d.datname;
ALTER TABLE certificateauthority ADD COLUMN manifest_and_crl_check_needed BOOLEAN;
<filename>Databases Basics MSSQL Server/Joins, Subqueries, CTE and Indices/Addresses with Towns.sql select top 50 e.FirstName, e.LastName,t.Name, a.AddressText from Employees as e inner join Addresses as a on e.AddressID = a.AddressID inner join Towns as t on a.TownID = t.TownID order by e.FirstName, e.LastName
CREATE TABLE SOURCES ( id SERIAL PRIMARY KEY, url VARCHAR(2048) NOT NULL, refresh_time INT ); CREATE TABLE TAGS ( id SERIAL PRIMARY KEY, name VARCHAR(255) NOT NULL, created timestamp without time zone NOT NULL DEFAULT (current_timestamp AT TIME ZONE 'UTC') ); CREATE TABLE CHARTS ( id SERIAL PRIMARY KEY, name VARCHAR(255), version VARCHAR(255), digest VARCHAR(255), description TEXT, app_version VARCHAR(255), icon VARCHAR(2048), engine VARCHAR(2048), home VARCHAR(2048), sources TEXT, maintainers TEXT, urls TEXT, user_name VARCHAR(255), source_id INT, created timestamp without time zone NOT NULL DEFAULT (current_timestamp AT TIME ZONE 'UTC'), CONSTRAINT fk_source FOREIGN KEY(source_id) REFERENCES SOURCES(id) ); CREATE INDEX IDX_CHARTS ON CHARTS(user_name, name, version);
<gh_stars>0 /* Navicat MySQL Data Transfer Source Server : Local Source Server Version : 50721 Source Host : localhost:3306 Source Database : spa Target Server Type : MYSQL Target Server Version : 50721 File Encoding : 65001 Date: 2019-09-10 13:11:12 */ SET FOREIGN_KEY_CHECKS=0; -- ---------------------------- -- Table structure for migrations -- ---------------------------- DROP TABLE IF EXISTS `migrations`; CREATE TABLE `migrations` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `migration` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `batch` int(11) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- ---------------------------- -- Records of migrations -- ---------------------------- INSERT INTO `migrations` VALUES ('1', '2014_10_12_000000_create_users_table', '1'); INSERT INTO `migrations` VALUES ('2', '2014_10_12_100000_create_password_resets_table', '1'); INSERT INTO `migrations` VALUES ('3', '2017_12_07_122845_create_oauth_providers_table', '1'); -- ---------------------------- -- Table structure for oauth_providers -- ---------------------------- DROP TABLE IF EXISTS `oauth_providers`; CREATE TABLE `oauth_providers` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `user_id` int(10) unsigned NOT NULL, `provider` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `provider_user_id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `access_token` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `refresh_token` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL, PRIMARY KEY (`id`), KEY `oauth_providers_user_id_foreign` (`user_id`), KEY `oauth_providers_provider_user_id_index` (`provider_user_id`), CONSTRAINT `oauth_providers_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- ---------------------------- -- Records of oauth_providers -- ---------------------------- -- ---------------------------- -- Table structure for password_resets -- ---------------------------- DROP TABLE IF EXISTS `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, KEY `password_resets_email_index` (`email`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- ---------------------------- -- Records of password_resets -- ---------------------------- -- ---------------------------- -- Table structure for users -- ---------------------------- DROP TABLE IF EXISTS `users`; CREATE TABLE `users` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `password` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `remember_token` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `users_email_unique` (`email`) ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- ---------------------------- -- Records of users -- ---------------------------- INSERT INTO `users` VALUES ('1', 'nidhal', '<EMAIL>', <PASSWORD>', 'BZzlM6514uNK13GIcxtmzmuqAfe13DCmDwg8IlpvKH0Au6qhIJIzS3CYq6V8', '2019-03-16 21:39:28', '2019-03-16 22:45:30'); INSERT INTO `users` VALUES ('2', '<EMAIL>', '<EMAIL>', <PASSWORD>u<PASSWORD>', null, '2019-09-10 11:08:28', '2019-09-10 11:08:28'); SET FOREIGN_KEY_CHECKS=1;