text stringlengths 6 9.38M |
|---|
/*
Navicat Premium Data Transfer
Source Server : jlkj_mall
Source Server Type : MySQL
Source Server Version : 50173
Source Host : 120.27.50.31
Source Database : e_shops
Target Server Type : MySQL
Target Server Version : 50173
File Encoding : utf-8
Date: 04/29/2016 20:41:01 PM
*/
-- ----------------------------
-- Table structure for `distributors`
-- ----------------------------
DROP TABLE IF EXISTS `distributors`;
CREATE TABLE `distributors` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '่ชๅขไธป้ฎ',
`user_id` bigint(20) DEFAULT NULL COMMENT '็จๆทid',
`shop_name` varchar(64) DEFAULT NULL COMMENT 'ๅบ้บๅ็งฐ',
`open_shop_time` datetime DEFAULT NULL COMMENT 'ๅผๅบๆถ้ด',
`open_status` varchar(2) DEFAULT NULL COMMENT 'ๅบ้บ็ถๆ',
`parent_id` bigint(20) DEFAULT NULL COMMENT 'ไธ็บงid',
PRIMARY KEY (`id`)
) ;
|
SELECT * FROM BIRDERS;
SELECT * FROM BIRDS;
SELECT * FROM BIRD_FAMILYS;
SELECT * FROM LOCATIONS;
SELECT * FROM BIRD_LISTS;
SELECT * FROM SIGHTINGS; |
USE `anslutningsplattform`;
-- MySQL dump 10.13 Distrib 5.6.19, for osx10.7 (i386)
--
-- Host: rtp-t-db01.i.centrera.se Database: anslutningsplattform
-- ------------------------------------------------------
-- Server version 5.1.73
/*!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 `bestallning`
--
DROP TABLE IF EXISTS `bestallning`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `bestallning` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`version` bigint(20) NOT NULL,
`bestallare_id` bigint(20) NOT NULL,
`bestallare_roll` varchar(255) DEFAULT NULL,
`driftmiljo_id` varchar(255) NOT NULL,
`other_info` MEDIUMTEXT DEFAULT NULL,
`producentbestallning_id` bigint(20) DEFAULT NULL,
`status` varchar(255) NOT NULL,
PRIMARY KEY (`id`),
KEY `FK_p1chcfduor1708ru1rbur44ex` (`bestallare_id`),
KEY `FK_1o75o372k0p8fovb63umnrc81` (`driftmiljo_id`),
KEY `FK_rmpt7srpkcwsy5nvikqi9at4c` (`producentbestallning_id`),
CONSTRAINT `FK_rmpt7srpkcwsy5nvikqi9at4c` FOREIGN KEY (`producentbestallning_id`) REFERENCES `producentbestallning` (`id`),
CONSTRAINT `FK_1o75o372k0p8fovb63umnrc81` FOREIGN KEY (`driftmiljo_id`) REFERENCES `driftmiljo` (`id`),
CONSTRAINT `FK_p1chcfduor1708ru1rbur44ex` FOREIGN KEY (`bestallare_id`) REFERENCES `personkontakt` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `bestallning_konsumentbestallning`
--
DROP TABLE IF EXISTS `bestallning_konsumentbestallning`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `bestallning_konsumentbestallning` (
`bestallning_konsumentbestallningar_id` bigint(20) DEFAULT NULL,
`konsumentbestallning_id` bigint(20) DEFAULT NULL,
KEY `FK_bwccnjtdqqy52rr6ku1p28uhn` (`konsumentbestallning_id`),
KEY `FK_c1gv5dhf9n1q4rbiv7oykaw49` (`bestallning_konsumentbestallningar_id`),
CONSTRAINT `FK_c1gv5dhf9n1q4rbiv7oykaw49` FOREIGN KEY (`bestallning_konsumentbestallningar_id`) REFERENCES `bestallning` (`id`),
CONSTRAINT `FK_bwccnjtdqqy52rr6ku1p28uhn` FOREIGN KEY (`konsumentbestallning_id`) REFERENCES `konsumentbestallning` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `driftmiljo`
--
DROP TABLE IF EXISTS `driftmiljo`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `driftmiljo` (
`id` varchar(255) NOT NULL,
`version` bigint(20) NOT NULL,
`namn` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `funktionkontakt`
--
DROP TABLE IF EXISTS `funktionkontakt`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `funktionkontakt` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`version` bigint(20) NOT NULL,
`epost` varchar(255) NOT NULL,
`telefon` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `hibernate_unique_key`
--
DROP TABLE IF EXISTS `hibernate_unique_key`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `hibernate_unique_key` (
`next_hi` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `konsumentanslutning`
--
DROP TABLE IF EXISTS `konsumentanslutning`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `konsumentanslutning` (
`id` bigint(20) NOT NULL,
`version` bigint(20) NOT NULL,
`giltig_fran_tid` datetime NOT NULL,
`giltig_till_tid` datetime NOT NULL,
`tjanstekontrakt_major_version` int(11) NOT NULL,
`tjanstekontrakt_minor_version` int(11) NOT NULL,
`tjanstekontrakt_namnrymd` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `konsumentanslutning_logisk_adress`
--
DROP TABLE IF EXISTS `konsumentanslutning_logisk_adress`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `konsumentanslutning_logisk_adress` (
`konsumentanslutning_id` bigint(20) NOT NULL,
`ny_logisk_adress_id` bigint(20) DEFAULT NULL,
KEY `FK_thiyyhhohngeeoaa0dupkup9y` (`ny_logisk_adress_id`),
CONSTRAINT `FK_thiyyhhohngeeoaa0dupkup9y` FOREIGN KEY (`ny_logisk_adress_id`) REFERENCES `logisk_adress` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `konsumentbestallning`
--
DROP TABLE IF EXISTS `konsumentbestallning`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `konsumentbestallning` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`version` bigint(20) NOT NULL,
`tjanstekomponent_id` bigint(20) NOT NULL,
PRIMARY KEY (`id`),
KEY `FK_ipdcd8itip119wxanacocy8ai` (`tjanstekomponent_id`),
CONSTRAINT `FK_ipdcd8itip119wxanacocy8ai` FOREIGN KEY (`tjanstekomponent_id`) REFERENCES `tjanstekomponent` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `konsumentbestallning_konsumentanslutning`
--
DROP TABLE IF EXISTS `konsumentbestallning_konsumentanslutning`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `konsumentbestallning_konsumentanslutning` (
`konsumentbestallning_konsumentanslutningar_id` bigint(20) DEFAULT NULL,
`konsumentanslutning_id` bigint(20) DEFAULT NULL,
KEY `FK_ikkl2sq1d45fnajb7ts6343f1` (`konsumentbestallning_konsumentanslutningar_id`),
CONSTRAINT `FK_ikkl2sq1d45fnajb7ts6343f1` FOREIGN KEY (`konsumentbestallning_konsumentanslutningar_id`) REFERENCES `konsumentbestallning` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `konsumentbestallning_uppdaterad_konsumentanslutning`
--
DROP TABLE IF EXISTS `konsumentbestallning_uppdaterad_konsumentanslutning`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `konsumentbestallning_uppdaterad_konsumentanslutning` (
`konsumentbestallning_uppdaterad_konsumentanslutningar_id` bigint(20) DEFAULT NULL,
`uppdaterad_konsumentanslutning_id` bigint(20) DEFAULT NULL,
KEY `FK_jw4rdbbs70ag8iyht1a1sbgt9` (`uppdaterad_konsumentanslutning_id`),
KEY `FK_b269u3pj9axutppqada09j2xs` (`konsumentbestallning_uppdaterad_konsumentanslutningar_id`),
CONSTRAINT `FK_b269u3pj9axutppqada09j2xs` FOREIGN KEY (`konsumentbestallning_uppdaterad_konsumentanslutningar_id`) REFERENCES `konsumentbestallning` (`id`),
CONSTRAINT `FK_jw4rdbbs70ag8iyht1a1sbgt9` FOREIGN KEY (`uppdaterad_konsumentanslutning_id`) REFERENCES `uppdaterad_konsumentanslutning` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `logisk_adress`
--
DROP TABLE IF EXISTS `logisk_adress`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `logisk_adress` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`version` bigint(20) NOT NULL,
`hsa_id` varchar(255) NOT NULL,
`namn` varchar(255) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `UK_t0hh8k0lm3gmwpkueja279g16` (`hsa_id`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `nat`
--
DROP TABLE IF EXISTS `nat`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `nat` (
`id` varchar(255) NOT NULL,
`version` bigint(20) NOT NULL,
`namn` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `personkontakt`
--
DROP TABLE IF EXISTS `personkontakt`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `personkontakt` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`version` bigint(20) NOT NULL,
`epost` varchar(255) NOT NULL,
`hsa_id` varchar(255) DEFAULT NULL,
`namn` varchar(255) NOT NULL,
`telefon` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `producentanslutning`
--
DROP TABLE IF EXISTS `producentanslutning`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `producentanslutning` (
`id` bigint(20) NOT NULL,
`version` bigint(20) NOT NULL,
`giltig_fran_tid` datetime NOT NULL,
`giltig_till_tid` datetime NOT NULL,
`rivta_profil` varchar(255) NOT NULL,
`tjanstekontrakt_major_version` int(11) NOT NULL,
`tjanstekontrakt_minor_version` int(11) NOT NULL,
`tjanstekontrakt_namnrymd` varchar(255) NOT NULL,
`url` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `producentanslutning_logisk_adress`
--
DROP TABLE IF EXISTS `producentanslutning_logisk_adress`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `producentanslutning_logisk_adress` (
`producentanslutning_id` bigint(20) NOT NULL,
`ny_logisk_adress_id` bigint(20) DEFAULT NULL,
KEY `FK_hy9ednsc537efvjvdi8r32lnv` (`ny_logisk_adress_id`),
CONSTRAINT `FK_hy9ednsc537efvjvdi8r32lnv` FOREIGN KEY (`ny_logisk_adress_id`) REFERENCES `logisk_adress` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `producentbestallning`
--
DROP TABLE IF EXISTS `producentbestallning`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `producentbestallning` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`version` bigint(20) NOT NULL,
`namn_pa_etjanst` varchar(255) DEFAULT NULL,
`tjanstekomponent_id` bigint(20) NOT NULL,
PRIMARY KEY (`id`),
KEY `FK_pt1cfj8tcs1nr1elo8nblviap` (`tjanstekomponent_id`),
CONSTRAINT `FK_pt1cfj8tcs1nr1elo8nblviap` FOREIGN KEY (`tjanstekomponent_id`) REFERENCES `tjanstekomponent` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `producentbestallning_producentanslutning`
--
DROP TABLE IF EXISTS `producentbestallning_producentanslutning`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `producentbestallning_producentanslutning` (
`producentbestallning_producentanslutningar_id` bigint(20) DEFAULT NULL,
`producentanslutning_id` bigint(20) DEFAULT NULL,
KEY `FK_9ok28d0qtg5kyj0kkb4g6tdss` (`producentbestallning_producentanslutningar_id`),
CONSTRAINT `FK_9ok28d0qtg5kyj0kkb4g6tdss` FOREIGN KEY (`producentbestallning_producentanslutningar_id`) REFERENCES `producentbestallning` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `producentbestallning_uppdaterad_producentanslutning`
--
DROP TABLE IF EXISTS `producentbestallning_uppdaterad_producentanslutning`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `producentbestallning_uppdaterad_producentanslutning` (
`producentbestallning_uppdaterad_producentanslutningar_id` bigint(20) DEFAULT NULL,
`uppdaterad_producentanslutning_id` bigint(20) DEFAULT NULL,
KEY `FK_k8644roj2eyybojsc62ejkouy` (`uppdaterad_producentanslutning_id`),
KEY `FK_6jp88iy2vrq2i3cd2fra0fqmu` (`producentbestallning_uppdaterad_producentanslutningar_id`),
CONSTRAINT `FK_6jp88iy2vrq2i3cd2fra0fqmu` FOREIGN KEY (`producentbestallning_uppdaterad_producentanslutningar_id`) REFERENCES `producentbestallning` (`id`),
CONSTRAINT `FK_k8644roj2eyybojsc62ejkouy` FOREIGN KEY (`uppdaterad_producentanslutning_id`) REFERENCES `uppdaterad_producentanslutning` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `role`
--
DROP TABLE IF EXISTS `role`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `role` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`version` bigint(20) NOT NULL,
`name` varchar(255) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `UK_8sewwnpamngi6b1dwaa88askk` (`name`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `role_permissions`
--
DROP TABLE IF EXISTS `role_permissions`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `role_permissions` (
`role_id` bigint(20) DEFAULT NULL,
`permissions_string` varchar(255) DEFAULT NULL,
KEY `FK_d4atqq8ege1sij0316vh2mxfu` (`role_id`),
CONSTRAINT `FK_d4atqq8ege1sij0316vh2mxfu` FOREIGN KEY (`role_id`) REFERENCES `role` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `tjanstekomponent`
--
DROP TABLE IF EXISTS `tjanstekomponent`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `tjanstekomponent` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`version` bigint(20) NOT NULL,
`beskrivning` varchar(255) NOT NULL,
`hsa_id` varchar(255) NOT NULL,
`huvudansvarig_kontakt_epost` varchar(255) DEFAULT NULL,
`huvudansvarig_kontakt_hsa_id` varchar(255) DEFAULT NULL,
`huvudansvarig_kontakt_namn` varchar(255) DEFAULT NULL,
`huvudansvarig_kontakt_telefon` varchar(255) DEFAULT NULL,
`ipadress` varchar(255) DEFAULT NULL,
`organisation` varchar(255) DEFAULT NULL,
`ping_for_configurationurl` varchar(255) DEFAULT NULL,
`teknisk_kontakt_epost` varchar(255) DEFAULT NULL,
`teknisk_kontakt_hsa_id` varchar(255) DEFAULT NULL,
`teknisk_kontakt_namn` varchar(255) DEFAULT NULL,
`teknisk_kontakt_telefon` varchar(255) DEFAULT NULL,
`teknisk_supportkontakt_epost` varchar(255) DEFAULT NULL,
`teknisk_supportkontakt_telefon` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `UK_hve38rq1bac4udieiyc44ahyl` (`hsa_id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `tjanstekomponent_driftmiljo`
--
DROP TABLE IF EXISTS `tjanstekomponent_driftmiljo`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `tjanstekomponent_driftmiljo` (
`tjanstekomponent_driftmiljoer_id` bigint(20) DEFAULT NULL,
`driftmiljo_id` varchar(255) DEFAULT NULL,
KEY `FK_73v0bcg0siyrupmc9sx8xknf6` (`driftmiljo_id`),
KEY `FK_clrm55eb6pj52u1u3c3vf8bjm` (`tjanstekomponent_driftmiljoer_id`),
CONSTRAINT `FK_clrm55eb6pj52u1u3c3vf8bjm` FOREIGN KEY (`tjanstekomponent_driftmiljoer_id`) REFERENCES `tjanstekomponent` (`id`),
CONSTRAINT `FK_73v0bcg0siyrupmc9sx8xknf6` FOREIGN KEY (`driftmiljo_id`) REFERENCES `driftmiljo` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `tjanstekomponent_nat`
--
DROP TABLE IF EXISTS `tjanstekomponent_nat`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `tjanstekomponent_nat` (
`tjanstekomponent_nat_id` bigint(20) NOT NULL,
`nat_id` varchar(255) DEFAULT NULL,
KEY `FK_os5ybv4d17hr8raghl9irffb` (`nat_id`),
KEY `FK_1bgrl8sldeev5ntxb2pqren71` (`tjanstekomponent_nat_id`),
CONSTRAINT `FK_1bgrl8sldeev5ntxb2pqren71` FOREIGN KEY (`tjanstekomponent_nat_id`) REFERENCES `tjanstekomponent` (`id`),
CONSTRAINT `FK_os5ybv4d17hr8raghl9irffb` FOREIGN KEY (`nat_id`) REFERENCES `nat` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `uppdaterad_konsumentanslutning`
--
DROP TABLE IF EXISTS `uppdaterad_konsumentanslutning`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `uppdaterad_konsumentanslutning` (
`id` bigint(20) NOT NULL,
`version` bigint(20) NOT NULL,
`giltig_fran_tid` datetime NOT NULL,
`giltig_till_tid` datetime NOT NULL,
`tjanstekontrakt_major_version` int(11) NOT NULL,
`tjanstekontrakt_minor_version` int(11) NOT NULL,
`tjanstekontrakt_namnrymd` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `uppdaterad_konsumentanslutning_logisk_adress`
--
DROP TABLE IF EXISTS `uppdaterad_konsumentanslutning_logisk_adress`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `uppdaterad_konsumentanslutning_logisk_adress` (
`uppdaterad_konsumentanslutning_id` bigint(20) NOT NULL,
`befintlig_logisk_adress_id` bigint(20) DEFAULT NULL,
`borttagen_logisk_adress_id` bigint(20) DEFAULT NULL,
KEY `FK_4fiw05jcy20w5lvpnpycf48mg` (`befintlig_logisk_adress_id`),
KEY `FK_3po2edgdjxpqeu280eq20w3qe` (`uppdaterad_konsumentanslutning_id`),
KEY `FK_421jmuokxw7fe3ifk5lag88wl` (`borttagen_logisk_adress_id`),
CONSTRAINT `FK_421jmuokxw7fe3ifk5lag88wl` FOREIGN KEY (`borttagen_logisk_adress_id`) REFERENCES `logisk_adress` (`id`),
CONSTRAINT `FK_3po2edgdjxpqeu280eq20w3qe` FOREIGN KEY (`uppdaterad_konsumentanslutning_id`) REFERENCES `uppdaterad_konsumentanslutning` (`id`),
CONSTRAINT `FK_4fiw05jcy20w5lvpnpycf48mg` FOREIGN KEY (`befintlig_logisk_adress_id`) REFERENCES `logisk_adress` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `uppdaterad_producentanslutning`
--
DROP TABLE IF EXISTS `uppdaterad_producentanslutning`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `uppdaterad_producentanslutning` (
`id` bigint(20) NOT NULL,
`version` bigint(20) NOT NULL,
`giltig_fran_tid` datetime NOT NULL,
`giltig_till_tid` datetime NOT NULL,
`rivta_profil` varchar(255) NOT NULL,
`tjanstekontrakt_major_version` int(11) NOT NULL,
`tjanstekontrakt_minor_version` int(11) NOT NULL,
`tjanstekontrakt_namnrymd` varchar(255) NOT NULL,
`url` varchar(255) NOT NULL,
`tidigare_rivta_profil` varchar(255) DEFAULT NULL,
`tidigare_url` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `uppdaterad_producentanslutning_logisk_adress`
--
DROP TABLE IF EXISTS `uppdaterad_producentanslutning_logisk_adress`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `uppdaterad_producentanslutning_logisk_adress` (
`uppdaterad_producentanslutning_id` bigint(20) NOT NULL,
`befintlig_logisk_adress_id` bigint(20) DEFAULT NULL,
`borttagen_logisk_adress_id` bigint(20) DEFAULT NULL,
KEY `FK_kur93b91tc0n30kx2ce4mraaf` (`befintlig_logisk_adress_id`),
KEY `FK_4mdt2udan62gn754opwscx1n8` (`uppdaterad_producentanslutning_id`),
KEY `FK_6i51ot9khxu3pgp7iidcs9mje` (`borttagen_logisk_adress_id`),
CONSTRAINT `FK_6i51ot9khxu3pgp7iidcs9mje` FOREIGN KEY (`borttagen_logisk_adress_id`) REFERENCES `logisk_adress` (`id`),
CONSTRAINT `FK_4mdt2udan62gn754opwscx1n8` FOREIGN KEY (`uppdaterad_producentanslutning_id`) REFERENCES `uppdaterad_producentanslutning` (`id`),
CONSTRAINT `FK_kur93b91tc0n30kx2ce4mraaf` FOREIGN KEY (`befintlig_logisk_adress_id`) REFERENCES `logisk_adress` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `user`
--
DROP TABLE IF EXISTS `user`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `user` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`version` bigint(20) NOT NULL,
`datum_skapad` varchar(255) NOT NULL,
`epost` varchar(255) NOT NULL,
`namn` varchar(255) NOT NULL,
`password_hash` varchar(255) NOT NULL,
`username` varchar(255) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `UK_sb8bbouer5wak8vyiiy4pf2bx` (`username`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `user_permissions`
--
DROP TABLE IF EXISTS `user_permissions`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `user_permissions` (
`user_id` bigint(20) DEFAULT NULL,
`permissions_string` varchar(255) DEFAULT NULL,
KEY `FK_525n7wn9ejoa648m26bm4rhtt` (`user_id`),
CONSTRAINT `FK_525n7wn9ejoa648m26bm4rhtt` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `user_roles`
--
DROP TABLE IF EXISTS `user_roles`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `user_roles` (
`role_id` bigint(20) NOT NULL,
`user_id` bigint(20) NOT NULL,
PRIMARY KEY (`user_id`,`role_id`),
KEY `FK_5q4rc4fh1on6567qk69uesvyf` (`role_id`),
CONSTRAINT `FK_5q4rc4fh1on6567qk69uesvyf` FOREIGN KEY (`role_id`) REFERENCES `role` (`id`),
CONSTRAINT `FK_g1uebn6mqk9qiaw45vnacmyo2` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping events for database 'anslutningsplattform'
--
--
-- Dumping routines for database 'anslutningsplattform'
--
/*!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 2015-11-04 20:47:05
INSERT INTO `anslutningsplattform`.`hibernate_unique_key` (`next_hi`) VALUES (1);
|
INSERT INTO `addon_account` (name, label, shared) VALUES
('society_Journalist', 'Journalist', 1)
;
INSERT INTO `datastore` (name, label, shared) VALUES
('society_Journalist', 'Journalist', 1)
;
INSERT INTO `addon_inventory` (name, label, shared) VALUES
('society_Journalist', 'Journalist', 1)
;
INSERT INTO `jobs` (name, label) VALUES
('Journalist','Journalist')
;
INSERT INTO `job_grades` (job_name, grade, name, label, salary, skin_male, skin_female) VALUES
('Journalist',0,'agent','Filmbardar',3000,'{}','{}'),
('Journalist',1,'special','Sedabardar',4000,'{}','{}'),
('Journalist',2,'supervisor','Gozareshgar',5000,'{}','{}'),
('Journalist',3,'assistant','Moaven',5500,'{}','{}'),
('Journalist',4,'boss','Rais',6000,'{}','{}')
;
|
DROP TABLE IF EXISTS harry;
CREATE TABLE harry(
id SERIAL PRIMARY KEY,
house VARCHAR(255),
name VARCHAR(255),
eyecolor VARCHAR(255)
); |
set serveroutput on;
declare
cursor cur_vuelos is
select * from vuelo;
begin
for r in cur_vuelos loop
sp_insert_into_historico(r.fecha_hora_llegada, r.id_status_vuelo, r.id_vuelo);
if r.id_status_vuelo = 3 or r.id_status_vuelo = 4 then
sp_insert_into_historico(r.fecha_hora_llegada, 2, r.id_vuelo);
sp_insert_into_historico(r.fecha_hora_llegada, 1, r.id_vuelo);
elsif r.id_status_vuelo = 5 then
sp_insert_into_historico(r.fecha_hora_llegada, 1, r.id_vuelo);
end if;
end loop;
end;
/
show errors;
|
insert into avatars (avatar_base_type_id, level, skin, hair, picture_url, night_background_url, day_background_url, status, text_id, created_by, created_date)
values
(2, 1, 1, 3, 's1h3.png', 'night1.png', 'day1.png', 'ACTIVE', 1, 1, current_timestamp),
(2, 2, 1, 3, 's1h3.png', 'night1.png', 'day1.png', 'ACTIVE', 1, 1, current_timestamp),
(2, 3, 1, 3, 's1h3.png', 'night1.png', 'day1.png', 'ACTIVE', 1, 1, current_timestamp),
(2, 4, 1, 3, 's1h3.png', 'night1.png', 'day1.png', 'ACTIVE', 1, 1, current_timestamp),
(2, 5, 1, 3, 's1h3.png', 'night1.png', 'day1.png', 'ACTIVE', 1, 1, current_timestamp),
(2, 6, 1, 3, 's1h3.png', 'night1.png', 'day1.png', 'ACTIVE', 1, 1, current_timestamp),
(2, 7, 1, 3, 's1h3.png', 'night1.png', 'day1.png', 'ACTIVE', 1, 1, current_timestamp),
(2, 8, 1, 3, 's1h3.png', 'night1.png', 'day1.png', 'ACTIVE', 1, 1, current_timestamp),
(2, 9, 1, 3, 's1h3.png', 'night1.png', 'day1.png', 'ACTIVE', 1, 1, current_timestamp),
(2, 10, 1, 3, 's1h3.png', 'night10.png', 'day10.png', 'ACTIVE', 1, 1, current_timestamp),
(2, 11, 1, 3, 's1h3.png', 'night10.png', 'day10.png', 'ACTIVE', 1, 1, current_timestamp),
(2, 12, 1, 3, 's1h3.png', 'night10.png', 'day10.png', 'ACTIVE', 1, 1, current_timestamp),
(2, 13, 1, 3, 's1h3.png', 'night10.png', 'day10.png', 'ACTIVE', 1, 1, current_timestamp),
(2, 14, 1, 3, 's1h3.png', 'night10.png', 'day10.png', 'ACTIVE', 1, 1, current_timestamp),
(2, 15, 1, 3, 's1h3.png', 'night10.png', 'day10.png', 'ACTIVE', 1, 1, current_timestamp),
(2, 16, 1, 3, 's1h3.png', 'night10.png', 'day10.png', 'ACTIVE', 1, 1, current_timestamp),
(2, 17, 1, 3, 's1h3.png', 'night10.png', 'day10.png', 'ACTIVE', 1, 1, current_timestamp),
(2, 18, 1, 3, 's1h3.png', 'night10.png', 'day10.png', 'ACTIVE', 1, 1, current_timestamp),
(2, 19, 1, 3, 's1h3.png', 'night10.png', 'day10.png', 'ACTIVE', 1, 1, current_timestamp),
(2, 20, 1, 3, 's1h3.png', 'night20.png', 'day20.png', 'ACTIVE', 1, 1, current_timestamp),
(2, 21, 1, 3, 's1h3.png', 'night20.png', 'day20.png', 'ACTIVE', 1, 1, current_timestamp),
(2, 22, 1, 3, 's1h3.png', 'night20.png', 'day20.png', 'ACTIVE', 1, 1, current_timestamp),
(2, 23, 1, 3, 's1h3.png', 'night20.png', 'day20.png', 'ACTIVE', 1, 1, current_timestamp),
(2, 24, 1, 3, 's1h3.png', 'night20.png', 'day20.png', 'ACTIVE', 1, 1, current_timestamp),
(2, 25, 1, 3, 's1h3.png', 'night20.png', 'day20.png', 'ACTIVE', 1, 1, current_timestamp),
(2, 26, 1, 3, 's1h3.png', 'night20.png', 'day20.png', 'ACTIVE', 1, 1, current_timestamp),
(2, 27, 1, 3, 's1h3.png', 'night20.png', 'day20.png', 'ACTIVE', 1, 1, current_timestamp),
(2, 28, 1, 3, 's1h3.png', 'night20.png', 'day20.png', 'ACTIVE', 1, 1, current_timestamp),
(2, 29, 1, 3, 's1h3.png', 'night20.png', 'day20.png', 'ACTIVE', 1, 1, current_timestamp),
(2, 30, 1, 3, 's1h3.png', 'night30.png', 'day30.png', 'ACTIVE', 1, 1, current_timestamp),
(2, 31, 1, 3, 's1h3.png', 'night30.png', 'day30.png', 'ACTIVE', 1, 1, current_timestamp),
(2, 32, 1, 3, 's1h3.png', 'night30.png', 'day30.png', 'ACTIVE', 1, 1, current_timestamp),
(2, 33, 1, 3, 's1h3.png', 'night30.png', 'day30.png', 'ACTIVE', 1, 1, current_timestamp),
(2, 34, 1, 3, 's1h3.png', 'night30.png', 'day30.png', 'ACTIVE', 1, 1, current_timestamp),
(2, 35, 1, 3, 's1h3.png', 'night30.png', 'day30.png', 'ACTIVE', 1, 1, current_timestamp),
(2, 36, 1, 3, 's1h3.png', 'night30.png', 'day30.png', 'ACTIVE', 1, 1, current_timestamp),
(2, 37, 1, 3, 's1h3.png', 'night30.png', 'day30.png', 'ACTIVE', 1, 1, current_timestamp),
(2, 38, 1, 3, 's1h3.png', 'night30.png', 'day30.png', 'ACTIVE', 1, 1, current_timestamp),
(2, 39, 1, 3, 's1h3.png', 'night30.png', 'day30.png', 'ACTIVE', 1, 1, current_timestamp),
(2, 40, 1, 3, 's1h3.png', 'night40.png', 'day40.png', 'ACTIVE', 1, 1, current_timestamp),
(2, 41, 1, 3, 's1h3.png', 'night40.png', 'day40.png', 'ACTIVE', 1, 1, current_timestamp),
(2, 42, 1, 3, 's1h3.png', 'night40.png', 'day40.png', 'ACTIVE', 1, 1, current_timestamp),
(2, 43, 1, 3, 's1h3.png', 'night40.png', 'day40.png', 'ACTIVE', 1, 1, current_timestamp),
(2, 44, 1, 3, 's1h3.png', 'night40.png', 'day40.png', 'ACTIVE', 1, 1, current_timestamp),
(2, 45, 1, 3, 's1h3.png', 'night40.png', 'day40.png', 'ACTIVE', 1, 1, current_timestamp),
(2, 46, 1, 3, 's1h3.png', 'night40.png', 'day40.png', 'ACTIVE', 1, 1, current_timestamp),
(2, 47, 1, 3, 's1h3.png', 'night40.png', 'day40.png', 'ACTIVE', 1, 1, current_timestamp),
(2, 48, 1, 3, 's1h3.png', 'night40.png', 'day40.png', 'ACTIVE', 1, 1, current_timestamp),
(2, 49, 1, 3, 's1h3.png', 'night40.png', 'day40.png', 'ACTIVE', 1, 1, current_timestamp);
|
/*
* ๋ฆฌํผํธ ์ฌ์ฉ์๋ฅผ 3๊ฐ์ง๋ก ๋ถ๋ฅํ๊ธฐ
* ๋ฆฌํผํธ ์ฌ์ฉ์๋ ์ด์ ๋ฌ์๋ ์ฌ์ฉํ ์ฌ์ฉ์๋ผ๊ณ ์ ์ํฉ๋๋ค.
* ๊ทธ๋ฐ๋ฐ ์ด์ ๋ฌ์ ์ฌ์ฉ์ ์ํ์ ๋ฐ๋ผ ์ถ๊ฐ๋ก ๋ฆฌํผํธ ์ฌ์ฉ์๋ฅผ ๋ค์ 3๊ฐ์ง๋ก ๋ถ๋ฅํ ์ ์์ต๋๋ค.
*
* 1.์ ๊ท ๋ฆฌํผํธ ์ฌ์ฉ์ : ์ด์ ๋ฌ์๋ ์ ๊ท ์ฌ์ฉ์๋ก ๋ถ๋ฅ๋์์ผ๋ฉฐ, ์ด๋ฒ ๋ฌ์๋ ์ฌ์ฉํ ์ฌ์ฉ์
* 2.๊ธฐ์กด ๋ฆฌํผํธ ์ฌ์ฉ์ : ์ด์ ๋ฌ๋ ๋ฆฌํผํธ ์ฌ์ฉ์๋ก ๋ถ๋ฅ๋์์ผ๋ฉฐ, ์ด๋ฒ ๋ฌ์๋ ์ฌ์ฉํ ์ฌ์ฉ์
* 3.์ปด๋ฐฑ ๋ฆฌํผํธ ์ฌ์ฉ์ : ์ด์ ๋ฌ์ ์ปด๋ฐฑ ์ฌ์ฉ์๋ก ๋ถ๋ฅ๋์์ผ๋ฉฐ, ์ด๋ฒ ๋ฌ์๋ ์ฌ์ฉํ ์ฌ์ฉ์
*
* */
์ฝ๋ 12-24 ๋ฆฌํผํธ ์ฌ์ฉ์๋ฅผ ์ธ๋ถํํด์ ์ง๊ณํ๋ ์ฟผ๋ฆฌ
with monthly_user_action as (
--์๋ณ ์ฌ์ฉ์ ์ก์
์ง์ฝํ๊ธฐ
select distinct
u.user_id
, substring(u.register_date , 1, 7) as register_month
, substring(l.stamp , 1, 7) as action_month
, substring(cast(l.stamp::date - interval '1 month' as text) , 1, 7) as ACTION_MONTH_PRIV
from mst_users as U
inner join action_log as L
on U.user_id = L.user_id
)
, monthly_user_with_type AS(
select action_month
, user_id
, case when register_month = action_month
then 'new_user'
when action_month_priv = LAG(action_month) OVER(partition by user_id order by action_month)
then 'repeat_user'
else 'comback_user'
end as c
, action_month_priv
from monthly_user_action
)
, monthly_users as (select M1.action_month
,count(m1.user_id) as mau
,count(case when m1.c = 'new_user' then 1 end) as new_users
,count(case when m1.c = 'repeat_user' then 1 end) as repeat_users
,count(case when m1.c = 'comback_user' then 1 end) as comback_users
, count( case when m1.c = 'repeat_user' and m0.c = 'new_user' then 1 end) as new_repeat_users
, count( case when m1.c = 'repeat_user' and m0.c = 'repeat_user' then 1 end) as continuous_repeat_users
, count( case when m1.c = 'repeat_user' and m0.c = 'comback_user' then 1 end) as come_back_repeat_users
from monthly_user_with_type as m1
left outer join monthly_user_with_type as m0
on m1.user_id = m0.user_id
and m1.action_month_priv = m0.action_month
group by m1.action_month
)
select * from monthly_users
order by action_month;
)
|
SELECT DepositGroup , SUM(DepositAmount) AS TotalSum
FROM WizzardDeposits
GROUP BY DepositGroup
|
USE `store`;
CREATE TABLE authors
(
id BIGINT(20) PRIMARY KEY NOT NULL AUTO_INCREMENT,
name_and_last_name VARCHAR(255)
);
CREATE TABLE book_details
(
id BIGINT(20) PRIMARY KEY NOT NULL AUTO_INCREMENT,
content_type VARCHAR(255),
data LONGBLOB,
description LONGTEXT,
file_name VARCHAR(255),
size BIGINT(20),
book_id BIGINT(20)
);
CREATE TABLE books
(
id BIGINT(20) PRIMARY KEY NOT NULL AUTO_INCREMENT,
isbn VARCHAR(255),
name VARCHAR(255),
price DOUBLE,
quantity_in_stock INT(11),
category_id BIGINT(20)
);
CREATE TABLE books_authors
(
book_id BIGINT(20) NOT NULL,
authors_id BIGINT(20) NOT NULL
);
CREATE TABLE cart_items
(
id BIGINT(20) PRIMARY KEY NOT NULL AUTO_INCREMENT,
quantity INT(11) NOT NULL,
book_id BIGINT(20),
cart_id BIGINT(20)
);
CREATE TABLE carts
(
id BIGINT(20) PRIMARY KEY NOT NULL AUTO_INCREMENT,
expiry_date DATETIME,
total_price DOUBLE
);
CREATE TABLE categories
(
id BIGINT(20) PRIMARY KEY NOT NULL AUTO_INCREMENT,
name VARCHAR(255),
parent_id BIGINT(20)
);
CREATE TABLE checkouts
(
id BIGINT(20) PRIMARY KEY NOT NULL AUTO_INCREMENT,
cart_id BIGINT(20),
contact_info_id BIGINT(20),
delivery_info_id BIGINT(20)
);
CREATE TABLE contact_info
(
id BIGINT(20) PRIMARY KEY NOT NULL AUTO_INCREMENT,
first_name VARCHAR(255),
last_name VARCHAR(255),
phone VARCHAR(255)
);
CREATE TABLE delivery_info
(
id BIGINT(20) PRIMARY KEY NOT NULL AUTO_INCREMENT,
address VARCHAR(255),
city VARCHAR(255),
country VARCHAR(255),
postal_code VARCHAR(255),
customer_id BIGINT(20)
);
CREATE TABLE invoices
(
id BIGINT(20) PRIMARY KEY NOT NULL AUTO_INCREMENT,
expiry_date DATETIME,
gross_price DOUBLE,
status VARCHAR(255),
tax_amount DOUBLE,
checkout_id BIGINT(20)
);
CREATE TABLE users
(
id BIGINT(20) PRIMARY KEY NOT NULL AUTO_INCREMENT,
email VARCHAR(255),
password VARCHAR(255),
type VARCHAR(255),
username VARCHAR(255),
contact_info_id BIGINT(20)
);
ALTER TABLE book_details ADD FOREIGN KEY (book_id) REFERENCES books (id);
CREATE INDEX FKoa7sqrtgxwg066s9521udtvpv ON book_details (book_id);
ALTER TABLE books ADD FOREIGN KEY (category_id) REFERENCES categories (id);
CREATE INDEX FKleqa3hhc0uhfvurq6mil47xk0 ON books (category_id);
ALTER TABLE books_authors ADD FOREIGN KEY (book_id) REFERENCES books (id);
ALTER TABLE books_authors ADD FOREIGN KEY (authors_id) REFERENCES authors (id);
CREATE INDEX FK1b933slgixbjdslgwu888m34v ON books_authors (book_id);
CREATE INDEX FK20menrngp9wi9at1dsu5cbb8o ON books_authors (authors_id);
ALTER TABLE cart_items ADD FOREIGN KEY (book_id) REFERENCES books (id);
ALTER TABLE cart_items ADD FOREIGN KEY (cart_id) REFERENCES carts (id);
CREATE INDEX FKhiu1jw80o45wfiw5tgok1xpkl ON cart_items (book_id);
CREATE INDEX FKpcttvuq4mxppo8sxggjtn5i2c ON cart_items (cart_id);
ALTER TABLE categories ADD FOREIGN KEY (parent_id) REFERENCES categories (id);
CREATE INDEX FKsaok720gsu4u2wrgbk10b5n8d ON categories (parent_id);
ALTER TABLE checkouts ADD FOREIGN KEY (cart_id) REFERENCES carts (id);
ALTER TABLE checkouts ADD FOREIGN KEY (contact_info_id) REFERENCES contact_info (id);
ALTER TABLE checkouts ADD FOREIGN KEY (delivery_info_id) REFERENCES delivery_info (id);
CREATE INDEX FK86fuskbtwaroxm1cvjosp38rd ON checkouts (cart_id);
CREATE INDEX FKlq4vg49v14lmvg9xaws2unr7o ON checkouts (contact_info_id);
CREATE INDEX FKo8go6r9sylyg9gohwd0vtyg7r ON checkouts (delivery_info_id);
ALTER TABLE delivery_info ADD FOREIGN KEY (customer_id) REFERENCES users (id);
CREATE INDEX FKpu1p3umcrw4iwuamcej3stecm ON delivery_info (customer_id);
ALTER TABLE invoices ADD FOREIGN KEY (checkout_id) REFERENCES checkouts (id);
CREATE INDEX FKth0mk832424ly9uc1ju765e22 ON invoices (checkout_id);
ALTER TABLE users ADD FOREIGN KEY (contact_info_id) REFERENCES contact_info (id);
CREATE INDEX FKhrhbec6xa18rkht81ls2bbgoj ON users (contact_info_id); |
create table site_uptime (
dt DATE,
site_id INT NOT NULL,
attribute VARCHAR(20),
uptime INT,
PRIMARY KEY (dt, site_id, attribute)
) ENGINE=InnoDB CHARSET=latin1; |
CREATE OR REPLACE VIEW "RESOURCE_CAPACITY"."PNMAC"."VW_REDLINEACTUALS_V2" AS
SELECT
/* Employee Info */
rl.user_login as network_login
,dwo.employeeid as employee_id
,dwo.departmentid as employee_departmentid
,dept_emp.divisionid as employee_divisionid
/* Time Entry Features */
,(CASE WHEN length(trim(rl.itid)) < 3 THEN rl.project_identifier else trim(rl.itid) END) as effort_id
,(CASE WHEN rl.entry_activity = 'Capitalized' THEN 'Yes' ELSE 'No' END) as redline_capitalization
/* Time info */
,rl.entry_year as year
,'Q'||extract(quarter from rl.entry_date) as quarter
,extract(month from rl.entry_date) as month
,rl.entry_week as week
,rl.entry_date as entry_date
,rl.entry_hours as billable_hours
/* Redline Selections */
,rl.project_name as redline_project
,rl.project_identifier as redline_project_identifier
,TO_CHAR(rl.issue_id) as redline_issue
,TO_CHAR(rl.issue_subject) as redline_issue_subject
,ifnull(rl.issue_impacted_application_id,rl.project_impacted_application_id) as redline_application_id
,ifnull((CASE WHEN rl.issue_impacted_application = '<None>' THEN null END),rl.project_impacted_application) as redline_application_name
,rl.break_fix_lights_on_enhancement
,rl.primary_delivery_team as redline_primary_delivery_team
/* Billed To */
,s.sub_division_id as billed_sub_division_id
,ifnull(s.department_id,(CASE WHEN length(rl.project_billed_department_id) = 4 THEN rl.project_billed_department_id ELSE null END)) as redline_project_billed_department_id
,(CASE WHEN length(rl.project_billed_department_id) = 4 THEN rl.project_billed_department_name ELSE null END) as redline_project_billed_department_name
,ifnull(s.division_id,(CASE WHEN length(rl.project_billed_department_id) = 3 THEN rl.project_billed_department_id ELSE dept.divisionid END)) as redline_project_billed_division_id
,(CASE WHEN length(rl.project_billed_department_id) = 3 THEN rl.project_billed_department_name ELSE div.name END) as redline_project_billed_division_name
/* Calculations and Logic */
,(CASE
WHEN rl.itid = 'OOO' THEN 'OOO'
WHEN rl.redline_project_category = 'Maintenance' THEN 'MAINT'
WHEN rl.project_identifier = 'administration' THEN 'ADMIN'
WHEN rl.itid in ('WK068','WK075','WK096','WK118','WK122','WK128','WK131','WK154',
'WK165','WK174','WK175','WK176','WK177','WK178','WK179','WK180',
'WK181','WK182','WK183','WK184','WK185','WK186','WK187','WK188',
'WK190','WK181','WK194','WK197','WK198','WK201','WK202','WK209','WK228','WK237',
'WK232','WK234','WK247','WK318','WK911','WK913') THEN 'ADMIN'
WHEN left(trim(rl.itid),2) = 'WK' THEN 'MAINT'
ELSE 'PROJ' END) as WORK_CATEGORY
FROM "REDLINE"."PNMAC"."VW_TIMESHEETENTRIES" rl
LEFT JOIN
"DW_ORG"."PNMAC"."VW_ONE_ROW_PER_EMPLOYEE" dwo ON trim(lower(rl.USER_LOGIN)) = trim(lower(dwo.networklogin)) and dwo.rowcurrentflag = 'Y'
LEFT JOIN "RESOURCE_CAPACITY"."PNMAC"."VW_EFFORTLISTING" el ON (CASE WHEN length(trim(rl.itid)) < 3 THEN rl.project_identifier else trim(rl.itid) END) = el.effort_id and rl.entry_year = el.year
LEFT JOIN "RESOURCE_CAPACITY"."PNMAC"."SUB_DIVISIONS" s ON el.billable_to_sub_division_id = s.sub_division_id
LEFT JOIN "DW_ORG"."PNMAC"."DEPARTMENT" dept ON rl.project_billed_department_id = dept.departmentid
LEFT JOIN "DW_ORG"."PNMAC"."DIVISION" div ON dept.divisionid = div.divisionid
LEFT JOIN "DW_ORG"."PNMAC"."DEPARTMENT" dept_emp ON dwo.DEPARTMENTID = dept_emp.DEPARTMENTID
WHERE
(
(lower(rl.USER_LOGIN) not in ('ssharma','dpandurangi','sverma') and rl.ENTRY_LAST_UPDATED >= '2018-07-02')
OR
(lower(rl.USER_LOGIN) in ('ssharma','dpandurangi','sverma') and rl.ENTRY_LAST_UPDATED >= '2018-07-15')
)
AND
/* We need to ignore certain parts of Redline2 ... */
rl.project_identifier <> 'servdata';
|
๏ปฟ-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE PROCEDURE sp_Busca_Facturado_Cobrado
-- Add the parameters for the stored procedure here
@idProyecto int,
@idEmpresa int,
@fecha datetime
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
SELECT ERP.Proyecto.ID, ERP.Proyecto.Nombre, ERP.Proyecto.Numero, ERP.Proyecto.IdEmpresa,
ERP.Comprobante.Serie, ERP.Comprobante.Documento, ERP.Comprobante.Fecha, ERP.Comprobante.IdMoneda,
ERP.Comprobante.SubTotal, ERP.Comprobante.IGV, ERP.Comprobante.Total, ERP.Comprobante.IdComprobanteEstado,
ERP.CuentaCobrar.ID as idCuentaCobrar, ERP.CuentaCobrar.IdMoneda, ERP.CuentaCobrar.Total, ERP.Comprobante.Fecha
FROM (ERP.Proyecto INNER JOIN ERP.Comprobante ON (ERP.Proyecto.IdEmpresa = ERP.Comprobante.IdEmpresa) AND
(ERP.Proyecto.ID = ERP.Comprobante.IdProyecto)) INNER JOIN ERP.CuentaCobrar ON
(ERP.Comprobante.IdEmpresa = ERP.CuentaCobrar.IdEmpresa) AND (ERP.Comprobante.Documento = ERP.CuentaCobrar.Numero) AND
(ERP.Comprobante.Serie = ERP.CuentaCobrar.Serie)
WHERE (((ERP.Proyecto.ID)=@idProyecto) AND ((ERP.Proyecto.IdEmpresa)=@idEmpresa) AND
((ERP.Comprobante.IdComprobanteEstado)=2) AND
(( cast(ERP.Comprobante.Fecha as date))<=@fecha))
END |
drop table flashcard;
drop table user_roles;
drop table users;
-- New spring security compliant tables:
CREATE TABLE `USERS` (
`userid` int(11) NOT NULL AUTO_INCREMENT,
`email` varchar(255) DEFAULT NULL,
`password` varchar(255) DEFAULT NULL,
`username` varchar(255) DEFAULT NULL,
`enabled` tinyint(1) NOT NULL,
PRIMARY KEY (`userid`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8;
CREATE TABLE `USER_ROLE` (
`user_role_id` int(10) NOT NULL,
`userid` int(11) NOT NULL,
`authority` varchar(45) NOT NULL,
PRIMARY KEY (`user_role_id`),
KEY `FK_user_role` (`userid`),
CONSTRAINT `FK_user_role` FOREIGN KEY (`userid`) REFERENCES `users` (`userid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `FLASHCARD` (
`fid` int(11) NOT NULL AUTO_INCREMENT,
`answer` varchar(255) DEFAULT NULL,
`question` varchar(255) DEFAULT NULL,
`topic` varchar(255) DEFAULT NULL,
`userid` int(11) DEFAULT NULL,
PRIMARY KEY (`fid`),
KEY `FK_flashcard_user` (`userid`),
CONSTRAINT `FK_flashcard_user` FOREIGN KEY (`userid`) REFERENCES `USERS` (`userid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- inserts updated for spring security
insert into users (userid, username, password, email, enabled)
values(1, 'bob', 'ee11cbb19052e40b07aac0ca060c23ee', 'bob@domain.com', 1);
insert into users (userid, username, password, email, enabled)
values(2, 'tom', '21232f297a57a5a743894a0e4a801fc3', 'tom@org.gov', 1);
INSERT INTO user_role (USER_ROLE_ID, USERID,AUTHORITY)
VALUES (1, 1, 'ROLE_USER');
INSERT INTO user_role (USER_ROLE_ID, USERID,AUTHORITY)
VALUES (2, 2, 'ROLE_ADMIN');
insert into FLASHCARD (fid, question, answer, topic, userid) values(1, 'What is your name?', 'charlton', 'people', 1);
insert into FLASHCARD (fid, question, answer, topic, userid) values(2, 'Who is your boss?', 'myself', 'happy', 2);
insert into FLASHCARD (fid, question, answer, topic, userid) values(3, 'What is the capital of Greece?', 'Athens', 'Geography', 1);
insert into FLASHCARD (fid, question, answer, topic, userid) values(4, 'Hello', 'Hola', 'Languages', 2);
|
๏ปฟ
CREATE PROC [Maestro].[Usp_Sel_TipoMovimiento]
AS
BEGIN
SELECT [ID]
,[Nombre]
,[Abreviatura]
FROM [Maestro].[TipoMovimiento]
END
|
DROP TABLE IF EXISTS GERENTE;
DROP TABLE IF EXISTS TRABALHA;
DROP TABLE IF EXISTS COMPANHIA;
DROP TABLE IF EXISTS EMPREGADO;
CREATE TABLE public."Empregado"
(
cod_empregado integer,
nome_empregado character varying(50),
rua character varying(50),
cidade character varying(50),
salario double precision,
PRIMARY KEY (cod_empregado)
);
CREATE TABLE public."Companhia"
(
"CNPJ" character varying(14) NOT NULL,
nome_companhia character varying(50),
cidade character varying(50),
PRIMARY KEY ("CNPJ")
);
CREATE TABLE public."Trabalha"
(
"CNPJ" character varying(14) COLLATE pg_catalog."default" NOT NULL,
cod_empregado integer NOT NULL,
CONSTRAINT "Trabalha_pkey" PRIMARY KEY ("CNPJ", cod_empregado),
CONSTRAINT "FK_Companhia" FOREIGN KEY ("CNPJ")
REFERENCES public."Companhia" ("CNPJ") MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
NOT VALID,
CONSTRAINT "FK_Empregado" FOREIGN KEY (cod_empregado)
REFERENCES public."Empregado" (cod_empregado) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
NOT VALID
);
CREATE TABLE public."Gerente"
(
cod_empregado integer NOT NULL,
cod_companhia character varying(14) COLLATE pg_catalog."default" NOT NULL,
CONSTRAINT "Gerente_pkey" PRIMARY KEY (cod_empregado, cod_companhia),
CONSTRAINT "FK_Companhia" FOREIGN KEY (cod_companhia)
REFERENCES public."Companhia" ("CNPJ") MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION,
CONSTRAINT "FK_Empregado" FOREIGN KEY (cod_empregado)
REFERENCES public."Empregado" (cod_empregado) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
); |
SELECT
c.id,
c.assignee_id,
c.created_at,
MIN(p.created_at) AS closed_date
FROM
roberto_salcido899.solutionsintercomconvosv2 c
JOIN roberto_salcido899.solutionsdemointercomconvopartsv2 p ON p.conversation_id = c.id AND p.part_type = 'close'
AND EXTRACT(dow FROM c.created_at) NOT IN (0,6)
AND DATE_PART('Hour', c.created_at) BETWEEN 7 AND 18
GROUP BY 1,2,3
ORDER BY 2 |
--
-- PostgreSQL database dump
--
SET statement_timeout = 0;
SET lock_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SET check_function_bodies = false;
SET client_min_messages = warning;
--
-- Name: plpgsql; Type: EXTENSION; Schema: -; Owner:
--
CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
--
-- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner:
--
COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
SET search_path = public, pg_catalog;
SET default_tablespace = '';
SET default_with_oids = false;
--
-- Name: albums; Type: TABLE; Schema: public; Owner: photoalbum; Tablespace:
--
CREATE TABLE albums (
album_id integer NOT NULL,
title character varying(50) NOT NULL,
created_date date NOT NULL,
cover_photo_id integer NOT NULL
);
ALTER TABLE albums OWNER TO photoalbum;
--
-- Name: albums_album_id_seq; Type: SEQUENCE; Schema: public; Owner: photoalbum
--
CREATE SEQUENCE albums_album_id_seq
START WITH 3
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE albums_album_id_seq OWNER TO photoalbum;
--
-- Name: albums_album_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: photoalbum
--
ALTER SEQUENCE albums_album_id_seq OWNED BY albums.album_id;
--
-- Name: photos; Type: TABLE; Schema: public; Owner: photoalbum; Tablespace:
--
CREATE TABLE photos (
photo_id integer NOT NULL,
title character varying(50) NOT NULL,
created_date date NOT NULL,
file_path character varying(100) NOT NULL,
album_id integer NOT NULL
);
ALTER TABLE photos OWNER TO photoalbum;
--
-- Name: photos_photo_id_seq; Type: SEQUENCE; Schema: public; Owner: photoalbum
--
CREATE SEQUENCE photos_photo_id_seq
START WITH 6
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE photos_photo_id_seq OWNER TO photoalbum;
--
-- Name: photos_photo_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: photoalbum
--
ALTER SEQUENCE photos_photo_id_seq OWNED BY photos.photo_id;
--
-- Name: album_id; Type: DEFAULT; Schema: public; Owner: photoalbum
--
ALTER TABLE ONLY albums ALTER COLUMN album_id SET DEFAULT nextval('albums_album_id_seq'::regclass);
--
-- Name: photo_id; Type: DEFAULT; Schema: public; Owner: photoalbum
--
ALTER TABLE ONLY photos ALTER COLUMN photo_id SET DEFAULT nextval('photos_photo_id_seq'::regclass);
--
-- Name: albums_pkey; Type: CONSTRAINT; Schema: public; Owner: photoalbum; Tablespace:
--
ALTER TABLE ONLY albums
ADD CONSTRAINT albums_pkey PRIMARY KEY (album_id);
--
-- Name: photos_pkey; Type: CONSTRAINT; Schema: public; Owner: photoalbum; Tablespace:
--
ALTER TABLE ONLY photos
ADD CONSTRAINT photos_pkey PRIMARY KEY (photo_id);
--
-- Name: public; Type: ACL; Schema: -; Owner: photoalbum
--
REVOKE ALL ON SCHEMA public FROM PUBLIC;
REVOKE ALL ON SCHEMA public FROM photoalbum;
GRANT ALL ON SCHEMA public TO photoalbum;
GRANT ALL ON SCHEMA public TO PUBLIC;
--
-- PostgreSQL database dump complete
--
|
create table BURI_TEST_INT (
TEST_ID bigint not null,
VALUE varchar(100) not null,
VERSION_NO bigint not null,
constraint BURI_TEST_INT_PK primary key(TEST_ID)
);
|
set define off;
-- Remove HARMONY.TSOD_TYPE_SEQ-sequence and HARMONY.TSOD_TYPE-table
BEGIN HARMONY.DOIT('DROP SEQUENCE HARMONY.SOD_TYPE_SEQ');END;
/
BEGIN HARMONY.DOIT('DROP TABLE HARMONY.TSOD_TYPE');END; |
SELECT *
FROM customer_1.Dunder_Mifflin
WHERE purchased_at > '{{purchase_start_date}}'
AND purchased_at < '{{purchase_end_date}}'
AND account_manager = 'Angela Martin'
|
-- MySQL Workbench Forward Engineering
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES';
-- -----------------------------------------------------
-- Schema mydb
-- -----------------------------------------------------
-- -----------------------------------------------------
-- Schema db_web
-- -----------------------------------------------------
-- -----------------------------------------------------
-- Schema db_web
-- -----------------------------------------------------
CREATE SCHEMA IF NOT EXISTS `db_web` DEFAULT CHARACTER SET utf8 ;
USE `db_web` ;
-- -----------------------------------------------------
-- Table `db_web`.`status`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `db_web`.`status` (
`idstatus` INT(11) NOT NULL AUTO_INCREMENT,
`nome` VARCHAR(10) NULL DEFAULT NULL,
PRIMARY KEY (`idstatus`))
ENGINE = InnoDB
AUTO_INCREMENT = 3
DEFAULT CHARACTER SET = utf8;
-- -----------------------------------------------------
-- Table `db_web`.`aparelho`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `db_web`.`aparelho` (
`idaparelho` INT(11) NOT NULL AUTO_INCREMENT,
`modelo` VARCHAR(70) NULL DEFAULT NULL,
`descricao` VARCHAR(255) NULL DEFAULT NULL,
`status_id` INT(11) NOT NULL,
`cor` VARCHAR(45) NULL,
`equipamento` VARCHAR(50) NULL,
`numeroSerie` VARCHAR(50) NULL,
PRIMARY KEY (`idaparelho`, `status_id`),
INDEX `fk_aparelho_status1_idx` (`status_id` ASC),
CONSTRAINT `fk_aparelho_status1`
FOREIGN KEY (`status_id`)
REFERENCES `db_web`.`status` (`idstatus`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB
AUTO_INCREMENT = 27
DEFAULT CHARACTER SET = utf8;
-- -----------------------------------------------------
-- Table `db_web`.`empresa`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `db_web`.`empresa` (
`idempresa` INT(11) NOT NULL AUTO_INCREMENT,
`nome` VARCHAR(100) NULL DEFAULT NULL,
PRIMARY KEY (`idempresa`))
ENGINE = InnoDB
AUTO_INCREMENT = 3
DEFAULT CHARACTER SET = utf8;
-- -----------------------------------------------------
-- Table `db_web`.`usuario`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `db_web`.`usuario` (
`idusuario` INT(11) NOT NULL AUTO_INCREMENT,
`email` VARCHAR(45) NULL DEFAULT NULL,
`senha` VARCHAR(45) NULL DEFAULT NULL,
`nome` VARCHAR(45) NULL DEFAULT NULL,
PRIMARY KEY (`idusuario`))
ENGINE = InnoDB
AUTO_INCREMENT = 2
DEFAULT CHARACTER SET = utf8;
-- -----------------------------------------------------
-- Table `db_web`.`manutencao`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `db_web`.`manutencao` (
`idmanutencao` INT(11) NOT NULL AUTO_INCREMENT,
`data` DATE NULL DEFAULT NULL,
`valor` DOUBLE(10,2) NULL DEFAULT NULL,
`descricao` VARCHAR(255) NULL DEFAULT NULL,
`aparelho_id` INT(11) NOT NULL,
`empresa_id` INT(11) NOT NULL,
`usuario_id` INT(11) NOT NULL,
`ordemServico` INT NULL,
PRIMARY KEY (`idmanutencao`, `aparelho_id`, `empresa_id`, `usuario_id`),
INDEX `fk_manutencao_aparelho_idx` (`aparelho_id` ASC),
INDEX `fk_manutencao_empresa1_idx` (`empresa_id` ASC),
INDEX `fk_manutencao_user1_idx` (`usuario_id` ASC),
CONSTRAINT `fk_manutencao_aparelho`
FOREIGN KEY (`aparelho_id`)
REFERENCES `db_web`.`aparelho` (`idaparelho`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_manutencao_empresa1`
FOREIGN KEY (`empresa_id`)
REFERENCES `db_web`.`empresa` (`idempresa`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_manutencao_user1`
FOREIGN KEY (`usuario_id`)
REFERENCES `db_web`.`usuario` (`idusuario`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB
AUTO_INCREMENT = 4
DEFAULT CHARACTER SET = utf8;
SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
|
create database exercicio02;
use exercicio02;
create table produtos (
codigo int primary key auto_increment,
produto varchar(40),
categoria varchar(20),
valor double,
cadastro date
);
insert into produtos values
(null,"Smartphone Samsung A8","telefonia", 1400.00 , '2019-07-22'),
(null, "Notebook Acer A650","informรกtica",'3800.00' , '2019-03-19'),
(null, "Telefone sem fio Intelbras","telefonia",'129.90', '2018-12-20'),
(null, "iPhone XR","telefonia", '5499.00', '2019-07-08'),
(null, "Notebook Dell Espiron 500","informรกtica",'3975.80', '2019-01-29'),
(null, "All in one LG A8574","informรกtica",'2547.12', '2019-02-13'),
(null, "Smartphone Motorola G7","telefonia",'799.00', '2019-04-03'),
(null, "Smartphone Galaxy S10","telefonia",'4600.00', '2019-05-03'),
(null, "Notebook Acer Axpros 47","informรกtica",'2857.00', '2019-08-16'),
(null, "Smartphone Asus Zenfone 6","telefonia",'2356.00', '2018-07-29'),
(null, "Smartphone Samsung J4", null, '1700.00', '2018-06-16');
set SQL_SAFE_UPDATES = 0;
select*from produtos;
select count(*) from produtos;
select produto, valor from produtos where cadastro between "2019-04-01" and "2019-07-31";
update produtos set categoria = "telefonia" where categoria is null;
select categoria, count(categoria) from produtos group by categoria;
select avg(valor) from produtos;
SELECT round(avg (valor),2) from produtos; # UTILIZAR O ROUND ARREDONDA A QUANTIDADE DE CASAS APรS A VIRGULA.
select * from produtos where valor = (select min(valor) from produtos);
select * from produtos where categoria = "telefonia" and valor >=4000.00;
select * from produtos where cadastro < "2018-12-30" and cadastro > "2018-01-01";
delete from produtos where produto like "%LG%" or produto like "%Samsung%";
select codigo from produtos where produto like "%intelbras%";
drop table produtos;
drop database exercicio02;
|
insert into avatars (avatar_base_type_id, level, skin, hair, picture_url, night_background_url, day_background_url, status, text_id, created_by, created_date)
values
(5, 1, 1, 3, 's1h3.png', 'night1.png', 'day1.png', 'ACTIVE', 1, 1, current_timestamp),
(5, 2, 1, 3, 's1h3.png', 'night1.png', 'day1.png', 'ACTIVE', 1, 1, current_timestamp),
(5, 3, 1, 3, 's1h3.png', 'night1.png', 'day1.png', 'ACTIVE', 1, 1, current_timestamp),
(5, 4, 1, 3, 's1h3.png', 'night1.png', 'day1.png', 'ACTIVE', 1, 1, current_timestamp),
(5, 5, 1, 3, 's1h3.png', 'night1.png', 'day1.png', 'ACTIVE', 1, 1, current_timestamp),
(5, 6, 1, 3, 's1h3.png', 'night1.png', 'day1.png', 'ACTIVE', 1, 1, current_timestamp),
(5, 7, 1, 3, 's1h3.png', 'night1.png', 'day1.png', 'ACTIVE', 1, 1, current_timestamp),
(5, 8, 1, 3, 's1h3.png', 'night1.png', 'day1.png', 'ACTIVE', 1, 1, current_timestamp),
(5, 9, 1, 3, 's1h3.png', 'night1.png', 'day1.png', 'ACTIVE', 1, 1, current_timestamp),
(5, 10, 1, 3, 's1h3.png', 'night10.png', 'day10.png', 'ACTIVE', 1, 1, current_timestamp),
(5, 11, 1, 3, 's1h3.png', 'night10.png', 'day10.png', 'ACTIVE', 1, 1, current_timestamp),
(5, 12, 1, 3, 's1h3.png', 'night10.png', 'day10.png', 'ACTIVE', 1, 1, current_timestamp),
(5, 13, 1, 3, 's1h3.png', 'night10.png', 'day10.png', 'ACTIVE', 1, 1, current_timestamp),
(5, 14, 1, 3, 's1h3.png', 'night10.png', 'day10.png', 'ACTIVE', 1, 1, current_timestamp),
(5, 15, 1, 3, 's1h3.png', 'night10.png', 'day10.png', 'ACTIVE', 1, 1, current_timestamp),
(5, 16, 1, 3, 's1h3.png', 'night10.png', 'day10.png', 'ACTIVE', 1, 1, current_timestamp),
(5, 17, 1, 3, 's1h3.png', 'night10.png', 'day10.png', 'ACTIVE', 1, 1, current_timestamp),
(5, 18, 1, 3, 's1h3.png', 'night10.png', 'day10.png', 'ACTIVE', 1, 1, current_timestamp),
(5, 19, 1, 3, 's1h3.png', 'night10.png', 'day10.png', 'ACTIVE', 1, 1, current_timestamp),
(5, 20, 1, 3, 's1h3.png', 'night20.png', 'day20.png', 'ACTIVE', 1, 1, current_timestamp),
(5, 21, 1, 3, 's1h3.png', 'night20.png', 'day20.png', 'ACTIVE', 1, 1, current_timestamp),
(5, 22, 1, 3, 's1h3.png', 'night20.png', 'day20.png', 'ACTIVE', 1, 1, current_timestamp),
(5, 23, 1, 3, 's1h3.png', 'night20.png', 'day20.png', 'ACTIVE', 1, 1, current_timestamp),
(5, 24, 1, 3, 's1h3.png', 'night20.png', 'day20.png', 'ACTIVE', 1, 1, current_timestamp),
(5, 25, 1, 3, 's1h3.png', 'night20.png', 'day20.png', 'ACTIVE', 1, 1, current_timestamp),
(5, 26, 1, 3, 's1h3.png', 'night20.png', 'day20.png', 'ACTIVE', 1, 1, current_timestamp),
(5, 27, 1, 3, 's1h3.png', 'night20.png', 'day20.png', 'ACTIVE', 1, 1, current_timestamp),
(5, 28, 1, 3, 's1h3.png', 'night20.png', 'day20.png', 'ACTIVE', 1, 1, current_timestamp),
(5, 29, 1, 3, 's1h3.png', 'night20.png', 'day20.png', 'ACTIVE', 1, 1, current_timestamp),
(5, 30, 1, 3, 's1h3.png', 'night30.png', 'day30.png', 'ACTIVE', 1, 1, current_timestamp),
(5, 31, 1, 3, 's1h3.png', 'night30.png', 'day30.png', 'ACTIVE', 1, 1, current_timestamp),
(5, 32, 1, 3, 's1h3.png', 'night30.png', 'day30.png', 'ACTIVE', 1, 1, current_timestamp),
(5, 33, 1, 3, 's1h3.png', 'night30.png', 'day30.png', 'ACTIVE', 1, 1, current_timestamp),
(5, 34, 1, 3, 's1h3.png', 'night30.png', 'day30.png', 'ACTIVE', 1, 1, current_timestamp),
(5, 35, 1, 3, 's1h3.png', 'night30.png', 'day30.png', 'ACTIVE', 1, 1, current_timestamp),
(5, 36, 1, 3, 's1h3.png', 'night30.png', 'day30.png', 'ACTIVE', 1, 1, current_timestamp),
(5, 37, 1, 3, 's1h3.png', 'night30.png', 'day30.png', 'ACTIVE', 1, 1, current_timestamp),
(5, 38, 1, 3, 's1h3.png', 'night30.png', 'day30.png', 'ACTIVE', 1, 1, current_timestamp),
(5, 39, 1, 3, 's1h3.png', 'night30.png', 'day30.png', 'ACTIVE', 1, 1, current_timestamp),
(5, 40, 1, 3, 's1h3.png', 'night40.png', 'day40.png', 'ACTIVE', 1, 1, current_timestamp),
(5, 41, 1, 3, 's1h3.png', 'night40.png', 'day40.png', 'ACTIVE', 1, 1, current_timestamp),
(5, 42, 1, 3, 's1h3.png', 'night40.png', 'day40.png', 'ACTIVE', 1, 1, current_timestamp),
(5, 43, 1, 3, 's1h3.png', 'night40.png', 'day40.png', 'ACTIVE', 1, 1, current_timestamp),
(5, 44, 1, 3, 's1h3.png', 'night40.png', 'day40.png', 'ACTIVE', 1, 1, current_timestamp),
(5, 45, 1, 3, 's1h3.png', 'night40.png', 'day40.png', 'ACTIVE', 1, 1, current_timestamp),
(5, 46, 1, 3, 's1h3.png', 'night40.png', 'day40.png', 'ACTIVE', 1, 1, current_timestamp),
(5, 47, 1, 3, 's1h3.png', 'night40.png', 'day40.png', 'ACTIVE', 1, 1, current_timestamp),
(5, 48, 1, 3, 's1h3.png', 'night40.png', 'day40.png', 'ACTIVE', 1, 1, current_timestamp),
(5, 49, 1, 3, 's1h3.png', 'night40.png', 'day40.png', 'ACTIVE', 1, 1, current_timestamp);
|
-- MySQL dump 10.13 Distrib 5.5.9, for Win32 (x86)
--
-- Host: 174.122.31.166 Database: dentists_dsusa_site
-- ------------------------------------------------------
-- Server version 5.0.92-community
/*!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 */;
--
-- Not dumping tablespaces as no INFORMATION_SCHEMA.FILES table on this server
--
--
-- Current Database: `dentists_dsusa_site`
--
CREATE DATABASE /*!32312 IF NOT EXISTS*/ `dentists_dsusa_site` /*!40100 DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci */;
USE `dentists_dsusa_site`;
--
-- Table structure for table `admin`
--
DROP TABLE IF EXISTS `admin`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `admin` (
`id` int(11) NOT NULL auto_increment,
`login` varchar(255) default NULL,
`password` varchar(255) default NULL,
`salt` varchar(255) default NULL,
`level` int(11) default NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=14 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `admin_advertisements`
--
DROP TABLE IF EXISTS `admin_advertisements`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `admin_advertisements` (
`id` int(11) NOT NULL auto_increment,
`image` varchar(255) default NULL,
`title` varchar(64) default NULL,
`text` varchar(255) default NULL,
`links` varchar(255) default NULL,
`name` varchar(255) default NULL,
`page` varchar(255) default NULL,
`order` int(11) default NULL,
`use_default` int(11) default NULL,
`align` enum('left','right') default NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=20 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `admin_email_templates`
--
DROP TABLE IF EXISTS `admin_email_templates`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `admin_email_templates` (
`id` int(11) NOT NULL auto_increment,
`subject` varchar(255) default NULL,
`content` text,
`type` varchar(255) default NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `admin_inquiries`
--
DROP TABLE IF EXISTS `admin_inquiries`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `admin_inquiries` (
`id` int(18) NOT NULL auto_increment,
`name` varchar(150) default NULL,
`email` varchar(150) default NULL,
`message` text,
`date` varchar(150) default NULL,
`is_dentist` int(1) default '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `admin_privileges`
--
DROP TABLE IF EXISTS `admin_privileges`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `admin_privileges` (
`id` int(11) NOT NULL auto_increment,
`privilege_id` int(11) default NULL,
`admin_id` int(11) default NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=9 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `admin_profiles`
--
DROP TABLE IF EXISTS `admin_profiles`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `admin_profiles` (
`id` int(255) NOT NULL auto_increment,
`user_id` text NOT NULL,
`fname` text NOT NULL,
`mname` text NOT NULL,
`lname` text NOT NULL,
`photo` text NOT NULL,
`st` text NOT NULL,
`town` text NOT NULL,
`city` text NOT NULL,
`zipcode` text NOT NULL,
`state_id` text NOT NULL,
`telno` text NOT NULL,
`emailaddress` text NOT NULL,
`website` text NOT NULL,
`shortbio` text NOT NULL,
`ofchrs` text NOT NULL,
`promos` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `admin_seo_tags`
--
DROP TABLE IF EXISTS `admin_seo_tags`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `admin_seo_tags` (
`id` int(11) NOT NULL auto_increment,
`page` varchar(255) default NULL,
`title` varchar(255) default NULL,
`keywords` varchar(255) default NULL,
`description` text,
`content` text,
`editable_content` int(11) default NULL,
`content_only` int(11) default NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=11 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `admin_setting_choices`
--
DROP TABLE IF EXISTS `admin_setting_choices`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `admin_setting_choices` (
`id` int(11) NOT NULL auto_increment,
`value` varchar(255) default NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `admin_setting_privileges`
--
DROP TABLE IF EXISTS `admin_setting_privileges`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `admin_setting_privileges` (
`id` int(11) NOT NULL auto_increment,
`name` varchar(255) default NULL,
`description` text,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `admin_settings`
--
DROP TABLE IF EXISTS `admin_settings`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `admin_settings` (
`id` int(11) NOT NULL auto_increment,
`analytics_id` varchar(255) default NULL,
`search_result_text` varchar(255) default NULL,
`footer_tags` text,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `admin_social_media_icons`
--
DROP TABLE IF EXISTS `admin_social_media_icons`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `admin_social_media_icons` (
`id` int(11) NOT NULL auto_increment,
`icon` varchar(255) default NULL,
`link` varchar(255) default NULL,
`tooltip` varchar(255) default NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=12 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Temporary table structure for view `bayesian_rating`
--
DROP TABLE IF EXISTS `bayesian_rating`;
/*!50001 DROP VIEW IF EXISTS `bayesian_rating`*/;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE TABLE `bayesian_rating` (
`user_id` int(11),
`avg_num_votes` decimal(23,4),
`avg_rating` double,
`this_num_votes` bigint(20),
`this_rating` double,
`the_rating` double
) ENGINE=MyISAM */;
SET character_set_client = @saved_cs_client;
--
-- Temporary table structure for view `city_population`
--
DROP TABLE IF EXISTS `city_population`;
/*!50001 DROP VIEW IF EXISTS `city_population`*/;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE TABLE `city_population` (
`city_population` decimal(30,0),
`city_name` varchar(40),
`state_abbr` varchar(2)
) ENGINE=MyISAM */;
SET character_set_client = @saved_cs_client;
--
-- Table structure for table `cms_patients`
--
DROP TABLE IF EXISTS `cms_patients`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `cms_patients` (
`id` int(11) NOT NULL auto_increment,
`caller_name` varchar(255) default NULL,
`dental_emergency` varchar(1) default NULL,
`phone` varchar(255) default NULL,
`pain_level` varchar(2) default NULL,
`patient_name` varchar(255) default NULL,
`dentist_assigned_to` int(11) default NULL,
`fear_of_dentist` varchar(1) default NULL,
`last_appointment_date` date default NULL,
`birth_day` date default NULL,
`address` varchar(255) default NULL,
`city` varchar(255) default NULL,
`state` varchar(255) default NULL,
`zip` varchar(255) default NULL,
`email` varchar(255) default NULL,
`notes` text,
`office_contact` varchar(255) default NULL,
`author_added` int(255) default NULL,
`author_updated` int(255) default NULL,
`added` datetime default NULL,
`updated` datetime default NULL,
`pdf_file` varchar(255) default NULL,
`appointment_date` date default NULL,
`appointment_time` varchar(255) default NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `cms_users`
--
DROP TABLE IF EXISTS `cms_users`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `cms_users` (
`id` int(11) NOT NULL auto_increment,
`name` varchar(255) default NULL,
`login` varchar(255) default NULL,
`password` varchar(255) default NULL,
`salt` varchar(255) default NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `content_articles`
--
DROP TABLE IF EXISTS `content_articles`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `content_articles` (
`id` int(18) NOT NULL auto_increment,
`title` varchar(200) default NULL,
`summary` text,
`content` text,
`image` varchar(200) default NULL,
`author` varchar(200) default NULL,
`date` date default NULL,
`category_id` int(18) NOT NULL,
`tags` text,
PRIMARY KEY (`id`),
FULLTEXT KEY `title` (`title`,`summary`,`content`,`tags`)
) ENGINE=MyISAM AUTO_INCREMENT=9 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `content_categories`
--
DROP TABLE IF EXISTS `content_categories`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `content_categories` (
`id` int(18) NOT NULL auto_increment,
`category_title` varchar(200) default NULL,
`description` text,
`type` int(11) default NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `content_videos`
--
DROP TABLE IF EXISTS `content_videos`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `content_videos` (
`id` int(18) NOT NULL auto_increment,
`title` varchar(200) default NULL,
`size` varchar(150) default NULL,
`summary` text,
`date` date default NULL,
`tags` text,
`image` varchar(150) default NULL,
`filename` varchar(150) default NULL,
`category_id` int(11) default NULL,
PRIMARY KEY (`id`),
FULLTEXT KEY `title` (`title`,`summary`,`tags`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `data_cities`
--
DROP TABLE IF EXISTS `data_cities`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `data_cities` (
`id` int(11) NOT NULL auto_increment,
`city_name` varchar(40) character set utf8 default NULL,
`state_abbr` varchar(2) character set utf8 default NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=29829 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `data_dentists_raw_distinct`
--
DROP TABLE IF EXISTS `data_dentists_raw_distinct`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `data_dentists_raw_distinct` (
`id` int(11) NOT NULL auto_increment,
`user_id` int(11) default NULL,
`first_name` varchar(255) default NULL,
`last_name` varchar(255) default NULL,
`middle_initial` varchar(255) default NULL,
`post_nominal` varchar(255) default NULL,
`name` text,
`company_name` text,
`bio` text,
`address` text,
`city` text,
`state` text,
`zip` text,
`phone` text,
`login_email` varchar(255) default NULL,
`email` text,
`website` text,
`monday` text,
`tuesday` text,
`wednesday` text,
`thursday` text,
`friday` text,
`saturday` text,
`sunday` text,
`qualifications` text,
`certifications` text,
`specialties` text,
`promotion_titles` text,
`promotion_descriptions` text,
`promo_codes` text,
`prof_pic` varchar(255) default NULL,
`dentist_image` text,
`dentist_description_image` text,
`other_images` text,
`before_and_after` text,
`source_file` varchar(255) default NULL,
`valid_city` int(11) default NULL,
`valid_zip` int(11) default NULL,
`valid_state` int(11) default NULL,
`valid_email` int(11) default NULL,
`valid_website` int(11) default NULL,
`valid_name` int(11) default NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=946 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `data_locations`
--
DROP TABLE IF EXISTS `data_locations`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `data_locations` (
`id` int(11) NOT NULL auto_increment,
`zip_code` char(5) character set utf8 default NULL,
`city_name` varchar(40) character set utf8 default NULL,
`state_abbr` varchar(2) character set utf8 default NULL,
`state_long` varchar(45) default NULL,
`longitude` float default NULL,
`latitude` float default NULL,
`elevation` smallint(6) default NULL,
`population` mediumint(8) unsigned default NULL,
PRIMARY KEY (`id`),
KEY `zip_code` (`zip_code`),
FULLTEXT KEY `city_name` (`city_name`),
FULLTEXT KEY `state_abbr` (`state_abbr`)
) ENGINE=MyISAM AUTO_INCREMENT=42487 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `data_states`
--
DROP TABLE IF EXISTS `data_states`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `data_states` (
`id` int(11) NOT NULL auto_increment,
`state_abbr` varchar(2) character set utf8 default NULL,
`state_long` varchar(45) default NULL,
`disabled` int(11) default NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=63 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `payment_plan_types`
--
DROP TABLE IF EXISTS `payment_plan_types`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `payment_plan_types` (
`id` int(11) NOT NULL auto_increment,
`name` varchar(255) default NULL,
`is_recurring` int(11) default NULL,
`recurring_type` varchar(255) default NULL,
`recurring_cycles` int(11) default NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `payment_plans`
--
DROP TABLE IF EXISTS `payment_plans`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `payment_plans` (
`id` int(11) NOT NULL auto_increment,
`type` int(11) default NULL,
`initial_payment` int(11) default NULL,
`recurring_payment` int(11) default NULL,
`name` varchar(255) default NULL,
`description` text,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=9 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `paypal_transactions`
--
DROP TABLE IF EXISTS `paypal_transactions`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `paypal_transactions` (
`entryID` int(11) NOT NULL auto_increment,
`type` varchar(255) NOT NULL,
`results` varchar(255) NOT NULL,
`timestamp` int(14) NOT NULL,
PRIMARY KEY (`entryID`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Temporary table structure for view `total_votes`
--
DROP TABLE IF EXISTS `total_votes`;
/*!50001 DROP VIEW IF EXISTS `total_votes`*/;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE TABLE `total_votes` (
`user_id` int(11),
`total_votes` bigint(21)
) ENGINE=MyISAM */;
SET character_set_client = @saved_cs_client;
--
-- Table structure for table `user_accounts`
--
DROP TABLE IF EXISTS `user_accounts`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `user_accounts` (
`id` int(255) NOT NULL auto_increment,
`email` varchar(255) NOT NULL,
`password` varchar(255) NOT NULL,
`salt` varchar(255) NOT NULL,
`plan_id` int(11) default NULL,
`status` int(11) default NULL,
`date` date default NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=922 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `user_appointments`
--
DROP TABLE IF EXISTS `user_appointments`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `user_appointments` (
`id` int(18) NOT NULL auto_increment,
`appointment` varchar(150) default NULL,
`name` varchar(255) default NULL,
`age` varchar(50) default NULL,
`oral_health` varchar(150) default NULL,
`last_visit` date default NULL,
`app_date` date default NULL,
`app_time` varchar(50) default NULL,
`email` varchar(150) default NULL,
`telephone` varchar(150) default NULL,
`mobile` varchar(150) default NULL,
`comments` text,
`pid` int(18) default NULL,
`is_read` int(1) NOT NULL default '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `user_certifications`
--
DROP TABLE IF EXISTS `user_certifications`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `user_certifications` (
`id` int(11) NOT NULL auto_increment,
`filename` varchar(255) default NULL,
`path` varchar(255) default NULL,
`group` varchar(255) default NULL,
`type` varchar(255) default NULL,
`user_id` int(11) default NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `user_company_info`
--
DROP TABLE IF EXISTS `user_company_info`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `user_company_info` (
`id` int(11) NOT NULL auto_increment,
`company_name` varchar(255) default NULL,
`address` varchar(255) default NULL,
`city` varchar(255) default NULL,
`state` varchar(255) default NULL,
`zip` varchar(25) default NULL,
`telephone` varchar(25) default NULL,
`dsusa_telephone` varchar(55) default NULL,
`website` varchar(255) default NULL,
`company_email` varchar(255) default NULL,
`user_id` int(11) default NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `user_id` (`user_id`),
KEY `zip` (`zip`)
) ENGINE=MyISAM AUTO_INCREMENT=922 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Temporary table structure for view `user_count`
--
DROP TABLE IF EXISTS `user_count`;
/*!50001 DROP VIEW IF EXISTS `user_count`*/;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE TABLE `user_count` (
`user_count` bigint(21),
`city` varchar(255),
`state` varchar(255)
) ENGINE=MyISAM */;
SET character_set_client = @saved_cs_client;
--
-- Temporary table structure for view `user_count_and_city_population`
--
DROP TABLE IF EXISTS `user_count_and_city_population`;
/*!50001 DROP VIEW IF EXISTS `user_count_and_city_population`*/;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE TABLE `user_count_and_city_population` (
`user_count` bigint(21),
`city_population` decimal(30,0),
`city_name` varchar(40),
`state_abbr` varchar(2)
) ENGINE=MyISAM */;
SET character_set_client = @saved_cs_client;
--
-- Table structure for table `user_dashboard_info`
--
DROP TABLE IF EXISTS `user_dashboard_info`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `user_dashboard_info` (
`id` int(11) NOT NULL auto_increment,
`user_id` int(11) default NULL,
`promotional` text,
`documents_intro` text,
`gallery_intro` text,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=922 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `user_events`
--
DROP TABLE IF EXISTS `user_events`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `user_events` (
`id` int(18) NOT NULL auto_increment,
`message` text,
`note` varchar(150) default NULL,
`start_date` date default NULL,
`end_date` date default NULL,
`user_id` int(18) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `user_files`
--
DROP TABLE IF EXISTS `user_files`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `user_files` (
`id` int(11) NOT NULL auto_increment,
`filename` varchar(255) default NULL,
`path` varchar(255) default NULL,
`group` varchar(255) default NULL,
`type` varchar(255) default NULL,
`user_id` int(11) default NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `user_images`
--
DROP TABLE IF EXISTS `user_images`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `user_images` (
`id` int(11) NOT NULL auto_increment,
`path` varchar(255) default NULL,
`filename` varchar(255) default NULL,
`user_id` int(11) default NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `user_personal_info`
--
DROP TABLE IF EXISTS `user_personal_info`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `user_personal_info` (
`id` int(11) NOT NULL auto_increment,
`post_nominal` varchar(25) default NULL,
`first_name` varchar(55) default NULL,
`last_name` varchar(55) default NULL,
`bio` text,
`mobile_number` varchar(55) default NULL,
`user_id` int(11) default NULL,
`prof_pic` varchar(150) default NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `user_id` (`user_id`),
FULLTEXT KEY `last_name` (`last_name`)
) ENGINE=MyISAM AUTO_INCREMENT=922 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `user_pre_registrations`
--
DROP TABLE IF EXISTS `user_pre_registrations`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `user_pre_registrations` (
`id` int(11) NOT NULL auto_increment,
`name` varchar(255) default NULL,
`phone` varchar(255) default NULL,
`email` varchar(255) default NULL,
`interested_in` int(11) default NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `user_promotionals`
--
DROP TABLE IF EXISTS `user_promotionals`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `user_promotionals` (
`id` int(11) NOT NULL auto_increment,
`name` varchar(255) default NULL,
`code` varchar(255) default NULL,
`description` text,
`file_path` varchar(255) default NULL,
`file` varchar(255) default NULL,
`user_id` int(11) default NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `user_reviews`
--
DROP TABLE IF EXISTS `user_reviews`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `user_reviews` (
`id` int(11) NOT NULL auto_increment,
`name` varchar(255) default NULL,
`email` varchar(255) default NULL,
`website` varchar(255) default NULL,
`message` text,
`rating` float default NULL,
`user_id` int(11) default NULL,
`date` date default NULL,
`is_read` int(11) default '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `user_schedules`
--
DROP TABLE IF EXISTS `user_schedules`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `user_schedules` (
`id` int(18) NOT NULL auto_increment,
`day` varchar(50) default NULL,
`login` varchar(50) default NULL,
`break_in` varchar(50) default NULL,
`break_out` varchar(50) default NULL,
`logout` varchar(50) default NULL,
`order` int(10) default NULL,
`user_id` int(18) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `user_specialties`
--
DROP TABLE IF EXISTS `user_specialties`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `user_specialties` (
`id` int(11) NOT NULL auto_increment,
`specialty_id` int(11) default NULL,
`specialty_text` text,
`user_id` int(11) default NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `user_specialty_categories`
--
DROP TABLE IF EXISTS `user_specialty_categories`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `user_specialty_categories` (
`id` int(18) NOT NULL auto_increment,
`specialty_title` varchar(200) default NULL,
`description` text,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=14 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `user_statistics`
--
DROP TABLE IF EXISTS `user_statistics`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `user_statistics` (
`id` int(11) NOT NULL auto_increment,
`page_view` int(11) default NULL,
`user_id` int(11) default NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=923 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Current Database: `dentists_dsusa_site`
--
USE `dentists_dsusa_site`;
--
-- Final view structure for view `bayesian_rating`
--
/*!50001 DROP TABLE IF EXISTS `bayesian_rating`*/;
/*!50001 DROP VIEW IF EXISTS `bayesian_rating`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `bayesian_rating` AS select `e`.`user_id` AS `user_id`,(select avg(`t`.`total_votes`) AS `AVG(t.total_votes)` from `total_votes` `t` where (`t`.`total_votes` > 0)) AS `avg_num_votes`,(select avg(`user_reviews`.`rating`) AS `AVG(rating)` from `user_reviews`) AS `avg_rating`,(select `total_votes`.`total_votes` AS `total_votes` from `total_votes` where (`total_votes`.`user_id` = `e`.`user_id`)) AS `this_num_votes`,(select avg(`user_reviews`.`rating`) AS `AVG(rating)` from `user_reviews` where (`user_reviews`.`user_id` = `e`.`user_id`)) AS `this_rating`,(select (((`avg_num_votes` * `avg_rating`) + (`this_num_votes` * `this_rating`)) / (`avg_num_votes` + `this_num_votes`)) AS `( (avg_num_votes * avg_rating) + (this_num_votes * this_rating) ) / (avg_num_votes + this_num_votes)`) AS `the_rating` from `user_reviews` `e` group by `e`.`user_id` */;
--
-- Final view structure for view `city_population`
--
/*!50001 DROP TABLE IF EXISTS `city_population`*/;
/*!50001 DROP VIEW IF EXISTS `city_population`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED DEFINER=`dentists_webuser`@`184.195.228.%` SQL SECURITY DEFINER VIEW `city_population` AS select sum(`d`.`population`) AS `city_population`,`d`.`city_name` AS `city_name`,`d`.`state_abbr` AS `state_abbr` from `data_locations` `d` group by `d`.`state_abbr`,`d`.`city_name` */;
--
-- Final view structure for view `total_votes`
--
/*!50001 DROP TABLE IF EXISTS `total_votes`*/;
/*!50001 DROP VIEW IF EXISTS `total_votes`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `total_votes` AS select distinct `o`.`user_id` AS `user_id`,(select count(`user_reviews`.`user_id`) AS `COUNT(user_id)` from `user_reviews` where (`user_reviews`.`user_id` = `o`.`user_id`)) AS `total_votes` from `user_reviews` `o` */;
--
-- Final view structure for view `user_count`
--
/*!50001 DROP TABLE IF EXISTS `user_count`*/;
/*!50001 DROP VIEW IF EXISTS `user_count`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED DEFINER=`dentists_webuser`@`184.195.228.%` SQL SECURITY DEFINER VIEW `user_count` AS select count(0) AS `user_count`,`u`.`city` AS `city`,`u`.`state` AS `state` from `user_company_info` `u` group by `u`.`state`,`u`.`city` */;
--
-- Final view structure for view `user_count_and_city_population`
--
/*!50001 DROP TABLE IF EXISTS `user_count_and_city_population`*/;
/*!50001 DROP VIEW IF EXISTS `user_count_and_city_population`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED DEFINER=`dentists_webuser`@`184.195.228.%` SQL SECURITY DEFINER VIEW `user_count_and_city_population` AS select `u`.`user_count` AS `user_count`,`c`.`city_population` AS `city_population`,`c`.`city_name` AS `city_name`,`c`.`state_abbr` AS `state_abbr` from (`city_population` `c` left join `user_count` `u` on(((`c`.`state_abbr` = convert(`u`.`state` using utf8)) and (`c`.`city_name` = convert(`u`.`city` using utf8))))) */;
/*!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 2011-10-21 0:46:00
|
CLEAR SCREEN;
SET SERVEROUTPUT ON;
SET FEEDBACK ON;
DECLARE
rb RMAN_RULEBLOCKS%ROWTYPE;
BEGIN
-- BEGINNING OF RULEBLOCK --
rb.blockid:='rrt_panel_vm';
DELETE FROM rman_ruleblocks WHERE blockid=rb.blockid;
rb.picoruleblock:='
/* Rule block to gather lab tests */
#define_ruleblock([[rb_id]],
{
description: "Rule block to gather lab tests",
is_active:2,
}
);
rrt => rout_rrt.rrt.val.bind();
loc_1s => rout_rrt_hd_location.loc_1s.val.bind();
loc_1s_txt : {loc_1s = 710100010132 => `CA-GAP`},
{loc_1s = 720600013032 => `TEHS-NRU`},
{loc_1s = 710100010122 => `CA-FD`},
{loc_1s = 710500012022 => `CA-TCH`},
{loc_1s = 720600015062 => `TEHS-7AD`},
{loc_1s = 720900016042 or loc_1s = 720900016052 => `TEHS-KDH`},
{loc_1s = 720600005012 => `TEHS-PDU`},
{loc_1s = 721200017012 => `TEHS-TIW`},
{loc_1s in (710111460001,710111460051,710410202051)=>`CA-OTHER`},
{loc_1s in (720600014022,720600013012)=>`TEHS-OTHER`},
{=>`UNDETERMINED`}
;
hd_recent_flag => rout_rrt.hd_recent_flag.val.bind();
sodium1_val => rout_rrt_labs_euc.sodium1_val.val.bind();
sodium1_dt => rout_rrt_labs_euc.sodium1_dt.val.bind();
potassium1_val => rout_rrt_labs_euc.potassium1_val.val.bind();
bicarb1_val => rout_rrt_labs_euc.bicarb1_val.val.bind();
calcium1_val => rout_ckd_shpt.calcium1_val.val.bind();
calcium1_dt => rout_ckd_shpt.calcium1_dt.val.bind();
magnesium1_val => rout_ckd_shpt.magnesium1_val.val.bind();
phosphate1_val => rout_ckd_shpt.phos1_val.val.bind();
pth1_val =>rout_ckd_shpt.pth1_val.val.bind();
pth1_dt =>rout_ckd_shpt.pth1_val.dt.bind();
hb1_val => rout_ckd_anaemia.hb_val.val.bind();
hb1_dt => rout_ckd_anaemia.hb_dt.val.bind();
plt1_val => rout_ckd_anaemia.plt1_val.val.bind();
fer1_val => rout_ckd_anaemia.fer_val.val.bind();
tsat1_val => rout_ckd_anaemia.tsat1_val.val.bind();
av_plasty_ld => rout_rrt_hd_acc_iv.av_plasty_ld.val.bind();
hours => rout_rrt_hd_param.hours_val.val.bind();
/* mode => rout_rrt_hd_param.mode_val.val.bind();*/
urr => rout_rrt_hd_adequacy.urr_1.val.bind();
spktv => rout_rrt_hd_adequacy.spktv.val.bind();
hd_clinic_ld => rout_rrt_journey.hd_clinic_ld.val.bind();
[[rb_id]] : {rrt=1 => 1},{=>0};
#define_attribute(loc_1s_txt,{
label:"Dialysis panel satellite facility location",
is_reportable:1,
type:3
});
#define_attribute(hd_recent_flag,{
label:"Dialysis panel Hd recency flag",
is_reportable:1,
type:2
});
#define_attribute(sodium1_val,{
label:"Dialysis panel Labs sodium",
is_reportable:1,
type:2
});
#define_attribute(potassium1_val,{
label:"Dialysis panel Labs potassium",
is_reportable:1,
type:2
});
#define_attribute(bicarb1_val,{
label:"Dialysis panel Labs bicarb",
is_reportable:1,
type:2
});
#define_attribute(calcium1_val,{
label:"Dialysis panel Labs calcium",
is_reportable:1,
type:2
});
#define_attribute(magnesium1_val,{
label:"Dialysis panel Labs magnesium",
is_reportable:1,
type:2
});
#define_attribute(phos1_val,{
label:"Dialysis panel Labs phosphate",
is_reportable:1,
type:2
});
#define_attribute(pth1_val,{
label:"Dialysis panel Labs pth",
is_reportable:1,
type:2
});
#define_attribute(cinacalcet_ld,{
label:"Dialysis panel Meds cinacalcet",
is_reportable:1,
type:2
});
#define_attribute(calcitriol_ld,{
label:"Dialysis panel Meds calcitriol",
is_reportable:1,
type:2
});
#define_attribute(phos_bind_ld,{
label:"Dialysis panel Meds phos_bind_ld",
is_reportable:1,
type:2
});
#define_attribute(hb1_val,{
label:"Dialysis panel Labs Haemoglobin",
is_reportable:1,
type:2
});
#define_attribute(plt1_val,{
label:"Dialysis panel Labs platelets",
is_reportable:1,
type:2
});
#define_attribute(fer_val,{
label:"Dialysis panel Labs ferritin",
is_reportable:1,
type:2
});
#define_attribute(tsat1_val,{
label:"Dialysis panel Labs tsat",
is_reportable:1,
type:2
});
#define_attribute(av_plasty_ld,{
label:"Dialysis panel AV plasty",
is_reportable:1,
type:2
});
#define_attribute(
mode_hdf,{
label:"Dialysis panel parameters mode",
is_reportable:1,
type:2
});
#define_attribute(hours,{
label:"Dialysis panel parameters hours",
is_reportable:1,
type:2
});
#define_attribute(urr,{
label:"Dialysis panel Labs URR",
is_reportable:1,
type:2
});
#define_attribute(spktv,{
label:"Dialysis panel Labs spKTV",
is_reportable:1,
type:2
});
#define_attribute(hd_clinic_ld,{
label:"Dialysis panel last hd clinic",
is_reportable:1,
type:2
});
';
rb.picoruleblock := replace(rb.picoruleblock,'[[rb_id]]',rb.blockid);
rb.picoruleblock:=rman_pckg.sanitise_clob(rb.picoruleblock);
INSERT INTO rman_ruleblocks(blockid,picoruleblock) VALUES(rb.blockid,rb.picoruleblock);
COMMIT;
-- END OF RULEBLOCK --
END;
|
-- https://www.hackerrank.com/challenges/african-cities
SELECT A.NAME
FROM CITY A
INNER JOIN COUNTRY B
ON B.CODE = A.COUNTRYCODE
WHERE B.CONTINENT = 'Africa' |
SELECT
ITEM_CODE,
--ใLAMP_STEP2 ๅใไปๆง่ฟฝๅ ใปๅคๆดๅฏพๅฟใ zhanglw modify 2013/04/27 start
--ITEM_NAME,
CASE WHEN /*countryId*/'' = 1 THEN ITEM_NAME_ENGLISH
WHEN /*countryId*/'' = 81 THEN ITEM_NAME
WHEN /*countryId*/'' = 86 THEN ITEM_NAME_CHINESE
END AS ITEM_NAME,
--ใLAMP_STEP2 ๅใไปๆง่ฟฝๅ ใปๅคๆดๅฏพๅฟใ zhanglw modify 2013/04/27 end
CLASS_NM,
EXAMPLE
FROM ITEM_MST
WHERE
1=1
-- IF ็ป้ข๏ผๅคงๅ้กๅใโ ใNULL
/*IF (dto.classNmSearch != null)*/
-- ๅคงๅ้กใณใผใใ๏ผใใใฉใกใผใฟ๏ผๅคงๅ้กๅ
AND CLASS_NM = /*dto.classNmSearch*/''
/*END*/
--ใLAMP_STEP2 ๅใไปๆง่ฟฝๅ ใปๅคๆดๅฏพๅฟใ zhanglw add 2013/04/28 start
AND CLASS_NM IS NOT NULL
--ใLAMP_STEP2 ๅใไปๆง่ฟฝๅ ใปๅคๆดๅฏพๅฟใ zhanglw add 2013/04/28 end
/*IF (dto.itemCodeSearch != null)*/
-- ๅๅใณใผใใLIKEใ'%ๅๅใณใผใ%'
AND ITEM_CODE LIKE /*dto.itemCodeSearch*/''
/*END*/
ORDER BY ITEM_CODE |
DROP TABLE IF EXISTS plan_features;
DROP TABLE IF EXISTS pricing_plans;
DROP TABLE IF EXISTS categories;
DROP TABLE IF EXISTS apps;
CREATE TABLE apps(
url VARCHAR(50) PRIMARY KEY,
title VARCHAR(20) NOT NULL,
developer VARCHAR(10) NOT NULL,
rating DECIMAL NOT NULL,
reviews_count INTEGER NOT NULL
);
CREATE TABLE categories(
app_url VARCHAR(50) NOT NULL,
category VARCHAR(20) NOT NULL,
PRIMARY KEY(app_url, category),
FOREIGN KEY (app_url) REFERENCES apps(url)
);
CREATE TABLE pricing_plans(
id INTEGER,
app_url VARCHAR(50) NOT NULL,
title VARCHAR(20) NOT NULL,
price VARCHAR(20) NOT NULL,
PRIMARY KEY(id),
FOREIGN KEY (app_url) REFERENCES apps(url)
);
CREATE TABLE plan_features(
pricing_plan_id INTEGER NOT NULL,
app_url VARCHAR(50) NOT NULL,
feature VARCHAR(20) NOT NULL,
PRIMARY KEY(pricing_plan_id, app_url, feature),
FOREIGN KEY (app_url) REFERENCES apps(url),
FOREIGN KEY (pricing_plan_id) REFERENCES pricing_plans(id)
);
|
--selecionar todos
SELECT * FROM estados
--selecionar nome e sigla da tabela estado sendo que somente a regiao sul
SELECT nome, sigla FROM estados
where regiao = 'sul'
--selecionar nome e regiao da tabela estado cujo populacao seja superioa a 10kk
SELECT nome, regiao FROM estados
WHERE populacao >= 10
ORDER BY populacao DESC |
UPDATE
AUTHORITY_ACTION_GROUP
SET
--ๅๆถๅบๅ=2: ๅๆถๆธ
CANCEL_FLG=CAST(/*cancelFlg*/ AS CHAR(1)),
--ๆฐ่ฆ่
/ๆดๆฐ่
=็ป้ข๏ผใญใฐใคใณใฆใผใถID
MODIFY_USER=/*oldAuthorityEntity.modifyUser*/,
--ๆฐ่ฆๆฅไป/ๆดๆฐๆฅไป=ๆดๆฐๆฅๆ
MODIFY_DATE=/*oldAuthorityEntity.modifyDate*/
WHERE
--ใฆใผใถใผID = ็ป้ข๏ผใฆใผใถID
USER_ID=/*oldAuthorityEntity.userId*/ AND
--ๆๆจฉๅบๅ = 0
AUTHORIZATION_FLG=CAST(/*authoritionFlg*/ AS CHAR(1)) |
CREATE TABLE user_posts
(
id INT AUTO_INCREMENT NOT NULL,
name VARCHAR(255) NOT NULL,
email VARCHAR(255) NOT NULL,
country VARCHAR(255) NOT NULL,
gender VARCHAR(255) NOT NULL,
message VARCHAR(255) NOT NULL,
PRIMARY KEY (id)
)
DEFAULT CHARACTER SET utf8mb4
COLLATE 'utf8mb4_unicode_ci'
ENGINE = InnoDB; |
SELECT A.Campaรฑa,
C.Variedad,
C.Orden,
cdate(format(A.FechaID,"####-##-##")) AS Fecha,
A.FUC,
B.CategoriaID,
D.Categoria,
B.CalibreID,
E.Calibre,
B.Cajas,
B.KilosxCaja,
B.KilosTotal,
B.Comentario
FROM ((((TB_CalibreProceso AS A
LEFT JOIN TB_CalibreProcesoDetalle B ON A.ProcesoID=B.ProcesoID)
LEFT JOIN TB_VentaExportacionVariedad AS C ON A.VariedadID=C.VariedadID)
LEFT JOIN TB_VentaExportacionCategoria AS D ON B.CategoriaID=D.CategoriaID)
LEFT JOIN TB_Calibre AS E ON B.CalibreID=E.CalibreID) |
-- phpMyAdmin SQL Dump
-- version 5.0.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: May 31, 2020 at 09:29 PM
-- Server version: 10.4.11-MariaDB
-- PHP Version: 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 */;
--
-- Database: `slama`
--
-- --------------------------------------------------------
--
-- Table structure for table `bookmark`
--
CREATE TABLE `bookmark` (
`id_bookmark` int(11) NOT NULL,
`id_user` int(11) NOT NULL,
`id_trajet` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `comentaires`
--
CREATE TABLE `comentaires` (
`id_com` int(11) NOT NULL,
`id_corona` int(11) NOT NULL,
`id_user` int(11) NOT NULL,
`com` varchar(1000) NOT NULL,
`date_com` datetime NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `corona`
--
CREATE TABLE `corona` (
`id_corona` int(11) NOT NULL,
`id_user` int(11) NOT NULL,
`objet` varchar(255) NOT NULL,
`text` varchar(1000) NOT NULL,
`date` datetime NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `corona`
--
INSERT INTO `corona` (`id_corona`, `id_user`, `objet`, `text`, `date`) VALUES
(9, 18, '1077 cases and 48 deaths in Tunisia', '<div class=\'text-center\'>\r\n<h1> </h1>\r\n\r\n<p><img src=\"https://www.worldometers.info/img/flags/small/tn_ts-flag.gif\" style=\"width:60px\" /></p>\r\n\r\n<p> Tunisia</p>\r\n\r\n<h1>Coronavirus Cases:</h1>\r\n\r\n<p>1,077</p>\r\n\r\n<h1>Deaths:</h1>\r\n\r\n<p>48</p>\r\n\r\n<h1>Recovered:</h1>\r\n\r\n<p>960</p>\r\n\r\n</div>', '2020-05-31 20:17:42');
-- --------------------------------------------------------
--
-- Table structure for table `likes`
--
CREATE TABLE `likes` (
`id_like` int(11) NOT NULL,
`id_corona` int(11) NOT NULL,
`id_user` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `likes`
--
INSERT INTO `likes` (`id_like`, `id_corona`, `id_user`) VALUES
(6, 9, 18);
-- --------------------------------------------------------
--
-- Table structure for table `message`
--
CREATE TABLE `message` (
`id_message` int(11) NOT NULL,
`objet` varchar(255) NOT NULL,
`message` varchar(1000) NOT NULL,
`id_envoye` int(11) NOT NULL,
`id_recep` int(11) NOT NULL,
`date` date NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `preferences`
--
CREATE TABLE `preferences` (
`id_preferences` int(11) NOT NULL,
`id_user` int(11) NOT NULL,
`kids` tinyint(1) NOT NULL DEFAULT 0,
`smoke` tinyint(1) NOT NULL DEFAULT 0,
`music` tinyint(1) NOT NULL DEFAULT 0,
`girl` tinyint(1) NOT NULL DEFAULT 0,
`stop` tinyint(1) NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `preferences`
--
INSERT INTO `preferences` (`id_preferences`, `id_user`, `kids`, `smoke`, `music`, `girl`, `stop`) VALUES
(18, 18, 1, 1, 0, 0, 0);
-- --------------------------------------------------------
--
-- Table structure for table `rating`
--
CREATE TABLE `rating` (
`id_rating` int(11) NOT NULL,
`id_de` int(11) NOT NULL,
`id_a` int(11) NOT NULL,
`note` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `trajet`
--
CREATE TABLE `trajet` (
`id_trajet` int(11) NOT NULL,
`villeDep` varchar(255) NOT NULL,
`empDep` varchar(255) NOT NULL,
`villeArr` varchar(255) NOT NULL,
`empArr` varchar(255) NOT NULL,
`ddp` date NOT NULL,
`tdp` time NOT NULL,
`num` int(11) NOT NULL,
`place` int(11) NOT NULL DEFAULT 1,
`prix` float NOT NULL,
`id_user` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `trajet`
--
INSERT INTO `trajet` (`id_trajet`, `villeDep`, `empDep`, `villeArr`, `empArr`, `ddp`, `tdp`, `num`, `place`, `prix`, `id_user`) VALUES
(37, 'Sousse', 'Polytechnique bloc C', 'Monastir', 'Airport', '2020-06-04', '09:00:00', 54007387, 1, 1.5, 18);
-- --------------------------------------------------------
--
-- Table structure for table `user`
--
CREATE TABLE `user` (
`id_user` int(11) NOT NULL,
`nom` varchar(255) NOT NULL,
`prenom` varchar(255) NOT NULL,
`email` varchar(255) NOT NULL,
`mdp` varchar(255) NOT NULL,
`num` int(11) NOT NULL,
`sexe` varchar(255) NOT NULL,
`ville` varchar(255) NOT NULL,
`date` date NOT NULL DEFAULT current_timestamp(),
`job` varchar(255) NOT NULL DEFAULT 'Pas identifiรฉ',
`voiture` varchar(255) NOT NULL DEFAULT 'Pas identifiรฉ'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `user`
--
INSERT INTO `user` (`id_user`, `nom`, `prenom`, `email`, `mdp`, `num`, `sexe`, `ville`, `date`, `job`, `voiture`) VALUES
(18, 'SLAMA', 'khairi', 'khairi.slama@polytechnicien.tn', 'azerty123', 54007387, 'undefined', 'Sousse', '2020-05-31', 'Etudiant', 'Ford focus');
-- --------------------------------------------------------
--
-- Table structure for table `villes`
--
CREATE TABLE `villes` (
`id_ville` int(11) NOT NULL,
`nom` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `villes`
--
INSERT INTO `villes` (`id_ville`, `nom`) VALUES
(1, 'Ariana'),
(2, 'Bรฉja'),
(3, 'Ben Arous'),
(4, 'Bizerte'),
(5, 'Gabรจs'),
(6, 'Gafsa'),
(7, 'Jendouba'),
(8, 'Kairouan'),
(9, 'Kasserine'),
(10, 'Kebili'),
(11, 'Kef'),
(12, 'Mahdia'),
(13, 'Manouba'),
(14, 'Medenine'),
(15, 'Monastir'),
(16, 'Nabeul'),
(17, 'Sfax'),
(18, 'Sidi Bouzid'),
(19, 'Siliana'),
(20, 'Sousse'),
(21, 'Tataouine'),
(22, 'Tozeur'),
(23, 'Tunis'),
(24, 'Zaghouan');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `bookmark`
--
ALTER TABLE `bookmark`
ADD PRIMARY KEY (`id_bookmark`),
ADD KEY `id_trajet` (`id_trajet`),
ADD KEY `id_user` (`id_user`);
--
-- Indexes for table `comentaires`
--
ALTER TABLE `comentaires`
ADD PRIMARY KEY (`id_com`),
ADD KEY `id_corona` (`id_corona`),
ADD KEY `id_user` (`id_user`);
--
-- Indexes for table `corona`
--
ALTER TABLE `corona`
ADD PRIMARY KEY (`id_corona`),
ADD KEY `id_user` (`id_user`);
--
-- Indexes for table `likes`
--
ALTER TABLE `likes`
ADD PRIMARY KEY (`id_like`),
ADD KEY `id_corona` (`id_corona`),
ADD KEY `id_user` (`id_user`);
--
-- Indexes for table `message`
--
ALTER TABLE `message`
ADD PRIMARY KEY (`id_message`),
ADD KEY `message_ibfk_1` (`id_envoye`),
ADD KEY `id_recep` (`id_recep`);
--
-- Indexes for table `preferences`
--
ALTER TABLE `preferences`
ADD PRIMARY KEY (`id_preferences`),
ADD KEY `id_user` (`id_user`);
--
-- Indexes for table `rating`
--
ALTER TABLE `rating`
ADD PRIMARY KEY (`id_rating`),
ADD KEY `id_de` (`id_de`),
ADD KEY `id_a` (`id_a`);
--
-- Indexes for table `trajet`
--
ALTER TABLE `trajet`
ADD PRIMARY KEY (`id_trajet`),
ADD KEY `id_user` (`id_user`);
--
-- Indexes for table `user`
--
ALTER TABLE `user`
ADD PRIMARY KEY (`id_user`);
--
-- Indexes for table `villes`
--
ALTER TABLE `villes`
ADD PRIMARY KEY (`id_ville`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `bookmark`
--
ALTER TABLE `bookmark`
MODIFY `id_bookmark` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;
--
-- AUTO_INCREMENT for table `comentaires`
--
ALTER TABLE `comentaires`
MODIFY `id_com` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11;
--
-- AUTO_INCREMENT for table `corona`
--
ALTER TABLE `corona`
MODIFY `id_corona` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11;
--
-- AUTO_INCREMENT for table `likes`
--
ALTER TABLE `likes`
MODIFY `id_like` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
--
-- AUTO_INCREMENT for table `message`
--
ALTER TABLE `message`
MODIFY `id_message` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;
--
-- AUTO_INCREMENT for table `preferences`
--
ALTER TABLE `preferences`
MODIFY `id_preferences` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=19;
--
-- AUTO_INCREMENT for table `rating`
--
ALTER TABLE `rating`
MODIFY `id_rating` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;
--
-- AUTO_INCREMENT for table `trajet`
--
ALTER TABLE `trajet`
MODIFY `id_trajet` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=38;
--
-- AUTO_INCREMENT for table `user`
--
ALTER TABLE `user`
MODIFY `id_user` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=19;
--
-- AUTO_INCREMENT for table `villes`
--
ALTER TABLE `villes`
MODIFY `id_ville` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=25;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `bookmark`
--
ALTER TABLE `bookmark`
ADD CONSTRAINT `bookmark_ibfk_1` FOREIGN KEY (`id_trajet`) REFERENCES `trajet` (`id_trajet`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `bookmark_ibfk_2` FOREIGN KEY (`id_user`) REFERENCES `user` (`id_user`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `comentaires`
--
ALTER TABLE `comentaires`
ADD CONSTRAINT `comentaires_ibfk_1` FOREIGN KEY (`id_corona`) REFERENCES `corona` (`id_corona`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `comentaires_ibfk_2` FOREIGN KEY (`id_user`) REFERENCES `user` (`id_user`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `corona`
--
ALTER TABLE `corona`
ADD CONSTRAINT `corona_ibfk_1` FOREIGN KEY (`id_user`) REFERENCES `user` (`id_user`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `likes`
--
ALTER TABLE `likes`
ADD CONSTRAINT `likes_ibfk_1` FOREIGN KEY (`id_corona`) REFERENCES `corona` (`id_corona`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `likes_ibfk_2` FOREIGN KEY (`id_user`) REFERENCES `user` (`id_user`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `message`
--
ALTER TABLE `message`
ADD CONSTRAINT `message_ibfk_1` FOREIGN KEY (`id_envoye`) REFERENCES `user` (`id_user`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `message_ibfk_2` FOREIGN KEY (`id_recep`) REFERENCES `user` (`id_user`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `preferences`
--
ALTER TABLE `preferences`
ADD CONSTRAINT `preferences_ibfk_1` FOREIGN KEY (`id_user`) REFERENCES `user` (`id_user`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `rating`
--
ALTER TABLE `rating`
ADD CONSTRAINT `rating_ibfk_1` FOREIGN KEY (`id_de`) REFERENCES `user` (`id_user`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `rating_ibfk_2` FOREIGN KEY (`id_a`) REFERENCES `user` (`id_user`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `trajet`
--
ALTER TABLE `trajet`
ADD CONSTRAINT `id_user` FOREIGN KEY (`id_user`) REFERENCES `user` (`id_user`) ON DELETE CASCADE ON UPDATE CASCADE;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
/* Formatted on 21/07/2014 18:37:48 (QP5 v5.227.12220.39754) */
CREATE OR REPLACE FORCE VIEW MCRE_OWN.V_MCRE0_ST_IRIS
(
ID_DPER,
COD_SNDG,
DTA_RIFERIMENTO,
VAL_IRIS_GRE,
VAL_IRIS_CLI,
VAL_LIV_RISCHIO_GRE,
VAL_LIV_RISCHIO_CLI,
VAL_LGD,
DTA_LGD,
VAL_EAD,
DTA_EAD,
VAL_PA,
DTA_PA,
VAL_PD_MONITORAGGIO,
DTA_PD_MONITORAGGIO,
VAL_RATING_MONITORAGGIO,
VAL_IND_UTL_INTERNO,
VAL_IND_UTL_ESTERNO,
VAL_IND_UTL_COMPLESSIVO,
VAL_IND_RATA,
VAL_IND_ROTAZIONE,
VAL_IND_INDEBITAMENTO,
VAL_IND_INSOL_PORTAF,
FLG_FATAL
)
AS
WITH T_MCRE0_FL_IRIS
AS (SELECT (SELECT TO_NUMBER (
TO_CHAR (
TO_DATE (TRIM (PERIODO_RIF), 'DDMMYYYY'),
'YYYYMMDD'))
FROM TE_MCRE0_IRIS_IDT
WHERE ROWNUM = 1)
ID_DPER,
RPAD (FAD_NDG_GRP, 16, 0) AS COD_SNDG,
TO_DATE (FAD_DAT_RIF, 'MMYYYY') AS DTA_RIFERIMENTO,
TO_NUMBER (FAD_IRS_GRP_ECO)
* DECODE (FAD_IRS_GRP_ECO_SGN, '-', -1, '+', 1, 0)
AS VAL_IRIS_GRE,
TO_NUMBER (FAD_IRS_CLI_GRP)
* DECODE (FAD_IRS_CLI_GRP_SGN, '-', -1, '+', 1, 0)
AS VAL_IRIS_CLI,
TRIM (FAD_LRI_GRP_ECO) AS VAL_LIV_RISCHIO_GRE,
TRIM (FAD_LRI_CLI) AS VAL_LIV_RISCHIO_CLI,
TO_NUMBER (FAD_LGD) AS VAL_LGD,
TO_DATE (FAD_DAT_RIF_LGD, 'DDMMYYYY') AS DTA_LGD,
TO_NUMBER (FAD_EAD) AS VAL_EAD,
TO_DATE (FAD_DAT_RIF_EAD, 'DDMMYYYY') AS DTA_EAD,
TO_NUMBER (FAD_PA) AS VAL_PA,
TO_DATE (FAD_DAT_RIF_PA, 'DDMMYYYY') AS DTA_PA,
TO_NUMBER (FAD_PDM) AS VAL_PD_MONITORAGGIO,
TO_DATE (FAD_DAT_RIF_PDM, 'DDMMYYYY')
AS DTA_PD_MONITORAGGIO,
TRIM (FAD_RAT_MON) AS VAL_RATING_MONITORAGGIO,
TO_NUMBER (FAD_IND_UTL_INT)
* DECODE (FAD_IND_UTL_INT_SGN, '-', -1, '+', 1, 0)
AS VAL_IND_UTL_INTERNO,
TO_NUMBER (FAD_IND_UTL_EST)
* DECODE (FAD_IND_UTL_EST_SGN, '-', -1, '+', 1, 0)
AS VAL_IND_UTL_ESTERNO,
TO_NUMBER (FAD_IND_UTL_CPL)
* DECODE (FAD_IND_UTL_CPL_SGN, '-', -1, '+', 1, 0)
AS VAL_IND_UTL_COMPLESSIVO,
TO_NUMBER (FAD_IND_RAT)
* DECODE (FAD_IND_RAT_SGN, '-', -1, '+', 1, 0)
AS VAL_IND_RATA,
TO_NUMBER (FAD_IND_RTZ)
* DECODE (FAD_IND_RTZ_SGN, '-', -1, '+', 1, 0)
AS VAL_IND_ROTAZIONE,
TO_NUMBER (FAD_IND_IDB)
* DECODE (FAD_IND_IDB_SGN, '-', -1, '+', 1, 0)
AS VAL_IND_INDEBITAMENTO,
TO_NUMBER (FAD_IND_INS_POR)
* DECODE (FAD_IND_INS_POR_SGN, '-', -1, '+', 1, 0)
AS VAL_IND_INSOL_PORTAF,
FAD_FLG_FAT AS FLG_FATAL
FROM TE_MCRE0_IRIS_INC
WHERE FND_MCRE0_is_numeric (FAD_NDG_GRP) = 1
AND FND_MCRE0_is_date ('01' || FAD_DAT_RIF) = 1
AND FND_MCRE0_is_numeric (FAD_IRS_GRP_ECO) = 1
AND FND_MCRE0_is_numeric (FAD_IRS_CLI_GRP) = 1
AND FND_MCRE0_is_numeric (FAD_LGD) = 1
AND FND_MCRE0_is_date (FAD_DAT_RIF_LGD) = 1
AND FND_MCRE0_is_numeric (FAD_EAD) = 1
AND FND_MCRE0_is_date (FAD_DAT_RIF_EAD) = 1
AND FND_MCRE0_is_numeric (FAD_PA) = 1
AND FND_MCRE0_is_date (FAD_DAT_RIF_PA) = 1
AND FND_MCRE0_is_numeric (FAD_PDM) = 1
AND FND_MCRE0_is_date (FAD_DAT_RIF_PDM) = 1
AND FND_MCRE0_is_numeric (FAD_IND_UTL_INT) = 1
AND FND_MCRE0_is_numeric (FAD_IND_UTL_EST) = 1
AND FND_MCRE0_is_numeric (FAD_IND_UTL_CPL) = 1
AND FND_MCRE0_is_numeric (FAD_IND_RAT) = 1
AND FND_MCRE0_is_numeric (FAD_IND_RTZ) = 1
AND FND_MCRE0_is_numeric (FAD_IND_IDB) = 1
AND FND_MCRE0_is_numeric (FAD_IND_INS_POR) = 1)
SELECT "ID_DPER",
"COD_SNDG",
"DTA_RIFERIMENTO",
"VAL_IRIS_GRE",
"VAL_IRIS_CLI",
"VAL_LIV_RISCHIO_GRE",
"VAL_LIV_RISCHIO_CLI",
"VAL_LGD",
"DTA_LGD",
"VAL_EAD",
"DTA_EAD",
"VAL_PA",
"DTA_PA",
"VAL_PD_MONITORAGGIO",
"DTA_PD_MONITORAGGIO",
"VAL_RATING_MONITORAGGIO",
"VAL_IND_UTL_INTERNO",
"VAL_IND_UTL_ESTERNO",
"VAL_IND_UTL_COMPLESSIVO",
"VAL_IND_RATA",
"VAL_IND_ROTAZIONE",
"VAL_IND_INDEBITAMENTO",
"VAL_IND_INSOL_PORTAF",
"FLG_FATAL"
FROM (SELECT COUNT (1) OVER (PARTITION BY id_dper, cod_sndg) num_recs,
id_dper,
cod_sndg,
dta_riferimento,
val_iris_gre,
val_iris_cli,
val_liv_rischio_gre,
val_liv_rischio_cli,
val_lgd,
dta_lgd,
val_ead,
dta_ead,
val_pa,
dta_pa,
val_pd_monitoraggio,
dta_pd_monitoraggio,
val_rating_monitoraggio,
val_ind_utl_interno,
val_ind_utl_esterno,
val_ind_utl_complessivo,
val_ind_rata,
val_ind_rotazione,
val_ind_indebitamento,
val_ind_insol_portaf,
flg_fatal
FROM T_MCRE0_FL_IRIS) tmp
WHERE NUM_RECS = 1
AND TRIM (TO_CHAR (id_dper)) IS NOT NULL
AND TRIM (TO_CHAR (cod_sndg)) IS NOT NULL;
|
SELECT employees.emp_no,
employees.first_name,
employees.last_name,
titles.title,
titles.from_date,
titles.to_date
INTO retirement_titles
FROM employees
INNER JOIN titles
ON (employees.emp_no = titles.emp_no)
WHERE (birth_date BETWEEN '1952-01-01' AND '1955-12-31');
SELECT DISTINCT ON (emp_no) emp_no,
first_name,
last_name,
title
INTO unique_titles
FROM retirement_titles
ORDER BY emp_no ASC, retirement_titles.to_date DESC
SELECT COUNT(unique_titles.title), unique_titles.title
INTO retiring_titles
FROM unique_titles
GROUP BY title
ORDER BY COUNT(unique_titles.title) DESC
SELECT DISTINCT ON (emp_no) employees.emp_no,
employees.first_name,
employees.last_name,
employees.birth_date,
dept_employees.from_date,
dept_employees.to_date,
titles.title
INTO mentorship_eligibility
FROM employees
INNER JOIN dept_employees
ON (employees.emp_no = dept_employees.emp_no)
INNER JOIN titles
ON (employees.emp_no = titles.emp_no)
WHERE (birth_date BETWEEN '1965-01-01' AND '1965-12-31')
ORDER BY emp_no ASC;
SELECT * from mentorship_eligibility
|
alter table REPORT_GROUP add SYS_TENANT_ID varchar2(255)^
alter table REPORT_REPORT add SYS_TENANT_ID varchar2(255)^
drop index IDX_REPORT_GROUP_UNIQ_TITLE^
create unique index IDX_REPORT_GROUP_UNIQ_TITLE on REPORT_GROUP(TITLE, SYS_TENANT_ID, DELETE_TS)^
drop index IDX_REPORT_REPORT_UNIQ_NAME^
create unique index IDX_REPORT_REPORT_UNIQ_NAME on REPORT_REPORT(NAME, SYS_TENANT_ID, DELETE_TS)^ |
USE capital_college;
INSERT INTO OrgInfo
(OrgID, Organization, Membership, President, VicePresident)
VALUES
(1, 'Phi Kappa Mu Fraternity', 30, 1, 2),
(2, 'Big Brothers and Sisters', 120, 2, 3),
(3, 'Ecology Club', 45, 3, 4);
INSERT INTO StudentInfo
(StudentID, FirstName, LastName, MajorID)
VALUES
(1, 'Thomas', 'Dunn', 1),
(2, 'Sylvia', 'Friend', 2),
(3, 'Elizabeth', 'Harris', 1),
(4, 'David', 'Smith', 3);
INSERT INTO Major
(MajorID, Major)
VALUES
(1, 'Business'),
(2, 'Sociology'),
(3, 'English'); |
๏ปฟ
INSERT INTO members(email,last_name,first_name,phone_number,adress,account_number,profil_picture,validated)
VALUES ('depapealex@gmail.com','De Pape', 'Alexandre','0477566777', 'avenue de l\'รฉpicier nยฐ5 uccle', NULL, NULL, false)
;
INSERT INTO members
VALUES ('schellensval@hotmail.com','Schellens', 'Valentin', '0479998433', 'rue de la libertรฉ nยฐ30 bruxelles',NULL,NULL,1,'member',true)
;
INSERT INTO members
VALUES ('ahmadsharifrazi@hotmail.com','Sharifrazi','Mir Ahmad','0479234556','avenue de l\'aurore nยฐ3 rhode-saint-genรจse',NULL,NULL,1,'coach',true)
;
INSERT INTO members
VALUES ('xavierlinet@hotmail.com','Linet','Xavier','0467935434','clos-chapelles 3 woluwe-saint-lambert',NULL,NULL,1,'member',true) |
--ไฟฎๆนๆ้
grant ๆ้ๅ็งฐ on ๆฐๆฎๅบ to ่ดฆๆท@ไธปๆบ with grant option;
--็ป่็ๅคไธไธชupdateๆ้
grant select,update on jing_dong.* to 'laowang'@'localhost' with grant option;
--ไฟฎๆนๅฏ็
alter user ่ดฆๆท@ไธปๆบ IDENTIFIED by 'ๆฐๅฏ็ ';
--ไฟฎๆนๅฎๅฏ็ ่ฎฐๅพๅทๆฐ |
----------------------------------------------------------
---CINEMA.MOVIE_RATING---
insert into CINEMA.MOVIE_RATING(Name, Acronym, Description)
select 'General Audiences', 'G', 'All ages admitted. Nothing that would offend parents for viewing by children.';
insert into CINEMA.MOVIE_RATING(Name, Acronym, Description)
select 'Parental Guidance Suggested', 'PG', 'Some material may not be suitable for children. Parents urged to give "parental guidance". May contain some material parents might not like for their young children.';
insert into CINEMA.MOVIE_RATING(Name, Acronym, Description)
select 'Parents Strongly Cautioned', 'PG-13', 'Some material may be inappropriate for children under 13. Parents are urged to be cautious. Some material may be inappropriate for pre-teenagers.';
insert into CINEMA.MOVIE_RATING(Name, Acronym, Description)
select 'Restricted', 'R', 'Under 17 requires accompanying parent or adult guardian. Contains some adult material. Parents are urged to learn more about the film before taking their young children with them.';
insert into CINEMA.MOVIE_RATING(Name, Acronym, Description)
select 'Adults Only', 'NC-17', 'No One 17 and Under Admitted. Clearly adult. Children are not admitted.';
select * from CINEMA.MOVIE_RATING;
----------------------------------------------------------
---CINEMA.GENRE---
insert into CINEMA.MOVIE_GENRE(Name) values ('Absurdist/surreal/whimsical'),
('Action'),
('Adventure'),
('Comedy'),
('Crime'),
('Drama'),
('Fantasy'),
('Historical'),
('Historical fiction'),
('Horror'),
('Magical realism'),
('Mystery'),
('Paranoid'),
('Philosophical'),
('Political'),
('Romance'),
('Saga'),
('Satire'),
('Science fiction'),
('Slice of Life'),
('Speculative'),
('Thriller'),
('Urban'),
('Western');
select * from CINEMA.MOVIE_GENRE;
----------------------------------------------------------
---CINEMA.THEATRE---
insert into CINEMA.THEATRE(Name) values ('Sala 1'),
('Sala 2'),
('Sala 3'),
('Sala 4'),
('Sala 5'),
('Sala 6'),
('Sala 7'),
('Sala 8'),
('Sala 9'),
('Sala 10'),
('Sala 11'),
('Sala 12');
select * from CINEMA.THEATRE;
----------------------------------------------------------
---CINEMA.SEAT---
insert into CINEMA.SEAT(RowLetter, SeatNumber) values ('A', 1), ('A', 2), ('A', 3), ('A', 4), ('A', 5), ('A', 6), ('A', 7), ('A', 8), ('A', 9), ('A', 10), ('A', 11), ('A', 12), ('A', 13), ('A', 14), ('A', 15),
('B', 1), ('B', 2), ('B', 3), ('B', 4), ('B', 5), ('B', 6), ('B', 7), ('B', 8), ('B', 9), ('B', 10), ('B', 11), ('B', 12), ('B', 13), ('B', 14), ('B', 15),
('C', 1), ('C', 2), ('C', 3), ('C', 4), ('C', 5), ('C', 6), ('C', 7), ('C', 8), ('C', 9), ('C', 10), ('C', 11), ('C', 12), ('C', 13), ('C', 14), ('C', 15),
('D', 1), ('D', 2), ('D', 3), ('D', 4), ('D', 5), ('D', 6), ('D', 7), ('D', 8), ('D', 9), ('D', 10), ('D', 11), ('D', 12), ('D', 13), ('D', 14), ('D', 15),
('E', 1), ('E', 2), ('E', 3), ('E', 4), ('E', 5), ('E', 6), ('E', 7), ('E', 8), ('E', 9), ('E', 10), ('E', 11), ('E', 12), ('E', 13), ('E', 14), ('E', 15),
('F', 1), ('F', 2), ('F', 3), ('F', 4), ('F', 5), ('F', 6), ('F', 7), ('F', 8), ('F', 9), ('F', 10), ('F', 11), ('F', 12), ('F', 13), ('F', 14), ('F', 15),
('G', 1), ('G', 2), ('G', 3), ('G', 4), ('G', 5), ('G', 6), ('G', 7), ('G', 8), ('G', 9), ('G', 10), ('G', 11), ('G', 12), ('G', 13), ('G', 14), ('G', 15),
('H', 1), ('H', 2), ('H', 3), ('H', 4), ('H', 5), ('H', 6), ('H', 7), ('H', 8), ('H', 9), ('H', 10), ('H', 11), ('H', 12), ('H', 13), ('H', 14), ('H', 15),
('I', 1), ('I', 2), ('I', 3), ('I', 4), ('I', 5), ('I', 6), ('I', 7), ('I', 8), ('I', 9), ('I', 10), ('I', 11), ('I', 12), ('I', 13), ('I', 14), ('I', 15),
('J', 1), ('J', 2), ('J', 3), ('J', 4), ('J', 5), ('J', 6), ('J', 7), ('J', 8), ('J', 9), ('J', 10), ('J', 11), ('J', 12), ('J', 13), ('J', 14), ('J', 15),
select * from CINEMA.SEAT;
----------------------------------------------------------
|
CREATE TABLE tbPessoa (
idtbPessoa INTEGER NOT NULL ,
nome VARCHAR(150) NULL,
endereco VARCHAR(200) NULL,
cidade VARCHAR(100) NULL,
estado CHAR(2) NULL,
sexo CHAR(1) NULL,
CONSTRAINT tbPessoa_pk PRIMARY KEY (idtbPessoa)
);
CREATE TABLE tbPaciente (
tbPessoa_idtbPessoa INTEGER NOT NULL,
nrSUS INTEGER NOT NULL ,
convenio VARCHAR(100) NULL,
CONSTRAINT tbPaciente_pk PRIMARY KEY (tbPessoa_idtbPessoa),
CONSTRAINT tbPessoapaciente_fk FOREIGN KEY (tbPessoa_idtbPessoa) REFERENCES tbPessoa(idtbPessoa)
);
CREATE TABLE tbMedico (
tbPessoa_idtbPessoa INTEGER NOT NULL,
crm VARCHAR(10) NOT NULL ,
CONSTRAINT tbMedico_pk PRIMARY KEY (tbPessoa_idtbPessoa),
CONSTRAINT tbPessoaMedico_fk FOREIGN KEY (tbPessoa_idtbPessoa) REFERENCES tbPessoa(idtbPessoa)
);
CREATE TABLE tbAtendimento (
idtbAtendimento INTEGER NOT NULL ,
tbMedico_tbPessoa_idtbPessoa INTEGER NOT NULL,
tbPaciente_tbPessoa_idtbPessoa INTEGER NOT NULL,
data_atendimento DATE,
finalizado CHAR(1),
CONSTRAINT tbAtendimento_pk PRIMARY KEY (idtbAtendimento),
CONSTRAINT tbAtendimento_medico FOREIGN KEY (tbMedico_tbPessoa_idtbPessoa) REFERENCES tbMedico(tbPessoa_idtbPessoa),
CONSTRAINT tbAtendimento_paciente FOREIGN KEY (tbPaciente_tbPessoa_idtbPessoa) REFERENCES tbPaciente(tbPessoa_idtbPessoa)
);
|
-- MySQL dump 10.16 Distrib 10.1.10-MariaDB, for Linux (x86_64)
--
-- Host: localhost Database: rookery
-- ------------------------------------------------------
-- Server version 10.1.10-MariaDB-log
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `bird_families`
--
DROP TABLE IF EXISTS `bird_families`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `bird_families` (
`family_id` int(11) NOT NULL AUTO_INCREMENT,
`scientific_name` varchar(255) DEFAULT NULL,
`brief_description` varchar(255) DEFAULT NULL,
`order_id` int(11) DEFAULT NULL,
PRIMARY KEY (`family_id`),
UNIQUE KEY `scientific_name` (`scientific_name`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `bird_families`
--
LOCK TABLES `bird_families` WRITE;
/*!40000 ALTER TABLE `bird_families` DISABLE KEYS */;
/*!40000 ALTER TABLE `bird_families` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `bird_orders`
--
DROP TABLE IF EXISTS `bird_orders`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `bird_orders` (
`order_id` int(11) NOT NULL AUTO_INCREMENT,
`scientific_name` varchar(255) DEFAULT NULL,
`brief_description` text,
`order_image` blob,
PRIMARY KEY (`order_id`),
UNIQUE KEY `scientific_name` (`scientific_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `bird_orders`
--
LOCK TABLES `bird_orders` WRITE;
/*!40000 ALTER TABLE `bird_orders` DISABLE KEYS */;
/*!40000 ALTER TABLE `bird_orders` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `birds`
--
DROP TABLE IF EXISTS `birds`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `birds` (
`bird_id` int(11) NOT NULL AUTO_INCREMENT,
`scientific_name` varchar(255) DEFAULT NULL,
`common_name` varchar(255) DEFAULT NULL,
`family_id` int(11) DEFAULT NULL,
`conservation_status_id` int(11),
`wing_id` char(2) DEFAULT NULL,
`body_id` char(2) DEFAULT NULL,
`bill_id` char(2) DEFAULT NULL,
`description` text,
PRIMARY KEY (`bird_id`),
UNIQUE KEY `scientific_name` (`scientific_name`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `birds`
--
LOCK TABLES `birds` WRITE;
/*!40000 ALTER TABLE `birds` DISABLE KEYS */;
INSERT INTO `birds` VALUES (1,'Charadrius vociferus','Killdeer',NULL,7,NULL,NULL,NULL,NULL),(2,'Gavia immer','Great Northern Loon',NULL,7,NULL,NULL,NULL,NULL),(3,'Aix sponsa','Wood Duck',NULL,7,NULL,NULL,NULL,NULL),(4,'Chordeiles minor','Common Nighthawk',NULL,7,NULL,NULL,NULL,NULL),(5,'Sitta carolinensis','White-breasted Nuthatch',NULL,7,NULL,NULL,NULL,NULL),(6,'Apteryx mantelli','North Island Brown Kiwi',NULL,7,NULL,NULL,NULL,NULL);
/*!40000 ALTER TABLE `birds` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `birds_bill_shapes`
--
DROP TABLE IF EXISTS `birds_bill_shapes`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `birds_bill_shapes` (
`bill_id` char(2) DEFAULT NULL,
`bill_shape` char(25) DEFAULT NULL,
`bill_example` blob,
UNIQUE KEY `bill_id` (`bill_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `birds_bill_shapes`
--
LOCK TABLES `birds_bill_shapes` WRITE;
/*!40000 ALTER TABLE `birds_bill_shapes` DISABLE KEYS */;
/*!40000 ALTER TABLE `birds_bill_shapes` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `birds_body_shapes`
--
DROP TABLE IF EXISTS `birds_body_shapes`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `birds_body_shapes` (
`body_id` char(3) DEFAULT NULL,
`body_shape` char(25) DEFAULT NULL,
`body_example` blob,
UNIQUE KEY `body_id` (`body_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `birds_body_shapes`
--
LOCK TABLES `birds_body_shapes` WRITE;
/*!40000 ALTER TABLE `birds_body_shapes` DISABLE KEYS */;
/*!40000 ALTER TABLE `birds_body_shapes` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `birds_details`
--
DROP TABLE IF EXISTS `birds_details`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `birds_details` (
`bird_id` int(11) NOT NULL DEFAULT '0',
`bird_description` text,
`migrate` int(11) DEFAULT NULL,
`bird_feeder` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `birds_details`
--
LOCK TABLES `birds_details` WRITE;
/*!40000 ALTER TABLE `birds_details` DISABLE KEYS */;
INSERT INTO `birds_details` VALUES (1,NULL,NULL,NULL),(2,NULL,NULL,NULL),(3,NULL,NULL,NULL),(4,NULL,NULL,NULL),(5,NULL,NULL,NULL),(6,NULL,NULL,NULL);
/*!40000 ALTER TABLE `birds_details` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `birds_habitats`
--
DROP TABLE IF EXISTS `birds_habitats`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `birds_habitats` (
`bird_id` int(11) DEFAULT NULL,
`habitat_id` int(11) DEFAULT NULL,
UNIQUE KEY `bird_habitat` (`bird_id`,`habitat_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `birds_habitats`
--
LOCK TABLES `birds_habitats` WRITE;
/*!40000 ALTER TABLE `birds_habitats` DISABLE KEYS */;
INSERT INTO `birds_habitats` VALUES (2,5),(3,5),(3,6);
/*!40000 ALTER TABLE `birds_habitats` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `birds_new`
--
DROP TABLE IF EXISTS `birds_new`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `birds_new` (
`bird_id` int(11) NOT NULL AUTO_INCREMENT,
`scientific_name` varchar(255) DEFAULT NULL,
`common_name` varchar(50) DEFAULT NULL,
`family_id` int(11) DEFAULT NULL,
`description` text,
PRIMARY KEY (`bird_id`),
UNIQUE KEY `scientific_name` (`scientific_name`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `birds_new`
--
LOCK TABLES `birds_new` WRITE;
/*!40000 ALTER TABLE `birds_new` DISABLE KEYS */;
INSERT INTO `birds_new` VALUES (1,'Charadrius vociferus','Killdeer',NULL,NULL),(2,'Gavia immer','Great Northern Loon',NULL,NULL),(3,'Aix sponsa','Wood Duck',NULL,NULL),(4,'Chordeiles minor','Common Nighthawk',NULL,NULL),(5,'Sitta carolinensis','White-breasted Nuthatch',NULL,NULL),(6,'Apteryx mantelli','North Island Brown Kiwi',NULL,NULL);
/*!40000 ALTER TABLE `birds_new` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `birds_wing_shapes`
--
DROP TABLE IF EXISTS `birds_wing_shapes`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `birds_wing_shapes` (
`wing_id` char(2) DEFAULT NULL,
`wing_shape` char(25) DEFAULT NULL,
`wing_example` blob,
UNIQUE KEY `wing_id` (`wing_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `birds_wing_shapes`
--
LOCK TABLES `birds_wing_shapes` WRITE;
/*!40000 ALTER TABLE `birds_wing_shapes` DISABLE KEYS */;
/*!40000 ALTER TABLE `birds_wing_shapes` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `conservation_status`
--
DROP TABLE IF EXISTS `conservation_status`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `conservation_status` (
`conservation_id` int(11) NOT NULL AUTO_INCREMENT,
`conservation_category` char(10) DEFAULT NULL,
`conservation_state` char(25) DEFAULT NULL,
PRIMARY KEY (`conservation_id`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `conservation_status`
--
LOCK TABLES `conservation_status` WRITE;
/*!40000 ALTER TABLE `conservation_status` DISABLE KEYS */;
INSERT INTO `conservation_status` VALUES (1,'Extinct','Extinct'),(2,'Extinct','Extinct in Wild'),(3,'Threatened','Critically Endangered'),(4,'Threatened','Endangered'),(5,'Threatened','Vulnerable'),(6,'Lower Risk','Conservation Dependent'),(7,'Lower Risk','Near Threatened'),(8,'Lower Risk','Least Concern');
/*!40000 ALTER TABLE `conservation_status` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `habitat_codes`
--
DROP TABLE IF EXISTS `habitat_codes`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `habitat_codes` (
`habitat_id` int(11) NOT NULL AUTO_INCREMENT,
`habitat` varchar(25) DEFAULT NULL,
PRIMARY KEY (`habitat_id`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `habitat_codes`
--
LOCK TABLES `habitat_codes` WRITE;
/*!40000 ALTER TABLE `habitat_codes` DISABLE KEYS */;
INSERT INTO `habitat_codes` VALUES (1,'Coasts'),(2,'Deserts'),(3,'Forests'),(4,'Grasslands'),(5,'Lakes, Rivers, Ponds'),(6,'Marshes, Swamps'),(7,'Mountains'),(8,'Oceans'),(9,'Urban');
/*!40000 ALTER TABLE `habitat_codes` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2016-01-04 17:13:21
|
/**
* SQL for get shikugun list
* @author PhuVV
* @version $Id: SukTodofukenShikugunService_getJushoNetListByTodofukenCd_Sel_01.sql 15771 2014-07-22 02:44:11Z p_bui_fu $
*/
SELECT DISTINCT
JKN.SHIKUGUN_KUKURI3_CD,
JKN.SHIKUGUN_KUKURI3_NM,
JKN.SHIKUGUN_KUKURI2_CD,
JKN.SHIKUGUN_KUKURI2_NM,
JKN.SHIKUGUN_KUKURI2_DISP_SEQ,
JKN.SHIKUGUN_KUKURI3_DISP_SEQ,
JKN.TODOFUKEN_CD,
JKN.TODOFUKEN_NM
FROM
MA_CM_MA_JUSHO_KUKURI_NET JKN
WHERE
JKN.TODOFUKEN_CD = /*todofukenCd*/'13'
ORDER BY
JKN.SHIKUGUN_KUKURI2_DISP_SEQ , JKN.SHIKUGUN_KUKURI3_DISP_SEQ
|
UPDATE dbo.TblIntervention
SET Description = i.Comment
FROM dbo.TblIntervention AS [i]
UPDATE dbo.TblIntervention
SET Comment = NULL
FROM dbo.TblIntervention AS [i]
|
-- Alterac Valley Original 20
UPDATE battleground_template SET MinPlayersPerTeam = '10' WHERE id = 1;
-- Warsong Gulch Original 5
UPDATE battleground_template SET MinPlayersPerTeam = '3' WHERE id = 2;
-- Arathi Basin Original 8
UPDATE battleground_template SET MinPlayersPerTeam = '4' WHERE id = 3;
-- Eye of The Storm Original 8
UPDATE battleground_template SET MinPlayersPerTeam = '4' WHERE id = 7;
-- Isle of Conquest Original 20
UPDATE battleground_template SET MinPlayersPerTeam = '10' WHERE id = 30;
-- Random battleground Original 20
UPDATE battleground_template SET MinPlayersPerTeam = '5' WHERE id = 32; |
CREATE TABLE users (
id SERIAL PRIMARY KEY,
username VARCHAR(255) NOT NULL,
password VARCHAR(255) NOT NULL,
email VARCHAR(60) NOT NULL
);
CREATE TABLE unit (
id SERIAL PRIMARY KEY,
unit_cd VARCHAR(50) NOT NULL,
name VARCHAR(50)
);
CREATE TABLE energy (
id SERIAL PRIMARY KEY,
quantity NUMERIC NOT NULL,
read_date DATE NOT NULL,
unit_id INTEGER REFERENCES unit (ID),
user_id INTEGER REFERENCES users (ID)
);
CREATE TABLE gas (
id SERIAL PRIMARY KEY,
quantity NUMERIC NOT NULL,
read_date DATE NOT NULL,
unit_id INTEGER REFERENCES unit (ID),
user_id INTEGER REFERENCES users (ID)
);
CREATE TABLE hot_water (
id SERIAL PRIMARY KEY,
quantity NUMERIC NOT NULL,
read_date DATE NOT NULL,
unit_id INTEGER REFERENCES unit (ID),
user_id INTEGER REFERENCES users (ID)
);
CREATE TABLE cold_water (
id SERIAL PRIMARY KEY,
quantity NUMERIC NOT NULL,
read_date DATE NOT NULL,
unit_id INTEGER REFERENCES unit (ID),
user_id INTEGER REFERENCES users (ID)
);
CREATE TABLE heating (
id SERIAL PRIMARY KEY,
quantity NUMERIC NOT NULL,
read_date DATE NOT NULL,
unit_id INTEGER REFERENCES unit (ID),
user_id INTEGER REFERENCES users (ID)
); |
CREATE OR REPLACE TRIGGER ConsistenciaCapitulos
AFTER INSERT OR UPDATE ON INFO_EPISODIOS
FOR EACH ROW
DECLARE
episodio tpNatural, temporada tpNatural, serie tpNatural;
CURSOR cursorCapitulos IS SELECT id, episodio_De, temporada FROM INFO_EPISODIOS;
BEGIN
OPEN cursorCapitulos;
LOOP
FETCH cursorCapitulos INTO serie, episodio, temporada;
EXIT WHEN cursorCapitulos%NOTFOUND;
IF (NEW.episodio = episodio) AND (NEW.id = serie) AND (NEW.temporada = temporada) THEN
RAISE_APPLICATION_ERROR (-20000, 'El capitulo y temporada ya estan introducidos para la serie = ' || serie);
END IF;
END LOOP;
CLOSE cursorCapitulos;
END;
|
--
-- Fixes only for YTDB
--
-- fix spam in log
UPDATE `waypoint_scripts` SET `datalong2`='1' WHERE datalong IN (39550,76221,54324,50036,48310,46906,61615,45940,70153,46400,55838,35782,54324,46960,49119,46400,70602);
-- fix crash with use .gob near command and russian locale
UPDATE `trinity_string` SET `content_loc8` = '%d (Entry: %d) - |cffffffff|Hgameobject:%d|h[%s X:%f Y:%f Z:%f MapId:%d]|h|r' WHERE `entry` = '517';
-- Anub'arak, fix of incorrect YTDB flag
UPDATE `creature_template` SET `unit_flags` = 32832 WHERE `entry`= 34564;
UPDATE `creature_template` SET `unit_flags` = 32832 WHERE `entry`= 34566;
UPDATE `creature_template` SET `unit_flags` = 32832 WHERE `entry`= 35615;
UPDATE `creature_template` SET `unit_flags` = 32832 WHERE `entry`= 35616;
-- fix crash with NPC 38068 cast spel (recursion)
UPDATE `creature_template` SET `ScriptName`="", `spell1`="" WHERE `entry` = 38068;
-- fix aggro for Rimefang and Spinestalker
UPDATE `creature_template` SET `InhabitType`=5 WHERE `entry` IN (37533, 37534);
-- Fix start Valithria encounter while enconter is DONE
UPDATE `creature` SET `spawntimesecs` = 604800 WHERE `id` IN (38752, 16980);
-- Add lost data
DELETE FROM `creature` WHERE `guid` in (85584, 85585, 85586);
INSERT INTO `creature` (`guid`, `id`, `map`, `spawnMask`, `phaseMask`, `modelid`, `equipment_id`, `position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecs`, `spawndist`, `currentwaypoint`, `curhealth`, `curmana`, `MovementType`, `npcflag`, `unit_flags`, `dynamicflags`) VALUES
(85584, 29836, 604, 3, 1, 0, 0, 1851.12, 743.221, 135.951, 3.1629, 7200, 0, 0, 45516, 0, 0, 0, 0, 0),
(85585, 29836, 604, 3, 1, 0, 0, 1874.55, 757.72, 136.039, 3.56345, 7200, 0, 0, 45516, 0, 0, 0, 0, 0),
(85586, 29836, 604, 3, 1, 0, 0, 1875.77, 726.76, 135.946, 2.61705, 7200, 0, 0, 45516, 0, 0, 0, 0, 0);
-- QUEST 9663 "The Kessel Run"
-- right gossip number for NPC
UPDATE `creature_template` SET `gossip_menu_id`=7983 WHERE `entry`=17440;
-- Smart AI
UPDATE `creature_template` SET `AIName`= 'SmartAI' WHERE `entry` IN (17116,17240,17440);
DELETE FROM `smart_scripts` WHERE `source_type`=0 AND `entryorguid` IN (17116,17240,17440);
INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES
(17116,0,0,0,64,0,100,0,0,0,0,0,33,17116,0,0,0,0,0,7,0,0,0,0,0,0,0, 'On gossip hello credit for quest 9663'),
(17240,0,0,0,64,0,100,0,0,0,0,0,33,17240,0,0,0,0,0,7,0,0,0,0,0,0,0, 'On gossip hello credit for quest 9663'),
(17440,0,0,0,64,0,100,0,0,0,0,0,33,17440,0,0,0,0,0,7,0,0,0,0,0,0,0, 'On gossip hello credit for quest 9663');
-- Add Gossip menu items
DELETE FROM `gossip_menu` WHERE `entry`=7399 AND `text_id`=9038;
DELETE FROM `gossip_menu` WHERE `entry`=7983 AND `text_id`=8994;
DELETE FROM `gossip_menu` WHERE `entry`=7983 AND `text_id`=9039;
DELETE FROM `gossip_menu` WHERE `entry`=7370 AND `text_id`=9040;
INSERT INTO `gossip_menu` (`entry`,`text_id`) VALUES
(7399,9038),(7983,8994),(7983,9039),(7370,9040);
-- Gossip conditions
DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=14 AND `SourceGroup` IN (7399,7983,7370);
INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES
(14,7399,9038,0,9,9663,0,0,0,'','Show gossip text 9038 if player has quest 9663'),
(14,7983,9039,0,9,9663,0,0,0,'','Show gossip text 9039 if player has quest 9663'),
(14,7370,9040,0,9,9663,0,0,0,'','Show gossip text 9040 if player has quest 9663');
-- QUEST What The Dragons Know (horde & alliance)
-- right gossip number for NPC
UPDATE `creature_template` SET `gossip_menu_id`=10192 WHERE `entry`=26917;
UPDATE `creature_template` SET `gossip_menu_id`=10199 WHERE `entry`=27990;
DELETE FROM `gossip_menu_option` WHERE `menu_id`=10199;
INSERT INTO `gossip_menu_option` (`menu_id`,`id`,`option_icon`,`option_text`,`option_id`,`npc_option_npcflag`,`action_menu_id`,`action_poi_id`,`box_coded`,`box_money`,`box_text`) VALUES
(10199,0,0,'What do you know of ancient swords?',1,1,0,0,0,0,''),
(10199,1,0,'What do you know of ancient swords?',1,1,0,0,0,0,'');
DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=15 AND `SourceGroup`=10199;
INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES
(15,10199,0,0,9,14444,0,0,0,'','Show gossip option 0 if player has quest 14444 (Alliance)'),
(15,10199,1,0,9,24555,0,0,0,'','Show gossip option 1 if player has quest 24555 (Horde)');
-- Smart AI
UPDATE `creature_template` SET `AIName`= 'SmartAI' WHERE `entry`=27990;
DELETE FROM `smart_scripts` WHERE `entryorguid` IN (27990,2799000,2799001);
INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES
(27990,0,0,0,62,0,100,0,10199,0,0,0,80,2799001,0,0,0,0,0,1,0,0,0,0,0,0,0, 'On gossip option select run script'),
(27990,0,1,0,62,0,100,0,10199,1,0,0,80,2799000,0,0,0,0,0,1,0,0,0,0,0,0,0, 'On gossip option select run script'),
-- horde quest script
(2799000,9,0,0,0,0,100,0,0,0,0,0,81,0,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Turn off Gossip & Questgiver flags'),
(2799000,9,1,0,0,0,100,0,0,0,0,0,81,0,0,0,0,0,0,9,26917,0,10,0,0,0,0, 'Turn of Gossip & Questgiver flags for Alexstrasza'),
(2799000,9,2,0,0,0,100,0,2000,2000,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Say text 0'),
(2799000,9,3,0,0,0,100,0,4000,4000,0,0,1,1,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Say text 1'),
(2799000,9,4,0,0,0,100,0,0,0,0,0,45,0,1,0,0,0,0,9,38017,0,30,0,0,0,0, 'Kalecgos start path'),
(2799000,9,5,0,0,0,100,0,4000,4000,0,0,1,2,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Say text 2'),
(2799000,9,6,0,0,0,100,0,4000,4000,0,0,1,3,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Say text 3'),
(2799000,9,7,0,0,0,100,0,4000,4000,0,0,1,0,0,0,0,0,0,9,38017,0,30,0,0,0,0, 'Kalecgos Say text 0'),
(2799000,9,8,0,0,0,100,0,4000,4000,0,0,1,1,0,0,0,0,0,9,38017,0,30,0,0,0,0, 'Kalecgos Say text 1'),
(2799000,9,9,0,0,0,100,0,4000,4000,0,0,1,4,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Say text 4'),
(2799000,9,10,0,0,0,100,0,4000,4000,0,0,1,2,0,0,0,0,0,9,38017,0,30,0,0,0,0, 'Kalecgos Say text 2'),
(2799000,9,11,0,0,0,100,0,3000,3000,0,0,45,0,1,0,0,0,0,9,26917,0,10,0,0,0,0, 'Turn Alexstrasza'),
(2799000,9,12,0,0,0,100,0,1000,1000,0,0,1,0,0,0,0,0,0,9,26917,0,10,0,0,0,0, 'Alexstrasza Say text 0'),
(2799000,9,13,0,0,0,100,0,4000,4000,0,0,1,3,0,0,0,0,0,9,38017,0,30,0,0,0,0, 'Kalecgos Say text 3'),
(2799000,9,14,0,0,0,100,0,3000,3000,0,0,45,0,2,0,0,0,0,9,38017,0,30,0,0,0,0, 'Kalecgos resume path'),
(2799000,9,15,0,0,0,100,0,0,0,0,0,45,0,2,0,0,0,0,9,26917,0,10,0,0,0,0, 'Turn Alexstrasza back'),
(2799000,9,16,0,0,0,100,0,1000,1000,0,0,1,5,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Say text 5'),
(2799000,9,17,0,0,0,100,0,4000,4000,0,0,1,6,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Say text 6'),
(2799000,9,18,0,0,0,100,0,4000,4000,0,0,33,36715,0,0,0,0,0,7,0,0,0,0,0,0,0, 'Give quest credit'),
(2799000,9,19,0,0,0,100,0,4000,4000,0,0,81,3,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Turn on Gossip & Questgiver flags'),
(2799000,9,20,0,0,0,100,0,0,0,0,0,81,3,0,0,0,0,0,9,26917,0,10,0,0,0,0, 'Turn on Gossip & Questgiver flags for Alexstrasza'),
-- alliance quest script
(2799001,9,0,0,0,0,100,0,0,0,0,0,81,0,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Turn off Gossip & Questgiver flags'),
(2799001,9,1,0,0,0,100,0,0,0,0,0,81,0,0,0,0,0,0,9,26917,0,10,0,0,0,0, 'Turn of Gossip & Questgiver flags for Alexstrasza'),
(2799001,9,2,0,0,0,100,0,2000,2000,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Say text 0'),
(2799001,9,3,0,0,0,100,0,4000,4000,0,0,1,1,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Say text 1'),
(2799001,9,4,0,0,0,100,0,0,0,0,0,45,0,1,0,0,0,0,9,38017,0,30,0,0,0,0, 'Kalecgos start path'),
(2799001,9,5,0,0,0,100,0,4000,4000,0,0,1,2,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Say text 2'),
(2799001,9,6,0,0,0,100,0,4000,4000,0,0,1,3,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Say text 3'),
(2799001,9,7,0,0,0,100,0,4000,4000,0,0,1,0,0,0,0,0,0,9,38017,0,30,0,0,0,0, 'Kalecgos Say text 0'),
(2799001,9,8,0,0,0,100,0,4000,4000,0,0,1,1,0,0,0,0,0,9,38017,0,30,0,0,0,0, 'Kalecgos Say text 1'),
(2799001,9,9,0,0,0,100,0,4000,4000,0,0,1,4,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Say text 4'),
(2799001,9,10,0,0,0,100,0,4000,4000,0,0,1,2,0,0,0,0,0,9,38017,0,30,0,0,0,0, 'Kalecgos Say text 2'),
(2799001,9,11,0,0,0,100,0,3000,3000,0,0,45,0,1,0,0,0,0,9,26917,0,10,0,0,0,0, 'Turn Alexstrasza'),
(2799001,9,12,0,0,0,100,0,1000,1000,0,0,1,0,0,0,0,0,0,9,26917,0,10,0,0,0,0, 'Alexstrasza Say text 0'),
(2799001,9,13,0,0,0,100,0,4000,4000,0,0,1,3,0,0,0,0,0,9,38017,0,30,0,0,0,0, 'Kalecgos Say text 3'),
(2799001,9,14,0,0,0,100,0,3000,3000,0,0,45,0,2,0,0,0,0,9,38017,0,30,0,0,0,0, 'Kalecgos resume path'),
(2799001,9,15,0,0,0,100,0,0,0,0,0,45,0,2,0,0,0,0,9,26917,0,10,0,0,0,0, 'Turn Alexstrasza back'),
(2799001,9,16,0,0,0,100,0,1000,1000,0,0,1,5,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Say text 5'),
(2799001,9,17,0,0,0,100,0,4000,4000,0,0,1,7,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Say text 7'),
(2799001,9,18,0,0,0,100,0,4000,4000,0,0,33,36715,0,0,0,0,0,7,0,0,0,0,0,0,0, 'Give quest credit'),
(2799001,9,19,0,0,0,100,0,4000,4000,0,0,81,3,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Turn on Gossip & Questgiver flags'),
(2799001,9,20,0,0,0,100,0,0,0,0,0,81,3,0,0,0,0,0,9,26917,0,10,0,0,0,0, 'Turn on Gossip & Questgiver flags for Alexstrasza');
DELETE FROM `creature_text` WHERE `entry` IN (26917,27990,38017);
INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES
(26917,0,0,'Mortal champions have long used these weapons to combat evil. I see no reason to keep the swords from them in this battle.',0,0,100,1,0,0,'Alexstrasza the Life-Binder'),
(27990,0,0,'You''re too late, $n. Another visitor from Dalaran came asking after information about the same prismatic dragon blades.',0,0,100,1,0,0,'Krasus'),
(27990,1,0,'From your description, I''m certain the book I loaned our visitor could allow you to easily identify the weapon.',0,0,100,25,0,0,'Krasus'),
(27990,2,0,'I''m afraid you''ll have to ask the -- Well, perhaps Kalecgos can help.',0,0,100,1,0,0,'Krasus'),
(27990,3,0,'$n may have found the remains of a prismatic blade, Kalecgos. Will you offer your help to our visitor?',0,0,100,1,0,0,'Krasus'),
(27990,4,0,'You believe our allies will not be able to control the power of the swords?',0,0,100,1,0,0,'Krasus'),
(27990,5,0,'As will we all.',0,0,100,25,0,0,'Krasus'),
(27990,6,0,'Please, mortal, speak with Arcanist Tybalin in Dalaran. He may be able to negotiate with the Sunreavers for access to the book.',0,0,100,1,0,0,'Krasus'),
(27990,7,0,'Please, mortal, seek out Magister Hathorel in Dalaran. He might be able to negotiate with the Silver Covenant for access to the book.',0,0,100,1,0,0,'Krasus'),
(38017,0,0,'Are you certain you should be helping these mortals in their quest for the sword?',0,0,100,1,0,0,'Kalecgos'),
(38017,1,0,'These blades, Krasus... They were made long ago, when things were... different.',0,0,100,1,0,0,'Kalecgos'),
(38017,2,0,'Our enemies once turned our strongest weapon against us. What makes you think the prismatic blades will be any different?',0,0,100,1,0,0,'Kalecgos'),
(38017,3,0,'As you wish, my queen. I will not stand in their way, but I will keep a close watch.',0,0,100,16,0,0,'Kalecgos');
-- waypoints for Kalecgos
DELETE FROM `waypoints` WHERE `entry`=38017;
INSERT INTO `waypoints` (`entry`,`pointid`,`position_x`,`position_y`,`position_z`,`point_comment`) VALUES
(38017,1,3541.156,276.041,342.721,'talk point'),
(38017,2,3545.989,287.278,342.721,'home point');
-- SAI for Kalecgos
UPDATE `creature_template` SET `AIName`= 'SmartAI' WHERE `entry`=38017;
DELETE FROM `smart_scripts` WHERE `source_type`=0 AND `entryorguid`=38017;
DELETE FROM `smart_scripts` WHERE `source_type`=9 AND `entryorguid` IN (3801700,3801701);
INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES
(38017,0,0,1,38,0,100,0,0,1,0,0,80,3801700,0,0,0,0,0,1,0,0,0,0,0,0,0, 'On dataset 0 1 run script'),
(38017,0,1,1,38,0,100,0,0,2,0,0,80,3801701,0,0,0,0,0,1,0,0,0,0,0,0,0, 'On dataset 0 2 run script'),
(38017,0,2,3,40,0,100,0,1,38017,0,0,54,30000,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Pause at wp 1'),
(38017,0,3,0,61,0,100,0,0,0,0,0,66,0,0,0,0,0,0,9,27990,0,15,0,0,0,0, 'turn to Krasus'),
(38017,0,4,5,40,0,100,0,2,38017,0,0,55,0,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Stop at wp 2'),
(38017,0,5,0,61,0,100,0,0,0,0,0,66,0,0,0,0,0,0,1,0,0,0,0,0,0,0, 'turn to pos'),
(3801700,9,0,0,0,0,100,0,0,0,0,0,45,0,0,0,0,0,0,1,0,0,0,0,0,0,0, 'dataset 0 0'),
(3801700,9,1,0,0,0,100,0,0,0,0,0,53,0,38017,0,0,0,0,1,0,0,0,0,0,0,0, 'wp start'),
(3801701,9,0,0,0,0,100,0,0,0,0,0,45,0,0,0,0,0,0,1,0,0,0,0,0,0,0, 'dataset 0 0'),
(3801701,9,1,0,0,0,100,0,0,0,0,0,65,0,0,0,0,0,0,1,0,0,0,0,0,0,0, 'wp resume');
-- SAI for Alexstrasza
UPDATE `creature_template` SET `AIName`= 'SmartAI' WHERE `entry`=26917;
DELETE FROM `smart_scripts` WHERE `source_type`=0 AND `entryorguid`=26917;
INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES
(26917,0,0,1,38,0,100,0,0,1,0,0,66,0,0,0,0,0,0,8,0,0,0,0,0,0,1.6049, 'On dataset 0 1 turn'),
(26917,0,1,1,38,0,100,0,0,2,0,0,66,0,0,0,0,0,0,1,0,0,0,0,0,0,0, 'On dataset 0 2 turn');
-- Fix can not take a loot at the ICC blood princes
UPDATE creature_template set dynamicflags = 8 where entry in (37970, 38401, 38784, 38785);
-- Increased drop chance for some cook recipes
UPDATE `item_loot_template` SET `ChanceOrQuestChance` = 15 WHERE `item` IN (33873, 33870);
UPDATE `item_loot_template` SET `ChanceOrQuestChance` = 10 WHERE `item` IN (33875, 33869);
-- Delete non-attackable flag from Army of the Dead Ghoul NPC (24207)
UPDATE `creature_template` SET `unit_flags`=0 WHERE `entry` =24207;
-- Restore data deleted in 2011_10_23_08_world_sai.sql TC update (27.10.2011)
DELETE FROM `creature` WHERE `guid` =56995;
INSERT INTO `creature` (`guid`, `id`, `map`, `spawnMask`, `phaseMask`, `modelid`, `equipment_id`, `position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecs`, `spawndist`, `currentwaypoint`, `curhealth`, `curmana`, `MovementType`, `npcflag`, `unit_flags`, `dynamicflags`) VALUES
(56995, 16933, 530, 1, 1, 0, 0, -1545.9, 3627.48, 35.0149, 2.96104, 600, 5, 0, 5000, 0, 1, 0, 0, 0);
-- fix creatures spawn coordinates
REPLACE INTO `creature` (`guid`, `id`, `map`, `spawnMask`, `phaseMask`, `modelid`, `equipment_id`, `position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecs`, `spawndist`, `currentwaypoint`, `curhealth`, `curmana`, `MovementType`) VALUES
(97343, 25428, 571, 1, 1, 0, 0, 4457.88, 5241.73, 74.4109, 5.03238, 600, 15, 0, 7984, 3080, 1),
(111385, 31718, 571, 1, 1, 0, 0, 7930.02, 1022.7, 462.613, 5.22892, 300, 0, 0, 12600, 3994, 0);
REPLACE INTO `creature` (`guid`, `id`, `map`, `spawnMask`, `phaseMask`, `modelid`, `equipment_id`, `position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecs`, `spawndist`, `currentwaypoint`, `curhealth`, `curmana`, `MovementType`) VALUES
(98952, 30102, 571, 1, 1, 0, 0, 5823.54, -2910.77, 303.546, 3.70443, 600, 0, 0, 10635, 0, 0),
(111940, 31140, 571, 1, 1, 0, 0, 6582.88, 1116.38, 273.358, 0.355237, 300, 0, 0, 12600, 0, 0);
-- Fix Sindragosa non aggro
UPDATE creature_template SET unit_flags = '0' WHERE entry IN (36853,38267,38266,38265);
-- Fix On Metzen! Achievement (20.12.2011)
UPDATE `smart_scripts` SET `event_param1`=6763 WHERE `entryorguid` =15664;
-- Fix repetable of event for object 185861 (23.12.2011)
UPDATE `creature_ai_scripts` SET `event_flags`=1 WHERE `creature_id`=23119;
|
SELECT
A.CONTRACT_NO, --ๅฅ็ด็ชๅท
A.CUSTOMER_NAME, --้กงๅฎข๏ผฟๅ็งฐ
A.ACCEPTANCE_CHECK_SCHEDULED_DATE, --็ณ่ซๆ
ๅ ฑ๏ผๆคๅไบๅฎๆฅ
A.CONTRACT_PERIOD, --็ณ่ซๆ
ๅ ฑ๏ผๅฅ็ดๆ้
A.PREPAY_FEE, --็ณ่ซๆ
ๅ ฑ๏ผๅๆใใชใผในๆ
A.LEASE_FEE, --็ณ่ซๆ
ๅ ฑ๏ผใชใผในๆ้
A.NEXT_WITHDRAW_METHOD AS LEASE_WITHDRAW_METHOD, --็ณ่ซๆ
ๅ ฑ๏ผใชใผในๆๅๅๆนๆณ
A.NEXT_WITHDRAW_DATE AS LEASE_WITHDRAW_DATE, --็ณ่ซๆ
ๅ ฑ๏ผใชใผในๆๅๅๆฅ
--๏ผฉ๏ผฆ T1๏ผๆๅจๅฐ๏ผNULLTHENใT2๏ผๆๅจๅฐELSEใT1๏ผๆๅจๅฐ END AS ้กงๅฎข๏ผฟๆๅจๅฐ
CASE WHEN
T1.ADDRESS IS NULL
THEN T2.ADDRESS
ELSE T1.ADDRESS END AS CUSTOMER_ADDRESS,
--๏ผฉ๏ผฆ T1๏ผ้ป่ฉฑ็ชๅท๏ผNULL THENใT2๏ผ้ป่ฉฑ็ชๅท ELSEใT1๏ผ้ป่ฉฑ็ชๅท END AS ้กงๅฎข๏ผฟ้ป่ฉฑ็ชๅท
CASE WHEN
T1.PHONE_NO IS NULL
THEN T2.PHONE_NO
ELSE T1.PHONE_NO END AS CUSTOMER_PHONE_NO,
T2.CONTRACT_NAME1 AS CONTRACT_NAME, --้ฃ็ตก่
๏ผฟๅๅ
T2.ADDRESS AS CONTRACT_ADDRESS, --้ฃ็ตก่
๏ผฟๆๅจๅฐ
T2.PHONE_NO AS CONTRACT_PHONE_NO, --้ฃ็ตก่
๏ผฟ้ป่ฉฑ็ชๅท
T2.CONTRACT_PORTABLE_PHONE_NO1 AS CONTRACT_PORTABLE_PHONE_NO,--้ฃ็ตก่
๏ผฟๆบๅธฏ็ชๅท
CASE WHEN
F.CUSTOMER_KBN = CAST(/*customerKbn*/ AS CHAR(1))
THEN F.ID_CARD_NO
ELSE F.ORGANIZATION_CODE END AS ID_OR_ORGANIZATION --่บซไปฝ่ฏๅท/ๆบๆไปฃ็
FROM
APPLY_INFO A
--็ณ่ซๆ
ๅ ฑ๏ผ้กงๅฎข๏ผฟๅๅผๅ
ใณใผใ๏ผๅๅผๅ
ใในใฟ๏ผๅๅผๅ
ใณใผใ๏ผ๏ผ๏ผ
LEFT JOIN CUSTOMER_MST F
ON A.CUSTOMER_CODE = F.CUSTOMER_CODE
--ๅๅผๅ
ใในใฟ๏ผๅๅผๅ
ใณใผใ๏ผ้ฃ็ตกๅ
ๆ
ๅ ฑ๏ผT1๏ผ๏ผๅๅผๅ
ใณใผใ๏ผ๏ผ๏ผ
--้ฃ็ตกๅ
ๆ
ๅ ฑ๏ผT1๏ผ๏ผ้ฃ็ตกๅ
ๅ๏ผใ1๏ผ็ป่จไฝๆใ
LEFT JOIN CORRESPONDENCE_MST T1
ON F.CUSTOMER_CODE = T1.CUSTOMER_CODE
AND T1.CORRESPONDENCE_NAME = CAST(/*correspondenceName*/'' AS CHAR(1))
--็ณ่ซๆ
ๅ ฑ๏ผ้กงๅฎข๏ผฟๅๅผๅ
ใณใผใ๏ผ้ฃ็ตกๅ
ๆ
ๅ ฑ๏ผT2๏ผ๏ผๅๅผๅ
ใณใผใ๏ผ๏ผ๏ผ
--็ณ่ซๆ
ๅ ฑ๏ผ็บ็ฅจ้ไป๏ผฟ้ฃ็ตกๅ
็ชๅท๏ผ้ฃ็ตกๅ
ๆ
ๅ ฑ๏ผT2๏ผ๏ผ้ฃ็ตกๅ
็ชๅท๏ผ๏ผ๏ผ
LEFT JOIN CORRESPONDENCE_MST T2
ON A.CUSTOMER_CODE = T2.CUSTOMER_CODE
AND A.INVOICE_SEND_INDEX_NO = T2.CORRESPONDENCE_No
WHERE
A.APPLY_NO = /*applyNo*/''
|
CREATE TABLE "User"(
"id" serial,
"username" varchar(20) unique not null,
"email" varchar(80) unique not null,
"password" varchar(120) not null
"createdAt" datetime default current_timestamp,
"updatedAt" datetime null
);
CREATE TABLE "UserInfo"(
"id" serial,
"idUser" integer references "Users"(id),
"firstName" varchar(80) not null,
"lastName" varchar(80) not null,
"profileImage" varchar(120) null,
"about" varchar(255) null,
"school" varchar(120) null,
/**
Ocupaciones etc
**/
"createdAt" datetime default current_timestamp,
"updatedAt" datetime null
);
select * from "User" inner join "UserInfo" on "User".id = "UserInfo"."idUser";
-- Listado de clubes
CREATE TABLE "Club"(
"id" serial,
"idUser" integer references "Users"(id),
"identifier" varchar(20) unique not null,
"description" varchar(255) null,
"visibility" smallint,
"createdAt" datetime default current_timestamp,
"updatedAt" datetime null
);
-- Vista propia de club
CREATE TABLE "ClubInfo"(
"id" serial,
"idClub" integer references "Club"(id),
"idUser" integer references "Users"(id),
)
-- Normal
select * from "Club" inner join "ClubInfo" on "Club".id = "ClubInfo"."idClub";
CREATE TABLE "ClubMember"(
"id" serial,
"idClub" integer references "Club"(id),
"idUser" integer references "Users"(id),
"role" smallint default 1 check("role" > 0)
);
-- Full
select * from "Blog"
inner join "BlogInfo" on "Blog".id = "BlogInfo"."idBlog";
inner join "BlogTag" on "Blog".id = "BlogTag"."idBlog"
inner join "Tag" on "BlogTag"."idTag" = "Tag".id
inner join "BlogTag" on "Blog".id = "BlogTag"."idBlog"
CREATE TABLE "Blog"(
"id" serial,
"idClub" integer references "Club"(id) null,
"idUser" integer references "Users"(id),
"identifier" varchar(20) unique,
"about" varchar(255),
"createdAt" datetime default current_timestamp,
"updatedAt" datetime null
);
CREATE TABLE "BlogInfo"(
"id" serial,
"idClub" integer references "Club"(id) null,
"idUser" integer references "Users"(id),
"content" text null,
"createdAt" datetime default current_timestamp,
"updatedAt" datetime null
);
CREATE TABLE "Tag"(
"id" serial,
"tag" varchar(20) not null,
"slug" varchar(20) not null unique,
)
CREATE TABLE "BlogTag"(
"id" serial,
"idBlog" integer references "Blog"(id) null,
"idTag" integer references "Tag"(id) null,
);
CREATE TABLE "Topic"(
"id" serial,
"topic" varchar(20) not null,
"slug" varchar(20) not null unique,
)
CREATE TABLE "BlogTopic"(
"id" serial,
"idBlog" integer references "Blog"(id) null,
"idTopic" integer references "Topic"(id) null,
); |
DROP TABLE IF EXISTS `XXX_plugin_ltu`; ##b_dump##
CREATE TABLE `XXX_plugin_ltu` (
`ltu__id` int(11) NOT NULL AUTO_INCREMENT,
`ltu__link_to_url_1` text,
`ltu__link_to_url_2` text,
PRIMARY KEY (`ltu__id`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 ; ##b_dump##
INSERT INTO `XXX_plugin_ltu` SET ltu__id='1', ltu__link_to_url_1='Standard;http://www.google.de', ltu__link_to_url_2='Standard;http://www.papoo.de' ; ##b_dump##
ALTER TABLE `XXX_plugin_ltu` ADD `ltu__link_to_url_3` TEXT; ##b_dump##
ALTER TABLE `XXX_plugin_ltu` ADD `ltu__link_to_url_4` TEXT; ##b_dump## |
--first, check if tablename exists - if so, drop it
IF OBJECT_ID('dbo.Admiage') IS NOT NULL
BEGIN
DROP TABLE dbo.DimAdmiage
END
--then select the IDs from the relevant column, create table, adding description (use case statement, and values from data dictionary)
SELECT DISTINCT
admiage as ID,
CASE
WHEN admiage = '999' THEN 'unknown'
else admiage --the original data value uses 'Not Known' for a lot of null values/non-sensible values
END
AS DESCRIPTION
INTO dbo.DimAdmiage
FROM RawDataset |
CREATE TABLE cliente(
id INT PRIMARY KEY,
nome varchar(100) not null,
email varchar(250) not null,
telefone varchar(20) not null
);
|
INSERT INTO greeting(greeting_message) VALUES('Hello world!'); |
-- ๋์ ๋น๊ต ์ฐ์ฐ์์ AND ์ฐ์ฐ์๋ฅผ ์ฌ์ฉํ์ฌ ์ถ๋ ฅํ๊ธฐ
SELECT *
FROM EMP
WHERE SAL >= 2000
AND SAL <=3000;
--BETWEEN A AND B ์ฐ์ฐ์๋ฅผ ์ฌ์ฉํ์ฌ ์ถ๋ ฅํ๊ธฐ
SELECT *
FROM EMP
WHERE SAL BETWEEN 2000 AND 3000;
--BETWEEN A AND B ์ฐ์ฐ์๋ฅผ NOT ์ฐ์ฐ์๋ฅผ ์ฌ์ฉํ์ฌ ์ถ๋ ฅํ๊ธฐ
SELECT *
FROM EMP
WHERE SAL NOT BETWEEN 2000 AND 3000;
--LIKE ์ฐ์ฐ์ ์ฌ์ฉํ์ฌ ์ถ๋ ฅํ๊ธฐ
SELECT *
FROM EMP
WHERE ENAME LIKE 'S%';
-- ์ฌ์ ์ด๋ฆ์ ๋ ๋ฒ์งธ ๊ธ์๊ฐ L์ธ ์ฌ์๋ง ์ถ๋ ฅํ๊ธฐ
SELECT *
FROM EMP
WHERE ENAME LIKE '_L%';
--์ฌ์ ์ด๋ฆ์ AM์ด ํฌํจ๋์ด ์๋ ์ฌ์ ๋ฐ์ดํฐ๋ง ์ถ๋ ฅํ๊ธฐ
SELECT *
FROM EMP
WHERE ENAME LIKE '%AM%';
--์์ผ๋ ์นด๋ ๋ฌธ์๊ฐ ๋ฐ์ดํฐ ์ผ๋ถ์ผ ๊ฒฝ์ฐ
SELECT *
FROM SOME_TABLE
WHERE SOME_COLUMN LIKE 'A|_A%' ESCAPE '|';
|
/**
* CREATE Script for init of DB
*/
-- Create 3 OFFLINE drivers
insert into driver (id, date_created, deleted, online_status, password, username) values (1, now(), false, 'OFFLINE',
'$2a$10$ZURC5U8mLk3shySLJJlDcuK8L7shIz71bWH3Ka7Fnbt5HoRIyLh2K', 'driver01');
insert into driver (id, date_created, deleted, online_status, password, username) values (2, now(), false, 'OFFLINE',
'$2a$10$vF2tBQL.0sDFLQDME5IZNuAJ0BRF1EuzwD515qVoKjZhUqCE8UwXS', 'driver02');
insert into driver (id, date_created, deleted, online_status, password, username) values (3, now(), false, 'OFFLINE',
'$2a$10$pPEsGKJSnmTvuBxREWDw1.z/OWuwrUqEFPm82THI6ygZTvMCwSz1a', 'driver03');
-- Create 3 ONLINE drivers
insert into driver (id, date_created, deleted, online_status, password, username) values (4, now(), false, 'ONLINE',
'$2a$10$cEooeRJ5jWQb/k3QSHxp0eeT0V2EfxmAh.zM0JfKPM3kJ.iZxQBUC', 'driver04');
insert into driver (id, date_created, deleted, online_status, password, username) values (5, now(), false, 'ONLINE',
'$2a$10$lwIhrIa/M3pMKBOQKxQBn.xP1uSkjoUDimiCb0DRchsmVeqMWGe.q', 'driver05');
insert into driver (id, date_created, deleted, online_status, password, username) values (6, now(), false, 'ONLINE',
'$2a$10$kDZ9XQBz/Oicf3WwuIQjO.kQZ7c7rUfm4XsxkdQCXhCVTMzTKjQoC', 'driver06');
-- Create 1 OFFLINE driver with coordinate(longitude=9.5&latitude=55.954)
insert into driver (id, coordinate, date_coordinate_updated, date_created, deleted, online_status, password, username)
values
(7,
'aced0005737200226f72672e737072696e676672616d65776f726b2e646174612e67656f2e506f696e7431b9e90ef11a4006020002440001784400017978704023000000000000404bfa1cac083127', now(), now(), false, 'OFFLINE',
'$2a$10$fBJDRPxAj9fiojGGhZBfLOYKDdlTzlAC8LtWiLN4FF6YrdmryZTjG', 'driver07');
-- Create 1 ONLINE driver with coordinate(longitude=9.5&latitude=55.954)
insert into driver (id, coordinate, date_coordinate_updated, date_created, deleted, online_status, password, username)
values
(8,
'aced0005737200226f72672e737072696e676672616d65776f726b2e646174612e67656f2e506f696e7431b9e90ef11a4006020002440001784400017978704023000000000000404bfa1cac083127', now(), now(), false, 'ONLINE',
'$2a$10$b6cnXn4tVZ94.xyEbwDJwuFx3Tcrdy19axnCvLPnsoYUma7LzsIrq', 'driver08');
-- Create CarManufacturers for MyTaxi
insert into carmanufacturer (id, date_created, engine_type, manufacturer, max_passengers_allowed, model, type)
values
(1, now(), 'GAS', 'Acura', 4, 'TSX', 'LUXURY');
insert into carmanufacturer (id, date_created, engine_type, manufacturer, max_passengers_allowed, model, type)
values
(2, now(), 'GAS', 'Abarth', 4, 'Grande Punto', 'SUV');
insert into carmanufacturer (id, date_created, engine_type, manufacturer, max_passengers_allowed, model, type)
values
(3, now(), 'GAS', 'Aston Martin', 4, 'Virage', 'COUPE');
insert into carmanufacturer (id, date_created, engine_type, manufacturer, max_passengers_allowed, model, type)
values
(4, now(), 'GAS', 'Acura', 5, 'TL', 'SUV');
insert into carmanufacturer (id, date_created, engine_type, manufacturer, max_passengers_allowed, model, type)
values
(5, now(), 'ELECTRIC', 'Tesla', 4, 'Model S', 'ELECTRIC');
insert into carmanufacturer (id, date_created, engine_type, manufacturer, max_passengers_allowed, model, type)
values
(6, now(), 'HYBRID', 'Toyota', 4, 'Prius', 'HYBRID');
insert into carmanufacturer (id, date_created, engine_type, manufacturer, max_passengers_allowed, model, type)
values
(7, now(), 'GAS', 'Ferrari', 4, 'LaFerrari', 'COUPE');
insert into carmanufacturer (id, date_created, engine_type, manufacturer, max_passengers_allowed, model, type)
values
(8, now(), 'GAS', 'Ferrari', 4, 'Testarossa', 'COUPE');
|
SELECT DISTINCT CASE
WHEN ( app_decision_code IN ( 0, 1, 4 ) ) THEN 'Not Approved'
ELSE
CASE
WHEN ( app_decision_code = 5 ) THEN 'Cancelled'
ELSE
CASE
WHEN ( app_decision_code = 6 ) THEN 'Rejected'
ELSE 'Approved'
END
END
END AS USER_DESC,
CASE
WHEN app_contract_number IS NULL THEN co_ud_co_contract_id
ELSE app_contract_number
END AS COLUMN0049,
app_fkey AS ACT_KEY,
co_custname,
Max(co_accountingownercode) AS
MaxCo_accountingownercode,
co_purchaseoption_tbdesc,
co_programtype_tbdesc,
co_ud_co_advance_arrears,
co_branch_tbdesc,
Max(rep1) AS MaxRep1,
co_paymentamount AS
CO_UD_CO_ORIG_PYMT_AMT,
co_residualamount,
co_productline_tbdesc,
Min(co_termduration) AS MinCo_termduration,
co_equipmentcost,
Sum(as_listprice) AS SumAs_listprice,
Max (CASE
WHEN ( co_roi_nompt IS NULL ) THEN
as_pricing_target_yield_as
ELSE co_roi_nompt
END) AS
CO_PRICING_TARGET_YIELD,
scd_code AS MaxScd_code,
local_sic_code,
Max(rep2) AS MaxRep2,
Max(rep3) AS MaxRep3,
co_promotion_tbdesc AS COLUMN0051,
CASE
WHEN app_new_cust_yn = 1 THEN 'New'
ELSE 'Existing'
END AS COLUMN0067,
CASE
WHEN co_productline = 0070 THEN 'Yes'
ELSE 'No'
END AS COLUMN0068,
co_ud_co_comp_conversion_tbdesc AS
CO_UD_CO_COMP_CONVERSION_TBDES,
Cast(Max(rpt_co.co_bookingdate) AS DATE) AS CO_bookingDate
FROM rapport.dbo.rpt_asset RPT_ASSET
INNER JOIN rapport.dbo.rpt_co RPT_CO
ON rpt_asset.co_fkey = rpt_co.co_key
INNER JOIN rapport.dbo.application APPLICATIO
ON rpt_co.app_fkey = APPLICATIO.app_key
INNER JOIN rapport.dbo.marketing_reps MARKETING
ON rpt_asset.co_fkey = MARKETING.co_fkey
LEFT OUTER JOIN rapport.dbo.rpt_cust_data RPT_CUST_D
ON APPLICATIO.cust_fkey = RPT_CUST_D.ent_fkey
LEFT OUTER JOIN rapport.dbo.decision_codes DECISION_C
ON APPLICATIO.app_decision_code =
DECISION_C.decision_code_key
LEFT OUTER JOIN rapport.dbo.rpt_sic_code RPT_SIC_CO
ON RPT_CUST_D.cust_data_key = RPT_SIC_CO.cust_data_fkey
INNER JOIN rapport.dbo.change_history CHANGE_HIS
ON rpt_co.app_fkey = CHANGE_HIS.chg_app_fkey
WHERE (( app_decision_code NOT IN( 0, 1, 4, 5, 6 )
AND co_equipmentcost <> 0 ))
AND scd_code <> '9999'
AND co_key NOT LIKE '%-2'
AND ( chg_field_name = 'UD_CO_APP_STATUS'
AND ( chg_old_data = '03'
OR chg_new_data = '03' ) )
GROUP BY CASE
WHEN ( app_decision_code IN ( 0, 1, 4 ) ) THEN 'Not Approved'
ELSE
CASE
WHEN ( app_decision_code = 5 ) THEN 'Cancelled'
ELSE
CASE
WHEN ( app_decision_code = 6 ) THEN 'Rejected'
ELSE 'Approved'
END
END
END,
CASE
WHEN app_contract_number IS NULL THEN co_ud_co_contract_id
ELSE app_contract_number
END,
app_fkey,
co_custname,
co_purchaseoption_tbdesc,
co_programtype_tbdesc,
co_ud_co_advance_arrears,
co_branch_tbdesc,
co_paymentamount,
co_residualamount,
co_productline_tbdesc,
co_equipmentcost,
scd_code,
local_sic_code,
co_promotion_tbdesc,
CASE
WHEN app_new_cust_yn = 1 THEN 'New'
ELSE 'Existing'
END,
CASE
WHEN co_productline = 0070 THEN 'Yes'
ELSE 'No'
END,
co_ud_co_comp_conversion_tbdesc
HAVING Max(rep1) <> ''
AND Min (CASE
WHEN ( chg_field_name = 'UD_CO_APP_STATUS'
AND ( chg_new_data = '01'
OR chg_new_data = '03' ) ) THEN chg_date_time
END) BETWEEN ? AND ?
ORDER BY 3 |
CREATE TABLE provider_url_domain (
provider_url VARCHAR,
domain_name VARCHAR,
PRIMARY KEY (provider_url, domain_name));
--//@UNDO
DROP TABLE provider_url_domain; |
SELECT
gto.transaction_id,
create_time,
group_code,
schedule,
payment_type,
currency,
profit,
price,
cost,
coupon
FROM GroupTourOrder gto
JOIN Transations t
ON gto.transaction_id = t.transaction_id
WHERE
transaction_id LIKE '%'
AND create_time >= '%'
AND create_time < current_timestamp
AND group_code LIKE '%'
AND clear_status = 'N'
AND lock_status = 'N'
AND salesperson_code = 'fzjrlct'
/**/
ORDER BY t.
LIMIT 15
|
SELECT PetName, PetBreed, PetType
FROM PET
WHERE PetType NOT IN ('Cat', 'Dog', 'Fish') |
CREATE TABLE admin (
id INT NOT NULL AUTO_INCREMENT,
name VARCHAR(20) NOT NULL,
email VARCHAR(20) NOT NULL,
password VARCHAR(20) NOT NULL,
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
deleted_at DATETIME NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY(id)
);
DESCRIBE admin;
SELECT * FROM admin;
INSERT INTO admin(name,email,password) VALUES('admin', 'admin@mail.com','password');
Drop TABLE admin;
CREATE TABLE users (
id INT NOT NULL AUTO_INCREMENT,
name VARCHAR(20) NOT NULL,
email VARCHAR(20) NOT NULL,
password VARCHAR(20) NOT NULL,
is_premium BOOLEAN NOT NULL,
is_payed BOOLEAN NOT NULL,
country VARCHAR(20) NOT NULL DEFAULT('default country'),
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
deleted_at DATETIME NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY(id)
);
DESCRIBE users;
SELECT * FROM users;
INSERT INTO users(name,email,password,is_premium,is_payed,country)
VALUES('normal1','normal1@mail.com','password',FALSE,FALSE,'Turkey');
INSERT INTO users(name,email,password,is_premium,is_payed,country)
VALUES('normal2','normal2@mail.com','password',FALSE,FALSE,'Turkey');
INSERT INTO users(name,email,password,is_premium,is_payed,country)
VALUES('normal3','normal3@mail.com','password',FALSE,FALSE,'Turkey');
INSERT INTO users(name,email,password,is_premium,is_payed,country)
VALUES('normal4','normal4@mail.com','password',FALSE,FALSE,'Turkey');
INSERT INTO users(name,email,password,is_premium,is_payed,country)
VALUES('normal5','normal5@mail.com','password',TRUE,FALSE,'Turkey');
INSERT INTO users(name,email,password,is_premium,is_payed,country)
VALUES('premium1','premium1@mail.com','password',TRUE,TRUE,'Turkey');
INSERT INTO users(name,email,password,is_premium,is_payed,country)
VALUES('premium2','premium2@mail.com','password',TRUE,TRUE,'Turkey');
INSERT INTO users(name,email,password,is_premium,is_payed,country)
VALUES('premium3','premium3@mail.com','password',TRUE,TRUE,'Turkey');
INSERT INTO users(name,email,password,is_premium,is_payed,country)
VALUES('premium4','premium4@mail.com','password',TRUE,TRUE,'Turkey');
INSERT INTO users(name,email,password,is_premium,is_payed,country)
VALUES('premium5','premium5@mail.com','password',TRUE,TRUE,'Turkey');
Drop TABLE users;
CREATE TABLE user_followers(
id INT NOT NULL AUTO_INCREMENT,
user_id INT ,
follower_id INT ,
PRIMARY KEY(id),
FOREIGN KEY(user_id) REFERENCES users(id) ON DELETE CASCADE,
FOREIGN KEY(follower_id) REFERENCES users(id) ON DELETE CASCADE
);
DESCRIBE user_followers;
SELECT * FROM user_followers;
INSERT INTO user_followers(user_id,follower_id) VALUES(6,1);
INSERT INTO user_followers(user_id,follower_id) VALUES(6,2);
INSERT INTO user_followers(user_id,follower_id) VALUES(6,3);
INSERT INTO user_followers(user_id,follower_id) VALUES(7,4);
INSERT INTO user_followers(user_id,follower_id) VALUES(8,5);
Drop TABLE user_followers;
CREATE TABLE albums(
id INT NOT NULL AUTO_INCREMENT,
genre_id INT NULL,
artist_song_id INT NULL,
name VARCHAR(30) NOT NULL,
release_date INT NOT NULL,
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
deleted_at DATETIME NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY(id),
FOREIGN KEY(genre_id) REFERENCES genre(id) ON DELETE CASCADE,
FOREIGN KEY(artist_song_id) REFERENCES artist_song(id) ON DELETE CASCADE
);
DESCRIBE albums;
SELECT * FROM albums;
INSERT INTO albums(genre_id,artist_song_id,name,release_date) VALUES (1,1, 'Uppercut', 2020);
INSERT INTO albums(genre_id,artist_song_id,name,release_date) VALUES (1,2, 'C-137', 2020);
INSERT INTO albums(genre_id,artist_song_id,name,release_date) VALUES (1,3, 'Microphone Show', 2015);
INSERT INTO albums(genre_id,artist_song_id,name,release_date) VALUES (2,4, 'Californication', 1999);
INSERT INTO albums(genre_id,artist_song_id,name,release_date) VALUES (2,4, 'Stadium Arcadium', 2006);
INSERT INTO albums(genre_id,artist_song_id,name,release_date) VALUES (2,5, 'Saintmoteltelevision', 2016);
INSERT INTO albums(genre_id,artist_song_id,name,release_date) VALUES (3,6, 'Master of Puppets', 1986);
INSERT INTO albums(genre_id,artist_song_id,name,release_date) VALUES (3,7, 'Sehnsucht', 1997);
INSERT INTO albums(genre_id,artist_song_id,name,release_date) VALUES (3,8, 'Ace of Spaces', 1980);
Drop TABLE albums;
CREATE TABLE artists(
id INT NOT NULL AUTO_INCREMENT,
name VARCHAR(30) NOT NULL,
country VARCHAR(20) NOT NULL,
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
deleted_at DATETIME NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY(id)
);
DESCRIBE artists;
SELECT * FROM artists;
INSERT INTO artists(name,country) VALUES ('Defkhan','Turkey');
INSERT INTO artists(name,country) VALUES ('Hidra','Turkey');
INSERT INTO artists(name,country) VALUES ('Joker','Turkey');
INSERT INTO artists(name,country) VALUES ('Red Hot Chili Peppers','America');
INSERT INTO artists(name,country) VALUES ('Saint Motel','America');
INSERT INTO artists(name,country) VALUES ('Metallica','America');
INSERT INTO artists(name,country) VALUES ('Rammstein','Germany');
INSERT INTO artists(name,country) VALUES ('Motorhead','America');
Drop TABLE artists;
CREATE TABLE artist_song(
id INT NOT NULL AUTO_INCREMENT,
artist1_id INT NOT NULL,
artist2_id INT NULL,
artist3_id INT NULL,
FOREIGN KEY(artist1_id) REFERENCES artists(id) ON DELETE CASCADE,
FOREIGN KEY(artist2_id) REFERENCES artists(id) ON DELETE CASCADE,
FOREIGN KEY(artist3_id) REFERENCES artists(id) ON DELETE CASCADE,
PRIMARY KEY(id)
);
SELECT * FROM artist_song;
INSERT INTO artist_song(artist1_id) VALUE (1);
INSERT INTO artist_song(artist1_id) VALUE (2);
INSERT INTO artist_song(artist1_id) VALUE (3);
INSERT INTO artist_song(artist1_id) VALUE (4);
INSERT INTO artist_song(artist1_id) VALUE (5);
INSERT INTO artist_song(artist1_id) VALUE (6);
INSERT INTO artist_song(artist1_id) VALUE (7);
INSERT INTO artist_song(artist1_id) VALUE (8);
CREATE TABLE genre(
id INT NOT NULL AUTO_INCREMENT,
name VARCHAR(20) NOT NULL,
PRIMARY KEY(id)
);
DESCRIBE genre;
SELECT * FROM genre;
INSERT INTO genre(name) VALUES ('Rap');
INSERT INTO genre(name) VALUES ('Rock');
INSERT INTO genre(name) VALUES ('Metal');
Drop TABLE genre;
CREATE TABLE playlist (
id INT NOT NULL AUTO_INCREMENT,
name VARCHAR(20) NOT NULL,
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
deleted_at DATETIME NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY(id)
);
DESCRIBE playlist;
SELECT * FROM playlist;
INSERT INTO playlist(name) VALUES ('Rap');
INSERT INTO playlist(name) VALUES ('Rock');
INSERT INTO playlist(name) VALUES ('Metal');
INSERT INTO playlist(name) VALUES ('Top10 Rap');
INSERT INTO playlist(name) VALUES ('Top10 Rock');
INSERT INTO playlist(name) VALUES ('Top10 Metal');
INSERT INTO playlist(name) VALUES ('Top10 General');
Drop TABLE playlist;
CREATE TABLE songs (
id INT NOT NULL AUTO_INCREMENT,
album_id INT NULL,
genre_id INT NULL,
artist_song_id INT NULL,
name VARCHAR(20) NOT NULL,
release_date INT NOT NULL,
lenght FLOAT NOT NULL,
plays INT NOT NULL,
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
deleted_at DATETIME NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY(id),
FOREIGN KEY(album_id) REFERENCES albums(id) ON DELETE CASCADE,
FOREIGN KEY(genre_id) REFERENCES genre(id) ON DELETE CASCADE,
FOREIGN KEY(artist_song_id) REFERENCES artist_song(id) ON DELETE CASCADE
);
DESCRIBE songs;
SELECT * FROM songs;
INSERT INTO songs(album_id, genre_id, artist_song_id, name, release_date, lenght, plays)
VALUES (1,1,1,'Sade King', 2020, 3.55, 106889);
INSERT INTO songs(album_id, genre_id, artist_song_id, name, release_date, lenght, plays)
VALUES (1,1,1,'Tornavida', 2020, 3.21, 68489);
INSERT INTO songs(album_id, genre_id, artist_song_id, name, release_date, lenght, plays)
VALUES (1,1,1,'Bayrak', 2020, 3.06, 108489);
INSERT INTO songs(album_id, genre_id, artist_song_id, name, release_date, lenght, plays)
VALUES (2,1,2, 'High', 2020, 3.13, 1019621);
INSERT INTO songs(album_id, genre_id, artist_song_id, name, release_date, lenght, plays)
VALUES (2,1,2, 'Lirikal Ag', 2020, 3.00, 1367681);
INSERT INTO songs(album_id, genre_id, artist_song_id, name, release_date, lenght, plays)
VALUES (2,1,2, 'Bagirin', 2020, 3.56, 4049259);
INSERT INTO songs(album_id, genre_id, artist_song_id, name, release_date, lenght, plays)
VALUES (3,1,3,'Karistir Kartlari',2015, 3.55, 1068489);
INSERT INTO songs(album_id, genre_id, artist_song_id, name, release_date, lenght, plays)
VALUES (3,1,3,'Kafana Takma', 2015, 3.34, 155023);
INSERT INTO songs(album_id, genre_id, artist_song_id, name, release_date, lenght, plays)
VALUES (3,1,3,'Gel Barisalim', 2015, 3.15, 146364);
INSERT INTO songs(album_id, genre_id, artist_song_id, name, release_date, lenght, plays)
VALUES (4,2,4,'Around the World', 1999, 3.58, 101946665);
INSERT INTO songs(album_id, genre_id, artist_song_id, name, release_date, lenght, plays)
VALUES (4,2,4,'Parallel Universe', 1999, 4.29, 70113549);
INSERT INTO songs(album_id, genre_id, artist_song_id, name, release_date, lenght, plays)
VALUES (4,2,4,'Scar Tissue', 1999, 3.35, 410750841);
INSERT INTO songs(album_id, genre_id, artist_song_id, name, release_date, lenght, plays)
VALUES (5,2,4,'Dani California',2006, 4.42, 388875435);
INSERT INTO songs(album_id, genre_id, artist_song_id, name, release_date, lenght, plays)
VALUES (5,2,4,'Snow', 2006, 5.34, 634141024);
INSERT INTO songs(album_id, genre_id, artist_song_id, name, release_date, lenght, plays)
VALUES (5,2,4,'Charlie', 2006, 4.37, 40671324);
INSERT INTO songs(album_id, genre_id, artist_song_id, name, release_date, lenght, plays)
VALUES (6,2,5,'Move',2016, 3.07, 43735836);
INSERT INTO songs(album_id, genre_id, artist_song_id, name, release_date, lenght, plays)
VALUES (6,2,5,'Getaway', 2016, 3.01, 8280300);
INSERT INTO songs(album_id, genre_id, artist_song_id, name, release_date, lenght, plays)
VALUES (6,2,5,'Destroyer', 2016, 3.11, 9451750);
INSERT INTO songs(album_id, genre_id, artist_song_id, name, release_date, lenght, plays)
VALUES (7,3,6,'Master of Puppets',1986, 8.35, 328260361);
INSERT INTO songs(album_id, genre_id, artist_song_id, name, release_date, lenght, plays)
VALUES (7,3,6,'Battery', 1986, 5.12, 82256626);
INSERT INTO songs(album_id, genre_id, artist_song_id, name, release_date, lenght, plays)
VALUES (7,3,6,'One', 1986, 6.36, 29061611);
INSERT INTO songs(album_id, genre_id, artist_song_id, name, release_date, lenght, plays)
VALUES (8,3,7,'Sehnsucht', 1997, 4.04, 31461942);
INSERT INTO songs(album_id, genre_id, artist_song_id, name, release_date, lenght, plays)
VALUES (8,3,7,'Engel', 1997, 4.24, 115254569);
INSERT INTO songs(album_id, genre_id, artist_song_id, name, release_date, lenght, plays)
VALUES (8,3,7,'Tier', 1997, 3.46, 21780293);
INSERT INTO songs(album_id, genre_id, artist_song_id, name, release_date, lenght, plays)
VALUES (9,3,8,'Ace of Spades', 1980, 2.46, 252606228);
INSERT INTO songs(album_id, genre_id, artist_song_id, name, release_date, lenght, plays)
VALUES (9,3,8,'King of Kings', 1980, 2.38, 3484432);
INSERT INTO songs(album_id, genre_id, artist_song_id, name, release_date, lenght, plays)
VALUES (9,3,8,'Motorhead', 1980, 3.20, 4871124);
INSERT INTO songs(album_id, genre_id, artist_song_id, name, release_date, lenght, plays)
VALUES (9,3,8,'Motorhead1', 1980, 3.20, 4871124);
Drop TABLE songs;
CREATE TABLE user_album (
id INT NOT NULL AUTO_INCREMENT,
album_id INT NULL,
user_id INT NULL,
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
deleted_at DATETIME NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY(id),
FOREIGN KEY(album_id) REFERENCES albums(id) ON DELETE CASCADE,
FOREIGN KEY(user_id) REFERENCES users(id) ON DELETE CASCADE
);
DESCRIBE user_album;
SELECT * FROM user_album;
INSERT INTO user_album(album_id, user_id) VALUES (1,1);
INSERT INTO user_album(album_id, user_id) VALUES (2,1);
INSERT INTO user_album(album_id, user_id) VALUES (2,2);
INSERT INTO user_album(album_id, user_id) VALUES (3,3);
INSERT INTO user_album(album_id, user_id) VALUES (3,4);
INSERT INTO user_album(album_id, user_id) VALUES (4,5);
INSERT INTO user_album(album_id, user_id) VALUES (5,6);
INSERT INTO user_album(album_id, user_id) VALUES (4,7);
INSERT INTO user_album(album_id, user_id) VALUES (6,8);
INSERT INTO user_album(album_id, user_id) VALUES (7,9);
INSERT INTO user_album(album_id, user_id) VALUES (8,10);
INSERT INTO user_album(album_id, user_id) VALUES (1,10);
INSERT INTO user_album(album_id, user_id) VALUES (2,10);
Drop TABLE user_album;
CREATE TABLE user_artist (
id INT NOT NULL AUTO_INCREMENT,
artist_song_id INT NULL,
user_id INT NULL,
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
deleted_at DATETIME NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY(id),
FOREIGN KEY(artist_song_id) REFERENCES artist_song(id) ON DELETE CASCADE,
FOREIGN KEY(user_id) REFERENCES users(id) ON DELETE CASCADE
);
DESCRIBE user_artist;
SELECT * FROM user_artist;
INSERT INTO user_artist(artist_song_id, user_id) VALUES (1,1);
INSERT INTO user_artist(artist_song_id, user_id) VALUES (7,1);
INSERT INTO user_artist(artist_song_id, user_id) VALUES (6,2);
INSERT INTO user_artist(artist_song_id, user_id) VALUES (5,3);
INSERT INTO user_artist(artist_song_id, user_id) VALUES (3,4);
INSERT INTO user_artist(artist_song_id, user_id) VALUES (4,5);
INSERT INTO user_artist(artist_song_id, user_id) VALUES (3,6);
INSERT INTO user_artist(artist_song_id, user_id) VALUES (2,7);
INSERT INTO user_artist(artist_song_id, user_id) VALUES (5,8);
INSERT INTO user_artist(artist_song_id, user_id) VALUES (4,9);
INSERT INTO user_artist(artist_song_id, user_id) VALUES (5,10);
INSERT INTO user_artist(artist_song_id, user_id) VALUES (6,10);
INSERT INTO user_artist(artist_song_id, user_id) VALUES (7,10);
Drop TABLE user_artist;
CREATE TABLE user_playlist (
id INT NOT NULL AUTO_INCREMENT,
genre_id INT NULL,
playlist_id INT NULL,
user_id INT NULL,
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
deleted_at DATETIME NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY(id),
FOREIGN KEY(genre_id) REFERENCES genre(id) ON DELETE CASCADE,
FOREIGN KEY(playlist_id) REFERENCES playlist(id) ON DELETE CASCADE,
FOREIGN KEY(user_id) REFERENCES users(id) ON DELETE CASCADE
);
DESCRIBE user_playlist;
SELECT * FROM user_playlist;
INSERT INTO user_playlist(genre_id, playlist_id, user_id) VALUES (1,1,1);
INSERT INTO user_playlist(genre_id, playlist_id, user_id) VALUES (2,2,1);
INSERT INTO user_playlist(genre_id, playlist_id, user_id) VALUES (3,3,1);
INSERT INTO user_playlist(genre_id, playlist_id, user_id) VALUES (1,1,2);
INSERT INTO user_playlist(genre_id, playlist_id, user_id) VALUES (2,2,2);
INSERT INTO user_playlist(genre_id, playlist_id, user_id) VALUES (3,3,2);
INSERT INTO user_playlist(genre_id, playlist_id, user_id) VALUES (1,1,3);
INSERT INTO user_playlist(genre_id, playlist_id, user_id) VALUES (2,2,3);
INSERT INTO user_playlist(genre_id, playlist_id, user_id) VALUES (3,3,3);
INSERT INTO user_playlist(genre_id, playlist_id, user_id) VALUES (1,1,4);
INSERT INTO user_playlist(genre_id, playlist_id, user_id) VALUES (2,2,4);
INSERT INTO user_playlist(genre_id, playlist_id, user_id) VALUES (3,3,4);
INSERT INTO user_playlist(genre_id, playlist_id, user_id) VALUES (1,1,5);
INSERT INTO user_playlist(genre_id, playlist_id, user_id) VALUES (2,2,5);
INSERT INTO user_playlist(genre_id, playlist_id, user_id) VALUES (3,3,5);
INSERT INTO user_playlist(genre_id, playlist_id, user_id) VALUES (1,1,6);
INSERT INTO user_playlist(genre_id, playlist_id, user_id) VALUES (2,2,6);
INSERT INTO user_playlist(genre_id, playlist_id, user_id) VALUES (3,3,6);
INSERT INTO user_playlist(genre_id, playlist_id, user_id) VALUES (1,1,7);
INSERT INTO user_playlist(genre_id, playlist_id, user_id) VALUES (2,2,7);
INSERT INTO user_playlist(genre_id, playlist_id, user_id) VALUES (3,3,7);
INSERT INTO user_playlist(genre_id, playlist_id, user_id) VALUES (1,1,8);
INSERT INTO user_playlist(genre_id, playlist_id, user_id) VALUES (2,2,8);
INSERT INTO user_playlist(genre_id, playlist_id, user_id) VALUES (3,3,8);
INSERT INTO user_playlist(genre_id, playlist_id, user_id) VALUES (1,1,9);
INSERT INTO user_playlist(genre_id, playlist_id, user_id) VALUES (2,2,9);
INSERT INTO user_playlist(genre_id, playlist_id, user_id) VALUES (3,3,9);
INSERT INTO user_playlist(genre_id, playlist_id, user_id) VALUES (1,1,10);
INSERT INTO user_playlist(genre_id, playlist_id, user_id) VALUES (2,2,10);
INSERT INTO user_playlist(genre_id, playlist_id, user_id) VALUES (3,3,10);
Drop TABLE user_playlist;
CREATE TABLE playlist_songs (
id INT NOT NULL AUTO_INCREMENT,
playlist_id INT NULL,
song_id INT NULL,
user_id INT NULL,
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
deleted_at DATETIME NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY(id),
FOREIGN KEY(playlist_id) REFERENCES playlist(id) ON DELETE CASCADE,
FOREIGN KEY(song_id) REFERENCES songs(id) ON DELETE CASCADE,
FOREIGN KEY(user_id) REFERENCES users(id) ON DELETE CASCADE
);
DESCRIBE playlist_songs;
SELECT * FROM playlist_songs;
INSERT INTO playlist_songs(playlist_id, song_id, user_id) VALUES (1,1,1);
INSERT INTO playlist_songs(playlist_id, song_id, user_id) VALUES (2,4,1);
INSERT INTO playlist_songs(playlist_id, song_id, user_id) VALUES (3,7,1);
INSERT INTO playlist_songs(playlist_id, song_id, user_id) VALUES (1,2,2);
INSERT INTO playlist_songs(playlist_id, song_id, user_id) VALUES (2,5,2);
INSERT INTO playlist_songs(playlist_id, song_id, user_id) VALUES (3,8,2);
INSERT INTO playlist_songs(playlist_id, song_id, user_id) VALUES (1,3,3);
INSERT INTO playlist_songs(playlist_id, song_id, user_id) VALUES (2,6,3);
INSERT INTO playlist_songs(playlist_id, song_id, user_id) VALUES (3,9,3);
INSERT INTO playlist_songs(playlist_id, song_id, user_id) VALUES (1,1,4);
INSERT INTO playlist_songs(playlist_id, song_id, user_id) VALUES (2,4,4);
INSERT INTO playlist_songs(playlist_id, song_id, user_id) VALUES (3,7,4);
INSERT INTO playlist_songs(playlist_id, song_id, user_id) VALUES (1,2,5);
INSERT INTO playlist_songs(playlist_id, song_id, user_id) VALUES (2,5,5);
INSERT INTO playlist_songs(playlist_id, song_id, user_id) VALUES (3,8,5);
INSERT INTO playlist_songs(playlist_id, song_id, user_id) VALUES (1,3,6);
INSERT INTO playlist_songs(playlist_id, song_id, user_id) VALUES (2,6,6);
INSERT INTO playlist_songs(playlist_id, song_id, user_id) VALUES (3,9,6);
INSERT INTO playlist_songs(playlist_id, song_id, user_id) VALUES (1,1,7);
INSERT INTO playlist_songs(playlist_id, song_id, user_id) VALUES (2,4,7);
INSERT INTO playlist_songs(playlist_id, song_id, user_id) VALUES (3,7,7);
INSERT INTO playlist_songs(playlist_id, song_id, user_id) VALUES (1,2,8);
INSERT INTO playlist_songs(playlist_id, song_id, user_id) VALUES (2,5,8);
INSERT INTO playlist_songs(playlist_id, song_id, user_id) VALUES (3,8,8);
INSERT INTO playlist_songs(playlist_id, song_id, user_id) VALUES (1,3,9);
INSERT INTO playlist_songs(playlist_id, song_id, user_id) VALUES (2,6,9);
INSERT INTO playlist_songs(playlist_id, song_id, user_id) VALUES (3,9,9);
INSERT INTO playlist_songs(playlist_id, song_id, user_id) VALUES (1,1,10);
INSERT INTO playlist_songs(playlist_id, song_id, user_id) VALUES (2,4,10);
INSERT INTO playlist_songs(playlist_id, song_id, user_id) VALUES (3,7,10);
Drop TABLE playlist_songs;
SET GLOBAL FOREIGN_KEY_CHECKS=0 |
SELECT TOP(CONVERT(INT, /*topRow*/))
CONTRACT_INFO.APPLY_NO,--็ณ่ซ็ชๅท
CONTRACT_INFO.CONTRACT_NO,--ๅฅ็ด็ชๅท
CONTRACT_INFO.AGENCY_CUST_CODE,--ๅฃฒไธปใณใผใ
CONTRACT_INFO.KEY_CURRENCY_ID, --ๅๅผ้่ฒจ
CASE WHEN
CUST2.CUSTOMER_ABBR_NAME IS NULL THEN CONTRACT_INFO.CUST3NAME
ELSE
CUST2.CUSTOMER_ABBR_NAME
END AS AGENCY_NAME, --ๅฃฒไธปๅ
CONTRACT_INFO.CUSTOMER_CODE,--้กงๅฎขใณใผใ
CUST1.CUSTOMER_ABBR_NAME AS CUSTOMER_NAME,--้กงๅฎขๅ
CONTRACT_INFO.REPRESENTATION_SUPPLIES_NAME AS SUPPLIES_NAME,--็ฉไปถๅ
CONTRACT_INFO.OBTAIN_SUM_TOTAL,--ๅๅพ้้ก
CONTRACT_INFO.WITHDRAW_SUM_TOTAL,--ๅๅ็ท้ก
CONTRACT_INFO.START_DATE,--้ๅง๏ผไบๅฎ๏ผๆฅ
CONTRACT_INFO.CONTRACT_PERIOD,--ๆ้
CONTRACT_INFO.EARNINGS_RATE,--ๅฎ่ณชๅฉๅปป
CONTRACT_INFO.GROSS_MARGIN_PRESENT,--็ฒๅฉๅไพก
CONTRACT_INFO.SPREAD,--๏ฝฝ๏พ๏พ๏พ๏ฝฏ๏พ๏พ
CONTRACT_INFO.CONTRACT_CONDITION AS CONTRACT_CONDITION_CODE,--ๅฅ็ด็ถๆณใณใผใ
CODE.CODE_NAME AS CONTRACT_CONDITION,--ๅฅ็ด็ถๆณ
CONTRACT_INFO.CHARGER_NAME,--็ณ่ซ่
CONTRACT_INFO.MODIFY_DATE,--ๆฐ่ฆๆฅไป/ๆดๆฐๆฅไป
CONTRACT_INFO.CANCAL_STATE, --ๅๆถ็ถๆณ
CONTRACT_INFO.CASE_NO, --ๆกไปถ็ชๅท
--CONTRACT_INFO.CONTRACT_FILE_TYPE as CONTRACT_FILE_TYPE, --ไฝฟ็จๅฅ็ดๆธๅบๅ
CURRENCYMST.CURRENCY_NAME, -- ้่ฒจ่กจ็คบๅ
-- ใ่ฃฝๅๅโ ๏ผๅขๅค็จ็ญ๏ผๅใไปๆง่ฟฝๅ ใปๅคๆดใ ZHOU ADD START 2012/10/12--
CONTRACT_INFO.TAX_TYPE AS H_TAX_CATEGORY, --็จๅบๅ
-- ใ่ฃฝๅๅโ ๏ผๅขๅค็จ็ญ๏ผๅใไปๆง่ฟฝๅ ใปๅคๆดใ ZHOU ADD END 2012/10/12 --
--**********ใTFSๅใไปๆง่ฟฝๅ ใปๅคๆดๅฏพๅฟใ zhou add start 2013/01/08*************--
CONTRACT_INFO.TRADE_MORPHOLOGY --ๅๅผๅฝขๆ
--**********ใTFSๅใไปๆง่ฟฝๅ ใปๅคๆดๅฏพๅฟใ zhou add end 2013/01/08***************--
--*** wanglanyu add 2013/12/06 start ***/
,CONTRACT_INFO.CHARGE_AGENCY as BRANCH_SEARCH, --ๆ ็นใณใผใ
BRAN.BRANCH_NAME BRANCH_SEARCH_NAME--ๆ ็นๅ
--*** wanglanyu add 2013/12/06 end ***/
FROM
(SELECT
--CONTRACT.CONTRACT_FILE_TYPE,
CONTRACT.APPLY_NO,
CONTRACT.CONTRACT_NO,
CONTRACT.CASE_NO,
CONTRACT.USER_ID,
CONTRACT.CHARGER_NAME,
ISNULL(CONTRACT.AGENCY_CUST_CODE,SUPPLIES.ANGENCY_CUSTOMER_CODE) AS AGENCY_CUST_CODE,
CONTRACT.AGENCY_NAME,
CONTRACT.CUSTOMER_CODE,
CONTRACT.CUSTOMER_NAME,
--redmine #1428 start
CONTRACT.REAL_CREDIT_CUSTOMER_CODE,
CONTRACT.REAL_CREDIT_CUSTOMER_NAME,
--redmine #1428 end
CONTRACT.MODIFY_DATE,
CONTRACT.REPRESENTATION_SUPPLIES_NAME,
SUPPLIES.SUPPLIES_NO,
CONTRACT.OBTAIN_SUM_TOTAL AS OBTAIN_SUM_TOTAL,
CONTRACT.WITHDRAW_SUM_TOTAL AS WITHDRAW_SUM_TOTAL,
-- ใ่ฃฝๅๅโ ๏ผๅขๅค็จ็ญ๏ผๅใไปๆง่ฟฝๅ ใปๅคๆดใ ZHOU ADD START 2012/10/12--
CONTRACT.TAX_TYPE,
-- ใ่ฃฝๅๅโ ๏ผๅขๅค็จ็ญ๏ผๅใไปๆง่ฟฝๅ ใปๅคๆดใ ZHOU ADD END 2012/10/12 --
--ๅฅ็ด็ถๆณ๏ผ๏ผ้ๅงๆธ then ้ๅงๆฅ else ้ๅงไบๅฎๆฅ
CASE WHEN
CONTRACT.CONTRACT_CONDITION >=CAST(/*dto.alreadyStarted*/ AS CHAR(2)) THEN CONTRACT.START_DATE
ELSE
CONTRACT.START_SCHEDULED_DATE END AS START_DATE,
CONTRACT.CONTRACT_PERIOD,
CONTRACT.EARNINGS_RATE,
CONTRACT.KEY_CURRENCY_ID,
CONTRACT.GROSS_MARGIN_PRESENT_VALUE AS GROSS_MARGIN_PRESENT,
(CONTRACT.EARNINGS_RATE - CONTRACT.PROCURANCE_COST) AS SPREAD,
--ๆฅญๅๆฅๆๅๅพAPI๏ผ๏ผ่ปขใชใผในๆฅ AND ๅฅ็ด็ถๆณ๏ผ42:่ปขใชใผในๆฑบ่ฃๆธ then 43๏ผ่ปขใชใผในๆธ
CASE WHEN
CONVERT(DATE,/*dtType*/) >= CONTRACT.TRANSFER_LEASE_DATE
AND CONTRACT.CONTRACT_CONDITION=/*dto.transferLeaseAlreadySanction*/ THEN /*dto.alreadyTransferLease*/
--ๆฅญๅๆฅๆๅๅพAPI๏ผ๏ผ่งฃ็ดๆฅ AND ๅฅ็ด็ถๆณ๏ผ52:่งฃ็ดๆฑบ่ฃๆธ then 53๏ผ่งฃ็ดๆธ
WHEN
CONVERT(DATE,/*dtType*/) >= CONTRACT.END_AGREEMENT_DATE
AND CONTRACT.CONTRACT_CONDITION=/*dto.cancelAlreadySanction*/ THEN /*dto.alreadyCancel*/
--ๆฅญๅๆฅๆๅๅพAPI๏ผ๏ผๆบไบๆฅ AND ๅฅ็ด็ถๆณ<>42:่ปขใชใผในๆฑบ่ฃๆธ AND ๅฅ็ด็ถๆณ<> 52:่งฃ็ดๆฑบ่ฃๆธ then 60๏ผๆบไบๆธ
WHEN
CONVERT(DATE,/*dtType*/) >= CONTRACT.END_DATE
AND CONTRACT.CONTRACT_CONDITION<>/*dto.transferLeaseAlreadySanction*/
AND CONTRACT.CONTRACT_CONDITION<>/*dto.cancelAlreadySanction*/ THEN /*dto.end*/
ELSE
CONTRACT.CONTRACT_CONDITION END AS CONTRACT_CONDITION,
CONTRACT.CANCAL_STATE,
CONTRACT.TRANSFER_LEASE_DATE,
CONTRACT.END_AGREEMENT_DATE,
CONTRACT.END_DATE,
CUST3.CUSTOMER_ABBR_NAME AS CUST3NAME,
CONTRACT.PAY_CONDITION,
CONTRACT.END_FILE_PRINTOUT_STATUS,
CONTRACT.PURCHASE_OPTION_RIGHT,
--**********ใTFSๅใไปๆง่ฟฝๅ ใปๅคๆดๅฏพๅฟใ zhou add start 2013/01/08*************--
CONTRACT.TRADE_MORPHOLOGY --ๅๅผๅฝขๆ
--**********ใTFSๅใไปๆง่ฟฝๅ ใปๅคๆดๅฏพๅฟใ zhou add end 2013/01/08***************--
--***wanglanyu add 2013/12/06 start ***/
,CONTRACT.CHARGE_AGENCY
--***wanglanyu add 2013/12/06 end ***/
,CONTRACT.END_AGREEMENT_REASON
--ๅฅ็ดๆ
ๅ ฑใใผใใซ
FROM CONTRACT_INFO CONTRACT
--ๅฅ็ด็ฉไปถๆ
ๅ ฑใใผใใซ
INNER JOIN CONTRACT_SUPPLIES_INFO SUPPLIES
ON
CONTRACT.CONTRACT_NO=SUPPLIES.CONTRACT_NO
/*IF (dto.suppliesNoSearch != null)*/
AND EXISTS(SELECT * FROM CONTRACT_SUPPLIES_INFO CON WHERE CON.CONTRACT_NO = CONTRACT.CONTRACT_NO AND CON.SUPPLIES_NO = /*dto.suppliesNoSearch*/)
/*END*/
LEFT JOIN CUSTOMER_MST CUST3
ON
CUST3.DELETE_FLG =CAST(/*dto.deleteFlgNormal*/ AS CHAR(1))
AND CUST3.AGENCY_FLG=CAST(/*dto.fAgencyFlag*/ AS CHAR(1))
AND CUST3.CUSTOMER_CODE=SUPPLIES.ANGENCY_CUSTOMER_CODE
WHERE 1=1
/*IF (dto.payConditionSearch != null)*/
AND CONTRACT.PAY_CONDITION = CAST(/*dto.payConditionSearch*/ AS CHAR(1))
/*END*/
AND (
(
CONTRACT.CONTRACT_CONDITION >= CAST(/*contractCondition31*/ AS CHAR(2))
/*IF (dto.startDateFrom != null)*/
AND CONTRACT.START_DATE >= CONVERT(DATE,/*dto.startDateFrom*/)
/*END*/
/*IF (dto.startDateTo != null)*/
AND CONTRACT.START_DATE <= CONVERT(DATE,/*dto.startDateTo*/)
/*END*/
)
OR
(
CONTRACT.CONTRACT_CONDITION < CAST(/*contractCondition31*/ AS CHAR(2))
/*IF (dto.startDateFrom != null)*/
AND CONTRACT.START_SCHEDULED_DATE >= CONVERT(DATE,/*dto.startDateFrom*/)
/*END*/
/*IF (dto.startDateTo != null)*/
AND CONTRACT.START_SCHEDULED_DATE <= CONVERT(DATE,/*dto.startDateTo*/)
/*END*/
)
)
AND (
(
CONTRACT.CONTRACT_CONDITION >= CAST(/*contractCondition20*/ AS CHAR(2))
/*IF (dto.contractPlanDateFrom != null)*/
AND CONTRACT.CONTRACT_DATE >= CONVERT(DATE,/*dto.contractPlanDateFrom*/)
/*END*/
/*IF (dto.contractPlanDateTo != null)*/
AND CONTRACT.CONTRACT_DATE <= CONVERT(DATE,/*dto.contractPlanDateTo*/)
/*END*/
)
OR
(
CONTRACT.CONTRACT_CONDITION < CAST(/*contractCondition20*/ AS CHAR(2))
/*IF (dto.contractPlanDateFrom != null)*/
AND CONTRACT.CONTRACT_SCHEDULED_DATE >= CONVERT(DATE,/*dto.contractPlanDateFrom*/)
/*END*/
/*IF (dto.contractPlanDateTo != null)*/
AND CONTRACT.CONTRACT_SCHEDULED_DATE <= CONVERT(DATE,/*dto.contractPlanDateTo*/)
/*END*/
)
)
/*IF (dto.endReportStatusSearch != null)*/
AND CONTRACT.END_FILE_PRINTOUT_STATUS = CAST(/*dto.endReportStatusSearch*/ AS CHAR(1))
/*END*/
--็ป้ข๏ผๅฅ็ด็ชๅท
/*IF (dto.contractNoSearch != null)*/
AND (CONTRACT.CONTRACT_NO=/*dto.contractNoSearch*/ OR CONTRACT.OUTSIDE_CONTRACT_NO=/*dto.contractNoSearch*/ OR OLD_TOZUI_CONTRACT_NO = /*dto.contractNoSearch*/)
/*END*/
/*IF (dto.agencyCodeSearch != null)*/
AND (CONTRACT.AGENCY_CUST_CODE=/*dto.agencyCodeSearch*/ OR SUPPLIES.ANGENCY_CUSTOMER_CODE=/*dto.agencyCodeSearch*/)
/*END*/
/*IF(dto.conCurrencySearch!=null)*/
AND CONTRACT.KEY_CURRENCY_ID= CAST(/*dto.conCurrencySearch*/ AS CHAR(3))
/*END*/
) AS CONTRACT_INFO
--ใณใผใใในใ
LEFT JOIN CODE_MASTER CODE
ON
CODE.CODE_TYPE=CAST(/*dto.contractStatus*/ AS CHAR(3))
AND CODE.COUNTRY_ID=/*dto.countryId*/
AND CODE.CODE_ID=CONTRACT_INFO.CONTRACT_CONDITION
--ๅๅผๅ
ใในใฟ๏ผ--้กงๅฎข
LEFT JOIN CUSTOMER_MST CUST1
ON
CUST1.DELETE_FLG =CAST(/*dto.deleteFlgNormal*/ AS CHAR(1))
AND CUST1.CUSTOMER_FLG=CAST(/*dto.fCustomerFlag*/ AS CHAR(1))
AND CUST1.CUSTOMER_CODE=CONTRACT_INFO.CUSTOMER_CODE
--ๅๅผๅ
ใในใฟ๏ผ--ๅฃฒไธป
LEFT JOIN CUSTOMER_MST CUST2
ON
CUST2.DELETE_FLG =CAST(/*dto.deleteFlgNormal*/ AS CHAR(1))
--ใLAMP่ฃฝๅๅ_ใญใผใณSTEP1ไปๆง่ฟฝๅ ใปๅคๆดๅฏพๅฟใ zhanghf del 2014/06/10 start
--AND CUST2.AGENCY_FLG=CAST(dto.fAgencyFlag AS CHAR(1))
--ใLAMP่ฃฝๅๅ_ใญใผใณSTEP1ไปๆง่ฟฝๅ ใปๅคๆดๅฏพๅฟใ zhanghf del 2014/06/10 end
AND CUST2.CUSTOMER_CODE=CONTRACT_INFO.AGENCY_CUST_CODE
-- ้่ฒจใในใฟ
LEFT JOIN CURRENCY_MST CURRENCYMST
ON CONTRACT_INFO.KEY_CURRENCY_ID = CURRENCYMST.CURRENCY_ID
INNER JOIN (SELECT
C.CONTRACT_NO,
MIN(S.SUPPLIES_NO) AS SUPPLIES_NO
FROM
CONTRACT_INFO C
INNER JOIN CONTRACT_SUPPLIES_INFO S
ON
S.CONTRACT_NO = C.CONTRACT_NO
WHERE
1=1
/*IF (dto.payConditionSearch != null)*/
AND C.PAY_CONDITION = CAST(/*dto.payConditionSearch*/ AS CHAR(1))
/*END*/
AND (
(
C.CONTRACT_CONDITION >= CAST(/*contractCondition31*/ AS CHAR(2))
/*IF (dto.startDateFrom != null)*/
AND C.START_DATE >= CONVERT(DATE,/*dto.startDateFrom*/)
/*END*/
/*IF (dto.startDateTo != null)*/
AND C.START_DATE <= CONVERT(DATE,/*dto.startDateTo*/)
/*END*/
)
OR
(
C.CONTRACT_CONDITION < CAST(/*contractCondition31*/ AS CHAR(2))
/*IF (dto.startDateFrom != null)*/
AND C.START_SCHEDULED_DATE >= CONVERT(DATE,/*dto.startDateFrom*/)
/*END*/
/*IF (dto.startDateTo != null)*/
AND C.START_SCHEDULED_DATE <= CONVERT(DATE,/*dto.startDateTo*/)
/*END*/
)
)
/*IF (dto.endReportStatusSearch != null)*/
AND C.END_FILE_PRINTOUT_STATUS = CAST(/*dto.endReportStatusSearch*/ AS CHAR(1))
/*END*/
--็ป้ข๏ผๅฅ็ด็ชๅท
/*IF (dto.contractNoSearch != null)*/
AND
( C.CONTRACT_NO=/*dto.contractNoSearch*/ OR C.OUTSIDE_CONTRACT_NO=/*dto.contractNoSearch*/ OR C.OLD_TOZUI_CONTRACT_NO = /*dto.contractNoSearch*/ )
/*END*/
/*IF (dto.agencyCodeSearch != null)*/
AND
( C.AGENCY_CUST_CODE=/*dto.agencyCodeSearch*/ OR S.ANGENCY_CUSTOMER_CODE=/*dto.agencyCodeSearch*/ )
/*END*/
GROUP BY
C.CONTRACT_NO
) CONTRACT_SINGLE
ON CONTRACT_SINGLE.SUPPLIES_NO = CONTRACT_INFO.SUPPLIES_NO AND CONTRACT_SINGLE.CONTRACT_NO = CONTRACT_INFO.CONTRACT_NO
--***wanglanyu add 2013/12/06 start ***/
LEFT JOIN BRANCH_MST BRAN
ON
--ๅฅ็ดๆ
ๅ ฑ๏ผๆ ็นใณใผใใ=ใๆ ็นใในใฟ๏ผๆ ็นใณใผใ๏ผ๏ผ๏ผ
BRAN.BRANCH_CODE = CONTRACT_INFO.CHARGE_AGENCY
--ๆ ็นใในใฟ๏ผๅฝ๏ผฉ๏ผคใ๏ผใใปใใทใงใณ๏ผๅฝ๏ผฉ๏ผค
AND BRAN.COUNTRY_ID = /*countryId*/
--***wanglanyu add 2013/12/06 end ***/
WHERE
1=1
--็ป้ข๏ผๆกไปถๅฑๆง
/*IF (dto.caseNoSearch != null)*/
AND CONTRACT_INFO.CASE_NO = CAST(/*dto.caseNoSearch*/ AS CHAR(4))
/*END*/
--็ป้ข๏ผๅฅ็ด็ถๆณFromใจ็ป้ข๏ผๅฅ็ด็ถๆณTo
/*IF (dto.contractConditionFromSearch != null and dto.contractConditionToSearch != null)*/
AND (CONTRACT_INFO.CONTRACT_CONDITION >= CAST(/*dto.contractConditionFromSearch*/ AS CHAR(2))
AND CONTRACT_INFO.CONTRACT_CONDITION <= CAST(/*dto.contractConditionToSearch*/ AS CHAR(2)))
/*END*/
/*IF (dto.contractConditionFromSearch != null and dto.contractConditionToSearch == null)*/
AND (CONTRACT_INFO.CONTRACT_CONDITION >= CAST(/*dto.contractConditionFromSearch*/ AS CHAR(2)))
/*END*/
/*IF (dto.contractConditionToSearch != null and dto.contractConditionFromSearch == null)*/
AND (CONTRACT_INFO.CONTRACT_CONDITION <= CAST(/*dto.contractConditionToSearch*/ AS CHAR(2)))
/*END*/
--็ป้ข๏ผๅฅ็ด็ถๆณFrom๏ผ43๏ผ่ปขใชใผในๆธ
/*END*/
--็ป้ข๏ผๅๆถ็ถๆณ
/*IF (dto.cancelConditionSearch != null)*/
AND CONTRACT_INFO.CANCAL_STATE = CAST(/*dto.cancelConditionSearch*/ AS CHAR(1))
/*END*/
--็ป้ข๏ผๅฃฒไธปใณใผใ
/*IF (dto.agencyCodeSearch != null)*/
AND CONTRACT_INFO.AGENCY_CUST_CODE=/*dto.agencyCodeSearch*/
/*END*/
--็ป้ข๏ผ้กงๅฎขใณใผใ
/*IF (dto.customerCodeSearch != null)*/
AND CONTRACT_INFO.CUSTOMER_CODE=/*dto.customerCodeSearch*/
/*END*/
--redmine #1428 start
--็ป้ข๏ผๅฎ้
ๆไฟกๆนใณใผใ
/*IF (dto.realCreditCustomerCodeSearch != null)*/
AND CONTRACT_INFO.REAL_CREDIT_CUSTOMER_CODE=/*dto.realCreditCustomerCodeSearch*/
/*END*/
--redmine #1428 end
--็ป้ข๏ผๆ
ๅฝ่
ID
/*IF (dto.chargerNameSearch != null)*/
AND CONTRACT_INFO.USER_ID=/*dto.chargerNameSearch*/
/*END*/
-- ใ่ฃฝๅๅโ ๏ผๅขๅค็จ็ญ๏ผๅใไปๆง่ฟฝๅ ใปๅคๆดใ ZHOU ADD START 2012/10/12--
/*IF (dto.taxCategorySearch != null)*/
AND CONTRACT_INFO.TAX_TYPE= CAST(/*dto.taxCategorySearch*/ AS CHAR(1))
/*END*/
--***wanglanyu add 2013/12/06 start ***/
/*IF (dto.branch != null)*/
AND CONTRACT_INFO.CHARGE_AGENCY= CAST(/*dto.branch*/ AS CHAR(8))
--ELSE
AND CONTRACT_INFO.CHARGE_AGENCY IN /*dto.branchList*/()
/*END*/
--***wanglanyu add 2013/12/06 end ***/
/*IF (dto.endAgreementReason != null)*/
AND CONTRACT_INFO.END_AGREEMENT_REASON = CAST(/*dto.endAgreementReason*/ AS CHAR(1))
/*END*/
ORDER BY
CONTRACT_INFO.CONTRACT_NO ASC |
CLEAR SCREEN;
SET SERVEROUTPUT ON;
SET FEEDBACK ON;
DECLARE
rb RMAN_RULEBLOCKS%ROWTYPE;
BEGIN
-- BEGINNING OF RULEBLOCK --
rb.blockid:='ckd_anaemia';
DELETE FROM rman_ruleblocks WHERE blockid=rb.blockid;
rb.picoruleblock:='
/* Rule block to determine CKD complications */
#define_ruleblock([[rb_id]],
{
description: "Rule block to determine CKD complications",
is_active:2
}
);
#doc(,
{
txt:"Complications including Hb low",
cite : "ckd_complications_ref1, ckd_complications_ref2"
}
);
ckd => rout_ckd.ckd.val.bind();
rrt => rout_rrt.rrt.val.bind();
esrd : {rrt in (1,2,4)=>1},{=>0};
#doc(,
{
txt:"Haematenics"
}
);
hb => eadv.lab_bld_hb._.lastdv().where(dt>sysdate-60);
hb2 => eadv.lab_bld_hb._.lastdv().where(dt<hb_dt and dt>sysdate-90);
hb3 => eadv.lab_bld_hb._.lastdv().where(dt<hb2_dt-21 and dt>sysdate-120);
hb2_1_qt : { coalesce(hb2_val,0)>0 => round((hb_val-hb2_val)/hb2_val,2)};
hb3_2_qt : { coalesce(hb3_val,0)>0 => round((hb2_val-hb3_val)/hb3_val,2)};
hb_cum_qt : { hb2_1_qt > 0.2 and (hb3_2_qt + hb2_1_qt) >0.3 => 1},
{ hb2_1_qt > 0.1 and (hb3_2_qt + hb2_1_qt) >0.2 => 2},
{ hb2_1_qt < (-0.1) and (hb3_2_qt + hb2_1_qt) < (-0.2) => 3},
{ hb2_1_qt < (-0.2) and (hb3_2_qt + hb2_1_qt) < (-0.3) => 4},
{=>0};
hb_non_ss : {hb_dt - hb2_dt <7 and abs(hb2_1_qt)>0.2 =>1},{=>0};
plt1 => eadv.lab_bld_platelets._.lastdv().where(dt>sysdate-60);
wcc_neut1 => eadv.lab_bld_wcc_neutrophils._.lastdv().where(dt>sysdate-60);
wcc_eos1 => eadv.lab_bld_wcc_eosinophils._.lastdv().where(dt>sysdate-60);
rbc_mcv => eadv.lab_bld_rbc_mcv._.lastdv().where(dt>sysdate-60);
esa => eadv.rxnc_b03xa._.lastdv().where(dt>sysdate-365);
b05_ld => eadv.[rxnc_b05cb,rxnc_b05xa].dt.max().where(val=1);
fer => eadv.lab_bld_ferritin._.lastdv().where(dt>sysdate-120);
crp => eadv.lab_bld_crp._.lastdv().where(dt>sysdate-120);
tsat1 => eadv.lab_bld_tsat._.lastdv().where(dt>sysdate-120);
#doc(,{
txt:"Determine haematenic complications"
});
hb_state : { coalesce(hb_val,0)>0 and coalesce(hb_val,0)<60 =>1},
{ coalesce(hb_val,0)>=60 and coalesce(hb_val,0)<80 =>2},
{ coalesce(hb_val,0)>=80 and coalesce(hb_val,0)<100 =>3},
{ coalesce(hb_val,0)>=100 and coalesce(hb_val,0)<125 =>4},
{ coalesce(hb_val,0)>=125 and coalesce(hb_val,0)<140 =>5},
{ coalesce(hb_val,0)>=140 and coalesce(hb_val,0)<180 =>6},
{ coalesce(hb_val,0)>180 =>7},
{=>0};
mcv_state : { hb_state=1 and coalesce(rbc_mcv_val,0)>0 and coalesce(rbc_mcv_val,0)<70 => 11 },
{ hb_state=1 and coalesce(rbc_mcv_val,0)>=70 and coalesce(rbc_mcv_val,0)<80 => 12 },
{ hb_state=1 and coalesce(rbc_mcv_val,0)>=80 and coalesce(rbc_mcv_val,0)<=100 => 20 },
{ hb_state=1 and coalesce(rbc_mcv_val,0)>=100 => 31 },{ =>0};
fe_status_null : { fer_val? and tsat1_val? =>1},{=>0};
fe_low : { fer_val<250 or tsat1_val<0.25=> 1},{=>0};
hyper_ferr : { fer_val>1000 => 1},{=>0};
thal_sig : {mcv_state=11 =>1 },{=>0};
esa_null : { esa_dt? =>1},{=>0};
esa_state : { esa_null=0 and esa_val=1 => 1},{ esa_null=0 and esa_val=0 => 2},{=>0};
[[rb_id]] : { rrt in(1,2,4) or ckd>4 => 1 },{=>0};
';
rb.picoruleblock := replace(rb.picoruleblock,'[[rb_id]]',rb.blockid);
rb.picoruleblock:=rman_pckg.sanitise_clob(rb.picoruleblock);
INSERT INTO rman_ruleblocks(blockid,picoruleblock) VALUES(rb.blockid,rb.picoruleblock);
COMMIT;
-- END OF RULEBLOCK --
END;
|
CREATE OR REPLACE VIEW "REDLINE"."PNMAC"."VW_MONTHTABLE" AS
SELECT
date_start
,dateadd('day',-1, add_months(date_start,1)) as date_end
FROM
(SELECT /* Table of all months from 2014 to 2023 */
dateadd(month,row_number() over (ORDER BY seq4())-1,add_months(date_from_parts(year(current_timestamp()), month(current_timestamp()), 1),-12)) as date_start
FROM table(generator(rowCount => 14))) generator;
|
-- MariaDB dump 10.19 Distrib 10.4.18-MariaDB, for Win64 (AMD64)
--
-- Host: 127.0.0.1 Database: projet_trello
-- ------------------------------------------------------
-- Server version 10.4.18-MariaDB
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
/*!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 `board`
--
DROP TABLE IF EXISTS `board`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `board` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`Title` varchar(128) NOT NULL,
`Owner` int(11) NOT NULL,
`CreatedAt` datetime NOT NULL DEFAULT current_timestamp(),
`ModifiedAt` datetime DEFAULT NULL,
PRIMARY KEY (`ID`),
UNIQUE KEY `Title` (`Title`),
KEY `Owner` (`Owner`),
CONSTRAINT `board_ibfk_1` FOREIGN KEY (`Owner`) REFERENCES `user` (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `board`
--
LOCK TABLES `board` WRITE;
/*!40000 ALTER TABLE `board` DISABLE KEYS */;
INSERT INTO `board` VALUES (1,'Projet PRWB',1,'2020-10-11 17:48:59',NULL),(2,'Projet ANC3',3,'2020-10-11 17:48:59',NULL),(4,'Boulot',5,'2020-11-25 18:54:53',NULL);
/*!40000 ALTER TABLE `board` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `card`
--
DROP TABLE IF EXISTS `card`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `card` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`Title` varchar(128) NOT NULL,
`Body` text NOT NULL,
`Position` int(11) NOT NULL DEFAULT 0,
`CreatedAt` datetime NOT NULL DEFAULT current_timestamp(),
`ModifiedAt` datetime DEFAULT NULL,
`Author` int(11) NOT NULL,
`Column` int(11) NOT NULL,
`DueDate` date DEFAULT NULL,
PRIMARY KEY (`ID`),
KEY `Author` (`Author`),
KEY `Column` (`Column`),
CONSTRAINT `card_ibfk_1` FOREIGN KEY (`Author`) REFERENCES `user` (`ID`),
CONSTRAINT `card_ibfk_2` FOREIGN KEY (`Column`) REFERENCES `column` (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `card`
--
LOCK TABLES `card` WRITE;
/*!40000 ALTER TABLE `card` DISABLE KEYS */;
INSERT INTO `card` VALUES (1,'Analyse conceptuelle','Faire l\'analyse conceptuelle de la base de donnรฉes du projet.',1,'2020-10-11 17:56:40','2020-11-27 13:07:39',2,3,NULL),(2,'Mockups itรฉration 1','Faire des prototypes d\'รฉcrans pour les fonctionnalitรฉs de la premiรจre itรฉration.',0,'2020-10-11 17:56:40','2020-11-27 13:07:40',1,2,NULL),(3,'Ecrire รฉnoncรฉ itรฉration 1.','',1,'2020-10-11 17:58:37','2020-11-27 13:07:42',4,2,'2021-01-01'),(4,'Echรฉances IT1 !','Dรฉcider des dates d\'รฉchรฉance pour la premiรจre itรฉration.',0,'2020-10-11 17:58:37','2020-11-27 13:07:34',1,3,NULL),(6,'Enoncรฉ itรฉration 2','',0,'2020-11-27 13:07:54',NULL,5,1,NULL);
/*!40000 ALTER TABLE `card` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `collaborate`
--
DROP TABLE IF EXISTS `collaborate`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `collaborate` (
`Board` int(11) NOT NULL,
`Collaborator` int(11) NOT NULL,
PRIMARY KEY (`Board`,`Collaborator`),
KEY `Collaborator` (`Collaborator`),
CONSTRAINT `collaborate_ibfk_1` FOREIGN KEY (`Collaborator`) REFERENCES `user` (`ID`),
CONSTRAINT `collaborate_ibfk_2` FOREIGN KEY (`Board`) REFERENCES `board` (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `collaborate`
--
LOCK TABLES `collaborate` WRITE;
/*!40000 ALTER TABLE `collaborate` DISABLE KEYS */;
INSERT INTO `collaborate` VALUES (1,2),(1,4),(1,5),(2,1);
/*!40000 ALTER TABLE `collaborate` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `column`
--
DROP TABLE IF EXISTS `column`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `column` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`Title` varchar(128) NOT NULL,
`Position` int(11) NOT NULL DEFAULT 0,
`CreatedAt` datetime NOT NULL DEFAULT current_timestamp(),
`ModifiedAt` datetime DEFAULT NULL,
`Board` int(11) NOT NULL,
PRIMARY KEY (`ID`),
KEY `Board` (`Board`),
CONSTRAINT `column_ibfk_1` FOREIGN KEY (`Board`) REFERENCES `board` (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `column`
--
LOCK TABLES `column` WRITE;
/*!40000 ALTER TABLE `column` DISABLE KEYS */;
INSERT INTO `column` VALUES (1,'A faire',0,'2020-10-11 17:51:59',NULL,1),(2,'En cours',1,'2020-10-11 17:51:59',NULL,1),(3,'Terminรฉ',2,'2020-10-11 17:52:27',NULL,1),(4,'A faire',0,'2020-10-11 17:52:27',NULL,2),(5,'Fini',1,'2020-10-11 17:53:07',NULL,2),(6,'Abandonnรฉ',2,'2020-10-11 17:53:07',NULL,2),(11,'Pas urgent...',0,'2020-11-25 18:55:06',NULL,4),(12,'Ne pas perdre de vue',1,'2020-11-25 18:55:17',NULL,4),(13,'Pour hier',2,'2020-11-25 18:55:32',NULL,4),(15,'Trop tard',3,'2020-11-25 18:56:11',NULL,4);
/*!40000 ALTER TABLE `column` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `participate`
--
DROP TABLE IF EXISTS `participate`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `participate` (
`Participant` int(11) NOT NULL,
`Card` int(11) NOT NULL,
PRIMARY KEY (`Participant`,`Card`),
KEY `Card` (`Card`),
CONSTRAINT `participate_ibfk_1` FOREIGN KEY (`Card`) REFERENCES `card` (`ID`),
CONSTRAINT `participate_ibfk_2` FOREIGN KEY (`Participant`) REFERENCES `user` (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `participate`
--
LOCK TABLES `participate` WRITE;
/*!40000 ALTER TABLE `participate` DISABLE KEYS */;
INSERT INTO `participate` VALUES (1,1),(5,1);
/*!40000 ALTER TABLE `participate` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `user`
--
DROP TABLE IF EXISTS `user`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `user` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`Mail` varchar(128) NOT NULL,
`FullName` varchar(128) NOT NULL,
`Password` varchar(256) NOT NULL,
`RegisteredAt` datetime NOT NULL DEFAULT current_timestamp(),
`Role` enum('user','admin') DEFAULT 'user',
PRIMARY KEY (`ID`),
UNIQUE KEY `Mail` (`Mail`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `user`
--
LOCK TABLES `user` WRITE;
/*!40000 ALTER TABLE `user` DISABLE KEYS */;
INSERT INTO `user` VALUES (1,'boverhaegen@epfc.eu','Boris Verhaegen','56ce92d1de4f05017cf03d6cd514d6d1','2020-10-11 17:46:19','admin'),(2,'bepenelle@epfc.eu','Benoรฎt Penelle','56ce92d1de4f05017cf03d6cd514d6d1','2020-10-11 17:46:19','admin'),(3,'brlacroix@epfc.eu','Bruno Lacroix','56ce92d1de4f05017cf03d6cd514d6d1','2020-10-11 17:47:20','user'),(4,'xapigeolet@epfc.eu','Xavier Pigeolet','56ce92d1de4f05017cf03d6cd514d6d1','2020-10-11 17:47:20','admin'),(5,'galagaffe@epfc.eu','Gaston Lagaffe','56ce92d1de4f05017cf03d6cd514d6d1','2020-11-25 18:46:55','user');
/*!40000 ALTER TABLE `user` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2021-04-15 22:41:56
|
DROP TABLE DESVIOS;
DROP TABLE RETRASOS;
DROP TABLE VUELO;
DROP TABLE AVION;
DROP TABLE AEROLINEA;
DROP TABLE AEROPUERTO; |
ALTER TABLE `pflanzen` ADD `liefer_id` INT UNSIGNED NULL ;
|
create or replace function get_age (dob in date)
return number
is
age number(3);
begin
select months_between(sysdate,dob)/12 into age from dual;
return (age);
end;
/
select get_age('1-Jan-86') from dual; |
select * from users_new
|
-- +migrate up
ALTER TABLE "public"."room_events"
ALTER COLUMN "room_id" TYPE text;
-- +migrate down
ALTER TABLE "public"."room_events"
ALTER COLUMN "room_id" TYPE integer;
|
rename table wp_commentmeta to anyprefix_commentmeta;
rename table wp_comments to anyprefix_comments;
rename table wp_links to anyprefix_links;
rename table wp_options to anyprefix_options;
rename table wp_postmeta to anyprefix_postmeta;
rename table wp_posts to anyprefix_posts;
rename table wp_terms to anyprefix_terms;
rename table wp_term_relationships to anyprefix_term_relationships;
rename table wp_term_taxonomy to anyprefix_term_taxonomy;
rename table wp_usermeta to anyprefix_usermeta;
rename table wp_users to anyprefix_users; |
-- --------------------------------------------------------
--
-- Table structure for table `roles`
--
CREATE TABLE `roles` (
`id` int(11) UNSIGNED NOT NULL,
`title` varchar(16) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `roles`
--
INSERT INTO `roles` (`id`, `title`) VALUES
(1, 'admin'),
(4, 'customer'),
(3, 'employee'),
(2, 'manager');
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
CREATE TABLE `users` (
`id` int(11) UNSIGNED NOT NULL,
`email` varchar(64) NOT NULL,
`password` varchar(256) NOT NULL,
`name` varchar(64) NOT NULL,
`role_id` int(11) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `users`
--
INSERT INTO `users` (`id`, `email`, `password`, `name`, `role_id`) VALUES
(1, 'admin@bookworms.com', '$2y$10$9DwoD.YVzCMleCri1pRRyeRewrPbNXgG0539GiTYyQD41HwQOWYoK', 'admin', 1),
(2, 'sarah@bloggs.com', '$2y$10$5kmfqH6smlxNHUA2HSqZMuLQaz2LhAnzXdgoJzREZVBxihsHjRmly', 'Bernadette Bashirian', 4);
--
-- Indexes for dumped tables
--
--
-- Indexes for table `roles`
--
ALTER TABLE `roles`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `roles_title_unique` (`title`);
--
-- Indexes for table `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `users_email_unique` (`email`),
ADD KEY `users_role_id` (`role_id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `roles`
--
ALTER TABLE `roles`
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `users`
--
ALTER TABLE `users`
ADD CONSTRAINT `users_role_id` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`);
COMMIT; |
/* Extracts o2sat chartevent data, removing unnecessary columns to make the data file smaller */
select
chartevents.subject_id,
chartevents.hadm_id,
chartevents.icustay_id,
chartevents.charttime as charteventsCharttime,
chartevents.cgid as caregiverID,
chartevents.itemid as charteventsItemid,
chartevents.value as charteventsValue,
chartevents.valuenum as charteventsValueuom
from chartevents
where chartevents.itemid in (778, 3784, 220235, 779, 3785, 220224, 3830, 823, 3831, 4203, 646, 220277, 834); |
SELECT
project.name as projeto,
department.name as departamento
from
project
join
department
on
department.id=project.id_dep; |
DELIMITER $$
DROP procedure IF EXISTS `spLoadPasswordPolicy`;
CREATE PROCEDURE `spLoadPasswordPolicy` ()
BEGIN
SELECT * FROM PasswordValidations;
END$$
DELIMITER ; |
CREATE TABLE IF NOT EXISTS `#__encrypted` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`stuff` VARBINARY(271) DEFAULT NULL,
PRIMARY KEY (`id`)
)
ENGINE =MyISAM
AUTO_INCREMENT =0
DEFAULT CHARSET =utf8; |
TRUNCATE TABLE buildings;
|
CREATE TABLE USERS_(
ID NUMBER,
CONSTRAINT USERS_PK PRIMARY KEY(ID),
NICK NVARCHAR2(16),
PASSWORD NVARCHAR2(128),
EMAIL NVARCHAR2(128),
DATE_ TIMESTAMP,
KARMA NUMBER(9,2),
IP NVARCHAR2(20)
); |
DROP TABLE IF EXISTS PERSON;
CREATE TABLE PERSON (
ID INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(250) NOT NULL,
age INT NOT NULL
); |
๏ปฟinsert into Employee
(Designation,EmployeeName,ProjectId,Skills)
values('Developer','Raj Kumar',2,'C#,Asp.Net,MVC'),
('Mobile Developer','Ankur Verma',3,'Java, Android Studio, Xamarin'),
('Developer','Dheeraj Sharma',1,'C#,Asp.Net,MVC,AngularJS'),
('Developer','Dhramveer',2,'C#,Asp.Net,MVC,AngularJS,Node.js'),
('Mobile Developer','Shivam Kumar',1,'Java, Android Studio, Xamarin') |
-- ----------------------------
-- Records of pms_product_attribute_category
-- ----------------------------
INSERT INTO `pms_product_attribute_category` VALUES ('1', 'ๆ่ฃ
-Tๆค', '2', '5');
INSERT INTO `pms_product_attribute_category` VALUES ('2', 'ๆ่ฃ
-่ฃค่ฃ
', '2', '4');
INSERT INTO `pms_product_attribute_category` VALUES ('3', 'ๆๆบๆฐ็ -ๆๆบ้่ฎฏ', '2', '4');
INSERT INTO `pms_product_attribute_category` VALUES ('4', '้
ไปถ', '0', '0');
INSERT INTO `pms_product_attribute_category` VALUES ('5', 'ๅฑ
ๅฎถ', '0', '0');
INSERT INTO `pms_product_attribute_category` VALUES ('6', 'ๆดๆค', '0', '0');
INSERT INTO `pms_product_attribute_category` VALUES ('10', 'ๆต่ฏๅ็ฑป', '0', '0');
|
CREATE TABLE users (
id serial PRIMARY KEY,
login VARCHAR(255) UNIQUE NOT NULL,
password VARCHAR(255) NOT NULL,
status VARCHAR(255) NOT NULL
); |
select to_date(t1.min_into_pool_date) ้ฆๆฌก่ทๅๆถ้ด,
round(t1.max_score,1) ่ฏๅ็ญ็บง,
count(t1.intention_id) as ่ทๅ้,
count(case when t2.min_apply_time is not null then t1.intention_id end) as ้็บฆๆฐ,
count(case when t3.min_adjust_start_time is not null then t1.intention_id end) as ๅบๅธญๆฐ,
count(case when t4.min_pay_date is not null then t1.intention_id end) as ๆๅๆฐ
from(
select tpel.intention_id, ao.max_score, min(tpel.into_pool_date) as min_into_pool_date, s.create_time
from dw_hf_mobdb.dw_tms_pool_exchange_log tpel
left join dw_hf_mobdb.dw_view_student s on s.student_intention_id = tpel.intention_id
left join dw_hf_mobdb.dw_alb_ocleads_score_s1_hist ao on ao.student_intention_id = tpel.intention_id
inner join dt_mobdb.dt_charlie_dept_month_end cdme on cdme.user_id = tpel.track_userid
and cdme.stats_date = current_date() and cdme.class = 'CC'
where to_date(tpel.into_pool_date) >= date_sub(current_date(),60)
group by tpel.intention_id, ao.max_score, s.create_time
having to_date(s.create_time) < trunc(min(tpel.into_pool_date),'MM')
) as t1
left join (
select
lpo.student_intention_id,
min(lpo.apply_time) as min_apply_time
from dw_hf_mobdb.dw_lesson_plan_order lpo
left join dw_hf_mobdb.dw_lesson_relation lr on lpo.order_id = lr.order_id
left join dw_hf_mobdb.dw_lesson_plan lp on lr.plan_id = lp.lesson_plan_id
inner join dt_mobdb.dt_charlie_dept_month_end cdme on cdme.user_id = lpo.apply_user_id
and cdme.stats_date = current_date() and cdme.class = 'CC'
where lpo.apply_time >= date_sub(current_date(),60)
and lp.lesson_type = 2
and lp.solve_status <> 6
group by lpo.student_intention_id
) as t2 on t2.student_intention_id = t1.intention_id
and t2.min_apply_time >= t1.min_into_pool_date
left join (
select
lpo.student_intention_id,
min(lp.adjust_start_time) as min_adjust_start_time
from dw_hf_mobdb.dw_lesson_plan_order lpo
left join dw_hf_mobdb.dw_lesson_relation lr on lpo.order_id = lr.order_id
left join dw_hf_mobdb.dw_lesson_plan lp on lr.plan_id = lp.lesson_plan_id
inner join dt_mobdb.dt_charlie_dept_month_end cdme on cdme.user_id = lpo.apply_user_id
and cdme.stats_date = current_date() and cdme.class = 'CC'
where lp.status in (3,5) and lp.solve_status <> 6
and lp.lesson_type = 2
and to_date(lp.adjust_start_time) >= date_sub(current_date(),60)
group by lpo.student_intention_id
) as t3 on t3.student_intention_id = t1.intention_id and t3.min_adjust_start_time >= t1.min_into_pool_date
left join (
select
min(tcp.pay_date) min_pay_date,
max(tcp.pay_date) last_pay_date,
tcp.contract_id,
s.student_intention_id,
sum(tcp.sum)/100 real_pay_sum,
avg((tc.sum-666)*10) contract_amount
from dw_hf_mobdb.dw_view_tms_contract_payment tcp
left join dw_hf_mobdb.dw_view_tms_contract tc on tcp.contract_id = tc.contract_id
left join dw_hf_mobdb.dw_view_student s on s.student_intention_id = tc.student_intention_id
left join dw_hf_mobdb.dw_view_user_info ui on ui.user_id = tc.submit_user_id
inner join dt_mobdb.dt_charlie_dept_month_end cdme on cdme.user_id = tcp.submit_user_id
and cdme.stats_date = current_date() and cdme.class = 'CC'
where tcp.pay_status in (2,4)
and ui.account_type = 1
group by tcp.contract_id, s.student_intention_id
having round(sum(tcp.sum/100),0) >= round(avg((tc.sum-666)*10),0)
and min(tcp.pay_date) >= date_sub(current_date(),60)
) as t4 on t4.student_intention_id = t1.intention_id and t4.min_pay_date >= t1.min_into_pool_date
group by ้ฆๆฌก่ทๅๆถ้ด, ่ฏๅ็ญ็บง
order by ่ฏๅ็ญ็บง |
CREATE TABLE skills(
id INT PRIMARY KEY ,
skill VARCHAR(50) NOT NULL
);
CREATE TABLE companies(
id INT PRIMARY KEY ,
company_name VARCHAR(50) NOT NULL ,
country VARCHAR(50) NOT NULL
);
CREATE TABLE customers(
id INT PRIMARY KEY ,
name VARCHAR(50) NOT NULL
);
CREATE TABLE developers(
id INT PRIMARY KEY ,
first_name VARCHAR(50),
last_name VARCHAR(50),
company_id INT,
FOREIGN KEY (company_id) REFERENCES companies(id)
);
CREATE TABLE projects(
id INT PRIMARY KEY ,
project VARCHAR(50) NOT NULL ,
company_id INT NOT NULL ,
customer_id INT NOT NULL ,
FOREIGN KEY (company_id) REFERENCES companies(id),
FOREIGN KEY (customer_id) REFERENCES customers(id)
);
CREATE TABLE developers_skills(
developer_id INT NOT NULL ,
skill_id INT NOT NULL ,
FOREIGN KEY (developer_id) REFERENCES developers(id),
FOREIGN KEY (skill_id) REFERENCES skills(id),
UNIQUE (developer_id, skill_id)
); |
select
s_suppkey as supplier_id,
rank() over (partition by s_suppkey order by s_suppkey desc) as supplier_item_rank,
s_name,
s_address,
s_nationkey,
s_phone,
s_acctbal,
s_comment
from snowflake_sample_data.tpch_sf1.supplier
|
select * from dept
* Added Line1 * |
-- MySQL Script generated by MySQL Workbench
-- 02/21/18 05:32:04
-- Model: New Model Version: 1.0
-- MySQL Workbench Forward Engineering
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES';
-- -----------------------------------------------------
-- Schema mydb
-- -----------------------------------------------------
-- -----------------------------------------------------
-- Schema nyblecraft
-- -----------------------------------------------------
-- -----------------------------------------------------
-- Schema nyblecraft
-- -----------------------------------------------------
CREATE SCHEMA IF NOT EXISTS `nyblecraft` DEFAULT CHARACTER SET utf8 ;
USE `nyblecraft` ;
-- -----------------------------------------------------
-- Table `nyblecraft`.`user`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `nyblecraft`.`user` (
`firstName` VARCHAR(20) NOT NULL,
`lastName` VARCHAR(20) NOT NULL,
`image` LONGBLOB NULL DEFAULT NULL,
`pdf` LONGBLOB NULL DEFAULT NULL,
PRIMARY KEY (`firstName`))
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8;
SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
|
CREATE TABLE IF NOT EXISTS http_status_codes
(
status INTEGER PRIMARY KEY,
message TEXT,
FOREIGN KEY (status) REFERENCES access_log (sc_status)
);
INSERT INTO http_status_codes VALUES (100, 'Continue');
INSERT INTO http_status_codes VALUES (101, 'Switching Protocols');
INSERT INTO http_status_codes VALUES (102, 'Processing');
INSERT INTO http_status_codes VALUES (200, 'OK');
INSERT INTO http_status_codes VALUES (201, 'Created');
INSERT INTO http_status_codes VALUES (202, 'Accepted');
INSERT INTO http_status_codes VALUES (203, 'Non-Authoritative Information');
INSERT INTO http_status_codes VALUES (204, 'No Content');
INSERT INTO http_status_codes VALUES (205, 'Reset Content');
INSERT INTO http_status_codes VALUES (206, 'Partial Content');
INSERT INTO http_status_codes VALUES (207, 'Multi-Status');
INSERT INTO http_status_codes VALUES (208, 'Already Reported');
INSERT INTO http_status_codes VALUES (226, 'IM Used');
INSERT INTO http_status_codes VALUES (300, 'Multiple Choices');
INSERT INTO http_status_codes VALUES (301, 'Moved Permanently');
INSERT INTO http_status_codes VALUES (302, 'Found');
INSERT INTO http_status_codes VALUES (303, 'See Other');
INSERT INTO http_status_codes VALUES (304, 'Not Modified');
INSERT INTO http_status_codes VALUES (305, 'Use Proxy');
INSERT INTO http_status_codes VALUES (306, '(Unused)');
INSERT INTO http_status_codes VALUES (307, 'Temporary Redirect');
INSERT INTO http_status_codes VALUES (308, 'Permanent Redirect');
INSERT INTO http_status_codes VALUES (400, 'Bad Request');
INSERT INTO http_status_codes VALUES (401, 'Unauthorized');
INSERT INTO http_status_codes VALUES (402, 'Payment Required');
INSERT INTO http_status_codes VALUES (403, 'Forbidden');
INSERT INTO http_status_codes VALUES (404, 'Not Found');
INSERT INTO http_status_codes VALUES (405, 'Method Not Allowed');
INSERT INTO http_status_codes VALUES (406, 'Not Acceptable');
INSERT INTO http_status_codes VALUES (407, 'Proxy Authentication Required');
INSERT INTO http_status_codes VALUES (408, 'Request Timeout');
INSERT INTO http_status_codes VALUES (409, 'Conflict');
INSERT INTO http_status_codes VALUES (410, 'Gone');
INSERT INTO http_status_codes VALUES (411, 'Length Required');
INSERT INTO http_status_codes VALUES (412, 'Precondition Failed');
INSERT INTO http_status_codes VALUES (413, 'Payload Too Large');
INSERT INTO http_status_codes VALUES (414, 'URI Too Long');
INSERT INTO http_status_codes VALUES (415, 'Unsupported Media Type');
INSERT INTO http_status_codes VALUES (416, 'Range Not Satisfiable');
INSERT INTO http_status_codes VALUES (417, 'Expectation Failed');
INSERT INTO http_status_codes VALUES (421, 'Misdirected Request');
INSERT INTO http_status_codes VALUES (422, 'Unprocessable Entity');
INSERT INTO http_status_codes VALUES (423, 'Locked');
INSERT INTO http_status_codes VALUES (424, 'Failed Dependency');
INSERT INTO http_status_codes VALUES (426, 'Upgrade Required');
INSERT INTO http_status_codes VALUES (428, 'Precondition Required');
INSERT INTO http_status_codes VALUES (429, 'Too Many Requests');
INSERT INTO http_status_codes VALUES (431, 'Request Header Fields Too Large');
INSERT INTO http_status_codes VALUES (500, 'Internal Server Error');
INSERT INTO http_status_codes VALUES (501, 'Not Implemented');
INSERT INTO http_status_codes VALUES (502, 'Bad Gateway');
INSERT INTO http_status_codes VALUES (503, 'Service Unavailable');
INSERT INTO http_status_codes VALUES (504, 'Gateway Timeout');
INSERT INTO http_status_codes VALUES (505, 'HTTP Version Not Supported');
INSERT INTO http_status_codes VALUES (506, 'Variant Also Negotiates');
INSERT INTO http_status_codes VALUES (507, 'Insufficient Storage');
INSERT INTO http_status_codes VALUES (508, 'Loop Detected');
INSERT INTO http_status_codes VALUES (510, 'Not Extended');
INSERT INTO http_status_codes VALUES (511, 'Network Authentication Required');
CREATE TABLE lnav_example_log
(
log_line INTEGER PRIMARY KEY,
log_part TEXT COLLATE naturalnocase,
log_time DATETIME,
log_actual_time DATETIME hidden,
log_idle_msecs int,
log_level TEXT collate loglevel,
log_mark boolean,
log_comment TEXT,
log_tags TEXT,
log_filters TEXT,
ex_procname TEXT collate 'BINARY',
ex_duration INTEGER,
log_time_msecs int hidden,
log_path TEXT hidden collate naturalnocase,
log_text TEXT hidden,
log_body TEXT hidden
);
CREATE VIEW lnav_top_view AS
SELECT *
FROM lnav_views
WHERE name = (SELECT name FROM lnav_view_stack ORDER BY rowid DESC LIMIT 1);
INSERT INTO lnav_example_log
VALUES (0, NULL, '2017-02-03T04:05:06.100', '2017-02-03T04:05:06.100', 0,
'info', 0, NULL, NULL, NULL, 'hw', 2, 1486094706000, '/tmp/log',
'2017-02-03T04:05:06.100 hw(2): Hello, World!', 'Hello, World!'),
(1, NULL, '2017-02-03T04:05:06.200', '2017-02-03T04:05:06.200', 100,
'error', 0, NULL, NULL, NULL, 'gw', 4, 1486094706000, '/tmp/log',
'2017-02-03T04:05:06.200 gw(4): Goodbye, World!', 'Goodbye, World!'),
(2, 'new', '2017-02-03T04:25:06.200', '2017-02-03T04:25:06.200', 1200000,
'warn', 0, NULL, NULL, NULL, 'gw', 1, 1486095906000, '/tmp/log',
'2017-02-03T04:25:06.200 gw(1): Goodbye, World!', 'Goodbye, World!'),
(3, 'new', '2017-02-03T04:55:06.200', '2017-02-03T04:55:06.200', 1800000,
'debug', 0, NULL, NULL, NULL, 'gw', 10, 1486097706000, '/tmp/log',
'2017-02-03T04:55:06.200 gw(10): Goodbye, World!', 'Goodbye, World!');
CREATE TABLE lnav_user_notifications
(
-- A unique identifier for the notification.
id TEXT NOT NULL DEFAULT 'org.lnav.user' PRIMARY KEY,
-- The priority of this message relative to others, the highest priority
-- message will be shown in the top-right corner.
priority INTEGER NOT NULL DEFAULT 0,
-- The time when this notification was created.
created DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
-- The time when this notification is no longer applicable.
expiration DATETIME DEFAULT NULL,
-- A JSON array with the names of the views where this notification is
-- applicable. Use NULL to show it in all views.
views JSON,
-- The message to display, can be null to clear the message.
message TEXT,
CHECK (views IS NULL OR json_type(views) = 'array')
);
INSERT INTO lnav_user_notifications (id, priority, expiration, message)
VALUES ('org.lnav.breadcrumb.focus', -1, DATETIME('now', '+1 minute'),
'Press <span class="-lnav_status-styles_hotkey">`</span> to focus on the breadcrumb bar');
CREATE TABLE lnav_views_echo AS
SELECT name, top, "left", height, inner_height, top_time, search
FROM lnav_views;
CREATE UNIQUE INDEX lnav_views_echo_index ON lnav_views_echo (name);
|
CREATE DATABASE edusena;
USE edusena;
CREATE TABLE Profesores(
identificacion_prof INT PRIMARY KEY NOT NULL,
nombres_prof VARCHAR(50) NOT NULL,
apellidos_prof varchar(50) NOT NULL,
edad_prof INT NOT NULL,
direccion_prof VARCHAR(30) NOT NULL,
genero_prof VARCHAR(10) NOT NULL,
correo_prof VARCHAR(30) NOT NULL,
telefono_prof INT NOT NULL
);
CREATE TABLE Cursos(
codigo_curso INT PRIMARY KEY NOT NULL,
nombre_curso VARCHAR(30) NOT NULL,
cant_estu_curso INT NOT NULL,
id_prof_curso INT NOT NULL, FOREIGN KEY(id_prof_curso) REFERENCES profesores(identificacion_prof) ON DELETE CASCADE
);
CREATE TABLE Estudiantes(
identificacion_estu INT NOT NULL PRIMARY KEY,
nombres_estu VARCHAR(50) NOT NULL,
apellidos_estu varchar(50) NOT NULL,
edad_estu INT NOT NULL,
direccion_estu VARCHAR(30) NOT NULL,
genero_estu VARCHAR(10) NOT NULL,
correo_estu VARCHAR(30) NOT NULL,
telefono_estu INT NOT NULL,
nombre_acu_estu VARCHAR(50) NOT NULL,
telefono_acu_estu INT NOT NULL,
id_prof_estu INT NOT NULL, FOREIGN KEY(id_prof_estu ) REFERENCES Profesores(identificacion_prof) ON DELETE CASCADE ,
codigo_curso_estu INT NOT NULL, FOREIGN KEY(codigo_curso_estu) REFERENCES Cursos(codigo_curso ) ON DELETE CASCADE
);
CREATE TABLE Usuarios(
id_user INT NOT NULL PRIMARY KEY,
usuario VARCHAR(60) NOT NULL,
password_user VARCHAR(60) NOT NULL
);
SELECT estu.identificacion_estu, estu.nombres_estu, estu.apellidos_estu, estu.edad_estu, estu.direccion_estu, estu.genero_estu, estu.correo_estu, estu.telefono_estu, estu.nombre_acu_estu, estu.telefono_acu_estu, prof.nombres_prof, prof.apellidos_prof, cur.nombre_curso FROM estudiantes estu INNER JOIN profesores prof ON estu.id_prof_estu = prof.identificacion_prof INNER JOIN cursos cur ON estu.codigo_curso_estu = cur.codigo_curso ORDER BY estu.nombres_estu ;
|
set define off;
-- ACN eTS-Contracts00002771
BEGIN HARMONY.DOIT('select ''eTS-Contracts00002771'' from dual');END;
/
BEGIN HARMONY.DOIT('ALTER TABLE HARMONY.TREVIEW_BATCH ADD BATCH_TYPE_CODE VARCHAR2(100)');END; |
insert into category values(1,'CMB/LAP','2018-09-05 10:25:21','Laptops',NULL);
insert into category values(2,'CMB/OEQ','2018-06-06 11:24:37','Office Equipments',NULL);
insert into category values(3,'CMB/DEV','2018-06-06 11:24:37','Development Devices',NULL);
insert into role values(1,1,'Admin',1);
insert into role values(2,1,'user',1);
insert into role values(3,0,'developer',1);
insert into role values(4,0,'Tester',1);
insert into user values(1,1,'2018-03-09 14:13:31','bathiyat@zone24x7.com','Bathiya','Tennakoon','BathiyaT',1);
insert into user values(2,1,'2018-03-09 14:13:31','amalik@zone24x7.com','Amali','Kumuduni','AmaliK',2);
insert into user values(3,1,'2018-03-09 14:13:31','Test@zone24x7.com','Test','Test','Test',2);
insert into allocation_type values(1,'Employee');
insert into allocation_type values(2,'Project');
insert into allocation_type values(3,'Other');
insert into status values(0,'Avaliable');
insert into status values(1,'Allocated');
insert into status values(2,'Deallocated');
insert into operation values(1,'View');
insert into operation values(2,'Add');
insert into operation values(3,'Edit');
insert into operation values(4,'Allocate');
insert into operation values(5,'Dispose');
insert into operation values(6,'Delete');
insert into permission values(1,1,1,1);
insert into permission values(2,1,2,1);
insert into permission values(3,1,3,1);
insert into permission values(4,1,4,1);
insert into permission values(5,1,5,1);
insert into permission values(6,1,6,1);
insert into permission values(8,2,1,2);
insert into permission values(9,2,2,2);
insert into permission values(10,2,3,2);
insert into permission values(11,2,4,2);
insert into permission values(12,2,5,2);
insert into attr_data_type values(1,'String');
insert into attr_data_type values(2,'Integer');
insert into attr_data_type values(3,'Float');
insert into attr_data_type values(4,'Currency');
insert into attr_data_type values(5,'Date');
insert into attribute values(1,'2018-05-09 15:50:40','Office EQ Make',1,1);
insert into attribute values(2,'2018-08-31 16:15:49','Models',1,1);
insert into attribute values(3,'2018-05-09 15:50:40','Serial Number',1,1);
insert into attribute values(4,'2018-08-31 16:02:35','Description',1,1);
insert into attribute values(5,'2018-05-09 15:50:40','Purchased Date',5,1);
insert into attribute values(6,'2018-05-09 15:50:40','Location',1,1);
insert into category_attribute values(1,0,1,1);
insert into category_attribute values(2,0,2,1);
insert into category_attribute values(3,0,3,1);
insert into category_attribute values(4,0,4,1);
insert into category_attribute values(5,0,5,1);
insert into attribute_value values(1,'Panasonic',1);
insert into attribute_value values(2,'HP',1);
insert into attribute_value values(3,'Nakamichi',1);
insert into attribute_value values(4,'Logitech',1);
insert into attribute_value values(5,'Zenith',1);
insert into attribute_value values(6,'Brother',1);
insert into resource values(1,'CMB/LAP/0001','2018-05-18 17:27:20',1,0,1);
insert into resource values(2,'CMB/LAP/0002','2018-05-09 15:50:40',1,0,1);
insert into resource values(3,'CMB/LAP/0003','2018-05-09 15:50:40',2,0,2);
insert into resource_attribute values(1,'Samsung',2,1);
insert into resource values(6,'CMB/LAP/0006','2018-05-18 17:27:20',1,0,1);
insert into resource_attribute values(10,'Samsung',2,1);
insert into resource values(7,'CMB/LAP/0007','2018-05-18 17:27:20',1,1,1);
insert into resource_attribute values(11,'Dell',2,1);
insert into resourcebin values(1,'CMB/LAP/0005','2018-05-18 17:27:20','not required',1,0,1);
insert into resourcebin values(2,'CMB/OEQ/0003','2018-05-09 15:50:40','Not required',2,0,2);
insert into resourcebin_attribute values(1,'laptop',2,1);
insert into allocation values(1,'2018-09-24 17:27:20','2018-09-24',NULL,3,7,1,1);
insert into other_allocation values(2,'BathiyaT',1);
|
/*
Navicat Premium Data Transfer
Source Server : jlkj_mall
Source Server Type : MySQL
Source Server Version : 50173
Source Host : 120.27.50.31
Source Database : e_shops
Target Server Type : MySQL
Target Server Version : 50173
File Encoding : utf-8
Date: 04/29/2016 20:39:15 PM
*/
-- ----------------------------
-- Table structure for `orders`
-- ----------------------------
DROP TABLE IF EXISTS `order_sdp`;
create table order_sdp
(
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '่ชๅขไธป้ฎ',
order_id bigint(20),
distributor_id bigint(20),
primary key (id)
);
|
-- phpMyAdmin SQL Dump
-- version 4.9.0.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: May 27, 2021 at 12:18 PM
-- Server version: 10.3.16-MariaDB
-- PHP Version: 7.1.30
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: `url_shortner`
--
-- --------------------------------------------------------
--
-- Table structure for table `url`
--
CREATE TABLE `url` (
`URL_Id` int(11) NOT NULL,
`URL_LongUrl` text DEFAULT NULL,
`URL_ShortUrl` text DEFAULT NULL,
`URL_ShortCode` varchar(20) DEFAULT NULL,
`URL_AddedDate` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `url`
--
INSERT INTO `url` (`URL_Id`, `URL_LongUrl`, `URL_ShortUrl`, `URL_ShortCode`, `URL_AddedDate`) VALUES
(1, 'https://www.youtube.com/watch?v=z_9mqGnAwNc', 'http://localhost/url-shortner//rd?63bkp', '63bkp', '2021-05-27 12:06:17');
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
CREATE TABLE `users` (
`US_Id` int(11) NOT NULL,
`US_Username` varchar(50) DEFAULT NULL,
`US_Password` varchar(100) DEFAULT NULL,
`US_AddedDate` datetime NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `users`
--
INSERT INTO `users` (`US_Id`, `US_Username`, `US_Password`, `US_AddedDate`) VALUES
(1, 'admin', '21232f297a57a5a743894a0e4a801fc3', '2021-05-27 11:27:37');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `url`
--
ALTER TABLE `url`
ADD PRIMARY KEY (`URL_Id`);
--
-- Indexes for table `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`US_Id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `url`
--
ALTER TABLE `url`
MODIFY `URL_Id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
MODIFY `US_Id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
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 */;
|
-- =====================================================================================
-- ICIS Schema
-- Copyright 2005-9 International Rice Research Institute (IRRI) and
-- Centro Internacional de Mejoramiento de Maiz y Trigo (CIMMYT)
--
-- All rights reserved.
--
-- url cropwiki.irri.org/icis/
-- url cropforge.irri.org/
--
-- This script is free software; you can redistribute it and/or
-- modify it under the terms of the GNU General Public License
-- as published by the Free Software Foundation; either version 2
-- of the License, or (at your option) any later version.
--
-- This script is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this script; if not, write to the Free Software
-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-- =======================================================================================
--
-- Authors - -- MCDHabito
-- * IRRI-CIMMYT CROP RESEARCH INFORMATICS LABORATORY
-- * Generation Challenge Programme
-- Description - create the icis DMS tables (ver 5.6) / IBDB DMS v1
--
-- storage ENGINE=MyISAM DEFAULT CHARSET=utf8
--
--
-- NEW table: structure for table 'address'
--
--
DROP TABLE IF EXISTS address;
CREATE TABLE address (
addrid INT NOT NULL,
addrtab varchar(40) DEFAULT NULL,
addrrec INT NOT NULL,
addrtype INT DEFAULT NULL,
addr1 varchar(125) NOT NULL,
addr2 varchar(125) DEFAULT NULL,
cityid INT DEFAULT NULL,
stateid INT DEFAULT NULL,
cpostal varchar(10) NOT NULL,
cntryid INT NOT NULL,
aphone varchar(25) NOT NULL,
afax varchar(25) NOT NULL,
aemail varchar(255) NOT NULL,
addrstat INT DEFAULT NULL,
PRIMARY KEY (addrid)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--
-- table structure for table 'data_c'
--
DROP TABLE IF EXISTS data_c;
CREATE TABLE data_c (
ounitid INT NOT NULL DEFAULT 0,
variatid INT NOT NULL DEFAULT 0,
dvalue VARCHAR(50) NOT NULL DEFAULT '-',
PRIMARY KEY (ounitid,variatid)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--
CREATE INDEX data_c_idx01 ON data_c (ounitid);
CREATE INDEX data_c_idx02 ON data_c (variatid);
CREATE INDEX data_c_idx03 ON data_c (dvalue);
CREATE INDEX data_c_idx04 on data_c (ounitid,variatid);
--
--
-- table structure for table 'data_n'
--
DROP TABLE IF EXISTS data_n;
CREATE TABLE data_n (
ounitid INT NOT NULL DEFAULT 0,
variatid INT NOT NULL DEFAULT 0,
dvalue DOUBLE PRECISION DEFAULT 0,
PRIMARY KEY (ounitid,variatid)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--
CREATE INDEX data_n_idx01 ON data_n (ounitid);
CREATE INDEX data_n_idx02 ON data_n (variatid);
CREATE INDEX data_n_idx03 ON data_n (dvalue);
CREATE INDEX data_n_idx04 on data_c (ounitid,variatid);
--
--
-- table structure for table 'data_t'
--
DROP TABLE IF EXISTS data_t;
CREATE TABLE data_t (
ounitid INT NOT NULL DEFAULT 0,
variatid INT NOT NULL DEFAULT 0,
dvalue VARCHAR(255) NOT NULL DEFAULT '-',
PRIMARY KEY (ounitid,variatid)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--
CREATE INDEX data_t_idx01 ON data_t (ounitid);
CREATE INDEX data_t_idx02 ON data_t (variatid);
CREATE INDEX data_t_idx03 ON data_t (dvalue);
CREATE INDEX data_t_idx04 on data_c (ounitid,variatid);
--
--
-- table structure for table 'datattr'
--
DROP TABLE IF EXISTS datattr;
CREATE TABLE datattr (
dattrid INT NOT NULL DEFAULT 0,
datype INT DEFAULT 0,
datable VARCHAR(2) NOT NULL DEFAULT '-',
ounitid INT NOT NULL DEFAULT 0,
variatid INT NOT NULL DEFAULT 0,
datval VARCHAR(255) NOT NULL DEFAULT '-',
PRIMARY KEY (dattrid)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--
CREATE INDEX datattr_idx01 ON datattr (ounitid);
CREATE INDEX datattr_idx02 ON datattr (variatid);
CREATE INDEX datattr_idx03 ON datattr (dattrid);
--
--
-- table structure for table 'dmsattr'
--
DROP TABLE IF EXISTS dmsattr;
CREATE TABLE dmsattr (
dmsatid INT NOT NULL DEFAULT 0,
dmsatype INT DEFAULT 0,
dmsatab VARCHAR(10) NOT NULL DEFAULT '-',
dmsatrec INT DEFAULT 0,
dmsatval VARCHAR(255) NOT NULL DEFAULT '-',
PRIMARY KEY (dmsatid)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--
CREATE INDEX dmsattr_idx01 ON dmsattr (dmsatid);
--
--
-- table structure for table 'dudflds'
--
DROP TABLE IF EXISTS dudflds;
CREATE TABLE dudflds (
fldno INT NOT NULL DEFAULT 0,
ftable VARCHAR(24) NOT NULL DEFAULT '-',
ftype VARCHAR(12) NOT NULL DEFAULT '-',
fcode VARCHAR(8) NOT NULL DEFAULT '-',
fname VARCHAR(50) NOT NULL DEFAULT '-',
ffmt VARCHAR(255) NOT NULL DEFAULT '-',
fdesc VARCHAR(255) NOT NULL DEFAULT '-',
lfldno INT DEFAULT 0,
fuid INT DEFAULT 0,
fdate INT DEFAULT 0,
oldfldno INT DEFAULT 0,
oldfldid INT DEFAULT 0,
PRIMARY KEY (fldno)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--
CREATE INDEX dudflds_idx01 ON dudflds (fcode);
CREATE INDEX dudflds_idx02 ON dudflds (fuid);
CREATE INDEX dudflds_idx03 ON dudflds (oldfldid);
CREATE INDEX dudflds_idx04 ON dudflds (fldno);
--
--
-- table structure for table 'effect'
--
DROP TABLE IF EXISTS effect;
CREATE TABLE effect (
represno INT NOT NULL DEFAULT 0,
factorid INT NOT NULL DEFAULT 0,
effectid INT NOT NULL DEFAULT 0,
PRIMARY KEY (represno,factorid,effectid)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--
CREATE INDEX effect_idx01 ON effect (represno);
CREATE INDEX effect_idx02 ON effect (effectid);
CREATE INDEX effect_idx03 ON effect (factorid);
CREATE INDEX effect_idx04 ON effect (effectid,factorid);
CREATE INDEX effect_idx05 ON effect (effectid,represno);
CREATE INDEX effect_idx06 on effect (represno,factorid,effectid);
--
--
-- table structure for table 'factor'
--
DROP TABLE IF EXISTS factor;
CREATE TABLE factor (
labelid INT NOT NULL DEFAULT 0,
factorid INT NOT NULL DEFAULT 0,
studyid INT NOT NULL DEFAULT 0,
fname VARCHAR(50) NOT NULL DEFAULT '-',
traitid INT NOT NULL DEFAULT 0,
scaleid INT NOT NULL DEFAULT 0,
tmethid INT NOT NULL DEFAULT 0,
ltype VARCHAR(1) NOT NULL DEFAULT '-',
tid INT NOT NULL DEFAULT 0, -- new column: for use with ibfieldbook
PRIMARY KEY (labelid)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--
CREATE INDEX factor_idx01 ON factor (factorid);
CREATE INDEX factor_idx02 ON factor (studyid,fname);
CREATE INDEX factor_idx03 ON factor (traitid,scaleid,tmethid);
CREATE INDEX factor_idx04 ON factor (scaleid);
CREATE INDEX factor_idx05 ON factor (tmethid);
CREATE INDEX factor_idx06 ON factor (studyid);
CREATE INDEX factor_idx08 ON factor (traitid);
CREATE INDEX factor_idx09 ON factor (traitid,studyid);
CREATE INDEX factor_idx10 ON factor (studyid,traitid);
CREATE INDEX factor_idx11 ON factor (labelid);
--
--
-- table INSTITUT
--
-- changes from v5.5:
-- 1) columns removed: street, postbox, city, stateid, cpostal, cntryid, aphone, afax, aemail
--
DROP TABLE IF EXISTS institut;
CREATE TABLE institut (
institid INT NOT NULL DEFAULT 0,
pinsid INT default null,
insname varchar(150) default null,
insacr varchar(20) default null,
instype INT default null,
weburl varchar(255) default null, -- increase length from 60 to 255
sins INT default null,
eins INT default null,
ichange INT default null,
faocode varchar(10) default null,
inslocid INT NOT NULL DEFAULT 0,
PRIMARY KEY (institid)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--
-- CREATE INDEX institut_idx01 on institut (cntryid); -- removed
CREATE INDEX institut_idx02 on institut (faocode);
CREATE INDEX institut_idx03 on institut (institid);
CREATE INDEX institut_idx04 on institut (pinsid);
CREATE INDEX institut_idx05 on institut (inslocid);
--
--
-- table structure for table 'level_c'
--
DROP TABLE IF EXISTS level_c;
CREATE TABLE level_c (
labelid INT NOT NULL DEFAULT 0,
factorid INT NOT NULL DEFAULT 0,
levelno INT NOT NULL DEFAULT 0,
lvalue VARCHAR(255) NOT NULL DEFAULT '-',
PRIMARY KEY (labelid,factorid,levelno)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--
CREATE INDEX level_c_idx01 ON level_c (labelid);
CREATE INDEX level_c_idx02 ON level_c (factorid,levelno);
CREATE INDEX level_c_idx03 ON level_c (factorid);
CREATE INDEX level_c_idx04 ON level_c (factorid,lvalue);
CREATE INDEX level_c_idx05 ON level_c (lvalue);
CREATE INDEX level_c_idx06 ON level_c (levelno);
CREATE INDEX level_c_idx07 on level_c (labelid,levelno);
--
--
-- table structure for table 'level_n'
--
DROP TABLE IF EXISTS level_n;
CREATE TABLE level_n (
labelid INT NOT NULL DEFAULT 0,
factorid INT NOT NULL DEFAULT 0,
levelno INT NOT NULL DEFAULT 0,
lvalue DOUBLE PRECISION NOT NULL DEFAULT 0,
PRIMARY KEY (labelid,factorid,levelno)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--
CREATE INDEX level_n_idx01 ON level_n (labelid);
CREATE INDEX level_n_idx02 ON level_n (factorid,levelno);
CREATE INDEX level_n_idx03 ON level_n (factorid,lvalue);
CREATE INDEX level_n_idx04 ON level_n (factorid);
CREATE INDEX level_n_idx05 ON level_n (lvalue);
CREATE INDEX level_n_idx06 ON level_n (levelno);
CREATE INDEX level_n_idx07 ON level_n (labelid,levelno);
--
--
-- table structure for table 'level_t'
--
DROP TABLE IF EXISTS level_t;
CREATE TABLE level_t (
labelid INT NOT NULL DEFAULT 0,
factorid INT NOT NULL DEFAULT 0,
levelno INT NOT NULL DEFAULT 0,
lvalue VARCHAR(255) NOT NULL DEFAULT '-',
PRIMARY KEY (labelid,factorid,levelno)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--
CREATE INDEX level_t_idx01 ON level_t (labelid);
CREATE INDEX level_t_idx02 ON level_t (factorid,levelno);
CREATE INDEX level_t_idx03 ON level_t (factorid,lvalue);
CREATE INDEX level_t_idx04 ON level_t (factorid);
CREATE INDEX level_t_idx05 ON level_t (lvalue);
CREATE INDEX level_t_idx06 ON level_t (levelno);
CREATE INDEX level_t_idx07 ON level_t (labelid, levelno);
--
--
-- table structure for table 'levels'
--
-- new table as of v5.5 (added April 2008)
--
DROP TABLE IF EXISTS levels;
CREATE TABLE levels (
levelno INT NOT NULL DEFAULT 0,
factorid INT NOT NULL DEFAULT 0,
PRIMARY KEY (levelno)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--
CREATE INDEX levels_idx01 ON levels (factorid);
CREATE INDEX levels_idx02 on levels (levelno);
--
--
-- table structure for table 'obsunit'
--
-- new table as of v5.5 (added April 2008)
--
DROP TABLE IF EXISTS obsunit;
CREATE TABLE obsunit (
ounitid INT NOT NULL DEFAULT 0,
effectid INT NOT NULL DEFAULT 0,
PRIMARY KEY (ounitid)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--
CREATE INDEX obsunit_idx01 ON obsunit (effectid);
CREATE INDEX obsunit_idx02 ON obsunit (ounitid);
--
--
-- table structure for table 'oindex'
--
DROP TABLE IF EXISTS oindex;
CREATE TABLE oindex (
ounitid INT NOT NULL DEFAULT 0,
factorid INT NOT NULL DEFAULT 0,
levelno INT NOT NULL DEFAULT 0,
represno INT NOT NULL DEFAULT 0,
oindexid INT NOT NULL AUTO_INCREMENT PRIMARY KEY -- new column
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--
CREATE INDEX oindex_idx01 ON oindex (factorid,levelno);
CREATE INDEX oindex_idx02 ON oindex (ounitid);
CREATE INDEX oindex_idx03 ON oindex (represno,ounitid);
CREATE INDEX oindex_idx04 ON oindex (levelno);
CREATE INDEX oindex_idx05 ON oindex (ounitid,factorid);
CREATE INDEX oindex_idx06 ON oindex (factorid);
CREATE INDEX oindex_idx07 ON oindex (represno);
CREATE INDEX oindex_idx08 on oindex (ounitid,factorid,levelno,represno);
--
--
-- table structure for table 'persons'
--
DROP TABLE IF EXISTS persons;
CREATE TABLE persons (
personid INT NOT NULL DEFAULT 0,
fname VARCHAR(20) NOT NULL DEFAULT '-',
lname VARCHAR(50) NOT NULL DEFAULT '-',
ioname VARCHAR(15) NOT NULL DEFAULT '-',
institid INT NOT NULL DEFAULT 0,
ptitle VARCHAR(25) NOT NULL DEFAULT '-',
poname VARCHAR(50) NOT NULL DEFAULT '-',
plangu INT NOT NULL DEFAULT 0,
pphone VARCHAR(20) NOT NULL DEFAULT '-',
pextent VARCHAR(20) NOT NULL DEFAULT '-',
pfax VARCHAR(20) NOT NULL DEFAULT '-',
pemail VARCHAR(40) NOT NULL DEFAULT '-',
prole INT NOT NULL DEFAULT 0,
sperson INT NOT NULL DEFAULT 0,
eperson INT NOT NULL DEFAULT 0,
pstatus INT NOT NULL DEFAULT 0,
pnotes VARCHAR(255) NOT NULL DEFAULT '-',
contact VARCHAR(255) NOT NULL DEFAULT '-',
PRIMARY KEY (personid)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--
CREATE INDEX persons_idx01 ON persons (institid);
CREATE INDEX persons_idx02 ON persons (personid);
--
--
-- NEW:
-- Table structure for table 'personlist'
--
DROP TABLE IF EXISTS personlist;
CREATE TABLE personlist (
personlistid INT NOT NULL DEFAULT 0,
ownertab VARCHAR(40),
ownerrec INT,
sortorder INT,
personid INT,
personname VARCHAR(64),
pliststatus INT DEFAULT 1
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--
CREATE INDEX personlist_idx01 ON personlist(personlistid);
CREATE INDEX personlist_idx02 ON personlist(sortorder);
CREATE INDEX personlist_idx03 ON personlist(personid);
CREATE INDEX personlist_idx04 ON personlist(personname);
CREATE INDEX personlist_idx05 ON personlist(pliststatus);
--
--
-- NEW:
-- Table structure for table 'project'
--
DROP TABLE IF EXISTS project;
CREATE TABLE project (
projectid INT NOT NULL DEFAULT 0,
projectname VARCHAR(50) NOT NULL DEFAULT '-',
projecttype INT DEFAULT 0,
projectdesc VARCHAR(255) NOT NULL DEFAULT '-',
projectfundingbody INT DEFAULT 0,
projectfocusregion INT DEFAULT 0,
projectdate INT,
projectuid INT,
projectstartdate INT,
projectenddate INT,
projectlocn INT,
projectteam INT,
projectprincipal INT,
projectcoinvestigators INT,
projectref INT DEFAULT 0,
PRIMARY KEY (projectid)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--
CREATE INDEX project_idx01 ON project(projectname);
CREATE INDEX project_idx02 ON project(projectfundingbody);
CREATE INDEX project_idx03 ON project(projectfocusregion);
CREATE INDEX project_idx04 ON project(projectdesc);
--
--
-- table structure for table 'represtn'
--
-- new table as of v5.5 (added April 2008)
--
DROP TABLE IF EXISTS represtn;
CREATE TABLE represtn (
represno INT NOT NULL DEFAULT 0,
effectid INT NOT NULL DEFAULT 0,
represname VARCHAR(150) NOT NULL DEFAULT '-',
PRIMARY KEY (represno)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--
CREATE INDEX represtn_idx01 on represtn (represno);
--
--
-- table structure for table 'scale'
--
DROP TABLE IF EXISTS scale;
CREATE TABLE scale (
scaleid INT NOT NULL DEFAULT 0,
scname VARCHAR(50) NOT NULL DEFAULT '-',
traitid INT NOT NULL DEFAULT 0,
sctype VARCHAR(1) NOT NULL DEFAULT '-',
PRIMARY KEY (scaleid)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--
CREATE INDEX scale_idx01 ON scale (traitid,scname);
CREATE INDEX scale_idx02 ON scale (traitid);
CREATE INDEX scale_idx03 ON scale (scaleid);
--
--
-- table structure for table 'scalecon'
--
DROP TABLE IF EXISTS scalecon;
CREATE TABLE scalecon (
scaleid INT NOT NULL DEFAULT 0,
slevel DOUBLE PRECISION NOT NULL DEFAULT 0,
elevel DOUBLE PRECISION NOT NULL DEFAULT 0,
scaleconid INT NOT NULL AUTO_INCREMENT PRIMARY KEY -- new column
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--
CREATE INDEX scalecon_idx01 ON scalecon (scaleid);
CREATE INDEX scalecon_idx02 on scalecon (scaleid,slevel,elevel);
--
--
-- table structure for table 'scaledis'
--
DROP TABLE IF EXISTS scaledis;
CREATE TABLE scaledis (
scaleid INT NOT NULL DEFAULT 0,
`value` VARCHAR(20) NOT NULL DEFAULT '-',
valdesc VARCHAR(255) NOT NULL DEFAULT '-',
scaledisid INT NOT NULL AUTO_INCREMENT PRIMARY KEY -- new column
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--
CREATE INDEX scaledis_idx01 ON scaledis (scaleid);
CREATE INDEX scaledis_idx02 ON scaledis (scaleid,value);
--
--
--
-- table structure for table 'scaletab'
--
-- May2007: v5.4 - Rename column "sql" to "ssql": "sql" is a reserved word as of MySQL v5.0
-- May2008: v5.5 - rename column "module" to "smodule"
--
DROP TABLE IF EXISTS scaletab;
CREATE TABLE scaletab (
scaleid INT NOT NULL DEFAULT 0,
ssql VARCHAR(250) NOT NULL DEFAULT '-',
smodule VARCHAR(5) NOT NULL DEFAULT '-',
scaletabid INT NOT NULL AUTO_INCREMENT PRIMARY KEY -- new column
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--
CREATE INDEX scaletab_idx01 ON scaletab (scaleid);
--
--
-- table structure for table 'steffect'
--
-- new table as of v5.5 (added April 2008)
--
DROP TABLE IF EXISTS steffect;
CREATE TABLE steffect (
effectid INT NOT NULL DEFAULT 0,
studyid INT NOT NULL DEFAULT 0,
effectname VARCHAR(150) NOT NULL DEFAULT '-',
PRIMARY KEY (effectid,studyid)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--
CREATE INDEX steffect_idx01 ON steffect (studyid);
CREATE INDEX steffect_idx02 ON steffect (effectid);
CREATE INDEX steffect_idx03 on steffect (studyid,effectid);
--
--
-- table structure for table 'study'
--
DROP TABLE IF EXISTS study;
CREATE TABLE study (
studyid INT NOT NULL DEFAULT 0,
sname VARCHAR(50) NOT NULL DEFAULT '-',
pmkey INT NOT NULL DEFAULT 0,
title VARCHAR(255) NOT NULL DEFAULT '-',
objectiv VARCHAR(255) DEFAULT '-',
investid INT NOT NULL DEFAULT 0,
stype VARCHAR(1) DEFAULT '-',
sdate INT DEFAULT 0,
edate INT DEFAULT 0,
userid INT DEFAULT 0,
sstatus INT NOT NULL DEFAULT 1,
shierarchy INT NOT NULL DEFAULT 0,
studydate INT DEFAULT 0, -- new column: date the study was created (format: YYYYMMDD)
PRIMARY KEY (studyid)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--
CREATE INDEX study_idx01 ON study (investid);
CREATE INDEX study_idx02 ON study (pmkey);
CREATE INDEX study_idx03 ON study (sname);
CREATE INDEX study_idx04 ON study (shierarchy);
CREATE INDEX study_idx05 ON study (stype);
CREATE INDEX study_idx06 ON study (sstatus);
CREATE INDEX study_idx07 ON study (userid);
CREATE INDEX study_idx08 on study (studyid);
--
--
-- table structure for table 'tmethod'
--
DROP TABLE IF EXISTS tmethod;
CREATE TABLE tmethod (
tmethid INT NOT NULL DEFAULT 0,
tmname VARCHAR(50) NOT NULL DEFAULT '-',
traitid INT NOT NULL DEFAULT 0,
tmabbr VARCHAR(6) DEFAULT '-',
tmdesc VARCHAR(255) DEFAULT '-',
PRIMARY KEY (tmethid)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--
CREATE INDEX tmethod_idx01 ON tmethod (traitid,tmname);
CREATE INDEX tmethod_idx02 ON tmethod (traitid);
CREATE INDEX tmethod_idx03 on tmethod (tmethid);
--
--
-- table structure for table 'trait'
--
DROP TABLE IF EXISTS trait;
CREATE TABLE trait (
tid INT NOT NULL DEFAULT 0,
traitid INT NOT NULL DEFAULT 0,
trname VARCHAR(50) NOT NULL DEFAULT '-',
trabbr VARCHAR(10) DEFAULT '-', -- increase length from 8 to 10
trdesc VARCHAR(255) DEFAULT '-',
scaleid INT NOT NULL DEFAULT 0,
tmethid INT DEFAULT 0,
tnstat INT DEFAULT 0,
traitgroup VARCHAR(50) DEFAULT '-',
ontology VARCHAR(50) DEFAULT '-',
isolanguage VARCHAR(2) NOT NULL DEFAULT 'en', -- new column, indicates language used
PRIMARY KEY (tid)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--
CREATE INDEX trait_idx01 ON trait (tmethid);
CREATE INDEX trait_idx02 ON trait (scaleid);
CREATE INDEX trait_idx03 ON trait (traitid);
CREATE INDEX trait_idx04 ON trait (tid);
CREATE INDEX trait_idx05 on trait (isolanguage);
--
--
-- table structure for table 'variate'
--
DROP TABLE IF EXISTS variate;
CREATE TABLE variate (
variatid INT NOT NULL DEFAULT 0,
studyid INT NOT NULL DEFAULT 0,
vname VARCHAR(50) NOT NULL DEFAULT '-',
traitid INT NOT NULL DEFAULT 0,
scaleid INT NOT NULL DEFAULT 0,
tmethid INT NOT NULL DEFAULT 0,
dtype VARCHAR(1) NOT NULL DEFAULT '-',
vtype VARCHAR(7) NOT NULL DEFAULT '-',
tid INT NOT NULL DEFAULT 0, -- new column: for use with ibfieldbook
PRIMARY KEY (variatid)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--
CREATE INDEX variate_idx01 ON variate (studyid,vname);
CREATE INDEX variate_idx02 ON variate (traitid,scaleid,tmethid);
CREATE INDEX variate_idx03 ON variate (scaleid);
CREATE INDEX variate_idx04 ON variate (studyid);
CREATE INDEX variate_idx05 ON variate (traitid,studyid);
CREATE INDEX variate_idx06 ON variate (tmethid);
CREATE INDEX variate_idx07 ON variate (traitid);
CREATE INDEX variate_idx08 ON variate (vname);
CREATE INDEX variate_idx09 ON variate (studyid,traitid);
CREATE INDEX variate_idx10 ON variate (variatid);
--
--
-- table structure for table 'veffect'
--
DROP TABLE IF EXISTS veffect;
CREATE TABLE veffect (
represno INT NOT NULL DEFAULT 0,
variatid INT NOT NULL DEFAULT 0,
PRIMARY KEY (represno,variatid)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--
CREATE INDEX veffect_idx01 ON veffect (represno);
CREATE INDEX veffect_idx02 ON veffect (variatid);
CREATE INDEX veffect_idx03 ON veffect (represno,variatid);
--
--
-- Table structure for table 'grplevel'
-- (for grouping/limiting user access rights)
--
DROP TABLE IF EXISTS grplevel;
CREATE TABLE grplevel (
levelid INT NOT NULL DEFAULT 0,
leveldesc VARCHAR(100) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--
CREATE INDEX grplevel_idx01 on grplevel (levelid);
--
--
-- Table structure for table 'grpuser'
-- (for grouping/limiting user access rights)
--
DROP TABLE IF EXISTS grpuser;
CREATE TABLE grpuser (
userid INT NOT NULL DEFAULT 0,
levelid INT NOT NULL DEFAULT 0,
valueid INT NOT NULL DEFAULT 0
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--
CREATE INDEX grpuser_idx01 on grpuser (userid);
CREATE INDEX grpuser_idx02 on grpuser (userid,levelid);
CREATE INDEX grpuser_idx03 on grpuser (levelid,valueid);
--
--
-- Table structure for table 'grplevelval'
-- (for grouping/limiting user access rights)
--
DROP TABLE IF EXISTS grplevelval;
CREATE TABLE grplevelval (
valueid INT NOT NULL DEFAULT 0,
valueabbr VARCHAR(15) DEFAULT NULL,
valuename VARCHAR(50) DEFAULT NULL,
valuedesc VARCHAR(100) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--
CREATE INDEX grplevelval_idx01 on grplevelval (valueid);
CREATE INDEX grplevelval_idx02 on grplevelval (valueabbr);
CREATE INDEX grplevelval_idx03 on grplevelval (valuename);
--
|
DROP TABLE IF EXISTS `currencies`;
CREATE TABLE `currencies` (
`id` int(4) UNSIGNED ZEROFILL NOT NULL AUTO_INCREMENT COMMENT 'Currency id',
`name` varchar(16) DEFAULT NULL COMMENT 'Currency Name',
`symbol` char(8) DEFAULT NULL COMMENT 'Currency Symbol',
`rounding` decimal(7,6) unsigned NOT NULL DEFAULT '0.00' COMMENT 'Rounding',
`is_active` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'Status',
`position` varchar(6) DEFAULT 'after' COMMENT 'Position',
`currency_unit_label` varchar(16) DEFAULT NULL COMMENT 'Currency Label',
`currency_subunit_label` varchar(16) DEFAULT NULL COMMENT 'Currency Label',
`created` datetime DEFAULT CURRENT_TIMESTAMP COMMENT 'record modify date',
`modified` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'record create date',
`created_by` int(8) UNSIGNED ZEROFILL,
`modified_by` int(8) UNSIGNED ZEROFILL,
PRIMARY KEY (`id`),
UNIQUE KEY `UNQ_CURRENCY_NAME_SYMBOL` (`name`,`symbol`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='Currency';
DROP TABLE IF EXISTS `crypto_currencies`;
CREATE TABLE `crypto_currencies` (
`id` int(4) UNSIGNED ZEROFILL NOT NULL AUTO_INCREMENT COMMENT 'Currency id',
`name` varchar(16) DEFAULT NULL COMMENT 'Currency Name',
`symbol` char(8) DEFAULT NULL COMMENT 'Currency Symbol',
`rounding` decimal(7,6) unsigned NOT NULL DEFAULT '0.00' COMMENT 'Rounding',
`is_active` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'Status',
`position` varchar(6) DEFAULT 'after' COMMENT 'Position',
`currency_unit_label` varchar(16) DEFAULT NULL COMMENT 'Currency Label',
`currency_unit_tag` varchar(16) DEFAULT NULL COMMENT 'Currency Category (coins, points, point values, reward points)',
`created` datetime DEFAULT CURRENT_TIMESTAMP COMMENT 'record modify date',
`modified` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'record create date',
`created_by` int(8) UNSIGNED ZEROFILL,
`modified_by` int(8) UNSIGNED ZEROFILL,
PRIMARY KEY (`id`),
UNIQUE KEY `UNQ_CRYPTO_NAME_SYMBOL` (`name`,`symbol`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COMMENT='Crypto Currency';
REPLACE INTO `crypto_currencies` (`id`, `name`, `symbol`, `rounding`, `is_active`, `position`, `currency_unit_label`, `currency_unit_tag`, `created`, `modified`, `created_by`, `modified_by`)
VALUES ('1', 'PV', 'แฉแณ', '0.000001', '1', 'after', 'Varatto', 'reward points', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, NULL, NULL);
REPLACE INTO `crypto_currencies` (`id`, `name`, `symbol`, `rounding`, `is_active`, `position`, `currency_unit_label`, `currency_unit_tag`, `created`, `modified`, `created_by`, `modified_by`)
VALUES ('2', 'NU', 'แจแณ', '0.000001', '1', 'after', 'Nutracoin', 'coins', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, NULL, NULL);
REPLACE INTO `crypto_currencies` (`id`, `name`, `symbol`, `rounding`, `is_active`, `position`, `currency_unit_label`, `currency_unit_tag`, `created`, `modified`, `created_by`, `modified_by`)
VALUES ('3', 'ETH', 'ฮ', '0.000001', '1', 'before', 'Ethereum', 'coins', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, NULL, NULL);
REPLACE INTO `crypto_currencies` (`id`, `name`, `symbol`, `rounding`, `is_active`, `position`, `currency_unit_label`, `currency_unit_tag`, `created`, `modified`, `created_by`, `modified_by`)
VALUES ('4', 'BTC', 'โฟ', '0.000001', '0', 'before', 'Bitcoin', 'coins', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, NULL, NULL);
REPLACE INTO `crypto_currencies` (`id`, `name`, `symbol`, `rounding`, `is_active`, `position`, `currency_unit_label`, `currency_unit_tag`, `created`, `modified`, `created_by`, `modified_by`)
VALUES ('5', 'LTC', 'ล', '0.000001', '0', 'after', 'Litecoin', 'coins', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, NULL, NULL);
DROP TABLE IF EXISTS `crypto_currency_rates`;
CREATE TABLE `crypto_currency_rates` (
`id` int(4) UNSIGNED ZEROFILL NOT NULL AUTO_INCREMENT COMMENT 'id',
`crypto_currency_id` int(4) UNSIGNED ZEROFILL COMMENT 'Currency id',
`crypto_currency_name` varchar(16) DEFAULT NULL COMMENT 'Currency Name',
`symbol` char(8) DEFAULT NULL COMMENT 'Currency Symbol',
`price` decimal(12,6) unsigned NOT NULL DEFAULT '0.00' COMMENT 'Price',
`market_capitalization` decimal(18,6) unsigned NOT NULL DEFAULT '0.00' COMMENT 'Market Capitalization',
`circulating_supply` decimal(18,6) unsigned NOT NULL DEFAULT '0.00' COMMENT 'Circulating Supply',
`volume` decimal(12,0) unsigned NOT NULL DEFAULT '0.00' COMMENT 'Volume',
`currency_id` int(4) UNSIGNED ZEROFILL COMMENT 'default currency is in USD',
`currency_name` varchar(16) DEFAULT NULL COMMENT 'Currency Name',
`created` datetime DEFAULT CURRENT_TIMESTAMP COMMENT 'record modify date',
`modified` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'record create date',
`created_by` int(8) UNSIGNED ZEROFILL,
`modified_by` int(8) UNSIGNED ZEROFILL,
PRIMARY KEY (`id`),
UNIQUE KEY `UNQ_CRYPTO_RATE_ID` (`crypto_currency_id`, `currency_id`),
UNIQUE KEY `UNQ_CRYPTO_RATE_NAME_SYMBOL` (`crypto_currency_name`,`symbol`,`currency_name`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COMMENT='Crypto Currency Rates';
|
CREATE TABLE IF NOT EXISTS `ticket` (
`ticket_id` int(11) NOT NULL auto_increment,
`booking_date` datetime NOT NULL,
`dest_station` varchar(255) NOT NULL,
`email` varchar(255) default NULL,
`passenger_name` varchar(255) NOT NULL,
`source_station` varchar(255) NOT NULL,
PRIMARY KEY (`ticket_id`)
) ;
|
-- phpMyAdmin SQL Dump
-- version 4.5.1
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: Mar 07, 2016 at 08:51 AM
-- Server version: 10.1.8-MariaDB
-- PHP Version: 5.6.14
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `proyektingkat2`
--
-- --------------------------------------------------------
--
-- Table structure for table `admin`
--
CREATE TABLE `admin` (
`Nama` varchar(30) NOT NULL,
`Username` varchar(30) NOT NULL,
`Password` varchar(30) NOT NULL,
`Telepon` varchar(30) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `admin`
--
INSERT INTO `admin` (`Nama`, `Username`, `Password`, `Telepon`) VALUES
('derry', 'admin', 'admin', '085726567333');
-- --------------------------------------------------------
--
-- Table structure for table `artist`
--
CREATE TABLE `artist` (
`Nama` varchar(30) NOT NULL,
`Username` varchar(30) NOT NULL,
`Password` varchar(30) NOT NULL,
`Telepon` varchar(30) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `artist`
--
INSERT INTO `artist` (`Nama`, `Username`, `Password`, `Telepon`) VALUES
('widy', 'artist3', 'artist3', '0865432132456'),
('derry', 'derryza', 'derryza', 'derryza'),
('fdff', 'dsfds', 'dsfdsf', 'fdsf'),
('erg', 'erg', 'er', 'eg'),
('neg', 'fgbr', 'rbt', 'reg'),
('dfsfsdf', 'gfnfnfg', 'werewr', '53434634'),
('dfsdf', 'sfdfsd', 'fsdf', 'sfsdf'),
('fff', 'vfhj', 'fhj', 'ggh');
-- --------------------------------------------------------
--
-- Table structure for table `member`
--
CREATE TABLE `member` (
`Nama` varchar(30) NOT NULL,
`Username` varchar(30) DEFAULT NULL,
`Password` varchar(30) NOT NULL,
`Telepon` varchar(30) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `member`
--
INSERT INTO `member` (`Nama`, `Username`, `Password`, `Telepon`) VALUES
('peter', 'member', 'member', '194916469248');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `admin`
--
ALTER TABLE `admin`
ADD PRIMARY KEY (`Username`);
--
-- Indexes for table `artist`
--
ALTER TABLE `artist`
ADD PRIMARY KEY (`Username`);
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
set echo off newpage 0 space 0 pagesize 32767 feed off head off underline off trimspool on termout off linesize 4000
--------------------------------------------------------
-- DDL for Table USER_HISTORY
--------------------------------------------------------
CREATE TABLE "BBPORTAL"."USER_HISTORY"
( "ID" NUMBER(19,0),
"UUID" NUMBER(19,0),
"TIME" TIMESTAMP (6),
"EVENT" NUMBER,
"FIELD" NUMBER,
"OLDVAL" VARCHAR2(4000 BYTE),
"NEWVAL" VARCHAR2(4000 BYTE),
"REFID" VARCHAR2(255 CHAR)
) SEGMENT CREATION IMMEDIATE
PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
NOCOMPRESS LOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
TABLESPACE "BLAWDATA" ;
--------------------------------------------------------
-- DDL for Index USER_HISTORY_PK
--------------------------------------------------------
CREATE UNIQUE INDEX "BBPORTAL"."USER_HISTORY_PK" ON "BBPORTAL"."USER_HISTORY" ("ID")
PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
TABLESPACE "BLAWDATA" ;
--------------------------------------------------------
-- Constraints for Table USER_HISTORY
--------------------------------------------------------
ALTER TABLE "BBPORTAL"."USER_HISTORY" MODIFY ("ID" NOT NULL ENABLE);
ALTER TABLE "BBPORTAL"."USER_HISTORY" ADD CONSTRAINT "USER_HISTORY_PK" PRIMARY KEY ("ID")
USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
TABLESPACE "BLAWDATA" ENABLE;
QUIT;
|
update "HET_LOCAL_AREA" set "CONCURRENCY_CONTROL_NUMBER" = "CONCURRENCY_CONTROL_NUMBER" + 1, "END_DATE" = now() where "NAME" = 'Un-Assigned';
insert into "HET_ROLLOVER_PROGRESS"
select a."DISTRICT_ID", null
from "HET_DISTRICT" a
where not exists (select 1
from "HET_ROLLOVER_PROGRESS" b
where b."DISTRICT_ID" = a."DISTRICT_ID");
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.