sql
stringlengths 6
1.05M
|
|---|
-- phpMyAdmin SQL Dump
-- version 5.1.1
-- https://www.phpmyadmin.net/
--
-- Servidor: 127.0.0.1
-- Tiempo de generación: 07-08-2021 a las 02:38:12
-- Versión del servidor: 10.4.19-MariaDB
-- Versión de PHP: 8.0.7
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 */;
--
-- Base de datos: `evab`
--
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `articulos`
--
CREATE TABLE `articulos` (
`id_articulo` int(3) NOT NULL,
`nombre_articulo` varchar(50) NOT NULL,
`tipo` varchar(50) NOT NULL,
`marca` varchar(50) NOT NULL,
`precio` float NOT NULL,
`disponibilidad` varchar(25) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Volcado de datos para la tabla `articulos`
--
INSERT INTO `articulos` (`id_articulo`, `nombre_articulo`, `tipo`, `marca`, `precio`, `disponibilidad`) VALUES
(1, 'Ecógrafo', 'Diagnóstico', 'Mindray', 10000000, 'stock'),
(2, 'Resonador ', 'Diagnóstico', 'Hitachi', 2000000000, 'stock'),
(3, 'Mamógrafo', 'Diagnóstico', 'Fugifilm', 50000000, 'vendido'),
(4, 'Tomógrafo', 'Diagnóstico', 'Hitachi', 70000000, 'stock'),
(5, 'Oxímetro', 'Diagnóstico', 'Coronet', 3450, 'stock'),
(6, 'Respirador', 'Tratamiento', 'Mindray', 30000000, 'vendido'),
(7, 'Bomba de infusión', 'Tratamiento', 'Mindray', 115000, 'stock'),
(8, 'Monitor multiparamétrico', 'Diagnóstico', 'Mindray', 500000000, 'stock'),
(9, 'Equipo de RX', 'Diagnóstico', 'Phillips', 50000000, 'vendido'),
(10, 'Desfibrilador', 'Tratamiento', 'Mindray', 10000000, 'stock'),
(11, 'Máquina de Anestesia', 'Tratamiento', 'Mindray', 20000000, 'stock'),
(12, 'Electrobisturí', 'Tratamiento', 'CEC', 825000, 'Stock'),
(13, 'Ondas de choque', 'Tratamiento', 'CEC', 684431, 'vendido'),
(14, 'Equipo de electroporación', 'Tratamiento', 'CEC', 59690, 'vendido'),
(15, 'Equipo de magnetoterapia', 'Tratamiento', 'CEC', 38600, 'stock'),
(17, 'Aspirador quirúrgico', 'Tratamiento', 'CEC', 325000, 'Stock');
--
-- Índices para tablas volcadas
--
--
-- Indices de la tabla `articulos`
--
ALTER TABLE `articulos`
ADD PRIMARY KEY (`id_articulo`);
--
-- AUTO_INCREMENT de las tablas volcadas
--
--
-- AUTO_INCREMENT de la tabla `articulos`
--
ALTER TABLE `articulos`
MODIFY `id_articulo` int(3) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=30;
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.2
-- https://www.phpmyadmin.net/
--
-- Máy chủ: 127.0.0.1
-- Thời gian đã tạo: Th1 14, 2020 lúc 03:46 AM
-- Phiên bản máy phục vụ: 10.4.11-MariaDB
-- Phiên bản PHP: 7.4.1
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 */;
--
-- Cơ sở dữ liệu: `webdownload`
--
CREATE DATABASE IF NOT EXISTS `webdownload` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
USE `webdownload`;
-- --------------------------------------------------------
--
-- Cấu trúc bảng cho bảng `tblaccount`
--
CREATE TABLE IF NOT EXISTS `tblaccount` (
`ID` int(11) NOT NULL,
`role` int(11) NOT NULL,
`username` text NOT NULL,
`password` text NOT NULL,
`activated` int(11) NOT NULL,
`deleted` int(11) NOT NULL,
`mobile` text DEFAULT NULL,
`Fullname` text NOT NULL,
`date_of_birth` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Đang đổ dữ liệu cho bảng `tblaccount`
--
INSERT INTO `tblaccount` (`ID`, `role`, `username`, `password`, `activated`, `deleted`, `mobile`, `Fullname`, `date_of_birth`) VALUES
(1, 1, 'admin', '<PASSWORD>', 1, 0, '0353237140', 'Trần Mạnh Cường', '2020-01-22 00:00:00');
-- --------------------------------------------------------
--
-- Cấu trúc bảng cho bảng `tblcategory`
--
CREATE TABLE IF NOT EXISTS `tblcategory` (
`ID` int(11) NOT NULL,
`name` text NOT NULL,
`url` text NOT NULL,
`order` int(11) NOT NULL,
`icon` text DEFAULT NULL,
`ParentID` int(11) DEFAULT NULL,
`text` text DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Đang đổ dữ liệu cho bảng `tblcategory`
--
INSERT INTO `tblcategory` (`ID`, `name`, `url`, `order`, `icon`, `ParentID`, `text`) VALUES
(1, 'Linux', 'linux', 2, 'https://upload.wikimedia.org/wikipedia/commons/thumb/3/35/Tux.svg/270px-Tux.svg.png', NULL, NULL),
(2, 'Windows xp', 'win-xp', 1, 'http://icons.iconarchive.com/icons/tatice/operating-systems/128/Windows-icon.png', 3, NULL),
(3, 'Windows', 'windows', 1, 'http://icons.iconarchive.com/icons/martz90/circle/128/windows-8-icon.png', NULL, NULL),
(4, 'Văn phòng', 'vangphong', 3, 'http://icons.iconarchive.com/icons/tatice/operating-systems/128/Windows-icon.png', 3, NULL),
(5, 'Game', 'game', 4, 'https://upload.wikimedia.org/wikipedia/commons/thumb/3/35/Tux.svg/270px-Tux.svg.png', 3, NULL),
(6, 'Ubuntu', 'Ubuntu', 5, 'http://icons.iconarchive.com/icons/tatice/operating-systems/128/Ubuntu-icon.png', 1, NULL);
-- --------------------------------------------------------
--
-- Cấu trúc bảng cho bảng `tblsoftware`
--
CREATE TABLE IF NOT EXISTS `tblsoftware` (
`ID` int(11) NOT NULL,
`DateAdd` datetime NOT NULL,
`Name` text NOT NULL,
`icon` text NOT NULL,
`rating` float NOT NULL DEFAULT 0,
`provider` text DEFAULT NULL,
`version` text DEFAULT NULL,
`lience` int(11) NOT NULL,
`size` int(11) NOT NULL,
`viewed` int(11) NOT NULL,
`downloaded` int(11) NOT NULL,
`operating_systems` text DEFAULT NULL,
`text` text DEFAULT NULL,
`main_download` text DEFAULT NULL,
`related_downloadID` int(11) DEFAULT NULL,
`tags` text DEFAULT NULL,
`categoryID` int(11) NOT NULL,
`Visible` int(11) NOT NULL,
`short_url` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Đang đổ dữ liệu cho bảng `tblsoftware`
--
INSERT INTO `tblsoftware` (`ID`, `DateAdd`, `Name`, `icon`, `rating`, `provider`, `version`, `lience`, `size`, `viewed`, `downloaded`, `operating_systems`, `text`, `main_download`, `related_downloadID`, `tags`, `categoryID`, `Visible`, `short_url`) VALUES
(1, '2020-01-11 10:11:12', 'Microsoft Office 2016', '/images/office.png', 2, NULL, NULL, 1, 0, 50, 11, 'Windows 7 | 8.1 | 10', '<p><strong>Office 2016</strong> là phiên bản mới của Microsoft. Là bộ ứng dụng văn phòng với nhiều công cụ mạnh mẽ hơn Office 2010, 2007, 2003.</p><figure class=\"image\"><img src=\"https://caidatphanmem.net/wp-content/uploads/2018/11/microsoft-office-2016-120718-711x400.png\" alt=\"\" srcset=\"https://caidatphanmem.net/wp-content/uploads/2018/11/microsoft-office-2016-120718-711x400.png 711w, https://caidatphanmem.net/wp-content/uploads/2018/11/microsoft-office-2016-120718-768x432.png 768w, https://caidatphanmem.net/wp-content/uploads/2018/11/microsoft-office-2016-120718.png 1280w\" sizes=\"100vw\" width=\"711\"></figure><p> </p><p><strong>Office 2016</strong> mang lại một cách làm việc mới, hiệu quả với nhiều tính năng. Sau đây, mình sẽ hướng dẫn các bạn <i>Download Office 2016.</i></p><h3>Hướng Dẫn Cách Download Office 2016 Full Crack</h3><p>+)<strong> Link tải</strong>:</p><ul><li><a href=\"http://123link.pro/X6riz\"><strong>Office 2016 64bit</strong></a></li><li><a href=\"http://123link.pro/eoeHgNa\"><strong>Office 2016 32bit</strong></a></li></ul><p>+) <strong>key: NKGG6-WBPCC-HXWMY-6DQGJ-CPQVG</strong></p><h3>Hướng dẫn cách cài đặt Office 2016</h3><p>Tương tự như cài Office 2010 và Office 2007.</p><p>Bạn có thể tham khảo cách cài đặt <a href=\"https://caidatphanmem.net/tai-microsoft-office-2010-full-key-ban-quyen-mien-phi/\"><strong>Office 2010</strong></a> và <a href=\"https://caidatphanmem.net/tai-va-cai-dat-office-2007-crack-key-caidatphanmem-net/\"><strong>Office 2007.</strong></a></p><p><strong>Bước 1:</strong></p><p>Sau khi tải về, bạn tiến hành cài đặt trên máy tính( phụ thuộc vào máy tính + tốc độ truyền mạng).</p><p>Khi <strong>cài đặt</strong> hoàn tất => nhấn <strong>close .</strong></p>', 'http://123link.pro/X6riz55555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555\r\nhttp://123link.pro/X6riz55555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555\r\n', NULL, NULL, 4, 1, 'microsoft-office'),
(2, '2020-01-13 13:37:45', 'Microsoft Office 2019', '/assets/images/eco-product-img-1.png', 0, 'Microsoft', '71', 0, 0, 48, 6, 'Windows xp', NULL, NULL, NULL, NULL, 4, 1, 'windows');
-- --------------------------------------------------------
--
-- Cấu trúc bảng cho bảng `tbltop`
--
CREATE TABLE IF NOT EXISTS `tbltop` (
`ID` int(11) NOT NULL,
`Week` text DEFAULT NULL,
`Top` text DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Cấu trúc bảng cho bảng `__efmigrationshistory`
--
CREATE TABLE IF NOT EXISTS `__efmigrationshistory` (
`MigrationId` varchar(150) CHARACTER SET utf8 NOT NULL,
`ProductVersion` varchar(32) CHARACTER SET utf8 NOT NULL,
PRIMARY KEY (`MigrationId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Đang đổ dữ liệu cho bảng `__efmigrationshistory`
--
INSERT INTO `__efmigrationshistory` (`MigrationId`, `ProductVersion`) VALUES
('20200114023441_Initial', '2.1.14-servicing-32113'),
('20200114024127_NotAllowNull', '2.1.14-servicing-32113');
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 */;
|
<reponame>CloudifySource/cloudify-widget
alter table widget add column auto_refresh_recipe tinyint(1) default 1;
alter table widget add column auto_refresh_provider tinyint(1) default 1;
alter table widget add column cloud_provider_url varchar(511);
alter table widget add column cloud_provider_root_dir varchar(255);
|
-- Sequence: aud_seq
-- DROP SEQUENCE aud_seq;
CREATE SEQUENCE aud_seq
INCREMENT 1
MINVALUE 1
MAXVALUE 1000000
START 1
CACHE 1
CYCLE;
ALTER TABLE aud_seq
OWNER TO postgres;
|
CREATE TABLE "users" (
"id" SERIAL PRIMARY KEY,
"name" VARCHAR(30) NOT NULL,
"display_name" VARCHAR(45) NOT NULL,
"password" VARCHAR(255) NOT NULL
);
CREATE TABLE "roles" (
"id" SERIAL PRIMARY KEY,
"name" VARCHAR(45) NOT NULL
);
CREATE TABLE "user_roles" (
"user_id" INT NOT NULL,
"role_id" INT NOT NULL,
PRIMARY KEY ("user_id", "role_id"),
CONSTRAINT "fk_user_roles_users"
FOREIGN KEY ("user_id")
REFERENCES "users"("id")
ON DELETE CASCADE,
CONSTRAINT "fk_user_roles_roles"
FOREIGN KEY ("role_id")
REFERENCES "roles"("id")
ON DELETE CASCADE
);
INSERT INTO "users"
("name", "display_name", "password")
VALUES
('beni39', '<NAME>', 'rahasia123'),
('ferimahendra', '<NAME>', 'F9Hi3k8_FKi3');
INSERT INTO "roles"
("name")
VALUES
('Mahasiswa'),
('Dosen Tetap'),
('Teller');
INSERT INTO "user_roles"
("user_id", "role_id")
VALUES
(1, 2),
(1, 3),
(2, 1);
|
/*
Navicat MySQL Data Transfer
Source Server : MySql
Source Server Version : 50528
Source Host : localhost:3306
Source Database : geekqanda
Target Server Type : MYSQL
Target Server Version : 50528
File Encoding : 65001
Date: 2014-10-22 21:54:37
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for `qa_tag`
-- ----------------------------
DROP TABLE IF EXISTS `qa_tag`;
CREATE TABLE `qa_tag` (
`qa_id` int(11) NOT NULL,
`tag_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of qa_tag
-- ----------------------------
|
<gh_stars>1-10
INSERT INTO `drops` VALUES ('684', '289', '100', ' 1', '100');
INSERT INTO `drops` VALUES ('684', '2018', '100', ' 1', '100');
INSERT INTO `drops` VALUES ('685', '400', '100', ' 1', '100');
INSERT INTO `drops` VALUES ('685', '2032', '100', ' 1', '100');
INSERT INTO `drops` VALUES ('686', '533', '100', ' 1', '100');
INSERT INTO `drops` VALUES ('686', '1671', '100', ' 1', '100');
INSERT INTO `drops` VALUES ('687', '401', '100', ' 1', '100');
INSERT INTO `drops` VALUES ('687', '2021', '100', ' 1', '100');
INSERT INTO `drops` VALUES ('688', '423', '100', ' 1', '100');
INSERT INTO `drops` VALUES ('688', '2026', '100', ' 1', '100');
INSERT INTO `drops` VALUES ('689', '532', '100', ' 1', '100');
INSERT INTO `drops` VALUES ('689', '2029', '100', ' 1', '100');
INSERT INTO `drops` VALUES ('690', '7018', '100', ' 1', '100');
INSERT INTO `drops` VALUES ('691', '405', '100', ' 1', '100');
INSERT INTO `drops` VALUES ('692', '425', '100', ' 1', '100');
INSERT INTO `drops` VALUES ('692', '2035', '100', ' 1', '100');
INSERT INTO `drops` VALUES ('693', '39', '100', ' 1', '100');
INSERT INTO `drops` VALUES ('694', '411', '100', ' 1', '100');
INSERT INTO `drops` VALUES ('695', '412', '100', ' 1', '100');
INSERT INTO `drops` VALUES ('696', '442', '100', ' 1', '100');
INSERT INTO `drops` VALUES ('696', '443', '100', ' 1', '100');
INSERT INTO `drops` VALUES ('697', '445', '100', ' 1', '100');
INSERT INTO `drops` VALUES ('698', '444', '100', ' 1', '100');
INSERT INTO `drops` VALUES ('699', '7032', '100', ' 1', '100');
INSERT INTO `drops` VALUES ('700', '350', '100', ' 1', '100');
INSERT INTO `drops` VALUES ('701', '446', '100', ' 1', '100');
INSERT INTO `drops` VALUES ('702', '313', '100', ' 1', '100');
INSERT INTO `drops` VALUES ('703', '7033', '100', ' 1', '100');
INSERT INTO `drops` VALUES ('704', '421', '100', ' 1', '100');
INSERT INTO `drops` VALUES ('705', '428', '100', ' 1', '100');
INSERT INTO `drops` VALUES ('706', '395', '100', ' 1', '100');
INSERT INTO `drops` VALUES ('707', '380', '100', ' 1', '100');
INSERT INTO `drops` VALUES ('708', '593', '100', ' 1', '100');
INSERT INTO `drops` VALUES ('709', '594', '100', ' 1', '100');
INSERT INTO `drops` VALUES ('710', '7059', '100', ' 1', '100');
INSERT INTO `drops` VALUES ('711', '303', '100', ' 1', '100');
INSERT INTO `drops` VALUES ('712', '473', '100', ' 1', '100');
INSERT INTO `drops` VALUES ('713', '476', '100', ' 1', '100');
INSERT INTO `drops` VALUES ('714', '460', '100', ' 1', '100');
INSERT INTO `drops` VALUES ('715', '2358', '100', ' 1', '100');
INSERT INTO `drops` VALUES ('716', '2357', '100', ' 1', '100');
INSERT INTO `drops` VALUES ('717', '471', '100', ' 1', '100');
INSERT INTO `drops` VALUES ('718', '461', '100', ' 1', '100');
INSERT INTO `drops` VALUES ('719', '7013', '100', ' 1', '100');
INSERT INTO `drops` VALUES ('720', '7925', '100', ' 1', '100');
INSERT INTO `drops` VALUES ('721', '474', '100', ' 1', '100');
INSERT INTO `drops` VALUES ('722', '449', '100', ' 1', '100');
INSERT INTO `drops` VALUES ('723', '7016', '100', ' 1', '100');
INSERT INTO `drops` VALUES ('724', '470', '100', ' 1', '100');
INSERT INTO `drops` VALUES ('725', '7014', '100', ' 1', '100');
INSERT INTO `drops` VALUES ('726', '1782', '100', ' 1', '100');
INSERT INTO `drops` VALUES ('726', '1790', '100', ' 1', '100');
INSERT INTO `drops` VALUES ('727', '607', '100', ' 1', '100');
INSERT INTO `drops` VALUES ('727', '1846', '100', ' 1', '100');
INSERT INTO `drops` VALUES ('728', '603', '100', ' 1', '100');
INSERT INTO `drops` VALUES ('729', '598', '100', ' 1', '100');
INSERT INTO `drops` VALUES ('730', '1757', '100', ' 1', '100');
INSERT INTO `drops` VALUES ('730', '1759', '100', ' 1', '100');
INSERT INTO `drops` VALUES ('731', '1750', '100', ' 1', '100');
INSERT INTO `drops` VALUES ('732', '1847', '100', ' 1', '100');
INSERT INTO `drops` VALUES ('732', '1749', '100', ' 1', '100');
INSERT INTO `drops` VALUES ('733', '1794', '100', ' 1', '100');
INSERT INTO `drops` VALUES ('733', '1796', '100', ' 1', '100');
INSERT INTO `drops` VALUES ('734', '1805', '100', ' 1', '100');
INSERT INTO `drops` VALUES ('734', '1807', '100', ' 1', '100');
INSERT INTO `drops` VALUES ('735', '600', '100', ' 1', '100');
INSERT INTO `drops` VALUES ('735', '1799', '100', ' 1', '100');
INSERT INTO `drops` VALUES ('736', '1792', '100', ' 1', '100');
INSERT INTO `drops` VALUES ('737', '1784', '100', ' 1', '100');
INSERT INTO `drops` VALUES ('737', '1788', '100', ' 1', '100');
INSERT INTO `drops` VALUES ('738', '1801', '100', ' 1', '100');
INSERT INTO `drops` VALUES ('738', '1803', '100', ' 1', '100');
INSERT INTO `drops` VALUES ('739', '602', '100', ' 1', '100');
INSERT INTO `drops` VALUES ('739', '1853', '100', ' 1', '100');
|
UPDATE envelope SET created_time = (data->'auditFields'->>'createdDate')::TIMESTAMPTZ WHERE created_time IS NULL;
ALTER TABLE envelope ALTER COLUMN created_time SET DEFAULT CURRENT_TIMESTAMP;
ALTER TABLE envelope ALTER COLUMN created_time SET NOT NULL;
|
-- =================================================
-- PACKAGE: FRAMEWORK
-- CREATE : 2018.11.6
-- UPDATE :
-- =================================================
CREATE TABLE AC_UI_PROPERTY (
PROPERTY_NAME VARCHAR2(100) NOT NULL,
PROPERTY_VALUE VARCHAR2(1024) NOT NULL,
CONSTRAINT AC_UI_PROPERTY_PK PRIMARY KEY (PROPERTY_NAME)
);
CREATE TABLE AC_UI_SEQUENCER(
SEQUENCER_ID INTEGER NOT NULL,
NAME VARCHAR2(100) NOT NULL,
DISPLAY_NAME VARCHAR(255),
VALUE INTEGER NOT NULL,
CONSTRAINT AC_UI_SEQUENCER_PK PRIMARY KEY (SEQUENCER_ID)
);
CREATE UNIQUE INDEX "AC_UI_SEQUENCER_UIDX1" ON "AC_UI_SEQUENCER" ("NAME");
COMMENT ON COLUMN "AC_UI_SEQUENCER"."SEQUENCER_ID" IS '시퀀서 ID';
COMMENT ON COLUMN "AC_UI_SEQUENCER"."NAME" IS '시퀀서 이름';
COMMENT ON COLUMN "AC_UI_SEQUENCER"."VALUE" IS '시퀀서 값';
COMMENT ON TABLE "AC_UI_SEQUENCER" IS '애플리케이션 전역에서 사용되는 시퀀서 정보';
-- =================================================
-- PACKAGE: SECURITY
-- CREATE : 2018.11.6
-- UPDATE :
-- =================================================
-- User
CREATE TABLE AC_UI_USER (
USER_ID INTEGER NOT NULL,
USERNAME VARCHAR2(100) NOT NULL,
PASSWORD_HASH VARCHAR2(64) NOT NULL,
NAME VARCHAR2(100),
NAME_VISIBLE NUMBER(1, 0) DEFAULT 1 ,
FIRST_NAME VARCHAR2(100),
LAST_NAME VARCHAR2(100),
EMAIL VARCHAR2(100) NOT NULL,
EMAIL_VISIBLE NUMBER(1, 0) DEFAULT 1,
USER_ENABLED NUMBER(1, 0) DEFAULT 1,
USER_EXTERNAL NUMBER(1, 0) DEFAULT 0,
STATUS NUMBER(1, 0) DEFAULT 0,
CREATION_DATE DATE DEFAULT SYSDATE NOT NULL,
MODIFIED_DATE DATE DEFAULT SYSDATE NOT NULL,
CONSTRAINT AC_UI_USER_PK PRIMARY KEY (USER_ID)
);
CREATE UNIQUE INDEX AC_UI_USER_IDX_USERNAME ON AC_UI_USER (USERNAME);
COMMENT ON TABLE "AC_UI_USER" IS '사용자 테이블';
COMMENT ON COLUMN "AC_UI_USER"."USER_ID" IS 'ID';
COMMENT ON COLUMN "AC_UI_USER"."USERNAME" IS '로그인 아이디';
COMMENT ON COLUMN "AC_UI_USER"."NAME" IS '전체 이름';
COMMENT ON COLUMN "AC_UI_USER"."PASSWORD_HASH" IS '암호화된 패스워드';
COMMENT ON COLUMN "AC_UI_USER"."NAME_VISIBLE" IS '이름 공개 여부';
COMMENT ON COLUMN "AC_UI_USER"."FIRST_NAME" IS '이름';
COMMENT ON COLUMN "AC_UI_USER"."LAST_NAME" IS '성';
COMMENT ON COLUMN "AC_UI_USER"."EMAIL" IS '메일주소';
COMMENT ON COLUMN "AC_UI_USER"."EMAIL_VISIBLE" IS '메일주소 공개여부';
COMMENT ON COLUMN "AC_UI_USER"."USER_ENABLED" IS '계정 사용여부';
COMMENT ON COLUMN "AC_UI_USER"."STATUS" IS '계정 상태';
COMMENT ON COLUMN "AC_UI_USER"."CREATION_DATE" IS '생성일자';
COMMENT ON COLUMN "AC_UI_USER"."MODIFIED_DATE" IS '수정일자';
-- Role
CREATE TABLE AC_UI_ROLE (
ROLE_ID INTEGER NOT NULL,
NAME VARCHAR2(100) NOT NULL,
DESCRIPTION VARCHAR2(1000) NOT NULL,
CREATION_DATE DATE DEFAULT SYSDATE NOT NULL,
MODIFIED_DATE DATE DEFAULT SYSDATE NOT NULL,
CONSTRAINT AC_UI_ROLE_PK PRIMARY KEY (ROLE_ID)
);
COMMENT ON TABLE "AC_UI_ROLE" IS '롤 테이블';
COMMENT ON COLUMN "AC_UI_ROLE"."ROLE_ID" IS '롤 ID';
COMMENT ON COLUMN "AC_UI_ROLE"."NAME" IS '롤 이름';
COMMENT ON COLUMN "AC_UI_ROLE"."DESCRIPTION" IS '설명';
COMMENT ON COLUMN "AC_UI_ROLE"."CREATION_DATE" IS '생성일자';
COMMENT ON COLUMN "AC_UI_ROLE"."MODIFIED_DATE" IS '수정일자';
CREATE UNIQUE INDEX AC_UI_ROLE_NAME_IDX ON AC_UI_ROLE (NAME);
-- User Roles
CREATE TABLE AC_UI_USER_ROLES (
USER_ID INTEGER NOT NULL,
ROLE_ID INTEGER NOT NULL,
CONSTRAINT AC_UI_USER_ROLES_PK PRIMARY KEY (USER_ID, ROLE_ID)
);
COMMENT ON TABLE "AC_UI_USER_ROLES" IS '사용자 롤 테이블';
COMMENT ON COLUMN "AC_UI_USER_ROLES"."USER_ID" IS '그룹 ID';
COMMENT ON COLUMN "AC_UI_USER_ROLES"."ROLE_ID" IS '롤 ID';
-- User remember me
CREATE TABLE AC_UI_USER_LOGIN_TOKEN (
UUID VARCHAR2(100) NOT NULL,
USERNAME VARCHAR2(100) NOT NULL,
TOKEN VARCHAR2(100) NOT NULL,
LAST_USE_DATE TIMESTAMP DEFAULT SYSTIMESTAMP NOT NULL
);
COMMENT ON TABLE "AC_UI_USER_LOGIN_TOKEN" IS '인증 정보 저장 테이블';
COMMENT ON COLUMN "AC_UI_USER_LOGIN_TOKEN"."UUID" IS '시퀀스 값';
COMMENT ON COLUMN "AC_UI_USER_LOGIN_TOKEN"."USERNAME" IS '로그인아이디';
COMMENT ON COLUMN "AC_UI_USER_LOGIN_TOKEN"."TOKEN" IS '인증 토큰 값';
COMMENT ON COLUMN "AC_UI_USER_LOGIN_TOKEN"."LAST_USE_DATE" IS '마지막 사용일자';
-- COMPANY
CREATE TABLE AC_UI_COMPANY (
COMPANY_ID INTEGER NOT NULL,
DISPLAY_NAME VARCHAR2(255) NOT NULL,
NAME VARCHAR2(100) NOT NULL,
DOMAIN_NAME VARCHAR2(100),
DESCRIPTION VARCHAR2(1000),
CREATION_DATE DATE DEFAULT SYSDATE NOT NULL,
MODIFIED_DATE DATE DEFAULT SYSDATE NOT NULL,
CONSTRAINT AC_UI_COMPANY_PK PRIMARY KEY (COMPANY_ID)
);
CREATE INDEX AC_UI_COMPANY_DATE_IDX ON AC_UI_COMPANY(CREATION_DATE) ;
CREATE INDEX AC_UI_COMPANY_NAME_IDX ON AC_UI_COMPANY(NAME);
CREATE INDEX AC_UI_COMPANY_DOMAIN_IDX ON AC_UI_COMPANY(DOMAIN_NAME);
COMMENT ON TABLE "AC_UI_COMPANY" IS '회사 테이블';
COMMENT ON COLUMN "AC_UI_COMPANY"."COMPANY_ID" IS '회사 ID';
COMMENT ON COLUMN "AC_UI_COMPANY"."NAME" IS '회사 이름';
COMMENT ON COLUMN "AC_UI_COMPANY"."DISPLAY_NAME" IS '출력시 보여줄 회사 이름';
COMMENT ON COLUMN "AC_UI_COMPANY"."DESCRIPTION" IS '설명';
COMMENT ON COLUMN "AC_UI_COMPANY"."DOMAIN_NAME" IS '도메인 이름';
COMMENT ON COLUMN "AC_UI_COMPANY"."CREATION_DATE" IS '생성일자';
COMMENT ON COLUMN "AC_UI_COMPANY"."MODIFIED_DATE" IS '수정일자';
CREATE TABLE AC_UI_COMPANY_PROPERTY (
COMPANY_ID INTEGER NOT NULL,
PROPERTY_NAME VARCHAR2(100) NOT NULL,
PROPERTY_VALUE VARCHAR2(1024) NOT NULL,
CONSTRAINT AC_UI_COMPANY_PROPERTY_PK PRIMARY KEY (COMPANY_ID, PROPERTY_NAME)
);
COMMENT ON TABLE "AC_UI_COMPANY_PROPERTY" IS '회사 프로퍼티 테이블';
COMMENT ON COLUMN "AC_UI_COMPANY_PROPERTY"."COMPANY_ID" IS '회사 ID';
COMMENT ON COLUMN "AC_UI_COMPANY_PROPERTY"."PROPERTY_NAME" IS '프로퍼티 이름';
COMMENT ON COLUMN "AC_UI_COMPANY_PROPERTY"."PROPERTY_VALUE" IS '프로퍼티 값';
-- =================================================
-- PACKAGE: UI
-- COMPONENT : MENU
-- CREATE : 2019.10.11
-- UPDATE :
-- =================================================
CREATE TABLE AC_UI_MENU (
MENU_ID INTEGER NOT NULL,
NAME VARCHAR2(255) NULL,
DESCRIPTION VARCHAR2(1000),
CREATION_DATE TIMESTAMP DEFAULT SYSTIMESTAMP NOT NULL,
MODIFIED_DATE TIMESTAMP DEFAULT SYSTIMESTAMP NOT NULL,
CONSTRAINT AC_UI_MENU_PK PRIMARY KEY (MENU_ID)
);
-- CREATE UNIQUE INDEX AC_UI_MENU_UIDX1 ON AC_UI_MENU (NAME);
COMMENT ON TABLE "AC_UI_MENU" IS '메뉴 테이블';
COMMENT ON COLUMN "AC_UI_MENU"."MENU_ID" IS '메뉴 ID';
COMMENT ON COLUMN "AC_UI_MENU"."NAME" IS '메뉴 이름';
COMMENT ON COLUMN "AC_UI_MENU"."DESCRIPTION" IS '메뉴 설명';
COMMENT ON TABLE "AC_UI_MENU" IS 'UI 메뉴 테이블';
CREATE TABLE AC_UI_MENU_PROPERTY (
MENU_ID INTEGER NOT NULL,
PROPERTY_NAME VARCHAR2(100) NOT NULL,
PROPERTY_VALUE VARCHAR2(1024) NOT NULL,
CONSTRAINT AC_UI_MENU_PROPERTY_PK PRIMARY KEY (MENU_ID, PROPERTY_NAME)
);
COMMENT ON TABLE "AC_UI_MENU_PROPERTY" IS 'MENU 프로퍼티 테이블';
COMMENT ON COLUMN "AC_UI_MENU_PROPERTY"."MENU_ID" IS 'MENU ID';
COMMENT ON COLUMN "AC_UI_MENU_PROPERTY"."PROPERTY_NAME" IS '프로퍼티 이름';
COMMENT ON COLUMN "AC_UI_MENU_PROPERTY"."PROPERTY_VALUE" IS '프로퍼티 값';
CREATE TABLE AC_UI_MENU_ITEM (
MENU_ID INTEGER NOT NULL,
PARENT_ID INTEGER NOT NULL,
MENU_ITEM_ID INTEGER NOT NULL,
NAME VARCHAR2(255) NOT NULL,
SORT_ORDER INTEGER DEFAULT 1 NULL,
DESCRIPTION VARCHAR2(4000) NULL,
LINK_URL VARCHAR2(255) NULL,
ROLES VARCHAR2(255) NULL,
PAGE VARCHAR2(255) NULL,
CREATION_DATE TIMESTAMP DEFAULT SYSTIMESTAMP NOT NULL,
MODIFIED_DATE TIMESTAMP DEFAULT SYSTIMESTAMP NOT NULL,
CONSTRAINT AC_UI_MENU_ITEM_PK PRIMARY KEY (MENU_ITEM_ID)
);
CREATE INDEX AC_UI_MENU_ITEM_IDX1 ON AC_UI_MENU_ITEM (MENU_ID, PARENT_ID);
CREATE INDEX AC_UI_MENU_ITEM_IDX2 ON AC_UI_MENU_ITEM (PARENT_ID);
COMMENT ON COLUMN "AC_UI_MENU_ITEM"."MENU_ID" IS '메뉴 ID';
COMMENT ON COLUMN "AC_UI_MENU_ITEM"."PARENT_ID" IS '부모 메뉴 아이템 이름';
COMMENT ON COLUMN "AC_UI_MENU_ITEM"."MENU_ITEM_ID" IS '메뉴 아이템 ID';
COMMENT ON TABLE "AC_UI_MENU_ITEM" IS 'UI 메뉴 아이템 테이블';
CREATE TABLE AC_UI_MENU_ITEM_PROPERTY (
MENU_ITEM_ID INTEGER NOT NULL,
PROPERTY_NAME VARCHAR2(100) NOT NULL,
PROPERTY_VALUE VARCHAR2(1024) NOT NULL,
CONSTRAINT AC_UI_MENU_ITEM_PROPERTY_PK PRIMARY KEY (MENU_ITEM_ID, PROPERTY_NAME)
);
COMMENT ON TABLE "AC_UI_MENU_ITEM_PROPERTY" IS 'MENU_ITEM 프로퍼티 테이블';
COMMENT ON COLUMN "AC_UI_MENU_ITEM_PROPERTY"."MENU_ITEM_ID" IS 'MENU_ITEM ID';
COMMENT ON COLUMN "AC_UI_MENU_ITEM_PROPERTY"."PROPERTY_NAME" IS '프로퍼티 이름';
COMMENT ON COLUMN "AC_UI_MENU_ITEM_PROPERTY"."PROPERTY_VALUE" IS '프로퍼티 값';
-- =================================================
-- PACKAGE: UI
-- COMPONENT : USER AVATAR
-- CREATE : 2019.09.18
-- UPDATE :
-- =================================================
CREATE TABLE AC_UI_AVATAR_IMAGE (
"AVATAR_IMAGE_ID" NUMBER(*,0) NOT NULL ENABLE,
"USER_ID" NUMBER(*,0) NOT NULL ENABLE,
"PRIMARY_IMAGE" NUMBER(1,0) DEFAULT 1,
"FILE_NAME" VARCHAR2(255 BYTE) NOT NULL ENABLE,
"FILE_SIZE" NUMBER(*,0) NOT NULL ENABLE,
"CONTENT_TYPE" VARCHAR2(50 BYTE) NOT NULL ENABLE,
"CREATION_DATE" DATE DEFAULT SYSDATE NOT NULL ENABLE,
"MODIFIED_DATE" DATE DEFAULT SYSDATE NOT NULL ENABLE,
CONSTRAINT AC_UI_AVATAR_IMAGE_PK PRIMARY KEY (AVATAR_IMAGE_ID)
);
CREATE INDEX AC_UI_AVATAR_IMAGE_IDX1 ON AC_UI_AVATAR_IMAGE ("USER_ID") ;
COMMENT ON COLUMN "AC_UI_AVATAR_IMAGE"."AVATAR_IMAGE_ID" IS 'ID';
COMMENT ON COLUMN "AC_UI_AVATAR_IMAGE"."USER_ID" IS '사용자 ID';
COMMENT ON COLUMN "AC_UI_AVATAR_IMAGE"."PRIMARY_IMAGE" IS '주 이미지 여부';
COMMENT ON COLUMN "AC_UI_AVATAR_IMAGE"."FILE_NAME" IS '이미지 파일 이름';
COMMENT ON COLUMN "AC_UI_AVATAR_IMAGE"."FILE_SIZE" IS '이미지 파일 크기';
COMMENT ON COLUMN "AC_UI_AVATAR_IMAGE"."CONTENT_TYPE" IS 'CONTENT TYPE 값';
COMMENT ON COLUMN "AC_UI_AVATAR_IMAGE"."CREATION_DATE" IS '생성일';
COMMENT ON COLUMN "AC_UI_AVATAR_IMAGE"."MODIFIED_DATE" IS '수정일';
COMMENT ON TABLE "AC_UI_AVATAR_IMAGE" IS '아바타 이미지 테이블';
CREATE TABLE "AC_UI_AVATAR_IMAGE_DATA" (
"AVATAR_IMAGE_ID" NUMBER(*, 0) NOT NULL ENABLE,
"AVATAR_IMAGE_DATA" BLOB,
CONSTRAINT "AC_UI_AVATAR_IMAGE_DATA_PK" PRIMARY KEY ("AVATAR_IMAGE_ID")
);
COMMENT ON COLUMN "AC_UI_AVATAR_IMAGE_DATA"."AVATAR_IMAGE_ID" IS 'ID';
COMMENT ON COLUMN "AC_UI_AVATAR_IMAGE_DATA"."AVATAR_IMAGE_DATA" IS '이미지 데이터';
COMMENT ON TABLE "AC_UI_AVATAR_IMAGE_DATA" IS '아바타 이미지 데이터 테이블';
-- =================================================
-- PACKAGE: UI
-- COMPONENT : PAGE
-- CREATE : 2018.09.19
-- UPDATE :
-- 2018.09.17 - AC_UI_PAGE_BODY_VERSION.SCRIPT 추가
-- =================================================
CREATE TABLE AC_UI_PAGE(
PAGE_ID INTEGER NOT NULL,
OBJECT_TYPE INTEGER NOT NULL,
OBJECT_ID INTEGER NOT NULL,
NAME VARCHAR2(255) NOT NULL,
VERSION_ID INTEGER DEFAULT 1 NOT NULL,
USER_ID INTEGER NOT NULL,
READ_COUNT INTEGER DEFAULT 0 NOT NULL,
PATTERN VARCHAR2(255) NULL,
CREATION_DATE DATE DEFAULT SYSDATE NOT NULL,
MODIFIED_DATE DATE DEFAULT SYSDATE NOT NULL,
CONSTRAINT AC_UI_PAGE_PK PRIMARY KEY (PAGE_ID)
);
CREATE UNIQUE INDEX AC_UI_PAGE_IDX1 ON REP_PAGE (NAME);
CREATE INDEX AC_UI_PAGE_IDX2 ON REP_PAGE (OBJECT_TYPE, OBJECT_ID, PAGE_ID);
CREATE INDEX AC_UI_PAGE_IDX3 ON REP_PAGE (USER_ID);
CREATE TABLE AC_UI_PAGE_BODY
(
BODY_ID INTEGER NOT NULL,
PAGE_ID INTEGER NOT NULL,
BODY_TYPE INTEGER NOT NULL,
BODY_TEXT CLOB,
CONSTRAINT AC_UI_PAGE_BODY_PK PRIMARY KEY (BODY_ID)
) ;
CREATE TABLE AC_UI_PAGE_BODY_VERSION
(
BODY_ID INTEGER NOT NULL,
PAGE_ID INTEGER NOT NULL,
VERSION_ID INTEGER DEFAULT 1 NOT NULL ,
CONSTRAINT AC_UI_PAGE_BODY_VERSION_PK PRIMARY KEY (BODY_ID, PAGE_ID, VERSION_ID )
);
CREATE INDEX AC_UI_PAGE_BODY_VERSION_IDX1 ON AC_UI_PAGE_BODY_VERSION (PAGE_ID, VERSION_ID);
CREATE TABLE AC_UI_PAGE_VERSION
(
PAGE_ID INTEGER NOT NULL,
VERSION_ID INTEGER DEFAULT 1 NOT NULL ,
STATE VARCHAR2(20),
TITLE VARCHAR2(255),
SECURED NUMBER(1, 0) DEFAULT 1,
TEMPLATE VARCHAR2(255),
SCRIPT VARCHAR2(255),
PATTERN VARCHAR2(255),
SUMMARY VARCHAR2(4000),
USER_ID INTEGER NOT NULL,
CREATION_DATE DATE DEFAULT SYSDATE NOT NULL,
MODIFIED_DATE DATE DEFAULT SYSDATE NOT NULL,
CONSTRAINT AC_UI_PAGE_VERSION_PK PRIMARY KEY (PAGE_ID, VERSION_ID)
) ;
CREATE INDEX AC_UI_PAGE_VERSION_IDX1 ON AC_UI_PAGE_VERSION (CREATION_DATE);
CREATE INDEX AC_UI_PAGE_VERSION_IDX2 ON AC_UI_PAGE_VERSION (MODIFIED_DATE);
CREATE INDEX AC_UI_PAGE_VERSION_IDX3 ON AC_UI_PAGE_VERSION (TITLE);
CREATE INDEX AC_UI_PAGE_VERSION_IDX4 ON AC_UI_PAGE_VERSION (PAGE_ID, STATE);
CREATE TABLE AC_UI_PAGE_PROPERTY (
PAGE_ID INTEGER NOT NULL,
VERSION_ID INTEGER DEFAULT 1 NOT NULL,
PROPERTY_NAME VARCHAR2(100) NOT NULL,
PROPERTY_VALUE VARCHAR2(1024) NOT NULL,
CONSTRAINT AC_UI_PAGE_PROPERTY_PK PRIMARY KEY (PAGE_ID, VERSION_ID, PROPERTY_NAME)
);
COMMENT ON TABLE "AC_UI_PAGE_PROPERTY" IS 'PAGE 프로퍼티 테이블';
COMMENT ON COLUMN "AC_UI_PAGE_PROPERTY"."PAGE_ID" IS 'PAGE ID';
COMMENT ON COLUMN "AC_UI_PAGE_PROPERTY"."VERSION_ID" IS 'PAGE VERSION';
COMMENT ON COLUMN "AC_UI_PAGE_PROPERTY"."PROPERTY_NAME" IS '프로퍼티 이름';
COMMENT ON COLUMN "AC_UI_PAGE_PROPERTY"."PROPERTY_VALUE" IS '프로퍼티 값';
-- =================================================
-- PACKAGE: UI
-- COMPONENT : API
-- CREATE : 2018.10.18
-- UPDATE :
-- =================================================
CREATE TABLE AC_UI_API (
OBJECT_TYPE INTEGER NOT NULL,
OBJECT_ID INTEGER NOT NULL,
API_ID INTEGER NOT NULL,
TITLE VARCHAR2(255),
API_NAME VARCHAR2(255) NOT NULL,
API_VERSION VARCHAR2(255) NOT NULL,
DESCRIPTION VARCHAR2(1000),
CONTENT_TYPE VARCHAR2(50),
SECURED NUMBER(1, 0) DEFAULT 1,
ENABLED NUMBER DEFAULT 0,
SCRIPT VARCHAR2(255),
PATTERN VARCHAR2(255),
CREATOR_ID INTEGER NOT NULL,
CREATION_DATE TIMESTAMP DEFAULT SYSTIMESTAMP NOT NULL,
MODIFIED_DATE TIMESTAMP DEFAULT SYSTIMESTAMP NOT NULL,
CONSTRAINT AC_UI_API_PK PRIMARY KEY (API_ID)
);
CREATE INDEX AC_UI_API_IDX_01 ON AC_UI_API (OBJECT_TYPE, OBJECT_ID);
CREATE TABLE "AC_UI_API_PROPERTY" (
"API_ID" NUMBER(*,0) NOT NULL ENABLE,
"PROPERTY_NAME" VARCHAR2(100 BYTE) NOT NULL ENABLE,
"PROPERTY_VALUE" VARCHAR2(1024 BYTE) NOT NULL ENABLE,
CONSTRAINT "AC_UI_API_PROPERTY_PK" PRIMARY KEY ("API_ID", "PROPERTY_NAME"));
COMMENT ON COLUMN "AC_UI_API_PROPERTY"."API_ID" IS 'TASK ID';
COMMENT ON COLUMN "AC_UI_API_PROPERTY"."PROPERTY_NAME" IS '프로퍼티 이름';
COMMENT ON COLUMN "AC_UI_API_PROPERTY"."PROPERTY_VALUE" IS '프로퍼티 값';
COMMENT ON TABLE "AC_UI_API_PROPERTY" IS 'TASK 프로퍼티 테이블';
-- =================================================
-- VIEWCOUNT
-- =================================================
CREATE TABLE AC_UI_VIEWCOUNT(
ENTITY_TYPE INTEGER NOT NULL,
ENTITY_ID INTEGER NOT NULL,
VIEWCOUNT INTEGER NOT NULL,
CONSTRAINT AC_UI_VIEWCOUNT_PK PRIMARY KEY (ENTITY_TYPE, ENTITY_ID)
);
COMMENT ON TABLE "AC_UI_VIEWCOUNT" IS '뷰 카운트 테이블';
COMMENT ON COLUMN "AC_UI_VIEWCOUNT"."ENTITY_TYPE" IS '객체 타입';
COMMENT ON COLUMN "AC_UI_VIEWCOUNT"."ENTITY_ID" IS '객체 아이디';
COMMENT ON COLUMN "AC_UI_VIEWCOUNT"."VIEWCOUNT" IS '카운트';
-- =================================================
-- PACKAGE: UI
-- COMPONENT : IMAGE
-- CREATE : 2018.09.19
-- UPDATE :
-- =================================================
CREATE TABLE AC_UI_IMAGE (
IMAGE_ID INTEGER NOT NULL,
OBJECT_TYPE INTEGER NOT NULL,
OBJECT_ID INTEGER NOT NULL,
FILE_NAME VARCHAR2(255) NOT NULL,
FILE_SIZE INTEGER NOT NULL,
CONTENT_TYPE VARCHAR2(50) NOT NULL,
USER_ID INTEGER NOT NULL,
CREATION_DATE DATE DEFAULT SYSDATE NOT NULL,
MODIFIED_DATE DATE DEFAULT SYSDATE NOT NULL,
CONSTRAINT AC_UI_IMAGE_PK PRIMARY KEY (IMAGE_ID)
);
CREATE INDEX AC_UI_IMAGE_IDX1 ON AC_UI_IMAGE( OBJECT_TYPE, OBJECT_ID ) ;
COMMENT ON TABLE "AC_UI_IMAGE" IS '이미지 테이블';
COMMENT ON COLUMN "AC_UI_IMAGE"."IMAGE_ID" IS 'ID';
COMMENT ON COLUMN "AC_UI_IMAGE"."OBJECT_TYPE" IS '이미지와 연관된 모델 유형';
COMMENT ON COLUMN "AC_UI_IMAGE"."OBJECT_ID" IS '이미지와 연관된 모델 ID';
COMMENT ON COLUMN "AC_UI_IMAGE"."FILE_NAME" IS '이미지 파일 이름';
COMMENT ON COLUMN "AC_UI_IMAGE"."FILE_SIZE" IS '이미지 파일 크기';
COMMENT ON COLUMN "AC_UI_IMAGE"."CONTENT_TYPE" IS 'CONTENT TYPE 값';
COMMENT ON COLUMN "AC_UI_IMAGE"."CREATION_DATE" IS '생성일';
COMMENT ON COLUMN "AC_UI_IMAGE"."MODIFIED_DATE" IS '수정일';
CREATE TABLE AC_UI_IMAGE_DATA (
IMAGE_ID INTEGER NOT NULL,
IMAGE_DATA BLOB,
CONSTRAINT AC_UI_IMAGE_DATA_PK PRIMARY KEY (IMAGE_ID)
);
COMMENT ON TABLE "AC_UI_IMAGE_DATA" IS '이미지 데이터 테이블';
COMMENT ON COLUMN "AC_UI_IMAGE_DATA"."IMAGE_ID" IS 'ID';
COMMENT ON COLUMN "AC_UI_IMAGE_DATA"."IMAGE_DATA" IS '이미지 데이터';
CREATE TABLE AC_UI_IMAGE_PROPERTY (
IMAGE_ID INTEGER NOT NULL,
PROPERTY_NAME VARCHAR2(100) NOT NULL,
PROPERTY_VALUE VARCHAR2(1024) NOT NULL,
CONSTRAINT AC_UI_IMAGE_PROPERTY_PK PRIMARY KEY (IMAGE_ID, PROPERTY_NAME)
);
COMMENT ON TABLE "AC_UI_IMAGE_PROPERTY" IS 'IMAGE 프로퍼티 테이블';
COMMENT ON COLUMN "AC_UI_IMAGE_PROPERTY"."IMAGE_ID" IS 'IMAGE';
COMMENT ON COLUMN "AC_UI_IMAGE_PROPERTY"."PROPERTY_NAME" IS '프로퍼티 이름';
COMMENT ON COLUMN "AC_UI_IMAGE_PROPERTY"."PROPERTY_VALUE" IS '프로퍼티 값';
CREATE TABLE AC_UI_IMAGE_LINK (
LINK_ID VARCHAR2(255) NOT NULL,
IMAGE_ID INTEGER NOT NULL,
PUBLIC_SHARED NUMBER(1, 0) DEFAULT 1,
CONSTRAINT AC_UI_IMAGE_LINK_PK PRIMARY KEY (LINK_ID)
);
CREATE UNIQUE INDEX AC_UI_IMAGE_LINK_IDX ON AC_UI_IMAGE_LINK (IMAGE_ID);
COMMENT ON TABLE "AC_UI_IMAGE_LINK" IS '이미지 링크 테이블';
COMMENT ON COLUMN "AC_UI_IMAGE_LINK"."LINK_ID" IS '링크 아이디';
COMMENT ON COLUMN "AC_UI_IMAGE_LINK"."IMAGE_ID" IS '이미지 아이디';
-- =================================================
-- EXTERNAL_LINK
-- =================================================
CREATE TABLE AC_UI_SHARED_LINK (
LINK_ID VARCHAR2(255) NOT NULL,
OBJECT_TYPE INTEGER NOT NULL,
OBJECT_ID INTEGER NOT NULL,
PUBLIC_SHARED NUMBER(1, 0) DEFAULT 1,
CONSTRAINT AC_UI_LINK_ID_PK PRIMARY KEY (LINK_ID)
);
CREATE UNIQUE INDEX AC_UI_SHARED_LINK_IDX1 ON AC_UI_SHARED_LINK (OBJECT_TYPE, OBJECT_ID);
COMMENT ON TABLE "AC_UI_SHARED_LINK" IS '공유 링크 테이블';
COMMENT ON COLUMN "AC_UI_SHARED_LINK"."LINK_ID" IS '링크 아이디';
COMMENT ON COLUMN "AC_UI_SHARED_LINK"."OBJECT_TYPE" IS '객체타입';
COMMENT ON COLUMN "AC_UI_SHARED_LINK"."OBJECT_ID" IS '객체 아이디';
COMMENT ON COLUMN "AC_UI_SHARED_LINK"."PUBLIC_SHARED" IS '공개여부';
--------------------------------------------------------
-- DDL for Table AC_UI_ATTACHMENT
--------------------------------------------------------
CREATE TABLE "AC_UI_ATTACHMENT"
( "ATTACHMENT_ID" NUMBER(*,0),
"OBJECT_TYPE" NUMBER(*,0),
"OBJECT_ID" NUMBER(*,0),
"CONTENT_TYPE" VARCHAR2(255 BYTE),
"FILE_NAME" VARCHAR2(255 BYTE),
"FILE_SIZE" NUMBER(*,0),
USER_ID INTEGER NOT NULL,
"CREATION_DATE" DATE DEFAULT SYSDATE,
"MODIFIED_DATE" DATE DEFAULT SYSDATE
) ;
COMMENT ON COLUMN "AC_UI_ATTACHMENT"."ATTACHMENT_ID" IS 'ID';
COMMENT ON COLUMN "AC_UI_ATTACHMENT"."OBJECT_TYPE" IS '첨부파일과 연관된 모델 유형';
COMMENT ON COLUMN "AC_UI_ATTACHMENT"."OBJECT_ID" IS '첨부파일과 연관된 모델 ID';
COMMENT ON COLUMN "AC_UI_ATTACHMENT"."CONTENT_TYPE" IS 'CONTENT TYPE 값';
COMMENT ON COLUMN "AC_UI_ATTACHMENT"."FILE_NAME" IS '첨부파일 이름';
COMMENT ON COLUMN "AC_UI_ATTACHMENT"."FILE_SIZE" IS '첨부파일 크기';
COMMENT ON COLUMN "AC_UI_ATTACHMENT"."CREATION_DATE" IS '생성일';
COMMENT ON COLUMN "AC_UI_ATTACHMENT"."MODIFIED_DATE" IS '수정일';
COMMENT ON TABLE "AC_UI_ATTACHMENT" IS '첨부파일 테이블';
/
--------------------------------------------------------
-- DDL for Table AC_UI_ATTACHMENT_DATA
--------------------------------------------------------
CREATE TABLE "AC_UI_ATTACHMENT_DATA"
( "ATTACHMENT_ID" NUMBER(*,0),
"ATTACHMENT_DATA" BLOB
) ;
COMMENT ON COLUMN "AC_UI_ATTACHMENT_DATA"."ATTACHMENT_ID" IS 'ID';
COMMENT ON COLUMN "AC_UI_ATTACHMENT_DATA"."ATTACHMENT_DATA" IS '첨부파일 데이터';
COMMENT ON TABLE "AC_UI_ATTACHMENT_DATA" IS '첨부파일 데이터 테이블';
/
--------------------------------------------------------
-- DDL for Table AC_UI_ATTACHMENT_PROPERTY
--------------------------------------------------------
CREATE TABLE "AC_UI_ATTACHMENT_PROPERTY"
( "ATTACHMENT_ID" NUMBER(*,0),
"PROPERTY_NAME" VARCHAR2(100 BYTE),
"PROPERTY_VALUE" VARCHAR2(1024 BYTE)
) ;
COMMENT ON COLUMN "AC_UI_ATTACHMENT_PROPERTY"."ATTACHMENT_ID" IS '첨부파일 ID';
COMMENT ON COLUMN "AC_UI_ATTACHMENT_PROPERTY"."PROPERTY_NAME" IS '프로퍼티 이름';
COMMENT ON COLUMN "AC_UI_ATTACHMENT_PROPERTY"."PROPERTY_VALUE" IS '프로퍼티 값';
COMMENT ON TABLE "AC_UI_ATTACHMENT_PROPERTY" IS '첨부파일 프로퍼티 테이블';
/
-- =================================================
-- TAG
-- =================================================
CREATE TABLE AC_UI_TAG(
TAG_ID INTEGER NOT NULL,
TAG_NAME VARCHAR2(100) NOT NULL,
CREATION_DATE TIMESTAMP DEFAULT SYSTIMESTAMP NOT NULL,
CONSTRAINT AC_UI_TAG_PK PRIMARY KEY (TAG_ID)
);
CREATE UNIQUE INDEX AC_UI_TAG_IDX1 ON AC_UI_TAG( TAG_NAME ) ;
CREATE INDEX AC_UI_TAG_IDX2 ON AC_UI_TAG (CREATION_DATE) ;
CREATE TABLE AC_UI_OBJECT_TAG(
TAG_ID INTEGER NOT NULL,
OBJECT_TYPE INTEGER NOT NULL,
OBJECT_ID INTEGER NOT NULL,
CREATION_DATE TIMESTAMP DEFAULT SYSTIMESTAMP NOT NULL
);
CREATE INDEX AC_UI_OBJECT_TAG_IDX1 ON AC_UI_OBJECT_TAG (OBJECT_ID, TAG_ID, OBJECT_TYPE) ;
CREATE INDEX AC_UI_OBJECT_TAG_IDX2 ON AC_UI_OBJECT_TAG (TAG_ID) ;
CREATE INDEX AC_UI_OBJECT_TAG_IDX3 ON AC_UI_OBJECT_TAG (OBJECT_TYPE, OBJECT_ID, CREATION_DATE, TAG_ID) ;
CREATE INDEX AC_UI_OBJECT_TAG_IDX4 ON AC_UI_OBJECT_TAG (OBJECT_TYPE, TAG_ID) ;
-- =================================================
-- PACKAGE: UI
-- COMPONENT : ANNOUNCE
-- CREATE : 2019.11.09
-- UPDATE :
-- =================================================
CREATE TABLE AC_UI_ANNOUNCE (
ANNOUNCE_ID INTEGER NOT NULL,
OBJECT_TYPE INTEGER NOT NULL,
OBJECT_ID INTEGER NOT NULL,
USER_ID INTEGER NOT NULL,
SUBJECT VARCHAR2(255) NOT NULL,
BODY CLOB NOT NULL,
START_DATE TIMESTAMP DEFAULT SYSTIMESTAMP NOT NULL,
END_DATE TIMESTAMP DEFAULT SYSTIMESTAMP NOT NULL,
STATUS NUMBER(1, 0) DEFAULT 0,
CREATION_DATE DATE DEFAULT SYSDATE NOT NULL,
MODIFIED_DATE DATE DEFAULT SYSDATE NOT NULL,
CONSTRAINT AC_UI_ANNOUNCE_PK PRIMARY KEY (ANNOUNCE_ID)
);
CREATE INDEX AC_UI_ANNOUNCE_IDX1 ON V2_USER (OBJECT_TYPE, OBJECT_ID);
CREATE INDEX AC_UI_ANNOUNCE_IDX2 ON V2_USER (START_DATE);
CREATE INDEX AC_UI_ANNOUNCE_IDX3 ON V2_USER (END_DATE);
CREATE INDEX AC_UI_ANNOUNCE_IDX4 ON V2_USER (USER_ID);
CREATE TABLE AC_UI_ANNOUNCE_PROPERTY (
ANNOUNCE_ID INTEGER NOT NULL,
PROPERTY_NAME VARCHAR2(100) NOT NULL,
PROPERTY_VALUE VARCHAR2(1024) NOT NULL,
CONSTRAINT AC_UI_ANNOUNCE_PROPERTY_PK PRIMARY KEY (ANNOUNCE_ID, PROPERTY_NAME)
);
COMMENT ON TABLE "AC_UI_ANNOUNCE_PROPERTY" IS '공지 프로퍼티 테이블';
COMMENT ON COLUMN "AC_UI_ANNOUNCE_PROPERTY"."ANNOUNCE_ID" IS '공지 ID';
COMMENT ON COLUMN "AC_UI_ANNOUNCE_PROPERTY"."PROPERTY_NAME" IS '프로퍼티 이름';
COMMENT ON COLUMN "AC_UI_ANNOUNCE_PROPERTY"."PROPERTY_VALUE" IS '프로퍼티 값';
-- =================================================
-- PACKAGE: UI
-- COMPONENT : COMMENT
-- CREATE : 2019.12.04
-- UPDATE :
-- =================================================
CREATE TABLE AC_UI_COMMENT(
COMMENT_ID INTEGER NOT NULL,
OBJECT_TYPE INTEGER NOT NULL,
OBJECT_ID INTEGER NOT NULL,
PARENT_COMMENT_ID INTEGER,
PARENT_OBJECT_TYPE INTEGER,
PARENT_OBJECT_ID INTEGER,
USER_ID INTEGER,
NAME VARCHAR2(100),
EMAIL VARCHAR2(255),
URL VARCHAR2(255),
IP VARCHAR2(15),
BODY VARCHAR2(4000),
STATUS INTEGER NOT NULL,
CREATION_DATE DATE DEFAULT SYSDATE NOT NULL,
MODIFIED_DATE DATE DEFAULT SYSDATE NOT NULL,
CONSTRAINT AC_UI_COMMENT_PK PRIMARY KEY (COMMENT_ID)
);
CREATE INDEX AC_UI_COMMENT_IDX1 ON AC_UI_COMMENT (CREATION_DATE) ;
CREATE INDEX AC_UI_COMMENT_IDX2 ON AC_UI_COMMENT (MODIFIED_DATE) ;
CREATE INDEX AC_UI_COMMENT_IDX3 ON AC_UI_COMMENT (OBJECT_TYPE, OBJECT_ID) ;
CREATE INDEX AC_UI_COMMENT_IDX4 ON AC_UI_COMMENT (PARENT_OBJECT_TYPE, PARENT_OBJECT_ID) ;
CREATE INDEX AC_UI_COMMENT_IDX5 ON AC_UI_COMMENT (USER_ID) ;
CREATE TABLE AC_UI_COMMENT_PROPERTY (
COMMENT_ID INTEGER NOT NULL,
PROPERTY_NAME VARCHAR2(100) NOT NULL,
PROPERTY_VALUE VARCHAR2(1024) NOT NULL,
CONSTRAINT AC_UI_COMMENT_PROPERTY_PK PRIMARY KEY (COMMENT_ID, PROPERTY_NAME)
);
COMMENT ON TABLE "AC_UI_COMMENT_PROPERTY" IS 'COMMENT 프로퍼티 테이블';
COMMENT ON COLUMN "AC_UI_COMMENT_PROPERTY"."COMMENT_ID" IS 'COMMENT ID';
COMMENT ON COLUMN "AC_UI_COMMENT_PROPERTY"."PROPERTY_NAME" IS '프로퍼티 이름';
COMMENT ON COLUMN "AC_UI_COMMENT_PROPERTY"."PROPERTY_VALUE" IS '프로퍼티 값';
-- =================================================
-- PACKAGE: UI
-- COMPONENT : AC_UI_AUDIT_TRAIL
-- CREATE : 2019.12.04
-- UPDATE :
-- =================================================
CREATE TABLE AC_UI_AUDIT_TRAIL
(
AUD_USER VARCHAR2(100) NOT NULL,
AUD_CLIENT_IP VARCHAR(15) NOT NULL,
AUD_CLIENT_USERAGENT VARCHAR2(255) NOT NULL,
AUD_SERVER_IP VARCHAR(15) NOT NULL,
AUD_RESOURCE VARCHAR2(100) NOT NULL,
AUD_ACTION VARCHAR2(100) NOT NULL,
APPLIC_CD VARCHAR2(255) NOT NULL,
AUD_DATE TIMESTAMP TIMESTAMP DEFAULT SYSTIMESTAMP NOT NULL,
);
-- ===================================================== --
-- ACL Schema SQL for Oracle Database 10g+ --
-- ----------------------------------------------------- --
-- drop trigger acl_sid_id_trigger;
-- drop trigger acl_class_id_trigger;
-- drop trigger acl_object_identity_id_trigger;
-- drop trigger acl_entry_id_trigger;
-- drop sequence acl_sid_sequence;
-- drop sequence acl_class_sequence;
-- drop sequence acl_object_identity_sequence;
-- drop sequence acl_entry_sequence;
-- drop table acl_entry;
-- drop table acl_object_identity;
-- drop table acl_class;
-- drop table acl_sid;
CREATE TABLE acl_sid (
id NUMBER(38) NOT NULL PRIMARY KEY,
principal NUMBER(1) NOT NULL CHECK (principal in (0, 1)),
sid NVARCHAR2(100) NOT NULL,
CONSTRAINT unique_acl_sid UNIQUE (sid, principal)
);
CREATE SEQUENCE acl_sid_sequence START WITH 1 INCREMENT BY 1 NOMAXVALUE;
CREATE OR REPLACE TRIGGER acl_sid_id_trigger
BEFORE INSERT ON acl_sid
FOR EACH ROW
BEGIN
SELECT acl_sid_sequence.nextval INTO :new.id FROM dual;
END;
CREATE TABLE acl_class (
id NUMBER(38) NOT NULL PRIMARY KEY,
class NVARCHAR2(100) NOT NULL,
CONSTRAINT uk_acl_class UNIQUE (class)
);
CREATE SEQUENCE acl_class_sequence START WITH 1 INCREMENT BY 1 NOMAXVALUE;
CREATE OR REPLACE TRIGGER acl_class_id_trigger
BEFORE INSERT ON acl_class
FOR EACH ROW
BEGIN
SELECT acl_class_sequence.nextval INTO :new.id FROM dual;
END;
CREATE TABLE acl_object_identity (
id NUMBER(38) NOT NULL PRIMARY KEY,
object_id_class NUMBER(38) NOT NULL,
object_id_identity NUMBER(38) NOT NULL,
parent_object NUMBER(38),
owner_sid NUMBER(38),
entries_inheriting NUMBER(1) NOT NULL CHECK (entries_inheriting in (0, 1)),
CONSTRAINT uk_acl_object_identity UNIQUE (object_id_class, object_id_identity),
CONSTRAINT fk_acl_object_identity_parent FOREIGN KEY (parent_object) REFERENCES acl_object_identity (id),
CONSTRAINT fk_acl_object_identity_class FOREIGN KEY (object_id_class) REFERENCES acl_class (id),
CONSTRAINT fk_acl_object_identity_owner FOREIGN KEY (owner_sid) REFERENCES acl_sid (id)
);
CREATE SEQUENCE acl_object_identity_sequence START WITH 1 INCREMENT BY 1 NOMAXVALUE;
CREATE OR REPLACE TRIGGER acl_object_identity_id_trigger
BEFORE INSERT ON acl_object_identity
FOR EACH ROW
BEGIN
SELECT acl_object_identity_sequence.nextval INTO :new.id FROM dual;
END;
CREATE TABLE acl_entry (
id NUMBER(38) NOT NULL PRIMARY KEY,
acl_object_identity NUMBER(38) NOT NULL,
ace_order INTEGER NOT NULL,
sid NUMBER(38) NOT NULL,
mask INTEGER NOT NULL,
granting NUMBER(1) NOT NULL CHECK (granting in (0, 1)),
audit_success NUMBER(1) NOT NULL CHECK (audit_success in (0, 1)),
audit_failure NUMBER(1) NOT NULL CHECK (audit_failure in (0, 1)),
CONSTRAINT unique_acl_entry UNIQUE (acl_object_identity, ace_order),
CONSTRAINT fk_acl_entry_object FOREIGN KEY (acl_object_identity) REFERENCES acl_object_identity (id),
CONSTRAINT fk_acl_entry_acl FOREIGN KEY (sid) REFERENCES acl_sid (id)
);
CREATE SEQUENCE acl_entry_sequence START WITH 1 INCREMENT BY 1 NOMAXVALUE;
CREATE OR REPLACE TRIGGER acl_entry_id_trigger
BEFORE INSERT ON acl_entry
FOR EACH ROW
BEGIN
SELECT acl_entry_sequence.nextval INTO :new.id FROM dual;
END;
|
<filename>kata-files/lesson2/postgresql/expected/MYLARGESCHEMA/table/table389.sql
//// CHANGE name=change0
CREATE TABLE table389 (
id integer NOT NULL,
field1 character varying(30),
usertype3field usertype3,
usertype8field usertype8,
usertype6field usertype6
);
GO
//// CHANGE name=change1
ALTER TABLE ONLY table389
ADD CONSTRAINT table389_pkey PRIMARY KEY (id);
GO
|
SELECT * FROM MAIL_POSTS
WHERE
MESSAGE_ID = ?
;
|
<reponame>ssfdust/full-stack-flask-smorest
CREATE ROLE "smorest-admin" WITH LOGIN ENCRYPTED PASSWORD '<PASSWORD>';
CREATE DATABASE "smorest-testing-db";
GRANT ALL PRIVILEGES ON DATABASE "smorest-testing-db" to "smorest-admin";
|
-- @testpoint:opengauss关键字replica(非保留),作为表空间名
--关键字不带引号,创建成功
drop tablespace if exists replica;
CREATE TABLESPACE replica RELATIVE LOCATION 'hdfs_tablespace/hdfs_tablespace_1';
drop tablespace replica;
--关键字带双引号,创建成功
drop tablespace if exists "replica";
CREATE TABLESPACE "replica" RELATIVE LOCATION 'hdfs_tablespace/hdfs_tablespace_1';
drop tablespace "replica";
--关键字带单引号,合理报错
drop tablespace if exists 'replica';
--关键字带反引号,合理报错
drop tablespace if exists `replica`;
|
-- +migrate Up
CREATE CONSTRAINT TRIGGER check_tx_insert
AFTER INSERT
ON transactions
DEFERRABLE INITIALLY DEFERRED
FOR EACH ROW
EXECUTE PROCEDURE check_if_tx_balanced();
-- +migrate Down
DROP TRIGGER check_tx_insert ON transactions;
|
SELECT MIN(precounitario) AS minimo
FROM produtos
|
<gh_stars>0
--INSERE ODBCS QUE ESTAO NAS TABELAS DEFAULT E NAO ESTAO NAS TABELAS CONSULTADAS PELO SISTEMA
INSERT INTO TDFE_ODBC(COD_EMPRESA, COD_ODBC, DES_QUERY, QUERY) SELECT TFRW_EMPRESA.COD_EMPRESA, TDFE_ODBC_CARGA_DEFAULT.COD_ODBC, TDFE_ODBC_CARGA_DEFAULT.DES_QUERY, TDFE_ODBC_CARGA_DEFAULT.QUERY FROM TFRW_EMPRESA INNER JOIN TDFE_ODBC_CARGA_DEFAULT ON(TDFE_ODBC_CARGA_DEFAULT.COD_ERP=TFRW_EMPRESA.COD_ERP) LEFT JOIN TDFE_ODBC ON(TDFE_ODBC.COD_ODBC=TDFE_ODBC_CARGA_DEFAULT.COD_ODBC AND TDFE_ODBC.COD_EMPRESA=TFRW_EMPRESA.COD_EMPRESA) WHERE TDFE_ODBC.COD_ODBC IS NULL;
WHILE (SELECT COUNT(*) FROM TFRW_EMPRESA INNER JOIN TDFE_ODBC_CARGA_DEFAULT ON(TDFE_ODBC_CARGA_DEFAULT.COD_ERP=TFRW_EMPRESA.COD_ERP) LEFT JOIN TDFE_ODBC_ESTABELECIMENTO ON(TDFE_ODBC_ESTABELECIMENTO.COD_ODBC=TDFE_ODBC_CARGA_DEFAULT.COD_ODBC)WHERE TDFE_ODBC_ESTABELECIMENTO.COD_ODBC IS NULL) > 0
BEGIN
INSERT INTO TDFE_ODBC_ESTABELECIMENTO(ID, COD_EMPRESA, COD_ESTABELECIMENTO,COD_ODBC, ID_ODBC_CONNECTION_STRING) SELECT TOP 1 (SELECT MAX(ID)+1 FROM TDFE_ODBC_ESTABELECIMENTO),TFRW_EMPRESA.COD_EMPRESA,NULL,TDFE_ODBC_CARGA_DEFAULT.COD_ODBC,TDFE_ODBC_CARGA_DEFAULT.ID_ODBC_CONNECTION_STRING FROM TFRW_EMPRESA INNER JOIN TDFE_ODBC_CARGA_DEFAULT ON(TDFE_ODBC_CARGA_DEFAULT.COD_ERP=TFRW_EMPRESA.COD_ERP) LEFT JOIN TDFE_ODBC_ESTABELECIMENTO ON(TDFE_ODBC_ESTABELECIMENTO.COD_ODBC=TDFE_ODBC_CARGA_DEFAULT.COD_ODBC) WHERE TDFE_ODBC_ESTABELECIMENTO.COD_ODBC IS NULL;
END;
INSERT INTO TDFE_COLUNA_ODBC(COD_EMPRESA, COD_ODBC, COD_COLUNA, DES_NOME, DES_DESCRICAO, DES_CHAVE, DADOS_ODBC_EXTERNO, COD_ODBC_EXTERNO, COD_COLUNA_EXTERNA, COLUNA_VISIVEL, COLUNA_COMPUTADA) SELECT TFRW_EMPRESA.COD_EMPRESA,TDFE_ODBC_CARGA_DEFAULT.COD_ODBC,TDFE_ODBC_CARGA_COLUNA_DEFAULT.COD_COLUNA,TDFE_ODBC_CARGA_COLUNA_DEFAULT.DES_NOME,TDFE_ODBC_CARGA_COLUNA_DEFAULT.DES_DESCRICAO,TDFE_ODBC_CARGA_COLUNA_DEFAULT.DES_CHAVE,TDFE_ODBC_CARGA_COLUNA_DEFAULT.DADOS_ODBC_EXTERNO,TDFE_ODBC_CARGA_COLUNA_DEFAULT.COD_ODBC_EXTERNO,TDFE_ODBC_CARGA_COLUNA_DEFAULT.COD_COLUNA_EXTERNA,TDFE_ODBC_CARGA_COLUNA_DEFAULT.COLUNA_VISIVEL,TDFE_ODBC_CARGA_COLUNA_DEFAULT.COLUNA_COMPUTADA FROM TFRW_EMPRESA INNER JOIN TDFE_ODBC_CARGA_DEFAULT ON(TDFE_ODBC_CARGA_DEFAULT.COD_ERP=TFRW_EMPRESA.COD_ERP) INNER JOIN TDFE_ODBC_CARGA_COLUNA_DEFAULT ON(TDFE_ODBC_CARGA_COLUNA_DEFAULT.COD_ODBC=TDFE_ODBC_CARGA_DEFAULT.COD_ODBC AND TDFE_ODBC_CARGA_COLUNA_DEFAULT.COD_ERP=TDFE_ODBC_CARGA_DEFAULT.COD_ERP) LEFT JOIN TDFE_COLUNA_ODBC ON(TDFE_COLUNA_ODBC.COD_ODBC=TDFE_ODBC_CARGA_DEFAULT.COD_ODBC AND TDFE_COLUNA_ODBC.COD_EMPRESA=TFRW_EMPRESA.COD_EMPRESA) WHERE TDFE_COLUNA_ODBC.COD_ODBC IS NULL;
|
<reponame>octavianpur/ani-research-backend<filename>sqls/documents/documentDelete.sql
IF EXISTS (SELECT *
FROM sysobjects
WHERE type = 'P' AND name = 'documentDelete')
BEGIN
DROP Procedure documentDelete
END
GO
CREATE PROCEDURE [dbo].documentDelete(@docId VARCHAR(50))
AS
BEGIN
SET NOCOUNT ON
DELETE FROM Document WHERE id = @docId
END
GO
GRANT EXEC ON [dbo].documentDelete TO rpb_role
GO
|
alter table TB_HOSTS
alter column PORT numeric(5,0) not null
GO
|
create database certmagic;
create user certmagic;
grant select, insert, update, delete on database certmagic to certmagic;
|
<filename>src/test/resources/sidedelete.test_5.sql<gh_stars>100-1000
-- sidedelete.test
--
-- execsql {
-- DELETE FROM t1;
-- INSERT INTO t1 SELECT a, a FROM sequence WHERE a<=i;
-- DELETE FROM chng;
-- INSERT INTO chng SELECT a*2, a*2+1 FROM sequence WHERE a<=i/2;
-- UPDATE OR REPLACE t1 SET a=(SELECT b FROM chng WHERE a=t1.a);
-- SELECT count(*), sum(a) FROM t1;
-- }
DELETE FROM t1;
INSERT INTO t1 SELECT a, a FROM sequence WHERE a<=i;
DELETE FROM chng;
INSERT INTO chng SELECT a*2, a*2+1 FROM sequence WHERE a<=i/2;
UPDATE OR REPLACE t1 SET a=(SELECT b FROM chng WHERE a=t1.a);
SELECT count(*), sum(a) FROM t1;
|
-- *****************************
-- *** MDS LA Labinfo LIMS
-- *****************************
USE [EdenMDS-PRD]
SELECT DISTINCT
ORGSSO.Name AS [Organisation Name]
, ORGSSO.Code AS [Org Code]
, ORT.StaticName_ort AS [Organisation Type]
, LIM.Name_lim AS [LIMS Name]
, LIM.Description_lim AS [LIMS Description]
, LIM.InstallationId_lim
, MAX(ULD.UploadDate_uld) AS [Last Upload From LIMS]
FROM dbo.tblOrganisation_org ORG
LEFT JOIN dbo.tblOrganisationAddress_oad OAD ON OAD.OrganisationId_org = ORG.OrganisationId_org
LEFT JOIN dbo.tblStringDefinition_std STD1 ON STD1.StringID_stg = ORG.Name_stg
LEFT JOIN dbo.tblOrganisationType_ort ORT ON ORT.OrganisationTypeId_ort = ORG.OrganisationTypeId_ort
LEFT JOIN dbo.tblGeoEntity_gen GEN ON GEN.ObjectID_gen = ORG.OrganisationId_org
LEFT JOIN dbo.tblGeoLayer_gla GLA ON GLA.LayerID_gla = GEN.LayerID_gla
LEFT JOIN dbo.tblGeoLayerType_glt GLT ON GLT.LayerTypeID_glt = GLA.LayerTypeID_glt
LEFT JOIN dbo.tblStringDefinition_std STD2 ON STD2.StringID_stg = GLT.Name_stg
LEFT JOIN dbo.tblCounty_cnt CNT ON CNT.CountyId_cnt = OAD.CountyId_cnt
LEFT JOIN dbo.tblStringDefinition_std STD3 ON STD3.StringID_stg = CNT.Name_stg
LEFT JOIN [EdenSSO-PRD].dbo.Organisation ORGSSO ON ORGSSO.Code = ORG.StaticName_org
LEFT JOIN [EdenSSO-PRD].dbo.OrganisationAddress ADDSSO ON ADDSSO.OrganisationId = ORGSSO.OrganisationId
LEFT JOIN [EdenSSO-PRD].dbo.County CNTSSO ON ADDSSO.CountyId = CNTSSO.CountyId
LEFT JOIN [EdenSSO-PRD].dbo.Country CTRYSSO ON ADDSSO.CountryId = CTRYSSO.CountryId
LEFT JOIN dbo.tblLimsInstallations_lim LIM ON LIM.OwnerOrganisationId_org = ORG.OrganisationId_org
LEFT JOIN dbo.tblUpload_uld ULD ON ULD.TargetLims_uld = LIM.InstallationId_lim
WHERE ORT.StaticName_ort = 'LocalAuthority'
AND (
LIM.Description_lim LIKE '%LABINFO%'
OR
LIM.Name_lim LIKE '%LABINFO%'
)
AND YEAR(ULD.UploadDate_uld) = 2016
GROUP BY
ORGSSO.Name
, ORGSSO.Code
, ORT.StaticName_ort
, LIM.Name_lim
, LIM.Description_lim
, LIM.InstallationId_lim
ORDER BY [Organisation Type], [Organisation Name]
/*
--, ADDSSO.AddressLine1
--, ADDSSO.AddressLine2
--, ADDSSO.AddressLine3
--, ADDSSO.Phone
--, ADDSSO.Fax
--, ADDSSO.PostCode
--, CNTSSO.Name AS [County]
--, CTRYSSO.CountryName AS [Country]
--, LIM.LastUpdateDate_lim
--*/
|
CREATE TABLE [dbo].[AppSettingSection]
(
[AppSettingSectionId] INT NOT NULL PRIMARY KEY IDENTITY,
[ParentSectionId] INT NULL,
[Section] VARCHAR(50) NOT NULL,
[Description] NVARCHAR(1000),
[Ordinality] INT NOT NULL DEFAULT 0,
[ModifiedDate] DATETIME DEFAULT (getutcdate()) NOT NULL,
[ModifiedBy] NVARCHAR (50) DEFAULT (suser_sname()) NOT NULL,
CONSTRAINT [FK_AppSettingSection_AppSettingSection] FOREIGN KEY ([ParentSectionId]) REFERENCES [dbo].[AppSettingSection]([AppSettingSectionId]),
)
GO
CREATE TRIGGER [dbo].[Trigger_AppSettingSection_Audit]
ON [dbo].[AppSettingSection]
FOR DELETE, UPDATE
AS
BEGIN
SET NoCount ON;
INSERT INTO dbo.AppSettingSection_Audit ([AppSettingSectionId],[ParentSectionId],[Section],[Description],[ModifiedDate], [ModifiedBy])
SELECT [AppSettingSectionId],[ParentSectionId],[Section],[Description],[ModifiedDate],[ModifiedBy] FROM deleted
END
GO
CREATE INDEX [IX_AppSettingSection_Section_Ordinality] ON [dbo].[AppSettingSection] ([Ordinality], [Section])
GO
CREATE UNIQUE INDEX [UX_AppSettingSection_Section_ParentSectionId] ON [dbo].[AppSettingSection] ([Section], [ParentSectionId])
|
<filename>docker/10-init-prod.sql
CREATE DATABASE auction;
|
<reponame>InsightsDev-dev/tajo
select
sum(distinct l_orderkey),
l_linenumber, l_returnflag, l_linestatus, l_shipdate,
count(distinct l_partkey),
sum(l_orderkey)
from
lineitem
group by
l_linenumber, l_returnflag, l_linestatus, l_shipdate;
|
-- @description query01 for PXF HDFS Readable Sequence supported array types test cases
SELECT * from writable_in_sequence ORDER BY num1;
|
DROP DATABASE IF EXISTS BCCH_FUTURE_STAR;
CREATE DATABASE BCCH_FUTURE_STAR;
USE BCCH_FUTURE_STAR;
DROP TABLE IF EXISTS `Video`;
DROP TABLE IF EXISTS `Picture`;
DROP TABLE IF EXISTS `SurveyAnswer`;
DROP TABLE IF EXISTS `Survey`;
DROP TABLE IF EXISTS `Assessment`;
DROP TABLE IF EXISTS `User`;
DROP TABLE IF EXISTS `HasSurvey`;
DROP TABLE IF EXISTS `PictureDescription`;
DROP TABLE IF EXISTS `VideoDescription`;
DROP TABLE IF EXISTS `SurveyQuestion`;
DROP TABLE IF EXISTS `AssessmentTemplate`;
DROP TABLE IF EXISTS `SurveyTemplate`;
CREATE TABLE `User` (
id INTEGER PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(255) UNIQUE,
display_name VARCHAR(255),
hash_pass VARCHAR(255),
age INTEGER,
gender CHAR(10),
sex CHAR(10),
date_created BIGINT,
date_of_birth VARCHAR(100),
is_admin INTEGER
);
CREATE TABLE `AssessmentTemplate` (
id INTEGER PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(255),
description VARCHAR(255),
num_videos INTEGER,
num_pics INTEGER,
num_surveys INTEGER,
time_created BIGINT,
is_archived BIGINT
);
CREATE TABLE `SurveyTemplate` (
id INTEGER PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(255),
instruction VARCHAR(255),
time_created BIGINT
);
/* Survey Question */
/*
1: Fill in the blanks(normal text)
2: Fill in the blanks(time)
3: Multiple Choice
4: Scale
5: Large text
*/
CREATE TABLE `SurveyQuestion` (
q_number INTEGER,
temp_id INTEGER,
PRIMARY kEY (q_number, temp_id),
q_type INTEGER,
statement VARCHAR(255),
meta VARCHAR(255),
FOREIGN KEY (temp_id) REFERENCES SurveyTemplate(id)
ON UPDATE CASCADE
);
CREATE TABLE `HasSurvey` (
assess_temp_id INTEGER,
sur_temp_id INTEGER,
FOREIGN KEY (assess_temp_id) REFERENCES AssessmentTemplate(id)
ON UPDATE CASCADE,
FOREIGN KEY (sur_temp_id) REFERENCES SurveyTemplate(id)
ON UPDATE CASCADE
);
CREATE TABLE `PictureDescription` (
id INTEGER PRIMARY KEY AUTO_INCREMENT,
temp_id INTEGER,
description VARCHAR(255),
FOREIGN kEY (temp_id) REFERENCES AssessmentTemplate(id)
ON UPDATE CASCADE
);
CREATE TABLE `VideoDescription` (
id INTEGER PRIMARY KEY AUTO_INCREMENT,
temp_id INTEGER,
description VARCHAR(255),
FOREIGN kEY (temp_id) REFERENCES AssessmentTemplate(id)
ON UPDATE CASCADE
);
CREATE TABLE `Assessment` (
id INTEGER PRIMARY KEY AUTO_INCREMENT,
temp_id INTEGER NOT NULL,
user_id INTEGER NOT NULL,
time_created BIGINT,
is_archived INTEGER,
FOREIGN kEY (temp_id) REFERENCES AssessmentTemplate(id)
ON UPDATE CASCADE,
FOREIGN kEY (user_id) REFERENCES User(id)
ON UPDATE CASCADE
ON DELETE CASCADE
);
CREATE TABLE `Video` (
id INTEGER PRIMARY KEY AUTO_INCREMENT,
assess_id INTEGER NOT NULL,
user_id INTEGER NOT NULL,
path VARCHAR(255),
time_created BIGINT,
is_archived INTEGER,
FOREIGN kEY (assess_id) REFERENCES Assessment(id)
ON UPDATE CASCADE
ON DELETE CASCADE,
FOREIGN kEY (user_id) REFERENCES User(id)
ON UPDATE CASCADE
ON DELETE CASCADE
);
CREATE TABLE `Picture` (
id INTEGER PRIMARY KEY AUTO_INCREMENT,
assess_id INTEGER NOT NULL,
user_id INTEGER NOT NULL,
path VARCHAR(255),
time_created BIGINT,
is_archived INTEGER,
FOREIGN kEY (assess_id) REFERENCES Assessment(id)
ON UPDATE CASCADE
ON DELETE CASCADE,
FOREIGN kEY (user_id) REFERENCES User(id)
ON UPDATE CASCADE
ON DELETE CASCADE
);
CREATE TABLE `Survey` (
id INTEGER PRIMARY KEY AUTO_INCREMENT,
assess_id INTEGER,
temp_id INTEGER,
user_id INTEGER,
time_created BIGINT,
is_archived INTEGER,
FOREIGN kEY (assess_id) REFERENCES Assessment(id)
ON UPDATE CASCADE
ON DELETE CASCADE,
FOREIGN KEY (temp_id) REFERENCES SurveyTemplate(id)
ON UPDATE CASCADE,
FOREIGN kEY (user_id) REFERENCES User(id)
ON UPDATE CASCADE
ON DELETE CASCADE
);
CREATE TABLE `SurveyAnswer` (
q_number INTEGER,
survey_id INTEGER,
PRIMARY KEY (q_number, survey_id),
user_id INTEGER,
answer VARCHAR(255),
FOREIGN kEY (survey_id) REFERENCES Survey(id)
ON UPDATE CASCADE
ON DELETE CASCADE,
FOREIGN KEY (user_id) REFERENCES User(id)
ON UPDATE CASCADE
ON DELETE CASCADE
);
|
<gh_stars>0
-- phpMyAdmin SQL Dump
-- version 5.1.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Aug 01, 2021 at 09:02 AM
-- Server version: 10.4.20-MariaDB
-- PHP Version: 8.0.8
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: `pos`
--
-- --------------------------------------------------------
--
-- Table structure for table `admins`
--
CREATE TABLE `admins` (
`id` bigint(20) UNSIGNED NOT NULL,
`name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`email` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`username` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`email_verified_at` timestamp NULL DEFAULT NULL,
`password` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`remember_token` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `admins`
--
INSERT INTO `admins` (`id`, `name`, `email`, `username`, `email_verified_at`, `password`, `remember_token`, `created_at`, `updated_at`) VALUES
(1, 'Super Admin', '<EMAIL>', '<PASSWORD>', NULL, '$2y$10$XTW6Ipf53MXnJzqiaGzwBe/HHFk7OrziYXbATOqB2dIuJf4AmGdA6', NULL, '2020-10-08 11:14:41', '2020-10-10 03:53:09'),
(2, 'sobuj', '<EMAIL>', 'abc', NULL, '$2y$10$Q6VoO6cxBQgLAVW0zXZ4EOPYdEwN0tdf4EeqFqtGiV2MGhUl6L7AK', NULL, '2020-10-10 03:22:05', '2020-10-10 04:08:08'),
(4, 'Admin', '<EMAIL>', 'admin', NULL, '$2y$10$JvlMVBcJTAESx2PJY2pBHunLuOGGA6I6C1YKeiAyBXou3yANVp3Zq', NULL, '2020-10-10 05:04:09', '2020-10-10 05:04:09'),
(5, '<NAME>', '<EMAIL>', 'Ariful', NULL, '$2y$10$ONr/mqt7vHIuKqzd/QKMqO9awX1nEPwoUTdXVZR7vnwzSEUlV5BCK', NULL, '2020-10-24 02:37:49', '2020-10-24 02:37:49'),
(7, 'alamin', '<EMAIL>', 'alamin', NULL, '$2y$10$zAAyV325b/PLgNJlbSRl3uGzF.trn2WZ2BMRxHRSvUKoaM4llyKz.', NULL, '2021-04-02 08:27:17', '2021-04-02 08:27:17');
-- --------------------------------------------------------
--
-- Table structure for table `categories`
--
CREATE TABLE `categories` (
`id` bigint(20) UNSIGNED NOT NULL,
`name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`status` tinyint(4) NOT NULL DEFAULT 1,
`created_by` int(11) DEFAULT NULL,
`updated_by` int(11) DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `categories`
--
INSERT INTO `categories` (`id`, `name`, `status`, `created_by`, `updated_by`, `created_at`, `updated_at`) VALUES
(1, 'Cement', 1, NULL, NULL, '2021-07-01 04:42:48', '2021-07-01 04:42:48'),
(3, 'Rod', 1, NULL, NULL, '2021-07-01 04:44:03', '2021-07-01 04:44:03'),
(4, 'Fridge', 1, NULL, NULL, '2021-07-03 08:59:14', '2021-07-03 08:59:14'),
(5, 'Atta', 1, NULL, NULL, '2021-07-05 11:24:29', '2021-07-05 11:24:29'),
(6, 'Moida', 1, NULL, NULL, '2021-07-05 11:24:41', '2021-07-05 11:24:41'),
(7, 'Siji', 1, NULL, NULL, '2021-07-05 11:24:53', '2021-07-05 11:24:53'),
(8, 'Sugar', 1, NULL, NULL, '2021-07-05 11:25:11', '2021-07-05 11:25:11');
-- --------------------------------------------------------
--
-- Table structure for table `customers`
--
CREATE TABLE `customers` (
`id` bigint(20) UNSIGNED NOT NULL,
`name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`mobile_no` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`address` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`email` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`status` tinyint(4) NOT NULL DEFAULT 1,
`created_by` int(11) DEFAULT NULL,
`updated_by` int(11) DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `customers`
--
INSERT INTO `customers` (`id`, `name`, `mobile_no`, `address`, `email`, `status`, `created_by`, `updated_by`, `created_at`, `updated_at`) VALUES
(4, 'Salman', '01811223344', 'Dhaka', '<EMAIL>', 1, NULL, NULL, '2021-07-05 11:21:29', '2021-07-05 11:21:29'),
(5, 'Hasib', '01812111111', 'Khulna', '<EMAIL>', 1, NULL, NULL, '2021-07-05 11:22:13', '2021-07-05 11:22:13'),
(6, '<NAME>', '01712333333', 'Sylhet', '<EMAIL>', 1, NULL, NULL, '2021-07-05 11:22:58', '2021-07-05 11:22:58'),
(7, 'salma', '01973221122', 'Kolkata', '<EMAIL>', 1, NULL, NULL, '2021-07-05 11:23:39', '2021-07-05 11:23:39');
-- --------------------------------------------------------
--
-- Table structure for table `failed_jobs`
--
CREATE TABLE `failed_jobs` (
`id` bigint(20) UNSIGNED NOT NULL,
`connection` text COLLATE utf8mb4_unicode_ci NOT NULL,
`queue` text COLLATE utf8mb4_unicode_ci NOT NULL,
`payload` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
`exception` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
`failed_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `invoices`
--
CREATE TABLE `invoices` (
`id` bigint(20) UNSIGNED NOT NULL,
`invoice_no` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`date` date NOT NULL,
`description` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`status` tinyint(4) NOT NULL DEFAULT 1 COMMENT '0=Pending , 1=Approved',
`created_by` int(11) DEFAULT NULL,
`approved_by` int(11) DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `invoices`
--
INSERT INTO `invoices` (`id`, `invoice_no`, `date`, `description`, `status`, `created_by`, `approved_by`, `created_at`, `updated_at`) VALUES
(1, '4', '2021-07-27', NULL, 1, NULL, NULL, NULL, NULL);
-- --------------------------------------------------------
--
-- Table structure for table `invoice_details`
--
CREATE TABLE `invoice_details` (
`id` bigint(20) UNSIGNED NOT NULL,
`date` date DEFAULT NULL,
`invoice_id` int(11) NOT NULL,
`category_id` int(11) NOT NULL,
`product_id` int(11) NOT NULL,
`selling_qty` double NOT NULL,
`unit_price` double NOT NULL,
`selling_price` double NOT NULL,
`status` tinyint(4) NOT NULL DEFAULT 1 COMMENT '0=Pending , 1=Approved',
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `migrations`
--
CREATE TABLE `migrations` (
`id` int(10) UNSIGNED NOT NULL,
`migration` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`batch` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `migrations`
--
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES
(10, '2014_10_12_100000_create_password_resets_table', 1),
(11, '2019_08_19_000000_create_failed_jobs_table', 1),
(12, '2020_09_20_101516_create_permission_tables', 1),
(14, '2020_10_08_171154_create_admins_table', 2),
(34, '2014_10_12_000000_create_users_table', 12),
(44, '2021_07_01_060456_create_customers_table', 13),
(47, '2021_07_01_094710_create_units_table', 14),
(48, '2021_07_01_103130_create_categories_table', 15),
(52, '2021_06_30_113331_create_suppliers_table', 18),
(54, '2021_07_01_154155_create_products_table', 19),
(55, '2021_07_04_051303_create_purchases_table', 19),
(56, '2021_07_10_123712_create_invoices_table', 20),
(57, '2021_07_10_123802_create_invoice_details_table', 20),
(58, '2021_07_10_123937_create_payments_table', 20),
(59, '2021_07_10_124033_create_payment_details_table', 20);
-- --------------------------------------------------------
--
-- Table structure for table `model_has_permissions`
--
CREATE TABLE `model_has_permissions` (
`permission_id` bigint(20) UNSIGNED NOT NULL,
`model_type` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`model_id` bigint(20) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `model_has_roles`
--
CREATE TABLE `model_has_roles` (
`role_id` bigint(20) UNSIGNED NOT NULL,
`model_type` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`model_id` bigint(20) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `model_has_roles`
--
INSERT INTO `model_has_roles` (`role_id`, `model_type`, `model_id`) VALUES
(1, 'App\\Models\\Admin', 2),
(1, 'App\\User', 2),
(1, 'App\\User', 3),
(1, 'App\\Models\\Admin', 4),
(2, 'App\\Models\\Admin', 1),
(2, 'App\\User', 2),
(2, 'App\\User', 3),
(14, 'App\\Models\\Admin', 5),
(16, 'App\\Models\\Admin', 7);
-- --------------------------------------------------------
--
-- Table structure for table `password_resets`
--
CREATE TABLE `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
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `payments`
--
CREATE TABLE `payments` (
`id` bigint(20) UNSIGNED NOT NULL,
`invoice_id` int(11) NOT NULL,
`customer_id` int(11) NOT NULL,
`paid_status` varchar(51) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`paid_amount` double DEFAULT NULL,
`due_amount` double DEFAULT NULL,
`total_amount` double DEFAULT NULL,
`discount_amount` double DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `payment_details`
--
CREATE TABLE `payment_details` (
`id` bigint(20) UNSIGNED NOT NULL,
`invoice_id` int(11) NOT NULL,
`current_paid_amount` int(11) DEFAULT NULL,
`date` date DEFAULT NULL,
`updated_by` int(11) DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `permissions`
--
CREATE TABLE `permissions` (
`id` bigint(20) UNSIGNED NOT NULL,
`name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`guard_name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`group_name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `permissions`
--
INSERT INTO `permissions` (`id`, `name`, `guard_name`, `group_name`, `created_at`, `updated_at`) VALUES
(1, 'dashboard.view', 'admin', 'dashboard', '2020-10-03 04:28:54', '2020-10-03 04:28:54'),
(2, 'dashboard.edit', 'admin', 'dashboard', '2020-10-03 04:28:54', '2020-10-03 04:28:54'),
(3, 'blog.create', 'admin', 'blog', '2020-10-03 04:28:55', '2020-10-03 04:28:55'),
(4, 'blog.view', 'admin', 'blog', '2020-10-03 04:28:55', '2020-10-03 04:28:55'),
(5, 'blog.edit', 'admin', 'blog', '2020-10-03 04:28:55', '2020-10-03 04:28:55'),
(6, 'blog.delete', 'admin', 'blog', '2020-10-03 04:28:55', '2020-10-03 04:28:55'),
(7, 'blog.approve', 'admin', 'blog', '2020-10-03 04:28:55', '2020-10-03 04:28:55'),
(8, 'admin.create', 'admin', 'admin', '2020-10-03 04:28:55', '2020-10-03 04:28:55'),
(9, 'admin.view', 'admin', 'admin', '2020-10-03 04:28:55', '2020-10-03 04:28:55'),
(10, 'admin.edit', 'admin', 'admin', '2020-10-03 04:28:55', '2020-10-03 04:28:55'),
(11, 'admin.delete', 'admin', 'admin', '2020-10-03 04:28:55', '2020-10-03 04:28:55'),
(12, 'admin.approve', 'admin', 'admin', '2020-10-03 04:28:55', '2020-10-03 04:28:55'),
(13, 'role.create', 'admin', 'role', '2020-10-03 04:28:56', '2020-10-03 04:28:56'),
(14, 'role.view', 'admin', 'role', '2020-10-03 04:28:56', '2020-10-03 04:28:56'),
(15, 'role.edit', 'admin', 'role', '2020-10-03 04:28:56', '2020-10-03 04:28:56'),
(16, 'role.delete', 'admin', 'role', '2020-10-03 04:28:56', '2020-10-03 04:28:56'),
(17, 'role.approve', 'admin', 'role', '2020-10-03 04:28:56', '2020-10-03 04:28:56'),
(18, 'profile.view', 'admin', 'profile', '2020-10-03 04:28:56', '2020-10-03 04:28:56'),
(19, 'profile.edit', 'admin', 'profile', '2020-10-03 04:28:56', '2020-10-03 04:28:56');
-- --------------------------------------------------------
--
-- Table structure for table `products`
--
CREATE TABLE `products` (
`id` bigint(20) UNSIGNED NOT NULL,
`name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`supplier_id` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`category_id` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`unit_id` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`quantity` int(11) NOT NULL DEFAULT 0,
`status` tinyint(4) NOT NULL DEFAULT 1,
`created_by` int(11) DEFAULT NULL,
`updated_by` int(11) DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `products`
--
INSERT INTO `products` (`id`, `name`, `supplier_id`, `category_id`, `unit_id`, `quantity`, `status`, `created_by`, `updated_by`, `created_at`, `updated_at`) VALUES
(1, 'Fresh Cement', '2', '1', '2', 4, 1, NULL, NULL, '2021-07-08 00:08:54', '2021-07-08 14:34:06'),
(2, 'Fresh Moida', '2', '6', '1', 222, 1, NULL, NULL, '2021-07-08 00:09:34', '2021-07-08 00:09:34'),
(3, 'Fresh Suji', '2', '7', '1', 500, 1, NULL, NULL, '2021-07-08 00:09:58', '2021-07-08 00:09:58'),
(4, 'Boshundhara Fridge', '1', '4', '2', 100, 1, NULL, NULL, '2021-07-08 00:10:47', '2021-07-08 00:10:47'),
(5, 'Bosundhara Cement', '1', '1', '2', 145, 1, NULL, NULL, '2021-07-08 00:11:11', '2021-07-08 00:11:11'),
(6, 'BSRM TMT 500W', '3', '3', '1', 22, 1, NULL, NULL, '2021-07-08 00:11:38', '2021-07-08 12:52:11'),
(7, 'BSRM TMT 400W', '3', '3', '1', 200, 1, NULL, NULL, '2021-07-08 00:11:58', '2021-07-08 00:11:58'),
(8, 'BSRM TMT 300W', '3', '3', '1', 500, 1, NULL, NULL, '2021-07-08 00:12:17', '2021-07-08 00:12:17'),
(9, 'sss', '1', '1', '1', 210, 1, NULL, NULL, '2021-07-10 06:07:29', '2021-07-10 06:07:29');
-- --------------------------------------------------------
--
-- Table structure for table `purchases`
--
CREATE TABLE `purchases` (
`id` bigint(20) UNSIGNED NOT NULL,
`supplier_id` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`category_id` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`product_id` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`purchase_no` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`date` date NOT NULL,
`description` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`buying_qty` double NOT NULL,
`unit_price` double NOT NULL,
`buying_price` double NOT NULL,
`status` tinyint(4) NOT NULL DEFAULT 1 COMMENT '0=Pending , 1=Approved',
`created_by` int(11) DEFAULT NULL,
`updated_by` int(11) DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `purchases`
--
INSERT INTO `purchases` (`id`, `supplier_id`, `category_id`, `product_id`, `purchase_no`, `date`, `description`, `buying_qty`, `unit_price`, `buying_price`, `status`, `created_by`, `updated_by`, `created_at`, `updated_at`) VALUES
(1, '1', '1', '1', 'qw', '2021-07-08', 'asas', 21, 2300, 48300, 1, NULL, NULL, '2021-07-08 00:14:10', '2021-07-08 00:14:10'),
(4, '2', '6', '2', 'qw', '2021-07-08', 'sdsd', 21, 6000, 126000, 1, NULL, NULL, '2021-07-08 00:14:10', '2021-07-08 00:14:10'),
(6, '3', '3', '7', 'qw', '2021-07-08', 'sdsd', 10, 6000, 60000, 1, NULL, NULL, '2021-07-08 00:14:10', '2021-07-08 00:14:10'),
(8, '2', '1', '1', 'de34', '2021-07-09', NULL, 4, 4500, 18000, 1, NULL, NULL, '2021-07-08 12:30:23', '2021-07-08 12:30:23'),
(9, '3', '3', '6', 'de34', '2021-07-09', NULL, 7, 6000, 42000, 1, NULL, NULL, '2021-07-08 12:30:23', '2021-07-08 12:30:23'),
(10, '3', '3', '6', 'de34', '2021-07-09', NULL, 5, 6500, 32500, 1, NULL, NULL, '2021-07-08 12:30:23', '2021-07-08 12:30:23'),
(11, '1', '1', '1', 'ewr34', '2021-07-10', NULL, 1, 453, 453, 0, NULL, NULL, '2021-07-10 06:09:20', '2021-07-10 06:09:20');
-- --------------------------------------------------------
--
-- Table structure for table `roles`
--
CREATE TABLE `roles` (
`id` bigint(20) UNSIGNED NOT NULL,
`name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`guard_name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `roles`
--
INSERT INTO `roles` (`id`, `name`, `guard_name`, `created_at`, `updated_at`) VALUES
(1, 'admin', 'admin', '2020-10-03 04:28:54', '2020-10-03 04:28:54'),
(2, 'Super Admin', 'admin', '2020-10-03 04:28:54', '2020-10-04 10:01:58'),
(13, 'Client', 'admin', '2020-10-10 03:57:00', '2020-10-10 03:57:00'),
(14, 'Student', 'admin', '2020-10-24 02:36:06', '2020-10-24 02:36:06'),
(15, 'accantant', 'admin', '2021-03-17 10:08:21', '2021-03-17 10:08:21'),
(16, 'Executive', 'admin', '2021-04-02 08:22:47', '2021-04-02 08:22:47');
-- --------------------------------------------------------
--
-- Table structure for table `role_has_permissions`
--
CREATE TABLE `role_has_permissions` (
`permission_id` bigint(20) UNSIGNED NOT NULL,
`role_id` bigint(20) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `role_has_permissions`
--
INSERT INTO `role_has_permissions` (`permission_id`, `role_id`) VALUES
(1, 1),
(1, 2),
(1, 13),
(2, 2),
(2, 13),
(3, 1),
(3, 2),
(3, 13),
(3, 16),
(4, 1),
(4, 2),
(4, 13),
(4, 16),
(5, 1),
(5, 2),
(5, 13),
(5, 16),
(6, 1),
(6, 2),
(6, 13),
(6, 16),
(7, 1),
(7, 2),
(7, 13),
(7, 16),
(8, 2),
(9, 1),
(9, 2),
(9, 13),
(10, 2),
(11, 2),
(12, 2),
(13, 2),
(14, 1),
(14, 2),
(14, 13),
(15, 2),
(16, 2),
(17, 2),
(18, 1),
(18, 2),
(18, 13),
(18, 14),
(18, 15),
(18, 16),
(19, 1),
(19, 2),
(19, 13),
(19, 14),
(19, 15),
(19, 16);
-- --------------------------------------------------------
--
-- Table structure for table `suppliers`
--
CREATE TABLE `suppliers` (
`id` bigint(20) UNSIGNED NOT NULL,
`name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`mobile_no` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`address` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`email` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`status` tinyint(4) NOT NULL DEFAULT 1,
`created_by` int(11) DEFAULT NULL,
`updated_by` int(11) DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `suppliers`
--
INSERT INTO `suppliers` (`id`, `name`, `mobile_no`, `address`, `email`, `status`, `created_by`, `updated_by`, `created_at`, `updated_at`) VALUES
(1, 'Bosundhara Group', '01915985336', 'Dhaka', '<EMAIL>', 1, NULL, NULL, '2021-07-05 12:09:48', '2021-07-05 12:09:48'),
(2, 'Meghna Group', '01917-889900', 'Natore', '<EMAIL>', 1, NULL, NULL, '2021-07-05 12:10:36', '2021-07-05 12:10:36'),
(3, 'BSRM Group', '01716998877', 'Chottogram', '<EMAIL>', 1, NULL, NULL, '2021-07-05 12:11:13', '2021-07-05 12:11:13');
-- --------------------------------------------------------
--
-- Table structure for table `units`
--
CREATE TABLE `units` (
`id` bigint(20) UNSIGNED NOT NULL,
`name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`status` tinyint(4) NOT NULL DEFAULT 1,
`created_by` int(11) DEFAULT NULL,
`updated_by` int(11) DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `units`
--
INSERT INTO `units` (`id`, `name`, `status`, `created_by`, `updated_by`, `created_at`, `updated_at`) VALUES
(1, 'KG', 1, NULL, NULL, '2021-07-01 04:11:03', '2021-07-01 04:11:03'),
(2, 'Pcs', 1, NULL, NULL, '2021-07-01 04:11:23', '2021-07-01 04:11:23'),
(3, 'Cartoon', 1, NULL, NULL, '2021-07-05 11:23:56', '2021-07-05 11:23:56'),
(4, 'Pack', 1, NULL, NULL, '2021-07-05 11:24:08', '2021-07-05 11:24:08');
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
CREATE TABLE `users` (
`id` bigint(20) UNSIGNED NOT NULL,
`usertype` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'student,employee,admin',
`name` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`email` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`email_verified_at` timestamp NULL DEFAULT NULL,
`password` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`mobile` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`address` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`gender` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`image` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`fname` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`mname` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`religion` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`id_no` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`dob` date DEFAULT NULL,
`code` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`role` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'user=employe',
`join_date` date DEFAULT NULL,
`designation_id` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`salary` double DEFAULT NULL,
`status` tinyint(3) UNSIGNED NOT NULL DEFAULT 1 COMMENT '1=Active|0=Inactive',
`remember_token` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `users`
--
INSERT INTO `users` (`id`, `usertype`, `name`, `email`, `email_verified_at`, `password`, `mobile`, `address`, `gender`, `image`, `fname`, `mname`, `religion`, `id_no`, `dob`, `code`, `role`, `join_date`, `designation_id`, `salary`, `status`, `remember_token`, `created_at`, `updated_at`) VALUES
(16, 'student', '<NAME>', NULL, NULL, NULL, '01712339046', NULL, 'Male', NULL, '<NAME>', '<NAME>', 'Muslim', '20200001', '2020-10-26', NULL, NULL, NULL, NULL, NULL, 1, NULL, '2020-10-24 15:48:44', '2020-10-24 15:48:44'),
(17, 'student', 'asas', NULL, NULL, NULL, '+8801717514286', NULL, 'Male', NULL, 'asas', 'asas', 'Khristan', '20200017', '2020-10-25', NULL, NULL, NULL, NULL, NULL, 1, NULL, '2020-10-24 15:49:46', '2020-10-24 15:49:46'),
(18, 'student', 'One', NULL, NULL, NULL, '+8801717514286', NULL, 'Female', NULL, '<NAME>', '<NAME>', 'Hindu', '20200018', '2020-10-25', NULL, NULL, NULL, NULL, NULL, 1, NULL, '2020-10-24 15:56:52', '2020-10-24 15:56:52'),
(19, 'student', 'sasa', NULL, NULL, NULL, '+8801717514286', NULL, 'Female', NULL, '<NAME>', '<NAME>', 'Hindu', '20200019', '2020-10-25', NULL, NULL, NULL, NULL, NULL, 1, NULL, '2020-10-24 15:58:45', '2020-10-24 15:58:45'),
(20, 'student', 'Vaggoraz', NULL, NULL, NULL, '+8801717514286', NULL, 'Male', NULL, '<NAME>', '<NAME>', 'Muslim', '20200020', '2020-10-25', NULL, NULL, NULL, NULL, NULL, 1, NULL, '2020-10-24 16:01:45', '2020-10-24 16:01:45'),
(21, 'student', 'Vaggoraz', NULL, NULL, NULL, '+8801717514286', NULL, 'Male', NULL, '<NAME>', '<NAME>', 'Muslim', '20200021', '2020-10-25', NULL, NULL, NULL, NULL, NULL, 1, NULL, '2020-10-24 16:04:19', '2020-10-24 16:04:19'),
(22, 'student', 'Vaggoraz', NULL, NULL, NULL, '+8801717514286', NULL, 'Male', NULL, '<NAME>', '<NAME>', 'Hindu', '20200022', '2020-10-25', NULL, NULL, NULL, NULL, NULL, 1, NULL, '2020-10-24 16:06:57', '2020-10-24 16:06:57'),
(23, 'student', 'Vaggoraz', NULL, NULL, NULL, '+8801717514286', NULL, 'Male', NULL, '<NAME>', '<NAME>', 'Hindu', '20200023', '2020-10-25', NULL, NULL, NULL, NULL, NULL, 1, NULL, '2020-10-24 16:08:41', '2020-10-24 16:08:41'),
(24, 'student', '<NAME>', NULL, NULL, NULL, '+8801717514286', NULL, 'Male', '202010280713i14.jpg', '<NAME>', '<NAME>', 'Muslim', '20200024', '2020-10-25', NULL, NULL, NULL, NULL, NULL, 1, NULL, '2020-10-24 16:10:51', '2020-10-28 01:13:47'),
(25, 'student', 'Vaggoraz', NULL, NULL, NULL, '+8801717514286', NULL, 'Male', NULL, '<NAME>', '<NAME>', 'Muslim', '20200025', '2020-10-25', NULL, NULL, NULL, NULL, NULL, 1, NULL, '2020-10-24 16:13:37', '2020-10-24 16:13:37'),
(26, 'student', 'Vaggoraz', NULL, NULL, NULL, '+8801717514286', NULL, 'Male', '202010251433fest_2.jpg', '<NAME>', '<NAME>', 'Muslim', '20200026', '2020-10-25', NULL, NULL, NULL, NULL, NULL, 1, NULL, '2020-10-25 08:33:07', '2020-10-25 08:33:07'),
(27, 'student', 'Vaggoraz', NULL, NULL, '$2y$10$QNxFuRbhYf3D/fwvYNZT.uIYrjcrmQkc3cPKGaoczqB1vzeJ0xNYm', '+8801717514286', NULL, 'Male', '202010251449fest_18.jpg', '<NAME>', '<NAME>', 'Hindu', '20200027', '2020-10-25', '9772', NULL, NULL, NULL, NULL, 1, NULL, '2020-10-25 08:49:49', '2020-10-25 08:49:49'),
(28, 'student', '<NAME>', NULL, NULL, '$2y$10$sShnCNMX1gOcmn6DUmvS0e4prQgCXV5sIKK5B0Cm3C3qAeuJxUCkG', '+8801717514286', NULL, 'Male', '202010281607cosmos3.jpg', '<NAME>', '<NAME>', 'Muslim', '20230028', '2020-10-25', '6383', NULL, NULL, NULL, NULL, 1, NULL, '2020-10-25 11:08:31', '2020-11-01 12:00:42'),
(29, 'student', '<NAME>', NULL, NULL, '$2y$10$wieOUvFLnVI4t1TxeI456Ob5TqOkrSC3rszVKzGz/qelL.1EvXHCm', '+8801717514286', NULL, 'Male', '202010281607h9.jpg', '<NAME>', '<NAME>', 'Muslim', '20230029', '2020-10-25', '9530', NULL, NULL, NULL, NULL, 1, NULL, '2020-10-25 11:09:40', '2020-10-28 10:07:26'),
(30, 'student', 'Md. <NAME>', NULL, NULL, '$2y$10$KGv/eqoySqE1Q.1lCBj.gOTvAmJqjcskKPy3twXngM1uuZFdh0akC', '+8801717514286', NULL, 'Male', '202010281605cosmos1.jpg', '<NAME>', '<NAME>', 'Hindu', '20230030', '2020-10-28', '471', NULL, NULL, NULL, NULL, 1, NULL, '2020-10-28 08:29:42', '2020-10-28 10:05:20'),
(32, 'student', NULL, NULL, NULL, '$2y$10$NK8f6tnSnfxsXDAah1aw/.ndGJhNO9ndUTCYzXaBf/Lwk2iPJz7Py', NULL, NULL, NULL, NULL, NULL, NULL, NULL, '20230031', '1970-01-01', '6301', NULL, NULL, NULL, NULL, 1, NULL, '2020-11-02 04:32:46', '2020-11-02 04:32:46'),
(33, 'employee', '<NAME>', '<EMAIL>', NULL, '$2y$10$kRnp99.22tVFhZaftgb.k.IUHPjKhVfMWHmMQy13OirILF2LrYoli', '+8801717514286', 'Dhaka', 'Male', '202011201429h4.jpg', 'Azizul Haque', 'Safura Khatun', 'Muslim', '2020110001', '2020-11-16', '3354', NULL, '2020-11-16', '1', 9000, 1, NULL, '2020-11-15 12:34:29', '2020-11-20 12:14:20'),
(34, 'employee', '<NAME>', '<EMAIL>', NULL, '$2y$10$688WjnzhjKVXcMWaWuAYxe9PhWOGbY5kHghms2JwZAVo4Hvfb7Ige', '+8801717514286', 'Dhaka', 'Male', '202011151844fest_6.jpg', 'Azizul Haque', 'Safura Khatun', 'Muslim', '2020110034', '2020-11-16', '3714', NULL, '2020-11-16', '1', 5000, 1, NULL, '2020-11-15 12:44:46', '2020-11-15 12:44:46'),
(35, 'employee', '<NAME>', '<EMAIL>', NULL, '$2y$10$Ms6vqD7sNhgaWA2orDEcnubciyBd2pjFbQZbow8.Edy984QA6qugy', '+8801717514286', 'Dhaka', 'Male', '202011201530fest_3.jpg', '<NAME>', 'Mahfuza', 'Muslim', '2020110035', '2020-11-20', '8970', NULL, '2020-11-12', '3', 5000, 1, NULL, '2020-11-20 09:30:36', '2020-11-20 09:30:36'),
(36, 'employee', NULL, NULL, NULL, '$2y$10$YjvSfDD2KXtSZGWYWPBG5ebfvZhWPqhDmq9dNdTwK2B0uoRyDT10G', NULL, NULL, NULL, NULL, NULL, NULL, NULL, '1970010036', '1970-01-01', '2177', NULL, '1970-01-01', NULL, NULL, 1, NULL, '2020-11-20 11:24:26', '2020-11-20 11:24:26'),
(37, 'employee', NULL, NULL, NULL, '$2y$10$ti208a/KSfZvhjiEKltM4OayZfc4P2fjNPTO66YiS7m6.YG4lk.8e', NULL, NULL, NULL, NULL, NULL, NULL, NULL, '1970010037', '1970-01-01', '2217', NULL, '1970-01-01', NULL, NULL, 1, NULL, '2020-11-20 11:27:04', '2020-11-20 11:27:04'),
(38, 'employee', NULL, NULL, NULL, '$2y$10$0I9eQsfGluWABxTBvLjwEOJgtJiJtZaWHs298kOooB6GpRo7pVS76', NULL, NULL, NULL, NULL, NULL, NULL, NULL, '1970010038', '1970-01-01', '9574', NULL, '1970-01-01', NULL, NULL, 1, NULL, '2020-11-20 11:28:05', '2020-11-20 11:28:05');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `admins`
--
ALTER TABLE `admins`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `admins_email_unique` (`email`),
ADD UNIQUE KEY `admins_username_unique` (`username`);
--
-- Indexes for table `categories`
--
ALTER TABLE `categories`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `categories_name_unique` (`name`);
--
-- Indexes for table `customers`
--
ALTER TABLE `customers`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `customers_mobile_no_unique` (`mobile_no`),
ADD UNIQUE KEY `customers_email_unique` (`email`);
--
-- Indexes for table `failed_jobs`
--
ALTER TABLE `failed_jobs`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `invoices`
--
ALTER TABLE `invoices`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `invoice_details`
--
ALTER TABLE `invoice_details`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `migrations`
--
ALTER TABLE `migrations`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `model_has_permissions`
--
ALTER TABLE `model_has_permissions`
ADD PRIMARY KEY (`permission_id`,`model_id`,`model_type`),
ADD KEY `model_has_permissions_model_id_model_type_index` (`model_id`,`model_type`);
--
-- Indexes for table `model_has_roles`
--
ALTER TABLE `model_has_roles`
ADD PRIMARY KEY (`role_id`,`model_id`,`model_type`),
ADD KEY `model_has_roles_model_id_model_type_index` (`model_id`,`model_type`);
--
-- Indexes for table `password_resets`
--
ALTER TABLE `password_resets`
ADD KEY `password_resets_email_index` (`email`);
--
-- Indexes for table `payments`
--
ALTER TABLE `payments`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `payment_details`
--
ALTER TABLE `payment_details`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `permissions`
--
ALTER TABLE `permissions`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `products`
--
ALTER TABLE `products`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `products_name_unique` (`name`);
--
-- Indexes for table `purchases`
--
ALTER TABLE `purchases`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `roles`
--
ALTER TABLE `roles`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `role_has_permissions`
--
ALTER TABLE `role_has_permissions`
ADD PRIMARY KEY (`permission_id`,`role_id`),
ADD KEY `role_has_permissions_role_id_foreign` (`role_id`);
--
-- Indexes for table `suppliers`
--
ALTER TABLE `suppliers`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `suppliers_mobile_no_unique` (`mobile_no`),
ADD UNIQUE KEY `suppliers_email_unique` (`email`);
--
-- Indexes for table `units`
--
ALTER TABLE `units`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `units_name_unique` (`name`);
--
-- Indexes for table `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `admins`
--
ALTER TABLE `admins`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;
--
-- AUTO_INCREMENT for table `categories`
--
ALTER TABLE `categories`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;
--
-- AUTO_INCREMENT for table `customers`
--
ALTER TABLE `customers`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;
--
-- AUTO_INCREMENT for table `failed_jobs`
--
ALTER TABLE `failed_jobs`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `invoices`
--
ALTER TABLE `invoices`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `invoice_details`
--
ALTER TABLE `invoice_details`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `migrations`
--
ALTER TABLE `migrations`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=60;
--
-- AUTO_INCREMENT for table `payments`
--
ALTER TABLE `payments`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `payment_details`
--
ALTER TABLE `payment_details`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `permissions`
--
ALTER TABLE `permissions`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=20;
--
-- AUTO_INCREMENT for table `products`
--
ALTER TABLE `products`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;
--
-- AUTO_INCREMENT for table `purchases`
--
ALTER TABLE `purchases`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12;
--
-- AUTO_INCREMENT for table `roles`
--
ALTER TABLE `roles`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=17;
--
-- AUTO_INCREMENT for table `suppliers`
--
ALTER TABLE `suppliers`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT for table `units`
--
ALTER TABLE `units`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=39;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `model_has_permissions`
--
ALTER TABLE `model_has_permissions`
ADD CONSTRAINT `model_has_permissions_permission_id_foreign` FOREIGN KEY (`permission_id`) REFERENCES `permissions` (`id`) ON DELETE CASCADE;
--
-- Constraints for table `model_has_roles`
--
ALTER TABLE `model_has_roles`
ADD CONSTRAINT `model_has_roles_role_id_foreign` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`) ON DELETE CASCADE;
--
-- Constraints for table `role_has_permissions`
--
ALTER TABLE `role_has_permissions`
ADD CONSTRAINT `role_has_permissions_permission_id_foreign` FOREIGN KEY (`permission_id`) REFERENCES `permissions` (`id`) ON DELETE CASCADE,
ADD CONSTRAINT `role_has_permissions_role_id_foreign` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`) ON DELETE CASCADE;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
-- sql command to get electronic subscriptions for exporting
--
-- with a token
--
SELECT
client_sage_client_final tiers_id,
tiers_drupal drupal_id,
revue_code revue,
CONCAT(abonnement_annee, '-01-01') debut,
CONCAT(abonnement_annee + 1, '-::bonus::') fin
FROM
abonnement
LEFT JOIN revue ON revue_id = abonnement_revue
LEFT JOIN client_sage ON client_sage_id = abonnement_client_sage
LEFT JOIN tiers ON client_sage_client_final = tiers_id
WHERE abonnement_type = 2
AND abonnement_annee >= year(now()) - 1
AND tiers_drupal IS NOT null
AND abonnement_ignorer = 0;
|
<reponame>Morganballat/Yabon-back<filename>migration/verify/views.sql
-- Verify yabon-prono:views on pg
BEGIN;
-- XXX Add verifications here.
ROLLBACK;
|
-- insert upstream waterbody areas into temp table
WITH upstr_wb AS
(SELECT DISTINCT
a.linear_feature_id,
ST_Area(lake.geom) as area_lake,
ST_Area(manmade.geom) as area_manmade,
ST_Area(wetland.geom) as area_wetland
FROM whse_basemapping.fwa_stream_networks_sp a
INNER JOIN whse_basemapping.fwa_stream_networks_sp b
ON FWA_Upstream(
a.blue_line_key,
a.downstream_route_measure,
a.wscode_ltree,
a.localcode_ltree,
b.blue_line_key,
b.downstream_route_measure,
b.wscode_ltree,
b.localcode_ltree,
True,
.02
)
LEFT OUTER JOIN whse_basemapping.fwa_lakes_poly lake
ON b.waterbody_key = lake.waterbody_key
LEFT OUTER JOIN whse_basemapping.fwa_manmade_waterbodies_poly manmade
ON b.waterbody_key = manmade.waterbody_key
LEFT OUTER JOIN whse_basemapping.fwa_wetlands_poly wetland
ON b.waterbody_key = wetland.waterbody_key
WHERE b.waterbody_key IS NOT NULL
AND a.watershed_group_code = %s
ORDER BY a.linear_feature_id
)
INSERT INTO whse_basemapping.temp_upstream_wb_area_ha
SELECT
linear_feature_id,
ROUND((SUM(COALESCE(uwb.area_lake, 0)) / 10000)::numeric, 2) AS upstream_lake_ha,
ROUND((SUM(COALESCE(uwb.area_manmade, 0)) / 10000)::numeric, 2) AS upstream_reservoir_ha,
ROUND((SUM(COALESCE(uwb.area_wetland, 0)) / 10000)::numeric, 2) AS upstream_wetland_ha
FROM upstr_wb uwb
GROUP BY linear_feature_id;
|
-- MySQL dump 10.13 Distrib 5.6.35, for osx10.9 (x86_64)
--
-- Host: localhost Database: Quickadclassified
-- ------------------------------------------------------
-- Server version 5.6.35
/*!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 */;
--
-- Dumping data for table `<<prefix>>subadmin1`
--
/*!40000 ALTER TABLE `<<prefix>>subadmin1` DISABLE KEYS */;
INSERT INTO `<<prefix>>subadmin1` VALUES (1717,'LK.36','LK','Western','Western',1);
INSERT INTO `<<prefix>>subadmin1` VALUES (1718,'LK.35','LK','Uva','Uva',1);
INSERT INTO `<<prefix>>subadmin1` VALUES (1719,'LK.34','LK','Southern','Southern',1);
INSERT INTO `<<prefix>>subadmin1` VALUES (1720,'LK.33','LK','Sabaragamuwa','Sabaragamuwa',1);
INSERT INTO `<<prefix>>subadmin1` VALUES (1721,'LK.32','LK','North Western','North Western',1);
INSERT INTO `<<prefix>>subadmin1` VALUES (1722,'LK.30','LK','North Central','North Central',1);
INSERT INTO `<<prefix>>subadmin1` VALUES (1723,'LK.29','LK','Central','Central',1);
INSERT INTO `<<prefix>>subadmin1` VALUES (1724,'LK.38','LK','Northern Province','Northern Province',1);
INSERT INTO `<<prefix>>subadmin1` VALUES (1725,'LK.37','LK','Eastern Province','Eastern Province',1);
/*!40000 ALTER TABLE `<<prefix>>subadmin1` ENABLE KEYS */;
--
-- Dumping data for table `<<prefix>>subadmin2`
--
/*!40000 ALTER TABLE `<<prefix>>subadmin2` DISABLE KEYS */;
INSERT INTO `<<prefix>>subadmin2` VALUES (21035,'LK.38.1225017','LK','LK.38','Vavuniya District','Vavuniya District',1);
INSERT INTO `<<prefix>>subadmin2` VALUES (21036,'LK.37.1226258','LK','LK.37','Trincomalee District','Trincomalee District',1);
INSERT INTO `<<prefix>>subadmin2` VALUES (21037,'LK.33.1228729','LK','LK.33','Ratnapura District','Ratnapura District',1);
INSERT INTO `<<prefix>>subadmin2` VALUES (21038,'LK.32.1229292','LK','LK.32','Puttalam District','Puttalam District',1);
INSERT INTO `<<prefix>>subadmin2` VALUES (21039,'LK.30.1229899','LK','LK.30','Polonnaruwa District','Polonnaruwa District',1);
INSERT INTO `<<prefix>>subadmin2` VALUES (21040,'LK.29.1232781','LK','LK.29','Nuwara Eliya District','Nuwara Eliya District',1);
INSERT INTO `<<prefix>>subadmin2` VALUES (21041,'LK.38.1234392','LK','LK.38','Mullaitivu District','Mullaitivu District',1);
INSERT INTO `<<prefix>>subadmin2` VALUES (21042,'LK.35.1234818','LK','LK.35','Moneragala District','Moneragala District',1);
INSERT INTO `<<prefix>>subadmin2` VALUES (21043,'LK.34.1235845','LK','LK.34','Matara District','Matara District',1);
INSERT INTO `<<prefix>>subadmin2` VALUES (21044,'LK.29.1235854','LK','LK.29','Matale District','Matale District',1);
INSERT INTO `<<prefix>>subadmin2` VALUES (21045,'LK.38.1236148','LK','LK.38','Mannar District','Mannar District',1);
INSERT INTO `<<prefix>>subadmin2` VALUES (21046,'LK.32.1237978','LK','LK.32','Kurunegala District','Kurunegala District',1);
INSERT INTO `<<prefix>>subadmin2` VALUES (21047,'LK.38.1240371','LK','LK.38','Kilinochchi District','Kilinochchi District',1);
INSERT INTO `<<prefix>>subadmin2` VALUES (21048,'LK.33.1240722','LK','LK.33','Kegalle District','Kegalle District',1);
INSERT INTO `<<prefix>>subadmin2` VALUES (21049,'LK.29.1241621','LK','LK.29','Kandy District','Kandy District',1);
INSERT INTO `<<prefix>>subadmin2` VALUES (21050,'LK.36.1241963','LK','LK.36','Kalutara District','Kalutara District',1);
INSERT INTO `<<prefix>>subadmin2` VALUES (21051,'LK.38.1242831','LK','LK.38','Jaffna District','Jaffna District',1);
INSERT INTO `<<prefix>>subadmin2` VALUES (21052,'LK.34.1244925','LK','LK.34','Hambantota District','Hambantota District',1);
INSERT INTO `<<prefix>>subadmin2` VALUES (21053,'LK.36.1246005','LK','LK.36','Gampaha District','Gampaha District',1);
INSERT INTO `<<prefix>>subadmin2` VALUES (21054,'LK.34.1246292','LK','LK.34','Galle District','Galle District',1);
INSERT INTO `<<prefix>>subadmin2` VALUES (21055,'LK.36.1248990','LK','LK.36','Colombo District','Colombo District',1);
INSERT INTO `<<prefix>>subadmin2` VALUES (21056,'LK.37.1250159','LK','LK.37','Batticaloa District','Batticaloa District',1);
INSERT INTO `<<prefix>>subadmin2` VALUES (21057,'LK.35.1250614','LK','LK.35','Badulla District','Badulla District',1);
INSERT INTO `<<prefix>>subadmin2` VALUES (21058,'LK.30.1251080','LK','LK.30','Anuradhapura District','Anuradhapura District',1);
INSERT INTO `<<prefix>>subadmin2` VALUES (21059,'LK.37.1251460','LK','LK.37','Ampara District','Ampara District',1);
/*!40000 ALTER TABLE `<<prefix>>subadmin2` ENABLE KEYS */;
--
-- Dumping data for table `<<prefix>>cities`
--
/*!40000 ALTER TABLE `<<prefix>>cities` DISABLE KEYS */;
INSERT INTO `<<prefix>>cities` VALUES (1223648,'LK','Welisara','Welisara',7.0281,79.9014,'P','PPL','LK.36',NULL,41306,'Asia/Colombo',1,'2006-01-26 23:00:00','2006-01-26 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (1223738,'LK','Weligama','Weligama',5.97501,80.4297,'P','PPL','LK.34',NULL,22179,'Asia/Colombo',1,'2012-11-07 23:00:00','2012-11-07 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (1224061,'LK','Wattegama','Wattegama',6.7989,81.4808,'P','PPL','LK.35',NULL,8000,'Asia/Colombo',1,'2006-01-16 23:00:00','2006-01-16 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (1224085,'LK','Wattala','Wattala',6.9779,79.8898,'P','PPL','LK.36',NULL,30725,'Asia/Colombo',1,'2012-01-16 23:00:00','2012-01-16 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (1225018,'LK','Vavuniya','Vavuniya',8.7514,80.4971,'P','PPL','LK.38',NULL,60176,'Asia/Colombo',1,'2012-04-04 23:00:00','2012-04-04 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (1225142,'LK','Valvedditturai','Valvedditturai',9.81667,80.1667,'P','PPL','LK.38',NULL,78205,'Asia/Colombo',1,'2012-04-04 23:00:00','2012-04-04 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (1225187,'LK','Vakarai','Vakarai',8.13333,81.4333,'P','PPL','LK.37',NULL,21000,'Asia/Colombo',1,'2017-12-12 23:00:00','2017-12-12 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (1226260,'LK','Trincomalee','Trincomalee',8.5711,81.2335,'P','PPLA','LK.37',NULL,108420,'Asia/Colombo',1,'2012-01-15 23:00:00','2012-01-15 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (1227037,'LK','Tangalla','Tangalla',6.02338,80.7974,'P','PPL','LK.34',NULL,10497,'Asia/Colombo',1,'2017-07-16 23:00:00','2017-07-16 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (1228730,'LK','Ratnapura','Ratnapura',6.68278,80.3992,'P','PPLA','LK.33',NULL,47832,'Asia/Colombo',1,'2013-06-27 23:00:00','2013-06-27 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (1229293,'LK','Puttalam','Puttalam',8.0362,79.8283,'P','PPL','LK.32',NULL,45661,'Asia/Colombo',1,'2012-01-16 23:00:00','2012-01-16 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (1229901,'LK','Polonnaruwa','Polonnaruwa',7.93965,81.0027,'P','PPL','LK.30',NULL,13900,'Asia/Colombo',1,'2012-11-07 23:00:00','2012-11-07 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (1229989,'LK','Point Pedro','Point Pedro',9.81667,80.2333,'P','PPL','LK.38',NULL,89810,'Asia/Colombo',1,'2012-04-04 23:00:00','2012-04-04 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (1230089,'LK','Pita Kotte','Pita Kotte',6.8905,79.9015,'P','PPL','LK.36',NULL,118179,'Asia/Colombo',1,'2006-01-16 23:00:00','2006-01-16 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (1230613,'LK','Peliyagoda','Peliyagoda',6.9685,79.8836,'P','PPL','LK.36',NULL,30717,'Asia/Colombo',1,'2012-01-16 23:00:00','2012-01-16 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (1231410,'LK','Panadura','Panadura',6.7132,79.9026,'P','PPL','LK.36',NULL,33735,'Asia/Colombo',1,'2012-01-16 23:00:00','2012-01-16 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (1232783,'LK','Nuwara Eliya','Nuwara Eliya',6.97078,80.7829,'P','PPL','LK.29','LK.29.1232781',25775,'Asia/Colombo',1,'2013-09-20 23:00:00','2013-09-20 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (1233369,'LK','Negombo','Negombo',7.2083,79.8358,'P','PPL','LK.36',NULL,137223,'Asia/Colombo',1,'2012-01-16 23:00:00','2012-01-16 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (1234378,'LK','Mulleriyawa','Mulleriyawa',6.933,79.9297,'P','PPL','LK.36',NULL,33540,'Asia/Colombo',1,'2006-01-16 23:00:00','2006-01-16 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (1234569,'LK','Dehiwala-Mount Lavinia','Dehiwala-Mount Lavinia',6.84019,79.8712,'P','PPL','LK.36','LK.36.1248990',219827,'Asia/Colombo',1,'2015-12-12 23:00:00','2015-12-12 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (1234633,'LK','Moratuwa','Moratuwa',6.773,79.8816,'P','PPL','LK.36',NULL,185031,'Asia/Colombo',1,'2012-01-16 23:00:00','2012-01-16 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (1234808,'LK','Monaragala','Monaragala',6.8714,81.3487,'P','PPL','LK.35',NULL,10236,'Asia/Colombo',1,'2012-01-16 23:00:00','2012-01-16 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (1235000,'LK','Minuwangoda','Minuwangoda',7.1663,79.9533,'P','PPL','LK.36',NULL,7772,'Asia/Colombo',1,'2012-01-16 23:00:00','2012-01-16 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (1235846,'LK','Matara','Matara',5.94851,80.5353,'P','PPL','LK.34',NULL,76254,'Asia/Colombo',1,'2010-06-14 23:00:00','2010-06-14 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (1235855,'LK','Matale','Matale',7.4698,80.6217,'P','PPL','LK.29',NULL,36462,'Asia/Colombo',1,'2017-12-13 23:00:00','2017-12-13 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (1236854,'LK','Maharagama','Maharagama',6.848,79.9265,'P','PPL','LK.36',NULL,66576,'Asia/Colombo',1,'2012-01-16 23:00:00','2012-01-16 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (1237980,'LK','Kurunegala','Kurunegala',7.4863,80.3623,'P','PPLA','LK.32',NULL,28571,'Asia/Colombo',1,'2012-01-13 23:00:00','2012-01-13 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (1238427,'LK','Kuliyapitiya','Kuliyapitiya',7.4688,80.0401,'P','PPL','LK.32',NULL,6877,'Asia/Colombo',1,'2012-01-16 23:00:00','2012-01-16 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (1238992,'LK','Sri Jayewardenepura Kotte','Sri Jayewardenepura Kotte',6.88297,79.9071,'P','PPL','LK.36',NULL,115826,'Asia/Colombo',1,'2015-04-23 23:00:00','2015-04-23 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (1239047,'LK','Kotikawatta','Kotikawatta',6.9269,79.9095,'P','PPL','LK.36',NULL,64565,'Asia/Colombo',1,'2013-04-02 23:00:00','2013-04-02 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (1239593,'LK','Kolonnawa','Kolonnawa',6.9329,79.8848,'P','PPL','LK.36',NULL,58076,'Asia/Colombo',1,'2012-01-16 23:00:00','2012-01-16 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (1240372,'LK','Kilinochchi','Kilinochchi',9.3961,80.3982,'P','PPL','LK.38',NULL,13006,'Asia/Colombo',1,'2012-04-04 23:00:00','2012-04-04 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (1240622,'LK','Kelaniya','Kelaniya',6.9553,79.922,'P','PPL','LK.36',NULL,28846,'Asia/Colombo',1,'2013-04-12 23:00:00','2013-04-12 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (1240723,'LK','Kegalle','Kegalle',7.2523,80.3436,'P','PPL','LK.33',NULL,17962,'Asia/Colombo',1,'2017-12-12 23:00:00','2017-12-12 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (1240935,'LK','Katunayaka','Katunayaka',7.16992,79.8884,'P','PPLA3','LK.36',NULL,84643,'Asia/Colombo',1,'2014-08-04 23:00:00','2014-08-04 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (1241076,'LK','Kataragama','Kataragama',6.4134,81.3346,'P','PPL','LK.35',NULL,20935,'Asia/Colombo',1,'2017-06-21 23:00:00','2017-06-21 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (1241622,'LK','Kandy','Kandy',7.2955,80.6356,'P','PPLA','LK.29',NULL,111701,'Asia/Colombo',1,'2012-01-13 23:00:00','2012-01-13 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (1241750,'LK','Kandana','Kandana',7.048,79.8937,'P','PPL','LK.36',NULL,33424,'Asia/Colombo',1,'2012-01-16 23:00:00','2012-01-16 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (1241964,'LK','Kalutara','Kalutara',6.5831,79.9593,'P','PPL','LK.36',NULL,38000,'Asia/Colombo',1,'2014-02-01 23:00:00','2014-02-01 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (1242110,'LK','Kalmunai','Kalmunai',7.40902,81.8347,'P','PPL','LK.37',NULL,100171,'Asia/Colombo',1,'2014-05-02 23:00:00','2014-05-02 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (1242833,'LK','Jaffna','Jaffna',9.66845,80.0074,'P','PPLA','LK.38',NULL,169102,'Asia/Colombo',1,'2013-06-27 23:00:00','2013-06-27 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (1242835,'LK','Ja Ela','Ja Ela',7.0744,79.8919,'P','PPL','LK.36',NULL,32175,'Asia/Colombo',1,'2006-01-26 23:00:00','2006-01-26 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (1243867,'LK','Horana South','Horana South',6.7159,80.0626,'P','PPL','LK.36',NULL,8982,'Asia/Colombo',1,'2012-01-16 23:00:00','2012-01-16 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (1243936,'LK','Homagama','Homagama',6.844,80.0024,'P','PPL','LK.36',NULL,34664,'Asia/Colombo',1,'2006-01-16 23:00:00','2006-01-16 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (1244397,'LK','Hendala','Hendala',6.9909,79.883,'P','PPL','LK.36',NULL,56978,'Asia/Colombo',1,'2006-01-16 23:00:00','2006-01-16 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (1244596,'LK','Hatton','Hatton',6.8916,80.5955,'P','PPL','LK.29',NULL,15073,'Asia/Colombo',1,'2012-01-18 23:00:00','2012-01-18 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (1244773,'LK','Hanwella Ihala','Hanwella Ihala',6.9012,80.0852,'P','PPL','LK.36',NULL,22918,'Asia/Colombo',1,'2006-01-26 23:00:00','2006-01-26 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (1246000,'LK','Gampola','Gampola',7.1643,80.5696,'P','PPL','LK.29',NULL,24730,'Asia/Colombo',1,'2012-01-16 23:00:00','2012-01-16 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (1246007,'LK','Gampaha','Gampaha',7.0897,79.9925,'P','PPL','LK.36',NULL,9350,'Asia/Colombo',1,'2012-01-16 23:00:00','2012-01-16 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (1246294,'LK','Galle','Galle',6.0367,80.217,'P','PPLA','LK.34',NULL,93118,'Asia/Colombo',1,'2012-01-13 23:00:00','2012-01-13 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (1246321,'LK','Galkissa','Galkissa',6.8293,79.863,'P','PPL','LK.36',NULL,215941,'Asia/Colombo',1,'2006-01-26 23:00:00','2006-01-26 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (1246924,'LK','Eravur Town','Eravur Town',7.7782,81.6038,'P','PPL','LK.37',NULL,22982,'Asia/Colombo',1,'2012-04-04 23:00:00','2012-04-04 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (1248749,'LK','Dambulla','Dambulla',7.86,80.6517,'P','PPL','LK.29','LK.29.1235854',66716,'Asia/Colombo',1,'2015-04-10 23:00:00','2015-04-10 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (1248991,'LK','Colombo','Colombo',6.93194,79.8478,'P','PPLC','LK.36',NULL,648034,'Asia/Colombo',1,'2007-02-16 23:00:00','2007-02-16 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (1249145,'LK','Chilaw','Chilaw',7.57583,79.7953,'P','PPL','LK.32',NULL,24712,'Asia/Colombo',1,'2012-01-16 23:00:00','2012-01-16 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (1249931,'LK','Beruwala','Beruwala',6.4788,79.9828,'P','PPL','LK.36',NULL,34250,'Asia/Colombo',1,'2012-01-31 23:00:00','2012-01-31 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (1249978,'LK','Bentota','Bentota',6.42598,79.9958,'P','PPL','LK.34',NULL,37000,'Asia/Colombo',1,'2013-04-12 23:00:00','2013-04-12 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (1250161,'LK','Batticaloa','Batticaloa',7.7102,81.6924,'P','PPL','LK.37',NULL,86742,'Asia/Colombo',1,'2012-04-04 23:00:00','2012-04-04 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (1250164,'LK','Battaramulla South','Battaramulla South',6.8964,79.9181,'P','PPL','LK.36',NULL,75633,'Asia/Colombo',1,'2012-01-16 23:00:00','2012-01-16 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (1250615,'LK','Badulla','Badulla',6.9895,81.0557,'P','PPLA','LK.35',NULL,47587,'Asia/Colombo',1,'2013-06-27 23:00:00','2013-06-27 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (1251081,'LK','Anuradhapura','Anuradhapura',8.31223,80.4131,'P','PPLA','LK.30',NULL,60943,'Asia/Colombo',1,'2013-04-02 23:00:00','2013-04-02 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (1251459,'LK','Ampara','Ampara',7.29754,81.682,'P','PPL','LK.37',NULL,18348,'Asia/Colombo',1,'2012-11-07 23:00:00','2012-11-07 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (1251574,'LK','Ambalangoda','Ambalangoda',6.2355,80.0538,'P','PPL','LK.34',NULL,20133,'Asia/Colombo',1,'2012-01-16 23:00:00','2012-01-16 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (6285792,'LK','Horawala Junction','Horawala Junction',6.48088,80.1271,'P','PPL','LK.36',NULL,7500,'Asia/Colombo',1,'2011-06-13 23:00:00','2011-06-13 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (8260318,'LK','Shanjeev Home','Shanjeev Home',7.38216,81.842,'P','PPL','LK.37',NULL,20000,'Asia/Colombo',1,'2013-11-07 23:00:00','2013-11-07 23:00:00');
INSERT INTO `<<prefix>>cities` VALUES (9259456,'LK','Mount Lavinia','Mount Lavinia',6.83947,79.8645,'P','PPLX','LK.36','LK.36.1248990',219827,'Asia/Colombo',1,'2015-12-12 23:00:00','2015-12-12 23:00:00');
/*!40000 ALTER TABLE `<<prefix>>cities` ENABLE KEYS */;
/*!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
|
<gh_stars>0
/*
* ===================================== script basico =================================
* fecha: 14/12/2021
* autor: <NAME>
* proyecto: Prueba programador jr. comsatel
* =====================================================================================
*/
#DROP DATABASE IF EXISTS DBpruebaJrComsatel;
CREATE DATABASE DBpruebaJrComsatel;
USE DBpruebaJrComsatel;
# -------------tabla tareas--------------------
CREATE TABLE Tb_Tarea
(
Id INT AUTO_INCREMENT PRIMARY KEY,
Tarea varchar(200),
Finalizado bool
);
/* datos iniciales para la tabla Tarea*/
insert into Tb_Tarea(Tarea, Finalizado) values('Reunion Diaria | 08:30 am',false);
insert into Tb_Tarea(Tarea, Finalizado) values('Coordinar reunion con el AreaComenrcial',false);
select * from Tb_Tarea;
|
START TRANSACTION;
CREATE TABLE `tb_usuario` IF NOT EXISTS (
`usu_id` int(11) NOT NULL,
`usu_login` varchar(40) NOT NULL,
`usu_senha` varchar(50) NOT NULL COMMENT 'md5',
`usu_nome` varchar(60) NOT NULL,
`usu_nivel` int(11) NOT NULL DEFAULT 0 COMMENT 'nível de permissão de acesso; 100/90/80/70/60/50/40/30/20/10/0',
`usu_ativo` bit(1) NOT NULL DEFAULT b'1'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT INTO `tb_usuario` (`usu_id`, `usu_login`, `usu_senha`, `usu_nome`, `usu_nivel`, `usu_ativo`) VALUES
(1, 'alltronic', 'f4688fd43cbef7ac061c7309a475519f', 'Alltronic', 100, b'1');
ALTER TABLE `tb_usuario`
ADD PRIMARY KEY (`usu_id`),
ADD UNIQUE KEY `idx_usu_login` (`usu_login`);
ALTER TABLE `tb_usuario`
MODIFY `usu_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
ALTER TABLE `alltronic_ssda`.`tb_usuario` DROP INDEX `idx_usu_login`, ADD UNIQUE `idx_usuario_login` (`usu_login`) USING BTREE;
ALTER TABLE `tb_maquina` CHANGE `maq_ativo` `maq_ativo` TINYINT(1) NOT NULL DEFAULT '1';
ALTER TABLE `tb_maquina_grupo` CHANGE `mgr_ativo` `mgr_ativo` TINYINT(1) NOT NULL DEFAULT '1';
ALTER TABLE `tb_tipo_status` CHANGE `tst_ativo` `tst_ativo` TINYINT(1) NOT NULL DEFAULT '1';
ALTER TABLE `tb_usuario` CHANGE `usu_ativo` `usu_ativo` TINYINT(1) NOT NULL DEFAULT '1';
ALTER TABLE tb_usuario ADD CONSTRAINT check_usuario_ativo CHECK (usu_ativo IN (0, 1));
ALTER TABLE tb_usuario ADD CONSTRAINT check_usuario_nivel CHECK (usu_nivel IN (0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100));
ALTER TABLE tb_tipo_status ADD CONSTRAINT check_tipo_status_ativo CHECK (tst_ativo IN (0, 1));
ALTER TABLE tb_status ADD CONSTRAINT check_status_bit CHECK (sta_bit >= 0);
ALTER TABLE tb_maquina_grupo ADD CONSTRAINT check_maq_grupo_ativo CHECK (mgr_ativo IN (0, 1));
ALTER TABLE tb_maquina ADD CONSTRAINT check_maquina_ativo CHECK (maq_ativo IN (0, 1));
ALTER TABLE tb_log_status_maquina ADD CONSTRAINT check_log_sta_maquina_valor CHECK (lsm_valor IN (0, 1));
ALTER TABLE tb_log_envase_bico ADD CONSTRAINT check_log_envase_bico CHECK (leb_valor >= 0);
CREATE TABLE `alltronic_ssda`.`tb_menu` ( `men_id` INT NOT NULL AUTO_INCREMENT , `men_descricao` VARCHAR(30) NOT NULL , `men_pai` INT NULL , `men_icon` VARCHAR(60) NULL , `men_nivel` INT NOT NULL COMMENT 'nível de acesso/permissão' , `men_ativo` TINYINT NOT NULL DEFAULT '1' , PRIMARY KEY (`men_id`)) ENGINE = InnoDB;
ALTER TABLE tb_menu ADD CONSTRAINT check_menu_ativo CHECK (men_ativo IN (0, 1));
ALTER TABLE tb_menu ADD CONSTRAINT check_menu_nivel CHECK (men_nivel IN (0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100));
ALTER TABLE `tb_menu` ADD `men_controller` VARCHAR(40) NOT NULL AFTER `men_pai`, ADD `men_action` VARCHAR(40) NOT NULL AFTER `men_controller`;
ALTER TABLE `tb_menu` CHANGE `men_controller` `men_controller` VARCHAR(40) CHARACTER SET utf8 COLLATE utf8_general_ci NULL;
ALTER TABLE `tb_menu` CHANGE `men_action` `men_action` VARCHAR(40) CHARACTER SET utf8 COLLATE utf8_general_ci NULL;
INSERT INTO `tb_menu` (`men_id`, `men_descricao`, `men_pai`, `men_controller`, `men_action`, `men_icon`, `men_nivel`, `men_ativo`) VALUES (NULL, 'Cadastros', NULL, NULL, NULL, '<i class=\"far fa-fw fa-folder\"></i>', '100', '1');
INSERT INTO `tb_menu` (`men_id`, `men_descricao`, `men_pai`, `men_controller`, `men_action`, `men_icon`, `men_nivel`, `men_ativo`) VALUES (NULL, 'Menu', (SELECT a.men_id FROM tb_menu a WHERE a.men_descricao = 'Cadastros'), 'Menu', 'index', '<i class=\"fas fa-fw fa-bars\"></i>', '100', '1');
ALTER TABLE `tb_menu` CHANGE `men_nivel` `men_nivel` INT(11) NOT NULL DEFAULT '0' COMMENT 'nível de acesso/permissão';
INSERT INTO `tb_menu` (`men_id`, `men_descricao`, `men_pai`, `men_controller`, `men_action`, `men_icon`, `men_nivel`, `men_ativo`) VALUES (NULL, 'Relatórios', NULL, NULL, NULL, '<i class=\"fas fa-print\"></i>', '0', '1');
UPDATE `tb_menu` SET men_controller = 'Relatorio', men_action = 'index' WHERE men_descricao = 'Relatórios';
DROP TRIGGER IF EXISTS trig_check_menu_insert;
delimiter //
CREATE TRIGGER `trig_check_menu_insert` BEFORE INSERT ON `tb_menu` FOR EACH ROW
BEGIN
DECLARE v_msg_error TEXT DEFAULT '';
DECLARE v_temp_string TEXT DEFAULT '';
IF (LENGTH(COALESCE(NEW.men_descricao, '')) < 3) THEN
SET v_temp_string = v_msg_error;
SET v_msg_error = CONCAT(' - A descrição deve ter pelo menos 3 caracteres! ', v_temp_string);
END IF;
IF (LENGTH(COALESCE(NEW.men_controller, '')) > 0) AND (LENGTH(COALESCE(NEW.men_action, '')) <= 0) THEN
SET v_temp_string = v_msg_error;
SET v_msg_error = CONCAT(' - Preencha a action! ', v_temp_string);
END IF;
IF (LENGTH(COALESCE(NEW.men_action, '')) > 0) AND (LENGTH(COALESCE(NEW.men_controller, '')) <= 0) THEN
SET v_temp_string = v_msg_error;
SET v_msg_error = CONCAT(' - Preencha o controller! ', v_temp_string);
END IF;
IF v_msg_error != '' THEN
SET v_temp_string = CONCAT('Corrija os erros antes de prosseguir: ', v_msg_error);
SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = v_temp_string;
END IF;
END //
delimiter ;
DROP TRIGGER IF EXISTS trig_check_menu_update;
delimiter //
CREATE TRIGGER `trig_check_menu_update` BEFORE INSERT ON `tb_menu` FOR EACH ROW
BEGIN
DECLARE v_msg_error TEXT DEFAULT '';
DECLARE v_temp_string TEXT DEFAULT '';
IF (LENGTH(COALESCE(NEW.men_descricao, '')) < 3) THEN
SET v_temp_string = v_msg_error;
SET v_msg_error = CONCAT(' - A descrição deve ter pelo menos 3 caracteres! ', v_temp_string);
END IF;
IF (LENGTH(COALESCE(NEW.men_controller, '')) > 0) AND (LENGTH(COALESCE(NEW.men_action, '')) <= 0) THEN
SET v_temp_string = v_msg_error;
SET v_msg_error = CONCAT(' - Preencha a action! ', v_temp_string);
END IF;
IF (LENGTH(COALESCE(NEW.men_action, '')) > 0) AND (LENGTH(COALESCE(NEW.men_controller, '')) <= 0) THEN
SET v_temp_string = v_msg_error;
SET v_msg_error = CONCAT(' - Preencha o controller! ', v_temp_string);
END IF;
IF v_msg_error != '' THEN
SET v_temp_string = CONCAT('Corrija os erros antes de prosseguir: ', v_msg_error);
SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = v_temp_string;
END IF;
END //
delimiter ;
INSERT INTO `tb_menu` (`men_descricao`, `men_pai`, `men_controller`, `men_action`, `men_icon`, `men_nivel`, `men_ativo`) VALUES ('Status', (SELECT a.men_id FROM tb_menu a WHERE a.men_descricao = 'Cadastros'), 'Status', 'index', '<i class=\"fas fa-thermometer-half\"></i>', '100', '1');
INSERT INTO `tb_menu` (`men_descricao`, `men_pai`, `men_controller`, `men_action`, `men_icon`, `men_nivel`, `men_ativo`) VALUES ('Máquina Grupo', (SELECT a.men_id FROM tb_menu a WHERE a.men_descricao = 'Cadastros'), 'MaquinaGrupo', 'index', '<i class=\"fas fa-industry\"></i>', '100', '1');
ALTER TABLE `alltronic_ssda`.`tb_maquina_grupo` ADD UNIQUE `uk_mgr_descricao` (`mgr_descricao`);
INSERT INTO `tb_menu` (`men_descricao`, `men_pai`, `men_controller`, `men_action`, `men_icon`, `men_nivel`, `men_ativo`) VALUES ('Máquina', (SELECT a.men_id FROM tb_menu a WHERE a.men_descricao = 'Cadastros'), 'Maquina', 'index', '<i class=\"fas fa-industry\"></i>', '100', '1');
DROP TRIGGER IF EXISTS trig_delete_maquina_bico;
delimiter //
CREATE TRIGGER `trig_delete_maquina_bico` BEFORE DELETE ON `tb_maquina` FOR EACH ROW
BEGIN
DELETE FROM tb_maquina_bico WHERE mab_maq_id = OLD.maq_id;
END //
delimiter ;
COMMIT;
|
-- Adding elevation attribute
alter table locations
add column elevation integer;
|
<gh_stars>0
-- abstract search.get_item queries matching items
--
create function search.get_item(jsonb)
returns setof search_.item
language sql
stable
as $$
select null::search_.item where false
$$;
-- abstract search.to_jsonb transforms an item to uniform type
--
create function search.to_jsonb(search_.item)
returns jsonb
language sql
as $$
select null::jsonb where false
$$;
-- search.get returns aggregrates matching items
-- returning search_.item and select * will inline query
-- override this as needed
--
create function search.get (
req jsonb
)
-- returns setof search_.item
returns setof jsonb
language sql
security definer
stable
as $$
-- select *
select search.to_jsonb(t)
from search.get_item(req) t
$$;
-- search.get_item and search.to_jsonb are replaced base on
-- search_.type as below:
--
create procedure search.replace_get_fs ()
language plpgsql
as $$
declare
t text;
begin
-- for all-types:
-- update search.get_item(req)
-- it uses match_f(param_t, match_it) to search for items
execute format('
create or replace function search.get_item (
req jsonb
)
returns setof search_.item
language sql
stable
as $fn$
select *
from search_.item t
where (
req->>''types'' is null
or t.type = any (array(select jsonb_array_elements_text(req->''types'')))
)
and (%s)
$fn$;
',(
select array_to_string(array_agg(format('
(
t.type=%L
and %s(
jsonb_populate_record(null::%s, t.param),
jsonb_populate_record(null::%s, req)
)
)', t.id, t.match_f::regproc, t.param_t, t.match_it)),
' OR ')
from search_.type t
));
-- update search.to_jsonb(item)
-- to transform output uniformly as a jsonb
--
execute format('
create or replace function search.to_jsonb (
i search_.item
)
returns jsonb
language sql
stable
as $fn$
select case
%s
else null
end;
$fn$;
', (
select array_to_string(array_agg(format('
when i.type = %L
then (
select %s(a) from %s a where a.id=i.id
)
', t.id, t.jsonb_f::regproc, t.table_t)),
'')
from search_.type t
));
end;
$$;
|
USE questions;
DROP TABLE IF EXISTS questions;
CREATE TABLE questions (
id INTEGER NOT NULL AUTO_INCREMENT,
username VARCHAR(256) NOT NULL,
contents VARCHAR(1024) NOT NULL,
problem CHAR NOT NULL,
time timestamp NOT NULL DEFAULT now(),
PRIMARY KEY (id)
) CHARSET=utf8;
|
-- Examples from snowflake docs.
select * from stock_price_history
match_recognize(
partition by company
order by price_date
measures
match_number() as match_number,
first(price_date) as start_date,
last(price_date) as end_date,
count(*) as rows_in_sequence,
count(row_with_price_decrease.*) as num_decreases,
count(row_with_price_increase.*) as num_increases
one row per match
after match skip to last row_with_price_increase
pattern(row_before_decrease row_with_price_decrease+ row_with_price_increase+)
define
row_with_price_decrease as price < lag(price),
row_with_price_increase as price > lag(price)
)
order by company, match_number;
select price_date, match_number, msq, price, cl from
(select * from stock_price_history where company='ABCD') match_recognize(
order by price_date
measures
match_number() as "MATCH_NUMBER",
match_sequence_number() as msq,
classifier() as cl
all rows per match
pattern(any_row up+)
define
any_row as true,
up as price > lag(price)
)
order by match_number, msq;
select * from stock_price_history match_recognize(
partition by company
order by price_date
measures
match_number() as "MATCH_NUMBER"
all rows per match omit empty matches
pattern(overavg*)
define
overavg as price > avg(price) over (rows between unbounded
preceding and unbounded following)
)
order by company, price_date;
select * from stock_price_history match_recognize(
partition by company
order by price_date
measures
match_number() as "MATCH_NUMBER",
classifier() as cl
all rows per match with unmatched rows
pattern(overavg+)
define
overavg as price > avg(price) over (rows between unbounded
preceding and unbounded following)
)
order by company, price_date;
select company, price_date, price, "FINAL FIRST(LT45.price)", "FINAL LAST(LT45.price)"
from stock_price_history
match_recognize (
partition by company
order by price_date
measures
final first(lt45.price) as "FINAL FIRST(LT45.price)",
final last(lt45.price) as "FINAL LAST(LT45.price)"
all rows per match
after match skip past last row
pattern (lt45 lt45)
define
lt45 as price < 45.00
)
where company = 'ABCD'
order by price_date;
-- Testing all quantifiers.
select * from stock_price_history
match_recognize(
partition by company
order by price_date
measures
match_number() as match_number,
first(price_date) as start_date,
last(price_date) as end_date,
count(*) as rows_in_sequence,
count(row_with_price_decrease.*) as num_decreases,
count(row_with_price_increase.*) as num_increases
one row per match
after match skip to last row_with_price_increase
pattern(^ S1+ S2* S3? S4{1} S5{1,} S6{,1} S7{1,1} S8*? $)
define
row_with_price_decrease as price < lag(price),
row_with_price_increase as price > lag(price)
)
order by company, match_number;
-- Testing operators.
select * from stock_price_history
match_recognize(
partition by company
order by price_date
measures
match_number() as match_number,
first(price_date) as start_date,
last(price_date) as end_date,
count(*) as rows_in_sequence,
count(row_with_price_decrease.*) as num_decreases,
count(row_with_price_increase.*) as num_increases
one row per match
after match skip to last row_with_price_increase
pattern(^ ( S1 | S2* )? S3 PERMUTE(S4+, S5*?) {- S6 -}+ $)
define
row_with_price_decrease as price < lag(price),
row_with_price_increase as price > lag(price)
)
order by company, match_number;
select * from stock_price_history
match_recognize(
partition by company
order by price_date
measures
match_number() as match_number,
first(price_date) as start_date,
last(price_date) as end_date,
count(*) as rows_in_sequence,
count(row_with_price_decrease.*) as num_decreases,
count(row_with_price_increase.*) as num_increases
one row per match
after match skip to last row_with_price_increase
pattern((A {- B+ C+ -} D+))
define
row_with_price_decrease as price < lag(price),
row_with_price_increase as price > lag(price)
)
order by company, match_number;
select * from stock_price_history
match_recognize(
partition by company
order by price_date
measures
match_number() as match_number,
first(price_date) as start_date,
last(price_date) as end_date,
count(*) as rows_in_sequence,
count(row_with_price_decrease.*) as num_decreases,
count(row_with_price_increase.*) as num_increases
one row per match
after match skip to last row_with_price_increase
pattern((A | B){5} C+)
define
row_with_price_decrease as price < lag(price),
row_with_price_increase as price > lag(price)
)
order by company, match_number;
|
-- This SQL script (re-)creates test database.
DROP TABLE IF EXISTS users;
DROP TABLE IF EXISTS companies;
CREATE TABLE companies (
id SERIAL PRIMARY KEY,
name VARCHAR(255) NOT NULL
);
CREATE TABLE users (
id SERIAL PRIMARY KEY,
company_id INTEGER NOT NULL REFERENCES companies(id),
name VARCHAR(255) NOT NULL,
email VARCHAR(255) NOT NULL
);
|
<filename>products.sql<gh_stars>1-10
CREATE TABLE `products` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`image` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`price` float(10,2) NOT NULL,
`status` tinyint(1) NOT NULL DEFAULT '1',
`category` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
INSERT INTO products VALUES
(1,'Sports Bra Style1','images/womens/bra1.jpg',15.00,1,'womens'),
(2,'Sports Bra Style2','images/womens/bra2.jpg',15.00,1,'womens'),
(3,'Sports Bra Style3','images/womens/bra3.jpg',15.00,1,'womens'),
(4,'Sports Bra Style4','images/womens/bra4.jpg',15.00,1,'womens'),
(5,'Sports Bra Style5','images/womens/bra5.jpg',15.00,1,'womens'),
(6,'Sports Bra Style6','images/womens/bra6.jpg',15.00,1,'womens'),
(7,'Trainer Style1','images/shoes/trainer1.jpg',45.00,1,'shoes'),
(8,'Trainer Style2','images/shoes/trainer2.jpg',45.00,1,'shoes'),
(9,'Trainer Style3','images/shoes/trainer3.jpg',45.00,1,'shoes'),
(10,'Trainer Style4','images/shoes/trainer4.jpg',45.00,1,'shoes'),
(11,'Trainer Style5','images/shoes/trainer5.jpg',45.00,1,'shoes'),
(12,'Trainer Style6','images/shoes/trainer6.jpg',45.00,1,'shoes'),
(13,'Tent Style1','images/camping/tent1.jpg',165.00,1,'camping'),
(14,'Tent Style2','images/camping/tent2.jpg',165.00,1,'camping'),
(15,'Tent Style3','images/camping/tent3.jpg',165.00,1,'camping'),
(16,'Tent Style4','images/camping/tent4.jpg',165.00,1,'camping'),
(17,'Tent Style5','images/camping/tent5.jpg',165.00,1,'camping'),
(18,'Tent Style6','images/camping/tent6.jpg',165.00,1,'camping'),
(19,'Shirt Style1','images/mens/shirt1.jpg',17.00,1,'mens'),
(20,'Shirt Style2','images/mens/shirt2.jpg',17.00,1,'mens'),
(21,'Shirt Style3','images/mens/shirt3.jpg',17.00,1,'mens'),
(22,'Shirt Style4','images/mens/shirt4.jpg',17.00,1,'mens'),
(23,'Shirt Style5','images/mens/shirt5.jpg',17.00,1,'mens'),
(24,'Shirt Style6','images/mens/shirt6.jpg',17.00,1,'mens');
CREATE TABLE `womens` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`image` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`price` float(10,2) NOT NULL,
`status` tinyint(1) NOT NULL DEFAULT '1',
`category` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
INSERT INTO womens VALUES
(1,'Sports Bra Style1','images/womens/bra1.jpg',15.00,1,'womens'),
(2,'Sports Bra Style2','images/womens/bra2.jpg',15.00,1,'womens'),
(3,'Sports Bra Style3','images/womens/bra3.jpg',15.00,1,'womens'),
(4,'Sports Bra Style4','images/womens/bra4.jpg',15.00,1,'womens'),
(5,'Sports Bra Style5','images/womens/bra5.jpg',15.00,1,'womens'),
(6,'Sports Bra Style6','images/womens/bra6.jpg',15.00,1,'womens');
CREATE TABLE `mens` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`image` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`price` float(10,2) NOT NULL,
`status` tinyint(1) NOT NULL DEFAULT '1',
`category` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
INSERT INTO mens VALUES
(19,'Shirt Style1','images/mens/shirt1.jpg',17.00,1,'mens'),
(20,'Shirt Style2','images/mens/shirt2.jpg',17.00,1,'mens'),
(21,'Shirt Style3','images/mens/shirt3.jpg',17.00,1,'mens'),
(22,'Shirt Style4','images/mens/shirt4.jpg',17.00,1,'mens'),
(23,'Shirt Style5','images/mens/shirt5.jpg',17.00,1,'mens'),
(24,'Shirt Style6','images/mens/shirt6.jpg',17.00,1,'mens');
CREATE TABLE `shoes` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`image` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`price` float(10,2) NOT NULL,
`status` tinyint(1) NOT NULL DEFAULT '1',
`category` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
INSERT INTO shoes VALUES
(7,'Trainer Style1','images/shoes/trainer1.jpg',45.00,1,'shoes'),
(8,'Trainer Style2','images/shoes/trainer2.jpg',45.00,1,'shoes'),
(9,'Trainer Style3','images/shoes/trainer3.jpg',45.00,1,'shoes'),
(10,'Trainer Style4','images/shoes/trainer4.jpg',45.00,1,'shoes'),
(11,'Trainer Style5','images/shoes/trainer5.jpg',45.00,1,'shoes'),
(12,'Trainer Style6','images/shoes/trainer6.jpg',45.00,1,'shoes');
CREATE TABLE `camping` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`image` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`price` float(10,2) NOT NULL,
`status` tinyint(1) NOT NULL DEFAULT '1',
`category` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
INSERT INTO camping VALUES
(13,'Tent Style1','images/camping/tent1.jpg',165.00,1,'camping'),
(14,'Tent Style2','images/camping/tent2.jpg',165.00,1,'camping'),
(15,'Tent Style3','images/camping/tent3.jpg',165.00,1,'camping'),
(16,'Tent Style4','images/camping/tent4.jpg',165.00,1,'camping'),
(17,'Tent Style5','images/camping/tent5.jpg',165.00,1,'camping'),
(18,'Tent Style6','images/camping/tent6.jpg',165.00,1,'camping');
|
USE [master]
GO
CREATE DATABASE [SqlCodeReview]
CONTAINMENT = NONE
ON PRIMARY
( NAME = N'SqlCodeRreview', FILENAME = N'M:\TLO\TLO_MSTR\SQLData1\MSSQL11.TLO_MSTR\MSSQL\DATA\SqlCodeRreview.mdf' , SIZE = 5072KB , MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB )
LOG ON
( NAME = N'SqlCodeRreview_log', FILENAME = N'M:\TLO\TLO_MSTR\SQLData1\MSSQL11.TLO_MSTR\MSSQL\DATA\SqlCodeRreview_log.ldf' , SIZE = 4096KB , MAXSIZE = 2048GB , FILEGROWTH = 10%)
GO
ALTER DATABASE [SqlCodeReview] SET COMPATIBILITY_LEVEL = 110
GO
IF (1 = FULLTEXTSERVICEPROPERTY('IsFullTextInstalled'))
begin
EXEC [SqlCodeReview].[dbo].[sp_fulltext_database] @action = 'enable'
end
GO
ALTER DATABASE [SqlCodeReview] SET ANSI_NULL_DEFAULT OFF
GO
ALTER DATABASE [SqlCodeReview] SET ANSI_NULLS OFF
GO
ALTER DATABASE [SqlCodeReview] SET ANSI_PADDING OFF
GO
ALTER DATABASE [SqlCodeReview] SET ANSI_WARNINGS OFF
GO
ALTER DATABASE [SqlCodeReview] SET ARITHABORT OFF
GO
ALTER DATABASE [SqlCodeReview] SET AUTO_CLOSE OFF
GO
ALTER DATABASE [SqlCodeReview] SET AUTO_CREATE_STATISTICS ON
GO
ALTER DATABASE [SqlCodeReview] SET AUTO_SHRINK OFF
GO
ALTER DATABASE [SqlCodeReview] SET AUTO_UPDATE_STATISTICS ON
GO
ALTER DATABASE [SqlCodeReview] SET CURSOR_CLOSE_ON_COMMIT OFF
GO
ALTER DATABASE [SqlCodeReview] SET CURSOR_DEFAULT GLOBAL
GO
ALTER DATABASE [SqlCodeReview] SET CONCAT_NULL_YIELDS_NULL OFF
GO
ALTER DATABASE [SqlCodeReview] SET NUMERIC_ROUNDABORT OFF
GO
ALTER DATABASE [SqlCodeReview] SET QUOTED_IDENTIFIER OFF
GO
ALTER DATABASE [SqlCodeReview] SET RECURSIVE_TRIGGERS OFF
GO
ALTER DATABASE [SqlCodeReview] SET DISABLE_BROKER
GO
ALTER DATABASE [SqlCodeReview] SET AUTO_UPDATE_STATISTICS_ASYNC OFF
GO
ALTER DATABASE [SqlCodeReview] SET DATE_CORRELATION_OPTIMIZATION OFF
GO
ALTER DATABASE [SqlCodeReview] SET TRUSTWORTHY OFF
GO
ALTER DATABASE [SqlCodeReview] SET ALLOW_SNAPSHOT_ISOLATION OFF
GO
ALTER DATABASE [SqlCodeReview] SET PARAMETERIZATION SIMPLE
GO
ALTER DATABASE [SqlCodeReview] SET READ_COMMITTED_SNAPSHOT OFF
GO
ALTER DATABASE [SqlCodeReview] SET HONOR_BROKER_PRIORITY OFF
GO
ALTER DATABASE [SqlCodeReview] SET RECOVERY FULL
GO
ALTER DATABASE [SqlCodeReview] SET MULTI_USER
GO
ALTER DATABASE [SqlCodeReview] SET PAGE_VERIFY CHECKSUM
GO
ALTER DATABASE [SqlCodeReview] SET DB_CHAINING OFF
GO
ALTER DATABASE [SqlCodeReview] SET FILESTREAM( NON_TRANSACTED_ACCESS = OFF )
GO
ALTER DATABASE [SqlCodeReview] SET TARGET_RECOVERY_TIME = 0 SECONDS
GO
ALTER DATABASE [SqlCodeReview] SET READ_WRITE
GO
|
ALTER TABLE `users` ADD `unsubscribed` TINYINT NOT NULL DEFAULT '0' AFTER `left_menu_open`;
|
<gh_stars>100-1000
# Write your MySQL query statement below
select name,population,area from World where area>3000000 OR population>25000000;
|
<filename>backend/de.metas.fresh/de.metas.fresh.base/src/main/sql/postgresql/system/70-de.metas.fresh/5536520_sys_gh5804_MakeBPName_Identifier_in_BPLocation.sql
-- 2019-11-21T08:58:52.923Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Column SET SeqNo=2,Updated=TO_TIMESTAMP('2019-11-21 10:58:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=2960
;
-- 2019-11-21T08:59:06.791Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Column SET IsIdentifier='Y', SeqNo=1,Updated=TO_TIMESTAMP('2019-11-21 10:59:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=569638
;
-- 2019-11-21T11:10:31.141Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,577370,0,TO_TIMESTAMP('2019-11-21 13:10:30','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','Name of BPartner','Name of BPartner',TO_TIMESTAMP('2019-11-21 13:10:30','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2019-11-21T11:10:31.159Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, CommitWarning,Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName,WEBUI_NameBrowse,WEBUI_NameNew,WEBUI_NameNewBreadcrumb, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Element_ID, t.CommitWarning,t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName,t.WEBUI_NameBrowse,t.WEBUI_NameNew,t.WEBUI_NameNewBreadcrumb, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y' OR l.IsBaseLanguage='Y') AND t.AD_Element_ID=577370 AND NOT EXISTS (SELECT 1 FROM AD_Element_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Element_ID=t.AD_Element_ID)
;
-- 2019-11-21T11:11:58.850Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET IsTranslated='Y', Name='<NAME>', PrintName='<NAME>',Updated=TO_TIMESTAMP('2019-11-21 13:11:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=577370 AND AD_Language='de_CH'
;
-- 2019-11-21T11:11:59.040Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(577370,'de_CH')
;
-- 2019-11-21T11:12:04.703Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET IsTranslated='Y', Name='<NAME>', PrintName='<NAME>',Updated=TO_TIMESTAMP('2019-11-21 13:12:04','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=577370 AND AD_Language='de_DE'
;
-- 2019-11-21T11:12:04.708Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(577370,'de_DE')
;
-- 2019-11-21T11:12:04.728Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_ad_element_on_ad_element_trl_update(577370,'de_DE')
;
-- 2019-11-21T11:12:04.731Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Column SET ColumnName=NULL, Name='<NAME>', Description=NULL, Help=NULL WHERE AD_Element_ID=577370
;
-- 2019-11-21T11:12:04.732Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Para SET ColumnName=NULL, Name='<NAME>', Description=NULL, Help=NULL WHERE AD_Element_ID=577370 AND IsCentrallyMaintained='Y'
;
-- 2019-11-21T11:12:04.733Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET Name='Ab<NAME>', Description=NULL, Help=NULL WHERE (AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=577370) AND AD_Name_ID IS NULL ) OR (AD_Name_ID = 577370)
;
-- 2019-11-21T11:12:04.751Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_PrintFormatItem pi SET PrintName='Abw. Firmenname', Name='Abw. Firmenname' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=pi.AD_Column_ID AND c.AD_Element_ID=577370)
;
-- 2019-11-21T11:12:04.752Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Tab SET Name='Abw. Firmenname', Description=NULL, Help=NULL, CommitWarning = NULL WHERE AD_Element_ID = 577370
;
-- 2019-11-21T11:12:04.754Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_WINDOW SET Name='Abw. Firmenname', Description=NULL, Help=NULL WHERE AD_Element_ID = 577370
;
-- 2019-11-21T11:12:04.755Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Menu SET Name = 'Abw. Firmenname', Description = NULL, WEBUI_NameBrowse = NULL, WEBUI_NameNew = NULL, WEBUI_NameNewBreadcrumb = NULL WHERE AD_Element_ID = 577370
;
-- 2019-11-21T11:12:22.136Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET IsTranslated='Y',Updated=TO_TIMESTAMP('2019-11-21 13:12:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=577370 AND AD_Language='en_US'
;
-- 2019-11-21T11:12:22.140Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(577370,'en_US')
;
-- 2019-11-21T11:13:10.154Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Field SET AD_Name_ID=577370, Description=NULL, Help=NULL, Name='<NAME>',Updated=TO_TIMESTAMP('2019-11-21 13:13:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=591856
;
-- 2019-11-21T11:13:10.157Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_FieldTranslation_From_AD_Name_Element(577370)
;
-- 2019-11-21T11:13:10.186Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
DELETE FROM AD_Element_Link WHERE AD_Field_ID=591856
;
-- 2019-11-21T11:13:10.231Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select AD_Element_Link_Create_Missing_Field(591856)
;
|
create table notification_email_hold (
reply_id integer
constraint notification_email_hold_pk primary key
constraint notif_email_hold_reply_id_fk
references notification_replies(reply_id),
to_addr clob,
headers clob,
body clob
);
|
<reponame>kuldeeppatani/PhpJobportal<gh_stars>0
-- phpMyAdmin SQL Dump
-- version 4.7.0
-- https://www.phpmyadmin.net/
--
-- Host: localhost:3306
-- Generation Time: Jan 06, 2020 at 10:31 AM
-- Server version: 5.6.34-log
-- PHP Version: 7.1.5
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: `jobportal`
--
-- --------------------------------------------------------
--
-- Table structure for table `adminlogin`
--
CREATE TABLE `adminlogin` (
`id` int(10) NOT NULL,
`Email` varchar(60) NOT NULL,
`Password` varchar(40) NOT NULL,
`updatedtime` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `adminlogin`
--
INSERT INTO `adminlogin` (`id`, `Email`, `Password`, `updatedtime`) VALUES
(1, '<EMAIL>', '<PASSWORD>', '2019-12-17 01:48:42.084691');
-- --------------------------------------------------------
--
-- Table structure for table `feedback`
--
CREATE TABLE `feedback` (
`id` int(10) NOT NULL,
`Name` varchar(40) NOT NULL,
`Email` varchar(60) NOT NULL,
`Message` varchar(400) NOT NULL,
`updatedtime` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `feedback`
--
INSERT INTO `feedback` (`id`, `Name`, `Email`, `Message`, `updatedtime`) VALUES
(6, 'Anuradha', '<EMAIL>', 'Curabitur non nulla sit amet nislinit tempus convallis quis ac lectus. lac inia eget consectetur sed, convallis at tellus. Nulla porttitor accumsana tincidunt.Lorem ipsum dolor sit amet consectetur adipisicing elit sedc dnmo eiusmod tempor incididunt ut labore et dolore .', '2019-12-10 06:47:37.257038'),
(7, 'Aman', '<EMAIL>', 'Good morning have a nice day!', '2019-12-16 08:46:47.089133'),
(8, 'sachin', '<EMAIL>', 'hello !', '2019-12-16 08:47:24.138725'),
(9, '<NAME>', '<EMAIL>', 'Hiiiii', '2019-12-16 08:47:41.424240'),
(10, '<NAME>', '<EMAIL>', 'Good afternoon everyone and have a nice day !!', '2019-12-16 08:48:36.333851'),
(11, '<NAME>', '<EMAIL>', 'Good afternoon everyone and have a nice day !!', '2019-12-16 08:48:36.371349');
-- --------------------------------------------------------
--
-- Table structure for table `job`
--
CREATE TABLE `job` (
`id` int(10) NOT NULL,
`userid` int(10) NOT NULL,
`Job Title` varchar(40) NOT NULL,
`Post` varchar(40) NOT NULL,
`Technology` varchar(40) NOT NULL,
`Location` varchar(80) NOT NULL,
`Company` varchar(60) NOT NULL,
`Salary` varchar(90) NOT NULL,
`Address` varchar(160) NOT NULL,
`updatedtime` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
`status` varchar(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `job`
--
INSERT INTO `job` (`id`, `userid`, `Job Title`, `Post`, `Technology`, `Location`, `Company`, `Salary`, `Address`, `updatedtime`, `status`) VALUES
(3, 0, 'kjnbhgvcfxhm', 'Marketing Directer', 'Technology Management Consulting', 'Noida', 'HCL', '10,000 - 20,000', 'dsfghuhkujlnbvbncxdzesrery6uihkm, vbfgtyuhik', '2020-01-03 12:57:28.684144', 'Request'),
(7, 0, 'bhhnhnnnyd', 'Regigonal sales Manager', 'Technology Management Consulting', 'Lucknow', 'MNC', '15,000 - 20,000', 'ngrtkjgntkrgntkgng gjtngrg', '2019-12-17 01:44:18.447568', 'Aproved'),
(8, 0, 'bhhnhnnnyd', 'Web Developer / Designer', 'ASP.NET', 'Noida', 'MNC', '15,000 - 20,000', 'hjjvyhguj m hy bhhuijkm, nvyugiujk', '2019-12-12 06:19:03.108333', 'Request'),
(9, 0, 'knjkvghuih', 'Regigonal sales Manager', 'Company Name goes here', 'Noida', 'MNC', '15,000', 'hjjvyhguj m hy bhhuijkm, nvyugiujk', '2019-12-15 16:57:47.483932', 'Aproved'),
(10, 0, 'kjnbhgvcfxhm', 'Regigonal sales Manager', 'Technology Management Consulting', 'Delhi', 'HCL', '15,000 - 20,000', 'hjjvyhguj m hy bhhuijkm, nvyugiujk', '2020-01-03 13:02:52.562932', 'Request'),
(11, 0, 'knjkvghuih', 'Web Developer / Designer', 'PHP,Wordpress', 'Noida', 'kjhgffgj', '10,000-15,000', 'hjjvyhguj m hy bhhuijkm, nvyugiujk', '2019-12-17 01:21:00.837287', 'Request'),
(12, 0, 'knjkvghuih', 'Digital Marketing', 'ASP.NET', 'Pune', 'HCL', '15,000 - 20,000', 'dsfghuhkujlnbvbncxdzesrery6uihkm, vbfgtyuhik', '2019-12-26 15:55:04.867350', 'Request'),
(13, 0, 'Language Matters Recruitment Consultants', 'French speaking Client Executive', 'Technology Management Consulting', 'Noida', 'gfdfgfhvhkjlm,m ', '12,000-15,000', 'hjjvyhguj m hy bhhuijkm, nvyugiujk', '2020-01-03 13:18:58.884620', 'Pending'),
(14, 0, 'knjkvghuih', 'Web Developer / Designer', 'Technology Management Consulting', 'Delhi', 'kjhgffgj', '15,000 - 20,000', 'ngrtkjgntkrgntkgng gjtngrg', '2020-01-03 13:19:37.357785', 'Pending'),
(15, 0, 'bhhnhnnnyd', 'web developer', 'Php', 'Pune', 'HCL', '12,000', 'hjjvyhguj m hy bhhuijkm, nvyugiujk', '2020-01-03 13:20:01.139411', 'Pending');
-- --------------------------------------------------------
--
-- Table structure for table `registration`
--
CREATE TABLE `registration` (
`id` int(10) NOT NULL,
`createdtime` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
`Name` varchar(50) NOT NULL,
`Email` varchar(60) NOT NULL,
`Password` varchar(40) NOT NULL,
`Contact No` varchar(20) NOT NULL,
`Gender` varchar(10) NOT NULL,
`About Us` varchar(300) NOT NULL,
`Experience` varchar(400) NOT NULL,
`Location` varchar(100) NOT NULL,
`Post` varchar(100) NOT NULL,
`Education` varchar(300) NOT NULL,
`Current Job` varchar(60) NOT NULL,
`File Upload` varchar(500) NOT NULL,
`updatedtime` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000',
`status` varchar(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `registration`
--
INSERT INTO `registration` (`id`, `createdtime`, `Name`, `Email`, `Password`, `Contact No`, `Gender`, `About Us`, `Experience`, `Location`, `Post`, `Education`, `Current Job`, `File Upload`, `updatedtime`, `status`) VALUES
(13, '2019-12-15 16:43:16.356216', '<NAME>', '<EMAIL>', 'shalu3456', '987654323', 'female', 'Curabitur non nulla sit amet nislinit tempus convallis quis ac lectus. lac inia eget consectetur sed, convallis at tellus. Nulla porttitor accumsana tincidunt.Lorem ipsum dolor sit amet consectetur adipisicing elit sedc dnmo eiusmod tempor incididunt ut labore et dolore .Nam arcu mauris, tincidunt s', '6 months', 'Mumbai', 'Web Developer', '2008 - 2012 Curabitur non nulla sit amet nislinit tempus convallis quis ac lectus. lac inia eget consectetur sed, convallis at tellus. Nulla porttitor accumsana tincidunt.Lorem ipsum dolor sit amet consectetur adipisicing elit sedc dnmo eiusmod tempor incididunt ut labore et dolore .Nam arcu mauris', '', 'a4.jpg', '2019-12-09 06:57:42.000000', 'Approved'),
(14, '2019-12-12 09:32:26.629626', 'sachin', '<EMAIL>', 'sk9876', '97867645445', 'male', 'Curabitur non nulla sit amet nislinit tempus convallis quis ac lectus. lac inia eget consectetur sed, convallis at tellus. Nulla porttitor accumsana tincidunt.Lorem ipsum dolor sit amet consectetur adipisicing elit sedc dnmo eiusmod tempor incididunt ut labore et dolore .Nam arcu mauris.', '2 month', 'Mumbai', 'Application Developer', ' B Tech', '', 'a2.jpg', '2019-12-09 20:33:49.000000', 'Approved'),
(15, '2019-12-11 10:53:33.491335', 'Km vinita ', '<EMAIL>', 'vinita', '9336000032', 'female', 'Curabitur non nulla sit amet nislinit tempus convallis quis ac lectus. lac inia eget consectetur sed, convallis at tellus. Nulla porttitor accumsana tincidunt.Lorem ipsum dolor sit amet consectetur adipisicing elit sedc dnmo eiusmod tempor incididunt ut labore et dolore .', '8 months', 'Delhi', 'Web Developer / UI Designer', ' 2008 - 2012 Curabitur non nulla sit amet nislinit tempus convallis quis ac lectus. lac inia eget consectetur sed, convallis at tellus. Nulla porttitor accumsana tincidunt.Lorem ipsum dolor sit amet consectetur adipisicing elit sedc dnmo eiusmod tempor incididunt ut labore ', '', 'a1.jpg', '2019-12-10 06:50:29.000000', 'Approved'),
(16, '2019-12-15 16:35:55.777806', '<NAME>', '<EMAIL>', 'divya12', '9867346516', 'female', 'Cras sapien urna, malesuada ut varius consequat, hendrerit nisl. Aliquam vestibulum, odio non ullamcorper malesuada.\r\nLorem ipsum dolor sit amet consectetur adipisicing elit sedc dnmo eiusmod tempor incididunt ut labore et dolore .Nam arcu mauris, tincidunt sed convallis non, egestas ut lacus. Cras ', '2 Year', 'Noida', 'UX / UI Designer at Company Name', ' Curabitur non nulla sit amet nislinit tempus convallis quis ac lectus. lac inia eget consectetur sed, convallis at tellus. Nulla porttitor accumsana tincidunt.Lorem ipsum dolor sit amet consectetur adipisicing elit sedc dnmo eiusmod tempor incididunt ut labore et dolore .', '', 'pragati.jpg', '2019-12-11 19:29:51.000000', 'Pending');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `adminlogin`
--
ALTER TABLE `adminlogin`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `feedback`
--
ALTER TABLE `feedback`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `job`
--
ALTER TABLE `job`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `registration`
--
ALTER TABLE `registration`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `adminlogin`
--
ALTER TABLE `adminlogin`
MODIFY `id` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `feedback`
--
ALTER TABLE `feedback`
MODIFY `id` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12;
--
-- AUTO_INCREMENT for table `job`
--
ALTER TABLE `job`
MODIFY `id` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=16;
--
-- AUTO_INCREMENT for table `registration`
--
ALTER TABLE `registration`
MODIFY `id` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=17;COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
<gh_stars>1-10
-- SELECT DATE_FORMAT("2009-09-04",' %Y, %m, %d');
-- SELECT * FROM dragonfly_db.aeshnidae01 WHERE Dates BETWEEN '2018-01-01' AND '2020-07-19';
-- SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'dragonfly_db';
-- SELECT MONTH(Dates), COUNT(*) FROM dragonfly_db.aeshnidae01 WHERE Dates BETWEEN '2018-01-01' AND '2020-07-19' GROUP BY MONTH(Dates) ORDER BY MONTH(Dates);
-- SELECT YEAR(Dates), MONTH(Dates), COUNT(*) FROM dragonfly_db.aeshnidae01 WHERE Dates BETWEEN '2018-01-01' AND '2020-07-19' GROUP BY YEAR(Dates), MONTH(Dates) ORDER BY YEAR(Dates), MONTH(Dates);
-- SELECT YEAR(Dates), City, COUNT(*) FROM dragonfly_db.coenagrionidae08 WHERE Dates BETWEEN '2010-01-01' AND '2020-07-19' GROUP BY YEAR(Dates),City
-- SELECT COUNT(*) FROM dragonfly_db.aeshnidae01
SELECT DATE(Dates), ID FROM dragonfly_db.aeshnidae01
|
select test_cal_dt.week_beg_dt, sum(test_kylin_fact.price)
from test_kylin_fact
inner join edw.test_cal_dt as test_cal_dt ON test_kylin_fact.cal_dt = test_cal_dt.cal_dt
group by test_cal_dt.week_beg_dt
|
<gh_stars>0
SELECT
*
FROM
userlogins5.multiblast_fmt_jobs
WHERE
job_digest = ?
AND user_id = ?
|
<gh_stars>10-100
// # Introduction
// This CDS logic is based on the USPSTF guideline: Statin Use for the Primary Prevention of Cardiovascular Disease in
// Adults: Preventive Medication. This CDS only implements the core inclusion and exclusion logic associated with this
// guideline. In the process of authoring the logic, certain assumptions were made and details developed when the guideline
// did not provide enough specificity. These decisions were made in the context of the CDS Connection Cholesterol Workgroup
// and are documented in the logic and/or in the CDS Connect artifact metadata.
//
// This CDS is meant to be used in conjunction with one of the following CQL libraries
// - USPSTF_Statin_Use_for_Primary_Prevention_of_CVD_in_Adults_FHIRv102
// - USPSTF_Statin_Use_for_Primary_Prevention_of_CVD_in_Adults_PatientFacing_FHIRv102
//
// ##Source guideline: [USPSTF Statin Use for the Primary Prevention of Cardiovascular Disease in Adults: Preventive Medication](http://jamanetwork.com/journals/jama/fullarticle/2584058)
library USPSTF_Statin_Use_for_Primary_Prevention_of_CVD_in_Adults_Shared_Logic_FHIRv102 version '1.0.0'
// # Data model #
// The FHIR DSTU2 model is preferred by CDS Connect artifacts due to its current adoption in Health IT products.
using FHIR version '1.0.2'
// # Referenced libraries #
// The FHIRHelpers library provides common functions for simplifying interaction w/ the FHIR v102 data model.
include FHIRHelpers version '1.0.2' called FHIRHelpers
// The CDS Connect Commons for FHIRv102 library provides functions representing commonly used CDS logic and patterns.
include CDS_Connect_Commons_for_FHIRv102 version '1.3.3' called C3F
// The CDS Connect Conversions library provides functions for converting between units.
include CDS_Connect_Conversions version '1.0.2' called Convert
// # Value sets and codes #
// ## Code Systems ##
// Declare what code systems we are using to directly reference individual codes (not part of a value set)
codesystem "LOINC": 'http://loinc.org'
codesystem "SNOMED-CT": 'http://snomed.info/sct/1000124'
codesystem "ICD-10-CM": 'http://hl7.org/fhir/sid/icd-10-cm'
// ## Value sets ##
// List value sets used by the artifact. The links to the Value Set Authority Center (VSAC) point to the latest expansion of each value set available.
// Some concepts use more than one value set. This may happen when there are competing or related value sets for the same concept in VSAC, or
// when a concept can be represented in several vocabulary standards, and no value sets grouping the vocabulary-specific representations are available.
// [See value set in VSAC](https://vsac.nlm.nih.gov/valueset/2.16.840.1.113883.3.464.1003.198.11.1029/expansion)
valueset "LDL Test": '2.16.840.1.113883.3.464.1003.198.11.1029'
valueset "LDL-c": '2.16.840.1.113883.3.117.1.7.1.215'
// [See value set in VSAC](https://vsac.nlm.nih.gov/valueset/2.16.840.1.113883.3.464.1003.103.12.1001/expansion)
valueset "Diabetes": '2.16.840.1.113883.3.464.1003.103.12.1001'
// [See value set in VSAC](https://vsac.nlm.nih.gov/valueset/2.16.840.1.113762.1.4.1032.9/expansion)
valueset "Hypertension": '2.16.840.1.113762.1.4.1032.9'
// [See value set in VSAC](https://vsac.nlm.nih.gov/valueset/2.16.840.1.113883.3.600.2390/expansion)
valueset "Current Tobacco Smoker": '2.16.840.1.113883.3.600.2390'
// [See value set in VSAC](https://vsac.nlm.nih.gov/valueset/2.16.840.1.113883.3.464.1003.104.12.1003/expansion)
valueset "Ischemic Vascular Disease": '2.16.840.1.113883.3.464.1003.104.12.1003'
// [See value set in VSAC](https://vsac.nlm.nih.gov/valueset/2.16.840.1.113883.3.117.1.7.1.204/expansion)
valueset "Carotid Intervention": '2.16.840.1.113883.3.117.1.7.1.204'
// [See value set in VSAC](https://vsac.nlm.nih.gov/valueset/2.16.840.1.113762.1.4.1032.15/expansion)
valueset "Familial Hypercholesterolemia": '2.16.840.1.113762.1.4.1032.15'
// [See value set in VSAC](https://vsac.nlm.nih.gov/valueset/2.16.840.1.113883.3.526.3.378/expansion)
valueset "Pregnancy": '2.16.840.1.113883.3.526.3.378'
valueset "Pregnancy (New ICD10 codes published in 2018 and 2019)": '2.16.840.1.113762.1.4.1032.80'
valueset "Breastfeeding ICD10": '2.16.840.1.113762.1.4.1047.67'
// [See value set in VSAC](https://vsac.nlm.nih.gov/valueset/2.16.840.1.113883.3.526.3.353/expansion)
valueset "End stage renal disease": '2.16.840.1.113883.3.526.3.353'
valueset "ESRD Monthly Outpatient Services": '2.16.840.1.113883.3.464.1003.109.11.1029'
// [See value set in VSAC](https://vsac.nlm.nih.gov/valueset/2.16.840.1.113883.3.464.1003.109.12.1013/expansion)
valueset "Dialysis services": '2.16.840.1.113883.3.464.1003.109.12.1013'
valueset "Dependence on dialysis": '2.16.840.1.113762.1.4.1032.96'
// [See value set in VSAC](https://vsac.nlm.nih.gov/valueset/2.16.840.1.113762.1.4.1032.14/expansion)
valueset "Cirrhosis": '2.16.840.1.113762.1.4.1032.14'
valueset "Rhabdomyolysis": '2.16.840.1.113762.1.4.1032.97'
// [See value set in VSAC](https://vsac.nlm.nih.gov/valueset/2.16.840.1.113762.1.4.1047.107/expansion)
valueset "Low intensity statin therapy": '2.16.840.1.113762.1.4.1047.107'
// [See value set in VSAC](https://vsac.nlm.nih.gov/valueset/2.16.840.1.113762.1.4.1032.16/expansion)
valueset "Low Intensity Statin Therapy Branded": '2.16.840.1.113762.1.4.1032.16'
// [See value set in VSAC](https://vsac.nlm.nih.gov/valueset/2.16.840.1.113762.1.4.1047.98/expansion)
valueset "Moderate intensity statin therapy": '2.16.840.1.113762.1.4.1047.98'
// [See value set in VSAC](https://vsac.nlm.nih.gov/valueset/2.16.840.1.113762.1.4.1032.17/expansion)
valueset "Moderate Intensity Statin Therapy Branded": '2.16.840.1.113762.1.4.1032.17'
// [See value set in VSAC](https://vsac.nlm.nih.gov/valueset/2.16.840.1.113762.1.4.1047.97/expansion)
valueset "High intensity statin therapy": '2.16.840.1.113762.1.4.1047.97'
// [See value set in VSAC](https://vsac.nlm.nih.gov/valueset/2.16.840.1.113762.1.4.1032.18/expansion)
valueset "High Intensity Statin Therapy Branded": '2.16.840.1.113762.1.4.1032.18'
// Using two existing HDL-c value sets. Both value sets contain unique LOINC codes that are appropriate to represent HDL-c.
// [See value set in VSAC](https://vsac.nlm.nih.gov/valueset/2.16.840.1.113883.3.464.1003.104.12.1012/expansion)
valueset "HDL-C Laboratory Test": '2.16.840.1.113883.3.464.1003.104.12.1012'
valueset "High Density Lipoprotein (HDL) LOINC": '2.16.840.1.113883.3.600.873'
// Using two existing myocardial infarction value sets. Both value sets
// contain unique SNOMED-CT and ICD-10-CM codes that appear to be appropriate
// to represent myocardial infarction.
// [See Myocardial Infarction value set in VSAC](https://vsac.nlm.nih.gov/valueset/2.16.840.1.113883.3.526.3.403/expansion)
valueset "Myocardial Infarction": '2.16.840.1.113883.3.526.3.403'
// [See Acute Myocardial Infarction value set in VSAC](https://vsac.nlm.nih.gov/valueset/2.16.840.1.113883.3.464.1003.104.12.1001/expansion)
valueset "Acute Myocardial Infarction": '2.16.840.1.113883.3.464.1003.104.12.1001'
// Using two existing coronary artery bypass graft (CABG) procedure value sets.
// Value sets overlap but use unique terminologies that appear to be appropriate to represent CABG.
// Includes SNOMED-CT, ICD-9-CM and ICD-10-CM codes. [See value set in VSAC](https://vsac.nlm.nih.gov/valueset/2.16.840.1.113883.3.666.5.694/expansion)
valueset "CABG Surgeries": '2.16.840.1.113883.3.666.5.694'
valueset "Coronary Artery Bypass Graft": '2.16.840.1.113883.3.464.1003.104.11.1004'
// Using two existing value sets for PCI. Most recent grouping only includes
// ICD-10-CM and SNOMED-CT codes, but because historical procedures are
// relevant, the ICD-9-CM value set is included as well.
valueset "Percutaneous Coronary Intervention ICD10": '2.16.840.1.113883.3.3157.2000.1'
valueset "Percutaneous Coronary Intervention SNOMEDCT": '2.16.840.1.113883.3.3157.2000.2'
// ## Individual codes ##
// list individual codes from code systems used directly in the CQL logic. Individual codes are used when there is
// a single code from a particular vocabulary standard used to represent a clinical concept. It is considered best-practice
// not to create value sets containing a single code.
// Using the smoking status code defined in the DAF Smoking Status profile
// <http://hl7.org/fhir/us/daf/2016Sep/daf-core-smokingstatus.html>
code "Tobacco smoking status code": '72166-2' from "LOINC" display 'Tobacco smoking status'
// Using the LOINC Code for the ACC/AHA cardiovascular pooled cohort risk calculator
code "CVD 10-year risk code": '79423-0' from "LOINC"
display 'Cardiovascular disease 10Y risk [Likelihood] ACC-AHA Pooled Cohort by Goff 2013'
// Using the LOINC code for pregnancy status observable
code "Pregnancy status code": '82810-3' from "LOINC" display 'Pregnancy status'
// Using SNOMED-CT code for pregnancy observation ("answer to pregnancy status observable")
code "Pregnant code": '77386006' from "SNOMED-CT" display 'Patient currently pregnant (finding)'
// Using LOINC code for breastfeeding observable
code "Breastfeeding status code": '63895-7' from "LOINC" display 'Breastfeeding status'
code "Currently breastfeeding code": '169750002' from "SNOMED-CT" display 'Mother currently breast-feeding (finding)'
code "Dependence on renal dialysis code": 'Z99.2' from "ICD-10-CM" display 'Dependence on renal dialysis'
// Using ICD-10 code for familial hypercholesterolemia. Not included in a value set since best practice
// is to avoid single-code value sets.
code "Familial hypercholesterolemia code": 'E78.01' from "ICD-10-CM" display 'Familial hypercholesterolemia'
code "Rhabdomyolysis code": 'M62.82' from "ICD-10-CM" display 'Rhabdomyolysis'
// CQL currently requires concept declarations to contain references to code declarations.
concept "Tobacco smoking status": { "Tobacco smoking status code" } display 'Tobacco smoking status'
concept "CVD 10-year risk": { "CVD 10-year risk code" }
display 'Cardiovascular disease 10Y risk [Likelihood] ACC-AHA Pooled Cohort by Goff 2013'
concept "Dependence on renal dialysis": { "Dependence on renal dialysis code" } display 'Dependence on renal dialysis'
concept "Pregnancy status": { "Pregnancy status code" } display 'Pregnancy status'
concept "Pregnant": { "Pregnant code" } display 'Patient currently pregnant (finding)'
concept "Breastfeeding status": { "Breastfeeding status code" } display 'Breastfeeding status'
concept "Currently breastfeeding": { "Currently breastfeeding code" } display 'Mother currently breast-feeding (finding)'
concept "Familial hypercholesterolemia concept": { "Familial hypercholesterolemia code" } display 'Familial hypercholesterolemia'
concept "Rhabdomyolysis concept": { "Rhabdomyolysis code" } display 'Rhabdomyolysis'
// # CDS logic #
context Patient
// ## Target population ##
// Determines if patient's age, in years, at the time CQL is run, is within the limits defined by the USPSTF
// recommendation (40 years - 75 years inclusive). **NOTE**: The CQL 'between' operator is inclusive.
define InDemographic:
AgeInYears() between 40 and 75
// The most recent verified (final or amended) LDL test.
define MostRecentLDLTest:
C3F.MostRecent(C3F.Verified(
[Observation: "LDL Test"] union
[Observation: "LDL-c"]))
// The most recent verified (final or amended) LDL test that is no more than six years old.
// Evaluation of CVD risk is recommended every 4-6 years, along with the data requirements
// to calculate risk (i.e., lab values and smoking status). Results older than 6 years may
// not accurately reflect the patient's current condition.
define MostRecentValidLDLTest:
C3F.MostRecent(C3F.Verified(C3F.ObservationLookBack(
[Observation: "LDL Test"] union
[Observation: "LDL-c"], 6 years)))
// The most recent verified LDL result, converted to mg/dL (if necessary), and no older than 6 years.
define MostRecentValidLDLResult:
Convert.to_mg_per_dL_for_blood_cholesterol(C3F.QuantityValue(MostRecentValidLDLTest))
define HDLTests:
[Observation: "HDL-C Laboratory Test"] union
[Observation: "High Density Lipoprotein (HDL) LOINC"]
// The most recent verified (final or amended) HDL test
define MostRecentHDLTest:
C3F.MostRecent(C3F.Verified(HDLTests))
// The most recent verified (final or amended) HDL test that is no more than six years old.
// Evaluation of CVD risk is recommended every 4-6 years, along with the data requirements
// to calculate risk (i.e., lab values and smoking status). Results older than 6 years may
// not accurately reflect the patient's current condition
define MostRecentValidHDLTest:
C3F.MostRecent(C3F.Verified(C3F.ObservationLookBack(HDLTests, 6 years)))
// The most recent verified HDL result, converted to mg/dL (if necessary), and no older than 6 years.
define MostRecentValidHDLResult:
Convert.to_mg_per_dL_for_blood_cholesterol(C3F.QuantityValue(MostRecentValidHDLTest))
// Determines if patient has a confirmed and active diagnosis of diabetes. Only confirmed and active diagnoses are
// used based on the Cholesterol Workgroup feedback from the May 2017 meeting.
define HasDiabetes:
Exists(C3F.Confirmed(C3F.ActiveCondition([Condition: "Diabetes"])))
// Determines if patient has a confirmed and active diagnosis of hypertension. Only confirmed and active diagnoses are
// used based on the Cholesterol Workgroup feedback from the May 2017 meeting.
define HasHypertension:
Exists(C3F.Confirmed(C3F.ActiveCondition([Condition: "Hypertension"])))
// The most recent verified (final or amended) smoking status based on the DAF Smoking Status profile.
// @see <http://hl7.org/fhir/us/daf/2016Sep/daf-core-smokingstatus.html>
define MostRecentSmokingStatus:
C3F.ConceptValue(C3F.MostRecent(C3F.Verified(C3F.ObservationsByConcept("Tobacco smoking status"))))
// The most recent verified (final or amended) smoking status based on the DAF Smoking Status profile and no more than
// six years old. Evaluation of CVD risk is recommended every 4-6 years, along with the data requirements to calculate
// risk (i.e., lab values and smoking status). Results older than 6 years may not accurately reflect the patient's current condition.
// @see <http://hl7.org/fhir/us/daf/2016Sep/daf-core-smokingstatus.html>
define MostRecentValidSmokingStatus:
C3F.ConceptValue(C3F.MostRecent(C3F.Verified(C3F.ObservationLookBack(C3F.ObservationsByConcept("Tobacco smoking status"), 6 years))))
// Determines if last documented smoking status pointed to patient being a smoker.
// NOTE: Updated in version 1.0.1 to specifically return null when the code is null since the CQL 1.2 Errata 2 (2018APR)
// changed InValueSet to return false when the code is null (previously the spec indicated to return null in this case).
define IsSmoker:
if MostRecentValidSmokingStatus is null then null
else MostRecentValidSmokingStatus in "Current Tobacco Smoker"
// The most recent verified (final or amended) ACC/AHA CVD Risk Assessment. Note that although FHIR DSTU2 has a
// RiskAssessment resource, we've chosen to use Observation. This is because RiskAssessment is at maturity level 0
// in FHIR DSTU2 and is not known to be used by any vendors. On the other hand, Observation is at maturity level 3
// and is supported by many vendors. In addition, it is reasonable to expect a risk assessment to be modeled as an
// Observation.
define MostRecentCVDRiskAssessment:
C3F.MostRecent(C3F.Verified(C3F.ObservationsByConcept("CVD 10-year risk")))
// The most recent verified (final or amended) ACC/AHA CVD Risk Assessment no older than 6 years old.
// Evaluation of CVD risk is recommended every 4-6 years, along with the data requirements to calculate
// risk (i.e., lab values and smoking status). Results older than 6 years may not accurately reflect
// the patient's current condition.
define MostRecentValidCVDRiskAssessment:
C3F.MostRecent(C3F.Verified(C3F.ObservationLookBack(C3F.ObservationsByConcept("CVD 10-year risk"), 6 years)))
// The most recent verified ACC/AHA CVD Risk Assessment result no older than 6 years old.
define MostRecentValidCVDRiskAssessmentResult:
C3F.QuantityValue(MostRecentValidCVDRiskAssessment)
// Determines if patient has a confirmed and active cardiovascular disease diagnosis. Only confirmed diagnoses are
// used, but any status (active, relapse, remission, resolved) applies.
define HasCVD:
Exists(C3F.Confirmed([Condition: "Myocardial Infarction"]))
or Exists(C3F.Confirmed([Condition: "Acute Myocardial Infarction"]))
or Exists(C3F.Confirmed([Condition: "Ischemic Vascular Disease"]))
// Determines if the patient has had a completed CVD-related procedure, implying that the patient has a
// cardiovascular disease. Can be used as a proxy for CVD diagnosis.
define HasHadCVDProcedures:
Exists(C3F.Completed([Procedure: "CABG Surgeries"]))
or Exists(C3F.Completed([Procedure: "Coronary Artery Bypass Graft"]))
or Exists(C3F.Completed([Procedure: "Percutaneous Coronary Intervention ICD10"]))
or Exists(C3F.Completed([Procedure: "Percutaneous Coronary Intervention SNOMEDCT"]))
or Exists(C3F.Completed([Procedure: "Carotid Intervention"]))
// Determines if patient has a confirmed and active diagnosis of `hypercholesterolemia`. Only confirmed and active
// diagnoses are used based on the Cholesterol Workgroup feedback from the May 2017 meeting.
define HasFamilialHypercholesterolemia:
Exists(C3F.Confirmed(C3F.ActiveCondition([Condition: "Familial Hypercholesterolemia"])))
or Exists(C3F.Confirmed(C3F.ActiveCondition(C3F.ConditionsByConcept("Familial hypercholesterolemia concept"))))
// The most recent verified (final or amended) pregnancy status, modeled as an
// observation. A pregnancy status indicative of pregnancy but older than 42
// weeks is most likely outdated and will not be considered in the CDS artifact.
define MostRecentPregnancyObservation:
C3F.MostRecent(C3F.Verified(C3F.ObservationLookBack(C3F.ObservationsByConcept("Pregnancy status"), 42 weeks)))
// Determines if the patient is currently pregnant.
define IsPregnant:
// Determines if a confirmed diagnosis indicative of pregnancy exists
Exists(C3F.Confirmed(C3F.ActiveCondition(
[Condition: "Pregnancy"] union
[Condition: "Pregnancy (New ICD10 codes published in 2018 and 2019)"])))
// Determines if the most recent pregnancy status observation indicates the patient is pregnant.
or C3F.ConceptValue(MostRecentPregnancyObservation) ~ "Pregnant"
// The most recent verified (final or amended) breastfeeding observation. A breastfeeding
// observation older than 1 year is most likely outdated and will not be considered in the
// CDS artifact.
define MostRecentBreastfeedingObservation:
C3F.MostRecent(C3F.Verified(C3F.ObservationLookBack(C3F.ObservationsByConcept("Breastfeeding status"), 1 year)))
// Determines if the patient is currently breastfeeding.
define IsBreastfeeding:
// Determines if the patient has a current Condition indicating breastfeeding.
Exists(C3F.Confirmed(C3F.ActiveCondition([Condition: "Breastfeeding ICD10"])))
// Determines if the most recent breastfeeding observation indicates the patient is breastfeeding.
or C3F.ConceptValue(MostRecentBreastfeedingObservation) ~ "Currently breastfeeding"
// Determines if patient has a confirmed and active diagnosis of end stage renal disease. Only confirmed and active
// diagnoses are used based on the Cholesterol Workgroup feedback from the May 2017 meeting.
define HasEndStageRenalDisease:
Exists(C3F.Confirmed(C3F.ActiveCondition([Condition: "End stage renal disease"])))
define RecentEndStageRenalDiseaseEncounter:
(C3F.EncounterLookBack([Encounter], 1 month)) E
where exists(
E.reason R where
C3F.NullSafeToConcept(R) in "ESRD Monthly Outpatient Services"
)
and E.status.value in List{'in-progress','finished'}
define HasHadRecentEndStageRenalDiseaseEncounter:
Exists(RecentEndStageRenalDiseaseEncounter)
// Determines if the patient has undergone dialysis in the past week. Since dialysis typically occurs 2-3 times
// a week, we do not consider the edge case of in-progress dialysis, as one of the previous dialysis rounds should
// still be captured.
define OnDialysis:
Exists(
(C3F.ProcedureLookBack([Procedure: "Dialysis services"], 1 week)) P
where P.status.value in List{'in-progress', 'completed'}
)
define DependentUponDialysisConditions:
C3F.Confirmed(C3F.ActiveOrRecurring(
[Condition: "Dependence on dialysis"] union
[Condition: "Dependence on renal dialysis"]
))
define DependentUponDialysis:
Exists(DependentUponDialysisConditions)
define RhabdomyolysisConditions:
C3F.Confirmed(C3F.ActiveOrRecurring(
[Condition: "Rhabdomyolysis"] union
[Condition: "Rhabdomyolysis concept"]
))
define HasRhabdomyolysis:
Exists(RhabdomyolysisConditions)
// Determines if patient has a confirmed and active diagnosis of cirrhosis. Only confirmed and active
// diagnoses are used based on the Cholesterol Workgroup feedback from the May 2017 meeting.
define HasCirrhosis:
Exists(C3F.Confirmed(C3F.ActiveOrRecurring([Condition: "Cirrhosis"])))
// Determines if the patient is currently on an active statin medication -- by looking at medication statements
// (medications the patient indicates they're on), medication prescriptions, and dispensed medications. Indication
// of any of the three within the past two years is considered sufficient evidence that the patient is taking a statin.
define StatinMedicationStatements:
(C3F.MedicationStatementLookBack(
[MedicationStatement: "Low intensity statin therapy"] union
[MedicationStatement: "Low Intensity Statin Therapy Branded"] union
[MedicationStatement: "Moderate intensity statin therapy"] union
[MedicationStatement: "Moderate Intensity Statin Therapy Branded"] union
[MedicationStatement: "High intensity statin therapy"] union
[MedicationStatement: "High Intensity Statin Therapy Branded"]
, 2 years)) M
where M.status.value in List{'active'}
define StatinMedicationOrders:
(C3F.MedicationOrderLookBack(
[MedicationOrder: "Low intensity statin therapy"] union
[MedicationOrder: "Low Intensity Statin Therapy Branded"] union
[MedicationOrder: "Moderate intensity statin therapy"] union
[MedicationOrder: "Moderate Intensity Statin Therapy Branded"] union
[MedicationOrder: "High intensity statin therapy"] union
[MedicationOrder: "High Intensity Statin Therapy Branded"]
, 2 years)) M
where M.status.value in List{'active','completed'}
define StatinMedicationDispensed:
(C3F.MedicationDispenseLookBack(
[MedicationDispense: "Low intensity statin therapy"] union
[MedicationDispense: "Low Intensity Statin Therapy Branded"] union
[MedicationDispense: "Moderate intensity statin therapy"] union
[MedicationDispense: "Moderate Intensity Statin Therapy Branded"] union
[MedicationDispense: "High intensity statin therapy"] union
[MedicationDispense: "High Intensity Statin Therapy Branded"]
, 2 years)) M
where M.status.value in List{'in-progress','completed'}
define OnStatinTherapy:
Exists(StatinMedicationStatements) or
Exists(StatinMedicationOrders) or
Exists(StatinMedicationDispensed)
// Determines if any of the data elements that are expected to be present are not present or are too old (more than 6
// years old, per the CDS Connect Cholesterol Workgroup). Usually this would be used to encourage the provider to
// take the necessary actions to fill in missing or old data.
define HasMissingOrOldData:
MostRecentValidLDLResult is null
or MostRecentValidHDLResult is null
or MostRecentValidCVDRiskAssessmentResult is null
or IsSmoker is null
// Determines if patient has one or more of the 4 risk factors defined by the USPSTF.
define HasCVDRiskFactors:
MostRecentValidLDLResult > 130 'mg/dL'
or MostRecentValidHDLResult < 40 'mg/dL'
or HasDiabetes
or HasHypertension
or IsSmoker
// Determines if the patient meets the excusion criteria for the CDS. If so, this CDS cannot supply a recommendation
// for the patient.
define MeetsExclusionCriteria:
// Patients who have a CVD diagnosis are not
// are not considered to be in the target population for the USPSTF statin
// recommendations, since they are not eligible for primary prevention of CVD.
HasCVD
// Patients who have had procedures to treat CVD, implying that the patients
// have a CVD diagnosis, are not considered to be in the target population for
// the USPSTF statin recommendations, since they are not eligible for primary
//prevention of CVD.
or HasHadCVDProcedures
// Patients with very elevated LDL results are not considered to be in the
// target population for the USPSTF statin recommendation. These patients are at
// elevated CVD risk and may require statin use outside of current USPSTF
// recommendations.
or MostRecentValidLDLResult > 190 'mg/dL'
// Patients with familial hypercholesterolemia are at *elevated* CVD risk and may
// require statin use outside of current USPSTF recommendations, which target patients
// with at *moderate* risk for CVD.
or HasFamilialHypercholesterolemia
// Statins are contraindicated for pregnant patients.
or IsPregnant
// Statins are contraindicated for patients who are breastfeeding.
or IsBreastfeeding
// Statins are contraindicated for patients who have end stage renal disease.
or HasEndStageRenalDisease
or HasHadRecentEndStageRenalDiseaseEncounter
// Statins are contraindicated for patients on dialysis (which implies end stage
// renal disease).
or OnDialysis
or DependentUponDialysis
// Statins are contraindicated for patients with cirrhosis.
or HasCirrhosis
// A recommendation for a statin should be ommitted if a patient is already on
// a statin medication.
or OnStatinTherapy
or HasRhabdomyolysis
|
START TRANSACTION;
ALTER TABLE ${myuniversity}_${mymodule}.item DISABLE TRIGGER USER;
UPDATE ${myuniversity}_${mymodule}.item AS it
SET jsonb = JSONB_SET(
it.jsonb,
'{effectiveCallNumberComponents}',
jsonb_build_object(
'callNumber', COALESCE(it.jsonb->'itemLevelCallNumber', hr.jsonb->'callNumber'),
'prefix', COALESCE(it.jsonb->'itemLevelCallNumberPrefix', hr.jsonb->'callNumberPrefix'),
'suffix', COALESCE(it.jsonb->'itemLevelCallNumberSuffix', hr.jsonb->'callNumberSuffix'),
'typeId', COALESCE(it.jsonb->'itemLevelCallNumberTypeId', hr.jsonb->'callNumberTypeId')
)
)
FROM ${myuniversity}_${mymodule}.holdings_record AS hr
WHERE hr.id = it.holdingsrecordid;
ALTER TABLE ${myuniversity}_${mymodule}.item ENABLE TRIGGER USER;
END TRANSACTION;
|
<filename>samples/Scheduler/SchedulerService/quartzTables.sql
IF NOT EXISTS ( SELECT * FROM sys.schemas WHERE name = N'Scheduler' )
EXEC('CREATE SCHEMA [Scheduler] AUTHORIZATION [dbo]');
IF NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[Scheduler].[CALENDARS]') AND OBJECTPROPERTY(id, N'ISUSERTABLE') = 1)
OR NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[Scheduler].[CRON_TRIGGERS]') AND OBJECTPROPERTY(id, N'ISUSERTABLE') = 1)
OR NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[Scheduler].[BLOB_TRIGGERS]') AND OBJECTPROPERTY(id, N'ISUSERTABLE') = 1)
OR NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[Scheduler].[FIRED_TRIGGERS]') AND OBJECTPROPERTY(id, N'ISUSERTABLE') = 1)
OR NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[Scheduler].[PAUSED_TRIGGER_GRPS]') AND OBJECTPROPERTY(id, N'ISUSERTABLE') = 1)
OR NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[Scheduler].[SCHEDULER_STATE]') AND OBJECTPROPERTY(id, N'ISUSERTABLE') = 1)
OR NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[Scheduler].[LOCKS]') AND OBJECTPROPERTY(id, N'ISUSERTABLE') = 1)
OR NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[Scheduler].[JOB_DETAILS]') AND OBJECTPROPERTY(id, N'ISUSERTABLE') = 1)
OR NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[Scheduler].[SIMPLE_TRIGGERS]') AND OBJECTPROPERTY(id, N'ISUSERTABLE') = 1)
OR NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[Scheduler].[SIMPROP_TRIGGERS]') AND OBJECTPROPERTY(id, N'ISUSERTABLE') = 1)
OR NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[Scheduler].[TRIGGERS]') AND OBJECTPROPERTY(id, N'ISUSERTABLE') = 1)
BEGIN
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[Scheduler].[FK_TRIGGERS_JOB_DETAILS]') AND OBJECTPROPERTY(id, N'ISFOREIGNKEY') = 1)
ALTER TABLE [Scheduler].[TRIGGERS] DROP CONSTRAINT FK_TRIGGERS_JOB_DETAILS
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[Scheduler].[FK_CRON_TRIGGERS_TRIGGERS]') AND OBJECTPROPERTY(id, N'ISFOREIGNKEY') = 1)
ALTER TABLE [Scheduler].[CRON_TRIGGERS] DROP CONSTRAINT FK_CRON_TRIGGERS_TRIGGERS
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[Scheduler].[FK_SIMPLE_TRIGGERS_TRIGGERS]') AND OBJECTPROPERTY(id, N'ISFOREIGNKEY') = 1)
ALTER TABLE [Scheduler].[SIMPLE_TRIGGERS] DROP CONSTRAINT FK_SIMPLE_TRIGGERS_TRIGGERS
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[Scheduler].[FK_SIMPROP_TRIGGERS_TRIGGERS]') AND OBJECTPROPERTY(id, N'ISFOREIGNKEY') = 1)
ALTER TABLE [Scheduler].[SIMPROP_TRIGGERS] DROP CONSTRAINT FK_SIMPROP_TRIGGERS_TRIGGERS
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[Scheduler].[CALENDARS]') AND OBJECTPROPERTY(id, N'ISUSERTABLE') = 1)
DROP TABLE [Scheduler].[CALENDARS]
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[Scheduler].[CRON_TRIGGERS]') AND OBJECTPROPERTY(id, N'ISUSERTABLE') = 1)
DROP TABLE [Scheduler].[CRON_TRIGGERS]
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[Scheduler].[BLOB_TRIGGERS]') AND OBJECTPROPERTY(id, N'ISUSERTABLE') = 1)
DROP TABLE [Scheduler].[BLOB_TRIGGERS]
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[Scheduler].[FIRED_TRIGGERS]') AND OBJECTPROPERTY(id, N'ISUSERTABLE') = 1)
DROP TABLE [Scheduler].[FIRED_TRIGGERS]
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[Scheduler].[PAUSED_TRIGGER_GRPS]') AND OBJECTPROPERTY(id, N'ISUSERTABLE') = 1)
DROP TABLE [Scheduler].[PAUSED_TRIGGER_GRPS]
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[Scheduler].[SCHEDULER_STATE]') AND OBJECTPROPERTY(id, N'ISUSERTABLE') = 1)
DROP TABLE [Scheduler].[SCHEDULER_STATE]
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[Scheduler].[LOCKS]') AND OBJECTPROPERTY(id, N'ISUSERTABLE') = 1)
DROP TABLE [Scheduler].[LOCKS]
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[Scheduler].[JOB_DETAILS]') AND OBJECTPROPERTY(id, N'ISUSERTABLE') = 1)
DROP TABLE [Scheduler].[JOB_DETAILS]
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[Scheduler].[SIMPLE_TRIGGERS]') AND OBJECTPROPERTY(id, N'ISUSERTABLE') = 1)
DROP TABLE [Scheduler].[SIMPLE_TRIGGERS]
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[Scheduler].[SIMPROP_TRIGGERS]') AND OBJECTPROPERTY(id, N'ISUSERTABLE') = 1)
DROP TABLE [Scheduler].SIMPROP_TRIGGERS
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[Scheduler].[TRIGGERS]') AND OBJECTPROPERTY(id, N'ISUSERTABLE') = 1)
DROP TABLE [Scheduler].[TRIGGERS]
CREATE TABLE [Scheduler].[CALENDARS] (
[SCHED_NAME] [NVARCHAR] (100) NOT NULL ,
[CALENDAR_NAME] [NVARCHAR] (200) NOT NULL ,
[CALENDAR] [IMAGE] NOT NULL
)
CREATE TABLE [Scheduler].[CRON_TRIGGERS] (
[SCHED_NAME] [NVARCHAR] (100) NOT NULL ,
[TRIGGER_NAME] [NVARCHAR] (150) NOT NULL ,
[TRIGGER_GROUP] [NVARCHAR] (150) NOT NULL ,
[CRON_EXPRESSION] [NVARCHAR] (120) NOT NULL ,
[TIME_ZONE_ID] [NVARCHAR] (80)
)
CREATE TABLE [Scheduler].[FIRED_TRIGGERS] (
[SCHED_NAME] [NVARCHAR] (100) NOT NULL ,
[ENTRY_ID] [NVARCHAR] (95) NOT NULL ,
[TRIGGER_NAME] [NVARCHAR] (150) NOT NULL ,
[TRIGGER_GROUP] [NVARCHAR] (150) NOT NULL ,
[INSTANCE_NAME] [NVARCHAR] (200) NOT NULL ,
[FIRED_TIME] [BIGINT] NOT NULL ,
[SCHED_TIME] [BIGINT] NOT NULL ,
[PRIORITY] [INTEGER] NOT NULL ,
[STATE] [NVARCHAR] (16) NOT NULL,
[JOB_NAME] [NVARCHAR] (150) NULL ,
[JOB_GROUP] [NVARCHAR] (150) NULL ,
[IS_NONCONCURRENT] BIT NULL ,
[REQUESTS_RECOVERY] BIT NULL
)
CREATE TABLE [Scheduler].[PAUSED_TRIGGER_GRPS] (
[SCHED_NAME] [NVARCHAR] (100) NOT NULL ,
[TRIGGER_GROUP] [NVARCHAR] (150) NOT NULL
)
CREATE TABLE [Scheduler].[SCHEDULER_STATE] (
[SCHED_NAME] [NVARCHAR] (100) NOT NULL ,
[INSTANCE_NAME] [NVARCHAR] (200) NOT NULL ,
[LAST_CHECKIN_TIME] [BIGINT] NOT NULL ,
[CHECKIN_INTERVAL] [BIGINT] NOT NULL
)
CREATE TABLE [Scheduler].[LOCKS] (
[SCHED_NAME] [NVARCHAR] (100) NOT NULL ,
[LOCK_NAME] [NVARCHAR] (40) NOT NULL
)
CREATE TABLE [Scheduler].[JOB_DETAILS] (
[SCHED_NAME] [NVARCHAR] (100) NOT NULL ,
[JOB_NAME] [NVARCHAR] (150) NOT NULL ,
[JOB_GROUP] [NVARCHAR] (150) NOT NULL ,
[DESCRIPTION] [NVARCHAR] (250) NULL ,
[JOB_CLASS_NAME] [NVARCHAR] (250) NOT NULL ,
[IS_DURABLE] BIT NOT NULL ,
[IS_NONCONCURRENT] BIT NOT NULL ,
[IS_UPDATE_DATA] BIT NOT NULL ,
[REQUESTS_RECOVERY] BIT NOT NULL ,
[JOB_DATA] [IMAGE] NULL
)
CREATE TABLE [Scheduler].[SIMPLE_TRIGGERS] (
[SCHED_NAME] [NVARCHAR] (100) NOT NULL ,
[TRIGGER_NAME] [NVARCHAR] (150) NOT NULL ,
[TRIGGER_GROUP] [NVARCHAR] (150) NOT NULL ,
[REPEAT_COUNT] [INTEGER] NOT NULL ,
[REPEAT_INTERVAL] [BIGINT] NOT NULL ,
[TIMES_TRIGGERED] [INTEGER] NOT NULL
)
CREATE TABLE [Scheduler].[SIMPROP_TRIGGERS] (
[SCHED_NAME] [NVARCHAR] (100) NOT NULL ,
[TRIGGER_NAME] [NVARCHAR] (150) NOT NULL ,
[TRIGGER_GROUP] [NVARCHAR] (150) NOT NULL ,
[STR_PROP_1] [NVARCHAR] (512) NULL,
[STR_PROP_2] [NVARCHAR] (512) NULL,
[STR_PROP_3] [NVARCHAR] (512) NULL,
[INT_PROP_1] [INT] NULL,
[INT_PROP_2] [INT] NULL,
[LONG_PROP_1] [BIGINT] NULL,
[LONG_PROP_2] [BIGINT] NULL,
[DEC_PROP_1] [NUMERIC] (13,4) NULL,
[DEC_PROP_2] [NUMERIC] (13,4) NULL,
[BOOL_PROP_1] BIT NULL,
[BOOL_PROP_2] BIT NULL,
)
CREATE TABLE [Scheduler].[BLOB_TRIGGERS] (
[SCHED_NAME] [NVARCHAR] (100) NOT NULL ,
[TRIGGER_NAME] [NVARCHAR] (150) NOT NULL ,
[TRIGGER_GROUP] [NVARCHAR] (150) NOT NULL ,
[BLOB_DATA] [IMAGE] NULL
)
CREATE TABLE [Scheduler].[TRIGGERS] (
[SCHED_NAME] [NVARCHAR] (100) NOT NULL ,
[TRIGGER_NAME] [NVARCHAR] (150) NOT NULL ,
[TRIGGER_GROUP] [NVARCHAR] (150) NOT NULL ,
[JOB_NAME] [NVARCHAR] (150) NOT NULL ,
[JOB_GROUP] [NVARCHAR] (150) NOT NULL ,
[DESCRIPTION] [NVARCHAR] (250) NULL ,
[NEXT_FIRE_TIME] [BIGINT] NULL ,
[PREV_FIRE_TIME] [BIGINT] NULL ,
[PRIORITY] [INTEGER] NULL ,
[TRIGGER_STATE] [NVARCHAR] (16) NOT NULL ,
[TRIGGER_TYPE] [NVARCHAR] (8) NOT NULL ,
[START_TIME] [BIGINT] NOT NULL ,
[END_TIME] [BIGINT] NULL ,
[CALENDAR_NAME] [NVARCHAR] (200) NULL ,
[MISFIRE_INSTR] [INTEGER] NULL ,
[JOB_DATA] [IMAGE] NULL
)
ALTER TABLE [Scheduler].[CALENDARS] WITH NOCHECK ADD
CONSTRAINT [PK_CALENDARS] PRIMARY KEY CLUSTERED
(
[SCHED_NAME],
[CALENDAR_NAME]
)
ALTER TABLE [Scheduler].[CRON_TRIGGERS] WITH NOCHECK ADD
CONSTRAINT [PK_CRON_TRIGGERS] PRIMARY KEY CLUSTERED
(
[SCHED_NAME],
[TRIGGER_NAME],
[TRIGGER_GROUP]
)
ALTER TABLE [Scheduler].[FIRED_TRIGGERS] WITH NOCHECK ADD
CONSTRAINT [PK_FIRED_TRIGGERS] PRIMARY KEY CLUSTERED
(
[SCHED_NAME],
[ENTRY_ID]
)
ALTER TABLE [Scheduler].[PAUSED_TRIGGER_GRPS] WITH NOCHECK ADD
CONSTRAINT [PK_PAUSED_TRIGGER_GRPS] PRIMARY KEY CLUSTERED
(
[SCHED_NAME],
[TRIGGER_GROUP]
)
ALTER TABLE [Scheduler].[SCHEDULER_STATE] WITH NOCHECK ADD
CONSTRAINT [PK_SCHEDULER_STATE] PRIMARY KEY CLUSTERED
(
[SCHED_NAME],
[INSTANCE_NAME]
)
ALTER TABLE [Scheduler].[LOCKS] WITH NOCHECK ADD
CONSTRAINT [PK_LOCKS] PRIMARY KEY CLUSTERED
(
[SCHED_NAME],
[LOCK_NAME]
)
ALTER TABLE [Scheduler].[JOB_DETAILS] WITH NOCHECK ADD
CONSTRAINT [PK_JOB_DETAILS] PRIMARY KEY CLUSTERED
(
[SCHED_NAME],
[JOB_NAME],
[JOB_GROUP]
)
ALTER TABLE [Scheduler].[SIMPLE_TRIGGERS] WITH NOCHECK ADD
CONSTRAINT [PK_SIMPLE_TRIGGERS] PRIMARY KEY CLUSTERED
(
[SCHED_NAME],
[TRIGGER_NAME],
[TRIGGER_GROUP]
)
ALTER TABLE [Scheduler].[SIMPROP_TRIGGERS] WITH NOCHECK ADD
CONSTRAINT [PK_SIMPROP_TRIGGERS] PRIMARY KEY CLUSTERED
(
[SCHED_NAME],
[TRIGGER_NAME],
[TRIGGER_GROUP]
)
ALTER TABLE [Scheduler].[TRIGGERS] WITH NOCHECK ADD
CONSTRAINT [PK_TRIGGERS] PRIMARY KEY CLUSTERED
(
[SCHED_NAME],
[TRIGGER_NAME],
[TRIGGER_GROUP]
)
ALTER TABLE [Scheduler].BLOB_TRIGGERS WITH NOCHECK ADD
CONSTRAINT [PK_BLOB_TRIGGERS] PRIMARY KEY CLUSTERED
(
[SCHED_NAME],
[TRIGGER_NAME],
[TRIGGER_GROUP]
)
ALTER TABLE [Scheduler].[CRON_TRIGGERS] ADD
CONSTRAINT [FK_CRON_TRIGGERS_TRIGGERS] FOREIGN KEY
(
[SCHED_NAME],
[TRIGGER_NAME],
[TRIGGER_GROUP]
) REFERENCES [Scheduler].[TRIGGERS] (
[SCHED_NAME],
[TRIGGER_NAME],
[TRIGGER_GROUP]
) ON DELETE CASCADE
ALTER TABLE [Scheduler].[SIMPLE_TRIGGERS] ADD
CONSTRAINT [FK_SIMPLE_TRIGGERS_TRIGGERS] FOREIGN KEY
(
[SCHED_NAME],
[TRIGGER_NAME],
[TRIGGER_GROUP]
) REFERENCES [Scheduler].[TRIGGERS] (
[SCHED_NAME],
[TRIGGER_NAME],
[TRIGGER_GROUP]
) ON DELETE CASCADE
ALTER TABLE [Scheduler].[SIMPROP_TRIGGERS] ADD
CONSTRAINT [FK_SIMPROP_TRIGGERS_TRIGGERS] FOREIGN KEY
(
[SCHED_NAME],
[TRIGGER_NAME],
[TRIGGER_GROUP]
) REFERENCES [Scheduler].[TRIGGERS] (
[SCHED_NAME],
[TRIGGER_NAME],
[TRIGGER_GROUP]
) ON DELETE CASCADE
ALTER TABLE [Scheduler].[TRIGGERS] ADD
CONSTRAINT [FK_TRIGGERS_JOB_DETAILS] FOREIGN KEY
(
[SCHED_NAME],
[JOB_NAME],
[JOB_GROUP]
) REFERENCES [Scheduler].[JOB_DETAILS] (
[SCHED_NAME],
[JOB_NAME],
[JOB_GROUP]
)
CREATE INDEX IDX_T_J ON [Scheduler].[TRIGGERS](SCHED_NAME,JOB_NAME,JOB_GROUP)
CREATE INDEX IDX_T_JG ON [Scheduler].[TRIGGERS](SCHED_NAME,JOB_GROUP)
CREATE INDEX IDX_T_C ON [Scheduler].[TRIGGERS](SCHED_NAME,CALENDAR_NAME)
CREATE INDEX IDX_T_G ON [Scheduler].[TRIGGERS](SCHED_NAME,TRIGGER_GROUP)
CREATE INDEX IDX_T_STATE ON [Scheduler].[TRIGGERS](SCHED_NAME,TRIGGER_STATE)
CREATE INDEX IDX_T_N_STATE ON [Scheduler].[TRIGGERS](SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP,TRIGGER_STATE)
CREATE INDEX IDX_T_N_G_STATE ON [Scheduler].[TRIGGERS](SCHED_NAME,TRIGGER_GROUP,TRIGGER_STATE)
CREATE INDEX IDX_T_NEXT_FIRE_TIME ON [Scheduler].[TRIGGERS](SCHED_NAME,NEXT_FIRE_TIME)
CREATE INDEX IDX_T_NFT_ST ON [Scheduler].[TRIGGERS](SCHED_NAME,TRIGGER_STATE,NEXT_FIRE_TIME)
CREATE INDEX IDX_T_NFT_MISFIRE ON [Scheduler].[TRIGGERS](SCHED_NAME,MISFIRE_INSTR,NEXT_FIRE_TIME)
CREATE INDEX IDX_T_NFT_ST_MISFIRE ON [Scheduler].[TRIGGERS](SCHED_NAME,MISFIRE_INSTR,NEXT_FIRE_TIME,TRIGGER_STATE)
CREATE INDEX IDX_T_NFT_ST_MISFIRE_GRP ON [Scheduler].[TRIGGERS](SCHED_NAME,MISFIRE_INSTR,NEXT_FIRE_TIME,TRIGGER_GROUP,TRIGGER_STATE)
CREATE INDEX IDX_FT_TRIG_INST_NAME ON [Scheduler].[FIRED_TRIGGERS](SCHED_NAME,INSTANCE_NAME)
CREATE INDEX IDX_FT_INST_JOB_REQ_RCVRY ON [Scheduler].[FIRED_TRIGGERS](SCHED_NAME,INSTANCE_NAME,REQUESTS_RECOVERY)
CREATE INDEX IDX_FT_J_G ON [Scheduler].[FIRED_TRIGGERS](SCHED_NAME,JOB_NAME,JOB_GROUP)
CREATE INDEX IDX_FT_JG ON [Scheduler].[FIRED_TRIGGERS](SCHED_NAME,JOB_GROUP)
CREATE INDEX IDX_FT_T_G ON [Scheduler].[FIRED_TRIGGERS](SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
CREATE INDEX IDX_FT_TG ON [Scheduler].[FIRED_TRIGGERS](SCHED_NAME,TRIGGER_GROUP)
END
|
-- start_ignore
DROP VIEW IF EXISTS cpu_status;
DROP VIEW IF EXISTS busy;
DROP VIEW IF EXISTS cancel_all;
DROP FUNCTION IF EXISTS round_percentage(text);
DROP TABLE IF EXISTS bigtable;
DROP ROLE IF EXISTS role1_cpu_test;
DROP ROLE IF EXISTS role2_cpu_test;
DROP RESOURCE GROUP rg1_cpu_test;
DROP RESOURCE GROUP rg2_cpu_test;
-- end_ignore
--
-- helper functions, tables and views
--
CREATE TABLE bigtable AS
SELECT i AS c1, 'abc' AS c2
FROM generate_series(1,100000) i;
-- the cpu usage limitation has an error rate about +-7.5%,
-- and also we want to satisfy the 0.1:0.2 rate under 90% overall limitation
-- so we round the cpu rate by 15%
CREATE OR REPLACE FUNCTION round_percentage(json) RETURNS text AS $$
SELECT (round(avg(value::text::float)/15)*15)::text||'%'
FROM json_each_text($1)
$$ LANGUAGE sql;
CREATE OR REPLACE VIEW cpu_status AS
SELECT s.rsgname, round_percentage(s.cpu_usage)
FROM gp_toolkit.gp_resgroup_status s
ORDER BY s.groupid;
CREATE VIEW busy AS
SELECT count(*)
FROM
bigtable t1,
bigtable t2,
bigtable t3,
bigtable t4,
bigtable t5
WHERE 0 = (t1.c1 % 2 + 10000)!
AND 0 = (t2.c1 % 2 + 10000)!
AND 0 = (t3.c1 % 2 + 10000)!
AND 0 = (t4.c1 % 2 + 10000)!
AND 0 = (t5.c1 % 2 + 10000)!
;
CREATE VIEW cancel_all AS
SELECT pg_cancel_backend(procpid)
FROM pg_stat_activity
WHERE current_query LIKE 'SELECT * FROM busy%';
--
-- check gpdb cgroup configuration
--
-- cfs_quota_us := cfs_period_us * ncores * gp_resource_group_cpu_limit
-- shares := 1024 * ncores
--
! python -c "print $(cat /sys/fs/cgroup/cpu/gpdb/cpu.cfs_quota_us) == int($(cat /sys/fs/cgroup/cpu/gpdb/cpu.cfs_period_us) * $(nproc) * $(psql -d isolation2resgrouptest -Aqtc "SHOW gp_resource_group_cpu_limit"))";
! python -c "print $(cat /sys/fs/cgroup/cpu/gpdb/cpu.shares) == 1024 * 256";
--
-- check default groups configuration
--
-- SUB/shares := TOP/shares * cpu_rate_limit
--
! python -c "print $(cat /sys/fs/cgroup/cpu/gpdb/$(psql -d isolation2resgrouptest -Aqtc "SELECT oid FROM pg_resgroup WHERE rsgname='default_group'")/cpu.shares) == int($(cat /sys/fs/cgroup/cpu/gpdb/cpu.shares) * $(psql -d isolation2resgrouptest -Aqtc "SELECT value FROM pg_resgroupcapability c, pg_resgroup g WHERE c.resgroupid=g.oid AND reslimittype=2 AND g.rsgname='default_group'") / 100)";
! python -c "print $(cat /sys/fs/cgroup/cpu/gpdb/$(psql -d isolation2resgrouptest -Aqtc "SELECT oid FROM pg_resgroup WHERE rsgname='admin_group'")/cpu.shares) == int($(cat /sys/fs/cgroup/cpu/gpdb/cpu.shares) * $(psql -d isolation2resgrouptest -Aqtc "SELECT value FROM pg_resgroupcapability c, pg_resgroup g WHERE c.resgroupid=g.oid AND reslimittype=2 AND g.rsgname='admin_group'") / 100)";
-- create two resource groups
CREATE RESOURCE GROUP rg1_cpu_test WITH (concurrency=5, cpu_rate_limit=10, memory_limit=20);
CREATE RESOURCE GROUP rg2_cpu_test WITH (concurrency=5, cpu_rate_limit=20, memory_limit=20);
-- check rg1_cpu_test configuration
! python -c "print $(cat /sys/fs/cgroup/cpu/gpdb/$(psql -d isolation2resgrouptest -Aqtc "SELECT oid FROM pg_resgroup WHERE rsgname='rg1_cpu_test'")/cpu.shares) == int($(cat /sys/fs/cgroup/cpu/gpdb/cpu.shares) * 0.1)";
-- check rg2_cpu_test configuration
! python -c "print $(cat /sys/fs/cgroup/cpu/gpdb/$(psql -d isolation2resgrouptest -Aqtc "SELECT oid FROM pg_resgroup WHERE rsgname='rg2_cpu_test'")/cpu.shares) == int($(cat /sys/fs/cgroup/cpu/gpdb/cpu.shares) * 0.2)";
-- create two roles and assign them to above groups
CREATE ROLE role1_cpu_test RESOURCE GROUP rg1_cpu_test;
CREATE ROLE role2_cpu_test RESOURCE GROUP rg2_cpu_test;
GRANT ALL ON busy TO role1_cpu_test;
GRANT ALL ON busy TO role2_cpu_test;
-- prepare parallel queries in the two groups
10: SET ROLE TO role1_cpu_test;
11: SET ROLE TO role1_cpu_test;
12: SET ROLE TO role1_cpu_test;
13: SET ROLE TO role1_cpu_test;
14: SET ROLE TO role1_cpu_test;
20: SET ROLE TO role2_cpu_test;
21: SET ROLE TO role2_cpu_test;
22: SET ROLE TO role2_cpu_test;
23: SET ROLE TO role2_cpu_test;
24: SET ROLE TO role2_cpu_test;
--
-- now we get prepared.
--
-- on empty load the cpu usage shall be 0%
--
SELECT * FROM cpu_status;
--
-- a group should burst to use all the cpu usage
-- when it's the only one with running queries.
--
-- however the overall cpu usage is controlled by a GUC
-- gp_resource_group_cpu_limit which is 90% by default.
--
-- so the cpu usage shall be 90%
--
10&: SELECT * FROM busy;
11&: SELECT * FROM busy;
12&: SELECT * FROM busy;
13&: SELECT * FROM busy;
14&: SELECT * FROM busy;
SELECT pg_sleep(20);
SELECT * FROM cpu_status;
-- start_ignore
SELECT * FROM cancel_all;
10<:
11<:
12<:
13<:
14<:
-- end_ignore
--
-- when there are multiple groups with parallel queries,
-- they should share the cpu usage by their cpu_usage settings,
--
-- rg1_cpu_test:rg2_cpu_test is 0.1:0.2 => 1:2, so:
--
-- - rg1_cpu_test gets 90% * 1/3 => 30%;
-- - rg2_cpu_test gets 90% * 2/3 => 60%;
--
10&: SELECT * FROM busy;
11&: SELECT * FROM busy;
12&: SELECT * FROM busy;
13&: SELECT * FROM busy;
14&: SELECT * FROM busy;
20&: SELECT * FROM busy;
21&: SELECT * FROM busy;
22&: SELECT * FROM busy;
23&: SELECT * FROM busy;
24&: SELECT * FROM busy;
SELECT pg_sleep(20);
SELECT * FROM cpu_status;
-- start_ignore
SELECT * FROM cancel_all;
10<:
11<:
12<:
13<:
14<:
20<:
21<:
22<:
23<:
24<:
-- end_ignore
-- cleanup
REVOKE ALL ON busy FROM role1_cpu_test;
REVOKE ALL ON busy FROM role2_cpu_test;
DROP ROLE role1_cpu_test;
DROP ROLE role2_cpu_test;
DROP RESOURCE GROUP rg1_cpu_test;
DROP RESOURCE GROUP rg2_cpu_test;
|
<gh_stars>0
-- phpMyAdmin SQL Dump
-- version 4.0.10.6
-- http://www.phpmyadmin.net
--
-- Хост: 127.0.0.1:3306
-- Время создания: Май 13 2016 г., 14:40
-- Версия сервера: 5.5.41-log
-- Версия PHP: 5.4.35
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 */;
--
-- База данных: `YiiShopy`
--
-- --------------------------------------------------------
--
-- Структура таблицы `user`
--
CREATE TABLE IF NOT EXISTS `user` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`username` varchar(255) NOT NULL,
`password` varchar(255) NOT NULL,
`auth_key` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
<gh_stars>1-10
# Pi Engine schema
# http://pialog.org
# Author: <NAME> <<EMAIL>>
# --------------------------------------------------------
# ------------------------------------------------------
# Comment
# >>>>
# Comment type
CREATE TABLE `{type}` (
`id` int(10) unsigned NOT NULL auto_increment,
`module` varchar(64) NOT NULL default '',
`controller` varchar(64) NOT NULL default '',
`action` varchar(64) NOT NULL default '',
`identifier` varchar(64) NOT NULL default '',
`params` varchar(255) NOT NULL default '',
`name` varchar(64) NOT NULL default '',
`title` varchar(255) NOT NULL default '',
-- Callback to fetch source meta data
`callback` varchar(255) NOT NULL default '',
-- Locator to identify root meta data
`locator` varchar(255) NOT NULL default '',
`active` tinyint(1) unsigned NOT NULL default '1',
`icon` varchar(255) NOT NULL default '',
PRIMARY KEY (`id`),
UNIQUE KEY `module_type` (`module`, `name`)
);
# Comment root
CREATE TABLE `{root}` (
`id` int(10) unsigned NOT NULL auto_increment,
`module` varchar(64) NOT NULL,
`type` varchar(64) NOT NULL default '',
`item` int(10) unsigned NOT NULL,
`active` tinyint(1) unsigned NOT NULL default '1',
-- User id of root item author
`author` int(10) unsigned NOT NULL default '0',
PRIMARY KEY (`id`),
UNIQUE KEY `module_item` (`module`, `type`, `item`),
KEY `author` (`author`)
);
# Comment posts
CREATE TABLE `{post}` (
`id` int(10) unsigned NOT NULL auto_increment,
`uid` int(10) unsigned NOT NULL default '0',
`root` int(10) unsigned NOT NULL,
`reply` int(10) unsigned NOT NULL default '0',
`content` text,
-- Content markup: text, html, markdown
`markup` varchar(64) NOT NULL default '',
`time` int(10) unsigned NOT NULL default '0',
`time_updated` int(10) unsigned NOT NULL default '0',
`active` tinyint(1) unsigned NOT NULL default '1',
`ip` varchar(15) NOT NULL default '',
`module` varchar(64) NOT NULL,
PRIMARY KEY (`id`),
KEY `uid` (`uid`),
KEY `root` (`root`)
);
|
<gh_stars>0
-- @testpoint:opengauss关键字reuse(非保留),作为用户组名
--关键字不带引号-成功
drop group if exists reuse;
create group reuse with password '<PASSWORD>';
drop group reuse;
--关键字带双引号-成功
drop group if exists "reuse";
create group "reuse" with password '<PASSWORD>';
drop group "reuse";
--关键字带单引号-合理报错
drop group if exists 'reuse';
--关键字带反引号-合理报错
drop group if exists `reuse`;
|
<filename>docker/test-db/12-tm-europe-borders.sql
CREATE SCHEMA "data";
CREATE TABLE "data"."europe_borders" (gid serial,
"fips" varchar(2),
"iso2" varchar(2),
"iso3" varchar(3),
"un" int4,
"name" varchar(50),
"area" numeric,
"pop2005" numeric,
"region" int4,
"subregion" int4,
"lon" numeric,
"lat" numeric);
ALTER TABLE "data"."europe_borders" ADD PRIMARY KEY (gid);
SELECT AddGeometryColumn('data','europe_borders','geom','4326','MULTIPOLYGON',2);
|
--name: achillesAnalysis
--connection: Demo:test_queries:PostgresNetCDM
select * from cdm_synthea_results.achilles_analysis
where analysis_id in (select distinct analysis_id from cdm_synthea_results.achilles_results);
|
<filename>schema.sql
drop table if exists recipes;
create table recipes (
id integer primary key AUTO_INCREMENT,
title varchar(50) default '' not null,
reference varchar(500) default '' not null,
description varchar(500) default '' not null,
username varchar(50) default '' not null,
views integer default 0 not null
);
|
<gh_stars>0
with
source_data as (
select
category_id
, category_name
, description
from {{ source('erp_northwind_10_2021', 'categories') }}
)
select * from source_data
|
-- phpMyAdmin SQL Dump
-- version 4.8.4
-- https://www.phpmyadmin.net/
--
-- Servidor: 127.0.0.1
-- Tiempo de generación: 10-07-2021 a las 18:43:29
-- Versión del servidor: 10.1.37-MariaDB
-- Versión de PHP: 5.6.39
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: `pruebag8`
--
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `migrations`
--
CREATE TABLE `migrations` (
`id` int(10) UNSIGNED NOT NULL,
`migration` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`batch` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `tb_eps`
--
CREATE TABLE `tb_eps` (
`id` int(11) NOT NULL,
`nombre` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Volcado de datos para la tabla `tb_eps`
--
INSERT INTO `tb_eps` (`id`, `nombre`) VALUES
(1, 'SALUD TOTAL'),
(2, 'COOMEVA'),
(3, 'SALUDCOOP'),
(4, 'SANITAS'),
(5, 'COLSUBSIDIO'),
(6, 'COLSALUD');
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `tb_roles`
--
CREATE TABLE `tb_roles` (
`id` int(11) NOT NULL,
`nombre` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Volcado de datos para la tabla `tb_roles`
--
INSERT INTO `tb_roles` (`id`, `nombre`) VALUES
(1, 'ADMINISTRADOR'),
(2, 'USUARIO GENERAL');
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `users`
--
CREATE TABLE `users` (
`id` bigint(20) UNSIGNED NOT NULL,
`name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`documento` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`telefono` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL,
`genero` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`fecha_nacimiento` date DEFAULT NULL,
`email_verified_at` timestamp NULL DEFAULT NULL,
`password` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`rol_id` int(11) DEFAULT NULL,
`eps_id` int(11) DEFAULT NULL,
`remember_token` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Volcado de datos para la tabla `users`
--
INSERT INTO `users` (`id`, `name`, `email`, `documento`, `telefono`, `genero`, `fecha_nacimiento`, `email_verified_at`, `password`, `rol_id`, `eps_id`, `remember_token`, `created_at`, `updated_at`) VALUES
(1, 'Ser<NAME>', '<EMAIL>', '1121916694', '3143377003', 'Masculino', '1994-09-25', NULL, '$2y$10$seGsBr5hApbzowMQem16V.YeL/E.PZxmqBK/8.2D1M4M9tOOnuiFi', 1, 1, NULL, '2021-07-10 18:40:14', '2021-07-10 21:08:50'),
(2, '<NAME>', '<EMAIL>', '123123', '123', 'Masculino', '2006-01-01', NULL, '$2y$10$j/CpXs8wvYEhE1FRZNMYcut8XLaFBEIn5TLz/1Xsd7VDuMBYiFdGC', 1, 4, NULL, '2021-07-10 20:22:42', '2021-07-10 21:09:39'),
(4, '<NAME>', '<EMAIL>', '123123', '312456878', 'Masculino', '1940-07-10', NULL, '$2y$10$sSm96zGV/ASQJ4VR1o1JWuigYci6o0CeQtA.Cy4PxvGAfvSrFi/kO', 1, 2, NULL, '2021-07-10 21:26:07', '2021-07-10 21:29:53');
--
-- Índices para tablas volcadas
--
--
-- Indices de la tabla `migrations`
--
ALTER TABLE `migrations`
ADD PRIMARY KEY (`id`);
--
-- Indices de la tabla `tb_eps`
--
ALTER TABLE `tb_eps`
ADD PRIMARY KEY (`id`);
--
-- Indices de la tabla `tb_roles`
--
ALTER TABLE `tb_roles`
ADD PRIMARY KEY (`id`);
--
-- Indices de la tabla `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id`),
ADD KEY `eps_id` (`eps_id`),
ADD KEY `rol_id` (`rol_id`);
--
-- AUTO_INCREMENT de las tablas volcadas
--
--
-- AUTO_INCREMENT de la tabla `migrations`
--
ALTER TABLE `migrations`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT de la tabla `tb_eps`
--
ALTER TABLE `tb_eps`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
--
-- AUTO_INCREMENT de la tabla `tb_roles`
--
ALTER TABLE `tb_roles`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT de la tabla `users`
--
ALTER TABLE `users`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
--
-- Restricciones para tablas volcadas
--
--
-- Filtros para la tabla `users`
--
ALTER TABLE `users`
ADD CONSTRAINT `users_ibfk_1` FOREIGN KEY (`eps_id`) REFERENCES `tb_eps` (`id`),
ADD CONSTRAINT `users_ibfk_2` FOREIGN KEY (`rol_id`) REFERENCES `tb_roles` (`id`);
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
<filename>cv_maestro.sql
-- phpMyAdmin SQL Dump
-- version 4.8.5
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Mar 07, 2020 at 07:23 AM
-- Server version: 10.1.38-MariaDB
-- PHP Version: 7.3.2
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: `cv_maestro`
--
-- --------------------------------------------------------
--
-- Table structure for table `catalog_bandung`
--
CREATE TABLE `catalog_bandung` (
`id` int(11) NOT NULL,
`nama_kelas` varchar(128) NOT NULL,
`image` varchar(128) NOT NULL,
`tempat` varchar(128) NOT NULL,
`registrasi` int(11) NOT NULL,
`bandung4` int(11) NOT NULL,
`bandung8` int(11) NOT NULL,
`keterangan` varchar(500) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `catalog_bandung`
--
INSERT INTO `catalog_bandung` (`id`, `nama_kelas`, `image`, `tempat`, `registrasi`, `bandung4`, `bandung8`, `keterangan`) VALUES
(1, '1 Siswa 1 pelatih', 'bandung1.jpg', 'Bandung', 100000, 400000, 700000, 'belajar lebih menyenangkan bersama kami'),
(2, '2 Siswa 1 pelatih', 'bandung2.jpg', 'Bandung', 100000, 300000, 500000, 'Akan di latih dengan pelatih yang profesional');
-- --------------------------------------------------------
--
-- Table structure for table `catalog_jakarta`
--
CREATE TABLE `catalog_jakarta` (
`id` int(11) NOT NULL,
`nama_kelas` varchar(128) NOT NULL,
`image` varchar(128) NOT NULL,
`lokasi` varchar(128) NOT NULL,
`registrasi` int(11) NOT NULL,
`jakarta4` int(11) NOT NULL,
`jakarta8` int(11) NOT NULL,
`keterangan` varchar(500) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `catalog_jakarta`
--
INSERT INTO `catalog_jakarta` (`id`, `nama_kelas`, `image`, `lokasi`, `registrasi`, `jakarta4`, `jakarta8`, `keterangan`) VALUES
(2, 'Private', '1.jpg', 'Jabodetabek', 100000, 700000, 1300000, 'Siswa akan di latih oleh 1 pelatih yang profesional'),
(3, 'Kelas', '2.jpg', 'jabodetabek', 100000, 500000, 900000, 'Siswa akan di latih oleh 1 pelatih yang profesional, kelas ini cocok untuk siswa yang tidak ingin belajar renang sendiri'),
(4, 'Terapi', 'jakarta3.jpg', 'Jabodetabek', 100000, 400000, 700000, 'Kelas ini cocok buat anak-anak yang mau latihan bareng bersama temannya');
-- --------------------------------------------------------
--
-- Table structure for table `data_pelatih`
--
CREATE TABLE `data_pelatih` (
`id` int(11) NOT NULL,
`nama_pelatih` varchar(128) NOT NULL,
`jenis_kelamin` varchar(128) NOT NULL,
`area_kerja` varchar(128) NOT NULL,
`mulai_gabung` varchar(128) NOT NULL,
`cuoch` varchar(10000) NOT NULL,
`jumlah_siswa` varchar(128) NOT NULL,
`image` varchar(128) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `data_pelatih`
--
INSERT INTO `data_pelatih` (`id`, `nama_pelatih`, `jenis_kelamin`, `area_kerja`, `mulai_gabung`, `cuoch`, `jumlah_siswa`, `image`) VALUES
(1, 'Gilang', 'Laki-laki', 'Bandung', '20 mei 2017', 'Berenang membuat hati lebih tenang', '50', 'gilang.jpg'),
(2, 'Ilham', 'Laki-laki', 'Jabodetabek', '12 januari 2015', 'Jadikan air sebagai sahabat', '40', 'ilham.jpg'),
(3, 'Ikhsan', 'Laki-laki', 'Bali', '15 februari 2019', 'Berenang membuat hati tenang', '15', 'ikhsan.jpg'),
(4, 'Kiki', 'Laki-laki', 'jabodetabek', '20 juni 2018', 'Jangan takut dengan air', '40', 'kiki.jpg');
-- --------------------------------------------------------
--
-- Table structure for table `data_siswa`
--
CREATE TABLE `data_siswa` (
`id` int(11) NOT NULL,
`nama_siswa` varchar(128) NOT NULL,
`jenis_kelamin` varchar(128) NOT NULL,
`tempat_latihan` varchar(128) NOT NULL,
`paket_renang` varchar(128) NOT NULL,
`nama_pelatih` varchar(128) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `data_siswa`
--
INSERT INTO `data_siswa` (`id`, `nama_siswa`, `jenis_kelamin`, `tempat_latihan`, `paket_renang`, `nama_pelatih`) VALUES
(1, 'Keano', 'Perempuan', 'Kolam renang Oasis', 'Bandung18', 'Coach Novita'),
(2, 'Kiki', 'Laki-Laki', 'Kolam renang Oasis', 'Bandung14', 'Coach Erma');
-- --------------------------------------------------------
--
-- Table structure for table `jumlah_siswa`
--
CREATE TABLE `jumlah_siswa` (
`id` int(11) NOT NULL,
`jumlah` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `jumlah_siswa`
--
INSERT INTO `jumlah_siswa` (`id`, `jumlah`) VALUES
(1, 1),
(2, 2),
(3, 3),
(4, 4);
-- --------------------------------------------------------
--
-- Table structure for table `order_jakarta`
--
CREATE TABLE `order_jakarta` (
`id` int(11) NOT NULL,
`nama_siswa` varchar(128) NOT NULL,
`nama_ortu` varchar(128) NOT NULL,
`jenis_kelamin` varchar(128) NOT NULL,
`usia` varchar(128) NOT NULL,
`nama_sekolah` varchar(128) NOT NULL,
`telepon` varchar(128) NOT NULL,
`alamat-tinggal` varchar(500) NOT NULL,
`nama_kolam` varchar(128) NOT NULL,
`nama_kelas` varchar(128) NOT NULL,
`daerah` varchar(128) NOT NULL,
`pelatih` varchar(128) NOT NULL,
`status` varchar(128) NOT NULL,
`date_created` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `order_jakarta`
--
INSERT INTO `order_jakarta` (`id`, `nama_siswa`, `nama_ortu`, `jenis_kelamin`, `usia`, `nama_sekolah`, `telepon`, `alamat-tinggal`, `nama_kolam`, `nama_kelas`, `daerah`, `pelatih`, `status`, `date_created`) VALUES
(14, 'Kiki Agustin', 'Awan', 'Laki-Laki', '20', 'Smk Dharma Agung', '085794203570', 'Jl. Salamungkal Rt.02 Desa.Karangtunggal', 'Kolam Oasis', '2 Siswa 4 Pertemuan', '', 'belum ada pelatih', 'Lunas', 1571558904),
(15, '<NAME>', 'Awan', 'Laki-Laki', '16', 'sma Cikancung', '0000000', 'Salamungkal', 'Oasis', '2 Siswa 4 Pertemuan', '', 'Kiki Agustin', 'Lunas', 1571558904),
(16, 'De<NAME>', 'gaga', 'Laki-laki', '14', 'smk', '3456', 'bandung', 'Oasis', '4 Pertemuan', 'Bandung', 'belum ada pelatih', 'Belum Bayar', 1572457472),
(20, 'asasa', 'asasa', 'asasa', 'asasa', 'asasa', '1212', 'asasa', 'asasa', 'Swim Prestasi 4 Pertemuan', '', 'belum ada pelatih', 'Belum Bayar', 1572548931),
(22, 'kiki', 'kiki', 'kiki', 'kiki', 'kiki', '1212', 'kiki', 'kiki', '2 Siswa4 Pertemuan', '', 'belum ada pelatih', 'Belum Bayar', 1572549746),
(23, 'kiki', 'kiki', 'kiki', 'kiki', 'kiki', 'kiki', 'kiki', 'kiki', '2 Siswa 8 Pertemuan', '', 'belum ada pelatih', 'Belum Bayar', 1572549746),
(24, 'Dea Khasanah', 'Dea Khasanah', 'Dea Khasanah', 'Dea Khasanah', 'Dea Khasanah', 'Dea Khasanah', 'Dea Khasanah', 'Dea Khasanah', '2 Siswa4 Pertemuan', '', 'belum ada pelatih', 'Belum Bayar', 1572549987),
(25, 'Dea Khasanah', 'Dea Khasanah', 'Dea Khasanah', 'Dea Khasanah', 'Dea Khasanah', 'Dea Khasanah', 'Dea Khasanah', 'Dea Khasanah', '2 Siswa4 Pertemuan', '', 'belum ada pelatih', 'Belum Bayar', 1572549987),
(28, 'asasa', 'asasa', 'Laki-laki', 'asasa', 'asas', '123', 'asas', 'aasa', 'Bandung 1 Siswa 4 Pertemuan', '', 'belum ada pelatih', 'Belum Bayar', 1573586154),
(29, 'Kiki Agustin', 'Kiki Agustin', 'Laki-laki', 'Kiki Agustin', 'Kiki Agustin', '123', 'Kiki Agustin', 'Kiki Agustin', 'Jakarta 3/4 Siswa 8 Pertemuan', '', 'belum ada pelatih', 'Belum Bayar', 1573586301),
(30, 'asasasa', 'asasasa', 'Perempuan', '12', 'sasasasa', '1213', 'asasasa', 'asasasa', 'Jakarta 2 Siswa 4 Pertemuan', '', 'belum ada pelatih', 'Belum Bayar', 1574275135),
(31, 'asasasa', 'asasasa', 'Laki-laki', '1211', 'asasasa', '1213', 'asasasa', 'asasasa', 'Jakarta 3/4 Siswa 8 Pertemuan', '', 'belum ada pelatih', 'Belum Bayar', 1574275157),
(32, 'asasasa', 'asasasa', 'Perempuan', '12', 'asasasa', '123', 'asasasa', 'asasasa', 'Jakarta 3/4 Siswa 8 Pertemuan', '', 'belum ada pelatih', 'Belum Bayar', 1574275193),
(33, 'asasasa', 'asasasa', 'Perempuan', '12', 'asasasa', '123', 'asasasa', 'asasasa', 'Jakarta 3/4 Siswa 8 Pertemuan', '', 'belum ada pelatih', 'Belum Bayar', 1574275239),
(34, 'asasasa', 'asasasa', 'Laki-laki', '34', 'asasasa', '565656', 'asasasa', 'asasasa', 'Jakarta 3/4 Siswa 8 Pertemuan', '', 'belum ada pelatih', 'Belum Bayar', 1574275296),
(35, 'asasasa', 'asasasa', 'Laki-laki', '121', 'asasasa', '1213', 'asasasa', 'asasasa', 'Jakarta 3/4 Siswa 8 Pertemuan', '', 'belum ada pelatih', 'Belum Bayar', 1574275404),
(36, 'asasasa', 'asasasa', 'Laki-laki', '12', 'asasasa', '1213', 'asasasa', 'asasasa', 'Jakarta 3/4 Siswa 4 Pertemuan', '', 'belum ada pelatih', 'Belum Bayar', 1574275436),
(37, 'asasasa', 'asasasa', 'Laki-laki', '121', 'asasasa', '345', 'asasasa', 'asasasa', 'Jakarta 3/4 Siswa 8 Pertemuan', '', 'belum ada pelatih', 'Belum Bayar', 1574275470),
(38, 'asasasa', 'asasasa', 'Laki-laki', '12', 'asasasa', '3121', 'asasasa', 'asasasa', 'Jakarta 3/4 Siswa 8 Pertemuan', '', 'belum ada pelatih', 'Belum Bayar', 1574275493),
(40, 'asasasa', 'asasasa', 'asasasa', '12', 'asasasa', '1214', 'asasasa', 'asasasa', 'asasasa', 'asasasa', 'asasasa', 'asasasa', 0),
(41, 'asasasa', 'asasasa', 'Laki-laki', 'asasasa', 'asasasa', '1213', 'asasasa', 'asasasa', 'Bandung 1 Siswa 8 Pertemuan', '', 'belum ada pelatih', 'Belum Bayar', 1574275705),
(42, 'asasasa', 'asasasa', 'Laki-laki', '321', 'asasasa', '321', 'asasasa', 'asasasa', 'Jakarta 2 Siswa 4 Pertemuan', '', 'belum ada pelatih', 'Belum Bayar', 1574275726),
(43, 'asasasa', 'asasasa', 'Laki-laki', '321', 'asasasa', '321', 'asasasa', 'asasasa', 'Jakarta 1 Siswa 8 Pertemuan', '', 'belum ada pelatih', 'Belum Bayar', 1574275825),
(44, 'asasasa', 'asasasa', 'Laki-laki', '21', 'asasasa', '321', 'asasasa', 'asasasa', 'Jakarta 1 Siswa 4 Pertemuan', '', 'belum ada pelatih', 'Belum Bayar', 1574275861),
(45, 'asasasa', 'asasasa', 'Laki-laki', '321', 'asasasa', '4321', 'asasasa', 'asasasa', 'Bandung 3/4 Siswa 8 Pertemuan', '', 'belum ada pelatih', 'Belum Bayar', 1574275903),
(46, 'asasasa', 'asasasa', 'Laki-laki', '321', 'asasasa', '321', 'asasasa', 'asasasa', 'Bandung 3/4 Siswa 8 Pertemuan', '', 'belum ada pelatih', 'Belum Bayar', 1574275940),
(47, 'asasasa', 'asasasa', 'Laki-laki', '4321', 'asasasa', '4321', 'asasasa', 'asasasa', 'Bandung 1 Siswa 4 Pertemuan', '', 'belum ada pelatih', 'Belum Bayar', 1574275972),
(48, 'asasasa', 'asasasa', 'Laki-laki', '432', 'asasasa', '4321', 'asasasa', 'asasasa', 'Jakarta 3/4 Siswa 4 Pertemuan', '', 'belum ada pelatih', 'Belum Bayar', 1574275998),
(49, 'asasasa', 'asasasa', 'Laki-laki', '321', 'asasasa', '321', 'asasasa', 'asasasa', 'Jakarta 3/4 Siswa 8 Pertemuan', '', 'belum ada pelatih', 'Belum Bayar', 1574276020),
(50, 'sasasa', 'asasa', 'Laki-laki', 'asasa', 'asasa', '1213', 'asada', 'asaad', 'Bandung 1 Siswa 4 Pertemuan', '', 'belum ada pelatih', 'Belum Bayar', 1575380107),
(51, 'asasa', 'asasa', 'Laki-laki', '12', 'ass', '121', 'asasasa', 'asasa', 'Jakarta 3/4 Siswa 4 Pertemuan', '', 'belum ada pelatih', 'Belum Bayar', 1575380173),
(52, 'kkikii', 'asasa', 'Laki-laki', '123', 'asasa', '121', 'asaa', 'asasa', 'Bandung 1 Siswa 4 Pertemuan', '', 'belum ada pelatih', 'Belum Bayar', 1575380201),
(53, 'asasa', 'asasa', 'Laki-laki', '12', 'asasa', '12121', 'asasa', 'asaa', 'Bandung 1 Siswa 4 Pertemuan', '', 'belum ada pelatih', 'Belum Bayar', 1575457659);
-- --------------------------------------------------------
--
-- 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,
`rol_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`, `rol_id`, `is_active`, `date_created`) VALUES
(3, 'Dea', '<EMAIL>', 'default.jpg', '$2y$10$v3Duk9T5oktUDof2cMS.LOgPwe4BV59mUaOUj80JtB3sWmIVkKW0q', 2, 1, 1568524980),
(8, '<NAME>', '<EMAIL>', '72174190_2167464950218173_6294285897851244342_n.jpg', '$2y$10$V/IXx1beZs0MGkgVYrp9U.TjcMYOyWoxmEzwPVQol0Ojjw6Wz8iBO', 1, 1, 1570642084),
(9, 'mega Kusmayati', '<EMAIL>', 'banner.jpg', '$2y$10$Lbbc6Ht6Vib2TokWzqLhGuvQLeBKvIrSKF7TC4F9/hu.U7U8vTCiO', 3, 1, 1570690854),
(10, 'Novita', '<EMAIL>', 'default.jpg', '$2y$10$6.lRbpD/sKYB6aN7vZ7DROGib8r.0jiXYtwLQ3GuOuEXYkaTIjQEu', 3, 1, 1570814584),
(11, 'Roma', '<EMAIL>', 'default.jpg', '$2y$10$ZbhpoekzJj.paYi1BTJ0P.Vl854g9DNQwJOqz8CGnfeAoQigbg1AC', 2, 1, 1570832156),
(14, 'kaka', '<EMAIL>', 'default.jpg', '$2y$10$cvyEe92/xdgNXyD6AJCpL.FuVBfLsMLysWBlJMDKJ0CdLhy1gwKL6', 2, 1, 1571859030),
(15, 'ishaq', '<EMAIL>', 'default.jpg', '$2y$10$nObqdm0UO93uizj/8zHyYOI.xWRWCavez5ZbMyNSX2QWxXzKhVPVi', 2, 1, 1572566612),
(16, 'Juju', '<EMAIL>', 'default.jpg', '$2y$10$pPGGwh1cWFYWEFufrZAh5ezYXtfa2MwqBFFqjACwN2x66ObbqK1Yi', 2, 1, 1574218174),
(17, 'Cici', '<EMAIL>', 'default.jpg', '$2y$10$u/ZTc1blgqukzuTMeq2W9uXQQ22k4gXqu8/Q31VDmfBS7fc4Ukz9a', 2, 1, 1574835560);
-- --------------------------------------------------------
--
-- Table structure for table `user_access_menu`
--
CREATE TABLE `user_access_menu` (
`id` int(11) NOT NULL,
`rol_id` int(11) NOT NULL,
`menu_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `user_access_menu`
--
INSERT INTO `user_access_menu` (`id`, `rol_id`, `menu_id`) VALUES
(1, 1, 1),
(2, 1, 2),
(3, 2, 2),
(4, 1, 3),
(5, 3, 2),
(6, 3, 4),
(7, 1, 4),
(8, 1, 5),
(10, 2, 5),
(11, 3, 5);
-- --------------------------------------------------------
--
-- Table structure for table `user_menu`
--
CREATE TABLE `user_menu` (
`id` int(11) NOT NULL,
`menu` varchar(128) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `user_menu`
--
INSERT INTO `user_menu` (`id`, `menu`) VALUES
(1, 'Admin'),
(3, 'Menu'),
(4, 'Pelatih'),
(5, 'User');
-- --------------------------------------------------------
--
-- Table structure for table `user_rol`
--
CREATE TABLE `user_rol` (
`id` int(11) NOT NULL,
`rol` varchar(128) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `user_rol`
--
INSERT INTO `user_rol` (`id`, `rol`) VALUES
(1, 'Administrator'),
(2, 'Member'),
(3, 'Pelatih');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `catalog_bandung`
--
ALTER TABLE `catalog_bandung`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `catalog_jakarta`
--
ALTER TABLE `catalog_jakarta`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `data_pelatih`
--
ALTER TABLE `data_pelatih`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `data_siswa`
--
ALTER TABLE `data_siswa`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `jumlah_siswa`
--
ALTER TABLE `jumlah_siswa`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `order_jakarta`
--
ALTER TABLE `order_jakarta`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `user`
--
ALTER TABLE `user`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `user_access_menu`
--
ALTER TABLE `user_access_menu`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `user_menu`
--
ALTER TABLE `user_menu`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `user_rol`
--
ALTER TABLE `user_rol`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `catalog_bandung`
--
ALTER TABLE `catalog_bandung`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `catalog_jakarta`
--
ALTER TABLE `catalog_jakarta`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT for table `data_pelatih`
--
ALTER TABLE `data_pelatih`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT for table `data_siswa`
--
ALTER TABLE `data_siswa`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `jumlah_siswa`
--
ALTER TABLE `jumlah_siswa`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT for table `order_jakarta`
--
ALTER TABLE `order_jakarta`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=54;
--
-- AUTO_INCREMENT for table `user`
--
ALTER TABLE `user`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=18;
--
-- AUTO_INCREMENT for table `user_access_menu`
--
ALTER TABLE `user_access_menu`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12;
--
-- AUTO_INCREMENT for table `user_menu`
--
ALTER TABLE `user_menu`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
--
-- AUTO_INCREMENT for table `user_rol`
--
ALTER TABLE `user_rol`
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 */;
|
SELECT SETVAL('types_id_seq', (SELECT MAX(id) + 1 FROM types));
SELECT SETVAL('users_id_seq', (SELECT MAX(id) + 1 FROM users));
SELECT SETVAL('transfers_id_seq', (SELECT MAX(id) + 1 FROM transfers));
SELECT SETVAL('offerings_id_seq', (SELECT MAX(id) + 1 FROM offerings));
SELECT SETVAL('tithes_id_seq', (SELECT MAX(id) + 1 FROM tithes));
|
-- MySQL dump 10.13 Distrib 5.5.53, for debian-linux-gnu (x86_64)
--
-- Host: 0.0.0.0 Database: dw
-- ------------------------------------------------------
-- Server version 5.5.53-0ubuntu0.14.04.1
/*!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 */;
--
-- Current Database: `dw`
--
CREATE DATABASE /*!32312 IF NOT EXISTS*/ `dw_test` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci */;
USE `dw_test`;
--
-- Table structure for table `File`
--
DROP TABLE IF EXISTS `File`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `File` (
`Filename` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`TotalNumberOfRows` int(11) DEFAULT NULL,
`RowsWithErrors` int(11) DEFAULT NULL,
`StartDate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`EndDate` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`CreationDate` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`Filename`),
UNIQUE KEY `Filename` (`Filename`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `File`
--
LOCK TABLES `File` WRITE;
/*!40000 ALTER TABLE `File` DISABLE KEYS */;
/*!40000 ALTER TABLE `File` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `Transaction`
--
DROP TABLE IF EXISTS `Transaction`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Transaction` (
`TransactionID` int(11) NOT NULL,
`TransactionDate` date NOT NULL,
`Amount` text COLLATE utf8_unicode_ci NOT NULL,
`CreationDate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`TransactionDescriptionPK` int(11) NOT NULL,
`FilePK` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`TransactionID`),
UNIQUE KEY `TransactionID` (`TransactionID`),
KEY `TransactionDescriptionPK` (`TransactionDescriptionPK`),
KEY `FilePK` (`FilePK`),
CONSTRAINT `Transaction_ibfk_1` FOREIGN KEY (`TransactionDescriptionPK`) REFERENCES `TransactionDescription` (`TransactionDescriptionPK`),
CONSTRAINT `Transaction_ibfk_2` FOREIGN KEY (`FilePK`) REFERENCES `File` (`Filename`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `Transaction`
--
LOCK TABLES `Transaction` WRITE;
/*!40000 ALTER TABLE `Transaction` DISABLE KEYS */;
/*!40000 ALTER TABLE `Transaction` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `TransactionDescription`
--
DROP TABLE IF EXISTS `TransactionDescription`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `TransactionDescription` (
`TransactionDescriptionPK` int(11) NOT NULL AUTO_INCREMENT,
`Description` varchar(33) COLLATE utf8_unicode_ci NOT NULL,
`CreationDate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`TransactionDescriptionPK`),
UNIQUE KEY `TransactionDescriptionPK` (`TransactionDescriptionPK`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `TransactionDescription`
--
LOCK TABLES `TransactionDescription` WRITE;
/*!40000 ALTER TABLE `TransactionDescription` DISABLE KEYS */;
/*!40000 ALTER TABLE `TransactionDescription` 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-03-16 17:12:04
|
create or replace PACKAGE PRUEBAS_EXAMEN_TEORICO_DGT
AS
PROCEDURE inicializar;
PROCEDURE insertar (nombre_prueba VARCHAR2, w_num_alum VARCHAR2, w_fecha_ex DATE, w_apto CHAR, salidaEsperada BOOLEAN);
PROCEDURE actualizar_apto (nombre_prueba VARCHAR2, w_num_ex_t Integer, w_apto CHAR, salidaEsperada BOOLEAN);
PROCEDURE actualizar_fecha_ex (nombre_prueba VARCHAR2, w_num_ex_t Integer, w_fecha_ex DATE, salidaEsperada BOOLEAN);
PROCEDURE eliminar (nombre_prueba VARCHAR2, w_num_ex_t INTEGER, salidaEsperada BOOLEAN);
END PRUEBAS_EXAMEN_TEORICO_DGT;
|
<reponame>kytrinyx/stalemate
-- +goose Up
-- SQL in section 'Up' is executed when this migration is applied
CREATE TABLE teams (
id serial PRIMARY KEY,
installation_id integer,
account character varying(255),
repository character varying(255),
github_team_id integer,
name character varying(255),
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
);
CREATE INDEX teams_installation ON teams (installation_id);
CREATE UNIQUE INDEX teams_repo ON teams (github_team_id, account, repository);
-- +goose Down
-- SQL section 'Down' is executed when this migration is rolled back
DROP TABLE teams;
|
<filename>C# DB Module/DB Basics PL-SQL/ExamPreparations/Exam - 16 October 2016/Exam - 16 October 2016/08. Extract Delayed Flights.sql<gh_stars>1-10
SELECT
FlightID, DepartureTime, ArrivalTime
FROM Flights
WHERE Status = 'Delayed'
ORDER BY FlightID
|
<filename>backend/migrations/004_add_continuously_send_notifications_column_to_service_table.up.sql
alter table service
add continuously_send_notifications bool default false not null;
|
<filename>src/test/resources/tkt2192.test_2.sql
-- tkt2192.test
--
-- execsql {
-- select * from summary;
-- }
select * from summary;
|
<gh_stars>100-1000
IF EXISTS (SELECT * FROM sys.objects WHERE schema_id=SCHEMA_ID('microsoft') AND name = N'asinh')
DROP FUNCTION microsoft.asinh;
GO
CREATE FUNCTION microsoft.asinh(@expression VARCHAR(8000))
RETURNS FLOAT
WITH SCHEMABINDING
AS
BEGIN
RETURN LOG(@expression + SQRT((CAST(@expression AS FLOAT) * CAST(@expression AS FLOAT)) - 1))
END
GO
|
<reponame>TheMarques/development_toolkit<filename>database/structs/tables_shop.sql
CREATE TABLE IF NOT EXISTS "customer" (
"id" INTEGER,
"name" TEXT NOT NULL UNIQUE,
"address" TEXT,
PRIMARY KEY("id" AUTOINCREMENT)
);
CREATE TABLE IF NOT EXISTS "item" (
"id" INTEGER,
"description" TEXT NOT NULL UNIQUE,
"price" FLOAT NOT NULL,
PRIMARY KEY("id" AUTOINCREMENT)
);
|
<gh_stars>10-100
create table user (
user_id int auto_increment primary key,
user_name varchar(20) null comment '姓名',
age int(3) default 0 comment '年龄'
);
|
-- MySQL dump 10.13 Distrib 5.7.15, for Linux (x86_64)
--
-- Host: localhost Database: grab
-- ------------------------------------------------------
-- Server version 5.7.15-0ubuntu0.16.04.1
/*!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 `cqssc`
--
DROP TABLE IF EXISTS `cqssc`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `cqssc` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`qishu` char(20) NOT NULL COMMENT '开奖期数',
`one` tinyint(3) NOT NULL COMMENT '万位 第一位号码',
`two` tinyint(3) NOT NULL COMMENT '千位 第二位号码',
`three` tinyint(3) NOT NULL COMMENT '百位 第三位号码',
`four` tinyint(3) NOT NULL COMMENT '十位 第四位号码',
`five` tinyint(3) NOT NULL COMMENT '个位 第五位号码',
`code` char(20) NOT NULL COMMENT '开奖号码',
`front_three_type` tinyint(1) NOT NULL COMMENT '前三类型\n1=>组6\n2=>组3',
`center_three_type` tinyint(1) NOT NULL COMMENT '中三类型\n1=>组6\n2=>组3',
`after_three_type` tinyint(1) NOT NULL COMMENT '后三类型\n1=>组6\n2=>组3',
`kj_time` char(50) DEFAULT NULL COMMENT '开奖时间',
`time` int(11) NOT NULL COMMENT '数据记录时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8 COMMENT='重庆时时彩';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `analysisCqssc`
--
DROP TABLE IF EXISTS `analysisCqssc`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `analysisCqssc` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`cqssc_id` int(11) NOT NULL COMMENT '重庆时时彩 数据分析表',
`front_three_lucky_txt` text COMMENT '前三 中奖号码',
`front_three_regret_txt` text COMMENT '前三 未中奖号码',
`center_three_lucky_txt` text COMMENT '中三中奖号',
`center_three_regret_txt` text COMMENT '中三未中奖号',
`after_three_lucky_txt` text COMMENT '后三中奖号码',
`after_three_regret_txt` text COMMENT '后三未中奖号码',
`data_txt` text COMMENT '当前导入的数据',
`type` int(11) NOT NULL DEFAULT '1' COMMENT '数据包\n1=>重庆时时彩数据包1\n2=>重庆时时彩数据包2',
`time` int(11) NOT NULL COMMENT '数据创建日期',
PRIMARY KEY (`id`),
KEY `fk_analysisCqssc_cqssc1_idx` (`cqssc_id`),
CONSTRAINT `fk_analysisCqssc_cqssc1` FOREIGN KEY (`cqssc_id`) REFERENCES `cqssc` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8 COMMENT='重庆时时彩分析';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `tjssc`
--
DROP TABLE IF EXISTS `tjssc`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `tjssc` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`qishu` char(20) NOT NULL COMMENT '开奖期数',
`one` tinyint(3) NOT NULL COMMENT '万位 第一位号码',
`two` tinyint(3) NOT NULL COMMENT '千位 第二位号码',
`three` tinyint(3) NOT NULL COMMENT '百位 第三位号码',
`four` tinyint(3) NOT NULL COMMENT '十位 第四位号码',
`five` tinyint(3) NOT NULL COMMENT '个位 第五位号码',
`code` char(20) NOT NULL COMMENT '开奖号码',
`front_three_type` tinyint(1) NOT NULL COMMENT '前三类型\n1=>组6\n2=>组3',
`center_three_type` tinyint(1) NOT NULL COMMENT '中三类型\n1=>组6\n2=>组3',
`after_three_type` tinyint(1) NOT NULL COMMENT '后三类型\n1=>组6\n2=>组3',
`kj_time` char(50) DEFAULT NULL COMMENT '开奖时间',
`time` int(11) NOT NULL COMMENT '数据记录时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8 COMMENT='天津时时彩';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `analysisTjssc`
--
DROP TABLE IF EXISTS `analysisTjssc`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `analysisTjssc` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`tjssc_id` int(11) NOT NULL COMMENT '天津时时彩开奖表主键id',
`front_three_lucky_txt` text COMMENT '前三 中奖号码',
`front_three_regret_txt` text COMMENT '前三 未中奖号码',
`center_three_lucky_txt` text COMMENT '中三中奖号',
`center_three_regret_txt` text COMMENT '中三未中奖号',
`after_three_lucky_txt` text COMMENT '后三中奖号码',
`after_three_regret_txt` text COMMENT '后三未中奖号码',
`data_txt` text COMMENT '当前导入的数据',
`type` int(11) NOT NULL DEFAULT '1' COMMENT '数据包\n1=>天津时时彩数据包1\n2=>天津时时彩数据包2',
`time` int(11) NOT NULL COMMENT '数据创建日期',
PRIMARY KEY (`id`),
KEY `fk_analysisTjssc_tjssc1_idx` (`tjssc_id`),
CONSTRAINT `fk_analysisTjssc_tjssc1` FOREIGN KEY (`tjssc_id`) REFERENCES `tjssc` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8 COMMENT='天津时时彩分析';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `xjssc`
--
DROP TABLE IF EXISTS `xjssc`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `xjssc` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`qishu` char(20) NOT NULL COMMENT '开奖期数',
`one` tinyint(3) NOT NULL COMMENT '万位 第一位号码',
`two` tinyint(3) NOT NULL COMMENT '千位 第二位号码',
`three` tinyint(3) NOT NULL COMMENT '百位 第三位号码',
`four` tinyint(3) NOT NULL COMMENT '十位 第四位号码',
`five` tinyint(3) NOT NULL COMMENT '个位 第五位号码',
`code` char(20) NOT NULL COMMENT '开奖号码',
`front_three_type` tinyint(1) NOT NULL COMMENT '前三类型\n1=>组6\n2=>组3',
`center_three_type` tinyint(1) NOT NULL COMMENT '中三类型\n1=>组6\n2=>组3',
`after_three_type` tinyint(1) NOT NULL COMMENT '后三类型\n1=>组6\n2=>组3',
`kj_time` char(50) DEFAULT NULL COMMENT '开奖时间',
`time` int(11) NOT NULL COMMENT '数据记录时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8 COMMENT='新疆时时彩';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `analysisXjssc`
--
DROP TABLE IF EXISTS `analysisXjssc`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `analysisXjssc` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`xjssc_id` int(11) NOT NULL COMMENT '新疆时时彩开奖表主键ID',
`front_three_lucky_txt` text COMMENT '前三 中奖号码',
`front_three_regret_txt` text COMMENT '前三 未中奖号码',
`center_three_lucky_txt` text COMMENT '中三中奖号',
`center_three_regret_txt` text COMMENT '中三未中奖号',
`after_three_lucky_txt` text COMMENT '后三中奖号码',
`after_three_regret_txt` text COMMENT '后三未中奖号码',
`data_txt` text COMMENT '当前导入的数据',
`type` int(11) NOT NULL DEFAULT '1' COMMENT '数据包\n1=>重庆时时彩数据包1\n2=>重庆时时彩数据包2',
`time` int(11) NOT NULL COMMENT '数据包\n1=>新疆时时彩数据包1\n2=>新疆时时彩数据包2',
PRIMARY KEY (`id`),
KEY `fk_analysisXjssc_xjssc1_idx` (`xjssc_id`),
CONSTRAINT `fk_analysisXjssc_xjssc1` FOREIGN KEY (`xjssc_id`) REFERENCES `xjssc` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8 COMMENT='新疆时时彩数据分析';
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2016-10-08 19:56:27
ALTER TABLE `grab`.`analysisTjssc`
CHANGE COLUMN `type` `type` INT(11) NOT NULL COMMENT '天津数据包id' ,
ADD INDEX `fk_analysisTjssc_tjssc1_idx` (`tjssc_id` ASC),
DROP INDEX `fk_analysisTjssc_tjssc1_idx` ;
ALTER TABLE `grab`.`analysisXjssc`
CHANGE COLUMN `type` `type` INT(11) NOT NULL COMMENT '新疆数据包id' ,
ADD INDEX `fk_analysisXjssc_xjssc1_idx` (`xjssc_id` ASC),
DROP INDEX `fk_analysisXjssc_xjssc1_idx` ;
ALTER TABLE `grab`.`analysisCqssc`
CHANGE COLUMN `type` `type` INT(11) NOT NULL COMMENT '重庆数据包id' ,
ADD INDEX `fk_analysisCqssc_cqssc1_idx` (`cqssc_id` ASC),
DROP INDEX `fk_analysisCqssc_cqssc1_idx` ;
|
<gh_stars>10-100
/* r1297 Index polls sql delete and extrafields upd */
UPDATE `cot_extra_fields` SET field_location = 'sed_users' WHERE field_location = 'users';
UPDATE `cot_extra_fields` SET field_location = 'sed_pages' WHERE field_location = 'pages';
DELETE FROM `cot_auth` WHERE auth_option = 'indexpolls';
DELETE FROM `cot_config` WHERE config_cat = 'indexpolls';
DELETE FROM `cot_plugins` WHERE pl_code = 'indexpolls';
|
<reponame>opengauss-mirror/Yat<gh_stars>0
-- @testpoint: sign函数入参为其它函数
select sign(replace('10','0',''));
select sign(power(2,3));
select sign(pi());
|
-- @testpoint:opengauss关键字deallocate(非保留),作为视图名
--关键字deallocate作为视图名,不带引号,创建成功
CREATE or replace VIEW deallocate AS
SELECT * FROM pg_tablespace WHERE spcname = 'pg_default';
drop view deallocate;
--关键字deallocate作为视图名,加双引号,创建成功
CREATE or replace VIEW "deallocate" AS
SELECT * FROM pg_tablespace WHERE spcname = 'pg_default';
drop VIEW "deallocate";
--关键字deallocate作为视图名,加单引号,合理报错
CREATE or replace VIEW 'deallocate' AS
SELECT * FROM pg_tablespace WHERE spcname = 'pg_default';
--关键字deallocate作为视图名,加反引号,合理报错
CREATE or replace VIEW `deallocate` AS
SELECT * FROM pg_tablespace WHERE spcname = 'pg_default';
|
SELECT * FROM fp_text_contents
WHERE text_content_id = :text_content_id;
|
USE hospital;
CREATE VIEW `v_high_paid_in_dep_4` AS
SELECT * FROM employees AS e WHERE e.department_id = 4 AND e.salary >= 1600
ORDER BY id;
SELECT * FROM v_high_paid_in_dep_4;
|
/* STORES */
INSERT INTO store(id, version, name, email, status) VALUES(1, 0, 'Brazil Store', '<EMAIL>', 'ACTIVE');
INSERT INTO store(id, version, name, email, status) VALUES(2, 0, 'Chile Store', '<EMAIL>', 'ACTIVE');
INSERT INTO store(id, version, name, email, status) VALUES(3, 0, 'German Store', '<EMAIL>', 'INACTIVE');
INSERT INTO store(id, version, name, email, status) VALUES(4, 0, 'Canada Store', '<EMAIL>', 'ACTIVE');
INSERT INTO store(id, version, name, email, status) VALUES(5, 0, 'Gana Store', '<EMAIL>', 'ACTIVE');
|
drop table `tasks` ON CASCADE;
drop table `limitations` ON CASCADE;
drop table `users` ON CASCADE;
|
---------------------------------------
-- Balances
---------------------------------------
DROP FUNCTION report_account_balances();
CREATE OR REPLACE FUNCTION report_account_balances() RETURNS TABLE(account TEXT, balance NUMERIC(11,2)) AS $$
DECLARE
BEGIN
RETURN QUERY SELECT activity.account, SUM(amount) as total FROM activity WHERE activity.account<>'' GROUP BY activity.account ORDER BY total DESC;
END;
$$ LANGUAGE plpgsql;
DROP FUNCTION report_subaccount_balances();
CREATE OR REPLACE FUNCTION report_subaccount_balances() RETURNS TABLE(subaccount TEXT, balance NUMERIC(11,2)) AS $$
DECLARE
BEGIN
RETURN QUERY SELECT activity.subaccount, SUM(amount) as total FROM activity WHERE activity.subaccount<>'' GROUP BY activity.subaccount ORDER BY total DESC;
END;
$$ LANGUAGE plpgsql;
DROP FUNCTION report_category_balances();
CREATE OR REPLACE FUNCTION report_category_balances() RETURNS TABLE(category TEXT, balance NUMERIC(11,2)) AS $$
DECLARE
BEGIN
RETURN QUERY SELECT activity.category, SUM(amount) as total FROM activity WHERE activity.category <>'' GROUP BY activity.category ORDER BY total DESC;
END;
$$ LANGUAGE plpgsql;
-- CREATE OR REPLACE FUNCTION "report_all"()
-- RETURNS SETOF refcursor AS $$
-- DECLARE
-- accountRC refcursor;
-- subaccountRC refcursor;
-- categoryRC refcursor;
-- BEGIN
-- open accountRC FOR
-- SELECT * FROM report_account_balances();
-- RETURN NEXT accountRC;
--
-- open subaccountRC FOR
-- SELECT * FROM report_subaccount_balances();
-- RETURN NEXT subaccountRC;
--
-- open categoryRC FOR
-- SELECT * FROM report_category_balances();
-- RETURN NEXT categoryRC;
--
-- RETURN;
-- END;
-- $$ LANGUAGE 'plpgsql' VOLATILE;
---------------------------------------
-- Budget Comparison
---------------------------------------
DROP FUNCTION report_month_spendings(int);
CREATE OR REPLACE FUNCTION report_month_spendings(months_ago Integer) RETURNS TABLE(category TEXT, percentage NUMERIC(2,2), spent NUMERIC(11,2), expected NUMERIC(11,2), leftover NUMERIC(11,2)) AS $$
DECLARE
total NUMERIC(11,2);
month_end DATE := date_trunc('month', now()::date) - (to_char(months_ago, '9999999999') || ' month')::INTERVAL;
month_start DATE := date_trunc('month', now()::date) - (to_char(months_ago+1, '9999999999') || ' month')::INTERVAL;
BEGIN
SELECT sum(amount) INTO total FROM activity WHERE amount < 0 AND day >= month_start AND day < month_end;
RETURN QUERY SELECT
activity.category as cat,
SUM(amount)/total as percentage,
0-SUM(amount) as spent,
budget.expected,
coalesce(budget.expected, 0) - (0-SUM(amount)) as leftover
FROM activity left join budget on activity.category = budget.item
WHERE
activity.category<>''
AND activity.amount<0
AND day >= month_start
AND day < month_end
GROUP BY activity.category, budget.expected order by spent desc;
END;
$$ LANGUAGE plpgsql;
|
<filename>electric-guitars.sql
--
-- PostgreSQL database dump
--
-- Dumped from database version 14.0
-- Dumped by pg_dump version 14.0
-- Started on 2021-10-30 20:39:11 CEST
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET xmloption = content;
SET client_min_messages = warning;
SET row_security = off;
--
-- TOC entry 832 (class 1247 OID 20298)
-- Name: bodytype; Type: TYPE; Schema: public; Owner: jurica
--
CREATE TYPE public.bodytype AS ENUM (
'solid',
'semi-hollow',
'hollowbody'
);
ALTER TYPE public.bodytype OWNER TO jurica;
--
-- TOC entry 835 (class 1247 OID 20306)
-- Name: bridgetype; Type: TYPE; Schema: public; Owner: jurica
--
CREATE TYPE public.bridgetype AS ENUM (
'floyd-rose',
'bigsby',
'vibrato',
'hardtail'
);
ALTER TYPE public.bridgetype OWNER TO jurica;
--
-- TOC entry 826 (class 1247 OID 20280)
-- Name: neckjointtype; Type: TYPE; Schema: public; Owner: jurica
--
CREATE TYPE public.neckjointtype AS ENUM (
'bolt-on',
'set'
);
ALTER TYPE public.neckjointtype OWNER TO jurica;
--
-- TOC entry 829 (class 1247 OID 20286)
-- Name: pickupconfiguration; Type: TYPE; Schema: public; Owner: jurica
--
CREATE TYPE public.pickupconfiguration AS ENUM (
'sss',
'ss',
'hh',
'hsh',
'hss'
);
ALTER TYPE public.pickupconfiguration OWNER TO jurica;
SET default_tablespace = '';
SET default_table_access_method = heap;
--
-- TOC entry 210 (class 1259 OID 20316)
-- Name: electricguitar; Type: TABLE; Schema: public; Owner: jurica
--
CREATE TABLE public.electricguitar (
id integer NOT NULL,
manufacturer text,
model text,
firstyearofproduction integer,
scalelengthinches real,
neckjointtype public.neckjointtype,
pickupconfigurations public.pickupconfiguration[],
bodytype public.bodytype,
stringcount integer,
bridgetype public.bridgetype
);
ALTER TABLE public.electricguitar OWNER TO jurica;
--
-- TOC entry 209 (class 1259 OID 20315)
-- Name: electricguitar_id_seq; Type: SEQUENCE; Schema: public; Owner: jurica
--
CREATE SEQUENCE public.electricguitar_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.electricguitar_id_seq OWNER TO jurica;
--
-- TOC entry 3609 (class 0 OID 0)
-- Dependencies: 209
-- Name: electricguitar_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: jurica
--
ALTER SEQUENCE public.electricguitar_id_seq OWNED BY public.electricguitar.id;
--
-- TOC entry 213 (class 1259 OID 20341)
-- Name: electricguitarguitarplayer; Type: TABLE; Schema: public; Owner: jurica
--
CREATE TABLE public.electricguitarguitarplayer (
guitarid integer,
playerid integer
);
ALTER TABLE public.electricguitarguitarplayer OWNER TO jurica;
--
-- TOC entry 212 (class 1259 OID 20333)
-- Name: guitarplayer; Type: TABLE; Schema: public; Owner: jurica
--
CREATE TABLE public.guitarplayer (
id integer NOT NULL,
firstname text,
lastname text
);
ALTER TABLE public.guitarplayer OWNER TO jurica;
--
-- TOC entry 211 (class 1259 OID 20332)
-- Name: guitarplayer_id_seq; Type: SEQUENCE; Schema: public; Owner: jurica
--
CREATE SEQUENCE public.guitarplayer_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.guitarplayer_id_seq OWNER TO jurica;
--
-- TOC entry 3610 (class 0 OID 0)
-- Dependencies: 211
-- Name: guitarplayer_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: jurica
--
ALTER SEQUENCE public.guitarplayer_id_seq OWNED BY public.guitarplayer.id;
--
-- TOC entry 3452 (class 2604 OID 20319)
-- Name: electricguitar id; Type: DEFAULT; Schema: public; Owner: jurica
--
ALTER TABLE ONLY public.electricguitar ALTER COLUMN id SET DEFAULT nextval('public.electricguitar_id_seq'::regclass);
--
-- TOC entry 3453 (class 2604 OID 20336)
-- Name: guitarplayer id; Type: DEFAULT; Schema: public; Owner: jurica
--
ALTER TABLE ONLY public.guitarplayer ALTER COLUMN id SET DEFAULT nextval('public.guitarplayer_id_seq'::regclass);
--
-- TOC entry 3600 (class 0 OID 20316)
-- Dependencies: 210
-- Data for Name: electricguitar; Type: TABLE DATA; Schema: public; Owner: jurica
--
COPY public.electricguitar (id, manufacturer, model, firstyearofproduction, scalelengthinches, neckjointtype, pickupconfigurations, bodytype, stringcount, bridgetype) FROM stdin;
1 Fender Stratocaster 1954 25.5 bolt-on {sss,hss,hsh} solid 6 vibrato
2 Fender Telecaster 1950 25.5 bolt-on {ss,hh} solid 6 hardtail
3 Ibanez JEM 1987 25.5 bolt-on {hsh} solid 6 floyd-rose
4 Ibanez JEM7 1988 25.5 bolt-on {hsh} solid 7 floyd-rose
5 Gibson <NAME> 1952 24.75 set {hh} solid 6 hardtail
6 Gibson ES335 1958 24.75 set {hh} semi-hollow 6 hardtail
7 Gibson ES175 1949 24.75 set {hh} hollowbody 6 hardtail
8 Gibson SG 1961 24.75 set {hh} solid 6 hardtail
9 Epiphone Casino 1961 24.75 set {hh} hollowbody 6 hardtail
10 Epiphone Sheraton 1959 24.75 set {hh} hollowbody 6 hardtail
\.
--
-- TOC entry 3603 (class 0 OID 20341)
-- Dependencies: 213
-- Data for Name: electricguitarguitarplayer; Type: TABLE DATA; Schema: public; Owner: jurica
--
COPY public.electricguitarguitarplayer (guitarid, playerid) FROM stdin;
1 13
1 14
1 15
1 24
1 28
2 17
2 19
3 16
4 16
5 15
5 17
5 19
5 24
5 28
6 13
6 15
6 17
6 20
6 21
7 25
7 26
8 20
8 15
9 18
9 22
10 28
\.
--
-- TOC entry 3602 (class 0 OID 20333)
-- Dependencies: 212
-- Data for Name: guitarplayer; Type: TABLE DATA; Schema: public; Owner: jurica
--
COPY public.guitarplayer (id, firstname, lastname) FROM stdin;
13 John Mayer
14 Jimi Hendrix
15 Eric Clapton
16 Steve Vai
17 Robben Ford
18 John Lennon
19 Jimmy Page
20 Larry Carlton
21 BB King
22 Gary Clark Jr
23 <NAME> Hooker
24 Mark Knopfler
25 Pat Metheney
26 Wes Montgomery
27 Keith Richards
28 Steve Lukather
\.
--
-- TOC entry 3611 (class 0 OID 0)
-- Dependencies: 209
-- Name: electricguitar_id_seq; Type: SEQUENCE SET; Schema: public; Owner: jurica
--
SELECT pg_catalog.setval('public.electricguitar_id_seq', 10, true);
--
-- TOC entry 3612 (class 0 OID 0)
-- Dependencies: 211
-- Name: guitarplayer_id_seq; Type: SEQUENCE SET; Schema: public; Owner: jurica
--
SELECT pg_catalog.setval('public.guitarplayer_id_seq', 28, true);
--
-- TOC entry 3455 (class 2606 OID 20323)
-- Name: electricguitar electricguitar_pkey; Type: CONSTRAINT; Schema: public; Owner: jurica
--
ALTER TABLE ONLY public.electricguitar
ADD CONSTRAINT electricguitar_pkey PRIMARY KEY (id);
--
-- TOC entry 3457 (class 2606 OID 20340)
-- Name: guitarplayer guitarplayer_pkey; Type: CONSTRAINT; Schema: public; Owner: jurica
--
ALTER TABLE ONLY public.guitarplayer
ADD CONSTRAINT guitarplayer_pkey PRIMARY KEY (id);
--
-- TOC entry 3458 (class 2606 OID 20344)
-- Name: electricguitarguitarplayer electricguitarguitarplayer_guitarid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: jurica
--
ALTER TABLE ONLY public.electricguitarguitarplayer
ADD CONSTRAINT electricguitarguitarplayer_guitarid_fkey FOREIGN KEY (guitarid) REFERENCES public.electricguitar(id) ON DELETE CASCADE;
--
-- TOC entry 3459 (class 2606 OID 20349)
-- Name: electricguitarguitarplayer electricguitarguitarplayer_playerid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: jurica
--
ALTER TABLE ONLY public.electricguitarguitarplayer
ADD CONSTRAINT electricguitarguitarplayer_playerid_fkey FOREIGN KEY (playerid) REFERENCES public.guitarplayer(id) ON DELETE CASCADE;
-- Completed on 2021-10-30 20:39:11 CEST
--
-- PostgreSQL database dump complete
--
|
----|--------------------------------------------------------------------------------
----| [UsersInRoles] - Backs up all the data from a table into a SQL script.
----|--------------------------------------------------------------------------------
--BEGIN TRANSACTION
IF (NOT EXISTS (SELECT * FROM UserInRole WHERE RoleName = 'Administrador' AND UserName = 'Admin'))
BEGIN
INSERT INTO UserInRole
([RoleName], [CreatedBy], [CreatedDate], [ModifiedBy], [ModifiedDate], [ActiveFlag], [UserName])
VALUES
('Administrador', 'Admin', '04/08/2010 23:54:52', 'Admin', '04/08/2010 23:54:52', 0, 'Admin');
END
--IF @@ERROR <> 0 ROLLBACK TRANSACTION;
--ELSE COMMIT TRANSACTION;
--GO
----|--------------------------------------------------------------------------------
|
-- phpMyAdmin SQL Dump
-- version 4.7.4
-- https://www.phpmyadmin.net/
--
-- Máy chủ: 127.0.0.1
-- Thời gian đã tạo: Th10 15, 2017 lúc 05:24 PM
-- Phiên bản máy phục vụ: 10.1.26-MariaDB
-- Phiên bản PHP: 7.1.9
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Cơ sở dữ liệu: `blog_db`
--
-- --------------------------------------------------------
--
-- Cấu trúc bảng cho bảng `catagories`
--
CREATE TABLE `catagories` (
`id` int(10) UNSIGNED NOT NULL,
`name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Đang đổ dữ liệu cho bảng `catagories`
--
INSERT INTO `catagories` (`id`, `name`, `created_at`, `updated_at`) VALUES
(6, 'Lorem Ipsum', '2017-10-15 05:18:06', '2017-10-15 05:18:06'),
(7, 'Laravel', '2017-10-15 06:10:15', '2017-10-15 06:10:15');
-- --------------------------------------------------------
--
-- Cấu trúc bảng cho bảng `contacts`
--
CREATE TABLE `contacts` (
`id` int(10) UNSIGNED NOT NULL,
`name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`email` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`message` text COLLATE utf8mb4_unicode_ci NOT NULL,
`read` tinyint(1) NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Đang đổ dữ liệu cho bảng `contacts`
--
INSERT INTO `contacts` (`id`, `name`, `email`, `message`, `read`, `created_at`, `updated_at`) VALUES
(2, 'banghia', '<EMAIL>', 'kho nhi', 1, '2017-10-15 00:23:45', '2017-10-15 01:11:07'),
(3, 'banghia', '<EMAIL>', 'test gui lan 2', 0, '2017-10-15 01:28:35', '2017-10-15 01:28:35'),
(4, 'ba nghia', '<EMAIL>', 'tin nhan dep trai nay', 1, '2017-10-15 04:15:06', '2017-10-15 05:53:03');
-- --------------------------------------------------------
--
-- Cấu trúc bảng cho bảng `migrations`
--
CREATE TABLE `migrations` (
`id` int(10) UNSIGNED NOT NULL,
`migration` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`batch` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Đang đổ dữ liệu cho bảng `migrations`
--
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES
(13, '2014_10_12_000000_create_users_table', 1),
(14, '2014_10_12_100000_create_password_resets_table', 1),
(15, '2017_10_14_020457_create_catagories_table', 1),
(16, '2017_10_14_023428_create_posts_table', 1),
(17, '2017_10_15_010155_create_tags_table', 1),
(18, '2017_10_15_012859_create_post_tag_table', 1),
(19, '2017_10_15_063933_create_contacts_table', 2);
-- --------------------------------------------------------
--
-- Cấu trúc bảng cho bảng `password_resets`
--
CREATE TABLE `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
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- Cấu trúc bảng cho bảng `posts`
--
CREATE TABLE `posts` (
`id` int(10) UNSIGNED NOT NULL,
`title` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`description` text COLLATE utf8mb4_unicode_ci NOT NULL,
`content` text COLLATE utf8mb4_unicode_ci NOT NULL,
`thumb` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`catagory_id` int(10) UNSIGNED DEFAULT NULL,
`slug` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Đang đổ dữ liệu cho bảng `posts`
--
INSERT INTO `posts` (`id`, `title`, `description`, `content`, `thumb`, `catagory_id`, `slug`, `created_at`, `updated_at`) VALUES
(6, 'Lorem Ipsum', '\"Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit...\" \"There is no one who loves pain itself, who seeks after it and wants to have it, simply because it is pain...\"', '<p><strong>The standard Lorem Ipsum passage, used since the 1500s</strong></p>\r\n\r\n<p>\"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.\"</p>\r\n\r\n<p><strong>Section 1.10.32 of \"de Finibus Bonorum et Malorum\", written by Cicero in 45 BC</strong></p>\r\n\r\n<p>\"Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?\"</p>\r\n\r\n<p><strong>1914 translation by <NAME></strong></p>\r\n\r\n<p>\"But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but because occasionally circumstances occur in which toil and pain can procure him some great pleasure. To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure?\"</p>\r\n\r\n<p><strong>Section 1.10.33 of \"de Finibus Bonorum et Malorum\", written by Cicero in 45 BC</strong></p>\r\n\r\n<p>\"At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Temporibus autem quibusdam et aut officiis debitis aut rerum necessitatibus saepe eveniet ut et voluptates repudiandae sint et molestiae non recusandae. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.\"</p>\r\n\r\n<p><strong>1914 translation by <NAME></strong></p>\r\n\r\n<p>\"On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammelled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted. The wise man therefore always holds in these matters to this principle of selection: he rejects pleasures to secure other greater pleasures, or else he endures pains to avoid worse pains.\"</p>', 'vYbTnMKEK5xfg9eQZtYi8LnOE7VMsUq8MRvXPhmX.jpeg', 6, 'lorem-ipsum', '2017-10-15 05:20:15', '2017-10-15 05:21:38'),
(8, 'Lorem Ipsum 2', 'Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit...\" \"There is no one who loves pain itself, who seeks after it and wants to have it, simply because it is pain...\"', '<p><strong>The standard Lorem Ipsum passage, used since the 1500s</strong></p>\r\n\r\n<p>\"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.\"</p>\r\n\r\n<p><strong>Section 1.10.32 of \"de Finibus Bonorum et Malorum\", written by Cicero in 45 BC</strong></p>\r\n\r\n<p>\"Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?\"</p>\r\n\r\n<p><strong>1914 translation by <NAME></strong></p>\r\n\r\n<p>\"But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but because occasionally circumstances occur in which toil and pain can procure him some great pleasure. To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure?\"</p>\r\n\r\n<p><strong>Section 1.10.33 of \"de Finibus Bonorum et Malorum\", written by Cicero in 45 BC</strong></p>\r\n\r\n<p>\"At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Temporibus autem quibusdam et aut officiis debitis aut rerum necessitatibus saepe eveniet ut et voluptates repudiandae sint et molestiae non recusandae. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.\"</p>\r\n\r\n<p><strong>1914 translation by <NAME></strong></p>\r\n\r\n<p>\"On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammelled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted. The wise man therefore always holds in these matters to this principle of selection: he rejects pleasures to secure other greater pleasures, or else he endures pains to avoid worse pains.\"</p>', '99mHqnYX2DPupqunFJRNPIOagc6j8M57P0rYCeHT.jpeg', 6, 'lorem-ipsum-2', '2017-10-15 06:07:02', '2017-10-15 06:07:02'),
(10, 'Lorem Ipsum 4', '\"Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit...\" \"There is no one who loves pain itself, who seeks after it and wants to have it, simply because it is pain...\"', '<p><strong>The standard Lorem Ipsum passage, used since the 1500s</strong></p>\r\n\r\n<p>\"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.\"</p>\r\n\r\n<p><strong>Section 1.10.32 of \"de Finibus Bonorum et Malorum\", written by Cicero in 45 BC</strong></p>\r\n\r\n<p>\"Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?\"</p>\r\n\r\n<p><strong>1914 translation by <NAME></strong></p>\r\n\r\n<p>\"But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but because occasionally circumstances occur in which toil and pain can procure him some great pleasure. To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure?\"</p>\r\n\r\n<p><strong>Section 1.10.33 of \"de Finibus Bonorum et Malorum\", written by Cicero in 45 BC</strong></p>\r\n\r\n<p>\"At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Temporibus autem quibusdam et aut officiis debitis aut rerum necessitatibus saepe eveniet ut et voluptates repudiandae sint et molestiae non recusandae. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.\"</p>\r\n\r\n<p><strong>1914 translation by <NAME></strong></p>\r\n\r\n<p>\"On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammelled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted. The wise man therefore always holds in these matters to this principle of selection: he rejects pleasures to secure other greater pleasures, or else he endures pains to avoid worse pains.\"</p>', 'v6FAxGuEInKwEPG4zlTjI8m4uApz46Jmd5zFoFq8.jpeg', 6, 'lorem-ipsum-4', '2017-10-15 06:08:30', '2017-10-15 06:08:30'),
(11, 'Lorem Ipsum 3', '\"Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit...\" \"There is no one who loves pain itself, who seeks after it and wants to have it, simply because it is pain...\"', '<p>The standard Lorem Ipsum passage, used since the 1500s</p>\r\n\r\n<p>\"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.\"</p><p>Section 1.10.32 of \"de Finibus Bonorum et Malorum\", written by Cicero in 45 BC</p>\r\n\r\n<p>\"Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?\"</p><p>1914 translation by <NAME></p>\r\n\r\n<p>\"But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but because occasionally circumstances occur in which toil and pain can procure him some great pleasure. To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure?\"</p><p>Section 1.10.33 of \"de Finibus Bonorum et Malorum\", written by Cicero in 45 BC</p>\r\n\r\n<p>\"At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Temporibus autem quibusdam et aut officiis debitis aut rerum necessitatibus saepe eveniet ut et voluptates repudiandae sint et molestiae non recusandae. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.\"</p><p>1914 translation by <NAME></p>\r\n\r\n<p>\"On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammelled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted. The wise man therefore always holds in these matters to this principle of selection: he rejects pleasures to secure other greater pleasures, or else he endures pains to avoid worse pains.\"</p>', 'bOBALH8PImMo1stgeG0Yc8pSQiDqFFge3E9mVkwB.jpeg', 6, 'lorem-ipsum-3', '2017-10-15 06:09:30', '2017-10-15 06:09:30'),
(12, 'Lorem Ipsum 5', '\"Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit...\" \"There is no one who loves pain itself, who seeks after it and wants to have it, simply because it is pain...\"', '<p>The standard Lorem Ipsum passage, used since the 1500s</p>\r\n\r\n<p>\"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.\"</p><p>Section 1.10.32 of \"de Finibus Bonorum et Malorum\", written by Cicero in 45 BC</p>\r\n\r\n<p>\"Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?\"</p><p>1914 translation by <NAME></p>\r\n\r\n<p>\"But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but because occasionally circumstances occur in which toil and pain can procure him some great pleasure. To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure?\"</p><p>Section 1.10.33 of \"de Finibus Bonorum et Malorum\", written by Cicero in 45 BC</p>\r\n\r\n<p>\"At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Temporibus autem quibusdam et aut officiis debitis aut rerum necessitatibus saepe eveniet ut et voluptates repudiandae sint et molestiae non recusandae. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.\"</p><p>1914 translation by <NAME></p>\r\n\r\n<p>\"On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammelled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted. The wise man therefore always holds in these matters to this principle of selection: he rejects pleasures to secure other greater pleasures, or else he endures pains to avoid worse pains.\"</p>', '2SSPaZj2IMj2cVWOdzeHtMlXW4FncWsrKvF5dNLO.jpeg', 7, 'lorem-ipsum-5', '2017-10-15 06:11:16', '2017-10-15 06:11:16'),
(13, 'Lorem Ipsum Lorem Ipsum', '\"Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit...\" \"There is no one who loves pain itself, who seeks after it and wants to have it, simply because it is pain...\"', '<p>The standard Lorem Ipsum passage, used since the 1500s</p>\r\n\r\n<p>\"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.\"</p><p>Section 1.10.32 of \"de Finibus Bonorum et Malorum\", written by Cicero in 45 BC</p>\r\n\r\n<p>\"Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?\"</p><p>1914 translation by H. Rackham</p>\r\n\r\n<p>\"But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but because occasionally circumstances occur in which toil and pain can procure him some great pleasure. To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure?\"</p><p>Section 1.10.33 of \"de Finibus Bonorum et Malorum\", written by Cicero in 45 BC</p>\r\n\r\n<p>\"At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Temporibus autem quibusdam et aut officiis debitis aut rerum necessitatibus saepe eveniet ut et voluptates repudiandae sint et molestiae non recusandae. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.\"</p><p>1914 translation by <NAME></p>\r\n\r\n<p>\"On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammelled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted. The wise man therefore always holds in these matters to this principle of selection: he rejects pleasures to secure other greater pleasures, or else he endures pains to avoid worse pains.\"</p>', 'cSV5wos137vxXOxwl9qd84yLMHR3SgAs7x0KUB5M.jpeg', 7, 'lorem-ipsum-lorem-ipsum', '2017-10-15 06:12:24', '2017-10-15 06:12:24');
-- --------------------------------------------------------
--
-- Cấu trúc bảng cho bảng `post_tag`
--
CREATE TABLE `post_tag` (
`id` int(10) UNSIGNED NOT NULL,
`post_id` int(10) UNSIGNED NOT NULL,
`tag_id` int(10) UNSIGNED NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Đang đổ dữ liệu cho bảng `post_tag`
--
INSERT INTO `post_tag` (`id`, `post_id`, `tag_id`, `created_at`, `updated_at`) VALUES
(30, 6, 8, NULL, NULL),
(31, 6, 9, NULL, NULL),
(32, 6, 10, NULL, NULL),
(33, 8, 8, NULL, NULL),
(34, 8, 9, NULL, NULL),
(35, 11, 9, NULL, NULL),
(36, 12, 11, NULL, NULL),
(37, 13, 8, NULL, NULL),
(38, 13, 9, NULL, NULL),
(39, 13, 10, NULL, NULL),
(40, 13, 11, NULL, NULL);
-- --------------------------------------------------------
--
-- Cấu trúc bảng cho bảng `tags`
--
CREATE TABLE `tags` (
`id` int(10) UNSIGNED NOT NULL,
`name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Đang đổ dữ liệu cho bảng `tags`
--
INSERT INTO `tags` (`id`, `name`, `created_at`, `updated_at`) VALUES
(8, 'Lorem Ipsum', '2017-10-15 05:18:15', '2017-10-15 05:18:15'),
(9, 'web', '2017-10-15 05:18:23', '2017-10-15 05:18:23'),
(10, 'php', '2017-10-15 05:18:28', '2017-10-15 05:18:28'),
(11, 'Laravel', '2017-10-15 06:10:02', '2017-10-15 06:10:02');
-- --------------------------------------------------------
--
-- Cấu trúc bảng cho bảng `users`
--
CREATE TABLE `users` (
`id` int(10) UNSIGNED NOT NULL,
`name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`email` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`password` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`remember_token` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Đang đổ dữ liệu cho bảng `users`
--
INSERT INTO `users` (`id`, `name`, `email`, `password`, `remember_token`, `created_at`, `updated_at`) VALUES
(1, 'admin', '<EMAIL>', <PASSWORD>', 'clXqOCwc18CA8LLTHgcqpwW0bByJXk1mVVTIjfFLKG60PKaItmiUAAMKvu44', '2017-10-14 22:45:20', '2017-10-14 22:45:20');
--
-- Chỉ mục cho các bảng đã đổ
--
--
-- Chỉ mục cho bảng `catagories`
--
ALTER TABLE `catagories`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `catagories_name_unique` (`name`);
--
-- Chỉ mục cho bảng `contacts`
--
ALTER TABLE `contacts`
ADD PRIMARY KEY (`id`);
--
-- Chỉ mục cho bảng `migrations`
--
ALTER TABLE `migrations`
ADD PRIMARY KEY (`id`);
--
-- Chỉ mục cho bảng `password_resets`
--
ALTER TABLE `password_resets`
ADD KEY `password_resets_email_index` (`email`);
--
-- Chỉ mục cho bảng `posts`
--
ALTER TABLE `posts`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `posts_slug_unique` (`slug`),
ADD KEY `posts_catagory_id_foreign` (`catagory_id`);
--
-- Chỉ mục cho bảng `post_tag`
--
ALTER TABLE `post_tag`
ADD PRIMARY KEY (`id`),
ADD KEY `post_tag_post_id_foreign` (`post_id`),
ADD KEY `post_tag_tag_id_foreign` (`tag_id`);
--
-- Chỉ mục cho bảng `tags`
--
ALTER TABLE `tags`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `tags_name_unique` (`name`);
--
-- Chỉ mục cho bảng `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `users_email_unique` (`email`);
--
-- AUTO_INCREMENT cho các bảng đã đổ
--
--
-- AUTO_INCREMENT cho bảng `catagories`
--
ALTER TABLE `catagories`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;
--
-- AUTO_INCREMENT cho bảng `contacts`
--
ALTER TABLE `contacts`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT cho bảng `migrations`
--
ALTER TABLE `migrations`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=20;
--
-- AUTO_INCREMENT cho bảng `posts`
--
ALTER TABLE `posts`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=14;
--
-- AUTO_INCREMENT cho bảng `post_tag`
--
ALTER TABLE `post_tag`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=41;
--
-- AUTO_INCREMENT cho bảng `tags`
--
ALTER TABLE `tags`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12;
--
-- AUTO_INCREMENT cho bảng `users`
--
ALTER TABLE `users`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- Các ràng buộc cho các bảng đã đổ
--
--
-- Các ràng buộc cho bảng `posts`
--
ALTER TABLE `posts`
ADD CONSTRAINT `posts_catagory_id_foreign` FOREIGN KEY (`catagory_id`) REFERENCES `catagories` (`id`);
--
-- Các ràng buộc cho bảng `post_tag`
--
ALTER TABLE `post_tag`
ADD CONSTRAINT `post_tag_post_id_foreign` FOREIGN KEY (`post_id`) REFERENCES `posts` (`id`),
ADD CONSTRAINT `post_tag_tag_id_foreign` FOREIGN KEY (`tag_id`) REFERENCES `tags` (`id`);
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
<filename>src/templates/insert/departement/2_trigger.sql
DROP TRIGGER IF EXISTS InsertTempDepartement ON tempDepartement;
CREATE TRIGGER InsertTempDepartement
AFTER INSERT ON tempDepartement
FOR EACH ROW EXECUTE PROCEDURE insert_departement();
|
/* Standout Suggestion 2
Create a view that returns all employee attributes;
results should resemble initial Excel file
*/
CREATE VIEW v_employee AS
SELECT emp.emp_id AS "emp_id",
emp.emp_nm AS "emp_nm",
emp.email AS "email",
emp.hire_dt AS "hire_dt",
job.job_title AS "job_title",
sal.value AS "salary",
dep.dep_nm AS "department",
(SELECT emp_nm
FROM Employee
WHERE emp_id = eh.manager_id) AS "manager",
eh.start_dt AS "start_dt",
eh.end_dt AS "end_dt",
loc.loc_nm AS "location",
addr.addr_nm AS "address",
ci.city_nm AS "city",
st.state_nm AS "state",
edu.edu_level AS "education_level"
FROM EmployeeHistory AS eh
JOIN Employee AS emp
ON eh.emp_id = emp.emp_id
JOIN Education AS edu
ON emp.edu_id = edu.edu_id
JOIN JobPosition AS job
ON eh.job_id = job.job_id
JOIN Department AS dep
ON eh.dep_id = dep.dep_id
JOIN Salary AS sal
ON eh.salary_id = sal.salary_id
JOIN Address AS addr
ON eh.addr_id = addr.addr_id
JOIN City AS ci
ON addr.city_id = ci.city_id
JOIN State AS st
ON st.state_id = ci.state_id
JOIN Location AS loc
ON st.loc_id = loc.loc_id ;
/* Standout Suggestion 2
Create a stored procedure with parameters that returns current and past jobs
(include employee name, job title, department, manager name, start and end date for position)
when given an employee name. for employee <NAME>.
*/
create or replace function GetAllJobs
(in _empName character varying)
RETURNS TABLE (
Employee character varying,
Job_Title character varying,
Department character varying,
Manager character varying,
StartDate date,
EndDate date
)
as $$
SELECT emp.emp_nm as Employee,
job.job_title as Job_Title,
dep.dep_nm as Department,
(SELECT emp_nm
FROM Employee
WHERE emp_id = eh.manager_id) as Manager,
eh.start_dt as StartDate,
eh.end_dt as EndDate
FROM EmployeeHistory AS eh
JOIN Employee AS emp
ON eh.emp_id = emp.emp_id
JOIN JobPosition AS job
ON eh.job_id = job.job_id
JOIN Department AS dep
ON eh.dep_id = dep.dep_id
WHERE emp.emp_nm = _empName;
$$
LANGUAGE SQL;
/* Standout Suggestion 3
Implement user security on the restricted salary attribute.
Create a non-management user named NoMgr.
*/
CREATE ROLE noManager;
GRANT CONNECT ON DATABASE postgres TO noManager;
GRANT SELECT ON ALL TABLES IN SCHEMA Public to noManager;
REVOKE SELECT ON TABLE salary FROM noManager;
CREATE USER NoMgr WITH PASSWORD '<PASSWORD>';
GRANT noManager TO NoMgr;
|
--SELECT "TableroSistemaPenal_1"."MOT_TERMINO" AS "MOT_TERMINO" FROM "TableroSistemaPenal_1" GROUP BY 1 ORDER BY "MOT_TERMINO" ASC ;
|
CREATE TABLE "contacts" (
"id" INTEGER PRIMARY KEY AUTOINCREMENT,
"first_name" TEXT,
"last_name" TEXT,
"company" TEXT,
"address" TEXT,
"city" TEXT,
"county" TEXT,
"postal" TEXT,
"phone1" TEXT,
"phone2" TEXT,
"created_at" TEXT NOT NULL,
"updated_at" TEXT NOT NULL
)
|
<reponame>leoiii12/neo4j-network-text-analysis<gh_stars>1-10
MATCH path = (:Word)-[:NEXT]->(:Word)
WITH path
WITH collect(path) as paths
call apoc.gephi.add(null, 'workspace1', paths) yield nodes, relationships, time
RETURN nodes, relationships, time
|
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[DF_WebOffice_Name]') AND type = 'D')
BEGIN
ALTER TABLE [dbo].[WebOffice] DROP CONSTRAINT [DF_WebOffice_Name]
END
GO
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[DF_WebOffice_ParentId]') AND type = 'D')
BEGIN
ALTER TABLE [dbo].[WebOffice] DROP CONSTRAINT [DF_WebOffice_ParentId]
END
GO
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[DF_WebOffice_AddressLine1]') AND type = 'D')
BEGIN
ALTER TABLE [dbo].[WebOffice] DROP CONSTRAINT [DF_WebOffice_AddressLine1]
END
GO
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[DF_WebOffice_MobileNumber]') AND type = 'D')
BEGIN
ALTER TABLE [dbo].[WebOffice] DROP CONSTRAINT [DF_WebOffice_MobileNumber]
END
GO
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[DF_WebOffice_PhoneNumber]') AND type = 'D')
BEGIN
ALTER TABLE [dbo].[WebOffice] DROP CONSTRAINT [DF_WebOffice_PhoneNumber]
END
GO
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[DF_WebOffice_EmailAddress]') AND type = 'D')
BEGIN
ALTER TABLE [dbo].[WebOffice] DROP CONSTRAINT [DF_WebOffice_EmailAddress]
END
GO
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[DF_WebOffice_ContactPersonId]') AND type = 'D')
BEGIN
ALTER TABLE [dbo].[WebOffice] DROP CONSTRAINT [DF_WebOffice_ContactPersonId]
END
GO
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[WebOffice]') AND type in (N'U'))
DROP TABLE [dbo].[WebOffice]
GO
|
<gh_stars>1-10
-- phpMyAdmin SQL Dump
-- version 4.5.1
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: Nov 05, 2016 at 09:45 AM
-- Server version: 10.1.13-MariaDB
-- PHP Version: 5.5.35
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 utf8mb4 */;
--
-- Database: `house_rent_db`
--
-- --------------------------------------------------------
--
-- Table structure for table `tbl_flat`
--
CREATE TABLE `tbl_flat` (
`id` int(11) NOT NULL,
`flat_name` varchar(20) NOT NULL,
`owner_username` varchar(20) NOT NULL,
`location_details` varchar(100) DEFAULT NULL,
`location_id` int(11) NOT NULL,
`flat_type` varchar(20) NOT NULL,
`masterbed` int(11) NOT NULL,
`bed` int(11) NOT NULL,
`balcony` int(11) NOT NULL,
`washroom` int(11) NOT NULL,
`flat_details` varchar(200) DEFAULT NULL,
`flat_price` int(11) NOT NULL,
`isPublished` int(11) NOT NULL,
`available_from` varchar(50) DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Dumping data for table `tbl_flat`
--
INSERT INTO `tbl_flat` (`id`, `flat_name`, `owner_username`, `location_details`, `location_id`, `flat_type`, `masterbed`, `bed`, `balcony`, `washroom`, `flat_details`, `flat_price`, `isPublished`, `available_from`, `created_at`, `updated_at`) VALUES
(1, 'F121', 'shovon', NULL, 2, 'Family', 1, 3, 2, 2, NULL, 20000, 1, '07-November-2016', '2016-11-04 12:12:42', '2016-11-05 07:29:04'),
(2, 'aaaaaaaa', 'shovon', 'aaaaaaaaaaaaaaa', 1, 'Family', 2, 2, 1, 0, 'aaaaaaaa', 1111111111, 1, '30-November-2016', '2016-11-04 12:17:48', '2016-11-05 07:18:10'),
(3, 'F121', 'shovon', 'aaaaaaaaaaaaaaa', 2, 'Family', 0, 0, 0, 0, 'aaaaaaaa', 1234, 1, '27-November-2016', '2016-11-04 12:26:15', '2016-11-05 07:18:04'),
(4, 'F1212', 'shovon', 'aaaaaaaaaaaaaaa', 2, 'Bechelor', 0, 0, 0, 0, 'aaaaaaaa', 1234, 1, '28-November-2016', '2016-11-04 12:29:12', '2016-11-05 07:17:57'),
(5, 'F12100', 'shovon', 'sssssss', 1, 'Family', 0, 3, 0, 0, 'aaaaaaaa', 100, 1, '06-November-2016', '2016-11-04 15:18:59', '2016-11-05 07:17:50');
-- --------------------------------------------------------
--
-- Table structure for table `tbl_location`
--
CREATE TABLE `tbl_location` (
`id` int(11) NOT NULL,
`location` varchar(30) NOT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `tbl_location`
--
INSERT INTO `tbl_location` (`id`, `location`, `created_at`, `updated_at`) VALUES
(1, 'Dhaka', '2016-11-03 07:11:33', '2016-11-03 07:11:33'),
(2, 'Chittagong', '2016-11-03 07:11:33', '2016-11-03 07:11:33'),
(3, 'Rajshahi', '2016-11-03 07:15:48', '2016-11-03 07:15:48');
-- --------------------------------------------------------
--
-- Table structure for table `tbl_owner`
--
CREATE TABLE `tbl_owner` (
`id` int(11) NOT NULL,
`username` varchar(20) NOT NULL,
`password` varchar(100) NOT NULL,
`user_role` int(11) NOT NULL DEFAULT '0',
`email` varchar(40) NOT NULL,
`mobile` int(20) NOT NULL,
`createdat` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updatedat` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `tbl_owner`
--
INSERT INTO `tbl_owner` (`id`, `username`, `password`, `user_role`, `email`, `mobile`, `createdat`, `updatedat`) VALUES
(1, 'shovon', '123456', 0, '<EMAIL>', 1675954877, '2016-11-03 18:39:27', '2016-11-03 18:39:27'),
(2, 'shovon1', '123456', 0, '<EMAIL>', 1675954877, '2016-11-03 18:44:32', '2016-11-03 18:44:32'),
(3, 'asif', '123456', 0, '<EMAIL>', 165, '2016-11-03 18:49:07', '2016-11-03 18:49:07'),
(4, 'asif2', '<PASSWORD>', 0, '<EMAIL>', 54564, '2016-11-03 18:50:17', '2016-11-03 18:50:17'),
(5, 'aaaaa', '12345', 0, '<EMAIL>', 16, '2016-11-04 06:00:12', '2016-11-04 06:00:12'),
(6, 'admin', 'admin', 1, '<EMAIL>', 1675, '2016-11-04 09:54:38', '2016-11-04 09:54:38');
-- --------------------------------------------------------
--
-- Table structure for table `tbl_rating`
--
CREATE TABLE `tbl_rating` (
`id` int(11) NOT NULL,
`flat_id` int(11) NOT NULL,
`rating` double NOT NULL,
`total_view` int(11) NOT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `tbl_sublocation`
--
CREATE TABLE `tbl_sublocation` (
`id` int(11) NOT NULL,
`location_id` int(11) NOT NULL,
`sublocation` varchar(30) NOT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `tbl_sublocation`
--
INSERT INTO `tbl_sublocation` (`id`, `location_id`, `sublocation`, `created_at`, `updated_at`) VALUES
(1, 1, 'Mirpur', '2016-11-03 07:36:22', '2016-11-03 07:36:22'),
(2, 1, 'Dhanmondi', '2016-11-03 07:36:22', '2016-11-03 07:36:22');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `tbl_flat`
--
ALTER TABLE `tbl_flat`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `tbl_location`
--
ALTER TABLE `tbl_location`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `tbl_owner`
--
ALTER TABLE `tbl_owner`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `username` (`username`);
--
-- Indexes for table `tbl_rating`
--
ALTER TABLE `tbl_rating`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `tbl_sublocation`
--
ALTER TABLE `tbl_sublocation`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `tbl_flat`
--
ALTER TABLE `tbl_flat`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
--
-- AUTO_INCREMENT for table `tbl_location`
--
ALTER TABLE `tbl_location`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT for table `tbl_owner`
--
ALTER TABLE `tbl_owner`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
--
-- AUTO_INCREMENT for table `tbl_rating`
--
ALTER TABLE `tbl_rating`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `tbl_sublocation`
--
ALTER TABLE `tbl_sublocation`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=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 */;
|
select id from deal_links
update accounts set asset_kind = credit_card where type = CreditCard
update accounts set asset_kind = capital_fund where type = CapitalFund
update accounts set type = CaptitalFund where account_type_code = 1
update users set type = LoginEngineUser where verified = 1
update deals set updated_at = created_at where updated_at is null
select user_id, friend_user_id, friend_level from friends
select sum(amount) from account_entries inner join deals on account_entries.deal_id = deals.id where account_entries.account_id = ? and (deals.date < ? or (deals.date = ? and deals.daily_seq < ?)) and deals.confirmed = ?;
update accounts set type = CapitalFund where type = CaptitalFund
select account_id, user_id, target_user_id, target_ex_account_id from account_links
update deals set type = Deal where type = General
update deals set created_at = timestamp where created_at is null
select id from accounts where type not in ('Income', 'Account::Income', 'Expense', 'Account::Expense')
update accounts set asset_kind = cache where type = Cache
update accounts set type = Cache where account_type_code = 1
SELECT id, summary FROM deals;
select user_id, target_id from friend_permissions where type = 'Acceptance'
select id from accounts;
update accounts set asset_kind = credit where type = Credit
update accounts set asset_kind = banking_facility where type = BankingFacility
select id, asset_kind from accounts where asset_kind is not null
update users set salted_password = <PASSWORD> where type = LoginEngineUser
SELECT id, deal_id, amount FROM account_entries WHERE type = 'Entry::General' ORDER BY deal_id, id
select friend_link_id from account_entries where id = #{id} and friend_link_id is not null
select user_id, target_id, type from friend_permissions
select id, user_id, linked_ex_entry_id, linked_user_id, friend_link_id from account_entries where linked_ex_entry_id is not null
update accounts set type = Credit where account_type_code = 1
update accounts set type = Expense where account_type_code = 2
select id, deal_id, user_id from account_entries where friend_link_id = #{deal_link_id}
select max(id) from deal_links
update accounts set type = CaptitalFund where type = CapitalFund
update accounts set type = Income where account_type_code = 3
update deals set type = General where type = Deal
update account_entries set date = ?, daily_seq = ? where deal_id = ?
update users set crypted_password = <PASSWORD> where type = LoginEngineUser
update accounts set type = BankingFacility where account_type_code = 1
update accounts set type = CreditCard where account_type_code = 1
update deals set type=Deal where type=SubordinateDeal
update users set verified = 1 where activated_at is not null
select id, date, daily_seq from deals
|
<gh_stars>1-10
DROP DATABASE IF EXISTS DATA_BASE_NAME;
--SEP--
CREATE DATABASE DATA_BASE_NAME
WITH OWNER = postgres
ENCODING = 'UTF8'
TABLESPACE = pg_default
CONNECTION LIMIT = -1;
|
alter table egbpa_occupancy_certificate add column approvaldate date;
|
-- https://www.hackerrank.com/challenges/weather-observation-station-10/problem
SELECT DISTINCT(CITY) FROM STATION WHERE
RIGHT(CITY, 1)
NOT IN ('a', 'e', 'i', 'o', 'u');
|
<reponame>piougy/CzechIdMng
--
-- CzechIdM 10.0.0 Flyway script
-- BCV solutions s.r.o.
--
-- Test resources for tests with flyway enabled
CREATE TABLE test_contract_resource (
id varchar(255) NOT NULL,
description varchar(255) NULL,
disabled varchar(255) NULL,
leader varchar(255) NULL,
main varchar(255) NULL,
modified timestamp NULL,
name varchar(255) NULL,
"owner" varchar(255) NULL,
positions varchar(255) NULL,
state varchar(255) NULL,
validfrom date NULL,
validtill date NULL,
workposition varchar(255) NULL,
CONSTRAINT test_contract_resource_pkey PRIMARY KEY (id)
);
CREATE TABLE test_contract_slice_resource (
id varchar(255) NOT NULL,
contract_code varchar(255) NULL,
description varchar(255) NULL,
disabled varchar(255) NULL,
leader varchar(255) NULL,
main varchar(255) NULL,
modified timestamp NULL,
name varchar(255) NULL,
"owner" varchar(255) NULL,
state varchar(255) NULL,
validfrom date NULL,
validfrom_slice date NULL,
validtill date NULL,
workposition varchar(255) NULL,
CONSTRAINT test_contract_slice_resource_pkey PRIMARY KEY (id)
);
CREATE TABLE test_resource (
name varchar(255) NOT NULL,
descrip varchar(2000) NULL,
eav_attribute varchar(255) NULL,
email varchar(255) NULL,
firstname varchar(255) NULL,
lastname varchar(255) NULL,
modified timestamp NULL,
"password" varchar(255) NULL,
status varchar(255) NULL,
CONSTRAINT test_resource_pkey PRIMARY KEY (name)
);
CREATE TABLE test_role_resource (
name varchar(255) NOT NULL,
approve_remove bool NULL,
description varchar(255) NULL,
eav_attribute varchar(255) NULL,
"member" varchar(2000) NULL,
modified timestamp NULL,
priority int4 NULL,
status varchar(255) NULL,
"type" varchar(255) NULL,
CONSTRAINT test_role_resource_pkey PRIMARY KEY (name)
);
CREATE TABLE test_schema_resource (
name varchar(255) NOT NULL,
boolean_value bool NULL,
byte_value bytea NULL,
date_value timestamp NULL,
double_value numeric(38,4) NULL,
int_value int4 NULL,
long_value int8 NULL,
short_text_value varchar(2000) NULL,
string_value text NULL,
uuid_value bytea NULL,
CONSTRAINT test_schema_resource_pkey PRIMARY KEY (name)
);
CREATE TABLE test_tree_resource (
id varchar(255) NOT NULL,
code varchar(255) NULL,
descript varchar(255) NULL,
email varchar(255) NULL,
modified timestamp NULL,
name varchar(255) NULL,
parent varchar(255) NULL,
status varchar(255) NULL,
CONSTRAINT test_tree_resource_pkey PRIMARY KEY (id)
);
|
<filename>src/test/resources/tkt3992.test_6.sql
-- tkt3992.test
--
-- execsql {
-- CREATE TABLE t2(a REAL, b REAL, c REAL);
-- INSERT INTO t2 VALUES(1, 2, 3);
-- CREATE TRIGGER tr2 BEFORE UPDATE ON t2 BEGIN
-- SELECT tcl('set res', typeof(new.c));
-- END;
--
-- UPDATE t2 SET a = 'I';
-- }
CREATE TABLE t2(a REAL, b REAL, c REAL);
INSERT INTO t2 VALUES(1, 2, 3);
CREATE TRIGGER tr2 BEFORE UPDATE ON t2 BEGIN
SELECT tcl('set res', typeof(new.c));
END;
UPDATE t2 SET a = 'I';
|
-- 2019-05-17T08:46:15.403
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,AD_UI_ElementType,Created,CreatedBy,IsActive,IsAdvancedField,IsAllowFiltering,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,IsMultiLine,MultiLine_LinesCount,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,1099,0,186,1000026,559145,'F',TO_TIMESTAMP('2019-05-17 08:46:15','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','N','Y','N','N','N',0,'C_Order_PaymentTerm_ID',60,0,0,TO_TIMESTAMP('2019-05-17 08:46:15','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2019-05-17T08:46:35.356
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
DELETE FROM AD_UI_Element WHERE AD_UI_Element_ID=544780
;
-- 2019-05-17T09:00:21.633
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Reference SET Name='C_PaymentTerm_Default_First',Updated=TO_TIMESTAMP('2019-05-17 09:00:21','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Reference_ID=227
;
-- 2019-05-17T09:01:33.914
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Ref_Table SET AD_Window_ID=141, OrderByClause='C_PaymentTerm.IsDefault DESC',Updated=TO_TIMESTAMP('2019-05-17 09:01:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Reference_ID=227
;
-- 2019-05-17T09:02:01.716
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Column SET AD_Reference_ID=18, AD_Reference_Value_ID=227, IsAutoApplyValidationRule='Y',Updated=TO_TIMESTAMP('2019-05-17 09:02:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=2187
;
-- 2019-05-17T09:27:02.589
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET Description='If a new record is created where this column or field is empty, then insert the first possible record reference. If set, then AD_Val_Rule_ID is used for filtering and AD_Reference_Value_ID is used for ordering.', Help='Works for new recrods (model interceptor) and new UI-documents (tab callout).',Updated=TO_TIMESTAMP('2019-05-17 09:27:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=575835 AND AD_Language='en_US'
;
-- 2019-05-17T09:27:12.364
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET Description='If a new record is created where this column or field is empty, then insert the first possible record reference. If set, then AD_Val_Rule_ID is used for filtering and AD_Reference_Value_ID is used for ordering.',Updated=TO_TIMESTAMP('2019-05-17 09:27:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=575835 AND AD_Language='de_CH'
;
-- 2019-05-17T09:27:17.491
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET Description='If a new record is created where this column or field is empty, then insert the first possible record reference. If set, then AD_Val_Rule_ID is used for filtering and AD_Reference_Value_ID is used for ordering.',Updated=TO_TIMESTAMP('2019-05-17 09:27:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=575835 AND AD_Language='de_DE'
;
-- 2019-05-17T09:27:20.899
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET Description='If a new record is created where this column or field is empty, then insert the first possible record reference. If set, then AD_Val_Rule_ID is used for filtering and AD_Reference_Value_ID is used for ordering.',Updated=TO_TIMESTAMP('2019-05-17 09:27:20','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=575835 AND AD_Language='nl_NL'
;
-- 2019-05-17T09:27:31.106
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET Help='Works for new recrods (model interceptor) and new UI-documents (tab callout).',Updated=TO_TIMESTAMP('2019-05-17 09:27:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=575835 AND AD_Language='nl_NL'
;
-- 2019-05-17T09:27:34.135
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET Help='Works for new recrods (model interceptor) and new UI-documents (tab callout).',Updated=TO_TIMESTAMP('2019-05-17 09:27:34','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=575835 AND AD_Language='de_DE'
;
-- 2019-05-17T09:28:26.641
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET Help='Works for new recrods (model interceptor) and new UI-documents (tab callout).',Updated=TO_TIMESTAMP('2019-05-17 09:28:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=575835 AND AD_Language='de_CH'
;
-- 2019-05-17T09:28:31.910
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET PrintName='Validierungsregel automatisch anwenden.',Updated=TO_TIMESTAMP('2019-05-17 09:28:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=575835 AND AD_Language='de_CH'
;
-- 2019-05-17T09:28:34.788
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET PrintName='Validierungsregel automatisch anwenden',Updated=TO_TIMESTAMP('2019-05-17 09:28:34','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=575835 AND AD_Language='de_CH'
;
-- 2019-05-17T09:28:44.559
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET Name='Validierungsregel automatisch anwenden.',Updated=TO_TIMESTAMP('2019-05-17 09:28:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=575835 AND AD_Language='de_CH'
;
-- 2019-05-17T09:28:47.862
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET Name='Validierungsregel automatisch anwenden',Updated=TO_TIMESTAMP('2019-05-17 09:28:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=575835 AND AD_Language='de_CH'
;
-- 2019-05-17T09:57:34.925
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Element_Trl SET Help='Works for new records (model interceptor) and new UI-documents (tab callout).',Updated=TO_TIMESTAMP('2019-05-17 09:57:34','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=575835 AND AD_Language='de_CH'
;
-- 2019-05-17T10:57:34.026
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Column SET AD_Val_Rule_ID=NULL,Updated=TO_TIMESTAMP('2019-05-17 10:57:34','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=4940
;
-- 2019-05-17T10:58:21.129
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Column SET AD_Val_Rule_ID=NULL,Updated=TO_TIMESTAMP('2019-05-17 10:58:21','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=1760
;
|
<filename>Database Table Create.sql
CREATE TABLE IF NOT EXISTS student (
pid CHAR(7) PRIMARY KEY,
email VARCHAR(32766) NOT NULL,
birth_date DATE NOT NULL,
county VARCHAR(32766) NOT NULL,
primary_college VARCHAR(32766) NOT NULL,
race VARCHAR(32766) NOT NULL,
tianjin_based BOOL NOT NULL
);
show tables;
SHOW CREATE TABLE student;
CREATE TABLE IF NOT EXISTS daily_health_indicators (
temperature VARCHAR(32766),
oxygen_saturation VARCHAR(32766),
headache VARCHAR(32766),
cough VARCHAR(32766),
trouble_breathing VARCHAR(32766),
smell_taste_loss VARCHAR(32766),
abnormally_tired BOOL,
occured DATE,
pid CHAR(7),
FOREIGN KEY (pid) REFERENCES student(pid),
PRIMARY KEY (pid, occured)
);
show tables;
SHOW CREATE TABLE daily_health_indicators;
CREATE TABLE IF NOT EXISTS comorbidity (
student_smoke BOOL,
student_overweight BOOL,
immunocompromised BOOL,
respiratory_disease BOOL,
renal_impairment BOOL,
congestive_heart_failure BOOL,
hypertension BOOL,
diabetes BOOL,
pid CHAR(7) PRIMARY KEY,
FOREIGN KEY (pid) REFERENCES student(pid)
);
show tables;
SHOW CREATE TABLE comorbidity;
CREATE TABLE IF NOT EXISTS precaution (
typical_mask_used VARCHAR(32766),
protective_eyewear_use BOOL,
hand_wash_frequency VARCHAR(32766),
exposure_careless_individuals BOOL,
pid CHAR(7) PRIMARY KEY,
FOREIGN KEY (pid) REFERENCES student(pid)
);
show tables;
SHOW CREATE TABLE precaution;
show tables;
select * from student;
select * from daily_health_indicators;
select * from comorbidity;
select * from precaution;
|
ALTER TABLE db_version CHANGE COLUMN required_6970_01_mangos_playercreateinfo required_7002_01_mangos_spell_chain bit;
DELETE FROM `spell_chain` WHERE `spell_id` IN (51490,59156,59158,59159);
INSERT INTO `spell_chain` VALUES
(51490,0,51490,1,0),
(59156,51490,51490,2,0),
(59158,59156,51490,3,0),
(59159,59158,51490,4,0);
|
/* KenticoDeleteAnalyticsData-ByDays.v11.sql */
/* Goal: Clean up analytics data beyond a given # of days */
/* Description: Deletes individual Analytics Hits that are beyond the given */
/* number of days. This way you can delete data that is older than XXX days. */
/* This can take a long time to run and isn't recommended you run while the site is */
/* Being hit. On one site with over 50 million records beyond the date it took 40 minutes to run. */
/* Be very careful with this one, there is no coming back */
/* Intended Kentico Verison: 11.x */
/* Author: <NAME> (<EMAIL>) */
/* Revision: 1.0 */
/* Take a backup first! Don't be THAT guy! */
declare @DaysToKeep int = 548; /* MODIFY ME */
declare @CutOffDate datetime = null;
-- Creates the cut off point
set @CutOffDate = DATEADD(day, -1*@DaysToKeep, GETDATE())
-- Delete various Analytics data that have an end time that is earlier than the cut off date.
-- DateDiff(day, '2020-01-15', '2020-01-01') would result in a negative number (Keep),
-- where as DateDiff(day, '2019-12-30', '2020-01-01') would result in a negative number and should be deleted
delete from [Analytics_YearHits]
where DATEDIFF(day, HitsEndTime, @CutOffDate) > 0
delete from [Analytics_MonthHits]
where DATEDIFF(day, HitsEndTime, @CutOffDate) > 0
delete from [Analytics_WeekHits]
where DATEDIFF(day, HitsEndTime, @CutOffDate) > 0
delete from [Analytics_DayHits]
where DATEDIFF(day, HitsEndTime, @CutOffDate) > 0
delete from [Analytics_HourHits]
where DATEDIFF(day, HitsEndTime, @CutOffDate) > 0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.