blob_id stringlengths 40 40 | language stringclasses 1
value | repo_name stringlengths 5 133 | path stringlengths 3 276 | src_encoding stringclasses 33
values | length_bytes int64 23 9.61M | score float64 2.52 5.28 | int_score int64 3 5 | detected_licenses listlengths 0 44 | license_type stringclasses 2
values | text stringlengths 23 9.43M | download_success bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|
c003dbc1c189f1ed8a82714c1e142a3fba69d02c | SQL | uoit-cs/mycampus-crawler | /analysis/cs-growth/run.sql | UTF-8 | 2,561 | 4.375 | 4 | [] | no_license | .header on
.mode column
create temp table S as
with S0 as (
select
substr(semester, 1, 4) as year,
semester,
code,
title,
crn,
max(actual) as actual
from schedule
where code like 'CSCI%U'
and schtype = 'Lecture'
and semester >= '2015'
group by semester, code, crn
)
select year, semester, code, title, sum(actual) as actual
from S0
group by semester, code
order by year, code
;
-- first year enrollment estimation
select year, actual as 'csci_1060u'
from S
where code = 'CSCI 1060U';
-- total students taught
select year, sum(actual) as 'total_in_lectures'
from S
group by year;
-- total non-lectures
select
substr(semester, 1, 4) as year,
count(*) as 'lab_or_tutorial'
from schedule
where code like 'CSCI%U'
and code < 'CSCI 3'
and schtype is not 'Lecture'
and semester >= '2015'
group by year
;
-- lectures and their first teaching
.width 10 10
with T as (
select
instructor,
crn,
semester,
max(actual) as actual
from schedule
where code like 'CSCI%'
and (
instructor like '%Green' or
instructor like '%Pu' or
instructor like '%Bradbury' or
instructor like '%Qureshi' or
instructor like '%Collins' or
instructor like '%Szlichta' or
instructor like '%Fortier--')
group by instructor, semester, crn
)
select substr(semester, 1, 4) as year, sum(actual) as undergrads
from T
group by year
order by year
;
-- ratio of sessionals
.width
with T as (
select distinct semester, code, title, instructor
from schedule
where code like 'CSCI%U'
and semester > '2015'
and schtype = 'Lecture'
),
S as (
select * from T
where
instructor like 'J%Bradbury' or
instructor like 'J%Szlichta' or
instructor like 'F%Qureshi' or
instructor like 'M%Green' or
instructor like 'K%Pu' or
instructor like 'R%Fortier' or
instructor like 'C%Collins' or
instructor like 'M%Beligan' or
instructor like 'M%Bennett' or
instructor like 'Y%Zhu' or
instructor like 'M%Makrehchi' or
instructor like 'M%Ebrahimi' or
instructor like 'L%Veen'
)
select
semester,
case when S.instructor is null then 'sessional' else 'core' end as type,
count(distinct code)
from T left join S using (semester, code, instructor)
group by semester, type
order by semester, type, code
;
| true |
58269cf4217f88d9e66a3f25abe6b6588762910d | SQL | TareqJudehGithub/SQL_ZTM | /Query_Practice.sql | UTF-8 | 3,328 | 4.625 | 5 | [] | no_license | -- Check SQL version:
SELECT VERSION();
SELECT id,
occurred_at,
total_amt_usd
FROM orders
ORDER BY occurred_at DESC
LIMIT 10;
SELECT id,
account_id,
total_amt_usd
FROM orders
ORDER BY total_amt_usd DESC
LIMIT 5;
SELECT id,
account_id,
total_amt_usd
FROM orders
ORDER BY total_amt_usd DESC, account_id
LIMIT 20;
SELECT *
FROM orders
WHERE gloss_amt_usd >= 1000
LIMIT 5;
SELECT name,
website,
primary_poc
FROM accounts
WHERE name = 'Exxon Mobil';
-- divides the standard_amt_usd by the standard_qty to
-- find the unit price for standard paper for each order.
SELECT id AS "Order ID",
account_id AS "Account ID",
ROUND(standard_amt_usd / standard_qty, 2) AS "Unit Price"
FROM orders
LIMIT 10;
SELECT id AS "Order ID",
account_id AS "Account ID",
ROUND(poster_amt_usd / (standard_amt_usd + gloss_amt_usd + poster_amt_usd), 2) AS "Poster Revenue"
FROM orders
WHERE poster_amt_usd > 0
LIMIT 10;
-- Logical Operators
-- LIKE
SELECT *
FROM accounts
WHERE name LIKE '%s';
-- IN
SELECT *
FROM orders
WHERE account_id IN (1001, 1091, 1081)
ORDER BY occurred_at DESC
LIMIT 10;
SELECT *
FROM accounts
WHERE name IN ('Walmart', 'Apple');
SELECT name,
primary_poc,
sales_rep_id
FROM accounts
WHERE name IN ('Walmart', 'Target', 'Nordstrom');
SELECT *
FROM web_events
WHERE channel IN ('organic', 'adwords');
-- NOT
SELECT name,
primary_poc,
sales_rep_id
FROM accounts
WHERE name NOT IN ('Walmart', 'Target', 'Nordstrom');
SELECT *
FROM web_events
WHERE channel NOT IN ('organic', 'adwords');
SELECT *
FROM accounts
WHERE name NOT LIKE 'C%';
SELECT *
FROM accounts
WHERE name NOT LIKE '%one%';
SELECT *
FROM accounts
WHERE name NOT LIKE '%s';
-- BETWEEN AND
SELECT *
FROM orders
WHERE occurred_at BETWEEN '2013-01-01' AND '2016-12-31';
SELECT *
FROM orders
WHERE (standard_qty BETWEEN 1000 AND 1500) AND poster_qty = 0 AND gloss_qty = 0;
-- Using the accounts table, find all the companies whose names do not start with 'C' and end with 's'.
SELECT *
FROM accounts
WHERE name NOT LIKE 'C%' AND name LIKE '%s';
SELECT *
FROM web_events
WHERE (occurred_at BETWEEN '2016-01-01' AND '2016-12-31') AND channel IN ('organic', 'adwords');
-- OR
SELECT id,
gloss_qty,
poster_qty
FROM orders
WHERE gloss_qty > 4000 OR poster_qty > 4000
SELECT name,
accounts.primary_poc
FROM accounts
WHERE (name LIKE 'C%' OR name LIKE 'W%')
AND (primary_poc lIKE '%ana%' OR accounts.primary_poc LIKE '%Ana%' )
AND (accounts.primary_poc NOT LIKE '%eana%');
-- Joins (INNER JOIN)
SELECT *
FROM orders AS ord
JOIN accounts AS acc
ON ord.account_id = acc.id;
SELECT *
FROM orders AS ord
JOIN accounts AS acc
ON ord.account_id = acc.id
JOIN web_events AS web
ON acc.id = web.account_id;
SELECT *
FROM web_events;
SELECT acc.primary_poc,
web.occurred_at,
web.channel,
acc.name
FROM accounts AS acc
JOIN web_events AS web
ON acc.id = web.account_id
WHERE acc.name = 'Walmart'
ORDER BY web.occurred_at;
-- LEFT JOIN
SELECT acc.primary_poc,
web.occurred_at,
web.channel,
acc.name
FROM accounts AS acc
LEFT JOIN web_events AS web
ON acc.id = web.account_id
WHERE acc.name = 'Walmart'
ORDER BY web.occurred_at;
SELECT DISTINCT
acc.name,
events.channel
FROM web_events AS events
JOIN accounts AS acc
ON events.account_id = acc.id
WHERE acc.id = 1001;
| true |
3e51ebff55e8959675d626f23fedb9a169c413ee | SQL | andrelokal/SkeletonGenerator | /engineer/dbteste.sql | UTF-8 | 9,514 | 3.609375 | 4 | [] | no_license | -- MySQL Script generated by MySQL Workbench
-- 03/05/17 19:31:20
-- Model: New Model Version: 1.0
-- MySQL Workbench Forward Engineering
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES';
-- -----------------------------------------------------
-- Schema mydb
-- -----------------------------------------------------
-- -----------------------------------------------------
-- Schema dbteste
-- -----------------------------------------------------
-- -----------------------------------------------------
-- Schema dbteste
-- -----------------------------------------------------
CREATE SCHEMA IF NOT EXISTS `dbteste` DEFAULT CHARACTER SET utf8 ;
USE `dbteste` ;
-- -----------------------------------------------------
-- Table `dbteste`.`pessoa`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `dbteste`.`pessoa` (
`id` INT NOT NULL AUTO_INCREMENT,
`status` VARCHAR(2) NOT NULL COMMENT 'AT=ATIVO\nIN=INATIVO\n',
`tipo` VARCHAR(1) NOT NULL COMMENT 'F=FISICA\nJ=JURIDICA\n',
`rua` VARCHAR(100) NULL DEFAULT NULL,
`numero` VARCHAR(5) NULL DEFAULT NULL,
`bairro` VARCHAR(100) NULL DEFAULT NULL,
`cidade` VARCHAR(100) NULL DEFAULT NULL,
`uf` VARCHAR(2) NULL DEFAULT NULL,
`cep` VARCHAR(30) NULL DEFAULT NULL,
`pais` VARCHAR(45) NULL DEFAULT NULL,
`telefone` VARCHAR(30) NULL DEFAULT NULL,
`email` VARCHAR(100) NULL DEFAULT NULL,
`dt_atualizacao` DATETIME NULL DEFAULT NULL,
`dt_cadastro` DATETIME NULL DEFAULT NULL,
PRIMARY KEY (`id`))
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `dbteste`.`juridica`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `dbteste`.`juridica` (
`id` INT NOT NULL AUTO_INCREMENT,
`pessoa_id` INT NOT NULL,
`cnpj` VARCHAR(100) NOT NULL,
`razao_social` VARCHAR(200) NOT NULL,
`nome_fantasia` VARCHAR(200) NOT NULL,
`inscricao_estadual` VARCHAR(100) NULL DEFAULT NULL,
`ccm` VARCHAR(100) NULL DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE INDEX `cnpj_UNIQUE` (`cnpj` ASC),
INDEX `fk_juridica_pessoa2_idx` (`pessoa_id` ASC),
UNIQUE INDEX `pessoa_id_UNIQUE` (`pessoa_id` ASC),
CONSTRAINT `fk_juridica_pessoa2`
FOREIGN KEY (`pessoa_id`)
REFERENCES `dbteste`.`pessoa` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `dbteste`.`fisica`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `dbteste`.`fisica` (
`id` INT NOT NULL AUTO_INCREMENT,
`pessoa_id` INT NOT NULL,
`cpf` VARCHAR(20) NOT NULL,
`nome` VARCHAR(200) NOT NULL,
`rg` VARCHAR(20) NULL DEFAULT NULL,
`dt_nascimento` DATE NULL DEFAULT NULL,
`sexo` VARCHAR(1) NULL DEFAULT NULL COMMENT 'SEXO:\nH=HOMEM\nM=MULHER\n',
UNIQUE INDEX `cpf_UNIQUE` (`cpf` ASC),
INDEX `fk_fisica_pessoa2_idx` (`pessoa_id` ASC),
PRIMARY KEY (`id`),
UNIQUE INDEX `pessoa_id_UNIQUE` (`pessoa_id` ASC),
CONSTRAINT `fk_fisica_pessoa2`
FOREIGN KEY (`pessoa_id`)
REFERENCES `dbteste`.`pessoa` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `dbteste`.`categoria`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `dbteste`.`categoria` (
`id` INT NOT NULL AUTO_INCREMENT,
`nome` VARCHAR(200) NOT NULL,
PRIMARY KEY (`id`))
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `dbteste`.`unidade`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `dbteste`.`unidade` (
`id` INT NOT NULL AUTO_INCREMENT,
`descricao` VARCHAR(45) NOT NULL,
PRIMARY KEY (`id`))
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `dbteste`.`produto`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `dbteste`.`produto` (
`id` INT NOT NULL AUTO_INCREMENT,
`codigo` VARCHAR(45) NULL DEFAULT NULL,
`codbar` VARCHAR(255) NULL DEFAULT NULL,
`categoria_id` INT NOT NULL,
`nome` VARCHAR(200) NOT NULL,
`descricao` VARCHAR(1000) NULL DEFAULT NULL,
`valor` DECIMAL(7,2) NOT NULL,
`unidade_id` INT NOT NULL,
PRIMARY KEY (`id`),
INDEX `fk_produto_categoria1_idx` (`categoria_id` ASC),
UNIQUE INDEX `codigo_UNIQUE` (`codigo` ASC),
UNIQUE INDEX `codbar_UNIQUE` (`codbar` ASC),
INDEX `fk_produto_unidade1_idx` (`unidade_id` ASC),
CONSTRAINT `fk_produto_categoria1`
FOREIGN KEY (`categoria_id`)
REFERENCES `dbteste`.`categoria` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_produto_unidade1`
FOREIGN KEY (`unidade_id`)
REFERENCES `dbteste`.`unidade` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `dbteste`.`funcionario`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `dbteste`.`funcionario` (
`id` INT NOT NULL AUTO_INCREMENT,
`pessoa_id` INT NOT NULL,
`login` VARCHAR(50) NOT NULL,
`senha` VARCHAR(20) NOT NULL,
`email` VARCHAR(100) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE INDEX `login_UNIQUE` (`login` ASC),
INDEX `fk_funcionario_pessoa1_idx` (`pessoa_id` ASC),
CONSTRAINT `fk_funcionario_pessoa1`
FOREIGN KEY (`pessoa_id`)
REFERENCES `dbteste`.`pessoa` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `dbteste`.`entrada_produto`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `dbteste`.`entrada_produto` (
`id` INT NOT NULL AUTO_INCREMENT,
`produto_id` INT NOT NULL,
`fornecedor_id` INT NOT NULL,
`quantidade` DECIMAL(10,0) NOT NULL,
`lote` VARCHAR(45) NULL DEFAULT NULL,
`dt_compra` DATE NOT NULL,
`dt_validade` DATE NULL DEFAULT NULL,
`valor_unitario` DECIMAL(7,2) NULL DEFAULT NULL,
`valor_total` DECIMAL(7,2) NULL DEFAULT NULL,
PRIMARY KEY (`id`),
INDEX `fk_entrada_produto_produto1_idx` (`produto_id` ASC),
INDEX `fk_entrada_produto_pessoa1_idx` (`fornecedor_id` ASC),
CONSTRAINT `fk_entrada_produto_produto1`
FOREIGN KEY (`produto_id`)
REFERENCES `dbteste`.`produto` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_entrada_produto_pessoa1`
FOREIGN KEY (`fornecedor_id`)
REFERENCES `dbteste`.`pessoa` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `dbteste`.`venda`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `dbteste`.`venda` (
`id` INT NOT NULL AUTO_INCREMENT,
`cliente_id` INT NOT NULL,
`desconto` VARCHAR(45) NULL DEFAULT NULL,
`total` DECIMAL(7,2) NOT NULL,
`data` DATETIME NOT NULL,
PRIMARY KEY (`id`, `data`),
INDEX `fk_venda_pessoa1_idx` (`cliente_id` ASC),
CONSTRAINT `fk_venda_pessoa1`
FOREIGN KEY (`cliente_id`)
REFERENCES `dbteste`.`pessoa` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `dbteste`.`itens_venda`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `dbteste`.`itens_venda` (
`id` INT NOT NULL AUTO_INCREMENT,
`venda_id` INT NOT NULL,
`produto_id` INT NOT NULL,
`quantidade` VARCHAR(45) NULL DEFAULT NULL,
`valor_unitario` DECIMAL(7,2) NULL DEFAULT NULL,
INDEX `fk_itens_venda_venda1_idx` (`venda_id` ASC),
INDEX `fk_itens_venda_produto1_idx` (`produto_id` ASC),
PRIMARY KEY (`id`),
CONSTRAINT `fk_itens_venda_venda1`
FOREIGN KEY (`venda_id`)
REFERENCES `dbteste`.`venda` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_itens_venda_produto1`
FOREIGN KEY (`produto_id`)
REFERENCES `dbteste`.`produto` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `dbteste`.`modulo`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `dbteste`.`modulo` (
`id` INT NOT NULL AUTO_INCREMENT,
`text` VARCHAR(200) NOT NULL,
`pai` INT(11) NULL DEFAULT NULL,
`statusID` TINYTEXT NULL DEFAULT NULL,
`link` VARCHAR(255) NULL DEFAULT NULL,
PRIMARY KEY (`id`),
INDEX `fk_modulo_modulo1_idx` (`pai` ASC))
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `dbteste`.`acesso`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `dbteste`.`acesso` (
`id` INT NOT NULL AUTO_INCREMENT,
`modulo_id` INT NOT NULL,
`funcionario_id` INT NOT NULL,
`nivel_acesso` VARCHAR(45) NOT NULL,
PRIMARY KEY (`id`),
INDEX `fk_acesso_funcionario1_idx` (`funcionario_id` ASC),
INDEX `fk_acesso_modulo1` (`modulo_id` ASC),
CONSTRAINT `fk_acesso_modulo1`
FOREIGN KEY (`modulo_id`)
REFERENCES `dbteste`.`modulo` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_acesso_funcionario1`
FOREIGN KEY (`funcionario_id`)
REFERENCES `dbteste`.`funcionario` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
| true |
999d676caad51ccd7aeeb5b7776cf472555ba7d6 | SQL | Kalesberg/wmach-api | /API/SQL/m2.Currencies.sql | UTF-8 | 456 | 3.03125 | 3 | [] | no_license | DROP TABLE m2.RateRegionCurrencies
CREATE TABLE m2.RateRegionCurrencies (
ID INT IDENTITY(1,1),
Prefix VARCHAR(20) NOT NULL,
Region VARCHAR(100) NOT NULL,
Multiplier DECIMAL(3,2) NOT NULL
)
INSERT INTO m2.RateRegionCurrencies VALUES ('CAN', 'Canada', 1.1), ('EUR', 'Europe', 1.1), ('AUS', 'Australia', 0.85), ('LA', 'Latin America', 1.1)
ALTER PROCEDURE m2.getRateCurrencyMultipliers
AS
SELECT Prefix, Region, Multiplier FROM m2.RateRegionCurrencies
| true |
3ad1e7614b3a946465747700616e86395bc67f42 | SQL | GokoshiJr/curso-sql | /insert_books.sql | UTF-8 | 341 | 3.28125 | 3 | [] | no_license | /* El Arte de la guerra, Enrique Rincon, 2020 */
/* Estructuras defensivas, Enrique Rincon, 2018 */
INSERT INTO books (title, author_id)
VALUES ('El Arte de la guerra', 4);
INSERT INTO books (title, author_id, `year`)
VALUES ('Estructuras defensivas',
(SELECT author_id FROM authors WHERE `name` = 'Enrique Rincon' LIMIT 1) /* Sub Query*/
, 2018
); | true |
818da3a7672f6135e9fbba7d269243d1637403ff | SQL | ojkalam/loan-management | /admin/brac_loan.sql | UTF-8 | 5,765 | 2.96875 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 4.7.4
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Apr 06, 2018 at 10:06 PM
-- Server version: 10.1.30-MariaDB
-- PHP Version: 7.2.1
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `brac_loan`
--
-- --------------------------------------------------------
--
-- Table structure for table `tbl_borrower`
--
CREATE TABLE `tbl_borrower` (
`id` int(11) NOT NULL,
`name` varchar(100) NOT NULL,
`nid` bigint(30) NOT NULL,
`rejected` int(11) NOT NULL DEFAULT '0',
`gender` varchar(20) NOT NULL,
`mobile` varchar(20) NOT NULL,
`email` varchar(50) NOT NULL,
`dob` date NOT NULL,
`address` varchar(255) NOT NULL,
`working_status` varchar(50) NOT NULL,
`image` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `tbl_borrower`
--
INSERT INTO `tbl_borrower` (`id`, `name`, `nid`, `rejected`, `gender`, `mobile`, `email`, `dob`, `address`, `working_status`, `image`) VALUES
(6, 'Md Raihan Uddin', 199645454, 0, 'Male', '01834564564', 'raihan@mail.com', '1995-11-22', 'Uttara, Dhaka', 'Employee', 'admin/uploads/e8ff9fb761.jpg');
-- --------------------------------------------------------
--
-- Table structure for table `tbl_liability`
--
CREATE TABLE `tbl_liability` (
`id` int(11) NOT NULL,
`b_id` int(11) NOT NULL,
`loan_id` int(11) NOT NULL,
`property_name` varchar(255) NOT NULL,
`property_details` text NOT NULL,
`price` bigint(50) NOT NULL,
`pay_remaining_loan` bigint(50) NOT NULL,
`return_money` bigint(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `tbl_loan_application`
--
CREATE TABLE `tbl_loan_application` (
`id` int(11) NOT NULL,
`b_id` int(11) NOT NULL,
`status` int(11) NOT NULL DEFAULT '0',
`name` varchar(100) NOT NULL,
`expected_loan` bigint(50) NOT NULL,
`loan_percentage` int(11) NOT NULL,
`installments` int(11) NOT NULL,
`total_loan` bigint(50) NOT NULL,
`emi_loan` int(11) NOT NULL,
`amount_paid` bigint(50) DEFAULT '0',
`amount_remain` bigint(50) DEFAULT NULL,
`current_inst` int(11) DEFAULT '0',
`remain_inst` int(11) DEFAULT NULL,
`next_date` date DEFAULT NULL,
`files` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `tbl_loan_application`
--
INSERT INTO `tbl_loan_application` (`id`, `b_id`, `status`, `name`, `expected_loan`, `loan_percentage`, `installments`, `total_loan`, `emi_loan`, `amount_paid`, `amount_remain`, `current_inst`, `remain_inst`, `next_date`, `files`) VALUES
(8, 6, 3, 'Md Raihan Uddin', 45000, 10, 12, 49500, 4125, 8250, 41250, 2, 10, '2018-01-03', 'admin/uploads/documents/9987e42b7d.docx');
-- --------------------------------------------------------
--
-- Table structure for table `tbl_payment`
--
CREATE TABLE `tbl_payment` (
`id` int(11) NOT NULL,
`b_id` int(11) NOT NULL,
`loan_id` int(11) NOT NULL,
`pay_amount` int(11) NOT NULL,
`pay_date` date NOT NULL,
`current_inst` int(11) NOT NULL,
`remain_inst` int(11) NOT NULL,
`fine` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `tbl_payment`
--
INSERT INTO `tbl_payment` (`id`, `b_id`, `loan_id`, `pay_amount`, `pay_date`, `current_inst`, `remain_inst`, `fine`) VALUES
(26, 6, 8, 4125, '2018-04-07', 1, 11, 0),
(27, 6, 8, 4125, '2018-05-07', 2, 10, 0);
-- --------------------------------------------------------
--
-- Table structure for table `tbl_user`
--
CREATE TABLE `tbl_user` (
`id` int(11) NOT NULL,
`name` varchar(100) NOT NULL,
`email` varchar(100) NOT NULL,
`pass` varchar(50) NOT NULL,
`designation` varchar(100) NOT NULL,
`role` tinyint(4) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `tbl_user`
--
INSERT INTO `tbl_user` (`id`, `name`, `email`, `pass`, `designation`, `role`) VALUES
(2, 'Md Niamul Haque', 'head@gmail.com', '68053af2923e00204c3ca7c6a3150cf7', 'Head Officer', 3),
(3, 'Md Abul Kalam', 'branch@gmail.com', '202cb962ac59075b964b07152d234b70', 'Branch Officer', 2),
(4, 'Md Faizul Haque', 'var@gmail.com', '250cf8b51c773f3f8dc8b4be867a9a02', 'Varifier', 1);
--
-- Indexes for dumped tables
--
--
-- Indexes for table `tbl_borrower`
--
ALTER TABLE `tbl_borrower`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `nid` (`nid`);
--
-- Indexes for table `tbl_liability`
--
ALTER TABLE `tbl_liability`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `tbl_loan_application`
--
ALTER TABLE `tbl_loan_application`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `tbl_payment`
--
ALTER TABLE `tbl_payment`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `tbl_user`
--
ALTER TABLE `tbl_user`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `tbl_borrower`
--
ALTER TABLE `tbl_borrower`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
--
-- AUTO_INCREMENT for table `tbl_loan_application`
--
ALTER TABLE `tbl_loan_application`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;
--
-- AUTO_INCREMENT for table `tbl_payment`
--
ALTER TABLE `tbl_payment`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=28;
--
-- AUTO_INCREMENT for table `tbl_user`
--
ALTER TABLE `tbl_user`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
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 */;
| true |
174a43d25ddeece3a44b6c3f5253c79ada6973ef | SQL | JinhiA/Burger | /db/schema.sql | UTF-8 | 432 | 3.265625 | 3 | [] | no_license | -- Drops the programming_db if it already exists --
DROP DATABASE IF EXISTS burgers_db;
-- Created the DB "burgers_db" (only works on local connections)
CREATE DATABASE burgers_db;
-- Use the burgers_db for all the rest of the script
USE burgers_db;
-- Created the table "burgers"
CREATE TABLE burgers (
id INT AUTO_INCREMENT NOT NULL,
burger_name VARCHAR(80) NOT NULL,
devoured BOOLEAN DEFAULT false,
PRIMARY KEY(id)
); | true |
435aa3b026a092613982d5d9b9a01fd4b4d3fcd7 | SQL | DuchelWemo/CSI2532Playground | /db/Migration/20210405110514-create-competition-table.sql | UTF-8 | 250 | 2.796875 | 3 | [] | no_license | CREATE TABLE competition(
competitionid int NOT NULL,
name varchar(50),
venue varchar(50),
start_date_time DATETIME,
end_date_time DATETIME,
duration VARCHAR(50),
PRIMARY KEY (competitionid)
);
| true |
1ee8770f5cef90c64c62e7e2fd04aad269389cfd | SQL | svintenok/timetable_agent | /src/main/resources/db/changelog/sql/0003-insert-test-data.sql | UTF-8 | 20,046 | 3.171875 | 3 | [] | no_license | --liquibase formatted sql
--changeset svintenok:1
INSERT INTO study_course(course_num) VALUES (1); --1
INSERT INTO study_course(course_num) VALUES (2); --2
INSERT INTO study_course(course_num) VALUES (3); --3
INSERT INTO study_course(course_num) VALUES (4); --4
INSERT INTO study_group(group_num, course_id, student_count) VALUES ('11-501', 4, 18);--1
INSERT INTO study_group(group_num, course_id, student_count) VALUES ('11-502', 4, 19);--2
INSERT INTO study_group(group_num, course_id, student_count) VALUES ('11-503', 4, 16);--3
INSERT INTO group_set(name) VALUES ('четвертый курс');--1
INSERT INTO group_set_group(study_group_id, group_set_id) VALUES (1, 1);--1
INSERT INTO group_set_group(study_group_id, group_set_id) VALUES (2, 1);--2
INSERT INTO group_set_group(study_group_id, group_set_id) VALUES (3, 1);--3
INSERT INTO subject_course(name, pair_count, study_course_id) VALUES ('Основы информационного поиска', 2, 4);--1
INSERT INTO subject_course(name, pair_count, study_course_id) VALUES ('Методология научных исследований', 2, 4);--2
--INSERT INTO subject_course(name, pair_count, study_course_id) VALUES ('Проектирование цифровых образовательных сред', 2, 4);--3
--INSERT INTO subject_course(name, pair_count, study_course_id) VALUES ('Интернет вещей', 2, 4);--4
INSERT INTO subject_course(name, pair_count, study_course_id, opt_course_block) VALUES ('Курс по выбору', 2, 4, TRUE );--3
--INSERT INTO opt_course_block(name, study_course_id) VALUES ('блок № 1', 4);--1
--INSERT INTO opt_course_block_subject(opt_course_block_id, subject_course_id) VALUES (1, 3);--1
--INSERT INTO opt_course_block_subject(opt_course_block_id, subject_course_id) VALUES (1, 4);--2
INSERT INTO opt_subject_course(name, subject_course, student_count, study_course_id) VALUES ('Проектирование цифровых образовательных сред', 3, 7, 4);--1
INSERT INTO opt_subject_course(name, subject_course, student_count, study_course_id) VALUES ('Интернет вещей', 3, 40, 4);--2
INSERT INTO timeslot_day(day_num, day_name) VALUES (1, 'Понедельник');--1
INSERT INTO timeslot_day(day_num, day_name) VALUES (2, 'Вторник');--2
INSERT INTO timeslot_day(day_num, day_name) VALUES (3, 'Среда');--3
INSERT INTO timeslot_day(day_num, day_name) VALUES (4, 'Четверг');--4
INSERT INTO timeslot_day(day_num, day_name) VALUES (5, 'Пятница');--5
INSERT INTO timeslot_day(day_num, day_name) VALUES (6, 'Суббота');--6
INSERT INTO timeslot_time(pair_num, time_interval) VALUES (1, '8:30-10:00');--1
INSERT INTO timeslot_time(pair_num, time_interval) VALUES (2, '10:10-11:40');--2
INSERT INTO timeslot_time(pair_num, time_interval) VALUES (3, '11:50-13:20');--3
INSERT INTO timeslot_time(pair_num, time_interval) VALUES (4, '14:00-15:30');--4
INSERT INTO timeslot_time(pair_num, time_interval) VALUES (5, '15:40-17:10');--5
INSERT INTO timeslot_time(pair_num, time_interval) VALUES (6, '17:20-18:50');--6
INSERT INTO timeslot(timeslot_day, timeslot_time) VALUES (1, 1);--1
INSERT INTO timeslot(timeslot_day, timeslot_time) VALUES (1, 2);--2
INSERT INTO timeslot(timeslot_day, timeslot_time) VALUES (1, 3);--3
INSERT INTO timeslot(timeslot_day, timeslot_time) VALUES (1, 4);--4
INSERT INTO timeslot(timeslot_day, timeslot_time) VALUES (1, 5);--5
INSERT INTO timeslot(timeslot_day, timeslot_time) VALUES (1, 6);--6
INSERT INTO timeslot(timeslot_day, timeslot_time) VALUES (2, 1);--7
INSERT INTO timeslot(timeslot_day, timeslot_time) VALUES (2, 2);--8
INSERT INTO timeslot(timeslot_day, timeslot_time) VALUES (2, 3);--9
INSERT INTO timeslot(timeslot_day, timeslot_time) VALUES (2, 4);--10
INSERT INTO timeslot(timeslot_day, timeslot_time) VALUES (2, 5);--11
INSERT INTO timeslot(timeslot_day, timeslot_time) VALUES (2, 6);--12
INSERT INTO timeslot(timeslot_day, timeslot_time) VALUES (3, 1);--13
INSERT INTO timeslot(timeslot_day, timeslot_time) VALUES (3, 2);--14
INSERT INTO timeslot(timeslot_day, timeslot_time) VALUES (3, 3);--15
INSERT INTO timeslot(timeslot_day, timeslot_time) VALUES (3, 4);--16
INSERT INTO timeslot(timeslot_day, timeslot_time) VALUES (3, 5);--17
INSERT INTO timeslot(timeslot_day, timeslot_time) VALUES (3, 6);--18
INSERT INTO timeslot(timeslot_day, timeslot_time) VALUES (4, 1);--19
INSERT INTO timeslot(timeslot_day, timeslot_time) VALUES (4, 2);--20
INSERT INTO timeslot(timeslot_day, timeslot_time) VALUES (4, 3);--21
INSERT INTO timeslot(timeslot_day, timeslot_time) VALUES (4, 4);--22
INSERT INTO timeslot(timeslot_day, timeslot_time) VALUES (4, 5);--23
INSERT INTO timeslot(timeslot_day, timeslot_time) VALUES (4, 6);--24
INSERT INTO timeslot(timeslot_day, timeslot_time) VALUES (5, 1);--25
INSERT INTO timeslot(timeslot_day, timeslot_time) VALUES (5, 2);--26
INSERT INTO timeslot(timeslot_day, timeslot_time) VALUES (5, 3);--27
INSERT INTO timeslot(timeslot_day, timeslot_time) VALUES (5, 4);--28
INSERT INTO timeslot(timeslot_day, timeslot_time) VALUES (5, 5);--29
INSERT INTO timeslot(timeslot_day, timeslot_time) VALUES (5, 6);--30
INSERT INTO timeslot(timeslot_day, timeslot_time) VALUES (6, 1);--31
INSERT INTO timeslot(timeslot_day, timeslot_time) VALUES (6, 2);--32
INSERT INTO timeslot(timeslot_day, timeslot_time) VALUES (6, 3);--33
INSERT INTO timeslot(timeslot_day, timeslot_time) VALUES (6, 4);--34
INSERT INTO timeslot(timeslot_day, timeslot_time) VALUES (6, 5);--35
INSERT INTO timeslot(timeslot_day, timeslot_time) VALUES (6, 6);--36
INSERT INTO professor(name) VALUES ('Абрамский М. М.');--1
INSERT INTO professor(name) VALUES ('Хайдаров Ш. М.');--2
INSERT INTO professor(name) VALUES ('Галицина И. Н.');--3
INSERT INTO professor(name) VALUES ('Невзорова О. А.');--4
INSERT INTO professor(name) VALUES ('Камалетдинов И. Р.');--5
INSERT INTO auditory(capacity, auditory_number) VALUES (25, '1409');--1
INSERT INTO auditory(capacity, auditory_number) VALUES (200, '108');--2
INSERT INTO auditory(capacity, auditory_number) VALUES (25, '1306');--3
INSERT INTO auditory(capacity, auditory_number) VALUES (50, '1310');--4
INSERT INTO pair_type(type) VALUES ('практика');--1
INSERT INTO pair_type(type) VALUES ('лекция');--2
INSERT INTO pair_type(type) VALUES ('курс по выбору');--3
INSERT INTO assigned_pair(timeslot, timeslot_day, timeslot_time, study_group_id, group_set_id, subject_course_id, type, opt_subject_course_id, professor_id, auditory_id) VALUES (5, 1, 5, 1, NULL, 1, 1, NULL, 2, 3);--1
INSERT INTO assigned_pair(timeslot, timeslot_day, timeslot_time, study_group_id, group_set_id, subject_course_id, type, opt_subject_course_id, professor_id, auditory_id) VALUES (6, 1, 6, NULL, 1, 2, 2, NULL, 3, 2);--2
INSERT INTO assigned_pair(timeslot, timeslot_day, timeslot_time, study_group_id, group_set_id, subject_course_id, type, opt_subject_course_id, professor_id, auditory_id) VALUES (11, 2, 5, NULL, 1, 3, 3, 1, 1, 1);--3
INSERT INTO assigned_pair(timeslot, timeslot_day, timeslot_time, study_group_id, group_set_id, subject_course_id, type, opt_subject_course_id, professor_id, auditory_id) VALUES (12, 2, 6, NULL, 1, 3, 3, 1, 1, 1);--4
INSERT INTO assigned_pair(timeslot, timeslot_day, timeslot_time, study_group_id, group_set_id, subject_course_id, type, opt_subject_course_id, professor_id, auditory_id) VALUES (11, 2, 5, NULL, 1, 3, 3, 2, 5, 4);--5
INSERT INTO assigned_pair(timeslot, timeslot_day, timeslot_time, study_group_id, group_set_id, subject_course_id, type, opt_subject_course_id, professor_id, auditory_id) VALUES (12, 2, 6, NULL, 1, 3, 3, 2, 5, 4);--6
INSERT INTO assigned_pair(timeslot, timeslot_day, timeslot_time, study_group_id, group_set_id, subject_course_id, type, opt_subject_course_id, professor_id, auditory_id) VALUES (24, 4, 6, NULL, 1, 1, 2, NULL, 4, 2);--7
INSERT INTO assigned_pair(timeslot, timeslot_day, timeslot_time, study_group_id, group_set_id, subject_course_id, type, opt_subject_course_id, professor_id, auditory_id) VALUES (34, 6, 4, 1, NULL, 2, 1, NULL, 1, 1);--8
--INSERT INTO group_pair(study_group_id, assigned_pair_id) VALUES (1, 1);--1
--INSERT INTO group_pair(study_group_id, assigned_pair_id) VALUES (1, 2);--2
--INSERT INTO group_pair(study_group_id, assigned_pair_id) VALUES (2, 2);--3
--INSERT INTO group_pair(study_group_id, assigned_pair_id) VALUES (3, 2);--4
--INSERT INTO group_pair(study_group_id, assigned_pair_id) VALUES (1, 3);--5
--INSERT INTO group_pair(study_group_id, assigned_pair_id) VALUES (2, 3);--6
--INSERT INTO group_pair(study_group_id, assigned_pair_id) VALUES (3, 3);--7
--INSERT INTO group_pair(study_group_id, assigned_pair_id) VALUES (1, 4);--8
--INSERT INTO group_pair(study_group_id, assigned_pair_id) VALUES (2, 4);--9
--INSERT INTO group_pair(study_group_id, assigned_pair_id) VALUES (3, 4);--10
--INSERT INTO group_pair(study_group_id, assigned_pair_id) VALUES (1, 5);--11
--INSERT INTO group_pair(study_group_id, assigned_pair_id) VALUES (2, 5);--12
--INSERT INTO group_pair(study_group_id, assigned_pair_id) VALUES (3, 5);--13
--INSERT INTO group_pair(study_group_id, assigned_pair_id) VALUES (1, 6);--14
--INSERT INTO group_pair(study_group_id, assigned_pair_id) VALUES (2, 6);--15
--INSERT INTO group_pair(study_group_id, assigned_pair_id) VALUES (3, 6);--16
--INSERT INTO group_pair(study_group_id, assigned_pair_id) VALUES (1, 7);--17
--INSERT INTO group_pair(study_group_id, assigned_pair_id) VALUES (2, 7);--18
--INSERT INTO group_pair(study_group_id, assigned_pair_id) VALUES (3, 7);--19
--INSERT INTO group_pair(study_group_id, assigned_pair_id) VALUES (1, 8);--20
INSERT INTO operation(name, operation) VALUES ('больше', '>');--1
INSERT INTO operation(name, operation) VALUES ('меньше', '<');--2
INSERT INTO operation(name, operation) VALUES ('не больше', '<=');--3
INSERT INTO operation(name, operation) VALUES ('не меньше', '>=');--4
INSERT INTO operation(name, operation) VALUES ('равно', '=');--5
INSERT INTO professor_timeslot_resource(professor_id, timeslot) VALUES (1, 11);--1
INSERT INTO professor_timeslot_resource(professor_id, timeslot) VALUES (1, 12);--2
INSERT INTO professor_timeslot_resource(professor_id, timeslot) VALUES (1, 34);--3
INSERT INTO professor_timeslot_resource(professor_id, timeslot) VALUES (2, 5);--4
INSERT INTO professor_timeslot_resource(professor_id, timeslot) VALUES (3, 6);--5
INSERT INTO professor_timeslot_resource(professor_id, timeslot) VALUES (4, 24);--6
INSERT INTO professor_timeslot_resource(professor_id, timeslot) VALUES (5, 11);--7
INSERT INTO professor_timeslot_resource(professor_id, timeslot) VALUES (5, 12);--8
INSERT INTO auditory_resource(auditory_id, timeslot) VALUES (1, 11);--1
INSERT INTO auditory_resource(auditory_id, timeslot) VALUES (1, 12);--2
INSERT INTO auditory_resource(auditory_id, timeslot) VALUES (1, 34);--3
INSERT INTO auditory_resource(auditory_id, timeslot) VALUES (2, 6);--4
INSERT INTO auditory_resource(auditory_id, timeslot) VALUES (2, 24);--5
INSERT INTO auditory_resource(auditory_id, timeslot) VALUES (3, 5);--6
INSERT INTO auditory_resource(auditory_id, timeslot) VALUES (4, 11);--7
INSERT INTO auditory_resource(auditory_id, timeslot) VALUES (4, 12);--8
--1
INSERT INTO factor(name, sql_expression) VALUES ('число окон в неделю',
'WITH parms as (select ? as group_id, ? as opt_choice)
SELECT count(*) FROM timeslot as cur_timeslot
WHERE NOT EXISTS (
SELECT * FROM assigned_pair as cur_pair WHERE
(cur_pair.study_group_id=(SELECT group_id FROM parms)
OR (SELECT group_id FROM parms) IN (SELECT study_group_id from group_set_group
WHERE group_set_group.group_set_id=cur_pair.group_set_id))
AND (opt_subject_course_id IS null OR opt_subject_course_id = ANY ((SELECT opt_choice FROM parms)::int[]))
AND cur_pair.timeslot=cur_timeslot.id AND NOT cur_pair.replacement)
AND EXISTS (SELECT * FROM assigned_pair as prev_pair WHERE
(prev_pair.study_group_id=(SELECT group_id FROM parms)
OR (SELECT group_id FROM parms) IN (SELECT study_group_id from group_set_group
WHERE group_set_group.group_set_id=prev_pair.group_set_id))
AND (opt_subject_course_id IS null OR opt_subject_course_id = ANY ((SELECT opt_choice FROM parms)::int[]))
AND not prev_pair.replacement AND prev_pair.timeslot_day = cur_timeslot.timeslot_day
AND prev_pair.timeslot_time < cur_timeslot.timeslot_time)
AND EXISTS (SELECT * FROM assigned_pair as next_pair WHERE
(next_pair.study_group_id=(SELECT group_id FROM parms)
OR (SELECT group_id FROM parms) IN (SELECT study_group_id from group_set_group
WHERE group_set_group.group_set_id=next_pair.group_set_id))
AND (opt_subject_course_id IS null OR opt_subject_course_id = ANY ((SELECT opt_choice FROM parms)::int[]))
AND not next_pair.replacement AND next_pair.timeslot_day = cur_timeslot.timeslot_day
AND next_pair.timeslot_time > cur_timeslot.timeslot_time);');
--2
INSERT INTO factor(name, sql_expression) VALUES ('максимальное число пар в день',
'WITH parms as (select ? as group_id)
SELECT COALESCE(MAX(pair_count), 0) FROM
(SELECT COUNT(*) AS pair_count FROM assigned_pair WHERE
(study_group_id=(SELECT group_id FROM parms)
OR (SELECT group_id FROM parms) IN (SELECT study_group_id from group_set_group
WHERE group_set_group.group_set_id=assigned_pair.group_set_id))
AND (opt_subject_course_id IS null OR opt_subject_course_id = ANY (?::int[]))
AND NOT replacement
GROUP BY timeslot_day) pair_counts;');
--3
INSERT INTO factor(name, sql_expression) VALUES ('максимальное число пар по курсу в день',
'WITH parms as (select ? as group_id)
SELECT COALESCE(MAX(course_pair_count), 0) FROM
(SELECT COUNT(*) AS course_pair_count FROM assigned_pair WHERE
(study_group_id=(SELECT group_id FROM parms)
OR (SELECT group_id FROM parms) IN (SELECT study_group_id from group_set_group
WHERE group_set_group.group_set_id=assigned_pair.group_set_id))
AND (opt_subject_course_id IS null OR opt_subject_course_id = ANY (?::int[]))
AND NOT replacement
GROUP BY timeslot_day, subject_course_id) course_pair_counts;');
--4
INSERT INTO factor(name, sql_expression) VALUES ('минимальное число пар в день',
'WITH parms as (select ? as group_id)
SELECT COALESCE(MIN(course_pair_count), 0) FROM
(SELECT COUNT(*) AS course_pair_count FROM assigned_pair WHERE
(study_group_id=(SELECT group_id FROM parms)
OR (SELECT group_id FROM parms) IN (SELECT study_group_id from group_set_group
WHERE group_set_group.group_set_id=assigned_pair.group_set_id))
AND (opt_subject_course_id IS null OR opt_subject_course_id = ANY (?::int[]))
AND NOT replacement
GROUP BY timeslot_day) pair_counts;');
--5
INSERT INTO factor(name, sql_expression) VALUES ('максимальное количество окон подряд',
'WITH parms as (select ? as group_id, ? as opt_choice),
pair_window as (SELECT * FROM timeslot as cur_timeslot
WHERE NOT EXISTS (
SELECT * FROM assigned_pair as cur_pair WHERE
(cur_pair.study_group_id=(SELECT group_id FROM parms)
OR (SELECT group_id FROM parms) IN (SELECT study_group_id from group_set_group
WHERE group_set_group.group_set_id=cur_pair.group_set_id))
AND (opt_subject_course_id IS null OR opt_subject_course_id = ANY ((SELECT opt_choice FROM parms)::int[]))
AND cur_pair.timeslot=cur_timeslot.id AND NOT cur_pair.replacement)
AND EXISTS (SELECT * FROM assigned_pair as prev_pair WHERE
(prev_pair.study_group_id=(SELECT group_id FROM parms)
OR (SELECT group_id FROM parms) IN (SELECT study_group_id from group_set_group
WHERE group_set_group.group_set_id=prev_pair.group_set_id))
AND (opt_subject_course_id IS null OR opt_subject_course_id = ANY ((SELECT opt_choice FROM parms)::int[]))
AND not prev_pair.replacement AND prev_pair.timeslot_day = cur_timeslot.timeslot_day
AND prev_pair.timeslot_time < cur_timeslot.timeslot_time)
AND EXISTS (SELECT * FROM assigned_pair as next_pair WHERE
(next_pair.study_group_id=(SELECT group_id FROM parms)
OR (SELECT group_id FROM parms) IN (SELECT study_group_id from group_set_group
WHERE group_set_group.group_set_id=next_pair.group_set_id))
AND (opt_subject_course_id IS null OR opt_subject_course_id = ANY ((SELECT opt_choice FROM parms)::int[]))
AND not next_pair.replacement AND next_pair.timeslot_day = cur_timeslot.timeslot_day
AND next_pair.timeslot_time > cur_timeslot.timeslot_time))
SELECT MAX(seq_pair_windows_count) FROM
(SELECT COUNT(id) as seq_pair_windows_count FROM
(SELECT id, id - ROW_NUMBER() OVER(ORDER BY id) as diff FROM pair_window) win_seq
GROUP BY diff) seq_pair_windows_count');
--6
INSERT INTO factor(name, sql_expression) VALUES ('максимальное количество пар подряд',
'WITH parms as (select ? as group_id, ? as opt_choice),
pair as (SELECT * FROM assigned_pair as pair
WHERE (pair.study_group_id=(SELECT group_id FROM parms)
OR (SELECT group_id FROM parms) IN (SELECT study_group_id from group_set_group
WHERE group_set_group.group_set_id=pair.group_set_id))
AND (opt_subject_course_id IS null OR opt_subject_course_id = ANY ((SELECT opt_choice FROM parms)::int[]))
AND NOT pair.replacement)
SELECT MAX(seq_pair_count) FROM
(SELECT COUNT(timeslotbv, l) as seq_pair_count FROM
(SELECT timeslot, timeslot - ROW_NUMBER() OVER(ORDER BY timeslot) as diff FROM pair) pair_seq
GROUP BY diff) seq_pair_count;');
--7
INSERT INTO factor(name, sql_expression) VALUES ('равномерность нагрузки по количеству пар',
'WITH parms as (select ? as group_id)
SELECT COALESCE(stddev(course_pair_count), 0) FROM
(SELECT COUNT(*) AS course_pair_count FROM assigned_pair WHERE
(study_group_id=(SELECT group_id FROM parms)
OR (SELECT group_id FROM parms) IN (SELECT study_group_id from group_set_group
WHERE group_set_group.group_set_id=assigned_pair.group_set_id))
AND (opt_subject_course_id IS null OR opt_subject_course_id = ANY (?::int[]))
AND NOT replacement
GROUP BY timeslot_day) pair_counts;');
INSERT INTO restriction(name, factor_id, operation_id, restriction_value, hard, priority) VALUES ('Число окон в неделю не должно превышать пяти', 1, 3, 5, FALSE, 3);--1
INSERT INTO restriction(name, factor_id, operation_id, restriction_value, hard, priority) VALUES ('Максимальное число пар в день не должно превышать шести', 2, 3, 6, TRUE, 5);--2
INSERT INTO restriction(name, factor_id, operation_id, restriction_value, hard, priority) VALUES ('Максимальное число пар по курсу в день не должно превышать двух', 3, 3, 2, FALSE, 5);--3
INSERT INTO restriction(name, factor_id, operation_id, restriction_value, hard, priority) VALUES ('ЧИсло окон подряд не должно превышать двух', 5, 3, 2, FALSE, 3);--3
--1
INSERT INTO resource_checking(name, sql_expression) VALUES ('group_timeslot',
'WITH parms as (select ? as group_id)
SELECT timeslot FROM assigned_pair WHERE
(study_group_id=(SELECT group_id FROM parms)
OR (SELECT group_id FROM parms) IN (SELECT study_group_id from group_set_group
WHERE group_set_group.group_set_id=assigned_pair.group_set_id))
AND (opt_subject_course_id IS null OR opt_subject_course_id = ANY (?::int[]))
AND NOT replacement
GROUP BY timeslot, even_week
HAVING COUNT(*) > 1;');
--2
INSERT INTO resource_checking(name, sql_expression) VALUES ('auditory_timeslot',
'SELECT auditory_id, timeslot FROM assigned_pair WHERE
NOT replacement
GROUP BY auditory_id, timeslot, even_week
HAVING COUNT(*) > 1;');
--3
INSERT INTO resource_checking(name, sql_expression) VALUES ('professor_timeslot',
'SELECT professor_id, timeslot FROM assigned_pair WHERE
NOT replacement
GROUP BY professor_id, timeslot, even_week
HAVING COUNT(*) > 1;'); | true |
af201e8be839a4ff9512fdd27f0024f2b9036b66 | SQL | Qchien99/Website-CNPM | /weblaptop (2).sql | UTF-8 | 11,475 | 2.9375 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 4.9.0.1
-- https://www.phpmyadmin.net/
--
-- Máy chủ: 127.0.0.1
-- Thời gian đã tạo: Th5 19, 2021 lúc 08:08 PM
-- Phiên bản máy phục vụ: 10.3.16-MariaDB
-- Phiên bản PHP: 7.3.6
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Cơ sở dữ liệu: `weblaptop`
--
-- --------------------------------------------------------
--
-- Cấu trúc bảng cho bảng `categories`
--
CREATE TABLE `categories` (
`id` bigint(20) UNSIGNED NOT NULL,
`cate_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`parent_id` int(11) NOT NULL DEFAULT 0,
`slug` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
`deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Đang đổ dữ liệu cho bảng `categories`
--
INSERT INTO `categories` (`id`, `cate_name`, `parent_id`, `slug`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, 'Điện Thoại', 0, 'dien-thoai', '2021-05-19 10:07:52', '2021-05-19 10:07:52', NULL),
(2, 'LapTop', 0, 'laptop', '2021-05-19 10:08:02', '2021-05-19 10:08:02', NULL),
(3, 'Phụ Kiện', 0, 'phu-kien', '2021-05-19 10:08:15', '2021-05-19 10:08:15', NULL),
(4, 'Iphone', 1, 'iphone', '2021-05-19 10:08:28', '2021-05-19 10:08:28', NULL),
(5, 'OPPO', 1, 'oppo', '2021-05-19 10:08:43', '2021-05-19 10:08:43', NULL),
(6, 'Iphone 8', 4, 'iphone-8', '2021-05-19 10:08:57', '2021-05-19 10:08:57', NULL),
(7, 'ASUS', 2, 'asus', '2021-05-19 10:09:17', '2021-05-19 10:09:17', NULL),
(8, 'Iphone 8 Plus', 4, 'iphone-8-plus', '2021-05-19 10:09:37', '2021-05-19 10:09:37', NULL),
(9, 'Acer', 2, 'acer', '2021-05-19 10:09:54', '2021-05-19 10:09:54', NULL);
-- --------------------------------------------------------
--
-- Cấu trúc bảng cho bảng `customers`
--
CREATE TABLE `customers` (
`id` int(10) UNSIGNED NOT NULL,
`fullname` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
`email` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`phone` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`password` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`gender` tinyint(3) UNSIGNED NOT NULL,
`address` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Đang đổ dữ liệu cho bảng `customers`
--
INSERT INTO `customers` (`id`, `fullname`, `email`, `phone`, `password`, `gender`, `address`, `created_at`, `updated_at`) VALUES
(1, 'Nguyễn Covid', 'kh01@gmail.com', '0222333666', '$2y$10$ooPG9s1lcwUGYv1nqeyNcO0ccYJf8hlhm5dJXy7xoamvgiczXHB7S', 1, 'Hà Nội', NULL, NULL),
(2, 'Nguyễn Khoảng Cách', 'kh02@gmail.com', '0222333777', '$2y$10$ooPG9s1lcwUGYv1nqeyNcO0ccYJf8hlhm5dJXy7xoamvgiczXHB7S', 2, 'Hà Tây', NULL, NULL),
(3, 'Nguyễn Khẩu Trang', 'kh03@gmail.com', '0222333888', '$2y$10$ooPG9s1lcwUGYv1nqeyNcO0ccYJf8hlhm5dJXy7xoamvgiczXHB7S', 1, 'Hà Đông', NULL, NULL),
(4, 'Nguyễn Khai Báo', 'kh05@gmail.com', '0222333111', '$2y$10$ooPG9s1lcwUGYv1nqeyNcO0ccYJf8hlhm5dJXy7xoamvgiczXHB7S', 1, 'Hà Đông', NULL, NULL),
(5, 'Nguyễn Khử Khuẩn', 'kh06@gmail.com', '0222333222', '$2y$10$ooPG9s1lcwUGYv1nqeyNcO0ccYJf8hlhm5dJXy7xoamvgiczXHB7S', 1, 'Hà Nam', NULL, NULL),
(6, 'Nguyễn Không Tụ Tập', 'kh07@gmail.com', '0222333444', '$2y$10$ooPG9s1lcwUGYv1nqeyNcO0ccYJf8hlhm5dJXy7xoamvgiczXHB7S', 2, 'Hà Bắc', NULL, NULL),
(7, 'Mai Âm Nhạc', 'kh08@gmail.com', '0222333555', '$2y$10$ooPG9s1lcwUGYv1nqeyNcO0ccYJf8hlhm5dJXy7xoamvgiczXHB7S', 2, 'Hà Tĩnh', NULL, NULL);
-- --------------------------------------------------------
--
-- Cấu trúc bảng cho bảng `failed_jobs`
--
CREATE TABLE `failed_jobs` (
`id` bigint(20) UNSIGNED NOT NULL,
`uuid` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`connection` text COLLATE utf8mb4_unicode_ci NOT NULL,
`queue` text COLLATE utf8mb4_unicode_ci NOT NULL,
`payload` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
`exception` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
`failed_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- Cấu trúc bảng cho bảng `migrations`
--
CREATE TABLE `migrations` (
`id` int(10) UNSIGNED NOT NULL,
`migration` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`batch` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Đang đổ dữ liệu cho bảng `migrations`
--
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES
(34, '2014_10_12_000000_create_users_table', 1),
(35, '2014_10_12_100000_create_password_resets_table', 1),
(36, '2019_08_19_000000_create_failed_jobs_table', 1),
(37, '2021_05_11_134531_add_column_deleted_at_table_users', 1),
(38, '2021_05_14_055309_create_categories_table', 1),
(39, '2021_05_14_062445_add_column_deleted_at_table_categories', 1),
(40, '2021_05_15_153040_create_products_table', 1),
(41, '2021_05_18_130547_create_customers_table', 1);
-- --------------------------------------------------------
--
-- Cấu trúc bảng cho bảng `password_resets`
--
CREATE TABLE `password_resets` (
`email` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`token` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- Cấu trúc bảng cho bảng `products`
--
CREATE TABLE `products` (
`id` bigint(20) UNSIGNED NOT NULL,
`name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`code` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`slug` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`image` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`price` decimal(18,2) NOT NULL,
`state` tinyint(4) NOT NULL,
`categories_id` bigint(20) UNSIGNED NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Đang đổ dữ liệu cho bảng `products`
--
INSERT INTO `products` (`id`, `name`, `code`, `slug`, `image`, `price`, `state`, `categories_id`, `created_at`, `updated_at`) VALUES
(1, 'iphonn 8 plus like new', 'sp01', 'iphonn-8-plus-like-new', 'iphonn-8-plus-like-new.PNG', '1500000.00', 1, 6, '2021-05-19 10:11:19', '2021-05-19 10:16:32'),
(2, 'iphone 8 new', 'sp02', 'iphone-8-new', 'iphone-8-new.jpg', '2500000.00', 1, 4, '2021-05-19 10:15:18', '2021-05-19 10:15:18'),
(3, 'Acer gaming', 'sp03', 'acer-gaming', 'acer-gaming.jpg', '1500000000.00', 0, 9, '2021-05-19 10:16:01', '2021-05-19 10:16:01'),
(4, 'tai nghe sony', 'sp04', 'tai-nghe-sony', 'tai-nghe-sony.jpg', '1500000.00', 0, 3, '2021-05-19 10:17:14', '2021-05-19 10:17:14');
-- --------------------------------------------------------
--
-- Cấu trúc bảng cho bảng `users`
--
CREATE TABLE `users` (
`id` int(10) UNSIGNED NOT NULL,
`fullname` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
`password` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`address` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`email` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`phone` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '0395954444',
`level` tinyint(3) UNSIGNED NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
`deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Đang đổ dữ liệu cho bảng `users`
--
INSERT INTO `users` (`id`, `fullname`, `password`, `address`, `email`, `phone`, `level`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, 'admin', '$2y$10$ooPG9s1lcwUGYv1nqeyNcO0ccYJf8hlhm5dJXy7xoamvgiczXHB7S', 'ha noi', 'admin@gmail.com', '0222555444', 2, NULL, NULL, NULL),
(2, 'đào văn hải', '$2y$10$ooPG9s1lcwUGYv1nqeyNcO0ccYJf8hlhm5dJXy7xoamvgiczXHB7S', 'số nhà 17 ngõ 15', 'daovhai0110@gmail.com', '0979133267', 2, '2021-05-19 10:19:02', '2021-05-19 10:20:24', NULL),
(3, 'nhân viên 01', '$2y$10$ooPG9s1lcwUGYv1nqeyNcO0ccYJf8hlhm5dJXy7xoamvgiczXHB7S', 'ho chi minh', 'nv01@gmail.com', '0979133267', 1, '2021-05-19 10:19:41', '2021-05-19 10:19:41', NULL),
(4, 'nhân viên 02', '$2y$10$ooPG9s1lcwUGYv1nqeyNcO0ccYJf8hlhm5dJXy7xoamvgiczXHB7S', 'ho chi minh', 'nv02@gmail.com', '0979133267', 1, '2021-05-19 10:20:12', '2021-05-19 10:20:39', '2021-05-19 10:20:39'),
(5, 'nhân viên 03', '$2y$10$ooPG9s1lcwUGYv1nqeyNcO0ccYJf8hlhm5dJXy7xoamvgiczXHB7S', 'ho chi minh', 'nv03@gmail.com', '0979133267', 1, '2021-05-19 10:21:23', '2021-05-19 10:21:23', NULL),
(6, 'nhân viên 04', '$2y$10$ooPG9s1lcwUGYv1nqeyNcO0ccYJf8hlhm5dJXy7xoamvgiczXHB7S', 'ha tinh', 'nv04@gmail.com', '0979133225', 1, '2021-05-19 10:21:48', '2021-05-19 10:59:00', NULL);
--
-- Chỉ mục cho các bảng đã đổ
--
--
-- Chỉ mục cho bảng `categories`
--
ALTER TABLE `categories`
ADD PRIMARY KEY (`id`);
--
-- Chỉ mục cho bảng `customers`
--
ALTER TABLE `customers`
ADD PRIMARY KEY (`id`);
--
-- Chỉ mục cho bảng `failed_jobs`
--
ALTER TABLE `failed_jobs`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `failed_jobs_uuid_unique` (`uuid`);
--
-- Chỉ mục cho bảng `migrations`
--
ALTER TABLE `migrations`
ADD PRIMARY KEY (`id`);
--
-- Chỉ mục cho bảng `password_resets`
--
ALTER TABLE `password_resets`
ADD KEY `password_resets_email_index` (`email`);
--
-- Chỉ mục cho bảng `products`
--
ALTER TABLE `products`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `products_code_unique` (`code`),
ADD KEY `products_categories_id_foreign` (`categories_id`);
--
-- Chỉ mục cho bảng `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT cho các bảng đã đổ
--
--
-- AUTO_INCREMENT cho bảng `categories`
--
ALTER TABLE `categories`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;
--
-- AUTO_INCREMENT cho bảng `customers`
--
ALTER TABLE `customers`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;
--
-- AUTO_INCREMENT cho bảng `failed_jobs`
--
ALTER TABLE `failed_jobs`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT cho bảng `migrations`
--
ALTER TABLE `migrations`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=42;
--
-- AUTO_INCREMENT cho bảng `products`
--
ALTER TABLE `products`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT cho bảng `users`
--
ALTER TABLE `users`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
--
-- Các ràng buộc cho các bảng đã đổ
--
--
-- Các ràng buộc cho bảng `products`
--
ALTER TABLE `products`
ADD CONSTRAINT `products_categories_id_foreign` FOREIGN KEY (`categories_id`) REFERENCES `categories` (`id`) ON DELETE CASCADE;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true |
ccee2a3731028d579d4cf29e3a669bf7e63c09d4 | SQL | JoinMarketing/laravel-database-encryption | /tests/Database/password_resets.sql | UTF-8 | 354 | 2.625 | 3 | [
"MIT"
] | permissive | CREATE TABLE `password_resets` (
`email` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`token` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
ALTER TABLE `password_resets`
ADD KEY `password_resets_email_index` (`email`);
COMMIT;
| true |
661dbb596174154d8793fd1938ef62a849083af9 | SQL | fabiodamas/erp_desktop | /SQLs/opeerp2.sql | UTF-8 | 1,045 | 2.9375 | 3 | [] | no_license | select Concat(
-- hr.category_employee,category_ids/id
"__export__.hr_employee_",
Convert(Codigo+6,char) ,
"," ,
-- True,active
"True",
",",
-- 089.191.748-90,x_CPF
COALESCE(CPF,""),
",",
-- (14) 9746-3155,mobile_phone
COALESCE(Telefone1,""),
",",
-- 1968-09-02,birthday
DATE_FORMAT(COALESCE(DataNascto,CONVERT("1900-01-01",DATE)), '%Y-%m-%d'),
",",
-- base.main_company,company_id/id
"base.main_company"
",",
-- Married,marital
"Married", -- marital
",",
-- base.br,country_id/id
"base.br", -- marital
",",
-- Brasileira,place_of_birth
"Brasileira",
",",
-- EDSON HENRIQUE CALCIOLARI - 87,name
COALESCE(Nome,""), -- name
",",
-- JAHIR CALCIOLARI,x_NomeMae
COALESCE(NomeMae,""), -- name
",",
-- ARDILIA RUSSO CALCIOLARI,x_NomePai
COALESCE(NomePai,""), -- name
",",
-- 16.828.718-3,x_RG
COALESCE(RG,""),
",",
-- Male, gender;
"Male"
",",
-- "**********PLANO DE SAUDE UNIMED**********, notes
"\"",
COALESCE(Observacao,"")
,
"\"",
",",
-- resource_id/id
"hr.employee_resource_",
Convert(Codigo+6,char)
) from funcionarios ;
select COUNT(*) from funcionarios
| true |
e0e6f9e3a7c550462d261f98e2be439e29fe921a | SQL | yilin6867/pinkyNailOrder | /src/sql/ORDER.sql | UTF-8 | 722 | 3.4375 | 3 | [] | no_license | DROP TABLE IF EXISTS ORDERS;
CREATE TABLE ORDERS
(
ORDER_ID INT,
SERVICE_ID VARCHAR(4),
CUST_ID INT,
EMP_ID VARCHAR(4),
APPO_ID INT,
TRANS_ID INT,
PRICE DECIMAL(5,2)
);
ALTER TABLE ORDERS ADD CONSTRAINT PK_ORDER PRIMARY KEY(ORDER_ID);
ALTER TABLE ORDERS ADD CONSTRAINT FK_CONSUMER FOREIGN KEY(CUST_ID) REFERENCES CUSTOMER(CUST_ID);
ALTER TABLE ORDERS ADD CONSTRAINT FK_SERVICE FOREIGN KEY(SERVICE_ID) REFERENCES SERVICE(ID);
ALTER TABLE ORDERS ADD CONSTRAINT FK_EMP_WORK FOREIGN KEY(EMP_ID) REFERENCES EMPLOYEE(EMP_ID);
ALTER TABLE ORDERS ADD CONSTRAINT FK_APPO FOREIGN KEY(APPO_ID) REFERENCES CUST_APPOINTMENT(APPO_ID);
ALTER TABLE ORDERS ADD CONSTRAINT FK_TRANS FOREIGN KEY(TRANS_ID) REFERENCES TRANSACTIONS(TRANS_ID);
| true |
0a351ca58e426edf4f8a95fc0090bf09c297b692 | SQL | solonvavasis/drivehub | /database.sql | UTF-8 | 16,753 | 2.828125 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 4.6.6
-- https://www.phpmyadmin.net/
--
-- Host: db21.papaki.gr:3306
-- Generation Time: Feb 28, 2017 at 12:16 AM
-- Server version: 10.1.18-MariaDB
-- PHP Version: 5.6.27
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: `solonvav_drivehub`
--
CREATE DATABASE IF NOT EXISTS `solonvav_drivehub` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
USE `solonvav_drivehub`;
-- --------------------------------------------------------
--
-- Table structure for table `cars`
--
CREATE TABLE `cars` (
`ID` int(11) NOT NULL,
`car_id` int(11) NOT NULL,
`car_cc` varchar(255) NOT NULL,
`car_brand` varchar(255) NOT NULL,
`car_price` varchar(255) NOT NULL,
`car_description` varchar(255) NOT NULL,
`car_town` varchar(255) NOT NULL,
`car_address` varchar(255) NOT NULL,
`image` varchar(255) NOT NULL,
`booking_count` int(255) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `cars`
--
INSERT INTO `cars` (`ID`, `car_id`, `car_cc`, `car_brand`, `car_price`, `car_description`, `car_town`, `car_address`, `image`, `booking_count`) VALUES
(27, 35, '1600', 'seat', '25', 'awesome car', 'Athens', 'Glifada', 'Seat_Altea_front_20090919.jpg', 1),
(28, 36, '1400', 'opel', '25', 'awesome car\r\n', 'Athens', 'Sintagma', 'opel-06.jpg', 2),
(29, 37, '1200', 'Seat', '30', 'This is a seat', 'Athens', 'Glifada', 'seat_ibiza_1_6_tdi_cr_105_hp_dpf_style_large_30008.jpg', 8),
(30, 38, '1400', 'mercedes', '30', 'awesome car', 'Athens', 'Peristeri', 'mercedes.jpg', 13),
(31, 39, '1800', 'BMW', '40', 'awesome car', 'Athens', 'Koropi', '2015bmwm235i-012.jpg', 0),
(32, 40, '1800', 'BMW', '45', 'awesome car', 'Athens', 'Xalandri', 'bmw.JPG', 1),
(33, 41, '1800', 'bmw', '45', 'awesome car', 'Athens', 'Marousi', 'bmw_awesome.JPG', 0),
(34, 42, '1600', 'fiat', '50', 'not an awesome car', 'Athens', 'Piraias', 'Fiat_Idea_front_20071102.jpg', 0),
(35, 44, '1600', 'mercendes', '80', 'Toumpano autokinito', 'Athens', 'Xalandri', '00-Mercedes-Benz-Vehicles-C-Class-C-63-Coupe-AMG-1180x559.jpg', 1),
(36, 45, '1600', 'Opel', '40', 'Awesome car', 'Athens', 'Kifisia', 'Seat_Altea_front_20090919.jpg', 0),
(37, 47, '2000', 'VOLVO', '90', 'This is a Volvo', 'Xania', 'Xania', '2015-volvo-s60-polestar-fd.jpg', 0),
(38, 48, '1600', 'Audi', '65', 'This is an Audi', 'Xania', 'Xania', 'Audi-RS7-Sportback_2758091b.jpg', 0),
(39, 50, '1400`', 'unknown', '30', 'awesome car\r\n', 'Athens', 'Agios Stefanos', 'Fiat_Seicento_front_20080127.jpg', 2),
(40, 55, '1234', 'Toyota', '12', 'This is a toyota', 'Athens', 'Agios Stefanos', '2015_toyota_camry_sedan_xle_fq_oem_3_717.jpg', 0),
(41, 56, '1234', 'Awesome', '23', 'Awesome', 'Lamia', 'Lamia', '8224973Lancia_Delta_III_20090620_front.JPG', 0),
(42, 58, '1400', 'Awesome', '23', 'Awesome car', 'Korinthos', 'Korinthos', 'fiat500.jpg', 0),
(43, 59, '1444', 'awesome', '23', 'awesome', 'Korinthos', 'Korinthos', 'Lancia_Hyena_CENTENARY.jpg', 0),
(44, 60, '1500', 'Audi', '35', 'Audi 80 turbo', 'Volos', 'Volos', 'audi.png', 0),
(45, 31, '999', 'Toyoda', '99', 'The best car that uses the force to increase horsepower from 50 to 100', 'Sparti', 'Sparti', '81Z4x5+Ay7L._SL1500_.jpg', 0),
(46, 65, '1200', 'Audi', '50', 'Great car', 'Korinthos', 'Korinthos', 'buyers_guide_-_audi_a5_cabrio_2014_-_front_quarter.jpg', 1);
-- --------------------------------------------------------
--
-- Table structure for table `locations`
--
CREATE TABLE `locations` (
`location_id` int(11) NOT NULL,
`location_town` varchar(255) NOT NULL,
`location_address` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `locations`
--
INSERT INTO `locations` (`location_id`, `location_town`, `location_address`) VALUES
(1, 'Athens', 'Glifada'),
(2, 'Athens', 'Sintagma'),
(3, 'Athens', 'Peristeri'),
(4, 'Athens', 'Koropi'),
(5, 'Athens', 'Xalandri'),
(6, 'Athens', 'Marousi'),
(7, 'Athens', 'Piraias'),
(8, 'Athens', 'Kifisia'),
(9, 'Athens', 'Agios Stefanos'),
(10, 'Lamia', 'Lamia'),
(11, 'Korinthos', 'Korinthos'),
(12, 'Thiva', 'Thiva'),
(13, 'Volos', 'Volos'),
(14, 'Karditsa', 'Karditsa'),
(15, 'Trikala', 'Trikala'),
(16, 'Larisa', 'Larisa'),
(17, 'Ioannina', 'Ioannina'),
(18, 'Arta', 'Arta'),
(19, 'Kastoria', 'Kastoria'),
(20, 'Thessaloniki', 'Leukos Pyrgos'),
(21, 'Thessaloniki', 'Toumpa'),
(22, 'Thessaloniki', 'Valaori'),
(23, 'Kavala', 'Kavala'),
(24, 'Alexandroupoli', 'Alexandroupoli'),
(25, 'Agrinio', 'Agrinio'),
(26, 'Tripoli', 'Tripoli'),
(27, 'Kalamata', 'Kalamata'),
(28, 'Pirgos', 'Pirgos'),
(29, 'Sparti', 'Sparti'),
(30, 'Xania', 'Xania'),
(31, 'Rethimno', 'test address 31'),
(32, 'Hrakleio', 'test address 32');
-- --------------------------------------------------------
--
-- Table structure for table `testdate`
--
CREATE TABLE `testdate` (
`ID` int(11) NOT NULL,
`date_id` int(11) NOT NULL,
`blocked_dates` date NOT NULL,
`is_owner` int(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `testdate`
--
INSERT INTO `testdate` (`ID`, `date_id`, `blocked_dates`, `is_owner`) VALUES
(178, 36, '2016-03-15', 0),
(179, 36, '2016-03-16', 0),
(180, 36, '2016-03-17', 0),
(181, 36, '2016-03-18', 0),
(182, 36, '2016-03-19', 0),
(183, 44, '2016-03-18', 1),
(184, 44, '2016-03-19', 1),
(185, 37, '2016-03-16', 1),
(186, 37, '2016-03-17', 1),
(187, 44, '2016-03-21', 0),
(188, 44, '2016-03-22', 0),
(189, 40, '2016-03-17', 0),
(190, 40, '2016-03-18', 0),
(191, 40, '2016-03-19', 0),
(192, 40, '2016-03-20', 0),
(193, 40, '2016-03-21', 0),
(194, 40, '2016-03-22', 0),
(195, 40, '2016-03-23', 0),
(196, 40, '2016-03-24', 0),
(197, 38, '2016-03-17', 0),
(198, 38, '2016-03-18', 0),
(199, 38, '2016-03-19', 0),
(200, 38, '2016-03-20', 0),
(201, 38, '2016-03-21', 0),
(202, 38, '2016-03-22', 0),
(203, 38, '2016-03-23', 0),
(204, 38, '2016-03-24', 0),
(205, 38, '2016-03-25', 0),
(206, 38, '2016-03-26', 0),
(207, 38, '2016-03-27', 0),
(208, 38, '2016-03-28', 0),
(209, 38, '2016-03-29', 0),
(210, 38, '2016-03-30', 0),
(211, 38, '2016-03-31', 0),
(212, 50, '2016-03-22', 0),
(213, 50, '2016-03-23', 0),
(214, 38, '2016-04-06', 0),
(215, 38, '2016-04-07', 0),
(216, 38, '1970-01-01', 0),
(217, 38, '2016-04-13', 0),
(218, 38, '2016-04-14', 0),
(219, 38, '2016-04-15', 0),
(220, 38, '2016-04-16', 0),
(221, 38, '2016-04-17', 0),
(222, 38, '2016-04-18', 0),
(223, 38, '2016-04-19', 0),
(224, 38, '2016-04-20', 0),
(225, 38, '2016-04-21', 0),
(226, 38, '2016-04-22', 0),
(227, 59, '2016-04-01', 1),
(228, 59, '2016-04-02', 1),
(229, 38, '2016-04-29', 0),
(230, 38, '2016-04-30', 0),
(240, 37, '2016-04-06', 0),
(241, 37, '2016-04-07', 0),
(242, 37, '2016-04-08', 0),
(243, 37, '2016-04-09', 0),
(260, 31, '2016-04-07', 1),
(261, 31, '2016-04-08', 1),
(262, 31, '2016-04-09', 1),
(263, 31, '2016-04-10', 1),
(264, 31, '2016-04-11', 1),
(265, 31, '2016-04-12', 1),
(266, 31, '2016-04-13', 1),
(267, 31, '2016-04-14', 1),
(268, 31, '2016-04-15', 1),
(269, 31, '2016-04-16', 1),
(270, 37, '2016-04-19', 0),
(271, 37, '2016-04-20', 0),
(272, 37, '2016-04-21', 0),
(273, 37, '2016-04-22', 0),
(274, 37, '2016-04-25', 0),
(275, 37, '2016-04-26', 0),
(276, 37, '2016-04-27', 0),
(277, 37, '2016-05-10', 0),
(278, 37, '2016-05-11', 0),
(279, 37, '2016-05-12', 0),
(280, 37, '2016-05-18', 0),
(281, 37, '2016-05-19', 0),
(282, 37, '2016-05-20', 0),
(283, 37, '2016-05-21', 0),
(284, 37, '2016-06-01', 0),
(285, 37, '2016-06-02', 0),
(286, 37, '2016-06-03', 0),
(287, 37, '2016-06-04', 0),
(288, 38, '2016-04-24', 0),
(289, 38, '2016-04-25', 0),
(290, 38, '2016-04-26', 0),
(291, 38, '2016-04-27', 0),
(292, 38, '2016-04-28', 0),
(293, 35, '2016-04-26', 0),
(294, 35, '2016-04-27', 0),
(295, 35, '2016-04-28', 0),
(296, 35, '2016-04-29', 0),
(297, 37, '2016-09-28', 0),
(298, 37, '2016-09-29', 0),
(299, 37, '2016-09-30', 0),
(300, 37, '2016-12-14', 1),
(301, 37, '2016-12-15', 1),
(302, 37, '2016-12-16', 1),
(303, 37, '2016-12-17', 1),
(304, 37, '2016-12-18', 0),
(305, 37, '2016-12-19', 0),
(306, 37, '2016-12-20', 0),
(307, 38, '2017-02-07', 0),
(308, 38, '2017-02-08', 0),
(309, 38, '2017-02-09', 0),
(310, 38, '2017-02-10', 0),
(311, 38, '2017-02-11', 0),
(312, 38, '2017-02-12', 0),
(313, 38, '2017-02-13', 0),
(314, 65, '2017-02-27', 0),
(315, 65, '2017-02-28', 0);
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
CREATE TABLE `users` (
`id` int(11) NOT NULL,
`username` varchar(255) NOT NULL,
`first_name` varchar(255) NOT NULL,
`last_name` varchar(255) NOT NULL,
`password` varchar(255) NOT NULL,
`email` varchar(255) NOT NULL,
`phone` int(11) NOT NULL,
`address` varchar(255) NOT NULL,
`status` int(11) NOT NULL,
`user_lvl` varchar(255) NOT NULL,
`image` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `users`
--
INSERT INTO `users` (`id`, `username`, `first_name`, `last_name`, `password`, `email`, `phone`, `address`, `status`, `user_lvl`, `image`) VALUES
(31, 'aioannidis', 'Apostolos', 'Ioannidis', '$2y$10$lKs/DpV.b6B2yxBjBh/CP.mqfpAWsQhm/KX1A8iK1uJrk1uQ7suHa', 'a.ioannidis@sae.edu', 2103217661, 'Korai 2 Moschato', 1460017820, 'full', '81Z4x5+Ay7L._SL1500_.jpg'),
(35, 'john', 'john', 'john', '$2y$10$p81h.CRqI.HGgkUE8e7Wgea3oM6XT0APAoyW0vK2KlccJnjvi.Q1q', 'john@gmail.com', 2147483647, 'john 32', 1457808704, 'full', 'Seat_Altea_front_20090919.jpg'),
(36, 'johnny', 'johnny', 'johnny', '$2y$10$Ayqj8TJoXn.g3fVJVb.t1uf500t5v.t1dYTTqAx0tMpEAt6Uxh.yq', 'johnny@gmail.com', 473259823, 'johnny 23', 1457810734, 'full', 'mercedes.jpg'),
(37, 'solon', 'solon', 'vavasis', '$2y$10$1fIhkW7wm1bn.cA9JYA.CO4XfyGq45BapyN8MinhXcU6CSBBhMpWy', 'vavasol1987@gmail.com', 123456, 'Agias Triados 9', 1481595893, 'full', 'seat_ibiza_1_6_tdi_cr_105_hp_dpf_style_large_30008.jpg'),
(38, 'kostas', 'kostas', 'kostas', '$2y$10$/FvfrNg/lLyEIebgraXN0.sQImVepeYzQc.JHrpxO5OuWKp1VxR1i', 'kostas@gmail.com', 2147483647, 'kostas 35', 1457810247, 'full', 'mercedes.jpg'),
(39, 'lakis', 'lakis', 'lakis', '$2y$10$fKt2WLe2dNhaLprlf37ExeOQa0SQelkds2GQ9Aiv6co3ITi.8IVBG', 'lakis@gmail.com', 2147483647, 'lakis 67', 1457810864, 'full', '2015bmwm235i-012.jpg'),
(40, 'loulis', 'loulis', 'loulis', '$2y$10$ko1QzwaqsxEs.M.vrr2TS.vEIT8qio7VJ2UM/F18bwTTLGPA3mt5q', 'loulis@gmail.com', 23525245, 'loulis 23', 1457810970, 'full', 'bmw.JPG'),
(41, 'kosths', 'kosths', 'kosths', '$2y$10$IjJVaeh3UmlYccOAvbRnZeGjur5jM1S.QaJFIl8.a533QGcdVN9Qm', 'kosths@gmail.com', 234324324, 'kosths 34', 1457811240, 'full', 'bmw_awesome.JPG'),
(42, 'solonas', 'solonas', 'solonas', '$2y$10$HSlt8cG0eFwocmloZP1uSeXMLg0.0gAknFbdTqNUlQCW7OS2.4jtO', 'solonas@gmail.com', 2147483647, 'solonas 69', 1458059287, 'full', 'Fiat_Idea_front_20071102.jpg'),
(43, 'akis', 'akis', 'akis', '$2y$10$ah4XMSyXZPSjRRkMs/C2o.AXSoItlQ1LJNtQ95.gr8bJjicG0TPYO', 'akis@gmail.com', 343423432, 'akis 29', 1457812195, 'simple', 'opel_astra.JPG'),
(44, 'xakaitetoia', 'anastasios', 'dados', '$2y$10$aULpg1yKzZSPhilbs0Mbu.gMmuRRiogQ296JnZL.rc6yiyVU3LqFi', 'tdados@hotmail.com', 2101234092, 'attikhs 1', 1457882601, 'full', '00-Mercedes-Benz-Vehicles-C-Class-C-63-Coupe-AMG-1180x559.jpg'),
(45, 'teo', 'teo', 'teo', '$2y$10$j2qjKrEZOHYGSf.ah/7JnurcIE0xtWT5.RfHadQZP6fU.b2jdKxC6', 'teo@gmail.com', 2147483647, 'teo 34', 1458059314, 'full', 'Seat_Altea_front_20090919.jpg'),
(46, 'mastro', 'mastro', 'mastro', '$2y$10$3K/B5rjNZzBH3cotdlTd4ufZWrerZvVm7kQZJTnUQVFAa7xjvL1n2', 'mastro@gmail.com', 45098458, 'mastro 54', 1458060312, 'simple', ''),
(47, 'testuser1', 'Giwrgos', 'Georgiou', '$2y$10$wH1hd7//NxX3Z0t2lkSssuPPVl.gQkauggB3g/P43ffV07Psx1pN.', 'testuser1@mail.com', 2147483647, 'Random Address 1', 1458169825, 'full', '2015-volvo-s60-polestar-fd.jpg'),
(48, 'testuser2', 'Panos', 'Panopoulos', '$2y$10$Pe4YmCWke9wGIVw6SzNaPeXxkDRU2uFfYJ67Mf7S2N6iyfQjHr4fG', 'testuser2@mail.com', 2147483647, 'Random Address 2', 1458170340, 'full', 'Audi-RS7-Sportback_2758091b.jpg'),
(49, 'maestros', 'maestros', 'maestros', '$2y$10$Z/.Xyou954ciRKfu1fcDF.pMI4fVZEM2hCBE2IeQp1.uX6U3aSnJe', 'maestros@gmail.com', 3423423, 'maestros 43', 1458243538, 'simple', ''),
(50, 'makis', 'makis', 'makis', '$2y$10$B/3XHXnFzODifqglUH436.mo1hHC5IPWbVLQPmdAiRriz/nXAFntG', 'makis@gmail.com', 2147483647, 'makis 43', 1458240944, 'full', 'Fiat_Seicento_front_20080127.jpg'),
(51, 'nikos', 'nikos', 'nikos', '$2y$10$e3orICm2/hiZ982m8BkfAelseJKg7rS1B0HCtMHnukWAm5CX8pMLS', 'nikos.kal@outlook.com', 2147483647, 'filadelfeias 9', 1458242231, 'simple', ''),
(52, 'ΞΑÎΘΟΥΛΑ', 'ΞΑÎΘΟΥΛΑ', 'ΜΑÎΔΑΛΙΑ', '$2y$10$8nUUcqGVIBXwg8WvstBO0OfU9eL.fw1nB2Man8DskRL2wYKmtUnRK', 'xanth_mand@hotmail.com', 2147483647, 'ATHENS', 1458243790, 'simple', ''),
(53, 'Adamantia', 'Adamantia', 'Petropoulou', '$2y$10$t9ZRHFDcUgfuOLsQnpfDDOcCva91xzL7kegb6ySgHbb7fmT.yX8Xm', 'adamadia77@outlook.com', 2147483647, 'Kudwniwn 24', 1458245479, 'simple', ''),
(54, 'testioannidis', 'Test', 'Testidis', '$2y$10$hFyOWU1LrCQi3CHCFaHQeuo/4zuFD7J6iIxM59NMUXfiX8/hDFsoW', 'apo@web4u.gr', 2147483647, 'Korai 2 Moschato', 1458575322, 'simple', ''),
(55, 'newtestuser34', 'newtestuser34', 'newtestuser34', '$2y$10$L8PHe1Wmvgd5I7rLIr.IuuWCYgXh7IsP6ZkIqBwXXesB4G9OFG7t.', 'newtestuser34@mail.com', 2147483647, 'newtestuser34 123', 1458757317, 'full', '2015_toyota_camry_sedan_xle_fq_oem_3_717.jpg'),
(56, 'Nick', 'Nick', 'Nick', '$2y$10$k.KwEUHUlPNt4lf/c2DdWedQ1Yvrdv78PCHYXZ871dInKZKgUtHEu', 'Nick@gmail.com', 32434324, 'Nick 43', 1459035647, 'full', '8224973Lancia_Delta_III_20090620_front.JPG'),
(57, 'JJ', 'JJ', 'JJ', '$2y$10$qD2G28ViESb/5pWsngp5sen2D/bsADoQqtc6hVmba9ID5ExC1DfKe', 'JJ@gmail.com', 23423423, 'JJ 43', 1459039623, 'simple', ''),
(58, 'lou', 'lou', 'lou', '$2y$10$icM3jHqkO2PDCWTbqCqI4.A1zogSYTNIhkxqHpvn/3NubUOMwmy/m', 'lou@gmail.com', 34343432, 'lou 43', 1459100843, 'full', 'fiat500.jpg'),
(59, 'zizou', 'zizou', 'zizou', '$2y$10$t0loW4kdxwAKunRFeJjZlu7IQumThbXugN2ijM7ml0rBBA5D3/4XK', 'zizou@gmail.com', 2147483647, 'zizou 43', 1459103196, 'full', 'Lancia_Hyena_CENTENARY.jpg'),
(60, 'Stava', 'Stavros', 'Vavasis', '$2y$10$lrvrrWm001FD6wQ.kLgpu.ULmuSvBC4CIv9S1RGnrIOrLB5PdpSU2', 'stavros.vavasis@gmail.com', 2147483647, '52 witham house', 1459369589, 'full', 'audi.png'),
(61, 'solon2', 'solon2', 'solon2', '$2y$10$cUKtjIW4MY.JXo8zOz3BUeAUPjbBoDm7lkv04xgdsdQttR0da5H0y', 'vavasol1987@gmail.com', 2147483647, 'otinanai', 1460132991, 'simple', ''),
(62, 'mc', 'mc', 'mc', '$2y$10$ADmV/6OhAQFl7DPXb/VggeyB4NHDtADTVPAQSCpo0eKMHJM.7veDu', 'mc@gmail.com', 2147483647, 'mc 33', 1460136758, 'simple', ''),
(63, 'pac', 'pac', 'pac', '$2y$10$pshdiAofbiNuA.AzQo68eeBqKyduGQWUlpELXD9iENe9k/Lnw0h7K', 'pac@gmail.com', 2147483647, 'pac 33', 1460137081, 'simple', ''),
(64, 'stavacore', 'stava', 'core', '$2y$10$6eHNJtu774wHAjqcRmLcVetMK/UPpqgofJQC196I.ykZmLULtuSJy', 'stavros.vavasis@axsmarine.com', 2147483647, 'Kapou sthn Agglia', 1475089019, 'simple', ''),
(65, 'solonnew', 'solonnew', 'vavasisnew', '$2y$10$Q1m/fI7/Fd3KnHm5QaIPTOk0SASfvDLOQfufc6QTEWl7H32ZwoMDK', 'solon.vavasis@gmail.com', 2109875467, 'Somewhere', 1480355223, 'full', 'buyers_guide_-_audi_a5_cabrio_2014_-_front_quarter.jpg'),
(66, '11test', 'testman', 'testmanâ‚23', '$2y$10$2k75b60yuJ0YyK1QNrdayevX9iizdlmfzoj0prHELXaMQ3fKz1NDG', 'info@firmavabaks.ee', 2147483647, 'asfasf', 1486385530, 'simple', ''),
(67, 'martentesting', 'marten', 'testing', '$2y$10$JUOH39g95heEqrLKry7aS.lX9.fpCw8KpaavmZB00GQDgZvjnNZ0C', 'marten@closet.ee', 123456789, 'testing', 1488208853, 'simple', '');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `cars`
--
ALTER TABLE `cars`
ADD PRIMARY KEY (`ID`);
--
-- Indexes for table `drops`
--
ALTER TABLE `drops`
ADD PRIMARY KEY (`ID`);
--
-- Indexes for table `locations`
--
ALTER TABLE `locations`
ADD PRIMARY KEY (`location_id`);
--
-- Indexes for table `testdate`
--
ALTER TABLE `testdate`
ADD PRIMARY KEY (`ID`);
--
-- Indexes for table `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `cars`
--
ALTER TABLE `cars`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=47;
--
-- AUTO_INCREMENT for table `drops`
--
ALTER TABLE `drops`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `locations`
--
ALTER TABLE `locations`
MODIFY `location_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=33;
--
-- AUTO_INCREMENT for table `testdate`
--
ALTER TABLE `testdate`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=316;
--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=68;
/*!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 */;
| true |
a43fb21d87cb428de8cbaa2b4895699bf0af2d01 | SQL | cgesgin/fast_food_restoran_veritabani_projesi | /sql-kodlar/06_view.sql | UTF-8 | 3,427 | 4.4375 | 4 | [] | no_license | --View işlemleri
-----------------------------------------------------------------------------------------------
--1.View
--personellerin ad ,soyad ve maas bilgileri ile birlikte hangi subede calıstıklarını düşük maastan yüksek maas göre ve subelerin hangi adreste bulundukları listeleyen view
create view vw_personel_sube
as
select p.ad,
p.soyad,
p.maas,
sube.sube_ad,
sube.telefon ,
adres.adres_id
from personel p
inner join sube on sube.sube_id=p.personel_id
inner join adres on adres.adres_id=sube.sube_id
order by p.maas ;
-----------------------------------------------------------------------------------------------
--view silme
--drop view vw_personel_sube;
-----------------------------------------------------------------------------------------------
--2.View
--Müsterilerin fatura bilgilerini ve hangi personel tarafindan yapıldıgını ve nakit yada kart şeklinde ödeme yapanların
--tutarlarına göre sağladıgı kazanç oranını listeleyen view'dir.
create view vw_fatura_musteri_personel
as
select
fatura.odenecek_tutar as tutar,
fatura.ödeme_türü as ödeme,
CASE
WHEN fatura.odenecek_tutar >0 and fatura.odenecek_tutar<=100 THEN 'düşük kazanç'
WHEN fatura.odenecek_tutar >100 and fatura.odenecek_tutar<500 THEN 'iyi kazanç'
WHEN fatura.odenecek_tutar >500 THEN 'mükemmel kazanç'
END AS kazaç,
personel.ad as personelAd,
personel.soyad as personelSoyad,
musteri.ad as musteriAd,
musteri.soyad as musteriSoyad
from fatura
inner join personel on personel.personel_id=fatura.personel_id
inner join musteri on musteri.musteri_id=fatura.musteri_id
where fatura.ödeme_türü='nakit' or fatura.ödeme_türü='kart'
order by fatura.odenecek_tutar;
-----------------------------------------------------------------------------------------------
--3.View
--personel tablosunda cinsiyetleri sayan view
create view vw_cinsiyet
as
SELECT
SUM(CASE cinsiyet WHEN 'erkek' THEN 1 ELSE 0 END) "Erkek",
SUM(CASE cinsiyet WHEN 'kadın' THEN 1 ELSE 0 END) "Kadın"
FROM personel;
-----------------------------------------------------------------------------------------------
--4.View
update personel set unvan_id=1 where unvan_id is null;
create view vw_personel_unvan_sube
as
select
p.ad as personelAd,
p.soyad as personelSoyad,
s.sube_ad,
case
when p.unvan_id=1
then 'Kasiyer'
when p.unvan_id=2
then 'Asçı'
when p.unvan_id=3
then 'Aşcı yardımcısı'
when p.unvan_id=4
then 'Temizlik elemanı'
when p.unvan_id>4
then 'Diğer'
End as Pozisyon
from personel as p
inner join unvan as u on u.unvan_id=p.unvan_id
inner join sube as s on s.sube_id=p.sube_id
order by p.ad ;
-----------------------------------------------------------------------------------------------
--5.View
create view vw_personel_unvan
as
select
p.ad as personelAd,
p.soyad as personelSoyad,
case
when p.unvan_id=1
then 'Kasiyer'
when p.unvan_id=2
then 'Asçı'
when p.unvan_id=3
then 'Aşcı yardımcısı'
when p.unvan_id=4
then 'Temizlik elemanı'
when p.unvan_id>4
then 'Diğer'
End as Pozisyon
from personel as p
inner join unvan as u on u.unvan_id=p.unvan_id
order by p.ad ;
-----------------------------------------------------------------------------------------------
| true |
dcc2a7c35cee686b4eec31bca4e25dec22c04117 | SQL | HSuzu/Undrgrad-Databases | /Q5.sql | UTF-8 | 503 | 3.640625 | 4 | [] | no_license | with brs(Forename, Surname, driverId) as (
select Forename, Surname, driverId from Driver where Nationality = 'Brazilian'
), lastLapForRace(rId, lap) as (
select distinct raceId as rId, max(lap) from lapTimes group by raceId
), winnerForRace(raceId, driverId) as (
select raceId, driverId from lapTimes, lastLapforRace where (raceId = rId AND laptimes.lap = lastLapforRace.lap) AND position = '1'
) select Distinct Forename, Surname from brs, winnerForRace where brs.driverId = winnerForRace.driverId | true |
5c0dbd10eab3d28b7eb95c8e13e548f5a75b95d3 | SQL | dlinde7/Gameing-Events-Database | /DDL/getParicipantsFunc.sql | UTF-8 | 242 | 3.671875 | 4 | [] | no_license | CREATE FUNCTION getParticipants (@EventId bigint)
RETURNS TABLE
AS
RETURN
SELECT b.Name Event, c.Name TeamName
From EventRegistrations a, Events b, Teams c
WHERE b.EventId=a.EventId
AND c.TeamId=a.TeamId
AND a.EventId = @EventId | true |
5831eb57f34500ee9ee33bb632940cb7220549ce | SQL | yifeng2019uwb/DataCampAndCodePractice | /Data-Analyst-with-SQL-Server/04-Time-Series-Analysis-in-SQL-Server/04-Time-Series-Questions/15-Complete-the-fraud-analysis.sql | UTF-8 | 1,126 | 3.734375 | 4 | [] | no_license | /*
Complete the fraud analysis
So far, we have broken out day spa data into a stream of entrances and exits and ordered this stream chronologically. This stream contains two critical fields, StartOrdinal and StartOrEndOrdinal. StartOrdinal is the chronological ordering of all entrances. StartOrEndOrdinal contains all entrances and exits in order. Armed with these two pieces of information, we can find the maximum number of concurrent visits.
The results from the prior exercise are now in a temporary table called #StartStopOrder.
*/
/*
Fill out the HAVING clause to determine cases with more than 2 concurrent visitors.
Fill out the ORDER BY clause to show management the worst offenders: those with the highest values for MaxConcurrentCustomerVisits.
*/
SELECT s.*,
-- Build a stream of all check-in and check-out events
ROW_NUMBER() OVER (
-- Break this out by customer ID
PARTITION BY s.CustomerID
-- Order by event time and then the start ordinal
-- value (in case of exact time matches)
ORDER BY s.TimeUTC, s.StartOrdinal
) AS StartOrEndOrdinal
FROM #StartStopPoints s;
| true |
2332962ca0e75ba9e49c15866c1b184b36db8589 | SQL | nicolasreymond/kata-manga-1 | /import/data/init/constraints.sql | UTF-8 | 946 | 2.9375 | 3 | [] | no_license | --
-- Add the relevants constraints
--
ALTER TABLE `classify`
ADD CONSTRAINT `fk_classify_genre` FOREIGN KEY (`idgenre`) REFERENCES `genre` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
ADD CONSTRAINT `fk_classify_manga` FOREIGN KEY (`idmanga`) REFERENCES `manga` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
ALTER TABLE `publish`
ADD CONSTRAINT `fk_publish_magazine` FOREIGN KEY (`idmagazine`) REFERENCES `magazine` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
ADD CONSTRAINT `fk_publish_manga` FOREIGN KEY (`idmanga`) REFERENCES `manga` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
ALTER TABLE `write`
ADD CONSTRAINT `fk_write_author` FOREIGN KEY (`idauthor`) REFERENCES `author` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
ADD CONSTRAINT `fk_write_manga` FOREIGN KEY (`idmanga`) REFERENCES `manga` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
SET session SQL_MODE=default; -- Restore the SQL_MODE to default
| true |
f80406d61e80c0f8ebd76fc06a983a3c5b9205dc | SQL | swarup16/eLaundry-System | /src/main/sql/create.sql | UTF-8 | 5,090 | 3.234375 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 4.2.7.1
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: Dec 18, 2014 at 11:42 AM
-- Server version: 5.6.20
-- PHP Version: 5.5.15
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: `laundry_system`
--
-- --------------------------------------------------------
--
-- Table structure for table `address`
--
CREATE TABLE IF NOT EXISTS `address` (
`id` int(11) NOT NULL,
`city` varchar(255) DEFAULT NULL,
`state` varchar(255) DEFAULT NULL,
`street` varchar(255) DEFAULT NULL,
`zipCode` varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=18 ;
-- --------------------------------------------------------
--
-- Table structure for table `customer`
--
CREATE TABLE IF NOT EXISTS `customer` (
`id` int(11) NOT NULL,
`firstName` varchar(50) NOT NULL,
`middleName` varchar(50) DEFAULT NULL,
`lastName` varchar(50) NOT NULL,
`dateOfBirth` varchar(20) NOT NULL,
`email` varchar(50) NOT NULL,
`phone` varchar(20) NOT NULL,
`gender` varchar(10) NOT NULL,
`address_id` int(11) NOT NULL,
`users_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=16 ;
-- --------------------------------------------------------
--
-- Table structure for table `laundryitem`
--
CREATE TABLE IF NOT EXISTS `laundryitem` (
`item_id` int(11) NOT NULL,
`name` varchar(250) NOT NULL,
`description` varchar(250) NOT NULL,
`price` decimal(10,2) NOT NULL DEFAULT '0.00',
`status` varchar(10) NOT NULL DEFAULT 'Active',
`service_id` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=11 ;
-- --------------------------------------------------------
--
-- Table structure for table `laundryservice`
--
CREATE TABLE IF NOT EXISTS `laundryservice` (
`service_id` int(11) NOT NULL,
`name` varchar(250) NOT NULL,
`status` varchar(10) NOT NULL DEFAULT 'Active'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=4 ;
-- --------------------------------------------------------
--
-- Table structure for table `orderitem`
--
CREATE TABLE IF NOT EXISTS `orderitem` (
`order_item_id` int(11) NOT NULL,
`orderId` int(11) NOT NULL,
`laundryItemId` int(11) NOT NULL,
`quantity` double NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `serviceorder`
--
CREATE TABLE IF NOT EXISTS `serviceorder` (
`sorder_id` int(11) NOT NULL,
`orderDate` varchar(50) NOT NULL,
`expDeliveryDate` varchar(50) NOT NULL,
`actDeliveryDate` varchar(50) NOT NULL,
`orderStatus` varchar(15) NOT NULL DEFAULT 'Placed',
`customerId` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
CREATE TABLE IF NOT EXISTS `users` (
`id` int(11) NOT NULL,
`password` varchar(255) DEFAULT NULL,
`username` varchar(255) DEFAULT NULL,
`authority` varchar(20) NOT NULL DEFAULT 'ROLE_USER',
`enabled` tinyint(1) NOT NULL DEFAULT '1'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=11 ;
--
-- Indexes for dumped tables
--
--
-- Indexes for table `address`
--
ALTER TABLE `address`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `customer`
--
ALTER TABLE `customer`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `laundryitem`
--
ALTER TABLE `laundryitem`
ADD PRIMARY KEY (`item_id`);
--
-- Indexes for table `laundryservice`
--
ALTER TABLE `laundryservice`
ADD PRIMARY KEY (`service_id`);
--
-- Indexes for table `orderitem`
--
ALTER TABLE `orderitem`
ADD PRIMARY KEY (`order_item_id`);
--
-- Indexes for table `serviceorder`
--
ALTER TABLE `serviceorder`
ADD PRIMARY KEY (`sorder_id`);
--
-- Indexes for table `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `address`
--
ALTER TABLE `address`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=1;
--
-- AUTO_INCREMENT for table `customer`
--
ALTER TABLE `customer`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=1;
--
-- AUTO_INCREMENT for table `laundryitem`
--
ALTER TABLE `laundryitem`
MODIFY `item_id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=1;
--
-- AUTO_INCREMENT for table `laundryservice`
--
ALTER TABLE `laundryservice`
MODIFY `service_id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=1;
--
-- AUTO_INCREMENT for table `orderitem`
--
ALTER TABLE `orderitem`
MODIFY `order_item_id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `serviceorder`
--
ALTER TABLE `serviceorder`
MODIFY `sorder_id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=1;
--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=1;
| true |
7da80de9c20465e753bc24f0f1e2d7f2822bee02 | SQL | ojmakhura/redcapddp | /ddp_patient_project_mapping.sql | UTF-8 | 1,997 | 3.234375 | 3 | [] | no_license | -- Change the project_id value on the next line to match the one for your DDP project.
set @project_id = XX;
-- Do NOT change anything below this line.
delete from redcap_ddp_mapping where project_id = @project_id;
delete from redcap_ddp_preview_fields where project_id = @project_id;
set @event_id = (select event_id from redcap_events_metadata m, redcap_events_arms a where a.arm_id = m.arm_id and a.project_id = @project_id order by a.arm_num, m.day_offset, m.descrip limit 1);
INSERT INTO redcap_ddp_preview_fields (project_id, field1, field2, field3, field4, field5) VALUES
(@project_id, 'idNumber', 'firstName', 'surname', 'dob', NULL);
INSERT INTO redcap_ddp_mapping (external_source_field_name, is_record_identifier, project_id, event_id, field_name, temporal_field, preselect) VALUES
('idNumber', 1, @project_id, @event_id, 'id_number', NULL, NULL),
('dob', NULL, @project_id, @event_id, 'dob', NULL, NULL),
('firstName', NULL, @project_id, @event_id, 'first_name', NULL, NULL),
('sex', NULL, @project_id, @event_id, 'sex', NULL, NULL),
('surname', NULL, @project_id, @event_id, 'surname', NULL, NULL),
('contactNumber', NULL, @project_id, @event_id, 'contact_number', NULL, NULL),
('batchNumber', NULL, @project_id, @event_id, 'batch_number', 'visit_date', NULL),
('dispatchedDateTime', NULL, @project_id, @event_id, 'dispatch_date_time', 'visit_date', NULL),
('sampleStatus', NULL, @project_id, @event_id, 'sample_status', 'visit_date', NULL),
('dispatcher', NULL, @project_id, @event_id, 'dispatcher', 'visit_date', NULL),
('dispatchLocation', NULL, @project_id, @event_id, 'dispatch_location', 'visit_date', NULL),
('collectionDateTime', NULL, @project_id, @event_id, 'collection_date_time', 'visit_date', NULL),
('latitude', NULL, @project_id, @event_id, 'latitude', 'visit_date', NULL),
('longitude', NULL, @project_id, @event_id, 'longitude', 'visit_date', NULL),
('locationDetails', NULL, @project_id, @event_id, 'location_details', 'visit_date', NULL);
| true |
d80c35d0ecba66725fb88014fd651d60c2305f28 | SQL | iron-people-fec/similar-items | /SCHEMA.sql | UTF-8 | 415 | 2.734375 | 3 | [] | no_license | CREATE DATABASE IF NOT EXISTS fec;
USE fec;
CREATE TABLE IF NOT EXISTS products (
id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(64),
description VARCHAR(120),
imageUrl VARCHAR(120),
category INT,
isFavorite INT,
price VARCHAR(12),
cutPrice VARCHAR(12),
rating VARCHAR(12),
reviewCount INT
);
CREATE TABLE IF NOT EXISTS categories (
id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(64)
); | true |
44e6b76c5245ea0804d0bdb04dac54305e4941e4 | SQL | jdlrobson/mediawiki-extensions-Gather | /schema/gather_list_flag.sql | UTF-8 | 751 | 2.90625 | 3 | [] | no_license | -- Licence: CC0
-- Run with maintenance/sql.php for automatic replacement of /*_*/ etc
CREATE TABLE /*_*/gather_list_flag (
-- ID of the collection which has been flagged
glf_gl_id INT UNSIGNED NOT NULL,
-- Foreign key to user.user_id, 0 for anonymous
glf_user_id INT UNSIGNED NOT NULL DEFAULT 0,
-- IP address for anonymous users
glf_user_ip VARBINARY(40) NOT NULL DEFAULT '',
-- Marks flags which have been seen by an admin already and should not be used to autohide
glf_reviewed BOOL NOT NULL DEFAULT false
) /*$wgDBTableOptions*/;
CREATE UNIQUE INDEX /*i*/glf_list_user_ip ON /*_*/gather_list_flag (glf_gl_id, glf_user_id, glf_user_ip);
CREATE INDEX /*i*/glf_list_reviewed ON /*_*/gather_list_flag (glf_gl_id, glf_reviewed);
| true |
34d89208aae7b60cd64524b4282b8a04079ede0c | SQL | shadow81627/3612ICT | /Assignment/Insert.sql | UTF-8 | 2,258 | 2.765625 | 3 | [] | no_license | -- Insert Suppliers
INSERT INTO supplier
VALUES(1, "coles", null, 1234);
INSERT INTO supplier
VALUES(2, "woolies", null, 12345);
INSERT INTO supplier
VALUES(3, "aldi", null, 51824753556);
-- Insert Items
INSERT INTO item
VALUES(1, "pasta", "great original italian pasta", null, 'grain');
INSERT INTO item
VALUES(2, "pizza", "great original italian pizza", null,'fruit');
INSERT INTO item
VALUES(3, "cheese", "delicous parmasain cheese", null,'dairy');
-- Insert Products
INSERT INTO product
VALUES(1, 1, 1, 3.20, "kg");
INSERT INTO product
VALUES(2, 2, 2, 4.20, "kg");
INSERT INTO product
VALUES(3, 3, 3, 5.20, "kg");
-- Insert Customer
INSERT INTO customer
VALUES(1, "Ben", "ben@gmail.com", "21 Fake street");
INSERT INTO customer
VALUES(2, "Harry", "harry@gmail.com", "22 Fake street");
INSERT INTO customer
VALUES(3, "Bruce", "bruce@gmail.com", "23 Fake street");
-- Insert Product order
INSERT INTO product_order
VALUES( 1, 1, 1, 3.20, "kg", "21 Fake street", null, null, null);
INSERT INTO product_order
VALUES( 2, 2, 2, 5.7, "kg", "22 Fake street", null, null, null);
INSERT INTO product_order
VALUES( 3, 3, 3, 20.5, "kg", "23 Fake street", null, null, null);
-- Insert inventory
INSERT INTO inventory
VALUES(1, 1, "fridge", "the cold room out back", "21 Fake street");
INSERT INTO inventory
VALUES(2, 2, "pantry", "cupboard in the kitchen back", "22 Fake street");
INSERT INTO inventory
VALUES(3, 3, "shed", "shed out back", "23 Fake street");
-- Insert stock
INSERT INTO stock
VALUES(1, 1, 1, 3, "kg", null);
INSERT INTO stock
VALUES(1, 2, 2, 7.8, "kg", null);
INSERT INTO stock
VALUES(1, 3, 3, 52.4, "kg", null);
-- Insert recipies
INSERT INTO recipe
VALUES(1, 1, 3.2, "kg");
INSERT INTO recipe
VALUES(2, 2, 4.3, "kg");
INSERT INTO recipe
VALUES(3, 3, 9.3, "kg");
-- Insert process
INSERT INTO process
VALUES(1, 1, 1, "Add pasta", "Add pasta to the boiling water", null);
INSERT INTO process
VALUES(2, 2, 1, "Add pizza", "Add pizza to the boiling water", null);
INSERT INTO process
VALUES(3, 3, 1, "Add cheese", "Add cheese to the boiling water", null);
-- Insert ingrediets
INSERT INTO ingredient
VALUES(1, 1, 3, "kg");
INSERT INTO ingredient
VALUES(2, 1, 3, "kg");
INSERT INTO ingredient
VALUES(3, 1, 3, "kg"); | true |
45b73c299de8d1f925f372d0fa0f6739ca4059f0 | SQL | RTAndrew/nachysan | /nachysan.sql | UTF-8 | 67,529 | 3.25 | 3 | [
"MIT"
] | permissive | -- phpMyAdmin SQL Dump
-- version 4.7.4
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1:3306
-- Generation Time: 17-Mar-2018 às 05:38
-- Versão do servidor: 5.7.19
-- PHP Version: 5.6.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=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `nachysan`
--
-- --------------------------------------------------------
--
-- Estrutura da tabela `categorias`
--
DROP TABLE IF EXISTS `categorias`;
CREATE TABLE `categorias` (
`id` int(10) UNSIGNED NOT NULL,
`nome` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`slug` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC;
--
-- Extraindo dados da tabela `categorias`
--
INSERT INTO `categorias` (`id`, `nome`, `slug`) VALUES
(1, 'Para Elas', 'para-elas'),
(2, 'Para Eles', 'para-eles'),
(3, 'Diversos', 'diversos');
-- --------------------------------------------------------
--
-- Estrutura da tabela `categoria_producto`
--
DROP TABLE IF EXISTS `categoria_producto`;
CREATE TABLE `categoria_producto` (
`id` int(10) UNSIGNED NOT NULL,
`producto_id` int(10) UNSIGNED NOT NULL,
`categoria_id` int(10) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC;
--
-- Extraindo dados da tabela `categoria_producto`
--
INSERT INTO `categoria_producto` (`id`, `producto_id`, `categoria_id`) VALUES
(1, 1, 1),
(2, 3, 1),
(3, 18, 3);
-- --------------------------------------------------------
--
-- Estrutura da tabela `categoria_sub_categoria`
--
DROP TABLE IF EXISTS `categoria_sub_categoria`;
CREATE TABLE `categoria_sub_categoria` (
`id` int(10) UNSIGNED NOT NULL,
`categoria_id` int(10) UNSIGNED NOT NULL,
`sub_categoria_id` int(10) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC;
--
-- Extraindo dados da tabela `categoria_sub_categoria`
--
INSERT INTO `categoria_sub_categoria` (`id`, `categoria_id`, `sub_categoria_id`) VALUES
(1, 1, 1),
(2, 1, 2),
(3, 1, 3),
(4, 2, 2);
-- --------------------------------------------------------
--
-- Estrutura da tabela `categories`
--
DROP TABLE IF EXISTS `categories`;
CREATE TABLE `categories` (
`id` int(10) UNSIGNED NOT NULL,
`parent_id` int(10) UNSIGNED DEFAULT NULL,
`order` int(11) NOT NULL DEFAULT '1',
`name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`slug` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC;
-- --------------------------------------------------------
--
-- Estrutura da tabela `data_rows`
--
DROP TABLE IF EXISTS `data_rows`;
CREATE TABLE `data_rows` (
`id` int(10) UNSIGNED NOT NULL,
`data_type_id` int(10) UNSIGNED NOT NULL,
`field` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`type` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`display_name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`required` tinyint(1) NOT NULL DEFAULT '0',
`browse` tinyint(1) NOT NULL DEFAULT '1',
`read` tinyint(1) NOT NULL DEFAULT '1',
`edit` tinyint(1) NOT NULL DEFAULT '1',
`add` tinyint(1) NOT NULL DEFAULT '1',
`delete` tinyint(1) NOT NULL DEFAULT '1',
`details` text COLLATE utf8mb4_unicode_ci,
`order` int(11) NOT NULL DEFAULT '1'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC;
--
-- Extraindo dados da tabela `data_rows`
--
INSERT INTO `data_rows` (`id`, `data_type_id`, `field`, `type`, `display_name`, `required`, `browse`, `read`, `edit`, `add`, `delete`, `details`, `order`) VALUES
(1, 1, 'id', 'number', 'ID', 1, 0, 0, 0, 0, 0, '', 1),
(2, 1, 'author_id', 'text', 'Author', 1, 0, 1, 1, 0, 1, '', 2),
(3, 1, 'category_id', 'text', 'Category', 1, 0, 1, 1, 1, 0, '', 3),
(4, 1, 'title', 'text', 'Title', 1, 1, 1, 1, 1, 1, '', 4),
(5, 1, 'excerpt', 'text_area', 'excerpt', 1, 0, 1, 1, 1, 1, '', 5),
(6, 1, 'body', 'rich_text_box', 'Body', 1, 0, 1, 1, 1, 1, '', 6),
(7, 1, 'image', 'image', 'Post Image', 0, 1, 1, 1, 1, 1, '{\"resize\":{\"width\":\"1000\",\"height\":\"null\"},\"quality\":\"70%\",\"upsize\":true,\"thumbnails\":[{\"name\":\"medium\",\"scale\":\"50%\"},{\"name\":\"small\",\"scale\":\"25%\"},{\"name\":\"cropped\",\"crop\":{\"width\":\"300\",\"height\":\"250\"}}]}', 7),
(8, 1, 'slug', 'text', 'slug', 1, 0, 1, 1, 1, 1, '{\"slugify\":{\"origin\":\"title\",\"forceUpdate\":true}}', 8),
(9, 1, 'meta_description', 'text_area', 'meta_description', 1, 0, 1, 1, 1, 1, '', 9),
(10, 1, 'meta_keywords', 'text_area', 'meta_keywords', 1, 0, 1, 1, 1, 1, '', 10),
(11, 1, 'status', 'select_dropdown', 'status', 1, 1, 1, 1, 1, 1, '{\"default\":\"DRAFT\",\"options\":{\"PUBLISHED\":\"published\",\"DRAFT\":\"draft\",\"PENDING\":\"pending\"}}', 11),
(12, 1, 'created_at', 'timestamp', 'created_at', 0, 1, 1, 0, 0, 0, '', 12),
(13, 1, 'updated_at', 'timestamp', 'updated_at', 0, 0, 0, 0, 0, 0, '', 13),
(14, 2, 'id', 'number', 'id', 1, 0, 0, 0, 0, 0, '', 1),
(15, 2, 'author_id', 'text', 'author_id', 1, 0, 0, 0, 0, 0, '', 2),
(16, 2, 'title', 'text', 'title', 1, 1, 1, 1, 1, 1, '', 3),
(17, 2, 'excerpt', 'text_area', 'excerpt', 1, 0, 1, 1, 1, 1, '', 4),
(18, 2, 'body', 'rich_text_box', 'body', 1, 0, 1, 1, 1, 1, '', 5),
(19, 2, 'slug', 'text', 'slug', 1, 0, 1, 1, 1, 1, '{\"slugify\":{\"origin\":\"title\"}}', 6),
(20, 2, 'meta_description', 'text', 'meta_description', 1, 0, 1, 1, 1, 1, '', 7),
(21, 2, 'meta_keywords', 'text', 'meta_keywords', 1, 0, 1, 1, 1, 1, '', 8),
(22, 2, 'status', 'select_dropdown', 'status', 1, 1, 1, 1, 1, 1, '{\"default\":\"INACTIVE\",\"options\":{\"INACTIVE\":\"INACTIVE\",\"ACTIVE\":\"ACTIVE\"}}', 9),
(23, 2, 'created_at', 'timestamp', 'created_at', 1, 1, 1, 0, 0, 0, '', 10),
(24, 2, 'updated_at', 'timestamp', 'updated_at', 1, 0, 0, 0, 0, 0, '', 11),
(25, 2, 'image', 'image', 'image', 0, 1, 1, 1, 1, 1, '', 12),
(26, 3, 'id', 'number', 'id', 1, 0, 0, 0, 0, 0, '', 1),
(27, 3, 'name', 'text', 'name', 1, 1, 1, 1, 1, 1, '', 2),
(28, 3, 'email', 'text', 'email', 1, 1, 1, 1, 1, 1, '', 3),
(29, 3, 'password', 'password', 'password', 0, 0, 0, 1, 1, 0, '', 4),
(30, 3, 'user_belongsto_role_relationship', 'relationship', 'Role', 0, 1, 1, 1, 1, 0, '{\"model\":\"TCG\\\\Voyager\\\\Models\\\\Role\",\"table\":\"roles\",\"type\":\"belongsTo\",\"column\":\"role_id\",\"key\":\"id\",\"label\":\"name\",\"pivot_table\":\"roles\",\"pivot\":\"0\"}', 10),
(31, 3, 'remember_token', 'text', 'remember_token', 0, 0, 0, 0, 0, 0, '', 5),
(32, 3, 'created_at', 'timestamp', 'created_at', 0, 1, 1, 0, 0, 0, '', 6),
(33, 3, 'updated_at', 'timestamp', 'updated_at', 0, 0, 0, 0, 0, 0, '', 7),
(34, 3, 'avatar', 'image', 'avatar', 0, 1, 1, 1, 1, 1, '', 8),
(35, 5, 'id', 'number', 'id', 1, 0, 0, 0, 0, 0, '', 1),
(36, 5, 'name', 'text', 'name', 1, 1, 1, 1, 1, 1, '', 2),
(37, 5, 'created_at', 'timestamp', 'created_at', 0, 0, 0, 0, 0, 0, '', 3),
(38, 5, 'updated_at', 'timestamp', 'updated_at', 0, 0, 0, 0, 0, 0, '', 4),
(39, 4, 'id', 'number', 'id', 1, 0, 0, 0, 0, 0, '', 1),
(40, 4, 'parent_id', 'select_dropdown', 'parent_id', 0, 0, 1, 1, 1, 1, '{\"default\":\"\",\"null\":\"\",\"options\":{\"\":\"-- None --\"},\"relationship\":{\"key\":\"id\",\"label\":\"name\"}}', 2),
(41, 4, 'order', 'text', 'order', 1, 1, 1, 1, 1, 1, '{\"default\":1}', 3),
(42, 4, 'name', 'text', 'name', 1, 1, 1, 1, 1, 1, '', 4),
(43, 4, 'slug', 'text', 'slug', 1, 1, 1, 1, 1, 1, '{\"slugify\":{\"origin\":\"name\"}}', 5),
(44, 4, 'created_at', 'timestamp', 'created_at', 0, 0, 1, 0, 0, 0, '', 6),
(45, 4, 'updated_at', 'timestamp', 'updated_at', 0, 0, 0, 0, 0, 0, '', 7),
(46, 6, 'id', 'number', 'id', 1, 0, 0, 0, 0, 0, '', 1),
(47, 6, 'name', 'text', 'Name', 1, 1, 1, 1, 1, 1, '', 2),
(48, 6, 'created_at', 'timestamp', 'created_at', 0, 0, 0, 0, 0, 0, '', 3),
(49, 6, 'updated_at', 'timestamp', 'updated_at', 0, 0, 0, 0, 0, 0, '', 4),
(50, 6, 'display_name', 'text', 'Display Name', 1, 1, 1, 1, 1, 1, '', 5),
(51, 1, 'seo_title', 'text', 'seo_title', 0, 1, 1, 1, 1, 1, '', 14),
(52, 1, 'featured', 'checkbox', 'featured', 1, 1, 1, 1, 1, 1, '', 15),
(53, 3, 'role_id', 'text', 'role_id', 1, 1, 1, 1, 1, 1, '', 9),
(54, 7, 'id', 'checkbox', 'Id', 1, 0, 0, 0, 0, 0, NULL, 1),
(55, 7, 'nome', 'text', 'Nome', 1, 1, 1, 1, 1, 1, NULL, 2),
(56, 7, 'slug', 'text', 'Slug', 1, 1, 1, 1, 1, 1, '{\"slugify\":{\"origin\":\"nome\",\"forceUpdate\":true}}', 3),
(57, 8, 'id', 'checkbox', 'Id', 1, 0, 0, 0, 0, 0, NULL, 1),
(58, 8, 'nome', 'text', 'Nome', 1, 1, 1, 1, 1, 1, NULL, 2),
(59, 8, 'slug', 'text', 'Slug', 1, 1, 1, 1, 1, 1, '{\"slugify\":{\"origin\":\"nome\",\"forceUpdate\":true}}', 3),
(60, 9, 'id', 'checkbox', 'Id', 1, 0, 0, 0, 0, 0, NULL, 1),
(61, 9, 'pais', 'text', 'Nome do País', 1, 1, 1, 1, 1, 1, NULL, 2),
(62, 9, 'endereco', 'text', 'Endereço', 1, 1, 1, 1, 1, 1, NULL, 3),
(63, 9, 'contacto_id', 'select_dropdown', 'Contacto Primário', 1, 1, 1, 1, 1, 1, NULL, 4),
(64, 9, 'info_pai_belongsto_num_contacto_relationship', 'relationship', 'Contacto Primário', 0, 1, 1, 1, 1, 1, '{\"model\":\"App\\\\num_contacto\",\"table\":\"num_contactos\",\"type\":\"belongsTo\",\"column\":\"contacto_id\",\"key\":\"id\",\"label\":\"contacto\",\"pivot_table\":\"categoria_producto\",\"pivot\":\"0\"}', 5),
(65, 10, 'id', 'checkbox', 'Id', 1, 0, 0, 0, 0, 0, NULL, 1),
(66, 10, 'nome', 'text', 'Nome', 1, 1, 1, 1, 1, 1, NULL, 2),
(67, 10, 'funcao', 'text', 'Função', 1, 1, 1, 1, 1, 1, NULL, 3),
(68, 10, 'descricao', 'text_area', 'Descrição', 1, 1, 1, 1, 1, 1, NULL, 4),
(69, 10, 'imagem', 'image', 'Imagem', 1, 1, 1, 1, 1, 1, '{\"resize\":{\"width\":\"720\",\"height\":null},\"quality\":\"70%\",\"upsize\":false}', 5),
(70, 10, 'facebook_link', 'text', 'Facebook Link', 0, 1, 1, 1, 1, 1, NULL, 6),
(71, 10, 'instagram_link', 'text', 'Instagram Link', 0, 1, 1, 1, 1, 1, NULL, 7),
(72, 10, 'youtube_link', 'text', 'Youtube Link', 0, 1, 1, 1, 1, 1, NULL, 8),
(73, 11, 'id', 'checkbox', 'Id', 1, 0, 0, 0, 0, 0, NULL, 1),
(74, 11, 'email', 'text', 'Email', 1, 1, 1, 1, 1, 1, NULL, 3),
(75, 11, 'descricao_tipo_id', 'select_dropdown', 'Tipo', 0, 1, 1, 1, 1, 1, NULL, 2),
(76, 11, 'email_belongsto_descricao_tipo_relationship', 'relationship', 'descricao_tipos', 0, 1, 1, 1, 1, 1, '{\"model\":\"App\\\\descricao_tipos\",\"table\":\"descricao_tipos\",\"type\":\"belongsTo\",\"column\":\"descricao_tipo_id\",\"key\":\"id\",\"label\":\"nome\",\"pivot_table\":\"categoria_producto\",\"pivot\":\"0\"}', 4),
(77, 12, 'id', 'checkbox', 'Id', 1, 0, 0, 0, 0, 0, NULL, 1),
(78, 12, 'nome', 'text', 'Nome', 1, 1, 1, 1, 1, 1, NULL, 4),
(79, 12, 'slug', 'text', 'Slug', 1, 0, 1, 1, 1, 1, '{\"slugify\":{\"origin\":\"nome\",\"forceUpdate\":true}}', 5),
(80, 12, 'descricao', 'rich_text_box', 'Descrição', 1, 0, 1, 1, 1, 1, NULL, 6),
(81, 12, 'preco', 'number', 'Preço', 1, 1, 1, 1, 1, 1, NULL, 7),
(82, 12, 'preco_promocao', 'number', 'Preço Promoção', 0, 1, 1, 1, 1, 1, NULL, 8),
(83, 12, 'quantidade', 'number', 'Qtd.', 1, 1, 1, 1, 1, 1, NULL, 9),
(84, 12, 'thumbnail', 'image', 'Thumbnail', 1, 1, 1, 1, 1, 1, '{\"resize\":{\"width\":\"720\",\"height\":null},\"quality\":\"70%\",\"upsize\":false}', 10),
(85, 12, 'imagens', 'multiple_images', 'Imagens', 0, 0, 1, 1, 1, 1, '{\"resize\":{\"width\":\"1000\",\"height\":null},\"quality\":\"70%\",\"upsize\":false}', 11),
(86, 12, 'views', 'number', 'Visualizações', 1, 1, 1, 0, 0, 0, NULL, 12),
(87, 12, 'sub_categoria_id', 'select_dropdown', 'Subcategoria', 0, 1, 1, 1, 1, 1, NULL, 3),
(88, 12, 'estado_producto_id', 'select_dropdown', 'Estado', 0, 0, 1, 1, 1, 1, NULL, 2),
(89, 12, 'created_at', 'timestamp', 'Criado Em', 0, 1, 1, 0, 0, 0, NULL, 13),
(90, 12, 'updated_at', 'timestamp', 'Updated At', 0, 0, 0, 0, 0, 0, NULL, 14),
(91, 12, 'producto_belongsto_sub_categoria_relationship', 'relationship', 'Subcategoria', 0, 1, 1, 1, 1, 1, '{\"model\":\"App\\\\sub_categoria\",\"table\":\"sub_categorias\",\"type\":\"belongsTo\",\"column\":\"sub_categoria_id\",\"key\":\"id\",\"label\":\"nome\",\"pivot_table\":\"categoria_producto\",\"pivot\":\"0\"}', 15),
(92, 12, 'producto_belongsto_estado_producto_relationship', 'relationship', 'Estado', 0, 1, 1, 1, 1, 1, '{\"model\":\"App\\\\estado_producto\",\"table\":\"estado_productos\",\"type\":\"belongsTo\",\"column\":\"estado_producto_id\",\"key\":\"id\",\"label\":\"nome\",\"pivot_table\":\"categoria_producto\",\"pivot\":\"0\"}', 16),
(93, 12, 'producto_belongstomany_categoria_producto_relationship', 'relationship', 'Categoria', 0, 1, 1, 1, 1, 1, '{\"model\":\"App\\\\categoria\",\"table\":\"categorias\",\"type\":\"belongsToMany\",\"column\":\"id\",\"key\":\"id\",\"label\":\"nome\",\"pivot_table\":\"categoria_producto\",\"pivot\":\"1\"}', 17),
(94, 8, 'categoria_belongstomany_sub_categoria_relationship', 'relationship', 'sub_categorias', 0, 1, 1, 1, 1, 1, '{\"model\":\"App\\\\sub_categoria\",\"table\":\"sub_categorias\",\"type\":\"belongsToMany\",\"column\":\"id\",\"key\":\"id\",\"label\":\"nome\",\"pivot_table\":\"categoria_sub_categoria\",\"pivot\":\"1\"}', 4),
(95, 13, 'id', 'checkbox', 'Id', 1, 0, 0, 0, 0, 0, NULL, 1),
(96, 13, 'contacto', 'text', 'Contacto', 1, 1, 1, 1, 1, 1, NULL, 3),
(97, 13, 'descricao_tipo_id', 'checkbox', 'Tipo', 0, 1, 1, 1, 1, 1, NULL, 2),
(98, 13, 'num_contacto_belongsto_descricao_tipo_relationship', 'relationship', 'descricao_tipos', 0, 1, 1, 1, 1, 1, '{\"model\":\"App\\\\descricao_tipos\",\"table\":\"descricao_tipos\",\"type\":\"belongsTo\",\"column\":\"descricao_tipo_id\",\"key\":\"id\",\"label\":\"nome\",\"pivot_table\":\"categoria_producto\",\"pivot\":\"0\"}', 4),
(102, 15, 'id', 'checkbox', 'Id', 1, 0, 0, 0, 0, 0, NULL, 1),
(103, 15, 'nome', 'text', 'Nome', 1, 1, 1, 1, 1, 1, NULL, 2),
(104, 15, 'endereco_url', 'text', 'Endereco Url', 1, 1, 1, 1, 1, 1, NULL, 3);
-- --------------------------------------------------------
--
-- Estrutura da tabela `data_types`
--
DROP TABLE IF EXISTS `data_types`;
CREATE TABLE `data_types` (
`id` int(10) UNSIGNED NOT NULL,
`name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`slug` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`display_name_singular` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`display_name_plural` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`icon` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`model_name` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`policy_name` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`controller` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`description` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`generate_permissions` tinyint(1) NOT NULL DEFAULT '0',
`server_side` tinyint(4) NOT NULL DEFAULT '0',
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC;
--
-- Extraindo dados da tabela `data_types`
--
INSERT INTO `data_types` (`id`, `name`, `slug`, `display_name_singular`, `display_name_plural`, `icon`, `model_name`, `policy_name`, `controller`, `description`, `generate_permissions`, `server_side`, `created_at`, `updated_at`) VALUES
(1, 'posts', 'posts', 'Post', 'Posts', 'voyager-news', 'TCG\\Voyager\\Models\\Post', 'TCG\\Voyager\\Policies\\PostPolicy', '', '', 1, 0, '2018-03-14 01:31:05', '2018-03-14 01:31:05'),
(2, 'pages', 'pages', 'Page', 'Pages', 'voyager-file-text', 'TCG\\Voyager\\Models\\Page', NULL, '', '', 1, 0, '2018-03-14 01:31:06', '2018-03-14 01:31:06'),
(3, 'users', 'users', 'User', 'Users', 'voyager-person', 'TCG\\Voyager\\Models\\User', 'TCG\\Voyager\\Policies\\UserPolicy', '', '', 1, 0, '2018-03-14 01:31:06', '2018-03-14 01:31:06'),
(4, 'categories', 'categories', 'Category', 'Categories', 'voyager-categories', 'TCG\\Voyager\\Models\\Category', NULL, '', '', 1, 0, '2018-03-14 01:31:06', '2018-03-14 01:31:06'),
(5, 'menus', 'menus', 'Menu', 'Menus', 'voyager-list', 'TCG\\Voyager\\Models\\Menu', NULL, '', '', 1, 0, '2018-03-14 01:31:06', '2018-03-14 01:31:06'),
(6, 'roles', 'roles', 'Role', 'Roles', 'voyager-lock', 'TCG\\Voyager\\Models\\Role', NULL, '', '', 1, 0, '2018-03-14 01:31:06', '2018-03-14 01:31:06'),
(7, 'sub_categorias', 'sub-categorias', 'Sub Categoria', 'Sub Categorias', NULL, 'App\\sub_categoria', NULL, NULL, NULL, 1, 0, '2018-03-14 09:13:02', '2018-03-14 09:13:02'),
(8, 'categorias', 'categorias', 'Categoria', 'Categorias', NULL, 'App\\Categoria', NULL, NULL, NULL, 1, 0, '2018-03-14 09:18:18', '2018-03-14 09:18:18'),
(9, 'info_pais', 'info-pais', 'Informação do País', 'Informação dos Países', 'voyager-world', 'App\\info_pais', NULL, NULL, 'Todas as informações de um determinado país em que pode-se efectuar as vendas.', 1, 0, '2018-03-14 09:22:57', '2018-03-14 09:28:28'),
(10, 'perfil_staffs', 'perfil-staff', 'L\'Équipe', 'Perfil Staffs', 'voyager-people', 'App\\PerfilStaff', NULL, NULL, NULL, 1, 0, '2018-03-14 09:35:34', '2018-03-14 09:35:34'),
(11, 'emails', 'emails', 'Email', 'Emails', 'voyager-mail', 'App\\Email', NULL, NULL, NULL, 1, 0, '2018-03-14 09:44:36', '2018-03-14 22:27:43'),
(12, 'productos', 'productos', 'Producto', 'Productos', NULL, 'App\\Producto', NULL, NULL, NULL, 1, 0, '2018-03-14 22:50:49', '2018-03-14 22:50:49'),
(13, 'num_contactos', 'num-contactos', 'Contacto', 'Num Contactos', NULL, 'App\\num_contacto', NULL, NULL, NULL, 1, 0, '2018-03-15 00:50:58', '2018-03-15 00:50:58'),
(15, 'rede_social', 'rede-social', 'Rede Social', 'Rede Socials', NULL, 'App\\rede_social', NULL, NULL, NULL, 1, 0, '2018-03-15 19:24:28', '2018-03-15 19:24:28');
-- --------------------------------------------------------
--
-- Estrutura da tabela `descricao_tipos`
--
DROP TABLE IF EXISTS `descricao_tipos`;
CREATE TABLE `descricao_tipos` (
`id` int(10) UNSIGNED NOT NULL,
`nome` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`descricao` text COLLATE utf8mb4_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC;
--
-- Extraindo dados da tabela `descricao_tipos`
--
INSERT INTO `descricao_tipos` (`id`, `nome`, `descricao`) VALUES
(1, 'Primário', 'Principal a ser sempre utilizado'),
(2, 'Secundário', 'Resto a ser utilizados');
-- --------------------------------------------------------
--
-- Estrutura da tabela `emails`
--
DROP TABLE IF EXISTS `emails`;
CREATE TABLE `emails` (
`id` int(10) UNSIGNED NOT NULL,
`email` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`descricao_tipo_id` int(10) UNSIGNED DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC;
--
-- Extraindo dados da tabela `emails`
--
INSERT INTO `emails` (`id`, `email`, `descricao_tipo_id`) VALUES
(1, 'nachysan@gmail.com', 1),
(2, 'nachysan@site.com', 2);
-- --------------------------------------------------------
--
-- Estrutura da tabela `estado_productos`
--
DROP TABLE IF EXISTS `estado_productos`;
CREATE TABLE `estado_productos` (
`id` int(10) UNSIGNED NOT NULL,
`nome` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`descricao` text COLLATE utf8mb4_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC;
--
-- Extraindo dados da tabela `estado_productos`
--
INSERT INTO `estado_productos` (`id`, `nome`, `descricao`) VALUES
(1, 'Disponível', 'Productos que estão actualmente disponíveis para aquisição'),
(2, 'Indisponível', 'Productos que não se encontram disponíveis, mas que porém podem ser vistos através da galeria');
-- --------------------------------------------------------
--
-- Estrutura da tabela `info_pais`
--
DROP TABLE IF EXISTS `info_pais`;
CREATE TABLE `info_pais` (
`id` int(10) UNSIGNED NOT NULL,
`pais` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`endereco` text COLLATE utf8mb4_unicode_ci NOT NULL,
`contacto_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC;
--
-- Extraindo dados da tabela `info_pais`
--
INSERT INTO `info_pais` (`id`, `pais`, `endereco`, `contacto_id`) VALUES
(1, 'Angola', 'Luanda, Nova Vida, Rua 4, Predio 22, Apt. 12', 1),
(2, 'Namibia', 'Windhoek, South\'s Village, 12th Street Boys', 3);
-- --------------------------------------------------------
--
-- Estrutura da tabela `menus`
--
DROP TABLE IF EXISTS `menus`;
CREATE TABLE `menus` (
`id` int(10) UNSIGNED NOT NULL,
`name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC;
--
-- Extraindo dados da tabela `menus`
--
INSERT INTO `menus` (`id`, `name`, `created_at`, `updated_at`) VALUES
(1, 'admin', '2018-03-14 01:31:16', '2018-03-14 01:31:16'),
(2, 'user', '2018-03-15 01:07:11', '2018-03-15 01:07:11');
-- --------------------------------------------------------
--
-- Estrutura da tabela `menu_items`
--
DROP TABLE IF EXISTS `menu_items`;
CREATE TABLE `menu_items` (
`id` int(10) UNSIGNED NOT NULL,
`menu_id` int(10) UNSIGNED DEFAULT NULL,
`title` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`url` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`target` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '_self',
`icon_class` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`color` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`parent_id` int(11) DEFAULT NULL,
`order` int(11) NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
`route` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`parameters` text COLLATE utf8mb4_unicode_ci
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC;
--
-- Extraindo dados da tabela `menu_items`
--
INSERT INTO `menu_items` (`id`, `menu_id`, `title`, `url`, `target`, `icon_class`, `color`, `parent_id`, `order`, `created_at`, `updated_at`, `route`, `parameters`) VALUES
(1, 1, 'Dashboard', '', '_self', 'voyager-boat', NULL, NULL, 1, '2018-03-14 01:31:16', '2018-03-14 01:31:16', 'voyager.dashboard', NULL),
(2, 1, 'Media', '', '_self', 'voyager-images', NULL, NULL, 4, '2018-03-14 01:31:16', '2018-03-14 09:07:37', 'voyager.media.index', NULL),
(4, 1, 'Users', '', '_self', 'voyager-person', NULL, NULL, 3, '2018-03-14 01:31:17', '2018-03-14 01:31:17', 'voyager.users.index', NULL),
(7, 1, 'Roles', '', '_self', 'voyager-lock', NULL, NULL, 2, '2018-03-14 01:31:17', '2018-03-14 01:31:17', 'voyager.roles.index', NULL),
(8, 1, 'Tools', '', '_self', 'voyager-tools', NULL, NULL, 12, '2018-03-14 01:31:17', '2018-03-15 00:58:29', NULL, NULL),
(9, 1, 'Menu Builder', '', '_self', 'voyager-list', NULL, 8, 1, '2018-03-14 01:31:18', '2018-03-14 09:07:41', 'voyager.menus.index', NULL),
(10, 1, 'Database', '', '_self', 'voyager-data', NULL, NULL, 11, '2018-03-14 01:31:18', '2018-03-15 00:58:29', 'voyager.database.index', NULL),
(11, 1, 'Compass', '', '_self', 'voyager-compass', NULL, 8, 2, '2018-03-14 01:31:18', '2018-03-14 09:07:41', 'voyager.compass.index', NULL),
(12, 1, 'Settings', '', '_self', 'voyager-settings', NULL, NULL, 13, '2018-03-14 01:31:18', '2018-03-15 00:58:29', 'voyager.settings.index', NULL),
(13, 1, 'Hooks', '', '_self', 'voyager-hook', NULL, 8, 3, '2018-03-14 01:31:26', '2018-03-14 09:07:42', 'voyager.hooks', NULL),
(14, 1, 'Sub Categorias', '/admin/sub-categorias', '_self', 'voyager-categories', '#000000', 19, 2, '2018-03-14 09:13:03', '2018-03-15 19:14:26', NULL, ''),
(15, 1, 'Categorias', '/admin/categorias', '_self', 'voyager-folder', '#000000', 19, 1, '2018-03-14 09:18:19', '2018-03-14 22:36:20', NULL, ''),
(16, 1, 'Informação dos Países', '/admin/info-pais', '_self', 'voyager-world', '#000000', NULL, 6, '2018-03-14 09:22:57', '2018-03-15 00:59:25', NULL, ''),
(17, 1, 'L\'Équipe - Membros', '/admin/perfil-staff', '_self', 'voyager-people', '#000000', NULL, 7, '2018-03-14 09:35:35', '2018-03-15 00:59:25', NULL, ''),
(18, 1, 'Emails', '/admin/emails', '_self', 'voyager-mail', '#000000', NULL, 8, '2018-03-14 09:44:37', '2018-03-15 00:59:25', NULL, ''),
(19, 1, 'Productos', '', '_self', 'voyager-list', '#000000', NULL, 5, '2018-03-14 22:33:13', '2018-03-14 22:35:54', NULL, ''),
(20, 1, 'Lista de Productos', '/admin/productos', '_self', 'voyager-bag', '#000000', 19, 3, '2018-03-14 22:50:50', '2018-03-15 19:14:26', NULL, ''),
(21, 1, 'Contactos', '/admin/num-contactos', '_self', 'voyager-telephone', '#000000', NULL, 9, '2018-03-15 00:50:58', '2018-03-15 00:59:25', NULL, ''),
(23, 1, 'Rede Socials', '/admin/rede-social', '_self', 'voyager-heart', '#000000', NULL, 10, '2018-03-15 19:24:28', '2018-03-15 19:26:22', NULL, '');
-- --------------------------------------------------------
--
-- Estrutura da tabela `migrations`
--
DROP TABLE IF EXISTS `migrations`;
CREATE TABLE `migrations` (
`id` int(10) UNSIGNED NOT NULL,
`migration` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`batch` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC;
--
-- Extraindo dados da tabela `migrations`
--
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES
(1, '2014_10_12_000000_create_users_table', 1),
(2, '2014_10_12_100000_create_password_resets_table', 1),
(3, '2016_01_01_000000_add_voyager_user_fields', 1),
(4, '2016_01_01_000000_create_data_types_table', 1),
(5, '2016_01_01_000000_create_pages_table', 1),
(6, '2016_01_01_000000_create_posts_table', 1),
(7, '2016_02_15_204651_create_categories_table', 1),
(8, '2016_05_19_173453_create_menu_table', 1),
(9, '2016_10_21_190000_create_roles_table', 1),
(10, '2016_10_21_190000_create_settings_table', 1),
(11, '2016_11_30_135954_create_permission_table', 1),
(12, '2016_11_30_141208_create_permission_role_table', 1),
(13, '2016_12_26_201236_data_types__add__server_side', 1),
(14, '2017_01_13_000000_add_route_to_menu_items_table', 1),
(15, '2017_01_14_005015_create_translations_table', 1),
(16, '2017_01_15_000000_add_permission_group_id_to_permissions_table', 1),
(17, '2017_01_15_000000_create_permission_groups_table', 1),
(18, '2017_01_15_000000_make_table_name_nullable_in_permissions_table', 1),
(19, '2017_03_06_000000_add_controller_to_data_types_table', 1),
(20, '2017_04_11_000000_alter_post_nullable_fields_table', 1),
(21, '2017_04_21_000000_add_order_to_data_rows_table', 1),
(22, '2017_07_05_210000_add_policyname_to_data_types_table', 1),
(23, '2017_08_05_000000_add_group_to_settings_table', 1),
(24, '2018_02_10_152723_create_estado_productos_table', 1),
(25, '2018_02_10_183742_create_sub_categorias_table', 1),
(26, '2018_02_11_131623_create_productos_table', 1),
(27, '2018_02_11_164034_create_descricao_tipos_table', 1),
(28, '2018_02_11_183348_create_categorias_table', 1),
(29, '2018_02_12_011725_create_categoria_sub_categoria', 1),
(30, '2018_02_14_040444_create_categorias_productos', 1),
(31, '2018_03_04_215925_create_perfil_staffs_table', 1),
(32, '2018_03_11_163335_create_emails_table', 1),
(33, '2018_03_11_163631_create_num_contactos_table', 1),
(34, '2018_03_11_232957_create_info_pais_table', 1),
(35, '2018_03_11_233440_create_rede_social_table', 1);
-- --------------------------------------------------------
--
-- Estrutura da tabela `num_contactos`
--
DROP TABLE IF EXISTS `num_contactos`;
CREATE TABLE `num_contactos` (
`id` int(10) UNSIGNED NOT NULL,
`contacto` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`descricao_tipo_id` int(10) UNSIGNED DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC;
--
-- Extraindo dados da tabela `num_contactos`
--
INSERT INTO `num_contactos` (`id`, `contacto`, `descricao_tipo_id`) VALUES
(1, '+244932337220', 1),
(2, '+244998452443', 2),
(3, '+26497824582', 2);
-- --------------------------------------------------------
--
-- Estrutura da tabela `pages`
--
DROP TABLE IF EXISTS `pages`;
CREATE TABLE `pages` (
`id` int(10) UNSIGNED NOT NULL,
`author_id` int(11) NOT NULL,
`title` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`excerpt` text COLLATE utf8mb4_unicode_ci,
`body` text COLLATE utf8mb4_unicode_ci,
`image` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`slug` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`meta_description` text COLLATE utf8mb4_unicode_ci,
`meta_keywords` text COLLATE utf8mb4_unicode_ci,
`status` enum('ACTIVE','INACTIVE') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'INACTIVE',
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC;
-- --------------------------------------------------------
--
-- Estrutura da tabela `password_resets`
--
DROP TABLE IF EXISTS `password_resets`;
CREATE TABLE `password_resets` (
`email` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`token` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC;
-- --------------------------------------------------------
--
-- Estrutura da tabela `perfil_staffs`
--
DROP TABLE IF EXISTS `perfil_staffs`;
CREATE TABLE `perfil_staffs` (
`id` int(10) UNSIGNED NOT NULL,
`nome` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`funcao` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`descricao` text COLLATE utf8mb4_unicode_ci NOT NULL,
`imagem` text COLLATE utf8mb4_unicode_ci NOT NULL,
`facebook_link` text COLLATE utf8mb4_unicode_ci,
`instagram_link` text COLLATE utf8mb4_unicode_ci,
`youtube_link` text COLLATE utf8mb4_unicode_ci
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC;
--
-- Extraindo dados da tabela `perfil_staffs`
--
INSERT INTO `perfil_staffs` (`id`, `nome`, `funcao`, `descricao`, `imagem`, `facebook_link`, `instagram_link`, `youtube_link`) VALUES
(1, 'Sarah Azevedo Correia', 'CEO', 'It\'s not how many years you\'ve lived in your life, but how much life you\'ve lived in your years.\nIn the end, it\'s not the years in your life that count. It\'s the life in your years. ', '', 'http://facebook.com/', NULL, 'http://youtube.com/'),
(2, 'Vitoria Fernandes Correia', 'Marketing Digital', 'Everything you do today forms the seeds for what you harvest tomorrow.\nAlways do your best. What you plant now, you will harvest later.', '', 'http://facebook.com/', 'http://instagram.com/', NULL),
(3, 'Mateus Gomes Rodrigues', 'Assistente de Mídia', 'Age is not a limit for dreams and goals.\nYou are never too old to set another goal or to dream a new dream.', '', 'http://facebook.com/', 'http://instagram.com/', 'http://youtube.com/'),
(4, 'Matilde Cardoso Pereira', 'Relações Públicas', 'É um facto estabelecido de que um leitor é distraído pelo conteúdo legível de uma página quando analisa a sua mancha gráfica. Logo, o uso de Lorem Ipsum leva a uma distribuição mais ou menos normal de letras, ao contrário do uso de \'Conteúdo aqui, conteúdo aqui\', tornando-o texto legível. ', '', NULL, NULL, NULL),
(5, 'Arlete', 'CEO', '<p><strong>Lorem</strong> ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod<br />tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,<br />quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo<br />consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse<br />cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non<br />proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>', 'perfil-staffs/March2018/9iQuaFou7cHnfTwp7AWu.jpg', 'http://facebook.com/', NULL, NULL),
(6, 'maxine adams', 'Designer', '<p>Silver, shoulder-length hair almost fully covers a craggy, lived-in face. Bulging red eyes, set sunken within their sockets, watch devotedly over the village they\'ve protected for so long.</p>\r\n<p>A gunshot left a mark reaching from just under the right eyebrow , running towards the tip of the nose and ending on her left nostril leaves a lasting punishment of companionship.</p>', 'perfil-staffs/March2018/C4b4NhbinBQRwflLNN8H.jpg', NULL, NULL, NULL),
(7, 'Tânia Goncalves Pereira', 'Marketing', '<p>There\'s something enthralling about her, perhaps it\'s her attitude or perhaps it\'s simply a feeling of guilt. But nonetheless, people tend to stay on her good side, while commending her for her deeds.</p>', 'perfil-staffs/March2018/iXizQPGUhOrkddGLYfUM.jpg', NULL, NULL, 'http://youtube.com/'),
(8, 'Gabrielly Silva Carvalho', 'Marketing', '<p>White, frizzy hair clumsily hangs over a bony, radiant face. Hollow gray eyes, set wickedly within their sockets, watch heartily over the homes they\'ve nearly died for for so long.</p>', 'perfil-staffs/March2018/qBEf8TkrQJnqYo1JgUsh.jpg', 'http://facebook.com/', 'http://instagram.com/', 'http://youtubecom/');
-- --------------------------------------------------------
--
-- Estrutura da tabela `permissions`
--
DROP TABLE IF EXISTS `permissions`;
CREATE TABLE `permissions` (
`id` int(10) UNSIGNED NOT NULL,
`key` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`table_name` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
`permission_group_id` int(10) UNSIGNED DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC;
--
-- Extraindo dados da tabela `permissions`
--
INSERT INTO `permissions` (`id`, `key`, `table_name`, `created_at`, `updated_at`, `permission_group_id`) VALUES
(1, 'browse_admin', NULL, '2018-03-14 01:31:18', '2018-03-14 01:31:18', NULL),
(2, 'browse_database', NULL, '2018-03-14 01:31:19', '2018-03-14 01:31:19', NULL),
(3, 'browse_media', NULL, '2018-03-14 01:31:19', '2018-03-14 01:31:19', NULL),
(4, 'browse_compass', NULL, '2018-03-14 01:31:19', '2018-03-14 01:31:19', NULL),
(5, 'browse_menus', 'menus', '2018-03-14 01:31:19', '2018-03-14 01:31:19', NULL),
(6, 'read_menus', 'menus', '2018-03-14 01:31:19', '2018-03-14 01:31:19', NULL),
(7, 'edit_menus', 'menus', '2018-03-14 01:31:19', '2018-03-14 01:31:19', NULL),
(8, 'add_menus', 'menus', '2018-03-14 01:31:19', '2018-03-14 01:31:19', NULL),
(9, 'delete_menus', 'menus', '2018-03-14 01:31:19', '2018-03-14 01:31:19', NULL),
(10, 'browse_pages', 'pages', '2018-03-14 01:31:20', '2018-03-14 01:31:20', NULL),
(11, 'read_pages', 'pages', '2018-03-14 01:31:20', '2018-03-14 01:31:20', NULL),
(12, 'edit_pages', 'pages', '2018-03-14 01:31:20', '2018-03-14 01:31:20', NULL),
(13, 'add_pages', 'pages', '2018-03-14 01:31:20', '2018-03-14 01:31:20', NULL),
(14, 'delete_pages', 'pages', '2018-03-14 01:31:20', '2018-03-14 01:31:20', NULL),
(15, 'browse_roles', 'roles', '2018-03-14 01:31:20', '2018-03-14 01:31:20', NULL),
(16, 'read_roles', 'roles', '2018-03-14 01:31:20', '2018-03-14 01:31:20', NULL),
(17, 'edit_roles', 'roles', '2018-03-14 01:31:20', '2018-03-14 01:31:20', NULL),
(18, 'add_roles', 'roles', '2018-03-14 01:31:20', '2018-03-14 01:31:20', NULL),
(19, 'delete_roles', 'roles', '2018-03-14 01:31:20', '2018-03-14 01:31:20', NULL),
(20, 'browse_users', 'users', '2018-03-14 01:31:20', '2018-03-14 01:31:20', NULL),
(21, 'read_users', 'users', '2018-03-14 01:31:20', '2018-03-14 01:31:20', NULL),
(22, 'edit_users', 'users', '2018-03-14 01:31:21', '2018-03-14 01:31:21', NULL),
(23, 'add_users', 'users', '2018-03-14 01:31:21', '2018-03-14 01:31:21', NULL),
(24, 'delete_users', 'users', '2018-03-14 01:31:21', '2018-03-14 01:31:21', NULL),
(25, 'browse_posts', 'posts', '2018-03-14 01:31:21', '2018-03-14 01:31:21', NULL),
(26, 'read_posts', 'posts', '2018-03-14 01:31:21', '2018-03-14 01:31:21', NULL),
(27, 'edit_posts', 'posts', '2018-03-14 01:31:21', '2018-03-14 01:31:21', NULL),
(28, 'add_posts', 'posts', '2018-03-14 01:31:21', '2018-03-14 01:31:21', NULL),
(29, 'delete_posts', 'posts', '2018-03-14 01:31:21', '2018-03-14 01:31:21', NULL),
(30, 'browse_categories', 'categories', '2018-03-14 01:31:21', '2018-03-14 01:31:21', NULL),
(31, 'read_categories', 'categories', '2018-03-14 01:31:21', '2018-03-14 01:31:21', NULL),
(32, 'edit_categories', 'categories', '2018-03-14 01:31:21', '2018-03-14 01:31:21', NULL),
(33, 'add_categories', 'categories', '2018-03-14 01:31:21', '2018-03-14 01:31:21', NULL),
(34, 'delete_categories', 'categories', '2018-03-14 01:31:21', '2018-03-14 01:31:21', NULL),
(35, 'browse_settings', 'settings', '2018-03-14 01:31:22', '2018-03-14 01:31:22', NULL),
(36, 'read_settings', 'settings', '2018-03-14 01:31:22', '2018-03-14 01:31:22', NULL),
(37, 'edit_settings', 'settings', '2018-03-14 01:31:22', '2018-03-14 01:31:22', NULL),
(38, 'add_settings', 'settings', '2018-03-14 01:31:22', '2018-03-14 01:31:22', NULL),
(39, 'delete_settings', 'settings', '2018-03-14 01:31:22', '2018-03-14 01:31:22', NULL),
(40, 'browse_hooks', NULL, '2018-03-14 01:31:26', '2018-03-14 01:31:26', NULL),
(41, 'browse_sub_categorias', 'sub_categorias', '2018-03-14 09:13:02', '2018-03-14 09:13:02', NULL),
(42, 'read_sub_categorias', 'sub_categorias', '2018-03-14 09:13:02', '2018-03-14 09:13:02', NULL),
(43, 'edit_sub_categorias', 'sub_categorias', '2018-03-14 09:13:02', '2018-03-14 09:13:02', NULL),
(44, 'add_sub_categorias', 'sub_categorias', '2018-03-14 09:13:02', '2018-03-14 09:13:02', NULL),
(45, 'delete_sub_categorias', 'sub_categorias', '2018-03-14 09:13:02', '2018-03-14 09:13:02', NULL),
(46, 'browse_categorias', 'categorias', '2018-03-14 09:18:19', '2018-03-14 09:18:19', NULL),
(47, 'read_categorias', 'categorias', '2018-03-14 09:18:19', '2018-03-14 09:18:19', NULL),
(48, 'edit_categorias', 'categorias', '2018-03-14 09:18:19', '2018-03-14 09:18:19', NULL),
(49, 'add_categorias', 'categorias', '2018-03-14 09:18:19', '2018-03-14 09:18:19', NULL),
(50, 'delete_categorias', 'categorias', '2018-03-14 09:18:19', '2018-03-14 09:18:19', NULL),
(51, 'browse_info_pais', 'info_pais', '2018-03-14 09:22:57', '2018-03-14 09:22:57', NULL),
(52, 'read_info_pais', 'info_pais', '2018-03-14 09:22:57', '2018-03-14 09:22:57', NULL),
(53, 'edit_info_pais', 'info_pais', '2018-03-14 09:22:57', '2018-03-14 09:22:57', NULL),
(54, 'add_info_pais', 'info_pais', '2018-03-14 09:22:57', '2018-03-14 09:22:57', NULL),
(55, 'delete_info_pais', 'info_pais', '2018-03-14 09:22:57', '2018-03-14 09:22:57', NULL),
(56, 'browse_perfil_staffs', 'perfil_staffs', '2018-03-14 09:35:34', '2018-03-14 09:35:34', NULL),
(57, 'read_perfil_staffs', 'perfil_staffs', '2018-03-14 09:35:34', '2018-03-14 09:35:34', NULL),
(58, 'edit_perfil_staffs', 'perfil_staffs', '2018-03-14 09:35:34', '2018-03-14 09:35:34', NULL),
(59, 'add_perfil_staffs', 'perfil_staffs', '2018-03-14 09:35:34', '2018-03-14 09:35:34', NULL),
(60, 'delete_perfil_staffs', 'perfil_staffs', '2018-03-14 09:35:34', '2018-03-14 09:35:34', NULL),
(61, 'browse_emails', 'emails', '2018-03-14 09:44:37', '2018-03-14 09:44:37', NULL),
(62, 'read_emails', 'emails', '2018-03-14 09:44:37', '2018-03-14 09:44:37', NULL),
(63, 'edit_emails', 'emails', '2018-03-14 09:44:37', '2018-03-14 09:44:37', NULL),
(64, 'add_emails', 'emails', '2018-03-14 09:44:37', '2018-03-14 09:44:37', NULL),
(65, 'delete_emails', 'emails', '2018-03-14 09:44:37', '2018-03-14 09:44:37', NULL),
(66, 'browse_productos', 'productos', '2018-03-14 22:50:50', '2018-03-14 22:50:50', NULL),
(67, 'read_productos', 'productos', '2018-03-14 22:50:50', '2018-03-14 22:50:50', NULL),
(68, 'edit_productos', 'productos', '2018-03-14 22:50:50', '2018-03-14 22:50:50', NULL),
(69, 'add_productos', 'productos', '2018-03-14 22:50:50', '2018-03-14 22:50:50', NULL),
(70, 'delete_productos', 'productos', '2018-03-14 22:50:50', '2018-03-14 22:50:50', NULL),
(71, 'browse_num_contactos', 'num_contactos', '2018-03-15 00:50:58', '2018-03-15 00:50:58', NULL),
(72, 'read_num_contactos', 'num_contactos', '2018-03-15 00:50:58', '2018-03-15 00:50:58', NULL),
(73, 'edit_num_contactos', 'num_contactos', '2018-03-15 00:50:58', '2018-03-15 00:50:58', NULL),
(74, 'add_num_contactos', 'num_contactos', '2018-03-15 00:50:58', '2018-03-15 00:50:58', NULL),
(75, 'delete_num_contactos', 'num_contactos', '2018-03-15 00:50:58', '2018-03-15 00:50:58', NULL),
(81, 'browse_rede_social', 'rede_social', '2018-03-15 19:24:28', '2018-03-15 19:24:28', NULL),
(82, 'read_rede_social', 'rede_social', '2018-03-15 19:24:28', '2018-03-15 19:24:28', NULL),
(83, 'edit_rede_social', 'rede_social', '2018-03-15 19:24:28', '2018-03-15 19:24:28', NULL),
(84, 'add_rede_social', 'rede_social', '2018-03-15 19:24:28', '2018-03-15 19:24:28', NULL),
(85, 'delete_rede_social', 'rede_social', '2018-03-15 19:24:28', '2018-03-15 19:24:28', NULL);
-- --------------------------------------------------------
--
-- Estrutura da tabela `permission_groups`
--
DROP TABLE IF EXISTS `permission_groups`;
CREATE TABLE `permission_groups` (
`id` int(10) UNSIGNED NOT NULL,
`name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC;
-- --------------------------------------------------------
--
-- Estrutura da tabela `permission_role`
--
DROP TABLE IF EXISTS `permission_role`;
CREATE TABLE `permission_role` (
`permission_id` int(10) UNSIGNED NOT NULL,
`role_id` int(10) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC;
--
-- Extraindo dados da tabela `permission_role`
--
INSERT INTO `permission_role` (`permission_id`, `role_id`) VALUES
(1, 1),
(1, 2),
(2, 1),
(3, 1),
(3, 2),
(4, 1),
(5, 1),
(5, 2),
(6, 1),
(6, 2),
(7, 1),
(8, 1),
(9, 1),
(10, 1),
(11, 1),
(12, 1),
(13, 1),
(14, 1),
(15, 1),
(16, 1),
(17, 1),
(18, 1),
(19, 1),
(20, 1),
(21, 1),
(22, 1),
(23, 1),
(24, 1),
(25, 1),
(26, 1),
(27, 1),
(28, 1),
(29, 1),
(30, 1),
(31, 1),
(32, 1),
(33, 1),
(34, 1),
(35, 1),
(36, 1),
(37, 1),
(38, 1),
(39, 1),
(41, 1),
(41, 2),
(42, 1),
(42, 2),
(43, 1),
(43, 2),
(44, 1),
(44, 2),
(45, 1),
(45, 2),
(46, 1),
(46, 2),
(47, 1),
(47, 2),
(48, 1),
(48, 2),
(49, 1),
(49, 2),
(50, 1),
(50, 2),
(51, 1),
(51, 2),
(52, 1),
(52, 2),
(53, 1),
(53, 2),
(54, 1),
(54, 2),
(55, 1),
(55, 2),
(56, 1),
(56, 2),
(57, 1),
(57, 2),
(58, 1),
(58, 2),
(59, 1),
(59, 2),
(60, 1),
(60, 2),
(61, 1),
(61, 2),
(62, 1),
(62, 2),
(63, 1),
(63, 2),
(64, 1),
(64, 2),
(65, 1),
(65, 2),
(66, 1),
(66, 2),
(67, 1),
(67, 2),
(68, 1),
(68, 2),
(69, 1),
(69, 2),
(70, 1),
(70, 2),
(71, 1),
(71, 2),
(72, 1),
(72, 2),
(73, 1),
(73, 2),
(74, 1),
(74, 2),
(75, 1),
(75, 2),
(81, 1),
(81, 2),
(82, 1),
(82, 2),
(83, 1),
(83, 2),
(84, 1),
(84, 2),
(85, 1),
(85, 2);
-- --------------------------------------------------------
--
-- Estrutura da tabela `posts`
--
DROP TABLE IF EXISTS `posts`;
CREATE TABLE `posts` (
`id` int(10) UNSIGNED NOT NULL,
`author_id` int(11) NOT NULL,
`category_id` int(11) DEFAULT NULL,
`title` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`seo_title` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`excerpt` text COLLATE utf8mb4_unicode_ci,
`body` text COLLATE utf8mb4_unicode_ci NOT NULL,
`image` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`slug` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`meta_description` text COLLATE utf8mb4_unicode_ci,
`meta_keywords` text COLLATE utf8mb4_unicode_ci,
`status` enum('PUBLISHED','DRAFT','PENDING') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'DRAFT',
`featured` tinyint(1) NOT NULL DEFAULT '0',
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC;
-- --------------------------------------------------------
--
-- Estrutura da tabela `productos`
--
DROP TABLE IF EXISTS `productos`;
CREATE TABLE `productos` (
`id` int(10) UNSIGNED NOT NULL,
`nome` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`slug` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`descricao` text COLLATE utf8mb4_unicode_ci NOT NULL,
`preco` int(11) NOT NULL,
`preco_promocao` int(11) DEFAULT '0',
`quantidade` int(11) NOT NULL,
`thumbnail` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`imagens` text COLLATE utf8mb4_unicode_ci,
`views` bigint(20) NOT NULL DEFAULT '0',
`sub_categoria_id` int(10) UNSIGNED DEFAULT NULL,
`estado_producto_id` int(10) UNSIGNED DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC;
--
-- Extraindo dados da tabela `productos`
--
INSERT INTO `productos` (`id`, `nome`, `slug`, `descricao`, `preco`, `preco_promocao`, `quantidade`, `thumbnail`, `imagens`, `views`, `sub_categoria_id`, `estado_producto_id`, `created_at`, `updated_at`) VALUES
(1, 'Brinco de Ferro', 'brinco-de-ferro', 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod\n tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,\n quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo\n consequat.', 3000, 1000, 2, 'produto(2)', NULL, 6, 1, NULL, NULL, '2018-03-12 16:13:47'),
(2, 'Brinco de Pano', 'brinco-de-pano', 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod\n tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,\n quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo\n consequat.', 3000, 0, 1, 'produto(2)', NULL, 9, 1, NULL, NULL, '2018-03-12 19:29:42'),
(3, 'Brinco de Crochê', 'brinco-de-croche', '<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>', 3000, 2560, 1, 'produto(2)', NULL, 10, 2, 1, NULL, '2018-03-14 23:49:20'),
(4, 'Colar de Tecido', 'colar-de-tecido', 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod\n tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,\n quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo\n consequat.', 5500, 3990, 1, 'produto(1)', NULL, 2, 1, NULL, NULL, NULL),
(5, 'Brinco de Madeira', 'brinco-de-madeira', 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.', 3000, NULL, 2, 'productos/February2018/kr9ol0sYBo34kULa73OR.jpg', NULL, 55, 1, NULL, '2018-02-03 22:00:00', '2018-03-05 13:01:54'),
(6, 'Brinco Arrojado', 'brinco-arrojado', 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.', 3000, 2000, 1, 'productos/February2018/UuEvzCXUHuz9XPb9nY57.jpg', NULL, 30, 1, NULL, '2018-01-31 22:00:00', '2018-03-05 13:01:27'),
(7, 'Brinco CC', 'brinco-CC', 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.', 3000, NULL, 1, 'productos/February2018/ZKMNgvlXtJws6L1sAYa8.jpg', NULL, 8, 1, NULL, '2018-02-17 22:00:00', '2018-03-03 12:27:20'),
(8, 'Colar Arrojado (Edição Limitada)', 'colar-arrojado-edicao-limitada', 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.', 5500, NULL, 1, 'productos/February2018/ujCOAiItzGdYRjI0tA4s.jpg', NULL, 15, 1, NULL, '2018-02-01 22:00:00', '2018-02-28 20:48:44'),
(9, 'Brinco de Plastico', 'brinco-de-plastico', 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.', 2000, NULL, 1, 'productos/February2018/PgZcm35tJm0izpsOtbE6.jpg', NULL, 10, 1, NULL, '2018-02-16 11:50:14', '2018-03-05 13:02:41'),
(10, 'Brinco de bolinha', 'brinco-de-bolinha', '<p>Novas tendencias</p>\r\n<p style=\"text-align: left;\">Materiais utilizados:</p>\r\n<ul>\r\n<li>Tecidos</li>\r\n<li>Bolinhas</li>\r\n</ul>\r\n<p> </p>', 2900, NULL, 1, 'productos/March2018/E2PXxJsUENirx6EC8jWl.jpg', '[\"productos\\/March2018\\/u03Q15XYq6clqt0wDTCt.jpeg\",\"productos\\/March2018\\/pnz6iTqd2L2qyFOR23iu.jpeg\",\"productos\\/March2018\\/pNCq5w0eMB65PsHo5I0W.jpeg\",\"productos\\/March2018\\/xIOO9A1ZesR1SlENk9x1.jpg\"]', 41, 1, 1, '2018-02-28 18:07:11', '2018-03-14 23:43:41'),
(11, 'Carteira (Mulher Africana)', 'carteira-(mulher-africana)', '<p>This morning it\'s been rainy here, so I\'m off the road. Decided it was a good time/opportunity to do some work on a little project that I\'ve had brewing in my back brain for several years.</p>', 5000, 0, 1, 'productos/March2018/F7u5EXalaVqhEIA1YirL.jpeg', NULL, 1, 1, NULL, '2018-03-05 12:04:55', '2018-03-05 13:01:33'),
(18, 'Colar Cai-Cai', 'colar-cai-cai', '<p>If I had the time / inclination to do it properly, I would learn enough code to create the app myself, but I\'ve never been a programmer - not really on any \'true\' level.</p>\r\n<p>I can figure out Google Spreadsheets though, and I just <em>knew </em>that there had to be a way to do what I\'m looking for in there.</p>\r\n<p>I\'m here to say that I\'ve figured it out!</p>', 7000, 0, 1, 'productos/March2018/qguACNYeCZBr9mGyHYtb.jpeg', NULL, 1, 1, 1, '2018-03-05 12:07:15', '2018-03-14 23:50:02');
-- --------------------------------------------------------
--
-- Estrutura da tabela `rede_social`
--
DROP TABLE IF EXISTS `rede_social`;
CREATE TABLE `rede_social` (
`id` int(10) UNSIGNED NOT NULL,
`nome` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`endereco_url` text COLLATE utf8mb4_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC;
--
-- Extraindo dados da tabela `rede_social`
--
INSERT INTO `rede_social` (`id`, `nome`, `endereco_url`) VALUES
(1, 'facebook', 'http://facebook.com/'),
(2, 'instagram', 'http://instagram.com/');
-- --------------------------------------------------------
--
-- Estrutura da tabela `roles`
--
DROP TABLE IF EXISTS `roles`;
CREATE TABLE `roles` (
`id` int(10) UNSIGNED NOT NULL,
`name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`display_name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC;
--
-- Extraindo dados da tabela `roles`
--
INSERT INTO `roles` (`id`, `name`, `display_name`, `created_at`, `updated_at`) VALUES
(1, 'admin', 'Administrator', '2018-03-14 01:26:07', '2018-03-14 01:26:07'),
(2, 'user', 'Normal User', '2018-03-14 01:31:18', '2018-03-14 01:31:18');
-- --------------------------------------------------------
--
-- Estrutura da tabela `settings`
--
DROP TABLE IF EXISTS `settings`;
CREATE TABLE `settings` (
`id` int(10) UNSIGNED NOT NULL,
`key` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`display_name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`value` text COLLATE utf8mb4_unicode_ci NOT NULL,
`details` text COLLATE utf8mb4_unicode_ci,
`type` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`order` int(11) NOT NULL DEFAULT '1',
`group` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC;
--
-- Extraindo dados da tabela `settings`
--
INSERT INTO `settings` (`id`, `key`, `display_name`, `value`, `details`, `type`, `order`, `group`) VALUES
(1, 'site.title', 'Site Title', 'Nachy San', '', 'text', 1, 'Site'),
(2, 'site.description', 'Site Description', 'Artesanatos', '', 'text', 2, 'Site'),
(3, 'site.logo', 'Site Logo', '', '', 'image', 3, 'Site'),
(4, 'site.google_analytics_tracking_id', 'Google Analytics Tracking ID', '', '', 'text', 4, 'Site'),
(5, 'admin.bg_image', 'Admin Background Image', 'settings/March2018/c8HAWUN8tpYB9wuO3vfI.jpg', '', 'image', 5, 'Admin'),
(6, 'admin.title', 'Admin Title', 'Nachy San', '', 'text', 1, 'Admin'),
(7, 'admin.description', 'Admin Description', 'Artesanatos com a liberdade de respirar.', '', 'text', 2, 'Admin'),
(8, 'admin.loader', 'Admin Loader', '', '', 'image', 3, 'Admin'),
(9, 'admin.icon_image', 'Admin Icon Image', '', '', 'image', 4, 'Admin'),
(10, 'admin.google_analytics_client_id', 'Google Analytics Client ID (used for admin dashboard)', '', '', 'text', 1, 'Admin');
-- --------------------------------------------------------
--
-- Estrutura da tabela `sub_categorias`
--
DROP TABLE IF EXISTS `sub_categorias`;
CREATE TABLE `sub_categorias` (
`id` int(10) UNSIGNED NOT NULL,
`nome` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`slug` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC;
--
-- Extraindo dados da tabela `sub_categorias`
--
INSERT INTO `sub_categorias` (`id`, `nome`, `slug`) VALUES
(1, 'Brincos', 'brincos'),
(2, 'Pastas', 'pastas'),
(3, 'Bolsas', 'bolsas');
-- --------------------------------------------------------
--
-- Estrutura da tabela `translations`
--
DROP TABLE IF EXISTS `translations`;
CREATE TABLE `translations` (
`id` int(10) UNSIGNED NOT NULL,
`table_name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`column_name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`foreign_key` int(10) UNSIGNED NOT NULL,
`locale` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`value` text COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC;
-- --------------------------------------------------------
--
-- Estrutura da tabela `users`
--
DROP TABLE IF EXISTS `users`;
CREATE TABLE `users` (
`id` int(10) UNSIGNED NOT NULL,
`role_id` int(11) DEFAULT NULL,
`name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`email` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`avatar` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT 'users/default.png',
`password` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`remember_token` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC;
--
-- Extraindo dados da tabela `users`
--
INSERT INTO `users` (`id`, `role_id`, `name`, `email`, `avatar`, `password`, `remember_token`, `created_at`, `updated_at`) VALUES
(1, 1, 'admin', 'admin@admin.com', 'users/default.png', '$2y$10$5x/KEz09Avwyt15KEUwCcekB/qWHHttm2zqPyxhrbFn0Vd2W.91Q2', 't2ViCxeWBGx4XINcdd7nQUY7IMlXIm4nwdiaGeEvu8Ev91SLUjKgA3PCF96o', '2018-03-14 01:26:05', '2018-03-14 01:26:07'),
(2, 2, 'Nachy San', 'your@email.com', 'users/default.png', '$2y$10$DcTntcoa9CpK.9hywO27SezerLPsu89ThWSxy76DT5hkD3QcCSyN2', 'C0ZollIexeiA0GNNKmX1t2GsMCHZXmy8eyhC3yQsN0r1RdVrF5zjLE73fwrJ', '2018-03-15 01:06:41', '2018-03-15 01:06:41');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `categorias`
--
ALTER TABLE `categorias`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `categorias_nome_unique` (`nome`),
ADD UNIQUE KEY `categorias_slug_unique` (`slug`);
--
-- Indexes for table `categoria_producto`
--
ALTER TABLE `categoria_producto`
ADD PRIMARY KEY (`id`),
ADD KEY `categoria_producto_producto_id_foreign` (`producto_id`),
ADD KEY `categoria_producto_categoria_id_foreign` (`categoria_id`);
--
-- Indexes for table `categoria_sub_categoria`
--
ALTER TABLE `categoria_sub_categoria`
ADD PRIMARY KEY (`id`),
ADD KEY `categoria_sub_categoria_categoria_id_foreign` (`categoria_id`),
ADD KEY `categoria_sub_categoria_sub_categoria_id_foreign` (`sub_categoria_id`);
--
-- Indexes for table `categories`
--
ALTER TABLE `categories`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `categories_slug_unique` (`slug`),
ADD KEY `categories_parent_id_foreign` (`parent_id`);
--
-- Indexes for table `data_rows`
--
ALTER TABLE `data_rows`
ADD PRIMARY KEY (`id`),
ADD KEY `data_rows_data_type_id_foreign` (`data_type_id`);
--
-- Indexes for table `data_types`
--
ALTER TABLE `data_types`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `data_types_name_unique` (`name`),
ADD UNIQUE KEY `data_types_slug_unique` (`slug`);
--
-- Indexes for table `descricao_tipos`
--
ALTER TABLE `descricao_tipos`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `descricao_tipos_nome_unique` (`nome`);
--
-- Indexes for table `emails`
--
ALTER TABLE `emails`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `emails_email_unique` (`email`),
ADD KEY `emails_descricao_tipo_id_foreign` (`descricao_tipo_id`);
--
-- Indexes for table `estado_productos`
--
ALTER TABLE `estado_productos`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `info_pais`
--
ALTER TABLE `info_pais`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `info_pais_pais_unique` (`pais`),
ADD UNIQUE KEY `info_pais_contacto_id_unique` (`contacto_id`);
--
-- Indexes for table `menus`
--
ALTER TABLE `menus`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `menus_name_unique` (`name`);
--
-- Indexes for table `menu_items`
--
ALTER TABLE `menu_items`
ADD PRIMARY KEY (`id`),
ADD KEY `menu_items_menu_id_foreign` (`menu_id`);
--
-- Indexes for table `migrations`
--
ALTER TABLE `migrations`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `num_contactos`
--
ALTER TABLE `num_contactos`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `num_contactos_contacto_unique` (`contacto`),
ADD KEY `num_contactos_descricao_tipo_id_foreign` (`descricao_tipo_id`);
--
-- Indexes for table `pages`
--
ALTER TABLE `pages`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `pages_slug_unique` (`slug`);
--
-- Indexes for table `password_resets`
--
ALTER TABLE `password_resets`
ADD KEY `password_resets_email_index` (`email`);
--
-- Indexes for table `perfil_staffs`
--
ALTER TABLE `perfil_staffs`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `perfil_staffs_nome_unique` (`nome`);
--
-- Indexes for table `permissions`
--
ALTER TABLE `permissions`
ADD PRIMARY KEY (`id`),
ADD KEY `permissions_key_index` (`key`);
--
-- Indexes for table `permission_groups`
--
ALTER TABLE `permission_groups`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `permission_groups_name_unique` (`name`);
--
-- Indexes for table `permission_role`
--
ALTER TABLE `permission_role`
ADD PRIMARY KEY (`permission_id`,`role_id`),
ADD KEY `permission_role_permission_id_index` (`permission_id`),
ADD KEY `permission_role_role_id_index` (`role_id`);
--
-- Indexes for table `posts`
--
ALTER TABLE `posts`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `posts_slug_unique` (`slug`);
--
-- Indexes for table `productos`
--
ALTER TABLE `productos`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `productos_nome_unique` (`nome`),
ADD UNIQUE KEY `productos_slug_unique` (`slug`),
ADD KEY `productos_sub_categoria_id_foreign` (`sub_categoria_id`),
ADD KEY `productos_estado_producto_id_foreign` (`estado_producto_id`);
--
-- Indexes for table `rede_social`
--
ALTER TABLE `rede_social`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `rede_social_nome_unique` (`nome`);
--
-- Indexes for table `roles`
--
ALTER TABLE `roles`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `roles_name_unique` (`name`);
--
-- Indexes for table `settings`
--
ALTER TABLE `settings`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `settings_key_unique` (`key`);
--
-- Indexes for table `sub_categorias`
--
ALTER TABLE `sub_categorias`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `sub_categorias_nome_unique` (`nome`),
ADD UNIQUE KEY `sub_categorias_slug_unique` (`slug`);
--
-- Indexes for table `translations`
--
ALTER TABLE `translations`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `translations_table_name_column_name_foreign_key_locale_unique` (`table_name`,`column_name`,`foreign_key`,`locale`);
--
-- Indexes for table `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `users_email_unique` (`email`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `categorias`
--
ALTER TABLE `categorias`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT for table `categoria_producto`
--
ALTER TABLE `categoria_producto`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT for table `categoria_sub_categoria`
--
ALTER TABLE `categoria_sub_categoria`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT for table `categories`
--
ALTER TABLE `categories`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `data_rows`
--
ALTER TABLE `data_rows`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=105;
--
-- AUTO_INCREMENT for table `data_types`
--
ALTER TABLE `data_types`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=16;
--
-- AUTO_INCREMENT for table `descricao_tipos`
--
ALTER TABLE `descricao_tipos`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `emails`
--
ALTER TABLE `emails`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `estado_productos`
--
ALTER TABLE `estado_productos`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `info_pais`
--
ALTER TABLE `info_pais`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `menus`
--
ALTER TABLE `menus`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `menu_items`
--
ALTER TABLE `menu_items`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=24;
--
-- AUTO_INCREMENT for table `migrations`
--
ALTER TABLE `migrations`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=36;
--
-- AUTO_INCREMENT for table `num_contactos`
--
ALTER TABLE `num_contactos`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT for table `pages`
--
ALTER TABLE `pages`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `perfil_staffs`
--
ALTER TABLE `perfil_staffs`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;
--
-- AUTO_INCREMENT for table `permissions`
--
ALTER TABLE `permissions`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=86;
--
-- AUTO_INCREMENT for table `permission_groups`
--
ALTER TABLE `permission_groups`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `posts`
--
ALTER TABLE `posts`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `productos`
--
ALTER TABLE `productos`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=19;
--
-- AUTO_INCREMENT for table `rede_social`
--
ALTER TABLE `rede_social`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `roles`
--
ALTER TABLE `roles`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `settings`
--
ALTER TABLE `settings`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11;
--
-- AUTO_INCREMENT for table `sub_categorias`
--
ALTER TABLE `sub_categorias`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT for table `translations`
--
ALTER TABLE `translations`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- Constraints for dumped tables
--
--
-- Limitadores para a tabela `categoria_producto`
--
ALTER TABLE `categoria_producto`
ADD CONSTRAINT `categoria_producto_categoria_id_foreign` FOREIGN KEY (`categoria_id`) REFERENCES `categorias` (`id`) ON DELETE CASCADE,
ADD CONSTRAINT `categoria_producto_producto_id_foreign` FOREIGN KEY (`producto_id`) REFERENCES `productos` (`id`) ON DELETE CASCADE;
--
-- Limitadores para a tabela `categoria_sub_categoria`
--
ALTER TABLE `categoria_sub_categoria`
ADD CONSTRAINT `categoria_sub_categoria_categoria_id_foreign` FOREIGN KEY (`categoria_id`) REFERENCES `categorias` (`id`) ON DELETE CASCADE,
ADD CONSTRAINT `categoria_sub_categoria_sub_categoria_id_foreign` FOREIGN KEY (`sub_categoria_id`) REFERENCES `sub_categorias` (`id`);
--
-- Limitadores para a tabela `categories`
--
ALTER TABLE `categories`
ADD CONSTRAINT `categories_parent_id_foreign` FOREIGN KEY (`parent_id`) REFERENCES `categories` (`id`) ON DELETE SET NULL ON UPDATE CASCADE;
--
-- Limitadores para a tabela `data_rows`
--
ALTER TABLE `data_rows`
ADD CONSTRAINT `data_rows_data_type_id_foreign` FOREIGN KEY (`data_type_id`) REFERENCES `data_types` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Limitadores para a tabela `emails`
--
ALTER TABLE `emails`
ADD CONSTRAINT `emails_descricao_tipo_id_foreign` FOREIGN KEY (`descricao_tipo_id`) REFERENCES `descricao_tipos` (`id`);
--
-- Limitadores para a tabela `menu_items`
--
ALTER TABLE `menu_items`
ADD CONSTRAINT `menu_items_menu_id_foreign` FOREIGN KEY (`menu_id`) REFERENCES `menus` (`id`) ON DELETE CASCADE;
--
-- Limitadores para a tabela `num_contactos`
--
ALTER TABLE `num_contactos`
ADD CONSTRAINT `num_contactos_descricao_tipo_id_foreign` FOREIGN KEY (`descricao_tipo_id`) REFERENCES `descricao_tipos` (`id`);
--
-- Limitadores para a tabela `permission_role`
--
ALTER TABLE `permission_role`
ADD CONSTRAINT `permission_role_permission_id_foreign` FOREIGN KEY (`permission_id`) REFERENCES `permissions` (`id`) ON DELETE CASCADE,
ADD CONSTRAINT `permission_role_role_id_foreign` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`) ON DELETE CASCADE;
--
-- Limitadores para a tabela `productos`
--
ALTER TABLE `productos`
ADD CONSTRAINT `productos_estado_producto_id_foreign` FOREIGN KEY (`estado_producto_id`) REFERENCES `estado_productos` (`id`),
ADD CONSTRAINT `productos_sub_categoria_id_foreign` FOREIGN KEY (`sub_categoria_id`) REFERENCES `sub_categorias` (`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 */;
| true |
0bf727d2e1a9ef6ba1647aa7b7bfc329a48b2601 | SQL | dongnhat97/C0421G1_Module3_DongVanNhat | /Furuma_Resort/insert_table.sql | UTF-8 | 854 | 2.8125 | 3 | [] | no_license | use furuma_resort;
-- Thêm vị trí
insert into position (position_name)
value ('lễ tân'),('phục vụ'),('chuyên viên'),('giám sát'),('quản lý'),('giám đốc');
-- Thêm trình độ
insert into education_degree (education_degree_name)
value ('Trung cấp'),('Cao đẳng'),('Đại học'),('sau Đại học');
-- Thêm bộ phận
insert into division (division_name)
value ( 'sale_marketing'),('hành chính'),('phục vụ'),('quản lý');
-- Thêm loại khách hàng
insert into customer_type (customer_type_name)
value('Diamond'), ('Platinium'), ('Gold'), ('Silver'), ('Member');
-- Thêm loại dịch vụ
insert into service_type (service_type_name)
value('villa'),('house'),('room');
-- thêm kiểu thuê
insert into rent_type (rent_type_name)
value('Hour'),('day'),('month'),('year');
| true |
0a87092db18a338a831fa76bb7a754042f9ffe97 | SQL | daimaniu/fence-demo | /fence-dao/127.0.0.1--16-7-9.19-25-fence.sql | UTF-8 | 2,034 | 2.984375 | 3 | [] | no_license | # ************************************************************
# Sequel Pro SQL dump
# Version 4541
#
# http://www.sequelpro.com/
# https://github.com/sequelpro/sequelpro
#
# Host: 127.0.0.1 (MySQL 5.6.20)
# Database: fence
# Generation Time: 2016-07-09 11:25:47 +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 fence
# ------------------------------------------------------------
DROP TABLE IF EXISTS `fence`;
CREATE TABLE `fence` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`type` int(2) DEFAULT NULL COMMENT '1 圆形 2 多边形',
`lng` double DEFAULT NULL,
`lat` double DEFAULT NULL,
`address` varchar(255) DEFAULT NULL,
`circle` varchar(128) DEFAULT NULL,
`polygon` varchar(255) DEFAULT NULL,
`created` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
# Dump of table upload_log
# ------------------------------------------------------------
DROP TABLE IF EXISTS `upload_log`;
CREATE TABLE `upload_log` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`lat` double DEFAULT NULL,
`lng` double DEFAULT NULL,
`valid` int(11) DEFAULT NULL,
`created` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true |
fa1c38d362fc8fe12ad90aedd2c24e6603faf00e | SQL | DarthWolf1479/CodeProyectoTeam3 | /Base_de_Datos/mibase.sql | UTF-8 | 4,427 | 2.828125 | 3 | [] | no_license | -- MySQL dump 10.13 Distrib 5.7.17, for Win64 (x86_64)
--
-- Host: localhost Database: logindb
-- ------------------------------------------------------
-- Server version 5.7.17-log
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `alumnos`
--
DROP TABLE IF EXISTS `alumnos`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `alumnos` (
`nombre` varchar(50) COLLATE utf8_spanish2_ci NOT NULL,
`codigo` int(11) NOT NULL,
PRIMARY KEY (`codigo`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_spanish2_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `alumnos`
--
LOCK TABLES `alumnos` WRITE;
/*!40000 ALTER TABLE `alumnos` DISABLE KEYS */;
INSERT INTO `alumnos` VALUES ('Messi',1010),('fabi',1212),('miguel',2222),('Ronaldo',4444);
/*!40000 ALTER TABLE `alumnos` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `materia`
--
DROP TABLE IF EXISTS `materia`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `materia` (
`nombre` varchar(50) COLLATE utf8_spanish2_ci NOT NULL,
`codigo` int(20) NOT NULL,
`aula` varchar(20) COLLATE utf8_spanish2_ci NOT NULL,
PRIMARY KEY (`codigo`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_spanish2_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `materia`
--
LOCK TABLES `materia` WRITE;
/*!40000 ALTER TABLE `materia` DISABLE KEYS */;
INSERT INTO `materia` VALUES ('Computacion',4545,'u8'),('Matematicas',8989,'l3');
/*!40000 ALTER TABLE `materia` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `profesor`
--
DROP TABLE IF EXISTS `profesor`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `profesor` (
`nombre` varchar(50) COLLATE utf8_spanish2_ci NOT NULL,
`codigo` int(11) NOT NULL,
PRIMARY KEY (`codigo`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_spanish2_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `profesor`
--
LOCK TABLES `profesor` WRITE;
/*!40000 ALTER TABLE `profesor` DISABLE KEYS */;
INSERT INTO `profesor` VALUES ('Alberto',1212),('kiki',5555);
/*!40000 ALTER TABLE `profesor` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `usuarios`
--
DROP TABLE IF EXISTS `usuarios`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `usuarios` (
`id-usuario` int(11) NOT NULL AUTO_INCREMENT,
`nombre` varchar(50) COLLATE utf8_spanish2_ci NOT NULL,
`pass` varchar(20) COLLATE utf8_spanish2_ci NOT NULL,
`Apellido` varchar(50) COLLATE utf8_spanish2_ci NOT NULL,
`Correo` varchar(50) COLLATE utf8_spanish2_ci NOT NULL,
PRIMARY KEY (`id-usuario`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8 COLLATE=utf8_spanish2_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `usuarios`
--
LOCK TABLES `usuarios` WRITE;
/*!40000 ALTER TABLE `usuarios` DISABLE KEYS */;
INSERT INTO `usuarios` VALUES (7,'Pepe','2222','Pepito','pepe13@hotmail.com'),(8,'luchioo','1919','alvarez','luchoakd07@gmail.com'),(9,'luisegp','1818','egp','lucho@gmail.com');
/*!40000 ALTER TABLE `usuarios` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2017-06-04 15:14:27
| true |
3f0f0037ebe6fdc94da8a13cf0d3571be509d4ee | SQL | Jason-Cooke/bigquery-etl | /sql/telemetry_derived/smoot_usage_nondesktop_v2/query.sql | UTF-8 | 4,773 | 3.609375 | 4 | [] | no_license | CREATE TEMP FUNCTION
udf_bitmask_lowest_7() AS (0x7F);
CREATE TEMP FUNCTION
udf_active_n_weeks_ago(x INT64, n INT64)
RETURNS BOOLEAN
AS (
BIT_COUNT(x >> (7 * n) & udf_bitmask_lowest_7()) > 0
);
CREATE TEMP FUNCTION
udf_bitcount_lowest_7(x INT64) AS (
BIT_COUNT(x & udf_bitmask_lowest_7())
);
CREATE TEMP FUNCTION
udf_bitpos( bits INT64 ) AS ( CAST(SAFE.LOG(bits & -bits, 2) AS INT64));
CREATE TEMP FUNCTION
udf_smoot_usage_from_bits(
bit_arrays ARRAY<STRUCT<days_created_profile_bits INT64, days_active_bits INT64>>)
AS ((
WITH
unnested AS (
SELECT
days_active_bits AS bits,
udf_bitpos(days_created_profile_bits) AS dnp,
udf_bitpos(days_active_bits) AS days_since_active,
udf_bitcount_lowest_7(days_active_bits) AS active_days_in_week
FROM
UNNEST(bit_arrays) )
SELECT AS STRUCT
COUNTIF(bits > 0) = 0 AS is_empty_group,
STRUCT(
COUNTIF(days_since_active < 1) AS dau,
COUNTIF(days_since_active < 7) AS wau,
COUNTIF(days_since_active < 28) AS mau,
SUM(active_days_in_week) AS active_days_in_week
) AS day_0,
STRUCT(
COUNTIF(dnp = 6) AS new_profiles
) AS day_6,
STRUCT(
COUNTIF(dnp = 13) AS new_profiles,
COUNTIF(udf_active_n_weeks_ago(bits, 1)) AS active_in_week_0,
COUNTIF(udf_active_n_weeks_ago(bits, 0)) AS active_in_week_1,
COUNTIF(udf_active_n_weeks_ago(bits, 1)
AND udf_active_n_weeks_ago(bits, 0))
AS active_in_weeks_0_and_1,
COUNTIF(dnp = 13 AND udf_active_n_weeks_ago(bits, 1)) AS new_profile_active_in_week_0,
COUNTIF(dnp = 13 AND udf_active_n_weeks_ago(bits, 0)) AS new_profile_active_in_week_1,
COUNTIF(dnp = 13 AND udf_active_n_weeks_ago(bits, 1)
AND udf_active_n_weeks_ago(bits, 0))
AS new_profile_active_in_weeks_0_and_1
) AS day_13
FROM
unnested ));
--
WITH
base AS (
SELECT
* REPLACE (
CASE app_name
WHEN 'Fennec' THEN CONCAT(app_name, ' ', os)
WHEN 'Focus' THEN CONCAT(app_name, ' ', os)
WHEN 'Lockbox' THEN CONCAT('Lockwise ', os)
WHEN 'Zerda' THEN 'Firefox Lite'
ELSE app_name
END AS app_name),
normalized_channel AS channel
FROM
telemetry.nondesktop_clients_last_seen_v1
WHERE
-- We apply this filter here rather than in the live view because this field
-- is not normalized and there are many single pings that come in with unique
-- nonsensical app_name values. App names are documented in
-- https://docs.telemetry.mozilla.org/concepts/choosing_a_dataset_mobile.html#products-overview
(STARTS_WITH(app_name, 'FirefoxReality') OR app_name IN (
'Fenix',
'Fennec', -- Firefox for Android and Firefox for iOS
'Focus',
'Lockbox', -- Lockwise
'FirefoxConnect', -- Amazon Echo
'FirefoxForFireTV',
'Zerda')) -- Firefox Lite, previously called Rocket
-- There are also many strange nonsensical entries for os, so we filter here.
AND os IN ('Android', 'iOS')),
--
nested AS (
SELECT
submission_date,
[
STRUCT('Any Firefox Non-desktop Activity' AS usage,
udf_smoot_usage_from_bits(ARRAY_AGG(STRUCT(days_created_profile_bits,
days_seen_bits))) AS metrics)
] AS metrics_array,
MOD(ABS(FARM_FINGERPRINT(client_id)), 20) AS id_bucket,
app_name,
app_version,
country,
locale,
os,
os_version,
channel
FROM
base
WHERE
client_id IS NOT NULL
-- Reprocess all dates by running this query with --parameter=submission_date:DATE:NULL
AND (@submission_date IS NULL OR @submission_date = submission_date)
GROUP BY
submission_date,
id_bucket,
app_name,
app_version,
country,
locale,
os,
os_version,
channel ),
--
unnested AS (
SELECT
submission_date,
m.usage,
(SELECT AS STRUCT m.metrics.* EXCEPT (is_empty_group)) AS metrics,
nested.* EXCEPT (submission_date, metrics_array)
FROM
nested
CROSS JOIN
UNNEST(metrics_array) AS m
WHERE
-- Optimization so we don't have to store rows where counts are all zero.
NOT m.metrics.is_empty_group )
--
SELECT
*
FROM
unnested
WHERE
-- For the 'Firefox Non-desktop' umbrella, we include only apps that
-- are considered for KPIs, so we filter out FireTV and Reality.
app_name != 'FirefoxForFireTV'
AND NOT STARTS_WITH(app_name, 'FirefoxReality')
UNION ALL
SELECT
-- Also present each app as its own usage criterion. App names are documented in
-- https://docs.telemetry.mozilla.org/concepts/choosing_a_dataset_mobile.html#products-overview
* REPLACE(REPLACE(usage, 'Firefox Non-desktop', app_name) AS usage)
FROM
unnested
| true |
11790bd0006874b67032bf864b2c68e2eff30d52 | SQL | ruandev/beauty | /scripts sql/01_db_initial.sql | UTF-8 | 7,087 | 3.234375 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 4.7.7
-- https://www.phpmyadmin.net/
--
-- Host: localhost
-- Generation Time: Jul 23, 2018 at 08:56 PM
-- Server version: 5.6.38
-- PHP Version: 7.2.1
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "-03:00";
--
-- Database: `BEAUTY`
--
use beauty;
-- --------------------------------------------------------
--
-- Table structure for table `AGENDAMENTO`
--
CREATE TABLE `AGENDAMENTO` (
`ID` int(11) NOT NULL,
`ID_CLIENTE` int(11) NOT NULL,
`DATA_HORA` datetime NOT NULL,
`OBS` varchar(200) NOT NULL,
`ID_FUNC` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `CAIXA`
--
CREATE TABLE `CAIXA` (
`ID` int(11) NOT NULL,
`ABERTURA` datetime NOT NULL,
`FECHAMENTO` datetime NOT NULL,
`VALOR_INICIAL` double NOT NULL,
`VALOR_FINAL` double NOT NULL,
`ABERTO` tinyint(1) NOT NULL,
`ID_FUNC_ABERT` int(11) NOT NULL,
`ID_FUNC_FECHA` int(11) NOT NULL,
`OBS` varchar(200) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `CLIENTE`
--
CREATE TABLE `CLIENTE` (
`ID` int(11) NOT NULL,
`NOME` varchar(100) NOT NULL,
`TELEFONE` varchar(11) NOT NULL,
`RG` varchar(20) NOT NULL,
`CPF` varchar(11) NOT NULL,
`ENDERECO` varchar(50) NOT NULL,
`NUMERO` varchar(10) NOT NULL,
`COMPLEMENTO` varchar(100) NOT NULL,
`BAIRRO` varchar(50) NOT NULL,
`CIDADE` varchar(50) NOT NULL,
`CEP` varchar(8) NOT NULL,
`OBS` varchar(200) NOT NULL,
`EMAIL` varchar(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `FORNECEDOR`
--
CREATE TABLE `FORNECEDOR` (
`ID` int(11) NOT NULL,
`NOME_FANTASIA` varchar(50) NOT NULL,
`CNPJ` varchar(14) NOT NULL,
`REPRESENTANTE` varchar(50) NOT NULL,
`TELEFONE` varchar(11) NOT NULL,
`EMAIL` varchar(50) NOT NULL,
`CELULAR` varchar(11) NOT NULL,
`OBS` varchar(200) NOT NULL,
`ENDERECO` varchar(100) NOT NULL,
`NUMERO` varchar(10) NOT NULL,
`COMPLEMENTO` varchar(50) NOT NULL,
`BAIRRO` varchar(50) NOT NULL,
`CIDADE` varchar(50) NOT NULL,
`CEP` varchar(8) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `FUNCIONARIO`
--
CREATE TABLE `FUNCIONARIO` (
`ID` int(11) NOT NULL,
`NOME` varchar(100) NOT NULL,
`TELEFONE` varchar(11) NOT NULL,
`RG` varchar(10) NOT NULL,
`CPF` varchar(11) NOT NULL,
`EMAIL` varchar(50) NOT NULL,
`ENDERECO` varchar(50) NOT NULL,
`NUMERO` varchar(10) NOT NULL,
`COMPLEMENTO` varchar(50) NOT NULL,
`BAIRRO` varchar(50) NOT NULL,
`CIDADE` varchar(100) NOT NULL,
`UF` varchar(2) NOT NULL,
`CEP` varchar(8) NOT NULL,
`OBS` varchar(200) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `MOVIMENTO_CAIXA`
--
CREATE TABLE `MOVIMENTO_CAIXA` (
`ID` int(11) NOT NULL,
`ID_CAIXA` int(11) NOT NULL,
`DATA_HORA` datetime NOT NULL,
`VALOR` double NOT NULL,
`ENTRADA` tinyint(1) NOT NULL,
`ID_FUNC_MOV` int(11) NOT NULL,
`OBS` varchar(200) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `PRODUTO`
--
CREATE TABLE `PRODUTO` (
`ID` int(11) NOT NULL,
`DESCRICAO` varchar(100) NOT NULL,
`VALOR_VENDA` double NOT NULL,
`ESTOQUE_ATUAL` int(11) NOT NULL,
`OBS` varchar(200) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `SERVICO`
--
CREATE TABLE `SERVICO` (
`ID` int(11) NOT NULL,
`DESCRICAO` varchar(50) NOT NULL,
`VALOR` double NOT NULL,
`OBS` varchar(200) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `SERVICO_AGENDAMENTO`
--
CREATE TABLE `SERVICO_AGENDAMENTO` (
`ID` int(11) NOT NULL,
`ID_SERVICO` int(11) NOT NULL,
`ID_AGENDAMENTO` int(11) NOT NULL,
`OBS` varchar(200) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Indexes for dumped tables
--
--
-- Indexes for table `AGENDAMENTO`
--
ALTER TABLE `AGENDAMENTO`
ADD PRIMARY KEY (`ID`),
ADD KEY `FK_CLIENTE_AGEND` (`ID_CLIENTE`),
ADD KEY `FK_FUNC_AGEND` (`ID_FUNC`);
--
-- Indexes for table `CAIXA`
--
ALTER TABLE `CAIXA`
ADD PRIMARY KEY (`ID`),
ADD KEY `FK_FUNC_ABRE_CAIXA` (`ID_FUNC_ABERT`),
ADD KEY `FK_FUNC_FECHA_CAIXA` (`ID_FUNC_FECHA`);
--
-- Indexes for table `CLIENTE`
--
ALTER TABLE `CLIENTE`
ADD PRIMARY KEY (`ID`),
ADD UNIQUE KEY `CPF` (`CPF`);
--
-- Indexes for table `FORNECEDOR`
--
ALTER TABLE `FORNECEDOR`
ADD PRIMARY KEY (`ID`),
ADD UNIQUE KEY `CNPJ` (`CNPJ`);
--
-- Indexes for table `FUNCIONARIO`
--
ALTER TABLE `FUNCIONARIO`
ADD PRIMARY KEY (`ID`),
ADD UNIQUE KEY `CPF` (`CPF`);
--
-- Indexes for table `MOVIMENTO_CAIXA`
--
ALTER TABLE `MOVIMENTO_CAIXA`
ADD PRIMARY KEY (`ID`),
ADD KEY `FK_CAIXA_MOV` (`ID_CAIXA`),
ADD KEY `FK_FUNC_MOV` (`ID_FUNC_MOV`);
--
-- Indexes for table `PRODUTO`
--
ALTER TABLE `PRODUTO`
ADD PRIMARY KEY (`ID`);
--
-- Indexes for table `SERVICO`
--
ALTER TABLE `SERVICO`
ADD PRIMARY KEY (`ID`),
ADD UNIQUE KEY `DESCRICAO` (`DESCRICAO`);
--
-- Indexes for table `SERVICO_AGENDAMENTO`
--
ALTER TABLE `SERVICO_AGENDAMENTO`
ADD PRIMARY KEY (`ID`),
ADD KEY `FK_SERVICO_SERVICO_AGEND` (`ID_SERVICO`),
ADD KEY `FK_AGEND_SERVICO_AGEND` (`ID_AGENDAMENTO`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `AGENDAMENTO`
--
ALTER TABLE `AGENDAMENTO`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `CAIXA`
--
ALTER TABLE `CAIXA`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `CLIENTE`
--
ALTER TABLE `CLIENTE`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `FORNECEDOR`
--
ALTER TABLE `FORNECEDOR`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `FUNCIONARIO`
--
ALTER TABLE `FUNCIONARIO`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `MOVIMENTO_CAIXA`
--
ALTER TABLE `MOVIMENTO_CAIXA`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `PRODUTO`
--
ALTER TABLE `PRODUTO`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `SERVICO`
--
ALTER TABLE `SERVICO`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `SERVICO_AGENDAMENTO`
--
ALTER TABLE `SERVICO_AGENDAMENTO`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
| true |
ee6d5942279796996f2dc4324c99e69a820f08af | SQL | ErikMcClure/bequeath.me | /bequeathme.sql | UTF-8 | 45,908 | 3.9375 | 4 | [
"Apache-2.0"
] | permissive | -- --------------------------------------------------------
-- Host: 127.0.0.1
-- Server version: 10.2.11-MariaDB - mariadb.org binary distribution
-- Server OS: Win64
-- HeidiSQL Version: 9.4.0.5192
-- --------------------------------------------------------
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET NAMES utf8 */;
/*!50503 SET NAMES utf8mb4 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
-- Dumping database structure for bequeathme
CREATE DATABASE IF NOT EXISTS `bequeathme` /*!40100 DEFAULT CHARACTER SET utf8mb4 */;
USE `bequeathme`;
-- Dumping structure for table bequeathme.activity
CREATE TABLE IF NOT EXISTS `activity` (
`Day` tinyint(3) unsigned NOT NULL,
`Hour` tinyint(3) unsigned NOT NULL,
`Visits` bigint(20) unsigned NOT NULL,
PRIMARY KEY (`Day`,`Hour`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='A helper table for the backend to store website activity that can be easily averaged to find the least active hour of any given week.';
-- Data exporting was unselected.
-- Dumping structure for procedure bequeathme.AddCharge
DELIMITER //
CREATE DEFINER=`root`@`localhost` PROCEDURE `AddCharge`(IN `_page` BIGINT UNSIGNED)
MODIFIES SQL DATA
COMMENT 'Creates a new charge and the associated transactions for all the pledges'
BEGIN
INSERT INTO charges (Page) VALUES (_page);
SET @charge = LAST_INSERT_ID();
CALL AddChargeTransactions(@charge, _page);
END//
DELIMITER ;
-- Dumping structure for procedure bequeathme.AddChargeTransactions
DELIMITER //
CREATE DEFINER=`root`@`localhost` PROCEDURE `AddChargeTransactions`(
IN `_charge` BIGINT UNSIGNED,
IN `_page` BIGINT UNSIGNED
)
MODIFIES SQL DATA
BEGIN
DECLARE done INT DEFAULT FALSE;
DECLARE i BIGINT UNSIGNED;
DECLARE cur CURSOR FOR SELECT P.Source FROM pledges P INNER JOIN sources S ON S.ID = P.Source WHERE P.Page = _page AND P.Paused = 0 AND S.Trusted = 0;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
INSERT INTO transactions (`User`, Page, Charge, Reward, Source, Amount)
SELECT `User`, Page, _charge, Reward, Source, Amount
FROM pledges
WHERE Page = _page AND Paused = 0;
-- If any pledgers have failed transactions and an untrusted valid payment source, force processing
OPEN cur;
read_loop: LOOP
FETCH cur INTO i;
IF done THEN
LEAVE read_loop;
END IF;
CALL ValidateSource(i); -- Note: It's fine if a race condition results in attempting to validate a pledge that was not actually charged.
END LOOP;
CLOSE cur;
END//
DELIMITER ;
-- Dumping structure for procedure bequeathme.AddComment
DELIMITER //
CREATE DEFINER=`root`@`localhost` PROCEDURE `AddComment`(IN `_user` BIGINT UNSIGNED, IN `_post` BIGINT UNSIGNED, IN `_reply` BIGINT UNSIGNED, IN `_content` VARCHAR(2048))
COMMENT 'Adds a comment and sends out notifications'
BEGIN
INSERT INTO comments (`User`, Post, Reply, Content)
VALUES (_user, _post, _reply, _content);
SET @id = LAST_INSERT_ID();
SET @author = (SELECT `User` FROM posts WHERE ID = _post);
IF _reply IS NOT NULL THEN
SET @other = (SELECT `User` FROM comments WHERE ID = _reply);
INSERT INTO notifications (`User`, `Post`, `Type`, `Data`, `Aux`)
VALUES (@other, _post, 2, @id, _reply);
IF @other != _user THEN
INSERT INTO notifications (`User`, `Post`, `Type`, `Data`)
VALUES (@author, _post, 1, @id);
END IF;
ELSE
INSERT INTO notifications (`User`, `Post`, `Type`, `Data`)
VALUES (@author, _post, 1, @id);
END IF;
END//
DELIMITER ;
-- Dumping structure for procedure bequeathme.AddPledge
DELIMITER //
CREATE DEFINER=`root`@`localhost` PROCEDURE `AddPledge`(
IN `_user` BIGINT UNSIGNED,
IN `_page` BIGINT UNSIGNED,
IN `_source` BIGINT UNSIGNED,
IN `_amount` DECIMAL(10,8) UNSIGNED,
IN `_reward` BIGINT UNSIGNED,
IN `_notify` TINYINT UNSIGNED
)
DETERMINISTIC
COMMENT 'Adds or updates a pledge, updating transactions as necessary'
BEGIN
DECLARE author BIGINT UNSIGNED;
DECLARE monthly BIT;
SELECT `User`, Monthly INTO author, monthly FROM pages WHERE ID = _page;
SET @notify = 3; -- pledge added
IF EXISTS (SELECT ID FROM pledges WHERE `User` = _user AND Page = _page FOR UPDATE) THEN -- Use FOR UPDATE to prevent deadlock scenario due to potential update below
SET @notify = 4; -- pledge edited
END IF;
INSERT INTO notifications (`User`, `Page`, `Type`, `Data`)
VALUES (author, _page, @notify, _user);
INSERT INTO pledges (`User`, Page, Source, Amount, Reward, Notify)
VALUES (_user, _page, _source, _amount, _reward, _notify)
ON DUPLICATE KEY UPDATE Source = _source, Amount = _amount, Reward = _reward, Notify = _notify;
IF monthly = 1 THEN
-- Check if there is an existing monthly transaction in the current month (non-monthly transactions could exist if the page was changed). Exclude NULL charges with negative amounts because those are refunds.
SELECT @existing := ID, @amount := Amount FROM currentmonth WHERE `User` = _user AND Page = _page AND Charge IS NULL AND Amount >= 0;
IF @existing IS NOT NULL THEN
IF _amount > @amount THEN -- Only if you raised your pledge do we update the transaction
UPDATE transactions SET Amount = _amount WHERE ID = @existing AND `Process` IS NULL;
END IF;
ELSE -- Otherwise insert a new one
INSERT INTO transactions (`User`, Page, Source, Amount, Reward)
VALUES (_user, _page, _source, _amount, _reward);
END IF;
END IF;
END//
DELIMITER ;
-- Dumping structure for procedure bequeathme.AddSourceStripe
DELIMITER //
CREATE DEFINER=`root`@`localhost` PROCEDURE `AddSourceStripe`(
IN `_user` BIGINT UNSIGNED,
IN `_stripe` VARCHAR(48)
)
DETERMINISTIC
COMMENT 'Adds a stripe payment source'
BEGIN
INSERT INTO sources (`User`, Stripe)
VALUES (_user, _stripe);
CALL FixTransactions(_user);
CALL ValidateSource(LAST_INSERT_ID());
END//
DELIMITER ;
-- Dumping structure for table bequeathme.alerts
CREATE TABLE IF NOT EXISTS `alerts` (
`ID` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`Type` smallint(5) unsigned NOT NULL DEFAULT 0,
`Data` bigint(20) unsigned NOT NULL DEFAULT 0,
`Timestamp` timestamp NOT NULL DEFAULT current_timestamp(),
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='These are developer alerts that are e-mailed to a response team. The backend has the option of dealing with different alert types in different ways.';
-- Data exporting was unselected.
-- Dumping structure for procedure bequeathme.BanUser
DELIMITER //
CREATE DEFINER=`root`@`localhost` PROCEDURE `BanUser`(
IN `_user` BIGINT UNSIGNED
)
MODIFIES SQL DATA
DETERMINISTIC
COMMENT 'Bans a user, deleting all pledges and pages. Does not delete source methods or pending transactions, but the backend should attempt to force source of pending transactions anyway.'
BEGIN
UPDATE users SET Banned = 1 WHERE `User` = _user;
DELETE FROM notifications WHERE `User` = _user;
DELETE FROM pledges WHERE `User` = OLD.ID;
UPDATE pages SET Suspended = 1 WHERE `User` = OLD.ID;
END//
DELIMITER ;
-- Dumping structure for table bequeathme.blocked
CREATE TABLE IF NOT EXISTS `blocked` (
`User` bigint(20) unsigned NOT NULL COMMENT 'User doing the blocking',
`Blocked` bigint(20) unsigned NOT NULL COMMENT 'User that was blocked',
`Timestamp` timestamp NOT NULL DEFAULT current_timestamp(),
PRIMARY KEY (`User`,`Blocked`),
KEY `FK_BLOCKED_USERS2` (`Blocked`),
CONSTRAINT `FK_BLOCKED_USERS` FOREIGN KEY (`User`) REFERENCES `users` (`ID`),
CONSTRAINT `FK_BLOCKED_USERS2` FOREIGN KEY (`Blocked`) REFERENCES `users` (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='Tracks which users have been blocked by another user.';
-- Data exporting was unselected.
-- Dumping structure for procedure bequeathme.CalculatePayments
DELIMITER //
CREATE DEFINER=`root`@`localhost` PROCEDURE `CalculatePayments`(
IN `_time` DATE
)
COMMENT 'Calculates the payments necessary for all transactions scheduled in the given month'
BEGIN
DECLARE done INT DEFAULT FALSE;
DECLARE source BIGINT UNSIGNED;
DECLARE cur CURSOR FOR SELECT DISTINCT Source FROM TRANSACTIONS_TEMP;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
-- Coalesce all transactions this month that have either failed or don't have a payment yet into payments based on sources
CREATE TEMPORARY TABLE TRANSACTIONS_TEMP (
ID BIGINT UNSIGNED,
Source BIGINT UNSIGNED,
Amount DECIMAL(10,8)
) ENGINE=MEMORY;
INSERT INTO TRANSACTIONS_TEMP
SELECT T.ID, T.Source, T.Amount
FROM transactions T INNER JOIN sources S ON T.Source = S.ID
WHERE T.`User` = @author AND S.Invalid = 0 AND T.`Timestamp` <= _time AND (T.Failed = 1 OR T.Payment IS NULL)
AND T.`Timestamp` >= UNIX_TIMESTAMP(LAST_DAY(_time) + INTERVAL 1 DAY - INTERVAL 1 MONTH)
AND T.`Timestamp` < UNIX_TIMESTAMP(LAST_DAY(_time) + INTERVAL 1 DAY) FOR UPDATE;
OPEN cur;
read_loop: LOOP
FETCH cur INTO source;
IF done THEN
LEAVE read_loop;
END IF;
INSERT INTO payments (Source, Amount)
SELECT Source, SUM(Amount)
FROM TRANSACTIONS_TEMP
WHERE Source = source
GROUP BY Source;
UPDATE transactions
SET Payment = LAST_INSERT_ID()
WHERE ID IN (SELECT ID FROM TRANSACTIONS_TEMP WHERE Source = source);
END LOOP;
CLOSE cur;
END//
DELIMITER ;
-- Dumping structure for procedure bequeathme.CalculatePayouts
DELIMITER //
CREATE DEFINER=`root`@`localhost` PROCEDURE `CalculatePayouts`(
IN `_buffer` DECIMAL(10,8),
IN `_targetbuffer` DECIMAL(10,8),
IN `_bufferpercent` FLOAT,
IN `_maxpercent` FLOAT
)
COMMENT 'Incorporates expenses and calculates total payout for all creators. Must be called after all backer transactions have been processed, so failed pledges can be taken into account.'
BEGIN
-- Set the ingesting flag on these payments. We can query this value to check if this function has failed and needs to be called again.
UPDATE payments SET Ingesting = 1 WHERE Processing IS NULL AND Failed = 0 AND Fee IS NOT NULL;
SELECT @income := SUM(Amount), @fees := SUM(Fee) FROM payments WHERE Ingesting = 1 FOR UPDATE;
-- Set the ingesting flag on the expenses and query them as well.
UPDATE expenses SET Ingesting = 1 WHERE `Timestamp` <= _time AND Paid = 0;
SELECT @expense := SUM(Amount) FROM expenses WHERE Ingesting = 1 FOR UPDATE;
-- If we go over the buffer payout % we want, we'll use up to half the buffer to try and cover the difference before raising the percent take again.
-- If we go above the maximum payout %, we can't cover all expenses, so we pay as many as we can in full, starting from the largest.
-- Success, update payments signifying that they have been successfully processed
UPDATE payments SET Ingesting = 0, Processing = CURRENT_TIMESTAMP() WHERE Ingesting = 1;
UPDATE expenses SET Ingesting = 0 WHERE Ingesting = 1;
END//
DELIMITER ;
-- Dumping structure for table bequeathme.charges
CREATE TABLE IF NOT EXISTS `charges` (
`ID` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`Page` bigint(20) unsigned NOT NULL,
`Timestamp` timestamp NOT NULL DEFAULT current_timestamp(),
PRIMARY KEY (`ID`),
KEY `FK_CHARGES_PAGES` (`Page`),
CONSTRAINT `FK_CHARGES_PAGES` FOREIGN KEY (`Page`) REFERENCES `pages` (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- Data exporting was unselected.
-- Dumping structure for event bequeathme.Coalesce
DELIMITER //
CREATE DEFINER=`root`@`localhost` EVENT `Coalesce` ON SCHEDULE EVERY 1 MONTH STARTS '2017-12-02 00:01:01' ON COMPLETION PRESERVE ENABLE COMMENT 'Creates processing rows for last month' DO BEGIN
CALL CalculatePayments(DATE_SUB(CURDATE(), INTERVAL 4 DAY));
CALL GenMonthlyTransactions(CURDATE());
END//
DELIMITER ;
-- Dumping structure for table bequeathme.comments
CREATE TABLE IF NOT EXISTS `comments` (
`ID` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`User` bigint(20) unsigned NOT NULL,
`Post` bigint(20) unsigned NOT NULL,
`Reply` bigint(20) unsigned DEFAULT NULL,
`Timestamp` timestamp NOT NULL DEFAULT current_timestamp(),
`Edited` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`Content` varchar(2048) NOT NULL,
PRIMARY KEY (`ID`),
KEY `INDEX_USER` (`User`),
KEY `INDEX_POST` (`Post`),
KEY `FK_COMMENTS_COMMENTS` (`Reply`),
CONSTRAINT `FK_COMMENTS_COMMENTS` FOREIGN KEY (`Reply`) REFERENCES `comments` (`ID`),
CONSTRAINT `FK_COMMENTS_POSTS` FOREIGN KEY (`Post`) REFERENCES `posts` (`ID`),
CONSTRAINT `FK_COMMENTS_USERS` FOREIGN KEY (`User`) REFERENCES `users` (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- Data exporting was unselected.
-- Dumping structure for view bequeathme.currentmonth
-- Creating temporary table to overcome VIEW dependency errors
CREATE TABLE `currentmonth`
) ENGINE=MyISAM;
-- Dumping structure for procedure bequeathme.EditMessage
DELIMITER //
CREATE DEFINER=`root`@`localhost` PROCEDURE `EditMessage`(
IN `_id` BIGINT UNSIGNED,
IN `_recipient` BIGINT UNSIGNED,
IN `_title` VARCHAR(256),
IN `_content` TEXT
)
COMMENT 'Edits a message, but only if it hasn''t been sent yet.'
BEGIN
IF (SELECT Draft FROM messages WHERE ID = _id FOR UPDATE) = 0 THEN
UPDATE messages SET Recipient = _recipient, Title = _title, Content = _content WHERE ID = _id;
END IF;
END//
DELIMITER ;
-- Dumping structure for procedure bequeathme.EditReward
DELIMITER //
CREATE DEFINER=`root`@`localhost` PROCEDURE `EditReward`(
IN `_reward` BIGINT UNSIGNED,
IN `_order` TINYINT,
IN `_name` VARCHAR(256),
IN `_description` VARCHAR(1024),
IN `_amount` DECIMAL(10,8)
)
COMMENT 'Edits a reward, updating backer rewards based on pledge amount.'
BEGIN
DECLARE done INT DEFAULT FALSE;
DECLARE u BIGINT UNSIGNED;
DECLARE p BIGINT UNSIGNED;
DECLARE a DECIMAL(10,8);
DECLARE cur CURSOR FOR SELECT P.`User`, P.Page, P.Amount FROM pledges P INNER JOIN rewards R ON P.Reward = R.ID WHERE P.Amount < R.Amount FOR UPDATE;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
UPDATE rewards
SET `Order` = _order, Name = _name, Description = _description, Amount = _amount
WHERE ID = _reward;
-- After updating the reward, go through all pledges and look for ones that no longer qualify for their reward
OPEN cur;
read_loop: LOOP
FETCH cur INTO u, p, a;
IF done THEN
LEAVE read_loop;
END IF;
UPDATE pledges
SET Reward = (SELECT ID FROM rewards WHERE Page = p AND Amount <= a ORDER BY Amount DESC, `Order` ASC LIMIT 1)
WHERE `User` = u AND Page = p;
-- TODO: consider updating transactions as well
END LOOP;
CLOSE cur;
END//
DELIMITER ;
-- Dumping structure for table bequeathme.expenses
CREATE TABLE IF NOT EXISTS `expenses` (
`ID` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`Amount` decimal(10,8) NOT NULL,
`Timestamp` timestamp NOT NULL DEFAULT current_timestamp(),
`Paid` bit(1) NOT NULL DEFAULT b'0',
`Ingesting` bit(1) NOT NULL DEFAULT b'0',
`Priority` int(11) NOT NULL DEFAULT 0,
`Category` tinyint(3) unsigned NOT NULL DEFAULT 0,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='Expenses calculated by the backend that will need to be paid at the end of the month. Any expenses that are not accounted for carry over for next month. The backend can use a buffer zone to smooth over expenses.';
-- Data exporting was unselected.
-- Dumping structure for procedure bequeathme.FixTransactions
DELIMITER //
CREATE DEFINER=`root`@`localhost` PROCEDURE `FixTransactions`(
IN `_user` BIGINT UNSIGNED
)
MODIFIES SQL DATA
COMMENT 'If a valid source method exists, assigns it to any transactions that don''t currently have one.'
UPDATE transactions
SET Source = (SELECT Source FROM sources WHERE `User` = _user AND Invalid = 0 LIMIT 1)
WHERE `User` = _user AND Source IS NULL AND (Failed = 1 OR Payment IS NULL)//
DELIMITER ;
-- Dumping structure for table bequeathme.flags
CREATE TABLE IF NOT EXISTS `flags` (
`User` bigint(20) unsigned NOT NULL,
`Data` bigint(20) unsigned NOT NULL,
`Type` tinyint(3) unsigned NOT NULL COMMENT '0: page, 1: post, 2: comment',
`Timestamp` timestamp NOT NULL DEFAULT current_timestamp(),
`Confirmed` bit(1) DEFAULT NULL,
PRIMARY KEY (`User`,`Data`,`Type`),
CONSTRAINT `FK_FLAGS_USERS` FOREIGN KEY (`User`) REFERENCES `users` (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='This tracks who has flagged a page, post, or comment and at what time.';
-- Data exporting was unselected.
-- Dumping structure for procedure bequeathme.GenMonthlyTransactions
DELIMITER //
CREATE DEFINER=`root`@`localhost` PROCEDURE `GenMonthlyTransactions`(
IN `_date` DATE
)
MODIFIES SQL DATA
COMMENT 'Generates transactions for the given month, but only if those transactions don''t already exist.'
BEGIN
SET @firstday = UNIX_TIMESTAMP(LAST_DAY(_date) + INTERVAL 1 DAY - INTERVAL 1 MONTH);
IF (SELECT COUNT(*) FROM transactions WHERE Charge IS NULL AND Amount >= 0
AND `Timestamp` >= @firstday
AND `Timestamp` < UNIX_TIMESTAMP(LAST_DAY(_date) + INTERVAL 1 DAY)) = 0 THEN
INSERT INTO transactions (`User`, Page, Reward, Source, Amount, `Timestamp`)
SELECT B.`User`, B.Page, B.Reward, B.Source, B.Amount, @firstday
FROM pledges B INNER JOIN pages P ON B.Page = P.ID
WHERE P.Monthly = 1 AND P.Draft = 0 AND B.Paused = 0;
END IF;
END//
DELIMITER ;
-- Dumping structure for table bequeathme.goals
CREATE TABLE IF NOT EXISTS `goals` (
`Page` bigint(20) unsigned NOT NULL,
`Amount` decimal(10,8) unsigned NOT NULL,
`Name` varchar(128) NOT NULL,
`Description` varchar(2048) NOT NULL,
PRIMARY KEY (`Page`,`Amount`),
CONSTRAINT `FK_GOALS_PAGES` FOREIGN KEY (`Page`) REFERENCES `pages` (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- Data exporting was unselected.
-- Dumping structure for table bequeathme.messages
CREATE TABLE IF NOT EXISTS `messages` (
`ID` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`Sender` bigint(20) unsigned DEFAULT NULL,
`Recipient` bigint(20) unsigned DEFAULT NULL,
`Title` varchar(256) NOT NULL,
`Content` text NOT NULL,
`Timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`Draft` bit(1) NOT NULL DEFAULT b'1',
PRIMARY KEY (`ID`),
KEY `FK_MESSAGES_USERS` (`Sender`),
KEY `FK_MESSAGES_USERS2` (`Recipient`),
CONSTRAINT `FK_MESSAGES_USERS` FOREIGN KEY (`Sender`) REFERENCES `users` (`ID`),
CONSTRAINT `FK_MESSAGES_USERS2` FOREIGN KEY (`Recipient`) REFERENCES `users` (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='Direct messages from creators to backers';
-- Data exporting was unselected.
-- Dumping structure for table bequeathme.notifications
CREATE TABLE IF NOT EXISTS `notifications` (
`ID` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`User` bigint(20) unsigned NOT NULL,
`Page` bigint(20) unsigned DEFAULT NULL,
`Post` bigint(20) unsigned DEFAULT NULL,
`Timestamp` timestamp NOT NULL DEFAULT current_timestamp(),
`Type` smallint(5) unsigned NOT NULL COMMENT '1 comment on post, 2 reply to comment, 3 pledge added, 4 pledge edited, 5 pledge removed, 6 page deleted, 7 user deleted, 8 post added, 9 payment succeeded, 10 payment failed, 11 payment refunded, 12 payout succeeded, 13 payout failed',
`Data` bigint(20) unsigned NOT NULL,
`Aux` bigint(20) unsigned NOT NULL DEFAULT 0,
PRIMARY KEY (`ID`),
KEY `FK_NOTIFICATIONS_USERS` (`User`),
KEY `FK_NOTIFICATIONS_PAGES` (`Page`),
KEY `FK_NOTIFICATIONS_POSTS` (`Post`),
CONSTRAINT `FK_NOTIFICATIONS_PAGES` FOREIGN KEY (`Page`) REFERENCES `pages` (`ID`),
CONSTRAINT `FK_NOTIFICATIONS_POSTS` FOREIGN KEY (`Post`) REFERENCES `posts` (`ID`),
CONSTRAINT `FK_NOTIFICATIONS_USERS` FOREIGN KEY (`User`) REFERENCES `users` (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- Data exporting was unselected.
-- Dumping structure for table bequeathme.oauth
CREATE TABLE IF NOT EXISTS `oauth` (
`User` bigint(20) unsigned NOT NULL,
`Service` smallint(5) unsigned NOT NULL,
`AccessToken` varchar(64) NOT NULL,
`RefreshToken` varchar(64) NOT NULL,
`Expires` datetime DEFAULT NULL,
`Scope` bigint(20) unsigned NOT NULL DEFAULT 0,
PRIMARY KEY (`User`,`Service`),
CONSTRAINT `FK_OAUTH_USERS` FOREIGN KEY (`User`) REFERENCES `users` (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- Data exporting was unselected.
-- Dumping structure for table bequeathme.pages
CREATE TABLE IF NOT EXISTS `pages` (
`ID` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`User` bigint(20) unsigned NOT NULL,
`Monthly` bit(1) NOT NULL DEFAULT b'1',
`Restricted` bit(1) NOT NULL DEFAULT b'0' COMMENT 'If true, only patrons that have paid for at least a month are allowed to comment',
`Sensitive` bit(1) NOT NULL DEFAULT b'0',
`Draft` bit(1) NOT NULL DEFAULT b'1',
`Suspended` bit(1) NOT NULL DEFAULT b'0',
`Name` varchar(256) NOT NULL,
`Description` text NOT NULL,
`Video` varchar(256) NOT NULL DEFAULT '''''',
`Item` varchar(64) NOT NULL,
`Background` varchar(256) NOT NULL DEFAULT '''''',
`Edited` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
PRIMARY KEY (`ID`),
KEY `INDEX_USER` (`User`),
CONSTRAINT `FK_PAGES_USERS` FOREIGN KEY (`User`) REFERENCES `users` (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- Data exporting was unselected.
-- Dumping structure for table bequeathme.payments
CREATE TABLE IF NOT EXISTS `payments` (
`ID` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`Source` bigint(20) unsigned DEFAULT NULL COMMENT 'This is only NULL if the source used to pay this was deleted',
`Amount` decimal(10,8) NOT NULL,
`Fee` decimal(10,8) DEFAULT NULL,
`Failed` bit(1) NOT NULL DEFAULT b'0',
`Refunded` bit(1) NOT NULL DEFAULT b'0' COMMENT 'Only used to deal with chargebacks',
`Ingesting` bit(1) NOT NULL COMMENT 'Set to 1 while being processed. If processing fails, will mark the group of payments that need to be re-done',
`Scheduled` timestamp NOT NULL DEFAULT current_timestamp(),
`Processed` timestamp NULL DEFAULT NULL,
`Confirmation` varchar(64) NOT NULL DEFAULT '''''',
PRIMARY KEY (`ID`),
KEY `FK_PROCESSING_SOURCES` (`Source`),
CONSTRAINT `FK_PROCESSING_SOURCES` FOREIGN KEY (`Source`) REFERENCES `sources` (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='Stores the actual, coalesced transaction payments going through source processors, whether it failed, the confirmation ID, when it was scheduled and when it was attempted. The backend queries this table for pending payments that need to be processed.';
-- Data exporting was unselected.
-- Dumping structure for table bequeathme.payouts
CREATE TABLE IF NOT EXISTS `payouts` (
`ID` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`User` bigint(20) unsigned DEFAULT NULL COMMENT 'This is only NULL if the user was deleted',
`Amount` decimal(10,8) NOT NULL,
`Fee` decimal(10,8) DEFAULT NULL,
`Paid` bit(1) NOT NULL DEFAULT b'0',
`Timestamp` datetime NOT NULL DEFAULT current_timestamp(),
`Confirmation` varchar(64) DEFAULT NULL,
PRIMARY KEY (`ID`),
KEY `FK_PAYOUTS_USERS` (`User`),
CONSTRAINT `FK_PAYOUTS_USERS` FOREIGN KEY (`User`) REFERENCES `users` (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='Tracks the sources that should be made to the creators, with expenses removed, adjusted to compensate for expected fees.';
-- Data exporting was unselected.
-- Dumping structure for table bequeathme.pledges
CREATE TABLE IF NOT EXISTS `pledges` (
`User` bigint(20) unsigned NOT NULL,
`Page` bigint(20) unsigned NOT NULL,
`Source` bigint(20) unsigned NOT NULL,
`Amount` decimal(10,8) unsigned NOT NULL,
`Reward` bigint(20) unsigned NOT NULL,
`Timestamp` timestamp NOT NULL DEFAULT current_timestamp(),
`Edited` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`Paused` bit(1) NOT NULL DEFAULT b'0',
`Notify` tinyint(3) unsigned NOT NULL DEFAULT 0 COMMENT 'Bit 1+2: notify on public posts, Bit 3+4: Notify on locked posts',
PRIMARY KEY (`User`,`Page`),
KEY `INDEX_REWARD` (`Reward`),
KEY `FK_PLEDGES_PAGES` (`Page`),
KEY `FK_PLEDGES_SOURCES` (`Source`),
CONSTRAINT `FK_PLEDGES_PAGES` FOREIGN KEY (`Page`) REFERENCES `pages` (`ID`),
CONSTRAINT `FK_PLEDGES_REWARDS` FOREIGN KEY (`Reward`) REFERENCES `rewards` (`ID`),
CONSTRAINT `FK_PLEDGES_SOURCES` FOREIGN KEY (`Source`) REFERENCES `sources` (`ID`),
CONSTRAINT `FK_PLEDGES_USERS` FOREIGN KEY (`User`) REFERENCES `users` (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- Data exporting was unselected.
-- Dumping structure for table bequeathme.posts
CREATE TABLE IF NOT EXISTS `posts` (
`ID` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`Page` bigint(20) unsigned NOT NULL,
`Title` varchar(256) NOT NULL,
`Content` text NOT NULL,
`Timestamp` timestamp NOT NULL DEFAULT current_timestamp(),
`Edited` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`Scheduled` timestamp NULL DEFAULT NULL COMMENT 'If not-null, this post will have Draft set to 0 at the specified time. ',
`Charge` bigint(20) unsigned DEFAULT NULL,
`Locked` bigint(20) unsigned DEFAULT NULL,
`Draft` bit(1) NOT NULL DEFAULT b'1',
`CreateCharge` bit(1) NOT NULL DEFAULT b'0' COMMENT 'If true a charge will be created when this post is published, but only if Charge is actually NULL',
`Sensitive` bit(1) NOT NULL DEFAULT b'0',
`DMCA` bit(1) NOT NULL DEFAULT b'0' COMMENT 'If true, taken down by DMCA',
PRIMARY KEY (`ID`),
KEY `INDEX_PAGE` (`Page`),
KEY `FK_POSTS_REWARDS` (`Locked`),
KEY `FK_POSTS_CHARGES` (`Charge`),
CONSTRAINT `FK_POSTS_CHARGES` FOREIGN KEY (`Charge`) REFERENCES `charges` (`ID`),
CONSTRAINT `FK_POSTS_PAGES` FOREIGN KEY (`Page`) REFERENCES `pages` (`ID`),
CONSTRAINT `FK_POSTS_REWARDS` FOREIGN KEY (`Locked`) REFERENCES `rewards` (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- Data exporting was unselected.
-- Dumping structure for procedure bequeathme.ProcessPayment
DELIMITER //
CREATE DEFINER=`root`@`localhost` PROCEDURE `ProcessPayment`(
IN `_payment` BIGINT UNSIGNED,
IN `_fee` DECIMAL(10,8),
IN `_confirmation` VARCHAR(64)
)
COMMENT 'Marks a payment as succeeded or failed. If it fails, marks the source as invalid.'
BEGIN
DECLARE u BIGINT UNSIGNED;
DECLARE source BIGINT UNSIGNED;
DECLARE amt DECIMAL(10,8);
SET @notify = 9;
SET @failed = 0;
IF _fee IS NULL THEN
SET @failed = 1;
SET @notify = 10;
END IF;
UPDATE payments
SET Failed = @failed, Fee = _fee, Confirmation = _confirmation
WHERE ID = _payment;
SELECT `User`, ID, Amount INTO u, source, amt
FROM payments
WHERE ID = _payment FOR UPDATE;
IF _failed = 1 THEN
UPDATE sources
SET Invalid = 1, Trusted = 0
WHERE ID = source;
SET @alt = (SELECT ID FROM sources WHERE `User` = u AND Invalid = 0 LIMIT 1);
IF @alt IS NOT NULL THEN
INSERT INTO payments (Source, Amount)
VALUES (@alt, amt);
ELSE -- Otherwise there are no valid sources to fall back to, so mark all associated transactions as failed
UPDATE transactions
SET Failed = 1
WHERE Payment = _payment;
END IF;
END IF;
INSERT INTO notifications (`User`, `Type`, `Data`)
VALUES (u, @notify, _payment);
END//
DELIMITER ;
-- Dumping structure for procedure bequeathme.ProcessPayout
DELIMITER //
CREATE DEFINER=`root`@`localhost` PROCEDURE `ProcessPayout`(
IN `_payout` BIGINT UNSIGNED,
IN `_fee` DECIMAL(10,8),
IN `_confirmation` VARCHAR(64)
)
MODIFIES SQL DATA
COMMENT 'Marks a payout as having succeeded or failed.'
BEGIN
SET @notify = 12;
SET @paid = 1;
IF _fee IS NULL THEN
SET @paid = 0;
SET @notify = 13;
END IF;
UPDATE payouts
SET Paid = @paid, Fee = _fee, Confirmation = _confirmation
WHERE ID = _payout;
SET @u = (SELECT `User` FROM payouts WHERE ID = _payout);
IF _paid = 0 THEN
UPDATE users
SET PayoutFailure = 1
WHERE ID = @u;
END IF;
INSERT INTO notifications (`User`, `Type`, `Data`)
VALUES (@u, @notify, _payout);
END//
DELIMITER ;
-- Dumping structure for procedure bequeathme.PublishPost
DELIMITER //
CREATE DEFINER=`root`@`localhost` PROCEDURE `PublishPost`(
IN `_post` BIGINT UNSIGNED
)
MODIFIES SQL DATA
COMMENT 'Publishes a post, setting the Draft value to 0, creating a charge if necessary and notifying backers'
BEGIN
SELECT @draft := Draft, @charge := Charge, @locked := Locked, @createcharge := CreateCharge, @page := Page
FROM posts WHERE ID = _post FOR UPDATE; -- Must use FOR UPDATE here to obtain write lock
-- Do a sanity check here so we don't republish something multiple times due to race conditions
IF @draft = 1 THEN
-- Only create a new charge if the current post has no charge
IF @createcharge = 1 AND @charge IS NULL THEN
INSERT INTO charges (Page) VALUES (@page);
SET @charge = LAST_INSERT_ID();
SET @createcharge = 0;
CALL AddChargeTransactions(@charge, @page);
END IF;
UPDATE posts SET Draft = 0, Charge = @charge, CreateCharge = @createcharge, Scheduled = NULL WHERE ID = _post;
INSERT INTO notifications (`User`, `Page`, `Post`, `Type`, `Data`)
SELECT `User`, @page, @post, 8, 0
FROM pledges
WHERE Page = @page;
END IF;
END//
DELIMITER ;
-- Dumping structure for event bequeathme.PublishScheduledPosts
DELIMITER //
CREATE DEFINER=`root`@`localhost` EVENT `PublishScheduledPosts` ON SCHEDULE EVERY 15 MINUTE STARTS '2017-12-10 23:51:13' ON COMPLETION PRESERVE ENABLE COMMENT 'Publishes any scheduled posts' DO BEGIN
DECLARE done INT DEFAULT FALSE;
DECLARE i BIGINT UNSIGNED;
DECLARE cur CURSOR FOR SELECT ID FROM posts WHERE Draft = 1 AND Scheduled IS NOT NULL AND Scheduled <= CURRENT_TIMESTAMP();
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
OPEN cur;
read_loop: LOOP
FETCH cur INTO i;
IF done THEN
LEAVE read_loop;
END IF;
CALL PublishPost(i);
END LOOP;
CLOSE cur;
END//
DELIMITER ;
-- Dumping structure for procedure bequeathme.RefundPayment
DELIMITER //
CREATE DEFINER=`root`@`localhost` PROCEDURE `RefundPayment`(
IN `_payment` BIGINT UNSIGNED
)
DETERMINISTIC
COMMENT 'Refunding a payment marks it as refunded and deletes the associated transactions (since they effectively no longer exist)'
BEGIN
UPDATE payments
SET Refunded = 1
WHERE ID = _payment;
DELETE FROM transactions
WHERE Payment = _payment;
SET @u = (SELECT `User` FROM sources WHERE ID = (SELECT Source FROM payments WHERE ID = _payment));
IF @u IS NOT NULL THEN
INSERT INTO notifications (`User`, `Type`, `Data`)
VALUES (@u, 11, _payout);
END IF;
END//
DELIMITER ;
-- Dumping structure for procedure bequeathme.RemoveCharge
DELIMITER //
CREATE DEFINER=`root`@`localhost` PROCEDURE `RemoveCharge`(IN `_charge` BIGINT UNSIGNED)
MODIFIES SQL DATA
DETERMINISTIC
COMMENT 'This function removes a charge AND all of its associated posts.'
BEGIN
DELETE FROM posts WHERE Charge = _charge;
DELETE FROM charges WHERE ID = _charge;
END//
DELIMITER ;
-- Dumping structure for procedure bequeathme.RemoveComment
DELIMITER //
CREATE DEFINER=`root`@`localhost` PROCEDURE `RemoveComment`(IN `_comment` BIGINT UNSIGNED)
MODIFIES SQL DATA
DETERMINISTIC
COMMENT 'Removes a comment by setting the content to an empty string, relying on the front end to replace this with [deleted]'
BEGIN
UPDATE comments SET Content = '' WHERE ID = _comment;
DELETE FROM notifications WHERE `Type` = 1 AND `Data` = _comment;
END//
DELIMITER ;
-- Dumping structure for procedure bequeathme.RemoveMessage
DELIMITER //
CREATE DEFINER=`root`@`localhost` PROCEDURE `RemoveMessage`(
IN `_user` BIGINT UNSIGNED,
IN `_message` BIGINT UNSIGNED
)
COMMENT 'Deletes a message entirely if it hasn''t been sent, or removes a user from it.'
BEGIN
DECLARE sender BIGINT UNSIGNED;
DECLARE recipient BIGINT UNSIGNED;
DECLARE draft BIT;
SELECT Sender, Recipient, Draft INTO sender, recipient, draft FROM messages WHERE ID = _message FOR UPDATE;
IF draft = 1 AND sender = _user THEN
DELETE FROM messages WHERE ID = _message;
ELSEIF draft = 0 AND sender = _user THEN
UPDATE messages SET Sender = NULL WHERE ID = _message;
ELSEIF draft = 0 AND recipient = _user THEN
UPDATE messages SET Recipient = NULL WHERE ID = _message;
ELSE
SIGNAL SQLSTATE '45000'
SET MESSAGE_TEXT = 'Can\'t delete message a user isn\'t actually a part of.';
END IF;
END//
DELIMITER ;
-- Dumping structure for procedure bequeathme.RemovePage
DELIMITER //
CREATE DEFINER=`root`@`localhost` PROCEDURE `RemovePage`(
IN `_page` BIGINT UNSIGNED
)
COMMENT 'Removes a page and sends out a "page deleted" notification to the pledgers'
BEGIN
SELECT @name := Name, @author := `User` FROM pages WHERE ID = _page FOR UPDATE;
INSERT INTO textcache (`Data`, `Aux`)
VALUES ((SELECT DisplayName FROM users WHERE ID = @author), @name);
SET @id = LAST_INSERT_ID();
INSERT INTO notifications (`User`, `Type`, `Data`)
SELECT `User`, 6, @id
FROM pledges
WHERE Page = _page;
DELETE FROM pages WHERE ID = _page;
END//
DELIMITER ;
-- Dumping structure for procedure bequeathme.RemovePledge
DELIMITER //
CREATE DEFINER=`root`@`localhost` PROCEDURE `RemovePledge`(
IN `_user` BIGINT UNSIGNED,
IN `_page` BIGINT UNSIGNED
)
MODIFIES SQL DATA
COMMENT 'Removes a pledge and notifies the creator'
BEGIN
DELETE FROM pledges WHERE `User` = _user AND Page = _page;
IF ROW_COUNT() > 0 THEN
INSERT INTO notifications (`User`, Page, `Type`, `Data`)
VALUES ((SELECT `User` FROM pages WHERE Page = _page), _page, 5, _user);
END IF;
END//
DELIMITER ;
-- Dumping structure for table bequeathme.rewards
CREATE TABLE IF NOT EXISTS `rewards` (
`ID` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`Page` bigint(20) unsigned NOT NULL,
`Order` tinyint(4) NOT NULL,
`Name` varchar(256) NOT NULL DEFAULT '''''',
`Description` varchar(1024) NOT NULL DEFAULT '''''',
`Amount` decimal(10,8) unsigned NOT NULL DEFAULT 0.00000000,
PRIMARY KEY (`ID`),
KEY `INDEX_PAGE` (`Page`),
CONSTRAINT `FK_REWARDS_PAGES` FOREIGN KEY (`Page`) REFERENCES `pages` (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- Data exporting was unselected.
-- Dumping structure for procedure bequeathme.SendMessage
DELIMITER //
CREATE DEFINER=`root`@`localhost` PROCEDURE `SendMessage`(
IN `_id` BIGINT UNSIGNED
)
COMMENT 'Sends a message, but only if it has a valid recipient.'
BEGIN
DECLARE sender BIGINT UNSIGNED;
DECLARE recipient BIGINT UNSIGNED;
DECLARE title VARCHAR(256);
DECLARE content TEXT;
SELECT Sender, Recipient, Title, Content INTO sender, recipient, title, content FROM messages WHERE ID = _id FOR UPDATE;
IF sender IS NOT NULL AND recipient IS NOT NULL AND Title != '' AND content != '' THEN
UPDATE messages SET Draft = 0 WHERE ID = _id;
ELSE
SIGNAL SQLSTATE '45000'
SET MESSAGE_TEXT = 'A message must have a sender, recipient, title, and content.';
END IF;
END//
DELIMITER ;
-- Dumping structure for table bequeathme.sources
CREATE TABLE IF NOT EXISTS `sources` (
`ID` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`User` bigint(20) unsigned NOT NULL,
`Paypal` varchar(64) DEFAULT NULL,
`Stripe` varchar(48) DEFAULT NULL COMMENT 'A stripe payment source. The customer ID is stored on the user table itself',
`Invalid` bit(1) NOT NULL DEFAULT b'0',
`Trusted` bit(1) NOT NULL DEFAULT b'0',
PRIMARY KEY (`ID`),
KEY `FK_SOURCES_USERS` (`User`),
CONSTRAINT `FK_SOURCES_USERS` FOREIGN KEY (`User`) REFERENCES `users` (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='Represents any form of payment. All payment types start untrusted, which triggers manual processing of a single transaction outside of the normal monthly coalesce operation as soon as a transaction is available. If it succeeds, it''s marked as trusted. If it''s failed, it''s marked as invalid and cannot be used. If you have outstanding failed transactions, those MUST be paid off by any new payment method you add for it to be considered "trusted". ';
-- Data exporting was unselected.
-- Dumping structure for table bequeathme.textcache
CREATE TABLE IF NOT EXISTS `textcache` (
`ID` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`Data` varchar(512) NOT NULL DEFAULT '''''',
`Aux` varchar(512) NOT NULL DEFAULT '''''',
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='This table is only used to cache text that will be needed in notifications about deleted pages or users whose information is no longer available.';
-- Data exporting was unselected.
-- Dumping structure for table bequeathme.transactions
CREATE TABLE IF NOT EXISTS `transactions` (
`ID` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`User` bigint(20) unsigned NOT NULL,
`Page` bigint(20) unsigned NOT NULL,
`Charge` bigint(20) unsigned DEFAULT NULL,
`Reward` bigint(20) unsigned DEFAULT NULL,
`Source` bigint(20) unsigned DEFAULT NULL,
`Amount` decimal(10,8) NOT NULL,
`Timestamp` timestamp NOT NULL DEFAULT current_timestamp(),
`Failed` bit(1) NOT NULL DEFAULT b'0' COMMENT 'Set to 1 if the last attempt to resolve this transaction failed. ',
`Payment` bigint(20) unsigned DEFAULT NULL COMMENT 'Set to the last attempt to resolve this transaction, which may have failed.',
PRIMARY KEY (`ID`),
KEY `FK_TRANSACTIONS_USERS` (`User`),
KEY `FK_TRANSACTIONS_PAGES` (`Page`),
KEY `FK_TRANSACTIONS_REWARDS` (`Reward`),
KEY `FK_TRANSACTIONS_SOURCES` (`Source`),
KEY `FK_TRANSACTIONS_CHARGES` (`Charge`),
KEY `FK_TRANSACTIONS_PAYMENTS` (`Payment`),
CONSTRAINT `FK_TRANSACTIONS_CHARGES` FOREIGN KEY (`Charge`) REFERENCES `charges` (`ID`),
CONSTRAINT `FK_TRANSACTIONS_PAGES` FOREIGN KEY (`Page`) REFERENCES `pages` (`ID`),
CONSTRAINT `FK_TRANSACTIONS_PAYMENTS` FOREIGN KEY (`Payment`) REFERENCES `payments` (`ID`),
CONSTRAINT `FK_TRANSACTIONS_REWARDS` FOREIGN KEY (`Reward`) REFERENCES `rewards` (`ID`),
CONSTRAINT `FK_TRANSACTIONS_SOURCES` FOREIGN KEY (`Source`) REFERENCES `sources` (`ID`),
CONSTRAINT `FK_TRANSACTIONS_USERS` FOREIGN KEY (`User`) REFERENCES `users` (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- Data exporting was unselected.
-- Dumping structure for table bequeathme.users
CREATE TABLE IF NOT EXISTS `users` (
`ID` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`Username` varchar(128) NOT NULL,
`Password` varchar(512) DEFAULT NULL COMMENT 'Can be NULL if user only logs in via OAuth',
`Email` varchar(128) NOT NULL,
`DisplayName` varchar(256) NOT NULL DEFAULT '''''',
`About` varchar(4096) NOT NULL DEFAULT '''''',
`Privacy` tinyint(3) unsigned NOT NULL DEFAULT 0,
`Joined` timestamp NOT NULL DEFAULT current_timestamp(),
`Edited` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`LastRead` timestamp NOT NULL DEFAULT current_timestamp(),
`Currency` smallint(5) unsigned NOT NULL DEFAULT 0,
`Notify` bigint(20) unsigned NOT NULL DEFAULT 0,
`Foreign` bit(1) NOT NULL DEFAULT b'0',
`Individual` bit(1) NOT NULL DEFAULT b'1',
`Banned` bit(1) NOT NULL DEFAULT b'0',
`ShowSensitive` bit(1) NOT NULL DEFAULT b'0',
`PayoutFailure` bit(1) NOT NULL DEFAULT b'0',
`StripeCustomerID` varchar(48) DEFAULT NULL,
PRIMARY KEY (`ID`),
UNIQUE KEY `UNIQUE_USERNAME` (`Username`),
UNIQUE KEY `UNIQUE_EMAIL` (`Email`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- Data exporting was unselected.
-- Dumping structure for procedure bequeathme.ValidateSource
DELIMITER //
CREATE DEFINER=`root`@`localhost` PROCEDURE `ValidateSource`(
IN `_source` BIGINT UNSIGNED
)
COMMENT 'Given a new, untrusted, valid payment source, creates a processing row based on invalid and/or recent transactions to force initial payment.'
BEGIN
SELECT @author := `User`, @trusted := Trusted, @invalid := Invalid
FROM sources
WHERE ID = _source;
IF @invalid = 0 AND @trusted = 0 THEN
IF (SELECT COUNT(*) FROM transactions WHERE `User` = @author AND Failed = 1) > 0 THEN
INSERT INTO payments (Source, Amount)
SELECT Source, SUM(Amount)
FROM transactions
WHERE `User` = @author AND Failed = 1
GROUP BY Source;
ELSE
SELECT @id := ID, @source := Source, @amount := Amount
FROM transactions
WHERE `User` = @author AND Payment IS NULL LIMIT 1 FOR UPDATE;
IF @id IS NOT NULL THEN
INSERT INTO payments (Source, Amount)
VALUES (@source, @amount);
UPDATE transactions
SET Payment = LAST_INSERT_ID()
WHERE ID = @id;
END IF;
END IF;
END IF;
END//
DELIMITER ;
-- Dumping structure for trigger bequeathme.charges_before_delete
SET @OLDTMP_SQL_MODE=@@SQL_MODE, SQL_MODE='STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
DELIMITER //
CREATE TRIGGER `charges_before_delete` BEFORE DELETE ON `charges` FOR EACH ROW BEGIN
-- Any transactions that already succeeded must be refunded if the charge is deleted
INSERT INTO transactions (`User`, Page, Reward, Source, Amount)
SELECT `User`, Page, Reward, Source, -Amount
FROM transactions
WHERE charge = OLD.ID AND Failed = 0 AND `Payment` IS NOT NULL;
DELETE FROM transactions WHERE Charge = OLD.ID;
UPDATE posts
SET Charge = NULL
WHERE Charge = OLD.ID;
END//
DELIMITER ;
SET SQL_MODE=@OLDTMP_SQL_MODE;
-- Dumping structure for trigger bequeathme.pages_before_delete
SET @OLDTMP_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
DELIMITER //
CREATE TRIGGER `pages_before_delete` BEFORE DELETE ON `pages` FOR EACH ROW BEGIN
DELETE FROM transactions WHERE Page = OLD.ID;
DELETE FROM notifications WHERE Page = OLD.ID;
DELETE FROM charges WHERE Page = OLD.ID;
DELETE FROM pledges WHERE Page = OLD.ID;
DELETE FROM posts WHERE Page = OLD.ID;
DELETE FROM goals WHERE Page = OLD.ID;
DELETE FROM rewards WHERE Page = OLD.ID;
END//
DELIMITER ;
SET SQL_MODE=@OLDTMP_SQL_MODE;
-- Dumping structure for trigger bequeathme.payments_before_delete
SET @OLDTMP_SQL_MODE=@@SQL_MODE, SQL_MODE='STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
DELIMITER //
CREATE TRIGGER `payments_before_delete` BEFORE DELETE ON `payments` FOR EACH ROW BEGIN
UPDATE transactions SET `Payment` = NULL WHERE `Payment` = OLD.ID;
END//
DELIMITER ;
SET SQL_MODE=@OLDTMP_SQL_MODE;
-- Dumping structure for trigger bequeathme.posts_before_delete
SET @OLDTMP_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
DELIMITER //
CREATE TRIGGER `posts_before_delete` BEFORE DELETE ON `posts` FOR EACH ROW BEGIN
UPDATE comments SET Reply = NULL WHERE Reply IN (SELECT ID FROM comments WHERE `User` = OLD.ID);
DELETE FROM comments WHERE `User` = OLD.ID;
DELETE FROM notifications WHERE Post = OLD.ID;
END//
DELIMITER ;
SET SQL_MODE=@OLDTMP_SQL_MODE;
-- Dumping structure for trigger bequeathme.rewards_before_delete
SET @OLDTMP_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
DELIMITER //
CREATE TRIGGER `rewards_before_delete` BEFORE DELETE ON `rewards` FOR EACH ROW BEGIN
UPDATE posts SET Locked = NULL WHERE Locked = OLD.ID;
SET @replace = (SELECT ID FROM rewards WHERE ID != OLD.ID AND Page = OLD.Page AND Amount <= OLD.Amount ORDER BY Amount DESC, `Order` ASC LIMIT 1);
UPDATE pledges SET Reward = @replace WHERE Reward = OLD.ID AND Page = OLD.Page;
UPDATE transactions SET Reward = @replace WHERE Reward = OLD.ID AND Page = OLD.Page;
END//
DELIMITER ;
SET SQL_MODE=@OLDTMP_SQL_MODE;
-- Dumping structure for trigger bequeathme.sources_before_delete
SET @OLDTMP_SQL_MODE=@@SQL_MODE, SQL_MODE='STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
DELIMITER //
CREATE TRIGGER `sources_before_delete` BEFORE DELETE ON `sources` FOR EACH ROW BEGIN
UPDATE payments SET Source = NULL WHERE `User` = OLD.`User`;
SET @target = (SELECT ID FROM sources WHERE `User` = OLD.`User` AND ID != OLD.ID AND Invalid = 0 LIMIT 1);
-- We update the transactions to either the new payment method, or NULL if none is available
UPDATE transactions SET Source = @target WHERE `User` = OLD.`User` AND Source = OLD.ID;
IF @target IS NULL THEN -- No other source method available, delete all pledges
DELETE FROM pledges WHERE `User` = OLD.`User` AND Source = OLD.ID;
ELSE -- Otherwise move any pledges on this source method to another source method
UPDATE pledges SET Source = @target WHERE `User` = OLD.`User` AND Source = OLD.ID;
END IF;
END//
DELIMITER ;
SET SQL_MODE=@OLDTMP_SQL_MODE;
-- Dumping structure for trigger bequeathme.users_before_delete
SET @OLDTMP_SQL_MODE=@@SQL_MODE, SQL_MODE='STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
DELIMITER //
CREATE TRIGGER `users_before_delete` BEFORE DELETE ON `users` FOR EACH ROW BEGIN
IF (SELECT COUNT(*) FROM transactions where `User` = OLD.ID AND (Failed IS NOT NULL OR Failed = 1)) > 0 THEN
SIGNAL SQLSTATE '45000'
SET MESSAGE_TEXT = 'Cannot delete user with unpaid transactions';
END IF;
DELETE FROM transactions WHERE `User` = OLD.ID;
DELETE FROM notifications WHERE `User` = OLD.ID;
UPDATE payouts SET `User` = NULL WHERE `User` = OLD.ID;
UPDATE comments SET Reply = NULL WHERE Reply IN (SELECT ID FROM comments WHERE `User` = OLD.ID);
DELETE FROM comments WHERE `User` = OLD.ID;
UPDATE messages SET Sender = NULL WHERE Sender = OLD.ID;
UPDATE messages SET Recipient = NULL WHERE Recipient = OLD.ID;
DELETE FROM messages WHERE Sender IS NULL AND Recipient IS NULL;
DELETE FROM pledges WHERE `User` = OLD.ID;
DELETE FROM sources WHERE `User` = OLD.ID;
DELETE FROM pages WHERE `User` = OLD.ID;
DELETE FROM oauth WHERE `User` = OLD.ID;
DELETE FROM flags WHERE `User` = OLD.ID;
DELETE FROM blocked WHERE `User` = OLD.ID OR `Blocked` = OLD.ID;
END//
DELIMITER ;
SET SQL_MODE=@OLDTMP_SQL_MODE;
-- Dumping structure for view bequeathme.currentmonth
-- Removing temporary table and create final VIEW structure
DROP TABLE IF EXISTS `currentmonth`;
CREATE ALGORITHM=MERGE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `currentmonth` AS SELECT * FROM transactions
WHERE `Timestamp` >= UNIX_TIMESTAMP(LAST_DAY(CURDATE()) + INTERVAL 1 DAY - INTERVAL 1 MONTH)
AND `Timestamp` < UNIX_TIMESTAMP(LAST_DAY(CURDATE()) + INTERVAL 1 DAY) ;
/*!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 */;
| true |
9b844c096b122f94562586519dd5090e9abfd13b | SQL | woodjj1/IN705_S2DB3 | /Answers/Week2Lab1-Answers-UNION.sql | UTF-8 | 6,563 | 4.5 | 4 | [] | no_license | /*
Using Transact-SQL : Exercises
------------------------------------------------------------
Exercises for section 6
e6.1 List the paper with the lowest average enrolment per instance. Ignore all papers with no enrolments.
Display the paper ID, paper name and average enrolment count.
select top 1 p.PaperID, p.PaperName, avg(EnrolmentCount) as AverageCount from
(select PaperID, SemesterID, cast(count(*) as decimal(9,4)) as EnrolmentCount from Enrolment e
group by PaperID, SemesterID) ec
join Paper p
on p.PaperID = ec.PaperID
group by p.PaperID, p.PaperName
order by AverageCount asc
e6.2 List the paper with the highest average enrolment per instance.
Display the paper ID, paper name and average enrolment count.
select top 1 p.PaperID, p.PaperName, avg(EnrolmentCount) as AverageCount from
(select PaperID, SemesterID, cast(count(*) as decimal(9,4)) as EnrolmentCount from Enrolment e
group by PaperID, SemesterID) ec
join Paper p
on p.PaperID = ec.PaperID
group by p.PaperID, p.PaperName
order by AverageCount desc
e6.3 For each paper that has a paper instance: list the paper ID, paper name,
starting date of the earliest instance, starting date of the most recent instance,
the minimum number of enrolments in the instances,
maximum number of enrolments in the instances and
average number of enrolments across all the instances.
select counts.PaperID, p.PaperName,
min(counts.StartDate) as [Earliest Instance Started], max(counts.StartDate) as [Latest instance Started],
min(counts.EnrolmentCount) as [Smallest Enrolment], max(counts.EnrolmentCount) as [Largest Enrolment],
avg(counts.EnrolmentCount) as [Average Enrolment]
from
(select i.PaperID, i.SemesterID, s.StartDate, cast(count(*) as decimal(9,6)) as EnrolmentCount from PaperInstance i
join Semester s on s.SemesterID = i.SemesterID
join Enrolment e on e.PaperID = i.PaperID and e.SemesterID = i.SemesterID
group by i.PaperID, i.SemesterID , s.StartDate) counts
join Paper p on p.PaperID = counts.PaperID
group by counts.PaperID, p.PaperName
--or more simply
select
p.PaperID,
p.PaperName,
Min(s.StartDate) as EarliestStartDate, --need aliases
Max(s.StartDate) as LatestStartDate,
Min(ec.EnrolmentCount) as SmallestEnrolment ,
Max(ec.EnrolmentCount) as LargestEnrolment ,
avg(ec.EnrolmentCount) as AverageEnrolment
from
(
select
PaperID,
SemesterID,
COUNT(*) as EnrolmentCount
from Enrolment
group by
PaperID,
SemesterID
) ec --get the enrolment counts for each paper instance
join Semester s
on s.SemesterID = ec.SemesterID
join Paper p
on p.PaperID=ec.PaperID
group by
p.PaperID,
p.PaperName
e6.4 Which paper attracts people with long names? Find the background statistics
to support a hypothesis test: for each paper with enrolments calculate the mean full name length,
sample standard deviation full name length & sample size (that is: number of enrolments).
select NL.PaperID, count(*) as [Sample Size], avg(NL.NameLength) as [Average Name Length],
stdev(NL.NameLength) as [Standard Deviation Name Length] from
(select e.PaperID, cast(len(p.FullName) as decimal(9,4)) as NameLength from Enrolment e
join Person p on p.PersonID = e.PersonID) NL
group by NL.PaperID
e6.5 Rank the semesters from the most loaded (that is: the highest number of enrolments) to
the least loaded. Calculate the ordinal position (1 for first, 2 for second...) of the semester
in this ranking.
--SQL Server 2000 and earlier
select SemesterID, EnrolmentCount, count(innerSemesterID) + 1 as Rank from
( (select i.SemesterID , count(*) as EnrolmentCount from PaperInstance i
join Semester s on s.SemesterID = i.SemesterID
join Enrolment e on e.PaperID = i.PaperID and e.SemesterID = i.SemesterID
group by i.SemesterID ) counts1
left join
(select i.SemesterID as innerSemesterID, count(*) as innerEnrolmentCount from PaperInstance i
join Semester s on s.SemesterID = i.SemesterID
join Enrolment e on e.PaperID = i.PaperID and e.SemesterID = i.SemesterID
group by i.SemesterID ) counts2
on counts1.EnrolmentCount < counts2.innerEnrolmentCount)
group by SemesterID, EnrolmentCount
order by Rank
--SQL Server 2017 can use RANK() function
select
i.SemesterID,
s.StartDate,
count(*) as EnrolmentCount,
rank() over (order by count(*))
from PaperInstance i
join Semester s on s.SemesterID = i.SemesterID
join Enrolment e on e.PaperID = i.PaperID and e.SemesterID = i.SemesterID
group by i.SemesterID, StartDate
order by count(*)
--or
select
s.SemesterID,
s.StartDate ,
s.EndDate ,
COUNT(*) EnrolmentCount,
RANK() over (order by COUNT(*) desc ) as [ordinal position]
from Enrolment e
join Semester s
on s.SemesterID= e.SemesterID
group by
s.SemesterID ,
s.StartDate ,
s.EndDate
*/
/*
Exercises for section 7
--Use UNION to solve these tasks.
--Note that these tasks could possibly be solved by another non-UNION statement.
--Can you also write a non-UNION statement that produces the same result?
e7.1 In one result, list all the people who enrolled in a paper delivered during 2019 and
all the people who have enrolled in IN605.
The result should have three columns: PersonID, Full Name and the reason the person
is on the list - either 'enrolled in 2019' or 'enrolled in IN605'
*/
select
p.PersonID,
Fullname,
'enrolled in 2019' as Reason
from Enrolment e
join Person p on p.PersonID = e.PersonID
where e.SemesterID like '2019__'
union
select
p.PersonID,
Fullname,
'enrolled in IN605' as Reason
from Enrolment e
join Person p on p.PersonID = e.PersonID
where e.PaperID = 'IN605'
--without union...
--gives DIFFERENT results, so you can't use this as a substitiute
select
p.PersonID,
Fullname,
case
when e.SemesterID like '2019__' then 'enrolled in 2019'
when e.PaperID = 'IN605' then 'enrolled in IN605'
end as Reason
from Enrolment e
join Person p on p.PersonID = e.PersonID
where e.SemesterID like '2019__'
or e.PaperID = 'N605'
/*
e7.2 Produce one resultset with two columns.
List the all Paper Names and all the Person Full Names in one column.
In the other column calculate the number of characters in the name.
Sort the result with the longest name first.
*/
--with UNION
select
PaperName,
len(PaperName) as [Number of characters]
from Paper
union
select
Fullname,
len(Fullname)
from Person
order by [Number of characters] desc
--without UNION is impossible
--because we need to merge data from two columns
--on two different tables; join does not perform this | true |
ee36a0d0e70767c3703b557583ec4f7c2b99dfbb | SQL | tekbasse/affiliates | /sql/postgresql/affiliates-create.sql | UTF-8 | 685 | 2.984375 | 3 | [] | no_license | -- affiliates-create.sql
--
-- @license GNU GENERAL PUBLIC LICENSE, Version 3
--
-- aka company_credits
CREATE TABLE aff_rewards (
contact_id integer,
--tx_time
--reward_amt
--conversion
net_balance numeric
);
-- part of company_details
CREATE TABLE aff_referrals (
contact_id integer,
referred_id integer,
referring_type varchar(12),
referral_calc_ref varchar(12),
referring_info text
-- from referral_calendar
time_to_credit timestamptz,
amount_to_credit numeric,
-- credited_p was referral_calender.active, which means?
-- There are cases where invoice_no not null while active=t
credited_p varchar(1),
invoice_no varchar(80)
);
| true |
909ab609d8383075837abc8913d4977974057b05 | SQL | moutainhigh/lotwork | /baokai-game/src/main/webapp/WEB-INF/classes/sql/oracle/SL_GAMEORDER_Leaderboard.sql | UTF-8 | 326 | 2.59375 | 3 | [] | no_license | CREATE TABLE SL_GAMEORDER_Leaderboard(
ID NUMBER PRIMARY KEY,
ROWNO NUMBER,
USER_ID NUMBER,
USER_ACCOUNT VARCHAR(30),
TOTAL_AMOUNT NUMBER,
CREATE_TIME TIMESTAMP(6) ,
LV NUMBER
)
CREATE SEQUENCE SEQ_SL_Leaderboard_ID
MINVALUE 1
MAXVALUE 999999999999999999999999999
START WITH 1
INCREMENT BY 1
NOCACHE;
| true |
5b9290156bc9f0ce4478255dcaed324eb1417c6a | SQL | indra400/TA | /skripsi_indra.sql | UTF-8 | 6,718 | 2.984375 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | -- phpMyAdmin SQL Dump
-- version 3.2.0.1
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Aug 26, 2016 at 10:12 PM
-- Server version: 5.1.37
-- PHP Version: 5.3.0
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
/*!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: `skripsi_indra`
--
-- --------------------------------------------------------
--
-- Table structure for table `t_id_buah`
--
CREATE TABLE IF NOT EXISTS `t_id_buah` (
`id_buah` int(3) NOT NULL,
`nama_buah` varchar(20) NOT NULL,
`satuan` varchar(4) NOT NULL,
PRIMARY KEY (`id_buah`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Dumping data for table `t_id_buah`
--
INSERT INTO `t_id_buah` (`id_buah`, `nama_buah`, `satuan`) VALUES
(2, 'apel bekasi', 'dus'),
(1, 'Jeruk brebes', 'dus');
-- --------------------------------------------------------
--
-- Table structure for table `t_id_jabatan`
--
CREATE TABLE IF NOT EXISTS `t_id_jabatan` (
`id_jabatan` int(3) NOT NULL,
`nama_jabatan` varchar(15) NOT NULL,
PRIMARY KEY (`id_jabatan`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Dumping data for table `t_id_jabatan`
--
INSERT INTO `t_id_jabatan` (`id_jabatan`, `nama_jabatan`) VALUES
(1, 'administrator');
-- --------------------------------------------------------
--
-- Table structure for table `t_perusahaan`
--
CREATE TABLE IF NOT EXISTS `t_perusahaan` (
`id_perusahaan` int(2) NOT NULL,
`nama_perusahaan` varchar(20) NOT NULL,
`alamat` varchar(30) NOT NULL,
`direktur` varchar(10) NOT NULL,
`id_pegawai` int(5) NOT NULL,
`logo` varchar(11) NOT NULL,
PRIMARY KEY (`id_perusahaan`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Dumping data for table `t_perusahaan`
--
INSERT INTO `t_perusahaan` (`id_perusahaan`, `nama_perusahaan`, `alamat`, `direktur`, `id_pegawai`, `logo`) VALUES
(1, 'ANEKA BUAH CEMERLANG', 'Jl. Gamping Sleman', 'Sauqi', 1, 'abc.jpg');
-- --------------------------------------------------------
--
-- Table structure for table `t_stok_gudang`
--
CREATE TABLE IF NOT EXISTS `t_stok_gudang` (
`id_stok_gudang` int(5) NOT NULL,
`id_buah` int(3) NOT NULL,
`id_transaksi_suplier` int(5) NOT NULL,
`harga_satuan` int(10) NOT NULL,
PRIMARY KEY (`id_stok_gudang`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Dumping data for table `t_stok_gudang`
--
-- --------------------------------------------------------
--
-- Table structure for table `t_stok_pasar`
--
CREATE TABLE IF NOT EXISTS `t_stok_pasar` (
`id_stok_pasar` int(5) NOT NULL,
`id_stok_gudang` int(5) NOT NULL,
`id_buah` int(3) NOT NULL,
`harga_satuan` int(10) NOT NULL,
PRIMARY KEY (`id_stok_pasar`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Dumping data for table `t_stok_pasar`
--
-- --------------------------------------------------------
--
-- Table structure for table `t_transaksi_gudang`
--
CREATE TABLE IF NOT EXISTS `t_transaksi_gudang` (
`id_transaksi_gudang` int(5) NOT NULL AUTO_INCREMENT,
`tgl_transaksi_gudang` date NOT NULL,
`wkt_transaksi_gudang` time NOT NULL,
`id_buah` int(3) NOT NULL,
`quantity` int(3) NOT NULL,
`id_pelanggan` int(5) NOT NULL,
`id_pegawai` int(5) NOT NULL,
`total_harga` int(10) NOT NULL,
PRIMARY KEY (`id_transaksi_gudang`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
--
-- Dumping data for table `t_transaksi_gudang`
--
-- --------------------------------------------------------
--
-- Table structure for table `t_transaksi_pasar`
--
CREATE TABLE IF NOT EXISTS `t_transaksi_pasar` (
`id_transaksi_pasar` int(5) NOT NULL AUTO_INCREMENT,
`tgl_transaksi_pasar` date NOT NULL,
`wkt_transaksi_pasar` time NOT NULL,
`id_buah` int(3) NOT NULL,
`quantity` int(3) NOT NULL,
`id_pelanggan` int(5) NOT NULL,
`id_pegawai` int(5) NOT NULL,
`total_harga` int(10) NOT NULL,
PRIMARY KEY (`id_transaksi_pasar`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
--
-- Dumping data for table `t_transaksi_pasar`
--
-- --------------------------------------------------------
--
-- Table structure for table `t_transaksi_suplier`
--
CREATE TABLE IF NOT EXISTS `t_transaksi_suplier` (
`id_transaksi_suplier` int(5) NOT NULL AUTO_INCREMENT,
`id_suplier` int(5) NOT NULL,
`tgl_masuk_suplier` date NOT NULL,
`wkt_masuk_suplier` time NOT NULL,
`id_buah` int(3) NOT NULL,
`quantity` int(4) NOT NULL,
`harga_buah` int(10) NOT NULL,
`kadaluarsa` int(4) NOT NULL,
PRIMARY KEY (`id_transaksi_suplier`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
--
-- Dumping data for table `t_transaksi_suplier`
--
-- --------------------------------------------------------
--
-- Table structure for table `t_user_pegawai`
--
CREATE TABLE IF NOT EXISTS `t_user_pegawai` (
`id_pegawai` int(5) NOT NULL,
`nama_pegawai` varchar(20) NOT NULL,
`alamat_pegawai` varchar(50) NOT NULL,
`jenis_kelamin` enum('0','1') NOT NULL,
`id_jabatan` int(2) NOT NULL,
PRIMARY KEY (`id_pegawai`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Dumping data for table `t_user_pegawai`
--
INSERT INTO `t_user_pegawai` (`id_pegawai`, `nama_pegawai`, `alamat_pegawai`, `jenis_kelamin`, `id_jabatan`) VALUES
(10001, 'admin', 'Gamping Sleman', '1', 1);
-- --------------------------------------------------------
--
-- Table structure for table `t_user_pelanggan`
--
CREATE TABLE IF NOT EXISTS `t_user_pelanggan` (
`id_pelanggan` int(5) NOT NULL,
`nama_pelanggan` varchar(15) NOT NULL,
`alamat_pelanggan` varchar(50) NOT NULL,
`no_telp` varchar(13) NOT NULL,
PRIMARY KEY (`id_pelanggan`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Dumping data for table `t_user_pelanggan`
--
INSERT INTO `t_user_pelanggan` (`id_pelanggan`, `nama_pelanggan`, `alamat_pelanggan`, `no_telp`) VALUES
(20001, 'budi waseso', 'mlati sleman', '09574352413');
-- --------------------------------------------------------
--
-- Table structure for table `t_user_suplier`
--
CREATE TABLE IF NOT EXISTS `t_user_suplier` (
`id_suplier` int(5) NOT NULL,
`nama_suplier` varchar(20) NOT NULL,
`alamat_suplier` varchar(50) NOT NULL,
`no_telp` varchar(13) NOT NULL,
PRIMARY KEY (`id_suplier`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Dumping data for table `t_user_suplier`
--
INSERT INTO `t_user_suplier` (`id_suplier`, `nama_suplier`, `alamat_suplier`, `no_telp`) VALUES
(30001, 'ahok sutopo', 'kudus jawa tengah', '0817263827');
/*!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 */;
| true |
568b91bdf55bff30b0425630853a4bbfa46b2619 | SQL | silence-do-good/stress-test-Postgres-and-MySQL | /dump/high/day24/select1928.sql | UTF-8 | 178 | 2.65625 | 3 | [] | no_license |
SELECT timeStamp, temperature FROM ThermometerOBSERVATION o
WHERE timestamp>'2017-11-23T19:28:00Z' AND timestamp<'2017-11-24T19:28:00Z' AND temperature>=14 AND temperature<=50
| true |
00b14be6e39ee79aeac30d6327528e74c9db8a08 | SQL | ntogka/DataBases-Project-1 | /V.3/host_table.sql | UTF-8 | 1,536 | 3.46875 | 3 | [] | no_license | CREATE TABLE "Host"
AS (SELECT DISTINCT host_id as id, host_url as url, host_name as name, host_since as since, host_location as location,
host_about as about, host_response_time as response_time, host_response_rate as response_rate,
host_acceptance_rate as acceptance_rate, host_is_superhost as is_superhost,
host_thumbnail_url as thumbnail_url , host_picture_url as picture_url , host_neighbourhood as neighbourhood,
host_listings_count as listings_count , host_total_listings_count as total_listings_count,
host_verifications as verifications , host_has_profile_pic as has_profile_pic , host_identity_verified as identity_verified ,
calculated_host_listings_count as calculated_listings_count FROM "Listings");
ALTER TABLE "Host"
ADD PRIMARY KEY (id);
ALTER TABLE "Listings"
ADD CONSTRAINT host_id FOREIGN KEY (host_id)
REFERENCES "Host" (id);
ALTER TABLE "Listings"
DROP COLUMN host_url,
DROP COLUMN host_name,
DROP COLUMN host_since,
DROP COLUMN host_location,
DROP COLUMN host_about,
DROP COLUMN host_response_time,
DROP COLUMN host_response_rate,
DROP COLUMN host_acceptance_rate,
DROP COLUMN host_is_superhost,
DROP COLUMN host_thumbnail_url,
DROP COLUMN host_picture_url,
DROP COLUMN host_neighbourhood,
DROP COLUMN host_listings_count,
DROP COLUMN host_total_listings_count,
DROP COLUMN host_verifications,
DROP COLUMN host_has_profile_pic,
DROP COLUMN host_identity_verified,
DROP COLUMN calculated_host_listings_count; | true |
f28cab347b2ccea10db7dbf77bed078b7b470f5d | SQL | VinayHaryan/SQL_projects | /ProjectAnsSQLQueries.sql | UTF-8 | 3,534 | 4.15625 | 4 | [] | no_license | --Quest 1
select Profiles.profile_id, CONCAT(Profiles.first_name,' ',Profiles.last_name) as FullName,
Profiles.phone from Profiles
inner join Tenancy_histories
on Profiles.profile_id=Tenancy_histories.profile_id
where Profiles.profile_id in
(select profile_id from
(select top(1) datediff(dd, move_in_date,move_out_date)as a,profile_id from
Tenancy_histories) as b)
--Quest 2
select CONCAT(Profiles.first_name,' ',Profiles.last_name) as FullName, Profiles.email,
Profiles.phone from Profiles
inner join Tenancy_histories
on Profiles.profile_id=Tenancy_histories.profile_id
where Tenancy_histories.rent>9000 and Profiles.profile_id in
(select profile_id from profiles where marital_status='Y')
--Quest 3
select p.profile_id, CONCAT(p.first_name,' ',p.last_name) as FullName, p.phone, p.email,
p.[city(hometown)], t.house_id, t.move_in_date, t.move_out_date, t.rent, e.latest_employer,
e.Occupational_category, COALESCE(r.NumberOfrefferals,0) from Tenancy_histories as t
inner join Profiles as p
on t.profile_id=p.profile_id
inner join Employment_details as e
on p.profile_id=e.profile_id
left join(select COUNT(*) as NumberOfrefferals, referrer_id from Referrals
where referral_valid=1
group by referrer_id) as r
on p.profile_id=r.referrer_id
where
p.[city(hometown)] in('Bangalore', 'Pune') and
(t.move_in_date between '2015-01-01' and '2016-01-31') or
(t.move_out_date between '2015-01-01' and '2016-01-31') or
(t.move_in_date <= '2015-01-01' and t.move_out_date>= '2016-01-31')
order by rent desc
--Quest 4
select CONCAT(p.first_name,' ',p.last_name) as FullName, p.email,
p.phone, r.referrer_id, r.TotalReferralBonus from Profiles as p
inner join (select referrer_id,sum(referrer_bonus_amount) as TotalReferralBonus from Referrals
where referral_valid=1
group by referrer_id) as r
on p.profile_id=r.referrer_id
--Quest 5
select distinct(p.[city(hometown)]), sum(t.rent) over (partition by [city(hometown)] ) as CityTotalRent,
SUM(rent) over() as TotalRent from Profiles as p
inner join Tenancy_histories as t
on t.profile_id=p.profile_id
--Quest6
create view vw_tenant as
select profile_id, rent, move_in_date, h.house_type, h.beds_vacant, a.description, a.city
from Tenancy_histories as t
inner join Houses as h
on t.house_id=h.house_id
inner join Addresses as a
on a.house_id=h.house_id
where move_in_date>='2015-04-30'
and move_out_date is null and
h.beds_vacant>0
select * from vw_tenant
--Quest 7
select top(1)
ref_id,referrer_id,valid_till,DATEADD(m,1,valid_till) as extended_valid_till from Referrals
where referrer_id in (select referrer_id from Referrals
group by referrer_id
having COUNT(*) >2)
order by valid_till desc
--Quest 8
select p.profile_id, CONCAT(p.first_name,' ',p.last_name) as FullName,
p.phone, iif(t.rent>10000,'Grade A',iif(t.rent<7500,'Grade C', 'Grade B')) as 'Customer Segment' from Profiles as p
inner join Tenancy_histories as t
on t.profile_id=p.profile_id
--Quest 9
select CONCAT(p.first_name,' ',p.last_name) as FullName,
p.phone, p.[city(hometown)], h.house_type, h.bhk_details, h.bed_count, h.furnishing_type, h.Beds_vacant
from Profiles as p
inner join Tenancy_histories as t
on t.profile_id=p.profile_id
inner join Houses as h
on t.house_id=h.house_id
where p.profile_id not in (select referrer_id from Referrals)
--Quest 10
select * from Houses where SUBSTRING(bhk_details,1,1) in(
select top(1) SUBSTRING(bhk_details,1,1) as occupancy from Houses order by bhk_details desc )
| true |
7f6f03da76a2a535723265edf9e0f9a85c1e8dbe | SQL | jesgac/Nomisoft | /protected/backups/db_nomisoft_29.03.2016_16.45.12.sql | UTF-8 | 138,099 | 3.578125 | 4 | [] | no_license | -- -------------------------------------------
SET AUTOCOMMIT=0;
START TRANSACTION;
SET SQL_QUOTE_SHOW_CREATE = 1;
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
-- -------------------------------------------
-- -------------------------------------------
-- START BACKUP
-- -------------------------------------------
-- -------------------------------------------
-- TABLE `asignaciones`
-- -------------------------------------------
DROP TABLE IF EXISTS `asignaciones`;
CREATE TABLE IF NOT EXISTS `asignaciones` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Clave primaria',
`b_alimenticio` float NOT NULL COMMENT 'Pago del bono alimenticio',
`asistencia` float NOT NULL COMMENT 'Pago de bono de asistencia',
`feriado` float NOT NULL COMMENT 'Pago de dia feriado',
`sabado` float NOT NULL COMMENT 'pago de Sabados trabajados',
`horasextra_diurna` float NOT NULL COMMENT 'Pago de Horas extras diurnas',
`horasextras_nocturna` float NOT NULL COMMENT 'Pago de Horas extras nocturna',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=76 DEFAULT CHARSET=latin1;
-- -------------------------------------------
-- TABLE `auditoria`
-- -------------------------------------------
DROP TABLE IF EXISTS `auditoria`;
CREATE TABLE IF NOT EXISTS `auditoria` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primaria',
`id_user` int(10) NOT NULL,
`accion` int(10) NOT NULL,
`modelo` varchar(40) NOT NULL,
`id_registro` int(10) NOT NULL,
`fecha` datetime NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=309 DEFAULT CHARSET=latin1;
-- -------------------------------------------
-- TABLE `cargos`
-- -------------------------------------------
DROP TABLE IF EXISTS `cargos`;
CREATE TABLE IF NOT EXISTS `cargos` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Clave primaria',
`cargo` varchar(50) CHARACTER SET latin1 COLLATE latin1_spanish_ci NOT NULL COMMENT 'Descripcion del cargo del empleado',
`sueldo` float NOT NULL COMMENT 'Salario correspondiente al cargo',
`tipo_sueldo` int(1) NOT NULL COMMENT 'describe si el pago es mensual o semanal',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=43 DEFAULT CHARSET=latin1;
-- -------------------------------------------
-- TABLE `conceptos`
-- -------------------------------------------
DROP TABLE IF EXISTS `conceptos`;
CREATE TABLE IF NOT EXISTS `conceptos` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Clave primaria',
`Fecha` date NOT NULL COMMENT 'Fecha de vigencia del concepto',
`tipo_bono` int(11) NOT NULL COMMENT 'Describe cual es el bono (1=>U.T., 2=>HE diurnas, 3=>HE nocturnas, 4=> dia feriado 5=>sabados, 6=>Bono alimentacion, 7=>asistencia )',
`bono` float NOT NULL COMMENT 'Variable de la formula del calculo que corresponde al tipo de bono',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=latin1;
-- -------------------------------------------
-- TABLE `deducciones`
-- -------------------------------------------
DROP TABLE IF EXISTS `deducciones`;
CREATE TABLE IF NOT EXISTS `deducciones` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Clave primaria',
`sso` float NOT NULL COMMENT 'Descuento del Seguro Social Obligatorio',
`spf` float NOT NULL COMMENT 'Descuento del Seguro de Paro forzoso',
`lph` float NOT NULL COMMENT 'Descuento de la Ley de Politica Habitacional o Faov ( Fondo de Ahorro Obligatorio para la Vivienda)',
`inasistencia` float NOT NULL COMMENT 'Descuento por dias no laborados',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=76 DEFAULT CHARSET=latin1;
-- -------------------------------------------
-- TABLE `empleados`
-- -------------------------------------------
DROP TABLE IF EXISTS `empleados`;
CREATE TABLE IF NOT EXISTS `empleados` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Clave primaria',
`id_persona` int(11) NOT NULL COMMENT 'Clave foranea de la tabla persona',
`id_obra` int(11) NOT NULL COMMENT 'Clave foranea de la tabla Obra',
`nro_cuenta` varchar(20) NOT NULL COMMENT 'Numero de cuenta del trabajador',
`id_empresa` int(11) NOT NULL COMMENT 'Clave Foranea de la tabla empresa',
`id_talla` int(11) NOT NULL COMMENT 'Clave foranea de la tabla talla',
`id_cargo` int(11) NOT NULL COMMENT 'Clave foranea de la tabla cargo',
`cod_banco` varchar(4) NOT NULL COMMENT 'Identificador de la entidad bancaria',
`tipo_empleado` int(1) NOT NULL COMMENT 'Describe el tipo de trabajador (empelado u obrero)',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=73 DEFAULT CHARSET=latin1;
-- -------------------------------------------
-- TABLE `empresa`
-- -------------------------------------------
DROP TABLE IF EXISTS `empresa`;
CREATE TABLE IF NOT EXISTS `empresa` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Clave primaria',
`nombre_emp` varchar(100) NOT NULL COMMENT 'Nombre de la empresa',
`direccion` text NOT NULL COMMENT 'Direccion de la empresa',
`telefono` varchar(15) NOT NULL COMMENT 'Telefono de la empresa',
`rif` varchar(15) NOT NULL COMMENT 'Rif de la empresa',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;
-- -------------------------------------------
-- TABLE `hijos`
-- -------------------------------------------
DROP TABLE IF EXISTS `hijos`;
CREATE TABLE IF NOT EXISTS `hijos` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Clave Primaria',
`id_persona` int(11) NOT NULL COMMENT 'Clave foranea de la tabla persona',
`nombre` varchar(45) NOT NULL COMMENT 'Nombre del Hijo',
`apellido` varchar(45) NOT NULL COMMENT 'Apellido del Hijo',
`fecha_nac` varchar(45) NOT NULL COMMENT 'Fecha de Nacimiento del Hijo',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;
-- -------------------------------------------
-- TABLE `nomina`
-- -------------------------------------------
DROP TABLE IF EXISTS `nomina`;
CREATE TABLE IF NOT EXISTS `nomina` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Clave Primaria',
`id_empleado` int(11) NOT NULL COMMENT 'Clave foranea de la tabla empleado',
`id_asignacion` int(11) NOT NULL COMMENT 'Clave foranea de la tabla asignacion',
`id_deduccion` int(11) NOT NULL COMMENT 'Clave foranea de la tabla deduccion',
`total_asig` float NOT NULL COMMENT 'Sumatoria de las asignaciones',
`total_deduc` float NOT NULL COMMENT 'Sumatoria de las deducciones',
`neto` float NOT NULL COMMENT 'Neto a pagar del trabajador',
`fecha` date NOT NULL COMMENT 'Fecha de pago de la nomina',
`vaciado` float NOT NULL COMMENT 'Pago por vaciado',
`prestamos` float NOT NULL COMMENT 'pago de prestamos',
`otros` float NOT NULL COMMENT 'Pago de bonos varios',
`descuento` float NOT NULL COMMENT 'descuentos varios',
`nominacol` varchar(45) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=55 DEFAULT CHARSET=latin1;
-- -------------------------------------------
-- TABLE `obras`
-- -------------------------------------------
DROP TABLE IF EXISTS `obras`;
CREATE TABLE IF NOT EXISTS `obras` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Clave Primaria',
`id_empleado` int(11) NOT NULL COMMENT 'Clave foranea de la tabla empleado',
`nombre_obra` varchar(45) NOT NULL COMMENT 'Nombre de la obra',
`direccion` varchar(100) NOT NULL COMMENT 'Direccion de la Obra',
`fech_ini` date NOT NULL COMMENT 'Fecha de inicio de la obra',
`fech_fin` date NOT NULL COMMENT 'fecha de cierre de la obra',
`status` varchar(1) NOT NULL COMMENT 'Indica estado de actividad de la obra',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;
-- -------------------------------------------
-- TABLE `personas`
-- -------------------------------------------
DROP TABLE IF EXISTS `personas`;
CREATE TABLE IF NOT EXISTS `personas` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Clave Primaria',
`nombre` varchar(50) NOT NULL COMMENT 'Nombre del trabajador',
`apellido` varchar(50) NOT NULL COMMENT 'apellido del trabajador',
`cedula` varchar(15) NOT NULL COMMENT 'Documento de identidad',
`fecha_nac` date NOT NULL COMMENT 'Fecha de nacimiento del trabajador',
`lugar_nac` text NOT NULL COMMENT 'Lugar de nacimiento del trabajador',
`nacionalidad` varchar(1) NOT NULL COMMENT 'Nacionalidad del trabajador',
`sexo` varchar(1) NOT NULL COMMENT 'Sexo del trabajador',
`direccion` text NOT NULL COMMENT 'Direccion del trabajador',
`telefono` varchar(15) NOT NULL COMMENT 'Numero telefonico del trabajador',
`email` varchar(50) NOT NULL COMMENT 'Correo electronico del trabajador',
PRIMARY KEY (`id`),
UNIQUE KEY `cedula` (`cedula`)
) ENGINE=InnoDB AUTO_INCREMENT=74 DEFAULT CHARSET=latin1;
-- -------------------------------------------
-- TABLE `tallas`
-- -------------------------------------------
DROP TABLE IF EXISTS `tallas`;
CREATE TABLE IF NOT EXISTS `tallas` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Clave primaria',
`talla_zapato` varchar(3) NOT NULL COMMENT 'Numero de calzado',
`talla_pantalon` varchar(3) NOT NULL COMMENT 'Numero de talla de pantalon',
`talla_camisa` varchar(3) NOT NULL COMMENT 'Numero de talla de camisa',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=82 DEFAULT CHARSET=latin1;
-- -------------------------------------------
-- TABLE `usuario`
-- -------------------------------------------
DROP TABLE IF EXISTS `usuario`;
CREATE TABLE IF NOT EXISTS `usuario` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Clave primaria',
`id_persona` int(11) NOT NULL COMMENT 'Clave foranea de la tabla persona',
`user` varchar(50) NOT NULL COMMENT 'Nombre de Usuario',
`pass` varchar(150) NOT NULL COMMENT 'Contraseña del usuario',
`nivel` int(1) NOT NULL COMMENT 'Nivel de acceso del usuario',
PRIMARY KEY (`id`),
UNIQUE KEY `user` (`user`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=latin1;
-- -------------------------------------------
-- TABLE DATA asignaciones
-- -------------------------------------------
INSERT INTO `asignaciones` (`id`,`b_alimenticio`,`asistencia`,`feriado`,`sabado`,`horasextra_diurna`,`horasextras_nocturna`) VALUES
('1','0','0','0','0','0','0');
INSERT INTO `asignaciones` (`id`,`b_alimenticio`,`asistencia`,`feriado`,`sabado`,`horasextra_diurna`,`horasextras_nocturna`) VALUES
('2','0','0','0','0','0','0');
INSERT INTO `asignaciones` (`id`,`b_alimenticio`,`asistencia`,`feriado`,`sabado`,`horasextra_diurna`,`horasextras_nocturna`) VALUES
('3','0','1','0','0','0','0');
INSERT INTO `asignaciones` (`id`,`b_alimenticio`,`asistencia`,`feriado`,`sabado`,`horasextra_diurna`,`horasextras_nocturna`) VALUES
('4','30','0','0','0','0','0');
INSERT INTO `asignaciones` (`id`,`b_alimenticio`,`asistencia`,`feriado`,`sabado`,`horasextra_diurna`,`horasextras_nocturna`) VALUES
('5','30','0','0','0','0','0');
INSERT INTO `asignaciones` (`id`,`b_alimenticio`,`asistencia`,`feriado`,`sabado`,`horasextra_diurna`,`horasextras_nocturna`) VALUES
('6','30','0','0','0','0','0');
INSERT INTO `asignaciones` (`id`,`b_alimenticio`,`asistencia`,`feriado`,`sabado`,`horasextra_diurna`,`horasextras_nocturna`) VALUES
('7','30','0','0','0','0','0');
INSERT INTO `asignaciones` (`id`,`b_alimenticio`,`asistencia`,`feriado`,`sabado`,`horasextra_diurna`,`horasextras_nocturna`) VALUES
('8','30','0','0','0','0','0');
INSERT INTO `asignaciones` (`id`,`b_alimenticio`,`asistencia`,`feriado`,`sabado`,`horasextra_diurna`,`horasextras_nocturna`) VALUES
('9','30','0','0','0','0','0');
INSERT INTO `asignaciones` (`id`,`b_alimenticio`,`asistencia`,`feriado`,`sabado`,`horasextra_diurna`,`horasextras_nocturna`) VALUES
('10','30','0','0','0','0','0');
INSERT INTO `asignaciones` (`id`,`b_alimenticio`,`asistencia`,`feriado`,`sabado`,`horasextra_diurna`,`horasextras_nocturna`) VALUES
('11','30','0','1','1','1','1');
INSERT INTO `asignaciones` (`id`,`b_alimenticio`,`asistencia`,`feriado`,`sabado`,`horasextra_diurna`,`horasextras_nocturna`) VALUES
('12','30','1','1','1','1','1');
INSERT INTO `asignaciones` (`id`,`b_alimenticio`,`asistencia`,`feriado`,`sabado`,`horasextra_diurna`,`horasextras_nocturna`) VALUES
('13','0','0','0','0','1','2');
INSERT INTO `asignaciones` (`id`,`b_alimenticio`,`asistencia`,`feriado`,`sabado`,`horasextra_diurna`,`horasextras_nocturna`) VALUES
('14','0','1','0','0','1','1');
INSERT INTO `asignaciones` (`id`,`b_alimenticio`,`asistencia`,`feriado`,`sabado`,`horasextra_diurna`,`horasextras_nocturna`) VALUES
('15','30','1','0','0','0','0');
INSERT INTO `asignaciones` (`id`,`b_alimenticio`,`asistencia`,`feriado`,`sabado`,`horasextra_diurna`,`horasextras_nocturna`) VALUES
('16','0','1','0','0','0','0');
INSERT INTO `asignaciones` (`id`,`b_alimenticio`,`asistencia`,`feriado`,`sabado`,`horasextra_diurna`,`horasextras_nocturna`) VALUES
('17','0','1','0','0','0','0');
INSERT INTO `asignaciones` (`id`,`b_alimenticio`,`asistencia`,`feriado`,`sabado`,`horasextra_diurna`,`horasextras_nocturna`) VALUES
('18','0','1','0','0','0','0');
INSERT INTO `asignaciones` (`id`,`b_alimenticio`,`asistencia`,`feriado`,`sabado`,`horasextra_diurna`,`horasextras_nocturna`) VALUES
('19','0','1','0','0','0','0');
INSERT INTO `asignaciones` (`id`,`b_alimenticio`,`asistencia`,`feriado`,`sabado`,`horasextra_diurna`,`horasextras_nocturna`) VALUES
('20','0','1','0','0','0','0');
INSERT INTO `asignaciones` (`id`,`b_alimenticio`,`asistencia`,`feriado`,`sabado`,`horasextra_diurna`,`horasextras_nocturna`) VALUES
('21','0','0','0','0','0','0');
INSERT INTO `asignaciones` (`id`,`b_alimenticio`,`asistencia`,`feriado`,`sabado`,`horasextra_diurna`,`horasextras_nocturna`) VALUES
('22','30','0','0','0','0','0');
INSERT INTO `asignaciones` (`id`,`b_alimenticio`,`asistencia`,`feriado`,`sabado`,`horasextra_diurna`,`horasextras_nocturna`) VALUES
('23','30','0','0','0','0','0');
INSERT INTO `asignaciones` (`id`,`b_alimenticio`,`asistencia`,`feriado`,`sabado`,`horasextra_diurna`,`horasextras_nocturna`) VALUES
('24','0','0','0','0','0','0');
INSERT INTO `asignaciones` (`id`,`b_alimenticio`,`asistencia`,`feriado`,`sabado`,`horasextra_diurna`,`horasextras_nocturna`) VALUES
('25','0','0','0','0','0','0');
INSERT INTO `asignaciones` (`id`,`b_alimenticio`,`asistencia`,`feriado`,`sabado`,`horasextra_diurna`,`horasextras_nocturna`) VALUES
('26','30','0','0','0','0','0');
INSERT INTO `asignaciones` (`id`,`b_alimenticio`,`asistencia`,`feriado`,`sabado`,`horasextra_diurna`,`horasextras_nocturna`) VALUES
('27','30','0','0','0','0','0');
INSERT INTO `asignaciones` (`id`,`b_alimenticio`,`asistencia`,`feriado`,`sabado`,`horasextra_diurna`,`horasextras_nocturna`) VALUES
('28','30','0','0','0','0','0');
INSERT INTO `asignaciones` (`id`,`b_alimenticio`,`asistencia`,`feriado`,`sabado`,`horasextra_diurna`,`horasextras_nocturna`) VALUES
('29','30','0','0','0','0','0');
INSERT INTO `asignaciones` (`id`,`b_alimenticio`,`asistencia`,`feriado`,`sabado`,`horasextra_diurna`,`horasextras_nocturna`) VALUES
('30','30','0','0','0','0','0');
INSERT INTO `asignaciones` (`id`,`b_alimenticio`,`asistencia`,`feriado`,`sabado`,`horasextra_diurna`,`horasextras_nocturna`) VALUES
('31','30','0','0','0','0','0');
INSERT INTO `asignaciones` (`id`,`b_alimenticio`,`asistencia`,`feriado`,`sabado`,`horasextra_diurna`,`horasextras_nocturna`) VALUES
('32','30','0','0','0','0','0');
INSERT INTO `asignaciones` (`id`,`b_alimenticio`,`asistencia`,`feriado`,`sabado`,`horasextra_diurna`,`horasextras_nocturna`) VALUES
('33','30','1','0','0','0','0');
INSERT INTO `asignaciones` (`id`,`b_alimenticio`,`asistencia`,`feriado`,`sabado`,`horasextra_diurna`,`horasextras_nocturna`) VALUES
('34','30','0','0','0','0','0');
INSERT INTO `asignaciones` (`id`,`b_alimenticio`,`asistencia`,`feriado`,`sabado`,`horasextra_diurna`,`horasextras_nocturna`) VALUES
('35','30','1','0','0','0','0');
INSERT INTO `asignaciones` (`id`,`b_alimenticio`,`asistencia`,`feriado`,`sabado`,`horasextra_diurna`,`horasextras_nocturna`) VALUES
('36','30','1','0','0','0','0');
INSERT INTO `asignaciones` (`id`,`b_alimenticio`,`asistencia`,`feriado`,`sabado`,`horasextra_diurna`,`horasextras_nocturna`) VALUES
('37','30','1','0','0','0','0');
INSERT INTO `asignaciones` (`id`,`b_alimenticio`,`asistencia`,`feriado`,`sabado`,`horasextra_diurna`,`horasextras_nocturna`) VALUES
('38','30','1','0','0','0','1');
INSERT INTO `asignaciones` (`id`,`b_alimenticio`,`asistencia`,`feriado`,`sabado`,`horasextra_diurna`,`horasextras_nocturna`) VALUES
('39','30','1','0','0','1','0');
INSERT INTO `asignaciones` (`id`,`b_alimenticio`,`asistencia`,`feriado`,`sabado`,`horasextra_diurna`,`horasextras_nocturna`) VALUES
('40','30','1','0','0','0','0');
INSERT INTO `asignaciones` (`id`,`b_alimenticio`,`asistencia`,`feriado`,`sabado`,`horasextra_diurna`,`horasextras_nocturna`) VALUES
('41','30','1','0','0','0','0');
INSERT INTO `asignaciones` (`id`,`b_alimenticio`,`asistencia`,`feriado`,`sabado`,`horasextra_diurna`,`horasextras_nocturna`) VALUES
('42','30','1','0','0','0','0');
INSERT INTO `asignaciones` (`id`,`b_alimenticio`,`asistencia`,`feriado`,`sabado`,`horasextra_diurna`,`horasextras_nocturna`) VALUES
('43','30','1','0','0','0','0');
INSERT INTO `asignaciones` (`id`,`b_alimenticio`,`asistencia`,`feriado`,`sabado`,`horasextra_diurna`,`horasextras_nocturna`) VALUES
('44','30','1','0','0','0','0');
INSERT INTO `asignaciones` (`id`,`b_alimenticio`,`asistencia`,`feriado`,`sabado`,`horasextra_diurna`,`horasextras_nocturna`) VALUES
('45','30','1','0','0','0','0');
INSERT INTO `asignaciones` (`id`,`b_alimenticio`,`asistencia`,`feriado`,`sabado`,`horasextra_diurna`,`horasextras_nocturna`) VALUES
('46','30','0','0','0','0','0');
INSERT INTO `asignaciones` (`id`,`b_alimenticio`,`asistencia`,`feriado`,`sabado`,`horasextra_diurna`,`horasextras_nocturna`) VALUES
('47','30','0','0','0','0','0');
INSERT INTO `asignaciones` (`id`,`b_alimenticio`,`asistencia`,`feriado`,`sabado`,`horasextra_diurna`,`horasextras_nocturna`) VALUES
('48','30','1','0','0','0','0');
INSERT INTO `asignaciones` (`id`,`b_alimenticio`,`asistencia`,`feriado`,`sabado`,`horasextra_diurna`,`horasextras_nocturna`) VALUES
('49','30','1','0','0','0','0');
INSERT INTO `asignaciones` (`id`,`b_alimenticio`,`asistencia`,`feriado`,`sabado`,`horasextra_diurna`,`horasextras_nocturna`) VALUES
('50','30','1','0','0','0','0');
INSERT INTO `asignaciones` (`id`,`b_alimenticio`,`asistencia`,`feriado`,`sabado`,`horasextra_diurna`,`horasextras_nocturna`) VALUES
('51','28','0','0','0','0','0');
INSERT INTO `asignaciones` (`id`,`b_alimenticio`,`asistencia`,`feriado`,`sabado`,`horasextra_diurna`,`horasextras_nocturna`) VALUES
('52','30','1','0','0','0','0');
INSERT INTO `asignaciones` (`id`,`b_alimenticio`,`asistencia`,`feriado`,`sabado`,`horasextra_diurna`,`horasextras_nocturna`) VALUES
('53','30','0','0','0','0','0');
INSERT INTO `asignaciones` (`id`,`b_alimenticio`,`asistencia`,`feriado`,`sabado`,`horasextra_diurna`,`horasextras_nocturna`) VALUES
('54','30','0','0','0','0','0');
INSERT INTO `asignaciones` (`id`,`b_alimenticio`,`asistencia`,`feriado`,`sabado`,`horasextra_diurna`,`horasextras_nocturna`) VALUES
('55','30','0','0','0','0','0');
INSERT INTO `asignaciones` (`id`,`b_alimenticio`,`asistencia`,`feriado`,`sabado`,`horasextra_diurna`,`horasextras_nocturna`) VALUES
('56','30','0','0','0','0','0');
INSERT INTO `asignaciones` (`id`,`b_alimenticio`,`asistencia`,`feriado`,`sabado`,`horasextra_diurna`,`horasextras_nocturna`) VALUES
('57','30','0','0','0','0','0');
INSERT INTO `asignaciones` (`id`,`b_alimenticio`,`asistencia`,`feriado`,`sabado`,`horasextra_diurna`,`horasextras_nocturna`) VALUES
('58','30','0','0','0','0','0');
INSERT INTO `asignaciones` (`id`,`b_alimenticio`,`asistencia`,`feriado`,`sabado`,`horasextra_diurna`,`horasextras_nocturna`) VALUES
('59','30','0','0','0','0','0');
INSERT INTO `asignaciones` (`id`,`b_alimenticio`,`asistencia`,`feriado`,`sabado`,`horasextra_diurna`,`horasextras_nocturna`) VALUES
('60','30','1','0','0','0','0');
INSERT INTO `asignaciones` (`id`,`b_alimenticio`,`asistencia`,`feriado`,`sabado`,`horasextra_diurna`,`horasextras_nocturna`) VALUES
('61','30','1','0','0','0','0');
INSERT INTO `asignaciones` (`id`,`b_alimenticio`,`asistencia`,`feriado`,`sabado`,`horasextra_diurna`,`horasextras_nocturna`) VALUES
('62','30','0','0','0','0','0');
INSERT INTO `asignaciones` (`id`,`b_alimenticio`,`asistencia`,`feriado`,`sabado`,`horasextra_diurna`,`horasextras_nocturna`) VALUES
('63','30','1','0','0','0','0');
INSERT INTO `asignaciones` (`id`,`b_alimenticio`,`asistencia`,`feriado`,`sabado`,`horasextra_diurna`,`horasextras_nocturna`) VALUES
('64','30','1','0','0','0','0');
INSERT INTO `asignaciones` (`id`,`b_alimenticio`,`asistencia`,`feriado`,`sabado`,`horasextra_diurna`,`horasextras_nocturna`) VALUES
('65','30','1','0','0','0','0');
INSERT INTO `asignaciones` (`id`,`b_alimenticio`,`asistencia`,`feriado`,`sabado`,`horasextra_diurna`,`horasextras_nocturna`) VALUES
('66','30','1','0','0','0','0');
INSERT INTO `asignaciones` (`id`,`b_alimenticio`,`asistencia`,`feriado`,`sabado`,`horasextra_diurna`,`horasextras_nocturna`) VALUES
('67','30','1','0','0','0','0');
INSERT INTO `asignaciones` (`id`,`b_alimenticio`,`asistencia`,`feriado`,`sabado`,`horasextra_diurna`,`horasextras_nocturna`) VALUES
('68','30','1','0','0','0','0');
INSERT INTO `asignaciones` (`id`,`b_alimenticio`,`asistencia`,`feriado`,`sabado`,`horasextra_diurna`,`horasextras_nocturna`) VALUES
('69','30','1','0','0','0','0');
INSERT INTO `asignaciones` (`id`,`b_alimenticio`,`asistencia`,`feriado`,`sabado`,`horasextra_diurna`,`horasextras_nocturna`) VALUES
('70','30','1','0','0','0','0');
INSERT INTO `asignaciones` (`id`,`b_alimenticio`,`asistencia`,`feriado`,`sabado`,`horasextra_diurna`,`horasextras_nocturna`) VALUES
('71','30','1','0','0','0','0');
INSERT INTO `asignaciones` (`id`,`b_alimenticio`,`asistencia`,`feriado`,`sabado`,`horasextra_diurna`,`horasextras_nocturna`) VALUES
('72','30','1','0','0','0','0');
INSERT INTO `asignaciones` (`id`,`b_alimenticio`,`asistencia`,`feriado`,`sabado`,`horasextra_diurna`,`horasextras_nocturna`) VALUES
('73','30','1','0','0','0','0');
INSERT INTO `asignaciones` (`id`,`b_alimenticio`,`asistencia`,`feriado`,`sabado`,`horasextra_diurna`,`horasextras_nocturna`) VALUES
('74','30','1','0','0','0','0');
INSERT INTO `asignaciones` (`id`,`b_alimenticio`,`asistencia`,`feriado`,`sabado`,`horasextra_diurna`,`horasextras_nocturna`) VALUES
('75','30','1','0','0','0','0');
-- -------------------------------------------
-- TABLE DATA auditoria
-- -------------------------------------------
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('1','3','1','Hijos','2','2016-02-29 03:28:56');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('2','3','1','Personas','46','2016-02-29 03:29:15');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('3','3','1','Conceptos','2','2016-02-29 03:29:25');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('4','8','4','Empleados','4','2016-03-12 08:53:53');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('5','8','4','Empleados','6','2016-03-12 08:53:55');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('6','8','4','Empleados','5','2016-03-12 08:53:57');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('7','8','4','Empleados','8','2016-03-12 08:53:59');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('8','8','4','Empleados','7','2016-03-12 08:54:02');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('9','8','4','Empleados','2','2016-03-12 08:54:07');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('10','8','4','Empleados','3','2016-03-12 08:54:09');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('11','8','4','Empleados','1','2016-03-12 08:54:11');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('12','8','2','Empleados','1','2016-03-12 09:00:34');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('13','8','3','Empleados','1','2016-03-12 09:01:05');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('14','8','2','Personas','58','2016-03-12 09:07:59');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('15','8','1','Personas','58','2016-03-12 09:07:59');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('16','8','3','Personas','58','2016-03-12 09:10:27');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('17','8','1','Personas','58','2016-03-12 09:10:27');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('18','8','3','Personas','58','2016-03-12 09:11:00');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('19','8','1','Personas','58','2016-03-12 09:11:00');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('20','3','3','Personas','58','2016-03-12 09:11:35');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('21','3','1','Personas','58','2016-03-12 09:11:36');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('22','3','3','Personas','58','2016-03-12 09:21:05');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('23','3','1','Personas','58','2016-03-12 09:21:05');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('24','3','3','Personas','58','2016-03-12 09:25:26');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('25','3','1','Personas','58','2016-03-12 09:25:26');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('26','3','3','Personas','58','2016-03-12 09:25:49');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('27','3','1','Personas','58','2016-03-12 09:25:49');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('28','3','3','Personas','58','2016-03-12 02:58:34');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('29','3','1','Personas','58','2016-03-12 09:28:34');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('30','3','1','Personas','58','2016-03-12 09:28:47');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('31','3','1','Personas','58','2016-03-12 09:28:48');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('32','3','1','Personas','58','2016-03-12 09:28:48');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('33','3','3','Personas','58','2016-03-12 09:29:00');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('34','3','1','Personas','58','2016-03-12 09:29:01');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('35','3','3','Personas','58','2016-03-12 02:59:19');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('36','3','1','Personas','58','2016-03-12 09:29:19');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('37','3','3','Personas','58','2016-03-12 09:29:43');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('38','3','1','Personas','58','2016-03-12 09:29:44');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('39','3','1','Personas','58','2016-03-12 09:29:57');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('40','3','1','Personas','58','2016-03-12 09:29:58');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('41','3','3','Personas','58','2016-03-12 09:30:13');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('42','3','1','Personas','58','2016-03-12 09:30:13');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('43','3','3','Personas','58','2016-03-12 09:30:28');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('44','3','1','Personas','58','2016-03-12 09:30:28');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('45','8','3','Personas','58','2016-03-12 09:31:31');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('46','8','1','Personas','58','2016-03-12 09:31:32');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('47','8','2','Empleados','2','2016-03-12 09:33:44');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('48','8','2','Empleados','3','2016-03-12 09:37:22');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('49','8','2','Empleados','4','2016-03-12 09:38:44');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('50','8','3','Empleados','4','2016-03-12 09:38:59');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('51','8','2','Empleados','5','2016-03-12 09:39:43');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('52','8','2','Empleados','6','2016-03-12 09:41:10');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('53','8','2','Empleados','7','2016-03-12 09:51:59');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('54','8','2','Empleados','8','2016-03-12 09:53:50');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('55','8','2','Empleados','9','2016-03-12 09:59:53');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('56','8','2','Empleados','10','2016-03-12 10:07:13');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('57','8','2','Empleados','11','2016-03-12 10:14:45');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('58','8','2','Empleados','12','2016-03-12 10:16:13');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('59','8','2','Empleados','13','2016-03-12 10:18:00');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('60','8','2','Empleados','14','2016-03-12 10:20:01');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('61','8','2','Empleados','15','2016-03-12 10:21:34');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('62','8','2','Personas','59','2016-03-12 10:25:00');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('63','8','1','Personas','59','2016-03-12 10:25:00');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('64','8','2','Empleados','16','2016-03-12 10:26:32');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('65','8','2','Empleados','17','2016-03-12 10:27:32');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('66','8','2','Empleados','18','2016-03-12 10:28:44');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('67','8','2','Empleados','19','2016-03-12 10:30:29');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('68','8','2','Empleados','20','2016-03-12 10:31:37');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('69','8','2','Empleados','21','2016-03-12 10:32:58');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('70','8','2','Empleados','22','2016-03-12 10:34:15');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('71','8','2','Personas','60','2016-03-12 10:48:47');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('72','8','1','Personas','60','2016-03-12 10:48:47');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('73','8','2','Empleados','23','2016-03-12 10:51:00');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('74','8','2','Cargos','36','2016-03-12 10:51:31');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('75','8','1','Cargos','36','2016-03-12 10:51:31');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('76','8','3','Empleados','23','2016-03-12 10:52:06');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('77','8','2','Empleados','24','2016-03-12 10:55:56');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('78','8','2','Personas','61','2016-03-12 10:58:51');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('79','8','1','Personas','61','2016-03-12 10:58:51');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('80','8','2','Empleados','25','2016-03-12 11:04:37');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('81','8','2','Personas','62','2016-03-12 11:12:58');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('82','8','1','Personas','62','2016-03-12 11:12:59');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('83','8','2','Empleados','26','2016-03-12 11:13:40');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('84','8','2','Personas','63','2016-03-12 11:15:37');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('85','8','1','Personas','63','2016-03-12 11:15:37');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('86','8','2','Empleados','27','2016-03-12 11:16:22');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('87','8','2','Personas','64','2016-03-12 11:17:50');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('88','8','1','Personas','64','2016-03-12 11:17:50');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('89','8','2','Empleados','28','2016-03-12 11:18:28');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('90','8','2','Personas','65','2016-03-12 11:19:57');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('91','8','1','Personas','65','2016-03-12 11:19:57');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('92','8','2','Empleados','29','2016-03-12 11:20:41');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('93','8','2','Personas','66','2016-03-12 11:22:18');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('94','8','1','Personas','66','2016-03-12 11:22:18');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('95','8','2','Empleados','30','2016-03-12 11:22:55');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('96','8','2','Empleados','31','2016-03-12 11:29:14');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('97','8','2','Empleados','32','2016-03-12 11:38:07');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('98','8','2','Empleados','33','2016-03-12 11:39:33');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('99','8','2','Empleados','34','2016-03-12 11:49:37');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('100','8','3','Empleados','33','2016-03-12 11:49:47');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('101','8','3','Empleados','31','2016-03-12 11:50:01');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('102','8','3','Empleados','32','2016-03-12 11:50:13');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('103','8','2','Empleados','35','2016-03-12 11:51:51');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('104','8','2','Personas','67','2016-03-12 12:01:48');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('105','8','1','Personas','67','2016-03-12 12:01:48');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('106','8','2','Cargos','37','2016-03-12 12:03:36');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('107','8','1','Cargos','37','2016-03-12 12:03:36');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('108','8','2','Empleados','36','2016-03-12 12:04:37');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('109','8','2','Empleados','37','2016-03-12 12:06:14');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('110','8','2','Empleados','38','2016-03-12 12:08:09');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('111','8','2','Empleados','39','2016-03-12 12:09:33');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('112','8','2','Empleados','40','2016-03-12 12:15:12');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('113','8','2','Empleados','41','2016-03-12 12:30:01');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('114','8','2','Empleados','42','2016-03-12 12:33:18');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('115','8','2','Empleados','43','2016-03-12 12:34:48');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('116','8','2','Empleados','44','2016-03-12 12:36:19');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('117','8','2','Cargos','38','2016-03-12 12:36:48');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('118','8','1','Cargos','38','2016-03-12 12:36:48');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('119','8','3','Empleados','44','2016-03-12 12:37:17');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('120','8','3','Empleados','44','2016-03-12 12:37:33');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('121','8','2','Empleados','45','2016-03-12 12:38:40');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('122','8','2','Empleados','46','2016-03-12 12:40:02');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('123','8','2','Empleados','47','2016-03-12 12:43:11');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('124','8','2','Empleados','48','2016-03-12 12:44:36');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('125','8','2','Empleados','49','2016-03-12 12:55:35');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('126','8','2','Empleados','50','2016-03-12 02:04:22');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('127','8','2','Cargos','39','2016-03-12 02:06:14');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('128','8','1','Cargos','39','2016-03-12 02:06:14');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('129','8','3','Empleados','50','2016-03-12 02:06:29');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('130','8','2','Empleados','51','2016-03-12 02:07:31');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('131','8','2','Empleados','52','2016-03-12 02:09:46');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('132','8','2','Empleados','53','2016-03-12 02:12:05');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('133','8','2','Empleados','54','2016-03-12 02:16:26');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('134','8','2','Empleados','55','2016-03-12 02:18:25');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('135','8','2','Empleados','56','2016-03-12 02:23:05');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('136','8','2','Empleados','57','2016-03-12 02:26:09');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('137','8','2','Cargos','40','2016-03-12 02:26:27');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('138','8','1','Cargos','40','2016-03-12 02:26:27');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('139','8','3','Empleados','57','2016-03-12 02:26:57');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('140','8','2','Empleados','58','2016-03-12 02:28:33');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('141','8','2','Empleados','59','2016-03-12 02:31:23');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('142','8','2','Personas','68','2016-03-16 04:23:11');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('143','8','1','Personas','68','2016-03-16 04:23:12');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('144','8','2','Empleados','60','2016-03-16 04:24:30');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('145','8','2','Empleados','61','2016-03-16 04:29:25');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('146','8','2','Empleados','62','2016-03-16 04:41:25');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('147','8','2','Empleados','63','2016-03-16 04:44:58');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('148','8','2','Empleados','64','2016-03-16 04:54:33');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('149','3','2','Nomina','1','2016-03-28 08:42:29');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('150','3','6','Nomina','1','2016-03-28 08:42:32');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('151','3','6','Nomina','1','2016-03-28 08:43:53');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('152','3','6','Nomina','1','2016-03-28 08:45:22');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('153','3','6','Nomina','1','2016-03-28 08:46:35');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('154','3','6','Nomina','1','2016-03-28 08:46:56');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('155','3','2','Personas','69','2016-03-28 08:51:09');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('156','3','1','Personas','69','2016-03-28 08:51:09');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('157','3','4','Personas','69','2016-03-28 08:51:26');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('158','8','2','Personas','69','2016-03-28 09:35:06');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('159','8','1','Personas','69','2016-03-28 09:35:06');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('160','8','2','Empleados','65','2016-03-28 09:46:54');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('161','8','2','Personas','70','2016-03-28 09:52:01');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('162','8','1','Personas','70','2016-03-28 09:52:01');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('163','8','2','Empleados','66','2016-03-28 09:52:44');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('164','8','2','Personas','71','2016-03-28 09:54:52');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('165','8','1','Personas','71','2016-03-28 09:54:52');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('166','8','2','Empleados','67','2016-03-28 09:56:57');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('167','8','2','Personas','72','2016-03-28 10:00:18');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('168','8','1','Personas','72','2016-03-28 10:00:19');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('169','8','2','Empleados','68','2016-03-28 10:02:23');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('170','8','2','Personas','73','2016-03-28 10:05:37');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('171','8','1','Personas','73','2016-03-28 10:05:37');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('172','8','2','Empleados','69','2016-03-28 10:07:00');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('173','8','2','Empleados','70','2016-03-28 10:09:24');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('174','8','2','Empleados','71','2016-03-28 10:10:31');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('175','8','2','Empleados','72','2016-03-28 10:11:50');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('176','8','2','Nomina','1','2016-03-28 10:38:55');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('177','8','2','Conceptos','10','2016-03-28 10:40:32');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('178','8','1','Conceptos','10','2016-03-28 10:40:32');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('179','8','2','Nomina','2','2016-03-28 10:41:54');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('180','8','3','Nomina','2','2016-03-28 10:53:48');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('181','8','2','Nomina','3','2016-03-28 11:00:16');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('182','8','3','Empleados','2','2016-03-28 11:00:57');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('183','8','3','Cargos','25','2016-03-28 11:01:36');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('184','8','1','Cargos','25','2016-03-28 11:01:36');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('185','8','2','Nomina','4','2016-03-28 11:02:20');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('186','8','2','Nomina','5','2016-03-28 11:03:56');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('187','8','7','Nomina','0','2016-03-28 11:04:54');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('188','8','7','Nomina','0','2016-03-28 11:07:54');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('189','8','6','Nomina','5','2016-03-28 11:08:20');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('190','8','2','Nomina','6','2016-03-28 11:12:27');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('191','8','3','Nomina','6','2016-03-28 11:18:11');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('192','8','2','Nomina','7','2016-03-28 11:19:36');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('193','8','3','Nomina','7','2016-03-28 11:27:04');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('194','8','2','Nomina','8','2016-03-28 11:28:40');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('195','8','2','Nomina','9','2016-03-28 11:29:31');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('196','8','2','Nomina','10','2016-03-28 11:30:27');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('197','8','3','Nomina','10','2016-03-28 11:33:12');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('198','8','2','Nomina','11','2016-03-28 11:33:51');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('199','8','2','Nomina','12','2016-03-28 11:34:43');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('200','8','3','Nomina','12','2016-03-28 11:35:25');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('201','8','6','Nomina','12','2016-03-28 11:35:45');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('202','8','3','Nomina','12','2016-03-28 11:36:24');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('203','3','6','Nomina','12','2016-03-28 11:39:09');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('204','3','7','Nomina','0','2016-03-28 11:39:51');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('205','8','6','Nomina','12','2016-03-28 11:41:12');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('206','8','7','Nomina','0','2016-03-28 11:41:23');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('207','8','3','Nomina','12','2016-03-28 11:42:25');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('208','8','7','Nomina','0','2016-03-28 11:42:44');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('209','8','3','Nomina','12','2016-03-28 11:43:58');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('210','8','2','Nomina','13','2016-03-28 11:45:01');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('211','8','3','Nomina','13','2016-03-28 11:45:47');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('212','8','2','Nomina','14','2016-03-28 11:47:11');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('213','8','3','Cargos','2','2016-03-28 11:47:54');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('214','8','1','Cargos','2','2016-03-28 11:47:54');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('215','8','2','Nomina','15','2016-03-28 11:48:49');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('216','8','2','Nomina','16','2016-03-28 11:49:31');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('217','8','2','Nomina','17','2016-03-28 11:50:36');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('218','8','6','Nomina','17','2016-03-28 11:50:47');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('219','8','2','Cargos','41','2016-03-28 11:51:51');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('220','8','1','Cargos','41','2016-03-28 11:51:51');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('221','8','3','Empleados','14','2016-03-28 11:52:23');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('222','8','3','Nomina','17','2016-03-28 11:52:36');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('223','8','2','Nomina','18','2016-03-28 11:53:30');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('224','8','7','Nomina','0','2016-03-28 11:53:54');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('225','8','2','Nomina','19','2016-03-28 11:55:07');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('226','8','7','Nomina','0','2016-03-28 11:55:34');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('227','3','7','Nomina','0','2016-03-28 03:23:41');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('228','3','6','Nomina','19','2016-03-28 03:28:00');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('229','3','6','Nomina','4','2016-03-28 03:30:16');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('230','3','6','Nomina','5','2016-03-28 03:33:12');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('231','3','6','Nomina','12','2016-03-28 03:33:27');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('232','3','6','Nomina','12','2016-03-28 04:05:07');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('233','8','6','Nomina','4','2016-03-29 09:40:28');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('234','8','2','Nomina','20','2016-03-29 09:43:25');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('235','8','3','Nomina','20','2016-03-29 09:43:59');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('236','8','3','Nomina','20','2016-03-29 09:51:42');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('237','8','2','Nomina','21','2016-03-29 10:08:11');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('238','8','3','Nomina','21','2016-03-29 10:08:36');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('239','8','3','Nomina','20','2016-03-29 10:09:21');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('240','8','2','Nomina','22','2016-03-29 10:12:11');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('241','8','2','Nomina','23','2016-03-29 10:12:38');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('242','8','3','Nomina','23','2016-03-29 10:12:53');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('243','8','2','Nomina','24','2016-03-29 10:13:27');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('244','8','2','Nomina','25','2016-03-29 10:16:31');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('245','8','3','Nomina','25','2016-03-29 10:16:58');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('246','8','1','Empleados','63','2016-03-29 10:18:07');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('247','8','2','Cargos','42','2016-03-29 10:18:34');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('248','8','1','Cargos','42','2016-03-29 10:18:35');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('249','8','3','Empleados','19','2016-03-29 10:18:52');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('250','8','2','Nomina','26','2016-03-29 10:19:21');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('251','8','3','Nomina','26','2016-03-29 10:19:47');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('252','8','2','Nomina','27','2016-03-29 10:20:57');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('253','8','2','Nomina','28','2016-03-29 10:33:48');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('254','8','3','Nomina','28','2016-03-29 10:34:00');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('255','8','2','Nomina','29','2016-03-29 10:34:58');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('256','8','2','Nomina','30','2016-03-29 10:36:06');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('257','8','1','Nomina','30','2016-03-29 10:36:13');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('258','8','3','Nomina','30','2016-03-29 10:36:34');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('259','8','1','Nomina','30','2016-03-29 10:36:39');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('260','8','3','Nomina','30','2016-03-29 10:37:34');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('261','8','2','Nomina','31','2016-03-29 10:40:41');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('262','8','2','Nomina','32','2016-03-29 10:59:38');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('263','8','1','Nomina','32','2016-03-29 11:00:05');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('264','8','3','Empleados','31','2016-03-29 11:00:54');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('265','8','2','Nomina','33','2016-03-29 11:01:42');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('266','8','1','Empleados','31','2016-03-29 11:02:11');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('267','8','1','Nomina','33','2016-03-29 11:03:58');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('268','8','3','Nomina','33','2016-03-29 11:04:14');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('269','3','7','Nomina','0','2016-03-29 03:35:12');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('270','3','6','Nomina','33','2016-03-29 03:41:22');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('271','8','2','Nomina','34','2016-03-29 03:46:04');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('272','8','3','Nomina','34','2016-03-29 03:46:22');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('273','8','3','Nomina','34','2016-03-29 03:46:53');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('274','8','2','Nomina','35','2016-03-29 03:47:13');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('275','8','3','Nomina','35','2016-03-29 03:47:39');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('276','8','3','Empleados','34','2016-03-29 03:48:08');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('277','8','2','Nomina','36','2016-03-29 03:48:41');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('278','8','2','Nomina','37','2016-03-29 03:49:24');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('279','8','2','Nomina','38','2016-03-29 03:49:51');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('280','8','2','Nomina','39','2016-03-29 03:50:27');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('281','8','1','Empleados','38','2016-03-29 03:51:01');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('282','8','3','Empleados','38','2016-03-29 03:51:25');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('283','8','2','Nomina','40','2016-03-29 03:51:57');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('284','8','1','Empleados','46','2016-03-29 03:53:01');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('285','8','3','Empleados','39','2016-03-29 03:53:29');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('286','8','2','Nomina','41','2016-03-29 03:54:13');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('287','8','2','Nomina','42','2016-03-29 03:54:57');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('288','8','2','Nomina','43','2016-03-29 03:55:41');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('289','8','2','Nomina','44','2016-03-29 03:56:37');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('290','8','2','Nomina','45','2016-03-29 03:57:52');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('291','8','2','Nomina','46','2016-03-29 03:58:51');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('292','8','2','Nomina','47','2016-03-29 03:59:35');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('293','8','2','Nomina','48','2016-03-29 04:00:07');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('294','8','2','Nomina','49','2016-03-29 04:00:46');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('295','8','2','Nomina','50','2016-03-29 04:01:18');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('296','8','2','Nomina','51','2016-03-29 04:01:53');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('297','8','2','Nomina','52','2016-03-29 04:02:56');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('298','8','2','Nomina','53','2016-03-29 04:03:25');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('299','8','2','Nomina','54','2016-03-29 04:06:53');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('300','8','7','Nomina','0','2016-03-29 04:08:42');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('301','3','7','Nomina','0','2016-03-29 04:15:26');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('302','3','7','Nomina','0','2016-03-29 04:16:42');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('303','3','7','Nomina','0','2016-03-29 04:19:10');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('304','3','6','Nomina','54','2016-03-29 04:29:45');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('305','3','5','Personas','46','2016-03-29 04:30:51');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('306','3','1','Personas','46','2016-03-29 04:34:22');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('307','3','1','Empleados','63','2016-03-29 04:34:27');
INSERT INTO `auditoria` (`id`,`id_user`,`accion`,`modelo`,`id_registro`,`fecha`) VALUES
('308','3','5','Personas','46','2016-03-29 04:36:20');
-- -------------------------------------------
-- TABLE DATA cargos
-- -------------------------------------------
INSERT INTO `cargos` (`id`,`cargo`,`sueldo`,`tipo_sueldo`) VALUES
('1','Obrero de 1ra.','2560','1');
INSERT INTO `cargos` (`id`,`cargo`,`sueldo`,`tipo_sueldo`) VALUES
('2','Vigilante','2561','1');
INSERT INTO `cargos` (`id`,`cargo`,`sueldo`,`tipo_sueldo`) VALUES
('3','Ayudante','2740','1');
INSERT INTO `cargos` (`id`,`cargo`,`sueldo`,`tipo_sueldo`) VALUES
('4','Ayudante Mecánico dissel','3071','1');
INSERT INTO `cargos` (`id`,`cargo`,`sueldo`,`tipo_sueldo`) VALUES
('5','Chófer de 2da. (de 3 a 8 tons.)','2922.57','1');
INSERT INTO `cargos` (`id`,`cargo`,`sueldo`,`tipo_sueldo`) VALUES
('6','Albañil de 2da.','3071.53','1');
INSERT INTO `cargos` (`id`,`cargo`,`sueldo`,`tipo_sueldo`) VALUES
('7','Cabillero de 2da.','3071.53','1');
INSERT INTO `cargos` (`id`,`cargo`,`sueldo`,`tipo_sueldo`) VALUES
('8','carpintero de 2da.','3071.53','1');
INSERT INTO `cargos` (`id`,`cargo`,`sueldo`,`tipo_sueldo`) VALUES
('9','Electricista de 2da.','3071.53','1');
INSERT INTO `cargos` (`id`,`cargo`,`sueldo`,`tipo_sueldo`) VALUES
('10','Pintor de 2da.','3071.53','1');
INSERT INTO `cargos` (`id`,`cargo`,`sueldo`,`tipo_sueldo`) VALUES
('11','Chófer de 1ra. (8 a 15 ton.)','3112.2','1');
INSERT INTO `cargos` (`id`,`cargo`,`sueldo`,`tipo_sueldo`) VALUES
('12','Chofer de camion mas de 15 ton.','3193.68','1');
INSERT INTO `cargos` (`id`,`cargo`,`sueldo`,`tipo_sueldo`) VALUES
('13','Albañil de 1ra.','3435','1');
INSERT INTO `cargos` (`id`,`cargo`,`sueldo`,`tipo_sueldo`) VALUES
('14','Cabillero de 1ra.','3435','1');
INSERT INTO `cargos` (`id`,`cargo`,`sueldo`,`tipo_sueldo`) VALUES
('15','Carpintero de 1ra.','3435','1');
INSERT INTO `cargos` (`id`,`cargo`,`sueldo`,`tipo_sueldo`) VALUES
('16','Electricista de 1ra.','3435','1');
INSERT INTO `cargos` (`id`,`cargo`,`sueldo`,`tipo_sueldo`) VALUES
('17','Pintor de 1ra.','3435','1');
INSERT INTO `cargos` (`id`,`cargo`,`sueldo`,`tipo_sueldo`) VALUES
('18','Plomero de 1ra.','3435','1');
INSERT INTO `cargos` (`id`,`cargo`,`sueldo`,`tipo_sueldo`) VALUES
('19','Maestro Carpintero de 2da.','3582.32','1');
INSERT INTO `cargos` (`id`,`cargo`,`sueldo`,`tipo_sueldo`) VALUES
('20','Maestro Albañil','3801.91','1');
INSERT INTO `cargos` (`id`,`cargo`,`sueldo`,`tipo_sueldo`) VALUES
('21','Maestro Cabillero','3801.91','1');
INSERT INTO `cargos` (`id`,`cargo`,`sueldo`,`tipo_sueldo`) VALUES
('22','Mestro Carpintero de 1ra.','3801.91','1');
INSERT INTO `cargos` (`id`,`cargo`,`sueldo`,`tipo_sueldo`) VALUES
('23','Mestro de obra de 1ra.','4382.29','1');
INSERT INTO `cargos` (`id`,`cargo`,`sueldo`,`tipo_sueldo`) VALUES
('24','Administrador','33800','2');
INSERT INTO `cargos` (`id`,`cargo`,`sueldo`,`tipo_sueldo`) VALUES
('25','Ingeniero Residente','16000','1');
INSERT INTO `cargos` (`id`,`cargo`,`sueldo`,`tipo_sueldo`) VALUES
('26','Dibujante','4450','1');
INSERT INTO `cargos` (`id`,`cargo`,`sueldo`,`tipo_sueldo`) VALUES
('27','Ingeniero Residente I','38600','2');
INSERT INTO `cargos` (`id`,`cargo`,`sueldo`,`tipo_sueldo`) VALUES
('28','Contador Publico','24200','2');
INSERT INTO `cargos` (`id`,`cargo`,`sueldo`,`tipo_sueldo`) VALUES
('29','Mensajero','9649','2');
INSERT INTO `cargos` (`id`,`cargo`,`sueldo`,`tipo_sueldo`) VALUES
('30','Aseadora','9649','2');
INSERT INTO `cargos` (`id`,`cargo`,`sueldo`,`tipo_sueldo`) VALUES
('31','Asistente Contable','24200','2');
INSERT INTO `cargos` (`id`,`cargo`,`sueldo`,`tipo_sueldo`) VALUES
('32','Recepcionista','9649','2');
INSERT INTO `cargos` (`id`,`cargo`,`sueldo`,`tipo_sueldo`) VALUES
('33','Ingeniero Residente II','9000','1');
INSERT INTO `cargos` (`id`,`cargo`,`sueldo`,`tipo_sueldo`) VALUES
('34','Encargado de obra','7800','1');
INSERT INTO `cargos` (`id`,`cargo`,`sueldo`,`tipo_sueldo`) VALUES
('35','Supervisor de Obra','7800','1');
INSERT INTO `cargos` (`id`,`cargo`,`sueldo`,`tipo_sueldo`) VALUES
('36','SINDICATO I','5000','1');
INSERT INTO `cargos` (`id`,`cargo`,`sueldo`,`tipo_sueldo`) VALUES
('37','Ingeniero Residente III','24200','2');
INSERT INTO `cargos` (`id`,`cargo`,`sueldo`,`tipo_sueldo`) VALUES
('38','VIGILANTE NOCTURNO','4225','1');
INSERT INTO `cargos` (`id`,`cargo`,`sueldo`,`tipo_sueldo`) VALUES
('39','OPERADOR DE EQUIPO LIVIANO','3071.53','1');
INSERT INTO `cargos` (`id`,`cargo`,`sueldo`,`tipo_sueldo`) VALUES
('40','PLOMERO DE 2da','3071.53','1');
INSERT INTO `cargos` (`id`,`cargo`,`sueldo`,`tipo_sueldo`) VALUES
('41','Maestro de Obra de 1ra.1','5000','1');
INSERT INTO `cargos` (`id`,`cargo`,`sueldo`,`tipo_sueldo`) VALUES
('42','AYUDANTE DE 1ra','3071','1');
-- -------------------------------------------
-- TABLE DATA conceptos
-- -------------------------------------------
INSERT INTO `conceptos` (`id`,`Fecha`,`tipo_bono`,`bono`) VALUES
('1','2015-12-02','1','150');
INSERT INTO `conceptos` (`id`,`Fecha`,`tipo_bono`,`bono`) VALUES
('2','2015-12-02','2','0.75');
INSERT INTO `conceptos` (`id`,`Fecha`,`tipo_bono`,`bono`) VALUES
('3','2015-12-02','3','0.75');
INSERT INTO `conceptos` (`id`,`Fecha`,`tipo_bono`,`bono`) VALUES
('4','2015-12-02','4','1.5');
INSERT INTO `conceptos` (`id`,`Fecha`,`tipo_bono`,`bono`) VALUES
('5','2015-12-02','5','1.5');
INSERT INTO `conceptos` (`id`,`Fecha`,`tipo_bono`,`bono`) VALUES
('6','2015-12-02','6','1.5');
INSERT INTO `conceptos` (`id`,`Fecha`,`tipo_bono`,`bono`) VALUES
('7','2016-01-01','7','4');
INSERT INTO `conceptos` (`id`,`Fecha`,`tipo_bono`,`bono`) VALUES
('8','2016-01-01','8','0.5');
INSERT INTO `conceptos` (`id`,`Fecha`,`tipo_bono`,`bono`) VALUES
('9','2016-01-01','9','1');
INSERT INTO `conceptos` (`id`,`Fecha`,`tipo_bono`,`bono`) VALUES
('10','2016-02-01','1','177');
-- -------------------------------------------
-- TABLE DATA deducciones
-- -------------------------------------------
INSERT INTO `deducciones` (`id`,`sso`,`spf`,`lph`,`inasistencia`) VALUES
('1','1','1','1','0');
INSERT INTO `deducciones` (`id`,`sso`,`spf`,`lph`,`inasistencia`) VALUES
('2','1','1','1','0');
INSERT INTO `deducciones` (`id`,`sso`,`spf`,`lph`,`inasistencia`) VALUES
('3','1','1','1','0');
INSERT INTO `deducciones` (`id`,`sso`,`spf`,`lph`,`inasistencia`) VALUES
('4','1','1','1','0');
INSERT INTO `deducciones` (`id`,`sso`,`spf`,`lph`,`inasistencia`) VALUES
('5','0','0','1','0');
INSERT INTO `deducciones` (`id`,`sso`,`spf`,`lph`,`inasistencia`) VALUES
('6','0','0','0','0');
INSERT INTO `deducciones` (`id`,`sso`,`spf`,`lph`,`inasistencia`) VALUES
('7','0','0','0','0');
INSERT INTO `deducciones` (`id`,`sso`,`spf`,`lph`,`inasistencia`) VALUES
('8','0','0','0','0');
INSERT INTO `deducciones` (`id`,`sso`,`spf`,`lph`,`inasistencia`) VALUES
('9','0','0','0','0');
INSERT INTO `deducciones` (`id`,`sso`,`spf`,`lph`,`inasistencia`) VALUES
('10','0','0','0','0');
INSERT INTO `deducciones` (`id`,`sso`,`spf`,`lph`,`inasistencia`) VALUES
('11','1','1','1','1');
INSERT INTO `deducciones` (`id`,`sso`,`spf`,`lph`,`inasistencia`) VALUES
('12','1','1','1','1');
INSERT INTO `deducciones` (`id`,`sso`,`spf`,`lph`,`inasistencia`) VALUES
('13','1','1','1','0');
INSERT INTO `deducciones` (`id`,`sso`,`spf`,`lph`,`inasistencia`) VALUES
('14','1','1','1','0');
INSERT INTO `deducciones` (`id`,`sso`,`spf`,`lph`,`inasistencia`) VALUES
('15','1','1','1','0');
INSERT INTO `deducciones` (`id`,`sso`,`spf`,`lph`,`inasistencia`) VALUES
('16','1','1','1','0');
INSERT INTO `deducciones` (`id`,`sso`,`spf`,`lph`,`inasistencia`) VALUES
('17','1','1','1','0');
INSERT INTO `deducciones` (`id`,`sso`,`spf`,`lph`,`inasistencia`) VALUES
('18','1','1','1','0');
INSERT INTO `deducciones` (`id`,`sso`,`spf`,`lph`,`inasistencia`) VALUES
('19','1','1','1','0');
INSERT INTO `deducciones` (`id`,`sso`,`spf`,`lph`,`inasistencia`) VALUES
('20','1','1','1','0');
INSERT INTO `deducciones` (`id`,`sso`,`spf`,`lph`,`inasistencia`) VALUES
('21','1','1','1','0');
INSERT INTO `deducciones` (`id`,`sso`,`spf`,`lph`,`inasistencia`) VALUES
('22','1','1','1','0');
INSERT INTO `deducciones` (`id`,`sso`,`spf`,`lph`,`inasistencia`) VALUES
('23','1','1','1','0');
INSERT INTO `deducciones` (`id`,`sso`,`spf`,`lph`,`inasistencia`) VALUES
('24','0','0','0','0');
INSERT INTO `deducciones` (`id`,`sso`,`spf`,`lph`,`inasistencia`) VALUES
('25','0','0','0','0');
INSERT INTO `deducciones` (`id`,`sso`,`spf`,`lph`,`inasistencia`) VALUES
('26','1','1','1','0');
INSERT INTO `deducciones` (`id`,`sso`,`spf`,`lph`,`inasistencia`) VALUES
('27','1','1','1','0');
INSERT INTO `deducciones` (`id`,`sso`,`spf`,`lph`,`inasistencia`) VALUES
('28','1','1','1','0');
INSERT INTO `deducciones` (`id`,`sso`,`spf`,`lph`,`inasistencia`) VALUES
('29','1','1','1','0');
INSERT INTO `deducciones` (`id`,`sso`,`spf`,`lph`,`inasistencia`) VALUES
('30','1','1','1','0');
INSERT INTO `deducciones` (`id`,`sso`,`spf`,`lph`,`inasistencia`) VALUES
('31','1','1','1','0');
INSERT INTO `deducciones` (`id`,`sso`,`spf`,`lph`,`inasistencia`) VALUES
('32','1','1','1','0');
INSERT INTO `deducciones` (`id`,`sso`,`spf`,`lph`,`inasistencia`) VALUES
('33','1','1','1','0');
INSERT INTO `deducciones` (`id`,`sso`,`spf`,`lph`,`inasistencia`) VALUES
('34','1','1','1','0');
INSERT INTO `deducciones` (`id`,`sso`,`spf`,`lph`,`inasistencia`) VALUES
('35','1','1','1','0');
INSERT INTO `deducciones` (`id`,`sso`,`spf`,`lph`,`inasistencia`) VALUES
('36','1','1','1','0');
INSERT INTO `deducciones` (`id`,`sso`,`spf`,`lph`,`inasistencia`) VALUES
('37','1','1','1','0');
INSERT INTO `deducciones` (`id`,`sso`,`spf`,`lph`,`inasistencia`) VALUES
('38','1','1','1','0');
INSERT INTO `deducciones` (`id`,`sso`,`spf`,`lph`,`inasistencia`) VALUES
('39','1','1','1','0');
INSERT INTO `deducciones` (`id`,`sso`,`spf`,`lph`,`inasistencia`) VALUES
('40','1','1','1','0');
INSERT INTO `deducciones` (`id`,`sso`,`spf`,`lph`,`inasistencia`) VALUES
('41','1','1','1','0');
INSERT INTO `deducciones` (`id`,`sso`,`spf`,`lph`,`inasistencia`) VALUES
('42','1','1','1','0');
INSERT INTO `deducciones` (`id`,`sso`,`spf`,`lph`,`inasistencia`) VALUES
('43','1','1','1','0');
INSERT INTO `deducciones` (`id`,`sso`,`spf`,`lph`,`inasistencia`) VALUES
('44','1','1','1','0');
INSERT INTO `deducciones` (`id`,`sso`,`spf`,`lph`,`inasistencia`) VALUES
('45','1','1','1','0');
INSERT INTO `deducciones` (`id`,`sso`,`spf`,`lph`,`inasistencia`) VALUES
('46','1','1','1','0');
INSERT INTO `deducciones` (`id`,`sso`,`spf`,`lph`,`inasistencia`) VALUES
('47','1','1','1','0');
INSERT INTO `deducciones` (`id`,`sso`,`spf`,`lph`,`inasistencia`) VALUES
('48','1','1','1','0');
INSERT INTO `deducciones` (`id`,`sso`,`spf`,`lph`,`inasistencia`) VALUES
('49','1','1','1','0');
INSERT INTO `deducciones` (`id`,`sso`,`spf`,`lph`,`inasistencia`) VALUES
('50','0','0','0','0');
INSERT INTO `deducciones` (`id`,`sso`,`spf`,`lph`,`inasistencia`) VALUES
('51','1','1','1','0');
INSERT INTO `deducciones` (`id`,`sso`,`spf`,`lph`,`inasistencia`) VALUES
('52','1','1','1','0');
INSERT INTO `deducciones` (`id`,`sso`,`spf`,`lph`,`inasistencia`) VALUES
('53','1','1','1','0');
INSERT INTO `deducciones` (`id`,`sso`,`spf`,`lph`,`inasistencia`) VALUES
('54','1','1','1','0');
INSERT INTO `deducciones` (`id`,`sso`,`spf`,`lph`,`inasistencia`) VALUES
('55','1','1','1','0');
INSERT INTO `deducciones` (`id`,`sso`,`spf`,`lph`,`inasistencia`) VALUES
('56','1','1','1','0');
INSERT INTO `deducciones` (`id`,`sso`,`spf`,`lph`,`inasistencia`) VALUES
('57','1','1','1','0');
INSERT INTO `deducciones` (`id`,`sso`,`spf`,`lph`,`inasistencia`) VALUES
('58','1','1','1','0');
INSERT INTO `deducciones` (`id`,`sso`,`spf`,`lph`,`inasistencia`) VALUES
('59','1','1','1','0');
INSERT INTO `deducciones` (`id`,`sso`,`spf`,`lph`,`inasistencia`) VALUES
('60','1','1','1','0');
INSERT INTO `deducciones` (`id`,`sso`,`spf`,`lph`,`inasistencia`) VALUES
('61','1','1','1','0');
INSERT INTO `deducciones` (`id`,`sso`,`spf`,`lph`,`inasistencia`) VALUES
('62','1','1','1','0');
INSERT INTO `deducciones` (`id`,`sso`,`spf`,`lph`,`inasistencia`) VALUES
('63','1','1','1','0');
INSERT INTO `deducciones` (`id`,`sso`,`spf`,`lph`,`inasistencia`) VALUES
('64','1','1','1','0');
INSERT INTO `deducciones` (`id`,`sso`,`spf`,`lph`,`inasistencia`) VALUES
('65','1','1','1','0');
INSERT INTO `deducciones` (`id`,`sso`,`spf`,`lph`,`inasistencia`) VALUES
('66','1','1','1','0');
INSERT INTO `deducciones` (`id`,`sso`,`spf`,`lph`,`inasistencia`) VALUES
('67','1','1','1','0');
INSERT INTO `deducciones` (`id`,`sso`,`spf`,`lph`,`inasistencia`) VALUES
('68','1','1','1','0');
INSERT INTO `deducciones` (`id`,`sso`,`spf`,`lph`,`inasistencia`) VALUES
('69','1','1','1','0');
INSERT INTO `deducciones` (`id`,`sso`,`spf`,`lph`,`inasistencia`) VALUES
('70','1','1','1','0');
INSERT INTO `deducciones` (`id`,`sso`,`spf`,`lph`,`inasistencia`) VALUES
('71','1','1','1','0');
INSERT INTO `deducciones` (`id`,`sso`,`spf`,`lph`,`inasistencia`) VALUES
('72','1','1','1','0');
INSERT INTO `deducciones` (`id`,`sso`,`spf`,`lph`,`inasistencia`) VALUES
('73','1','1','1','0');
INSERT INTO `deducciones` (`id`,`sso`,`spf`,`lph`,`inasistencia`) VALUES
('74','1','1','1','0');
INSERT INTO `deducciones` (`id`,`sso`,`spf`,`lph`,`inasistencia`) VALUES
('75','1','1','1','0');
-- -------------------------------------------
-- TABLE DATA empleados
-- -------------------------------------------
INSERT INTO `empleados` (`id`,`id_persona`,`id_obra`,`nro_cuenta`,`id_empresa`,`id_talla`,`id_cargo`,`cod_banco`,`tipo_empleado`) VALUES
('1','4','4','01160024710006468918','1','10','24','0116','2');
INSERT INTO `empleados` (`id`,`id_persona`,`id_obra`,`nro_cuenta`,`id_empresa`,`id_talla`,`id_cargo`,`cod_banco`,`tipo_empleado`) VALUES
('2','58','4','01160024720007142145','1','11','25','0116','2');
INSERT INTO `empleados` (`id`,`id_persona`,`id_obra`,`nro_cuenta`,`id_empresa`,`id_talla`,`id_cargo`,`cod_banco`,`tipo_empleado`) VALUES
('3','1','4','01160024760185344950','1','12','26','0116','2');
INSERT INTO `empleados` (`id`,`id_persona`,`id_obra`,`nro_cuenta`,`id_empresa`,`id_talla`,`id_cargo`,`cod_banco`,`tipo_empleado`) VALUES
('4','5','4','01160024760190100583','1','13','27','0116','2');
INSERT INTO `empleados` (`id`,`id_persona`,`id_obra`,`nro_cuenta`,`id_empresa`,`id_talla`,`id_cargo`,`cod_banco`,`tipo_empleado`) VALUES
('5','3','4','01160024750186671792','1','14','28','0116','2');
INSERT INTO `empleados` (`id`,`id_persona`,`id_obra`,`nro_cuenta`,`id_empresa`,`id_talla`,`id_cargo`,`cod_banco`,`tipo_empleado`) VALUES
('6','6','4','01160024760205435084','1','15','29','0116','2');
INSERT INTO `empleados` (`id`,`id_persona`,`id_obra`,`nro_cuenta`,`id_empresa`,`id_talla`,`id_cargo`,`cod_banco`,`tipo_empleado`) VALUES
('7','7','4','01160024740205984916','1','16','30','0116','2');
INSERT INTO `empleados` (`id`,`id_persona`,`id_obra`,`nro_cuenta`,`id_empresa`,`id_talla`,`id_cargo`,`cod_banco`,`tipo_empleado`) VALUES
('8','8','4','01160024720194403408','1','17','31','0116','2');
INSERT INTO `empleados` (`id`,`id_persona`,`id_obra`,`nro_cuenta`,`id_empresa`,`id_talla`,`id_cargo`,`cod_banco`,`tipo_empleado`) VALUES
('9','2','4','01160024700019627513','1','18','32','0116','2');
INSERT INTO `empleados` (`id`,`id_persona`,`id_obra`,`nro_cuenta`,`id_empresa`,`id_talla`,`id_cargo`,`cod_banco`,`tipo_empleado`) VALUES
('10','9','4','01160024790016489128','1','19','33','0116','2');
INSERT INTO `empleados` (`id`,`id_persona`,`id_obra`,`nro_cuenta`,`id_empresa`,`id_talla`,`id_cargo`,`cod_banco`,`tipo_empleado`) VALUES
('11','10','4','01160024790185363326','1','20','35','0116','1');
INSERT INTO `empleados` (`id`,`id_persona`,`id_obra`,`nro_cuenta`,`id_empresa`,`id_talla`,`id_cargo`,`cod_banco`,`tipo_empleado`) VALUES
('12','11','4','01160024760202080129','1','21','2','0116','1');
INSERT INTO `empleados` (`id`,`id_persona`,`id_obra`,`nro_cuenta`,`id_empresa`,`id_talla`,`id_cargo`,`cod_banco`,`tipo_empleado`) VALUES
('13','12','4','01160024720185877125','1','22','3','0116','1');
INSERT INTO `empleados` (`id`,`id_persona`,`id_obra`,`nro_cuenta`,`id_empresa`,`id_talla`,`id_cargo`,`cod_banco`,`tipo_empleado`) VALUES
('14','13','1','01160024710193458489','1','23','41','0116','1');
INSERT INTO `empleados` (`id`,`id_persona`,`id_obra`,`nro_cuenta`,`id_empresa`,`id_talla`,`id_cargo`,`cod_banco`,`tipo_empleado`) VALUES
('15','14','1','01160024710020616120','1','24','1','0116','1');
INSERT INTO `empleados` (`id`,`id_persona`,`id_obra`,`nro_cuenta`,`id_empresa`,`id_talla`,`id_cargo`,`cod_banco`,`tipo_empleado`) VALUES
('16','59','1','01160024750020566310','1','25','14','0116','1');
INSERT INTO `empleados` (`id`,`id_persona`,`id_obra`,`nro_cuenta`,`id_empresa`,`id_talla`,`id_cargo`,`cod_banco`,`tipo_empleado`) VALUES
('17','15','1','01160024710187565490','1','26','13','0116','1');
INSERT INTO `empleados` (`id`,`id_persona`,`id_obra`,`nro_cuenta`,`id_empresa`,`id_talla`,`id_cargo`,`cod_banco`,`tipo_empleado`) VALUES
('18','16','1','01160024750185246834','1','27','13','0116','1');
INSERT INTO `empleados` (`id`,`id_persona`,`id_obra`,`nro_cuenta`,`id_empresa`,`id_talla`,`id_cargo`,`cod_banco`,`tipo_empleado`) VALUES
('19','17','1','01160024710185266576','1','28','42','0116','1');
INSERT INTO `empleados` (`id`,`id_persona`,`id_obra`,`nro_cuenta`,`id_empresa`,`id_talla`,`id_cargo`,`cod_banco`,`tipo_empleado`) VALUES
('20','18','1','01160024790190670444','1','29','15','0116','1');
INSERT INTO `empleados` (`id`,`id_persona`,`id_obra`,`nro_cuenta`,`id_empresa`,`id_talla`,`id_cargo`,`cod_banco`,`tipo_empleado`) VALUES
('21','19','1','01160024720022686258','1','30','21','0116','1');
INSERT INTO `empleados` (`id`,`id_persona`,`id_obra`,`nro_cuenta`,`id_empresa`,`id_talla`,`id_cargo`,`cod_banco`,`tipo_empleado`) VALUES
('22','20','1','01160024760023399790','1','31','3','0116','1');
INSERT INTO `empleados` (`id`,`id_persona`,`id_obra`,`nro_cuenta`,`id_empresa`,`id_talla`,`id_cargo`,`cod_banco`,`tipo_empleado`) VALUES
('23','60','1','01160024710033812608','1','32','36','0116','1');
INSERT INTO `empleados` (`id`,`id_persona`,`id_obra`,`nro_cuenta`,`id_empresa`,`id_talla`,`id_cargo`,`cod_banco`,`tipo_empleado`) VALUES
('24','57','1','01160024760024548987','1','33','1','0116','1');
INSERT INTO `empleados` (`id`,`id_persona`,`id_obra`,`nro_cuenta`,`id_empresa`,`id_talla`,`id_cargo`,`cod_banco`,`tipo_empleado`) VALUES
('25','61','1','01160024750024548979','1','34','3','0116','1');
INSERT INTO `empleados` (`id`,`id_persona`,`id_obra`,`nro_cuenta`,`id_empresa`,`id_talla`,`id_cargo`,`cod_banco`,`tipo_empleado`) VALUES
('26','62','1','','1','35','13','','1');
INSERT INTO `empleados` (`id`,`id_persona`,`id_obra`,`nro_cuenta`,`id_empresa`,`id_talla`,`id_cargo`,`cod_banco`,`tipo_empleado`) VALUES
('27','63','1','','1','36','3','','1');
INSERT INTO `empleados` (`id`,`id_persona`,`id_obra`,`nro_cuenta`,`id_empresa`,`id_talla`,`id_cargo`,`cod_banco`,`tipo_empleado`) VALUES
('28','64','1','','1','37','3','','1');
INSERT INTO `empleados` (`id`,`id_persona`,`id_obra`,`nro_cuenta`,`id_empresa`,`id_talla`,`id_cargo`,`cod_banco`,`tipo_empleado`) VALUES
('29','65','1','','1','38','13','','1');
INSERT INTO `empleados` (`id`,`id_persona`,`id_obra`,`nro_cuenta`,`id_empresa`,`id_talla`,`id_cargo`,`cod_banco`,`tipo_empleado`) VALUES
('30','66','1','','1','39','13','','1');
INSERT INTO `empleados` (`id`,`id_persona`,`id_obra`,`nro_cuenta`,`id_empresa`,`id_talla`,`id_cargo`,`cod_banco`,`tipo_empleado`) VALUES
('31','22','2','01160024750185266436','2','40','41','0116','1');
INSERT INTO `empleados` (`id`,`id_persona`,`id_obra`,`nro_cuenta`,`id_empresa`,`id_talla`,`id_cargo`,`cod_banco`,`tipo_empleado`) VALUES
('32','23','2','01160024700186897545','2','41','14','0116','1');
INSERT INTO `empleados` (`id`,`id_persona`,`id_obra`,`nro_cuenta`,`id_empresa`,`id_talla`,`id_cargo`,`cod_banco`,`tipo_empleado`) VALUES
('33','24','2','01160024760205818412','2','42','3','0116','1');
INSERT INTO `empleados` (`id`,`id_persona`,`id_obra`,`nro_cuenta`,`id_empresa`,`id_talla`,`id_cargo`,`cod_banco`,`tipo_empleado`) VALUES
('34','25','2','01160024780190071486','2','43','42','0116','1');
INSERT INTO `empleados` (`id`,`id_persona`,`id_obra`,`nro_cuenta`,`id_empresa`,`id_talla`,`id_cargo`,`cod_banco`,`tipo_empleado`) VALUES
('35','26','2','01160024700185247423','2','44','7','0116','1');
INSERT INTO `empleados` (`id`,`id_persona`,`id_obra`,`nro_cuenta`,`id_empresa`,`id_talla`,`id_cargo`,`cod_banco`,`tipo_empleado`) VALUES
('36','67','2','01160024770024424323','2','45','37','0116','2');
INSERT INTO `empleados` (`id`,`id_persona`,`id_obra`,`nro_cuenta`,`id_empresa`,`id_talla`,`id_cargo`,`cod_banco`,`tipo_empleado`) VALUES
('37','27','2','01160024730185260380','2','46','20','0116','1');
INSERT INTO `empleados` (`id`,`id_persona`,`id_obra`,`nro_cuenta`,`id_empresa`,`id_talla`,`id_cargo`,`cod_banco`,`tipo_empleado`) VALUES
('38','53','2','01160024710190071087','2','47','41','0116','1');
INSERT INTO `empleados` (`id`,`id_persona`,`id_obra`,`nro_cuenta`,`id_empresa`,`id_talla`,`id_cargo`,`cod_banco`,`tipo_empleado`) VALUES
('39','28','2','01160024710185266304','2','48','15','0116','1');
INSERT INTO `empleados` (`id`,`id_persona`,`id_obra`,`nro_cuenta`,`id_empresa`,`id_talla`,`id_cargo`,`cod_banco`,`tipo_empleado`) VALUES
('40','29','2','01160024730207412847','2','49','3','0116','1');
INSERT INTO `empleados` (`id`,`id_persona`,`id_obra`,`nro_cuenta`,`id_empresa`,`id_talla`,`id_cargo`,`cod_banco`,`tipo_empleado`) VALUES
('41','30','2','01160024710020962479','2','50','14','0116','1');
INSERT INTO `empleados` (`id`,`id_persona`,`id_obra`,`nro_cuenta`,`id_empresa`,`id_talla`,`id_cargo`,`cod_banco`,`tipo_empleado`) VALUES
('42','31','2','01160024780019640960','2','51','14','0116','1');
INSERT INTO `empleados` (`id`,`id_persona`,`id_obra`,`nro_cuenta`,`id_empresa`,`id_talla`,`id_cargo`,`cod_banco`,`tipo_empleado`) VALUES
('43','32','2','01160024720190548924','2','52','21','0116','1');
INSERT INTO `empleados` (`id`,`id_persona`,`id_obra`,`nro_cuenta`,`id_empresa`,`id_talla`,`id_cargo`,`cod_banco`,`tipo_empleado`) VALUES
('44','33','2','01160024770024425567','2','53','38','0116','1');
INSERT INTO `empleados` (`id`,`id_persona`,`id_obra`,`nro_cuenta`,`id_empresa`,`id_talla`,`id_cargo`,`cod_banco`,`tipo_empleado`) VALUES
('45','34','2','01160024720022673199','2','54','3','0116','1');
INSERT INTO `empleados` (`id`,`id_persona`,`id_obra`,`nro_cuenta`,`id_empresa`,`id_talla`,`id_cargo`,`cod_banco`,`tipo_empleado`) VALUES
('46','35','2','01160024710197338038','2','55','8','0116','1');
INSERT INTO `empleados` (`id`,`id_persona`,`id_obra`,`nro_cuenta`,`id_empresa`,`id_talla`,`id_cargo`,`cod_banco`,`tipo_empleado`) VALUES
('47','36','2','01160024780207413193','2','56','15','0116','2');
INSERT INTO `empleados` (`id`,`id_persona`,`id_obra`,`nro_cuenta`,`id_empresa`,`id_talla`,`id_cargo`,`cod_banco`,`tipo_empleado`) VALUES
('48','37','2','01160024710020553544','2','57','13','0116','1');
INSERT INTO `empleados` (`id`,`id_persona`,`id_obra`,`nro_cuenta`,`id_empresa`,`id_talla`,`id_cargo`,`cod_banco`,`tipo_empleado`) VALUES
('49','38','2','01160024760020176945','2','58','16','0116','1');
INSERT INTO `empleados` (`id`,`id_persona`,`id_obra`,`nro_cuenta`,`id_empresa`,`id_talla`,`id_cargo`,`cod_banco`,`tipo_empleado`) VALUES
('50','39','2','01160024750185266193','2','59','39','0116','1');
INSERT INTO `empleados` (`id`,`id_persona`,`id_obra`,`nro_cuenta`,`id_empresa`,`id_talla`,`id_cargo`,`cod_banco`,`tipo_empleado`) VALUES
('51','40','2','01160024720188322493','2','60','4','0116','1');
INSERT INTO `empleados` (`id`,`id_persona`,`id_obra`,`nro_cuenta`,`id_empresa`,`id_talla`,`id_cargo`,`cod_banco`,`tipo_empleado`) VALUES
('52','41','2','01160024730185265286','2','61','11','0116','1');
INSERT INTO `empleados` (`id`,`id_persona`,`id_obra`,`nro_cuenta`,`id_empresa`,`id_talla`,`id_cargo`,`cod_banco`,`tipo_empleado`) VALUES
('53','42','2','01160024760206215622','2','62','3','0116','1');
INSERT INTO `empleados` (`id`,`id_persona`,`id_obra`,`nro_cuenta`,`id_empresa`,`id_talla`,`id_cargo`,`cod_banco`,`tipo_empleado`) VALUES
('54','43','2','01160024720197701663','2','63','5','0116','1');
INSERT INTO `empleados` (`id`,`id_persona`,`id_obra`,`nro_cuenta`,`id_empresa`,`id_talla`,`id_cargo`,`cod_banco`,`tipo_empleado`) VALUES
('55','44','2','01160024790024460494','2','64','2','0116','1');
INSERT INTO `empleados` (`id`,`id_persona`,`id_obra`,`nro_cuenta`,`id_empresa`,`id_talla`,`id_cargo`,`cod_banco`,`tipo_empleado`) VALUES
('56','47','2','01160024730185265448','2','65','16','0116','1');
INSERT INTO `empleados` (`id`,`id_persona`,`id_obra`,`nro_cuenta`,`id_empresa`,`id_talla`,`id_cargo`,`cod_banco`,`tipo_empleado`) VALUES
('57','48','2','01160024710206216149','2','66','40','0116','1');
INSERT INTO `empleados` (`id`,`id_persona`,`id_obra`,`nro_cuenta`,`id_empresa`,`id_talla`,`id_cargo`,`cod_banco`,`tipo_empleado`) VALUES
('58','49','2','01160024740204763673','2','67','1','0116','1');
INSERT INTO `empleados` (`id`,`id_persona`,`id_obra`,`nro_cuenta`,`id_empresa`,`id_talla`,`id_cargo`,`cod_banco`,`tipo_empleado`) VALUES
('59','55','2','01160024740024548960','2','68','5','0116','1');
INSERT INTO `empleados` (`id`,`id_persona`,`id_obra`,`nro_cuenta`,`id_empresa`,`id_talla`,`id_cargo`,`cod_banco`,`tipo_empleado`) VALUES
('60','68','2','01160024770185257623','2','69','15','0116','1');
INSERT INTO `empleados` (`id`,`id_persona`,`id_obra`,`nro_cuenta`,`id_empresa`,`id_talla`,`id_cargo`,`cod_banco`,`tipo_empleado`) VALUES
('61','45','3','01160024780186563680','1','70','20','0116','1');
INSERT INTO `empleados` (`id`,`id_persona`,`id_obra`,`nro_cuenta`,`id_empresa`,`id_talla`,`id_cargo`,`cod_banco`,`tipo_empleado`) VALUES
('62','56','3','01160024700019702744','1','71','13','0116','1');
INSERT INTO `empleados` (`id`,`id_persona`,`id_obra`,`nro_cuenta`,`id_empresa`,`id_talla`,`id_cargo`,`cod_banco`,`tipo_empleado`) VALUES
('63','46','3','01160024740021477442','1','72','3','0116','1');
INSERT INTO `empleados` (`id`,`id_persona`,`id_obra`,`nro_cuenta`,`id_empresa`,`id_talla`,`id_cargo`,`cod_banco`,`tipo_empleado`) VALUES
('64','54','3','01160024730019962347','1','73','1','0116','1');
INSERT INTO `empleados` (`id`,`id_persona`,`id_obra`,`nro_cuenta`,`id_empresa`,`id_talla`,`id_cargo`,`cod_banco`,`tipo_empleado`) VALUES
('65','69','3','','1','74','2','','1');
INSERT INTO `empleados` (`id`,`id_persona`,`id_obra`,`nro_cuenta`,`id_empresa`,`id_talla`,`id_cargo`,`cod_banco`,`tipo_empleado`) VALUES
('66','70','3','','1','75','6','','1');
INSERT INTO `empleados` (`id`,`id_persona`,`id_obra`,`nro_cuenta`,`id_empresa`,`id_talla`,`id_cargo`,`cod_banco`,`tipo_empleado`) VALUES
('67','71','3','01160024710197341926','1','76','3','0116','1');
INSERT INTO `empleados` (`id`,`id_persona`,`id_obra`,`nro_cuenta`,`id_empresa`,`id_talla`,`id_cargo`,`cod_banco`,`tipo_empleado`) VALUES
('68','72','3','','1','77','1','','1');
INSERT INTO `empleados` (`id`,`id_persona`,`id_obra`,`nro_cuenta`,`id_empresa`,`id_talla`,`id_cargo`,`cod_banco`,`tipo_empleado`) VALUES
('69','73','3','01160024700194031918','1','78','13','0116','1');
INSERT INTO `empleados` (`id`,`id_persona`,`id_obra`,`nro_cuenta`,`id_empresa`,`id_talla`,`id_cargo`,`cod_banco`,`tipo_empleado`) VALUES
('70','50','4','01160024700185514480','1','79','13','0116','1');
INSERT INTO `empleados` (`id`,`id_persona`,`id_obra`,`nro_cuenta`,`id_empresa`,`id_talla`,`id_cargo`,`cod_banco`,`tipo_empleado`) VALUES
('71','51','4','01160024710020433042','1','80','1','0116','1');
INSERT INTO `empleados` (`id`,`id_persona`,`id_obra`,`nro_cuenta`,`id_empresa`,`id_talla`,`id_cargo`,`cod_banco`,`tipo_empleado`) VALUES
('72','52','4','01160024710022475974','1','81','15','0116','1');
-- -------------------------------------------
-- TABLE DATA empresa
-- -------------------------------------------
INSERT INTO `empresa` (`id`,`nombre_emp`,`direccion`,`telefono`,`rif`) VALUES
('1','PROMOTORA RL 2006, C.A.','Av Los Llanos, Edif. Juma, piso 2, ofc. 17, San Juan de los Morros.','(0246)-431-3941','j-315328232');
INSERT INTO `empresa` (`id`,`nombre_emp`,`direccion`,`telefono`,`rif`) VALUES
('2','Promotora Via Appia, C.A.','Av Los Llanos, Edif. Juma, piso 2, ofc. 17, San Juan de los Morros.','(0246)-431-3941','j-40622581-9');
-- -------------------------------------------
-- TABLE DATA hijos
-- -------------------------------------------
INSERT INTO `hijos` (`id`,`id_persona`,`nombre`,`apellido`,`fecha_nac`) VALUES
('1','3','Jesús Andrés ','Bastidas Arruebarrena','2010-01-15');
INSERT INTO `hijos` (`id`,`id_persona`,`nombre`,`apellido`,`fecha_nac`) VALUES
('2','3','Mauricio José','Bastidas Arruebarrena','2012-05-10');
-- -------------------------------------------
-- TABLE DATA nomina
-- -------------------------------------------
INSERT INTO `nomina` (`id`,`id_empleado`,`id_asignacion`,`id_deduccion`,`total_asig`,`total_deduc`,`neto`,`fecha`,`vaciado`,`prestamos`,`otros`,`descuento`,`nominacol`) VALUES
('2','1','23','23','8144.5','929.5','24115','2016-02-26','0','0','179.5','0','');
INSERT INTO `nomina` (`id`,`id_empleado`,`id_asignacion`,`id_deduccion`,`total_asig`,`total_deduc`,`neto`,`fecha`,`vaciado`,`prestamos`,`otros`,`descuento`,`nominacol`) VALUES
('4','2','25','25','0','0','16000','2016-02-26','0','0','0','0','');
INSERT INTO `nomina` (`id`,`id_empleado`,`id_asignacion`,`id_deduccion`,`total_asig`,`total_deduc`,`neto`,`fecha`,`vaciado`,`prestamos`,`otros`,`descuento`,`nominacol`) VALUES
('5','3','26','26','17965','244.75','22170.2','2016-02-26','0','10000','0','0','');
INSERT INTO `nomina` (`id`,`id_empleado`,`id_asignacion`,`id_deduccion`,`total_asig`,`total_deduc`,`neto`,`fecha`,`vaciado`,`prestamos`,`otros`,`descuento`,`nominacol`) VALUES
('6','4','27','27','7965','1061.5','26203.5','2016-02-26','0','0','0','0','');
INSERT INTO `nomina` (`id`,`id_empleado`,`id_asignacion`,`id_deduccion`,`total_asig`,`total_deduc`,`neto`,`fecha`,`vaciado`,`prestamos`,`otros`,`descuento`,`nominacol`) VALUES
('7','5','28','28','8218.5','665.5','19653','2016-02-26','0','0','253.5','0','');
INSERT INTO `nomina` (`id`,`id_empleado`,`id_asignacion`,`id_deduccion`,`total_asig`,`total_deduc`,`neto`,`fecha`,`vaciado`,`prestamos`,`otros`,`descuento`,`nominacol`) VALUES
('8','6','29','29','9965','265.348','14524.2','2016-02-26','0','0','2000','0','');
INSERT INTO `nomina` (`id`,`id_empleado`,`id_asignacion`,`id_deduccion`,`total_asig`,`total_deduc`,`neto`,`fecha`,`vaciado`,`prestamos`,`otros`,`descuento`,`nominacol`) VALUES
('9','7','30','30','7965','265.348','12524.2','2016-02-26','0','0','0','0','');
INSERT INTO `nomina` (`id`,`id_empleado`,`id_asignacion`,`id_deduccion`,`total_asig`,`total_deduc`,`neto`,`fecha`,`vaciado`,`prestamos`,`otros`,`descuento`,`nominacol`) VALUES
('10','8','31','31','9143.5','665.5','20578','2016-02-26','0','0','1178.5','0','');
INSERT INTO `nomina` (`id`,`id_empleado`,`id_asignacion`,`id_deduccion`,`total_asig`,`total_deduc`,`neto`,`fecha`,`vaciado`,`prestamos`,`otros`,`descuento`,`nominacol`) VALUES
('11','9','32','32','7965','265.348','12524.2','2016-02-26','0','0','0','0','');
INSERT INTO `nomina` (`id`,`id_empleado`,`id_asignacion`,`id_deduccion`,`total_asig`,`total_deduc`,`neto`,`fecha`,`vaciado`,`prestamos`,`otros`,`descuento`,`nominacol`) VALUES
('12','10','33','33','19679.3','862.3','27817','2016-02-26','0','0','4000','367.3','');
INSERT INTO `nomina` (`id`,`id_empleado`,`id_asignacion`,`id_deduccion`,`total_asig`,`total_deduc`,`neto`,`fecha`,`vaciado`,`prestamos`,`otros`,`descuento`,`nominacol`) VALUES
('13','11','34','34','9465','655','16610','2016-02-26','0','0','1500','226','');
INSERT INTO `nomina` (`id`,`id_empleado`,`id_asignacion`,`id_deduccion`,`total_asig`,`total_deduc`,`neto`,`fecha`,`vaciado`,`prestamos`,`otros`,`descuento`,`nominacol`) VALUES
('15','12','36','36','11080.1','140.855','13500.3','2016-02-26','0','0','920','0','');
INSERT INTO `nomina` (`id`,`id_empleado`,`id_asignacion`,`id_deduccion`,`total_asig`,`total_deduc`,`neto`,`fecha`,`vaciado`,`prestamos`,`otros`,`descuento`,`nominacol`) VALUES
('16','13','37','37','10313.6','150.7','12902.9','2016-02-26','0','0','0','0','');
INSERT INTO `nomina` (`id`,`id_empleado`,`id_asignacion`,`id_deduccion`,`total_asig`,`total_deduc`,`neto`,`fecha`,`vaciado`,`prestamos`,`otros`,`descuento`,`nominacol`) VALUES
('19','65','40','40','11080.1','140.855','13500.3','2016-02-26','0','0','920','0','');
INSERT INTO `nomina` (`id`,`id_empleado`,`id_asignacion`,`id_deduccion`,`total_asig`,`total_deduc`,`neto`,`fecha`,`vaciado`,`prestamos`,`otros`,`descuento`,`nominacol`) VALUES
('20','14','41','41','13810.7','275','18535.7','2016-02-26','0','0','1560','0','');
INSERT INTO `nomina` (`id`,`id_empleado`,`id_asignacion`,`id_deduccion`,`total_asig`,`total_deduc`,`neto`,`fecha`,`vaciado`,`prestamos`,`otros`,`descuento`,`nominacol`) VALUES
('21','15','42','42','10329.3','140.8','12748.5','2016-02-26','0','0','170','0','');
INSERT INTO `nomina` (`id`,`id_empleado`,`id_asignacion`,`id_deduccion`,`total_asig`,`total_deduc`,`neto`,`fecha`,`vaciado`,`prestamos`,`otros`,`descuento`,`nominacol`) VALUES
('22','16','43','43','11079.3','188.925','14325.4','2016-02-26','0','0','170','0','');
INSERT INTO `nomina` (`id`,`id_empleado`,`id_asignacion`,`id_deduccion`,`total_asig`,`total_deduc`,`neto`,`fecha`,`vaciado`,`prestamos`,`otros`,`descuento`,`nominacol`) VALUES
('23','17','44','44','11079.3','188.925','14325.4','2016-02-26','0','0','170','0','');
INSERT INTO `nomina` (`id`,`id_empleado`,`id_asignacion`,`id_deduccion`,`total_asig`,`total_deduc`,`neto`,`fecha`,`vaciado`,`prestamos`,`otros`,`descuento`,`nominacol`) VALUES
('24','18','45','45','11079.3','188.925','14325.4','2016-02-26','0','0','170','0','');
INSERT INTO `nomina` (`id`,`id_empleado`,`id_asignacion`,`id_deduccion`,`total_asig`,`total_deduc`,`neto`,`fecha`,`vaciado`,`prestamos`,`otros`,`descuento`,`nominacol`) VALUES
('26','19','47','47','9012.43','168.905','11914.5','2016-02-26','0','0','1047.43','0','');
INSERT INTO `nomina` (`id`,`id_empleado`,`id_asignacion`,`id_deduccion`,`total_asig`,`total_deduc`,`neto`,`fecha`,`vaciado`,`prestamos`,`otros`,`descuento`,`nominacol`) VALUES
('27','20','48','48','11079.3','188.925','14325.4','2016-02-26','0','0','170','0','');
INSERT INTO `nomina` (`id`,`id_empleado`,`id_asignacion`,`id_deduccion`,`total_asig`,`total_deduc`,`neto`,`fecha`,`vaciado`,`prestamos`,`otros`,`descuento`,`nominacol`) VALUES
('28','21','49','49','11393.8','209.105','14986.6','2016-02-26','0','0','170','0','');
INSERT INTO `nomina` (`id`,`id_empleado`,`id_asignacion`,`id_deduccion`,`total_asig`,`total_deduc`,`neto`,`fecha`,`vaciado`,`prestamos`,`otros`,`descuento`,`nominacol`) VALUES
('29','23','50','50','12250.7','0','17250.7','2016-02-26','0','0','0','0','');
INSERT INTO `nomina` (`id`,`id_empleado`,`id_asignacion`,`id_deduccion`,`total_asig`,`total_deduc`,`neto`,`fecha`,`vaciado`,`prestamos`,`otros`,`descuento`,`nominacol`) VALUES
('30','24','51','51','9249.71','140.8','11668.9','2016-02-26','0','0','1815.71','0','');
INSERT INTO `nomina` (`id`,`id_empleado`,`id_asignacion`,`id_deduccion`,`total_asig`,`total_deduc`,`neto`,`fecha`,`vaciado`,`prestamos`,`otros`,`descuento`,`nominacol`) VALUES
('31','25','52','52','10483.6','150.7','13072.9','2016-02-26','0','0','170','0','');
INSERT INTO `nomina` (`id`,`id_empleado`,`id_asignacion`,`id_deduccion`,`total_asig`,`total_deduc`,`neto`,`fecha`,`vaciado`,`prestamos`,`otros`,`descuento`,`nominacol`) VALUES
('33','31','54','54','10166','275','14891','2016-02-26','0','0','2201','0','');
INSERT INTO `nomina` (`id`,`id_empleado`,`id_asignacion`,`id_deduccion`,`total_asig`,`total_deduc`,`neto`,`fecha`,`vaciado`,`prestamos`,`otros`,`descuento`,`nominacol`) VALUES
('34','33','55','55','9437.86','150.7','12027.2','2016-02-26','0','0','1472.86','0','');
INSERT INTO `nomina` (`id`,`id_empleado`,`id_asignacion`,`id_deduccion`,`total_asig`,`total_deduc`,`neto`,`fecha`,`vaciado`,`prestamos`,`otros`,`descuento`,`nominacol`) VALUES
('36','34','57','57','9012.43','168.905','11914.5','2016-02-26','0','0','1047.43','0','');
INSERT INTO `nomina` (`id`,`id_empleado`,`id_asignacion`,`id_deduccion`,`total_asig`,`total_deduc`,`neto`,`fecha`,`vaciado`,`prestamos`,`otros`,`descuento`,`nominacol`) VALUES
('37','35','58','58','9012.43','168.934','11915','2016-02-26','0','0','1047.43','0','');
INSERT INTO `nomina` (`id`,`id_empleado`,`id_asignacion`,`id_deduccion`,`total_asig`,`total_deduc`,`neto`,`fecha`,`vaciado`,`prestamos`,`otros`,`descuento`,`nominacol`) VALUES
('38','36','59','59','7965','665.5','19399.5','2016-02-26','0','0','0','0','');
INSERT INTO `nomina` (`id`,`id_empleado`,`id_asignacion`,`id_deduccion`,`total_asig`,`total_deduc`,`neto`,`fecha`,`vaciado`,`prestamos`,`otros`,`descuento`,`nominacol`) VALUES
('39','37','60','60','11393.8','209.105','14986.6','2016-02-26','0','0','170','0','');
INSERT INTO `nomina` (`id`,`id_empleado`,`id_asignacion`,`id_deduccion`,`total_asig`,`total_deduc`,`neto`,`fecha`,`vaciado`,`prestamos`,`otros`,`descuento`,`nominacol`) VALUES
('40','38','61','61','14250.7','275','18975.7','2016-02-26','0','0','2000','0','');
INSERT INTO `nomina` (`id`,`id_empleado`,`id_asignacion`,`id_deduccion`,`total_asig`,`total_deduc`,`neto`,`fecha`,`vaciado`,`prestamos`,`otros`,`descuento`,`nominacol`) VALUES
('41','39','62','62','9116.43','188.925','12362.5','2016-02-26','0','0','1151.43','0','');
INSERT INTO `nomina` (`id`,`id_empleado`,`id_asignacion`,`id_deduccion`,`total_asig`,`total_deduc`,`neto`,`fecha`,`vaciado`,`prestamos`,`otros`,`descuento`,`nominacol`) VALUES
('42','40','63','63','10483.6','150.7','13072.9','2016-02-26','0','0','170','0','');
INSERT INTO `nomina` (`id`,`id_empleado`,`id_asignacion`,`id_deduccion`,`total_asig`,`total_deduc`,`neto`,`fecha`,`vaciado`,`prestamos`,`otros`,`descuento`,`nominacol`) VALUES
('43','41','64','64','11079.3','188.925','14325.4','2016-02-26','0','0','170','0','');
INSERT INTO `nomina` (`id`,`id_empleado`,`id_asignacion`,`id_deduccion`,`total_asig`,`total_deduc`,`neto`,`fecha`,`vaciado`,`prestamos`,`otros`,`descuento`,`nominacol`) VALUES
('45','42','66','66','11079.3','188.925','14325.4','2016-02-26','0','0','170','0','');
INSERT INTO `nomina` (`id`,`id_empleado`,`id_asignacion`,`id_deduccion`,`total_asig`,`total_deduc`,`neto`,`fecha`,`vaciado`,`prestamos`,`otros`,`descuento`,`nominacol`) VALUES
('46','43','67','67','11393.8','209.105','14986.6','2016-02-26','0','0','170','0','');
INSERT INTO `nomina` (`id`,`id_empleado`,`id_asignacion`,`id_deduccion`,`total_asig`,`total_deduc`,`neto`,`fecha`,`vaciado`,`prestamos`,`otros`,`descuento`,`nominacol`) VALUES
('47','44','68','68','11586.4','232.375','15579.1','2016-02-26','0','0','0','0','');
INSERT INTO `nomina` (`id`,`id_empleado`,`id_asignacion`,`id_deduccion`,`total_asig`,`total_deduc`,`neto`,`fecha`,`vaciado`,`prestamos`,`otros`,`descuento`,`nominacol`) VALUES
('48','45','69','69','10483.6','150.7','13072.9','2016-02-26','0','0','170','0','');
INSERT INTO `nomina` (`id`,`id_empleado`,`id_asignacion`,`id_deduccion`,`total_asig`,`total_deduc`,`neto`,`fecha`,`vaciado`,`prestamos`,`otros`,`descuento`,`nominacol`) VALUES
('49','46','70','70','10767.7','168.934','13670.3','2016-02-26','0','0','170','0','');
INSERT INTO `nomina` (`id`,`id_empleado`,`id_asignacion`,`id_deduccion`,`total_asig`,`total_deduc`,`neto`,`fecha`,`vaciado`,`prestamos`,`otros`,`descuento`,`nominacol`) VALUES
('50','47','71','71','11079.3','188.925','14325.4','2016-02-26','0','0','170','0','');
INSERT INTO `nomina` (`id`,`id_empleado`,`id_asignacion`,`id_deduccion`,`total_asig`,`total_deduc`,`neto`,`fecha`,`vaciado`,`prestamos`,`otros`,`descuento`,`nominacol`) VALUES
('51','48','72','72','11079.3','188.925','14325.4','2016-02-26','0','0','170','0','');
INSERT INTO `nomina` (`id`,`id_empleado`,`id_asignacion`,`id_deduccion`,`total_asig`,`total_deduc`,`neto`,`fecha`,`vaciado`,`prestamos`,`otros`,`descuento`,`nominacol`) VALUES
('52','49','73','73','11599.3','188.925','14845.4','2016-02-26','0','0','690','0','');
INSERT INTO `nomina` (`id`,`id_empleado`,`id_asignacion`,`id_deduccion`,`total_asig`,`total_deduc`,`neto`,`fecha`,`vaciado`,`prestamos`,`otros`,`descuento`,`nominacol`) VALUES
('53','50','74','74','10767.7','168.934','13670.3','2016-02-26','0','0','170','0','');
INSERT INTO `nomina` (`id`,`id_empleado`,`id_asignacion`,`id_deduccion`,`total_asig`,`total_deduc`,`neto`,`fecha`,`vaciado`,`prestamos`,`otros`,`descuento`,`nominacol`) VALUES
('54','51','75','75','10767.3','168.905','13669.4','2016-02-26','0','0','170','0','');
-- -------------------------------------------
-- TABLE DATA obras
-- -------------------------------------------
INSERT INTO `obras` (`id`,`id_empleado`,`nombre_obra`,`direccion`,`fech_ini`,`fech_fin`,`status`) VALUES
('1','0','ELVIS','AV LOS PUENTES #10','2014-01-01','2019-01-01','1');
INSERT INTO `obras` (`id`,`id_empleado`,`nombre_obra`,`direccion`,`fech_ini`,`fech_fin`,`status`) VALUES
('2','0','CC VIA APPIA','AV BOLIVAR S/N','2015-01-05','2020-01-05','1');
INSERT INTO `obras` (`id`,`id_empleado`,`nombre_obra`,`direccion`,`fech_ini`,`fech_fin`,`status`) VALUES
('3','0','COTOPRIZ','AV ACOSTA CARLES ','2015-01-02','2020-01-02','1');
INSERT INTO `obras` (`id`,`id_empleado`,`nombre_obra`,`direccion`,`fech_ini`,`fech_fin`,`status`) VALUES
('4','0','OBRAS VARIAS','OBRAS VARIAS','2016-01-01','2021-01-01','1');
-- -------------------------------------------
-- TABLE DATA personas
-- -------------------------------------------
INSERT INTO `personas` (`id`,`nombre`,`apellido`,`cedula`,`fecha_nac`,`lugar_nac`,`nacionalidad`,`sexo`,`direccion`,`telefono`,`email`) VALUES
('1','Manuel Jose','Moreno Lopez','14643985','1981-08-19','San Juan de los Morros','V','M','Las palmas, calle pinto salinas #16, San Juan de los Morros. Edo. Guarico','(0426)-749-0025','manuelmoreno2156@gmail.com');
INSERT INTO `personas` (`id`,`nombre`,`apellido`,`cedula`,`fecha_nac`,`lugar_nac`,`nacionalidad`,`sexo`,`direccion`,`telefono`,`email`) VALUES
('2','Mircelys Josefina','Belisario Hurtado','20586493','1990-03-19','San Juan de los Morros','V','F','Barrio San Jose, Calle Simon Rodriguez, san juan de los morros','(0424)-362-0772','mircelys_18@hotmail.com');
INSERT INTO `personas` (`id`,`nombre`,`apellido`,`cedula`,`fecha_nac`,`lugar_nac`,`nacionalidad`,`sexo`,`direccion`,`telefono`,`email`) VALUES
('3','Mariangel','Arruebarrena Hernandez','13850772','1979-04-21','Valle de la Pascua','V','F','Calle El Carmen Casa Nº 20. San Juan de los Morros. Estado Guárico','','mariangelarrue1510@gmail.com');
INSERT INTO `personas` (`id`,`nombre`,`apellido`,`cedula`,`fecha_nac`,`lugar_nac`,`nacionalidad`,`sexo`,`direccion`,`telefono`,`email`) VALUES
('4','Jona Carelina','Vasquez Alzuro','14394605','1979-02-12','San juan de los Morros, Estado Guarico','V','F','Via el Castrero, frente el circuito penal, casa s/n, San Juan de los Morros.','','JONA937@HOTMAIL.COM');
INSERT INTO `personas` (`id`,`nombre`,`apellido`,`cedula`,`fecha_nac`,`lugar_nac`,`nacionalidad`,`sexo`,`direccion`,`telefono`,`email`) VALUES
('5','Diana Josefina','Carreño Otero','15481991','1983-04-25','calabozo','V','F','calle miel c/c el panal, edif. resd villa paraiso, p-1, san juan de los morros','','');
INSERT INTO `personas` (`id`,`nombre`,`apellido`,`cedula`,`fecha_nac`,`lugar_nac`,`nacionalidad`,`sexo`,`direccion`,`telefono`,`email`) VALUES
('6','Pedro Mercedes ','Ramos Guevara','11122836','1976-03-08','San Juan de los Morros','V','M','Callejon marisol, casa # 69, San Juan de los Morros
','','');
INSERT INTO `personas` (`id`,`nombre`,`apellido`,`cedula`,`fecha_nac`,`lugar_nac`,`nacionalidad`,`sexo`,`direccion`,`telefono`,`email`) VALUES
('7','Rosaura Maria','Ibarra Cotto','14146758','1975-12-01','San Juan de los Morros
','V','F','calle trinidad casa s/n barrio san jose, San Juan de los Morros','','');
INSERT INTO `personas` (`id`,`nombre`,`apellido`,`cedula`,`fecha_nac`,`lugar_nac`,`nacionalidad`,`sexo`,`direccion`,`telefono`,`email`) VALUES
('8','Gloria Carolina ','Prieto Arato','18664176','1987-07-07','villa de cura','V','F','urbanizacion romulo gallegos sector 4, v/13 casa # 2 San Juan de los Morros
','','');
INSERT INTO `personas` (`id`,`nombre`,`apellido`,`cedula`,`fecha_nac`,`lugar_nac`,`nacionalidad`,`sexo`,`direccion`,`telefono`,`email`) VALUES
('9','Ronald de Jesus','Lopez Hurtado','19724662','1989-11-07','San Juan de los Morros
','V','M','urb. antonio miguel martinez calle devy #2, San Juan de los Morros
','','');
INSERT INTO `personas` (`id`,`nombre`,`apellido`,`cedula`,`fecha_nac`,`lugar_nac`,`nacionalidad`,`sexo`,`direccion`,`telefono`,`email`) VALUES
('10','Jose Ruben','Sanchez Lopez','7072252','1963-11-23','valencia','V','M','av. los llanos edif juma piso 2, San Juan de los Morros
','','');
INSERT INTO `personas` (`id`,`nombre`,`apellido`,`cedula`,`fecha_nac`,`lugar_nac`,`nacionalidad`,`sexo`,`direccion`,`telefono`,`email`) VALUES
('11','Guillermo Rafael','Gonzalez Escalona','5161423','1958-12-09','San Juan de los Morros','V','M','av. los llanos casa s/n, San Juan de los Morros
','','');
INSERT INTO `personas` (`id`,`nombre`,`apellido`,`cedula`,`fecha_nac`,`lugar_nac`,`nacionalidad`,`sexo`,`direccion`,`telefono`,`email`) VALUES
('12','Maximo ','jimenez Arreaza','10673607','1969-04-12','San Juan de los Morros
','V','M','calle san jacinto casa # 144 sector las palmas, San Juan de los Morros
','','');
INSERT INTO `personas` (`id`,`nombre`,`apellido`,`cedula`,`fecha_nac`,`lugar_nac`,`nacionalidad`,`sexo`,`direccion`,`telefono`,`email`) VALUES
('13','Rosendo Ramon','Gonzalez','6607208','1955-04-01','San Juan de los Morros
','V','M','calle panamericana barrio bicentenario, casa # 24, San Juan de los Morros','','');
INSERT INTO `personas` (`id`,`nombre`,`apellido`,`cedula`,`fecha_nac`,`lugar_nac`,`nacionalidad`,`sexo`,`direccion`,`telefono`,`email`) VALUES
('14','Juan Vicente','Aponte Villalobos','10668257','1965-05-23','San Juan de los Morros
','V','M','camoruquito callejon la cruz, casa # 26, San Juan de los Morros','','');
INSERT INTO `personas` (`id`,`nombre`,`apellido`,`cedula`,`fecha_nac`,`lugar_nac`,`nacionalidad`,`sexo`,`direccion`,`telefono`,`email`) VALUES
('15','Carlos Eduardo','Olivo Lara','20588185','1983-01-04','San Juan de los Morros','V','M','pedro zaraza terraza de san luis casa s/n, San Juan de los Morros','','');
INSERT INTO `personas` (`id`,`nombre`,`apellido`,`cedula`,`fecha_nac`,`lugar_nac`,`nacionalidad`,`sexo`,`direccion`,`telefono`,`email`) VALUES
('16','Tomas Salvador ','Rojas Moreno','16363226','1980-08-09','San Juan de los Morros','V','M','sector el totumo calle la esperanza casa # 16, San Juan de los Morros','','');
INSERT INTO `personas` (`id`,`nombre`,`apellido`,`cedula`,`fecha_nac`,`lugar_nac`,`nacionalidad`,`sexo`,`direccion`,`telefono`,`email`) VALUES
('17','Victor Manuel','Manzano','13152190','1977-01-26','San Juan de los Morros','V','M','calle zamora casa # 72 sector zamora, San Juan de los Morros','','');
INSERT INTO `personas` (`id`,`nombre`,`apellido`,`cedula`,`fecha_nac`,`lugar_nac`,`nacionalidad`,`sexo`,`direccion`,`telefono`,`email`) VALUES
('18','Julio Jose','Martinez Manzano','16362160','1984-12-20','San Juan de los Morros','V','M','brisas del valle casa # 1, San Juan de los Morros','','');
INSERT INTO `personas` (`id`,`nombre`,`apellido`,`cedula`,`fecha_nac`,`lugar_nac`,`nacionalidad`,`sexo`,`direccion`,`telefono`,`email`) VALUES
('19','Jose Clemente','Ferrer ','2512497','1946-11-29','San Juan de los Morros','V','M','av. romulo gallegos casa # 37, San Juan de los Morros','','');
INSERT INTO `personas` (`id`,`nombre`,`apellido`,`cedula`,`fecha_nac`,`lugar_nac`,`nacionalidad`,`sexo`,`direccion`,`telefono`,`email`) VALUES
('20','Felix Antonio','Perez Bravo','11797828','1970-09-07','San Juan de los Morros','V','M','calle negro primero barrio aeropuerto casa # 27 b, San Juan de los Morros','','');
INSERT INTO `personas` (`id`,`nombre`,`apellido`,`cedula`,`fecha_nac`,`lugar_nac`,`nacionalidad`,`sexo`,`direccion`,`telefono`,`email`) VALUES
('21','Wilfredo Jose','Rojas Retaco','16076472','1983-07-22','San Juan de los Morros','V','M','calle la trinidad barrio san jose casa s/n, San Juan de los Morros','','');
INSERT INTO `personas` (`id`,`nombre`,`apellido`,`cedula`,`fecha_nac`,`lugar_nac`,`nacionalidad`,`sexo`,`direccion`,`telefono`,`email`) VALUES
('22','Carlos Jose','salazar ','11122031','1970-09-20','San Juan de los Morros','V','M','calle paez este casa # 31 sector victor angel , San Juan de los Morros','','');
INSERT INTO `personas` (`id`,`nombre`,`apellido`,`cedula`,`fecha_nac`,`lugar_nac`,`nacionalidad`,`sexo`,`direccion`,`telefono`,`email`) VALUES
('23','Juan Ciro','Rojas Requena','10666472','1965-08-08','San Juan de los Morros','V','M','calle la trinidad, casa # 33 barrio san jose San Juan de los Morros','','');
INSERT INTO `personas` (`id`,`nombre`,`apellido`,`cedula`,`fecha_nac`,`lugar_nac`,`nacionalidad`,`sexo`,`direccion`,`telefono`,`email`) VALUES
('24','David Ernesto','Hernandez Ramos','21258689','1992-11-26','San Juan de los Morros','V','M','calle colorado , casa # 19,villa de cura','','');
INSERT INTO `personas` (`id`,`nombre`,`apellido`,`cedula`,`fecha_nac`,`lugar_nac`,`nacionalidad`,`sexo`,`direccion`,`telefono`,`email`) VALUES
('25','Orlando Jose','Manzano','13151567','1975-12-15','San Juan de los Morros','V','M','calle zamora casa # 72, zona puerta negra, San Juan de los Morros','','');
INSERT INTO `personas` (`id`,`nombre`,`apellido`,`cedula`,`fecha_nac`,`lugar_nac`,`nacionalidad`,`sexo`,`direccion`,`telefono`,`email`) VALUES
('26','Luis Alberto','Herratt','14395521','1980-10-06','San Juan de los Morros','V','M','calle santa rosa callejon altamira 72, San Juan de los Morros','','');
INSERT INTO `personas` (`id`,`nombre`,`apellido`,`cedula`,`fecha_nac`,`lugar_nac`,`nacionalidad`,`sexo`,`direccion`,`telefono`,`email`) VALUES
('27','Pedro Guillermo','España','8770070','1961-08-21','San Juan de los Morros','V','M','barrio las majaguas, calle las piedras, San Juan de los Morros','','');
INSERT INTO `personas` (`id`,`nombre`,`apellido`,`cedula`,`fecha_nac`,`lugar_nac`,`nacionalidad`,`sexo`,`direccion`,`telefono`,`email`) VALUES
('28','Jose Alberto','Loreto Quintana','10666890','1970-04-04','San Juan de los Morros','V','M','calle zamora casa # 10, sector la trinidad, San Juan de los Morros','','');
INSERT INTO `personas` (`id`,`nombre`,`apellido`,`cedula`,`fecha_nac`,`lugar_nac`,`nacionalidad`,`sexo`,`direccion`,`telefono`,`email`) VALUES
('29','Jose Rafael ','Gomez Requena','9887447','1970-11-02','San Juan de los Morros','V','M','calle ppal camoruquito casa s/n, San Juan de los Morros','','');
INSERT INTO `personas` (`id`,`nombre`,`apellido`,`cedula`,`fecha_nac`,`lugar_nac`,`nacionalidad`,`sexo`,`direccion`,`telefono`,`email`) VALUES
('30','Pedro','Garcia Diaz','10666694','1969-01-11','San Juan de los Morros','V','M','calle 14 de marzo, casa # 8, San Juan de los Morros','','');
INSERT INTO `personas` (`id`,`nombre`,`apellido`,`cedula`,`fecha_nac`,`lugar_nac`,`nacionalidad`,`sexo`,`direccion`,`telefono`,`email`) VALUES
('31','Luis Enrique','Manzano Bolivar','8996499','1967-06-27','San Juan de los Morros','V','M','calle zamora casa # 80, San Juan de los Morros','','');
INSERT INTO `personas` (`id`,`nombre`,`apellido`,`cedula`,`fecha_nac`,`lugar_nac`,`nacionalidad`,`sexo`,`direccion`,`telefono`,`email`) VALUES
('32','Pedro Alejandro','Manzano Hernandez','7278860','1952-04-27','San Juan de los Morros','V','M','calle zamora casa # 76, San Juan de los Morros','','');
INSERT INTO `personas` (`id`,`nombre`,`apellido`,`cedula`,`fecha_nac`,`lugar_nac`,`nacionalidad`,`sexo`,`direccion`,`telefono`,`email`) VALUES
('33','Tomas Ramon','Lamuño','9598386','1959-01-03','San Juan de los Morros','V','M','calle carabobo aeropuerto casa # 3-A, San Juan de los Morros','','');
INSERT INTO `personas` (`id`,`nombre`,`apellido`,`cedula`,`fecha_nac`,`lugar_nac`,`nacionalidad`,`sexo`,`direccion`,`telefono`,`email`) VALUES
('34','Victor Jose','Lara','19160216','1985-05-04','San Juan de los Morros','V','M','calle san jose casa s/n, barrio san jose ,San Juan de los Morros','','');
INSERT INTO `personas` (`id`,`nombre`,`apellido`,`cedula`,`fecha_nac`,`lugar_nac`,`nacionalidad`,`sexo`,`direccion`,`telefono`,`email`) VALUES
('35','Cesar Jose','Loreto Bolivar','19222368','1988-05-16','San Juan de los Morros','V','M','calle zamora casa # 10, San Juan de los Morros','','');
INSERT INTO `personas` (`id`,`nombre`,`apellido`,`cedula`,`fecha_nac`,`lugar_nac`,`nacionalidad`,`sexo`,`direccion`,`telefono`,`email`) VALUES
('36','Felix Alfonzo ','Mendoza ','7291993','1955-01-23','San Juan de los Morros','V','M','calle la morera colo, casa # 26, San Juan de los Morros','','');
INSERT INTO `personas` (`id`,`nombre`,`apellido`,`cedula`,`fecha_nac`,`lugar_nac`,`nacionalidad`,`sexo`,`direccion`,`telefono`,`email`) VALUES
('37','Henry Rafael','Hernandez ','15480313','1975-12-24','San Juan de los Morros','V','M','calle libertad, valle verde casa # 55, San Juan de los Morros','','');
INSERT INTO `personas` (`id`,`nombre`,`apellido`,`cedula`,`fecha_nac`,`lugar_nac`,`nacionalidad`,`sexo`,`direccion`,`telefono`,`email`) VALUES
('38','Marvin Ricardo','Olivares Nieves','16734037','1984-07-23','villa de cura','V','M','calle paez las tablitas, casa # 129, la villa','','');
INSERT INTO `personas` (`id`,`nombre`,`apellido`,`cedula`,`fecha_nac`,`lugar_nac`,`nacionalidad`,`sexo`,`direccion`,`telefono`,`email`) VALUES
('39','Asterio Jose','Seijas Perdomo','8785766','1963-06-10','San Juan de los Morros','V','M','calle bicentenario casa # 38, San Juan de los Morros','','');
INSERT INTO `personas` (`id`,`nombre`,`apellido`,`cedula`,`fecha_nac`,`lugar_nac`,`nacionalidad`,`sexo`,`direccion`,`telefono`,`email`) VALUES
('40','Robinson Antonio','Pomonti Paez','4390663','1956-05-24','san juan de los morros','V','M','calle san jose, casa s/n, barrio san jose , san juan de los morros','','');
INSERT INTO `personas` (`id`,`nombre`,`apellido`,`cedula`,`fecha_nac`,`lugar_nac`,`nacionalidad`,`sexo`,`direccion`,`telefono`,`email`) VALUES
('41','Carlos Jose','Ramirez','7286759','1955-05-17','san juan de los morros','V','M','carretera nacional via flores, las lomas de pica, san juan de los morros','','');
INSERT INTO `personas` (`id`,`nombre`,`apellido`,`cedula`,`fecha_nac`,`lugar_nac`,`nacionalidad`,`sexo`,`direccion`,`telefono`,`email`) VALUES
('42','Egardo Javier','Tovar','10975213','1971-06-11','san juan de los morros','V','M','1° de mayo, casa # 20, san juan de los morros','','');
INSERT INTO `personas` (`id`,`nombre`,`apellido`,`cedula`,`fecha_nac`,`lugar_nac`,`nacionalidad`,`sexo`,`direccion`,`telefono`,`email`) VALUES
('43','Manuel Antonio ','Vargas Hernandez','10668337','1971-12-15','san juan de los morros','V','M','Av. fermin toro, casa s/n, san juan de los morros','','');
INSERT INTO `personas` (`id`,`nombre`,`apellido`,`cedula`,`fecha_nac`,`lugar_nac`,`nacionalidad`,`sexo`,`direccion`,`telefono`,`email`) VALUES
('44','Primitivo Rafael','Parejo Flores','9075053','1950-02-12','san juan de los morros','V','M','calle wiliam gonzalez, casa # 77, san juan de los morros','','');
INSERT INTO `personas` (`id`,`nombre`,`apellido`,`cedula`,`fecha_nac`,`lugar_nac`,`nacionalidad`,`sexo`,`direccion`,`telefono`,`email`) VALUES
('45','Felipe Rafael','Febres','4877798','1954-04-14','san juan de los morros','V','M','calle miguel antonio olivero, casa # 44, san juan de los morros','','');
INSERT INTO `personas` (`id`,`nombre`,`apellido`,`cedula`,`fecha_nac`,`lugar_nac`,`nacionalidad`,`sexo`,`direccion`,`telefono`,`email`) VALUES
('46','Argenis Jesus ','Liebano Moreno','20876365','1987-09-08','san juan de los morros','V','M','caretera nacional, calle 5 de julio, casa s/n, san juan de los morros','','');
INSERT INTO `personas` (`id`,`nombre`,`apellido`,`cedula`,`fecha_nac`,`lugar_nac`,`nacionalidad`,`sexo`,`direccion`,`telefono`,`email`) VALUES
('47','Jose Gregorio','Carruido','9886140','1968-07-06','san juan de los morros','V','M','carretera el castrero casa s/n, barrio la ceiba, san juan de los morros','','');
INSERT INTO `personas` (`id`,`nombre`,`apellido`,`cedula`,`fecha_nac`,`lugar_nac`,`nacionalidad`,`sexo`,`direccion`,`telefono`,`email`) VALUES
('48','Edgar Arturo','Alayon Peña','18972971','1988-11-08','san juan de los morros','V','M','calle santa rosa, casa # 100, san juan de los morros
','','');
INSERT INTO `personas` (`id`,`nombre`,`apellido`,`cedula`,`fecha_nac`,`lugar_nac`,`nacionalidad`,`sexo`,`direccion`,`telefono`,`email`) VALUES
('49','Edgar Daniel','Velasquez Maita','19221912','1988-04-29','san juan de los morros','V','M','calle el carmen, casa s/n, san juan de los morros','','');
INSERT INTO `personas` (`id`,`nombre`,`apellido`,`cedula`,`fecha_nac`,`lugar_nac`,`nacionalidad`,`sexo`,`direccion`,`telefono`,`email`) VALUES
('50','Jhon Lenor ','Peña Peña','13874683','1976-02-13','san juan de los morros','V','M','calle union, valle verde casa # 58, san juan de los morros','','');
INSERT INTO `personas` (`id`,`nombre`,`apellido`,`cedula`,`fecha_nac`,`lugar_nac`,`nacionalidad`,`sexo`,`direccion`,`telefono`,`email`) VALUES
('51','Eddy Jesus','Peña Torres','25130671','1995-08-23','san juan de los morros','V','M','calle union valle verde, casa # 71, san juan de los morros','','');
INSERT INTO `personas` (`id`,`nombre`,`apellido`,`cedula`,`fecha_nac`,`lugar_nac`,`nacionalidad`,`sexo`,`direccion`,`telefono`,`email`) VALUES
('52','Jose Luis ','Galazzo Solano','17062230','1983-10-22','san juan de los morros','V','M','calle santa ines casa s/n, san juan de los morros','','');
INSERT INTO `personas` (`id`,`nombre`,`apellido`,`cedula`,`fecha_nac`,`lugar_nac`,`nacionalidad`,`sexo`,`direccion`,`telefono`,`email`) VALUES
('53','Pablo Olivo','Garcia','5153510','1954-05-13','san juan de los morros','V','M','barrio la morera calle ppal, casa s/n, san juan de los morros','','');
INSERT INTO `personas` (`id`,`nombre`,`apellido`,`cedula`,`fecha_nac`,`lugar_nac`,`nacionalidad`,`sexo`,`direccion`,`telefono`,`email`) VALUES
('54','Carlos Luis','Seijas Ramirez','9885599','1968-09-21','cantagallo','V','M','sector 03, casa # 17 cantagallo','','');
INSERT INTO `personas` (`id`,`nombre`,`apellido`,`cedula`,`fecha_nac`,`lugar_nac`,`nacionalidad`,`sexo`,`direccion`,`telefono`,`email`) VALUES
('55','Liones Alfredo','Pulvirenti Hernandez','8999858','1968-02-07','ocumare','V','M','barrio los placeres callejon mexico # 24, san juan de los morros','','');
INSERT INTO `personas` (`id`,`nombre`,`apellido`,`cedula`,`fecha_nac`,`lugar_nac`,`nacionalidad`,`sexo`,`direccion`,`telefono`,`email`) VALUES
('56','Isaias Emilio','Montevideo','4393293','1956-07-06','san juan de los morros','V','M','pueblo nuevo, calle 5 de julio # 4, san juan de los morros','','');
INSERT INTO `personas` (`id`,`nombre`,`apellido`,`cedula`,`fecha_nac`,`lugar_nac`,`nacionalidad`,`sexo`,`direccion`,`telefono`,`email`) VALUES
('57','Keiber Gabriel ','Cedeño Morales','25887536','1996-10-12','san juan de los morros','V','M','sector aeropuerto calle union, casa # 13, san juan de los morros','','');
INSERT INTO `personas` (`id`,`nombre`,`apellido`,`cedula`,`fecha_nac`,`lugar_nac`,`nacionalidad`,`sexo`,`direccion`,`telefono`,`email`) VALUES
('58','Jacinto de la Cruz','Rojas Zapata','7282075','1963-05-03','San Juan de los Morros','V','M','Urb. Altamira, Av. Romulo Gallegos, frente a los Baños Termales','(0414)-465-0445','jacintorojaszapata@hotmail.com');
INSERT INTO `personas` (`id`,`nombre`,`apellido`,`cedula`,`fecha_nac`,`lugar_nac`,`nacionalidad`,`sexo`,`direccion`,`telefono`,`email`) VALUES
('59','HENRY DEL VALLE','VELIZ','5603896','1955-11-15','mATURIN','V','M','EL LUCIANERO, CALLEJON ORTIZ, #55','(0426)-232-4042','');
INSERT INTO `personas` (`id`,`nombre`,`apellido`,`cedula`,`fecha_nac`,`lugar_nac`,`nacionalidad`,`sexo`,`direccion`,`telefono`,`email`) VALUES
('60','BALBINO','SOJO','7298893','1966-03-31','San Juan de los Morros','V','M','San Juan de los Morros','(0414)-493-9843','');
INSERT INTO `personas` (`id`,`nombre`,`apellido`,`cedula`,`fecha_nac`,`lugar_nac`,`nacionalidad`,`sexo`,`direccion`,`telefono`,`email`) VALUES
('61','Jose Gregorio','Maitan','11121414','1973-10-14','San Juan de los Morros','V','M','Urb. Trina Chacin s/n duasdualito','(0414)-945-5564','');
INSERT INTO `personas` (`id`,`nombre`,`apellido`,`cedula`,`fecha_nac`,`lugar_nac`,`nacionalidad`,`sexo`,`direccion`,`telefono`,`email`) VALUES
('62','Armando Antonio','Manzano Manzano','19985939','1987-12-30','San Juan de los Morros','V','M','Urb. Hugo Chavez, S/n','(0426)-448-2408','');
INSERT INTO `personas` (`id`,`nombre`,`apellido`,`cedula`,`fecha_nac`,`lugar_nac`,`nacionalidad`,`sexo`,`direccion`,`telefono`,`email`) VALUES
('63','Manuel Antonio ','Hermoso Benavides','18971433','1989-06-14','San Juan de los Morros','V','M','Calle Zamora, callejon bolivar, casa #78','(0246)-432-0998','');
INSERT INTO `personas` (`id`,`nombre`,`apellido`,`cedula`,`fecha_nac`,`lugar_nac`,`nacionalidad`,`sexo`,`direccion`,`telefono`,`email`) VALUES
('64','Luis MIguel','Manzano','24975032','1995-03-12','San Juan de los Morros','V','M','Calle Zamora, casa #77','(0424)-363-2083','');
INSERT INTO `personas` (`id`,`nombre`,`apellido`,`cedula`,`fecha_nac`,`lugar_nac`,`nacionalidad`,`sexo`,`direccion`,`telefono`,`email`) VALUES
('65','Jose Gregorio','Ramirez Gonzalez','13151348','1977-08-07','San Juan de los Morros','V','M','La morera, los aguacates, casa s/n','(0412)-141-0376','');
INSERT INTO `personas` (`id`,`nombre`,`apellido`,`cedula`,`fecha_nac`,`lugar_nac`,`nacionalidad`,`sexo`,`direccion`,`telefono`,`email`) VALUES
('66','Armando Antonio','Manzano Bolivar','8780772','1961-07-25','San Juan de los Morros','V','M','Calle Zamora, barrio Puerta negra, casa #76','(0424)-305-7782','');
INSERT INTO `personas` (`id`,`nombre`,`apellido`,`cedula`,`fecha_nac`,`lugar_nac`,`nacionalidad`,`sexo`,`direccion`,`telefono`,`email`) VALUES
('67','Carmen Maria','Machin Perez','19221917','1990-08-26','San Juan de los Morros','V','F','Av. Andres Eloy Blanco, casa #2, El sombrero','(0414)-295-4932','');
INSERT INTO `personas` (`id`,`nombre`,`apellido`,`cedula`,`fecha_nac`,`lugar_nac`,`nacionalidad`,`sexo`,`direccion`,`telefono`,`email`) VALUES
('68','GREGORY ','AZUAJES','13874648','1977-05-22','San Juan de los Morros','V','M','El totumo, calle principal, #40','(0414)-945-9885','');
INSERT INTO `personas` (`id`,`nombre`,`apellido`,`cedula`,`fecha_nac`,`lugar_nac`,`nacionalidad`,`sexo`,`direccion`,`telefono`,`email`) VALUES
('69','JOSE RAMON','UTRERA APONTE','7297412','1957-09-28','San Juan de los Morros','V','M','Los Bagres, Casa S/N','','');
INSERT INTO `personas` (`id`,`nombre`,`apellido`,`cedula`,`fecha_nac`,`lugar_nac`,`nacionalidad`,`sexo`,`direccion`,`telefono`,`email`) VALUES
('70','YOAN EDUARDO','HERNANDEZ MACHADO','18617941','1985-11-12','San Juan de los Morros','V','M','Carretera Nacional, Los Cedros, Casa #25','(0424)-354-3979','');
INSERT INTO `personas` (`id`,`nombre`,`apellido`,`cedula`,`fecha_nac`,`lugar_nac`,`nacionalidad`,`sexo`,`direccion`,`telefono`,`email`) VALUES
('71','Jose Antonio','Mateus Santaella','15392513','1979-03-07','San Juan de los Morros','V','M','Las Majaguas, Calle Principal, casa #8','(0426)-644-1028','');
INSERT INTO `personas` (`id`,`nombre`,`apellido`,`cedula`,`fecha_nac`,`lugar_nac`,`nacionalidad`,`sexo`,`direccion`,`telefono`,`email`) VALUES
('72','Francisco Javier','Alvarez Gorrin','18972747','1988-02-18','San Juan de los Morros','V','M','Canta Gallo, El Bosques 2','(0414)-449-8935','');
INSERT INTO `personas` (`id`,`nombre`,`apellido`,`cedula`,`fecha_nac`,`lugar_nac`,`nacionalidad`,`sexo`,`direccion`,`telefono`,`email`) VALUES
('73','Wilmer Alfredo','Diamont Valera','11119549','1972-07-30','San Juan de los Morros','V','M','Sector Los Cedros, Casa #145','(0424)-344-0220','');
-- -------------------------------------------
-- TABLE DATA tallas
-- -------------------------------------------
INSERT INTO `tallas` (`id`,`talla_zapato`,`talla_pantalon`,`talla_camisa`) VALUES
('1','','','');
INSERT INTO `tallas` (`id`,`talla_zapato`,`talla_pantalon`,`talla_camisa`) VALUES
('2','','','');
INSERT INTO `tallas` (`id`,`talla_zapato`,`talla_pantalon`,`talla_camisa`) VALUES
('3','45','38','xl');
INSERT INTO `tallas` (`id`,`talla_zapato`,`talla_pantalon`,`talla_camisa`) VALUES
('4','','','');
INSERT INTO `tallas` (`id`,`talla_zapato`,`talla_pantalon`,`talla_camisa`) VALUES
('5','44','38','xl');
INSERT INTO `tallas` (`id`,`talla_zapato`,`talla_pantalon`,`talla_camisa`) VALUES
('6','38','28','s');
INSERT INTO `tallas` (`id`,`talla_zapato`,`talla_pantalon`,`talla_camisa`) VALUES
('7','','','');
INSERT INTO `tallas` (`id`,`talla_zapato`,`talla_pantalon`,`talla_camisa`) VALUES
('8','','','');
INSERT INTO `tallas` (`id`,`talla_zapato`,`talla_pantalon`,`talla_camisa`) VALUES
('9','','','');
INSERT INTO `tallas` (`id`,`talla_zapato`,`talla_pantalon`,`talla_camisa`) VALUES
('10','','','');
INSERT INTO `tallas` (`id`,`talla_zapato`,`talla_pantalon`,`talla_camisa`) VALUES
('11','','','');
INSERT INTO `tallas` (`id`,`talla_zapato`,`talla_pantalon`,`talla_camisa`) VALUES
('12','','','');
INSERT INTO `tallas` (`id`,`talla_zapato`,`talla_pantalon`,`talla_camisa`) VALUES
('13','','','');
INSERT INTO `tallas` (`id`,`talla_zapato`,`talla_pantalon`,`talla_camisa`) VALUES
('14','','','');
INSERT INTO `tallas` (`id`,`talla_zapato`,`talla_pantalon`,`talla_camisa`) VALUES
('15','','','');
INSERT INTO `tallas` (`id`,`talla_zapato`,`talla_pantalon`,`talla_camisa`) VALUES
('16','','','');
INSERT INTO `tallas` (`id`,`talla_zapato`,`talla_pantalon`,`talla_camisa`) VALUES
('17','','','');
INSERT INTO `tallas` (`id`,`talla_zapato`,`talla_pantalon`,`talla_camisa`) VALUES
('18','','','');
INSERT INTO `tallas` (`id`,`talla_zapato`,`talla_pantalon`,`talla_camisa`) VALUES
('19','42','34','M');
INSERT INTO `tallas` (`id`,`talla_zapato`,`talla_pantalon`,`talla_camisa`) VALUES
('20','42','30','M');
INSERT INTO `tallas` (`id`,`talla_zapato`,`talla_pantalon`,`talla_camisa`) VALUES
('21','36','42','L');
INSERT INTO `tallas` (`id`,`talla_zapato`,`talla_pantalon`,`talla_camisa`) VALUES
('22','42','32','M');
INSERT INTO `tallas` (`id`,`talla_zapato`,`talla_pantalon`,`talla_camisa`) VALUES
('23','39','32','L');
INSERT INTO `tallas` (`id`,`talla_zapato`,`talla_pantalon`,`talla_camisa`) VALUES
('24','42','32','S');
INSERT INTO `tallas` (`id`,`talla_zapato`,`talla_pantalon`,`talla_camisa`) VALUES
('25','40','42','XXL');
INSERT INTO `tallas` (`id`,`talla_zapato`,`talla_pantalon`,`talla_camisa`) VALUES
('26','42','30','M');
INSERT INTO `tallas` (`id`,`talla_zapato`,`talla_pantalon`,`talla_camisa`) VALUES
('27','41','32','M');
INSERT INTO `tallas` (`id`,`talla_zapato`,`talla_pantalon`,`talla_camisa`) VALUES
('28','41','36','XXL');
INSERT INTO `tallas` (`id`,`talla_zapato`,`talla_pantalon`,`talla_camisa`) VALUES
('29','41','28','M');
INSERT INTO `tallas` (`id`,`talla_zapato`,`talla_pantalon`,`talla_camisa`) VALUES
('30','41','32','M');
INSERT INTO `tallas` (`id`,`talla_zapato`,`talla_pantalon`,`talla_camisa`) VALUES
('31','40','30','M');
INSERT INTO `tallas` (`id`,`talla_zapato`,`talla_pantalon`,`talla_camisa`) VALUES
('32','','','');
INSERT INTO `tallas` (`id`,`talla_zapato`,`talla_pantalon`,`talla_camisa`) VALUES
('33','40','30','M');
INSERT INTO `tallas` (`id`,`talla_zapato`,`talla_pantalon`,`talla_camisa`) VALUES
('34','40','30','M');
INSERT INTO `tallas` (`id`,`talla_zapato`,`talla_pantalon`,`talla_camisa`) VALUES
('35','41','34','L');
INSERT INTO `tallas` (`id`,`talla_zapato`,`talla_pantalon`,`talla_camisa`) VALUES
('36','42','34','L');
INSERT INTO `tallas` (`id`,`talla_zapato`,`talla_pantalon`,`talla_camisa`) VALUES
('37','42','32','M');
INSERT INTO `tallas` (`id`,`talla_zapato`,`talla_pantalon`,`talla_camisa`) VALUES
('38','44','38','xl');
INSERT INTO `tallas` (`id`,`talla_zapato`,`talla_pantalon`,`talla_camisa`) VALUES
('39','40','32','L');
INSERT INTO `tallas` (`id`,`talla_zapato`,`talla_pantalon`,`talla_camisa`) VALUES
('40','42','34','M');
INSERT INTO `tallas` (`id`,`talla_zapato`,`talla_pantalon`,`talla_camisa`) VALUES
('41','43','36','L');
INSERT INTO `tallas` (`id`,`talla_zapato`,`talla_pantalon`,`talla_camisa`) VALUES
('42','41','32','M');
INSERT INTO `tallas` (`id`,`talla_zapato`,`talla_pantalon`,`talla_camisa`) VALUES
('43','41','36','XXL');
INSERT INTO `tallas` (`id`,`talla_zapato`,`talla_pantalon`,`talla_camisa`) VALUES
('44','42','32','M');
INSERT INTO `tallas` (`id`,`talla_zapato`,`talla_pantalon`,`talla_camisa`) VALUES
('45','','','');
INSERT INTO `tallas` (`id`,`talla_zapato`,`talla_pantalon`,`talla_camisa`) VALUES
('46','41','30','S');
INSERT INTO `tallas` (`id`,`talla_zapato`,`talla_pantalon`,`talla_camisa`) VALUES
('47','42','34','m');
INSERT INTO `tallas` (`id`,`talla_zapato`,`talla_pantalon`,`talla_camisa`) VALUES
('48','40','32','M');
INSERT INTO `tallas` (`id`,`talla_zapato`,`talla_pantalon`,`talla_camisa`) VALUES
('49','41','36','L');
INSERT INTO `tallas` (`id`,`talla_zapato`,`talla_pantalon`,`talla_camisa`) VALUES
('50','41','34','L');
INSERT INTO `tallas` (`id`,`talla_zapato`,`talla_pantalon`,`talla_camisa`) VALUES
('51','40','32','M');
INSERT INTO `tallas` (`id`,`talla_zapato`,`talla_pantalon`,`talla_camisa`) VALUES
('52','41','30','S');
INSERT INTO `tallas` (`id`,`talla_zapato`,`talla_pantalon`,`talla_camisa`) VALUES
('53','42','36','L');
INSERT INTO `tallas` (`id`,`talla_zapato`,`talla_pantalon`,`talla_camisa`) VALUES
('54','43','34','L');
INSERT INTO `tallas` (`id`,`talla_zapato`,`talla_pantalon`,`talla_camisa`) VALUES
('55','41','34','L');
INSERT INTO `tallas` (`id`,`talla_zapato`,`talla_pantalon`,`talla_camisa`) VALUES
('56','39','34','L');
INSERT INTO `tallas` (`id`,`talla_zapato`,`talla_pantalon`,`talla_camisa`) VALUES
('57','42','36','M');
INSERT INTO `tallas` (`id`,`talla_zapato`,`talla_pantalon`,`talla_camisa`) VALUES
('58','44','34','M');
INSERT INTO `tallas` (`id`,`talla_zapato`,`talla_pantalon`,`talla_camisa`) VALUES
('59','41','34','M');
INSERT INTO `tallas` (`id`,`talla_zapato`,`talla_pantalon`,`talla_camisa`) VALUES
('60','40','34','M');
INSERT INTO `tallas` (`id`,`talla_zapato`,`talla_pantalon`,`talla_camisa`) VALUES
('61','38','30','L');
INSERT INTO `tallas` (`id`,`talla_zapato`,`talla_pantalon`,`talla_camisa`) VALUES
('62','41','34','M');
INSERT INTO `tallas` (`id`,`talla_zapato`,`talla_pantalon`,`talla_camisa`) VALUES
('63','45','36','L');
INSERT INTO `tallas` (`id`,`talla_zapato`,`talla_pantalon`,`talla_camisa`) VALUES
('64','43','36','M');
INSERT INTO `tallas` (`id`,`talla_zapato`,`talla_pantalon`,`talla_camisa`) VALUES
('65','41','32','M');
INSERT INTO `tallas` (`id`,`talla_zapato`,`talla_pantalon`,`talla_camisa`) VALUES
('66','40','30','M');
INSERT INTO `tallas` (`id`,`talla_zapato`,`talla_pantalon`,`talla_camisa`) VALUES
('67','45','32','M');
INSERT INTO `tallas` (`id`,`talla_zapato`,`talla_pantalon`,`talla_camisa`) VALUES
('68','43','34','XL');
INSERT INTO `tallas` (`id`,`talla_zapato`,`talla_pantalon`,`talla_camisa`) VALUES
('69','40','32','M');
INSERT INTO `tallas` (`id`,`talla_zapato`,`talla_pantalon`,`talla_camisa`) VALUES
('70','43','32','L');
INSERT INTO `tallas` (`id`,`talla_zapato`,`talla_pantalon`,`talla_camisa`) VALUES
('71','41','32','S');
INSERT INTO `tallas` (`id`,`talla_zapato`,`talla_pantalon`,`talla_camisa`) VALUES
('72','39','30','S');
INSERT INTO `tallas` (`id`,`talla_zapato`,`talla_pantalon`,`talla_camisa`) VALUES
('73','41','32','L');
INSERT INTO `tallas` (`id`,`talla_zapato`,`talla_pantalon`,`talla_camisa`) VALUES
('74','41','36','M');
INSERT INTO `tallas` (`id`,`talla_zapato`,`talla_pantalon`,`talla_camisa`) VALUES
('75','39','28','S');
INSERT INTO `tallas` (`id`,`talla_zapato`,`talla_pantalon`,`talla_camisa`) VALUES
('76','42','30','M');
INSERT INTO `tallas` (`id`,`talla_zapato`,`talla_pantalon`,`talla_camisa`) VALUES
('77','41','30','M');
INSERT INTO `tallas` (`id`,`talla_zapato`,`talla_pantalon`,`talla_camisa`) VALUES
('78','39','32','L');
INSERT INTO `tallas` (`id`,`talla_zapato`,`talla_pantalon`,`talla_camisa`) VALUES
('79','41','32','M');
INSERT INTO `tallas` (`id`,`talla_zapato`,`talla_pantalon`,`talla_camisa`) VALUES
('80','40','32','S');
INSERT INTO `tallas` (`id`,`talla_zapato`,`talla_pantalon`,`talla_camisa`) VALUES
('81','41','32','M');
-- -------------------------------------------
-- TABLE DATA usuario
-- -------------------------------------------
INSERT INTO `usuario` (`id`,`id_persona`,`user`,`pass`,`nivel`) VALUES
('3','1','administrador','292ef3d4df7a0882d4e8d253db414b04','3');
INSERT INTO `usuario` (`id`,`id_persona`,`user`,`pass`,`nivel`) VALUES
('6','2','Mircelys','f574c60b9799d4c63550742dbce11a46','2');
INSERT INTO `usuario` (`id`,`id_persona`,`user`,`pass`,`nivel`) VALUES
('7','3','mary2329','be53d253d6bc3258a8160556dda3e9b2','2');
INSERT INTO `usuario` (`id`,`id_persona`,`user`,`pass`,`nivel`) VALUES
('8','4','jonav','50d2be98900f1d8a2fb3c3207c6d31b9','1');
-- -------------------------------------------
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
COMMIT;
-- -------------------------------------------
-- -------------------------------------------
-- END BACKUP
-- -------------------------------------------
| true |
95262154e2e7aa997a2dbf8160dc44c093bf8cc3 | SQL | Rthorpesr/bamazon | /bamazon.sql | UTF-8 | 499 | 2.9375 | 3 | [] | no_license |
drop database if exists Bamazon;
CREATE DATABASE Bamazon;
USE Bamazon;
CREATE TABLE products (
item_id INT NOT NULL AUTO_INCREMENT,
product_name VARCHAR(100) NOT NULL,
department_name VARCHAR(50) NULL,
price DECIMAL(7,2) NOT NULL,
stock_quantity INT NOT NULL DEFAULT '1',
PRIMARY KEY (item_id)
);
Select * From products;
insert into products(product_name, department_name, price, stock_quantity, product_sales)
value ("Iphone X", "Electronics", 999.99, 10, 5);
| true |
2a585fd5483f6c4134bc6195a1faefc5ef323764 | SQL | valuko/impala_tpcds | /queries/query22.sql | UTF-8 | 1,433 | 3.28125 | 3 | [
"Apache-2.0"
] | permissive | -- start query 5 in stream 0 using template query22a.tpl using seed 1380568660
with results as
(select i_product_name
,i_brand
,i_class
,i_category
,inv_quantity_on_hand qoh
from inventory
,date_dim
,item
,warehouse
where inv_date_sk=d_date_sk
and inv_item_sk=i_item_sk
and inv_warehouse_sk = w_warehouse_sk
and d_month_seq between 1206 and 1206 + 11
-- group by i_product_name,i_brand,i_class,i_category
),
results_rollup as
(select i_product_name, i_brand, i_class, i_category,avg(qoh) qoh
from results
group by i_product_name,i_brand,i_class,i_category
union all
select i_product_name, i_brand, i_class, null i_category,avg(qoh) qoh
from results
group by i_product_name,i_brand,i_class
union all
select i_product_name, i_brand, null i_class, null i_category,avg(qoh) qoh
from results
group by i_product_name,i_brand
union all
select i_product_name, null i_brand, null i_class, null i_category,avg(qoh) qoh
from results
group by i_product_name
union all
select null i_product_name, null i_brand, null i_class, null i_category,avg(qoh) qoh
from results)
select i_product_name, i_brand, i_class, i_category,qoh
from results_rollup
order by qoh, i_product_name, i_brand, i_class, i_category
limit 100;
-- end query 5 in stream 0 using template query22a.tpl
| true |
e106c5b559e118ee81740fcdbef4ad4cb318b15f | SQL | ihor-bondarenko/node_training | /1.sql | UTF-8 | 2,016 | 3.921875 | 4 | [] | no_license | CREATE TABLE birds (
bird_id INT AUTO_INCREMENT PRIMARY KEY,
scientific_name VARCHAR(255) UNIQUE,
common_name VARCHAR(50),
family_id INT,
description TEXT);
CREATE DATABASE birdwatchers;
CREATE TABLE birdwatchers.humans
(human_id INT AUTO_INCREMENT PRIMARY KEY,
formal_title VARCHAR(25),
name_first VARCHAR(25),
name_last VARCHAR(25),
email_address VARCHAR(255));
CREATE TABLE bird_families (
family_id INT AUTO_INCREMENT PRIMARY KEY,
scientific_name VARCHAR(255) UNIQUE,
brief_description VARCHAR(255) );
CREATE TABLE bird_orders (
order_id INT AUTO_INCREMENT PRIMARY KEY,
scientific_name VARCHAR(255) UNIQUE,
brief_description VARCHAR(255),
order_image BLOB
) DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
ALTER TABLE bird_families
ADD COLUMN order_id INT;
ALTER TABLE birds
ADD COLUMN wing_id CHAR(2) AFTER family_id;
ALTER TABLE birds
ADD COLUMN body_id CHAR(2) AFTER wing_id,
ADD COLUMN bill_id CHAR(2) AFTER body_id,
ADD COLUMN endangered BIT DEFAULT b'1' AFTER bill_id,
CHANGE COLUMN common_name common_name VARCHAR(255);
UPDATE birds_new SET endangered = 0
WHERE bird_id IN(1,2,4,5);
ALTER TABLE birds_new
MODIFY COLUMN endangered
ENUM('Extinct',
'Extinct in Wild',
'Threatened - Critically Endangered',
'Threatened - Endangered',
'Threatened - Vulnerable',
'Lower Risk - Conservation Dependent',
'Lower Risk - Near Threatened',
'Lower Risk - Least Concern')
AFTER family_id;
UPDATE birds_new
SET endangered = 7;
CREATE TABLE rookery.conservation_status
(status_id INT AUTO_INCREMENT PRIMARY KEY,
conservation_category CHAR(10),
conservation_state CHAR(25) );
INSERT INTO rookery.conservation_status
(conservation_category, conservation_state)
VALUES('Extinct','Extinct'),
('Extinct','Extinct in Wild'),
('Threatened','Critically Endangered'),
('Threatened','Endangered'),
('Threatened','Vulnerable'),
('Lower Risk','Conservation Dependent'),
('Lower Risk','Near Threatened'),
('Lower Risk','Least Concern');
ALTER TABLE birds_new
CHANGE COLUMN endangered conservation_status_id INT DEFAULT 8;
| true |
66ef70e5b535a53af879ab8c9bcc9669494a806a | SQL | andriimielkov/TestTask | /script.sql | UTF-8 | 1,084 | 3.734375 | 4 | [] | no_license | CREATE DATABASE 'Shop';
USE 'Shop';
CREATE TABLE IF NOT EXISTS Product (
prod_id INT AUTO_INCREMENT,
prod_name VARCHAR(20) NOT NULL ,
price DOUBLE,
PRIMARY KEY(prod_id));
CREATE TABLE IF NOT EXISTS Purchase (
pur_id INT AUTO_INCREMENT NOT NULL,
prod_id INT,
quantity INT ,
purchase_date DATE,
PRIMARY KEY (pur_id),
FOREIGN KEY (prod_id) REFERENCES Product(prod_id)
ON UPDATE CASCADE
ON DELETE RESTRICT);
INSERT INTO Product (prod_name, price) VALUES ('Bike','1000');
INSERT INTO Product (prod_name, price) VALUES ('NoteBook','5000');
INSERT INTO Product (prod_name, price) VALUES ('Phone','2000');
INSERT INTO Product (prod_name, price) VALUES ('Computer','10000');
INSERT INTO Product (prod_name, price) VALUES ('Car','1000000');
INSERT INTO Purchase (prod_id, quantity, purchase_date) VALUES (1,'12',now());
INSERT INTO Purchase (prod_id, quantity, purchase_date) VALUES (3,'30',now());
INSERT INTO Purchase (prod_id, quantity, purchase_date) VALUES (5,'4',now());
INSERT INTO Purchase (prod_id, quantity, purchase_date) VALUES (5,'4','2016-01-10'); | true |
4fc04589b46d0efe9bdb02efb75ecb7351009d70 | SQL | BogdanFi/cmiN | /FII/L2/SGBD/3/Poieana_Cosmin_X_3/Poieana_Cosmin_X_3_1.sql | UTF-8 | 12,185 | 3.703125 | 4 | [] | no_license | CREATE OR REPLACE FUNCTION rand(start_int NUMBER, end_int NUMBER)
RETURN NUMBER AS
ret NUMBER;
BEGIN
ret := TRUNC(DBMS_RANDOM.VALUE(start_int, end_int + 1));
RETURN ret;
END;
/
CREATE OR REPLACE PACKAGE FII AS
date_format CONSTANT VARCHAR(16) := 'DD-MON-YYYY';
stud_id Studenti.id%TYPE;
PROCEDURE adauga_student(
stud_nr_matricol OUT Studenti.nr_matricol%TYPE,
stud_nume Studenti.nume%TYPE := 'Poieana',
stud_prenume Studenti.prenume%TYPE := 'Cosmin',
stud_an Studenti.an%TYPE := 3,
stud_grupa Studenti.grupa%TYPE := 'A6',
stud_bursa Studenti.bursa%TYPE := NULL,
stud_data_nastere Studenti.data_nastere%TYPE := TO_DATE('26-APR-1993', date_format),
stud_email Studenti.email%TYPE := 'cmin764@gmail.com'
);
PROCEDURE afiseaza_student(stud_nr_matricol Studenti.nr_matricol%TYPE);
PROCEDURE sterge_student(stud_nr_matricol Studenti.nr_matricol%TYPE);
END FII;
/
CREATE OR REPLACE PACKAGE BODY FII AS
PROCEDURE get_varsta(stud_data_nastere IN Studenti.data_nastere%TYPE,
ani OUT NUMBER, luni OUT NUMBER, zile OUT NUMBER) AS
-- Procedura privata ce intoarce varsta unui student.
luni_delta NUMBER;
data_aux Studenti.data_nastere%TYPE;
data_crt Studenti.data_nastere%TYPE;
BEGIN
data_crt := SYSDATE();
luni_delta := FLOOR(MONTHS_BETWEEN(data_crt, stud_data_nastere));
ani := FLOOR(luni_delta / 12);
luni := luni_delta MOD 12;
data_aux := ADD_MONTHS(stud_data_nastere, luni_delta);
zile := ROUND(data_crt - data_aux);
END get_varsta;
FUNCTION random_char(gen_letter NUMBER := 0)
RETURN VARCHAR AS
-- Intoarce un caracter aleator.
letter VARCHAR(1);
nr NUMBER;
BEGIN
nr := ASCII('0') + rand(0, 9);
nr := nr + gen_letter * (ASCII('A') - ASCII('0'));
letter := CHR(nr);
RETURN letter;
END;
PROCEDURE adauga_note(stud_an Studenti.an%TYPE, an_delta NUMBER) AS
CURSOR cursuri_crs IS
SELECT * FROM Cursuri
WHERE stud_an = Cursuri.an;
cursuri_line cursuri_crs%ROWTYPE;
note_id Note.id%TYPE;
BEGIN
DBMS_OUTPUT.PUT_LINE('[i] Adaugam notele din anul ' || stud_an || '.');
SELECT MAX(Note.id) + 1 INTO note_id
FROM Note;
OPEN cursuri_crs;
LOOP
FETCH cursuri_crs INTO cursuri_line;
EXIT WHEN cursuri_crs%NOTFOUND;
DBMS_OUTPUT.PUT_LINE('[*] Inseram nota noua cu ID: ' || note_id);
INSERT INTO Note VALUES(
note_id,
stud_id,
cursuri_line.id,
rand(4, 10),
SYSDATE() - an_delta * 365 + rand(0, 30),
SYSDATE(),
SYSDATE()
);
COMMIT;
note_id := note_id + 1;
END LOOP;
CLOSE cursuri_crs;
END;
PROCEDURE adauga_student(
stud_nr_matricol OUT Studenti.nr_matricol%TYPE,
stud_nume Studenti.nume%TYPE := 'Poieana',
stud_prenume Studenti.prenume%TYPE := 'Cosmin',
stud_an Studenti.an%TYPE := 3,
stud_grupa Studenti.grupa%TYPE := 'A6',
stud_bursa Studenti.bursa%TYPE := NULL,
stud_data_nastere Studenti.data_nastere%TYPE := TO_DATE('26-APR-1993', date_format),
stud_email Studenti.email%TYPE := 'cmin764@gmail.com'
) AS
matricol_dim CONSTANT NUMBER := 6;
dim NUMBER;
letter VARCHAR(1);
get_letter NUMBER;
BEGIN
-- Alegem ID unic.
SELECT MAX(Studenti.id) + 1 INTO stud_id
FROM Studenti;
DBMS_OUTPUT.PUT_LINE('[*] ID nou: ' || stud_id);
-- Generam aleator nr. matricol.
WHILE TRUE LOOP
stud_nr_matricol := '';
FOR idx IN 1..matricol_dim LOOP
IF (idx IN (4, 5)) THEN
get_letter := 1;
ELSE
get_letter := 0;
END IF;
letter := random_char(get_letter);
stud_nr_matricol := CONCAT(stud_nr_matricol, letter);
END LOOP;
SELECT COUNT(1) INTO dim
FROM Studenti
WHERE stud_nr_matricol LIKE Studenti.nr_matricol;
IF (dim = 0) THEN
-- Am gasit un nr. matricol unic.
EXIT;
ELSE
DBMS_OUTPUT.PUT_LINE('[*] Nr. matricol duplicat: ' || stud_nr_matricol ||
' (cu ' || dim || ' intampinari).');
END IF;
END LOOP;
DBMS_OUTPUT.PUT_LINE('[*] Nr. matricol unic: ' || stud_nr_matricol);
-- Adaugam efectiv studentul in baza de date.
INSERT INTO Studenti VALUES(
stud_id,
stud_nr_matricol,
stud_nume,
stud_prenume,
stud_an,
stud_grupa,
stud_bursa,
stud_data_nastere,
stud_email,
SYSDATE(),
SYSDATE()
);
COMMIT;
DBMS_OUTPUT.PUT_LINE('[i] Student adaugat cu succes!');
-- Adaugam note pentru acest student.
IF (stud_an > 1) THEN
FOR an_crt IN 1..stud_an - 1 LOOP
adauga_note(an_crt, stud_an - an_crt);
END LOOP;
END IF;
END adauga_student;
PROCEDURE alege_student(stud_nr_matricol Studenti.nr_matricol%TYPE) AS
BEGIN
stud_id := NULL;
SELECT Studenti.id INTO stud_id
FROM Studenti
WHERE stud_nr_matricol LIKE Studenti.nr_matricol AND
ROWNUM = 1;
IF (stud_id = NULL) THEN
DBMS_OUTPUT.PUT_LINE('[!] Studentul cu nr. matricol "' || stud_nr_matricol ||
'" nu a fost gasit!');
END IF;
END;
FUNCTION get_medie(my_stud_id Studenti.id%TYPE)
RETURN FLOAT AS
medie FLOAT := -1;
BEGIN
SELECT AVG(Note.valoare) INTO medie
FROM Note
WHERE my_stud_id = Note.id_student;
RETURN medie;
END;
PROCEDURE afiseaza_student(stud_nr_matricol Studenti.nr_matricol%TYPE) AS
CURSOR studenti_crs IS
SELECT * FROM Studenti
WHERE stud_id = Studenti.id AND ROWNUM=1;
studenti_line studenti_crs%ROWTYPE;
CURSOR prieteni_crs IS
SELECT * FROM Prieteni
WHERE studenti_line.id = Prieteni.id_student1 OR
studenti_line.id = Prieteni.id_student2;
prieteni_line prieteni_crs%ROWTYPE;
prieten_id Prieteni.id_student1%TYPE;
CURSOR colegi_crs IS
SELECT * FROM Studenti
WHERE studenti_line.grupa = Studenti.grupa;
colegi_line colegi_crs%ROWTYPE;
CURSOR note_crs IS
SELECT * FROM Note
WHERE studenti_line.id = Note.id_student;
note_line note_crs%ROWTYPE;
media FLOAT;
cmp_medie FLOAT;
ani NUMBER;
luni NUMBER;
zile NUMBER;
max_prieteni CONSTANT NUMBER := NULL;
prieteni_count NUMBER;
pozitie NUMBER := 1;
p_id Studenti.id%TYPE;
p_nume Studenti.nume%TYPE;
p_prenume Studenti.prenume%TYPE;
nume_curs Cursuri.titlu_curs%TYPE;
BEGIN
alege_student(stud_nr_matricol);
IF (stud_id = NULL) THEN
RETURN;
END IF;
-- Selectam studentul corespunzator.
OPEN studenti_crs;
FETCH studenti_crs INTO studenti_line;
CLOSE studenti_crs;
-- Afisam detalii simple despre student.
DBMS_OUTPUT.PUT_LINE('[i] ID: ' || studenti_line.id);
DBMS_OUTPUT.PUT_LINE('[i] Nr. matricol: ' || studenti_line.nr_matricol);
DBMS_OUTPUT.PUT_LINE('[i] Nume: ' || studenti_line.nume);
DBMS_OUTPUT.PUT_LINE('[i] Prenume: ' || studenti_line.prenume);
DBMS_OUTPUT.PUT_LINE('[i] An: ' || studenti_line.an);
DBMS_OUTPUT.PUT_LINE('[i] Grupa: ' || studenti_line.grupa);
DBMS_OUTPUT.PUT_LINE('[i] Bursa: ' || studenti_line.bursa);
DBMS_OUTPUT.PUT_LINE('[i] Data nastere: ' || studenti_line.data_nastere);
DBMS_OUTPUT.PUT_LINE('[i] E-mail: ' || studenti_line.email);
-- Afisam media.
media := get_medie(studenti_line.id);
DBMS_OUTPUT.PUT_LINE('[i] Media: ' || media);
-- Pozitie in grupa.
pozitie := 1;
OPEN colegi_crs;
LOOP
FETCH colegi_crs INTO colegi_line;
EXIT WHEN colegi_crs%NOTFOUND;
cmp_medie := get_medie(colegi_line.id);
IF (cmp_medie > media) THEN
pozitie := pozitie + 1;
END IF;
END LOOP;
CLOSE colegi_crs;
DBMS_OUTPUT.PUT_LINE('[i] Pozitie in grupa: ' || pozitie);
-- Varsta.
get_varsta(studenti_line.data_nastere, ani, luni, zile);
DBMS_OUTPUT.PUT_LINE('[i] Varsta: ' ||
ani || ' ani ' ||
luni || ' luni ' ||
zile || ' zile.');
-- Prieteni.
DBMS_OUTPUT.PUT_LINE('[i] Prieteni:');
prieteni_count := 0;
OPEN prieteni_crs;
LOOP
FETCH prieteni_crs INTO prieteni_line;
EXIT WHEN prieteni_crs%NOTFOUND;
IF (max_prieteni <> 0 AND prieteni_count >= max_prieteni) THEN
EXIT;
END IF;
-- Alegem prietenul corespunzator.
IF (prieteni_line.id_student1 = studenti_line.id) THEN
prieten_id := prieteni_line.id_student2;
ELSE
prieten_id := prieteni_line.id_student1;
END IF;
SELECT id, nume, prenume INTO p_id, p_nume, p_prenume
FROM Studenti
WHERE prieten_id = Studenti.id AND
ROWNUM = 1;
DBMS_OUTPUT.PUT_LINE(' ' || '- ' || p_nume || ' ' ||
p_prenume || ' (' || p_id || ')');
prieteni_count := prieteni_count + 1;
END LOOP;
CLOSE prieteni_crs;
-- Foaie matricola.
DBMS_OUTPUT.PUT_LINE('[i] Foaie matricola:');
OPEN note_crs;
LOOP
FETCH note_crs INTO note_line;
EXIT WHEN note_crs%NOTFOUND;
SELECT Cursuri.titlu_curs INTO nume_curs
FROM Cursuri
WHERE note_line.id_curs = Cursuri.id AND
ROWNUM = 1;
DBMS_OUTPUT.PUT_LINE(' - ' || nume_curs || ': ' || note_line.valoare ||
' (' || note_line.data_notare || ').');
END LOOP;
CLOSE note_crs;
END afiseaza_student;
PROCEDURE sterge_student(stud_nr_matricol Studenti.nr_matricol%TYPE) AS
BEGIN
-- Cautam si stergem studentul in cauza, dupa ID.
alege_student(stud_nr_matricol);
IF (stud_id = NULL) THEN
RETURN;
END IF;
-- Eliminam notele studentului mai intai.
DELETE FROM Note
WHERE stud_id = Note.id_student;
-- Acum eliminam studentul propriu-zis.
DELETE FROM Studenti
WHERE stud_id = Studenti.id;
DBMS_OUTPUT.PUT_LINE('[i] A fost sters cu succes studentul cu ID "' ||
stud_id || '" (inclusiv notele).');
END sterge_student;
END FII;
/
SET serveroutput ON;
DECLARE
stud_nr_matricol Studenti.nr_matricol%TYPE := '';
BEGIN
FII.adauga_student(stud_nr_matricol);
FII.afiseaza_student(stud_nr_matricol);
FII.sterge_student(stud_nr_matricol);
FII.afiseaza_student('121HO6'); -- ID: 1
DBMS_OUTPUT.PUT_LINE('End');
END;
| true |
6feb97949153bd419a03285a02d8e928db2b9fcb | SQL | Marioalf2002/FormLogin | /usuarios.sql | UTF-8 | 1,822 | 3.09375 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 4.9.0.1
-- https://www.phpmyadmin.net/
--
-- Servidor: 127.0.0.1
-- Tiempo de generación: 11-10-2019 a las 20:23:35
-- Versión del servidor: 10.4.6-MariaDB
-- Versión de PHP: 7.3.8
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Base de datos: `login`
--
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `usuarios`
--
CREATE TABLE `usuarios` (
`id` int(11) NOT NULL,
`nombres` varchar(255) NOT NULL,
`usuario` varchar(50) NOT NULL,
`password` varchar(50) NOT NULL,
`tipo` enum('Usuario','Admin','','') NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Volcado de datos para la tabla `usuarios`
--
INSERT INTO `usuarios` (`id`, `nombres`, `usuario`, `password`, `tipo`) VALUES
(1, 'Mario Hernandez', 'Mario', '123', 'Admin'),
(2, 'Michelle Estefania\r\n', 'Michelle', '1234', 'Usuario'),
(3, 'Michael Varela', 'Michael', '12344', 'Usuario'),
(4, 'Jose Cardenas', 'Jose', '12345', 'Usuario'),
(5, 'Jorge Remache', 'Jorge', '12345', 'Usuario');
--
-- Índices para tablas volcadas
--
--
-- Indices de la tabla `usuarios`
--
ALTER TABLE `usuarios`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT de las tablas volcadas
--
--
-- AUTO_INCREMENT de la tabla `usuarios`
--
ALTER TABLE `usuarios`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true |
96a908049e4c45b4e364ecd1287fac2f8ecf126f | SQL | laura-lancie/UniworkTeam-Project-Section | /SQL/users.sql | UTF-8 | 3,019 | 2.984375 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 4.2.10
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Apr 20, 2019 at 03:29 PM
-- Server version: 5.5.58-0+deb7u1-log
-- PHP Version: 5.6.31-1~dotdeb+7.1
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: `unn_w18025112`
--
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
CREATE TABLE IF NOT EXISTS `users` (
`userID` mediumint(8) NOT NULL,
`firstName` varchar(255) NOT NULL,
`surname` varchar(255) NOT NULL,
`email` varchar(255) NOT NULL,
`password` varchar(255) NOT NULL,
`username` varchar(50) NOT NULL,
`imageURL` varchar(255) NOT NULL,
`bio` text NOT NULL,
`facebook` varchar(255) NOT NULL,
`twitter` varchar(255) NOT NULL,
`instagram` varchar(255) NOT NULL,
`emailConfirm` tinyint(1) NOT NULL DEFAULT '0',
`access` tinyint(1) DEFAULT '1',
`display` tinyint(1) DEFAULT '0',
`joinDate` date NOT NULL,
`suspensionEnd` date NOT NULL DEFAULT '1970-01-01',
`tempPassword` varchar(255) NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `users`
--
INSERT INTO `users` (`userID`, `firstName`, `surname`, `email`, `password`, `username`, `imageURL`, `bio`, `facebook`, `twitter`, `instagram`, `emailConfirm`, `access`, `display`, `joinDate`, `suspensionEnd`, `tempPassword`) VALUES
(1, 'Gary', 'Walker', 'gary@tbc.com', '$2y$12$WDQJmG1NlNMEUT25UU5Q0eGkWzmHs1AC.OmAieoPY2GO3rEUPkDiy', 'Administrator', '', '', '', '', '', 1, 4, 0, '2019-03-20', '1970-01-01', ''),
(2, 'David', 'McDowell', 'davidwmcdowell86@gmail.com', '$2y$12$nB6CZpLa/ZXqIH6Y/D9Q4eEW.FmJR3RjQaGhktuV61dmY.n3Bclxu', 'Macky_5150', 'userImages/F2A34636-AFBE-469F-91D9-81D8029F7A47.jpeg', 'My favourite movie is Jaws and I also like Jurassic Park, Escape From New York, The Shining, The Big Lebowski, Blade Runner and many more. I need to keep writing to test the limits of the bio box but I have completely ran out of things to say.', 'davidmcdowell5150', 'macky_5150', 'macky_5150', 1, 1, 1, '2019-04-05', '1970-01-01', ''),
(3, 'Laura', 'Atkin', 'laurakatkin@gmail.com', '$2y$12$UmN.RvgPgfrSITS8ks7LeuvxkENfVu2OW9NV3hPZK3CSuqkEtyAXS', 'LauraA', '', '', '', '', '', 1, 4, 0, '2019-04-19', '1970-01-01', '');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`userID`), ADD UNIQUE KEY `email` (`email`), ADD UNIQUE KEY `userID` (`userID`), ADD UNIQUE KEY `username` (`username`), ADD KEY `access` (`access`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
MODIFY `userID` mediumint(8) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=4;
/*!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 */;
| true |
6e78a4a3aa5aa3aecfaae5db563d86a05b906b32 | SQL | cuba-platform/workflow-thesis | /modules/core/db/update/postgres/02/02-130-migrateAssignmentAttachmentToCardAttachment.sql | UTF-8 | 168 | 2.53125 | 3 | [] | no_license | -- Description:
update WF_ATTACHMENT set CARD_ID = (select a.card_id from WF_ASSIGNMENT a where a.id = assignment_id), type = 'C' where CARD_ID is NULL and type = 'A'; | true |
0b7af3b5dd3e161ec63cca0d3f02a9f818dd3bc8 | SQL | sgmsgood/query | /1101_PL_bind,func/test_elseif.sql | UHC | 696 | 3.5 | 4 | [] | no_license | -- if (else ~ if)
-- Է¹ 0 '0 ۾Ƽ '
-- 100 ū '100 Ŀ ' / ''
set serveroutput on
set verify off
accept score prompt ': '
declare
score number := &score;
begin
dbms_output.put(score); --> ¿ score ֱ ؼ. Ʒ Ŀ ¿ .
if score < 0 then
dbms_output.put_line(' 0 ۾Ƽ ');
elsif score > 100 then
dbms_output.put_line(' 100 Ŀ ');
else
dbms_output.put_line(' Է¼ o(^^o)(o^^)o');
end if;
end;
/ | true |
5f2adc3364e37c4ae37136a9f57252b0c105b026 | SQL | silence-do-good/stress-test-Postgres-and-MySQL | /dump/low/day22/select1012.sql | UTF-8 | 412 | 3.578125 | 4 | [] | no_license |
SELECT obs.sensor_id, avg(counts)
FROM (SELECT sensor_id, date_trunc('day', timestamp), count(*) as counts
FROM WiFiAPObservation WHERE timestamp>'2017-11-21T10:12:00Z' AND timestamp<'2017-11-22T10:12:00Z' AND SENSOR_ID = ANY(array['3143_clwa_3059','3141_clwe_1100','3143_clwa_3231','3146_clwa_6049','3146_clwa_6011'])
GROUP BY sensor_id, date_trunc('day', timestamp)) AS obs
GROUP BY sensor_id
| true |
c56f301f8c8af4d8db2cd41548c31f3d2ac5d4c3 | SQL | emefix/Kobiety-do-kodu | /Celebrity/sqlQueries.sql | UTF-8 | 474 | 2.9375 | 3 | [
"Apache-2.0"
] | permissive | CREATE SCHEMA `celebrityapp` DEFAULT CHARACTER SET utf8 COLLATE utf8_polish_ci ;
CREATE TABLE `celebrityapp`.`celebrities` (
`id` INT PRIMARY KEY AUTO_INCREMENT,
`name` VARCHAR(255),
`canSing` TINYINT,
`canAct` TINYINT,
`canDance` TINYINT
)
DEFAULT CHARACTER SET = utf8
COLLATE = utf8_polish_ci;
SELECT * FROM `celebrityapp`.`celebrities`;
INSERT INTO `celebrityapp`.`celebrities` (`name`, `canSing`, `canAct`, `canDance`) VALUES ('Eminem', 1, 1, 0); | true |
1b640b9d7c0b50398294d5801fc8701a1e627f38 | SQL | Telefonica/rural-planner | /sql/ec/v_acceso_transporte_clusters.sql | UTF-8 | 8,759 | 2.875 | 3 | [] | no_license | CREATE OR REPLACE VIEW
{schema}.v_acceso_transporte_clusters
(
cluster_id,
codigo_divipola,
torre_acceso,
km_dist_torre_acceso,
owner_torre_acceso,
altura_torre_acceso,
tipo_torre_acceso,
vendor_torre_acceso,
tecnologia_torre_acceso,
torre_acceso_4g,
torre_acceso_3g,
torre_acceso_2g,
torre_acceso_source,
torre_acceso_internal_id,
latitude_torre_acceso,
longitude_torre_acceso,
geom_torre_acceso,
geom_line_torre_acceso,
geom_line_transporte_torre_acceso,
torre_acceso_movistar_optima,
distancia_torre_acceso_movistar_optima,
torre_acceso_regional_optima,
distancia_torre_acceso_regional_optima,
torre_acceso_terceros_optima,
distancia_torre_acceso_terceros_optima,
los_acceso_transporte,
torre_transporte,
km_dist_torre_transporte,
owner_torre_transporte,
altura_torre_transporte,
tipo_torre_transporte,
banda_satelite_torre_transporte,
torre_transporte_fibra,
torre_transporte_radio,
torre_transporte_satellite,
torre_transporte_source,
torre_transporte_internal_id,
latitude_torre_transporte,
longitude_torre_transporte,
geom_torre_transporte,
geom_line_torre_transporte,
torre_transporte_movistar_optima,
distancia_torre_transporte_movistar_optima,
torre_transporte_regional_optima,
distancia_torre_transporte_regional_optima,
torre_transporte_terceros_optima,
distancia_torre_transporte_terceros_optima
) AS
SELECT
tr.centroid AS cluster_id,
tr.centroid as codigo_divipola,
NULL::integer as torre_acceso,
0::DOUBLE PRECISION as km_dist_torre_acceso,
NULL::TEXT AS owner_torre_acceso,
50 as altura_torre_acceso,
NULL::TEXT AS tipo_torre_acceso,
NULL::TEXT AS vendor_torre_acceso,
'-' AS tecnologia_torre_acceso,
FALSE AS torre_acceso_4g,
FALSE AS torre_acceso_3g,
FALSE AS torre_acceso_2g,
NULL::TEXT AS torre_acceso_source,
NULL::TEXT AS torre_acceso_internal_id,
NULL::DOUBLE PRECISION as latitude_torre_acceso,
NULL::DOUBLE PRECISION as longitude_torre_acceso,
NULL::GEOMETRY as geom_torre_acceso,
NULL::GEOMETRY as geom_line_torre_acceso,
ST_MakeLine(tr.geom_centroid::geometry,i.geom::geometry) as geom_line_trasnporte_torre_acceso,
NULL::integer AS torre_acceso_movistar_optima,
NULL::DOUBLE PRECISION as distancia_torre_acceso_movistar_optima,
NULL::integer AS torre_acceso_regional_optima,
NULL::DOUBLE PRECISION as distancia_torre_acceso_regional_optima,
NULL::integer AS torre_acceso_terceros_optima,
NULL::DOUBLE PRECISION as distancia_torre_acceso_terceros_optima,
tr.line_of_sight_movistar as los_acceso_transporte,
tr.movistar_transport as torre_transporte,
tr.distance_movistar_transport/1000 as km_dist_torre_transporte,
i.owner as owner_torre_transporte,
i.tower_height as altura_torre_transporte,
CASE
WHEN ((i.fiber
AND i.radio)
AND i.satellite)
THEN 'FO+RADIO+SAT'::text
WHEN (i.fiber
AND i.radio)
THEN 'i+RADIO'::text
WHEN (i.fiber
AND i.satellite)
THEN 'FO+SAT'::text
WHEN (i.radio
AND i.satellite)
THEN 'RADIO+SAT'::text
WHEN i.fiber
THEN 'FO'::text
WHEN i.radio
THEN 'RADIO'::text
WHEN i.satellite
THEN 'SAT'::text
ELSE '-'::text
END AS tipo_torre_transporte,
i.satellite_band_in_use as banda_satelite_torre_transporte,
i.fiber as torre_transporte_fibra,
i.radio as torre_transporte_radio,
i.satellite as torre_transporte_satellite,
i.source as torre_transporte_source,
i.internal_id as torre_transporte_internal_id,
i.latitude as latitude_torre_transporte,
i.longitude as longitude_torre_transporte,
i.geom as geom_torre_transporte,
ST_Makeline(i.geom::geometry, tr.geom_centroid::geometry) as geom_line_torre_transporte,
tr.movistar_transport as torre_transporte_movistar_optima,
tr.distance_movistar_transport as distancia_torre_transporte_movistar_optima,
NULL::INTEGER as torre_transporte_regional_optima,
NULL::DOUBLE PRECISION as distancia_torre_transporte_regional_optima,
tr.third_party_transport as torre_transporte_terceros_optima,
tr.distance_third_party_transport as distancia_torre_transporte_terceros_optima
FROM
{schema}.transport_greenfield_clusters tr
LEFT JOIN {schema}.infrastructure_global i
ON tr.movistar_transport=i.tower_id
LEFT JOIN {schema}.clusters c
ON c.centroid=tr.centroid
WHERE c.nodes IS NOT NULL
UNION
SELECT c.centroid AS cluster_id,
NULL::text AS codigo_divipola,
tr.tower_id as torre_acceso,
(0)::DOUBLE PRECISION AS km_dist_torre_acceso,
i.owner as owner_torre_acceso,
i.tower_height as altura_torre_acceso,
i.tower_type as tipo_torre_acceso,
i.vendor as vendor_torre_acceso,
CASE
WHEN ((i.tech_4g
AND i.tech_3g)
AND i.tech_2g)
THEN '4G+3G+2G'::text
WHEN (i.tech_4g
AND i.tech_3g)
THEN '4G+3G'::text
WHEN (i.tech_4g
AND i.tech_2g)
THEN '4G+2G'::text
WHEN (i.tech_3g
AND i.tech_2g)
THEN '3G+2G'::text
WHEN i.tech_4g
THEN '4G'::text
WHEN i.tech_3g
THEN '3G'::text
WHEN i.tech_2g
THEN '2G'::text
ELSE '-'::text
END AS tecnologia_torre_acceso,
i.tech_4g as torre_acceso_4g,
i.tech_3g as torre_acceso_3g,
i.tech_2g as torre_acceso_2g,
i.source as torre_acceso_source,
i.internal_id as torre_acceso_internal_id,
i.latitude as latitude_torre_acceso,
i.longitude as longitude_torre_acceso,
i.geom as geom_torre_acceso,
NULL::GEOMETRY AS geom_line_torre_acceso,
ST_MakeLine(i.geom::geometry, it.geom::geometry) as geom_line_trasnporte_torre_acceso,
i.tower_id as torre_acceso_movistar_optima,
0 as distancia_torre_acceso_movistar_optima,
NULL::INTEGER AS torre_acceso_regional_optima,
NULL::DOUBLE PRECISION AS distancia_torre_acceso_regional_optima,
NULL::INTEGER as torre_acceso_terceros_optima,
NULL::DOUBLE PRECISION AS distancia_torre_acceso_terceros_optima,
tr.line_of_sight_movistar as los_acceso_transporte,
tr.movistar_transport_id as torre_transporte,
tr.distance_third_party_transport_m/1000 as km_dist_torre_transporte,
it.owner as owner_torre_transporte,
it.tower_height as altura_torre_transporte,
CASE
WHEN ((it.fiber
AND it.radio)
AND it.satellite)
THEN 'FO+RADIO+SAT'::text
WHEN (it.fiber
AND it.radio)
THEN 'FO+RADIO'::text
WHEN (it.fiber
AND it.satellite)
THEN 'FO+SAT'::text
WHEN (it.radio
AND it.satellite)
THEN 'RADIO+SAT'::text
WHEN it.fiber
THEN 'FO'::text
WHEN it.radio
THEN 'RADIO'::text
WHEN it.satellite
THEN 'SAT'::text
ELSE '-'::text
END AS tipo_torre_transporte,
it.satellite_band_in_use as banda_satelite_torre_transporte,
it.fiber as torre_transporte_fibra,
it.radio as torre_transporte_radio,
it.satellite as torre_transporte_satellite,
it.source as torre_transporte_source,
it.internal_id as torre_transporte_internal_id,
it.latitude as latitude_torre_transporte,
it.longitude as longitude_torre_transporte,
it.geom as geom_torre_transporte,
ST_MakeLine(i.geom::geometry, it.geom::geometry) as geom_line_torre_transporte,
tr.movistar_transport_id as torre_transporte_movistar_optima,
tr.distance_movistar_transport_m as distancia_torre_transporte_movistar_optima,
NULL::INTEGER AS torre_transporte_regional_optima,
NULL::DOUBLE PRECISION AS distancia_torre_transporte_regional_optima,
tr.third_party_transport_id as torre_transporte_terceros_optima,
tr.distance_third_party_transport_m as distancia_torre_transporte_terceros_optima
FROM
{schema}.clusters c
LEFT JOIN {schema}.transport_by_tower tr
ON c.centroid=tr.tower_id::text
LEFT JOIN {schema}.infrastructure_global i
ON c.centroid=i.tower_id::TEXT
LEFT JOIN {schema}.infrastructure_global it
ON tr.movistar_transport_id=it.tower_id
WHERE i.tower_id IS NOT NULL; | true |
fd2f332a54c621d4475d3b3ddb5346bbfc070f70 | SQL | mhnvelu/dairy-factory-order-service | /src/main/resources/scripts/mysql-init.sql | UTF-8 | 587 | 2.578125 | 3 | [
"Apache-2.0"
] | permissive | DROP DATABASE if exists dairyfactoryorderservice;
drop user if exists `dairy_factory_order_service`@`%`;
create database if not exists dairyfactoryorderservice character set utf8mb4 collate
utf8mb4_unicode_ci;
create user if not exists `dairy_factory_order_service`@`%` IDENTIFIED with mysql_native_password
by 'password';
grant select, insert, update, delete, create, drop, references, index, alter, execute, CREATE,
create view, show view, create routine, alter routine, event, trigger on
`dairyfactoryorderservice`.* to
`dairy_factory_order_service`@`%`;
flush privileges; | true |
733ee76ec46daea26d85bca29d8292eb1abbf124 | SQL | sharunya-sr/nf | /webNF_integrate/nishritha_foundation.sql | UTF-8 | 3,678 | 3.09375 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 4.9.2
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Jul 14, 2020 at 10:09 AM
-- Server version: 10.4.10-MariaDB
-- PHP Version: 7.1.33
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: `nishritha_foundation`
--
-- --------------------------------------------------------
--
-- Table structure for table `contact`
--
CREATE TABLE `contact` (
`name` varchar(255) NOT NULL,
`email` varchar(100) NOT NULL,
`phone` int(10) NOT NULL,
`msg` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `contact`
--
INSERT INTO `contact` (`name`, `email`, `phone`, `msg`) VALUES
('mumbaifoodreview', '98kamaljitkaur@gmail.com', 2147483647, 'hey,this is doneee'),
('mumbaifoodreview', '98kamaljitkaur@gmail.com', 2147483647, 'heyyy'),
('mumbaifoodreview', '98kamaljitkaur@gmail.com', 2147483647, 'heyyyyaa');
-- --------------------------------------------------------
--
-- Table structure for table `volunteer`
--
CREATE TABLE `volunteer` (
`id` int(11) NOT NULL,
`first_name` text NOT NULL,
`last_name` text NOT NULL,
`email` text NOT NULL,
`phone` int(10) NOT NULL,
`age` int(11) NOT NULL,
`gender` text NOT NULL,
`volunteer_available` text NOT NULL,
`hours` int(11) NOT NULL,
`volunteer_status` text NOT NULL,
`address1` text NOT NULL,
`address2` text NOT NULL,
`state` text NOT NULL,
`city` text NOT NULL,
`postal_code` int(11) NOT NULL,
`profile` text NOT NULL,
`experience` text NOT NULL,
`hear` text NOT NULL,
`image` varchar(255) NOT NULL,
`application_status` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `volunteer`
--
INSERT INTO `volunteer` (`id`, `first_name`, `last_name`, `email`, `phone`, `age`, `gender`, `volunteer_available`, `hours`, `volunteer_status`, `address1`, `address2`, `state`, `city`, `postal_code`, `profile`, `experience`, `hear`, `image`, `application_status`) VALUES
(7, 'Kamaljit', ' Angrez Singh', 'admin@blog.com', 2147483647, 20, 'female', '3-4 days', 2, 'Homemaker', 'kharghar', 'SKP', 'Maharashtra', 'kharghar,Navi-mumbai', 410210, 'Teaching Volunteer', 'Yes', 'Friend/Family', 'uploads/Capture.JPG', 'Accepted'),
(10, 'Thor', 'Asgard', 'thor@marvel.com', 1010102334, 70, 'male', '5-6 days', 3, 'Retired', 'Marvel universe', 'Asgard', 'Earth', 'Sutur', 210301, 'Managing events', 'Yes', 'Email', 'uploads/thor.jpg', 'Accepted'),
(11, 'Kamaljit', ' Angrez Singh', 'admin@blog.com', 1010102334, 20, 'female', 'Homemaker', 3, 'Homemaker', 'kharghar', 'SKP', 'Maharashtra', 'kharghar,Navi-mumbai', 410210, 'Teaching Volunteer', 'Yes', 'Social Media', 'uploads/volunteerlogo.png', 'Accepted'),
(12, 'Kamaljit', ' Angrez Singh', '98kamaljitkaur@gmail.com', 2147483647, 20, 'female', 'Homemaker', 3, 'Homemaker', 'kharghar', 'SKP', 'Maharashtra', 'kharghar,Navi-mumbai', 410210, 'Fundraising Volunteer', 'Yes', 'Website', 'uploads/volunteerlogo.png', 'Accepted');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `volunteer`
--
ALTER TABLE `volunteer`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `volunteer`
--
ALTER TABLE `volunteer`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=13;
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 */;
| true |
017a443394c6c1a6d83e03289fe0e98099b34d19 | SQL | meta-udit-saxena/Assignments | /DBMS1/library.sql | UTF-8 | 14,570 | 4.40625 | 4 | [] | no_license | -- Drop Database if already present
DROP DATABASE IF EXISTS `library`;
-- Create database.
CREATE DATABASE `library`;
-- Select database.
USE `library`;
-- Create table members.
CREATE TABLE `members`(
member_id VARCHAR(10) PRIMARY KEY,
member_name VARCHAR(45) NOT NULL,
address_line1 VARCHAR(30) NOT NULL,
address_line2 VARCHAR(30) NOT NULL,
category VARCHAR(1) NOT NULL
);
-- Create table author.
CREATE TABLE `author`(
author_id VARCHAR(10) PRIMARY KEY,
author_name VARCHAR(45) NOT NULL
);
-- Create table subjects.
CREATE TABLE `subjects`(
subject_id VARCHAR(10) PRIMARY KEY,
subject_name VARCHAR(20) NOT NULL
);
-- Create table publisher.
CREATE TABLE `publisher`(
publisher_id VARCHAR(10) PRIMARY KEY,
publisher_name VARCHAR(45) NOT NULL
);
-- Create table title.
CREATE TABLE `title`(
title_id VARCHAR(10) PRIMARY KEY,
title_name VARCHAR(50) NOT NULL,
subject_id VARCHAR(10),
publisher_id VARCHAR(10),
CONSTRAINT fk_title_subjects FOREIGN KEY (subject_id) REFERENCES `subjects` (subject_id) ON UPDATE CASCADE ON DELETE CASCADE ,
CONSTRAINT fk_title_publisher FOREIGN KEY (publisher_id) REFERENCES `publisher` (publisher_id) ON UPDATE CASCADE ON DELETE CASCADE
);
-- Create table books.
CREATE TABLE `books`(
accession_no VARCHAR(10) PRIMARY KEY,
title_id VARCHAR(10),
purchase_date DATE NOT NULL,
price DOUBLE NOT NULL,
status ENUM('AVAILABLE', 'UNAVAILABLE') NOT NULL,
CONSTRAINT fk_book_title FOREIGN KEY (title_id) REFERENCES `title` (title_id) ON UPDATE CASCADE ON DELETE CASCADE
);
-- Create table title_author.
CREATE TABLE `title_author`(
title_id VARCHAR(10),
author_id VARCHAR(10),
PRIMARY KEY (title_id,author_id),
CONSTRAINT fk_title_author_title FOREIGN KEY (title_id) REFERENCES `title` (title_id) ON UPDATE CASCADE ON DELETE CASCADE ,
CONSTRAINT fk_title_author_author FOREIGN KEY (author_id) REFERENCES `author` (author_id) ON UPDATE CASCADE ON DELETE CASCADE
);
-- Create table book_issue.
CREATE TABLE `book_issue`(
issue_date TIMESTAMP,
accession_no VARCHAR(10),
member_id VARCHAR(10),
due_date DATE NOT NULL,
PRIMARY KEY (issue_date,accession_no,member_id),
CONSTRAINT fk_book_issue_book FOREIGN KEY (accession_no) REFERENCES `books` (accession_no) ON UPDATE CASCADE ON DELETE CASCADE ,
CONSTRAINT fk_book_issue_member FOREIGN KEY (member_id) REFERENCES `members` (member_id) ON UPDATE CASCADE ON DELETE CASCADE
);
-- Create table book_return.
CREATE TABLE `book_return`(
return_date TIMESTAMP,
accession_no VARCHAR(10),
member_id VARCHAR(10),
issue_date DATE NOT NULL,
PRIMARY KEY (return_date,accession_no,member_id),
CONSTRAINT fk_book_return_members FOREIGN KEY (member_id) REFERENCES `members` (member_id) ON UPDATE CASCADE ON DELETE CASCADE ,
CONSTRAINT fk_book_return_books FOREIGN KEY (accession_no) REFERENCES `books` (accession_no) ON UPDATE CASCADE ON DELETE CASCADE
);
-- Show all tables in the database.
SHOW tables;
-- To set default value of column issue_date to current date.
ALTER TABLE `book_issue`
MODIFY COLUMN issue_date TIMESTAMP
DEFAULT NOW();
-- To set default value of column due_date to current date + 15.
CREATE TRIGGER set_default_due_date
BEFORE INSERT ON `book_issue`
FOR EACH ROW
SET NEW.due_date = ADDDATE(NOW(), INTERVAL 15 DAY);
-- Delete the foreign key fk_book_issue_member.
ALTER TABLE `book_issue` DROP FOREIGN KEY fk_book_issue_member;
-- Delete the foreign key fk_book_return_members.
ALTER TABLE `book_return` DROP FOREIGN KEY fk_book_return_members;
-- Delete table members.
DROP TABLE `members`;
-- Again create table members.
CREATE TABLE `members`(
member_id VARCHAR(10) PRIMARY KEY,
member_name VARCHAR(45) NOT NULL,
address_line1 VARCHAR(30) NOT NULL,
address_line2 VARCHAR(30) NOT NULL,
category VARCHAR(20) NOT NULL
);
-- Again add the foreign key fk_book_issue_member.
ALTER TABLE `book_issue`
ADD CONSTRAINT fk_book_issue_member
FOREIGN KEY (member_id)
REFERENCES `members`(member_id);
-- Again add the foreign key fk_book_return_member.
ALTER TABLE `book_return`
ADD CONSTRAINT fk_book_return_member
FOREIGN KEY (member_id)
REFERENCES `members`(member_id);
-- Insert values into table authors.
INSERT INTO `author`(author_id, author_name) VALUES("Author1", "J. K. Rowling");
INSERT INTO `author`(author_id, author_name) VALUES("Author2", "Chetan Bhagat");
INSERT INTO `author`(author_id, author_name) VALUES("Author3", "Harold Robbins");
INSERT INTO `author`(author_id, author_name) VALUES("Author4", "James Gosling");
INSERT INTO `author`(author_id, author_name) VALUES("Author5", "Danielle Steel");
INSERT INTO `author`(author_id, author_name) VALUES("Author6", "William Shakespeare");
-- Insert values into table publisher.
INSERT INTO `publisher`(publisher_id, publisher_name) VALUES("Publisher1", "NotionPress");
INSERT INTO `publisher`(publisher_id, publisher_name) VALUES("Publisher2", "Tata McGraw Hill");
INSERT INTO `publisher`(publisher_id, publisher_name) VALUES("Publisher3", "Arihant Publications");
INSERT INTO `publisher`(publisher_id, publisher_name) VALUES("Publisher4", "Taxmann Publications");
INSERT INTO `publisher`(publisher_id, publisher_name) VALUES("Publisher5", "Genius Publications");
INSERT INTO `publisher`(publisher_id, publisher_name) VALUES("Publisher6", "Ashirwad Publications");
-- Insert values into table subjects.
INSERT INTO `subjects`(subject_id, subject_name) VALUES("Subject1", "DBMS");
INSERT INTO `subjects`(subject_id, subject_name) VALUES("Subject2", "C++ Programming");
INSERT INTO `subjects`(subject_id, subject_name) VALUES("Subject3", "Oracle");
INSERT INTO `subjects`(subject_id, subject_name) VALUES("Subject4", "JavaScript");
INSERT INTO `subjects`(subject_id, subject_name) VALUES("Subject5", "JAVA");
INSERT INTO `subjects`(subject_id, subject_name) VALUES("Subject6", "Mathematics");
-- Insert values into table members.
INSERT INTO `members`(member_id, member_name, address_line1, address_line2, category) VALUES("Member1", "Neel Singhal", "Sector-3", "Gopalpura", "F");
INSERT INTO `members`(member_id, member_name, address_line1, address_line2, category) VALUES("Member2", "Udit Saxena", "Sector-18", "Shanti Nagar", "M");
INSERT INTO `members`(member_id, member_name, address_line1, address_line2, category) VALUES("Member3", "Gaurav Tak", "Sector-6", "Sanganer", "F");
INSERT INTO `members`(member_id, member_name, address_line1, address_line2, category) VALUES("Member4", "Shivam Lalwani", "Sector-13", "Pratap Nagar", "M");
INSERT INTO `members`(member_id, member_name, address_line1, address_line2, category) VALUES("Member5", "Gourav Gandhi", "Sector-2", "Choti Chopad", "F");
-- Insert values into table titles.
INSERT INTO `title`(title_id, title_name, subject_id, publisher_id) VALUES("Title1", "Harry Potter - Goblet of Fire", "Subject1", "Publisher6");
INSERT INTO `title`(title_id, title_name, subject_id, publisher_id) VALUES("Title2", "Let Us C", "Subject2", "Publisher5");
INSERT INTO `title`(title_id, title_name, subject_id, publisher_id) VALUES("Title3", "Earth Facts", "Subject3", "Publisher4");
INSERT INTO `title`(title_id, title_name, subject_id, publisher_id) VALUES("Title4", "Know Database Management", "Subject4", "Publisher2");
INSERT INTO `title`(title_id, title_name, subject_id, publisher_id) VALUES("Title5", "JAVA - Basics", "Subject5", "Publisher3");
INSERT INTO `title`(title_id, title_name, subject_id, publisher_id) VALUES("Title6", "Vedic Mathematics", "Subject6", "Publisher1");
-- Insert values into table title_author.
INSERT INTO `title_author`(title_id, author_id) VALUES("Title1", "Author1");
INSERT INTO `title_author`(title_id, author_id) VALUES("Title2", "Author5");
INSERT INTO `title_author`(title_id, author_id) VALUES("Title3", "Author1");
INSERT INTO `title_author`(title_id, author_id) VALUES("Title4", "Author6");
INSERT INTO `title_author`(title_id, author_id) VALUES("Title5", "Author3");
INSERT INTO `title_author`(title_id, author_id) VALUES("Title6", "Author2");
-- Insert values into table books.
INSERT INTO `books`(accession_no, title_id, purchase_date, price, status) VALUES("Book1", "Title1", '2017-07-14', 500.00, 'AVAILABLE');
INSERT INTO `books`(accession_no, title_id, purchase_date, price, status) VALUES("Book2", "Title2", '2017-04-23', 110.00, 'AVAILABLE');
INSERT INTO `books`(accession_no, title_id, purchase_date, price, status) VALUES("Book3", "Title3", '2017-11-15', 110.00, 'AVAILABLE');
INSERT INTO `books`(accession_no, title_id, purchase_date, price, status) VALUES("Book4", "Title4", '2016-05-16', 215.00, 'AVAILABLE');
INSERT INTO `books`(accession_no, title_id, purchase_date, price, status) VALUES("Book5", "Title5", '2016-03-13', 510.00, 'AVAILABLE');
INSERT INTO `books`(accession_no, title_id, purchase_date, price, status) VALUES("Book6", "Title6", '2015-04-30', 220.00, 'AVAILABLE');
-- Insert values into table book_issue.
INSERT INTO `book_issue`(issue_date, accession_no, member_id, due_date) VALUES('2017-09-01', "Book6", "Member2", '2017-09-16');
INSERT INTO `book_issue`(issue_date, accession_no, member_id, due_date) VALUES('2017-08-24', "Book1", "Member1", '2017-09-07');
INSERT INTO `book_issue`(issue_date, accession_no, member_id, due_date) VALUES('2017-09-21', "Book4", "Member3", '2017-10-04');
INSERT INTO `book_issue`(issue_date, accession_no, member_id, due_date) VALUES('2017-09-10', "Book2", "Member4", '2017-09-25');
INSERT INTO `book_issue`(issue_date, accession_no, member_id, due_date) VALUES('2017-09-16', "Book3", "Member5", '2017-10-01');
-- Insert values into table book_return .
INSERT INTO `book_return`(return_date, accession_no, member_id, issue_date) VALUES('2017-09-16', "Book6", "Member2", '2017-09-01');
INSERT INTO `book_return`(return_date, accession_no, member_id, issue_date) VALUES('2017-09-07', "Book1", "Member1", '2017-08-24');
INSERT INTO `book_return`(return_date, accession_no, member_id, issue_date) VALUES('2017-10-04', "Book4", "Member3", '2017-09-21');
INSERT INTO `book_return`(return_date, accession_no, member_id, issue_date) VALUES('2017-09-25', "Book2", "Member4", '2017-09-10');
INSERT INTO `book_return`(return_date, accession_no, member_id, issue_date) VALUES('2017-10-01', "Book3", "Member5", '2017-09-16');
-- disable safe mode
SET SQL_SAFE_UPDATES = 0;
-- Update address_line2 field of members table.
UPDATE `members` SET address_line2 = "Jaipur";
-- Update address_line1 field of members table.
UPDATE `members` SET address_line1 = 'EPIP, Sitapura' WHERE category = "F";
-- Delete all rows from table publisher.
DELETE FROM `publisher`;
-- Entering data into publisher table using substitution variable.
SET @name = 'NotionPress',@id ='Publisher1';
INSERT INTO `publisher`(publisher_id, publisher_name) VALUES(@id, @name);
SET @name = 'Tata McGraw Hill',@id ='Publisher2';
INSERT INTO `publisher`(publisher_id, publisher_name) VALUES(@id, @name);
SET @name = 'Arihant Publications' ,@id ='Publisher3';
INSERT INTO `publisher`(publisher_id, publisher_name) VALUES(@id, @name);
SET @name = 'Taxmann Publications',@id ='Publisher4';
INSERT INTO `publisher`(publisher_id, publisher_name) VALUES(@id, @name);
SET @name = 'Genius Publications',@id ='Publisher5';
INSERT INTO `publisher`(publisher_id, publisher_name) VALUES(@id, @name);
SET @name = 'Ashirwad Publications',@id ='Publisher6';
INSERT INTO `publisher`(publisher_id, publisher_name) VALUES(@id, @name);
-- Insert values into table titles.
INSERT INTO `title`(title_id, title_name, subject_id, publisher_id) VALUES("Title1", "Harry Potter - Goblet of Fire", "Subject1", "Publisher6");
INSERT INTO `title`(title_id, title_name, subject_id, publisher_id) VALUES("Title2", "Let Us C", "Subject2", "Publisher5");
INSERT INTO `title`(title_id, title_name, subject_id, publisher_id) VALUES("Title3", "Earth Facts", "Subject3", "Publisher4");
INSERT INTO `title`(title_id, title_name, subject_id, publisher_id) VALUES("Title4", "Know Database Management", "Subject4", "Publisher2");
INSERT INTO `title`(title_id, title_name, subject_id, publisher_id) VALUES("Title5", "JAVA - Basics", "Subject5", "Publisher3");
INSERT INTO `title`(title_id, title_name, subject_id, publisher_id) VALUES("Title6", "Vedic Mathematics", "Subject6", "Publisher1");
-- Insert values into table books.
INSERT INTO `books`(accession_no, title_id, purchase_date, price, status) VALUES("Book1", "Title1", '2017-07-14', 500.00, 'AVAILABLE');
INSERT INTO `books`(accession_no, title_id, purchase_date, price, status) VALUES("Book2", "Title2", '2017-04-23', 110.00, 'AVAILABLE');
INSERT INTO `books`(accession_no, title_id, purchase_date, price, status) VALUES("Book3", "Title3", '2017-11-15', 110.00, 'AVAILABLE');
INSERT INTO `books`(accession_no, title_id, purchase_date, price, status) VALUES("Book4", "Title4", '2016-05-16', 215.00, 'AVAILABLE');
INSERT INTO `books`(accession_no, title_id, purchase_date, price, status) VALUES("Book5", "Title5", '2016-03-13', 510.00, 'AVAILABLE');
INSERT INTO `books`(accession_no, title_id, purchase_date, price, status) VALUES("Book6", "Title6", '2015-04-30', 220.00, 'AVAILABLE');
-- Insert values into table book_issue.
INSERT INTO `book_issue`(issue_date, accession_no, member_id, due_date) VALUES('2017-09-01', "Book6", "Member2", '2017-09-16');
INSERT INTO `book_issue`(issue_date, accession_no, member_id, due_date) VALUES('2017-08-24', "Book1", "Member1", '2017-09-07');
INSERT INTO `book_issue`(issue_date, accession_no, member_id, due_date) VALUES('2017-09-21', "Book4", "Member3", '2017-10-04');
INSERT INTO `book_issue`(issue_date, accession_no, member_id, due_date) VALUES('2017-09-10', "Book2", "Member4", '2017-09-25');
INSERT INTO `book_issue`(issue_date, accession_no, member_id, due_date) VALUES('2017-09-16', "Book3", "Member5", '2017-10-01');
-- Insert values into table book_return .
INSERT INTO `book_return`(return_date, accession_no, member_id, issue_date) VALUES('2017-09-16', "Book6", "Member2", '2017-09-01');
INSERT INTO `book_return`(return_date, accession_no, member_id, issue_date) VALUES('2017-09-07', "Book1", "Member1", '2017-08-24');
INSERT INTO `book_return`(return_date, accession_no, member_id, issue_date) VALUES('2017-10-04', "Book4", "Member3", '2017-09-21');
INSERT INTO `book_return`(return_date, accession_no, member_id, issue_date) VALUES('2017-09-25', "Book2", "Member4", '2017-09-10');
INSERT INTO `book_return`(return_date, accession_no, member_id, issue_date) VALUES('2017-10-01', "Book3", "Member5", '2017-09-16');
-- Delete rows with Publisher1 from table title.
DELETE FROM `title` WHERE publisher_id = 'Publisher1';
| true |
ea1ba3ffc05c8dbe1e2149be3cb56a9f959eb13a | SQL | tjacobs2/UbSRD | /6A_UBQ_Respair.sql | UTF-8 | 2,456 | 3.5625 | 4 | [] | no_license | .header on
SELECT
it.pdb_code AS pdb, uc.chain_id AS ubq_chain,
rpi1.pdb_residue_number AS tar_res, rpi1.chain_id AS tar_chain, r1.name3 AS tar_name3,
un.real AS ubq_res,
rpi2.chain_id AS ubq_chain, r2.name3 AS ubq_name3,
rp.actcoord_dist AS distance,
sss.dssp AS partner_dssp,
it.ubl_type AS ubl_type,
uc.inter_type AS inter_type
FROM ubq_chains uc
JOIN residue_pdb_identification rpi1 ON
uc.struct_id = rpi1.struct_id AND
rpi1.chain_id NOT IN (SELECT uc2.chain_id FROM ubq_chains uc2 WHERE uc2.struct_id = rpi1.struct_id)
JOIN residues r1 ON
r1.struct_id = uc.struct_id AND
r1.resNum = rpi1.residue_number
JOIN residue_pdb_identification rpi2 ON
uc.struct_id = rpi2.struct_id AND
rpi2.chain_id = uc.chain_id
JOIN residues r2 ON
r2.struct_id = uc.struct_id AND
r2.resNum = rpi2.residue_number
JOIN ubq_numbering un ON
rpi2.pdb_residue_number = un.renum
JOIN residue_pairs rp ON
uc.struct_id = rp.struct_id AND
((rpi1.chain_id = uc.chain_id AND rpi2.chain_id != uc.chain_id) OR
(rpi1.chain_id != uc.chain_id AND rpi2.chain_id = uc.chain_id)) AND
((rpi1.residue_number = rp.resNum1 AND rpi2.residue_number = rp.resNum2) OR
(rpi1.residue_number = rp.resNum2 AND rpi2.residue_number = rp.resNum1))
JOIN interaction_type it ON
uc.struct_id = it.struct_id
JOIN secondary_structure_segments sss ON
uc.struct_id = sss.struct_id
AND
(rpi1.residue_number BETWEEN sss.residue_begin AND sss.residue_end)
WHERE
rp.actcoord_dist < 6
AND
it.ubl_type = 'UBQ'
AND
(uc.inter_type = 'NC' OR uc.inter_type = 'DB' OR uc.inter_type = 'CJ')
AND
(r1.name3 = 'ALA' OR r1.name3 = 'ASP' OR r1.name3 = 'ASN' OR r1.name3 = 'ARG' OR r1.name3 = 'CYS' OR r1.name3 = 'GLN'
OR r1.name3 = 'GLU' OR r1.name3 = 'GLY' OR r1.name3 = 'HIS' OR r1.name3 = 'ILE' OR r1.name3 = 'LEU'
OR r1.name3 = 'LYS' OR r1.name3 = 'MET' OR r1.name3 = 'PHE' OR r1.name3 = 'PRO' OR r1.name3 = 'SER' OR r1.name3 = 'THR'
OR r1.name3 = 'TRP' OR r1.name3 = 'TYR' OR r1.name3 = 'VAL')
AND
(r2.name3 = 'ALA' OR r2.name3 = 'ASP' OR r2.name3 = 'ASN' OR r2.name3 = 'ARG' OR r2.name3 = 'CYS' OR r2.name3 = 'GLN'
OR r2.name3 = 'GLU' OR r2.name3 = 'GLY' OR r2.name3 = 'HIS' OR r2.name3 = 'ILE' OR r2.name3 = 'LEU'
OR r2.name3 = 'LYS' OR r2.name3 = 'MET' OR r2.name3 = 'PHE' OR r2.name3 = 'PRO' OR r2.name3 = 'SER' OR r2.name3 = 'THR'
OR r2.name3 = 'TRP' OR r2.name3 = 'TYR' OR r2.name3 = 'VAL')
;
| true |
2da398087248d6ca8df551a3c48ed8c43595b4fe | SQL | lebedev-nikita/SQL_homework | /Homework/02.3-db-manipulating/4.sql | UTF-8 | 715 | 3.703125 | 4 | [] | no_license | -- Каких лекарств не хватает, где их заказать и куда везти
SELECT prov.email AS prov_email,
ds.name AS ds_name,
ds.city AS ds_city,
ds.address AS ds_address,
dc.name AS dc_name,
sc.recommended_amount - sc.current_amount AS amount_to_send
FROM stock_control sc INNER JOIN drug_class dc USING (drug_class_id)
INNER JOIN drug_store ds USING (drug_store_id)
INNER JOIN provisioner prov USING (provisioner_id)
WHERE sc.current_amount < sc.recommended_amount/2
AND drug_store_id = 1
AND request_date IS NULL
OR current_date - request_date > days_to_deliver
ORDER BY ds.drug_store_id, prov.provisioner_id
; | true |
8df9d310b1ebc4df15564b243ead5ae18bf4c4fd | SQL | wangboliang/short-url | /database/init_ddl.sql | UTF-8 | 616 | 2.984375 | 3 | [] | no_license | drop table if exists short_url;
/*==============================================================*/
/* Table: short_url */
/*==============================================================*/
create table short_url
(
id varchar(32) not null comment 'ID',
long_url varchar(512) comment '长链接',
short_url varchar(128) comment '短链接',
created_date timestamp comment '创建日期',
expires_date timestamp comment '失效日期',
primary key (id)
);
alter table short_url comment '短链表'; | true |
c08ce747bd4f2ffa230e1895da2ae9c4033737a2 | SQL | najiboulhouch/publication | /Pub.sql | UTF-8 | 14,100 | 3.140625 | 3 | [
"MIT"
] | permissive | -- phpMyAdmin SQL Dump
-- version 3.5.1
-- http://www.phpmyadmin.net
--
-- Client: localhost
-- Généré le: Lun 08 Juillet 2013 à 21:29
-- Version du serveur: 5.5.24-log
-- Version de PHP: 5.4.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 */;
--
-- Base de données: `publication`
--
CREATE DATABASE `publication` DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
USE `publication`;
-- --------------------------------------------------------
--
-- Structure de la table `commande`
--
CREATE TABLE IF NOT EXISTS `commande` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`uti_id` int(11) DEFAULT NULL,
`datecommande` date DEFAULT NULL,
`reduction` int(11) DEFAULT NULL,
`user` varchar(254) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `UNIQ_6EEAA67D3951DF75` (`uti_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=35 ;
--
-- Contenu de la table `commande`
--
INSERT INTO `commande` (`id`, `uti_id`, `datecommande`, `reduction`, `user`) VALUES
(12, 12, '2013-06-05', 25, 'najib'),
(17, 13, '2013-06-05', 60, 'najib'),
(18, 14, '2013-06-05', 40, 'najib'),
(19, 15, '2013-06-10', 25, 'admin'),
(20, 16, '2013-06-05', 75, 'latifa'),
(21, 17, '2013-06-05', 70, 'latifa'),
(22, 18, '2013-06-05', 30, 'latifa'),
(23, 19, '2013-06-05', 60, 'latifa'),
(24, 20, '2013-06-05', 50, 'latifa'),
(25, 21, '2013-06-05', 45, 'latifa'),
(26, 22, '2013-06-05', 55, 'admin'),
(27, 23, '2013-06-06', 100, 'hamid'),
(28, 24, '2013-06-06', 50, 'admin'),
(29, 25, '2013-06-09', 100, 'latifa'),
(30, 26, '2013-06-16', 100, 'admin'),
(31, 27, '2013-06-19', 50, 'latifa'),
(32, 28, '2013-06-24', 25, 'admin'),
(33, 29, '2013-06-24', 100, 'admin'),
(34, 30, '2013-06-26', 25, 'admin');
-- --------------------------------------------------------
--
-- Structure de la table `detailscommande`
--
CREATE TABLE IF NOT EXISTS `detailscommande` (
`qtecommande` int(11) DEFAULT NULL,
`commande_id` int(11) NOT NULL,
`ouvrage_id` int(11) NOT NULL,
PRIMARY KEY (`commande_id`,`ouvrage_id`),
KEY `IDX_FCF13E1182EA2E54` (`commande_id`),
KEY `IDX_FCF13E1115D884B5` (`ouvrage_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Contenu de la table `detailscommande`
--
INSERT INTO `detailscommande` (`qtecommande`, `commande_id`, `ouvrage_id`) VALUES
(6, 12, 106),
(2, 12, 108),
(2, 17, 108),
(4, 18, 107),
(6, 18, 109),
(2, 19, 112),
(2, 19, 115),
(2, 20, 108),
(2, 21, 107),
(2, 21, 109),
(2, 22, 108),
(2, 22, 109),
(12, 23, 116),
(1, 24, 107),
(3, 24, 110),
(4, 24, 111),
(14, 24, 117),
(2, 25, 108),
(3, 25, 111),
(4, 25, 112),
(2, 26, 115),
(2, 27, 113),
(2, 27, 116),
(2, 28, 113),
(2, 28, 116),
(2, 29, 106),
(3, 30, 113),
(2, 30, 116),
(3, 31, 113),
(2, 31, 122),
(1, 32, 113),
(4, 32, 120),
(1, 33, 113),
(2, 33, 116),
(1, 34, 113),
(2, 34, 120);
-- --------------------------------------------------------
--
-- Structure de la table `facture`
--
CREATE TABLE IF NOT EXISTS `facture` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`com_id` int(11) DEFAULT NULL,
`datefacture` datetime DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `com_id` (`com_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=31 ;
--
-- Contenu de la table `facture`
--
INSERT INTO `facture` (`id`, `com_id`, `datefacture`) VALUES
(12, 12, '2013-06-05 03:31:07'),
(13, 17, '2013-06-05 03:44:54'),
(14, 18, '2013-06-05 03:45:51'),
(15, 19, '2013-06-05 03:45:51'),
(16, 20, '2013-06-05 09:07:31'),
(17, 21, '2013-06-05 09:19:06'),
(18, 22, '2013-06-05 09:21:08'),
(19, 23, '2013-06-05 09:28:51'),
(20, 24, '2013-06-05 09:45:57'),
(21, 25, '2013-06-05 09:53:47'),
(22, 26, '2013-06-05 14:57:11'),
(23, 27, '2013-06-06 03:16:49'),
(24, 28, '2013-06-06 19:43:39'),
(25, 29, '2013-06-09 23:51:20'),
(26, 30, '2013-06-16 11:23:27'),
(27, 31, '2013-06-19 09:18:40'),
(28, 32, '2013-06-24 10:14:21'),
(29, 33, '2013-06-24 23:55:50'),
(30, 34, '2013-06-26 13:53:16');
-- --------------------------------------------------------
--
-- Structure de la table `flshr_user`
--
CREATE TABLE IF NOT EXISTS `flshr_user` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`username` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`username_canonical` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`email` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`email_canonical` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`enabled` tinyint(1) NOT NULL,
`salt` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`password` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`last_login` datetime DEFAULT NULL,
`locked` tinyint(1) NOT NULL,
`expired` tinyint(1) NOT NULL,
`expires_at` datetime DEFAULT NULL,
`confirmation_token` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`password_requested_at` datetime DEFAULT NULL,
`roles` longtext COLLATE utf8_unicode_ci NOT NULL COMMENT '(DC2Type:array)',
`credentials_expired` tinyint(1) NOT NULL,
`credentials_expire_at` datetime DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `UNIQ_B317D80A92FC23A8` (`username_canonical`),
UNIQUE KEY `UNIQ_B317D80AA0D96FBF` (`email_canonical`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=7 ;
--
-- Contenu de la table `flshr_user`
--
INSERT INTO `flshr_user` (`id`, `username`, `username_canonical`, `email`, `email_canonical`, `enabled`, `salt`, `password`, `last_login`, `locked`, `expired`, `expires_at`, `confirmation_token`, `password_requested_at`, `roles`, `credentials_expired`, `credentials_expire_at`) VALUES
(4, 'admin', 'admin', 'admin@gmail.Com', 'admin@gmail.com', 1, 'ejzbpviizrk800sgcgkcgo0cggoc4k8', 'HgTnRl/qfOqphHUfd9IrYje7fB2OuulCklbPZudWObkQ8ip6dIncz9iPngG9fh/+JwnrdudEGTwU+CKffKG7Zg==', '2013-06-27 09:59:05', 0, 0, NULL, NULL, NULL, 'a:1:{i:0;s:16:"ROLE_SUPER_ADMIN";}', 0, NULL),
(5, 'latifa', 'latifa', 'latifa@gmail.com', 'latifa@gmail.com', 1, 'j5rkzk4iglc04s8sw4w008okc4404cc', 'O3Vz9OqYssAeYmrN//11BGczsMxTIlUSWXLVDIeVM6qmImGem4Ih95pQdBp7kJyNrAl5g9XgknhAjSmpk14aIw==', '2013-06-27 09:48:05', 0, 0, NULL, NULL, NULL, 'a:1:{i:0;s:10:"ROLE_ADMIN";}', 0, NULL),
(6, 'hamid', 'hamid', 'hamid@gmail.com', 'hamid@gmail.com', 1, '9mn6tm9gbx0c0g0s88gs0gc4wsgg004', '1fJoiTukpMND1u/3eQEuaNciMCNFO4nVkZ2ecIu5EyjfBuDabDU2fYO5ctrhZ/WHOEq/8jVupd6Jz2skNsXtMQ==', '2013-06-06 03:15:16', 0, 0, NULL, NULL, NULL, 'a:1:{i:0;s:10:"ROLE_ADMIN";}', 0, NULL);
-- --------------------------------------------------------
--
-- Structure de la table `ouvrage`
--
CREATE TABLE IF NOT EXISTS `ouvrage` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`titre` varchar(1024) DEFAULT NULL,
`auteur` varchar(1024) DEFAULT NULL,
`editeur` varchar(1024) DEFAULT NULL,
`serie` varchar(1024) DEFAULT NULL,
`impression` varchar(254) DEFAULT NULL,
`depot_legal` varchar(1024) DEFAULT NULL,
`isbn` varchar(254) DEFAULT NULL,
`issn` varchar(254) DEFAULT NULL,
`edition` varchar(254) DEFAULT NULL,
`prix` decimal(10,0) DEFAULT NULL,
`qutestocke` int(11) DEFAULT NULL,
`photo` varchar(254) DEFAULT NULL,
`descrption` varchar(1024) DEFAULT NULL,
`dateentree` date DEFAULT NULL,
`etat` varchar(254) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=128 ;
--
-- Contenu de la table `ouvrage`
--
INSERT INTO `ouvrage` (`id`, `titre`, `auteur`, `editeur`, `serie`, `impression`, `depot_legal`, `isbn`, `issn`, `edition`, `prix`, `qutestocke`, `photo`, `descrption`, `dateentree`, `etat`) VALUES
(106, 'الفهرس العام لمجلة افاق', 'محمد يحيى', 'test', '13', 'bibliothéque nationnale', 'test', '1234', '12345', 'test', '202', 10, 'mohammed.png', 'test', '2008-01-18', 'stock'),
(107, 'مجتمع المواطنة ودول المؤسسات', 'كمال عبداللطيف', 'test', '54', 'bibliothéque nationnale', '123', '1233', '12345', 'test', '400', 5, 'test.png', 'test', '2008-01-01', 'stock'),
(108, 'من ايناون الى استانبول', 'عبد الاحد السبتي،عبد الرحيم بنحادة', 'test', '1234AAQ', 'ATN casa', '123', '123', '12345', 'test', '595', 2, 'aa.png', 'test', '2017-01-01', 'stock'),
(109, 'الرباط او الاوقات المغربية', 'الاخوان جون و جيروم طارو', 'test', '1234AAQ', 'bibliothéque nationnale', '12AQQ', '1234', '12345', 'test', '500', 2, 'aa.png', 'test', '2012-01-01', 'stock'),
(110, 'LA LANGUE BERBERE', 'ANDRE BASSET', 'test', '12', 'ATN casa', '123', '1234', '1233', 'test', '450', 3, 'aa.png', 'test', '2008-11-01', 'stock'),
(111, 'RABAT OU LES HEURES MAROCAINES', 'JERAUME ET JEAN THARAUD', 'Faculté des lettres et sciences humaines', '17', 'ATN casa', '12', '345', '356', 'test', '700', 2, 'aa.png', 'test', '2010-01-01', 'stock'),
(112, 'LA PETITE HISTOIRE DU RABAT', 'JACQUES CAILLE', 'bibliotheque nationale', '14', 'ATN casa', '123', '1234', '12345', 'test', '350', 9, 'aa.png', 'test', '2008-08-01', 'stock'),
(113, 'CONTES BERBERES DU MAROC', 'EMILELAOUST', 'bibliotheque nationale', '13', 'ATN casa', '12', '345', '12345', 'test', '700', 10, 'aa.png', 'test', '2014-01-01', 'stock'),
(114, 'RABAT ET SA REGION', 'TOME 2', 'bibliotheque nationale', '16', 'ATN casa', '12AQQ', '1234', '12345', 'test', '900', 10, 'aa.png', 'test', '2011-08-01', 'archive'),
(115, 'RABAT ET SA REGION', 'TOME 1', 'bibliotheque nationale', '15', 'ATN casa', '123', '123WAQ', '343', 'test', '500', 10, 'aa.png', 'test', '2015-01-01', 'stock'),
(116, 'REGION DES DOUKKALA', 'TOME 2', 'bibliotheque nationale', '1234AAQ', 'ATN casa', '123', '1234', '12345', 'test', '400', 10, 'aa.png', 'test', '2011-09-01', 'stock'),
(117, 'REGION DES DOUKKALA', 'TOME 1 LES DOUKKALA', 'bibliotheque nationale', '18', 'ATN casa', '12', '1234', '12345', 'test', '1000', 6, 'aa.png', 'test', '2008-01-01', 'stock'),
(118, 'قراءة في مدونات الشرق القديم و اعمال الاستاذ شحلان', 'الاستاذ شحلان', 'bibliotheque nationale', '169', 'ATN casa', '12', '1233', '12345', 'test', '600', 12, 'aa.png', 'test', '2008-09-01', 'archive'),
(119, 'VILLE ET ENVIRONNEMENT DURABLE EN AFRIQUE ET AU MOYEN-ORIENT', '??', 'Taoufik Agoumy et Mohammed Refass', '171', 'ATN casa', '123', '1234', '12345', 'test', '400', 12, 'aa.png', 'test', '2011-01-01', 'archive'),
(120, 'مدينة الرباط في القرن التاسع عشر(1818،1912', 'عبد العزيز الخمليشي', 'bibliotheque nationale', '66', 'ATN casa', '12', '1234', '12345', 'test', '780', 28, 'aa.png', 'test', '2008-01-01', 'stock'),
(121, 'السلطة العلمية و السلطة السياسيةة', 'حسن حفيظي علوي', 'bibliotheque nationale', '1234AAQ', 'ATN casa', '12AQQ', '1233', '12345', 'test', '345', 12, 'aa.png', 'test', '2008-10-01', 'stock'),
(122, 'المجاهد السلاوي محمد بن احمد العياشي', 'عبد اللطيف الشادلي', 'bibliotheque nationale', '1234AAQ', 'ATN casa', '123', '1234', '12345', 'test', '500', 10, 'aa.png', 'test', '2008-01-01', 'stock'),
(123, 'من الشاي الى الاتاي العادة و التاريخ', 'عبد الاحد السبتي،عبد الرحمان الخساسي', 'bibliotheque nationale', '1234AAQ', 'ATN casa', '12AQQ', '1234', '12345', 'test', '400', 12, 'aa.png', 'test', '2008-01-01', 'stock'),
(125, 'programmation C', 'TOME 2', 'Faculté des lettres et sciences humaines', '1234AAQ', 'ATN casa', '123', '1234', NULL, NULL, '3', 2, 'Hydrangeas.jpg', NULL, NULL, 'archive'),
(126, 'te', 'rze', 'Faculté des lettres et sciences humaines', 'zerz', 'rezer', NULL, NULL, NULL, NULL, '3', 2, NULL, NULL, NULL, 'archive'),
(127, 'aa', 'zz', 'Faculté des lettres et sciences humaines', 'zzz', 'zz', 'rr', 'rr', 'dd', 'dff', '2', 3, 'nijo.png', 'fs', '2015-08-13', 'stock');
-- --------------------------------------------------------
--
-- Structure de la table `utilisateur`
--
CREATE TABLE IF NOT EXISTS `utilisateur` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`typeutilisateur` varchar(200) DEFAULT NULL,
`email` varchar(100) DEFAULT NULL,
`cin` varchar(20) DEFAULT NULL,
`cne` varchar(20) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=31 ;
--
-- Contenu de la table `utilisateur`
--
INSERT INTO `utilisateur` (`id`, `typeutilisateur`, `email`, `cin`, `cne`) VALUES
(12, 'Etudiant interne', 'najib@hotmai.com', NULL, NULL),
(13, 'Professeur interne', 'najib@hotmai.fr', NULL, NULL),
(14, 'Etudiant interne', 'najib@hotmai.com', NULL, NULL),
(15, 'Etudiant interne', 'najib@hotmai.com', NULL, NULL),
(16, 'Etudiant interne', 'reda@hotmai.fr', NULL, NULL),
(17, 'Professeur interne', 'najib@hotmai.com', NULL, NULL),
(18, 'Professeur interne', 'reda@hotmai.fr', NULL, NULL),
(19, 'Professeur interne', 'test@gmail.com', NULL, NULL),
(20, 'Etudiant interne', 'reda@hotmai.fr', NULL, 'AZDFDGF'),
(21, 'Professeur interne', 'reda@hotmai.fr', NULL, NULL),
(22, 'Professeur interne', 'najib@hotmai.com', NULL, NULL),
(23, 'Professeur interne', 'najib@hotmai.com', NULL, NULL),
(24, 'Professeur interne', 'najib@hotmai.com', NULL, NULL),
(25, 'Professeur interne', 'najib@hotmai.com', NULL, NULL),
(26, 'Professeur interne', 'najib@hotmai.co', NULL, NULL),
(27, 'Professeur interne', 'najib@hotmai.COM', NULL, NULL),
(28, 'Professeur interne', 'najib@hotmai.com', NULL, NULL),
(29, 'Etablissement', 'najib@hotmai.com', NULL, NULL),
(30, 'Professeur interne', 'najib@hotmai.com', NULL, NULL);
--
-- Contraintes pour les tables exportées
--
--
-- Contraintes pour la table `commande`
--
ALTER TABLE `commande`
ADD CONSTRAINT `fk_commander` FOREIGN KEY (`uti_id`) REFERENCES `utilisateur` (`id`);
--
-- Contraintes pour la table `detailscommande`
--
ALTER TABLE `detailscommande`
ADD CONSTRAINT `FK_FCF13E1115D884B5` FOREIGN KEY (`ouvrage_id`) REFERENCES `ouvrage` (`id`),
ADD CONSTRAINT `FK_FCF13E1182EA2E54` FOREIGN KEY (`commande_id`) REFERENCES `commande` (`id`);
--
-- Contraintes pour la table `facture`
--
ALTER TABLE `facture`
ADD CONSTRAINT `facture_ibfk_1` FOREIGN KEY (`com_id`) REFERENCES `commande` (`id`);
/*!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 */;
| true |
fa10598af05df4e682cea8787741bab34569bbbc | SQL | prjromy/ChannakyaBase | /ChaBase/fin/Functions/FGetReportChequeBookBlocked.sql | UTF-8 | 587 | 3.140625 | 3 | [] | no_license | CREATE function [fin].[FGetReportChequeBookBlocked](@fromdate smalldatetime,@toDate smalldatetime,@branchId int=null,@iaccno int=null)
returns table as return
(
select
ad.Accno as AccountNumber,
ad.Aname as AccountName,
ah.ChkNo as ChequeNo,
ahh.Tdate,
'ChequeBlocked' as ShowWith
from fin.AChq ac
join fin.ADetail ad on ad.IAccno=ac.IAccno
join fin.AchqH ah on ah.Rno=ac.rno
join fin.AchqHH ahh on ahh.AchqHId=ah.AchqHId where ahh.Cstate in (2,4) and ahh.tdate between @fromdate and @toDate and brchid = COALESCE(@branchId,brchid) and ad.IAccno=coalesce(@iaccno,ad.iaccno)
) | true |
b15c8be010ca7822dc4fd23b5be8d0e49d862e54 | SQL | djmgeneseo/misc | /SQL/LEARNING.sql | UTF-8 | 8,967 | 3.796875 | 4 | [] | no_license | -----------------------------------------
-- setup first db
-----------------------------------------
create database mytestdb
use mytestdb
create table mytesttable (
rollno int,
firstname varchar(50),
lastname varchar(50)
)
select rollno, firstname, lastname from mytesttable
insert into mytesttable(rollno, firstname, lastname)
values(1, 'David', 'Murphy')
select rollno, firstname, lastname from mytesttable
SELECT FULLTEXTSERVICEPROPERTY('IsFullTextInstalled')
-----------------------------------------
-- ADVENTURE WORKS 2012
-----------------------------------------
use AdventureWorks2012
SELECT * FROM [HumanResources].[Department]
-- SHOW ALL DEPARTMENT NAMES
SELECT NAME FROM [HumanResources].[Department]
-- SHOW ALL GROUPS
SELECT GROUPNAME FROM [HumanResources].Department
-- SHOW ALL DISTINCT GROUPNAMES
SELECT DISTINCT GROUPNAME FROM [HumanResources].Department
-- SHOW ALL DEPARTMENT NAMES WHO ARE PART OF MANUFACTURING (not case sensitive!)
SELECT NAME, GROUPNAME FROM [HumanResources].Department
WHERE GROUPNAME LIKE 'MANUFACTURING'
-- SHOW ALL EMPLOYEES FROM THE EMPLOYEE TABLE
SELECT * FROM [HumanResources].Employee
-- SHOW LIST OF ALL EMPLOYEES WHO HAVE A ORGLEVEL = 2
SELECT * FROM [HumanResources].Employee WHERE OrganizationLevel = 2
-- SHOW LIST OF ALL EMPLOYEES WHO HAVE ORGLEVEL = 2 OR 3
SELECT * FROM [HumanResources].Employee WHERE OrganizationLevel IN (2,3)
-- SHOW LIST OF EMPLOYEES WITH TITLE FACILITIES MANAGER
SELECT * FROM [HumanResources].Employee WHERE JOBTITLE LIKE 'FACILITIES MANAGER'
-- won't work because of whitespace!
SELECT * FROM [HumanResources].Employee WHERE JOBTITLE LIKE 'FACILITIES MANAGER '
-- SHOW ALL EMPLOYEES WITH MANAGER IN TITLE (% means anything can come before if placed before string, and anything can come after if placed after)
SELECT * FROM [HumanResources].Employee WHERE JOBTITLE LIKE '%MANAGER'
-- SHOW ALL EMPLOYEES WITH CONTROL IN MIDDLE OF TITLE (% before and after means anything can come before or after)
SELECT * FROM [HumanResources].Employee WHERE JOBTITLE LIKE '%CONTROL%'
-- SHOW ALL EMPLOYEES WHO ARE BORN AFTER Jan 1, 1980
SELECT * FROM [HumanResources].Employee WHERE BirthDate > '1/1/1980'
-- SHOW ALL EMPLOYEES WHO ARE BORN BETWEEN Jan 1, 1970 and Jan 1, 1980
SELECT * FROM [HumanResources].Employee WHERE BirthDate > '1/1/1970' AND BirthDate < '1/1/1980'
-- or
SELECT * FROM [HumanResources].Employee WHERE BirthDate BETWEEN '1/1/1970' AND '1/1/1980'
-----------------------------------------
-- DEEP DIVE
-----------------------------------------
SELECT NAME, LISTPRICE FROM [Production].Product
-- ADD NEW COLLUMN THAT ADDS 10 TO VALUE OF EACH LISTPRICE COLUMN
SELECT NAME, LISTPRICE, LISTPRICE + 10 AS ADJUSTED_LIST_PRICE FROM [Production].[Product]
-- STORE THIS IN SEPARATE TABLE (permanent table)
-- INTO
SELECT NAME, LISTPRICE, LISTPRICE + 10 AS ADJUSTED_LIST_PRICE INTO [PRODUCTION].[Product_2] FROM [Production].[Product]
-- checkout new table!
SELECT * FROM [Production].Product_2
-- (temporary table; after losing connection to server, and out of the context of this query, the table will delete!)
SELECT NAME, LISTPRICE, LISTPRICE + 10 AS ADJUSTED_LIST_PRICE INTO #temptable FROM [Production].[Product]
SELECT * FROM #temptable
-- DELETE DATA FROM TABLE: delete row that has "bearing ball"
DELETE FROM Production.Product_2
WHERE NAME LIKE 'BEARING BALL'
SELECT * FROM [Production].Product_2
-- UPDATE STATEMENT
UPDATE [Production].Product_2
SET NAME = 'BLADE_NEW'
WHERE NAME LIKE 'BLADE'
SELECT * FROM [Production].[Product_2]
-----------------------------------------
-- JOINS
-----------------------------------------
-- 3 Types: Inner Join, Outer Join, Cross Join.
-- 2 different tables, the same column between both tables. There should be at least 1 match between both tables.
-- EmployeeID is common between both tables.
-- INNER JOIN ONLY JOINS ONLY COMMON ROWS!!! If one table lacks EmployeeID 3, then only EmployeeID 1 & 2 will join.
-- Left outer join: Non-matched entries from right table will have NULL. Give all rows of table 1, and all commmon rows of table 2. If you don't find a common row, then place null.
-- Right outer join: Non-matched entries from left table will have NULL
-- Full outer join:
-- Cross Join: Each row from table 1 will be joined with every row from table 2
CREATE TABLE MYEMPLOYEE (EMPLOYEEID INT, FIRSTNAME VARCHAR(20), LASTNAME VARCHAR(20))
INSERT INTO MYEMPLOYEE VALUES (1, 'Michael', 'Scott')
INSERT INTO MYEMPLOYEE VALUES (2, 'Pam', 'Beesly')
INSERT INTO MYEMPLOYEE VALUES (3, 'Dwight', 'Shrute')
SELECT * FROM MYEMPLOYEE
DELETE MYEMPLOYEE
create table MYSALARY (EMPLOYEEID INT, SALARY FLOAT)
INSERT INTO MYSALARY VALUES (1, 10000)
INSERT INTO MYSALARY VALUES (2, 8000)
INSERT INTO MYSALARY VALUES (3, 6000)
DELETE FROM MYSALARY
WHERE EMPLOYEEID = 1 AND EMPLOYEEID = 2 AND EMPLOYEEID = 3
DELETE MYSALARY
SELECT * FROM MYSALARY
SELECT * FROM MYEMPLOYEE
-- INNER JOIN
-- 'a' and 'b' are aliases
SELECT A.FIRSTNAME, A.LASTNAME, B.SALARY
FROM MYEMPLOYEE A INNER JOIN MYSALARY B ON A.EMPLOYEEID = B.EMPLOYEEID
-- OUTER JOIN
-- LEFT OUTER JOIN: right-table should have null where column values are missing
CREATE TABLE MYPHONE (EMPLOYEEID INT, PHONENUMBER INT)
INSERT INTO MYPHONE VALUES (1, 1211123342)
INSERT INTO MYPHONE VALUES (2, 1111111111)
SELECT * FROM MYEMPLOYEE
SELECT * FROM MYPHONE
SELECT A.FIRSTNAME, A.LASTNAME, B.PHONENUMBER FROM MYEMPLOYEE A LEFT JOIN MYPHONE B
ON A.EMPLOYEEID = B.EMPLOYEEID
-- RIGHT OUTER JOIN: Left table should have nulls
CREATE TABLE MYPARKING (EMPLOYEEID INT, PARKINGSPOT VARCHAR(20))
INSERT INTO MYPARKING VALUES (1, 'a1')
INSERT INTO MYPARKING VALUES (2, 'a2')
SELECT * FROM MYPARKING
SELECT * FROM MYEMPLOYEE
SELECT A.PARKINGSPOT, B.FIRSTNAME, B.LASTNAME FROM MYPARKING A RIGHT JOIN MYEMPLOYEE B
ON A.EMPLOYEEID = B.EMPLOYEEID
-- FULL OUTER JOIN
CREATE TABLE MYCUSTOMER (CUSTOMERID INT, CUSTOMERNAME VARCHAR(20))
INSERT INTO MYCUSTOMER VALUES (1, 'RAKESH')
INSERT INTO MYCUSTOMER VALUES (2, 'DAVID')
CREATE TABLE MYORDER (ORDERNUMBER INT, ORDERNAME VARCHAR(20), CUSTOMERID INT)
INSERT INTO MYORDER VALUES (1, 'SOMEORDER1', 1)
INSERT INTO MYORDER VALUES (2, 'SOMEORDER2', 2)
INSERT INTO MYORDER VALUES (3, 'SOMEORDER3', 7)
INSERT INTO MYORDER VALUES (4, 'SOMEORDER4', 8)
SELECT * FROM MYCUSTOMER
SELECT * FROM MYORDER
SELECT A.CUSTOMERID, A.CUSTOMERNAME, B.ORDERNUMBER, B.ORDERNAME
FROM MYORDER B FULL OUTER JOIN MYCUSTOMER A
ON A.CUSTOMERID = B.CUSTOMERID
-- CROSS JOIN:
SELECT * FROM MYCUSTOMER
SELECT * FROM MYSALARY
SELECT * FROM MYCUSTOMER CROSS JOIN MYSALARY
-- SELECT * FROM MYCUSTOMER, MYSALARY
---------------------------------------------
-- GET DATE
SELECT GETDATE()
SELECT GETDATE() -2
-- DATEPART
SELECT DATEPART(yyyy, GETDATE())
SELECT DATEPART(yyyy, GETDATE()) AS YEARNUMBER
SELECT DATEPART(mm, GETDATE())
SELECT DATEPART(dd, GETDATE())
-- DATEADD
SELECT DATEADD(day, 4, GETDATE())
SELECT DATEADD(day, 4, '7/4/2015')
SELECT DATEADD(month, 4, GETDATE())
--
SELECT TOP 10 * FROM [Production].[WorkOrder]
SELECT WORKORDERID, PRODUCTID, STARTDATE, ENDDATE, DATEDIFF(DAY, STARTDATE, ENDDATE) AS DIFFERENCEINDAYS
FROM [Production].[WorkOrder]
SELECT DATEPART(DAY, GETDATE())
SELECT DATEPART(DAY, GETDATE()-1)
-- add +day part of today's date -1 (if day = 11, add 10)
SELECT DATEADD(dd, (DATEPART(DAY, GETDATE())-1), GETDATE())
-- subtract day part of today's date -1 (if day = 11, subtract 10)
SELECT DATEADD(dd, -(DATEPART(DAY, GETDATE())-1), GETDATE())
--------------------------
-- AGGREGATE FUNCITONS
-- MYSALARY
SELECT * FROM MYSALARY
SELECT AVG(SALARY) FROM MYSALARY
SELECT COUNT (SALARY) FROM MYSALARY
SELECT COUNT(*) FROM MYSALARY
SELECT MIN(SALARY) FROM MYSALARY
SELECT MAX(SALARY) FROM MYSALARY
-- MYORDER
SELECT * FROM MYORDER
-- CONCAT
print CONCAT('String 1', ' String 2')
SELECT ORDERNUMBER, ORDERNAME, CONCAT(ORDERNAME, ' ', ORDERNAME, RAND()) AS CONCATENATEDTEXT
FROM MYORDER
-- SELECT FIRST 5 CHARACTERS FROM ORDERNAME
SELECT ORDERNUMBER, ORDERNAME, LEFT(ORDERNAME, 5) AS FIRST_5_CHARS FROM MYORDER
-- RIGHT
SELECT ORDERNUMBER, ORDERNAME, RIGHT(ORDERNAME, 5) AS LAST_5_CHARS FROM MYORDER
-- SUBSTRING
SELECT ORDERNUMBER, ORDERNAME, SUBSTRING(ORDERNAME, 3, 5) AS MIDDLE_CHARS FROM MYORDER
-- LOWERCASE
SELECT ORDERNUMBER, ORDERNAME, LOWER(ORDERNAME) AS LOWERCASE FROM MYORDER
-- UPPERCASE
SELECT ORDERNUMBER, ORDERNAME, UPPER(ORDERNAME) AS UPPERCASE FROM MYORDER
-- LENGTH
SELECT ORDERNUMBER, ORDERNAME, LEN(ORDERNAME) STRING_LENGTH FROM MYORDER
-- First upper, rest lower
SELECT ORDERNAME, ORDERNUMBER, CONCAT(UPPER(LEFT(ORDERNAME, 1)), LOWER(SUBSTRING(ORDERNAME, 2, LEN(ORDERNAME)))) AS FIRST_UPPER_REST_LOWER FROM MYORDER
-- TRIM
SELECT ' Mytext '
SELECT LEN(' Mytext ')
-- LTRIM - removes spaces from the left side of text
SELECT LTRIM(' Mytext ')
-- RTRIM
SELECT RTRIM(' Mytext ')
-- BOTH
SELECT LTRIM(RTRIM(' Mytext ')) | true |
70cbbba04683c1d614df2c5db21c316117c0d363 | SQL | chen358805035/python | /webapp/awesome-python3-webapp/www/schema.sql | UTF-8 | 1,206 | 3.78125 | 4 | [] | no_license |
drop database if exists awesome;
create database awesome;
use awesome;
grant select, insert, update, delete on awesome.* to 'www-data'@'localhost' identified by 'www-data';
create table users(
id varchar(50) not null,
email varchar(50) not null,
passwd varchar(50) not null,
admin varchar(50) not null,
name varchar(50) not null,
image varchar(500) not null,
created_at real not null,
unique key idx_email (email),
key idx_created_at (created_at),
primary key (id)
)engine = innodb default charset = utf8;
create table blogs(
id varchar(50) not null,
user_id varchar(50) not null,
user_name varchar(50) not null,
user_image varchar(500) not null,
name varchar(50) not null,
summary varchar(200) not null,
content mediumtext not null,
created_at real not null,
key idx_created_at (created_at),
primary key (id)
)engine = innodb default charset = utf8;
create table comments(
id varchar(50) not null,
blog_id varchar(50) not null,
user_id varchar(50) not null,
user_name varchar(50) not null,
user_image varchar(500) not null,
content mediumtext not null,
created_at real not null,
key idx_created_at (created_at),
primary key(id)
)engine = innodb default charset = utf8; | true |
c6a90a614dd64cd8992cbd4964d9d934a6d5d462 | SQL | gmartinezramirez-old/Distributed-DB-Hash-Table | /db1_hotelmascota.sql | UTF-8 | 675 | 2.65625 | 3 | [
"MIT"
] | permissive |
CREATE DATABASE db1_hotelmascota;
USE db1_hotelmascota;
CREATE TABLE mascota_db1 (
mascota_id INT NOT NULL AUTO_INCREMENT,
mascota_nombre VARCHAR(100) NOT NULL,
mascota_nombrePropietario VARCHAR(40) NOT NULL,
mascota_rutPropietario VARCHAR(40) NOT NULL,
mascota_fechaIngreso DATE,
mascota_fechaRetiro DATE,
mascota_edad INT NOT NULL,
mascota_tipo VARCHAR(100) NOT NULL,
PRIMARY KEY ( mascota_id )
);
INSERT INTO mascota_db1 (mascota_nombre, mascota_nombrePropietario, mascota_rutPropietario, mascota_fechaIngreso, mascota_fechaRetiro, mascota_edad, mascota_tipo)
VALUES ('negro_db1','john','18045598-0','2015-08-01','2015-08-10', 15, 'gato'); | true |
3812f1592ba9925440c7f566b62d8199b10b7d22 | SQL | silence-do-good/stress-test-Postgres-and-MySQL | /dump/high/day09/select1410.sql | UTF-8 | 178 | 2.625 | 3 | [] | no_license |
SELECT timeStamp, temperature FROM ThermometerOBSERVATION o
WHERE timestamp>'2017-11-08T14:10:00Z' AND timestamp<'2017-11-09T14:10:00Z' AND temperature>=46 AND temperature<=83
| true |
d5b55eb7859d940c0bc38ebabf8006f868ae1da1 | SQL | Caucorico/ESIPE | /BDD/TP-06/Exercice-02/requetes.sql | UTF-8 | 1,321 | 4.0625 | 4 | [
"MIT"
] | permissive | -- La liste des identifiants et noms de magasins qui ne vendent pas de bureaux.
SELECT *
FROM magasin
WHERE idmag NOT IN (
SELECT idmag
FROM magasin
INNER JOIN stocke
USING(idmag)
INNER JOIN produit
USING(idpro)
WHERE produit.libelle = 'bureau'
);
-- La liste des magasins dont tous les produits sont à moins de 100 euros.
SELECT *
FROM magasin
WHERE 100 > (
SELECT MAX(stocke.prixunit)
FROM stocke
WHERE stocke.idmag = magasin.idmag
GROUP BY idmag
);
-- La liste des produits qu’aucun client n’a acheté.
SELECT *
FROM produit
WHERE idpro NOT IN (
SELECT DISTINCT idpro
FROM produit
INNER JOIN contient
USING(idpro)
);
-- La liste des identifiants et libellés de produits qui ont été vendus au moins 40% plus cher que leur prix moyen sur le marché.
SELECT produit.idpro, produit.libelle
FROM produit
INNER JOIN contient
USING(idpro)
WHERE contient.prixunit > 1.4*(
SELECT AVG(stocke.prixunit)
FROM stocke
WHERE stocke.idpro = produit.idpro
);
-- La liste des noms et prénoms de clients qui ont acheté un produit au moins 20 euros plus cher que son prix moyen, avec les libellés des produits en question.
SELECT client.nom, client.prenom
FROM client
WHERE client.numcli IN (
SELECT client.numcli
FROM client
INNER JOIN facture
USING(numcli)
INNER JOIN contient
USING(numfac)
) | true |
8386736b5c39b8d5333c0d307f4b71b879623aef | SQL | gdg-work/SkillFactory__SDA6__Case_A10 | /SQL_Snippets/rus_buyers.sql | UTF-8 | 848 | 3.921875 | 4 | [] | no_license | create view c10_total_conversion_by_cohort as
with
transactions_by_cohort as (
select
date_trunc('month', u.created_at)::date as cohort,
count(distinct c.user_id) as buyers,
count(purchased_at) as transactions
from
case10.carts as c
join case10.users as u on c.user_id = u.id
join c10_russian_users_ids as rui on c.user_id = rui.uid
where c.state = 'successful'
group by cohort
),
conversion_by_cohort as (
select
cohort,
uc.count as registered_users,
buyers,
transactions,
round(buyers*1.0/uc.count,3) as conversion,
round(transactions*1.0/buyers,3) as apc
from
transactions_by_cohort as tbc
join case10.users_count_by_cohort as uc using (cohort)
)
select sum(buyers) from conversion_by_cohort;
| true |
23e7fa68c02458b33e37763751f3cc177c938bcb | SQL | nishantmunjal/onlantest | /onlanfet_db.sql | UTF-8 | 29,938 | 3.015625 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 4.0.4
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Apr 15, 2014 at 08:44 PM
-- Server version: 5.6.12-log
-- PHP Version: 5.4.12
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: `onlanfet_db`
--
CREATE DATABASE IF NOT EXISTS `onlanfet_db` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;
USE `onlanfet_db`;
-- --------------------------------------------------------
--
-- Table structure for table `adminlogin_tbl`
--
CREATE TABLE IF NOT EXISTS `adminlogin_tbl` (
`sid` int(11) NOT NULL AUTO_INCREMENT,
`user` varchar(30) NOT NULL DEFAULT 'fetalok',
`password1` varchar(30) NOT NULL DEFAULT 'fetalok2013',
PRIMARY KEY (`sid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;
--
-- Dumping data for table `adminlogin_tbl`
--
INSERT INTO `adminlogin_tbl` (`sid`, `user`, `password1`) VALUES
(1, 'admin', 'admin'),
(2, 'fet', 'fet');
-- --------------------------------------------------------
--
-- Table structure for table `registration_tbl`
--
CREATE TABLE IF NOT EXISTS `registration_tbl` (
`sid` int(100) NOT NULL AUTO_INCREMENT,
`sname` varchar(80) NOT NULL,
`branch` varchar(5) NOT NULL,
`year` int(2) NOT NULL,
`roll` int(100) NOT NULL,
`user` varchar(20) NOT NULL,
`password1` varchar(20) NOT NULL,
`password2` varchar(20) NOT NULL,
`createddate` date NOT NULL,
`createdtime` time NOT NULL,
`isdeleted` tinyint(1) NOT NULL DEFAULT '1',
`is_login` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`sid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=162 ;
--
-- Dumping data for table `registration_tbl`
--
INSERT INTO `registration_tbl` (`sid`, `sname`, `branch`, `year`, `roll`, `user`, `password1`, `password2`, `createddate`, `createdtime`, `isdeleted`, `is_login`) VALUES
(1, 'Ashutosh kumar', 'ECE', 1, 13, 'ashutosh', 'ashu321', '', '2013-09-23', '15:55:38', 1, 0),
(2, 'AMIT KUMAR SINGH KUSHWAHA', 'ECE', 1, 8, 'AMIT KUSHWAHA', 'AKSKKS', '', '2013-09-23', '15:55:42', 1, 0),
(3, 'AMAN JOHARI', 'ECE', 1, 7, 'amanjohari', 'neemkaroriji', '', '2013-09-23', '15:55:44', 1, 0),
(4, 'ashwani yadav', 'ECE', 1, 14, 'ashwani yadav', '9648920934', '', '2013-09-23', '15:55:46', 1, 0),
(5, 'gautam bhagat', 'ECE', 1, 28, 'gautambhagat', '9469647948', '', '2013-09-23', '15:55:50', 1, 0),
(6, 'A V Y K KAUSHIK', 'ECE', 1, 1, 'A V Y K KAUSHIK', 'kau2605@', '', '2013-09-23', '15:55:52', 1, 0),
(7, 'jai chaturvedi', 'ECE', 1, 31, 'jai chaturvedi', 'rudramadhu', '', '2013-09-23', '15:55:59', 1, 0),
(8, 'ankul jain', 'ECE', 1, 10, 'ankul', '1201hanu1994', '', '2013-09-23', '15:56:04', 1, 0),
(9, 'M.Srinivasnaik', 'ECE', 1, 36, 'srinivasnaik', 'srinu', '', '2013-09-23', '15:56:10', 1, 0),
(10, 'sonu kumar patel', 'ECE', 3, 80, 'sp singh', '9135700465', '', '2013-09-23', '15:56:15', 1, 0),
(11, 'Shivam Rathaur', 'EEE', 1, 80, 'shivam', 'shirathore', '', '2013-09-23', '15:56:34', 1, 0),
(12, 'RAMAVATH AKHIL', 'ECE', 1, 59, 'akhil', 'akh1996@', '', '2013-09-23', '15:56:46', 1, 0),
(13, 'CHANDRAHASA KUMAR', 'ECE', 1, 18, 'KRISHNA', '8521637151', '', '2013-09-23', '15:57:19', 1, 0),
(14, 'Vishal Antony', 'ECE', 1, 91, 'Vishal Antony', 'jenubled', '', '2013-09-23', '15:57:22', 1, 0),
(15, 'Ravi kushwaha', 'ECE', 1, 61, 'Ravikushwaha', '9335330488', '', '2013-09-23', '15:57:31', 1, 0),
(16, 'vivek kumar singh', 'EEE', 1, 91, 'vivek singh', '9695158306', '', '2013-09-23', '15:57:45', 1, 0),
(17, 'saurabh kumar gupta', 'ECE', 1, 70, 'saurabhkumargupta', '7275964959', '', '2013-09-23', '15:58:10', 1, 0),
(18, 'VIKAL CHANDRA', 'ECE', 1, 86, 'vikal chandra', '54321896', '', '2013-09-23', '15:58:44', 1, 0),
(19, 'MEDESI SRAVAN SARAN MANIKANTA', 'ECE', 1, 41, 'sravanmanikanta93', 'sravan17121993', '', '2013-09-23', '15:59:05', 1, 0),
(20, 'SHUBHAM KUMAR SINGH', 'ECE', 1, 75, 'SHUBHAM KUMAR SINGH', '9126445059', '', '2013-09-23', '15:59:05', 1, 0),
(22, 'sarvjeet kumar jha', 'ECE', 1, 68, 'sarvjeetgod', 'mahishanu', '', '2013-09-23', '15:59:21', 1, 0),
(23, 'karan bauskar', 'ECE', 1, 32, 'karan bauskar', 'priya', '', '2013-09-23', '15:59:21', 1, 0),
(24, 'sagar goel', 'ECE', 1, 65, 'sagargoel', '8430487550', '', '2013-09-23', '15:59:24', 1, 0),
(25, 'gaadari kalyan', 'ECE', 1, 25, 'gaadarikalyan522@gma', '123', '', '2013-09-23', '16:03:50', 1, 0),
(26, 'MADAN MOHAN SARKAR', 'ECE', 1, 37, 'MAHI.W.B.', 'MAHI.W.B.', '', '2013-09-23', '16:05:48', 1, 0),
(27, 'kalyan', 'ECE', 1, 25, 'kalyan', '123', '', '2013-09-23', '16:05:56', 1, 0),
(31, 'pushpendra kumar', 'EEE', 1, 56, 'pushpendra kumar', 'shivdayal', '', '2013-09-24', '16:08:15', 1, 0),
(32, 'rahul kumar paswan', 'EEE', 1, 57, 'rahul', 'shanti', '', '2013-09-24', '16:09:26', 1, 0),
(33, 'Deepak kumar', 'EEE', 1, 25, 'deepak', '8859384621', '', '2013-09-24', '16:11:02', 1, 0),
(34, 'pawan singh', 'EEE', 1, 52, 'pawan', '9045373827', '', '2013-09-24', '16:11:16', 1, 0),
(35, 'omhari rajput', 'EEE', 1, 50, 'omharirajput', '9718939540', '', '2013-09-24', '16:11:33', 1, 0),
(36, 'AMIT KUMAR', 'EEE', 1, 9, 'AMIT KUMAR', 'AMIT KUMAR', '', '2013-09-24', '16:11:43', 1, 0),
(37, 'ANUP KUMAR', 'EEE', 1, 16, 'ANUP KUMAR', 'ANUP3587', '', '2013-09-24', '16:11:53', 1, 0),
(38, 'DINESH KUMAR SINGAR', 'EEE', 1, 28, 'DINESH KUMAR SINGAR', '12083594', '', '2013-09-24', '16:12:02', 1, 0),
(39, 'vivek kumar singh', 'EEE', 1, 91, 'vivek kumar singh', '9695158306', '', '2013-09-24', '16:12:18', 1, 0),
(40, 'abhishek raj', 'EEE', 1, 2, 'abhishek2095', 'ab.20.95', '', '2013-09-24', '16:12:33', 1, 0),
(41, 'Akshay kumar', 'EEE', 1, 7, 'Akshay kumar', '12345', '', '2013-09-24', '16:12:34', 1, 0),
(42, 'anurag jaiswal', 'EEE', 1, 18, 'kinganurag786', 'kinganu..', '', '2013-09-24', '16:12:37', 1, 0),
(43, 'Roshan kumar sahani', 'EEE', 1, 69, 'roshan kumar sahani', '8051306510', '', '2013-09-24', '16:12:51', 1, 0),
(44, 'vishwajeet kumar', 'EEE', 1, 89, 'vishwajeet_kumar', '143puja', '', '2013-09-24', '16:12:53', 1, 0),
(45, 'ABHISHEK SHARMA', 'EEE', 1, 3, 'BRILLIANT ABHISHEK', 'ILOVEMYINDIA', '', '2013-09-24', '16:12:59', 1, 0),
(46, 'pushpendra kumar', 'EEE', 1, 56, 'pushpendra kumar', 'shivdayal', '', '2013-09-24', '16:13:01', 1, 0),
(47, 'pawan singh', 'EEE', 1, 52, 'pawan singh', '9045373827', '', '2013-09-24', '16:13:05', 1, 0),
(48, 'pankaj dixit', 'EEE', 1, 51, 'pankaj dixit', 'gkv_2013', '', '2013-09-24', '16:13:11', 1, 0),
(49, 'vishal verma', 'EEE', 1, 88, 'vishalverma', 'shganesh', '', '2013-09-24', '16:13:21', 1, 0),
(50, 'shatrughn kumar kushwaha', 'EEE', 1, 79, 'shatrughn', 'passward', '', '2013-09-24', '16:13:37', 1, 0),
(51, 'rakesh chaudhari', 'EEE', 1, 60, 'rakesh chaudhari', '9628990590', '', '2013-09-24', '16:14:04', 1, 0),
(52, 'KUNDAN KUMAR', 'EEE', 1, 38, 'kundan', '12345', '', '2013-09-24', '16:15:15', 1, 0),
(53, 'anurag yadav', 'EEE', 1, 19, 'anurag yadav', 'anurag', '', '2013-09-24', '16:15:40', 1, 0),
(54, 'Gaurav rathore', 'EEE', 1, 31, 'gauravrathore095@gma', 'ashi', '', '2013-09-24', '16:15:43', 1, 0),
(55, 'SHUBHAM RAJ', 'EEE', 1, 83, 'shubhamraj', 'fet214', '', '2013-09-24', '16:16:02', 1, 0),
(56, 'govind kumar', 'EEE', 1, 32, 'govind', '251311', '', '2013-09-24', '16:17:20', 1, 0),
(57, 'Gaurav rathore', 'EEE', 1, 31, 'Gaurav rathore', 'ashi', '', '2013-09-24', '16:18:11', 1, 0),
(59, 'Avinash Tripathi', 'ME', 1, 24, 'avinashtripathi', 'chachaji', '', '2013-09-25', '15:55:56', 1, 0),
(60, 'AKSHAY GOEL', 'ME', 1, 12, 'akshay', 'akshaygoel', '', '2013-09-25', '15:56:44', 1, 0),
(61, 'ABHISHEK ANAND', 'ME', 1, 3, 'abhishek', '7641379447', '', '2013-09-25', '15:56:53', 1, 0),
(62, 'ASHISH ROY', 'EEE', 1, 18, 'ashish_roy', 'awq6189', '', '2013-09-25', '15:56:54', 1, 0),
(63, 'Abhishek Verma', 'ME', 1, 6, 'abhishek', '87436058', '', '2013-09-25', '15:57:22', 1, 0),
(64, 'Anurag', 'ME', 1, 17, 'Anurag', 'babu123', '', '2013-09-25', '15:57:25', 1, 0),
(65, 'ajit amar harijan', 'ME', 1, 9, 'ajit', '9879662213', '', '2013-09-25', '15:57:34', 1, 0),
(66, 'AMRENDRA KUMAR', 'ME', 1, 13, 'amrendra', 'myfamily', '', '2013-09-25', '15:57:39', 1, 0),
(67, 'ABHIJIT KUMAR', 'ME', 1, 1, 'abhijit', '9012094709', '', '2013-09-25', '15:58:26', 1, 0),
(68, 'AKHILESH YADAV', 'ME', 1, 11, 'akhilaryan', 'jhonsmith257250', '', '2013-09-25', '15:59:05', 1, 0),
(69, 'FAIZ ALI', 'ME', 1, 30, 'FAIZI', '9012047165', '', '2013-09-25', '15:59:59', 1, 0),
(70, 'Akash Gautam', 'ME', 1, 10, 'fltltakash', 'fltltakash', '', '2013-09-25', '16:00:02', 1, 0),
(71, 'ashvanee rajput', 'ME', 1, 19, 'ashvanee rajput', 'ashu94124522', '', '2013-09-25', '16:00:19', 1, 0),
(72, 'Abhishek Misra', 'ME', 1, 5, 'abk', 'abkrulez', '', '2013-09-25', '16:00:41', 1, 0),
(73, 'Abhinav pateria', 'ME', 1, 2, 'sibbu0101', 'abhinav@0101', '', '2013-09-25', '16:01:19', 1, 0),
(74, 'durgesh mishra', 'ME', 1, 29, 'durgesh', '123', '', '2013-09-25', '16:01:36', 1, 0),
(76, 'SUMIT KUMAR', 'ME', 1, 84, 'S.K.', '7828850555922', '', '2013-09-25', '16:02:59', 1, 0),
(77, 'Saurabh Suman ', 'ME', 1, 75, 'saurabhsuman', '2087', '', '2013-09-25', '16:03:04', 1, 0),
(78, 'vishal rawat', 'ME', 1, 91, 'vishal', 'taru8005', '', '2013-09-25', '16:03:35', 1, 0),
(79, 'Saurabh Suman ', 'ME', 1, 75, 'saurabh suman', '2087', '', '2013-09-25', '16:03:39', 1, 0),
(80, 'shashi kumar', 'ME', 1, 76, 'imshashi', 'itsfakeworld', '', '2013-09-25', '16:03:56', 1, 0),
(81, 'vipul verma', 'ME', 1, 90, 'vipulverma@283', 'shrutivipul', '', '2013-09-25', '16:04:08', 1, 0),
(82, 'atul kumar', 'ME', 1, 22, 'atul kumar', '1234', '', '2013-09-25', '16:06:02', 1, 0),
(84, 'Gajendra Patidar', 'ME', 1, 31, 'gajendra_patidar', 'patidar', '', '2013-09-25', '16:07:00', 1, 0),
(85, 'RUPESH PRAJAPATI', 'ME', 1, 68, 'RUPESH', '1234', '', '2013-09-25', '16:09:01', 1, 0),
(86, 'SHIVBRAT', 'ME', 1, 78, 'SHIVBRAT', 'DHARMBRAT', '', '2013-09-25', '16:11:23', 1, 0),
(87, 'Anshuman', 'ME', 1, 16, 'anshuman', '12345', '', '2013-09-25', '16:18:57', 1, 0),
(88, 'Sanjeeb kumar gouda', 'ME', 1, 72, 'sanjeeb72', 'fetgkv215', '', '2013-09-25', '16:19:34', 1, 0),
(89, 'Utkarsh Choudhary', 'ME', 1, 86, 'Utkarsh86', 'Choudhary86', '', '2013-09-25', '16:19:43', 1, 0),
(90, 'ankit meena', 'ME', 1, 15, 'ankit meena15', '20502050', '', '2013-09-25', '16:19:45', 1, 0),
(91, 'SANWARIYA LAL MEENA', 'ME', 1, 73, 'MONIKA MEENA', 'MONIKA', '', '2013-09-25', '16:20:14', 1, 0),
(92, 'Aniruddh Maurya', 'ME', 1, 14, 'Aniruddh', 'ANI800', '', '2013-09-25', '16:20:17', 1, 0),
(93, 'TEJ PRAKASH', 'ME', 1, 85, 'tejprakash', 'bareilly', '', '2013-09-25', '16:20:31', 1, 0),
(94, 'dilip yadav', 'CSE', 1, 26, 'dilipyadav', 'dilipyadav1994', '', '2013-09-30', '15:08:24', 1, 0),
(95, 'dilip yadav', 'CSE', 1, 26, 'dilipyadav', 'dilipyadav1994', '', '2013-09-30', '15:17:07', 1, 0),
(96, 'dilip yadav', 'CSE', 1, 26, 'dilipyadav', 'dilipyadav1994', '', '2013-09-30', '15:17:09', 1, 0),
(97, 'dilip yadav', 'CSE', 1, 26, 'dilipyadav', 'dilipyadav1994', '', '2013-09-30', '15:17:09', 1, 0),
(99, 'dilip yadav', 'CSE', 1, 26, 'dilipyadav', 'dilipyadav1994', '', '2013-09-30', '15:17:10', 1, 0),
(101, 'sajjan kumar yadav', 'ECE', 2, 63, 'sajjan', '9760588216', '', '2013-09-30', '15:42:30', 1, 0),
(102, 's.mourya', 'CSE', 1, 65, 'mouryas20', '9012095827', '', '2013-09-30', '15:43:49', 1, 0),
(103, 'SAURAV KUMAR', 'CSE', 1, 72, 'SAURAV', '9761654102', '', '2013-09-30', '15:44:35', 1, 0),
(104, 'PRATEEK CHANDRA', 'CSE', 1, 53, 'prateek', 'chandraprateek', '', '2013-09-30', '15:44:48', 1, 0),
(105, 'sandeep singh', 'CSE', 1, 67, 'sandeep', 'shashank', '', '2013-09-30', '15:44:50', 1, 0),
(106, 'Rakesh Singh Rawat', 'CSE', 1, 60, 'rakesh', '9915544851convoy', '', '2013-09-30', '15:44:52', 1, 0),
(107, 'Himanshu Gupta', 'CSE', 1, 33, 'Himanshu', 'quiz13', '', '2013-09-30', '15:45:02', 1, 0),
(108, 'NITESH KUMAR RAI', 'CSE', 1, 49, 'NITESH', '@lovekushINDIA#', '', '2013-09-30', '15:45:12', 1, 0),
(109, 'SAURABH CHAUHAN', 'CSE', 1, 70, 'saurabh', '18@$unny', '', '2013-09-30', '15:45:12', 1, 0),
(110, 'Rakesh Singh Rawat', 'CSE', 1, 60, 'rakesh', '9915544851', '', '2013-09-30', '15:45:29', 1, 0),
(111, 'vikram singh', 'CSE', 1, 86, 'vikram', 'viknit', '', '2013-09-30', '15:46:22', 1, 0),
(112, 'Nitesh', 'CSE', 1, 48, 'niteshkumar', 'avadhesh', '', '2013-09-30', '15:46:27', 1, 0),
(113, 'SHANTIBHUSHAN', 'ECE', 2, 69, 'bhushan', '12345', '', '2013-09-30', '15:46:31', 1, 0),
(114, 'Shubhajyoti Das', 'CSE', 1, 74, 'Shubhajyoti', 'tukai', '', '2013-09-30', '15:47:04', 1, 0),
(115, 'VIPUL CHANDRA', 'CSE', 1, 87, 'VIPUL', '93149009081', '', '2013-09-30', '15:47:43', 1, 0),
(116, 'pulkit agarwal', 'CSE', 1, 54, 'pulkitgarg', '15091994pU@', '', '2013-09-30', '15:47:49', 1, 0),
(117, 'Shubham Verma', 'CSE', 1, 77, 'Vshubham8', '8bigbang', '', '2013-09-30', '15:47:58', 1, 0),
(118, 'shubham tulasyan', 'CSE', 1, 76, 'shubhamtulasyan', 'khadda', '', '2013-09-30', '15:48:02', 1, 0),
(119, 'satyam', 'CSE', 1, 69, 'satyam', '02021994', '', '2013-09-30', '15:48:35', 1, 0),
(120, 'SHUBHAM GUPTA', 'CSE', 1, 75, 'guptshubham', 'Shiv1996$', '', '2013-09-30', '15:49:01', 1, 0),
(121, 'jitendra kumar', 'CSE', 1, 36, 'jitendra', 'jitendra', '', '2013-09-30', '15:49:13', 1, 0),
(122, 'SUNIL KUMAR KAUSHIK', 'CSE', 1, 79, 'sk858671@gmail.com', '8385913608', '', '2013-09-30', '15:50:01', 1, 0),
(123, 'RISHABH KUMAR JAIN', 'CSE', 1, 63, 'rjrishabh34', '8791793385', '', '2013-09-30', '15:50:14', 1, 0),
(124, 'Tapan Kumar Soren', 'CSE', 1, 81, 'tpnsoren405', '9861297181', '', '2013-09-30', '15:51:39', 1, 0),
(125, 'PRAKHAR SAXENA', 'CSE', 1, 52, 'prakhar', '2610', '', '2013-09-30', '15:51:47', 1, 0),
(126, 'virendra kumawat', 'CSE', 1, 88, 'virendra', 'sakshiveeru', '', '2013-09-30', '15:52:08', 1, 0),
(127, 'Tirunagari charan', 'CSE', 1, 82, 'tirunagaricharan', 'killmebeauty', '', '2013-09-30', '15:55:28', 1, 0),
(128, 'sajal gupta', 'CSE', 1, 66, 'sajalgupta', 'saj1995', '', '2013-09-30', '15:58:50', 1, 0),
(129, 'rishabh tiwari', 'CSE', 1, 64, 'rishabh', 'mathurawasi', '', '2013-09-30', '15:59:12', 1, 0),
(130, 'mukesh kumar', 'CSE', 1, 41, 'mukesh kumar', 'mukesh', '', '2013-09-30', '16:00:04', 1, 0),
(131, 'Sundarlal Baror', 'CSE', 1, 78, 'sundarlal78', 'Nirmalbaba', '', '2013-09-30', '16:00:34', 1, 0),
(132, 'rahul kumar soni', 'CSE', 1, 56, 'rahul786', 'rahulsoni', '', '2013-09-30', '16:02:08', 1, 0),
(133, 'omprakash bhakar', 'CSE', 1, 50, 'omprakash', '9012093525', '', '2013-09-30', '16:04:30', 1, 0),
(134, 'Abhishek Gupta', 'CSE', 1, 4, 'Abhishek', 'gupta', '', '2013-09-30', '16:10:57', 1, 0),
(135, 'Altamash Khan', 'CSE', 1, 11, 'altamash296', 'iamwaiting', '', '2013-09-30', '16:11:48', 1, 0),
(136, 'GAURAV SHUKLA', 'CSE', 1, 29, 'gaurav', 'gaurav515', '', '2013-09-30', '16:12:41', 1, 0),
(137, 'Ankush Lakhmani', 'CSE', 1, 16, 'Ankush Lakhmani', '9044664478', '', '2013-09-30', '16:12:53', 1, 0),
(138, 'dheeraj kumar ramotra', 'CSE', 1, 25, 'dheeraj', '12345', '', '2013-09-30', '16:13:32', 1, 0),
(139, 'Abhishek kumar', 'CSE', 1, 5, 'abhi26kumar', '9012046901', '', '2013-09-30', '16:14:08', 1, 0),
(140, 'anoop patel', 'CSE', 1, 17, 'anoop patel', '123', '', '2013-09-30', '16:15:27', 1, 0),
(141, 'DEEPANSHU RAJ', 'CSE', 1, 22, 'drajranu@gmail.com', 'deepanshuchi', '', '2013-09-30', '16:16:47', 1, 0),
(142, 'anooppatel', 'CSE', 1, 17, 'anoop patel', '123', '', '2013-09-30', '16:17:21', 1, 0),
(143, 'ADITYA KUMAR', 'CSE', 1, 9, 'Aditya', 'bittooboss', '', '2013-09-30', '16:17:42', 1, 0),
(144, 'deepchand chauhan', 'CSE', 1, 23, 'deepchand', '1246', '', '2013-09-30', '16:18:11', 1, 0),
(145, 'anoop patel', 'CSE', 1, 17, 'anooppatel', '123', '', '2013-09-30', '16:19:04', 1, 0),
(146, 'abhishek sahu', 'CSE', 1, 7, 'itsmesahuabhishek@gm', 'abhi9568613107', '', '2013-09-30', '16:19:21', 1, 0),
(147, 'AJAY KUMAR PRAJAPATI', 'CSE', 1, 10, ' ajay kumar praj', 'ayfffff', '', '2013-09-30', '16:20:37', 1, 0),
(148, 'abhishek sahu', 'CSE', 1, 7, 'abhishek.sahu', 'abhi9568613107', '', '2013-09-30', '16:21:24', 1, 0),
(149, 'deepchand chauhan', 'CSE', 1, 23, 'deepchand', 'deepchand', '', '2013-09-30', '16:22:54', 1, 0),
(150, 'AJAY KUMAR PRAJAPATI', 'CSE', 1, 10, 'ajay', '9627128675', '', '2013-09-30', '16:23:33', 1, 0),
(151, 'deepchand chauhan', 'CSE', 1, 23, 'deepchand', 'deep', '', '2013-09-30', '16:25:35', 1, 0),
(152, 'ajay kumar prajapati', 'CSE', 1, 10, 'ajay', '9627128675', '', '2013-09-30', '16:27:18', 1, 0),
(153, 'deepchand chauhan', 'CSE', 1, 23, 'deepchand', 'deep', '', '2013-09-30', '16:29:53', 1, 0),
(154, 'RAJESH AGGARWAL', 'EEE', 2, 57, 'RAJESH01AG', '9006894755', '', '2014-01-29', '11:40:07', 1, 0),
(155, 'alok', 'ECE', 2, 0, 'alok', 'alok', '', '2014-04-14', '23:45:45', 1, 1),
(156, 'alok', 'ECE', 2, 0, 'alok', 'alok', '', '2014-04-14', '23:46:41', 1, 1),
(157, 'alok', 'ECE', 2, 9, 'alok', 'alok', '', '2014-04-14', '23:50:20', 1, 1),
(158, 'alok', 'ECE', 2, 9, 'alok', 'alok', '', '2014-04-14', '23:51:14', 1, 1),
(159, 'Sumit', 'CSE', 1, 2, 'sumit', 'sumit', '', '2014-04-15', '00:32:41', 1, 0),
(160, 'Student', 'CSE', 1, 1, 'student', 'student', '', '2014-04-15', '00:39:28', 1, 1),
(161, 'Aa', 'ECE', 3, 11, 'aa', 'aa', '', '2014-04-15', '00:50:01', 1, 1);
-- --------------------------------------------------------
--
-- Table structure for table `result`
--
CREATE TABLE IF NOT EXISTS `result` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`sname` varchar(50) NOT NULL,
`branch` varchar(5) NOT NULL,
`year` int(11) NOT NULL,
`Maxmarks` int(11) NOT NULL,
`ans_correct` int(11) NOT NULL,
`ans_incorrect` int(11) NOT NULL,
`Ques_utmpted` int(11) NOT NULL,
`Obtmarks` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=61 ;
--
-- Dumping data for table `result`
--
INSERT INTO `result` (`id`, `sname`, `branch`, `year`, `Maxmarks`, `ans_correct`, `ans_incorrect`, `Ques_utmpted`, `Obtmarks`) VALUES
(1, 'dilip yadav', 'CSE', 1, 0, 8, 22, 0, 24),
(3, 'SAURABH CHAUHAN', 'CSE', 1, 0, 13, 16, 1, 39),
(5, 's.mourya', 'CSE', 1, 0, 8, 22, 0, 24),
(6, 'NITESH KUMAR RAI', 'CSE', 1, 0, 12, 18, 0, 36),
(7, 'Shubhajyoti Das', 'CSE', 1, 0, 10, 20, 0, 30),
(8, 'Rakesh Singh Rawat', 'CSE', 1, 0, 7, 23, 0, 21),
(9, 'SHUBHAM GUPTA', 'CSE', 1, 0, 9, 21, 0, 27),
(10, 'sandeep singh', 'CSE', 1, 0, 11, 19, 0, 33),
(11, 'Himanshu Gupta', 'CSE', 1, 0, 5, 25, 0, 15),
(13, 'PRATEEK CHANDRA', 'CSE', 1, 0, 12, 18, 0, 36),
(15, 'Tapan Kumar Soren', 'CSE', 1, 0, 9, 21, 0, 27),
(16, 'vikram singh', 'CSE', 1, 0, 11, 19, 0, 33),
(18, 'shubham tulasyan', 'CSE', 1, 0, 10, 20, 0, 30),
(20, 'PRAKHAR SAXENA', 'CSE', 1, 0, 10, 20, 0, 30),
(21, 'Nitesh', 'CSE', 1, 0, 8, 22, 0, 24),
(25, 'pulkit agarwal', 'CSE', 1, 0, 9, 21, 0, 27),
(26, 'rishabh tiwari', 'CSE', 1, 0, 13, 17, 0, 39),
(27, 'SAURAV KUMAR', 'CSE', 1, 0, 14, 16, 0, 42),
(28, 'virendra kumawat', 'CSE', 1, 0, 9, 21, 0, 27),
(31, 'Tirunagari charan', 'CSE', 1, 0, 8, 22, 0, 24),
(32, 'rahul kumar soni', 'CSE', 1, 0, 9, 21, 0, 27),
(33, 'jitendra kumar', 'CSE', 1, 0, 9, 20, 1, 27),
(35, 'SUNIL KUMAR KAUSHIK', 'CSE', 1, 0, 11, 19, 0, 33),
(36, 'mukesh kumar', 'CSE', 1, 0, 10, 19, 1, 30),
(37, 'Sundarlal Baror', 'CSE', 1, 0, 11, 19, 0, 33),
(38, 'sajal gupta', 'CSE', 1, 0, 12, 18, 0, 36),
(39, 'satyam', 'CSE', 1, 0, 12, 18, 0, 36),
(40, 'GAURAV SHUKLA', 'CSE', 1, 0, 11, 19, 0, 33),
(41, 'RISHABH KUMAR JAIN', 'CSE', 1, 0, 9, 21, 0, 27),
(42, 'Altamash Khan', 'CSE', 1, 0, 12, 18, 0, 36),
(43, 'VIPUL CHANDRA', 'CSE', 1, 0, 11, 18, 1, 33),
(44, 'Shubham Verma', 'CSE', 1, 0, 13, 16, 1, 39),
(45, 'dheeraj kumar ramotra', 'CSE', 1, 0, 14, 15, 1, 42),
(46, 'omprakash bhakar', 'CSE', 1, 0, 9, 20, 1, 27),
(47, 'DEEPANSHU RAJ', 'CSE', 1, 0, 8, 22, 0, 24),
(48, 'Abhishek kumar', 'CSE', 1, 0, 11, 14, 5, 33),
(49, 'anoop patel', 'CSE', 1, 0, 5, 18, 7, 15),
(50, 'Abhishek Gupta', 'CSE', 1, 0, 13, 17, 0, 39),
(51, 'Ankush Lakhmani', 'CSE', 1, 0, 12, 18, 0, 36),
(55, 'abhishek sahu', 'CSE', 1, 0, 6, 22, 2, 18),
(56, 'deepchand chauhan', 'CSE', 1, 0, 7, 16, 7, 21),
(57, 'AJAY KUMAR PRAJAPATI', 'CSE', 1, 0, 14, 16, 0, 42),
(58, 'RAJESH AGGARWAL', 'EEE', 2, 0, 1, 1, 28, 3),
(59, 'Ashutosh kumar', 'ECE', 1, 0, 2, 6, 22, 0),
(60, 'Ashutosh kumar', 'ECE', 1, 0, 0, 0, 31, 0);
-- --------------------------------------------------------
--
-- Table structure for table `test1ques`
--
CREATE TABLE IF NOT EXISTS `test1ques` (
`qid` int(11) NOT NULL AUTO_INCREMENT,
`question` text NOT NULL,
`opt1` text NOT NULL,
`opt2` text NOT NULL,
`opt3` text NOT NULL,
`opt4` text NOT NULL,
`correct_ans` text NOT NULL,
`isdeleted` tinyint(1) NOT NULL DEFAULT '1',
PRIMARY KEY (`qid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=71 ;
--
-- Dumping data for table `test1ques`
--
INSERT INTO `test1ques` (`qid`, `question`, `opt1`, `opt2`, `opt3`, `opt4`, `correct_ans`, `isdeleted`) VALUES
(14, 'Recently (August, 2013), US International Trade Commission has imposed ban on importing and selling of which mobiles in the US market?\r\n', 'Nokia', 'Apple', 'Samsung', 'Blackberry', 'Samsung', 0),
(15, 'Which of the following nations are considered triad nuclear powers?\r\n1.Russia\r\n2.United States\r\n3.China\r\n4.India\r\nChoose the correct answers from the code given below:\r\n', 'Only 1 & 2', 'Only 1, 2 & 4', 'Only 2 & 4', 'Only 1, 2 & 3', 'Only 1 & 2', 0),
(17, 'According to TRAI Telecommunication Mobile Number Portability (Fifth Amendment) Regulations, 2013 how many corporate mobile numbers of service providers can be ported to another service provider through letter of authorization?\r\n', 'Upto 50%', 'Upto 60%', 'Upto 75%', 'Upto 100%', 'Upto 50%', 0),
(18, 'Auto-mobile Industry sector, contribute what percent of the country’s manufacturing GDP?\r\n', '15', '20', '22', '25', '25', 0),
(19, 'Recently (August, 2013), RBI has announced that it will sell government bonds worth ___ crore rupees every Monday to check volatility in the foreign exchange market. Fill the blank with correct option?\r\n', '10,000', '15,000', '20,000', '15,000', '20,000', 0),
(20, 'Who among the followings has become the first Indian woman player to clinch an individual medal at the World Badminton Championship?\r\n', 'P V Sindhu', 'Saina Nehwal', 'Ashwini Ponnappa', 'Jwala Gutta', 'P V Sindhu', 0),
(21, 'With which of the following countries, India has signed civil nuclear cooperation agreement?\r\n1.France\r\n2.USA\r\n3.Canada\r\n4.Japan\r\n5.Australia\r\nChoose the correct option from the codes given below:\r\n', 'Only 1, 2, 3 & 4', 'Only 1, 2, 3, & 5', 'Only 1, 2 & 3', 'All the above', 'Only 1, 2 & 3', 0),
(22, 'In a recent decision, union government approved setting up of how many Mega Food Parks during 12th plan period?\r\n', '11', '12', '14', '15', '12', 0),
(23, 'According to a latest report, which of the following countries has the largest group of overseas citizens of India?\r\n', 'United States', 'Canada', 'South Africa', 'Australia', 'United States', 1),
(24, 'Currently, which one of the followings is the top profit-making Public Sector Undertakings (PSUs)?', 'ONGC', 'BSNL', 'NTPC', 'SAIL', 'ONGC', 0),
(26, 'Till date, how many Prime Ministers of India got defeated in no-confidence motion against them?', 'One', 'Two', 'Three', 'Four', 'Three', 0),
(27, 'According to Forbes, who among the followings has topped the Forbes List of Top Paid Female Athlete?\r\n', 'Saina Nehwal', 'Sania Mirza', 'Maria Sharapova', 'Serena Williams', 'Maria Sharapova', 0),
(28, 'Which one of the following will become the first e-court of the country, where petitions filed via e-mails would be entertained?\r\n', 'Bangalore High Court', 'Madras High Court', 'Bombay High Court', 'Delhi High Court', 'Bombay High Court', 1),
(29, 'Name the Indian Chess Player who has won Politiken Cup in Denmark.\r\n', 'Vishwanathan Anand', 'P Harikrishna', 'Parimanjan Negi', 'Abhijit Kunte', 'Parimanjan Negi', 1),
(30, 'Which of the following places is famous for “Chikankari Workâ€, a traditional embroidery art?', 'Lucknow', 'Jaipur', 'Ajmer', 'Dharmavaram', 'Lucknow', 1),
(31, 'By defeating which one of the following teams, India has won historic bronze medal at junior women hockey world cup in August 2013?\r\n', 'Holland', 'South Africa', 'Pakistan', 'England', 'England', 1),
(32, 'Which of the following IITs has designing rail coaches that will draw power from the sun for interior lighting and cooking?\r\n', 'IIT Kanpur', 'IIT Madras', 'IIT Kharagpur', 'IIT Delhi', 'IIT Madras', 1),
(33, 'Who among the following has become the first cricketer to hit 400 sixes in an International Career?\r\n', 'Chris Gayle', 'Virendra Shehwag', 'Shahid Afridi', 'Kevin Peterson', 'Shahid Afridi', 1),
(34, 'Recently (July 2013) , which of the following state has become the first in country launch video chat in prisons?\r\n', 'Haryana', 'Uttar Pradesh', 'Himachal Pradesh', 'Assam', 'Himachal Pradesh', 0),
(35, 'In which of the following countries, Wikileaks founder Julian Assange has officially launched his Wikileaks political party?\r\n', 'Australia', 'USA', 'Russia', 'Canada', 'Australia', 1),
(36, 'As per the latest report (July 2013), which of the following has become the world’s most profitable mobile handset vendor?\r\n', 'Apple', 'Nokia', 'Samsung', 'Motorola', 'Samsung', 1),
(37, 'The total number of Olympic gold medals in field hockey won by India is __?\r\n', 'Five', 'Eight', 'Nine', 'Eleven', 'Eight', 1),
(38, 'India’s first cashless treatment of road accident victims has been recently launched at which among the following highways / corridors?\r\n', 'Gurgaon-Jaipur', 'Bangalore-Chennai', 'Mumbai-Ahmadabad', 'Mumbai-Pune', 'Gurgaon-Jaipur', 0),
(39, 'Who among the following has been selected for “Asia Business Leaders Award 2013�\r\n', 'Ratan Tata', 'Mukesh Ambani', 'Azim Premji', 'Narayana Murthy', 'Azim Premji', 0),
(40, 'Recently, in which of the following cities, country’s first wireless traffic controller system has been unveiled?\r\n', 'Bangalore', 'Chennai', 'Mumbai', 'New Delhi', 'New Delhi', 1),
(41, 'Recently, which one of the following Telecom operator announced that it would offer free access of Wikipedia to its customers?\r\n', 'Airtel', 'Aircel', 'Idea', 'Vodafone', 'Aircel', 0),
(42, 'The Union Government has decided to make production of Photo identity card mandatory for purchase of which of the following commodity?\r\n', 'Ammonium Nitrate', 'LPG', 'Acids', 'Alcohol', 'Acids', 0),
(43, 'India’s Deepika Kumari who is news recently, is associated with which sports / games?\r\n', 'Archery', 'Boxing', 'Cycling', 'High Jump', 'Archery', 0),
(44, 'As present, how many states have Woman Chief Ministers?\r\n', 'Two', 'Three', 'Four', 'One', 'Three', 0),
(45, 'As per the latest data (June, 2013), India ranks _____ in terms of number of internet users.\r\n', 'First', 'Second', 'Third', 'Fourth', 'Third', 0),
(46, 'Which of the following is used in Diesel engine?\r\n', 'Cylinder and Spark plug', 'Spark plug and Piston', 'Cylinder, Spark plug and Piston', 'Cylinder and Piston', 'Cylinder and Piston', 1),
(47, 'United Nation has declared which one of the following dates as “Malala Day�\r\n', 'July 10', 'July 12', 'July 14', 'July 15', 'July 12', 1),
(48, 'The abbreviated form of Computer VIRUS is______?\r\n', 'Vital Information Resource Under Seize', 'Vital Information Resource Under Secure', 'Vital Information Replication Under Seize', 'Vital Information Replication Under Secure', 'Vital Information Resource Under Secure', 1),
(49, 'The BSNL has announced that it will close down the Telegram service from July 15, 2013, thus Telegraph becoming a thing of past. In which year, first Telegram was sent in India?\r\n', '1848', '1850', '1853', '1857', '1850', 1),
(50, 'Recently, India has withdrawn all subsidies on cooking gas and kerosene being provided to which one of the following country?\r\n', 'Nepal', 'Bhutan', 'Pakistan', 'Afghanistan', 'Bhutan', 0),
(51, 'Which of the following countries has largest Muslim population?\r\n', 'Pakistan', 'India', 'Indonesia', 'Bangladesh', 'Indonesia', 1),
(52, 'The Union Government has given nod to set up country’s first Woman University at which of the following place?\r\n', 'Raebarelli, Uttar Pradesh', 'Mysore, Karnataka', 'Nasik, Maharastra', 'Anand, Gujarat', 'Raebarelli, Uttar Pradesh', 1),
(53, 'Which of the following movies has won best movie award at 14th IIFA-2013?\r\n', 'Kahaani', 'Barfi', 'Ek Tha Tiger', 'Bodyguard', 'Barfi', 1),
(54, 'As per the latest ICC Test rankings (July 2013), which of the following country is in top position?\r\n', 'South Africa', 'England', 'India', 'Australia', 'South Africa', 0),
(55, 'Who among the following are the winners of Men’s and Women’s single title in Wimbledon Tennis -2013?\r\n', 'Roger Federer, Serena Williams', 'Rafeal Nadal, Marion Bartoli', 'Andy Murray, Marion Bartoli', 'Daniel Nestor, Marion Bartoli', 'Andy Murray, Marion Bartoli', 0),
(56, 'Vikas Gowda, who clinched India’s first gold at Asian Meet is associated with which of the following Athletic sports?\r\n', 'Discus Throw', 'High Jump', 'Javelin Throw', 'Wrestling', 'Discus Throw', 0),
(57, 'Recently, Pakistan Cricket Board imposed a life ban on which one of the following Pakistan Cricket Player?\r\n', 'Salman Bhatt', 'Danish Kaneria', 'Shahid Afridi', 'Shoib Mallik', 'Danish Kaneria', 0),
(58, 'Who among the following has been elected as president of Asian Athletic Association’s?\r\n', 'Suresh Kalmadi', 'Dahlan Jumaan Al-Hamad', 'Adille Sumariwala', 'C K Valson', 'Dahlan Jumaan Al-Hamad', 1),
(59, 'Annashree Yojana is a flagship programme of which one of the following state?\r\n', 'Delhi', 'Haryana', 'Punjab', 'Uttarkhand', 'Delhi', 1),
(60, 'Which of the following country has become the winner of FIFA Confederations cup 2013?\r\n', 'Brazil', 'Spain', 'Italy', 'Germany', 'Brazil', 1),
(61, 'Recently, which of the following state has been declared as first “Smoke Free†state in the country?\r\n', 'Himachal Pradesh', 'Odisha', 'Jharkhand', 'Haryana', 'Himachal Pradesh', 1),
(62, 'Recently, which of the following Non-Banking Financial Company (NBFC) got approval from the Reserve Bank of India (RBI) for establishing as well as operating White Label ATMs?\r\n', 'Power Finance Corp', 'Mahindra and Mahindra', 'Muthoot Finance', 'Edelweiss capital', 'Muthoot Finance', 1),
(63, 'Which of the following company recently unveiled the World’s first Firefox operating smartphone?\r\n', 'Samsung', 'Micromax', 'Telefonica', 'Nokia', 'Telefonica', 1),
(64, 'What is the name of the Sun observing satellite launched by NASA recently?\r\n', 'IRIS', 'Crusader', 'Corona', 'Sunset', 'IRIS', 1),
(65, 'Which of the following space agency is partnering ISRO’s Mars Orbiter Mission?\r\n', 'NASA', 'European space agency', 'Russian Space agency', 'French space agency', 'NASA', 1),
(66, 'Recently, which one of the following car entered the Guinness World Records for driving on a longest journey?\r\n', 'Nano', 'Swift', 'Alto', 'Ford', 'Nano', 1),
(67, 'Which one of the following state has recently launched “Mukhyamantri Bijli Bachat Lamp Yojna†for energy conservation?\r\n', 'Rajasthan', 'Uttar Pradesh', 'Jharkhand', 'Punjab', 'Rajasthan', 1),
(68, 'Nirmal Gram Puraskar†award is related to which one of the following ministry?\r\n', 'Ministry of Environment and Forest', 'Ministry of Rural Development', 'Ministry of Culture', 'Ministry of Social Welfare', 'Ministry of Rural Development', 1),
(69, 'Who among the following has been ranked top in the most powerful celebrity list of Forbes?\r\n', 'Lady Gaga', 'Steven Spielberg', 'Oprah Winfrey', 'Madonna', 'Oprah Winfrey', 1),
(70, 'a', 'a', 'a', 'a', 'a', 'a', 0);
/*!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 */;
| true |
b21d6cc9f0e8d057a74f93f8d4228dddd829f4b3 | SQL | Aleksandar210/HackerRank-Softuni-challenges | /SoftuniLabPractice/T-SQL Practice/SqlJoinsAndSubQPractice.sql | UTF-8 | 7,010 | 4.5 | 4 | [] | no_license | --1 task
SELECT top 5 EmployeeID, JobTitle,Employees.AddressID,AddressText
FROM Employees
JOIN Addresses ON Employees.AddressId=Addresses.AddressId
ORDER BY Employees.AddressID ASC
--first name last name town and adress text
SELECT top 50 FirstName,LastName,Towns.[Name],AddressText
FROM Employees
JOIN Addresses ON Employees.AddressID = Addresses.AddressID
JOIN Towns ON Addresses.TownID = Towns.TownID
ORDER BY FirstName ASC,LastName
--select firstName Last name empl id and department id where we get only those from sales
SELECT EmployeeID,FirstName,LastName,Departments.[Name] AS DepartmentName
FROM Employees
JOIN Departments ON Employees.DepartmentID = Departments.DepartmentID
WHERE Departments.[Name] LIKE 'Sales'
ORDER BY Employees.EmployeeID ASC
--with those who are salary above 15000
SELECT top 5 EmployeeID,FirstName,LastName,Departments.[Name] AS DepartmentName
FROM Employees
JOIN Departments ON Employees.DepartmentID = Departments.DepartmentID
WHERE Employees.Salary>15000
ORDER BY Departments.DepartmentID ASC
--filter only employees without a project
SELECT top 5 Employees.EmployeeID,CONCAT_WS(' ',FirstName,LastName) AS [Full Name]
FROM Employees
FULL OUTER JOIN EmployeesProjects ON Employees.EmployeeID=EmployeesProjects.EmployeeID
WHERE ProjectID is null
--hired after some date and are from sales or finance
SELECT FirstName,LastName,HireDate,Departments.[Name]
FROM Employees
JOIN Departments ON Departments.DepartmentID=Employees.EmployeeID
WHERE HireDate>CONVERT(smalldatetime,'1999-01-01') AND Departments.[Name] IN('Sales','Finance')
ORDER BY HireDate ASC
--select employees with a project after date and is still ongoing
SELECT top 5 EmployeeS.EmployeeID as EmployeeID,FirstName,LastName,Projects.[Name] AS ProjectName
FROM Employees
JOIN EmployeesProjects ON EmployeeS.EmployeeID=EmployeesProjects.EmployeeID
JOIN Projects ON Projects.ProjectID = EmployeesProjects.ProjectID
WHERE Projects.StartDate>'2002-08-13' AND Projects.EndDate IS NULL
ORDER BY EmployeeID ASC
--Employee 24 and select null project name if the project has started during ora fter 2005
SELECT Employees.EmployeeID,CONCAT_WS(' ',FirstName,LastName) AS [Full name],
CASE
WHEN Projects.StartDate>=Convert(smalldatetime,'2005-01-01') THEN NULL
ELSE Projects.[Name]
END AS [Project Name]
FROM Employees
JOIN EmployeesProjects ON Employees.EmployeeID=EmployeesProjects.EmployeeID
JOIN Projects ON Projects.ProjectID = EmployeesProjects.ProjectID
WHERE Employees.EmployeeID = 24
--Employee and Manager
SELECT Employees.EmployeeID,Employees.FirstName,Employees.ManagerID,Managers.FirstName
FROM Employees
JOIN Employees AS Managers ON Employees.ManagerID = Managers.EmployeeID
WHERE Employees.ManagerID IN (3,7)
ORDER BY Employees.EmployeeID ASC
--Employee Summary
SELECT TOP 50 CONCAT_WS(' ',Employees.FirstName,Employees.LastName),CONCAT_WS(' ',Managers.[FirstName],Managers.[LastName]),Departments.[Name]
FROM Employees
JOIN Employees AS Managers ON Employees.ManagerID = Managers.EmployeeID
JOIN Departments ON Employees.DepartmentID = Departments.DepartmentID
ORDER BY Employees.EmployeeID ASC
--test
SELECT (SELECT [Name] FROM Departments WHERE Employees.DepartmentID = Departments.DepartmentID),AVG(Salary)
FROM Employees
GROUP BY DepartmentID
--Select the min salary from the departments and the department name of that min salary
SELECT TOP 1 AVG(Salary) as avgSalary
FROM Employees
GROUP BY DepartmentID
Order by avgSalary ASC
--Show country code and name mountain range and peak name and elevation
--First we have a country table that has only information about the country and a mountain table that has info of the mountains
--We have a middle table which has mountain id and country id we will use this one
SELECT Countries.CountryCode,CountryName,MountainRange,Peaks.PeakName,Peaks.Elevation
FROM Countries
JOIN MountainsCountries ON Countries.CountryCode = MountainsCountries.CountryCode
JOIN Mountains ON MountainsCountries.MountainId = Mountains.Id
JOIN Peaks ON Mountains.Id = Peaks.MountainId
WHERE CountryName LIKE('Bulgaria') AND Elevation>2835
ORDER BY Elevation DESC
SELECT * FROM Countries
--Count mountain ranges in countries in USA Russia and Bulgaria
SELECT Countries.CountryCode,COUNT(Mountains.MountainRange) as MountainRangeCount
FROM Countries
JOIN MountainsCountries ON Countries.CountryCode = MountainsCountries.CountryCode
JOIN Mountains ON MountainsCountries.MountainId = Mountains.Id
WHERE Countries.CountryName IN ('Bulgaria','Russia','United states')
GROUP BY Countries.CountryCode
--Countries with or without rivers
SELECT top 5 CountryName,RiverName
FROM Countries
LEFT JOIN CountriesRivers ON Countries.CountryCode = CountriesRivers.CountryCode
LEFT JOIN Rivers ON CountriesRivers.RiverId = Rivers.Id
WHERE ContinentCode = 'AF'
ORDER BY CountryName ASC
-- not quite sure but it works in some way
SELECT Countries.ContinentCode AS ContinentCode,Countries.CurrencyCode AS CurrencyCode,COUNT(*) AS CurrencyUsage
FROM Countries
JOIN Continents as cc ON Countries.ContinentCode = cc.ContinentCode
JOIN Currencies as ccr ON Countries.CurrencyCode = ccr.CurrencyCode
GROUP BY Countries.ContinentCode,Countries.CurrencyCode
Having COUNT(*) >1
ORDER BY ContinentCode DESC
--Countries with no mountain
SELECT COUNT(*) --Countries.CountryName,MountainsCountries.MountainId
FROM Countries
FULL OUTER JOIN MountainsCountries ON Countries.CountryCode = MountainsCountries.CountryCode
WHERE MountainsCountries.MountainId IS NULL
--Highest Peak name and Elevation by country
--the highest peak in Countries
SELECT CountryName,ElevationNumber,RiverLength
FROM
(SELECT CountryName,PeakName,ElevationNumber,RiverLength,
DENSE_RANK() OVER (PARTITION BY CountryName ORDER BY ElevationNumber DESC,RiverLength DESC) AS CountryRank
FROM
(SELECT Countries.CountryName AS CountryName,Peaks.PeakName AS PeakName,Peaks.Elevation AS ElevationNumber,Rivers.[Length] AS RiverLength
FROM Countries
JOIN MountainsCountries ON Countries.CountryCode = MountainsCountries.CountryCode
JOIN Mountains ON MountainsCountries.MountainId = Mountains.Id
JOIN Peaks ON Mountains.Id = Peaks.MountainId
JOIN CountriesRivers ON Countries.CountryCode = CountriesRivers.CountryCode
JOIN Rivers ON CountriesRivers.RiverId = Rivers.Id
) AS CountriesPeaksRivers
) AS Something
WHERE CountryRank = 1
--highest peak by country and elevation in mountain range
SELECT CountryName,ISNULL(PeakName,'No highest Peak'),ISNULL(PeakElevation,0),ISNULL(MountainRange,'No mountain')
FROM
(SELECT Countries.CountryName AS CountryName,Peaks.PeakName AS PeakName,Peaks.Elevation AS PeakElevation,Mountains.MountainRange AS MountainRange,
DENSE_RANK() OVER(PARTITION BY CountryName ORDER BY Peaks.Elevation desc) AS PeakRank
FROM Countries
LEFT JOIN MountainsCountries ON Countries.CountryCode = MountainsCountries.CountryCode
LEFT JOIN Mountains ON MountainsCountries.MountainId = Mountains.Id
LEFT JOIN Peaks ON Mountains.Id = Peaks.MountainId
) AS PeakInfo
WHERE PeakRank =1
ORDER BY CountryName
| true |
f4883b231b8e032162e26fb6b5e5f7cc8a171e7d | SQL | atakage/SQL- | /GRADE(2019-10-15).sql | UTF-8 | 3,299 | 4.59375 | 5 | [] | no_license | -- grade 화면
CREATE TABLE tbl_score(
s_id NUMBER,
s_std nVARCHAR2(50) NOT NULL,
s_subject nVARCHAR2(50) NOT NULL,
s_score NUMBER(3) NOT NULL,
s_remark nVARCHAR2(50),
CONSTRAINT pk_score PRIMARY KEY(s_id) -- PK를 컬럼에 지정하지 않고 별도의 CONSTRAINT 추가 방식으로 지정
-- 표준 SQL에서는 PK 지정방식을 컬럼에 PRIMARY KEY 키워드 지정 방식으로 사용하는데 표준 SQL의 PK 지정방식이 안 되는 DBMS가 있음
-- 이런 경우에 사용
);
SELECT COUNT(*) FROM tbl_score;
SELECT * FROM tbl_score;
SELECT s_std, sum(s_score) AS 총점, ROUND(avg(s_score),2) AS 평균 FROM tbl_score GROUP BY s_std ORDER BY s_std; -- 학생(s_std) 데이터가 같은 레코드를 묶기, 묶여진 그룹 내에서 총점과 평균 계산
SELECT s_subject FROM tbl_score GROUP BY s_subject ORDER BY s_subject;
/*
과학
국사
국어
미술
수학
영어
*/
SELECT s_std AS 학생, SUM(DECODE(s_subject, '과학', s_score)) AS 과학, SUM(DECODE(s_subject, '국사', s_score)) AS 국사, SUM(DECODE(s_subject, '국어', s_score)) AS 국어, SUM(DECODE(s_subject, '미술', s_score)) AS 미술,
SUM(DECODE(s_subject, '수학', s_score)) AS 수학, SUM(DECODE(s_subject, '영어', s_score)) AS 영어 FROM tbl_score GROUP BY s_std ORDER BY s_std ;
-- 성적테이블을 각 과목이름으로 컬럼을 만들어 생성을 하면 데이터를 추가하거나 단순 조회를 할 때는 편리하게 사용할 수 있음
-- 그러나 사용 중 과목이 추가되거나 과목명 변경되는 경우 테이블의 컬럼을 변경해야 하는 상황이 발생, 컬럼 변경은 DBMS나 사용자 입장에서 많은 비용을 지불해야 하므로 컬럼 변경은 신중히
-- 실제 데이터는 고정된 컬럼으로 생성된 테이블에 저장을 하고 View로 확인을 할 떄 PIVOT 방식으로 펼쳐보면, 마치 실제 테이블에 컬럼이 존재하는 것처럼 사용할 수 있음
SELECT * FROM (SELECT s_std, s_subject, s_score FROM tbl_score) PIVOT( -- 오라클 11g 이후의 PIVOT 전용 문법, SQL Developer에서 수행 명령에 제한 있음, main from 절에 SUB QUERY를 사용해 테이블 지정해야 함
SUM(s_score) -- 컬럼 이름 별로 분리하여 표시할 데이터
FOR s_subject -- 묶어서 펼칠 컬럼 이름
IN
( '과학' AS 과학, '국사' AS 국사, '국어' AS 국어, '미술' AS 미술, '수학' AS 수학, '영어' AS 영어)) ORDER BY s_std;
CREATE VIEW view_score AS(
SELECT s_std AS 학생, SUM(DECODE(s_subject, '과학', s_score)) AS 과학, SUM(DECODE(s_subject, '국사', s_score)) AS 국사, SUM(DECODE(s_subject, '국어', s_score)) AS 국어, SUM(DECODE(s_subject, '미술', s_score)) AS 미술,
SUM(DECODE(s_subject, '수학', s_score)) AS 수학, SUM(DECODE(s_subject, '영어', s_score)) AS 영어,
SUM(s_score) AS 총점, ROUND(AVG(s_score),2) AS 평균, RANK() OVER (ORDER BY SUM(s_score) DESC) AS 석차 FROM tbl_score GROUP BY s_std
);
SELECT * FROM view_score ORDER BY 학생; | true |
7dbadeb1fb680b081f8cc8598481eb7fd58f6a3b | SQL | BGCX067/f1project-svn-to-git | /trunk/install.sql | UTF-8 | 33,329 | 3.171875 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 3.1.1
-- http://www.phpmyadmin.net
--
-- 主机: localhost
-- 生成日期: 2009 年 03 月 10 日 01:35
-- 服务器版本: 5.1.30
-- PHP 版本: 5.2.8
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
/*!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 */;
--
-- 数据库: `jj`
--
-- --------------------------------------------------------
--
-- 表的结构 `yui_admin`
--
CREATE TABLE IF NOT EXISTS `yui_admin` (
`id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
`typer` enum('system','manager','editor') NOT NULL DEFAULT 'editor',
`user` varchar(100) NOT NULL DEFAULT '',
`pass` varchar(50) NOT NULL DEFAULT '',
`email` varchar(100) NOT NULL DEFAULT '',
`modulelist` text NOT NULL COMMENT '可管理的模块,系统管理员无效',
`menuid` varchar(255) NOT NULL COMMENT '常用菜单ID号',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;
--
-- 导出表中的数据 `yui_admin`
--
INSERT INTO `yui_admin` (`id`, `typer`, `user`, `pass`, `email`, `modulelist`, `menuid`) VALUES
(1, 'system', 'admin', '21232f297a57a5a743894a0e4a801fc3', 'admin@admin.com', '', '');
-- --------------------------------------------------------
--
-- 表的结构 `yui_book`
--
CREATE TABLE IF NOT EXISTS `yui_book` (
`id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
`user` varchar(255) NOT NULL DEFAULT '',
`subject` varchar(255) NOT NULL DEFAULT '',
`content` text NOT NULL,
`postdate` int(10) unsigned NOT NULL DEFAULT '0',
`email` varchar(255) NOT NULL DEFAULT '',
`ifcheck` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '0为未审核,1为已审核所有人可以看,2为已审核但仅限会员能查看',
`reply` text NOT NULL,
`replydate` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '回复时间',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=7 ;
--
-- 导出表中的数据 `yui_book`
--
INSERT INTO `yui_book` (`id`, `user`, `subject`, `content`, `postdate`, `email`, `ifcheck`, `reply`, `replydate`) VALUES
(1, '测试', '测试留言', '测试留言', 1221922909, 'test@126.com', 1, '<div>测试审核\r\n<div><img border="0" alt="" src="upfiles/200809/03/mark_1220426054.jpg" /></div>\r\n</div>', 1221923491),
(2, '测试2', '图片展示5', 'fsdfasdfasd', 1221923587, 'test@126.com', 1, '', 0),
(3, '谢大哥', '1', '123233', 1236065490, 'xxz@live.cn', 0, '', 1236218946),
(5, '234-093', '720394', '879238479', 1236133716, '27@hdfj.com', 0, '', 0),
(6, '234', '234234', '234234234', 1236133785, '234@76j.com', 0, '', 0);
-- --------------------------------------------------------
--
-- 表的结构 `yui_category`
--
CREATE TABLE IF NOT EXISTS `yui_category` (
`id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增ID号,也是分类ID号',
`catetype` enum('article','product','picture','download') NOT NULL DEFAULT 'article' COMMENT '分类类别',
`rootid` mediumint(8) unsigned NOT NULL DEFAULT '0' COMMENT '根分类ID号',
`parentid` mediumint(8) unsigned NOT NULL DEFAULT '0' COMMENT '父分类ID号',
`catename` varchar(255) NOT NULL DEFAULT '' COMMENT '分类名称',
`catestyle` varchar(255) NOT NULL DEFAULT '' COMMENT '样式',
`taxis` tinyint(3) unsigned NOT NULL DEFAULT '255' COMMENT '排序,值越小越往前靠',
`tpl_index` varchar(255) NOT NULL DEFAULT '' COMMENT '封面模板',
`tpl_list` varchar(255) NOT NULL DEFAULT '' COMMENT '列表模板',
`tpl_msg` varchar(255) NOT NULL DEFAULT '' COMMENT '内容模板',
`ifcheck` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '1为正常,0为隐藏',
`psize` tinyint(3) unsigned NOT NULL DEFAULT '30' COMMENT '分类列表每页显示个数,默认是30',
`keywords` varchar(255) NOT NULL COMMENT '分类关键字',
`description` varchar(255) NOT NULL COMMENT '分类描述',
`note` varchar(255) NOT NULL COMMENT '分类描述',
PRIMARY KEY (`id`),
KEY `rootid` (`rootid`,`ifcheck`),
KEY `parentid` (`parentid`,`ifcheck`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=6 ;
--
-- 导出表中的数据 `yui_category`
--
INSERT INTO `yui_category` (`id`, `catetype`, `rootid`, `parentid`, `catename`, `catestyle`, `taxis`, `tpl_index`, `tpl_list`, `tpl_msg`, `ifcheck`, `psize`, `keywords`, `description`, `note`) VALUES
(1, 'article', 0, 0, '新闻中心', '', 10, '', '', '', 1, 30, '', '', '关于本站的一些新闻信息~~'),
(2, 'product', 0, 0, '产品中心', '', 10, '', '', '', 1, 10, '', '', '展示产品相关信息'),
(3, 'picture', 0, 0, '图片展示', '', 10, '', '', '', 1, 30, '', '', '展示本公司里的一些图片信息'),
(5, 'article', 0, 0, '促销新闻', '', 255, '', '', '', 1, 30, '', '', '');
-- --------------------------------------------------------
--
-- 表的结构 `yui_codes`
--
CREATE TABLE IF NOT EXISTS `yui_codes` (
`id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增ID号',
`sign` varchar(50) NOT NULL COMMENT '自定义标签,必须是唯一值或空值',
`subject` varchar(255) NOT NULL COMMENT '广告题头,用于后台管理',
`content` text NOT NULL COMMENT '广告内容',
`status` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '0为未审核,1为正常',
PRIMARY KEY (`id`),
KEY `start_date` (`status`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
--
-- 导出表中的数据 `yui_codes`
--
-- --------------------------------------------------------
--
-- 表的结构 `yui_content`
--
CREATE TABLE IF NOT EXISTS `yui_content` (
`id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '主题ID号,对应msg表中的自增ID号',
`cateid` mediumint(8) unsigned NOT NULL DEFAULT '0' COMMENT '分类ID号,用于索引',
`content` longtext NOT NULL COMMENT '内容信息',
PRIMARY KEY (`id`),
KEY `cateid` (`cateid`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--
-- 导出表中的数据 `yui_content`
--
INSERT INTO `yui_content` (`id`, `cateid`, `content`) VALUES
(2, 1, '<div>这是应用于新闻测试的~~</div>'),
(3, 2, '<div>简单测试dfasdfsdfasdf</div>'),
(8, 1, '<div>好饿啊.</div>'),
(5, 1, '<div>不错不错fsdafsdfsdafsdafsafsdfsad</div>'),
(6, 1, '<div>fsdfsdfsfsdfsdfg</div>'),
(7, 2, '<div>呵呵~~~~</div>'),
(9, 1, '<div>345345</div>\r\n<div>我要看一下</div>\r\n<div>是不是真的有问题</div>'),
(11, 1, '<div>666666666666666666666666666666</div>'),
(12, 1, '<div>55555555555</div>'),
(13, 1, '<div>456456456</div>'),
(14, 1, '<div>67567</div>'),
(15, 1, '<div>hggg</div>'),
(16, 1, '<div>cdf5fg</div>'),
(17, 1, '<div>aadf345</div>'),
(18, 1, '<div>asdfasdf</div>'),
(20, 1, '<div>4444444444444444444444</div>'),
(21, 1, '<div>444444444444444444444442222222</div>'),
(22, 1, '<div>2222222222222222222222</div>'),
(23, 1, '<div>345345345</div>'),
(24, 1, '<div>345345345</div>'),
(25, 1, '<div>7777</div>'),
(26, 1, '<div>45345345345</div>'),
(27, 5, '<div>小新新</div>');
-- --------------------------------------------------------
--
-- 表的结构 `yui_driver`
--
CREATE TABLE IF NOT EXISTS `yui_driver` (
`id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
`user` varchar(255) NOT NULL DEFAULT '',
`subject` varchar(255) NOT NULL DEFAULT '',
`content` text NOT NULL,
`postdate` int(10) unsigned NOT NULL DEFAULT '0',
`email` varchar(255) NOT NULL DEFAULT '',
`phone` varchar(255) NOT NULL DEFAULT '',
`holder` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '0æ— é©¾é©¶è¯ï¼?有驾驶è¯',
`ifcheck` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '0ä¸ºæœªå®¡æ ¸ï¼?ä¸ºå·²å®¡æ ¸æ‰€æœ‰äººå¯ä»¥çœ‹ï¼Œ2ä¸ºå·²å®¡æ ¸ä½†ä»…é™ä¼šå‘˜èƒ½æŸ¥çœ‹',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=5 ;
--
-- 导出表中的数据 `yui_driver`
--
INSERT INTO `yui_driver` (`id`, `user`, `subject`, `content`, `postdate`, `email`, `phone`, `holder`, `ifcheck`) VALUES
(3, '谢大哥大', '1', '1232343333', 1236217580, 'xxz@live.cn', '15013707091', 1, 0);
-- --------------------------------------------------------
--
-- 表的结构 `yui_link`
--
CREATE TABLE IF NOT EXISTS `yui_link` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`typeid` mediumint(9) NOT NULL COMMENT '对应linktype的类别',
`name` varchar(255) NOT NULL DEFAULT '',
`url` varchar(255) NOT NULL DEFAULT '',
`picture` varchar(255) DEFAULT NULL,
`taxis` tinyint(3) unsigned DEFAULT '255',
`width` tinyint(3) unsigned NOT NULL COMMENT '图片链接宽度',
`height` tinyint(3) unsigned NOT NULL COMMENT '图片链接高度',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=6 ;
--
-- 导出表中的数据 `yui_link`
--
INSERT INTO `yui_link` (`id`, `typeid`, `name`, `url`, `picture`, `taxis`, `width`, `height`) VALUES
(2, 2, '我要买车', 'special.php/7.html', 'upfiles/1236241455.jpg', 1, 90, 20),
(3, 2, '试驾预约', 'driver.php', 'upfiles/1236241511.jpg', 2, 90, 20),
(4, 2, '企业网站', 'http://www.ford.com.cn/', 'upfiles/1236241194.jpg', 0, 90, 20);
-- --------------------------------------------------------
--
-- 表的结构 `yui_linktype`
--
CREATE TABLE IF NOT EXISTS `yui_linktype` (
`id` mediumint(9) NOT NULL AUTO_INCREMENT COMMENT '链接类型',
`typename` varchar(80) NOT NULL COMMENT '链接类型',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ;
--
-- 导出表中的数据 `yui_linktype`
--
INSERT INTO `yui_linktype` (`id`, `typename`) VALUES
(2, '右上角');
-- --------------------------------------------------------
--
-- 表的结构 `yui_msg`
--
CREATE TABLE IF NOT EXISTS `yui_msg` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '信息自增ID号',
`cateid` mediumint(8) unsigned NOT NULL DEFAULT '0' COMMENT '分类ID对应category表的自增ID号',
`subject` varchar(255) NOT NULL DEFAULT '' COMMENT '主题',
`style` varchar(255) NOT NULL DEFAULT '' COMMENT '主题CSS样式',
`author` varchar(50) NOT NULL DEFAULT '' COMMENT '作者名称',
`postdate` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '发布时间',
`tplfile` varchar(255) NOT NULL DEFAULT '' COMMENT '模板文件,为空使用系统默认',
`hits` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '点击率',
`taxis` int(11) NOT NULL DEFAULT '0' COMMENT '排序,值越大越往前排',
`thumb` varchar(255) NOT NULL COMMENT '缩略图',
`istop` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '是否置顶,0为普通,1-9为不同级别的置顶',
`isvouch` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '是否推荐,0为不推荐,1-9为不同级别的推荐',
`isbest` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '是否精华,0为普通,1-9为不同级别的精华',
`ifcheck` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '1为已审核,0为未审核',
`clou` varchar(255) NOT NULL COMMENT '简要描述',
`url` varchar(255) DEFAULT '' COMMENT '外部网址',
`mark` varchar(255) NOT NULL COMMENT '商品大图',
`standard` varchar(30) NOT NULL COMMENT '规格',
`number` varchar(30) NOT NULL COMMENT '型号',
`m_price` varchar(30) NOT NULL COMMENT '市场价',
`s_price` varchar(30) NOT NULL COMMENT '市城价',
`promotions` varchar(255) NOT NULL COMMENT '促销活动',
`softsize` varchar(50) NOT NULL COMMENT '软件大小',
`softlang` varchar(255) NOT NULL COMMENT '软件语言',
`softsystem` varchar(255) NOT NULL COMMENT '软件应用平台',
`softdemo` varchar(80) NOT NULL COMMENT '软件演示地址',
`softadmin` varchar(80) NOT NULL COMMENT '软件开发者',
`softemail` varchar(80) NOT NULL COMMENT '联系邮箱',
`softother` varchar(255) NOT NULL COMMENT '其他说明',
`softlicense` varchar(255) NOT NULL COMMENT '授权方式',
PRIMARY KEY (`id`,`cateid`),
KEY `cateid` (`cateid`,`ifcheck`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=28 ;
--
-- 导出表中的数据 `yui_msg`
--
INSERT INTO `yui_msg` (`id`, `cateid`, `subject`, `style`, `author`, `postdate`, `tplfile`, `hits`, `taxis`, `thumb`, `istop`, `isvouch`, `isbest`, `ifcheck`, `clou`, `url`, `mark`, `standard`, `number`, `m_price`, `s_price`, `promotions`, `softsize`, `softlang`, `softsystem`, `softdemo`, `softadmin`, `softemail`, `softother`, `softlicense`) VALUES
(2, 1, '测试新闻', '', 'admin', 1220437251, '', 6, 0, '', 0, 0, 0, 1, '本新闻应用于测试使用', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''),
(3, 2, '测试产品', '', 'admin', 1220371200, '', 36, 0, 'upfiles/200809/21/thumb_1221989172_51.jpg', 0, 0, 0, 1, '简单测试', '', 'upfiles/200809/21/mark_1221989172_51.jpg', 'SD983', 'DDP9', '98.00', '78.00', '购买本商品可物赠……', '', '', '', '', '', '', '', ''),
(8, 1, '我的爱', '', 'admin', 1235007630, '', 5, 0, '', 0, 0, 0, 1, 'bicth', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''),
(5, 1, '不错不错', '', 'admin', 1220544000, '', 5, 0, '', 0, 0, 0, 1, '3.0啊ffsdfsfsdfsdfsd', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''),
(6, 1, 'sdfsdfsdfsdfsdf', '', 'admin', 1220544000, '', 11, 0, '', 0, 0, 0, 1, 'sdfasfsadfsdafsd', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''),
(7, 2, '测试产品二', '', 'admin', 1221840000, '', 19, 0, 'upfiles/200809/21/thumb_1221989058_20.jpg', 0, 0, 0, 1, '这是测试产品二噢', '', 'upfiles/200809/21/mark_1221989058_20.jpg', '吨', 'DS-100', '98.50', '90.00', '买二赠一', '', '', '', '', '', '', '', ''),
(9, 1, '345345', '', 'admin', 1235543599, '', 72, 0, '', 0, 0, 0, 1, '345345', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''),
(11, 1, '666666666666', '', 'admin', 1235716106, '', 0, 0, '', 0, 0, 0, 1, '66666666666666', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''),
(12, 1, '5555555', '', 'admin', 1235716116, '', 0, 0, '', 0, 0, 0, 1, '5555555555', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''),
(13, 1, '456456', '', 'admin', 1235716130, '', 0, 0, '', 0, 0, 0, 1, '456456', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''),
(14, 1, '66666666666666667', '', 'admin', 1235716150, '', 2, 0, '', 0, 0, 0, 1, '5666666666', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''),
(15, 1, 'dgh', '', 'admin', 1235716160, '', 0, 0, '', 0, 0, 0, 1, 'fh', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''),
(16, 1, 'bs45', '', 'admin', 1235716178, '', 3, 0, '', 0, 0, 0, 1, 'sf3', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''),
(17, 1, '458gh234', '', 'admin', 1235716191, '', 9, 0, '', 0, 0, 0, 1, 'daga45', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''),
(18, 1, 'adfadf', '', 'admin', 1235716201, '', 47, 0, '', 0, 0, 0, 1, 'adfadf', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''),
(20, 1, '324', '', 'admin', 1235975861, '', 0, 0, '', 0, 0, 0, 1, '44444444444444444444', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''),
(21, 1, '33333333333333333', '', 'admin', 1235975871, '', 0, 0, '', 0, 0, 0, 1, '33333333334444', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''),
(22, 1, '222222222222', '', 'admin', 1235975879, '', 0, 0, '', 0, 0, 0, 1, '2222222222222223', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''),
(23, 1, '555555555555555556', '', 'admin', 1235975898, '', 1, 0, '', 0, 0, 0, 1, '7834534', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''),
(24, 1, '34444', '', 'admin', 1235975919, '', 5, 0, '', 0, 0, 0, 1, '44534', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''),
(25, 1, '6456456', '', 'admin', 1235975933, '', 10, 0, '', 0, 0, 0, 1, '23767', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''),
(26, 1, '345345345', '', 'admin', 1235975949, '', 104, 0, '', 0, 0, 0, 1, '3453', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''),
(27, 5, '小新新', '', 'admin', 1236222699, '', 1, 0, '', 0, 0, 0, 1, '小新新', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '');
-- --------------------------------------------------------
--
-- 表的结构 `yui_nav`
--
CREATE TABLE IF NOT EXISTS `yui_nav` (
`id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL DEFAULT '',
`css` varchar(255) NOT NULL DEFAULT '',
`url` varchar(255) NOT NULL DEFAULT '',
`target` tinyint(3) unsigned NOT NULL DEFAULT '0',
`taxis` tinyint(3) unsigned NOT NULL DEFAULT '255',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=10 ;
--
-- 导出表中的数据 `yui_nav`
--
INSERT INTO `yui_nav` (`id`, `name`, `css`, `url`, `target`, `taxis`) VALUES
(1, '网站首页', '', 'home.php', 0, 10),
(2, '企业介绍', '', 'special.php?id=6', 0, 20),
(3, '新闻资讯', '', 'list.php?id=1', 0, 30),
(4, '图片展示', '', 'list.php?id=3', 0, 40),
(5, '产品展示', '', 'list.php?id=2', 0, 50),
(7, '在线留言', '', 'book.php', 0, 70),
(8, '联系我们', '', 'special.php?id=2', 0, 80);
-- --------------------------------------------------------
--
-- 表的结构 `yui_notice`
--
CREATE TABLE IF NOT EXISTS `yui_notice` (
`id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
`subject` varchar(255) NOT NULL DEFAULT '',
`style` varchar(255) NOT NULL COMMENT '样式管理',
`url` varchar(255) NOT NULL DEFAULT '' COMMENT '公告链接的网址',
`content` text NOT NULL,
`postdate` int(10) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=5 ;
--
-- 导出表中的数据 `yui_notice`
--
INSERT INTO `yui_notice` (`id`, `subject`, `style`, `url`, `content`, `postdate`) VALUES
(1, '测试站内公告', 'color:#008080;', '', '<div>这是测试站内公告\r\n<div>这是测试站内公告\r\n<div>这是测试站内公告\r\n<div>这是测试站内公告\r\n<div>这是测试站内公告</div>\r\n</div>\r\n</div>\r\n</div>\r\n</div>', 1220874079),
(2, '测试公告二', '', '', '<div>测试第二个公告\r\n<div>测试第二个公告\r\n<div>测试第二个公告\r\n<div>测试第二个公告</div>\r\n</div>\r\n</div>\r\n</div>', 1220875440),
(3, '测试带图片的公告', '', '', '<div>\r\n<div><img border="0" alt="" src="upfiles/200809/05/1220602126.gif" />这里是图片噢~~~</div>\r\n</div>', 1220875488),
(4, '测试第五个公告', '', '', '<div>测试第五个公告测试第五个公告测试第五个公告测试第五个公告测试第五个公告测试第五个公告测试第五个公告测试第五个公告测试第五个公告测试第五个公告测试第五个公告测试第五个公告测试第五个公告测试第五个公告测试第五个公告测试第五个公告测试第五个公告测试第五个公告测试第五个公告测试第五个公告测试第五个公告测试第五个公告</div>', 1220875564);
-- --------------------------------------------------------
--
-- 表的结构 `yui_onegroup`
--
CREATE TABLE IF NOT EXISTS `yui_onegroup` (
`id` mediumint(9) NOT NULL AUTO_INCREMENT COMMENT '自增ID号,也是组ID号',
`groupname` varchar(255) NOT NULL COMMENT '组名称',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=7 ;
--
-- 导出表中的数据 `yui_onegroup`
--
INSERT INTO `yui_onegroup` (`id`, `groupname`) VALUES
(1, '简介组'),
(5, '客户服务'),
(3, '企业介绍'),
(4, '车型介绍'),
(6, '福友会');
-- --------------------------------------------------------
--
-- 表的结构 `yui_onepage`
--
CREATE TABLE IF NOT EXISTS `yui_onepage` (
`id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增ID号,也是专题ID号',
`groupid` mediumint(9) NOT NULL DEFAULT '0' COMMENT '分组ID,未分组的ID将在任意组中显示',
`subject` varchar(255) NOT NULL DEFAULT '' COMMENT '专题名称',
`style` varchar(255) NOT NULL DEFAULT '' COMMENT 'CSS样式',
`sub_content` text NOT NULL COMMENT '简单说明内容',
`content` text NOT NULL COMMENT '专题内容',
`url` varchar(255) NOT NULL DEFAULT '' COMMENT '跳转网址',
`taxis` tinyint(3) unsigned NOT NULL DEFAULT '255' COMMENT '排序,值越小越往前靠',
`ifcheck` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '专题状态,0为锁定,1为正常',
`tpl` varchar(255) NOT NULL COMMENT '模板文件',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=16 ;
--
-- 导出表中的数据 `yui_onepage`
--
INSERT INTO `yui_onepage` (`id`, `groupid`, `subject`, `style`, `sub_content`, `content`, `url`, `taxis`, `ifcheck`, `tpl`) VALUES
(6, 3, '小企', '', '', '<div style="text-align: center"><a href="templates/default/images/966222.jpg"><img alt="" src="templates/default/images/966222.jpg" /></a></div>\r\n<div style=""> </div>\r\n<div style="text-align: center">我是小企</div>', '', 255, 1, ''),
(2, 1, '联系我们', '', '', '<div>广东广物福恒汽车贸易有限公司[长安福特授权经销商]</div>\r\n<div>地址:广州市东晓南路瑞宝路段(晓港湾斜对面) </div>\r\n<div>24小时销售热线:020-34102088 34102188</div>\r\n<div>24小时服务热线:020-84081111</div>\r\n<div>24小时保险热线:020-84086672</div>\r\n<div>预约(客户关系中心):020-84081220</div>\r\n<div>传真:020-84071356</div>\r\n<div>网址:<a href="http://www.gwfh-ford.com.cn/">http://www.gwfh-ford.com.cn</a></div>\r\n<div>全国首批广州首家通过福特QualityCare机电钣喷双项认证</div>\r\n<div>五年蝉联广州地区福特销售、服务双料冠军</div>\r\n<div>长安福特十佳经销商<span> </span>福特广州第一店</div>\r\n<div>2008羊城汽车经销商五星级认证 超白金服务店</div>\r\n<div>2008羊城汽车经销商五星级认证 五星级汽车经销商</div>\r\n<div>2008年度羊城十佳汽车经销商</div>', '', 20, 1, ''),
(3, 1, '诚聘英才', '', '', '<div>老总致词信息~~~</div>', '', 30, 1, ''),
(4, 1, '公司概况', '', '', '<div>公司制度</div>', '', 40, 1, ''),
(7, 4, '车型展示', '', '', '<p style="text-align: center"><a href="http://www.ford.com.cn/servlet/ContentServer?cid=1178860906492&pagename=Page&site=FCN&c=DFYPage"><img alt="" border="0" src="upfiles/1236329172.jpg" /></a></p>\r\n<p style="text-align: center"><a href="http://www.fordmondeo.com.cn/"><img alt="" border="0" src="upfiles/1236329161.jpg" /></a></p>\r\n<p style="text-align: center"><a href="http://www.ford-focus.com.cn/"><img alt="" border="0" src="upfiles/1236329146.jpg" /></a></p>\r\n<p style="text-align: center"><a href="http://www.fords-max.com.cn/"><img alt="" border="0" src="upfiles/1236329154.jpg" /></a></p>\r\n<p style="text-align: center"> </p>\r\n<p style="text-align: center"> </p>\r\n<div style="text-align: center"> </div>', '', 255, 1, ''),
(8, 4, '帮您选车', '', '', '<div>帮您选车</div>', '', 255, 1, ''),
(9, 4, '购车信贷', '', '', '<div>购车信贷</div>', '', 255, 1, ''),
(10, 5, '服务承诺', '', '', '<div>服务承诺</div>', '', 255, 1, ''),
(11, 5, '维修服务', '', '', '<div>维修服务</div>', '', 255, 1, ''),
(12, 5, '增值服务', '', '', '<div>增值服务</div>', '', 255, 1, ''),
(13, 6, '车务通', '', '', '<div>车务通</div>', '', 255, 1, ''),
(14, 6, '车友活动', '', '', '<div>车友活动</div>', '', 255, 1, ''),
(15, 1, '电子地图', '', '', '<iframe src=''http://channel.mapabc.com/openmap/fmap.jsp?id=15424&eid=102181&uid=7066&z=14&w=475&h=290'' scrolling=no frameborder=0 width=475 height=290 align=middle></iframe>', '', 25, 1, '');
-- --------------------------------------------------------
--
-- 表的结构 `yui_phpok`
--
CREATE TABLE IF NOT EXISTS `yui_phpok` (
`id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增ID号',
`sign` varchar(50) NOT NULL COMMENT '自定义标签,必须是唯一值或空值',
`subject` varchar(255) NOT NULL COMMENT '标题,用于后台管理',
`content` text NOT NULL COMMENT '自定义内容',
`status` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '0为未审核,1为正常',
PRIMARY KEY (`id`),
KEY `start_date` (`status`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=4 ;
--
-- 导出表中的数据 `yui_phpok`
--
INSERT INTO `yui_phpok` (`id`, `sign`, `subject`, `content`, `status`) VALUES
(1, 'contactus', '加工厂', '<div>我要加工加工</div>', 1),
(2, 'about', '简介', '<div>\r\n<table cellspacing="0" cellpadding="0" width="80%" align="center" border="0">\r\n <tbody>\r\n <tr>\r\n <td height="2"> </td>\r\n </tr>\r\n <tr>\r\n <td><span class="str">请随时留意我店活动预告</span><br />\r\n 这里将及时公布我店的活动预告,敬请广大车主和有购车意项的用户随时留意我店活动公告。谢谢!</td>\r\n </tr>\r\n </tbody>\r\n</table>\r\n</div>', 1),
(3, 'footer', '页脚版权说明', '<div>页脚版权说明 我是版权说明</div>', 0);
-- --------------------------------------------------------
--
-- 表的结构 `yui_session`
--
CREATE TABLE IF NOT EXISTS `yui_session` (
`id` varchar(32) NOT NULL COMMENT 'session_id',
`data` text NOT NULL COMMENT 'session 内容',
`lasttime` int(10) unsigned NOT NULL COMMENT '时间',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--
-- 导出表中的数据 `yui_session`
--
INSERT INTO `yui_session` (`id`, `data`, `lasttime`) VALUES
('oob8gnhdhp8h7r9fnb3vkm94r6', 'qgLoginChk|s:0:"";admin|a:7:{s:2:"id";s:1:"1";s:5:"typer";s:6:"system";s:4:"user";s:5:"admin";s:4:"pass";s:32:"21232f297a57a5a743894a0e4a801fc3";s:5:"email";s:15:"admin@admin.com";s:10:"modulelist";s:0:"";s:6:"menuid";s:0:"";}return_url|s:44:"admin.php?file=attachments&act=list&pageid=0";', 1236589607);
-- --------------------------------------------------------
--
-- 表的结构 `yui_sysmenu`
--
CREATE TABLE IF NOT EXISTS `yui_sysmenu` (
`id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增ID号',
`rootid` mediumint(8) unsigned NOT NULL DEFAULT '0' COMMENT '所属为子分类ID,0为他本身就是根分类,不存在链接',
`parentid` mediumint(8) unsigned NOT NULL DEFAULT '0' COMMENT '左侧菜单父级ID',
`name` varchar(100) NOT NULL COMMENT '名称',
`menu_url` varchar(255) NOT NULL COMMENT '链接网址',
`taxis` tinyint(3) unsigned NOT NULL DEFAULT '255' COMMENT '排序,值越小越往前靠',
`status` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '1正在使用0未使用',
`ifsystem` tinyint(1) NOT NULL DEFAULT '0' COMMENT '1为系统菜单0为可编辑菜单',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=77 ;
--
-- 导出表中的数据 `yui_sysmenu`
--
INSERT INTO `yui_sysmenu` (`id`, `rootid`, `parentid`, `name`, `menu_url`, `taxis`, `status`, `ifsystem`) VALUES
(1, 0, 0, '系统设置', 'admin.php?file=left&act=system', 255, 1, 1),
(2, 1, 0, '常规设置', '', 10, 1, 1),
(3, 1, 2, '网站基本信息', 'admin.php?file=system&act=siteset', 10, 1, 1),
(57, 15, 19, '分类管理', 'admin.php?file=category&act=list', 50, 1, 0),
(5, 1, 2, '后台菜单管理', 'admin.php?file=sysmenu&act=index', 254, 1, 1),
(7, 1, 2, 'GD图形库设置', 'admin.php?file=system&act=gdset', 30, 1, 1),
(8, 1, 2, '附件上传设置', 'admin.php?file=system&act=ftpset', 40, 1, 1),
(15, 0, 0, '内容管理', 'admin.php?file=left&act=msg', 10, 1, 0),
(19, 15, 0, '内容信息', '', 10, 1, 0),
(20, 15, 19, '文章内容', 'admin.php?file=article&act=list', 10, 1, 0),
(24, 15, 0, '附件管理', '', 20, 1, 0),
(25, 15, 24, '添加附件链接', 'admin.php?file=attachments&act=link', 10, 1, 0),
(26, 15, 24, 'Xupfiles上传大文件', 'admin.php?file=attachments&act=xupfiles', 20, 0, 0),
(27, 15, 24, '简单的小文件上传', 'admin.php?file=attachments&act=upfiles', 40, 1, 0),
(29, 15, 24, '附件列表', 'admin.php?file=attachments&act=list', 255, 1, 0),
(30, 15, 19, '单页面管理', 'admin.php?file=onepage&act=list', 60, 1, 0),
(45, 0, 0, '其他管理', 'admin.php?file=left&act=other', 30, 1, 0),
(47, 45, 71, '网站留言', 'admin.php?file=book&act=list', 20, 1, 0),
(52, 45, 71, '站内公告', 'admin.php?file=notice&act=list', 10, 1, 0),
(58, 15, 19, '产品管理', 'admin.php?file=product&act=list', 20, 0, 0),
(61, 45, 71, '导航菜单', 'admin.php?file=nav&act=list', 30, 1, 0),
(64, 45, 71, '管理投票', 'admin.php?file=vote&act=list', 40, 1, 0),
(72, 45, 71, '自定义链接', 'admin.php?file=link&act=list', 60, 1, 0),
(67, 45, 71, '自定义代码', 'admin.php?file=phpok&act=list', 50, 1, 0),
(68, 15, 19, '图片播放器', 'admin.php?file=index.img&act=set', 255, 1, 0),
(69, 15, 19, '图片展示', 'admin.php?file=picture&act=list', 30, 0, 0),
(70, 15, 19, '下载信息', 'admin.php?file=download&act=list', 40, 0, 0),
(71, 45, 0, '基本功能管理', '', 10, 1, 0),
(73, 0, 0, '人力管理', '', 20, 0, 0),
(75, 45, 0, '试驾预约', '', 255, 1, 0),
(76, 45, 75, '试驾预约', 'admin.php?file=driver&act=list', 255, 1, 0);
-- --------------------------------------------------------
--
-- 表的结构 `yui_upfiles`
--
CREATE TABLE IF NOT EXISTS `yui_upfiles` (
`id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增ID号,也是附件的ID号',
`filetype` varchar(10) NOT NULL COMMENT '文件格式,如jpg,gif等',
`tmpname` varchar(255) NOT NULL DEFAULT '' COMMENT '原文件名称,即在客户端显示的名称',
`filename` varchar(255) NOT NULL DEFAULT '' COMMENT '新文件名称,这是以时间及随机数整合生成的唯一值',
`folder` varchar(255) NOT NULL DEFAULT '' COMMENT '文件目录,基于网站的根目录的路径',
`postdate` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '上传时间',
`thumbfile` varchar(255) NOT NULL DEFAULT '' COMMENT '缩略图文件,假如附件是图片的话',
`markfile` varchar(255) NOT NULL DEFAULT '' COMMENT '水印图文件,假如附件是图片的话',
PRIMARY KEY (`id`),
KEY `filetype` (`filetype`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=67 ;
--
-- 导出表中的数据 `yui_upfiles`
--
INSERT INTO `yui_upfiles` (`id`, `filetype`, `tmpname`, `filename`, `folder`, `postdate`, `thumbfile`, `markfile`) VALUES
(54, 'jpg', 'lm01.jpg', '1236241455.jpg', 'upfiles/', 1236241455, 'thumb_1236241455.jpg', 'mark_1236241455.jpg'),
(55, 'jpg', 'lm02.jpg', '1236241511.jpg', 'upfiles/', 1236241511, 'thumb_1236241511.jpg', 'mark_1236241511.jpg'),
(47, 'gif', 'title-logo.gif', '1234920867.gif', 'upfiles/', 1234920867, 'thumb_1234920867.gif', 'mark_1234920867.gif'),
(48, 'svn', '.svn', '1236065513_82.svn', 'upfiles/200903/03/', 1236065513, '', ''),
(49, 'jpg', 'bb12.jpg', '1236066692.jpg', 'upfiles/', 1236066692, 'thumb_1236066692.jpg', 'mark_1236066692.jpg'),
(50, 'jpg', 'bb13.jpg', '1236066713.jpg', 'upfiles/', 1236066713, 'thumb_1236066713.jpg', 'mark_1236066713.jpg'),
(51, 'svn', '.svn', '1236215447_7.svn', 'upfiles/200903/05/', 1236215447, '', ''),
(52, 'jpg', 'lm00.jpg', '1236240263.jpg', 'upfiles/', 1236240263, 'thumb_1236240263.jpg', 'mark_1236240263.jpg'),
(53, 'jpg', 'lm00.jpg', '1236241194.jpg', 'upfiles/', 1236241194, 'thumb_1236241194.jpg', 'mark_1236241194.jpg'),
(56, 'svn', '.svn', '1236324084_100.svn', 'upfiles/200903/06/', 1236324084, '', ''),
(65, 'jpg', '1236570890_1.jpg', '1236570890_1.jpg', 'upfiles/', 1236570890, 'thumb_1236570890_1.jpg', 'mark_1236570890_1.jpg'),
(66, 'jpg', '1236570890_2.jpg', '1236570890_2.jpg', 'upfiles/', 1236570890, 'thumb_1236570890_2.jpg', 'mark_1236570890_2.jpg'),
(61, 'jpg', '3b_ex_focus_img1.jpg', '1236329146.jpg', 'upfiles/', 1236329146, 'thumb_1236329146.jpg', 'mark_1236329146.jpg'),
(62, 'jpg', 'FCN_smax_exGallery_03_IMG,01.jpg', '1236329154.jpg', 'upfiles/', 1236329154, 'thumb_1236329154.jpg', 'mark_1236329154.jpg'),
(63, 'jpg', 'FCN_zhisheng_ExGallery_01_IMG1.jpg', '1236329161.jpg', 'upfiles/', 1236329161, 'thumb_1236329161.jpg', 'mark_1236329161.jpg'),
(64, 'jpg', 'FCN_zhisheng_ExGallery_01_IMG12.jpg', '1236329172.jpg', 'upfiles/', 1236329172, 'thumb_1236329172.jpg', 'mark_1236329172.jpg');
-- --------------------------------------------------------
--
-- 表的结构 `yui_vote`
--
CREATE TABLE IF NOT EXISTS `yui_vote` (
`id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增ID号',
`voteid` mediumint(8) unsigned NOT NULL DEFAULT '0' COMMENT '是否是主题,0为主题,其他ID为选项',
`subject` varchar(255) NOT NULL DEFAULT '' COMMENT '主题或被选项名称',
`vtype` enum('single','pl') NOT NULL DEFAULT 'pl' COMMENT '投票类型,single单选,pl是复选',
`vcount` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '票数',
`ifcheck` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '默认是否选中,0为不选中,1为选中',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=6 ;
--
-- 导出表中的数据 `yui_vote`
--
INSERT INTO `yui_vote` (`id`, `voteid`, `subject`, `vtype`, `vcount`, `ifcheck`) VALUES
(1, 0, '改进服务计划', 'single', 3, 1),
(2, 1, '相当不错', 'single', 3, 1),
(3, 1, '一般般!', 'single', 1, 0),
(4, 1, '不是很好', 'single', 0, 0),
(5, 1, '无法满意', 'single', 0, 0);
| true |
ed2a38947964d2fea11f60aee54a955fbe990c68 | SQL | tuandongoc/CMX | /CMX.api/docs/Script/Workplan detail - Approver list.sql | UTF-8 | 393 | 3.625 | 4 | [] | no_license | SELECT TAP.TicketApprovalID, APP.EmployeeName AS Approver, TAP.ApproverLevel, TAP.ApprovalStatus, TAP.ActionedDate, ActionedBy
FROM CWX_AccountTicket AT
INNER JOIN CWX_TicketApproval TAP ON AT.TicketID = TAP.TicketApprovalRefID AND TAP.Location = 'TICKET'
LEFT JOIN Employee APP ON TAP.ApproverID = APP.EmployeeID
LEFT JOIN Employee ACT ON TAP.ActionedBy = ACT.EmployeeID
WHERE AT.TicketID = ? | true |
889d21bd8b04e392e0550f26a8b9bf886f15e6c6 | SQL | jakecraige/pwmdashboard | /install/amcs_db_setup.sql | UTF-8 | 11,469 | 3.1875 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 3.4.11.1
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Apr 03, 2013 at 08:28 AM
-- Server version: 5.5.23
-- PHP Version: 5.2.17
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: `amcs`
--
-- --------------------------------------------------------
--
-- Table structure for table `current_status`
--
CREATE TABLE IF NOT EXISTS `current_status` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`status` varchar(160) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=18 ;
--
-- Dumping data for table `current_status`
--
INSERT INTO `current_status` (`id`, `status`) VALUES
(1, 'New'),
(7, 'Remote Actions Completed'),
(3, 'On-Site Actions Completed'),
(4, 'Company Tech Dispatched'),
(9, 'Tech On Site'),
(11, 'Call dispatched to PWM');
-- --------------------------------------------------------
--
-- Table structure for table `events`
--
CREATE TABLE IF NOT EXISTS `events` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`store_number` varchar(40) COLLATE utf8_unicode_ci NOT NULL,
`event` varchar(8) COLLATE utf8_unicode_ci NOT NULL,
`timestamp` varchar(30) COLLATE utf8_unicode_ci NOT NULL,
`message` text COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=756 ;
-- --------------------------------------------------------
--
-- Table structure for table `log`
--
CREATE TABLE IF NOT EXISTS `log` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`page` varchar(15) COLLATE utf8_unicode_ci NOT NULL,
`activity` varchar(160) COLLATE utf8_unicode_ci NOT NULL,
`sql` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
`success` varchar(15) COLLATE utf8_unicode_ci NOT NULL,
`unix_timestamp` varchar(30) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=25 ;
-- --------------------------------------------------------
--
-- Table structure for table `pc_manufacturers`
--
CREATE TABLE IF NOT EXISTS `pc_manufacturers` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(30) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=9 ;
-- --------------------------------------------------------
--
-- Table structure for table `pending_queries`
--
CREATE TABLE IF NOT EXISTS `pending_queries` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`event_id` int(11) NOT NULL,
`added_ts` int(11) NOT NULL,
`execution_ts` int(20) NOT NULL,
`is_processing` int(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=32 ;
-- --------------------------------------------------------
--
-- Table structure for table `problems`
--
CREATE TABLE IF NOT EXISTS `problems` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`store_number` varchar(20) COLLATE utf8_unicode_ci NOT NULL,
`event` varchar(8) COLLATE utf8_unicode_ci NOT NULL,
`timestamp` int(20) NOT NULL,
`linked_events` text COLLATE utf8_unicode_ci NOT NULL,
`status` varchar(160) COLLATE utf8_unicode_ci NOT NULL,
`status_timestamp` int(20) NOT NULL,
`notes` varchar(300) COLLATE utf8_unicode_ci NOT NULL,
`previous_status` text COLLATE utf8_unicode_ci NOT NULL,
`resolution_type` varchar(35) COLLATE utf8_unicode_ci NOT NULL,
`resolution` varchar(160) COLLATE utf8_unicode_ci NOT NULL,
`resolution_timestamp` int(20) NOT NULL,
`fixed_action` varchar(300) COLLATE utf8_unicode_ci NOT NULL,
`body` text COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=172 ;
-- --------------------------------------------------------
--
-- Table structure for table `resolution_type`
--
CREATE TABLE IF NOT EXISTS `resolution_type` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`type` varchar(160) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=10 ;
--
-- Dumping data for table `resolution_type`
--
INSERT INTO `resolution_type` (`id`, `type`) VALUES
(1, 'Fixed Remotely'),
(2, 'Fixed by Contractor'),
(3, 'Warranty - Fixed by PWM'),
(7, 'Fixed by In House Tech');
-- --------------------------------------------------------
--
-- Table structure for table `ruleset`
--
CREATE TABLE IF NOT EXISTS `ruleset` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`event` varchar(7) COLLATE utf8_unicode_ci NOT NULL,
`actions` text COLLATE utf8_unicode_ci NOT NULL,
`priority` int(1) NOT NULL,
`error_to_problem` int(11) NOT NULL,
`trim` int(1) NOT NULL DEFAULT '0',
`system_resolved` int(4) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=17 ;
--
-- Dumping data for table `ruleset`
--
INSERT INTO `ruleset` (`id`, `event`, `actions`, `priority`, `error_to_problem`, `trim`, `system_resolved`) VALUES
(1, 'LCP', 'Check for any display issues on the sign.\r\n\r\nVerify if its presents itself on both sides of the sign.\r\n\r\nIf only on one side, you will need a sign company on site with a replacement motherboard and line controller as it could be either of these with a problem.', 3, 60, 0, 240),
(2, 'SCP', 'Check for any sign display issues\r\n\r\nIf they exist, do they exist on both sides of the sign?\r\n\r\nAre you able to update the prices on the sign?\r\n\r\nCall PWM Support at 866-796-7446 for assistance', 2, 120, 0, 60),
(3, 'NOS', 'Check and see if the sign is having any display issues. Ex: Flashing or Brightness\r\n\r\nIf the sign is flashing you will need a new sensor or have a sign technician disconnect the current one and set a static brightness.\r\n\r\nIf the sign is not bright enough call PWM Support at 866-796-7446 and a service technician can walk you through doing this.', 3, 300, 0, 60),
(5, 'OVT', 'Make note if the sign has any display issues.\r\n\r\nPlease turn the sign off at the breaker to prevent damaging any components. \r\n\r\nCall PWM Support at 866-796-7446 after for further instructions. ', 1, 60, 0, 180),
(6, 'NCP', 'Verify the Control Unit and Wireless Radio(if there is one) is powered on. The control unit has a screen that should have a display showing. The radio has led lights next to the antenna.\r\n\r\nVerify all 3 wires are secured into the wireless radio and not loose or broken.\r\n\r\nCall PWM Support at 866-796-7446 after for further instructions if the issue is not resolved.', 2, 300, 0, 60),
(7, 'NCA', 'Check control unit for loose wires and make note if any are found. \r\n\r\nVerify that flashing lights exist inside of the Control Unit.\r\n\r\nCall PWM to troubleshoot this issue.', 2, 60, 1, 60),
(8, 'CPF', 'Verify that the home screen of the Control Unit does not say "POS Unused" on the bottom half. \r\n\r\nCall PWM Support at 866-796-7446 after for further instructions. ', 3, 180, 0, 60),
(10, 'PCE', 'No action necessary.', 3, 60, 0, 300),
(11, 'RST', 'Verify the unit is plugged into a surge protector to protect from power surges.\r\n\r\nIf this issue is recurring you may need to replace the unit.', 3, 0, 0, 0),
(12, 'IVP', 'You must resend the correct price through the POS. \r\n\r\nIf this is not sucessful, send prices manually through the control unit to update the sign.\r\n\r\nIf you are unable to do this, call PWM at 866-796-7446.', 1, 0, 0, 0),
(13, 'CNS', 'Call the store and verify if the sign is displaying the correct price. If it is, have your supervisor close this problem.\r\n\r\nIf the sign displays an incorrect price. Please resend the correct price and recheck step one. \r\n\r\nIf the issue still exists, please contact PWM at 866-796-7446.', 1, 0, 0, 0),
(14, 'UAC', 'None Yet.', 2, 0, 0, 0),
(15, 'KSS-RPS', 'No defined actions.', 2, 15, 0, 15),
(16, 'KSS-SPM', 'No defined actions.', 1, 999, 0, 999);
-- --------------------------------------------------------
--
-- Table structure for table `sites`
--
CREATE TABLE IF NOT EXISTS `sites` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`number` varchar(20) COLLATE utf8_unicode_ci NOT NULL,
`name` varchar(75) COLLATE utf8_unicode_ci NOT NULL,
`phone` varchar(13) COLLATE utf8_unicode_ci NOT NULL,
`address` varchar(150) COLLATE utf8_unicode_ci NOT NULL,
`num_signs` int(1) NOT NULL DEFAULT '1',
`trans_rate` int(5) NOT NULL DEFAULT '5',
`connection` varchar(40) COLLATE utf8_unicode_ci NOT NULL,
`cu_version` varchar(5) COLLATE utf8_unicode_ci NOT NULL,
`amcs_version` varchar(5) COLLATE utf8_unicode_ci NOT NULL,
`active` varchar(3) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'Yes',
`pos` varchar(25) COLLATE utf8_unicode_ci NOT NULL,
`warranty_expires` int(20) NOT NULL,
`pc_manufacture` varchar(30) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'None',
`sign1` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`sign2` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`sign3` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`sign4` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=28 ;
-- --------------------------------------------------------
--
-- Table structure for table `system_config`
--
CREATE TABLE IF NOT EXISTS `system_config` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`refresh_time` int(5) NOT NULL,
`trans_rate` int(11) NOT NULL,
`max_price_change` float NOT NULL DEFAULT '0.25',
`email_list` text COLLATE utf8_unicode_ci NOT NULL,
`forward_cns_time` int(3) NOT NULL DEFAULT '15',
`backward_cns_time` int(3) NOT NULL DEFAULT '15',
`uac_start_time` varchar(5) COLLATE utf8_unicode_ci NOT NULL,
`uac_end_time` varchar(5) COLLATE utf8_unicode_ci NOT NULL,
`uac_overnight` int(1) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=2 ;
--
-- Dumping data for table `system_config`
--
INSERT INTO `system_config` (`id`, `refresh_time`, `trans_rate`, `max_price_change`, `email_list`, `forward_cns_time`, `backward_cns_time`, `uac_start_time`, `uac_end_time`, `uac_overnight`) VALUES
(1, 15, 30, 0.3, '', 10, 10, '22:00', '07:00', 0);
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
CREATE TABLE IF NOT EXISTS `users` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`email` varchar(40) COLLATE utf8_unicode_ci NOT NULL,
`password` varchar(32) COLLATE utf8_unicode_ci NOT NULL,
`level` int(1) NOT NULL DEFAULT '3',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=10 ;
--
-- Dumping data for table `users`
--
INSERT INTO `users` (`id`, `email`, `password`, `level`) VALUES
(2, 'jakec@p-w-m.com', '588f5104b178d204b8a599148a561c05', 10),
(3, 'britts@p-w-m.com', '5f4dcc3b5aa765d61d8327deb882cf99', 10),
(4, 'supervisor@p-w-m.com', '09348c20a019be0318387c08df7a783d', 2),
(5, 'user@p-w-m.com', 'ee11cbb19052e40b07aac0ca060c23ee', 1),
(9, 'admin@p-w-m.com', '21232f297a57a5a743894a0e4a801fc3', 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 */;
| true |
6d3e8b9ad613885ca7c8ff1e12aaea64492263d6 | SQL | Alexiis94/HospitalComunal | /DB_EXAMEN/examen_dai.sql | UTF-8 | 8,289 | 3.203125 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 4.6.5.2
-- https://www.phpmyadmin.net/
--
-- Servidor: 127.0.0.1
-- Tiempo de generación: 07-07-2017 a las 03:26:10
-- Versión del servidor: 10.1.21-MariaDB
-- Versión de PHP: 7.1.1
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 */;
--
-- Base de datos: `examen_dai`
--
create database examen_dai;
use examen_dai;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `consulta`
--
CREATE TABLE `consulta` (
`idAtencion` int(11) NOT NULL,
`fechaAtencion` date NOT NULL,
`rutPaciente` int(11) NOT NULL,
`rutMedico` int(11) NOT NULL,
`idEstado` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
--
-- Volcado de datos para la tabla `consulta`
--
INSERT INTO `consulta` (`idAtencion`, `fechaAtencion`, `rutPaciente`, `rutMedico`, `idEstado`) VALUES
(1, '2017-07-21', 19585652, 19585652, 1),
(2, '2017-07-21', 19585652, 19585652, 1),
(3, '2017-07-21', 1298739, 19585652, 1);
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `especialidad`
--
CREATE TABLE `especialidad` (
`idEspecialidad` int(11) NOT NULL,
`nombreEspecialidad` varchar(30) COLLATE utf8_bin NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
--
-- Volcado de datos para la tabla `especialidad`
--
INSERT INTO `especialidad` (`idEspecialidad`, `nombreEspecialidad`) VALUES
(1, 'Cirujano'),
(2, 'Nutricionista ');
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `estado_consulta`
--
CREATE TABLE `estado_consulta` (
`idEstado` int(11) NOT NULL,
`estado` varchar(20) COLLATE utf8_bin NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
--
-- Volcado de datos para la tabla `estado_consulta`
--
INSERT INTO `estado_consulta` (`idEstado`, `estado`) VALUES
(1, 'Agendada'),
(2, 'Confirmada'),
(3, 'Anulada'),
(4, 'Perdida'),
(5, 'Realizada');
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `medico`
--
CREATE TABLE `medico` (
`rut` int(11) NOT NULL,
`nombreMedioco` varchar(30) COLLATE utf8_bin NOT NULL,
`fechaContratacion` date NOT NULL,
`especialidad` int(11) NOT NULL,
`valorConsulta` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
--
-- Volcado de datos para la tabla `medico`
--
INSERT INTO `medico` (`rut`, `nombreMedioco`, `fechaContratacion`, `especialidad`, `valorConsulta`) VALUES
(19585652, 'Diego Diaz', '2017-07-06', 1, 30000);
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `paciente`
--
CREATE TABLE `paciente` (
`rut` int(9) NOT NULL,
`idPerfil` int(11) NOT NULL,
`idUsuario` int(11) NOT NULL,
`nombrePaciente` varchar(25) COLLATE utf8_bin NOT NULL,
`fechaNacimiento` date NOT NULL,
`sexo` varchar(10) COLLATE utf8_bin NOT NULL,
`Direccion` varchar(60) COLLATE utf8_bin NOT NULL,
`Telefono` varchar(13) COLLATE utf8_bin NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
--
-- Volcado de datos para la tabla `paciente`
--
INSERT INTO `paciente` (`rut`, `idPerfil`, `idUsuario`, `nombrePaciente`, `fechaNacimiento`, `sexo`, `Direccion`, `Telefono`) VALUES
(128397, 4, 10, 'Jaunito', '2017-07-03', 'Masculino', '68a74b602ec5c1b677acd40ffb92bafb', '+127612387'),
(1243124, 4, 8, 'Prueba Direccion', '2017-06-26', 'Femenino', '1bc29b36f623ba82aaf6724fd3b16718', '+123412312'),
(1298739, 4, 9, 'Prueba', '2017-07-06', 'Femenino', 'askdl', 'asodk'),
(19585652, 4, 2, 'Diego Diaz', '2017-06-06', 'Masculino', 'Fake Street 123', '+56927364528');
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `perfil`
--
CREATE TABLE `perfil` (
`idPerfil` int(11) NOT NULL,
`nombrePerfil` varchar(20) COLLATE utf8_bin NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
--
-- Volcado de datos para la tabla `perfil`
--
INSERT INTO `perfil` (`idPerfil`, `nombrePerfil`) VALUES
(1, 'Director'),
(2, 'Administrador'),
(3, 'Secretaria'),
(4, 'Paciente');
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `usuario`
--
CREATE TABLE `usuario` (
`idUsuario` int(11) NOT NULL,
`nombreUsuario` varchar(20) COLLATE utf8_bin NOT NULL,
`contrasenna` varchar(50) COLLATE utf8_bin NOT NULL,
`idPerfil` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
--
-- Volcado de datos para la tabla `usuario`
--
INSERT INTO `usuario` (`idUsuario`, `nombreUsuario`, `contrasenna`, `idPerfil`) VALUES
(1, 'ddiazj', 'a189c633d9995e11bf8607170ec9a4b8', 2),
(2, 'DiegoPaciente', 'a189c633d9995e11bf8607170ec9a4b8', 4),
(3, 'DiegoDirector', 'a189c633d9995e11bf8607170ec9a4b8', 1),
(4, 'DiegoSecretario', 'a189c633d9995e11bf8607170ec9a4b8', 3),
(8, 'Algo1', 'a189c633d9995e11bf8607170ec9a4b8', 4),
(9, 'Algo2', 'a189c633d9995e11bf8607170ec9a4b8', 4),
(10, 'Nuevo Juanito', 'a189c633d9995e11bf8607170ec9a4b8', 4);
--
-- Índices para tablas volcadas
--
--
-- Indices de la tabla `consulta`
--
ALTER TABLE `consulta`
ADD PRIMARY KEY (`idAtencion`),
ADD KEY `Consulta_FK_Paciente` (`rutPaciente`),
ADD KEY `Consulta_FK_Medico` (`rutMedico`),
ADD KEY `Consulta_FK_Estado` (`idEstado`);
--
-- Indices de la tabla `especialidad`
--
ALTER TABLE `especialidad`
ADD PRIMARY KEY (`idEspecialidad`);
--
-- Indices de la tabla `estado_consulta`
--
ALTER TABLE `estado_consulta`
ADD PRIMARY KEY (`idEstado`);
--
-- Indices de la tabla `medico`
--
ALTER TABLE `medico`
ADD PRIMARY KEY (`rut`),
ADD KEY `Medico_FK_Especialidad` (`especialidad`);
--
-- Indices de la tabla `paciente`
--
ALTER TABLE `paciente`
ADD PRIMARY KEY (`rut`),
ADD KEY `Paciente_FK_Usuario` (`idPerfil`),
ADD KEY `Paciente_FK_Usuario_3` (`idUsuario`);
--
-- Indices de la tabla `perfil`
--
ALTER TABLE `perfil`
ADD PRIMARY KEY (`idPerfil`);
--
-- Indices de la tabla `usuario`
--
ALTER TABLE `usuario`
ADD PRIMARY KEY (`idUsuario`),
ADD KEY `Usuario_FK_Perfil` (`idPerfil`);
--
-- AUTO_INCREMENT de las tablas volcadas
--
--
-- AUTO_INCREMENT de la tabla `consulta`
--
ALTER TABLE `consulta`
MODIFY `idAtencion` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT de la tabla `especialidad`
--
ALTER TABLE `especialidad`
MODIFY `idEspecialidad` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT de la tabla `estado_consulta`
--
ALTER TABLE `estado_consulta`
MODIFY `idEstado` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
--
-- AUTO_INCREMENT de la tabla `perfil`
--
ALTER TABLE `perfil`
MODIFY `idPerfil` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT de la tabla `usuario`
--
ALTER TABLE `usuario`
MODIFY `idUsuario` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11;
--
-- Restricciones para tablas volcadas
--
--
-- Filtros para la tabla `consulta`
--
ALTER TABLE `consulta`
ADD CONSTRAINT `Consulta_FK_Estado` FOREIGN KEY (`idEstado`) REFERENCES `estado_consulta` (`idEstado`),
ADD CONSTRAINT `Consulta_FK_Medico` FOREIGN KEY (`rutMedico`) REFERENCES `medico` (`rut`),
ADD CONSTRAINT `Consulta_FK_Paciente` FOREIGN KEY (`rutPaciente`) REFERENCES `paciente` (`rut`);
--
-- Filtros para la tabla `medico`
--
ALTER TABLE `medico`
ADD CONSTRAINT `Medico_FK_Especialidad` FOREIGN KEY (`especialidad`) REFERENCES `especialidad` (`idEspecialidad`);
--
-- Filtros para la tabla `paciente`
--
ALTER TABLE `paciente`
ADD CONSTRAINT `Paciente_FK_Perfil` FOREIGN KEY (`idPerfil`) REFERENCES `perfil` (`idPerfil`),
ADD CONSTRAINT `Paciente_FK_Usuario_3` FOREIGN KEY (`idUsuario`) REFERENCES `usuario` (`idUsuario`);
--
-- Filtros para la tabla `usuario`
--
ALTER TABLE `usuario`
ADD CONSTRAINT `Usuario_FK_Perfil` FOREIGN KEY (`idPerfil`) REFERENCES `perfil` (`idPerfil`);
/*!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 */;
| true |
229af544c3aa4f1ecfdf35e1095d9c488b812d37 | SQL | bhujyo/Data_science | /SQL/sql4.sql | UTF-8 | 141 | 3.203125 | 3 | [] | no_license | select count(*) FROM(
SELECT docid
FROM (frequency)
WHERE term = 'law'
UNION
SELECT docid
FROM (frequency)
WHERE term = 'legal');
| true |
457d51d6099251be557235b25ee4d68695cac591 | SQL | andersilva1/petline | /bd/petline.sql | UTF-8 | 18,131 | 2.796875 | 3 | [] | no_license | /*
Navicat MySQL Data Transfer
Source Server : local
Source Server Version : 50505
Source Host : localhost:3306
Source Database : petline
Target Server Type : MYSQL
Target Server Version : 50505
File Encoding : 65001
Date: 2018-11-08 16:36:19
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for `agenda`
-- ----------------------------
DROP TABLE IF EXISTS `agenda`;
CREATE TABLE `agenda` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`dt_passeio` date NOT NULL,
`hora_inicio` time DEFAULT NULL,
`hora_fim` time DEFAULT NULL,
`descricao` text,
`ativo` char(1) DEFAULT NULL,
`id_usuario` int(11) DEFAULT NULL,
`dt_alteracao` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `idx_agenda` (`id`),
KEY `fk_id_usuario` (`id_usuario`),
CONSTRAINT `fk_id_usuario` FOREIGN KEY (`id_usuario`) REFERENCES `usuario` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=40 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of agenda
-- ----------------------------
INSERT INTO `agenda` VALUES ('10', '2018-10-20', '08:00:00', '18:00:00', 'Estou disponível', '1', '3', '2018-10-25 13:23:17');
INSERT INTO `agenda` VALUES ('11', '2018-10-21', '08:00:00', '12:00:00', 'Estou disponível', '1', '3', '2018-10-25 13:23:49');
INSERT INTO `agenda` VALUES ('12', '2018-10-22', '12:00:00', '18:00:00', 'Estou disponível', '1', '3', '2018-10-25 13:24:03');
INSERT INTO `agenda` VALUES ('13', '2018-10-23', '15:00:00', '18:00:00', 'Esses são os meus dias disponíveis', '1', '3', '2018-10-25 13:24:16');
INSERT INTO `agenda` VALUES ('14', '2018-10-24', '16:00:00', '20:00:00', 'Disponível', '1', '3', '2018-10-25 13:24:36');
INSERT INTO `agenda` VALUES ('15', '2018-10-25', '17:00:00', '21:00:00', 'disponivel', '1', '3', '2018-10-25 13:24:54');
INSERT INTO `agenda` VALUES ('16', '2018-10-26', '08:00:00', '10:00:00', 'disponivel', '1', '3', '2018-10-25 13:25:15');
INSERT INTO `agenda` VALUES ('17', '2018-10-27', '11:00:00', '12:00:00', '', '1', '3', '2018-10-25 13:25:27');
INSERT INTO `agenda` VALUES ('23', '2018-10-28', '15:00:00', '16:00:00', '', '1', '3', '2018-10-25 14:25:33');
INSERT INTO `agenda` VALUES ('35', '2018-10-29', '18:00:00', '22:00:00', '', '1', '3', '2018-11-02 13:13:29');
INSERT INTO `agenda` VALUES ('36', '2018-10-30', '08:00:00', '18:00:00', 'estou livre', '1', '3', '2018-11-02 13:13:49');
INSERT INTO `agenda` VALUES ('37', '2018-10-31', '12:00:00', '18:00:00', '', '1', '3', '2018-11-02 13:14:02');
INSERT INTO `agenda` VALUES ('38', '2018-11-01', '12:00:00', '18:00:00', '', '1', '3', '2018-11-02 13:14:21');
INSERT INTO `agenda` VALUES ('39', '2018-11-02', '08:00:00', '12:00:00', '', '1', '3', '2018-11-02 13:14:44');
-- ----------------------------
-- Table structure for `conta`
-- ----------------------------
DROP TABLE IF EXISTS `conta`;
CREATE TABLE `conta` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`agencia` varchar(255) DEFAULT NULL,
`tipo_conta` varchar(255) DEFAULT NULL,
`numero` varchar(255) DEFAULT NULL,
`dt_alteracao` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`cartao` varchar(255) DEFAULT NULL,
`id_usuario` int(11) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `idx_conta` (`id`),
KEY `fk_id_usuario_4` (`id_usuario`),
CONSTRAINT `fk_id_usuario_4` FOREIGN KEY (`id_usuario`) REFERENCES `usuario` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of conta
-- ----------------------------
-- ----------------------------
-- Table structure for `pacote`
-- ----------------------------
DROP TABLE IF EXISTS `pacote`;
CREATE TABLE `pacote` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`nome` varchar(255) NOT NULL,
`quantidade_passeio` int(11) NOT NULL,
`dt_passeio` date NOT NULL,
`hora_inicio` time DEFAULT NULL,
`hora_fim` time DEFAULT NULL,
`id_usuario` int(11) DEFAULT NULL,
`dt_alteracao` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`ativo` char(1) DEFAULT NULL,
`pet_pego` char(1) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `idx_pacote` (`id`),
KEY `fk_id_usuario_2` (`id_usuario`),
CONSTRAINT `fk_id_usuario_2` FOREIGN KEY (`id_usuario`) REFERENCES `usuario` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=28 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of pacote
-- ----------------------------
INSERT INTO `pacote` VALUES ('2', 'LINE_BASIC', '1', '2018-10-20', '07:18:00', '08:18:00', '2', '2018-11-07 12:59:28', '0', '0');
INSERT INTO `pacote` VALUES ('3', 'LINE_BASIC', '1', '2018-10-21', '05:05:00', '05:05:00', '2', '2018-11-07 13:00:59', '0', '0');
INSERT INTO `pacote` VALUES ('4', 'LINE_BASIC', '1', '2018-10-23', '10:00:00', '11:00:00', '2', '2018-11-07 13:04:19', '1', '1');
INSERT INTO `pacote` VALUES ('5', 'LINE_BASIC', '1', '2018-10-24', '10:00:00', '11:00:00', '2', '2018-11-07 13:34:22', '1', '1');
INSERT INTO `pacote` VALUES ('6', 'LINE_BASIC', '1', '2018-10-25', '10:00:00', '11:00:00', '2', '2018-11-07 12:59:28', '1', '0');
INSERT INTO `pacote` VALUES ('7', 'LINE_BASIC', '1', '2018-10-26', '10:00:00', '11:00:00', '2', '2018-11-07 12:59:28', '1', '0');
INSERT INTO `pacote` VALUES ('8', 'LINE_BASIC', '1', '2018-10-27', '10:00:00', '11:00:00', '2', '2018-11-07 12:59:28', '1', '0');
INSERT INTO `pacote` VALUES ('9', 'LINE_BASIC', '1', '2018-10-28', '11:00:00', '12:00:00', '2', '2018-11-07 12:59:28', '1', '0');
INSERT INTO `pacote` VALUES ('12', 'LINE_BASIC', '1', '2018-10-12', '15:09:00', '16:09:00', '8', '2018-11-07 12:59:28', '1', '0');
INSERT INTO `pacote` VALUES ('13', 'LINE_BASIC', '1', '2018-10-12', '18:00:00', '20:00:00', '8', '2018-11-07 12:59:28', '1', '0');
INSERT INTO `pacote` VALUES ('14', 'LINE_BASIC', '1', '2018-11-05', '05:05:00', '05:05:00', '8', '2018-11-07 12:59:28', '1', '0');
INSERT INTO `pacote` VALUES ('15', 'RICH_DOG', '1', '2018-10-20', '10:10:00', '11:10:00', '7', '2018-11-07 12:59:28', '0', '0');
INSERT INTO `pacote` VALUES ('16', 'RICH_DOG', '1', '2018-10-21', '10:00:00', '11:00:00', '7', '2018-11-07 12:59:28', '1', '0');
INSERT INTO `pacote` VALUES ('17', 'RICH_DOG', '1', '2018-10-22', '12:00:00', '13:00:00', '7', '2018-11-07 12:59:28', '1', '0');
INSERT INTO `pacote` VALUES ('18', 'RICH_DOG', '1', '2018-10-23', '14:00:00', '15:00:00', '7', '2018-11-07 12:59:28', '1', '0');
INSERT INTO `pacote` VALUES ('19', 'RICH_DOG', '1', '2018-10-24', '15:00:00', '16:00:00', '7', '2018-11-07 12:59:28', '1', '0');
INSERT INTO `pacote` VALUES ('20', 'RICH_DOG', '1', '2018-10-25', '12:00:00', '13:00:00', '7', '2018-11-07 12:59:28', '1', '0');
INSERT INTO `pacote` VALUES ('21', 'RICH_DOG', '1', '2018-10-26', '13:00:00', '14:00:00', '7', '2018-11-07 12:59:28', '1', '0');
INSERT INTO `pacote` VALUES ('22', 'RICH_DOG', '1', '2018-10-27', '13:10:00', '13:50:00', '7', '2018-11-07 12:59:28', '1', '0');
INSERT INTO `pacote` VALUES ('23', 'RICH_DOG', '1', '2018-10-28', '05:10:00', '06:00:00', '7', '2018-11-07 12:59:28', '1', '0');
INSERT INTO `pacote` VALUES ('24', 'RICH_DOG', '1', '2018-10-29', '07:00:00', '08:00:00', '7', '2018-11-07 12:59:28', '1', '0');
INSERT INTO `pacote` VALUES ('25', 'RICH_DOG', '1', '2018-10-30', '13:00:00', '14:00:00', '7', '2018-11-07 12:59:28', '1', '0');
INSERT INTO `pacote` VALUES ('26', 'RICH_DOG', '1', '2018-11-01', '10:00:00', '10:30:00', '7', '2018-11-07 12:59:28', '1', '0');
INSERT INTO `pacote` VALUES ('27', 'LINE_BASIC', '1', '2018-11-06', '09:00:00', '10:00:00', '2', '2018-11-07 12:59:28', '1', '0');
-- ----------------------------
-- Table structure for `passeador`
-- ----------------------------
DROP TABLE IF EXISTS `passeador`;
CREATE TABLE `passeador` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`nome` varchar(255) NOT NULL,
`sobrenome` varchar(255) NOT NULL,
`login` varchar(25) DEFAULT NULL,
`senha` varchar(25) NOT NULL,
`email` varchar(255) NOT NULL,
`telefone` varchar(50) NOT NULL,
`rg` varchar(20) NOT NULL,
`cpf` varchar(25) NOT NULL,
`descricao` text,
`dt_nascimento` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`dt_alteracao` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`ativo` int(11) DEFAULT NULL,
`cidade` varchar(255) DEFAULT NULL,
`pais` varchar(255) DEFAULT NULL,
`uf` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `cpf` (`cpf`),
UNIQUE KEY `login` (`login`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of passeador
-- ----------------------------
-- ----------------------------
-- Table structure for `pesquisa`
-- ----------------------------
DROP TABLE IF EXISTS `pesquisa`;
CREATE TABLE `pesquisa` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`id_passeador` int(11) DEFAULT NULL,
`pergunta` varchar(255) DEFAULT NULL,
`nota` varchar(20) NOT NULL,
`dt_alteracao` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `fk_passeio` (`id_passeador`),
KEY `idx_pesquisa` (`id`),
CONSTRAINT `fk_passeio` FOREIGN KEY (`id_passeador`) REFERENCES `passeador` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of pesquisa
-- ----------------------------
-- ----------------------------
-- Table structure for `pet`
-- ----------------------------
DROP TABLE IF EXISTS `pet`;
CREATE TABLE `pet` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`nome` varchar(255) NOT NULL,
`raca` varchar(255) NOT NULL,
`peso` varchar(25) NOT NULL,
`cor` varchar(25) NOT NULL,
`dt_nascimento` date NOT NULL DEFAULT '0000-00-00',
`dt_alteracao` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`descricao` text,
`id_usuario` int(11) DEFAULT NULL,
`ativo` char(1) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `idx_pet` (`id`),
KEY `fk_id_usuario_3` (`id_usuario`),
CONSTRAINT `fk_id_usuario_3` FOREIGN KEY (`id_usuario`) REFERENCES `usuario` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of pet
-- ----------------------------
INSERT INTO `pet` VALUES ('1', 'Dick 2', 'Labrador 3', '15', 'Preto e branco', '2018-10-16', '2018-10-16 13:42:02', 'Ele é um cachorro e bonito', '1', '1');
INSERT INTO `pet` VALUES ('2', 'Dick Vigarista', 'Labrador', '50', 'Preto e branco', '2015-10-10', '2018-10-15 14:05:14', 'Ele é um cachorro', '1', '1');
INSERT INTO `pet` VALUES ('4', 'Nina', 'vira-lata', '12', 'preta', '2018-10-15', '2018-10-16 13:36:20', 'É uma cachorro linda', '2', '1');
INSERT INTO `pet` VALUES ('5', 'Nina', 'poodle', '15', 'preta', '2018-10-15', '2018-11-02 16:01:47', 'Cachorra', '2', '0');
INSERT INTO `pet` VALUES ('6', 'Nina', 'vira-lata', '12', 'branco', '0000-00-00', '2018-10-25 19:35:21', 'Nina é linda', '8', '1');
INSERT INTO `pet` VALUES ('8', 'Lindinho', 'Sem Raca Definida', '80', 'Preto', '0000-00-00', '2018-11-02 12:26:16', 'Ele é muito brabo', '1', '1');
INSERT INTO `pet` VALUES ('9', 'Branquinha', 'Sem Raca Definida', '10', 'Branco', '2015-01-01', '2018-11-02 12:56:36', 'Ela é bem mansa', '1', '1');
INSERT INTO `pet` VALUES ('10', 'Peludinho', 'Afegao Hound', '20', 'Amarelo', '2012-12-12', '2018-11-02 16:02:02', 'É lindo', '2', '0');
INSERT INTO `pet` VALUES ('11', 'Mel', 'ShihTzu', '10', 'Preto', '2018-02-01', '2018-11-02 13:12:06', 'É linda', '7', '1');
-- ----------------------------
-- Table structure for `servico`
-- ----------------------------
DROP TABLE IF EXISTS `servico`;
CREATE TABLE `servico` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`id_passeador` int(11) NOT NULL,
`id_pacote` int(11) NOT NULL,
`id_pet` int(11) NOT NULL,
`id_agenda` int(11) DEFAULT NULL,
`dt_alteracao` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`id_cliente` int(11) DEFAULT NULL,
`ativo` char(1) DEFAULT NULL,
`valor_pacote` decimal(10,0) NOT NULL,
PRIMARY KEY (`id`),
KEY `fk_id_usuario_5` (`id_passeador`),
KEY `fk_id_pacote` (`id_pacote`),
KEY `fk_id_pet` (`id_pet`),
KEY `fk_id_agenda` (`id_agenda`),
KEY `fk_id_usuario_6` (`id_cliente`),
CONSTRAINT `fk_id_agenda` FOREIGN KEY (`id_agenda`) REFERENCES `agenda` (`id`),
CONSTRAINT `fk_id_pacote` FOREIGN KEY (`id_pacote`) REFERENCES `pacote` (`id`),
CONSTRAINT `fk_id_pet` FOREIGN KEY (`id_pet`) REFERENCES `pet` (`id`),
CONSTRAINT `fk_id_usuario_5` FOREIGN KEY (`id_passeador`) REFERENCES `usuario` (`id`),
CONSTRAINT `fk_id_usuario_6` FOREIGN KEY (`id_cliente`) REFERENCES `usuario` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of servico
-- ----------------------------
INSERT INTO `servico` VALUES ('1', '3', '2', '4', null, '2018-11-07 12:54:14', '2', '0', '0');
INSERT INTO `servico` VALUES ('2', '3', '2', '5', null, '2018-11-07 12:54:14', '2', '0', '0');
INSERT INTO `servico` VALUES ('3', '3', '2', '4', null, '2018-11-07 12:54:14', '2', '1', '0');
INSERT INTO `servico` VALUES ('4', '3', '2', '4', null, '2018-11-07 12:54:14', '2', '1', '0');
INSERT INTO `servico` VALUES ('5', '3', '2', '4', null, '2018-11-07 12:54:14', '2', '1', '0');
INSERT INTO `servico` VALUES ('6', '3', '2', '10', null, '2018-11-07 12:54:14', '2', '0', '0');
INSERT INTO `servico` VALUES ('7', '3', '15', '11', null, '2018-11-07 12:54:14', '7', '0', '0');
INSERT INTO `servico` VALUES ('8', '3', '15', '11', null, '2018-11-07 12:54:14', '7', '0', '0');
INSERT INTO `servico` VALUES ('11', '3', '15', '11', null, '2018-11-07 12:54:14', '7', '0', '0');
-- ----------------------------
-- Table structure for `usuario`
-- ----------------------------
DROP TABLE IF EXISTS `usuario`;
CREATE TABLE `usuario` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`nome` varchar(255) NOT NULL,
`sobrenome` varchar(255) NOT NULL,
`login` varchar(25) NOT NULL,
`senha` varchar(50) NOT NULL,
`email` varchar(255) NOT NULL,
`telefone` varchar(50) NOT NULL,
`rg` varchar(20) NOT NULL,
`cpf` varchar(25) NOT NULL,
`uf` char(2) NOT NULL,
`cep` varchar(20) NOT NULL,
`cidade` varchar(255) NOT NULL,
`rua` varchar(255) NOT NULL,
`bairro` varchar(255) NOT NULL,
`dt_nascimento` date NOT NULL,
`descricao` text,
`perfil` char(3) NOT NULL,
`ativo` int(11) DEFAULT NULL,
`dt_alteracao` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `cpf` (`cpf`),
UNIQUE KEY `login` (`login`),
KEY `idx_cliente` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of usuario
-- ----------------------------
INSERT INTO `usuario` VALUES ('1', 'Administrador', 'Petline', 'admin', '23d42f5f3f66498b2c8ff4c20b8c5ac826e47146', 'administrador@petline.com', '(00) 00000-0', '00000000', '000000000', 'DF', '72745-011', 'Brasília', 'Quadra 45 Conjunto K', 'Vila São José (Brazlândia)', '2018-10-09', '', 'adm', '1', '2018-09-13 20:31:02');
INSERT INTO `usuario` VALUES ('2', 'Cliente', 'Petline', 'cliente', 'f7c3bc1d808e04732adf679965ccc34ca7ae3441', 'cliente@petline.com', '(61) 99356-4879', '19.878.131-6', '635.460.591-23', 'MG', '30510-410', 'Belo Horizonte', 'Rua Azaléia', 'Nova Gameleira', '2018-10-16', '', 'cli', '1', '2018-10-18 11:30:04');
INSERT INTO `usuario` VALUES ('3', 'Passeador', 'Petline', 'passeador', 'f7c3bc1d808e04732adf679965ccc34ca7ae3441', 'passeador@passeador.com', '(61) 93265-9898', '16.589.876', '171.418.723-37', 'RJ', '23575-385', 'Rio de Janeiro', 'Travessa Dom Diniz', 'Santa Cruz', '2018-10-09', '', 'pas', '1', '2018-10-18 11:29:24');
INSERT INTO `usuario` VALUES ('4', 'Rafael', 'Souza', 'rafael', 'f7c3bc1d808e04732adf679965ccc34ca7ae3441', 'rafael@gmail.com', '(65) 49846-5168', '21.498.465-1', '726.491.981-17', 'GO', '72855-239', 'Luziânia', 'Quadra 239', 'Parque Industrial Mingone', '2018-10-04', '', 'cli', '1', '2018-11-05 14:32:51');
INSERT INTO `usuario` VALUES ('5', 'Rafael', 'Rodrigues', 'rafael1', '1f49d78abdcbe13fcf991ec4a4ee60fcdf8b7f4b', 'rafael2@gmail.com', '(44) 44444-4444', '65.198.465-1', '426.187.374-58', 'DF', '72738-000', 'Brasília', 'Quadra 38', 'Vila São José (Brazlândia)', '2018-10-11', 'Onde quer que você esteja, você sempre estará lá!!!!!', 'pas', '1', '2018-09-20 13:59:05');
INSERT INTO `usuario` VALUES ('6', 'Evaldo', 'Junior', 'evaldo', '3e2fc5e632b74c065a9a5efa054acacd7b14475c', 'evaldo@gmail.com', '(61) 32132-1321', '11.111.284-8', '000.000.000-00', 'DF', '72745-011', 'Brasília', 'Quadra 45 Conjunto K', 'Vila São José (Brazlândia)', '2018-10-09', 'Sou passeador e gosto de passear com cães', 'pas', '1', '2018-09-20 19:25:32');
INSERT INTO `usuario` VALUES ('7', 'Anderson', 'Rodrigues', 'anderson1', 'f7c3bc1d808e04732adf679965ccc34ca7ae3441', 'andersonrodrigues209@gmail.com', '(61) 99332-4195', '16.546.848-6', '057.799.111-69', 'DF', '72745-011', 'Brasília', 'Quadra 45 Conjunto K', 'Vila São José (Brazlândia)', '1996-11-17', '', 'cli', '1', '2018-11-06 12:52:08');
INSERT INTO `usuario` VALUES ('8', 'Gislane', 'Santana', 'gislane', 'f7c3bc1d808e04732adf679965ccc34ca7ae3441', 'santana1204@gmail.com', '(61) 99999-9999', '11.111.111-1', '830.002.402-68', '..', '72745-011', '...', '...', '...', '0000-00-00', '', 'cli', '1', '2018-10-25 19:30:51');
INSERT INTO `usuario` VALUES ('9', 'Sarah', 'Guedes', 'sarahlinda', 'e94ddd1dc4bee199d0a5452ef42ff4205dbbc9ea', 'sarah@gmail.com', '(61) 95651-6849', '2151551', '629.353.633-96', 'DF', '72738-000', 'Brasília', 'Quadra 38', 'Vila São José (Brazlândia)', '2018-01-01', 'A Sarah é MUITO feia!', 'pas', '1', '2018-11-01 22:26:51');
-- ----------------------------
-- Function structure for `fcRetornaValorPacote`
-- ----------------------------
DROP FUNCTION IF EXISTS `fcRetornaValorPacote`;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` FUNCTION `fcRetornaValorPacote`(pIdUsuario INT) RETURNS varchar(9) CHARSET utf8
BEGIN
DECLARE vPacote VARCHAR(255);
DECLARE vValor VARCHAR(255);
SET vPacote = (
SELECT
nome
FROM pacote
WHERE
id_usuario = pIdUsuario
AND ativo = 1
GROUP BY nome
);
IF (vPacote IS NOT NULL) THEN
IF (vPacote = 'LINE_BASIC') THEN SET vValor = 'R$ 339,72';
ELSE
IF (vPacote = 'RICH_DOG') THEN SET vValor = 'R$ 482,76';
ELSE
SET vValor = 'R$ 835,89';
END IF;
END IF;
ELSE
SET vValor = 'R$ 0,00';
END IF;
RETURN vValor;
END
;;
DELIMITER ;
| true |
7e205f8716f0299df9f121215ac1f29023b46fe6 | SQL | danthomas/DTS.GymManager | /DTS.GymManager.Database/Tables/Workout.sql | UTF-8 | 448 | 3.015625 | 3 | [] | no_license | CREATE TABLE Workout
(
WorkoutId INT IDENTITY(1, 1) NOT NULL
, WorkoutTypeId TINYINT NOT NULL
, MemberId INT NULL
, Duration TIME NULL
, IncreasedReps TINYINT NULL
, Description VARCHAR(200) NOT NULL
, CONSTRAINT PK_Workout PRIMARY KEY (WorkoutId)
, CONSTRAINT FK_Workout_WorkoutType FOREIGN KEY (WorkoutTypeId) REFERENCES WorkoutType (WorkoutTypeId)
, CONSTRAINT FK_Workout_Member FOREIGN KEY (MemberId) REFERENCES Member (MemberId)
)
| true |
766aae85fe010e22922c4576127bdaa043bdca1e | SQL | hasib135/Restaurant-Management-System-Using-PL-SQL-in-Oracal10g | /CODES/query_link_on_employee/delete_employee_type_checks_fk.sql | UTF-8 | 907 | 3.21875 | 3 | [] | no_license | set serveroutput on;
--create or replace procedure insert_employee() is
accept type_id number prompt 'enter type_id to delete : '
declare
a number;
temp number;
b number;
begin
a:=0;
temp:=0;
b:=0;
b:='&type_id';
select count(*) into temp from employee1@site_link where type_id=b;
select greatest(temp,a) into a from dual;
select count(*) into temp from employee2@site_link where type_id=b;
select greatest(temp,a) into a from dual;
select count(*) into temp from employee3 where type_id=b;
select greatest(temp,a) into a from dual;
select count(*) into temp from employee1@site_link where type_id=b;
select greatest(temp,a) into a from dual;
if a=0 then
delete from type@site_link where type_id=b;
dbms_output.put_line('successful deletation');
else
dbms_output.put_line('the type is reffered in employee_table you can not delete it');
end if;
commit;
end;
/
| true |
325a3a2ece01c62aa6f85dc15e589f1781fc30fc | SQL | dyps/Capacitacao_PayStore_02 | /src/main/resources/db/migration/schema/V20210304210000__create_table_livro_categorias_livro.sql | UTF-8 | 299 | 2.78125 | 3 | [] | no_license | create table tb_book_book_categories (
books_id int8 not null,
book_categories_id int8 not null,
constraint book_categories_idFK foreign key (book_categories_id) references tb_book_category,
constraint books_idFK foreign key (books_id) references tb_book
);
| true |
f73ced2c3c7589a9fb01a17b679caa291d2bc62b | SQL | ghas-results/b-con | /sql/dash_invoice_report.sql | UTF-8 | 7,662 | 2.890625 | 3 | [
"Apache-2.0"
] | permissive | -- Copyright 2020 Google LLC
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
CREATE OR REPLACE TABLE `$$dash_invoice_report$$` AS (
WITH reports_orig AS (
SELECT
partner,
partner_id,
advertiser,
advertiser_id,
advertiser_status,
advertiser_integration_code,
campaign,
campaign_id,
insertion_order,
insertion_order_id,
insertion_order_status,
insertion_order_integration_code,
line_item,
line_item_id,
advertiser_currency,
SAFE.REGEXP_EXTRACT(campaign, r'[A-Z]{4}[0-9]{4}') AS schedule_number,
SAFE_CAST(media_cost_advertiser_currency AS FLOAT64) AS media_cost_advertiser_currency,
SAFE_CAST(platform_fee_adv_currency AS FLOAT64) AS platform_fee_adv_currency,
SAFE_CAST(REPLACE(platform_fee_rate,'%','') AS FLOAT64) AS platform_fee_rate,
SAFE_CAST(cpm_fee_1_adv_currency AS FLOAT64) AS cpm_fee_1_adv_currency,
SAFE_CAST(cpm_fee_2_adv_currency AS FLOAT64) AS cpm_fee_2_adv_currency,
SAFE_CAST(cpm_fee_3_adv_currency AS FLOAT64) AS cpm_fee_3_adv_currency,
SAFE_CAST(cpm_fee_4_adv_currency AS FLOAT64) AS cpm_fee_4_adv_currency,
SAFE_CAST(cpm_fee_5_adv_currency AS FLOAT64) AS cpm_fee_5_adv_currency,
SAFE_CAST(media_fee_1_adv_currency AS FLOAT64) AS media_fee_1_adv_currency,
SAFE_CAST(media_fee_2_adv_currency AS FLOAT64) AS media_fee_2_adv_currency,
SAFE_CAST(media_fee_3_adv_currency AS FLOAT64) AS media_fee_3_adv_currency,
SAFE_CAST(media_fee_4_adv_currency AS FLOAT64) AS media_fee_4_adv_currency,
SAFE_CAST(media_fee_5_adv_currency AS FLOAT64) AS media_fee_5_adv_currency,
SAFE_CAST(data_fees_adv_currency AS FLOAT64) AS data_fees_adv_currency,
SAFE_CAST(revenue_adv_currency AS FLOAT64) AS revenue_adv_currency,
SAFE_CAST(billable_cost_adv_currency AS FLOAT64) AS billable_cost_adv_currency,
SAFE_CAST(report_start_date AS TIMESTAMP) AS report_start_date,
SAFE_CAST(report_end_date AS TIMESTAMP) AS report_end_date,
SAFE_CAST(insert_time AS TIMESTAMP) AS insert_time,
SAFE_CAST(impressions AS INT64) AS impressions,
SAFE_CAST(clicks AS INT64) AS clicks,
FROM `$$reports$$`
)
, invoices_orig AS (
SELECT
bill_to,
invoice_number,
PARSE_TIMESTAMP('%d %b %Y', invoice_date) AS invoice_date,
PARSE_TIMESTAMP('%d %b %Y', due_date) AS invoice_due_date,
billing_id,
currency,
SAFE_CAST(REPLACE(invoice_amount,',','') AS FLOAT64) AS invoice_amount,
product,
SAFE_CAST(REPLACE(gst_pct,'%','') AS FLOAT64) AS gst_pct,
SAFE_CAST(gst_val AS FLOAT64) AS gst_val,
SAFE_CAST(insert_time AS TIMESTAMP) AS insert_time
FROM `$$invoices$$`
)
, invoice_entries_orig AS (
SELECT
order_name,
purchase_order,
description,
quantity,
uom,
SAFE_CAST(REPLACE(amount, ',','') AS FLOAT64) AS invoice_entry_amount,
invoice_number,
SAFE_CAST(insert_time AS TIMESTAMP) AS insert_time
FROM `$$invoice_entries$$`
)
, reports AS (
SELECT
r.*
FROM reports_orig AS r
JOIN (
SELECT
advertiser_id,
campaign_id,
insertion_order_id,
line_item_id,
report_start_date,
report_end_date,
MAX(SAFE_CAST (insert_time AS TIMESTAMP)) AS insert_time
FROM reports_orig
GROUP BY 1,2,3,4,5,6
) AS m
USING(advertiser_id, campaign_id, insertion_order_id, line_item_id, report_start_date, report_end_date, insert_time)
)
, invoices AS (
SELECT i.*
FROM invoices_orig AS i
JOIN (
SELECT
invoice_number,
invoice_due_date,
billing_id,
bill_to,
currency,
invoice_amount AS invoice_amount,
product,
gst_pct,
gst_val,
MAX(insert_time) AS insert_time
FROM invoices_orig
GROUP BY 1,2,3,4,5,6,7,8,9
) AS m
USING(invoice_number, insert_time)
)
, invoice_entries AS (
SELECT
e.*,
LOWER(TRIM(description)) AS description_formatted
FROM invoice_entries_orig AS e
JOIN (
SELECT invoice_number, MAX(insert_time) AS insert_time
FROM invoice_entries_orig
GROUP BY 1
) AS m
USING(invoice_number, insert_time)
)
, invoice_entries_parsed AS (
SELECT
invoice_number,
REGEXP_EXTRACT(description, 'Partner:(.*?)ID: .*') AS partner,
REGEXP_EXTRACT(description, 'Partner:.*?ID: ([0-9]*)') AS partner_id,
REGEXP_EXTRACT(description, 'Advertiser:(.*?)ID: .*') AS advertiser,
REGEXP_EXTRACT(description, 'Advertiser:.*?ID: ([0-9]*)') AS advertiser_id,
REGEXP_EXTRACT(description, 'Campaign:(.*?)ID: .*') AS campaign,
REGEXP_EXTRACT(description, 'Campaign:.*?ID: ([0-9]*)') AS campaign_id,
REGEXP_EXTRACT(description, 'Insertion order:(.*?)ID: .*') AS insertion_order,
REGEXP_EXTRACT(description, 'Insertion order:.*?ID: ([0-9]*)') AS insertion_order_id,
invoice_entry_amount,
SPLIT(description_formatted, '–')[OFFSET(0)] AS desc_reason,
description_formatted,
uom,
quantity,
FROM invoice_entries
)
, report1 AS (
SELECT
partner,
partner_id,
advertiser,
advertiser_id,
campaign,
campaign_id,
insertion_order,
insertion_order_id,
report_end_date,
CASE
WHEN schedule_number IS NULL THEN 'NA'
ELSE schedule_number
END AS schedule_number,
SUM(media_cost_advertiser_currency + platform_fee_adv_currency + cpm_fee_1_adv_currency + media_fee_2_adv_currency) AS amount,
SUM(revenue_adv_currency) AS revenue_adv_currency,
SUM(billable_cost_adv_currency) AS billable_cost_adv_currency
FROM reports AS r
GROUP BY 1,2,3,4,5,6,7,8,9,10
)
, invoice1 AS (
SELECT
partner,
partner_id,
advertiser,
advertiser_id,
campaign,
campaign_id,
insertion_order,
insertion_order_id,
invoice_number,
invoice_date,
invoice_due_date,
billing_id,
bill_to,
currency,
product,
uom,
quantity,
gst_pct,
invoice_amount,
gst_val,
SUM(invoice_entry_amount) as sum_invoice_entry_amount
FROM invoice_entries_parsed
JOIN invoices USING(invoice_number)
GROUP BY 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20
)
SELECT
COALESCE(i.partner, r.partner) AS partner,
COALESCE(i.partner_id, r.partner_id) AS partner_id,
COALESCE(i.advertiser, r.advertiser) AS advertiser,
COALESCE(i.advertiser_id, r.advertiser_id) AS advertiser_id,
COALESCE(i.campaign, r.campaign) AS campaign,
COALESCE(i.campaign_id, r.campaign_id) AS campaign_id,
COALESCE(i.insertion_order, r.insertion_order) AS insertion_order,
COALESCE(i.insertion_order_id, r.insertion_order_id) AS insertion_order_id,
i.invoice_number,
i.invoice_amount,
r.report_end_date,
i.invoice_date,
i.invoice_due_date,
i.currency,
i.bill_to,
i.gst_val,
i.gst_pct,
i.uom,
i.quantity,
i.product,
r.schedule_number,
r.amount AS report_amount,
i.sum_invoice_entry_amount,
r.amount-i.sum_invoice_entry_amount AS diff,
r.revenue_adv_currency AS revenue_adv_currency,
r.billable_cost_adv_currency AS billable_cost_adv_currency
FROM report1 AS r
FULL OUTER JOIN invoice1 AS i
ON r.advertiser_id = i.advertiser_id
AND r.campaign_id = i.campaign_id
AND r.insertion_order_id = i.insertion_order_id
AND r.report_end_date = i.invoice_date
ORDER BY i.invoice_number
)
| true |
40e6f99241c56ae2d56986ab7460142024e38adf | SQL | mvaldetaro/JAVA | /d2_orientacao_a_objetos_com_uml_e_modelagem_de_dados/Assessment/projeto-fisico-dados.sql | UTF-8 | 7,184 | 3.3125 | 3 | [] | no_license | -- MySQL Script generated by MySQL Workbench
-- 10/22/16 15:45:35
-- 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 bd_tv
-- -----------------------------------------------------
-- -----------------------------------------------------
-- Schema bd_tv
-- -----------------------------------------------------
CREATE SCHEMA IF NOT EXISTS `bd_tv` DEFAULT CHARACTER SET utf8 ;
USE `bd_tv` ;
-- -----------------------------------------------------
-- Table `bd_tv`.`Endereco`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `bd_tv`.`Endereco` (
`idEndereco` INT NOT NULL,
`rua` VARCHAR(45) NULL,
`numero` VARCHAR(45) NULL,
`bairro` VARCHAR(45) NULL,
`cidade` VARCHAR(45) NULL,
`estado` VARCHAR(45) NULL,
`cep` INT NULL,
PRIMARY KEY (`idEndereco`))
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `bd_tv`.`Usuario`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `bd_tv`.`Usuario` (
`idUsuario` INT NOT NULL,
`nome` VARCHAR(255) NULL,
`cpf` INT NULL,
`genero` VARCHAR(45) NULL,
`dtNascimento` DATETIME NULL,
`telefone` INT NULL,
`matricula` INT NULL,
`login` VARCHAR(45) NULL,
`senha` VARCHAR(45) NULL,
`Endereco_idEndereco` INT NOT NULL,
`idTitular` INT NOT NULL,
PRIMARY KEY (`idUsuario`, `Endereco_idEndereco`, `idTitular`),
UNIQUE INDEX `idUsuario_UNIQUE` (`idUsuario` ASC),
INDEX `fk_Usuario_Endereco_idx` (`Endereco_idEndereco` ASC),
INDEX `fk_Usuario_Usuario1_idx` (`idTitular` ASC),
CONSTRAINT `fk_Usuario_Endereco`
FOREIGN KEY (`Endereco_idEndereco`)
REFERENCES `bd_tv`.`Endereco` (`idEndereco`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_Usuario_Usuario1`
FOREIGN KEY (`idTitular`)
REFERENCES `bd_tv`.`Usuario` (`idUsuario`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `bd_tv`.`Plano`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `bd_tv`.`Plano` (
`idPlano` INT NOT NULL,
`titulo` VARCHAR(255) NULL,
PRIMARY KEY (`idPlano`))
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `bd_tv`.`Contrato`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `bd_tv`.`Contrato` (
`idContrato` INT NOT NULL,
`Usuario_idUsuario` INT NOT NULL,
`Plano_idPlano` INT NOT NULL,
`codigoContrato` INT NULL,
`situacao` VARCHAR(45) NULL,
`dtInicial` VARCHAR(45) NULL,
`dtEncerramento` VARCHAR(45) NULL,
PRIMARY KEY (`idContrato`, `Usuario_idUsuario`, `Plano_idPlano`),
INDEX `fk_Contrato_Usuario1_idx` (`Usuario_idUsuario` ASC),
INDEX `fk_Contrato_Plano1_idx` (`Plano_idPlano` ASC),
CONSTRAINT `fk_Contrato_Usuario1`
FOREIGN KEY (`Usuario_idUsuario`)
REFERENCES `bd_tv`.`Usuario` (`idUsuario`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_Contrato_Plano1`
FOREIGN KEY (`Plano_idPlano`)
REFERENCES `bd_tv`.`Plano` (`idPlano`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `bd_tv`.`Canal`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `bd_tv`.`Canal` (
`idCanal` INT NOT NULL,
`nome` VARCHAR(45) NULL,
`numero` VARCHAR(45) NULL,
PRIMARY KEY (`idCanal`))
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `bd_tv`.`Categoria`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `bd_tv`.`Categoria` (
`idCategoria` INT NOT NULL,
`nome` VARCHAR(45) NULL,
PRIMARY KEY (`idCategoria`))
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `bd_tv`.`Canal_Categoria`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `bd_tv`.`Canal_Categoria` (
`idCanal_Categoria` INT NOT NULL,
`Canal_idCanal` INT NOT NULL,
`Categoria_idCategoria` INT NOT NULL,
PRIMARY KEY (`idCanal_Categoria`, `Canal_idCanal`, `Categoria_idCategoria`),
INDEX `fk_Canal_Categoria_Canal1_idx` (`Canal_idCanal` ASC),
INDEX `fk_Canal_Categoria_Categoria1_idx` (`Categoria_idCategoria` ASC),
CONSTRAINT `fk_Canal_Categoria_Canal1`
FOREIGN KEY (`Canal_idCanal`)
REFERENCES `bd_tv`.`Canal` (`idCanal`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_Canal_Categoria_Categoria1`
FOREIGN KEY (`Categoria_idCategoria`)
REFERENCES `bd_tv`.`Categoria` (`idCategoria`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `bd_tv`.`Plano_Canal`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `bd_tv`.`Plano_Canal` (
`idPlano_Canal` INT NOT NULL,
`Plano_idPlano` INT NOT NULL,
`Canal_idCanal` INT NOT NULL,
`dtInicio` VARCHAR(45) NULL,
`Plano_Canalcol` VARCHAR(45) NULL,
PRIMARY KEY (`idPlano_Canal`, `Plano_idPlano`, `Canal_idCanal`),
INDEX `fk_Plano_Canal_Plano1_idx` (`Plano_idPlano` ASC),
INDEX `fk_Plano_Canal_Canal1_idx` (`Canal_idCanal` ASC),
CONSTRAINT `fk_Plano_Canal_Plano1`
FOREIGN KEY (`Plano_idPlano`)
REFERENCES `bd_tv`.`Plano` (`idPlano`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_Plano_Canal_Canal1`
FOREIGN KEY (`Canal_idCanal`)
REFERENCES `bd_tv`.`Canal` (`idCanal`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `bd_tv`.`Programa`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `bd_tv`.`Programa` (
`idPrograma` INT NOT NULL,
`titulo` VARCHAR(255) NULL,
`data` DATE NULL,
`classificacao` VARCHAR(45) NULL,
PRIMARY KEY (`idPrograma`))
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `bd_tv`.`Grade`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `bd_tv`.`Grade` (
`idGrade` INT NOT NULL,
`Canal_idCanal` INT NOT NULL,
`Programa_idPrograma` INT NOT NULL,
`horarioInicial` VARCHAR(45) NULL,
`horarioFinal` VARCHAR(45) NULL,
PRIMARY KEY (`idGrade`, `Canal_idCanal`, `Programa_idPrograma`),
INDEX `fk_Grade_Programa1_idx` (`Programa_idPrograma` ASC),
INDEX `fk_Grade_Canal1_idx` (`Canal_idCanal` ASC),
CONSTRAINT `fk_Grade_Programa1`
FOREIGN KEY (`Programa_idPrograma`)
REFERENCES `bd_tv`.`Programa` (`idPrograma`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_Grade_Canal1`
FOREIGN KEY (`Canal_idCanal`)
REFERENCES `bd_tv`.`Canal` (`idCanal`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
| true |
cf68b2b6bc8b61552a8e56364d2094fe14283fa4 | SQL | semonke/geometrylib-mindbox | /sql_products_categories.sql | UTF-8 | 247 | 3.59375 | 4 | [] | no_license | USE store;
SELECT Products.Name AS ProductName, Categories.Name AS CategoryName
FROM Products
LEFT JOIN ProductsToCategories ON ProductsToCategories.Product_Id = Products.Id
LEFT JOIN Categories ON Categories.Id = ProductsToCategories.Category_Id | true |
8c39106c4659328f27ecdd175e05679d0605306a | SQL | ajbd2106/Benchmarking-Big-SQL-Systems | /spark_sql/spark_tpch_orc/final_tpch_queries/tpch_query21.sql | UTF-8 | 927 | 4.3125 | 4 | [] | no_license | -- explain
create temporary table l3 stored as orc as
select orderkey, count(distinct suppkey) as cntSupp
from lineitem
where receiptdate > commitdate and orderkey is not null
group by orderkey
having cntSupp = 1
;
with location as (
select supplier.* from supplier, nation where
supplier.nationkey = nation.nationkey and nation.name = 'SAUDI ARABIA'
)
select sl.name, count(*) as numwait
from
(
select li.suppkey, li.orderkey
from lineitem li join orders o on li.orderkey = o.orderkey and
o.orderstatus = 'F'
join
(
select l.orderkey, count(distinct l.suppkey) as cntSupp
from lineitem l
group by orderkey
) l2 on li.orderkey = l2.orderkey and
li.receiptdate > li.commitdate and
l2.cntSupp > 1
) l1 join l3 on l1.orderkey = l3.orderkey
join location sl on l1.suppkey = sl.suppkey
group by
sl.name
order by
numwait desc,
sl.name
limit 100;
| true |
07989a5f9ea9c8e3722e6832008c410abb0addb7 | SQL | rfgonzalez13/cv | /res/datos_curriculares .sql | UTF-8 | 18,985 | 3.21875 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 5.0.2
-- https://www.phpmyadmin.net/
--
-- Servidor: localhost
-- Tiempo de generación: 09-09-2021 a las 11:57:36
-- Versión del servidor: 10.3.23-MariaDB-0+deb10u1
-- Versión de PHP: 7.3.19-1~deb10u1
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Base de datos: `datos_curriculares`
--
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `articulo`
--
CREATE TABLE `articulo` (
`CodigoA` int(11) NOT NULL,
`AutoresA` varchar(200) COLLATE latin1_spanish_ci NOT NULL DEFAULT '',
`TituloA` varchar(100) COLLATE latin1_spanish_ci NOT NULL DEFAULT '',
`TituloR` varchar(100) COLLATE latin1_spanish_ci NOT NULL DEFAULT '',
`ISSN` varchar(13) COLLATE latin1_spanish_ci NOT NULL DEFAULT '',
`VolumenR` varchar(4) COLLATE latin1_spanish_ci DEFAULT NULL,
`PagIniA` int(4) DEFAULT NULL,
`PagFinA` int(4) DEFAULT NULL,
`FechaPublicacionR` date DEFAULT NULL,
`EstadoA` enum('Enviado','Revision','Publicado') COLLATE latin1_spanish_ci NOT NULL DEFAULT 'Publicado'
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_spanish_ci;
--
-- Volcado de datos para la tabla `articulo`
--
INSERT INTO `articulo` (`CodigoA`, `AutoresA`, `TituloA`, `TituloR`, `ISSN`, `VolumenR`, `PagIniA`, `PagFinA`, `FechaPublicacionR`, `EstadoA`) VALUES
(1, 'Rubén Fernández, Marcos Llorente, Florentino Fernández', 'La vida despues de la ESEI', 'SuperPOP', 'ISSNLO67690PO', 'WEP3', 187, 189, '2007-09-23', 'Publicado'),
(2, 'Rubén Fernández, Marcos Llorente, Florentino Fernández', 'La muerte despues de la ESEI', 'SuperPOP', 'ISSNLO67690PO', 'WEP3', 187, 189, '2007-09-23', 'Revision'),
(3, 'Rubén Fernández, Cristiano Ronaldo, Florentino Fernández', 'Python mola', 'PRONTO', 'ISSNLOLER9099', 'DERV', 1, 25, '1993-09-23', 'Publicado');
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `congreso`
--
CREATE TABLE `congreso` (
`CodigoC` int(11) NOT NULL,
`NombreC` varchar(100) COLLATE latin1_spanish_ci NOT NULL DEFAULT '',
`AcronimoC` varchar(20) COLLATE latin1_spanish_ci NOT NULL DEFAULT '',
`AnhoC` year(4) NOT NULL DEFAULT 0000,
`LugarC` varchar(20) COLLATE latin1_spanish_ci NOT NULL DEFAULT ''
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_spanish_ci;
--
-- Volcado de datos para la tabla `congreso`
--
INSERT INTO `congreso` (`CodigoC`, `NombreC`, `AcronimoC`, `AnhoC`, `LugarC`) VALUES
(1, 'Vida de Vicio', 'VdV', 1999, 'Ibiza'),
(2, 'Bases de Datos Molonas', 'BDM', 2008, 'Japon');
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `estancia`
--
CREATE TABLE `estancia` (
`CodigoE` int(11) NOT NULL,
`CentroE` varchar(100) COLLATE latin1_spanish_ci NOT NULL DEFAULT '',
`UniversidadE` varchar(40) COLLATE latin1_spanish_ci NOT NULL DEFAULT '',
`PaisE` varchar(20) COLLATE latin1_spanish_ci NOT NULL DEFAULT '',
`FechaInicioE` date NOT NULL DEFAULT '0000-00-00',
`FechaFinE` date NOT NULL DEFAULT '0000-00-00',
`TipoE` enum('Investigacion','Doctorado','Invitado') COLLATE latin1_spanish_ci NOT NULL DEFAULT 'Investigacion',
`LoginU` varchar(15) COLLATE latin1_spanish_ci NOT NULL DEFAULT ''
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_spanish_ci;
--
-- Volcado de datos para la tabla `estancia`
--
INSERT INTO `estancia` (`CodigoE`, `CentroE`, `UniversidadE`, `PaisE`, `FechaInicioE`, `FechaFinE`, `TipoE`, `LoginU`) VALUES
(1, 'ESEI', 'Universidad de Vigo', 'España', '2000-01-01', '2002-03-05', 'Invitado', 'floro'),
(2, 'ESEI', 'Universidad de Vigo', 'España', '1992-01-01', '1994-03-05', 'Doctorado', 'floro'),
(3, 'ESEI', 'Universidad de Vigo', 'España', '2005-01-01', '2005-01-15', 'Investigacion', 'floro'),
(4, 'ESEI', 'Universidad de Vigo', 'España', '2000-01-01', '2002-03-05', 'Invitado', 'ana'),
(8, 'Kimbawe', 'Kimbempe', 'Kenia', '1990-03-09', '1991-09-09', 'Investigacion', 'floro');
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `libro`
--
CREATE TABLE `libro` (
`CodigoL` int(11) NOT NULL,
`AutoresL` varchar(200) COLLATE latin1_spanish_ci NOT NULL DEFAULT '',
`TituloL` varchar(100) COLLATE latin1_spanish_ci NOT NULL DEFAULT '',
`ISBN` varchar(13) COLLATE latin1_spanish_ci NOT NULL DEFAULT '',
`PagIniL` varchar(4) COLLATE latin1_spanish_ci DEFAULT NULL,
`PagFinL` varchar(4) COLLATE latin1_spanish_ci DEFAULT NULL,
`VolumenL` varchar(4) COLLATE latin1_spanish_ci DEFAULT NULL,
`EditorialL` varchar(100) COLLATE latin1_spanish_ci DEFAULT NULL,
`FechaPublicacionL` date NOT NULL DEFAULT '0000-00-00',
`EditorL` varchar(100) COLLATE latin1_spanish_ci DEFAULT NULL,
`PaisEdicionL` varchar(20) COLLATE latin1_spanish_ci NOT NULL DEFAULT ''
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_spanish_ci;
--
-- Volcado de datos para la tabla `libro`
--
INSERT INTO `libro` (`CodigoL`, `AutoresL`, `TituloL`, `ISBN`, `PagIniL`, `PagFinL`, `VolumenL`, `EditorialL`, `FechaPublicacionL`, `EditorL`, `PaisEdicionL`) VALUES
(1, 'Lionel Messi, Florentino Fernández, Paco Buyo', 'Las mariposas de Brievik', '9783642024801', '5', '250', 'IV', 'ANAYA', '2009-04-04', 'Florentino Perez', 'Noruega'),
(2, 'Rubencito, Florentino Fernández, Marquinhos', 'Jose Breton y la piedra filosofal', '9783642024801', '5', '250', 'IV', 'ANAYA', '2015-04-04', 'Joan Laporta', 'España');
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `materia`
--
CREATE TABLE `materia` (
`CodigoM` int(11) NOT NULL,
`TipoM` enum('Grado','Tercer Ciclo','Curso','Master','Postgrado') COLLATE latin1_spanish_ci NOT NULL DEFAULT 'Grado',
`TipoParticipacionM` enum('Docente','Director') COLLATE latin1_spanish_ci NOT NULL DEFAULT 'Docente',
`DenominacionM` varchar(100) COLLATE latin1_spanish_ci NOT NULL DEFAULT '',
`TitulacionM` varchar(100) COLLATE latin1_spanish_ci NOT NULL DEFAULT '',
`AnhoAcademicoM` varchar(11) COLLATE latin1_spanish_ci NOT NULL DEFAULT '',
`CreditosTeoM` char(3) COLLATE latin1_spanish_ci NOT NULL DEFAULT '0',
`CreditosPraM` char(3) COLLATE latin1_spanish_ci NOT NULL DEFAULT '0',
`CuatrimestreM` enum('Primero','Segundo','Anual') COLLATE latin1_spanish_ci NOT NULL DEFAULT 'Primero',
`LoginU` varchar(15) COLLATE latin1_spanish_ci NOT NULL DEFAULT ''
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_spanish_ci;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `pfc`
--
CREATE TABLE `pfc` (
`CodigoPFC` varchar(10) COLLATE latin1_spanish_ci NOT NULL DEFAULT '',
`TituloPFC` varchar(100) COLLATE latin1_spanish_ci NOT NULL DEFAULT '',
`AlumnoPFC` varchar(40) COLLATE latin1_spanish_ci NOT NULL DEFAULT '',
`FechaLecturaPFC` date DEFAULT NULL,
`CalificacionPFC` enum('Aprobado','Notable','Sobresaliente','Matricula') COLLATE latin1_spanish_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_spanish_ci;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `ponencia`
--
CREATE TABLE `ponencia` (
`CodigoP` int(11) NOT NULL,
`AutoresP` varchar(200) COLLATE latin1_spanish_ci NOT NULL DEFAULT '',
`TituloP` varchar(100) COLLATE latin1_spanish_ci NOT NULL DEFAULT '',
`CongresoP` varchar(40) COLLATE latin1_spanish_ci NOT NULL DEFAULT '',
`FechaIniCP` date NOT NULL DEFAULT '0000-00-00',
`FechaFinCP` date NOT NULL DEFAULT '0000-00-00',
`LugarCP` varchar(20) COLLATE latin1_spanish_ci NOT NULL DEFAULT '',
`PaisCP` varchar(20) COLLATE latin1_spanish_ci NOT NULL DEFAULT ''
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_spanish_ci;
--
-- Volcado de datos para la tabla `ponencia`
--
INSERT INTO `ponencia` (`CodigoP`, `AutoresP`, `TituloP`, `CongresoP`, `FechaIniCP`, `FechaFinCP`, `LugarCP`, `PaisCP`) VALUES
(1, 'Cristiano Ronaldo, Lionel Messi', 'El 2-6', 'Historia del Clásico', '2017-06-09', '2017-06-12', 'Madrid', 'España');
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `proyecto`
--
CREATE TABLE `proyecto` (
`CodigoProy` int(11) NOT NULL,
`TituloProy` varchar(100) COLLATE latin1_spanish_ci NOT NULL DEFAULT '',
`EntidadFinanciadora` varchar(40) COLLATE latin1_spanish_ci NOT NULL DEFAULT '',
`AcronimoProy` varchar(20) COLLATE latin1_spanish_ci NOT NULL DEFAULT '',
`AnhoInicioProy` year(4) NOT NULL DEFAULT 0000,
`AnhoFinProy` year(4) NOT NULL DEFAULT 0000,
`Importe` int(11) NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_spanish_ci;
--
-- Volcado de datos para la tabla `proyecto`
--
INSERT INTO `proyecto` (`CodigoProy`, `TituloProy`, `EntidadFinanciadora`, `AcronimoProy`, `AnhoInicioProy`, `AnhoFinProy`, `Importe`) VALUES
(1, 'P01', 'Ministerio de interior', 'P01', 2003, 2004, 560),
(2, 'Proyecto secreto', 'CIA', 'XXX-D23', 2017, 2019, 345000),
(6, 'Cosas de ANA', 'Andorra', 'ANA', 1999, 2001, 2550),
(21, 'Proyecto Prueba', 'TEST', 'BBVA', 1993, 1999, 3450);
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `tad`
--
CREATE TABLE `tad` (
`CodigoTAD` varchar(10) COLLATE latin1_spanish_ci NOT NULL DEFAULT '',
`TituloTAD` varchar(100) COLLATE latin1_spanish_ci NOT NULL DEFAULT '',
`AlumnoTAD` varchar(40) COLLATE latin1_spanish_ci NOT NULL DEFAULT '',
`FechaLecturaTAD` date DEFAULT NULL,
`LoginU` varchar(15) COLLATE latin1_spanish_ci NOT NULL DEFAULT ''
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_spanish_ci;
--
-- Volcado de datos para la tabla `tad`
--
INSERT INTO `tad` (`CodigoTAD`, `TituloTAD`, `AlumnoTAD`, `FechaLecturaTAD`, `LoginU`) VALUES
('1', 'Indices y optimizacion de consultas recurrentes', 'Francisco Rojas Fernandez', '2018-10-05', 'floro');
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `technicalreport`
--
CREATE TABLE `technicalreport` (
`CodigoTR` int(11) NOT NULL,
`AutoresTR` varchar(200) COLLATE latin1_spanish_ci NOT NULL DEFAULT '',
`TituloTR` varchar(100) COLLATE latin1_spanish_ci NOT NULL DEFAULT '',
`DepartamentoTR` varchar(100) COLLATE latin1_spanish_ci NOT NULL DEFAULT '',
`UniversidadTR` varchar(40) COLLATE latin1_spanish_ci NOT NULL DEFAULT '',
`FechaTR` date NOT NULL DEFAULT '0000-00-00'
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_spanish_ci;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `usuario`
--
CREATE TABLE `usuario` (
`LoginU` varchar(15) COLLATE latin1_spanish_ci NOT NULL DEFAULT '',
`PasswordU` varchar(32) COLLATE latin1_spanish_ci NOT NULL DEFAULT '',
`NombreU` varchar(15) COLLATE latin1_spanish_ci NOT NULL DEFAULT '',
`ApellidosU` varchar(30) COLLATE latin1_spanish_ci NOT NULL DEFAULT '',
`TituloAcademicoU` varchar(100) COLLATE latin1_spanish_ci NOT NULL DEFAULT '',
`TipoContratoU` varchar(40) COLLATE latin1_spanish_ci NOT NULL DEFAULT '',
`CentroU` varchar(100) COLLATE latin1_spanish_ci NOT NULL DEFAULT '',
`DepartamentoU` varchar(100) COLLATE latin1_spanish_ci NOT NULL DEFAULT '',
`UniversidadU` varchar(40) COLLATE latin1_spanish_ci NOT NULL DEFAULT '',
`TipoU` enum('A','P') COLLATE latin1_spanish_ci NOT NULL DEFAULT 'P'
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_spanish_ci;
--
-- Volcado de datos para la tabla `usuario`
--
INSERT INTO `usuario` (`LoginU`, `PasswordU`, `NombreU`, `ApellidosU`, `TituloAcademicoU`, `TipoContratoU`, `CentroU`, `DepartamentoU`, `UniversidadU`, `TipoU`) VALUES
('admin', 'e0b7feb3cf3e7d177da400774de0af5b', 'Administrador', '', '', '', '', '', '', 'A'),
('ana', '8ff72d70d87ae08c3f76d990744b91b4', 'Ana', 'Guerra Carvajal', 'Espia', 'Precario', 'ESEI', 'Espionaje', 'Universidad de Madrid', 'A'),
('floro', '8ff72d70d87ae08c3f76d990744b91b4', 'Florentino', 'Fernández Riverola', 'Titular de Universidad', 'Plantilla', 'Escuela Superior de Ingeniería Informática', 'Informática', 'Universidad de Vigo', 'A');
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `usuario_articulo`
--
CREATE TABLE `usuario_articulo` (
`CodigoA` int(11) NOT NULL DEFAULT 0,
`LoginU` varchar(15) COLLATE latin1_spanish_ci NOT NULL DEFAULT ''
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_spanish_ci;
--
-- Volcado de datos para la tabla `usuario_articulo`
--
INSERT INTO `usuario_articulo` (`CodigoA`, `LoginU`) VALUES
(0, 'floro'),
(1, 'floro'),
(2, 'floro'),
(3, 'floro');
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `usuario_congreso`
--
CREATE TABLE `usuario_congreso` (
`LoginU` varchar(15) COLLATE latin1_spanish_ci NOT NULL DEFAULT '',
`CodigoC` int(11) NOT NULL DEFAULT 0,
`TipoParticipacionC` enum('MCO','MCC','R','C','PCO','PCC') COLLATE latin1_spanish_ci NOT NULL DEFAULT 'MCO'
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_spanish_ci;
--
-- Volcado de datos para la tabla `usuario_congreso`
--
INSERT INTO `usuario_congreso` (`LoginU`, `CodigoC`, `TipoParticipacionC`) VALUES
('ana', 2, 'MCC'),
('floro', 1, 'PCO'),
('floro', 2, 'R');
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `usuario_libro`
--
CREATE TABLE `usuario_libro` (
`CodigoL` int(11) NOT NULL DEFAULT 0,
`LoginU` varchar(15) COLLATE latin1_spanish_ci NOT NULL DEFAULT ''
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_spanish_ci;
--
-- Volcado de datos para la tabla `usuario_libro`
--
INSERT INTO `usuario_libro` (`CodigoL`, `LoginU`) VALUES
(1, 'floro'),
(2, 'floro');
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `usuario_pfc`
--
CREATE TABLE `usuario_pfc` (
`CodigoPFC` varchar(10) COLLATE latin1_spanish_ci NOT NULL DEFAULT '',
`LoginU` varchar(15) COLLATE latin1_spanish_ci NOT NULL DEFAULT ''
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_spanish_ci;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `usuario_ponencia`
--
CREATE TABLE `usuario_ponencia` (
`CodigoP` int(11) NOT NULL DEFAULT 0,
`LoginU` varchar(15) COLLATE latin1_spanish_ci NOT NULL DEFAULT ''
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_spanish_ci;
--
-- Volcado de datos para la tabla `usuario_ponencia`
--
INSERT INTO `usuario_ponencia` (`CodigoP`, `LoginU`) VALUES
(1, 'floro');
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `usuario_proyecto`
--
CREATE TABLE `usuario_proyecto` (
`CodigoProy` int(11) NOT NULL DEFAULT 0,
`LoginU` varchar(15) COLLATE latin1_spanish_ci NOT NULL DEFAULT '',
`TipoParticipacionProy` enum('Investigador','Investigador Principal') COLLATE latin1_spanish_ci NOT NULL DEFAULT 'Investigador'
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_spanish_ci;
--
-- Volcado de datos para la tabla `usuario_proyecto`
--
INSERT INTO `usuario_proyecto` (`CodigoProy`, `LoginU`, `TipoParticipacionProy`) VALUES
(1, 'ana', 'Investigador Principal'),
(1, 'floro', 'Investigador'),
(2, 'floro', 'Investigador'),
(6, 'ana', 'Investigador Principal'),
(21, 'floro', 'Investigador Principal');
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `usuario_technicalreport`
--
CREATE TABLE `usuario_technicalreport` (
`CodigoTR` int(11) NOT NULL DEFAULT 0,
`LoginU` varchar(15) COLLATE latin1_spanish_ci NOT NULL DEFAULT ''
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_spanish_ci;
--
-- Índices para tablas volcadas
--
--
-- Indices de la tabla `articulo`
--
ALTER TABLE `articulo`
ADD PRIMARY KEY (`CodigoA`);
--
-- Indices de la tabla `congreso`
--
ALTER TABLE `congreso`
ADD PRIMARY KEY (`CodigoC`);
--
-- Indices de la tabla `estancia`
--
ALTER TABLE `estancia`
ADD PRIMARY KEY (`CodigoE`);
--
-- Indices de la tabla `libro`
--
ALTER TABLE `libro`
ADD PRIMARY KEY (`CodigoL`);
--
-- Indices de la tabla `materia`
--
ALTER TABLE `materia`
ADD PRIMARY KEY (`CodigoM`);
--
-- Indices de la tabla `pfc`
--
ALTER TABLE `pfc`
ADD PRIMARY KEY (`CodigoPFC`);
--
-- Indices de la tabla `ponencia`
--
ALTER TABLE `ponencia`
ADD PRIMARY KEY (`CodigoP`);
--
-- Indices de la tabla `proyecto`
--
ALTER TABLE `proyecto`
ADD PRIMARY KEY (`CodigoProy`);
--
-- Indices de la tabla `tad`
--
ALTER TABLE `tad`
ADD PRIMARY KEY (`CodigoTAD`);
--
-- Indices de la tabla `technicalreport`
--
ALTER TABLE `technicalreport`
ADD PRIMARY KEY (`CodigoTR`);
--
-- Indices de la tabla `usuario`
--
ALTER TABLE `usuario`
ADD PRIMARY KEY (`LoginU`);
--
-- Indices de la tabla `usuario_articulo`
--
ALTER TABLE `usuario_articulo`
ADD PRIMARY KEY (`CodigoA`,`LoginU`);
--
-- Indices de la tabla `usuario_congreso`
--
ALTER TABLE `usuario_congreso`
ADD PRIMARY KEY (`LoginU`,`CodigoC`,`TipoParticipacionC`);
--
-- Indices de la tabla `usuario_libro`
--
ALTER TABLE `usuario_libro`
ADD PRIMARY KEY (`CodigoL`,`LoginU`);
--
-- Indices de la tabla `usuario_pfc`
--
ALTER TABLE `usuario_pfc`
ADD PRIMARY KEY (`CodigoPFC`,`LoginU`);
--
-- Indices de la tabla `usuario_ponencia`
--
ALTER TABLE `usuario_ponencia`
ADD PRIMARY KEY (`CodigoP`,`LoginU`);
--
-- Indices de la tabla `usuario_proyecto`
--
ALTER TABLE `usuario_proyecto`
ADD PRIMARY KEY (`CodigoProy`,`LoginU`);
--
-- Indices de la tabla `usuario_technicalreport`
--
ALTER TABLE `usuario_technicalreport`
ADD PRIMARY KEY (`CodigoTR`,`LoginU`);
--
-- AUTO_INCREMENT de las tablas volcadas
--
--
-- AUTO_INCREMENT de la tabla `articulo`
--
ALTER TABLE `articulo`
MODIFY `CodigoA` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT de la tabla `congreso`
--
ALTER TABLE `congreso`
MODIFY `CodigoC` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT de la tabla `estancia`
--
ALTER TABLE `estancia`
MODIFY `CodigoE` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;
--
-- AUTO_INCREMENT de la tabla `libro`
--
ALTER TABLE `libro`
MODIFY `CodigoL` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT de la tabla `materia`
--
ALTER TABLE `materia`
MODIFY `CodigoM` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT de la tabla `ponencia`
--
ALTER TABLE `ponencia`
MODIFY `CodigoP` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT de la tabla `proyecto`
--
ALTER TABLE `proyecto`
MODIFY `CodigoProy` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=23;
--
-- AUTO_INCREMENT de la tabla `technicalreport`
--
ALTER TABLE `technicalreport`
MODIFY `CodigoTR` int(11) NOT NULL AUTO_INCREMENT;
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 */;
| true |
d8f3aee33c8cf2dca0e8424eb463f3017afe0a1a | SQL | EwertonWeb/UriOnlineJudgeSQL | /2621_urionlineSQL.sql | UTF-8 | 141 | 3.3125 | 3 | [] | no_license | SELECT p.name
FROM products as p
inner JOIN providers as pr on p.id_providers=pr.id
WHERE(p.amount between 10 and 20)
and
pr.name like 'P%'; | true |
d334430263c99cfc99ce3094642f708f61829bff | SQL | Keikishim2/Courses_CodeIgniter | /mysql_data.sql | UTF-8 | 2,921 | 3 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | permissive | CREATE DATABASE IF NOT EXISTS `ci_courses` /*!40100 DEFAULT CHARACTER SET utf8 */;
USE `ci_courses`;
-- MySQL dump 10.13 Distrib 5.6.17, for Win64 (x86_64)
--
-- Host: 127.0.0.1 Database: ci_courses
-- ------------------------------------------------------
-- Server version 5.6.17
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `courses`
--
DROP TABLE IF EXISTS `courses`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `courses` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(45) NOT NULL,
`description` text,
`created_at` datetime NOT NULL,
`updated_at` datetime NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=20 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `courses`
--
LOCK TABLES `courses` WRITE;
/*!40000 ALTER TABLE `courses` DISABLE KEYS */;
INSERT INTO `courses` VALUES (3,'French','French language, grammar, and vocabulary','2014-11-23 15:40:46','2014-11-23 15:40:46'),(7,'Biology','Study of life','2014-11-24 16:45:40','2014-11-24 16:45:40'),(8,'German','German 101','2014-11-24 16:46:30','2014-11-24 16:46:30'),(9,'Chemestry','Chemistry 203','2014-11-24 16:46:44','2014-11-24 16:46:44'),(10,'Aerobics','Cardio athletics','2014-11-24 16:47:26','2014-11-24 16:47:26'),(12,'Dancing with the stars','Dancing','2014-11-24 16:58:51','2014-11-24 16:58:51'),(13,'Snowboarding the Bunny Hill','Basics of snowboarding for those who are new to the slopes','2014-11-24 18:09:11','2014-11-24 18:09:11'),(14,'KatrinaDawnSanford','My life','2014-11-24 18:10:30','2014-11-24 18:10:30'),(18,'Welcome to life as an adult','I see you','2014-11-24 18:19:55','2014-11-24 18:19:55'),(19,'Home Economics Advanced','Cooking and sewing','2014-11-24 19:17:52','2014-11-24 19:17:52');
/*!40000 ALTER TABLE `courses` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
| true |
bd7a6b664ac3648bfb313d3b6c7ebbac78370fb8 | SQL | SoulMan87/Database | /Databeses/nomina(1).sql | UTF-8 | 6,298 | 3.328125 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 4.8.2
-- https://www.phpmyadmin.net/
--
-- Servidor: 127.0.0.1
-- Tiempo de generación: 05-09-2018 a las 17:42:42
-- Versión del servidor: 10.1.34-MariaDB
-- Versión de PHP: 7.2.8
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Base de datos: `nomina`
--
DELIMITER $$
--
-- Procedimientos
--
CREATE DEFINER=`root`@`localhost` PROCEDURE `spBuscarPago` (IN `doc` INT) BEGIN
SELECT*
from pago
WHERE Documento=doc;
END$$
CREATE DEFINER=`root`@`localhost` PROCEDURE `spconsultar` (`id` INT) BEGIN
SELECT*
FROM empleado
WHERE Documento= id;
END$$
CREATE DEFINER=`root`@`localhost` PROCEDURE `spConsultarEmpleado` (`id` INT) BEGIN
SELECT*
from empleado
where Documento=id;
end$$
CREATE DEFINER=`root`@`localhost` PROCEDURE `spMaxcodigo` () begin
DECLARE maxi int;
SET maxi = (SELECT MAX(codigo) FROM nomina);
IF (maxi IS null) THEN
SET maxi=1;
ELSE
SET maxi=maxi+1;
end IF;
SELECT maxi;
END$$
CREATE DEFINER=`root`@`localhost` PROCEDURE `spRegistrarEmpleado` (IN `doc` INT, IN `tipo` VARCHAR(15), IN `nom` VARCHAR(50), IN `ape` VARCHAR(50), IN `gen` VARCHAR(10), IN `nac` DATE, IN `correo` VARCHAR(50), IN `esta` BOOLEAN) BEGIN
DECLARE msg varchar(50);
IF(EXISTS(SELECT documento FROM empleado WHERE documento=doc)) THEN
SET msg='Empleado ya existe';
ELSE
INSERT INTO empleado(Documento,tipoDocumento, Nombres,Apellido,Genero,Nacimiento, Email, Estado)
VALUES(doc,tipo,nom, ape, gen, nac, correo,esta);
SET msg='Empleado registrado exitosamente';
SELECT msg as respuesta;
END IF;
END$$
DELIMITER ;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `empleado`
--
CREATE TABLE `empleado` (
`Documento` int(11) NOT NULL,
`TipoDocumento` varchar(15) NOT NULL,
`Nombres` varchar(50) NOT NULL,
`Apellido` varchar(50) NOT NULL,
`genero` varchar(10) NOT NULL,
`nacimiento` date NOT NULL,
`email` varchar(50) NOT NULL,
`estado` bit(1) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Volcado de datos para la tabla `empleado`
--
INSERT INTO `empleado` (`Documento`, `TipoDocumento`, `Nombres`, `Apellido`, `genero`, `nacimiento`, `email`, `estado`) VALUES
(123, 'Cédula', 'jaime', 'jaramillo', 'Mujer', '1980-09-11', 'jaime@gmai.com', b'1'),
(147, 'TI', 'cristian', 'david', 'Hombre', '2000-04-04', 'bigmicris@gmal.com', b'1'),
(159, 'Cédula', 'Marcela', 'Montoya', 'Mujer', '1987-08-09', 'elianaossa@misena.edu.co', b'1'),
(357, 'Cédula', 'jasinto', 'fonceca', 'Selecione:', '1999-09-15', 'jo@gmail.com', b'1'),
(456, 'Cédula', 'Nathalia', 'acosta', 'Mujer', '1983-12-31', 'nathacosta@gmail.co', b'1'),
(789, 'Cédula', 'jonathan', 'hinestroza', 'Hombre', '1987-11-11', 'jonatha.hinestroza@gmail.com', b'1');
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `nomina`
--
CREATE TABLE `nomina` (
`codigo` int(11) NOT NULL,
`Documento` int(11) NOT NULL,
`HT` int(11) NOT NULL,
`VHO` int(11) NOT NULL,
`HO` int(11) NOT NULL,
`HE` int(11) NOT NULL,
`VPHO` int(11) NOT NULL,
`VPHE` float NOT NULL,
`VPHEN` float NOT NULL,
`VPHED` float NOT NULL,
`VTP` float NOT NULL,
`fecha` date NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Volcado de datos para la tabla `nomina`
--
INSERT INTO `nomina` (`codigo`, `Documento`, `HT`, `VHO`, `HO`, `HE`, `VPHO`, `VPHE`, `VPHEN`, `VPHED`, `VTP`, `fecha`) VALUES
(1, 123, 87, 10000, 80, 7, 800000, 87500, 87500, 0, 800000, '2018-09-02'),
(2, 456, 87, 10000, 80, 7, 800000, 87500, 87500, 0, 800000, '2018-09-02'),
(3, 159, 90, 10000, 80, 10, 800000, 135000, 100000, 35000, 835000, '2018-09-02'),
(4, 159, 90, 10000, 80, 10, 800000, 135000, 100000, 35000, 835000, '2018-09-02'),
(5, 123, 120, 10000, 80, 40, 800000, 660000, 100000, 560000, 1360000, '2018-09-02'),
(6, 147, 70, 8000, 70, 0, 560000, 0, 0, 0, 560000, '2018-09-02'),
(7, 789, 150, 8000, 80, 70, 640000, 948000, 80000, 868000, 1508000, '2018-09-02'),
(8, 123, 120, 10000, 80, 40, 800000, 660000, 100000, 560000, 1360000, '2018-09-02'),
(9, 123, 156, 10000, 80, 76, 800000, 1290000, 100000, 1190000, 1990000, '2018-09-05'),
(10, 357, 456, 10000, 80, 376, 800000, 6540000, 100000, 6440000, 7240000, '2018-09-05');
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `pago`
--
CREATE TABLE `pago` (
`codigo` int(11) NOT NULL,
`Documento` int(11) NOT NULL,
`fecha` date NOT NULL,
`HT` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Volcado de datos para la tabla `pago`
--
INSERT INTO `pago` (`codigo`, `Documento`, `fecha`, `HT`) VALUES
(4, 123, '2018-12-10', 50);
--
-- Índices para tablas volcadas
--
--
-- Indices de la tabla `empleado`
--
ALTER TABLE `empleado`
ADD PRIMARY KEY (`Documento`);
--
-- Indices de la tabla `nomina`
--
ALTER TABLE `nomina`
ADD PRIMARY KEY (`codigo`),
ADD KEY `Documento` (`Documento`);
--
-- Indices de la tabla `pago`
--
ALTER TABLE `pago`
ADD PRIMARY KEY (`codigo`),
ADD KEY `Documento` (`Documento`);
--
-- AUTO_INCREMENT de las tablas volcadas
--
--
-- AUTO_INCREMENT de la tabla `nomina`
--
ALTER TABLE `nomina`
MODIFY `codigo` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11;
--
-- AUTO_INCREMENT de la tabla `pago`
--
ALTER TABLE `pago`
MODIFY `codigo` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- Restricciones para tablas volcadas
--
--
-- Filtros para la tabla `nomina`
--
ALTER TABLE `nomina`
ADD CONSTRAINT `nomina_ibfk_1` FOREIGN KEY (`Documento`) REFERENCES `empleado` (`Documento`);
--
-- Filtros para la tabla `pago`
--
ALTER TABLE `pago`
ADD CONSTRAINT `pago_ibfk_1` FOREIGN KEY (`Documento`) REFERENCES `empleado` (`Documento`);
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 */;
| true |
19005f36a29f98714ffeddd550f052c7a8223c4d | SQL | RRFreitas/GeekWay | /geekway-api/database/postgres.sql | UTF-8 | 3,474 | 2.796875 | 3 | [
"MIT"
] | permissive | CREATE TABLE tb_usuario(
id SERIAL PRIMARY KEY,
nome varchar(100) NOT NULL,
email varchar(50) NOT NULL UNIQUE,
senha varchar(20) NOT NULL,
data_nasc date,
profissao varchar(30),
genero varchar(15),
cidade varchar(30),
estado varchar(30),
pais varchar(30)
);
CREATE TABLE tb_postagem(
id SERIAL PRIMARY KEY,
usuario_id integer NOT NULL,
mensagem varchar(140),
privacidade varchar(20),
data_hora timestamp,
curtidas integer,
FOREIGN KEY(usuario_id) REFERENCES tb_usuario(id)
);
CREATE TABLE tb_postagem_privada(
postagem_id integer,
id_usuario_permitido integer,
FOREIGN KEY(postagem_id) REFERENCES tb_postagem(id),
FOREIGN KEY(id_usuario_permitido) REFERENCES tb_usuario(id)
);
CREATE TABLE tb_comentario_postagem(
postagem_id integer,
usuario_id integer,
mensagem text,
data_hora timestamp,
curtidas integer,
FOREIGN KEY(postagem_id) REFERENCES tb_postagem(id),
FOREIGN KEY(usuario_id) REFERENCES tb_usuario(id)
);
CREATE TABLE tb_mensagem_direta(
id SERIAL PRIMARY KEY,
remetente_id integer,
destinatario_id integer,
mensagem text,
data_hora timestamp,
visualizada boolean,
FOREIGN KEY(remetente_id) REFERENCES tb_usuario(id),
FOREIGN KEY(destinatario_id) REFERENCES tb_usuario(id)
);
CREATE TABLE tb_solicitacao_amizade(
id SERIAL PRIMARY KEY,
solicitante_id integer,
solicitado_id integer,
status varchar(8),
data_solicitacao date,
FOREIGN KEY(solicitante_id) REFERENCES tb_usuario(id),
FOREIGN KEY(solicitado_id) REFERENCES tb_usuario(id)
);
CREATE TABLE tb_notificacoes(
id SERIAL PRIMARY KEY,
usuario_id integer,
mensagem text,
FOREIGN KEY(usuario_id) REFERENCES tb_usuario(id)
);
CREATE TABLE tb_amizade(
id SERIAL PRIMARY KEY,
usuario1_id integer,
usuario2_id integer,
data_inicio date,
FOREIGN KEY(usuario1_id) REFERENCES tb_usuario(id),
FOREIGN KEY(usuario2_id) REFERENCES tb_usuario(id)
);
CREATE TABLE tb_grupo(
id SERIAL PRIMARY KEY,
id_criador integer,
nome varchar(50),
data_criacao date,
descricao varchar(500),
FOREIGN KEY(id_criador) REFERENCES tb_usuario(id)
);
CREATE TABLE tb_grupo_participante(
grupo_id integer,
participante_id integer,
data_entrada date,
cargo varchar(20),
FOREIGN KEY(grupo_id) REFERENCES tb_grupo(id),
FOREIGN KEY(participante_id) REFERENCES tb_usuario(id)
); | true |
00e2a1e372504af762d75b903d86b9971abc2936 | SQL | Hallip/UNAL | /Data Bases/Final/Oracle.sql | UTF-8 | 18,297 | 3.25 | 3 | [] | no_license | /*==============================================================*/
/* DBMS name: ORACLE Version 11g */
/* Created on: 11/7/2019 12:52:27 */
/*==============================================================*/
/*==============================================================*/
/* Table: BODEGA */
/*==============================================================*/
create table BODEGA
(
ID_PRODUCTO INTEGER not null,
CANTIDAD INTEGER,
SUCUR_BOD VARCHAR2(32) not null,
CIUDADSU VARCHAR2(32),
PAISSU VARCHAR2(32),
constraint PK_BODEGA primary key (ID_PRODUCTO, SUCUR_BOD)
);
/*==============================================================*/
/* Index: INVENTARIO2_FK */
/*==============================================================*/
create index INVENTARIO2_FK on BODEGA (
CIUDADSU ASC,
PAISSU ASC
);
/*==============================================================*/
/* Table: CARGOS */
/*==============================================================*/
create table CARGOS
(
NOM_CAR VARCHAR2(32) not null,
NOMBRE_DEP VARCHAR2(32),
SUCURSAL VARCHAR2(32),
DEP_CAR VARCHAR2(32),
S_MIN INTEGER,
S_MAX INTEGER,
constraint PK_CARGOS primary key (NOM_CAR)
);
/*==============================================================*/
/* Index: PERTENECE_FK */
/*==============================================================*/
create index PERTENECE_FK on CARGOS (
NOMBRE_DEP ASC,
SUCURSAL ASC
);
/*==============================================================*/
/* Table: CIUDADES */
/*==============================================================*/
create table CIUDADES
(
NOM_CIU VARCHAR2(32),
IATACIU VARCHAR2(3) not null,
ISO3166 INTEGER,
CIUDADSU VARCHAR2(32),
PAISSU VARCHAR2(32),
ISO3166CIU INTEGER,
constraint PK_CIUDADES primary key (IATACIU)
);
/*==============================================================*/
/* Index: LUGAR_FK */
/*==============================================================*/
create index LUGAR_FK on CIUDADES (
ISO3166 ASC
);
/*==============================================================*/
/* Index: SPER_FK */
/*==============================================================*/
create index SPER_FK on CIUDADES (
CIUDADSU ASC,
PAISSU ASC
);
/*==============================================================*/
/* Table: CLIENTES */
/*==============================================================*/
create table CLIENTES
(
CED_EMP INTEGER,
CED_CLI INTEGER not null,
NOMB_CLI VARCHAR2(32),
AP_CLI VARCHAR2(32),
SUCUR_CLI VARCHAR2(32),
DIREC_CLI VARCHAR2(32),
EMAIL_CLI VARCHAR2(32),
TEL_CLI INTEGER,
VENDEDOR VARCHAR2(32),
constraint PK_CLIENTES primary key (CED_CLI)
);
/*==============================================================*/
/* Index: ATIENDE_FK */
/*==============================================================*/
create index ATIENDE_FK on CLIENTES (
CED_EMP ASC
);
/*==============================================================*/
/* Index: CITA_CLI_FK */
/*==============================================================*/
/*==============================================================*/
/* Table: DEPARTAMENTOS */
/*==============================================================*/
create table DEPARTAMENTOS
(
NOMBRE_DEP VARCHAR2(32) not null,
DIRECTOR_DEP VARCHAR2(32) not null,
SUCURSAL VARCHAR2(32) not null,
constraint PK_DEPARTAMENTOS primary key (NOMBRE_DEP, SUCURSAL)
);
/*==============================================================*/
/* Table: EMPLEADOS */
/*==============================================================*/
create table EMPLEADOS
(
CED_EMP INTEGER not null,
NOM_CAR VARCHAR2(32),
NOMB_EMP VARCHAR2(1024) not null,
AP_EMP VARCHAR2(1024) not null,
GEN_EMP VARCHAR2(1024) not null,
EMAIL_EMP VARCHAR2(1024) not null,
FECHA_INGRESO DATE not null,
DEP_EMP VARCHAR2(1024) not null,
SUCURSAL_EMP VARCHAR2(1024) not null,
JEFE VARCHAR2(1024) not null,
SALARIO INTEGER not null,
COMISION INTEGER,
SANCION SMALLINT,
constraint PK_EMPLEADOS primary key (CED_EMP)
);
/*==============================================================*/
/* Index: TRABAJA_FK */
/*==============================================================*/
create index TRABAJA_FK on EMPLEADOS (
NOM_CAR ASC
);
/*==============================================================*/
/* Table: LISTA_DE_CANDIDATOS */
/*==============================================================*/
create table LISTA_DE_CANDIDATOS
(
CED_CAN INTEGER not null,
NOM_CAR VARCHAR2(32),
NOM_CAN_ VARCHAR2(1024),
AP_CAN VARCHAR2(1024),
GEN_CAN VARCHAR2(1024),
TEL_CAN INTEGER,
EMAIL_CAN VARCHAR2(1024),
APTITUD INTEGER,
SUCUR_CAN VARCHAR2(1024),
constraint PK_LISTA_DE_CANDIDATOS primary key (CED_CAN)
);
/*==============================================================*/
/* Index: ASPIRANTE_FK */
/*==============================================================*/
create index ASPIRANTE_FK on LISTA_DE_CANDIDATOS (
NOM_CAR ASC
);
/*==============================================================*/
/* Table: LLENA_BODEGA */
/*==============================================================*/
create table LLENA_BODEGA
(
CIUDADSU VARCHAR2(32) not null,
PAISSU VARCHAR2(32) not null,
NIT_PRO INTEGER not null,
constraint PK_LLENA_BODEGA primary key (CIUDADSU, PAISSU, NIT_PRO)
);
/*==============================================================*/
/* Index: LLENA_BODEGA2_FK */
/*==============================================================*/
create index LLENA_BODEGA2_FK on LLENA_BODEGA (
NIT_PRO ASC
);
/*==============================================================*/
/* Index: LLENA_BODEGA_FK */
/*==============================================================*/
create index LLENA_BODEGA_FK on LLENA_BODEGA (
CIUDADSU ASC,
PAISSU ASC
);
/*==============================================================*/
/* Table: PAISES */
/*==============================================================*/
create table PAISES
(
NOM_PAIS VARCHAR2(32),
ISO3166 INTEGER not null,
IATAPAIS VARCHAR2(2),
PREFIX INTEGER not null,
constraint PK_PAISES primary key (ISO3166)
);
/*==============================================================*/
/* Table: PRODUCTOS */
/*==============================================================*/
create table PRODUCTOS
(
ID_PROD INTEGER not null,
SUCUR_BOD VARCHAR2(32),
NIT_PRO INTEGER,
DESCRIP_PROD VARCHAR2(32) not null,
PRECIO_COMPRA INTEGER not null,
PRECIO_DE_VENTA INTEGER not null,
NOM_PRO VARCHAR2(32) not null,
constraint PK_PRODUCTOS primary key (ID_PROD)
);
/*==============================================================*/
/* Index: TENER_FK */
/*==============================================================*/
create index TENER_FK on PRODUCTOS (
ID_PRODUCTO ASC,
SUCUR_BOD ASC
);
/*==============================================================*/
/* Index: VENDE_EMPRE_FK */
/*==============================================================*/
create index VENDE_EMPRE_FK on PRODUCTOS (
NIT_PRO ASC
);
/*==============================================================*/
/* Table: PROVEEDORES */
/*==============================================================*/
create table PROVEEDORES
(
NOM_PRO VARCHAR2(32),
NIT_PRO INTEGER not null,
COD INTEGER,
TEL_PRO INTEGER,
DIREC_PRO VARCHAR2(32),
NOM_GER VARCHAR2(32),
CED_GER INTEGER,
TEL_GER INTEGER,
CIUDAD VARCHAR2(32),
EMAIL_PRO VARCHAR2(32),
constraint PK_PROVEEDORES primary key (NIT_PRO)
);
/*==============================================================*/
/* Table: SUCURSALES */
/*==============================================================*/
create table SUCURSALES
(
CIUDADSU VARCHAR2(32) not null,
PAISSU VARCHAR2(32) not null,
IATACIU VARCHAR2(3),
ID_PRODUCTO INTEGER,
SUCUR_BOD VARCHAR2(32),
DIRECTOR_DE_SUCURSAL VARCHAR2(32),
PREFIJOSU INTEGER,
TELEFONOSU INTEGER,
constraint PK_SUCURSALES primary key (CIUDADSU, PAISSU)
);
/*==============================================================*/
/* Index: SPER2_FK */
/*==============================================================*/
create index SPER2_FK on SUCURSALES (
IATACIU ASC
);
/*==============================================================*/
/* Index: INVENTARIO_FK */
/*==============================================================*/
create index INVENTARIO_FK on SUCURSALES (
ID_PRODUCTO ASC,
SUCUR_BOD ASC
);
/*==============================================================*/
/* Table: VENTAS */
/*==============================================================*/
create table VENTAS
(
ID_VENTA INTEGER not null,
ID_PRODUCTO INTEGER,
SUCUR_BOD VARCHAR2(32),
CED_EMP INTEGER,
CED_CLI INTEGER,
VENDEDOR_VE VARCHAR2(1024),
CLIENTE_VE VARCHAR2(1024),
IDPROVE INTEGER,
CANTIDAD_PRO INTEGER,
VALOR_VE INTEGER,
constraint PK_VENTAS primary key (ID_VENTA)
);
/*==============================================================*/
/* Index: SUMINISTRA_FK */
/*==============================================================*/
create index SUMINISTRA_FK on VENTAS (
ID_PRODUCTO ASC,
SUCUR_BOD ASC
);
/*==============================================================*/
/* Index: VENDE_FK */
/*==============================================================*/
create index VENDE_FK on VENTAS (
CED_EMP ASC
);
/*==============================================================*/
/* Index: COMPRA_FK */
/*==============================================================*/
create index COMPRA_FK on VENTAS (
CED_CLI ASC
);
/*==============================================================*/
/* Table: VISITAS */
/*==============================================================*/
create table VISITAS
(
VENDEDOR_CI VARCHAR2(32) not null,
CLIENTE_CI VARCHAR2(32) not null,
CED_CLI INTEGER,
CED_EMP INTEGER,
FECHA_CI DATE,
ESTADO VARCHAR2(32),
constraint PK_VISITAS primary key (CLIENTE_CI, VENDEDOR_CI)
);
/*==============================================================*/
/* Index: CITA_CLI2_FK */
/*==============================================================*/
create index CITA_CLI2_FK on VISITAS (
CED_CLI ASC
);
/*==============================================================*/
/* Index: CITA_EMP_FK */
/*==============================================================*/
create index CITA_EMP_FK on VISITAS (
CED_EMP ASC
);
alter table BODEGA
add constraint FK_BODEGA_INVENTARI_SUCURSAL foreign key (CIUDADSU, PAISSU)
references SUCURSALES (CIUDADSU, PAISSU);
alter table CARGOS
add constraint FK_CARGOS_PERTENECE_DEPARTAM foreign key (NOMBRE_DEP, SUCURSAL)
references DEPARTAMENTOS (NOMBRE_DEP, SUCURSAL);
alter table CIUDADES
add constraint FK_CIUDADES_LUGAR_PAISES foreign key (ISO3166)
references PAISES (ISO3166);
alter table CIUDADES
add constraint FK_CIUDADES_SPER_SUCURSAL foreign key (CIUDADSU, PAISSU)
references SUCURSALES (CIUDADSU, PAISSU);
alter table CLIENTES
add constraint FK_CLIENTES_ATIENDE_EMPLEADO foreign key (CED_EMP)
references EMPLEADOS (CED_EMP);
alter table CLIENTES
add constraint FK_CLIENTES_CITA_CLI_VISITAS foreign key (CLIENTE_CI, VENDEDOR_CI)
references VISITAS (CLIENTE_CI, VENDEDOR_CI);
alter table EMPLEADOS
add constraint FK_EMPLEADO_TRABAJA_CARGOS foreign key (NOM_CAR)
references CARGOS (NOM_CAR);
alter table LISTA_DE_CANDIDATOS
add constraint FK_LISTA_DE_ASPIRANTE_CARGOS foreign key (NOM_CAR)
references CARGOS (NOM_CAR);
alter table LLENA_BODEGA
add constraint FK_LLENA_BO_LLENA_BOD_SUCURSAL foreign key (CIUDADSU, PAISSU)
references SUCURSALES (CIUDADSU, PAISSU);
alter table LLENA_BODEGA
add constraint FK_LLENA_BO_LLENA_BOD_PROVEEDO foreign key (NIT_PRO)
references PROVEEDORES (NIT_PRO);
alter table PRODUCTOS
add constraint FK_PRODUCTO_TENER_BODEGA foreign key (ID_PRODUCTO, SUCUR_BOD)
references BODEGA (ID_PRODUCTO, SUCUR_BOD);
alter table PRODUCTOS
add constraint FK_PRODUCTO_VENDE_EMP_PROVEEDO foreign key (NIT_PRO)
references PROVEEDORES (NIT_PRO);
alter table SUCURSALES
add constraint FK_SUCURSAL_INVENTARI_BODEGA foreign key (ID_PRODUCTO, SUCUR_BOD)
references BODEGA (ID_PRODUCTO, SUCUR_BOD);
alter table SUCURSALES
add constraint FK_SUCURSAL_SPER2_CIUDADES foreign key (IATACIU)
references CIUDADES (IATACIU);
alter table VENTAS
add constraint FK_VENTAS_COMPRA_CLIENTES foreign key (CED_CLI)
references CLIENTES (CED_CLI);
alter table VENTAS
add constraint FK_VENTAS_SUMINISTR_BODEGA foreign key (ID_PRODUCTO, SUCUR_BOD)
references BODEGA (ID_PRODUCTO, SUCUR_BOD);
alter table VENTAS
add constraint FK_VENTAS_VENDE_EMPLEADO foreign key (CED_EMP)
references EMPLEADOS (CED_EMP);
alter table VISITAS
add constraint FK_VISITAS_CITA_CLI2_CLIENTES foreign key (CED_CLI)
references CLIENTES (CED_CLI);
alter table VISITAS
add constraint FK_VISITAS_CITA_EMP_EMPLEADO foreign key (CED_EMP)
references EMPLEADOS (CED_EMP);
CREATE TABLE PAISES_REGISTRADOSE (nombre_pais varchar(32), estado varchar(32));
CREATE TABLE EMPLEADOS_REGISTRADOS ( cedula_empleado int,nombre_empleado varchar(32), fecha_ingreso DATE, fecha_cambio_car DATE,fecha_desv DATE, estado varchar(32));
CREATE TABLE CLIENTE_REGISTRADO (cedula_cliente int, nombre_cliente varchar(32), estado varchar(32));
CREATE TABLE PRODUCTO_REGISTRADO (id_producto int,estado varchar(32));
CREATE TABLE PROVEEDORES_REGISTRADOS (nit_proveedor int,nom_pro varchar(32), estado varchar(32) );
create table BITACORA_VENTAS (vendedor varchar(32), cliente varchar(32),sucursal varchar(32),usuario varchar(32),hostname varchar(32),operacion varchar(32),fecha date);
CREATE VIEW VIPAISES_REGISTRADOSE as select * from PAISES_REGISTRADOSE;
CREATE VIEW VRPAISES_REGISTRADOSE AS SELECT * FROM PAISES_REGISTRADOSE;
CREATE VIEW VIEMPLEADOS_REGISTRADOS AS SELECT * FROM EMPLEADOS_REGISTRADOS;
CREATE VIEW VREMPLEADOS_REGISTRADOS AS SELECT * FROM EMPLEADOS_REGISTRADOS;
CREATE VIEW VICLIENTE_REGISTRADO AS SELECT * FROM CLIENTE_REGISTRADO;
CREATE VIEW VRCLIENTE_REGISTRADO AS SELECT * FROM CLIENTE_REGISTRADO;
CREATE VIEW VIPRODUCTO_REGISTRADO AS SELECT * FROM PRODUCTO_REGISTRADO;
CREATE VIEW VRPRODUCTO_REGISTRADO AS SELECT * FROM PRODUCTO_REGISTRADO;
CREATE VIEW VIPROVEEDORES_REGISTRADOS AS SELECT * FROM PROVEEDORES_REGISTRADOS;
CREATE VIEW VRPROVEEDORES_REGISTRADOS AS SELECT * FROM PROVEEDORES_REGISTRADOS;
CREATE VIEW VIBITACORA_VENTAS AS SELECT * FROM BITACORA_VENTAS;
CREATE VIEW VRBITACORA_VENTAS AS SELECT * FROM BITACORA_VENTAS;
GRANT INSERT ON VIPAISES_REGISTRADOSE TO grupo22;
GRANT SELECT ON VRPAISES_REGISTRADOSE TO grupo22;
GRANT INSERT ON VIEMPLEADOS_REGISTRADOS TO grupo22;
GRANT SELECT ON VREMPLEADOS_REGISTRADOS TO grupo22;
GRANT INSERT ON VICLIENTE_REGISTRADO TO grupo22;
GRANT SELECT ON VRCLIENTE_REGISTRADO TO grupo22;
GRANT INSERT ON VIPRODUCTO_REGISTRADO TO grupo22;
GRANT SELECT ON VRPRODUCTO_REGISTRADO TO grupo22;
GRANT INSERT ON VIPROVEEDORES_REGISTRADOS TO grupo22;
GRANT SELECT ON VRPROVEEDORES_REGISTRADOS TO grupo22;
GRANT INSERT ON VIBITACORA_VENTAS TO grupo22;
GRANT SELECT ON VRBITACORA_VENTAS TO grupo22;
| true |
281eef12547134f9832c5cc9109cefb68fbc7d1d | SQL | isuru89/oasis | /services/stats-api/src/main/resources/io/github/oasis/db/scripts/game/readGameStatus.sql | UTF-8 | 158 | 2.9375 | 3 | [
"Apache-2.0"
] | permissive | SELECT
OGS.game_id AS gameId,
OGS.status,
OGS.updated_at AS updatedAt
FROM
OA_GAME_STATUS OGS
WHERE
game_id = :id
ORDER BY
updated_at DESC
LIMIT 1 | true |
ecaeb3d0b64d9671641aaa220a6c4a6a110b930d | SQL | CommunityConnect/CoCo | /demo_invitation/cocoinv_clean.sql | UTF-8 | 13,485 | 2.828125 | 3 | [] | no_license | -- MySQL dump 10.13 Distrib 5.5.52, for debian-linux-gnu (x86_64)
--
-- Host: 127.0.0.1 Database: CoCoINV
-- ------------------------------------------------------
-- Server version 5.5.52-0ubuntu0.14.04.1
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `domainSite`
--
DROP TABLE IF EXISTS `domainSite`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `domainSite` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`domain` int(10) unsigned NOT NULL,
`site` int(10) unsigned NOT NULL,
PRIMARY KEY (`id`),
KEY `domainID_idx` (`domain`),
KEY `siteId_idx` (`site`),
CONSTRAINT `domainId_sites` FOREIGN KEY (`domain`) REFERENCES `domains` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `siteId` FOREIGN KEY (`site`) REFERENCES `sites` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `domainSite`
--
LOCK TABLES `domainSite` WRITE;
/*!40000 ALTER TABLE `domainSite` DISABLE KEYS */;
INSERT INTO `domainSite` VALUES (1,1,1),(2,1,2);
/*!40000 ALTER TABLE `domainSite` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `domains`
--
DROP TABLE IF EXISTS `domains`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `domains` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`portal_address` varchar(45) NOT NULL,
`email_domain` varchar(45) NOT NULL,
`bgp_ip` varchar(45) DEFAULT NULL,
`as_num` int(11) DEFAULT NULL,
`as_name` varchar(45) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `domains`
--
LOCK TABLES `domains` WRITE;
/*!40000 ALTER TABLE `domains` DISABLE KEYS */;
INSERT INTO `domains` VALUES (1,'www1','email1','10.2.0.254',65020,'tno-north'),(2,'www2','email2','10.3.0.254',65030,'tno-south');
/*!40000 ALTER TABLE `domains` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `extLinks`
--
DROP TABLE IF EXISTS `extLinks`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `extLinks` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`switch` int(11) DEFAULT NULL,
`domain` int(10) unsigned DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `switch_idx` (`switch`),
KEY `domain_idx` (`domain`),
CONSTRAINT `domain_fk_ext` FOREIGN KEY (`domain`) REFERENCES `domains` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `switch_fk_ext` FOREIGN KEY (`switch`) REFERENCES `switches` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `extLinks`
--
LOCK TABLES `extLinks` WRITE;
/*!40000 ALTER TABLE `extLinks` DISABLE KEYS */;
INSERT INTO `extLinks` VALUES (1,3,2);
/*!40000 ALTER TABLE `extLinks` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `links`
--
DROP TABLE IF EXISTS `links`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `links` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`from` int(11) NOT NULL,
`to` int(11) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `id_UNIQUE` (`id`),
KEY `from_idx` (`from`),
KEY `to_idx` (`to`),
CONSTRAINT `from` FOREIGN KEY (`from`) REFERENCES `switches` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `to` FOREIGN KEY (`to`) REFERENCES `switches` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `links`
--
LOCK TABLES `links` WRITE;
/*!40000 ALTER TABLE `links` DISABLE KEYS */;
INSERT INTO `links` VALUES (1,1,3),(2,2,1);
/*!40000 ALTER TABLE `links` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `sites`
--
DROP TABLE IF EXISTS `sites`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `sites` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(45) NOT NULL,
`x` int(11) NOT NULL,
`y` int(11) NOT NULL,
`switch` int(11) NOT NULL,
`remote_port` int(10) unsigned NOT NULL,
`local_port` int(10) unsigned NOT NULL,
`vlanid` int(10) unsigned NOT NULL,
`ipv4prefix` varchar(45) NOT NULL,
`mac_address` varchar(45) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `id_UNIQUE` (`id`),
UNIQUE KEY `name_UNIQUE` (`name`),
KEY `switch_idx` (`switch`),
CONSTRAINT `switch_id` FOREIGN KEY (`switch`) REFERENCES `switches` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `sites`
--
LOCK TABLES `sites` WRITE;
/*!40000 ALTER TABLE `sites` DISABLE KEYS */;
INSERT INTO `sites` VALUES (1,'tn_ce1',0,0,2,2,1,0,'10.2.1.0/24','00:10:02:00:00:01'),(2,'tn_ce2',0,0,3,2,1,0,'10.2.2.0/24','00:10:02:00:00:02');
/*!40000 ALTER TABLE `sites` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `subnetUsers`
--
DROP TABLE IF EXISTS `subnetUsers`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `subnetUsers` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`user` int(10) unsigned NOT NULL,
`subnet` int(10) unsigned NOT NULL,
PRIMARY KEY (`id`),
KEY `adminId_idx` (`user`),
KEY `fk_userSubnet_subnets1_idx` (`subnet`),
CONSTRAINT `userId1` FOREIGN KEY (`user`) REFERENCES `users` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_userSubnet_subnets1` FOREIGN KEY (`subnet`) REFERENCES `subnets` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `subnetUsers`
--
LOCK TABLES `subnetUsers` WRITE;
/*!40000 ALTER TABLE `subnetUsers` DISABLE KEYS */;
INSERT INTO `subnetUsers` VALUES (1,2,1),(2,4,2);
/*!40000 ALTER TABLE `subnetUsers` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `subnets`
--
DROP TABLE IF EXISTS `subnets`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `subnets` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`subnet` varchar(45) NOT NULL,
`site` int(10) unsigned NOT NULL,
PRIMARY KEY (`id`),
KEY `fk_subnets_site1_idx` (`site`),
CONSTRAINT `fk_subnets_site1` FOREIGN KEY (`site`) REFERENCES `sites` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `subnets`
--
LOCK TABLES `subnets` WRITE;
/*!40000 ALTER TABLE `subnets` DISABLE KEYS */;
INSERT INTO `subnets` VALUES (1,'10.2.1.0/24',1),(2,'10.2.2.0/24',2);
/*!40000 ALTER TABLE `subnets` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `switches`
--
DROP TABLE IF EXISTS `switches`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `switches` (
`id` int(11) NOT NULL,
`name` varchar(45) NOT NULL,
`mininetname` varchar(45) NOT NULL,
`x` int(10) unsigned NOT NULL,
`y` int(10) unsigned NOT NULL,
`mpls_label` int(10) unsigned NOT NULL,
PRIMARY KEY (`id`,`name`),
UNIQUE KEY `id_UNIQUE` (`id`),
UNIQUE KEY `name_UNIQUE` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `switches`
--
LOCK TABLES `switches` WRITE;
/*!40000 ALTER TABLE `switches` DISABLE KEYS */;
INSERT INTO `switches` VALUES (1,'openflow:34','tn_pc1',0,0,0),(2,'openflow:33','tn_pe1',0,0,0),(3,'openflow:35','tn_pe2',0,0,0);
/*!40000 ALTER TABLE `switches` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `users`
--
DROP TABLE IF EXISTS `users`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `users` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(45) DEFAULT NULL,
`email` varchar(45) NOT NULL,
`domain` int(10) unsigned NOT NULL,
`site` int(10) unsigned NOT NULL,
`admin` tinyint(1) NOT NULL,
PRIMARY KEY (`id`),
KEY `pk_user_idx` (`id`),
KEY `domainId_idx` (`domain`),
KEY `fk_user_site1_idx` (`site`),
CONSTRAINT `domainId_users` FOREIGN KEY (`domain`) REFERENCES `domains` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_user_site1` FOREIGN KEY (`site`) REFERENCES `sites` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `users`
--
LOCK TABLES `users` WRITE;
/*!40000 ALTER TABLE `users` DISABLE KEYS */;
INSERT INTO `users` VALUES (1,'tn_ce1_admin','tn_ce1_admin@mail.com',1,1,1),(2,'tn_ce1_user','tn_ce1_user@mail.com',1,1,0),(3,'tn_ce2_admin','tn_ce2_admin@mail.com',1,2,1),(4,'tn_ce2_user','tn_ce2_user@mail.com',1,2,0);
/*!40000 ALTER TABLE `users` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `vpnSubnet`
--
DROP TABLE IF EXISTS `vpnSubnet`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `vpnSubnet` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`vpn` int(10) unsigned NOT NULL,
`subnet` int(10) unsigned NOT NULL,
PRIMARY KEY (`id`),
KEY `vpnId_idx` (`vpn`),
KEY `fk_vpnToSite_subnets1_idx` (`subnet`),
CONSTRAINT `vpnId_subnet` FOREIGN KEY (`vpn`) REFERENCES `vpns` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_vpnToSite_subnets1` FOREIGN KEY (`subnet`) REFERENCES `subnets` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `vpnSubnet`
--
LOCK TABLES `vpnSubnet` WRITE;
/*!40000 ALTER TABLE `vpnSubnet` DISABLE KEYS */;
/*!40000 ALTER TABLE `vpnSubnet` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `vpnUsers`
--
DROP TABLE IF EXISTS `vpnUsers`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `vpnUsers` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`vpn` int(10) unsigned NOT NULL,
`user` int(10) unsigned NOT NULL,
PRIMARY KEY (`id`),
KEY `vpnId_idx` (`vpn`),
KEY `userId_idx` (`user`),
CONSTRAINT `vpnId_users` FOREIGN KEY (`vpn`) REFERENCES `vpns` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `userId` FOREIGN KEY (`user`) REFERENCES `users` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `vpnUsers`
--
LOCK TABLES `vpnUsers` WRITE;
/*!40000 ALTER TABLE `vpnUsers` DISABLE KEYS */;
/*!40000 ALTER TABLE `vpnUsers` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `vpns`
--
DROP TABLE IF EXISTS `vpns`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `vpns` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(45) DEFAULT NULL,
`route_target` varchar(45) NOT NULL,
`domain` int(10) unsigned NOT NULL,
`owner` int(10) unsigned NOT NULL,
`pathProtection` varchar(45) DEFAULT NULL,
`failoverType` varchar(45) DEFAULT NULL,
`isPublic` tinyint(1) NOT NULL,
PRIMARY KEY (`id`),
KEY `domainId_idx1` (`domain`),
KEY `fk_vpn_user1_idx1` (`owner`),
CONSTRAINT `domainId_vpns` FOREIGN KEY (`domain`) REFERENCES `domains` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_vpn_user1` FOREIGN KEY (`owner`) REFERENCES `users` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `vpns`
--
LOCK TABLES `vpns` WRITE;
/*!40000 ALTER TABLE `vpns` DISABLE KEYS */;
/*!40000 ALTER TABLE `vpns` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2016-09-22 14:25:40
| true |
1b3644c69b8e1a3cef1efb66d837f9ed6c5007c5 | SQL | koninklijke-collective/koning_api_queue | /ext_tables.sql | UTF-8 | 1,837 | 2.75 | 3 | [] | no_license | #
# Table structure for table 'tx_koningapiqueue_domain_model_api'
#
CREATE TABLE tx_koningapiqueue_domain_model_api (
uid int(11) NOT NULL auto_increment,
pid int(11) DEFAULT '0',
tstamp int(11) DEFAULT '0' NOT NULL,
crdate int(11) DEFAULT '0' NOT NULL,
cruser_id int(11) DEFAULT '0' NOT NULL,
editlock tinyint(4) DEFAULT '0' NOT NULL,
identifier varchar(225) DEFAULT '',
name varchar(225) DEFAULT '',
description text NOT NULL,
location varchar(225) DEFAULT '',
requests int(11) DEFAULT '0' NOT NULL,
PRIMARY KEY (uid)
);
#
# Table structure for table 'tx_koningapiqueue_domain_model_request'
#
CREATE TABLE tx_koningapiqueue_domain_model_request (
uid int(11) NOT NULL auto_increment,
pid int(11) DEFAULT '0',
tstamp int(11) DEFAULT '0' NOT NULL,
crdate int(11) DEFAULT '0' NOT NULL,
cruser_id int(11) DEFAULT '0' NOT NULL,
editlock tinyint(4) DEFAULT '0' NOT NULL,
api int(11) DEFAULT '0' NOT NULL,
request int(11) DEFAULT '0' NOT NULL,
location varchar(225) DEFAULT '',
method varchar(6) DEFAULT '',
body longtext NOT NULL,
headers text NOT NULL,
last_process_date int(11) DEFAULT '0' NOT NULL,
responses int(11) DEFAULT '0' NOT NULL,
PRIMARY KEY (uid)
);
#
# Table structure for table 'tx_koningapiqueue_domain_model_request'
#
CREATE TABLE tx_koningapiqueue_domain_model_response (
uid int(11) NOT NULL auto_increment,
pid int(11) DEFAULT '0',
tstamp int(11) DEFAULT '0' NOT NULL,
crdate int(11) DEFAULT '0' NOT NULL,
cruser_id int(11) DEFAULT '0' NOT NULL,
editlock tinyint(4) DEFAULT '0' NOT NULL,
request int(11) DEFAULT '0' NOT NULL,
processed_date int(11) DEFAULT '0' NOT NULL,
status_code int(11) DEFAULT '0' NOT NULL,
body longtext NOT NULL,
PRIMARY KEY (uid)
);
| true |
bd8890f3596cb2e27562d7cf2d19bb98b5fabfdd | SQL | motogoozy/houser | /db/seed.sql | UTF-8 | 746 | 3.46875 | 3 | [] | no_license | -- Create Table
create table houses(
id serial PRIMARY KEY,
property_name varchar(30),
address varchar(100),
city varchar(100),
state varchar(2),
zip integer
);
-- Adding dummy data
insert into houses(property_name, address, city, state, zip)
values('Kyles House', '123 Main St', 'Spanish Fork', 'UT', 84660);
insert into houses(property_name, address, city, state, zip)
values('Milos House', '456 Center St', 'Salt Lake City', 'UT', 85858);
insert into houses(property_name, address, city, state, zip)
values('Marisas House', '789 East St', 'Los Angeles', 'CA', 90210);
-- Adding Columns
ALTER TABLE houses
ADD image VARCHAR(200);
ALTER TABLE houses
ADD mortgage integer;
ALTER TABLE houses
ADD rent integer; | true |
6bcdde205edb0d49dcce968894748323c18899f3 | SQL | patricknaka/Nova | /Views Nike/VW_NK_FLASH_CAIXA_PEDIDO.sql | UTF-8 | 4,815 | 3.265625 | 3 | [] | no_license | SELECT
-- O campo CD_CIA foi incluido para diferenciar NIKE(13) E BUNZL(15)
--**********************************************************************************************************************************************************
Q_ENTREGA.t$UNEG$C CD_UNIDADE_NEGOCIO,
Q_ENTREGA.t$PECL$C NR_PEDIDO,
Q_ENTREGA.t$ENTR$C NR_ENTREGA,
tdsls400.t$ORNO NR_ORDEM,
CAST((FROM_TZ(TO_TIMESTAMP(TO_CHAR(tdsls400.t$ddat, 'DD-MON-YYYY HH24:MI:SS'), 'DD-MON-YYYY HH24:MI:SS'), 'GMT')
AT time zone 'America/Sao_Paulo') AS DATE) DT_LIMITE_EXP,
CAST((FROM_TZ(TO_TIMESTAMP(TO_CHAR(znsls400.t$dtem$c, 'DD-MON-YYYY HH24:MI:SS'), 'DD-MON-YYYY HH24:MI:SS'), 'GMT')
AT time zone 'America/Sao_Paulo') AS DATE) DT_EMISSAO,
cast(znfmd001.t$fili$c as int) CD_FILIAL,
znfmd001.t$dsca$c DS_FILIAL,
cast(Q_ENTREGA.VL_TOTAL as numeric(15,2)) VL_TOTAL,
cast(Q_ENTREGA.QUANTIDADE as int) QT_VENDIDA,
ltrim(rtrim(Q_ENTREGA.t$itml$c)) CD_ITEM,
cast((whwmd400.t$hght*
whwmd400.t$wdth*
whwmd400.t$dpth*
Q_ENTREGA.QUANTIDADE) as numeric(15,4)) VL_VOLUME_M3,
tcibd001.t$citg CD_DEPARTAMENTO,
tcmcs023.t$dsca DS_DEPARTAMENTO,
CAST(13 AS INT) CD_CIA
FROM
(SELECT
znsls401.T$NCIA$C,
znsls401.T$UNEG$C,
znsls401.T$PECL$C,
znsls401.T$SQPD$C,
znsls401.T$ENTR$C,
znsls401.t$itml$c,
SUM(znsls401.t$vlun$c*znsls401.t$qtve$c)+
sum(znsls401.t$vlfr$c) -
sum(znsls401.t$vldi$c) VL_TOTAL,
sum(znsls401.t$qtve$c) QUANTIDADE
FROM baandb.tznsls401601 znsls401
GROUP BY
znsls401.T$NCIA$C,
znsls401.T$UNEG$C,
znsls401.T$PECL$C,
znsls401.T$SQPD$C,
znsls401.T$ENTR$C,
znsls401.t$itml$c) Q_ENTREGA
INNER JOIN baandb.tznsls400601 znsls400 ON znsls400.T$NCIA$C = Q_ENTREGA.T$NCIA$C
AND znsls400.T$UNEG$C = Q_ENTREGA.T$UNEG$C
AND znsls400.T$PECL$C = Q_ENTREGA.T$PECL$C
AND znsls400.T$SQPD$C = Q_ENTREGA.T$SQPD$C
INNER JOIN
(SELECT
znsls410.T$NCIA$C,
znsls410.T$UNEG$C,
znsls410.T$PECL$C,
znsls410.T$SQPD$C,
znsls410.T$ENTR$C,
--znsls410.t$ORNO$C,
znsls410.T$POCO$C ID_ULTIMO_PONTO,
ROW_NUMBER() OVER (PARTITION BY znsls410.T$NCIA$C,
znsls410.T$UNEG$C,
znsls410.T$PECL$C,
znsls410.T$SQPD$C,
znsls410.T$ENTR$C
ORDER BY znsls410.T$DTOC$C DESC, znsls410.T$SEQN$C DESC) RN
FROM baandb.tznsls410601 znsls410) Q_UPONTO
ON Q_UPONTO.T$NCIA$C = Q_ENTREGA.T$NCIA$C
AND Q_UPONTO.T$UNEG$C = Q_ENTREGA.T$UNEG$C
AND Q_UPONTO.T$PECL$C = Q_ENTREGA.T$PECL$C
AND Q_UPONTO.T$SQPD$C = Q_ENTREGA.T$SQPD$C
AND Q_UPONTO.T$ENTR$C = Q_ENTREGA.T$ENTR$C
INNER JOIN (SELECT
A.T$NCIA$C,
A.T$UNEG$C,
A.T$PECL$C,
A.T$SQPD$C,
A.T$ENTR$C,
MAX(A.T$ORNO$C) T$ORNO$C
FROM BAANDB.TZNSLS004601 A
WHERE A.T$DATE$C=( SELECT MAX(B.T$DATE$C)
FROM BAANDB.TZNSLS004601 B
WHERE B.T$NCIA$C=A.T$NCIA$C
AND B.T$UNEG$C=A.T$UNEG$C
AND B.T$PECL$C=A.T$PECL$C
AND B.T$SQPD$C=A.T$SQPD$C
AND B.T$ENTR$C=A.T$ENTR$C)
GROUP BY A.T$NCIA$C,
A.T$UNEG$C,
A.T$PECL$C,
A.T$SQPD$C,
A.T$ENTR$C) ZNSLS004
ON ZNSLS004.T$NCIA$C = Q_UPONTO.T$NCIA$C
AND ZNSLS004.T$UNEG$C = Q_UPONTO.T$UNEG$C
AND ZNSLS004.T$PECL$C = Q_UPONTO.T$PECL$C
AND ZNSLS004.T$SQPD$C = Q_UPONTO.T$SQPD$C
AND ZNSLS004.T$ENTR$C = Q_UPONTO.T$ENTR$C
INNER JOIN baandb.ttdsls400601 tdsls400 ON tdsls400.t$orno = ZNSLS004.t$ORNO$C
INNER JOIN baandb.ttcmcs065601 tcmcs065 ON tcmcs065.t$cwoc = tdsls400.t$cofc
INNER JOIN baandb.ttccom130601 tccom130 ON tccom130.t$cadr = tcmcs065.t$cadr
INNER JOIN baandb.tznfmd001601 znfmd001 ON znfmd001.t$fovn$c = tccom130.t$fovn$l
INNER JOIN baandb.twhwmd400601 whwmd400 ON whwmd400.t$item = Q_ENTREGA.t$itml$c
INNER JOIN baandb.ttcibd001601 tcibd001 ON tcibd001.t$item = Q_ENTREGA.t$itml$c
INNER JOIN baandb.ttcmcs023601 tcmcs023 ON tcmcs023.t$citg = tcibd001.t$citg
WHERE Q_UPONTO.ID_ULTIMO_PONTO='WMS'
AND Q_UPONTO.RN=1
AND Q_ENTREGA.QUANTIDADE>0
AND tdsls400.t$hdst!=35 | true |
cbb8e7fc758fb9721f10326ef87ec45f968a0759 | SQL | mskf3000/codework | /sql-fmt/sample/eam010/q1.1.sql | ISO-8859-1 | 18,410 | 3.0625 | 3 | [] | no_license | --SELECT COUNT(1) FROM (
SELECT /***** RULE */
DISTINCT
ewo.wip_entity_name ordem_servico
, ewo.wip_entity_name ordem_servico2
, DECODE( NVL(ewo.parent_wip_entity_name,NVL(ewo.manual_rebuild_flag,'N'))
, 'N','Ordem de Servio'
,'Ordem de Servio de Recriao') tipo_ordem
, db.department_code||' - '||db.description departamento_responsavel
, NVL(ewo.service_request, wewr.work_request_number ) num_solicitacao_servico
, mel.location_codes||' - '||mel.description area
, ewo.activity_source_meaning origem_ativo
, fu.user_name planejador
, ewo.asset_number tag_comum
, msi.segment1 grupo_ativos
, msi.description desc_grupo_ativos
, mea.descriptive_text desc_ativos
, DECODE( NVL(ewo.rebuild_serial_number,'X')
, ewo.rebuild_serial_number, DECODE( NVL(ewo.parent_wip_entity_name, NVL(ewo.manual_rebuild_flag,'N'))
, 'N',ewo.asset_description
, mear.descriptive_text
)
, NULL) ativo
, mea.fa_asset_number num_patrimonio
, ewo.rebuild_serial_number tag_recriavel
, msb.segment1 grupo_ativos_recriavel
, msb.description desc_grupo_ativos_recriavel
, msb.description desc_ativos
, CASE WHEN SUBSTR(UPPER(flv.meaning),1,1) IN ('N') THEN 'NO' ELSE 'SIM' END medidor
, CASE WHEN SUBSTR(UPPER(flv.meaning),1,1) IN ('N') THEN '' ELSE me.meter_name END nome
, CASE WHEN SUBSTR(UPPER(flv.meaning),1,1) IN ('N') THEN '' ELSE me.meter_uom END udm
, DECODE( mrr.reset_flag
, 'Y', 0
, mrr.current_reading
) ultima_leitura
, mfgl_tp.meaning tipo_os
, ewo.priority_disp prioridade
, TO_CHAR(ewo.creation_date ,'dd/mm/yy hh24:mi') data_emissao
, ewo.activity_type_disp tipo_atividade
, ewo.activity_cause_disp causa_atividade
, TO_CHAR(ewo.scheduled_start_date,'dd/mm/yy hh24:mi') data_programada
, NVL(meav.activity, msi_at.segment1) numero_atividade
, NVL(meav.activity_description, NVL(msi_at.description,ewo.description)) descricao_atividade
, ewo.status_type_disp status
, TO_CHAR(ewo.scheduled_start_date ,'dd/mm/yy hh24:mi') inicio_programado
, TO_CHAR(ewo.scheduled_completion_date,'dd/mm/yy hh24:mi') final_programado
, (ewo.scheduled_completion_date - ewo.scheduled_start_date)*24*60 tempo_parada_programado -- Em minutos
, db.department_id
, NULL inicio_real
, NULL final_real
, NULL tempo_real
, NULL leitura_atual
, ewo.organization_id
, ewo.status_type
, ewo.wip_entity_id
, mea.serial_number
FROM wip_eam_work_requests_v wewr
, bom_departments db
, mtl_eam_locations mel
, mtl_serial_numbers msn
, fnd_user fu
, mtl_system_items_b msi_at --\ Ativo Standard
, mtl_system_items_b msi
, mtl_system_items_b msb
, mtl_eam_asset_numbers_all_v mea
, mtl_eam_asset_numbers_all_v mear -- Descrio ativo Recriavel
, eam_meters me
, eam_asset_meters am
, eam_meter_readings mrr
, mfg_lookups mfgl_tp
, mfg_lookups mfgl
, fnd_lookup_values flv
, wip_discrete_jobs j
, mtl_eam_asset_activities meaa
, mtl_eam_asset_activities_v meav
, eam_work_orders_v ewo
WHERE db.department_code = ewo.owning_department_code
AND db.organization_id = ewo.organization_id
AND ewo.maintenance_object_id = msn.gen_object_id (+)
AND ewo.organization_id = msn.current_organization_id (+)
AND msn.eam_location_id = mel.location_id (+)
AND ewo.created_by = fu.user_id
AND ewo.asset_group_id = msi.inventory_item_id (+)
AND ewo.organization_id = msi.organization_id (+)
AND ewo.primary_item_id = msi_at.inventory_item_id (+)
AND ewo.organization_id = msi_at.organization_id (+)
AND ewo.asset_number = mea.maintained_unit (+)
AND ewo.rebuild_serial_number = mear.serial_number (+) -- descrio de ativo recriavel -- 08/01/2007
AND ewo.rebuild_item_id = mear.inventory_item_id (+) -- descrio de ativo recriavel -- 08/01/2007
AND ewo.rebuild_item_id = msb.inventory_item_id (+)
AND ewo.organization_id = msb.organization_id (+)
AND me.meter_id = am.meter_id
AND am.meter_id = mrr.meter_id (+)
AND NVL(mrr.meter_reading_id, -1) = NVL(eam_meter_readings_jsp.get_latest_meter_reading_id(me.meter_id), -1)
AND NVL(me.from_effective_date, SYSDATE)<= SYSDATE
AND NVL(me.to_effective_date, SYSDATE+1)>= SYSDATE
AND 'EAM_METER_VALUE_CHANGE' = mfgl.lookup_type (+)
AND me.value_change_dir = mfgl.lookup_code (+)
AND ewo.work_order_type = mfgl_tp.lookup_code (+)
AND 'WIP_EAM_WORK_ORDER_TYPE' = mfgl_tp.lookup_type (+)
AND NVL(mfgl_tp.enabled_flag,'Y') = 'Y'
AND flv.lookup_type = 'EAM_YES_NO'
AND flv.lookup_code = eam_meter_readings_jsp.is_meter_reading_mandatory(j.wip_entity_id,am.meter_id)
AND flv.language = USERENV('LANG')
AND j.wip_entity_id = ewo.wip_entity_id
AND meaa.activity_association_id = meav.activity_association_id (+)
AND meaa.asset_activity_id = meav.asset_activity_id (+)
AND meaa.inventory_item_id = meav.inventory_item_id (+)
AND meaa.wip_entity_id (+) = ewo.wip_entity_id
AND ewo.wip_entity_name BETWEEN NVL(&p_ordem_servico_ini, ewo.wip_entity_name)
AND NVL(&p_ordem_servico_fim, ewo.wip_entity_name)
AND ewo.scheduled_start_date BETWEEN NVL( TO_DATE(&p_dt_ini_ini,'rrrr/mm/dd hh24:mi:ss') , ewo.scheduled_start_date )
AND NVL(TRUNC(TO_DATE(&p_dt_ini_fim,'rrrr/mm/dd hh24:mi:ss') + .99999), ewo.scheduled_start_date )
AND NVL(mel.location_codes,'x') BETWEEN NVL(&p_area_ativo_ini , NVL(mel.location_codes,'x'))
AND NVL(&p_area_ativo_fim , NVL(mel.location_codes,'x'))
AND NVL(ewo.asset_number,'x') = NVL(&p_num_ativo , NVL(ewo.asset_number,'x'))
AND ewo.status_type = NVL(&p_status_os , ewo.status_type)
AND db.department_code = NVL(&p_depart_atrib , db.department_code)
AND wewr.wip_entity_id (+) = ewo.wip_entity_id
AND ewo.organization_id = NVL(&p_organization_id, ewo.organization_id)
UNION
SELECT
DISTINCT
ewo.wip_entity_name ordem_servico
, ewo.wip_entity_name ordem_servico2
, DECODE( NVL(ewo.parent_wip_entity_name,NVL(ewo.manual_rebuild_flag,'N'))
, 'N','Ordem de Servio'
, 'Ordem de Servio de Recriao') tipo_ordem
, db.department_code||' - '||db.description departamento_responsavel
, NVL(ewo.service_request, wewr.work_request_number ) num_solicitacao_servico
, mel.location_codes||' - '||mel.description area
, ewo.activity_source_meaning origem_ativo
, fu.user_name planejador
, ewo.asset_number tag_comum
, msi.segment1 grupo_ativos
, msi.description desc_grupo_ativos
, mea.descriptive_text desc_ativos
, DECODE( NVL(ewo.rebuild_serial_number,'x')
, ewo.rebuild_serial_number, DECODE( NVL(ewo.parent_wip_entity_name, NVL(ewo.manual_rebuild_flag,'N'))
, 'N', ewo.asset_description
, mear.descriptive_text)
, NULL ) ativo
, mea.fa_asset_number num_patrimonio
, ewo.rebuild_serial_number tag_recriavel
, msb.segment1 grupo_ativos_recriavel
, msb.description desc_grupo_ativos_recriavel
, mea.descriptive_text desc_ativos
, 'NO' medidor
, NULL nome
, NULL udm
, NULL ultima_leitura
, mfgl_tp.meaning tipo_os
, ewo.priority_disp prioridade
, TO_CHAR(EWO.CREATION_DATE,'DD/MM/YY HH24:MI') Data_Emissao
, ewo.activity_type_disp tipo_atividade
, ewo.activity_cause_disp causa_atividade
, TO_CHAR(ewo.scheduled_start_date,'dd/mm/yy hh24:mi') data_programada
, NVL(meav.activity, msi_at.segment1) numero_atividade
, NVL(meav.activity_description, NVL(msi_at.description,
ewo.description) ) descricao_atividade
, ewo.status_type_disp status
, TO_CHAR(ewo.scheduled_start_date , 'dd/mm/yy hh24:mi') inicio_programado
, TO_CHAR(ewo.scheduled_completion_date, 'dd/mm/yy hh24:mi') final_programado
, (ewo.scheduled_completion_date - ewo.scheduled_start_date)*24*60 tempo_parada_programado -- em minutos
, db.department_id
, NULL inicio_real
, NULL final_real
, NULL tempo_real
, NULL leitura_atual
, ewo.organization_id
, ewo.status_type
, ewo.wip_entity_id
, mea.serial_number
FROM
wip_eam_work_requests_v wewr
, bom_departments db
, mtl_eam_locations mel
, mtl_serial_numbers msn
, fnd_user fu
, mtl_system_items_b msi_at --\ Ativo Standard
, mtl_system_items_b msi
, mtl_system_items_b msb
, mtl_eam_asset_numbers_all_v mea
, mtl_eam_asset_numbers_all_v mear -- Descrio ativo Recriavel
, mfg_lookups mfgl_tp
, mfg_lookups mfgl
, fnd_lookup_values flv
, wip_discrete_jobs j
, mtl_eam_asset_activities meaa
, mtl_eam_asset_activities_v meav
, eam_work_orders_v ewo
WHERE db.department_code = ewo.owning_department_code
AND db.organization_id = ewo.organization_id
AND ewo.maintenance_object_id = msn.gen_object_id (+)
AND ewo.organization_id = msn.current_organization_id (+)
AND msn.eam_location_id = mel.location_id (+)
AND ewo.created_by = fu.user_id
AND ewo.asset_group_id = msi.inventory_item_id (+)
AND ewo.organization_id = msi.organization_id (+)
AND ewo.primary_item_id = msi_at.inventory_item_id (+)
AND ewo.organization_id = msi_at.organization_id (+)
AND ewo.asset_number = mea.maintained_unit (+)
AND ewo.rebuild_serial_number = mear.serial_number (+)
AND ewo.rebuild_item_id = mear.inventory_item_id (+)
AND ewo.rebuild_item_id = msb.inventory_item_id (+)
AND ewo.organization_id = msb.organization_id (+)
AND 'EAM_METER_VALUE_CHANGE' = mfgl.lookup_type (+)
AND ewo.work_order_type = mfgl_tp.lookup_code (+)
AND 'WIP_EAM_WORK_ORDER_TYPE' = mfgl_tp.lookup_type (+)
AND NVL(mfgl_tp.enabled_flag,'Y') = 'Y'
AND flv.lookup_type = 'EAM_YES_NO'
AND flv.lookup_code = eam_meter_readings_jsp.is_meter_reading_mandatory(j.wip_entity_id,NULL) --am.meter_id)
AND flv.language = USERENV('LANG')
AND j.wip_entity_id = ewo.wip_entity_id
AND meaa.activity_association_id = meav.activity_association_id (+)
AND meaa.asset_activity_id = meav.asset_activity_id (+)
AND meaa.inventory_item_id = meav.inventory_item_id (+)
AND meaa.wip_entity_id (+) = ewo.wip_entity_id
AND ewo.wip_entity_name BETWEEN NVL(&p_ordem_servico_ini, ewo.wip_entity_name)
AND NVL(&p_ordem_servico_fim, ewo.wip_entity_name)
AND ewo.scheduled_start_date BETWEEN NVL( TO_DATE(&p_dt_ini_ini,'rrrr/mm/dd hh24:mi:ss') , ewo.scheduled_start_date )
AND NVL(TRUNC(TO_DATE(&p_dt_ini_fim,'rrrr/mm/dd hh24:mi:ss') + .99999), ewo.scheduled_start_date )
AND NVL(mel.location_codes,'x') BETWEEN NVL(&p_area_ativo_ini , NVL(mel.location_codes,'x'))
AND NVL(&p_area_ativo_fim , NVL(mel.location_codes,'x'))
AND NVL(ewo.asset_number,'x') = NVL(&p_num_ativo , NVL(ewo.asset_number ,'x'))
AND ewo.status_type = NVL(&p_status_os , ewo.status_type )
AND db.department_code = NVL(&p_depart_atrib , db.department_code )
AND wewr.wip_entity_id (+) = ewo.wip_entity_id
AND ewo.organization_id = NVL(&p_organization_id,ewo.organization_id)
AND (SELECT COUNT(me.meter_id)
FROM eam_meters me ) = 0
AND ROWNUM = 3
/****/
--) | true |
72f774d03e2dba9816b22c31bf6ba65f3f00033a | SQL | am502/DB | /src/main/resources/task2/k5.sql | UTF-8 | 449 | 3.40625 | 3 | [] | no_license | WITH g1_k5 AS (
SELECT word
FROM genome_1_k5 UNION
SELECT word
FROM genome_1_k5),
g2_k5 AS (
SELECT word
FROM genome_2_k5 UNION
SELECT word
FROM genome_2_k5),
one AS (
SELECT word
FROM g1_k5 INTERSECT
SELECT word
FROM g2_k5),
two AS (
SELECT word
FROM g1_k5 UNION
SELECT word
FROM g2_k5
)
SELECT (SELECT CAST(COUNT(*) AS FLOAT)
FROM one) /
(SELECT CAST(COUNT(*) AS FLOAT)
FROM two); | true |
cd101af4f75c4a370162c1de3728d146ca853ba0 | SQL | qiudaoke/flowable-userguide | /sql/sql/upgrade/common/flowable.db2.upgradestep.6.4.0.to.6.4.1.common.sql | UTF-8 | 2,231 | 2.984375 | 3 | [
"MIT"
] | permissive | create table ACT_HI_TSK_LOG (
ID_ bigint not null GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1),
TYPE_ varchar(64),
TASK_ID_ varchar(64) not null,
TIME_STAMP_ timestamp not null,
USER_ID_ varchar(255),
DATA_ varchar(4000),
EXECUTION_ID_ varchar(64),
PROC_INST_ID_ varchar(64),
PROC_DEF_ID_ varchar(64),
SCOPE_ID_ varchar(255),
SCOPE_DEFINITION_ID_ varchar(255),
SUB_SCOPE_ID_ varchar(255),
SCOPE_TYPE_ varchar(255),
TENANT_ID_ varchar(255) default '',
primary key (ID_)
);
create table ACT_RU_ENTITYLINK (
ID_ varchar(64) not null,
REV_ integer,
CREATE_TIME_ timestamp,
LINK_TYPE_ varchar(255),
SCOPE_ID_ varchar(255),
SCOPE_TYPE_ varchar(255),
SCOPE_DEFINITION_ID_ varchar(255),
REF_SCOPE_ID_ varchar(255),
REF_SCOPE_TYPE_ varchar(255),
REF_SCOPE_DEFINITION_ID_ varchar(255),
HIERARCHY_TYPE_ varchar(255),
primary key (ID_)
);
create index ACT_IDX_ENT_LNK_SCOPE on ACT_RU_ENTITYLINK(SCOPE_ID_, SCOPE_TYPE_, LINK_TYPE_);
create index ACT_IDX_ENT_LNK_SCOPE_DEF on ACT_RU_ENTITYLINK(SCOPE_DEFINITION_ID_, SCOPE_TYPE_, LINK_TYPE_);
create table ACT_HI_ENTITYLINK (
ID_ varchar(64) not null,
LINK_TYPE_ varchar(255),
CREATE_TIME_ timestamp,
SCOPE_ID_ varchar(255),
SCOPE_TYPE_ varchar(255),
SCOPE_DEFINITION_ID_ varchar(255),
REF_SCOPE_ID_ varchar(255),
REF_SCOPE_TYPE_ varchar(255),
REF_SCOPE_DEFINITION_ID_ varchar(255),
HIERARCHY_TYPE_ varchar(255),
primary key (ID_)
);
create index ACT_IDX_HI_ENT_LNK_SCOPE on ACT_HI_ENTITYLINK(SCOPE_ID_, SCOPE_TYPE_, LINK_TYPE_);
create index ACT_IDX_HI_ENT_LNK_SCOPE_DEF on ACT_HI_ENTITYLINK(SCOPE_DEFINITION_ID_, SCOPE_TYPE_, LINK_TYPE_);
update ACT_GE_PROPERTY set VALUE_ = '6.4.1.3' where NAME_ = 'common.schema.version';
update ACT_GE_PROPERTY set VALUE_ = '6.4.1.3' where NAME_ = 'task.schema.version';
insert into ACT_GE_PROPERTY values ('entitylink.schema.version', '6.4.1.3', 1);
update ACT_GE_PROPERTY set VALUE_ = '6.4.1.3' where NAME_ = 'job.schema.version';
update ACT_GE_PROPERTY set VALUE_ = '6.4.1.3' where NAME_ = 'identitylink.schema.version';
update ACT_GE_PROPERTY set VALUE_ = '6.4.1.3' where NAME_ = 'variable.schema.version';
| true |
5808c56a662d1cf0aabe7f695decd60cdfa30fdf | SQL | bintangsaktya/chatrtp | /kuisioner/quizzer.sql | UTF-8 | 2,009 | 2.921875 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 3.5.2
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Jun 14, 2017 at 02:51 PM
-- Server version: 5.5.25a
-- PHP Version: 5.4.4
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
--
-- Database: `quizzer`
--
-- --------------------------------------------------------
--
-- Table structure for table `choices`
--
CREATE TABLE IF NOT EXISTS `choices` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`question_number` int(11) NOT NULL,
`is_correct` tinyint(1) NOT NULL,
`text` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=13 ;
--
-- Dumping data for table `choices`
--
INSERT INTO `choices` (`id`, `question_number`, `is_correct`, `text`) VALUES
(1, 1, 1, 'revo'),
(2, 1, 0, 'bit'),
(3, 1, 0, 'bort'),
(4, 1, 0, 'nettttt'),
(5, 2, 0, 'ayam'),
(6, 2, 0, 'ular'),
(7, 2, 0, 'bekicot'),
(8, 2, 1, 'antik'),
(9, 3, 0, 'cari gesek'),
(10, 3, 0, 'ngusir hantu'),
(11, 3, 0, 'cari uang'),
(12, 3, 1, 'tambah ilmu');
-- --------------------------------------------------------
--
-- Table structure for table `questions`
--
CREATE TABLE IF NOT EXISTS `questions` (
`question_number` int(11) NOT NULL AUTO_INCREMENT,
`text` text NOT NULL,
PRIMARY KEY (`question_number`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;
--
-- Dumping data for table `questions`
--
INSERT INTO `questions` (`question_number`, `text`) VALUES
(1, 'apa kah motor anda ?'),
(2, 'apa yang anda temukan pada saat anda masuk ke rumah kosong?'),
(3, 'anda kuliah untuk apa?');
/*!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 */;
| true |
14851f7b384ab92e424f57274bb0fe596cf307db | SQL | tiikerikissa/TrinityCore_4.3.4_DB_Alpha | /updates/079_2013_08_12_01_world_sai.sql | UTF-8 | 30,369 | 2.921875 | 3 | [] | no_license |
-- Baron Ashbury
SET @ENTRY := 37735;
UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry`=@ENTRY;
DELETE FROM `smart_scripts` WHERE `source_type`=0 AND `entryorguid`=@ENTRY;
INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES
(@ENTRY,0,0,1,2,0,100,1,0,30,0,0,11,8599,0,0,0,0,0,1,0,0,0,0,0,0,0,'Baron Ashbury - AT 30% HP - Cast Enrage'),
(@ENTRY,0,1,0,61,0,100,1,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'Baron Ashbury - AT 30% HP - Say Text');
-- NPC talk text insert
SET @ENTRY := 37735;
DELETE FROM `creature_text` WHERE `entry`=@ENTRY;
INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES
(@ENTRY,0,0, '%s becomes enraged!',16,0,100,0,0,0, 'Baron Ashbury - combat Enrage');
-- Bloodfang Lurker
SET @ENTRY := 35463;
UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry`=@ENTRY;
DELETE FROM `smart_scripts` WHERE `source_type`=0 AND `entryorguid`=@ENTRY;
INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES
(@ENTRY,0,0,1,2,0,100,1,0,30,0,0,11,8599,0,0,0,0,0,1,0,0,0,0,0,0,0,'Bloodfang Lurker - AT 30% HP - Cast Enrage'),
(@ENTRY,0,1,0,61,0,100,1,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'Bloodfang Lurker - AT 30% HP - Say Text'),
(@ENTRY,0,2,0,11,0,100,1,0,0,0,0,11,5916,0,0,0,0,0,1,0,0,0,0,0,0,0,'Bloodfang Lurker - ON SPAWN - Cast Shadowstalker Stealth'),
(@ENTRY,0,3,0,7,0,100,1,0,0,0,0,11,5916,0,0,0,0,0,1,0,0,0,0,0,0,0,'Bloodfang Lurker - ON EVADE - Cast Shadowstalker Stealth');
-- NPC talk text insert
SET @ENTRY := 35463;
DELETE FROM `creature_text` WHERE `entry`=@ENTRY;
INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES
(@ENTRY,0,0, '%s becomes enraged!',16,0,100,0,0,0, 'Bloodfang Lurker - combat Enrage');
-- Bloodfang Ripper
SET @ENTRY := 35505;
UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry`=@ENTRY;
DELETE FROM `smart_scripts` WHERE `source_type`=0 AND `entryorguid`=@ENTRY;
INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES
(@ENTRY,0,0,1,2,0,100,1,0,30,0,0,11,8599,0,0,0,0,0,1,0,0,0,0,0,0,0,'Bloodfang Ripper - AT 30% HP - Cast Enrage'),
(@ENTRY,0,1,0,61,0,100,1,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'Bloodfang Ripper - AT 30% HP - Say Text');
-- NPC talk text insert
SET @ENTRY := 35505;
DELETE FROM `creature_text` WHERE `entry`=@ENTRY;
INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES
(@ENTRY,0,0, '%s becomes enraged!',16,0,100,0,0,0, 'Bloodfang Ripper - combat Enrage');
-- Bloodfang Stalker
SET @ENTRY := 35229;
UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry`=@ENTRY;
DELETE FROM `smart_scripts` WHERE `source_type`=0 AND `entryorguid`=@ENTRY;
INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES
(@ENTRY,0,0,1,2,0,100,1,0,30,0,0,11,8599,0,0,0,0,0,1,0,0,0,0,0,0,0,'Bloodfang Stalker - AT 30% HP - Cast Enrage'),
(@ENTRY,0,1,0,61,0,100,1,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'Bloodfang Stalker - AT 30% HP - Say Text');
-- NPC talk text insert
SET @ENTRY := 35229;
DELETE FROM `creature_text` WHERE `entry`=@ENTRY;
INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES
(@ENTRY,0,0, '%s becomes enraged!',16,0,100,0,0,0, 'Bloodfang Stalker - combat Enrage');
-- Bloodfang Worgen
SET @ENTRY := 35118;
UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry`=@ENTRY;
DELETE FROM `smart_scripts` WHERE `source_type`=0 AND `entryorguid`=@ENTRY;
INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES
(@ENTRY,0,0,1,2,0,100,1,0,30,0,0,11,8599,0,0,0,0,0,1,0,0,0,0,0,0,0,'Bloodfang Worgen - AT 30% HP - Cast Enrage'),
(@ENTRY,0,1,0,61,0,100,1,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'Bloodfang Worgen - AT 30% HP - Say Text');
-- NPC talk text insert
SET @ENTRY := 35118;
DELETE FROM `creature_text` WHERE `entry`=@ENTRY;
INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES
(@ENTRY,0,0, '%s becomes enraged!',16,0,100,0,0,0, 'Bloodfang Worgen - combat Enrage');
-- Duskhaven Watchman
SET @ENTRY := 36211;
UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry`=@ENTRY;
DELETE FROM `smart_scripts` WHERE `source_type`=0 AND `entryorguid`=@ENTRY;
INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES
(@ENTRY,0,0,1,4,0,100,1,0,0,0,0,21,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'Duskhaven Watchman - ON AGGRO - Stop Moving'),
(@ENTRY,0,1,2,61,0,100,1,0,0,0,0,11,6660,0,0,0,0,0,2,0,0,0,0,0,0,0,'Duskhaven Watchman - ON AGGRO - Cast Shoot'),
(@ENTRY,0,2,3,61,0,100,1,0,0,0,0,20,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'Duskhaven Watchman - ON AGGRO - Stop Melee Attack'),
(@ENTRY,0,3,0,61,0,100,1,0,0,0,0,22,1,0,0,0,0,0,1,0,0,0,0,0,0,0,'Duskhaven Watchman - ON AGGRO - Set Phase 1'),
(@ENTRY,0,4,5,9,1,100,0,5,30,2300,3900,11,6660,0,0,0,0,0,2,0,0,0,0,0,0,0,'Duskhaven Watchman - IC - Cast Shoot'),
(@ENTRY,0,5,0,61,1,100,0,0,0,0,0,40,2,0,0,0,0,0,1,0,0,0,0,0,0,0,'Duskhaven Watchman - IC - Set Ranged Weapon Model'),
(@ENTRY,0,6,7,9,1,100,0,30,80,0,0,21,1,0,0,0,0,0,1,0,0,0,0,0,0,0,'Duskhaven Watchman - ON RANGE - Start Moving'),
(@ENTRY,0,7,0,61,1,100,0,0,0,0,0,20,1,0,0,0,0,0,1,0,0,0,0,0,0,0,'Duskhaven Watchman - ON RANGE - Start Melee Attack'),
(@ENTRY,0,8,9,9,1,100,0,0,10,0,0,21,1,0,0,0,0,0,1,0,0,0,0,0,0,0,'Duskhaven Watchman - ON RANGE - Start Moving'),
(@ENTRY,0,9,10,61,1,100,0,0,0,0,0,40,1,0,0,0,0,0,1,0,0,0,0,0,0,0,'Duskhaven Watchman - ON RANGE - Set Melee Weapon Model'),
(@ENTRY,0,10,0,61,1,100,0,0,0,0,0,20,1,0,0,0,0,0,1,0,0,0,0,0,0,0,'Duskhaven Watchman - ON RANGE - Start Melee Attack'),
(@ENTRY,0,11,12,9,1,100,0,11,25,0,0,21,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'Duskhaven Watchman - ON RANGE - Stop Moving'),
(@ENTRY,0,12,13,61,1,100,0,0,0,0,0,20,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'Duskhaven Watchman - ON RANGE - Stop Melee Attack'),
(@ENTRY,0,13,0,61,1,100,0,0,0,0,0,40,2,0,0,0,0,0,1,0,0,0,0,0,0,0,'Duskhaven Watchman - ON RANGE - Set Ranged Weapon Model'),
(@ENTRY,0,14,15,7,1,100,1,0,0,0,0,40,1,0,0,0,0,0,1,0,0,0,0,0,0,0,'Duskhaven Watchman - ON EVADE - Set Melee Weapon Model'),
(@ENTRY,0,15,0,61,1,100,1,0,0,0,0,22,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'Duskhaven Watchman - ON EVADE - Reset'),
(@ENTRY,0,16,0,9,1,100,0,0,5,12000,14500,11,15496,0,0,0,0,0,2,0,0,0,0,0,0,0,'Duskhaven Watchman - ON CLOSE - Cast Cleave');
-- Forsaken Assassin
SET @ENTRY := 36207;
UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry`=@ENTRY;
DELETE FROM `smart_scripts` WHERE `source_type`=0 AND `entryorguid`=@ENTRY;
INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES
(@ENTRY,0,0,0,67,0,100,0,9000,12000,0,0,11,75360,0,0,0,0,0,2,0,0,0,0,0,0,0,'Forsaken Assassin - IC - Cast Backstab');
-- Forsaken Castaway
SET @ENTRY := 36488;
UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry`=@ENTRY;
DELETE FROM `smart_scripts` WHERE `source_type`=0 AND `entryorguid`=@ENTRY;
INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES
(@ENTRY,0,0,0,0,0,100,0,6000,9000,18000,27000,11,75395,0,0,0,0,0,2,0,0,0,0,0,0,0,'Forsaken Castaway - IC - Cast Planked');
-- Forsaken Crossbowman
SET @ENTRY := 38210;
UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry`=@ENTRY;
DELETE FROM `smart_scripts` WHERE `source_type`=0 AND `entryorguid`=@ENTRY;
INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES
(@ENTRY,0,0,1,4,0,100,1,0,0,0,0,21,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'Forsaken Crossbowman - ON AGGRO - Stop Moving'),
(@ENTRY,0,1,2,61,0,100,1,0,0,0,0,11,6660,0,0,0,0,0,2,0,0,0,0,0,0,0,'Forsaken Crossbowman - ON AGGRO - Cast Shoot'),
(@ENTRY,0,2,3,61,0,100,1,0,0,0,0,20,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'Forsaken Crossbowman - ON AGGRO - Stop Melee Attack'),
(@ENTRY,0,3,0,61,0,100,1,0,0,0,0,22,1,0,0,0,0,0,1,0,0,0,0,0,0,0,'Forsaken Crossbowman - ON AGGRO - Set Phase 1'),
(@ENTRY,0,4,5,9,1,100,0,5,30,2300,3900,11,6660,0,0,0,0,0,2,0,0,0,0,0,0,0,'Forsaken Crossbowman - IC - Cast Shoot'),
(@ENTRY,0,5,0,61,1,100,0,0,0,0,0,40,2,0,0,0,0,0,1,0,0,0,0,0,0,0,'Forsaken Crossbowman - IC - Set Ranged Weapon Model'),
(@ENTRY,0,6,7,9,1,100,0,30,80,0,0,21,1,0,0,0,0,0,1,0,0,0,0,0,0,0,'Forsaken Crossbowman - ON RANGE - Start Moving'),
(@ENTRY,0,7,0,61,1,100,0,0,0,0,0,20,1,0,0,0,0,0,1,0,0,0,0,0,0,0,'Forsaken Crossbowman - ON RANGE - Start Melee Attack'),
(@ENTRY,0,8,9,9,1,100,0,0,10,0,0,21,1,0,0,0,0,0,1,0,0,0,0,0,0,0,'Forsaken Crossbowman - ON RANGE - Start Moving'),
(@ENTRY,0,9,10,61,1,100,0,0,0,0,0,40,1,0,0,0,0,0,1,0,0,0,0,0,0,0,'Forsaken Crossbowman - ON RANGE - Set Melee Weapon Model'),
(@ENTRY,0,10,0,61,1,100,0,0,0,0,0,20,1,0,0,0,0,0,1,0,0,0,0,0,0,0,'Forsaken Crossbowman - ON RANGE - Start Melee Attack'),
(@ENTRY,0,11,12,9,1,100,0,11,25,0,0,21,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'Forsaken Crossbowman - ON RANGE - Stop Moving'),
(@ENTRY,0,12,13,61,1,100,0,0,0,0,0,20,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'Forsaken Crossbowman - ON RANGE - Stop Melee Attack'),
(@ENTRY,0,13,0,61,1,100,0,0,0,0,0,40,2,0,0,0,0,0,1,0,0,0,0,0,0,0,'Forsaken Crossbowman - ON RANGE - Set Ranged Weapon Model'),
(@ENTRY,0,14,15,7,1,100,1,0,0,0,0,40,1,0,0,0,0,0,1,0,0,0,0,0,0,0,'Forsaken Crossbowman - ON EVADE - Set Melee Weapon Model'),
(@ENTRY,0,15,0,61,1,100,1,0,0,0,0,22,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'Forsaken Crossbowman - ON EVADE - Reset');
-- Forsaken Infantry
SET @ENTRY := 38616;
UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry`=@ENTRY;
DELETE FROM `smart_scripts` WHERE `source_type`=0 AND `entryorguid`=@ENTRY;
INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES
(@ENTRY,0,0,0,0,0,100,0,2500,4500,12000,13000,11,57846,0,0,0,0,0,2,0,0,0,0,0,0,0,'Forsaken Infantry - IC - Cast Heroic Strike');
-- Forsaken Infantry
SET @ENTRY := 38192;
UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry`=@ENTRY;
DELETE FROM `smart_scripts` WHERE `source_type`=0 AND `entryorguid`=@ENTRY;
INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES
(@ENTRY,0,0,0,0,0,100,0,2500,4500,12000,13000,11,57846,0,0,0,0,0,2,0,0,0,0,0,0,0,'Forsaken Infantry - IC - Cast Heroic Strike');
-- Forsaken Infantry
SET @ENTRY := 37692;
UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry`=@ENTRY;
DELETE FROM `smart_scripts` WHERE `source_type`=0 AND `entryorguid`=@ENTRY;
INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES
(@ENTRY,0,0,0,0,0,100,0,2500,4500,12000,13000,11,57846,0,0,0,0,0,2,0,0,0,0,0,0,0,'Forsaken Infantry - IC - Cast Heroic Strike');
-- Forsaken Sailor
SET @ENTRY := 36396;
UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry`=@ENTRY;
DELETE FROM `smart_scripts` WHERE `source_type`=0 AND `entryorguid`=@ENTRY;
INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES
(@ENTRY,0,0,0,0,0,100,0,3500,4500,14000,20000,11,75361,0,0,0,0,0,2,0,0,0,0,0,0,0,'Forsaken Sailor - IC - Cast Swashbuckling Slice');
-- Forsaken Scout
SET @ENTRY := 36671;
UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry`=@ENTRY;
DELETE FROM `smart_scripts` WHERE `source_type`=0 AND `entryorguid`=@ENTRY;
INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES
(@ENTRY,0,0,0,0,0,100,0,4000,7000,17000,22000,11,75388,0,0,0,0,0,2,0,0,0,0,0,0,0,'Forsaken Scout - IC - Cast Rusty Cut');
-- Frenzied Stalker
SET @ENTRY := 35627;
UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry`=@ENTRY;
DELETE FROM `smart_scripts` WHERE `source_type`=0 AND `entryorguid`=@ENTRY;
INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES
(@ENTRY,0,0,1,2,0,100,1,0,30,0,0,11,8599,0,0,0,0,0,1,0,0,0,0,0,0,0,'Frenzied Stalker - AT 30% HP - Cast Enrage'),
(@ENTRY,0,1,0,61,0,100,1,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'Frenzied Stalker - AT 30% HP - Say Text');
-- NPC talk text insert
SET @ENTRY := 35627;
DELETE FROM `creature_text` WHERE `entry`=@ENTRY;
INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES
(@ENTRY,0,0, '%s becomes enraged!',16,0,100,0,0,0, 'Frenzied Stalker - combat Enrage');
-- Howling Banshee
SET @ENTRY := 37757;
UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry`=@ENTRY;
DELETE FROM `smart_scripts` WHERE `source_type`=0 AND `entryorguid`=@ENTRY;
INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES
(@ENTRY,0,0,0,4,0,100,1,0,0,0,0,22,1,0,0,0,0,0,1,0,0,0,0,0,0,0,'Howling Banshee - ON AGGRO - Set Phase 1'),
(@ENTRY,0,1,0,4,1,100,1,0,0,0,0,21,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'Howling Banshee - ON AGGRO - Stop Moving'),
(@ENTRY,0,2,0,4,1,100,1,0,0,0,0,11,9613,0,0,0,0,0,2,0,0,0,0,0,0,0,'Howling Banshee - ON AGGRO - Cast Shadow Bolt'),
(@ENTRY,0,3,0,9,1,100,0,0,40,3400,4700,11,9613,0,0,0,0,0,2,0,0,0,0,0,0,0,'Howling Banshee - IC - Cast Shadow Bolt'),
(@ENTRY,0,4,0,9,1,100,0,40,100,0,0,21,1,0,0,0,0,0,1,0,0,0,0,0,0,0,'Howling Banshee - ON RANGE - Start Moving'),
(@ENTRY,0,5,0,9,1,100,0,10,15,0,0,21,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'Howling Banshee - ON RANGE - Stop Moving'),
(@ENTRY,0,6,0,9,1,100,0,0,40,0,0,21,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'Howling Banshee - ON RANGE - Stop Moving'),
(@ENTRY,0,7,0,3,1,100,0,0,15,0,0,22,2,0,0,0,0,0,1,0,0,0,0,0,0,0,'Howling Banshee - AT 15% MANA - Set Phase 2'),
(@ENTRY,0,8,0,3,2,100,0,0,15,0,0,21,1,0,0,0,0,0,1,0,0,0,0,0,0,0,'Howling Banshee - AT 15% MANA - Start Moving'),
(@ENTRY,0,9,0,3,2,100,0,30,100,100,100,22,1,0,0,0,0,0,1,0,0,0,0,0,0,0,'Howling Banshee - MANA IS ABOVE 30% - Set Phase 1'),
(@ENTRY,0,10,0,0,1,100,0,8000,12000,25000,27000,11,75438,0,0,0,0,0,1,0,0,0,0,0,0,0,'Howling Banshee - IC - Cast Banshee Screech');
-- Lord Walden
SET @ENTRY := 37733;
UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry`=@ENTRY;
DELETE FROM `smart_scripts` WHERE `source_type`=0 AND `entryorguid`=@ENTRY;
INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES
(@ENTRY,0,0,0,0,0,100,0,4000,7000,15000,19000,11,75359,0,0,0,0,0,2,0,0,0,0,0,0,0,'Lord Walden - IC - Cast Seasoned Brandy');
-- Northgate Rebel
SET @ENTRY := 36057;
UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry`=@ENTRY;
DELETE FROM `smart_scripts` WHERE `source_type`=0 AND `entryorguid`=@ENTRY;
INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES
(@ENTRY,0,0,1,4,0,100,1,0,0,0,0,21,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'Northgate Rebel - ON AGGRO - Stop Moving'),
(@ENTRY,0,1,2,61,0,100,1,0,0,0,0,11,6660,0,0,0,0,0,2,0,0,0,0,0,0,0,'Northgate Rebel - ON AGGRO - Cast Shoot'),
(@ENTRY,0,2,3,61,0,100,1,0,0,0,0,20,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'Northgate Rebel - ON AGGRO - Stop Melee Attack'),
(@ENTRY,0,3,0,61,0,100,1,0,0,0,0,22,1,0,0,0,0,0,1,0,0,0,0,0,0,0,'Northgate Rebel - ON AGGRO - Set Phase 1'),
(@ENTRY,0,4,5,9,1,100,0,5,30,2300,3900,11,6660,0,0,0,0,0,2,0,0,0,0,0,0,0,'Northgate Rebel - IC - Cast Shoot'),
(@ENTRY,0,5,0,61,1,100,0,0,0,0,0,40,2,0,0,0,0,0,1,0,0,0,0,0,0,0,'Northgate Rebel - IC - Set Ranged Weapon Model'),
(@ENTRY,0,6,7,9,1,100,0,30,80,0,0,21,1,0,0,0,0,0,1,0,0,0,0,0,0,0,'Northgate Rebel - ON RANGE - Start Moving'),
(@ENTRY,0,7,0,61,1,100,0,0,0,0,0,20,1,0,0,0,0,0,1,0,0,0,0,0,0,0,'Northgate Rebel - ON RANGE - Start Melee Attack'),
(@ENTRY,0,8,9,9,1,100,0,0,10,0,0,21,1,0,0,0,0,0,1,0,0,0,0,0,0,0,'Northgate Rebel - ON RANGE - Start Moving'),
(@ENTRY,0,9,10,61,1,100,0,0,0,0,0,40,1,0,0,0,0,0,1,0,0,0,0,0,0,0,'Northgate Rebel - ON RANGE - Set Melee Weapon Model'),
(@ENTRY,0,10,0,61,1,100,0,0,0,0,0,20,1,0,0,0,0,0,1,0,0,0,0,0,0,0,'Northgate Rebel - ON RANGE - Start Melee Attack'),
(@ENTRY,0,11,12,9,1,100,0,11,25,0,0,21,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'Northgate Rebel - ON RANGE - Stop Moving'),
(@ENTRY,0,12,13,61,1,100,0,0,0,0,0,20,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'Northgate Rebel - ON RANGE - Stop Melee Attack'),
(@ENTRY,0,13,0,61,1,100,0,0,0,0,0,40,2,0,0,0,0,0,1,0,0,0,0,0,0,0,'Northgate Rebel - ON RANGE - Set Ranged Weapon Model'),
(@ENTRY,0,14,15,7,1,100,1,0,0,0,0,40,1,0,0,0,0,0,1,0,0,0,0,0,0,0,'Northgate Rebel - ON EVADE - Set Melee Weapon Model'),
(@ENTRY,0,15,0,61,1,100,1,0,0,0,0,22,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'Northgate Rebel - ON EVADE - Reset'),
(@ENTRY,0,16,0,9,1,100,0,0,5,12000,14500,11,15496,0,0,0,0,0,2,0,0,0,0,0,0,0,'Northgate Rebel - ON CLOSE - Cast Cleave');
-- Rampaging Worgen
SET @ENTRY := 34884;
UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry`=@ENTRY;
DELETE FROM `smart_scripts` WHERE `source_type`=0 AND `entryorguid`=@ENTRY;
INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES
(@ENTRY,0,0,1,2,0,100,1,0,30,0,0,11,8599,0,0,0,0,0,1,0,0,0,0,0,0,0,'Cast Enrage at 30% HP'),
(@ENTRY,0,1,0,61,0,100,1,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'Say Text at 30% HP');
-- NPC talk text insert
SET @ENTRY := 34884;
DELETE FROM `creature_text` WHERE `entry`=@ENTRY;
INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES
(@ENTRY,0,0, '%s becomes enraged!',16,0,100,0,0,0, 'combat Enrage');
-- Rampaging Worgen
SET @ENTRY := 35660;
UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry`=@ENTRY;
DELETE FROM `smart_scripts` WHERE `source_type`=0 AND `entryorguid`=@ENTRY;
INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES
(@ENTRY,0,0,1,2,0,100,1,0,30,0,0,11,8599,0,0,0,0,0,1,0,0,0,0,0,0,0,'Rampaging Worgen - AT 30% HP - Cast Enrage'),
(@ENTRY,0,1,0,61,0,100,1,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'Rampaging Worgen - AT 30% HP - Say Text');
-- NPC talk text insert
SET @ENTRY := 35660;
DELETE FROM `creature_text` WHERE `entry`=@ENTRY;
INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES
(@ENTRY,0,0, '%s becomes enraged!',16,0,100,0,0,0, 'Rampaging Worgen - combat Enrage');
-- Veteran Dark Ranger
SET @ENTRY := 38022;
UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry`=@ENTRY;
DELETE FROM `smart_scripts` WHERE `source_type`=0 AND `entryorguid`=@ENTRY;
INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES
(@ENTRY,0,0,1,4,0,100,1,0,0,0,0,21,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'Veteran Dark Ranger - ON AGGRO - Stop Moving'),
(@ENTRY,0,1,2,61,0,100,1,0,0,0,0,11,6660,0,0,0,0,0,2,0,0,0,0,0,0,0,'Veteran Dark Ranger - ON AGGRO - Cast Shoot'),
(@ENTRY,0,2,3,61,0,100,1,0,0,0,0,20,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'Veteran Dark Ranger - ON AGGRO - Stop Melee Attack'),
(@ENTRY,0,3,0,61,0,100,1,0,0,0,0,22,1,0,0,0,0,0,1,0,0,0,0,0,0,0,'Veteran Dark Ranger - ON AGGRO - Set Phase 1'),
(@ENTRY,0,4,5,9,1,100,0,5,30,2300,3900,11,6660,0,0,0,0,0,2,0,0,0,0,0,0,0,'Veteran Dark Ranger - IC - Cast Shoot'),
(@ENTRY,0,5,0,61,1,100,0,0,0,0,0,40,2,0,0,0,0,0,1,0,0,0,0,0,0,0,'Veteran Dark Ranger - IC - Set Ranged Weapon Model'),
(@ENTRY,0,6,7,9,1,100,0,30,80,0,0,21,1,0,0,0,0,0,1,0,0,0,0,0,0,0,'Veteran Dark Ranger - ON RANGE - Start Moving'),
(@ENTRY,0,7,0,61,1,100,0,0,0,0,0,20,1,0,0,0,0,0,1,0,0,0,0,0,0,0,'Veteran Dark Ranger - ON RANGE - Start Melee Attack'),
(@ENTRY,0,8,9,9,1,100,0,0,10,0,0,21,1,0,0,0,0,0,1,0,0,0,0,0,0,0,'Veteran Dark Ranger - ON RANGE - Start Moving'),
(@ENTRY,0,9,10,61,1,100,0,0,0,0,0,40,1,0,0,0,0,0,1,0,0,0,0,0,0,0,'Veteran Dark Ranger - ON RANGE - Set Melee Weapon Model'),
(@ENTRY,0,10,0,61,1,100,0,0,0,0,0,20,1,0,0,0,0,0,1,0,0,0,0,0,0,0,'Veteran Dark Ranger - ON RANGE - Start Melee Attack'),
(@ENTRY,0,11,12,9,1,100,0,11,25,0,0,21,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'Veteran Dark Ranger - ON RANGE - Stop Moving'),
(@ENTRY,0,12,13,61,1,100,0,0,0,0,0,20,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'Veteran Dark Ranger - ON RANGE - Stop Melee Attack'),
(@ENTRY,0,13,0,61,1,100,0,0,0,0,0,40,2,0,0,0,0,0,1,0,0,0,0,0,0,0,'Veteran Dark Ranger - ON RANGE - Set Ranged Weapon Model'),
(@ENTRY,0,14,15,7,1,100,1,0,0,0,0,40,1,0,0,0,0,0,1,0,0,0,0,0,0,0,'Veteran Dark Ranger - ON EVADE - Set Melee Weapon Model'),
(@ENTRY,0,15,0,61,1,100,1,0,0,0,0,22,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'Veteran Dark Ranger - ON EVADE - Reset'),
(@ENTRY,0,16,0,0,1,100,0,8500,12000,18500,24000,11,75439,0,0,0,0,0,2,0,0,0,0,0,0,0,'Veteran Dark Ranger - IC - Cast Black Shot');
-- Vilebrood Skitterer
SET @ENTRY := 36813;
UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry`=@ENTRY;
DELETE FROM `smart_scripts` WHERE `source_type`=0 AND `entryorguid`=@ENTRY;
INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES
(@ENTRY,0,0,0,0,0,100,0,5000,6000,18500,21500,11,744,0,0,0,0,0,2,0,0,0,0,0,0,0,'Vilebrood Skitterer - IC - Cast Poison');
-- Worgen Alpha
SET @ENTRY := 35167;
UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry`=@ENTRY;
DELETE FROM `smart_scripts` WHERE `source_type`=0 AND `entryorguid`=@ENTRY;
INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES
(@ENTRY,0,0,1,2,0,100,1,0,30,0,0,11,8599,0,0,0,0,0,1,0,0,0,0,0,0,0,' Worgen Alpha - AT 30% HP - Cast Enrage'),
(@ENTRY,0,1,0,61,0,100,1,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,' Worgen Alpha - AT 30% HP - Say Text');
-- NPC talk text insert
SET @ENTRY := 35167;
DELETE FROM `creature_text` WHERE `entry`=@ENTRY;
INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES
(@ENTRY,0,0, '%s becomes enraged!',16,0,100,0,0,0, ' Worgen Alpha - combat Enrage');
-- Worgen Runt
SET @ENTRY := 35456;
UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry`=@ENTRY;
DELETE FROM `smart_scripts` WHERE `source_type`=0 AND `entryorguid`=@ENTRY;
INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES
(@ENTRY,0,0,1,2,0,100,1,0,30,0,0,11,8599,0,0,0,0,0,1,0,0,0,0,0,0,0,' Worgen Runt - AT 30% HP - Cast Enrage'),
(@ENTRY,0,1,0,61,0,100,1,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,' Worgen Runt - AT 30% HP - Say Text');
-- NPC talk text insert
SET @ENTRY := 35456;
DELETE FROM `creature_text` WHERE `entry`=@ENTRY;
INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES
(@ENTRY,0,0, '%s becomes enraged!',16,0,100,0,0,0, 'Worgen Runt - combat Enrage');
| true |
ed91b3de76e61a15e985800993617a0bd1a297e4 | SQL | JAYTAS/Omilos | /System/Scripts/Database/Mysql/Campaign Database/Stored Procedures/Campaign.uspGetMonthlyCampaignInstanceDates.sql | UTF-8 | 2,951 | 4.0625 | 4 | [] | no_license | DELIMITER $$
DROP PROCEDURE IF EXISTS `Campaign`.`uspGetMonthlyCampaignInstanceDates` $$
CREATE PROCEDURE `Campaign`.`uspGetMonthlyCampaignInstanceDates`
/*
Description : This is to get Campaign Instance dates for a campaign schedule.
Paramenters :
1. startDate : Start date of the campaign
2. endDate : End date of the campaign
3. separationCount : How many days once like once in 2days
4. maxNumberOfOccurrences : Number instance requsted by the user
5. dayOfCampaignMonth : days of the month on which instance has to take place
6. weekOfMonth : week of month on which instance has to take place
Example : CALL Campaign.uspGetMonthlyCampaignInstanceDates('2018-11-01', '2019-01-31', 1, 100, 1, null, null);
*/
(
IN startDate DATE,
IN endDate DATE,
IN separationCount INT(11),
IN maxNumberOfOccurrences INT(11),
IN dayOfCampaignMonth INT(11),
IN dayOfWeek INT(11),
IN weekOfMonth INT(11)
)
MonthlyCampaignInstanceDatesBlock:BEGIN
DECLARE totalNumberOfMonths INT;
DECLARE lastDayOfMonth INT;
DECLARE lastDayOfCurrentMonth INT;
DECLARE i INT;
DECLARE dayOfCampaignStartMonth INT;
DECLARE monthInterval INT;
DECLARE campaignStartMonth INT;
DECLARE campaignStartYear INT;
DECLARE firstDayOfStartDate DATE;
DECLARE tempDate DATE;
DECLARE tempDay INT;
DROP TEMPORARY TABLE IF EXISTS campaignInstanceDates;
CREATE TEMPORARY TABLE campaigninstancedates (
InstanceDate DATE
);
SET campaignStartYear = (SELECT YEAR(startDate));
SET campaignStartMonth = (SELECT MONTH(startDate));
SET dayOfCampaignStartMonth = (SELECT DAYOFMONTH(startDate));
SET totalNumberOfMonths = (SELECT TIMESTAMPDIFF(Month, startDate, endDate) + 1);
SET firstDayOfStartDate = (SELECT DATE_ADD(MAKEDATE(campaignStartYear, 1), INTERVAL campaignStartMonth - 1 MONTH));
IF dayOfCampaignMonth IS NOT NULL THEN
SET lastDayOfMonth = 32;
SET i = (SELECT IF(dayOfCampaignStartMonth > dayOfCampaignMonth, separationCount, 0));
WHILE i < totalNumberOfMonths DO
SET tempDate = (SELECT DATE_ADD(firstDayOfStartDate, INTERVAL i MONTH));
SET lastDayOfCurrentMonth = (SELECT DAY(LAST_DAY(tempDate)));
SET tempDay = (SELECT IF (dayOfCampaignMonth = lastDayOfMonth, lastDayOfCurrentMonth, dayOfCampaignMonth));
IF(tempDay <= lastDayOfCurrentMonth) THEN
INSERT INTO campaigninstancedates (InstanceDate) VALUES (DATE_ADD(tempDate, INTERVAL tempDay - 1 DAY));
END IF;
SET i = i + separationCount;
END WHILE;
SELECT * FROM campaigninstancedates WHERE InstanceDate <= endDate LIMIT maxNumberOfOccurrences;
LEAVE MonthlyCampaignInstanceDatesBlock;
END IF;
END MonthlyCampaignInstanceDatesBlock$$
DELIMITER ; | true |
2641bb92ab90b265347b03c920bcbbd2cb27931e | SQL | andreisham/databases | /Homeworks/lesson_9/lesson_9_function.sql | WINDOWS-1251 | 855 | 3.578125 | 4 | [] | no_license | --
--
drop function if exists friendship_direction;
delimiter //
create function friendship_direction(check_user_id int)
returns float reads sql data
begin
declare requests_to_user int;
declare requests_from_user int;
-- ( 1)
set requests_to_user = (select count(*) from friend_requests where target_user_id = check_user_id);
-- ( 2)
select count(*) into requests_from_user from friend_requests where initiator_user_id = check_user_id;
return requests_to_user / requests_from_user;
end //
delimiter ;
select friendship_direction(1); | true |
4ac6aeeee4eaa109ec2516dc535348bface29b5f | SQL | dlrbgh9303/oraclesource | /hr.sql | UTF-8 | 8,208 | 4.8125 | 5 | [] | no_license | -- employees 테이블 전체 내용 조회
SELECT
*
FROM
employees;
-- employees 테이블의 first_name,last_name,job_id 만 조회
SELECT
first_name,
last_name,
job_id
FROM
employees;
-- employee_id가 176인 사람의 LAST_NAME과 DEPARTMENT_ID 조회
SELECT
last_name,
department_id
FROM
employees
WHERE
employee_id = 176;
-- >,<,>=,<= 사용
-- salary가 12000이상 되는 직원들의 last_name, salary 조회
SELECT
last_name,
salary
FROM
employees
WHERE
salary >= 12000;
-- salary가 5000~12000의 범위 이외인 사원들의 last_name, salary 조회
SELECT
last_name,
salary
FROM
employees
WHERE
salary < 5000
OR salary > 12000;
-- 20번 및 50번 부서에서 근무하는 모든 사원들의 LAST_NAME 및 DEPARTMENT_ID 조회
SELECT
last_name,
department_id
FROM
employees
WHERE
department_id IN ( 20, 50 );
-- COMMISSION_PCT를 받는 모든 사원들의 LAST_NAME, SALARY, COMMISSION_PCT 조회
-- 단. SALARY 내림차순, COMMISSION_PCT 내림차순
SELECT
last_name,
salary,
commission_pct
FROM
employees
WHERE
commission_pct > 0
ORDER BY
salary DESC,
commission_pct DESC;
-- SALARY가 2500,3500,7000 이 아니며 JOB_ID가 SA_REP, ST_CLERK인 사원 조회
SELECT
*
FROM
employees
WHERE
salary NOT IN ( 2500, 3500, 7000 )
AND job_id IN ( 'SA_REP', 'ST_CLERK' );
-- 2008/02/20~ 2008/05/01 사이에 고용된 사원들의 LAST_NAME, EMPLOYEE_ID, HIRE_DATE
-- 조회한다. HIRE_DATE 내림차순으로 조회
SELECT
last_name,
employee_id,
hire_date
FROM
employees
WHERE
hire_date >= '2008-02-20'
AND hire_date <= '2008-05-01'
ORDER BY
hire_date DESC;
-- 2004년도에 고용된 모든 사람들의 LAST_NAME, HIRE_DATE 조회
-- HIRE_DATE 오름차순 정렬
SELECT
last_name,
hire_date
FROM
employees
WHERE
hire_date >= '2004-01-01'
AND hire_date <= '2004-12-31'
ORDER BY
hire_date;
-- BETWEEN A AND B
-- salary가 5000~12000의 범위 이외인 사원들의 last_name, salary 조회
SELECT
last_name,
salary
FROM
employees
WHERE
salary NOT BETWEEN 5000 AND 12000;
-- 20번 및 50번 부서에서 근무하며, SALARY가 5000~12000 사이인 사원들의 LAST_NAME 및 DEPARTMENT_ID 조회
SELECT
last_name,
department_id
FROM
employees
WHERE
department_id IN ( 20, 50 )
AND salary BETWEEN 5000 AND 12000;
-- 2008/02/20~ 2008/05/01 사이에 고용된 사원들의 LAST_NAME, EMPLOYEE_ID, HIRE_DATE
-- 조회한다. HIRE_DATE 내림차순으로 조회
SELECT
last_name,
hire_date
FROM
employees
WHERE
hire_date BETWEEN '2008-02-20' AND '2008-05-01'
ORDER BY
hire_date DESC;
-- 2004년도에 고용된 모든 사람들의 LAST_NAME, HIRE_DATE 조회
-- HIRE_DATE 오름차순 정렬
SELECT
last_name,
hire_date
FROM
employees
WHERE
hire_date BETWEEN '2004-01-01' AND '2004-12-31'
ORDER BY
hire_date;
-- LIKE
-- 2004년도에 고용된 모든 사람들의 LAST_NAME, HIRE_DATE 조회
-- HIRE_DATE 오름차순 정렬
SELECT
last_name,
hire_date
FROM
employees
WHERE
hire_date LIKE '04%'
ORDER BY
hire_date;
-- LAST_NAME에 u가 포함되는 사원들의 사번 및 LAST_NAME 조회
SELECT
employee_id,
last_name
FROM
employees
WHERE
last_name LIKE '%u%';
-- LAST_NAME의 4번째 글자가 a 인 사원들의 last_name 조회
SELECT
last_name
FROM
employees
WHERE
last_name LIKE '___a%';
-- LAST_NAME에 글자가 a 혹은 e 글자가 들어 있는 사원들의 last_name 조회한 후
-- last_name 오름차순 조회
SELECT
last_name
FROM
employees
WHERE
last_name LIKE '%a%'
OR last_name LIKE '%e%'
ORDER BY
last_name;
-- LAST_NAME에 글자가 a 와 e 글자가 들어 있는 사원들의 last_name 조회한 후
-- last_name 오름차순 조회
SELECT
last_name
FROM
employees
WHERE
last_name LIKE '%a%e%'
OR last_name LIKE '%e%a%'
ORDER BY
last_name;
-- manager_id가 없는 사원들의 last_name, job_id 조회
SELECT
last_name,
job_id
FROM
employees
WHERE
manager_id IS NULL;
-- job_id가 ST_CLERK 인 사원의 department_id 조회(단, 부서번호가 null인 것 제외)
SELECT DISTINCT
department_id
FROM
employees
WHERE
job_id = 'ST_CLERK'
AND department_id IS NOT NULL;
-- commission_pct가 null 이 아닌 사원들 중에서 commission = salary * commission_pct 를 구한 후
-- employee_id, first_name, job_id, commission 조회
SELECT
employee_id,
first_name,
job_id,
salary * commission_pct AS commission
FROM
employees
WHERE
commission_pct IS NOT NULL;
-- first_name이 Curtis인 사람의 first_name,last_name,email,phone_number,job_id 조회
-- 단, job_id 결과는 소문자로 출력한다.
SELECT first_name,last_name,email,phone_number,lower(job_id)
FROM employees
WHERE first_name = 'Curtis';
-- job_id가 AD_PRES, PU_CUERK인 사원들의 EMPLOYEE_ID, FIRST_NAME, LAST_NAME,
-- DEPARTMENT_ID, JOB_ID 조회, 단, 사원명은 FIRST_NAME과 LAST_NAME을 연결하여 출력
SELECT EMPLOYEE_ID, CONCAT(FIRST_NAME, LAST_NAME),DEPARTMENT_ID, JOB_ID
FROM employees
WHERE job_id IN('AD_PRES', 'PU_CUERK');
SELECT EMPLOYEE_ID, CONCAT(FIRST_NAME,CONCAT(' ', LAST_NAME)),DEPARTMENT_ID, JOB_ID
FROM employees
WHERE job_id IN('AD_PRES', 'PU_CUERK');
SELECT EMPLOYEE_ID, FIRST_NAME || ' ' || LAST_NAME,DEPARTMENT_ID, JOB_ID
FROM employees
WHERE job_id IN('AD_PRES', 'PU_CUERK');
-- [실습4] 부서 80의 각 사원에 대해 적용 가능한 세율을 표시하시오.
SELECT LAST_NAME, SALARY, DECODE(TRUNC(salary/2000,0),
0, 0.00,
1, 0.09,
2, 0.20,
3, 0.30,
4, 0.40,
5, 0.42,
6, 0.44,
0.45) AS TAX_RATE
FROM employees WHERE department_id=80;
-- 사원들의 최대급여와 최소 급여의 차이를 조회
SELECT MAX(salary) - MIN(salary) AS GAP FROM employees;
-- 매니저로 근무하는 사원들의 총 수 조회(단, MAMAGER_ID 중복 제거)
SELECT COUNT(DISTINCT MANAGER_ID) FROM employees;
-- 문1] 자신의 담당 매니저의 고용일보다 빠른 입사자 찾기(employees self join)
select *
from employees e1, employees e2
where e1.manager_id = e2.employee_id and e1.hire_date < e2.hire_date;
select *
from employees e1 join employees e2 on e1.manager_id = e2.employee_id
and e1.hire_date < e2.hire_date;
-- 문2] 도시 이름이 T로 시작하는 지역에 사는 사원들의 사번,last_name,부서번호 조회
-- employees, department 테이블 연결, locations 테이블 연결
select employee_id, last_name, e.department_id
from employees e, departments d,locations l
where e.department_id = d.department_id and d.location_id = l.location_id and city like 'T%';
-- 문3] 위치 id가 1700인 사원들의 last_name,부서번호, 연봉 조회
-- employees, department 테이블 연결
select last_name, e.department_id, e.salary
from employees e, departments d
where e.department_id = d.department_id and location_id = 1700;
-- 문4] Executive 부서에 근무하는 모든 사원들의 부서번호, last_name, job_id 조회
-- employees, department 테이블 연결
select last_name, e.department_id, e.job_id
from employees e, departments d
where e.department_id = d.department_id and d.department_name = 'Executive';
create table indexTBL as select DISTINCT first_name, last_name, hire_date from employees;
select * from indexTBL;
-- 인덱스 생성 전 검색 방식 = full
select * from indexTBL where first_name='Jack';
-- 인덱스 생성
create index idx_indexTBL_firstname on indexTBL(first_name);
-- 인덱스 생성 후 검색 방식 : index 검색 (Range Scan)
select * from indexTBL where first_name='Jack';
select * from indexTBL;
| true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.