text stringlengths 6 9.38M |
|---|
DROP VIEW BURI_PATH_HISTORY_DATA_USER
; |
DROP DATABASE IF EXISTS test;
CREATE DATABASE test;
USE test;
CREATE TABLE user
(
id int(8) NOT NULL AUTO_INCREMENT,
name varchar(25) NOT NULL,
age int,
isAdmin BIT NOT NULL DEFAULT 0,
createdDate timestamp NOT NULL DEFAULT NOW(),
PRIMARY KEY (id)
);
INSERT INTO user (name, age, isAdmin) VALUES
("User 1", 5, 0),
("User 2", 76, 1),
("User 3", 21, 0),
("User 4", 35, 0),
("Paul Atreydos", 21, TRUE),
("User 5", 42, 0),
("User 6", 42, 0),
("User 7", 42, 0),
("User 8", 42, 0),
("User 9", 42, 0),
("User 10", 42, 0),
("User 11", 42, 0),
("User 12", 42, 0),
("User 13", 42, 0),
("User 14", 42, 1),
("User 15", 42, 0),
("User 16", 42, 0),
("User 17", 42, 0),
("User 18", 42, 0),
("User 19", 42, 0),
("User 20", 42, 0);
|
use studyin;
CREATE TABLE `COUNT`
( `TIME` DATE,
`PAGEVIEW` int(11),
`PAGEVIEWDAY` int(11),
`APPLICATION` int(11),
`APPLICATIONDAY` int(11),
`KAIFAQU` int(11),
`ZHIFUQU` int(11),
`FUSHANQU` int(11),
`MUPINGQU` int(11),
`LAISHANQU` int(11),
`LONGKOU` int(11),
`ZHAOYUAN` int(11),
`QIXIA` int(11),
`LAIZHOU` int(11),
`CHANGDAO` int(11),
`HAIYANG` int(11),
`LAIYANG` int(11),
`PENGLAI` int(11),
PRIMARY KEY (`TIME`),
UNIQUE KEY `ordinal_UNIQUE` (`TIME`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*
ALTER TABLE `WYXX`.`COUNT` ADD CONSTRAINT `COUNT_PK` PRIMARY KEY (`TIME`)
USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
TABLESPACE `USERS` ENABLE;
ALTER TABLE `WYXX`.`COUNT` MODIFY (`TIME` NOT NULL ENABLE);
*/ |
--Problem 23.Write a SQL statement that changes the password to NULL
--for all users that have not been in the system since 10.03.2010.
UPDATE Users
SET Password = NULL
WHERE LastLoginTime >= '10.03.2010' |
INSERT INTO accounts (uuid, balance, description, currency)
VALUES ('9ea90432-51bc-44c3-bd42-2619a70b1ae0', 1000, 'test 1', 'EUR');
INSERT INTO accounts (uuid, balance, description, currency)
VALUES ('4ea896d5-b04d-458e-a6f4-d61da18ba6eb', 1000, 'test 1', 'EUR');
INSERT INTO accounts (uuid, balance, description, currency)
VALUES ('6d61f3e6-f850-4948-9d17-087517e098a4', 1000, 'test 1', 'EUR'); |
-- Create tables for raw data to be loaded into
CREATE TABLE premise (
id INT PRIMARY KEY,
premise_name TEXT,
county_id INT
);
CREATE TABLE county (
id INT PRIMARY KEY,
county_name TEXT,
license_count INT,
county_id INT
);
-- Join tables
SELECT premise.id,
premise.premise_name,
premise.county_id
FROM premise
JOIN county ON premise.id = county.id; |
BACKUP DATABASE [DATABASE_NAME] TO DISK = 'NUL'
BACKUP LOG [DATABASE_NAME] TO DISK = 'NUL' |
DROP DATABASE IF EXISTS Calendar;
CREATE DATABASE Calendar;
USE Calendar;
CREATE TABLE `User` (
userId INT NOT NULL AUTO_INCREMENT,
name VARCHAR(100),
email VARCHAR(150),
username VARCHAR(80) NOT NULL,
password VARCHAR(102) NOT NULL,
CONSTRAINT User_PK PRIMARY KEY (userId),
CONSTRAINT uniqueUsername UNIQUE (username)
);
CREATE TABLE `Group` (
groupId INT NOT NULL AUTO_INCREMENT,
name VARCHAR(100),
description VARCHAR(200),
superGroup INT,
CONSTRAINT Group_PK PRIMARY KEY (groupId),
CONSTRAINT Group_FK FOREIGN KEY (superGroup) REFERENCES `Group`(groupId)
ON DELETE CASCADE
ON UPDATE CASCADE
);
CREATE TABLE Membership (
userId INT NOT NULL,
groupId INT NOT NULL,
rights BOOLEAN NOT NULL,
CONSTRAINT Membership_PK PRIMARY KEY (userId, groupId),
CONSTRAINT Membership_FK1 FOREIGN KEY (userId) REFERENCES `User`(userId)
ON DELETE CASCADE
ON UPDATE CASCADE,
CONSTRAINT Membership_FK2 FOREIGN KEY (groupId) REFERENCES `Group`(groupId)
ON DELETE CASCADE
ON UPDATE CASCADE
);
CREATE TABLE Room (
roomId INT NOT NULL AUTO_INCREMENT,
name VARCHAR(50),
description VARCHAR(250),
`size` INT,
CONSTRAINT Room_PK PRIMARY KEY (roomId)
);
CREATE TABLE Event (
eventId INT NOT NULL AUTO_INCREMENT,
name VARCHAR(100),
description VARCHAR(250),
place VARCHAR(250),
startTime TIMESTAMP,
endTime TIMESTAMP,
room INT,
CONSTRAINT Event_PK PRIMARY KEY (eventId),
CONSTRAINT Event_FK FOREIGN KEY (room) REFERENCES Room(roomId)
ON DELETE RESTRICT
ON UPDATE CASCADE
);
CREATE TABLE Notification (
notId INT NOT NULL AUTO_INCREMENT,
`type` VARCHAR(50),
title VARCHAR(80),
content VARCHAR(250),
time TIMESTAMP,
status BOOLEAN,
receiver INT NOT NULL,
eventId INT,
groupId INT,
CONSTRAINT Not_PK PRIMARY KEY (notId),
CONSTRAINT Not_FK1 FOREIGN KEY (receiver) REFERENCES `User`(userId)
ON DELETE CASCADE
ON UPDATE CASCADE,
CONSTRAINT NOT_FK2 FOREIGN KEY (eventId) REFERENCES Event (eventId)
ON DELETE CASCADE
ON UPDATE CASCADE,
CONSTRAINT NOT_FK3 FOREIGN KEY (groupId) REFERENCES `Group` (groupId)
ON DELETE CASCADE
ON UPDATE CASCADE
);
CREATE TABLE Participant_user (
eventId INT NOT NULL,
userId INT NOT NULL,
rights BOOLEAN NOT NULL,
status BOOLEAN,
visible BOOLEAN,
description VARCHAR (200),
CONSTRAINT ParUser_PK PRIMARY KEY (eventId, userId),
CONSTRAINT ParUser_FK1 FOREIGN KEY (eventId) REFERENCES Event(eventId)
ON DELETE CASCADE
ON UPDATE CASCADE,
CONSTRAINT ParUser_FK2 FOREIGN KEY (userId) REFERENCES `User`(userId)
ON DELETE CASCADE
ON UPDATE CASCADE
);
CREATE TABLE Participant_group (
eventId INT NOT NULL,
groupId INT NOT NULL,
rights BOOLEAN NOT NULL,
status BOOLEAN,
visible BOOLEAN,
description VARCHAR (200),
CONSTRAINT ParGroup_PK PRIMARY KEY (eventId, groupId),
CONSTRAINT ParGroup_FK1 FOREIGN KEY (eventId) REFERENCES Event(eventId)
ON DELETE CASCADE
ON UPDATE CASCADE,
CONSTRAINT ParGroup_FK2 FOREIGN KEY (groupId) REFERENCES `Group`(groupId)
ON DELETE CASCADE
ON UPDATE CASCADE
);
CREATE TABLE Alarm (
eventId INT NOT NULL,
userId INT NOT NULL,
alarmTime INT,
CONSTRAINT Alarm_PK PRIMARY KEY (eventId, userId),
CONSTRAINT Alarm_FK1 FOREIGN KEY (eventId) REFERENCES Event(eventId)
ON DELETE CASCADE
ON UPDATE CASCADE,
CONSTRAINT Alarm_FK2 FOREIGN KEY (userId) REFERENCES `User`(userId)
ON DELETE CASCADE
ON UPDATE CASCADE
);
|
UPDATE customers
SET customer_photo = EMPTY_CLOB();
UPDATE products
SET product_photo = EMPTY_BLOB(); |
CREATE TABLE IF NOT EXISTS tweets (
id INTEGER PRIMARY KEY,
text TEXT NOT NULL,
user_id INTEGER NOT NULL,
user_name TEXT NOT NULL,
date_tweeted TEXT NOT NULL,
location TEXT NULL
);
|
-- phpMyAdmin SQL Dump
-- version 4.6.5.2
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Aug 29, 2018 at 05:21 PM
-- Server version: 10.1.21-MariaDB
-- PHP Version: 5.6.30
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `christmasdraw`
--
-- --------------------------------------------------------
--
-- Table structure for table `administrator`
--
CREATE TABLE `administrator` (
`adminid` int(11) NOT NULL,
`adminname` varchar(50) NOT NULL,
`password` varchar(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `administrator`
--
INSERT INTO `administrator` (`adminid`, `adminname`, `password`) VALUES
(1, 'admin', 'password');
-- --------------------------------------------------------
--
-- Table structure for table `category`
--
CREATE TABLE `category` (
`categoryid` int(50) NOT NULL,
`categoryname` varchar(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `category`
--
INSERT INTO `category` (`categoryid`, `categoryname`) VALUES
(1, 'Luxury Hamper'),
(2, 'Essential Hamper'),
(3, 'Childrens Hamper'),
(4, 'Pamper Hamper');
-- --------------------------------------------------------
--
-- Table structure for table `hamper`
--
CREATE TABLE `hamper` (
`hamperid` int(50) NOT NULL,
`image` varchar(50) NOT NULL,
`hampertype` varchar(50) NOT NULL,
`description` text NOT NULL,
`categoryid` int(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `hamper`
--
INSERT INTO `hamper` (`hamperid`, `image`, `hampertype`, `description`, `categoryid`) VALUES
(1, 'images/luxury_hamper.jpeg', 'Luxury Christmas Hamper', 'A luxury hamper including wines & chocolates', 1),
(2, 'images/essential_hamper.jpeg', 'Essential Christmas Hamper', 'A hamper with all your larder favourites', 2),
(3, 'images/childrens_hamper.jpeg', 'Children\'s Christmas Eve Hamper', 'A treat for the kids for Christmas Eve', 3),
(4, 'images/pamper_hamper.jpeg', 'Pamper Hamper', 'A treat for the adults with all these goodies', 4);
-- --------------------------------------------------------
--
-- Table structure for table `hamperitem`
--
CREATE TABLE `hamperitem` (
`hamperid` int(10) NOT NULL,
`Itemid` int(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `hamperitem`
--
INSERT INTO `hamperitem` (`hamperid`, `Itemid`) VALUES
(1, 1),
(1, 2),
(1, 3),
(1, 4),
(1, 5),
(1, 6),
(1, 7),
(1, 8),
(1, 9),
(1, 10),
(1, 11),
(1, 12),
(1, 13),
(1, 14),
(1, 15),
(1, 23),
(1, 45),
(1, 56),
(1, 63),
(1, 64),
(1, 65),
(2, 16),
(2, 17),
(2, 18),
(2, 19),
(2, 20),
(2, 21),
(2, 22),
(2, 24),
(2, 25),
(2, 26),
(2, 27),
(2, 28),
(2, 29),
(2, 30),
(2, 31),
(2, 32),
(2, 33),
(2, 34),
(2, 35),
(1, 1),
(1, 2),
(1, 3),
(1, 4),
(1, 5),
(1, 6),
(1, 7),
(1, 8),
(1, 9),
(1, 10),
(1, 11),
(1, 12),
(1, 13),
(1, 14),
(1, 15),
(1, 23),
(1, 45),
(1, 56),
(1, 63),
(1, 64),
(1, 65),
(2, 16),
(2, 17),
(2, 18),
(2, 19),
(2, 20),
(2, 21),
(2, 22),
(2, 24),
(2, 25),
(2, 26),
(2, 27),
(2, 28),
(2, 29),
(2, 30),
(2, 31),
(2, 32),
(2, 33),
(2, 34),
(2, 35),
(2, 36),
(2, 37),
(2, 38),
(2, 39),
(2, 40),
(2, 41),
(2, 42),
(2, 43),
(2, 44),
(2, 46),
(2, 47),
(2, 48),
(2, 49),
(2, 50),
(2, 3),
(2, 8),
(3, 51),
(3, 52),
(3, 53),
(3, 54),
(3, 55),
(3, 57),
(3, 58),
(3, 59),
(3, 60),
(3, 14),
(4, 61),
(4, 62),
(2, 36),
(2, 37),
(2, 38),
(2, 39),
(2, 40),
(2, 41),
(2, 42),
(2, 43),
(2, 44),
(2, 46),
(2, 47),
(2, 48),
(2, 49),
(2, 50),
(2, 3),
(2, 8),
(3, 51),
(3, 52),
(3, 53),
(3, 54),
(3, 55),
(3, 57),
(3, 58),
(3, 59),
(3, 60),
(3, 14),
(4, 61),
(4, 62);
-- --------------------------------------------------------
--
-- Table structure for table `item`
--
CREATE TABLE `item` (
`itemid` int(10) NOT NULL,
`image` varchar(200) NOT NULL,
`itemdescription` text NOT NULL,
`categoryid` int(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `item`
--
INSERT INTO `item` (`itemid`, `image`, `itemdescription`, `categoryid`) VALUES
(1, 'images/christmas_cake.jpg', 'Iced Christmas Cake', 1),
(2, 'images/shloer.jpg', 'Bottle Shloer', 1),
(4, 'images/christmas_cracker.jpg', 'Luxury Christmas Crackers', 1),
(5, 'images/crisps.jpg', 'Fancy Crisps', 1),
(6, 'images/peanuts.jpg', 'Peanuts', 1),
(7, '', 'Chutney\'s', 1),
(8, 'images/cranberry_sauce.jpg', 'Cranberry Sauce', 1),
(9, 'images/luxury_chocolate.jpg', 'Luxury Chocolates', 1),
(10, 'images/chocolate_santa.jpg', 'Chocolate Santa', 1),
(11, 'images/chocolate_santa.jpg', 'Chocolate Snowman', 1),
(12, '', 'Box Biscuits', 1),
(13, 'images/christmas_napkin.jpg', 'Christmas Napkins', 1),
(14, '', 'Selection Box', 1),
(15, 'images/candle.jpg', 'Candle', 1),
(16, 'images/teabags.jpg', 'Box Teabags', 2),
(17, 'images/coffee.jpg', 'Jar Coffee', 2),
(18, '', 'Stuffing Mix', 2),
(19, 'images/jam.jpg', 'Jar Jam', 2),
(20, '', 'Tin Fruit', 2),
(21, '', 'Trifle Sponges', 2),
(22, '', 'Flan Case', 2),
(23, '', 'Tin Sweets', 1),
(24, 'images/crisps.jpg', 'Crisps', 2),
(25, '', 'Dips', 2),
(26, '', 'Mustard', 2),
(27, 'images/red_sauce.jpg', 'Red Sauce', 2),
(28, '', 'Brown Sauce', 2),
(29, '', 'Mayonnaise', 2),
(30, '', 'Jar Mixed herbs', 2),
(31, 'images/salt.jpg', 'Salt', 2),
(32, 'images/pepper.jpg', 'Pepper', 2),
(33, '', 'Tin Foil', 2),
(34, 'images/shortbread.jpg', 'Box Shortbread', 1),
(35, '', 'Cling Film', 2),
(36, '', 'Greaseproof Paper', 2),
(37, '', 'Bird\'s Trifle', 2),
(38, '', 'Bottle Mineral', 2),
(39, '', 'Custard', 2),
(40, '', 'Jelly', 2),
(41, '', 'Peas', 2),
(42, '', 'Beans', 2),
(43, '', 'Sugar', 2),
(44, '', 'Spaghetti', 2),
(45, '', 'Christmas Pudding', 1),
(46, '', 'Dry Soup Mix', 2),
(47, 'images//soup.jpg', 'Soup', 2),
(48, '', 'Bisto', 2),
(49, '', 'Tins Rice', 2),
(50, '', 'Vinegar', 2),
(51, 'images/hot_chocolate.jpg', 'Hot Chocolate', 3),
(52, 'images/marshmallow.jpg', 'Marshmallows', 3),
(53, 'images/santas_cup.jpg', 'Tube Sweets', 3),
(54, 'images/santas_cup.jpg', 'Santa\'s Milk Cup', 3),
(55, 'images/santa\'scup&plate.jpg', 'Santa\'s Cookie Plate', 3),
(56, 'images/red_wine.jpg', 'Red Wine', 1),
(57, '', 'Reindeer Food', 3),
(58, '', 'Colouring Book', 3),
(59, 'images/crayons.jpg', 'Crayons', 3),
(60, '', 'Christmas DVD', 3),
(61, 'images/aftershave.jpg', 'Mans gift set', 4),
(62, 'images/perfume.jpg', 'Womans Gift Set', 4),
(63, 'images/white_wine.jpg', 'White Wine', 1),
(64, 'images/rose_wine.jpg', 'Rose Wine', 1),
(65, 'images/sparkling_wine.jpg', 'Sparkling Wine', 1),
(66, 'images/mince_pies.jpg', 'Mince pies', 1);
-- --------------------------------------------------------
--
-- Table structure for table `pledger`
--
CREATE TABLE `pledger` (
`pledgerid` int(50) NOT NULL,
`firstname` text NOT NULL,
`lastname` text NOT NULL,
`email` text NOT NULL,
`phoneno` int(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `pledger`
--
INSERT INTO `pledger` (`pledgerid`, `firstname`, `lastname`, `email`, `phoneno`) VALUES
(1, 'Anne-Marie', 'Foy', 'annemariefoy1974@gmail.com', 879975707),
(2, 'test', 'test', 'test@gmail.com', 875931564),
(3, 'test1', 'test1', 'test1@gmail.com', 861931681),
(4, 'test4', 'test4', 'test4@gmail.com', 853216549),
(5, 'test5', 'test5', 'test5@gmail.com', 876325992),
(7, 'slash', 'hudson', 'snakepit@gmail.com', 873246943),
(8, 'test 6', 'test', 'test6@gmail.com', 0),
(9, 'Paul ', 'Doherty', 'paul.doherty@optum.com', 749115039),
(10, 'a', 'b', 'c@gmail.com', 842635463),
(11, 'a', 'b', 'c@gmail.com', 842635463),
(12, 'a', 'b', 'c@gmail.com', 842635463);
-- --------------------------------------------------------
--
-- Table structure for table `quantity`
--
CREATE TABLE `quantity` (
`pledgeditemid` int(50) NOT NULL,
`hamperid` int(50) NOT NULL,
`Itemid` int(10) NOT NULL,
`pledgerid` int(50) NOT NULL,
`quantity` int(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `question`
--
CREATE TABLE `question` (
`id` int(11) NOT NULL,
`author_email` varchar(100) NOT NULL,
`author_name` varchar(100) NOT NULL,
`content` text NOT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`status` enum('pending','planned','','') NOT NULL DEFAULT 'pending',
`title` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `question`
--
INSERT INTO `question` (`id`, `author_email`, `author_name`, `content`, `created_at`, `status`, `title`) VALUES
(1, 'amf@gmail.com', 'anne-amir', 'f v vlvnps gel vls glsv lsvwlv s, ldg wlb dslb w,b slb wlgsl', '2018-08-07 15:17:35', 'planned', 'nwlgbwolgbv ls '),
(2, 'amf@gmail.com', 'sf gnwgnv;mleg#', 'c cmfsv wmnpv; lgWG LSVN LWT MT SLMGEl glslk', '2018-08-07 15:18:42', 'planned', 'mfmwofnl f'),
(4, 'md@gmail.com', 'mdmsn ', 'fmmpwnf f ofnolw lfw lw ', '2018-08-19 19:58:03', 'pending', 'hfdbw f'),
(5, 'paul.doherty@optum.com', 'Paul Doherty', 'lkjsdfhsohfkwjfkwj', '2018-08-23 11:11:17', 'planned', 'kjhsfkj'),
(6, 'amf@gmail.com', 'amf', 'tjd of wog olwg ', '2018-08-26 19:45:18', 'pending', 'test');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `administrator`
--
ALTER TABLE `administrator`
ADD PRIMARY KEY (`adminid`);
--
-- Indexes for table `category`
--
ALTER TABLE `category`
ADD PRIMARY KEY (`categoryid`);
--
-- Indexes for table `hamper`
--
ALTER TABLE `hamper`
ADD PRIMARY KEY (`hamperid`),
ADD KEY `categoryid` (`categoryid`);
--
-- Indexes for table `item`
--
ALTER TABLE `item`
ADD PRIMARY KEY (`itemid`),
ADD KEY `categoryid` (`categoryid`);
--
-- Indexes for table `pledger`
--
ALTER TABLE `pledger`
ADD PRIMARY KEY (`pledgerid`);
--
-- Indexes for table `quantity`
--
ALTER TABLE `quantity`
ADD PRIMARY KEY (`pledgeditemid`),
ADD KEY `hamperid` (`hamperid`),
ADD KEY `Itemid` (`Itemid`),
ADD KEY `pledgerid` (`pledgerid`);
--
-- Indexes for table `question`
--
ALTER TABLE `question`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `administrator`
--
ALTER TABLE `administrator`
MODIFY `adminid` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `category`
--
ALTER TABLE `category`
MODIFY `categoryid` int(50) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT for table `hamper`
--
ALTER TABLE `hamper`
MODIFY `hamperid` int(50) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT for table `item`
--
ALTER TABLE `item`
MODIFY `itemid` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=67;
--
-- AUTO_INCREMENT for table `pledger`
--
ALTER TABLE `pledger`
MODIFY `pledgerid` int(50) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=13;
--
-- AUTO_INCREMENT for table `quantity`
--
ALTER TABLE `quantity`
MODIFY `pledgeditemid` int(50) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `question`
--
ALTER TABLE `question`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `category`
--
ALTER TABLE `category`
ADD CONSTRAINT `category_ibfk_1` FOREIGN KEY (`categoryid`) REFERENCES `hamper` (`categoryid`);
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
SELECT
RPAD(
CAST(soc.id_socio AS CHAR),
19,
' '
) AS idSocio,
cci.valor AS monto,
CONCAT(
LPAD(cci.mes, 2, '0'),
'/',
cci.anio
) AS periodo,
cci.anio AS anioPeriodo,
cci.mes AS mesPeriodo,
cci.fecha_emision AS emision,
date_format(DATE_ADD(cci.fecha_emision, INTERVAL 10 DAY), '%Y%m%d') AS vencimiento,
date_format(DATE_ADD(cci.fecha_emision, INTERVAL 15 DAY), '%Y%m%d') AS vencimientoDos,
date_format(DATE_ADD(cci.fecha_emision, INTERVAL 20 DAY), '%Y%m%d') AS vencimientoTres,
RPAD(
cci.id_cta_cte_item,
20,
' '
) AS idFactura,
LPAD(
REPLACE(CAST(ROUND(cci.valor,2) AS CHAR),'.',''),
11,
'0'
) AS montoFormat
FROM io_socio soc
JOIN io_estado_socio es ON es.id_estado_socio = soc.estado_socio_id
JOIN io_cta_cte cc ON cc.socio_id = soc.id_socio
JOIN io_cta_cte_item cci ON cci.cta_cte_id = cc.id_cta_cte
LEFT JOIN io_categoria_socio cs ON cs.id_categoria_socio = cci.categoria_id
LEFT JOIN io_tipo_grupo_familiar tgf ON tgf.id_tipo_grupo_familiar = cci.tipo_grupo_familiar_id
LEFT JOIN io_categoria_socio cs2 ON cs2.id_categoria_socio = cs.id_categoria_socio
LEFT JOIN io_tipo_grupo_familiar tgf2 ON tgf2.id_tipo_grupo_familiar = tgf.id_tipo_grupo_familiar
WHERE es.socio_activo = TRUE
AND cci.anulado = FALSE AND cci.refinanciado = FALSE AND cci.pagado = FALSE
AND cci.concepto_id = 1
ORDER BY cci.anio DESC, cci.mes DESC; |
#a
select * from employees where hire_date=(
select min(hire_date) from employees
);
#b
update salaries set salary=salary+1 where emp_no in (
select emp_no from employees where gender='M'
);
#c
delete from titles where emp_no in (
select emp_no from employees where last_name="Acton"
);
delete from dept_emp where emp_no in (
select emp_no from employees where last_name="Acton"
);
delete from salaries where emp_no in (
select emp_no from employees where last_name="Acton"
);
delete from employees where last_name="Acton";
#d
insert into employees values(66666,"1995-05-19","Wang","Zhiwei",'M',"2017-06-01");
insert into titles values(66666,"CEO","2017-06-01","2018-06-01");
insert into dept_emp values(66666,"no1","2017-06-01","2018-06-01");
insert into salaries values(66666,400000,"2017-06-01","2018-06-01");
|
UPDATE asesoria
SET asesor= :asesor,
hora_inicio= :hora_inicio,
hora_fin= :hora_fin,
fecha_asesoria= :fecha_asesoria,
duracion= :duracion
WHERE id= :id;
|
drop table if exists station;
create table station
(
id bigserial not null constraint station_pk primary key,
station_name varchar(100),
creator varchar(100),
create_date timestamptz default now(),
modify_date timestamptz
); |
select
100.00 * sum(case
when p_type like 'PROMO%'
then l_extendedprice*(1-l_discount)
else 0
end) / sum(l_extendedprice * (1 - l_discount)) as promo_revenue
from
lineitem,part
where
l_partkey = p_partkey
and l_shipdate >= date '1995-09-01'
and l_shipdate < date '1995-09-01' + interval '1' month;
|
# Host: localhost (Version 5.7.16-log)
# Date: 2020-12-25 10:26:21
# Generator: MySQL-Front 6.1 (Build 1.26)
#
# Structure for table "陈凯宇_news3"
#
DROP TABLE IF EXISTS `陈凯宇_news3`;
CREATE TABLE `陈凯宇_news3` (
`Id` int(11) NOT NULL AUTO_INCREMENT,
`类别` varchar(255) DEFAULT NULL,
`标题` varchar(255) DEFAULT NULL,
`内容` longtext,
`时间` varchar(255) DEFAULT NULL,
PRIMARY KEY (`Id`)
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;
#
# Data for table "陈凯宇_news3"
#
INSERT INTO `陈凯宇_news3` VALUES (1,'招聘新闻','招花店店长','职位描述:\r\n1、负责花店的员工日常管理及培训,花卉零售以及渠道销售工作,为店铺盈利制定创意营销策略,会员维护等工作; 2、制定鲜花设计方案,橱窗设计方案,保证店内产品的展示性; 3、对于花店产品的摆放有独到的见解及风格,了解客户的心理需求,进行店面文化设计; 4、监督鲜花的要货、上货、补货,做好进货验收、商品陈列、商品质量和服务质量管理、门店鲜花鲜度及损耗管理; 5、掌握门店各种设备的维护保养知识; 6、监督门店内外的清洁卫生,负责保卫、防火等管理; 7、妥善处理顾客投诉和服务工作中所发生的各种矛盾; 任职资格: 1、大专学历以上,有花卉门店管理工作2年以上经验; 2、学习能力强,有领导力才能,良好的审美; 3、形象气质佳、具备亲和力。','2020-12-23');
|
ALTER TABLE `t_post`
ADD COLUMN `auth_code` VARCHAR(20) NOT NULL DEFAULT '' COMMENT '访问密码' AFTER `comment_num`;
|
CREATE DATABASE IF NOT EXISTS `projectkoala` /*!40100 DEFAULT CHARACTER SET utf8 */;
USE `projectkoala`;
-- MySQL dump 10.13 Distrib 5.6.13, for Win32 (x86)
--
-- Host: localhost Database: projectkoala
-- ------------------------------------------------------
-- Server version 5.6.14
/*!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 `accounts`
--
DROP TABLE IF EXISTS `accounts`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `accounts` (
`Id` int(11) NOT NULL,
`Faculties_Id` int(11) NOT NULL,
`FullName` varchar(50) DEFAULT NULL,
`UserName` varchar(50) DEFAULT NULL,
`PassWord` varchar(50) DEFAULT NULL,
`Emai` varchar(50) DEFAULT NULL,
`PhoneNumber` char(20) DEFAULT NULL,
`IsActive` tinyint(1) DEFAULT NULL,
`IsRoot` tinyint(1) DEFAULT NULL,
`ChucVu` varchar(50) DEFAULT NULL,
PRIMARY KEY (`Id`,`Faculties_Id`),
KEY `fk_Accounts_Faculties1_idx` (`Faculties_Id`),
CONSTRAINT `fk_Accounts_Faculties1` FOREIGN KEY (`Faculties_Id`) REFERENCES `faculties` (`Id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `accounts`
--
LOCK TABLES `accounts` WRITE;
/*!40000 ALTER TABLE `accounts` DISABLE KEYS */;
INSERT INTO `accounts` VALUES (1000,1,'admin','admin','admin','admin','adimn',1,1,NULL);
/*!40000 ALTER TABLE `accounts` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `buslist`
--
DROP TABLE IF EXISTS `buslist`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `buslist` (
`idBusList` int(11) NOT NULL,
`idStudents` int(11) NOT NULL,
`LuotDi` varchar(45) NOT NULL,
`GhiChu` varchar(500) DEFAULT NULL,
`TienXe` varchar(45) NOT NULL,
`DiaChi` varchar(120) NOT NULL,
`IsActive` int(11) DEFAULT NULL,
`StartDate` date DEFAULT NULL,
`EndDate` date DEFAULT NULL,
PRIMARY KEY (`idBusList`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `buslist`
--
LOCK TABLES `buslist` WRITE;
/*!40000 ALTER TABLE `buslist` DISABLE KEYS */;
/*!40000 ALTER TABLE `buslist` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `classes`
--
DROP TABLE IF EXISTS `classes`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `classes` (
`Id` int(11) NOT NULL,
`Faculties_Id` int(11) NOT NULL,
`Semesters` int(11) NOT NULL,
`Levels_Id` int(11) NOT NULL,
`Year` year(4) DEFAULT NULL,
`NameClass` varchar(45) DEFAULT NULL,
`TeacherClass` varchar(45) DEFAULT NULL,
`MaxNumber` int(11) DEFAULT NULL,
`IsActive` tinyint(1) DEFAULT NULL,
PRIMARY KEY (`Id`,`Faculties_Id`),
KEY `fk_Classes_Faculties1_idx` (`Faculties_Id`),
KEY `fk_Classes_Semesters1_idx` (`Semesters`),
KEY `fk_Classes_Levels1_idx` (`Levels_Id`),
CONSTRAINT `fk_Classes_Faculties1` FOREIGN KEY (`Faculties_Id`) REFERENCES `faculties` (`Id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_Classes_Levels1` FOREIGN KEY (`Levels_Id`) REFERENCES `levels` (`Id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_Classes_Semesters1` FOREIGN KEY (`Semesters`) REFERENCES `semesters` (`SemesterNumber`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `classes`
--
LOCK TABLES `classes` WRITE;
/*!40000 ALTER TABLE `classes` DISABLE KEYS */;
/*!40000 ALTER TABLE `classes` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `classes_has_students`
--
DROP TABLE IF EXISTS `classes_has_students`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `classes_has_students` (
`Classes_Id` int(11) NOT NULL,
`Students_Id` int(11) NOT NULL,
`Faculties_Id` int(11) NOT NULL,
`Class_Id_Old` int(11) DEFAULT '0',
PRIMARY KEY (`Classes_Id`,`Students_Id`,`Faculties_Id`),
KEY `fk_Classes_has_Students_Students1_idx` (`Students_Id`),
KEY `fk_Classes_has_Students_Classes1_idx` (`Classes_Id`),
KEY `fk_Classes_has_Students_Faculties1_idx` (`Faculties_Id`),
CONSTRAINT `fk_Classes_has_Students_Classes1` FOREIGN KEY (`Classes_Id`) REFERENCES `classes` (`Id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_Classes_has_Students_Faculties1` FOREIGN KEY (`Faculties_Id`) REFERENCES `faculties` (`Id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_Classes_has_Students_Students1` FOREIGN KEY (`Students_Id`) REFERENCES `students` (`Id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `classes_has_students`
--
LOCK TABLES `classes_has_students` WRITE;
/*!40000 ALTER TABLE `classes_has_students` DISABLE KEYS */;
/*!40000 ALTER TABLE `classes_has_students` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `cost`
--
DROP TABLE IF EXISTS `cost`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `cost` (
`Id` int(11) NOT NULL,
`Faculties_Id` int(11) NOT NULL,
`Semesters` int(11) NOT NULL,
`NameCost` varchar(45) NOT NULL,
`Amount` double DEFAULT NULL,
`year` year(4) NOT NULL,
`StartDate` date DEFAULT NULL,
`EndDate` date DEFAULT NULL,
PRIMARY KEY (`Id`,`Faculties_Id`,`Semesters`),
KEY `fk_Cost_Faculties1_idx` (`Faculties_Id`),
KEY `fk_Cost_Semesters1_idx` (`Semesters`),
CONSTRAINT `fk_Cost_Faculties1` FOREIGN KEY (`Faculties_Id`) REFERENCES `faculties` (`Id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_Cost_Semesters` FOREIGN KEY (`Semesters`) REFERENCES `semesters` (`SemesterNumber`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `cost`
--
LOCK TABLES `cost` WRITE;
/*!40000 ALTER TABLE `cost` DISABLE KEYS */;
/*!40000 ALTER TABLE `cost` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `dropbox`
--
DROP TABLE IF EXISTS `dropbox`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `dropbox` (
`id` int(11) NOT NULL,
`mail` varchar(45) DEFAULT NULL,
`pass` varchar(45) DEFAULT NULL,
`active` int(11) DEFAULT NULL,
`remeber` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `dropbox`
--
LOCK TABLES `dropbox` WRITE;
/*!40000 ALTER TABLE `dropbox` DISABLE KEYS */;
/*!40000 ALTER TABLE `dropbox` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `faculties`
--
DROP TABLE IF EXISTS `faculties`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `faculties` (
`Id` int(11) NOT NULL,
`Address` varchar(200) DEFAULT NULL,
`PhoneNumbers` char(20) DEFAULT NULL,
`Email` varchar(50) DEFAULT NULL,
`UpdateDate` date DEFAULT NULL,
`CreateDate` date DEFAULT NULL,
`name` varchar(45) DEFAULT NULL,
PRIMARY KEY (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `faculties`
--
LOCK TABLES `faculties` WRITE;
/*!40000 ALTER TABLE `faculties` DISABLE KEYS */;
INSERT INTO `faculties` VALUES (1,'340 Bà triệu, Quận Hai Bà Trưng','+(84.4) 3772.3060','BaTrieu@gmail.com','2013-03-08','2013-03-08','Koala House Bà Triệu'),(2,'261 Hoàng Ngân, Quận Cầu Giấy','+(84.4) 3772.3060','HoangNgan@gmail.com','2013-03-08','2013-03-08','Koala House Hoàng Ngân'),(3,'5 Phan Kế Bính, Quận Ba Đình','+(84.4) 3974.7617','PhanKeBinh@gmail.com','2013-03-08','2013-03-08','Koala House Phan Kế Bính'),(4,'3 Nguyễn Huy Tự, Quận Hai Bà Trưng','+ (84.4) 3972.8913','NguyenHuyTu@gmail.com','2013-03-08','2013-03-08','Koala House Nguyễn Huy Tự');
/*!40000 ALTER TABLE `faculties` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `lateday`
--
DROP TABLE IF EXISTS `lateday`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `lateday` (
`Id` int(11) NOT NULL,
`Faculties_Id` int(11) NOT NULL,
`Students_Id` int(11) NOT NULL,
`LateDate` date DEFAULT NULL,
`Time` int(11) DEFAULT '0',
`isActive` int(11) DEFAULT NULL,
`Semester` int(11) DEFAULT NULL,
`year` year(4) DEFAULT NULL,
PRIMARY KEY (`Id`,`Faculties_Id`),
KEY `fk_LateDay_Faculties1_idx` (`Faculties_Id`),
KEY `fk_LateDay_Students1_idx` (`Students_Id`),
CONSTRAINT `fk_LateDay_Faculties1` FOREIGN KEY (`Faculties_Id`) REFERENCES `faculties` (`Id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_LateDay_Students1` FOREIGN KEY (`Students_Id`) REFERENCES `students` (`Id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `lateday`
--
LOCK TABLES `lateday` WRITE;
/*!40000 ALTER TABLE `lateday` DISABLE KEYS */;
/*!40000 ALTER TABLE `lateday` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `learnsummer`
--
DROP TABLE IF EXISTS `learnsummer`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `learnsummer` (
`id` int(11) NOT NULL,
`idStudents` int(11) NOT NULL,
`tuanhoc` varchar(60) NOT NULL,
`soTuanHoc` int(11) NOT NULL,
`class` varchar(60) NOT NULL,
`IsActive` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `learnsummer`
--
LOCK TABLES `learnsummer` WRITE;
/*!40000 ALTER TABLE `learnsummer` DISABLE KEYS */;
/*!40000 ALTER TABLE `learnsummer` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `leaves`
--
DROP TABLE IF EXISTS `leaves`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `leaves` (
`Id` int(11) NOT NULL,
`Faculties_Id` int(11) NOT NULL,
`Students_Id` int(11) NOT NULL,
`StartDate` varchar(10) DEFAULT NULL,
`EndDate` varchar(10) DEFAULT NULL,
PRIMARY KEY (`Id`,`Faculties_Id`),
KEY `fk_Leaves_Faculties1_idx` (`Faculties_Id`),
KEY `fk_Leaves_Students1_idx` (`Students_Id`),
CONSTRAINT `fk_Leaves_Faculties1` FOREIGN KEY (`Faculties_Id`) REFERENCES `faculties` (`Id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_Leaves_Students1` FOREIGN KEY (`Students_Id`) REFERENCES `students` (`Id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `leaves`
--
LOCK TABLES `leaves` WRITE;
/*!40000 ALTER TABLE `leaves` DISABLE KEYS */;
/*!40000 ALTER TABLE `leaves` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `levels`
--
DROP TABLE IF EXISTS `levels`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `levels` (
`Id` int(11) NOT NULL,
`Name` varchar(50) DEFAULT NULL,
PRIMARY KEY (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `levels`
--
LOCK TABLES `levels` WRITE;
/*!40000 ALTER TABLE `levels` DISABLE KEYS */;
INSERT INTO `levels` VALUES (1,'NẮNG MAI (SUNSHINE)'),(2,'TỔ ONG (BEEHIVE)'),(3,'TỔ KIẾN (CHRYSALIS)'),(4,'MẪU GIÁO (KINDERGARTEN)');
/*!40000 ALTER TABLE `levels` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `receipts`
--
DROP TABLE IF EXISTS `receipts`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `receipts` (
`Id` int(11) NOT NULL,
`Faculties_Id` int(11) NOT NULL,
`Accounts_Id` int(11) NOT NULL,
`Students_Id` int(11) NOT NULL,
`No` int(11) DEFAULT NULL,
`NamePayer` varchar(45) DEFAULT NULL,
`NameCasher` varchar(45) DEFAULT NULL,
`Number` double DEFAULT NULL,
`InWords` varchar(50) DEFAULT NULL,
`IsReturn` tinyint(1) DEFAULT NULL,
`CreateDate` date DEFAULT NULL,
`IsTransfer` tinyint(1) DEFAULT NULL,
`Percent` int(11) DEFAULT NULL,
`Reason` varchar(512) DEFAULT NULL,
PRIMARY KEY (`Id`,`Faculties_Id`),
KEY `fk_Receipts_Faculties1_idx` (`Faculties_Id`),
KEY `fk_Receipts_Accounts1_idx` (`Accounts_Id`),
KEY `fk_Receipts_Students1_idx` (`Students_Id`),
CONSTRAINT `fk_Receipts_Accounts1` FOREIGN KEY (`Accounts_Id`) REFERENCES `accounts` (`Id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_Receipts_Faculties1` FOREIGN KEY (`Faculties_Id`) REFERENCES `faculties` (`Id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_Receipts_Students1` FOREIGN KEY (`Students_Id`) REFERENCES `students` (`Id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `receipts`
--
LOCK TABLES `receipts` WRITE;
/*!40000 ALTER TABLE `receipts` DISABLE KEYS */;
/*!40000 ALTER TABLE `receipts` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `refund`
--
DROP TABLE IF EXISTS `refund`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `refund` (
`id` int(11) NOT NULL,
`idStudent` int(11) NOT NULL,
`StartDate` date DEFAULT NULL,
`EndDate` date NOT NULL,
`Note` varchar(200) DEFAULT NULL,
`IsActive` int(11) NOT NULL,
`SoTien` varchar(45) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `refund`
--
LOCK TABLES `refund` WRITE;
/*!40000 ALTER TABLE `refund` DISABLE KEYS */;
/*!40000 ALTER TABLE `refund` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `semesters`
--
DROP TABLE IF EXISTS `semesters`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `semesters` (
`SemesterNumber` int(11) NOT NULL,
`Faculties_Id` int(11) NOT NULL,
`Year` year(4) NOT NULL,
`StartDate` date DEFAULT NULL,
`EndDate` date DEFAULT NULL,
`IsActivity` int(11) DEFAULT NULL,
PRIMARY KEY (`SemesterNumber`,`Faculties_Id`,`Year`),
KEY `fk_Semesters_Faculties1_idx` (`Faculties_Id`),
CONSTRAINT `fk_Semesters_Faculties1` FOREIGN KEY (`Faculties_Id`) REFERENCES `faculties` (`Id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `semesters`
--
LOCK TABLES `semesters` WRITE;
/*!40000 ALTER TABLE `semesters` DISABLE KEYS */;
INSERT INTO `semesters` VALUES (1,1,2013,'2013-01-01','2013-01-01',0),(2,1,2013,'2013-01-01','2013-01-01',0),(3,1,2013,'2013-01-01','2013-01-01',0),(4,1,2013,'2013-01-01','2013-01-01',0),(5,1,2013,'2013-01-01','2013-01-01',0);
/*!40000 ALTER TABLE `semesters` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `students`
--
DROP TABLE IF EXISTS `students`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `students` (
`Id` int(11) NOT NULL,
`Faculties_Id` int(11) NOT NULL,
`FullName` varchar(50) DEFAULT NULL,
`BrithDay` date DEFAULT NULL,
`PhoneNumberFather` char(16) DEFAULT NULL,
`Father` varchar(45) DEFAULT NULL,
`IsClient` tinyint(1) DEFAULT NULL,
`CreateDate` date DEFAULT NULL,
`Debt` float DEFAULT NULL,
`isactive` int(11) DEFAULT NULL,
`Mother` varchar(45) DEFAULT NULL,
`PhoneNumberMother` varchar(16) DEFAULT NULL,
`HomePhone` varchar(16) DEFAULT NULL,
`Email` varchar(45) DEFAULT NULL,
`Sex` int(11) DEFAULT NULL,
`IsDatCoc` int(11) DEFAULT NULL,
`NhapHoc` date DEFAULT NULL,
`NghiHoc` date DEFAULT NULL,
`DaiDien` varchar(256) DEFAULT NULL,
PRIMARY KEY (`Id`,`Faculties_Id`),
KEY `fk_Students_Faculties1_idx` (`Faculties_Id`),
CONSTRAINT `fk_Students_Faculties1` FOREIGN KEY (`Faculties_Id`) REFERENCES `faculties` (`Id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `students`
--
LOCK TABLES `students` WRITE;
/*!40000 ALTER TABLE `students` DISABLE KEYS */;
/*!40000 ALTER TABLE `students` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `students_has_cost`
--
DROP TABLE IF EXISTS `students_has_cost`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `students_has_cost` (
`Students_Id` int(11) NOT NULL,
`Cost_Id` int(11) NOT NULL,
`Faculties_Id` int(11) NOT NULL,
`IsDebt` tinyint(1) DEFAULT NULL,
PRIMARY KEY (`Students_Id`,`Cost_Id`,`Faculties_Id`),
KEY `fk_Students_has_Cost_Cost1_idx` (`Cost_Id`),
KEY `fk_Students_has_Cost_Students1_idx` (`Students_Id`),
KEY `fk_Students_has_Cost_Faculties1_idx` (`Faculties_Id`),
CONSTRAINT `fk_Students_has_Cost_Cost1` FOREIGN KEY (`Cost_Id`) REFERENCES `cost` (`Id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_Students_has_Cost_Faculties1` FOREIGN KEY (`Faculties_Id`) REFERENCES `faculties` (`Id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_Students_has_Cost_Students1` FOREIGN KEY (`Students_Id`) REFERENCES `students` (`Id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `students_has_cost`
--
LOCK TABLES `students_has_cost` WRITE;
/*!40000 ALTER TABLE `students_has_cost` DISABLE KEYS */;
/*!40000 ALTER TABLE `students_has_cost` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `summerweek`
--
DROP TABLE IF EXISTS `summerweek`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `summerweek` (
`id` int(11) NOT NULL,
`tuanHoc` int(11) NOT NULL,
`startDay` varchar(60) NOT NULL,
`endDay` varchar(60) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `summerweek`
--
LOCK TABLES `summerweek` WRITE;
/*!40000 ALTER TABLE `summerweek` DISABLE KEYS */;
INSERT INTO `summerweek` VALUES (1,1,'2014-1-2','2014-1-6'),(2,2,'2014-2-3','2014-2-4'),(3,3,'2014-2-3','2014-2-4'),(4,4,'2014-2-3','2014-2-4'),(5,5,'2014-2-3','2014-2-4'),(6,6,'2014-2-3','2014-2-4'),(7,7,'2014-2-3','2014-2-4'),(8,8,'2014-2-3','2014-2-4');
/*!40000 ALTER TABLE `summerweek` 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 2014-07-10 2:10:21
|
/* Lógico_1: */
CREATE TABLE Vaga (
Id INT PRIMARY KEY,
Titulo Varchar (45),
Descricao varchar(1000),
Alocado Boolean,
ComoCandidatar Varchar(1000),
Salario Float,
FK_Contratante_Id INT,
FK_TipoSalario_Id INT,
FK_FormaContrato_Id INT,
FK_NivelProfissional_Id INT,
FK_EstadoVaga_Id INT
);
CREATE TABLE Contratante (
Id INT PRIMARY KEY,
Cnpj Varchar(14),
Descricao 100,
FK_Pessoa_Id INT,
FK_Endereco_Id INT
);
CREATE TABLE Desenvolvedor (
Local Varchar (45),
GitHub Varchar (45),
Id INT PRIMARY KEY,
FK_Pessoa_Id INT
);
CREATE TABLE Repositorio (
Id INT PRIMARY KEY,
Nome Varchar (45)
);
CREATE TABLE Contratado (
Id INT PRIMARY KEY,
FK_Vaga_Id INT,
FK_Desenvolvedor_Id INT,
FK_Contratante_Id INT
);
CREATE TABLE TipoContato (
Id INT PRIMARY KEY,
Tipo Varchar(30)
);
CREATE TABLE Favorito (
Id INT PRIMARY KEY,
FK_Desenvolvedor_Id INT,
FK_Vaga_Id INT
);
CREATE TABLE Pessoa (
Id INT PRIMARY KEY,
Nome Varchar (45)
);
CREATE TABLE Contato (
Id INT PRIMARY KEY,
Contato Varchar (45),
FK_Pessoa_Id INT,
FK_TipoContato_Id INT
);
CREATE TABLE Issue (
Id INT PRIMARY KEY,
Numero INT,
FK_Vaga_Id INT,
FK_Repositorio_Id INT
);
CREATE TABLE Endereco (
Id INT PRIMARY KEY,
Cep Varchar(8),
Complemento Varchar(30),
Numero INT
);
CREATE TABLE Resposta (
Id INT PRIMARY KEY,
Conteudo Varchar(150),
FK_Desenvolvedor_Id INT,
FK_Vaga_Id INT
);
CREATE TABLE Requisito (
Id INT PRIMARY KEY,
Descricao Varchar (45),
FK_Vaga_Id INT,
FK_TipoRequisito_Id INT
);
CREATE TABLE Beneficio (
Id INT PRIMARY KEY,
Valor Float,
Descricao Varchar (45),
FK_Vaga_Id INT,
FK_TipoBeneficio_Id INT
);
CREATE TABLE TipoSalario (
Id INT PRIMARY KEY,
Tipo varchar(1000)
);
CREATE TABLE TipoRequisito (
Id INT PRIMARY KEY,
Tipo Varchar (45)
);
CREATE TABLE TipoBeneficio (
Id INT PRIMARY KEY,
Tipo Varchar (45)
);
CREATE TABLE FormaContrato (
Id INT PRIMARY KEY,
Tipo Varchar (45)
);
CREATE TABLE NivelProfissional (
Id INT PRIMARY KEY,
Nivel Varchar (45)
);
CREATE TABLE EstadoVaga (
Id INT PRIMARY KEY,
Estado Boolean
);
ALTER TABLE Vaga ADD CONSTRAINT FK_Vaga_1
FOREIGN KEY (FK_Contratante_Id)
REFERENCES Contratante (Id)
ON DELETE RESTRICT ON UPDATE RESTRICT;
ALTER TABLE Vaga ADD CONSTRAINT FK_Vaga_2
FOREIGN KEY (FK_TipoSalario_Id)
REFERENCES TipoSalario (Id)
ON DELETE RESTRICT ON UPDATE RESTRICT;
ALTER TABLE Vaga ADD CONSTRAINT FK_Vaga_3
FOREIGN KEY (FK_FormaContrato_Id)
REFERENCES FormaContrato (Id)
ON DELETE RESTRICT ON UPDATE RESTRICT;
ALTER TABLE Vaga ADD CONSTRAINT FK_Vaga_4
FOREIGN KEY (FK_NivelProfissional_Id)
REFERENCES NivelProfissional (Id)
ON DELETE RESTRICT ON UPDATE RESTRICT;
ALTER TABLE Vaga ADD CONSTRAINT FK_Vaga_5
FOREIGN KEY (FK_EstadoVaga_Id)
REFERENCES EstadoVaga (Id)
ON DELETE RESTRICT ON UPDATE RESTRICT;
ALTER TABLE Contratante ADD CONSTRAINT FK_Contratante_1
FOREIGN KEY (FK_Pessoa_Id)
REFERENCES Pessoa (Id)
ON DELETE RESTRICT ON UPDATE RESTRICT;
ALTER TABLE Contratante ADD CONSTRAINT FK_Contratante_2
FOREIGN KEY (FK_Endereco_Id)
REFERENCES Endereco (Id)
ON DELETE RESTRICT ON UPDATE RESTRICT;
ALTER TABLE Desenvolvedor ADD CONSTRAINT FK_Desenvolvedor_1
FOREIGN KEY (FK_Pessoa_Id)
REFERENCES Pessoa (Id)
ON DELETE RESTRICT ON UPDATE RESTRICT;
ALTER TABLE Contratado ADD CONSTRAINT FK_Contratado_1
FOREIGN KEY (FK_Vaga_Id)
REFERENCES Vaga (Id)
ON DELETE RESTRICT ON UPDATE RESTRICT;
ALTER TABLE Contratado ADD CONSTRAINT FK_Contratado_2
FOREIGN KEY (FK_Desenvolvedor_Id)
REFERENCES Desenvolvedor (Id)
ON DELETE RESTRICT ON UPDATE RESTRICT;
ALTER TABLE Contratado ADD CONSTRAINT FK_Contratado_3
FOREIGN KEY (FK_Contratante_Id)
REFERENCES Contratante (Id)
ON DELETE RESTRICT ON UPDATE RESTRICT;
ALTER TABLE Favorito ADD CONSTRAINT FK_Favorito_1
FOREIGN KEY (FK_Desenvolvedor_Id)
REFERENCES Desenvolvedor (Id)
ON DELETE RESTRICT ON UPDATE RESTRICT;
ALTER TABLE Favorito ADD CONSTRAINT FK_Favorito_2
FOREIGN KEY (FK_Vaga_Id)
REFERENCES Vaga (Id)
ON DELETE RESTRICT ON UPDATE RESTRICT;
ALTER TABLE Contato ADD CONSTRAINT FK_Contato_1
FOREIGN KEY (FK_Pessoa_Id)
REFERENCES Pessoa (Id)
ON DELETE RESTRICT ON UPDATE RESTRICT;
ALTER TABLE Contato ADD CONSTRAINT FK_Contato_2
FOREIGN KEY (FK_TipoContato_Id)
REFERENCES TipoContato (Id)
ON DELETE RESTRICT ON UPDATE RESTRICT;
ALTER TABLE Issue ADD CONSTRAINT FK_Issue_1
FOREIGN KEY (FK_Vaga_Id)
REFERENCES Vaga (Id)
ON DELETE RESTRICT ON UPDATE RESTRICT;
ALTER TABLE Issue ADD CONSTRAINT FK_Issue_2
FOREIGN KEY (FK_Repositorio_Id)
REFERENCES Repositorio (Id)
ON DELETE RESTRICT ON UPDATE RESTRICT;
ALTER TABLE Resposta ADD CONSTRAINT FK_Resposta_1
FOREIGN KEY (FK_Desenvolvedor_Id)
REFERENCES Desenvolvedor (Id)
ON DELETE RESTRICT ON UPDATE RESTRICT;
ALTER TABLE Resposta ADD CONSTRAINT FK_Resposta_2
FOREIGN KEY (FK_Vaga_Id)
REFERENCES Vaga (Id)
ON DELETE RESTRICT ON UPDATE RESTRICT;
ALTER TABLE Requisito ADD CONSTRAINT FK_Requisito_1
FOREIGN KEY (FK_Vaga_Id)
REFERENCES Vaga (Id)
ON DELETE RESTRICT ON UPDATE RESTRICT;
ALTER TABLE Requisito ADD CONSTRAINT FK_Requisito_2
FOREIGN KEY (FK_TipoRequisito_Id)
REFERENCES TipoRequisito (Id)
ON DELETE RESTRICT ON UPDATE RESTRICT;
ALTER TABLE Beneficio ADD CONSTRAINT FK_Beneficio_1
FOREIGN KEY (FK_Vaga_Id)
REFERENCES Vaga (Id)
ON DELETE RESTRICT ON UPDATE RESTRICT;
ALTER TABLE Beneficio ADD CONSTRAINT FK_Beneficio_2
FOREIGN KEY (FK_TipoBeneficio_Id)
REFERENCES TipoBeneficio (Id)
ON DELETE RESTRICT ON UPDATE RESTRICT; |
select
p_partkey as part_id,
rank() over (partition by p_partkey order by p_partkey desc) as part_item_rank,
p_name,
p_mfgr,
p_brand,
p_type,
p_size,
p_container,
p_retailprice,
p_comment
from snowflake_sample_data.tpch_sf1.part
|
CREATE TABLE chats(
id SERIAL not null,
content text not null,
room_id integer not null references rooms(id),
user_id integer not null references users(id),
PRIMARY KEY(id)
);
|
--user4
CREATE TABLE tbl_student(
st_no CHAR(3) PRIMARY KEY NOT NULL,
st_name nVARCHAR2(30) NOT NULL,
st_addr nVARCHAR2(50),
st_grade NUMBER(1) NOT NULL,
st_height NUMBER(3),
st_weight NUMBER(3),
st_nick nVARCHAR2(20),
st_nick_rem nVARCHAR2(50),
st_dep_no CHAR(3) NOT NULL
);
SELECT * FROM tbl_student;
CREATE TABLE tbl_dept(
dept_no CHAR(3) PRIMARY KEY NOT NULL,
dept_name nVARCHAR2(50) NOT NULL,
dept_pro nVARCHAR2(50),
dept_te nVARCHAR2(50)
);
SELECT * FROM tbl_dept;
--tbl_student 와 tbl_dept 테이블을 LEFT JOIN해서 리스트를 확인
SELECT * FROM tbl_student;
SELECT * FROM tbl_student,tbl_dept
WHERE st_dep_no = dept_no;
|
-- Out of line, named
CREATE TABLE test
(
id NUMBER,
val VARCHAR2(20),
CONSTRAINTS test_pk PRIMARY KEY (id)
);
-- Out of line, not named
CREATE TABLE test
(
id NUMBER,
val VARCHAR2(20),
PRIMARY KEY (id) -- SYS_C0016459886
);
-- In line
CREATE TABLE test
(
id NUMBER PRIMARY KEY,
val VARCHAR2(20)
);
-- In line, named constraints
CREATE TABLE test
(
id NUMBER CONSTRAINTS test_il_pk PRIMARY KEY,
val VARCHAR2(20) CONSTRAINTS val_nn NOT NULL -- named not null
);
-- CREATION WITH ALTER --
|
SELECT prod_codigo,
prod_detalle,
SUM(i1.item_cantidad) AS egresos_de_stock
FROM producto
JOIN item_factura i1 ON i1.item_producto = prod_codigo
JOIN factura f1 ON f1.fact_tipo = i1.item_tipo
AND f1.fact_sucursal = i1.item_sucursal
AND f1.fact_numero = i1.item_numero
WHERE YEAR ( f1.fact_fecha ) = 2012
GROUP BY prod_codigo,
prod_detalle
HAVING SUM(i1.item_cantidad) > ( SELECT SUM(i2.item_cantidad)
FROM item_factura i2
JOIN factura f2 ON f2.fact_tipo = i2.item_tipo
AND f2.fact_sucursal = i2.item_sucursal
AND f2.fact_numero = i2.item_numero
WHERE YEAR ( f2.fact_fecha ) = 2011
AND i2.item_producto = prod_codigo
GROUP BY i2.item_producto ); |
-- employees3 테이블 (직원 관리)
CREATE SEQUENCE EMP_SEQ START WITH 1 MINVALUE 1 INCREMENT BY 1;
CREATE TABLE employees3 (
emp_id NUMBER(4)
CONSTRAINT employee_id_pk PRIMARY KEY,
emp_name VARCHAR2(10)
CONSTRAINT employee_name_nn NOT NULL,
emp_phone VARCHAR2(13)
CONSTRAINT employee_tel_nn NOT NULL
CONSTRAINT employee_tel_uk UNIQUE
CONSTRAINT employee_tel_reg CHECK ( REGEXP_LIKE ( emp_phone,
'010-\d{4}-\d{4}' ) ),
manager_id NUMBER(4),
emp_age NUMBER(3)
CONSTRAINT employee_age_nn NOT NULL,
hire_date DATE
CONSTRAINT hire_date_nn NOT NULL,
salary NUMBER(8)
CONSTRAINT employee_salary_nn NOT NULL
CONSTRAINT employee_salary_min CHECK ( salary > 0 ),
job_position VARCHAR2(10)
CONSTRAINT job_position_nn NOT NULL,
department_id NUMBER(4)
CONSTRAINT department_id_fk REFERENCES departments3 ( department_id ),
division VARCHAR2(9)
CONSTRAINT employee_division_nn NOT NULL
CONSTRAINT employee_division CHECK ( division IN (
'정규직',
'계약직'
) )
);
-- 조회
SELECT * FROM employees3;
-- 직원 테이블 삭제
DROP TABLE employees3 PURGE;
-- 내용만 삭제
DELETE FROM employees3;
-- departments3 테이블 (부서 관리)
CREATE SEQUENCE DPT_SEQ START WITH 1 MINVALUE 1 INCREMENT BY 1;
CREATE TABLE departments3 (
department_id NUMBER(4)
CONSTRAINT department_id_pk PRIMARY KEY,
department_name VARCHAR2(10)
CONSTRAINT department_name_nn NOT NULL,
manager_id NUMBER(4)
CONSTRAINT manager_id_nn NOT NULL
);
-- 조회
SELECT * FROM departments3;
-- 부서 테이블 삭제
DROP TABLE departments3 PURGE;
-- 내용만 삭제
DELETE FROM departments3;
-- attendance 테이블 (출석 관리)
CREATE TABLE attendance (
check_date VARCHAR2(20)
CONSTRAINT check_date_nn NOT NULL,
check_in_time VARCHAR2(15)
CONSTRAINT check_in_time_nn NOT NULL,
check_out_time VARCHAR2(15),
emp_id NUMBER(4)
CONSTRAINT employee_id_fk
REFERENCES employees3 ( emp_id )
CONSTRAINT empoyee_id_nn NOT NULL,
emp_name VARCHAR2(10)
CONSTRAINT emp_id_nn NOT NULL,
attendance_check VARCHAR2(8)
CONSTRAINT attendance_check_nn NOT NULL
);
-- 조회
SELECT * FROM attendance;
-- 출석 테이블 삭제
DROP TABLE attendance PURGE;
-- 내용만 삭제
DELETE FROM attendance; |
CREATE DATABASE IF NOT EXISTS fprofile_db;
GRANT ALL PRIVILEGES ON fprofile_db.* To 'sqoop'@'localhost' IDENTIFIED BY 'sqoop';
GRANT ALL PRIVILEGES ON fprofile_db.* To 'sqoop'@'%' IDENTIFIED BY 'sqoop';
USE fprofile_db;
DROP TABLE IF EXISTS `profile`;
CREATE TABLE `profile` (
`profile_id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`visitor_id` VARCHAR(100) NOT NULL,
`time` TEXT NULL,
`url` TEXT NULL,
`client_time` TEXT NULL,
`resolution` TEXT NULL,
`browser` TEXT NULL,
`os` TEXT NULL,
`devicetype` TEXT NULL,
`devicemodel` TEXT NULL,
`ipinfo` TEXT NULL,
PRIMARY KEY (`profile_id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
|
INSERT INTO coffees_DID_DN_DS (DID, DN, DS)
SELECT DID, DN, DS
FROM coffees;
INSERT INTO coffees_CID_CN_CM (CID, CN, CM)
SELECT CID, CN, CM
FROM coffees;
INSERT INTO rentals_HZ_HC(HZ, HC)
SELECT HZ, HC
FROM rentals;
INSERT INTO rentals_PID_PN(PID, PN)
SELECT PID, PN
FROM rentals;
INSERT INTO rentals_HID_HZ_HC (HID, HZ,HC)
SELECT HID, HZ,HC
FROM rentals;
INSERT INTO projects_ID_MID_MN(ID, MID, MN)
SELECT ID, MID, MN
FROM projects;
INSERT INTO Projects_PID_PN (PID, PN)
SELECT PID, PN
FROM projects;
INSERT INTO Projects_SID_SN (SID, SN)
SELECT SID, SN
FROM projects;
|
CREATE TABLE `ad` (
`Id` int NOT NULL AUTO_INCREMENT,
`IdPlace` int DEFAULT NULL,
`PictureUrl` varchar(256) DEFAULT NULL,
`Position` int DEFAULT NULL,
`IdActivity` int DEFAULT NULL,
PRIMARY KEY (`Id`),
KEY `IdPlace` (`IdPlace`)
) ENGINE=MyISAM AUTO_INCREMENT=11 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci |
select day, count(name) as "total_assignement"
from assignments
group by day
order by day;
|
-- phpMyAdmin SQL Dump
-- version 4.6.6
-- https://www.phpmyadmin.net/
--
-- Host: localhost
-- Generation Time: 17 Des 2018 pada 12.06
-- Versi Server: 5.7.17-log
-- PHP Version: 5.6.30
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `data_mhs`
--
-- --------------------------------------------------------
--
-- Struktur dari tabel `mhs`
--
CREATE TABLE `mhs` (
`id` int(11) NOT NULL,
`foto` varchar(100) NOT NULL,
`nim` varchar(15) NOT NULL,
`nama` varchar(100) NOT NULL,
`ttl` varchar(100) NOT NULL,
`asal_sma` varchar(100) NOT NULL,
`telp_rumah` varchar(15) NOT NULL,
`no_hp` varchar(15) NOT NULL,
`email` varchar(50) NOT NULL,
`ibu` varchar(50) NOT NULL,
`bapak` varchar(50) NOT NULL,
`no_telp_ortu` varchar(15) NOT NULL,
`alamat` varchar(100) NOT NULL,
`kelurahan` varchar(50) NOT NULL,
`kecamatan` varchar(50) NOT NULL,
`negara` varchar(50) NOT NULL,
`provinsi` varchar(50) NOT NULL,
`kabupaten_kota` varchar(50) NOT NULL,
`kode_pos` varchar(10) NOT NULL,
`email_lain` varchar(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data untuk tabel `mhs`
--
INSERT INTO `mhs` (`id`, `foto`, `nim`, `nama`, `ttl`, `asal_sma`, `telp_rumah`, `no_hp`, `email`, `ibu`, `bapak`, `no_telp_ortu`, `alamat`, `kelurahan`, `kecamatan`, `negara`, `provinsi`, `kabupaten_kota`, `kode_pos`, `email_lain`) VALUES
(1, 'foto-2.jpg', '11160930000200', 'Kizuna', 'dimana mana', 'abc', '34523', '45143636', 'gfdghsdffd@fdhadhad.gdgsg', 'agd', 'asdga', '5243243', 'hafdhdahfhfdhffshdahhaahah afh fah aha ha haa fdwete', 'dsgadd', 'agdgdas', 'agdagsd', 'agdasg', 'agadga', '5252', 'dggasd@dgfga.aG'),
(4, 'salsalbila.jpg', '11160170000071', 'Raden Salsalbila', 'Jakarta, 21 Juni 1998', 'SMAS Daar El Qolam', '021-5919271', '081213342865', 'raden.june@gmail.com', 'Tuti Suhartati', 'Raden Dadang Ruhman', '081316318514', 'Jl. Danau Batur Raya No. 8 RT 004/ RW 007', 'Bencongan', 'Kelapa Dua', 'Indonesia', 'Banten', 'Tangerang', '15811', 'raden.salsalbila16@mhs.uinjkt.ac.id'),
(5, 'izza.jpg', '11160170000048', 'Izzatul Jannah', 'Tangerang, 14 April 1998', 'SMA DAAR EL QOLAM', '', '087830121965', 'izzaatul.jannah@gmail.com', 'Andrawati', 'Pardi Lahit', '081389341135', 'Perum Teratai Griya Asri, Blok G3 No. 37', 'Legok', 'Legok', 'Indonesia', 'Banten', 'Tangerang', '15820', ''),
(6, 'fira.jpg', '11160170000050', 'Maghfira Izani Maulani', 'Tangerang, 13 Februari 1998', 'SMAN 33 Jakarta', '-', '081804099571', 'maghfiraizanimaulani13@gmail.com', 'Sri Haryati', 'Haripomo', '0818844182', 'Komplek KFT Blok A10 No.16', 'Cengkareng Barat', 'Cengkareng', 'Indonesia', 'DKI Jakarta', ' Jakarta Barat', '', ''),
(7, 'isnaini.jpg', '11160170000044', 'Isnaini Rizqi Br Butar Butar', ' Pematang Sapat,15 Desember 1997', 'SMAN 3 MUARA BUNGO', '', '082129089094', 'Isnainirizqi@rocketmail.com', 'Lanna Sari Nasution', 'Rizqi Isrin Butar Butar', '', 'komplek perumahan PTPN VI PKS RIMDU JAMBI', 'Karang Dadi', 'Rimbo Ilir', 'Indonesia', 'Jambi', 'Tebo', '', ''),
(8, 'dewi.jpg', '11160170000072', 'Dewi Haryani', 'Jakarta, 11-12-97', 'SMAN 4 Tangerang Selatan', '', '08978283546', 'dewi1997yani@gmail.com', 'Utih', 'Usup', '', 'Jl. Nuri Atas', 'Rengas', 'Ciputat Timur', 'Indonesia', 'Banten', 'Tangerang Selatan', '15412', ''),
(9, 'nav_home-icon2.png', '11160170000043', 'Annisa Fira Nindy Amalia', 'Jakarta, 5 Agustus 1998', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''),
(10, 'search-icon.png', '11160170000049', 'Adilah Nida Rinjani', 'Depok, 17 Maret 1998', 'SMAN 2 Cirebon', '', '087780469451', 'adilahnidarinjani@gmail.com', 'Nurul', 'Hary', '', 'Jl. Al Ikhlas', 'Cempaka Putih', 'Ciputat Timur', 'Indonesia', 'Banten', 'Tangerang Selatan', '15124', ''),
(11, 'kusna.jpg', '11160170000066', 'Muhammad Khusna Khabaib', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''),
(12, 'nav_acc-icon2.png', '11160170000057', 'Daesita Maulida', 'Jakarta, 01 Desember 1997', 'MAN 19 Jakarta', '', '087875067040', 'daesita.maulida@gmail.com', 'Yuliah', 'Hapas A.M', '', 'Jl. H. Daiman gg. hrisin no 56', 'Kreo Selatan', 'Larang', 'Indonesia', 'Banten', 'Tangerang', '15156', ''),
(13, 'dian mei.jpg', '11160170000075', 'Dian Meiliawati', 'Tangerang, 2 Mei 1998', 'SMAN 12 TANGSEL', '', '085959682785', 'dianmeilia31@gmail.com', 'Supriati', 'Gino Subari', '081381422188', 'Gang Salem II. RT 04 RW 01. No : 95', 'Serpong', 'Serpong', 'Indonesia', 'Banten', 'Tangerang Selatan', '15310', ''),
(14, 'jun.jpg', '11160170000073', 'Jundullah Wangsa Humaka', 'Serang, 3 Juni 1997', ' MA Persis Tarogong', '', '089524643681', 'encemancuniansejati@gmail.com', 'Lilis Lisawati', 'Saepul Anwar', '081320097769', 'komplek pilar biru, jln.pilar utara1 no.25', 'Cibiru Hilir', 'Cileunyi', 'Indonesia', 'Jawa Barat', 'Kab. Bandung', '', ''),
(15, 'fenny.jpg', '11160170000059', 'Fenny Rachmawati', 'Bekasi, 8 Oktober 1998', 'SMAN 2 Tambun Selatan', '', '089638355798', 'fennyrachmawati08@gmail.com', 'Siti Nurkhaenih', 'Triyanto', '0812-8219-0087', 'Mahkota Indah Blok GC 4 No 6 RT 003/RW 030', 'Mangun Jaya', 'Tambun Selatan ', 'Indonesia', 'Jawa Barat', 'Bekasi', '17510', ''),
(16, 'novia.jpg', '11160170000061', 'Novia Zahrotul Wihda ', 'Jakarta, 08 November 1997 ', 'MAN SERPONG ', '', '085773128398 ', 'zahrotulwihda@gmail.com ', 'Satiyah', 'Suwanta ', '081296457675', 'Jl. merpati Raya No.10 RT 03/01', 'Sawah', 'Ciputat ', 'Indonesia', 'Banten ', 'Tangerang Selatan ', '15413', ''),
(17, 'DSC_8814.JPG', '11160170000051', 'Nida Fauziah', 'Jakarta, 22 Desember 1997', 'SMAN 63 Jakarta', '021 7373822', '089604247973', 'nidaf942@gmail.com', 'umi muhdiyati', 'muji slamet', '081585130878', 'jalan menjangan 3 rt 003 rw 003', 'pondok ranji', 'ciputat timur', 'indonesia', 'Banten', 'Kota Tangerang', '15412', 'nida.fauziah16@uinjkt.ac.id'),
(18, 'DSC_0009.JPG', '11160170000047', 'Ahmad Firdaus', '22 September 1998', 'SMAN 11 Tangsel', '', '08121996593', 'firdauskun590@gmail.com', 'Rohida', 'Tukino', '', 'Kp. poncol RT 01/011', 'Lengkong Wetan', 'Serpong', 'indonesia', 'Banten', 'Tangerang Selatan', '15322', ''),
(19, 'nav_home-icon2.png', '11160170000053', 'Khairul Umam', 'Serang, 25 Agustus 1998', 'SMK N 1 CILEGON', '', '089604711676', 'khairulumamm25@gmail.com', 'Hj. Nursyamsiar', 'Drs. H. Harun Al-Rasyid', '085922281249', 'Jl. Gurame Tengah no.142 Bambu Apus, Pamulang', 'Bambu Apus', 'Pamulang', 'Indonesia', 'Banten', 'Tangerang Selatan', '15415', ''),
(20, 'nav_home-icon2.png', '11160170000058', 'Yanita Amalia Safitri', 'Tulungagung, 26 Januari 1998', 'SMAN 2 Tambun Selatan', '', '081284101460', 'yanitamalia.s@gmail.com', 'Sri Mulyati', 'Surono', ' 081316715378', 'Jl. Durian 3 No.19', 'Wanasari', 'Cibitung', 'Indonesia', 'Jawa Barat', 'Kab. Bekasi', '17521', 'yanitamalia@gmail.com');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `mhs`
--
ALTER TABLE `mhs`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `mhs`
--
ALTER TABLE `mhs`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=21;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
-- phpMyAdmin SQL Dump
-- version 4.7.9
-- https://www.phpmyadmin.net/
--
-- Hôte : 127.0.0.1
-- Généré le : mer. 06 juin 2018 à 15:16
-- Version du serveur : 10.1.31-MariaDB
-- Version de PHP : 7.2.3
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 données : `cip`
--
DELIMITER $$
--
-- Fonctions
--
CREATE DEFINER=`root`@`localhost` FUNCTION `setSMRT` () RETURNS INT(11) NO SQL
DETERMINISTIC
RETURN @vSMRT$$
DELIMITER ;
-- --------------------------------------------------------
--
-- Structure de la table `cip`
--
CREATE TABLE `cip` (
`numero` int(11) NOT NULL,
`description` varchar(255) NOT NULL,
`natureGain` int(11) NOT NULL,
`valeurGain` float NOT NULL,
`points` int(11) NOT NULL,
`prime` double NOT NULL,
`date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`etat` varchar(255) NOT NULL DEFAULT 'encours',
`controlling` int(11) NOT NULL DEFAULT '2'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Déchargement des données de la table `cip`
--
INSERT INTO `cip` (`numero`, `description`, `natureGain`, `valeurGain`, `points`, `prime`, `date`, `etat`, `controlling`) VALUES
(1, 'this is the description of cip numero 1', 3, 0, 0, 0, '2018-06-06 01:20:46', 'encours', 2),
(2, 'this is the description of cip numero 2', 8, 0, 0, 0, '2018-06-06 01:22:17', 'encours', 9),
(3, 'this is the description of cip numero 3', 1, 0, 0, 0, '2018-06-06 01:22:29', 'encours', 11),
(4, 'this is the description of cip numero 4', 2, 0, 0, 0, '2018-06-06 01:22:53', 'encours', 2),
(5, 'this is the description of cip numero 5', 4, 0, 0, 0, '2018-06-06 01:23:11', 'encours', 2),
(6, 'this is the description of cip numero 6', 1, 0, 0, 0, '2018-06-06 01:23:31', 'encours', 11),
(7, 'this is the description of cip numero 7', 3, 0, 0, 0, '2018-06-06 01:23:50', 'encours', 2),
(8, 'this is the description of cip numero 8', 8, 0, 0, 0, '2018-06-06 01:24:04', 'encours', 9);
-- --------------------------------------------------------
--
-- Structure de la table `cip_user`
--
CREATE TABLE `cip_user` (
`id` int(11) NOT NULL,
`numcip` int(11) NOT NULL,
`iduser` int(11) NOT NULL,
`date_affectation` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Déchargement des données de la table `cip_user`
--
INSERT INTO `cip_user` (`id`, `numcip`, `iduser`, `date_affectation`) VALUES
(1, 1, 3, '2018-06-06 09:20:38'),
(2, 1, 4, '2018-06-06 09:21:00'),
(3, 1, 5, '2018-06-06 09:21:09'),
(4, 2, 3, '2018-06-06 09:21:14'),
(5, 3, 4, '2018-06-06 09:21:20'),
(6, 3, 5, '2018-06-06 09:21:22'),
(7, 4, 3, '2018-06-06 09:21:31'),
(8, 4, 5, '2018-06-06 09:21:35'),
(9, 5, 2, '2018-06-06 09:21:43'),
(10, 6, 3, '2018-06-06 09:22:14'),
(11, 6, 5, '2018-06-06 09:22:19'),
(12, 7, 3, '2018-06-06 09:22:24'),
(13, 8, 7, '2018-06-06 09:22:31'),
(14, 8, 4, '2018-06-06 09:22:35');
-- --------------------------------------------------------
--
-- Structure de la table `departement`
--
CREATE TABLE `departement` (
`id` int(11) NOT NULL,
`serviceName` varchar(255) NOT NULL,
`SMRT` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Déchargement des données de la table `departement`
--
INSERT INTO `departement` (`id`, `serviceName`, `SMRT`) VALUES
(1, 'HR', '13'),
(2, 'PPE-CC', '14'),
(3, 'Direction Quality', '15'),
(4, 'Supply Chain', '16'),
(6, 'Audi', '17'),
(7, 'IM', '18'),
(8, 'LPS plus', '8'),
(9, 'MMC', ''),
(10, 'Managing Director', ''),
(11, 'VW', ''),
(12, 'AC(Asian Customer)', ''),
(13, 'Sys App LTN1', ''),
(14, 'Commercial Managing Direction', ''),
(15, 'Shared Service Hub', ''),
(16, 'General Administration', ''),
(17, 'KSK Project MEB', ''),
(18, 'Autarks MEB', '');
-- --------------------------------------------------------
--
-- Structure de la table `gain`
--
CREATE TABLE `gain` (
`id` int(11) NOT NULL,
`natureGain` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Déchargement des données de la table `gain`
--
INSERT INTO `gain` (`id`, `natureGain`) VALUES
(1, 'MOD'),
(2, 'Matière'),
(3, 'Invest.'),
(4, 'Conso.'),
(5, 'Transp.'),
(6, 'Qualité'),
(7, 'Déchet'),
(8, 'Autres');
-- --------------------------------------------------------
--
-- Structure de la table `user`
--
CREATE TABLE `user` (
`matricule` int(11) NOT NULL,
`nom` varchar(255) NOT NULL,
`prenom` varchar(255) NOT NULL,
`service` int(11) NOT NULL,
`points` int(11) NOT NULL,
`statut` varchar(255) NOT NULL,
`email` varchar(255) NOT NULL,
`password` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Déchargement des données de la table `user`
--
INSERT INTO `user` (`matricule`, `nom`, `prenom`, `service`, `points`, `statut`, `email`, `password`) VALUES
(1, 'KACEM', 'farouk', 1, 0, 'admin', 'farouk.kcm95@gmail.com', 'toto'),
(2, 'BEDOUI', 'rami', 7, 0, 'controlling', 'rami_bedoui@gmail.com', 'toto'),
(3, 'JMAL', 'ammar', 8, 0, 'user', 'ammarjmel06@gmail.com', 'toto'),
(4, 'BOUZID', 'noureddine', 7, 0, 'user', 'nouredine07@gmail.com', 'toto'),
(5, 'ATTIA', 'aycha', 4, 0, 'user', 'attia92@gmail.com', 'toto'),
(8, 'FEHRI', 'sami', 8, 0, 'SMRT', 'sami_fehri@gmail.com', 'toto'),
(9, 'WERTANI', 'nawfel', 3, 0, 'controlling', 'wertani99@gmail.com', 'toto'),
(10, 'MSAKNI', 'youssef', 12, 0, 'headOfControlling', 'youssef95@gmail.com', 'toto'),
(11, 'SLITI', 'naim', 11, 0, 'controlling', 'sliti01@gmail.com', 'toto'),
(12, 'BALBOULI', 'aymen', 15, 0, 'DF', 'balbouli_ess@gmail.com', 'toto'),
(13, 'BEN CHRIFIA', 'MOAZ', 1, 0, 'SMRT', 'moaz@gmail.com', 'toto'),
(14, 'LKAABI', 'Smir', 2, 0, 'SMRT', 'Samir@gmai.com', 'toto'),
(15, 'WERTANI', 'Nawfel', 3, 0, 'SMRT', 'nawfel@gmail.com', 'toto'),
(16, 'KHAZRI', 'Wahbi', 4, 0, 'SMRT', 'wahbi@hotmail.fr', 'toto'),
(17, 'VILLA', 'david', 6, 0, 'SMRT', 'david@gmail.com', 'toto'),
(18, 'LIONEL', 'Messi', 7, 0, 'SMRT', 'lionel@gmail.com', 'tuto');
-- --------------------------------------------------------
--
-- Doublure de structure pour la vue `user_by_smrt`
-- (Voir ci-dessous la vue réelle)
--
CREATE TABLE `user_by_smrt` (
`matricule` int(11)
,`nom` varchar(255)
,`prenom` varchar(255)
,`service` int(11)
,`points` int(11)
,`statut` varchar(255)
,`email` varchar(255)
,`password` varchar(255)
,`id` int(11)
,`serviceName` varchar(255)
,`SMRT` varchar(255)
);
-- --------------------------------------------------------
--
-- Structure de la vue `user_by_smrt`
--
DROP TABLE IF EXISTS `user_by_smrt`;
CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `user_by_smrt` AS select `user`.`matricule` AS `matricule`,`user`.`nom` AS `nom`,`user`.`prenom` AS `prenom`,`user`.`service` AS `service`,`user`.`points` AS `points`,`user`.`statut` AS `statut`,`user`.`email` AS `email`,`user`.`password` AS `password`,`departement`.`id` AS `id`,`departement`.`serviceName` AS `serviceName`,`departement`.`SMRT` AS `SMRT` from (`user` join `departement` on((`user`.`service` = `departement`.`id`))) where (`user`.`service` = (select `departement`.`id` from `departement` where (`departement`.`SMRT` = `setSMRT`()))) ;
--
-- Index pour les tables déchargées
--
--
-- Index pour la table `cip`
--
ALTER TABLE `cip`
ADD PRIMARY KEY (`numero`),
ADD KEY `natureGain` (`natureGain`);
--
-- Index pour la table `cip_user`
--
ALTER TABLE `cip_user`
ADD PRIMARY KEY (`id`);
--
-- Index pour la table `departement`
--
ALTER TABLE `departement`
ADD PRIMARY KEY (`id`);
--
-- Index pour la table `gain`
--
ALTER TABLE `gain`
ADD PRIMARY KEY (`id`);
--
-- Index pour la table `user`
--
ALTER TABLE `user`
ADD PRIMARY KEY (`matricule`),
ADD KEY `service` (`service`);
--
-- AUTO_INCREMENT pour les tables déchargées
--
--
-- AUTO_INCREMENT pour la table `cip`
--
ALTER TABLE `cip`
MODIFY `numero` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;
--
-- AUTO_INCREMENT pour la table `cip_user`
--
ALTER TABLE `cip_user`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=16;
--
-- AUTO_INCREMENT pour la table `departement`
--
ALTER TABLE `departement`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=46;
--
-- AUTO_INCREMENT pour la table `gain`
--
ALTER TABLE `gain`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;
--
-- AUTO_INCREMENT pour la table `user`
--
ALTER TABLE `user`
MODIFY `matricule` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=23;
--
-- Contraintes pour les tables déchargées
--
--
-- Contraintes pour la table `user`
--
ALTER TABLE `user`
ADD CONSTRAINT `service` FOREIGN KEY (`service`) REFERENCES `departement` (`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 */;
|
CREATE DATABASE IF NOT EXISTS `my_database`; |
Positive variables
VGETOH_CAP1(YYY,AAA,MMM) 'Endogenous max production level for ETOH used to calculate demand charge'
VGETOH_CAP2(YYY,AAA,MMM) 'Endogenous max production level for ETOH used to calculate demand charge'
VGETOH_CAPY(YYY,AAA) 'Endogenous max production level for ETOH used to calculate yearly demand charge'
;
|
-- phpMyAdmin SQL Dump
-- version 4.8.3
-- https://www.phpmyadmin.net/
--
-- Servidor: 127.0.0.1
-- Tiempo de generación: 14-11-2019 a las 23:07:33
-- Versión del servidor: 10.1.36-MariaDB
-- Versión de PHP: 7.2.10
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: `hotel`
--
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `agents`
--
CREATE TABLE `agents` (
`id` int(11) NOT NULL,
`user` varchar(100) COLLATE utf8_spanish_ci DEFAULT NULL,
`pass` varchar(100) COLLATE utf8_spanish_ci DEFAULT NULL,
`token` text COLLATE utf8_spanish_ci,
`name` varchar(100) COLLATE utf8_spanish_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci;
--
-- Volcado de datos para la tabla `agents`
--
INSERT INTO `agents` (`id`, `user`, `pass`, `token`, `name`) VALUES
(1, 'brian', '12345', 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJsb2dpbkRhdGEiOnsidXNlciI6ImJyaWFuIiwicGFzcyI6IjEyMzQ1In0sImlhdCI6MTU3MzczMzg3MX0.92otqOCZzEdXYnF4SzR_g9xw_1ofTfEcqSgWReqvf-M', 'Brian R');
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `city`
--
CREATE TABLE `city` (
`id` int(11) NOT NULL,
`name` varchar(150) COLLATE utf8_spanish_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci;
--
-- Volcado de datos para la tabla `city`
--
INSERT INTO `city` (`id`, `name`) VALUES
(1, 'Medellin'),
(2, 'Bogota'),
(3, 'Cali'),
(4, 'Barranquilla'),
(5, 'Cartagena');
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `contact`
--
CREATE TABLE `contact` (
`id` int(11) NOT NULL,
`name` varchar(150) COLLATE utf8_spanish_ci DEFAULT NULL,
`phone` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci;
--
-- Volcado de datos para la tabla `contact`
--
INSERT INTO `contact` (`id`, `name`, `phone`) VALUES
(1, 'Contact uno', 1111111111),
(2, 'Contact dos', 2147483647),
(3, 'Contact tres', 2147483647),
(4, 'Contact cuatro', 2147483647),
(5, 'Contact cinco', 2147483647),
(6, 'Contact seis', 2147483647),
(7, 'Contact siete', 2147483647),
(8, 'Contact ocho', 2147483647),
(9, 'Contact nueve', 2147483647),
(10, 'Contact diez', 1010101010),
(11, 'bartolome', 0),
(12, 'yayaya', 12345),
(13, 'yayaya', 12345),
(14, 'papapa', 321),
(15, 'papapa', 321),
(16, 'asd', 0),
(17, 'vbnvbn', 456456),
(18, 'vbnvbn', 456456),
(19, 'asd', 0),
(20, 'asd', 0),
(21, 'asd', 0),
(22, 'tyu', 987),
(23, 'tyu', 987),
(24, 'asd', 0),
(25, 'qwe', 98),
(26, 'qwe', 98),
(27, 'william', 2147483647),
(28, 'asd', 5198198),
(29, 'asd', 7849515),
(30, 'asd', 5198198),
(31, 'asd', 7849515),
(32, 'william', 2147483647),
(33, '456456', 456456),
(34, 'papaye 2', 466787);
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `gender`
--
CREATE TABLE `gender` (
`id` int(11) NOT NULL,
`name` varchar(20) COLLATE utf8_spanish_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci;
--
-- Volcado de datos para la tabla `gender`
--
INSERT INTO `gender` (`id`, `name`) VALUES
(1, 'Masculino'),
(2, 'Femenino');
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `hotels`
--
CREATE TABLE `hotels` (
`id` int(11) NOT NULL,
`name` varchar(150) COLLATE utf8_spanish_ci DEFAULT NULL,
`state` int(1) DEFAULT '1'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci;
--
-- Volcado de datos para la tabla `hotels`
--
INSERT INTO `hotels` (`id`, `name`, `state`) VALUES
(1, 'Hotel 1', 1),
(2, 'Hotel 2', 1),
(3, 'Hotel 3', 1),
(4, 'Hotel 4', 1),
(5, 'Hotel 5', 1),
(6, 'Hotel 6', 1),
(7, 'Hotel 7', 0),
(8, 'Hotel 8', 1),
(9, 'Hotel 9', 0),
(10, 'Hotel 10', 1),
(11, 'hotel 11', 0);
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `hotel_room`
--
CREATE TABLE `hotel_room` (
`id` int(11) NOT NULL,
`id_hotel` int(11) DEFAULT NULL,
`id_room` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci;
--
-- Volcado de datos para la tabla `hotel_room`
--
INSERT INTO `hotel_room` (`id`, `id_hotel`, `id_room`) VALUES
(6, 2, 6),
(7, 2, 7),
(8, 2, 8),
(9, 2, 9),
(10, 2, 10),
(11, 3, 1),
(12, 3, 2),
(13, 3, 3),
(14, 3, 4),
(15, 3, 5),
(16, 4, 6),
(17, 4, 7),
(18, 4, 8),
(19, 4, 9),
(20, 4, 10),
(21, 5, 1),
(22, 5, 2),
(23, 5, 3),
(24, 5, 4),
(25, 5, 5),
(26, 6, 6),
(27, 6, 7),
(28, 6, 8),
(29, 6, 9),
(30, 6, 10),
(113, 1, 1),
(114, 1, 3),
(115, 1, 5),
(116, 1, 7),
(117, 1, 9),
(118, 9, 1),
(119, 9, 2),
(120, 9, 3);
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `reservations`
--
CREATE TABLE `reservations` (
`id` int(11) NOT NULL,
`date_create` date DEFAULT NULL,
`date_start` date DEFAULT NULL,
`date_end` date DEFAULT NULL,
`people` int(11) DEFAULT NULL,
`id_city` int(11) DEFAULT NULL,
`id_hotel_room` int(11) DEFAULT NULL,
`id_contact` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci;
--
-- Volcado de datos para la tabla `reservations`
--
INSERT INTO `reservations` (`id`, `date_create`, `date_start`, `date_end`, `people`, `id_city`, `id_hotel_room`, `id_contact`) VALUES
(4, '2019-11-12', '2019-11-11', '2019-12-21', 10, 1, 6, 1),
(5, '2019-11-12', '2019-11-12', '2019-12-22', 20, 2, 7, 2),
(6, '2019-11-12', '2019-11-13', '2019-12-23', 30, 3, 8, 3),
(7, '2019-11-12', '2019-11-14', '2019-12-24', 40, 4, 9, 4),
(8, '2019-11-12', '2019-11-15', '2019-12-25', 50, 5, 10, 5),
(9, '2019-11-12', '2019-11-16', '2019-12-26', 60, 1, 11, 6),
(10, '2019-11-12', '2019-11-17', '2019-12-27', 70, 2, 12, 7),
(11, '2019-11-12', '2019-11-18', '2019-12-28', 80, 3, 13, 8),
(12, '2019-11-12', '2019-11-19', '2019-12-29', 90, 4, 14, 9),
(13, '2019-11-12', '2019-11-10', '2019-12-10', 5, 5, 15, 10),
(14, '2019-11-12', '2019-11-11', '2019-12-21', 10, 1, 16, 1),
(15, '2019-11-12', '2019-11-12', '2019-12-22', 20, 2, 17, 2),
(16, '2019-11-12', '2019-11-13', '2019-12-23', 30, 3, 18, 3),
(17, '2019-11-12', '2019-11-14', '2019-12-24', 40, 4, 19, 4),
(18, '2019-11-12', '2019-11-15', '2019-12-25', 50, 5, 20, 5),
(19, '2019-11-12', '2019-11-16', '2019-12-26', 60, 1, 21, 6),
(20, '2019-11-12', '2019-11-17', '2019-12-27', 70, 2, 22, 7),
(21, '2019-11-12', '2019-11-18', '2019-12-28', 80, 3, 23, 8),
(22, '2019-11-12', '2019-11-19', '2019-12-29', 90, 4, 24, 9),
(23, '2019-11-12', '2019-11-10', '2019-12-10', 5, 5, 25, 10),
(25, '2019-11-14', '2019-11-14', '2019-11-14', 1, 1, 118, 25),
(26, '2019-11-14', '2019-11-14', '2019-11-14', 1, 1, 118, 26),
(27, '2019-11-14', '2019-11-14', '2019-11-14', 3, 1, 16, 29),
(28, '2019-11-14', '2019-11-14', '2019-11-14', 3, 1, 16, 29),
(29, '2019-11-14', '2019-11-14', '2019-11-14', 3, 1, 16, 29),
(30, '2019-11-14', '2019-11-14', '2019-11-14', 3, 1, 16, 32),
(31, '2019-11-14', '2019-11-14', '2019-11-14', 3, 1, 16, 32),
(32, '2019-11-14', '2019-11-14', '2019-11-14', 3, 1, 16, 32),
(33, '2019-11-14', '2019-11-14', '2019-11-14', 2, 1, 113, 34),
(34, '2019-11-14', '2019-11-14', '2019-11-14', 2, 1, 113, 34);
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `reservation_detail`
--
CREATE TABLE `reservation_detail` (
`id` int(11) NOT NULL,
`name` varchar(150) COLLATE utf8_spanish_ci DEFAULT NULL,
`last_name` varchar(150) COLLATE utf8_spanish_ci DEFAULT NULL,
`birth` date DEFAULT NULL,
`id_gender` int(11) DEFAULT NULL,
`number_doc` varchar(20) COLLATE utf8_spanish_ci DEFAULT NULL,
`email` varchar(100) COLLATE utf8_spanish_ci DEFAULT NULL,
`phone` int(11) DEFAULT NULL,
`id_reservation` int(11) DEFAULT NULL,
`id_type_doc` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci;
--
-- Volcado de datos para la tabla `reservation_detail`
--
INSERT INTO `reservation_detail` (`id`, `name`, `last_name`, `birth`, `id_gender`, `number_doc`, `email`, `phone`, `id_reservation`, `id_type_doc`) VALUES
(1, 'pepito 1', 'perez 1', '1995-10-16', 1, '1047971220', 'email.prueba@gmail.com', 2147483647, 4, 1),
(2, 'pepito 2', 'perez 2', '1992-10-16', 2, '2222222222', 'email.prueba@gmail.com', 2147483647, 5, 2),
(3, 'pepito 3', 'perez 3', '1993-10-16', 1, '3333333333', 'email.prueba@gmail.com', 2147483647, 6, 3),
(4, 'pepito 4', 'perez 4', '1994-10-16', 2, '4444444444', 'email.prueba@gmail.com', 2147483647, 7, 1),
(5, 'pepito 5', 'perez 5', '1995-10-16', 1, '5555555555', 'email.prueba@gmail.com', 2147483647, 8, 2),
(6, 'pepito 6', 'perez 6', '1996-10-16', 2, '6666666666', 'email.prueba@gmail.com', 2147483647, 9, 3),
(7, 'pepito 7', 'perez 7', '1997-10-16', 1, '7777777777', 'email.prueba@gmail.com', 2147483647, 10, 1),
(8, 'pepito 8', 'perez 8', '1998-10-16', 2, '8888888888', 'email.prueba@gmail.com', 2147483647, 11, 2),
(9, 'pepito 9', 'perez 9', '1999-10-16', 1, '9999999999', 'email.prueba@gmail.com', 2147483647, 12, 3),
(10, 'pepito 10', 'perez 10', '0000-00-00', 2, '1010101010', 'email.prueba@gmail.com', 2147483647, 13, 1),
(11, 'pepito 2', 'perez 2', '1992-10-16', 1, '2222222222', 'email.prueba@gmail.com', 2147483647, 5, 2),
(12, 'pepito 3', 'perez 3', '1993-10-16', 1, '3333333333', 'email.prueba@gmail.com', 2147483647, 6, 3),
(13, 'pepito 4', 'perez 4', '1994-10-16', 1, '4444444444', 'email.prueba@gmail.com', 2147483647, 7, 1),
(14, 'pepito 5', 'perez 5', '1995-10-16', 1, '5555555555', 'email.prueba@gmail.com', 2147483647, 8, 2),
(15, 'pepito 6', 'perez 6', '1996-10-16', 1, '6666666666', 'email.prueba@gmail.com', 2147483647, 9, 3),
(16, 'pepito 7', 'perez 7', '1997-10-16', 1, '7777777777', 'email.prueba@gmail.com', 2147483647, 10, 1),
(17, 'pepito 8', 'perez 8', '1998-10-16', 1, '8888888888', 'email.prueba@gmail.com', 2147483647, 11, 2),
(18, 'pepito 9', 'perez 9', '1999-10-16', 1, '9999999999', 'email.prueba@gmail.com', 2147483647, 12, 3),
(19, 'pepito 10', 'perez 10', '0000-00-00', 1, '1010101010', 'email.prueba@gmail.com', 2147483647, 13, 1),
(20, 'pepito 2', 'perez 2', '1992-10-16', 2, '2222222222', 'email.prueba@gmail.com', 2147483647, 5, 2),
(21, 'pepito 3', 'perez 3', '1993-10-16', 2, '3333333333', 'email.prueba@gmail.com', 2147483647, 6, 3),
(22, 'pepito 4', 'perez 4', '1994-10-16', 2, '4444444444', 'email.prueba@gmail.com', 2147483647, 7, 1),
(23, 'pepito 5', 'perez 5', '1995-10-16', 2, '5555555555', 'email.prueba@gmail.com', 2147483647, 8, 2),
(24, 'pepito 6', 'perez 6', '1996-10-16', 2, '6666666666', 'email.prueba@gmail.com', 2147483647, 9, 3),
(25, 'pepito 7', 'perez 7', '1997-10-16', 2, '7777777777', 'email.prueba@gmail.com', 2147483647, 10, 1),
(26, 'pepito 8', 'perez 8', '1998-10-16', 2, '8888888888', 'email.prueba@gmail.com', 2147483647, 11, 2),
(27, 'pepito 9', 'perez 9', '1999-10-16', 2, '9999999999', 'email.prueba@gmail.com', 2147483647, 12, 3),
(28, 'pepito 10', 'perez 10', '0000-00-00', 2, '1010101010', 'email.prueba@gmail.com', 2147483647, 13, 1),
(29, 'asdsadasdsad', 'asdasdadasdasd', '2019-11-01', 2, '6216159', 'asd', 59951, 32, 1),
(30, 'asd', 'asd', '2019-11-15', 2, '4569871', 'asd', 25631478, 32, 2),
(31, 'brian', 'brian', '2019-11-01', 1, '1047971220', 'brian@brian.com', 2147483647, 32, 1),
(32, 'papaya', 'papaya', '2019-11-01', 2, '45456', '456456', 456456, 34, 1),
(33, 'papaye', 'papaye', '2019-11-08', 2, '5416516', 'papaye', 45358, 34, 1);
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `rooms`
--
CREATE TABLE `rooms` (
`id` int(11) NOT NULL,
`name` varchar(100) COLLATE utf8_spanish_ci DEFAULT NULL,
`cost` int(11) DEFAULT '0',
`tax` int(11) DEFAULT '0',
`location` int(11) DEFAULT NULL,
`state` int(11) DEFAULT '1',
`id_type` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci;
--
-- Volcado de datos para la tabla `rooms`
--
INSERT INTO `rooms` (`id`, `name`, `cost`, `tax`, `location`, `state`, `id_type`) VALUES
(1, 'Habitaciòn 1', 1000, 19, 1, 1, 4),
(2, 'Habitaciòn 222', 222, 222, 2, 0, 4),
(3, 'Habitaciòn 3', 3000, 19, 3, 1, 3),
(4, 'Habitaciòn 4', 4000, 19, 4, 1, 4),
(5, 'Habitaciòn 5', 5000, 19, 5, 1, 1),
(6, 'Habitaciòn 6', 6000, 19, 1, 1, 2),
(7, 'Habitaciòn 7', 7000, 19, 2, 1, 3),
(8, 'Habitaciòn 8', 8000, 19, 3, 1, 4),
(9, 'Habitaciòn 9', 9000, 19, 4, 1, 1),
(10, 'Habitaciòn 10', 10000, 19, 5, 1, 2),
(11, '123', 123, 123, 1, 1, 4),
(12, '11111', 11111, 11111, 2, 1, 2),
(13, 'bars', 1000, 5, 3, 1, 3),
(14, 'barsta', 5000, 5, 3, 1, 3);
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `types`
--
CREATE TABLE `types` (
`id` int(11) NOT NULL,
`name` varchar(50) COLLATE utf8_spanish_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci;
--
-- Volcado de datos para la tabla `types`
--
INSERT INTO `types` (`id`, `name`) VALUES
(1, 'Sencilla'),
(2, 'Normal'),
(3, 'Doble'),
(4, 'Grupal');
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `type_doc`
--
CREATE TABLE `type_doc` (
`id` int(11) NOT NULL,
`name` varchar(100) COLLATE utf8_spanish_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci;
--
-- Volcado de datos para la tabla `type_doc`
--
INSERT INTO `type_doc` (`id`, `name`) VALUES
(1, 'Cedula de ciudadania'),
(2, 'Cedula de extranjeria'),
(3, 'Tarjeta de identidad');
--
-- Índices para tablas volcadas
--
--
-- Indices de la tabla `agents`
--
ALTER TABLE `agents`
ADD PRIMARY KEY (`id`);
--
-- Indices de la tabla `city`
--
ALTER TABLE `city`
ADD PRIMARY KEY (`id`);
--
-- Indices de la tabla `contact`
--
ALTER TABLE `contact`
ADD PRIMARY KEY (`id`);
--
-- Indices de la tabla `gender`
--
ALTER TABLE `gender`
ADD PRIMARY KEY (`id`);
--
-- Indices de la tabla `hotels`
--
ALTER TABLE `hotels`
ADD PRIMARY KEY (`id`);
--
-- Indices de la tabla `hotel_room`
--
ALTER TABLE `hotel_room`
ADD PRIMARY KEY (`id`),
ADD KEY `fk_hotel` (`id_hotel`),
ADD KEY `fk_room` (`id_room`);
--
-- Indices de la tabla `reservations`
--
ALTER TABLE `reservations`
ADD PRIMARY KEY (`id`),
ADD KEY `fk_id_city` (`id_city`),
ADD KEY `fk_id_contact` (`id_contact`),
ADD KEY `fk_id_hotel_room` (`id_hotel_room`);
--
-- Indices de la tabla `reservation_detail`
--
ALTER TABLE `reservation_detail`
ADD PRIMARY KEY (`id`),
ADD KEY `fk_id_type_doc` (`id_type_doc`),
ADD KEY `fk_id_reservation` (`id_reservation`);
--
-- Indices de la tabla `rooms`
--
ALTER TABLE `rooms`
ADD PRIMARY KEY (`id`),
ADD KEY `fk_type` (`id_type`),
ADD KEY `fk_location` (`location`);
--
-- Indices de la tabla `types`
--
ALTER TABLE `types`
ADD PRIMARY KEY (`id`);
--
-- Indices de la tabla `type_doc`
--
ALTER TABLE `type_doc`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT de las tablas volcadas
--
--
-- AUTO_INCREMENT de la tabla `agents`
--
ALTER TABLE `agents`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT de la tabla `city`
--
ALTER TABLE `city`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
--
-- AUTO_INCREMENT de la tabla `contact`
--
ALTER TABLE `contact`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=35;
--
-- AUTO_INCREMENT de la tabla `gender`
--
ALTER TABLE `gender`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT de la tabla `hotels`
--
ALTER TABLE `hotels`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12;
--
-- AUTO_INCREMENT de la tabla `hotel_room`
--
ALTER TABLE `hotel_room`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=121;
--
-- AUTO_INCREMENT de la tabla `reservations`
--
ALTER TABLE `reservations`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=35;
--
-- AUTO_INCREMENT de la tabla `reservation_detail`
--
ALTER TABLE `reservation_detail`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=34;
--
-- AUTO_INCREMENT de la tabla `rooms`
--
ALTER TABLE `rooms`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=15;
--
-- AUTO_INCREMENT de la tabla `types`
--
ALTER TABLE `types`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT de la tabla `type_doc`
--
ALTER TABLE `type_doc`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- Restricciones para tablas volcadas
--
--
-- Filtros para la tabla `hotel_room`
--
ALTER TABLE `hotel_room`
ADD CONSTRAINT `fk_hotel` FOREIGN KEY (`id_hotel`) REFERENCES `hotels` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `fk_room` FOREIGN KEY (`id_room`) REFERENCES `rooms` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Filtros para la tabla `reservations`
--
ALTER TABLE `reservations`
ADD CONSTRAINT `fk_id_city` FOREIGN KEY (`id_city`) REFERENCES `city` (`id`),
ADD CONSTRAINT `fk_id_contact` FOREIGN KEY (`id_contact`) REFERENCES `contact` (`id`),
ADD CONSTRAINT `fk_id_hotel_room` FOREIGN KEY (`id_hotel_room`) REFERENCES `hotel_room` (`id`);
--
-- Filtros para la tabla `reservation_detail`
--
ALTER TABLE `reservation_detail`
ADD CONSTRAINT `fk_id_reservation` FOREIGN KEY (`id_reservation`) REFERENCES `reservations` (`id`),
ADD CONSTRAINT `fk_id_type_doc` FOREIGN KEY (`id_type_doc`) REFERENCES `type_doc` (`id`);
--
-- Filtros para la tabla `rooms`
--
ALTER TABLE `rooms`
ADD CONSTRAINT `fk_location` FOREIGN KEY (`location`) REFERENCES `city` (`id`),
ADD CONSTRAINT `fk_type` FOREIGN KEY (`id_type`) REFERENCES `types` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
SELECT e.FirstName + ' ' + e.LastName AS Employee,
ISNULL(m.FirstName + ' ' + m.LastName, 'no manager') AS Manager
FROM Employees e
LEFT JOIN Employees m
ON m.EmployeeID = e.ManagerID |
/*
Copyright 2021 Snowplow Analytics Ltd. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
-- A table storing an identifier for this run of a model - used to identify runs of the model across multiple modules/steps (eg. base, page views share this id per run)
CREATE TABLE IF NOT EXISTS {{.scratch_schema}}.mobile_metadata_run_id{{.entropy}} (
run_id TIMESTAMP
);
INSERT INTO {{.scratch_schema}}.mobile_metadata_run_id{{.entropy}} (
SELECT
GETDATE()
WHERE
-- Only insert if table is empty
(SELECT run_id FROM {{.scratch_schema}}.mobile_metadata_run_id{{.entropy}} LIMIT 1) IS NULL
);
-- Permanent metadata table
CREATE TABLE IF NOT EXISTS {{.output_schema}}.datamodel_metadata{{.entropy}} (
run_id TIMESTAMP,
model_version VARCHAR(64),
model VARCHAR(64),
module VARCHAR(64),
run_start_tstamp TIMESTAMP,
run_end_tstamp TIMESTAMP,
rows_this_run INT,
distinct_key VARCHAR(64),
distinct_key_count INT,
time_key VARCHAR(64),
min_time_key TIMESTAMP,
max_time_key TIMESTAMP,
duplicate_rows_removed INT,
distinct_keys_removed INT
);
-- Setup Metadata
DROP TABLE IF EXISTS {{.scratch_schema}}.mobile_sessions_metadata_this_run{{.entropy}};
CREATE TABLE {{.scratch_schema}}.mobile_sessions_metadata_this_run{{.entropy}} (
id VARCHAR(64),
run_id TIMESTAMP,
model_version VARCHAR(64),
model VARCHAR(64),
module VARCHAR(64),
run_start_tstamp TIMESTAMP,
run_end_tstamp TIMESTAMP,
rows_this_run INT,
distinct_key VARCHAR(64),
distinct_key_count INT,
time_key VARCHAR(64),
min_time_key TIMESTAMP,
max_time_key TIMESTAMP,
duplicate_rows_removed INT,
distinct_keys_removed INT
);
INSERT INTO {{.scratch_schema}}.mobile_sessions_metadata_this_run{{.entropy}} (
SELECT
'run',
run_id,
'{{.model_version}}',
'mobile',
'sessions',
GETDATE(),
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL
FROM {{.scratch_schema}}.mobile_metadata_run_id{{.entropy}}
);
-- Setup Sessions table
CREATE TABLE IF NOT EXISTS {{.output_schema}}.mobile_sessions{{.entropy}} (
app_id VARCHAR(255) ENCODE ZSTD,
session_id CHAR(36) ENCODE ZSTD NOT NULL,
session_index INT ENCODE ZSTD,
previous_session_id CHAR(36) ENCODE ZSTD,
session_first_event_id CHAR(36) ENCODE ZSTD,
session_last_event_id CHAR(36) ENCODE ZSTD,
start_tstamp TIMESTAMP ENCODE RAW, --raw for sk
end_tstamp TIMESTAMP ENCODE ZSTD,
model_tstamp TIMESTAMP ENCODE ZSTD,
user_id VARCHAR(255) ENCODE ZSTD,
device_user_id VARCHAR(4096) ENCODE ZSTD,
network_userid VARCHAR(128) ENCODE ZSTD,
session_duration_s INT ENCODE ZSTD,
has_install BOOLEAN ENCODE ZSTD,
screen_views INT ENCODE ZSTD,
screen_names_viewed INT ENCODE ZSTD,
app_errors INT ENCODE ZSTD,
fatal_app_errors INT ENCODE ZSTD,
first_event_name VARCHAR(1000) ENCODE ZSTD,
last_event_name VARCHAR(1000) ENCODE ZSTD,
first_screen_view_name VARCHAR(4096) ENCODE ZSTD,
first_screen_view_transition_type VARCHAR(4096) ENCODE ZSTD,
first_screen_view_type VARCHAR(4096) ENCODE ZSTD,
last_screen_view_name VARCHAR(4096) ENCODE ZSTD,
last_screen_view_transition_type VARCHAR(4096) ENCODE ZSTD,
last_screen_view_type VARCHAR(4096) ENCODE ZSTD,
platform VARCHAR(255) ENCODE ZSTD,
dvce_screenwidth INT ENCODE ZSTD,
dvce_screenheight INT ENCODE ZSTD,
device_manufacturer VARCHAR(4096) ENCODE ZSTD,
device_model VARCHAR(4096) ENCODE ZSTD,
os_type VARCHAR(4096) ENCODE ZSTD,
os_version VARCHAR(4096) ENCODE ZSTD,
android_idfa VARCHAR(4096) ENCODE ZSTD,
apple_idfa VARCHAR(4096) ENCODE ZSTD,
apple_idfv VARCHAR(4096) ENCODE ZSTD,
open_idfa VARCHAR(4096) ENCODE ZSTD,
device_latitude DOUBLE PRECISION,
device_longitude DOUBLE PRECISION,
device_latitude_longitude_accuracy DOUBLE PRECISION,
device_altitude DOUBLE PRECISION,
device_altitude_accuracy DOUBLE PRECISION,
device_bearing DOUBLE PRECISION,
device_speed DOUBLE PRECISION,
geo_country CHAR(2) ENCODE ZSTD,
geo_region CHAR(3) ENCODE ZSTD,
geo_city VARCHAR(75) ENCODE ZSTD,
geo_zipcode VARCHAR(15) ENCODE ZSTD,
geo_latitude DOUBLE PRECISION ENCODE ZSTD,
geo_longitude DOUBLE PRECISION ENCODE ZSTD,
geo_region_name VARCHAR(100) ENCODE ZSTD,
geo_timezone VARCHAR(64) ENCODE ZSTD,
user_ipaddress VARCHAR(128) ENCODE ZSTD,
useragent VARCHAR(1000) ENCODE ZSTD,
name_tracker VARCHAR(128) ENCODE ZSTD,
v_tracker VARCHAR(100) ENCODE ZSTD,
carrier VARCHAR(4096) ENCODE ZSTD,
network_technology VARCHAR(4096) ENCODE ZSTD,
network_type VARCHAR(7) ENCODE ZSTD,
first_build VARCHAR(255) ENCODE ZSTD,
last_build VARCHAR(255) ENCODE ZSTD,
first_version VARCHAR(255) ENCODE ZSTD,
last_version VARCHAR(255) ENCODE ZSTD
)
DISTSTYLE KEY
DISTKEY (session_id)
SORTKEY (start_tstamp);
-- Staged manifest table as input to users step
CREATE TABLE IF NOT EXISTS {{.scratch_schema}}.mobile_sessions_userid_manifest_staged{{.entropy}} (
device_user_id VARCHAR(4096),
start_tstamp TIMESTAMP
)
DISTSTYLE KEY
DISTKEY (device_user_id)
SORTKEY (device_user_id);
|
/*
Date: 2016-12-23
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for `p_permission`
-- ----------------------------
DROP TABLE IF EXISTS `p_permission`;
CREATE TABLE `p_permission` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(50) UNIQUE NOT NULL COMMENT '权限名',
`sn` int(2) NOT NULL UNIQUE COMMENT '权限标识(BIT)',
`comment` varchar(50) DEFAULT NULL COMMENT '权限说明',
`create_time` datetime DEFAULT datetime COMMENT '创建日期',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COMMENT '权限表';
-- ----------------------------
-- Records of p_permission
-- ----------------------------
INSERT INTO `p_permission` VALUES ('1', 'query', 0, '查询', null);
INSERT INTO `p_permission` VALUES ('2', 'create', 1, '增加', null);
INSERT INTO `p_permission` VALUES ('3', 'update', 2, '修改', null);
INSERT INTO `p_permission` VALUES ('4', 'delete', 3, '删除', null);
-- ----------------------------
-- Table structure for `p_acl`
-- ----------------------------
DROP TABLE IF EXISTS `p_acl`;
CREATE TABLE `p_acl` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`principal_type` varchar(50) NOT NULL COMMENT '主体类型(角色或用户)',
`principal_sn` int(11) NOT NULL COMMENT '主体标识(ID)',
`resource_sn` int(11) NOT NULL COMMENT '资源标识(Module ID)',
`acl_state` int(32) NOT NULL COMMENT '授权状态(用(bit)表示, 64bit-20位max)',
`acl_ext_state` int(2) DEFAULT 0 COMMENT '是否继承(0否-1是)',
`create_time` datetime DEFAULT datetime COMMENT '创建日期',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COMMENT '访问控制列表';
-- ----------------------------
-- Records of p_acl
-- ----------------------------
INSERT INTO `p_acl` VALUES ('1', 'ROLE', 1, 1, 15, 0, null);
INSERT INTO `p_acl` VALUES ('2', 'ROLE', 1, 2, 15, 0, null);
INSERT INTO `p_acl` VALUES ('3', 'ROLE', 1, 3, 15, 0, null);
INSERT INTO `p_acl` VALUES ('4', 'ROLE', 1, 4, 15, 0, null);
INSERT INTO `p_acl` VALUES ('5', 'ROLE', 1, 5, 15, 0, null);
INSERT INTO `p_acl` VALUES ('6', 'ROLE', 1, 6, 15, 0, null);
INSERT INTO `p_acl` VALUES ('7', 'ROLE', 1, 7, 15, 0, null);
INSERT INTO `p_acl` VALUES ('8', 'ROLE', 1, 8, 15, 0, null);
INSERT INTO `p_acl` VALUES ('9', 'ROLE', 1, 9, 15, 0, null);
INSERT INTO `p_acl` VALUES ('10', 'ROLE', 1, 10, 15, 0, null);
INSERT INTO `p_acl` VALUES ('11', 'ROLE', 1, 11, 15, 0, null);
INSERT INTO `p_acl` VALUES ('12', 'ROLE', 1, 12, 15, 0, null);
INSERT INTO `p_acl` VALUES ('13', 'ROLE', 2, 1, 9, 0, null);
INSERT INTO `p_acl` VALUES ('14', 'ROLE', 3, 1, 5, 0, null);
INSERT INTO `p_acl` VALUES ('15', 'USER', 4, 1, 1, 0, null);
-- ----------------------------
-- Table structure for `p_module`
-- ----------------------------
DROP TABLE IF EXISTS `p_module`;
CREATE TABLE `p_module` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`pid` int(10) DEFAULT NULL COMMENT '父模块',
`name` varchar(32) NOT NULL COMMENT '模块名称',
`url` varchar(50) DEFAULT NULL COMMENT '模块地址',
`order_no` int(10) DEFAULT NULL COMMENT '模块排序编号',
`sn` varchar(32) NOT NULL UNIQUE COMMENT '模块标识',
`create_time` datetime DEFAULT datetime COMMENT '创建日期',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COMMENT '系统模块';
-- ----------------------------
-- Records of p_module
-- ----------------------------
INSERT INTO `p_module` VALUES ('1', null, 'Overview', '/index', '1', 'IndexUrl', null);
INSERT INTO `p_module` VALUES ('2', null, 'Reports', '/reports', '1', 'Reports', null);
INSERT INTO `p_module` VALUES ('3', null, 'Analytics', '/analytics', '1', 'Analytics', null);
INSERT INTO `p_module` VALUES ('4', null, 'Export', '/export', '1', 'Export', null);
INSERT INTO `p_module` VALUES ('5', null, 'Nav item', '/navitem', '1', 'Nav_item', null);
INSERT INTO `p_module` VALUES ('6', null, 'Nav item again', '/navitemagain', '1', 'Nav_item_again', null);
INSERT INTO `p_module` VALUES ('7', null, 'One more nav', '/onenav', '1', 'One_more_nav', null);
INSERT INTO `p_module` VALUES ('8', null, 'Another nav item', '/anothernav', '1', 'Another_nav_item', null);
INSERT INTO `p_module` VALUES ('9', null, 'More navigation', '/more', '1', 'More_navigation', null);
INSERT INTO `p_module` VALUES ('10', null, 'Acl Manager', '/acl', '1', 'Acl_Manager', null);
INSERT INTO `p_module` VALUES ('11', null, 'One more nav', null, '1', 'One_more_nav1', null);
INSERT INTO `p_module` VALUES ('12', null, 'Another nav item', null, '1', 'Another_nav_item1', null);
-- ----------------------------
-- Table structure for `p_role`
-- ----------------------------
DROP TABLE IF EXISTS `p_role`;
CREATE TABLE `p_role` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`role_name` varchar(32) DEFAULT NULL UNIQUE COMMENT '角色名称',
`description` varchar(200) DEFAULT NULL COMMENT '角色描述',
`create_time` datetime DEFAULT datetime COMMENT '创建日期',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COMMENT '角色表';
-- ----------------------------
-- Records of p_role
-- ----------------------------
INSERT INTO `p_role` VALUES ('1', 'admin', '系统管理员', null);
INSERT INTO `p_role` VALUES ('2', 'teacher', '教师', null);
INSERT INTO `p_role` VALUES ('3', 'student', '学生', null);
-- ----------------------------
-- Table structure for `p_role_module`
-- ----------------------------
DROP TABLE IF EXISTS `p_role_module`;
CREATE TABLE `p_role_module` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`role_id` int(11) DEFAULT NULL COMMENT '角色id',
`module_id` int(11) DEFAULT NULL COMMENT '模块id',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COMMENT '角色模块映射表';
-- ----------------------------
-- Records of p_role_module
-- ----------------------------
INSERT INTO `p_role_module` VALUES ('1', '1', '1');
INSERT INTO `p_role_module` VALUES ('2', '1', '2');
INSERT INTO `p_role_module` VALUES ('3', '1', '3');
INSERT INTO `p_role_module` VALUES ('4', '1', '4');
INSERT INTO `p_role_module` VALUES ('5', '1', '5');
INSERT INTO `p_role_module` VALUES ('6', '1', '6');
INSERT INTO `p_role_module` VALUES ('7', '1', '7');
INSERT INTO `p_role_module` VALUES ('8', '1', '8');
INSERT INTO `p_role_module` VALUES ('9', '1', '9');
INSERT INTO `p_role_module` VALUES ('10', '1', '10');
INSERT INTO `p_role_module` VALUES ('11', '1', '11');
INSERT INTO `p_role_module` VALUES ('12', '1', '12');
INSERT INTO `p_role_module` VALUES ('13', '2', '1');
INSERT INTO `p_role_module` VALUES ('14', '2', '2');
INSERT INTO `p_role_module` VALUES ('15', '3', '1');
-- ----------------------------
-- Table structure for `p_user`
-- ----------------------------
DROP TABLE IF EXISTS `p_user`;
CREATE TABLE `p_user` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`account` varchar(32) UNIQUE NOT NULL COMMENT '账号',
`password` varchar(32) NOT NULL COMMENT '密码',
`name` varchar(32) DEFAULT NULL COMMENT '用户名称',
`stop_state` varchar(2) DEFAULT NULL COMMENT '是否停用',
`stop_time` datetime DEFAULT NULL COMMENT '停用时间',
`stop_user` varchar(20) DEFAULT NULL COMMENT '停用人',
`create_time` datetime DEFAULT datetime COMMENT '创建日期',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COMMENT '用户表';
-- ----------------------------
-- Records of p_user
-- ----------------------------
INSERT INTO `p_user` VALUES ('1', 'admin', 'admin@123', 'Admin', null);
INSERT INTO `p_user` VALUES ('2', 'lance', 'admin', 'Lance', null);
INSERT INTO `p_user` VALUES ('3', 'test', 'test', 'test', null);
INSERT INTO `p_user` VALUES ('4', 'test4', 'test', 'noRole', null);
-- ----------------------------
-- Table structure for `p_user_role`
-- ----------------------------
DROP TABLE IF EXISTS `p_user_role`;
CREATE TABLE `p_user_role` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) DEFAULT NULL COMMENT '用户id',
`role_id` int(11) DEFAULT NULL COMMENT '角色id',
`order_no` int(11) DEFAULT NULL COMMENT '编号',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COMMENT '角色用户映射表';
-- ----------------------------
-- Records of p_user_role
-- ----------------------------
INSERT INTO `p_user_role` VALUES ('1', '1', '1', '1');
INSERT INTO `p_user_role` VALUES ('2', '2', '2', '2');
INSERT INTO `p_user_role` VALUES ('3', '3', '3', '3');
INSERT INTO `p_user_role` VALUES ('4', '1', '2', '4');
|
-- -------- << PROJETO1 >> ------------ --
-- --
-- SCRIPT PROCEDURAL --
-- --
-- Data Criacao ...........: 13/10/2017 --
-- Autor(es) ..............: José Aquiles , Ramon --
-- Banco de Dados .........: MySQL --
-- Banco de Dados(nome) ...: NUMTA --
-- --
-- --
-- PROJETO => 1 Base de Dados --
-- => 1 procedure --
-- => 2 tabelas --
-- => 3 views --
-- ----------------------------------------------------------------- --
USE NUMTA;
DELIMITER $$
-- procedure que pega as imagens de uma pasta e insere na tabela
CREATE PROCEDURE INSERT_IMAGEM (in letra char)
BEGIN
-- caso o mysql perca conexão mude o valor default de i para um numero posterior ao ultimo inserido e rode a procedure
DECLARE i int default 0 ;
DECLARE done int default 0;
repeat
if i<10 then
insert into IMAGEM(filename,imagem)
VALUES (concat(letra,'0000',i,'.png'),
load_file(concat('/var/lib/mysql-files/training-',letra,'/',letra,'0000',i,'.png')));
elseif i>=10 and i<100 then
insert into IMAGEM(filename,imagem)
VALUES (concat(letra,'000',i,'.png'),
load_file(concat('/var/lib/mysql-files/training-',letra,'/',letra,'000',i,'.png')));
elseif i>=100 and i<1000 then
insert into IMAGEM(filename,imagem)
VALUES (concat(letra,'00',i,'.png'),
load_file(concat('/var/lib/mysql-files/training-',letra,'/',letra,'.00',i,'.png')));
elseif i>=1000 and i<10000 then
insert into IMAGEM(filename,imagem)
VALUES (concat(letra,'0',i,'.png'),
load_file(concat('/var/lib/mysql-files/training-',letra,'/',letra,'0',i,'.png')));
elseif i>=10000 then
insert into IMAGEM(filename,imagem)
VALUES (concat(letra,i,'.png'),
load_file(concat('/var/lib/mysql-files/training-',letra,'/',letra,i,'.png')));
end if;
set i = i + 1 ;
until done = 1 END repeat;
END $$
call INSERT_IMAGEM('b') $$
call INSERT_IMAGEM('c') $$
call INSERT_IMAGEM('a') $$
call INSERT_IMAGEM('d') $$
call INSERT_IMAGEM('e') $$
|
CREATE DATABASE `labor7`
CHARACTER SET utf8 COLLATE utf8_general_ci;
USE `labor7`;
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
CREATE TABLE `bejegyzesek` (
`szoveg` varchar(200) NOT NULL,
`nev` varchar(50) NOT NULL,
`email` varchar(50) NOT NULL,
`id` int(11) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
INSERT INTO `bejegyzesek` (`szoveg`, `nev`, `email`, `id`) VALUES
('Ujabb velemenyt fogalmazok meg', 'Gipsz Jakab', 'ujemail@email.info', 4),
('Nagyon kedvez? véleményem van!', 'Teszt Elek', 'email@email.ma', 3),
('Kiváló véleménnyel vagyok', 'Próba Béla', 'email@ami.nincs', 5);
CREATE TABLE `felhasznalok` (
`id` int(10) UNSIGNED NOT NULL,
`csaladi_nev` varchar(45) NOT NULL,
`uto_nev` varchar(45) NOT NULL,
`bejelentkezes` int(12) NOT NULL,
`jelszo` varchar(40) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
INSERT INTO `felhasznalok` (`id`, `csaladi_nev`, `uto_nev`, `bejelentkezes`, `jelszo`) VALUES
(1, 'Családi_1', 'Utónév_1', 0, 'd4b90f2dfafc736205a98bf3ae6541431bc77d8e'),
(2, 'Családi_2', 'Utónév_2', 0, '6cf8efacae19431476020c1e2ebd2d8acca8f5c0'),
(3, 'Családi_3', 'Utónév_3', 0, 'df4d8ad070f0d1585e172a2150038df5cc6c891a'),
(4, 'Családi_4', 'Utónév_4', 0, 'b020c308c155d6bbd7eb7d27bd30c0573acbba5b'),
(5, 'Családi_5', 'Utónév_5', 0, '9ab1a4743b30b5e9c037e6a645f0cfee80fb41d4'),
(6, 'Családi_6', 'Utónév_6', 0, '7ca01f28594b1a06239b1d96fc716477d198470b'),
(0, 'aaa', 'aaa', 0, '7e240de74fb1ed08fa08d38063f6a6a91462a815');
ALTER TABLE `bejegyzesek`
ADD PRIMARY KEY (`id`);
ALTER TABLE `felhasznalok`
ADD PRIMARY KEY `id` (`id`);
ALTER TABLE `bejegyzesek`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
ALTER TABLE `felhasznalok`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
COMMIT;
|
select * from negotiation_activity where activity_type_id in (
select activity_type_id
from negotiation_activity_type n,
krcr_parm_t p
where p.parm_nm = 'uh_restricted_negotiation_activity_types'
and p.val like '%[' || n.description || ']%'
);
select * from negotiation_activity ; |
-- SELECT day, count(*) FROM assignments
-- group by day
-- HAVING count(*) > 10
-- order by day
-- ;
-- SELECT cohorts.name AS cohort_name, count(students.*) AS student_count FROM students
-- JOIN cohorts on cohorts.id = cohort_id
-- GROUP BY cohort_name
-- HAVING count(students.*) >= 18
-- order by student_count;
-- SELECT cohorts.name AS cohort, count(assignment_submissions.*) as total_submissions
-- FROM assignment_submissions
-- JOIN students on students.id = student_id
-- JOIN cohorts on cohorts.id = cohort_id
-- group by cohorts.name
-- order by total_submissions DESC;
-- SELECT students.name as student, avg(assignment_submissions.duration) AS average_assignment_duration
-- FROM students
-- JOIN assignment_submissions ON student_id = students.id
-- WHERE end_date is null
-- group by student
-- ORDER BY average_assignment_duration DESC;
-- SELECT students.name AS student,
-- avg(assignment_submissions.duration) AS average_assignment_duration,
-- avg(assignments.duration) AS average_estimated_duration
-- FROM students
-- JOIN assignment_submissions ON students.id = student_id
-- JOIN assignments ON assignments.id = assignment_id
-- WHERE end_date is null
-- GROUP BY student
-- HAVING avg(assignment_submissions.duration) < avg(assignments.duration)
-- ORDER by (average_assignment_duration);
-- SELECT avg(total_students) as average_students FROM
-- (SELECT count(students) as total_students
-- FROM students
-- JOIN cohorts on cohorts.id = cohort_id
-- GROUP BY cohorts) as totals_table;
select * FROM assignments WHERE
ID NOT IN (SELECT assignment_id
FROM assignment_submissions
JOIN students ON students.id = student_id
WHERE students.name = 'Ibrahim Schimmel'); |
CREATE DATABASE `wssa_db` CHARACTER SET utf8 COLLATE utf8_general_ci;
GRANT ALL ON `wssa_db`.* TO `wssa_db_usr`@localhost IDENTIFIED BY 'lF4eP3UQEzP';
CREATE TABLE `ws_logs_onlapps` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`api_request_time` int(11) NOT NULL DEFAULT '0',
`api_version` decimal(10,2) NOT NULL DEFAULT '1.00',
`api_resource` varchar(100) NOT NULL DEFAULT '',
`api_resource_id` int(11) NOT NULL DEFAULT '0',
`api_args` varchar(300) NOT NULL DEFAULT '',
`api_response_type` int(1) NOT NULL DEFAULT '0',
`api_gzoutput` int(1) NOT NULL DEFAULT '0',
`api_call_url` varchar(300) NOT NULL DEFAULT '',
`api_remote_ip` varchar(20) NOT NULL DEFAULT '',
`api_remote_ua` varchar(300) NOT NULL DEFAULT '',
`api_nonce_hash` varchar(300) NOT NULL DEFAULT '',
`query_sql` text NOT NULL,
`server_time` varchar(300) NOT NULL DEFAULT '',
`authenticated` int(1) NOT NULL DEFAULT '0',
`user_key` int(11) NOT NULL DEFAULT '0',
`user_name` varchar(30) NOT NULL DEFAULT '',
`client_name` varchar(30) NOT NULL DEFAULT '',
`client_api_state` int(11) NOT NULL DEFAULT '0',
`input_file` varchar(200) NOT NULL DEFAULT '',
`output_file` varchar(200) NOT NULL DEFAULT '',
`api_method` varchar(10) NOT NULL DEFAULT '',
`public_key` varchar(16) NOT NULL DEFAULT '',
`error` int(1) NOT NULL DEFAULT '0',
`error_msg` varchar(200) NOT NULL DEFAULT '',
`record_count` int(11) NOT NULL DEFAULT '0',
`fieldset` varchar(200) NOT NULL DEFAULT '',
`request_state` int(2) NOT NULL DEFAULT '0',
`request_initd` decimal(14,4) NOT NULL DEFAULT '0.0000',
`request_trmd` decimal(14,4) NOT NULL DEFAULT '0.0000',
`request_drtn` varchar(20) NOT NULL DEFAULT '',
`rkey_p5` varchar(16) NOT NULL DEFAULT '',
`rkey_p6` varchar(24) NOT NULL DEFAULT '',
`rkey_p7` varchar(32) NOT NULL DEFAULT '',
`log_file_name` varchar(80) NOT NULL DEFAULT '',
`log_file_path` varchar(200) NOT NULL DEFAULT '',
`log_file_emailed` int(1) NOT NULL DEFAULT '0',
`log_file_email_recipients` varchar(200) NOT NULL DEFAULT '',
`log_file_contents` text NOT NULL,
`creation_datetime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`update_timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`creation_user_id` varchar(100) NOT NULL DEFAULT '',
`update_user_id` varchar(100) NOT NULL DEFAULT '',
`status` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
|
---- charge (correction)
INSERT INTO RECUT.BILLOPERATION (ID,NAME,NAME_BS,TYPE_ID,D1,D2,REQ_CYCLE,REQ_READING,REQ_KWH,REQ_GEL,SEQ,DIFF_GROUP_ID) VALUES
(790, '2015 correction', '2015 ß.ÃÀÒÉÝáÅÉÓ ÊÏÒÄØÔÉÒÄÁÀ', 4, null, null, 0, 1, 0, 0, 804, 0);
INSERT INTO RECUT.BILLOPERATION (ID,NAME,NAME_BS,TYPE_ID,D1,D2,REQ_CYCLE,REQ_READING,REQ_KWH,REQ_GEL,SEQ,DIFF_GROUP_ID) VALUES
(791, '2015 discharge', '2015 ß.ÃÀÒÉÝáÅÉÓ ÌÏáÓÍÀ', 4, null, null, 0, 1, 0, 0, 164, 0);
INSERT INTO RECUT.BILLOPERATION (ID,NAME,NAME_BS,TYPE_ID,D1,D2,REQ_CYCLE,REQ_READING,REQ_KWH,REQ_GEL,SEQ,DIFF_GROUP_ID) VALUES
(792, '2015 corrected', '2015 ß.ÊÏÒÄØÔÉÒÄÁÖËÉ ÃÀÒÉÝáÅÀ', 4, null, null, 0, 1, 0, 0, 164, 0);
---- debt (correction)
INSERT INTO RECUT.BILLOPERATION (ID,NAME,NAME_BS,TYPE_ID,D1,D2,REQ_CYCLE,REQ_READING,REQ_KWH,REQ_GEL,SEQ,DIFF_GROUP_ID) VALUES
(793, '2015 debt correction', '2015 ß.ÅÀËÉÓ ÊÏÒÄØÔÉÒÄÁÀ', 4, null, null, 0, 1, 0, 0, 236, 0);
---- previous year's actcorrection
INSERT INTO RECUT.BILLOPERATION (ID, NAME, NAME_BS, TYPE_ID, D1, D2, REQ_CYCLE, REQ_READING, REQ_KWH, REQ_GEL, SEQ, DIFF_GROUP_ID)
VALUES (418, 'oper.actcorr.2014', 'ÄÒÈãÄÒÀÃÉ ÀØÔÉ 2014ß', 4, null, null, 0, 0, 0, 0, 50113, 0);
---- new subsidy
INSERT INTO RECUT.BILLOPERATION (ID, NAME, NAME_BS, TYPE_ID, D1, D2, REQ_CYCLE, REQ_READING, REQ_KWH, REQ_GEL, SEQ, DIFF_GROUP_ID)
VALUES (510, 'subsidy510', 'ÄÍÄÒÂÄÔÉÊÉÓ ÅÄÔÄÒÀÍÄÁÉ (200ÊÅÔ)', 5, null, null, 0, 0, 0, 0, 100000, 14);
|
DROP TABLE IF EXISTS `snapshot`;
CREATE TABLE `snapshot` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`datetime` datetime NOT NULL,
`host` varchar(100) NOT NULL,
`vm` varchar(100) NOT NULL,
`action` varchar(100) NOT NULL,
`snapshot` varchar(100) NOT NULL,
`status` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
-- phpMyAdmin SQL Dump
-- version 4.3.11
-- http://www.phpmyadmin.net
--
-- Servidor: 127.0.0.1
-- Tiempo de generación: 18-07-2015 a las 02:21:12
-- Versión del servidor: 5.6.24
-- Versión de PHP: 5.6.8
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
--
-- Base de datos: `bdhousemate`
--
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `asociados`
--
CREATE TABLE IF NOT EXISTS `asociados` (
`idasocio` int(5) NOT NULL,
`socio1` varchar(5) COLLATE utf8_spanish_ci NOT NULL,
`socio2` varchar(5) COLLATE utf8_spanish_ci NOT NULL,
`solicitud` char(1) COLLATE utf8_spanish_ci NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci;
--
-- Volcado de datos para la tabla `asociados`
--
INSERT INTO `asociados` (`idasocio`, `socio1`, `socio2`, `solicitud`) VALUES
(22, '0', '2', '2');
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `convenio`
--
CREATE TABLE IF NOT EXISTS `convenio` (
`idconvenio` varchar(5) COLLATE utf8_spanish_ci NOT NULL,
`idinmueble` varchar(5) COLLATE utf8_spanish_ci NOT NULL,
`idusuario` varchar(5) COLLATE utf8_spanish_ci NOT NULL,
`oferta` varchar(6) COLLATE utf8_spanish_ci NOT NULL,
`aprovado1` char(1) COLLATE utf8_spanish_ci NOT NULL,
`aprovado2` char(1) COLLATE utf8_spanish_ci NOT NULL,
`fecha_aprobacion` date NOT NULL,
`fecha_final` date NOT NULL,
`adelanto` varchar(5) COLLATE utf8_spanish_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci;
--
-- Volcado de datos para la tabla `convenio`
--
INSERT INTO `convenio` (`idconvenio`, `idinmueble`, `idusuario`, `oferta`, `aprovado1`, `aprovado2`, `fecha_aprobacion`, `fecha_final`, `adelanto`) VALUES
('1', '1', '3', '23000', '1', '1', '2015-07-23', '2015-08-14', '2000'),
('2', '1', '3', '23000', '0', '0', '2015-07-17', '2015-09-30', '2000');
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `empresa`
--
CREATE TABLE IF NOT EXISTS `empresa` (
`IdEmpresa` varchar(5) COLLATE utf8_spanish_ci NOT NULL,
`dueño` varchar(5) COLLATE utf8_spanish_ci NOT NULL,
`telefono` varchar(8) COLLATE utf8_spanish_ci NOT NULL,
`nombre` varchar(30) COLLATE utf8_spanish_ci NOT NULL,
`direccion` varchar(140) COLLATE utf8_spanish_ci NOT NULL,
`nit` varchar(14) COLLATE utf8_spanish_ci NOT NULL,
`telefono2` varchar(8) COLLATE utf8_spanish_ci NOT NULL,
`descrip` varchar(140) COLLATE utf8_spanish_ci NOT NULL,
`imagen` varchar(30) COLLATE utf8_spanish_ci DEFAULT NULL,
`ratings` int(1) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci;
--
-- Volcado de datos para la tabla `empresa`
--
INSERT INTO `empresa` (`IdEmpresa`, `dueño`, `telefono`, `nombre`, `direccion`, `nit`, `telefono2`, `descrip`, `imagen`, `ratings`) VALUES
('0', '0', '11111123', 'House Mate', 'Agua Caliente, Chalatenango, El Salvador', '12345678901112', '23232323', 'Cosas de la vida', 'House Mate Logo 5.png', 0);
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `empresamen`
--
CREATE TABLE IF NOT EXISTS `empresamen` (
`idmensaje` varchar(5) COLLATE utf8_spanish_ci NOT NULL,
`idempresa` varchar(5) COLLATE utf8_spanish_ci NOT NULL,
`titulo` varchar(30) COLLATE utf8_spanish_ci NOT NULL,
`texto` varchar(240) COLLATE utf8_spanish_ci NOT NULL,
`fecha` date NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci;
--
-- Volcado de datos para la tabla `empresamen`
--
INSERT INTO `empresamen` (`idmensaje`, `idempresa`, `titulo`, `texto`, `fecha`) VALUES
('0', '0', 'Empresa op', 'Bienvenidos a House Mate dentro de esta sección se maneja todo lo referente a empresa.', '2015-07-11'),
('1', '0', 'Terminado', 'Falta poco para terminar todo el modulo de empresa', '2015-07-12');
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `empresasolicitud`
--
CREATE TABLE IF NOT EXISTS `empresasolicitud` (
`idsolicitud` varchar(5) COLLATE utf8_spanish_ci NOT NULL,
`idempresa` varchar(5) COLLATE utf8_spanish_ci NOT NULL,
`idusuario` varchar(5) COLLATE utf8_spanish_ci NOT NULL,
`aprovado` int(1) NOT NULL,
`aprovado2` int(1) NOT NULL,
`mensaje` varchar(260) CHARACTER SET utf8 COLLATE utf8_spanish2_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci;
--
-- Volcado de datos para la tabla `empresasolicitud`
--
INSERT INTO `empresasolicitud` (`idsolicitud`, `idempresa`, `idusuario`, `aprovado`, `aprovado2`, `mensaje`) VALUES
('1', '0', '1', 1, 0, 'Metete'),
('2', '0', '3', 1, 1, 'Venga papa');
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `etiqueta`
--
CREATE TABLE IF NOT EXISTS `etiqueta` (
`IdEtiqueta` varchar(5) COLLATE utf8_spanish_ci NOT NULL,
`Idinmueble` varchar(5) COLLATE utf8_spanish_ci NOT NULL,
`Netiqueta` int(5) NOT NULL,
`Valor` varchar(50) COLLATE utf8_spanish_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci;
--
-- Volcado de datos para la tabla `etiqueta`
--
INSERT INTO `etiqueta` (`IdEtiqueta`, `Idinmueble`, `Netiqueta`, `Valor`) VALUES
('1', '0', 1, '1'),
('10', '1', 6, '0'),
('11', '1', 7, '0'),
('12', '1', 8, '0'),
('13', '1', 9, '0'),
('14', '1', 10, '0'),
('15', '2', 1, '13-0-0-0-0'),
('16', '2', 6, '120'),
('17', '2', 7, '0'),
('18', '2', 8, '0'),
('19', '2', 9, '0'),
('2', '0', 2, '1'),
('20', '2', 10, '0'),
('21', '3', 6, '7'),
('22', '3', 7, '2'),
('23', '3', 8, '1'),
('24', '3', 9, '0'),
('25', '3', 10, '0'),
('3', '0', 4, '2'),
('4', '0', 5, '1'),
('5', '0', 7, '1'),
('6', '0', 8, '2'),
('7', '0', 9, '11'),
('8', '0', 10, '2'),
('9', '1', 1, '13-0-0-0-0');
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `inmueble`
--
CREATE TABLE IF NOT EXISTS `inmueble` (
`IdInmueble` varchar(5) COLLATE utf8_spanish_ci NOT NULL,
`Dueno` varchar(5) COLLATE utf8_spanish_ci DEFAULT NULL,
`Direccion` varchar(140) COLLATE utf8_spanish_ci NOT NULL,
`Descripcion` varchar(140) COLLATE utf8_spanish_ci NOT NULL,
`VentaRenta` int(1) NOT NULL,
`Tipopropiedad` int(1) NOT NULL,
`Precio` varchar(20) COLLATE utf8_spanish_ci NOT NULL,
`Imagen` varchar(100) COLLATE utf8_spanish_ci NOT NULL,
`DescDire` text COLLATE utf8_spanish_ci,
`estado` varchar(1) COLLATE utf8_spanish_ci NOT NULL,
`areadeterreno` varchar(15) COLLATE utf8_spanish_ci NOT NULL,
`areadeconstruc` varchar(15) COLLATE utf8_spanish_ci NOT NULL,
`aprovado` varchar(1) COLLATE utf8_spanish_ci NOT NULL,
`age` varchar(2) COLLATE utf8_spanish_ci NOT NULL,
`valuo1` varchar(15) COLLATE utf8_spanish_ci NOT NULL,
`valuo2` varchar(15) COLLATE utf8_spanish_ci NOT NULL,
`total` varchar(20) COLLATE utf8_spanish_ci NOT NULL,
`remaining` varchar(2) COLLATE utf8_spanish_ci NOT NULL,
`perito` varchar(5) COLLATE utf8_spanish_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci;
--
-- Volcado de datos para la tabla `inmueble`
--
INSERT INTO `inmueble` (`IdInmueble`, `Dueno`, `Direccion`, `Descripcion`, `VentaRenta`, `Tipopropiedad`, `Precio`, `Imagen`, `DescDire`, `estado`, `areadeterreno`, `areadeconstruc`, `aprovado`, `age`, `valuo1`, `valuo2`, `total`, `remaining`, `perito`) VALUES
('0', '0', 'Santa Tecla, La Libertad, El Salvador', 'Test', 2, 1, '23000', 'img/Houses/2.jpg', NULL, '', '', '', '', '', '', '', '', '', ''),
('1', '0', 'Apaneca, Ahuachapán, El Salvador', 'asd', 1, 1, '1230', 'img/Houses/b.jpg', 'asd', '1', '120', '120', '1', '10', '27817.06', '12000.00', '39817.06', '65', '0'),
('2', '0', 'Agua Caliente, Chalatenango, El Salvador', '1230', 1, 0, '1230', 'img/Houses/3.jpg', '1230', '3', '120', '120', '1', '10', '27426.12', '14760.00', '42186.12', '64', '3'),
('3', '0', 'Apaneca, Ahuachapán, El Salvador', 'Manual', 2, 1, '1245', 'img/Houses/4.jpg', 'Jose', '2', '186', '122', '1', '10', '18669.93', '30690.00', '49359.93', '65', '0');
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `mensaje`
--
CREATE TABLE IF NOT EXISTS `mensaje` (
`idmensaje` int(5) NOT NULL,
`remitente` varchar(5) COLLATE utf8_spanish_ci NOT NULL,
`destinatario` varchar(5) COLLATE utf8_spanish_ci NOT NULL,
`asunto` varchar(25) COLLATE utf8_spanish_ci NOT NULL,
`mensaje` varchar(260) COLLATE utf8_spanish_ci NOT NULL,
`fecha` datetime NOT NULL,
`estado` char(1) COLLATE utf8_spanish_ci NOT NULL,
`estado2` char(1) COLLATE utf8_spanish_ci NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci;
--
-- Volcado de datos para la tabla `mensaje`
--
INSERT INTO `mensaje` (`idmensaje`, `remitente`, `destinatario`, `asunto`, `mensaje`, `fecha`, `estado`, `estado2`) VALUES
(1, '0', '2', 'Test', 'Hola!', '2015-06-12 00:00:00', '', ''),
(2, '0', '2', 'Test 2', 'sadhgaskdjashdaskdjksdasjdhajghdasgdhasgsdasd', '2015-06-12 00:00:00', '', ''),
(3, '1', '2', 'Test 3', 'esto es de otro usuario', '2015-06-12 00:00:00', '', ''),
(4, '0', '3', 'asd', 'cristopher esta aca', '2015-06-25 11:04:24', '2', '3'),
(5, '2', '0', 'no', 'j', '2015-06-26 14:11:48', '2', '1'),
(6, '0', '2', 'soy gay', 'ño', '2015-06-26 14:20:38', '1', '2'),
(7, '0', '3', '', '', '2015-06-26 14:21:02', '1', '3');
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `tbusuario`
--
CREATE TABLE IF NOT EXISTS `tbusuario` (
`idUsuario` varchar(5) COLLATE utf8_spanish_ci NOT NULL DEFAULT '',
`nombre` varchar(20) COLLATE utf8_spanish_ci DEFAULT NULL,
`apellido` varchar(20) COLLATE utf8_spanish_ci DEFAULT NULL,
`fechanac` date NOT NULL,
`correo` varchar(50) COLLATE utf8_spanish_ci DEFAULT NULL,
`usuario` varchar(20) COLLATE utf8_spanish_ci DEFAULT NULL,
`contra` varchar(120) COLLATE utf8_spanish_ci DEFAULT NULL,
`tipo` int(1) DEFAULT NULL,
`image` varchar(50) COLLATE utf8_spanish_ci DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci;
--
-- Volcado de datos para la tabla `tbusuario`
--
INSERT INTO `tbusuario` (`idUsuario`, `nombre`, `apellido`, `fechanac`, `correo`, `usuario`, `contra`, `tipo`, `image`) VALUES
('2', 'Test', 'Test2 prueba', '1994-12-12', 'html@hotmail.com', 'Garcia', '734c9f9c17e31655a415bd2bb0a36c012a3e8cda', 4, NULL),
('1', 'Jose', 'Montolla', '1996-01-12', 'correo@hotmail.com', 'Visitante', '734c9f9c17e31655a415bd2bb0a36c012a3e8cda', 3, NULL),
('0', 'Fernando Antonio', 'Menjivar Rivera', '1993-12-12', 'Menjivarmenjivar@gmail.com', 'Fernando', '8cb2237d0679ca88db6464eac60da96345513964', 1, NULL),
('3', 'asd', 'asd', '1233-12-12', 'correo@correo', 'asd', 'f10e2821bbbea527ea02200352313bc059445190', 3, NULL),
('4', 'Jose Alexander', 'Garcia Valladares', '1995-12-12', 'nome@hotmail.com', 'alexan', '5eb0f0f0ec5a736b6931', 4, NULL),
('5', 'Marvin', 'asdsadw', '2019-04-12', 'marvin@asd.es', 'marvin215', '7c4a8d09ca3762af61e59520943dc26494f8941b', 4, NULL);
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `usuario`
--
CREATE TABLE IF NOT EXISTS `usuario` (
`IdUsuario` varchar(5) COLLATE utf8_spanish_ci NOT NULL,
`TempId` varchar(5) COLLATE utf8_spanish_ci NOT NULL,
`Credenciales` text COLLATE utf8_spanish_ci,
`Direccion` varchar(140) COLLATE utf8_spanish_ci NOT NULL,
`DUI` varchar(9) COLLATE utf8_spanish_ci NOT NULL,
`NIT` varchar(10) COLLATE utf8_spanish_ci DEFAULT NULL,
`telefono1` varchar(8) COLLATE utf8_spanish_ci NOT NULL,
`telefono2` varchar(8) COLLATE utf8_spanish_ci DEFAULT NULL,
`Rating` int(1) DEFAULT NULL,
`Empresa` varchar(5) COLLATE utf8_spanish_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci;
--
-- Volcado de datos para la tabla `usuario`
--
INSERT INTO `usuario` (`IdUsuario`, `TempId`, `Credenciales`, `Direccion`, `DUI`, `NIT`, `telefono1`, `telefono2`, `Rating`, `Empresa`) VALUES
('0', '0', 'Profesional experto', 'San Salvador', '233333333', '2312321312', '22222222', '22222222', 0, '0'),
('1', '1', 'sdasdasd', 'asdsdasd', '131231231', '2321313213', '12312321', '23232323', 0, ''),
('2', '3', 'Credencial goes here', 'Dirrecion goes here', '123213213', '1232132131', '23232323', '23232323', 0, ''),
('3', '2', 'New at the company mates', 'sasdasasjdlkasjdkl', '123123232', '1223213213', '23232332', '23232323', 0, '');
--
-- Índices para tablas volcadas
--
--
-- Indices de la tabla `asociados`
--
ALTER TABLE `asociados`
ADD PRIMARY KEY (`idasocio`), ADD KEY `socio1` (`socio1`,`socio2`);
--
-- Indices de la tabla `convenio`
--
ALTER TABLE `convenio`
ADD PRIMARY KEY (`idconvenio`);
--
-- Indices de la tabla `empresa`
--
ALTER TABLE `empresa`
ADD PRIMARY KEY (`IdEmpresa`), ADD UNIQUE KEY `Dueño` (`dueño`);
--
-- Indices de la tabla `empresamen`
--
ALTER TABLE `empresamen`
ADD PRIMARY KEY (`idmensaje`), ADD KEY `idempresa` (`idempresa`);
--
-- Indices de la tabla `empresasolicitud`
--
ALTER TABLE `empresasolicitud`
ADD PRIMARY KEY (`idsolicitud`), ADD KEY `idempresa` (`idempresa`,`idusuario`), ADD KEY `idempresa_2` (`idempresa`), ADD KEY `idusuario` (`idusuario`), ADD KEY `idempresa_3` (`idempresa`), ADD KEY `idusuario_2` (`idusuario`);
--
-- Indices de la tabla `etiqueta`
--
ALTER TABLE `etiqueta`
ADD PRIMARY KEY (`IdEtiqueta`), ADD KEY `Idinmueble` (`Idinmueble`);
--
-- Indices de la tabla `inmueble`
--
ALTER TABLE `inmueble`
ADD PRIMARY KEY (`IdInmueble`), ADD KEY `Dueno` (`Dueno`);
--
-- Indices de la tabla `mensaje`
--
ALTER TABLE `mensaje`
ADD PRIMARY KEY (`idmensaje`), ADD KEY `remitente` (`remitente`,`destinatario`), ADD KEY `remitente_2` (`remitente`), ADD KEY `destinatario` (`destinatario`);
--
-- Indices de la tabla `tbusuario`
--
ALTER TABLE `tbusuario`
ADD PRIMARY KEY (`idUsuario`), ADD UNIQUE KEY `usuario` (`usuario`), ADD UNIQUE KEY `usuario_2` (`usuario`), ADD UNIQUE KEY `correo` (`correo`);
--
-- Indices de la tabla `usuario`
--
ALTER TABLE `usuario`
ADD PRIMARY KEY (`IdUsuario`), ADD UNIQUE KEY `TempId` (`TempId`), ADD UNIQUE KEY `TempId_2` (`TempId`), ADD KEY `Empresa` (`Empresa`);
--
-- AUTO_INCREMENT de las tablas volcadas
--
--
-- AUTO_INCREMENT de la tabla `asociados`
--
ALTER TABLE `asociados`
MODIFY `idasocio` int(5) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=23;
--
-- AUTO_INCREMENT de la tabla `mensaje`
--
ALTER TABLE `mensaje`
MODIFY `idmensaje` int(5) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=8;
--
-- Restricciones para tablas volcadas
--
--
-- Filtros para la tabla `empresa`
--
ALTER TABLE `empresa`
ADD CONSTRAINT `empresa_ibfk_1` FOREIGN KEY (`dueño`) REFERENCES `usuario` (`IdUsuario`);
--
-- Filtros para la tabla `empresamen`
--
ALTER TABLE `empresamen`
ADD CONSTRAINT `empresamen_ibfk_1` FOREIGN KEY (`idempresa`) REFERENCES `empresa` (`IdEmpresa`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Filtros para la tabla `empresasolicitud`
--
ALTER TABLE `empresasolicitud`
ADD CONSTRAINT `empresasolicitud_ibfk_1` FOREIGN KEY (`idempresa`) REFERENCES `empresa` (`IdEmpresa`),
ADD CONSTRAINT `empresasolicitud_ibfk_2` FOREIGN KEY (`idusuario`) REFERENCES `usuario` (`IdUsuario`);
--
-- Filtros para la tabla `etiqueta`
--
ALTER TABLE `etiqueta`
ADD CONSTRAINT `etiqueta_ibfk_1` FOREIGN KEY (`Idinmueble`) REFERENCES `inmueble` (`IdInmueble`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Filtros para la tabla `inmueble`
--
ALTER TABLE `inmueble`
ADD CONSTRAINT `inmueble_ibfk_1` FOREIGN KEY (`Dueno`) REFERENCES `usuario` (`IdUsuario`) ON DELETE CASCADE ON UPDATE CASCADE;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
-------------------------------------------------------------------------------------
-- Instruções SQL DML ---------------------------------------------------------------
---VIEWS------------------------------------------------------------------
-- VIEW PARA REALIZAR A SOMA DO GASTO TOTAL COM PLANOS GOVERNAMENTAL
CREATE VIEW
GastoTotalPlanoGovernamental
AS(
SELECT
to_char((SUM(valorRecebido) / 100), 'L9G999G990D99') as GastoTotal
FROM PlanoGovernamentalAprovado
)
SELECT * from GastoTotalPlanoGovernamental
DROP VIEW GastoTotalPlanoGovernamental
-- VIEW PARA OBTER O GASTO TOTAL COM O PLANO GOVERNAMENTAL AGRUPADOS POR ESFERA GOV.
CREATE VIEW
GastoTotalPlanoGovernamentalPorEsferaGov
AS(
SELECT
eg.nome as EsferaGov,
to_char((SUM(pga.valorRecebido) / 100), 'L9G999G990D99') as GastoTotal
FROM PlanoGovernamentalAprovado pga
INNER JOIN Escola e ON e.inep = pga.inepEscola
INNER JOIN EsferaGovernamental eg ON eg.id = e.esferaGovId
GROUP BY EsferaGov
ORDER BY GastoTotal DESC
)
SELECT * from GastoTotalPlanoGovernamentalPorEsferaGov
DROP VIEW GastoTotalPlanoGovernamentalPorEsferaGov
-- VIEW PARA OBTER O GASTO TOTAL COM O PLANO GOVERNAMENTAL AGRUPADOS POR ESTADO.
CREATE VIEW
GastoTotalPlanoGovernamentalPorEstado
AS(
SELECT
et.nome as Estado,
to_char((SUM(pga.valorRecebido) / 100), 'L9G999G990D99') as GastoTotal
FROM PlanoGovernamentalAprovado pga
INNER JOIN Escola e ON e.inep = pga.inepEscola
INNER JOIN Municipio m ON m.id = e.municipioId
INNER JOIN Estado et ON et.uf = m.uf
GROUP BY Estado
ORDER BY GastoTotal DESC
)
SELECT * from GastoTotalPlanoGovernamentalPorEstado
DROP VIEW GastoTotalPlanoGovernamentalPorEstado
-- VIEW PARA OBTER O VALOR RECEBIDO POR CADA ESCOLA EM ORDEM DECRESCENTE
CREATE VIEW
ValorRecebidoPorEscola
AS(
SELECT
e.nome as Escola,
to_char((valorRecebido / 100), 'L9G999G990D99') as ValorRecebido
FROM PlanoGovernamentalAprovado pga
INNER JOIN Escola e ON e.inep = pga.inepEscola
ORDER BY ValorRecebido DESC
)
SELECT * from ValorRecebidoPorEscola
DROP VIEW ValorRecebidoPorEscola
-- VIEW PARA OBTER O VALOR RECEBIDO POR ESCOLA DA ZONA RURAL
CREATE VIEW
ValorRecebidoPorEscolaRural
AS(
SELECT
e.nome as Escola,
to_char((valorRecebido / 100), 'L9G999G990D99') as ValorRecebido,
l.nome
FROM PlanoGovernamentalAprovado pga
INNER JOIN Escola e ON e.inep = pga.inepEscola
INNER JOIN Localizacao l ON l.id = e.localizacaoId
WHERE l.nome = 'RURAL'
ORDER BY ValorRecebido DESC
)
SELECT * from ValorRecebidoPorEscolaRural
DROP VIEW ValorRecebidoPorEscolaRural
-- VIEW PARA OBTER O VALOR RECEBIDO POR ESCOLA DA ZONA URBANA
CREATE VIEW
ValorRecebidoPorEscolaUrbana
AS(
SELECT
e.nome as Escola,
to_char((valorRecebido / 100), 'L9G999G990D99') as ValorRecebido,
l.nome
FROM PlanoGovernamentalAprovado pga
INNER JOIN Escola e ON e.inep = pga.inepEscola
INNER JOIN Localizacao l ON l.id = e.localizacaoId
WHERE l.nome = 'URBANA'
ORDER BY ValorRecebido DESC
)
SELECT * from ValorRecebidoPorEscolaUrbana
DROP VIEW ValorRecebidoPorEscolaUrbana
-- VIEW PARA OBTER O TOTAL DE ESCOLAS DA ZONA URBANA E RURAL SEPARADOS
CREATE VIEW
TotalDeEscolasUrbanaERural
AS(
SELECT
l.nome,
COUNT(e.*) as Escolas
FROM PlanoGovernamentalAprovado pga
INNER JOIN Escola e ON e.inep = pga.inepEscola
INNER JOIN Localizacao l ON l.id = e.localizacaoId
GROUP BY l.nome
)
SELECT * from TotalDeEscolasUrbanaERural
DROP VIEW TotalDeEscolasUrbanaERural
-- VIEW PARA OBTER A QUANTIDADE DE ESCOLAS BENEFICIADAS POR PLANO GOVERNAMENTAL
CREATE VIEW
QtdEscolaBeneficiadasPorPlanoGovernamental
AS(
SELECT
pg.nome as PlanoGovernamental,
COUNT(pga.*) as EscolasContempladas
FROM PlanoGovernamentalAprovado pga
INNER JOIN PlanoGovernamental pg ON pg.id = pga.planoGovId
GROUP BY 1
ORDER BY EscolasContempladas DESC
)
SELECT * from QtdEscolaBeneficiadasPorPlanoGovernamental
DROP VIEW QtdEscolaBeneficiadasPorPlanoGovernamental
-- VIEW PARA OBTER AS ESCOLAS QUE NÃO FORAM BENEFICIADAS COM PLANO GOVERNAMENTAL
CREATE VIEW
EscolasNaoBeneficiadasComPlanoGovernamental
AS(
SELECT
e.nome as Escola
FROM PlanoGovernamentalAprovado pga
RIGHT JOIN Escola e ON e.inep = pga.inepEscola
WHERE pga.inepEscola IS NULL
)
SELECT * from EscolasNaoBeneficiadasComPlanoGovernamental
DROP VIEW EscolasNaoBeneficiadasComPlanoGovernamental
-- VIEW PARA OBTER OS PLANOS GOVERNAMENTAIS QUE NÃO FORAM IMPLANTADOS EM UMA ESCOLA
CREATE VIEW
PlanoGovernamentalNaoImplamtados
AS(
SELECT
pg.nome as PlanoGovernamental
FROM PlanoGovernamentalAprovado pga
RIGHT JOIN PlanoGovernamental pg ON pg.id = pga.planoGovId
WHERE pga.planoGovId IS NULL
)
SELECT * from PlanoGovernamentalNaoImplamtados
DROP VIEW PlanoGovernamentalNaoImplamtados |
-- phpMyAdmin SQL Dump
-- version 4.8.0.1
-- https://www.phpmyadmin.net/
--
-- Host: db
-- Generation Time: May 19, 2018 at 11:15 AM
-- Server version: 5.6.40
-- PHP Version: 7.2.4
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: `extension`
--
-- --------------------------------------------------------
--
-- Table structure for table `resource`
--
CREATE TABLE `resource` (
`id` int(11) UNSIGNED NOT NULL,
`type` varchar(50) NOT NULL,
`name` varchar(100) NOT NULL,
`capacity` int(11) UNSIGNED NOT NULL,
`remaining` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Triggers `resource`
--
DELIMITER $$
CREATE TRIGGER `Set the remaining counter right after insert` AFTER UPDATE ON `resource` FOR EACH ROW update resource
set remaining = capacity
where id = NEW.id
$$
DELIMITER ;
--
-- Indexes for dumped tables
--
--
-- Indexes for table `resource`
--
ALTER TABLE `resource`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `resource`
--
ALTER TABLE `resource`
MODIFY `id` int(11) UNSIGNED 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 */;
|
CREATE DATABASE IF NOT EXISTS `hu_sprint` /*!40100 DEFAULT CHARACTER SET utf8 */;
USE `hu_sprint`;
-- MySQL dump 10.13 Distrib 5.7.12, for Win64 (x86_64)
--
-- Host: localhost Database: hu_sprint
-- ------------------------------------------------------
-- Server version 5.7.13-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 `user_submission`
--
DROP TABLE IF EXISTS `user_submission`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `user_submission` (
`Submission_id` int(11) NOT NULL AUTO_INCREMENT,
`Submission_date` datetime NOT NULL,
`Submission_amount` int(10) DEFAULT NULL,
`Submission_To` varchar(45) DEFAULT NULL,
`student_Id` decimal(10,0) NOT NULL,
PRIMARY KEY (`Submission_id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `user_submission`
--
LOCK TABLES `user_submission` WRITE;
/*!40000 ALTER TABLE `user_submission` DISABLE KEYS */;
INSERT INTO `user_submission` VALUES (1,'2018-01-05 18:00:00',500,'ALK',12346),(2,'2018-05-08 08:00:00',500,'ALB',12346),(3,'2018-01-09 15:00:00',1000,'ALK',12347),(4,'2018-02-08 10:00:00',100,'ALB',12345);
/*!40000 ALTER TABLE `user_submission` 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 2019-01-27 20:19:59
|
-- phpMyAdmin SQL Dump
-- version 4.4.15.9
-- https://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Apr 03, 2019 at 05:21 PM
-- Server version: 5.6.37
-- PHP Version: 5.6.31
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: `Asset Management`
--
-- --------------------------------------------------------
--
-- Table structure for table `ASSETS_CUSTOMERS`
--
CREATE TABLE IF NOT EXISTS `ASSETS_CUSTOMERS` (
`Customer_Name` varchar(100) COLLATE utf32_bin NOT NULL,
`PK Customer_ID` int(11) NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf32 COLLATE=utf32_bin;
--
-- Dumping data for table `ASSETS_CUSTOMERS`
--
INSERT INTO `ASSETS_CUSTOMERS` (`Customer_Name`, `PK Customer_ID`) VALUES
('Paul', 3);
-- --------------------------------------------------------
--
-- Table structure for table `ASSETS_EVENTS`
--
CREATE TABLE IF NOT EXISTS `ASSETS_EVENTS` (
`PK_Event_ID` int(11) NOT NULL,
`FK_Customer_ID` int(11) NOT NULL,
`FK_Register_ID` int(11) NOT NULL,
`Event_Type` varchar(100) COLLATE utf32_bin NOT NULL,
`Event_Date` date NOT NULL,
`Event_Amount` double NOT NULL,
`Event_Description` varchar(100) COLLATE utf32_bin NOT NULL,
`Invoice_Paid` float NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf32 COLLATE=utf32_bin;
--
-- Dumping data for table `ASSETS_EVENTS`
--
INSERT INTO `ASSETS_EVENTS` (`PK_Event_ID`, `FK_Customer_ID`, `FK_Register_ID`, `Event_Type`, `Event_Date`, `Event_Amount`, `Event_Description`, `Invoice_Paid`) VALUES
(1, 3, 0, 'Vente', '2019-02-06', 200, 'Vraiment compliquer', 50),
(5, 3, 0, 'ee', '2019-04-03', 0, 'ee', 0),
(6, 3, 0, 'ee', '2019-04-03', 0, 'ee', 0),
(7, 3, 0, 'ee', '2019-04-03', 0, 'ee', 0),
(8, 3, 0, 'poupou', '2019-04-03', 60, 'c gay le poupou', 40);
-- --------------------------------------------------------
--
-- Table structure for table `ASSET_REGISTER`
--
CREATE TABLE IF NOT EXISTS `ASSET_REGISTER` (
`PK_Asset_Register_ID` int(11) NOT NULL,
`Asset_Name` varchar(100) COLLATE utf32_bin NOT NULL,
`Type` varchar(100) COLLATE utf32_bin NOT NULL,
`physicalPresence` varchar(100) COLLATE utf32_bin NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf32 COLLATE=utf32_bin;
--
-- Dumping data for table `ASSET_REGISTER`
--
INSERT INTO `ASSET_REGISTER` (`PK_Asset_Register_ID`, `Asset_Name`, `Type`, `physicalPresence`) VALUES
(5, 'axcvbnmrjy junior le deuxiwemwe', '', 'Intangible'),
(7, 'Nintendo', 'Actif financier', 'Tangible'),
(8, 'Manon', 'Actif financier', 'Tangible'),
(9, 'e', 'Actif fixe', 'Tangible'),
(10, 'abc', 'Actif courant', 'Tangible'),
(11, 'Essaie', 'Actif fixe', 'Intangible');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `ASSETS_CUSTOMERS`
--
ALTER TABLE `ASSETS_CUSTOMERS`
ADD PRIMARY KEY (`PK Customer_ID`);
--
-- Indexes for table `ASSETS_EVENTS`
--
ALTER TABLE `ASSETS_EVENTS`
ADD PRIMARY KEY (`PK_Event_ID`),
ADD KEY `FK Customer_ID` (`FK_Customer_ID`),
ADD KEY `PK Event_ID` (`PK_Event_ID`),
ADD KEY `FK_Register_ID` (`FK_Register_ID`);
--
-- Indexes for table `ASSET_REGISTER`
--
ALTER TABLE `ASSET_REGISTER`
ADD PRIMARY KEY (`PK_Asset_Register_ID`),
ADD KEY `PK_Asset_Register_ID` (`PK_Asset_Register_ID`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `ASSETS_CUSTOMERS`
--
ALTER TABLE `ASSETS_CUSTOMERS`
MODIFY `PK Customer_ID` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT for table `ASSETS_EVENTS`
--
ALTER TABLE `ASSETS_EVENTS`
MODIFY `PK_Event_ID` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=9;
--
-- AUTO_INCREMENT for table `ASSET_REGISTER`
--
ALTER TABLE `ASSET_REGISTER`
MODIFY `PK_Asset_Register_ID` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=12;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `ASSETS_EVENTS`
--
ALTER TABLE `ASSETS_EVENTS`
ADD CONSTRAINT `FKC_EVENTS_CUSTOMERS` FOREIGN KEY (`FK_Customer_ID`) REFERENCES `ASSETS_CUSTOMERS` (`PK Customer_ID`) ON DELETE CASCADE ON UPDATE CASCADE;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
CREATE TABLE IF NOT EXISTS blocked_ipv4 (
id INT AUTO_INCREMENT PRIMARY KEY,
ipv4 VARCHAR(15) NOT NULL,
reason VARCHAR(512) NOT NULL
)
|
INSERT INTO public.users(userid,username,email,password,enabled)VALUES (1,'jack','abc@abc.com','jack', 1);
INSERT INTO public.user_roles (user_role_id,userid, role)VALUES (1,1, 'ROLE_USER');
INSERT INTO public.users(userid,username,email,password,enabled)VALUES (2,'peter','abc@abc.com','peter', 1);
INSERT INTO public.user_roles (user_role_id,userid, role)VALUES (2,2, 'ROLE_USER'); |
insert into avatars (avatar_base_type_id, level, skin, hair, picture_url, night_background_url, day_background_url, status, text_id, created_by, created_date)
values
(4, 1, 3, 1, 's3h1.png', 'night1.png', 'day1.png', 'ACTIVE', 1, 1, current_timestamp),
(4, 2, 3, 1, 's3h1.png', 'night1.png', 'day1.png', 'ACTIVE', 1, 1, current_timestamp),
(4, 3, 3, 1, 's3h1.png', 'night1.png', 'day1.png', 'ACTIVE', 1, 1, current_timestamp),
(4, 4, 3, 1, 's3h1.png', 'night1.png', 'day1.png', 'ACTIVE', 1, 1, current_timestamp),
(4, 5, 3, 1, 's3h1.png', 'night1.png', 'day1.png', 'ACTIVE', 1, 1, current_timestamp),
(4, 6, 3, 1, 's3h1.png', 'night1.png', 'day1.png', 'ACTIVE', 1, 1, current_timestamp),
(4, 7, 3, 1, 's3h1.png', 'night1.png', 'day1.png', 'ACTIVE', 1, 1, current_timestamp),
(4, 8, 3, 1, 's3h1.png', 'night1.png', 'day1.png', 'ACTIVE', 1, 1, current_timestamp),
(4, 9, 3, 1, 's3h1.png', 'night1.png', 'day1.png', 'ACTIVE', 1, 1, current_timestamp),
(4, 10, 3, 1, 's3h1.png', 'night10.png', 'day10.png', 'ACTIVE', 1, 1, current_timestamp),
(4, 11, 3, 1, 's3h1.png', 'night10.png', 'day10.png', 'ACTIVE', 1, 1, current_timestamp),
(4, 12, 3, 1, 's3h1.png', 'night10.png', 'day10.png', 'ACTIVE', 1, 1, current_timestamp),
(4, 13, 3, 1, 's3h1.png', 'night10.png', 'day10.png', 'ACTIVE', 1, 1, current_timestamp),
(4, 14, 3, 1, 's3h1.png', 'night10.png', 'day10.png', 'ACTIVE', 1, 1, current_timestamp),
(4, 15, 3, 1, 's3h1.png', 'night10.png', 'day10.png', 'ACTIVE', 1, 1, current_timestamp),
(4, 16, 3, 1, 's3h1.png', 'night10.png', 'day10.png', 'ACTIVE', 1, 1, current_timestamp),
(4, 17, 3, 1, 's3h1.png', 'night10.png', 'day10.png', 'ACTIVE', 1, 1, current_timestamp),
(4, 18, 3, 1, 's3h1.png', 'night10.png', 'day10.png', 'ACTIVE', 1, 1, current_timestamp),
(4, 19, 3, 1, 's3h1.png', 'night10.png', 'day10.png', 'ACTIVE', 1, 1, current_timestamp),
(4, 20, 3, 1, 's3h1.png', 'night20.png', 'day20.png', 'ACTIVE', 1, 1, current_timestamp),
(4, 21, 3, 1, 's3h1.png', 'night20.png', 'day20.png', 'ACTIVE', 1, 1, current_timestamp),
(4, 22, 3, 1, 's3h1.png', 'night20.png', 'day20.png', 'ACTIVE', 1, 1, current_timestamp),
(4, 23, 3, 1, 's3h1.png', 'night20.png', 'day20.png', 'ACTIVE', 1, 1, current_timestamp),
(4, 24, 3, 1, 's3h1.png', 'night20.png', 'day20.png', 'ACTIVE', 1, 1, current_timestamp),
(4, 25, 3, 1, 's3h1.png', 'night20.png', 'day20.png', 'ACTIVE', 1, 1, current_timestamp),
(4, 26, 3, 1, 's3h1.png', 'night20.png', 'day20.png', 'ACTIVE', 1, 1, current_timestamp),
(4, 27, 3, 1, 's3h1.png', 'night20.png', 'day20.png', 'ACTIVE', 1, 1, current_timestamp),
(4, 28, 3, 1, 's3h1.png', 'night20.png', 'day20.png', 'ACTIVE', 1, 1, current_timestamp),
(4, 29, 3, 1, 's3h1.png', 'night20.png', 'day20.png', 'ACTIVE', 1, 1, current_timestamp),
(4, 30, 3, 1, 's3h1.png', 'night30.png', 'day30.png', 'ACTIVE', 1, 1, current_timestamp),
(4, 31, 3, 1, 's3h1.png', 'night30.png', 'day30.png', 'ACTIVE', 1, 1, current_timestamp),
(4, 32, 3, 1, 's3h1.png', 'night30.png', 'day30.png', 'ACTIVE', 1, 1, current_timestamp),
(4, 33, 3, 1, 's3h1.png', 'night30.png', 'day30.png', 'ACTIVE', 1, 1, current_timestamp),
(4, 34, 3, 1, 's3h1.png', 'night30.png', 'day30.png', 'ACTIVE', 1, 1, current_timestamp),
(4, 35, 3, 1, 's3h1.png', 'night30.png', 'day30.png', 'ACTIVE', 1, 1, current_timestamp),
(4, 36, 3, 1, 's3h1.png', 'night30.png', 'day30.png', 'ACTIVE', 1, 1, current_timestamp),
(4, 37, 3, 1, 's3h1.png', 'night30.png', 'day30.png', 'ACTIVE', 1, 1, current_timestamp),
(4, 38, 3, 1, 's3h1.png', 'night30.png', 'day30.png', 'ACTIVE', 1, 1, current_timestamp),
(4, 39, 3, 1, 's3h1.png', 'night30.png', 'day30.png', 'ACTIVE', 1, 1, current_timestamp),
(4, 40, 3, 1, 's3h1.png', 'night40.png', 'day40.png', 'ACTIVE', 1, 1, current_timestamp),
(4, 41, 3, 1, 's3h1.png', 'night40.png', 'day40.png', 'ACTIVE', 1, 1, current_timestamp),
(4, 42, 3, 1, 's3h1.png', 'night40.png', 'day40.png', 'ACTIVE', 1, 1, current_timestamp),
(4, 43, 3, 1, 's3h1.png', 'night40.png', 'day40.png', 'ACTIVE', 1, 1, current_timestamp),
(4, 44, 3, 1, 's3h1.png', 'night40.png', 'day40.png', 'ACTIVE', 1, 1, current_timestamp),
(4, 45, 3, 1, 's3h1.png', 'night40.png', 'day40.png', 'ACTIVE', 1, 1, current_timestamp),
(4, 46, 3, 1, 's3h1.png', 'night40.png', 'day40.png', 'ACTIVE', 1, 1, current_timestamp),
(4, 47, 3, 1, 's3h1.png', 'night40.png', 'day40.png', 'ACTIVE', 1, 1, current_timestamp),
(4, 48, 3, 1, 's3h1.png', 'night40.png', 'day40.png', 'ACTIVE', 1, 1, current_timestamp),
(4, 49, 3, 1, 's3h1.png', 'night40.png', 'day40.png', 'ACTIVE', 1, 1, current_timestamp);
|
use `edufood`;
CREATE TABLE `food_types` (
`id` INT auto_increment NOT NULL,
`name` varchar(128) NOT NULL,
`icon` varchar(128) NOT NULL,
PRIMARY KEY (`id`)
);
ALTER TABLE `foods`
ADD COLUMN `food_type_id` INT NOT NULL after `place_id`, add CONSTRAINT `fk_food food_types`
FOREIGN KEY (`food_type_id`) REFERENCES `food_types` (`id`);
INSERT INTO`food_types` (`name`, `icon`) VALUES ('Coffee', 'hot_beverage.png'), ('Steak', 'steaks.png'),
('Burger', 'burgers.png'), ('Bakery', 'bakery.png'),
('Dessert', 'dessert.png'), ('Sushi', 'sushi.png'),
('Sea food', 'sea_food.png'), ('Pasta', 'pasta.png'),
('Cocktail', 'cocktail.png'), ('Pizza', 'pizza.png'),
('Fast food', 'fast_food.png'), ('Salad', 'salad.png');
|
--oneops accounts
CREATE ROLE kloopz LOGIN
ENCRYPTED PASSWORD 'md5f213e95a1ff83ef692fda9aa87199981'
NOSUPERUSER INHERIT CREATEDB CREATEROLE REPLICATION;
CREATE DATABASE kloopzapp
WITH OWNER = kloopz
ENCODING = 'UTF8'
TABLESPACE = pg_default
CONNECTION LIMIT = 1000;
--oneops cms
CREATE ROLE kloopzcm LOGIN
ENCRYPTED PASSWORD 'md5bd21eadfdda4b653e92100ab7cf341d2'
SUPERUSER INHERIT CREATEDB CREATEROLE REPLICATION;
CREATE DATABASE kloopzdb
WITH OWNER = kloopzcm
ENCODING = 'UTF8'
TABLESPACE = pg_default
CONNECTION LIMIT = 1000;
--activiti schema
CREATE ROLE activiti LOGIN
ENCRYPTED PASSWORD 'md529396e43ae92947c301a806c535bb7b9'
NOSUPERUSER INHERIT CREATEDB CREATEROLE REPLICATION;
CREATE DATABASE activitidb
WITH OWNER = activiti
ENCODING = 'UTF8'
TABLESPACE = pg_default
CONNECTION LIMIT = 1000;
|
/*
Queries used for Tableau Project
*/
USE SQLProject
-- 1.
SELECT
SUM([new_cases]) AS [Total Cases],
SUM(CAST([new_deaths] AS INT)) AS [Total Deaths],
SUM(CAST([new_deaths] AS INT))/SUM([New_Cases])*100 AS [Death Percentage]
FROM [SQLProject]..[Covid_Death]
WHERE [continent] IS NOT NULL
ORDER BY 1,2
-- 2.
SELECT
[location],
SUM(CAST([new_deaths] AS INT)) AS [Total Deaths]
FROM [SQLProject]..[Covid_Death]
WHERE [continent] IS NULL
AND [location] NOT IN ('World', 'European Union', 'International')
GROUP BY [location]
ORDER BY [Total Deaths] DESC
-- 3.
SELECT
[location],
[population],
MAX([total_cases]) AS [Highest Count],
MAX([total_cases]/[population]*100) AS [Infection Percentage]
FROM [SQLProject]..[Covid_Death]
WHERE [continent] IS NOT NULL
GROUP BY [location], [population]
ORDER BY [Infection Percentage] DESC
-- 4.
SELECT
[location],
[population],
[date],
MAX([total_cases]) AS [Highest Count],
MAX([total_cases]/[population]*100) AS [Infection Percentage]
FROM [SQLProject]..[Covid_Death]
WHERE [continent] IS NOT NULL
GROUP BY [location], [population], [date]
ORDER BY [Infection Percentage] DESC
-- 5
SELECT
[continent],
[location],
[date],
[population],
[new_cases],
[total_cases],
[new_deaths],
[total_deaths]
FROM [SQLProject]..[Covid_Death]
WHERE [continent] IS NOT NULL
ORDER BY [continent], [location] |
ALTER TABLE `access_roles` CHANGE `area_level` `area_level` ENUM('world','country','state','city','department') CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL COMMENT 'These will be prioritize as Wolrd > Country > State > City > Department';
ALTER TABLE `access_roles` DROP `name`;
|
INSERT INTO livros VALUES (9780134685991, 'Effective Java', 3, 'Inglês', '18-12-2017', '06-03-2019');
INSERT INTO livros VALUES (9789726081890, '1984', 5, 'Português', '08-06-1949', '06-03-2019');
INSERT INTO livros VALUES (9789726081975, 'A quinta dos animais', 7, 'Português', '17-08-1945', '06-03-2019');
INSERT INTO livros VALUES (9780007448036, 'A game of thrones', 9, 'Inglês', '06-08-1996', '06-03-2019');
INSERT INTO livros VALUES (9780553579901, 'A clash of kings', 9, 'Inglês', '16-11-1998', '06-03-2019');
INSERT INTO autores VALUES ('Joshua', 'Bloch', 'M', '28-08-1961');
INSERT INTO autores VALUES ('George', 'Orwell', 'M', '25-06-1903');
INSERT INTO autores VALUES ('George R. R.', 'Martin', 'M', '20-09-1948');
INSERT INTO editoras VALUES ('Addison-Wesley Professional', '13-05-1942', 'Estados Unidos da América');
INSERT INTO editoras VALUES ('HarperCollins Publishers', '24-02-1989', 'Estados Unidos da América');
INSERT INTO editoras VALUES ('Antígona', '01-06-1979', 'Portugal');
INSERT INTO nacionalidades VALUES ('Joshua', 'Bloch', 'Americana');
INSERT INTO nacionalidades VALUES ('George', 'Orwell', 'Britânica');
INSERT INTO nacionalidades VALUES ('George R. R.', 'Martin', 'Americana');
INSERT INTO livros_autores VALUES (9789726081890, 'George', 'Orwell');
INSERT INTO livros_autores VALUES (9789726081975, 'George', 'Orwell');
INSERT INTO livros_autores VALUES (9780007448036, 'George R. R.', 'Martin');
INSERT INTO livros_autores VALUES (9780553579901, 'George R. R.', 'Martin');
INSERT INTO livros_autores VALUES (9780134685991, 'Joshua', 'Bloch');
INSERT INTO livros_editoras VALUES (9780134685991, 'Addison-Wesley Professional');
INSERT INTO livros_editoras VALUES (9780007448036, 'HarperCollins Publishers');
INSERT INTO livros_editoras VALUES (9780553579901, 'HarperCollins Publishers');
INSERT INTO livros_editoras VALUES (9789726081890, 'Antígona');
INSERT INTO livros_editoras VALUES (9789726081975, 'Antígona'); |
create table userinfo(
id number(10) not null,
firstname varchar(40) not null,
lastname varchar(40) not null,
gender number(2) not null,
dateOfBirth date not null,
country varchar(40) not null,
Constraint userinfo_pk primary key(id)
);
create table userrole(
id number(10) not null,
name varchar(40) not null,
Constraint role_pk primary key(id)
);
create table appUser(
id number(10) not null,
email varchar(40) not null,
password varchar(40) not null,
userInfoId number(10) not null,
roleId number(10) not null,
Constraint user_pk primary key(id),
Foreign key (userInfoId) references userinfo(id),
Foreign key (roleId) references userrole(id)
);
create table hotelInfo(
id number(10) not null,
title varchar(30) not null,
description varchar(30) not null,
countOfStars number(10) not null,
Constraint hotelInfo_pk primary key(id)
);
create table hotelAddress(
id number(10) not null,
street varchar(30) not null,
city varchar(30) not null,
country varchar(30) not null,
houseNumber number(5) not null,
Constraint hotelAddress_pk primary key(id)
);
create table hotel(
id number(10) not null,
hotelInfoId number(10) not null,
hotelAddressId number(10) not null,
Constraint hotel_pk primary key(id),
Foreign key (hotelInfoId) references hotelInfo(id),
Foreign key (hotelAddressId) references hotelAddress(id)
);
create table roomType(
id number(10) not null,
name varchar(40) not null,
Constraint roomType_pk primary key(id)
);
create table room(
id number(10) not null,
floor number(4) not null,
numberOfRoom number(10) not null,
hotelId number(10) not null,
roomTypeId number(10) not null,
Constraint room_pk primary key(id),
Foreign key (hotelId) references hotel(id),
Foreign key (roomTypeId) references roomType(id)
); |
UPDATE mysql.user SET Password=PASSWORD('P@ssword123') WHERE User='root';
FLUSH PRIVILEGES;
|
SELECT
sm.year,
sm.name,
count(*)
FROM sourcemetricsource sms
JOIN sourcemetric sm ON sms."sourceMetric" = sm.id
GROUP BY sm.name, sm.year
ORDER BY sm.year DESC |
SELECT
player_id,
name,
sum(win) as win,
sum(lose) as lose,
sum(save) as save
FROM
pitching p
inner join GAME g on g.game_id=p.game_id
inner join PLAYER pl on p.player_id=pl.id
WHERE
player_id=/*playerId*/
and ((game_date>=/*beginDate*/ and game_date</*todayDate*/)
or (game_date=/*todayDate*/ and game_number<=/*gameNumber*/))
group by player_id; |
Select DEPT_NAME, MAX(BASIC), MIN(BASIC), AVG(BASIC)
From EMP Inner Join DEPARTMENT
ON EMP.DEPT_CODE = DEPARTMENT.DEPT_CODE
Group by EMP.DEPT_CODE;
|
DROP TABLE IF EXISTS {{.scratch_schema}}.mobile_staging_reconciliation{{.entropy}};
CREATE TABLE {{.scratch_schema}}.mobile_staging_reconciliation{{.entropy}}
DISTSTYLE KEY
DISTKEY (_pk)
SORTKEY (_pk)
AS (
WITH events AS (
SELECT
'1' AS _pk,
COUNT(DISTINCT event_id) AS distinct_event_ids,
SUM(CASE WHEN event_name = 'screen_view' THEN 1 END) AS screen_view_rows,
COUNT(DISTINCT CASE WHEN event_name = 'screen_view' THEN event_id END) AS distinct_sv_event_ids,
COUNT(DISTINCT session_id) AS distinct_session_ids,
SUM(CASE WHEN event_index_in_session = 1 THEN 1 END) AS sessions_rows,
COUNT(DISTINCT CASE WHEN event_name = 'screen_view' THEN session_id END) AS distinct_session_ids_w_screen_view,
COUNT(DISTINCT CASE WHEN event_name = 'application_error' THEN event_id END) AS app_error_distinct_event_ids,
SUM(CASE WHEN event_name = 'application_error' THEN 1 END) AS app_error_row_count
FROM {{.scratch_schema}}.mobile_events_staged{{.entropy}}
GROUP BY 1
)
, screen_views AS (
SELECT
'1' AS _pk,
COUNT(DISTINCT event_id) AS distinct_sv_event_ids,
COUNT(DISTINCT screen_view_id) AS distinct_screen_view_ids,
COUNT(DISTINCT session_id) AS distinct_session_ids,
COUNT(*) AS screen_view_rows
FROM {{.scratch_schema}}.mobile_screen_views_staged{{.entropy}}
GROUP BY 1
)
--Not valid if screen views run multiple times to staging.
, screen_view_removed_dupes AS (
SELECT
'1' AS _pk,
COUNT(*) AS removed_screen_view_rows
FROM {{.scratch_schema}}.mobile_sv_screen_view_events{{.entropy}} AS ev
WHERE ev.screen_view_id_index != 1
GROUP BY 1
)
, app_errors AS (
SELECT
'1' AS _pk,
COUNT(DISTINCT event_id) AS distinct_app_errors_event_id,
COUNT(*) AS app_error_rows
FROM {{.scratch_schema}}.mobile_app_errors_staged{{.entropy}}
GROUP BY 1
)
, sessions AS (
SELECT
'1' AS _pk,
COUNT(DISTINCT session_id) AS distinct_session_ids,
SUM(screen_views) AS distinct_screen_view_ids,
COUNT(*) AS sessions_rows,
SUM(app_errors) AS app_errors
FROM {{.scratch_schema}}.mobile_sessions_this_run{{.entropy}}
GROUP BY 1
)
SELECT
e._pk,
NVL(e.screen_view_rows,0) - NVL(sv.screen_view_rows,0) - NVL(svd.removed_screen_view_rows,0) AS ev_to_sv_sv_rows,
NVL(e.distinct_sv_event_ids,0) - NVL(sv.distinct_sv_event_ids,0) AS ev_to_sv_distinct_event_ids,
NVL(e.sessions_rows,0) - NVL(s.sessions_rows,0) AS ev_to_sess_session_rows,
NVL(e.distinct_session_ids,0) - NVL(s.distinct_session_ids,0) AS ev_to_sess_distinct_session_ids,
NVL(e.distinct_session_ids_w_screen_view,0) - NVL(sv.distinct_session_ids,0) AS ev_to_sv_distinct_session_ids,
{{if eq (or .app_errors false) true}}
--Only evaluate if module enabled
NVL(e.app_error_distinct_event_ids,0) - NVL(ae.distinct_app_errors_event_id,0) AS ev_to_ae_distinct_event_ids,
NVL(e.app_error_row_count,0) - NVL(ae.app_error_rows,0) AS ev_to_ae_row_count,
{{else}}
0 AS ev_to_ae_distinct_event_ids,
0 AS ev_to_ae_row_count,
{{end}}
NVL(sv.distinct_screen_view_ids,0) -NVL(s.distinct_screen_view_ids,0) AS sv_to_sess_sv_distinct_screen_view_ids,
NVL(ae.distinct_app_errors_event_id,0) - NVL(s.app_errors,0) AS ae_to_sess_app_errors
FROM events e
LEFT JOIN screen_views sv
ON e._pk = sv._pk
LEFT JOIN screen_view_removed_dupes svd
ON e._pk = svd._pk
LEFT JOIN app_errors ae
ON e._pk = ae._pk
LEFT JOIN sessions s
ON e._pk = s._pk
);
|
ALTER TABLE `cs_exam_history` CHANGE `identity_no` `identity_id` VARCHAR(28) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '身份证号码';
ALTER TABLE `cs_exam_history`
DROP `year`,
DROP `month`,
DROP `day`;
ALTER TABLE `cs_coach` ADD `is_first` INT NOT NULL DEFAULT '0' COMMENT '是否第一次登陆' AFTER `user_id`;
|
-- phpMyAdmin SQL Dump
-- version 4.8.5
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1:3306
-- Generation Time: 29-Maio-2019 às 17:12
-- Versão do servidor: 5.7.26
-- versão do PHP: 7.2.18
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: `upsdatabase`
--
-- --------------------------------------------------------
--
-- Estrutura da tabela `tbl_prod`
--
DROP TABLE IF EXISTS `tbl_prod`;
CREATE TABLE IF NOT EXISTS `tbl_prod` (
`idtbl_prod` int(11) NOT NULL,
`nome_prod` varchar(45) NOT NULL,
`nome_loja` varchar(45) NOT NULL,
`valor_cash` decimal(9,2) DEFAULT NULL,
`valor_credCar` decimal(9,2) DEFAULT NULL,
`data` date NOT NULL,
`cambio` decimal(9,2) NOT NULL,
PRIMARY KEY (`idtbl_prod`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Extraindo dados da tabela `tbl_prod`
--
INSERT INTO `tbl_prod` (`idtbl_prod`, `nome_prod`, `nome_loja`, `valor_cash`, `valor_credCar`, `data`, `cambio`) VALUES
(1, 'RX 580', 'Amazon - BR', '1289.00', '1289.00', '2019-05-22', '1.00'),
(2, 'RX 580', 'Amazon - NA', '184.99', '184.99', '2019-05-22', '4.05'),
(3, 'RX 570', 'Amazon - NA', '488.00', '487.00', '2019-05-23', '4.05'),
(4, 'RX 570', 'Amazon - NA', '200.00', '200.00', '2019-05-24', '4.05'),
(5, 'RX 570', 'Amazon - NA', '600.00', '607.00', '2019-05-22', '4.05'),
(6, 'RX 570', 'Amazon - BR', '100.00', '100.00', '2019-05-24', '4.05'),
(7, 'RX 570', 'Amazon - BR', '200.00', '200.00', '2019-05-23', '1.00'),
(8, 'RX 570', 'Amazon - BR', '400.00', NULL, '2019-02-12', '8.00'),
(9, 'RX 570', 'Amazon - NA', '700.00', NULL, '2019-04-17', '8.00'),
(10, 'RX 570', 'Amazon - NA', '700.00', NULL, '2019-05-14', '8.00'),
(11, 'RX 570', 'Amazon - BR', '500.00', NULL, '2019-05-22', '8.00'),
(12, 'RX 570', 'Amazon - BR', '1000.00', NULL, '2019-09-12', '8.00'),
(13, 'SSD 480gb', 'Americanas', '320.00', NULL, '2019-05-24', '1.00'),
(14, 'SSD 240gb', 'Americanas', '175.00', NULL, '2019-05-24', '1.00'),
(15, 'GTX 1050 Ti', 'Kabum', '950.00', '1000.00', '2019-03-13', '1.00'),
(16, 'GTX 1050 Ti', 'Kabum', '1100.00', '1200.00', '2018-12-11', '1.00'),
(17, 'GTX 1050 Ti', 'Kabum', '900.00', '950.00', '2019-05-24', '1.00'),
(18, 'GTX 1050 Ti', 'Americanas', '1000.00', '1050.00', '2019-05-24', '1.00'),
(19, 'GTX 1050 Ti', 'Americanas', '1200.00', '1250.00', '2019-03-12', '1.00'),
(20, 'SSD 480gb', 'Americanas', '370.00', '400.00', '2019-03-12', '1.00'),
(21, 'SSD 480gb', 'Americanas', '390.00', '420.00', '2019-01-15', '1.00'),
(22, 'SSD 480gb', 'Kabum', '290.00', '320.00', '2019-05-24', '1.00'),
(23, 'SSD 480gb', 'Kabum', '350.00', '370.00', '2019-03-05', '1.00'),
(24, 'SSD 240gb', 'Americanas', '200.00', '230.00', '2019-03-15', '1.00'),
(25, 'SSD 240gb', 'Americanas', '220.00', '250.00', '2019-02-12', '1.00'),
(26, 'SSD 240gb', 'kabum', '170.00', '190.00', '2019-05-24', '1.00'),
(27, 'SSD 240gb', 'kabum', '200.00', '220.00', '2019-03-09', '1.00'),
(28, 'SSD 240gb', 'kabum', '190.00', '210.00', '2019-02-20', '1.00');
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
-- phpMyAdmin SQL Dump
-- version 5.0.2
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Tempo de geração: 12-Out-2020 às 04:19
-- Versão do servidor: 10.4.14-MariaDB
-- versão do PHP: 7.4.9
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 */;
--
-- Banco de dados: `carros`
--
-- --------------------------------------------------------
--
-- Estrutura da tabela `cars`
--
CREATE TABLE `cars` (
`CAR_CODE` int(10) UNSIGNED NOT NULL,
`CAR_YEAR` char(4) NOT NULL,
`CAR_CHASSI` varchar(45) NOT NULL,
`CAR_PLAQUE` char(20) NOT NULL,
`CAR_MODEL_CODE` int(10) UNSIGNED NOT NULL,
`CAR_MANUFACTURER_CODE` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Extraindo dados da tabela `cars`
--
INSERT INTO `cars` (`CAR_CODE`, `CAR_YEAR`, `CAR_CHASSI`, `CAR_PLAQUE`, `CAR_MODEL_CODE`, `CAR_MANUFACTURER_CODE`) VALUES
(18, '3030', '123456', 'QWE-4343', 2, 3),
(19, '2345', '1234567', 'QWE-2335', 1, 2);
-- --------------------------------------------------------
--
-- Estrutura da tabela `manufacturers`
--
CREATE TABLE `manufacturers` (
`MANUFACTURER_CODE` int(11) NOT NULL,
`MANUFACTURER_NAME` varchar(60) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Extraindo dados da tabela `manufacturers`
--
INSERT INTO `manufacturers` (`MANUFACTURER_CODE`, `MANUFACTURER_NAME`) VALUES
(1, 'Chevrolete'),
(3, 'Fiat'),
(2, 'Wolksvagem');
-- --------------------------------------------------------
--
-- Estrutura da tabela `models`
--
CREATE TABLE `models` (
`MODEL_CODE` int(10) UNSIGNED NOT NULL,
`MODEL_NAME` varchar(60) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Extraindo dados da tabela `models`
--
INSERT INTO `models` (`MODEL_CODE`, `MODEL_NAME`) VALUES
(1, 'Golf'),
(2, 'Opala'),
(3, 'Estrada'),
(4, 'F-250');
--
-- Índices para tabelas despejadas
--
--
-- Índices para tabela `cars`
--
ALTER TABLE `cars`
ADD PRIMARY KEY (`CAR_CODE`),
ADD UNIQUE KEY `CARRO_CODIGO_UNIQUE` (`CAR_CODE`),
ADD UNIQUE KEY `CARRO_CHASSI_UNIQUE` (`CAR_CHASSI`),
ADD UNIQUE KEY `CARRO_PLACA_UNIQUE` (`CAR_PLAQUE`),
ADD KEY `fk_carrros_modelo1_idx` (`CAR_MODEL_CODE`),
ADD KEY `fk_carrros_fabricante1_idx` (`CAR_MANUFACTURER_CODE`);
--
-- Índices para tabela `manufacturers`
--
ALTER TABLE `manufacturers`
ADD PRIMARY KEY (`MANUFACTURER_CODE`),
ADD UNIQUE KEY `FABRICANTE_NOME_UNIQUE` (`MANUFACTURER_NAME`),
ADD UNIQUE KEY `MANUFACTURER_CODE_UNIQUE` (`MANUFACTURER_CODE`);
--
-- Índices para tabela `models`
--
ALTER TABLE `models`
ADD PRIMARY KEY (`MODEL_CODE`),
ADD UNIQUE KEY `MODELO_CODIGO_UNIQUE` (`MODEL_CODE`);
--
-- AUTO_INCREMENT de tabelas despejadas
--
--
-- AUTO_INCREMENT de tabela `cars`
--
ALTER TABLE `cars`
MODIFY `CAR_CODE` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=20;
--
-- AUTO_INCREMENT de tabela `manufacturers`
--
ALTER TABLE `manufacturers`
MODIFY `MANUFACTURER_CODE` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT de tabela `models`
--
ALTER TABLE `models`
MODIFY `MODEL_CODE` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- Restrições para despejos de tabelas
--
--
-- Limitadores para a tabela `cars`
--
ALTER TABLE `cars`
ADD CONSTRAINT `fk_carrros_fabricante1` FOREIGN KEY (`CAR_MANUFACTURER_CODE`) REFERENCES `manufacturers` (`MANUFACTURER_CODE`) ON DELETE NO ACTION ON UPDATE NO ACTION,
ADD CONSTRAINT `fk_carrros_modelo1` FOREIGN KEY (`CAR_MODEL_CODE`) REFERENCES `models` (`MODEL_CODE`) ON DELETE NO ACTION ON UPDATE NO ACTION;
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 */;
|
/*
Navicat MySQL Data Transfer
Source Server : eop@localhost
Source Server Version : 50624
Source Host : localhost:3306
Source Database : eop
Target Server Type : MYSQL
Target Server Version : 50624
File Encoding : 65001
Date: 2016-12-15 18:24:50
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for com_roles
-- ----------------------------
DROP TABLE IF EXISTS `com_roles`;
CREATE TABLE `com_roles` (
`rid` int(15) NOT NULL,
`rcode` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '角色code',
`rname` varchar(30) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '角色名称',
`rpcode` varchar(60) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '角色权限识别code',
`rtime` datetime NOT NULL COMMENT '添加时间',
`rstatus` tinyint(2) NOT NULL COMMENT '状态',
PRIMARY KEY (`rid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
/* Formatted on 21/07/2014 18:34:31 (QP5 v5.227.12220.39754) */
CREATE OR REPLACE FORCE VIEW MCRE_OWN.V_MCRE0_APP_PM_VALID
(
ID_UTENTE,
ID_REFERENTE,
COD_COMPARTO,
COD_SNDG,
COD_NDG,
DESC_NOME_CONTROPARTE,
COD_GRUPPO_ECONOMICO,
DESC_GRUPPO_ECONOMICO,
COD_ABI_ISTITUTO,
COD_ABI_CARTOLARIZZATO,
DESC_ISTITUTO,
COD_PERCORSO,
COD_STRUTTURA_COMPETENTE_RG,
DESC_STRUTTURA_COMPETENTE_RG,
COD_STRUTTURA_COMPETENTE_AR,
DESC_STRUTTURA_COMPETENTE_AR,
COD_STRUTTURA_COMPETENTE_FI,
DESC_STRUTTURA_COMPETENTE_FI,
COD_STRUTTURA_COMPETENTE,
DTA_DECORRENZA_STATO,
DTA_SCADENZA_STATO,
DTA_UTENTE_ASSEGNATO,
COD_STATO_PRECEDENTE,
COD_PROCESSO,
SCSB_ACC_TOT,
SCSB_UTI_TOT,
VAL_NUMERO_PIANO,
DTA_VALIDAZIONE,
DTA_SCADENZA,
ID_WORKFLOW,
FLG_PRESA_VISIONE_MODIFICA,
DTA_PRESA_VISIONE_MODIFICA,
FLG_NOTE
)
AS
SELECT -- VG 20140702 cod_tipo_piano diverso da L
a.ID_UTENTE,
a.ID_REFERENTE,
a.COD_COMPARTO,
a.COD_SNDG,
a.COD_NDG,
a.DESC_NOME_CONTROPARTE,
a.COD_GRUPPO_ECONOMICO,
a.DESC_GRUPPO_ECONOMICO,
a.COD_ABI_ISTITUTO,
a.COD_ABI_CARTOLARIZZATO,
a.DESC_ISTITUTO,
a.cod_percorso,
a.COD_STRUTTURA_COMPETENTE_RG,
a.DESC_STRUTTURA_COMPETENTE_RG,
a.COD_STRUTTURA_COMPETENTE_AR,
a.DESC_STRUTTURA_COMPETENTE_AR,
a.COD_STRUTTURA_COMPETENTE_FI,
a.DESC_STRUTTURA_COMPETENTE_FI,
a.COD_STRUTTURA_COMPETENTE,
a.DTA_DECORRENZA_STATO,
a.DTA_SCADENZA_STATO,
a.DTA_UTENTE_ASSEGNATO,
(SELECT cod_macrostato
FROM t_mcre0_app_stati
WHERE cod_microstato = a.COD_STATO_PRECEDENTE)
COD_STATO_PRECEDENTE,
a.COD_PROCESSO,
a.SCSB_ACC_TOT,
a.SCSB_UTI_TOT,
P.ID_PIANO VAL_NUMERO_PIANO,
p.DTA_PIANO_VALIDATO DTA_VALIDAZIONE,
p.DTA_SCADENZA,
ID_WORKFLOW,
P.FLG_PRESA_VISIONE_MODIFICA,
P.DTA_PRESA_VISIONE_MODIFICA,
P.FLG_PIANO_MODIFICATO FLG_NOTE
FROM V_MCRE0_APP_UPD_FIELDS a, T_MCRE0_APP_GEST_PM p
WHERE a.COD_ABI_CARTOLARIZZATO = p.COD_ABI_CARTOLARIZZATO
AND a.COD_NDG = p.COD_NDG
AND a.DTA_DECORRENZA_STATO = P.DTA_DECORRENZA_STATO
AND A.COD_STATO = 'PM'
AND P.FLG_PIANO_ANNULLATO = 'N'
AND P.ID_WORKFLOW IN (15, 20) --piano validato/modificato
AND p.DTA_PIANO_VALIDATO IS NOT NULL
AND COD_TIPO_PIANO != 'L';
|
drop table table11;
drop table table12;
drop table table21;
drop table table31; |
/*
Navicat Premium Data Transfer
Source Server : localhost
Source Server Type : MySQL
Source Server Version : 50721
Source Host : localhost:3306
Source Schema : db0722
Target Server Type : MySQL
Target Server Version : 50721
File Encoding : 65001
Date: 23/10/2019 17:24:57
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for course
-- ----------------------------
DROP TABLE IF EXISTS `course`;
CREATE TABLE `course` (
`cid` int(11) NOT NULL AUTO_INCREMENT,
`cname` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
PRIMARY KEY (`cid`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of course
-- ----------------------------
INSERT INTO `course` VALUES (1, 'JAVA');
INSERT INTO `course` VALUES (2, 'HTML');
INSERT INTO `course` VALUES (3, 'DATABASE');
-- ----------------------------
-- Table structure for husband
-- ----------------------------
DROP TABLE IF EXISTS `husband`;
CREATE TABLE `husband` (
`id` int(11) NOT NULL,
`name` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of husband
-- ----------------------------
INSERT INTO `husband` VALUES (1, '杨过');
INSERT INTO `husband` VALUES (2, '郭靖');
INSERT INTO `husband` VALUES (3, '武大即');
INSERT INTO `husband` VALUES (4, '梁山伯');
-- ----------------------------
-- Table structure for order
-- ----------------------------
DROP TABLE IF EXISTS `order`;
CREATE TABLE `order` (
`oid` int(11) NOT NULL AUTO_INCREMENT,
`oname` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`pid` int(11) NULL DEFAULT NULL,
PRIMARY KEY (`oid`) USING BTREE,
INDEX `op`(`pid`) USING BTREE,
CONSTRAINT `op` FOREIGN KEY (`pid`) REFERENCES `person` (`Id`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB AUTO_INCREMENT = 11 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of order
-- ----------------------------
INSERT INTO `order` VALUES (1, '荣耀MagicBook 2019 14英寸轻薄窄边框', 2);
INSERT INTO `order` VALUES (2, '小米 (MI)Ruby 2019款 15.6英寸金属轻薄', 1);
INSERT INTO `order` VALUES (3, '戴尔灵越14 燃 14英寸英特尔酷睿i5轻薄窄边框', 3);
INSERT INTO `order` VALUES (4, '联想(Lenovo)小新14英寸 锐龙版R5', 4);
INSERT INTO `order` VALUES (5, '红辣椒7X 4+64GB 学生智能手机', 5);
INSERT INTO `order` VALUES (6, '荣耀10青春版 幻彩渐变', 1);
INSERT INTO `order` VALUES (7, 'OPPO K1 全面屏手机', 2);
INSERT INTO `order` VALUES (8, '卡梵蒂GAVADI 鳄鱼皮钱包', 5);
INSERT INTO `order` VALUES (9, '七匹狼钱包', 2);
INSERT INTO `order` VALUES (10, '金利来(Goldlion)男士钱包', 1);
-- ----------------------------
-- Table structure for person
-- ----------------------------
DROP TABLE IF EXISTS `person`;
CREATE TABLE `person` (
`Id` int(11) NOT NULL AUTO_INCREMENT,
`Name` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`Bir` date NULL DEFAULT NULL,
`Address` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`age` int(11) NULL DEFAULT NULL,
PRIMARY KEY (`Id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 16 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of person
-- ----------------------------
INSERT INTO `person` VALUES (1, '梦琪', '2019-05-08', '北京市', 1);
INSERT INTO `person` VALUES (2, '忆柳', '2019-05-14', '天津市', 1);
INSERT INTO `person` VALUES (3, '慕青', '2018-10-17', '上海市', 1);
INSERT INTO `person` VALUES (4, '初夏', '2017-04-13', '重庆市', 1);
INSERT INTO `person` VALUES (5, '新柔', '2018-12-29', '广州市', 1);
INSERT INTO `person` VALUES (9, '李小气', '2019-05-08', '北京市', 1);
INSERT INTO `person` VALUES (10, '李小气', NULL, NULL, 1);
INSERT INTO `person` VALUES (11, '梦琪23', '2019-05-08', '北京市', 1);
INSERT INTO `person` VALUES (12, '梦琪33', '2019-05-08', '北京市', 1);
INSERT INTO `person` VALUES (13, '梦琪43', '2019-05-08', '北京市', 1);
INSERT INTO `person` VALUES (15, 'koko', '2019-10-17', 'hf', 22);
-- ----------------------------
-- Table structure for stu_cou
-- ----------------------------
DROP TABLE IF EXISTS `stu_cou`;
CREATE TABLE `stu_cou` (
`scid` int(11) NOT NULL AUTO_INCREMENT,
`cid` int(11) NULL DEFAULT NULL,
`sid` int(11) NULL DEFAULT NULL,
PRIMARY KEY (`scid`) USING BTREE,
INDEX `scs`(`sid`) USING BTREE,
INDEX `scc`(`cid`) USING BTREE,
CONSTRAINT `scc` FOREIGN KEY (`cid`) REFERENCES `course` (`cid`) ON DELETE RESTRICT ON UPDATE RESTRICT,
CONSTRAINT `scs` FOREIGN KEY (`sid`) REFERENCES `student` (`sid`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB AUTO_INCREMENT = 8 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of stu_cou
-- ----------------------------
INSERT INTO `stu_cou` VALUES (1, 1, 1);
INSERT INTO `stu_cou` VALUES (2, 1, 2);
INSERT INTO `stu_cou` VALUES (3, 1, 3);
INSERT INTO `stu_cou` VALUES (4, 2, 1);
INSERT INTO `stu_cou` VALUES (5, 2, 2);
INSERT INTO `stu_cou` VALUES (6, 2, 3);
INSERT INTO `stu_cou` VALUES (7, 3, 1);
-- ----------------------------
-- Table structure for student
-- ----------------------------
DROP TABLE IF EXISTS `student`;
CREATE TABLE `student` (
`sid` int(11) NOT NULL AUTO_INCREMENT,
`sname` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
PRIMARY KEY (`sid`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of student
-- ----------------------------
INSERT INTO `student` VALUES (1, '梦琪', NULL);
INSERT INTO `student` VALUES (2, '初夏', NULL);
INSERT INTO `student` VALUES (3, '忆柳', NULL);
-- ----------------------------
-- Table structure for wife
-- ----------------------------
DROP TABLE IF EXISTS `wife`;
CREATE TABLE `wife` (
`id` int(11) NOT NULL,
`name` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of wife
-- ----------------------------
INSERT INTO `wife` VALUES (1, '小龙女');
INSERT INTO `wife` VALUES (2, '黄容');
INSERT INTO `wife` VALUES (3, '潘金莲');
INSERT INTO `wife` VALUES (4, '祝英台');
SET FOREIGN_KEY_CHECKS = 1;
|
alter table order_detail
rename column quantity_id to quantity; |
DELETE FROM northwind.order_details
where unit_price > 10 and id >= 0;
|
DROP TABLE IF EXISTS distributed_statistics ;
CREATE TABLE distributed_statistics (
received_date Date DEFAULT CAST(now(), 'Date'),
user_id UInt64 DEFAULT CAST(0, 'UInt64'),
campaign_id UInt64 DEFAULT CAST(0, 'UInt64'),
advert_id UInt64 DEFAULT CAST(0, 'UInt64'),
match_id UInt64 DEFAULT CAST(0, 'UInt64'),
status String,
event_type String,
ssp_name String,
app_id String,
payment_type String DEFAULT '',
placement_type String,
position UInt8,
placement_position String,
price AggregateFunction(sum, Float64),
bid AggregateFunction(sum, Float64),
cnt_events AggregateFunction(sum, Int32)
) ENGINE = AggregatingMergeTree(received_date, (received_date, status, event_type, ssp_name, placement_type, position, placement_position, payment_type, user_id, campaign_id, advert_id, match_id), 8192);
DROP TABLE IF EXISTS materialized_statistics ;
CREATE MATERIALIZED VIEW materialized_statistics TO distributed_statistics
AS
SELECT received_date,
user_id,
campaign_id,
advert_id,
match_id,
status,
event_type,
ssp_name,
app_id,
payment_type,
placement_type,
position,
placement_position,
sumState(price) AS price,
sumState(bid) AS bid,
sumState(cnt_events) as cnt_events
FROM distributed_events
GROUP BY received_date, status, event_type, ssp_name, app_id, placement_type, position, placement_position, payment_type, user_id, campaign_id, advert_id, match_id;
INSERT INTO distributed_statistics
SELECT received_date,
user_id,
campaign_id,
advert_id,
match_id,
status,
event_type,
ssp_name,
app_id,
payment_type,
placement_type,
position,
placement_position,
sumState(price) AS price,
sumState(bid) AS bid,
sumState(cnt_events) AS cnt_events
FROM distributed_events
GROUP BY received_date, status, event_type, ssp_name, app_id, placement_type, position, placement_position, payment_type, user_id, campaign_id, advert_id, match_id;
|
/*
Navicat Premium Data Transfer
Source Server : aa
Source Server Type : MySQL
Source Server Version : 50723
Source Host : localhost:3306
Source Schema : imds_0
Target Server Type : MySQL
Target Server Version : 50723
File Encoding : 65001
Date: 09/09/2018 22:22:17
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for t_order_0
-- ----------------------------
DROP TABLE IF EXISTS `t_order_0`;
CREATE TABLE `t_order_0` (
`order_id` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT '订单编码',
`user_id` bigint(20) DEFAULT NULL,
`total_price` decimal(20, 2) DEFAULT 0.00 COMMENT '订单总额',
`pay_price` decimal(20, 2) DEFAULT 0.00 COMMENT '应付金额',
`amount` bigint(20) DEFAULT 0 COMMENT '商品数量',
`buyer_name` varchar(80) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '收货人',
`buyer_phone` varchar(80) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '手机',
`status` int(2) DEFAULT 0 COMMENT '订单状态 0:未付款,1:已付款,2:已发货,3:已完成,4:取消订单,5:支付失败',
PRIMARY KEY (`order_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin COMMENT = '订单信息表' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for t_order_1
-- ----------------------------
DROP TABLE IF EXISTS `t_order_1`;
CREATE TABLE `t_order_1` (
`order_id` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT '订单编码',
`user_id` bigint(20) DEFAULT NULL,
`total_price` decimal(20, 2) DEFAULT 0.00 COMMENT '订单总额',
`pay_price` decimal(20, 2) DEFAULT 0.00 COMMENT '应付金额',
`amount` bigint(20) DEFAULT 0 COMMENT '商品数量',
`buyer_name` varchar(80) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '收货人',
`buyer_phone` varchar(80) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '手机',
`status` int(2) DEFAULT 0 COMMENT '订单状态 0:未付款,1:已付款,2:已发货,3:已完成,4:取消订单,5:支付失败',
PRIMARY KEY (`order_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin COMMENT = '订单信息表' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for t_order_detail_0
-- ----------------------------
DROP TABLE IF EXISTS `t_order_detail_0`;
CREATE TABLE `t_order_detail_0` (
`detail_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '订单明细编码',
`order_id` bigint(20) NOT NULL COMMENT '订单编码',
`goods_id` bigint(20) NOT NULL COMMENT '商品编码',
`price` decimal(20, 2) DEFAULT 0.00 COMMENT '商品价格',
`count` bigint(20) DEFAULT 0 COMMENT '商品数量',
`goods_name` varchar(80) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '商品名称',
`status` int(2) DEFAULT 0 COMMENT '预留字段',
PRIMARY KEY (`detail_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin COMMENT = '订单明细信息表' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for t_order_detail_1
-- ----------------------------
DROP TABLE IF EXISTS `t_order_detail_1`;
CREATE TABLE `t_order_detail_1` (
`detail_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '订单明细编码',
`order_id` bigint(20) NOT NULL COMMENT '订单编码',
`goods_id` bigint(20) NOT NULL COMMENT '商品编码',
`price` decimal(20, 2) DEFAULT 0.00 COMMENT '商品价格',
`count` bigint(20) DEFAULT 0 COMMENT '商品数量',
`goods_name` varchar(80) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '商品名称',
`status` int(2) DEFAULT 0 COMMENT '预留字段',
PRIMARY KEY (`detail_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin COMMENT = '订单明细信息表' ROW_FORMAT = Dynamic;
SET FOREIGN_KEY_CHECKS = 1;
|
INSERT INTO `Conductor` (`DNI`,`nroLicencia`) VALUES (23235783,64535);
INSERT INTO `Conductor` (`DNI`,`nroLicencia`) VALUES (36881131,65564);
INSERT INTO `Conductor` (`DNI`,`nroLicencia`) VALUES (41904291,20422);
INSERT INTO `Conductor` (`DNI`,`nroLicencia`) VALUES (40966468,62609);
INSERT INTO `Conductor` (`DNI`,`nroLicencia`) VALUES (30408855,42795);
INSERT INTO `Conductor` (`DNI`,`nroLicencia`) VALUES (23965617,76121);
INSERT INTO `Conductor` (`DNI`,`nroLicencia`) VALUES (35324098,65607);
INSERT INTO `Conductor` (`DNI`,`nroLicencia`) VALUES (48978996,60951);
INSERT INTO `Conductor` (`DNI`,`nroLicencia`) VALUES (29964964,70551);
INSERT INTO `Conductor` (`DNI`,`nroLicencia`) VALUES (46152032,26779); |
drop table objective_history;
drop table task;
drop table objective;
drop table status_type;
create table status_type
(
type_key int primary key not null,
type_name varchar(20) not null
);
create table objective
(
id int primary key auto_increment,
title varchar(100) not null,
details varchar(1000) null,
priority int not null,
status_type_key int not null,
status_date datetime null,
status_details varchar(1000) null,
last_update_date datetime not null
);
alter table objective
add constraint fk_objective_status_type_key
foreign key (status_type_key)
references status_type(type_key);
create table task
(
id int primary key auto_increment,
objective_id int not null,
title varchar(100) not null,
details varchar(1000) null,
priority int not null,
status_type_key int not null,
last_update_date datetime not null
);
alter table task
add constraint fk_task_objective_id
foreign key (objective_id)
references objective(id);
alter table task
add constraint fk_task_status_type_key
foreign key (status_type_key)
references status_type(type_key);
create table objective_history
(
id int primary key auto_increment,
objective_id int not null,
previous_status_type_key int null,
current_status_type_key int not null,
update_date datetime not null,
is_new bit not null
);
alter table objective_history
add constraint fk_objective_history_objective_id
foreign key (objective_id)
references objective(id);
alter table objective_history
add constraint fk_objective_history_previous_status_type_key
foreign key (previous_status_type_key)
references status_type(type_key);
alter table objective_history
add constraint fk_objective_history_current_status_type_key
foreign key (current_status_type_key)
references status_type(type_key); |
CREATE TABLE employees (
Id INTEGER PRIMARY KEY AUTOINCREMENT,
fullname VARCHAR (30) NOT NULL,
job VARCHAR (10) default 'jp',
salary INTEGER (10)
);
insert into employees(fullname,job,salary)
values('Andy Roberts','SP',1500000)
insert into employees(fullname,job,salary)
values('Larry Page','TL',3500000)
insert into employees(fullname,job,salary)
values('Joe Stagner','SP',2000000) |
/*update correct number of cars in lot*/
/*insert single tuple*/
insert into Auction_Automobile values ('1d7FC7ZAtemporary', 'Silver', 'Dodge', 'Dakota', 'keegan', 2005, 'clean', 'auto', 4, null, 131007);
/*show table with 911s, then delete one, show change, reinsert(for consistancy)*/
select * from Auction_Automobile where model = '911';
delete from Auction_Automobile where vin = 'SCBFC7ZA6EC752199';
select * from Auction_Automobile where model = '911';
insert into Auction_Automobile values ('SCBFC7ZA6EC752199', 'Purple', 'Porsche', '911', 'dealer', 1996, 'junk', 'manual', 4, null,189007);
/*temp tuples to do multi delete*/
insert into Auction_Automobile values ('5N1AA0NDtemporary', 'Black', 'Honda', 'Inspire', 'keegan', 1993, 'clean', 'auto', 1, null, 93379);
insert into Auction_Automobile values ('5N1AA486temporary', 'White', 'Chevrolet', 'G-Series G20', 'keegan', 1993, 'clean', 'auto', 1, null, 121379);
/*delete multi tuple (my temp cars)*/
select * from Auction_Automobile where owner = 'keegan';
delete from Auction_Automobile where vin in (
select vin from (select * from Auction_Automobile) as d
where d.owner = 'keegan');
select * from Auction_Automobile where owner = 'keegan';
/*updates all priuses with new owner*/
select * from Auction_Automobile where model = 'Prius';
update Auction_Automobile set owner = '***DEVIL***' where vin = '5N1AA0ND1FN712067';
select * from Auction_Automobile where model = 'Prius';
/*update multiple*/
update Auction_Automobile set owner = '***SatanOwnsAPrius***' where vin in (
select vin from (select * from Auction_Automobile) as u where u.model = 'Prius');
select * from Auction_Automobile where model = 'Prius';
/*reset owners to original*/
update Auction_Automobile set owner = null where vin in (
select vin from (select * from Auction_Automobile) as u where u.model = 'Prius');
|
CREATE PROC SelectAllOrders
AS
BEGIN
Select *
FROM Orders
END; |
-- DSM 1
create hadoop table potData (nombre varchar(50), edad int)
stored as parquetfile;
load hadoop using file url '/user/bigsql_lab/data.csv' with source properties ('field.delimiter'=',') into table potData overwrite with load properties ('rejected.records.dir'='/tmp/rejected_records/AUX','max.rejected.records'=1,'num.map.tasks'=30);
select * from potData;
-- DSM 2
create hadoop table potInsert (nombre varchar(50), edad int)
stored as parquetfile;
insert into potInsert values ('paco', 10),( 'arancha', 20),( 'pedro', 30),( 'nacho', 15);
select * from potInsert;
-- DSM 3
create external hadoop table potExternal (nombre varchar(50), edad int)
location '/user/bigsql_lab/external'
row format delimited fields terminated by '|';
select * from potExternal;
|
SELECT TOP (5) c.CountryName,
r.RiverName
FROM Countries AS c
LEFT JOIN CountriesRivers AS cr
ON cr.CountryCode = c.CountryCode
LEFT JOIN Rivers AS r
ON r.Id = cr.RiverId
WHERE c.ContinentCode = 'AF'
ORDER BY c.CountryName |
-- REGULAR EXPRESIONS
-- ^ begenning
-- $ end
-- | logical or
-- [afasd] list
-- [a-h] from one to one
-- SELECT *
-- FROM customers
-- WHERE first_name REGEXP "ELEKA" or first_name REGEXP "AMBUR"
-- SELECT *
-- FROM customers
-- WHERE last_name REGEXP "EY$|ON$"
-- Last names that start with MY or contains SE
-- SELECT *
-- FROM customers
-- WHERE last_name REGEXP ("^MY|SE")
-- last names contain B followed by R or uninstall
SELECT *
FROM customers
WHERE last_name REGEXP ('B[R|U]')
|
SELECT
DI.TargetProtocolApplication.Run,
DI.TargetProtocolApplication,
DI.Data,
DI.Role
FROM
exp.DataInputs DI
WHERE
DI.TargetProtocolApplication.Type = 'ExperimentRun'
-- only show Runs for the current protocol
AND DI.TargetProtocolApplication.Run.RowId IN (SELECT RowId FROM Runs)
AND DI.Role NOT IN ('Script File', 'AnalysisParameters')
|
/*
MySQL Data Transfer
Source Host: localhost
Source Database: beelove
Target Host: localhost
Target Database: beelove
Date: 2020/9/4 9:11:05
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for blacklist
-- ----------------------------
DROP TABLE IF EXISTS `blacklist`;
CREATE TABLE `blacklist` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`person_id` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records
-- ----------------------------
|
SELECT
RowId,
ParticipantId,
Name,
Label,
Timepoint,
Features
FROM
-- Must use full path to access data held in /Studies
Project."DimensionReduction".DimRedux_Assay_Data_PreCompute
-- Then use IN filter to 'inherit' the global study/participant filter
WHERE
ParticipantId IN (SELECT ParticipantId from study.Participant)
|
CREATE TABLE "park" (
"id" SERIAL PRIMARY KEY,
"latitude" FLOAT NOT NULL,
"longitudes" FLOAT NOT NULL,
"park_name" VARCHAR NOT NULL,
"info_window" VARCHAR (100),
"img_url" VARCHAR (500)
);
CREATE TABLE "user" (
"id" SERIAL PRIMARY KEY,
"username" VARCHAR (80) UNIQUE NOT NULL,
"password" VARCHAR (1000) NOT NULL
);
CREATE TABLE "user_location" (
"user_latitude" FLOAT NOT NULL,
"user_longitude" FLOAT NOT NULL,
"user_ref_id" INT REFERENCES "user" PRIMARY KEY
);
|
create table t1 (a1 int) |
ATTACH DATABASE '$ATTACH_DB' as OLD;
insert into Tag(name, sort_order) select name, rowid from OLD.Tag;
update Tag set sort_order = id;
insert into ReferenceName(name, sort_order) select name, rowid from OLD.ReferenceName;
update ReferenceName set sort_order = id;
update ReferenceName set sort_order = sort_order + 1 where sort_order > 12;
update ReferenceName set sort_order = 13 where id = 47;
update ReferenceName set sort_order = sort_order + 1 where sort_order > 18;
update ReferenceName set sort_order = 19 where id = 48;
insert into TestImage select * from OLD.TestImage;
insert into BloodTest select bt.id, bt.date, t.id from OLD.BloodTest as bt join Tag as t on bt.tag = t.name;
insert into BloodTestEntry select bt.id, t.id, bt.value from OLD.BloodTestEntry as bt
join ReferenceName as t on bt.name = t.name;
insert into BloodTest_BloodTestEntry select * from OLD.BloodTest_BloodTestEntry;
insert into BloodTest_TestImage select * from OLD.BloodTest_TestImage; |
-- GENRE's
insert into GENRE(name) values('Science fiction');
insert into GENRE(name) values('Romance');
insert into GENRE(name) values('Drama');
insert into GENRE(name) values('Mystery');
insert into GENRE(name) values('Horror');
insert into GENRE(name) values('Childrens');
insert into GENRE(name) values('History');
-- AUTHOR's
insert into AUTHOR(name,nationality) values('Yann Martel','Cannada');
insert into AUTHOR(name,nationality) values('Amish Tripathi','India');
insert into AUTHOR(name,nationality) values('J. R. R. Tolkien','United Kingdom');
insert into AUTHOR(name,nationality) values('Chetan Bhagat','India');
-- PUBLISHER's
insert into PUBLISHER(name,country) values('Random House of Canada','Cannada');
insert into PUBLISHER(name,country) values('Rupa Publications','India');
insert into PUBLISHER(name,country) values('Westland Publications','India');
insert into PUBLISHER(name,country) values('Westland Publications','United Kingdom');
insert into PUBLISHER(name,country) values('Allen & Unwin','Australia');
-- BOOK's
insert into BOOKS(name,author_id,genre_id,published_date,publisher_id,language,cost,currency)
values('Life of Pi',1, 1, TO_DATE('11-09-2001', 'DD-MM-YYY'), 1,'English', 63, 'INR');
insert into BOOKS(name,author_id,genre_id,published_date,publisher_id,language,cost,currency)
values('The Secret of the Nagas',2, 1, TO_DATE('21-07-2011', 'DD-MM-YYY'), 2,'English', 257, 'INR');
insert into BOOKS(name,author_id,genre_id,published_date,publisher_id,language,cost,currency)
values('Lord of the Rings',3, 3, TO_DATE('21-12-2001', 'DD-MM-YYY'), 4,'English', 1500, 'INR');
insert into BOOKS(name,author_id,genre_id,published_date,publisher_id,language,cost,currency)
values('2 States',4, 2, TO_DATE('21-08-2010', 'DD-MM-YYY'), 2,'English', 249, 'INR');
insert into BOOKS(name,author_id,genre_id,published_date,publisher_id,language,cost,currency)
values('half girl friend',4, 2, TO_DATE('21-08-2012', 'DD-MM-YYY'), 2,'English', 249, 'INR');
-- ENTITIE'S
insert into ENTITY(name) values('Book');
insert into ENTITY(name) values('Author');
insert into ENTITY(name) values('Publisher');
insert into ENTITY(name) values('Genre');
-- ENTITY VIEW's
insert into ENTITY_VIEW(entity_id,attribute,attribute_label,input_type,is_entity)
values(1,'name','Book Name','text',false);
insert into ENTITY_VIEW(entity_id,attribute,attribute_label,input_type,is_entity,composed_entity)
values(1,'author','Author Name','select',true,'author');
insert into ENTITY_VIEW(entity_id,attribute,attribute_label,input_type,is_entity)
values(1,'publishedDate','Published Date','date',false);
insert into ENTITY_VIEW(entity_id,attribute,attribute_label,input_type,is_entity,composed_entity)
values(1,'publisher','Publisher','select',true,'genre');
insert into ENTITY_VIEW(entity_id,attribute,attribute_label,input_type,is_entity)
values(1,'language','Language','text',false);
insert into ENTITY_VIEW(entity_id,attribute,attribute_label,input_type,is_entity)
values(1,'cost','Price','text',false);
insert into ENTITY_VIEW(entity_id,attribute,attribute_label,input_type,is_entity)
values(1,'currency','Currency','text',false);
|
-- MySQL Administrator dump 1.4
--
-- ------------------------------------------------------
-- Server version 5.6.16
/*!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_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' */;
--
-- Create schema ccsfif
--
CREATE DATABASE IF NOT EXISTS ccsfif;
USE ccsfif;
--
-- Definition of table `account`
--
DROP TABLE IF EXISTS `account`;
CREATE TABLE `account` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`ACCOUNT_ID` varchar(5) NOT NULL,
`ACCOUNT_ROLE` varchar(25) NOT NULL,
`READ_ONLY` int(10) unsigned NOT NULL DEFAULT '1',
`ACCESS_TYPE` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '0 = own, 1 = department, 2=alldepts, 3 = admin',
PRIMARY KEY (`ACCOUNT_ID`),
UNIQUE KEY `id` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `account`
--
/*!40000 ALTER TABLE `account` DISABLE KEYS */;
INSERT INTO `account` (`id`,`ACCOUNT_ID`,`ACCOUNT_ROLE`,`READ_ONLY`,`ACCESS_TYPE`) VALUES
(1,'AC001','System Administrator',0,3),
(2,'AC002','Manager',0,1),
(3,'AC003','Faculty',0,0),
(4,'AC004','Staff',1,2),
(5,'AC005','QMO',0,2);
/*!40000 ALTER TABLE `account` ENABLE KEYS */;
--
-- Definition of table `area_spec`
--
DROP TABLE IF EXISTS `area_spec`;
CREATE TABLE `area_spec` (
`AS_CODE` int(11) NOT NULL AUTO_INCREMENT,
`AS_TITLE` varchar(50) NOT NULL,
PRIMARY KEY (`AS_CODE`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `area_spec`
--
/*!40000 ALTER TABLE `area_spec` DISABLE KEYS */;
INSERT INTO `area_spec` (`AS_CODE`,`AS_TITLE`) VALUES
(1,' N/A'),
(2,'Signal Processing'),
(3,'Artificial Intelligence'),
(4,'Digital Forensics'),
(5,'Big Data and Analytics');
/*!40000 ALTER TABLE `area_spec` ENABLE KEYS */;
--
-- Definition of table `awards`
--
DROP TABLE IF EXISTS `awards`;
CREATE TABLE `awards` (
`AWARD_ID` int(11) NOT NULL AUTO_INCREMENT,
`FID` int(8) DEFAULT NULL,
`AWARD_TITLE` varchar(100) DEFAULT NULL,
`AWARD_BODY` varchar(100) DEFAULT NULL,
`AWARD_DATE` date DEFAULT NULL,
PRIMARY KEY (`AWARD_ID`),
KEY `fk_awards_fid` (`FID`),
CONSTRAINT `fk_awards_fid` FOREIGN KEY (`FID`) REFERENCES `faculty` (`FID`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `awards`
--
/*!40000 ALTER TABLE `awards` DISABLE KEYS */;
INSERT INTO `awards` (`AWARD_ID`,`FID`,`AWARD_TITLE`,`AWARD_BODY`,`AWARD_DATE`) VALUES
(1,97000001,'First Honorable Mention','Academy Awards','2008-02-03');
/*!40000 ALTER TABLE `awards` ENABLE KEYS */;
--
-- Definition of table `co_author`
--
DROP TABLE IF EXISTS `co_author`;
CREATE TABLE `co_author` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`AUTHOR_VAL` varchar(45) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `co_author`
--
/*!40000 ALTER TABLE `co_author` DISABLE KEYS */;
INSERT INTO `co_author` (`id`,`AUTHOR_VAL`) VALUES
(1,'Yes'),
(2,'No');
/*!40000 ALTER TABLE `co_author` ENABLE KEYS */;
--
-- Definition of table `community_service`
--
DROP TABLE IF EXISTS `community_service`;
CREATE TABLE `community_service` (
`CS_ID` int(11) NOT NULL AUTO_INCREMENT,
`FID` int(8) DEFAULT NULL,
`CS_TYPE` varchar(100) DEFAULT NULL,
`DESCRIPTION` varchar(100) DEFAULT NULL,
`UNIT_CODE` varchar(20) DEFAULT NULL,
`DEPT_CODE` varchar(15) DEFAULT NULL,
`COMMITTEE` varchar(45) DEFAULT NULL,
`OTHERS` varchar(45) DEFAULT NULL,
`PROJECT_SITE` varchar(100) DEFAULT NULL,
`START_DATE` date DEFAULT NULL,
`END_DATE` date DEFAULT NULL,
`INSTITUTION` varchar(45) DEFAULT NULL,
`ORG_NAME` varchar(45) DEFAULT NULL,
`GOV_NAME` varchar(45) DEFAULT NULL,
PRIMARY KEY (`CS_ID`),
KEY `fk_fid` (`FID`),
KEY `fk_cs_unitcode` (`UNIT_CODE`),
KEY `fk_cs_deptcode` (`DEPT_CODE`),
KEY `fk_cs_cstype` (`CS_TYPE`),
KEY `fk_cs_instid` (`INSTITUTION`),
KEY `fk_cs_orgid` (`ORG_NAME`),
KEY `fk_cs_govid` (`GOV_NAME`),
CONSTRAINT `fk_cs_cstype` FOREIGN KEY (`CS_TYPE`) REFERENCES `cs_type` (`CSTYPE_CODE`) ON DELETE SET NULL ON UPDATE CASCADE,
CONSTRAINT `fk_cs_deptcode` FOREIGN KEY (`DEPT_CODE`) REFERENCES `department` (`dept_code`) ON DELETE SET NULL ON UPDATE CASCADE,
CONSTRAINT `fk_cs_unitcode` FOREIGN KEY (`UNIT_CODE`) REFERENCES `unit` (`Unit_Code`) ON DELETE SET NULL ON UPDATE CASCADE,
CONSTRAINT `fk_fid` FOREIGN KEY (`FID`) REFERENCES `faculty` (`FID`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `community_service`
--
/*!40000 ALTER TABLE `community_service` DISABLE KEYS */;
INSERT INTO `community_service` (`CS_ID`,`FID`,`CS_TYPE`,`DESCRIPTION`,`UNIT_CODE`,`DEPT_CODE`,`COMMITTEE`,`OTHERS`,`PROJECT_SITE`,`START_DATE`,`END_DATE`,`INSTITUTION`,`ORG_NAME`,`GOV_NAME`) VALUES
(1,97000001,'CS001','Teaching Computer','CED','CT','CSC',NULL,NULL,'2009-01-01','2009-01-01',NULL,NULL,NULL),
(3,97000001,'CS003','Govenrment Project',NULL,NULL,NULL,NULL,'Marikina','2009-01-01','2009-01-05',NULL,NULL,'Department Of Public Works'),
(5,97000001,'CS002','Pailaw Sa Baranggay',NULL,NULL,NULL,NULL,'Caloocan','2005-01-01','2007-01-02',NULL,'Baranggay 123',NULL),
(6,97000001,'CS003','Pakain Sa Siyudad',NULL,NULL,NULL,NULL,'Malabon','2001-01-01','2001-01-01',NULL,NULL,'DSWD'),
(7,97000001,'CS004','Bahay Bahayan',NULL,NULL,NULL,'Bahay Ni Kulas','Makati','2006-01-10','2006-01-10',NULL,NULL,NULL);
/*!40000 ALTER TABLE `community_service` ENABLE KEYS */;
--
-- Definition of table `country`
--
DROP TABLE IF EXISTS `country`;
CREATE TABLE `country` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`COUNTRY_CODE` varchar(4) NOT NULL,
`COUNTRY_NAME` varchar(35) NOT NULL,
PRIMARY KEY (`COUNTRY_CODE`),
UNIQUE KEY `id` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `country`
--
/*!40000 ALTER TABLE `country` DISABLE KEYS */;
INSERT INTO `country` (`id`,`COUNTRY_CODE`,`COUNTRY_NAME`) VALUES
(1,' N/A',' N/A'),
(2,'AFG','Afghanistan'),
(3,'ALB','Albania'),
(4,'AUS','Australia'),
(5,'AUT','Austria'),
(6,'BEL','Belgium'),
(7,'BHS','Bahamas'),
(8,'CHN','China'),
(9,'DZA','Algeria'),
(10,'JPN','Japan'),
(11,'KHM','Cambodia'),
(12,'MAC','Macau'),
(13,'MYS','Malaysia'),
(14,'PHL','Philippines'),
(15,'ROU','Romania'),
(16,'RUS','Russia'),
(17,'SGP','Singapore'),
(18,'USA','United Stated of America');
/*!40000 ALTER TABLE `country` ENABLE KEYS */;
--
-- Definition of table `cs_type`
--
DROP TABLE IF EXISTS `cs_type`;
CREATE TABLE `cs_type` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`CSTYPE_CODE` varchar(5) NOT NULL,
`CSTYPE_TITLE` varchar(35) NOT NULL,
PRIMARY KEY (`CSTYPE_CODE`),
UNIQUE KEY `id` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `cs_type`
--
/*!40000 ALTER TABLE `cs_type` DISABLE KEYS */;
INSERT INTO `cs_type` (`id`,`CSTYPE_CODE`,`CSTYPE_TITLE`) VALUES
(1,'CS000',' N/A'),
(2,'CS001','DLSU'),
(3,'CS002','Professional Organization'),
(4,'CS003','Government'),
(5,'CS004','Others');
/*!40000 ALTER TABLE `cs_type` ENABLE KEYS */;
--
-- Definition of table `currency`
--
DROP TABLE IF EXISTS `currency`;
CREATE TABLE `currency` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`CURRENCY_NAME` varchar(45) NOT NULL,
`COUNTRY` varchar(5) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `currency`
--
/*!40000 ALTER TABLE `currency` DISABLE KEYS */;
INSERT INTO `currency` (`id`,`CURRENCY_NAME`,`COUNTRY`) VALUES
(1,'Australia$','AUS'),
(2,' N/A',NULL),
(3,'PhP','PHL');
/*!40000 ALTER TABLE `currency` ENABLE KEYS */;
--
-- Definition of table `degree`
--
DROP TABLE IF EXISTS `degree`;
CREATE TABLE `degree` (
`DEGREE_ID` int(11) NOT NULL AUTO_INCREMENT,
`DEGREE_TITLE` varchar(100) NOT NULL,
PRIMARY KEY (`DEGREE_ID`)
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `degree`
--
/*!40000 ALTER TABLE `degree` DISABLE KEYS */;
INSERT INTO `degree` (`DEGREE_ID`,`DEGREE_TITLE`) VALUES
(1,'Computer Science'),
(2,'Information Technology'),
(3,'Computer Engineering'),
(4,'Electronics and Communications Engineering'),
(6,'Information Systems'),
(7,'Technology Management');
/*!40000 ALTER TABLE `degree` ENABLE KEYS */;
--
-- Definition of table `degree_earned`
--
DROP TABLE IF EXISTS `degree_earned`;
CREATE TABLE `degree_earned` (
`DE_ID` int(11) NOT NULL AUTO_INCREMENT,
`FID` int(8) DEFAULT NULL,
`DLEVEL_ID` varchar(4) DEFAULT NULL,
`DEGREE_ID` int(11) DEFAULT NULL,
`SPECIALIZATION` varchar(45) DEFAULT NULL,
`YEAR_OBTAINED` int(4) DEFAULT NULL,
`INSTITUTION_ID` int(11) DEFAULT NULL,
`LOCATION_ID` varchar(45) DEFAULT NULL,
`SO_NUM` varchar(25) NOT NULL,
PRIMARY KEY (`DE_ID`),
KEY `DE_ID` (`DE_ID`),
KEY `fk_degree_fid` (`FID`),
KEY `fk_degree_dlevelid` (`DLEVEL_ID`),
KEY `fk_degree_loc` (`LOCATION_ID`),
KEY `DEGREE_ID` (`DEGREE_ID`),
KEY `degree_earned_ibfk_2` (`INSTITUTION_ID`),
CONSTRAINT `degree_earned_ibfk_1` FOREIGN KEY (`DEGREE_ID`) REFERENCES `degree` (`DEGREE_ID`) ON DELETE SET NULL ON UPDATE CASCADE,
CONSTRAINT `degree_earned_ibfk_2` FOREIGN KEY (`INSTITUTION_ID`) REFERENCES `institution` (`INSTITUTION_ID`) ON DELETE SET NULL ON UPDATE SET NULL,
CONSTRAINT `fk_degree_dlevelid` FOREIGN KEY (`DLEVEL_ID`) REFERENCES `degree_level` (`DLEVEL_ID`) ON DELETE SET NULL ON UPDATE CASCADE,
CONSTRAINT `fk_degree_fid` FOREIGN KEY (`FID`) REFERENCES `faculty` (`FID`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `degree_earned`
--
/*!40000 ALTER TABLE `degree_earned` DISABLE KEYS */;
INSERT INTO `degree_earned` (`DE_ID`,`FID`,`DLEVEL_ID`,`DEGREE_ID`,`SPECIALIZATION`,`YEAR_OBTAINED`,`INSTITUTION_ID`,`LOCATION_ID`,`SO_NUM`) VALUES
(1,97011112,'DL00',1,'N/A',2005,2,'Manila','SO1212121'),
(3,97000001,'DL00',1,'Database Systems',2004,9,'Manila','SO12345');
/*!40000 ALTER TABLE `degree_earned` ENABLE KEYS */;
--
-- Definition of table `degree_level`
--
DROP TABLE IF EXISTS `degree_level`;
CREATE TABLE `degree_level` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`DLEVEL_ID` varchar(4) NOT NULL,
`DLEVEL_TITLE` varchar(35) NOT NULL,
`DLEVEL_DESC` varchar(45) DEFAULT NULL,
PRIMARY KEY (`DLEVEL_ID`),
UNIQUE KEY `ID` (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `degree_level`
--
/*!40000 ALTER TABLE `degree_level` DISABLE KEYS */;
INSERT INTO `degree_level` (`ID`,`DLEVEL_ID`,`DLEVEL_TITLE`,`DLEVEL_DESC`) VALUES
(1,'DL00','Bachelor (BS)','Bachelor Of Science In'),
(2,'DL01','Bachelor (BA)','Bachelor of Arts in'),
(3,'DL02','Master\'s (MS)','Master of Science in'),
(4,'DL03','Master\'s (MA)','Master of Arts in'),
(5,'DL04','Master\'s (M)','Master in'),
(6,'DL05','Doctoral (PhD)','Doctor of Philosophy in'),
(7,'DL06','Doctoral (EdD)','Doctor of Education in'),
(8,'DL07','Doctoral (Doctor In)','Doctor in'),
(9,'DL08','Doctoral (Doctor of)','Doctor of');
/*!40000 ALTER TABLE `degree_level` ENABLE KEYS */;
--
-- Definition of table `degree_pursue`
--
DROP TABLE IF EXISTS `degree_pursue`;
CREATE TABLE `degree_pursue` (
`DP_ID` int(11) NOT NULL AUTO_INCREMENT,
`FID` int(8) DEFAULT NULL,
`DEGREE_ID` int(11) DEFAULT NULL,
`DLEVEL_ID` varchar(4) DEFAULT NULL,
`INSTITUTION_ID` int(11) DEFAULT NULL,
`DEGREE_STAGES` varchar(5) DEFAULT NULL,
`EARNED_UNITS` int(3) DEFAULT NULL,
`START_DATE` date DEFAULT NULL,
`END_DATE` text,
PRIMARY KEY (`DP_ID`),
KEY `fk_degreepursue_fid` (`FID`),
KEY `fk_dp_dlevelid` (`DLEVEL_ID`),
KEY `fk_dp_degstages` (`DEGREE_STAGES`),
KEY `DEGREE_ID` (`DEGREE_ID`),
KEY `degree_pursue_ibfk_2` (`INSTITUTION_ID`),
CONSTRAINT `degree_pursue_ibfk_1` FOREIGN KEY (`DEGREE_ID`) REFERENCES `degree` (`DEGREE_ID`) ON DELETE SET NULL ON UPDATE CASCADE,
CONSTRAINT `degree_pursue_ibfk_2` FOREIGN KEY (`INSTITUTION_ID`) REFERENCES `institution` (`INSTITUTION_ID`) ON DELETE SET NULL ON UPDATE CASCADE,
CONSTRAINT `fk_degreepursue_fid` FOREIGN KEY (`FID`) REFERENCES `faculty` (`FID`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `fk_dp_degstages` FOREIGN KEY (`DEGREE_STAGES`) REFERENCES `degree_stages` (`DS_CODE`) ON DELETE SET NULL ON UPDATE CASCADE,
CONSTRAINT `fk_dp_dlevelid` FOREIGN KEY (`DLEVEL_ID`) REFERENCES `degree_level` (`DLEVEL_ID`) ON DELETE SET NULL ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `degree_pursue`
--
/*!40000 ALTER TABLE `degree_pursue` DISABLE KEYS */;
INSERT INTO `degree_pursue` (`DP_ID`,`FID`,`DEGREE_ID`,`DLEVEL_ID`,`INSTITUTION_ID`,`DEGREE_STAGES`,`EARNED_UNITS`,`START_DATE`,`END_DATE`) VALUES
(1,97011112,3,'DL08',6,'DS004',33,'2010-06-01','2014-06-03'),
(3,97000001,2,'DL08',10,'DS004',33,'2007-02-03','On-going'),
(4,97000001,2,'DL04',3,'DS002',40,'2006-01-06','On-going');
/*!40000 ALTER TABLE `degree_pursue` ENABLE KEYS */;
--
-- Definition of table `degree_stages`
--
DROP TABLE IF EXISTS `degree_stages`;
CREATE TABLE `degree_stages` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`DS_CODE` varchar(5) NOT NULL,
`DS_NAME` varchar(25) NOT NULL,
PRIMARY KEY (`DS_CODE`),
UNIQUE KEY `ID` (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `degree_stages`
--
/*!40000 ALTER TABLE `degree_stages` DISABLE KEYS */;
INSERT INTO `degree_stages` (`ID`,`DS_CODE`,`DS_NAME`) VALUES
(1,'DS000',' N/A'),
(2,'DS001','Dissertation'),
(3,'DS002','Thesis'),
(4,'DS003','Comprehensives'),
(5,'DS004','Academic Courses');
/*!40000 ALTER TABLE `degree_stages` ENABLE KEYS */;
--
-- Definition of table `department`
--
DROP TABLE IF EXISTS `department`;
CREATE TABLE `department` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`dept_code` varchar(15) NOT NULL,
`dept_name` varchar(45) NOT NULL,
PRIMARY KEY (`dept_code`),
UNIQUE KEY `id` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `department`
--
/*!40000 ALTER TABLE `department` DISABLE KEYS */;
INSERT INTO `department` (`id`,`dept_code`,`dept_name`) VALUES
(1,' N/A',' N/A'),
(2,'CT','Computer Technology'),
(3,'IS','Information System'),
(4,'IT','Information Technology'),
(5,'ST','Software Technology');
/*!40000 ALTER TABLE `department` ENABLE KEYS */;
--
-- Definition of table `educ_level`
--
DROP TABLE IF EXISTS `educ_level`;
CREATE TABLE `educ_level` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`EL_ID` varchar(5) NOT NULL,
`EL_TITLE` varchar(35) NOT NULL,
PRIMARY KEY (`EL_ID`),
UNIQUE KEY `id` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `educ_level`
--
/*!40000 ALTER TABLE `educ_level` DISABLE KEYS */;
INSERT INTO `educ_level` (`id`,`EL_ID`,`EL_TITLE`) VALUES
(1,'EL001','Elementary'),
(2,'EL002','Secondary'),
(3,'EL003','Tertiary');
/*!40000 ALTER TABLE `educ_level` ENABLE KEYS */;
--
-- Definition of table `faculty`
--
DROP TABLE IF EXISTS `faculty`;
CREATE TABLE `faculty` (
`FID` int(8) NOT NULL,
`PASSWORD` varchar(45) NOT NULL,
`USERNAME` varchar(25) NOT NULL,
`ACCOUNT_ID` varchar(5) NOT NULL,
`FFNAME` varchar(25) NOT NULL,
`FLNAME` varchar(25) NOT NULL,
`FMNAME` varchar(25) DEFAULT NULL,
`UNIT_CODE` varchar(5) DEFAULT NULL,
`DEPT` varchar(45) DEFAULT NULL,
`CLASSIFICATION` varchar(25) DEFAULT NULL,
`RANK` varchar(45) DEFAULT NULL,
`POSITION_ID` varchar(5) DEFAULT NULL,
`ACTIVE` int(11) DEFAULT NULL,
PRIMARY KEY (`FID`),
KEY `fk_fac_unitcode` (`UNIT_CODE`),
KEY `fk_fac_dept` (`DEPT`),
KEY `fk_fac_rank` (`RANK`),
KEY `fk_fac_position` (`POSITION_ID`),
KEY `fk_fac_account` (`ACCOUNT_ID`),
CONSTRAINT `faculty_ibfk_1` FOREIGN KEY (`ACCOUNT_ID`) REFERENCES `account` (`ACCOUNT_ID`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `fk_fac_dept` FOREIGN KEY (`DEPT`) REFERENCES `department` (`dept_code`) ON DELETE SET NULL ON UPDATE CASCADE,
CONSTRAINT `fk_fac_position` FOREIGN KEY (`POSITION_ID`) REFERENCES `position` (`POSITION_ID`) ON DELETE SET NULL ON UPDATE CASCADE,
CONSTRAINT `fk_fac_rank` FOREIGN KEY (`RANK`) REFERENCES `rank` (`rank_code`) ON DELETE SET NULL ON UPDATE CASCADE,
CONSTRAINT `fk_fac_unitcode` FOREIGN KEY (`UNIT_CODE`) REFERENCES `unit` (`Unit_Code`) ON DELETE SET NULL ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `faculty`
--
/*!40000 ALTER TABLE `faculty` DISABLE KEYS */;
INSERT INTO `faculty` (`FID`,`PASSWORD`,`USERNAME`,`ACCOUNT_ID`,`FFNAME`,`FLNAME`,`FMNAME`,`UNIT_CODE`,`DEPT`,`CLASSIFICATION`,`RANK`,`POSITION_ID`,`ACTIVE`) VALUES
(1111,'5f4dcc3b5aa765d61d8327deb882cf99','staff.account','AC004','Account','Staff','S','CCS','CT','P0006',' N/A','P0005',1),
(20001,'5f4dcc3b5aa765d61d8327deb882cf99','admin.account','AC001','Administrator','System','A','CCS',' N/A','P0003','L1','P0000',1),
(20002,'5f4dcc3b5aa765d61d8327deb882cf99','ct.manager','AC002','Manager','CT','CT','CCS','CT','PPPPP',' N/A','PPPPP',1),
(20003,'827ccb0eea8a706c4c34a16891f84e7b','qmo.account','AC005','QMO','QMO','QMO','CCS',' N/A','PPPPP',' N/A','PPPPP',1),
(97000001,'54f3eeb8b394244e8e9f3968f76acb59','geanne.franco','AC003','Geanne Ross','Franco','Lunar','CCS','IS','P0003','AP2','P0003',1),
(97011112,'5f4dcc3b5aa765d61d8327deb882cf99','sample2.faculty2','AC003','Faculty2','Sample2','Yu','CCS','ST','P0003','AP2','P0003',1),
(97012345,'696d29e0940a4957748fe3fc9efd22a3','alexie.ballon','AC003','Alexie','Ballon','E.','CCS','CT','P0003','AP2','P0003',1);
/*!40000 ALTER TABLE `faculty` ENABLE KEYS */;
--
-- Definition of table `funding_agency`
--
DROP TABLE IF EXISTS `funding_agency`;
CREATE TABLE `funding_agency` (
`FAGENCY_ID` int(11) NOT NULL AUTO_INCREMENT,
`FAGENCY_NAME` varchar(70) NOT NULL,
PRIMARY KEY (`FAGENCY_ID`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `funding_agency`
--
/*!40000 ALTER TABLE `funding_agency` DISABLE KEYS */;
INSERT INTO `funding_agency` (`FAGENCY_ID`,`FAGENCY_NAME`) VALUES
(1,' N/A'),
(2,'Funding Agency 1'),
(3,'Funding Agency 2');
/*!40000 ALTER TABLE `funding_agency` ENABLE KEYS */;
--
-- Definition of table `gov_agencies`
--
DROP TABLE IF EXISTS `gov_agencies`;
CREATE TABLE `gov_agencies` (
`GOV_ID` int(11) NOT NULL AUTO_INCREMENT,
`AGENCY_NAME` varchar(100) DEFAULT NULL,
`AGENCY_LOCATION` varchar(50) DEFAULT NULL,
PRIMARY KEY (`GOV_ID`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `gov_agencies`
--
/*!40000 ALTER TABLE `gov_agencies` DISABLE KEYS */;
INSERT INTO `gov_agencies` (`GOV_ID`,`AGENCY_NAME`,`AGENCY_LOCATION`) VALUES
(1,' N/A',' N/A'),
(2,'Social Security System','Manila'),
(3,'Department of Social Welfare Development','Manila');
/*!40000 ALTER TABLE `gov_agencies` ENABLE KEYS */;
--
-- Definition of table `industry`
--
DROP TABLE IF EXISTS `industry`;
CREATE TABLE `industry` (
`INDUSTRY_ID` int(11) NOT NULL AUTO_INCREMENT,
`INDUSTRY_NAME` varchar(45) NOT NULL,
`IND_ACRONYM` varchar(25) DEFAULT NULL,
PRIMARY KEY (`INDUSTRY_ID`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `industry`
--
/*!40000 ALTER TABLE `industry` DISABLE KEYS */;
INSERT INTO `industry` (`INDUSTRY_ID`,`INDUSTRY_NAME`,`IND_ACRONYM`) VALUES
(1,' N/A',' N/A'),
(2,'Digital Telecommunications Philippines','(DIGITEL)'),
(3,'Globe Telecomm','(GLOBE)'),
(4,'Integrated Microelectronics, Inc.','(IMI)'),
(6,'Philippine Long Distance Company','(PLDT)');
/*!40000 ALTER TABLE `industry` ENABLE KEYS */;
--
-- Definition of table `institution`
--
DROP TABLE IF EXISTS `institution`;
CREATE TABLE `institution` (
`INSTITUTION_ID` int(11) NOT NULL AUTO_INCREMENT,
`INSTITUTION_NAME` varchar(45) NOT NULL,
`LOCATION` varchar(45) DEFAULT NULL,
`COUNTRY` varchar(25) DEFAULT NULL,
PRIMARY KEY (`INSTITUTION_ID`)
) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `institution`
--
/*!40000 ALTER TABLE `institution` DISABLE KEYS */;
INSERT INTO `institution` (`INSTITUTION_ID`,`INSTITUTION_NAME`,`LOCATION`,`COUNTRY`) VALUES
(1,' N/A','1',' N/A'),
(2,'De La Salle University','1','PHL'),
(3,'Ateneo De Manila University','1','PHL'),
(4,'University of the Philippines, Diliman','1','PHL'),
(5,'University of the Philippines, Los Banos','1','PHL'),
(6,'Technological University of the Philippines','1','PHL'),
(7,'University of Santo Tomas','1','PHL'),
(9,'Colegio de San Juan de Letran','1','PHL'),
(10,'FEU - East Asia College','1','PHL'),
(11,'Pamantasan Ng Lungsod Ng Maynila','1','PHL');
/*!40000 ALTER TABLE `institution` ENABLE KEYS */;
--
-- Definition of table `journal_publication`
--
DROP TABLE IF EXISTS `journal_publication`;
CREATE TABLE `journal_publication` (
`JOURNALPUB_ID` int(11) NOT NULL AUTO_INCREMENT,
`JOURNALPUB_TYPE` varchar(45) NOT NULL,
PRIMARY KEY (`JOURNALPUB_ID`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `journal_publication`
--
/*!40000 ALTER TABLE `journal_publication` DISABLE KEYS */;
INSERT INTO `journal_publication` (`JOURNALPUB_ID`,`JOURNALPUB_TYPE`) VALUES
(1,' N/A'),
(2,'ISI'),
(4,'Scopus'),
(5,'Abstracted And Refereed');
/*!40000 ALTER TABLE `journal_publication` ENABLE KEYS */;
--
-- Definition of table `journals`
--
DROP TABLE IF EXISTS `journals`;
CREATE TABLE `journals` (
`JOURNAL_ID` int(11) NOT NULL AUTO_INCREMENT,
`JOURNAL_TITLE` varchar(100) NOT NULL,
`JOURNAL_TYPE` varchar(35) NOT NULL,
`JOURNAL_PUBLICATION` varchar(35) NOT NULL,
PRIMARY KEY (`JOURNAL_ID`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `journals`
--
/*!40000 ALTER TABLE `journals` DISABLE KEYS */;
INSERT INTO `journals` (`JOURNAL_ID`,`JOURNAL_TITLE`,`JOURNAL_TYPE`,`JOURNAL_PUBLICATION`) VALUES
(1,' N/A','N/A','N/A'),
(2,'IEEE Transactions on Affective Computing','Trade Journal','International'),
(3,'The CET Review','Academic Journal','Local'),
(4,'The Journal of DLSU-CCS','Academic','Local');
/*!40000 ALTER TABLE `journals` ENABLE KEYS */;
--
-- Definition of table `location`
--
DROP TABLE IF EXISTS `location`;
CREATE TABLE `location` (
`LOCATION_ID` int(11) NOT NULL AUTO_INCREMENT,
`LOCATION_NAME` varchar(45) NOT NULL,
`REGION` varchar(45) DEFAULT NULL,
PRIMARY KEY (`LOCATION_ID`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `location`
--
/*!40000 ALTER TABLE `location` DISABLE KEYS */;
INSERT INTO `location` (`LOCATION_ID`,`LOCATION_NAME`,`REGION`) VALUES
(1,' N/A',NULL),
(2,'Caloocan','National Capital Region (NCR)'),
(3,'Abra','Cordillera Administrative Region (CAR)'),
(5,'Dagupan','Ilocos Region (Region I)');
/*!40000 ALTER TABLE `location` ENABLE KEYS */;
--
-- Definition of table `organization`
--
DROP TABLE IF EXISTS `organization`;
CREATE TABLE `organization` (
`ORG_ID` int(11) NOT NULL AUTO_INCREMENT,
`ORG_NAME` varchar(100) NOT NULL,
`ORG_ACRONYM` varchar(25) DEFAULT NULL,
`ORG_LOCATION` varchar(100) NOT NULL,
PRIMARY KEY (`ORG_ID`)
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `organization`
--
/*!40000 ALTER TABLE `organization` DISABLE KEYS */;
INSERT INTO `organization` (`ORG_ID`,`ORG_NAME`,`ORG_ACRONYM`,`ORG_LOCATION`) VALUES
(1,' N/A',' N/A',''),
(2,'Philippines Society of Information Technology Educators','PSITE','Manila'),
(3,'','',''),
(4,'Philippine Computing Organization Alliance','PCOA','DLSU Manila'),
(5,'Computing Society of the Philippines','CSP','Manila'),
(7,'Association Of Computing Machinery','ACM','Manila');
/*!40000 ALTER TABLE `organization` ENABLE KEYS */;
--
-- Definition of table `position`
--
DROP TABLE IF EXISTS `position`;
CREATE TABLE `position` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`POSITION_ID` varchar(5) NOT NULL,
`POSITION_TITLE` varchar(45) NOT NULL,
PRIMARY KEY (`POSITION_ID`),
UNIQUE KEY `ID` (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `position`
--
/*!40000 ALTER TABLE `position` DISABLE KEYS */;
INSERT INTO `position` (`ID`,`POSITION_ID`,`POSITION_TITLE`) VALUES
(1,'P0000','Administrator'),
(2,'P0001','Dean'),
(3,'P0002','Chairperson'),
(4,'P0003','Full Time - Faculty'),
(5,'P0004','Part Time - Faculty'),
(6,'P0005','Academic Staff'),
(7,'P0006','Academic Service Faculty'),
(8,'PPPPP',' N/A');
/*!40000 ALTER TABLE `position` ENABLE KEYS */;
--
-- Definition of table `professional_acty`
--
DROP TABLE IF EXISTS `professional_acty`;
CREATE TABLE `professional_acty` (
`PA_ID` int(11) NOT NULL AUTO_INCREMENT,
`LEADER_TYPE` int(1) NOT NULL,
`FID` int(8) DEFAULT NULL,
`DESIGNATION` varchar(45) DEFAULT NULL,
`ORG_NAME` varchar(45) DEFAULT NULL,
`START_DATE` date DEFAULT NULL,
`END_DATE` varchar(25) DEFAULT NULL,
PRIMARY KEY (`PA_ID`),
KEY `fk_profacty_fid` (`FID`),
KEY `professional_acty_ibfk_1` (`ORG_NAME`),
CONSTRAINT `fk_profacty_fid` FOREIGN KEY (`FID`) REFERENCES `faculty` (`FID`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `professional_acty`
--
/*!40000 ALTER TABLE `professional_acty` DISABLE KEYS */;
INSERT INTO `professional_acty` (`PA_ID`,`LEADER_TYPE`,`FID`,`DESIGNATION`,`ORG_NAME`,`START_DATE`,`END_DATE`) VALUES
(1,1,97000001,'President','Manila Journal Science','2009-06-02','On-Going'),
(3,0,97000001,'Secretary','Manila Computation Society','2007-03-04','On-going');
/*!40000 ALTER TABLE `professional_acty` ENABLE KEYS */;
--
-- Definition of table `professional_exp`
--
DROP TABLE IF EXISTS `professional_exp`;
CREATE TABLE `professional_exp` (
`PE_ID` int(11) NOT NULL AUTO_INCREMENT,
`FID` int(8) DEFAULT NULL,
`LICENSURE_TITLE` varchar(45) DEFAULT NULL,
`YEAR_PASSED` int(4) DEFAULT NULL,
`LICENSE_NO` int(7) DEFAULT NULL,
`DATE_VALIDITY` date DEFAULT NULL,
PRIMARY KEY (`PE_ID`),
KEY `fk_profexp_fid` (`FID`),
CONSTRAINT `fk_profexp_fid` FOREIGN KEY (`FID`) REFERENCES `faculty` (`FID`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `professional_exp`
--
/*!40000 ALTER TABLE `professional_exp` DISABLE KEYS */;
/*!40000 ALTER TABLE `professional_exp` ENABLE KEYS */;
--
-- Definition of table `professional_prac`
--
DROP TABLE IF EXISTS `professional_prac`;
CREATE TABLE `professional_prac` (
`PP_ID` int(11) NOT NULL AUTO_INCREMENT,
`FID` int(8) DEFAULT NULL,
`WORK_NATURE` varchar(45) DEFAULT NULL,
`INSTITUTION` varchar(45) DEFAULT NULL,
`NO_YEARS` int(2) DEFAULT NULL,
`START_DATE` date DEFAULT NULL,
`END_DATE` date DEFAULT NULL,
PRIMARY KEY (`PP_ID`),
KEY `fk_profprac_fid` (`FID`),
KEY `professional_prac_ibfk_1` (`INSTITUTION`),
CONSTRAINT `fk_profprac_fid` FOREIGN KEY (`FID`) REFERENCES `faculty` (`FID`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `professional_prac`
--
/*!40000 ALTER TABLE `professional_prac` DISABLE KEYS */;
INSERT INTO `professional_prac` (`PP_ID`,`FID`,`WORK_NATURE`,`INSTITUTION`,`NO_YEARS`,`START_DATE`,`END_DATE`) VALUES
(1,97000001,'Dynamic Website','FEU',2,'2008-01-01','2009-01-01');
/*!40000 ALTER TABLE `professional_prac` ENABLE KEYS */;
--
-- Definition of table `pub_local`
--
DROP TABLE IF EXISTS `pub_local`;
CREATE TABLE `pub_local` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`local_type` varchar(15) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `pub_local`
--
/*!40000 ALTER TABLE `pub_local` DISABLE KEYS */;
INSERT INTO `pub_local` (`id`,`local_type`) VALUES
(1,' N/A'),
(2,'Local'),
(3,'International');
/*!40000 ALTER TABLE `pub_local` ENABLE KEYS */;
--
-- Definition of table `publication`
--
DROP TABLE IF EXISTS `publication`;
CREATE TABLE `publication` (
`PUB_CODE` int(11) NOT NULL AUTO_INCREMENT,
`FID` int(8) DEFAULT NULL,
`PUB_TYPE` varchar(5) DEFAULT NULL,
`PAPER_TITLE` varchar(250) DEFAULT NULL,
`WORK_TITLE` varchar(100) DEFAULT NULL,
`CONF_TITLE` varchar(100) DEFAULT NULL,
`SEMINAR_TITLE` varchar(100) DEFAULT NULL,
`JOURNAL` varchar(65) DEFAULT NULL,
`PUBLISHER` varchar(100) DEFAULT NULL,
`AUTHOR` varchar(100) DEFAULT NULL,
`VOLUME_NO` int(5) DEFAULT NULL,
`ISSUE_NO` varchar(25) DEFAULT NULL,
`ISBN` varchar(25) DEFAULT NULL,
`PATENT_NO` varchar(30) DEFAULT NULL,
`PAGES` varchar(20) DEFAULT NULL,
`PUBLICATION_TYPE` int(11) DEFAULT NULL,
`OUTPUT_TYPE` varchar(45) DEFAULT NULL,
`PAPER_TYPE` varchar(25) DEFAULT NULL,
`PLACE_PUBLICATION` varchar(45) DEFAULT NULL,
`DATE_PUBLICATION` date DEFAULT NULL,
`START_DATE` date DEFAULT NULL,
`END_DATE` date DEFAULT NULL,
`ISSUING_COUNTRY` varchar(3) DEFAULT NULL,
`EDITORS` varchar(100) DEFAULT NULL,
`PUBLISHED_IN` varchar(100) DEFAULT NULL,
`VENUE_PERFORMANCE` varchar(100) DEFAULT NULL,
`REMARKS` varchar(100) DEFAULT NULL,
`LOCAL` int(11) DEFAULT NULL,
`CO_AUTHOR` int(5) DEFAULT NULL,
PRIMARY KEY (`PUB_CODE`),
KEY `fk_publication_fid` (`FID`),
KEY `fk_pub_pubtype` (`PUB_TYPE`),
KEY `fk_pub_country` (`ISSUING_COUNTRY`),
KEY `fk_pub_journals` (`JOURNAL`),
KEY `fk_journalpub_type` (`PUBLICATION_TYPE`),
CONSTRAINT `fk_publication_fid` FOREIGN KEY (`FID`) REFERENCES `faculty` (`FID`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `fk_pub_country` FOREIGN KEY (`ISSUING_COUNTRY`) REFERENCES `country` (`COUNTRY_CODE`) ON DELETE SET NULL ON UPDATE CASCADE,
CONSTRAINT `fk_pub_pubtype` FOREIGN KEY (`PUB_TYPE`) REFERENCES `publication_type` (`PT_ID`) ON DELETE SET NULL ON UPDATE CASCADE,
CONSTRAINT `publication_ibfk_1` FOREIGN KEY (`PUBLICATION_TYPE`) REFERENCES `journal_publication` (`JOURNALPUB_ID`) ON DELETE SET NULL ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=18 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `publication`
--
/*!40000 ALTER TABLE `publication` DISABLE KEYS */;
INSERT INTO `publication` (`PUB_CODE`,`FID`,`PUB_TYPE`,`PAPER_TITLE`,`WORK_TITLE`,`CONF_TITLE`,`SEMINAR_TITLE`,`JOURNAL`,`PUBLISHER`,`AUTHOR`,`VOLUME_NO`,`ISSUE_NO`,`ISBN`,`PATENT_NO`,`PAGES`,`PUBLICATION_TYPE`,`OUTPUT_TYPE`,`PAPER_TYPE`,`PLACE_PUBLICATION`,`DATE_PUBLICATION`,`START_DATE`,`END_DATE`,`ISSUING_COUNTRY`,`EDITORS`,`PUBLISHED_IN`,`VENUE_PERFORMANCE`,`REMARKS`,`LOCAL`,`CO_AUTHOR`) VALUES
(1,97011112,'PT001','Development Of Web-Base FIS',NULL,NULL,NULL,'4',NULL,NULL,1,'ISN1111',NULL,NULL,'4-7',5,NULL,NULL,NULL,'2008-09-02',NULL,NULL,NULL,NULL,NULL,NULL,NULL,2,NULL),
(2,97011112,'PT001','Development Of FIS',NULL,NULL,NULL,'2',NULL,NULL,1,'ISN',NULL,NULL,'4',5,NULL,NULL,NULL,'2006-02-01',NULL,NULL,NULL,NULL,NULL,NULL,NULL,2,NULL),
(3,97000001,'PT001','Development Of',NULL,NULL,NULL,'2',NULL,NULL,4,'3',NULL,NULL,'45-46',2,NULL,NULL,NULL,'2005-01-01',NULL,NULL,NULL,NULL,NULL,NULL,NULL,3,NULL),
(4,97000001,'PT002','Franco',NULL,NULL,NULL,'Proto',NULL,NULL,2,'1','12345',NULL,'4-5',NULL,NULL,NULL,NULL,'2007-01-01',NULL,NULL,NULL,NULL,NULL,NULL,NULL,2,NULL),
(6,97000001,'PT003','Patents Of New',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'112233',NULL,NULL,NULL,NULL,NULL,'2001-01-01',NULL,NULL,'PHL',NULL,NULL,NULL,NULL,NULL,NULL),
(8,97000001,'PT006','The Legend','Book Of',NULL,NULL,NULL,'Sterling',NULL,NULL,NULL,'123456',NULL,'3-4',NULL,NULL,NULL,'Manila','2005-01-01',NULL,NULL,NULL,'Lunarsss',NULL,NULL,NULL,2,NULL),
(9,97000001,'PT007','Published Paper Of New',NULL,'International Conference',NULL,NULL,'IEEE 1122',NULL,NULL,NULL,NULL,NULL,'3-4',NULL,NULL,NULL,'India','2005-02-03',NULL,NULL,NULL,NULL,NULL,NULL,NULL,3,2),
(10,97000001,'PT008','Lunar',NULL,NULL,NULL,NULL,'IEEE International',NULL,NULL,NULL,NULL,NULL,'7-10',NULL,NULL,NULL,'Kuala, Lumpur','2009-02-05',NULL,NULL,NULL,NULL,'Singapore',NULL,NULL,3,NULL),
(11,97000001,'PT009','The Play',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'2006-02-03',NULL,NULL,NULL,NULL,NULL,'Cultural Center Of The Phil',NULL,NULL,NULL),
(12,97000001,'PT010','My Special Research',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'Journal List',NULL,'2009-01-03',NULL,NULL,NULL,NULL,NULL,NULL,'Anything That Can Be Processed',2,1),
(13,97000001,'PT011',NULL,NULL,NULL,'Agile Methodology',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'2009-02-04','2009-02-16',NULL,NULL,NULL,'Marikina',NULL,2,NULL),
(14,97000001,'PT005','My Book',NULL,NULL,NULL,NULL,'Pearl Publisher',NULL,NULL,NULL,'123456',NULL,NULL,NULL,NULL,NULL,'Manila','2008-01-01',NULL,NULL,NULL,NULL,NULL,NULL,NULL,2,NULL),
(15,97000001,'PT001','Pag-aaral',NULL,NULL,NULL,'Maligaya',NULL,NULL,5,'2',NULL,NULL,'89',4,NULL,NULL,NULL,'2009-06-01',NULL,NULL,NULL,NULL,NULL,NULL,NULL,3,2),
(16,97000001,'PT002','Prototype',NULL,NULL,NULL,'Bahay Kubo',NULL,NULL,3,'5','1234BNN',NULL,'78',NULL,NULL,NULL,NULL,'2003-01-01',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(17,97000001,'PT005','My Book Book',NULL,NULL,NULL,NULL,'Published Everywhere',NULL,NULL,NULL,'465667BBBNN',NULL,NULL,NULL,NULL,NULL,'Mnila','2001-01-01',NULL,NULL,NULL,NULL,NULL,NULL,NULL,3,NULL);
/*!40000 ALTER TABLE `publication` ENABLE KEYS */;
--
-- Definition of table `publication_type`
--
DROP TABLE IF EXISTS `publication_type`;
CREATE TABLE `publication_type` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`PT_ID` varchar(5) NOT NULL,
`PT_TITLE` varchar(45) NOT NULL,
PRIMARY KEY (`PT_ID`),
UNIQUE KEY `id` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `publication_type`
--
/*!40000 ALTER TABLE `publication_type` DISABLE KEYS */;
INSERT INTO `publication_type` (`id`,`PT_ID`,`PT_TITLE`) VALUES
(1,'PT001','Journal'),
(2,'PT002','Prototype'),
(3,'PT003','Patent'),
(4,'PT004','Book'),
(5,'PT005','Textbook'),
(6,'PT006','Chapter'),
(7,'PT007','Conference'),
(8,'PT008','Other Published'),
(9,'PT009','Screen Play'),
(10,'PT010','Other Research'),
(11,'PT011','Seminars');
/*!40000 ALTER TABLE `publication_type` ENABLE KEYS */;
--
-- Definition of table `rank`
--
DROP TABLE IF EXISTS `rank`;
CREATE TABLE `rank` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`rank_code` varchar(25) NOT NULL,
`rank_title` varchar(35) NOT NULL,
PRIMARY KEY (`id`),
KEY `rank_code` (`rank_code`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `rank`
--
/*!40000 ALTER TABLE `rank` DISABLE KEYS */;
INSERT INTO `rank` (`id`,`rank_code`,`rank_title`) VALUES
(1,' N/A',' N/A'),
(2,'AP1','Assistant Professor 1'),
(3,'AP2','Assistant Professor 2'),
(4,'AP3','Assistant Professor 3'),
(5,'L1','Lecturer 1'),
(6,'L2','Lecturer 2'),
(8,'L3','Lecturer 3'),
(9,'AP4','Assistant Professor 4');
/*!40000 ALTER TABLE `rank` ENABLE KEYS */;
--
-- Definition of table `research_external`
--
DROP TABLE IF EXISTS `research_external`;
CREATE TABLE `research_external` (
`RESEARCH_ID` int(11) NOT NULL AUTO_INCREMENT,
`FID` int(8) DEFAULT NULL,
`RESEARCH_TITLE` varchar(100) DEFAULT NULL,
`RESEARCH_TYPE` varchar(45) DEFAULT NULL,
`FUNDING_TYPE` varchar(40) DEFAULT NULL,
`FAGENCY` varchar(45) DEFAULT NULL,
`CURRENCY` varchar(45) DEFAULT NULL,
`AMOUNT` float(12,2) DEFAULT NULL,
`START_DATE` date DEFAULT NULL,
`END_DATE` varchar(15) DEFAULT NULL,
PRIMARY KEY (`RESEARCH_ID`),
KEY `fk_resext_fid` (`FID`),
KEY `fk_resext_fagency` (`FAGENCY`),
CONSTRAINT `fk_resext_fid` FOREIGN KEY (`FID`) REFERENCES `faculty` (`FID`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `research_external`
--
/*!40000 ALTER TABLE `research_external` DISABLE KEYS */;
INSERT INTO `research_external` (`RESEARCH_ID`,`FID`,`RESEARCH_TITLE`,`RESEARCH_TYPE`,`FUNDING_TYPE`,`FAGENCY`,`CURRENCY`,`AMOUNT`,`START_DATE`,`END_DATE`) VALUES
(1,97000001,'Development Of Something','Funded','External','Pag-ibig','1',25999.00,'2009-01-02','2010-02-03'),
(2,97000001,'Creation Of New Porject','Grants','','International Of','',0.00,'2009-01-01','2010-01-01'),
(3,97000001,'Bahay Kubo','Grants','','Kahit Munti','',0.00,'2006-02-03','On-going');
/*!40000 ALTER TABLE `research_external` ENABLE KEYS */;
--
-- Definition of table `research_internal`
--
DROP TABLE IF EXISTS `research_internal`;
CREATE TABLE `research_internal` (
`RESEARCH_ID` int(11) NOT NULL AUTO_INCREMENT,
`FID` int(8) DEFAULT NULL,
`RESEARCH_TITLE` varchar(100) DEFAULT NULL,
`RESEARCH_TYPE` varchar(45) DEFAULT NULL,
`FUNDING_TYPE` varchar(40) DEFAULT NULL,
`FUNDING_UNIT` varchar(20) DEFAULT NULL,
`CURRENCY` varchar(45) DEFAULT NULL,
`AMOUNT` decimal(12,2) DEFAULT NULL,
`START_DATE` date DEFAULT NULL,
`END_DATE` varchar(15) DEFAULT NULL,
PRIMARY KEY (`RESEARCH_ID`),
KEY `fk_resint_fid` (`FID`),
KEY `fk_resint_fundunit` (`FUNDING_UNIT`),
CONSTRAINT `fk_resint_fid` FOREIGN KEY (`FID`) REFERENCES `faculty` (`FID`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `research_internal_ibfk_1` FOREIGN KEY (`FUNDING_UNIT`) REFERENCES `unit` (`Unit_Code`) ON DELETE SET NULL ON UPDATE SET NULL
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `research_internal`
--
/*!40000 ALTER TABLE `research_internal` DISABLE KEYS */;
INSERT INTO `research_internal` (`RESEARCH_ID`,`FID`,`RESEARCH_TITLE`,`RESEARCH_TYPE`,`FUNDING_TYPE`,`FUNDING_UNIT`,`CURRENCY`,`AMOUNT`,`START_DATE`,`END_DATE`) VALUES
(2,97000001,'Development Of Web','Funded','Internal','COE','PhP','25000.00','2008-01-01','On-going');
/*!40000 ALTER TABLE `research_internal` ENABLE KEYS */;
--
-- Definition of table `special_training`
--
DROP TABLE IF EXISTS `special_training`;
CREATE TABLE `special_training` (
`ST_ID` int(11) NOT NULL AUTO_INCREMENT,
`FID` int(8) DEFAULT NULL,
`TRAINING_TITLE` varchar(100) DEFAULT NULL,
`VENUE` varchar(45) DEFAULT NULL,
`START_DATE` date DEFAULT NULL,
`END_DATE` date DEFAULT NULL,
`INSTITUTION` varchar(45) DEFAULT NULL,
PRIMARY KEY (`ST_ID`),
KEY `fk_spectrain_fid` (`FID`),
KEY `fk_strain_instid` (`INSTITUTION`),
CONSTRAINT `fk_spectrain_fid` FOREIGN KEY (`FID`) REFERENCES `faculty` (`FID`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `special_training`
--
/*!40000 ALTER TABLE `special_training` DISABLE KEYS */;
INSERT INTO `special_training` (`ST_ID`,`FID`,`TRAINING_TITLE`,`VENUE`,`START_DATE`,`END_DATE`,`INSTITUTION`) VALUES
(1,97000001,'Agile Methodology','Caloocan, City','2009-01-06','2009-01-12','De La Salle University');
/*!40000 ALTER TABLE `special_training` ENABLE KEYS */;
--
-- Definition of table `status`
--
DROP TABLE IF EXISTS `status`;
CREATE TABLE `status` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`ACTIVE` varchar(25) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `status`
--
/*!40000 ALTER TABLE `status` DISABLE KEYS */;
INSERT INTO `status` (`id`,`ACTIVE`) VALUES
(1,'Active'),
(2,'Inactive');
/*!40000 ALTER TABLE `status` ENABLE KEYS */;
--
-- Definition of table `teaching_experience`
--
DROP TABLE IF EXISTS `teaching_experience`;
CREATE TABLE `teaching_experience` (
`TE_ID` int(11) NOT NULL AUTO_INCREMENT,
`FID` int(8) DEFAULT NULL,
`EL_ID` varchar(5) DEFAULT NULL,
`INSTITUTION_ID` int(11) DEFAULT NULL,
`NO_YEARS` int(3) DEFAULT NULL,
`START_DATE` date DEFAULT NULL,
`END_DATE` date DEFAULT NULL,
`POSITION_ID` varchar(5) DEFAULT NULL,
PRIMARY KEY (`TE_ID`),
KEY `fk_teachexp_fid` (`FID`),
KEY `fk_teachexp` (`EL_ID`),
KEY `fk_teachexp_inst` (`INSTITUTION_ID`),
KEY `fk_teachexp_pos` (`POSITION_ID`),
CONSTRAINT `fk_teachexp_fid` FOREIGN KEY (`FID`) REFERENCES `faculty` (`FID`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `teaching_experience_ibfk_1` FOREIGN KEY (`EL_ID`) REFERENCES `educ_level` (`EL_ID`) ON DELETE SET NULL ON UPDATE CASCADE,
CONSTRAINT `teaching_experience_ibfk_2` FOREIGN KEY (`INSTITUTION_ID`) REFERENCES `institution` (`INSTITUTION_ID`) ON DELETE SET NULL ON UPDATE CASCADE,
CONSTRAINT `teaching_experience_ibfk_3` FOREIGN KEY (`POSITION_ID`) REFERENCES `position` (`POSITION_ID`) ON DELETE SET NULL ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `teaching_experience`
--
/*!40000 ALTER TABLE `teaching_experience` DISABLE KEYS */;
INSERT INTO `teaching_experience` (`TE_ID`,`FID`,`EL_ID`,`INSTITUTION_ID`,`NO_YEARS`,`START_DATE`,`END_DATE`,`POSITION_ID`) VALUES
(2,97000001,'EL003',7,2,'2012-01-01','2014-01-01','P0003');
/*!40000 ALTER TABLE `teaching_experience` ENABLE KEYS */;
--
-- Definition of table `unit`
--
DROP TABLE IF EXISTS `unit`;
CREATE TABLE `unit` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`Unit_Code` varchar(20) NOT NULL,
`Unit_Title` varchar(75) NOT NULL,
PRIMARY KEY (`Unit_Code`),
UNIQUE KEY `id` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `unit`
--
/*!40000 ALTER TABLE `unit` DISABLE KEYS */;
INSERT INTO `unit` (`id`,`Unit_Code`,`Unit_Title`) VALUES
(2,'AVCAS','Office of the Associate Vice Chancellor for Academic Affairs'),
(3,'CCS','College of Computer Studies'),
(4,'CED','College of Education'),
(5,'CLA','College of Liberal Arts'),
(16,'COB','College Of Business'),
(7,'COE','College of Engineering'),
(8,'COL','College of Law'),
(9,'COS','College of Science'),
(10,'EVPERI','Executive Vice President for External Relations and Internallization'),
(1,'N/A',' N/A'),
(11,'OPC','Office of the President and Chancellor'),
(12,'SoE','School of Economics'),
(13,'STA','Student Affairs'),
(14,'VCLMAR','Office of the Vice Chancellor for Lasallian Mission and Alumni Relations'),
(15,'VCR','Office of the Associate Vice Chancellor for Research');
/*!40000 ALTER TABLE `unit` ENABLE KEYS */;
/*!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 */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
SELECT
TRANSFER_AMOUNT,
WITHDRAW_RESULT_DATE,
MRR_RATE
FROM
(
SELECT
--回収実績額
TRANSFER_AMOUNT,
--回収実績日
WITHDRAW_RESULT_DATE,
--MRRレート
0 AS MRR_RATE
FROM
--消込履歴詳細
NEGATION_HISTORY_DETAIL_INFO
WHERE
--消込履歴詳細.回収種別 = リース料
WITHDRAW_CASUS = CAST(/*dto.withdrawCasusLease*/ AS CHAR(2))
--消込履歴詳細.契約番号 = パラメータ.契約番号
AND CONTRACT_NO = /*dto.contractNo*/''
--消込履歴詳細.回数 = パラメータ.回数
AND COUPON = /*dto.coupon*/
--消込履歴詳細.入金結果フラグ = 成功
AND TRANSFER_RESULT_FLG = CAST(/*dto.receiptResultFlgSucc*/ AS CHAR(1))
--消込履歴詳細.消込失敗フラグ = OFF
AND NEGATION_FAIL_FLG = CAST(/*dto.negationFailFlgOff*/ AS CHAR(1))
--消込履歴詳細.入金取消フラグ = OFF
AND RESULT_FLG_CANCLE_FLG = '0'
UNION ALL
SELECT
0 AS TRANSFER_AMOUNT,
START_DATE AS WITHDRAW_RESULT_DATE,
MRR_RATE
FROM MRR_RATE_MST
) AS T
ORDER BY
WITHDRAW_RESULT_DATE
|
--
-- PostgreSQL database dump
--
SET statement_timeout = 0;
SET lock_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SET check_function_bodies = false;
SET client_min_messages = warning;
SET search_path = public, pg_catalog;
ALTER TABLE ONLY public.films DROP CONSTRAINT title_unique;
DROP TABLE public.films;
DROP EXTENSION plpgsql;
DROP SCHEMA public;
--
-- Name: public; Type: SCHEMA; Schema: -; Owner: -
--
CREATE SCHEMA public;
--
-- Name: SCHEMA public; Type: COMMENT; Schema: -; Owner: -
--
COMMENT ON SCHEMA public IS 'standard public schema';
--
-- Name: plpgsql; Type: EXTENSION; Schema: -; Owner: -
--
CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
--
-- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner: -
--
COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
SET search_path = public, pg_catalog;
SET default_tablespace = '';
SET default_with_oids = false;
--
-- Name: films; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE films (
title character varying(255) NOT NULL,
year integer NOT NULL,
genre character varying(100) NOT NULL,
director_id integer,
duration integer NOT NULL,
CONSTRAINT title_length CHECK ((length((title)::text) >= 1)),
CONSTRAINT year_range CHECK (((year >= 1900) AND (year <= 2100)))
);
--
-- Data for Name: films; Type: TABLE DATA; Schema: public; Owner: -
--
INSERT INTO films VALUES ('Die Hard', 1988, 'action', 1, 132);
INSERT INTO films VALUES ('Casablanca', 1942, 'drama', 2, 102);
INSERT INTO films VALUES ('The Conversation', 1974, 'thriller', 3, 113);
INSERT INTO films VALUES ('The Godfather', 1970, 'thriller', 3, 220);
INSERT INTO films VALUES ('1984', 1956, 'scifi', 4, 90);
;
CREATE TABLE directors (
id serial,
name text,
review text
);
INSERT INTO directors (name, review)
VALUES ('John McTiernan', 'great guy'),
('Michael Curtiz', 'mediocre'),
('Francis Ford Coppola', 'so talented'),
('Michael Anderson', 'don''t know him');
--
-- PostgreSQL database dump complete
--
-- add a primary key to the directors table
ALTER TABLE directors
ADD PRIMARY KEY (id);
-- the director_id column of films is a foreign key referencing directors
ALTER TABLE films
ADD FOREIGN KEY (director_id) REFERENCES directors (id) ON DELETE CASCADE;
-- adding a film with a director_id that does not match any director will lead
-- to an error, because it violates "referential integrity", i.e., we would have a record in the films table with no matching record in the directors table.
INSERT INTO films
VALUES ('Some movie', 1940, 'drama', 10, 100);
-- ERROR: insert or update on table "films" violates foreign key constraint "films_director_id_fkey"
-- DETAIL: Key (director_id)=(10) is not present in table "directors".
-- However, we can add another Coppola movie:
INSERT INTO films
VALUES ('Gangs of New York', 2010, 'drama', 3, 120);
-- When we join the two tables, we see the correct result:
SELECT *
FROM films
INNER JOIN directors
ON films.director_id = directors.id;
-- Now how about this?
SELECT *
FROM films, directors
WHERE films.director_id = directors.id;
-- same result. according to the wikipedia page on joins, this is essentially a cross join restricted by a where clause. wikipedia also says this is "implicit join" notation.
|
ALTER TABLE bets
CHANGE probability p_9 float(15,14) DEFAULT NULL,
ADD p_10 float(15,14) DEFAULT NULL,
ADD p_11 float(15,14) DEFAULT NULL,
ADD p_12 float(15,14) DEFAULT NULL,
ADD p_13 float(15,14) DEFAULT NULL,
ADD p_14 float(15,14) DEFAULT NULL;
|
-- phpMyAdmin SQL Dump
-- version 4.5.1
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: Feb 22, 2019 at 06:34 PM
-- Server version: 10.1.13-MariaDB
-- PHP Version: 7.0.6
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: `twlp_php_ecommerce`
--
-- --------------------------------------------------------
--
-- Table structure for table `tbl_admin`
--
CREATE TABLE `tbl_admin` (
`adminId` int(11) NOT NULL,
`adminName` varchar(255) NOT NULL,
`adminUser` varchar(255) NOT NULL,
`adminEmail` varchar(255) NOT NULL,
`adminPass` varchar(255) NOT NULL,
`lavel` tinyint(4) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `tbl_admin`
--
INSERT INTO `tbl_admin` (`adminId`, `adminName`, `adminUser`, `adminEmail`, `adminPass`, `lavel`) VALUES
(1, 'Admin', 'admin', 'admin@gmail.com', '202cb962ac59075b964b07152d234b70', 0);
-- --------------------------------------------------------
--
-- Table structure for table `tbl_brand`
--
CREATE TABLE `tbl_brand` (
`brandId` int(11) NOT NULL,
`brandName` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `tbl_brand`
--
INSERT INTO `tbl_brand` (`brandId`, `brandName`) VALUES
(15, 'SAMSUNG'),
(19, 'CANON'),
(20, 'HP'),
(21, 'Intel');
-- --------------------------------------------------------
--
-- Table structure for table `tbl_category`
--
CREATE TABLE `tbl_category` (
`catId` int(11) NOT NULL,
`catName` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `tbl_category`
--
INSERT INTO `tbl_category` (`catId`, `catName`) VALUES
(1, 'Desktop'),
(3, 'Laptop'),
(4, 'Camera'),
(6, 'Software'),
(8, 'Mobile Phones');
-- --------------------------------------------------------
--
-- Table structure for table `tbl_product`
--
CREATE TABLE `tbl_product` (
`productId` int(11) NOT NULL,
`productName` varchar(255) NOT NULL,
`catId` int(11) NOT NULL,
`brandId` int(11) NOT NULL,
`body` text NOT NULL,
`price` float(10,2) NOT NULL,
`image` varchar(255) NOT NULL,
`type` tinyint(4) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `tbl_product`
--
INSERT INTO `tbl_product` (`productId`, `productName`, `catId`, `brandId`, `body`, `price`, `image`, `type`) VALUES
(1, 'Samsung Galaxy S9', 8, 15, 'Samsung Galaxy S9 ', 15000.00, 'uploads/18c70c0b08.jpg', 0),
(2, 'Samsung Galaxy J7 Duo', 8, 15, 'Samsung Galaxy J7 Duo', 15236.00, 'uploads/70eeb0adc0.jpg', 0),
(3, 'Canon EOS Rebel SL2', 4, 19, 'Canon EOS Rebel SL2', 145695.00, 'uploads/087c1725ab.jpg', 0),
(4, 'HP 15.6 inch HD Notebook', 3, 20, 'HP 15.6 inch HD Notebook(2018) ', 12563.00, 'uploads/6bb7b1bf9f.jpg', 0),
(5, 'HP 15-f233wm 15.6in.', 3, 20, 'HP 15-f233wm 15.6in. (500GB, Intel Celeron N, 1.6GHz, 4GB) Notebook/Laptop - Black - L0T33UA#ABA ', 15695.00, 'uploads/f10b379c17.jpg', 0),
(6, 'HP 15-f233wm 15.6in.', 3, 20, ' HP 15-f233wm 15.6in. (500GB, Intel Celeron N, 1.6GHz, 4GB) Notebook/Laptop - Black - L0T33UA#ABA ', 15695.00, 'uploads/2c64cae5c9.jpg', 0),
(7, 'Inspiron 15 5000', 3, 20, ' 15-inch laptop delivering an exceptional viewing experience, a head-turning finish and an array of options designed to elevate your entertainment, wherever you go.\r\n\r\nInterested in a dedicated graphics card for premium entertainment? Check out our Inspiron 15 7000 laptop with NVIDIA® GeForce® MX130 graphics. ', 85000.00, 'uploads/da4a5b6d95.jpg', 1),
(8, 'HP ENVY x360 - 13-ag0018au', 3, 20, 'The remarkable versatility of the 13" ENVY x360 PC gives you the freedom to go anywhere life takes you. With the newest AMD processor and up to 12.5 hours of battery life[1], it delivers ample power in a slim and sleek design that’s easily portable. Enhanced privacy frees you up to do more on-the-go ', 25499.00, 'uploads/25ed7fae02.jpg', 0),
(9, 'Refurbished HP 7800 Desktop PC', 1, 21, 'Refurbished HP 7800 Desktop PC with Intel Core 2 Duo Processor, 4GB Memory, 19" Monitor, 250GB Hard Drive and Windows 10 Home', 85720.00, 'uploads/2e93ada674.jpeg', 0),
(10, 'GCâ„¢ 10 Marine Camera', 4, 19, 'GCâ„¢ 10 Marine Camera ', 334.99, 'uploads/6e0697a3b9.jpg', 1);
--
-- Indexes for dumped tables
--
--
-- Indexes for table `tbl_admin`
--
ALTER TABLE `tbl_admin`
ADD PRIMARY KEY (`adminId`);
--
-- Indexes for table `tbl_brand`
--
ALTER TABLE `tbl_brand`
ADD PRIMARY KEY (`brandId`);
--
-- Indexes for table `tbl_category`
--
ALTER TABLE `tbl_category`
ADD PRIMARY KEY (`catId`);
--
-- Indexes for table `tbl_product`
--
ALTER TABLE `tbl_product`
ADD PRIMARY KEY (`productId`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `tbl_admin`
--
ALTER TABLE `tbl_admin`
MODIFY `adminId` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `tbl_brand`
--
ALTER TABLE `tbl_brand`
MODIFY `brandId` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=22;
--
-- AUTO_INCREMENT for table `tbl_category`
--
ALTER TABLE `tbl_category`
MODIFY `catId` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;
--
-- AUTO_INCREMENT for table `tbl_product`
--
ALTER TABLE `tbl_product`
MODIFY `productId` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
INSERT INTO account (account_id, name, email_id, phone) VALUES ('1', 'Supaureeya Saha', 'supaureeya123@gmail.com', '45443543');
INSERT INTO account (account_id, name, email_id, phone) VALUES ('2', 'Subarna Saha', 'subarna.saha.1994@gmail.com', '23543254');
INSERT INTO product(product_id, product_name, unit_price) VALUES ('1', 'Yoga Mat', '200');
INSERT INTO product(product_id, product_name, unit_price) VALUES ('2', 'Yonex GR 303 Badminton Racquet', '499');
INSERT INTO product(product_id, product_name, unit_price) VALUES ('3', 'Cosco Dribble Basket Balls', '780');
INSERT INTO product(product_id, product_name, unit_price) VALUES ('4', 'Samsung 192 L Refrigirator', '16490');
INSERT INTO product(product_id, product_name, unit_price) VALUES ('5', 'Bajaj Cooler', '5490');
INSERT INTO product(product_id, product_name, unit_price) VALUES ('6', 'Wings of Fire', '223');
INSERT INTO product(product_id, product_name, unit_price) VALUES ('7', 'ELEVEN MINUTES', '198');
INSERT INTO product(product_id, product_name, unit_price) VALUES ('8', 'Redmi Note 7', '10900');
INSERT INTO product(product_id, product_name, unit_price) VALUES ('9', 'Samsung M20', '10499');
INSERT INTO order_table (order_id, account_id, product_id, quantity, date, status) VALUES ('1233', '1', '2', '2', '2019-04-01', 'PENDING');
INSERT INTO order_table (order_id, account_id, product_id, quantity, date, status) VALUES ('1234', '1', '1', '1', '2019-04-01', 'PENDING');
INSERT INTO order_table (order_id, account_id, product_id, quantity, date, status) VALUES ('1235', '1', '6', '1', '2019-04-01', 'PENDING');
INSERT INTO order_table (order_id, account_id, product_id, quantity, date, status) VALUES ('1236', '1', '7', '1', '2019-04-01', 'PENDING');
INSERT INTO order_table (order_id, account_id, product_id, quantity, date, status) VALUES ('1237', '1', '9', '1', '2019-04-01', 'PENDING'); |
-- CREATE DATABASE IF NOT EXISTS lianyu_web DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
-- create user lianyu_web@localhost identified by '123456';
-- grant all on lianyu_web.* to 'lianyu_web'@'localhost'; |
DROP TABLE IF EXISTS TEST;
CREATE TABLE TEST(ID INT AUTO_INCREMENT PRIMARY KEY,
NAME VARCHAR(255) NOT NULL
);
DROP TABLE IF EXISTS TRADE_STORE;
CREATE TABLE TRADE_STORE (
ID INT AUTO_INCREMENT PRIMARY KEY,
TRADE_ID VARCHAR(10) NOT NULL,
VERSION INT NOT NULL,
COUNTER_PARTY_ID VARCHAR(25) NOT NULL,
BOOK_ID VARCHAR(250) NOT NULL,
EXPIRED_FLAG CHAR(1) NOT NULL,
MATURITY_ON DATE NOT NULL,
CREATED_ON DATE DEFAULT CURRENT_DATE NOT NULL
);
INSERT INTO TRADE_STORE (TRADE_ID, VERSION, COUNTER_PARTY_ID,BOOK_ID,EXPIRED_FLAG,MATURITY_ON,
CREATED_ON) VALUES
('T1', 1, 'CP-1','B1','N',TO_DATE('20-MAY-2020','DD-MON-YYYY'),CURRENT_DATE),
('T2', 2, 'CP-2','B1','N',TO_DATE('20-MAY-2021','DD-MON-YYYY'),CURRENT_DATE),
('T2', 1, 'CP-1','B1','N',TO_DATE('20-MAY-2021','DD-MON-YYYY'),CURRENT_DATE),
('T3', 3, 'CP-3','B2','N',TO_DATE('20-MAY-2014','DD-MON-YYYY'),CURRENT_DATE);
|
with allICU as
(select
uniquepid,
patienthealthsystemstayid,
patientunitstayid,
gender,
age,
ethnicity,
hospitaladmitoffset,
unitdischargeoffset,
hospitaldischargeoffset,
unitdischargestatus,
hospitaldischargestatus,
ROW_NUMBER() OVER (PARTITION BY patienthealthsystemstayid ORDER BY hospitaladmitoffset) as ICU_rank
-- hospitalid,
-- wardid,
-- apacheadmissiondx,
-- admissionheight,
-- hospitaladmitsource,
-- hospitaldischargeyear,
-- hospitaldischargetime24,
-- hospitaladmittime24,
-- hospitaldischargelocation,
-- unittype,
-- unitadmitsource,
-- unitvisitnumber,
-- unitstaytype,
-- admissionweight,
-- dischargeweight,
-- unitdischargetime24,
-- unitdischargelocation
from `physionet-data.eicu_crd.patient` -- table of ICU stays confusingly called "patients"
where unitDischargeOffset > 720 -- los is longer than 12 hours
),
firstICU as (
select * from allICU
where ICU_rank = 1 -- first icu stay within the same hospital admission
),
on_mech_vent as(
select icu.*, ox.vent_start, ox.vent_end, ox.oxygen_therapy_type, ox.supp_oxygen
from firstICU icu
inner join `NMB_eICU.eicu_oxygen_therapy` ox
on icu.patientunitstayid = ox.icustay_id
where ox.ventnum = 1
and oxygen_therapy_type = 4),
------------------------------------------------------------------------------------------------------------------------
-- now we compute PF ratios
pao2 as --pao2 from lab
(
select lab.patientunitstayid, labresult as pao2, lab.labresultoffset
from
(select *
from `physionet-data.eicu_crd.lab` lab
where lower(labname) like 'pao2%') lab
left outer join on_mech_vent mv
on lab.patientunitstayid = mv.patientunitstayid
where labresultoffset between -1440 + vent_start and 1440 + vent_start
-- group by patientunitstayid
)
,
fio2 as --FIO2 from respchart
(SELECT
DISTINCT rp.patientunitstayid,
case
when CAST(respchartvalue AS numeric) > 0 and CAST(respchartvalue AS numeric) <= 1
then CAST(respchartvalue AS numeric) * 100
-- improperly input data - looks like O2 flow in litres
when CAST(respchartvalue AS numeric) > 1 and CAST(respchartvalue AS numeric) < 21
then null
when CAST(respchartvalue AS numeric) >= 21 and CAST(respchartvalue AS numeric) <= 100
then CAST(respchartvalue AS numeric)
else null end -- unphysiological
as fio2,
-- , max(case when respchartvaluelabel = 'FiO2' then respchartvalue else null end) as fiO2
rp.respchartoffset
FROM
`physionet-data.eicu_crd.respiratorycharting` rp
left outer join on_mech_vent mv
on rp.patientunitstayid = mv.patientunitstayid
WHERE
respchartoffset BETWEEN -1440 + vent_start and 1440 + vent_start
AND respchartvalue <> ''
AND REGEXP_CONTAINS(respchartvalue, '^[0-9]{0,2}$')
ORDER BY
patientunitstayid),
pf_ratio as
(select fio2.patientunitstayid, 100 * pao2.pao2 / fio2.fio2 as pf, fio2.respchartoffset as fio2_offset, pao2.labresultoffset as pao2_offset
from fio2
inner join pao2
on fio2.patientunitstayid = pao2.patientunitstayid
where fio2.respchartoffset between pao2.labresultoffset - 240 and pao2.labresultoffset + 240
-- values are less than 4 hours apart
),
peep as
(
select lab.patientunitstayid, max(labresult) as peep, patientunitstayid as peep_offset
from `physionet-data.eicu_crd.lab` lab
where LOWER(labname) like "%peep%"
group by patientunitstayid
),
min_pf_ratio as (
select patientunitstayid, min(pf) as min_pf
from pf_ratio
group by patientunitstayid),
final as
(select mv.*, pf.min_pf, peep.peep
from on_mech_vent mv
inner join min_pf_ratio pf
on mv.patientunitstayid = pf.patientunitstayid
inner join peep
on mv.patientunitstayid = peep.patientunitstayid)
select *
from final
where min_pf <= 150
and peep >= 5
-- 6947 |
create table Person (
PersonID int not null identity constraint PK_Person primary key,
Name varchar(100) not null
); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.