sql
stringlengths 6
1.05M
|
|---|
-- --------------------------------------------------------------------
--
-- orc_uninstall.sql
--
-- Remove ORC format in pluggable storage framework
--
-- --------------------------------------------------------------------
SET allow_system_table_mods=ddl;
DROP FUNCTION IF EXISTS pg_catalog.orc_validate_interfaces();
DROP FUNCTION IF EXISTS pg_catalog.orc_validate_options();
DROP FUNCTION IF EXISTS pg_catalog.orc_validate_encodings();
DROP FUNCTION IF EXISTS pg_catalog.orc_validate_datatypes();
DROP FUNCTION IF EXISTS pg_catalog.orc_beginscan();
DROP FUNCTION IF EXISTS pg_catalog.orc_getnext_init();
DROP FUNCTION IF EXISTS pg_catalog.orc_getnext();
DROP FUNCTION IF EXISTS pg_catalog.orc_rescan();
DROP FUNCTION IF EXISTS pg_catalog.orc_endscan();
DROP FUNCTION IF EXISTS pg_catalog.orc_stopscan();
DROP FUNCTION IF EXISTS pg_catalog.orc_insert_init();
DROP FUNCTION IF EXISTS pg_catalog.orc_insert();
DROP FUNCTION IF EXISTS pg_catalog.orc_insert_finish();
|
<filename>schemas/reference/V16__bflocationtype.sql<gh_stars>0
CREATE TABLE bflocationtype (
id UUID NOT NULL PRIMARY KEY,
seaport BOOLEAN NOT NULL,
railterminal BOOLEAN NOT NULL,
airport BOOLEAN NOT NULL,
postexchange BOOLEAN NOT NULL,
multimodal BOOLEAN NOT NULL,
fixedtransport BOOLEAN NOT NULL,
bordercrossing BOOLEAN NOT NULL,
roadterminal BOOLEAN NOT NULL,
portclassification INT2,
description VARCHAR(60) NOT NULL,
validfrom TIMESTAMP WITH TIME ZONE,
validto TIMESTAMP WITH TIME ZONE
);
-- Table comment
COMMENT ON TABLE bflocationtype IS '{"label": "Border port types", "description": "A detailed list of border port types", "schemalastupdated": "06/03/2019", "dataversion": 1}';
-- Column comments
COMMENT ON COLUMN bflocationtype.id IS '{"label": "Identifier", "description": "Unique identifying column.", "summaryview": "false"}';
COMMENT ON COLUMN bflocationtype.seaport IS '{"label": "Sea port", "description": "Is the location a seaport?", "summaryview": "false"}';
COMMENT ON COLUMN bflocationtype.railterminal IS '{"label": "Rail terminal", "description": "Is the location a rail terminal?", "summaryview": "false"}';
COMMENT ON COLUMN bflocationtype.airport IS '{"label": "Air port", "description": "Is the location a airport?", "summaryview": "false"}';
COMMENT ON COLUMN bflocationtype.postexchange IS '{"label": "Postal hub", "description": "Is the location a postal exchange?", "summaryview": "false"}';
COMMENT ON COLUMN bflocationtype.multimodal IS '{"label": "Mixed mode", "description": "Is the location a multi modal crossing?", "summaryview": "false"}';
COMMENT ON COLUMN bflocationtype.fixedtransport IS '{"label": "Fixed transport", "description": "Is the location a fixed transport crossing?", "summaryview": "false"}';
COMMENT ON COLUMN bflocationtype.bordercrossing IS '{"label": "Border crossing", "description": "Is the location a border crossing?", "summaryview": "false"}';
COMMENT ON COLUMN bflocationtype.roadterminal IS '{"label": "Road terminal", "description": "Is the location a road terminal?", "summaryview": "false"}';
COMMENT ON COLUMN bflocationtype.portclassification IS '{"label": "Port classification", "description": "The classification of port type.", "summaryview": "true"}';
COMMENT ON COLUMN bflocationtype.description IS '{"label": "Description", "description": "Description of port crossing.", "summaryview": "true"}';
COMMENT ON COLUMN bflocationtype.validfrom IS '{"label": "Valid from date", "description": "Item valid from date.", "summaryview" : "false"}';
COMMENT ON COLUMN bflocationtype.validto IS '{"label": "Valid to date", "description": "Item valid to date.", "summaryview" : "false"}';
-- GRANTs
GRANT SELECT ON bflocationtype TO ${anonuser};
GRANT SELECT ON bflocationtype TO ${serviceuser};
GRANT SELECT ON bflocationtype TO ${readonlyuser};
|
<filename>Reindex_InstallScript.sql
--------------------------------------------------
-- VARIABLES -------------------------------------
-- CHANGE BELLOW IN WHOLE SCRIPT BEFORE EXECUTE --
-- CTRL + H --------------------------------------
--------------------------------------------------
-- N'sa' ==> Job owner
-- N'MSSQL Admins' ==> SQL Agent notification for failure
-- <EMAIL> ==> Who will receive the reports
--------------------------------------------------
USE [msdb]
GO
IF EXISTS (SELECT job_id FROM msdb.dbo.sysjobs_view WHERE name = N'__REINDEX__')
EXEC msdb.dbo.sp_delete_job @job_name=N'__REINDEX__', @delete_unused_schedule=1
GO
IF EXISTS (SELECT job_id FROM msdb.dbo.sysjobs_view WHERE name = N'__REINDEX_CHECK_FRAGM__')
EXEC msdb.dbo.sp_delete_job @job_name=N'__REINDEX_CHECK_FRAGM__', @delete_unused_schedule=1
GO
IF EXISTS (SELECT job_id FROM msdb.dbo.sysjobs_view WHERE name = N'__REINDEX_KILLER__')
EXEC msdb.dbo.sp_delete_job @job_name=N'__REINDEX_KILLER__', @delete_unused_schedule=1
GO
-------------------------------
-- PROCEDURES -----------------
-------------------------------
USE [_SQL_];
GO
IF NOT EXISTS
(
SELECT 1
FROM INFORMATION_SCHEMA.ROUTINES
WHERE SPECIFIC_SCHEMA = N'idx'
)
EXEC ('CREATE SCHEMA [idx];');
GO
IF NOT EXISTS
(
SELECT 1
FROM INFORMATION_SCHEMA.ROUTINES
WHERE SPECIFIC_SCHEMA = N'idx'
AND SPECIFIC_NAME = N'usp_CheckIndexFragmentation'
)
EXEC ('CREATE PROCEDURE [idx].[usp_CheckIndexFragmentation] AS SELECT 1');
GO
ALTER PROCEDURE [idx].[usp_CheckIndexFragmentation] @IgnoreDatabases NVARCHAR(MAX) = NULL
AS
BEGIN
EXEC [master].[dbo].[sp_BlitzIndex] @Mode = 2,
@GetAllDatabases = 1,
@OutputDatabaseName = '_SQL_',
@OutputSchemaName = 'idx',
@OutputTableName = 'IndexInventory',
@IgnoreDatabases = @IgnoreDatabases;
-- CREATE STRUCTURE ---
IF NOT EXISTS
(
SELECT 1
FROM sys.indexes
WHERE name = 'IX_run_datetime'
AND object_id = OBJECT_ID('idx.IndexInventory')
)
EXEC (' USE [_SQL_]
CREATE NONCLUSTERED INDEX [IX_run_datetime] ON [idx].[IndexInventory]
(
[run_datetime] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
USE [_SQL_];
CREATE TABLE [idx].[IndexFragmentation]
(
[id] [INT] IDENTITY(1, 1) NOT NULL,
[id_inventory] INT NOT NULL,
[index_type_desc] NVARCHAR(60) NOT NULL,
[index_depth] TINYINT NOT NULL,
[avg_fragmentation_in_percent] FLOAT NOT NULL,
[fragment_count] BIGINT NOT NULL,
[page_count] BIGINT NOT NULL,
[time_to_check] INT NOT NULL,
CONSTRAINT [PK_ID_IndexFragmentation]
PRIMARY KEY CLUSTERED ([id] ASC)
WITH(FILLFACTOR = 95) ON [PRIMARY]
) ON [PRIMARY];
IF NOT EXISTS
(
SELECT 1
FROM sys.indexes
WHERE name = ''IX_id_inventory''
AND object_id = OBJECT_ID(''idx.IndexFragmentation'')
)
CREATE INDEX [IX_id_inventory] ON [_SQL_].[idx].[IndexFragmentation] ([id_inventory]);
');
-- Get last check
DECLARE @id_current UNIQUEIDENTIFIER;
SELECT TOP (1)
@id_current = run_id
FROM [_SQL_].[idx].[IndexInventory]
WHERE run_datetime IN
(
SELECT MAX(run_datetime) FROM [_SQL_].[idx].[IndexInventory]
);
DECLARE @id INT = 0;
DECLARE @database_name NVARCHAR(128);
DECLARE @object_name NVARCHAR(128);
DECLARE @index_id INT;
DECLARE @SQL NVARCHAR(4000);
DECLARE id_cursor CURSOR FOR
SELECT id
FROM [_SQL_].[idx].[IndexInventory]
WHERE run_id = @id_current;
OPEN id_cursor;
FETCH NEXT FROM id_cursor
INTO @id;
WHILE @@FETCH_STATUS = 0
BEGIN
-- GET DATA
SELECT @database_name = database_name,
@object_name = N'[' +schema_name + N'].[' + table_name + N']',
@index_id = index_id
FROM [_SQL_].[idx].[IndexInventory]
WHERE id = @id;
-- INSERT RESULTS OF FRAGMENTATION
SET @SQL
= N'
USE [' + @database_name
+ N'];
DECLARE @time1 DATETIME = (SELECT GETDATE());
DECLARE @Ident INT;
INSERT INTO [_SQL_].[idx].[IndexFragmentation] (id_inventory, index_type_desc, index_depth, avg_fragmentation_in_percent, fragment_count, page_count, time_to_check)
SELECT ' + CAST(@id AS NVARCHAR(10))
+ N' AS id_inventory, ips.index_type_desc, ips.index_depth, ips.avg_fragmentation_in_percent, ips.fragment_count, ips.page_count, 0
FROM sys.dm_db_index_physical_stats(DB_ID(''' + @database_name + N'''), OBJECT_ID(''' + @object_name + N'''), '
+ CAST(@index_id AS NVARCHAR(10))
+ N', 0, ''LIMITED'') ips
INNER JOIN sys.indexes i
ON (ips.object_id = i.object_id)
AND (ips.index_id = i.index_id)
WHERE alloc_unit_type_desc = ''IN_ROW_DATA'';
SET @Ident = (SELECT SCOPE_IDENTITY());
DECLARE @time2 DATETIME = (SELECT GETDATE());
-- UPDATE how long did it take
UPDATE [_SQL_].[idx].[IndexFragmentation]
SET time_to_check = DATEDIFF(SECOND, @time1, @time2)
WHERE id = @Ident;
';
--PRINT @SQL;
EXECUTE (@SQL);
FETCH NEXT FROM id_cursor
INTO @id;
END;
CLOSE id_cursor;
DEALLOCATE id_cursor;
END;
GO
USE [_SQL_];
GO
IF NOT EXISTS
(
SELECT 1
FROM INFORMATION_SCHEMA.ROUTINES
WHERE SPECIFIC_SCHEMA = N'idx'
)
EXEC ('CREATE SCHEMA [idx];');
GO
IF NOT EXISTS
(
SELECT 1
FROM INFORMATION_SCHEMA.ROUTINES
WHERE SPECIFIC_SCHEMA = N'idx'
AND SPECIFIC_NAME = N'usp_CreateToDoIndexList'
)
EXEC ('CREATE PROCEDURE [idx].[usp_CreateToDoIndexList] AS SELECT 1');
GO
-- EXEC [_SQL_].[idx].[usp_CreateToDoIndexList] @email_rec = '<EMAIL>'
ALTER PROCEDURE [idx].[usp_CreateToDoIndexList] @profile_name NVARCHAR(128) = 'mail_profile', @email_rec NVARCHAR(MAX) = '<EMAIL>'
AS
BEGIN
-- CREATE STRUCTURE
IF NOT EXISTS
(
SELECT 1
FROM sys.tables
WHERE name = 'IndexToDo'
)
EXEC (' USE [_SQL_]
CREATE TABLE [idx].[IndexToDo](
[id] [INT] IDENTITY(1,1) NOT NULL,
[AddedDate] DATETIME2 NOT NULL,
[server_name] [nvarchar](128) NULL,
[database_name] [nvarchar](128) NULL,
[schema_name] [nvarchar](128) NULL,
[table_name] [nvarchar](128) NULL,
[index_name] [nvarchar](128) NULL,
[index_type_desc] [nvarchar](60) NULL,
[total_reserved_MB] [numeric](29, 2) NULL,
[avg_fragmentation_in_percent] [float] NULL,
[SQL] [nvarchar](max) NULL,
[ClassifiedBy] [varchar](200) NOT NULL,
[Done] BIT NOT NULL
CONSTRAINT [PK_ID_IndexToDo] PRIMARY KEY CLUSTERED
(
[id] ASC
)
) ON [PRIMARY]
');
IF NOT EXISTS
(
SELECT 1
FROM sys.tables
WHERE name = 'IndexToDoExceptions'
)
EXEC (' USE [_SQL_]
CREATE TABLE [idx].[IndexToDoExceptions](
[id] [INT] IDENTITY(1,1) NOT NULL,
[SQL] [nvarchar](max) NULL
CONSTRAINT [PK_ID_IndexToDoExceptions] PRIMARY KEY CLUSTERED
(
[id] ASC
)
) ON [PRIMARY]
');
-- Check exists rows in [_SQL_].[idx].[IndexToDo]
IF NOT EXISTS
(
SELECT 1 FROM [_SQL_].[idx].[IndexToDo] WHERE Done = 0
)
BEGIN
-- CHECK EDITION
DECLARE @RebuildMode NVARCHAR(15);
SELECT @RebuildMode = CASE
WHEN SERVERPROPERTY ('EditionID') IN (1804890536, 1872460670, 610778273, -2117995310, 1674378470) THEN 'ONLINE = ON(WAIT_AT_LOW_PRIORITY (MAX_DURATION = 1 MINUTES, ABORT_AFTER_WAIT = SELF))'
ELSE 'ONLINE = OFF(WAIT_AT_LOW_PRIORITY (MAX_DURATION = 1 MINUTES, ABORT_AFTER_WAIT = SELF))'
END;
-- GET TOP 10 THE MOST FRAGMENTATION (LESS THEN 1 GB) --
INSERT INTO [_SQL_].[idx].[IndexToDo]
SELECT TOP(10)
SYSDATETIME() AS AddedDate,
indxi.server_name,
indxi.database_name,
indxi.schema_name,
indxi.table_name,
indxi.index_name,
indxf.index_type_desc,
indxi.total_reserved_MB,
indxf.avg_fragmentation_in_percent,
CASE
WHEN (indxf.index_type_desc = 'HEAP') THEN N'ALTER TABLE [' + indxi.database_name + '].[' + indxi.schema_name + '].[' + indxi.table_name + '] REBUILD WITH (' + @RebuildMode + ')'
WHEN (indxf.index_type_desc = 'NONCLUSTERED INDEX') THEN N'ALTER INDEX [' + indxi.index_name + '] ON [' + indxi.database_name + '].[' + indxi.schema_name + '].[' + indxi.table_name + '] REBUILD WITH (' + @RebuildMode + ')'
WHEN (indxf.index_type_desc = 'CLUSTERED INDEX') THEN N'ALTER INDEX [' + indxi.index_name + '] ON [' + indxi.database_name + '].[' + indxi.schema_name + '].[' + indxi.table_name + '] REBUILD WITH (' + @RebuildMode + ')'
WHEN (indxf.index_type_desc = 'PRIMARY XML INDEX') THEN N'ALTER INDEX [' + indxi.index_name + '] ON [' + indxi.database_name + '].[' + indxi.schema_name + '].[' + indxi.table_name + '] REBUILD WITH (' + @RebuildMode + ')'
ELSE N'WARNING! STRANGE INDEX ==> [' + indxi.database_name + '].[' + indxi.schema_name + '].[' + indxi.table_name + '] SIZE: ' + CAST(indxi.total_reserved_MB AS NVARCHAR(100)) + ' MB'
END AS [SQL],
'CL1 - MOST FRAMGMENTATION (LESS THEN 1 GB)' AS ClassifiedBy,
0 AS Done
FROM [_SQL_].[idx].[IndexInventory] AS indxi
LEFT JOIN [_SQL_].[idx].[IndexFragmentation] AS indxf
ON indxi.id = indxf.id_inventory
WHERE indxi.run_datetime =
(
SELECT MAX(run_datetime) FROM [_SQL_].[idx].[IndexInventory]
)
AND indxi.total_reserved_MB <= 1000
AND indxf.avg_fragmentation_in_percent > 80
ORDER BY indxf.avg_fragmentation_in_percent DESC
-- GET TOP 10 THE MOST FRAGMENTATION (BIGGER THEN 50 GB AND LESS THEN 120 GB) --
INSERT INTO [_SQL_].[idx].[IndexToDo]
SELECT TOP(10)
SYSDATETIME() AS AddedDate,
indxi.server_name,
indxi.database_name,
indxi.schema_name,
indxi.table_name,
indxi.index_name,
indxf.index_type_desc,
indxi.total_reserved_MB,
indxf.avg_fragmentation_in_percent,
CASE
WHEN (indxf.index_type_desc = 'HEAP') THEN N'ALTER TABLE [' + indxi.database_name + '].[' + indxi.schema_name + '].[' + indxi.table_name + '] REBUILD WITH (' + @RebuildMode + ')'
WHEN (indxf.index_type_desc = 'NONCLUSTERED INDEX') THEN N'ALTER INDEX [' + indxi.index_name + '] ON [' + indxi.database_name + '].[' + indxi.schema_name + '].[' + indxi.table_name + '] REBUILD WITH (' + @RebuildMode + ')'
WHEN (indxf.index_type_desc = 'CLUSTERED INDEX') THEN N'ALTER INDEX [' + indxi.index_name + '] ON [' + indxi.database_name + '].[' + indxi.schema_name + '].[' + indxi.table_name + '] REBUILD WITH (' + @RebuildMode + ')'
WHEN (indxf.index_type_desc = 'PRIMARY XML INDEX') THEN N'ALTER INDEX [' + indxi.index_name + '] ON [' + indxi.database_name + '].[' + indxi.schema_name + '].[' + indxi.table_name + '] REBUILD WITH (' + @RebuildMode + ')'
ELSE N'WARNING! STRANGE INDEX ==> [' + indxi.database_name + '].[' + indxi.schema_name + '].[' + indxi.table_name + '] SIZE: ' + CAST(indxi.total_reserved_MB AS NVARCHAR(100)) + ' MB'
END AS [SQL],
'CL2 - MOST FRAMGMENTATION (BIGGER THEN 1 GB AND LESS THEN 50 GB)' AS ClassifiedBy,
0 AS Done
FROM [_SQL_].[idx].[IndexInventory] AS indxi
LEFT JOIN [_SQL_].[idx].[IndexFragmentation] AS indxf
ON indxi.id = indxf.id_inventory
WHERE indxi.run_datetime =
(
SELECT MAX(run_datetime) FROM [_SQL_].[idx].[IndexInventory]
)
AND indxi.total_reserved_MB > 1000
AND indxi.total_reserved_MB <= 50000
AND indxf.avg_fragmentation_in_percent > 70
ORDER BY indxf.avg_fragmentation_in_percent DESC
-- GET TOP 10 THE MOST FRAGMENTATION (BIGGER THEN 50 GB AND LESS THEN 120 GB) --
INSERT INTO [_SQL_].[idx].[IndexToDo]
SELECT TOP(10)
SYSDATETIME() AS AddedDate,
indxi.server_name,
indxi.database_name,
indxi.schema_name,
indxi.table_name,
indxi.index_name,
indxf.index_type_desc,
indxi.total_reserved_MB,
indxf.avg_fragmentation_in_percent,
CASE
WHEN (indxf.index_type_desc = 'HEAP') THEN N'WARNING! STRANGE HEAP: [' + indxi.database_name + '].[' + indxi.schema_name + '].[' + indxi.table_name + '] Size: ' + CAST(indxi.total_reserved_MB AS NVARCHAR(100)) + ' MB'
WHEN (indxf.index_type_desc = 'NONCLUSTERED INDEX') THEN N'ALTER INDEX [' + indxi.index_name + '] ON [' + indxi.database_name + '].[' + indxi.schema_name + '].[' + indxi.table_name + '] REBUILD WITH (' + @RebuildMode + ')'
WHEN (indxf.index_type_desc = 'CLUSTERED INDEX') THEN N'ALTER INDEX [' + indxi.index_name + '] ON [' + indxi.database_name + '].[' + indxi.schema_name + '].[' + indxi.table_name + '] REBUILD WITH (' + @RebuildMode + ')'
WHEN (indxf.index_type_desc = 'PRIMARY XML INDEX') THEN N'ALTER INDEX [' + indxi.index_name + '] ON [' + indxi.database_name + '].[' + indxi.schema_name + '].[' + indxi.table_name + '] REORGANIZE'
ELSE N'WARNING! STRANGE INDEX ==> [' + indxi.database_name + '].[' + indxi.schema_name + '].[' + indxi.table_name + '] SIZE: ' + CAST(indxi.total_reserved_MB AS NVARCHAR(100)) + ' MB'
END AS [SQL],
'CL3 - MOST FRAMGMENTATION (BIGGER THEN 50 GB AND LESS THEN 120 GB)' AS ClassifiedBy,
0 AS Done
FROM [_SQL_].[idx].[IndexInventory] AS indxi
LEFT JOIN [_SQL_].[idx].[IndexFragmentation] AS indxf
ON indxi.id = indxf.id_inventory
WHERE indxi.run_datetime =
(
SELECT MAX(run_datetime) FROM [_SQL_].[idx].[IndexInventory]
)
AND indxi.total_reserved_MB > 50000
AND indxi.total_reserved_MB <= 120000
AND indxf.avg_fragmentation_in_percent > 60
ORDER BY indxf.avg_fragmentation_in_percent DESC
-- GET TOP 10 THE MOST FRAGMENTATION (BIGGER THEN 120 GB) --
INSERT INTO [_SQL_].[idx].[IndexToDo]
SELECT TOP(10)
SYSDATETIME() AS AddedDate,
indxi.server_name,
indxi.database_name,
indxi.schema_name,
indxi.table_name,
indxi.index_name,
indxf.index_type_desc,
indxi.total_reserved_MB,
indxf.avg_fragmentation_in_percent,
CASE
WHEN (indxf.index_type_desc = 'HEAP') THEN N'WARNING! STRANGE HEAP: [' + indxi.database_name + '].[' + indxi.schema_name + '].[' + indxi.table_name + '] Size: ' + CAST(indxi.total_reserved_MB AS NVARCHAR(100)) + ' MB'
WHEN (indxf.index_type_desc = 'NONCLUSTERED INDEX') THEN N'ALTER INDEX [' + indxi.index_name + '] ON [' + indxi.database_name + '].[' + indxi.schema_name + '].[' + indxi.table_name + '] REORGANIZE'
WHEN (indxf.index_type_desc = 'CLUSTERED INDEX') THEN N'ALTER INDEX [' + indxi.index_name + '] ON [' + indxi.database_name + '].[' + indxi.schema_name + '].[' + indxi.table_name + '] REORGANIZE'
WHEN (indxf.index_type_desc = 'PRIMARY XML INDEX') THEN N'ALTER INDEX [' + indxi.index_name + '] ON [' + indxi.database_name + '].[' + indxi.schema_name + '].[' + indxi.table_name + '] REORGANIZE'
ELSE N'WARNING! STRANGE INDEX ==> [' + indxi.database_name + '].[' + indxi.schema_name + '].[' + indxi.table_name + '] SIZE: ' + CAST(indxi.total_reserved_MB AS NVARCHAR(100)) + ' MB'
END AS [SQL],
'CL4 - MOST FRAMGMENTATION (BIGGER THEN 120 GB)' AS ClassifiedBy,
0 AS Done
FROM [_SQL_].[idx].[IndexInventory] AS indxi
LEFT JOIN [_SQL_].[idx].[IndexFragmentation] AS indxf
ON indxi.id = indxf.id_inventory
WHERE indxi.run_datetime =
(
SELECT MAX(run_datetime) FROM [_SQL_].[idx].[IndexInventory]
)
AND indxi.total_reserved_MB > 120000
AND indxf.avg_fragmentation_in_percent > 50
ORDER BY indxf.avg_fragmentation_in_percent DESC
-- GET TOP 10 THE MOST FRAGMENTATION (THE MOST READERS) --
INSERT INTO [_SQL_].[idx].[IndexToDo]
SELECT TOP(10)
SYSDATETIME() AS AddedDate,
indxi.server_name,
indxi.database_name,
indxi.schema_name,
indxi.table_name,
indxi.index_name,
indxf.index_type_desc,
indxi.total_reserved_MB,
indxf.avg_fragmentation_in_percent,
CASE
WHEN (indxf.index_type_desc = 'HEAP') AND indxi.total_reserved_MB < 50000 THEN N'ALTER TABLE [' + indxi.database_name + '].[' + indxi.schema_name + '].[' + indxi.table_name + '] REBUILD WITH (' + @RebuildMode + ')'
WHEN (indxf.index_type_desc = 'HEAP') AND indxi.total_reserved_MB >= 50000 THEN N'WARNING! STRANGE HEAP: [' + indxi.database_name + '].[' + indxi.schema_name + '].[' + indxi.table_name + '] Size: ' + CAST(indxi.total_reserved_MB AS NVARCHAR(100)) + ' MB'
WHEN (indxf.index_type_desc = 'NONCLUSTERED INDEX') THEN N'ALTER INDEX [' + indxi.index_name + '] ON [' + indxi.database_name + '].[' + indxi.schema_name + '].[' + indxi.table_name + '] REORGANIZE'
WHEN (indxf.index_type_desc = 'CLUSTERED INDEX') THEN N'ALTER INDEX [' + indxi.index_name + '] ON [' + indxi.database_name + '].[' + indxi.schema_name + '].[' + indxi.table_name + '] REORGANIZE'
WHEN (indxf.index_type_desc = 'PRIMARY XML INDEX') THEN N'ALTER INDEX [' + indxi.index_name + '] ON [' + indxi.database_name + '].[' + indxi.schema_name + '].[' + indxi.table_name + '] REORGANIZE'
ELSE N'WARNING! STRANGE INDEX ==> [' + indxi.database_name + '].[' + indxi.schema_name + '].[' + indxi.table_name + '] SIZE: ' + CAST(indxi.total_reserved_MB AS NVARCHAR(100)) + ' MB'
END AS [SQL],
'CL5 - MOST FRAMGMENTATION (THE MOST READERS)' AS ClassifiedBy,
0 AS Done
FROM [_SQL_].[idx].[IndexInventory] AS indxi
LEFT JOIN [_SQL_].[idx].[IndexFragmentation] AS indxf
ON indxi.id = indxf.id_inventory
WHERE indxi.run_datetime =
(
SELECT MAX(run_datetime) FROM [_SQL_].[idx].[IndexInventory]
)
AND indxi.reads_per_write > 0.5
AND indxf.avg_fragmentation_in_percent > 50
ORDER BY indxf.avg_fragmentation_in_percent DESC
--- ENABLE JOB FOR REINDEX ---
EXEC msdb.dbo.sp_update_job @job_name=N'__REINDEX__',
@enabled=1;
--- SEND EMAILS FOR STRANGE INDEXES
DECLARE @sql NVARCHAR(MAX);
DECLARE @send_email BIT = 0;
DECLARE @subject NVARCHAR(256);
DECLARE @body NVARCHAR(MAX) = N'';
DECLARE sql_cursor CURSOR FOR
SELECT [SQL]
FROM [_SQL_].[idx].[IndexToDo]
WHERE SQL LIKE 'WARNING!%' AND Done = 0;
OPEN sql_cursor;
FETCH NEXT FROM sql_cursor
INTO @sql;
WHILE @@FETCH_STATUS = 0
BEGIN
SET @send_email = 1;
SET @body += @sql + '</br>';
FETCH NEXT FROM sql_cursor
INTO @sql;
END;
CLOSE sql_cursor;
DEALLOCATE sql_cursor;
IF (@send_email = 1)
BEGIN
SET @subject = '[' + @@SERVERNAME + '] I found big, on the exceptions list or strange index!'
EXEC msdb.dbo.sp_send_dbmail
@profile_name = @profile_name,
@recipients = @email_rec,
@body = @body,
@subject = @subject,
@body_format = 'HTML';
UPDATE [_SQL_].[idx].[IndexToDo]
SET Done = 1
WHERE SQL LIKE 'WARNING!%' AND Done = 0;
END -- send email
-- Update Exceptions
UPDATE [_SQL_].[idx].[IndexToDo]
SET Done = 1
WHERE [SQL] IN (SELECT [SQL] FROM [_SQL_].[idx].[IndexToDoExceptions]);
END -- check if not exists rows in [_SQL_].[idx].[IndexToDo]
END -- OF PROCEDURE
GO
USE [_SQL_];
GO
IF NOT EXISTS
(
SELECT 1
FROM INFORMATION_SCHEMA.ROUTINES
WHERE SPECIFIC_SCHEMA = N'idx'
)
EXEC ('CREATE SCHEMA [idx];');
GO
IF NOT EXISTS
(
SELECT 1
FROM INFORMATION_SCHEMA.ROUTINES
WHERE SPECIFIC_SCHEMA = N'idx'
AND SPECIFIC_NAME = N'usp_Reindex'
)
EXEC ('CREATE PROCEDURE [idx].[usp_Reindex] AS SELECT 1');
GO
-- EXAMPLE: EXEC [_SQL_].[idx].[usp_Reindex] @profile_name = 'mail_profile', @email_rec = '<EMAIL>'
ALTER PROCEDURE [idx].[usp_Reindex] @profile_name NVARCHAR(128) = 'mail_profile', @email_rec NVARCHAR(MAX) = '<EMAIL>'
AS
BEGIN
DECLARE @Subject NVARCHAR(255)
SET @Subject = '[' + @@SERVERNAME + '] - ERROR DURING REBUILD/REORGANIZATION OF THE INDEX';
DECLARE @ID INT
DECLARE @command NVARCHAR(MAX)
DECLARE @errortext NVARCHAR(MAX)
DECLARE @Count INT
SELECT @Count = COUNT(*) FROM [_SQL_].[idx].[IndexToDo] WHERE Done = 0
IF (@Count > 0)
BEGIN
SELECT TOP(1) @ID = [id]
,@command = [SQL]
FROM [_SQL_].[idx].[IndexToDo]
WHERE Done = 0
ORDER BY [id];
BEGIN TRY
EXEC (@command)
END TRY
BEGIN CATCH
SELECT @errortext = ERROR_MESSAGE();
-- check text = Online index operation cannot be performed%
IF (@errortext like '%online index operation cannot be performed%' or @errortext like '%online operation cannot be performed for index%')
BEGIN
BEGIN TRY
SET @command = REPLACE(@command, 'REBUILD WITH (ONLINE = ON(WAIT_AT_LOW_PRIORITY (MAX_DURATION = 1 MINUTES, ABORT_AFTER_WAIT = SELF)))', 'REORGANIZE')
EXEC (@command)
END TRY
BEGIN CATCH
SELECT @errortext = ERROR_MESSAGE();
SET @errortext = @command + CHAR(10) + CHAR(13) + @errortext;
--send email error message
EXEC msdb.dbo.sp_send_dbmail
@profile_name = @profile_name,
@recipients = @email_rec,
@body = @errortext,
@subject = @Subject;
END CATCH
END
ELSE
BEGIN
SELECT @errortext = ERROR_MESSAGE();
SET @errortext = @command + CHAR(10) + CHAR(13) + @errortext;
--send email error message
EXEC msdb.dbo.sp_send_dbmail
@profile_name = @profile_name,
@recipients = @email_rec,
@body = @errortext,
@subject = @Subject;
END
END CATCH
UPDATE [_SQL_].[idx].[IndexToDo] SET Done = 1 WHERE [Done] = 0 AND id = @ID
END
ELSE
BEGIN
EXEC msdb.dbo.sp_update_job @job_name=N'__REINDEX__',
@enabled=0
END
END
GO
USE [_SQL_];
GO
IF NOT EXISTS
(
SELECT 1
FROM INFORMATION_SCHEMA.ROUTINES
WHERE SPECIFIC_SCHEMA = N'idx'
)
EXEC ('CREATE SCHEMA [idx];');
GO
IF NOT EXISTS
(
SELECT 1
FROM INFORMATION_SCHEMA.ROUTINES
WHERE SPECIFIC_SCHEMA = N'idx'
AND SPECIFIC_NAME = N'usp_KillLongReindexSession'
)
EXEC ('CREATE PROCEDURE [idx].[usp_KillLongReindexSession] AS SELECT 1');
GO
-- EXAMPLE: EXEC [_SQL_].[idx].[usp_KillLongReindexSession]
ALTER PROCEDURE [idx].[usp_KillLongReindexSession]
AS
BEGIN
DECLARE @SPID INT;
SELECT TOP(1) @SPID = session_id
FROM sys.dm_exec_requests r
OUTER APPLY sys.dm_exec_sql_text(sql_handle) t
JOIN sys.sysprocesses sp ON r.session_id = sp.spid
WHERE session_id != @@SPID
AND session_id > 50
AND SUBSTRING( t.text,
(r.statement_start_offset / 2) + 1,
CASE
WHEN statement_end_offset = -1
OR statement_end_offset = 0 THEN
(DATALENGTH(t.text) - r.statement_start_offset / 2) + 1
ELSE
(r.statement_end_offset - r.statement_start_offset) / 2 + 1
END
) LIKE 'ALTER%REORGANIZE%'
OR SUBSTRING( t.text,
(r.statement_start_offset / 2) + 1,
CASE
WHEN statement_end_offset = -1
OR statement_end_offset = 0 THEN
(DATALENGTH(t.text) - r.statement_start_offset / 2) + 1
ELSE
(r.statement_end_offset - r.statement_start_offset) / 2 + 1
END
) LIKE 'ALTER%REBUILD%';
IF (@SPID IS NOT NULL)
EXEC ('KILL ' + @SPID);
END;
GO
-------------------------------
-- JOBS -----------------------
-------------------------------
USE [msdb]
GO
DECLARE @jobId BINARY(16)
DECLARE @desc_1 NVARCHAR(MAX) = 'Index inventory and fragmentation check - ' + SUSER_NAME() + ' - ' + CONVERT(CHAR(10), GETDATE(), 121)
EXEC msdb.dbo.sp_add_job @job_name=N'__REINDEX_CHECK_FRAGM__',
@enabled=1,
@notify_level_eventlog=0,
@notify_level_email=2,
@notify_level_page=2,
@delete_level=0,
@description= @desc_1,
@category_name=N'Database Maintenance',
@owner_login_name=N'sa',
@notify_email_operator_name=N'MSSQL Admins', @job_id = @jobId OUTPUT
select @jobId
GO
EXEC msdb.dbo.sp_add_jobserver @job_name=N'__REINDEX_CHECK_FRAGM__'
GO
USE [msdb]
GO
EXEC msdb.dbo.sp_add_jobstep @job_name=N'__REINDEX_CHECK_FRAGM__', @step_name=N'_fragm_check_',
@step_id=1,
@cmdexec_success_code=0,
@on_success_action=1,
@on_fail_action=2,
@retry_attempts=0,
@retry_interval=0,
@os_run_priority=0, @subsystem=N'TSQL',
@command=N'EXEC [idx].[usp_CheckIndexFragmentation]
EXEC [idx].[usp_CreateToDoIndexList] @email_rec = ''<EMAIL>''',
@database_name=N'_SQL_',
@flags=0
GO
USE [msdb]
GO
DECLARE @desc_1 NVARCHAR(MAX) = 'Index inventory and fragmentation check - ' + SUSER_NAME() + ' - ' + CONVERT(CHAR(10), GETDATE(), 121)
EXEC msdb.dbo.sp_update_job @job_name=N'__REINDEX_CHECK_FRAGM__',
@enabled=1,
@start_step_id=1,
@notify_level_eventlog=0,
@notify_level_email=2,
@notify_level_page=2,
@delete_level=0,
@description=@desc_1,
@category_name=N'Database Maintenance',
@owner_login_name=N'sa',
@notify_email_operator_name=N'MSSQL Admins',
@notify_page_operator_name=N''
GO
USE [msdb]
GO
DECLARE @schedule_id int
EXEC msdb.dbo.sp_add_jobschedule @job_name=N'__REINDEX_CHECK_FRAGM__', @name=N'third Sat of every Month',
@enabled=1,
@freq_type=32,
@freq_interval=7,
@freq_subday_type=1,
@freq_subday_interval=0,
@freq_relative_interval=4,
@freq_recurrence_factor=1,
@active_start_date=20191020,
@active_end_date=99991231,
@active_start_time=230000,
@active_end_time=235959, @schedule_id = @schedule_id OUTPUT
select @schedule_id
GO
USE [msdb]
GO
/****** Object: Job [__REINDEX__] Script Date: 20.11.2019 15:09:06 ******/
BEGIN TRANSACTION
DECLARE @ReturnCode INT
SELECT @ReturnCode = 0
/****** Object: JobCategory [Database Maintenance] Script Date: 20.11.2019 15:09:06 ******/
IF NOT EXISTS (SELECT name FROM msdb.dbo.syscategories WHERE name=N'Database Maintenance' AND category_class=1)
BEGIN
EXEC @ReturnCode = msdb.dbo.sp_add_category @class=N'JOB', @type=N'LOCAL', @name=N'Database Maintenance'
IF (@@ERROR <> 0 OR @ReturnCode <> 0) GOTO QuitWithRollback
END
DECLARE @jobId BINARY(16)
DECLARE @desc_1 NVARCHAR(MAX) = 'Rebuild indexes from [_SQL_].[idx].[IndexToDo] list - ' + SUSER_NAME() + ' - ' + CONVERT(CHAR(10), GETDATE(), 121)
EXEC @ReturnCode = msdb.dbo.sp_add_job @job_name=N'__REINDEX__',
@enabled=1,
@notify_level_eventlog=0,
@notify_level_email=2,
@notify_level_netsend=0,
@notify_level_page=0,
@delete_level=0,
@description=@desc_1,
@category_name=N'Database Maintenance',
@owner_login_name=N'sa',
@notify_email_operator_name=N'MSSQL Admins', @job_id = @jobId OUTPUT
IF (@@ERROR <> 0 OR @ReturnCode <> 0) GOTO QuitWithRollback
/****** Object: Step [_RX_] Script Date: 20.11.2019 15:09:06 ******/
EXEC @ReturnCode = msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'_RX_',
@step_id=1,
@cmdexec_success_code=0,
@on_success_action=1,
@on_success_step_id=0,
@on_fail_action=2,
@on_fail_step_id=0,
@retry_attempts=0,
@retry_interval=0,
@os_run_priority=0, @subsystem=N'TSQL',
@command=N'EXEC [_SQL_].[idx].[usp_Reindex] @profile_name = ''mail_profile'', @email_rec = ''<EMAIL>''',
@database_name=N'_SQL_',
@flags=0
IF (@@ERROR <> 0 OR @ReturnCode <> 0) GOTO QuitWithRollback
EXEC @ReturnCode = msdb.dbo.sp_update_job @job_id = @jobId, @start_step_id = 1
IF (@@ERROR <> 0 OR @ReturnCode <> 0) GOTO QuitWithRollback
EXEC @ReturnCode = msdb.dbo.sp_add_jobschedule @job_id=@jobId, @name=N'Sunday At Midday During 1 Hour',
@enabled=1,
@freq_type=8,
@freq_interval=1,
@freq_subday_type=2,
@freq_subday_interval=10,
@freq_relative_interval=0,
@freq_recurrence_factor=1,
@active_start_date=20191120,
@active_end_date=99991231,
@active_start_time=120000,
@active_end_time=125959
IF (@@ERROR <> 0 OR @ReturnCode <> 0) GOTO QuitWithRollback
EXEC @ReturnCode = msdb.dbo.sp_add_jobserver @job_id = @jobId, @server_name = N'(local)'
IF (@@ERROR <> 0 OR @ReturnCode <> 0) GOTO QuitWithRollback
COMMIT TRANSACTION
GOTO EndSave
QuitWithRollback:
IF (@@TRANCOUNT > 0) ROLLBACK TRANSACTION
EndSave:
GO
USE [msdb]
GO
EXEC msdb.dbo.sp_update_job @job_name=N'__REINDEX__',
@enabled=0
GO
USE [msdb]
GO
/****** Object: Job [__REINDEX_KILLER__] Script Date: 25.11.2019 11:41:17 ******/
BEGIN TRANSACTION
DECLARE @ReturnCode INT
SELECT @ReturnCode = 0
/****** Object: JobCategory [Database Maintenance] Script Date: 25.11.2019 11:41:17 ******/
IF NOT EXISTS (SELECT name FROM msdb.dbo.syscategories WHERE name=N'Database Maintenance' AND category_class=1)
BEGIN
EXEC @ReturnCode = msdb.dbo.sp_add_category @class=N'JOB', @type=N'LOCAL', @name=N'Database Maintenance'
IF (@@ERROR <> 0 OR @ReturnCode <> 0) GOTO QuitWithRollback
END
DECLARE @jobId BINARY(16)
DECLARE @desc_1 NVARCHAR(MAX) = 'Killing long sessions with rebuilt indexes - ' + SUSER_NAME() + ' - ' + CONVERT(CHAR(10), GETDATE(), 121)
EXEC @ReturnCode = msdb.dbo.sp_add_job @job_name=N'__REINDEX_KILLER__',
@enabled=1,
@notify_level_eventlog=0,
@notify_level_email=2,
@notify_level_netsend=0,
@notify_level_page=0,
@delete_level=0,
@description=@desc_1,
@category_name=N'Database Maintenance',
@owner_login_name=N'sa',
@notify_email_operator_name=N'MSSQL Admins', @job_id = @jobId OUTPUT
IF (@@ERROR <> 0 OR @ReturnCode <> 0) GOTO QuitWithRollback
/****** Object: Step [_RX_] Script Date: 25.11.2019 11:41:17 ******/
EXEC @ReturnCode = msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'_RX_',
@step_id=1,
@cmdexec_success_code=0,
@on_success_action=1,
@on_success_step_id=0,
@on_fail_action=2,
@on_fail_step_id=0,
@retry_attempts=0,
@retry_interval=0,
@os_run_priority=0, @subsystem=N'TSQL',
@command=N'EXEC [_SQL_].[idx].[usp_KillLongReindexSession]',
@database_name=N'_SQL_',
@flags=0
IF (@@ERROR <> 0 OR @ReturnCode <> 0) GOTO QuitWithRollback
EXEC @ReturnCode = msdb.dbo.sp_update_job @job_id = @jobId, @start_step_id = 1
IF (@@ERROR <> 0 OR @ReturnCode <> 0) GOTO QuitWithRollback
EXEC @ReturnCode = msdb.dbo.sp_add_jobschedule @job_id=@jobId, @name=N'Sunday At 4 PM',
@enabled=1,
@freq_type=8,
@freq_interval=1,
@freq_subday_type=1,
@freq_subday_interval=10,
@freq_relative_interval=0,
@freq_recurrence_factor=1,
@active_start_date=20191120,
@active_end_date=99991231,
@active_start_time=160000,
@active_end_time=235959
IF (@@ERROR <> 0 OR @ReturnCode <> 0) GOTO QuitWithRollback
EXEC @ReturnCode = msdb.dbo.sp_add_jobserver @job_id = @jobId, @server_name = N'(local)'
IF (@@ERROR <> 0 OR @ReturnCode <> 0) GOTO QuitWithRollback
COMMIT TRANSACTION
GOTO EndSave
QuitWithRollback:
IF (@@TRANCOUNT > 0) ROLLBACK TRANSACTION
EndSave:
GO
|
<gh_stars>0
-- user management
create table users (
USER_NAME varchar(15) not null primary key,
USER_PASSWD varchar(15) not null
);
insert into users (USER_NAME, USER_PASSWD) values('<PASSWORD>','<PASSWORD>');
insert into users (USER_NAME, USER_PASSWD) values('<PASSWORD>','<PASSWORD>');
create table user_roles (
USER_NAME varchar(15) not null,
ROLE_NAME varchar(15) not null,
primary key (USER_NAME, ROLE_NAME)
);
insert into user_roles (USER_NAME, ROLE_NAME) values('admin','admin');
insert into user_roles (USER_NAME, ROLE_NAME) values('admin','moderator-api');
insert into user_roles (USER_NAME, ROLE_NAME) values('admin','moderator-gui');
insert into user_roles (USER_NAME, ROLE_NAME) values('moderator','moderator-api');
insert into user_roles (USER_NAME, ROLE_NAME) values('moderator','moderator-gui');
-- media content
-- sessions
create table tomcat_sessions
(
session_id varchar(100) not null primary key,
valid_sessions char(1) not null,
max_inactive int not null,
last_access bigint not null,
app_name varchar(255),
session_data bytea
);
CREATE INDEX kapp_name ON tomcat_sessions USING hash (app_name);
|
<filename>migrations/sqls/20220312024630-orders-books-table-up.sql<gh_stars>0
CREATE TABLE order_books (
id SERIAL PRIMARY KEY,
quantity integer,
order_id bigint REFERENCES orders(id),
book_id bigint REFERENCES books(id)
);
|
-- # ASSIGNMENT-5 # --
--USE EMPLOYEE
SELECT EMP.EMPID, NAME, CITY, DOJ, DEPT, SALARY
FROM EMP
INNER JOIN EMPSAL
ON EMP.EMPID=EMPSAL.EMPID
WHERE CITY = 'DELHI';
--------------------
SELECT EMP.EMPID, NAME, ADDR, CITY, PHNO, EMAIL, DOB FROM EMP
LEFT JOIN EMPSAL
ON EMP.EMPID = EMPSAL.EMPID
WHERE EMPSAL.EMPID IS NULL;
|
DROP TRIGGER lexeme_delete_trigger ON thoughts;
--;;
DROP FUNCTION delete_thought_lexeme();
|
CREATE TABLE [dbo].[hlsysassociation]
(
[associationid] INT NOT NULL CONSTRAINT [CK_hlsysassociation_idc_zr] CHECK ([associationid] > 0), -- see Bug_106197
[associationdefid] INT NOT NULL,
[objectida] INT NOT NULL CONSTRAINT [CK_hlsysassociation_ida_zr] CHECK ([objectida] > 0),
[objectdefida] INT NOT NULL,
[objectidb] INT NOT NULL CONSTRAINT [CK_hlsysassociation_idb_zr] CHECK ([objectidb] > 0),
[objectdefidb] INT NOT NULL,
[creationtime] DATETIME NOT NULL,
[lastmodified] DATETIME NOT NULL,
[owner] INT NOT NULL
, CONSTRAINT [PK_hlsysassociation] PRIMARY KEY CLUSTERED ([associationid] ASC)
, CONSTRAINT [FK_hlsysassociation_asdefid] FOREIGN KEY ([associationdefid]) REFERENCES [dbo].[hlsysassociationdef]([associationdefid])
, CONSTRAINT [FK_hlsysassociation_oadefid] FOREIGN KEY ([objectdefida]) REFERENCES [dbo].[hlsysobjectdef]([objectdefid])
, CONSTRAINT [FK_hlsysassociation_obdefid] FOREIGN KEY ([objectdefidb]) REFERENCES [dbo].[hlsysobjectdef]([objectdefid])
, CONSTRAINT [CK_hlsysassociation_aid_bid] CHECK ([objectida]<>[objectidb])
-- Needed for performance
, CONSTRAINT [UQ_hlsysassociation_cabidaidb] UNIQUE ([associationdefid],[objectdefida],[objectida],[objectdefidb],[objectidb]) -- @lubo(v62):Nice if this works for old customers!!! If not use the script below.
, CONSTRAINT [FK_hlsysassociation_owner] FOREIGN KEY ([owner]) REFERENCES [dbo].[hlsysagent]([agentid]) -- required by the trigger
)
GO
CREATE NONCLUSTERED INDEX [IX_hlsysassociation_cabida]
ON [dbo].[hlsysassociation]([associationdefid] ASC, [objectdefida] ASC, [objectdefidb] ASC, [objectida] ASC)
INCLUDE([associationid], [objectidb]);
GO
CREATE NONCLUSTERED INDEX [IX_hlsysassociation_cabidb]
ON [dbo].[hlsysassociation]([associationdefid] ASC, [objectdefida] ASC, [objectdefidb] ASC, [objectidb] ASC)
INCLUDE([associationid], [objectida]);
GO
CREATE NONCLUSTERED INDEX [IX_hlsysassociation_rolea] -- @lubo: v63up3 UseCase delete object
ON [dbo].[hlsysassociation]([objectida] ASC, [objectdefida] ASC)
INCLUDE([associationid], [associationdefid], [objectidb], [objectdefidb]);
GO
CREATE NONCLUSTERED INDEX [IX_hlsysassociation_roleb] -- @lubo: v63up3 UseCase delete object
ON [dbo].[hlsysassociation]([objectidb] ASC, [objectdefidb] ASC)
INCLUDE([associationid], [associationdefid], [objectida], [objectdefida]);
GO
/* HOW TO FIND/SHOW/ELIMINATE duplicates:
SELECT ai.associationdefid, ai.objectida, ai.objectidb, COUNT(ai.associationid)
FROM dbo.hlsysassociation AS ai
GROUP BY ai.associationdefid, ai.objectida, ai.objectidb
HAVING COUNT(ai.associationid) > 1;
--SELECT * FROM dbo.hlsysassociation AS ai WHERE ai.associationdefid = ... AND ai.objectida = ... AND ai.objectidb = ...;
--DELETE ai FROM dbo.hlsysassociation AS ai WHERE ai.associationdefid = ... AND ai.objectida = ... AND ai.objectidb = ...;
*/
|
<filename>procedures/recompile.sql
CREATE OR REPLACE PROCEDURE recompile (
in_name VARCHAR2 := '%',
in_type VARCHAR2 := '%',
in_level NUMBER := 2,
in_interpreted BOOLEAN := TRUE,
in_identifiers BOOLEAN := TRUE,
in_statements BOOLEAN := TRUE,
in_severe BOOLEAN := TRUE,
in_performance BOOLEAN := TRUE,
in_informational BOOLEAN := FALSE,
in_ccflags VARCHAR2 := NULL,
in_force BOOLEAN := FALSE
) AS
in_force_y CONSTANT CHAR := CASE WHEN in_force THEN 'Y' END;
--
v_code_type VARCHAR2(32767);
v_optimize_level VARCHAR2(32767);
v_scope VARCHAR2(32767);
v_warnings VARCHAR2(32767);
v_ccflags VARCHAR2(32767);
v_invalids PLS_INTEGER;
BEGIN
/**
* This package is part of the APP CORE project under MIT licence.
* https://github.com/jkvetina/#core
*
* Copyright (c) <NAME>, 2022
*
* (R)
* --- ---
* #@@@@@@ &@@@@@@
* @@@@@@@@ .@ @@@@@@@@
* ----- @@@@@@ @@@@@@, @@@@@@@ -----
* &@@@@@@@@@@@ @@@ &@@@@@@@@@. @@@@ .@@@@@@@@@@@#
* @@@@@@@@@@@ @ @@@@@@@@@@@@@ @ @@@@@@@@@@@
* \@@@@@@@@@@ @@@@@@@@@@@@@@@ @@@@@@@@@@
* @@@@@@@@@ @@@@@@@@@@@@@@@ &@@@@@@@@
* @@@@@@@( @@@@@@@@@@@@@@@ @@@@@@@@
* @@@@@@( @@@@@@@@@@@@@@, @@@@@@@
* .@@@@@, @@@@@@@@@@@@@ @@@@@@
* @@@@@@ *@@@@@@@@@@@@@ @@@@@@
* @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@.
* @@@@@@@@@@@@@@@@@@@@@@@@@@@@@
* @@@@@@@@@@@@@@@@@@@@@@@@@@@@
* .@@@@@@@@@@@@@@@@@@@@@@@@@
* .@@@@@@@@@@@@@@@@@@@@@
* <EMAIL>
* -------
*
*/
-- first recompile invalid and requested objects
DBMS_OUTPUT.PUT_LINE('--');
DBMS_OUTPUT.PUT('INVALID: ');
--
FOR c IN (
SELECT o.*
FROM (
SELECT o.object_name, o.object_type
FROM user_objects o
WHERE o.status != 'VALID'
AND o.object_type NOT IN ('SEQUENCE', 'MATERIALIZED VIEW')
AND o.object_name != $$PLSQL_UNIT -- not this procedure
UNION ALL
SELECT o.object_name, o.object_type
FROM user_objects o
WHERE in_force_y = 'Y'
AND o.object_type IN ('PACKAGE', 'PACKAGE BODY', 'PROCEDURE', 'FUNCTION', 'TRIGGER', 'VIEW', 'SYNONYM')
AND (o.object_type LIKE in_type OR in_type IS NULL)
AND (o.object_name LIKE in_name OR in_name IS NULL)
AND o.object_name != $$PLSQL_UNIT -- not this procedure
) o
ORDER BY CASE o.object_type
WHEN 'PACKAGE' THEN 1
WHEN 'PACKAGE BODY' THEN 2
ELSE 3 END
) LOOP
v_scope := '';
v_warnings := '';
v_ccflags := '';
-- allow pl/sql settings changes in force mode
IF in_force THEN
-- get and apply ccflags only relevant to current object
IF in_ccflags IS NOT NULL THEN
BEGIN
SELECT
LISTAGG(REGEXP_SUBSTR(in_ccflags, '(' || s.flag_name || ':[^,]+)', 1, 1, NULL, 1), ', ')
WITHIN GROUP (ORDER BY s.flag_name)
INTO v_ccflags
FROM (
SELECT DISTINCT REGEXP_SUBSTR(s.text, '[$].*\s[$][$]([A-Z0-9-_]+)\s.*[$]', 1, 1, NULL, 1) AS flag_name
FROM user_source s
WHERE REGEXP_LIKE(s.text, '[$].*\s[$][$][A-Z0-9-_]+\s.*[$]')
AND s.name = c.object_name
AND s.type = c.object_type
) s;
EXCEPTION
WHEN NO_DATA_FOUND THEN
v_ccflags := NULL;
END;
END IF;
--
v_scope := v_scope || CASE WHEN in_identifiers THEN 'IDENTIFIERS:ALL, ' END;
v_scope := v_scope || CASE WHEN in_statements THEN 'STATEMENTS:ALL, ' END;
v_warnings := v_warnings || CASE WHEN in_severe THEN 'ENABLE:SEVERE, ' END;
v_warnings := v_warnings || CASE WHEN in_performance THEN 'ENABLE:PERFORMANCE, ' END;
v_warnings := v_warnings || CASE WHEN in_informational THEN 'ENABLE:INFORMATIONAL, ' END;
--
v_code_type := 'PLSQL_CODE_TYPE = ' || CASE WHEN in_interpreted THEN 'INTERPRETED' ELSE 'NATIVE' END || ' ';
v_optimize_level := 'PLSQL_OPTIMIZE_LEVEL = ' || in_level || ' ';
v_scope := 'PLSCOPE_SETTINGS = ''' || RTRIM(v_scope, ', ') || ''' ';
v_warnings := 'PLSQL_WARNINGS = ''' || REPLACE(RTRIM(v_warnings, ', '), ',', ''', ''') || ''' ';
v_ccflags := 'PLSQL_CCFLAGS = ''' || RTRIM(v_ccflags) || ''' ';
END IF;
-- recompile object
BEGIN
EXECUTE IMMEDIATE
'ALTER ' || REPLACE(c.object_type, ' BODY', '') || ' ' || c.object_name || ' COMPILE ' ||
CASE WHEN c.object_type LIKE '% BODY' THEN ' BODY' END || ' ' ||
CASE WHEN c.object_type IN (
'PACKAGE', 'PACKAGE BODY', 'PROCEDURE', 'FUNCTION', 'TRIGGER'
) THEN
v_code_type ||
v_optimize_level ||
v_scope ||
v_warnings ||
v_ccflags ||
'REUSE SETTINGS'
END;
--
DBMS_OUTPUT.PUT('.');
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT('!'); -- something went wrong
END;
END LOOP;
-- show number of invalid objects
SELECT COUNT(*) INTO v_invalids
FROM user_objects o
WHERE o.status != 'VALID'
AND o.object_type != 'MATERIALIZED VIEW'
AND o.object_name != $$PLSQL_UNIT; -- not this procedure
--
DBMS_OUTPUT.PUT_LINE(' -> ' || v_invalids);
DBMS_OUTPUT.PUT_LINE('');
-- list invalid objects
IF v_invalids > 0 THEN
FOR c IN (
SELECT object_type, LISTAGG(object_name, ', ') WITHIN GROUP (ORDER BY object_name) AS objects
FROM (
SELECT DISTINCT o.object_type, o.object_name
FROM user_objects o
WHERE o.status != 'VALID'
AND o.object_type != 'MATERIALIZED VIEW'
ORDER BY o.object_type, o.object_name
)
GROUP BY object_type
ORDER BY object_type
) LOOP
DBMS_OUTPUT.PUT_LINE(' ' || RPAD(c.object_type || ':', 15, ' ') || ' ' || c.objects);
END LOOP;
DBMS_OUTPUT.PUT_LINE('');
END IF;
END;
/
|
<filename>samples/Demo/Beef.Demo.Database/Schema/DemoCdc/Stored Procedures/Generated/spCompletePersonCdcOutbox.sql
CREATE PROCEDURE [DemoCdc].[spCompletePersonCdcOutbox]
@OutboxId INT,
@TrackingList AS [DemoCdc].[udtCdcTrackingList] READONLY
AS
BEGIN
/*
* This is automatically generated; any changes will be lost.
*/
SET NOCOUNT ON;
BEGIN TRY
-- Wrap in a transaction.
BEGIN TRANSACTION
-- Mark the outbox as complete and merge the tracking info; then return the updated outbox data and stop!
DECLARE @IsCompleteAlready BIT
SELECT @IsCompleteAlready = [_outbox].[IsComplete]
FROM [DemoCdc].[PersonOutbox] AS [_outbox]
WHERE OutboxId = @OutboxId
DECLARE @Msg NVARCHAR(256)
IF @@ROWCOUNT <> 1
BEGIN
SET @Msg = CONCAT('Outbox ''', @OutboxId, ''' cannot be completed as it does not exist.');
THROW 56005, @Msg, 1;
END
IF @IsCompleteAlready = 1
BEGIN
SET @Msg = CONCAT('Outbox ''', @OutboxId, ''' is already complete; cannot be completed more than once.');
THROW 56002, @Msg, 1;
END
UPDATE [_outbox] SET
[_outbox].[IsComplete] = 1,
[_outbox].[CompletedDate] = GETUTCDATE()
FROM [DemoCdc].[PersonOutbox] AS [_outbox]
WHERE OutboxId = @OutboxId
MERGE INTO [DemoCdc].[CdcTracking] WITH (HOLDLOCK) AS [_ct]
USING @TrackingList AS [_list] ON ([_ct].[Schema] = 'Demo' AND [_ct].[Table] = 'Person' AND [_ct].[Key] = [_list].[Key])
WHEN MATCHED AND EXISTS (
SELECT [_list].[Key], [_list].[Hash]
EXCEPT
SELECT [_ct].[Key], [_ct].[Hash])
THEN UPDATE SET [_ct].[Hash] = [_list].[Hash], [_ct].[OutboxId] = @OutboxId
WHEN NOT MATCHED BY TARGET
THEN INSERT ([Schema], [Table], [Key], [Hash], [OutboxId])
VALUES ('Demo', 'Person', [_list].[Key], [_list].[Hash], @OutboxId);
SELECT [_outbox].[OutboxId], [_outbox].[CreatedDate], [_outbox].[IsComplete], [_outbox].[CompletedDate], [_outbox].[CorrelationId], [_outbox].[HasDataLoss]
FROM [DemoCdc].[PersonOutbox] AS [_outbox]
WHERE [_outbox].OutboxId = @OutboxId
-- Commit the transaction.
COMMIT TRANSACTION
RETURN 0
END TRY
BEGIN CATCH
-- Rollback transaction and rethrow error.
IF @@TRANCOUNT > 0
ROLLBACK TRANSACTION;
THROW;
END CATCH
END
|
<filename>application/wei_site/uninstall.sql<gh_stars>0
DELETE FROM `wp_model` WHERE `name`='custom_reply_news' ORDER BY id DESC LIMIT 1;
DROP TABLE IF EXISTS `wp_custom_reply_news`;
DELETE FROM `wp_model` WHERE `name`='weisite_cms' ORDER BY id DESC LIMIT 1;
DROP TABLE IF EXISTS `wp_weisite_cms`;
|
<gh_stars>1-10
SELECT *
FROM (
SELECT item_sk
,d_date
,web_sales
,store_sales
,MAX(web_sales) AS web_cumulative
,MAX(store_sales) AS store_cumulative
FROM (
SELECT CASE
WHEN web.item_sk IS NOT NULL
THEN web.item_sk
ELSE store.item_sk
END item_sk
,CASE
WHEN web.d_date IS NOT NULL
THEN web.d_date
ELSE store.d_date
END d_date
,web.cume_sales web_sales
,store.cume_sales store_sales
FROM (
SELECT ws_item_sk item_sk
,d_date
,SUM(SUM(ws_sales_price)) AS cume_sales
FROM web_sales
JOIN date_dim
WHERE ws_sold_date_sk = d_date_sk
AND d_month_seq BETWEEN 1200
AND 1200 + 11
AND ws_item_sk IS NOT NULL
GROUP BY ws_item_sk
,d_date
) web
FULL OUTER JOIN (
SELECT ss_item_sk item_sk
,d_date
,SUM(SUM(ss_sales_price)) AS cume_sales
FROM store_sales
JOIN date_dim
WHERE ss_sold_date_sk = d_date_sk
AND d_month_seq BETWEEN 1200
AND 1200 + 11
AND ss_item_sk IS NOT NULL
GROUP BY ss_item_sk
,d_date
) store ON (
web.item_sk = store.item_sk
AND web.d_date = store.d_date
)
) x
) y
WHERE web_cumulative > store_cumulative
ORDER BY item_sk
,d_date;
|
<gh_stars>1-10
/*
Navicat MySQL Data Transfer
Source Server : 本地
Source Server Version : 50718
Source Host : localhost:3306
Source Database : puppet
Target Server Type : MYSQL
Target Server Version : 50718
File Encoding : 65001
Date: 2017-09-23 14:59:50
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for adm_user
-- ----------------------------
DROP TABLE IF EXISTS `adm_user`;
CREATE TABLE `adm_user` (
`id` varchar(50) NOT NULL COMMENT 'ID',
`name` varchar(50) DEFAULT NULL COMMENT '姓名',
`password` varchar(255) DEFAULT NULL COMMENT '用户密码',
`gender` varchar(50) DEFAULT NULL COMMENT '性别',
`email` varchar(50) DEFAULT NULL COMMENT '邮箱',
`phone` varchar(50) DEFAULT NULL COMMENT '电话',
`qq` varchar(50) DEFAULT NULL COMMENT 'QQ',
`wechat` varchar(50) DEFAULT NULL COMMENT '微信',
`address` varchar(255) DEFAULT NULL COMMENT '地址',
`resume` text COMMENT '个人介绍',
`avatar` text COMMENT '头像',
`nickname` varchar(50) DEFAULT NULL COMMENT '昵称',
`createDate` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '创建时间',
`updateDate` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
`remark` text COMMENT '用户备注',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
<filename>src/main/resources/db/migration/V2__resources.sql<gh_stars>10-100
DROP
TABLE IF EXISTS resources;
CREATE TABLE resources (
id BIGSERIAL PRIMARY KEY NOT NULL,
deployment_id BIGINT NOT NULL,
kind VARCHAR NOT NULL,
ref VARCHAR NOT NULL,
name TEXT NOT NULL,
cpu_boost BOOLEAN NOT NULL,
mem_limit BOOLEAN NOT NULL,
CONSTRAINT fk_deployment_id FOREIGN KEY (deployment_id) REFERENCES deployments (id) ON DELETE CASCADE,
CONSTRAINT unique_deployment_id_ref_kind UNIQUE (deployment_id, kind, ref),
CONSTRAINT check_kind CHECK (kind IN ('Elasticsearch', 'Kibana', 'APM'))
);
|
{%- macro relative_change(x_0, x_N) -%}
{#-/* Computes the relative change between `x_0` and `x_N` values
ARGS:
- x_0 (numeric) is the initial value
- x_N (numeric) is the final value
RETURNS: the relative change between `x_0` and `x_N` (numeric)
SUPPORTS:
- All (purely arithmetic)
*/-#}
(( {{ x_N }} - {{ x_0 }} ) / {{ x_0 }})
{%- endmacro -%}
|
DROP MATERIALIZED VIEW IF EXISTS trip.export;
|
<gh_stars>10-100
CREATE FUNCTION public.drop_fk_except_for(tables_in character varying[]) RETURNS SETOF character varying
LANGUAGE plpgsql
AS $$
DECLARE
BEGIN
-- aaa
END;
$$;
|
/* Copyright 2001, 2019 IBM Corporation
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the
* following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the
* following disclaimer in the documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
void Water3SiteRattleHalfStep(
MDVM &aMDVM
)
{
/*
/* JWP August 2001
/*
/* does SECOND velocity halfstep update w/ RATTLE for rigid water
/* adds dt/2 * f(t+dt)/m to v(t+dt/2)
/* calling routine is responsible to make sure f(t+dt) is correct
/* velocity update is followed by RATTLE which adjusts the
/* velocities v(t+dt) so they have no components along the constraints
/*
const double tolerance = 0.00000001;
const integer max_iterations = 1000;
/*
/* really conservative default SHAKE tolerance
/* 10^-6 can be OK but timestep dependent, no warranties, etc.
/*
/* this routine assumes OHH ordering, i.e. O=Site A, H1=Site B, H2=Site C
/*
XYZ vA = aMDVM.GetVelocity( MDVM::SiteA );
XYZ vB = aMDVM.GetVelocity( MDVM::SiteB );
XYZ vC = aMDVM.GetVelocity( MDVM::SiteC );
XYZ fA = aMDVM.GetForce( MDVM::SiteA );
XYZ fB = aMDVM.GetForce( MDVM::SiteB );
XYZ fC = aMDVM.GetForce( MDVM::SiteC );
XYZ mA = aMDVM.GetHalfInverseMass( MDVM::SiteA );
XYZ mB = aMDVM.GetHalfInverseMass( MDVM::SiteB );
XYZ mC = aMDVM.GetHalfInverseMass( MDVM::SiteC );
double dt = a.MDVM.GetDeltaT;
/*
/* factor of 1/2 is implicit in GetHalfInverseMass, which returns 1/2m
/*
/* FRANK: delete these if the halfstep happens before this routine
vA += dt * fA * mA;
vB += dt * fB * mB;
vC += dt * fC * mC;
/* done with normal UpdateVelocityHalfStep, on to RATTLE
/* pretty much direct from <NAME>'s little water code, JWP
/* convert tolerance to velocities. . .
double veloc_tolerance = tolerance/dt;
/* current position vectors at t+dt
XYZ vecAB = aMDVM.GetVector( MDVM::SiteB, MDVM::SiteA );
XYZ vecAC = aMDVM.GetVector( MDVM::SiteC, MDVM::SiteA );
XYZ vecBC = aMDVM.GetVector( MDVM::SiteC, MDVM::SiteB );
/* start with forces of constraint set to zero
XYZ fconA = 0.0;
XYZ fconB = 0.0;
XYZ fconC = 0.0;
/* get the relative velocities along each constraint
XYZ velAB = vA - vB;
XYZ velAC = vA - vC;
XYZ velBC = vB - vC;
/* initially assume all 3 constraints are violated,
/* ensuring at least one pass through the loop
/*
/* it's traditional to keep track of the number of iterations and
/* vomit if it passes the maximum. . .
/*
/* since the 3 constraints are coupled, if we make adjustments
/* to fix any one constraint, we have to check them all again
integer rattle_iterations = 0;
integer violations = 3;
while ((violations) > 0)&&(rattle_iterations < max_iterations)) {
/* project the current values of the interparticle velocities
/* (includes contributions from any force of constraint we have generated
/* so far)
XYZ proAB = velAB + dt * (fconA - fconB);
XYZ proAC = velAC + dt * (fconA - fconC);
XYZ proBC = velBC + dt * (fconB - fconC);
/* get the dot product of each velocity on the corresponding
/* constraint to check against veloc_tolerance
double devproAB = proAB*vecAB;
double devproAC = proAC*vecAC;
double devproBC = proBC*vecBC;
integer testAB = 1;
integer testAC = 1;
integer testBC = 1;
/* check each vector against the corresponding constraint
/* if it is violated, calculate the additional "forces of constraint"
/* necessary to fix it
/*
/* FRANK:
/* I wasn't sure of the sign of the vecAB, etc. vectors
/* the following is all coded with the assumption that vecAB is the
/* vector from A to B, and so on
/*
/* O - H1 vector
if (abs(devproAB) > vector_tolerance*rOH) {
double G = devproAB / (rOHsq * (mA + mB));
fconA -= G * mA * vecAB;
fconB += G * mB * vecAB;
} else {
testAB = 0;
}
/* O - H2 vector
if (abs(devproAC) > vector_tolerance*rOH) {
double G = devproAC / (rOHsq * (mA + mC));
fconA -= G * mA * vecAC;
fconC += G * mC * vecAC;
} else {
testAC = 0;
}
/* H1 - H2 vector
/* note that since both particles have the same mass we don't
/* have to mass-weight the force of constraint, just divide it by 2
if (abs(devproBC) > vector_tolerance*rHH) {
double G = devproBC / rHHsq;
fconB -= G * vecBC;
fconC += G * vecBC;
} else {
testBC = 0;
}
violations = testAB + testAC + testBC;
rattle_iterations++;
}
/*
/* check if we hit max_iterations
/*
if (rattle_iterations >= max_iterations) {
/* FRANK:
/* some sort of error throw/exception goes here
} else {
/*
/* done with RATTLE iterations, converged before the iteration limit
/* now place influence of force of constraint in velocity arrays
/* remember fcon[A,B,C] are not real forces but f/m * dt/2
/*
/* note we are not including a virial contribution from the force of
/* constraint. . .
/*
vA += fconA;
vB += fconB;
vC += fconC;
/*
aMDVM.ReportVelocity( MDVM::SiteA, vA );
aMDVM.ReportVelocity( MDVM::SiteB, vB );
aMDVM.ReportVelocity( MDVM::SiteC, vC );
}
/*
return;
}
|
CREATE TABLE IF NOT EXISTS `user_jobs` (
`id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`user_id` int(10) UNSIGNED NOT NULL,
`job_id` int(10) UNSIGNED NOT NULL,
`job_level` int(10) UNSIGNED NOT NULL,
`created_at` DATETIME NOT NULL,
`updated_at` DATETIME NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=Innodb DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;
|
-- phpMyAdmin SQL Dump
-- version 5.0.4
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Dec 23, 2020 at 09:29 AM
-- Server version: 10.4.17-MariaDB
-- PHP Version: 7.4.13
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: `db_klinik`
--
-- --------------------------------------------------------
--
-- Table structure for table `data_dokter`
--
CREATE TABLE `data_dokter` (
`id` int(11) NOT NULL,
`kode_dokter` varchar(6) NOT NULL,
`nama` varchar(128) NOT NULL,
`jk` enum('L','P') NOT NULL,
`poli` varchar(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `data_dokter`
--
INSERT INTO `data_dokter` (`id`, `kode_dokter`, `nama`, `jk`, `poli`) VALUES
(2, 'dr0002', '<NAME>', 'L', 'umum');
-- --------------------------------------------------------
--
-- Table structure for table `data_report`
--
CREATE TABLE `data_report` (
`id` int(11) NOT NULL,
`id_rekam_medis` int(5) NOT NULL,
`catatan` text NOT NULL,
`catatan_1` text DEFAULT NULL,
`status` enum('read','unread') NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `data_report`
--
INSERT INTO `data_report` (`id`, `id_rekam_medis`, `catatan`, `catatan_1`, `status`) VALUES
(2, 18, 'obat habis, diganti jadi apa?', 'ssss', 'read');
-- --------------------------------------------------------
--
-- Table structure for table `data_rujukan`
--
CREATE TABLE `data_rujukan` (
`id` int(11) NOT NULL,
`id_rekam_medis` varchar(9) NOT NULL,
`tanggal` date NOT NULL,
`nama_poli` varchar(50) NOT NULL,
`nama_rumah_sakit` varchar(100) NOT NULL,
`dokter` varchar(128) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `data_rujukan`
--
INSERT INTO `data_rujukan` (`id`, `id_rekam_medis`, `tanggal`, `nama_poli`, `nama_rumah_sakit`, `dokter`) VALUES
(1, '20', '2020-06-01', 'THT', 'RSUD Bogor', 'Ghoniyyatul Nabilah');
-- --------------------------------------------------------
--
-- Table structure for table `kategori_obat`
--
CREATE TABLE `kategori_obat` (
`id` int(11) NOT NULL,
`nama_kategori` varchar(128) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `kategori_obat`
--
INSERT INTO `kategori_obat` (`id`, `nama_kategori`) VALUES
(2, 'Tablet'),
(11, 'Kapsul'),
(15, 'Syrup');
-- --------------------------------------------------------
--
-- Table structure for table `obat`
--
CREATE TABLE `obat` (
`id` int(11) NOT NULL,
`kode_obat` varchar(6) NOT NULL,
`nama_obat` varchar(128) NOT NULL,
`kategori` varchar(128) NOT NULL,
`stok` int(11) NOT NULL,
`satuan` varchar(128) NOT NULL,
`deskripsi` varchar(128) DEFAULT NULL,
`tanggal_masuk` date NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `obat`
--
INSERT INTO `obat` (`id`, `kode_obat`, `nama_obat`, `kategori`, `stok`, `satuan`, `deskripsi`, `tanggal_masuk`) VALUES
(16, 'Kd0001', 'Metronidazole', '2', 1000, 'Butir', '', '2020-12-23');
-- --------------------------------------------------------
--
-- Table structure for table `pasien`
--
CREATE TABLE `pasien` (
`id` int(11) NOT NULL,
`no_medis` varchar(9) NOT NULL,
`nama_pasien` varchar(30) NOT NULL,
`umur` int(2) NOT NULL,
`alamat` varchar(30) NOT NULL,
`kelurahan` varchar(128) NOT NULL,
`kecamatan` varchar(128) NOT NULL,
`provinsi` varchar(128) NOT NULL,
`kode_pos` varchar(5) NOT NULL,
`tanggal_daftar` date NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `pasien`
--
INSERT INTO `pasien` (`id`, `no_medis`, `nama_pasien`, `umur`, `alamat`, `kelurahan`, `kecamatan`, `provinsi`, `kode_pos`, `tanggal_daftar`) VALUES
(18, '202012001', 'YOYOH', 50, 'Bojong Kidul', '', '', '', '', '2020-12-20'),
(19, '202012002', '<NAME>', 60, 'Ciletuh', '', '', '', '', '2020-12-21'),
(20, '202012003', 'LENI', 20, '<NAME>', '', '', '', '', '2020-12-21'),
(21, '202012004', 'RANAH', 50, 'Bitung Sari Rt 04/01', '', '', '', '', '2020-12-21'),
(22, '202012005', 'HERAWATI', 18, 'Tenggek', '', '', '', '', '2020-12-21'),
(23, '202012006', 'SUPARDI', 28, '<NAME>', '', '', '', '', '2020-12-21'),
(24, '202012007', 'DENI', 31, 'Cimande', '', '', '', '', '2020-12-21'),
(25, '202012008', 'SAAD', 81, 'Cibolang', '', '', '', '', '2020-12-21'),
(26, '202012009', 'UJANG', 54, 'Kp. <NAME>', '', '', '', '', '2020-12-21'),
(27, '202012010', 'FATIMAH', 36, '<NAME>', '', '', '', '', '2020-12-21'),
(28, '202012011', 'EEM', 60, 'Nangoh', '', '', '', '', '2020-12-21'),
(29, '202012012', 'OMA', 50, '<NAME>', '', '', '', '', '2020-12-21'),
(30, '202012013', '<NAME>', 80, 'Cukangaleuh', '', '', '', '', '2020-12-21'),
(31, '202012014', 'IYAN', 50, 'Ciderum', '', '', '', '', '2020-12-21'),
(32, '202012015', 'IMAS', 38, 'Cibodas', '', '', '', '', '2020-12-21'),
(33, '202012016', 'H.Ridwan', 69, 'Gadog', '', '', '', '', '2020-12-21'),
(34, '202012017', '<NAME>', 16, '<NAME>', '', '', '', '', '2020-12-21'),
(35, '202012018', '<NAME>', 53, 'Cisarua', '', '', '', '', '2020-12-21'),
(36, '202012019', 'ARA', 19, '<NAME>', '', '', '', '', '2020-12-21'),
(37, '202012020', 'ARAH', 75, 'Rancanmaya', '', '', '', '', '2020-12-21'),
(38, '202012021', 'MAJA', 52, 'Rulita Rt 03/ 03', '', '', '', '', '2020-12-21'),
(39, '202012022', 'TN. UDIN', 60, 'CIBURAYUT', '', '', '', '', '2020-12-21'),
(40, '202012023', 'NY.LILIH', 62, '<NAME>', '', '', '', '', '2020-12-21'),
(41, '202012024', 'TN.H. OMON', 70, 'Cimande', '', '', '', '', '2020-12-21'),
(42, '202012025', 'NY.HANA', 60, 'Rancanmaya', '', '', '', '', '2020-12-21'),
(43, '202012026', 'TN.NANANG', 50, 'Ciawi', '', '', '', '', '2020-12-21'),
(44, '202012027', 'NY.CICIH', 54, 'Rancanmaya', '', '', '', '', '2020-12-21'),
(45, '202012028', 'TN.ISUM', 42, '<NAME>', '', '', '', '', '2020-12-21'),
(46, '202012029', 'TN.ENAB', 65, 'B<NAME>', '', '', '', '', '2020-12-21'),
(47, '202012030', 'TN. ANG', 70, '<NAME>', '', '', '', '', '2020-12-21'),
(48, '202012031', 'TN.WAHYU', 37, 'KP.PANJANG', '', '', '', '', '2020-12-21'),
(49, '202012032', '<NAME>', 50, 'BABAKAN', '', '', '', '', '2020-12-21'),
(50, '202012033', '<NAME>', 70, 'CIGOMBONG', '', '', '', '', '2020-12-21'),
(51, '202012034', 'NY.NURELASARI', 30, 'CIGOMBONG', '', '', '', '', '2020-12-21'),
(52, '202012035', 'TN.ABDUL HANAN', 21, 'CIKERETEG', '', '', '', '', '2020-12-21'),
(53, '202012036', 'TN.ERWIN', 29, 'TANGKIL', '', '', '', '', '2020-12-21'),
(54, '202012037', 'NY.ONI', 70, 'BITUNGSARI', '', '', '', '', '2020-12-21'),
(55, '202012038', 'TN.IKI', 22, 'PANCAWATI', '', '', '', '', '2020-12-21'),
(56, '202012039', 'NY.ROSMIATI', 21, '<NAME>', '', '', '', '', '2020-12-21'),
(57, '202012040', 'NY.ELIM', 52, 'BITUNGSARI', '', '', '', '', '2020-12-21'),
(58, '202012041', 'TN.NANANG', 50, 'CIAWI', '', '', '', '', '2020-12-21'),
(59, '202012042', 'NN.NURANISA', 15, 'Ciawi', '', '', '', '', '2020-12-21'),
(60, '202012043', 'H.USMAN', 70, 'Rancanmaya', '', '', '', '', '2020-12-21'),
(61, '202012044', 'TN. MANG UYA', 45, 'CIKERETEG', '', '', '', '', '2020-12-21'),
(62, '202012045', 'TN.UBAD', 5017, '<NAME>', '', '', '', '', '2020-12-21'),
(63, '202012046', '<NAME>', 17, 'SITUBEREUM', '', '', '', '', '2020-12-21'),
(64, '202012047', 'TN.KOSASIH', 56, 'CIBOLANG', '', '', '', '', '2020-12-21'),
(65, '202012048', '<NAME>', 21, '<NAME>', '', '', '', '', '2020-12-21');
-- --------------------------------------------------------
--
-- Table structure for table `rekam_medis`
--
CREATE TABLE `rekam_medis` (
`id` int(11) NOT NULL,
`no_medis` varchar(9) NOT NULL,
`tensi` varchar(10) DEFAULT NULL,
`diagnosa` text DEFAULT NULL,
`terapi` text DEFAULT NULL,
`dokter` varchar(50) DEFAULT NULL,
`tanggal` date NOT NULL,
`status` enum('antrian','selesai','ambil obat') NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `rekam_medis`
--
INSERT INTO `rekam_medis` (`id`, `no_medis`, `tensi`, `diagnosa`, `terapi`, `dokter`, `tanggal`, `status`) VALUES
(1, '202012046', '130/90', 'pusing', 'pusing', '<NAME>', '2020-12-23', 'selesai');
-- --------------------------------------------------------
--
-- Table structure for table `user`
--
CREATE TABLE `user` (
`id` int(11) NOT NULL,
`name` varchar(128) NOT NULL,
`email` varchar(128) NOT NULL,
`image` varchar(128) NOT NULL,
`password` varchar(256) NOT NULL,
`role_id` int(11) NOT NULL,
`is_active` int(1) NOT NULL,
`date_created` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `user`
--
INSERT INTO `user` (`id`, `name`, `email`, `image`, `password`, `role_id`, `is_active`, `date_created`) VALUES
(31, 'ryan', '<EMAIL>', 'default.jpg', <PASSWORD>', 1, 1, 1608447590),
(33, '<NAME>', '<EMAIL>', 'default.jpg', '$2y$10$y.AI5mcXLctYChLXDl6Fu.vVW24I/z2vUzy0D8tdclHbG59/Ipal2', 2, 1, 1608509544),
(34, 'admin', '<EMAIL>', 'default.jpg', <PASSWORD>', 1, 1, 1608614246);
-- --------------------------------------------------------
--
-- Table structure for table `user_role`
--
CREATE TABLE `user_role` (
`id` int(11) NOT NULL,
`role` varchar(128) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `user_role`
--
INSERT INTO `user_role` (`id`, `role`) VALUES
(1, 'Administrator'),
(2, 'Member');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `data_dokter`
--
ALTER TABLE `data_dokter`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `data_report`
--
ALTER TABLE `data_report`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `data_rujukan`
--
ALTER TABLE `data_rujukan`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `kategori_obat`
--
ALTER TABLE `kategori_obat`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `obat`
--
ALTER TABLE `obat`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `pasien`
--
ALTER TABLE `pasien`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `rekam_medis`
--
ALTER TABLE `rekam_medis`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `user`
--
ALTER TABLE `user`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `user_role`
--
ALTER TABLE `user_role`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `data_dokter`
--
ALTER TABLE `data_dokter`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `data_report`
--
ALTER TABLE `data_report`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `data_rujukan`
--
ALTER TABLE `data_rujukan`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `kategori_obat`
--
ALTER TABLE `kategori_obat`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=16;
--
-- AUTO_INCREMENT for table `obat`
--
ALTER TABLE `obat`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=17;
--
-- AUTO_INCREMENT for table `pasien`
--
ALTER TABLE `pasien`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=66;
--
-- AUTO_INCREMENT for table `rekam_medis`
--
ALTER TABLE `rekam_medis`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `user`
--
ALTER TABLE `user`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=35;
--
-- AUTO_INCREMENT for table `user_role`
--
ALTER TABLE `user_role`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
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 */;
|
-- phpMyAdmin SQL Dump
-- version 4.9.0.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Mar 05, 2020 at 09:56 AM
-- Server version: 10.4.6-MariaDB
-- PHP Version: 7.3.9
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `blog`
--
-- --------------------------------------------------------
--
-- Table structure for table `content`
--
CREATE TABLE `content` (
`id` int(11) NOT NULL,
`title` varchar(40) NOT NULL,
`text` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `content`
--
INSERT INTO `content` (`id`, `title`, `text`) VALUES
(1, 'corona', 'bir corona rugi gara gara virus'),
(3, ' jajala', 'au ah mumet');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `content`
--
ALTER TABLE `content`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `content`
--
ALTER TABLE `content`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
<filename>db/queries/tables/league-tables-ordered.sql
SELECT * FROM league_tables
ORDER BY gameweek_id
, focus DESC
, points DESC
, goal_difference DESC
, "for" DESC
, team_name;
|
<filename>V1/Database/Stored Procedures/FF.uspDraftGetNextPick.sql
SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [FF].[uspDraftGetNextPick]
(
@LeagueId int,
@Year int
)
AS
DECLARE @NextPick int, @NextRound int, @NextTeam int, @Rounds int, @Teams int
DECLARE @picks TABLE (NextPick int not null)
-- add bounds
INSERT @picks VALUES (0)
INSERT @picks VALUES (168)
-- add the used picks
INSERT @picks
SELECT Overall
FROM FF.PlayerTeam pt INNER JOIN FF.Team t ON pt.TeamId = t.TeamId
WHERE t.Year = @Year
AND t.LeagueId = @LeagueId
-- figure out the lowest pick available
SELECT TOP 1 @NextPick = LastSeqNumber + 1
from (
select (SELECT TOP 1 NextPick FROM @picks WHERE NextPick < a.NextPick ORDER BY NextPick DESC) as LastSeqNumber,
a.NextPick as NextSeqNumber
from @picks a
left join @picks b on a.NextPick = b.NextPick + 1
where b.NextPick IS NULL
) a
WHERE LastSeqNumber IS NOT NULL
ORDER BY LastSeqNumber
-- get the number of rounds
SELECT @Rounds = Rounds
FROM FF.LeagueYear
WHERE LeagueId = @LeagueId
AND Year = @Year
-- get the number of teams
SELECT @Teams = COUNT(TeamId)
FROM FF.Team
WHERE LeagueId = @LeagueId
AND Year = @Year
-- get the pick, round and team
SELECT @NextPick = Pick, @NextRound = Round, @NextTeam = Team
FROM FF.DraftPickIndex
WHERE MaxRounds = @Rounds
AND MaxTeams = @Teams
AND Pick = @NextPick
-- translate the next team into a team id
SELECT @NextTeam = t.TeamId
FROM FF.Team t
WHERE t.LeagueId = @LeagueId
AND t.Year = @Year
AND t.DraftOrder = @NextTeam
-- return data
SELECT @NextPick AS NextPick, @NextRound AS NextRound, @NextTeam AS NextTeam
RETURN
GO
GRANT EXECUTE ON [FF].[uspDraftGetNextPick] TO [DataUser] AS [dbo]
GO
|
<gh_stars>0
-- Todo Items
insert into TodoItems (Title, Description, IsDone)
values ('Water flowers','Give the flowers water',false),
('Work out','Go on a running tour',true),
('Go to sleep','Go to bed early', false),
('Drink much water','Try to drink much water',false);
-- Students
insert into Students (Name, FirstName, Mobile, Email)
values ('Serruys','Willem','0479806551','<EMAIL>'),
('Serruys','Koenraad','0488555222','<EMAIL>'),
('Thienpont','Florine','0456123456','<EMAIL>'),
('Serruys','Bert','0456789456','<EMAIL>'),
('Geeroms','Elles','0456123452','<EMAIL>');
|
<filename>dinesykmeldte-backend/src/main/resources/db/V1__create_sykmelding_soknad_tables.sql
CREATE TABLE narmesteleder (
narmeste_leder_id VARCHAR primary key not null,
pasient_fnr VARCHAR not null,
leder_fnr VARCHAR not null,
orgnummer VARCHAR not null
);
CREATE TABLE sykmelding (
sykmelding_id VARCHAR primary key not null,
pasient_fnr VARCHAR not null,
pasient_navn VARCHAR not null,
orgnummer VARCHAR not null,
orgnavn VARCHAR null,
startdato_sykefravaer DATE not null,
sykmelding JSONB not null,
lest BOOLEAN not null,
timestamp TIMESTAMP with time zone not null,
latest_tom DATE not null
);
CREATE TABLE soknad (
soknad_id VARCHAR primary key not null,
sykmelding_id VARCHAR not null,
pasient_fnr VARCHAR not null,
orgnummer VARCHAR not null,
soknad JSONB not null,
sendt_dato DATE null,
lest BOOLEAN not null,
timestamp TIMESTAMP with time zone not null,
latest_tom DATE not null
);
create index sykmelding_fnr_idx on sykmelding(pasient_fnr);
create index soknad_fnr_idx on soknad(pasient_fnr);
create index narmesteleder_lederfnr_idx on narmesteleder(leder_fnr);
|
-- phpMyAdmin SQL Dump
-- version 5.0.3
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Nov 07, 2020 at 04:16 AM
-- Server version: 10.4.14-MariaDB
-- PHP Version: 7.4.11
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: `social`
--
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
CREATE TABLE `users` (
`id` int(11) NOT NULL,
`first_name` varchar(25) NOT NULL,
`last_name` varchar(25) NOT NULL,
`username` varchar(100) NOT NULL,
`email` varchar(100) NOT NULL,
`password` varchar(255) NOT NULL,
`signup_date` date NOT NULL,
`profile_pic` varchar(255) NOT NULL,
`num_posts` int(11) NOT NULL,
`num_likes` int(11) NOT NULL,
`user_closed` varchar(3) NOT NULL,
`friend_array` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `users`
--
INSERT INTO `users` (`id`, `first_name`, `last_name`, `username`, `email`, `password`, `signup_date`, `profile_pic`, `num_posts`, `num_likes`, `user_closed`, `friend_array`) VALUES
(1, 'Jannatul', 'Ferdouse', '<PASSWORD>erdouse', '<EMAIL>', 'abcd', '2020-11-01', 'abc', 1, 1, 'no', ''),
(2, 'Aaaa', 'Bbbb', 'aaaa_bbbb', '<EMAIL>', 'ab56b4d92b40713acc5af<PASSWORD>4b786', '2020-11-06', 'assets/images/profile_pics/defaults/head_deep_blue.png', 0, 0, 'no', ','),
(3, 'Rupa', 'Rupa', 'rupa_rupa', '<EMAIL>', '594f803b380a41396ed63dca39503542', '2020-11-06', 'assets/images/profile_pics/defaults/head_emerald.png', 0, 0, 'no', ','),
(7, 'Aaaa', 'Bbbb', 'aaaa_bbbb_1', '<EMAIL>', 'ab56b4d92b40713acc5af89985d4b786', '2020-11-06', 'assets/images/profile_pics/defaults/head_emerald.png', 0, 0, 'no', ','),
(8, 'Aaa', 'Bbb', 'aaa_bbb', '<EMAIL>', '594f803b380a41396ed63dca39503542', '2020-11-06', 'assets/images/profile_pics/defaults/head_deep_blue.png', 0, 0, 'no', ','),
(10, 'Abcde', 'Ab', 'abcde_ab', '<EMAIL>', '<PASSWORD>', '2020-11-06', 'assets/images/profile_pics/defaults/head_deep_blue.png', 0, 0, 'no', ','),
(11, 'Abc', 'Bc', 'abc_bc', '<EMAIL>', 'e<PASSWORD>', '2020-11-06', '', 0, 0, 'no', ','),
(12, 'Abc', 'Bc', 'abc_bc_1', '<EMAIL>', '594f803b380a41396ed63dca39503542', '2020-11-06', ' ', 0, 0, 'no', ','),
(13, 'Robin', 'Arifa', 'robin_arifa', '<EMAIL>', '8b161ad81e63e1f58cb64ae300b92a9e', '2020-11-06', ' ', 0, 0, 'no', ',');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `email` (`email`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=14;
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 schema if not exists backups;
create table backups.hosts (
id serial primary key,
host text not null,
port int default 5432,
cluster_name text not null,
archiver_name text[2] not null,
bareos_on text default 'archive_1',
keep_backups_cnt text not null,
periodicity_days int not null,
directory text not null,
last_archiver text,
last_backup_id int,
last_backup_start_txtime timestamptz default 'epoch',
constraint host unique(host),
constraint cluster_name unique(cluster_name)
);
ALTER TABLE backups.hosts
OWNER TO postgres;
---
create table backups.tasks (
backup_id serial primary key,
host text not null,
archiver_name text not null,
start_txtime timestamptz,
end_txtime timestamptz,
is_failed boolean default false not null
);
create index ON backups.tasks (start_txtime);
ALTER TABLE backups.tasks
OWNER TO postgres;
-- insert into backups.hosts (host, cluster_name, archiver_name, bareos_on, keep_backups_cnt, periodicity_days, directory) values
-- ('master7-sb', 'master7', '{"archive_1", "archive_2"}', 'archive_1', 2, 4, '/archive_path7/');
-- insert into backups.hosts (host, cluster_name, archiver_name, bareos_on, keep_backups_cnt, periodicity_days, directory) values
-- ('master2-sb', 'master2', '{"archive_1", "archive_2"}', 'archive_1', 2, 4, '/archive_path2/') ;
-- insert into backups.hosts (host, cluster_name, archiver_name, bareos_on, keep_backups_cnt, periodicity_days, directory) values
-- ('master1-sb', 'master1', '{"archive_1", "archive_2"}', 'archive_1', 2, 8, '/archive_path/') ;
---
CREATE OR REPLACE FUNCTION backups.get_next(i_archiver text, OUT o_backip_id int, OUT o_pghost text, OUT o_pgport int, OUT o_remote_archiver text,
OUT o_keep_backups_cnt int, OUT o_backups_dir text, OUT o_bareos_on text)
RETURNS SETOF record
LANGUAGE plpgsql
ROWS 1
AS $function$
-- Backups queue for backup postgres servers to two archive servers in turn.
-- Function returns which backup must be executed by base-backup and mark it in table tasks as in progress (end_txtime = NULL).
-- Backup script must mark successful backup by executing select * backups.stop(backup_id),
-- backip_id - o_backip_id is an out parameter of that function.
-- periodicity_days - periodicity(in days) of backup for specific(!) archive
-- Returns 0 strings if there is no backup tasks for specific archive
-- Backups are alternating between 2 archive servers.
-- If previous backup was made to 1st archive server, then next will be made by 2nd archive server(and vice versa) if there is no crashes
-- If the backup is failed on specific archive server, it will not being retried till
-- the row with failed status would be deleted(manually or by 'select * from backups.stop(backup_id)') from backups.tasks
-- Meanwhile on second archive backups operations will continue being successfully executed
-- RESTRICTIONS:
-- First backup must be run on the 1st archive server (second archive starts work only after 1st one)
-- EXAMPLE of adding new cluster to backup queu:
-- insert into backups.hosts (host, cluster_name, archiver_name, keep_backups_cnt, periodicity_days, directory) values
-- ('master7-sb', 'master7', '{"archive_1", "archive_2"}', 2, 4, '/archive_path7/');
-- host - standby, from which backups will be taken
-- cluster_name - cluster name (e.g. master7)
-- archiver_name - array with two archive servers (destination of backup)
-- keep_backups_cnt - the number of backups to keep on one server (recommended value 2)
-- periodicity_days - schedule for one(!) archive server (recommended value 4 or more and it must be multiple of 2)
-- directory - destination
DECLARE
BACKUP_START_TIME constant time := '03:07'; -- don't start backup befor this time
v_host_r record;
v_chosen_archiver text;
v_is_found boolean := false;
v_days_delimiter integer;
v_expected_backup_date timestamptz;
begin
-- Mark backup tasks as failed if there was no backups.done() call between backups.get_next() for specific archive server
update
backups.tasks t
set
is_failed = true
from
backups.hosts b
where
t.backup_id = b.last_backup_id
and t.archiver_name = i_archiver
and t.end_txtime is NULL
and t.is_failed = false;
if found then
raise notice '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!';
raise notice 'WARNING: one of backups marked as failed!';
raise notice '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!';
end if;
-- backup queue
for v_host_r in select * from backups.hosts order by last_backup_start_txtime desc
loop
-- try to derive next archive server name (take the opposite one)
-- if there was fail on previous one, backup still needs to be done
-- check existence failed backup task on opposite archive:
perform * from
backups.tasks t
where
t.archiver_name = coalesce((array_remove(v_host_r.archiver_name, v_host_r.last_archiver))[1], v_host_r.archiver_name[1])
and t.host = v_host_r.host
and t.is_failed = true
order by
start_txtime desc
limit 1;
-- if failed then continue execute backup tasks on previous one archive server
if found then
v_chosen_archiver := v_host_r.last_archiver;
v_days_delimiter := 1;
else
v_chosen_archiver := coalesce((array_remove(v_host_r.archiver_name, v_host_r.last_archiver))[1], v_host_r.archiver_name[1]);
v_days_delimiter := 2;
end if;
-- skip if input parameter does not match with reusult of function
if i_archiver != v_chosen_archiver then
continue;
end if;
-- if there is no such backup_id in tasks, then chose that host
if v_host_r.last_backup_id is NULL then
v_is_found := true;
exit;
end if;
perform * from backups.tasks t where t.backup_id = v_host_r.last_backup_id;
if not found then
-- TODO: cope with deleting of row in tasks
v_is_found := true;
exit;
end if;
-- check for errors in backup tasks for chosen archive server
perform *
from
backups.tasks t
where
t.archiver_name = v_chosen_archiver
and t.host = v_host_r.host
and t.is_failed = true
order by
start_txtime desc
limit 1;
-- skip backup execution till error will be fixed and record with error will be removed from tasks
if found then
continue;
end if;
-- v_days_multiplier dependency on before last backup task fail is done to alternate archives in right way
-- e.g.: if periodicity_days = 4, then backup will be made each 2 days on different archive servers
-- while on each archive server backup task is executed each 4 days
-- check if periodicity_days are passed since last backup on that archive server
v_expected_backup_date := v_host_r.last_backup_start_txtime::date + BACKUP_START_TIME + v_host_r.periodicity_days * '1 days'::interval / v_days_delimiter;
-- raise notice 'DEBUG: v_expected_backup_date: %, v_days_delimiter: %', v_expected_backup_date, v_days_delimiter;
perform *
from
backups.tasks t
where
t.backup_id = v_host_r.last_backup_id
and v_expected_backup_date::timestamptz <= now()
order by
start_txtime desc
limit 1;
if found then
v_is_found := true;
exit;
end if;
end loop;
-- exit with error if don't find appropriate backup candidate
if v_is_found = false then
-- raise notice 'there is no tasks for ''%''', i_archiver;
return;
end if;
o_pghost := v_host_r.host;
o_pgport := v_host_r.port;
o_keep_backups_cnt := v_host_r.keep_backups_cnt;
o_backups_dir := v_host_r.directory;
o_bareos_on := v_host_r.bareos_on;
-- choose host for syncing (wal-sync, wal-cleanup)
select (array_remove(v_host_r.archiver_name, v_chosen_archiver))[1] into o_remote_archiver from backups.hosts h;
-- add record with backup task
insert into backups.tasks
(host, archiver_name, start_txtime, end_txtime)
values
(v_host_r.host, v_chosen_archiver, now(), NULL)
returning backup_id into o_backip_id;
-- update hosts status
update backups.hosts set last_archiver = v_chosen_archiver, last_backup_start_txtime = now(), last_backup_id = o_backip_id where host = v_host_r.host;
return next;
end;
$function$;
alter function backups.get_next ( text) owner to postgres ;
---
CREATE OR REPLACE FUNCTION backups.stop(i_backup_id integer, OUT o_info boolean)
RETURNS boolean
LANGUAGE plpgsql
AS $function$
-- mark backup_id (which was get by backups.i_archiver()) as successful
DECLARE
begin
o_info := false;
update
backups.tasks
set
is_failed = false,
end_txtime = now()
where
backup_id = i_backup_id;
if found then
o_info := true;
end if;
end;
$function$;
alter function backups.stop ( integer) owner to postgres ;
---
|
# q1.sql — http://www4.wiwiss.fu-berlin.de/bizer/BerlinSPARQLBenchmark/spec/index.html#queryTripleQ1
# $Id: q1.sql,v 1.1 2008-11-16 14:06:36 eric Exp $
#
# substitutions:
# @ProductType@=59
# @ProductFeature1@=5
# @ProductFeature2@=7
# @x@=578
SELECT distinct nr, label
FROM product AS p
INNER JOIN producttypeproduct AS ptp ON p.nr = ptp.product AND ptp.productType=59
INNER JOIN productfeatureproduct AS pf5 ON pf5.product=p.nr AND pf5.productFeature=5
INNER JOIN productfeatureproduct AS pf7 ON pf7.product=p.nr AND pf7.productFeature=7
WHERE propertyNum1 > 578
ORDER BY label
LIMIT 10;
|
CREATE TYPE [dbo].[Corruption] AS TABLE (
[SourceTable] TINYINT NOT NULL,
[database_id] INT NOT NULL,
[last_update_date] DATETIME NOT NULL);
|
<gh_stars>1-10
/*
--------------------------------------------------------------------
© 2017 sqlservertutorial.net All Rights Reserved
--------------------------------------------------------------------
Name : BikeStores
Link : http://www.sqlservertutorial.net/load-sample-database/
Version: 1.0
--------------------------------------------------------------------
*/
-- drop tables
DROP TABLE IF EXISTS sales.order_items;
DROP TABLE IF EXISTS sales.orders;
DROP TABLE IF EXISTS production.stocks;
DROP TABLE IF EXISTS production.products;
DROP TABLE IF EXISTS production.categories;
DROP TABLE IF EXISTS production.brands;
DROP TABLE IF EXISTS sales.customers;
DROP TABLE IF EXISTS sales.staffs;
DROP TABLE IF EXISTS sales.stores;
-- drop the schemas
DROP SCHEMA IF EXISTS sales;
DROP SCHEMA IF EXISTS production;
|
DELETE FROM `m_permission` WHERE code in ('UNDOTRANSACTIONBATCHTRX_SAVINGSACCOUNT');
INSERT INTO `m_permission` (`id`, `grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) VALUES
(NULL, 'portfolio', 'UNDOTRANSACTIONBATCHTRX_SAVINGSACCOUNT', 'SAVINGSACCOUNT', 'UNDOTRANSACTIONBATCHTRX', '1');
|
<reponame>DataWorkbench/account<gh_stars>0
CREATE TABLE IF NOT EXISTS `flink_cluster` (
-- Workspace id it belongs to
`space_id` CHAR(20) NOT NULL,
-- Cluster ID, unique within a region
`id` CHAR(20) NOT NULL,
-- Cluster Name, Unique within a workspace
-- The max length of use set is 128. The system will be auto rename to <name>.<id> when deleted.
-- Thus the VARCHAR should be define as 149 (128 + 20 + 1)
`name` VARCHAR(149) NOT NULL,
-- The flink version.
`version` VARCHAR(63) NOT NULL,
-- The cluster status. 1 => "deleted" 2 => "running" 3 => "stopped" 4 => "starting" 5 => "exception" 6 => "Arrears"
`status` TINYINT(1) UNSIGNED NOT NULL,
-- Flink task number for TaskManager. Is required, Min 1, Max ?
`task_num` INT,
-- Flink JobManager's cpu and memory. 1CU = 1C + 4GB. Is required, Min 0.5, Max 8
`job_cu` FLOAT,
-- Flink TaskManager's cpu and memory. 1CU = 1C + 4GB. Is required, Min 0.5, Max 8
`task_cu` FLOAT,
-- Network config.
`network_id` CHAR(20) NOT NULL,
-- Config of host aliases
`host_aliases` JSON,
-- Flink config.
`config` JSON,
-- The user-id of created this flink cluster.
`created_by` VARCHAR(128) NOT NULL,
-- Timestamp of create time
`created` BIGINT(20) UNSIGNED NOT NULL,
-- Timestamp of update time, Update when some changed, default value should be same as "created"
`updated` BIGINT(20) UNSIGNED NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY unique_flink_cluster_name(`space_id`, `name`)
) ENGINE=InnoDB COMMENT='The flink cluster info.';
|
<gh_stars>1-10
INSERT INTO SessionPlanet
(PlanetId, Exhausted)
VALUES ({0},{1});
|
-- Database: mssql
-- Change Parameter: columns=[column:[
-- name="id"
-- type="int"
-- ], ]
-- Change Parameter: tableName=person
CREATE INDEX ON [person]([id]);
|
DROP TABLE IF EXISTS view_proposal_validators;
DROP INDEX IF EXISTS view_proposal_validators_initial_delegator_address_btree_index;
DROP INDEX IF EXISTS view_proposal_validators_initial_delegator_address_btree_index;
|
ALTER TABLE `member_investments` ADD `deposit_amount` FLOAT(10,2) NULL DEFAULT NULL AFTER `start_ammount`;
CREATE TABLE IF NOT EXISTS `plans` (
`id` int(11) NOT NULL,
`name` varchar(20) NOT NULL,
`status` tinyint(1) DEFAULT '0',
`created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`created_by` int(11) NOT NULL,
`updated_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`updated_by` int(11) NOT NULL,
`is_deleted` tinyint(2) NOT NULL DEFAULT '0'
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;
--
-- Dumping data for table `plans`
--
INSERT INTO `plans` (`id`, `name`, `status`, `created_at`, `created_by`, `updated_at`, `updated_by`, `is_deleted`) VALUES
(1, 'FD', 1, '2015-07-02 19:25:24', 1, '2015-07-08 17:07:49', 1, 0),
(2, 'RD', 1, '2015-07-02 19:25:24', 1, '2015-07-08 17:07:49', 1, 0),
(3, 'DDS', 1, '2015-07-02 19:25:24', 1, '2015-08-01 15:44:17', 1, 0),
(4, 'MIS', 1, '2015-07-02 19:25:24', 1, '2015-08-01 15:44:14', 1, 0);
-- --------------------------------------------------------
--
-- Table structure for table `plans_details`
--
CREATE TABLE IF NOT EXISTS `plans_details` (
`id` int(11) NOT NULL,
`plan_id` int(11) DEFAULT NULL,
`duration` varchar(10) DEFAULT NULL,
`duration_type` varchar(1) NOT NULL DEFAULT 'M',
`installment_type` varchar(255) DEFAULT NULL,
`interest_rate` varchar(5) DEFAULT NULL,
`status` tinyint(1) DEFAULT '0',
`created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`created_by` int(11) NOT NULL,
`updated_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`updated_by` int(11) NOT NULL,
`is_deleted` tinyint(2) NOT NULL DEFAULT '0'
) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8;
--
-- Dumping data for table `plans_details`
--
INSERT INTO `plans_details` (`id`, `plan_id`, `duration`, `duration_type`, `installment_type`, `interest_rate`, `status`, `created_at`, `created_by`, `updated_at`, `updated_by`, `is_deleted`) VALUES
(1, 1, '12', 'M', 'One Time', '10.5', 1, '2015-07-09 08:52:37', 1, '2015-08-01 21:17:42', 1, 0),
(2, 1, '24', 'M', 'One Time', '11', 1, '2015-07-09 08:54:30', 1, '2015-08-01 21:17:47', 1, 0),
(3, 1, '36', 'M', 'One Time', '11.5', 1, '2015-07-09 08:54:31', 1, '2015-08-01 21:17:52', 1, 0),
(4, 1, '60', 'M', 'One Time', '12', 1, '2015-07-09 08:54:31', 1, '2015-08-01 21:18:16', 1, 0),
(5, 2, '36', 'M', 'Yearly', '12', 1, '2015-07-09 09:04:43', 1, '2015-08-01 21:54:51', 1, 0),
(6, 2, '36', 'M', 'Half Yearly', '12', 1, '2015-07-09 09:04:43', 1, '2015-08-01 21:54:51', 1, 0),
(7, 2, '36', 'M', 'Quaterly', '12', 1, '2015-07-09 09:04:43', 1, '2015-08-01 21:54:51', 1, 0),
(8, 2, '36', 'M', 'Monthly', '12', 1, '2015-07-09 09:04:43', 1, '2015-08-01 21:54:51', 1, 0),
(9, 2, '60', 'M', 'Yearly', '12.5', 1, '2015-07-09 09:04:43', 1, '2015-07-09 09:04:43', 1, 0),
(10, 2, '60', 'M', 'Half Yearly', '12.5', 1, '2015-07-09 09:04:43', 1, '2015-07-09 09:04:43', 1, 0),
(11, 2, '60', 'M', 'Quaterly', '12.5', 1, '2015-07-09 09:04:43', 1, '2015-07-09 09:04:43', 1, 0),
(12, 2, '60', 'M', 'Monthly', '12.5', 1, '2015-07-09 09:04:43', 1, '2015-07-09 09:04:43', 1, 0),
(13, 3, '365', 'D', 'Per Day', '5', 1, '2015-07-09 09:04:43', 1, '2015-07-09 09:04:43', 1, 0);
-- --------------------------------------------------------
--
-- Table structure for table `plan_formula_test`
--
CREATE TABLE IF NOT EXISTS `plan_formula_test` (
`id` int(11) NOT NULL,
`plan_id` int(11) NOT NULL,
`plan_details_id` int(11) NOT NULL,
`amount` varchar(255) NOT NULL,
`deposit_amount` varchar(255) NOT NULL,
`maturity_ammount` varchar(255) NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=130 DEFAULT CHARSET=utf8;
--
-- Dumping data for table `plan_formula_test`
--
INSERT INTO `plan_formula_test` (`id`, `plan_id`, `plan_details_id`, `amount`, `deposit_amount`, `maturity_ammount`) VALUES
(1, 1, 1, '1000', '1000', '1105'),
(2, 1, 1, '2000', '2000', '2210'),
(3, 1, 1, '5000', '5000', '5525'),
(4, 1, 1, '7500', '7500', '8287'),
(5, 1, 1, '10000', '10000', '11050'),
(6, 1, 1, '15000', '15000', '16575'),
(7, 1, 1, '20000', '20000', '22100'),
(8, 1, 1, '25000', '25000', '27625'),
(9, 1, 1, '50000', '50000', '55250'),
(10, 1, 1, '100000', '100000', '110500'),
(11, 1, 2, '1000', '1000', '1232'),
(12, 1, 2, '2000', '2000', '2464'),
(13, 1, 2, '5000', '5000', '6160'),
(14, 1, 2, '7500', '7500', '9240'),
(15, 1, 2, '10000', '10000', '12321'),
(16, 1, 2, '15000', '15000', '18481'),
(17, 1, 2, '20000', '20000', '24642'),
(18, 1, 2, '25000', '25000', '30802'),
(19, 1, 2, '50000', '50000', '61605'),
(20, 1, 2, '100000', '100000', '123210'),
(21, 1, 3, '1000', '1000', '1386'),
(22, 1, 3, '2000', '2000', '2772'),
(23, 1, 3, '5000', '5000', '6931'),
(24, 1, 3, '7500', '7500', '10396'),
(25, 1, 3, '10000', '10000', '13862'),
(26, 1, 3, '15000', '15000', '20793'),
(27, 1, 3, '20000', '20000', '27724'),
(28, 1, 3, '25000', '25000', '34655'),
(29, 1, 3, '50000', '50000', '69310'),
(30, 1, 4, '100000', '100000', '138620'),
(31, 1, 4, '1000', '1000', '1762'),
(32, 1, 4, '2000', '2000', '3524'),
(33, 1, 4, '5000', '5000', '8810'),
(34, 1, 4, '7500', '7500', '13215'),
(35, 1, 4, '10000', '10000', '17620'),
(36, 1, 4, '15000', '15000', '26430'),
(37, 1, 4, '20000', '20000', '35240'),
(38, 1, 4, '25000', '25000', '44050'),
(39, 1, 4, '50000', '50000', '88100'),
(40, 1, 4, '100000', '100000', '176200'),
(41, 2, 5, '1190', '3600', '4308'),
(42, 2, 5, '2380', '7200', '8616'),
(43, 2, 5, '3570', '10800', '12924'),
(44, 2, 5, '4760', '14400', '17232'),
(45, 2, 5, '5950', '18000', '21540'),
(46, 2, 5, '7140', '21600', '25884'),
(47, 2, 5, '8330', '25200', '30155'),
(48, 2, 5, '9520', '28800', '34463'),
(49, 2, 5, '10710', '32400', '38771'),
(50, 2, 5, '11900', '36000', '43079'),
(51, 2, 6, '595', '3600', '4308'),
(52, 2, 6, '1190', '7200', '8616'),
(53, 2, 6, '1785', '10800', '12924'),
(54, 2, 6, '2380', '14400', '17232'),
(55, 2, 6, '2975', '18000', '21540'),
(56, 2, 6, '3570', '21600', '25884'),
(57, 2, 6, '4165', '25200', '30155'),
(58, 2, 6, '4760', '28800', '34463'),
(59, 2, 6, '5355', '32400', '38771'),
(60, 2, 6, '5950', '36000', '43079'),
(61, 2, 7, '298', '3600', '4308'),
(62, 2, 7, '595', '7200', '8616'),
(63, 2, 7, '894', '10800', '12924'),
(64, 2, 7, '1192', '14400', '17232'),
(65, 2, 7, '1490', '18000', '21540'),
(66, 2, 7, '1788', '21600', '25884'),
(67, 2, 7, '2086', '25200', '30155'),
(68, 2, 7, '2384', '28800', '34463'),
(69, 2, 7, '2682', '32400', '38771'),
(70, 2, 7, '2980', '36000', '43079'),
(71, 2, 8, '100', '3600', '4308'),
(72, 2, 8, '200', '7200', '8616'),
(73, 2, 8, '300', '10800', '12924'),
(74, 2, 8, '400', '14400', '17232'),
(75, 2, 8, '500', '18000', '21540'),
(76, 2, 8, '600', '21600', '25884'),
(77, 2, 8, '700', '25200', '30155'),
(78, 2, 8, '800', '28800', '34463'),
(79, 2, 8, '900', '32400', '38771'),
(80, 2, 8, '1000', '36000', '43079'),
(81, 2, 9, '1190', '6000', '8211'),
(82, 2, 9, '2380', '12000', '8616'),
(83, 2, 9, '3570', '18000', '24634'),
(84, 2, 9, '4760', '24000', '32646'),
(85, 2, 9, '5950', '30000', '41047'),
(86, 2, 9, '7140', '36000', '49269'),
(87, 2, 9, '8330', '42000', '57480'),
(88, 2, 9, '9520', '48000', '65692'),
(89, 2, 9, '10710', '54000', '73903'),
(90, 2, 9, '11900', '60000', '82115'),
(91, 2, 10, '595', '6000', '8211'),
(92, 2, 10, '1190', '12000', '8616'),
(93, 2, 10, '1785', '18000', '24634'),
(94, 2, 10, '2380', '24000', '32646'),
(95, 2, 10, '2975', '30000', '41047'),
(96, 2, 10, '3570', '36000', '49269'),
(97, 2, 10, '4165', '42000', '57480'),
(98, 2, 10, '4760', '48000', '65692'),
(99, 2, 10, '5355', '54000', '73903'),
(100, 2, 10, '5950', '60000', '82115'),
(101, 2, 11, '298', '6000', '8211'),
(102, 2, 11, '596', '12000', '8616'),
(103, 2, 11, '894', '18000', '24634'),
(104, 2, 11, '1192', '24000', '32646'),
(105, 2, 11, '1490', '30000', '41047'),
(106, 2, 11, '1788', '36000', '49269'),
(107, 2, 11, '2086', '42000', '57480'),
(108, 2, 11, '2384', '48000', '65692'),
(109, 2, 11, '2682', '54000', '73903'),
(110, 2, 11, '2980', '60000', '82115'),
(111, 2, 12, '100', '6000', '8211'),
(112, 2, 12, '200', '12000', '8616'),
(113, 2, 12, '300', '18000', '24634'),
(114, 2, 12, '400', '24000', '32646'),
(115, 2, 12, '500', '30000', '41047'),
(116, 2, 12, '600', '36000', '49269'),
(117, 2, 12, '700', '42000', '57480'),
(118, 2, 12, '800', '48000', '65692'),
(119, 2, 12, '900', '54000', '73903'),
(120, 2, 12, '1000', '60000', '82115'),
(121, 3, 13, '100', '36500', '38325'),
(122, 3, 13, '200', '73000', '76650'),
(123, 3, 13, '300', '109500', '114975'),
(124, 3, 13, '400', '146000', '153300'),
(125, 3, 13, '500', '182500', '191625'),
(126, 3, 13, '600', '219000', '229950'),
(127, 3, 13, '700', '255500', '268275'),
(128, 3, 13, '900', '325500', '341775'),
(129, 3, 13, '1000', '365000', '383250');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `plans`
--
ALTER TABLE `plans`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `plans_details`
--
ALTER TABLE `plans_details`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `plan_formula_test`
--
ALTER TABLE `plan_formula_test`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `plans`
--
ALTER TABLE `plans`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT for table `plans_details`
--
ALTER TABLE `plans_details`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=14;
--
-- AUTO_INCREMENT for table `plan_formula_test`
--
ALTER TABLE `plan_formula_test`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=130;
|
<filename>db/insert_scripts/insert_person.sql
-- <NAME>
-- february 26 2022
-- insert peron
USE [CapstoneRecipeDatabase]
GO
INSERT INTO [dbo].[Person]
([Id]
,[AccountTypeId]
,[FirstName]
,[LastName]
,[Email]
,[EmailUpdates]
,[EmailNewsletter]
,[Username]
,[Password]
,[FailedLoginCount])
VALUES
(0, 2, '', '', '', 0, 0, '', '', 0),
(1, 2, 'albert', 'albatross', '<EMAIL>', 1, 1, 'aalbatross', 'aaa', 0),
(2, 2, 'brittany', 'bert', '<EMAIL>', 1, 0, 'bbert', 'bbb', 0),
(3, 2, 'christina', 'chen', '<EMAIL>', 0, 1, 'cchen', 'ccc', 0),
(4, 1, 'daphne', 'dunder', '<EMAIL>', 1, 1, 'ddunder', 'ddd', 0),
(5, 1, 'emory', 'excel', '<EMAIL>', 1, 1, 'excel2020', 'eee', 0)
GO
|
-- This file should undo anything in `up.sql`
drop TABLE votes;
drop TABLE user_invite_locks;
drop TABLE user_invites;
drop TABLE proposals;
drop TABLE polls;
drop TYPE progress;
|
<filename>src/main/resources/data.sql
INSERT INTO USUARIO (USUARIO_ID, USERNAME, PASSWORD, FIRSTNAME, LASTNAME, EMAIL, ENABLED, LASTPASSWORDRESETDATE) VALUES (100, 'admin', <PASSWORD>', 'admin', 'admin', '<EMAIL>', 1, PARSEDATETIME('01-01-2016', 'dd-MM-yyyy'));
INSERT INTO USUARIO (USUARIO_ID, USERNAME, PASSWORD, FIRSTNAME, LASTNAME, EMAIL, ENABLED, LASTPASSWORDRESETDATE) VALUES (200, 'user', <PASSWORD>', 'user', 'user', '<EMAIL>', 1, PARSEDATETIME('01-01-2016','dd-MM-yyyy'));
INSERT INTO USUARIO (USUARIO_ID, USERNAME, PASSWORD, FIRSTNAME, LASTNAME, EMAIL, ENABLED, LASTPASSWORDRESETDATE) VALUES (300, 'disabled', <PASSWORD>', 'user', 'user', '<EMAIL>', 0, PARSEDATETIME('01-01-2016','dd-MM-yyyy'));
INSERT INTO AUTHORITY (ID, NAME) VALUES (1, 'ROLE_USER');
INSERT INTO AUTHORITY (ID, NAME) VALUES (2, 'ROLE_ADMIN');
INSERT INTO USER_AUTHORITY (USUARIO_ID, AUTHORITY_ID) VALUES (100, 1);
INSERT INTO USER_AUTHORITY (USUARIO_ID, AUTHORITY_ID) VALUES (100, 2);
INSERT INTO USER_AUTHORITY (USUARIO_ID, AUTHORITY_ID) VALUES (200, 1);
INSERT INTO USER_AUTHORITY (USUARIO_ID, AUTHORITY_ID) VALUES (300, 1);
INSERT INTO HORAS_USUARIO (HORA_ID, DIA, HORAS, USUARIO_ID) VALUES (0, '2018-03-26', 8, 100);
|
<reponame>suru-works/Surgases<gh_stars>0
DELIMITER $$
CREATE OR REPLACE PROCEDURE proc_cliente_consultar_ultimo_pedido (IN cliente_telefono TYPE OF cliente.telefono)
READS SQL DATA
BEGIN
DECLARE fup TYPE OF pedido.fecha;
DECLARE nup TYPE OF pedido.numero;
SELECT fecha_ultimo_pedido, numero_ultimo_pedido INTO fup, nup FROM cliente WHERE telefono = cliente_telefono;
SELECT * FROM pedido WHERE fecha = fup AND numero = nup;
END; $$
DELIMITER ;
DELIMITER $$
CREATE OR REPLACE PROCEDURE proc_impresora_insertar (
IN impresora_descripcion TYPE OF impresora.descripcion
)
MODIFIES SQL DATA
BEGIN
START TRANSACTION;
INSERT INTO impresora(descripcion) VALUES(impresora_descripcion);
SELECT LAST_INSERT_ID() as id;
COMMIT;
END; $$
DELIMITER ;
DELIMITER $$
CREATE OR REPLACE PROCEDURE proc_pedido_actualizar_informacion (
IN pedido_fecha TYPE OF pedido.fecha,
IN pedido_numero TYPE OF pedido.numero,
IN pedido_precio_bruto TYPE OF pedido.precio_bruto,
IN pedido_precio_final TYPE OF pedido.precio_final,
IN peso_total TYPE OF producto.peso
)
MODIFIES SQL DATA
BEGIN
DECLARE puntos_libra TYPE OF static.puntosxlibra;
DECLARE pedido_puntos_compra TYPE OF pedido.puntos_compra;
SELECT puntosxlibra INTO puntos_libra FROM static;
SET pedido_puntos_compra := puntos_libra * peso_total;
UPDATE pedido
SET precio_bruto = pedido_precio_bruto, precio_final = pedido_precio_final, puntos_compra = pedido_puntos_compra
WHERE fecha = pedido_fecha AND numero = pedido_numero;
END; $$
DELIMITER ;
DELIMITER $$
CREATE OR REPLACE PROCEDURE proc_pedido_insertar (
IN pedido_direccion TYPE OF pedido.direccion,
IN pedido_municipio TYPE OF pedido.municipio,
IN pedido_estado TYPE OF pedido.estado,
IN pedido_bodega TYPE OF pedido.bodega,
IN pedido_nota TYPE OF pedido.nota,
IN pedido_empleado_vendedor TYPE OF empleado.id,
IN pedido_empleado_repartidor TYPE OF empleado.id,
IN cliente_telefono TYPE OF cliente.telefono
)
MODIFIES SQL DATA
BEGIN
DECLARE ahora TIMESTAMP;
DECLARE pedido_fecha TYPE OF pedido.fecha;
DECLARE pedido_numero TYPE OF pedido.numero;
DECLARE cliente_tipo TYPE OF cliente.tipo;
SET ahora = NOW();
SET pedido_fecha := DATE(ahora);
IF (pedido_fecha IN (SELECT fecha FROM pedido)) THEN
SELECT MAX(numero) INTO pedido_numero FROM pedido WHERE fecha = pedido_fecha;
SET pedido_numero := pedido_numero + 1;
ELSE
SET pedido_numero := 1;
END IF;
SELECT tipo INTO cliente_tipo FROM cliente WHERE telefono = cliente_telefono;
UPDATE cliente
SET fecha_ultimo_pedido = pedido_fecha, numero_ultimo_pedido = pedido_numero, numero_pedidos = numero_pedidos + 1
WHERE telefono = cliente_telefono;
INSERT INTO pedido(
fecha,
numero,
hora_registro,
direccion,
municipio,
estado,
bodega,
tipo_cliente,
nota,
empleado_vendedor,
empleado_repartidor,
cliente_pedidor
) VALUES (
pedido_fecha,
pedido_numero,
TIME(ahora),
pedido_direccion,
pedido_municipio,
pedido_estado,
pedido_bodega,
cliente_tipo,
pedido_nota,
pedido_empleado_vendedor,
pedido_empleado_repartidor,
cliente_telefono
);
SELECT pedido_fecha AS fecha, pedido_numero AS numero;
END; $$
DELIMITER ;
DELIMITER $$
CREATE OR REPLACE PROCEDURE proc_pedido_inventario_puntos (
IN pedido_fecha TYPE OF pedido.fecha,
IN pedido_numero TYPE OF pedido.numero
)
MODIFIES SQL DATA
BEGIN
DECLARE puntos_libra TYPE OF static.puntosxlibra;
DECLARE producto_inventario TYPE OF producto.inventario;
DECLARE puntos_totales TYPE OF cliente.puntos;
DECLARE producto_peso TYPE OF producto.peso;
DECLARE cliente_telefono TYPE OF cliente.telefono;
SELECT puntosxlibra INTO puntos_libra FROM static;
FOR pp IN (SELECT producto, unidades FROM pedidoxproducto WHERE fecha_pedido = pedido_fecha AND numero_pedido = pedido_numero) DO
SELECT inventario INTO producto_inventario FROM producto WHERE codigo = pp.producto;
IF producto_inventario - pp.unidades < 0 THEN
SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = 'Hay un producto sin suficiente stock';
END IF;
END FOR;
SET puntos_totales := 0;
FOR pp IN (SELECT producto, unidades FROM pedidoxproducto WHERE fecha_pedido = pedido_fecha AND numero_pedido = pedido_numero) DO
UPDATE producto SET inventario = inventario - pp.unidades WHERE codigo = pp.producto;
SELECT peso INTO producto_peso FROM producto WHERE codigo = pp.producto;
SET puntos_totales := puntos_totales + (puntos_libra * producto_peso);
END FOR;
UPDATE pedido SET puntos_compra = puntos_totales WHERE fecha = pedido_fecha AND numero = pedido_numero;
SELECT cliente_pedidor INTO cliente_telefono FROM pedido WHERE fecha = pedido_fecha AND numero = pedido_numero;
UPDATE cliente SET puntos = puntos + puntos_totales WHERE telefono = cliente_pedidor;
END; $$
DELIMITER ;
DELIMITER $$
CREATE OR REPLACE PROCEDURE proc_pedidoxproducto_actualizar (
IN producto_codigo TYPE OF pedidoxproducto.producto,
IN pedido_fecha TYPE OF pedidoxproducto.fecha_pedido,
IN pedido_numero TYPE OF pedidoxproducto.numero_pedido,
IN pedidoxproducto_precio_venta TYPE OF pedidoxproducto.precio_venta,
IN pedidoxproducto_unidades TYPE OF pedidoxproducto.unidades
)
MODIFIES SQL DATA
BEGIN
DECLARE pedidoxproducto_precio_venta_original TYPE OF pedidoxproducto.precio_venta;
DECLARE pedidoxproducto_valor_iva_original TYPE OF pedidoxproducto.valor_iva;
DECLARE pedidoxproducto_unidades_original TYPE OF pedidoxproducto.valor_iva;
DECLARE pedidoxproducto_valor_iva TYPE OF pedidoxproducto.valor_iva;
DECLARE pedidoxproducto_descuento TYPE OF pedidoxproducto.descuento;
DECLARE precio_bruto_original TYPE OF pedidoxproducto.precio_bruto;
DECLARE precio_final_original TYPE OF pedido.precio_final;
DECLARE precio_bruto_nuevo TYPE OF pedido.precio_bruto;
DECLARE precio_final_nuevo TYPE OF pedido.precio_final;
SELECT precio_venta, valor_iva, descuento, unidades INTO pedidoxproducto_precio_venta_original, pedidoxproducto_valor_iva_original, pedidoxproducto_descuento, pedidoxproducto_unidades_original
FROM pedidoxproducto
WHERE producto = producto_codigo AND fecha_pedido = pedido_fecha AND numero_pedido = pedido_numero;
SET pedidoxproducto_valor_iva := pedidoxproducto_precio_venta * (pedidoxproducto_valor_iva / pedidoxproducto_precio_venta_original);
UPDATE pedidoxproducto
SET precio_venta = pedidoxproducto_precio_venta, valor_iva = pedidoxproducto_valor_iva, unidades = pedidoxproducto_unidades
WHERE producto = producto_codigo AND fecha_pedido = pedido_fecha AND numero_pedido = pedido_numero;
SET precio_bruto_original := pedidoxproducto_precio_venta_original * pedidoxproducto_unidades_original;
SET precio_final_original := (pedidoxproducto_precio_venta_original + pedidoxproducto_valor_iva_original) * ((100 - pedidoxproducto_descuento) / 100) * pedidoxproducto_unidades_original;
SET precio_bruto_nuevo := pedidoxproducto_precio_venta * pedidoxproducto_unidades;
SET precio_final_nuevo := (pedidoxproducto_precio_venta + pedidoxproducto_valor_iva) * ((100 - pedidoxproducto_descuento) / 100) * pedidoxproducto_unidades;
SELECT precio_bruto_original, precio_final_original, precio_bruto_nuevo, precio_final_nuevo;
END; $$
DELIMITER ;
DELIMITER $$
CREATE OR REPLACE PROCEDURE proc_pedidoxproducto_eliminar (
IN producto_codigo TYPE OF pedidoxproducto.producto,
IN pedido_fecha TYPE OF pedidoxproducto.fecha_pedido,
IN pedido_numero TYPE OF pedidoxproducto.numero_pedido
)
MODIFIES SQL DATA
BEGIN
DECLARE pedidoxproducto_precio_venta TYPE OF pedidoxproducto.precio_venta;
DECLARE pedidoxproducto_valor_iva TYPE OF pedidoxproducto.valor_iva;
DECLARE pedidoxproducto_descuento TYPE OF pedidoxproducto.descuento;
DECLARE pedidoxproducto_unidades TYPE OF pedidoxproducto.unidades;
DECLARE precio_bruto TYPE OF pedido.precio_bruto;
DECLARE precio_final TYPE OF pedido.precio_final;
SELECT precio_venta, valor_iva, descuento, unidades INTO pedidoxproducto_precio_venta, pedidoxproducto_valor_iva, pedidoxproducto_descuento, pedidoxproducto_unidades
FROM pedidoxproducto
WHERE producto = producto_codigo AND fecha_pedido = pedido_fecha AND numero_pedido = pedido_numero;
SET precio_bruto := pedidoxproducto_precio_venta * pedidoxproducto_unidades;
SET precio_final := (pedidoxproducto_precio_venta + pedidoxproducto_valor_iva) * ((100 - pedidoxproducto_descuento) / 100) * pedidoxproducto_unidades;
SELECT precio_bruto, precio_final;
END; $$
DELIMITER ;
DELIMITER $$
CREATE OR REPLACE PROCEDURE proc_pedidoxproducto_insertar (
IN producto_codigo TYPE OF pedidoxproducto.producto,
IN pedido_fecha TYPE OF pedidoxproducto.fecha_pedido,
IN pedido_numero TYPE OF pedidoxproducto.numero_pedido,
IN pedidoxproducto_precio_venta TYPE OF pedidoxproducto.precio_venta,
IN pedidoxproducto_unidades TYPE OF pedidoxproducto.unidades,
IN cliente_telefono TYPE OF pedido.cliente_pedidor
)
MODIFIES SQL DATA
BEGIN
DECLARE pedidoxproducto_valor_iva TYPE OF pedidoxproducto.valor_iva;
DECLARE pedidoxproducto_descuento TYPE OF pedidoxproducto.descuento;
DECLARE clientexproducto_descuento TYPE OF clientexproducto.descuento;
DECLARE precio_bruto TYPE OF pedido.precio_bruto;
DECLARE precio_final TYPE OF pedido.precio_final;
SET pedidoxproducto_valor_iva := pedidoxproducto_precio_venta * ((SELECT iva_actual FROM static) / 100);
SET pedidoxproducto_descuento := 0;
SELECT descuento INTO pedidoxproducto_descuento
FROM clientexproducto
WHERE cliente = cliente_telefono AND producto = producto_codigo;
INSERT INTO pedidoxproducto VALUES (
producto_codigo,
pedido_fecha,
pedido_numero,
pedidoxproducto_precio_venta,
pedidoxproducto_valor_iva,
pedidoxproducto_descuento,
pedidoxproducto_unidades
);
SET precio_final := (pedidoxproducto_precio_venta + pedidoxproducto_valor_iva) * ((100 - pedidoxproducto_descuento) / 100) * pedidoxproducto_unidades;
SELECT pedidoxproducto_precio_venta * pedidoxproducto_unidades AS precio_bruto, precio_final;
END; $$
DELIMITER ;
DELIMITER $$
CREATE OR REPLACE PROCEDURE proc_usuario_cambiar_password (
IN usuario_restore_password_token TYPE OF usuario.restore_password_token,
IN usuario_password_hash TYPE OF usuario.password_hash
)
MODIFIES SQL DATA
BEGIN
DECLARE usuario_username TYPE OF usuario.username;
SELECT username INTO usuario_username FROM usuario WHERE restore_password_token = usuario_restore_password_token;
DELETE FROM sessions WHERE session_id IN (SELECT session_id FROM user_sessions WHERE username = usuario_username);
DELETE FROM user_sessions WHERE username = usuario_username;
UPDATE usuario SET password_hash = <PASSWORD>, restore_password_token = NULL WHERE username = usuario_username;
END; $$
DELIMITER ;
DELIMITER $$
CREATE OR REPLACE PROCEDURE proc_usuario_cliente_insertar (
IN cliente_telefono TYPE OF cliente.telefono,
IN cliente_email TYPE OF cliente.email,
IN cliente_nombre TYPE OF cliente.nombre,
IN cliente_tipo TYPE OF cliente.tipo,
IN usuario_username TYPE OF usuario.username,
IN usuario_email TYPE OF usuario.email,
IN usuario_password_hash TYPE OF usuario.password_hash
)
MODIFIES SQL DATA
DETERMINISTIC
BEGIN
INSERT INTO cliente(
telefono,
email,
nombre,
fecha_registro,
puntos,
tipo,
numero_pedidos
) VALUES (
cliente_telefono,
cliente_email,
cliente_nombre,
DATE(NOW()),
0,
cliente_tipo,
0
);
INSERT INTO usuario(
username,
email,
password_hash,
verificado,
es_admin,
cliente
) VALUES (
usuario_username,
usuario_email,
usuario_password_hash,
b'0',
b'0',
cliente_telefono
);
END; $$
DELIMITER ;
DELIMITER $$
CREATE OR REPLACE PROCEDURE proc_usuario_current (IN usuario_username TYPE OF usuario.username)
READS SQL DATA
BEGIN
DECLARE usuario_cliente TYPE OF usuario.cliente;
DECLARE usuario_empleado TYPE OF usuario.empleado;
DECLARE cliente_tipo TYPE OF cliente.tipo;
DECLARE empleado_tipo TYPE OF empleado.tipo;
SELECT cliente, empleado INTO usuario_cliente, usuario_empleado FROM usuario WHERE username = usuario_username;
IF usuario_cliente IS NOT NULL THEN
SELECT tipo INTO cliente_tipo FROM cliente WHERE telefono = usuario_cliente;
END IF;
IF usuario_empleado IS NOT NULL THEN
SELECT tipo INTO empleado_tipo FROM empleado WHERE id = usuario_empleado;
END IF;
SELECT username, email, es_admin, cliente_tipo, empleado_tipo FROM usuario WHERE username = usuario_username;
END; $$
DELIMITER ;
DELIMITER $$
CREATE OR REPLACE PROCEDURE proc_usuario_insertar (
IN usuario_username TYPE OF usuario.username,
IN usuario_email TYPE OF usuario.email,
IN usuario_password_hash TYPE OF usuario.password_hash,
IN usuario_cliente TYPE OF usuario.cliente
)
MODIFIES SQL DATA
BEGIN
INSERT INTO usuario(
username,
email,
password_hash,
verificado,
es_admin,
cliente
) VALUES (
usuario_username,
usuario_email,
usuario_password_hash,
b'0',
b'0',
usuario_cliente
);
UPDATE cliente SET email = usuario_email WHERE telefono = usuario_cliente;
END; $$
DELIMITER ;
|
-- Drop all tables and views created for the HR database example
DROP VIEW HR.OPA_EMPLOYEES_VIEW;
DROP VIEW HR.OPA_LOCATIONS_VIEW;
DROP VIEW HR.OPA_DEPARTMENTS_VIEW;
DROP TABLE HR.OPA_EMPLOYEES;
DROP TABLE HR.OPA_LOCATIONS;
DROP TABLE HR.OPA_DEPARTMENTS;
|
<reponame>geophile/sql-layer
SELECT artists.* FROM artists
INNER JOIN artists AS b ON (b.id = artists.id)
WHERE (artists.id IN (
SELECT join_albums_artists.artist_id FROM join_albums_artists
WHERE ((join_albums_artists.album_id IN (
SELECT albums.id FROM albums
INNER JOIN albums AS b ON (b.id = albums.id)
WHERE ((albums.id IN (1, 3)) AND (albums.id IS NOT NULL)))) AND
(join_albums_artists.artist_id IS NOT NULL))));
|
-- phpMyAdmin SQL Dump
-- version 4.8.3
-- https://www.phpmyadmin.net/
--
-- Servidor: 127.0.0.1
-- Tiempo de generación: 15-02-2019 a las 02:57:39
-- Versión del servidor: 10.1.35-MariaDB
-- Versión de PHP: 7.2.9
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Base de datos: `tms`
--
CREATE DATABASE IF NOT EXISTS `tms` DEFAULT CHARACTER SET utf16 COLLATE utf16_unicode_ci;
USE `tms`;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `tms_score`
--
-- Creación: 09-02-2019 a las 03:03:26
-- Última actualización: 15-02-2019 a las 01:48:15
-- Última revisión: 14-02-2019 a las 20:51:22
--
DROP TABLE IF EXISTS `tms_score`;
CREATE TABLE `tms_score` (
`id` int(11) NOT NULL,
`gen` varchar(32) COLLATE utf8_bin NOT NULL,
`user` varchar(20) COLLATE utf8_bin NOT NULL,
`time` float NOT NULL,
`country` varchar(10) COLLATE utf8_bin NOT NULL,
`date` datetime NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
--
-- RELACIONES PARA LA TABLA `tms_score`:
--
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `tms_statics`
--
-- Creación: 14-02-2019 a las 21:24:04
--
DROP TABLE IF EXISTS `tms_statics`;
CREATE TABLE `tms_statics` (
`id` int(11) NOT NULL,
`scoreboard` int(11) NOT NULL,
`games` int(11) NOT NULL,
`country` varchar(10) COLLATE utf16_unicode_ci NOT NULL,
`gen` int(3) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf16 COLLATE=utf16_unicode_ci;
--
-- RELACIONES PARA LA TABLA `tms_statics`:
--
--
-- Índices para tablas volcadas
--
--
-- Indices de la tabla `tms_score`
--
ALTER TABLE `tms_score`
ADD PRIMARY KEY (`id`);
--
-- Indices de la tabla `tms_statics`
--
ALTER TABLE `tms_statics`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT de las tablas volcadas
--
--
-- AUTO_INCREMENT de la tabla `tms_score`
--
ALTER TABLE `tms_score`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT de la tabla `tms_statics`
--
ALTER TABLE `tms_statics`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- Metadatos
--
USE `phpmyadmin`;
--
-- Metadatos para la tabla tms_score
--
--
-- Metadatos para la tabla tms_statics
--
--
-- Metadatos para la base de datos tms
--
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 */;
|
-- add type on node
alter table node add(
"PLATFORMTYPE" VARCHAR2(255)
) ;
update node set platformtype='JBOSS' where platformtype is null;
alter table node_aud add(
"PLATFORMTYPE" VARCHAR2(255)
) ;
update node_aud set platformtype='JBOSS' where platformtype is null;
|
UPDATE census SET "the_geom" = ST_SetSRID(ST_Point("INTPTLON", "INTPTLAT"), 4269);
|
BEGIN;
ALTER TABLE players DROP COLUMN role;
DROP TYPE enum_player_role;
COMMIT;
|
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
-- --------------------------------------------------------
-- Table structure for table `networknotice`
--
CREATE TABLE IF NOT EXISTS `networknotice` (
`notice_id` int(11) NOT NULL AUTO_INCREMENT,
`label` tinyblob NOT NULL,
`wiki` blob NOT NULL,
`namespace` tinyblob NOT NULL,
`notice_text` blob NOT NULL,
`style` tinyblob NOT NULL,
`category` blob NOT NULL,
`prefix` blob NOT NULL,
`action` blob NOT NULL,
`disabled` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`notice_id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=binary;
|
<filename>modules/Blogs/meta/install_db/posts/MySQLi.sql
CREATE TABLE IF NOT EXISTS `[prefix]blogs_posts` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`user` bigint(20) unsigned NOT NULL,
`date` bigint(20) unsigned NOT NULL,
`title` varchar(1024) NOT NULL,
`path` varchar(255) NOT NULL,
`content` mediumtext NOT NULL,
`draft` tinyint(1) unsigned NOT NULL,
PRIMARY KEY (`id`),
KEY `user` (`user`),
KEY `date` (`date`),
KEY `path` (`path`),
KEY `draft` (`draft`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS `[prefix]blogs_posts_sections` (
`id` int(11) NOT NULL COMMENT 'Post id',
`section` int(11) NOT NULL COMMENT 'Category id',
KEY `id` (`id`),
KEY `section` (`section`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS `[prefix]blogs_posts_tags` (
`id` bigint(20) NOT NULL COMMENT 'Post id',
`tag` bigint(20) NOT NULL COMMENT 'Tag id',
`lang` varchar(2) NOT NULL,
KEY `id` (`id`),
KEY `tag` (`tag`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS `[prefix]blogs_sections` (
`id` smallint(4) unsigned NOT NULL AUTO_INCREMENT,
`parent` smallint(4) unsigned NOT NULL DEFAULT '0',
`title` varchar(1024) NOT NULL,
`path` varchar(255) NOT NULL,
PRIMARY KEY (`id`),
KEY `parent` (`parent`),
KEY `path` (`path`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS `[prefix]blogs_tags` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`text` varchar(1024) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `text` (`text`(191))
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS `[prefix]texts` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`label` varchar(1024) NOT NULL,
`group` varchar(1024) NOT NULL,
PRIMARY KEY (`id`),
KEY `label` (`label`(191),`group`(191))
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS `[prefix]texts_data` (
`id` bigint(20) NOT NULL COMMENT 'id from texts table',
`id_` varchar(25) NOT NULL,
`lang` varchar(2) NOT NULL,
`text` mediumtext NOT NULL,
PRIMARY KEY (`id`,`lang`),
KEY `id_` (`id_`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_unicode_ci;
|
----------------------- Buffer usage count distribution -----------------------
SELECT
c.relname,
count(*) AS buffers
FROM pg_class c
INNER JOIN pg_buffercache b
ON b.relfilenode=c.relfilenode
INNER JOIN pg_database d
ON (b.reldatabase=d.oid AND d.datname=current_database())
GROUP BY c.relname
ORDER BY 2 DESC
LIMIT 2;
relname | buffers
---------------------------------+---------
pgbench_accounts | 9061
pgbench_accounts_pkey | 7168
|
USE [master]
GO
-- remove listener that exists previously
ALTER AVAILABILITY GROUP [ag1]
REMOVE LISTENER N'ag-node000';
GO
-- create listener that maps to the listener of the primary replica IP to use for read-routing
ALTER AVAILABILITY GROUP [ag1]
ADD LISTENER N'ag-node000' (
WITH IP
((N'10.0.0.4', N'255.255.240.0')
)
, PORT=2433);
GO
|
<gh_stars>10-100
DROP TABLE "public"."votes";
|
<reponame>Kcjohnson/SCGP
/*
Build a squared gene x subject matrix for heatmap plotting
1. Get selected tumor pairs as described elsewhere (`selected_tumor_pairs`)
- reduce this list to a list of aliquots, combining (a) and (b) into a single column (`selected_aliquots`). This list is only used for coverage
2. Select a list of genes and specific variants
- Take genes deemed significant using the dNdS-CV method
- Manually adding a genes that are not significant by dNdS but are known glioma genes (handpicked from Anzhela's list)
- Filter the list of variants by subsetting hotspot variants only for those genes where they are known
3. Take the cartesian product between the genes and aliquots table, generating a table with (genes x aliquots) numbers of rows (`selected_genes_samples`)
- Get coverage statistics from all these loci across all aliquots and compute median for each gene and aliquot (`gene_sample_coverage`)
- Use the tumor pairs list from step 1 to align tumor pairs to genes and coverage statistics for sample (a) and (b) from each pair (`gene_pair_coverage`)
4. Take variants from each tumor_barcode, subsetting selected tumor pairs from step 1 and by variants from step 2 (`variants_by_case_and_gene`)
- For each pair, there exists an optimal first tumor (a) and subsequent tumor sample (b)
- Aggregate over variants by case_barcode and gene_symbol, selecting only the top variant for each subject/gene combination
- Restrict to events with coverage >= 5 in both (a) and (b)
- Variants for each tumor pair/gene combination are ordered according to variant_classification_priority (see new table analysis.variant_classifications) and whether or not the mutation was called in a/b and finally based on read_depth
- Manually calling all variants based on a 0.05 VAF threshold, since we already applied stringent filtering prior to this step (eg. only variants with a mutect call in either (a) or (b) are included in the data at this point)
5. Right join the limited list of variants from step 4 with the extensive coverage statistics from step 3, generating a squared table with all genes and all subjects (`squared_variants`)
6. Perform a subject level call of whether the variant was called in sample A only (initial only), B only (recurrence only), or both (shared), or in neither mark as wild-type.
- If there is not enough coverage in either A or B, mark the gene/subject combination as NULL to indicate insufficient coverage.
*/
WITH
selected_tumor_pairs AS
(
SELECT
tumor_pair_barcode,
case_barcode,
tumor_barcode_a,
tumor_barcode_b,
row_number() OVER (PARTITION BY case_barcode ORDER BY surgical_interval_mo DESC, portion_a ASC, portion_b ASC, substring(tumor_pair_barcode from 27 for 3) ASC) AS priority
FROM analysis.tumor_pairs ps
LEFT JOIN analysis.blocklist b1 ON b1.aliquot_barcode = ps.tumor_barcode_a
LEFT JOIN analysis.blocklist b2 ON b2.aliquot_barcode = ps.tumor_barcode_b
WHERE
comparison_type = 'longitudinal' AND
sample_type_b <> 'M1' AND -- exclude metastatic samples here because this is outside the scope of our study
b1.coverage_exclusion = 'allow' AND b2.coverage_exclusion = 'allow'
),
selected_aliquots AS
(
SELECT tumor_barcode_a AS aliquot_barcode, case_barcode FROM selected_tumor_pairs WHERE priority = 1
UNION
SELECT tumor_barcode_b AS aliquot_barcode, case_barcode FROM selected_tumor_pairs WHERE priority = 1
),
selected_genes AS
(
SELECT sn.gene_symbol, chrom, pos, alt, sn.variant_classification, vc.variant_classification_priority, protein_change
FROM variants.anno sn
LEFT JOIN variants.variant_classifications vc ON sn.variant_classification = vc.variant_classification
WHERE
variant_classification_priority IS NOT NULL AND
(sn.gene_symbol IN ('ATM','ATR','RPA1','RPA2','RPA3','RPA4','BRCA1','BRCA2','RAD51','RFC1','RFC2','RFC3','RFC4','RFC5','XRCC1','PCNA','PARP1','ERCC1','MSH3','PMS2','MLH1','MSH6','MSH2','MLH3','EXO1','NBN','RAD50','CHEK2','FANCI','FANCD2','FANCA','FANCC','FANCE','FANCL','FANCG','FANCM','ERCC4','ERCC2','ERCC5','PARP2','APEX1','FEN1','XPC','ERCC6','GTF2H2','ERCC3','XPA','RAD23B','PALB2','RAD51C','XRCC6','XRCC5','PRKDC','XRCC4','Lig4','FANCB','FANCF','FAAP24','CHEK1','BRIP1','SLX4','FAN1','MUS81','EME1','POLE','POLD1','MRE11A','RAD51D','RAD52','RAD51B','PMS1','RAD23A','LIG3','MGMT','OGG1','UNG','SMUG1','MBD4','TDG','MUTYH','NTHL1','MPG','NEIL1','NEIL2','NEIL3','APEX2','PNKP','APLF','PARP3','ALKBH2','ALKBH3','MSH4','MSH5','PMS2P3','CETN2','DDB1','DDB2','GTF2H1','GTF2H3','GTF2H4','GTF2H5','CDK7','CCNH','MNAT1','LIG1','ERCC8','UVSSA','XAB2','MMS19','DMC1','XRCC2','XRCC3','RAD54L','RAD54B','SHFM1','RBBP8','SLX1A','SLX1B','GEN1','FAAP20','DCLRE1C','NHEJ1','PAXIP1','BLM','MLL3','CRIP1','CDK12','BAP1','BARD1','WRN','BUB1','CENPE','ZW10','TTK','KNTC1','AURKB','POLB','POLH','POLQ','TDP1','TDP2','NUDT1','DUT','RRM2B','POLG','REV3L','MAD2L2','REV1','POLI','POLK','POLL','POLM','POLN','TREX1','TREX2','APTX','SPO11','ENDOV','UBE2A','UBE2B','RAD18','SHPRH','HLTF','RNF168','SPRTN','RNF8','RNF4','UBE2V2','UBE2N','H2AFX','CHAF1A','SETMAR','RECQL4','MPLKIP','DCLRE1A','DCLRE1B','PRPF19','RECQL','RECQL5','HELQ','RDM1','NABP2','ATRIP','MDC1','RAD1','RAD9A','HUS1','RAD17','TP53','TP53BP1','TOPBP1','CLK2','PER1'))
),
selected_genes_samples AS
(
SELECT aliquot_barcode, case_barcode, gene_symbol, chrom, lower(pos) AS start_pos, upper(pos)-1 AS end_pos, alt
FROM selected_aliquots, selected_genes
),
variants_by_case_and_gene AS
(
SELECT
gtc.gene_symbol,
gtc.case_barcode,
gtc.tumor_pair_barcode,
gtc.chrom,
gtc.pos,
gtc.alt,
gtc.variant_classification,
sg.protein_change,
mutect2_call_a AS selected_call_a, --(alt_count_a::decimal / (alt_count_a+ref_count_a) > 0.05) AS selected_call_a,
mutect2_call_b AS selected_call_b, --(alt_count_b::decimal / (alt_count_b+ref_count_b) > 0.05) AS selected_call_b,
row_number() OVER (PARTITION BY gtc.gene_symbol, gtc.case_barcode ORDER BY mutect2_call_a::integer + mutect2_call_b::integer = 2, variant_classification_priority, mutect2_call_a::integer + mutect2_call_b::integer DESC, (ref_count_a + alt_count_a + ref_count_b + alt_count_b) DESC) AS priority
FROM variants.pgeno gtc
INNER JOIN selected_tumor_pairs stp ON stp.tumor_pair_barcode = gtc.tumor_pair_barcode AND stp.priority = 1
INNER JOIN selected_genes sg ON sg.chrom = gtc.chrom AND sg.pos = gtc.pos AND sg.alt = gtc.alt
WHERE
(mutect2_call_a OR mutect2_call_b) AND (ref_count_a +alt_count_a >=5) AND (ref_count_b + alt_count_b >= 5)
),
squared_variants AS
(
SELECT
vcg.gene_symbol,
vcg.case_barcode,
vcg.chrom,
vcg.pos,
vcg.alt,
vcg.variant_classification,
vcg.protein_change,
vcg.selected_call_a,
vcg.selected_call_b
FROM (SELECT * FROM variants_by_case_and_gene WHERE priority = 1) vcg
)
SELECT
gene_symbol,
var.case_barcode,
variant_classification,
protein_change,
selected_call_a,
selected_call_b,
(CASE
WHEN selected_call_a AND selected_call_b THEN 'Shared'
WHEN selected_call_a AND NOT selected_call_b THEN 'Shed'
WHEN selected_call_b AND NOT selected_call_a THEN 'Acquired'
ELSE NULL END) AS variant_call
FROM squared_variants var
|
<gh_stars>100-1000
DELETE FROM "t_2uhu4szs1kq";
INSERT INTO "t_2uhu4szs1kq" ("id", "created_at", "updated_at", "sort", "created_by_id", "updated_by_id", "f_hwenour8ara", "f_hznqtmqljb2", "f_u4i0jrp4uo6", "f_l8uuiwcnlw9") VALUES
(1, '2021-09-03 08:19:53.163+00', '2021-09-18 07:50:34.039+00', 70, 1, 1, '这是我们要做的任务这是我们要做的', '2021-09-17 00:00:00+00', 'f1g3r41rdh8', '利本毛所线表体定质花,则根物大教斯经前,飞能D发科程W目。 阶直少看员片飞飞今西取亲本就条,持层品平米今ON孤你七2。 花离定可除展通向业很,斗术真节西严特矿,导养-N群长置便。 深规马细三强低按段,事作般习就代它,完技O布D枝快。 便报动斗改克离为具影研立特,养命规么才设步局方总较共张,时什Q肃声的者起开出话。'),
(2, '2021-09-12 08:01:16.467+00', '2021-09-18 07:50:34.039+00', 71, 1, 1, '批量上传附件', '2021-09-24 00:00:00+00', 'f1g3r41rdh8', '利本毛所线表体定质花,则根物大教斯经前,飞能D发科程W目。 阶直少看员片飞飞今西取亲本就条,持层品平米今ON孤你七2。 花离定可除展通向业很,斗术真节西严特矿,导养-N群长置便。 深规马细三强低按段,事作般习就代它,完技O布D枝快。 便报动斗改克离为具影研立特,养命规么才设步局方总较共张,时什Q肃声的者起开出话。'),
(5, '2021-09-12 08:02:51.903+00', '2021-09-18 07:50:34.039+00', 69, 1, 1, '张斯些况于非按并音习又极别解切参', '2021-09-08 00:00:00+00', 'lebkfnj3d9i', '利本毛所线表体定质花,则根物大教斯经前,飞能D发科程W目。 阶直少看员片飞飞今西取亲本就条,持层品平米今ON孤你七2。 花离定可除展通向业很,斗术真节西严特矿,导养-N群长置便。 深规马细三强低按段,事作般习就代它,完技O布D枝快。 便报动斗改克离为具影研立特,养命规么才设步局方总较共张,时什Q肃声的者起开出话。'),
(4, '2021-09-12 08:02:37.852+00', '2021-09-18 07:50:34.039+00', 72, 1, 1, '包派极都火题折究条', '2021-10-08 00:00:00+00', 'zfowtv6fnel', '利本毛所线表体定质花,则根物大教斯经前,飞能D发科程W目。 阶直少看员片飞飞今西取亲本就条,持层品平米今ON孤你七2。 花离定可除展通向业很,斗术真节西严特矿,导养-N群长置便。 深规马细三强低按段,事作般习就代它,完技O布D枝快。 便报动斗改克离为具影研立特,养命规么才设步局方总较共张,时什Q肃声的者起开出话。'),
(6, '2021-09-17 01:35:18.379+00', '2021-09-18 07:50:34.039+00', 73, 1, 1, '达到顶峰五十五分', '2021-09-17 00:00:00+00', 'zfowtv6fnel', NULL),
(3, '2021-09-12 08:02:20.501+00', '2021-09-18 07:50:34.042+00', 68, 1, 1, '往你周观青整积元路公', '2021-09-24 00:00:00+00', 'lebkfnj3d9i', '利本毛所线表体定质花,则根物大教斯经前,飞能D发科程W目。 阶直少看员片飞飞今西取亲本就条,持层品平米今ON孤你七2。 花离定可除展通向业很,斗术真节西严特矿,导养-N群长置便。 深规马细三强低按段,事作般习就代它,完技O布D枝快。 便报动斗改克离为具影研立特,养命规么才设步局方总较共张,时什Q肃声的者起开出话。');
|
SELECT FILE#, BLOCK#, MARKED_CORRUPT, CORRUPTION_TYPE
FROM V$BACKUP_CORRUPTION;
|
<gh_stars>0
/*
Navicat MySQL Data Transfer
Source Server : sirenDB
Source Server Type : MySQL
Source Server Version : 50717
Source Host : localhost
Source Database : bookstore
Target Server Type : MySQL
Target Server Version : 50717
File Encoding : utf-8
Date: 06/16/2021 11:09:43 AM
*/
SET NAMES utf8;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for `menus`
-- ----------------------------
DROP TABLE IF EXISTS `menus`;
CREATE TABLE `menus` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(200) DEFAULT NULL,
`url` varchar(200) DEFAULT NULL,
`target` varchar(10) DEFAULT NULL,
`remark` varchar(200) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4;
-- ----------------------------
-- Records of `menus`
-- ----------------------------
BEGIN;
INSERT INTO `menus` VALUES ('1', '商品信息', '/admin/productInfo', 'self', null), ('2', '用户信息', '/admin/userInfo', 'self', null), ('3', '通知公告', '/admin/noticeInfo', 'self', null), ('4', '菜单信息', '/admin/menuInfo', 'self', null), ('5', '订单信息', '/admin/orderInfo', 'self', null), ('6', '订单详情', '/admin/orderItemInfo', 'self', null);
COMMIT;
-- ----------------------------
-- Table structure for `notices`
-- ----------------------------
DROP TABLE IF EXISTS `notices`;
CREATE TABLE `notices` (
`n_id` int(11) NOT NULL AUTO_INCREMENT,
`title` varchar(200) DEFAULT NULL,
`detail` varchar(255) DEFAULT NULL,
`createtime` datetime DEFAULT NULL,
`remark` varchar(255) DEFAULT NULL,
PRIMARY KEY (`n_id`)
) ENGINE=InnoDB AUTO_INCREMENT=18 DEFAULT CHARSET=utf8mb4;
-- ----------------------------
-- Records of `notices`
-- ----------------------------
BEGIN;
INSERT INTO `notices` VALUES ('1', '白先勇《台北人》', '“美中不足的是,抬望眼,总看见园中西隅,剩下的那两棵意大利柏树中间,露出一块楞楞的空白来,缺口当中,映着湛湛青空,悠悠白云,那是一道女娲炼石也无法弥补的天裂。”', '2020-12-04 23:13:50', null), ('2', '《现代艺术150年:一个未完成的任务》', '“如果我们还能从一百五十多年前莫奈的《日出》、梵高的《星空》中,依稀辨认出艺术“原来”的模样,那么,一百五十年后安迪·沃霍尔的金汤宝罐头、达米恩·赫斯特的腌制鲨鱼,还有翠西·艾敏乱糟糟的床,足以让我们看到艺术的其他可能。回顾现代艺术一个半世纪的反叛之路,我们见证了一代又一代人如何变得愈发反叛、大胆、混乱。这背后,是艺术家对“何为艺术”的无尽追问,是他们对周遭世界的回应与抵抗。现代艺术的故事仍在继续,也许永远不会完成。”', '2020-12-24 13:16:15', null), ('3', '《存在主义咖啡馆:自由、存在和杏子鸡尾酒》', '“在本书中,英国著名作家莎拉·贝克韦尔将历史、传记与哲学结合在一起,以史诗般恢弘的视角,激情地讲述了一个充满了斗争、爱情、反抗与背叛的存在主义故事,深入探讨了在今天这个纷争不断、技术驱动的世界里,当我们每个人再次面对有关绝对自由、全球责任与人类真实性的问题时,曾经也受过它们困扰的存在主义者能告诉我们什么。”', '2020-12-30 21:17:51', null), ('4', '袁哲生《寂寞的游戏》', '“我从来没有看过那样一张完全没有表情的脸,和那么空洞的一双眼球,对我视而不见。\n那时,他望了好一会儿,然后才掉头走开。我还记得自己一直蹲在树上,痴痴地看着那双橘色的塑胶拖鞋慢慢离去,发出干燥的沙沙声。接着,我清清楚楚地看到自己蜷缩在树上,我看见自己用一种很陌生的姿势躲在一个阴暗寂寞的角落里,我哭了...”', '2021-01-01 23:20:48', null), ('5', '双雪涛《平原上的摩西》', '“我说,你准备好了吗? 她说,我准备好了。 我把手伸进怀里,绕过我的手枪,掏出我的烟。那是我们的平原。上面的她,十一二岁,笑着,没穿袜子,看着半空。烟盒在水上漂着,上面那层塑料在阳光底下泛着光芒,北方午后的微风吹着她,向着岸边走去。”', '2021-01-30 09:22:15', null), ('6', '《麦田里的守望者》', '“对一个人来说,一辈子里注定会不时去寻找一些他们自身周围所不能提供的东西,要么他们以为自身的周围无法提供,所以放弃了寻找,他们甚至在还没有真正开始寻找前,就放弃了。 一个不成熟的人的标志是他愿意为了某个理由而轰轰烈烈地死去,而一个成熟的人的标志是他愿意为了某个理由而谦恭地活下去”', '2021-02-27 23:24:46', null), ('7', '《小王子》', '“我那时什么也不懂!我应该根据她的行为,而不是根据她的话来判断她。 她使我的生活芬芳多彩,我真不该离开她跑出来。我本应该猜出在她那令人爱怜 的花招后面所隐藏的温情。花是多么自相矛盾!我当时太年青,还不懂得爱她。”', '2021-03-30 23:29:40', null), ('11', 'test', 'test', null, null), ('16', 'xixi', 'siren', '2021-05-31 01:54:24', null), ('17', '贺正龙出新歌啦!', '我手下艺人真不错,再接再厉\r\n天啊\r\n龙龙快帮我签名', '2021-05-31 10:20:29', null);
COMMIT;
-- ----------------------------
-- Table structure for `notices_copy`
-- ----------------------------
DROP TABLE IF EXISTS `notices_copy`;
CREATE TABLE `notices_copy` (
`n_id` int(11) NOT NULL AUTO_INCREMENT,
`title` varchar(200) DEFAULT NULL,
`detail` varchar(255) DEFAULT NULL,
`createtime` datetime DEFAULT NULL,
`remark` varchar(255) DEFAULT NULL,
PRIMARY KEY (`n_id`)
) ENGINE=InnoDB AUTO_INCREMENT=18 DEFAULT CHARSET=utf8mb4;
-- ----------------------------
-- Records of `notices_copy`
-- ----------------------------
BEGIN;
INSERT INTO `notices_copy` VALUES ('1', '白先勇《台北人》', '“美中不足的是,抬望眼,总看见园中西隅,剩下的那两棵意大利柏树中间,露出一块楞楞的空白来,缺口当中,映着湛湛青空,悠悠白云,那是一道女娲炼石也无法弥补的天裂。”', '2020-12-04 23:13:50', null), ('2', '《现代艺术150年:一个未完成的任务》', '“如果我们还能从一百五十多年前莫奈的《日出》、梵高的《星空》中,依稀辨认出艺术“原来”的模样,那么,一百五十年后安迪·沃霍尔的金汤宝罐头、达米恩·赫斯特的腌制鲨鱼,还有翠西·艾敏乱糟糟的床,足以让我们看到艺术的其他可能。回顾现代艺术一个半世纪的反叛之路,我们见证了一代又一代人如何变得愈发反叛、大胆、混乱。这背后,是艺术家对“何为艺术”的无尽追问,是他们对周遭世界的回应与抵抗。现代艺术的故事仍在继续,也许永远不会完成。”', '2020-12-24 13:16:15', null), ('3', '《存在主义咖啡馆:自由、存在和杏子鸡尾酒》', '“在本书中,英国著名作家莎拉·贝克韦尔将历史、传记与哲学结合在一起,以史诗般恢弘的视角,激情地讲述了一个充满了斗争、爱情、反抗与背叛的存在主义故事,深入探讨了在今天这个纷争不断、技术驱动的世界里,当我们每个人再次面对有关绝对自由、全球责任与人类真实性的问题时,曾经也受过它们困扰的存在主义者能告诉我们什么。”', '2020-12-30 21:17:51', null), ('4', '袁哲生《寂寞的游戏》', '“我从来没有看过那样一张完全没有表情的脸,和那么空洞的一双眼球,对我视而不见。\n那时,他望了好一会儿,然后才掉头走开。我还记得自己一直蹲在树上,痴痴地看着那双橘色的塑胶拖鞋慢慢离去,发出干燥的沙沙声。接着,我清清楚楚地看到自己蜷缩在树上,我看见自己用一种很陌生的姿势躲在一个阴暗寂寞的角落里,我哭了...”', '2021-01-01 23:20:48', null), ('5', '双雪涛《平原上的摩西》', '“我说,你准备好了吗? 她说,我准备好了。 我把手伸进怀里,绕过我的手枪,掏出我的烟。那是我们的平原。上面的她,十一二岁,笑着,没穿袜子,看着半空。烟盒在水上漂着,上面那层塑料在阳光底下泛着光芒,北方午后的微风吹着她,向着岸边走去。”', '2021-01-30 09:22:15', null), ('6', '《麦田里的守望者》', '“对一个人来说,一辈子里注定会不时去寻找一些他们自身周围所不能提供的东西,要么他们以为自身的周围无法提供,所以放弃了寻找,他们甚至在还没有真正开始寻找前,就放弃了。 一个不成熟的人的标志是他愿意为了某个理由而轰轰烈烈地死去,而一个成熟的人的标志是他愿意为了某个理由而谦恭地活下去”', '2021-02-27 23:24:46', null), ('7', '《小王子》', '“我那时什么也不懂!我应该根据她的行为,而不是根据她的话来判断她。 她使我的生活芬芳多彩,我真不该离开她跑出来。我本应该猜出在她那令人爱怜 的花招后面所隐藏的温情。花是多么自相矛盾!我当时太年青,还不懂得爱她。”', '2021-03-30 23:29:40', null), ('11', 'test', 'test', null, null), ('16', 'xixi', 'siren', '2021-05-31 01:54:24', null), ('17', '龙龙出新歌啦!', 'test', '2021-05-31 10:20:29', null);
COMMIT;
-- ----------------------------
-- Table structure for `orderitems`
-- ----------------------------
DROP TABLE IF EXISTS `orderitems`;
CREATE TABLE `orderitems` (
`order_id` int(11) DEFAULT NULL,
`product_id` int(11) DEFAULT NULL,
`buy_num` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- ----------------------------
-- Table structure for `orders`
-- ----------------------------
DROP TABLE IF EXISTS `orders`;
CREATE TABLE `orders` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) DEFAULT NULL,
`money` double DEFAULT NULL,
`pay_state` int(11) DEFAULT NULL,
`guest_name` varchar(50) DEFAULT NULL,
`guest_address` varchar(200) DEFAULT NULL,
`guest_phone` varchar(50) DEFAULT NULL,
`order_time` datetime DEFAULT NULL,
`remark` varchar(200) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8mb4;
-- ----------------------------
-- Records of `orders`
-- ----------------------------
BEGIN;
INSERT INTO `orders` VALUES ('1', '1', '33', '1', 'admin', '重庆', '18698575409', '2021-05-27 20:10:47', null), ('2', '1', '53', '1', 'admin', '重庆', '18698575409', '2021-05-27 21:11:37', null), ('3', '1', '200', '0', 'admin', '重大', '18698575409', '2021-05-27 22:30:00', null), ('4', '2', '200', '1', 'siren', '湖南省长沙市幸福疗养院', '19218076508', '2021-05-27 22:52:47', null), ('5', '2', '56', '1', 'siren', '湖南省长沙市幸福疗养院', '19218076508', '2021-05-27 22:54:35', null), ('6', '8', '100', '0', '蓝蓝', '四川省遂宁市大英首府', '15598372729', '2021-05-27 22:56:40', null), ('7', '8', '100', '1', '蓝蓝', '四川省遂宁市大英首府', '15598372729', '2021-05-27 23:09:13', null), ('12', null, '200', '0', 'nihao', '尖顶坡', '178943743095', '2021-05-30 20:57:57', null), ('13', null, '22', '1', 'nihao', '的轨顶风道', '1123455', '2021-05-30 20:48:24', null), ('14', null, '200', '1', 'yxf', '属地是否会浮动和', '178943743095', '2021-05-30 21:51:30', null);
COMMIT;
-- ----------------------------
-- Table structure for `products`
-- ----------------------------
DROP TABLE IF EXISTS `products`;
CREATE TABLE `products` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(50) DEFAULT NULL,
`price` double DEFAULT NULL,
`category` varchar(50) DEFAULT NULL,
`pnum` int(11) DEFAULT NULL,
`imgurl` varchar(200) DEFAULT NULL,
`description` varchar(200) DEFAULT NULL,
`remark` varchar(200) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8mb4;
-- ----------------------------
-- Records of `products`
-- ----------------------------
BEGIN;
INSERT INTO `products` VALUES ('1', 'Java程序设计', '33', '计算机', '5', '/resources/images/java.jpg', 'Java程序设计', null), ('2', 'Web前端开发', '20', '计算机', '4', '/resources/images/web.jpg', 'Web前端开发', null), ('3', 'Php开发', '36', '计算机', '5', '/resources/images/php.jpg', 'Php开发', null), ('4', '大数据技术', '40', '计算机', '9', '/resources/images/bigdata.jpg', '大数据技术', null), ('5', 'javascript程序开发', '56', '计算机', '8', '/resources/images/javascript.jpg', 'javascript', null), ('9', 'caibuc', '12', '测试', '34', '', '', null), ('10', 'caicai', '89', '测试', '12', '', '', null), ('11', 'pp', '12', '测试', '12', '', '', null), ('12', 'qqq', '23', '测试', '34', '', '', null), ('13', 'yyyy', '12', '测试', '34', '', '', null);
COMMIT;
-- ----------------------------
-- Table structure for `users`
-- ----------------------------
DROP TABLE IF EXISTS `users`;
CREATE TABLE `users` (
`id` int(12) NOT NULL AUTO_INCREMENT,
`username` varchar(50) DEFAULT NULL,
`password` varchar(50) DEFAULT NULL,
`gender` varchar(2) DEFAULT NULL,
`email` varchar(50) DEFAULT NULL,
`telephone` varchar(15) DEFAULT NULL,
`introduce` varchar(100) DEFAULT NULL,
`activecode` varchar(50) DEFAULT NULL,
`state` int(11) DEFAULT NULL,
`role` varchar(200) DEFAULT NULL,
`registtime` datetime DEFAULT NULL,
`remark` varchar(200) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=22 DEFAULT CHARSET=utf8mb4;
-- ----------------------------
-- Records of `users`
-- ----------------------------
BEGIN;
INSERT INTO `users` VALUES ('1', 'admin', '123456', '女', '<EMAIL>', '18698575409', null, null, null, null, '2021-01-27 20:35:55', ''), ('2', 'siren', '001204', '女', '<EMAIL>', '19118076508', null, null, null, null, '2021-05-12 12:43:56', null), ('3', '枫枫', '043845', '女', '<EMAIL>', '17874077431', null, null, null, null, '2021-05-13 08:44:28', null), ('4', 'poopman', '123456', '男', '<EMAIL>', '13767754890', null, null, null, null, '2021-03-27 20:44:56', null), ('5', 'ricky', 'c13789', '男', '<EMAIL>', '17799440034', null, null, null, null, '2021-05-04 15:10:12', null), ('6', '龙龙', '123456', '男', '<EMAIL>', '17823741855', null, null, null, null, '2021-04-11 19:05:43', null), ('7', '阳阳', '654321', '男', '<EMAIL>', '18890443251', null, null, null, null, '2021-04-13 15:46:07', null), ('8', '蓝蓝', '235689', '女', '<EMAIL>', '15456730985', null, null, null, null, '2021-05-07 08:47:00', null), ('9', '王五', '112086', '女', '<EMAIL>', '15598372729', null, null, null, null, '2021-05-27 22:52:31', null), ('12', 'testt', '123456', '男', '<EMAIL>', '1234567899023', '', null, null, null, '2021-05-31 20:53:54', null), ('16', 'lss', '123456', '女', '<EMAIL>', '1234567899023', '', null, null, null, '2021-05-31 22:29:35', null), ('17', 'ans', '123456', '男', '<EMAIL>', '1234567899023', '', null, null, null, '2021-05-31 22:38:36', null), ('18', 'pyy', 'pyypyy', '男', '<EMAIL>', '18976305832', '大帅哥', null, null, null, '2021-05-31 22:43:04', null), ('19', '小菊', '520yxf', '女', '<EMAIL>', '18224274604', '', null, null, null, '2021-06-01 14:09:34', null), ('21', '小芸', '123456', '女', '<EMAIL>', '1234567899023', '', null, null, null, '2021-06-06 22:22:52', null);
COMMIT;
SET FOREIGN_KEY_CHECKS = 1;
|
-- phpMyAdmin SQL Dump
-- version 5.0.2
-- https://www.phpmyadmin.net/
--
-- Servidor: 127.0.0.1
-- Tiempo de generación: 09-02-2021 a las 14:42:35
-- Versión del servidor: 10.4.14-MariaDB
-- Versión de PHP: 7.4.10
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 */;
create database inscripcion;
use inscripcion;
-- Base de datos: `inscripcion`
--
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `alumno`
--
CREATE TABLE `alumno` (
`codMatri_alumno` char(8) NOT NULL,
`dni_alumno` char(8) NOT NULL,
`contrasenia_alumno` varchar(8) NOT NULL,
`nombres_alumno` varchar(100) NOT NULL,
`apellidos_alumno` varchar(100) NOT NULL,
`sexo` varchar(15) NOT NULL,
`fechNac_alumno` varchar(15) NOT NULL,
`direccion_alumno` varchar(100) NOT NULL,
`telefPer_alumno` char(9) DEFAULT NULL,
`telefCasa_alumno` char(9) DEFAULT NULL,
`email_alumno` varchar(100) NOT NULL,
`especialidad_alumno` varchar(50) NOT NULL,
`ciclo_alumno` char(1) NOT NULL,
`tipo_alumno` char(2) NOT NULL,
`codOperBan_alumno` varchar(15) NOT NULL,
`obser_alumno` varchar(1000) DEFAULT NULL,
`num_alumno` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Índices para tablas volcadas
--
--
-- Indices de la tabla `alumno`
--
ALTER TABLE `alumno`
ADD PRIMARY KEY (`num_alumno`);
--
-- AUTO_INCREMENT de las tablas volcadas
--
--
-- AUTO_INCREMENT de la tabla `alumno`
--
ALTER TABLE `alumno`
MODIFY `num_alumno` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;
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 files (
id bigint NOT NULL,
access_salt text NOT NULL,
s3_upload_key text NOT NULL,
is_uploaded boolean default false NOT NULL,
PRIMARY KEY (id)
);
CREATE INDEX on files(s3_upload_key);
CREATE TABLE file_parts (
file_id bigint NOT NULL,
number int NOT NULL,
size int NOT NULL,
s3_upload_key text NOT NULL,
PRIMARY KEY (file_id, number)
)
|
-- EqualTo
select 1 = 1;
select 1 = '1';
select 1.0 = '1';
select 1.5 = '1.51';
-- GreaterThan
select 1 > '1';
select 2 > '1.0';
select 2 > '2.0';
select 2 > '2.2';
select '1.5' > 0.5;
select to_date('2009-07-30 04:17:52') > to_date('2009-07-30 04:17:52');
select to_date('2009-07-30 04:17:52') > '2009-07-30 04:17:52';
-- GreaterThanOrEqual
select 1 >= '1';
select 2 >= '1.0';
select 2 >= '2.0';
select 2.0 >= '2.2';
select '1.5' >= 0.5;
select to_date('2009-07-30 04:17:52') >= to_date('2009-07-30 04:17:52');
select to_date('2009-07-30 04:17:52') >= '2009-07-30 04:17:52';
-- LessThan
select 1 < '1';
select 2 < '1.0';
select 2 < '2.0';
select 2.0 < '2.2';
select 0.5 < '1.5';
select to_date('2009-07-30 04:17:52') < to_date('2009-07-30 04:17:52');
select to_date('2009-07-30 04:17:52') < '2009-07-30 04:17:52';
-- LessThanOrEqual
select 1 <= '1';
select 2 <= '1.0';
select 2 <= '2.0';
select 2.0 <= '2.2';
select 0.5 <= '1.5';
select to_date('2009-07-30 04:17:52') <= to_date('2009-07-30 04:17:52');
select to_date('2009-07-30 04:17:52') <= '2009-07-30 04:17:52';
|
<reponame>fanrice123/qut-meditation
-- MySQL dump 10.16 Distrib 10.1.16-MariaDB, for Win32 (AMD64)
--
-- Host: localhost Database: meditation
-- ------------------------------------------------------
-- Server version 10.1.16-MariaDB
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `classtable`
--
DROP TABLE IF EXISTS `classtable`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `classtable` (
`courseID` int(11) NOT NULL,
`studentID` int(11) NOT NULL,
KEY `studentID` (`studentID`),
KEY `courseID` (`courseID`),
CONSTRAINT `classtable_ibfk_1` FOREIGN KEY (`studentID`) REFERENCES `user` (`id`),
CONSTRAINT `classtable_ibfk_2` FOREIGN KEY (`courseID`) REFERENCES `course` (`courseID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `classtable`
--
LOCK TABLES `classtable` WRITE;
/*!40000 ALTER TABLE `classtable` DISABLE KEYS */;
/*!40000 ALTER TABLE `classtable` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `course`
--
DROP TABLE IF EXISTS `course`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `course` (
`courseID` int(11) NOT NULL AUTO_INCREMENT,
`start` date NOT NULL,
`duration` int(11) NOT NULL,
`end` date NOT NULL,
PRIMARY KEY (`courseID`)
) ENGINE=InnoDB AUTO_INCREMENT=31 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `course`
--
LOCK TABLES `course` WRITE;
/*!40000 ALTER TABLE `course` DISABLE KEYS */;
INSERT INTO `course` VALUES (30,'2016-10-06',10,'2016-10-16');
/*!40000 ALTER TABLE `course` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `migration`
--
DROP TABLE IF EXISTS `migration`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `migration` (
`version` varchar(180) CHARACTER SET utf8 COLLATE utf8_unicode_520_ci NOT NULL,
`apply_time` int(11) DEFAULT NULL,
PRIMARY KEY (`version`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `migration`
--
LOCK TABLES `migration` WRITE;
/*!40000 ALTER TABLE `migration` DISABLE KEYS */;
INSERT INTO `migration` VALUES ('m000000_000000_base',1473403432),('m130524_201442_init',1473403438);
/*!40000 ALTER TABLE `migration` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `user`
--
DROP TABLE IF EXISTS `user`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `user` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`username` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`admin` tinyint(1) NOT NULL,
`firstName` varchar(40) COLLATE utf8_unicode_ci NOT NULL,
`lastName` varchar(40) COLLATE utf8_unicode_ci NOT NULL,
`auth_key` varchar(32) COLLATE utf8_unicode_ci NOT NULL,
`password_hash` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`password_reset_token` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`email` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`dob` date NOT NULL,
`gender` varchar(6) COLLATE utf8_unicode_ci NOT NULL,
`phone` varchar(20) COLLATE utf8_unicode_ci NOT NULL,
`tel` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
`status` smallint(6) NOT NULL DEFAULT '10',
`created_at` int(11) NOT NULL,
`updated_at` int(11) NOT NULL,
`address` varchar(250) COLLATE utf8_unicode_ci NOT NULL,
`postcode` smallint(6) NOT NULL,
`state` varchar(4) COLLATE utf8_unicode_ci NOT NULL,
`suburb` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`vegan` tinyint(1) NOT NULL,
`allergies` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`medicInfo` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `username` (`username`),
UNIQUE KEY `email` (`email`),
UNIQUE KEY `password_reset_token` (`password_reset_token`)
) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `user`
--
LOCK TABLES `user` WRITE;
/*!40000 ALTER TABLE `user` DISABLE KEYS */;
INSERT INTO `user` VALUES (1,'admin123',1,'Admin','Nistrator','LnOv87CVH320bAemt3zrwXL6kPkEMaYk','$2y$13$wH9ETEBeMGim6Wf3rqzD5usLSmGkqkqcnMsPCumIgOZ5GyIPezbs2',NULL,'<EMAIL>','1995-07-11','male','61477888999',NULL,10,1473412170,1473412170,'103, Wickham Terrace',4000,'QLD','Brisbane',0,'',''),(3,'test123',0,'aeffaf','Faffef','X2zXMs4OFJmIbNOP_SvmI1CTJIvZl2JD','$2y$13$KcFOQOVPn3bbFr38qa8.8ONN77KblfQVXHpCC.MJBzOEVixj2yv6G',NULL,'<EMAIL>','2016-09-01','male','525256255522',NULL,10,1473441763,1473441763,'efgsdfgsvserfseg res grsgsdfg sdfg sfdg ',5454,'sfes','sdf gvsdg sreg',0,NULL,NULL),(4,'benNERD',0,'bebebebe','lalalala','3UdeCb0atfDZ3IjgjfrBdaCing9Ot9wI','$2y$13$qAwvY3Mjns.7t0bHDIf4PORsz.FnZAGpv7Do/mfSfedsRJ4hU6IUu',NULL,'<EMAIL>','0000-00-00','other','01212354',NULL,10,1473482211,1473482211,'wefaawefawefawefawe',3432,'erar','swag',0,NULL,NULL),(5,'abcdefg',0,'Tee','TA','BLybGtjxTYHlZ_qcaCuNrMm2pxcm-LKH','$2y$13$96ThALz8QZ./Cl3cpqO1SuPT9FlHxykMbkj4raafOKEbzlA3qhRnu',NULL,'<EMAIL>','0000-00-00','other','55462421342434',NULL,10,1474350139,1474350139,'wefsdvf wfas sfg gg cx',3435,'fase','dfe ef sfs',0,NULL,NULL),(6,'test111',0,'ttt','eee','jtz6fkqs4DSIyRoZj8aW0ahUPeCniR4P','$2y$13$yIuI8zvZiuCyycN07KSgauItWFiDaqenSiXyG/IYQoMERR.RwEYOy',NULL,'<EMAIL>','0000-00-00','other','342426525245',NULL,10,1474381914,1474381914,'awerfa3 4r fagfw3se faef3',4322,'rgdg','wef 3w4r ',0,NULL,NULL),(8,'test1',0,'BBB','CCC','vCRBGUgiao8rlUwGTxuGIhq35XTF3L0h','$2y$13$bE9zPel0ItDDb3gIsOyRt.Skr8EYd1Opluam4N2ntSsdgOdTpGPf.',NULL,'<EMAIL>','2004-12-01','female','23434515','',10,1474405694,1474405694,'awefr3 4t3rfar4r3arfa3wr2',3424,'rege','awefae rfeaw',1,'',''),(9,'test2',0,'CCC','BBB','lyu6_5_1__HbO6DyXhByoCzgmcrbwWZ2','$2y$13$N1VLayfEsEXn0W6Tta8JmuNNAC1NrNW2Srs4KvBc633OjvHWkiJjW',NULL,'<EMAIL>','1908-11-26','female','3453452342',NULL,10,1474409916,1474409916,'3rfserfse rfref s',3424,'awef','wefawef aw',1,NULL,NULL),(10,'test3',0,'xxxxx','yyyyy','Wp4oDagETwPOA0ntchu2ZiyWH8-EN6iA','$2y$13$E6SJnbVKxSiC7Ynj3HKBMu.yKaZMQq3RmhLHlpp.kVq/KCIg95/8O',NULL,'<EMAIL>','1994-07-05','female','342342523',NULL,10,1474410153,1474410153,'awefweafawe fa efsefdzv',3224,'wef ','zzefew fw',1,NULL,NULL),(11,'qqqq',0,'zzz','xxx','3btW4kvjtEtSwH6h050aU0THIPOfgWzg','$2y$13$/hBoOixGJ9NDvNH4Evek9uU3/BnRyBuiLoCPEbJ5LkT0/qfFYLEPa',NULL,'<EMAIL>','2016-09-14','other','2423452454253',NULL,10,1474410335,1474410335,'awefwae fweafsfsefsfgefaf a',2321,'zsdf','awfda efawf',1,NULL,NULL),(12,'testa',0,'qwedfwef','awdaw da','KV8-hrTcBZPfZ2wXNgHzTE23y2mw9JeL','$2y$13$DCnuXFokISa76MfvSmmAh.nTETbSQtJBNTYLX1JsOZyFpy3SCkc3q',NULL,'<EMAIL>','2016-09-14','male','2342535234141',NULL,10,1474410472,1474410472,'awef awefaw',3321,'awef','awef wefa fewaf aw',1,'awefawe fweaf vfsdbdfgbdrtbdxtgb hstgs4e5rg3a 4 tf4aw3','ef 3a4f g4egfvrseg re grg\r\nr grg\r\n s\r\ng s\r\n');
/*!40000 ALTER TABLE `user` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `volunteer`
--
DROP TABLE IF EXISTS `volunteer`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `volunteer` (
`studentID` int(11) NOT NULL,
`courseID` int(11) NOT NULL,
KEY `studentID` (`studentID`),
KEY `courseID` (`courseID`),
CONSTRAINT `volunteer_ibfk_1` FOREIGN KEY (`studentID`) REFERENCES `user` (`id`),
CONSTRAINT `volunteer_ibfk_2` FOREIGN KEY (`courseID`) REFERENCES `course` (`courseID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `volunteer`
--
LOCK TABLES `volunteer` WRITE;
/*!40000 ALTER TABLE `volunteer` DISABLE KEYS */;
/*!40000 ALTER TABLE `volunteer` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2016-09-23 2:15:14
|
DELETE FROM dbo."Rev";
INSERT INTO dbo."Rev" (a, b) VALUES (:a, :b);
|
insert into role (name, description) values ('Root', '');
insert into role (name, description) values ('Admin', '');
insert into role (name, description) values ('Edit', '');
insert into role (name, description) values ('View', '');
insert into role (name, description) values ('Comment', '');
insert into groups (name, description) values ('Root', '');
insert into groups (name, description) values ('Admin', '');
insert into groups (name, description) values ('Editor', '');
insert into groups (name, description) values ('User', '');
insert into group_role (groupID, role_id) values ((select id from groups where name = 'Root'), (select id from role where name = 'Root'));
insert into group_role (groupID, role_id) values ((select id from groups where name = 'Root'), (select id from role where name = 'Admin'));
insert into group_role (groupID, role_id) values ((select id from groups where name = 'Root'), (select id from role where name = 'Edit'));
insert into group_role (groupID, role_id) values ((select id from groups where name = 'Root'), (select id from role where name = 'View'));
insert into group_role (groupID, role_id) values ((select id from groups where name = 'Root'), (select id from role where name = 'Comment'));
insert into group_role (groupID, role_id) values ((select id from groups where name = 'Admin'), (select id from role where name = 'Admin'));
insert into group_role (groupID, role_id) values ((select id from groups where name = 'Admin'), (select id from role where name = 'Edit'));
insert into group_role (groupID, role_id) values ((select id from groups where name = 'Admin'), (select id from role where name = 'View'));
insert into group_role (groupID, role_id) values ((select id from groups where name = 'Admin'), (select id from role where name = 'Comment'));
insert into group_role (groupID, role_id) values ((select id from groups where name = 'Editor'), (select id from role where name = 'Edit'));
insert into group_role (groupID, role_id) values ((select id from groups where name = 'Editor'), (select id from role where name = 'View'));
insert into group_role (groupID, role_id) values ((select id from groups where name = 'Editor'), (select id from role where name = 'Comment'));
insert into group_role (groupID, role_id) values ((select id from groups where name = 'User'), (select id from role where name = 'View'));
insert into group_role (groupID, role_id) values ((select id from groups where name = 'User'), (select id from role where name = 'Comment'));
|
create procedure viw.sUserUpdate
(
@UserId int,
@Email nvarchar(64)
)
as
begin
update viw.tUser
set Email = @Email
where UserId = @UserId;
return 0;
end;
|
SELECT
g.name,
g.run_date,
AVG(g.toxic_index) AS avg_toxic_index,
MAX(g.stddev_toxic_index) AS stddev_toxic_index
FROM (
SELECT
f.name,
f.run_date,
f.run_hour,
f.toxic_index,
stddev(f.toxic_index) OVER (
PARTITION BY f.name, f.run_date
) AS stddev_toxic_index
FROM (
SELECT
subreddits.name,
watermarks.run_start::DATE AS run_date,
EXTRACT(HOUR FROM watermarks.run_start) as run_hour,
count_comments,
count_posts,
score_compound_weighted_mean,
score_compound_mean,
score_compound_mean - score_compound_weighted_mean AS toxic_index
FROM sentiment
LEFT JOIN subreddits ON sentiment.subreddit_id=subreddits.id
LEFT JOIN watermarks ON sentiment.run_id=watermarks.id
) AS f
) as g
GROUP BY g.name, g.run_date
ORDER BY g.run_date DESC;
|
<reponame>PhotoVoltaicMage/AutoFuelAndService
/**
* Author: <NAME>
* Created: May 14, 2020
*/
-- CONNECT TO DATABASE
--CONNECT 'jdbc:derby://localhost:1527/%DERBY_DB_HOME%/FuelEcoService;create=true;user=DMK;password=<PASSWORD>';
AUTOCOMMIT OFF;
--------------------------------------------------------
-- REMOVE SCHEMA IF THEY EXIST
--IF EXISTS VEHICLE_FUEL_TABLE THEN
--DROP TABLE VEHICLE_FUEL_TABLE;
--IF EXISTS VEHICLE_SERVICE THEN
--DROP TABLE VEHICLE_SERVICE;
--IF EXISTS USER_VEHICLE THEN
--DROP TABLE USER_VEHICLE;
--IF EXISTS FUEL_EVENT THEN
DROP TABLE FUEL_EVENT;
--IF EXISTS SERVICE_TABLE THEN
DROP TABLE SERVICE_TABLE;
--IF EXISTS SERVICE_EVENT THEN
DROP TABLE SERVICE_EVENT;
--IF EXISTS VEHICLE_TABLE THEN
DROP TABLE VEHICLE_TABLE;
--IF EXISTS USER_TABLE THEN
DROP TABLE USER_TABLE;
--IF EXISTS NEW_VEHICLE_FUEL_EVENT THEN
DROP TRIGGER NEW_VEHICLE_FUEL_EVENT;
-----------------------------------------------------------
-- TABLE TO HOLD USER ACCOUNT DATA
CREATE TABLE USER_TABLE (
USER_ID VARCHAR(20) NOT NULL,
USER_PASS VARCHAR(20) NOT NULL,
USER_TYPE VARCHAR(10) DEFAULT 'normal',
FIRST_NAME VARCHAR(30),
LAST_NAME VARCHAR(30)
);
ALTER TABLE USER_TABLE
ADD CONSTRAINT USER_ID_PK PRIMARY KEY(USER_ID);
--------------------------------------------------------
-- TABLE TO HOLD VEHICLE SPECIFIC DATA
CREATE TABLE VEHICLE_TABLE (
VIN CHAR(17) UNIQUE NOT NULL,
MODEL_YEAR SMALLINT NOT NULL,
MAKER VARCHAR(20) NOT NULL,
MODEL_NAME VARCHAR(20) NOT NULL,
TRIM_LEVEL VARCHAR(8) DEFAULT 'BASE',
CURRENT_ODO INTEGER NOT NULL,
TIRE_SIZE CHAR(9),
DISPLAY_NAME VARCHAR(50) NOT NULL,
IS_ACTIVE BOOLEAN NOT NULL DEFAULT TRUE,
USER_ID VARCHAR(20) NOT NULL
);
ALTER TABLE VEHICLE_TABLE
ADD CONSTRAINT USER_ID_FK FOREIGN KEY (USER_ID)
REFERENCES USER_TABLE (USER_ID);
ALTER TABLE VEHICLE_TABLE
ADD CONSTRAINT USER_VIN_PK PRIMARY KEY (USER_ID,VIN);
----------------------------------------------------------
-- TABLE TO HOLD RE-FUELING EVENT DATA
CREATE TABLE FUEL_EVENT (
VIN CHAR(17) NOT NULL,
EVENT_TIME TIMESTAMP NOT NULL,
ODOMETER INTEGER NOT NULL,
TOTAL_PRICE REAL NOT NULL,
NUM_GAL REAL NOT NULL,
IS_FULL_TANK BOOLEAN NOT NULL DEFAULT TRUE
);
ALTER TABLE FUEL_EVENT
ADD CONSTRAINT VIN_FUEL_FK FOREIGN KEY (VIN) REFERENCES VEHICLE_TABLE (VIN);
ALTER TABLE FUEL_EVENT
ADD CONSTRAINT EVENT_TIME_PK PRIMARY KEY (VIN, EVENT_TIME);
------------------------------------------------------------
-- TABLE TO HOLD SERVICE EVENT DATA
CREATE TABLE SERVICE_EVENT (
SERV_EVENT_ID INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY,
ODOMETER INTEGER NOT NULL,
SERV_DATE DATE NOT NULL,
SERV_LOCATION VARCHAR(50),
VIN CHAR(17) NOT NULL
);
ALTER TABLE SERVICE_EVENT
ADD CONSTRAINT VIN_SERV_FK FOREIGN KEY (VIN) REFERENCES VEHICLE_TABLE (VIN);
ALTER TABLE SERVICE_EVENT
ADD CONSTRAINT SERV_EVENT_ID_PK PRIMARY KEY (SERV_EVENT_ID);
------------------------------------------------------------
-- TABLE TO HOLD SERVICES PERFORMED IN A SERVICE EVENT
CREATE TABLE SERVICE_TABLE (
SERV_ID INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY,
SERV_DESC VARCHAR(50) NOT NULL,
SERV_COST REAL NOT NULL DEFAULT 0.0,
SERV_EVENT_ID INTEGER NOT NULL
);
ALTER TABLE SERVICE_TABLE
ADD CONSTRAINT SERV_EVENT_ID_FK FOREIGN KEY (SERV_EVENT_ID) REFERENCES SERVICE_EVENT (SERV_EVENT_ID);
ALTER TABLE SERVICE_TABLE
ADD CONSTRAINT SERV_ID_PK PRIMARY KEY (SERV_ID);
-----------------------------------------------------------
-- LINK VEHICLE_TABLE AND FUEL_EVENT
--CREATE TABLE VEHICLE_FUEL_TABLE (
-- VIN CHAR(17) NOT NULL,
-- EVENT_TIME TIMESTAMP NOT NULL
--);
--ALTER TABLE VEHICLE_FUEL_TABLE
-- ADD CONSTRAINT VIN_FK
-- FOREIGN KEY (VIN) REFERENCES VEHICLE_TABLE (VIN);
--ALTER TABLE VEHICLE_FUEL_TABLE
-- ADD CONSTRAINT EVENT_TIME_FK
-- FOREIGN KEY (EVENT_TIME) REFERENCES FUEL_EVENT (EVENT_TIME);
-----------------------------------------------------------
-- LINK SERVICE_TABLE TO VEHICLE_TABLE
--CREATE TABLE VEHICLE_SERVICE (
-- VIN CHAR(17) NOT NULL,
-- SERV_EVENT_ID INTEGER NOT NULL
--);
--ALTER TABLE VEHICLE_SERVICE
-- ADD CONSTRAINT VIN_FK
-- FOREIGN KEY (VIN) REFERENCES VEHICLE_TABLE (VIN);
--ALTER TABLE VEHICLE_SERVICE
-- ADD CONSTRAINT SERV_EVENT_ID_FK
-- FOREIGN KEY (SERV_EVENT_ID) REFERENCES SERVICE_TABLE (SERV_EVENT_ID);
--);
------------------------------------------------------------
-- LINK USER_TABLE TO VEHICLE_TABLE
--CREATE TABLE USER_VEHICLE (
-- USER_ID VARCHAR(20) NOT NULL,
-- VIN CHAR(17) NOT NULL
--);
--ALTER TABLE USER_VEHICLE
-- ADD CONSTRAINT USER_ID_FK
-- FOREIGN KEY (USER_ID) REFERENCES USER_TABLE (USER_ID);
--ALTER TABLE USER_VEHICLE
-- ADD CONSTRAINT VIN_FK
-- FOREIGN KEY (VIN) REFERENCES VEHICLE_TABLE (VIN);
------------------------------------------------------------
-- CREATE DATA MANAGEMENT TRIGGER EVENTS
-- WHEN ADDING A NEW FUEL_EVENT
-- CHECK TO MAKE SURE THAT THE FIELD VEHICLE_TABLE.CURRENT_ODO HAS THE CORRECT
-- VALUE (IE. THE HIGHEST MILEAGE FROM THE FUEL_EVENT TABLE FOR THAT VEHICLE)
CREATE TRIGGER NEW_VEHICLE_FUEL_EVENT AFTER INSERT ON FUEL_EVENT
REFERENCING NEW AS N
FOR EACH ROW MODE DB2SQL
WHEN (N.ODOMETER > (SELECT CURRENT_ODO FROM VEHICLE_TABLE WHERE (VIN = N.VIN)))
UPDATE VEHICLE_TABLE SET CURRENT_ODO = N.ODOMETER WHERE (VIN = N.VIN);
------------------------------------------------------------
COMMIT;
AUTOCOMMIT ON;
|
<gh_stars>0
INSERT INTO kirushizm (id, txt, created, accepted, creator)
VALUES (1, 'В петушиную баню не пойду, лучше в бан.', '2019-02-12 21:23:25.671000', true, 'Александр Шахов');
INSERT INTO kirushizm (id, txt, created, accepted, creator)
VALUES (2, 'Я в чужие пиздецы не лезу, мне своих хватает.', '2019-02-12 21:40:03.910000', true, 'Александр Шахов');
INSERT INTO kirushizm (id, txt, created, accepted, creator)
VALUES (3, 'У меня нет для тебя тёплых слов.', '2019-02-12 21:40:15.573000', true, 'Александр Шахов');
INSERT INTO kirushizm (id, txt, created, accepted, creator)
VALUES (4, 'Я не обязан это выслушивать.', '2019-02-12 21:40:25.866000', true, 'Александр Шахов');
INSERT INTO kirushizm (id, txt, created, accepted, creator)
VALUES (6, 'Ява - говно.', '2019-02-12 21:42:17.291000', true, 'Александр Шахов');
INSERT INTO kirushizm (id, txt, created, accepted, creator)
VALUES (7, 'I''m T.N.T. I''m dynamite', '2019-02-13 08:45:25.291000', true, 'Александр Шахов');
INSERT INTO kirushizm (id, txt, created, accepted, creator)
VALUES (8, 'Всё пиздец, Госдума приняла в первом чтении законопроект об изоляции российского сегмента интернета', '2019-02-13 08:50:17.624000', true, 'Александр Шахов');
INSERT INTO kirushizm (id, txt, created, accepted, creator)
VALUES (9, 'Всё пиздец, Матвиенко попросила Медведева полностью остановить экспорт леса', '2019-02-13 08:51:52.094000', true, 'Александр Шахов');
INSERT INTO kirushizm (id, txt, created, accepted, creator)
VALUES (11, 'Может хватит тут хрустеть уже?', '2019-02-14 16:55:42.447000', true, 'Александр Шахов');
INSERT INTO kirushizm (id, txt, created, accepted, creator)
VALUES (12, 'Т<NAME>уф - полное дерьмо.', '2019-02-14 17:03:02.232000', true, 'Александр Шахов');
INSERT INTO kirushizm (id, txt, created, accepted, creator)
VALUES (13, 'Всё пиздец, Росавтодор покроет российские дороги "суперасфальтом"', '2019-02-14 17:04:09.568000', true, 'Александр Шахов');
INSERT INTO kirushizm (id, txt, created, accepted, creator)
VALUES (17, 'Кловер навсегда! ♥️♥️♥️♥️♥️', '2019-02-15 08:02:05.441000', true, 'Александр Шахов');
INSERT INTO kirushizm (id, txt, created, accepted, creator)
VALUES (18, 'Всё пиздец, <NAME> вышел на татами в Сочи.', '2019-02-15 08:05:24.167000', true, 'Александр Шахов');
INSERT INTO kirushizm (id, txt, created, accepted, creator)
VALUES (19, 'Кловер - полное дерьмо.', '2019-02-15 08:07:42.532000', true, 'Александр Шахов');
INSERT INTO kirushizm (id, txt, created, accepted, creator)
VALUES (20, 'Расскажи хоть, как тебе хуёво.', '2019-02-15 14:05:32.501000', true, 'Александр Шахов');
INSERT INTO kirushizm (id, txt, created, accepted, creator)
VALUES (21, 'Побыстрее бы на кловер перейти.', '2019-02-15 14:05:40.483000', true, 'Александр Шахов');
INSERT INTO kirushizm (id, txt, created, accepted, creator)
VALUES (53, 'Я не знаю, что сказать, кроме того, что оракл мудаки.', '2019-02-26 15:01:41.822000', true, 'Александр Шахов');
INSERT INTO kirushizm (id, txt, created, accepted, creator)
VALUES (58, 'Anata ga dore dake warui no ka o oshietekudasai', '2019-04-29 21:26:10.971000', true, '<NAME>');
INSERT INTO kirushizm (id, txt, created, accepted, creator)
VALUES (60, 'Мне похуй на твоё мнение', '2019-05-07 14:20:49.547000', true, 'А<NAME>');
INSERT INTO kirushizm (id, txt, created, accepted, creator)
VALUES (61, 'Араб с мечом зарезал немца из казахстана', '2019-08-02 07:42:08.786000', true, 'А<NAME>');
|
<filename>Queries/Employee_Database_Challenge.sql<gh_stars>0
--Deliverable 1, Retiring Employees by Title--
--D1, retirement titles
SELECT
e.emp_no,
e.first_name,
e.last_name,
t.title,
t.from_date,
t.to_date
INTO retirement_titles
FROM employees AS e
INNER JOIN titles AS t
ON (e.emp_no = t.emp_no)
WHERE e.birth_date BETWEEN '1952-01-01' AND '1955-12-31'
ORDER BY e,emp_no;
--D1, remove dupes
SELECT DISTINCT ON (emp_no) emp_no,
first_name,
last_name,
title
INTO unique_titles
FROM retirement_titles
WHERE to_date = '9999-01-01'
ORDER BY emp_no ASC, to_date DESC;
--D1, employees by title about to retire
SELECT COUNT(title), title
INTO retiring_titles
FROM unique_titles
GROUP BY title
ORDER BY COUNT(title) DESC;
--Deliverable 2, Emps eligible for Mentorship Program
SELECT DISTINCT ON (e.emp_no) e.emp_no,
e.first_name,
e.last_name,
e.birth_date,
de.from_date,
de.to_date,
t.title
INTO mentorship_eligibility
FROM employees AS e
INNER JOIN dept_emp AS de
ON (e.emp_no = de.emp_no)
INNER JOIN titles AS t
ON (e.emp_no = t.emp_no)
WHERE
de.to_date = '9999-01-01'AND
e.birth_date BETWEEN '1965-01-01' AND '1965-12-31'
ORDER BY e.emp_no;
--D3, two additional tables
--mentorship eligible by title--
SELECT COUNT(title), title
FROM mentorship_eligibility
GROUP BY title
ORDER BY COUNT(title) DESC;
--compare current mentorship elegibility vs outgoing by dept
--refactor previous mentorship_elegibility table to include dept_name
SELECT DISTINCT ON (e.emp_no) e.emp_no,
e.first_name,
e.last_name,
e.birth_date,
de.from_date,
de.to_date,
t.title,
d.dept_name
INTO mentorship_eligibility_with_dept
FROM employees AS e
INNER JOIN dept_emp AS de
ON (e.emp_no = de.emp_no)
INNER JOIN titles AS t
ON (e.emp_no = t.emp_no)
INNER JOIN departments AS d
ON (d.dept_no = de.dept_no)
WHERE
de.to_date = '9999-01-01'AND
e.birth_date BETWEEN '1965-01-01' AND '1965-12-31'
ORDER BY e.emp_no;
--find count of available mentors per dept
SELECT COUNT(title) AS "potential_mentors",
dept_name
INTO available_mentors
FROM mentorship_eligibility_with_dept
GROUP BY dept_name
ORDER BY COUNT(title) DESC;
--join available mentors with retiring employees per dept
SELECT COUNT(title) AS "potential_mentors",
dept_name
INTO available_mentors
FROM mentorship_eligibility_with_dept
GROUP BY dept_name
ORDER BY COUNT(title) DESC;
|
<filename>KInspector.Modules/Scripts/UnusedTemplatesModule.sql<gh_stars>0
SELECT PageTemplateDisplayName,PageTemplateCodeName, PageTemplateType, PageTemplateDescription
FROM CMS_PageTemplate
WHERE PageTemplateID not in (SELECT DISTINCT NodeTemplateID FROM View_CMS_Tree_Joined WHERE NodeTemplateID is not NULL)
AND PageTemplateType not in ('dashboard','ui')
ORDER BY PageTemplateDisplayName
|
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600744',@CutoffDate = N'2017-09-30',@EPS = N'-0.33',@EPSDeduct = N'0',@Revenue = N'55.79亿',@RevenueYoy = N'38.96',@RevenueQoq = N'66.48',@Profit = N'-5.87亿',@ProfitYoy = N'-12682.23',@ProfiltQoq = N'53.02',@NAVPerUnit = N'1.9961',@ROE = N'-15.26',@CashPerUnit = N'0.2703',@GrossProfitRate = N'0.02',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2017-10-28'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600744',@CutoffDate = N'2017-09-30',@EPS = N'-0.33',@EPSDeduct = N'0',@Revenue = N'55.79亿',@RevenueYoy = N'38.96',@RevenueQoq = N'66.48',@Profit = N'-5.87亿',@ProfitYoy = N'-12682.23',@ProfiltQoq = N'53.02',@NAVPerUnit = N'1.9961',@ROE = N'-15.26',@CashPerUnit = N'0.2703',@GrossProfitRate = N'0.02',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2017-10-28'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600744',@CutoffDate = N'2017-06-30',@EPS = N'-0.257',@EPSDeduct = N'-0.263',@Revenue = N'33.01亿',@RevenueYoy = N'54.10',@RevenueQoq = N'-29.22',@Profit = N'-4.58亿',@ProfitYoy = N'-79.07',@ProfiltQoq = N'-51.79',@NAVPerUnit = N'2.0689',@ROE = N'-11.69',@CashPerUnit = N'0.2064',@GrossProfitRate = N'-1.69',@Distribution = N'不分配不转增',@DividenRate = N'-',@AnnounceDate = N'2017-08-19'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600744',@CutoffDate = N'2017-03-31',@EPS = N'-0.1',@EPSDeduct = N'0',@Revenue = N'19.33亿',@RevenueYoy = N'37.54',@RevenueQoq = N'-19.14',@Profit = N'-1.82亿',@ProfitYoy = N'-997.48',@ProfiltQoq = N'-194.36',@NAVPerUnit = N'2.2238',@ROE = N'-4.56',@CashPerUnit = N'0.1574',@GrossProfitRate = N'-0.50',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2017-04-28'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600744',@CutoffDate = N'2016-09-30',@EPS = N'-0.0026',@EPSDeduct = N'0',@Revenue = N'40.15亿',@RevenueYoy = N'-26.37',@RevenueQoq = N'154.14',@Profit = N'-459.44万',@ProfitYoy = N'-101.37',@ProfiltQoq = N'190.99',@NAVPerUnit = N'2.2177',@ROE = N'-0.12',@CashPerUnit = N'0.9289',@GrossProfitRate = N'10.33',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2017-10-28'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600744',@CutoffDate = N'2016-12-31',@EPS = N'0.11',@EPSDeduct = N'0.003',@Revenue = N'64.05亿',@RevenueYoy = N'-13.52',@RevenueQoq = N'27.67',@Profit = N'1.88亿',@ProfitYoy = N'-50.66',@ProfiltQoq = N'-23.25',@NAVPerUnit = N'2.3259',@ROE = N'4.64',@CashPerUnit = N'0.8932',@GrossProfitRate = N'12.39',@Distribution = N'不分配不转增',@DividenRate = N'-',@AnnounceDate = N'2017-03-24'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600744',@CutoffDate = N'2015-12-31',@EPS = N'0.23',@EPSDeduct = N'-0.09',@Revenue = N'74.06亿',@RevenueYoy = N'-7.95',@RevenueQoq = N'30.65',@Profit = N'3.81亿',@ProfitYoy = N'331.54',@ProfiltQoq = N'-7.19',@NAVPerUnit = N'2.2203',@ROE = N'13.50',@CashPerUnit = N'1.9732',@GrossProfitRate = N'20.45',@Distribution = N'不分配不转增',@DividenRate = N'-',@AnnounceDate = N'2017-03-24'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600744',@CutoffDate = N'2015-09-30',@EPS = N'0.21',@EPSDeduct = N'0',@Revenue = N'54.52亿',@RevenueYoy = N'4.48',@RevenueQoq = N'11.34',@Profit = N'3.36亿',@ProfitYoy = N'458.42',@ProfiltQoq = N'151.77',@NAVPerUnit = N'2.1571',@ROE = N'13.46',@CashPerUnit = N'1.1568',@GrossProfitRate = N'19.13',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2016-10-29'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600744',@CutoffDate = N'2015-06-30',@EPS = N'0.12',@EPSDeduct = N'0.1',@Revenue = N'38.80亿',@RevenueYoy = N'4.15',@RevenueQoq = N'-19.76',@Profit = N'2.02亿',@ProfitYoy = N'111.99',@ProfiltQoq = N'-180.06',@NAVPerUnit = N'1.8268',@ROE = N'8.36',@CashPerUnit = N'3.3137',@GrossProfitRate = N'20.35',@Distribution = N'不分配不转增',@DividenRate = N'-',@AnnounceDate = N'2016-08-30'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600744',@CutoffDate = N'2015-03-31',@EPS = N'0.22',@EPSDeduct = N'0',@Revenue = N'24.63亿',@RevenueYoy = N'10.86',@RevenueQoq = N'-18.09',@Profit = N'3.61亿',@ProfitYoy = N'636.90',@ProfiltQoq = N'208.18',@NAVPerUnit = N'1.9578',@ROE = N'14.44',@CashPerUnit = N'2.5719',@GrossProfitRate = N'25.89',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2016-04-29'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600744',@CutoffDate = N'2014-12-31',@EPS = N'0.05',@EPSDeduct = N'-0.13',@Revenue = N'80.46亿',@RevenueYoy = N'-16.70',@RevenueQoq = N'61.08',@Profit = N'8831.46万',@ProfitYoy = N'-1732.97',@ProfiltQoq = N'300.94',@NAVPerUnit = N'3.2596',@ROE = N'4.03',@CashPerUnit = N'3.7723',@GrossProfitRate = N'17.81',@Distribution = N'不分配不转增',@DividenRate = N'-',@AnnounceDate = N'2016-03-30'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600744',@CutoffDate = N'2016-06-30',@EPS = N'-0.14',@EPSDeduct = N'-0.17',@Revenue = N'21.42亿',@RevenueYoy = N'-44.79',@RevenueQoq = N'-47.58',@Profit = N'-2.56亿',@ProfitYoy = N'-226.29',@ProfiltQoq = N'-1461.97',@NAVPerUnit = N'2.0768',@ROE = N'-6.68',@CashPerUnit = N'0.6372',@GrossProfitRate = N'3.03',@Distribution = N'不分配不转增',@DividenRate = N'-',@AnnounceDate = N'2017-08-19'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600744',@CutoffDate = N'2014-06-30',@EPS = N'-0.2721',@EPSDeduct = N'-0.281',@Revenue = N'28.97亿',@RevenueYoy = N'-4.41',@RevenueQoq = N'-8.13',@Profit = N'-1.94亿',@ProfitYoy = N'8.52',@ProfiltQoq = N'-692.75',@NAVPerUnit = N'1.7972',@ROE = N'-14.19',@CashPerUnit = N'1.9117',@GrossProfitRate = N'6.90',@Distribution = N'不分配不转增',@DividenRate = N'-',@AnnounceDate = N'2015-08-27'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600744',@CutoffDate = N'2014-09-30',@EPS = N'-0.06',@EPSDeduct = N'0',@Revenue = N'52.19亿',@RevenueYoy = N'-19.21',@RevenueQoq = N'-8.53',@Profit = N'-9382.91万',@ProfitYoy = N'-96.07',@ProfiltQoq = N'89.06',@NAVPerUnit = N'1.7989',@ROE = N'-6.68',@CashPerUnit = N'3.5561',@GrossProfitRate = N'12.19',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2015-10-30'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600744',@CutoffDate = N'2014-03-31',@EPS = N'-0.0305',@EPSDeduct = N'0',@Revenue = N'15.10亿',@RevenueYoy = N'-17.48',@RevenueQoq = N'-34.30',@Profit = N'-2169.26万',@ProfitYoy = N'65.08',@ProfiltQoq = N'-118.22',@NAVPerUnit = N'2.0389',@ROE = N'-1.51',@CashPerUnit = N'0.7329',@GrossProfitRate = N'11.57',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2015-04-29'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600744',@CutoffDate = N'2013-12-31',@EPS = N'0.02',@EPSDeduct = N'-0.13',@Revenue = N'74.56亿',@RevenueYoy = N'-7.99',@RevenueQoq = N'8.13',@Profit = N'1069.68万',@ProfitYoy = N'-89.15',@ProfiltQoq = N'15.22',@NAVPerUnit = N'2.0391',@ROE = N'0.74',@CashPerUnit = N'2.0109',@GrossProfitRate = N'10.93',@Distribution = N'不分配不转增',@DividenRate = N'-',@AnnounceDate = N'2015-03-14'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600744',@CutoffDate = N'2013-06-30',@EPS = N'-0.2975',@EPSDeduct = N'-0.3035',@Revenue = N'30.31亿',@RevenueYoy = N'-25.86',@RevenueQoq = N'-34.38',@Profit = N'-2.12亿',@ProfitYoy = N'32.46',@ProfiltQoq = N'-140.77',@NAVPerUnit = N'1.6317',@ROE = N'-16.71',@CashPerUnit = N'0.8914',@GrossProfitRate = N'4.93',@Distribution = N'不分配不转增',@DividenRate = N'-',@AnnounceDate = N'2014-08-22'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600744',@CutoffDate = N'2016-03-31',@EPS = N'0.01',@EPSDeduct = N'0',@Revenue = N'14.05亿',@RevenueYoy = N'-42.94',@RevenueQoq = N'-28.08',@Profit = N'2025.22万',@ProfitYoy = N'-94.39',@ProfiltQoq = N'-54.80',@NAVPerUnit = N'2.2317',@ROE = N'0.52',@CashPerUnit = N'0.3826',@GrossProfitRate = N'14.65',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2017-04-28'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600744',@CutoffDate = N'2012-12-31',@EPS = N'0.14',@EPSDeduct = N'-0.59',@Revenue = N'81.03亿',@RevenueYoy = N'-17.71',@RevenueQoq = N'60.08',@Profit = N'9859.84万',@ProfitYoy = N'135.58',@ProfiltQoq = N'414.76',@NAVPerUnit = N'2.0241',@ROE = N'6.75',@CashPerUnit = N'1.7847',@GrossProfitRate = N'11.06',@Distribution = N'不分配不转增',@DividenRate = N'-',@AnnounceDate = N'2014-03-27'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600744',@CutoffDate = N'2013-09-30',@EPS = N'-0.1523',@EPSDeduct = N'0',@Revenue = N'51.57亿',@RevenueYoy = N'-8.38',@RevenueQoq = N'77.02',@Profit = N'-1.08亿',@ProfitYoy = N'77.96',@ProfiltQoq = N'169.08',@NAVPerUnit = N'1.7769',@ROE = N'-8.22',@CashPerUnit = N'0.9998',@GrossProfitRate = N'9.11',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2014-10-29'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600744',@CutoffDate = N'2013-03-31',@EPS = N'-0.0873',@EPSDeduct = N'-0.0882',@Revenue = N'18.30亿',@RevenueYoy = N'-23.31',@RevenueQoq = N'-25.80',@Profit = N'-6212.08万',@ProfitYoy = N'34.55',@ProfiltQoq = N'-111.07',@NAVPerUnit = N'1.8419',@ROE = N'-4.63',@CashPerUnit = N'0.4445',@GrossProfitRate = N'7.30',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2014-04-26'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600744',@CutoffDate = N'2012-03-31',@EPS = N'-0.1334',@EPSDeduct = N'-0.1335',@Revenue = N'23.86亿',@RevenueYoy = N'31.13',@RevenueQoq = N'-30.94',@Profit = N'-9491.43万',@ProfitYoy = N'51.43',@ProfiltQoq = N'-123.99',@NAVPerUnit = N'1.7470',@ROE = N'-7.37',@CashPerUnit = N'0.9962',@GrossProfitRate = N'4.81',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2013-04-25'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600744',@CutoffDate = N'2012-06-30',@EPS = N'-0.4404',@EPSDeduct = N'-0.4429',@Revenue = N'40.88亿',@RevenueYoy = N'3.61',@RevenueQoq = N'-28.70',@Profit = N'-3.13亿',@ProfitYoy = N'11.97',@ProfiltQoq = N'-130.23',@NAVPerUnit = N'1.4450',@ROE = N'-26.55',@CashPerUnit = N'0.8996',@GrossProfitRate = N'2.34',@Distribution = N'不分配不转增',@DividenRate = N'-',@AnnounceDate = N'2013-08-15'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600744',@CutoffDate = N'2011-09-30',@EPS = N'-0.8304',@EPSDeduct = N'-0.7978',@Revenue = N'63.81亿',@RevenueYoy = N'24.71',@RevenueQoq = N'14.58',@Profit = N'-5.91亿',@ProfitYoy = N'-14.93',@ProfiltQoq = N'-46.22',@NAVPerUnit = N'1.3118',@ROE = N'-48.00',@CashPerUnit = N'0.6172',@GrossProfitRate = N'0.30',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2012-10-26'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600744',@CutoffDate = N'2011-12-31',@EPS = N'-0.27',@EPSDeduct = N'-0.95',@Revenue = N'98.37亿',@RevenueYoy = N'30.62',@RevenueQoq = N'41.88',@Profit = N'-1.95亿',@ProfitYoy = N'-1052.42',@ProfiltQoq = N'268.43',@NAVPerUnit = N'1.8726',@ROE = N'-12.40',@CashPerUnit = N'1.2632',@GrossProfitRate = N'5.07',@Distribution = N'不分配不转增',@DividenRate = N'-',@AnnounceDate = N'2013-03-29'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600744',@CutoffDate = N'2011-03-31',@EPS = N'-0.2746',@EPSDeduct = N'-0.2763',@Revenue = N'18.20亿',@RevenueYoy = N'-8.29',@RevenueQoq = N'-24.61',@Profit = N'-1.95亿',@ProfitYoy = N'-804.18',@ProfiltQoq = N'-136.55',@NAVPerUnit = N'1.8756',@ROE = N'-13.65',@CashPerUnit = N'0.1926',@GrossProfitRate = N'-0.51',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2012-04-26'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600744',@CutoffDate = N'2011-06-30',@EPS = N'-0.5003',@EPSDeduct = N'-0.5073',@Revenue = N'39.46亿',@RevenueYoy = N'18.59',@RevenueQoq = N'16.81',@Profit = N'-3.56亿',@ProfitYoy = N'-5.13',@ProfiltQoq = N'17.80',@NAVPerUnit = N'1.6428',@ROE = N'-26.36',@CashPerUnit = N'0.2330',@GrossProfitRate = N'0.31',@Distribution = N'不分配不转增',@DividenRate = N'-',@AnnounceDate = N'2012-08-11'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600744',@CutoffDate = N'2010-12-31',@EPS = N'0.03',@EPSDeduct = N'-0.91',@Revenue = N'75.31亿',@RevenueYoy = N'35.70',@RevenueQoq = N'34.86',@Profit = N'2050.73万',@ProfitYoy = N'-61.99',@ProfiltQoq = N'404.64',@NAVPerUnit = N'2.1481',@ROE = N'1.16',@CashPerUnit = N'1.1070',@GrossProfitRate = N'5.00',@Distribution = N'不分配不转增',@DividenRate = N'-',@AnnounceDate = N'2012-04-26'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600744',@CutoffDate = N'2010-06-30',@EPS = N'-0.4759',@EPSDeduct = N'-0.4934',@Revenue = N'33.27亿',@RevenueYoy = N'195.17',@RevenueQoq = N'-32.33',@Profit = N'-3.39亿',@ProfitYoy = N'12.03',@ProfiltQoq = N'-1367.06',@NAVPerUnit = N'2.0975',@ROE = N'-18.65',@CashPerUnit = N'0.3445',@GrossProfitRate = N'1.11',@Distribution = N'不分配不转增',@DividenRate = N'-',@AnnounceDate = N'2011-08-25'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600744',@CutoffDate = N'2010-03-31',@EPS = N'-0.0304',@EPSDeduct = N'-0.0315',@Revenue = N'19.84亿',@RevenueYoy = N'171.49',@RevenueQoq = N'-36.70',@Profit = N'-2161.30万',@ProfitYoy = N'85.75',@ProfiltQoq = N'-104.31',@NAVPerUnit = N'2.8789',@ROE = N'-1.03',@CashPerUnit = N'0.2071',@GrossProfitRate = N'8.14',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2011-04-25'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600744',@CutoffDate = N'2009-12-31',@EPS = N'0.0758',@EPSDeduct = N'-0.2677',@Revenue = N'55.49亿',@RevenueYoy = N'71.54',@RevenueQoq = N'143.53',@Profit = N'5395.91万',@ProfitYoy = N'105.08',@ProfiltQoq = N'897.15',@NAVPerUnit = N'3.0073',@ROE = N'2.80',@CashPerUnit = N'0.7894',@GrossProfitRate = N'7.61',@Distribution = N'不分配不转增',@DividenRate = N'-',@AnnounceDate = N'2011-04-25'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600744',@CutoffDate = N'2009-09-30',@EPS = N'-0.6295',@EPSDeduct = N'-0.6331',@Revenue = N'24.14亿',@RevenueYoy = N'7.95',@RevenueQoq = N'224.85',@Profit = N'-4.48亿',@ProfitYoy = N'28.35',@ProfiltQoq = N'73.01',@NAVPerUnit = N'1.9983',@ROE = N'-',@CashPerUnit = N'0.9467',@GrossProfitRate = N'-0.43',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2010-10-25'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600744',@CutoffDate = N'2009-06-30',@EPS = N'-0.541',@EPSDeduct = N'-0.5414',@Revenue = N'11.27亿',@RevenueYoy = N'-27.22',@RevenueQoq = N'-45.78',@Profit = N'-3.85亿',@ProfitYoy = N'-2.63',@ProfiltQoq = N'-53.77',@NAVPerUnit = N'2.2350',@ROE = N'-23.25',@CashPerUnit = N'0.2346',@GrossProfitRate = N'-7.89',@Distribution = N'不分配不转增',@DividenRate = N'-',@AnnounceDate = N'2010-08-23'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600744',@CutoffDate = N'2009-03-31',@EPS = N'-0.2132',@EPSDeduct = N'-0.2166',@Revenue = N'7.31亿',@RevenueYoy = N'-22.12',@RevenueQoq = N'-26.81',@Profit = N'-1.52亿',@ProfitYoy = N'-29.99',@ProfiltQoq = N'72.72',@NAVPerUnit = N'2.4617',@ROE = N'-',@CashPerUnit = N'0.2029',@GrossProfitRate = N'-1.85',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2010-04-23'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600744',@CutoffDate = N'2008-12-31',@EPS = N'-1.4926',@EPSDeduct = N'-1.2834',@Revenue = N'32.35亿',@RevenueYoy = N'-10.97',@RevenueQoq = N'45.16',@Profit = N'-10.62亿',@ProfitYoy = N'-2497.55',@ProfiltQoq = N'-122.38',@NAVPerUnit = N'2.4188',@ROE = N'-40.69',@CashPerUnit = N'2.4020',@GrossProfitRate = N'-7.38',@Distribution = N'不分配不转增',@DividenRate = N'-',@AnnounceDate = N'2010-04-23'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600744',@CutoffDate = N'2008-09-30',@EPS = N'-0.8786',@EPSDeduct = N'-0.8748',@Revenue = N'22.37亿',@RevenueYoy = N'-5.61',@RevenueQoq = N'12.73',@Profit = N'-6.25亿',@ProfitYoy = N'-320.49',@ProfiltQoq = N'3.22',@NAVPerUnit = N'3.8012',@ROE = N'-',@CashPerUnit = N'1.1338',@GrossProfitRate = N'-6.50',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2009-10-23'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600744',@CutoffDate = N'2012-09-30',@EPS = N'-0.691',@EPSDeduct = N'-0.6934',@Revenue = N'56.29亿',@RevenueYoy = N'-11.79',@RevenueQoq = N'-9.45',@Profit = N'-4.92亿',@ProfitYoy = N'16.79',@ProfiltQoq = N'18.40',@NAVPerUnit = N'1.1895',@ROE = N'-45.13',@CashPerUnit = N'0.5108',@GrossProfitRate = N'2.34',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2013-10-30'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600744',@CutoffDate = N'2010-09-30',@EPS = N'-0.7226',@EPSDeduct = N'-0.746',@Revenue = N'51.17亿',@RevenueYoy = N'111.93',@RevenueQoq = N'33.30',@Profit = N'-5.14亿',@ProfitYoy = N'-14.79',@ProfiltQoq = N'44.64',@NAVPerUnit = N'1.8483',@ROE = N'-29.76',@CashPerUnit = N'1.0091',@GrossProfitRate = N'0.36',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2011-10-26'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600744',@CutoffDate = N'2008-06-30',@EPS = N'-0.5271',@EPSDeduct = N'-0.5217',@Revenue = N'15.49亿',@RevenueYoy = N'-1.37',@RevenueQoq = N'-34.97',@Profit = N'-3.75亿',@ProfitYoy = N'-362.43',@ProfiltQoq = N'-121.42',@NAVPerUnit = N'4.2832',@ROE = N'-11.44',@CashPerUnit = N'0.6004',@GrossProfitRate = N'-3.96',@Distribution = N'不分配不转增',@DividenRate = N'-',@AnnounceDate = N'2009-08-20'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600744',@CutoffDate = N'2007-12-31',@EPS = N'0.0692',@EPSDeduct = N'0.0083',@Revenue = N'36.34亿',@RevenueYoy = N'23.92',@RevenueQoq = N'58.17',@Profit = N'4927.56万',@ProfitYoy = N'-91.83',@ProfiltQoq = N'341.95',@NAVPerUnit = N'4.9306',@ROE = N'0.49',@CashPerUnit = N'1.2240',@GrossProfitRate = N'15.23',@Distribution = N'不分配不转增',@DividenRate = N'-',@AnnounceDate = N'2009-04-23'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600744',@CutoffDate = N'2007-09-30',@EPS = N'-0.2089',@EPSDeduct = N'-0.207',@Revenue = N'23.70亿',@RevenueYoy = N'31.72',@RevenueQoq = N'16.18',@Profit = N'-1.49亿',@ProfitYoy = N'-71.01',@ProfiltQoq = N'40.21',@NAVPerUnit = N'4.6994',@ROE = N'-',@CashPerUnit = N'0.6726',@GrossProfitRate = N'8.63',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2008-10-23'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600744',@CutoffDate = N'2008-03-31',@EPS = N'-0.164',@EPSDeduct = N'-0.1615',@Revenue = N'9.38亿',@RevenueYoy = N'6.37',@RevenueQoq = N'-25.77',@Profit = N'-1.17亿',@ProfitYoy = N'-465.94',@ProfiltQoq = N'-171.39',@NAVPerUnit = N'4.1990',@ROE = N'-',@CashPerUnit = N'0.2811',@GrossProfitRate = N'3.93',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2009-04-23'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600744',@CutoffDate = N'2007-06-30',@EPS = N'-0.114',@EPSDeduct = N'-0.1148',@Revenue = N'15.70亿',@RevenueYoy = N'42.56',@RevenueQoq = N'-22.01',@Profit = N'-8112.11万',@ProfitYoy = N'-46.37',@ProfiltQoq = N'-454.35',@NAVPerUnit = N'3.6076',@ROE = N'-3.01',@CashPerUnit = N'0.6020',@GrossProfitRate = N'9.09',@Distribution = N'不分配不转增',@DividenRate = N'-',@AnnounceDate = N'2008-08-22'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600744',@CutoffDate = N'2006-09-30',@EPS = N'-0.1222',@EPSDeduct = N'0',@Revenue = N'17.99亿',@RevenueYoy = N'1.71',@RevenueQoq = N'45.62',@Profit = N'-8694.95万',@ProfitYoy = N'61.14',@ProfiltQoq = N'59.36',@NAVPerUnit = N'3.5270',@ROE = N'-',@CashPerUnit = N'0.7207',@GrossProfitRate = N'2.27',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2007-10-24'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600744',@CutoffDate = N'2007-03-31',@EPS = N'0.0465',@EPSDeduct = N'0',@Revenue = N'8.82亿',@RevenueYoy = N'41.73',@RevenueQoq = N'-22.17',@Profit = N'3189.33万',@ProfitYoy = N'43.95',@ProfiltQoq = N'-88.11',@NAVPerUnit = N'3.8864',@ROE = N'-',@CashPerUnit = N'0.3698',@GrossProfitRate = N'16.33',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2008-04-25'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600744',@CutoffDate = N'2006-06-30',@EPS = N'-0.0779',@EPSDeduct = N'0',@Revenue = N'11.01亿',@RevenueYoy = N'12.45',@RevenueQoq = N'-23.05',@Profit = N'-5542.31万',@ProfitYoy = N'78.21',@ProfiltQoq = N'-450.15',@NAVPerUnit = N'3.5845',@ROE = N'-2.15',@CashPerUnit = N'0.4110',@GrossProfitRate = N'2.84',@Distribution = N'不分配不转增',@DividenRate = N'-',@AnnounceDate = N'2007-08-31'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600744',@CutoffDate = N'2006-03-31',@EPS = N'0.0283',@EPSDeduct = N'0',@Revenue = N'6.22亿',@RevenueYoy = N'-5.16',@RevenueQoq = N'-28.15',@Profit = N'2215.62万',@ProfitYoy = N'139.69',@ProfiltQoq = N'-44.53',@NAVPerUnit = N'3.6935',@ROE = N'-',@CashPerUnit = N'0.2201',@GrossProfitRate = N'12.31',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2007-04-28'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600744',@CutoffDate = N'2006-12-31',@EPS = N'0.2546',@EPSDeduct = N'0.1317',@Revenue = N'29.32亿',@RevenueYoy = N'11.29',@RevenueQoq = N'62.52',@Profit = N'1.81亿',@ProfitYoy = N'197.48',@ProfiltQoq = N'950.49',@NAVPerUnit = N'3.7665',@ROE = N'4.02',@CashPerUnit = N'0.8681',@GrossProfitRate = N'14.29',@Distribution = N'10派1.2',@DividenRate = N'1.69',@AnnounceDate = N'2008-04-25'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600744',@CutoffDate = N'2005-12-31',@EPS = N'-0.2583',@EPSDeduct = N'0',@Revenue = N'26.35亿',@RevenueYoy = N'22.86',@RevenueQoq = N'9.78',@Profit = N'-1.86亿',@ProfitYoy = N'-2266.31',@ProfiltQoq = N'30.30',@NAVPerUnit = N'3.6624',@ROE = N'-6.74',@CashPerUnit = N'-0.2521',@GrossProfitRate = N'6.35',@Distribution = N'不分配不转增',@DividenRate = N'-',@AnnounceDate = N'2007-04-28'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600744',@CutoffDate = N'2005-06-30',@EPS = N'-0.3575',@EPSDeduct = N'0',@Revenue = N'9.79亿',@RevenueYoy = N'1.30',@RevenueQoq = N'-50.76',@Profit = N'-2.54亿',@ProfitYoy = N'-756.06',@ProfiltQoq = N'-255.68',@NAVPerUnit = N'3.6380',@ROE = N'-9.37',@CashPerUnit = N'-0.5947',@GrossProfitRate = N'-15.68',@Distribution = N'不分配不转增',@DividenRate = N'-',@AnnounceDate = N'2006-08-25'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'600744',@CutoffDate = N'2005-09-30',@EPS = N'0',@EPSDeduct = N'0',@Revenue = N'17.69亿',@RevenueYoy = N'17.94',@RevenueQoq = N'144.18',@Profit = N'-2.24亿',@ProfitYoy = N'-472.88',@ProfiltQoq = N'115.44',@NAVPerUnit = N'3.7110',@ROE = N'-',@CashPerUnit = N'-0.4476',@GrossProfitRate = N'-3.77',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2006-10-27'
|
-- Query the total population of all cities in CITY where District is California.
-- Input Format
-- The CITY table is described as follows:
/*
Enter your query here.
Please append a semicolon ";" at the end of the query and enter your query in a single line to avoid error.
*/
SELECT SUM(POPULATION) FROM CITY WHERE DISTRICT = 'California'
|
<filename>chapter02/druid-demo/src/main/resources/schema.sql
create table foo(id int identity, bar varchar(64));
insert into foo(id, bar) values (1, 'AAA');
|
DROP TABLE IF EXISTS priljubljene;
DROP TABLE IF EXISTS nepremicnine;
DROP TABLE IF EXISTS agencije;
DROP TABLE IF EXISTS regije;
DROP TABLE IF EXISTS uporabniki;
CREATE TABLE regije (
id serial PRIMARY KEY,
regija text NOT NULL
);
CREATE TABLE agencije (
id serial PRIMARY KEY,
agencija text NOT NULL
);
CREATE TABLE nepremicnine (
id serial PRIMARY KEY,
ime text NOT NULL,
vrsta text NOT NULL,
opis text NOT NULL,
leto_izgradnje integer,
zemljisce text,
velikost real NOT NULL,
cena real NOT NULL,
agencija integer REFERENCES agencije(id),
regija integer REFERENCES regije(id)
);
CREATE TABLE uporabniki(
id serial PRIMARY KEY,
ime text NOT NULL,
priimek text NOT NULL,
email text NOT NULL UNIQUE,
uporabnisko_ime text NOT NULL UNIQUE,
geslo text NOT NULL
--CONSTRAINT blabla UNIQUE(kire stolpce) lahko tudi tak delas
);
CREATE TABLE priljubljene(
uporabnik integer REFERENCES uporabniki(id),
nepremicnina integer REFERENCES nepremicnine(id)
);
GRANT ALL ON DATABASE sem2020_domenfb TO sabrinac;
GRANT ALL ON SCHEMA public TO sabrinac;
GRANT ALL ON ALL TABLES IN SCHEMA public TO sabrinac;
GRANT ALL ON ALL SEQUENCES IN SCHEMA public TO sabrinac;
GRANT ALL ON DATABASE sem2020_domenfb TO timotejg;
GRANT ALL ON SCHEMA public TO timotejg;
GRANT ALL ON ALL TABLES IN SCHEMA public TO timotejg;
GRANT ALL ON ALL SEQUENCES IN SCHEMA public TO timotejg;
--GRANT SELECT ON DATABASE sem2020_domenfb TO javnost;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO javnost;
GRANT INSERT ON ALL TABLES IN SCHEMA public TO javnost;
GRANT DELETE ON "public"."priljubljene" TO javnost;
|
<reponame>jdkoren/sqlite-parser
-- misc5.test
--
-- execsql {SELECT .1 }
SELECT .1
|
<reponame>OpenPerpetuum/OPDB-docs<filename>Patches/Live_13/Raw_SQL/EntityDef_outpostDecay__2019_09_08.sql<gh_stars>1-10
USE [perpetuumsa]
GO
--------------------------------------------
--Outpost Decay Definition
--A definition for valid intrusion events and logs
--
--Date Modified: 2019/09/08
--------------------------------------------
INSERT INTO [dbo].[entitydefaults]
([definitionname],[quantity],[attributeflags],[categoryflags],[options],[note],[enabled],[volume],[mass],[hidden],[health],[descriptiontoken],[purchasable],[tiertype],[tierlevel])
VALUES
('def_outpost_decay',1,2,(SELECT value FROM categoryFlags WHERE name = 'cf_intrusion_objects'),'','Decay def',1,1,1,0,100,'',0,1,1);
GO
|
<reponame>scossin/Achilles
-- 500 Number of persons with death, by cause_concept_id
--HINT DISTRIBUTE_ON_KEY(stratum_1)
SELECT
500 AS analysis_id,
CAST(d.cause_concept_id AS VARCHAR(255)) AS stratum_1,
CAST(NULL AS VARCHAR(255)) AS stratum_2,
CAST(NULL AS VARCHAR(255)) AS stratum_3,
CAST(NULL AS VARCHAR(255)) AS stratum_4,
CAST(NULL AS VARCHAR(255)) AS stratum_5,
COUNT_BIG(DISTINCT d.person_id) AS count_value
INTO
@scratchDatabaseSchema@schemaDelim@tempAchillesPrefix_500
FROM
@cdmDatabaseSchema.death d
JOIN
@cdmDatabaseSchema.observation_period op
ON
d.person_id = op.person_id
AND
d.death_date >= op.observation_period_start_date
AND
d.death_date <= op.observation_period_end_date
GROUP BY
d.cause_concept_id;
|
select id, id_estudiante, id_profesor, fecha, valor from clase
|
<filename>libs/sdc_etl_libs/sql/Ultipro/rest_apis/CREATE_TABLE_restapi_employee_job_history_details.sql
create table "RESTAPI_EMPLOYEE_JOB_HISTORY_DETAILS_PII"
(
"ANNUALSALARY" float,
"COMPANYID" varchar,
"DATETIMECREATED" datetime,
"EMPLOYEEID" varchar,
"EMPLOYEETYPE" varchar,
"EMPLOYEESTATUS" varchar,
"FLSACATEGORY" varchar,
"FULLTIMEORPARTTIME" varchar,
"HOURLYPAYRATE" float,
"ISJOBCHANGE" boolean,
"ISORGCHANGE" boolean,
"ISOUTSIDEGUIDELINES" boolean,
"ISOUTSIDERANGE" boolean,
"ISPROMOTION" boolean,
"ISRATECHANGE" boolean,
"ISSYSTEM" boolean,
"ISTRANSFER" boolean,
"JOBCODE" varchar,
"JOBDESCRIPTION" varchar,
"JOBEFFECTIVEDATE" datetime,
"JOBGROUPCODE" varchar,
"LOCATIONCODE" varchar,
"ORGLEVEL1CODE" varchar,
"ORGLEVEL2CODE" varchar,
"ORGLEVEL3CODE" varchar,
"ORGLEVEL4CODE" varchar,
"OTHERRATE1" float,
"OTHERRATE2" float,
"OTHERRATE3" float,
"OTHERRATE4" float,
"PAYGROUPCODE" varchar,
"PAYPERIODCODE" varchar,
"PAYSCALECODE" varchar,
"PERCENTCHANGE" float,
"PERIODPAYRATE" float,
"PIECEPAYRATE" float,
"POSITIONCODE" varchar,
"REASONCODE" varchar,
"SALARYGRADE" varchar,
"SALARYORHOURLY" varchar,
"SCHEDULEDANNUALHOURS" float,
"SCHEDULEDFULLTIMEEQUIVALENCY" float,
"SCHEDULEDWORKHOURS" float,
"SHIFTCODE" varchar,
"SHIFTGROUPCODE" varchar,
"STEPNUMBER" float,
"SUPERVISORID" varchar,
"SUPERVISORNAMEFIRST" varchar,
"SUPERVISORNAMELAST" varchar,
"SUPERVISORNAMESUFFIX" varchar,
"SUPERVISORNOTINLIST" boolean,
"SYSTEMID" varchar,
"UNIONNATIONAL" varchar,
"USEPAYSCALES" boolean,
"WEEKLYPAYRATE" float,
"NOTES" varchar,
"HOMECOMPANYID" varchar,
"INTEGRATIONEFFECTIVEDATE" datetime,
"PROJECTCODE" varchar,
"NUMBEROFPAYMENTS" float,
"WEEKLYHOURS" float,
"ISVIEWABLEBYEMPLOYEE" boolean,
"CREATEDBYUSERID" float,
"JOBTITLE" varchar,
"_SF_INSERTEDDATETIME" datetime
);
|
select name from member where id in (select member_id from checkout_item group by member_id having count(member_id) > 1);
|
insert
into
Customer
(created_on, firstName, lastName, id)
values
(?, ?, ?, ?)
-- binding parameter [1] as [TIMESTAMP] - [Thu Jul 27 15:45:00 EEST 2017]
-- binding parameter [2] as [VARCHAR] - [John]
-- binding parameter [3] as [VARCHAR] - [Doe]
-- binding parameter [4] as [BIGINT] - [1]
insert
into
CUSTOM_REV_INFO
(timestamp, username, id)
values
(?, ?, ?)
-- binding parameter [1] as [BIGINT] - [1501159500888]
-- binding parameter [2] as [VARCHAR] - [Vlad Mihalcea]
-- binding parameter [3] as [INTEGER] - [1]
insert
into
Customer_AUD
(REVTYPE, created_on, firstName, lastName, id, REV)
values
(?, ?, ?, ?, ?, ?)
-- binding parameter [1] as [INTEGER] - [0]
-- binding parameter [2] as [TIMESTAMP] - [Thu Jul 27 15:45:00 EEST 2017]
-- binding parameter [3] as [VARCHAR] - [John]
-- binding parameter [4] as [VARCHAR] - [Doe]
-- binding parameter [5] as [BIGINT] - [1]
-- binding parameter [6] as [INTEGER] - [1]
|
CREATE SCHEMA IF NOT EXISTS cbv;
CREATE TABLE IF NOT EXISTS cbv.masterdata
(
id character varying(128) COLLATE pg_catalog."default" NOT NULL,
type character varying(128) COLLATE pg_catalog."default" NOT NULL,
created_on timestamp without time zone NOT NULL DEFAULT timezone('UTC'::text, now()),
last_update timestamp without time zone NOT NULL DEFAULT timezone('UTC'::text, now()),
CONSTRAINT pk_cbv_masterdata PRIMARY KEY (id, type)
)
WITH (OIDS = FALSE);
CREATE TABLE IF NOT EXISTS cbv.attribute
(
masterdata_id character varying(128) COLLATE pg_catalog."default" NOT NULL,
masterdata_type character varying(128) COLLATE pg_catalog."default" NOT NULL,
id character varying(128) COLLATE pg_catalog."default" NOT NULL,
value character varying(128) COLLATE pg_catalog."default" NOT NULL,
CONSTRAINT pk_cbv_masterdata_attribute PRIMARY KEY (masterdata_id, masterdata_type, id),
CONSTRAINT fl_cbv_attribute_to_masterdata FOREIGN KEY (masterdata_id, masterdata_type) REFERENCES cbv.masterdata (id, type)
)
WITH (OIDS = FALSE);
CREATE TABLE IF NOT EXISTS cbv.attribute_field
(
internal_id int NOT NULL,
internal_parent_id int NULL,
masterdata_type character varying(128) COLLATE pg_catalog."default" NOT NULL,
masterdata_id character varying(128) COLLATE pg_catalog."default" NOT NULL,
parent_id character varying(128) COLLATE pg_catalog."default" NOT NULL,
name character varying(128) COLLATE pg_catalog."default" NOT NULL,
namespace character varying(128) COLLATE pg_catalog."default" NULL,
value character varying(128) COLLATE pg_catalog."default" NULL,
CONSTRAINT pk_cbv_masterdata_attribute_field PRIMARY KEY (masterdata_type, masterdata_id, internal_id)
)
WITH (OIDS = FALSE);
CREATE TABLE IF NOT EXISTS cbv.hierarchy
(
type character varying(128) COLLATE pg_catalog."default" NOT NULL,
parent_id character varying(128) COLLATE pg_catalog."default" NOT NULL,
children_id character varying(128) COLLATE pg_catalog."default" NOT NULL,
CONSTRAINT pk_cbv_hierarchy PRIMARY KEY (type, parent_id, children_id)
)
WITH (OIDS = FALSE);
CREATE MATERIALIZED VIEW IF NOT EXISTS cbv.masterdata_hierarchy
AS
(
WITH RECURSIVE children(type, parent_id, children_id, depth) AS
(
(
SELECT type, parent_id, children_id, 0
FROM cbv.hierarchy
)
UNION
(
SELECT c.type, c.parent_id, h.children_id, c.depth+1
FROM cbv.hierarchy h
JOIN children c
ON (c.children_id = h.parent_id AND c.type = h.type)
)
)
SELECT * FROM children
);
CREATE OR REPLACE FUNCTION refresh_masterdata_hierarchy()
RETURNS TRIGGER LANGUAGE plpgsql
AS $$
BEGIN
REFRESH MATERIALIZED VIEW cbv.masterdata_hierarchy;
RETURN NULL;
END $$;
DROP TRIGGER IF EXISTS flatten_cbv_hierarchy ON cbv.hierarchy CASCADE;
CREATE TRIGGER flatten_cbv_hierarchy AFTER INSERT OR UPDATE OR DELETE ON cbv.hierarchy
EXECUTE PROCEDURE refresh_masterdata_hierarchy();
|
IF EXISTS(SELECT 'True' FROM msdb.dbo.sysjobs WHERE name = 'DOI - Refresh Metadata')
BEGIN
EXEC msdb.dbo.sp_delete_job @job_name = N'DOI - Refresh Metadata' ;
PRINT 'Deleted Job DOI - Refresh Metadata.'
END
GO
BEGIN TRY
BEGIN TRANSACTION
DECLARE @ReturnCode INT
SELECT @ReturnCode = 0
/****** Object: JobCategory [DB Maintenance] Script Date: 7/25/2014 4:08:45 PM ******/
IF NOT EXISTS (SELECT name FROM msdb.dbo.syscategories WHERE name=N'DB Maintenance' AND category_class=1)
BEGIN
EXEC @ReturnCode = msdb.dbo.sp_add_category
@class=N'JOB',
@type=N'LOCAL',
@name=N'DB Maintenance'
END
DECLARE @jobId BINARY(16)
EXEC @ReturnCode = msdb.dbo.sp_add_job
@job_name=N'DOI - Refresh Metadata',
@enabled=1,
@notify_level_eventlog=0,
@notify_level_email=0,
@notify_level_netsend=0,
@notify_level_page=0,
@delete_level=0,
@description=N'No description available.',
@category_name=N'DB Maintenance',
@owner_login_name=N'sa',
@job_id = @jobId OUTPUT
PRINT 'Created job DOI - Refresh Metadata'
/****** Object: Step [DOI - Refresh Metadata] Script Date: 7/25/2014 4:08:45 PM ******/
EXEC @ReturnCode = msdb.dbo.sp_add_jobstep
@job_id=@jobId,
@step_name=N'Refresh Metadata',
@step_id=1,
@cmdexec_success_code=0,
@on_success_action=1,
@on_success_step_id=0,
@on_fail_action=2,
@on_fail_step_id=0,
@retry_attempts=0,
@retry_interval=0,
@os_run_priority=0,
@subsystem=N'TSQL',
@command=N'EXEC DOI.spRefreshMetadata_Run_All',
@database_name=N'DOI',
@flags=0
EXEC @ReturnCode = msdb.dbo.sp_add_jobschedule
@job_id=@jobId,
@name=N'DOI-Every 5 Minutes',
@enabled=1,
@freq_type=4,
@freq_interval=1,
@freq_subday_type=4,
@freq_subday_interval=5,
@freq_relative_interval=0,
@freq_recurrence_factor=0,
@active_start_date=20191217,
@active_end_date=99991231,
@active_start_time=0,
@active_end_time=235959,
@schedule_uid=N'39536401-ebf7-4876-8ad7-86ea459ded1c'
EXEC @ReturnCode = msdb.dbo.sp_update_job
@job_id = @jobId,
@start_step_id = 1
EXEC @ReturnCode = msdb.dbo.sp_add_jobserver
@job_id = @jobId,
@server_name = N'(local)'
COMMIT TRANSACTION
END TRY
BEGIN CATCH
IF (@@TRANCOUNT > 0) ROLLBACK TRANSACTION;
THROW;
END CATCH
SELECT @jobid = job_id
FROM msdb.dbo.sysjobs j
WHERE j.name = 'DOI - Refresh Metadata'
IF EXISTS(SELECT 'True' FROM master.dbo.JobsToGovern WHERE JobName = 'DOI - Refresh Metadata')
BEGIN
DELETE master.dbo.JobsToGovern WHERE JobName = 'DOI - Refresh Metadata'
END
IF NOT EXISTS(SELECT 'True' FROM master.dbo.JobsToGovern WHERE JobName = 'DOI - Refresh Metadata')
BEGIN
INSERT INTO master.dbo.JobsToGovern ( JobID ,JobName ,MatchString )
VALUES ( @jobid , N'DOI - Refresh Metadata' , N'SQLAgent - TSQL JobStep (Job ' + CONVERT(VARCHAR(36), CONVERT(BINARY(16), @jobid), 1) + '%')
END
GO
|
drop table s_warehouse;
create table s_warehouse as
(select W_WAREHOUSE_ID WRHS_WAREHOUSE_ID
,W_WAREHOUSE_name WRHS_WAREHOUSE_DESC
,W_WAREHOUSE_SQ_FT WRHS_WAREHOUSE_SQ_FT
from warehouse
where rownum < 10);
|
ALTER DATABASE DEFAULT SET JavaBinaryForUDx = '/usr/java/latest/bin/java';
CREATE OR REPLACE LIBRARY verticajavaudl AS '/tmp/vertica-java-udl-0.1-jar-with-dependencies.jar' language 'java';
CREATE OR REPLACE PARSER XmlParser AS LANGUAGE 'java' NAME 'com.bryanherger.udparser.XmlParserFactory' LIBRARY verticajavaudl;
CREATE OR REPLACE PARSER FixParser AS LANGUAGE 'java' NAME 'com.bryanherger.udparser.FixParserFactory' LIBRARY verticajavaudl;
CREATE OR REPLACE FILTER XmlFilter AS LANGUAGE 'java' NAME 'com.bryanherger.udparser.XmlFilterFactory' LIBRARY verticajavaudl;
CREATE OR REPLACE FILTER FIXFilter AS LANGUAGE 'java' NAME 'com.bryanherger.udparser.FIXFilterFactory' LIBRARY verticajavaudl;
DROP TABLE IF EXISTS public.examplexml;
CREATE TABLE public.examplexml (author_text VARCHAR, title_text VARCHAR, title_attr_lang VARCHAR, year_text VARCHAR, price_text VARCHAR);
COPY public.examplexml FROM LOCAL 'example.xml' PARSER XmlParser(document='book',field_delimiter=';');
SELECT * FROM public.examplexml;
DROP TABLE IF EXISTS public.examplexmlflex;
CREATE FLEX TABLE public.examplexmlflex();
COPY public.examplexmlflex FROM LOCAL 'example.xml' FILTER XmlFilter(document='book',field_delimiter=';') PARSER FJSONPARSER();
SELECT * FROM public.examplexmlflex;
select __identity__, MAPTOSTRING(__raw__) from public.examplexmlflex;
DROP TABLE IF EXISTS public.examplefix;
CREATE TABLE public.examplefix (FIX44 VARCHAR, FIX45 VARCHAR, FIX49 VARCHAR, FIX150 VARCHAR, FIX151 VARCHAR, FIX52 VARCHAR, FIX31 VARCHAR, FIX98 VARCHAR, FIX10 VARCHAR, FIX54 VARCHAR, FIX32 VARCHAR, FIX11 VARCHAR, FIX55 VARCHAR, FIX34 VARCHAR, FIX56 VARCHAR, FIX35 VARCHAR, FIX14 VARCHAR, FIX58 VARCHAR, FIX59 VARCHAR, FIX37 VARCHAR, FIX38 VARCHAR, FIX17 VARCHAR, FIX39 VARCHAR, FIX6 VARCHAR, FIX8 VARCHAR, FIX9 VARCHAR, FIX108 VARCHAR, FIX40 VARCHAR, FIX41 VARCHAR, FIX20 VARCHAR, FIX21 VARCHAR);
COPY public.examplefix FROM LOCAL 'example.fix' PARSER FixParser();
SELECT * FROM public.examplefix;
DROP TABLE IF EXISTS public.examplefixflex;
CREATE FLEX TABLE public.examplefixflex();
COPY public.examplefixflex FROM LOCAL 'example.fix' FILTER FIXFilter() PARSER FJSONPARSER();
SELECT * FROM public.examplefixflex;
select __identity__, MAPTOSTRING(__raw__) from public.examplefixflex;
|
ALTER TABLE scans ADD date_updated DATETIME COMMENT 'The date that this scan was last updated' AFTER date_created;
ALTER TABLE scanned_page ADD num_errors INT COMMENT 'The total number of errors found';
ALTER TABLE scanned_page ADD num_notices INT COMMENT 'The total number of notices found';
|
<filename>database/migrations/2015_05_05_210603_users_password_imageurl/up.sql
ALTER TABLE users
ALTER COLUMN password DROP NOT NULL;
ALTER TABLE users
ADD COLUMN image_url character varying(255);
|
<filename>db.sql
-- --------------------------------------------------------
-- Host: localhost
-- Server version: 10.4.10-MariaDB - mariadb.org binary distribution
-- Server OS: Win64
-- HeidiSQL Version: 11.0.0.5919
-- --------------------------------------------------------
/*!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' */;
-- Dumping structure for table msdfs_forms_db.applicants
DROP TABLE IF EXISTS `applicants`;
CREATE TABLE IF NOT EXISTS `applicants` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`application_id` bigint(20) unsigned NOT NULL,
`person_id` bigint(20) unsigned NOT NULL,
`active` int(1) NOT NULL DEFAULT 1,
`order` int(11) NOT NULL DEFAULT 0,
`created_at` timestamp NOT NULL DEFAULT current_timestamp(),
`updated_at` datetime DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE,
KEY `FK_applicants_applications` (`application_id`),
KEY `FK_applicants_persons` (`person_id`),
CONSTRAINT `FK_applicants_applications` FOREIGN KEY (`application_id`) REFERENCES `applications` (`id`),
CONSTRAINT `FK_applicants_persons` FOREIGN KEY (`person_id`) REFERENCES `people` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC;
-- Dumping data for table msdfs_forms_db.applicants: ~0 rows (approximately)
/*!40000 ALTER TABLE `applicants` DISABLE KEYS */;
/*!40000 ALTER TABLE `applicants` ENABLE KEYS */;
-- Dumping structure for table msdfs_forms_db.applications
DROP TABLE IF EXISTS `applications`;
CREATE TABLE IF NOT EXISTS `applications` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`ip` text NOT NULL,
`form_id` int(10) unsigned NOT NULL,
`status_id` int(10) unsigned NOT NULL DEFAULT 0,
`schedules_approved` tinyint(4) DEFAULT NULL,
`reference_number` varchar(50) DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT current_timestamp(),
`updated_at` datetime DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE,
KEY `FK_applications_forms` (`form_id`),
KEY `FK_applications_status` (`status_id`),
CONSTRAINT `FK_applications_forms` FOREIGN KEY (`form_id`) REFERENCES `forms` (`id`),
CONSTRAINT `FK_applications_status` FOREIGN KEY (`status_id`) REFERENCES `status` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC;
-- Dumping data for table msdfs_forms_db.applications: ~0 rows (approximately)
/*!40000 ALTER TABLE `applications` DISABLE KEYS */;
/*!40000 ALTER TABLE `applications` ENABLE KEYS */;
-- Dumping structure for table msdfs_forms_db.application_approvals
DROP TABLE IF EXISTS `application_approvals`;
CREATE TABLE IF NOT EXISTS `application_approvals` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`application_status_audit_id` bigint(20) unsigned NOT NULL,
`type` varchar(255) NOT NULL,
`key` varchar(255) NOT NULL,
`value` varchar(255) NOT NULL,
PRIMARY KEY (`id`) USING BTREE,
KEY `FK_application_documents_applications` (`application_status_audit_id`) USING BTREE,
CONSTRAINT `FK_application_approval_application_status_audit` FOREIGN KEY (`application_status_audit_id`) REFERENCES `application_status_audit` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC;
-- Dumping data for table msdfs_forms_db.application_approvals: ~0 rows (approximately)
/*!40000 ALTER TABLE `application_approvals` DISABLE KEYS */;
/*!40000 ALTER TABLE `application_approvals` ENABLE KEYS */;
-- Dumping structure for table msdfs_forms_db.application_assistance_sought
DROP TABLE IF EXISTS `application_assistance_sought`;
CREATE TABLE IF NOT EXISTS `application_assistance_sought` (
`application_id` bigint(20) unsigned NOT NULL,
`assistance_sought_id` int(10) unsigned NOT NULL,
PRIMARY KEY (`application_id`,`assistance_sought_id`),
KEY `FK_application_documents_applications` (`application_id`) USING BTREE,
KEY `FK_application_assistance_sought_assistance_sought` (`assistance_sought_id`),
CONSTRAINT `FK_application_assistance_sought_applications` FOREIGN KEY (`application_id`) REFERENCES `applications` (`id`),
CONSTRAINT `FK_application_assistance_sought_assistance_sought` FOREIGN KEY (`assistance_sought_id`) REFERENCES `assistance_sought` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC;
-- Dumping data for table msdfs_forms_db.application_assistance_sought: ~0 rows (approximately)
/*!40000 ALTER TABLE `application_assistance_sought` DISABLE KEYS */;
/*!40000 ALTER TABLE `application_assistance_sought` ENABLE KEYS */;
-- Dumping structure for table msdfs_forms_db.application_documents
DROP TABLE IF EXISTS `application_documents`;
CREATE TABLE IF NOT EXISTS `application_documents` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`application_id` bigint(20) unsigned NOT NULL,
`file` varchar(255) NOT NULL,
`document` varchar(255) NOT NULL,
`document_type_id` int(10) unsigned DEFAULT NULL,
`path` text NOT NULL,
`created_at` timestamp NOT NULL DEFAULT current_timestamp(),
`updated_at` datetime DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE,
KEY `FK_application_documents_applications` (`application_id`),
KEY `FK_application_documents_document_types` (`document_type_id`),
CONSTRAINT `FK_application_documents_applications` FOREIGN KEY (`application_id`) REFERENCES `applications` (`id`),
CONSTRAINT `FK_application_documents_document_types` FOREIGN KEY (`document_type_id`) REFERENCES `document_types` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC;
-- Dumping data for table msdfs_forms_db.application_documents: ~0 rows (approximately)
/*!40000 ALTER TABLE `application_documents` DISABLE KEYS */;
/*!40000 ALTER TABLE `application_documents` ENABLE KEYS */;
-- Dumping structure for table msdfs_forms_db.application_grants
DROP TABLE IF EXISTS `application_grants`;
CREATE TABLE IF NOT EXISTS `application_grants` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`application_id` bigint(20) unsigned NOT NULL,
`key` varchar(255) NOT NULL,
`value` varchar(255) NOT NULL,
`created_at` timestamp NOT NULL DEFAULT current_timestamp(),
`updated_at` datetime DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE,
KEY `FK_application_documents_applications` (`application_id`) USING BTREE,
CONSTRAINT `application_grants_ibfk_1` FOREIGN KEY (`application_id`) REFERENCES `applications` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC;
-- Dumping data for table msdfs_forms_db.application_grants: ~0 rows (approximately)
/*!40000 ALTER TABLE `application_grants` DISABLE KEYS */;
/*!40000 ALTER TABLE `application_grants` ENABLE KEYS */;
-- Dumping structure for table msdfs_forms_db.application_status_audit
DROP TABLE IF EXISTS `application_status_audit`;
CREATE TABLE IF NOT EXISTS `application_status_audit` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`application_id` bigint(20) unsigned NOT NULL,
`changed_by` bigint(20) unsigned NOT NULL,
`status_old` int(10) unsigned NOT NULL,
`status_new` int(10) unsigned NOT NULL,
`details` text CHARACTER SET latin1 DEFAULT NULL,
`user_name` text COLLATE utf8_unicode_ci DEFAULT NULL,
`user_role` text COLLATE utf8_unicode_ci DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`updated_at` datetime NOT NULL,
PRIMARY KEY (`id`) USING BTREE,
KEY `FK_application_status_audit_applications` (`application_id`),
KEY `FK_application_status_audit_users` (`changed_by`),
KEY `FK_application_status_audit_status` (`status_old`),
KEY `FK_application_status_audit_status_2` (`status_new`),
CONSTRAINT `FK_application_status_audit_applications` FOREIGN KEY (`application_id`) REFERENCES `applications` (`id`),
CONSTRAINT `FK_application_status_audit_status` FOREIGN KEY (`status_old`) REFERENCES `status` (`id`),
CONSTRAINT `FK_application_status_audit_status_2` FOREIGN KEY (`status_new`) REFERENCES `status` (`id`),
CONSTRAINT `FK_application_status_audit_users` FOREIGN KEY (`changed_by`) REFERENCES `users` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ROW_FORMAT=DYNAMIC;
-- Dumping data for table msdfs_forms_db.application_status_audit: ~0 rows (approximately)
/*!40000 ALTER TABLE `application_status_audit` DISABLE KEYS */;
/*!40000 ALTER TABLE `application_status_audit` ENABLE KEYS */;
-- Dumping structure for table msdfs_forms_db.assistance_sought
DROP TABLE IF EXISTS `assistance_sought`;
CREATE TABLE IF NOT EXISTS `assistance_sought` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`assistance` varchar(150) NOT NULL,
`slug` varchar(150) DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE,
UNIQUE KEY `country` (`assistance`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC;
-- Dumping data for table msdfs_forms_db.assistance_sought: ~2 rows (approximately)
/*!40000 ALTER TABLE `assistance_sought` DISABLE KEYS */;
INSERT INTO `assistance_sought` (`id`, `assistance`, `slug`) VALUES
(1, 'Income Support Grant', 'public_assistance'),
(2, 'Rental Assistance Grant', 'rental_assistance'),
(3, 'Temporary Food Card Support', 'temp_food_card');
/*!40000 ALTER TABLE `assistance_sought` ENABLE KEYS */;
-- Dumping structure for table msdfs_forms_db.banks
DROP TABLE IF EXISTS `banks`;
CREATE TABLE IF NOT EXISTS `banks` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`bank` varchar(150) NOT NULL,
PRIMARY KEY (`id`) USING BTREE,
UNIQUE KEY `country` (`bank`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC;
-- Dumping data for table msdfs_forms_db.banks: ~6 rows (approximately)
/*!40000 ALTER TABLE `banks` DISABLE KEYS */;
INSERT INTO `banks` (`id`, `bank`) VALUES
(1, 'First Citizens Bank'),
(6, 'JMMB'),
(3, 'Republic Bank'),
(4, 'Royal Bank'),
(2, 'Scotiabank'),
(5, 'Unit Trust');
/*!40000 ALTER TABLE `banks` ENABLE KEYS */;
-- Dumping structure for table msdfs_forms_db.citizen_proof
DROP TABLE IF EXISTS `citizen_proof`;
CREATE TABLE IF NOT EXISTS `citizen_proof` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`proof` varchar(150) NOT NULL,
PRIMARY KEY (`id`) USING BTREE,
UNIQUE KEY `country` (`proof`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC;
-- Dumping data for table msdfs_forms_db.citizen_proof: ~4 rows (approximately)
/*!40000 ALTER TABLE `citizen_proof` DISABLE KEYS */;
INSERT INTO `citizen_proof` (`id`, `proof`) VALUES
(2, 'Certificate of Immigration Status'),
(3, 'Certificate of Residence'),
(1, 'National ID'),
(4, 'Passport');
/*!40000 ALTER TABLE `citizen_proof` ENABLE KEYS */;
-- Dumping structure for table msdfs_forms_db.communities
DROP TABLE IF EXISTS `communities`;
CREATE TABLE IF NOT EXISTS `communities` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`community` varchar(255) NOT NULL,
`code` int(11) DEFAULT NULL,
`region_code` int(11) NOT NULL,
PRIMARY KEY (`id`) USING BTREE,
KEY `FK_communities_regions` (`region_code`),
CONSTRAINT `FK_communities_regions` FOREIGN KEY (`region_code`) REFERENCES `regions` (`code`)
) ENGINE=InnoDB AUTO_INCREMENT=521 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC;
-- Dumping data for table msdfs_forms_db.communities: ~520 rows (approximately)
/*!40000 ALTER TABLE `communities` DISABLE KEYS */;
INSERT INTO `communities` (`id`, `community`, `code`, `region_code`) VALUES
(1, 'Abysinia Village (Oilfield area)', 5301, 11),
(2, 'Acono Village', 3319, 80),
(3, 'Agostini Village', 4201, 90),
(4, 'Agostini Village', 5101, 11),
(5, '<NAME>', 3119, 60),
(6, 'Anglais Settlement', 6101, 12),
(7, 'Apex Oil Field', 8101, 15),
(8, 'Aranguez', 3211, 70),
(9, 'Arena', 4202, 90),
(10, 'Arima Heights/Temple Village', 3402, 80),
(11, '<NAME>', 3001, 30),
(12, 'Aripero Village', 8301, 15),
(13, 'Arouca', 3311, 80),
(14, 'Avocat Village', 8102, 15),
(15, 'Bagatelle', 3127, 60),
(16, 'Balandra', 6301, 12),
(17, 'Balmain', 4401, 90),
(18, 'Bamboo Grove', 9801, 70),
(19, 'Bamboo Village', 8401, 15),
(20, 'Barataria', 3209, 70),
(21, 'Barrackpore', 9802, 13),
(22, '<NAME>', 7402, 13),
(23, 'Baster Hall', 4402, 90),
(24, 'Batchyia Village', 8104, 14),
(25, 'Bayshore', 3117, 60),
(26, '<NAME>', 8201, 15),
(27, '<NAME>', 3137, 60),
(28, 'Beetham Estate', 3218, 70),
(29, 'Bejucal', 9805, 70),
(30, 'Belmont', 1001, 10),
(31, '<NAME>', 7502, 13),
(32, 'Bennet Village', 8202, 15),
(33, 'Biche', 9817, 11),
(34, '<NAME>', 3104, 60),
(35, 'Blanchisseuse', 9803, 70),
(36, 'Blue Basin', 3130, 60),
(37, 'Blue Range', 3141, 60),
(38, '<NAME>', 8402, 15),
(39, 'Boissiere', 3124, 60),
(40, 'Bon Air Development', 3312, 80),
(41, 'Bon Air West Development', 3336, 80),
(42, '<NAME>', 7403, 13),
(43, 'Bonasse Village', 8403, 15),
(44, '<NAME>', 7301, 90),
(45, '<NAME>', 9804, 13),
(46, '<NAME> Village', 4101, 90),
(47, '<NAME>', 4102, 90),
(48, '<NAME> Village', 3502, 80),
(49, '<NAME>', 4103, 90),
(50, '<NAME>', 4104, 90),
(51, '<NAME>', 4403, 90),
(52, 'Brickfield', 4203, 90),
(53, 'Brickfield/Navet', 5202, 90),
(54, 'Brighton', 8302, 15),
(55, 'Broadway', 2012, 20),
(56, 'Brooklyn Settlement', 6401, 12),
(57, 'Broomage', 7504, 13),
(58, 'Brothers Road', 5203, 90),
(59, 'Brothers Settlement', 7505, 13),
(60, 'Bucarro', 4404, 90),
(61, '<NAME>', 7506, 13),
(62, 'Butler Village', 4204, 90),
(63, 'Caigual', 6402, 12),
(64, 'Calcutta Road No. 2', 4105, 90),
(65, 'Calcutta Settlement No.2', 4406, 90),
(66, 'California', 4405, 90),
(67, '<NAME>', 3008, 30),
(68, '<NAME>', 3140, 60),
(69, 'Canaan Village Palmiste', 7203, 14),
(70, 'Canaree', 7404, 13),
(71, '<NAME>', 3310, 80),
(72, 'Canque', 5204, 11),
(73, 'Cantaro Village', 3220, 70),
(74, '<NAME>', 9806, 15),
(75, 'Caparo', 9945, 90),
(76, 'Carapal', 8203, 15),
(77, 'Carapichaima', 9906, 90),
(78, 'Carapo', 3406, 80),
(79, 'Caratal', 7302, 90),
(80, 'Carenage', 3101, 60),
(81, '<NAME>', 3003, 30),
(82, '<NAME>', 4207, 90),
(83, 'Car-Michael', 6501, 12),
(84, '<NAME>', 3327, 80),
(85, 'Cascade', 3214, 70),
(86, 'Caura', 3332, 80),
(87, '<NAME>', 7204, 13),
(88, '<NAME>', 7303, 90),
(89, 'Cedros', 8405, 15),
(90, 'Centeno', 3342, 80),
(91, '<NAME>', 4016, 40),
(92, 'Chaguaramas', 3102, 60),
(93, '<NAME>', 3122, 60),
(94, '<NAME>', 9807, 70),
(95, 'Chandernagore', 4208, 90),
(96, 'Charlieville', 4019, 40),
(97, '<NAME>', 8105, 14),
(98, '<NAME>', 5103, 11),
(99, 'Chase Village', 4209, 90),
(100, 'Chatham', 8406, 15),
(101, 'Chickland', 4107, 90),
(102, '<NAME>', 4302, 90),
(103, 'Chinese Village', 8303, 15),
(104, 'City Proper', 2003, 20),
(105, '<NAME>', 9907, 90),
(106, '<NAME>', 3404, 80),
(107, 'Cleghorn and <NAME>', 7205, 13),
(108, '<NAME>', 8012, 50),
(109, '<NAME>', 6602, 12),
(110, 'Coalmine', 4108, 90),
(111, '<NAME>', 5104, 11),
(112, 'Cochrane', 9808, 15),
(113, 'Cocorite', 1002, 10),
(114, 'Cocoyea Village', 2017, 20),
(115, 'Corinth', 7206, 13),
(116, 'Coromandel', 8407, 15),
(117, 'Corosal', 7305, 90),
(118, 'Coryal', 6502, 12),
(119, 'Coryal Village', 7507, 13),
(120, 'C<NAME>', 4409, 90),
(121, 'Covigne', 3115, 60),
(122, 'Cumaca', 6201, 12),
(123, 'Cumana', 6102, 12),
(124, 'Cumuto', 6503, 12),
(125, 'Cunaripo', 9909, 12),
(126, 'Cunupia', 9809, 40),
(127, 'Curepe', 3341, 80),
(128, 'Cushe/Navet', 9911, 11),
(129, 'D'Abadi', 9942, 80),
(130, '<NAME>', 8204, 15),
(131, '<NAME>', 8106, 15),
(132, '<NAME>', 7207, 14),
(133, 'Deep Ravine/Clear Water', 5106, 11),
(134, 'Delhi Settlement', 8107, 15),
(135, 'Diamond', 4410, 90),
(136, 'Diamond', 7208, 14),
(137, '<NAME>', 3114, 60),
(138, 'Dibe/<NAME>', 3144, 60),
(139, '<NAME>', 3111, 60),
(140, 'Dinsley', 3344, 80),
(141, 'Dinsley/Trincity', 3346, 80),
(142, 'Dow Village', 4411, 90),
(143, 'Dow Village', 8108, 15),
(144, 'Duncan Village', 7209, 14),
(145, '<NAME>illage', 7508, 13),
(146, 'East Port of Spain', 1012, 10),
(147, 'Eastern Quarry', 3206, 70),
(148, 'Eccles Village', 9810, 13),
(149, 'Ecclesville', 5107, 11),
(150, 'Edinburgh 500', 4012, 40),
(151, '<NAME>ens', 4013, 40),
(152, 'Edinburgh Village', 4210, 90),
(153, 'Egypt Village', 8006, 50),
(154, 'El Dorado', 3307, 80),
(155, 'El Socorro', 3207, 70),
(156, 'El Socorro Extension', 3208, 70),
(157, '<NAME>', 1003, 10),
(158, 'Embacadre', 2013, 20),
(159, 'Endeavour Village', 4010, 40),
(160, 'Enterprise', 4001, 40),
(161, '<NAME> Medical Complex', 3347, 80),
(162, '<NAME>', 8206, 15),
(163, '<NAME>', 8205, 15),
(164, 'Esmeralda', 4005, 40),
(165, 'Esperance Village', 7210, 14),
(166, 'Esperanza', 4412, 90),
(167, 'Fairview', 4109, 90),
(168, 'Fairways', 3123, 60),
(169, 'Fanny Village', 8003, 50),
(170, 'Farnum Village', 7307, 90),
(171, 'Febeau Village', 3229, 70),
(172, 'Federation Park', 1004, 10),
(173, 'Felicity', 4008, 40),
(174, 'Felicity Hall', 4413, 90),
(175, 'Fifth Company', 7510, 13),
(176, 'Fishing Pond', 6403, 12),
(177, 'Five Rivers', 3335, 80),
(178, 'Flanagin Town', 4110, 90),
(179, 'Fonrose Village', 5206, 11),
(180, 'Forest Reserve', 8306, 15),
(181, 'Forres Park', 7308, 90),
(182, '<NAME>', 3121, 60),
(183, 'Four Roads', 3125, 60),
(184, 'Four Roads - Tamana', 6604, 12),
(185, 'Frederick Settlement', 4304, 80),
(186, 'Freeport', 9913, 90),
(187, 'Friendship', 4415, 90),
(188, 'Friendship', 9811, 13),
(189, 'Fullerton', 8408, 15),
(190, 'Fyzabad', 8109, 15),
(191, 'Gasparillo', 7309, 90),
(192, 'George Village', 7101, 13),
(193, 'Gheerahoo', 8110, 15),
(194, 'Glencoe', 3116, 60),
(195, 'Golconda', 9812, 13),
(196, 'Gonzales', 1005, 10),
(197, 'Gonzales (Point Fortin)', 9813, 15),
(198, '<NAME>', 3143, 60),
(199, '<NAME>', 4112, 90),
(200, '<NAME>', 3219, 70),
(201, 'Grand Lagoon', 5302, 11),
(202, 'Grand Riviere', 6103, 12),
(203, 'Granville', 8409, 15),
(204, 'Green Acres', 2019, 20),
(205, 'Green Hill Village', 3126, 60),
(206, 'Guaico', 9915, 12),
(207, '<NAME> 10', 8309, 15),
(208, 'Guaracara', 7310, 90),
(209, 'Guatopajaro', 6506, 12),
(210, 'Guayaguayare', 9916, 11),
(211, '<NAME>', 2020, 20),
(212, 'Haleland Park/Moka', 3142, 60),
(213, '<NAME>', 7511, 13),
(214, '<NAME>', 9917, 13),
(215, 'Harris Village', 8111, 15),
(216, 'Heights of Guanapo', 3415, 80),
(217, 'Hermitage', 7311, 90),
(218, 'Hermitage Village', 7214, 14),
(219, 'Hindustan', 7102, 13),
(220, 'Hollywood', 8004, 50),
(221, '<NAME>', 4006, 40),
(222, '<NAME>illage', 6507, 12),
(223, 'Icacos', 8410, 15),
(224, '<NAME>illage', 9918, 13),
(225, 'Indian Trail', 9920, 90),
(226, 'Indian Walk', 9919, 13),
(227, 'Industrial Estate', 3113, 60),
(228, '<NAME>', 8207, 15),
(229, '<NAME>', 4004, 40),
(230, '<NAME>', 7216, 13),
(231, 'Kandahar', 3334, 80),
(232, '<NAME>', 9921, 80),
(233, '<NAME>illage', 7515, 13),
(234, 'L'<NAME>', 6104, 12),
(235, '<NAME>', 7405, 13),
(236, '<NAME>', 3315, 80),
(237, '<NAME>', 8310, 15),
(238, '<NAME>', 3231, 70),
(239, '<NAME>', 9943, 80),
(240, '<NAME>', 7217, 14),
(241, 'La Fortune/Pluck', 8112, 15),
(242, '<NAME>', 3418, 80),
(243, '<NAME>', 3105, 60),
(244, '<NAME>', 3407, 80),
(245, 'La Mango Village', 3320, 80),
(246, 'La Paille Village', 3326, 80),
(247, '<NAME>', 3235, 70),
(248, '<NAME>', 3107, 60),
(249, 'La Resource', 3408, 80),
(250, '<NAME>', 7218, 14),
(251, '<NAME>', 7406, 13),
(252, '<NAME>', 5304, 11),
(253, '<NAME>', 7407, 13),
(254, '<NAME>', 3139, 60),
(255, 'La Seiva Village', 3316, 80),
(256, '<NAME>', 3201, 70),
(257, '<NAME>', 4014, 40),
(258, 'Lan<NAME>', 3103, 60),
(259, '<NAME>', 3503, 70),
(260, '<NAME> (Nos. 1 & 2)', 4306, 90),
(261, 'Laventille', 3212, 70),
(262, 'Le Platte', 3134, 60),
(263, 'Lendore Village', 4007, 40),
(264, 'Lengua Village', 7219, 14),
(265, 'Lengua Village/Barrackpore', 7516, 13),
(266, 'Les Efforts East', 2009, 20),
(267, 'Les Efforts West', 2008, 20),
(268, 'Libertville', 5207, 11),
(269, 'Long Circular', 1006, 10),
(270, 'Longdenville', 9814, 40),
(271, 'Lopinot Village', 3339, 80),
(272, 'Lorensotte', 8208, 15),
(273, '<NAME>', 8209, 15),
(274, '<NAME>', 8210, 15),
(275, '<NAME>/Erin', 8211, 15),
(276, 'Lothian', 7517, 13),
(277, 'Lower Hill Side', 2010, 20),
(278, 'Lower Santa Cruz', 3230, 70),
(279, 'Macaulay', 7312, 90),
(280, 'Macoya', 3306, 80),
(281, 'Madras Settlement', 4307, 90),
(282, 'Mafeking', 5109, 11),
(283, 'Mahoe', 6105, 12),
(284, 'Mainfield', 5402, 11),
(285, 'Malabar', 3004, 30),
(286, 'Malgretoute', 9923, 13),
(287, 'Malick', 3216, 70),
(288, '<NAME>', 3343, 80),
(289, 'Mamoral No. 2', 9924, 90),
(290, 'Manzanilla', 9925, 12),
(291, 'Marabella', 2016, 20),
(292, 'Marac', 7408, 13),
(293, 'Maracas', 3221, 70),
(294, '<NAME>', 3239, 70),
(295, 'Maracas/St. Joseph', 3314, 80),
(296, '<NAME>', 6607, 12),
(297, '<NAME>', 2021, 20),
(298, '<NAME>', 3138, 60),
(299, '<NAME>', 3227, 70),
(300, 'Matelot', 6106, 12),
(301, 'Matilda', 7518, 13),
(302, 'Matura', 6302, 12),
(303, 'Maturita', 9815, 30),
(304, 'Mausica', 9927, 80),
(305, 'Mayaro', 5305, 11),
(306, 'Mayo', 7313, 90),
(307, '<NAME>', 4417, 90),
(308, 'Melajo', 6202, 12),
(309, 'Mendez Village', 8113, 14),
(310, 'Mission', 6107, 12),
(311, '<NAME>', 8114, 15),
(312, '<NAME>ir/Silver Stream', 8308, 15),
(313, '<NAME>pos', 2005, 20),
(314, 'Mon Repos', 3215, 70),
(315, '<NAME>', 7221, 14),
(316, '<NAME>', 6108, 12),
(317, 'Montrose Village', 4018, 40),
(318, 'Mora Settlement', 5110, 11),
(319, '<NAME>', 6406, 12),
(320, '<NAME>', 8115, 14),
(321, 'Moruga Village', 7410, 13),
(322, 'Morvant', 3213, 70),
(323, 'Mount D'or', 3237, 70),
(324, 'Mount Pleasant', 3007, 30),
(325, 'Mount Pleasant', 4418, 90),
(326, 'Mount St. Benedict', 3322, 80),
(327, '<NAME>', 3224, 70),
(328, '<NAME>', 3223, 70),
(329, '<NAME>', 3602, 90),
(330, 'Munroe Settlement', 4002, 40),
(331, 'Nancoo Village', 4308, 90),
(332, 'Navet Village', 2007, 20),
(333, 'Navet Village', 9928, 11),
(334, 'Never Dirty', 3228, 70),
(335, 'New Grant', 9929, 13),
(336, 'New Village', 8002, 50),
(337, 'Newlands', 8009, 50),
(338, 'Newtown', 1007, 10),
(339, 'North Manzanilla', 6407, 12),
(340, 'North Post', 3131, 60),
(341, 'O'meara Road', 3002, 30),
(342, 'Olton Road', 3411, 80),
(343, 'Orange Valley', 4419, 90),
(344, 'Oropouche', 6408, 12),
(345, 'Oropouche', 8116, 15),
(346, 'Oropuna Village/Piarco', 3330, 80),
(347, 'Ortoire', 5306, 11),
(348, 'Ouplay Village', 4420, 90),
(349, 'Palmiste', 4214, 90),
(350, 'Palmiste', 7222, 14),
(351, 'Palmyra', 7223, 13),
(352, 'Palmyra Village/Mt. Pleasant', 7224, 13),
(353, '<NAME>', 8212, 15),
(354, 'Paradise', 2011, 20),
(355, '<NAME>', 3309, 80),
(356, 'Paramin', 3135, 60),
(357, 'Parforce', 7314, 90),
(358, '<NAME> South', 8311, 15),
(359, 'Pasea Extension', 3304, 80),
(360, '<NAME>illage', 3128, 60),
(361, 'Penal', 8117, 14),
(362, 'Penal Quinam Beach Road', 8119, 14),
(363, 'Penal Rock Road', 8118, 14),
(364, 'Pepper Village', 4115, 90),
(365, 'Pepper Village', 8120, 15),
(366, 'Petersfield', 4015, 40),
(367, '<NAME>', 3217, 70),
(368, '<NAME>', 7521, 13),
(369, '<NAME>', 3236, 70),
(370, '<NAME>', 7225, 13),
(371, '<NAME>', 3133, 60),
(372, 'PETROTRIN (Point A Pierre)', 7323, 90),
(373, 'Peytonville', 3410, 80),
(374, 'Philipines', 7226, 14),
(375, 'Phoenix Park', 4421, 90),
(376, 'Picton', 3203, 70),
(377, 'Picton', 7227, 14),
(378, '<NAME>', 3413, 80),
(379, 'Piparo', 9816, 13),
(380, 'Plaisance', 5307, 11),
(381, 'Plaisance Park', 7316, 90),
(382, 'Pleasantville', 2006, 20),
(383, '<NAME>', 6603, 12),
(384, 'Point Cumana', 3106, 60),
(385, 'Point D'or', 8312, 15),
(386, 'Point Fortin Proper', 8010, 50),
(387, 'Point Ligoure', 8005, 50),
(388, 'Point Lisas (Industrial Estate)', 4422, 90),
(389, 'Point Lisas (NHA)', 4423, 90),
(390, 'Poole', 5209, 11),
(391, 'Poonah', 7317, 90),
(392, 'Port of Spain Port Area', 1014, 10),
(393, 'Port of Spain Proper', 1013, 10),
(394, 'Powder Magazine', 3109, 60),
(395, 'Preysal', 4116, 90),
(396, 'Princes Town Proper', 7523, 13),
(397, 'Quarry Village', 8121, 15),
(398, 'Radix', 5308, 11),
(399, 'Rambert Village', 7228, 14),
(400, 'Rampanalgas', 6303, 12),
(401, '<NAME>', 8213, 15),
(402, 'Ravine Sable', 4215, 90),
(403, 'Real Springs', 3324, 80),
(404, 'Redhill', 3337, 80),
(405, 'Reform Village', 7524, 13),
(406, '<NAME>', 3112, 60),
(407, '<NAME>', 9931, 11),
(408, 'River Estate', 3129, 60),
(409, 'Riversdale', 7318, 90),
(410, '<NAME>/Siparia', 8122, 15),
(411, '<NAME>', 7105, 13),
(412, 'Rochard Road', 8123, 14),
(413, '<NAME>', 3226, 70),
(414, 'Rousillac', 8314, 15),
(415, 'Salazar Village', 8316, 15),
(416, 'Salibya Village', 6304, 12),
(417, '<NAME>', 3233, 70),
(418, 'Samaroo Village', 3412, 80),
(419, '<NAME>', 9818, 14),
(420, '<NAME>', 3210, 70),
(421, '<NAME>', 9819, 11),
(422, '<NAME>/Brazil', 3601, 90),
(423, '<NAME>', 6109, 12),
(424, '<NAME>', 9932, 12),
(425, '<NAME>', 9933, 12),
(426, '<NAME>', 3232, 70),
(427, '<NAME>', 8214, 15),
(428, '<NAME>', 3321, 80),
(429, 'Santa Rosa Heights', 3414, 80),
(430, '<NAME>', 3136, 60),
(431, 'Scott Road Village', 8125, 14),
(432, 'Sealots', 1008, 10),
(433, 'Sherwood Park', 3403, 80),
(434, 'Simeon Road', 3110, 60),
(435, 'Siparia', 8127, 15),
(436, 'Sisters Village', 7525, 13),
(437, 'Sixth Company', 7106, 13),
(438, 'Sobo Village', 8315, 15),
(439, 'Soconusco', 3234, 70),
(440, 'Spring Village', 3318, 80),
(441, 'Spring Village', 4117, 90),
(442, 'Spring Village', 4424, 90),
(443, 'Springland/San Fabian', 7319, 90),
(444, 'St. Andrew's Village', 4425, 90),
(445, 'St. Anns', 3202, 70),
(446, 'St. Augustine', 3303, 80),
(447, 'St. Augustine South', 3325, 80),
(448, 'St. Barbs', 3205, 70),
(449, 'St. Charles Village', 4009, 40),
(450, 'St. Charles Village', 7229, 13),
(451, 'St. Clair', 1009, 10),
(452, 'St. Clements', 7230, 13),
(453, 'St. Croix Village', 9820, 13),
(454, 'St. Helena Village', 9935, 80),
(455, 'St. James', 1010, 10),
(456, 'St. John', 8128, 15),
(457, 'St. John's Village', 3323, 80),
(458, 'St. John's Village', 9821, 13),
(459, 'St. Joseph', 3301, 80),
(460, 'St. Joseph Village', 2004, 20),
(461, 'St. Joseph Village', 5309, 11),
(462, 'St. Julien', 7527, 13),
(463, 'St. Lucien Road', 3132, 60),
(464, 'St. Madeline', 7232, 13),
(465, 'St. Margaret', 7320, 90),
(466, 'St. Mary's Village', 8129, 15),
(467, 'St. Mary's Village', 9936, 13),
(468, 'St. Mary's Village (Freeport)', 9944, 90),
(469, 'St. Thomas Village', 4017, 40),
(470, 'Sudama Village', 8130, 15),
(471, 'Sum Sum Hill', 7321, 90),
(472, 'Surrey Village', 3338, 80),
(473, 'Syne Village', 9823, 14),
(474, 'Tabaquite', 4118, 90),
(475, 'Tableland', 7108, 13),
(476, 'Tacarigua', 3305, 80),
(477, 'Talparo', 3603, 90),
(478, 'Tamana', 9937, 12),
(479, 'Tamana Road', 3604, 90),
(480, 'Tarouba', 2015, 20),
(481, 'Techier Village', 8011, 50),
(482, 'Thick Village', 8132, 15),
(483, 'Tobago', 1000, 1000),
(484, 'Toco', 6110, 12),
(485, 'Todd's Road', 4217, 90),
(486, 'Todd's Station', 9938, 90),
(487, 'Tompire', 6111, 12),
(488, 'Tortuga', 9939, 90),
(489, 'Trincity', 3345, 80),
(490, 'Tulsa Village', 9822, 14),
(491, 'Tumpuna Road', 3005, 30),
(492, 'Tumpuna Road', 3417, 80),
(493, 'Tunapuna', 3302, 80),
(494, 'Turure', 6411, 12),
(495, 'Union Park', 2014, 20),
(496, 'Union Village', 2001, 20),
(497, 'Union Village', 5113, 11),
(498, 'Union Village', 7324, 90),
(499, 'Upper Belmont', 3204, 70),
(500, 'Upper St. James', 3145, 60),
(501, '<NAME>', 7234, 13),
(502, 'Valencia', 9940, 12),
(503, 'Val<NAME>', 3317, 80),
(504, 'Valsay', 9941, 80),
(505, 'Vance River', 8318, 15),
(506, 'Vessigny', 8319, 15),
(507, '<NAME>', 3118, 60),
(508, 'Victoria Village', 2018, 20),
(509, 'Vistabella', 2002, 20),
(510, 'Waddle Village', 8215, 15),
(511, 'Wallerfield', 3416, 80),
(512, 'Warren Village', 4311, 80),
(513, 'Warren Village', 4427, 90),
(514, 'Water Hole', 3120, 60),
(515, 'Waterloo', 4219, 90),
(516, 'Welcome', 4220, 90),
(517, 'Wellington', 7235, 14),
(518, 'West Moorings', 3108, 60),
(519, 'White Land', 7325, 90),
(520, 'Woodbrook', 1011, 10);
/*!40000 ALTER TABLE `communities` ENABLE KEYS */;
-- Dumping structure for table msdfs_forms_db.cron_log
DROP TABLE IF EXISTS `cron_log`;
CREATE TABLE IF NOT EXISTS `cron_log` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`job` varchar(50) CHARACTER SET latin1 NOT NULL,
`details` text CHARACTER SET latin1 DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT current_timestamp(),
`updated_at` datetime NOT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ROW_FORMAT=DYNAMIC;
-- Dumping data for table msdfs_forms_db.cron_log: ~0 rows (approximately)
/*!40000 ALTER TABLE `cron_log` DISABLE KEYS */;
/*!40000 ALTER TABLE `cron_log` ENABLE KEYS */;
-- Dumping structure for table msdfs_forms_db.dashboard_data
DROP TABLE IF EXISTS `dashboard_data`;
CREATE TABLE IF NOT EXISTS `dashboard_data` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(150) COLLATE utf8_unicode_ci NOT NULL,
`slug` varchar(150) COLLATE utf8_unicode_ci NOT NULL,
`description` mediumtext COLLATE utf8_unicode_ci DEFAULT NULL,
`value` mediumtext COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`id`) USING BTREE,
UNIQUE KEY `slug` (`slug`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ROW_FORMAT=DYNAMIC;
-- Dumping data for table msdfs_forms_db.dashboard_data: ~0 rows (approximately)
/*!40000 ALTER TABLE `dashboard_data` DISABLE KEYS */;
/*!40000 ALTER TABLE `dashboard_data` ENABLE KEYS */;
-- Dumping structure for table msdfs_forms_db.disasters
DROP TABLE IF EXISTS `disasters`;
CREATE TABLE IF NOT EXISTS `disasters` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`slug` varchar(150) NOT NULL,
`disaster` varchar(150) NOT NULL,
PRIMARY KEY (`id`) USING BTREE,
UNIQUE KEY `country` (`disaster`) USING BTREE,
UNIQUE KEY `slug` (`slug`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC;
-- Dumping data for table msdfs_forms_db.disasters: ~4 rows (approximately)
/*!40000 ALTER TABLE `disasters` DISABLE KEYS */;
INSERT INTO `disasters` (`id`, `slug`, `disaster`) VALUES
(1, 'flooding', 'Flooding'),
(2, 'fire', 'Fire'),
(3, 'land_slide', 'Land Slide'),
(4, 'earthquake', 'Earthquake'),
(5, 'other_disaster', 'Other');
/*!40000 ALTER TABLE `disasters` ENABLE KEYS */;
-- Dumping structure for table msdfs_forms_db.document_types
DROP TABLE IF EXISTS `document_types`;
CREATE TABLE IF NOT EXISTS `document_types` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`type` varchar(150) NOT NULL,
`mime` varchar(150) NOT NULL,
`icon` varchar(150) NOT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC;
-- Dumping data for table msdfs_forms_db.document_types: ~6 rows (approximately)
/*!40000 ALTER TABLE `document_types` DISABLE KEYS */;
INSERT INTO `document_types` (`id`, `type`, `mime`, `icon`) VALUES
(1, 'PDF', 'application/pdf', 'fa-file-pdf-o'),
(2, 'MS Word Docx', 'application/msword', 'fa-file-word-o'),
(3, 'MS Word Doc', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'fa-file-word-o'),
(4, 'Text', 'text/plain', 'fa-file-text-o'),
(5, 'PNG Image', 'image/png', 'fa-image'),
(6, 'JPG Image', 'image/jpg', 'fa-image'),
(7, 'Jpeg Image', 'image/jpeg', 'fa-image');
/*!40000 ALTER TABLE `document_types` ENABLE KEYS */;
-- Dumping structure for table msdfs_forms_db.email_log
DROP TABLE IF EXISTS `email_log`;
CREATE TABLE IF NOT EXISTS `email_log` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`subject` text CHARACTER SET latin1 NOT NULL,
`details` text CHARACTER SET latin1 NOT NULL,
`created_at` timestamp NOT NULL DEFAULT current_timestamp(),
`updated_at` datetime NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ROW_FORMAT=DYNAMIC;
-- Dumping data for table msdfs_forms_db.email_log: ~0 rows (approximately)
/*!40000 ALTER TABLE `email_log` DISABLE KEYS */;
/*!40000 ALTER TABLE `email_log` ENABLE KEYS */;
-- Dumping structure for table msdfs_forms_db.employment_list
DROP TABLE IF EXISTS `employment_list`;
CREATE TABLE IF NOT EXISTS `employment_list` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`slug` varchar(150) NOT NULL,
`employment_classification` varchar(150) NOT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC;
-- Dumping data for table msdfs_forms_db.employment_list: ~4 rows (approximately)
/*!40000 ALTER TABLE `employment_list` DISABLE KEYS */;
INSERT INTO `employment_list` (`id`, `slug`, `employment_classification`) VALUES
(1, 'retrenched', 'Retrenched'),
(2, 'terminated', 'Terminated'),
(3, 'income_loss', 'Loss of Income'),
(4, 'income_reduced', 'Income Reduced'),
(5, 'reduced_income', 'Reduced Income');
/*!40000 ALTER TABLE `employment_list` ENABLE KEYS */;
-- Dumping structure for table msdfs_forms_db.employment_status
DROP TABLE IF EXISTS `employment_status`;
CREATE TABLE IF NOT EXISTS `employment_status` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`status` varchar(150) NOT NULL,
PRIMARY KEY (`id`) USING BTREE,
UNIQUE KEY `country` (`status`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC;
-- Dumping data for table msdfs_forms_db.employment_status: ~11 rows (approximately)
/*!40000 ALTER TABLE `employment_status` DISABLE KEYS */;
INSERT INTO `employment_status` (`id`, `status`) VALUES
(1, 'Employed'),
(6, 'Other'),
(4, 'Pensioner'),
(7, 'Primary Student'),
(10, 'Retiree – NIS'),
(11, 'Retiree – Pensioner'),
(8, 'Secondary Student'),
(2, 'Self-Employed'),
(9, 'Tertiary Student'),
(3, 'Unemployed');
/*!40000 ALTER TABLE `employment_status` ENABLE KEYS */;
-- Dumping structure for table msdfs_forms_db.error_log
DROP TABLE IF EXISTS `error_log`;
CREATE TABLE IF NOT EXISTS `error_log` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`user` text COLLATE utf8_unicode_ci DEFAULT NULL,
`ip` text COLLATE utf8_unicode_ci DEFAULT NULL,
`action` text COLLATE utf8_unicode_ci DEFAULT NULL,
`exception` text COLLATE utf8_unicode_ci DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT current_timestamp(),
`updated_at` datetime NOT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ROW_FORMAT=DYNAMIC;
-- Dumping data for table msdfs_forms_db.error_log: ~3 rows (approximately)
/*!40000 ALTER TABLE `error_log` DISABLE KEYS */;
INSERT INTO `error_log` (`id`, `user`, `ip`, `action`, `exception`, `created_at`, `updated_at`) VALUES
(1, '<KEY> '<KEY> '<KEY>', '<KEY>', '2020-09-14 14:59:18', '2020-09-14 14:59:18'),
(2, '<KEY> '<KEY> '<KEY>', '<KEY>', '2020-09-14 18:35:28', '2020-09-14 18:35:28'),
(3, 'eyJpdiI6ImhPVGM5cFNtUTk2b0gwVGtTVkhLNVE9PSIsInZhbHVlIjoiZnZlTE55bnplRmVyZzhqR3Y1MzVzZ0szQTBDMlAxOVNRSkd5cEJXNDI0az0iLCJtYWMiOiI4ZGZmNjgyNzdkNmM1MmY0ZmY2Y2VmZjI3YWIyNTQzYTM0ZjA3Mjg1OGQ4MzFiODQyZDJlN2IxY2IxNzkwY2MwIn0=', 'eyJpdiI6IlVGemVHZUNmWktlNmkvT0pTNWRjSXc9PSIsInZhbHVlIjoiMEx6cU1mekVtUHdaK0JDNHFKMUVYWEVINUh5SVRUaGUvTmJFTmp5T2JIND0iLCJtYWMiOiI0MGY0NzIzNmM2Y2Q1ZmE3N2M3YWZlMzY5NjAzYzUzMjlhYjk4YTc3Zjk3ZTAzZTIxN2RhMTk0MjBmOWM1NWI0In0=', '<KEY>', '<KEY>', '2020-09-14 18:35:29', '2020-09-14 18:35:29');
/*!40000 ALTER TABLE `error_log` ENABLE KEYS */;
-- Dumping structure for table msdfs_forms_db.failed_jobs
DROP TABLE IF EXISTS `failed_jobs`;
CREATE TABLE IF NOT EXISTS `failed_jobs` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`connection` text COLLATE utf8_unicode_ci NOT NULL,
`queue` text COLLATE utf8_unicode_ci NOT NULL,
`payload` longtext COLLATE utf8_unicode_ci NOT NULL,
`failed_at` timestamp NOT NULL DEFAULT current_timestamp(),
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- Dumping data for table msdfs_forms_db.failed_jobs: ~0 rows (approximately)
/*!40000 ALTER TABLE `failed_jobs` DISABLE KEYS */;
/*!40000 ALTER TABLE `failed_jobs` ENABLE KEYS */;
-- Dumping structure for table msdfs_forms_db.forms
DROP TABLE IF EXISTS `forms`;
CREATE TABLE IF NOT EXISTS `forms` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`form` varchar(150) NOT NULL,
`slug` varchar(50) NOT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC;
-- Dumping data for table msdfs_forms_db.forms: ~2 rows (approximately)
/*!40000 ALTER TABLE `forms` DISABLE KEYS */;
INSERT INTO `forms` (`id`, `form`, `slug`) VALUES
(1, 'Form A - Employer/ Employee', 'form_a'),
(2, 'Form B - Self Employed', 'form_b'),
(3, 'Critical Incident Form', 'critical_incident');
/*!40000 ALTER TABLE `forms` ENABLE KEYS */;
-- Dumping structure for table msdfs_forms_db.form_a
DROP TABLE IF EXISTS `form_a`;
CREATE TABLE IF NOT EXISTS `form_a` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`application_id` bigint(20) unsigned NOT NULL,
`employment_list_id` int(10) unsigned NOT NULL,
`effective_date` date NOT NULL,
`employer_name` text NOT NULL,
`employer_address` text NOT NULL,
`employer_authorized_person` text NOT NULL,
`employer_contact` text NOT NULL,
PRIMARY KEY (`id`) USING BTREE,
KEY `FK_form_a_applications` (`application_id`),
KEY `FK_form_a_employment_list` (`employment_list_id`),
CONSTRAINT `FK_form_a_applications` FOREIGN KEY (`application_id`) REFERENCES `applications` (`id`),
CONSTRAINT `FK_form_a_employment_list` FOREIGN KEY (`employment_list_id`) REFERENCES `employment_list` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC;
-- Dumping data for table msdfs_forms_db.form_a: ~0 rows (approximately)
/*!40000 ALTER TABLE `form_a` DISABLE KEYS */;
/*!40000 ALTER TABLE `form_a` ENABLE KEYS */;
-- Dumping structure for table msdfs_forms_db.form_b
DROP TABLE IF EXISTS `form_b`;
CREATE TABLE IF NOT EXISTS `form_b` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`application_id` bigint(20) unsigned NOT NULL,
`employment_list_id` int(10) unsigned NOT NULL,
`effective_date` date NOT NULL,
`recommender_first_name` text NOT NULL,
`recommender_surname` text NOT NULL,
`recommender_gender` varchar(1) NOT NULL,
`recommender_job_title_id` int(10) unsigned NOT NULL,
`recommender_job_title_info` text DEFAULT NULL,
`recommender_contact_no` text NOT NULL,
`recommender_email` text DEFAULT NULL,
`recommender_home_address` text NOT NULL,
`recommender_city_town_id` int(10) unsigned NOT NULL,
`recommender_years_known` tinyint(4) NOT NULL DEFAULT 0,
PRIMARY KEY (`id`) USING BTREE,
KEY `FK_form_b_applications` (`application_id`),
KEY `FK_form_b_employment_list` (`employment_list_id`),
KEY `FK_form_b_job_titles` (`recommender_job_title_id`),
KEY `FK_form_b_communities` (`recommender_city_town_id`),
CONSTRAINT `FK_form_b_applications` FOREIGN KEY (`application_id`) REFERENCES `applications` (`id`),
CONSTRAINT `FK_form_b_communities` FOREIGN KEY (`recommender_city_town_id`) REFERENCES `communities` (`id`),
CONSTRAINT `FK_form_b_employment_list` FOREIGN KEY (`employment_list_id`) REFERENCES `employment_list` (`id`),
CONSTRAINT `FK_form_b_job_titles` FOREIGN KEY (`recommender_job_title_id`) REFERENCES `job_titles` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC;
-- Dumping data for table msdfs_forms_db.form_b: ~0 rows (approximately)
/*!40000 ALTER TABLE `form_b` DISABLE KEYS */;
/*!40000 ALTER TABLE `form_b` ENABLE KEYS */;
-- Dumping structure for table msdfs_forms_db.form_ci_items_lost
DROP TABLE IF EXISTS `form_ci_items_lost`;
CREATE TABLE IF NOT EXISTS `form_ci_items_lost` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`form_critical_incident_id` bigint(20) unsigned NOT NULL,
`item_id` int(10) unsigned NOT NULL,
`recommended` int(1) NOT NULL DEFAULT 0,
`approved` int(1) NOT NULL DEFAULT 0,
`cost` decimal(10,2) DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE,
KEY `FK_form_ci_items_lost_form_critical_incident` (`form_critical_incident_id`),
KEY `FK_form_ci_items_lost_items_lost_or_damaged` (`item_id`),
CONSTRAINT `FK_form_ci_items_lost_form_critical_incident` FOREIGN KEY (`form_critical_incident_id`) REFERENCES `form_critical_incident` (`id`),
CONSTRAINT `FK_form_ci_items_lost_items_lost_or_damaged` FOREIGN KEY (`item_id`) REFERENCES `items_lost_or_damaged` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC;
-- Dumping data for table msdfs_forms_db.form_ci_items_lost: ~0 rows (approximately)
/*!40000 ALTER TABLE `form_ci_items_lost` DISABLE KEYS */;
/*!40000 ALTER TABLE `form_ci_items_lost` ENABLE KEYS */;
-- Dumping structure for table msdfs_forms_db.form_critical_incident
DROP TABLE IF EXISTS `form_critical_incident`;
CREATE TABLE IF NOT EXISTS `form_critical_incident` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`application_id` bigint(20) unsigned NOT NULL,
`disaster_id` int(10) unsigned NOT NULL,
`disaster_other` text DEFAULT NULL,
`housing_damage` varchar(1) DEFAULT NULL,
`housing_repairs` text DEFAULT NULL,
`insured` varchar(1) DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE,
KEY `FK_form_critical_incident_applications` (`application_id`),
KEY `FK_form_critical_incident_disasters` (`disaster_id`),
CONSTRAINT `FK_form_critical_incident_applications` FOREIGN KEY (`application_id`) REFERENCES `applications` (`id`),
CONSTRAINT `FK_form_critical_incident_disasters` FOREIGN KEY (`disaster_id`) REFERENCES `disasters` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC;
-- Dumping data for table msdfs_forms_db.form_critical_incident: ~0 rows (approximately)
/*!40000 ALTER TABLE `form_critical_incident` DISABLE KEYS */;
/*!40000 ALTER TABLE `form_critical_incident` ENABLE KEYS */;
-- Dumping structure for table msdfs_forms_db.households
DROP TABLE IF EXISTS `households`;
CREATE TABLE IF NOT EXISTS `households` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`housing_type_id` int(10) unsigned DEFAULT NULL,
`address1` text NOT NULL,
`address2` text DEFAULT NULL,
`community_id` int(10) unsigned NOT NULL,
`total_income_id` int(10) unsigned DEFAULT NULL,
`total_income` decimal(10,2) DEFAULT NULL,
`active` int(1) NOT NULL DEFAULT 1,
`created_at` timestamp NOT NULL DEFAULT current_timestamp(),
`updated_at` datetime DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE,
KEY `FK_households_housing_types` (`housing_type_id`),
KEY `FK_households_communities` (`community_id`),
KEY `FK_households_total_income` (`total_income_id`),
CONSTRAINT `FK_households_communities` FOREIGN KEY (`community_id`) REFERENCES `communities` (`id`),
CONSTRAINT `FK_households_housing_types` FOREIGN KEY (`housing_type_id`) REFERENCES `housing_types` (`id`),
CONSTRAINT `FK_households_total_income` FOREIGN KEY (`total_income_id`) REFERENCES `total_income` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC;
-- Dumping data for table msdfs_forms_db.households: ~0 rows (approximately)
/*!40000 ALTER TABLE `households` DISABLE KEYS */;
/*!40000 ALTER TABLE `households` ENABLE KEYS */;
-- Dumping structure for table msdfs_forms_db.housing_types
DROP TABLE IF EXISTS `housing_types`;
CREATE TABLE IF NOT EXISTS `housing_types` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`type` varchar(150) NOT NULL,
PRIMARY KEY (`id`) USING BTREE,
UNIQUE KEY `country` (`type`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC;
-- Dumping data for table msdfs_forms_db.housing_types: ~4 rows (approximately)
/*!40000 ALTER TABLE `housing_types` DISABLE KEYS */;
INSERT INTO `housing_types` (`id`, `type`) VALUES
(3, 'Free Lodging'),
(2, 'Owner'),
(4, 'Renter/Tenant'),
(1, 'Squatter');
/*!40000 ALTER TABLE `housing_types` ENABLE KEYS */;
-- Dumping structure for table msdfs_forms_db.id_states
DROP TABLE IF EXISTS `id_states`;
CREATE TABLE IF NOT EXISTS `id_states` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`id_state` varchar(150) NOT NULL,
PRIMARY KEY (`id`) USING BTREE,
UNIQUE KEY `country` (`id_state`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC;
-- Dumping data for table msdfs_forms_db.id_states: ~3 rows (approximately)
/*!40000 ALTER TABLE `id_states` DISABLE KEYS */;
INSERT INTO `id_states` (`id`, `id_state`) VALUES
(2, 'Currently lost but have police report'),
(1, 'Have identification card'),
(3, 'Possess an EBC letter');
/*!40000 ALTER TABLE `id_states` ENABLE KEYS */;
-- Dumping structure for table msdfs_forms_db.insurers
DROP TABLE IF EXISTS `insurers`;
CREATE TABLE IF NOT EXISTS `insurers` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`form_critical_incident_id` bigint(20) unsigned NOT NULL,
`insurer_name` text NOT NULL,
`insurer_address` text NOT NULL,
`insurer_contact` text DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE,
KEY `FK_insurers_form_critical_incident` (`form_critical_incident_id`),
CONSTRAINT `FK_insurers_form_critical_incident` FOREIGN KEY (`form_critical_incident_id`) REFERENCES `form_critical_incident` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC;
-- Dumping data for table msdfs_forms_db.insurers: ~0 rows (approximately)
/*!40000 ALTER TABLE `insurers` DISABLE KEYS */;
/*!40000 ALTER TABLE `insurers` ENABLE KEYS */;
-- Dumping structure for table msdfs_forms_db.items_lost_or_damaged
DROP TABLE IF EXISTS `items_lost_or_damaged`;
CREATE TABLE IF NOT EXISTS `items_lost_or_damaged` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`slug` varchar(150) NOT NULL,
`item` varchar(150) NOT NULL,
`max_value` decimal(10,2) DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC;
-- Dumping data for table msdfs_forms_db.items_lost_or_damaged: ~12 rows (approximately)
/*!40000 ALTER TABLE `items_lost_or_damaged` DISABLE KEYS */;
INSERT INTO `items_lost_or_damaged` (`id`, `slug`, `item`, `max_value`) VALUES
(1, 'stove', 'Stove', 2500.00),
(2, 'refrigerator', 'Refrigerator', 4000.00),
(3, 'washing_machine', 'Washing Machine', 3500.00),
(4, 'bed_mattress', 'Bed & Mattress', 2000.00),
(5, 'wardrobe', 'Wardrobe', 3000.00),
(6, 'chest_of_drawers', 'Chest of Drawers', 2000.00),
(7, 'living_room_set', 'Living Room Set', 3500.00),
(8, 'dining_room_set', 'Dining Room Set', 3500.00),
(9, 'kitchen_cupboards', 'Kitchen Cupboards', 2000.00),
(10, 'school_supplies_primary', 'School Supplies (Primary)', 700.00),
(11, 'school_supplies_secondary', 'School Supplies (Secondary)', 1000.00),
(12, 'clothing', 'Clothing', 1000.00);
/*!40000 ALTER TABLE `items_lost_or_damaged` ENABLE KEYS */;
-- Dumping structure for table msdfs_forms_db.jobs
DROP TABLE IF EXISTS `jobs`;
CREATE TABLE IF NOT EXISTS `jobs` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`queue` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`payload` longtext COLLATE utf8_unicode_ci NOT NULL,
`attempts` tinyint(3) unsigned NOT NULL,
`reserved` tinyint(3) unsigned NOT NULL,
`reserved_at` int(10) unsigned DEFAULT NULL,
`available_at` int(10) unsigned NOT NULL,
`created_at` int(10) unsigned NOT NULL,
PRIMARY KEY (`id`),
KEY `jobs_queue_reserved_reserved_at_index` (`queue`,`reserved`,`reserved_at`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- Dumping data for table msdfs_forms_db.jobs: ~0 rows (approximately)
/*!40000 ALTER TABLE `jobs` DISABLE KEYS */;
/*!40000 ALTER TABLE `jobs` ENABLE KEYS */;
-- Dumping structure for table msdfs_forms_db.job_titles
DROP TABLE IF EXISTS `job_titles`;
CREATE TABLE IF NOT EXISTS `job_titles` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`title` varchar(150) NOT NULL,
`label` varchar(150) DEFAULT NULL,
`help` varchar(150) DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC;
-- Dumping data for table msdfs_forms_db.job_titles: ~18 rows (approximately)
/*!40000 ALTER TABLE `job_titles` DISABLE KEYS */;
INSERT INTO `job_titles` (`id`, `title`, `label`, `help`) VALUES
(1, 'Minister of Religion', NULL, NULL),
(2, 'Managing Director, Director or Manager', NULL, NULL),
(3, 'Professionals (University Graduates)', 'Qualification', 'The level of certification.'),
(4, 'Member of Parliament', NULL, NULL),
(5, 'Mayor', NULL, NULL),
(6, 'Borough or County Councilor', NULL, NULL),
(7, 'Notary Public', NULL, NULL),
(8, 'Justice of the Peace', NULL, NULL),
(9, 'Commissioner of Affidavits', NULL, NULL),
(10, 'Senior Public Servants Range 30+', 'Range', 'Range of public servant officer.'),
(11, 'Police Officer Corporal+', 'Regimental Number', 'Number issued to officer.'),
(12, 'Prison Officer II +', 'Regimental Number', 'Number issued to officer.'),
(13, 'Fire Sub-Officer +', 'Regimental Number', 'Number issued to officer.'),
(14, 'Member of Defense Force Corporal/Leading Seaman+', 'Regimental Number', 'Number issued to officer.'),
(15, 'School Principal', NULL, NULL),
(16, 'Vice-Principal', NULL, NULL),
(17, 'Lecturer', NULL, NULL),
(18, 'Graduate Teacher I +', NULL, NULL);
/*!40000 ALTER TABLE `job_titles` ENABLE KEYS */;
-- Dumping structure for table msdfs_forms_db.landlords
DROP TABLE IF EXISTS `landlords`;
CREATE TABLE IF NOT EXISTS `landlords` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`household_id` bigint(20) unsigned NOT NULL,
`first_name` text NOT NULL,
`surname` text NOT NULL,
`contact` text NOT NULL,
`rental_amount` double(10,2) NOT NULL,
`active` int(1) NOT NULL DEFAULT 1,
`created_at` timestamp NOT NULL DEFAULT current_timestamp(),
`updated_at` datetime DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE,
KEY `FK_landlords_households` (`household_id`),
CONSTRAINT `FK_landlords_households` FOREIGN KEY (`household_id`) REFERENCES `households` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC;
-- Dumping data for table msdfs_forms_db.landlords: ~0 rows (approximately)
/*!40000 ALTER TABLE `landlords` DISABLE KEYS */;
/*!40000 ALTER TABLE `landlords` ENABLE KEYS */;
-- Dumping structure for table msdfs_forms_db.local_boards
DROP TABLE IF EXISTS `local_boards`;
CREATE TABLE IF NOT EXISTS `local_boards` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`local_board` varchar(150) NOT NULL,
`area` varchar(150) NOT NULL,
`letter` varchar(5) NOT NULL,
PRIMARY KEY (`id`) USING BTREE,
UNIQUE KEY `country` (`local_board`) USING BTREE,
UNIQUE KEY `code` (`letter`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC;
-- Dumping data for table msdfs_forms_db.local_boards: ~9 rows (approximately)
/*!40000 ALTER TABLE `local_boards` DISABLE KEYS */;
INSERT INTO `local_boards` (`id`, `local_board`, `area`, `letter`) VALUES
(1, 'St George Central', 'Aranguez', 'A'),
(2, 'St George East', 'Tunapuna', 'B'),
(3, 'Caroni', 'Chaguanas', 'C'),
(4, 'St Andrews/St David', '<NAME>', 'DE'),
(5, '<NAME>/Mayaro', '<NAME>', 'F'),
(6, 'Victoria West', 'San Fernando', 'G'),
(7, 'Victoria East', 'Princes Town', 'H'),
(8, 'St Patrick East', 'Penal', 'J'),
(9, 'St Patrick West', 'Point Fortin', 'K'),
(10, 'Tobago', 'Tobago', 'L'),
(11, 'St George West', 'POS', 'M');
/*!40000 ALTER TABLE `local_boards` ENABLE KEYS */;
-- Dumping structure for table msdfs_forms_db.marital_status
DROP TABLE IF EXISTS `marital_status`;
CREATE TABLE IF NOT EXISTS `marital_status` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`status` varchar(150) NOT NULL,
PRIMARY KEY (`id`) USING BTREE,
UNIQUE KEY `country` (`status`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC;
-- Dumping data for table msdfs_forms_db.marital_status: ~6 rows (approximately)
/*!40000 ALTER TABLE `marital_status` DISABLE KEYS */;
INSERT INTO `marital_status` (`id`, `status`) VALUES
(3, 'Common-Law'),
(2, 'Married'),
(6, 'Other'),
(4, 'Separated'),
(1, 'Single'),
(5, 'Widow');
/*!40000 ALTER TABLE `marital_status` ENABLE KEYS */;
-- Dumping structure for table msdfs_forms_db.migrations
DROP TABLE IF EXISTS `migrations`;
CREATE TABLE IF NOT EXISTS `migrations` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`migration` varchar(191) 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;
-- Dumping data for table msdfs_forms_db.migrations: ~2 rows (approximately)
/*!40000 ALTER TABLE `migrations` DISABLE KEYS */;
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);
/*!40000 ALTER TABLE `migrations` ENABLE KEYS */;
-- Dumping structure for table msdfs_forms_db.password_resets
DROP TABLE IF EXISTS `password_resets`;
CREATE TABLE IF NOT EXISTS `password_resets` (
`email` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`token` varchar(191) 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;
-- Dumping data for table msdfs_forms_db.password_resets: ~0 rows (approximately)
/*!40000 ALTER TABLE `password_resets` DISABLE KEYS */;
/*!40000 ALTER TABLE `password_resets` ENABLE KEYS */;
-- Dumping structure for table msdfs_forms_db.people
DROP TABLE IF EXISTS `people`;
CREATE TABLE IF NOT EXISTS `people` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`first_name` text NOT NULL,
`surname` text NOT NULL,
`othername` text DEFAULT NULL,
`email` text DEFAULT NULL,
`gender` char(1) NOT NULL,
`citizen` char(1) DEFAULT NULL,
`dob` date NOT NULL,
`marital_status_id` int(10) unsigned DEFAULT NULL,
`marital_status_other` text DEFAULT NULL,
`national_id` bigint(20) DEFAULT NULL,
`national_id_state_id` int(10) unsigned DEFAULT NULL,
`drivers_permit` text DEFAULT NULL,
`passport` text DEFAULT NULL,
`nis` text DEFAULT NULL,
`employment_status_id` int(10) unsigned NOT NULL,
`employment_status_other` text DEFAULT NULL,
`job_title` text DEFAULT NULL,
`primary_mobile_contact` text DEFAULT NULL,
`secondary_mobile_contact` text DEFAULT NULL,
`land_line_telephone_contact` text DEFAULT NULL,
`income_id` int(10) unsigned DEFAULT NULL,
`income` decimal(10,2) DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT current_timestamp(),
`updated_at` datetime DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE,
KEY `FK_persons_id_states` (`national_id_state_id`),
KEY `FK_persons_employment_status` (`employment_status_id`),
KEY `FK_persons_total_income` (`income_id`),
KEY `FK_persons_marital_status` (`marital_status_id`),
CONSTRAINT `FK_persons_employment_status` FOREIGN KEY (`employment_status_id`) REFERENCES `employment_status` (`id`),
CONSTRAINT `FK_persons_id_states` FOREIGN KEY (`national_id_state_id`) REFERENCES `id_states` (`id`),
CONSTRAINT `FK_persons_marital_status` FOREIGN KEY (`marital_status_id`) REFERENCES `marital_status` (`id`),
CONSTRAINT `FK_persons_total_income` FOREIGN KEY (`income_id`) REFERENCES `total_income` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC;
-- Dumping data for table msdfs_forms_db.people: ~0 rows (approximately)
/*!40000 ALTER TABLE `people` DISABLE KEYS */;
/*!40000 ALTER TABLE `people` ENABLE KEYS */;
-- Dumping structure for table msdfs_forms_db.person_bank
DROP TABLE IF EXISTS `person_bank`;
CREATE TABLE IF NOT EXISTS `person_bank` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`person_id` bigint(20) unsigned NOT NULL,
`bank_id` int(10) unsigned NOT NULL,
`scotia_branch_id` int(10) unsigned DEFAULT NULL,
`branch` text DEFAULT NULL,
`account` text DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT current_timestamp(),
`updated_at` datetime DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE,
KEY `FK_person_household_persons` (`person_id`) USING BTREE,
KEY `FK_person_bank_banks` (`bank_id`),
KEY `FK_person_bank_scotia_branches` (`scotia_branch_id`),
CONSTRAINT `FK_person_bank_banks` FOREIGN KEY (`bank_id`) REFERENCES `banks` (`id`),
CONSTRAINT `FK_person_bank_people` FOREIGN KEY (`person_id`) REFERENCES `people` (`id`),
CONSTRAINT `FK_person_bank_scotia_branches` FOREIGN KEY (`scotia_branch_id`) REFERENCES `scotia_branches` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC;
-- Dumping data for table msdfs_forms_db.person_bank: ~0 rows (approximately)
/*!40000 ALTER TABLE `person_bank` DISABLE KEYS */;
/*!40000 ALTER TABLE `person_bank` ENABLE KEYS */;
-- Dumping structure for table msdfs_forms_db.person_household
DROP TABLE IF EXISTS `person_household`;
CREATE TABLE IF NOT EXISTS `person_household` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`person_id` bigint(20) unsigned NOT NULL,
`household_id` bigint(20) unsigned NOT NULL,
`relationship_id` int(10) unsigned DEFAULT NULL,
`relationship_other` varchar(150) DEFAULT NULL,
`active` int(1) NOT NULL DEFAULT 1,
`confirm` int(1) NOT NULL DEFAULT 0,
`created_at` timestamp NOT NULL DEFAULT current_timestamp(),
`updated_at` datetime DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE,
KEY `FK_person_household_persons` (`person_id`),
KEY `FK_person_household_households` (`household_id`),
KEY `FK_person_household_relationships` (`relationship_id`),
CONSTRAINT `FK_person_household_households` FOREIGN KEY (`household_id`) REFERENCES `households` (`id`),
CONSTRAINT `FK_person_household_persons` FOREIGN KEY (`person_id`) REFERENCES `people` (`id`),
CONSTRAINT `FK_person_household_relationships` FOREIGN KEY (`relationship_id`) REFERENCES `relationships` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC;
-- Dumping data for table msdfs_forms_db.person_household: ~0 rows (approximately)
/*!40000 ALTER TABLE `person_household` DISABLE KEYS */;
/*!40000 ALTER TABLE `person_household` ENABLE KEYS */;
-- Dumping structure for table msdfs_forms_db.regions
DROP TABLE IF EXISTS `regions`;
CREATE TABLE IF NOT EXISTS `regions` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`region` varchar(150) NOT NULL,
`code` int(11) NOT NULL,
`letter` varchar(5) DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE,
UNIQUE KEY `country` (`region`) USING BTREE,
UNIQUE KEY `code` (`code`),
KEY `FK_regions_local_boards` (`letter`),
CONSTRAINT `FK_regions_local_boards` FOREIGN KEY (`letter`) REFERENCES `local_boards` (`letter`)
) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC;
-- Dumping data for table msdfs_forms_db.regions: ~15 rows (approximately)
/*!40000 ALTER TABLE `regions` DISABLE KEYS */;
INSERT INTO `regions` (`id`, `region`, `code`, `letter`) VALUES
(1, 'Tobago', 1000, 'L'),
(2, 'City of Port of Spain', 10, 'M'),
(3, 'Mayaro/<NAME>', 11, 'F'),
(4, 'Sangre Grande', 12, 'DE'),
(5, 'Princes Town', 13, 'H'),
(6, 'Penal/Debe', 14, 'J'),
(7, 'Siparia', 15, 'J'),
(8, 'City of San Fernando', 20, 'G'),
(9, 'Borough of Arima', 30, 'B'),
(10, 'Borough of Chaguanas', 40, 'C'),
(11, 'Borough of Point Fortin', 50, 'K'),
(12, '<NAME>', 60, 'M'),
(13, 'San Juan/Laventille', 70, 'A'),
(14, 'Tunapuna/Piarco', 80, 'B'),
(15, 'Couva/Tabaquite/Talparo', 90, 'C');
/*!40000 ALTER TABLE `regions` ENABLE KEYS */;
-- Dumping structure for table msdfs_forms_db.relationships
DROP TABLE IF EXISTS `relationships`;
CREATE TABLE IF NOT EXISTS `relationships` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`relationship` varchar(150) NOT NULL,
`description` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE,
UNIQUE KEY `country` (`relationship`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC;
-- Dumping data for table msdfs_forms_db.relationships: ~12 rows (approximately)
/*!40000 ALTER TABLE `relationships` DISABLE KEYS */;
INSERT INTO `relationships` (`id`, `relationship`, `description`) VALUES
(0, 'Applicant', NULL),
(1, 'Spouse', NULL),
(3, 'Sibling', NULL),
(4, 'Parent', NULL),
(5, 'Grandparent', NULL),
(6, 'Grandchild', NULL),
(7, 'Relative', NULL),
(8, 'Relative by Law', NULL),
(9, 'Other', NULL),
(10, 'Son', NULL),
(11, 'Daughter', NULL);
/*!40000 ALTER TABLE `relationships` ENABLE KEYS */;
-- Dumping structure for table msdfs_forms_db.roles
DROP TABLE IF EXISTS `roles`;
CREATE TABLE IF NOT EXISTS `roles` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`role` varchar(150) NOT NULL,
`slug` varchar(150) NOT NULL,
`description` varchar(150) DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC;
-- Dumping data for table msdfs_forms_db.roles: ~6 rows (approximately)
/*!40000 ALTER TABLE `roles` DISABLE KEYS */;
INSERT INTO `roles` (`id`, `role`, `slug`, `description`) VALUES
(1, 'Administrator', 'admin', NULL),
(2, 'Intake Officer', 'intake_officer', NULL),
(3, 'Registration Clerk', 'registration_clerk', NULL),
(4, 'Welfare Officer I', 'welfare_officer_1', NULL),
(5, 'Welfare Officer II', 'welfare_officer_2', NULL),
(6, 'Schedule Clerk', 'schedule_clerk', NULL),
(7, 'Supervisor', 'supervisor', NULL),
(8, 'Deputy Director', 'deputy_director', NULL);
/*!40000 ALTER TABLE `roles` ENABLE KEYS */;
-- Dumping structure for table msdfs_forms_db.role_permissions
DROP TABLE IF EXISTS `role_permissions`;
CREATE TABLE IF NOT EXISTS `role_permissions` (
`role_id` int(10) unsigned NOT NULL,
`status_id` int(10) unsigned NOT NULL,
`description` varchar(150) DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT current_timestamp(),
`updated_at` datetime DEFAULT NULL,
PRIMARY KEY (`role_id`,`status_id`),
KEY `FK_status_permissions_status` (`status_id`),
CONSTRAINT `FK_status_permissions_roles` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`),
CONSTRAINT `FK_status_permissions_status` FOREIGN KEY (`status_id`) REFERENCES `status` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC;
-- Dumping data for table msdfs_forms_db.role_permissions: ~10 rows (approximately)
/*!40000 ALTER TABLE `role_permissions` DISABLE KEYS */;
INSERT INTO `role_permissions` (`role_id`, `status_id`, `description`, `created_at`, `updated_at`) VALUES
(2, 1, NULL, '2020-08-09 23:05:16', NULL),
(2, 2, NULL, '2020-08-09 00:50:03', NULL),
(2, 3, NULL, '2020-08-09 00:41:38', NULL),
(3, 4, NULL, '2020-08-09 00:42:07', NULL),
(4, 5, NULL, '2020-08-09 00:44:00', NULL),
(4, 6, NULL, '2020-08-09 00:53:41', NULL),
(5, 7, NULL, '2020-08-09 00:44:34', NULL),
(7, 8, NULL, '2020-08-09 00:46:54', NULL),
(7, 9, NULL, '2020-08-09 00:47:33', NULL),
(7, 11, NULL, '2020-08-09 00:47:16', NULL);
/*!40000 ALTER TABLE `role_permissions` ENABLE KEYS */;
-- Dumping structure for table msdfs_forms_db.schedules
DROP TABLE IF EXISTS `schedules`;
CREATE TABLE IF NOT EXISTS `schedules` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`created_by` bigint(20) unsigned NOT NULL,
`type_id` int(10) unsigned NOT NULL,
`region_id` int(10) unsigned DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT current_timestamp(),
`updated_at` datetime DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE,
KEY `FK_schedules_users` (`created_by`),
KEY `FK_schedules_schedule_types` (`type_id`),
CONSTRAINT `FK_schedules_schedule_types` FOREIGN KEY (`type_id`) REFERENCES `schedule_types` (`id`),
CONSTRAINT `FK_schedules_users` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC;
-- Dumping data for table msdfs_forms_db.schedules: ~0 rows (approximately)
/*!40000 ALTER TABLE `schedules` DISABLE KEYS */;
/*!40000 ALTER TABLE `schedules` ENABLE KEYS */;
-- Dumping structure for table msdfs_forms_db.schedule_applications
DROP TABLE IF EXISTS `schedule_applications`;
CREATE TABLE IF NOT EXISTS `schedule_applications` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`schedule_id` bigint(20) unsigned NOT NULL,
`application_id` bigint(20) unsigned NOT NULL,
`number` int(11) DEFAULT NULL,
`reference_number` varchar(50) NOT NULL,
`applicant_name` text NOT NULL,
`id_card` bigint(20) NOT NULL,
`address` text NOT NULL,
`vat` decimal(10,2) NOT NULL DEFAULT 0.00,
`total` decimal(10,2) NOT NULL DEFAULT 0.00,
`supplier` text DEFAULT NULL,
`invoice` text NOT NULL,
`contact` text NOT NULL,
PRIMARY KEY (`id`) USING BTREE,
KEY `FK_schedule_applications_schedules` (`schedule_id`),
KEY `FK_schedule_applications_applications` (`application_id`),
CONSTRAINT `FK_schedule_applications_applications` FOREIGN KEY (`application_id`) REFERENCES `applications` (`id`),
CONSTRAINT `FK_schedule_applications_schedules` FOREIGN KEY (`schedule_id`) REFERENCES `schedules` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC;
-- Dumping data for table msdfs_forms_db.schedule_applications: ~0 rows (approximately)
/*!40000 ALTER TABLE `schedule_applications` DISABLE KEYS */;
/*!40000 ALTER TABLE `schedule_applications` ENABLE KEYS */;
-- Dumping structure for table msdfs_forms_db.schedule_items
DROP TABLE IF EXISTS `schedule_items`;
CREATE TABLE IF NOT EXISTS `schedule_items` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`schedule_application_id` bigint(20) unsigned NOT NULL,
`quantity` int(11) NOT NULL,
`item` text NOT NULL,
`cost` decimal(10,2) NOT NULL DEFAULT 0.00,
PRIMARY KEY (`id`) USING BTREE,
KEY `FK_schedule_items_schedule_applications` (`schedule_application_id`),
CONSTRAINT `FK_schedule_items_schedule_applications` FOREIGN KEY (`schedule_application_id`) REFERENCES `schedule_applications` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC;
-- Dumping data for table msdfs_forms_db.schedule_items: ~0 rows (approximately)
/*!40000 ALTER TABLE `schedule_items` DISABLE KEYS */;
/*!40000 ALTER TABLE `schedule_items` ENABLE KEYS */;
-- Dumping structure for table msdfs_forms_db.schedule_rent
DROP TABLE IF EXISTS `schedule_rent`;
CREATE TABLE IF NOT EXISTS `schedule_rent` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`schedule_application_id` bigint(20) unsigned NOT NULL,
`landlord` text NOT NULL,
`item` text NOT NULL,
`quantity` int(11) NOT NULL,
`amount` decimal(10,2) NOT NULL DEFAULT 0.00,
`start_date` date NOT NULL,
PRIMARY KEY (`id`) USING BTREE,
KEY `FK_schedule_items_schedule_applications` (`schedule_application_id`) USING BTREE,
CONSTRAINT `schedule_rent_ibfk_1` FOREIGN KEY (`schedule_application_id`) REFERENCES `schedule_applications` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC;
-- Dumping data for table msdfs_forms_db.schedule_rent: ~0 rows (approximately)
/*!40000 ALTER TABLE `schedule_rent` DISABLE KEYS */;
/*!40000 ALTER TABLE `schedule_rent` ENABLE KEYS */;
-- Dumping structure for table msdfs_forms_db.schedule_types
DROP TABLE IF EXISTS `schedule_types`;
CREATE TABLE IF NOT EXISTS `schedule_types` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`type` varchar(150) NOT NULL,
PRIMARY KEY (`id`) USING BTREE,
UNIQUE KEY `country` (`type`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC;
-- Dumping data for table msdfs_forms_db.schedule_types: ~4 rows (approximately)
/*!40000 ALTER TABLE `schedule_types` DISABLE KEYS */;
INSERT INTO `schedule_types` (`id`, `type`) VALUES
(3, 'Clothing Approved Schedule'),
(2, 'Household Approved Schedule'),
(1, 'Rental Assistance Approved Schedule'),
(4, 'School Supplies Approved Schedule');
/*!40000 ALTER TABLE `schedule_types` ENABLE KEYS */;
-- Dumping structure for table msdfs_forms_db.scotia_branches
DROP TABLE IF EXISTS `scotia_branches`;
CREATE TABLE IF NOT EXISTS `scotia_branches` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`branch` varchar(150) NOT NULL,
`transit_code` int(11) NOT NULL,
PRIMARY KEY (`id`) USING BTREE,
UNIQUE KEY `transit_code` (`transit_code`),
UNIQUE KEY `country` (`branch`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=24 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC;
-- Dumping data for table msdfs_forms_db.scotia_branches: ~23 rows (approximately)
/*!40000 ALTER TABLE `scotia_branches` DISABLE KEYS */;
INSERT INTO `scotia_branches` (`id`, `branch`, `transit_code`) VALUES
(1, 'Chaguanas', 60525),
(2, 'Cipero & Rushworth', 81745),
(3, 'Couva', 30395),
(4, 'Cunupia', 76885),
(5, 'Marabella', 61705),
(6, 'Penal', 46375),
(7, 'Price Plaza', 59345),
(8, 'Princes Town', 40485),
(9, '<NAME>', 62885),
(10, '<NAME>', 60285),
(11, 'Siparia', 54635),
(12, 'Arima', 90415),
(13, '<NAME>', 74625),
(14, 'Lowlands', 12005),
(15, 'Maraval', 95315),
(16, 'Park & Pembroke', 10405),
(17, 'Port of Spain', 90035),
(18, 'San Juan', 40725),
(19, 'Sangre Grande', 70615),
(20, 'Scarborough', 21105),
(21, 'Scotia Centre', 74815),
(22, 'Trincity', 18275),
(23, 'Tunapuna', 42135);
/*!40000 ALTER TABLE `scotia_branches` ENABLE KEYS */;
-- Dumping structure for table msdfs_forms_db.status
DROP TABLE IF EXISTS `status`;
CREATE TABLE IF NOT EXISTS `status` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`status` varchar(150) NOT NULL,
`button` varchar(150) DEFAULT NULL,
`step` int(1) NOT NULL DEFAULT 0,
`restore_id` int(10) unsigned DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE,
KEY `FK_status_status` (`restore_id`),
CONSTRAINT `FK_status_status` FOREIGN KEY (`restore_id`) REFERENCES `status` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC;
-- Dumping data for table msdfs_forms_db.status: ~12 rows (approximately)
/*!40000 ALTER TABLE `status` DISABLE KEYS */;
INSERT INTO `status` (`id`, `status`, `button`, `step`, `restore_id`) VALUES
(0, 'Inactive', 'deactivate', 0, 0),
(1, 'Active', 'activate', 1, 0),
(2, 'On Hold', 'on hold', 1, 1),
(3, 'Forwarded', 'forward', 2, 1),
(4, 'Logged', 'log', 2, 3),
(5, 'Pending', 'pending', 2, 4),
(6, 'Updated', 'update', 3, 5),
(7, 'Submitted For Approval', 'submit for approval', 3, 6),
(8, 'Under Review', 'review', 3, 7),
(9, 'Approved', 'approve', 4, 8),
(10, 'Sent For Payment', 'payment', 4, NULL),
(11, 'Rejected', 'reject', 4, 8);
/*!40000 ALTER TABLE `status` ENABLE KEYS */;
-- Dumping structure for table msdfs_forms_db.total_income
DROP TABLE IF EXISTS `total_income`;
CREATE TABLE IF NOT EXISTS `total_income` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`income` varchar(150) NOT NULL,
PRIMARY KEY (`id`) USING BTREE,
UNIQUE KEY `country` (`income`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC;
-- Dumping data for table msdfs_forms_db.total_income: ~4 rows (approximately)
/*!40000 ALTER TABLE `total_income` DISABLE KEYS */;
INSERT INTO `total_income` (`id`, `income`) VALUES
(2, '$12,000 - $20,000'),
(3, '$20,000-$50,000'),
(4, 'Greater than $50,000'),
(1, 'Less than $12,000');
/*!40000 ALTER TABLE `total_income` ENABLE KEYS */;
-- Dumping structure for table msdfs_forms_db.users
DROP TABLE IF EXISTS `users`;
CREATE TABLE IF NOT EXISTS `users` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`first_name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`surname` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`role_id` int(10) unsigned DEFAULT NULL,
`email` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`email_verified_at` timestamp NULL DEFAULT NULL,
`active` int(1) NOT NULL DEFAULT 1,
`password` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`remember_token` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`last_online` datetime DEFAULT NULL,
`created_by` bigint(20) unsigned DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `users_email_unique` (`email`),
KEY `FK_users_users` (`created_by`),
KEY `FK_users_roles` (`role_id`),
CONSTRAINT `FK_users_roles` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`),
CONSTRAINT `FK_users_users` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=25 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- Dumping data for table msdfs_forms_db.users: ~24 rows (approximately)
/*!40000 ALTER TABLE `users` DISABLE KEYS */;
INSERT INTO `users` (`id`, `first_name`, `surname`, `role_id`, `email`, `email_verified_at`, `active`, `password`, `remember_token`, `last_online`, `created_by`, `created_at`, `updated_at`) VALUES
(1, 'Admin', 'User', 1, '<EMAIL>', NULL, 1, '$2y$10$aRBnMbZm1ld51AkoRYKd4uACqpoNXSaVYPjq74o94WAhb9fGDnaFm', NULL, '2020-09-14 18:21:49', NULL, '2020-05-02 04:29:15', '2020-09-14 18:21:49'),
(2, 'Morgan', 'Merritt', 2, '<EMAIL>', NULL, 0, '$2y$10$QnAKGQFoMMSzWUZ.NL2atuXDKsCSjxE8gRDDt1IMOucFu7wTgJcFq', NULL, NULL, 1, '2020-08-06 22:02:35', '2020-09-14 14:13:31'),
(3, 'Social', 'Admin', 1, '<EMAIL>', NULL, 1, '$2y$10$eYk3SMODJZZcGQXE6HK1Y.f5WsaGVlnAPu.q/lOaETHPKK5NqgnGG', NULL, NULL, 1, '2020-08-07 02:25:15', '2020-08-07 02:33:25'),
(4, 'SAO', 'Test', 1, '<EMAIL>', NULL, 1, '$2y$10$Tgr0XoTcEGrZG.y5LPr4oe3Tu18iNl9QOwQBJn.Xox5l10TPwZefO', NULL, '2020-08-10 14:35:18', 1, '2020-08-10 10:13:01', '2020-08-10 14:35:18'),
(5, 'John', 'IntakeOfficer', 2, '<EMAIL>', NULL, 1, '$2y$10$3xOOzGsjxcF8tINO7ANkr.UzxNh.9pmkNKdl6crrXGi8WCs4tLRVC', NULL, '2020-08-10 12:29:27', 4, '2020-08-10 12:01:11', '2020-08-10 12:29:27'),
(6, 'Intake', 'Test', 2, '<EMAIL>', NULL, 1, '$2y$10$ItGMN.jWEWJRQ.cQ4.9Q8.yhBF5HZLxWaWfWh3hbKw2kMYFkJRsB2', NULL, '2020-08-10 13:51:41', 4, '2020-08-10 12:02:06', '2020-08-10 13:51:41'),
(7, 'Registration Clerk', 'Tester', 3, '<EMAIL>', NULL, 1, '$2y$10$lTWLGHA1ka7QFlvc/I0mfO4BsndvUog37fvC.zhK9BbZrxdsSMpW.', NULL, '2020-08-10 12:42:25', 4, '2020-08-10 12:04:36', '2020-08-10 12:43:04'),
(8, 'Welfare', 'Officer 1', 4, '<EMAIL>', NULL, 1, '$2y$10$5h2SG/Xx8nL1EcygRUOjYOwsd/wnfjVvCWEH31qzVv0BJgHmi/VSC', NULL, '2020-08-10 12:47:10', 4, '2020-08-10 12:07:50', '2020-08-10 12:47:34'),
(9, 'Welfare', 'Officer 2', 5, '<EMAIL>', NULL, 1, '$2y$10$/4kLrwD6Al9b/DKfV6ajl.vGuNvuyc8bfcecyAvkewmo2vkDskPTK', NULL, '2020-08-10 12:49:41', 4, '2020-08-10 12:13:38', '2020-08-10 12:49:58'),
(10, 'Schedule', 'Clerk', 6, '<EMAIL>', NULL, 1, '$2y$10$TyUXuVuqhQSnAKtY3jMYPeVQw6ScC9XZEaU8lzXKL7xwaTDmyKIpW', NULL, NULL, 4, '2020-08-10 12:15:18', '2020-08-10 12:15:18'),
(11, 'John', 'Registration', 3, '<EMAIL>', NULL, 1, '$2y$10$fFfUOXoI8Vjep8tw163atuqD/nojjUZZHKUNeGV/04.EfmYGL47ly', NULL, '2020-08-10 12:55:20', 4, '2020-08-10 12:15:45', '2020-08-10 12:55:20'),
(12, 'Supervisor', '2', 7, '<EMAIL>', NULL, 1, '$2y$10$GOhCF98gqgrn0ytynTYCX.2XT/3Wtl6Um7TAqMnd2iVps8Z6wx7eu', NULL, '2020-08-10 12:52:24', 4, '2020-08-10 12:16:16', '2020-08-10 12:52:57'),
(13, 'John', 'WelOf1', 4, '<EMAIL>', NULL, 1, '$2y$10$ItBHwIgk8kfcGO.zz9tyfuAzDR3wyVK9xB/9lybYUF76v2vy6onbi', NULL, '2020-08-10 12:56:58', 4, '2020-08-10 12:18:27', '2020-08-10 12:56:58'),
(14, 'John', 'WelOf2', 5, '<EMAIL>', NULL, 1, '$2y$10$VDi3PohsCWzC7TRlGRurkeMbKK6AJYiPzQbSPTNoaiHPl0bxiNNBG', NULL, '2020-08-10 12:59:03', 4, '2020-08-10 12:19:24', '2020-08-10 12:59:03'),
(15, 'John', 'ScheduleClerk', 6, '<EMAIL>', NULL, 1, '$2y$10$EWvgAQANEVB5Kj0G0.8bhOQROnbxbETR7NY/ZKZRU4fHMBKDefRa.', NULL, '2020-08-10 13:04:02', 4, '2020-08-10 12:20:39', '2020-08-10 13:04:02'),
(16, 'John', 'Supervisor', 7, '<EMAIL>', NULL, 1, '$2y$10$4Om/qv.1pWmlQIi3x4hwG.9zFbailyGlivjXjDHaO4C7AxYE6yt0a', NULL, '2020-08-10 13:00:37', 4, '2020-08-10 12:22:00', '2020-08-10 13:00:37'),
(17, 'Sharlan', 'Intake Officer', 2, '<EMAIL>', NULL, 1, '$2y$10$Mh3BpUSehYgLBdcJRk1Uw.TLIDWzILSgBz50S/EJbYycfURRI5sf2', NULL, '2020-08-10 13:51:08', 3, '2020-08-10 12:48:59', '2020-08-10 13:51:08'),
(18, 'Sharlan', 'Registration', 3, '<EMAIL>', NULL, 1, '$2y$10$2tiNROXm5IVPvMWEmmT/3eclKJvVIH7thNBFEx6ZSHFO9Er/oPzdu', NULL, '2020-08-10 13:24:01', 3, '2020-08-10 13:22:42', '2020-08-10 13:24:01'),
(19, 'sharlan', 'welfare1', 4, '<EMAIL>', NULL, 1, '$2y$10$IxXv5vSqAPSAMoXQ/Eok7.6vONeZesN17Zf0mOIYCis3HCFfPRvRm', NULL, '2020-08-10 13:28:03', 3, '2020-08-10 13:26:34', '2020-08-10 13:28:03'),
(20, 'sharlan', 'welfare2', 5, '<EMAIL>', NULL, 1, '$2y$10$3ca0NLzI61NzP4/To4pu7.1jieOOGpJ5Ybm5A9eZpn3TpvcttgGiO', NULL, '2020-08-10 13:30:33', 3, '2020-08-10 13:27:02', '2020-08-10 13:30:33'),
(21, 'sharlan', 'supervisorII', 7, '<EMAIL>', NULL, 1, '$2y$10$MEwksBYLUh.r7bJhDB01Q.awO1LMpAcLdupB03bBI3QR5CtmMSj4y', NULL, '2020-08-10 13:31:46', 3, '2020-08-10 13:27:28', '2020-08-10 13:31:46'),
(22, 'sharlan', 'schedule', 6, '<EMAIL>', NULL, 1, '$2y$10$Y.4p13tIdm3tlyFMUWZgi.UL5C3Q3unvMzjxjhbvCxb613lfPeeEy', NULL, '2020-08-10 13:33:10', 3, '2020-08-10 13:27:49', '2020-08-10 13:33:10'),
(23, 'supervisor', 'Local Board', 7, '<EMAIL>', NULL, 1, '$2y$10$sqEwRNJhcGoiqyYpsvCS7eNWdM3W1t4pUwJG5hquHo9JFpmH05hS2', NULL, '2020-08-14 15:39:34', 3, '2020-08-14 15:34:38', '2020-08-14 15:39:34'),
(24, 'New', 'Guy', 2, '<EMAIL>', NULL, 1, '$2y$10$fs7rTsynMrdkmX.hXIyc1ejzjOptTt2Q02h1ExICqam86PkDMRLlu', NULL, '2020-09-14 12:06:27', 1, '2020-09-14 11:55:13', '2020-09-14 12:06:27');
/*!40000 ALTER TABLE `users` ENABLE KEYS */;
-- Dumping structure for table msdfs_forms_db.user_audit
DROP TABLE IF EXISTS `user_audit`;
CREATE TABLE IF NOT EXISTS `user_audit` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`user_id` bigint(20) unsigned NOT NULL,
`changed_by` bigint(20) unsigned NOT NULL,
`attribute` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`old` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`new` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`created_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`updated_at` datetime NOT NULL,
PRIMARY KEY (`id`) USING BTREE,
KEY `FK_feedback_status_audit_users` (`changed_by`) USING BTREE,
KEY `FK_user_audit_users` (`user_id`),
CONSTRAINT `FK_user_audit_users` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`),
CONSTRAINT `user_audit_ibfk_2` FOREIGN KEY (`changed_by`) REFERENCES `users` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ROW_FORMAT=DYNAMIC;
-- Dumping data for table msdfs_forms_db.user_audit: ~16 rows (approximately)
/*!40000 ALTER TABLE `user_audit` DISABLE KEYS */;
INSERT INTO `user_audit` (`id`, `user_id`, `changed_by`, `attribute`, `old`, `new`, `created_at`, `updated_at`) VALUES
(1, 1, 1, 'regions', '[]', '[1,2,8]', '2020-08-17 16:54:13', '2020-08-17 16:54:13'),
(2, 1, 1, 'regions', '[]', '[1,2,8]', '2020-08-17 16:55:10', '2020-08-17 16:55:10'),
(3, 1, 1, 'regions', '[1,2,8]', '[9,2,8,12,1]', '2020-08-17 17:00:16', '2020-08-17 17:00:16'),
(4, 1, 1, 'regions', '[]', '[9,10,12,14]', '2020-09-14 10:57:02', '2020-09-14 10:57:02'),
(5, 1, 1, 'regions', '[]', '[9,10,12,14]', '2020-09-14 10:58:00', '2020-09-14 10:58:00'),
(6, 1, 1, 'regions', '[]', '["B","M"]', '2020-09-14 10:58:41', '2020-09-14 10:58:41'),
(7, 1, 1, 'regions', '[]', '["B","M"]', '2020-09-14 10:58:53', '2020-09-14 10:58:53'),
(8, 5, 1, 'regions', '[]', '["B","C","K","M","G","DE","J"]', '2020-09-14 11:04:35', '2020-09-14 11:04:35'),
(9, 5, 1, 'local_boards', '["B","C","DE","G","J","K","M"]', '["DE","B","M","J","K","G"]', '2020-09-14 11:41:56', '2020-09-14 11:41:56'),
(10, 5, 1, 'local_boards', '["B","C","DE","G","J","K","M"]', '["DE","B","M","J","K","G"]', '2020-09-14 11:43:09', '2020-09-14 11:43:09'),
(11, 5, 1, 'local_boards', '[]', '["DE","B","M","J","K","G"]', '2020-09-14 11:43:47', '2020-09-14 11:43:47'),
(12, 5, 1, 'local_boards', '["B","DE","G","J","K","M"]', '["C","DE","B","M","J","K","G"]', '2020-09-14 11:43:58', '2020-09-14 11:43:58'),
(13, 6, 1, 'local_boards', '[]', '["B","M"]', '2020-09-14 11:44:25', '2020-09-14 11:44:25'),
(14, 1, 1, 'local_boards', '["B","M"]', '["C","B","M"]', '2020-09-14 11:54:18', '2020-09-14 11:54:18'),
(15, 24, 1, 'password', '-', 'password reset', '2020-09-14 12:05:32', '2020-09-14 12:05:32'),
(16, 2, 1, 'active', '1', '0', '2020-09-14 14:13:31', '2020-09-14 14:13:31');
/*!40000 ALTER TABLE `user_audit` ENABLE KEYS */;
-- Dumping structure for table msdfs_forms_db.user_boards
DROP TABLE IF EXISTS `user_boards`;
CREATE TABLE IF NOT EXISTS `user_boards` (
`user_id` bigint(20) unsigned NOT NULL,
`local_board` varchar(5) NOT NULL,
PRIMARY KEY (`user_id`,`local_board`) USING BTREE,
KEY `FK_user_regions_regions` (`local_board`) USING BTREE,
CONSTRAINT `FK_user_boards_local_boards` FOREIGN KEY (`local_board`) REFERENCES `local_boards` (`letter`),
CONSTRAINT `FK_user_regions_users` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC;
-- Dumping data for table msdfs_forms_db.user_boards: ~16 rows (approximately)
/*!40000 ALTER TABLE `user_boards` DISABLE KEYS */;
INSERT INTO `user_boards` (`user_id`, `local_board`) VALUES
(1, 'B'),
(1, 'C'),
(1, 'F'),
(5, 'B'),
(5, 'C'),
(5, 'DE'),
(5, 'G'),
(5, 'J'),
(5, 'K'),
(5, 'M'),
(6, 'B'),
(6, 'M'),
(24, 'C'),
(24, 'F'),
(24, 'G'),
(24, 'H');
/*!40000 ALTER TABLE `user_boards` ENABLE KEYS */;
-- Dumping structure for table msdfs_forms_db.user_logs
DROP TABLE IF EXISTS `user_logs`;
CREATE TABLE IF NOT EXISTS `user_logs` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`user_id` bigint(20) unsigned NOT NULL,
`ip` varchar(150) NOT NULL,
`action` varchar(150) NOT NULL,
`created_at` timestamp NOT NULL DEFAULT current_timestamp(),
`updated_at` datetime NOT NULL,
PRIMARY KEY (`id`) USING BTREE,
KEY `FK_ip_logs_users` (`user_id`) USING BTREE,
CONSTRAINT `FK_user_logs_users` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC;
-- Dumping data for table msdfs_forms_db.user_logs: ~1 rows (approximately)
/*!40000 ALTER TABLE `user_logs` DISABLE KEYS */;
INSERT INTO `user_logs` (`id`, `user_id`, `ip`, `action`, `created_at`, `updated_at`) VALUES
(1, 1, '127.0.0.1', 'Login', '2020-09-14 18:21:49', '2020-09-14 18:21:49');
/*!40000 ALTER TABLE `user_logs` ENABLE KEYS */;
-- Dumping structure for table msdfs_forms_db.version_logs
DROP TABLE IF EXISTS `version_logs`;
CREATE TABLE IF NOT EXISTS `version_logs` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`user_id` bigint(20) unsigned NOT NULL,
`release` tinyint(4) NOT NULL DEFAULT 0,
`feature` tinyint(4) NOT NULL DEFAULT 0,
`update` tinyint(4) NOT NULL DEFAULT 0,
`log` mediumtext NOT NULL,
`created_at` timestamp NOT NULL DEFAULT current_timestamp(),
`updated_at` datetime NOT NULL,
PRIMARY KEY (`id`) USING BTREE,
KEY `FK_ip_logs_users` (`user_id`) USING BTREE,
CONSTRAINT `version_logs_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC;
-- Dumping data for table msdfs_forms_db.version_logs: ~0 rows (approximately)
/*!40000 ALTER TABLE `version_logs` DISABLE KEYS */;
/*!40000 ALTER TABLE `version_logs` ENABLE KEYS */;
/*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */;
/*!40014 SET FOREIGN_KEY_CHECKS=IF(@OLD_FOREIGN_KEY_CHECKS IS NULL, 1, @OLD_FOREIGN_KEY_CHECKS) */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
<reponame>troygrossi/content-managment-sql-inquirer
CREATE TABLE departments (
department_id INTEGER AUTO_INCREMENT PRIMARY KEY,
department_name VARCHAR(30) NOT NULL
);
CREATE TABLE roles (
role_id INTEGER AUTO_INCREMENT PRIMARY KEY,
role_title VARCHAR(30) NOT NULL,
role_salary INTEGER NOT NULL,
role_department INTEGER NOT NULL,
FOREIGN KEY (role_department) REFERENCES departments(department_id)
);
CREATE TABLE employees (
employee_id INTEGER AUTO_INCREMENT PRIMARY KEY,
employee_fname VARCHAR(30) NOT NULL,
employee_lname VARCHAR(30) NOT NULL,
employee_role INTEGER NOT NULL,
employee_manager INTEGER,
FOREIGN KEY (employee_manager) REFERENCES employees(employee_id),
FOREIGN KEY (employee_role) REFERENCES roles(role_id)
);
|
-- phpMyAdmin SQL Dump
-- version 4.0.9
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: Nov 28, 2019 at 09:54 PM
-- Server version: 5.6.14
-- PHP Version: 5.5.6
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: `system`
--
-- --------------------------------------------------------
--
-- Table structure for table `addmision`
--
CREATE TABLE IF NOT EXISTS `addmision` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`date` date NOT NULL,
`time` time NOT NULL,
`patientId` int(11) DEFAULT NULL,
`staffId` int(11) DEFAULT NULL,
`wardID` int(11) DEFAULT NULL,
`bedID` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_persian_ci AUTO_INCREMENT=8 ;
--
-- Dumping data for table `addmision`
--
INSERT INTO `addmision` (`id`, `date`, `time`, `patientId`, `staffId`, `wardID`, `bedID`) VALUES
(1, '2019-01-01', '00:00:00', 12, 5, 3, 2),
(2, '2019-10-15', '00:00:00', 4, 7, 2, 3),
(3, '2019-11-04', '00:00:00', 6, 4, 5, 3),
(4, '2019-11-05', '00:00:00', 6, 4, 4, 5),
(7, '2019-11-19', '13:00:00', 12, 4, 8, NULL);
-- --------------------------------------------------------
--
-- Table structure for table `departments`
--
CREATE TABLE IF NOT EXISTS `departments` (
`id` int(85) NOT NULL AUTO_INCREMENT,
`departmentName` varchar(45) COLLATE utf8_persian_ci DEFAULT NULL,
`departmentDescriptio` varchar(45) COLLATE utf8_persian_ci DEFAULT NULL,
`numberOfEmployees` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_persian_ci AUTO_INCREMENT=9 ;
--
-- Dumping data for table `departments`
--
INSERT INTO `departments` (`id`, `departmentName`, `departmentDescriptio`, `numberOfEmployees`) VALUES
(1, 'amlkd', 'doipwf', 9),
(6, 'klkfw', 'csodios', 5),
(7, 'lasck', 'csldk', 7),
(8, 'kof', 'fkp', 10);
-- --------------------------------------------------------
--
-- Table structure for table `diagnosis`
--
CREATE TABLE IF NOT EXISTS `diagnosis` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`patientId` int(11) NOT NULL,
`date` date DEFAULT NULL,
`uploadBy` varchar(250) COLLATE utf8_persian_ci NOT NULL,
`diagnosedby` varchar(89) COLLATE utf8_persian_ci DEFAULT NULL,
`diagnosesSummary` longtext COLLATE utf8_persian_ci,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_persian_ci AUTO_INCREMENT=41 ;
--
-- Dumping data for table `diagnosis`
--
INSERT INTO `diagnosis` (`id`, `patientId`, `date`, `uploadBy`, `diagnosedby`, `diagnosesSummary`) VALUES
(1, 2, '2019-09-02', 'fjwlefwe', 'vndksjf', 'lsdfkjwpeopwfew;ewvdsmklnccmkdj\r\nlvdskmjfcslfewe\r\n cnxl,kfcnlsd\r\n,xlcsdfjlsk'),
(2, 1, '2019-10-08', 'jaksj', 'bbb', 'asiausa'),
(3, 5, '2019-10-04', 'udf', 'nnn', 'oiwherow'),
(4, 12, '2019-10-11', 'qwe', '', 'sfddfdssdf'),
(5, 11, '2019-10-04', 'ew', '', 'erte'),
(6, 8, '2019-10-10', 'mz', '', 'oiiiif'),
(8, 11, '2019-10-04', 'ew', 'kas', 'erte'),
(9, 32, '2019-10-17', 'hig', 'vg', 'vhuytfffffftdyt5tdtcdtde6c65ec6etfrdtt'),
(40, 6, '2019-10-22', 'mlv', 'uh', 'kjfserfre');
-- --------------------------------------------------------
--
-- Table structure for table `patient`
--
CREATE TABLE IF NOT EXISTS `patient` (
`date` date NOT NULL,
`name` varchar(100) COLLATE utf8_persian_ci NOT NULL,
`fhaterName` varchar(100) COLLATE utf8_persian_ci NOT NULL,
`address` varchar(45) COLLATE utf8_persian_ci DEFAULT NULL,
`gender` varchar(45) COLLATE utf8_persian_ci NOT NULL,
`age` int(12) NOT NULL,
`typeOfEvent` varchar(55) COLLATE utf8_persian_ci NOT NULL,
`takenthrowback` varchar(80) COLLATE utf8_persian_ci DEFAULT NULL,
`giventhrowback` varchar(80) COLLATE utf8_persian_ci DEFAULT NULL,
`estate` varchar(65) COLLATE utf8_persian_ci NOT NULL,
`detectionID` int(48) NOT NULL,
`id` int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_persian_ci AUTO_INCREMENT=20 ;
--
-- Dumping data for table `patient`
--
INSERT INTO `patient` (`date`, `name`, `fhaterName`, `address`, `gender`, `age`, `typeOfEvent`, `takenthrowback`, `giventhrowback`, `estate`, `detectionID`, `id`) VALUES
('2019-09-03', 'ssss', 'aaaaaaa', 'xxxxxxxx', 'female', 25, 'new', '', 'sfretsrdsrt', 'asdffghjkl', 5, 9),
('2019-09-16', 'nnnn', 'mmm', 'vvvvvvv', 'male', 50, 'Old', 'fvffxstrytsy', '', 'xgtrsytdy', 7, 10),
('2019-09-30', 'tttttttt', 'mmmmmmm', 'gggg', 'female', 55, 'Old', '', 'doiawuo', 'aaaaaaa', 5, 11),
('2019-04-10', 'Roia', 'samim', 'bharestan', 'female', 23, 'Old', NULL, NULL, 'djlfkpowf', 7, 12),
('2019-09-18', 'زینب', 'عبدالله', 'gozara', 'male', 3, 'Old', NULL, NULL, 'adsdd', 1, 13),
('2019-09-11', 'mmm', 'nnn', 'ddd', 'female', 0, 'new', 'dkjlawi', '', 'bbb', 8, 14),
('2019-10-10', 'jdv', 'jdsv', 'jds', 'female', 51, 'Old', NULL, NULL, 'kld', 6, 15),
('2019-10-02', 'da', 'dd', 'dwed', 'male', 14, 'new', NULL, NULL, 'dwq', 6, 16),
('2019-10-30', 'Roia', 'majed', 'njv', 'male', 11, 'Old', NULL, NULL, 'vds', 2, 17),
('2019-08-21', 'oij', 'jbhj', 'ifi', 'male', 42, 'new', NULL, NULL, '', 9, 18),
('2019-10-15', 'joi', 'uig', 'guy', 'female', 21, 'Old', NULL, NULL, 'uj', 1, 19);
-- --------------------------------------------------------
--
-- Table structure for table `staff`
--
CREATE TABLE IF NOT EXISTS `staff` (
`staffID` int(58) NOT NULL AUTO_INCREMENT,
`firstName` varchar(47) COLLATE utf8_persian_ci DEFAULT NULL,
`lastName` varchar(56) COLLATE utf8_persian_ci DEFAULT NULL,
`workingTime` varchar(45) COLLATE utf8_persian_ci DEFAULT NULL,
`departmentId` int(11) DEFAULT NULL,
`address` varchar(45) COLLATE utf8_persian_ci NOT NULL,
`UserName` varchar(45) COLLATE utf8_persian_ci NOT NULL,
`UserPassword` varchar(45) COLLATE utf8_persian_ci NOT NULL,
`staffJob` varchar(45) COLLATE utf8_persian_ci DEFAULT NULL,
`salary` int(45) DEFAULT NULL,
`age` int(18) DEFAULT NULL,
`gendeer` varchar(55) COLLATE utf8_persian_ci NOT NULL,
`photo` varchar(45) COLLATE utf8_persian_ci NOT NULL,
PRIMARY KEY (`staffID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_persian_ci AUTO_INCREMENT=14 ;
--
-- Dumping data for table `staff`
--
INSERT INTO `staff` (`staffID`, `firstName`, `lastName`, `workingTime`, `departmentId`, `address`, `UserName`, `UserPassword`, `staffJob`, `salary`, `age`, `gendeer`, `photo`) VALUES
(1, 'جمشید', 'کریمی', '8', 2, '<NAME>', 'ali', '321', 'نرس', 18000, 22, 'mail', ''),
(2, 'drs', 'tr', '4', 5, 'hki', '', '', 'uuoi', 7000, 50, 'male', ''),
(3, 'تتنتن', 'سروری', '8', 1, 'شهرنو', 'admin', '123', 'داکتر', 25000, 7, '', ''),
(4, 'ali', 'ahmad', '5', 5, 'herat', 'ahmad', '786', 'nars', 700, 16, '', ''),
(5, 'xxx', 'zzz', '8', 3, 'ccc', 'homa', '987', 'ddd', 1000, 40, '', ''),
(6, 'msklad', 'sklad', '4', 3, 'kawl', 'mosad', '12345', 'lwa', 600, 26, '', '0'),
(7, 'sd', 'sdiuf', '8', 4, '987', '', '', 'csadc', 5000, 45, 'female', ''),
(8, 'dy', 'gf', '4', 3, 'dg', 'mosadiq', '786', 'dh', 100, 24, '', ''),
(9, 'nokiu', 'uyg', '4', 5, '2222', '', '', 'nars', 79, 40, 'male', '0'),
(10, 'ttx', 'jhy', '4', 3, 'dxr', '', '', 'dfrd', 5000, 40, 'male', ''),
(12, 'mhamod', 'mhamodi', '8', 3, 'bikrabad', 'homa', '321', 'داکتر', 25000, 43, 'mail', 'b.png'),
(13, 'lkd', 'fe', '8', 3, 'ewf', '', '', 'do', 210, 28, 'female', '');
-- --------------------------------------------------------
--
-- Table structure for table `user`
--
CREATE TABLE IF NOT EXISTS `user` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(50) COLLATE utf8_persian_ci NOT NULL,
`uname` varchar(40) COLLATE utf8_persian_ci NOT NULL,
`pass` int(11) NOT NULL,
`photo` varchar(56) COLLATE utf8_persian_ci NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_persian_ci AUTO_INCREMENT=8 ;
--
-- Dumping data for table `user`
--
INSERT INTO `user` (`id`, `name`, `uname`, `pass`, `photo`) VALUES
(1, 'ali', 'admin', 12345, ''),
(2, 'sohell', 'shaber', 786, ''),
(3, 'somaia', '@somaia', 786, 'fr-08.jpg'),
(4, 'ahmad', 'ahmadi', 789, 'fr-10.jpg'),
(5, 'shabir', '@shabir', 54321, 'fr-01.jpg'),
(6, 'kaber', 'admin', 1234, 'fr-01.jpg'),
(7, '', 'admin', 1212, '');
-- --------------------------------------------------------
--
-- Table structure for table `wards`
--
CREATE TABLE IF NOT EXISTS `wards` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`wardName` varchar(45) COLLATE utf8_persian_ci DEFAULT NULL,
`numberOfBed` int(11) NOT NULL,
`numberOfStaff` int(11) NOT NULL,
`numberOfPatient` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_persian_ci AUTO_INCREMENT=7 ;
--
-- Dumping data for table `wards`
--
INSERT INTO `wards` (`id`, `wardName`, `numberOfBed`, `numberOfStaff`, `numberOfPatient`) VALUES
(1, 'داخله', 20, 15, 10),
(3, 'fpowej', 10, 15, 7),
(4, 'cdhs', 6, 5, 4),
(5, ' xkz', 3, 4, 2),
(6, 'slka', 6, 3, 3);
/*!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 PostgreSql table:
-- Table: x01_classcount
-- DROP TABLE x01_classcount;
CREATE TABLE x01_classcount
(
classcount_id serial NOT NULL,
project_idref integer NOT NULL DEFAULT 0,
event_idref integer NOT NULL DEFAULT 0,
person_idref integer NOT NULL DEFAULT 0,
account_idref integer NOT NULL DEFAULT 0,
sessions integer NOT NULL DEFAULT 0,
attendees integer NOT NULL DEFAULT 0,
event_date date NOT NULL DEFAULT now(),
"comments" character varying(256) NOT NULL DEFAULT ''::character varying,
"timestamp" timestamp without time zone DEFAULT timezone('UTC'::text, now()), -- Time is UTC, alias GMT, alias Greenwich Mean Time
CONSTRAINT classcount_Key PRIMARY KEY (classcount_id)
)
WITH (
OIDS=FALSE
);
ALTER TABLE x01_classcount OWNER TO ts_admin;
GRANT ALL ON TABLE x01_classcount TO ts_admin;
GRANT SELECT, UPDATE, INSERT, DELETE ON TABLE x01_classcount TO ts_editor;
GRANT SELECT ON TABLE x01_classcount TO ts_reader;
COMMENT ON COLUMN x01_classcount."timestamp" IS 'Time is UTC, alias GMT, alias Greenwich Mean Time';
GRANT UPDATE ON TABLE x01_classcount_classcount_ID_seq TO ts_editor;
|
INSERT INTO ratings
(brand_id,user_id,score,reason,created,updated)
VALUES
(4,1,90,'++customer service',NOW(),NOW())
,(5,1,95,'++technical excellence',NOW(),NOW())
,(6,1,90,'++customer service',NOW(),NOW())
,(7,1,100,'++purpose',NOW(),NOW())
,(8,1,100,'++purpose',NOW(),NOW())
,(9,1,10,'--sense',NOW(),NOW())
,(10,1,30,'--progressive ideals',NOW(),NOW())
,(11,1,50,'--nutrition',NOW(),NOW())
,(12,1,100,'++community',NOW(),NOW())
,(13,1,95,'++community',NOW(),NOW())
,(14,1,95,'++artistry',NOW(),NOW())
,(15,1,95,'++service',NOW(),NOW())
,(16,1,90,'++customer service',NOW(),NOW())
,(17,1,90,'++community',NOW(),NOW())
,(18,1,90,'++service',NOW(),NOW())
,(19,1,90,'',NOW(),NOW())
,(20,1,90,'',NOW(),NOW())
|
SELECT TOP (10) [user], [score]
from [FlyWithButchOhareDB_Copy].[dbo].[baggagebeltleaderboard] ORDER BY [score] DESC;
|
-- Program and Services
SELECT
services.id serviceId, services.serviceName, programs.id programId,
programs.programName
FROM
services
JOIN programs on services.programId = programs.id
;
-- Service payments
SELECT
payments.id paymentId, invoicePayments.amount, JSON_ARRAYAGG(JSON_OBJECT(
'serviceId', invoiceLineItems.serviceId,
'quantity', quantity,
'rate', rate
)) lineItems
FROM
invoicePayments
JOIN invoices ON invoices.id = invoicePayments.invoiceId
JOIN payments ON payments.id = invoicePayments.paymentId
LEFT JOIN invoiceLineItems ON invoiceLineItems.invoiceId = invoices.id
WHERE
invoiceLineItems.serviceId IS NOT NULL
AND invoices.invoiceDate >= ?
AND invoices.invoiceDate <= ?
AND payments.isDeleted = false
GROUP BY payments.id
;
-- Invoice totals
SELECT
SUM(invoicePayments.amount) invoiceTotal
FROM invoicePayments
JOIN invoices ON invoicePayments.invoiceId = invoices.id
JOIN payments on invoicePayments.paymentId = payments.id
WHERE
invoices.invoiceDate >= ? AND invoices.invoiceDate <= ?
AND payments.isDeleted = false
;
-- Payment totals
SELECT
SUM(paymentAmount) allPaymentsTotal
FROM payments
WHERE
payments.paymentDate >= ? AND payments.paymentDate <= ?
AND payments.isDeleted = false
;
-- Donation totals
SELECT
SUM(donationAmount) donationsTotal
FROM donations
WHERE
(donations.donationDate >= ? AND donations.donationDate <= ?)
AND donations.isDeleted = false
;
|
ALTER TABLE groups
ALTER COLUMN name TYPE VARCHAR(80),
ALTER COLUMN keycloakgrouppath TYPE VARCHAR(100),
ALTER COLUMN displayname TYPE VARCHAR(100),
ALTER COLUMN CODE TYPE VARCHAR(20);
|
-- mallocC.test
--
-- execsql {
-- PRAGMA auto_vacuum=1;
-- CREATE TABLE t0(a, b, c);
-- }
PRAGMA auto_vacuum=1;
CREATE TABLE t0(a, b, c);
|
<reponame>Shuttl-Tech/antlr_psql
-- file:alter_table.sql ln:225 expect:true
DROP INDEX onek_unique1_constraint
|
<filename>src/test/java/org/apache/ibatis/submitted/dynsql/CreateDB.sql
--
-- Copyright 2009-2021 the original author or authors.
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
--
create schema ibtest authorization dba;
create table ibtest.names
(
id int,
description varchar(20)
);
insert into ibtest.names (id, description)
values (1, 'Fred');
insert into ibtest.names (id, description)
values (2, 'Wilma');
insert into ibtest.names (id, description)
values (3, 'Pebbles');
insert into ibtest.names (id, description)
values (4, 'Barney');
insert into ibtest.names (id, description)
values (5, 'Betty');
insert into ibtest.names (id, description)
values (6, 'Bamm Bamm');
insert into ibtest.names (id, description)
values (7, 'Rock ''n Roll');
create table ibtest.numerics
(
id int,
tinynumber tinyint,
smallnumber smallint,
longinteger bigint,
biginteger bigint,
numericnumber numeric(10, 2),
decimalnumber decimal(10, 2),
realnumber real,
floatnumber float,
doublenumber double
);
insert into ibtest.numerics
values (1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
|
<gh_stars>1-10
DELETE FROM `script_texts` WHERE `entry` BETWEEN -1534030 AND -1534018;
INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES
(-1534018,'All of your efforts have been in vain, for the draining of the World Tree has already begun. Soon the heart of your world will beat no more.',10986,1,0,'archimonde SAY_PRE_EVENTS_COMPLETE'),
(-1534019,'Your resistance is insignificant.',10987,1,0,'archimonde SAY_AGGRO'),
(-1534020,'This world will burn!',10990,1,0,'archimonde SAY_DOOMFIRE1'),
(-1534021,'Manach sheek-thrish!',11041,1,0,'archimonde SAY_DOOMFIRE2'),
(-1534022,'A-kreesh!',10989,1,0,'archimonde SAY_AIR_BURST1'),
(-1534023,'Away vermin!',11043,1,0,'archimonde SAY_AIR_BURST2'),
(-1534024,'All creation will be devoured!',11044,1,0,'archimonde SAY_SLAY1'),
(-1534025,'Your soul will languish for eternity.',10991,1,0,'archimonde SAY_SLAY2'),
(-1534026,'I am the coming of the end!',11045,1,0,'archimonde SAY_SLAY3'),
(-1534027,'At last it is here. Mourn and lament the passing of all you have ever known and all that would have been! Akmin-kurai!',10993,1,0,'archimonde SAY_ENRAGE'),
(-1534028,'No, it cannot be! Nooo!',10992,1,0,'archimonde SAY_DEATH'),
(-1534029,'You are mine now.',10988,1,0,'archimonde SAY_SOUL_CHARGE1'),
(-1534030,'Bow to my will.',11042,1,0,'archimonde SAY_SOUL_CHARGE2');
|
CREATE DATABASE IF NOT EXISTS `mathdb` /*!40100 DEFAULT CHARACTER SET latin1 */;
USE `mathdb`;
-- MySQL dump 10.13 Distrib 5.7.12, for osx10.9 (x86_64)
--
-- Host: localhost Database: mathdb
-- ------------------------------------------------------
-- Server version 5.7.16
/*!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 `auth_permission`
--
DROP TABLE IF EXISTS `auth_permission`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `auth_permission` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(50) NOT NULL,
`content_type_id` int(11) NOT NULL,
`codename` varchar(100) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `content_type_id` (`content_type_id`,`codename`),
KEY `auth_permission_1bb8f392` (`content_type_id`),
CONSTRAINT `content_type_id_refs_id_728de91f` FOREIGN KEY (`content_type_id`) REFERENCES `django_content_type` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=122 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `auth_permission`
--
LOCK TABLES `auth_permission` WRITE;
/*!40000 ALTER TABLE `auth_permission` DISABLE KEYS */;
INSERT INTO `auth_permission` VALUES (1,'Can add permission',1,'add_permission'),(2,'Can change permission',1,'change_permission'),(3,'Can delete permission',1,'delete_permission'),(4,'Can add group',2,'add_group'),(5,'Can change group',2,'change_group'),(6,'Can delete group',2,'delete_group'),(7,'Can add user',3,'add_user'),(8,'Can change user',3,'change_user'),(9,'Can delete user',3,'delete_user'),(10,'Can add content type',4,'add_contenttype'),(11,'Can change content type',4,'change_contenttype'),(12,'Can delete content type',4,'delete_contenttype'),(13,'Can add session',5,'add_session'),(14,'Can change session',5,'change_session'),(15,'Can delete session',5,'delete_session'),(16,'Can add site',6,'add_site'),(17,'Can change site',6,'change_site'),(18,'Can delete site',6,'delete_site'),(19,'Can add log entry',7,'add_logentry'),(20,'Can change log entry',7,'change_logentry'),(21,'Can delete log entry',7,'delete_logentry'),(22,'Can add education_ level',8,'add_education_level'),(23,'Can change education_ level',8,'change_education_level'),(24,'Can delete education_ level',8,'delete_education_level'),(25,'Can add subject',9,'add_subject'),(26,'Can change subject',9,'change_subject'),(27,'Can delete subject',9,'delete_subject'),(28,'Can add block',10,'add_block'),(29,'Can change block',10,'change_block'),(30,'Can delete block',10,'delete_block'),(31,'Can add topic',11,'add_topic'),(32,'Can change topic',11,'change_topic'),(33,'Can delete topic',11,'delete_topic'),(34,'Can add subtopic',12,'add_subtopic'),(35,'Can change subtopic',12,'change_subtopic'),(36,'Can delete subtopic',12,'delete_subtopic'),(37,'Can add paperset',13,'add_paperset'),(38,'Can change paperset',13,'change_paperset'),(39,'Can delete paperset',13,'delete_paperset'),(40,'Can add paper',14,'add_paper'),(41,'Can change paper',14,'change_paper'),(42,'Can delete paper',14,'delete_paper'),(43,'Can add question',15,'add_question'),(44,'Can change question',15,'change_question'),(45,'Can delete question',15,'delete_question'),(46,'Can add solution',16,'add_solution'),(47,'Can change solution',16,'change_solution'),(48,'Can delete solution',16,'delete_solution'),(49,'Can add image',17,'add_image'),(50,'Can change image',17,'change_image'),(51,'Can delete image',17,'delete_image'),(52,'Can add answer type',18,'add_answertype'),(53,'Can change answer type',18,'change_answertype'),(54,'Can delete answer type',18,'delete_answertype'),(55,'Can add answer',19,'add_answer'),(56,'Can change answer',19,'change_answer'),(57,'Can delete answer',19,'delete_answer'),(58,'Can add progress',20,'add_progress'),(59,'Can change progress',20,'change_progress'),(60,'Can delete progress',20,'delete_progress'),(61,'Can add tag definition',21,'add_tagdefinition'),(62,'Can change tag definition',21,'change_tagdefinition'),(63,'Can delete tag definition',21,'delete_tagdefinition'),(64,'Can add tag',22,'add_tag'),(65,'Can change tag',22,'change_tag'),(66,'Can delete tag',22,'delete_tag'),(67,'Can add formula',23,'add_formula'),(68,'Can change formula',23,'change_formula'),(69,'Can delete formula',23,'delete_formula'),(70,'Can add formula_index',24,'add_formula_index'),(71,'Can change formula_index',24,'change_formula_index'),(72,'Can delete formula_index',24,'delete_formula_index'),(73,'Can add assessment',25,'add_assessment'),(74,'Can change assessment',25,'change_assessment'),(75,'Can delete assessment',25,'delete_assessment'),(76,'Can add response',26,'add_response'),(77,'Can change response',26,'change_response'),(78,'Can delete response',26,'delete_response'),(79,'Can add test',27,'add_test'),(80,'Can change test',27,'change_test'),(81,'Can delete test',27,'delete_test'),(82,'Can add test response',28,'add_testresponse'),(83,'Can change test response',28,'change_testresponse'),(84,'Can delete test response',28,'delete_testresponse'),(85,'Can add meta',29,'add_meta'),(86,'Can change meta',29,'change_meta'),(87,'Can delete meta',29,'delete_meta'),(88,'Can add question meta',30,'add_questionmeta'),(89,'Can change question meta',30,'change_questionmeta'),(90,'Can delete question meta',30,'delete_questionmeta'),(91,'Can add test question',31,'add_testquestion'),(92,'Can change test question',31,'change_testquestion'),(93,'Can delete test question',31,'delete_testquestion'),(94,'Can add user profile',32,'add_userprofile'),(95,'Can change user profile',32,'change_userprofile'),(96,'Can delete user profile',32,'delete_userprofile'),(97,'Can add user usage',33,'add_userusage'),(98,'Can change user usage',33,'change_userusage'),(99,'Can delete user usage',33,'delete_userusage'),(100,'Can add comment',34,'add_comment'),(101,'Can change comment',34,'change_comment'),(102,'Can delete comment',34,'delete_comment'),(103,'Can moderate comments',34,'can_moderate'),(104,'Can add comment flag',35,'add_commentflag'),(105,'Can change comment flag',35,'change_commentflag'),(106,'Can delete comment flag',35,'delete_commentflag'),(107,'Can add mptt comment',36,'add_mpttcomment'),(108,'Can change mptt comment',36,'change_mpttcomment'),(109,'Can delete mptt comment',36,'delete_mpttcomment'),(110,'Can add ask',37,'add_ask'),(111,'Can change ask',37,'change_ask'),(112,'Can delete ask',37,'delete_ask'),(113,'Can add askfile',38,'add_askfile'),(114,'Can change askfile',38,'change_askfile'),(115,'Can delete askfile',38,'delete_askfile'),(116,'Can add question c',39,'add_questionc'),(117,'Can change question c',39,'change_questionc'),(118,'Can delete question c',39,'delete_questionc'),(119,'Can add file c',40,'add_filec'),(120,'Can change file c',40,'change_filec'),(121,'Can delete file c',40,'delete_filec');
/*!40000 ALTER TABLE `auth_permission` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2017-05-15 19:53:50
|
<gh_stars>0
CREATE TYPE MODERATION AS ENUM ('WAITING', 'REJECTED');
-- If moderation is not null, then an ingredient must not be public,
-- and it must have an owner
ALTER TABLE ingredient
ADD COLUMN moderation MODERATION,
ADD CONSTRAINT moderation_check CHECK (
NOT ((owner is NULL or published = TRUE) AND moderation IS NOT NULL));
|
-- MySQL compatible file for reading data
CREATE SCHEMA IF NOT EXISTS movielens;
use movielens;
-- users table
-- zipcode is string instead of int, because we don't want zipcodes starting with 0 to be stripped of it.
CREATE TABLE IF NOT EXISTS users(user_id INT PRIMARY KEY, age INT NOT NULL, gender CHAR(1) NOT NULL, occupation VARCHAR(64) NOT NULL, zipcode VARCHAR(5) NOT NULL);
LOAD DATA LOCAL INFILE '~/ml-100k/u.user' INTO TABLE users FIELDS TERMINATED BY '|' LINES TERMINATED BY '\n';
-- movies table
-- Genre's generated via a script like this:
-- for gen in {'unknown','action','adventure','animation','childrens','comedy','crime','documentary','drama','fantasy','film_noir','horror','musical','mystery','romance','sci_fi','thriller','war','western'}; do printf "genre_$gen BOOL NOT NULL, "; done
CREATE TABLE IF NOT EXISTS movies(movie_id INT PRIMARY KEY, title VARCHAR(128) NOT NULL, release_date DATE NOT NULL, video_release_date DATE, imdb_url VARCHAR(1024), genre_unknown BOOL NOT NULL, genre_action BOOL NOT NULL, genre_adventure BOOL NOT NULL, genre_animation BOOL NOT NULL, genre_childrens BOOL NOT NULL, genre_comedy BOOL NOT NULL, genre_crime BOOL NOT NULL, genre_documentary BOOL NOT NULL, genre_drama BOOL NOT NULL, genre_fantasy BOOL NOT NULL, genre_film_noir BOOL NOT NULL, genre_horror BOOL NOT NULL, genre_musical BOOL NOT NULL, genre_mystery BOOL NOT NULL, genre_romance BOOL NOT NULL, genre_sci_fi BOOL NOT NULL, genre_thriller BOOL NOT NULL, genre_war BOOL NOT NULL, genre_western BOOL NOT NULL);
LOAD DATA LOCAL INFILE '~/ml-100k/u.item' INTO TABLE movies FIELDS TERMINATED BY '|' LINES TERMINATED BY '\n' (movie_id, title, @col3, @col4, imdb_url, genre_unknown, genre_action, genre_adventure, genre_animation, genre_childrens, genre_comedy, genre_crime, genre_documentary, genre_drama, genre_fantasy, genre_film_noir, genre_horror, genre_musical, genre_mystery, genre_romance, genre_sci_fi, genre_thriller, genre_war, genre_western) SET release_date = str_to_date(@col3,'%d-%b-%Y'), video_release_date = IF(@col4='', NULL, str_to_date(@col4, '%d-%b-%Y'));
-- ratings table
CREATE TABLE IF NOT EXISTS ratings (user_id INT NOT NULL, movie_id INT NOT NULL, rating INT NOT NULL, time TIMESTAMP NOT NULL);
LOAD DATA LOCAL INFILE '~/ml-100k/u.data' INTO TABLE ratings FIELDS TERMINATED BY '\t' LINES TERMINATED BY '\n' (user_id, movie_id, rating, @time) SET time = FROM_UNIXTIME(@time);
|
-- ### 新表预置数据:
-- dev_folder
-- 系统文件夹
insert into idata.dev_folder (id, creator, folder_name, folder_type) values (1, '系统管理员', 'LabelSystemFolder', 'LABEL');
insert into idata.dev_folder (id, creator, folder_name, folder_type) values (2, '系统管理员', 'EnumSystemFolder', 'ENUM');
insert into idata.dev_folder (id, creator, folder_name, folder_type) values (3, '系统管理员', 'ODS', 'TABLE');
insert into idata.dev_folder (id, creator, folder_name, folder_type) values (4, '系统管理员', 'DWD', 'TABLE');
insert into idata.dev_folder (id, creator, folder_name, folder_type) values (5, '系统管理员', 'DWS', 'TABLE');
insert into idata.dev_folder (id, creator, folder_name, folder_type) values (6, '系统管理员', 'DIM', 'TABLE');
insert into idata.dev_folder (id, creator, folder_name, folder_type) values (7, '系统管理员', 'ADS', 'TABLE');
insert into idata.dev_folder (id, creator, folder_name, folder_type) values (8, '系统管理员', 'DimensionFolder',
'DIMENSION');
insert into idata.dev_folder (id, creator, folder_name, folder_type) values (9, '系统管理员', 'ModifierFolder', 'MODIFIER');
insert into idata.dev_folder (id, creator, folder_name, folder_type) values (10, '系统管理员', 'MetricFolder', 'METRIC');
insert into idata.dev_folder (id, creator, folder_name, parent_id, folder_type) values (11, '系统管理员', 'AtomicMetricFolder', 10, 'METRIC');
insert into idata.dev_folder (id, creator, folder_name, parent_id, folder_type) values (12, '系统管理员', 'DeriveMetricFolder', 10, 'METRIC');
insert into idata.dev_folder (id, creator, folder_name, parent_id, folder_type) values (13, '系统管理员', 'ComplexMetricFolder', 10, 'METRIC');
--
-- dev_label_define
-- 表:数据库名称、是否分区表、安全等级、数仓分层、表中文名称、数仓所属人、业务方所属人、数据资产、数据域、metabase地址、描述、业务过程
insert into idata.dev_label_define (creator, label_code, label_name, label_tag, label_param_type, subject_type,
label_required, folder_id)
values ('系统管理员', 'dbName:LABEL', '数据库名称', 'STRING_LABEL', 'STRING', 'TABLE', 1, 1);
insert into idata.dev_label_define (creator, label_code, label_name, label_tag, label_param_type, subject_type,
label_required, folder_id)
values ('系统管理员', 'partitionedTbl:LABEL', '是否分区表', 'BOOLEAN_LABEL', 'BOOLEAN', 'TABLE', 1, 1);
insert into idata.dev_label_define (creator, label_code, label_name, label_tag, label_param_type, subject_type,
label_required, folder_id)
values ('系统管理员', 'tblSecurityLevel:LABEL', '安全等级', 'ENUM_VALUE_LABEL', 'securityLevelEnum:ENUM', 'TABLE', 0, 1);
insert into idata.dev_label_define (creator, label_code, label_name, label_tag, label_param_type, subject_type,
label_required, folder_id)
values ('系统管理员', 'dwLayer:LABEL', '数仓分层', 'ENUM_VALUE_LABEL', 'dwLayerEnum:ENUM', 'TABLE', 1, 1);
insert into idata.dev_label_define (creator, label_code, label_name, label_tag, label_param_type, subject_type,
label_required, folder_id)
values ('系统管理员', 'tblComment:LABEL', '表中文名称', 'STRING_LABEL', 'STRING', 'TABLE', 1, 1);
insert into idata.dev_label_define (creator, label_code, label_name, label_tag, label_param_type, subject_type,
label_required, folder_id)
values ('系统管理员', 'dwOwnerId:LABEL', '数仓所属人', 'USER_LABEL', 'WHOLE', 'TABLE', 1, 1);
insert into idata.dev_label_define (creator, label_code, label_name, label_tag, label_param_type, subject_type,
label_required, folder_id)
values ('系统管理员', 'pwOwnerId:LABEL', '业务所属人', 'STRING_LABEL', 'STRING', 'TABLE', 1, 1);
insert into idata.dev_label_define (creator, label_code, label_name, label_tag, label_param_type, subject_type,
label_required, folder_id)
values ('系统管理员', 'assetCatalogue:LABEL', '数据资产', 'ENUM_VALUE_LABEL', 'assetCatalogueEnum:ENUM', 'TABLE', 0, 1);
insert into idata.dev_label_define (creator, label_code, label_name, label_tag, label_param_type, subject_type,
label_required, folder_id)
values ('系统管理员', 'domainId:LABEL', '数据域', 'ENUM_VALUE_LABEL', 'domainIdEnum:ENUM', 'TABLE', 1, 1);
insert into idata.dev_label_define (creator, label_code, label_name, label_tag, label_param_type, subject_type,
label_required, folder_id)
values ('系统管理员', 'metabaseUrl:LABEL', 'Metabase地址', 'STRING_LABEL', 'STRING', 'TABLE', 0, 1);
insert into idata.dev_label_define (creator, label_code, label_name, label_tag, label_param_type, subject_type,
label_required, folder_id)
values ('系统管理员', 'tblDescription:LABEL', '描述', 'STRING_LABEL', 'STRING', 'TABLE', 0, 1);
insert into idata.dev_label_define (creator, label_code, label_name, label_tag, label_param_type, subject_type,
label_required, folder_id)
values ('系统管理员', 'bizProcess:LABEL', '业务过程', 'ENUM_VALUE_LABEL', 'bizProcessEnum:ENUM', 'TABLE', 0, 1);
-- 字段:主键、字段类型、安全等级、字段中文名称、是否分区字段、描述
insert into idata.dev_label_define (creator, label_code, label_name, label_tag, label_param_type, subject_type,
label_required, folder_id)
values ('系统管理员', 'pk:LABEL', '是否主键', 'BOOLEAN_LABEL', 'BOOLEAN', 'COLUMN', 1, 1);
insert into idata.dev_label_define (creator, label_code, label_name, label_tag, label_param_type, subject_type,
label_required, folder_id)
values ('系统管理员', 'columnType:LABEL', '字段类型', 'ENUM_VALUE_LABEL', 'hiveColTypeEnum:ENUM', 'COLUMN', 1, 1);
insert into idata.dev_label_define (creator, label_code, label_name, label_tag, label_param_type, subject_type,
label_required, folder_id)
values ('系统管理员', 'colSecurityLevel:LABEL', '安全等级', 'ENUM_VALUE_LABEL', 'securityLevelEnum:ENUM', 'COLUMN', 0, 1);
insert into idata.dev_label_define (creator, label_code, label_name, label_tag, label_param_type, subject_type,
label_required, folder_id)
values ('系统管理员', 'columnComment:LABEL', '字段中文名称', 'STRING_LABEL', 'STRING', 'COLUMN', 0, 1);
insert into idata.dev_label_define (creator, label_code, label_name, label_tag, label_param_type, subject_type,
label_required, folder_id)
values ('系统管理员', 'partitionedCol:LABEL', '是否分区字段', 'BOOLEAN_LABEL', 'BOOLEAN', 'COLUMN', 1, 1);
insert into idata.dev_label_define (creator, label_code, label_name, label_tag, label_param_type, subject_type,
label_required, folder_id)
values ('系统管理员', 'columnDescription:LABEL', '描述', 'STRING_LABEL', 'STRING', 'COLUMN', 0, 1);
--
-- dev_enum、dev_enum_value
-- 数据域、业务过程、数仓分层、安全等级、hive字段类型、聚合方式、数据资产
-- 数据域
insert into idata.dev_enum (creator, enum_code, enum_name, folder_id) values ('系统管理员', 'domainIdEnum:ENUM', '数据域', 2);
insert into idata.dev_enum_value (creator, enum_code, value_code, enum_value)
values ('系统管理员', 'domainIdEnum:ENUM', 'USER_DOMAIN:ENUM_VALUE', '用户域');
insert into idata.dev_enum_value (creator, enum_code, value_code, enum_value)
values ('系统管理员', 'domainIdEnum:ENUM', 'TRADE_DOMAIN:ENUM_VALUE', '交易域');
insert into idata.dev_enum_value (creator, enum_code, value_code, enum_value)
values ('系统管理员', 'domainIdEnum:ENUM', 'PRODUCT_DOMAIN:ENUM_VALUE', '商品域');
insert into idata.dev_enum_value (creator, enum_code, value_code, enum_value)
values ('系统管理员', 'domainIdEnum:ENUM', 'USER_BEHAVIOUR_DOMAIN:ENUM_VALUE', '用户行为域');
insert into idata.dev_enum_value (creator, enum_code, value_code, enum_value)
values ('系统管理员', 'domainIdEnum:ENUM', 'FILE_DOMAIN:ENUM_VALUE', '文件域');
insert into idata.dev_enum_value (creator, enum_code, value_code, enum_value)
values ('系统管理员', 'domainIdEnum:ENUM', 'GENERAL_DOMAIN:ENUM_VALUE', '通用域');
insert into idata.dev_enum_value (creator, enum_code, value_code, enum_value)
values ('系统管理员', 'domainIdEnum:ENUM', 'PROCURE_DOMAIN:ENUM_VALUE', '采购域');
insert into idata.dev_enum_value (creator, enum_code, value_code, enum_value)
values ('系统管理员', 'domainIdEnum:ENUM', 'ECOLOGY_DOMAIN:ENUM_VALUE', '金融域');
insert into idata.dev_enum_value (creator, enum_code, value_code, enum_value)
values ('系统管理员', 'domainIdEnum:ENUM', 'FINANCE_DOMAIN:ENUM_VALUE', '财务域');
insert into idata.dev_enum (creator, enum_code, enum_name, folder_id) values ('系统管理员', 'bizProcessEnum:ENUM', '业务过程', 2);
-- 数仓分层
insert into idata.dev_enum (creator, enum_code, enum_name, folder_id) values ('系统管理员', 'dwLayerEnum:ENUM', '数仓分层', 2);
insert into idata.dev_enum_value (creator, enum_code, value_code, enum_value)
values ('系统管理员', 'dwLayerEnum:ENUM', 'DW_LAYER_ADS:ENUM_VALUE', 'ADS');
insert into idata.dev_enum_value (creator, enum_code, value_code, enum_value)
values ('系统管理员', 'dwLayerEnum:ENUM', 'DW_LAYER_DWS:ENUM_VALUE', 'DWS');
insert into idata.dev_enum_value (creator, enum_code, value_code, enum_value)
values ('系统管理员', 'dwLayerEnum:ENUM', 'DW_LAYER_DWD:ENUM_VALUE', 'DWD');
insert into idata.dev_enum_value (creator, enum_code, value_code, enum_value)
values ('系统管理员', 'dwLayerEnum:ENUM', 'DW_LAYER_DIM:ENUM_VALUE', 'DIM');
insert into idata.dev_enum_value (creator, enum_code, value_code, enum_value)
values ('系统管理员', 'dwLayerEnum:ENUM', 'DW_LAYER_ODS:ENUM_VALUE', 'ODS');
-- 安全等级
insert into idata.dev_enum (creator, enum_code, enum_name, folder_id) values ('系统管理员', 'securityLevelEnum:ENUM', '安全等级', 2);
insert into idata.dev_enum_value (creator, enum_code, value_code, enum_value)
values ('系统管理员', 'securityLevelEnum:ENUM', 'SECURITY_LEVEL_C1:ENUM_VALUE', '客户可公开数据(C1)');
insert into idata.dev_enum_value (creator, enum_code, value_code, enum_value)
values ('系统管理员', 'securityLevelEnum:ENUM', 'SECURITY_LEVEL_C2:ENUM_VALUE', '客户可共享数据(C2)');
insert into idata.dev_enum_value (creator, enum_code, value_code, enum_value)
values ('系统管理员', 'securityLevelEnum:ENUM', 'SECURITY_LEVEL_C3:ENUM_VALUE', '客户隐私数据(C3)');
insert into idata.dev_enum_value (creator, enum_code, value_code, enum_value)
values ('系统管理员', 'securityLevelEnum:ENUM', 'SECURITY_LEVEL_C4:ENUM_VALUE', '客户机密数据(C4)');
insert into idata.dev_enum_value (creator, enum_code, value_code, enum_value)
values ('系统管理员', 'securityLevelEnum:ENUM', 'SECURITY_LEVEL_S1:ENUM_VALUE', '业务可公开数据(S1)');
insert into idata.dev_enum_value (creator, enum_code, value_code, enum_value)
values ('系统管理员', 'securityLevelEnum:ENUM', 'SECURITY_LEVEL_S2:ENUM_VALUE', '业务内部数据(S2)');
insert into idata.dev_enum_value (creator, enum_code, value_code, enum_value)
values ('系统管理员', 'securityLevelEnum:ENUM', 'SECURITY_LEVEL_S3:ENUM_VALUE', '业务保密数据(S3)');
insert into idata.dev_enum_value (creator, enum_code, value_code, enum_value)
values ('系统管理员', 'securityLevelEnum:ENUM', 'SECURITY_LEVEL_S4:ENUM_VALUE', '业务机密数据(S4)');
insert into idata.dev_enum_value (creator, enum_code, value_code, enum_value)
values ('系统管理员', 'securityLevelEnum:ENUM', 'SECURITY_LEVEL_B1:ENUM_VALUE', '政采云可公开数据(B1)');
insert into idata.dev_enum_value (creator, enum_code, value_code, enum_value)
values ('系统管理员', 'securityLevelEnum:ENUM', 'SECURITY_LEVEL_B2:ENUM_VALUE', '政采云内部数据(B2)');
insert into idata.dev_enum_value (creator, enum_code, value_code, enum_value)
values ('系统管理员', 'securityLevelEnum:ENUM', 'SECURITY_LEVEL_B3:ENUM_VALUE', '政采云保密数据(B3)');
insert into idata.dev_enum_value (creator, enum_code, value_code, enum_value)
values ('系统管理员', 'securityLevelEnum:ENUM', 'SECURITY_LEVEL_B4:ENUM_VALUE', '政采云机密数据(B4)');
insert into idata.dev_enum_value (creator, enum_code, value_code, enum_value)
values ('系统管理员', 'securityLevelEnum:ENUM', 'SECURITY_LEVEL_LOW:ENUM_VALUE', '低');
insert into idata.dev_enum_value (creator, enum_code, value_code, enum_value)
values ('系统管理员', 'securityLevelEnum:ENUM', 'SECURITY_LEVEL_MEDIUM:ENUM_VALUE', '中');
insert into idata.dev_enum_value (creator, enum_code, value_code, enum_value)
values ('系统管理员', 'securityLevelEnum:ENUM', 'SECURITY_LEVEL_HIGH:ENUM_VALUE', '高');
-- hive字段类型
insert into idata.dev_enum (creator, enum_code, enum_name, folder_id) values ('系统管理员', 'hiveColTypeEnum:ENUM', 'hive字段类型', 2);
insert into idata.dev_enum_value (creator, enum_code, value_code, enum_value)
values ('系统管理员', 'hiveColTypeEnum:ENUM', 'HIVE_COL_TYPE_BIGINT:ENUM_VALUE', 'BIGINT');
insert into idata.dev_enum_value (creator, enum_code, value_code, enum_value)
values ('系统管理员', 'hiveColTypeEnum:ENUM', 'HIVE_COL_TYPE_DOUBLE:ENUM_VALUE', 'DOUBLE');
insert into idata.dev_enum_value (creator, enum_code, value_code, enum_value)
values ('系统管理员', 'hiveColTypeEnum:ENUM', 'HIVE_COL_TYPE_TIMESTAMP:ENUM_VALUE', 'TIMESTAMP');
insert into idata.dev_enum_value (creator, enum_code, value_code, enum_value)
values ('系统管理员', 'hiveColTypeEnum:ENUM', 'HIVE_COL_TYPE_DATE:ENUM_VALUE', 'DATE');
insert into idata.dev_enum_value (creator, enum_code, value_code, enum_value)
values ('系统管理员', 'hiveColTypeEnum:ENUM', 'HIVE_COL_TYPE_STRING:ENUM_VALUE', 'STRING');
insert into idata.dev_enum_value (creator, enum_code, value_code, enum_value)
values ('系统管理员', 'hiveColTypeEnum:ENUM', 'HIVE_COL_TYPE_ARRAY_BIGINT:ENUM_VALUE', 'ARRAY<BIGINT>');
insert into idata.dev_enum_value (creator, enum_code, value_code, enum_value)
values ('系统管理员', 'hiveColTypeEnum:ENUM', 'HIVE_COL_TYPE_ARRAY_DOUBLE:ENUM_VALUE', 'ARRAY<DOUBLE>');
insert into idata.dev_enum_value (creator, enum_code, value_code, enum_value)
values ('系统管理员', 'hiveColTypeEnum:ENUM', 'HIVE_COL_TYPE_ARRAY_TIMESTAMP:ENUM_VALUE', 'ARRAY<TIMESTAMP>');
insert into idata.dev_enum_value (creator, enum_code, value_code, enum_value)
values ('系统管理员', 'hiveColTypeEnum:ENUM', 'HIVE_COL_TYPE_ARRAY_DATE:ENUM_VALUE', 'ARRAY<DATE>');
insert into idata.dev_enum_value (creator, enum_code, value_code, enum_value)
values ('系统管理员', 'hiveColTypeEnum:ENUM', 'HIVE_COL_TYPE_ARRAY_STRING:ENUM_VALUE', 'ARRAY<STRING>');
-- 聚合方式
insert into idata.dev_enum (creator, enum_code, enum_name, folder_id) values ('系统管理员', 'aggregatorEnum:ENUM', '聚合方式', 2);
insert into idata.dev_enum_value (creator, enum_code, value_code, enum_value)
values ('系统管理员', 'aggregatorEnum:ENUM', 'AGGREGATOR_SUM:ENUM_VALUE', '求和');
insert into idata.dev_enum_value (creator, enum_code, value_code, enum_value)
values ('系统管理员', 'aggregatorEnum:ENUM', 'AGGREGATOR_AVG:ENUM_VALUE', '求平均');
insert into idata.dev_enum_value (creator, enum_code, value_code, enum_value)
values ('系统管理员', 'aggregatorEnum:ENUM', 'AGGREGATOR_MAX:ENUM_VALUE', '最大值');
insert into idata.dev_enum_value (creator, enum_code, value_code, enum_value)
values ('系统管理员', 'aggregatorEnum:ENUM', 'AGGREGATOR_MIN:ENUM_VALUE', '最小值');
insert into idata.dev_enum_value (creator, enum_code, value_code, enum_value)
values ('系统管理员', 'aggregatorEnum:ENUM', 'AGGREGATOR_CNT:ENUM_VALUE', '计数');
insert into idata.dev_enum_value (creator, enum_code, value_code, enum_value)
values ('系统管理员', 'aggregatorEnum:ENUM', 'AGGREGATOR_CNTD:ENUM_VALUE', '去重计数');
insert into idata.dev_enum (creator, enum_code, enum_name, folder_id) values ('系统管理员', 'assetCatalogueEnum:ENUM', '数据资产', 2);
--
-- dev_enum_value
-- 同dev_enum
-- 告警等级
insert into idata.dev_label_define (creator, label_code, label_name, label_tag, label_param_type, subject_type,
label_required)
values ('系统管理员', 'alarmLayer:LABEL', '告警等级', 'ENUM_VALUE_LABEL', 'alarmLayerEnum:ENUM', 'TABLE', 0);
insert into idata.dev_enum (creator, enum_code, enum_name, folder_id) values ('系统管理员', 'alarmLayerEnum:ENUM', '告警等级',
2);
insert into idata.dev_enum_value (creator, enum_code, value_code, enum_value)
values ('系统管理员', 'alarmLayerEnum:ENUM', 'ALARM_LEVEL_HIGH:ENUM_VALUE', '高');
insert into idata.dev_enum_value (creator, enum_code, value_code, enum_value)
values ('系统管理员', 'alarmLayerEnum:ENUM', 'ALARM_LEVEL_MEDIUM:ENUM_VALUE', '中');
insert into idata.dev_enum_value (creator, enum_code, value_code, enum_value)
values ('系统管理员', 'alarmLayerEnum:ENUM', 'ALARM_LEVEL_LOW:ENUM_VALUE', '低');
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.