text
stringlengths
6
9.38M
-- Add two new fields to job table to support parameter/accu stacks: ALTER TABLE job ADD COLUMN param_id_stack CHAR(64) NOT NULL DEFAULT '' AFTER input_id; ALTER TABLE job ADD COLUMN accu_id_stack CHAR(64) NOT NULL DEFAULT '' AFTER param_id_stack; -- Extend the unique constraint to include both new fields: ALTER TABLE job DROP KEY input_id_analysis; ALTER TABLE job ADD UNIQUE KEY input_id_stacks_analysis (input_id, param_id_stack, accu_id_stack, analysis_id); -- UPDATE hive_sql_schema_version UPDATE hive_meta SET meta_value=52 WHERE meta_key='hive_sql_schema_version' AND meta_value='51';
delete from t_job; delete from t_job_allowance; delete from t_job_benefit; delete from t_job_feature; delete from t_job_language_level; delete from t_job_license; delete from t_job_nationality; delete from t_job_skill; delete from t_job_target_office; delete from t_job_workplace; delete from t_matching; delete from t_matching_step; delete from t_matching_finalize; delete from t_matching_step_finalize; delete from m_company; delete from m_company_client; delete from m_company_contract; delete from m_company_industry; delete from m_candidate; delete from t_resume; delete from t_resume_career; delete from t_resume_industry; delete from t_resume_language_level; delete from t_resume_license; delete from t_resume_skill; delete from t_resume_type_position; delete from t_resume_workplace; delete from t_resume_school; delete from t_file; delete from t_file_string; delete from t_sales; delete from t_sales_detail; delete from t_sales_slip; delete from t_sales_slip_detail; delete from t_journal; delete from t_journal_detail; delete from t_sales_slip_file;
CREATE TABLE IF NOT EXISTS user_owner_mapping ( owner_id bigint UNIQUE, oidc_username varchar(512) UNIQUE, CONSTRAINT user_owner_mapping_fk_owner FOREIGN KEY (owner_id) REFERENCES owner (id) )
select * from mydb.photo_post where description like '%hello%';
DROP TABLE equipo CASCADE CONSTRAINTS; DROP TABLE jornada CASCADE CONSTRAINTS; DROP TABLE jugador CASCADE CONSTRAINTS; DROP TABLE liga CASCADE CONSTRAINTS; DROP TABLE partido CASCADE CONSTRAINTS; DROP TABLE presidente CASCADE CONSTRAINTS; DROP TABLE usuario CASCADE CONSTRAINTS; CREATE TABLE equipo ( id_equipo NUMBER GENERATED ALWAYS AS IDENTITY, nombre VARCHAR2(20 CHAR) NOT NULL, presupuesto INTEGER NOT NULL, puntos INTEGER NOT NULL ); ALTER TABLE equipo ADD CONSTRAINT equipo_pk PRIMARY KEY ( id_equipo ); CREATE TABLE jornada ( id_jornada NUMBER GENERATED ALWAYS AS IDENTITY, fecha_inicio DATE NOT NULL, fecha_fin DATE NOT NULL, liga_id_liga INTEGER NOT NULL ); ALTER TABLE jornada ADD CONSTRAINT jornada_pk PRIMARY KEY ( id_jornada ); CREATE TABLE jugador ( id_jugador NUMBER GENERATED ALWAYS AS IDENTITY, nombre VARCHAR2(20 CHAR) NOT NULL, apellido VARCHAR2(20 CHAR) NOT NULL, nickname VARCHAR2(20 CHAR) NOT NULL, posicion VARCHAR2(20 CHAR) NOT NULL, sueldo INTEGER NOT NULL, titularidad CHAR(1) NOT NULL, equipo_id_equipo INTEGER NOT NULL ); ALTER TABLE jugador ADD CONSTRAINT jugador_pk PRIMARY KEY ( id_jugador ); CREATE TABLE liga ( id_liga NUMBER(2), nombre VARCHAR2(20 CHAR) NOT NULL, fecha_inicio DATE NOT NULL, fecha_fin DATE, en_curso CHAR(1) NOT NULL ); ALTER TABLE liga ADD CONSTRAINT liga_pk PRIMARY KEY ( id_liga ); CREATE TABLE partido ( equipo_id_equipo INTEGER NOT NULL, jornada_id_jornada INTEGER NOT NULL, equipo_visitante INTEGER NOT NULL, vencedor INTEGER, tipo CHAR(1), fecha_inicio DATE, fecha_fin DATE, kills_equipo_local INTEGER, kills_equipo_visitante INTEGER, oro_equipo_local INTEGER, oro_equipo_visitante INTEGER ); ALTER TABLE partido ADD CONSTRAINT partido_pk PRIMARY KEY ( equipo_id_equipo,jornada_id_jornada ); CREATE TABLE presidente ( id_presidente NUMBER GENERATED ALWAYS AS IDENTITY, nombre VARCHAR2(20 CHAR) NOT NULL, apellido VARCHAR2(20 CHAR) NOT NULL, equipo_id_equipo INTEGER NOT NULL ); ALTER TABLE presidente ADD CONSTRAINT presidente_pk PRIMARY KEY ( id_presidente ); CREATE TABLE usuario ( id_usuario NUMBER GENERATED ALWAYS AS IDENTITY, nombre VARCHAR2(20 CHAR) NOT NULL, password VARCHAR2(20 CHAR) NOT NULL, tipo VARCHAR2(20 CHAR) NOT NULL ); ALTER TABLE usuario ADD CONSTRAINT usuario_pk PRIMARY KEY ( id_usuario ); ALTER TABLE jornada ADD CONSTRAINT jornada_liga_fk FOREIGN KEY ( liga_id_liga ) REFERENCES liga ( id_liga ); ALTER TABLE jugador ADD CONSTRAINT jugador_equipo_fk FOREIGN KEY ( equipo_id_equipo ) REFERENCES equipo ( id_equipo ); ALTER TABLE partido ADD CONSTRAINT partido_equipo_fk FOREIGN KEY ( equipo_id_equipo ) REFERENCES equipo ( id_equipo ); ALTER TABLE partido ADD CONSTRAINT partido_jornada_fk FOREIGN KEY ( jornada_id_jornada ) REFERENCES jornada ( id_jornada ); ALTER TABLE presidente ADD CONSTRAINT presidente_equipo_fk FOREIGN KEY ( equipo_id_equipo ) REFERENCES equipo ( id_equipo ); --TRIGGERS --TRIGGER MUTANTE JUGADOR CREATE OR REPLACE TRIGGER TRIGGER_MUTANTE_JUGADOR AFTER INSERT OR UPDATE ON JUGADOR FOR EACH ROW BEGIN PAQUETE_MUTANTE.TITULARIDAD_NEW := :NEW.TITULARIDAD; PAQUETE_MUTANTE.TITULARIDAD_OLD := :OLD.TITULARIDAD; PAQUETE_MUTANTE.CODIGOEQUIPO := :NEW.EQUIPO_ID_EQUIPO; PAQUETE_MUTANTE.SUELDOJUGADOR := :NEW.SUELDO; PAQUETE_MUTANTE.SUELDOJUGADOR_OLD := :OLD.SUELDO; END; / --TRIGGER MUTANTE EQUIPO CREATE OR REPLACE TRIGGER TRIGGER_MUTANTE_EQUIPO AFTER INSERT OR UPDATE ON EQUIPO FOR EACH ROW BEGIN PAQUETE_MUTANTE.PRESUPUESTOEQUIPO := :NEW.PRESUPUESTO; END; / CREATE OR REPLACE TRIGGER TRIGGER_5_TITULARES AFTER INSERT OR UPDATE ON JUGADOR --ES MUTANTE DECLARE v_num_titulares NUMBER(2); BEGIN SELECT COUNT(*) INTO v_num_titulares FROM JUGADOR WHERE titularidad = 1 AND equipo_id_equipo = PAQUETE_MUTANTE.CODIGOEQUIPO; IF INSERTING THEN IF(v_num_titulares > 5 AND PAQUETE_MUTANTE.TITULARIDAD_NEW = 1) THEN RAISE_APPLICATION_ERROR(-20008, 'Solo puede haber 5 titulares en la plantilla'); END IF; ELSIF UPDATING THEN IF(v_num_titulares = 5 AND PAQUETE_MUTANTE.TITULARIDAD_OLD = 0 AND PAQUETE_MUTANTE.TITULARIDAD_NEW = 1) THEN RAISE_APPLICATION_ERROR(-20008, 'Solo puede haber 5 titulares en la plantilla'); END IF; END IF; END TRIGGER_5_TITULARES; / CREATE OR REPLACE TRIGGER TRIGGER_EQU_PRES_MEN_SAL_JUG BEFORE UPDATE ON EQUIPO FOR EACH ROW DECLARE v_sueldo_total_jug NUMBER(9); BEGIN SELECT SUM(SUELDO) INTO v_sueldo_total_jug FROM JUGADOR WHERE EQUIPO_ID_EQUIPO = :new.ID_EQUIPO; IF(v_sueldo_total_jug > :new.presupuesto) THEN RAISE_APPLICATION_ERROR(-20009, 'El equipo no tiene suficiente prespuesto como para pagar a sus jugadores'); END IF; END TRIGGER_EQU_PRES_MEN_SAL_JUG; / CREATE OR REPLACE TRIGGER TRIGGER_PRES_EQ_MEN_SAL_JUG AFTER INSERT OR UPDATE ON JUGADOR --ES MUTANTE DECLARE v_sueldo_total_jug NUMBER(9); v_presupuesto_equipo equipo.presupuesto%TYPE; BEGIN SELECT SUM(SUELDO) INTO v_sueldo_total_jug FROM JUGADOR WHERE EQUIPO_ID_EQUIPO = PAQUETE_MUTANTE.CODIGOEQUIPO; SELECT PRESUPUESTO INTO v_presupuesto_equipo FROM EQUIPO WHERE ID_EQUIPO = PAQUETE_MUTANTE.CODIGOEQUIPO; IF INSERTING THEN IF(v_sueldo_total_jug + PAQUETE_MUTANTE.SUELDOJUGADOR > v_presupuesto_equipo) THEN RAISE_APPLICATION_ERROR(-20009, 'El equipo no tiene suficiente prespuesto como para pagar a este jugador'); END IF; ELSIF UPDATING THEN IF(v_sueldo_total_jug - PAQUETE_MUTANTE.SUELDOJUGADOR_OLD + PAQUETE_MUTANTE.SUELDOJUGADOR > v_presupuesto_equipo) THEN RAISE_APPLICATION_ERROR(-20009, 'El equipo no tiene suficiente prespuesto como para pagar a este jugador'); END IF; END IF; EXCEPTION WHEN NO_DATA_FOUND THEN v_sueldo_total_jug := 0; END TRIGGER_PRES_EQ_MEN_SAL_JUG; / CREATE OR REPLACE TRIGGER BLOQUEO_CRUD_EQUIPO BEFORE INSERT OR UPDATE OF ID_EQUIPO, NOMBRE, PRESUPUESTO OR DELETE ON EQUIPO DECLARE v_num_jornadas NUMBER(2); BEGIN SELECT COUNT(*) INTO v_num_jornadas FROM JORNADA; --Almacenamos el numero de jornadas en una variable IF(v_num_jornadas != 0) THEN --Si el numero de jornadas no es 0 quiere decir que el calendario ya se ha creado por lo que no pueden modificarse los equipos. RAISE_APPLICATION_ERROR(-20004, 'No puedes modificar los equipos una vez generado el calendario'); END IF; END BLOQUEO_CRUD_EQUIPO; / CREATE OR REPLACE TRIGGER BLOQUEO_CRUD_JUGADOR BEFORE INSERT OR UPDATE OF ID_JUGADOR, NOMBRE, APELLIDO, NICKNAME, SUELDO, EQUIPO_ID_EQUIPO OR DELETE ON JUGADOR DECLARE v_num_jornadas NUMBER(2); BEGIN SELECT COUNT(*) INTO v_num_jornadas FROM JORNADA; --Almacenamos el numero de jornadas en una variable IF(v_num_jornadas != 0) THEN --Si el numero de jornadas no es 0 quiere decir que el calendario ya se ha creado por lo que no pueden modificarse los equipos. RAISE_APPLICATION_ERROR(-20004, 'No puedes modificar los jugadores una vez generado el calendario'); END IF; END BLOQUEO_CRUD_JUGADOR; / CREATE OR REPLACE TRIGGER GEN_CALENDAR_MIN_JUGADOR BEFORE INSERT ON JORNADA FOR EACH ROW DECLARE v_count_jugador NUMBER(3); v_num_equipos NUMBER(2); v_id_equipo NUMBER(2):= 1; v_num_jornada NUMBER(2); BEGIN SELECT COUNT(*) INTO v_num_jornada FROM jornada;--Select para coger el numero de jornadas IF (v_num_jornada = 0) THEN --Dado que vamos a crear todas las jornadas a la vez (a través de un script) solo necesitamos comprobar el numero de jugadores por equipo al insertar la primera jornada. --Una vez insertada la primera los requisitos de jugadores por equipo se van a cumplir por lo que no hace falta volver a disparar el trigger. SELECT COUNT(*) INTO v_num_equipos --Select para coger la cantidad de equipos FROM equipo; WHILE v_id_equipo <= v_num_equipos LOOP --loop para saber cuantos jugadores hay por cada equipo y aplicar la restriccion SELECT COUNT(*) INTO v_count_jugador FROM jugador WHERE equipo_id_equipo = (v_id_equipo); -- Select para coger la cantidad de jugadores por cada equipo IF (v_count_jugador < 2) THEN RAISE_APPLICATION_ERROR(-20003,'Los equipos tienen que tener minimo dos jugadores'); END IF; v_id_equipo := v_id_equipo + 1; END LOOP; END IF; END; / CREATE OR REPLACE TRIGGER TRIGGER_LIGA_NO_JUGADORES BEFORE UPDATE ON LIGA DECLARE v_count_equipos NUMBER(2); v_id_equipo NUMBER(2) := 1;--v_id_equipo es la variable que se incrementa para avanzar en el loop v_estado_liga liga.en_curso%TYPE; v_count_jugadores NUMBER(2); BEGIN SELECT en_curso INTO v_estado_liga FROM liga; --Almacenamos el estado de la liga (boolean en_curso) IF(v_estado_liga = 0) THEN --Si la liga no ha comenzado ejecutamos lo siguiente SELECT COUNT(*) INTO v_count_equipos FROM EQUIPO; --Almacenamos los equipos que hay WHILE v_id_equipo <= v_count_equipos LOOP --Iteramos a través de todos los equipos para determinar si algun equipo está vacío. SELECT COUNT(*) INTO v_count_jugadores --Almacenamos el numero de jugadores de cada equipo FROM JUGADOR WHERE equipo_id_equipo = v_id_equipo; IF(v_count_jugadores = 0) THEN RAISE_APPLICATION_ERROR(-20005, 'No se puede comenzar la liga con equipos sin jugadores'); END IF; v_id_equipo := v_id_equipo + 1; END LOOP; END IF; END TRIGGER_LIGA_NO_JUGADORES; / CREATE OR REPLACE TRIGGER MAX_JUGADOR AFTER INSERT OR UPDATE ON JUGADOR --ES MUTANTE DECLARE v_max_jugadores NUMBER(1) := 6; v_count_jugadores NUMBER(3); BEGIN SELECT COUNT(*) AS "NUMERO JUGADORES" INTO v_count_jugadores FROM jugador WHERE equipo_id_equipo = (PAQUETE_MUTANTE.CODIGOEQUIPO); IF(v_count_jugadores > v_max_jugadores) THEN raise_application_error(-20000, 'El numero de jugadores por equipo no puede ser superior a 6'); END IF; END MAX_JUGADOR; / CREATE OR REPLACE TRIGGER MAX_PRESUPUESTO_EQUIPO AFTER INSERT OR UPDATE ON EQUIPO DECLARE v_max_presupuesto NUMBER(6) := 200000; BEGIN IF(PAQUETE_MUTANTE.PRESUPUESTOEQUIPO >= v_max_presupuesto) THEN raise_application_error(-20002, 'El presupuesto del equipo no puede ser superior a 200k'); END IF; END MAX_PRESUPUESTO_EQUIPO; / CREATE OR REPLACE TRIGGER SALARIO_MIN_JUGADOR BEFORE INSERT OR UPDATE ON JUGADOR FOR EACH ROW DECLARE v_smi NUMBER(4) := 900; BEGIN IF(:NEW.SUELDO <= v_smi) THEN raise_application_error(-20001, 'El salario del jugador debe ser superior al SMI'); END IF; END SALARIO_MIN_JUGADOR; / CREATE OR REPLACE VIEW vista_estadisticas AS SELECT FECHA_INICIO "HORA INICIO", ROUND(FECHA_FIN - FECHA_INICIO, 2)*1440 "TIEMPO PARTIDA", KILLS_EQUIPO_LOCAL, KILLS_EQUIPO_VISITANTE, ORO_EQUIPO_LOCAL, ORO_EQUIPO_VISITANTE FROM PARTIDO;
CREATE OR REPLACE FUNCTION edad_actual( fecha_naci IN DATE ) RETURN NUMBER IS edad number(3):=0; BEGIN edad:= trunc( ( to_number( to_char(sysdate,'yyyymmdd') ) - to_number( to_char( fecha_naci,'yyyymmdd' ) ) ) / 10000 ); return edad; EXCEPTION WHEN OTHERS THEN edad:=0; RETURN edad; END; / -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- SELECT fechanaci, edad_actual( fechanaci ), sysdate FROM EMPLEADOS WHERE edad_actual( fechanaci ) >= 35;
-- Part 1: Create Client Tables create table back_office.stage_clients ( ClientID string, Name string, Symbol string, LastSale string, MarketCapLabel string, MarketCapAmount string, IPOyear string, Sector string, industry string, SummaryQuote string ) row format serde 'com.bizo.hive.serde.csv.CSVSerde' WITH SERDEPROPERTIES ( "separatorChar" = ",", "quoteChar" = '"', "escapeChar" = "\\" ) location '/data/clients/' tblproperties('serialization.null.format'=''); -- Part 2: Add data types for clients table create table back_office.cleansed_clients ( ClientID int, Name string, Symbol string, LastSale double, MarketCapLabel string, MarketCapAmount bigint, IPOyear int, Sector string, industry string, SummaryQuote string ) -- Part 3: Load cleansed_clients insert into back_office.cleansed_clients select cast(ClientID as int) as ClientID, Name, Symbol, LastSale, MarketCapLabel, cast(MarketCapAmount as bigint) as MarketCapAmount, cast(IPOyear as int) as IPOyear, Sector string, industry string, SummaryQuote string from back_office.stage_clients -- Part 4: Update sales table with clientIDs insert overwrite table back_office.cleansed_sales select RowID, c.ClientID, OrderID, OrderDate, OrderMonthYear, Quantity, Quote, DiscountPct, Rate, SaleAmount, CustomerName, CompanyName, s.Sector, s.Industry, City, ZipCode, State, Region, ProjectCompleteDate, DaysToComplete, ProductKey, ProductCategory, ProductSubCategory, Consultant, Manager, HourlyWage, RowCount, WageMargin from back_office.cleansed_sales s left join back_office.cleansed_clients c on s.companyname = c.name;
select distinct se.FilingId, se.CIK, se.FormType, sr.FileSize, se.CompanyName from GlobalDocumentData..SECEdgar as se left join GlobalDocumentData..CIKCategory as cc on se.CIK=cc.CIK left join GlobalDocumentData..SECFilingRSS as sr on se.Accession=sr.Accession where cc.Category=2 and se.FileDate>='2014-10-1' and se.FormType not in ('EFFECT') and se.Status=2 order by se.FilingId
DELETE FROM RESERVATION; DELETE FROM TICKET; DELETE FROM RANK; DELETE FROM EVENT; DELETE FROM USER; LOAD DATA LOCAL INFILE 'user.csv' INTO TABLE USER FIELDS TERMINATED BY ',' LINES TERMINATED BY '\r\n'; LOAD DATA LOCAL INFILE 'event.csv' INTO TABLE EVENT FIELDS TERMINATED BY ',' LINES TERMINATED BY '\r\n'; LOAD DATA LOCAL INFILE 'rank.csv' INTO TABLE RANK FIELDS TERMINATED BY ',' LINES TERMINATED BY '\r\n'; LOAD DATA LOCAL INFILE 'ticket.csv' INTO TABLE TICKET FIELDS TERMINATED BY ',' LINES TERMINATED BY '\r\n'; LOAD DATA LOCAL INFILE 'reservation.csv' INTO TABLE RESERVATION FIELDS TERMINATED BY ',' LINES TERMINATED BY '\r\n'; QUIT
use project_datarep; create table employees ( id int NOT NULL AUTO_INCREMENT, f_name varchar(15), s_name varchar(20), age int, emp_role varchar(20), salary int, PRIMARY KEY (id) );
-- !Ups ALTER TABLE Team CHANGE COLUMN abbrev abbrev varchar(3) NOT NULL; -- !Downs ALTER TABLE Team CHANGE COLUMN abbrev abbrev varchar(3);
# --- !Ups ALTER TABLE USUARIO ADD CONSTRAINT `fk_Usuario_Rol` FOREIGN KEY (`Rol_id`) REFERENCES `Rol` (`id`); ALTER TABLE USUARIO ADD CONSTRAINT `usuario_unique` UNIQUE (`usuario`); ALTER TABLE MOVIMIENTOS ADD UNIQUE `unique_index`(`num_tram`, `movimiento`, `fecha_ingreso`); ALTER TABLE MOVIMIENTOS ADD CONSTRAINT `fk_Movimientos_Dependencias1` FOREIGN KEY (`Dependencias_id`) REFERENCES `Dependencias` (`id`); ALTER TABLE MOVIMIENTOS ADD CONSTRAINT `fk_Movimientos_Dependencias2` FOREIGN KEY (`Dependencias_id1`) REFERENCES `Dependencias` (`id`); ALTER TABLE MOVIMIENTOS ADD CONSTRAINT `fk_Movimientos_Usuario1` FOREIGN KEY (`Usuario_id`) REFERENCES `Usuario` (`id`); ALTER TABLE USUARIO ADD CONSTRAINT `fk_usuario_ofi` FOREIGN KEY (`Dependencia_id`) REFERENCES `DEPENDENCIAS` (`id`);
-- phpMyAdmin SQL Dump -- version 4.9.0.1 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Generation Time: Apr 28, 2020 at 04:16 PM -- Server version: 10.4.6-MariaDB -- PHP Version: 7.3.9 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET AUTOCOMMIT = 0; START TRANSACTION; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8mb4 */; -- -- Database: `sidaad` -- -- -------------------------------------------------------- -- -- Table structure for table `data_penduduk` -- CREATE TABLE `data_penduduk` ( `nik` varchar(20) NOT NULL, `nama` varchar(100) NOT NULL, `ttl` varchar(100) NOT NULL, `agama` varchar(20) NOT NULL, `jkel` varchar(20) NOT NULL, `kewarganegaraan` varchar(20) NOT NULL, `status` varchar(20) NOT NULL, `pekerjaan` varchar(100) NOT NULL, `alamat` varchar(100) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `data_penduduk` -- INSERT INTO `data_penduduk` (`nik`, `nama`, `ttl`, `agama`, `jkel`, `kewarganegaraan`, `status`, `pekerjaan`, `alamat`) VALUES ('123123123', 'Uzumaki Naruto', 'Konoha, 05 Januari 2005', 'Islam', 'Laki - laki', 'Warga Negara Asing', 'Kawin', 'Genin Ninja', 'Konohagakure, Otsuki, Jepang'), ('13017892193729', 'Ten Ten', 'Kyoto, 8 Oktober 2005', 'Konghucu', 'Perempuan', 'Indonesia', 'Belum Kawin', 'Ninja Ahli Senjata', 'Jl. Katana Shuriken, Kyoto'), ('1601291104990002', 'Habib Abdurrasyid', 'Kyoto, 8 Oktober 2005', 'Islam', 'Laki - laki', 'Indonesia', 'Belum Kawin', 'Web Developer', 'Ds. Marga Mulya, Kec. Sinar peninjauan, Kab. Ogan Komering Ulu, Prov. Sumatera Selatan'), ('2313872194912', 'Sabrina Orial Manurung', 'Jakarta, 12 Maret 1998', 'Kristen Protestan', 'Perempuan', 'Indonesia', 'Belum Kawin', 'Manajer Proyek', 'Jl. Airan Raya, Ds. Jatimulyo'), ('231387219491223', 'Hanya Contoh Saja', 'Jakarta, 12 Maret 1998', 'Islam', 'Laki - laki', 'Indonesia', 'Kawin', 'Pelajar', 'Jl. Airan Raya, Ds. Jatimulyo'), ('343238759382', 'Neji Hyuga', 'Kyoto, 8 Oktober 2005', 'Islam', 'Laki - laki', 'Indonesia', '', 'Expert Ninja', 'Ds. Marga Mulya, Kec. Sinar peninjauan, Kab. Ogan Komering Ulu, Prov. Sumatera Selatan'), ('36874221038421', 'Rock Lee', 'Osaka, 27 Agustus 2006', 'Budha', 'Laki - laki', 'Indonesia', 'Belum Kawin', 'Ninja', 'Jl. Sake Kick, Osaka'), ('39038596124901', 'Sasuke Uchiha', '30 Mei 2003', 'Kristen Protestan', 'Laki - laki', 'Indonesia', 'Belum Kawin', 'Expert Ninja', 'Jl. Tokyo Baru'), ('73792042912639', 'Sakura Haruno', 'Tokyo, 12 Maret 2005', 'Katolik', 'Perempuan', 'Indonesia', 'Belum Kawin', 'Ninja Medis', 'Jl. Tokyo Lama, Samping Mie Ramen'), ('92385829032137', 'Kakashi Hatake', 'Yokohama, 23 September 1998', 'Hindu', 'Laki - laki', 'Indonesia', 'Kawin', 'Ninja Ahli Senjata', 'Jl. Sharingan, Yokohama'); -- -------------------------------------------------------- -- -- Table structure for table `transaksi` -- CREATE TABLE `transaksi` ( `id_trx` int(11) NOT NULL, `jenis_surat` varchar(100) NOT NULL, `nik` varchar(20) NOT NULL, `user_id` int(11) NOT NULL, `nomor_surat` int(11) NOT NULL, `created_at` varchar(20) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `transaksi` -- INSERT INTO `transaksi` (`id_trx`, `jenis_surat`, `nik`, `user_id`, `nomor_surat`, `created_at`) VALUES (60, 'Surat Keterangan Tidak Mampu', '343238759382', 2, 0, '01-04-2020'), (61, 'Surat Keterangan Status Pernikahan', '1601291104990002', 2, 0, '01-04-2020'), (62, 'Surat Keterangan Status Pernikahan', '13017892193729', 11, 0, '02-04-2020'), (63, 'Surat Keterangan Status Pernikahan', '36874221038421', 2, 0, '02-04-2020'), (64, 'Surat Keterangan Tidak Mampu', '92385829032137', 2, 0, '02-04-2020'), (65, 'Surat Keterangan Status Pernikahan', '13017892193729', 1, 0, '02-04-2020'), (66, 'Surat Keterangan Tidak Mampu', '39038596124901', 2, 0, '03-04-2020'), (67, 'Surat Keterangan Status Pernikahan', '343238759382', 2, 0, '04-04-2020'), (68, 'Surat Keterangan Status Pernikahan', '343238759382', 2, 0, '04-04-2020'), (69, 'Surat Keterangan Status Pernikahan', '343238759382', 2, 0, '04-04-2020'), (70, 'Surat Keterangan Status Pernikahan', '343238759382', 2, 0, '04-04-2020'), (71, 'Surat Keterangan Status Pernikahan', '343238759382', 2, 0, '04-04-2020'), (72, 'Surat Keterangan Status Pernikahan', '343238759382', 2, 0, '04-04-2020'), (73, 'Surat Keterangan Status Pernikahan', '343238759382', 2, 0, '04-04-2020'), (74, 'Surat Keterangan Status Pernikahan', '343238759382', 2, 0, '04-04-2020'), (75, 'Surat Keterangan Status Pernikahan', '343238759382', 2, 0, '04-04-2020'), (76, 'Surat Keterangan Status Pernikahan', '343238759382', 2, 0, '04-04-2020'), (77, 'Surat Keterangan Status Pernikahan', '343238759382', 2, 0, '04-04-2020'), (78, 'Surat Keterangan Status Pernikahan', '343238759382', 2, 0, '04-04-2020'), (79, 'Surat Keterangan Status Pernikahan', '343238759382', 2, 0, '04-04-2020'), (80, 'Surat Keterangan Status Pernikahan', '343238759382', 2, 0, '04-04-2020'), (81, 'Surat Keterangan Status Pernikahan', '343238759382', 2, 0, '04-04-2020'), (82, 'Surat Keterangan Status Pernikahan', '343238759382', 2, 0, '04-04-2020'), (83, 'Surat Keterangan Status Pernikahan', '343238759382', 2, 0, '04-04-2020'), (84, 'Surat Keterangan Status Pernikahan', '343238759382', 2, 12, '04-04-2020'), (85, 'Surat Keterangan Status Pernikahan', '343238759382', 2, 0, '04-04-2020'), (86, 'Surat Keterangan Status Pernikahan', '343238759382', 2, 0, '04-04-2020'), (87, 'Surat Keterangan Status Pernikahan', '343238759382', 2, 0, '04-04-2020'), (88, 'Surat Keterangan Status Pernikahan', '343238759382', 2, 0, '04-04-2020'), (89, 'Surat Keterangan Tidak Mampu', '36874221038421', 2, 0, '04-04-2020'), (90, 'Surat Keterangan Tidak Mampu', '36874221038421', 2, 0, '04-04-2020'), (91, 'Surat Keterangan Status Pernikahan', '92385829032137', 1, 0, '05-04-2020'), (92, 'Surat Keterangan Status Pernikahan', '92385829032137', 1, 0, '05-04-2020'), (93, 'Surat Keterangan Status Pernikahan', '92385829032137', 1, 0, '05-04-2020'), (94, 'Surat Keterangan Status Pernikahan', '92385829032137', 1, 0, '05-04-2020'), (95, 'Surat Keterangan Status Pernikahan', '92385829032137', 1, 0, '05-04-2020'), (96, 'Surat Keterangan Status Pernikahan', '92385829032137', 1, 0, '05-04-2020'), (97, 'Surat Keterangan Status Pernikahan', '92385829032137', 1, 0, '05-04-2020'), (98, 'Surat Keterangan Status Pernikahan', '92385829032137', 1, 0, '05-04-2020'), (99, 'Surat Keterangan Status Pernikahan', '92385829032137', 1, 0, '05-04-2020'), (100, 'Surat Keterangan Status Pernikahan', '73792042912639', 1, 0, '05-04-2020'), (101, 'Surat Keterangan Status Pernikahan', '73792042912639', 1, 0, '05-04-2020'), (102, 'Surat Keterangan Status Pernikahan', '73792042912639', 1, 0, '05-04-2020'), (103, 'Surat Keterangan Tidak Mampu', '36874221038421', 1, 0, '05-04-2020'), (104, 'Surat Keterangan Status Pernikahan', '39038596124901', 1, 0, '05-04-2020'), (105, 'Surat Keterangan Status Pernikahan', '1601291104990002', 1, 0, '05-04-2020'), (106, 'Surat Keterangan Status Pernikahan', '1601291104990002', 1, 0, '05-04-2020'), (107, 'Surat Keterangan Status Pernikahan', '92385829032137', 11, 0, '05-04-2020'), (108, 'Surat Izin Keramaian', '92385829032137', 11, 0, '05-04-2020'), (109, 'Surat Izin Keramaian', '343238759382', 11, 0, '05-04-2020'), (110, 'Surat Izin Keramaian', '343238759382', 11, 0, '05-04-2020'), (111, 'Surat Izin Keramaian', '73792042912639', 11, 0, '05-04-2020'), (112, 'Surat Pengantar SKCK', '36874221038421', 11, 0, '05-04-2020'), (113, 'Surat Keterangan Domisili', '2313872194912', 2, 0, '06-04-2020'), (114, 'Surat Keterangan Domisili', '73792042912639', 2, 0, '06-04-2020'), (115, 'Surat Keterangan Tidak Mampu', '36874221038421', 2, 0, '06-04-2020'), (116, 'Surat Keterangan Penghasilan Orangtua', '2313872194912', 2, 0, '06-04-2020'), (117, 'Surat Keterangan Tidak Mampu', '123123123', 2, 15, '08-04-2020'), (123, 'Surat Keterangan Status Pernikahan', '36874221038421', 1, 16, '26-04-2020'), (124, 'Surat Keterangan Status Pernikahan', '13017892193729', 1, 17, '26-04-2020'), (125, 'Surat Keterangan Status Pernikahan', '73792042912639', 1, 18, '26-04-2020'), (126, 'Surat Keterangan Status Pernikahan', '123123123', 1, 19, '26-04-2020'), (127, 'Surat Keterangan Tidak Mampu', '123123123', 1, 20, '26-04-2020'), (128, 'Surat Keterangan Usaha', '123123123', 1, 21, '26-04-2020'), (129, 'Surat Izin Keramaian', '123123123', 1, 22, '26-04-2020'), (132, 'Surat Keterangan Tidak Mampu', '231387219491223', 1, 23, '27-04-2020'); -- -------------------------------------------------------- -- -- Table structure for table `users` -- CREATE TABLE `users` ( `user_id` int(11) NOT NULL, `username` varchar(100) NOT NULL, `password` varchar(255) NOT NULL, `role_id` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `users` -- INSERT INTO `users` (`user_id`, `username`, `password`, `role_id`) VALUES (1, 'Habib Abdurrasyid', '!administrator', 1), (2, 'Syaiful Huda', '12345', 2), (11, 'Agil Melania Aziz', '1234', 2); -- -------------------------------------------------------- -- -- Table structure for table `user_role` -- CREATE TABLE `user_role` ( `role_id` int(11) NOT NULL, `role_name` varchar(20) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `user_role` -- INSERT INTO `user_role` (`role_id`, `role_name`) VALUES (1, 'Administrator'), (2, 'Operator'); -- -- Indexes for dumped tables -- -- -- Indexes for table `data_penduduk` -- ALTER TABLE `data_penduduk` ADD PRIMARY KEY (`nik`); -- -- Indexes for table `transaksi` -- ALTER TABLE `transaksi` ADD PRIMARY KEY (`id_trx`), ADD KEY `pemohon` (`nik`), ADD KEY `operator` (`user_id`); -- -- Indexes for table `users` -- ALTER TABLE `users` ADD PRIMARY KEY (`user_id`), ADD KEY `role_id` (`role_id`); -- -- Indexes for table `user_role` -- ALTER TABLE `user_role` ADD PRIMARY KEY (`role_id`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `transaksi` -- ALTER TABLE `transaksi` MODIFY `id_trx` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=133; -- -- AUTO_INCREMENT for table `users` -- ALTER TABLE `users` MODIFY `user_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=23; -- -- AUTO_INCREMENT for table `user_role` -- ALTER TABLE `user_role` MODIFY `role_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3; -- -- Constraints for dumped tables -- -- -- Constraints for table `transaksi` -- ALTER TABLE `transaksi` ADD CONSTRAINT `transaksiDataPenduduk` FOREIGN KEY (`nik`) REFERENCES `data_penduduk` (`nik`) ON DELETE CASCADE ON UPDATE CASCADE, ADD CONSTRAINT `transaksiUsers` FOREIGN KEY (`user_id`) REFERENCES `users` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE; -- -- Constraints for table `users` -- ALTER TABLE `users` ADD CONSTRAINT `users_ibfk_1` FOREIGN KEY (`role_id`) REFERENCES `user_role` (`role_id`); COMMIT; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
INSERT INTO parametro (nombre, valor, tipo) VALUES ('nombre_bucket','tesoreria_soportes','AWS'); INSERT INTO parametro (nombre, valor, tipo) VALUES ('url_imagenes','http://s3.amazonaws.com','AWS');
-- When was the earliest order ever placed? You only need to return the date. SELECT MIN(occured_at) FROM orders; -- Try performing the same query as in question 1 without using an aggregation function. SELECT occured_at FROM orders ORDER BY occured_at LIMIT 1; -- When did the most recent (latest) web_event occur? SELECT MAX(occured_at) FROM web_events; -- Try to perform the result of the previous query without using an aggregation function. SELECT occured_at FROM web_events ORDER BY occured_at DESC LIMIT 1; -- Find the mean (AVERAGE) amount spent per order on each paper type, as well as the mean amount of each paper type purchased per order. Your final answer should have 6 values - one for each paper type for the average number of sales, as well as the average amount. SELECT AVG(standard_qty) AS mean_standard, AVG(gloss_qty) AS mean_gloss, AVG(poster_qty) AS mean_poster, AVG(standard_amt_usd) AS mean_standard_usd, AVG(gloss_amt_usd) AS mean_gloss_usd, AVG(poster_amt_usd) AS mean_poster_usd FROM orders;
-- phpMyAdmin SQL Dump -- version 5.0.2 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Generation Time: Jan 07, 2021 at 03:35 PM -- Server version: 10.4.13-MariaDB -- PHP Version: 7.4.8 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; START TRANSACTION; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8mb4 */; -- -- Database: `online_food` -- -- -------------------------------------------------------- -- -- Table structure for table `admin` -- CREATE TABLE `admin` ( `id` int(11) NOT NULL, `name` varchar(50) NOT NULL, `username` varchar(50) NOT NULL, `password` varchar(50) NOT NULL, `email` varchar(50) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `admin` -- INSERT INTO `admin` (`id`, `name`, `username`, `password`, `email`) VALUES (1, 'Admin', 'admin', 'admin', 'admin@gmail.com'); -- -------------------------------------------------------- -- -- Table structure for table `category` -- CREATE TABLE `category` ( `id` int(11) NOT NULL, `category` varchar(50) NOT NULL, `order_number` int(11) NOT NULL, `status` int(11) NOT NULL, `added_on` datetime NOT NULL, `color` varchar(10) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `category` -- INSERT INTO `category` (`id`, `category`, `order_number`, `status`, `added_on`, `color`) VALUES (1, 'Veg', 1, 1, '2020-06-16 12:06:33', 'green'), (2, 'Non-Veg', 2, 1, '2020-06-16 12:06:41', 'red'); -- -------------------------------------------------------- -- -- Table structure for table `contact_us` -- CREATE TABLE `contact_us` ( `id` int(11) NOT NULL, `name` varchar(100) NOT NULL, `email` varchar(100) NOT NULL, `message` text NOT NULL, `added_on` datetime NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `contact_us` -- INSERT INTO `contact_us` (`id`, `name`, `email`, `message`, `added_on`) VALUES (1, 'Shebon Lin Shajan', 'shibourne2000@gmail.com', 'I loved the food.', '2021-01-05 08:47:01'), (8, 'Shebon Lin Shajan', 'shibourne2000@gmail.com', 'Great Food.', '2021-01-05 08:53:25'), (9, 'Anna', 'anna@gmail.com', 'Loved the atmosphere', '2021-01-05 08:57:42'), (10, 'Ashwin', 'ashwin@gmail.com', 'Loved the paneer tikka.', '2021-01-05 09:01:34'), (11, 'Liny', 'liny@gmail.com', 'Food was great', '2021-01-05 03:13:44'); -- -------------------------------------------------------- -- -- Table structure for table `coupon_code` -- CREATE TABLE `coupon_code` ( `id` int(11) NOT NULL, `coupon_code` varchar(20) NOT NULL, `coupon_type` enum('P','F') NOT NULL, `coupon_value` int(11) NOT NULL, `cart_min_value` int(11) NOT NULL, `expired_on` date NOT NULL, `status` int(11) NOT NULL, `added_on` datetime NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Table structure for table `course` -- CREATE TABLE `course` ( `id` int(1) NOT NULL, `course` varchar(10) NOT NULL, `status` int(1) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `course` -- INSERT INTO `course` (`id`, `course`, `status`) VALUES (1, 'Breakfast', 1), (2, 'Lunch', 1), (3, 'Dinner', 1), (4, 'Desserts', 1); -- -------------------------------------------------------- -- -- Table structure for table `delivery_boy` -- CREATE TABLE `delivery_boy` ( `id` int(11) NOT NULL, `name` varchar(50) NOT NULL, `mobile` varchar(50) NOT NULL, `password` varchar(50) NOT NULL, `status` int(11) NOT NULL, `added_on` datetime NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Table structure for table `dish` -- CREATE TABLE `dish` ( `id` int(11) NOT NULL, `course_id` int(11) NOT NULL, `dish` varchar(100) NOT NULL, `dish_detail` text NOT NULL, `image` varchar(100) NOT NULL, `status` int(11) NOT NULL, `added_on` datetime NOT NULL, `category_id` int(1) NOT NULL, `price` int(4) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `dish` -- INSERT INTO `dish` (`id`, `course_id`, `dish`, `dish_detail`, `image`, `status`, `added_on`, `category_id`, `price`) VALUES (1, 1, 'Classic English Breakfast', 'A perfect breakfast platter with bread, scrambled eggs, sausages and hash browns. Orange juice complimentary.', '977945963_862169053_gulab-jamun.jpg', 1, '2020-06-17 10:43:59', 2, 300), (2, 1, 'Breakfast tacos', 'Soft taco shells with your choice of filling (classic scrambled eggs/pulled chicken with spices).', '325195312_raj-kachori.jpeg', 1, '2020-06-17 10:46:06', 2, 270), (3, 1, 'Mozzarella Sticks', 'Fresh Mozzarella sticks dipped in batter and panko, fried to perfection.\r\n', '836724175_Chowmein.jpg', 1, '2020-06-17 10:47:26', 1, 200), (6, 1, 'Mediterranean Tomato Salad', 'Flavor-packed tomato salad with feta, loads of fresh herbs, and a light citrus dressing.', '386683969_01.jpg', 1, '2020-12-28 05:46:27', 1, 200), (7, 2, 'Roast Stuffed Chicken', 'Fresh farm chicken roasted with Italian spices and herbs and served with a side of mashed potatoes.', '250828528_roast.jpg', 1, '2020-12-28 05:49:18', 2, 450), (8, 2, 'Beef Lasagna', 'Lasagna made with lean ground beef, whole wheat lasagna noodles, prepared sauce, and plenty of mozzarella cheese.', '528260677_lasagna.jpg', 1, '2020-12-28 05:54:58', 2, 470), (9, 2, 'Chicken Pot Pie', 'Savory pie filled with cooked chicken, onion, carrot, and peas in a creamy sauce. With a flaky, buttery crust, it\'s comfort food at its finest.\r\n', '695427509_PotPie.jpg', 1, '2020-12-28 06:00:23', 2, 320), (10, 3, 'Quesadilla', 'Soft tortillas with chicken filling served with sour cream', '481639070_quesadilla.jpg', 1, '2020-12-28 06:02:28', 2, 280), (11, 3, 'Crispy Fried Chicken', 'Fresh farm grown chicken dipped in a spicy batter and fried to crispiness.', '129862901_kfc.jpg', 0, '2020-12-28 06:04:37', 2, 300), (12, 3, 'Hawaiian Veggie pizza', 'Pizza topped with pineapple, veggies, tomato sauce and cheese.', '598333795_pizza.jpg', 1, '2020-12-28 06:18:14', 1, 350), (13, 3, 'Thai green curry and white rice', 'Chicken in rich Thai-style green gravy served with boiled veggies and white rice.', '905112933_curry.jpg', 1, '2020-12-28 06:20:11', 2, 250), (14, 4, 'Chocolate Mud Cake', 'Soft decadent Chocolate cake topped with Chocolate ganache and seasonal berries.\r\n', '947187797_cake.jpg', 1, '2020-12-28 06:22:04', 1, 120), (15, 4, 'Lemon-Scented Blueberry Cupcakes', 'Studded with plump, juicy fresh berries and light flavor of lemon.', '431264972_Lemon-Blueberry-Cupcakes-FB.jpg', 1, '2020-12-28 06:23:19', 1, 100), (16, 4, 'Sizzling brownie', 'Hot fudgy brownie served in a skillet topped with chocolate sauce and ice cream.', '152751847_sizzling-brownie.jpg', 1, '2020-12-28 06:27:50', 1, 170), (17, 4, 'Blueberry Cheesecake', 'Creamy cheesecake topped with real blueberries and syrup.', '917032891_Blueberry-Cheesecake..jpg', 1, '2020-12-28 06:32:09', 1, 150), (20, 3, 'Paneer Tikka', 'Made from chunks of paneer marinated in spices and grilled in a tandoor.', '960259654_Paneer-Tikka.jpg', 1, '2021-01-05 07:52:39', 1, 0), (21, 2, 'Mushroom Soup', 'Tasty Mushroom Soup', '679448645_Paneer-Tikka.jpg', 1, '2021-01-05 02:00:49', 1, 0), (22, 3, 'Butter Chicken', 'Chunks of grilled chicken (tandoori chicken) cooked in a smooth buttery & creamy tomato based gravy served with Naan.', '743263275_butter-chicken.jpg', 1, '2021-01-05 08:16:09', 2, 0); -- -------------------------------------------------------- -- -- Table structure for table `dish_cart` -- CREATE TABLE `dish_cart` ( `id` int(11) NOT NULL, `user_id` int(11) NOT NULL, `dish_detail_id` int(11) NOT NULL, `qty` int(11) NOT NULL, `added_on` datetime NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `dish_cart` -- INSERT INTO `dish_cart` (`id`, `user_id`, `dish_detail_id`, `qty`, `added_on`) VALUES (1, 4, 0, 1, '2021-01-07 12:40:32'), (2, 5, 0, 1, '2021-01-07 12:57:40'), (3, 5, 7, 1, '2021-01-07 01:09:54'), (4, 5, 11, 16, '2021-01-07 01:10:10'), (5, 5, 10, 4, '2021-01-07 01:29:23'), (6, 5, 6, 1, '2021-01-07 01:29:23'), (7, 5, 24, 9, '2021-01-07 01:30:03'), (8, 5, 1, 1, '2021-01-07 01:30:20'), (9, 5, 19, 13, '2021-01-07 01:33:55'); -- -------------------------------------------------------- -- -- Table structure for table `dish_details` -- CREATE TABLE `dish_details` ( `id` int(11) NOT NULL, `dish_id` int(11) NOT NULL, `attribute` varchar(100) NOT NULL, `price` int(11) NOT NULL, `status` int(11) NOT NULL, `added_on` datetime NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `dish_details` -- INSERT INTO `dish_details` (`id`, `dish_id`, `attribute`, `price`, `status`, `added_on`) VALUES (1, 3, 'Full', 210, 1, '2020-06-19 10:25:47'), (6, 1, 'Full', 250, 1, '2020-06-20 00:00:00'), (7, 2, 'Full', 200, 1, '2020-06-20 00:00:00'), (8, 6, 'Full', 325, 1, '2020-12-28 05:46:27'), (9, 7, 'Full', 350, 1, '2020-12-28 05:49:18'), (10, 8, 'Full', 450, 1, '2020-12-28 05:54:58'), (11, 9, 'Full', 350, 1, '2020-12-28 06:00:23'), (12, 10, 'Full', 320, 1, '2020-12-28 06:02:28'), (13, 11, 'Full', 320, 1, '2020-12-28 06:04:37'), (14, 12, 'Full', 450, 1, '2020-12-28 06:18:14'), (15, 13, 'Full', 280, 1, '2020-12-28 06:20:11'), (16, 14, '1 kg', 1000, 1, '2020-12-28 06:22:04'), (17, 14, 'Per Slice', 210, 1, '2020-12-28 06:22:04'), (18, 15, 'Per piece', 100, 1, '2020-12-28 06:23:19'), (19, 16, 'Full', 180, 1, '2020-12-28 06:27:50'), (20, 17, 'Full', 1000, 1, '2020-12-28 06:32:09'), (21, 17, 'Per Slice', 150, 1, '2020-12-28 06:32:09'), (23, 20, 'Full', 350, 1, '2021-01-05 07:52:39'), (24, 21, 'Full', 250, 1, '2021-01-05 02:00:49'), (25, 22, 'Full', 320, 1, '2021-01-05 08:16:09'); -- -------------------------------------------------------- -- -- Table structure for table `order_detail` -- CREATE TABLE `order_detail` ( `id` int(11) NOT NULL, `order_id` int(11) NOT NULL, `dish_details_id` int(11) NOT NULL, `price` float NOT NULL, `gst` float NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Table structure for table `order_master` -- CREATE TABLE `order_master` ( `id` int(11) NOT NULL, `user_id` int(11) NOT NULL, `name` varchar(50) NOT NULL, `email` varchar(50) NOT NULL, `mobile` varchar(50) NOT NULL, `address` text NOT NULL, `total_price` float NOT NULL, `zipcode` varchar(10) NOT NULL, `delivery_boy_id` int(11) NOT NULL, `payment_status` int(11) NOT NULL, `order_status` int(11) NOT NULL, `added_on` datetime NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Table structure for table `order_status` -- CREATE TABLE `order_status` ( `id` int(11) NOT NULL, `order_status` varchar(50) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Table structure for table `user` -- CREATE TABLE `user` ( `id` int(11) NOT NULL, `name` varchar(50) NOT NULL, `email` varchar(50) NOT NULL, `mobile` varchar(15) NOT NULL, `password` varchar(50) NOT NULL, `status` int(11) NOT NULL, `added_on` datetime NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `user` -- INSERT INTO `user` (`id`, `name`, `email`, `mobile`, `password`, `status`, `added_on`) VALUES (2, 'Shebon Shajan', 'shebon@gmail.com', '1234567890', 'shebon', 0, '2020-06-16 00:00:00'), (4, 'Aleena', 'aleena@gmail.com', '1234567890', '1234', 1, '2021-01-07 11:30:07'), (5, 'demo', 'demo@gmail.com', '1234567890', '123', 1, '2021-01-07 12:56:53'); -- -- Indexes for dumped tables -- -- -- Indexes for table `admin` -- ALTER TABLE `admin` ADD PRIMARY KEY (`id`); -- -- Indexes for table `category` -- ALTER TABLE `category` ADD PRIMARY KEY (`id`); -- -- Indexes for table `contact_us` -- ALTER TABLE `contact_us` ADD PRIMARY KEY (`id`); -- -- Indexes for table `coupon_code` -- ALTER TABLE `coupon_code` ADD PRIMARY KEY (`id`); -- -- Indexes for table `course` -- ALTER TABLE `course` ADD PRIMARY KEY (`id`); -- -- Indexes for table `delivery_boy` -- ALTER TABLE `delivery_boy` ADD PRIMARY KEY (`id`); -- -- Indexes for table `dish` -- ALTER TABLE `dish` ADD PRIMARY KEY (`id`); -- -- Indexes for table `dish_cart` -- ALTER TABLE `dish_cart` ADD PRIMARY KEY (`id`); -- -- Indexes for table `dish_details` -- ALTER TABLE `dish_details` ADD PRIMARY KEY (`id`); -- -- Indexes for table `order_detail` -- ALTER TABLE `order_detail` ADD PRIMARY KEY (`id`); -- -- Indexes for table `order_master` -- ALTER TABLE `order_master` ADD PRIMARY KEY (`id`); -- -- Indexes for table `order_status` -- ALTER TABLE `order_status` ADD PRIMARY KEY (`id`); -- -- Indexes for table `user` -- ALTER TABLE `user` ADD PRIMARY KEY (`id`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `admin` -- ALTER TABLE `admin` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; -- -- AUTO_INCREMENT for table `category` -- ALTER TABLE `category` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6; -- -- AUTO_INCREMENT for table `contact_us` -- ALTER TABLE `contact_us` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12; -- -- AUTO_INCREMENT for table `coupon_code` -- ALTER TABLE `coupon_code` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `delivery_boy` -- ALTER TABLE `delivery_boy` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `dish` -- ALTER TABLE `dish` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=23; -- -- AUTO_INCREMENT for table `dish_cart` -- ALTER TABLE `dish_cart` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10; -- -- AUTO_INCREMENT for table `dish_details` -- ALTER TABLE `dish_details` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=26; -- -- AUTO_INCREMENT for table `order_detail` -- ALTER TABLE `order_detail` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `order_master` -- ALTER TABLE `order_master` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `order_status` -- ALTER TABLE `order_status` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `user` -- ALTER TABLE `user` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6; COMMIT; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
SELECT emp.last_name,emp.first_name,dept.dept_name FROM (employees emp LEFT JOIN dept_emp dept_e ON emp.emp_no = dept_e.emp_no) LEFT JOIN departments dept ON dept_e.dept_no = dept.dept_no;
INSERT INTO `ssaif_prod_abril`.`tbcategorias` (`idtcategoria`, `categoria`) SELECT `categorias`.`categoriaid`, `categorias`.`descripcion` FROM `ssaif_back_abril`.`categorias`;
create schema if NOT EXISTS test; create table if not exists test."user" ( id bigserial not null constraint test_id_pk primary key, name varchar(128), state varchar(128), number integer, money double precision, is_applied boolean, date date ); create table if not exists test."note" ( id bigserial not null constraint note_id_pk primary key, text varchar(2048) not null ); create table if not exists test."access_level" ( value varchar(128) primary key ); insert into test."access_level" values ('READ'); insert into test."access_level" values ('WRITE'); insert into test."access_level" values ('OWNER'); insert into test."access_level" values ('PUBLIC_READ'); insert into test."access_level" values ('PUBLIC_WRITE'); create table if not exists test."user_note" ( id bigserial not null constraint user_note_pk primary key, user_id bigint not null, note_id bigint not null, access_level varchar(128) not null, constraint user_note_user_fk foreign key (user_id) REFERENCES test."user" (id), constraint user_note_note_fk foreign key (note_id) references test."note" (id), constraint user_note_access_level_fk foreign key (access_level) references test."access_level" (value), constraint user_note_comb_unique UNIQUE (user_id, note_id, access_level) );
-- Create an ECG data table additional field with lag -- Note that your data should already be loaded in the ecg_data table. DROP TABLE IF EXISTS "ecg_data_with_lag"; CREATE TABLE IF NOT EXISTS "ecg_data_with_lag"( ecg_datetime TIMESTAMP WITHOUT TIME ZONE NOT NULL, ecg_datetime_prev TIMESTAMP WITHOUT TIME ZONE, -- can be null ecg_mv NUMERIC NOT NULL, --ecg reading in millivolts anomaly_likelihood NUMERIC ); SELECT create_hypertable('ecg_data_with_lag', 'ecg_datetime'); INSERT INTO ecg_data_with_lag(ecg_datetime, ecg_datetime_prev, ecg_mv, anomaly_likelihood) SELECT ecg_datetime, LAG(ecg_datetime) OVER (ORDER BY ecg_datetime) AS prev_row_datetime, ecg_mv, anomaly_likelihood FROM ecg_data; CREATE INDEX ON ecg_data_with_lag(ecg_mv); CREATE INDEX ON ecg_data_with_lag(anomaly_likelihood);
CREATE TABLE materia ( clave VARCHAR2(8) NOT NULL, nombre VARCHAR2(64) NOT NULL, CONSTRAINT materia_pk PRIMARY KEY(clave) );
--酒店提交单口径 select oi.d, count (distinct oi.orderid) as ois from (select substring(orderdate,0,10) as d , orderid from dw_htlmaindb.facthotelorder where d>="2017-06-01" and d<="2018-06-30") oi group by oi.d --酒店UV select d ,count(distinct clientcode) as htluvuv from DW_MobDB.factmbpageview where d>="2017-06-01" and d<="2018-06-30" and pagecode in ('hotel_inland_inquire', 'hotel_oversea_inquire') group by d --窄口径业务报表(对比酒店) select mocktable.d , mocktable.`宫格dau` , mocktable.`民宿订单` , mocktable.`u2o` , mocktable.`大住宿内宫格订单占比` , mocktable.`大住宿内宫格途家订单占比` , mocktable.`大住宿内宫格用户占比` , mocktable.`app内宫格用户占比` from ( select bnboi.d , bnboi.ois as `民宿订单` , bnbuvuv as `宫格DAU` , concat(cast(100*((bnboi.ois)/bnbuvuv) as decimal(5,2)),'%') as `U2O` , concat(cast(100*((bnboi.ois)/htloi.ois) as decimal(5,2)),'%') as `大住宿内宫格订单占比` , concat(cast(100*((tujiaoi.ois)/htloi.ois) as decimal(5,2)),'%') as `大住宿内宫格途家订单占比` , concat(cast(100*((bnbuvuv)/htluvuv) as decimal(5,2)),'%') as `大住宿内宫格用户占比` , concat(cast(100*((bnbuvuv)/appuvuv) as decimal(5,2)),'%') as `App内宫格用户占比` from (select a.d , sum (a.ois) as ois from (select a.d ,if(a.d>='2018-05-26', sum(if(a.terminalType=10, 1, 0)) , sum(if(a.applicationType=10 or a.applicationType is null, 1, 0))) as ois from (select distinct substring(b1.createdtime, 0, 10) as d , b1.applicationType , b1.terminalType , a1.orderid from ods_htl_bnborderdb.order_item a1 left join ods_htl_bnborderdb.order_header_v2 b1 on a1.orderid=b1.orderid and b1.d="2018-07-03" left join ods_htl_bnborderdb.order_item_space c1 on c1.orderitemid=a1.orderitemid and c1.d="2018-07-03" where substring(b1.createdtime,0,10)>="2018-06-17" and substring(b1.createdtime,0,10)<="2018-07-02" and b1.visitsource in (0, 20, 70, 120, 130, 201, 203, 205) and (a1.statusid like '12%' OR a1.statusid like '20%' OR a1.statusid like '22%' OR a1.statusid like '23%') and a1.saleamount>=20 and a1.d="2018-07-03" and b1.sellerid=0) a group by a.d union all select b.d , round(count(distinct b.orderid)*0.85,0) as ois from (select substring(orderdate, 0, 10) as d ,orderid from dw_htlmaindb.FactHotelOrder_All_Inn where substring(orderdate,0,10)>="2018-06-17" and substring(orderdate,0,10)<="2018-07-02" and d ="2018-07-03" ) b group by b.d)a group by a.d) bnboi join ( select a.d , if(a.d>='2018-05-26', sum(if(a.terminalType=10, 1, 0)) , sum(if(a.applicationType=10 or a.applicationType is null, 1, 0))) as ois from (select substring(b1.createdtime, 0, 10) as d , b1.applicationType , b1.terminalType , a1.orderid from ods_htl_bnborderdb.order_item a1 left join ods_htl_bnborderdb.order_header_v2 b1 on a1.orderid=b1.orderid and b1.d="2018-07-03" left join ods_htl_bnborderdb.order_item_space c1 on c1.orderitemid=a1.orderitemid and c1.d="2018-07-03" where substring(b1.createdtime,0,10)>="2018-06-17" and substring(b1.createdtime,0,10)<="2018-07-02" and b1.visitsource in (0, 20, 70, 120, 130, 201, 203, 205) and (a1.statusid like '12%' OR a1.statusid like '20%' OR a1.statusid like '22%' OR a1.statusid like '23%') and a1.vendorid in (105,115) and a1.saleamount>=20 and a1.d="2018-07-03" and b1.sellerid=0) a group by a.d)tujiaoi on tujiaoi.d = bnboi.d join (select oi.d , count (distinct oi.orderid) as ois from (select substring(orderdate,0,10) as d , orderid from dw_htlmaindb.facthotelorder where d>="2018-06-17" and d<="2018-07-02") oi inner join (select d , orderid from ods_htl_orderdb.ord_ltp_paymentinfo where d="2018-07-03" and paymentstatus = 2) olp on oi.orderid = olp.orderid group by oi.d)htloi on htloi.d = bnboi.d join (select d, count(distinct clientcode) as bnbuvuv from bnb_hive_db.bnb_pageview where d>="2018-06-17" and d<="2018-07-02" group by d) bnbuv on bnbuv.d = bnboi.d join (select d, count(distinct clientcode) as htluvuv from DW_MobDB.factmbpageview where d>="2018-06-17" and d<="2018-07-02" and pagecode in ('hotel_inland_inquire', 'hotel_oversea_inquire') and prepagecode in ('home', '0') group by d)htluv on htluv.d = bnboi.d join (select d, count(distinct clientcode) as appuvuv from DW_MobDB.factmbpageview where d>="2018-06-17" and d<="2018-07-02" and pagecode in ('home') group by d)appuv on appuv.d = bnboi.d ) as mocktable order by mocktable.d desc
/* Find the number of sellers whose rating is higher than 1000. */ SELECT COUNT(*) FROM Seller WHERE rating > 1000;
DROP TABLE IF EXISTS portfolio_portfolios CASCADE; -- CASCADE will drop all references to this table CREATE TABLE portfolio_portfolios ( currency_code varchar(8) DEFAULT 'USD' REFERENCES system_currencies (code) ON DELETE SET DEFAULT ON UPDATE CASCADE, cash numeric DEFAULT 0, total_position_count bigint DEFAULT 0 CHECK (total_position_count >= 0), --CONSTRAINT valid_space CHECK ((com_id > 0 AND net_id = 0 AND via_id = 0) OR (com_id = 0 AND net_id > 0 AND via_id = 0) OR (com_id = 0 AND net_id = 0 AND via_id > 0)), FOREIGN KEY (com_id, net_id, via_id, module_id, matrix_counter) REFERENCES module_matrix (com_id, net_id, via_id, module_id, counter) MATCH SIMPLE ON DELETE CASCADE ON UPDATE CASCADE ) INHERITS (module_template); -- Index on ID is automatically created by PRIMARY KEY CREATE UNIQUE INDEX portfolio_portfolios_com_net_via_matrix_counter_counter_x ON portfolio_portfolios (com_id, net_id, via_id, matrix_counter, counter); --CREATE INDEX portfolio_portfolios_com_matrix_counter_profile_active_x ON portfolio_portfolios (com_id, matrix_counter, profile_id, active); --CREATE INDEX portfolio_portfolios_net_matrix_counter_profile_active_x ON portfolio_portfolios (net_id, matrix_counter, profile_id, active); --CREATE INDEX portfolio_portfolios_via_matrix_counter_profile_active_x ON portfolio_portfolios (via_id, matrix_counter, profile_id, active); CREATE INDEX portfolio_portfolios_search_index ON portfolio_portfolios USING gin(search); ALTER TABLE public.portfolio_portfolios OWNER TO vmdbuser; -- Dynamic check module_matrix CREATE TRIGGER "portfolio_portfolios_check_module_matrix_trigger" BEFORE INSERT ON "portfolio_portfolios" FOR EACH ROW EXECUTE PROCEDURE "check_module_matrix" (); --Update the updated field on updates CREATE TRIGGER "portfolio_portfolios_updated_trigger" BEFORE UPDATE ON "portfolio_portfolios" FOR EACH ROW EXECUTE PROCEDURE "current_updated" (); -- Dynamic counter increment CREATE TRIGGER "portfolio_portfolios_counter_trigger" BEFORE INSERT ON "portfolio_portfolios" FOR EACH ROW EXECUTE PROCEDURE "dynamic_incrementer" ('counter', 'com_id', 'net_id', 'via_id', 'matrix_counter'); -- Update the search field CREATE TRIGGER "portfolio_portfolios_update_search_trigger" BEFORE INSERT OR UPDATE ON "portfolio_portfolios" FOR EACH ROW EXECUTE PROCEDURE "update_search" ('search', 'title', 'B', 'heading', 'C', 'summary', 'C', 'meta_title', 'D', 'meta_description', 'D', 'meta_keywords', 'D'); --Update the total_item_count in module_matrix CREATE TRIGGER "portfolio_portfolios_total_item_count_trigger" AFTER INSERT OR UPDATE OR DELETE ON "portfolio_portfolios" FOR EACH ROW EXECUTE PROCEDURE "update_total_count" ('module_matrix', 'total_item_count', 'false', 'com_id', 'com_id', 'net_id', 'net_id', 'via_id', 'via_id', 'module_id', 'module_id', 'counter', 'matrix_counter'); ----------------------------------------------------------------------------------------------------
ALTER TABLE `app_student_task` CHANGE COLUMN `student_id` `student_id` INT(11) NULL , ADD COLUMN `app_user_id` INT NOT NULL AFTER `student_id`;
# Write your MySQL query statement below delete from person where id not in (select id from (select MIN(id) id from Person group by email) p) # Every derived table must have its own alias # p # MIN(id) id # MIN(id) as id # Success # Details # Runtime: 1670 ms, faster than 90.31% of MySQL online submissions for Delete Duplicate Emails. # Memory Usage: 0B, less than 100.00% of MySQL online submissions for Delete Duplicate Emails. # Write your MySQL query statement below delete from person where id not in (select id from (select MIN(id) as id from Person group by email) p) # Success # Details # Runtime: 1774 ms, faster than 83.01% of MySQL online submissions for Delete Duplicate Emails. # Memory Usage: 0B, less than 100.00% of MySQL online submissions for Delete Duplicate Emails. # Write your MySQL query statement below # ... join ... on ... where ... delete p2 from person p1 join person p2 on p2.email = p1.email where p2.id > p1.id # Success # Details # Runtime: 1843 ms, faster than 77.62% of MySQL online submissions for Delete Duplicate Emails. # Memory Usage: 0B, less than 100.00% of MySQL online submissions for Delete Duplicate Emails. # Write your MySQL query statement below delete p1 from person p1, person p2 where p1.email = p2.email and p1.id > p2.id # Success # Details # Runtime: 1798 ms, faster than 81.17% of MySQL online submissions for Delete Duplicate Emails. # Memory Usage: 0B, less than 100.00% of MySQL online submissions for Delete Duplicate Emails.
-- phpMyAdmin SQL Dump -- version 4.8.3 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Generation Time: Dec 11, 2018 at 05:50 AM -- Server version: 10.1.36-MariaDB -- PHP Version: 5.6.38 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: `danushunt` -- -- -------------------------------------------------------- -- -- Table structure for table `barang` -- CREATE TABLE `barang` ( `id_barang` int(11) NOT NULL, `namaBarang` varchar(50) DEFAULT NULL, `keterangan` text, `jenis` varchar(6) NOT NULL, `harga` int(11) NOT NULL, `id_seller` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `barang` -- INSERT INTO `barang` (`id_barang`, `namaBarang`, `keterangan`, `jenis`, `harga`, `id_seller`) VALUES (1, 'Donat Madu', 'Donat terenak sedunia wow', 'manis', 2500, 2), (2, 'Oreo Goreng', 'Oreo wowowowwoow terenak sedunia wow', 'manis', 1750, 2), (3, 'Janji Mantan', 'wow keren keterangannya memang begini', 'manis', 30000, 2), (4, 'Kue Balok', 'Kue balok potongan dengan potongan toping dan harga', 'manis', 2000, 2), (5, 'Lidah Kucing', 'Lidah karena kalo kaki kasian ga bisa jalan', 'manis', 1500, 2), (6, 'cilok', 'cilokokokokok', 'asin', 5000, 2), (7, 'Cireng bumbu', 'cireng kecil pake bumbu luar biasa', 'asin', 3000, 2), (8, 'Tahu', 'tahu krispi', 'asin', 3000, 2), (11, 'uwauawuwauwauaw', 'uwauwauawuaw', 'manis', 3, 6), (12, '', '', 'manis', 0, 2), (13, '', '', 'manis', 0, 2); -- -------------------------------------------------------- -- -- Table structure for table `hunter` -- CREATE TABLE `hunter` ( `id_hunter` int(20) NOT NULL, `username` varchar(20) DEFAULT NULL, `password` varchar(20) DEFAULT NULL, `namalengkap` varchar(50) DEFAULT NULL, `email` varchar(50) DEFAULT NULL, `no_hp` varchar(16) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `hunter` -- INSERT INTO `hunter` (`id_hunter`, `username`, `password`, `namalengkap`, `email`, `no_hp`) VALUES (1, 'davidfim77', 'inipassword', 'David Ferdinand I M', 'zonetdavidzo@gmail.com', '082216718462'), (2, 'syainasan', 'syaisyai', 'Syaina Nur Fauziyah', 'syainasyaina@gmail.com', '089663455605'), (3, 'syainanf', 'syainanf2739', 'syaina', 'syainanf@gmail.com', '089663455605'), (4, 'kazuto', 'kakakarimah', 'Kakazuta Karimah', 'kakakarimah@gmail.com', '08956632548'), (5, 'bambangs', 'bambangbambang', 'bambang', 'bambang@unpad.ac.id', '089566325484'); -- -------------------------------------------------------- -- -- Table structure for table `seller` -- CREATE TABLE `seller` ( `id_seller` int(20) NOT NULL, `username` varchar(20) DEFAULT NULL, `password` varchar(20) DEFAULT NULL, `email` varchar(50) DEFAULT NULL, `no_hp` varchar(16) DEFAULT NULL, `idline` varchar(25) DEFAULT NULL, `namalengkap` varchar(50) DEFAULT NULL, `bio` text NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `seller` -- INSERT INTO `seller` (`id_seller`, `username`, `password`, `email`, `no_hp`, `idline`, `namalengkap`, `bio`) VALUES (2, 'officialdanushunt', 'danusdanus', 'officialdanushunt@gmail.com', '0821321437452', 'danus_id', 'Official DanusHunt Store', 'Toko kita adalah toko terbaik sepanjang masa dengan pilihan makananan yang tiada tara enaknya. \r\nDijamin semua manusia yang beli danusan ini nagih , yang jual pasti auto abis.\r\nMenu andalan kami :\r\n-Krabby Patty\r\n-Nasi Goweng\r\n-Risol terenak sepanjang masa\r\n-Buah Celup\r\n\r\nTunggu apalagi langsung aja order danusa auto habis ini\r\n\r\nSMART TERBAIK'), (3, 'ngemil', 'ngemilngemil', 'ngemil@gmail.com', '089662344573', 'ngemils', 'Ngemil', 'Ini bio tapi aku nanti bingung btw ko ini gada scrollnya ya aku bingung lohkolohko gini kemana scrollnya tapi bagus sih jadi kotak tapi bakal muncuk kagi ga? yaudah kita simpan'), (4, 'hifood', 'password', 'hifood@gmail.com', '082122122122', 'hifoods', 'HiFood', 'kotaknya gakeliatan harus diapain biar jadi keliatan?'), (6, 'uwawuwaw', 'uwawuwaw', 'uwawuwaw@uwaw.com', '123456789123', 'TIdak WAjib', 'WAKACIMPUNG', ''); -- -- Indexes for dumped tables -- -- -- Indexes for table `barang` -- ALTER TABLE `barang` ADD PRIMARY KEY (`id_barang`), ADD KEY `id_seller` (`id_seller`); -- -- Indexes for table `hunter` -- ALTER TABLE `hunter` ADD PRIMARY KEY (`id_hunter`); -- -- Indexes for table `seller` -- ALTER TABLE `seller` ADD PRIMARY KEY (`id_seller`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `barang` -- ALTER TABLE `barang` MODIFY `id_barang` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=14; -- -- AUTO_INCREMENT for table `hunter` -- ALTER TABLE `hunter` MODIFY `id_hunter` int(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6; -- -- AUTO_INCREMENT for table `seller` -- ALTER TABLE `seller` MODIFY `id_seller` int(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7; -- -- Constraints for dumped tables -- -- -- Constraints for table `barang` -- ALTER TABLE `barang` ADD CONSTRAINT `barang_ibfk_1` FOREIGN KEY (`id_seller`) REFERENCES `seller` (`id_seller`); 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 */;
USE irassh; ALTER TABLE `ttylog` CHANGE `ttylog` `ttylog` VARCHAR(100) NOT NULL; ALTER TABLE `ttylog` ADD `size` INT(11) NOT NULL;
CREATE DATABASE Shamazon; USE Shamazon; // -- table called products which contain the store CREATE TABLE products( item_id INTEGER(22) AUTO_INCREMENT NOT NULL, product_name VARCHAR(23) NOT NULL, department_name VARCHAR(19) NOT NULL, price DECIMAL(10,2) NOT NULL, stock_quantity INTEGER(12) NOT NULL, PRIMARY KEY(item_id) ); // -- QUERY to select products from all categories of one parent SELECT * FROM products; // -- inserting into products table INSERT INTO products (product_name, department_name, price, stock_quantity) VALUES ("Cat Pogs", "Fads", 1.99, 100), ("Mouse Pogs", "Fads", 1.98, 120), ("SuperSoaker 50", "Summer Fun", 29.95, 50), ("Slip n Slide", "Summer Fun", 75.00, 200), ("Sun Tan Lotion", "Summer Fun", 5.55, 55), ("Survival Towel", "PumpkinSpiceLife", 42.42, 42), ("Pumpkin Spice latte", "PumpkinSpiceLife", 9.87, 5000), ("Pumpkin Spice Gummi Worms", "PumpkinSpiceLife", 1.97, 3000), ("Pumpkin Spice Poster", "PumpkinSpiceLife", 8,76, 2000), ("Pumpkin CatNip Ball", "Cat Toys", 19.95, 60), ("Bottle Rockets", "Summer Fun", 12.99, 4444), ("Food Pogs", "Fads", 1.97, 300), ("Mcguffin", "Summer Fun", 1.01, 2), ("Fish on a Rope", "Cat Toys", 5.55, 50);
drop database BDPrimitiva; create database BDPrimitiva; create database BDPrimitiva; create table users ( id int unique auto_increment primary key, CodCon varchar(8) not null, usuario varchar(191), email varchar(191) unique, password varchar(191), remember_token varchar(100), created_at timestamp, updated_at timestamp, condicion tinyint(1), foreign key (CodCon) references TabCon(CodCon)); create table roles( id int unique auto_increment primary key, name varchar(191), description varchar(191) ); create table role_user( id int unique auto_increment primary key, user_id int, role_id int ); insert into roles(name, description) values('liderred', 'Usuario para ver los reportes del lider de casa de paz'); insert into roles(name, description) values('lidercdp', 'Usuario para el líder de casa de paz'); insert into roles(name, description) values('mentor', 'Usuario para ver todo relacionado a sus discìpulos'); --PROCEDURES DELIMITER // CREATE PROCEDURE mostrar_actividades() BEGIN SELECT CodAct, TipAct, LugAct, HorEnt, PriAct FROM TabActividades; END DELIMITER // CREATE PROCEDURE insertar_actividades( IN CodAct nvarchar(3), IN FecReg datetime, IN TipAct nvarchar(30), IN LugAct nvarchar(100), IN Tipo nvarchar(2), IN DiaActOtro nvarchar(7), IN DiaMes nvarchar(2), IN DiaSem nvarchar(2), IN FecIni datetime, IN FecFin datetime, IN HorEnt datetime, IN MinTol real, IN ConAsi bit, IN PriAct bit ) BEGIN insert into TabActividades(`CodAct`, `FecReg`, `TipAct`, `LugAct`, `Tipo`, `DiaActOtro`, `DiaMes`, `DiaSem`, `FecIni`, `FecFin`, `HorEnt`, `MinTol`, `ConAsi`, `PriAct`) values (CodAct, FecReg, TipAct, LugAct, Tipo, DiaActOtro, DiaMes, DiaSem, FecIni, FecFin, HorEnt, MinTol, ConAsi, PriAct); END// -- PROCEDIMIENTOS ALMACENADOS PARA CONGREGANTE -- DELIMITER // CREATE PROCEDURE mostrar_miembros() BEGIN SELECT CodCon, ApeCon, NomCon, EstaEnProceso, FecNacCon, NumCel, TipCon, DirCon, ParticipaCasaPaz, FalCons, FalConsCP, FecReg, ID_RED FROM TabCon WHERE EstCon = 'ACTIVO' ORDER BY ApeCon ASC; END// ----PROCEDIMIENTOS ALMACENADOS PARA CASAS DE PAZ DELIMITER // CREATE PROCEDURE mostrar_miembros_cdp( IN CodCdp nvarchar(6) ) BEGIN SELECT c.CodCon, CONCAT(c.ApeCon, ' ', c.NomCon) As Nombres, c.EstaEnProceso, c.DirCon, c.TipCon, YEAR(CURDATE())-YEAR(c.FecNacCon) + IF(DATE_FORMAT(CURDATE(),'%m-%d') > DATE_FORMAT(c.FecNacCon,'%m-%d'), 0 , -1 ) AS `EDAD_ACTUAL`, c.EstCon FROM TabMimCasPaz m INNER JOIN TabCon c ON m.CodCon = c.CodCon WHERE m.CodCasPaz = CodCdp; END// use BDPrimitiva; SELECT * FROM TabCasasDePaz WHERE ID_Red= '1' SELECT * FROM TabRedes
SET CLUSTER ''; SET DEFAULT_TABLE_TYPE 0; SET WRITE_DELAY 500; SET DEFAULT_LOCK_TIMEOUT 2000; SET CACHE_SIZE 16384; CREATE USER IF NOT EXISTS SA SALT '2fc8bc2d71f2d708' HASH 'b0243d44c37253fbe66182d9adf735a59a143a2a8b582ea01a5a20a25f32b9a7' ADMIN; CREATE SEQUENCE PUBLIC.SYSTEM_SEQUENCE_10F9D54E_B243_42B9_9CD4_A4F6044ACD97 START WITH 3 BELONGS_TO_TABLE; CREATE SEQUENCE PUBLIC.SYSTEM_SEQUENCE_DE308617_1B9B_4AE3_B100_D1A43104975E START WITH 1 BELONGS_TO_TABLE; CREATE SEQUENCE PUBLIC.SYSTEM_SEQUENCE_0B14B766_3CF8_473F_9E96_DC4FC29FA614 START WITH 7 BELONGS_TO_TABLE; CREATE SEQUENCE PUBLIC.SYSTEM_SEQUENCE_3B589423_1230_4E9B_ACD0_341B8889AAE7 START WITH 5 BELONGS_TO_TABLE; CREATE SEQUENCE PUBLIC.SYSTEM_SEQUENCE_5C973384_5DE4_4899_917C_590E44C01936 START WITH 27 BELONGS_TO_TABLE; CREATE CACHED TABLE PUBLIC.ACCT_AUTHORITY( ID BIGINT DEFAULT (NEXT VALUE FOR PUBLIC.SYSTEM_SEQUENCE_3B589423_1230_4E9B_ACD0_341B8889AAE7) NOT NULL NULL_TO_DEFAULT SEQUENCE PUBLIC.SYSTEM_SEQUENCE_3B589423_1230_4E9B_ACD0_341B8889AAE7, NAME VARCHAR(255) NOT NULL ); ALTER TABLE PUBLIC.ACCT_AUTHORITY ADD CONSTRAINT PUBLIC.CONSTRAINT_4 PRIMARY KEY(ID); -- 4 +/- SELECT COUNT(*) FROM PUBLIC.ACCT_AUTHORITY; INSERT INTO PUBLIC.ACCT_AUTHORITY(ID, NAME) VALUES (1, STRINGDECODE('\u6d4f\u89c8\u7528\u6237')), (2, STRINGDECODE('\u4fee\u6539\u7528\u6237')), (3, STRINGDECODE('\u6d4f\u89c8\u89d2\u8272')), (4, STRINGDECODE('\u4fee\u6539\u89d2\u8272')); CREATE CACHED TABLE PUBLIC.ACCT_ROLE( ID BIGINT DEFAULT (NEXT VALUE FOR PUBLIC.SYSTEM_SEQUENCE_10F9D54E_B243_42B9_9CD4_A4F6044ACD97) NOT NULL NULL_TO_DEFAULT SEQUENCE PUBLIC.SYSTEM_SEQUENCE_10F9D54E_B243_42B9_9CD4_A4F6044ACD97, NAME VARCHAR(255) NOT NULL ); ALTER TABLE PUBLIC.ACCT_ROLE ADD CONSTRAINT PUBLIC.CONSTRAINT_42 PRIMARY KEY(ID); -- 2 +/- SELECT COUNT(*) FROM PUBLIC.ACCT_ROLE; INSERT INTO PUBLIC.ACCT_ROLE(ID, NAME) VALUES (1, STRINGDECODE('\u7ba1\u7406\u5458')), (2, STRINGDECODE('\u7528\u6237')); CREATE CACHED TABLE PUBLIC.ACCT_ROLE_AUTHORITY( ROLE_ID BIGINT NOT NULL, AUTHORITY_ID BIGINT NOT NULL ); -- 6 +/- SELECT COUNT(*) FROM PUBLIC.ACCT_ROLE_AUTHORITY; INSERT INTO PUBLIC.ACCT_ROLE_AUTHORITY(ROLE_ID, AUTHORITY_ID) VALUES (1, 1), (1, 2), (1, 3), (1, 4), (2, 1), (2, 3); CREATE CACHED TABLE PUBLIC.ACCT_USER( ID BIGINT DEFAULT (NEXT VALUE FOR PUBLIC.SYSTEM_SEQUENCE_0B14B766_3CF8_473F_9E96_DC4FC29FA614) NOT NULL NULL_TO_DEFAULT SEQUENCE PUBLIC.SYSTEM_SEQUENCE_0B14B766_3CF8_473F_9E96_DC4FC29FA614, EMAIL VARCHAR(255), LOGIN_NAME VARCHAR(255) NOT NULL, NAME VARCHAR(255), PASSWORD VARCHAR(255) ); ALTER TABLE PUBLIC.ACCT_USER ADD CONSTRAINT PUBLIC.CONSTRAINT_424A PRIMARY KEY(ID); -- 6 +/- SELECT COUNT(*) FROM PUBLIC.ACCT_USER; INSERT INTO PUBLIC.ACCT_USER(ID, EMAIL, LOGIN_NAME, NAME, PASSWORD) VALUES (1, 'jianggl88@163.com', 'admin', 'Admin', 'admin'), (2, 'user@163.com', 'user', 'User', 'user'), (3, 'jack@163.com', 'user2', 'Jack', 'user2'), (4, 'kate@163.com', 'user3', 'Kate', 'user3'), (5, 'sawyer@163.com', 'user4', 'Sawyer', 'user4'), (6, 'ben@163.com', 'user5', 'Ben', 'user5'); CREATE CACHED TABLE PUBLIC.ACCT_USER_ROLE( USER_ID BIGINT NOT NULL, ROLE_ID BIGINT NOT NULL ); -- 7 +/- SELECT COUNT(*) FROM PUBLIC.ACCT_USER_ROLE; INSERT INTO PUBLIC.ACCT_USER_ROLE(USER_ID, ROLE_ID) VALUES (1, 1), (1, 2), (2, 2), (3, 2), (4, 2), (5, 2), (6, 2); CREATE CACHED TABLE PUBLIC.CLUB_MEMBER( ID BIGINT DEFAULT (NEXT VALUE FOR PUBLIC.SYSTEM_SEQUENCE_5C973384_5DE4_4899_917C_590E44C01936) NOT NULL NULL_TO_DEFAULT SEQUENCE PUBLIC.SYSTEM_SEQUENCE_5C973384_5DE4_4899_917C_590E44C01936, NAME VARCHAR(255), NC VARCHAR(255), PARNTS VARCHAR(255), PID VARCHAR(255), SJHM VARCHAR(255), YHZH VARCHAR(255) ); ALTER TABLE PUBLIC.CLUB_MEMBER ADD CONSTRAINT PUBLIC.CONSTRAINT_A PRIMARY KEY(ID); -- 2 +/- SELECT COUNT(*) FROM PUBLIC.CLUB_MEMBER; INSERT INTO PUBLIC.CLUB_MEMBER(ID, NAME, NC, PARNTS, PID, SJHM, YHZH) VALUES (21, STRINGDECODE('\u848b\u6839\u4eae'), 'genliang', NULL, '', '13917965535', '12345623'), (25, 'f3==', '2', NULL, '', 'sdf', 'f2--'); CREATE CACHED TABLE PUBLIC.FINANCIAL( ID BIGINT DEFAULT (NEXT VALUE FOR PUBLIC.SYSTEM_SEQUENCE_DE308617_1B9B_4AE3_B100_D1A43104975E) NOT NULL NULL_TO_DEFAULT SEQUENCE PUBLIC.SYSTEM_SEQUENCE_DE308617_1B9B_4AE3_B100_D1A43104975E, CZJE INTEGER, CZSJ TIMESTAMP, MEM_ID BIGINT ); ALTER TABLE PUBLIC.FINANCIAL ADD CONSTRAINT PUBLIC.CONSTRAINT_B PRIMARY KEY(ID); -- 0 +/- SELECT COUNT(*) FROM PUBLIC.FINANCIAL; ALTER TABLE PUBLIC.ACCT_ROLE ADD CONSTRAINT PUBLIC.CONSTRAINT_424 UNIQUE(NAME); ALTER TABLE PUBLIC.ACCT_USER ADD CONSTRAINT PUBLIC.CONSTRAINT_424A2 UNIQUE(LOGIN_NAME); ALTER TABLE PUBLIC.ACCT_AUTHORITY ADD CONSTRAINT PUBLIC.CONSTRAINT_49 UNIQUE(NAME); ALTER TABLE PUBLIC.ACCT_USER_ROLE ADD CONSTRAINT PUBLIC.FKFE85CB3EDE3FB930 FOREIGN KEY(ROLE_ID) REFERENCES PUBLIC.ACCT_ROLE(ID) NOCHECK; ALTER TABLE PUBLIC.ACCT_ROLE_AUTHORITY ADD CONSTRAINT PUBLIC.FKAE2434663FE97564 FOREIGN KEY(AUTHORITY_ID) REFERENCES PUBLIC.ACCT_AUTHORITY(ID) NOCHECK; ALTER TABLE PUBLIC.ACCT_USER_ROLE ADD CONSTRAINT PUBLIC.FKFE85CB3E836A7D10 FOREIGN KEY(USER_ID) REFERENCES PUBLIC.ACCT_USER(ID) NOCHECK; ALTER TABLE PUBLIC.ACCT_ROLE_AUTHORITY ADD CONSTRAINT PUBLIC.FKAE243466DE3FB930 FOREIGN KEY(ROLE_ID) REFERENCES PUBLIC.ACCT_ROLE(ID) NOCHECK;
CREATE PROCEDURE sp_ser_list_warrantiedTasks(@ManufacturerID int, @DATE datetime) AS Begin SELECT SID.Product_Code, Items.ProductName, SID.Product_Specification1, SID.TaskID, TaskMaster.Description 'TaskName', (select Prefix from VoucherPrefix where TranID='JOBCARD') + cast(JCA.DocumentID as varchar(50)) 'JobCardID', JCA.JobCardDate, JCD.ActualCharge, Case SIA.ServiceType When 1 Then 'Paid on Charge' When 2 Then 'Warranty Service' When 3 Then 'Estimation Required' End As ServiceType FROM ServiceInvoiceAbstract SIA INNER JOIN ServiceInvoiceDetail SID ON SIA.ServiceInvoiceID = SID.ServiceInvoiceID INNER JOIN JobCardAbstract JCA ON SIA.JobcardID = JCA.JobCardID INNER JOIN JobCardDetail JCD ON SIA.JobcardID = JCD.JobCardID and SID.Product_Code = JCD.Product_Code and SID.TaskID = JCD.TaskID and SID.Product_Specification1 = JCD.Product_Specification1 INNER JOIN Items ON SID.Product_Code = Items.Product_Code and Items.ManufacturerID = @ManufacturerID INNER JOIN TaskMaster ON SID.TaskID = TaskMaster.TaskID LEFT OUTER JOIN (Select BP.Batch_Code, BP.Product_Code from Batch_Products BP INNER JOIN GRNAbstract GRN ON GRN.GRNID = BP.GRN_ID) BATCH ON SID.Product_Code = BATCH.Product_Code AND SID.Batch_Code = BATCH.Batch_Code WHERE (SID.Chargeable = 0 OR SID.Warranty = 1) --Items may be non chargeable or Warranttied AND Isnull(SID.TaskID, '') <> '' and Isnull(SID.SpareCode, '') = '' -- to select the tasks... AND (JCD.Chargeable = 0 OR JCD.Warranty = 1) --Items may be non chargeable or Warranttied AND (Isnull(JCD.TaskID, '') <> '' and Isnull(JCD.SpareCode, '') = '') -- to select the tasks... AND (SIA.ServiceType = 2 OR SIA.ServiceType = 3) --Warranty Service (2) And Estimation Requied (3) will be allowed to Claim AND (SIA.Status & 128) <> 128 AND (SIA.Status & 64) <> 64 AND (IsNull(SID.Batch_Code,0) = 0 OR IsNull(BATCH.Batch_Code,0) <> 0) --to check whether the task for the jobcard is already Claimed or not... AND (Select Count(*) from ClaimsDetail CD, ClaimsNote CN where CN.ClaimID = CD.ClaimID AND CN.Status & 192 <> 192 AND SIA.JobCardId = CD.JobCardId AND SID.Product_Code = CD.Product_Code AND SID.TaskID = CD.TaskID) = 0 GROUP BY SID.Product_Code, SID.Product_Specification1, Items.ProductName, SID.TaskID, TaskMaster.Description, JCA.DocumentID, JCA.JobCardDate, JCD.ActualCharge, SIA.ServiceType ORDER BY JCA.DocumentID End
CREATE DATABASE python_test; CREATE TABLE santa_list( "id" serial primary key, "name" VARCHAR(255), "is_nice" boolean ); INSERT INTO santa_list("name","is_nice")VALUES('Dave',TRUE); INSERT INTO santa_list("name","is_nice")VALUES('Evan',TRUE); INSERT INTO santa_list("name","is_nice")VALUES('Luke',FALSE); INSERT INTO santa_list("name","is_nice")VALUES('Iris',TRUE); INSERT INTO santa_list("name","is_nice")VALUES('Ayriel',FALSE);
CREATE TABLE scientific_degree ( id SERIAL PRIMARY KEY, name VARCHAR(50) NOT NULL, name_eng VARCHAR(50) NOT NULL DEFAULT '', abbr VARCHAR(15) NOT NULL ); ALTER TABLE scientific_degree ADD CONSTRAINT uk_scientific_degree_name UNIQUE (name); -- ALTER SEQUENCE scientific_degree_id_seq OWNED BY scientific_degree.id; -- ALTER TABLE ONLY scientific_degree ALTER COLUMN id SET DEFAULT nextval('scientific_degree_id_seq'::regclass); INSERT INTO scientific_degree(name, abbr, name_eng) VALUES ('доктор технічних наук', 'д.т.н.', 'Doctor of Technical Science'); INSERT INTO scientific_degree(name, abbr, name_eng) VALUES ('доктор фізико-математичних наук', 'д.ф-м.н.', 'Doctor of Physical-Mathematical Science'); INSERT INTO scientific_degree(name, abbr, name_eng) VALUES ('доктор хіміних наук', 'д.т.н.', 'Doctor of Chemical Science'); ALTER TABLE teacher ADD COLUMN academic_title VARCHAR(25); ALTER TABLE teacher ADD COLUMN scientific_degree_id INTEGER; ALTER TABLE teacher DROP COLUMN scientific_degree; ALTER TABLE teacher ADD CONSTRAINT FK_teacher_scientific_degree FOREIGN KEY (scientific_degree_id) references scientific_degree; ALTER TABLE specialization DROP COLUMN applying_knowledge_and_understanding_outcomes; ALTER TABLE specialization DROP COLUMN applying_knowledge_and_understanding_outcomes_eng; ALTER TABLE specialization DROP COLUMN knowledge_and_understanding_outcomes; ALTER TABLE specialization DROP COLUMN knowledge_and_understanding_outcomes_eng; ALTER TABLE specialization DROP COLUMN making_judgements_outcomes_eng; ALTER TABLE specialization DROP COLUMN making_judgements_outcomes; ALTER TABLE specialization ADD COLUMN program_head_id INTEGER; ALTER TABLE specialization ADD CONSTRAINT FK_teacher_program_head FOREIGN KEY (program_head_id) references teacher;
CREATE OR REPLACE PUBLIC SYNONYM life_policy_pkg FOR orient.life_policy_pkg;
ALTER TABLE Users CHANGE MiddleName Initial VARCHAR(64);
create or replace PROCEDURE ACTUALIZA_ALUMNOS( w_OID_A IN Alumnos.OID_A%TYPE, w_Escuela IN Alumnos.Escuela%Type, w_Edad IN Alumnos.Edad%TYPE ) IS BEGIN UPDATE ALUMNOS SET EDAD = w_Edad WHERE w_OID_A = OID_A; UPDATE ALUMNOS SET ESCUELA = w_Escuela WHERE w_OID_A = OID_A; END ACTUALIZA_ALUMNOS; / CREATE OR REPLACE PROCEDURE ACTUALIZA_USUARIOS( w_OID_U IN Usuarios.OID_U%TYPE, w_Email IN Usuarios.Email%TYPE, w_OID_Z IN Usuarios.OID_Z%TYPE, w_Telefono IN Usuarios.Telefono%TYPE ) IS BEGIN UPDATE USUARIOS SET EMAIL = w_Email WHERE w_OID_U = OID_U; UPDATE USUARIOS SET OID_Z = w_OID_Z WHERE w_OID_U = OID_U; UPDATE USUARIOS SET TELEFONO = w_Telefono WHERE w_OID_U = OID_U; END ACTUALIZA_USUARIOS; / CREATE OR REPLACE PROCEDURE ACTUALIZA_ASIGNATURAS( W_OID_ASIG IN ASIGNATURAS.OID_ASIG%TYPE, W_Nombre IN ASIGNATURAS.CURSO%TYPE ) IS BEGIN UPDATE ASIGNATURAS SET Nombre = W_Nombre WHERE W_OID_ASIG = OID_ASIG; END ACTUALIZA_ASIGNATURAS; / CREATE OR REPLACE PROCEDURE ACTUALIZA_FACTURAS( W_OID_F IN FACTURAS.OID_F%TYPE, W_FECHADEPAGO IN FACTURAS.FECHADEPAGO%TYPE, W_PAGADO IN FACTURAS.PAGADO%TYPE ) IS BEGIN UPDATE FACTURAS SET FECHADEPAGO = W_FECHADEPAGO WHERE W_OID_F = OID_F; UPDATE FACTURAS SET PAGADO = W_PAGADO WHERE W_OID_F = OID_F; END ACTUALIZA_FACTURAS; / CREATE OR REPLACE PROCEDURE ACTUALIZA_MATRICULAS( W_OID_MAT IN MATRICULAS.OID_MAT%TYPE, W_EVALUACION IN MATRICULAS.EVALUACION%TYPE ) IS BEGIN UPDATE MATRICULAS SET EVALUACION = W_EVALUACION WHERE W_OID_MAT = OID_MAT; END ACTUALIZA_MATRICULAS; / CREATE OR REPLACE PROCEDURE ACTUALIZA_SALARIOS( W_OID_S IN SALARIOS.OID_S%TYPE, W_SALARIO_MES IN SALARIOS.SALARIO_MES%TYPE, W_MES IN SALARIOS.MES%TYPE ) IS BEGIN UPDATE SALARIOS SET SALARIO_MES = W_SALARIO_MES WHERE W_OID_S = OID_S; UPDATE SALARIOS SET MES = W_MES WHERE W_OID_S = OID_S; END ACTUALIZA_SALARIOS; / CREATE OR REPLACE PROCEDURE ACTUALIZA_ZONARESIDENCIAS( W_OID_Z IN ZONARESIDENCIAS.OID_Z%TYPE, W_NOMBREZONA IN ZONARESIDENCIAS.NOMBREZONA%TYPE, W_PROVINCIA IN ZONARESIDENCIAS.PROVINCIA%TYPE) IS BEGIN UPDATE ZONARESIDENCIAS SET NOMBREZONA = W_NOMBREZONA WHERE W_OID_Z = OID_Z; UPDATE ZONARESIDENCIAS SET PROVINCIA = W_PROVINCIA WHERE W_OID_Z = OID_Z; END ACTUALIZA_ZONARESIDENCIAS;
-- phpMyAdmin SQL Dump -- version 3.4.5 -- http://www.phpmyadmin.net -- -- Host: localhost -- Generation Time: Jan 20, 2012 at 03:28 AM -- Server version: 5.5.16 -- PHP Version: 5.3.8 SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8 */; -- -- Database: `evd` -- -- -------------------------------------------------------- -- -- Table structure for table `wp_evd_legislators` -- CREATE TABLE IF NOT EXISTS `wp_evd_legislators` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(255) NOT NULL, `partei` varchar(10) NOT NULL, `state` varchar(2) NOT NULL, `email` varchar(255) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=515 ; -- -- Dumping data for table `wp_evd_legislators` -- INSERT INTO `wp_evd_legislators` (`id`, `name`, `partei`, `state`, `email`) VALUES (2, 'ABELARDO LUPION', 'DEM', 'PR', 'dep.abelardolupion@camara.gov.br'), (3, 'ACELINO POPÓ', 'PRB', 'BA', 'dep.acelinopopo@camara.gov.br'), (4, 'ADEMIR CAMILO', 'PDT', 'MG', 'dep.ademircamilo@camara.gov.br'), (5, 'ADRIAN', 'PMDB', 'RJ', 'dep.adrian@camara.gov.br'), (6, 'AELTON FREITAS', 'PR', 'MG', 'dep.aeltonfreitas@camara.gov.br'), (7, 'AFONSO HAMM', 'PP', 'RS', 'dep.afonsohamm@camara.gov.br'), (8, 'AGUINALDO RIBEIRO', 'PP', 'PB', 'dep.aguinaldoribeiro@camara.gov.br'), (9, 'ALBERTO FILHO', 'PMDB', 'MA', 'dep.albertofilho@camara.gov.br'), (10, 'ALBERTO MOURÃO', 'PSDB', 'SP', 'dep.albertomourao@camara.gov.br'), (11, 'ALCEU MOREIRA', 'PMDB', 'RS', 'dep.alceumoreira@camara.gov.br'), (12, 'ALDO REBELO', 'PCdoB', 'SP', 'dep.aldorebelo@camara.gov.br'), (13, 'ALESSANDRO MOLON', 'PT', 'RJ', 'dep.alessandromolon@camara.gov.br'), (14, 'ALEX CANZIANI', 'PTB', 'PR', 'dep.alexcanziani@camara.gov.br'), (15, 'ALEXANDRE LEITE', 'DEM', 'SP', 'dep.alexandreleite@camara.gov.br'), (16, 'ALEXANDRE ROSO', 'PSB', 'RS', 'dep.alexandreroso@camara.gov.br'), (17, 'ALEXANDRE SANTOS', 'PMDB', 'RJ', 'dep.alexandresantos@camara.gov.br'), (18, 'ALFREDO KAEFER', 'PSDB', 'PR', 'dep.alfredokaefer@camara.gov.br'), (19, 'ALFREDO SIRKIS', 'PV', 'RJ', 'dep.alfredosirkis@camara.gov.br'), (20, 'ALICE PORTUGAL', 'PCdoB', 'BA', 'dep.aliceportugal@camara.gov.br'), (21, 'ALINE CORRÊA', 'PP', 'SP', 'dep.alinecorrea@camara.gov.br'), (22, 'ALMEIDA LIMA', 'PMDB', 'SE', 'dep.almeidalima@camara.gov.br'), (23, 'AMAURI TEIXEIRA', 'PT', 'BA', 'dep.amauriteixeira@camara.gov.br'), (24, 'ANA ARRAES', 'PSB', 'PE', 'dep.anaarraes@camara.gov.br'), (25, 'ANDERSON FERREIRA', 'PR', 'PE', 'dep.andersonferreira@camara.gov.br'), (26, 'ANDRÉ DIAS', 'PSDB', 'PA', 'dep.andredias@camara.gov.br'), (27, 'ANDRÉ FIGUEIREDO', 'PDT', 'CE', 'dep.andrefigueiredo@camara.gov.br'), (28, 'ANDRE MOURA', 'PSC', 'SE', 'dep.andremoura@camara.gov.br'), (29, 'ANDRE VARGAS', 'PT', 'PR', 'dep.andrevargas@camara.gov.br'), (30, 'ANDRÉ ZACHAROW', 'PMDB', 'PR', 'dep.andrezacharow@camara.gov.br'), (31, 'ANDREIA ZITO', 'PSDB', 'RJ', 'dep.andreiazito@camara.gov.br'), (32, 'ÂNGELO AGNOLIN', 'PDT', 'TO', 'dep.angeloagnolin@camara.gov.br'), (33, 'ANGELO VANHONI', 'PT', 'PR', 'dep.angelovanhoni@camara.gov.br'), (34, 'ANÍBAL GOMES', 'PMDB', 'CE', 'dep.anibalgomes@camara.gov.br'), (35, 'ANTHONY GAROTINHO', 'PR', 'RJ', 'dep.anthonygarotinho@camara.gov.br'), (36, 'ANTÔNIA LÚCIA', 'PSC', 'AC', 'dep.antonialucia@camara.gov.br'), (37, 'ANTÔNIO ANDRADE', 'PMDB', 'MG', 'dep.antonioandrade@camara.gov.br'), (38, 'ANTONIO BALHMANN', 'PSB', 'CE', 'dep.antoniobalhmann@camara.gov.br'), (39, 'ANTONIO BRITO', 'PTB', 'BA', 'dep.antoniobrito@camara.gov.br'), (40, 'ANTONIO BULHÕES', 'PRB', 'SP', 'dep.antoniobulhoes@camara.gov.br'), (41, 'ANTONIO CARLOS MAGALHÃES NETO', 'DEM', 'BA', 'dep.antoniocarlosmagalhaesneto@camara.gov.br'), (42, 'ANTONIO CARLOS MENDES THAME', 'PSDB', 'SP', 'dep.antoniocarlosmendesthame@camara.gov.br'), (43, 'ANTONIO IMBASSAHY', 'PSDB', 'BA', 'dep.antonioimbassahy@camara.gov.br'), (44, 'ANTÔNIO ROBERTO', 'PV', 'MG', 'dep.antonioroberto@camara.gov.br'), (45, 'ARACELY DE PAULA', 'PR', 'MG', 'dep.aracelydepaula@camara.gov.br'), (46, 'ARIOSTO HOLANDA', 'PSB', 'CE', 'dep.ariostoholanda@camara.gov.br'), (47, 'ARLINDO CHINAGLIA', 'PT', 'SP', 'dep.arlindochinaglia@camara.gov.br'), (48, 'ARMANDO VERGÍLIO', 'PMN', 'GO', 'dep.armandovergilio@camara.gov.br'), (49, 'ARNALDO FARIA DE SÁ', 'PTB', 'SP', 'dep.arnaldofariadesa@camara.gov.br'), (50, 'ARNALDO JARDIM', 'PPS', 'SP', 'dep.arnaldojardim@camara.gov.br'), (51, 'ARNALDO JORDY', 'PPS', 'PA', 'dep.arnaldojordy@camara.gov.br'), (52, 'ARNON BEZERRA', 'PTB', 'CE', 'dep.arnonbezerra@camara.gov.br'), (53, 'AROLDE DE OLIVEIRA', 'DEM', 'RJ', 'dep.aroldedeoliveira@camara.gov.br'), (54, 'ARTHUR LIRA', 'PP', 'AL', 'dep.arthurlira@camara.gov.br'), (55, 'ARTHUR OLIVEIRA MAIA', 'PMDB', 'BA', 'dep.arthuroliveiramaia@camara.gov.br'), (56, 'ARTUR BRUNO', 'PT', 'CE', 'dep.arturbruno@camara.gov.br'), (57, 'ASDRUBAL BENTES', 'PMDB', 'PA', 'dep.asdrubalbentes@camara.gov.br'), (58, 'ASSIS CARVALHO', 'PT', 'PI', 'dep.assiscarvalho@camara.gov.br'), (59, 'ASSIS DO COUTO', 'PT', 'PR', 'dep.assisdocouto@camara.gov.br'), (60, 'ASSIS MELO', 'PCdoB', 'RS', 'dep.assismelo@camara.gov.br'), (61, 'ÁTILA LINS', 'PMDB', 'AM', 'dep.atilalins@camara.gov.br'), (62, 'AUDIFAX', 'PSB', 'ES', 'dep.audifax@camara.gov.br'), (63, 'AUGUSTO CARVALHO', 'PPS', 'DF', 'dep.augustocarvalho@camara.gov.br'), (64, 'AUGUSTO COUTINHO', 'DEM', 'PE', 'dep.augustocoutinho@camara.gov.br'), (65, 'AUREO', 'PRTB', 'RJ', 'dep.aureo@camara.gov.br'), (66, 'BENEDITA DA SILVA', 'PT', 'RJ', 'dep.beneditadasilva@camara.gov.br'), (67, 'BENJAMIN MARANHÃO', 'PMDB', 'PB', 'dep.benjaminmaranhao@camara.gov.br'), (68, 'BERINHO BANTIM', 'PSDB', 'RR', 'dep.berinhobantim@camara.gov.br'), (69, 'BERNARDO SANTANA DE VASCONCELLOS', 'PR', 'MG', 'dep.bernardosantanadevasconcellos@camara.gov.br'), (70, 'BETO FARO', 'PT', 'PA', 'dep.betofaro@camara.gov.br'), (71, 'BETO MANSUR', 'PP', 'SP', 'dep.betomansur@camara.gov.br'), (72, 'BIFFI', 'PT', 'MS', 'dep.biffi@camara.gov.br'), (73, 'BOHN GASS', 'PT', 'RS', 'dep.bohngass@camara.gov.br'), (74, 'BONIFÁCIO DE ANDRADA', 'PSDB', 'MG', 'dep.bonifaciodeandrada@camara.gov.br'), (75, 'BRIZOLA NETO', 'PDT', 'RJ', 'dep.brizolaneto@camara.gov.br'), (76, 'BRUNA FURLAN', 'PSDB', 'SP', 'dep.brunafurlan@camara.gov.br'), (77, 'BRUNO ARAÚJO', 'PSDB', 'PE', 'dep.brunoaraujo@camara.gov.br'), (78, 'CAMILO COLA', 'PMDB', 'ES', 'dep.camilocola@camara.gov.br'), (79, 'CÂNDIDO VACCAREZZA', 'PT', 'SP', 'dep.candidovaccarezza@camara.gov.br'), (80, 'CARLAILE PEDROSA', 'PSDB', 'MG', 'dep.carlailepedrosa@camara.gov.br'), (81, 'CARLINHOS ALMEIDA', 'PT', 'SP', 'dep.carlinhosalmeida@camara.gov.br'), (82, 'CARLOS ALBERTO LERÉIA', 'PSDB', 'GO', 'dep.carlosalbertolereia@camara.gov.br'), (83, 'CARLOS BEZERRA', 'PMDB', 'MT', 'dep.carlosbezerra@camara.gov.br'), (84, 'CARLOS BRANDÃO', 'PSDB', 'MA', 'dep.carlosbrandao@camara.gov.br'), (85, 'CARLOS EDUARDO CADOCA', 'PSC', 'PE', 'dep.carloseduardocadoca@camara.gov.br'), (86, 'CARLOS MAGNO', 'PP', 'RO', 'dep.carlosmagno@camara.gov.br'), (87, 'CARLOS ROBERTO', 'PSDB', 'SP', 'dep.carlosroberto@camara.gov.br'), (88, 'CARLOS SAMPAIO', 'PSDB', 'SP', 'dep.carlossampaio@camara.gov.br'), (89, 'CARLOS SOUZA', 'PP', 'AM', 'dep.carlossouza@camara.gov.br'), (90, 'CARLOS ZARATTINI', 'PT', 'SP', 'dep.carloszarattini@camara.gov.br'), (91, 'CARMEN ZANOTTO', 'PPS', 'SC', 'dep.carmenzanotto@camara.gov.br'), (92, 'CELIA ROCHA', 'PTB', 'AL', 'dep.celiarocha@camara.gov.br'), (93, 'CELSO MALDANER', 'PMDB', 'SC', 'dep.celsomaldaner@camara.gov.br'), (94, 'CESAR COLNAGO', 'PSDB', 'ES', 'dep.cesarcolnago@camara.gov.br'), (95, 'CÉSAR HALUM', 'PPS', 'TO', 'dep.cesarhalum@camara.gov.br'), (96, 'CHICO ALENCAR', 'PSOL', 'RJ', 'dep.chicoalencar@camara.gov.br'), (97, 'CHICO D''ANGELO', 'PT', 'RJ', 'dep.chicodangelo@camara.gov.br'), (98, 'CHICO LOPES', 'PCdoB', 'CE', 'dep.chicolopes@camara.gov.br'), (99, 'CIDA BORGHETTI', 'PP', 'PR', 'dep.cidaborghetti@camara.gov.br'), (100, 'CLAUDIO CAJADO', 'DEM', 'BA', 'dep.claudiocajado@camara.gov.br'), (101, 'CLÁUDIO PUTY', 'PT', 'PA', 'dep.claudioputy@camara.gov.br'), (102, 'CLEBER VERDE', 'PRB', 'MA', 'dep.cleberverde@camara.gov.br'), (103, 'COSTA FERREIRA', 'PSC', 'MA', 'dep.costaferreira@camara.gov.br'), (104, 'DALVA FIGUEIREDO', 'PT', 'AP', 'dep.dalvafigueiredo@camara.gov.br'), (105, 'DAMIÃO FELICIANO', 'PDT', 'PB', 'dep.damiaofeliciano@camara.gov.br'), (106, 'DANIEL ALMEIDA', 'PCdoB', 'BA', 'dep.danielalmeida@camara.gov.br'), (107, 'DANILO FORTE', 'PMDB', 'CE', 'dep.daniloforte@camara.gov.br'), (108, 'DANRLEI DE DEUS HINTERHOLZ', 'PTB', 'RS', 'dep.danrleidedeushinterholz@camara.gov.br'), (109, 'DARCÍSIO PERONDI', 'PMDB', 'RS', 'dep.darcisioperondi@camara.gov.br'), (110, 'DAVI ALCOLUMBRE', 'DEM', 'AP', 'dep.davialcolumbre@camara.gov.br'), (111, 'DAVI ALVES SILVA JÚNIOR', 'PR', 'MA', 'dep.davialvessilvajunior@camara.gov.br'), (112, 'DÉCIO LIMA', 'PT', 'SC', 'dep.deciolima@camara.gov.br'), (113, 'DELEGADO PROTÓGENES', 'PCdoB', 'SP', 'dep.delegadoprotogenes@camara.gov.br'), (114, 'DELEY', 'PSC', 'RJ', 'dep.deley@camara.gov.br'), (115, 'DEVANIR RIBEIRO', 'PT', 'SP', 'dep.devanirribeiro@camara.gov.br'), (116, 'DIEGO ANDRADE', 'PR', 'MG', 'dep.diegoandrade@camara.gov.br'), (117, 'DILCEU SPERAFICO', 'PP', 'PR', 'dep.dilceusperafico@camara.gov.br'), (118, 'DIMAS FABIANO', 'PP', 'MG', 'dep.dimasfabiano@camara.gov.br'), (119, 'DIMAS RAMALHO', 'PPS', 'SP', 'dep.dimasramalho@camara.gov.br'), (120, 'DOMINGOS DUTRA', 'PT', 'MA', 'dep.domingosdutra@camara.gov.br'), (121, 'DOMINGOS NETO', 'PSB', 'CE', 'dep.domingosneto@camara.gov.br'), (122, 'DOMINGOS SÁVIO', 'PSDB', 'MG', 'dep.domingossavio@camara.gov.br'), (123, 'DR. ADILSON SOARES', 'PR', 'RJ', 'dep.dr.adilsonsoares@camara.gov.br'), (124, 'DR. ALUIZIO', 'PV', 'RJ', 'dep.dr.aluizio@camara.gov.br'), (125, 'DR. CARLOS ALBERTO', 'PMN', 'RJ', 'dep.dr.carlosalberto@camara.gov.br'), (126, 'DR. GRILO', 'PSL', 'MG', 'dep.dr.grilo@camara.gov.br'), (127, 'DR. JORGE SILVA', 'PDT', 'ES', 'dep.dr.jorgesilva@camara.gov.br'), (128, 'DR. PAULO CÉSAR', 'PR', 'RJ', 'dep.dr.paulocesar@camara.gov.br'), (129, 'DR. ROSINHA', 'PT', 'PR', 'dep.dr.rosinha@camara.gov.br'), (130, 'DR. UBIALI', 'PSB', 'SP', 'dep.dr.ubiali@camara.gov.br'), (131, 'DRA. ELAINE ABISSAMRA', 'PSB', 'SP', 'dep.dra.elaineabissamra@camara.gov.br'), (132, 'DUARTE NOGUEIRA', 'PSDB', 'SP', 'dep.duartenogueira@camara.gov.br'), (133, 'EDINHO ARAÚJO', 'PMDB', 'SP', 'dep.edinhoaraujo@camara.gov.br'), (134, 'EDINHO BEZ', 'PMDB', 'SC', 'dep.edinhobez@camara.gov.br'), (135, 'EDIO LOPES', 'PMDB', 'RR', 'dep.ediolopes@camara.gov.br'), (136, 'EDIVALDO HOLANDA JUNIOR', 'PTC', 'MA', 'dep.edivaldoholandajunior@camara.gov.br'), (137, 'EDMAR ARRUDA', 'PSC', 'PR', 'dep.edmararruda@camara.gov.br'), (138, 'EDSON EZEQUIEL', 'PMDB', 'RJ', 'dep.edsonezequiel@camara.gov.br'), (139, 'EDSON PIMENTA', 'PCdoB', 'BA', 'dep.edsonpimenta@camara.gov.br'), (140, 'EDSON SANTOS', 'PT', 'RJ', 'dep.edsonsantos@camara.gov.br'), (141, 'EDSON SILVA', 'PSB', 'CE', 'dep.edsonsilva@camara.gov.br'), (142, 'EDUARDO AZEREDO', 'PSDB', 'MG', 'dep.eduardoazeredo@camara.gov.br'), (143, 'EDUARDO BARBOSA', 'PSDB', 'MG', 'dep.eduardobarbosa@camara.gov.br'), (144, 'EDUARDO CUNHA', 'PMDB', 'RJ', 'dep.eduardocunha@camara.gov.br'), (145, 'EDUARDO DA FONTE', 'PP', 'PE', 'dep.eduardodafonte@camara.gov.br'), (146, 'EDUARDO GOMES', 'PSDB', 'TO', 'dep.eduardogomes@camara.gov.br'), (147, 'EDUARDO SCIARRA', 'DEM', 'PR', 'dep.eduardosciarra@camara.gov.br'), (148, 'EFRAIM FILHO', 'DEM', 'PB', 'dep.efraimfilho@camara.gov.br'), (149, 'ELCIONE BARBALHO', 'PMDB', 'PA', 'dep.elcionebarbalho@camara.gov.br'), (150, 'ELEUSES PAIVA', 'DEM', 'SP', 'dep.eleusespaiva@camara.gov.br'), (151, 'ELI CORREA FILHO', 'DEM', 'SP', 'dep.elicorreafilho@camara.gov.br'), (152, 'ELIANE ROLIM', 'PT', 'RJ', 'dep.elianerolim@camara.gov.br'), (153, 'ELISEU PADILHA', 'PMDB', 'RS', 'dep.eliseupadilha@camara.gov.br'), (154, 'EMILIANO JOSÉ', 'PT', 'BA', 'dep.emilianojose@camara.gov.br'), (155, 'ENIO BACCI', 'PDT', 'RS', 'dep.eniobacci@camara.gov.br'), (156, 'ERIKA KOKAY', 'PT', 'DF', 'dep.erikakokay@camara.gov.br'), (157, 'ERIVELTON SANTANA', 'PSC', 'BA', 'dep.eriveltonsantana@camara.gov.br'), (158, 'EROS BIONDINI', 'PTB', 'MG', 'dep.erosbiondini@camara.gov.br'), (159, 'ESPERIDIÃO AMIN', 'PP', 'SC', 'dep.esperidiaoamin@camara.gov.br'), (160, 'EUDES XAVIER', 'PT', 'CE', 'dep.eudesxavier@camara.gov.br'), (161, 'EVANDRO MILHOMEN', 'PCdoB', 'AP', 'dep.evandromilhomen@camara.gov.br'), (162, 'FÁBIO FARIA', 'PMN', 'RN', 'dep.fabiofaria@camara.gov.br'), (163, 'FÁBIO RAMALHO', 'PV', 'MG', 'dep.fabioramalho@camara.gov.br'), (164, 'FÁBIO SOUTO', 'DEM', 'BA', 'dep.fabiosouto@camara.gov.br'), (165, 'FABIO TRAD', 'PMDB', 'MS', 'dep.fabiotrad@camara.gov.br'), (166, 'FÁTIMA BEZERRA', 'PT', 'RN', 'dep.fatimabezerra@camara.gov.br'), (167, 'FÁTIMA PELAES', 'PMDB', 'AP', 'dep.fatimapelaes@camara.gov.br'), (168, 'FELIPE BORNIER', 'PHS', 'RJ', 'dep.felipebornier@camara.gov.br'), (169, 'FELIPE MAIA', 'DEM', 'RN', 'dep.felipemaia@camara.gov.br'), (170, 'FÉLIX MENDONÇA JÚNIOR', 'PDT', 'BA', 'dep.felixmendoncajunior@camara.gov.br'), (171, 'FERNANDO COELHO FILHO', 'PSB', 'PE', 'dep.fernandocoelhofilho@camara.gov.br'), (172, 'FERNANDO FERRO', 'PT', 'PE', 'dep.fernandoferro@camara.gov.br'), (173, 'FERNANDO FRANCISCHINI', 'PSDB', 'PR', 'dep.fernandofrancischini@camara.gov.br'), (174, 'FERNANDO JORDÃO', 'PMDB', 'RJ', 'dep.fernandojordao@camara.gov.br'), (175, 'FERNANDO MARRONI', 'PT', 'RS', 'dep.fernandomarroni@camara.gov.br'), (176, 'FERNANDO TORRES', 'DEM', 'BA', 'dep.fernandotorres@camara.gov.br'), (177, 'FILIPE PEREIRA', 'PSC', 'RJ', 'dep.filipepereira@camara.gov.br'), (178, 'FLÁVIA MORAIS', 'PDT', 'GO', 'dep.flaviamorais@camara.gov.br'), (179, 'FLAVIANO MELO', 'PMDB', 'AC', 'dep.flavianomelo@camara.gov.br'), (180, 'FRANCISCO ARAÚJO', 'PSL', 'RR', 'dep.franciscoaraujo@camara.gov.br'), (181, 'FRANCISCO ESCÓRCIO', 'PMDB', 'MA', 'dep.franciscoescorcio@camara.gov.br'), (182, 'FRANCISCO FLORIANO', 'PR', 'RJ', 'dep.franciscofloriano@camara.gov.br'), (183, 'FRANCISCO PRACIANO', 'PT', 'AM', 'dep.franciscopraciano@camara.gov.br'), (184, 'GABRIEL CHALITA', 'PMDB', 'SP', 'dep.gabrielchalita@camara.gov.br'), (185, 'GABRIEL GUIMARÃES', 'PT', 'MG', 'dep.gabrielguimaraes@camara.gov.br'), (186, 'GASTÃO VIEIRA', 'PMDB', 'MA', 'dep.gastaovieira@camara.gov.br'), (187, 'GEAN LOUREIRO', 'PMDB', 'SC', 'dep.geanloureiro@camara.gov.br'), (188, 'GENECIAS NORONHA', 'PMDB', 'CE', 'dep.geneciasnoronha@camara.gov.br'), (189, 'GEORGE HILTON', 'PRB', 'MG', 'dep.georgehilton@camara.gov.br'), (190, 'GERALDO RESENDE', 'PMDB', 'MS', 'dep.geraldoresende@camara.gov.br'), (191, 'GERALDO SIMÕES', 'PT', 'BA', 'dep.geraldosimoes@camara.gov.br'), (192, 'GERALDO THADEU', 'PPS', 'MG', 'dep.geraldothadeu@camara.gov.br'), (193, 'GIACOBO', 'PR', 'PR', 'dep.giacobo@camara.gov.br'), (194, 'GILMAR MACHADO', 'PT', 'MG', 'dep.gilmarmachado@camara.gov.br'), (195, 'GIOVANI CHERINI', 'PDT', 'RS', 'dep.giovanicherini@camara.gov.br'), (196, 'GIOVANNI QUEIROZ', 'PDT', 'PA', 'dep.giovanniqueiroz@camara.gov.br'), (197, 'GIROTO', 'PR', 'MS', 'dep.giroto@camara.gov.br'), (198, 'GIVALDO CARIMBÃO', 'PSB', 'AL', 'dep.givaldocarimbao@camara.gov.br'), (199, 'GLADSON CAMELI', 'PP', 'AC', 'dep.gladsoncameli@camara.gov.br'), (200, 'GLAUBER BRAGA', 'PSB', 'RJ', 'dep.glauberbraga@camara.gov.br'), (201, 'GONZAGA PATRIOTA', 'PSB', 'PE', 'dep.gonzagapatriota@camara.gov.br'), (202, 'GORETE PEREIRA', 'PR', 'CE', 'dep.goretepereira@camara.gov.br'), (203, 'GUILHERME CAMPOS', 'DEM', 'SP', 'dep.guilhermecampos@camara.gov.br'), (204, 'GUILHERME MUSSI', 'PV', 'SP', 'dep.guilhermemussi@camara.gov.br'), (205, 'HELENO SILVA', 'PRB', 'SE', 'dep.helenosilva@camara.gov.br'), (206, 'HÉLIO SANTOS', 'PSDB', 'MA', 'dep.heliosantos@camara.gov.br'), (207, 'HENRIQUE AFONSO', 'PV', 'AC', 'dep.henriqueafonso@camara.gov.br'), (208, 'HENRIQUE EDUARDO ALVES', 'PMDB', 'RN', 'dep.henriqueeduardoalves@camara.gov.br'), (209, 'HENRIQUE FONTANA', 'PT', 'RS', 'dep.henriquefontana@camara.gov.br'), (210, 'HENRIQUE OLIVEIRA', 'PR', 'AM', 'dep.henriqueoliveira@camara.gov.br'), (211, 'HERMES PARCIANELLO', 'PMDB', 'PR', 'dep.hermesparcianello@camara.gov.br'), (212, 'HEULER CRUVINEL', 'DEM', 'GO', 'dep.heulercruvinel@camara.gov.br'), (213, 'HOMERO PEREIRA', 'PR', 'MT', 'dep.homeropereira@camara.gov.br'), (214, 'HUGO LEAL', 'PSC', 'RJ', 'dep.hugoleal@camara.gov.br'), (215, 'HUGO MOTTA', 'PMDB', 'PB', 'dep.hugomotta@camara.gov.br'), (216, 'HUGO NAPOLEÃO', 'DEM', 'PI', 'dep.hugonapoleao@camara.gov.br'), (217, 'INOCÊNCIO OLIVEIRA', 'PR', 'PE', 'dep.inocenciooliveira@camara.gov.br'), (218, 'IRACEMA PORTELLA', 'PP', 'PI', 'dep.iracemaportella@camara.gov.br'), (219, 'IRAJÁ ABREU', 'DEM', 'TO', 'dep.irajaabreu@camara.gov.br'), (220, 'ÍRIS DE ARAÚJO', 'PMDB', 'GO', 'dep.irisdearaujo@camara.gov.br'), (221, 'IVAN VALENTE', 'PSOL', 'SP', 'dep.ivanvalente@camara.gov.br'), (222, 'IZALCI', 'PR', 'DF', 'dep.izalci@camara.gov.br'), (223, 'JAIME MARTINS', 'PR', 'MG', 'dep.jaimemartins@camara.gov.br'), (224, 'JAIR BOLSONARO', 'PP', 'RJ', 'dep.jairbolsonaro@camara.gov.br'), (225, 'JAIRO ATAÍDE', 'DEM', 'MG', 'dep.jairoataide@camara.gov.br'), (226, 'JANDIRA FEGHALI', 'PCdoB', 'RJ', 'dep.jandirafeghali@camara.gov.br'), (227, 'JANETE CAPIBERIBE', 'PSB', 'AP', 'dep.janetecapiberibe@camara.gov.br'), (228, 'JANETE ROCHA PIETÁ', 'PT', 'SP', 'dep.janeterochapieta@camara.gov.br'), (229, 'JÂNIO NATAL', 'PRP', 'BA', 'dep.janionatal@camara.gov.br'), (230, 'JAQUELINE RORIZ', 'PMN', 'DF', 'dep.jaquelineroriz@camara.gov.br'), (231, 'JEAN WYLLYS', 'PSOL', 'RJ', 'dep.jeanwyllys@camara.gov.br'), (232, 'JEFFERSON CAMPOS', 'PSB', 'SP', 'dep.jeffersoncampos@camara.gov.br'), (233, 'JERÔNIMO GOERGEN', 'PP', 'RS', 'dep.jeronimogoergen@camara.gov.br'), (234, 'JESUS RODRIGUES', 'PT', 'PI', 'dep.jesusrodrigues@camara.gov.br'), (235, 'JHONATAN DE JESUS', 'PRB', 'RR', 'dep.jhonatandejesus@camara.gov.br'), (236, 'JILMAR TATTO', 'PT', 'SP', 'dep.jilmartatto@camara.gov.br'), (237, 'JÔ MORAES', 'PCdoB', 'MG', 'dep.jomoraes@camara.gov.br'), (238, 'JOÃO ANANIAS', 'PCdoB', 'CE', 'dep.joaoananias@camara.gov.br'), (239, 'JOÃO ARRUDA', 'PMDB', 'PR', 'dep.joaoarruda@camara.gov.br'), (240, 'JOÃO BITTAR', 'DEM', 'MG', 'dep.joaobittar@camara.gov.br'), (241, 'JOÃO CAMPOS', 'PSDB', 'GO', 'dep.joaocampos@camara.gov.br'), (242, 'JOÃO CARLOS BACELAR', 'PR', 'BA', 'dep.joaocarlosbacelar@camara.gov.br'), (243, 'JOÃO DADO', 'PDT', 'SP', 'dep.joaodado@camara.gov.br'), (244, 'JOÃO LYRA', 'PTB', 'AL', 'dep.joaolyra@camara.gov.br'), (245, 'JOÃO MAGALHÃES', 'PMDB', 'MG', 'dep.joaomagalhaes@camara.gov.br'), (246, 'JOÃO MAIA', 'PR', 'RN', 'dep.joaomaia@camara.gov.br'), (247, 'JOÃO PAULO CUNHA', 'PT', 'SP', 'dep.joaopaulocunha@camara.gov.br'), (248, 'JOÃO PAULO LIMA', 'PT', 'PE', 'dep.joaopaulolima@camara.gov.br'), (249, 'JOÃO PIZZOLATTI', 'PP', 'SC', 'dep.joaopizzolatti@camara.gov.br'), (250, 'JOAQUIM BELTRÃO', 'PMDB', 'AL', 'dep.joaquimbeltrao@camara.gov.br'), (251, 'JONAS DONIZETTE', 'PSB', 'SP', 'dep.jonasdonizette@camara.gov.br'), (252, 'JORGE BOEIRA', 'PT', 'SC', 'dep.jorgeboeira@camara.gov.br'), (253, 'JORGE CORTE REAL', 'PTB', 'PE', 'dep.jorgecortereal@camara.gov.br'), (254, 'JORGE TADEU MUDALEN', 'DEM', 'SP', 'dep.jorgetadeumudalen@camara.gov.br'), (255, 'JORGINHO MELLO', 'PSDB', 'SC', 'dep.jorginhomello@camara.gov.br'), (256, 'JOSÉ AIRTON', 'PT', 'CE', 'dep.joseairton@camara.gov.br'), (257, 'JOSÉ AUGUSTO MAIA', 'PTB', 'PE', 'dep.joseaugustomaia@camara.gov.br'), (258, 'JOSÉ CARLOS ARAÚJO', 'PDT', 'BA', 'dep.josecarlosaraujo@camara.gov.br'), (259, 'JOSÉ CHAVES', 'PTB', 'PE', 'dep.josechaves@camara.gov.br'), (260, 'JOSÉ DE FILIPPI', 'PT', 'SP', 'dep.josedefilippi@camara.gov.br'), (261, 'JOSÉ GUIMARÃES', 'PT', 'CE', 'dep.joseguimaraes@camara.gov.br'), (262, 'JOSÉ HUMBERTO', 'PHS', 'MG', 'dep.josehumberto@camara.gov.br'), (263, 'JOSÉ LINHARES', 'PP', 'CE', 'dep.joselinhares@camara.gov.br'), (264, 'JOSÉ MENTOR', 'PT', 'SP', 'dep.josementor@camara.gov.br'), (265, 'JOSÉ NUNES', 'DEM', 'BA', 'dep.josenunes@camara.gov.br'), (266, 'JOSÉ OTÁVIO GERMANO', 'PP', 'RS', 'dep.joseotaviogermano@camara.gov.br'), (267, 'JOSÉ PRIANTE', 'PMDB', 'PA', 'dep.josepriante@camara.gov.br'), (268, 'JOSÉ ROCHA', 'PR', 'BA', 'dep.joserocha@camara.gov.br'), (269, 'JOSE STÉDILE', 'PSB', 'RS', 'dep.josestedile@camara.gov.br'), (270, 'JOSEPH BANDEIRA', 'PT', 'BA', 'dep.josephbandeira@camara.gov.br'), (271, 'JOSIAS GOMES', 'PT', 'BA', 'dep.josiasgomes@camara.gov.br'), (272, 'JOSUÉ BENGTSON', 'PTB', 'PA', 'dep.josuebengtson@camara.gov.br'), (273, 'JOVAIR ARANTES', 'PTB', 'GO', 'dep.jovairarantes@camara.gov.br'), (274, 'JÚLIO CAMPOS', 'DEM', 'MT', 'dep.juliocampos@camara.gov.br'), (275, 'JÚLIO CESAR', 'DEM', 'PI', 'dep.juliocesar@camara.gov.br'), (276, 'JÚLIO DELGADO', 'PSB', 'MG', 'dep.juliodelgado@camara.gov.br'), (277, 'JÚNIOR COIMBRA', 'PMDB', 'TO', 'dep.juniorcoimbra@camara.gov.br'), (278, 'JUNJI ABE', 'DEM', 'SP', 'dep.junjiabe@camara.gov.br'), (279, 'JUTAHY JUNIOR', 'PSDB', 'BA', 'dep.jutahyjunior@camara.gov.br'), (280, 'KEIKO OTA', 'PSB', 'SP', 'dep.keikoota@camara.gov.br'), (281, 'LAEL VARELLA', 'DEM', 'MG', 'dep.laelvarella@camara.gov.br'), (282, 'LAERCIO OLIVEIRA', 'PR', 'SE', 'dep.laerciooliveira@camara.gov.br'), (283, 'LAUREZ MOREIRA', 'PSB', 'TO', 'dep.laurezmoreira@camara.gov.br'), (284, 'LAURIETE', 'PSC', 'ES', 'dep.lauriete@camara.gov.br'), (285, 'LÁZARO BOTELHO', 'PP', 'TO', 'dep.lazarobotelho@camara.gov.br'), (286, 'LEANDRO VILELA', 'PMDB', 'GO', 'dep.leandrovilela@camara.gov.br'), (287, 'LELO COIMBRA', 'PMDB', 'ES', 'dep.lelocoimbra@camara.gov.br'), (288, 'LEONARDO MONTEIRO', 'PT', 'MG', 'dep.leonardomonteiro@camara.gov.br'), (289, 'LEONARDO QUINTÃO', 'PMDB', 'MG', 'dep.leonardoquintao@camara.gov.br'), (290, 'LEOPOLDO MEYER', 'PSB', 'PR', 'dep.leopoldomeyer@camara.gov.br'), (291, 'LILIAM SÁ', 'PR', 'RJ', 'dep.liliamsa@camara.gov.br'), (292, 'LINCOLN PORTELA', 'PR', 'MG', 'dep.lincolnportela@camara.gov.br'), (293, 'LINDOMAR GARÇON', 'PV', 'RO', 'dep.lindomargarcon@camara.gov.br'), (294, 'LIRA MAIA', 'DEM', 'PA', 'dep.liramaia@camara.gov.br'), (295, 'LOURIVAL MENDES', 'PTdoB', 'MA', 'dep.lourivalmendes@camara.gov.br'), (296, 'LUCI CHOINACKI', 'PT', 'SC', 'dep.lucichoinacki@camara.gov.br'), (297, 'LUCIANA SANTOS', 'PCdoB', 'PE', 'dep.lucianasantos@camara.gov.br'), (298, 'LUCIANO CASTRO', 'PR', 'RR', 'dep.lucianocastro@camara.gov.br'), (299, 'LÚCIO VALE', 'PR', 'PA', 'dep.luciovale@camara.gov.br'), (300, 'LUCIO VIEIRA LIMA', 'PMDB', 'BA', 'dep.luciovieiralima@camara.gov.br'), (301, 'LUIS CARLOS HEINZE', 'PP', 'RS', 'dep.luiscarlosheinze@camara.gov.br'), (302, 'LUIS TIBÉ', 'PTdoB', 'MG', 'dep.luistibe@camara.gov.br'), (303, 'LUIZ ALBERTO', 'PT', 'BA', 'dep.luizalberto@camara.gov.br'), (304, 'LUIZ ARGÔLO', 'PP', 'BA', 'dep.luizargolo@camara.gov.br'), (305, 'LUIZ CARLOS', 'PSDB', 'AP', 'dep.luizcarlos@camara.gov.br'), (306, 'LUIZ CARLOS SETIM', 'DEM', 'PR', 'dep.luizcarlossetim@camara.gov.br'), (307, 'LUIZ COUTO', 'PT', 'PB', 'dep.luizcouto@camara.gov.br'), (308, 'LUIZ FERNANDO FARIA', 'PP', 'MG', 'dep.luizfernandofaria@camara.gov.br'), (309, 'LUIZ FERNANDO MACHADO', 'PSDB', 'SP', 'dep.luizfernandomachado@camara.gov.br'), (310, 'LUIZ NISHIMORI', 'PSDB', 'PR', 'dep.luiznishimori@camara.gov.br'), (311, 'LUIZ NOÉ', 'PSB', 'RS', 'dep.luiznoe@camara.gov.br'), (312, 'LUIZ PITIMAN', 'PMDB', 'DF', 'dep.luizpitiman@camara.gov.br'), (313, 'LUIZA ERUNDINA', 'PSB', 'SP', 'dep.luizaerundina@camara.gov.br'), (314, 'MAGDA MOFATTO', 'PTB', 'GO', 'dep.magdamofatto@camara.gov.br'), (315, 'MANATO', 'PDT', 'ES', 'dep.manato@camara.gov.br'), (316, 'MANDETTA', 'DEM', 'MS', 'dep.mandetta@camara.gov.br'), (317, 'MANOEL JUNIOR', 'PMDB', 'PB', 'dep.manoeljunior@camara.gov.br'), (318, 'MANOEL SALVIANO', 'PSDB', 'CE', 'dep.manoelsalviano@camara.gov.br'), (319, 'MANUELA D''ÁVILA', 'PCdoB', 'RS', 'dep.manueladavila@camara.gov.br'), (320, 'MARA GABRILLI', 'PSDB', 'SP', 'dep.maragabrilli@camara.gov.br'), (321, 'MARÇAL FILHO', 'PMDB', 'MS', 'dep.marcalfilho@camara.gov.br'), (322, 'MARCELO AGUIAR', 'PSC', 'SP', 'dep.marceloaguiar@camara.gov.br'), (323, 'MARCELO CASTRO', 'PMDB', 'PI', 'dep.marcelocastro@camara.gov.br'), (324, 'MARCELO MATOS', 'PDT', 'RJ', 'dep.marcelomatos@camara.gov.br'), (325, 'MARCIO BITTAR', 'PSDB', 'AC', 'dep.marciobittar@camara.gov.br'), (326, 'MÁRCIO MACÊDO', 'PT', 'SE', 'dep.marciomacedo@camara.gov.br'), (327, 'MÁRCIO MARINHO', 'PRB', 'BA', 'dep.marciomarinho@camara.gov.br'), (328, 'MÁRCIO REINALDO MOREIRA', 'PP', 'MG', 'dep.marcioreinaldomoreira@camara.gov.br'), (329, 'MARCO MAIA', 'PT', 'RS', 'dep.marcomaia@camara.gov.br'), (330, 'MARCON', 'PT', 'RS', 'dep.marcon@camara.gov.br'), (331, 'MARCOS MEDRADO', 'PDT', 'BA', 'dep.marcosmedrado@camara.gov.br'), (332, 'MARCOS MONTES', 'DEM', 'MG', 'dep.marcosmontes@camara.gov.br'), (333, 'MARCUS PESTANA', 'PSDB', 'MG', 'dep.marcuspestana@camara.gov.br'), (334, 'MARINA SANTANNA', 'PT', 'GO', 'dep.marinasantanna@camara.gov.br'), (335, 'MARINHA RAUPP', 'PMDB', 'RO', 'dep.marinharaupp@camara.gov.br'), (336, 'MÁRIO DE OLIVEIRA', 'PSC', 'MG', 'dep.mariodeoliveira@camara.gov.br'), (337, 'MARLLOS SAMPAIO', 'PMDB', 'PI', 'dep.marllossampaio@camara.gov.br'), (338, 'MAURÍCIO QUINTELLA LESSA', 'PR', 'AL', 'dep.mauricioquintellalessa@camara.gov.br'), (339, 'MAURÍCIO TRINDADE', 'PR', 'BA', 'dep.mauriciotrindade@camara.gov.br'), (340, 'MAURO BENEVIDES', 'PMDB', 'CE', 'dep.maurobenevides@camara.gov.br'), (341, 'MAURO LOPES', 'PMDB', 'MG', 'dep.maurolopes@camara.gov.br'), (342, 'MAURO MARIANI', 'PMDB', 'SC', 'dep.mauromariani@camara.gov.br'), (343, 'MAURO NAZIF', 'PSB', 'RO', 'dep.mauronazif@camara.gov.br'), (344, 'MENDONÇA FILHO', 'DEM', 'PE', 'dep.mendoncafilho@camara.gov.br'), (345, 'MENDONÇA PRADO', 'DEM', 'SE', 'dep.mendoncaprado@camara.gov.br'), (346, 'MIGUEL CORRÊA', 'PT', 'MG', 'dep.miguelcorrea@camara.gov.br'), (347, 'MILTON MONTI', 'PR', 'SP', 'dep.miltonmonti@camara.gov.br'), (348, 'MIRIQUINHO BATISTA', 'PT', 'PA', 'dep.miriquinhobatista@camara.gov.br'), (349, 'MIRO TEIXEIRA', 'PDT', 'RJ', 'dep.miroteixeira@camara.gov.br'), (350, 'MISSIONÁRIO JOSÉ OLIMPIO', 'PP', 'SP', 'dep.missionariojoseolimpio@camara.gov.br'), (351, 'MOACIR MICHELETTO', 'PMDB', 'PR', 'dep.moacirmicheletto@camara.gov.br'), (352, 'MOREIRA MENDES', 'PPS', 'RO', 'dep.moreiramendes@camara.gov.br'), (353, 'NATAN DONADON', 'PMDB', 'RO', 'dep.natandonadon@camara.gov.br'), (354, 'NAZARENO FONTELES', 'PT', 'PI', 'dep.nazarenofonteles@camara.gov.br'), (355, 'NEILTON MULIM', 'PR', 'RJ', 'dep.neiltonmulim@camara.gov.br'), (356, 'NELSON BORNIER', 'PMDB', 'RJ', 'dep.nelsonbornier@camara.gov.br'), (357, 'NELSON MARCHEZAN JUNIOR', 'PSDB', 'RS', 'dep.nelsonmarchezanjunior@camara.gov.br'), (358, 'NELSON MARQUEZELLI', 'PTB', 'SP', 'dep.nelsonmarquezelli@camara.gov.br'), (359, 'NELSON MEURER', 'PP', 'PR', 'dep.nelsonmeurer@camara.gov.br'), (360, 'NELSON PADOVANI', 'PSC', 'PR', 'dep.nelsonpadovani@camara.gov.br'), (361, 'NELSON PELLEGRINO', 'PT', 'BA', 'dep.nelsonpellegrino@camara.gov.br'), (362, 'NERI GELLER', 'PP', 'MT', 'dep.nerigeller@camara.gov.br'), (363, 'NEWTON CARDOSO', 'PMDB', 'MG', 'dep.newtoncardoso@camara.gov.br'), (364, 'NEWTON LIMA', 'PT', 'SP', 'dep.newtonlima@camara.gov.br'), (365, 'NICE LOBÃO', 'DEM', 'MA', 'dep.nicelobao@camara.gov.br'), (366, 'NILDA GONDIM', 'PMDB', 'PB', 'dep.nildagondim@camara.gov.br'), (367, 'NILSON LEITÃO', 'PSDB', 'MT', 'dep.nilsonleitao@camara.gov.br'), (368, 'NILTON CAPIXABA', 'PTB', 'RO', 'dep.niltoncapixaba@camara.gov.br'), (369, 'ODAIR CUNHA', 'PT', 'MG', 'dep.odaircunha@camara.gov.br'), (370, 'ONOFRE SANTO AGOSTINI', 'DEM', 'SC', 'dep.onofresantoagostini@camara.gov.br'), (371, 'ONYX LORENZONI', 'DEM', 'RS', 'dep.onyxlorenzoni@camara.gov.br'), (372, 'OSMAR JÚNIOR', 'PCdoB', 'PI', 'dep.osmarjunior@camara.gov.br'), (373, 'OSMAR SERRAGLIO', 'PMDB', 'PR', 'dep.osmarserraglio@camara.gov.br'), (374, 'OSMAR TERRA', 'PMDB', 'RS', 'dep.osmarterra@camara.gov.br'), (375, 'OTAVIO LEITE', 'PSDB', 'RJ', 'dep.otavioleite@camara.gov.br'), (376, 'OTONIEL LIMA', 'PRB', 'SP', 'dep.otoniellima@camara.gov.br'), (377, 'OZIEL OLIVEIRA', 'PDT', 'BA', 'dep.ozieloliveira@camara.gov.br'), (378, 'PADRE JOÃO', 'PT', 'MG', 'dep.padrejoao@camara.gov.br'), (379, 'PADRE TON', 'PT', 'RO', 'dep.padreton@camara.gov.br'), (380, 'PAES LANDIM', 'PTB', 'PI', 'dep.paeslandim@camara.gov.br'), (381, 'PASTOR EURICO', 'PSB', 'PE', 'dep.pastoreurico@camara.gov.br'), (382, 'PASTOR MARCO FELICIANO', 'PSC', 'SP', 'dep.pastormarcofeliciano@camara.gov.br'), (383, 'PAUDERNEY AVELINO', 'DEM', 'AM', 'dep.pauderneyavelino@camara.gov.br'), (384, 'PAULO ABI-ACKEL', 'PSDB', 'MG', 'dep.pauloabiackel@camara.gov.br'), (385, 'PAULO CESAR QUARTIERO', 'DEM', 'RR', 'dep.paulocesarquartiero@camara.gov.br'), (386, 'PAULO FEIJÓ', 'PR', 'RJ', 'dep.paulofeijo@camara.gov.br'), (387, 'PAULO FOLETTO', 'PSB', 'ES', 'dep.paulofoletto@camara.gov.br'), (388, 'PAULO FREIRE', 'PR', 'SP', 'dep.paulofreire@camara.gov.br'), (389, 'PAULO MAGALHÃES', 'DEM', 'BA', 'dep.paulomagalhaes@camara.gov.br'), (390, 'PAULO MALUF', 'PP', 'SP', 'dep.paulomaluf@camara.gov.br'), (391, 'PAULO PEREIRA DA SILVA', 'PDT', 'SP', 'dep.paulopereiradasilva@camara.gov.br'), (392, 'PAULO PIAU', 'PMDB', 'MG', 'dep.paulopiau@camara.gov.br'), (393, 'PAULO PIMENTA', 'PT', 'RS', 'dep.paulopimenta@camara.gov.br'), (394, 'PAULO RUBEM SANTIAGO', 'PDT', 'PE', 'dep.paulorubemsantiago@camara.gov.br'), (395, 'PAULO TEIXEIRA', 'PT', 'SP', 'dep.pauloteixeira@camara.gov.br'), (396, 'PAULO WAGNER', 'PV', 'RN', 'dep.paulowagner@camara.gov.br'), (397, 'PEDRO CHAVES', 'PMDB', 'GO', 'dep.pedrochaves@camara.gov.br'), (398, 'PEDRO EUGÊNIO', 'PT', 'PE', 'dep.pedroeugenio@camara.gov.br'), (399, 'PEDRO UCZAI', 'PT', 'SC', 'dep.pedrouczai@camara.gov.br'), (400, 'PENNA', 'PV', 'SP', 'dep.penna@camara.gov.br'), (401, 'PEPE VARGAS', 'PT', 'RS', 'dep.pepevargas@camara.gov.br'), (402, 'PERPÉTUA ALMEIDA', 'PCdoB', 'AC', 'dep.perpetuaalmeida@camara.gov.br'), (403, 'PINTO ITAMARATY', 'PSDB', 'MA', 'dep.pintoitamaraty@camara.gov.br'), (404, 'POLICARPO', 'PT', 'DF', 'dep.policarpo@camara.gov.br'), (405, 'PROFESSOR SETIMO', 'PMDB', 'MA', 'dep.professorsetimo@camara.gov.br'), (406, 'PROFESSORA DORINHA SEABRA REZENDE', 'DEM', 'TO', 'dep.professoradorinhaseabrarezende@camara.gov.br'), (407, 'RAIMUNDÃO', 'PMDB', 'CE', 'dep.raimundao@camara.gov.br'), (408, 'RAIMUNDO GOMES DE MATOS', 'PSDB', 'CE', 'dep.raimundogomesdematos@camara.gov.br'), (409, 'RATINHO JUNIOR', 'PSC', 'PR', 'dep.ratinhojunior@camara.gov.br'), (410, 'RAUL HENRY', 'PMDB', 'PE', 'dep.raulhenry@camara.gov.br'), (411, 'RAUL LIMA', 'PP', 'RR', 'dep.raullima@camara.gov.br'), (412, 'REBECCA GARCIA', 'PP', 'AM', 'dep.rebeccagarcia@camara.gov.br'), (413, 'REGINALDO LOPES', 'PT', 'MG', 'dep.reginaldolopes@camara.gov.br'), (414, 'REGUFFE', 'PDT', 'DF', 'dep.reguffe@camara.gov.br'), (415, 'REINALDO AZAMBUJA', 'PSDB', 'MS', 'dep.reinaldoazambuja@camara.gov.br'), (416, 'REINHOLD STEPHANES', 'PMDB', 'PR', 'dep.reinholdstephanes@camara.gov.br'), (417, 'RENAN FILHO', 'PMDB', 'AL', 'dep.renanfilho@camara.gov.br'), (418, 'RENATO MOLLING', 'PP', 'RS', 'dep.renatomolling@camara.gov.br'), (419, 'RENZO BRAZ', 'PP', 'MG', 'dep.renzobraz@camara.gov.br'), (420, 'RIBAMAR ALVES', 'PSB', 'MA', 'dep.ribamaralves@camara.gov.br'), (421, 'RICARDO BERZOINI', 'PT', 'SP', 'dep.ricardoberzoini@camara.gov.br'), (422, 'RICARDO IZAR', 'PV', 'SP', 'dep.ricardoizar@camara.gov.br'), (423, 'RICARDO TRIPOLI', 'PSDB', 'SP', 'dep.ricardotripoli@camara.gov.br'), (424, 'ROBERTO BALESTRA', 'PP', 'GO', 'dep.robertobalestra@camara.gov.br'), (425, 'ROBERTO BRITTO', 'PP', 'BA', 'dep.robertobritto@camara.gov.br'), (426, 'ROBERTO DE LUCENA', 'PV', 'SP', 'dep.robertodelucena@camara.gov.br'), (427, 'ROBERTO DORNER', 'PP', 'MT', 'dep.robertodorner@camara.gov.br'), (428, 'ROBERTO FREIRE', 'PPS', 'SP', 'dep.robertofreire@camara.gov.br'), (429, 'ROBERTO SANTIAGO', 'PV', 'SP', 'dep.robertosantiago@camara.gov.br'), (430, 'ROBERTO TEIXEIRA', 'PP', 'PE', 'dep.robertoteixeira@camara.gov.br'), (431, 'RODRIGO DE CASTRO', 'PSDB', 'MG', 'dep.rodrigodecastro@camara.gov.br'), (432, 'RODRIGO MAIA', 'DEM', 'RJ', 'dep.rodrigomaia@camara.gov.br'), (433, 'ROGÉRIO CARVALHO', 'PT', 'SE', 'dep.rogeriocarvalho@camara.gov.br'), (434, 'ROGÉRIO MARINHO', 'PSDB', 'RN', 'dep.rogeriomarinho@camara.gov.br'), (435, 'ROGÉRIO PENINHA MENDONÇA', 'PMDB', 'SC', 'dep.rogeriopeninhamendonca@camara.gov.br'), (436, 'ROMÁRIO', 'PSB', 'RJ', 'dep.romario@camara.gov.br'), (437, 'ROMERO RODRIGUES', 'PSDB', 'PB', 'dep.romerorodrigues@camara.gov.br'), (438, 'RONALDO BENEDET', 'PMDB', 'SC', 'dep.ronaldobenedet@camara.gov.br'), (439, 'RONALDO CAIADO', 'DEM', 'GO', 'dep.ronaldocaiado@camara.gov.br'), (440, 'RONALDO FONSECA', 'PR', 'DF', 'dep.ronaldofonseca@camara.gov.br'), (441, 'RONALDO NOGUEIRA', 'PTB', 'RS', 'dep.ronaldonogueira@camara.gov.br'), (442, 'RONALDO ZULKE', 'PT', 'RS', 'dep.ronaldozulke@camara.gov.br'), (443, 'ROSANE FERREIRA', 'PV', 'PR', 'dep.rosaneferreira@camara.gov.br'), (444, 'ROSE DE FREITAS', 'PMDB', 'ES', 'dep.rosedefreitas@camara.gov.br'), (445, 'ROSINHA DA ADEFAL', 'PTdoB', 'AL', 'dep.rosinhadaadefal@camara.gov.br'), (446, 'RUBENS BUENO', 'PPS', 'PR', 'dep.rubensbueno@camara.gov.br'), (447, 'RUBENS OTONI', 'PT', 'GO', 'dep.rubensotoni@camara.gov.br'), (448, 'RUI COSTA', 'PT', 'BA', 'dep.ruicosta@camara.gov.br'), (449, 'RUI PALMEIRA', 'PSDB', 'AL', 'dep.ruipalmeira@camara.gov.br'), (450, 'RUY CARNEIRO', 'PSDB', 'PB', 'dep.ruycarneiro@camara.gov.br'), (451, 'SABINO CASTELO BRANCO', 'PTB', 'AM', 'dep.sabinocastelobranco@camara.gov.br'), (452, 'SALVADOR ZIMBALDI', 'PDT', 'SP', 'dep.salvadorzimbaldi@camara.gov.br'), (453, 'SANDES JÚNIOR', 'PP', 'GO', 'dep.sandesjunior@camara.gov.br'), (454, 'SANDRA ROSADO', 'PSB', 'RN', 'dep.sandrarosado@camara.gov.br'), (455, 'SANDRO ALEX', 'PPS', 'PR', 'dep.sandroalex@camara.gov.br'), (456, 'SANDRO MABEL', 'PR', 'GO', 'dep.sandromabel@camara.gov.br'), (457, 'SARAIVA FELIPE', 'PMDB', 'MG', 'dep.saraivafelipe@camara.gov.br'), (458, 'SARNEY FILHO', 'PV', 'MA', 'dep.sarneyfilho@camara.gov.br'), (459, 'SEBASTIÃO BALA ROCHA', 'PDT', 'AP', 'dep.sebastiaobalarocha@camara.gov.br'), (460, 'SÉRGIO BARRADAS CARNEIRO', 'PT', 'BA', 'dep.sergiobarradascarneiro@camara.gov.br'), (461, 'SÉRGIO BRITO', 'PSC', 'BA', 'dep.sergiobrito@camara.gov.br'), (462, 'SERGIO GUERRA', 'PSDB', 'PE', 'dep.sergioguerra@camara.gov.br'), (463, 'SÉRGIO MORAES', 'PTB', 'RS', 'dep.sergiomoraes@camara.gov.br'), (464, 'SIBÁ MACHADO', 'PT', 'AC', 'dep.sibamachado@camara.gov.br'), (465, 'SILAS CÂMARA', 'PSC', 'AM', 'dep.silascamara@camara.gov.br'), (466, 'SILVIO COSTA', 'PTB', 'PE', 'dep.silviocosta@camara.gov.br'), (467, 'SIMÃO SESSIM', 'PP', 'RJ', 'dep.simaosessim@camara.gov.br'), (468, 'SOLANGE ALMEIDA', 'PMDB', 'RJ', 'dep.solangealmeida@camara.gov.br'), (469, 'STEPAN NERCESSIAN', 'PPS', 'RJ', 'dep.stepannercessian@camara.gov.br'), (470, 'SUELI VIDIGAL', 'PDT', 'ES', 'dep.suelividigal@camara.gov.br'), (471, 'TAKAYAMA', 'PSC', 'PR', 'dep.takayama@camara.gov.br'), (472, 'TAUMATURGO LIMA', 'PT', 'AC', 'dep.taumaturgolima@camara.gov.br'), (473, 'TERESA SURITA', 'PMDB', 'RR', 'dep.teresasurita@camara.gov.br'), (474, 'TIRIRICA', 'PR', 'SP', 'dep.tiririca@camara.gov.br'), (475, 'TONINHO PINHEIRO', 'PP', 'MG', 'dep.toninhopinheiro@camara.gov.br'), (476, 'VALADARES FILHO', 'PSB', 'SE', 'dep.valadaresfilho@camara.gov.br'), (477, 'VALDEMAR COSTA NETO', 'PR', 'SP', 'dep.valdemarcostaneto@camara.gov.br'), (478, 'VALDIR COLATTO', 'PMDB', 'SC', 'dep.valdircolatto@camara.gov.br'), (479, 'VALDIVINO DE OLIVEIRA', 'PSDB', 'GO', 'dep.valdivinodeoliveira@camara.gov.br'), (480, 'VALMIR ASSUNÇÃO', 'PT', 'BA', 'dep.valmirassuncao@camara.gov.br'), (481, 'VALTENIR PEREIRA', 'PSB', 'MT', 'dep.valtenirpereira@camara.gov.br'), (482, 'VANDER LOUBET', 'PT', 'MS', 'dep.vanderloubet@camara.gov.br'), (483, 'VANDERLEI MACRIS', 'PSDB', 'SP', 'dep.vanderleimacris@camara.gov.br'), (484, 'VAZ DE LIMA', 'PSDB', 'SP', 'dep.vazdelima@camara.gov.br'), (485, 'VICENTE ARRUDA', 'PR', 'CE', 'dep.vicentearruda@camara.gov.br'), (486, 'VICENTE CANDIDO', 'PT', 'SP', 'dep.vicentecandido@camara.gov.br'), (487, 'VICENTINHO', 'PT', 'SP', 'dep.vicentinho@camara.gov.br'), (488, 'VIEIRA DA CUNHA', 'PDT', 'RS', 'dep.vieiradacunha@camara.gov.br'), (489, 'VILALBA', 'PRB', 'PE', 'dep.vilalba@camara.gov.br'), (490, 'VILSON COVATTI', 'PP', 'RS', 'dep.vilsoncovatti@camara.gov.br'), (491, 'VINICIUS GURGEL', 'S.PART.', 'AP', 'dep.viniciusgurgel@camara.gov.br'), (492, 'VITOR PAULO', 'PRB', 'RJ', 'dep.vitorpaulo@camara.gov.br'), (493, 'VITOR PENIDO', 'DEM', 'MG', 'dep.vitorpenido@camara.gov.br'), (494, 'WALDENOR PEREIRA', 'PT', 'BA', 'dep.waldenorpereira@camara.gov.br'), (495, 'WALDIR MARANHÃO', 'PP', 'MA', 'dep.waldirmaranhao@camara.gov.br'), (496, 'WALNEY ROCHA', 'PTB', 'RJ', 'dep.walneyrocha@camara.gov.br'), (497, 'WALTER IHOSHI', 'DEM', 'SP', 'dep.walterihoshi@camara.gov.br'), (498, 'WALTER TOSTA', 'PMN', 'MG', 'dep.waltertosta@camara.gov.br'), (499, 'WANDENKOLK GONÇALVES', 'PSDB', 'PA', 'dep.wandenkolkgoncalves@camara.gov.br'), (500, 'WASHINGTON REIS', 'PMDB', 'RJ', 'dep.washingtonreis@camara.gov.br'), (501, 'WELITON PRADO', 'PT', 'MG', 'dep.welitonprado@camara.gov.br'), (502, 'WELLINGTON FAGUNDES', 'PR', 'MT', 'dep.wellingtonfagundes@camara.gov.br'), (503, 'WELLINGTON ROBERTO', 'PR', 'PB', 'dep.wellingtonroberto@camara.gov.br'), (504, 'WILLIAM DIB', 'PSDB', 'SP', 'dep.williamdib@camara.gov.br'), (505, 'WILSON FILHO', 'PMDB', 'PB', 'dep.wilsonfilho@camara.gov.br'), (506, 'WLADIMIR COSTA', 'PMDB', 'PA', 'dep.wladimircosta@camara.gov.br'), (507, 'WOLNEY QUEIROZ', 'PDT', 'PE', 'dep.wolneyqueiroz@camara.gov.br'), (508, 'ZÉ GERALDO', 'PT', 'PA', 'dep.zegeraldo@camara.gov.br'), (509, 'ZÉ SILVA', 'PDT', 'MG', 'dep.zesilva@camara.gov.br'), (510, 'ZÉ VIEIRA', 'PR', 'MA', 'dep.zevieira@camara.gov.br'), (511, 'ZECA DIRCEU', 'PT', 'PR', 'dep.zecadirceu@camara.gov.br'), (512, 'ZENALDO COUTINHO', 'PSDB', 'PA', 'dep.zenaldocoutinho@camara.gov.br'), (513, 'ZEQUINHA MARINHO', 'PSC', 'PA', 'dep.zequinhamarinho@camara.gov.br'), (514, 'ZOINHO', 'PR', 'RJ', 'dep.zoinho@camara.gov.br'); /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
Create Procedure mERP_getReportDesc @ReportName nvarchar(max) AS BEGIN If exists (Select top 1 XMLReportCode from reports_to_upload where reportname =@reportname) BEGIN Select top 1 XMLReportCode from reports_to_upload where reportname =@reportname END ELSE BEGIN Select top 1 XMLReportCode from tbl_mERP_OtherReportsUpload where reportname =@reportname END END
CREATE VIEW [TimeManagement].[VI_Turbine] AS SELECT [PK_Id], [TurbineName] FROM [Turbine]
[getRpuData] SELECT mu.name, faas.barangay, SUM(IF(rpu.rputype = 'land',1,0)) AS LAND, SUM(IF(rpu.rputype = 'bldg',1,0)) AS BLDG, SUM(IF(rpu.rputype = 'misc',1,0)) AS MISC, SUM(IF(rpu.rputype = 'planttree',1,0)) AS PLANTTREE, SUM(IF(rpu.rputype = 'mach',1,0)) AS MACH, SUM(IF(rpu.rputype = 'land',rpu.totalareaha,0)) AS LANDTOTALAREAHA, SUM(IF(rpu.rputype = 'bldg',rpu.totalareaha,0)) AS BLDGTOTALAREAHA, SUM(IF(rpu.rputype = 'misc',rpu.totalareaha,0)) AS MISCTOTALAREAHA, SUM(IF(rpu.rputype = 'planttree',rpu.totalareaha,0)) AS PLANTTREETOTALAREAHA, SUM(IF(rpu.rputype = 'mach',rpu.totalareaha,0)) AS MACHTOTALAREAHA, SUM(IF(rpu.rputype = 'land',rpu.totalareasqm,0)) AS LANDTOTALAREASQM, SUM(IF(rpu.rputype = 'bldg',rpu.totalareasqm,0)) AS BLDGTOTALAREASQM, SUM(IF(rpu.rputype = 'misc',rpu.totalareasqm,0)) AS MISCTOTALAREASQM, SUM(IF(rpu.rputype = 'planttree',rpu.totalareasqm,0)) AS PLANTTREETOTALAREASQM, SUM(IF(rpu.rputype = 'mach',rpu.totalareasqm,0)) AS MACHTOTALAREASQM, SUM(IF(rpu.rputype = 'land',rpu.totalbmv,0)) AS LANDTOTALBMV, SUM(IF(rpu.rputype = 'bldg',rpu.totalbmv,0)) AS BLDGTOTALBMV, SUM(IF(rpu.rputype = 'misc',rpu.totalbmv,0)) AS MISCTOTALBMV, SUM(IF(rpu.rputype = 'planttree',rpu.totalbmv,0)) AS PLANTTREETOTALBMV, SUM(IF(rpu.rputype = 'mach',rpu.totalbmv,0)) AS MACHTOTALBMV, SUM(IF(rpu.rputype = 'land',rpu.totalmv,0)) AS LANDTOTALMV, SUM(IF(rpu.rputype = 'bldg',rpu.totalmv,0)) AS BLDGTOTALMV, SUM(IF(rpu.rputype = 'misc',rpu.totalmv,0)) AS MISCTOTALMV, SUM(IF(rpu.rputype = 'planttree',rpu.totalmv,0)) AS PLANTTREETOTALMV, SUM(IF(rpu.rputype = 'mach',rpu.totalmv,0)) AS MACHTOTALMV, SUM(IF(rpu.rputype = 'land',rpu.totalav,0)) AS LANDTOTALAV, SUM(IF(rpu.rputype = 'bldg',rpu.totalav,0)) AS BLDGTOTALAV, SUM(IF(rpu.rputype = 'misc',rpu.totalav,0)) AS MISCTOTALAV, SUM(IF(rpu.rputype = 'planttree',rpu.totalav,0)) AS PLANTTREETOTALAV, SUM(IF(rpu.rputype = 'mach',rpu.totalav,0)) AS MACHTOTALAV FROM faas_list faas INNER JOIN municipality mu ON mu.objid = faas.lguid INNER JOIN rpu rpu ON rpu.objid = faas.rpuid WHERE faas.state = "CURRENT" GROUP BY mu.name, faas.barangay ORDER BY mu.name; [getDashrputypecount] SELECT mu.name, faas.barangay, SUM(IF(rpu.rputype = 'land',1,0)) AS LAND, SUM(IF(rpu.rputype = 'bldg',1,0)) AS BLDG, SUM(IF(rpu.rputype = 'misc',1,0)) AS MISC, SUM(IF(rpu.rputype = 'planttree',1,0)) AS PLANTTREE, SUM(IF(rpu.rputype = 'mach',1,0)) AS MACH FROM faas_list faas INNER JOIN municipality mu ON mu.objid = faas.lguid INNER JOIN rpu rpu ON rpu.objid = faas.rpuid WHERE faas.state = "CURRENT" GROUP BY mu.name, faas.barangay ORDER BY mu.name; [getRPUType] SELECT lgu.name AS LGU, SUM(IF(rpu.rputype='land',1,0)) AS LAND, SUM(IF(rpu.rputype='bldg',1,0)) AS BLDG, SUM(IF(rpu.rputype='misc',1,0)) AS MISC, SUM(IF(rpu.rputype='mach',1,0)) AS MACH, SUM(IF(rpu.rputype='planttree',1,0)) AS PLANTTREE FROM `faas_list` fl INNER JOIN municipality lgu ON lgu.objid = fl.`lguid` INNER JOIN barangay bar ON bar.`objid` = fl.`barangayid` INNER JOIN rpu ON rpu.`objid` = fl.`rpuid` WHERE fl.`state` = 'CURRENT' GROUP BY lgu.`name` ORDER BY lgu.`name`, bar.`name`, rpu.`rputype` ; ####################### -- TOTAL Hectare RPU -- ####################### [getTotalHr] SELECT mu.name, SUM(IF(rpu.rputype = 'land',rpu.totalareaha,0)) AS LAND, SUM(IF(rpu.rputype = 'bldg',rpu.totalareaha,0)) AS BLDG, SUM(IF(rpu.rputype = 'misc',rpu.totalareaha,0)) AS MISC, SUM(IF(rpu.rputype = 'planttree',rpu.totalareaha,0)) AS PLANTTREE, SUM(IF(rpu.rputype = 'mach',rpu.totalareaha,0)) AS MACH FROM faas_list faas INNER JOIN municipality mu ON mu.objid = faas.lguid INNER JOIN rpu rpu ON rpu.objid = faas.rpuid WHERE faas.state = "CURRENT" GROUP BY mu.name ORDER BY mu.name; -- SELECT -- lgu.name AS LGU, -- -- bar.name AS BARANGAY, -- SUM(IF(rpu.rputype='land',rpu.`totalareaha`,0)) AS LAND, -- SUM(IF(rpu.rputype='bldg',rpu.`totalareaha`,0)) AS BLDG, -- SUM(IF(rpu.rputype='misc',rpu.`totalareaha`,0)) AS MISC, -- SUM(IF(rpu.rputype='mach',rpu.`totalareaha`,0)) AS MACH, -- SUM(IF(rpu.rputype='planttree',rpu.`totalareaha`,0)) AS PLANTTREE -- FROM `faas_list` fl -- INNER JOIN municipality lgu ON lgu.objid = fl.`lguid` -- INNER JOIN barangay bar ON bar.`objid` = fl.`barangayid` -- INNER JOIN rpu ON rpu.`objid` = fl.`rpuid` -- WHERE fl.`state` = 'CURRENT' -- GROUP BY lgu.`name` -- ORDER BY lgu.`name` -- ; ################### -- TOTAL SQM RPU -- ################### [getTotalSQM] SELECT lgu.name AS LGU, bar.name AS BARANGAY, SUM(IF(rpu.rputype='land',rpu.`totalareasqm`,0)) AS LAND, SUM(IF(rpu.rputype='bldg',rpu.`totalareasqm`,0)) AS BLDG, SUM(IF(rpu.rputype='misc',rpu.`totalareasqm`,0)) AS MISC, SUM(IF(rpu.rputype='mach',rpu.`totalareasqm`,0)) AS MACH, SUM(IF(rpu.rputype='planttree',rpu.`totalareasqm`,0)) AS PLANTTREE FROM `faas_list` fl INNER JOIN municipality lgu ON lgu.objid = fl.`lguid` INNER JOIN barangay bar ON bar.`objid` = fl.`barangayid` INNER JOIN rpu ON rpu.`objid` = fl.`rpuid` WHERE fl.`state` = 'CURRENT' GROUP BY lgu.`name`, bar.`name` ORDER BY lgu.`name`, bar.`name`, rpu.`rputype` ; ################### -- TOTAL BMV RPU -- ################### [getTotalBMV] SELECT lgu.name AS LGU, bar.name AS BARANGAY, SUM(IF(rpu.rputype='land',rpu.`totalbmv`,0)) AS LAND, SUM(IF(rpu.rputype='bldg',rpu.`totalbmv`,0)) AS BLDG, SUM(IF(rpu.rputype='misc',rpu.`totalbmv`,0)) AS MISC, SUM(IF(rpu.rputype='mach',rpu.`totalbmv`,0)) AS MACH, SUM(IF(rpu.rputype='planttree',rpu.`totalbmv`,0)) AS PLANTTREE FROM `faas_list` fl INNER JOIN municipality lgu ON lgu.objid = fl.`lguid` INNER JOIN barangay bar ON bar.`objid` = fl.`barangayid` INNER JOIN rpu ON rpu.`objid` = fl.`rpuid` WHERE fl.`state` = 'CURRENT' GROUP BY lgu.`name`, bar.`name` ORDER BY lgu.`name`, bar.`name`, rpu.`rputype` ; ################## -- TOTAL MV RPU -- ################## [getTotalMV] SELECT lgu.name AS LGU, bar.name AS BARANGAY, SUM(IF(rpu.rputype='land',rpu.`totalmv`,0)) AS LAND, SUM(IF(rpu.rputype='bldg',rpu.`totalmv`,0)) AS BLDG, SUM(IF(rpu.rputype='misc',rpu.`totalmv`,0)) AS MISC, SUM(IF(rpu.rputype='mach',rpu.`totalmv`,0)) AS MACH, SUM(IF(rpu.rputype='planttree',rpu.`totalmv`,0)) AS PLANTTREE FROM `faas_list` fl INNER JOIN municipality lgu ON lgu.objid = fl.`lguid` INNER JOIN barangay bar ON bar.`objid` = fl.`barangayid` INNER JOIN rpu ON rpu.`objid` = fl.`rpuid` WHERE fl.`state` = 'CURRENT' GROUP BY lgu.`name`, bar.`name` ORDER BY lgu.`name`, bar.`name`, rpu.`rputype` ; ################## -- TOTAL AV RPU -- ################## [getTotalAV] SELECT lgu.name AS LGU, bar.name AS BARANGAY, SUM(IF(rpu.rputype='land',rpu.`totalav`,0)) AS LAND, SUM(IF(rpu.rputype='bldg',rpu.`totalav`,0)) AS BLDG, SUM(IF(rpu.rputype='misc',rpu.`totalav`,0)) AS MISC, SUM(IF(rpu.rputype='mach',rpu.`totalav`,0)) AS MACH, SUM(IF(rpu.rputype='planttree',rpu.`totalav`,0)) AS PLANTTREE FROM `faas_list` fl INNER JOIN municipality lgu ON lgu.objid = fl.`lguid` INNER JOIN barangay bar ON bar.`objid` = fl.`barangayid` INNER JOIN rpu ON rpu.`objid` = fl.`rpuid` WHERE fl.`state` = 'CURRENT' GROUP BY lgu.`name`, bar.`name` ORDER BY lgu.`name`, bar.`name`, rpu.`rputype` ;
-- -- Tabla: `gen_empleados` añadir columna id_departamento FOREIGN KEY de la tabla rrhh_departamento -- ALTER TABLE `gen_empleados` ADD `id_departamento` INT NULL AFTER `foto`;
/* --Version Formatted on 1/11/2017 11:18:27 AM (QP5 v5.149.1003.31008) -No change -Note: SapCare schema is considered as "SAPSR3". Formatted on 1/30/2017 11:29:50 AM (QP5 v5.149.1003.31008) -CLIENT JOINS ADDED Formatted on 5/22/2017 2:46:11 PM (QP5 v5.149.1003.31008) -Ticket created date is updated. -Date filter condition applied from new ticket open date. */ SELECT CRMO.OBJECT_ID "ID", CRMC.ZZBUAG_ID "BAN", CRMC.ZZPAY_DATE "DEPOSIT_DATE", CRMO.ZZTOTAL_AMT "ACTV_AMT", CRMC.ZZPAY_CHANNEL "PAYMENT_CHANNEL" FROM SAPSR3.CRMD_ORDERADM_H CRMO, SAPSR3.CRMD_CUSTOMER_H CRMC, SAPSR3.CRM_JEST CJ, SAPSR3.TJ30T TJ, (SELECT E.OBJNR, E.MANDT, F.STSMA, F.SPRAS, MIN ( (TO_DATE (C.UDATE || C.UTIME, 'YYYYMMDDHH24MISS'))) DTTM FROM SAPSR3.CRM_JEST E, SAPSR3.TJ30T F, SAPSR3.CRM_JCDS C WHERE 1 = 1 AND E.STAT = F.ESTAT AND E.MANDT = F.MANDT AND E.STAT = C.STAT AND E.CHGNR = C.CHGNR AND E.OBJNR = C.OBJNR AND E.MANDT = C.MANDT GROUP BY E.OBJNR, E.MANDT, F.STSMA, F.SPRAS) OPN WHERE 1 = 1 --JOINS AND CRMO.PROCESS_TYPE = TJ.STSMA AND CRMO.GUID = CRMC.GUID AND CRMO.CLIENT = CRMC.CLIENT AND CRMO.GUID = CJ.OBJNR AND CJ.STAT = TJ.ESTAT AND CJ.MANDT = TJ.MANDT AND CRMO.DESCR_LANGUAGE = TJ.SPRAS --OPEN DTTM JOINS AND CRMO.GUID = OPN.OBJNR AND CRMO.CLIENT = OPN.MANDT AND CRMO.PROCESS_TYPE = OPN.STSMA AND CRMO.DESCR_LANGUAGE = OPN.SPRAS --FILTERS AND CRMO.PROCESS_TYPE = 'ZTMP' AND CJ.INACT <> 'X' --CURRENT STATUS AND TJ.TXT30 <> 'Closed' --AND TO_DATE (CRMO.POSTING_DATE, 'YYYYMMDDHH24MISS') >= SYSDATE - 1 --CREATED 1 DAY BEFORE --REMOVED AND OPN.DTTM >= SYSDATE - 1 --CREATED 1 DAY BEFORE
/** * * @author Алексей * @name group_type * @public * @readonly */ Select * From grp_type t1
SELECT n1.nome_coluna_1, n2.nome_coluna_1, n1.nome_coluna_2, n1.nome_coluna_3, n1.nome_coluna_4, n1.nome_coluna_5, n1.nome_coluna_6, n1.nome_coluna_7, n1.nome_coluna_8, n1.nome_coluna_9, n1.nome_coluna_10, n1.nome_coluna_11, n1.nome_coluna_12, n1.nome_coluna_13, n1.data FROM nome_tabela_1 n1 LEFT JOIN nome_tabela_2 n2 ON n2.id = n1.nome_tabela_2_id WHERE n1.data BETWEEN '2018-01-15' AND '2018-10-16' AND nome_coluna_13 = 'STRING' ORDER BY n1.data;
/* Navicat MySQL Data Transfer Source Server : 本地连接 Source Server Version : 50527 Source Host : localhost:3306 Source Database : activiti-db Target Server Type : MYSQL Target Server Version : 50527 File Encoding : 65001 Date: 2017-04-27 17:05:53 */ SET FOREIGN_KEY_CHECKS=0; -- ---------------------------- -- Table structure for `t_leave` -- ---------------------------- DROP TABLE IF EXISTS `t_leave`; CREATE TABLE `t_leave` ( `id` int(11) NOT NULL AUTO_INCREMENT, `leavePerson` varchar(20) COLLATE utf8_bin DEFAULT NULL, `superior` varchar(20) COLLATE utf8_bin DEFAULT NULL, `startTime` varchar(20) COLLATE utf8_bin DEFAULT NULL, `endTime` varchar(20) COLLATE utf8_bin DEFAULT NULL, `leaveReasons` varchar(200) COLLATE utf8_bin DEFAULT NULL, `createTime` varchar(20) CHARACTER SET utf8 DEFAULT NULL, `userID` varchar(20) COLLATE utf8_bin DEFAULT NULL, `domStatus` varchar(20) COLLATE utf8_bin DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -- ---------------------------- -- Records of t_leave -- ---------------------------- INSERT INTO `t_leave` VALUES ('2', 'sa', 'admin', '2017-04-25 11:10', '2017-04-29 11:10', 'dddd', '17-04-25 11:04:45', 'sa', '3'); INSERT INTO `t_leave` VALUES ('3', 'admin', 'sa', '2017-04-25 11:12', '2017-04-29 11:12', 'dddxxxx', '17-04-25 11:04:06', 'admin', '3'); INSERT INTO `t_leave` VALUES ('4', 'sa', 'admin', '2017-04-25 16:11', '2017-04-29 16:11', 'dddd', '17-04-25 04:04:30', 'sa', '1'); INSERT INTO `t_leave` VALUES ('5', 'sa', 'admin', '2017-04-25 16:11', '2017-04-29 16:11', 'ddddxx6666', '17-04-25 04:04:08', 'sa', '3'); INSERT INTO `t_leave` VALUES ('6', 'admin', 'sa', '2017-04-25 16:28', '2017-05-05 16:28', 'dddd6666', '17-04-25 04:04:45', 'admin', '3'); INSERT INTO `t_leave` VALUES ('7', 'sa', 'admin', '2017-04-26 16:35', '2017-04-29 16:35', 'dd', '17-04-26 04:04:42', 'sa', '1'); INSERT INTO `t_leave` VALUES ('8', 'sa', 'admin', '2017-04-26 16:42', '2017-05-05 16:42', 'xfddfdfxxx', '17-04-26 04:04:41', 'sa', '1'); INSERT INTO `t_leave` VALUES ('9', 'sa', 'admin', '2017-04-26 16:55', '2017-04-28 16:55', '请假玩', '17-04-26 04:04:53', 'sa', '2'); INSERT INTO `t_leave` VALUES ('10', 'sa', 'admin', '2017-04-26 16:59', '2017-04-29 16:59', 'xxx', '17-04-26 05:04:12', 'sa', '2'); INSERT INTO `t_leave` VALUES ('11', 'sa', 'admin', '2017-04-26 17:01', '2017-04-29 17:01', 'fffffff', '17-04-26 05:04:03', 'sa', '2'); INSERT INTO `t_leave` VALUES ('12', 'wo', 'bm', '2017-04-27 10:52', '2017-05-06 10:52', 'qingjia', '17-04-27 10:04:54', 'wo', '2'); INSERT INTO `t_leave` VALUES ('14', 'wo', 'bm', '2017-04-27 14:04', '2017-04-29 14:04', 'xxx555', '17-04-27 02:04:41', 'wo', '2'); INSERT INTO `t_leave` VALUES ('15', 'wo', 'bm', '2017-04-27 15:42', '2017-04-29 15:42', 'sss', '17-04-27 03:04:26', 'wo', '2'); INSERT INTO `t_leave` VALUES ('16', 'wo', 'bm', '2017-04-27 16:20', '2017-05-06 16:20', 'xxxx', '17-04-27 04:04:47', 'wo', '4'); INSERT INTO `t_leave` VALUES ('17', 'wo', 'bm', '2017-04-27 16:34', '2017-05-06 16:34', 'xxxx', '17-04-27 04:04:48', 'wo', '3'); INSERT INTO `t_leave` VALUES ('18', 'wo', 'bm', '2017-04-27 16:39', '2017-04-28 16:39', 'xxx', '17-04-27 04:04:34', 'wo', '4');
\set ON_ERROR_STOP on DROP DATABASE IF EXISTS surveydb; -- There is no "IF EXISTS" for DROP OWNED, so we -- just allow this error, to support fresh installs \set ON_ERROR_STOP off DROP OWNED BY bucket; \set ON_ERROR_STOP on DROP USER IF EXISTS bucket; \set ON_ERROR_STOP off DROP OWNED BY buckaro; \set ON_ERROR_STOP on DROP USER IF EXISTS buckaro; CREATE DATABASE surveydb; CREATE USER bucket WITH PASSWORD 'local'; GRANT ALL PRIVILEGES ON DATABASE "surveydb" to bucket; CREATE USER buckaro WITH PASSWORD 'local'; GRANT CONNECT ON DATABASE "surveydb" TO buckaro; GRANT USAGE ON SCHEMA public TO buckaro; GRANT SELECT ON ALL TABLES IN SCHEMA public TO buckaro; ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO buckaro;
CREATE EXTENSION IF NOT EXISTS pgcrypto; DROP TABLE IF EXISTS students; CREATE TABLE students( StudentId BIGINT PRIMARY KEY, ProgramCode VARCHAR(6) NOT NULL, ProgramDescription VARCHAR(50) NOT NULL, Year INT NOT NULL, CONSTRAINT fk_student FOREIGN KEY(StudentId) REFERENCES users(Id) ); INSERT INTO students(StudentId,ProgramCode,ProgramDescription,Year) VALUES (100774848,'CST','Computer System Technology',3); INSERT INTO students(StudentId,ProgramCode,ProgramDescription,Year) VALUES (100774814,'CPA','Computer Programmer Analyst',2); INSERT INTO students(StudentId,ProgramCode,ProgramDescription,Year) VALUES (100111111,'CST','Computer System Technology',3); SELECT * FROM students;
CREATE TABLE `sb_item` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `title` varchar(255) NOT NULL, `amount` double(10, 2) NOT NULL, `price` double(10, 2) NOT NULL, `created_at` datetime DEFAULT NULL, `updated_at` datetime DEFAULT NULL, `bill_id` bigint(20) NOT NULL, PRIMARY KEY (`id`) ) ENGINE = InnoDB DEFAULT CHARSET = utf8 COLLATE = utf8_general_ci; ALTER TABLE sb_item ADD CONSTRAINT fk_sb_item_sb_bill_bill_id FOREIGN KEY (bill_id) REFERENCES sb_bill (id);
CREATE TABLE IF NOT EXISTS map__planet_construction_states( id SERIAL PRIMARY KEY, built_at timestamptz not null, current_points int not null, points int not null ); ALTER TABLE map__planet_buildings DROP COLUMN built_at, ADD COLUMN construction_state_id int REFERENCES map__planet_construction_states(id);
CREATE DATABASE IF NOT EXISTS demo default charset utf8 COLLATE utf8_general_ci; create table samplemodel ( id int unsigned not null auto_increment primary key, lastName varchar(40) not null, firstName varchar(40) not null, email varchar(80) not null, unique index subscriber_idx1 (email) ) engine = InnoDb; insert into samplemodel(lastName, firstName, email) values ("James", "Gosling", "james.gosling@java.com"); insert into samplemodel(lastName, firstName, email) values ("Rod", "Johnson", "rod.johnson@spring.io"); insert into samplemodel(lastName, firstName, email) values ("Michael", "Monty", "michael.monty@mysql.com");
-- -- 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: affiliations; Type: TABLE; Schema: public; Owner: postgres; Tablespace: -- CREATE TABLE affiliations ( id integer NOT NULL, name text NOT NULL ); ALTER TABLE public.affiliations OWNER TO postgres; -- -- Name: affiliations_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres -- CREATE SEQUENCE affiliations_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; ALTER TABLE public.affiliations_id_seq OWNER TO postgres; -- -- Name: affiliations_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres -- ALTER SEQUENCE affiliations_id_seq OWNED BY affiliations.id; -- -- Name: workplaces; Type: TABLE; Schema: public; Owner: postgres; Tablespace: -- CREATE TABLE workplaces ( id integer NOT NULL, name text NOT NULL, description text ); ALTER TABLE public.workplaces OWNER TO postgres; -- -- Name: bars_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres -- CREATE SEQUENCE bars_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; ALTER TABLE public.bars_id_seq OWNER TO postgres; -- -- Name: bars_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres -- ALTER SEQUENCE bars_id_seq OWNED BY workplaces.id; -- -- Name: roles; Type: TABLE; Schema: public; Owner: postgres; Tablespace: -- CREATE TABLE roles ( id bigint NOT NULL, name text NOT NULL ); ALTER TABLE public.roles OWNER TO postgres; -- -- Name: roles_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres -- CREATE SEQUENCE roles_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; ALTER TABLE public.roles_id_seq OWNER TO postgres; -- -- Name: roles_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres -- ALTER SEQUENCE roles_id_seq OWNED BY roles.id; -- -- Name: shift_types; Type: TABLE; Schema: public; Owner: postgres; Tablespace: -- CREATE TABLE shift_types ( id integer NOT NULL, name text NOT NULL ); ALTER TABLE public.shift_types OWNER TO postgres; -- -- Name: shift_types_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres -- CREATE SEQUENCE shift_types_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; ALTER TABLE public.shift_types_id_seq OWNER TO postgres; -- -- Name: shift_types_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres -- ALTER SEQUENCE shift_types_id_seq OWNED BY shift_types.id; -- -- Name: shifts; Type: TABLE; Schema: public; Owner: postgres; Tablespace: -- CREATE TABLE shifts ( id integer NOT NULL, bar_id integer NOT NULL, start timestamp with time zone NOT NULL, finish timestamp with time zone NOT NULL, description text DEFAULT ''::text NOT NULL, type_id integer DEFAULT 0 NOT NULL ); ALTER TABLE public.shifts OWNER TO postgres; -- -- Name: shifts_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres -- CREATE SEQUENCE shifts_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; ALTER TABLE public.shifts_id_seq OWNER TO postgres; -- -- Name: shifts_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres -- ALTER SEQUENCE shifts_id_seq OWNED BY shifts.id; -- -- Name: user_shifts; Type: TABLE; Schema: public; Owner: postgres; Tablespace: -- CREATE TABLE user_shifts ( id integer NOT NULL, shift_id integer NOT NULL, user_id integer NOT NULL, role_id smallint, start timestamp with time zone, finish timestamp with time zone ); ALTER TABLE public.user_shifts OWNER TO postgres; -- -- Name: user_shifts_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres -- CREATE SEQUENCE user_shifts_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; ALTER TABLE public.user_shifts_id_seq OWNER TO postgres; -- -- Name: user_shifts_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres -- ALTER SEQUENCE user_shifts_id_seq OWNED BY user_shifts.id; -- -- Name: user_workplaces_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres -- CREATE SEQUENCE user_workplaces_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; ALTER TABLE public.user_workplaces_id_seq OWNER TO postgres; -- -- Name: user_workplaces; Type: TABLE; Schema: public; Owner: postgres; Tablespace: -- CREATE TABLE user_workplaces ( id integer DEFAULT nextval('user_workplaces_id_seq'::regclass) NOT NULL, user_id integer NOT NULL, workplace_id integer NOT NULL, since text NOT NULL ); ALTER TABLE public.user_workplaces OWNER TO postgres; -- -- Name: users; Type: TABLE; Schema: public; Owner: postgres; Tablespace: -- CREATE TABLE users ( id integer NOT NULL, email text NOT NULL, pass text NOT NULL, role text DEFAULT 'user'::text NOT NULL, name text NOT NULL, created timestamp with time zone DEFAULT now() NOT NULL, image text DEFAULT 'default'::text NOT NULL, affiliation_id integer ); ALTER TABLE public.users OWNER TO postgres; -- -- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres -- CREATE SEQUENCE users_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; ALTER TABLE public.users_id_seq OWNER TO postgres; -- -- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres -- ALTER SEQUENCE users_id_seq OWNED BY users.id; -- -- Name: id; Type: DEFAULT; Schema: public; Owner: postgres -- ALTER TABLE ONLY affiliations ALTER COLUMN id SET DEFAULT nextval('affiliations_id_seq'::regclass); -- -- Name: id; Type: DEFAULT; Schema: public; Owner: postgres -- ALTER TABLE ONLY roles ALTER COLUMN id SET DEFAULT nextval('roles_id_seq'::regclass); -- -- Name: id; Type: DEFAULT; Schema: public; Owner: postgres -- ALTER TABLE ONLY shift_types ALTER COLUMN id SET DEFAULT nextval('shift_types_id_seq'::regclass); -- -- Name: id; Type: DEFAULT; Schema: public; Owner: postgres -- ALTER TABLE ONLY shifts ALTER COLUMN id SET DEFAULT nextval('shifts_id_seq'::regclass); -- -- Name: id; Type: DEFAULT; Schema: public; Owner: postgres -- ALTER TABLE ONLY user_shifts ALTER COLUMN id SET DEFAULT nextval('user_shifts_id_seq'::regclass); -- -- Name: id; Type: DEFAULT; Schema: public; Owner: postgres -- ALTER TABLE ONLY users ALTER COLUMN id SET DEFAULT nextval('users_id_seq'::regclass); -- -- Name: id; Type: DEFAULT; Schema: public; Owner: postgres -- ALTER TABLE ONLY workplaces ALTER COLUMN id SET DEFAULT nextval('bars_id_seq'::regclass); -- -- Data for Name: affiliations; Type: TABLE DATA; Schema: public; Owner: postgres -- COPY affiliations (id, name) FROM stdin; 1 Lyche 2 Edgar 3 Daglighallen 4 Rundhallen 5 Klubben 6 Bodegaen 7 Storsalen 8 Strossa 9 Selskapssiden \. -- -- Name: affiliations_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres -- SELECT pg_catalog.setval('affiliations_id_seq', 9, true); -- -- Name: bars_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres -- SELECT pg_catalog.setval('bars_id_seq', 11, true); -- -- Data for Name: roles; Type: TABLE DATA; Schema: public; Owner: postgres -- COPY roles (id, name) FROM stdin; 6 Spritbarsjef 5 Barsjef 4 Kaféansvarlig 3 Hovmester 2 Ugle 1 Gjengis 7 Daglighallenbarsjef \. -- -- Name: roles_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres -- SELECT pg_catalog.setval('roles_id_seq', 7, true); -- -- Data for Name: shift_types; Type: TABLE DATA; Schema: public; Owner: postgres -- COPY shift_types (id, name) FROM stdin; 1 2 Tidlig 3 Sent \. -- -- Name: shift_types_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres -- SELECT pg_catalog.setval('shift_types_id_seq', 3, true); -- -- Data for Name: shifts; Type: TABLE DATA; Schema: public; Owner: postgres -- COPY shifts (id, bar_id, start, finish, description, type_id) FROM stdin; 5 3 2015-12-07 19:00:00+01 2015-12-08 00:00:00+01 1 10 3 2015-12-08 19:00:00+01 2015-12-09 00:00:00+01 1 15 3 2015-12-09 19:00:00+01 2015-12-10 00:00:00+01 1 20 3 2015-12-10 19:00:00+01 2015-12-11 02:00:00+01 1 21 5 2015-12-10 19:00:00+01 2015-12-11 02:00:00+01 1 26 3 2015-12-11 20:00:00+01 2015-12-12 02:30:00+01 1 27 4 2015-12-11 20:00:00+01 2015-12-12 03:00:00+01 1 28 5 2015-12-11 20:00:00+01 2015-12-12 03:00:00+01 1 29 6 2015-12-11 20:00:00+01 2015-12-12 03:00:00+01 1 30 7 2015-12-11 20:00:00+01 2015-12-12 03:00:00+01 1 31 8 2015-12-11 20:00:00+01 2015-12-12 03:00:00+01 1 32 9 2015-12-11 20:00:00+01 2015-12-12 03:00:00+01 1 33 10 2015-12-11 20:00:00+01 2015-12-12 03:00:00+01 1 38 3 2015-12-12 20:00:00+01 2015-12-13 02:30:00+01 1 39 4 2015-12-12 20:00:00+01 2015-12-13 03:00:00+01 1 40 5 2015-12-12 20:00:00+01 2015-12-13 03:00:00+01 1 41 6 2015-12-12 20:00:00+01 2015-12-13 03:00:00+01 1 42 7 2015-12-12 20:00:00+01 2015-12-13 03:00:00+01 1 43 8 2015-12-12 20:00:00+01 2015-12-13 03:00:00+01 1 44 9 2015-12-12 20:00:00+01 2015-12-13 03:00:00+01 1 45 10 2015-12-12 20:00:00+01 2015-12-13 03:00:00+01 1 46 1 2015-12-13 15:00:00+01 2015-12-13 22:00:00+01 1 47 2 2015-12-13 15:00:00+01 2015-12-13 22:00:00+01 1 48 3 2015-12-13 15:00:00+01 2015-12-13 22:00:00+01 1 53 3 2015-12-14 19:00:00+01 2015-12-15 00:00:00+01 1 58 3 2015-12-15 19:00:00+01 2015-12-16 00:00:00+01 1 63 3 2015-12-16 19:00:00+01 2015-12-17 00:00:00+01 1 68 3 2015-12-17 19:00:00+01 2015-12-18 02:00:00+01 1 69 5 2015-12-17 19:00:00+01 2015-12-18 02:00:00+01 1 74 3 2015-12-18 20:00:00+01 2015-12-19 02:30:00+01 1 75 4 2015-12-18 20:00:00+01 2015-12-19 03:00:00+01 1 76 5 2015-12-18 20:00:00+01 2015-12-19 03:00:00+01 1 2 1 2015-12-07 17:00:00+01 2015-12-08 00:00:00+01 3 4 2 2015-12-07 17:00:00+01 2015-12-08 00:00:00+01 3 7 1 2015-12-08 17:00:00+01 2015-12-09 00:00:00+01 3 9 2 2015-12-08 17:00:00+01 2015-12-09 00:00:00+01 3 12 1 2015-12-09 17:00:00+01 2015-12-10 00:00:00+01 3 14 2 2015-12-09 19:00:00+01 2015-12-10 02:00:00+01 3 17 1 2015-12-10 17:00:00+01 2015-12-11 00:00:00+01 3 19 2 2015-12-10 19:00:00+01 2015-12-11 02:00:00+01 3 23 1 2015-12-11 20:00:00+01 2015-12-12 03:00:00+01 3 25 2 2015-12-11 20:00:00+01 2015-12-12 03:00:00+01 3 35 1 2015-12-12 20:00:00+01 2015-12-13 03:00:00+01 3 37 2 2015-12-12 20:00:00+01 2015-12-13 03:00:00+01 3 50 1 2015-12-14 17:00:00+01 2015-12-15 00:00:00+01 3 52 2 2015-12-14 17:00:00+01 2015-12-15 00:00:00+01 3 55 1 2015-12-15 17:00:00+01 2015-12-16 00:00:00+01 3 57 2 2015-12-15 17:00:00+01 2015-12-16 00:00:00+01 3 60 1 2015-12-16 17:00:00+01 2015-12-17 00:00:00+01 3 62 2 2015-12-16 19:00:00+01 2015-12-17 02:00:00+01 3 65 1 2015-12-17 17:00:00+01 2015-12-18 00:00:00+01 3 67 2 2015-12-17 19:00:00+01 2015-12-18 02:00:00+01 3 71 1 2015-12-18 20:00:00+01 2015-12-19 03:00:00+01 3 73 2 2015-12-18 20:00:00+01 2015-12-19 03:00:00+01 3 83 1 2015-12-19 20:00:00+01 2015-12-20 03:00:00+01 3 85 2 2015-12-19 20:00:00+01 2015-12-20 03:00:00+01 3 98 1 2015-12-21 17:00:00+01 2015-12-22 00:00:00+01 3 100 2 2015-12-21 17:00:00+01 2015-12-22 00:00:00+01 3 103 1 2015-12-22 17:00:00+01 2015-12-23 00:00:00+01 3 105 2 2015-12-22 17:00:00+01 2015-12-23 00:00:00+01 3 108 1 2015-12-23 17:00:00+01 2015-12-24 00:00:00+01 3 110 2 2015-12-23 19:00:00+01 2015-12-24 02:00:00+01 3 113 1 2015-12-24 17:00:00+01 2015-12-25 00:00:00+01 3 115 2 2015-12-24 19:00:00+01 2015-12-25 02:00:00+01 3 77 6 2015-12-18 20:00:00+01 2015-12-19 03:00:00+01 1 78 7 2015-12-18 20:00:00+01 2015-12-19 03:00:00+01 1 79 8 2015-12-18 20:00:00+01 2015-12-19 03:00:00+01 1 80 9 2015-12-18 20:00:00+01 2015-12-19 03:00:00+01 1 128 9 2015-12-25 20:00:00+01 2015-12-26 03:00:00+01 1 129 10 2015-12-25 20:00:00+01 2015-12-26 03:00:00+01 1 134 3 2015-12-26 20:00:00+01 2015-12-27 02:30:00+01 1 135 4 2015-12-26 20:00:00+01 2015-12-27 03:00:00+01 1 136 5 2015-12-26 20:00:00+01 2015-12-27 03:00:00+01 1 137 6 2015-12-26 20:00:00+01 2015-12-27 03:00:00+01 1 138 7 2015-12-26 20:00:00+01 2015-12-27 03:00:00+01 1 139 8 2015-12-26 20:00:00+01 2015-12-27 03:00:00+01 1 140 9 2015-12-26 20:00:00+01 2015-12-27 03:00:00+01 1 141 10 2015-12-26 20:00:00+01 2015-12-27 03:00:00+01 1 142 1 2015-12-27 15:00:00+01 2015-12-27 22:00:00+01 1 143 2 2015-12-27 15:00:00+01 2015-12-27 22:00:00+01 1 144 3 2015-12-27 15:00:00+01 2015-12-27 22:00:00+01 1 149 3 2015-12-28 19:00:00+01 2015-12-29 00:00:00+01 1 154 3 2015-12-29 19:00:00+01 2015-12-30 00:00:00+01 1 1 1 2015-12-07 15:00:00+01 2015-12-07 22:00:00+01 2 3 2 2015-12-07 15:00:00+01 2015-12-07 22:00:00+01 2 6 1 2015-12-08 15:00:00+01 2015-12-08 22:00:00+01 2 8 2 2015-12-08 15:00:00+01 2015-12-08 22:00:00+01 2 11 1 2015-12-09 15:00:00+01 2015-12-09 22:00:00+01 2 13 2 2015-12-09 15:00:00+01 2015-12-09 22:00:00+01 2 16 1 2015-12-10 15:00:00+01 2015-12-10 22:00:00+01 2 18 2 2015-12-10 15:00:00+01 2015-12-10 22:00:00+01 2 22 1 2015-12-11 15:00:00+01 2015-12-11 22:00:00+01 2 24 2 2015-12-11 15:00:00+01 2015-12-11 22:00:00+01 2 34 1 2015-12-12 15:00:00+01 2015-12-12 22:00:00+01 2 36 2 2015-12-12 15:00:00+01 2015-12-12 22:00:00+01 2 49 1 2015-12-14 15:00:00+01 2015-12-14 22:00:00+01 2 51 2 2015-12-14 15:00:00+01 2015-12-14 22:00:00+01 2 54 1 2015-12-15 15:00:00+01 2015-12-15 22:00:00+01 2 56 2 2015-12-15 15:00:00+01 2015-12-15 22:00:00+01 2 59 1 2015-12-16 15:00:00+01 2015-12-16 22:00:00+01 2 131 1 2015-12-26 20:00:00+01 2015-12-27 03:00:00+01 3 133 2 2015-12-26 20:00:00+01 2015-12-27 03:00:00+01 3 146 1 2015-12-28 17:00:00+01 2015-12-29 00:00:00+01 3 148 2 2015-12-28 17:00:00+01 2015-12-29 00:00:00+01 3 151 1 2015-12-29 17:00:00+01 2015-12-30 00:00:00+01 3 153 2 2015-12-29 17:00:00+01 2015-12-30 00:00:00+01 3 156 1 2015-12-30 17:00:00+01 2015-12-31 00:00:00+01 3 158 2 2015-12-30 19:00:00+01 2015-12-31 02:00:00+01 3 161 1 2015-12-31 17:00:00+01 2016-01-01 00:00:00+01 3 163 2 2015-12-31 19:00:00+01 2016-01-01 02:00:00+01 3 167 1 2016-01-01 20:00:00+01 2016-01-02 03:00:00+01 3 169 2 2016-01-01 20:00:00+01 2016-01-02 03:00:00+01 3 179 1 2016-01-02 20:00:00+01 2016-01-03 03:00:00+01 3 181 2 2016-01-02 20:00:00+01 2016-01-03 03:00:00+01 3 194 1 2016-01-04 17:00:00+01 2016-01-05 00:00:00+01 3 196 2 2016-01-04 17:00:00+01 2016-01-05 00:00:00+01 3 199 1 2016-01-05 17:00:00+01 2016-01-06 00:00:00+01 3 159 3 2015-12-30 19:00:00+01 2015-12-31 00:00:00+01 1 164 3 2015-12-31 19:00:00+01 2016-01-01 02:00:00+01 1 165 5 2015-12-31 19:00:00+01 2016-01-01 02:00:00+01 1 170 3 2016-01-01 20:00:00+01 2016-01-02 02:30:00+01 1 171 4 2016-01-01 20:00:00+01 2016-01-02 03:00:00+01 1 172 5 2016-01-01 20:00:00+01 2016-01-02 03:00:00+01 1 173 6 2016-01-01 20:00:00+01 2016-01-02 03:00:00+01 1 174 7 2016-01-01 20:00:00+01 2016-01-02 03:00:00+01 1 175 8 2016-01-01 20:00:00+01 2016-01-02 03:00:00+01 1 176 9 2016-01-01 20:00:00+01 2016-01-02 03:00:00+01 1 177 10 2016-01-01 20:00:00+01 2016-01-02 03:00:00+01 1 182 3 2016-01-02 20:00:00+01 2016-01-03 02:30:00+01 1 183 4 2016-01-02 20:00:00+01 2016-01-03 03:00:00+01 1 184 5 2016-01-02 20:00:00+01 2016-01-03 03:00:00+01 1 185 6 2016-01-02 20:00:00+01 2016-01-03 03:00:00+01 1 186 7 2016-01-02 20:00:00+01 2016-01-03 03:00:00+01 1 187 8 2016-01-02 20:00:00+01 2016-01-03 03:00:00+01 1 188 9 2016-01-02 20:00:00+01 2016-01-03 03:00:00+01 1 189 10 2016-01-02 20:00:00+01 2016-01-03 03:00:00+01 1 190 1 2016-01-03 15:00:00+01 2016-01-03 22:00:00+01 1 191 2 2016-01-03 15:00:00+01 2016-01-03 22:00:00+01 1 192 3 2016-01-03 15:00:00+01 2016-01-03 22:00:00+01 1 197 3 2016-01-04 19:00:00+01 2016-01-05 00:00:00+01 1 202 3 2016-01-05 19:00:00+01 2016-01-06 00:00:00+01 1 119 1 2015-12-25 20:00:00+01 2015-12-26 03:00:00+01 3 121 2 2015-12-25 20:00:00+01 2015-12-26 03:00:00+01 3 201 2 2016-01-05 17:00:00+01 2016-01-06 00:00:00+01 3 61 2 2015-12-16 15:00:00+01 2015-12-16 22:00:00+01 2 64 1 2015-12-17 15:00:00+01 2015-12-17 22:00:00+01 2 66 2 2015-12-17 15:00:00+01 2015-12-17 22:00:00+01 2 70 1 2015-12-18 15:00:00+01 2015-12-18 22:00:00+01 2 72 2 2015-12-18 15:00:00+01 2015-12-18 22:00:00+01 2 82 1 2015-12-19 15:00:00+01 2015-12-19 22:00:00+01 2 84 2 2015-12-19 15:00:00+01 2015-12-19 22:00:00+01 2 97 1 2015-12-21 15:00:00+01 2015-12-21 22:00:00+01 2 99 2 2015-12-21 15:00:00+01 2015-12-21 22:00:00+01 2 102 1 2015-12-22 15:00:00+01 2015-12-22 22:00:00+01 2 104 2 2015-12-22 15:00:00+01 2015-12-22 22:00:00+01 2 107 1 2015-12-23 15:00:00+01 2015-12-23 22:00:00+01 2 109 2 2015-12-23 15:00:00+01 2015-12-23 22:00:00+01 2 112 1 2015-12-24 15:00:00+01 2015-12-24 22:00:00+01 2 114 2 2015-12-24 15:00:00+01 2015-12-24 22:00:00+01 2 118 1 2015-12-25 15:00:00+01 2015-12-25 22:00:00+01 2 120 2 2015-12-25 15:00:00+01 2015-12-25 22:00:00+01 2 130 1 2015-12-26 15:00:00+01 2015-12-26 22:00:00+01 2 132 2 2015-12-26 15:00:00+01 2015-12-26 22:00:00+01 2 145 1 2015-12-28 15:00:00+01 2015-12-28 22:00:00+01 2 147 2 2015-12-28 15:00:00+01 2015-12-28 22:00:00+01 2 150 1 2015-12-29 15:00:00+01 2015-12-29 22:00:00+01 2 152 2 2015-12-29 15:00:00+01 2015-12-29 22:00:00+01 2 155 1 2015-12-30 15:00:00+01 2015-12-30 22:00:00+01 2 157 2 2015-12-30 15:00:00+01 2015-12-30 22:00:00+01 2 160 1 2015-12-31 15:00:00+01 2015-12-31 22:00:00+01 2 162 2 2015-12-31 15:00:00+01 2015-12-31 22:00:00+01 2 166 1 2016-01-01 15:00:00+01 2016-01-01 22:00:00+01 2 168 2 2016-01-01 15:00:00+01 2016-01-01 22:00:00+01 2 178 1 2016-01-02 15:00:00+01 2016-01-02 22:00:00+01 2 180 2 2016-01-02 15:00:00+01 2016-01-02 22:00:00+01 2 193 1 2016-01-04 15:00:00+01 2016-01-04 22:00:00+01 2 195 2 2016-01-04 15:00:00+01 2016-01-04 22:00:00+01 2 198 1 2016-01-05 15:00:00+01 2016-01-05 22:00:00+01 2 200 2 2016-01-05 15:00:00+01 2016-01-05 22:00:00+01 2 81 10 2015-12-18 20:00:00+01 2015-12-19 03:00:00+01 1 86 3 2015-12-19 20:00:00+01 2015-12-20 02:30:00+01 1 87 4 2015-12-19 20:00:00+01 2015-12-20 03:00:00+01 1 88 5 2015-12-19 20:00:00+01 2015-12-20 03:00:00+01 1 89 6 2015-12-19 20:00:00+01 2015-12-20 03:00:00+01 1 90 7 2015-12-19 20:00:00+01 2015-12-20 03:00:00+01 1 91 8 2015-12-19 20:00:00+01 2015-12-20 03:00:00+01 1 92 9 2015-12-19 20:00:00+01 2015-12-20 03:00:00+01 1 93 10 2015-12-19 20:00:00+01 2015-12-20 03:00:00+01 1 94 1 2015-12-20 15:00:00+01 2015-12-20 22:00:00+01 1 95 2 2015-12-20 15:00:00+01 2015-12-20 22:00:00+01 1 96 3 2015-12-20 15:00:00+01 2015-12-20 22:00:00+01 1 101 3 2015-12-21 19:00:00+01 2015-12-22 00:00:00+01 1 106 3 2015-12-22 19:00:00+01 2015-12-23 00:00:00+01 1 111 3 2015-12-23 19:00:00+01 2015-12-24 00:00:00+01 1 116 3 2015-12-24 19:00:00+01 2015-12-25 02:00:00+01 1 117 5 2015-12-24 19:00:00+01 2015-12-25 02:00:00+01 1 122 3 2015-12-25 20:00:00+01 2015-12-26 02:30:00+01 1 123 4 2015-12-25 20:00:00+01 2015-12-26 03:00:00+01 1 124 5 2015-12-25 20:00:00+01 2015-12-26 03:00:00+01 1 125 6 2015-12-25 20:00:00+01 2015-12-26 03:00:00+01 1 126 7 2015-12-25 20:00:00+01 2015-12-26 03:00:00+01 1 127 8 2015-12-25 20:00:00+01 2015-12-26 03:00:00+01 1 \. -- -- Name: shifts_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres -- SELECT pg_catalog.setval('shifts_id_seq', 202, true); -- -- Data for Name: user_shifts; Type: TABLE DATA; Schema: public; Owner: postgres -- COPY user_shifts (id, shift_id, user_id, role_id, start, finish) FROM stdin; 2 1 61 1 \N \N 3 1 63 1 \N \N 4 1 121 1 \N \N 6 2 119 1 \N \N 7 2 18 1 \N \N 8 2 31 1 \N \N 10 3 45 1 \N \N 11 3 116 1 \N \N 12 3 87 1 \N \N 14 4 59 1 \N \N 15 4 93 1 \N \N 16 4 22 1 \N \N 18 5 4 1 \N \N 19 5 44 1 \N \N 20 5 119 1 \N \N 22 6 121 1 \N \N 23 6 105 1 \N \N 24 6 135 1 \N \N 26 7 26 1 \N \N 27 7 61 1 \N \N 28 7 24 1 \N \N 30 8 98 1 \N \N 31 8 93 1 \N \N 32 8 13 1 \N \N 34 9 98 1 \N \N 35 9 9 1 \N \N 36 9 74 1 \N \N 38 10 149 1 \N \N 39 10 150 1 \N \N 40 10 12 1 \N \N 42 11 25 1 \N \N 43 11 63 1 \N \N 44 11 124 1 \N \N 46 12 57 1 \N \N 47 12 126 1 \N \N 48 12 104 1 \N \N 50 13 20 1 \N \N 51 13 87 1 \N \N 52 13 3 1 \N \N 54 14 111 1 \N \N 55 14 61 1 \N \N 56 14 45 1 \N \N 58 15 93 1 \N \N 186 47 96 1 2015-12-13 13:00:00+01 2015-12-13 20:00:00+01 190 48 12 1 2015-12-13 05:00:00+01 2015-12-13 12:00:00+01 187 47 143 1 \N \N 188 47 20 1 \N \N 191 48 125 1 \N \N 192 48 42 1 \N \N 194 49 18 1 \N \N 195 49 129 1 \N \N 196 49 32 1 \N \N 198 50 6 1 \N \N 199 50 92 1 \N \N 200 50 1 1 \N \N 202 51 139 1 \N \N 203 51 26 1 \N \N 204 51 41 1 \N \N 206 52 67 1 \N \N 207 52 42 1 \N \N 208 52 90 1 \N \N 210 53 129 1 \N \N 211 53 112 1 \N \N 212 53 16 1 \N \N 214 54 38 1 \N \N 215 54 21 1 \N \N 216 54 46 1 \N \N 218 55 108 1 \N \N 219 55 77 1 \N \N 220 55 79 1 \N \N 222 56 77 1 \N \N 223 56 24 1 \N \N 224 56 53 1 \N \N 226 57 145 1 \N \N 227 57 6 1 \N \N 228 57 45 1 \N \N 230 58 66 1 \N \N 231 58 35 1 \N \N 232 58 130 1 \N \N 234 59 38 1 \N \N 235 59 37 1 \N \N 236 59 3 1 \N \N 238 60 117 1 \N \N 239 60 70 1 \N \N 240 60 81 1 \N \N 371 93 118 1 \N \N 372 93 61 1 \N \N 374 94 20 1 \N \N 375 94 37 1 \N \N 376 94 5 1 \N \N 378 95 39 1 \N \N 379 95 19 1 \N \N 380 95 69 1 \N \N 382 96 124 1 \N \N 383 96 70 1 \N \N 384 96 58 1 \N \N 386 97 8 1 \N \N 387 97 79 1 \N \N 388 97 49 1 \N \N 390 98 101 1 \N \N 391 98 49 1 \N \N 392 98 137 1 \N \N 394 99 52 1 \N \N 395 99 10 1 \N \N 396 99 102 1 \N \N 398 100 36 1 \N \N 399 100 113 1 \N \N 400 100 111 1 \N \N 402 101 5 1 \N \N 403 101 23 1 \N \N 404 101 71 1 \N \N 406 102 32 1 \N \N 407 102 23 1 \N \N 408 102 47 1 \N \N 410 103 22 1 \N \N 411 103 75 1 \N \N 412 103 89 1 \N \N 414 104 39 1 \N \N 415 104 149 1 \N \N 416 104 89 1 \N \N 418 105 143 1 \N \N 419 105 90 1 \N \N 420 105 4 1 \N \N 422 106 146 1 \N \N 423 106 94 1 \N \N 424 106 138 1 \N \N 426 107 124 1 \N \N 556 139 68 1 \N \N 558 140 109 1 \N \N 559 140 120 1 \N \N 560 140 124 1 \N \N 562 141 60 1 \N \N 563 141 105 1 \N \N 564 141 64 1 \N \N 566 142 6 1 \N \N 567 142 128 1 \N \N 568 142 57 1 \N \N 570 143 141 1 \N \N 571 143 56 1 \N \N 572 143 47 1 \N \N 574 144 149 1 \N \N 575 144 119 1 \N \N 576 144 5 1 \N \N 578 145 133 1 \N \N 579 145 34 1 \N \N 580 145 122 1 \N \N 582 146 114 1 \N \N 583 146 105 1 \N \N 584 146 56 1 \N \N 586 147 112 1 \N \N 587 147 28 1 \N \N 588 147 34 1 \N \N 590 148 115 1 \N \N 591 148 90 1 \N \N 592 148 12 1 \N \N 594 149 71 1 \N \N 595 149 89 1 \N \N 596 149 91 1 \N \N 598 150 143 1 \N \N 599 150 37 1 \N \N 600 150 98 1 \N \N 602 151 131 1 \N \N 603 151 25 1 \N \N 604 151 46 1 \N \N 606 152 42 1 \N \N 607 152 19 1 \N \N 608 152 123 1 \N \N 610 153 6 1 \N \N 611 153 9 1 \N \N 41 11 48 3 2015-12-09 14:00:00+01 2015-12-09 21:00:00+01 45 12 103 3 2015-12-09 16:00:00+01 2015-12-09 23:00:00+01 49 13 13 4 2015-12-09 14:00:00+01 2015-12-09 21:00:00+01 53 14 56 4 2015-12-09 18:00:00+01 2015-12-10 01:00:00+01 57 15 21 7 2015-12-09 17:00:00+01 2015-12-09 22:00:00+01 101 26 65 7 2015-12-11 19:00:00+01 2015-12-12 01:30:00+01 77 20 109 7 2015-12-10 18:00:00+01 2015-12-11 01:00:00+01 149 38 22 7 2015-12-12 19:00:00+01 2015-12-13 01:30:00+01 145 37 34 4 2015-12-12 19:00:00+01 2015-12-13 02:00:00+01 133 34 136 3 2015-12-12 14:00:00+01 2015-12-12 21:00:00+01 137 35 130 3 2015-12-12 19:00:00+01 2015-12-13 02:00:00+01 85 22 6 3 2015-12-11 14:00:00+01 2015-12-11 21:00:00+01 89 23 57 3 2015-12-11 19:00:00+01 2015-12-12 02:00:00+01 61 16 99 3 2015-12-10 14:00:00+01 2015-12-10 21:00:00+01 65 17 26 3 2015-12-10 16:00:00+01 2015-12-10 23:00:00+01 185 47 33 4 2015-12-13 14:00:00+01 2015-12-13 21:00:00+01 181 46 71 3 2015-12-13 14:00:00+01 2015-12-13 21:00:00+01 249 63 115 7 2015-12-16 18:00:00+01 2015-12-12 23:00:00+01 209 53 131 7 2015-12-14 18:00:00+01 2015-12-14 23:00:00+01 281 71 118 3 2015-12-18 19:00:00+01 2015-12-19 02:00:00+01 277 70 59 3 2015-12-18 13:00:00+01 2015-12-18 20:00:00+01 289 73 70 4 2015-12-18 19:00:00+01 2015-12-19 02:00:00+01 189 48 9 7 2015-12-13 06:00:00+01 2015-12-13 13:00:00+01 285 72 123 4 2015-12-18 14:00:00+01 2015-12-18 21:00:00+01 241 61 63 4 2015-12-16 14:00:00+01 2015-12-16 21:00:00+01 245 62 121 4 2015-12-16 18:00:00+01 2015-12-17 01:00:00+01 237 60 95 3 2015-12-16 16:00:00+01 2015-12-16 23:00:00+01 233 59 95 3 2015-12-16 14:00:00+01 2015-12-16 21:00:00+01 293 74 116 7 2015-12-18 19:00:00+01 2015-12-19 01:30:00+01 305 77 51 5 2015-12-18 17:00:00+01 2015-12-19 00:00:00+01 377 95 60 4 2015-12-20 14:00:00+01 2015-12-20 21:00:00+01 1 1 34 6 \N \N 5 2 3 2 \N \N 9 3 73 2 \N \N 13 4 97 4 \N \N 17 5 86 5 \N \N 21 6 67 5 \N \N 25 7 90 3 \N \N 29 8 44 6 \N \N 33 9 47 4 \N \N 37 10 44 5 \N \N 69 18 28 2 \N \N 73 19 76 5 \N \N 81 21 71 6 \N \N 93 24 35 5 \N \N 97 25 97 2 \N \N 105 27 84 6 \N \N 109 28 104 5 \N \N 113 29 134 2 \N \N 117 30 132 4 \N \N 121 31 110 3 \N \N 125 32 16 6 \N \N 129 33 73 5 \N \N 141 36 38 4 \N \N 153 39 32 3 \N \N 157 40 42 5 \N \N 161 41 27 5 \N \N 165 42 78 2 \N \N 169 43 63 6 \N \N 173 44 133 3 \N \N 177 45 38 5 \N \N 193 49 60 2 \N \N 197 50 69 5 \N \N 201 51 116 3 \N \N 205 52 104 6 \N \N 213 54 83 6 \N \N 217 55 53 5 \N \N 221 56 122 6 \N \N 225 57 139 5 \N \N 229 58 88 4 \N \N 253 64 65 6 \N \N 257 65 87 3 \N \N 261 66 15 2 \N \N 265 67 81 3 \N \N 269 68 149 4 \N \N 273 69 131 2 \N \N 297 75 133 6 \N \N 301 76 121 5 \N \N 309 78 114 6 \N \N 313 79 117 2 \N \N 317 80 124 6 \N \N 321 81 119 5 \N \N 325 82 94 3 \N \N 329 83 44 6 \N \N 333 84 106 4 \N \N 337 85 145 3 \N \N 341 86 85 4 \N \N 345 87 65 3 \N \N 349 88 149 6 \N \N 353 89 108 2 \N \N 357 90 67 6 \N \N 361 91 79 4 \N \N 365 92 11 2 \N \N 369 93 130 6 \N \N 373 94 35 3 \N \N 381 96 7 2 \N \N 385 97 76 3 \N \N 389 98 138 3 \N \N 393 99 46 5 \N \N 397 100 26 4 \N \N 401 101 130 2 \N \N 405 102 30 6 \N \N 409 103 37 2 \N \N 413 104 121 6 \N \N 417 105 118 6 \N \N 421 106 122 6 \N \N 425 107 52 4 \N \N 429 108 22 6 \N \N 433 109 110 6 \N \N 437 110 122 4 \N \N 441 111 109 5 \N \N 445 112 55 4 \N \N 449 113 144 6 \N \N 453 114 32 5 \N \N 457 115 137 6 \N \N 461 116 150 2 \N \N 465 117 55 2 \N \N 742 186 57 1 \N \N 743 186 16 1 \N \N 744 186 38 1 \N \N 746 187 80 1 \N \N 747 187 42 1 \N \N 748 187 134 1 \N \N 750 188 59 1 \N \N 751 188 36 1 \N \N 752 188 65 1 \N \N 754 189 122 1 \N \N 755 189 88 1 \N \N 756 189 104 1 \N \N 758 190 69 1 \N \N 759 190 21 1 \N \N 760 190 48 1 \N \N 762 191 22 1 \N \N 469 118 4 3 \N \N 473 119 84 6 \N \N 477 120 124 2 \N \N 481 121 100 2 \N \N 485 122 105 4 \N \N 489 123 3 3 \N \N 493 124 4 6 \N \N 497 125 21 5 \N \N 501 126 143 3 \N \N 505 127 14 2 \N \N 509 128 117 2 \N \N 513 129 5 4 \N \N 517 130 149 5 \N \N 521 131 46 4 \N \N 525 132 123 4 \N \N 529 133 8 4 \N \N 533 134 79 4 \N \N 537 135 48 4 \N \N 541 136 83 3 \N \N 545 137 37 4 \N \N 549 138 34 6 \N \N 553 139 70 2 \N \N 557 140 13 3 \N \N 561 141 122 4 \N \N 565 142 110 6 \N \N 569 143 143 6 \N \N 573 144 130 3 \N \N 577 145 66 5 \N \N 581 146 94 5 \N \N 585 147 149 3 \N \N 589 148 81 5 \N \N 593 149 15 2 \N \N 597 150 61 3 \N \N 601 151 115 6 \N \N 605 152 101 2 \N \N 609 153 140 5 \N \N 613 154 137 3 \N \N 617 155 66 2 \N \N 621 156 9 4 \N \N 625 157 141 4 \N \N 629 158 3 2 \N \N 633 159 71 4 \N \N 637 160 139 2 \N \N 641 161 39 6 \N \N 645 162 32 2 \N \N 649 163 76 4 \N \N 653 164 138 3 \N \N 657 165 29 5 \N \N 661 166 122 6 \N \N 665 167 45 5 \N \N 669 168 116 2 \N \N 673 169 68 6 \N \N 677 170 71 6 \N \N 681 171 109 4 \N \N 685 172 83 3 \N \N 689 173 136 6 \N \N 693 174 9 3 \N \N 697 175 147 5 \N \N 701 176 55 4 \N \N 705 177 29 2 \N \N 709 178 136 2 \N \N 713 179 124 3 \N \N 717 180 22 2 \N \N 721 181 71 3 \N \N 725 182 22 2 \N \N 729 183 124 2 \N \N 733 184 11 2 \N \N 737 185 133 4 \N \N 741 186 140 3 \N \N 745 187 95 4 \N \N 749 188 147 6 \N \N 753 189 103 3 \N \N 757 190 61 2 \N \N 761 191 29 6 \N \N 765 192 36 2 \N \N 769 193 114 3 \N \N 773 194 113 4 \N \N 777 195 58 4 \N \N 781 196 54 6 \N \N 785 197 113 3 \N \N 789 198 137 3 \N \N 793 199 44 2 \N \N 797 200 36 3 \N \N 801 201 53 2 \N \N 805 202 85 4 \N \N 59 15 147 1 \N \N 60 15 9 1 \N \N 62 16 137 1 \N \N 63 16 93 1 \N \N 64 16 56 1 \N \N 66 17 90 1 \N \N 67 17 130 1 \N \N 68 17 106 1 \N \N 70 18 132 1 \N \N 71 18 1 1 \N \N 72 18 123 1 \N \N 74 19 116 1 \N \N 75 19 27 1 \N \N 76 19 101 1 \N \N 78 20 45 1 \N \N 79 20 27 1 \N \N 80 20 105 1 \N \N 82 21 29 1 \N \N 83 21 133 1 \N \N 84 21 69 1 \N \N 86 22 3 1 \N \N 87 22 91 1 \N \N 88 22 38 1 \N \N 90 23 95 1 \N \N 91 23 38 1 \N \N 92 23 28 1 \N \N 94 24 101 1 \N \N 95 24 64 1 \N \N 96 24 65 1 \N \N 98 25 132 1 \N \N 99 25 96 1 \N \N 100 25 67 1 \N \N 102 26 32 1 \N \N 103 26 112 1 \N \N 104 26 56 1 \N \N 106 27 59 1 \N \N 107 27 95 1 \N \N 108 27 146 1 \N \N 110 28 40 1 \N \N 111 28 99 1 \N \N 112 28 136 1 \N \N 114 29 70 1 \N \N 115 29 55 1 \N \N 116 29 136 1 \N \N 118 30 31 1 \N \N 119 30 107 1 \N \N 120 30 108 1 \N \N 122 31 4 1 \N \N 123 31 86 1 \N \N 124 31 66 1 \N \N 126 32 107 1 \N \N 127 32 9 1 \N \N 128 32 72 1 \N \N 130 33 38 1 \N \N 131 33 58 1 \N \N 132 33 45 1 \N \N 134 34 118 1 \N \N 135 34 11 1 \N \N 136 34 79 1 \N \N 138 35 138 1 \N \N 139 35 126 1 \N \N 140 35 7 1 \N \N 142 36 50 1 \N \N 143 36 58 1 \N \N 144 36 149 1 \N \N 146 37 112 1 \N \N 147 37 86 1 \N \N 148 37 120 1 \N \N 150 38 103 1 \N \N 151 38 72 1 \N \N 152 38 131 1 \N \N 154 39 34 1 \N \N 155 39 10 1 \N \N 156 39 76 1 \N \N 158 40 117 1 \N \N 159 40 96 1 \N \N 160 40 55 1 \N \N 162 41 8 1 \N \N 163 41 96 1 \N \N 164 41 78 1 \N \N 166 42 54 1 \N \N 167 42 43 1 \N \N 168 42 42 1 \N \N 170 43 20 1 \N \N 171 43 31 1 \N \N 172 43 81 1 \N \N 174 44 43 1 \N \N 175 44 30 1 \N \N 176 44 94 1 \N \N 178 45 64 1 \N \N 179 45 60 1 \N \N 180 45 45 1 \N \N 182 46 19 1 \N \N 183 46 12 1 \N \N 184 46 133 1 \N \N 242 61 31 1 \N \N 243 61 4 1 \N \N 244 61 17 1 \N \N 246 62 64 1 \N \N 247 62 67 1 \N \N 248 62 35 1 \N \N 250 63 112 1 \N \N 251 63 9 1 \N \N 252 63 42 1 \N \N 254 64 10 1 \N \N 255 64 80 1 \N \N 256 64 2 1 \N \N 258 65 45 1 \N \N 259 65 7 1 \N \N 260 65 69 1 \N \N 262 66 34 1 \N \N 263 66 124 1 \N \N 264 66 34 1 \N \N 266 67 91 1 \N \N 267 67 49 1 \N \N 268 67 60 1 \N \N 270 68 38 1 \N \N 271 68 59 1 \N \N 272 68 113 1 \N \N 274 69 108 1 \N \N 275 69 51 1 \N \N 276 69 27 1 \N \N 278 70 48 1 \N \N 279 70 148 1 \N \N 280 70 138 1 \N \N 282 71 128 1 \N \N 283 71 74 1 \N \N 284 71 15 1 \N \N 286 72 85 1 \N \N 287 72 7 1 \N \N 288 72 11 1 \N \N 290 73 13 1 \N \N 291 73 87 1 \N \N 292 73 129 1 \N \N 294 74 97 1 \N \N 295 74 83 1 \N \N 296 74 47 1 \N \N 298 75 77 1 \N \N 299 75 48 1 \N \N 300 75 71 1 \N \N 302 76 133 1 \N \N 303 76 112 1 \N \N 304 76 149 1 \N \N 306 77 124 1 \N \N 307 77 96 1 \N \N 308 77 25 1 \N \N 310 78 75 1 \N \N 311 78 18 1 \N \N 312 78 23 1 \N \N 314 79 108 1 \N \N 315 79 94 1 \N \N 316 79 17 1 \N \N 318 80 79 1 \N \N 319 80 148 1 \N \N 320 80 61 1 \N \N 322 81 95 1 \N \N 323 81 89 1 \N \N 324 81 149 1 \N \N 326 82 30 1 \N \N 327 82 13 1 \N \N 328 82 99 1 \N \N 330 83 38 1 \N \N 331 83 37 1 \N \N 332 83 8 1 \N \N 334 84 71 1 \N \N 335 84 117 1 \N \N 336 84 30 1 \N \N 338 85 29 1 \N \N 339 85 148 1 \N \N 340 85 50 1 \N \N 342 86 21 1 \N \N 343 86 125 1 \N \N 344 86 124 1 \N \N 346 87 4 1 \N \N 347 87 9 1 \N \N 348 87 64 1 \N \N 350 88 123 1 \N \N 351 88 92 1 \N \N 352 88 78 1 \N \N 354 89 107 1 \N \N 355 89 79 1 \N \N 356 89 137 1 \N \N 358 90 117 1 \N \N 359 90 74 1 \N \N 360 90 91 1 \N \N 362 91 35 1 \N \N 363 91 72 1 \N \N 364 91 13 1 \N \N 366 92 137 1 \N \N 367 92 31 1 \N \N 368 92 131 1 \N \N 370 93 2 1 \N \N 427 107 14 1 \N \N 428 107 81 1 \N \N 430 108 95 1 \N \N 431 108 132 1 \N \N 432 108 95 1 \N \N 434 109 45 1 \N \N 435 109 12 1 \N \N 436 109 11 1 \N \N 438 110 100 1 \N \N 439 110 2 1 \N \N 440 110 20 1 \N \N 442 111 14 1 \N \N 443 111 18 1 \N \N 444 111 143 1 \N \N 446 112 81 1 \N \N 447 112 95 1 \N \N 448 112 48 1 \N \N 450 113 30 1 \N \N 451 113 50 1 \N \N 452 113 71 1 \N \N 454 114 132 1 \N \N 455 114 61 1 \N \N 456 114 97 1 \N \N 458 115 85 1 \N \N 459 115 36 1 \N \N 460 115 48 1 \N \N 462 116 72 1 \N \N 463 116 70 1 \N \N 464 116 132 1 \N \N 466 117 88 1 \N \N 467 117 17 1 \N \N 468 117 96 1 \N \N 470 118 44 1 \N \N 471 118 100 1 \N \N 472 118 47 1 \N \N 474 119 13 1 \N \N 475 119 96 1 \N \N 476 119 59 1 \N \N 478 120 59 1 \N \N 479 120 110 1 \N \N 480 120 101 1 \N \N 482 121 102 1 \N \N 483 121 25 1 \N \N 484 121 141 1 \N \N 486 122 40 1 \N \N 487 122 11 1 \N \N 488 122 122 1 \N \N 490 123 103 1 \N \N 491 123 96 1 \N \N 492 123 29 1 \N \N 494 124 69 1 \N \N 495 124 120 1 \N \N 496 124 36 1 \N \N 498 125 53 1 \N \N 499 125 15 1 \N \N 500 125 58 1 \N \N 502 126 54 1 \N \N 503 126 22 1 \N \N 504 126 107 1 \N \N 506 127 99 1 \N \N 507 127 127 1 \N \N 508 127 36 1 \N \N 510 128 137 1 \N \N 511 128 90 1 \N \N 512 128 70 1 \N \N 514 129 141 1 \N \N 515 129 101 1 \N \N 516 129 35 1 \N \N 518 130 27 1 \N \N 519 130 119 1 \N \N 520 130 144 1 \N \N 522 131 111 1 \N \N 523 131 70 1 \N \N 524 131 43 1 \N \N 526 132 137 1 \N \N 527 132 146 1 \N \N 528 132 14 1 \N \N 530 133 147 1 \N \N 531 133 81 1 \N \N 532 133 50 1 \N \N 534 134 45 1 \N \N 535 134 76 1 \N \N 536 134 30 1 \N \N 538 135 5 1 \N \N 539 135 81 1 \N \N 540 135 19 1 \N \N 542 136 25 1 \N \N 543 136 131 1 \N \N 544 136 20 1 \N \N 546 137 42 1 \N \N 547 137 101 1 \N \N 548 137 64 1 \N \N 550 138 88 1 \N \N 551 138 55 1 \N \N 552 138 69 1 \N \N 554 139 9 1 \N \N 555 139 87 1 \N \N 612 153 118 1 \N \N 614 154 42 1 \N \N 615 154 105 1 \N \N 616 154 130 1 \N \N 618 155 76 1 \N \N 619 155 45 1 \N \N 620 155 26 1 \N \N 622 156 79 1 \N \N 623 156 68 1 \N \N 624 156 31 1 \N \N 626 157 138 1 \N \N 627 157 113 1 \N \N 628 157 99 1 \N \N 630 158 33 1 \N \N 631 158 144 1 \N \N 632 158 123 1 \N \N 634 159 53 1 \N \N 635 159 33 1 \N \N 636 159 8 1 \N \N 638 160 66 1 \N \N 639 160 117 1 \N \N 640 160 6 1 \N \N 642 161 48 1 \N \N 643 161 30 1 \N \N 644 161 117 1 \N \N 646 162 124 1 \N \N 647 162 30 1 \N \N 648 162 91 1 \N \N 650 163 124 1 \N \N 651 163 58 1 \N \N 652 163 62 1 \N \N 654 164 113 1 \N \N 655 164 108 1 \N \N 656 164 28 1 \N \N 658 165 32 1 \N \N 659 165 99 1 \N \N 660 165 98 1 \N \N 662 166 145 1 \N \N 663 166 32 1 \N \N 664 166 35 1 \N \N 666 167 62 1 \N \N 667 167 122 1 \N \N 668 167 67 1 \N \N 670 168 58 1 \N \N 671 168 149 1 \N \N 672 168 50 1 \N \N 674 169 1 1 \N \N 675 169 105 1 \N \N 676 169 22 1 \N \N 678 170 17 1 \N \N 679 170 68 1 \N \N 680 170 44 1 \N \N 682 171 87 1 \N \N 683 171 111 1 \N \N 684 171 53 1 \N \N 686 172 134 1 \N \N 687 172 37 1 \N \N 688 172 1 1 \N \N 690 173 150 1 \N \N 691 173 119 1 \N \N 692 173 49 1 \N \N 694 174 57 1 \N \N 695 174 107 1 \N \N 696 174 60 1 \N \N 698 175 10 1 \N \N 699 175 102 1 \N \N 700 175 112 1 \N \N 702 176 73 1 \N \N 703 176 34 1 \N \N 704 176 119 1 \N \N 706 177 112 1 \N \N 707 177 2 1 \N \N 708 177 54 1 \N \N 710 178 99 1 \N \N 711 178 15 1 \N \N 712 178 41 1 \N \N 714 179 70 1 \N \N 715 179 100 1 \N \N 716 179 116 1 \N \N 718 180 126 1 \N \N 719 180 23 1 \N \N 720 180 101 1 \N \N 722 181 47 1 \N \N 723 181 88 1 \N \N 724 181 89 1 \N \N 726 182 74 1 \N \N 727 182 105 1 \N \N 728 182 29 1 \N \N 730 183 138 1 \N \N 731 183 45 1 \N \N 732 183 35 1 \N \N 734 184 16 1 \N \N 735 184 33 1 \N \N 736 184 44 1 \N \N 738 185 106 1 \N \N 739 185 58 1 \N \N 740 185 135 1 \N \N 763 191 110 1 \N \N 764 191 35 1 \N \N 766 192 88 1 \N \N 767 192 41 1 \N \N 768 192 91 1 \N \N 770 193 35 1 \N \N 771 193 6 1 \N \N 772 193 16 1 \N \N 774 194 96 1 \N \N 775 194 23 1 \N \N 776 194 58 1 \N \N 778 195 45 1 \N \N 779 195 97 1 \N \N 780 195 14 1 \N \N 782 196 39 1 \N \N 783 196 1 1 \N \N 784 196 78 1 \N \N 786 197 140 1 \N \N 787 197 9 1 \N \N 788 197 59 1 \N \N 790 198 20 1 \N \N 791 198 37 1 \N \N 792 198 103 1 \N \N 794 199 78 1 \N \N 795 199 39 1 \N \N 796 199 124 1 \N \N 798 200 4 1 \N \N 799 200 89 1 \N \N 800 200 146 1 \N \N 802 201 122 1 \N \N 803 201 139 1 \N \N 804 201 27 1 \N \N 806 202 30 1 \N \N 807 202 10 1 \N \N 808 202 13 1 \N \N \. -- -- Name: user_shifts_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres -- SELECT pg_catalog.setval('user_shifts_id_seq', 808, true); -- -- Data for Name: user_workplaces; Type: TABLE DATA; Schema: public; Owner: postgres -- COPY user_workplaces (id, user_id, workplace_id, since) FROM stdin; 1 1 1 H13 2 2 1 H12 3 3 1 H14 4 4 1 V15 5 5 1 V13 6 6 1 H13 7 7 1 H15 8 8 1 V15 9 9 1 V13 10 10 1 H12 11 11 1 V14 12 12 1 V15 13 13 1 H14 14 14 1 V14 15 15 1 H12 16 16 2 V13 17 17 2 H13 18 18 2 V15 19 19 2 V13 20 20 2 V12 21 21 2 V12 22 22 2 V14 23 23 2 H12 24 24 2 V12 25 25 2 H15 26 26 2 H12 27 27 2 V15 28 28 2 H14 29 29 2 H15 30 30 2 V12 31 31 3 V13 32 32 3 V14 33 33 3 V13 34 34 3 V14 35 35 3 H13 36 36 3 V14 37 37 3 H14 38 38 3 H15 39 39 3 V12 40 40 3 H13 41 41 3 H13 42 42 3 H13 43 43 3 H14 44 44 3 V13 45 45 3 H13 46 46 4 H15 47 47 4 V15 48 48 4 H15 49 49 4 V14 50 50 4 H14 51 51 4 H15 52 52 4 V13 53 53 4 H13 54 54 4 H14 55 55 4 V12 56 56 4 V15 57 57 4 H12 58 58 4 H13 59 59 4 V12 60 60 4 H13 61 61 5 H12 62 62 5 H13 63 63 5 V13 64 64 5 V15 65 65 5 V13 66 66 5 H12 67 67 5 V15 68 68 5 H13 69 69 5 V12 70 70 5 V15 71 71 5 V12 72 72 5 V12 73 73 5 H13 74 74 5 V12 75 75 5 V13 76 76 6 H13 77 77 6 H15 78 78 6 H14 79 79 6 H15 80 80 6 V15 81 81 6 H15 82 82 6 V13 83 83 6 H14 84 84 6 V12 85 85 6 H13 86 86 6 V13 87 87 6 V13 88 88 6 V15 89 89 6 H15 90 90 6 H13 91 91 7 H13 92 92 7 V13 93 93 7 V13 94 94 7 V14 95 95 7 V14 96 96 7 H12 97 97 7 V13 98 98 7 H14 99 99 7 V14 100 100 7 V12 101 101 7 V15 102 102 7 H13 103 103 7 H15 104 104 7 V15 105 105 7 H13 106 106 8 H15 107 107 8 H15 108 108 8 V12 109 109 8 H13 110 110 8 V15 111 111 8 V14 112 112 8 V13 113 113 8 H15 114 114 8 H15 115 115 8 H12 116 116 8 H15 117 117 8 V15 118 118 8 V15 119 119 8 H14 120 120 8 H13 121 121 9 H15 122 122 9 H15 123 123 9 H15 124 124 9 H12 125 125 9 H15 126 126 9 H13 127 127 9 V15 128 128 9 V14 129 129 9 H13 130 130 9 H12 131 131 9 V12 132 132 9 V12 133 133 9 H13 134 134 9 V13 135 135 9 V14 136 136 10 H15 137 137 10 V15 138 138 10 H15 139 139 10 V15 140 140 10 V15 141 141 10 V13 142 142 10 V14 143 143 10 H12 144 144 10 H15 145 145 10 H13 146 146 10 H14 147 147 10 V12 148 148 10 V15 149 149 10 V15 150 150 10 H12 \. -- -- Name: user_workplaces_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres -- SELECT pg_catalog.setval('user_workplaces_id_seq', 150, true); -- -- Data for Name: users; Type: TABLE DATA; Schema: public; Owner: postgres -- COPY users (id, email, pass, role, name, created, image, affiliation_id) FROM stdin; 100 nina.lyche@gmail.com pass user Nina Lyche 2015-12-07 17:55:34.166591+01 1 6 101 kirsti.buvarp@gmail.com pass user Kirsti Buvarp 2015-12-07 17:55:34.175394+01 1 6 102 nina.claudi@gmail.com pass user Nina Claudi 2015-12-07 17:55:34.183444+01 1 6 103 anna.steinsrud@gmail.com pass user Anna Steinsrud 2015-12-07 17:55:34.191873+01 1 6 104 sine.johansson@gmail.com pass user Sine Johansson 2015-12-07 17:55:34.200423+01 1 6 105 heimdal.lyche@gmail.com pass user Heimdal Lyche 2015-12-07 17:55:34.2085+01 1 6 106 lars.johansson@gmail.com pass user Lars Johansson 2015-12-07 17:55:34.21802+01 1 6 107 sigrid.jackson@gmail.com pass user Sigrid Jackson 2015-12-07 17:55:34.225595+01 1 6 108 tormod.promp@gmail.com pass user Tormod Promp 2015-12-07 17:55:34.233732+01 1 6 109 alice.kennedy@gmail.com pass user Alice Kennedy 2015-12-07 17:55:34.243099+01 1 7 110 julie.obama@gmail.com pass user Julie Obama 2015-12-07 17:55:34.251171+01 1 7 111 jonas.bay@gmail.com pass user Jonas Bay 2015-12-07 17:55:34.258463+01 1 7 112 alice.winchester@gmail.com pass user Alice Winchester 2015-12-07 17:55:34.266784+01 1 7 113 captain.stordalen@gmail.com pass user Captain Stordalen 2015-12-07 17:55:34.275696+01 1 7 26 heimdal.bush@gmail.com pass user Heimdal Bush 2015-12-07 17:55:33.540779+01 1 2 27 alice.reagan@gmail.com pass user Alice Reagan 2015-12-07 17:55:33.548785+01 1 2 45 petter.lyche@gmail.com pass user Petter Lyche 2015-12-07 17:55:33.699486+01 1 2 46 aslak.hauge@gmail.com pass user Aslak Hauge 2015-12-07 17:55:33.70705+01 1 2 47 tuva.jackson@gmail.com pass user Tuva Jackson 2015-12-07 17:55:33.715497+01 1 2 48 michelle.lyche@gmail.com pass user Michelle Lyche 2015-12-07 17:55:33.72422+01 1 2 49 sigrid.reagan@gmail.com pass user Sigrid Reagan 2015-12-07 17:55:33.732535+01 1 2 50 joar.stordalen@gmail.com pass user Joar Stordalen 2015-12-07 17:55:33.740432+01 1 2 114 aslak.tullball@gmail.com pass user Aslak Tullball 2015-12-07 17:55:34.284392+01 1 7 115 stine.haugland@gmail.com pass user Stine Haugland 2015-12-07 17:55:34.29184+01 1 7 116 jon.kennedy@gmail.com pass user Jon Kennedy 2015-12-07 17:55:34.300137+01 1 7 117 håkon.jackson@gmail.com pass user Håkon Jackson 2015-12-07 17:55:34.309538+01 1 7 118 kristoffer.tullball@gmail.com pass user Kristoffer Tullball 2015-12-07 17:55:34.317136+01 1 7 119 mari.haugland@gmail.com pass user Mari Haugland 2015-12-07 17:55:34.325568+01 1 7 123 nina.zakova@gmail.com pass user Nina Zakova 2015-12-07 17:55:34.358904+01 1 8 124 lilli.bay@gmail.com pass user Lilli Bay 2015-12-07 17:55:34.368346+01 1 8 125 mari.hauge@gmail.com pass user Mari Hauge 2015-12-07 17:55:34.375945+01 1 8 126 julie.eriksen@gmail.com pass user Julie Eriksen 2015-12-07 17:55:34.383547+01 1 8 127 lilli.promp@gmail.com pass user Lilli Promp 2015-12-07 17:55:34.392893+01 1 8 128 jon.nybakk@gmail.com pass user Jon Nybakk 2015-12-07 17:55:34.400909+01 1 8 11 ivar.hansen@gmail.com pass user Ivar Hansen 2015-12-07 17:55:33.417514+01 1 1 12 michelle.bush@gmail.com pass user Michelle Bush 2015-12-07 17:55:33.424328+01 1 1 25 olga.lyche@gmail.com pass user Olga Lyche 2015-12-07 17:55:33.531967+01 1 1 13 sigrid.lyche@gmail.com pass user Sigrid Lyche 2015-12-07 17:55:33.432384+01 1 1 14 tony.stordalen@gmail.com pass user Tony Stordalen 2015-12-07 17:55:33.440292+01 1 1 15 tormod.carter@gmail.com pass user Tormod Carter 2015-12-07 17:55:33.449126+01 1 1 16 julie.johansson@gmail.com pass user Julie Johansson 2015-12-07 17:55:33.458169+01 1 1 17 captain.hauge@gmail.com pass user Captain Hauge 2015-12-07 17:55:33.466895+01 1 1 18 joar.obama@gmail.com pass user Joar Obama 2015-12-07 17:55:33.473675+01 1 1 129 michael.zwaig@gmail.com pass user Michael Zwaig 2015-12-07 17:55:34.410035+01 1 8 51 kristoffer.buvarp@gmail.com pass user Kristoffer Buvarp 2015-12-07 17:55:33.748872+01 1 3 52 ivar.hauge@gmail.com pass user Ivar Hauge 2015-12-07 17:55:33.75776+01 1 3 53 tony.guttormsen@gmail.com pass user Tony Guttormsen 2015-12-07 17:55:33.765224+01 1 3 54 christine.buvarp@gmail.com pass user Christine Buvarp 2015-12-07 17:55:33.773625+01 1 3 19 tuva.misund@gmail.com pass user Tuva Misund 2015-12-07 17:55:33.482873+01 1 1 55 aslak.gay@gmail.com pass user Aslak Gay 2015-12-07 17:55:33.783173+01 1 3 56 alice.likhus@gmail.com pass user Alice Likhus 2015-12-07 17:55:33.790401+01 1 3 57 thor.bay@gmail.com pass user Thor Bay 2015-12-07 17:55:33.79896+01 1 3 58 magnus.guttormsen@gmail.com pass user Magnus Guttormsen 2015-12-07 17:55:33.807595+01 1 3 59 espen.guttormsen@gmail.com pass user Espen Guttormsen 2015-12-07 17:55:33.816768+01 1 3 60 tuva.winchester@gmail.com pass user Tuva Winchester 2015-12-07 17:55:33.826842+01 1 3 61 aslak.claudi@gmail.com pass user Aslak Claudi 2015-12-07 17:55:33.832147+01 1 3 20 michelle.bay@gmail.com pass user Michelle Bay 2015-12-07 17:55:33.490376+01 1 1 21 mari.nybakk@gmail.com pass user Mari Nybakk 2015-12-07 17:55:33.498718+01 1 1 22 brit.hauge@gmail.com pass user Brit Hauge 2015-12-07 17:55:33.508027+01 1 1 23 captain.obama@gmail.com pass user Captain Obama 2015-12-07 17:55:33.516174+01 1 1 24 kirsti.steinsrud@gmail.com pass user Kirsti Steinsrud 2015-12-07 17:55:33.523521+01 1 1 10 stian.stordalen@gmail.com pass user Stian Stordalen 2015-12-07 17:55:33.406891+01 1 1 62 odin.likhus@gmail.com pass user Odin Likhus 2015-12-07 17:55:33.840607+01 1 3 81 odin.lyche@gmail.com pass user Odin Lyche 2015-12-07 17:55:34.009202+01 1 4 82 anna.buvarp@gmail.com pass user Anna Buvarp 2015-12-07 17:55:34.016717+01 1 4 83 karen.eriksen@gmail.com pass user Karen Eriksen 2015-12-07 17:55:34.025221+01 1 4 130 sigrid.bay@gmail.com pass user Sigrid Bay 2015-12-07 17:55:34.417786+01 1 8 131 sigrid.carter@gmail.com pass user Sigrid Carter 2015-12-07 17:55:34.429662+01 1 8 132 tony.tullball@gmail.com pass user Tony Tullball 2015-12-07 17:55:34.438667+01 1 8 133 michelle.haugland@gmail.com pass user Michelle Haugland 2015-12-07 17:55:34.443087+01 1 8 134 thea.jackson@gmail.com pass user Thea Jackson 2015-12-07 17:55:34.450171+01 1 8 135 julie.claudi@gmail.com pass user Julie Claudi 2015-12-07 17:55:34.483735+01 1 8 136 christine.zakova@gmail.com pass user Christine Zakova 2015-12-07 17:55:34.492065+01 1 8 137 anna.obama@gmail.com pass user Anna Obama 2015-12-07 17:55:34.500573+01 1 9 138 sigrid.tullball@gmail.com pass user Sigrid Tullball 2015-12-07 17:55:34.508724+01 1 9 139 lilli.eriksen@gmail.com pass user Lilli Eriksen 2015-12-07 17:55:34.517102+01 1 9 140 stian.sørbotten@gmail.com pass user Stian Sørbotten 2015-12-07 17:55:34.525755+01 1 9 141 michelle.reagan@gmail.com pass user Michelle Reagan 2015-12-07 17:55:34.533796+01 1 9 142 ivar.promp@gmail.com pass user Ivar Promp 2015-12-07 17:55:34.542158+01 1 9 143 heimdal.nybakk@gmail.com pass user Heimdal Nybakk 2015-12-07 17:55:34.551082+01 1 9 67 magnus.hansen@gmail.com pass user Magnus Hansen 2015-12-07 17:55:33.891111+01 1 5 68 magnus.stordalen@gmail.com pass user Magnus Stordalen 2015-12-07 17:55:33.898984+01 1 5 69 tuva.zwaig@gmail.com pass user Tuva Zwaig 2015-12-07 17:55:33.908354+01 1 5 70 tuva.promp@gmail.com pass user Tuva Promp 2015-12-07 17:55:33.916819+01 1 5 71 lars.stordalen@gmail.com pass user Lars Stordalen 2015-12-07 17:55:33.925198+01 1 5 72 julie.sørbotten@gmail.com pass user Julie Sørbotten 2015-12-07 17:55:33.933444+01 1 5 73 magnus.kennedy@gmail.com pass user Magnus Kennedy 2015-12-07 17:55:33.942508+01 1 5 74 thea.guttormsen@gmail.com pass user Thea Guttormsen 2015-12-07 17:55:33.95022+01 1 5 75 lilli.likhus@gmail.com pass user Lilli Likhus 2015-12-07 17:55:33.958532+01 1 5 76 michael.sørbotten@gmail.com pass user Michael Sørbotten 2015-12-07 17:55:33.968532+01 1 5 63 nina.hauge@gmail.com pass user Nina Hauge 2015-12-07 17:55:33.849393+01 1 3 64 sigrid.gay@gmail.com pass user Sigrid Gay 2015-12-07 17:55:33.857098+01 1 3 65 espen.sørbotten@gmail.com pass user Espen Sørbotten 2015-12-07 17:55:33.865648+01 1 3 77 steffen.buvarp@gmail.com pass user Steffen Buvarp 2015-12-07 17:55:33.975773+01 1 5 78 sigrid.guttormsen@gmail.com pass user Sigrid Guttormsen 2015-12-07 17:55:33.983446+01 1 5 79 steffen.lyche@gmail.com pass user Steffen Lyche 2015-12-07 17:55:33.991821+01 1 5 80 magnus.likhus@gmail.com pass user Magnus Likhus 2015-12-07 17:55:34.000074+01 1 5 66 brit.bay@gmail.com pass user Brit Bay 2015-12-07 17:55:33.879723+01 1 5 120 aslak.tullball@gmail.com pass user Aslak Tullball 2015-12-07 17:55:34.33451+01 1 7 121 karen.sandvik@gmail.com pass user Karen Sandvik 2015-12-07 17:55:34.342576+01 1 7 1 magnusb.93@gmail.com pass admin Magnus Buvarp 2015-12-07 17:55:33.261888+01 1 1 2 magnus.holmås@gmail.com pass user Magnus Holmås 2015-12-07 17:55:33.315888+01 1 1 3 tuva.steinsrud@gmail.com pass user Tuva Steinsrud 2015-12-07 17:55:33.324037+01 1 1 4 sigrid.reagan@gmail.com pass user Sigrid Reagan 2015-12-07 17:55:33.335517+01 1 1 5 tuva.jackson@gmail.com pass user Tuva Jackson 2015-12-07 17:55:33.365154+01 1 1 6 lars.johansson@gmail.com pass user Lars Johansson 2015-12-07 17:55:33.37364+01 1 1 7 sine.kennedy@gmail.com pass user Sine Kennedy 2015-12-07 17:55:33.381955+01 1 1 8 magnus.sandvik@gmail.com pass user Magnus Sandvik 2015-12-07 17:55:33.390183+01 1 1 9 stine.hansen@gmail.com pass user Stine Hansen 2015-12-07 17:55:33.398571+01 1 1 28 jon.tullball@gmail.com pass user Jon Tullball 2015-12-07 17:55:33.556866+01 1 2 29 nina.steinsrud@gmail.com pass user Nina Steinsrud 2015-12-07 17:55:33.565139+01 1 2 30 tony.obama@gmail.com pass user Tony Obama 2015-12-07 17:55:33.574432+01 1 2 31 håkon.winchester@gmail.com pass user Håkon Winchester 2015-12-07 17:55:33.582001+01 1 2 32 lars.gay@gmail.com pass user Lars Gay 2015-12-07 17:55:33.590267+01 1 2 33 alice.stordalen@gmail.com pass user Alice Stordalen 2015-12-07 17:55:33.59879+01 1 2 34 tuva.steinsrud@gmail.com pass user Tuva Steinsrud 2015-12-07 17:55:33.607745+01 1 2 35 steffen.holmås@gmail.com pass user Steffen Holmås 2015-12-07 17:55:33.615257+01 1 2 36 haakon.tullball@gmail.com pass user Haakon Tullball 2015-12-07 17:55:33.62354+01 1 2 37 thea.zwaig@gmail.com pass user Thea Zwaig 2015-12-07 17:55:33.632368+01 1 2 38 ivar.johansson@gmail.com pass user Ivar Johansson 2015-12-07 17:55:33.640717+01 1 2 39 michelle.obama@gmail.com pass user Michelle Obama 2015-12-07 17:55:33.650279+01 1 2 122 iron.zwaig@gmail.com pass user Iron Zwaig 2015-12-07 17:55:34.350702+01 1 7 40 olga.eriksen@gmail.com pass user Olga Eriksen 2015-12-07 17:55:33.657087+01 1 2 41 thea.holmås@gmail.com pass user Thea Holmås 2015-12-07 17:55:33.665967+01 1 2 42 captain.steinsrud@gmail.com pass user Captain Steinsrud 2015-12-07 17:55:33.674415+01 1 2 43 magnus.kennedy@gmail.com pass user Magnus Kennedy 2015-12-07 17:55:33.682232+01 1 2 44 stine.kennedy@gmail.com pass user Stine Kennedy 2015-12-07 17:55:33.690289+01 1 2 84 petter.kennedy@gmail.com pass user Petter Kennedy 2015-12-07 17:55:34.034266+01 1 4 85 olga.nybakk@gmail.com pass user Olga Nybakk 2015-12-07 17:55:34.041867+01 1 4 86 petter.stordalen@gmail.com pass user Petter Stordalen 2015-12-07 17:55:34.050268+01 1 4 87 kristoffer.buvarp@gmail.com pass user Kristoffer Buvarp 2015-12-07 17:55:34.062156+01 1 4 88 odin.tullball@gmail.com pass user Odin Tullball 2015-12-07 17:55:34.067368+01 1 4 89 thor.bay@gmail.com pass user Thor Bay 2015-12-07 17:55:34.075107+01 1 4 90 michael.obama@gmail.com pass user Michael Obama 2015-12-07 17:55:34.083449+01 1 4 91 tormod.buvarp@gmail.com pass user Tormod Buvarp 2015-12-07 17:55:34.092325+01 1 4 92 magnus.stordalen@gmail.com pass user Magnus Stordalen 2015-12-07 17:55:34.100372+01 1 4 93 sigrid.haugland@gmail.com pass user Sigrid Haugland 2015-12-07 17:55:34.108712+01 1 4 94 lilli.claudi@gmail.com pass user Lilli Claudi 2015-12-07 17:55:34.117041+01 1 4 95 anna.sørbotten@gmail.com pass user Anna Sørbotten 2015-12-07 17:55:34.126034+01 1 6 96 stine.haugland@gmail.com pass user Stine Haugland 2015-12-07 17:55:34.133531+01 1 6 97 aslak.hauge@gmail.com pass user Aslak Hauge 2015-12-07 17:55:34.141813+01 1 6 98 julie.obama@gmail.com pass user Julie Obama 2015-12-07 17:55:34.151433+01 1 6 99 sine.stordalen@gmail.com pass user Sine Stordalen 2015-12-07 17:55:34.159236+01 1 6 144 lilli.buvarp@gmail.com pass user Lilli Buvarp 2015-12-07 17:55:34.558904+01 1 9 145 iron.eriksen@gmail.com pass user Iron Eriksen 2015-12-07 17:55:34.566823+01 1 9 146 nina.holmås@gmail.com pass user Nina Holmås 2015-12-07 17:55:34.575638+01 1 9 147 iron.sandvik@gmail.com pass user Iron Sandvik 2015-12-07 17:55:34.583805+01 1 9 148 ivar.stordalen@gmail.com pass user Ivar Stordalen 2015-12-07 17:55:34.592387+01 1 9 149 olga.johansson@gmail.com pass user Olga Johansson 2015-12-07 17:55:34.600342+01 1 9 150 heimdal.kennedy@gmail.com pass user Heimdal Kennedy 2015-12-07 17:55:34.609241+01 1 9 \. -- -- Name: users_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres -- SELECT pg_catalog.setval('users_id_seq', 150, true); -- -- Data for Name: workplaces; Type: TABLE DATA; Schema: public; Owner: postgres -- COPY workplaces (id, name, description) FROM stdin; 2 Edgar \N 3 Daglighallen \N 4 Rundhallen \N 5 Klubben \N 6 Bodegaen \N 7 Storsalen Syd \N 8 Storsalen Nord \N 1 Lyche \N 9 Strossa \N 10 Selskapssiden \N \. -- -- Name: affiliations_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: -- ALTER TABLE ONLY affiliations ADD CONSTRAINT affiliations_pkey PRIMARY KEY (id); -- -- Name: bars_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: -- ALTER TABLE ONLY workplaces ADD CONSTRAINT bars_pkey PRIMARY KEY (id); -- -- Name: roles_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: -- ALTER TABLE ONLY roles ADD CONSTRAINT roles_pkey PRIMARY KEY (id); -- -- Name: shift_types_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: -- ALTER TABLE ONLY shift_types ADD CONSTRAINT shift_types_pkey PRIMARY KEY (id); -- -- Name: shifts_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: -- ALTER TABLE ONLY shifts ADD CONSTRAINT shifts_pkey PRIMARY KEY (id); -- -- Name: shifts_pkey1; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: -- ALTER TABLE ONLY user_shifts ADD CONSTRAINT shifts_pkey1 PRIMARY KEY (id); -- -- Name: user_workplaces_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: -- ALTER TABLE ONLY user_workplaces ADD CONSTRAINT user_workplaces_pkey PRIMARY KEY (id); -- -- Name: users_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: -- ALTER TABLE ONLY users ADD CONSTRAINT users_pkey PRIMARY KEY (id); -- -- Name: shifts_bar_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY shifts ADD CONSTRAINT shifts_bar_id_fkey FOREIGN KEY (bar_id) REFERENCES workplaces(id); -- -- Name: shifts_type_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY shifts ADD CONSTRAINT shifts_type_id_fkey FOREIGN KEY (type_id) REFERENCES shift_types(id); -- -- Name: user_shifts_role_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY user_shifts ADD CONSTRAINT user_shifts_role_id_fkey FOREIGN KEY (role_id) REFERENCES roles(id); -- -- Name: user_shifts_shift_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY user_shifts ADD CONSTRAINT user_shifts_shift_id_fkey FOREIGN KEY (shift_id) REFERENCES shifts(id); -- -- Name: user_shifts_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY user_shifts ADD CONSTRAINT user_shifts_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id); -- -- Name: user_workplaces_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY user_workplaces ADD CONSTRAINT user_workplaces_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id); -- -- Name: user_workplaces_workplace_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY user_workplaces ADD CONSTRAINT user_workplaces_workplace_id_fkey FOREIGN KEY (workplace_id) REFERENCES workplaces(id); -- -- Name: public; Type: ACL; Schema: -; Owner: postgres -- REVOKE ALL ON SCHEMA public FROM PUBLIC; REVOKE ALL ON SCHEMA public FROM postgres; GRANT ALL ON SCHEMA public TO postgres; GRANT ALL ON SCHEMA public TO PUBLIC; -- -- PostgreSQL database dump complete --
create or replace view v1_hdzf005_hd as select a."HDDE213",a."JSDEG124",a."DE011",a."DE007",a."JSDE305",a."DE151",a."HDDE214",a."JSDE912",a."DE195",a."JSDE364",a."JSDE955",a."DE042",a."JSDE803",a."JSDE306", a."JSDE307",a."JSDE308",a."JSDE220",a."DE181",a."JSDE901",a."JSDE940",a."DE001",a."JSDEG215",a."JSDE909",a."JSDE999",a."DE022",a."JSDE014",a."CZDE940",a."CZDE941", a."JSDE090",a."PZID",a."PDH" ,a.kjpzh,jsde912 YHDM from hdzf005 a where a.hdde214 = 10 and de011||DE007 <'201304' union select a."HDDE213",a."JSDEG124",a."DE011",a."DE007",a."JSDE305",a."DE151",a."HDDE214",a."JSDE912",a."DE195",a."JSDE364",a."JSDE955",a."DE042",a."JSDE803",a."JSDE306", a."JSDE307",a."JSDE308",a."JSDE220",a."DE181",a."JSDE901",a."JSDE940",a."DE001",a."JSDEG215",a."JSDE909",a."JSDE999",a."DE022",a."JSDE014",a."CZDE940",a."CZDE941", a."JSDE090",a."PZID",a."PDH",a.kjpzh,y.hdde216 yhdm from hdzf005 a ,CFG072 y where a.hdde214 = 20 and y.jsde004 = 19 and a.jsde912 = y.jsde912 and de011||DE007 <'201304' union select a."HDDE213",a."JSDEG124",a."DE011",a."DE007",a."JSDE305",a."DE151",a."HDDE214",a."JSDE912",a."DE195",a."JSDE364",a."JSDE955",a."DE042",a."JSDE803",a."JSDE306", a."JSDE307",a."JSDE308",a."JSDE220",a."DE181",a."JSDE901",a."JSDE940",a."DE001",a."JSDEG215",a."JSDE909",a."JSDE999",a."DE022",a."JSDE014",a."CZDE940",a."CZDE941", a."JSDE090",a."PZID",a."PDH" ,a.kjpzh,jsde912 YHDM from hdzf005 a where de011||DE007 >='201304';
--1. Who checked out the book 'The Hobbit’? --Anand Beck SELECT member.name FROM member WHERE member.id IN ( SELECT checkout_item.member_id FROM book, checkout_item WHERE checkout_item.book_id = book.id AND book.title = 'The Hobbit' ); -- 2. How many people have not checked out anything? -- 37 SELECT COUNT(member.name) FROM member WHERE member.id NOT IN ( SELECT member_id FROM checkout_item ); -- 3. What books and movies aren't checked out? -- (There must be a more elegant way to achieve this?) -- 1984 -- Catcher in the Rye -- Crouching Tiger, Hidden Dragon -- Domain Driven Design -- Fellowship of the Ring -- Lawrence of Arabia -- Office Space -- Thin Red Line -- To Kill a Mockingbird -- Tom Sawyer SELECT book.title FROM book WHERE NOT EXISTS (SELECT * FROM checkout_item WHERE checkout_item.book_id = book.id) UNION SELECT movie.title FROM movie WHERE NOT EXISTS (SELECT * FROM checkout_item WHERE checkout_item.movie_id = movie.id); -- 4. Add the book 'The Pragmatic Programmer', and add yourself as a member. Check out 'The Pragmatic Programmer'. Use your query from question 1 to verify that you have checked it out. Also, provide the SQL used to update the database. INSERT INTO book (title) VALUES ('The Pragmatic Programmer'); INSERT INTO member (name) VALUES ('Ella Fahie'); INSERT INTO checkout_item (member_id, book_id) VALUES( (SELECT member.id FROM member WHERE member.name = 'Ella Fahie'), (SELECT book.id AS book_id FROM book WHERE book.title = 'The Pragmatic Programmer' ) ); -- 5. Who has checked out more that 1 item? -- Anand Beck -- Frank Smith SELECT member.name FROM member WHERE member.id IN ( SELECT checkout_item.member_id FROM checkout_item GROUP BY member_id HAVING COUNT(*) > 1 );
-- phpMyAdmin SQL Dump -- version 4.5.4.1deb2ubuntu2 -- http://www.phpmyadmin.net -- -- Host: localhost -- Generation Time: Sep 19, 2017 at 12:16 PM -- Server version: 10.0.31-MariaDB-0ubuntu0.16.04.2 -- PHP Version: 5.6.31-4+ubuntu16.04.1+deb.sury.org+4 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: `smandu` -- -- -------------------------------------------------------- -- -- Table structure for table `buku` -- CREATE TABLE `buku` ( `id_buku` int(10) UNSIGNED NOT NULL, `kode_buku` varchar(11) NOT NULL, `id_judul` int(10) UNSIGNED NOT NULL, `is_ada` enum('y','n') NOT NULL DEFAULT 'y' ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `buku` -- INSERT INTO `buku` (`id_buku`, `kode_buku`, `id_judul`, `is_ada`) VALUES (1, '959.223KinE', 1, 'n'), (2, '959.223KinE', 1, 'y'), (3, '959.223IdiS', 2, 'n'), (4, '959.223IdiS', 2, 'n'), (5, '959.223HarK', 3, 'n'), (6, '959.223HarK', 3, 'y'), (7, '090.223SarJ', 4, 'n'), (8, '090.223SarJ', 4, 'y'), (9, '959.223MarB', 5, 'n'), (10, '959.223MarB', 5, 'n'), (11, '959.223MarM', 6, 'n'), (12, '959.223MarM', 6, 'n'), (13, '959.223NunB', 7, 'y'), (14, '959.223HarK', 8, 'y'), (15, '959.223MuhS', 9, 'y'), (16, '959.223NunB', 10, 'n'); -- -------------------------------------------------------- -- -- Table structure for table `denda` -- CREATE TABLE `denda` ( `id_pinjam` int(10) UNSIGNED NOT NULL, `jumlah` int(10) UNSIGNED NOT NULL, `tanggal_pembayaran` date NOT NULL, `is_dibayar` enum('y','n') NOT NULL DEFAULT 'n' ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `denda` -- INSERT INTO `denda` (`id_pinjam`, `jumlah`, `tanggal_pembayaran`, `is_dibayar`) VALUES (1, 1500, '2017-09-07', 'y'), (2, 6000, '2017-09-19', 'y'); -- -------------------------------------------------------- -- -- Table structure for table `judul` -- CREATE TABLE `judul` ( `id_judul` int(10) UNSIGNED NOT NULL, `isbn` varchar(13) NOT NULL DEFAULT '0', `judul_buku` varchar(100) NOT NULL, `penulis` varchar(30) NOT NULL, `penerbit` varchar(30) NOT NULL, `letak` varchar(20) DEFAULT NULL, `cover` varchar(100) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `judul` -- INSERT INTO `judul` (`id_judul`, `isbn`, `judul_buku`, `penulis`, `penerbit`, `letak`, `cover`) VALUES (1, '9786022774617', 'Ekonomi SMA Kelas X', 'Kinanti Geminastiti', 'Yrama Widya', 'A', '20170904141155.jpg'), (2, '9786022415336', 'Sosiologi SMA Kelas X', 'Idianto Muin', 'Penerbit Erlangga', 'B', '20170904141708.jpg'), (3, '9786023742899', 'Kimia', 'A. Haris Watoni', 'Yrama Widya', 'C', '20170904142110.jpg'), (4, '9796929457', 'Jendela Hati', 'Sari Pusparini Soleh', 'ROSDA', 'D', '20170904142843.jpg'), (5, '9786022276390', 'Buku Siswa Matematika SMA Kelas XII', 'Marthen Kanginan', 'Yrama Widya', 'E', '20170904143358.jpg'), (6, '9789790779680', 'Matematika untuk SMA Kelas XI', 'Marthen Kanginan', 'Yrama Widya', 'F', '20170904143715.jpg'), (7, '9786022774594', 'Biologi untuk SMA Kelas XII', 'Nunung Nurhayati', 'Yrama Widya', 'G', '20170904144659.jpg'), (8, '9786022774846', 'Kimia SMA Kelas XII', 'Haris Watoni', 'Yrama Widya', 'H', '20170904145055.jpg'), (9, '9786022770701', 'Sosiologi SMA Kelas XI', 'Muhammad Taupan', 'Yrama Widya', 'F', '20170904145727.jpg'), (10, '9786022770589', 'Biologi Kelas XI', 'Nunung Nurhayati', 'Yrama Widya', 'C', '20170904150004.jpg'); -- -------------------------------------------------------- -- -- Table structure for table `kelas` -- CREATE TABLE `kelas` ( `id_kelas` int(10) UNSIGNED NOT NULL, `nama_kelas` varchar(20) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `kelas` -- INSERT INTO `kelas` (`id_kelas`, `nama_kelas`) VALUES (1, 'X A1'), (2, 'X A2'), (3, 'X A3'), (4, 'X A4'), (5, 'X A5'), (6, 'X S1'), (7, 'X S2'), (8, 'X S3'), (9, 'XI A1'), (10, 'XI A2'), (11, 'XI A3'), (12, 'XI A4'), (13, 'XI A5'), (14, 'XI S1'), (15, 'XI S2'), (16, 'XI S3'), (17, 'XII A1'), (18, 'XII A2'), (19, 'XII S1'), (20, 'XII S2'), (21, 'XII S3'), (22, 'Guru'); -- -------------------------------------------------------- -- -- Table structure for table `peminjaman` -- CREATE TABLE `peminjaman` ( `id_pinjam` int(10) UNSIGNED NOT NULL, `kode_pinjam` varchar(14) NOT NULL, `tanggal_pinjam` date NOT NULL, `id_user` int(10) UNSIGNED NOT NULL, `id_buku` int(10) UNSIGNED NOT NULL, `tanggal_kembali` date DEFAULT NULL, `status` enum('1','2','3','4') NOT NULL DEFAULT '1' ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `peminjaman` -- INSERT INTO `peminjaman` (`id_pinjam`, `kode_pinjam`, `tanggal_pinjam`, `id_user`, `id_buku`, `tanggal_kembali`, `status`) VALUES (1, '20170904150301', '2017-09-01', 3, 3, '2017-09-07', '4'), (2, '20170904150820', '2017-09-04', 2, 1, '2017-09-19', '4'), (3, '20170903151409', '2017-09-03', 8, 11, '2017-09-04', '4'), (4, '20170904151511', '2017-09-04', 8, 16, '2017-09-04', '4'), (5, '20170904151933', '2017-09-04', 1, 7, '2017-09-04', '4'), (6, '20170907080828', '2017-09-07', 2, 7, NULL, '2'), (7, '20170907081621', '2017-09-07', 3, 8, NULL, '3'), (8, '20170907083342', '2017-09-07', 3, 3, NULL, '3'), (9, '20170907104529', '2017-09-07', 2, 3, NULL, '2'), (10, '20170907105015', '2017-09-07', 8, 11, NULL, '1'), (11, '20170907105033', '2017-09-06', 8, 16, NULL, '1'), (12, '20170907105627', '2017-09-07', 12, 9, NULL, '1'), (13, '20170907105712', '2017-09-07', 12, 10, NULL, '2'), (18, '20170907120922', '2017-09-07', 6, 2, '2017-09-07', '4'), (19, '20170911112258', '2017-09-11', 9, 5, NULL, '2'), (20, '20170913180606', '2017-09-13', 6, 12, NULL, '2'), (21, '20170913180742', '2017-09-13', 10, 1, NULL, '1'), (22, '20170913180804', '2017-09-13', 10, 4, NULL, '1'); -- -------------------------------------------------------- -- -- Table structure for table `user` -- CREATE TABLE `user` ( `id_user` int(10) UNSIGNED NOT NULL, `username` varchar(30) NOT NULL, `password` varchar(50) NOT NULL, `level` enum('admin','anggota') NOT NULL DEFAULT 'anggota', `is_verified` enum('y','n') NOT NULL DEFAULT 'n', `no_induk` varchar(20) NOT NULL, `nama` varchar(30) NOT NULL, `jenis_kelamin` enum('l','p') NOT NULL, `no_hp` varchar(15) NOT NULL, `id_kelas` int(10) UNSIGNED NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `user` -- INSERT INTO `user` (`id_user`, `username`, `password`, `level`, `is_verified`, `no_induk`, `nama`, `jenis_kelamin`, `no_hp`, `id_kelas`) VALUES (1, 'salamah', '21232f297a57a5a743894a0e4a801fc3', 'admin', 'y', '02030004', 'salamah', 'p', '088824375423', 22), (2, 'andri', 'e10adc3949ba59abbe56e057f20f883e', 'anggota', 'y', '16170001', 'Andri Budi Trisnaliadi', 'l', '0888234424512', 1), (3, 'syifa', 'e10adc3949ba59abbe56e057f20f883e', 'anggota', 'y', '16170002', 'Syifa Nur Aisyah Zahra', 'p', '0888234424523', 2), (4, 'syarif', 'e10adc3949ba59abbe56e057f20f883e', 'anggota', 'y', '15160001', 'Syarif Hidayat', 'l', '081234214561', 9), (5, 'bambang', 'e10adc3949ba59abbe56e057f20f883e', 'anggota', 'y', '14150001', 'bambang', 'l', '085746127432', 19), (6, 'cahyati', 'e10adc3949ba59abbe56e057f20f883e', 'anggota', 'y', '15160004', 'Cahyati', 'p', '089712344123', 12), (7, 'haris', 'e10adc3949ba59abbe56e057f20f883e', 'anggota', 'y', '14150002', 'Harris Abimanyu', 'l', '081234214564', 17), (8, 'rahayu', 'e10adc3949ba59abbe56e057f20f883e', 'anggota', 'y', '15160006', 'Rahayu Agustine', 'p', '085746127437', 14), (9, 'irna', 'e10adc3949ba59abbe56e057f20f883e', 'anggota', 'y', '16170003', 'Irna Ratna Ayu', 'p', '085746127433', 6), (10, 'dewi', 'e10adc3949ba59abbe56e057f20f883e', 'anggota', 'y', '16170004', 'Dewi Lestari', 'p', '081234214569', 2), (11, 'jurniani', 'e10adc3949ba59abbe56e057f20f883e', 'anggota', 'y', '14150003', 'Jurniani', 'p', '089712344124', 18), (12, 'usman', 'e10adc3949ba59abbe56e057f20f883e', 'anggota', 'y', '14150007', 'Usman Fauzi', 'l', '089712344126', 21), (14, 'dahlia', 'e10adc3949ba59abbe56e057f20f883e', 'anggota', 'n', '15160005', 'Dahlia', 'p', '081234214564', 1); -- -- Indexes for dumped tables -- -- -- Indexes for table `buku` -- ALTER TABLE `buku` ADD PRIMARY KEY (`id_buku`), ADD KEY `id_judul` (`id_judul`); -- -- Indexes for table `denda` -- ALTER TABLE `denda` ADD PRIMARY KEY (`id_pinjam`); -- -- Indexes for table `judul` -- ALTER TABLE `judul` ADD PRIMARY KEY (`id_judul`); -- -- Indexes for table `kelas` -- ALTER TABLE `kelas` ADD PRIMARY KEY (`id_kelas`); -- -- Indexes for table `peminjaman` -- ALTER TABLE `peminjaman` ADD PRIMARY KEY (`id_pinjam`), ADD KEY `id_user` (`id_user`), ADD KEY `id_buku` (`id_buku`); -- -- Indexes for table `user` -- ALTER TABLE `user` ADD PRIMARY KEY (`id_user`), ADD UNIQUE KEY `username` (`username`), ADD UNIQUE KEY `no_induk` (`no_induk`), ADD KEY `id_kelas` (`id_kelas`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `buku` -- ALTER TABLE `buku` MODIFY `id_buku` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=17; -- -- AUTO_INCREMENT for table `denda` -- ALTER TABLE `denda` MODIFY `id_pinjam` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3; -- -- AUTO_INCREMENT for table `judul` -- ALTER TABLE `judul` MODIFY `id_judul` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11; -- -- AUTO_INCREMENT for table `kelas` -- ALTER TABLE `kelas` MODIFY `id_kelas` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=23; -- -- AUTO_INCREMENT for table `peminjaman` -- ALTER TABLE `peminjaman` MODIFY `id_pinjam` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=23; -- -- AUTO_INCREMENT for table `user` -- ALTER TABLE `user` MODIFY `id_user` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=15; -- -- Constraints for dumped tables -- -- -- Constraints for table `buku` -- ALTER TABLE `buku` ADD CONSTRAINT `buku_ibfk_1` FOREIGN KEY (`id_judul`) REFERENCES `judul` (`id_judul`) ON DELETE CASCADE ON UPDATE CASCADE; -- -- Constraints for table `denda` -- ALTER TABLE `denda` ADD CONSTRAINT `denda_ibfk_1` FOREIGN KEY (`id_pinjam`) REFERENCES `peminjaman` (`id_pinjam`) ON DELETE CASCADE ON UPDATE CASCADE; -- -- Constraints for table `peminjaman` -- ALTER TABLE `peminjaman` ADD CONSTRAINT `peminjaman_ibfk_1` FOREIGN KEY (`id_buku`) REFERENCES `buku` (`id_buku`) ON DELETE CASCADE ON UPDATE CASCADE, ADD CONSTRAINT `peminjaman_ibfk_2` FOREIGN KEY (`id_user`) REFERENCES `user` (`id_user`) ON DELETE CASCADE ON UPDATE CASCADE; -- -- Constraints for table `user` -- ALTER TABLE `user` ADD CONSTRAINT `user_ibfk_1` FOREIGN KEY (`id_kelas`) REFERENCES `kelas` (`id_kelas`) ON DELETE CASCADE ON UPDATE CASCADE; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
-- phpMyAdmin SQL Dump -- version 4.9.5deb2 -- https://www.phpmyadmin.net/ -- -- Host: localhost:3307 -- Czas generowania: 24 Wrz 2020, 07:46 -- Wersja serwera: 8.0.21-0ubuntu0.20.04.4 -- Wersja PHP: 7.2.33-1+ubuntu20.04.1+deb.sury.org+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 */; -- -- Baza danych: `prywatne_gamex` -- -- -------------------------------------------------------- -- -- Struktura tabeli dla tabeli `accounts` -- CREATE TABLE `accounts` ( `id` int UNSIGNED NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -------------------------------------------------------- -- -- Struktura tabeli dla tabeli `blogs` -- CREATE TABLE `blogs` ( `id` int UNSIGNED NOT NULL, `title` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `filepath` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci, `opis` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `thumb` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `slug` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `category` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `seo_title` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, `seo_description` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, `user_id` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Zrzut danych tabeli `blogs` -- INSERT INTO `blogs` (`id`, `title`, `filepath`, `opis`, `thumb`, `slug`, `content`, `category`, `seo_title`, `seo_description`, `user_id`, `created_at`, `updated_at`) VALUES (12, 'Automat do wyrobu girlandy żyłkowej 2 kolorowej', '/photos/shares/automat-do-wyrobu-girlandy.jpg', 'Automat do wyrobu girlandy żyłkowej 2 kolorowej', 'Automat do wyrobu girlandy żyłkowej 2 kolorowej', 'automat-do-wyrobu-girlandy-zylkowej-2-kolorowej', 'Automat do wyrobu girlandy żyłkowej 2 kolorowej', '10', 'Automat do wyrobu girlandy żyłkowej 2 kolorowej', 'Automat do wyrobu girlandy żyłkowej 2 kolorowej', '1', '2019-05-27 06:01:45', '2019-06-21 21:57:40'), (13, 'Automat do cięcia i skręcania girlandy', '/photos/shares/test.jpg', 'Automat do cięcia i skręcania girlandy', 'Automat do cięcia i skręcania girlandy', 'automat-do-ciecia-i-skrecania-girlandy', 'Automat do cięcia i skręcania girlandy', '10', 'Automat do cięcia i skręcania girlandy', 'Automat do cięcia i skręcania girlandy', '1', '2019-05-27 06:02:18', '2019-06-20 19:16:14'), (14, 'Zszywarka gałązek', '/photos/shares/test.jpg', 'Zszywarka gałązek', 'Zszywarka gałązek', 'zszywarka-galazek', 'Zszywarka gałązek', '10', 'Zszywarka gałązek', 'Zszywarka gałązek', '1', '2019-05-27 06:02:38', '2019-06-20 19:16:18'), (15, 'Automat do cięcia i skręcania girlandy z wykroinikiem', '/photos/shares/test.jpg', 'Automat do cięcia i skręcania girlandy z wykroinikiem', 'Automat do cięcia i skręcania girlandy z wykroinikiem', 'automat-do-ciecia-i-skrecania-girlandy-z-wykroinikiem', 'Automat do cięcia i skręcania girlandy z wykroinikiem', '10', 'Automat do cięcia i skręcania girlandy z wykroinikiem', 'Automat do cięcia i skręcania girlandy z wykroinikiem', '1', '2019-05-27 06:02:50', '2019-06-20 19:16:22'), (16, 'Gałęziarka', '/photos/shares/test.jpg', 'Gałęziarka', 'Gałęziarka', 'galeziarka', 'Gałęziarka', '10', 'Gałęziarka', 'Gałęziarka', '1', '2019-05-27 06:03:13', '2019-06-20 19:16:26'), (17, 'Gałęziarka 2s', '/photos/shares/test.jpg', 'Gałęziarka 2s', 'Gałęziarka 2s', 'galeziarka-2s', 'Gałęziarka 2s', '10', 'Gałęziarka 2s', 'Gałęziarka 2s', '1', '2019-05-27 06:03:15', '2019-06-20 19:16:29'), (18, 'Maszyna do łańcucha', '/photos/shares/test.jpg', 'Maszyna do łańcucha', 'Maszyna do łańcucha', 'maszyna-do-lancucha', 'Maszyna do łańcucha', '10', 'Maszyna do łańcucha', 'Maszyna do łańcucha', '1', '2019-05-27 06:03:22', '2019-06-20 19:16:34'), (19, 'Maszyna do girlandy 2g', NULL, 'Maszyna do girlandy 2g', 'Maszyna do girlandy 2g', 'maszyna-do-girlandy-2g', 'Maszyna do girlandy 2g', '10', 'Maszyna do girlandy 2g', 'Maszyna do girlandy 2g', '1', '2019-05-27 06:03:31', '2019-05-27 06:03:31'), (20, 'Maszyna do girlandy żyłkowej', '/photos/shares/test.jpg', 'Maszyna do girlandy żyłkowej', 'Maszyna do girlandy żyłkowej', 'maszyna-do-girlandy-zylkowej', 'Maszyna do girlandy żyłkowej', '10', 'Maszyna do girlandy żyłkowej', 'Maszyna do girlandy żyłkowej', '1', '2019-05-27 06:03:56', '2019-06-20 19:16:37'), (21, 'Maszyna do śnieżenia choinek', NULL, 'Maszyna do śnieżenia choinek', 'Maszyna do śnieżenia choinek', 'maszyna-do-sniezenia-choinek', 'Maszyna do śnieżenia choinek', '10', 'Maszyna do śnieżenia choinek', 'Maszyna do śnieżenia choinek', '1', '2019-05-27 06:04:03', '2019-05-27 06:04:03'), (22, 'Maszyna do składania choinek', NULL, 'Maszyna do składania choinek', 'Maszyna do składania choinek', 'maszyna-do-skladania-choinek', 'Maszyna do składania choinek', '10', 'Maszyna do składania choinek', 'Maszyna do składania choinek', '1', '2019-05-27 06:04:09', '2019-05-27 06:04:09'), (23, 'Nacinarka folii w igle', NULL, 'Nacinarka folii w igle', 'Nacinarka folii w igle', 'nacinarka-folii-w-igle', 'Nacinarka folii w igle', '10', 'Nacinarka folii w igle', 'Nacinarka folii w igle', '1', '2019-05-27 06:04:17', '2019-05-27 06:04:17'), (24, 'Nacinarka folii w igle wałkiem', NULL, 'Nacinarka folii w igle wałkiem', 'Nacinarka folii w igle wałkiem', 'nacinarka-folii-w-igle-walkiem', 'Nacinarka folii w igle wałkiem', '10', 'Nacinarka folii w igle wałkiem', 'Nacinarka folii w igle wałkiem', '1', '2019-05-27 06:04:54', '2019-05-27 06:04:54'), (25, 'Obcinarka girlandy', NULL, 'Obcinarka girlandy', 'Obcinarka girlandy', 'obcinarka-girlandy', 'Obcinarka girlandy', '10', 'Obcinarka girlandy', 'Obcinarka girlandy', '1', '2019-05-27 06:05:02', '2019-05-27 06:05:02'), (26, 'Obcinarka żyłki', NULL, 'Obcinarka arka żyłki', 'Obcinarka żyłki', 'obcinarka-zylki', 'Obcinarka żyłki', '10', 'Obcinarka żyłki', 'Obcinarka żyłki', '1', '2019-05-27 06:05:21', '2019-05-27 06:05:21'), (27, 'Przecinarka wąski pasek', NULL, 'Przecinarka wąski pasek', 'Przecinarka wąski pasek', 'przecinarka-waski-pasek', 'Przecinarka wąski pasek', '10', 'Przecinarka wąski pasek', 'Przecinarka wąski pasek', '1', '2019-05-27 06:05:30', '2019-05-27 06:05:30'), (28, 'Przewijarka drutów', NULL, 'Przewijarka drutów', 'Przewijarka drutów', 'przewijarka-drutow', 'Przewijarka drutów', '10', 'Przewijarka drutów', 'Przewijarka drutów', '1', '2019-05-27 06:05:47', '2019-05-27 06:05:47'), (29, 'Skręcarka 2g', NULL, 'Skręcarka 2g', 'Skręcarka 2g', 'skrecarka-2g', 'Skręcarka 2g', '10', 'Skręcarka 2g', 'Skręcarka 2g', '1', '2019-05-27 06:05:58', '2019-05-27 06:05:58'), (30, 'Wałek tnący', NULL, 'Wałek tnący', 'Wałek tnący', 'walek-tnacy', 'Wałek tnący', '10', 'Wałek tnący', 'Wałek tnący', '1', '2019-05-27 06:06:05', '2019-05-27 06:06:05'); -- -------------------------------------------------------- -- -- Struktura tabeli dla tabeli `categories` -- CREATE TABLE `categories` ( `id` int UNSIGNED NOT NULL, `name` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `slug` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `description` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `seo_title` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, `seo_description` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, `thumb` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, `templates` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `text_green` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, `text_white` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Zrzut danych tabeli `categories` -- INSERT INTO `categories` (`id`, `name`, `slug`, `description`, `seo_title`, `seo_description`, `thumb`, `templates`, `text_green`, `text_white`, `created_at`, `updated_at`) VALUES (9, 'Girlandy', 'girlandy', 'In neque ante, luctus non dapibus et, aliquet sit amet lacus. Ut a turpis quam. Praesent rutrum elit mi, at feugiat purus facilisis at.', 'Girlandy', '21fdsfdsfds', NULL, 'kategoria', 'sdfsdf', 'sdf', '2019-05-26 15:50:11', '2019-08-13 19:09:12'), (10, 'Maszyny do produkcji', 'maszyny-do-produkcji', 'In neque ante, luctus non dapibus et, aliquet sit amet lacus. Ut a turpis quam. Praesent rutrum elit mi, at feugiat purus facilisis at.', NULL, NULL, NULL, 'kategoria', NULL, NULL, '2019-05-26 15:50:15', '2019-08-12 21:10:22'), (11, 'Podstawy pod wieńce', 'podstawy-pod-wience', 'In neque ante, luctus non dapibus et, aliquet sit amet lacus. Ut a turpis quam. Praesent rutrum elit mi, at feugiat purus facilisis at.', NULL, NULL, NULL, 'kategoria', 'nowy i lepsz', 'fsdfsdfsd', '2019-05-26 15:50:28', '2019-08-12 21:10:25'), (12, 'Folia, drut, żyłka', 'folia-drut-zylka', 'In neque ante, luctus non dapibus et, aliquet sit amet lacus. Ut a turpis quam. Praesent rutrum elit mi, at feugiat purus facilisis at.', NULL, NULL, NULL, 'kategoria', NULL, NULL, '2019-05-26 15:50:30', '2019-08-12 21:10:27'), (13, 'Uchwyty do choinek', 'uchwyty-do-choinek', 'In neque ante, luctus non dapibus et, aliquet sit amet lacus. Ut a turpis quam. Praesent rutrum elit mi, at feugiat purus facilisis at.', NULL, NULL, NULL, 'kategoria', NULL, NULL, '2019-05-26 15:50:34', '2019-08-12 21:10:30'); -- -------------------------------------------------------- -- -- Struktura tabeli dla tabeli `forms` -- CREATE TABLE `forms` ( `id` int UNSIGNED NOT NULL, `name` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, `title` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, `url` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, `order` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, `menu_id` int UNSIGNED NOT NULL, `parent` int UNSIGNED DEFAULT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Zrzut danych tabeli `forms` -- INSERT INTO `forms` (`id`, `name`, `title`, `url`, `order`, `menu_id`, `parent`, `created_at`, `updated_at`) VALUES (1, 'fbhghbfg', 'hgfhgfhgf', 'hfghfg', '3', 1, NULL, '2019-08-16 06:23:40', '2020-04-30 05:12:32'), (3, 'fsd', 'fsd', 'fds', '0', 1, 1, '2020-04-29 11:39:10', '2020-04-29 11:39:12'); -- -------------------------------------------------------- -- -- Struktura tabeli dla tabeli `hooks` -- CREATE TABLE `hooks` ( `id` int UNSIGNED NOT NULL, `name` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `value` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `module` int NOT NULL DEFAULT '0', `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -------------------------------------------------------- -- -- Struktura tabeli dla tabeli `media` -- CREATE TABLE `media` ( `id` int UNSIGNED NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -------------------------------------------------------- -- -- Struktura tabeli dla tabeli `menus` -- CREATE TABLE `menus` ( `id` int UNSIGNED NOT NULL, `name` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Zrzut danych tabeli `menus` -- INSERT INTO `menus` (`id`, `name`) VALUES (1, 'bdhfjfgbd'); -- -------------------------------------------------------- -- -- Struktura tabeli dla tabeli `menu_builders` -- CREATE TABLE `menu_builders` ( `id` int UNSIGNED NOT NULL, `menu_title` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `menu_desc` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Zrzut danych tabeli `menu_builders` -- INSERT INTO `menu_builders` (`id`, `menu_title`, `menu_desc`, `created_at`, `updated_at`) VALUES (1, 'Strona główna', 'menu od góry', '2019-05-17 19:47:06', '2019-05-17 19:47:06'); -- -------------------------------------------------------- -- -- Struktura tabeli dla tabeli `menu_items` -- CREATE TABLE `menu_items` ( `id` int UNSIGNED NOT NULL, `menu_id` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `page_name` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `parents_items` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, `page_number` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, `page_title` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `page_parent` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Zrzut danych tabeli `menu_items` -- INSERT INTO `menu_items` (`id`, `menu_id`, `page_name`, `parents_items`, `page_number`, `page_title`, `page_parent`, `created_at`, `updated_at`) VALUES (1, '1', 'Strona główna', '1', NULL, '/', NULL, '2019-05-17 19:47:06', '2019-05-25 19:48:04'), (2, '1', 'Oferta', '2', NULL, '/oferta', NULL, '2019-05-17 19:47:06', '2019-05-17 19:47:06'), (3, '1', 'Maszyny do produkcji', NULL, '1', '/maszyny-do-produkcji', '2', '2019-05-17 19:47:06', '2019-05-17 19:47:06'), (4, '1', 'Uchwyty do choinek', NULL, '2', '/uchwyty-do-choinek', '2', '2019-05-17 19:47:06', '2019-05-17 19:47:06'), (5, '1', 'Folia, drut, żyłka', NULL, '3', '/folia-drut-zylka', '2', '2019-05-17 19:47:06', '2019-05-17 19:47:06'), (6, '1', 'Girlandy', NULL, '4', '/girlandy', '2', '2019-05-17 19:47:06', '2019-05-17 19:47:06'), (7, '1', 'Podstawy pod wieńce', NULL, '5', '/podstawy-pod-wience', '2', '2019-05-17 19:47:06', '2019-05-17 19:47:06'), (8, '1', 'Kontakt', '3', NULL, '/kontakt', NULL, '2019-05-17 19:47:06', '2019-05-17 19:47:06'); -- -------------------------------------------------------- -- -- Struktura tabeli dla tabeli `migrations` -- CREATE TABLE `migrations` ( `id` int UNSIGNED NOT NULL, `migration` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `batch` int NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Zrzut danych tabeli `migrations` -- INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (1, '2014_10_12_000000_create_users_table', 1), (2, '2014_10_12_100000_create_password_resets_table', 1), (3, '2019_02_09_162410_create_pages_table', 1), (4, '2019_02_09_163055_create_menu_items_table', 1), (5, '2019_02_14_214323_create_blogs_table', 1), (6, '2019_02_14_214400_create_accounts_table', 1), (7, '2019_02_14_214414_create_settings_table', 1), (8, '2019_02_14_215629_create_media_table', 1), (9, '2019_03_10_135806_create_menu_builders_table', 1), (10, '2019_04_27_211027_create_roles_table', 1), (11, '2019_04_27_211143_create_role_user_table', 1), (12, '2019_05_17_215413_create_categories_table', 2), (13, '2018_11_12_150644_hooks', 3), (16, '2019_07_14_203505_create_sliders_table', 4), (17, '2019_07_14_203617_create_slider_items_table', 4), (18, '2019_06_25_050629_menu', 5), (19, '2019_06_25_064659_create_forms_table', 5); -- -------------------------------------------------------- -- -- Struktura tabeli dla tabeli `pages` -- CREATE TABLE `pages` ( `id` int UNSIGNED NOT NULL, `title` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `opis` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `slug` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `templates` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `category` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `seo_title` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, `seo_description` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, `parent_id` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, `user_id` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `thumb` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Zrzut danych tabeli `pages` -- INSERT INTO `pages` (`id`, `title`, `opis`, `slug`, `templates`, `content`, `category`, `seo_title`, `seo_description`, `parent_id`, `user_id`, `thumb`, `created_at`, `updated_at`) VALUES (1, 'home', 'strona startowa', 'home', 'homepage', 'Witam', 'brak', 'Gamex | Producent choinek i wieńcy', 'choinek itd.', NULL, '1', 'test', '2019-05-17 19:52:07', '2020-04-30 05:14:06'), (3, 'kontakt', 'kontakt', 'kontakt', 'kontakt', 'kontakt', 'kontakt', 'kontakt', 'kontakt', NULL, '1', 'kontakt', '2019-07-08 18:47:28', '2019-07-08 18:47:28'); -- -------------------------------------------------------- -- -- Struktura tabeli dla tabeli `password_resets` -- CREATE TABLE `password_resets` ( `email` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `token` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `created_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -------------------------------------------------------- -- -- Struktura tabeli dla tabeli `roles` -- CREATE TABLE `roles` ( `id` int UNSIGNED NOT NULL, `name` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `description` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Zrzut danych tabeli `roles` -- INSERT INTO `roles` (`id`, `name`, `description`, `created_at`, `updated_at`) VALUES (1, 'admin', 'Administrator', '2019-04-27 19:21:58', '2019-04-27 19:21:58'), (2, 'moderator', 'Właściciel strony', '2019-04-27 19:21:58', '2019-04-27 19:21:58'), (3, 'user', 'Zwykły użytkownik', '2019-04-27 19:21:58', '2019-04-27 19:21:58'); -- -------------------------------------------------------- -- -- Struktura tabeli dla tabeli `role_user` -- CREATE TABLE `role_user` ( `id` int UNSIGNED NOT NULL, `role_id` int UNSIGNED NOT NULL, `user_id` int UNSIGNED NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Zrzut danych tabeli `role_user` -- INSERT INTO `role_user` (`id`, `role_id`, `user_id`) VALUES (1, 1, 2), (2, 2, 3), (3, 3, 4), (4, 3, 6), (5, 1, 1); -- -------------------------------------------------------- -- -- Struktura tabeli dla tabeli `settings` -- CREATE TABLE `settings` ( `id` int UNSIGNED NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -------------------------------------------------------- -- -- Struktura tabeli dla tabeli `sliders` -- CREATE TABLE `sliders` ( `id` int UNSIGNED NOT NULL, `title` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `description` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Zrzut danych tabeli `sliders` -- INSERT INTO `sliders` (`id`, `title`, `description`, `created_at`, `updated_at`) VALUES (1, 'slider główny', 'to jest homepage', '2019-07-15 17:00:29', '2019-07-15 17:00:29'), (2, 'drugie menu', 'test', '2019-07-15 17:50:17', '2019-07-15 17:50:17'); -- -------------------------------------------------------- -- -- Struktura tabeli dla tabeli `slider_items` -- CREATE TABLE `slider_items` ( `id` int UNSIGNED NOT NULL, `title` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `description` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `more_info` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `link` varchar(60) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `display` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `button_text` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `id_slider` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `photo` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Zrzut danych tabeli `slider_items` -- INSERT INTO `slider_items` (`id`, `title`, `description`, `more_info`, `link`, `display`, `button_text`, `id_slider`, `photo`, `created_at`, `updated_at`) VALUES (1, 'djgh', 'h', 'fghj', 'fghj', 'fghj', 'fghj', '2', '/photos/shares/automat-do-wyrobu-girlandy.jpg', '2019-08-03 17:58:50', '2019-08-03 17:58:50'), (2, 'dfg', 'dfg', 'dfg', 'dfg', 'dfg', 'dfg', '2', '/photos/shares/test.jpg', '2019-08-03 17:59:25', '2019-08-03 17:59:25'), (3, 'fgh', 'fgh', 'fgh', 'fgh', 'fgh', 'fghh', '1', '/photos/shares/test.jpg', '2019-08-03 17:59:47', '2019-08-03 17:59:47'); -- -------------------------------------------------------- -- -- Struktura tabeli dla tabeli `users` -- CREATE TABLE `users` ( `id` int UNSIGNED NOT NULL, `name` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `email` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `email_verified_at` timestamp NULL DEFAULT NULL, `password` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `remember_token` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Zrzut danych tabeli `users` -- INSERT INTO `users` (`id`, `name`, `email`, `email_verified_at`, `password`, `remember_token`, `created_at`, `updated_at`) VALUES (1, 'test', 'test@o2.com', NULL, '$2y$10$yPOPd9R.7MZW4xCUCFmRQudlhFxuZDl5IRYz0Y/uUhAbu26Sne4V6', 'dMSgj1FeFqPAPLnAgHKMOSQS67madE5fNwJhOxW2S0dboIsUylAZQdpH8KSM', NULL, NULL), (2, 'test', 'test@o2.pl', NULL, '$2y$10$ulzFQBJlyO8lUW4OtRPU2.CMnrgO//9m6K757MyYV2yniu53D4urm', NULL, '2019-04-27 19:21:58', '2019-04-27 19:21:58'), (3, 'test1', 'test1@o2.pl', NULL, '$2y$10$fd5snqxYl1/K1RAq0hr0WOSCj7SFKqkQnXfLVT2qf.EWp/vxb9jLO', NULL, '2019-04-27 19:21:58', '2019-04-27 19:21:58'), (4, 'test2', 'test2@o2.pl', NULL, '$2y$10$1vFkaDbFVCbjmcmKc9rMhu0gO3GqJASqtf0hGie9YeqUp1SB2.vGe', NULL, '2019-04-27 19:21:58', '2019-04-27 19:21:58'), (5, 'test1234', 'test@1234.pl', NULL, '$2y$10$6qYwUbUfyDaQlaEOECBP0OzA7Du00YwD1oTTGg/G8QWnyi6nLpW66', NULL, '2019-04-27 19:22:43', '2019-04-27 19:22:43'), (6, 'test1234', 'test1@1234.pl', NULL, '$2y$10$ialgGwEC9bWFb6qBo./UvOWB6LaHK7hq28Uq/03T4LBwNWmFqiHc6', NULL, '2019-04-27 19:23:23', '2019-04-27 19:23:23'); -- -- Indeksy dla zrzutów tabel -- -- -- Indeksy dla tabeli `accounts` -- ALTER TABLE `accounts` ADD PRIMARY KEY (`id`); -- -- Indeksy dla tabeli `blogs` -- ALTER TABLE `blogs` ADD PRIMARY KEY (`id`); -- -- Indeksy dla tabeli `categories` -- ALTER TABLE `categories` ADD PRIMARY KEY (`id`); -- -- Indeksy dla tabeli `forms` -- ALTER TABLE `forms` ADD PRIMARY KEY (`id`), ADD KEY `forms_menu_id_foreign` (`menu_id`), ADD KEY `forms_parent_foreign` (`parent`); -- -- Indeksy dla tabeli `hooks` -- ALTER TABLE `hooks` ADD PRIMARY KEY (`id`); -- -- Indeksy dla tabeli `media` -- ALTER TABLE `media` ADD PRIMARY KEY (`id`); -- -- Indeksy dla tabeli `menus` -- ALTER TABLE `menus` ADD PRIMARY KEY (`id`); -- -- Indeksy dla tabeli `menu_builders` -- ALTER TABLE `menu_builders` ADD PRIMARY KEY (`id`); -- -- Indeksy dla tabeli `menu_items` -- ALTER TABLE `menu_items` ADD PRIMARY KEY (`id`); -- -- Indeksy dla tabeli `migrations` -- ALTER TABLE `migrations` ADD PRIMARY KEY (`id`); -- -- Indeksy dla tabeli `pages` -- ALTER TABLE `pages` ADD PRIMARY KEY (`id`); -- -- Indeksy dla tabeli `password_resets` -- ALTER TABLE `password_resets` ADD KEY `password_resets_email_index` (`email`); -- -- Indeksy dla tabeli `roles` -- ALTER TABLE `roles` ADD PRIMARY KEY (`id`); -- -- Indeksy dla tabeli `role_user` -- ALTER TABLE `role_user` ADD PRIMARY KEY (`id`); -- -- Indeksy dla tabeli `settings` -- ALTER TABLE `settings` ADD PRIMARY KEY (`id`); -- -- Indeksy dla tabeli `sliders` -- ALTER TABLE `sliders` ADD PRIMARY KEY (`id`); -- -- Indeksy dla tabeli `slider_items` -- ALTER TABLE `slider_items` ADD PRIMARY KEY (`id`); -- -- Indeksy dla tabeli `users` -- ALTER TABLE `users` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `users_email_unique` (`email`); -- -- AUTO_INCREMENT dla tabel zrzutów -- -- -- AUTO_INCREMENT dla tabeli `accounts` -- ALTER TABLE `accounts` MODIFY `id` int UNSIGNED NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT dla tabeli `blogs` -- ALTER TABLE `blogs` MODIFY `id` int UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=31; -- -- AUTO_INCREMENT dla tabeli `categories` -- ALTER TABLE `categories` MODIFY `id` int UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=14; -- -- AUTO_INCREMENT dla tabeli `forms` -- ALTER TABLE `forms` MODIFY `id` int UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; -- -- AUTO_INCREMENT dla tabeli `hooks` -- ALTER TABLE `hooks` MODIFY `id` int UNSIGNED NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT dla tabeli `media` -- ALTER TABLE `media` MODIFY `id` int UNSIGNED NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT dla tabeli `menus` -- ALTER TABLE `menus` MODIFY `id` int UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; -- -- AUTO_INCREMENT dla tabeli `menu_builders` -- ALTER TABLE `menu_builders` MODIFY `id` int UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; -- -- AUTO_INCREMENT dla tabeli `menu_items` -- ALTER TABLE `menu_items` MODIFY `id` int UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9; -- -- AUTO_INCREMENT dla tabeli `migrations` -- ALTER TABLE `migrations` MODIFY `id` int UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=20; -- -- AUTO_INCREMENT dla tabeli `pages` -- ALTER TABLE `pages` MODIFY `id` int UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; -- -- AUTO_INCREMENT dla tabeli `roles` -- ALTER TABLE `roles` MODIFY `id` int UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; -- -- AUTO_INCREMENT dla tabeli `role_user` -- ALTER TABLE `role_user` MODIFY `id` int UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6; -- -- AUTO_INCREMENT dla tabeli `settings` -- ALTER TABLE `settings` MODIFY `id` int UNSIGNED NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT dla tabeli `sliders` -- ALTER TABLE `sliders` MODIFY `id` int UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3; -- -- AUTO_INCREMENT dla tabeli `slider_items` -- ALTER TABLE `slider_items` MODIFY `id` int UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; -- -- AUTO_INCREMENT dla tabeli `users` -- ALTER TABLE `users` MODIFY `id` int UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7; -- -- Ograniczenia dla zrzutów tabel -- -- -- Ograniczenia dla tabeli `forms` -- ALTER TABLE `forms` ADD CONSTRAINT `forms_menu_id_foreign` FOREIGN KEY (`menu_id`) REFERENCES `menus` (`id`) ON DELETE CASCADE, ADD CONSTRAINT `forms_parent_foreign` FOREIGN KEY (`parent`) REFERENCES `forms` (`id`) ON DELETE CASCADE; COMMIT; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
-- グループ分け(GROUP BY) -- groupingでグループ分け SELECT grouping, COUNT(*) FROM items GROUP BY grouping ; -- cost_priceで分ける(NULLもグループとして分類される) SELECT cost_price, COUNT(*) FROM items GROUP BY cost_price ; -- WHEREと併せて使う -- 実行順序は FROM -> WHERE -> GROUP BY -> SELECT SELECT cost_price, COUNT(*) FROM items WHERE grouping = '衣服' GROUP BY cost_price ; -- SELECTには集約キー以外の列は書けない -- GROUP BYにはASで指定した名前は使えない SELECT cost_price AS "仕入れ値", COUNT(*) FROM items GROUP BY "仕入れ値" ;
UPDATE fdmail SET d_read=now() WHERE rcvr =? AND id = ? AND del_r<>1 AND d_snt IS NOT NULL
CREATE PROCEDURE spMissingPayments AS BEGIN SELECT first_name, last_name FROM customer JOIN rental ON (customer.customer_id = rental.customer_id) RIGHT JOIN payment ON (rental.rental_id = payment.rental_id) WHERE payment.payment_id IS null; END
SELECT TOP (100) PERCENT '___' AS LN, IMINVLOC_SQL.prod_cat AS Cat, IMITMIDX_SQL.stocked_fg AS Stcked, IMINVLOC_SQL.item_no, IMITMIDX_SQL.item_desc_1, IMITMIDX_SQL.item_desc_2, IMINVLOC_SQL.qty_on_ord AS QOO, CASE WHEN (iminvloc_sql.qty_on_hand > 0) THEN IMINVLOC_SQL.qty_on_hand WHEN (iminvloc_sql.qty_on_hand < 0) THEN '0' END AS QOH, '___' AS AQOH, IMINVLOC_SQL.frz_qty AS FQTY, IMINVLOC_SQL.qty_allocated AS QALL, IMITMIDX_SQL.item_note_4 AS [Est Safety Stock], ROUND(IMINVLOC_SQL.prior_year_usage / 12.5, 0) AS [P YR MNTH], ROUND(IMINVLOC_SQL.usage_ytd / 11, 0) AS CMNTH, CASE WHEN (iminvloc_sql.qty_on_hand > 0) THEN IMINVLOC_SQL.qty_on_hand - IMINVLOC_SQL.qty_allocated WHEN (iminvloc_sql.qty_on_hand < 0) THEN IMINVLOC_SQL.qty_allocated END AS [QOH-QOA], CASE WHEN ((NOT (IMITMIDX_SQL.item_note_4 IS NULL)) AND (iminvloc_sql.qty_on_hand < 0) AND ((ROUND(IMINVLOC_SQL.qty_on_ord - IMINVLOC_SQL.qty_allocated - IMITMIDX_SQL.item_note_4, 0)) < 0)) THEN 'NC' WHEN ((NOT (IMITMIDX_SQL.item_note_4 IS NULL)) AND (iminvloc_sql.qty_on_hand > 0) AND ((ROUND(IMINVLOC_SQL.qty_on_hand + IMINVLOC_SQL.qty_on_ord - IMINVLOC_SQL.qty_allocated - IMITMIDX_SQL.item_note_4, 0)) < 0)) THEN 'NC' WHEN ((IMITMIDX_SQL.item_note_4 IS NULL) AND (iminvloc_sql.qty_on_hand > 0) AND (ROUND(IMINVLOC_SQL.qty_on_hand + IMINVLOC_SQL.qty_on_ord - IMINVLOC_SQL.qty_allocated, 0) < 0)) THEN 'NC' WHEN ((IMITMIDX_SQL.item_note_4 IS NULL) AND (iminvloc_sql.qty_on_hand < 0) AND (ROUND(IMINVLOC_SQL.qty_on_ord - IMINVLOC_SQL.qty_allocated, 0) < 0)) THEN 'NC' ELSE '' END AS [CHECK], CASE WHEN (NOT (IMITMIDX_SQL.item_note_4 IS NULL)) AND (IMINVLOC_SQL.qty_on_hand > 0) THEN (ROUND(IMINVLOC_SQL.qty_on_hand + IMINVLOC_SQL.qty_on_ord - IMINVLOC_SQL.qty_allocated - IMITMIDX_SQL.item_note_4, 0)) WHEN (NOT (IMITMIDX_SQL.item_note_4 IS NULL)) AND (IMINVLOC_SQL.qty_on_hand < 0) THEN (ROUND(IMINVLOC_SQL.qty_on_ord - IMINVLOC_SQL.qty_allocated - IMITMIDX_SQL.item_note_4, 0)) WHEN (IMITMIDX_SQL.item_note_4 IS NULL) AND (IMINVLOC_SQL.qty_on_hand > 0) THEN (ROUND(IMINVLOC_SQL.qty_on_hand + IMINVLOC_SQL.qty_on_ord - IMINVLOC_SQL.qty_allocated, 0)) WHEN (IMITMIDX_SQL.item_note_4 IS NULL) AND (IMINVLOC_SQL.qty_on_hand < 0) THEN (ROUND(IMINVLOC_SQL.qty_on_ord - IMINVLOC_SQL.qty_allocated, 0)) END AS [QOH+QOO-QOA-SS], CASE WHEN (IMINVLOC_SQL.qty_on_hand > 0) THEN ROUND((IMINVLOC_SQL.qty_on_hand + IMINVLOC_SQL.qty_on_ord - IMINVLOC_SQL.qty_allocated) - IMINVLOC_SQL.usage_ytd / 11, 0) WHEN (IMINVLOC_SQL.qty_on_hand < 0) THEN ROUND((IMINVLOC_SQL.qty_on_ord - IMINVLOC_SQL.qty_allocated) - IMINVLOC_SQL.usage_ytd / 11, 0) END AS SS1MNTH, CASE WHEN (IMINVLOC_SQL.qty_on_hand > 0) THEN ROUND((IMINVLOC_SQL.qty_on_hand + IMINVLOC_SQL.qty_on_ord - IMINVLOC_SQL.qty_allocated) - IMINVLOC_SQL.usage_ytd / 11, 0) WHEN (IMINVLOC_SQL.qty_on_hand < 0) THEN ROUND(((IMINVLOC_SQL.qty_on_ord - IMINVLOC_SQL.qty_allocated) - ((IMINVLOC_SQL.usage_ytd / 11)*2)), 0) END AS SS2MNTH, IMINVLOC_SQL.usage_ytd AS CYU, '_____' AS [Order], '____' AS [PO Check], IMITMIDX_SQL.item_note_2 AS Supplier, IMITMIDX_SQL.item_note_3 AS [Critical Item], IMITMIDX_SQL.item_note_5 AS [Misc Note (N5)], IMITMIDX_SQL.p_and_ic_cd AS [Rec Loc], IMINVLOC_SQL.prior_year_usage AS PYU, IMINVLOC_SQL.usage_ytd, CAST(ROUND(IMINVLOC_SQL.last_cost, 2, 0) AS DECIMAL(8, 2)) AS LC, CAST(ROUND(IMINVLOC_SQL.std_cost, 2, 0) AS DECIMAL(8, 2)) AS SC FROM dbo.iminvloc_sql AS IMINVLOC_SQL INNER JOIN dbo.imitmidx_sql AS IMITMIDX_SQL ON IMINVLOC_SQL.item_no = IMITMIDX_SQL.item_no WHERE (NOT (IMITMIDX_SQL.item_note_4 IS NULL)) AND (iminvloc_sql.qty_on_hand < 0) AND ((ROUND(IMINVLOC_SQL.qty_on_ord - IMINVLOC_SQL.qty_allocated - IMITMIDX_SQL.item_note_4, 0)) < 0) AND (NOT (IMINVLOC_SQL.prod_cat = '036' OR IMINVLOC_SQL.prod_cat = '037' OR IMINVLOC_SQL.prod_cat = '336' OR IMINVLOC_SQL.prod_cat = 'AP')) AND (IMITMIDX_SQL.item_note_1 = 'ch' OR IMITMIDX_SQL.item_note_1 = 'Ch' OR IMITMIDX_SQL.item_note_1 = 'CH' OR IMITMIDX_SQL.item_note_1 = 'CHD') OR (NOT (IMITMIDX_SQL.item_note_4 IS NULL)) AND (iminvloc_sql.qty_on_hand > 0) AND ((ROUND(IMINVLOC_SQL.qty_on_hand + IMINVLOC_SQL.qty_on_ord - IMINVLOC_SQL.qty_allocated - IMITMIDX_SQL.item_note_4, 0)) < 0) AND (NOT (IMINVLOC_SQL.prod_cat = '036' OR IMINVLOC_SQL.prod_cat = '037' OR IMINVLOC_SQL.prod_cat = '336' OR IMINVLOC_SQL.prod_cat = 'AP')) AND (IMITMIDX_SQL.item_note_1 = 'ch' OR IMITMIDX_SQL.item_note_1 = 'Ch' OR IMITMIDX_SQL.item_note_1 = 'CH' OR IMITMIDX_SQL.item_note_1 = 'CHD') AND (IMINVLOC_SQL.prior_year_usage > 0) OR (IMITMIDX_SQL.item_note_4 IS NULL) AND (iminvloc_sql.qty_on_hand > 0) AND (ROUND(IMINVLOC_SQL.qty_on_hand + IMINVLOC_SQL.qty_on_ord - IMINVLOC_SQL.qty_allocated, 0) < 0) AND (NOT (IMINVLOC_SQL.prod_cat = '036' OR IMINVLOC_SQL.prod_cat = '037' OR IMINVLOC_SQL.prod_cat = '336' OR IMINVLOC_SQL.prod_cat = 'AP')) AND (IMITMIDX_SQL.item_note_1 = 'ch' OR IMITMIDX_SQL.item_note_1 = 'Ch' OR IMITMIDX_SQL.item_note_1 = 'CH' OR IMITMIDX_SQL.item_note_1 = 'CHD') AND (IMINVLOC_SQL.qty_on_ord > 0) OR (IMITMIDX_SQL.item_note_4 IS NULL) AND (iminvloc_sql.qty_on_hand < 0) AND (ROUND(IMINVLOC_SQL.qty_on_ord - IMINVLOC_SQL.qty_allocated, 0) < 0) AND (NOT (IMINVLOC_SQL.prod_cat = '036' OR IMINVLOC_SQL.prod_cat = '037' OR IMINVLOC_SQL.prod_cat = '336' OR IMINVLOC_SQL.prod_cat = 'AP')) AND (IMITMIDX_SQL.item_note_1 = 'ch' OR IMITMIDX_SQL.item_note_1 = 'Ch' OR IMITMIDX_SQL.item_note_1 = 'CH' OR IMITMIDX_SQL.item_note_1 = 'CHD') AND (IMINVLOC_SQL.qty_allocated > 0) ORDER BY [CHECK] DESC
CREATE TABLE `voucher` ( `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, `code` VARCHAR(64) NOT NULL, `discount` FLOAT UNSIGNED NOT NULL, `start` TIMESTAMP NOT NULL DEFAULT '', `end` TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`id`), INDEX `code` (`code`) ) COLLATE='latin1_swedish_ci' ENGINE=InnoDB AUTO_INCREMENT=1535 ; select v1.id, v1.code, v1.`start`, v1.`end`, v2.id, v2.`start`, v2.`end` from voucher as v1 join voucher as v2 on v1.code = v2.code where v2.id > v1.id and v2.`start`<= v1.`end` AND v2.`end` >= v1.`start` LIMIT 10;
Create procedure sp_listinvoiceSR (@fromdate datetime, @todate datetime, @CUSTOMER nvarchar(15) = '%', @SalesMan nVarchar(500) = N'', @Beat nVarchar(500) = N'', @Channel Int = 0, @SubChannel Int =0) As Begin Create Table #tblSalesman(SalesManID Int) Create Table #tblBeat(BeatID Int) Create Table #tblChannel(ChannelID Int) Create Table #tblSubChannel(SubChannelID Int) If @SalesMan = N'' Insert InTo #tblSalesman Select SalesmanID From SalesMan Where Active = 1 Else Insert InTo #tblSalesman Select * From sp_SplitIn2Rows(@SalesMan,N',') If @Beat = N'' Insert InTo #tblBeat Select BeatID From Beat Where Active = 1 Else Insert InTo #tblBeat Select * From sp_SplitIn2Rows(@Beat,N',') If @Channel = 0 Begin Insert Into #tblChannel Values(0) Insert Into #tblChannel Select ChannelType From Customer_Channel Where Active = 1 End Else Insert Into #tblChannel Values(@Channel) If @SubChannel = 0 Begin Insert Into #tblSubChannel Values(0) Insert Into #tblSubChannel Select SubChannelID From SubChannel Where Active =1 End Else Insert Into #tblSubChannel Values(@SubChannel) select Customer.CustomerID, Customer.Company_Name, InvoiceID, InvoiceDate, NetValue, InvoiceType, DocumentID,DocReference,DocSerialType, "CatGrp" = Case When IsNull(InvoiceAbstract.GroupID,'0') = '0' --Then 'All Category' Else ProductCategoryGroupAbstract.GroupName End Then 'All Category' Else dbo.mERP_fn_Get_GroupNames(GroupID) End,isnull(GSTFullDocID, '') as GSTFullDocID from InvoiceAbstract, Customer --, ProductCategoryGroupAbstract where invoicedate between @fromdate and @todate and invoicetype <> 4 and invoicetype <> 2 and InvoiceAbstract.CustomerID like @CUSTOMER and Status & 128 = 0 And InvoiceAbstract.CustomerID = Customer.CustomerID --And InvoiceAbstract.GroupID *= ProductCategoryGroupAbstract.GroupID And Isnull(InvoiceAbstract.BeatID,0) In (Select BeatId From #tblBeat) And Isnull(InvoiceAbstract.SalesmanID,0) In (Select SalesmanID From #tblSalesman) And IsNull(Customer.ChannelType,0) In (Select ChannelID From #tblChannel) And IsNull(Customer.SubChannelID,0) In (Select SubChannelID From #tblSubChannel) order by Customer.Company_Name, InvoiceID Desc Drop Table #tblSalesman Drop Table #tblBeat Drop Table #tblChannel Drop Table #tblSubChannel End
DROP TABLE Greeting IF EXISTS; CREATE TABLE Greeting( id NUMERIC GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1) NOT NULL, text VARCHAR(50) NOT NULL, PRIMARY KEY (id) );
/*FINDINGS: THERE ARE A LOT OF CUSTOMERS IN HERE WITH DAMAGES AND WRONG ITEMS, WHAT I FORGOT IS THAT IN MY FINAL QUERY A LOT OF CUSTOMERS ARE FILTERED OUT BECAUSE WE ARE LOOKING FOR PEOPLE WITH ONLY A DAMAGE DEFECT*/ /*Metric - Average time to next order objective what are defects, and than what defects matter the most.*/ /*select customer_id, count(*) from (*/ SELECT AOV_GROUP, quarter as quarter, COUNT(DISTINCT(customer_id)) AS customer_cnt, sum(Q1Orders)/(COUNT(DISTINCT(customer_id))/*-sum(churn_cnt)*/) as avgQ1Orders, sum(Q2Orders)/(COUNT(DISTINCT(customer_id))/*-sum(churn_cnt)*/) as avgQ2Orders, sum(Q3Orders)/(COUNT(DISTINCT(customer_id))/*-sum(churn_cnt)*/) as avgQ3Orders, sum(Q4Orders)/(COUNT(DISTINCT(customer_id))/*-sum(churn_cnt)*/) as avgQ4Orders, sum(Q1Retail)/(COUNT(DISTINCT(customer_id))/*-sum(churn_cnt)*/) as avgQ1Retail, sum(Q2Retail)/(COUNT(DISTINCT(customer_id))/*-sum(churn_cnt)*/) as avgQ2Retail, sum(Q3Retail)/(COUNT(DISTINCT(customer_id))/*-sum(churn_cnt)*/) as avgQ3Retail, sum(Q4Retail)/(COUNT(DISTINCT(customer_id))/*-sum(churn_cnt)*/) as avgQ4Retail, sum(Total_Orders_Affected)/(COUNT(DISTINCT(customer_id))/*-sum(churn_cnt)*/) as avgTotalAffectedOrders, SUM(churn_cnt) as churn_cnt, avg(churn_cnt) as stdev_churn, (avg(churn_cnt)/COUNT(DISTINCT(customer_id)))^(1/2) as standard_error_churn, avg(Per_Diff_Q1vFuture) as avgPer_Diff_Q1vFuture, STDDEV(Per_Diff_Q1vFuture) as standard_deviation, STDDEV(Per_Diff_Q1vFuture)/(COUNT(DISTINCT(customer_id)))^(1/2) as standard_error_order_per_customer FROM /*Q0 STARTS HERE*/ ( /*SUBSTITUTE NULLS FOR SOME REASON I CAN ONLY ACCOMPLISH THIS WITH A SUBQUERY*/ SELECT year, quarter, customer_id, customer_segment, ISNull(Q1Orders,0) Q1Orders, ISNull(Q2Orders,0) Q2Orders, ISNull(Q3Orders,0) Q3Orders, ISNull(Q4Orders,0) Q4Orders, ISNull(Q1Retail,0) Q1Retail, ISNull(Q2Retail,0) Q2Retail, ISNull(Q3Retail,0) Q3Retail, ISNull(Q4Retail,0) Q4Retail, ISNULL(Total_Orders_Affected,0) Total_Orders_Affected, ISNULL(Total_Retail_Affected,0) Total_Retail_Affected, Churn_Cnt, CASE WHEN Q1Retail = 0 THEN NULL ELSE ((ISNull(Q2Retail,0) + ISNull(Q3Retail,0) + ISNull(Q4Retail,0))/ISNull(Q1Retail,0))-1 END as Retail_Per_Diff_Q1vFuture, ((ISNull(Q2Orders,0) + ISNull(Q3Orders,0) + ISNull(Q4Orders,0))/ISNull(Q1Orders,0))-1 as Per_Diff_Q1vFuture, case when Q1Retail <50 then 'Under 50' when Q1Retail between 50 and 100 then '50-100' when Q1Retail between 100 and 200 then '100-200' when Q1Retail >200 then '200+' END as AOV_GROUP FROM /*Q STARTS HERE*/ ( SELECT --Count(distinct(o.Customer_id)) as CustomerCnt, YEAR, quarter, o.customer_id, o.customer_segment, /* days_until_next_order, Total_defects,*/ /*remember you might have multiple order b/c we are filtering for single defects not orders*/ cast(sbsq1.order_cnt as numeric) as Q1Orders, cast(sbsq2.order_cnt as numeric) as Q2Orders, cast(sbsq3.order_cnt as numeric) as Q3Orders, cast(sbsq4.order_cnt as numeric) as Q4Orders, cast(sbsq1.retail as numeric) as Q1Retail, cast(sbsq2.retail as numeric) as Q2Retail, cast(sbsq3.retail as numeric) as Q3Retail, cast(sbsq4.retail as numeric) as Q4Retail, NULLIF((COALESCE(sbsq2.order_cnt,0) + COALESCE(sbsq3.order_cnt,0) + COALESCE(sbsq4.order_cnt,0)),0) as Total_Orders_Affected, NULLIF((COALESCE(sbsq2.Retail,0) + COALESCE(sbsq3.Retail,0) + COALESCE(sbsq4.Retail,0)),0) as Total_Retail_Affected, MAX(DECODE(NULLIF((COALESCE(sbsq2.order_cnt,0) + COALESCE(sbsq3.order_cnt,0) + COALESCE(sbsq4.order_cnt,0)),0), NULL , 1, 0)) AS "Churn_Cnt" --avg(days_until_next_order) as days_until_next_order, /*MEDIAN(days_until_next_order) OVER() AS median_days_until_next_order*/ FROM bitmp.tmamiya_order_defect_order_aggregate o /*JOINS START HERE*/ /*This portion limits the population to customers with total experience by quarter, reminder, this table has quarters be sure to filter for it otherwise you will have duplicates*/ LEFT JOIN ( SELECT /*FILTER OUT FOR TOTAL DEFECT NUMBER THIS LIMITS THE CUSTOMERS THAT HAD MULTIPLE DEFECTS TO ISOLATE CUSTOMERS THAT ONLY RECEIVED THAT ONE DEFECT*/ customer_id FROM (/*CONSOLIDATE QUARTER INFORMATION*/ SELECT customer_id, SUM(total_defects) AS defect_cnt FROM bitmp.tmamiya_order_defect_customer_aggregate WHERE quarter BETWEEN ${Quarter_start}$ AND ${Quarter_end}$ AND YEAR = 2014 GROUP BY 1 )q WHERE defect_cnt ${= or >}$ ${Total_Defect_Cnt}$ GROUP BY 1 ) c ON o.customer_id=c.customer_id /*ADD 1ST QUARTER ORDER CNT*/ left join (select custaccount, sum(retail) as retail,isnull(count(distinct(salesid)),0) as order_cnt from ANALYTICS.Salesline_based_shipping where datetime_order between '2014-01-01' and '2014-04-01' /*and custaccount = '114441'*/ group by 1) sbsq1 on o.customer_id = sbsq1.custaccount /*ADD 2ND AND 3RD QUARTER ORDER CNT*/ left join (select custaccount, sum(retail) as retail,isnull(count(distinct(salesid)),0) as order_cnt from ANALYTICS.Salesline_based_shipping where datetime_order between '2014-04-01' and '2014-07-01' group by 1) sbsq2 on o.customer_id = sbsq2.custaccount left join (select custaccount, sum(retail) as retail,isnull(count(distinct(salesid)),0) as order_cnt from ANALYTICS.Salesline_based_shipping where datetime_order between '2014-07-01' and '2014-10-01' group by 1) sbsq3 on o.customer_id = sbsq3.custaccount left join (select custaccount, sum(retail) as retail,isnull(count(distinct(salesid)),0) as order_cnt from ANALYTICS.Salesline_based_shipping where datetime_order between '2014-10-01' and '2015-01-01' group by 1) sbsq4 on o.customer_id = sbsq4.custaccount /*PRIMARY QUERY CONTINUES*/ WHERE YEAR = 2014 AND quarter BETWEEN ${Quarter_start}$ AND ${Quarter_end}$ AND cast(sbsq1.order_cnt as numeric) = 1 --and order_date between '2014-01-01' and '2014-03-01' -- AND Late = 1 --and Early = 0 -- and Early_Defect = 1 --and On_time = 0 and Defect_damage = 1 -- and Defect_wrong_item = 1 -- and Defect_transit = 1 -- and Total_defects = 1 -- and Cancellation = 1 --and CSA_issued_damage = 0 --and CSA_issued_shipping = 0 --and CSA_issued_other = 0 -- AND Total_CSA_Issued = ${CSA_ISSUED}$ GROUP BY 1,2,3,4,5,6,7,8,9,10,11,12,13 )q --WHERE Q1Retail = 0 )q0 GROUP BY 1,2 --where churn_cnt = 0 --where Total_defects > 1 /*GROUP BY 5*/ /*Q )duplicatecheck group by 1 having count(*) > 1*/
SELECT students.name AS student, ROUND(AVG(assignment_submissions.duration), 2) AS average_assignment_duration, ROUND(AVG(assignments.duration), 2) AS average_estimated_duration FROM assignment_submissions JOIN assignments ON assignments.id = assignment_id JOIN students ON students.id = student_id WHERE students.end_date IS NULL GROUP BY students.name HAVING AVG(assignment_submissions.duration) < AVG(assignments.duration) ORDER BY AVG(assignment_submissions.duration);
DROP TABLE IF EXISTS adoptions; DROP TABLE IF EXISTS animals; DROP TABLE IF EXISTS customers; CREATE TABLE customers ( id SERIAL8 primary key, name VARCHAR(255), address VARCHAR(255), phone_number VARCHAR(255) ); CREATE TABLE animals ( id SERIAL8 primary key, name VARCHAR(255) not null, type VARCHAR(255), breed VARCHAR(255), admission_date DATE, adoptable BOOLEAN, image VARCHAR(255), incare BOOLEAN ); CREATE TABLE adoptions ( id SERIAL8 primary key, animal_id INT8 references animals(id) ON DELETE CASCADE, customer_id INT8 references customers(id) ON DELETE CASCADE );
/* Navicat Premium Data Transfer Source Server : mySQL Source Server Type : MySQL Source Server Version : 80017 Source Host : localhost:3306 Source Schema : mypetstore Target Server Type : MySQL Target Server Version : 80017 File Encoding : 65001 Date: 27/10/2019 18:40:52 */ SET NAMES utf8mb4; SET FOREIGN_KEY_CHECKS = 0; -- ---------------------------- -- Table structure for account -- ---------------------------- DROP TABLE IF EXISTS `account`; CREATE TABLE `account` ( `userid` varchar(80) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `email` varchar(80) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `firstname` varchar(80) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `lastname` varchar(80) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `status` varchar(2) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `addr1` varchar(80) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `addr2` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `city` varchar(80) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `state` varchar(80) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `zip` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `country` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `phone` varchar(80) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, PRIMARY KEY (`userid`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of account -- ---------------------------- INSERT INTO `account` VALUES ('a', 'a', 'a', 'a', NULL, 'a', 'a', 'aa', 'a', 'a', 'a', 'a'); INSERT INTO `account` VALUES ('ACID', 'acid@yourdomain.com', 'ABC', 'XYX', 'OK', '901 San Antonio Road', 'MS UCUP02-206', 'Palo Alto', 'CA', '94303', 'USA', '555-555-5555'); INSERT INTO `account` VALUES ('j2ee', 'j2ee@yourdomain.com', 'John', 'Smith', 'CB', '902 San Antonio Road', 'MS UCUP03-306', 'John', 'CB', '94415', 'USA', '322-513-1654'); -- ---------------------------- -- Table structure for bannerdata -- ---------------------------- DROP TABLE IF EXISTS `bannerdata`; CREATE TABLE `bannerdata` ( `favcategory` varchar(80) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `bannername` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, PRIMARY KEY (`favcategory`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of bannerdata -- ---------------------------- INSERT INTO `bannerdata` VALUES ('BIRDS', '<image src=\"../images/banner_birds.gif\">'); INSERT INTO `bannerdata` VALUES ('CATS', '<image src=\"../images/banner_cats.gif\">'); INSERT INTO `bannerdata` VALUES ('DOGS', '<image src=\"../images/banner_dogs.gif\">'); INSERT INTO `bannerdata` VALUES ('FISH', '<image src=\"../images/banner_fish.gif\">'); INSERT INTO `bannerdata` VALUES ('REPTILES', '<image src=\"../images/banner_reptiles.gif\">'); -- ---------------------------- -- Table structure for cart -- ---------------------------- DROP TABLE IF EXISTS `cart`; CREATE TABLE `cart` ( `cartid` int(10) NOT NULL AUTO_INCREMENT, `username` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, PRIMARY KEY (`cartid`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 999 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of cart -- ---------------------------- INSERT INTO `cart` VALUES (999, 'j2ee'); -- ---------------------------- -- Table structure for cartitem -- ---------------------------- DROP TABLE IF EXISTS `cartitem`; CREATE TABLE `cartitem` ( `cartid` int(10) NOT NULL, `itemid` varchar(10) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, `quantity` int(10) NOT NULL, PRIMARY KEY (`cartid`, `itemid`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of cartitem -- ---------------------------- INSERT INTO `cartitem` VALUES (1, 'EST-11', 2); INSERT INTO `cartitem` VALUES (1, 'EST-19', 2); INSERT INTO `cartitem` VALUES (1, 'EST-9', 2); -- ---------------------------- -- Table structure for category -- ---------------------------- DROP TABLE IF EXISTS `category`; CREATE TABLE `category` ( `catid` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `name` varchar(80) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `descn` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, PRIMARY KEY (`catid`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of category -- ---------------------------- INSERT INTO `category` VALUES ('BIRDS', 'Birds', '<image src=\"images/birds_icon.gif\"><font size=\"5\" color=\"blue\"> Birds</font>'); INSERT INTO `category` VALUES ('CATS', 'Cats', '<image src=\"images/cats_icon.gif\"><font size=\"5\" color=\"blue\"> Cats</font>'); INSERT INTO `category` VALUES ('DOGS', 'Dogs', '<image src=\"images/dogs_icon.gif\"><font size=\"5\" color=\"blue\"> Dogs</font>'); INSERT INTO `category` VALUES ('FISH', 'Fish', '<image src=\"images/fish_icon.gif\"><font size=\"5\" color=\"blue\"> Fish</font>'); INSERT INTO `category` VALUES ('REPTILES', 'Reptiles', '<image src=\"images/reptiles_icon.gif\"><font size=\"5\" color=\"blue\"> Reptiles</font>'); -- ---------------------------- -- Table structure for inventory -- ---------------------------- DROP TABLE IF EXISTS `inventory`; CREATE TABLE `inventory` ( `itemid` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `qty` int(11) NOT NULL, PRIMARY KEY (`itemid`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of inventory -- ---------------------------- INSERT INTO `inventory` VALUES ('EST-1', 10000); INSERT INTO `inventory` VALUES ('EST-10', 10000); INSERT INTO `inventory` VALUES ('EST-11', 10000); INSERT INTO `inventory` VALUES ('EST-12', 9999); INSERT INTO `inventory` VALUES ('EST-13', 10000); INSERT INTO `inventory` VALUES ('EST-14', 10000); INSERT INTO `inventory` VALUES ('EST-15', 10000); INSERT INTO `inventory` VALUES ('EST-16', 10000); INSERT INTO `inventory` VALUES ('EST-17', 10000); INSERT INTO `inventory` VALUES ('EST-18', 10000); INSERT INTO `inventory` VALUES ('EST-19', 9999); INSERT INTO `inventory` VALUES ('EST-2', 10000); INSERT INTO `inventory` VALUES ('EST-20', 9999); INSERT INTO `inventory` VALUES ('EST-21', 10000); INSERT INTO `inventory` VALUES ('EST-22', 10000); INSERT INTO `inventory` VALUES ('EST-23', 10000); INSERT INTO `inventory` VALUES ('EST-24', 10000); INSERT INTO `inventory` VALUES ('EST-25', 10000); INSERT INTO `inventory` VALUES ('EST-26', 10000); INSERT INTO `inventory` VALUES ('EST-27', 10000); INSERT INTO `inventory` VALUES ('EST-28', 10000); INSERT INTO `inventory` VALUES ('EST-3', 10000); INSERT INTO `inventory` VALUES ('EST-4', 10000); INSERT INTO `inventory` VALUES ('EST-5', 10000); INSERT INTO `inventory` VALUES ('EST-6', 10000); INSERT INTO `inventory` VALUES ('EST-7', 10000); INSERT INTO `inventory` VALUES ('EST-8', 10000); INSERT INTO `inventory` VALUES ('EST-9', 10000); -- ---------------------------- -- Table structure for item -- ---------------------------- DROP TABLE IF EXISTS `item`; CREATE TABLE `item` ( `itemid` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `productid` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `listprice` decimal(10, 2) NULL DEFAULT NULL, `unitcost` decimal(10, 2) NULL DEFAULT NULL, `supplier` int(11) NULL DEFAULT NULL, `status` varchar(2) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `attr1` varchar(80) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `attr2` varchar(80) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `attr3` varchar(80) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `attr4` varchar(80) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `attr5` varchar(80) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, PRIMARY KEY (`itemid`) USING BTREE, INDEX `fk_item_2`(`supplier`) USING BTREE, INDEX `itemProd`(`productid`) USING BTREE, CONSTRAINT `fk_item_1` FOREIGN KEY (`productid`) REFERENCES `product` (`productid`) ON DELETE RESTRICT ON UPDATE RESTRICT, CONSTRAINT `fk_item_2` FOREIGN KEY (`supplier`) REFERENCES `supplier` (`suppid`) ON DELETE RESTRICT ON UPDATE RESTRICT ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of item -- ---------------------------- INSERT INTO `item` VALUES ('EST-1', 'FI-SW-01', 16.50, 10.00, 1, 'P', 'Large', NULL, NULL, NULL, NULL); INSERT INTO `item` VALUES ('EST-10', 'K9-DL-01', 18.50, 12.00, 1, 'P', 'Spotted Adult Female', NULL, NULL, NULL, NULL); INSERT INTO `item` VALUES ('EST-11', 'RP-SN-01', 18.50, 12.00, 1, 'P', 'Venomless', NULL, NULL, NULL, NULL); INSERT INTO `item` VALUES ('EST-12', 'RP-SN-01', 18.50, 12.00, 1, 'P', 'Rattleless', NULL, NULL, NULL, NULL); INSERT INTO `item` VALUES ('EST-13', 'RP-LI-02', 18.50, 12.00, 1, 'P', 'Green Adult', NULL, NULL, NULL, NULL); INSERT INTO `item` VALUES ('EST-14', 'FL-DSH-01', 58.50, 12.00, 1, 'P', 'Tailless', NULL, NULL, NULL, NULL); INSERT INTO `item` VALUES ('EST-15', 'FL-DSH-01', 23.50, 12.00, 1, 'P', 'With tail', NULL, NULL, NULL, NULL); INSERT INTO `item` VALUES ('EST-16', 'FL-DLH-02', 93.50, 12.00, 1, 'P', 'Adult Female', NULL, NULL, NULL, NULL); INSERT INTO `item` VALUES ('EST-17', 'FL-DLH-02', 93.50, 12.00, 1, 'P', 'Adult Male', NULL, NULL, NULL, NULL); INSERT INTO `item` VALUES ('EST-18', 'AV-CB-01', 193.50, 92.00, 1, 'P', 'Adult Male', NULL, NULL, NULL, NULL); INSERT INTO `item` VALUES ('EST-19', 'AV-SB-02', 15.50, 2.00, 1, 'P', 'Adult Male', NULL, NULL, NULL, NULL); INSERT INTO `item` VALUES ('EST-2', 'FI-SW-01', 16.50, 10.00, 1, 'P', 'Small', NULL, NULL, NULL, NULL); INSERT INTO `item` VALUES ('EST-20', 'FI-FW-02', 5.50, 2.00, 1, 'P', 'Adult Male', NULL, NULL, NULL, NULL); INSERT INTO `item` VALUES ('EST-21', 'FI-FW-02', 5.29, 1.00, 1, 'P', 'Adult Female', NULL, NULL, NULL, NULL); INSERT INTO `item` VALUES ('EST-22', 'K9-RT-02', 135.50, 100.00, 1, 'P', 'Adult Male', NULL, NULL, NULL, NULL); INSERT INTO `item` VALUES ('EST-23', 'K9-RT-02', 145.49, 100.00, 1, 'P', 'Adult Female', NULL, NULL, NULL, NULL); INSERT INTO `item` VALUES ('EST-24', 'K9-RT-02', 255.50, 92.00, 1, 'P', 'Adult Male', NULL, NULL, NULL, NULL); INSERT INTO `item` VALUES ('EST-25', 'K9-RT-02', 325.29, 90.00, 1, 'P', 'Adult Female', NULL, NULL, NULL, NULL); INSERT INTO `item` VALUES ('EST-26', 'K9-CW-01', 125.50, 92.00, 1, 'P', 'Adult Male', NULL, NULL, NULL, NULL); INSERT INTO `item` VALUES ('EST-27', 'K9-CW-01', 155.29, 90.00, 1, 'P', 'Adult Female', NULL, NULL, NULL, NULL); INSERT INTO `item` VALUES ('EST-28', 'K9-RT-01', 155.29, 90.00, 1, 'P', 'Adult Female', NULL, NULL, NULL, NULL); INSERT INTO `item` VALUES ('EST-3', 'FI-SW-02', 18.50, 12.00, 1, 'P', 'Toothless', NULL, NULL, NULL, NULL); INSERT INTO `item` VALUES ('EST-4', 'FI-FW-01', 18.50, 12.00, 1, 'P', 'Spotted', NULL, NULL, NULL, NULL); INSERT INTO `item` VALUES ('EST-5', 'FI-FW-01', 18.50, 12.00, 1, 'P', 'Spotless', NULL, NULL, NULL, NULL); INSERT INTO `item` VALUES ('EST-6', 'K9-BD-01', 18.50, 12.00, 1, 'P', 'Male Adult', NULL, NULL, NULL, NULL); INSERT INTO `item` VALUES ('EST-7', 'K9-BD-01', 18.50, 12.00, 1, 'P', 'Female Puppy', NULL, NULL, NULL, NULL); INSERT INTO `item` VALUES ('EST-8', 'K9-PO-02', 18.50, 12.00, 1, 'P', 'Male Puppy', NULL, NULL, NULL, NULL); INSERT INTO `item` VALUES ('EST-9', 'K9-DL-01', 18.50, 12.00, 1, 'P', 'Spotless Male Puppy', NULL, NULL, NULL, NULL); -- ---------------------------- -- Table structure for lineitem -- ---------------------------- DROP TABLE IF EXISTS `lineitem`; CREATE TABLE `lineitem` ( `orderid` int(11) NOT NULL, `linenum` int(11) NOT NULL, `itemid` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `quantity` int(11) NOT NULL, `unitprice` decimal(10, 2) NOT NULL, PRIMARY KEY (`orderid`, `linenum`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of lineitem -- ---------------------------- INSERT INTO `lineitem` VALUES (999, 997, 'EST-11', 2, 18.50); INSERT INTO `lineitem` VALUES (999, 998, 'EST-19', 1, 15.50); INSERT INTO `lineitem` VALUES (999, 999, 'EST-9', 2, 18.50); INSERT INTO `lineitem` VALUES (1000, 1000, 'EST-12', 1, 18.50); INSERT INTO `lineitem` VALUES (1001, 1001, 'EST-19', 1, 15.50); INSERT INTO `lineitem` VALUES (1002, 1002, 'EST-25', 1, 325.29); INSERT INTO `lineitem` VALUES (1003, 1003, 'EST-12', 1, 18.50); INSERT INTO `lineitem` VALUES (1003, 1004, 'EST-19', 1, 15.50); INSERT INTO `lineitem` VALUES (1003, 1005, 'EST-20', 1, 5.50); -- ---------------------------- -- Table structure for log -- ---------------------------- DROP TABLE IF EXISTS `log`; CREATE TABLE `log` ( `logid` int(10) NOT NULL AUTO_INCREMENT, `username` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `logdate` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `logtype` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `objectid` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, PRIMARY KEY (`logid`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of log -- ---------------------------- INSERT INTO `log` VALUES (13, 'j2ee', '2019-10-27 16:00:26', 'View Product', 'AV-SB-02'); INSERT INTO `log` VALUES (14, 'j2ee', '2019-10-27 16:00:29', 'Add Item', 'EST-19'); INSERT INTO `log` VALUES (15, 'j2ee', '2019-10-27 16:00:46', 'Pay Order', '1000'); INSERT INTO `log` VALUES (16, 'j2ee', '2019-10-27 16:14:42', 'View Item', 'EST-19'); INSERT INTO `log` VALUES (17, 'j2ee', '2019-10-27 16:14:52', 'Add Item', 'EST-19'); INSERT INTO `log` VALUES (18, 'j2ee', '2019-10-27 16:15:12', 'Pay Order', '1000'); INSERT INTO `log` VALUES (19, 'j2ee', '2019-10-27 16:24:09', 'View Product', 'K9-RT-01'); INSERT INTO `log` VALUES (20, 'j2ee', '2019-10-27 16:24:11', 'Add Item', 'EST-28'); INSERT INTO `log` VALUES (21, 'j2ee', '2019-10-27 16:24:24', 'Pay Order', '1000'); INSERT INTO `log` VALUES (22, 'j2ee', '2019-10-27 16:52:55', 'View Category', 'REPTILES'); INSERT INTO `log` VALUES (23, 'j2ee', '2019-10-27 16:52:57', 'View Product', 'RP-SN-01'); INSERT INTO `log` VALUES (24, 'j2ee', '2019-10-27 16:53:00', 'Add Item', 'EST-12'); INSERT INTO `log` VALUES (25, 'j2ee', '2019-10-27 16:53:21', 'Pay Order', '1000'); INSERT INTO `log` VALUES (26, 'j2ee', '2019-10-27 16:55:37', 'View Category', 'BIRDS'); INSERT INTO `log` VALUES (27, 'j2ee', '2019-10-27 16:55:39', 'View Product', 'AV-SB-02'); INSERT INTO `log` VALUES (28, 'j2ee', '2019-10-27 16:55:41', 'Add Item', 'EST-19'); INSERT INTO `log` VALUES (29, 'j2ee', '2019-10-27 17:11:31', 'View Category', 'BIRDS'); INSERT INTO `log` VALUES (30, 'j2ee', '2019-10-27 17:11:34', 'View Product', 'AV-SB-02'); INSERT INTO `log` VALUES (31, 'j2ee', '2019-10-27 17:11:36', 'Add Item', 'EST-19'); INSERT INTO `log` VALUES (32, 'j2ee', '2019-10-27 17:11:43', 'Pay Order', '1000'); INSERT INTO `log` VALUES (33, 'j2ee', '2019-10-27 17:13:51', 'View Category', 'DOGS'); INSERT INTO `log` VALUES (34, 'j2ee', '2019-10-27 17:13:54', 'View Product', 'K9-DL-01'); INSERT INTO `log` VALUES (35, 'j2ee', '2019-10-27 17:13:57', 'Add Item', 'EST-9'); INSERT INTO `log` VALUES (36, 'j2ee', '2019-10-27 17:16:42', 'Pay Order', '1000'); INSERT INTO `log` VALUES (37, 'j2ee', '2019-10-27 17:18:50', 'View Category', 'REPTILES'); INSERT INTO `log` VALUES (38, 'j2ee', '2019-10-27 17:18:52', 'View Product', 'RP-SN-01'); INSERT INTO `log` VALUES (39, 'j2ee', '2019-10-27 17:18:56', 'Add Item', 'EST-12'); INSERT INTO `log` VALUES (40, 'j2ee', '2019-10-27 17:19:57', 'Pay Order', '1000'); INSERT INTO `log` VALUES (41, 'j2ee', '2019-10-27 17:22:50', 'Pay Order', '1000'); INSERT INTO `log` VALUES (42, 'j2ee', '2019-10-27 17:35:49', 'Pay Order', '1000'); INSERT INTO `log` VALUES (43, 'j2ee', '2019-10-27 17:40:12', 'Pay Order', '1000'); INSERT INTO `log` VALUES (44, 'j2ee', '2019-10-27 17:57:45', 'View Category', 'REPTILES'); INSERT INTO `log` VALUES (45, 'j2ee', '2019-10-27 17:57:48', 'View Product', 'RP-SN-01'); INSERT INTO `log` VALUES (46, 'j2ee', '2019-10-27 17:58:01', 'View Item', 'EST-12'); INSERT INTO `log` VALUES (47, 'j2ee', '2019-10-27 17:58:03', 'Add Item', 'EST-12'); INSERT INTO `log` VALUES (48, 'j2ee', '2019-10-27 17:58:10', 'Create Order', '1000'); INSERT INTO `log` VALUES (49, 'j2ee', '2019-10-27 17:58:12', 'Pay Order', '1000'); INSERT INTO `log` VALUES (50, 'j2ee', '2019-10-27 18:07:20', 'View Category', 'BIRDS'); INSERT INTO `log` VALUES (51, 'j2ee', '2019-10-27 18:07:21', 'View Product', 'AV-SB-02'); INSERT INTO `log` VALUES (52, 'j2ee', '2019-10-27 18:07:23', 'View Item', 'EST-19'); INSERT INTO `log` VALUES (53, 'j2ee', '2019-10-27 18:07:25', 'Add Item', 'EST-19'); INSERT INTO `log` VALUES (54, 'j2ee', '2019-10-27 18:07:32', 'Create Order', '1001'); INSERT INTO `log` VALUES (55, 'j2ee', '2019-10-27 18:07:35', 'Pay Order', '1001'); INSERT INTO `log` VALUES (56, 'j2ee', '2019-10-27 18:22:41', 'View Category', 'DOGS'); INSERT INTO `log` VALUES (57, 'j2ee', '2019-10-27 18:22:43', 'View Product', 'K9-RT-02'); INSERT INTO `log` VALUES (58, 'j2ee', '2019-10-27 18:22:47', 'Add Item', 'EST-25'); INSERT INTO `log` VALUES (59, 'j2ee', '2019-10-27 18:22:52', 'Create Order', '1002'); INSERT INTO `log` VALUES (60, 'j2ee', '2019-10-27 18:22:55', 'Pay Order', '1002'); INSERT INTO `log` VALUES (61, 'j2ee', '2019-10-27 18:37:24', 'View Category', 'REPTILES'); INSERT INTO `log` VALUES (62, 'j2ee', '2019-10-27 18:37:26', 'View Product', 'RP-SN-01'); INSERT INTO `log` VALUES (63, 'j2ee', '2019-10-27 18:37:31', 'Add Item', 'EST-12'); INSERT INTO `log` VALUES (64, 'j2ee', '2019-10-27 18:37:35', 'View Category', 'BIRDS'); INSERT INTO `log` VALUES (65, 'j2ee', '2019-10-27 18:37:36', 'View Product', 'AV-SB-02'); INSERT INTO `log` VALUES (66, 'j2ee', '2019-10-27 18:37:38', 'Add Item', 'EST-19'); INSERT INTO `log` VALUES (67, 'j2ee', '2019-10-27 18:37:40', 'View Category', 'FISH'); INSERT INTO `log` VALUES (68, 'j2ee', '2019-10-27 18:37:41', 'View Product', 'FI-FW-02'); INSERT INTO `log` VALUES (69, 'j2ee', '2019-10-27 18:37:43', 'Add Item', 'EST-20'); INSERT INTO `log` VALUES (70, 'j2ee', '2019-10-27 18:37:51', 'Create Order', '1003'); INSERT INTO `log` VALUES (71, 'j2ee', '2019-10-27 18:37:54', 'Pay Order', '1003'); -- ---------------------------- -- Table structure for orders -- ---------------------------- DROP TABLE IF EXISTS `orders`; CREATE TABLE `orders` ( `orderid` int(11) NOT NULL AUTO_INCREMENT, `userid` varchar(80) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `orderdate` date NOT NULL, `shipaddr1` varchar(80) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `shipaddr2` varchar(80) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `shipcity` varchar(80) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `shipstate` varchar(80) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `shipzip` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `shipcountry` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `billaddr1` varchar(80) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `billaddr2` varchar(80) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `billcity` varchar(80) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `billstate` varchar(80) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `billzip` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `billcountry` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `courier` varchar(80) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `totalprice` decimal(10, 2) NOT NULL, `billtofirstname` varchar(80) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `billtolastname` varchar(80) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `shiptofirstname` varchar(80) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `shiptolastname` varchar(80) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `creditcard` varchar(80) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `exprdate` varchar(80) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `cardtype` varchar(80) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `locale` varchar(80) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, PRIMARY KEY (`orderid`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 999 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of orders -- ---------------------------- INSERT INTO `orders` VALUES (999, 'j2ee', '2019-10-21', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 19.20, 'a', 'a', 'a', 'a', '9999', 'a', 'visa', 'a'); INSERT INTO `orders` VALUES (1000, 'j2ee', '2019-10-27', '902 San Antonio Road', 'MS UCUP03-306', 'John', 'CB', '94415', 'USA', 'xixi', 'haha', 'lala', 'caca', '123', 'English', 'UPS', 39.50, 'John', 'Smith', 'John', 'Smith', '12345', ' 12/2019', 'visa', 'CA'); -- ---------------------------- -- Table structure for orderstatus -- ---------------------------- DROP TABLE IF EXISTS `orderstatus`; CREATE TABLE `orderstatus` ( `orderid` int(11) NOT NULL, `timestamp` date NOT NULL, `status` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, PRIMARY KEY (`orderid`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of orderstatus -- ---------------------------- INSERT INTO `orderstatus` VALUES (999, '2019-10-21', 'Paid'); INSERT INTO `orderstatus` VALUES (1000, '2019-10-27', 'Paid'); INSERT INTO `orderstatus` VALUES (1001, '2019-10-27', 'Paid'); INSERT INTO `orderstatus` VALUES (1002, '2019-10-27', 'Paid'); INSERT INTO `orderstatus` VALUES (1003, '2019-10-27', 'Paid'); -- ---------------------------- -- Table structure for product -- ---------------------------- DROP TABLE IF EXISTS `product`; CREATE TABLE `product` ( `productid` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `category` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `name` varchar(80) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `descn` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, PRIMARY KEY (`productid`) USING BTREE, INDEX `productCat`(`category`) USING BTREE, INDEX `productName`(`name`) USING BTREE, CONSTRAINT `fk_product_1` FOREIGN KEY (`category`) REFERENCES `category` (`catid`) ON DELETE RESTRICT ON UPDATE RESTRICT ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of product -- ---------------------------- INSERT INTO `product` VALUES ('AV-CB-01', 'BIRDS', 'Amazon Parrot', '<image src=\"images/bird2.gif\">Great companion for up to 75 years'); INSERT INTO `product` VALUES ('AV-SB-02', 'BIRDS', 'Finch', '<image src=\"images/bird1.gif\">Great stress reliever'); INSERT INTO `product` VALUES ('FI-FW-01', 'FISH', 'Koi', '<image src=\"images/fish3.gif\">Fresh Water fish from Japan'); INSERT INTO `product` VALUES ('FI-FW-02', 'FISH', 'Goldfish', '<image src=\"images/fish2.gif\">Fresh Water fish from China'); INSERT INTO `product` VALUES ('FI-SW-01', 'FISH', 'Angelfish', '<image src=\"images/fish1.gif\">Salt Water fish from Australia'); INSERT INTO `product` VALUES ('FI-SW-02', 'FISH', 'Tiger Shark', '<image src=\"images/fish4.gif\">Salt Water fish from Australia'); INSERT INTO `product` VALUES ('FL-DLH-02', 'CATS', 'Persian', '<image src=\"images/cat1.gif\">Friendly house cat, doubles as a princess'); INSERT INTO `product` VALUES ('FL-DSH-01', 'CATS', 'Manx', '<image src=\"images/cat2.gif\">Great for reducing mouse populations'); INSERT INTO `product` VALUES ('K9-BD-01', 'DOGS', 'Bulldog', '<image src=\"images/dog2.gif\">Friendly dog from England'); INSERT INTO `product` VALUES ('K9-CW-01', 'DOGS', 'Chihuahua', '<image src=\"images/dog4.gif\">Great companion dog'); INSERT INTO `product` VALUES ('K9-DL-01', 'DOGS', 'Dalmation', '<image src=\"images/dog5.gif\">Great dog for a Fire Station'); INSERT INTO `product` VALUES ('K9-PO-02', 'DOGS', 'Poodle', '<image src=\"images/dog6.gif\">Cute dog from France'); INSERT INTO `product` VALUES ('K9-RT-01', 'DOGS', 'Golden Retriever', '<image src=\"images/dog1.gif\">Great family dog'); INSERT INTO `product` VALUES ('K9-RT-02', 'DOGS', 'Labrador Retriever', '<image src=\"images/dog5.gif\">Great hunting dog'); INSERT INTO `product` VALUES ('RP-LI-02', 'REPTILES', 'Iguana', '<image src=\"images/lizard1.gif\">Friendly green friend'); INSERT INTO `product` VALUES ('RP-SN-01', 'REPTILES', 'Rattlesnake', '<image src=\"images/lizard1.gif\">Doubles as a watch dog'); -- ---------------------------- -- Table structure for profile -- ---------------------------- DROP TABLE IF EXISTS `profile`; CREATE TABLE `profile` ( `userid` varchar(80) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `langpref` varchar(80) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `favcategory` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `mylistopt` tinyint(1) NULL DEFAULT NULL, `banneropt` tinyint(1) NULL DEFAULT NULL, PRIMARY KEY (`userid`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of profile -- ---------------------------- INSERT INTO `profile` VALUES ('a', 'japanese', 'DOGS', NULL, NULL); INSERT INTO `profile` VALUES ('ACID', 'english', 'CATS', 1, 1); INSERT INTO `profile` VALUES ('j2ee', 'English', 'DOGS', 1, 1); -- ---------------------------- -- Table structure for sequence -- ---------------------------- DROP TABLE IF EXISTS `sequence`; CREATE TABLE `sequence` ( `typename` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `nextid` int(11) NOT NULL, PRIMARY KEY (`typename`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of sequence -- ---------------------------- INSERT INTO `sequence` VALUES ('cartnum', 1000); INSERT INTO `sequence` VALUES ('linenum', 1006); INSERT INTO `sequence` VALUES ('ordernum', 1004); -- ---------------------------- -- Table structure for signon -- ---------------------------- DROP TABLE IF EXISTS `signon`; CREATE TABLE `signon` ( `username` varchar(25) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `password` varchar(25) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, PRIMARY KEY (`username`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of signon -- ---------------------------- INSERT INTO `signon` VALUES ('a', 'a'); INSERT INTO `signon` VALUES ('ACID', 'ACID'); INSERT INTO `signon` VALUES ('admin', '1234'); INSERT INTO `signon` VALUES ('j2ee', 'j2ee'); -- ---------------------------- -- Table structure for supplier -- ---------------------------- DROP TABLE IF EXISTS `supplier`; CREATE TABLE `supplier` ( `suppid` int(11) NOT NULL, `name` varchar(80) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `status` varchar(2) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `addr1` varchar(80) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `addr2` varchar(80) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `city` varchar(80) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `state` varchar(80) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `zip` varchar(5) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `phone` varchar(80) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, PRIMARY KEY (`suppid`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of supplier -- ---------------------------- INSERT INTO `supplier` VALUES (1, 'XYZ Pets', 'AC', '600 Avon Way', '', 'Los Angeles', 'CA', '94024', '212-947-0797'); INSERT INTO `supplier` VALUES (2, 'ABC Pets', 'AC', '700 Abalone Way', '', 'San Francisco ', 'CA', '94024', '415-947-0797'); SET FOREIGN_KEY_CHECKS = 1;
CREATE VIEW Z_IMINVLOC_USAGE AS -- CREATED: 7/13/12 -- UPDATED: 7/13/12 BY: BG -- PURPOSE: Usage View SELECT TOP (100) PERCENT item_no AS item_no, SUM(CONVERT(Decimal(14, 4), usage_ytd)) AS usage_ytd FROM dbo.Z_IMINVLOC_USAGE_WITH_LEVELS GROUP BY item_no ORDER BY item_no
/*--customer (cid, firstname, lastname, gender, birthday, street, city) --online_sell (osid, cid, omid, sell_date) --online_media (omid, mid, price, type) --movie (mid, title, genre) --physical_media (pmid, mid, price, type, bought_date, bought_price) --physical_sell (psid, cid, pmid, sell_date)*/ /* QUESTION 1 */ /*point 1*/ drop index pmid_sell_INDX on physical_sell; create index pmid_sell_INDX on physical_sell(pmid); select count(pm.id) /* number of copies in physical_media store that are still in the shop */ from physical_media pm where pm.id not in ( /* id should not be in physical_sell */ select pmid from physical_sell ); select count(id) from online_media; /* number of online movies that are still in the shop: half of it are view offers */ /*point 2*/ drop index title_genre_INDX on movie; create index title_genre_INDX on movie(title,genre,origin); select count(ml.id) /* number of overlaps in movie table */ from movie ml where ml.origin='ML' and exists ( /* is there a movie from WH with the same title and genre? */ select * from movie wh where wh.title=ml.title and wh.genre=ml.genre and wh.origin='WH' ); select count(ml.id) /* number of overlaps on offer */ from movie ml /* every movie from ML that is in table "movie" is always on offer */ where ml.origin='ML' and exists ( select * from movie wh, physical_media pm where wh.title=ml.title and wh.genre=ml.genre and wh.origin='WH' and wh.id=pm.mid and pm.id not in( /* check if media containing the movie is in the offer */ select ps.pmid from physical_sell ps ) ); drop index pmid_sell_INDX on physical_sell; drop index title_genre_INDX on movie; /* QUESTION 2 */ /* point 1 */ drop index orig_INDX on movie; create index orig_INDX on movie(origin); select count(id) /* #customers of ML */ from customer where origin='ML'; select count(id) /* #customers of WH*/ from customer where origin='WH'; select count(id) /* #customers in total */ from customer; drop index orig_INDX on movie; /* point 2 */ drop index fname_lname_street_INDX on customer; create index fname_lname_street_INDX on customer(firstname,lastname,street,origin); /* drop index cust_orig on customer; create index cust_orig on customer(origin); */ select count(ml.id) /* #overlaps in customer */ from customer ml where ml.origin='ML' and exists ( /* is there a customer from WH with same fname,lname,street */ select * from customer wh where wh.firstname=ml.firstname and wh.lastname=ml.lastname and wh.street=ml.street and wh.origin='WH' ); drop index fname_lname_street_INDX on customer; /*drop index cust_orig on customer; */ /* point 3 */ select count(id) /* #of downloads and views in total */ from online_sell; select count(id), extract(year from sell_date) as year /* #of downloads and views per year */ from online_sell group by extract(year from sell_date); select count(os.id) /* #of downloads in total */ from online_sell os, online_media om where os.omid = om.id and om.type='download'; select count(os.id), extract(year from os.sell_date) as year /* #of downloads per year */ from online_sell os, online_media om where os.omid = om.id and om.type='download' group by extract(year from os.sell_date); select count(os.id) /* #of views in total */ from online_sell os, online_media om where os.omid = om.id and om.type='view'; select count(os.id), extract(year from os.sell_date) as year /* #of views per year */ from online_sell os, online_media om where os.omid = om.id and om.type='view' group by extract(year from os.sell_date); select count(id) /* #of physical sales in total */ from physical_sell; select count(id), extract(year from sell_date) as year /* #of physical sales per year */ from physical_sell group by extract(year from sell_date); /* point 4 */ select sum(om.price) /* revenue for online shop in total */ from online_sell os, online_media om where os.omid = om.id; select sum(om.price), extract(year from os.sell_date) as year /* revenue for online shop per year */ from online_sell os, online_media om where os.omid=om.id group by extract(year from os.sell_date); select sum(pm.price) /* revenue for physical shop in total */ from physical_sell ps, physical_media pm where ps.pmid = pm.id; select sum(pm.price), extract(year from ps.sell_date) as year /* revenue for physical shop per year */ from physical_sell ps, physical_media pm where ps.pmid = pm.id group by extract(year from ps.sell_date); /* for revenue in total (revenue ML + revenue WH): just sum up the two values */ /* point 5 */ select avg(om.price), os.cid /* avg revenue per customer for online shop in total */ from online_sell os, online_media om where os.omid = om.id group by os.cid; select avg(om.price), os.cid, extract(year from os.sell_date) /* avg revenue per customer for online shop per year */ from online_sell os, online_media om where os.omid = om.id group by os.cid, extract(year from os.sell_date); select avg(pm.price),ps.cid /* avg revenue per customer for physcial shop in total */ from physical_sell ps, physical_media pm where ps.pmid = pm.id group by ps.cid; select avg(pm.price),ps.cid,extract(year from ps.sell_date) /* avg revenue per customer for physcial shop per year */ from physical_sell ps, physical_media pm where ps.pmid = pm.id group by ps.cid, extract(year from ps.sell_date); /* still missing: for customer that appear in both shops */ /*point 6*/ /* net profit: revenue - expendure -> bought_price for hard copies */ /* net profit: revenue - expednure -> 30% of income per download, 25% of income per view */ select sum(om.price - 0.3*om.price) /* profit on downloads for online shop in total*/ from online_sell os, online_media om where os.omid=om.id and om.type='download'; select sum(om.price - 0.3*om.price),extract(year from os.sell_date) as year /* profit on downloads for online shop per year*/ from online_sell os, online_media om where os.omid=om.id and om.type='download' group by extract(year from os.sell_date); select sum(om.price - 0.25*om.price) /* profit on views for online shop in total*/ from online_sell os, online_media om where os.omid=om.id and om.type='view'; select sum(om.price - 0.25*om.price),extract(year from os.sell_date) as year /* profit on views for online shop per year*/ from online_sell os, online_media om where os.omid=om.id and om.type='view' group by extract(year from os.sell_date); /* for online shop profit in total: sum up the values */ select sum(pm.price - pm.bought_price) /* profit for physical shop in total */ from physical_sell ps, physical_media pm where ps.pmid=pm.id; select sum(pm.price - pm.bought_price), extract(year from ps.sell_date) /* profit for physical shop per year*/ from physical_sell ps, physical_media pm where ps.pmid=pm.id group by extract(year from ps.sell_date); /* for profit in total: sum up total profit of the two shops */ /* point 7 */ select avg(om.price - 0.3*om.price), os.cid /* avg profit on downloads per customer in total*/ from online_sell os, online_media om where os.omid=om.id and om.type='download' group by cid; select avg(om.price - 0.3*om.price), os.cid, extract(year from os.sell_date) as year /* avg profit on downloads per customer per year*/ from online_sell os, online_media om where os.omid=om.id and om.type='download' group by cid,extract(year from os.sell_date); select avg(om.price - 0.25*om.price), os.cid, /* avg profit on views per customer in total*/ from online_sell os, online_media om where os.omid=om.id and om.type='view' group by cid; select avg(om.price - 0.25*om.price), os.cid, extract(year from os.sell_date) as year/* avg profit on views per customer per year*/ from online_sell os, online_media om where os.omid=om.id and om.type='view' group by cid, extract(year from os.sell_date); select avg(pm.price-pm.bought_price), ps.cid /* avg profit on hard copies per customer in total */ from physical_sell ps, physical_media pm where ps.pmid=pm.id group by ps.cid; select avg(pm.price-pm.bought_price), ps.cid, extract(year from ps.sell_date) as year/* avg profit on hard copies per customer per year */ from physical_sell ps, physical_media pm where ps.pmid=pm.id group by ps.cid, extract(year from ps.sell_date);
-- -------------------------------------------------------- -- Title: Retrieves instances of FFP transfusions -- Notes: this query does not specify a schema. To run it on your local -- MIMIC schema, run the following command: -- SET SEARCH_PATH TO public, mimiciii; -- Where "mimiciii" is the name of your schema, and may be different. -- This will create the table on the "public" schema. -- -------------------------------------------------------- DROP materialized VIEW IF EXISTS ffp_transfusion CASCADE; CREATE materialized VIEW ffp_transfusion AS WITH raw_ffp AS ( SELECT CASE WHEN amount IS NOT NULL THEN amount WHEN stopped IS NOT NULL THEN 0 -- impute 200 mL when unit is not documented -- this is an approximation which holds ~90% of the time ELSE 200 END AS amount , amountuom , icustay_id , charttime FROM inputevents_cv WHERE itemid IN ( 30005, -- Fresh Frozen Plasma 30180 -- Fresh Froz Plasma ) AND amount > 0 UNION ALL SELECT amount , amountuom , icustay_id , endtime AS charttime FROM inputevents_mv WHERE itemid in ( 220970 -- Fresh Frozen Plasma ) AND amount > 0 ), pre_icu_ffp as ( SELECT sum(amount) as amount, icustay_id FROM inputevents_cv WHERE itemid IN ( 44172, -- FFP GTT 44236, -- E.R. FFP 46410, -- angio FFP 46418, -- ER ffp 46684, -- ER FFP 44819, -- FFP ON FARR 2 46530, -- Floor FFP 44044, -- FFP Drip 46122, -- ER in FFP 45669, -- ED FFP 42323 -- er ffp ) AND amount > 0 GROUP BY icustay_id UNION ALL SELECT sum(amount) as amount, icustay_id FROM inputevents_mv WHERE itemid IN ( 227072 -- PACU FFP Intake ) AND amount > 0 GROUP BY icustay_id ), cumulative AS ( SELECT sum(amount) over (PARTITION BY icustay_id ORDER BY charttime DESC) AS amount , amountuom , icustay_id , charttime , lag(charttime) over (PARTITION BY icustay_id ORDER BY charttime ASC) - charttime AS delta FROM raw_ffp ) -- We consider any transfusions started within 1 hr of the last one -- to be part of the same event SELECT cm.icustay_id , cm.charttime , cm.amount - CASE WHEN ROW_NUMBER() OVER w = 1 THEN 0 ELSE lag(cm.amount) OVER w END AS amount , cm.amount + CASE WHEN pre.amount IS NULL THEN 0 ELSE pre.amount END AS totalamount , cm.amountuom FROM cumulative AS cm LEFT JOIN pre_icu_ffp AS pre USING (icustay_id) WHERE delta IS NULL OR delta < CAST('-1 hour' AS INTERVAL) WINDOW w AS (PARTITION BY cm.icustay_id ORDER BY cm.charttime DESC) ORDER BY icustay_id, charttime;
CREATE TABLE wb_article_preview( id INT KEY AUTO_INCREMENT, title VARCHAR (30) NOT NULL UNIQUE, intro VARCHAR (200) NOT NULL, create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP, article_type TINYINT DEFAULT 0, read_count INT DEFAULT 0 ) charset=utf8, engine=innodb, auto_increment=1000; CREATE TABLE wb_article_content( article_id INT KEY, content TEXTcrea ) charset=utf8, engine=innodb; CREATE TABLE wb_tag( id INT KEY AUTO_INCREMENT, name CHAR (16) ) charset=utf8, engine=innodb, auto_increment=1000; CREATE TABLE r_article_tag( article_id INT, tag_id INT, KEY (article_id, tag_id) ) charset=utf8, engine=innodb; CREATE TABLE wb_timeline( id INT KEY AUTO_INCREMENT, create_time DATE, content VARCHAR (1000), assoc_url VARCHAR (100) ) charset=utf8, engine=innodb;
/* Navicat MySQL Data Transfer Source Server : MyConnection Source Server Version : 100137 Source Host : localhost:3306 Source Database : laravel-basics Target Server Type : MYSQL Target Server Version : 100137 File Encoding : 65001 Date: 2019-06-26 22:54:12 */ SET FOREIGN_KEY_CHECKS=0; -- ---------------------------- -- Table structure for friends -- ---------------------------- DROP TABLE IF EXISTS `friends`; CREATE TABLE `friends` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL, `my_id` int(11) NOT NULL, `friend_id` int(11) NOT NULL, `is_friend` tinyint(1) NOT NULL DEFAULT '0', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- ---------------------------- -- Records of friends -- ---------------------------- -- ---------------------------- -- Table structure for likes -- ---------------------------- DROP TABLE IF EXISTS `likes`; CREATE TABLE `likes` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL, `user_id` int(11) NOT NULL, `post_id` int(11) NOT NULL, `like` tinyint(1) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- ---------------------------- -- Records of likes -- ---------------------------- -- ---------------------------- -- Table structure for migrations -- ---------------------------- DROP TABLE IF EXISTS `migrations`; CREATE TABLE `migrations` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `migration` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `batch` int(11) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- ---------------------------- -- Records of migrations -- ---------------------------- INSERT INTO `migrations` VALUES ('1', '2019_05_16_181135_create_users_table', '1'); INSERT INTO `migrations` VALUES ('2', '2019_05_22_160444_create_posts_table', '2'); INSERT INTO `migrations` VALUES ('3', '2019_05_26_164857_create_likes_table', '3'); INSERT INTO `migrations` VALUES ('4', '2019_05_27_163118_create_friends_table', '4'); INSERT INTO `migrations` VALUES ('5', '2019_05_27_172008_create_requests_table', '5'); -- ---------------------------- -- Table structure for posts -- ---------------------------- DROP TABLE IF EXISTS `posts`; CREATE TABLE `posts` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL, `body` text COLLATE utf8mb4_unicode_ci NOT NULL, `user_id` int(11) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- ---------------------------- -- Records of posts -- ---------------------------- INSERT INTO `posts` VALUES ('5', '2019-05-22 17:39:53', '2019-05-22 17:39:53', 'Lorem Ipsum is simply dummy text of the printing and typesetting industry.', '27'); INSERT INTO `posts` VALUES ('6', '2019-05-22 17:40:07', '2019-05-22 17:40:07', 'It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using \'Content here, content here\', making it look like readable English.', '27'); INSERT INTO `posts` VALUES ('7', '2019-05-22 19:16:27', '2019-05-22 19:16:27', 'There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which don\'t look even slightly believable.', '21'); INSERT INTO `posts` VALUES ('8', '2019-05-22 19:16:41', '2019-05-22 19:16:41', 'Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old.', '21'); INSERT INTO `posts` VALUES ('10', '2019-05-22 19:40:47', '2019-05-22 19:40:47', 'The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for those interested. Sections 1.10.32 and 1.10.33 from \"de Finibus Bonorum et Malorum\" by Cicero are also reproduced in their exact original form, accompanied by English versions from the 1914 translation by H. Rackham.', '26'); INSERT INTO `posts` VALUES ('11', '2019-05-23 19:36:15', '2019-05-23 21:57:11', 'A new post....The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for those interested. Sections 1.10.32 and 1.10.33 from', '26'); INSERT INTO `posts` VALUES ('12', '2019-05-23 20:55:30', '2019-05-24 18:15:46', 'New post', '26'); INSERT INTO `posts` VALUES ('13', '2019-06-21 14:39:03', '2019-06-21 14:39:19', 'The standard chunk of Ipsum used since the 1500s is reproduced below for those interested.', '20'); -- ---------------------------- -- Table structure for requests -- ---------------------------- DROP TABLE IF EXISTS `requests`; CREATE TABLE `requests` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL, `my_id` int(11) NOT NULL, `user_id` int(11) NOT NULL, `is_requered` tinyint(1) NOT NULL DEFAULT '0', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- ---------------------------- -- Records of requests -- ---------------------------- INSERT INTO `requests` VALUES ('1', null, null, '20', '21', '1'); -- ---------------------------- -- Table structure for users -- ---------------------------- DROP TABLE IF EXISTS `users`; CREATE TABLE `users` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL, `email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `first_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `password` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `remember_token` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `photo` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=28 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- ---------------------------- -- Records of users -- ---------------------------- INSERT INTO `users` VALUES ('20', '2019-05-16 21:27:17', '2019-06-25 17:08:29', 'a@mail.ru', 'Arm', '$2y$10$yyDiVO90U7yIkViFl3fPweNdT0epA75iOwyysCbwTwZ6KGAiuJBhq', null, 'Arm-20.jpg'); INSERT INTO `users` VALUES ('21', '2019-05-16 21:27:41', '2019-06-06 12:33:08', 'b@mail.ru', 'Max', '$2y$10$pXbjwXv3Duvt37ixVS0bF.DN303pOu7umGOI7GRZg9mBr/nH67an6', null, 'Max-21.jpg'); INSERT INTO `users` VALUES ('22', '2019-05-17 08:08:34', '2019-06-25 17:11:03', 'c@mail.ru', 'Max', '$2y$10$C/S.NeCgpf.dQedaAWC7e.ArRocIiqMav5HnHfPE9CpUU.tuVetGq', null, 'Max-22.jpg'); INSERT INTO `users` VALUES ('26', '2019-05-17 09:10:52', '2019-05-27 17:24:36', 'k@mail.ru', 'Test', '$2y$10$U.3rK4A4C7G.uAaKogYoZuijIJW68/W0svMESH1BHgORPtwLjoTue', null, 'Test-26.jpg'); INSERT INTO `users` VALUES ('27', '2019-05-22 12:34:36', '2019-05-26 15:27:29', 'f@mail.ru', 'Arm', '$2y$10$OoRknVHvVE33PdxiVHdenOkJv5I59zgRzV7PY7DfMMX1ul2b13wi2', null, 'Arm-27.jpg'); SET FOREIGN_KEY_CHECKS=1;
/*Use the accounts table to create first and last name columns that hold the first and last names for the primary_poc.*/ SELECT LEFT(primary_poc,POSITION(' ' IN primary_poc)) AS first,RIGHT(primary_poc,LENGTH(primary_poc)-LENGTH(LEFT(primary_poc,POSITION(' ' IN primary_poc)))) AS LAST FROM ACCOUNTS
CREATE PROCEDURE GetProducts as begin select * from Product end --execute procedure exec GetProducts
CREATE TABLE [display].[sys_user_group] ( [active_display_value] NVARCHAR(80) NULL, [type_display_value] NVARCHAR(80) NULL, [sys_created_on_display_value] DATETIME NULL, [email_display_value] NVARCHAR(255) NULL, [description_display_value] NVARCHAR(MAX) NULL, [sys_updated_by_display_value] NVARCHAR(80) NULL, [sys_id_display_value] NVARCHAR(255) NULL, [include_members_display_value] NVARCHAR(80) NULL, [manager_display_value] NVARCHAR(255) NULL, [exclude_manager_display_value] NVARCHAR(80) NULL, [sys_mod_count_display_value] NVARCHAR(80) NULL, [default_assignee_display_value] NVARCHAR(80) NULL, [sys_created_by_display_value] NVARCHAR(255) NULL, [name_display_value] NVARCHAR(500) NULL, [sys_updated_on_display_value] DATETIME NULL, [sys_tags_display_value] NVARCHAR(80) NULL, [roles_display_value] NVARCHAR(MAX) NULL, [cost_center_display_value] NVARCHAR(MAX) NULL, [parent_display_value] NVARCHAR(500) NULL, [source_display_value] NVARCHAR(80) NULL )
create table member( name varchar2(20) not null, birth number(8) not null, gender varchar(10) not null, phone varchar2(20) primary key, mail varchar2(50) );
with prs as ( select pr.created_at, pr.merged_at from gha_pull_requests pr where pr.merged_at is not null and pr.created_at >= '{{from}}' and pr.created_at < '{{to}}' and pr.event_id = ( select i.event_id from gha_pull_requests i where i.id = pr.id order by i.updated_at desc limit 1 ) ), prs_groups as ( select r.repo_group, pr.created_at, pr.merged_at as merged_at from gha_pull_requests pr, gha_repos r where r.id = pr.dup_repo_id and r.name = pr.dup_repo_name and r.repo_group is not null and pr.merged_at is not null and pr.created_at >= '{{from}}' and pr.created_at < '{{to}}' and pr.event_id = ( select i.event_id from gha_pull_requests i where i.id = pr.id order by i.updated_at desc limit 1 ) ), prs_comps as ( select aa.company_name, pr.created_at, pr.merged_at from gha_pull_requests pr, gha_actors_affiliations aa where aa.actor_id = pr.user_id and aa.dt_from <= pr.created_at and aa.dt_to > pr.created_at and aa.company_name in (select companies_name from tcompanies) and pr.merged_at is not null and pr.created_at >= '{{from}}' and pr.created_at < '{{to}}' and pr.event_id = ( select i.event_id from gha_pull_requests i where i.id = pr.id order by i.updated_at desc limit 1 ) ), prs_groups_comps as ( select r.repo_group, aa.company_name, pr.created_at, pr.merged_at as merged_at from gha_pull_requests pr, gha_repos r, gha_actors_affiliations aa where aa.actor_id = pr.user_id and aa.dt_from <= pr.created_at and aa.dt_to > pr.created_at and aa.company_name in (select companies_name from tcompanies) and r.id = pr.dup_repo_id and r.name = pr.dup_repo_name and r.repo_group is not null and pr.merged_at is not null and pr.created_at >= '{{from}}' and pr.created_at < '{{to}}' and pr.event_id = ( select i.event_id from gha_pull_requests i where i.id = pr.id order by i.updated_at desc limit 1 ) ), tdiffs as ( select extract(epoch from merged_at - created_at) / 3600 as open_to_merge from prs ), tdiffs_groups as ( select repo_group, extract(epoch from merged_at - created_at) / 3600 as open_to_merge from prs_groups ), tdiffs_comps as ( select company_name, extract(epoch from merged_at - created_at) / 3600 as open_to_merge from prs_comps ), tdiffs_groups_comps as ( select repo_group, company_name, extract(epoch from merged_at - created_at) / 3600 as open_to_merge from prs_groups_comps ) select 'open2merge;All_All;p15,med,p85' as name, percentile_disc(0.15) within group (order by open_to_merge asc) as open_to_merge_15_percentile, percentile_disc(0.5) within group (order by open_to_merge asc) as open_to_merge_median, percentile_disc(0.85) within group (order by open_to_merge asc) as open_to_merge_85_percentile from tdiffs union select 'open2merge;' || repo_group || '_All;p15,med,p85' as name, percentile_disc(0.15) within group (order by open_to_merge asc) as open_to_merge_15_percentile, percentile_disc(0.5) within group (order by open_to_merge asc) as open_to_merge_median, percentile_disc(0.85) within group (order by open_to_merge asc) as open_to_merge_85_percentile from tdiffs_groups group by repo_group union select 'open2merge;All_' || company_name || ';p15,med,p85' as name, percentile_disc(0.15) within group (order by open_to_merge asc) as open_to_merge_15_percentile, percentile_disc(0.5) within group (order by open_to_merge asc) as open_to_merge_median, percentile_disc(0.85) within group (order by open_to_merge asc) as open_to_merge_85_percentile from tdiffs_comps group by company_name union select 'open2merge;' || repo_group || '_' || company_name || ';p15,med,p85' as name, percentile_disc(0.15) within group (order by open_to_merge asc) as open_to_merge_15_percentile, percentile_disc(0.5) within group (order by open_to_merge asc) as open_to_merge_median, percentile_disc(0.85) within group (order by open_to_merge asc) as open_to_merge_85_percentile from tdiffs_groups_comps group by repo_group, company_name order by open_to_merge_median desc, name asc ;
Create Procedure mERP_sp_DefaultOutletGroupID(@SchemeID Int) As Begin Select isNull(Min(GroupID),0) From tbl_mERP_SchemeSubGroup Where SchemeID = @SchemeID End
# ************************************************************ # Sequel Pro SQL dump # Version 4541 # # http://www.sequelpro.com/ # https://github.com/sequelpro/sequelpro # # Host: localhost (MySQL 5.7.25) # Database: fish # Generation Time: 2019-03-27 17:28:38 +0000 # ************************************************************ /*!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 */; /*!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 */; # Dump of table games # ------------------------------------------------------------ DROP TABLE IF EXISTS `games`; CREATE TABLE `games` ( `id` int(11) NOT NULL AUTO_INCREMENT, `gameCode` varchar(32) NOT NULL, `turn` int(11) NOT NULL, `population` int(11) NOT NULL, `gameState` varchar(12) NOT NULL DEFAULT 'none', `chair` varchar(20) DEFAULT '', `config` varchar(10) NOT NULL DEFAULT 'alpha', `reason` text, `created` datetime DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; # Dump of table players # ------------------------------------------------------------ DROP TABLE IF EXISTS `players`; CREATE TABLE `players` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `playerName` varchar(20) NOT NULL, `gameCode` varchar(32) NOT NULL, `onTurn` int(11) NOT NULL, `balance` int(11) NOT NULL, PRIMARY KEY (`id`), KEY `gameCode` (`gameCode`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; # Dump of table turns # ------------------------------------------------------------ DROP TABLE IF EXISTS `turns`; CREATE TABLE `turns` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `playerName` varchar(20) NOT NULL, `gameCode` varchar(32) NOT NULL, `onTurn` int(11) NOT NULL, `visible` float NOT NULL, `sought` float NOT NULL, `caught` float NOT NULL, `balanceBefore` int(11) NOT NULL, `unitPrice` float DEFAULT NULL, `income` int(11) DEFAULT NULL, `expenses` int(11) DEFAULT NULL, `balanceAfter` int(11) DEFAULT NULL, PRIMARY KEY (`id`), KEY `game` (`gameCode`), KEY `player` (`playerName`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_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 */;
CREATE DEFINER=`administrator`@`localhost` PROCEDURE `selectBusiness`(IN BID int) BEGIN #Selects business information from business_info view. To be used with select_business_images, select_business_hours, and select_deals select *, if(is_open(BID), "true", "false") as 'open' from business_info bi WHERE bi.business_id = BID; END
WITH y AS ( SELECT picking_id, product_id, location_id, sum(qty) AS qty FROM vg_xxy_stock_move_by_location WHERE prodlot_id IS NULL GROUP BY picking_id, product_id, location_id ) SELECT a.location_id, a.product_id, a.picking_id, b.lot_id AS prodlot_id, CASE WHEN a.qty < 0::NUMERIC THEN (- 1) ELSE 1 END AS stock_qty FROM y a INNER JOIN stock_pack_operation b ON a.picking_id = b.picking_id AND a.product_id = b.product_id AND b.location_dest_id = a.location_id UNION SELECT a.location_id, a.product_id, a.picking_id, b.lot_id AS prodlot_id, CASE WHEN a.qty < 0::NUMERIC THEN (- 1) ELSE 1 END AS stock_qty FROM y a INNER JOIN stock_pack_operation b ON a.picking_id = b.picking_id AND a.product_id = b.product_id AND b.location_id = a.location_id UNION SELECT a.location_id, a.product_id, a.picking_id, a.prodlot_id, a.qty AS stock_qty FROM vg_xxy_stock_move_by_location a WHERE a.prodlot_id IS NOT NULL; -- ----------------------------------------------------- SELECT a.id, a.origin, a.date, a.product_qty, a.location_id, a.state, a.name, a.warehouse_id, a.restrict_lot_id, a.product_id, a.picking_id, a.location_dest_id, a.invoice_state, a.invoice_line_id, round(b.price_subtotal / b.quantity,0) as unit_sale_price FROM stock_move a join account_invoice_line b on a.invoice_line_id = b.id where a.state <> 'cancel' and a.invoice_state = 'invoiced' and a.origin_returned_move_id is null with x as (SELECT a.id, a.origin, a.date, a.product_qty, a.location_id, a.state, a.name, a.warehouse_id, a.restrict_lot_id, a.product_id, a.picking_id, a.location_dest_id, a.invoice_state, a.invoice_line_id, round(b.price_subtotal / b.quantity,0) as unit_sale_price FROM stock_move a join account_invoice_line b on a.invoice_line_id = b.id where a.state <> 'cancel' and a.invoice_state = 'invoiced' and a.origin_returned_move_id is null ) SELECT i.id, l.id AS location_id, i.product_id, CASE WHEN i.state::text = 'done'::text THEN i.product_qty ELSE 0::numeric END AS qty, i.date, i.unit_sale_price, i.restrict_lot_id AS prodlot_id, i.picking_id, i.invoice_line_id FROM stock_location l, x i WHERE l.usage::text = 'internal'::text AND i.location_dest_id = l.id UNION ALL SELECT o.id, l.id AS location_id, o.product_id, CASE WHEN o.state::text = 'done'::text THEN - o.product_qty ELSE 0::numeric END AS qty, o.date, o.unit_sale_price, o.restrict_lot_id AS prodlot_id, o.picking_id, o.invoice_line_id FROM stock_location l, x o WHERE l.usage::text = 'internal'::text AND i.location_dest_id = l.id SELECT a.id, a.origin, a.move_dest_id, a.date, a.product_qty, a.origin_returned_move_id, a.location_id, a.picking_type_id, a.partner_id, a.state, a.name, a.warehouse_id, a.procure_method, a.restrict_lot_id, a.product_id, a.picking_id, a.location_dest_id, a.invoice_state, a.invoice_line_id, b.invoice_id, b.price_unit, b.price_subtotal,b.discount , b.product_id , b.name , b.quantity FROM stock_move a -- where a.invoice_line_id is not null; join account_invoice_line b on a.invoice_line_id = b.id where a.product_qty <> b.quantity and a.state <> 'cancel' and a.invoice_state = 'invoiced' and a.origin_returned_move_id is null order by a.origin; WITH x AS ( SELECT a.id, a.origin, a.DATE, a.product_qty, a.location_id, a.STATE, a.NAME, a.warehouse_id, a.restrict_lot_id, a.product_id, a.picking_id, a.location_dest_id, a.invoice_state, a.invoice_line_id, round(b.price_subtotal / b.quantity, 0) AS unit_sale_price FROM stock_move a INNER JOIN account_invoice_line b ON a.invoice_line_id = b.id WHERE a.STATE <> 'cancel' AND a.invoice_state = 'invoiced' AND a.origin_returned_move_id IS NULL AND a.product_qty <> 0 ) SELECT i.id, l.id AS location_id, i.product_id, CASE WHEN i.STATE::TEXT = 'done'::TEXT THEN i.product_qty ELSE 0::NUMERIC END AS qty, i.DATE, i.unit_sale_price, i.restrict_lot_id AS prodlot_id, i.picking_id, i.invoice_line_id FROM stock_location l, x i WHERE l.usage::TEXT = 'internal'::TEXT AND i.location_dest_id = l.id UNION ALL SELECT o.id, l.id AS location_id, o.product_id, CASE WHEN o.STATE::TEXT = 'done'::TEXT THEN - o.product_qty ELSE 0::NUMERIC END AS qty, o.DATE, o.unit_sale_price, o.restrict_lot_id AS prodlot_id, o.picking_id, o.invoice_line_id FROM stock_location l, x o WHERE l.usage::TEXT = 'internal'::TEXT AND o.location_dest_id = l.id; CREATE OR REPLACE VIEW vg_xxy_stock_move_by_location_2 AS WITH x AS ( SELECT vg_xxy_stock_move_by_location.id, vg_xxy_stock_move_by_location.location_id, vg_xxy_stock_move_by_location.product_id, vg_xxy_stock_move_by_location.qty, vg_xxy_stock_move_by_location.date, vg_xxy_stock_move_by_location.prodlot_id, vg_xxy_stock_move_by_location.picking_id, vg_xxy_stock_move_by_location.invoice_line_id, row_number() OVER (PARTITION BY vg_xxy_stock_move_by_location.picking_id, vg_xxy_stock_move_by_location.product_id) AS rnk FROM vg_xxy_stock_move_by_location ), y AS ( SELECT x.id, x.location_id, x.product_id, x.qty, x.date, x.prodlot_id, x.picking_id, x.invoice_line_id, x.rnk FROM x WHERE x.rnk = 1 ) SELECT a.id, a.location_id, a.product_id, a.date, a.picking_id, a.invoice_line_id, b.lot_id AS prodlot_id, CASE WHEN a.qty < 0::numeric THEN (-1) ELSE 1 END AS stock_qty FROM y a JOIN stock_pack_operation b ON a.picking_id = b.picking_id AND a.product_id = b.product_id AND b.location_dest_id = a.location_id WHERE a.prodlot_id IS NULL UNION SELECT a.id, a.location_id, a.product_id, a.date, a.picking_id, a.invoice_line_id, b.lot_id AS prodlot_id, CASE WHEN a.qty < 0::numeric THEN (-1) ELSE 1 END AS stock_qty FROM y a JOIN stock_pack_operation b ON a.picking_id = b.picking_id AND a.product_id = b.product_id AND b.location_id = a.location_id WHERE a.prodlot_id IS NULL UNION SELECT a.id, a.location_id, a.product_id, a.date, a.picking_id, a.invoice_line_id, a.prodlot_id, a.qty AS stock_qty FROM y a WHERE a.prodlot_id IS NOT NULL;
SELECT * FROM "special_movie" WHERE movie_id = ?;
INSERT INTO speeding_driver_alerts SELECT windowEnd, driverAvgSpeed.driverId, driverAvgSpeed.driverName, driverAvgSpeed.route, driverAvgSpeed.driverAvgSpeed FROM ( SELECT TUMBLE_END(geo_events.event_time, INTERVAL '3' MINUTE) as windowEnd, geo_events.driverId,geo_events.driverName,geo_events.route, avg(speed_events.speed) as driverAvgSpeed FROM truck_geo_events as geo_events, truck_speed_events as speed_events where geo_events.driverId = speed_events.driverId AND geo_events.event_time BETWEEN speed_events.event_time - INTERVAL '1' SECOND AND speed_events.event_time + INTERVAL '1' SECOND GROUP BY TUMBLE(geo_events.event_time, INTERVAL '3' MINUTE), geo_events.driverId, geo_events.driverName, geo_events.route ) driverAvgSpeed WHERE driverAvgSpeed.driverAvgSpeed > 80;
select xz, B.BX, DD from A JOIN B on A = B.B where A.BX <> 33;
/* Name: Amount of Searches saved 2 Data source: 4 Created By: Admin Last Update At: 2016-09-26T13:37:22.499847+00:00 */ SELECT date_time FROM (TABLE_QUERY(djomniture:cipomniture_djmansionglobal,'CONCAT(REPLACE(table_id,"_","-"),"-01") BETWEEN STRFTIME_UTC_USEC("{{startdate}}", "%Y-%m-01") and STRFTIME_UTC_USEC("{{enddate}}", "%Y-%m-31")')) WHERE date(date_time) > date('2016-02-02') and post_page_event='100' and post_prop25 ='searchSaved' order by date_time asc
CREATE TABLE CCAA( nombre varchar(100), PRIMARY KEY(nombre)); INSERT INTO CCAA(Nombre) Values('C.A Madrid'); INSERT INTO CCAA(Nombre) Values('Barcelona'); INSERT INTO CCAA(Nombre) Values('C.A Valenciana'); CREATE TABLE Ciudades( cid int, nombre varchar(100), ccaa varchar(100) NOT NULL, PRIMARY KEY(cid), UNIQUE(nombre,ccaa), FOREIGN KEY(ccaa) REFERENCES CCAA(nombre) ); INSERT INTO Ciudades(cid,Nombre,ccaa) Values(1,'Madrid', 'C.A Madrid'); INSERT INTO Ciudades(cid,Nombre,ccaa) Values(2,'Fuenlabrada', 'C.A Madrid'); INSERT INTO Ciudades(cid,Nombre,ccaa) Values(3,'Barcelona', 'Barcelona'); INSERT INTO Ciudades(cid,Nombre,ccaa) Values(4,'Alicante', 'C.A Valenciana'); CREATE TABLE Equipos( eid INT, nombre VARCHAR(100), cid INT NOT NULL, PRIMARY KEY(eid), FOREIGN KEY(cid) REFERENCES Ciudades(cid) ); INSERT INTO Equipos(eid,nombre,cid) Values(1, 'Real Madrid', 1); INSERT INTO Equipos(eid,nombre,cid) Values(2, 'Fuenlabrada', 2); INSERT INTO Equipos(eid,nombre,cid) Values(3, 'F.C Barcelona', 3); INSERT INTO Equipos(eid,nombre,cid) Values(4, 'Valencia Basket', 4); INSERT INTO Equipos(eid,nombre,cid) Values(5, 'DKV Joventud', 3); CREATE TABLE Temporadas( cid INT, cif_empresa VARCHAR(20), f_ini DATETIME, f_fin DATETIME, PRIMARY KEY(cid), FOREIGN KEY(cif_empresa) REFERENCES Empresas(cif) ); INSERT INTO Temporadas(cid, f_ini,f_fin,cif_empresa) Values(1, '2015-09-15', '2016-04-16', '5555E'); INSERT INTO Temporadas(cid, f_ini,f_fin,cif_empresa) Values(2, '2016-09-22', '2016-05-2', '5555E'); CREATE TABLE Empresas( cif VARCHAR(20), nombre VARCHAR(100), PRIMARY KEY(cif) ); INSERT INTO Empresas(cif,nombre) Values('1111E', 'BBVA'); INSERT INTO Empresas(cif,nombre) Values('2222E', 'MMT'); INSERT INTO Empresas(cif,nombre) Values('3333E', 'DKV'); INSERT INTO Empresas(cif,nombre) Values('4444E', 'LASSA'); INSERT INTO Empresas(cif,nombre) Values('5555E', 'Endesa'); INSERT INTO Empresas(cif,nombre) Values('6666E', 'TATA MOTORS'); INSERT INTO Empresas(cif,nombre) Values('7777E', 'Inditex'); CREATE TABLE Empresa_Equipo( cif VARCHAR(20), eid INT, PRIMARY KEY(cif,eid), FOREIGN KEY(cif) REFERENCES Empresas(cif), FOREIGN KEY(eid) REFERENCES Equipos(eid) ); INSERT INTO Empresa_Equipo(cif,eid) Values('2222E', 1); INSERT INTO Empresa_Equipo(cif,eid) Values('4444E', 3); INSERT INTO Empresa_Equipo(cif,eid) Values('3333E', 5); CREATE TABLE Personas( nif varchar(20), nombre varchar(20), apellidos varchar(50), fecha_nac DATETIME, PRIMARY KEY(nif)); INSERT INTO Personas(nif,nombre,apellidos,fecha_nac) Values('1111E', 'adrian', 'oter', '1994-03-21'); INSERT INTO Personas(nif,nombre,apellidos,fecha_nac) Values('2222E', 'cris', 'nieto', '1994-02-04'); INSERT INTO Personas(nif,nombre,apellidos,fecha_nac) Values('3333E', 'fer', 'rioja', '1994-06-14'); INSERT INTO Personas(nif,nombre,apellidos,fecha_nac) Values('1111J', 'fran', 'vazquez', '1980-03-21'); INSERT INTO Personas(nif,nombre,apellidos,fecha_nac) Values('2222J', 'juan carlos', 'navarro', '1978-02-04'); INSERT INTO Personas(nif,nombre,apellidos,fecha_nac) Values('3333J', 'roberto', 'dueñas', '1975-06-14'); INSERT INTO Personas(nif,nombre,apellidos,fecha_nac) Values('4444J', 'victor', 'claver', '1985-06-14'); INSERT INTO Personas(nif,nombre,apellidos,fecha_nac) Values('5555J', 'alex', 'abrines', '1993-05-18'); INSERT INTO Personas(nif,nombre,apellidos,fecha_nac) Values('6666J', 'sergio', 'llull', '1984-07-01'); INSERT INTO Personas(nif,nombre,apellidos,fecha_nac) Values('7777J', 'rudy', 'fernandez', '1982-06-17'); INSERT INTO Personas(nif,nombre,apellidos,fecha_nac) Values('8888J', 'louis', 'bullock', '1973-01-24'); INSERT INTO Personas(nif,nombre,apellidos,fecha_nac) Values('9999J', 'felipe', 'reyes', '1979-01-11'); INSERT INTO Personas(nif,nombre,apellidos,fecha_nac) Values('0000J', 'gustavo', 'ayon', '1972-02-03'); CREATE TABLE Entrenadores( nif VARCHAR(20), PRIMARY KEY(nif), FOREIGN KEY(nif) REFERENCES Personas(nif) ON DELETE CASCADE); INSERT INTO Entrenadores(nif) Values('1111E'); INSERT INTO Entrenadores(nif) Values('2222E'); INSERT INTO Entrenadores(nif) Values('3333E'); CREATE TABLE Jugadores( nif VARCHAR(20), estatura int, PRIMARY KEY(nif), FOREIGN KEY(nif) REFERENCES Personas(nif) ON DELETE CASCADE); INSERT INTO Jugadores(nif,estatura) Values('1111J', 2.08); INSERT INTO Jugadores(nif,estatura) Values('2222J', 1.90); INSERT INTO Jugadores(nif,estatura) Values('3333J', 2.12); INSERT INTO Jugadores(nif,estatura) Values('4444J', 2.02); INSERT INTO Jugadores(nif,estatura) Values('5555J', 1.89); INSERT INTO Jugadores(nif,estatura) Values('6666J', 1.93); INSERT INTO Jugadores(nif,estatura) Values('7777J', 1.97); INSERT INTO Jugadores(nif,estatura) Values('8888J', 1.88); INSERT INTO Jugadores(nif,estatura) Values('9999J', 2.07); INSERT INTO Jugadores(nif,estatura) Values('0000J', 2.10); CREATE TABLE Canchas( nombre VARCHAR(100), PRIMARY KEY(nombre) ); INSERT INTO Canchas(nombre) Values('Caja Mágica'); INSERT INTO Canchas(nombre) Values('Palacio de Vistalegre'); INSERT INTO Canchas(nombre) Values('Palau Blaugrana'); INSERT INTO Canchas(nombre) Values('Pabellón Olímpico de Badalona'); INSERT INTO Canchas(nombre) Values('La Fonteta'); CREATE TABLE Direcciones( nombre VARCHAR(100), calle VARCHAR(50), numero INT, ciudad VARCHAR(50), ccaa VARCHAR(50), PRIMARY KEY(nombre), FOREIGN KEY(nombre) REFERENCES Canchas(nombre), FOREIGN KEY(ccaa) REFERENCES CCAA(nombre) ); INSERT INTO Direcciones(nombre,calle,numero,ciudad,ccaa) Values('Caja Mágica', 'Perales', '7', 'Madrid', 'C.A Madrid'); INSERT INTO Direcciones(nombre,calle,numero,ciudad,ccaa) Values('Palacio de Vistalegre', 'Goya', '4', 'Madrid', 'C.A Madrid'); INSERT INTO Direcciones(nombre,calle,numero,ciudad,ccaa) Values('Palau Blaugrana', 'Canaletas', '8', 'Barcelona', 'Barcelona'); INSERT INTO Direcciones(nombre,calle,numero,ciudad,ccaa) Values('Pabellón Olímpico de Badalona', 'Barceloneta', '1', 'Badalona', 'Barcelona'); INSERT INTO Direcciones(nombre,calle,numero,ciudad,ccaa) Values('La Fonteta', 'Garay', '11', 'Elche', 'C.A Valenciana'); CREATE TABLE Periodos_Entreno( f_ini DATETIME, f_fin DATETIME, PRIMARY KEY(f_ini,f_fin) ); INSERT INTO Periodos_Entreno(f_ini,f_fin) Values('2015-09-15','2016-04-16'); INSERT INTO Periodos_Entreno(f_ini,f_fin) Values('2015-09-15','2015-12-25'); CREATE TABLE Entrenamientos( eid INT, entrenador_nif VARCHAR(20), cancha VARCHAR(20), temporada_id INT, f_ini DATETIME, f_fin DATETIME, PRIMARY KEY(entrenador_nif,temporada_id), FOREIGN KEY(eid) REFERENCES Equipos(eid), FOREIGN KEY(entrenador_nif) REFERENCES Entrenadores(nif), FOREIGN KEY(cancha) REFERENCES Canchas(nombre), FOREIGN KEY(temporada_id) REFERENCES Temporadas(cid), FOREIGN KEY(f_ini,f_fin) REFERENCES Periodos_Entreno(f_ini,f_fin) ); INSERT INTO Entrenamientos(eid,entrenador_nif,cancha,temporada_id,f_ini,f_fin) Values(2, '3333E', 'Caja Mágica', 2, '2015-09-15','2016-04-16'); INSERT INTO Entrenamientos(eid,entrenador_nif,cancha,temporada_id,f_ini,f_fin) Values(1, '1111E', 'Caja Mágica', 1, '2015-09-15','2016-04-16');INSERT INTO Entrenamientos(eid,entrenador_nif,cancha,temporada_id,f_ini,f_fin) Values(2, '2222E', 'La Fonteta', 1, '2015-09-15','2016-04-16'); INSERT INTO Entrenamientos(eid,entrenador_nif,cancha,temporada_id,f_ini,f_fin) Values(3, '3333E', 'Caja Mágica', 1, '2015-09-15','2016-04-16'); CREATE TABLE Jugador_Equipo( eid INT, nif VARCHAR(20), tid INT, PRIMARY KEY(nif,tid), FOREIGN KEY(eid) REFERENCES Equipos(eid), FOREIGN KEY(nif) REFERENCES Jugadores(nif), FOREIGN KEY(tid) REFERENCES Temporadas(cid) ); INSERT INTO Jugador_Equipo(eid,nif,tid) Values(3, '1111J', 1); INSERT INTO Jugador_Equipo(eid,nif,tid) Values(3, '2222J', 1); INSERT INTO Jugador_Equipo(eid,nif,tid) Values(3, '3333J', 1); INSERT INTO Jugador_Equipo(eid,nif,tid) Values(3, '4444J', 1); INSERT INTO Jugador_Equipo(eid,nif,tid) Values(3, '5555J', 1); INSERT INTO Jugador_Equipo(eid,nif,tid) Values(1, '6666J', 1); INSERT INTO Jugador_Equipo(eid,nif,tid) Values(1, '7777J', 1); INSERT INTO Jugador_Equipo(eid,nif,tid) Values(1, '8888J', 1); INSERT INTO Jugador_Equipo(eid,nif,tid) Values(1, '9999J', 1); INSERT INTO Jugador_Equipo(eid,nif,tid) Values(1, '0000J', 1); CREATE TABLE Partidos( pid INT, eid1 INT, result_eq1 INT, eid2 INT, result_eq2 INT, cancha VARCHAR(20), f_ini DATETIME, f_fin DATETIME, PRIMARY KEY(pid) FOREIGN KEY(eid1) REFERENCES Equipos(eid), FOREIGN KEY(eid2) REFERENCES Equipos(eid), FOREIGN KEY(cancha) REFERENCES Canchas(nombre) ); INSERT INTO Partidos(pid, eid1, result_eq1, eid2, result_eq2, cancha, f_ini,f_fin) Values(1, 1, 90, 3, 85, 'Caja Mágica', '20:00:00', '21:45:00'); INSERT INTO Partidos(pid, eid1, result_eq1, eid2, result_eq2, cancha, f_ini,f_fin) Values(2, 2, 94, 4, 102, "Pabellón Olímpico de Badalona", '20:00:00', '21:45:00'); INSERT INTO Partidos(pid, eid1, result_eq1, eid2, result_eq2, cancha, f_ini,f_fin) Values(3, 4, 97, 1, 110, "Palacio de Vistalegre", '20:00:00', '21:45:00'); INSERT INTO Partidos(pid, eid1, result_eq1, eid2, result_eq2, cancha, f_ini,f_fin) Values(4, 1, 90, 2, 87, 'Caja Mágica', '20:00:00', '21:45:00'); CREATE TABLE Cuarto1( cid INT, result_eq1 INT, result_eq2 INT, f_ini DATETIME, f_fin DATETIME, PRIMARY KEY(cid), FOREIGN KEY(cid) REFERENCES Partidos(pid) ); INSERT INTO Cuarto1(cid,result_eq1,result_eq2,f_ini,f_fin) Values(1, 20, 22, '20:00:00', '20:15:00'); INSERT INTO Cuarto1(cid,result_eq1,result_eq2,f_ini,f_fin) Values(2, 24, 30, '20:00:00', '20:15:00'); CREATE TABLE Cuarto2( cid INT, result_eq1 INT, result_eq2 INT, f_ini DATETIME, f_fin DATETIME, PRIMARY KEY(cid), FOREIGN KEY(cid) REFERENCES Partidos(pid) ); CREATE TABLE Cuarto3( cid INT, result_eq1 INT, result_eq2 INT, f_ini DATETIME, f_fin DATETIME, PRIMARY KEY(cid), FOREIGN KEY(cid) REFERENCES Partidos(pid) ); CREATE TABLE Cuarto4( cid INT, result_eq1 INT, result_eq2 INT, f_ini DATETIME, f_fin DATETIME, PRIMARY KEY(cid), FOREIGN KEY(cid) REFERENCES Partidos(pid) ); CREATE TABLE Periodos_Jug( hora_sal DATETIME, hora_ent DATETIME, hora_banq DATETIME, PRIMARY KEY(hora_sal, hora_ent, hora_banq) ); INSERT INTO Periodos_jug(hora_sal,hora_ent,hora_banq) Values('20:00:00', '20:08:00', '20:10:00'); CREATE TABLE Partidos_Jug( pid INT, nif VARCHAR(20), posicion VARCHAR(20), hora_sal DATETIME, hora_ent DATETIME, hora_banq DATETIME, PRIMARY KEY(pid, nif, posicion, hora_sal, hora_ent, hora_banq), FOREIGN KEY(nif) REFERENCES Jugadores(nif), FOREIGN KEY(hora_sal, hora_ent, hora_banq) REFERENCES Periodos_jug(hora_sal, hora_ent, hora_banq) ); INSERT INTO Partidos_Jug(pid,nif,posicion,hora_sal,hora_ent,hora_banq) Values(1, '1111J', 'Pivot', '20:00:00', '20:08:00', '20:10:00'); INSERT INTO Partidos_Jug(pid,nif,posicion,hora_sal,hora_ent,hora_banq) Values(1, '2222J', 'Base', '20:00:00', '20:08:00', '20:10:00'); CREATE TABLE Peso( nif VARCHAR(20), pid INT, peso FLOAT, PRIMARY KEY(nif,pid), FOREIGN KEY(nif) REFERENCES Jugadores(nif), FOREIGN KEY(pid) REFERENCES Partidos(pid) ); INSERT INTO PESO(nif,pid,peso) Values('1111J',1,90); INSERT INTO PESO(nif,pid,peso) Values('2222J',1,100); CREATE TABLE Jugadas( jid INT, hora_ini DATETIME, hora_fin DATETIME, PRIMARY KEY(jid) ); CREATE TABLE Jugadas_Part( pid INT, jid INT, PRIMARY KEY(pid,jid), FOREIGN KEY(pid) REFERENCES Partidos(pid), FOREIGN KEY(jid) REFERENCES Jugadas(jid) ); CREATE TABLE Records( nif VARCHAR(20), pid INT, jid INT, PRIMARY KEY(nif,pid,jid), FOREIGN KEY(nif) REFERENCES Jugadores(nif), FOREIGN KEY(pid) REFERENCES Partidos(pid), FOREIGN KEY(jid) REFERENCES Jugadas(jid) ); CREATE TABLE Defensas( jid INT, nif_defendido VARCHAR(20), nif_defendiendo VARCHAR(20), PRIMARY KEY(jid), FOREIGN KEY(jid) REFERENCES Jugadas(jid), FOREIGN KEY(nif_defendido) REFERENCES Jugadores(nif), FOREIGN KEY(nif_defendiendo) REFERENCES Jugadores(nif) ); CREATE TABLE Posesion( jid INT, nif_ini VARCHAR(20), posicion FLOAT, PRIMARY KEY(jid), FOREIGN KEY(jid) REFERENCES Jugadas(jid), FOREIGN KEY(nif_ini) REFERENCES Jugadores(nif) ); CREATE TABLE Tiro( jid INT, pto INT, fuera INT, rebote INT, PRIMARY KEY(jid), FOREIGN KEY(jid) REFERENCES Jugadas(jid) ); CREATE TABLE Pase( jid INT, fuera INT, nif_comp VARCHAR(20), nif_rival VARCHAR(20), PRIMARY KEY(jid), FOREIGN KEY(jid) REFERENCES Jugadas(jid) ); CREATE TABLE Robo( jid INT, nif_aquien VARCHAR(20), PRIMARY KEY(jid), FOREIGN KEY(jid) REFERENCES Jugadas(jid) ); CREATE TABLE Rebote( jid INT, PRIMARY KEY(jid), FOREIGN KEY(jid) REFERENCES Jugadas(jid) ); CREATE TABLE Intercepcion( jid INT, PRIMARY KEY(jid), FOREIGN KEY(jid) REFERENCES Jugadas(jid) ); SELECT * FROM PESO; SELECT * FROM Partidos_Jug;
insert into perbooks (name,image,user_id) values ($1,$2,$3)
# Q1 #réponse à la question 1 desc facts; desc dates; desc authors; desc collaborations; desc publications; desc squads; desc supports; #explain plan for select * from facts; #Q2 SELECT count(*) FROM facts; SELECT count(*) FROM dates; SELECT count(*) FROM authors; SELECT count(*) FROM collaborations; SELECT count(*) FROM publications; SELECT count(*) FROM squads; SELECT count(*) FROM supports; #Visualisation du plan d'exécution d'une requête #Q1 #R1 explain plan for select title from publications where nb_pages > 20 ; select * from table(dbms_xplan.display); #R2 explain plan for select title from publications natural join facts where date_id = 2008 ; select * from table(dbms_xplan.display); #R3 explain plan for select title from publications where publication_id in (select publication_id from facts where date_id = 2008); select * from table(dbms_xplan.display); #R4 explain plan for select title from publications natural join facts natural join collaborations natural join authors where last_name= 'Rosenthal' ; select * from table(dbms_xplan.display); #Q2 #R1 explain plan for select title from publications1 where nb_pages > 20 ; select * from table(dbms_xplan.display); #R2 explain plan for select title from publications1 natural join facts where date_id = 2008 ; select * from table(dbms_xplan.display); #R3 explain plan for select title from publications1 where publication_id in (select publication_id from facts where date_id = 2008); select * from table(dbms_xplan.display); #R4 explain plan for select title from publications1 natural join facts natural join collaborations natural join authors where last_name= 'Rosenthal' ; select * from table(dbms_xplan.display); #Les index #Q1 SELECT index_name, table_name, column_name FROM all_ind_columns WHERE index_owner = 'ADMIN_M2';
CREATE DATABASE `PlatziBlog` DEFAULT CHARACTER SET UTF8; USE `PlatziBlog`; CREATE TABLE `Categorias` ( `Id` INT NOT NULL AUTO_INCREMENT ,`Nombre` NVARCHAR(30) NOT NULL ,PRIMARY KEY (`Id`) ); USE `PlatziBlog`; CREATE TABLE `Etiquetas` ( `Id` INT NOT NULL AUTO_INCREMENT ,`Nombre` NVARCHAR(30) NOT NULL ,PRIMARY KEY (`Id`) ); USE `PlatziBlog`; CREATE TABLE `Usuarios` ( `Id` INT NOT NULL AUTO_INCREMENT ,`Login` NVARCHAR(30) NOT NULL ,`Password` NVARCHAR(32) NOT NULL ,`NickName` NVARCHAR(40) NOT NULL ,`Email` NVARCHAR(40) NOT NULL ,PRIMARY KEY (`Id`) ,UNIQUE INDEX `Email_UNIQUE` (`Email` ASC) ); USE `PlatziBlog`; CREATE TABLE `Posts` ( `Id` INT NOT NULL AUTO_INCREMENT ,`Titulo` NVARCHAR(150) NOT NULL ,`FechaPublicacion` TIMESTAMP NULL ,`Contenido` TEXT NOT NULL ,`Status` NCHAR(8) NULL DEFAULT 'activo' ,`UsuarioId` INT NOT NULL ,`CategoriaId` INT NOT NULL ,PRIMARY KEY (`Id`) ); USE `PlatziBlog`; ALTER TABLE `Posts` ADD INDEX `PostsUsuariosIdx` (`UsuarioId` ASC); USE `PlatziBlog`; ALTER TABLE `Posts` ADD CONSTRAINT `PostsUsuarios` FOREIGN KEY (`UsuarioId`) REFERENCES `PlatziBlog`.`Usuarios` (`Id`) ON DELETE RESTRICT ON UPDATE CASCADE; USE `PlatziBlog`; ALTER TABLE `Posts` ADD INDEX `PostsCategoriasIdx` (`CategoriaId` ASC); USE `PlatziBlog`; ALTER TABLE `Posts` ADD CONSTRAINT `PostsCategorias` FOREIGN KEY (`CategoriaId`) REFERENCES `PlatziBlog`.`Categorias` (`Id`) ON DELETE NO ACTION ON UPDATE NO ACTION; USE `PlatziBlog`; CREATE TABLE `Comentarios` ( `Id` INT NOT NULL AUTO_INCREMENT ,`CuerpoComentario` TEXT NOT NULL ,`UsuarioId` INT NOT NULL ,`PostId` INT NOT NULL ,PRIMARY KEY (`Id`) ); USE `PlatziBlog`; ALTER TABLE `Comentarios` ADD INDEX `ComentariosUsuariosIdx` (`UsuarioId` ASC); USE `PlatziBlog`; ALTER TABLE `Comentarios` ADD CONSTRAINT `ComentariosUsuarios` FOREIGN KEY (`UsuarioId`) REFERENCES `PlatziBlog`.`Usuarios` (`Id`) ON DELETE RESTRICT ON UPDATE CASCADE; USE `PlatziBlog`; ALTER TABLE `Comentarios` ADD INDEX `PostsComentariosIdx` (`PostId` ASC); USE `PlatziBlog`; ALTER TABLE `Comentarios` ADD CONSTRAINT `ComentariosPosts` FOREIGN KEY (`PostId`) REFERENCES `PlatziBlog`.`Posts` (`Id`) ON DELETE CASCADE ON UPDATE CASCADE; USE `PlatziBlog`; CREATE TABLE `PostsEtiquetas` ( `Id` INT NOT NULL AUTO_INCREMENT ,`PostId` INT NOT NULL ,`EtiquetaId` INT NOT NULL ,PRIMARY KEY (`Id`) ); USE `PlatziBlog`; ALTER TABLE `PostsEtiquetas` ADD INDEX `PostsEtiquetas_PostIdx` (`PostId` ASC); USE `PlatziBlog`; ALTER TABLE `PostsEtiquetas` ADD CONSTRAINT `PostsEtiquetasPost` FOREIGN KEY (`PostId`) REFERENCES `PlatziBlog`.`Posts` (`Id`) ON DELETE CASCADE ON UPDATE CASCADE; USE `PlatziBlog`; ALTER TABLE `PostsEtiquetas` ADD INDEX `PostsEtiquetas_EtiquetaIdx` (`EtiquetaId` ASC); USE `PlatziBlog`; ALTER TABLE `PostsEtiquetas` ADD CONSTRAINT `PostsEtiquetasEtiqueta` FOREIGN KEY (`EtiquetaId`) REFERENCES `PlatziBlog`.`Etiquetas` (`Id`) ON DELETE CASCADE ON UPDATE CASCADE;
http://blog.sqlauthority.com/2015/04/18/sql-server-create-login-with-sid-way-to-synchronize-logins-on-secondary-server/ --run Primary USE AppDB SELECT name, sid FROM sys.sysusers WHERE name = 'AppUser' USE MASTER SELECT name, sid FROM sys.sql_logins WHERE name = 'AppUser' --run Secondary USE AppDB SELECT name, sid FROM sys.sysusers WHERE name = 'AppUser' USE MASTER SELECT name, sid FROM sys.sql_logins WHERE name = 'AppUser' --run Secondary DROP LOGIN AppUser --run Secondary--using SID you got from primary CREATE Login AppUser WITH password = 'password@123', SID = 0x59B662112A43D24585BFE2BF80D9BE19, CHECK_POLICY = OFF
# Write your MySQL query statement below update salary set sex = (CASE WHEN sex = 'm' THEN 'f' else 'm' END) # Success # Details # Runtime: 249 ms, faster than 87.77% of MySQL online submissions for Swap Salary. # Memory Usage: 0B, less than 100.00% of MySQL online submissions for Swap Salary.
# Realizar las siguientes consultas sobre la base de datos personal: USE personal; # 1. Obtener los datos completos de los empleados. SELECT * FROM empleados; # 2. Obtener los datos completos de los departamentos. SELECT * FROM departamentos; # 3. Listar el nombre de los departamentos. SELECT DISTINCT nombre_depto AS Departamentos FROM departamentos; # 4. Obtener el nombre y salario de todos los empleados. SELECT Nombre, sal_emp AS Salario FROM empleados; # 5. Listar todas las comisiones. SELECT comision_emp AS Comisiones FROM empleados; # 6. Obtener los datos de los empleados cuyo cargo sea 'Secretaria'. SELECT * FROM empleados WHERE cargo_emp = 'Secretaria'; # 7. Obtener los datos de los empleados vendedores, ordenados por nombre alfabéticamente SELECT * FROM empleados WHERE cargo_emp = 'Vendedor' ORDER BY nombre ASC; # 8. Obtener el nombre y cargo de todos los empleados, ordenados por salario de menor a mayor. SELECT Nombre, cargo_emp AS Cargo, sal_emp as Salario FROM empleados ORDER BY sal_emp ASC; # 9. Elabore un listado donde para cada fila, figure el alias 'Nombre' y 'Cargo' para las respectivas tablas de empleados. SELECT id_emp AS ID, Nombre, cargo_emp AS Cargo FROM empleados; # 10. Listar los salarios y comisiones de los empleados del departamento 2000, ordenado por comisión de menor a mayor. SELECT sal_emp AS Salario, comision_emp AS Comision FROM empleados WHERE id_depto = 2000 ORDER BY comision_emp ASC; # 11. Obtener el valor total a pagar que resulta de sumar el salario y la comisión de los empleados del departamento 3000 una bonificación de 500, en orden alfabético del empleado SELECT *, sal_emp + comision_emp + 500 AS 'Valor Total' FROM empleados WHERE id_depto = 3000 ORDER BY nombre ASC; # 12. Muestra los empleados cuyo nombre empiece con la letra J SELECT * FROM empleados WHERE nombre LIKE 'J%'; # 13. Listar el salario, la comisión, el salario total (salario + comision) y nombre, de aquellos empleados que tienen comisión superior a 1000. SELECT sal_emp AS Salario, comision_emp AS Comision, sal_emp + comision_emp AS 'Salario Total', Nombre FROM empleados WHERE comision_emp > 1000; # 14. Obtener un listado similar al anterior, pero de aquellos empleados que NO tienen comisión. SELECT sal_emp AS Salario, comision_emp AS Comision, sal_emp + comision_emp AS 'Salario Total', Nombre FROM empleados WHERE comision_emp = 0; # 15. Obtener la lista de los empleados que ganan una comisión superior a su sueldo. SELECT Nombre, sal_emp AS Salario, comision_emp AS Comision, sal_emp + comision_emp AS 'Salario Total' FROM empleados WHERE comision_emp > sal_emp; # 16. Listar los empleados cuya comisión es menor o igual que el 30% de su sueldo. SELECT Nombre, sal_emp AS Salario, comision_emp AS Comision, sal_emp * 0.3 AS '30% del sueldo' FROM empleados WHERE comision_emp <= sal_emp*0.3; # 17. Hallar los empleados cuyo nombre no contiene la cadena MA. SELECT * FROM empleados WHERE nombre NOT LIKE '%MA%'; # 18. Obtener los nombres de los departamentos que sean "Ventas", "Investigación" y "Mantenimiento". SELECT * FROM departamentos WHERE nombre_depto LIKE "Ventas" OR nombre_depto LIKE "Investigación" OR nombre_depto LIKE "Mantenimiento"; # 19. Ahora obtener los nombres de los departamentos que no sean "Ventas" ni "Investigación" ni "Mantenimiento". SELECT * FROM departamentos WHERE nombre_depto NOT LIKE "Ventas" AND nombre_depto NOT LIKE "Investigación" AND nombre_depto NOT LIKE "Mantenimiento"; # 20. Mostrar el salario más alto de la empresa. SELECT * FROM Empleados WHERE sal_emp = (SELECT MAX(sal_emp) from empleados); # 21. Mostrar el nombre del último empleado de la lista por orden alfabetico SELECT * FROM empleados ORDER BY nombre DESC LIMIT 1; # 22. Hallar el salario más alto, el más bajo y la diferencia entre ellos SELECT MAX(sal_emp) AS "Salario Mas Alto", MIN(sal_emp) AS "Salario Mas Bajo", MAX(sal_emp)-MIN(sal_emp) AS Diferencia FROM Empleados; # 23. Hallar el salario promedio por departamento SELECT d.nombre_depto AS Departamento, AVG(e.sal_emp) AS "Salario Promedio" FROM empleados e JOIN departamentos d ON e.id_depto = d.id_depto GROUP BY d.nombre_depto; # 24. Hallar los departamentos que tienen más de tres empleados. Mostrar el número de empleados de esos departamentos. SELECT * FROM departamentos; SELECT COUNT(e.id_emp) AS "Cantidad Empleados", d.nombre_depto AS "Departamento" FROM empleados e JOIN departamentos d ON e.id_depto = d.id_depto GROUP BY d.nombre_depto HAVING COUNT(e.id_emp) > 3; /* VERSION USANDO HAVING SIN JOIN, SEPARANDO POR CODIGO DE DEPARTAMENTO Y NO POR NOMBRE*/ SELECT COUNT(id_emp) AS "Cantidad Empleados", id_depto AS "Codigo Departamento" FROM empleados GROUP BY id_depto HAVING COUNT(id_emp) > 3; # 25. Mostrar el código y nombre de cada Jefe, junto al número de empleados que dirige. Solo los que tengan más de dos empleados (2 incluido) SELECT * FROM EMPLEADOS; SELECT * FROM DEPARTAMENTOS; SELECT Substring(cod_jefe, -3) AS "Codigo Jefe", COUNT(Substring(cod_jefe, -3)) AS "Empleados a Cargo" from empleados Group by Substring(cod_jefe, -3); # 26. Hallar los departamentos que no tienen empleados # Agregue un area nueva para verificar que este correcto # INSERT INTO `departamentos` VALUES (4400, 'AREA NUEVA', 'LUNA', '38.700.144'); SELECT d.id_depto, nombre_depto FROM Departamentos d LEFT JOIN Empleados e ON d.id_depto = e.id_depto GROUP BY e.id_depto HAVING d.id_depto NOT IN (SELECT id_depto FROM empleados); # DELETE FROM departamentos WHERE id_depto = 4400; # 27. Mostrar la lista de los empleados cuyo salario es mayor o igual que el promedio de la empresa. Ordenarlo por departamento. /* por alguna razon hice esto, agarra la media de salario por departamento, ni idea era re tarde. SELECT e.id_depto as "ID DEPARTAMENTO", d.nombre_depto as "Nombre", AVG(sal_emp) AS "Promedio de salario" FROM empleados e JOIN Departamentos d ON e.id_depto = d.id_depto GROUP BY e.id_depto ORDER BY e.id_depto; */ SELECT id_emp, nombre, sal_emp salario FROM empleados WHERE sal_emp > (SELECT AVG(sal_emp) FROM empleados) GROUP BY id_depto; SELECT * FROM empleados; SELECT * FROM departamentos; # DROPEO LA TABLA POR LAS DUDAS DROP TABLE empleados; DROP TABLE departamentos; DROP DATABASE personal;
/* Создание процедуры расчета четвертого раунда */ CREATE OR ALTER PROCEDURE CALCULATE_FOURTH_ROUND ( TIRAGE_ID VARCHAR(32), SUBROUND_ID VARCHAR(32) ) AS BEGIN DELETE FROM WINNINGS WHERE LOTTERY_ID IN (SELECT LOTTERY_ID FROM LOTTERY WHERE TIRAGE_ID=:TIRAGE_ID AND ROUND_NUM=4 AND SUBROUND_ID=:SUBROUND_ID); INSERT INTO WINNINGS (LOTTERY_ID,TICKET_ID) SELECT T.LOTTERY_ID, T.TICKET_ID FROM (SELECT TICKET_ID, LOTTERY_ID, COUNT(*) AS AMOUNT FROM GET_TICKET_LINES(:TIRAGE_ID,4,:SUBROUND_ID) GROUP BY TICKET_ID, LOTTERY_ID) T WHERE T.AMOUNT>=6 AND T.TICKET_ID NOT IN (SELECT TICKET_ID FROM WINNINGS WHERE LOTTERY_ID IN (SELECT LOTTERY_ID FROM LOTTERY WHERE TIRAGE_ID=:TIRAGE_ID AND ROUND_NUM=3 AND SUBROUND_ID IS NULL)) AND T.TICKET_ID NOT IN (SELECT TICKET_ID FROM WINNINGS WHERE LOTTERY_ID IN (SELECT LOTTERY_ID FROM LOTTERY WHERE TIRAGE_ID=:TIRAGE_ID AND ROUND_NUM=4 AND SUBROUND_ID<>:SUBROUND_ID)); END -- /* Фиксация изменений */ COMMIT
INSERT INTO city (id_abbreviation, city_abbreviation) SELECT i::int, 'C' || i::text FROM generate_series(1, 195) s(i); SELECT * FROM city; INSERT INTO address (id_street, street, house, phone, id_abbreviation) SELECT i::int, 'street ' || i::text, floor(random()*30)::text, floor(random()*(9999999999-1000000000)+1000000000)::text, floor(random()*(195-1)+1)::int FROM generate_series(1, 10000) s(i); INSERT INTO customer (id_customer, first_name, last_name, address) SELECT i::int, 'name ' || i::text, 'surname ' || i::text, floor(random()*(10000-1)+1)::int FROM generate_series(1, 50000) s(i); SELECT * FROM customer; INSERT INTO branch (id_branch, branch_name, address) SELECT i::int, 'br_name ' || i::text, floor(random()*(10000-1)+1)::int FROM generate_series(1, 30000) s(i); INSERT INTO car (license_plate, model, price, id_branch) SELECT left(md5(i::text), 8)::text, 'model ' || i::text, floor(random()*(10000-500)+500)::decimal, floor(random()*(30000-1)+1)::int FROM generate_series(1, 60000) s(i); INSERT INTO rent (id_rent, days, license_plate) SELECT i::int, floor(random()*(100-1)+1)::int, left(md5(floor(random()*(60000-1)+1)::text), 8)::text FROM generate_series(1, 60000) s(i); INSERT INTO rent_customer (id_rent, id_customer, date) SELECT i::int, floor(random()*(50000-1)+1)::int, random() * (timestamp '2021-12-31' - timestamp '2018-01-01')+timestamp '2018-01-01'::timestamp FROM generate_series(1, 60000) s(i);
-- Apr 22, 2010 12:27:46 PM CEST -- FR [2990358] - Extend Initial Tenant setup -- https://sourceforge.net/tracker/?func=detail&aid=2990358&group_id=176962&atid=879335 UPDATE AD_Process_Para SET SeqNo=230,Updated=TO_TIMESTAMP('2010-04-22 12:27:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=53407 ; -- Apr 22, 2010 12:27:52 PM CEST -- FR [2990358] - Extend Initial Tenant setup -- https://sourceforge.net/tracker/?func=detail&aid=2990358&group_id=176962&atid=879335 UPDATE AD_Process_Para SET SeqNo=220,Updated=TO_TIMESTAMP('2010-04-22 12:27:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=53352 ; -- Apr 22, 2010 12:27:57 PM CEST -- FR [2990358] - Extend Initial Tenant setup -- https://sourceforge.net/tracker/?func=detail&aid=2990358&group_id=176962&atid=879335 UPDATE AD_Process_Para SET SeqNo=210,Updated=TO_TIMESTAMP('2010-04-22 12:27:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=53351 ; -- Apr 22, 2010 12:28:03 PM CEST -- FR [2990358] - Extend Initial Tenant setup -- https://sourceforge.net/tracker/?func=detail&aid=2990358&group_id=176962&atid=879335 UPDATE AD_Process_Para SET SeqNo=200,Updated=TO_TIMESTAMP('2010-04-22 12:28:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=53350 ; -- Apr 22, 2010 12:28:07 PM CEST -- FR [2990358] - Extend Initial Tenant setup -- https://sourceforge.net/tracker/?func=detail&aid=2990358&group_id=176962&atid=879335 UPDATE AD_Process_Para SET SeqNo=190,Updated=TO_TIMESTAMP('2010-04-22 12:28:07','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=53349 ; -- Apr 22, 2010 12:28:11 PM CEST -- FR [2990358] - Extend Initial Tenant setup -- https://sourceforge.net/tracker/?func=detail&aid=2990358&group_id=176962&atid=879335 UPDATE AD_Process_Para SET SeqNo=180,Updated=TO_TIMESTAMP('2010-04-22 12:28:11','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=53296 ; -- Apr 22, 2010 12:28:16 PM CEST -- FR [2990358] - Extend Initial Tenant setup -- https://sourceforge.net/tracker/?func=detail&aid=2990358&group_id=176962&atid=879335 UPDATE AD_Process_Para SET SeqNo=170,Updated=TO_TIMESTAMP('2010-04-22 12:28:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=53295 ; -- Apr 22, 2010 12:28:19 PM CEST -- FR [2990358] - Extend Initial Tenant setup -- https://sourceforge.net/tracker/?func=detail&aid=2990358&group_id=176962&atid=879335 UPDATE AD_Process_Para SET SeqNo=160,Updated=TO_TIMESTAMP('2010-04-22 12:28:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=53294 ; -- Apr 22, 2010 12:28:24 PM CEST -- FR [2990358] - Extend Initial Tenant setup -- https://sourceforge.net/tracker/?func=detail&aid=2990358&group_id=176962&atid=879335 UPDATE AD_Process_Para SET SeqNo=150,Updated=TO_TIMESTAMP('2010-04-22 12:28:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=53293 ; -- Apr 22, 2010 12:28:27 PM CEST -- FR [2990358] - Extend Initial Tenant setup -- https://sourceforge.net/tracker/?func=detail&aid=2990358&group_id=176962&atid=879335 UPDATE AD_Process_Para SET SeqNo=140,Updated=TO_TIMESTAMP('2010-04-22 12:28:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=53292 ; -- Apr 22, 2010 12:28:29 PM CEST -- FR [2990358] - Extend Initial Tenant setup -- https://sourceforge.net/tracker/?func=detail&aid=2990358&group_id=176962&atid=879335 UPDATE AD_Process_Para SET SeqNo=130,Updated=TO_TIMESTAMP('2010-04-22 12:28:29','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=53291 ; -- Apr 22, 2010 12:28:32 PM CEST -- FR [2990358] - Extend Initial Tenant setup -- https://sourceforge.net/tracker/?func=detail&aid=2990358&group_id=176962&atid=879335 UPDATE AD_Process_Para SET SeqNo=120,Updated=TO_TIMESTAMP('2010-04-22 12:28:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=53353 ; -- Apr 22, 2010 12:28:35 PM CEST -- FR [2990358] - Extend Initial Tenant setup -- https://sourceforge.net/tracker/?func=detail&aid=2990358&group_id=176962&atid=879335 UPDATE AD_Process_Para SET SeqNo=110,Updated=TO_TIMESTAMP('2010-04-22 12:28:35','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=53348 ; -- Apr 22, 2010 12:28:37 PM CEST -- FR [2990358] - Extend Initial Tenant setup -- https://sourceforge.net/tracker/?func=detail&aid=2990358&group_id=176962&atid=879335 UPDATE AD_Process_Para SET SeqNo=100,Updated=TO_TIMESTAMP('2010-04-22 12:28:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=53290 ; -- Apr 22, 2010 12:28:40 PM CEST -- FR [2990358] - Extend Initial Tenant setup -- https://sourceforge.net/tracker/?func=detail&aid=2990358&group_id=176962&atid=879335 UPDATE AD_Process_Para SET SeqNo=90,Updated=TO_TIMESTAMP('2010-04-22 12:28:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=53289 ; -- Apr 22, 2010 12:28:43 PM CEST -- FR [2990358] - Extend Initial Tenant setup -- https://sourceforge.net/tracker/?func=detail&aid=2990358&group_id=176962&atid=879335 UPDATE AD_Process_Para SET SeqNo=80,Updated=TO_TIMESTAMP('2010-04-22 12:28:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=53288 ; -- Apr 22, 2010 12:28:46 PM CEST -- FR [2990358] - Extend Initial Tenant setup -- https://sourceforge.net/tracker/?func=detail&aid=2990358&group_id=176962&atid=879335 UPDATE AD_Process_Para SET SeqNo=70,Updated=TO_TIMESTAMP('2010-04-22 12:28:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=53287 ; -- Apr 22, 2010 12:28:49 PM CEST -- FR [2990358] - Extend Initial Tenant setup -- https://sourceforge.net/tracker/?func=detail&aid=2990358&group_id=176962&atid=879335 UPDATE AD_Process_Para SET SeqNo=60,Updated=TO_TIMESTAMP('2010-04-22 12:28:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=53286 ; -- Apr 22, 2010 12:28:52 PM CEST -- FR [2990358] - Extend Initial Tenant setup -- https://sourceforge.net/tracker/?func=detail&aid=2990358&group_id=176962&atid=879335 UPDATE AD_Process_Para SET SeqNo=50,Updated=TO_TIMESTAMP('2010-04-22 12:28:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=53285 ; -- Apr 22, 2010 12:28:54 PM CEST -- FR [2990358] - Extend Initial Tenant setup -- https://sourceforge.net/tracker/?func=detail&aid=2990358&group_id=176962&atid=879335 UPDATE AD_Process_Para SET SeqNo=40,Updated=TO_TIMESTAMP('2010-04-22 12:28:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=53284 ; -- Apr 22, 2010 12:28:57 PM CEST -- FR [2990358] - Extend Initial Tenant setup -- https://sourceforge.net/tracker/?func=detail&aid=2990358&group_id=176962&atid=879335 UPDATE AD_Process_Para SET SeqNo=30,Updated=TO_TIMESTAMP('2010-04-22 12:28:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=53283 ; -- Apr 22, 2010 12:28:59 PM CEST -- FR [2990358] - Extend Initial Tenant setup -- https://sourceforge.net/tracker/?func=detail&aid=2990358&group_id=176962&atid=879335 UPDATE AD_Process_Para SET SeqNo=20,Updated=TO_TIMESTAMP('2010-04-22 12:28:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=53347 ;
Create Function Fn_GetLeastLevelSKU(@Product Nvarchar(4000),@Level Int) Returns @Items Table (Product_Code Nvarchar(255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL) As Begin If @Level = 2 Begin If (Select Top 1 isnull(Flag,0) from tbl_merp_Configabstract Where ScreenCode = 'OCGDS') = 0 Begin Insert Into @Items (Product_Code) select Distinct I.Product_Code From items I , ItemCategories IC4 , ItemCategories IC3 , ItemCategories IC2 where IC4.categoryid = i.categoryid and IC4.ParentId = IC3.categoryid and IC3.ParentId = IC2.categoryid and IC2.Category_Name = @Product End Else Begin Insert Into @Items (Product_Code) Select Distinct SystemSKU from OCGItemMaster O,Items I Where O.Division = @Product And I.Product_Code = O.SystemSKU And O.Exclusion = 0 End End Else If @Level = 3 Begin If (Select Top 1 isnull(Flag,0) from tbl_merp_Configabstract Where ScreenCode = 'OCGDS') = 0 Begin Insert Into @Items (Product_Code) select Distinct I.Product_Code From items I , ItemCategories IC4 , ItemCategories IC3 , ItemCategories IC2 where IC4.categoryid = i.categoryid and IC4.ParentId = IC3.categoryid and IC3.ParentId = IC2.categoryid and IC3.Category_Name = @Product End Else Begin Insert Into @Items (Product_Code) Select Distinct SystemSKU from OCGItemMaster O,Items I Where O.SubCategory = @Product And I.Product_Code = O.SystemSKU And O.Exclusion = 0 End End Else If @Level = 4 Begin If (Select Top 1 isnull(Flag,0) from tbl_merp_Configabstract Where ScreenCode = 'OCGDS') = 0 Begin Insert Into @Items (Product_Code) select Distinct I.Product_Code From items I , ItemCategories IC4 , ItemCategories IC3 , ItemCategories IC2 where IC4.categoryid = i.categoryid and IC4.ParentId = IC3.categoryid and IC3.ParentId = IC2.categoryid and IC4.Category_Name = @Product End Else Begin Insert Into @Items (Product_Code) Select Distinct SystemSKU from OCGItemMaster O,Items I Where O.MarketSKU = @Product And I.Product_Code = O.SystemSKU And O.Exclusion = 0 End End Else If @Level = 5 Begin Insert Into @Items (Product_Code) select @Product End Return End
create or replace procedure proc_Grade is cursor c is select * from customer31213; cursor c2(id number) is select * from category31213 where cust_id = id; emp customer31213%rowtype; emp2 category31213%rowtype; BEGIN for emp in c loop open c2(emp.cust_id); fetch c2 into emp2; if c2%notfound then if emp.total_purchase>=10000 and emp.total_purchase<=20000 then insert into category31213 values (emp.cust_id,'aa','platinum'); elsif emp.total_purchase>=5000 and emp.total_purchase<=9999 then insert into category31213 values (emp.cust_id,'aa','gold'); elsif emp.total_purchase>=2000 and emp.total_purchase<=4999 then insert into category31213 values (emp.cust_id,'aa','silver'); else dbms_output.put_line(' cannot be categorized !!'); end if; else dbms_output.put_line(' the customer is already present!!'); end if; close c2; end loop; END; /
DROP TABLE IF EXISTS widget_widgets_feed CASCADE; -- CASCADE will drop all references to this table CREATE TABLE widget_widgets_feed ( creation timestamp WITH TIME ZONE NOT NULL DEFAULT now(), com_id bigint NOT NULL DEFAULT 0 REFERENCES system_communities (id) ON DELETE CASCADE ON UPDATE CASCADE, -- If community id gets deleted set to DEFAULT; if updated, cascade net_id bigint NOT NULL DEFAULT 0 REFERENCES network_networks (id) ON DELETE CASCADE ON UPDATE CASCADE, -- If community id gets deleted set to DEFAULT; if updated, cascade via_id bigint NOT NULL DEFAULT 0 REFERENCES profile_profiles (id) ON DELETE CASCADE ON UPDATE CASCADE, -- If profile id gets deleted set to DEFAULT; if updated, cascade widget_counter bigint NOT NULL CHECK (widget_counter >= 1), modified bigint NOT NULL DEFAULT CEIL(EXTRACT(EPOCH FROM now())), lifetime bigint NOT NULL DEFAULT 3600, data text CONSTRAINT valid_space CHECK ((com_id > 0 AND net_id = 0 AND via_id = 0) OR (com_id = 0 AND net_id > 0 AND via_id = 0) OR (com_id = 0 AND net_id = 0 AND via_id > 0)) ); -- Index on ID is automatically created by PRIMARY KEY CREATE UNIQUE INDEX widget_widgets_feed_com_net_via_counter_x ON widget_widgets_feed (com_id, net_id, via_id, widget_counter); ALTER TABLE public.widget_widgets_feed OWNER TO vmdbuser; ----------------------------------------------------------------------------------------------------
CREATE TABLE TelefonoE ( Telefono varchar(20) not null ,Cedula int not null ,constraint pk_TelefonoE PRIMARY KEY(Telefono,Cedula) ,constraint fk_TelefonoE FOREIGN KEY(Cedula) references Empleado(Cedula) ); INSERT INTO TelefonoE(Telefono,Cedula) VALUES('02812345880',10000000); INSERT INTO TelefonoE(Telefono,Cedula) VALUES('02812345870',11000000);
create table akarmi (ize int);