text
stringlengths
6
9.38M
# Write your MySQL query statement below # Convert duration to bins WITH bin_tbl AS (SELECT CASE WHEN duration/60 >=0 AND duration/60 < 5 THEN '[0-5>' WHEN duration/60 >= 5 AND duration/60 < 10 THEN '[5-10>' WHEN duration/60 >= 10 AND duration/60 < 15 THEN '[10-15>' ELSE '15 or more' END AS bin FROM Sessions), # Aggregate bins bin_cts AS (SELECT bin, COUNT(*) AS total FROM bin_tbl GROUP BY bin), # Create bin list; Otherwise, bins with 0 count will be missing in result bin_list AS (SELECT '[0-5>' AS bin UNION SELECT '[5-10>' UNION SELECT '[10-15>' UNION SELECT '15 or more') # Count the number of sessions on it SELECT bin_list.bin, IFNULL(total, 0) AS total FROM bin_list LEFT JOIN bin_cts ON bin_list.bin = bin_cts.bin
SELECT * FROM orders WHERE id = $1 AND status = true;
create table stadium( stacode int not null auto_increment PRIMARY KEY, staname varchar(50) not null, staaddr1 varchar(50) not null, staaddr2 varchar(50) not null, staaddr3 varchar(50) not null, stapay int not null, stainfo varchar(2000) not null, stadate datetime not null, staclose int not null, staopen int not null, id varchar(20) not null, stalevel CHAR(1) DEFAULT 'Y' NOT NULL, poster1 VARCHAR(255) DEFAULT 'poster.jpg' NOT NULL, poster2 VARCHAR(255), poster3 VARCHAR(255), poster4 VARCHAR(255), poster5 VARCHAR(255) ); SELECT count(stacode) as count FROM stadium where id='soso' alter table stadium add id varchar(20) drop table stadium insert into stadium(stacode,staname,staaddr1,staaddr2,stapay,stainfo,stadate,staclose,staopen,stapasswd,stalevel,poster) value((SELECT IFNULL(MAX(stacode),0)+1 FROM stadium AS TB),'putfoot','서울특별시','종로구','35000','종각구장 입니다.',now(),'23','6','1234','Y','123.jsp') insert into stadium(stacode,staname,staaddr1,staaddr2,stapay,stainfo,stadate,staclose,staopen,stapasswd,stalevel,poster) value(1,'솔데스크','서울특별시','종로구','35000','종각구장 입니다.',now(),'23','6','1234','Y','123.jsp') UPDATE stadium SET stalevel='N' WHERE stacode='1' AND stalevel='Y'; drop table stadium; select * from stadium; INSERT INTO stadium(stacode, staname, staaddr,stapay,stainfo,stadate,staclose,staopen,stapasswd,stalevel,poster) VALUE((SELECT IFNULL(MAX(stacode),0)+1 FROM stadium AS TB),'월드컵경기장','마포구','5000','내용',now(),'10','24','1234','Y','123.jpg'); INSERT INTO stadium(stacode, staname, staaddr,stapay,stainfo,stadate,staclose,staopen,stapasswd) VALUE((SELECT IFNULL(MAX(stacode),0)+1 FROM stadium AS TB),?,?,?,?,now(),?,?,?); update stadium set stalevel='Y' where stacode='8' select poster from stadium drop table stadium2 SELECT staname, staaddr,stapay,stainfo,stadate,staclose,staopen FROM stadium ORDER BY stacode DESC; SELECT stacode, staname, staaddr,stapay,statel,stainfo,stadate,staclose,staopen FROM(SELECT stacode, staname, staaddr,stapay,statel,stainfo,stadate,staclose,staopen, @ROWNUM := @ROWNUM+1 as ROW FROM (SELECT stacode, staname, staaddr,stapay,statel,stainfo,stadate,staclose,staopen FROM stadium )A, (SELECT @ROWNUM := 0) B)C WHERE C.ROW>=1 AND C.ROW<=5
CREATE TABLE public.da_referal_type ( referal_type_cd character varying(32) NOT NULL, referal_type_name character varying(32), referal_type_desc character varying(32), record_status character(1), loc_cd character varying, org_cd character varying(8) NOT NULL, grp_cd character varying(8) NOT NULL, dw_facility_cd character varying(16), dw_last_updated_dt timestamp without time zone, dw_job_run_no numeric, dw_row_id character varying(128) );
CREATE TABLE course_subscriptions( id UUID PRIMARY KEY, user_id UUID NOT NULL REFERENCES users(id), course_id UUID NOT NULL REFERENCES courses(id), startTime TIMESTAMP NOT NULL, endTime TIMESTAMP, progress NUMERIC(4, 4) NOT NULL )
/*********************************** File HospitalizationCohorts.sql ***********************************/ IF OBJECT_ID('@resultsDatabaseSchema.rehospitalization', 'U') IS NOT NULL DROP TABLE @resultsDatabaseSchema.rehospitalization; SELECT visit_occurrence.person_id AS subject_id, MIN(visit_start_date) AS cohort_start_date, DATEADD(DAY, @post_time, MIN(visit_start_date)) AS cohort_end_date, 1 AS cohort_definition_id INTO @resultsDatabaseSchema.rehospitalization FROM @cdmDatabaseSchema.visit_occurrence INNER JOIN @cdmDatabaseSchema.observation_period ON visit_occurrence.person_id = observation_period.person_id INNER JOIN @cdmDatabaseSchema.condition_occurrence ON condition_occurrence.person_id = visit_occurrence.person_id WHERE visit_concept_id IN (9201, 9203) AND DATEDIFF(DAY, observation_period_start_date, visit_start_date) > @pre_time AND visit_start_date > observation_period_start_date AND DATEDIFF(DAY, visit_start_date, observation_period_end_date) > @post_time AND visit_start_date < observation_period_end_date AND DATEDIFF(DAY, condition_start_date, visit_start_date) > @pre_time AND condition_start_date <= visit_start_date AND condition_concept_id IN ( SELECT descendant_concept_id FROM @cdmDatabaseSchema.concept_ancestor WHERE ancestor_concept_id = 201826) /* Type 2 DM */ GROUP BY visit_occurrence.person_id; INSERT INTO @resultsDatabaseSchema.rehospitalization SELECT visit_occurrence.person_id AS subject_id, visit_start_date AS cohort_start_date, visit_end_date AS cohort_end_date, 2 AS cohort_definition_id FROM @resultsDatabaseSchema.rehospitalization INNER JOIN @cdmDatabaseSchema.visit_occurrence ON visit_occurrence.person_id = rehospitalization.subject_id WHERE visit_concept_id IN (9201, 9203) AND visit_start_date > cohort_start_date AND visit_start_date <= cohort_end_date AND cohort_definition_id = 1;
set serverout on whenever sqlerror exit; select to_number('Warning:Do not exec this script in the current user') from (select user name from dual) where upper(name) in ( 'SCOTT', 'ORACLE_OCM', 'XS$NULL', 'MDDATA', 'DIP', 'APEX_PUBLIC_USER', 'SPATIAL_CSW_ADMIN_USR', 'SPATIAL_WFS_ADMIN_USR', 'DBSNMP', 'SYSMAN', 'FLOWS_FILES', 'MDSYS', 'ORDSYS', 'EXFSYS', 'WMSYS', 'APPQOSSYS', 'APEX_030200', 'OWBSYS_AUDIT', 'ORDDATA', 'CTXSYS', 'ANONYMOUS', 'XDB', 'ORDPLUGINS', 'OWBSYS', 'SI_INFORMTN_SCHEMA', 'OLAPSYS', 'MGMT_VIEW', 'SYS', 'SYSTEM', 'OUTLN'); @@.\SP_GetCodeVersion.prc @@.\SP_GetFMDBUpgradeVersion.prc declare v_Version varchar2(100) := ''; p_version_id varchar2(100) := ''; p_ncount number := 0; n number; v_values varchar2(100) := ''; begin v_values := ''; SP_GetFMDBUpgradeVersion(v_Version); dbms_output.put_line('=========================================================================='); dbms_output.put_line(' FM database Server version number is:'||v_Version); dbms_output.put_line('=========================================================================='); select count(1) into p_ncount from user_tables t where t.TABLE_NAME = 'FM_VERSION'; if p_ncount = 0 then execute immediate ' create table FM_VERSION(version_id varchar2(100))'; v_values := '0'; execute immediate ' insert into FM_VERSION values (''' || v_values || ''')'; commit; end if; begin execute immediate 'select version_id from FM_VERSION t' into p_version_id; exception when others then null; end; if p_version_id <> '0' and p_version_id = v_Version then --The local database and server version is consistent, Without upgrade! dbms_output.put_line('=========================================================================='); dbms_output.put_line(' The local database version number is:'||v_Version); dbms_output.put_line('=========================================================================='); dbms_output.put_line('=========================================================================='); dbms_output.put_line(' The local database and server version is consistent, Without upgrade! '); dbms_output.put_line('=========================================================================='); select t.* into n from dual t where t.dummy <> 'X'; elsif p_version_id <> '0' and p_version_id <> v_Version then null; else null; end if; end; / @@.\FMOracleServer_Installation_NoCheckVersion.sql
-- MySQL Script generated by MySQL Workbench -- Thu Mar 22 15:37:43 2018 -- Model: New Model Version: 1.0 -- MySQL Workbench Forward Engineering SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0; SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0; SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES'; -- ----------------------------------------------------- -- Schema instituto -- ----------------------------------------------------- DROP SCHEMA IF EXISTS `instituto` ; -- ----------------------------------------------------- -- Schema instituto -- ----------------------------------------------------- CREATE SCHEMA IF NOT EXISTS `instituto` DEFAULT CHARACTER SET utf8 ; USE `instituto` ; -- ----------------------------------------------------- -- Table `instituto`.`tutor` -- ----------------------------------------------------- DROP TABLE IF EXISTS `instituto`.`tutor` ; CREATE TABLE IF NOT EXISTS `instituto`.`tutor` ( `dni` INT NOT NULL, `nombre` VARCHAR(45) NOT NULL, `apellido` VARCHAR(45) NOT NULL, `telefono` VARCHAR(45) NOT NULL, `email` VARCHAR(45) NULL, PRIMARY KEY (`dni`)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `instituto`.`alumno` -- ----------------------------------------------------- DROP TABLE IF EXISTS `instituto`.`alumno` ; CREATE TABLE IF NOT EXISTS `instituto`.`alumno` ( `apellido` VARCHAR(45) NOT NULL, `nombre` VARCHAR(45) NOT NULL, `dni` INT NOT NULL, `fechaNacimiento` DATE NOT NULL, `direccion` VARCHAR(45) NOT NULL, `email` VARCHAR(45) NULL, `lugarNacimiento` VARCHAR(45) NULL, `tutor_dni` INT NULL, PRIMARY KEY (`dni`), UNIQUE INDEX `dni_UNIQUE` (`dni` ASC), INDEX `fk_alumno_tutor1_idx` (`tutor_dni` ASC), CONSTRAINT `fk_alumno_tutor1` FOREIGN KEY (`tutor_dni`) REFERENCES `instituto`.`tutor` (`dni`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `instituto`.`curso` -- ----------------------------------------------------- DROP TABLE IF EXISTS `instituto`.`curso` ; CREATE TABLE IF NOT EXISTS `instituto`.`curso` ( `idcurso` INT NOT NULL AUTO_INCREMENT, `nombre` VARCHAR(45) NOT NULL, `anio` INT NOT NULL, PRIMARY KEY (`idcurso`), UNIQUE INDEX `idcurso_UNIQUE` (`idcurso` ASC)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `instituto`.`alumnoxcurso` -- ----------------------------------------------------- DROP TABLE IF EXISTS `instituto`.`alumnoxcurso` ; CREATE TABLE IF NOT EXISTS `instituto`.`alumnoxcurso` ( `alumno_dni` INT NOT NULL, `curso_idcurso` INT NOT NULL, `anio` INT NOT NULL, PRIMARY KEY (`alumno_dni`, `curso_idcurso`), INDEX `fk_alumno_has_curso_curso1_idx` (`curso_idcurso` ASC), INDEX `fk_alumno_has_curso_alumno_idx` (`alumno_dni` ASC), CONSTRAINT `fk_alumno_has_curso_alumno` FOREIGN KEY (`alumno_dni`) REFERENCES `instituto`.`alumno` (`dni`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_alumno_has_curso_curso1` FOREIGN KEY (`curso_idcurso`) REFERENCES `instituto`.`curso` (`idcurso`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `instituto`.`asistencia` -- ----------------------------------------------------- DROP TABLE IF EXISTS `instituto`.`asistencia` ; CREATE TABLE IF NOT EXISTS `instituto`.`asistencia` ( `idasistencia` INT NOT NULL AUTO_INCREMENT, `fecha` DATE NOT NULL, `tipo` ENUM('clase', 'edFisica', 'clase+edFisica') NOT NULL, `valor` ENUM('1', '1/2') NOT NULL, `alumnoxcurso_alumno_dni` INT NOT NULL, `alumnoxcurso_curso_idcurso` INT NOT NULL, `justificada` TINYINT(2) NOT NULL, PRIMARY KEY (`idasistencia`, `alumnoxcurso_alumno_dni`, `alumnoxcurso_curso_idcurso`), UNIQUE INDEX `idasistencia_UNIQUE` (`idasistencia` ASC), INDEX `fk_asistencia_alumnoxcurso1_idx` (`alumnoxcurso_alumno_dni` ASC, `alumnoxcurso_curso_idcurso` ASC), CONSTRAINT `fk_asistencia_alumnoxcurso1` FOREIGN KEY (`alumnoxcurso_alumno_dni` , `alumnoxcurso_curso_idcurso`) REFERENCES `instituto`.`alumnoxcurso` (`alumno_dni` , `curso_idcurso`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `instituto`.`preceptor` -- ----------------------------------------------------- DROP TABLE IF EXISTS `instituto`.`preceptor` ; CREATE TABLE IF NOT EXISTS `instituto`.`preceptor` ( `dni` INT NOT NULL, `nombre` VARCHAR(45) NOT NULL, `apellido` VARCHAR(45) NOT NULL, PRIMARY KEY (`dni`)) ENGINE = InnoDB; SET SQL_MODE=@OLD_SQL_MODE; SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
DROP DATABASE bookbiz; CREATE DATABASE bookbiz; CREATE TABLE publishers ( pub_id INT AUTO_INCREMENT, pub_name VARCHAR(80) NOT NULL, city VARCHAR(45) NULL, state VARCHAR(45) NULL, CONSTRAINT pk_publishers PRIMARY KEY (pub_id) ); CREATE TABLE books ( book_id INT AUTO_INCREMENT, title VARCHAR(80) NOT NULL, CONSTRAINT pk_book PRIMARY KEY (book_id) ); CREATE TABLE editions ( isbn CHAR(13), book_id INT, ed INT NULL, pub_id INT, num_pages INT NULL, circulation BIGINT(15) NUll, date_stamp DATE CONSTRAINT pk_editions PRIMARY KEY (isbn), CONSTRAINT pk_editions_unique UNIQUE (isbn), CONSTRAINT fk_editions_book FOREIGN KEY (book_id) REFERENCES books (book_id) ON DELETE CASCADE, CONSTRAINT fk_editions_pub FOREIGN KEY (pub_id) REFERENCES publishers (pub_id) ON DELETE SET NULL ); CREATE TABLE authors ( au_id INT AUTO_INCREMENT, au_lname VARCHAR(40) NOT NULL, au_fname VARCHAR(20) NOT NULL, CONSTRAINT pk_authors PRIMARY KEY (au_id) ); CREATE TABLE books_authors ( book_id INT, au_id INT, CONSTRAINT fk_books_authors_bookb FOREIGN KEY (book_id) REFERENCES books (book_id) ON DELETE CASCADE, CONSTRAINT fk_books_authors_au FOREIGN KEY (au_id) REFERENCES authors (au_id) ON DELETE CASCADE );
-- phpMyAdmin SQL Dump -- version 4.2.11 -- http://www.phpmyadmin.net -- -- Host: 127.0.0.1 -- Generation Time: Oct 11, 2015 at 03:46 PM -- Server version: 5.6.21 -- PHP Version: 5.6.3 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: `mock-api` -- -- -------------------------------------------------------- -- -- Table structure for table `user` -- CREATE TABLE IF NOT EXISTS `user` ( `id` int(11) NOT NULL, `email` varchar(150) COLLATE utf8_bin NOT NULL, `password` varchar(150) COLLATE utf8_bin NOT NULL, `firstname` varchar(255) COLLATE utf8_bin NOT NULL, `lastname` varchar(255) COLLATE utf8_bin NOT NULL, `address` varchar(255) COLLATE utf8_bin NOT NULL, `phonenumber` int(11) NOT NULL ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -- -- Dumping data for table `user` -- INSERT INTO `user` (`id`, `email`, `password`, `firstname`, `lastname`, `address`, `phonenumber`) VALUES (1, 'chincub@gmail.com', 'Cc150735', 'Chinnaporn', 'Soonue', '200/57 Trang', 82), (2, 'chincub@gmail.com', 'Cc150735', 'Chinnaporn', 'Soonue', '200/57 Trang', 82); -- -- Indexes for dumped tables -- -- -- Indexes for table `user` -- ALTER TABLE `user` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `id` (`id`,`email`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `user` -- ALTER TABLE `user` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=3; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
CREATE SEQUENCE fos_user_id_seq INCREMENT BY 1 MINVALUE 1 START 1; CREATE TABLE fos_user (id INT NOT NULL, PRIMARY KEY(id)); ALTER TABLE fos_user ADD username VARCHAR(180) NOT NULL; ALTER TABLE fos_user ADD username_canonical VARCHAR(180) NOT NULL; ALTER TABLE fos_user ADD email VARCHAR(180) NOT NULL; ALTER TABLE fos_user ADD email_canonical VARCHAR(180) NOT NULL; ALTER TABLE fos_user ADD enabled BOOLEAN NOT NULL; ALTER TABLE fos_user ADD salt VARCHAR(255) DEFAULT NULL; ALTER TABLE fos_user ADD password VARCHAR(255) NOT NULL; ALTER TABLE fos_user ADD last_login TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL; ALTER TABLE fos_user ADD confirmation_token VARCHAR(180) DEFAULT NULL; ALTER TABLE fos_user ADD password_requested_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL; ALTER TABLE fos_user ADD roles TEXT NOT NULL; COMMENT ON COLUMN fos_user.roles IS '(DC2Type:array)'; CREATE UNIQUE INDEX UNIQ_957A647992FC23A8 ON fos_user (username_canonical); CREATE UNIQUE INDEX UNIQ_957A6479A0D96FBF ON fos_user (email_canonical); CREATE UNIQUE INDEX UNIQ_957A6479C05FB297 ON fos_user (confirmation_token);
DECLARE CURSOR C_WHO_UPDATE IS select max(mm.cd_interface) cd_interface, mm.nu_codigo, mm.ic_tipo from vnd.interface mm where mm.dh_execucao > current_date -2 and exists ( (select 1 from ( SELECT it.nu_codigo, count(1) FROM VND.INTERFACE it where it.dh_execucao > current_date -2 group by it.nu_codigo having count(1) > 1) ss where ss.nu_codigo = mm.nu_codigo)) group by mm.nu_codigo, mm.ic_tipo ; V_LIMIT NUMBER:=10000; TYPE elo_interface_r IS RECORD ( CD_INTERFACE VND.INTERFACE.CD_INTERFACE%TYPE, NU_CODIGO VND.INTERFACE.NU_CODIGO%TYPE, IC_TIPO VND.INTERFACE.IC_TIPO%TYPE ); TYPE elo_interface_t IS TABLE OF elo_interface_r INDEX BY PLS_INTEGER; tof_elo_interface elo_interface_t; tof_new_interface elo_interface_t; BEGIN BEGIN OPEN C_WHO_UPDATE; FETCH C_WHO_UPDATE BULK COLLECT INTO tof_elo_interface LIMIT V_LIMIT; CLOSE C_WHO_UPDATE; EXCEPTION WHEN OTHERS THEN BEGIN RAISE_APPLICATION_ERROR(-20001, 'ERRO ENCONTRADO: GX_ELO_BATCH_ISSUE.303 - ' || SQLCODE || ' -ERROR- ' || SQLERRM); --ROLLBACK; END; END; IF tof_elo_interface.COUNT > 0 THEN FOR i_cart in tof_elo_interface.First .. tof_elo_interface.Last loop tof_new_interface(tof_new_interface.COUNT + 1).CD_INTERFACE:= tof_elo_interface(i_cart).CD_INTERFACE; end loop; END IF; IF tof_new_interface.COUNT > 0 THEN BEGIN FORALL i_cart in INDICES OF tof_new_interface delete VND.INTERFACE where CD_INTERFACE = tof_new_interface(i_cart).CD_INTERFACE ; COMMIT; EXCEPTION WHEN OTHERS THEN BEGIN RAISE_APPLICATION_ERROR(-20001, 'ERRO ENCONTRADO: GX_ELO_BATCH_ISSUE.304 - ' || SQLCODE || ' -ERROR- ' || SQLERRM); ROLLBACK; END; END; END IF; END; --select * from vnd.interface where dh_execucao is null;
.headers on .nullvalue '-null-' .mode csv -- -- 01 SELECT Site.name FROM Site JOIN Visited ON Site.lat <- 49.0 AND Site.name = Visited.site AND Visited.dated >= '1932-01-01';
/* 查詢學生的總成績並進行排名 */ SELECT s.s_id, s.s_name, SUM(sc.s_score) AS [Sum Score], RANK() OVER(ORDER BY SUM(sc.s_score) DESC) AS [Rank] FROM student s LEFT JOIN score sc ON s.s_id = sc.s_id GROUP BY s.s_id, s.s_name /* 按各科成績進行排序,並顯示排名(重點row_number) */ SELECT ROW_NUMBER() OVER(PARTITION BY c_id ORDER BY s_score DESC) AS [RANK], s.s_id, s.s_name, sc.c_id, sc.s_score FROM score sc join student s ON sc.s_id = s.s_id;
UPDATE users set profile_pic = $2 where emp_id = $1 and profile_pic is null;
ALTER TABLE trainhalts ADD CHECK (timein <= timeout); ALTER TABLE trainhalts DROP FOREIGN KEY `trainhalts_ibfk_1`; ALTER TABLE trainhalts ADD FOREIGN KEY id REFERENCES train(id) ON DELETE CASCADE; INSERT INTO trainhalts VALUES ("T129", 0, "CST", NULL, "22.00") INSERT INTO trainhalts VALUES ("T129", 1, "GPR", "22.10", "22.15") INSERT INTO trainhalts VALUES ("T129", 2, "TNA", "22.30", NULL)
-- populate networks INSERT INTO network (location) VALUES ('brighton'); INSERT INTO network (location) VALUES ('bunker'); SELECT * FROM network; -- add switch hosts INSERT INTO host (name, stack_position, network_id) SELECT 'ispsw01f', 1, id FROM network WHERE location = 'brighton'; INSERT INTO host (name, stack_position, network_id) SELECT 'ispsw01f', 2, id FROM network WHERE location = 'brighton'; INSERT INTO host (name, stack_position, network_id) SELECT 'ispsw03xa', 1, id FROM network WHERE location = 'bunker'; INSERT INTO host (name, stack_position, network_id) SELECT 'ispsw03xa', 2, id FROM network WHERE location = 'bunker'; INSERT INTO host (name, stack_position, network_id) SELECT 'ispsw03xg', 1, id FROM network WHERE location = 'bunker'; INSERT INTO host (name, stack_position, network_id) SELECT 'ispsw03xg', 2, id FROM network WHERE location = 'bunker'; INSERT INTO host (name, stack_position, network_id) SELECT 'ispsw03yc', 1, id FROM network WHERE location = 'bunker'; INSERT INTO host (name, stack_position, network_id) SELECT 'ispsw03yc', 2, id FROM network WHERE location = 'bunker'; INSERT INTO host (name, stack_position, network_id) SELECT 'ispsw03yh', 1, id FROM network WHERE location = 'bunker'; INSERT INTO host (name, stack_position, network_id) SELECT 'ispsw03yh', 2, id FROM network WHERE location = 'bunker'; -- add machines INSERT INTO host (name, network_id) SELECT 'devrob01a', id FROM network WHERE location = 'brighton'; INSERT INTO host (name, network_id) SELECT 'devrob01b', id FROM network WHERE location = 'brighton'; INSERT INTO host (name, network_id) SELECT 'devrob01c', id FROM network WHERE location = 'brighton'; INSERT INTO host (name, network_id) SELECT 'devrob01d', id FROM network WHERE location = 'brighton'; SELECT * FROM host; -- add switch interfaces INSERT INTO switch_interface (description, host_id) SELECT 'cspblah01a-description', id FROM host WHERE name = 'ispsw01f' AND stack_position = 1; INSERT INTO switch_interface (description, host_id) SELECT 'cspblah01b-eth1', id FROM host WHERE name = 'ispsw01f' AND stack_position = 1; INSERT INTO switch_interface (description, host_id) SELECT 'cspblah01c-eth8', id FROM host WHERE name = 'ispsw01f' AND stack_position = 2; INSERT INTO switch_interface (description, host_id) SELECT 'cspblah01d-eth1', id FROM host WHERE name = 'ispsw01f' AND stack_position = 2; SELECT * FROM switch_interface; -- add ethernet INSERT INTO ethernet (port, switch_interface_id) SELECT 1, id FROM switch_interface WHERE description = 'cspblah01d-eth1'; SELECT * FROM ethernet; -- add machine interfaces INSERT INTO machine_interface (name, mac, host_id) SELECT 'eth0', '000000000000', id FROM host WHERE name = 'devrob01a'; INSERT INTO machine_interface (name, mac, host_id) SELECT 'eth1', '000000000001', id FROM host WHERE name = 'devrob01a'; INSERT INTO machine_interface (name, mac, host_id) SELECT 'eth8', '000000000002', id FROM host WHERE name = 'devrob01c'; INSERT INTO machine_interface (name, mac, host_id) SELECT 'eth9', '000000000003', id FROM host WHERE name = 'devrob01d'; SELECT * FROM machine_interface; -- join examples SELECT network.location, host.name, host.stack_position, switch_interface.description FROM host INNER JOIN switch_interface ON switch_interface.host_id = host.id INNER JOIN network ON host.network_id = network.id; SELECT network.location, host.name, machine_interface.name, machine_interface.mac FROM host INNER JOIN machine_interface ON machine_interface.host_id = host.id INNER JOIN network ON host.network_id = network.id; -- view examples CREATE VIEW switch_interface_stuff AS SELECT network.location AS network, host.name AS switch, host.stack_position AS stack_position, ethernet.port AS port FROM host INNER JOIN switch_interface ON switch_interface.host_id = host.id INNER JOIN network ON host.network_id = network.id INNER JOIN ethernet ON ethernet.switch_interface_id = switch_interface.id; SELECT * FROM switch_interface_stuff; CREATE VIEW machine_interface_stuff AS SELECT network.location AS network, host.name AS machine, machine_interface.name AS interface, machine_interface.mac AS mac FROM host INNER JOIN machine_interface ON machine_interface.host_id = host.id INNER JOIN network ON host.network_id = network.id; SELECT * FROM machine_interface_stuff;
-- phpMyAdmin SQL Dump -- version 3.4.11.1deb2 -- http://www.phpmyadmin.net -- -- Host: localhost -- Erstellungszeit: 11. Jun 2014 um 08:07 -- Server Version: 5.5.31 -- PHP-Version: 5.4.4-14+deb7u4 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 */; -- -- Datenbank: `pool` -- -- -------------------------------------------------------- -- -- Tabellenstruktur für Tabelle `aktor` -- CREATE TABLE IF NOT EXISTS `aktor` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(255) DEFAULT NULL, `programm` int(1) DEFAULT '0', `verbrauch` int(4) DEFAULT NULL, `gpio` int(3) DEFAULT NULL, `toggle_gpio` int(3) NOT NULL, `zeitEin` int(11) NOT NULL, `zeitHeute` int(11) NOT NULL, `verbrauchWatt` decimal(5,2) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=5 ; -- -- Daten für Tabelle `aktor` -- INSERT INTO `aktor` (`id`, `name`, `programm`, `verbrauch`, `gpio`, `toggle_gpio`, `zeitEin`, `zeitHeute`, `verbrauchWatt`) VALUES (1, 'Pool', 3, NULL, 17, 0, 0, 0, 500.00), (2, 'Solar', 0, NULL, 24, 0, 0, 0, 0.00), (3, 'Licht', 0, NULL, 22, 0, 0, 0, 100.00), (4, 'Tablet', 0, NULL, 23, 0, 0, 0, 0.00); -- -------------------------------------------------------- -- -- Tabellenstruktur für Tabelle `einstellungen` -- CREATE TABLE IF NOT EXISTS `einstellungen` ( `maxWasser` int(10) NOT NULL, `diffTemp` int(11) NOT NULL, `minSolar` int(2) NOT NULL, `startPumpe` time NOT NULL, `stopPumpe` time NOT NULL, `startPumpe1` time NOT NULL, `stopPumpe1` time NOT NULL, `startTablet` time NOT NULL, `stopTablet` time NOT NULL, `tabletWochentag` varchar(30) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Daten für Tabelle `einstellungen` -- INSERT INTO `einstellungen` (`maxWasser`, `diffTemp`, `minSolar`, `startPumpe`, `stopPumpe`, `startPumpe1`, `stopPumpe1`, `startTablet`, `stopTablet`, `tabletWochentag`) VALUES (30, 3, 25, '08:45:00', '12:00:00', '13:15:00', '18:30:00', '11:30:00', '15:00:00', '1;2;4;6'); -- -------------------------------------------------------- -- -- Tabellenstruktur für Tabelle `logtemp` -- CREATE TABLE IF NOT EXISTS `logtemp` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(25) NOT NULL, `iid` varchar(30) DEFAULT NULL, `value` float DEFAULT NULL, `time` int(11) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Tabellenstruktur für Tabelle `logverbrauch` -- CREATE TABLE IF NOT EXISTS `logverbrauch` ( `id` int(11) NOT NULL AUTO_INCREMENT, `gpio` int(3) DEFAULT NULL, `kwh` varchar(11) DEFAULT NULL, `zeitEin` int(11) DEFAULT NULL, `date` int(11) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -- Daten für Tabelle `logverbrauch` -- -- -- Tabellenstruktur für Tabelle `sensoren` -- CREATE TABLE IF NOT EXISTS `sensoren` ( `id` int(2) NOT NULL AUTO_INCREMENT, `sensorId` varchar(20) NOT NULL, `name` varchar(20) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ; -- -- Daten für Tabelle `sensoren` -- INSERT INTO `sensoren` (`id`, `sensorId`, `name`) VALUES (1, '28-0000045c707e', 'Pool'), (2, '28-0000045d2690', 'Solar'), (3, '123456789', 'Raspberry'), (4, '28-00000472367d', 'Ruecklauf'); -- -------------------------------------------------------- -- -- Tabellenstruktur für Tabelle `temptrend` -- CREATE TABLE IF NOT EXISTS `temptrend` ( `Pool` float NOT NULL, `Solar` float NOT NULL, `Ruecklauf` float NOT NULL, `Raspberry` float NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Daten für Tabelle `temptrend` -- INSERT INTO `temptrend` (`Pool`, `Solar`, `Ruecklauf`, `Raspberry`) VALUES (0.18, 4.37, 0.25, 1.07); /*!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 roles (id, name, status, created_by, created_date) values (1, 'SUPER_USER', 'ACTIVE', 1, current_timestamp), (2, 'KEY_OFFICIAL', 'ACTIVE', 1, current_timestamp), (3, 'MONEY_LAUNDERING_OFFICIAL', 'ACTIVE', 1, current_timestamp), (4, 'MARKETING_MANAGER', 'ACTIVE', 1, current_timestamp), (5, 'CASINO_MANAGER', 'ACTIVE', 1, current_timestamp), (6, 'ONLINE_MARKETING_MANAGER', 'ACTIVE', 1, current_timestamp), (7, 'PAYMENTS_MANAGER', 'ACTIVE', 1, current_timestamp), (8, 'CUSTOMER_SUPPORT_MANAGER', 'ACTIVE', 1, current_timestamp), (9, 'CUSTOMER_SUPPORT_LEADER', 'ACTIVE', 1, current_timestamp), (10, 'CUSTOMER_SUPPORT', 'ACTIVE', 1, current_timestamp);
SELECT dataset_n.pid AS participantId, dataset_n.Name, dataset_n.Label, dataset_n.study_time_collected || ' ' || dataset_n.study_time_collected_unit AS timepoint, dataset_n.features FROM ( SELECT study_time_collected, study_time_collected_unit, pid, COUNT(population_definition_reported) AS features, 'fcs_analyzed_result' AS Name, 'Flow Cytometry' AS Label FROM ( SELECT DISTINCT study_time_collected, study_time_collected_unit, participantid AS pid, population_definition_reported FROM fcs_analyzed_result GROUP BY study_time_collected, study_time_collected_unit, participantid, population_definition_reported) GROUP BY study_time_collected, study_time_collected_unit, pid UNION SELECT study_time_collected, study_time_collected_unit, pid, COUNT(analyte) AS features, 'mbaa' AS Name, 'MBAA' AS Label FROM ( SELECT DISTINCT study_time_collected, study_time_collected_unit, participantid AS pid, analyte FROM mbaa GROUP BY study_time_collected, study_time_collected_unit, participantid, analyte) GROUP BY study_time_collected, study_time_collected_unit, pid UNION SELECT study_time_collected, study_time_collected_unit, pid, COUNT(analyte) AS features, 'elisa' AS Name, 'ELISA' AS Label FROM ( SELECT DISTINCT study_time_collected, study_time_collected_unit, participantid AS pid, analyte FROM elisa GROUP BY study_time_collected, study_time_collected_unit, participantid, analyte) GROUP BY study_time_collected, study_time_collected_unit, pid UNION SELECT study_time_collected, study_time_collected_unit, pid, COUNT(analyte) AS features, 'elispot' AS Name, 'ELISPOT' AS Label FROM ( SELECT DISTINCT study_time_collected, study_time_collected_unit, participantid AS pid, analyte FROM elispot GROUP BY study_time_collected, study_time_collected_unit, participantid, analyte) GROUP BY study_time_collected, study_time_collected_unit, pid UNION SELECT study_time_collected, study_time_collected_unit, participantid AS pid, 1 AS features, 'hai' AS Name, 'HAI' AS Label FROM hai GROUP BY study_time_collected, study_time_collected_unit, participantid UNION SELECT study_time_collected, study_time_collected_unit, participantid AS pid, 1 AS features, 'neut_ab_titer' AS Name, 'NAb' AS Label FROM neut_ab_titer GROUP BY study_time_collected, study_time_collected_unit, participantid UNION SELECT study_time_collected, study_time_collected_unit, participantid AS pid, COUNT(gene_symbol) AS features, 'pcr' AS Name, 'PCR' AS Label FROM pcr GROUP BY study_time_collected, study_time_collected_unit, participantid UNION SELECT study_time_collected, study_time_collected_unit, participantid AS pid, MAX(features) AS features, 'gene_expression_files' AS Name, 'Gene Expression' AS Label FROM assay.ExpressionMatrix.Matrix.InputSamplesWithFeatures GROUP BY study_time_collected, study_time_collected_unit, participantid ) AS dataset_n WHERE -- Ensure no blank non-pid rows due to AllFolder containerFilter option in upstream GE queries dataset_n.pid LIKE 'SUB%' ORDER BY dataset_n.pid ASC, dataset_n.Label ASC, dataset_n.study_time_collected_unit ASC, dataset_n.study_time_collected ASC
Step 1: Get albumuuid from crawling task: Select * from (Select trim(SUBSTRING_INDEX(Ext ->> '$.error_message',':',-1)) as albumuuid,TaskDetail ->>'$.album_id' as ituneid from crawlingtasks where crawlingtasks.Priority = 98 and crawlingtasks.CreatedAt like '2019-08-21%' and actionid = '9C8473C36E57472281A1C7936108FC06') as t1 UNION ALL Select * from (select ext ->> '$.album_uuid',TaskDetail ->>'$.album_id' as ituneid from crawlingtask_done where crawlingtask_done.CreatedAt like '2019-08-21%' and crawlingtask_done.actionid = '9C8473C36E57472281A1C7936108FC06') as t1 UNION ALL Select * from (Select trim(SUBSTRING_INDEX(Ext ->> '$.error_message',':',-1)),TaskDetail ->>'$.album_id' as ituneid from crawlingtasks where crawlingtasks.Priority = 99 and crawlingtasks.CreatedAt like '2019-08-22%' and actionid = '9C8473C36E57472281A1C7936108FC06') as t1 UNION ALL Select * from (select ext ->> '$.album_uuid',TaskDetail ->>'$.album_id' as ituneid from crawlingtask_done where crawlingtask_done.CreatedAt like '2019-08-22%' and crawlingtask_done.actionid = '9C8473C36E57472281A1C7936108FC06') as t1
create table biz_account ( id int not null auto_increment, acc_code varchar(16) not null, amt double not null, created datetime not null default current_timestamp, primary key (id) ); -- ENGINE=InnoDB DEFAULT CHARSET=utf8mb4
select count(1) from producto where id = :id
-- sqlite3 sample app.db DROP TABLE IF EXISTS `users_domains`; DROP TABLE IF EXISTS `domains`; DROP TABLE IF EXISTS `users_ids`; -- allows users and objects to be siloed into domains of interest CREATE TABLE `domains` ( `id` INTEGER PRIMARY KEY AUTOINCREMENT, `name` VARCHAR(255) NOT NULL UNIQUE, `description` VARCHAR(255), `appid` VARCHAR(255), `createdAt` DATETIME NOT NULL, `updatedAt` DATETIME NOT NULL, `ownerId` INTEGER REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE ); INSERT INTO domains VALUES (null, "default", "The domain that all new users are put in by default", null, datetime('now'), datetime('now'), 1); -- connects users to domains CREATE TABLE `users_domains` ( `userId` INTEGER REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, `domainId` INTEGER REFERENCES `domains` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, `createdAt` DATETIME DEFAULT CURRENT_TIMESTAMP, `updatedAt` DATETIME DEFAULT CURRENT_TIMESTAMP, UNIQUE (`userId`) ); -- created a unique short ID for users created through registration page CREATE TABLE `users_appids` ( `userId` INTEGER REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, `appid` VARCHAR(6) NOT NULL, `createdAt` DATETIME DEFAULT CURRENT_TIMESTAMP, UNIQUE (`userId`) ); -- CREATE TABLE `categories` ( -- `id` INTEGER PRIMARY KEY AUTOINCREMENT, -- `name` VARCHAR(255), -- `description` TEXT, -- `createdAt` DATETIME NOT NULL, -- `updatedAt` DATETIME NOT NULL, -- `domainId` INTEGER REFERENCES `domains` (`id`) ON DELETE SET NULL ON UPDATE CASCADE -- );
CREATE TABLE table3 ( id INTEGER PRIMARY KEY NOT NULL, nom VARCHAR(100) ); CREATE TABLE table2 ( id INTEGER PRIMARY KEY NOT NULL, nom VARCHAR(100), id_table3 INTEGER, nom_table3 VARCHAR(100) ); CREATE TABLE table1 ( id INTEGER PRIMARY KEY NOT NULL, nom VARCHAR(100), dt DATE, num INTEGER, id_table2 INTEGER REFERENCES table2(id), id_table3 INTEGER, FOREIGN KEY(id_table3) REFERENCES table3(id) ON DELETE CASCADE ); ALTER TABLE table3 ADD CONSTRAINT u_table3 UNIQUE (id, nom); ALTER TABLE table2 ADD CONSTRAINT fk_table2_table3 FOREIGN KEY (id_table3, nom_table3) REFERENCES table3(id, nom) ON UPDATE CASCADE ON DELETE RESTRICT;
-- phpMyAdmin SQL Dump -- version 4.6.6 -- https://www.phpmyadmin.net/ -- -- Host: localhost -- Generation Time: May 23, 2017 at 11:25 AM -- Server version: 5.6.28-log -- PHP Version: 5.6.19 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: `xihaxueche` -- -- -------------------------------------------------------- -- -- Table structure for table `cs_test_account` -- CREATE TABLE `cs_test_account` ( `accid` int(11) UNSIGNED NOT NULL, `field` char(64) NOT NULL DEFAULT '' COMMENT '字段名', `value` char(32) NOT NULL DEFAULT '' COMMENT '存储值', `beizhu` char(255) NOT NULL DEFAULT '' COMMENT '备注', `addtime` int(11) UNSIGNED NOT NULL DEFAULT '0' COMMENT '添加时间' ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `cs_test_account` -- INSERT INTO `cs_test_account` (`accid`, `field`, `value`, `beizhu`, `addtime`) VALUES (1, 'stu_phone', '18656999023', '陈曦学员', 0), (2, 'stu_phone', '17355100855', '高大成学员', 0), (3, 'stu_phone', '18326605314', '魏姣学员', 0), (4, 'stu_phone', '13205602383', '梅海龙学员', 0), (5, 'stu_phone', '18756004209', '王玲学员', 0), (6, 'stu_phone', '18655132037', '朱清学员', 0), (7, 'stu_phone', '18655132037', '吴红星学员', 0), (8, 'stu_phone', '15056032300', '陈蜂学员', 0), (9, 'stu_phone', '18681801214', '陈蜂学员', 0), (10, 'stu_phone', '14776768787', '未知', 0), (11, 'stu_phone', '13285652603', '唐地', 0), (12, 'stu_phone', '18756907614', '未知', 0); -- -- Indexes for dumped tables -- -- -- Indexes for table `cs_test_account` -- ALTER TABLE `cs_test_account` ADD PRIMARY KEY (`accid`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `cs_test_account` -- ALTER TABLE `cs_test_account` MODIFY `accid` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=13; /*!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 s.store_id, DATE_PART ('year', r.rental_date) AS rental_year, DATE_PART ('month', r.rental_date) AS rental_month, COUNT(*) AS count_of_rentals FROM Store s JOIN staff st ON s.store_id = st.store_id JOIN rental r ON r.staff_id = st.staff_id GROUP BY 1, 2, 3 ORDER BY 2, 3;
--First CTE WITH all_app_data AS (SELECT DISTINCT app.name, app.price as app_price, play.price as play_price, CAST(app.price as money) + CAST(play.price as money) as total_app_price, ROUND(((app.rating + play.rating)/2),2) AS avg_app_rating, app.primary_genre AS app_genre, play.genres as play_genre FROM app_store_apps AS app LEFT JOIN play_store_apps AS play on app.name = play.name), --Second CTE app_trader_purchase_price AS (SELECT *, CASE WHEN (total_app_price > '1') THEN (total_app_price * '10000') ELSE '10000' END AS app_trader_purchase_price FROM all_app_data), --Third CTE rounded ratings rounded_avg_rating AS (SELECT *, CASE WHEN avg_app_rating BETWEEN 0 AND 0.24 THEN 0 WHEN avg_app_rating BETWEEN 0.25 and 0.74 THEN 0.50 WHEN avg_app_rating BETWEEN 0.75 and 1.24 THEN 1.00 WHEN avg_app_rating BETWEEN 1.25 and 1.74 THEN 1.50 WHEN avg_app_rating BETWEEN 1.75 and 2.24 THEN 2.00 WHEN avg_app_rating BETWEEN 2.25 and 2.74 THEN 2.50 WHEN avg_app_rating BETWEEN 2.75 and 3.24 THEN 3.00 WHEN avg_app_rating BETWEEN 3.25 and 3.74 THEN 3.50 WHEN avg_app_rating BETWEEN 3.75 and 4.24 THEN 4.00 WHEN avg_app_rating BETWEEN 4.25 and 4.74 THEN 4.50 WHEN avg_app_rating BETWEEN 4.75 and 5.00 THEN 5.00 END as avg_app_rating_rounded FROM app_trader_purchase_price) --Outter query SELECT *, CASE WHEN avg_app_rating_rounded > 0 THEN ((avg_app_rating_rounded * 2) +1) ELSE 1 END AS expected_app_lifestpan_years FROM rounded_avg_rating ORDER BY app_trader_purchase_price DESC;
-- -------------------------------------------------------- -- Host: 127.0.0.1 -- Server Version: 10.1.36-MariaDB - mariadb.org binary distribution -- Server Betriebssystem: Win32 -- HeidiSQL Version: 9.3.0.4984 -- -------------------------------------------------------- /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET NAMES utf8mb4 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; -- Exportiere Datenbank Struktur für cms CREATE DATABASE IF NOT EXISTS `cms` /*!40100 DEFAULT CHARACTER SET latin1 */; USE `cms`; -- Exportiere Struktur von Tabelle cms.content CREATE TABLE IF NOT EXISTS `content` ( `CID` int(11) NOT NULL AUTO_INCREMENT, `CLongText` varchar(1024) NOT NULL, `LastModified` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, `Delete` tinyint(1) DEFAULT NULL, `CName` varchar(50) DEFAULT NULL, PRIMARY KEY (`CID`) ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1; -- Exportiere Daten aus Tabelle cms.content: ~3 rows (ungefähr) /*!40000 ALTER TABLE `content` DISABLE KEYS */; INSERT INTO `content` (`CID`, `CLongText`, `LastModified`, `Delete`, `CName`) VALUES (1, 'Hier könnte voll interessante Sachen stehen', '0000-00-00 00:00:00', 0, 'Tagesnews'), (2, 'Wo ist der Bus mit den Leuten die es interessiert', '0000-00-00 00:00:00', 0, 'Wayne'), (3, 'Fisch Fisch Fisch', '0000-00-00 00:00:00', 0, 'Fisch'); /*!40000 ALTER TABLE `content` ENABLE KEYS */; -- Exportiere Struktur von Tabelle cms.mainmenu CREATE TABLE IF NOT EXISTS `mainmenu` ( `MmID` int(11) NOT NULL AUTO_INCREMENT, `MmName` varchar(50) DEFAULT '0', `LastModified` TIMESTAMP DEFAULT CURRENT_TIMESTAMP, `Delete` tinyint(1) DEFAULT NULL, PRIMARY KEY (`MmID`) ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1; -- Exportiere Daten aus Tabelle cms.mainmenu: ~2 rows (ungefähr) /*!40000 ALTER TABLE `mainmenu` DISABLE KEYS */; INSERT INTO `mainmenu` (`MmID`, `MmName`, `LastModified`, `Delete`) VALUES (1, 'Hauptmenue', '2018-11-07 16:04:10', NULL), (2, 'News', '2018-11-07 16:04:10', NULL); /*!40000 ALTER TABLE `mainmenu` ENABLE KEYS */; -- Exportiere Struktur von Tabelle cms.settingtemplatevalue CREATE TABLE IF NOT EXISTS `settingtemplatevalue` ( `TemplateID` int(11) DEFAULT NULL, `SettingID` int(11) DEFAULT NULL, `Value` varchar(50) DEFAULT NULL, `LastModified` TIMESTAMP DEFAULT CURRENT_TIMESTAMP, `Delete` tinyint(1) DEFAULT NULL, KEY `settingtemplatevalue_templatesetting` (`SettingID`), KEY `settingtemplatevalue_template` (`TemplateID`), CONSTRAINT `settingtemplatevalue_template` FOREIGN KEY (`TemplateID`) REFERENCES `template` (`TemplateID`), CONSTRAINT `settingtemplatevalue_templatesetting` FOREIGN KEY (`SettingID`) REFERENCES `templatesetting` (`SettingID`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- Exportiere Daten aus Tabelle cms.settingtemplatevalue: ~5 rows (ungefähr) /*!40000 ALTER TABLE `settingtemplatevalue` DISABLE KEYS */; INSERT INTO `settingtemplatevalue` (`TemplateID`, `SettingID`, `Value`, `LastModified`, `Delete`) VALUES (1, 3, '500', '2018-11-07 16:03:42', NULL), (1, 2, '500', '2018-11-07 16:03:42', NULL), (1, 4, '30', '2018-11-07 16:03:42', NULL), (1, 1, '1050', '2018-11-07 16:03:42', NULL), (1, 5, '1', '2018-11-07 16:03:42', NULL); /*!40000 ALTER TABLE `settingtemplatevalue` ENABLE KEYS */; -- Exportiere Struktur von Tabelle cms.subcont CREATE TABLE IF NOT EXISTS `subcont` ( `SCID` int(11) NOT NULL AUTO_INCREMENT, `CID` int(11) DEFAULT NULL, `SmID` int(11) DEFAULT NULL, `Rank` int(11) DEFAULT NULL, PRIMARY KEY (`SCID`), KEY `FK__content` (`CID`), KEY `FK__submenu` (`SmID`), CONSTRAINT `FK__content` FOREIGN KEY (`CID`) REFERENCES `content` (`CID`), CONSTRAINT `FK__submenu` FOREIGN KEY (`SmID`) REFERENCES `submenu` (`SmID`) ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1; -- Exportiere Daten aus Tabelle cms.subcont: ~3 rows (ungefähr) /*!40000 ALTER TABLE `subcont` DISABLE KEYS */; INSERT INTO `subcont` (`SCID`, `CID`, `SmID`, `Rank`) VALUES (1, 3, 2, NULL), (2, 2, 3, NULL), (3, 1, 4, NULL); /*!40000 ALTER TABLE `subcont` ENABLE KEYS */; -- Exportiere Struktur von Tabelle cms.submenu CREATE TABLE IF NOT EXISTS `submenu` ( `SmID` int(11) NOT NULL AUTO_INCREMENT, `MmID` int(11) DEFAULT NULL, `SmName` varchar(50) DEFAULT '0', `LastModified` TIMESTAMP DEFAULT CURRENT_TIMESTAMP, `Delete` tinyint(1) DEFAULT NULL, PRIMARY KEY (`SmID`), KEY `FK_submenu_mainmenu` (`MmID`), CONSTRAINT `FK_submenu_mainmenu` FOREIGN KEY (`MmID`) REFERENCES `mainmenu` (`MmID`) ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1; -- Exportiere Daten aus Tabelle cms.submenu: ~4 rows (ungefähr) /*!40000 ALTER TABLE `submenu` DISABLE KEYS */; INSERT INTO `submenu` (`SmID`, `MmID`, `SmName`, `LastModified`, `Delete`) VALUES (1, 1, 'Admin', '2018-11-07 16:02:28', NULL), (2, 1, 'User', '2018-11-07 16:02:28', NULL), (3, 2, 'News 1', '2018-11-07 16:02:28', NULL), (4, 2, 'News 2', '2018-11-07 16:02:28', NULL); /*!40000 ALTER TABLE `submenu` ENABLE KEYS */; -- Exportiere Struktur von Tabelle cms.template CREATE TABLE IF NOT EXISTS `template` ( `TemplateID` int(11) NOT NULL AUTO_INCREMENT, `TemplateBezeichnung` varchar(50) NOT NULL, `LastModified` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, `Delete` tinyint(1) DEFAULT NULL, PRIMARY KEY (`TemplateID`) ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1; -- Exportiere Daten aus Tabelle cms.template: ~1 rows (ungefähr) /*!40000 ALTER TABLE `template` DISABLE KEYS */; INSERT INTO `template` (`TemplateID`, `TemplateBezeichnung`, `LastModified`, `Delete`) VALUES (1, 'default', '0000-00-00 00:00:00', 0); /*!40000 ALTER TABLE `template` ENABLE KEYS */; -- Exportiere Struktur von Tabelle cms.templatesetting CREATE TABLE IF NOT EXISTS `templatesetting` ( `SettingID` int(11) NOT NULL AUTO_INCREMENT, `SettingLabel` varchar(50) DEFAULT NULL, `SettingEinheit` varchar(15) DEFAULT NULL, `LastModified` TIMESTAMP DEFAULT CURRENT_TIMESTAMP, `Delete` tinyint(1) DEFAULT NULL, PRIMARY KEY (`SettingID`) ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1; -- Exportiere Daten aus Tabelle cms.templatesetting: ~4 rows (ungefähr) /*!40000 ALTER TABLE `templatesetting` DISABLE KEYS */; INSERT INTO `templatesetting` (`SettingID`, `SettingLabel`, `SettingEinheit`, `LastModified`, `Delete`) VALUES (1, 'tableWidth', 'px', '2018-09-13 17:54:33', NULL), (2, 'headerHight', 'px', '2018-09-13 17:54:54', NULL), (3, 'footerHeight', 'px', '2018-09-13 17:55:53', NULL), (4, 'menuWidth', 'percent', '2018-09-13 17:56:21', NULL), (5, 'tableBorder', 'px', '2018-09-20 17:32:24', NULL); /*!40000 ALTER TABLE `templatesetting` ENABLE KEYS */; /*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */; /*!40014 SET FOREIGN_KEY_CHECKS=IF(@OLD_FOREIGN_KEY_CHECKS IS NULL, 1, @OLD_FOREIGN_KEY_CHECKS) */; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
# ************************************************************ # Sequel Pro SQL dump # Version 4004 # # http://www.sequelpro.com/ # http://code.google.com/p/sequel-pro/ # # Host: 127.0.0.1 (MySQL 5.5.29) # Database: ORMTest # Generation Time: 2013-04-09 19:33:17 +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 Category # ------------------------------------------------------------ DROP TABLE IF EXISTS `Category`; CREATE TABLE `Category` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(255) DEFAULT NULL, `parentCategoryId` int(10) unsigned DEFAULT NULL, PRIMARY KEY (`id`), KEY `fk_Category_Category1_idx` (`parentCategoryId`), CONSTRAINT `fk_Category_Category1` FOREIGN KEY (`parentCategoryId`) REFERENCES `Category` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB DEFAULT CHARSET=utf8; LOCK TABLES `Category` WRITE; /*!40000 ALTER TABLE `Category` DISABLE KEYS */; INSERT INTO `Category` (`id`, `name`, `parentCategoryId`) VALUES (1,'Laptops',NULL), (2,'Apple Laptops',1); /*!40000 ALTER TABLE `Category` ENABLE KEYS */; UNLOCK TABLES; # Dump of table Product # ------------------------------------------------------------ DROP TABLE IF EXISTS `Product`; CREATE TABLE `Product` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `price` double(9,2) NOT NULL DEFAULT '0.00', `name` varchar(255) DEFAULT NULL, `description` mediumtext, `categoryId` int(10) unsigned DEFAULT NULL, PRIMARY KEY (`id`), KEY `fk_Product_Category1_idx` (`categoryId`), CONSTRAINT `fk_Product_Category1` FOREIGN KEY (`categoryId`) REFERENCES `Category` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB DEFAULT CHARSET=utf8; LOCK TABLES `Product` WRITE; /*!40000 ALTER TABLE `Product` DISABLE KEYS */; INSERT INTO `Product` (`id`, `price`, `name`, `description`, `categoryId`) VALUES (1,12999.99,'MacBook Air 13\'\'','Nice',2); /*!40000 ALTER TABLE `Product` ENABLE KEYS */; UNLOCK TABLES; # Dump of table User # ------------------------------------------------------------ DROP TABLE IF EXISTS `User`; CREATE TABLE `User` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `firstName` varchar(255) DEFAULT NULL, `lastName` varchar(255) DEFAULT NULL, `password` varchar(40) DEFAULT NULL COMMENT 'SHA1 password', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; LOCK TABLES `User` WRITE; /*!40000 ALTER TABLE `User` DISABLE KEYS */; INSERT INTO `User` (`id`, `firstName`, `lastName`, `password`) VALUES (1,'Danny','Kopping','1234'), (2,'Bob','McGuffin','1234'); /*!40000 ALTER TABLE `User` ENABLE KEYS */; UNLOCK TABLES; # Dump of table UserDetail # ------------------------------------------------------------ DROP TABLE IF EXISTS `UserDetail`; CREATE TABLE `UserDetail` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `phoneNumber` varchar(20) DEFAULT NULL, `address` mediumtext, `userId` int(10) unsigned NOT NULL, PRIMARY KEY (`id`,`userId`), KEY `fk_UserDetail_User1_idx` (`userId`), CONSTRAINT `fk_UserDetail_User1` FOREIGN KEY (`userId`) REFERENCES `User` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB DEFAULT CHARSET=utf8; LOCK TABLES `UserDetail` WRITE; /*!40000 ALTER TABLE `UserDetail` DISABLE KEYS */; INSERT INTO `UserDetail` (`id`, `phoneNumber`, `address`, `userId`) VALUES (1,'9797987987','103 Bob Avenue',1); /*!40000 ALTER TABLE `UserDetail` ENABLE KEYS */; UNLOCK TABLES; # Dump of table UserProduct # ------------------------------------------------------------ DROP TABLE IF EXISTS `UserProduct`; CREATE TABLE `UserProduct` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `userId` int(10) unsigned NOT NULL, `productId` int(10) unsigned NOT NULL, PRIMARY KEY (`id`,`userId`,`productId`), KEY `fk_User_has_Product_Product1_idx` (`productId`), KEY `fk_User_has_Product_User_idx` (`userId`), CONSTRAINT `fk_User_has_Product_User` FOREIGN KEY (`userId`) REFERENCES `User` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_User_has_Product_Product1` FOREIGN KEY (`productId`) REFERENCES `Product` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB DEFAULT CHARSET=utf8; LOCK TABLES `UserProduct` WRITE; /*!40000 ALTER TABLE `UserProduct` DISABLE KEYS */; INSERT INTO `UserProduct` (`id`, `userId`, `productId`) VALUES (1,1,1), (3,2,1), (4,1,1); CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `OwnedProducts` AS (select `p`.`name` AS `name`,`p`.`price` AS `price`,concat(`u`.`firstName`,`u`.`lastName`) AS `fullName`,count(`up`.`id`) AS `amount` from ((`user` `u` join `userproduct` `up` on((`u`.`id` = `up`.`userId`))) join `product` `p` on((`p`.`id` = `up`.`productId`))) group by `u`.`id`); /*!40000 ALTER TABLE `UserProduct` ENABLE KEYS */; UNLOCK TABLES; /*!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 */;
-- Table: "user".transfer_history -- DROP TABLE "user".transfer_history; CREATE TABLE "user".transfer_history ( trx_id character varying(10) COLLATE pg_catalog."default" NOT NULL DEFAULT nextval('transfer_hist_trx_id_seq'::regclass), trx_date timestamp(6) without time zone NOT NULL DEFAULT timezone('GMT+7'::text, (now())::timestamp without time zone), fr_acct_no character varying(6) COLLATE pg_catalog."default" NOT NULL, to_acct_no character varying(6) COLLATE pg_catalog."default" NOT NULL, xfer_amt text COLLATE pg_catalog."default" NOT NULL DEFAULT encrypt('0'::bytea, 'WE_GARDEN'::bytea, 'bf-cbc/pad:pkcs'::text), CONSTRAINT transfer_history_pkey PRIMARY KEY (trx_id) ) TABLESPACE pg_default; ALTER TABLE "user".transfer_history OWNER to postgres;
-- phpMyAdmin SQL Dump -- version 4.9.1 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Generation Time: Nov 02, 2019 at 07:49 AM -- Server version: 10.4.8-MariaDB -- PHP Version: 7.2.23 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: `hotel_booking` -- -- -------------------------------------------------------- -- -- Table structure for table `location` -- CREATE TABLE `location` ( `location_id` bigint(20) NOT NULL, `location_name` varchar(255) NOT NULL, `status` int(2) NOT NULL, `created_at` datetime NOT NULL DEFAULT current_timestamp(), `updated_at` datetime NOT NULL DEFAULT current_timestamp() ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `location` -- INSERT INTO `location` (`location_id`, `location_name`, `status`, `created_at`, `updated_at`) VALUES (1, 'chennai', 1, '2019-11-02 06:35:32', '2019-11-02 06:35:32'), (2, 'madurai', 1, '2019-11-02 06:35:32', '2019-11-02 06:35:32'); -- -------------------------------------------------------- -- -- Table structure for table `user_details` -- CREATE TABLE `user_details` ( `id` tinyint(20) NOT NULL, `first_name` varchar(255) NOT NULL, `last_name` varchar(255) NOT NULL, `email` varchar(255) NOT NULL, `password` varchar(255) NOT NULL, `status` int(2) NOT NULL, `created_at` datetime NOT NULL DEFAULT current_timestamp(), `updated_at` datetime NOT NULL DEFAULT current_timestamp() ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `user_details` -- INSERT INTO `user_details` (`id`, `first_name`, `last_name`, `email`, `password`, `status`, `created_at`, `updated_at`) VALUES (1, 'tamiz', 'venthan', 'tamilventhan08@gmail.com', '0937938b0449317df0ce0cb2bbcdad79', 1, '2019-11-02 05:49:50', '2019-11-02 05:49:50'); -- -------------------------------------------------------- -- -- Table structure for table `vendor_details` -- CREATE TABLE `vendor_details` ( `vendor_id` bigint(20) NOT NULL, `vendor_name` varchar(255) NOT NULL, `location_id` bigint(20) NOT NULL, `address` text DEFAULT NULL, `zip_code` int(10) DEFAULT NULL, `land_mark` text DEFAULT NULL, `room_counts` int(20) NOT NULL DEFAULT 0, `status` int(2) NOT NULL, `created_at` datetime NOT NULL DEFAULT current_timestamp(), `updated_at` datetime NOT NULL DEFAULT current_timestamp() ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `vendor_details` -- INSERT INTO `vendor_details` (`vendor_id`, `vendor_name`, `location_id`, `address`, `zip_code`, `land_mark`, `room_counts`, `status`, `created_at`, `updated_at`) VALUES (1, 'JK Hotel', 1, 'JK Hotel\r\n122, mail road,\r\nmedavakkam\r\nchennai', 6000100, 'medavakkam koot road', 20, 1, '2019-11-02 06:44:29', '2019-11-02 06:44:29'), (2, 'MKM Hotel', 2, '10, 1st croos st\r\nRing road\r\nMadurai', 625007, 'velemal hostpital opp.side', 10, 1, '2019-11-02 06:44:29', '2019-11-02 06:44:29'); -- -------------------------------------------------------- -- -- Table structure for table `vendor_rooms` -- CREATE TABLE `vendor_rooms` ( `id` bigint(20) NOT NULL, `vendor_id` bigint(20) NOT NULL, `room_type` enum('AC','NON AC','','') NOT NULL, `room_price` decimal(10,2) NOT NULL DEFAULT 0.00, `no_of_adult` int(3) NOT NULL, `no_of_child` int(3) NOT NULL, `discount_amt` int(2) NOT NULL, `status` int(11) NOT NULL, `created_at` datetime NOT NULL DEFAULT current_timestamp(), `updated_at` datetime NOT NULL DEFAULT current_timestamp() ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `vendor_rooms` -- INSERT INTO `vendor_rooms` (`id`, `vendor_id`, `room_type`, `room_price`, `no_of_adult`, `no_of_child`, `discount_amt`, `status`, `created_at`, `updated_at`) VALUES (1, 1, 'AC', '50.00', 2, 1, 5, 1, '2019-11-02 06:48:10', '2019-11-02 06:48:10'), (2, 2, 'NON AC', '400.00', 2, 1, 10, 1, '2019-11-02 06:48:10', '2019-11-02 06:48:10'); -- -- Indexes for dumped tables -- -- -- Indexes for table `location` -- ALTER TABLE `location` ADD PRIMARY KEY (`location_id`); -- -- Indexes for table `user_details` -- ALTER TABLE `user_details` ADD PRIMARY KEY (`id`); -- -- Indexes for table `vendor_details` -- ALTER TABLE `vendor_details` ADD PRIMARY KEY (`vendor_id`); -- -- Indexes for table `vendor_rooms` -- ALTER TABLE `vendor_rooms` ADD PRIMARY KEY (`id`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `location` -- ALTER TABLE `location` MODIFY `location_id` bigint(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3; -- -- AUTO_INCREMENT for table `user_details` -- ALTER TABLE `user_details` MODIFY `id` tinyint(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; -- -- AUTO_INCREMENT for table `vendor_details` -- ALTER TABLE `vendor_details` MODIFY `vendor_id` bigint(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; -- -- AUTO_INCREMENT for table `vendor_rooms` -- ALTER TABLE `vendor_rooms` MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3; COMMIT; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; ALTER TABLE `users` ADD `mobile_number` VARCHAR(15) NOT NULL AFTER `remember_token`;
use amazen100; -- CREATE TABLE products ( -- id INT NOT NULL AUTO_INCREMENT, -- title VARCHAR(255) NOT NULL, -- description VARCHAR(255), -- price DECIMAL(5,2), -- PRIMARY KEY (id) -- ); -- CREATE TABLE reviews ( -- id INT NOT NULL AUTO_INCREMENT, -- title VARCHAR(255) NOT NULL, -- body VARCHAR(255), -- rating INT NOT NULL, -- productId INT NOT NULL, -- PRIMARY KEY (id), -- FOREIGN KEY (productId) -- REFERENCES products (id) -- ON DELETE CASCADE -- ); -- DANGER ZONE -- ALTER A TABLE -- ALTER TABLE reviews -- ADD COLUMN date DATE -- DELETE ALL DATA WITHIN A COLLECTION -- DELETE FROM reviews; -- DELETE ENTIRE COLLECTION TABLE -- DROP TABLE reviews;
CREATE TABLE estudiante( id Serial PRIMARY KEY, Nombre1 text NOT NULL, Nombre2 text NOT NULL, Apellido1 text NOT NULL, Apellido2 text NOT NULL, Cedula varchar (15), fecha_Nacimiento DATE, nota_BDD decimal, nota_POO decimal, genero VARCHAR (20) ); ---TABLA CREADA--- SELECT * FROM estudiante; ---INGRESO DE DATOS--- INSERT INTO estudiante(Nombre1,Nombre2,Apellido1,Apellido2,Cedula, fecha_Nacimiento, nota_BDD, nota_POO, Genero) VALUES('JUAN','MARCO', 'ORTIZ', 'ZAPATA', '1724229008', '1998/11/25', 10, 8, 'Masculino'); INSERT INTO estudiante(Nombre1,Nombre2,Apellido1,Apellido2,Cedula, fecha_Nacimiento, nota_BDD, nota_POO, Genero) VALUES('MARCO','JUAN','ALVEZ','RAMOS', '1724229007', '1994/10/23', 9, 7, 'Masculino'); INSERT INTO estudiante(Nombre1,Nombre2,Apellido1,Apellido2,Cedula, fecha_Nacimiento, nota_BDD, nota_POO, Genero) VALUES('OMAR','IVAN','AGUIAR','ALVES', '1724229001', '1996/11/26',8.5, 9, 'Masculino'); INSERT INTO estudiante(Nombre1,Nombre2,Apellido1,Apellido2,Cedula, fecha_Nacimiento, nota_BDD, nota_POO, Genero) VALUES('MANUELA','LUCIA', 'BOLIVAR', 'BOLIVAR', '1724229002', '1990/11/21',8,10, 'Femenino'); INSERT INTO estudiante(Nombre1,Nombre2,Apellido1,Apellido2,Cedula, fecha_Nacimiento, nota_BDD, nota_POO, Genero) VALUES('LIZ', 'MARIA', 'BARCOS', 'CHICAIZA', '1724229003', '1997/11/28',7,8, 'Femenino'); INSERT INTO estudiante(Nombre1,Nombre2,Apellido1,Apellido2,Cedula, fecha_Nacimiento, nota_BDD, nota_POO, Genero) VALUES('TATIANA', 'INEZ', 'BOLIVAR', 'CACERES', '1724229004', '1999/11/29',8, 5.6, 'Femenino'); INSERT INTO estudiante(Nombre1,Nombre2,Apellido1,Apellido2,Cedula, fecha_Nacimiento, nota_BDD, nota_POO, Genero) VALUES('ELIANA', 'MARIA', 'OTUNA', 'BOLIVAR', '1724229005', '1993/11/23',9,9.9, 'Femenino'); INSERT INTO estudiante(Nombre1,Nombre2,Apellido1,Apellido2,Cedula, fecha_Nacimiento, nota_BDD, nota_POO, Genero) VALUES('RANDY','MARCO', 'ALVES', 'ALCIVAR', '1724229006', '1992/11/24',8, 6.6, 'Masculino'); INSERT INTO estudiante(Nombre1,Nombre2,Apellido1,Apellido2,Cedula, fecha_Nacimiento, nota_BDD, nota_POO, Genero) VALUES('DAVID', 'JHONN', 'FLORES', 'CARPIO', '1724229007', '1991/11/28',9,8.5, 'Masculino'); INSERT INTO estudiante(Nombre1,Nombre2,Apellido1,Apellido2,Cedula, fecha_Nacimiento, nota_BDD, nota_POO, Genero) VALUES('JOSE','JUAN', 'TITUAŅA', 'ANDRADE', '1724229011', '1993/11/27',7,6.6, 'Masculino'); INSERT INTO estudiante(Nombre1,Nombre2,Apellido1,Apellido2,Cedula, fecha_Nacimiento, nota_BDD, nota_POO, Genero) VALUES('IMELDA', 'ALEJANDRINA', 'CACEREZ', 'BOLIVAR', '1724229091', '1994/11/28', 8,5.6, 'Femenino'); INSERT INTO estudiante(Nombre1,Nombre2,Apellido1,Apellido2,Cedula, fecha_Nacimiento, nota_BDD, nota_POO, Genero) VALUES('GABRIELA', 'MARIA', 'MEZA', 'CACERES', '1724229078', '1995/11/21',9,6.3, 'Femenino'); INSERT INTO estudiante(Nombre1,Nombre2,Apellido1,Apellido2,Cedula, fecha_Nacimiento, nota_BDD, nota_POO, Genero) VALUES('MARIA', 'ANTONIETA', 'MALDONADO', 'ALCIVAR' ,'1724229032', '1996/11/22', 8, 10, 'Femenino'); INSERT INTO estudiante(Nombre1,Nombre2,Apellido1,Apellido2,Cedula, fecha_Nacimiento, nota_BDD, nota_POO, Genero) VALUES('MARCO', 'ANDRES', 'AGUIAR', 'MANZANO', '1724229045', '1997/11/24', 10, 6.8, 'Masculino'); ---SELECCIONAR COLUMNAS QUE SE QUIERE--- SELECT fecha_Nacimiento, nota_BDD, nota_POO, Genero FROM estudiante ---NOTA MAXIMA bdd--- SELECT * FROM estudiante WHERE nota_BDD = (SELECT MAX(nota_BDD) FROM estudiante) ORDER BY nombre1 ---NOTA MINIMA BDD--- SELECT * FROM estudiante WHERE nota_BDD = (SELECT MIN(nota_BDD) FROM estudiante) ORDER BY nombre1 --- NOTA MAXIMA PROGRAMACION--- SELECT * FROM estudiante WHERE nota_BDD = (SELECT MAX(nota_POO) FROM estudiante) ORDER BY nombre1 ---NOTA MINIMA PROGRAMACION--- SELECT * FROM estudiante WHERE nota_BDD = (SELECT MIN(nota_POO) FROM estudiante) ORDER BY nombre1 ---DE MAYOR A MENOR--- SELECT * FROM estudiante ORDER BY nota_BDD DESC ; ---DE MENOR A MAYOR--- SELECT * FROM estudiante ORDER BY nota_BDD ; ---ORDENAR POR GENERO--- SELECT * FROM estudiante where genero = 'Femenino' or genero = 'Masculino' ORDER BY genero ASC ---CUANTOS HAY MASCULINOS Y FEMENINOS--- SELECT genero, count(*) AS estudiante FROM estudiante GROUP BY genero --- LOS MEJORES 5 ESTUDIANTES--- SELECT * FROM estudiante ORDER BY nota_BDD DESC LIMIT 5
SELECT *, sub.calc_date_no_use + 2800 AS date FROM ( SELECT to_date(cast(last_sale_date as TEXT),'YYYY-MM-DD') AS calc_date_no_use, latitude AS lat, longitude AS lng FROM zhepu.sf_sold_homes ) sub
SELECT res_date.sched_id as sched_id, RTRIM(sched.sched_desc) as reservationname, RTRIM(res.res_desc) as roomname, res_date.res_id as res_id, res.grp_id as grp_id, res.res_type_id as res_type_id, RTRIM(res.res_hdr) as title, res.capacity as capacity, mtg_start_date_local as startdate, mtg_end_date_local as enddate, sched.num_attendees as num_attendees FROM RedESoft.dbo.tbl_sched as sched INNER JOIN RedESoft.dbo.tbl_sched_res_date as res_date ON sched.sched_id = res_date.sched_id INNER JOIN RedESoft.dbo.tbl_res as res ON res_date.res_id = res.res_id WHERE ( (mtg_start_date_local >= ? AND mtg_start_date_local <= ?) OR (mtg_end_date_local >= ? AND mtg_end_date_local <= ?) OR (mtg_start_date_local <= ? AND mtg_end_date_local >= ?) ) AND sched.deleted_flag = 0 AND res.res_id = ? ORDER BY roomname, startdate
-- CreateTable CREATE TABLE "key" ( "index" INTEGER NOT NULL, "last_used_at" TIMESTAMP(3) NOT NULL, PRIMARY KEY ("index") );
/* Navicat Premium Data Transfer Source Server : lnmp Source Server Type : MySQL Source Server Version : 50640 Source Host : 127.0.0.1 Source Database : testa Target Server Type : MySQL Target Server Version : 50640 File Encoding : utf-8 Date: 09/05/2019 11:35:14 AM */ SET NAMES utf8mb4; SET FOREIGN_KEY_CHECKS = 0; -- ---------------------------- -- Table structure for `answers` -- ---------------------------- DROP TABLE IF EXISTS `answers`; CREATE TABLE `answers` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `customerpath` char(20) CHARACTER SET latin1 DEFAULT NULL, `qid` int(10) unsigned DEFAULT NULL, `t` varchar(500) DEFAULT NULL, `created_on` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`), KEY `customerpath` (`customerpath`) ) ENGINE=InnoDB AUTO_INCREMENT=101 DEFAULT CHARSET=utf8; -- ---------------------------- -- Table structure for `config` -- ---------------------------- DROP TABLE IF EXISTS `config`; CREATE TABLE `config` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `customerpath` char(20) DEFAULT NULL, `appid` char(20) DEFAULT NULL, `appsec` char(50) DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `customerpath` (`customerpath`,`appid`), KEY `customerpath_2` (`customerpath`), KEY `appid` (`appid`) ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1; -- ---------------------------- -- Table structure for `contact_answers` -- ---------------------------- DROP TABLE IF EXISTS `contact_answers`; CREATE TABLE `contact_answers` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `customerpath` char(20) DEFAULT NULL, `contactid` int(10) unsigned DEFAULT NULL, `aid` int(10) unsigned DEFAULT NULL, `created_on` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`), KEY `customerpath` (`customerpath`) ) ENGINE=InnoDB AUTO_INCREMENT=94 DEFAULT CHARSET=latin1; -- ---------------------------- -- Table structure for `contacts` -- ---------------------------- DROP TABLE IF EXISTS `contacts`; CREATE TABLE `contacts` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `customerpath` char(20) DEFAULT NULL, `openid` varchar(50) DEFAULT NULL, `created_on` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`), UNIQUE KEY `customerpath` (`customerpath`,`openid`), KEY `customerpath_2` (`customerpath`), KEY `openid` (`openid`) ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1; -- ---------------------------- -- Table structure for `media` -- ---------------------------- DROP TABLE IF EXISTS `media`; CREATE TABLE `media` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `openid` char(50) DEFAULT NULL, `mediaid` char(100) DEFAULT NULL, `customerpath` char(20) DEFAULT NULL, `expiretime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1; -- ---------------------------- -- Table structure for `questions` -- ---------------------------- DROP TABLE IF EXISTS `questions`; CREATE TABLE `questions` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `customerpath` char(20) CHARACTER SET latin1 DEFAULT NULL, `t` varchar(500) DEFAULT NULL, `created_on` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `qid` int(10) DEFAULT NULL, PRIMARY KEY (`id`), KEY `customerpath` (`customerpath`) ) ENGINE=InnoDB AUTO_INCREMENT=28 DEFAULT CHARSET=utf8; -- ---------------------------- -- Table structure for `relationships` -- ---------------------------- DROP TABLE IF EXISTS `relationships`; CREATE TABLE `relationships` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `customerpath` char(20) DEFAULT NULL, `userid` int(10) unsigned DEFAULT NULL, `contactid` int(10) unsigned DEFAULT NULL, `created_on` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`), KEY `contactid` (`contactid`), KEY `customerpath` (`customerpath`) ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1; -- ---------------------------- -- Table structure for `users` -- ---------------------------- DROP TABLE IF EXISTS `users`; CREATE TABLE `users` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `customerpath` char(20) DEFAULT NULL, `username` varchar(50) DEFAULT NULL, `contactid` int(10) unsigned DEFAULT NULL, `unique_openid` varchar(50) DEFAULT NULL, `created_on` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`), KEY `unique_openid` (`unique_openid`), KEY `contactid` (`contactid`), KEY `customerpath` (`customerpath`) ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1; SET FOREIGN_KEY_CHECKS = 1;
DROP TABLE IF EXISTS `saraptama`.`attachments`; DROP TABLE IF EXISTS `saraptama`.`authors`; DROP TABLE IF EXISTS `saraptama`.`celems`; DROP TABLE IF EXISTS `saraptama`.`experts`; DROP TABLE IF EXISTS `saraptama`.`pelems`; DROP TABLE IF EXISTS `saraptama`.`projectexperts`; DROP TABLE IF EXISTS `saraptama`.`projects`; DROP TABLE IF EXISTS `saraptama`.`reports`; DROP TABLE IF EXISTS `saraptama`.`subreports`; DROP TABLE IF EXISTS `saraptama`.`subreports_celems`; DROP TABLE IF EXISTS `saraptama`.`subreports_pelems`; DROP TABLE IF EXISTS `saraptama`.`templates`; CREATE TABLE `saraptama`.`attachments` ( `id` int(10) NOT NULL AUTO_INCREMENT, `report_id` int(10) NOT NULL, `name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL, `filename` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL, `todelete` tinyint(1) DEFAULT '0', `created` date DEFAULT NULL, `modified` date DEFAULT NULL, PRIMARY KEY (`id`), KEY `report_id` (`report_id`)) DEFAULT CHARSET=utf8, COLLATE=utf8_general_ci, ENGINE=InnoDB; CREATE TABLE `saraptama`.`authors` ( `id` int(10) NOT NULL AUTO_INCREMENT, `author_group_id` varchar(5) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `created` date DEFAULT NULL, `modified` date DEFAULT NULL, PRIMARY KEY (`id`), KEY `author_group_id` (`author_group_id`)) DEFAULT CHARSET=utf8, COLLATE=utf8_general_ci, ENGINE=InnoDB; CREATE TABLE `saraptama`.`celems` ( `id` int(10) NOT NULL AUTO_INCREMENT, `celem` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `number` int(10) NOT NULL, `name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `celemgroup` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL, `description` text CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`), UNIQUE KEY `number` (`number`), KEY `celem` (`celem`), KEY `number_2` (`number`)) DEFAULT CHARSET=utf8, COLLATE=utf8_general_ci, ENGINE=InnoDB; CREATE TABLE `saraptama`.`experts` ( `id` int(10) NOT NULL AUTO_INCREMENT, `username` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `password` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `fullname` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `isadmin` tinyint(1) DEFAULT '0' NOT NULL, `created` date DEFAULT NULL, `modified` date DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `username` (`username`)) DEFAULT CHARSET=utf8, COLLATE=utf8_general_ci, ENGINE=InnoDB; CREATE TABLE `saraptama`.`pelems` ( `id` int(10) NOT NULL AUTO_INCREMENT, `celem_id` int(10) NOT NULL, `number` int(10) NOT NULL, PRIMARY KEY (`id`), KEY `celem_id` (`celem_id`)) DEFAULT CHARSET=utf8, COLLATE=utf8_general_ci, ENGINE=InnoDB; CREATE TABLE `saraptama`.`projectexperts` ( `id` int(10) NOT NULL AUTO_INCREMENT, `project_id` int(10) NOT NULL, `expert_id` int(10) NOT NULL, `created` date DEFAULT NULL, `modified` date DEFAULT NULL, PRIMARY KEY (`id`), KEY `project_id` (`project_id`), KEY `expert_id` (`expert_id`)) DEFAULT CHARSET=utf8, COLLATE=utf8_general_ci, ENGINE=InnoDB; CREATE TABLE `saraptama`.`projects` ( `id` int(10) NOT NULL AUTO_INCREMENT, `expert_id` int(10) NOT NULL, `author_id` int(10) DEFAULT 0 NOT NULL, `name` text CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `namesolicitare` text CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL, `projecttype` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `projecttypevizat` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `projectdomain` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `projectnumber` varchar(15) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL, `projectdate` date DEFAULT NULL, `projectdatetext` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL, `initiative` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL, `reportnumber` int(10) NOT NULL, `reportimpact` tinyint(1) DEFAULT '0' NOT NULL, `numberpages` int(10) DEFAULT 0 NOT NULL, `datelimitparlament` date NOT NULL, `datelimitparlamenttext` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `datelimitexpert` date NOT NULL, `datelimitexperttext` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `filename` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL, `projectreportstate` int(2) DEFAULT 1 NOT NULL, `projectstate` int(2) DEFAULT 1 NOT NULL, `reportmultipleedit` tinyint(1) DEFAULT '0' NOT NULL, `created` date DEFAULT NULL, `modified` date DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `reportnumber` (`reportnumber`), KEY `expert_id` (`expert_id`), KEY `author_id` (`author_id`), KEY `projecttype` (`projecttype`), KEY `reportnumber_2` (`reportnumber`), KEY `projectreportstate` (`projectreportstate`), KEY `projecttypevizat` (`projecttypevizat`), KEY `projectdomain` (`projectdomain`), KEY `projectnumber` (`projectnumber`)) DEFAULT CHARSET=utf8, COLLATE=utf8_general_ci, ENGINE=InnoDB; CREATE TABLE `saraptama`.`reports` ( `id` int(10) NOT NULL AUTO_INCREMENT, `project_id` int(10) DEFAULT NULL, `reportdate` date NOT NULL, `reportdatetext` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `p02list1` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL, `p02list2` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL, `p02text1` text CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL, `p02option1` int(1) DEFAULT 0, `p02option2` int(1) DEFAULT 0, `p04text1` text CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL, `p05list1` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL, `p05text1` text CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL, `p07text1` text CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL, `p07radio1` int(2) DEFAULT 0 NOT NULL, `p08text1` text CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL, `p08radio1` int(2) DEFAULT 0 NOT NULL, `p08radio2` int(22) DEFAULT 0 NOT NULL, `p09radio1` int(2) DEFAULT 0 NOT NULL, `p09radio2` int(2) DEFAULT 0 NOT NULL, `p09text1` text CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL, `p10text1` text CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL, `p10radio1` int(2) DEFAULT 0 NOT NULL, `p11text1` text CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL, `p11radio1` int(2) DEFAULT 0 NOT NULL, `p11radio2` int(2) DEFAULT 0 NOT NULL, `p12text1` text CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL, `p12radio1` int(2) DEFAULT 0 NOT NULL, `p12radio2` int(2) DEFAULT 0 NOT NULL, `p13text1` text CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL, `p13radio1` int(2) DEFAULT 0 NOT NULL, `p14text1` text CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL, `p14radio1` int(2) DEFAULT 0 NOT NULL, `p15text1` text CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL, `p15radio1` int(2) DEFAULT 0 NOT NULL, `p15radio2` int(2) DEFAULT 0 NOT NULL, `simplesubreport` text CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL, `concluzii` text CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL, `admincoments` text CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL, `reportstate` int(2) DEFAULT 0 NOT NULL, `created` date DEFAULT NULL, `modified` date DEFAULT NULL, PRIMARY KEY (`id`), KEY `project_id` (`project_id`), KEY `reportstate` (`reportstate`)) DEFAULT CHARSET=utf8, COLLATE=utf8_general_ci, ENGINE=InnoDB; CREATE TABLE `saraptama`.`subreports` ( `id` int(10) NOT NULL AUTO_INCREMENT, `report_id` int(10) DEFAULT NULL, `expert_id` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL, `subreportorder` int(10) DEFAULT 0, `articol` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL, `text` text CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL, `obiectia` text CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL, `alteelemente` text CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL, `alteelementeacceptate` tinyint(1) DEFAULT '0' NOT NULL, `alteriscuri` text CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL, `alteriscuriacceptate` tinyint(1) DEFAULT '0' NOT NULL, `recomandarea` text CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL, `todelete` tinyint(1) DEFAULT '0', `created` date DEFAULT NULL, `modified` date DEFAULT NULL, PRIMARY KEY (`id`), KEY `report_id` (`report_id`), KEY `expert_id` (`expert_id`)) DEFAULT CHARSET=utf8, COLLATE=utf8_general_ci, ENGINE=InnoDB; CREATE TABLE `saraptama`.`subreports_celems` ( `id` int(10) NOT NULL AUTO_INCREMENT, `subreport_id` int(10) NOT NULL, `celem_id` int(10) NOT NULL, PRIMARY KEY (`id`), KEY `subreport_id` (`subreport_id`), KEY `celem_id` (`celem_id`)) DEFAULT CHARSET=utf8, COLLATE=utf8_general_ci, ENGINE=InnoDB; CREATE TABLE `saraptama`.`subreports_pelems` ( `id` int(10) NOT NULL AUTO_INCREMENT, `subreport_id` int(10) NOT NULL, `pelem_id` int(10) NOT NULL, PRIMARY KEY (`id`), KEY `subreport_id` (`subreport_id`), KEY `pelem_id` (`pelem_id`)) DEFAULT CHARSET=utf8, COLLATE=utf8_general_ci, ENGINE=InnoDB; CREATE TABLE `saraptama`.`templates` ( `id` int(10) NOT NULL AUTO_INCREMENT, `name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `header` text CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL, `footer` text CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL, `headerpdf` text CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL, `footerpdf` text CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL, `date` date DEFAULT NULL, `datetext` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL, `created` date DEFAULT NULL, `modified` date DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`)) DEFAULT CHARSET=utf8, COLLATE=utf8_general_ci, ENGINE=InnoDB;
ALTER TABLE `reoccurrences` MODIFY COLUMN `name` VARCHAR(30) NOT NULL DEFAULT ''; ALTER TABLE `days` MODIFY COLUMN `reoccurrence` VARCHAR(30) NOT NULL DEFAULT ''; ALTER TABLE `dates` MODIFY COLUMN `reoccurrence` VARCHAR(30) NOT NULL DEFAULT '';
CREATE FOREIGN TABLE ft_accruals_b2b ( cfo bigint NULL, account bigint NULL, inn bigint NULL, client_name text NULL, contract_num text NULL, contract_detail text NULL, segent_type text NULL, serv_code text NULL, r_code text NULL, accrual_sum_vo_vat double precision NULL, negative_correction_sum_vo_vat double precision NULL, positive_correction_sum_vo_vat double precision NULL, correcting_period double precision NULL, serv_number double precision NULL, comment text NULL, related_accounts text NULL, file text NULL, accrual_sum_vo_vat2 double precision NULL, id integer ) SERVER postgres_fdw_server OPTIONS (schema_name 'public', table_name 'accruals_b2b');
PARAMETERS [@DocumentoID] Text (255), [@DocumentoItem] INTEGER; SELECT A.DocumentoID, A.Item, Format(A.Cantidad,"#,##0.00;(#,##0.00)") AS Cantidad, A.MonedaSimbolo+Format(A.PrecioUnitario,"#,##0.00;(#,##0.00)") AS PrecioUnitario, Format(A.Cantidad-iif(isnull(B.Asignado),0,B.Asignado),"#,##0.00;(#,##0.00)") AS Saldo, A.FechaCompra FROM (SELECT A.DocumentoID, A.Item, A.Cantidad, A.PrecioUnitario, cdate(format(B.FechaEmisionID,"####-##-##")) AS FechaCompra, C.MonedaSimbolo FROM (TB_CompraDetalle A LEFT JOIN TB_Compra B ON A.DocumentoID=B.DocumentoID) LEFT JOIN TB_Moneda C ON B.MonedaID=C.MonedaID WHERE (A.DocumentoID =[@DocumentoID] OR [@DocumentoID] IS NULL) AND (Item=[@DocumentoItem] OR [@DocumentoItem] IS NULL) AND A.ProductoID IS NOT NULL ) AS A LEFT JOIN (SELECT A.DocumentoID, A.DocumentoItem, SUM(Cantidad) AS Asignado FROM TB_IngresoInventarioDetalle A WHERE (A.DocumentoID=[@DocumentoID] OR [@DocumentoID] IS NULL) AND (A.DocumentoItem=[@DocumentoItem] OR [@DocumentoItem] IS NULL) GROUP BY A.DocumentoID, A.DocumentoItem) AS B ON (A.DocumentoID=B.DocumentoID) AND (A.Item=B.DocumentoItem)
create view employee_positions AS Select employees.id AS employee_id, first_name, last_name, title FROM employees LEFT JOIN titles on employees.title_id=titles.id
DROP DATABASE IF EXISTS `studentenhuis`; CREATE DATABASE `studentenhuis`; USE `studentenhuis`; -- studentenhuis_user aanmaken CREATE USER 'studentenhuis_user'@'%' IDENTIFIED BY 'secret'; CREATE USER 'studentenhuis_user'@'localhost' IDENTIFIED BY 'secret'; -- geef rechten aan deze user GRANT SELECT, INSERT, DELETE, UPDATE ON `studentenhuis`.* TO 'studentenhuis_user'@'%'; GRANT SELECT, INSERT, DELETE, UPDATE ON `studentenhuis`.* TO 'studentenhuis_user'@'localhost'; -- ----------------------------------------------------- -- Table `users` -- ----------------------------------------------------- DROP TABLE IF EXISTS `user` ; CREATE TABLE IF NOT EXISTS `user` ( `ID` INT UNSIGNED NOT NULL AUTO_INCREMENT, `Voornaam` VARCHAR(32) NOT NULL, `Achternaam` VARCHAR(32) NOT NULL, `Email` VARCHAR(32) NOT NULL, `Password` CHAR(64) BINARY NOT NULL, PRIMARY KEY (`ID`) ) ENGINE = InnoDB; -- Voorbeeld insert query. Wanneer je in Nodejs de ? variant gebruikt hoeven de '' niet om de waarden. -- Zet die dan wel in het array er na, in de goede volgorde. -- In je Nodejs app zou het password wel encrypted moeten worden. INSERT INTO `user` (Voornaam, Achternaam, Email, Password) VALUES ('Jan', 'Smit', 'jsmit@server.nl', 'secret'); -- ----------------------------------------------------- -- Table `studentenhuis` -- ----------------------------------------------------- DROP TABLE IF EXISTS `studentenhuis` ; CREATE TABLE IF NOT EXISTS `studentenhuis` ( `ID` INT UNSIGNED NOT NULL AUTO_INCREMENT, `Naam` VARCHAR(32) NOT NULL, `Adres` VARCHAR(32) DEFAULT 'hier het adres', `UserID` INT UNSIGNED NOT NULL, PRIMARY KEY (`ID`) ) ENGINE = InnoDB; ALTER TABLE `studentenhuis` ADD CONSTRAINT `fk_studentenhuis_user` FOREIGN KEY (`UserID`) REFERENCES `user` (`ID`) ON DELETE NO ACTION ON UPDATE CASCADE; -- Voorbeeld insert query. Wanneer je in Nodejs de ? variant gebruikt hoeven de '' niet om de waarden. INSERT INTO `studentenhuis` (Naam, Adres, UserID) VALUES ('Lovensdijk', 'Lovensdijkstraat, Breda', 1); -- ----------------------------------------------------- -- Table `maaltijd` -- ----------------------------------------------------- DROP TABLE IF EXISTS `maaltijd` ; CREATE TABLE IF NOT EXISTS `maaltijd` ( `ID` INT UNSIGNED NOT NULL AUTO_INCREMENT, `Naam` VARCHAR(32) NOT NULL, `Beschrijving` VARCHAR(64) NOT NULL, `Ingredienten` VARCHAR(64) NOT NULL, `Allergie` VARCHAR(32) NOT NULL, `Prijs` INT UNSIGNED NOT NULL, `UserID` INT UNSIGNED NOT NULL, `StudentenhuisID` INT UNSIGNED NOT NULL, PRIMARY KEY (`ID`) ) ENGINE = InnoDB; ALTER TABLE `maaltijd` ADD CONSTRAINT `fk_maaltijd_user` FOREIGN KEY (`UserID`) REFERENCES `user` (`ID`) ON DELETE NO ACTION ON UPDATE CASCADE, ADD CONSTRAINT `fk_maaltijd_studentenhuis` FOREIGN KEY (`StudentenhuisID`) REFERENCES `studentenhuis` (`ID`) ON DELETE NO ACTION ON UPDATE CASCADE; -- Voorbeeld insert query. INSERT INTO `maaltijd` (Naam, Beschrijving, Ingredienten, Allergie, Prijs, UserID, StudentenhuisID) VALUES ('Zuurkool met worst', 'Zuurkool a la Montizaan, specialiteit van het huis.', 'Zuurkool, worst, spekjes', 'Lactose, gluten', 5, 1, 1); -- ----------------------------------------------------- -- Table `deelnemers` -- Bevat de users die deelnemen aan een maaltijd in een studentenhuis. -- -- ----------------------------------------------------- DROP TABLE IF EXISTS `deelnemers` ; CREATE TABLE IF NOT EXISTS `deelnemers` ( `UserID` INT UNSIGNED NOT NULL, `StudentenhuisID` INT UNSIGNED NOT NULL, `MaaltijdID` INT UNSIGNED NOT NULL, PRIMARY KEY (`UserID`, `StudentenhuisID`, `MaaltijdID`) ) ENGINE = InnoDB; ALTER TABLE `deelnemers` ADD CONSTRAINT `fk_deelnemers_user` FOREIGN KEY (`UserID`) REFERENCES `user` (`ID`) ON DELETE NO ACTION ON UPDATE CASCADE, ADD CONSTRAINT `fk_deelnemers_studentenhuis` FOREIGN KEY (`StudentenhuisID`) REFERENCES `studentenhuis` (`ID`) ON DELETE NO ACTION ON UPDATE CASCADE, ADD CONSTRAINT `fk_deelnemers_maaltijd` FOREIGN KEY (`MaaltijdID`) REFERENCES `maaltijd` (`ID`) ON DELETE NO ACTION ON UPDATE CASCADE; -- Voorbeeld insert query. -- Let op: je kunt je maar één keer aanmelden voor een maaltijd in een huis. -- Je kunt je natuurlijk wel afmelden en opnieuw aanmelden. . INSERT INTO `deelnemers` (UserID, StudentenhuisID, MaaltijdID) VALUES (1, 1, 1); -- Voorbeeld van afmelden: DELETE FROM `deelnemers` WHERE UserID = 1 AND StudentenhuisID = 1 AND MaaltijdID = 1; -- En opnieuw aanmelden: INSERT INTO `deelnemers` (UserID, StudentenhuisID, MaaltijdID) VALUES (1, 1, 1); -- ----------------------------------------------------- -- View om deelnemers bij een maaltijd in een studentenhuis in te zien. -- -- ----------------------------------------------------- CREATE OR REPLACE VIEW `view_studentenhuis` AS SELECT `studentenhuis`.`ID`, `studentenhuis`.`Naam`, `studentenhuis`.`Adres`, CONCAT(`user`.`Voornaam`, ' ', `user`.`Achternaam`) AS `Contact`, `user`.`Email` FROM `studentenhuis` LEFT JOIN `user` ON `studentenhuis`.`UserID` = `user`.`ID`; SELECT * FROM `view_studentenhuis`; -- ----------------------------------------------------- -- View om deelnemers bij een maaltijd in een studentenhuis in te zien. -- -- ----------------------------------------------------- CREATE OR REPLACE VIEW `view_deelnemers` AS SELECT `deelnemers`.`StudentenhuisID`, `deelnemers`.`MaaltijdID`, `user`.`Voornaam`, `user`.`Achternaam`, `user`.`Email` FROM `deelnemers` LEFT JOIN `user` ON `deelnemers`.`UserID` = `user`.`ID`; -- Voorbeeldquery. SELECT * from `view_deelnemers` WHERE StudentenhuisID = 1 AND MaaltijdID = 1;
--// Add_Follow_table -- Migration SQL that makes the change goes here. create table Follower ( id varchar(36) not null, updatedOn bigint unsigned not null, createdOn bigint unsigned not null, ref varchar(255) not null, refId varchar(36) not null, echoedUserId varchar(36) not null, primary key (id)); create index ref_refId on Follower (ref, refId); create index echoedUserId on Follower (echoedUserId); --//@UNDO -- SQL to undo the change goes here. drop table Follower;
-- NotificationConstruct INSERT INTO public."ClassificationTypeCategory"("ClassificationTypeCategoryID", "Name") VALUES (8900000,'NotificationConstructTypeID'); INSERT INTO public."ClassificationTypeCategory"("ClassificationTypeCategoryID", "Name") VALUES (101,'NotificationConstructSubTypeID'); INSERT INTO public."ClassificationTypeCategory"("ClassificationTypeCategoryID", "Name") VALUES (102,'NotificationConstructCategoryID'); INSERT INTO public."ClassificationTypeCategory"("ClassificationTypeCategoryID", "Name") VALUES (103,'NotificationConstructSubCategoryID'); INSERT INTO public."ClassificationTypeCategory"("ClassificationTypeCategoryID", "Name") VALUES (8900003,'NotificationStatusID'); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (4987,'New','',8900003,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (4988,'Sent','',8900003,true,false); INSERT INTO public."ClassificationTypeCategory"("ClassificationTypeCategoryID", "Name") VALUES (105,'NotificationExportFormatID'); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (4989,'HTML','',8900002,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (4990,'HTML5','',8900002,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (4991,'PDF','',8900002,true,false); INSERT INTO public."ClassificationTypeCategory"("ClassificationTypeCategoryID", "Name") VALUES (8900001,'NotificationDeliveryMethodID'); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (4992,'Email','',8900001,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (4993,'System','',8900001,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (4994,'Alert','',8900000,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (4993,'Task','',8900000,true,false); -- Product INSERT INTO public."ClassificationTypeCategory"("ClassificationTypeCategoryID", "Name") VALUES (110,'ProductTypeID'); INSERT INTO public."ClassificationType"("Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES ('Supplier Product','',110,true,false); INSERT INTO public."ClassificationTypeCategory"("ClassificationTypeCategoryID", "Name") VALUES (111,'ProductSubTypeID'); INSERT INTO public."ClassificationTypeCategory"("ClassificationTypeCategoryID", "Name") VALUES (112,'ProductCategoryID'); INSERT INTO public."ClassificationTypeCategory"("ClassificationTypeCategoryID", "Name") VALUES (113,'ProductSubCategoryID'); -- Subscription INSERT INTO public."ClassificationTypeCategory"("ClassificationTypeCategoryID", "Name") VALUES (8001,'SubscriptionStatusID'); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (800100,'Future','',8001,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (800101,'In Trial','',8001,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (800102,'Active','',8001,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (800103,'Non Renewing','',8001,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (800104,'Cancelled','',8001,true,false); INSERT INTO public."ClassificationTypeCategory"("ClassificationTypeCategoryID", "Name") VALUES (8002,'CancelReasonID'); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (800200,'Not Paid','',8002,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (800201,'No Card','',8002,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (800202,'Fraud Review Failed','',8002,true,false); -- Payment Method INSERT INTO public."ClassificationTypeCategory"("ClassificationTypeCategoryID", "Name") VALUES (8003,'PaymentMethodID'); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (8500,'Card','',8003,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (8501,'BACS','',8003,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (8502,'Direct Debit','',8003,true,false); -- Transaction Type INSERT INTO public."ClassificationTypeCategory"("ClassificationTypeCategoryID", "Name") VALUES (8004,'TransactionTypeID'); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (800300,'Charge','',8004,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (800301,'Payment','',8004,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (800302,'Refund','',8004,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (800303,'Payment Authorisation','',8004,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (800304,'Adjustment','',8004,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (800305,'Info','',8004,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (800306,'Credit','',8004,true,false); -- transaction charge type INSERT INTO public."ClassificationTypeCategory"("ClassificationTypeCategoryID", "Name") VALUES (8799,'TransactionChargeTypeID'); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (800400,'One Time','',8799,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (800401,'Delay Capture','',8799,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (800402,'Initial','',8799,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (800403,'Metered','',8799,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (800404,'Quantity Based Component','',8799,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (800405,'On Off Component','',8799,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (800406,'Tax','',8799,true,false); -- Period INSERT INTO public."ClassificationTypeCategory"("ClassificationTypeCategoryID", "Name") VALUES (8006,'PeriodUnitID'); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (800500,'Week','',8006,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (800501,'Month','',8006,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (800502,'Year','',8006,true,false); -- Plan Status INSERT INTO public."ClassificationTypeCategory"("ClassificationTypeCategoryID", "Name") VALUES (8007,'PlanStatusID'); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (800600,'Active','',8007,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (800601,'Archived','',8007,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (800602,'Deleted','',8007,true,false); -- discount type INSERT INTO public."ClassificationTypeCategory"("ClassificationTypeCategoryID", "Name") VALUES (8008,'DiscountTypeID'); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (800800,'Fixed Amount','',8008,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (800801,'Percentage','',8008,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (800802,'Offer Quantity','',8008,true,false); INSERT INTO public."ClassificationTypeCategory"("ClassificationTypeCategoryID", "Name") VALUES (8009,'DurationTypeID'); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (800700,'One Time','',8009,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (800701,'Forever','',8009,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (800702,'Limited Period','',8009,true,false); -- discount status INSERT INTO public."ClassificationTypeCategory"("ClassificationTypeCategoryID", "Name") VALUES (8010,'DiscountStatusID'); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (800900,'Active','',8010,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (800901,'Expired','',8010,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (800902,'Archived','',8010,true,false); INSERT INTO public."ClassificationTypeCategory"("ClassificationTypeCategoryID", "Name") VALUES (8011,'DiscountAppliedOnID'); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (801000,'Invoice Amount','',8011,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (801001,'Specified Items Total','',8011,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (801002,'Each Specified Item','',8011,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (801003,'Each Unit of Specified Item','',8011,true,false); -- billing INSERT INTO public."ClassificationTypeCategory"("ClassificationTypeCategoryID", "Name") VALUES (8012,'BillingChargeTypeID'); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (801100,'Direct Debit','',8012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (801101,'BACS','',8012,true,false); -- Ledger type INSERT INTO public."ClassificationTypeCategory"("ClassificationTypeCategoryID", "Name") VALUES (8500,'LedgerAccountTypeID'); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (801200,'Deposit','',8500,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (801201,'Sales','',8500,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (801202,'Purchasing','',8500,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (801203,'Merchant','',8500,true,false); -- payment method type INSERT INTO public."ClassificationTypeCategory"("ClassificationTypeCategoryID", "Name") VALUES (8501,'PaymentMethodTypeID'); INSERT INTO public."ClassificationType"("ClassificationTypeID", "Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (8000, 'Credit Card','',8501,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (8001,'Debit Card','',8501,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (8002,'Direct Debit','',8501,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (8003,'BACS','',8501,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (8004,'Pre Authentication','',8501,true,false); -- card type INSERT INTO public."ClassificationTypeCategory"("ClassificationTypeCategoryID", "Name") VALUES (9001,'PaymentCardTypeID'); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (9000,'Visa Credit','',9001,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (9001,'Visa Debit','',9001,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (9002,'Visa Business','',9001,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (9003,'Visa UK Electron','',9001,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (9004,'MasterCard Credit','',9001,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (9005,'MasterCard Debit','',9001,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (9006,'Maestro','',9001,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (9007,'MasterCard Business','',9001,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (9008,'Diners','',9001,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (9009,'American Express','',9001,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (9020,'Other','',9001,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (9050,'Pre Authentication','',9001,true,false); -- bus message INSERT INTO public."ClassificationTypeCategory"("ClassificationTypeCategoryID", "Name") VALUES (10000,'BusMessageTypeID'); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (801300,'Atomic','',10000,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (801301,'Scheduled','',10000,true,false); -- bus message status INSERT INTO public."ClassificationTypeCategory"("ClassificationTypeCategoryID", "Name") VALUES (10001,'BusMessageStatusID'); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (801400,'Completed','',10001,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (801401,'Failed','',10001,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (801402,'Received','',10001,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (801403,'Sent','',10001,true,false); -- invoice type INSERT INTO public."ClassificationTypeCategory"("ClassificationTypeCategoryID", "Name") VALUES (8801,'InvoiceTypeID'); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (801500,'Scheduled','',8801,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (801501,'Manual','',8801,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (801502,'Online','',8801,true,false); -- invoice line item type INSERT INTO public."ClassificationTypeCategory"("ClassificationTypeCategoryID", "Name") VALUES (8802,'InvoiceLineItemTypeID'); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (801600,'Product','',8802,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (801601,'Plan Subscription','',8802,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (801602,'Credit Note','',8802,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (801603,'Debit Note','',8802,true,false); -- Invoice Category ID -- invoice line item type INSERT INTO public."ClassificationTypeCategory"("ClassificationTypeCategoryID", "Name") VALUES (8803,'InvoiceAccountingStatusID'); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (801700,'Paid Late','',8803,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (801701,'Arrears (BACS Only)','',8803,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (801702,'DD Returned','',8803,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (801703,'Credit Note','',8803,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (801704,'Written Off','',8803,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (801705,'Paid','',8803,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (801706,'Pending','',8803,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (801707,'Invoice Withdrawn','',8803,true,false); ----- ------- STS STUFF --- -- Actor INSERT INTO public."ClassificationTypeCategory"("ClassificationTypeCategoryID", "Name") VALUES (810000,'ActorTypeID'); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (810001,'STS','',810000,true,false); INSERT INTO public."ClassificationTypeCategory"("ClassificationTypeCategoryID", "Name") VALUES (810101,'ActorSubTypeID'); INSERT INTO public."ClassificationTypeCategory"("ClassificationTypeCategoryID", "Name") VALUES (810202,'ActorCategoryID'); INSERT INTO public."ClassificationTypeCategory"("ClassificationTypeCategoryID", "Name") VALUES (810303,'ActorSubCategoryID'); -- Search Categories INSERT INTO public."ClassificationTypeCategory"("ClassificationTypeCategoryID", "Name") VALUES (870000,'InviteTypeID'); INSERT INTO public."ClassificationTypeCategory"("ClassificationTypeCategoryID", "Name") VALUES (870001,'InviteSubTypeID'); INSERT INTO public."ClassificationTypeCategory"("ClassificationTypeCategoryID", "Name") VALUES (870002,'InviteCategoryID'); INSERT INTO public."ClassificationTypeCategory"("ClassificationTypeCategoryID", "Name") VALUES (870003,'InviteSubCategoryID'); INSERT INTO public."ClassificationTypeCategory"("ClassificationTypeCategoryID", "Name") VALUES (870004,'RejectReasonTypeID'); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (814000,'The address is wrong','',870004,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (814001,'The law firm is wrong','',870004,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (814002,'I am not purchasing a property','',870004,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (814003,'I am not selling a property','',870004,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (814004,'Other','',870004,true,false); INSERT INTO public."ClassificationTypeCategory"("ClassificationTypeCategoryID", "Name") VALUES (870005,'PropertyTenureID'); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (817000,'Freehold','',870005,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (817001,'Leasehold','',870005,true,false); INSERT INTO public."ClassificationTypeCategory"("ClassificationTypeCategoryID", "Name") VALUES (870006,'PropertySellerRelationshipTypeID'); INSERT INTO public."ClassificationTypeCategory"("ClassificationTypeCategoryID", "Name") VALUES (870007,'StsActorPrimarySecondaryRelationshipTypeID'); INSERT INTO public."ClassificationTypeCategory"("ClassificationTypeCategoryID", "Name") VALUES (870008,'DepositFromTypeID'); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (818000,'Gift','',870008,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (818001,'Saving','',870008,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (818002,'Loan','',870008,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (818003,'Proceed from Sale','',870008,true,false); INSERT INTO public."ClassificationTypeCategory"("ClassificationTypeCategoryID", "Name") VALUES (870009,'PlaceSeenMortgageBrokerTypeID'); INSERT INTO public."ClassificationTypeCategory"("ClassificationTypeCategoryID", "Name") VALUES (870010,'RegisteredProprietorTypeID'); INSERT INTO public."ClassificationTypeCategory"("ClassificationTypeCategoryID", "Name") VALUES (870011,'SellingUnderAuthorityTypeID'); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (871101,'Probate','',870011,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (871102,'Power of Attorney','',870011,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (871103,'Court Protection order','',870011,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (871104,'Registered Proprietor','',870011,true,false); INSERT INTO public."ClassificationTypeCategory"("ClassificationTypeCategoryID", "Name") VALUES (870012,'LenderID'); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877000,'Abbey National Building Society','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877001,'Alliance & Leicester','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877002,'Amber Homeloans','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877003,'Bank of Ireland','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877004,'Bank of Scotland','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877005,'Barclays','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877006,'Barnsley Building Society','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877007,'The Bath Building Society','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877008,'The Beverley Building Society','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877009,'Birmingham Midshires','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877010,'Bradford & Bingley Building Society','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877011,'Bristol & West','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877012,'Britannia','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877013,'The Buckinghamshire Building Society','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877014,'The Cambridge Building Society','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877015,'Capital Home Loans','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877016,'The Chelsea Building Society','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877017,'The Cheltenham and Gloucester Building Society','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877018,'Chesham Building Society','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877019,'The Cheshire Building Society','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877020,'The Chorley & District Building Society','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877021,'Co-operative Insurance (CIS)','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877022,'Clydesdale Bank','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877023,'The Co-operative Bank','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877024,'Coventry Building Society','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877025,'Cumberland Building Society','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877026,'Darlington Building Society','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877027,'The Derbyshire','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877028,'Direct Line','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877029,'Dudley Building Society','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877030,'Dunfermline Building Society','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877031,'Earl Shilton Building Society','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877032,'Ecology Building Society','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877033,'Egg','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877034,'First Active','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877035,'First Direct','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877036,'First National','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877037,'First Trust Bank','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877038,'Furness Building Society','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877039,'Future Mortgages','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877040,'GMAC-RFC','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877041,'Halifax','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877042,'The Hanley Building Society','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877043,'Hinckley and Rugby Building Society','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877044,'Holmesdale Building Society','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877045,'HSBC','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877046,'iGroup','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877047,'ING Direct','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877048,'Intelligent Finance','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877049,'Ipswich Building Society','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877050,'Irish Permanent','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877051,'Kensington Mortgages','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877052,'Kent Reliance','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877053,'The Lambeth Building Society','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877054,'The Leeds Building Society','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877055,'Leek United Building Society','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877056,'Legal & General','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877057,'London Mortgage Company','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877058,'Loughborough','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877059,'The Mansfield Building Society','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877060,'The Market Harborough Building Society','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877061,'The Marsden Building Society','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877062,'Melton Mowbray Building Society','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877063,'Mercantile Building Society','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877064,'Monmouthshire Building Society','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877065,'The Mortgage Lender','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877066,'Mortgage Trust','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877067,'Mortgage Works','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877068,'Mortgages PLC','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877069,'National Counties Building Society','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877070,'Nationwide Building Society','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877071,'NatWest','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877072,'Newbury Building Society','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877073,'Newcastle Building Society','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877074,'Northern Bank','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877075,'Northern Rock','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877076,'The Norwich and Peterborough Building Society','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877077,'Nottingham Building Society','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877078,'The One Account','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877079,'Paragon Mortgages','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877080,'Penrith Building Society','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877081,'Pink Home Loans','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877082,'Principality','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877083,'Progressive Building Society','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877084,'Prudential','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877085,'The Royal Bank of Scotland','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877086,'Saffron Walden Hertfordshire and Essex Building Society','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877087,'Santander','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877088,'Scottish Building Society','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877089,'Scottish Widows Bank','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877090,'Skipton Building Society','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877091,'Southern Pacific','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877092,'Stafford Railway Building Society','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877093,'Standard Life Bank','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877094,'Stroud & Swindon','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877095,'Swansea Building Society','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877096,'Teachers Building Society','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877097,'Tesco','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877098,'Universal Building Society','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877099,'West Bromwich Building Society','',870012,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (877100,'The Woolwich Bank','',870012,true,false); INSERT INTO public."ClassificationTypeCategory"("ClassificationTypeCategoryID", "Name") VALUES (870013,'IDDocumentTypeID'); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (871300, ' Current valid UK/EU passport','',870013,true, false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (871301,' Current UK/EU photo card driving licence','',870013,true, false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (871302,' Current full UK driving licence (old paper style)','',870013,true, false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (871303,' Non EU passport & Residents visa','',870013,true, false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (871304,' Firearms certifcate','',870013,true, false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (871305,' Most recent mortgage statement','',870013,true, false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (871306,' Current year Local Authority Council Tax bill','',870013,true, false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (871307,' Local Authority rent card or tenancy agreement','',870013,true, false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (871308,' Bank/building society/credit union statement or passbook','',870013,true, false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (871309,' Utility Bill','',870013,true, false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (871310,' Current valid UK/EU passport','',870013,true, false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (871311,' Current UK/EU photo card driving licence','',870013,true, false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (871312,' Inland Revenue tax coding notications','',870013,true, false); INSERT INTO public."ClassificationTypeCategory"("ClassificationTypeCategoryID", "Name") VALUES (870014,'IDDocumentCategoryTypeID'); INSERT INTO public."ClassificationTypeCategory"("ClassificationTypeCategoryID", "Name") VALUES (870015,'IDDocumentCertifiedByTypeID'); INSERT INTO public."ClassificationTypeCategory"("ClassificationTypeCategoryID", "Name") VALUES (870016,'InstructedFirmTypeID'); INSERT INTO public."ClassificationTypeCategory"("ClassificationTypeCategoryID", "Name") VALUES (870017,'StsSearchTypeID'); INSERT INTO public."ClassificationTypeCategory"("ClassificationTypeCategoryID", "Name") VALUES (870018,'StsSearchSubTypeID'); INSERT INTO public."ClassificationTypeCategory"("ClassificationTypeCategoryID", "Name") VALUES (870019,'StsSearchCategoryID'); INSERT INTO public."ClassificationTypeCategory"("ClassificationTypeCategoryID", "Name") VALUES (870020,'StsSearchSubCategoryID'); INSERT INTO public."ClassificationTypeCategory"("ClassificationTypeCategoryID", "Name") VALUES (870021,'StsPropertyTypeID'); INSERT INTO public."ClassificationTypeCategory"("ClassificationTypeCategoryID", "Name") VALUES (870022,'StsPropertySubTypeID'); -- Notification Group Type INSERT INTO public."ClassificationTypeCategory"("ClassificationTypeCategoryID", "Name") VALUES (670001,'NotificationGroupTypeID'); INSERT INTO public."ClassificationTypeCategory"("ClassificationTypeCategoryID", "Name") VALUES (670002,'NotificationGroupCategoryID'); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (670100,'General','',670001,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (670101,'TermsConditions','',670001,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (670200,'General','',670002,true,false); -- First Data INSERT INTO public."ClassificationTypeCategory"("ClassificationTypeCategoryID", "Name") VALUES (1000000,'ErrorCodeTypeID'); INSERT INTO public."ClassificationTypeCategory"("ClassificationTypeCategoryID", "Name") VALUES (1001000,'ErrorCodeCategoryID'); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (1000001,'FirstData Gateway','',1000000,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (1000002,'FirstData Card Issuer','',1000000,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (1000003,'LREnquiryByPropertyDescription','',1000000,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (1000004,'LRRegisterExtractService','',1000000,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (1000005,'LROfficialCopyTitleKnown','',1000000,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (1000006,'LROfficialSearchWholeWithPriority','',1000000,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (1000007,'LROfficialSearchPartWithPriority','',1000000,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (1001001,'FirstData','',1001000,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (1001002,'LandRegistry','',1001000,true,false); -- Transaction Gateway ID INSERT INTO public."ClassificationTypeCategory"("ClassificationTypeCategoryID", "Name") VALUES (1100000,'TransactionGatewayID'); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (1100000,'FirstData Merchant Gateway','',1100000,true,false); -- LRPropertyTenureTypeID INSERT INTO public."ClassificationTypeCategory"("ClassificationTypeCategoryID", "Name") VALUES (2100000,'LRPropertyTenureTypeID'); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (2100001,'Freehold','',2100000,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (2100002,'Other','',2100000,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (2100003,'Leasehold','',2100000,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (2100004,'Commonhold','',2100000,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (2100005,'Feuhold','',2100000,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (2100006,'Mixed','',2100000,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (2100007,'Unknown','',2100000,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (2100008,'Unavailable','',2100000,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (2100009,'Caution Against First Registration','',2100000,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (2100010,'Rent Charge','',2100000,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (2100011,'Franchise','',2100000,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (2100012,'Profit A Prendre In Gross','',2100000,true,false); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (2100013,'Manor','',2100000,true,false); INSERT INTO public."ClassificationType"("Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES ('LRDocument','',40,true,false); -- Service Interface Type ID INSERT INTO public."ClassificationTypeCategory"("ClassificationTypeCategoryID", "Name") VALUES (2200001,'ServiceInterfaceTypeID'); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (2200001,'Land Registry','',2200001,true,false); -- Service Definition Type ID INSERT INTO public."ClassificationTypeCategory"("ClassificationTypeCategoryID", "Name") VALUES (2200002,'ServiceDefinitionTypeID'); INSERT INTO public."ClassificationType"("ClassificationTypeID","Name", "Description", "ClassificationTypeCategoryID", "IsActive", "IsDeleted") VALUES (2200002,'Land Registry Service','',2200002,true,false);
-- -------------------------------------------------------- -- -- Estrutura da tabela `tb_pessoa_juridica` -- CREATE TABLE `tb_pessoa_juridica` ( `Pessoa` int(11) NOT NULL, `razaosocial` varchar(60) DEFAULT NULL, `cnpj` varchar(14) DEFAULT NULL, `incricaoestadual` varchar(20) DEFAULT NULL, `atividade` int(11) DEFAULT NULL, `homepage` varchar(255) DEFAULT NULL, `representante` varchar(45) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-- DropIndex DROP INDEX "Community_userId_unique"; -- CreateTable CREATE TABLE "Event" ( "id" SERIAL NOT NULL, "email" TEXT NOT NULL, "name" TEXT, "communityId" INTEGER NOT NULL, PRIMARY KEY ("id") ); -- CreateIndex CREATE UNIQUE INDEX "Event.email_unique" ON "Event"("email"); -- AddForeignKey ALTER TABLE "Event" ADD FOREIGN KEY ("communityId") REFERENCES "Community"("id") ON DELETE CASCADE ON UPDATE CASCADE;
select * from tariffcode where tc_jsonb->>'tc_status' = any(string_to_array($1,',')::text[])
-- update context mapping info table with owner id (deployment id) for per process instance strategies alter table ContextMappingInfo add column OWNER_ID varchar(255); update ContextMappingInfo set OWNER_ID = (select externalId from ProcessInstanceLog where processInstanceId = cast(CONTEXT_ID as int8)); create table AuditTaskImpl ( id int8 not null, activationTime date, actualOwner varchar(255), createdBy varchar(255), createdOn date, deploymentId varchar(255), description varchar(255), dueDate date, name varchar(255), parentId int8 not null, priority int4 not null, processId varchar(255), processInstanceId int8 not null, processSessionId int4 not null, status varchar(255), taskId int8, primary key (id)); create sequence AUDIT_ID_SEQ;
/* SQLyog Professional v13.1.1 (64 bit) MySQL - 10.1.36-MariaDB : Database - transport ********************************************************************* */ /*!40101 SET NAMES utf8 */; /*!40101 SET SQL_MODE=''*/; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; CREATE DATABASE /*!32312 IF NOT EXISTS*/`transport` /*!40100 DEFAULT CHARACTER SET latin1 */; USE `transport`; /*Table structure for table `admins` */ DROP TABLE IF EXISTS `admins`; CREATE TABLE `admins` ( `admin_id` int(11) NOT NULL AUTO_INCREMENT, `admin_name` varchar(250) NOT NULL, `password` varchar(512) NOT NULL, `active` tinyint(1) NOT NULL DEFAULT '1', `address` varchar(512) NOT NULL, `email` varchar(50) NOT NULL, `type` int(11) NOT NULL DEFAULT '1', PRIMARY KEY (`admin_id`) ) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=latin1; /*Data for the table `admins` */ insert into `admins`(`admin_id`,`admin_name`,`password`,`active`,`address`,`email`,`type`) values (1,'admin','123',1,'dasdadasd ','1674745213',1), (2,'user','123',0,'69 penistreet dhaka 420','1164521',2), (3,'Rafman','FatD111',1,'datascet','11114444',1), (4,'ad','12',1,'New Bitch','2621462',1), (5,'Shukla','1',0,'dadadadad','14648721',2), (6,'test','test',1,'test','123',1), (7,'TestUser','123',1,'test123','123',1), (8,'test123','123',1,'1234','test1234@gmail.com',2), (9,'test234','123',1,'Beijin1','1234565',2), (10,'test124','123',1,'test124','test124@gmail.com',2); /*Table structure for table `booking_history` */ DROP TABLE IF EXISTS `booking_history`; CREATE TABLE `booking_history` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(30) DEFAULT NULL, `phone` varchar(30) DEFAULT NULL, `email` varchar(50) DEFAULT NULL, `card_number` varchar(30) DEFAULT NULL, `card_code` varchar(30) DEFAULT NULL, `departure` date DEFAULT NULL, `return` date DEFAULT NULL, `bus_id` varchar(30) DEFAULT NULL, `costs` float DEFAULT '0', `fees` float DEFAULT '0', `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1; /*Data for the table `booking_history` */ insert into `booking_history`(`id`,`name`,`phone`,`email`,`card_number`,`card_code`,`departure`,`return`,`bus_id`,`costs`,`fees`,`created_at`) values (1,'123','123','123','123','123','2021-01-04','2020-12-23','123',600,60,'2021-01-25 17:37:57'), (2,'123','123','123','123','123','2021-01-25','2021-01-25','123',0,0,'2021-01-25 17:41:44'), (3,'456','456','456','456','456','2021-01-25','2021-01-28','MM-66',200,20,'2021-01-25 20:53:05'), (4,'test456','456','test@gmail.com','123','123','2021-01-25','2021-01-28','MM-66',200,20,'2021-01-25 21:03:58'), (5,'Luqman','+1234567','luqman@gmail.com','CVC123','123456','2021-01-26','2021-01-29','MM-66',200,20,'2021-01-26 08:30:10'); /*Table structure for table `buses` */ DROP TABLE IF EXISTS `buses`; CREATE TABLE `buses` ( `bus_id` int(10) NOT NULL AUTO_INCREMENT, `bus_name` varchar(110) NOT NULL, `model` varchar(110) NOT NULL, `capacity` int(10) DEFAULT '5', `commissioned` date DEFAULT NULL, `active` tinyint(1) NOT NULL DEFAULT '1', PRIMARY KEY (`bus_id`) ) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1; /*Data for the table `buses` */ insert into `buses`(`bus_id`,`bus_name`,`model`,`capacity`,`commissioned`,`active`) values (1,'AAAAA','AAAAAA',5,'2016-08-01',0), (2,'Star-line','MM-66',6,'2016-04-11',1), (3,'GG-Man1','A-55',5,'2016-08-24',1), (5,'Shohah','KK2',5,'2016-08-31',1), (6,'Star-gazer','55-B',5,'2016-08-17',0), (7,'Fantom','778D',5,'2016-08-03',0), (8,'Horn Drill','Fanom-33',5,'2016-08-09',0), (9,'AAAAAA','AAAAAAA',5,NULL,0), (10,'dsfsd','fsdfds',5,NULL,0), (11,'dasadasd','dadadadada',5,NULL,0), (12,'Bus','adadasda',5,NULL,0), (13,'testyyyygfd','tastyyyfsfsd',5,NULL,0), (14,'testbus','123',5,NULL,1), (16,'School Bus','Benz',20,NULL,1); /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
{DEFAULT @first_outcome_only = FALSE } TRUNCATE TABLE #cohort_outcome; DROP TABLE #cohort_outcome; {@first_outcome_only} ? { TRUNCATE TABLE #cohort_excluded_person; DROP TABLE #cohort_excluded_person; }
DROP TABLE LOG CREATE TABLE LOG ( LogId int IDENTITY PRIMARY KEY, LogDate datetime DEFAULT CURRENT_TIMESTAMP, LogLebel nvarchar(12) DEFAULT 'info', LogMessage varchar(max) )
--* File Name : Monitor_Memory.sql --* Author : DR Timothy S Hall --* Description : Displays memory allocations for the current database sessions. --* Requirements : Access to the V$ views. --* Call Syntax : @Monitor_Memory --* Last Modified: 15/07/2000 SELECT NVL(a.username,'{Background Task}') "Username", a.program "Program", Trunc(b.value/1024) "Memory (Kb)" FROM v$session a, v$sesstat b, v$statname c WHERE a.sid = b.sid AND b.statistic# = c.statistic# AND c.name = 'session pga memory' AND a.program IS NOT NULL ORDER BY b.value DESC;
CREATE TABLE WS_USER ( ID int(11) NOT NULL primary key auto_increment, USERNAME VARCHAR(100) NOT NULL, PASSWORD VARCHAR(200) NOT NULL, DATETOKENEXPIRES bigint(20) DEFAULT NULL, ACCOUNTLOCKED tinyint(4) DEFAULT NULL, ROLE VARCHAR(20) DEFAULT NULL ); CREATE TABLE ARTICLE ( ID int(11) NOT NULL primary key auto_increment // TO BE CONTINUED );
INSERT INTO burgers (burger_name) VALUES ('Becaon Burger'), ('Regular Burger'), ('Burger');
CREATE TABLE "user" ( "id" SERIAL PRIMARY KEY, "first_name" VARCHAR(100) NOT NULL, "last_name" VARCHAR(100) NOT NULL, "email" VARCHAR(100) UNIQUE NOT NULL, "password" VARCHAR(1000) DEFAULT '000000' NOT NULL, "auth_code" INT DEFAULT 2 NOT NULL, "is_activated" BOOLEAN DEFAULT TRUE NOT NULL ); CREATE TABLE "bowl_schedule" ( "id" SERIAL PRIMARY KEY, "bowl_date" date NOT NULL, "creator" INT REFERENCES "user", "create_time" timestamp default now(), "updator" INT REFERENCES "user", "update_time" timestamp default now() ); CREATE TABLE "user_bowl_schedule" ( "id" SERIAL PRIMARY KEY, "schedule_id" INT REFERENCES "bowl_schedule", "user_id" INT REFERENCES "user" ); create table "token" ( "id" serial primary key, "name" varchar(200) not null, "content" text not null ); insert into "user" ( "first_name", "last_name", "email", "password", "auth_code" ) values ( 'Mansang', 'Jo', 'jomansang@gmail.com', '1234', '0' ); insert into "bowl_schedule" ( "bowl_date", "creator", "updator" ) values ( '2019-02-28', 1, 1 ), ( '2019-03-07', 1, 1 ), ( '2019-03-14', 1, 1 ), ( '2019-03-21', 1, 1 ); insert into "user_bowl_schedule" ( "schedule_id", "user_id" ) values (1,1),(1,2),(1,3),(1,4),(1,5), (2,6),(2,7),(2,8),(2,9),(2,1), (3,2),(3,3),(3,4),(3,5),(3,6), (4,7),(4,8),(4,9),(4,1),(4,2);
INSERT INTO users (name, avatar, email, password) VALUES ( 'Mrs.Doubtfire', 'https://github.com/zachharrison/helperr/blob/master/front-end/public/avatars/mrs-doubtfire.png?raw=true', 'robinwilliams@ripthegoat.com', 'password' ), ( 'BobTheBuilder', 'https://github.com/zachharrison/helperr/blob/master/front-end/public/avatars/bob-the-builder.png?raw=true', 'Bob@BobsBuilding.com', 'password' ), ( 'Harry n'' Marv', 'https://github.com/zachharrison/helperr/blob/master/front-end/public/avatars/the-wet-bantis-homealone.png?raw=true', 'harrynmarv@notascam.com', 'password' ), ( 'Tom Brady', 'https://github.com/zachharrison/helperr/blob/master/front-end/public/avatars/tom-brady.png?raw=true', 'Tom@balldeflator.com', 'password' ), ( 'Curious George', 'https://github.com/zachharrison/helperr/blob/master/front-end/public/avatars/curious-george-sqr.png?raw=true', 'bannanaboi@msn.org', 'banananana' ); INSERT INTO categories (name, marker) VALUES ('Light-labour', '/hard-hat-solid.svg'), ('Cleaning', '/hand-sparkles-solid.svg'), ('Caregiving', '/baby-carriage-solid.svg'), ('AutoRepair', '/car-crash-solid.svg'), ('MinorRepair', '/tools-solid.svg'), ('Photography', '/camera-retro-solid.svg'), ('Lessons', '/user-graduate-solid.svg'), ('Delivery', '/shipping-fast-solid.svg'), ('Miscellaneous', '/question-solid.svg'); INSERT INTO jobs ( client_id, helper_id, category_id, name, description, lat, lng, price, pay_type, start_date, end_date, status ) VALUES ( 1, 2, 1, 'Furniture mover', 'I have recently purchased a beautiful new couch, and need someone who can help me carry it up 4 flights of stairs to my apartment', 45.631060, -122.671570, 10, ' total', '2021-02-26', '2021-02-27', 'COMPLETED' ), ( 4, 3, 5, 'Need an experience locksmith', 'The kool-aid man kicked our door in and now we need to lock fixed before we leave for a ski trip!', 49.275338, -123.1491361, 200, ' total', '2021-03-04', '2021-03-08', 'COMPLETED' ), ( 1, null, 8, 'Grocery shopping', 'I''m an old lady and need someone to do my grocery shopping and deliver to my house.', 49.278300, -123.126520, 40, '/hr', '2021-02-26', '2021-02-27', 'POSTED' ), ( 2, 1, 3, 'Babysit a lil brat', 'Take care of this POS for me thanks', 49.281290, -123.115121, 100, '/hr', '2021-02-26', '2021-02-27', 'COMPLETED' ), ( 2, null, 9, 'Need marriage counsellor', 'It seems like I can fix just about anything but my marriage, PLEASE HELP!', 48.6150804, -123.419924, 40000, ' total', '2021-02-26', '2021-02-27', 'POSTED' ), ( 2, 4, 7, 'Teach my uncoordinated son to throw a football', 'He''s really bad at sports.. not even sure he''s mine', 49.3042584, -123.1442522, 12000, '/hr', '2021-02-26', '2021-02-27', 'FILLED' ), ( 3, 1, 3, 'Caregiver needed during recovery from fall ', 'We both tripped on some Hotwheels then fell down the stairs onto some Lego.. Need a gentle caregiver to help us eat and go to the washroom during our long road to physical rehabilitation', 49.281290, 123.115121, 100, '/hr', '2021-02-26', '2021-02-27', 'COMPLETED' ), ( 5, null, 7, 'Help me relearn how to use the monkey bars', 'I ate so many Bananas during the quarantine that I can barely get of the couch! Someone, please help me train to use the monkey bars again', 49.2944647, -123.150173, 5, '/hr', '2021-02-26', '2021-02-27', 'POSTED' ), ( 4, 1, 7, 'Teach me how to cook', 'I would love to learn how to cook so that I can feed my family something other than cereal. Someone please teach me how to make an egg without burning it, or myself...', 49.282740, -123.133260, 30, ' total', '2021-02-20', '2021-02-27', 'COMPLETED' ), ( 4, null, 4, 'Put my wheel back on', 'My Harry is learning how to drive and somehow brought the car back home with one less wheel! Would really appreciate if someone could show him how to mount a spare. Make sure it''s on tight this time!', 49.282740, -123.133260, 75, ' total', '2021-02-20', '2021-02-27', 'COMPLETED' ), ( 4, null, 6, 'Need a skilled photoshopper', 'I have just won yet another Super Bowl, and would like all the photos online of me to show me kissing a the Vince Lombardi Trophy!', 49.280470, -123.123200, 3, ' total', '2021-02-26', '2021-02-27', 'POSTED' ), ( 5, null, 2, 'Party Cleanup', 'I invited my moneky pals over and we had a few too many banana flavoured craft beers.. We started throwing Banana peels at eachother then things escalated quickly.. Need someone to help me clean as I can''t stand the smell!', 49.281230, -123.132590, 100, '/hr', '2021-02-24', '2021-03-01', 'POSTED' ), ( 3, 2, 1, 'Fix my broken stove', 'I bought a brand new stove just 3 weeks ago and it has already stopped working. In need of someone handy who can fix it!', 49.272260, -123.153460, 100, ' total', '2021-02-26', '2021-02-27', 'FILLED' ), ( 3, 4, 6, 'LinkedIn headshots', 'Its been a while since we''ve been hired for locksmithing work due to our bad reviews.. Need some professional headshots to spice up our LinkedIn profile!', 49.264080, -123.151230, 70, ' total', '2021-02-26', '2021-03-02', 'COMPLETED' ), ( 3, null, 3, 'Need a caregiver to help us recover from another fall..', 'We were ziplining from our friends bedroom window to his tree house and the rope broke! We feel two stories and broke our legs. Need a caregiver to feed us while we recover ', 49.261320, -123.113940, 200, '/hr', '2021-02-26', '2021-03-19', 'POSTED' ), ( 4, null, 5, 'I put pasta in my toaster, now its broken!', 'My microwave broke after I tried to heat up some cutlery, so I tired to cook pasta in my toaster and now that doesn''t work either.. Someone please fix it!', 49.271600, -123.106500, 100, ' total', '2021-02-26', '2021-03-01', 'POSTED' ), ( 3, null, 8, 'Pickup groceries from Granville market', 'I''ve been meaning to pick up some fresh produce, but haven''t been able to make it down there. Would really appreciate some help!', 49.2727014, -123.1352146, 25, ' total', '2021-02-26', '2021-03-08', 'POSTED' ), ( 4, null, 9, 'Dropped my iphone in the Vancouver aquarium!', 'I need a scuba diver to get it for me, I''ll pay for for however long it takes!', 49.3007961, -123.1309293, 200, '/hr', '2021-02-26', '2021-03-07', 'POSTED' ), ( 5, null, 4, 'Hit a pothole, now my car is upside down!', 'Need a bodybuilder or mechanic to help me flip it back onto its wheels!', 49.275338, -123.1491361, 100, ' total', '2021-02-26', '2021-03-05', 'POSTED' ), ( 3, null, 1, 'Hold the ladder for Chritmas lights', 'Its March already so its about time I get my christmas lights setup!! I need somone to hold the ladder for me!', 49.2900541, -123.1376043, 12, '/hr', '2021-03-15', '2021-03-16', 'POSTED' ), ( 1, 5, 8, 'Need someone to pickup and deliver Banana bread', 'I placed an order for 6 fresh loaves of Banana Bread from the Robson Bakery, please deliver them to my house! Thank you', 49.29118829999999, -123.1347056, 20, ' total', '2021-03-15', '2021-03-16', 'COMPLETED' ); INSERT INTO offers (helper_id, job_id, price, pay_type, status) VALUES (2, 1, 20, '/hr', 'REVIEWED'), (3, 1, 30, '/hr', 'PENDING'), (4, 1, 30, '/hr', 'PENDING'), (4, 2, 150, ' total', 'PENDING'), (3, 2, 20, ' total', 'REVIEWED'), (2, 2, 25, ' total', 'PENDING'), (2, 3, 20, '/hr', 'PENDING'), (4, 3, 100, '/hr', 'PENDING'), (2, 5, 20, '/hr', 'PENDING'), (1, 4, 10, '/hr', 'REVIEWED'), (3, 4, 200, '/hr', 'PENDING'), (4, 4, 20, '/hr', 'PENDING'), (4, 5, 40, '/hr', 'PENDING'), (3, 5, 200, '/hr', 'PENDING'), (3, 6, 1, ' total', 'PENDING'), (4, 6, 100, '/hr', 'ACCEPTED'), (1, 6, 5, '/hr', 'PENDING'), (1, 7, 200, '/hr', 'REVIEWED'), (2, 7, 1212, ' total', 'PENDING'), (4, 8, 200, '/hr', 'PENDING'), (2, 8, 1250, ' total', 'REVIEWED'); INSERT INTO messages (user_id, offer_id, message, timestamp) VALUES ( 2, 1, 'User sent an offer: $10', '2021-02-17T09:14:39.223Z' ), ( 2, 1, 'Hello, I''m interested in your job to help you move your furniture. Let me know I''m available anytime!', '2021-02-18T09:14:45.223Z' ), ( 1, 1, 'Perfect, let''s talk in the morning then', '2021-02-21T09:14:39.223Z' ), ( 1, 15, 'User sent an offer: $2000', '2021-02-20T09:15:39.223Z' ), ( 1, 15, 'Hey, I think I might be able to help you out, I know it''s a tough situation. Let''s chat and see if we might be a good fit', '2021-02-21T09:15:39.223Z' ), ( 3, 15, 'I''m willing to try anything at this point, I know we can get through this! If you''re okay with the price let''s find a time that works.', '2021-02-22T09:15:39.223Z' ), ( 2, 7, 'User sent an offer: $2000', '2021-02-20T09:15:39.223Z' ); INSERT INTO reviews (helper_id, job_id, stars, details, timestamp) VALUES ( 2, 1, 5, 'Bob did such a great job lifting my beautiful victoria era, hardwood, 7 seat sectional couch up the stairs up the 10 flights of stairs to my appartment, I gave him a lemonade as a tip for all his hardwork', '2021-02-27 24:00:00' ), ( 1, 4, 3, 'Mrs.Doubtfire did a great job babysitting.. but she left the toliet seat up and now my wife is asking for a divorce!', '2021-02-27 24:00:00' ), ( 1, 7, 5, 'After Marv and I were seriously injured by some hotwheels Mrs.Doubtfire helped us get back to contracting for our lovely community!', '2021-02-27 24:00:00' ), ( 5, 21, 1, 'I placed an order for 6 fresh loaves of Banana Bread from the Robson Bakery and took a chance on Curious George.. He ate my order and delivered me a loaf of wonderbread wrapped in Banana peels!', '2021-02-27 24:00:00' ), ( 4, 13, 3, 'We booked Tom Brady to spice up our LinkedIn profile with some proffesional headshots so we can start locksmithing again. All the photos he took were actually just selfies of him with his Superbowl rings! He did sign them tho..', '2021-02-27 24:00:00' ), ( 3, 2, 1, 'The kool-aid man kicked our door in right before we left on vacation so we booked Harry and Marv as locksmiths. When we got home our house was flooded and one of my SuperBowl rings was gone. Good thing I have 6 more', '2021-02-27 24:00:00' ); -- VALUES ( -- 2, -- 1, -- 'User sent an offer 2000', -- '2021-02-15T09:13:58.223Z' -- ), -- ( -- 4, -- 2, -- 'User sent an offer 3000', -- '2021-02-16T09:12:38.223Z' -- ), -- ( -- 4, -- 4, -- 'User sent an offer 2000', -- '2021-02-16T09:12:38.223Z' -- ), -- ( -- 3, -- 5, -- 'User sent an offer 20000', -- '2021-02-15T09:12:38.223Z' -- ), -- ( -- 2, -- 5, -- 'User sent an offer 3000', -- '2021-02-17T09:16:42.223Z' -- ), -- ( -- 4, -- 6, -- 'User sent an offer 2500', -- '2021-02-17T09:14:39.223Z' -- ), -- ( -- 2, -- 1, -- 'Hey I am available to fill your babysitting position!', -- '2021-02-17T09:12:38.223Z' -- ), -- ( -- 1, -- 1, -- 'Sounds great!', -- '2021-02-17T09:14:28.223Z' -- ), -- ( -- 3, -- 2, -- 'I am very intrested in your position!', -- '2021-02-18T09:12:38.223Z' -- ), -- ( -- 4, -- 3, -- 'Lets chat tomorrow', -- '2021-02-17T09:12:38.223Z' -- ); -- GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO labber; -- "timestamp": "2021-02-18T09:12:38.223Z",
CREATE TABLE [Live] ( [LiveID] VARCHAR(32) NOT NULL, [GameID] VARCHAR(32) NOT NULL, [LiveName] VARCHAR NOT NULL, [LiveQty] INTEGER DEFAULT ('0'), [LiveText] VARCHAR, [BeginDate] DATE, [PlayerType] VARCHAR, [LiveLink] VARCHAR, [SequenceIndex] INT, CONSTRAINT [sqlite_autoindex_Live_1] PRIMARY KEY ([LiveID])); CREATE INDEX [Index_BeginDate] ON [Live] ([BeginDate] ASC);
-- cards going to expire next month SET @start = DATE_FORMAT(NOW(), '%Y-%m-01') + INTERVAL 1 MONTH; SELECT CONCAT('/admin/core/user/', cor.user_id, ' ', cor.user_id) AS 'user ID', u.email, CONCAT(u.first_name, ' ', u.last_name) AS name, CONCAT('/admin/orderrecurring/', cor.id, ' ', COALESCE(cor.recurring_id, 'None')) AS 'recurring profile ID', DATE_FORMAT(DATE(MIN(t.created_at)), '%Y-%m-%d') AS started, CONCAT(LEFT(cor.exp_date, 2), '-', RIGHT(cor.exp_date, 2)) AS 'expiration date', cor.amount_converted AS 'payment amount', COUNT(DISTINCT t.id) AS payments, SUM(t.amount_converted) AS 'total paid', DATE_FORMAT(DATE(MAX(t.created_at)), '%Y-%m-%d') AS 'last payment date', CAST(IF(cor.status != 'active', cor.status, IF(cor.period = 'months', cor.start + interval ceiling( datediff(current_date() - interval 1 day, cor.start) / 30.4375) month, IF(cor.period = 'weeks', cor.start + interval ceiling(datediff(current_date() - interval 1 day, cor.start) / 7) week, 'unknown'))) AS CHAR(50)) as 'next run date' FROM core_order o JOIN core_orderrecurring cor ON o.id = cor.order_id JOIN core_transaction t ON t.order_id = o.id AND t.type in ('sale', 'credit') AND t.status IN ('completed', '') AND t.success = 1 JOIN core_user u ON u.id = o.user_id WHERE o.status = 'completed' AND cor.status in ('active', 'past_due') AND cor.exp_date = DATE_FORMAT(@start, '%m%y') GROUP BY 1, cor.id ORDER BY 4;
--// add creditWindow -- Migration SQL that makes the change goes here. alter table RetailerSettings add creditWindow integer not null; update RetailerSettings set creditWindow = 168; alter table EchoMetrics add creditWindowEndsAt timestamp not null; update EchoMetrics, Echo set EchoMetrics.creditWindowEndsAt = date_add(Echo.createdOn, interval 168 hour) where EchoMetrics.echoId = Echo.id; --//@UNDO -- SQL to undo the change goes here. alter table RetailerSettings drop creditWindow; alter table EchoMetrics drop creditWindowEndsAt;
CREATE TABLE `mealtype` ( `Id` int NOT NULL AUTO_INCREMENT, `Name` varchar(128) NOT NULL DEFAULT '0', `Descrip` varchar(128) DEFAULT '0', `Created` timestamp NULL DEFAULT CURRENT_TIMESTAMP, `Modified` timestamp NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`Id`) ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
/* Navicat MySQL Data Transfer Source Server : zzp Source Server Version : 50557 Source Host : localhost:3306 Source Database : fix_platform Target Server Type : MYSQL Target Server Version : 50557 File Encoding : 65001 Date: 2018-04-22 17:31:29 */ SET FOREIGN_KEY_CHECKS=0; -- ---------------------------- -- Table structure for `fix_campus` -- ---------------------------- DROP TABLE IF EXISTS `fix_campus`; CREATE TABLE `fix_campus` ( `campus_id` varchar(36) NOT NULL, `campus` varchar(10) DEFAULT NULL, `campus_place_no` varchar(36) DEFAULT NULL, `campus_place` varchar(10) DEFAULT NULL, `create_time` timestamp NULL DEFAULT NULL, `update_time` timestamp NULL DEFAULT NULL, PRIMARY KEY (`campus_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of fix_campus -- ---------------------------- INSERT INTO `fix_campus` VALUES ('123', '1', '1011', '图书馆', null, null); INSERT INTO `fix_campus` VALUES ('1234', '1', '1012', '第一饭堂', null, null); INSERT INTO `fix_campus` VALUES ('1354321', '1', '1017', '大礼堂', null, null); INSERT INTO `fix_campus` VALUES ('2123', '2', '2011', '图书馆', null, null); INSERT INTO `fix_campus` VALUES ('42318', '1', '1018', '操场', null, null); INSERT INTO `fix_campus` VALUES ('65ds4', '2', '2012', '1栋教学楼', null, null); INSERT INTO `fix_campus` VALUES ('asdfga1534', '2', '2015', '3栋教学楼', null, null); INSERT INTO `fix_campus` VALUES ('asdgdfgn', '1', '1015', '7栋教学楼', null, null); INSERT INTO `fix_campus` VALUES ('aSR1dg32', '2', '2013', '2栋教学楼', null, null); INSERT INTO `fix_campus` VALUES ('asrdg', '1', '1016', '8栋教学楼', null, null); INSERT INTO `fix_campus` VALUES ('saDf', '1', '1014', '6栋教学楼', null, null); INSERT INTO `fix_campus` VALUES ('sdfgml', '1', '1013', '第二饭堂', null, null); INSERT INTO `fix_campus` VALUES ('z1d3f5g432', '2', '2016', '4栋教学楼', null, null); INSERT INTO `fix_campus` VALUES ('zSDg213', '2', '2014', '3栋教学楼', null, null); -- ---------------------------- -- Table structure for `fix_dorm` -- ---------------------------- DROP TABLE IF EXISTS `fix_dorm`; CREATE TABLE `fix_dorm` ( `dorm_id` varchar(36) NOT NULL, `dorm_no` varchar(10) DEFAULT NULL, `building_no` varchar(10) DEFAULT NULL, `community_no` varchar(10) DEFAULT NULL, `community_name` varchar(20) DEFAULT NULL, `campus` varchar(10) DEFAULT NULL, `create_time` timestamp NULL DEFAULT NULL, `update_time` timestamp NULL DEFAULT NULL, PRIMARY KEY (`dorm_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of fix_dorm -- ---------------------------- INSERT INTO `fix_dorm` VALUES ('123', '101', '12', '1', '莞华社区', '1', null, null); INSERT INTO `fix_dorm` VALUES ('124', '102', '12', '1', '莞华社区', '1', null, null); INSERT INTO `fix_dorm` VALUES ('125', '201', '13', '2', '莞逸社区', '1', null, null); INSERT INTO `fix_dorm` VALUES ('126', '202', '13', '2', '莞逸社区', '1', null, null); INSERT INTO `fix_dorm` VALUES ('127', '301', '12', '3', '莞博社区', '2', null, null); INSERT INTO `fix_dorm` VALUES ('128', '302', '12', '3', '莞博社区', '2', null, null); INSERT INTO `fix_dorm` VALUES ('129', '101', '12', '3', '莞博社区', '2', null, null); -- ---------------------------- -- Table structure for `fix_file` -- ---------------------------- DROP TABLE IF EXISTS `fix_file`; CREATE TABLE `fix_file` ( `file_id` varchar(36) NOT NULL, `file_name` varchar(50) DEFAULT NULL, `file_path` varchar(100) DEFAULT NULL, `file_type` varchar(10) DEFAULT NULL COMMENT '文件类型 1图片 2视频', `fix_id` varchar(36) DEFAULT NULL, `create_time` timestamp NULL DEFAULT NULL, `update_time` timestamp NULL DEFAULT NULL, PRIMARY KEY (`file_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of fix_file -- ---------------------------- -- ---------------------------- -- Table structure for `fix_free` -- ---------------------------- DROP TABLE IF EXISTS `fix_free`; CREATE TABLE `fix_free` ( `free_id` varchar(36) NOT NULL, `user_no` varchar(20) DEFAULT NULL, `user_id` varchar(36) DEFAULT NULL, `user_name` varchar(20) DEFAULT NULL, `busy_start_time` timestamp NULL DEFAULT NULL, `busy_end_time` timestamp NULL DEFAULT NULL, `create_time` timestamp NULL DEFAULT NULL, `update_time` timestamp NULL DEFAULT NULL, PRIMARY KEY (`free_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of fix_free -- ---------------------------- -- ---------------------------- -- Table structure for `fix_label` -- ---------------------------- DROP TABLE IF EXISTS `fix_label`; CREATE TABLE `fix_label` ( `label_id` varchar(36) NOT NULL, `label` varchar(10) DEFAULT NULL, `create_time` timestamp NULL DEFAULT NULL, `update_time` timestamp NULL DEFAULT NULL, PRIMARY KEY (`label_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of fix_label -- ---------------------------- INSERT INTO `fix_label` VALUES ('123', '洗衣机', null, null); INSERT INTO `fix_label` VALUES ('1234', '空调', null, null); INSERT INTO `fix_label` VALUES ('1234124', '冰箱', null, null); INSERT INTO `fix_label` VALUES ('12345', '手机', null, null); -- ---------------------------- -- Table structure for `fix_label_apply` -- ---------------------------- DROP TABLE IF EXISTS `fix_label_apply`; CREATE TABLE `fix_label_apply` ( `fix_label_apply_id` varchar(36) NOT NULL DEFAULT '', `user_id` varchar(36) DEFAULT NULL, `user_type` varchar(10) DEFAULT NULL, `user_no` varchar(20) DEFAULT NULL, `user_name` varchar(20) DEFAULT NULL, `origin_label` varchar(50) DEFAULT NULL, `origin_label_detail` varchar(100) DEFAULT NULL, `apply_label` varchar(50) DEFAULT NULL, `apply_label_detail` varchar(100) DEFAULT NULL, `reject_reason` varchar(100) DEFAULT NULL, `create_time` timestamp NULL DEFAULT NULL, `update_time` timestamp NULL DEFAULT NULL, PRIMARY KEY (`fix_label_apply_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of fix_label_apply -- ---------------------------- INSERT INTO `fix_label_apply` VALUES ('e82027b6-6ca3-46d4-ab3f-7fbb3db3872b', '201441404303', '1', '201441404303', '学生test', '', '', '手机', '维修手机', '0', '2018-04-20 20:55:56', null); -- ---------------------------- -- Table structure for `fix_msg` -- ---------------------------- DROP TABLE IF EXISTS `fix_msg`; CREATE TABLE `fix_msg` ( `msg_id` varchar(36) NOT NULL, `user_id` varchar(36) DEFAULT NULL, `user_no` varchar(20) DEFAULT NULL, `user_name` varchar(20) DEFAULT NULL, `create_time` timestamp NULL DEFAULT NULL, `update_time` timestamp NULL DEFAULT NULL, `phone` varchar(20) DEFAULT NULL, `content` varchar(200) DEFAULT NULL, PRIMARY KEY (`msg_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of fix_msg -- ---------------------------- -- ---------------------------- -- Table structure for `fix_record` -- ---------------------------- DROP TABLE IF EXISTS `fix_record`; CREATE TABLE `fix_record` ( `fix_id` varchar(36) NOT NULL COMMENT '维修id', `user_id` varchar(36) DEFAULT NULL COMMENT '用户id', `user_name` varchar(20) DEFAULT NULL COMMENT '名字', `user_no` varchar(20) DEFAULT NULL COMMENT '学工号', `user_type` varchar(10) DEFAULT NULL COMMENT '用户类型', `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间', `fix_status` varchar(10) DEFAULT NULL COMMENT '维修状态', `fixer_user_name` varchar(20) DEFAULT NULL, `fixer_user_no` varchar(20) DEFAULT NULL, `fixer_user_id` varchar(36) DEFAULT NULL, `fix_type` varchar(11) DEFAULT NULL COMMENT '维修类型', `label` varchar(50) DEFAULT NULL COMMENT '维修标签', `fixer_user_type` varchar(11) DEFAULT NULL COMMENT '维修师傅类型', `title` varchar(20) DEFAULT NULL COMMENT '标题', `detail` varchar(100) DEFAULT NULL COMMENT '详情', `file_path` varchar(500) DEFAULT NULL COMMENT '图片路径', `file_id` varchar(36) DEFAULT NULL, `vedio_id` varchar(36) DEFAULT NULL, `vedio_path` varchar(100) DEFAULT NULL COMMENT '视频路径', `appoint_start_time` timestamp NULL DEFAULT NULL COMMENT '维修开始时间', `appoint_end_time` timestamp NULL DEFAULT NULL COMMENT '维修结束时间', `update_time` timestamp NULL DEFAULT NULL COMMENT '更新时间', `remark` varchar(100) DEFAULT NULL COMMENT '备注', `appoint_user_type` varchar(10) DEFAULT NULL COMMENT '预约维修师傅类型', `appoint_user_id` varchar(36) DEFAULT NULL, `appoint_user_no` varchar(20) DEFAULT NULL, `appoint_user_name` varchar(20) DEFAULT NULL, `campus` varchar(10) DEFAULT NULL, `community_no` varchar(10) DEFAULT NULL, `community_name` varchar(20) DEFAULT NULL, `building_no` varchar(10) DEFAULT NULL, `dorm_no` varchar(10) DEFAULT NULL, `campus_palce` varchar(20) DEFAULT NULL COMMENT '校园位置', `order_type` varchar(10) DEFAULT NULL, PRIMARY KEY (`fix_id`), UNIQUE KEY `fix_id` (`fix_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of fix_record -- ---------------------------- INSERT INTO `fix_record` VALUES ('034df576-8e09-4c2b-94ab-759696cbb9b1', 'admin', '管理员', 'admin', '3', '2018-04-19 19:11:58', '7', null, null, null, '1', '洗衣机', null, '洗衣机', '洗衣机', '14eb1322-5e41-4e41-9d43-cb5b363dbdf6.jpg;75479a9f-d077-4789-b484-1165b4a0c5ed.jpg', null, null, null, '2018-04-19 19:11:20', '2018-04-20 00:00:00', '2018-04-19 19:11:58', null, '2', '201441404304', '201441404304', '维修师傅test', '1', '1', null, '12', '101', null, '3'); INSERT INTO `fix_record` VALUES ('08a322f5-3a10-4ca3-9ee6-88a9dbbe5188', 'admin', '管理员', 'admin', '3', '2018-04-20 19:15:31', '1', null, null, null, '2', null, null, 'adsfg', 'zdsrfgh', '', null, null, null, null, null, '2018-04-20 19:15:31', null, null, null, null, null, '2', null, null, null, null, '2012', '1'); INSERT INTO `fix_record` VALUES ('08f3d7f7-2626-46bd-a614-20348c3c0885', '201441404303', '学生test', '201441404303', '1', '2018-04-20 19:27:50', '1', null, null, null, '1', null, null, '厕所堵住', '无', null, null, null, null, null, null, null, null, null, null, null, null, '1', '1', '莞华社区', '12', '102', null, '1'); INSERT INTO `fix_record` VALUES ('1e35df16-730c-40e4-a920-35a1f2792c44', 'admin', '管理员', 'admin', '3', '2018-04-20 19:16:39', '1', null, null, null, '3', '洗衣机', null, 'sdg', 'sdgf', '', null, null, null, '2018-04-20 00:00:00', '2018-04-20 00:00:00', '2018-04-20 19:16:39', null, null, '', null, null, '1', null, null, null, null, null, '2'); INSERT INTO `fix_record` VALUES ('2453db58-ed2a-4e9d-a857-beb344ee74b5', 'admin', '管理员', 'admin', '3', '2018-04-19 19:12:00', '4', '维修师傅test', '201441404304', '201441404304', '1', '洗衣机', '2', '洗衣机', '洗衣机', '14eb1322-5e41-4e41-9d43-cb5b363dbdf6.jpg;75479a9f-d077-4789-b484-1165b4a0c5ed.jpg', null, null, null, '2018-04-19 19:11:20', '2018-04-20 00:00:00', '2018-04-19 19:12:00', null, '2', '201441404304', '201441404304', '维修师傅test', '1', '1', null, '12', '101', null, '3'); INSERT INTO `fix_record` VALUES ('286e9bbe-fc80-4a2e-9037-9eab520f1898', 'admin', '管理员', 'admin', '3', '2018-04-19 19:11:38', '8', '维修师傅test', '201441404304', '201441404304', '1', '洗衣机', null, '洗衣机', '洗衣机', '14eb1322-5e41-4e41-9d43-cb5b363dbdf6.jpg;75479a9f-d077-4789-b484-1165b4a0c5ed.jpg', null, null, null, '2018-04-19 19:11:20', '2018-04-20 00:00:00', '2018-04-19 19:11:38', null, null, '', null, null, '1', '1', null, '12', '101', null, '1'); INSERT INTO `fix_record` VALUES ('4be511f7-5955-4286-8966-7d23fd907a04', 'admin', '管理员', 'admin', '3', '2018-04-20 19:19:07', '1', null, null, null, '2', null, null, 'ASF', 'ARSDG', '', null, null, null, null, null, '2018-04-20 19:19:07', null, null, null, null, null, '2', null, null, null, null, '2013', '1'); INSERT INTO `fix_record` VALUES ('59178d65-2e6f-460f-a70b-bc8909d4f10d', '201441404303', '学生test', '201441404303', '1', '2018-04-20 20:48:25', '8', '维修师傅test', '201441404304', '201441404304', '1', '洗衣机', null, 'dfhzrhrzh', 'zewtrzyhzet', '3326ec48-dcd7-4e04-a35a-3ff551e90686.png;661a92eb-d43d-40f1-b6bf-c2b8cc7d27a9.png;77853f29-2e05-4261-963d-c32fc3eba83c.mp4', null, null, null, '2018-04-20 20:45:14', '2018-04-26 00:00:00', '2018-04-20 20:48:25', null, null, '', null, null, '1', '1', null, '12', '101', null, '1'); INSERT INTO `fix_record` VALUES ('8654eb30-9490-48db-b364-5e3a677db122', 'admin', '管理员', 'admin', '3', '2018-04-19 19:12:01', '2', '维修师傅test', '201441404304', '201441404304', '1', '洗衣机', null, '洗衣机', '洗衣机', '14eb1322-5e41-4e41-9d43-cb5b363dbdf6.jpg;75479a9f-d077-4789-b484-1165b4a0c5ed.jpg', null, null, null, '2018-04-19 19:11:20', '2018-04-20 00:00:00', '2018-04-19 19:12:01', null, null, null, null, null, '1', '1', null, '12', '101', null, '1'); INSERT INTO `fix_record` VALUES ('947548d4-9db5-448d-88d1-906196fc6e57', '201441404303', '学生test', '201441404303', '1', '2018-04-19 19:06:03', '1', null, null, null, '1', '洗衣机', null, '洗衣机水龙头坏了', '洗衣机水龙头坏了', '949b5be1-71c6-492a-a8ad-856a52d9397b.jpg;dc0fb4ae-9a0d-4720-b7dc-0dd9476703a6.jpg;8e6e2c73-4677-456c-86e8-73ca0aa25557.mp4', null, null, null, '2018-04-19 19:05:27', '2018-04-20 00:00:00', '2018-04-19 19:06:03', null, null, '', null, null, '1', '1', null, '12', '101', null, '1'); INSERT INTO `fix_record` VALUES ('9d5ce696-58cc-4da4-83a8-430aded691c6', 'admin', '管理员', 'admin', '3', '2018-04-19 19:11:49', '3', '维修师傅test', '201441404304', '201441404304', '1', '洗衣机', '2', '洗衣机', '洗衣机', '14eb1322-5e41-4e41-9d43-cb5b363dbdf6.jpg;75479a9f-d077-4789-b484-1165b4a0c5ed.jpg', null, null, null, '2018-04-19 19:11:20', '2018-04-20 00:00:00', '2018-04-19 19:11:49', null, null, '', null, null, '1', '1', null, '12', '101', null, '2'); INSERT INTO `fix_record` VALUES ('9d68ce7b-e979-4a4f-acb6-9770e98e84f7', 'admin', '管理员', 'admin', '3', '2018-04-19 19:11:36', '1', null, null, null, '1', '洗衣机', null, '洗衣机', '洗衣机', '14eb1322-5e41-4e41-9d43-cb5b363dbdf6.jpg;75479a9f-d077-4789-b484-1165b4a0c5ed.jpg', null, null, null, '2018-04-19 19:11:20', '2018-04-20 00:00:00', '2018-04-19 19:11:36', null, null, '', null, null, '1', '1', null, '12', '101', null, '1'); INSERT INTO `fix_record` VALUES ('c3d06523-374a-47ad-aa9c-f7156c125ca2', 'admin', '管理员', 'admin', '3', '2018-04-19 19:11:33', '7', null, null, null, '1', '洗衣机', null, '洗衣机', '洗衣机', '14eb1322-5e41-4e41-9d43-cb5b363dbdf6.jpg;75479a9f-d077-4789-b484-1165b4a0c5ed.jpg', null, null, null, '2018-04-19 19:11:20', '2018-04-20 00:00:00', '2018-04-19 19:11:33', null, null, '', null, null, '1', '1', null, '12', '101', null, '1'); INSERT INTO `fix_record` VALUES ('caa51aa1-386d-4c9c-8835-2d3ba70526f1', 'admin', '管理员', 'admin', '3', '2018-04-19 19:11:50', '1', null, null, null, '1', '洗衣机', null, '洗衣机', '洗衣机', '14eb1322-5e41-4e41-9d43-cb5b363dbdf6.jpg;75479a9f-d077-4789-b484-1165b4a0c5ed.jpg', null, null, null, '2018-04-19 19:11:20', '2018-04-20 00:00:00', '2018-04-19 19:11:50', null, null, '', null, null, '1', '1', null, '12', '101', null, '2'); INSERT INTO `fix_record` VALUES ('cac058b5-100d-43f5-b8c1-48f5a32bcb1d', 'admin', '管理员', 'admin', '3', '2018-04-19 19:11:46', '1', null, null, null, '1', '洗衣机', null, '洗衣机', '洗衣机', '14eb1322-5e41-4e41-9d43-cb5b363dbdf6.jpg;75479a9f-d077-4789-b484-1165b4a0c5ed.jpg', null, null, null, '2018-04-19 19:11:20', '2018-04-20 00:00:00', '2018-04-19 19:11:46', null, null, '', null, null, '1', '1', null, '12', '101', null, '2'); INSERT INTO `fix_record` VALUES ('cbd26678-6785-4b3d-8a4d-5d01bf324966', '201441404303', '学生test', '201441404303', '1', '2018-04-20 21:00:12', '1', null, null, null, '1', null, null, '厕所堵住', '无', null, null, null, null, null, null, null, null, null, null, null, null, '1', '1', '莞华社区', '12', '101', null, '1'); INSERT INTO `fix_record` VALUES ('e7d58aa9-cb02-40f4-8e7a-542bc9a9d986', 'admin', '管理员', 'admin', '3', '2018-04-20 19:26:19', '1', null, null, null, '2', null, null, 'arfg', 'aedrh', '', null, null, null, null, null, '2018-04-20 19:26:19', null, null, null, null, null, '2', null, null, null, null, '2012', '1'); INSERT INTO `fix_record` VALUES ('f120aac9-6af0-491d-93fc-aa747590e7b8', '201441404303', '学生test', '201441404303', '1', '2018-04-20 19:27:50', '1', null, null, null, '1', null, null, '厕所堵住', '无', null, null, null, null, null, null, null, null, null, null, null, null, '1', '1', '莞华社区', '12', '101', null, '1'); INSERT INTO `fix_record` VALUES ('fa605314-b170-426f-8229-d5ade6584dc8', '201441404303', '学生test', '201441404303', '1', '2018-04-20 21:00:12', '1', null, null, null, '1', null, null, '厕所堵住', '无', null, null, null, null, null, null, null, null, null, null, null, null, '1', '1', '莞华社区', '12', '102', null, '1'); -- ---------------------------- -- Table structure for `fix_record_change` -- ---------------------------- DROP TABLE IF EXISTS `fix_record_change`; CREATE TABLE `fix_record_change` ( `fix_record_change_id` varchar(36) NOT NULL DEFAULT '', `fix_id` varchar(36) DEFAULT NULL, `user_id` varchar(36) DEFAULT NULL, `user_type` varchar(10) DEFAULT NULL, `user_name` varchar(20) DEFAULT NULL, `operate_type` varchar(10) DEFAULT NULL, `operate_name` varchar(20) DEFAULT NULL, `detail` varchar(100) DEFAULT NULL, `create_time` timestamp NULL DEFAULT NULL, `update_time` timestamp NULL DEFAULT NULL, `user_no` varbinary(20) DEFAULT NULL, PRIMARY KEY (`fix_record_change_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of fix_record_change -- ---------------------------- INSERT INTO `fix_record_change` VALUES ('0330f9d5-61b3-4fef-af9e-965d0bfb91ce', '947548d4-9db5-448d-88d1-906196fc6e57', null, null, '维修师傅test', null, '结单', '没空', '2018-04-19 21:25:45', null, 0x323031343431343034333034); INSERT INTO `fix_record_change` VALUES ('0e31ad9f-aa40-4c9e-a8bc-d3de63968899', '8654eb30-9490-48db-b364-5e3a677db122', null, null, '管理员', null, '管理员', '管理员派单给维修人员:201441404304 维修师傅test', '2018-04-20 19:10:21', null, 0x61646D696E); INSERT INTO `fix_record_change` VALUES ('0ef3a5d6-6345-4821-977c-da11e98a4a91', '034df576-8e09-4c2b-94ab-759696cbb9b1', null, null, '管理员', null, '新增', '洗衣机', '2018-04-19 19:11:58', null, 0x61646D696E); INSERT INTO `fix_record_change` VALUES ('16e4050f-9b53-4c49-8d23-dd8c44769bee', '947548d4-9db5-448d-88d1-906196fc6e57', null, null, '学生test', null, '新增', '洗衣机水龙头坏了', '2018-04-19 19:06:03', null, 0x323031343431343034333033); INSERT INTO `fix_record_change` VALUES ('17427b48-f594-4d6d-ae6f-d014faa9f248', '59178d65-2e6f-460f-a70b-bc8909d4f10d', null, null, '学生test', null, '新增', 'zewtrzyhzet', '2018-04-20 20:48:25', null, 0x323031343431343034333033); INSERT INTO `fix_record_change` VALUES ('1bd5a3d8-0097-4e03-b559-c3c51602416b', '8654eb30-9490-48db-b364-5e3a677db122', null, null, '管理员', null, '新增', '洗衣机', '2018-04-19 19:12:01', null, 0x61646D696E); INSERT INTO `fix_record_change` VALUES ('41ed79dd-f7d5-4b78-a0f6-8cf7f9ca5a96', 'c3d06523-374a-47ad-aa9c-f7156c125ca2', null, null, '管理员', null, '新增', '洗衣机', '2018-04-19 19:11:33', null, 0x61646D696E); INSERT INTO `fix_record_change` VALUES ('454879d1-98e9-440a-8172-6a232fca1e69', '2453db58-ed2a-4e9d-a857-beb344ee74b5', null, null, '管理员', null, '新增', '洗衣机', '2018-04-19 19:12:00', null, 0x61646D696E); INSERT INTO `fix_record_change` VALUES ('47b123c7-b8e6-4a51-829e-88a1d8e34c48', '59178d65-2e6f-460f-a70b-bc8909d4f10d', null, null, '管理员', null, '管理员', '管理员派单给维修人员:201441404304 维修师傅test', '2018-04-20 20:50:18', null, 0x61646D696E); INSERT INTO `fix_record_change` VALUES ('49f8ab76-4b5c-4ac4-9e50-dfc6e59c950b', 'cbd26678-6785-4b3d-8a4d-5d01bf324966', null, null, '学生test', null, '管理员', '管理员上传线下维修单', '2018-04-20 21:00:12', null, 0x61646D696E); INSERT INTO `fix_record_change` VALUES ('5299596a-d491-4418-810a-9b936ccc0803', '947548d4-9db5-448d-88d1-906196fc6e57', null, null, '维修师傅test', null, '管理员', '管理员派单给维修人员:201441404304 维修师傅test', '2018-04-19 19:08:02', null, 0x61646D696E); INSERT INTO `fix_record_change` VALUES ('53464e4e-0056-445c-9030-9b84fabe45ee', 'cac058b5-100d-43f5-b8c1-48f5a32bcb1d', null, null, '管理员', null, '新增', '洗衣机', '2018-04-19 19:11:46', null, 0x61646D696E); INSERT INTO `fix_record_change` VALUES ('588a8eba-28bf-427e-9e77-a51dd69e1f0a', 'e7d58aa9-cb02-40f4-8e7a-542bc9a9d986', null, null, '管理员', null, '新增', 'aedrh', '2018-04-20 19:26:19', null, 0x61646D696E); INSERT INTO `fix_record_change` VALUES ('5f746dc9-f570-4f09-81df-361eb04d97c7', '8654eb30-9490-48db-b364-5e3a677db122', null, null, '维修师傅test', null, '拒绝接单', '维修人员维修师傅test拒绝了接单请求', '2018-04-19 22:20:06', null, 0x323031343431343034333034); INSERT INTO `fix_record_change` VALUES ('66b79371-8126-47c0-b8ce-de032e60c4ea', 'fa605314-b170-426f-8229-d5ade6584dc8', null, null, '学生test', null, '管理员', '管理员上传线下维修单', '2018-04-20 21:00:12', null, 0x61646D696E); INSERT INTO `fix_record_change` VALUES ('6ead5354-bf76-4ff9-bdac-92a3a1ac1e2a', 'caa51aa1-386d-4c9c-8835-2d3ba70526f1', null, null, '管理员', null, '新增', '洗衣机', '2018-04-19 19:11:50', null, 0x61646D696E); INSERT INTO `fix_record_change` VALUES ('70b1fbf1-3e22-4e96-8bdd-db1135533af9', '59178d65-2e6f-460f-a70b-bc8909d4f10d', null, null, '维修师傅test', null, '结单', 'yxryxr', '2018-04-20 20:52:52', null, 0x323031343431343034333034); INSERT INTO `fix_record_change` VALUES ('7726e9c5-966a-4445-9d2b-b49810ad8447', '08f3d7f7-2626-46bd-a614-20348c3c0885', null, null, '学生test', null, '管理员', '管理员上传线下维修单', '2018-04-20 19:27:50', null, 0x61646D696E); INSERT INTO `fix_record_change` VALUES ('82bcb44a-d52d-43b8-a7f0-0625c52876b9', '286e9bbe-fc80-4a2e-9037-9eab520f1898', null, null, '管理员', null, '评论评价', '管理员给本次维修评分:5', '2018-04-19 19:48:09', null, 0x61646D696E); INSERT INTO `fix_record_change` VALUES ('8d6b3de3-2930-4737-b689-1a6a143bd258', 'f120aac9-6af0-491d-93fc-aa747590e7b8', null, null, '学生test', null, '管理员', '管理员上传线下维修单', '2018-04-20 19:27:50', null, 0x61646D696E); INSERT INTO `fix_record_change` VALUES ('a3e1391c-0e21-4f49-afee-81705456469c', '9d5ce696-58cc-4da4-83a8-430aded691c6', null, null, '管理员', null, '新增', '洗衣机', '2018-04-19 19:11:49', null, 0x61646D696E); INSERT INTO `fix_record_change` VALUES ('a6c5f5bf-0900-4781-9312-07e4816f9976', '286e9bbe-fc80-4a2e-9037-9eab520f1898', null, null, '管理员', null, '新增', '洗衣机', '2018-04-19 19:11:38', null, 0x61646D696E); INSERT INTO `fix_record_change` VALUES ('a7cd2e86-d8e6-4a0e-bb83-38137964d2b1', '08a322f5-3a10-4ca3-9ee6-88a9dbbe5188', null, null, '管理员', null, '新增', 'zdsrfgh', '2018-04-20 19:15:31', null, 0x61646D696E); INSERT INTO `fix_record_change` VALUES ('b2922eec-0a19-4500-ac78-b14f2d2ae440', '2453db58-ed2a-4e9d-a857-beb344ee74b5', null, null, '维修师傅test', null, '预约接单', '学工号:201441404304 维修师傅test接单', '2018-04-19 21:14:02', null, 0x323031343431343034333034); INSERT INTO `fix_record_change` VALUES ('d74e0946-b012-4645-991c-594edec70140', '286e9bbe-fc80-4a2e-9037-9eab520f1898', null, null, '管理员', null, '结单', '维修师傅人很nice', '2018-04-19 19:47:43', null, 0x61646D696E); INSERT INTO `fix_record_change` VALUES ('dab0b333-3301-4314-9b15-e1a00c6984f2', '4be511f7-5955-4286-8966-7d23fd907a04', null, null, '管理员', null, '新增', 'ARSDG', '2018-04-20 19:19:07', null, 0x61646D696E); INSERT INTO `fix_record_change` VALUES ('df75c4e9-3971-42f2-b1fb-ad7418ea4007', '1e35df16-730c-40e4-a920-35a1f2792c44', null, null, '管理员', null, '新增', 'sdgf', '2018-04-20 19:16:39', null, 0x61646D696E); INSERT INTO `fix_record_change` VALUES ('e46d764e-2a8b-49cc-8e3c-3b76c63ae9f8', '59178d65-2e6f-460f-a70b-bc8909d4f10d', null, null, '学生test', null, '评论评价', '学生test给本次维修评分:4', '2018-04-20 20:53:37', null, 0x323031343431343034333033); INSERT INTO `fix_record_change` VALUES ('e59ca04f-28c3-4679-b107-6e457bd67090', '9d68ce7b-e979-4a4f-acb6-9770e98e84f7', null, null, '管理员', null, '新增', '洗衣机', '2018-04-19 19:11:36', null, 0x61646D696E); INSERT INTO `fix_record_change` VALUES ('f3b99d08-d76e-4b4f-8ea5-9f5ff88966f9', '9d5ce696-58cc-4da4-83a8-430aded691c6', null, null, '维修师傅test', null, '平台接单', '学工号:201441404304 维修师傅test接单', '2018-04-19 21:18:58', null, 0x323031343431343034333034); INSERT INTO `fix_record_change` VALUES ('f96518b1-0fed-4a45-b64d-625b057a1722', '286e9bbe-fc80-4a2e-9037-9eab520f1898', null, null, '维修师傅test', null, '管理员', '管理员派单给维修人员:201441404304 维修师傅test', '2018-04-19 19:18:45', null, 0x61646D696E); -- ---------------------------- -- Table structure for `fix_score` -- ---------------------------- DROP TABLE IF EXISTS `fix_score`; CREATE TABLE `fix_score` ( `score_id` varchar(36) NOT NULL DEFAULT '', `fix_id` varchar(36) DEFAULT NULL, `user_id` varchar(36) DEFAULT NULL, `user_no` varchar(20) DEFAULT NULL, `user_type` varchar(10) DEFAULT NULL, `user_name` varchar(20) DEFAULT NULL, `fixer_id` varchar(36) DEFAULT NULL, `fixer_type` varchar(10) DEFAULT NULL, `fixer_no` varchar(20) DEFAULT NULL, `fixer_name` varchar(20) DEFAULT NULL, `score` varchar(10) DEFAULT NULL, `comment` varchar(100) DEFAULT NULL, `create_time` timestamp NULL DEFAULT NULL, `update_time` timestamp NULL DEFAULT NULL, PRIMARY KEY (`score_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of fix_score -- ---------------------------- INSERT INTO `fix_score` VALUES ('7a37426e-ce68-4876-afe2-446d8c2727ec', '286e9bbe-fc80-4a2e-9037-9eab520f1898', null, null, null, null, '201441404304', null, '201441404304', '维修师傅test', '5', '很好', '2018-04-19 19:48:09', null); INSERT INTO `fix_score` VALUES ('ad16a47f-cfa2-4d92-9491-fba479cc8a4c', '59178d65-2e6f-460f-a70b-bc8909d4f10d', null, null, null, null, '201441404304', null, '201441404304', '维修师傅test', '4', 'srtyhseryu', '2018-04-20 20:53:37', null); -- ---------------------------- -- Table structure for `fix_upload` -- ---------------------------- DROP TABLE IF EXISTS `fix_upload`; CREATE TABLE `fix_upload` ( `upload_id` varchar(36) NOT NULL, `batch_no` varchar(36) DEFAULT NULL, `user_no` varchar(20) DEFAULT NULL, `user_name` varchar(20) DEFAULT NULL, `campus` varchar(10) DEFAULT NULL, `dorm_no` varchar(20) DEFAULT NULL, `community_no` varchar(20) DEFAULT NULL, `community_name` varchar(20) DEFAULT NULL, `building_no` varchar(10) DEFAULT NULL, `appoint_start_time` timestamp NULL DEFAULT NULL, `appoint_end_time` timestamp NULL DEFAULT NULL, `user_id` varchar(32) DEFAULT NULL, `user_type` varchar(10) DEFAULT NULL, `title` varchar(20) DEFAULT NULL, `detail` varchar(100) DEFAULT NULL, `create_time` timestamp NULL DEFAULT NULL, `update_time` timestamp NULL DEFAULT NULL, `tips` varchar(20) DEFAULT NULL, `success` varchar(2) DEFAULT NULL, PRIMARY KEY (`upload_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of fix_upload -- ---------------------------- INSERT INTO `fix_upload` VALUES ('b15686da-4d50-4ac8-bafd-51216a32f73e', '1524229159168', '201441404303', '学生test', '1', null, null, null, null, null, null, '201441404303', '1', '厕所堵住', '无', null, null, '不存在此宿舍号', '0'); INSERT INTO `fix_upload` VALUES ('ec934298-c60d-4bb8-b86d-203cf0877244', '1524223661680', '201441404303', '学生test', '1', null, null, null, null, null, null, '201441404303', '1', '厕所堵住', '无', null, null, '不存在此宿舍号', '0'); -- ---------------------------- -- Table structure for `fix_user` -- ---------------------------- DROP TABLE IF EXISTS `fix_user`; CREATE TABLE `fix_user` ( `user_id` varchar(36) NOT NULL, `user_no` varchar(20) DEFAULT NULL, `user_name` varchar(20) DEFAULT NULL, `password` varchar(36) DEFAULT NULL, `grade` varchar(10) DEFAULT NULL, `major` varchar(20) DEFAULT NULL, `dept` varchar(20) DEFAULT NULL, `campus` varchar(10) DEFAULT NULL, `phone` varchar(20) DEFAULT NULL, `user_type` varchar(10) DEFAULT NULL, `email` varchar(20) DEFAULT NULL, `is_admin` varchar(10) DEFAULT NULL, `is_fixer` varchar(10) DEFAULT NULL, `is_student` varchar(10) DEFAULT NULL, `label_detail` varchar(250) DEFAULT NULL, `label` varchar(50) DEFAULT NULL, `create_time` timestamp NULL DEFAULT NULL, `update_time` timestamp NULL DEFAULT NULL, PRIMARY KEY (`user_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of fix_user -- ---------------------------- INSERT INTO `fix_user` VALUES ('201441404303', '201441404303', '学生test', 'zzping123', '2014', null, null, '1', '13631781074', '1', '337095899@gmail.com', '0', '1', '1', '维修手机', '手机', '2018-03-29 13:31:04', null); INSERT INTO `fix_user` VALUES ('201441404304', '201441404304', '维修师傅test', '123456', null, null, null, '1', '13631781074', '2', '337095899@gmail.com', '0', '1', '0', '手机,空调,洗衣机,可维修电脑显示器', '手机,空调,洗衣机,电脑', null, null); INSERT INTO `fix_user` VALUES ('admin', 'admin', '管理员', '123456', null, null, null, null, '13631781074', '3', '337095899@qq.com', '1', '0', '0', null, null, null, null);
 CREATE PROCEDURE [ERP].[Usp_Upd_Establecimiento] @IdEntidad INT, @IdTipoEstablecimiento INT, @IdVia INT, @IdZona INT, @IdPais INT, @IdUbigeo INT, @NombreEstablecimiento VARCHAR(250), @Direccion VARCHAR(250), @NombreVia VARCHAR(250), @NumeroVia VARCHAR(4), @Interior VARCHAR(4), @NombreZona VARCHAR(250), @Referencia VARCHAR(250), @Sector VARCHAR(20), @Grupo VARCHAR(20), @Manzana VARCHAR(20), @Lote VARCHAR(20), @Kilometro VARCHAR(20), @FlagBorrador BIT, @Flag BIT AS BEGIN UPDATE ERP.Establecimiento SET IdTipoEstablecimiento = @IdTipoEstablecimiento, IdVia = @IdVia, IdZona = @IdZona, IdPais = @IdPais, IdUbigeo = @IdUbigeo, Nombre = @NombreEstablecimiento, Direccion = @Direccion, ViaNombre = @NombreVia, ViaNumero = @NumeroVia, Interior = @Interior, ZonaNombre = @NombreZona, Referencia = @Referencia, Sector = @Sector, Grupo = @Grupo, Manzana = @Manzana, Lote = @Lote, Kilometro = @Kilometro, FlagBorrador = @FlagBorrador, Flag = @Flag WHERE IdEntidad = @IdEntidad AND IdTipoEstablecimiento = @IdTipoEstablecimiento END
CREATE FUNCTION tablemult() RETURNS @Res TABLE ( LineID int, Train nvarchar(30), Passangers int ) AS BEGIN INSERT INTO @Res SELECT LinkerT.LineID, Train, Passangers FROM LinkerT JOIN TrainsT ON TrainsT.LineID = LinkerT.LineID WHERE Passangers > 300 RETURN END
select count(*)+1 from book where book_code like substring(book_code, 0, 8); select max(book_no + 1) from book; select substring(book_code, 0, 8) select max(book_no + 1) from book where book_no; insert into book_rental_info values (1, '2017-12-18', null, '2017-12-25', 1, 0070041005), (2, '2017-12-18', null, '2017-12-25', 1, 1110012301); insert into member values ('L00001', 'asdf', '이천희', 'lch', '010-1234-5678', '123456-1234567', 'asdf@naver.com', '대구광역시 달서구', '이미지 경로', 2,'없음'), ('L00002', 'asdf', '이차니', 'lch', '010-1234-5678', '123456-1234567', 'asdf@naver.com', '대구광역시 달서구', '이미지 경로', 1,'없음'), ('L00003', 'asdf', '이쩌늬', 'lch', '010-1234-5678', '123456-1234567', 'asdf@naver.com', '대구광역시 달서구', '이미지 경로', 2,'없음'); insert into book values ('1230012505', 125, 'asdf', 'asdf', 'asdf', 1111, false, null, 1, 2, 3, null); select * from book; select * from book_rental_info; select b.book_code, b.title, p.pub_name, b.author, bri.rental_date, bri.return_schedule from book_rental_info as bri join book as b on b.book_code = bri.book_code join publisher as p on p.pub_no = b.pub_no where member_no = 'L00001'; select * from book_rental_info where member_no = 'L00001'; INSERT INTO book_rental_info values (3, '2018-12-24', '2019-01-01', null, 'A0002', '0040000201'), (4, '2018-12-24', '2019-01-04', null, 'A0002', '0110000301'); insert into publisher values ('P001', '호우출판'), ('P002', '오라클'); select c.cate_b_name from book_rental_info as bri join book as b on b.book_code = bri.book_code JOIN category_b as c on b.cate_b_no = c.cate_b_no where member_no = 2; select count(b.cate_b_no) from book_rental_info as bri join book as b on b.book_code = bri.book_code where member_no = 2 and b.cate_b_no = '0'; select * from publisher; select * from `member`; select * from member where member_no = 'L0001' and password = '*5FEFDAF71624A2DAA56E303A03AC7A428C6A6652'; select b.*, cb.cate_b_name, cm.cate_m_name, cs.cate_s_name, p.pub_name from book as b join category_b as cb on b.cate_b_no = cb.cate_b_no join category_m as cm on b.cate_m_no = cm.cate_m_no join category_s as cs on b.cate_m_no = cs.cate_m_no join publisher as p on b.pub_no = p.pub_no where b.book_code = '0110000301' and cb.cate_b_no =b.cate_b_no and cm.cate_m_no = b.cate_m_no and cm.cate_b_no = cb.cate_b_no and cs.cate_s_no = b.cate_s_no and cs.cate_m_no = cm.cate_m_no and cs.cate_b_no = cb.cate_b_no and p.pub_no = b.pub_no; update book set author='윤성우', translator='신민철', title='열혈자바', price=7600, rental_possible=1, image=null, pub_no='P0001' WHERE book_code='0040000201';
-- -- Migration file: "alter percent column" created at 28.10.2014 03:25:41 (+06:00) -- ALTER TABLE `orders` CHANGE `discount` `discount_absolute` INT(11) NULL DEFAULT NULL COMMENT 'Фиксированная скидка на заказ';
select src_university_id,dest_university_id,count(capture_time) from session_info_20171015 where capture_time >= '2017/10/15 07:13:59' and capture_time < '2017/10/15 07:18:59' GROUP by src_university_id,dest_university_id;
//DROP TABLE IF EXISTS team_members; DROP TABLE IF EXISTS sprint_stars; DROP TABLE IF EXISTS story_points; DROP TABLE IF EXISTS test_tickets; DROP TABLE IF EXISTS code_quality; DROP TABLE IF EXISTS assists; DROP TABLE IF EXISTS kudos;
/* Navicat MySQL Data Transfer Source Server : ning Source Server Version : 50173 Source Host : 123.207.244.139:3306 Source Database : db_got_word Target Server Type : MYSQL Target Server Version : 50173 File Encoding : 65001 Date: 2017-12-09 19:48:22 */ SET FOREIGN_KEY_CHECKS=0; -- ---------------------------- -- Table structure for user -- ---------------------------- DROP TABLE IF EXISTS `user`; CREATE TABLE `user` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(45) NOT NULL, `password` varchar(45) NOT NULL, PRIMARY KEY (`id`,`name`) ) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of user -- ---------------------------- INSERT INTO `user` VALUES ('1', 'ninggc', ' '); INSERT INTO `user` VALUES ('2', 'user_2', '123'); INSERT INTO `user` VALUES ('3', 'test', 'test'); INSERT INTO `user` VALUES ('4', 'test', 'test'); INSERT INTO `user` VALUES ('5', 'test', 'test'); INSERT INTO `user` VALUES ('6', 'test', 'test'); -- ---------------------------- -- Table structure for word -- ---------------------------- DROP TABLE IF EXISTS `word`; CREATE TABLE `word` ( `word` varchar(45) NOT NULL, `explains` varchar(100) NOT NULL, `us-phonetic` varchar(45) DEFAULT NULL, `phonetic` varchar(100) DEFAULT NULL, `uk-phonetic` varchar(45) DEFAULT NULL, `text` text, PRIMARY KEY (`word`), UNIQUE KEY `word_UNIQUE` (`word`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of word -- ---------------------------- INSERT INTO `word` VALUES ('a', '', null, null, null, null); INSERT INTO `word` VALUES ('advance', 'n. 发展;前进;增长;预付款\r\nvt. 提出;预付;使……前进;将……提前\r\nvi. 前进;进展;上涨\r\nadj. 预先的;先行的', null, '英 [əd\'vɑːns] 美 [əd\'væns]', null, null); INSERT INTO `word` VALUES ('advancement', '', null, null, null, null); INSERT INTO `word` VALUES ('advocate', '', null, null, null, null); INSERT INTO `word` VALUES ('affluent', '', null, null, null, null); INSERT INTO `word` VALUES ('and', '', null, null, null, null); INSERT INTO `word` VALUES ('appear', '', null, null, null, null); INSERT INTO `word` VALUES ('approximately', '', null, null, null, null); INSERT INTO `word` VALUES ('b', '', null, null, null, null); INSERT INTO `word` VALUES ('bound', 'adj. 有义务的;必定的;受约束的;装有封面的\r\nvt. 束缚;使跳跃\r\nn. 范围;跳跃\r\nvi. 限制;弹起', null, '英 [baʊnd] 美 [baʊnd]', null, null); INSERT INTO `word` VALUES ('c', '', null, null, null, null); INSERT INTO `word` VALUES ('causal', '', null, null, null, null); INSERT INTO `word` VALUES ('caution', '', null, null, null, null); INSERT INTO `word` VALUES ('chinese', '', null, null, null, null); INSERT INTO `word` VALUES ('cite', '', null, null, null, null); INSERT INTO `word` VALUES ('collapse', '', null, null, null, null); INSERT INTO `word` VALUES ('commend', '', null, null, null, null); INSERT INTO `word` VALUES ('common', '', null, null, null, null); INSERT INTO `word` VALUES ('companions', '', null, null, null, null); INSERT INTO `word` VALUES ('compel', '', null, null, null, null); INSERT INTO `word` VALUES ('complex', '', null, null, null, null); INSERT INTO `word` VALUES ('complicated', '', null, null, null, null); INSERT INTO `word` VALUES ('conclusion', '', null, null, null, null); INSERT INTO `word` VALUES ('confront', 'vt. 面对;遭遇;比较', null, '英 [kən\'frʌnt] 美 [kən\'frʌnt]', null, null); INSERT INTO `word` VALUES ('consequence', '', null, null, null, null); INSERT INTO `word` VALUES ('consequently', '', null, null, null, null); INSERT INTO `word` VALUES ('consumption', 'n. 消费;消耗;肺痨', null, '英 [kən\'sʌm(p)ʃ(ə)n] 美 [kən\'sʌmpʃən]', null, null); INSERT INTO `word` VALUES ('contend', '', null, null, null, null); INSERT INTO `word` VALUES ('contribute', '', null, null, null, null); INSERT INTO `word` VALUES ('crisis', '', null, null, null, null); INSERT INTO `word` VALUES ('crucial', '', null, null, null, null); INSERT INTO `word` VALUES ('currently', '', null, null, null, null); INSERT INTO `word` VALUES ('d', '', null, null, null, null); INSERT INTO `word` VALUES ('dangerous', '', null, null, null, null); INSERT INTO `word` VALUES ('demonstrate', '', null, null, null, null); INSERT INTO `word` VALUES ('development', '', null, null, null, null); INSERT INTO `word` VALUES ('dispute', 'vt. 辩论;怀疑;阻止;抗拒\r\nvi. 争论\r\nn. 辩论;争吵', null, '英 [dɪ\'spjuːt; \'dɪspjuːt] 美 [\'dɪs\'pjʊt]', null, null); INSERT INTO `word` VALUES ('eccentric', '', null, null, null, null); INSERT INTO `word` VALUES ('efficiently', '', null, null, null, null); INSERT INTO `word` VALUES ('endless', 'adj. 无止境的;连续的;环状的;漫无目的的', null, '英 [\'endlɪs] 美 [ˈɛndlɪs]', null, null); INSERT INTO `word` VALUES ('entire', '', null, null, null, null); INSERT INTO `word` VALUES ('exert', '', null, null, null, null); INSERT INTO `word` VALUES ('expensive', '', null, null, null, null); INSERT INTO `word` VALUES ('fantastic', '', null, null, null, null); INSERT INTO `word` VALUES ('frequently', '', null, null, null, null); INSERT INTO `word` VALUES ('hazardous', '', null, null, null, null); INSERT INTO `word` VALUES ('hello', '', null, null, null, null); INSERT INTO `word` VALUES ('hinge-on', '', null, null, null, null); INSERT INTO `word` VALUES ('important', '', null, null, null, null); INSERT INTO `word` VALUES ('incentive', '', null, null, null, null); INSERT INTO `word` VALUES ('increasingly', '', null, null, null, null); INSERT INTO `word` VALUES ('incredible', '', null, null, null, null); INSERT INTO `word` VALUES ('individual', '', null, null, null, null); INSERT INTO `word` VALUES ('it-is-common-that', '', null, null, null, null); INSERT INTO `word` VALUES ('it-is-standard-practice-for-sb-to', '', null, null, null, null); INSERT INTO `word` VALUES ('literature', '', null, null, null, null); INSERT INTO `word` VALUES ('merit', '', null, null, null, null); INSERT INTO `word` VALUES ('motivation', '', null, null, null, null); INSERT INTO `word` VALUES ('not support chinese', '', null, null, null, null); INSERT INTO `word` VALUES ('nowadays', '', null, null, null, null); INSERT INTO `word` VALUES ('optimal', '', null, null, null, null); INSERT INTO `word` VALUES ('partially', '', null, null, null, null); INSERT INTO `word` VALUES ('person', '', null, null, null, null); INSERT INTO `word` VALUES ('predict', 'vt. 预报,预言;预知\r\nvi. 作出预言;作预料,作预报', null, '英 [prɪ\'dɪkt] 美 [prɪ\'dɪkt]', null, null); INSERT INTO `word` VALUES ('prevalent', '', null, null, null, null); INSERT INTO `word` VALUES ('pricey', '', null, null, null, null); INSERT INTO `word` VALUES ('r', '', null, null, null, null); INSERT INTO `word` VALUES ('raise', 'vt. 提高;筹集;养育;升起\r\nvi. 上升\r\nn. 高地;上升;加薪\r\nn. (Raise)人名;(英)雷兹', null, '英 [reɪz] 美 [rez]', null, null); INSERT INTO `word` VALUES ('realistic', '', null, null, null, null); INSERT INTO `word` VALUES ('rebuttal', '', null, null, null, null); INSERT INTO `word` VALUES ('reckon', '', null, null, null, null); INSERT INTO `word` VALUES ('relay', '', null, null, null, null); INSERT INTO `word` VALUES ('sign', 'n. 迹象;符号;记号;手势;指示牌\r\nvi. 签署;签名\r\nvt. 签署;示意', null, '英 [saɪn] 美 [saɪn]', null, null); INSERT INTO `word` VALUES ('significant', '', null, null, null, null); INSERT INTO `word` VALUES ('solid', '', null, null, null, null); INSERT INTO `word` VALUES ('strange', '', null, null, null, null); INSERT INTO `word` VALUES ('thrive', '', null, null, null, null); INSERT INTO `word` VALUES ('tough', '', null, null, null, null); INSERT INTO `word` VALUES ('transition', 'n. 过渡;转变;[分子生物] 转换;变调', null, '英 [træn\'zɪʃ(ə)n; trɑːn-; -\'sɪʃ-] 美 [træn\'zɪʃən]', null, null); INSERT INTO `word` VALUES ('trend', 'n. 趋势,倾向;走向\r\nvi. 趋向,伸向\r\nvt. 使…趋向', null, '英 [trend] 美 [trɛnd]', null, null); INSERT INTO `word` VALUES ('unethical', '', null, null, null, null); INSERT INTO `word` VALUES ('universal', '', null, null, null, null); INSERT INTO `word` VALUES ('utilize', '', null, null, null, null); INSERT INTO `word` VALUES ('whole', '', null, null, null, null); -- ---------------------------- -- Table structure for word_group -- ---------------------------- DROP TABLE IF EXISTS `word_group`; CREATE TABLE `word_group` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(45) NOT NULL, `user_id` int(11) NOT NULL, `user_name` varchar(45) NOT NULL, `note` text, PRIMARY KEY (`id`), KEY `fk_word_group_user_idx` (`user_id`,`user_name`), CONSTRAINT `fk_word_group_user` FOREIGN KEY (`user_id`, `user_name`) REFERENCES `user` (`id`, `name`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB AUTO_INCREMENT=58 DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of word_group -- ---------------------------- INSERT INTO `word_group` VALUES ('1', 'CET6_2017/12.1', '1', 'ninggc', null); INSERT INTO `word_group` VALUES ('2', 'group_2', '2', 'user_2', null); INSERT INTO `word_group` VALUES ('5', 'group_3', '2', 'user_2', null); INSERT INTO `word_group` VALUES ('44', 'group', '1', 'ninggc', null); INSERT INTO `word_group` VALUES ('54', 'CET6_Reading_Test7', '1', 'ninggc', null); INSERT INTO `word_group` VALUES ('57', 'CET6_advanced_vocabulary', '1', 'ninggc', null); -- ---------------------------- -- Table structure for word_has_group -- ---------------------------- DROP TABLE IF EXISTS `word_has_group`; CREATE TABLE `word_has_group` ( `word_word` varchar(45) NOT NULL, `word_group_id` int(11) NOT NULL, PRIMARY KEY (`word_word`,`word_group_id`), KEY `fk_word_has_word_group_word_group1_idx` (`word_group_id`), KEY `fk_word_has_word_group_word1_idx` (`word_word`), CONSTRAINT `fk_word_has_word_group_word_group1` FOREIGN KEY (`word_group_id`) REFERENCES `word_group` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `fk_word_has_word_group_word1` FOREIGN KEY (`word_word`) REFERENCES `word` (`word`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of word_has_group -- ---------------------------- INSERT INTO `word_has_group` VALUES ('advance', '1'); INSERT INTO `word_has_group` VALUES ('bound', '1'); INSERT INTO `word_has_group` VALUES ('confront', '1'); INSERT INTO `word_has_group` VALUES ('consumption', '1'); INSERT INTO `word_has_group` VALUES ('dispute', '1'); INSERT INTO `word_has_group` VALUES ('endless', '1'); INSERT INTO `word_has_group` VALUES ('predict', '1'); INSERT INTO `word_has_group` VALUES ('raise', '1'); INSERT INTO `word_has_group` VALUES ('sign', '1'); INSERT INTO `word_has_group` VALUES ('transition', '1'); INSERT INTO `word_has_group` VALUES ('trend', '1'); INSERT INTO `word_has_group` VALUES ('advance', '2'); INSERT INTO `word_has_group` VALUES ('advocate', '54'); INSERT INTO `word_has_group` VALUES ('appear', '54'); INSERT INTO `word_has_group` VALUES ('causal', '54'); INSERT INTO `word_has_group` VALUES ('caution', '54'); INSERT INTO `word_has_group` VALUES ('cite', '54'); INSERT INTO `word_has_group` VALUES ('collapse', '54'); INSERT INTO `word_has_group` VALUES ('commend', '54'); INSERT INTO `word_has_group` VALUES ('compel', '54'); INSERT INTO `word_has_group` VALUES ('conclusion', '54'); INSERT INTO `word_has_group` VALUES ('contend', '54'); INSERT INTO `word_has_group` VALUES ('contribute', '54'); INSERT INTO `word_has_group` VALUES ('crisis', '54'); INSERT INTO `word_has_group` VALUES ('efficiently', '54'); INSERT INTO `word_has_group` VALUES ('exert', '54'); INSERT INTO `word_has_group` VALUES ('incentive', '54'); INSERT INTO `word_has_group` VALUES ('literature', '54'); INSERT INTO `word_has_group` VALUES ('merit', '54'); INSERT INTO `word_has_group` VALUES ('motivation', '54'); INSERT INTO `word_has_group` VALUES ('partially', '54'); INSERT INTO `word_has_group` VALUES ('prevalent', '54'); INSERT INTO `word_has_group` VALUES ('realistic', '54'); INSERT INTO `word_has_group` VALUES ('rebuttal', '54'); INSERT INTO `word_has_group` VALUES ('relay', '54'); INSERT INTO `word_has_group` VALUES ('solid', '54'); INSERT INTO `word_has_group` VALUES ('thrive', '54'); INSERT INTO `word_has_group` VALUES ('unethical', '54'); INSERT INTO `word_has_group` VALUES ('advancement', '57'); INSERT INTO `word_has_group` VALUES ('affluent', '57'); INSERT INTO `word_has_group` VALUES ('approximately', '57'); INSERT INTO `word_has_group` VALUES ('common', '57'); INSERT INTO `word_has_group` VALUES ('companions', '57'); INSERT INTO `word_has_group` VALUES ('complex', '57'); INSERT INTO `word_has_group` VALUES ('complicated', '57'); INSERT INTO `word_has_group` VALUES ('consequence', '57'); INSERT INTO `word_has_group` VALUES ('consequently', '57'); INSERT INTO `word_has_group` VALUES ('crucial', '57'); INSERT INTO `word_has_group` VALUES ('currently', '57'); INSERT INTO `word_has_group` VALUES ('dangerous', '57'); INSERT INTO `word_has_group` VALUES ('demonstrate', '57'); INSERT INTO `word_has_group` VALUES ('development', '57'); INSERT INTO `word_has_group` VALUES ('eccentric', '57'); INSERT INTO `word_has_group` VALUES ('entire', '57'); INSERT INTO `word_has_group` VALUES ('expensive', '57'); INSERT INTO `word_has_group` VALUES ('fantastic', '57'); INSERT INTO `word_has_group` VALUES ('frequently', '57'); INSERT INTO `word_has_group` VALUES ('hazardous', '57'); INSERT INTO `word_has_group` VALUES ('hinge-on', '57'); INSERT INTO `word_has_group` VALUES ('important', '57'); INSERT INTO `word_has_group` VALUES ('increasingly', '57'); INSERT INTO `word_has_group` VALUES ('incredible', '57'); INSERT INTO `word_has_group` VALUES ('individual', '57'); INSERT INTO `word_has_group` VALUES ('it-is-common-that', '57'); INSERT INTO `word_has_group` VALUES ('it-is-standard-practice-for-sb-to', '57'); INSERT INTO `word_has_group` VALUES ('nowadays', '57'); INSERT INTO `word_has_group` VALUES ('optimal', '57'); INSERT INTO `word_has_group` VALUES ('person', '57'); INSERT INTO `word_has_group` VALUES ('pricey', '57'); INSERT INTO `word_has_group` VALUES ('reckon', '57'); INSERT INTO `word_has_group` VALUES ('significant', '57'); INSERT INTO `word_has_group` VALUES ('strange', '57'); INSERT INTO `word_has_group` VALUES ('tough', '57'); INSERT INTO `word_has_group` VALUES ('universal', '57'); INSERT INTO `word_has_group` VALUES ('utilize', '57'); INSERT INTO `word_has_group` VALUES ('whole', '57');
SELECT * FROM caregiver_availability WHERE user_id = $1;
Pós Graduação em Digital Technologies For Management 1ª Edição - Ano Letivo 2020/2021 UC de Database Management Projecto Final Imagine um website de avaliação de filmes, ondem os críticos inserem as suas classificações. O website ainda não contém muitos dados, mas já permite efetuar algumas consultas interessantes. O esquema é o seguinte: Filme ( fID, titulo, ano, realizador ) Cada filme é identificado por um número fID, um título, ano de produção e realizador. Critico ( cID, nome ) Cada crítico é identificado por um número cID e pelo seu nome. Classificacao ( cID, fID, estrelas, dataClassificacao ) Cada classificação é caraterizada pelo nº do crítico, nº do filme, nº de estrelas atribuídas (1-5) e data da classificação. Perguntas: 1. Listar os títulos de todos os filmes dirigidos por Steven Spielberg. select * from filme where realizador = 'Steven Spielberg' 2. Listar todos os anos em que foi produzido um filme que recebeu uma classificação de 4 ou 5, e ordene-os por ordem crescente. select distinct ano from filme f, classificacao c where f.fid = c.fid and estrelas between 4 and 5 order by ano asc 3. Listar os títulos de todos os filmes que não têm nenhuma classificação. Select titulo from filme f left join classificacao c on f.fid=c.fid where estrelas is null; 4. Alguns críticos não inseriram a data correspondente à sua classificação. Listar os nomes de todos os críticos que têm classificações em que a correspondente data é NULL. select nome from critico c, classificacao cl where c.id in ( select cid         from classificacao where dataclassificacao is null ) 5. Escrever uma query que apresenta as classificações no seguinte formato: nome do crítico, título do filme, nº de estrelas e data da classificação. Ordene o resultado por esta ordem: nome do crítico, título do filme, nº de estrelas. select distinct cr.nome nomedocritico, titulo titulodofilme, estrelas nºestrelas, dataclassificacao datadaclassificação from critico cr, classificacao cl, filme f where cr.cid = cl.cid and cl.fid = f.fid order by nomedocritico, titulodofilme, nºestrelas 6. Em todos os casos em que o mesmo crítico classificou o mesmo filme duas vezes, sendo a 2ª classificação superior à 1ª, listar o nome do crítico e o título do filme. select distinct cr.nome, f.titulo, cla.estrelas from critico cr join classificacao cl on cr.cid = cl.cid join classificacao cla on cl.cid = cla.cid join filme f on cl.fid = f.fid where cl.dataclassificacao < cla.dataclassificacao and cl.estrelas < cla.estrelas and cl.fid = cla.fid 7. Para cada filme com pelo menos uma classificação, pesquisar a classificação máxima que lhe foi atribuída. Listar o título do filme e a classificação máxima, ordenando por título do filme. select titulo, max(estrelas) as classificaçãomáxima from filme f join classificacao cla on f.fid = cla.fid group by titulo order by titulo 8. Listar os títulos dos filmes e as médias das classificações por ordem decrescente destas últimas. Listar por ordem alfabética os filmes com as mesmas médias. select titulo, cast(avg(estrelas) as decimal(10,1)) as médiaclassificação from filme f join classificacao cl on f.fid = cl.fid group by titulo order by titulo, médiaclassificação desc -- coloquei a média com uma casa decimal 9. Listar os nomes de todos os críticos que contribuíram com 3 ou mais classificações. select distinct nome from critico cr join classificacao cl on cr.cid = cl.cid group by nome having count (*) >= 3 10. Adicione à base de dados o crítico Diogo Silva, com um cID=209. insert into critico values (209, 'Diogo Silva') 11. Para cada filme, listar o seu título e a diferença entre a classificação mais alta e mais baixa que lhe foram atribuídas. Ordenar por ordem descendente da diferença de classificações e depois pelo título do filme. select titulo, (max(estrelas)-min(estrelas)) as diferençaclassificações from filme f, classificacao cl where f.fid = cl.fid group by titulo order by diferençaclassificações desc, titulo 12. Listar a diferença entre as médias das classificações dos filmes produzidos antes de 1980 e no ano de 1980 e seguintes. Deve ser calculada a média da classificação para cada filme e depois calculada a média das médias para os filmes anteriores a 1980 e os produzidos nos anos de 1980 e seguintes. SELECT ( AVG(CASE WHEN ano < 1980 THEN avg END)) - (AVG(CASE WHEN ano >= 1980 THEN avg END) ) diferençamédias FROM ( SELECT f.fid, f.ano, AVG(estrelas) avg FROM filme f JOIN classificacao c ON f.fid = c.fid GROUP BY f.fid, f.ano ) ---------------------------------------- select avg(Mantes)-avg(Mdepois) diferencamedias from ( select avg(estrelas)Mantes from classificacao cl join filme f on cl.fid = f.fid where ano < 1980 group by cl.fid ) MediaB1980 , ( select avg(estrelas)MDepois from classificacao cl join filme f on cl.fid = f.fid where ano >= 1980 group by cl.fid ) MediaA1980 -- fiz dois inline views, um para perceber a média da classificação antes de 1980 ( where ano < 1980 ) e outro para 1980 e depois ( where ano >= 1980 ) para -- no SELECT fazer a subtração entre um e o outro. 13. Para todos os realizadores de mais de um filme, listar o seu nome e os títulos dos filmes que realizaram, ordenados por nome do realizador, título do filme. select f.realizador, f.titulo from filme f join filme fl on f.realizador = fl.realizador group by f.titulo, f.realizador having count (f.titulo) > 1 order by f.realizador, f.titulo --------------- SELECT distinct f.realizador, f.titulo FROM filme f WHERE f.realizador IN (SELECT f.realizador FROM filme f GROUP BY f.realizador HAVING count(titulo) >1) ORDER BY f.realizador, f.titulo 14. Listar o(s) título(s) do(s)filme(s) com a maior média de classificações, bem como essa média. select titulo, avg(estrelas) from filme f join classificacao c on f.fid = c.fid group by titulo having avg(estrelas) = ( select max(avg(estrelas)) from classificacao c group by c.fid ) 15. Para cada par filme, crítico (título do filme e nome do crítico) liste o nº de classificações (um filme pode ser avaliado mais do que uma vez por um crítico, em datas diferentes). Listar também o nº de classificações por filme e por crítico, bem como o nº total de classificações. select f.titulo, cr.nome, count(estrelas) as nºclassificacoes from filme f, classificacao c, critico cr where f.fid=c.fid and c.cid=cr.cid group by cube (f.titulo, cr.nome) order by f.titulo, cr.nome 16. Apresente o ranking dos filmes por ordem descendente de média de classificação. Select titulo, rank() over (order by avg(estrelas) desc) as Ranking, cast(avg(estrelas) as decimal(10,1)) MediaClassif from filme natural join classificacao group by titulo; -- pode-se usar o dense_rank ao invés de rank para não deixar gaps no ranking em que existam empates. 17. Para cada realizador, apresente o ranking dos seus filmes por ordem descendente de média de classificação. select realizador, titulo, avg(estrelas) ClassMedia, rank() over(partition by realizador order by avg(estrelas) desc) as ranking from filme natural join classificacao group by realizador, titulo
SELECT birthdate FROM MOVIESTAR WHERE Name="Kim Basinger"
############### Importing file using the Import wizard of MySQL workbench ############ use assignment; set SQL_SAFE_UPDATES = 0; ############## Describe the data types of variables in the repective company table ############# desc `bajaj auto`; desc `eicher motors`; desc `hero motocorp`; desc `infosys`; desc `tcs`; desc `tvs motors`; ######### Creating temporary tables to convert Date variable to date format so that it could be sorted and fetch Close Price ######## create table bajajtemp select str_to_date(Date,'%d-%M-%Y') Date,`Close Price` from `bajaj auto`; create table eichertemp select str_to_date(Date,'%d-%M-%Y') Date,`Close Price` from `eicher motors`; create table herotemp select str_to_date(Date,'%d-%M-%Y') Date,`Close Price` from `hero motocorp`; create table infosystemp select str_to_date(Date,'%d-%M-%Y') Date,`Close Price` from `infosys`; create table tcstemp select str_to_date(Date,'%d-%M-%Y') Date,`Close Price` from `tcs`; create table tvstemp select str_to_date(Date,'%d-%M-%Y') Date,`Close Price` from `tvs motors`; ################################################################################################ ################## 1 Calculating the 20 and 50 Days Moving Average ############################# ################################################################################################
SELECT A.RACK_CD, A.RACK_NM, A.TOTAL_CELLS - COALESCE(B.ASSIGNED_CELLS, 0) AS REMAIN_CELLS, COALESCE(B.ASSIGNED_CELLS, 0) AS ASSIGNED_CELLS, COALESCE(B.ASSIGNED_PCS, 0) AS ASSIGNED_PCS FROM ( SELECT REG.RACK_CD, REG.RACK_NM, COUNT(LOC.EQUIP_CD) AS TOTAL_CELLS FROM CELLS LOC INNER JOIN RACKS REG ON LOC.DOMAIN_ID = REG.DOMAIN_ID AND LOC.EQUIP_CD = REG.RACK_CD WHERE LOC.DOMAIN_ID = :domainId AND REG.STAGE_CD = :stageCd AND (REG.BATCH_ID IS NULL OR LENGTH(REG.BATCH_ID) = 0) AND LOC.ACTIVE_FLAG = :activeFlag #if($equipCds) AND REG.RACK_CD IN (:equipCds) #end GROUP BY REG.RACK_CD, REG.RACK_NM ) A LEFT OUTER JOIN (SELECT EQUIP_CD, COUNT(DISTINCT(CELL_ASSGN_CD)) AS ASSIGNED_CELLS, SUM(TOTAL_PCS) AS ASSIGNED_PCS FROM ORDER_PREPROCESSES WHERE DOMAIN_ID = :domainId AND BATCH_ID = :batchId GROUP BY EQUIP_CD) B ON A.RACK_CD = B.EQUIP_CD ORDER BY A.RACK_CD
-- phpMyAdmin SQL Dump -- version 4.3.8 -- http://www.phpmyadmin.net -- -- Host: localhost -- Generation Time: Sep 18, 2017 at 07:56 AM -- Server version: 5.6.32-78.1-log -- PHP Version: 5.6.20 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: `spmgroup_empmanage` -- -- -------------------------------------------------------- -- -- Table structure for table `employee` -- CREATE TABLE IF NOT EXISTS `employee` ( `emp_id_auto` int(11) NOT NULL, `fname` varchar(255) DEFAULT NULL, `lname` varchar(255) DEFAULT NULL, `emp_id` varchar(255) DEFAULT NULL, `image` text, `father_name` varchar(255) DEFAULT NULL, `mob_no` varchar(255) DEFAULT NULL, `phn_no` varchar(255) DEFAULT NULL, `bld_grp` varchar(255) DEFAULT NULL, `rltv_phn` varchar(255) DEFAULT NULL, `frnd_phn` varchar(255) DEFAULT NULL, `adhar_no` varchar(255) DEFAULT NULL, `voter_id` varchar(255) DEFAULT NULL, `pan_card` varchar(255) DEFAULT NULL, `epf_no` varchar(255) DEFAULT NULL, `uan_no` varchar(255) DEFAULT NULL, `dob` varchar(255) DEFAULT NULL, `refrnce` varchar(255) DEFAULT NULL, `bank` varchar(255) DEFAULT NULL, `branch` varchar(255) DEFAULT NULL, `acc_name` varchar(255) DEFAULT NULL, `acc_no` varchar(255) DEFAULT NULL, `ifc_cose` varchar(255) DEFAULT NULL, `micr_code` varchar(255) DEFAULT NULL, `join_date` varchar(255) DEFAULT NULL, `base_sal` varchar(255) DEFAULT NULL, `emp_epf` varchar(255) DEFAULT NULL, `emp_esi` varchar(255) DEFAULT NULL, `house_rent` varchar(255) DEFAULT NULL, `tot_sal` varchar(255) DEFAULT NULL, `increment_date` varchar(255) DEFAULT NULL, `inc_rate` varchar(255) DEFAULT NULL, `nxt_inc` varchar(255) DEFAULT NULL, `area` varchar(255) DEFAULT NULL, `category` varchar(255) DEFAULT NULL, `contractor_name` varchar(255) DEFAULT NULL, `plant_name` varchar(255) DEFAULT NULL, `regno` varchar(255) DEFAULT NULL, `email` varchar(255) DEFAULT NULL, `age` varchar(255) DEFAULT NULL, `religion` varchar(255) DEFAULT NULL, `maritial_status` varchar(255) DEFAULT NULL, `spouse_details` varchar(255) DEFAULT NULL, `no_of_children` varchar(255) DEFAULT NULL, `edu_qualification` varchar(255) DEFAULT NULL, `language` varchar(255) DEFAULT NULL, `convicted` varchar(255) DEFAULT NULL, `convicted_details` text, `dl` varchar(255) DEFAULT NULL, `pasport` varchar(255) DEFAULT NULL, `other_details` text, `identification_mark` varchar(255) DEFAULT NULL, `other_disease` varchar(255) DEFAULT NULL, `medical_certificate` varchar(255) DEFAULT NULL, `emargency_contact_person` varchar(255) DEFAULT NULL, `emargency_contact_relation` varchar(255) DEFAULT NULL, `emargency_contact_no` varchar(255) DEFAULT NULL, `emargency_contact_address` varchar(255) DEFAULT NULL, `par_vill` varchar(255) DEFAULT NULL, `par_ps` varchar(255) DEFAULT NULL, `par_pin` varchar(255) DEFAULT NULL, `par_dis` varchar(255) DEFAULT NULL, `pre_vill` varchar(255) DEFAULT NULL, `pre_ps` varchar(255) DEFAULT NULL, `pre_dis` varchar(255) DEFAULT NULL, `pre_pin` varchar(255) DEFAULT NULL, `mother_name` varchar(255) DEFAULT NULL ) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1; -- -- Dumping data for table `employee` -- INSERT INTO `employee` (`emp_id_auto`, `fname`, `lname`, `emp_id`, `image`, `father_name`, `mob_no`, `phn_no`, `bld_grp`, `rltv_phn`, `frnd_phn`, `adhar_no`, `voter_id`, `pan_card`, `epf_no`, `uan_no`, `dob`, `refrnce`, `bank`, `branch`, `acc_name`, `acc_no`, `ifc_cose`, `micr_code`, `join_date`, `base_sal`, `emp_epf`, `emp_esi`, `house_rent`, `tot_sal`, `increment_date`, `inc_rate`, `nxt_inc`, `area`, `category`, `contractor_name`, `plant_name`, `regno`, `email`, `age`, `religion`, `maritial_status`, `spouse_details`, `no_of_children`, `edu_qualification`, `language`, `convicted`, `convicted_details`, `dl`, `pasport`, `other_details`, `identification_mark`, `other_disease`, `medical_certificate`, `emargency_contact_person`, `emargency_contact_relation`, `emargency_contact_no`, `emargency_contact_address`, `par_vill`, `par_ps`, `par_pin`, `par_dis`, `pre_vill`, `pre_ps`, `pre_dis`, `pre_pin`, `mother_name`) VALUES (1, 'John ', 'Cena', 'EMP001', 'imgres15033132491505284664.jpg', 'Jack Cena', '9800261025', '850924520', 'B+', '9547856321', '7563214569', '456123456123456457', 'WB45245524', 'PANYJ5852', '294369124264032', '98243298462938462934', '09/10/2007', 'n/a', 'SBI', 'US', 'John cena', '45632146632145632448', 'SBIN00012336', '665', '2015-07-13', '15000', '120', '1200', '500', '20000', '2017-09-22', '500', '2017-09-30', 'US', 'SKILLED', 'Lorem Ipsum', 'Ipsum', 'SPM/EMP/2', 'cena.john@gmail.com', '10', 'Hindu', 'unmarried', 'n/a', 'n/a', 'BA', 'Bengali', 'No', 'n/a', 'n/a', 'n/a', 'n/a', 'n/a', 'n/a', 'No', 'Mark Doe', 'Brother', '7896541236', '123 Demo Street, London , US', '123 Demo Street', 'CA', '654785', 'US', '123 Demo Street', 'CA', 'US', '654785', NULL); -- -------------------------------------------------------- -- -- Table structure for table `td_admin` -- CREATE TABLE IF NOT EXISTS `td_admin` ( `id` int(10) NOT NULL, `user` varchar(255) NOT NULL, `pass` char(255) NOT NULL, `name` varchar(100) NOT NULL, `photo` varchar(100) NOT NULL, `pass_original` varchar(255) NOT NULL, `login_allow` int(11) NOT NULL, `sub_admin` int(11) NOT NULL, `attempt_count` int(11) NOT NULL, `remote_ip` varchar(255) NOT NULL ) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=latin1; -- -- Dumping data for table `td_admin` -- INSERT INTO `td_admin` (`id`, `user`, `pass`, `name`, `photo`, `pass_original`, `login_allow`, `sub_admin`, `attempt_count`, `remote_ip`) VALUES (1, 'admin', '4e5ee4cc4f29dffd24a7c9749db7020066c41361e7b04d03d46ebcea42b7e93a', 'Bell', 'Bells_png1467191859.png', 'Spm@123#', 0, 0, 121, '116.193.128.129'), (3, 'Punam', '334e23ca9a89c8c898937ddf3a5ab3c45de4a7df20f99da893833a3bcb9585a1', '', '', 'Punam@123', 1, 1, 0, ''), (4, 'Ashish', '0645cc51a712f9d90d176fefda7973396678ee742fd45ea9612b1f37375d1568', '', '', 'Ashish@123', 1, 1, 2, '27.131.213.209'), (5, 'Sujata', '629c2cd5e4e27d13749e09a85573d0246e9bffb20161378cb1bf25e2ddba2455', '', '', 'Sujata@123', 1, 1, 0, ''), (7, 'Shankar', '438e4b56aa2aee059163164788cab0d53f325aeaed62db61e3c5bc2709f316b8', '', '', 'Shankar@123', 1, 1, 0, ''); -- -------------------------------------------------------- -- -- Table structure for table `td_pass_key` -- CREATE TABLE IF NOT EXISTS `td_pass_key` ( `id` int(10) NOT NULL, `pass_key` varchar(255) NOT NULL ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1; -- -- Dumping data for table `td_pass_key` -- INSERT INTO `td_pass_key` (`id`, `pass_key`) VALUES (1, '23#Spm@123#Spm'); -- -- Indexes for dumped tables -- -- -- Indexes for table `employee` -- ALTER TABLE `employee` ADD PRIMARY KEY (`emp_id_auto`); -- -- Indexes for table `td_admin` -- ALTER TABLE `td_admin` ADD PRIMARY KEY (`id`); -- -- Indexes for table `td_pass_key` -- ALTER TABLE `td_pass_key` ADD PRIMARY KEY (`id`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `employee` -- ALTER TABLE `employee` MODIFY `emp_id_auto` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=2; -- -- AUTO_INCREMENT for table `td_admin` -- ALTER TABLE `td_admin` MODIFY `id` int(10) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=8; -- -- AUTO_INCREMENT for table `td_pass_key` -- ALTER TABLE `td_pass_key` MODIFY `id` int(10) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=2; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
drop table eater_activities;
select * from 20200602_tb_user; insert into 20200602_tb_user(userId, userName,userCard) values (null, 'abc','123456789012345679'); set @@autocommit = 0; rollback; commit; update `20200602_tb_user` set userSex=1 where userId = 1; update `20200602_tb_user` set userSex=1 where userId = 2;
--SCOTT/TIGER로 접속 --SCOTT/TIGER의 emp 출력 conn SCOTT/TIGER select * from emp ; select * from dept; select * from salgrade; decs emp; --사원이름 / 월급/ 부서이름 select ename, sal,deptno from emp; --사원이름 / 입사날짜 select ename,hiredate from emp; --부서번호/부서이름 select deptno, dname from dept; --//중복제거 안되고 그대로 모든 직업정보나옴 select select job from emp --중복제거 된 job select distinct select job from emp; --직원이름 , 급여 , 급여 * 12 select ename, sal, sal*12 from emp; --이름변경 유일하게 "" 쓰는 구간 (나머지는 ''로 사용함) select ename, sal, sal*12 as "연봉" from emp; --직원이름, 직원, 연봉, commiton(영업수당) 정보 출력 select ename,job sal, comm from emp; --월급 + 영업수당 = 실급여 select ename, job, sal, comm, sal + comm as "실급여" from emp; --null일땐 0으로 바꿔 !!nvl!! comm이 null이라면 -1출력 -- * null과 0은 다르다! null운 -1 0은 0 select ename, job, sal, comm, sal + comm ,nvl(comm,-1) from emp; --null일땐 0으로 바꿔 !!nvl!! comm이 null이라면 0출력 select ename, job, sal, comm, sal + comm ,nvl(comm,0) from emp; --이름 설정 select ename, job, sal, comm, sal + comm ,nvl(comm,0)as "총급여" from emp; --사번, 사원이름, 상사직번 select empno, ename,mgr from emp; --상사가 없는 사람은 CEO라고 출력 select empno, ename,nvl(mgr,'<<CEO>>') from emp; --************에러내용 select empno, ename,nvl(mgr,'<<CEO>>') * ERROR at line 1: ORA-01722: invalid number --타입이 일치하지 않아서 오류 'ceo'가 number가 아니다 --**************** --문자열로 바꾸기 to_char / number / date select empno, ename,nvl(to_char(mgr),'<<CEO>>') as "매니저 코드" from emp; --문자열 연결 연산자 || select ename|| job from emp; --공백포함 select ename||' '|| job from emp; --행 개수만큼 출력된다 (16줄출력) select 20*20*4 from emp; --가상의 테이블을 만들어주는 dual select 20*20*4 from dual; -- sysdate년 /월/일 정보 출력 select SYSDATE from dual; --로그인한 유저의 정보 출력 select user from dual; --where 조건절 row에 제한을 걸음 select ename,job,deptno from emp where deptno = 10; --10번부서에 해당하는 이름, 직업, 부서번호 출력 select ename,job,deptno from emp where job = 'MANAGER'; --대소문자 구분하니까 주의해서 쓰기 --대문자 변환 함수 / lower 소문자 변환 함수 select ename,job,deptno from emp where UPPER(job) = UPPER('manager'); --82이년도 이후에 입사한 사람들 목록 select ename, hiredate from emp where hiredate > '82/01/01'; --82년 5월 1일 입사한 사람을 제외한 사람들 (!=) 도 가능함 select ename, hiredate from emp where hiredate <> '82/05/01'; --between and select ename, sal from emp; where sal >=2450 and sal <=3000; ---2450 / 3000도 포함된다 작은 값 먼저 ㅊ터리하기 select ename, sal from emp where sal between 2450 and 3000; --사번이 10번이거나 20번이거나 select ename, job, deptno from emp where deptno = 10d or deptno = 20; select ename, job, deptno from emp where deptno in(10,20); ---dept 테이블 모두 출력 select * from dept; --괄호 deptno가 20이면서 loc가 dalla스이거나 deptno가 30이면서 chicago인 select * from dept where (deptno,loc) in ((20,'DALLAS'),(30,'CHICAGO')); --like 연산자 ---이름이 A인 사람 select * from emp where ename = 'A' --이름이 A로 시작하는 사람 % :와일드카드 select * from emp where ename like 'A%'; --A로 끝나는 사람 select * from emp where ename like '%A'; --A가 포함되는 사람 select * from emp where ename like '%A%'; --뒤에서 3글자 앞이 A인사람 ~~AOO 인사람 select * from emp where ename like '%A__'; --81년도에 입사한 사원 목록 select * from emp where hiredate like '81%'; ---12/24 --WHERE 절에서 NULL 처리하기 SELECT * FROM EMP; ----MGR이 NULL인 값 출력 SELECT * FROM emp WHERE mgr IS NULL; ---MGR이 NULL이 아닌 값 출력 SELECT * FROM EMP WHERE MGR IS NOT NULL; --총급여가 2000이상인 값 출력 --WHERE에는 별칭(alias)사용이 안된다 SELECT ENAME,SAL,COMM, SAL+ NVL(COMM,0) AS "총급여" FROM EMP WHERE SAL+COMM(COMM,0) >2000; --정렬 SAL을 기준으로 오름차순 --오른차순(ASC)이 DEFAULT! SELECT ENAME,SAL,COMM, SAL+ NVL(COMM,0) AS "총급여" FROM EMP ORDER BY SAL; --내림차순 SELECT ENAME,SAL,COMM, SAL+ NVL(COMM,0) AS "총급여" FROM EMP ORDER BY SAL DESC; ----이중 가능 SELECT ENAME,SAL,COMM, SAL+ NVL(COMM,0) AS "총급여" FROM EMP ORDER BY SAL ASC, COMM DESC; ---SELECT에 없어도 가능 SELECT ENAME,SAL, SAL+ NVL(COMM,0) AS "총급여" FROM EMP ORDER BY SAL ASC, COMM DESC; ---WHERE없어도 SELECT에 없어도 가능 SELECT ENAME,SAL, SAL+ NVL(COMM,0) AS "총급여" FROM EMP WHERE COMM IS NOT NULL ORDER BY SAL ASC, COMM DESC; ---ALIAS문구로 정렬 가능 SELECT ENAME,SAL, SAL+ NVL(COMM,0) AS "총급여" FROM EMP WHERE SAL+NVL(COMM,0)>=2000 ORDER BY "총급여" ---위치인덱스로도 정렬 가능 SELECT ENAME,SAL, SAL+ NVL(COMM,0) AS "총급여" FROM EMP WHERE SAL+NVL(COMM,0)>=2000 ORDER BY 3; ---단일형 함수 select dname, lower(dname),loc,lower(loc) from dept; ---반올림 ,자릿수 표현, 소수점 다 자르기 select round(44.55),round(44.55,1),trunc(44.55) from dual; select sal, trunc(sal*0.03) as "TAX" from emp; ---문자열 자르기 : 월만 출력 select ename,hiredate,substr(hiredate,4,2) as 입사월 from emp; --사원의 입사월이 12월인 정보 추출 select ename,hiredate from emp where substr(hiredate,4,2) like '12'; --+해도 알아서 날짜연산된당 select sysdate, sysdate+30 from dual; ---인덱스 1부터 시작 4번째부터 2자리 select sysdate, substr(sysdate,4,2)from dual; --format 변경 select sysdate, to_char(sysdate,'yy')from dual; select sysdate, to_char(sysdate,'yyyy')from dual; select sysdate, to_char(sysdate,'day')from dual; select sysdate, to_char(sysdate,'mm')from dual; select sysdate, to_char(sysdate,'dd')from dual; --emp에서 사원들의 사원명, 입사월 및 요일 정보 출력, 월별정렬 (오류남 수정) select ename, to_char(HIREDATE,'mm')as"입사 월",to_char(HIREDATE,'day') as "요일" from EMP order by "입사 월"; --날짜형의 다양한 형태 select sysdate,to_date('2019/12/24') from dual; select sysdate,to_date('2019-12-24') from dual; select sysdate,to_date('2019 12 24') from dual; --년월일 순 select sysdate,to_date('19 12 19') from dual; select sysdate,to_date('12/24/19','mm/dd/yy') from dual; --decode 함수 if문 select ename,sal,decode(deptno, 10,sal*1.2, 20,sal*0.7,sal)as "보너스" from emp order by deptno;
/************************************************** INITIALIZATION **************************************************/ drop database if exists invoices; create database invoices character set = utf8; use invoices; /************************************************** TABLES **************************************************/ drop table if exists users; create table users ( user_id int unsigned not null auto_increment, username varchar(100) not null, -- active directory username; "samaccountname" initials varchar(5) not null, -- active directory initials; "initials" is_admin bool not null default false, is_active bool not null default true, primary key (user_id), unique key unique_username (username) ) engine = innodb default charset = utf8; drop table if exists inmate_units; create table inmate_units ( inmate_unit_id int unsigned not null auto_increment, unit_name varchar(100) not null, tdcj_unit_number varchar(10) null default null, -- unit number used for interagency mail address_1 varchar(200) not null, address_2 varchar(200) null default null, city varchar(100) not null, state varchar(100) not null, zip varchar(100) not null, primary key (inmate_unit_id) ) engine = innodb character set = utf8; drop table if exists patrons; create table patrons ( patron_id int unsigned not null auto_increment, first_name varchar(100) null default null, middle_name varchar(100) null default null, last_name varchar(100) null default null, office varchar(200) null default null, address_1 varchar(200) null default null, address_2 varchar(200) null default null, city varchar(100) null default null, state varchar(100) null default null, zip varchar(100) null default null, country varchar(100) null default null, inmate_number varchar(100) null default null, inmate_unit_id int unsigned null default null, phone varchar(100) null default null, phone_alt varchar(100) null default null, fax varchar(100) null default null, email varchar(100) null default null, is_frozen bool not null default false, frozen_on datetime null default null, is_tax_exempt bool not null default false, is_government_agency bool not null default false, has_billing_agreement bool not null default false, notes text null default null, created_on datetime not null, created_by int unsigned not null, last_modified_by int unsigned null default null, primary key (patron_id), foreign key fk_inmate_unit_id (inmate_unit_id) references inmate_units (inmate_unit_id), foreign key fk_created_by (created_by) references users (user_id), foreign key fk_last_modified_by (last_modified_by) references users (user_id) ) engine = innodb default charset = utf8; -- a table to store all modifications to the patrons table -- populated by trigger_patrons_after_update -- because it does not have a primary key, Entity Framework will treat this as a read-only view, which is OK since it is populated by trigger. -- see http://stackoverflow.com/questions/3996782/entity-framework-table-without-primary-key drop table if exists patrons_audit_log; create table patrons_audit_log ( edited_by int unsigned not null, edited_on datetime not null, patron_id int unsigned not null, column_edited varchar(100) not null, old_value text, new_value text, foreign key fk_edited_by (edited_by) references users (user_id), foreign key fk_patron_id (patron_id) references patrons (patron_id) on delete cascade ) engine = innodb default charset = utf8; drop table if exists patron_contacts; create table patron_contacts ( patron_contact_id int unsigned not null, patron_id int unsigned not null, contact_name varchar(255) not null, phone varchar(100) null default null, email varchar(100) null default null, notes text null default null, created_by int unsigned not null, created_on datetime not null, primary key (patron_contact_id), foreign key fk_patron_id (patron_id) references patrons (patron_id), foreign key fk_created_by (created_by) references users (user_id) ) engine = innodb default charset = utf8; drop table if exists tax_rates; create table tax_rates ( tax_rate_id int unsigned not null auto_increment, description varchar(100) not null, tax_rate decimal(5,4) not null default 0, is_active bool not null default true, primary key (tax_rate_id), unique key unique_description (description) ) engine = innodb default charset = utf8; drop table if exists product_categories; create table product_categories ( product_category_id int unsigned not null auto_increment, description varchar(100) not null, notes text null default null, comptroller_object_code varchar(10) null default null, -- COBJ agency_object_code varchar(10) null default null, -- AOBJ transaction_code varchar(10) null default null, -- TC; likely not to be used here since it is used in USAS software program_cost_account varchar(10) null default null, -- PCA; likely not to be used here & AAS says we are such a small agency we only have one PCA (subfunds) is_active bool not null default true, primary key (product_category_id), unique key unique_description (description) ) engine = innodb default charset = utf8; drop table if exists products; create table products ( product_id int unsigned not null auto_increment, product_category_id int unsigned not null, description varchar(100) not null, unit_price decimal(11,2) not null default 0, -- store prices up to 999,999,999.99 notes text null default null, is_taxable bool not null, is_active bool not null default true, is_information_provided bool not null default false, primary key (product_id), foreign key fk_product_category_id (product_category_id) references product_categories (product_category_id) ) engine = innodb default charset = utf8; drop table if exists payment_methods; create table payment_methods ( payment_method_id int unsigned not null auto_increment, description varchar(100) not null, primary key (payment_method_id), unique key unique_description (description) ) engine = innodb default charset = utf8; drop table if exists invoices; create table invoices ( invoice_id int unsigned not null auto_increment, patron_id int unsigned not null, public_notes text null default null, private_notes text null default null, is_tax_exempt bool not null default false, is_read_only bool not null default false, created_by int unsigned not null, created_on datetime not null, locked_on datetime null default null, -- the date this invoice was set as read only, is_void bool not null default false, primary key (invoice_id), foreign key fk_patron_id (patron_id) references patrons (patron_id), foreign key fk_created_by (created_by) references users (user_id), index idx_readonly (is_read_only), index idx_void (is_void) ) engine = innodb default charset = utf8; -- this table is updated by triggers; do not update it! instead, update invoices.is_tax_exempt as well as the tax_rates table. -- populated by trigger_invoices_after_insert, trigger_invoices_after_update, trigger_invoices_after_delete. -- for each invoice, this table is populated with copies of all the active taxes in the tax_rates table -- they are stored here as snapshots of the tax rates that existed when the invoice was created so that we don't rely on -- the data in the tax_rates table, which may change in the future and cause totals to change on finalized invoices. drop table if exists invoice_tax_rates; create table invoice_tax_rates ( invoice_tax_rate_id int unsigned not null auto_increment, invoice_id int unsigned not null, tax_rate decimal(5,4) not null, description varchar(100) not null, primary key (invoice_tax_rate_id), foreign key fk_invoice_id (invoice_id) references invoices (invoice_id) on delete cascade -- using 'on delete cascade' since this table shouldn't be touched manually ) engine = innodb default charset = utf8; -- this table is updated by triggers; do not update it! instead, update invoice_items, invoices, or payments -- populated by trigger_invoices_after_insert, trigger_invoices_after_update, trigger_invoices_after_delete, -- trigger_invoice_items_after_insert, trigger_invoice_items_after_update, trigger_invoice_items_after_delete, -- trigger_payments_after_insert, trigger_payments_after_update, trigger_payments_after_delete. drop table if exists invoice_amounts; create table invoice_amounts ( invoice_id int unsigned not null, subtotal decimal(11,2) not null default 0, tax_not_rounded decimal(12,3) not null default 0, tax decimal(11,2) not null default 0, total decimal(11,2) not null default 0, paid decimal(11,2) null default null, balance decimal(11,2) null default null, primary key (invoice_id), foreign key fk_invoice_id (invoice_id) references invoices (invoice_id) on delete cascade, -- using 'on delete cascade' since this table shouldn't be touched manually index idx_balance (balance) ) engine = innodb default charset = utf8; drop table if exists invoice_items; create table invoice_items ( invoice_item_id int unsigned not null auto_increment, invoice_id int unsigned not null, product_id int unsigned not null, is_product_taxable bool not null, -- copy over from products table quantity int unsigned not null default 0, unit_price decimal(11,2) not null default 0, -- copy it over from the products table so we have a snapshot in time of the price as it may change in the future product_description varchar(100) not null, -- copy it over from the products table so we have a snapshot in time of the description as it may change in the future notes varchar(255) null default null, sort_order tinyint unsigned null default null, primary key (invoice_item_id), foreign key fk_invoice_id (invoice_id) references invoices (invoice_id) on delete cascade, -- using 'on delete cascade' to streamline deletions foreign key fk_product_id (product_id) references products (product_id), index idx_sort_order (sort_order) ) engine = innodb default charset = utf8; -- this table is updated by triggers; do not update it! instead, update invoice_items, invoices, or payments -- populated by trigger_invoice_items_after_insert, trigger_invoice_items_after_update, trigger_invoice_items_after_delete -- trigger_invoices_after_insert, trigger_invoices_after_update, trigger_invoices_after_delete drop table if exists invoice_item_amounts; create table invoice_item_amounts ( invoice_item_id int unsigned not null, subtotal decimal(11,2) not null default 0, tax_not_rounded decimal(12,3) not null default 0, total_not_rounded decimal(12,3) not null default 0, -- this field is for informational purposes; it's never used in calculations primary key (invoice_item_id), foreign key fk_invoice_item_id (invoice_item_id) references invoice_items (invoice_item_id) on delete cascade -- using 'on delete cascade' since this table shouldn't be touched manually ) engine = innodb default charset = utf8; drop table if exists payments; create table payments ( payment_id int unsigned not null auto_increment, invoice_id int unsigned not null, payment_method_id int unsigned not null, amount decimal(11,2) not null default 0, authorization_code varchar(255) null default null, notes varchar(255) null default null, received_by int unsigned not null, received_on datetime not null, primary key (payment_id), foreign key fk_invoice_id (invoice_id) references invoices (invoice_id) on delete cascade, -- using 'on delete cascade' to streamline deletions, foreign key fk_payment_method_id (payment_method_id) references payment_methods (payment_method_id), foreign key fk_received_by (received_by) references users (user_id) ) engine = innodb default charset = utf8; -- this table should be limited to 5 entries per user by the web app. drop table if exists recently_viewed_patrons; create table recently_viewed_patrons ( user_id int unsigned not null, patron_id int unsigned not null, viewed_on datetime not null, primary key (user_id, patron_id, viewed_on), -- creating a primary key here otherwise Entity Framework implodes and doesn't allow us to write to the table; see http://stackoverflow.com/questions/3996782/entity-framework-table-without-primary-key foreign key fk_user_id (user_id) references users (user_id) on delete cascade, -- auto delete if either the user or the patron is deleted foreign key fk_patron_id (patron_id) references patrons (patron_id) on delete cascade ) engine = innodb default charset = utf8; -- this table will be limited to 5 entries per user by the web app. drop table if exists recently_viewed_invoices; create table recently_viewed_invoices ( user_id int unsigned not null, invoice_id int unsigned not null, viewed_on datetime not null, primary key (user_id, invoice_id, viewed_on), -- -- creating a primary key here otherwise Entity Framework implodes and doesn't allow us to write to the table; see http://stackoverflow.com/questions/3996782/entity-framework-table-without-primary-key foreign key fk_user_id (user_id) references users (user_id) on delete cascade, -- auto delete if either the user or the invoice is deleted foreign key fk_invoice_id (invoice_id) references invoices (invoice_id) on delete cascade ) engine = innodb default charset = utf8;
CREATE TABLE clients ( id uuid NOT NULL DEFAULT uuid_generate_v4(), name VARCHAR NOT NULL, last_name VARCHAR NOT NULL, email VARCHAR NOT NULL, phone VARCHAR NOT NULL, CONSTRAINT clients_pkey PRIMARY KEY (id) );
/* Copyright 2020-2021 Snowplow Analytics Ltd. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -- A table storing an identifier for this run of a model - used to identify runs of the model across multiple modules/steps (eg. base, page views share this id per run) CREATE TABLE IF NOT EXISTS {{.scratch_schema}}.metadata_run_id{{.entropy}} ( run_id TIMESTAMP ); INSERT INTO {{.scratch_schema}}.metadata_run_id{{.entropy}} ( SELECT GETDATE() WHERE -- Only insert if table is empty (SELECT run_id FROM {{.scratch_schema}}.metadata_run_id{{.entropy}} LIMIT 1) IS NULL ); -- Permanent metadata table CREATE TABLE IF NOT EXISTS {{.output_schema}}.datamodel_metadata{{.entropy}} ( run_id TIMESTAMP, model_version VARCHAR(64), model VARCHAR(64), module VARCHAR(64), run_start_tstamp TIMESTAMP, run_end_tstamp TIMESTAMP, rows_this_run INT, distinct_key VARCHAR(64), distinct_key_count INT, time_key VARCHAR(64), min_time_key TIMESTAMP, max_time_key TIMESTAMP, duplicate_rows_removed INT, distinct_keys_removed INT ); -- Setup temp metadata tables for this run DROP TABLE IF EXISTS {{.scratch_schema}}.pv_metadata_this_run{{.entropy}}; CREATE TABLE {{.scratch_schema}}.pv_metadata_this_run{{.entropy}} ( id VARCHAR(64), run_id TIMESTAMP, model_version VARCHAR(64), model VARCHAR(64), module VARCHAR(64), run_start_tstamp TIMESTAMP, run_end_tstamp TIMESTAMP, rows_this_run INT, distinct_key VARCHAR(64), distinct_key_count INT, time_key VARCHAR(64), min_time_key TIMESTAMP, max_time_key TIMESTAMP, duplicate_rows_removed INT, distinct_keys_removed INT ); INSERT INTO {{.scratch_schema}}.pv_metadata_this_run{{.entropy}} ( SELECT 'run', run_id, '{{.model_version}}', 'web', 'page-views', GETDATE(), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL FROM {{.scratch_schema}}.metadata_run_id{{.entropy}} ); -- Create page views table if it doesn't exist CREATE TABLE IF NOT EXISTS {{.output_schema}}.page_views{{.entropy}} ( page_view_id CHAR(36) ENCODE ZSTD NOT NULL, event_id CHAR(36) ENCODE ZSTD, app_id VARCHAR(255) ENCODE ZSTD, user_id VARCHAR(255) ENCODE ZSTD, domain_userid VARCHAR(128) ENCODE ZSTD, network_userid VARCHAR(128) ENCODE ZSTD, domain_sessionid VARCHAR(128) ENCODE ZSTD, domain_sessionidx INT ENCODE ZSTD, page_view_in_session_index INT ENCODE ZSTD, page_views_in_session INT ENCODE ZSTD, dvce_created_tstamp TIMESTAMP ENCODE ZSTD, collector_tstamp TIMESTAMP ENCODE ZSTD, derived_tstamp TIMESTAMP ENCODE ZSTD, start_tstamp TIMESTAMP ENCODE ZSTD, end_tstamp TIMESTAMP ENCODE ZSTD, engaged_time_in_s INT ENCODE ZSTD, absolute_time_in_s INT ENCODE ZSTD, horizontal_pixels_scrolled INT ENCODE ZSTD, vertical_pixels_scrolled INT ENCODE ZSTD, horizontal_percentage_scrolled DOUBLE PRECISION ENCODE ZSTD, vertical_percentage_scrolled DOUBLE PRECISION ENCODE ZSTD, doc_width INT ENCODE ZSTD, doc_height INT ENCODE ZSTD, page_title VARCHAR(2000) ENCODE ZSTD, page_url VARCHAR(4096) ENCODE ZSTD, page_urlscheme VARCHAR(16) ENCODE ZSTD, page_urlhost VARCHAR(255) ENCODE ZSTD, page_urlpath VARCHAR(3000) ENCODE ZSTD, page_urlquery VARCHAR(6000) ENCODE ZSTD, page_urlfragment VARCHAR(3000) ENCODE ZSTD, mkt_medium VARCHAR(255) ENCODE ZSTD, mkt_source VARCHAR(255) ENCODE ZSTD, mkt_term VARCHAR(255) ENCODE ZSTD, mkt_content VARCHAR(500) ENCODE ZSTD, mkt_campaign VARCHAR(255) ENCODE ZSTD, mkt_clickid VARCHAR(128) ENCODE ZSTD, mkt_network VARCHAR(64) ENCODE ZSTD, page_referrer VARCHAR(4096) ENCODE ZSTD, refr_urlscheme VARCHAR(16) ENCODE ZSTD, refr_urlhost VARCHAR(255) ENCODE ZSTD, refr_urlpath VARCHAR(6000) ENCODE ZSTD, refr_urlquery VARCHAR(6000) ENCODE ZSTD, refr_urlfragment VARCHAR(3000) ENCODE ZSTD, refr_medium VARCHAR(25) ENCODE ZSTD, refr_source VARCHAR(50) ENCODE ZSTD, refr_term VARCHAR(255) ENCODE ZSTD, geo_country CHAR(2) ENCODE ZSTD, geo_region CHAR(3) ENCODE ZSTD, geo_region_name VARCHAR(100) ENCODE ZSTD, geo_city VARCHAR(75) ENCODE ZSTD, geo_zipcode VARCHAR(15) ENCODE ZSTD, geo_latitude DOUBLE PRECISION ENCODE ZSTD, geo_longitude DOUBLE PRECISION ENCODE ZSTD, geo_timezone VARCHAR(64) ENCODE ZSTD, user_ipaddress VARCHAR(128) ENCODE ZSTD, useragent VARCHAR(1000) ENCODE ZSTD, br_lang VARCHAR(255) ENCODE ZSTD, br_viewwidth INT ENCODE ZSTD, br_viewheight INT ENCODE ZSTD, br_colordepth VARCHAR(12), br_renderengine VARCHAR(50), os_timezone VARCHAR(255), -- optional iab fields category VARCHAR, primary_impact VARCHAR, reason VARCHAR, spider_or_robot BOOLEAN, -- optional UA parser fields useragent_family VARCHAR, useragent_major VARCHAR, useragent_minor VARCHAR, useragent_patch VARCHAR, useragent_version VARCHAR, os_family VARCHAR, os_major VARCHAR, os_minor VARCHAR, os_patch VARCHAR, os_patch_minor VARCHAR, os_version VARCHAR, device_family VARCHAR, -- optional YAUAA fields device_class VARCHAR, agent_class VARCHAR, agent_name VARCHAR, agent_name_version VARCHAR, agent_name_version_major VARCHAR, agent_version VARCHAR, agent_version_major VARCHAR, device_brand VARCHAR, device_name VARCHAR, device_version VARCHAR, layout_engine_class VARCHAR, layout_engine_name VARCHAR, layout_engine_name_version VARCHAR, layout_engine_name_version_major VARCHAR, layout_engine_version VARCHAR, layout_engine_version_major VARCHAR, operating_system_class VARCHAR, operating_system_name VARCHAR, operating_system_name_version VARCHAR, operating_system_version VARCHAR ) DISTSTYLE KEY DISTKEY (page_view_id) SORTKEY (start_tstamp); -- Create staging table - acts as input to sessions step CREATE TABLE IF NOT EXISTS {{.scratch_schema}}.page_views_staged{{.entropy}} (LIKE {{.output_schema}}.page_views{{.entropy}});
create or replace view "DW_ORG"."PNMAC"."VW_MOSTRECENTEMPLOYEERECORDBYLOGIN" as select max(employeekey) as employeekeycode, networklogin from "DW_ORG"."PNMAC"."EMPLOYEE" where rowcurrentflag = 'Y' and employeeid not in ('001025') /* Some updates for records need to be removed! */ group by networklogin;
CREATE TABLE IF NOT EXISTS `users_sessions_robots` ( `iSessionID` INT NOT NULL AUTO_INCREMENT, `cRobotName` VARCHAR (50), `tsDate` INT NOT NULL, `cRobotSite` TEXT, PRIMARY KEY (`iSessionID`) ) ENGINE = MYISAM;
/* Project Option: Coyote Residence Office TEAM: King James & The Knights of the Data Table Data Load Method 1: Normal Insert - Insert SQL Command Done By: James Small */ INSERT INTO staff_member(Staff_number, First_name,Last_Name,Date_Of_Birth,Gender,Street,City,State,Zip,Location,Position,Email_address) values ('1000','Anthony Gonzalez','06-MAY-47','M','123 Four St','Redlands','CA','92373','CSUSB Main','Phys Ed Professor','agonz@csusb.edu'); INSERT INTO staff_member(Staff_number, First_name,Last_Name,Date_Of_Birth,Gender,Street,City,State,Zip,Location,Position,Email_address) values ('1001','Michelle Smith','09-JUN-58','F','654 Fourth St','Riverside','CA','92504','CSUSB Main','CSE Professor','msmith@csusb.edu'); INSERT INTO staff_member(Staff_number, First_name,Last_Name,Date_Of_Birth,Gender,Street,City,State,Zip,Location,Position,Email_address) values ('1002','Mark Preciado','03-JAN-45','M','352 Anderson Way','Riverside','CA','92504','CSUSB Main','Math Tutor','mpreciado@csusb.edu'); INSERT INTO staff_member(Staff_number, First_name,Last_Name,Date_Of_Birth,Gender,Street,City,State,Zip,Location,Position,Email_address) values ('1003','Ashley Lopez','03-APR-73','F','984 Halsey St','Redlands','CA','92375','CSUSB Main','English Professor','alopez@csusb.edu'); INSERT INTO staff_member(Staff_number, First_name,Last_Name,Date_Of_Birth,Gender,Street,City,State,Zip,Location,Position,Email_address) values ('1004','Sergio Martinez','11-DEC-82','M','253 Wilson Way','San Bernardino','CA','92408','CSUSB Main','Math Professor','smartinez@csusb.edu'); INSERT INTO staff_member(Staff_number, First_name,Last_Name,Date_Of_Birth,Gender,Street,City,State,Zip,Location,Position,Email_address) values ('1005','Lisa Turtle','27-SEP-61','F','352 Bell Way','Chino','CA','92347','CSUSB Main','History Professor','lturtle@csusb.edu');
-- phpMyAdmin SQL Dump -- version 4.6.5.2 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Generation Time: 27-Out-2017 às 01:53 -- Versão do servidor: 10.1.21-MariaDB -- PHP Version: 5.6.30 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: `projetointegrador` -- -- -------------------------------------------------------- -- -- Estrutura da tabela `historico` -- CREATE TABLE `historico` ( `idHistorico` int(11) NOT NULL, `nomeTarefa` varchar(50) DEFAULT NULL, `status` varchar(50) DEFAULT NULL, `frequencia` varchar(50) DEFAULT NULL, `descricao` varchar(50) DEFAULT NULL, `dataInicial` date DEFAULT NULL, `dataFinal` date DEFAULT NULL, `idTarefa` int(11) DEFAULT NULL, `idUsuario` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Estrutura da tabela `tarefa` -- CREATE TABLE `tarefa` ( `idTarefa` int(11) NOT NULL, `nomeTarefa` varchar(50) DEFAULT NULL, `status` varchar(50) DEFAULT NULL, `frequencia` varchar(50) DEFAULT NULL, `descricao` varchar(255) DEFAULT NULL, `dataInicial` date DEFAULT NULL, `dataFinal` date DEFAULT NULL, `idUsuario` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Extraindo dados da tabela `tarefa` -- INSERT INTO `tarefa` (`idTarefa`, `nomeTarefa`, `status`, `frequencia`, `descricao`, `dataInicial`, `dataFinal`, `idUsuario`) VALUES (3, 'tarefa III', 'Incompleto', 'Diariamente', 'sadasdasd', '2045-06-04', '2045-06-04', 11), (4, 'teste 2 ', 'Em avaliacao', 'Diariamente', 'asdasd', '2045-06-04', '2056-04-06', 11), (5, 'as', 'Completo', 'Diariamente', 'dasdas', '2012-03-12', '2045-06-04', 11), (6, 'Teste 3', 'Em avaliacao', 'Diariamente', 'teste 3', '2018-11-05', '2019-11-05', 11), (7, 'Verificar Email', 'Incompleto', 'Diariamente', 'Verificiar no email imobiliaria@gmail.com, novos emails e responder quando necessario', '2017-10-23', '2017-10-23', 11), (8, 'Teste', 'Incompleto', 'Diariamente', 'testestesad', '2015-04-06', '2078-09-07', 11), (9, 'teste', 'Em avaliacao', 'Diariamente', '65456456', '2046-04-04', '2046-05-04', 11), (10, 'qewqwe', 'Cancelada', 'Diariamente', '56465456', '2045-06-04', '2054-06-04', 11), (11, 'ada', 'Cancelada', 'Diariamente', '97987979', '2046-04-06', '2017-10-25', 11), (12, 'asds', 'Em avaliacao', 'Diariamente', '98798', '2046-05-04', '2078-09-07', 11); -- -------------------------------------------------------- -- -- Estrutura da tabela `usuario` -- CREATE TABLE `usuario` ( `idUsuario` int(11) NOT NULL, `nome` varchar(50) DEFAULT NULL, `usuario` varchar(50) DEFAULT NULL, `senha` varchar(50) DEFAULT NULL, `celular` varchar(50) DEFAULT NULL, `ativo` int(11) DEFAULT NULL, `email` varchar(50) DEFAULT NULL, `cpf` varchar(20) DEFAULT NULL, `telefone` varchar(50) DEFAULT NULL, `rg` varchar(50) DEFAULT NULL, `tipo` varchar(50) DEFAULT NULL, `endereco` varchar(50) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Extraindo dados da tabela `usuario` -- INSERT INTO `usuario` (`idUsuario`, `nome`, `usuario`, `senha`, `celular`, `ativo`, `email`, `cpf`, `telefone`, `rg`, `tipo`, `endereco`) VALUES (11, 'aa', 'aa', 'aa', 'aa', 0, 'aa', 'aa', 'aa', 'aa', '0', 'aa'), (12, 'aa', 'aa', 'aa', 'aa', 0, 'aa', 'aa', 'aa', 'aa', '0', 'aa'), (13, 'çççççç', 'teste', '', 'dsad', 0, 'dsad@asd', 'asda', 'dasd', 'dsad', '0', 'dad'), (17, 'aaaa5', 'tste', '1341', '7987', 1, '797@adsa', '0225457813', '(797) ___-____', '8977', 'Gerente', 'asd79879'), (18, 'bbbbb', 'bbbb', '555555', '55555', 1, '', '5555555', '5555', '5555555', '0', '55555'), (24, 'Usuario Teste', 'Teste', '123456789', '(45) 61378-9414', 1, 'teste@gmail', '454.654.654-46', '(23) 1231-3213', '123456', 'Gerente', 'Av Teste'); -- -- Indexes for dumped tables -- -- -- Indexes for table `historico` -- ALTER TABLE `historico` ADD PRIMARY KEY (`idHistorico`), ADD KEY `idTarefa` (`idTarefa`), ADD KEY `idUsuario` (`idUsuario`); -- -- Indexes for table `tarefa` -- ALTER TABLE `tarefa` ADD PRIMARY KEY (`idTarefa`), ADD KEY `idUsuario` (`idUsuario`); -- -- Indexes for table `usuario` -- ALTER TABLE `usuario` ADD PRIMARY KEY (`idUsuario`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `historico` -- ALTER TABLE `historico` MODIFY `idHistorico` int(11) NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `tarefa` -- ALTER TABLE `tarefa` MODIFY `idTarefa` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=13; -- -- AUTO_INCREMENT for table `usuario` -- ALTER TABLE `usuario` MODIFY `idUsuario` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=25; -- -- Constraints for dumped tables -- -- -- Limitadores para a tabela `historico` -- ALTER TABLE `historico` ADD CONSTRAINT `historico_ibfk_1` FOREIGN KEY (`idTarefa`) REFERENCES `tarefa` (`idTarefa`), ADD CONSTRAINT `historico_ibfk_2` FOREIGN KEY (`idUsuario`) REFERENCES `usuario` (`idUsuario`); -- -- Limitadores para a tabela `tarefa` -- ALTER TABLE `tarefa` ADD CONSTRAINT `tarefa_ibfk_1` FOREIGN KEY (`idUsuario`) REFERENCES `usuario` (`idUsuario`); /*!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 */;
------------------ Tao user --------------------- CREATE USER NV1512001 IDENTIFIED BY 123456; GRANT CREATE SESSION TO NV1512001; CREATE USER NV1512002 IDENTIFIED BY 123456; GRANT CREATE SESSION TO NV1512002; CREATE USER NV1512003 IDENTIFIED BY 123456; GRANT CREATE SESSION TO NV1512003; CREATE USER NV1512004 IDENTIFIED BY 123456; GRANT CREATE SESSION TO NV1512004; CREATE USER NV1512005 IDENTIFIED BY 123456; GRANT CREATE SESSION TO NV1512005; CREATE USER NV1512006 IDENTIFIED BY 123456; GRANT CREATE SESSION TO NV1512006; CREATE USER NV1512007 IDENTIFIED BY 123456; GRANT CREATE SESSION TO NV1512007; CREATE USER NV1512008 IDENTIFIED BY 123456; GRANT CREATE SESSION TO NV1512008; CREATE USER NV1512009 IDENTIFIED BY 123456; GRANT CREATE SESSION TO NV1512009; CREATE USER NV1512010 IDENTIFIED BY 123456; GRANT CREATE SESSION TO NV1512010; CREATE USER NV1512011 IDENTIFIED BY 123456; GRANT CREATE SESSION TO NV1512011; CREATE USER NV1512012 IDENTIFIED BY 123456; GRANT CREATE SESSION TO NV1512012; CREATE USER NV1512013 IDENTIFIED BY 123456; GRANT CREATE SESSION TO NV1512013; CREATE USER NV1512014 IDENTIFIED BY 123456; GRANT CREATE SESSION TO NV1512014; CREATE USER NV1512015 IDENTIFIED BY 123456; GRANT CREATE SESSION TO NV1512015; CREATE USER NV1512016 IDENTIFIED BY 123456; GRANT CREATE SESSION TO NV1512016; CREATE USER NV1512017 IDENTIFIED BY 123456; GRANT CREATE SESSION TO NV1512017; CREATE USER NV1512018 IDENTIFIED BY 123456; GRANT CREATE SESSION TO NV1512018; CREATE USER NV1512019 IDENTIFIED BY 123456; GRANT CREATE SESSION TO NV1512019; CREATE USER NV1512020 IDENTIFIED BY 123456; GRANT CREATE SESSION TO NV1512020; CREATE USER NV1512021 IDENTIFIED BY 123456; GRANT CREATE SESSION TO NV1512021; CREATE USER NV1512022 IDENTIFIED BY 123456; GRANT CREATE SESSION TO NV1512022; CREATE USER NV1512023 IDENTIFIED BY 123456; GRANT CREATE SESSION TO NV1512023; CREATE USER NV1512024 IDENTIFIED BY 123456; GRANT CREATE SESSION TO NV1512024; CREATE USER NV1512025 IDENTIFIED BY 123456; GRANT CREATE SESSION TO NV1512025; CREATE USER NV1512026 IDENTIFIED BY 123456; GRANT CREATE SESSION TO NV1512026; CREATE USER NV1512027 IDENTIFIED BY 123456; GRANT CREATE SESSION TO NV1512027; ------------------ Tao role --------------------- CREATE ROLE QLTAINGUYEN_NHANSU; CREATE ROLE QLTAIVU; CREATE ROLE QLCHUYENMON; CREATE ROLE TIEPTAN; CREATE ROLE NVTAIVU; CREATE ROLE BACSI; CREATE ROLE KYTHUATVIEN; CREATE ROLE BANTHUOC; CREATE ROLE KETOAN; CREATE ROLE NHANVIEN; -- gán cho t?t c? user -- quan ly -- GRANT NHANVIEN TO NV1512001; GRANT QLTAINGUYEN_NHANSU TO NV1512001; GRANT NHANVIEN TO NV1512002; GRANT QLTAIVU TO NV1512002; GRANT NHANVIEN TO NV1512003; GRANT QLCHUYENMON TO NV1512003; -- tiep tan -- GRANT NHANVIEN TO NV1512004; GRANT NHANVIEN TO NV1512005; GRANT NHANVIEN TO NV1512006; GRANT NHANVIEN TO NV1512007; GRANT NHANVIEN TO NV1512008; GRANT TIEPTAN TO NV1512004, NV1512005, NV1512006, NV1512007, NV1512008; -- NV tai vu -- GRANT NHANVIEN TO NV1512009; GRANT NHANVIEN TO NV1512010; GRANT NHANVIEN TO NV1512011; GRANT NHANVIEN TO NV1512012; GRANT NHANVIEN TO NV1512013; GRANT NVTAIVU TO NV1512009, NV1512010, NV1512011, NV1512012, NV1512013; -- bac si -- GRANT NHANVIEN TO NV1512014; GRANT NHANVIEN TO NV1512015; GRANT NHANVIEN TO NV1512016; GRANT NHANVIEN TO NV1512017; GRANT NHANVIEN TO NV1512018; GRANT BACSI TO NV1512014, NV1512015, NV1512016, NV1512017, NV1512018; -- ky thuat vien -- GRANT NHANVIEN TO NV1512019; GRANT NHANVIEN TO NV1512020; GRANT NHANVIEN TO NV1512021; GRANT KYTHUATVIEN TO NV1512019, NV1512020, NV1512021; -- ban thuoc -- GRANT NHANVIEN TO NV1512022; GRANT NHANVIEN TO NV1512023; GRANT NHANVIEN TO NV1512024; GRANT BANTHUOC TO NV1512022, NV1512023, NV1512024; -- ke toan -- GRANT NHANVIEN TO NV1512025; GRANT NHANVIEN TO NV1512026; GRANT NHANVIEN TO NV1512027; GRANT KETOAN TO NV1512025, NV1512026, NV1512027; -------------------- PHAN HE 1 ---------------------- --1.2 Xem danh sách các user select username from DBA_USERS where account_status = 'OPEN'; --1.3 Xem danh sách các table c?a user hi?n hành (QLBV), Xem danh sách các role select table_name from all_tables where owner = 'QLBV'; select role from DBA_ROLES where common = 'NO'; -- 1.4 Thêm m?i ??i t??ng, role CREATE USER NV1512003 IDENTIFIED BY 123456; --GRANT CREATE SESSION TO NV1512001; CREATE ROLE QLCHUYENMON; -- 1.5 Phân/l?y quy?n c?a user GRANT SELECT(TENTHUOC) ON THUOC TO NV1512003; REVOKE SELECT(TENTHUOC) ON THUOC FROM NV1512003; GRANT INSERT ON DICHVU TO NV1512003; REVOKE INSERT ON DICHVU FROM NV1512003; GRANT SELECT ON DICHVU TO NV1512003 WITH GRANT OPTION; -- Phân/l?y quy?n c?a role GRANT SELECT ON THUOC TO QLCHUYENMON; REVOKE SELECT ON THUOC FROM QLCHUYENMON; GRANT SELECT(TENDV) ON DICHVU TO QLCHUYENMON; REVOKE SELECT(TENDV) ON DICHVU FROM QLCHUYENMON; GRANT INSERT ON THUOC TO QLCHUYENMON WITH GRANT OPTION; -------------------- PHAN HE 2 ---------------------- --------------------ROLE NHAN VIEN -------------------- -- nhân viên duoc truy xuat danh sách pḥng ban, cham công GRANT SELECT ON PHONGBAN TO NHANVIEN; GRANT SELECT ON CHAMCONG TO NHANVIEN; GRANT SELECT ON NHANVIEN TO NHANVIEN; -- nhân viên (tru ke toan, quan ly tai nguyen & nhan su) duoc truy xuat danh sách nhân viên nhung chi duoc xem luong cua ḿnh CREATE OR REPLACE FUNCTION FUNCTION1( p_schema varchar2, p_obj varchar2 ) return varchar2 as user varchar2(100); begin user := SYS_CONTEXT('userenv','session_user'); if ( SYS_CONTEXT('userenv','ISDBA') = 'TRUE' ) then return ''; else if (user = 'QLBV' or user = 'NV1512025' or user = 'NV1512026' or user = 'NV1512027' or user = 'NV1512001') then return ''; else user := substr(user,3); return 'MANV = ''' || user || ''''; end if; end if; end; SELECT FUNCTION1('QLBV','NHANVIEN') PREDICATE FROM DUAL; BEGIN dbms_rls.add_policy ( object_schema => 'QLBV', object_name => 'NHANVIEN', policy_name => 'policy1', function_schema => 'QLBV', policy_function => 'FUNCTION1', statement_types => 'select', sec_relevant_cols => 'luong,matkhau', sec_relevant_cols_opt => dbms_rls.ALL_ROWS); END; ----------------- ROLE QLTAINGUYEN_NHANSU -------------------- GRANT SELECT ON THUOC TO NV1512003; REVOKE SELECT ON THUOC FROM NV1512003; GRANT SELECT(TENDV) ON DICHVU TO NV1512003; REVOKE SELECT(TENDV) ON DICHVU FROM NV1512003; GRANT INSERT ON THUOC TO NV1512003 WITH GRANT OPTION; GRANT SELECT ON THUOC TO QLCHUYENMON; REVOKE SELECT ON THUOC FROM QLCHUYENMON; GRANT SELECT(TENDV) ON DICHVU TO QLCHUYENMON; REVOKE SELECT(TENDV) ON DICHVU FROM QLCHUYENMON; GRANT INSERT ON THUOC TO QLCHUYENMON WITH GRANT OPTION; -- quan ly tai nguyen nhan su duoc xem, them, xoa, sua table phongban,chamcong GRANT SELECT,INSERT,UPDATE,DELETE ON PHONGBAN TO QLTAINGUYEN_NHANSU; GRANT SELECT,INSERT,UPDATE,DELETE ON CHAMCONG TO QLTAINGUYEN_NHANSU; ----------------- ROLE QLTAIVU -------------------- -- quan ly tai vu duoc insert, update c?t giá trong table dichvu va thuoc. GRANT INSERT, UPDATE (GIADV) ON DICHVU TO QLTAIVU; GRANT SELECT ON DICHVU TO QLTAIVU; GRANT INSERT, UPDATE (GIATHUOC) ON THUOC TO QLTAIVU; GRANT SELECT ON THUOC TO QLTAIVU; ----------------- ROLE QLCHUYENMON -------------------- -- quan ly chuyen mon duoc xem tat cac cac table GRANT SELECT ON PHIEUKHAM TO QLCHUYENMON; GRANT SELECT ON DICHVU TO QLCHUYENMON; GRANT SELECT ON PK_DV TO QLCHUYENMON; GRANT SELECT ON THUOC TO QLCHUYENMON; GRANT SELECT ON PK_THUOC TO QLCHUYENMON; ----------------- ROLE TIEPTAN -------------------- -- tiep tan duoc select, insert, delete, update table benhnhan GRANT SELECT,INSERT,UPDATE,DELETE ON BENHNHAN TO TIEPTAN; -- tiep tan duoc tao phieu kham GRANT INSERT ON PHIEUKHAM TO TIEPTAN; -- tiep tan duoc select, update tren cot mapk, mabn, mabs, ngaykham cua table phieu kham GRANT SELECT,UPDATE (MAPK,MABN,MABS,NGAYKHAM) ON PHIEUKHAM TO TIEPTAN; ----------------- ROLE NVTAIVU -------------------- -- nv tai vu duoc select dichvu, pk_dv, thuoc, pk_thuoc GRANT SELECT ON DICHVU TO NVTAIVU; GRANT SELECT ON PK_DV TO NVTAIVU; GRANT SELECT ON THUOC TO NVTAIVU; GRANT SELECT ON PK_THUOC TO NVTAIVU; -- nv tai vu duoc update cot trangthai,vienphi cua table phieukham GRANT UPDATE(TRANGTHAI,VIENPHI) ON PHIEUKHAM TO NVTAIVU; GRANT UPDATE (name) ON salapati.xyz TO myrole; ----------------- ROLE BACSI -------------------- -- bác si duoc truy xuat danh sách thuoc GRANT SELECT ON THUOC TO BACSI; -- bác si duoc truy xuat danh sách dich vu GRANT SELECT ON DICHVU TO BACSI; -- bac si chi xem dc thong tin phieu kham cua minh dieu tri grant SELECT ON PHIEUKHAM to BACSI grant update(trieuchung,chuandoan,motathem) on phieukham to bacsi CREATE OR REPLACE FUNCTION FUNCTION2( p_schema varchar2, p_obj varchar2 ) return varchar2 as user varchar2(100); temp varchar2(100); begin user := SYS_CONTEXT('userenv','session_user'); if ( SYS_CONTEXT('userenv','ISDBA') = 'TRUE' ) then return ''; else if (user = 'QLBV' or user = 'NV1512004' or user = 'NV1512005' or user = 'NV1512006' or user = 'NV1512007' or user = 'NV1512008' or user = 'NV1512003') then return ''; else user := substr(user,3); return 'MABS = ''' || user || ''''; end if; end if; end; BEGIN dbms_rls.add_policy ( object_schema => 'QLBV', object_name => 'PHIEUKHAM', policy_name => 'policy2', function_schema => 'QLBV', policy_function => 'FUNCTION2', statement_types => 'select'); END; -- bac si chi duoc chinh sua cot trieuchung, chuandoan, motathem trong phieukham ma minh duoc phan cong CREATE OR REPLACE FUNCTION FUNCTION4( p_schema varchar2, p_obj varchar2 ) return varchar2 as user varchar2(100); begin user := SYS_CONTEXT('userenv','session_user'); if ( SYS_CONTEXT('userenv','ISDBA') = 'TRUE' ) then return ''; else if (user = 'QLBV' or user = 'NV1512009' or user = 'NV1512010' or user = 'NV1512011' or user = 'NV1512012' or user = 'NV1512013') then return ''; else user := substr(user,3); return 'MABS = ''' || user || ''''; end if; end if; end; BEGIN dbms_rls.add_policy ( object_schema => 'QLBV', object_name => 'PHIEUKHAM', policy_name => 'policy4', function_schema => 'QLBV', policy_function => 'FUNCTION4', statement_types => 'update', update_check => true); END; -- bac si chi duoc xem thong tin benh nhan cua minh dieu tri GRANT SELECT, UPDATE ON PHIEUKHAM TO BACSI GRANT SELECT ON BENHNHAN TO BACSI -- CREATE OR REPLACE FUNCTION FUNCTION3( p_schema varchar2, p_obj varchar2 ) return varchar2 as user varchar2(100); temp number; begin user := SYS_CONTEXT('userenv','session_user'); if ( SYS_CONTEXT('userenv','ISDBA') = 'TRUE' ) then return ''; else if (user = 'QLBV' or user = 'NV1512004' or user = 'NV1512005' or user = 'NV1512006' or user = 'NV1512007' or user = 'NV1512008' ) then return ''; else user := substr(user,3); return 'MABN IN (select MABN from PHIEUKHAM where MABS = ' || to_number(user)|| ')'; end if; end if; end; BEGIN dbms_rls.add_policy ( object_schema => 'QLBV', object_name => 'BENHNHAN', policy_name => 'policy3', function_schema => 'QLBV', policy_function => 'FUNCTION3', statement_types => 'select'); END; -- bác si duoc them, sua, xóa thông tin pk_dv, pk_thuoc cua phieu kham ḿnh thuc hien GRANT SELECT,INSERT,UPDATE,DELETE ON PK_THUOC TO BACSI; GRANT SELECT,INSERT,UPDATE,DELETE ON PK_DV TO BACSI; CREATE OR REPLACE FUNCTION FUNCTION5( p_schema varchar2, p_obj varchar2 ) return varchar2 as user varchar2(100); temp number; begin user := SYS_CONTEXT('userenv','session_user'); if ( SYS_CONTEXT('userenv','ISDBA') = 'TRUE' ) then return ''; else if (user = 'QLBV') then return ''; else user := substr(user,3); return 'MAPK IN (select MAPK from PHIEUKHAM where MABS = ' || to_number(user)|| ')'; end if; end if; end; BEGIN dbms_rls.add_policy ( object_schema => 'QLBV', object_name => 'PK_THUOC', policy_name => 'policy5_1', function_schema => 'QLBV', policy_function => 'FUNCTION5', statement_types => 'insert,update,delete', update_check => true); END; BEGIN dbms_rls.add_policy ( object_schema => 'QLBV', object_name => 'PK_DV', policy_name => 'policy5_2', function_schema => 'QLBV', policy_function => 'FUNCTION5', statement_types => 'insert,update,delete', update_check => true); END; CREATE OR REPLACE FUNCTION FUNCTION8( p_schema varchar2, p_obj varchar2 ) return varchar2 as user varchar2(100); temp number; begin user := SYS_CONTEXT('userenv','session_user'); if ( SYS_CONTEXT('userenv','ISDBA') = 'TRUE' ) then return ''; else if (user = 'QLBV' or user = 'NV1512022' or user = 'NV1512023' or user = 'NV1512024' or user = 'NV1512003') then return ''; else user := substr(user,3); return 'MAPK IN (select MAPK from PHIEUKHAM where MABS = ' || to_number(user)|| ')'; end if; end if; end; BEGIN dbms_rls.add_policy ( object_schema => 'QLBV', object_name => 'PK_THUOC', policy_name => 'policy8', function_schema => 'QLBV', policy_function => 'FUNCTION8', statement_types => 'select'); END; ----------------- ROLE KYTHUATVIEN -------------------- -- kY thuAt viên duoc truy xuat danh sách dich vu. GRANT SELECT ON DICHVU TO KYTHUATVIEN; -- ky thuat viên duoc xem thông tin pk_dv cua ḿnh thuc hien GRANT SELECT ON PK_DV TO KYTHUATVIEN; CREATE OR REPLACE FUNCTION FUNCTION6( p_schema varchar2, p_obj varchar2 ) return varchar2 as user varchar2(100); begin user := SYS_CONTEXT('userenv','session_user'); if ( SYS_CONTEXT('userenv','ISDBA') = 'TRUE' ) then return ''; else if (user = 'QLBV' or user = 'NV1512003') then return ''; else user := substr(user,3); return 'MAKTV = ''' || user || '''' || 'or MAPK IN (select MAPK from PHIEUKHAM where MABS = ' || to_number(user)|| ')'; end if; end if; end; BEGIN dbms_rls.add_policy ( object_schema => 'QLBV', object_name => 'PK_DV', policy_name => 'policy6', function_schema => 'QLBV', policy_function => 'FUNCTION6', statement_types => 'select'); END; ----------------- ROLE BANTHUOC -------------------- -- nhân viên bán thuOc duoc xem danh sách thuc GRANT SELECT ON THUOC TO BANTHUOC; -- nhân viên bán thuoc duoc xem danh sách pk_thuoc cua ḿnh thuc hien GRANT SELECT ON PK_THUOC TO BANTHUOC; ----------------- ROLE KETOAN -------------------- -- nhân viên ke toán duoc xem luong cua moi nguoi -> dă cài dat o trên ------ OLS: xay dung va gan nhan cho mess select * from THONGBAO; grant select on THONGBAO to BACSI; grant select on THONGBAO to KYTHUATVIEN; GRANT SELECT ON THONGBAO TO NHANVIEN; GRANT SELECT ON THONGBAO TO NVTAIVU; grant select, insert, update, delete on THONGBAO to LBACSYS; -- th?c hi?n b?ng user LBACSYS ------ ma hoa -- dùng sys c?p quy?n grant execute on dbms_crypto to QLBV; CREATE OR REPLACE PACKAGE CRYPT_PHIEUKHAM IS FUNCTION ENCRYPT( INPUT_DATA IN VARCHAR2, KEY_ID IN VARCHAR2) RETURN RAW DETERMINISTIC; FUNCTION DECRYPT( INPUT_DATA IN RAW, KEY_ID IN VARCHAR2) RETURN VARCHAR2 DETERMINISTIC; END CRYPT_PHIEUKHAM; CREATE OR REPLACE PACKAGE BODY CRYPT_PHIEUKHAM IS ECRYPTION_TYPE PLS_INTEGER := DBMS_CRYPTO.ENCRYPT_AES192 + DBMS_CRYPTO.CHAIN_CBC + DBMS_CRYPTO.PAD_PKCS5; PAD VARCHAR2(1) := ' '; PROCEDURE PADDING(KEY_PAD IN OUT VARCHAR2); FUNCTION ENCRYPT( INPUT_DATA IN VARCHAR2, KEY_ID IN VARCHAR2) RETURN RAW DETERMINISTIC IS KEY_PAD VARCHAR2(200) := KEY_ID; ENCRYPT_RAW RAW(2000) ; BEGIN PADDING(KEY_PAD); ENCRYPT_RAW := dbms_crypto.encrypt( src => UTL_I18N.STRING_TO_RAW (INPUT_DATA, 'AL32UTF8'), TYP => ECRYPTION_TYPE, KEY => UTL_I18N.STRING_TO_RAW(KEY_PAD,'AL32UTF8')); RETURN ENCRYPT_RAW; END ENCRYPT; FUNCTION DECRYPT( INPUT_DATA IN RAW, KEY_ID IN VARCHAR2) RETURN VARCHAR2 DETERMINISTIC IS DECRYPT_RAW RAW(2000); KEY_PAD VARCHAR2(200):= KEY_ID; BEGIN PADDING(KEY_PAD); DECRYPT_RAW := DBMS_CRYPTO.DECRYPT( SRC => INPUT_DATA, TYP => ECRYPTION_TYPE, KEY => UTL_I18N.STRING_TO_RAW (KEY_PAD, 'AL32UTF8')); RETURN UTL_I18N.RAW_TO_CHAR(DECRYPT_RAW,'AL32UTF8'); END DECRYPT; PROCEDURE PADDING(KEY_PAD IN OUT VARCHAR2) IS BEGIN IF LENGTH(KEY_PAD) < 24 THEN KEY_PAD := RPAD(KEY_PAD,24,PAD); END IF; END; END CRYPT_PHIEUKHAM; --test crypt update PHIEUKHAM set CHUANDOAN = CRYPT_PHIEUKHAM.ENCRYPT(CHUANDOAN,TO_CHAR(MAPK)); update PHIEUKHAM set CHUANDOAN = CRYPT_PHIEUKHAM.DECRYPT(CHUANDOAN,TO_CHAR(MAPK)); select * from PHIEUKHAM; select CRYPT_PHIEUKHAM.DECRYPT(CHUANDOAN,TO_CHAR(MAPK)) FROM PHIEUKHAM; create or replace view phieukham_view as select pk.mapk, pk.mabn,pk.mabs,pk.ngaykham,pk.trieuchung,CRYPT_PHIEUKHAM.DECRYPT(CHUANDOAN,TO_CHAR(MAPK)) as chuandoan, pk.motathem,pk.trangthai,pk.vienphi from PHIEUKHAM pk; select * from PHIEUKHAM; select * from phieukham_view; ------- audit --------- ---Thiet lap audit voi tham so db,extended alter system set audit_trail=non scope=spfile; --enable audit shutdown immediate; startup alter system set audit_trail=db,extended scope=spfile; -- disable audit -- th?c hi?n audit audit select,insert,delete on NHANVIEN by access; audit select on THONGBAO by access; audit update on PHIEUKHAM by access WHENEVER SUCCESSFUL; audit update on PK_DV by access WHENEVER NOT SUCCESSFUL; AUDIT EXECUTE ON QLBV.CRYPT_PHIEUKHAM; -- danh sach user select username from DBA_USERS where account_status = 'OPEN' select table_name from all_tables where owner = 'QLBV'; -- danh sach user/role và quy?n ???c c?p select role from DBA_ROLES where common = 'NO'; -- dnah sách role select role from DBA_ROLES where INHERITED = 'NO'; -- xem quy?n ???c c?p (connect các user ?? ki?m tra) SELECT * FROM user_sys_privs; select * from user_role_privs; select * from user_col_privs; SELECT distinct grantee,owner,table_name,grantor,grantable FROM dba_tab_privs where grantee = 'KETOAN'; SELECT grantee,owner,table_name,column_name,grantor,privilege,grantable FROM dba_col_privs where grantee = 'KETOAN'; select * from THONGBAO; select user_tab_privs.grantee,owner,table_name,grantor,privilege,grantable,granted_role,admin_option from user_tab_privs, dba_role_privs where user_tab_privs.grantee = dba_role_privs.grantee; DROP TABLE CHINHANH CASCADE CONSTRAINTS; DROP TABLE THANHVIEN CASCADE CONSTRAINTS; DROP TABLE DONVI CASCADE CONSTRAINTS; DROP TABLE THONGBAO CASCADE CONSTRAINTS; DROP TABLE GIAMSAT CASCADE CONSTRAINTS; DROP TABLE THEODOI CASCADE CONSTRAINTS; DROP TABLE UNGCUVIEN CASCADE CONSTRAINTS; DROP TABLE BTC CASCADE CONSTRAINTS; DROP TABLE PHIEUBAU CASCADE CONSTRAINTS; DROP TABLE TO_LAP CASCADE CONSTRAINTS;
ALTER TABLE `factura` CHANGE `montoCuentaBancaria` `montoCuentaBancaria` DECIMAL(14,2) NULL DEFAULT '0'; ALTER TABLE `factura` CHANGE `importe_total` `importe_total` DECIMAL(14,2) NULL DEFAULT NULL; ALTER TABLE `factura` CHANGE `suma_impuestos` `suma_impuestos` DECIMAL(14,2) NULL DEFAULT NULL; ALTER TABLE `factura` CHANGE `sub_total` `sub_total` DECIMAL(14,2) NULL DEFAULT NULL; ALTER TABLE `factura` CHANGE `suma_retenciones` `suma_retenciones` DECIMAL(14,2) NULL DEFAULT NULL; ALTER TABLE `factura` CHANGE `suma_descuentos` `suma_descuentos` DECIMAL(14,2) NULL DEFAULT NULL; ALTER TABLE `factura` CHANGE `total` `total` DECIMAL(14,2) NULL DEFAULT NULL; ALTER TABLE `factura_pago` CHANGE `monto` `monto` DECIMAL(14,2) NOT NULL DEFAULT '0'; ALTER TABLE `impuestos_comprobante` CHANGE `total_impuestos_retenidos` `total_impuestos_retenidos` DECIMAL(14,2) NULL DEFAULT NULL; ALTER TABLE `impuestos_comprobante` CHANGE `total_impuestos_trasladados` `total_impuestos_trasladados` DECIMAL(14,2) NULL DEFAULT NULL; ALTER TABLE `impuesto` CHANGE `impuesto` `impuesto` DECIMAL(14,2) NULL DEFAULT NULL; ALTER TABLE `impuestos_retenido` CHANGE `impuesto` `impuesto` DECIMAL(14,2) NULL DEFAULT NULL; ALTER TABLE `impuestos_retenido` CHANGE `importe` `importe` DECIMAL(14,2) NULL DEFAULT NULL; ALTER TABLE `descuento` CHANGE `descuento` `descuento` DECIMAL(14,2) NULL DEFAULT NULL; ALTER TABLE `retencion` CHANGE `retencion` `retencion` DECIMAL(14,2) NULL DEFAULT NULL; ALTER TABLE `impuesto_trasladado` CHANGE `importe` `importe` DECIMAL(14,2) NULL DEFAULT NULL; ALTER TABLE `concepto_factura` CHANGE `cantidad` `cantidad` DECIMAL(14,2) NULL DEFAULT NULL; ALTER TABLE `concepto_factura` CHANGE `precio_unitario` `precio_unitario` DECIMAL(14,2) NULL DEFAULT NULL; ALTER TABLE `concepto_factura` CHANGE `importe` `importe` DECIMAL(14,2) NULL DEFAULT NULL; ALTER TABLE `concepto_factura` CHANGE `suma_impuestos` `suma_impuestos` DECIMAL(14,2) NULL DEFAULT NULL; ALTER TABLE `concepto_factura` CHANGE `subtotal` `subtotal` DECIMAL(14,2) NULL DEFAULT NULL; ALTER TABLE `concepto_factura` CHANGE `suma_retenciones` `suma_retenciones` DECIMAL(14,2) NULL DEFAULT NULL; ALTER TABLE `concepto_factura` CHANGE `suma_descuentos` `suma_descuentos` DECIMAL(14,2) NULL DEFAULT NULL; ALTER TABLE `concepto_factura` CHANGE `total` `total` DECIMAL(14,2) NULL DEFAULT NULL; ALTER TABLE `bitacora_factura` CHANGE `monto` `monto` DECIMAL(14,2) NULL DEFAULT '0'; ALTER TABLE `cat_porcentaje_retencion` CHANGE `porcentaje` `porcentaje` DECIMAL(6,2) NULL DEFAULT NULL; ALTER TABLE `cat_porcentaje_impuesto` CHANGE `porcentaje` `porcentaje` DECIMAL(6,2) NULL DEFAULT NULL; ALTER TABLE `comprobante` CHANGE `subtotal` `subtotal` DECIMAL(14,2) NULL DEFAULT NULL; ALTER TABLE `comprobante` CHANGE `descuento` `descuento` DECIMAL(14,2) NULL DEFAULT NULL; ALTER TABLE `comprobante` CHANGE `total` `total` DECIMAL(14,2) NULL DEFAULT NULL COMMENT 'El modelo de comprobante sera llenado partir de la información de los catálogos de la factura y una vez que se tengan guardados en la base de datos no podrán ser actualizados y será un modelo de solo consulta ya que es la información con la que se guardo la factura al momento de la generación y una vez que se timbro el xml por el sat ya es inmovible'; ALTER TABLE `concepto_comprobante` CHANGE `valor_unitario` `valor_unitario` DECIMAL(14,2) NULL DEFAULT NULL; ALTER TABLE `concepto_comprobante` CHANGE `importe` `importe` DECIMAL(14,2) NULL DEFAULT NULL;
/* Navicat SQLite Data Transfer Source Server : Douban Source Server Version : 30808 Source Host : :0 Target Server Type : SQLite Target Server Version : 30808 File Encoding : 65001 Date: 2017-01-17 22:49:26 */ PRAGMA foreign_keys = OFF; -- ---------------------------- -- Table structure for celebrity -- ---------------------------- DROP TABLE IF EXISTS "main"."celebrity"; CREATE TABLE "celebrity" ( "id" TEXT NOT NULL, "name" TEXT, "alt" TEXT, "avatars" TEXT, PRIMARY KEY ("id") );
-------------------------------------------------------- -- File created - Monday-January-08-2018 -------------------------------------------------------- REM INSERTING into SSARTEMS.BANK SET DEFINE OFF; Insert into SSARTEMS.BANK (NUMBER_FILIA,ADRESS) values (65484,'Проспект Перемоги 10'); Insert into SSARTEMS.BANK (NUMBER_FILIA,ADRESS) values (44645,'вул. Тараса Шевченка 15'); REM INSERTING into SSARTEMS.CLIENTS SET DEFINE OFF; Insert into SSARTEMS.CLIENTS (LOGIN,PASSWORD,PASSPORT,STREET,SURNAME,NAME,MIDDLENAME,PHONE,EMAIL,IDENTIFIICATION_CODE,BUD,KV) values ('SS','SS','АЮ15461','Сонячна','Дмитрук','Назар','Ільїч',3806487651,null,65661841,'1',null); Insert into SSARTEMS.CLIENTS (LOGIN,PASSWORD,PASSPORT,STREET,SURNAME,NAME,MIDDLENAME,PHONE,EMAIL,IDENTIFIICATION_CODE,BUD,KV) values ('Satir','pSatir','МВ324236','Крупської','Терешин','Андрій','Іванович',380751423654,'Satir@ukr.net',931484654,'6','455'); REM INSERTING into SSARTEMS.MANAGER SET DEFINE OFF; Insert into SSARTEMS.MANAGER (LOGIN,PASSWORD,ADMIN,FILL,NAME_SURNAME) values ('Jenkins','pJenkins',2,'65484','Медведчук Валентин'); Insert into SSARTEMS.MANAGER (LOGIN,PASSWORD,ADMIN,FILL,NAME_SURNAME) values ('Man','pMan',1,'44645','Кричук Дмитро'); REM INSERTING into SSARTEMS.OPERATIONS SET DEFINE OFF; REM INSERTING into SSARTEMS.SCORE SET DEFINE OFF; REM INSERTING into SSARTEMS.TYPE_SCORE SET DEFINE OFF; Insert into SSARTEMS.TYPE_SCORE (CODE_TYPE,NAME_TYPE) values (1,'Cript'); Insert into SSARTEMS.TYPE_SCORE (CODE_TYPE,NAME_TYPE) values (2,'usual');
select * from person; SELECT * from address; SELECT * FROM person_address; -- Find the person with 2 addresses. select * from person INNER JOIN (select count(*) as ad_count, pid from person_address GROUP BY pid ) as pr_add on pr_add.pid = person.pid and pr_add.ad_count = 2; -- Find the person with no addresses. SELECT * from person LEFT JOIN person_address on person.pid = person_address.pid WHERE person_address.pid IS NULL ; -- Find the person with matching first name and last name SELECT p1.first_name, p1.last_name from person p1 JOIN person p2 on p1.first_name = p2.last_name and p1.last_name = p2.first_name; -- Second max salary SELECT * from person WHERE salary in (select MAX(salary) from person WHERE salary NOT IN (SELECT MAX(salary) FROM person));
CREATE OR REPLACE VIEW MAN_TYPE_FLUID AS SELECT null id, null fluid_type, null feature_type, null featurecat_id, null observ FROM DUAL WHERE 1 = 2;
-- phpMyAdmin SQL Dump -- version 4.9.0.1 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Tempo de geração: 10-Ago-2019 às 04:22 -- Versão do servidor: 10.3.16-MariaDB -- versão do PHP: 7.1.31 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET AUTOCOMMIT = 0; START TRANSACTION; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COfLLATION_CONNECTION */; /*!40101 SET NAMES utf8mb4 */; -- -- Banco de dados: `GERS` -- DROP DATABASE IF EXISTS `GERS`; CREATE DATABASE IF NOT EXISTS `GERS` DEFAULT CHARACTER SET utf8 COLLATE utf8_bin; USE `GERS`; -- -------------------------------------------------------- -- -- Estrutura da tabela `booking` -- DROP TABLE IF EXISTS `booking`; CREATE TABLE IF NOT EXISTS `booking` ( `id` int(11) NOT NULL AUTO_INCREMENT, `customer_id` int(11) NOT NULL, `service_id` int(11) NOT NULL, `vehicle_id` int(11) NOT NULL, `booking_date` datetime NOT NULL, `estimated_date` datetime NOT NULL, `finished_date` datetime DEFAULT NULL, `reason_ext_time` varchar(30) COLLATE utf8_bin DEFAULT NULL, `observation` varchar(50) COLLATE utf8_bin DEFAULT NULL, PRIMARY KEY (`id`), KEY `customer_id` (`customer_id`), KEY `service_id` (`service_id`), KEY `vehicle_id` (`vehicle_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -- -------------------------------------------------------- -- -- Estrutura da tabela `enginetype` -- DROP TABLE IF EXISTS `engine_type`; CREATE TABLE IF NOT EXISTS `engine_type` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(20) COLLATE utf8_bin NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -- -- Extraindo dados da tabela `enginetype` -- INSERT INTO `engine_type` (`id`, `name`) VALUES (1, 'Diesel'), (2, 'Petrol'), (3, 'Hybrid'), (4, 'Eletric'); -- -------------------------------------------------------- -- -- Estrutura da tabela `profile` -- DROP TABLE IF EXISTS `profile`; CREATE TABLE IF NOT EXISTS `profile` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(20) COLLATE utf8_bin NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -- -- Extraindo dados da tabela `profile` -- INSERT INTO `profile` (`id`, `name`) VALUES (1, 'Admin'), (2, 'Customer'), (3, 'Employee'); -- -------------------------------------------------------- -- -- Estrutura da tabela `service` -- DROP TABLE IF EXISTS `service`; CREATE TABLE IF NOT EXISTS `service` ( `id` int(11) NOT NULL AUTO_INCREMENT, `service_type_id` int(11) NOT NULL, `employee_id` int(11) NOT NULL, `cost` decimal(10,2) NOT NULL, `status` varchar(15) COLLATE utf8_bin NOT NULL, `estimated_date` datetime NOT NULL, `started_date` datetime DEFAULT NULL, `finished_date` datetime DEFAULT NULL, `reason_ext_time` varchar(50) COLLATE utf8_bin DEFAULT NULL, PRIMARY KEY (`id`), KEY `service_type_id` (`service_type_id`), KEY `employee_id` (`employee_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -- -------------------------------------------------------- -- -- Estrutura da tabela `serviceitems` -- DROP TABLE IF EXISTS `service_items`; CREATE TABLE IF NOT EXISTS `service_items` ( `id` int(11) NOT NULL AUTO_INCREMENT, `service_id` int(11) NOT NULL, `item_id` int(11) NOT NULL, PRIMARY KEY (`id`), KEY `service_id` (`service_id`), KEY `item_id` (`item_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -- -------------------------------------------------------- -- -- Estrutura da tabela `servicetype` -- DROP TABLE IF EXISTS `service_type`; CREATE TABLE IF NOT EXISTS `service_type` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(20) COLLATE utf8_bin NOT NULL, `cost` decimal(10,2) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -- -- Extraindo dados da tabela `servicetype` -- INSERT INTO `service_type` (`id`, `name`, `cost`) VALUES (1, 'Annual Service', '200.00'), (2, 'Major Service', '250.00'), (3, 'Repair / Fault', '80.00'), (4, 'Major Repair', '150.00'); -- -------------------------------------------------------- -- -- Estrutura da tabela `user` -- DROP TABLE IF EXISTS `user`; CREATE TABLE IF NOT EXISTS `user` ( `id` int(11) NOT NULL AUTO_INCREMENT, `profile_id` int(11) NOT NULL, `first_name` varchar(20) COLLATE utf8_bin NOT NULL, `last_name` varchar(20) COLLATE utf8_bin NOT NULL, `email` varchar(20) COLLATE utf8_bin NOT NULL, `mobile_phone` varchar(20) COLLATE utf8_bin NOT NULL, `second_phone` varchar(20) COLLATE utf8_bin DEFAULT NULL, `password` varchar(15) COLLATE utf8_bin NOT NULL, PRIMARY KEY (`id`), KEY `profile_id` (`profile_id`) ) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -- -- Extraindo dados da tabela `user` -- INSERT INTO `user` (`id`, `profile_id`, `first_name`, `last_name`, `email`, `mobile_phone`, `second_phone`, `password`) VALUES (1, 1, 'Ger', 'Garage', 'ger@garage.com', '0830000001', NULL, '123'), (2, 2, 'Italo', 'Marcius', 'italomarcius@gmail.c', '0830000002', NULL, '123'), (3, 3, 'Joseph', 'O\'Connel', 'joconnel@garage.com', '0830000003', NULL, '123'), (4, 2, 'Felipe', 'Souza', 'felipesouza@gmail.c', '0830000004', NULL, '123'), (5, 3, 'Sean', 'Mc\'Gonnal', 'sean@garage.com', '0830000005', NULL, '123'); -- -------------------------------------------------------- -- -- Estrutura da tabela `vehicle` -- DROP TABLE IF EXISTS `vehicle`; CREATE TABLE IF NOT EXISTS `vehicle` ( `id` int(11) NOT NULL AUTO_INCREMENT, `type_id` int(11) NOT NULL, `engine_id` int(11) NOT NULL, `year` int(11) NOT NULL, `license` varchar(15) COLLATE utf8_bin NOT NULL, PRIMARY KEY (`id`), KEY `type_id` (`type_id`), KEY `engine_id` (`engine_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -- -------------------------------------------------------- -- -- Estrutura da tabela `vehicleitem` -- DROP TABLE IF EXISTS `vehicle_item`; CREATE TABLE IF NOT EXISTS `vehicle_item` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(50) COLLATE utf8_bin NOT NULL, `cost` decimal(10,2) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=81 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -- -- Extraindo dados da tabela `vehicleitem` -- INSERT INTO `vehicle_item` (`id`, `name`, `cost`) VALUES (41, '2.5 Gallon Air Tank', '72.99'), (42, 'TeraFlex Pullover Hoodie', '34.99'), (43, 'Lange Originals Paint Saver', '49.99'), (44, 'Fab Fours ViCowl Limb Rise', '159.99'), (45, 'ACE Engineering Inner Fender Insert', '42.99'), (46, 'Warn ATV Gravel Skid Kit', '16.99'), (47, 'GBC Sand Shark 20x11-8 Tire', '52.99'), (48, 'AT489 24x12-10 ATV Tire', '123.99'), (49, 'Dune Star 26x9-12 ATV Tire', '98.99'), (50, 'Big Horn Radial 2.0 23x8R-12 ATV', '106.99'), (51, 'ARB Compressor', '18.99'), (52, 'Inlet Air Filter Assembly', '3.99'), (53, '5-Piece Tank Port Fittings Kit', '9.99'), (54, 'VIAIR Check Valve', '6.99'), (55, 'VIAIR Air Down Gauge', '16.99'), (56, 'AirLift Dual Needle Air', '72.99'), (57, '4x4 Accessories Inflation Case', '50.99'), (58, '100% Duty Air Compressor', '219.99'), (59, 'ARB Twin Air Compressor Bundle', '727.96'), (60, '400C Onboard Air System', '599.99'), (61, '2 Gal. Tank High-Flow', '329.99'), (62, '2.54 CFM Air Compressor', '89.99'), (63, '88P Portable Compressor Kit', '65.99'), (64, 'Firestone Ride-Rite Air Tank', '55.99'), (65, '10lb. Package A System (Black)', '439.99'), (66, 'Neon Clock', '82.99'), (67, 'Poison Spyder Diff Cover Keychain (Black)', '22.99'), (68, 'Grille Key Chain (Raw)', '11.99'), (69, 'TeraFlex Lanyard (Black)', '2.99'), (70, 'MSD Work Apron', '19.99'), (71, '10lb. Package B System (Yellow)', '509.99'), (72, 'Sidearm Package A with Bracket (Blue)', '379.99'), (73, 'Trail Rated Jeep LED Sign', '115.99'), (74, '24x8-11 Radial ATV Tire', '70.99'), (75, 'Mud Lite 22x8-10 Radial ATV Tire', '65.99'), (76, 'Scorpion ATV Tire', '75.99'), (77, '26x10.00-12 K538 Executioner', '91.99'), (78, '22x11.00-9 K535A Parker DT ATV Tire', '99.99'), (79, 'Tires 21x11.00-10 K534 Gecko', '62.99'), (80, '22x11.00-10 K533 Klaw', '74.99'); -- -------------------------------------------------------- -- -- Estrutura da tabela `vehicle_make` -- DROP TABLE IF EXISTS `vehicle_make`; CREATE TABLE IF NOT EXISTS `vehicle_make` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(20) COLLATE utf8_bin NOT NULL, `type_id` int(11) NOT NULL, PRIMARY KEY (`id`), KEY `type_id` (`type_id`) ) ENGINE=InnoDB AUTO_INCREMENT=94 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -- -- Extraindo dados da tabela `vehiclemake` -- INSERT INTO `vehicle_make` (`id`, `name`, `type_id`) VALUES (63, 'Other', 5), (64, 'BMW X1', 2), (65, 'BMW X2', 2), (66, 'BMW X3', 2), (67, 'BMW X4', 2), (68, 'BMW RR', 1), (69, 'Suzuki 125', 1), (70, 'Suzuki 250', 1), (71, 'Toyota Corolla', 2), (72, 'Toyota Camry', 2), (73, 'Toyota Prius', 2), (74, 'Toyota Proace', 3), (75, 'Toyota Hiace', 4), (76, 'Ford Fiesta', 2), (77, 'Ford Ka', 2), (78, 'Ford Mondeo', 2), (79, 'Ford Ranger', 2), (80, 'Ford Transit', 3), (81, 'Ford Transit Bus', 4), (82, 'Ford Ecosport', 2), (83, 'Range Rover Evoque', 2), (84, 'Range Rover Sport', 2), (85, 'Range Rover Velar', 2), (86, 'Range Rover', 2), (87, 'Mercedez Sprinter', 3), (88, 'Audi A3', 2), (89, 'Audi A4', 2), (90, 'Audi A5', 2), (91, 'Audi A6', 2), (92, 'Audi A7', 2), (93, 'Iveco Daily', 4); -- -------------------------------------------------------- -- -- Estrutura da tabela `vehicle_type` -- DROP TABLE IF EXISTS `vehicle_type`; CREATE TABLE IF NOT EXISTS `vehicle_type` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(20) COLLATE utf8_bin NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -- -- Extraindo dados da tabela `vehicletype` -- INSERT INTO `vehicle_type` (`id`, `name`) VALUES (1, 'Motorbike'), (2, 'Car'), (3, 'Small Van'), (4, 'Small Bus'), (5, 'Other'); -- -- Restrições para despejos de tabelas -- -- -- Limitadores para a tabela `booking` -- ALTER TABLE `booking` ADD CONSTRAINT `booking_ibfk_1` FOREIGN KEY (`customer_id`) REFERENCES `user` (`id`), ADD CONSTRAINT `booking_ibfk_2` FOREIGN KEY (`service_id`) REFERENCES `service` (`id`), ADD CONSTRAINT `booking_ibfk_3` FOREIGN KEY (`vehicle_id`) REFERENCES `vehicle` (`id`); -- -- Limitadores para a tabela `service` -- ALTER TABLE `service` ADD CONSTRAINT `service_ibfk_1` FOREIGN KEY (`service_type_id`) REFERENCES `service_type` (`id`), ADD CONSTRAINT `service_ibfk_2` FOREIGN KEY (`employee_id`) REFERENCES `user` (`id`); -- -- Limitadores para a tabela `serviceitems` -- ALTER TABLE `service_items` ADD CONSTRAINT `serviceitems_ibfk_1` FOREIGN KEY (`service_id`) REFERENCES `service` (`id`), ADD CONSTRAINT `serviceitems_ibfk_2` FOREIGN KEY (`item_id`) REFERENCES `vehicle_item` (`id`); -- -- Limitadores para a tabela `user` -- ALTER TABLE `user` ADD CONSTRAINT `user_ibfk_1` FOREIGN KEY (`profile_id`) REFERENCES `profile` (`id`); -- -- Limitadores para a tabela `vehicle` -- ALTER TABLE `vehicle` ADD CONSTRAINT `vehicle_ibfk_1` FOREIGN KEY (`type_id`) REFERENCES `vehicle_type` (`id`), ADD CONSTRAINT `vehicle_ibfk_2` FOREIGN KEY (`engine_id`) REFERENCES `engine_type` (`id`); -- -- Limitadores para a tabela `vehiclemake` -- ALTER TABLE `vehicle_make` ADD CONSTRAINT `vehiclemake_ibfk_1` FOREIGN KEY (`type_id`) REFERENCES `vehicle_type` (`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 */;
/** team_mgr drop schema */ DROP TABLE team_season_map; DROP TABLE standings; DROP TABLE fixtures; DROP TABLE seasons; DROP TABLE teams; DROP TABLE clubs;
-- 24/07/2018 - Paid date for order and company info for customer ALTER TABLE `orders` ADD `payment_date` datetime NULL AFTER `delivery_date`; ALTER TABLE `orders` ADD `payment_description` TEXT NULL AFTER `payment_date`; DROP TABLE IF EXISTS `debt_types`; INSERT INTO `cost_types` (`id`, `name`, `description`, `is_public`, `created_dtm`, `modified_dtm`) VALUES (8, 'Khách hàng', NULL, 0, '2018-07-25 00:00:00', '2018-07-25 00:00:00'); ALTER TABLE `debts` ADD `order_id` int(11) NULL AFTER `import_id`;
-- phpMyAdmin SQL Dump -- version 4.7.4 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Generation Time: Dec 14, 2020 at 01:18 PM -- Server version: 10.1.29-MariaDB -- PHP Version: 7.0.26 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: `cbt_db` -- -- -------------------------------------------------------- -- -- Table structure for table `add_quetions` -- CREATE TABLE `add_quetions` ( `questions_id` int(11) NOT NULL, `question` varchar(1024) DEFAULT NULL, `option_1` varchar(100) DEFAULT NULL, `option_2` varchar(100) DEFAULT NULL, `option_3` varchar(100) DEFAULT NULL, `option_4` varchar(100) DEFAULT NULL, `course_id` int(11) DEFAULT NULL, `answer` varchar(225) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `add_quetions` -- INSERT INTO `add_quetions` (`questions_id`, `question`, `option_1`, `option_2`, `option_3`, `option_4`, `course_id`, `answer`) VALUES (5, 'how many type of form do we have in angular frame work ioeghejinvnv jkvsjnkvnkvnjkvjnksvnjksvjnkdnkbbnkdbnk', 'Two', 'Three', 'one', 'Four', 2, ''), (7, 'Biology is the study of what', 'kin', 'life', 'rice', 'world', 4, 'life'), (8, 'cnkvvbjkvbjdvjkvjksdvkllnksdnnvkdvnjvjnd', 'fkoim', 'joshua', 'holala', 'nfgn', 2, 'joshua'), (9, 'dash is where to inject our component ', 'low', 'constructor ', 'middle', 'con', 2, 'constructor '), (11, '____ is a name of any person animal place or things', 'noun', 'pronoun', 'verb', 'consonant', 6, 'noun'), (12, 'full meaning of php', 'hypertex preoccessor', 'html', 'css', 'javascipt', 7, 'hypertex preoccessor'); -- -------------------------------------------------------- -- -- Table structure for table `course_and_tutor` -- CREATE TABLE `course_and_tutor` ( `course_id` int(100) NOT NULL, `tutorsname` varchar(255) NOT NULL, `course` varchar(255) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `course_and_tutor` -- INSERT INTO `course_and_tutor` (`course_id`, `tutorsname`, `course`) VALUES (1, 'Atom', 'React'), (2, 'Mr Favor', 'Angular'), (3, 'Mr Oladejo', 'Math'), (4, 'Mr wale', 'biology'), (6, 'Mr Joseph', 'English'), (7, 'Mr james', 'php'); -- -------------------------------------------------------- -- -- Table structure for table `registration_tb` -- CREATE TABLE `registration_tb` ( `id` int(11) NOT NULL, `firstname` varchar(255) NOT NULL, `lastname` varchar(255) NOT NULL, `email` varchar(255) NOT NULL, `password` varchar(50) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `registration_tb` -- INSERT INTO `registration_tb` (`id`, `firstname`, `lastname`, `email`, `password`) VALUES (3, 'ezekiel', 'oladuniii', 'rindex@gmail.com', 'kola1234567'), (4, 'Oyesetan ', 'victor', 'pepper@gmail.com', 'pepepe13455'), (5, 'joshua', 'olarewaju', 'rinde@gmail.com', 'kolamide123'), (6, 'Olarinde', 'Joshua', 'olajoshua@gmail.com', 'olamidejosh123'), (7, 'olarinde', 'fatimo', 'olafati@gmail.com', 'olafati1234'), (8, 'joseph', 'olawale', 'joolawale@gmail.com', 'halawusa14567'); -- -------------------------------------------------------- -- -- Table structure for table `score_tb` -- CREATE TABLE `score_tb` ( `id` int(225) NOT NULL, `score` int(255) NOT NULL, `student_id` int(225) NOT NULL, `course_name` varchar(225) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `score_tb` -- INSERT INTO `score_tb` (`id`, `score`, `student_id`, `course_name`) VALUES (1, 2, 3, 'Angular'), (2, 1, 3, 'biology'), (3, 1, 3, 'biology'), (4, 1, 3, 'biology'), (5, 0, 3, 'biology'), (6, 1, 3, 'Mr felix'), (7, 2, 7, 'Angular'), (8, 1, 3, 'php'), (9, 1, 3, 'php'), (10, 1, 3, 'Angular'), (11, 0, 3, 'Angular'), (12, 0, 3, 'Angular'); -- -- Indexes for dumped tables -- -- -- Indexes for table `add_quetions` -- ALTER TABLE `add_quetions` ADD PRIMARY KEY (`questions_id`), ADD KEY `course_id` (`course_id`), ADD KEY `course_id_2` (`course_id`), ADD KEY `course_id_3` (`course_id`); -- -- Indexes for table `course_and_tutor` -- ALTER TABLE `course_and_tutor` ADD PRIMARY KEY (`course_id`); -- -- Indexes for table `registration_tb` -- ALTER TABLE `registration_tb` ADD PRIMARY KEY (`id`); -- -- Indexes for table `score_tb` -- ALTER TABLE `score_tb` ADD PRIMARY KEY (`id`), ADD KEY `student_id` (`student_id`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `add_quetions` -- ALTER TABLE `add_quetions` MODIFY `questions_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=13; -- -- AUTO_INCREMENT for table `course_and_tutor` -- ALTER TABLE `course_and_tutor` MODIFY `course_id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8; -- -- AUTO_INCREMENT for table `registration_tb` -- ALTER TABLE `registration_tb` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9; -- -- AUTO_INCREMENT for table `score_tb` -- ALTER TABLE `score_tb` MODIFY `id` int(225) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=13; -- -- Constraints for dumped tables -- -- -- Constraints for table `add_quetions` -- ALTER TABLE `add_quetions` ADD CONSTRAINT `add_quetions_ibfk_1` FOREIGN KEY (`course_id`) REFERENCES `course_and_tutor` (`course_id`) ON DELETE CASCADE ON UPDATE CASCADE; COMMIT; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
-- Server Keys insert into server_keys( server_key ) values( 'zuefpCdcIz/8VEkflD0D+K5srLeunWU+GnGzMMhzyHE=' ); -- Roles insert into roles values( '1', 'ADMIN' ); insert into roles values( '2', 'RECEPTIONIST' ); insert into roles values( '3', 'TECHNICIAN' ); -- Privs -- -- Admins can do anything. -- -- Receptionist can add/edit/read profiles, animals, and owners. They can all read comments. -- -- Technician can all comments and delete animals. insert into privs( description, role_id ) values( 'all users', 1 ); insert into privs( description, role_id ) values( 'all animals', 1 ); insert into privs( description, role_id ) values( 'all profiles', 1 ); insert into privs( description, role_id ) values( 'all owners', 1 ); insert into privs( description, role_id ) values( 'all reservations', 1 ); insert into privs( description, role_id ) values( 'all comments', 1 ); insert into privs( description, role_id ) values( 'add animals', 2 ); insert into privs( description, role_id ) values( 'edit animals', 2 ); insert into privs( description, role_id ) values( 'read animals', 2 ); insert into privs( description, role_id ) values( 'add profiles', 2 ); insert into privs( description, role_id ) values( 'edit profiles', 2 ); insert into privs( description, role_id ) values( 'read profiles', 2 ); insert into privs( description, role_id ) values( 'add owners', 2 ); insert into privs( description, role_id ) values( 'edit owners', 2 ); insert into privs( description, role_id ) values( 'read owners', 2 ); insert into privs( description, role_id ) values( 'all reservations', 2 ); insert into privs( description, role_id ) values( 'read comments', 2 ); insert into privs( description, role_id ) values( 'all comments', 3 ); insert into privs( description, role_id ) values( 'read animals', 3 ); insert into privs( description, role_id ) values( 'del animals', 3 ); -- Users (the following should never be deleteable nor modifiable) insert into users( username, hash, role_id ) values( 'vetroot', '$2a$10$3jdN5MqO9tWHjTO8JGhU8.ACs9TloXqR.YjCB84d8SOB1USzSYV5.', 1 ); insert into users( username, hash, role_id ) values( 'vetrec', '$2a$10$SBYd3h17NqVt3BrM5XJ87ugPDFC5YmtKCqbvNf5X8UdVweR1/Hooi', 2 ); insert into users( username, hash, role_id ) values( 'vettech', '$2a$10$1TJR8h8zG8RoXSEysfehJe7qbcluEzJZxUkO09UTUL.HZezaGwZRi', 3 ); -- Rooms insert into rooms( id, name, maxcap, cost ) values( 101, 'Gray Brick House', 1, 50.00 ); insert into rooms( id, name, maxcap, cost ) values( 102, 'Red Brick House', 1, 50.00 ); insert into rooms( id, name, maxcap, cost ) values( 103, 'Tropical Paradise', 2, 60.00 ); insert into rooms( id, name, maxcap, cost ) values( 104, 'Brown Fuzz', 2, 55.00 ); insert into rooms( id, name, maxcap, cost ) values( 105, 'Lunar Landscape', 3, 75.00 ); insert into rooms( id, name, maxcap, cost ) values( 106, 'Treehouse Colony', 3, 75.00 ); -- Profiles insert into profiles( id, name ) values( 1001, 'M/C Household' ); insert into profiles( id, name ) values( 1002, 'Jana Household' ); -- Animals insert into animals( id, name, species, profile_fk ) values( 10001, 'Sunshine', 'CAT', 1 ); insert into animals( id, name, species, profile_fk ) values( 10002, 'Mittens', 'CAT', 1 ); insert into animals( id, name, species, profile_fk ) values( 10003, 'Iana', 'SUGAR_GLIDER', 1 ); insert into animals( id, name, species, profile_fk ) values( 10004, 'Torrence', 'TORTOISE', 2 ); insert into animals( id, name, species, profile_fk ) values( 10005, 'Myrtle', 'TURTLE', 2 ); -- Owners insert into owners( id, name, phone, profile_fk ) values( 5001, 'Ken', '800-555-1212', 1 ); insert into owners( id, name, phone, profile_fk ) values( 5002, 'Sylvia', '813-555-1234', 1 ); insert into owners( id, name, phone, profile_fk ) values( 5003, 'Jana', '813-555-0059', 2 ); insert into owners( id, name, phone, profile_fk ) values( 5004, 'Jenny', '813-867-5309', 2 ); -- Reservations insert into reservations values( 4, 1, '2021-06-01', '2021-06-05', 0 ); insert into reservations values( 4, 1, '2021-06-11', '2021-06-15', 0 ); insert into reservations values( 1, 6, '2021-04-01', '2021-04-05', 0 ); insert into reservations values( 2, 6, '2021-04-01', '2021-04-05', 0 ); insert into reservations values( 3, 6, '2021-04-01', '2021-04-05', 0 ); -- Comments insert into comments( id, ondate, type, comment, animal_fk ) values( 50001, '2011-05-07 14:00:00', 'VAX', 'Rabies', 1 ); insert into comments( id, ondate, type, comment, animal_fk ) values( 50002, '2011-05-07 14:10:00', 'VAX', 'Rabies', 2 ); insert into comments( id, ondate, type, comment, animal_fk ) values( 50003, '2020-05-07 09:00:00', 'FOOD', 'SH Kibble Oral Health', 1 ); insert into comments( id, ondate, type, comment, animal_fk ) values( 50004, '2020-05-07 09:00:30', 'FOOD', 'SH Kibble Oral Health', 2 ); insert into comments( id, ondate, type, comment, animal_fk ) values( 50005, '2020-10-20 15:30:00', 'CHECKUP', '14 lbs, all clear', 1 ); insert into comments( id, ondate, type, comment, animal_fk ) values( 50006, '2020-10-20 15:45:00', 'CHECKUP', '13 lbs, all clear', 2 ); -- Procs (H2 has an issue with stored procedures) -- delimiter $$ -- drop procedure if exists find_users$$ -- create procedure find_users( in str varchar( 40 ) ) -- begin -- select * from users where username like concat( '%', str, '%' ) order by id; -- end -- $$ -- delimiter ;
-- -- 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: announcements; Type: TABLE; Schema: public; Owner: -; Tablespace: -- CREATE TABLE announcements ( id integer NOT NULL, title character varying(255) NOT NULL, description text NOT NULL, team_id integer NOT NULL, created_at timestamp without time zone, updated_at timestamp without time zone ); -- -- Name: announcements_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- CREATE SEQUENCE announcements_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; -- -- Name: announcements_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- ALTER SEQUENCE announcements_id_seq OWNED BY announcements.id; -- -- Name: assignments; Type: TABLE; Schema: public; Owner: -; Tablespace: -- CREATE TABLE assignments ( id integer NOT NULL, team_id integer NOT NULL, lesson_id integer NOT NULL, due_on timestamp without time zone NOT NULL, required boolean DEFAULT true NOT NULL, created_at timestamp without time zone, updated_at timestamp without time zone ); -- -- Name: assignments_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- CREATE SEQUENCE assignments_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; -- -- Name: assignments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- ALTER SEQUENCE assignments_id_seq OWNED BY assignments.id; -- -- Name: comments; Type: TABLE; Schema: public; Owner: -; Tablespace: -- CREATE TABLE comments ( id integer NOT NULL, user_id integer NOT NULL, submission_id integer NOT NULL, body text NOT NULL, created_at timestamp without time zone, updated_at timestamp without time zone, line_number integer, source_file_id integer, delivered boolean DEFAULT false NOT NULL ); -- -- Name: comments_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- CREATE SEQUENCE comments_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; -- -- Name: comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- ALTER SEQUENCE comments_id_seq OWNED BY comments.id; -- -- Name: lessons; Type: TABLE; Schema: public; Owner: -; Tablespace: -- CREATE TABLE lessons ( id integer NOT NULL, type character varying(255) NOT NULL, title character varying(255) NOT NULL, slug character varying(255) NOT NULL, body text NOT NULL, description text, searchable tsvector, archive character varying(255), created_at timestamp without time zone, updated_at timestamp without time zone, "position" integer NOT NULL ); -- -- Name: lessons_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- CREATE SEQUENCE lessons_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; -- -- Name: lessons_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- ALTER SEQUENCE lessons_id_seq OWNED BY lessons.id; -- -- Name: ratings; Type: TABLE; Schema: public; Owner: -; Tablespace: -- CREATE TABLE ratings ( id integer NOT NULL, user_id integer NOT NULL, lesson_id integer NOT NULL, clarity integer NOT NULL, helpfulness integer NOT NULL, comment text, created_at timestamp without time zone, updated_at timestamp without time zone ); -- -- Name: ratings_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- CREATE SEQUENCE ratings_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; -- -- Name: ratings_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- ALTER SEQUENCE ratings_id_seq OWNED BY ratings.id; -- -- Name: schema_migrations; Type: TABLE; Schema: public; Owner: -; Tablespace: -- CREATE TABLE schema_migrations ( version character varying(255) NOT NULL ); -- -- Name: source_files; Type: TABLE; Schema: public; Owner: -; Tablespace: -- CREATE TABLE source_files ( id integer NOT NULL, submission_id integer NOT NULL, filename character varying(255) DEFAULT 'untitled.txt'::character varying NOT NULL, body text NOT NULL, created_at timestamp without time zone, updated_at timestamp without time zone ); -- -- Name: source_files_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- CREATE SEQUENCE source_files_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; -- -- Name: source_files_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- ALTER SEQUENCE source_files_id_seq OWNED BY source_files.id; -- -- Name: submissions; Type: TABLE; Schema: public; Owner: -; Tablespace: -- CREATE TABLE submissions ( id integer NOT NULL, user_id integer NOT NULL, lesson_id integer NOT NULL, created_at timestamp without time zone, updated_at timestamp without time zone, archive character varying(255) NOT NULL, public boolean DEFAULT false NOT NULL, featured boolean DEFAULT false NOT NULL, comments_count integer DEFAULT 0 NOT NULL ); -- -- Name: submissions_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- CREATE SEQUENCE submissions_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; -- -- Name: submissions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- ALTER SEQUENCE submissions_id_seq OWNED BY submissions.id; -- -- Name: team_memberships; Type: TABLE; Schema: public; Owner: -; Tablespace: -- CREATE TABLE team_memberships ( id integer NOT NULL, user_id integer NOT NULL, team_id integer NOT NULL, created_at timestamp without time zone, updated_at timestamp without time zone ); -- -- Name: team_memberships_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- CREATE SEQUENCE team_memberships_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; -- -- Name: team_memberships_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- ALTER SEQUENCE team_memberships_id_seq OWNED BY team_memberships.id; -- -- Name: teams; Type: TABLE; Schema: public; Owner: -; Tablespace: -- CREATE TABLE teams ( id integer NOT NULL, name character varying(255) NOT NULL, created_at timestamp without time zone, updated_at timestamp without time zone ); -- -- Name: teams_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- CREATE SEQUENCE teams_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; -- -- Name: teams_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- ALTER SEQUENCE teams_id_seq OWNED BY teams.id; -- -- Name: users; Type: TABLE; Schema: public; Owner: -; Tablespace: -- CREATE TABLE users ( id integer NOT NULL, uid character varying(255) NOT NULL, provider character varying(255) NOT NULL, email character varying(255) NOT NULL, username character varying(255) NOT NULL, name character varying(255), created_at timestamp without time zone, updated_at timestamp without time zone, role character varying(255) DEFAULT 'member'::character varying NOT NULL, token character varying(255) NOT NULL ); -- -- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- CREATE SEQUENCE users_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; -- -- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- ALTER SEQUENCE users_id_seq OWNED BY users.id; -- -- Name: id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY announcements ALTER COLUMN id SET DEFAULT nextval('announcements_id_seq'::regclass); -- -- Name: id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY assignments ALTER COLUMN id SET DEFAULT nextval('assignments_id_seq'::regclass); -- -- Name: id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY comments ALTER COLUMN id SET DEFAULT nextval('comments_id_seq'::regclass); -- -- Name: id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY lessons ALTER COLUMN id SET DEFAULT nextval('lessons_id_seq'::regclass); -- -- Name: id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY ratings ALTER COLUMN id SET DEFAULT nextval('ratings_id_seq'::regclass); -- -- Name: id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY source_files ALTER COLUMN id SET DEFAULT nextval('source_files_id_seq'::regclass); -- -- Name: id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY submissions ALTER COLUMN id SET DEFAULT nextval('submissions_id_seq'::regclass); -- -- Name: id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY team_memberships ALTER COLUMN id SET DEFAULT nextval('team_memberships_id_seq'::regclass); -- -- Name: id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY teams ALTER COLUMN id SET DEFAULT nextval('teams_id_seq'::regclass); -- -- Name: id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY users ALTER COLUMN id SET DEFAULT nextval('users_id_seq'::regclass); -- -- Name: announcements_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- ALTER TABLE ONLY announcements ADD CONSTRAINT announcements_pkey PRIMARY KEY (id); -- -- Name: assignments_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- ALTER TABLE ONLY assignments ADD CONSTRAINT assignments_pkey PRIMARY KEY (id); -- -- Name: comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- ALTER TABLE ONLY comments ADD CONSTRAINT comments_pkey PRIMARY KEY (id); -- -- Name: lessons_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- ALTER TABLE ONLY lessons ADD CONSTRAINT lessons_pkey PRIMARY KEY (id); -- -- Name: ratings_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- ALTER TABLE ONLY ratings ADD CONSTRAINT ratings_pkey PRIMARY KEY (id); -- -- Name: source_files_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- ALTER TABLE ONLY source_files ADD CONSTRAINT source_files_pkey PRIMARY KEY (id); -- -- Name: submissions_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- ALTER TABLE ONLY submissions ADD CONSTRAINT submissions_pkey PRIMARY KEY (id); -- -- Name: team_memberships_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- ALTER TABLE ONLY team_memberships ADD CONSTRAINT team_memberships_pkey PRIMARY KEY (id); -- -- Name: teams_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- ALTER TABLE ONLY teams ADD CONSTRAINT teams_pkey PRIMARY KEY (id); -- -- Name: users_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- ALTER TABLE ONLY users ADD CONSTRAINT users_pkey PRIMARY KEY (id); -- -- Name: index_announcements_on_team_id; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX index_announcements_on_team_id ON announcements USING btree (team_id); -- -- Name: index_assignments_on_lesson_id; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX index_assignments_on_lesson_id ON assignments USING btree (lesson_id); -- -- Name: index_assignments_on_team_id; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX index_assignments_on_team_id ON assignments USING btree (team_id); -- -- Name: index_comments_on_delivered; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX index_comments_on_delivered ON comments USING btree (delivered) WHERE (delivered = false); -- -- Name: index_comments_on_source_file_id; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX index_comments_on_source_file_id ON comments USING btree (source_file_id); -- -- Name: index_comments_on_submission_id; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX index_comments_on_submission_id ON comments USING btree (submission_id); -- -- Name: index_comments_on_user_id; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX index_comments_on_user_id ON comments USING btree (user_id); -- -- Name: index_lessons_on_searchable; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX index_lessons_on_searchable ON lessons USING gin (searchable); -- -- Name: index_lessons_on_slug; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE UNIQUE INDEX index_lessons_on_slug ON lessons USING btree (slug); -- -- Name: index_ratings_on_lesson_id; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX index_ratings_on_lesson_id ON ratings USING btree (lesson_id); -- -- Name: index_ratings_on_user_id_and_lesson_id; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE UNIQUE INDEX index_ratings_on_user_id_and_lesson_id ON ratings USING btree (user_id, lesson_id); -- -- Name: index_source_files_on_submission_id; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX index_source_files_on_submission_id ON source_files USING btree (submission_id); -- -- Name: index_submissions_on_lesson_id; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX index_submissions_on_lesson_id ON submissions USING btree (lesson_id); -- -- Name: index_submissions_on_user_id; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX index_submissions_on_user_id ON submissions USING btree (user_id); -- -- Name: index_team_memberships_on_team_id; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX index_team_memberships_on_team_id ON team_memberships USING btree (team_id); -- -- Name: index_team_memberships_on_user_id_and_team_id; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE UNIQUE INDEX index_team_memberships_on_user_id_and_team_id ON team_memberships USING btree (user_id, team_id); -- -- Name: index_teams_on_name; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE UNIQUE INDEX index_teams_on_name ON teams USING btree (name); -- -- Name: index_users_on_email; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE UNIQUE INDEX index_users_on_email ON users USING btree (email); -- -- Name: index_users_on_lowercase_username; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE UNIQUE INDEX index_users_on_lowercase_username ON users USING btree (lower((username)::text)); -- -- Name: index_users_on_uid_and_provider; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE UNIQUE INDEX index_users_on_uid_and_provider ON users USING btree (uid, provider); -- -- Name: unique_schema_migrations; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE UNIQUE INDEX unique_schema_migrations ON schema_migrations USING btree (version); -- -- Name: lessons_searchable_update; Type: TRIGGER; Schema: public; Owner: - -- CREATE TRIGGER lessons_searchable_update BEFORE INSERT OR UPDATE ON lessons FOR EACH ROW EXECUTE PROCEDURE tsvector_update_trigger('searchable', 'pg_catalog.english', 'title', 'body', 'description'); -- -- PostgreSQL database dump complete -- SET search_path TO "$user",public; INSERT INTO schema_migrations (version) VALUES ('20140704220243'); INSERT INTO schema_migrations (version) VALUES ('20140705025620'); INSERT INTO schema_migrations (version) VALUES ('20140705060613'); INSERT INTO schema_migrations (version) VALUES ('20140706174616'); INSERT INTO schema_migrations (version) VALUES ('20140706183730'); INSERT INTO schema_migrations (version) VALUES ('20140707014614'); INSERT INTO schema_migrations (version) VALUES ('20140708222017'); INSERT INTO schema_migrations (version) VALUES ('20140708222338'); INSERT INTO schema_migrations (version) VALUES ('20140711194907'); INSERT INTO schema_migrations (version) VALUES ('20140712155618'); INSERT INTO schema_migrations (version) VALUES ('20140712191638'); INSERT INTO schema_migrations (version) VALUES ('20140713160257'); INSERT INTO schema_migrations (version) VALUES ('20140714010254'); INSERT INTO schema_migrations (version) VALUES ('20140715190942'); INSERT INTO schema_migrations (version) VALUES ('20140720030415'); INSERT INTO schema_migrations (version) VALUES ('20140720030640'); INSERT INTO schema_migrations (version) VALUES ('20140720040146'); INSERT INTO schema_migrations (version) VALUES ('20140720040402'); INSERT INTO schema_migrations (version) VALUES ('20140720185457'); INSERT INTO schema_migrations (version) VALUES ('20140802123039'); INSERT INTO schema_migrations (version) VALUES ('20140807181006'); INSERT INTO schema_migrations (version) VALUES ('20140810001317'); INSERT INTO schema_migrations (version) VALUES ('20140814010454'); INSERT INTO schema_migrations (version) VALUES ('20140814011324'); INSERT INTO schema_migrations (version) VALUES ('20140814011639'); INSERT INTO schema_migrations (version) VALUES ('20140814011852'); INSERT INTO schema_migrations (version) VALUES ('20140814012512'); INSERT INTO schema_migrations (version) VALUES ('20140818203653'); INSERT INTO schema_migrations (version) VALUES ('20140819174653'); INSERT INTO schema_migrations (version) VALUES ('20140826152921'); INSERT INTO schema_migrations (version) VALUES ('20140901185227'); INSERT INTO schema_migrations (version) VALUES ('20140901191401'); INSERT INTO schema_migrations (version) VALUES ('20140901191402'); INSERT INTO schema_migrations (version) VALUES ('20140928165428'); INSERT INTO schema_migrations (version) VALUES ('20140928170912'); INSERT INTO schema_migrations (version) VALUES ('20140928175407'); INSERT INTO schema_migrations (version) VALUES ('20140930132041'); INSERT INTO schema_migrations (version) VALUES ('20141003154749'); INSERT INTO schema_migrations (version) VALUES ('20141013190514'); INSERT INTO schema_migrations (version) VALUES ('20141019150156'); INSERT INTO schema_migrations (version) VALUES ('20141019150403'); INSERT INTO schema_migrations (version) VALUES ('20141021185401'); INSERT INTO schema_migrations (version) VALUES ('20141030203942'); INSERT INTO schema_migrations (version) VALUES ('20141102184011'); INSERT INTO schema_migrations (version) VALUES ('20141113200644'); INSERT INTO schema_migrations (version) VALUES ('20141126230346'); INSERT INTO schema_migrations (version) VALUES ('20141204203947');
/* Formatted on 21/07/2014 18:33:07 (QP5 v5.227.12220.39754) */ CREATE OR REPLACE FORCE VIEW MCRE_OWN.V_MCRE0_APP_API_RIALLOC_FILE ( RECORD_CHAR ) AS SELECT CASE WHEN SUBSTR (record_char, 1, 10) = '0000000000' THEN RPAD (SUBSTR (record_char, 11, 8), 60, ' ') ELSE record_char END AS record_char FROM (SELECT RPAD ('0000000000' || TO_CHAR (SYSDATE, 'ddmmyyyy'), 60, ' ') AS record_char FROM DUAL UNION SELECT NVL (COD_ABI_ISTITUTO, ' ') || COD_ABI_CARTOLARIZZATO || NVL (COD_NDG, ' ') || NVL (RPAD (COD_STATO, 2, ' '), ' ') || NVL (FLG_OUTSOURCING, ' ') || NVL (RPAD (COD_MATRICOLA, 7, ' '), ' ') || NVL ( RPAD (SUBSTR (COD_STRUTTURA_COMPETENTE, -5, 5), 5, ' '), 'NULL ') || ' ' AS record_char FROM V_MCRE0_APP_API_RIALLOC ORDER BY record_char ASC);
/*$tempViewSQL*/ SELECT --SUM(与信残リース料) ISNULL(SUM(CREDIT_BALANCE_LEASE),0) AS CREDIT_BALANCE_LEASE FROM --与信残高明細VIEW CREDIT_BALANCE_DETAIL_VIEW WHERE CONTRACT_NO IN (SELECT distinct C.CONTRACT_NO FROM CONTRACT_INFO C LEFT JOIN CONTRACT_GUARANTEE_INFO CG ON C.CONTRACT_NO = CG.CONTRACT_NO WHERE 1=1 /*IF(contractNo != null)*/ AND C.CONTRACT_NO != /*contractNo*/'' /*END*/ AND ( C.CUSTOMER_CODE = /*customerCode*/'' OR CG.GUARANTOR_CODE = /*customerCode*/'' ) )