text stringlengths 6 9.38M |
|---|
Create Procedure mERP_sp_Get_CSOutletGroup(@SchemeID Int)
as
Begin
Select SG.GroupID,
(Select Top 1 Case QPS When 0 Then 'No' Else 'Yes' End as QPS From tbl_mERP_SchemeOutlet Where SchemeID = SG.SchemeID
And GroupID = Max(SG.SubGroupID))
From tbl_mERP_SchemeSubGroup SG
Where SG.SchemeID = @SchemeID Group by SG.SchemeID,SG.GroupID Order By GroupID
End
|
-- phpMyAdmin SQL Dump
-- version 4.0.6deb1
-- http://www.phpmyadmin.net
--
-- Хост: localhost
-- Время создания: Дек 26 2013 г., 13:09
-- Версия сервера: 5.5.34-0ubuntu0.13.10.1
-- Версия PHP: 5.5.3-1ubuntu2.1
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
--
-- База данных: `royal`
--
-- --------------------------------------------------------
--
-- Структура таблицы `category_pages`
--
CREATE TABLE IF NOT EXISTS `category_pages` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`title` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Структура таблицы `contacts_pages`
--
CREATE TABLE IF NOT EXISTS `contacts_pages` (
`id` int(10) unsigned NOT NULL,
`phone_number` varchar(50) NOT NULL,
`address` varchar(100) NOT NULL,
`contact_name` varchar(50) NOT NULL,
`contact_email` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Структура таблицы `main_pages`
--
CREATE TABLE IF NOT EXISTS `main_pages` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`id_category_pages` int(10) unsigned NOT NULL,
`decription` text NOT NULL,
`content` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
/*!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.5.1
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: Jul 15, 2017 at 11:03 AM
-- Server version: 10.1.16-MariaDB
-- PHP Version: 5.6.24
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: `prjktdl`
--
-- --------------------------------------------------------
--
-- Table structure for table `hanghoa`
--
CREATE TABLE `hanghoa` (
`mahh` int(11) NOT NULL,
`tenhh` varchar(250) COLLATE utf8_unicode_ci NOT NULL,
`mausac` varchar(250) COLLATE utf8_unicode_ci NOT NULL,
`soluong` int(11) NOT NULL,
`ngaynhap` date NOT NULL,
`kichthuoc` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data for table `hanghoa`
--
INSERT INTO `hanghoa` (`mahh`, `tenhh`, `mausac`, `soluong`, `ngaynhap`, `kichthuoc`) VALUES
(1, 'Gấu Bông', 'rgb(102, 102, 102)', 5, '2017-06-07', 1),
(2, 'Bột giặt Omo', 'rgb(122, 8, 8)', 3, '2017-07-05', 1),
(3, 'Chảo chống dính', 'rgb(63, 68, 236)', 4, '2017-07-20', 1),
(4, 'Áo sơ mi', 'rgb(187, 43, 43)', 10, '2017-07-05', 1),
(5, 'Bình giữ nhiệt', 'rgb(106, 195, 16)', 3, '2017-07-26', 1);
-- --------------------------------------------------------
--
-- Table structure for table `hanghoa_ke`
--
CREATE TABLE `hanghoa_ke` (
`hh_id` int(11) NOT NULL,
`make` int(11) NOT NULL,
`thoigianthem` datetime NOT NULL,
`ngan` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data for table `hanghoa_ke`
--
INSERT INTO `hanghoa_ke` (`hh_id`, `make`, `thoigianthem`, `ngan`) VALUES
(1, 1, '2017-07-04 00:00:00', 2),
(1, 1, '2017-07-29 00:00:00', 5),
(1, 3, '2017-07-19 00:00:00', 4),
(2, 1, '2017-07-13 00:00:00', 1),
(4, 9, '2017-07-05 00:00:00', 3),
(4, 12, '2017-07-21 00:00:00', 4),
(4, 19, '2017-07-20 00:00:00', 2),
(5, 18, '2017-07-27 00:00:00', 1);
-- --------------------------------------------------------
--
-- Table structure for table `ke`
--
CREATE TABLE `ke` (
`make` int(11) NOT NULL,
`chieucao` int(11) NOT NULL,
`songan` int(11) NOT NULL,
`soluongsanpham` int(11) NOT NULL,
`makv` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data for table `ke`
--
INSERT INTO `ke` (`make`, `chieucao`, `songan`, `soluongsanpham`, `makv`) VALUES
(1, 2, 10, 0, 1),
(2, 2, 10, 0, 1),
(3, 2, 10, 0, 1),
(4, 2, 10, 0, 1),
(5, 2, 10, 0, 1),
(6, 2, 10, 0, 1),
(7, 2, 10, 0, 2),
(8, 2, 10, 0, 3),
(9, 2, 10, 0, 4),
(10, 2, 10, 0, 4),
(11, 2, 10, 0, 4),
(12, 2, 10, 0, 4),
(13, 2, 10, 0, 4),
(14, 3, 15, 0, 5),
(15, 3, 15, 0, 5),
(16, 3, 15, 0, 5),
(17, 3, 15, 0, 5),
(18, 3, 15, 0, 5),
(19, 3, 15, 0, 6),
(20, 3, 15, 0, 6),
(21, 3, 15, 0, 6),
(22, 3, 15, 0, 6),
(23, 3, 15, 0, 6),
(24, 3, 15, 0, 6),
(25, 3, 15, 0, 7),
(26, 4, 20, 0, 8);
-- --------------------------------------------------------
--
-- Table structure for table `khuvuc`
--
CREATE TABLE `khuvuc` (
`makv` int(11) NOT NULL,
`toadox` int(11) NOT NULL,
`toadoy` int(11) NOT NULL,
`gocxoay` int(11) NOT NULL,
`soluongke` int(11) NOT NULL,
`chieucao` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data for table `khuvuc`
--
INSERT INTO `khuvuc` (`makv`, `toadox`, `toadoy`, `gocxoay`, `soluongke`, `chieucao`) VALUES
(1, 220, 20, 0, 0, 0),
(2, 10, 40, -30, 0, 0),
(3, 0, 350, 30, 0, 0),
(4, 170, 125, 0, 0, 0),
(5, 170, 235, 0, 0, 0),
(6, 220, 360, 0, 0, 0),
(7, 1140, 115, 0, 0, 0),
(8, 1140, 232, 0, 0, 0);
--
-- Indexes for dumped tables
--
--
-- Indexes for table `hanghoa`
--
ALTER TABLE `hanghoa`
ADD PRIMARY KEY (`mahh`);
--
-- Indexes for table `hanghoa_ke`
--
ALTER TABLE `hanghoa_ke`
ADD PRIMARY KEY (`hh_id`,`make`,`thoigianthem`),
ADD KEY `make` (`make`);
--
-- Indexes for table `ke`
--
ALTER TABLE `ke`
ADD PRIMARY KEY (`make`),
ADD KEY `makv` (`makv`);
--
-- Indexes for table `khuvuc`
--
ALTER TABLE `khuvuc`
ADD PRIMARY KEY (`makv`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `hanghoa`
--
ALTER TABLE `hanghoa`
MODIFY `mahh` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
--
-- AUTO_INCREMENT for table `ke`
--
ALTER TABLE `ke`
MODIFY `make` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=27;
--
-- AUTO_INCREMENT for table `khuvuc`
--
ALTER TABLE `khuvuc`
MODIFY `makv` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `hanghoa_ke`
--
ALTER TABLE `hanghoa_ke`
ADD CONSTRAINT `hanghoa_ke_ibfk_1` FOREIGN KEY (`hh_id`) REFERENCES `hanghoa` (`mahh`),
ADD CONSTRAINT `hanghoa_ke_ibfk_2` FOREIGN KEY (`make`) REFERENCES `ke` (`make`);
--
-- Constraints for table `ke`
--
ALTER TABLE `ke`
ADD CONSTRAINT `ke_ibfk_1` FOREIGN KEY (`makv`) REFERENCES `khuvuc` (`makv`);
/*!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 */;
|
--unrecoverable.sql
@ttitle 'Unrecoverable Report'
set line 200 trimspool on
set pagesize 100
col name format a80
alter session set nls_date_format = 'yyyy-mm-dd hh24:mi:ss';
select name, unrecoverable_time, unrecoverable_change#
from v$datafile
where unrecoverable_time is not null
and unrecoverable_change# > 0
order by name
/
|
/* Создание процедуры получения статистики по розыгрышу */
CREATE OR ALTER PROCEDURE /*PREFIX*/GET_LOTTERY_STATISTICS
(
TIRAGE_ID VARCHAR(32)
)
RETURNS
(
ALL_COUNT INTEGER,
USED_COUNT INTEGER,
NOT_USED_COUNT INTEGER,
PRIZE_SUM NUMERIC(15,2),
JACKPOT_SUM NUMERIC(15,2),
FIRST_ROUND_SUM NUMERIC(15,2),
SECOND_ROUND_SUM NUMERIC(15,2),
THIRD_ROUND_SUM NUMERIC(15,2),
FOURTH_ROUND_SUM NUMERIC(15,2)
)
AS
DECLARE TICKET_COST NUMERIC(15,2);
DECLARE PRIZE_PERCENT NUMERIC(4,2);
DECLARE JACKPOT_PERCENT NUMERIC(4,2);
DECLARE FIRST_ROUND_PERCENT NUMERIC(4,2);
DECLARE TEMP_SUM NUMERIC(15,2);
BEGIN
SELECT TICKET_COST, PRIZE_PERCENT, JACKPOT_PERCENT,
FIRST_ROUND_PERCENT, THIRD_ROUND_SUM, FOURTH_ROUND_SUM
FROM /*PREFIX*/TIRAGES
WHERE TIRAGE_ID=:TIRAGE_ID
INTO :TICKET_COST, :PRIZE_PERCENT, :JACKPOT_PERCENT,
:FIRST_ROUND_PERCENT, :THIRD_ROUND_SUM, :FOURTH_ROUND_SUM;
SELECT COUNT(*)
FROM /*PREFIX*/TICKETS
WHERE TIRAGE_ID=:TIRAGE_ID
INTO :ALL_COUNT;
SELECT COUNT(*)
FROM /*PREFIX*/TICKETS
WHERE TIRAGE_ID=:TIRAGE_ID
AND NOT_USED=1
INTO :NOT_USED_COUNT;
USED_COUNT=ALL_COUNT-NOT_USED_COUNT;
PRIZE_SUM=(TICKET_COST*USED_COUNT)*PRIZE_PERCENT/100;
JACKPOT_SUM=PRIZE_SUM*JACKPOT_PERCENT/100;
IF (FOURTH_ROUND_SUM IS NULL) THEN
FOURTH_ROUND_SUM=0.0;
TEMP_SUM=PRIZE_SUM-FOURTH_ROUND_SUM;
FIRST_ROUND_SUM=TEMP_SUM*FIRST_ROUND_PERCENT/100;
SECOND_ROUND_SUM=TEMP_SUM-FIRST_ROUND_SUM-THIRD_ROUND_SUM;
END;
--
/* Фиксация изменений */
COMMIT |
select code, count(*)
from prices
where max(ifnull(close, 0), ifnull(adj_close, 0)) < low or max(ifnull(close, 0), ifnull(adj_close, 0)) > high
and market_cap is not null
group by code
order by code;
select c.company, prices.*
from prices
join companies c on prices.code = c.code
where (max(ifnull(close, 0), ifnull(adj_close, 0)) < low or max(ifnull(close, 0), ifnull(adj_close, 0)) > high)
and market_cap is not null
and sdate = '20100930'
;
select max(close, adj_close), *
from prices
where code = '033200'
-- and trading_volume = 0
and sdate between '20070901' and '20081231'
order by sdate;
select code, substr(sdate, 1, 4) as year,
max(max(ifnull(close, 0), ifnull(adj_close, 0))) as max,
min(max(ifnull(close, 0), ifnull(adj_close, 0))) as min
from prices
group by code, substr(sdate, 1, 4)
having max > min * 5 or max * 0.2 > min
order by code, year
;
select *
from prices
where sdate = '20200417'; |
DROP TABLE IF EXISTS USER;
create table USER
(
ID bigint AUTO_INCREMENT primary key,
EMAIL varchar(50) not null,
NAME varchar(50) not null,
BIRTHDAY DATE not null
);
insert into USER (EMAIL, NAME, BIRTHDAY)
VALUES ('Ivanov@mail.ru', 'Ivanov', parsedatetime('01-01-2001', 'dd-MM-yyyy'));
insert into USER (EMAIL, NAME, BIRTHDAY)
VALUES ('Petrov@mail.ru', 'Petrov', parsedatetime('02-02-2002', 'dd-MM-yyyy'));
insert into USER (EMAIL, NAME, BIRTHDAY)
VALUES ('Sidorov@mail.ru', 'Sidorov', parsedatetime('03-03-2003', 'dd-MM-yyyy')); |
-- LEN
SELECT LEN('Hola soy un texto');
SELECT LEN('');
-- UPPER
SELECT UPPER('Hola a todos');
SELECT UPPER(Nombre) FROM Alumno;
-- LOWER
SELECT LOWER('ESTE ESTA EN MAYUSCULAS');
SELECT LOWER(Nombre) FROM Alumno;
-- CONCAT
SELECT CONCAT('Hola', '@gmail');
SELECT CONCAT(Nombre, ' ', Apellido) AS NombreCompleto FROM Alumno; |
/* SUSHANT SINHA */
select distinct P1.Email
from Person as P1, Person as P2
where P1.Id != P2.Id and P1.Email = P2.Email
/* or can use this too */
select email from person group by email having count(id)>1; |
-- creates a table called first_table in the database hbtn_0c_0
-- first_table to have id INT, name VARCHAR(256)
CREATE TABLE IF NOT EXISTS first_table (id INT, name VARCHAR(256));
|
SELECT distinct
labels,
y.customer_id,
c.email,
y.product_id,
date_trunc('day',y.action_time) click_date_dt,
created_at assistly_created_at,
datediff(d,y.action_time,created_at)::numeric,
case_id
/*changed_at,
first_opened_at,
first_resolved_at,
y.visit_id,
y.clid,
*/
FROM analytics.yoda y
LEFT JOIN analytics.customer c
ON y.customer_id = c.customer_id
/*ADD ASSISTLY*/
JOIN(
SELECT
created_at,
changed_at,
first_opened_at,
first_resolved_at,
labels,
ca.case_id,
email
FROM
raw_sources.assistly_cases ca
join(select
customer_id,
email
from
raw_sources.assistly_customers) cu on ca.customer_id = cu.customer_id
) ac on ac.email = c.email
/*QUERY CONTINUES*/
WHERE action_name = 'se_pdp'
and action_type = 'cs_email_button'
and action_date between '2015-03-05' and current_date-1
and datediff(d,y.action_time,created_at)::numeric between -1 and 1
and c.email not like '%onekingslane%'
ORDER BY 2,6
limit 5000
|
.mode column
.headers on
INSERT INTO utilisateur (pseudo, prenom, nom, date_naissance, mail, password) VALUES
('matru', 'Machin', 'Truc', '1987-12-12', 'machin@webmail.com', '00000000');
-- Update password
UPDATE utilisateur
SET password = 1111
WHERE id = 1;
-- Afficher les utilisateurs
SELECT * FROM utilisateur;
-- Update password
UPDATE utilisateur
SET password = 1111
WHERE id = 1;
-- -- Afficher tout les Livres
-- SELECT * FROM livre;
--
-- -- Afficher les 5 derniers exemplaires ajoutés
-- SELECT e.id, l.id, u.id, e.date_exemplaire, l.titre, l.auteur, l.editeur, u.pseudo, s.type
-- FROM exemplaire AS e
-- INNER JOIN livre AS l ON e.id_livre = l.id
-- INNER JOIN utilisateur AS u ON e.id_util = u.id
-- INNER JOIN status AS s ON e.id_status = s.id
-- ORDER BY date_exemplaire DESC LIMIT 10;
--
-- -- Affiche la table exemplaires
-- -- SELECT * FROM exemplaire;
--
-- -- login
-- SELECT * FROM utilisateur
-- WHERE pseudo = 'micspi' AND password = '0000';
--
-- -- Livre d'un utilisateur
-- SELECT e.id, l.titre, l.auteur, l.editeur, e.date_exemplaire, s.type
-- FROM exemplaire AS e
-- INNER JOIN livre AS l ON e.id_livre = l.id
-- INNER JOIN utilisateur AS u ON e.id_util = u.id
-- INNER JOIN status AS s ON e.id_status = s.id
-- WHERE u.id = 3
-- ORDER BY titre ASC;
--
-- -- Ajouter un livre
-- INSERT INTO livre (titre, auteur, editeur, isbn) VALUES
-- ('Blade Runner', 'P.K.Dick', 'J''ai Lu', '2277217689');
|
DROP FUNCTION IF EXISTS getprovinces;
DROP FUNCTION IF EXISTS getcantones;
DROP FUNCTION IF EXISTS getdistricts; |
UPDATE AD_Column SET AD_Reference_ID=28, AD_Reference_Value_ID=NULL,Updated=TO_DATE('2009-06-02 11:32:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=56347
;
|
use MyDB;
select *
from SuperOrders;
drop table SuperOrders;
create table member(
Id varchar(25) primary key,
Password varchar(100),
Name varchar(25),
Email varchar(100)
)engine=InnoDB default charset=utf8;
select *
from member;
create table score(
name varchar(20) primary key,
kor int,
eng int,
math int,
total int,
average int
)engine=InnoDB default charset=utf8;
select *, rank() over (order by total DESC) as 등수
from score;
select *, rank() as 등수
from score;
create table tb_member(
id varchar(20) primary key,
pwd varchar(20),
name varchar(20),
tel varchar(13),
addr varchar(100),
birth varchar(8),
job varchar(50),
gender varchar(1),
email varchar(50),
intro varchar(1000)
)engine=InnoDB default charset=utf8;
select * from tb_member;
|
--- drop view r_inamts cascade
create or replace view r_inamts as select
alloctbl.shelfno_code_fm shelfno_code_fm ,
alloctbl.trngantt_processseq trngantt_processseq ,
alloctbl.shelfno_name_fm shelfno_name_fm ,
alloctbl.prjno_name prjno_name ,
alloctbl.unit_code unit_code ,
alloctbl.unit_name unit_name ,
alloctbl.trngantt_itm_id trngantt_itm_id ,
alloctbl.trngantt_loca_id trngantt_loca_id ,
alloctbl.itm_code_pare itm_code_pare ,
alloctbl.itm_code itm_code ,
alloctbl.itm_name_pare itm_name_pare ,
alloctbl.itm_name itm_name ,
alloctbl.loca_code_shelfno_fm loca_code_shelfno_fm ,
loca_in.loca_code loca_code_in ,
alloctbl.loca_code_pare loca_code_pare ,
alloctbl.loca_code loca_code ,
alloctbl.loca_name_shelfno_fm loca_name_shelfno_fm ,
loca_in.loca_name loca_name_in ,
alloctbl.loca_name_pare loca_name_pare ,
alloctbl.loca_name loca_name ,
alloctbl.itm_unit_id_pare itm_unit_id_pare ,
alloctbl.itm_unit_id itm_unit_id ,
alloctbl.itm_classlist_id_pare itm_classlist_id_pare ,
alloctbl.itm_classlist_id itm_classlist_id ,
alloctbl.trngantt_duedate trngantt_duedate ,
alloctbl.trngantt_shelfno_id_fm trngantt_shelfno_id_fm ,
alloctbl.trngantt_itm_id_pare trngantt_itm_id_pare ,
alloctbl.trngantt_loca_id_pare trngantt_loca_id_pare ,
inamt.id inamt_id,
inamt.id id,
inamt.starttime inamt_starttime,
inamt.amt inamt_amt,
inamt.crrs_id inamt_crr_id,
inamt.inoutflg inamt_inoutflg,
inamt.expiredate inamt_expiredate,
inamt.remark inamt_remark,
inamt.persons_id_upd inamt_person_id_upd,
inamt.created_at inamt_created_at,
inamt.updated_at inamt_updated_at,
inamt.update_ip inamt_update_ip,
inamt.alloctbls_id inamt_alloctbl_id,
inamt.locas_id_in inamt_loca_id_in,
alloctbl.classlist_code classlist_code ,
crr.crr_code crr_code ,
crr.crr_name crr_name ,
alloctbl.alloctbl_trngantt_id alloctbl_trngantt_id ,
alloctbl.classlist_name classlist_name ,
alloctbl.prjno_code_chil prjno_code_chil ,
alloctbl.prjno_code prjno_code ,
alloctbl.shelfno_loca_id_shelfno_fm shelfno_loca_id_shelfno_fm ,
alloctbl.trngantt_prjno_id trngantt_prjno_id
from inamts inamt,
r_crrs crr , r_persons person_upd , r_alloctbls alloctbl , r_locas loca_in
where inamt.crrs_id = crr.id and inamt.persons_id_upd = person_upd.id and inamt.alloctbls_id = alloctbl.id and inamt.locas_id_in = loca_in.id ;
DROP TABLE IF EXISTS sio.sio_r_inamts;
CREATE TABLE sio.sio_r_inamts (
sio_id numeric(38,0) CONSTRAINT SIO_r_inamts_id_pk PRIMARY KEY ,sio_user_code numeric(38,0)
,sio_Term_id varchar(30)
,sio_session_id numeric(38,0)
,sio_Command_Response char(1)
,sio_session_counter numeric(38,0)
,sio_classname varchar(50)
,sio_viewname varchar(30)
,sio_code varchar(30)
,sio_strsql varchar(4000)
,sio_totalcount numeric(38,0)
,sio_recordcount numeric(38,0)
,sio_start_record numeric(38,0)
,sio_end_record numeric(38,0)
,sio_sord varchar(256)
,sio_search varchar(10)
,sio_sidx varchar(256)
,loca_name_pare varchar (100)
,prjno_code_chil varchar (50)
,classlist_name varchar (100)
,classlist_name_pare varchar (100)
,crr_name varchar (100)
,itm_code varchar (50)
,crr_code varchar (50)
,classlist_code varchar (50)
,itm_name_pare varchar (100)
,classlist_code_pare varchar (50)
,loca_code varchar (50)
,loca_name_shelfno_fm varchar (100)
,loca_name_in varchar (100)
,loca_name varchar (100)
,itm_name varchar (100)
,prjno_name varchar (100)
,shelfno_name_fm varchar (100)
,unit_code_pare varchar (50)
,unit_code varchar (50)
,unit_name_pare varchar (100)
,unit_name varchar (100)
,shelfno_code_fm varchar (50)
,prjno_code varchar (50)
,itm_code_pare varchar (50)
,loca_code_shelfno_fm varchar (50)
,loca_code_in varchar (50)
,loca_code_pare varchar (50)
,inamt_expiredate date
,inamt_inoutflg varchar (3)
,inamt_starttime timestamp(6)
,inamt_amt numeric (18,4)
,alloctbl_qty_linkto_alloctbl numeric (22,0)
,trngantt_processseq numeric (38,0)
,trngantt_starttime timestamp(6)
,loca_abbr_in varchar (50)
,loca_zip_in varchar (10)
,loca_country_in varchar (20)
,loca_prfct_in varchar (20)
,loca_addr1_in varchar (50)
,loca_addr2_in varchar (50)
,loca_tel_in varchar (20)
,loca_fax_in varchar (20)
,loca_mail_in varchar (20)
,trngantt_duedate timestamp(6)
,trngantt_processseq_pare numeric (38,0)
,trngantt_qty_alloc numeric (22,6)
,crr_pricedecimal numeric (22,0)
,crr_amtdecimal numeric (22,0)
,crr_contents varchar (4000)
,alloctbl_qty_alloc numeric (22,6)
,trngantt_qty numeric (18,4)
,alloctbl_srctblname varchar (30)
,alloctbl_srctblid numeric (38,0)
,alloctbl_contents varchar (4000)
,alloctbl_qty numeric (22,6)
,alloctbl_qty_stk numeric (22,6)
,inamt_remark varchar (4000)
,inamt_id numeric (38,0)
,inamt_person_id_upd numeric (38,0)
,inamt_created_at timestamp(6)
,inamt_updated_at timestamp(6)
,inamt_update_ip varchar (40)
,inamt_alloctbl_id numeric (38,0)
,inamt_loca_id_in numeric (22,0)
,id numeric (38,0)
,inamt_crr_id numeric (22,0)
,itm_classlist_id_pare numeric (38,0)
,trngantt_itm_id_pare numeric (38,0)
,trngantt_loca_id_pare numeric (38,0)
,itm_unit_id numeric (22,0)
,trngantt_shelfno_id_fm numeric (22,0)
,itm_unit_id_pare numeric (22,0)
,trngantt_prjno_id numeric (38,0)
,shelfno_loca_id_shelfno_fm numeric (38,0)
,itm_classlist_id numeric (38,0)
,alloctbl_trngantt_id numeric (38,0)
,trngantt_itm_id numeric (38,0)
,trngantt_loca_id numeric (38,0)
,sio_errline varchar(4000)
,sio_org_tblname varchar(30)
,sio_org_tblid numeric(38,0)
,sio_add_time date
,sio_replay_time date
,sio_result_f char(1)
,sio_message_code char(10)
,sio_message_contents varchar(4000)
,sio_chk_done char(1)
);
CREATE INDEX sio_r_inamts_uk1
ON sio.sio_r_inamts(sio_user_code,sio_session_counter,sio_session_id,sio_Command_Response);
drop sequence if exists sio.sio_r_inamts_seq ;
create sequence sio.sio_r_inamts_seq ;
--- drop view r_incustwhs cascade
create or replace view r_incustwhs as select
custrcvplc.cust_bill_id_custrcvplc cust_bill_id_custrcvplc ,
alloctbl.shelfno_code_fm shelfno_code_fm ,
custrcvplc.bill_chrg_id_bill_custrcvplc bill_chrg_id_bill_custrcvplc ,
alloctbl.trngantt_processseq trngantt_processseq ,
alloctbl.shelfno_name_fm shelfno_name_fm ,
alloctbl.prjno_name prjno_name ,
alloctbl.unit_code unit_code ,
alloctbl.unit_name unit_name ,
alloctbl.trngantt_itm_id trngantt_itm_id ,
alloctbl.trngantt_loca_id trngantt_loca_id ,
alloctbl.itm_code_pare itm_code_pare ,
alloctbl.itm_code itm_code ,
alloctbl.itm_name_pare itm_name_pare ,
alloctbl.itm_name itm_name ,
custrcvplc.scrlv_code_chrg_cust_custrcvplc scrlv_code_chrg_cust_custrcvplc ,
custrcvplc.scrlv_code_chrg_bill_custrcvplc scrlv_code_chrg_bill_custrcvplc ,
custrcvplc.cust_loca_id_cust_custrcvplc cust_loca_id_cust_custrcvplc ,
custrcvplc.loca_code_cust_custrcvplc loca_code_cust_custrcvplc ,
alloctbl.loca_code_shelfno_fm loca_code_shelfno_fm ,
alloctbl.loca_code_pare loca_code_pare ,
alloctbl.loca_code loca_code ,
custrcvplc.loca_name_cust_custrcvplc loca_name_cust_custrcvplc ,
alloctbl.loca_name_shelfno_fm loca_name_shelfno_fm ,
alloctbl.loca_name_pare loca_name_pare ,
alloctbl.loca_name loca_name ,
custrcvplc.person_code_chrg_cust_custrcvplc person_code_chrg_cust_custrcvplc ,
custrcvplc.person_code_chrg_bill_custrcvplc person_code_chrg_bill_custrcvplc ,
custrcvplc.person_name_chrg_cust_custrcvplc person_name_chrg_cust_custrcvplc ,
custrcvplc.person_name_chrg_bill_custrcvplc person_name_chrg_bill_custrcvplc ,
alloctbl.itm_unit_id_pare itm_unit_id_pare ,
alloctbl.itm_unit_id itm_unit_id ,
alloctbl.itm_classlist_id_pare itm_classlist_id_pare ,
alloctbl.itm_classlist_id itm_classlist_id ,
alloctbl.trngantt_duedate trngantt_duedate ,
alloctbl.trngantt_shelfno_id_fm trngantt_shelfno_id_fm ,
alloctbl.trngantt_itm_id_pare trngantt_itm_id_pare ,
alloctbl.trngantt_loca_id_pare trngantt_loca_id_pare ,
custrcvplc.custrcvplc_code custrcvplc_code ,
custrcvplc.custrcvplc_name custrcvplc_name ,
incustwh.duedate incustwh_duedate,
incustwh.remark incustwh_remark,
incustwh.created_at incustwh_created_at,
incustwh.update_ip incustwh_update_ip,
incustwh.expiredate incustwh_expiredate,
incustwh.updated_at incustwh_updated_at,
incustwh.qty incustwh_qty,
incustwh.id incustwh_id,
incustwh.id id,
incustwh.persons_id_upd incustwh_person_id_upd,
incustwh.inoutflg incustwh_inoutflg,
incustwh.lotno incustwh_lotno,
incustwh.qty_stk incustwh_qty_stk,
incustwh.packno incustwh_packno,
incustwh.custrcvplcs_id incustwh_custrcvplc_id,
incustwh.alloctbls_id incustwh_alloctbl_id,
custrcvplc.bill_crr_id_bill_custrcvplc bill_crr_id_bill_custrcvplc ,
custrcvplc.usrgrp_name_chrg_cust_custrcvplc usrgrp_name_chrg_cust_custrcvplc ,
custrcvplc.usrgrp_name_chrg_bill_custrcvplc usrgrp_name_chrg_bill_custrcvplc ,
alloctbl.classlist_code classlist_code ,
custrcvplc.crr_code_bill_custrcvplc crr_code_bill_custrcvplc ,
custrcvplc.crr_name_bill_custrcvplc crr_name_bill_custrcvplc ,
alloctbl.alloctbl_trngantt_id alloctbl_trngantt_id ,
custrcvplc.person_sect_id_chrg_cust_custrcvplc person_sect_id_chrg_cust_custrcvplc ,
custrcvplc.person_sect_id_chrg_bill_custrcvplc person_sect_id_chrg_bill_custrcvplc ,
custrcvplc.cust_chrg_id_cust_custrcvplc cust_chrg_id_cust_custrcvplc ,
custrcvplc.usrgrp_code_chrg_cust_custrcvplc usrgrp_code_chrg_cust_custrcvplc ,
custrcvplc.usrgrp_code_chrg_bill_custrcvplc usrgrp_code_chrg_bill_custrcvplc ,
alloctbl.classlist_name classlist_name ,
alloctbl.prjno_code_chil prjno_code_chil ,
alloctbl.prjno_code prjno_code ,
alloctbl.shelfno_loca_id_shelfno_fm shelfno_loca_id_shelfno_fm ,
alloctbl.trngantt_prjno_id trngantt_prjno_id ,
custrcvplc.custrcvplc_cust_id_custrcvplc custrcvplc_cust_id_custrcvplc ,
custrcvplc.bill_loca_id_bill_custrcvplc bill_loca_id_bill_custrcvplc ,
custrcvplc.chrg_person_id_chrg_cust_custrcvplc chrg_person_id_chrg_cust_custrcvplc ,
custrcvplc.chrg_person_id_chrg_bill_custrcvplc chrg_person_id_chrg_bill_custrcvplc
from incustwhs incustwh,
r_persons person_upd , r_custrcvplcs custrcvplc , r_alloctbls alloctbl
where incustwh.persons_id_upd = person_upd.id and incustwh.custrcvplcs_id = custrcvplc.id and incustwh.alloctbls_id = alloctbl.id ;
DROP TABLE IF EXISTS sio.sio_r_incustwhs;
CREATE TABLE sio.sio_r_incustwhs (
sio_id numeric(38,0) CONSTRAINT SIO_r_incustwhs_id_pk PRIMARY KEY ,sio_user_code numeric(38,0)
,sio_Term_id varchar(30)
,sio_session_id numeric(38,0)
,sio_Command_Response char(1)
,sio_session_counter numeric(38,0)
,sio_classname varchar(50)
,sio_viewname varchar(30)
,sio_code varchar(30)
,sio_strsql varchar(4000)
,sio_totalcount numeric(38,0)
,sio_recordcount numeric(38,0)
,sio_start_record numeric(38,0)
,sio_end_record numeric(38,0)
,sio_sord varchar(256)
,sio_search varchar(10)
,sio_sidx varchar(256)
,shelfno_code_fm varchar (50)
,classlist_code_pare varchar (50)
,classlist_code varchar (50)
,scrlv_code_chrg_bill_custrcvplc varchar (50)
,loca_code_cust_custrcvplc varchar (50)
,loca_code_shelfno_fm varchar (50)
,loca_code_pare varchar (50)
,loca_code varchar (50)
,loca_name_cust_custrcvplc varchar (100)
,loca_name_shelfno_fm varchar (100)
,loca_name_pare varchar (100)
,loca_name varchar (100)
,person_code_chrg_cust_custrcvplc varchar (50)
,person_code_chrg_bill_custrcvplc varchar (50)
,person_name_chrg_cust_custrcvplc varchar (100)
,person_name_chrg_bill_custrcvplc varchar (100)
,prjno_code varchar (50)
,prjno_code_chil varchar (50)
,classlist_name varchar (100)
,classlist_name_pare varchar (100)
,custrcvplc_code varchar (50)
,custrcvplc_name varchar (100)
,usrgrp_name_chrg_bill_custrcvplc varchar (100)
,shelfno_name_fm varchar (100)
,prjno_name varchar (100)
,usrgrp_code_chrg_bill_custrcvplc varchar (50)
,unit_code_pare varchar (50)
,usrgrp_code_chrg_cust_custrcvplc varchar (50)
,usrgrp_name_chrg_cust_custrcvplc varchar (100)
,crr_code_bill_custrcvplc varchar (50)
,crr_name_bill_custrcvplc varchar (100)
,unit_code varchar (50)
,unit_name_pare varchar (100)
,unit_name varchar (100)
,itm_code_pare varchar (50)
,itm_code varchar (50)
,itm_name_pare varchar (100)
,itm_name varchar (100)
,scrlv_code_chrg_cust_custrcvplc varchar (50)
,incustwh_qty_stk numeric (22,6)
,incustwh_expiredate date
,incustwh_qty numeric (22,6)
,incustwh_packno varchar (10)
,incustwh_inoutflg varchar (3)
,incustwh_lotno varchar (50)
,incustwh_duedate timestamp(6)
,custrcvplc_addr2 varchar (50)
,custrcvplc_contents varchar (4000)
,alloctbl_qty_stk numeric (22,6)
,alloctbl_srctblid numeric (38,0)
,alloctbl_srctblname varchar (30)
,trngantt_duedate timestamp(6)
,custrcvplc_tel varchar (20)
,custrcvplc_stktaking_proc varchar (1)
,trngantt_processseq_pare numeric (38,0)
,alloctbl_qty numeric (22,6)
,trngantt_starttime timestamp(6)
,trngantt_qty_alloc numeric (22,6)
,alloctbl_contents varchar (4000)
,alloctbl_qty_linkto_alloctbl numeric (22,0)
,custrcvplc_addr1 varchar (50)
,trngantt_qty numeric (18,4)
,alloctbl_qty_alloc numeric (22,6)
,trngantt_processseq numeric (38,0)
,incustwh_remark varchar (4000)
,incustwh_custrcvplc_id numeric (38,0)
,incustwh_created_at timestamp(6)
,incustwh_update_ip varchar (40)
,incustwh_updated_at timestamp(6)
,incustwh_id numeric (38,0)
,id numeric (38,0)
,incustwh_person_id_upd numeric (38,0)
,incustwh_alloctbl_id numeric (38,0)
,alloctbl_trngantt_id numeric (38,0)
,person_sect_id_chrg_cust_custrcvplc numeric (22,0)
,person_sect_id_chrg_bill_custrcvplc numeric (22,0)
,cust_chrg_id_cust_custrcvplc numeric (38,0)
,bill_crr_id_bill_custrcvplc numeric (22,0)
,cust_bill_id_custrcvplc numeric (38,0)
,trngantt_loca_id_pare numeric (38,0)
,trngantt_itm_id_pare numeric (38,0)
,trngantt_shelfno_id_fm numeric (22,0)
,itm_classlist_id numeric (38,0)
,itm_classlist_id_pare numeric (38,0)
,itm_unit_id numeric (22,0)
,itm_unit_id_pare numeric (22,0)
,cust_loca_id_cust_custrcvplc numeric (38,0)
,shelfno_loca_id_shelfno_fm numeric (38,0)
,trngantt_loca_id numeric (38,0)
,trngantt_prjno_id numeric (38,0)
,custrcvplc_cust_id_custrcvplc numeric (22,0)
,trngantt_itm_id numeric (38,0)
,bill_loca_id_bill_custrcvplc numeric (38,0)
,chrg_person_id_chrg_cust_custrcvplc numeric (38,0)
,chrg_person_id_chrg_bill_custrcvplc numeric (38,0)
,bill_chrg_id_bill_custrcvplc numeric (22,0)
,sio_errline varchar(4000)
,sio_org_tblname varchar(30)
,sio_org_tblid numeric(38,0)
,sio_add_time date
,sio_replay_time date
,sio_result_f char(1)
,sio_message_code char(10)
,sio_message_contents varchar(4000)
,sio_chk_done char(1)
);
CREATE INDEX sio_r_incustwhs_uk1
ON sio.sio_r_incustwhs(sio_user_code,sio_session_counter,sio_session_id,sio_Command_Response);
drop sequence if exists sio.sio_r_incustwhs_seq ;
create sequence sio.sio_r_incustwhs_seq ;
--- drop view r_instks cascade
create or replace view r_instks as select
instk.qty instk_qty,
alloctbl.shelfno_code_fm shelfno_code_fm ,
shelfno_in.shelfno_code shelfno_code_in ,
alloctbl.trngantt_processseq trngantt_processseq ,
alloctbl.shelfno_name_fm shelfno_name_fm ,
shelfno_in.shelfno_name shelfno_name_in ,
alloctbl.prjno_name prjno_name ,
alloctbl.unit_code unit_code ,
alloctbl.unit_name unit_name ,
alloctbl.trngantt_itm_id trngantt_itm_id ,
alloctbl.trngantt_loca_id trngantt_loca_id ,
alloctbl.itm_code_pare itm_code_pare ,
alloctbl.itm_code itm_code ,
alloctbl.itm_name_pare itm_name_pare ,
alloctbl.itm_name itm_name ,
alloctbl.loca_code_shelfno_fm loca_code_shelfno_fm ,
shelfno_in.loca_code_shelfno loca_code_shelfno_in ,
alloctbl.loca_code_pare loca_code_pare ,
alloctbl.loca_code loca_code ,
alloctbl.loca_name_shelfno_fm loca_name_shelfno_fm ,
shelfno_in.loca_name_shelfno loca_name_shelfno_in ,
alloctbl.loca_name_pare loca_name_pare ,
alloctbl.loca_name loca_name ,
alloctbl.itm_unit_id_pare itm_unit_id_pare ,
alloctbl.itm_unit_id itm_unit_id ,
alloctbl.itm_classlist_id_pare itm_classlist_id_pare ,
alloctbl.itm_classlist_id itm_classlist_id ,
alloctbl.trngantt_duedate trngantt_duedate ,
instk.id instk_id,
instk.id id,
instk.starttime instk_starttime,
instk.qty_stk instk_qty_stk,
instk.lotno instk_lotno,
instk.packno instk_packno,
instk.inoutflg instk_inoutflg,
instk.expiredate instk_expiredate,
instk.persons_id_upd instk_person_id_upd,
instk.created_at instk_created_at,
instk.updated_at instk_updated_at,
instk.update_ip instk_update_ip,
alloctbl.trngantt_shelfno_id_fm trngantt_shelfno_id_fm ,
alloctbl.trngantt_itm_id_pare trngantt_itm_id_pare ,
instk.alloctbls_id instk_alloctbl_id,
alloctbl.trngantt_loca_id_pare trngantt_loca_id_pare ,
instk.shelfnos_id_in instk_shelfno_id_in,
alloctbl.classlist_code classlist_code ,
alloctbl.alloctbl_trngantt_id alloctbl_trngantt_id ,
alloctbl.classlist_name classlist_name ,
alloctbl.prjno_code_chil prjno_code_chil ,
alloctbl.alloctbl_srctblname alloctbl_srctblname ,
alloctbl.alloctbl_srctblid alloctbl_srctblid ,
alloctbl.prjno_code prjno_code ,
alloctbl.shelfno_loca_id_shelfno_fm shelfno_loca_id_shelfno_fm ,
shelfno_in.shelfno_loca_id_shelfno shelfno_loca_id_shelfno_in ,
alloctbl.trngantt_prjno_id trngantt_prjno_id ,
instk.qty_sch instk_qty_sch
from instks instk,
r_persons person_upd , r_alloctbls alloctbl , r_shelfnos shelfno_in
where instk.persons_id_upd = person_upd.id and instk.alloctbls_id = alloctbl.id and instk.shelfnos_id_in = shelfno_in.id ;
DROP TABLE IF EXISTS sio.sio_r_instks;
CREATE TABLE sio.sio_r_instks (
sio_id numeric(38,0) CONSTRAINT SIO_r_instks_id_pk PRIMARY KEY ,sio_user_code numeric(38,0)
,sio_Term_id varchar(30)
,sio_session_id numeric(38,0)
,sio_Command_Response char(1)
,sio_session_counter numeric(38,0)
,sio_classname varchar(50)
,sio_viewname varchar(30)
,sio_code varchar(30)
,sio_strsql varchar(4000)
,sio_totalcount numeric(38,0)
,sio_recordcount numeric(38,0)
,sio_start_record numeric(38,0)
,sio_end_record numeric(38,0)
,sio_sord varchar(256)
,sio_search varchar(10)
,sio_sidx varchar(256)
,instk_starttime timestamp(6)
,loca_code_shelfno_in varchar (50)
,loca_name_shelfno_in varchar (100)
,shelfno_code_in varchar (50)
,shelfno_name_in varchar (100)
,instk_lotno varchar (50)
,instk_packno varchar (10)
,itm_code varchar (50)
,itm_name varchar (100)
,trngantt_processseq numeric (38,0)
,instk_qty_sch numeric (22,6)
,instk_qty numeric (22,6)
,instk_qty_stk numeric (22,6)
,loca_code_shelfno_fm varchar (50)
,loca_name_shelfno_fm varchar (100)
,shelfno_code_fm varchar (50)
,shelfno_name_fm varchar (100)
,loca_code varchar (50)
,loca_name varchar (100)
,prjno_name varchar (100)
,loca_code_pare varchar (50)
,itm_code_pare varchar (50)
,unit_name varchar (100)
,unit_name_pare varchar (100)
,loca_name_pare varchar (100)
,prjno_code varchar (50)
,prjno_code_chil varchar (50)
,classlist_name varchar (100)
,classlist_name_pare varchar (100)
,unit_code varchar (50)
,classlist_code varchar (50)
,classlist_code_pare varchar (50)
,itm_name_pare varchar (100)
,unit_code_pare varchar (50)
,instk_inoutflg varchar (3)
,instk_expiredate date
,alloctbl_qty_linkto_alloctbl numeric (22,0)
,trngantt_starttime timestamp(6)
,trngantt_duedate timestamp(6)
,trngantt_processseq_pare numeric (38,0)
,trngantt_qty_alloc numeric (22,6)
,alloctbl_qty_alloc numeric (22,6)
,trngantt_qty numeric (18,4)
,alloctbl_srctblname varchar (30)
,alloctbl_srctblid numeric (38,0)
,alloctbl_contents varchar (4000)
,alloctbl_qty numeric (22,6)
,alloctbl_qty_stk numeric (22,6)
,shelfno_contents_in varchar (4000)
,instk_remark varchar (4000)
,instk_created_at timestamp(6)
,instk_updated_at timestamp(6)
,instk_update_ip varchar (40)
,instk_id numeric (38,0)
,id numeric (38,0)
,instk_alloctbl_id numeric (38,0)
,instk_person_id_upd numeric (38,0)
,instk_shelfno_id_in numeric (38,0)
,trngantt_loca_id numeric (38,0)
,trngantt_shelfno_id_fm numeric (22,0)
,trngantt_itm_id_pare numeric (38,0)
,trngantt_itm_id numeric (38,0)
,trngantt_loca_id_pare numeric (38,0)
,itm_unit_id_pare numeric (22,0)
,alloctbl_trngantt_id numeric (38,0)
,trngantt_prjno_id numeric (38,0)
,shelfno_loca_id_shelfno_fm numeric (38,0)
,itm_classlist_id numeric (38,0)
,itm_classlist_id_pare numeric (38,0)
,itm_unit_id numeric (22,0)
,shelfno_loca_id_shelfno_in numeric (38,0)
,sio_errline varchar(4000)
,sio_org_tblname varchar(30)
,sio_org_tblid numeric(38,0)
,sio_add_time date
,sio_replay_time date
,sio_result_f char(1)
,sio_message_code char(10)
,sio_message_contents varchar(4000)
,sio_chk_done char(1)
);
CREATE INDEX sio_r_instks_uk1
ON sio.sio_r_instks(sio_user_code,sio_session_counter,sio_session_id,sio_Command_Response);
drop sequence if exists sio.sio_r_instks_seq ;
create sequence sio.sio_r_instks_seq ;
--- drop view r_outamts cascade
create or replace view r_outamts as select
alloctbl.shelfno_code_fm shelfno_code_fm ,
alloctbl.trngantt_processseq trngantt_processseq ,
alloctbl.shelfno_name_fm shelfno_name_fm ,
alloctbl.prjno_name prjno_name ,
alloctbl.unit_code_pare unit_code_pare ,
alloctbl.unit_code unit_code ,
alloctbl.unit_name_pare unit_name_pare ,
alloctbl.unit_name unit_name ,
alloctbl.trngantt_itm_id trngantt_itm_id ,
alloctbl.trngantt_loca_id trngantt_loca_id ,
alloctbl.itm_code_pare itm_code_pare ,
alloctbl.itm_code itm_code ,
alloctbl.itm_name_pare itm_name_pare ,
alloctbl.itm_name itm_name ,
alloctbl.loca_code_shelfno_fm loca_code_shelfno_fm ,
loca_out.loca_code loca_code_out ,
alloctbl.loca_code_pare loca_code_pare ,
alloctbl.loca_code loca_code ,
alloctbl.loca_name_shelfno_fm loca_name_shelfno_fm ,
loca_out.loca_name loca_name_out ,
alloctbl.loca_name_pare loca_name_pare ,
alloctbl.loca_name loca_name ,
alloctbl.itm_unit_id_pare itm_unit_id_pare ,
alloctbl.itm_unit_id itm_unit_id ,
alloctbl.itm_classlist_id_pare itm_classlist_id_pare ,
alloctbl.itm_classlist_id itm_classlist_id ,
alloctbl.trngantt_duedate trngantt_duedate ,
alloctbl.trngantt_shelfno_id_fm trngantt_shelfno_id_fm ,
alloctbl.trngantt_itm_id_pare trngantt_itm_id_pare ,
alloctbl.trngantt_loca_id_pare trngantt_loca_id_pare ,
outamt.id outamt_id,
outamt.id id,
outamt.starttime outamt_starttime,
outamt.amt outamt_amt,
outamt.crrs_id outamt_crr_id,
outamt.inoutflg outamt_inoutflg,
outamt.expiredate outamt_expiredate,
outamt.remark outamt_remark,
outamt.persons_id_upd outamt_person_id_upd,
outamt.created_at outamt_created_at,
outamt.updated_at outamt_updated_at,
outamt.update_ip outamt_update_ip,
outamt.alloctbls_id outamt_alloctbl_id,
outamt.locas_id_out outamt_loca_id_out,
alloctbl.classlist_code classlist_code ,
crr.crr_code crr_code ,
crr.crr_name crr_name ,
alloctbl.alloctbl_trngantt_id alloctbl_trngantt_id ,
alloctbl.classlist_name classlist_name ,
alloctbl.prjno_code_chil prjno_code_chil ,
alloctbl.prjno_code prjno_code ,
alloctbl.shelfno_loca_id_shelfno_fm shelfno_loca_id_shelfno_fm ,
alloctbl.trngantt_prjno_id trngantt_prjno_id
from outamts outamt,
r_crrs crr , r_persons person_upd , r_alloctbls alloctbl , r_locas loca_out
where outamt.crrs_id = crr.id and outamt.persons_id_upd = person_upd.id and outamt.alloctbls_id = alloctbl.id and outamt.locas_id_out = loca_out.id ;
DROP TABLE IF EXISTS sio.sio_r_outamts;
CREATE TABLE sio.sio_r_outamts (
sio_id numeric(38,0) CONSTRAINT SIO_r_outamts_id_pk PRIMARY KEY ,sio_user_code numeric(38,0)
,sio_Term_id varchar(30)
,sio_session_id numeric(38,0)
,sio_Command_Response char(1)
,sio_session_counter numeric(38,0)
,sio_classname varchar(50)
,sio_viewname varchar(30)
,sio_code varchar(30)
,sio_strsql varchar(4000)
,sio_totalcount numeric(38,0)
,sio_recordcount numeric(38,0)
,sio_start_record numeric(38,0)
,sio_end_record numeric(38,0)
,sio_sord varchar(256)
,sio_search varchar(10)
,sio_sidx varchar(256)
,loca_name_pare varchar (100)
,prjno_code_chil varchar (50)
,classlist_name varchar (100)
,classlist_name_pare varchar (100)
,crr_name varchar (100)
,itm_code varchar (50)
,crr_code varchar (50)
,classlist_code varchar (50)
,itm_name_pare varchar (100)
,classlist_code_pare varchar (50)
,loca_code varchar (50)
,loca_name_shelfno_fm varchar (100)
,loca_name_out varchar (100)
,loca_name varchar (100)
,itm_name varchar (100)
,prjno_name varchar (100)
,shelfno_name_fm varchar (100)
,unit_code_pare varchar (50)
,unit_code varchar (50)
,unit_name_pare varchar (100)
,unit_name varchar (100)
,shelfno_code_fm varchar (50)
,prjno_code varchar (50)
,itm_code_pare varchar (50)
,loca_code_shelfno_fm varchar (50)
,loca_code_out varchar (50)
,loca_code_pare varchar (50)
,outamt_expiredate date
,outamt_inoutflg varchar (3)
,outamt_starttime timestamp(6)
,outamt_amt numeric (18,4)
,alloctbl_qty_linkto_alloctbl numeric (22,0)
,trngantt_processseq numeric (38,0)
,trngantt_starttime timestamp(6)
,loca_abbr_out varchar (50)
,loca_zip_out varchar (10)
,loca_country_out varchar (20)
,loca_prfct_out varchar (20)
,loca_addr1_out varchar (50)
,loca_addr2_out varchar (50)
,loca_tel_out varchar (20)
,loca_fax_out varchar (20)
,loca_mail_out varchar (20)
,trngantt_duedate timestamp(6)
,trngantt_processseq_pare numeric (38,0)
,trngantt_qty_alloc numeric (22,6)
,crr_pricedecimal numeric (22,0)
,crr_amtdecimal numeric (22,0)
,crr_contents varchar (4000)
,alloctbl_qty_alloc numeric (22,6)
,trngantt_qty numeric (18,4)
,alloctbl_srctblname varchar (30)
,alloctbl_srctblid numeric (38,0)
,alloctbl_contents varchar (4000)
,alloctbl_qty numeric (22,6)
,alloctbl_qty_stk numeric (22,6)
,outamt_remark varchar (4000)
,outamt_id numeric (38,0)
,outamt_person_id_upd numeric (38,0)
,outamt_created_at timestamp(6)
,outamt_updated_at timestamp(6)
,outamt_update_ip varchar (40)
,outamt_alloctbl_id numeric (38,0)
,outamt_loca_id_out numeric (22,0)
,id numeric (38,0)
,outamt_crr_id numeric (22,0)
,itm_classlist_id_pare numeric (38,0)
,trngantt_itm_id_pare numeric (38,0)
,trngantt_loca_id_pare numeric (38,0)
,itm_unit_id numeric (22,0)
,trngantt_shelfno_id_fm numeric (22,0)
,itm_unit_id_pare numeric (22,0)
,trngantt_prjno_id numeric (38,0)
,shelfno_loca_id_shelfno_fm numeric (38,0)
,itm_classlist_id numeric (38,0)
,alloctbl_trngantt_id numeric (38,0)
,trngantt_itm_id numeric (38,0)
,trngantt_loca_id numeric (38,0)
,sio_errline varchar(4000)
,sio_org_tblname varchar(30)
,sio_org_tblid numeric(38,0)
,sio_add_time date
,sio_replay_time date
,sio_result_f char(1)
,sio_message_code char(10)
,sio_message_contents varchar(4000)
,sio_chk_done char(1)
);
CREATE INDEX sio_r_outamts_uk1
ON sio.sio_r_outamts(sio_user_code,sio_session_counter,sio_session_id,sio_Command_Response);
drop sequence if exists sio.sio_r_outamts_seq ;
create sequence sio.sio_r_outamts_seq ;
--- drop view r_outstks cascade
create or replace view r_outstks as select
outstk.qty outstk_qty,
shelfno_out.shelfno_code shelfno_code_out ,
alloctbl.shelfno_code_fm shelfno_code_fm ,
alloctbl.trngantt_processseq trngantt_processseq ,
shelfno_out.shelfno_name shelfno_name_out ,
alloctbl.prjno_name prjno_name ,
alloctbl.unit_code_pare unit_code_pare ,
alloctbl.unit_code unit_code ,
alloctbl.unit_name_pare unit_name_pare ,
alloctbl.unit_name unit_name ,
alloctbl.trngantt_itm_id trngantt_itm_id ,
alloctbl.trngantt_loca_id trngantt_loca_id ,
alloctbl.itm_code_pare itm_code_pare ,
alloctbl.itm_code itm_code ,
alloctbl.itm_name_pare itm_name_pare ,
alloctbl.itm_name itm_name ,
shelfno_out.loca_code_shelfno loca_code_shelfno_out ,
alloctbl.loca_code_shelfno_fm loca_code_shelfno_fm ,
alloctbl.loca_code_pare loca_code_pare ,
alloctbl.loca_code loca_code ,
shelfno_out.loca_name_shelfno loca_name_shelfno_out ,
alloctbl.loca_name_pare loca_name_pare ,
alloctbl.itm_unit_id_pare itm_unit_id_pare ,
alloctbl.itm_unit_id itm_unit_id ,
alloctbl.itm_classlist_id_pare itm_classlist_id_pare ,
alloctbl.itm_classlist_id itm_classlist_id ,
alloctbl.trngantt_duedate trngantt_duedate ,
alloctbl.trngantt_shelfno_id_fm trngantt_shelfno_id_fm ,
alloctbl.trngantt_itm_id_pare trngantt_itm_id_pare ,
outstk.id outstk_id,
outstk.id id,
outstk.starttime outstk_starttime,
outstk.qty_stk outstk_qty_stk,
outstk.lotno outstk_lotno,
outstk.packno outstk_packno,
outstk.inoutflg outstk_inoutflg,
outstk.expiredate outstk_expiredate,
outstk.remark outstk_remark,
outstk.persons_id_upd outstk_person_id_upd,
outstk.created_at outstk_created_at,
outstk.updated_at outstk_updated_at,
outstk.update_ip outstk_update_ip,
outstk.alloctbls_id outstk_alloctbl_id,
alloctbl.trngantt_loca_id_pare trngantt_loca_id_pare ,
outstk.shelfnos_id_out outstk_shelfno_id_out,
alloctbl.classlist_code classlist_code ,
alloctbl.alloctbl_trngantt_id alloctbl_trngantt_id ,
alloctbl.classlist_name classlist_name ,
alloctbl.prjno_code_chil prjno_code_chil ,
alloctbl.alloctbl_srctblname alloctbl_srctblname ,
alloctbl.alloctbl_srctblid alloctbl_srctblid ,
alloctbl.prjno_code prjno_code ,
shelfno_out.shelfno_loca_id_shelfno shelfno_loca_id_shelfno_out ,
alloctbl.shelfno_loca_id_shelfno_fm shelfno_loca_id_shelfno_fm ,
alloctbl.trngantt_prjno_id trngantt_prjno_id ,
outstk.qty_sch outstk_qty_sch
from outstks outstk,
r_persons person_upd , r_alloctbls alloctbl , r_shelfnos shelfno_out
where outstk.persons_id_upd = person_upd.id and outstk.alloctbls_id = alloctbl.id and outstk.shelfnos_id_out = shelfno_out.id ;
DROP TABLE IF EXISTS sio.sio_r_outstks;
CREATE TABLE sio.sio_r_outstks (
sio_id numeric(38,0) CONSTRAINT SIO_r_outstks_id_pk PRIMARY KEY ,sio_user_code numeric(38,0)
,sio_Term_id varchar(30)
,sio_session_id numeric(38,0)
,sio_Command_Response char(1)
,sio_session_counter numeric(38,0)
,sio_classname varchar(50)
,sio_viewname varchar(30)
,sio_code varchar(30)
,sio_strsql varchar(4000)
,sio_totalcount numeric(38,0)
,sio_recordcount numeric(38,0)
,sio_start_record numeric(38,0)
,sio_end_record numeric(38,0)
,sio_sord varchar(256)
,sio_search varchar(10)
,sio_sidx varchar(256)
,trngantt_duedate timestamp(6)
,loca_code_shelfno_out varchar (50)
,loca_name_shelfno_fm varchar (100)
,loca_name_shelfno_out varchar (100)
,shelfno_code_out varchar (50)
,shelfno_name_out varchar (100)
,outstk_lotno varchar (50)
,outstk_packno varchar (10)
,itm_code varchar (50)
,itm_name varchar (100)
,trngantt_processseq numeric (38,0)
,outstk_qty_sch numeric (22,6)
,outstk_qty numeric (22,6)
,outstk_qty_stk numeric (22,6)
,alloctbl_srctblname varchar (30)
,alloctbl_srctblid numeric (38,0)
,shelfno_code_fm varchar (50)
,loca_code varchar (50)
,shelfno_name_fm varchar (100)
,loca_name_pare varchar (100)
,loca_name varchar (100)
,prjno_code varchar (50)
,prjno_code_chil varchar (50)
,classlist_name varchar (100)
,classlist_name_pare varchar (100)
,classlist_code varchar (50)
,classlist_code_pare varchar (50)
,unit_code_pare varchar (50)
,unit_code varchar (50)
,unit_name_pare varchar (100)
,unit_name varchar (100)
,itm_code_pare varchar (50)
,itm_name_pare varchar (100)
,prjno_name varchar (100)
,loca_code_shelfno_fm varchar (50)
,loca_code_pare varchar (50)
,outstk_starttime timestamp(6)
,outstk_expiredate date
,outstk_inoutflg varchar (3)
,alloctbl_qty_linkto_alloctbl numeric (22,0)
,trngantt_starttime timestamp(6)
,trngantt_processseq_pare numeric (38,0)
,trngantt_qty_alloc numeric (22,6)
,alloctbl_qty_alloc numeric (22,6)
,trngantt_qty numeric (18,4)
,alloctbl_contents varchar (4000)
,alloctbl_qty numeric (22,6)
,alloctbl_qty_stk numeric (22,6)
,shelfno_contents_out varchar (4000)
,outstk_remark varchar (4000)
,outstk_id numeric (38,0)
,outstk_person_id_upd numeric (38,0)
,outstk_created_at timestamp(6)
,outstk_updated_at timestamp(6)
,outstk_update_ip varchar (40)
,outstk_alloctbl_id numeric (38,0)
,id numeric (38,0)
,outstk_shelfno_id_out numeric (22,0)
,itm_unit_id numeric (22,0)
,trngantt_itm_id numeric (38,0)
,itm_unit_id_pare numeric (22,0)
,trngantt_prjno_id numeric (38,0)
,trngantt_loca_id_pare numeric (38,0)
,shelfno_loca_id_shelfno_out numeric (38,0)
,alloctbl_trngantt_id numeric (38,0)
,shelfno_loca_id_shelfno_fm numeric (38,0)
,trngantt_loca_id numeric (38,0)
,trngantt_itm_id_pare numeric (38,0)
,trngantt_shelfno_id_fm numeric (22,0)
,itm_classlist_id numeric (38,0)
,itm_classlist_id_pare numeric (38,0)
,sio_errline varchar(4000)
,sio_org_tblname varchar(30)
,sio_org_tblid numeric(38,0)
,sio_add_time date
,sio_replay_time date
,sio_result_f char(1)
,sio_message_code char(10)
,sio_message_contents varchar(4000)
,sio_chk_done char(1)
);
CREATE INDEX sio_r_outstks_uk1
ON sio.sio_r_outstks(sio_user_code,sio_session_counter,sio_session_id,sio_Command_Response);
drop sequence if exists sio.sio_r_outstks_seq ;
create sequence sio.sio_r_outstks_seq ;
|
insert into User
values(1, 'danillo.mendonca@gmail.com', 'Danillo Mendonca', '123', '(48) 991852535');
insert into Video
values(1, 'Video 1', 'https://www.youtube.com/watch?v=MvTh8P9dAk4', 'MvTh8P9dAk4');
insert into Video
values(2, 'Video 2', 'https://www.youtube.com/watch?v=t2zFRaPequM', 't2zFRaPequM');
insert into Video
values(3, 'Video 3', 'https://www.youtube.com/watch?v=Ifh2bzWqA8I', 'AypZnQS0sys');
insert into Video
values(4, 'Video 4', 'https://www.youtube.com/watch?v=AypZnQS0sys', 'AypZnQS0sys');
insert into Video
values(5, 'Video 5', 'https://www.youtube.com/watch?v=uT-OuE54reI', 'uT-OuE54reI'); |
SET IDENTITY_INSERT ArmorSet ON
INSERT INTO ArmorSet (ArmorSetID, Name) VALUES (1, 'Battle Armor')
INSERT INTO Armor (ArmorSetID, Rank, DamageReduction) VALUES (1, 1, 1)
INSERT INTO Armor (ArmorSetID, Rank, DamageReduction) VALUES (1, 2, 1)
INSERT INTO Armor (ArmorSetID, Rank, DamageReduction) VALUES (1, 3, 1)
INSERT INTO Armor (ArmorSetID, Rank, DamageReduction) VALUES (1, 4, 1)
INSERT INTO Armor (ArmorSetID, Rank, DamageReduction) VALUES (1, 5, 1)
INSERT INTO Armor (ArmorSetID, Rank, DamageReduction) VALUES (1, 6, 1)
INSERT INTO ArmorSet (ArmorSetID, Name) VALUES (2, 'Light Armor')
INSERT INTO Armor (ArmorSetID, Rank, DamageReduction) VALUES (2, 1, 0)
INSERT INTO Armor (ArmorSetID, Rank, DamageReduction) VALUES (2, 2, 0)
INSERT INTO Armor (ArmorSetID, Rank, DamageReduction) VALUES (2, 3, 1)
INSERT INTO Armor (ArmorSetID, Rank, DamageReduction) VALUES (2, 4, 1)
INSERT INTO Armor (ArmorSetID, Rank, DamageReduction) VALUES (2, 5, 1)
INSERT INTO Armor (ArmorSetID, Rank, DamageReduction) VALUES (2, 6, 1)
INSERT INTO ArmorSet (ArmorSetID, Name) VALUES (3, 'Necro Fusion Armor')
INSERT INTO Armor (ArmorSetID, Rank, DamageReduction) VALUES (3, 1, 1)
INSERT INTO Armor (ArmorSetID, Rank, DamageReduction) VALUES (3, 2, 1)
INSERT INTO Armor (ArmorSetID, Rank, DamageReduction) VALUES (3, 3, 1)
INSERT INTO Armor (ArmorSetID, Rank, DamageReduction) VALUES (3, 4, 1)
INSERT INTO Armor (ArmorSetID, Rank, DamageReduction) VALUES (3, 5, 2)
INSERT INTO Armor (ArmorSetID, Rank, DamageReduction) VALUES (3, 6, 2)
INSERT INTO ArmorSet (ArmorSetID, Name) VALUES (4, 'Officer''s Gear')
INSERT INTO Armor (ArmorSetID, Rank, DamageReduction) VALUES (4, 1, 1)
INSERT INTO Armor (ArmorSetID, Rank, DamageReduction) VALUES (4, 2, 1)
INSERT INTO Armor (ArmorSetID, Rank, DamageReduction) VALUES (4, 3, 2)
INSERT INTO Armor (ArmorSetID, Rank, DamageReduction) VALUES (4, 4, 2)
INSERT INTO Armor (ArmorSetID, Rank, DamageReduction) VALUES (4, 5, 2)
INSERT INTO Armor (ArmorSetID, Rank, DamageReduction) VALUES (4, 6, 2)
INSERT INTO ArmorSet (ArmorSetID, Name) VALUES (5, 'Battleplate')
INSERT INTO Armor (ArmorSetID, Rank, DamageReduction) VALUES (5, 1, 2)
INSERT INTO Armor (ArmorSetID, Rank, DamageReduction) VALUES (5, 2, 2)
INSERT INTO Armor (ArmorSetID, Rank, DamageReduction) VALUES (5, 3, 2)
INSERT INTO Armor (ArmorSetID, Rank, DamageReduction) VALUES (5, 4, 2)
INSERT INTO Armor (ArmorSetID, Rank, DamageReduction) VALUES (5, 5, 3)
INSERT INTO Armor (ArmorSetID, Rank, DamageReduction) VALUES (5, 6, 3)
INSERT INTO ArmorSet (ArmorSetID, Name) VALUES (6, 'Necro Priest Robe')
INSERT INTO Armor (ArmorSetID, Rank, DamageReduction) VALUES (6, 1, 2)
INSERT INTO Armor (ArmorSetID, Rank, DamageReduction) VALUES (6, 2, 2)
INSERT INTO Armor (ArmorSetID, Rank, DamageReduction) VALUES (6, 3, 3)
INSERT INTO Armor (ArmorSetID, Rank, DamageReduction) VALUES (6, 4, 3)
INSERT INTO Armor (ArmorSetID, Rank, DamageReduction) VALUES (6, 5, 3)
INSERT INTO Armor (ArmorSetID, Rank, DamageReduction) VALUES (6, 6, 3)
INSERT INTO ArmorSet (ArmorSetID, Name) VALUES (7, 'Wargear')
INSERT INTO Armor (ArmorSetID, Rank, DamageReduction) VALUES (7, 1, 3)
INSERT INTO Armor (ArmorSetID, Rank, DamageReduction) VALUES (7, 2, 3)
INSERT INTO Armor (ArmorSetID, Rank, DamageReduction) VALUES (7, 3, 3)
INSERT INTO Armor (ArmorSetID, Rank, DamageReduction) VALUES (7, 4, 3)
INSERT INTO Armor (ArmorSetID, Rank, DamageReduction) VALUES (7, 5, 4)
INSERT INTO Armor (ArmorSetID, Rank, DamageReduction) VALUES (7, 6, 4)
SET IDENTITY_INSERT ArmorSet OFF |
type GrosumImpl as object
( grow number
, fall number
, static function ODCIAggregateInitialize(sctx in out GrosumImpl) return number
, member function ODCIAggregateIterate(self in out GrosumImpl, value in number) return number
, member function ODCIAggregateTerminate(self in GrosumImpl, returnValue out number, flags in number) return number
, member function ODCIAggregateMerge(self in out GrosumImpl, ctx2 in GrosumImpl) return number
)
type body GrosumImpl is
static function ODCIAggregateInitialize(sctx in out GrosumImpl)
return number is
begin
sctx := GrosumImpl(0, 0);
return ODCIConst.Success;
end;
member function ODCIAggregateIterate(self in out GrosumImpl, value in number) return number is
begin
self.grow := self.grow + value;
if self.grow < 0 then
self.fall := self.fall - self.grow;
self.grow := 0;
end if;
return ODCIConst.Success;
end;
member function ODCIAggregateTerminate(self in GrosumImpl, returnValue out number, flags in number) return number is
begin
returnValue := self.grow;
return ODCIConst.Success;
end;
member function ODCIAggregateMerge(self in out GrosumImpl, ctx2 in GrosumImpl) return number is
begin
if self.grow < ctx2.fall then
self.fall := self.fall + ctx2.fall - self.grow;
self.grow := ctx2.grow;
else
self.grow := self.grow + ctx2.grow - ctx2.fall;
end if;
return ODCIConst.Success;
end;
end;
CREATE OR REPLACE function grosum(input number) return number parallel_enable aggregate using GrosumImpl;
-- Пример использования
with change(time, diff) as (
select 1, 10 from dual union all
select 2, -8 from dual union all
select 3, -5 from dual union all
select 4, 4 from dual
)
select time
, grosum(diff) over (order by time) as balance
from change
|
CREATE PROCEDURE SP_RECEPCION_SKU_UPDATE
@SKU_QTY_REAL INT,
@SKU_FECHA_INICIO DATETIME,
@SKU_FECHA_FIN DATETIME,
@SKU_CODIGO VARCHAR(50),
@PROT_CODIGO INT,
@PRO_CODIGO INT,
@DOC_NUMERO INT,
@DOC_TIPO VARCHAR(100),
@BOD_CODIGO VARCHAR(50),
@EMP_CODIGO INT
AS
BEGIN
-- ACTUALIZA EL SKU_QTY_REAL, LA FECHA DE INICIO Y FIN DEL SKU EN BASE A SUS LLAVES PRIMARIAS
IF (@SKU_FECHA_FIN = '')
SET @SKU_FECHA_FIN = NULL
UPDATE SKU
SET SKU_QTY_REAL = @SKU_QTY_REAL,
SKU_FECHA_INICIO = @SKU_FECHA_INICIO,
SKU_FECHA_FIN = @SKU_FECHA_FIN
WHERE SKU_CODIGO = @SKU_CODIGO
AND PROT_CODIGO = @PROT_CODIGO
AND PRO_CODIGO = @PRO_CODIGO
AND DOC_NUMERO = @DOC_NUMERO
AND DOC_TIPO = @DOC_TIPO
AND BOD_CODIGO = @BOD_CODIGO
AND EMP_CODIGO = @EMP_CODIGO
END
|
drop table if exists login;
CREATE TABLE IF NOT EXISTS Login(userID VARCHAR(255), pass VARCHAR(255) NOT NULL,
PRIMARY KEY (userID));
DROP TABLE if exists clientinfo;
CREATE TABLE IF NOT EXISTS ClientInfo(userID VARCHAR(255) NOT NULL, fullname CHAR(50),
address1 VARCHAR (100) NOT NULL, address2 VARCHAR (100), city CHAR(100), state CHAR (2),
zipcode INT (9) NOT NULL, PRIMARY KEY (userID), FOREIGN KEY (userID) REFERENCES
login (userID));
drop table if exists fuelquote;
CREATE TABLE IF NOT EXISTS fuelQuote (ID VARCHAR (255), gallons DOUBLE, address VARCHAR (100)
NOT NULL, deliverydate DATE, suggestedprice FLOAT, totalamountdue FLOAT,
PRIMARY KEY (ID, deliverydate), FOREIGN KEY (ID) REFERENCES ClientInfo (userID));
drop view if exists quoteHistory;
CREATE VIEW quoteHistory AS SELECT * FROM fuelQuote F WHERE ID = F.ID; |
INSERT INTO public.adherent(
id, adresse, codepostal, datenaissance, email, nom, prenom, ville, cotisation_id)
VALUES
(101, '2 Lot Chanteperdrix', '80300', '1968-02-16', 'PARUCH@gamil.com', 'PARUCH', 'Armand', 'MEAULTE', null),
(102, '5 Rue du Jeu de Tamis', '80370', '1963-04-16', 'MACRON@gamil.com', 'MACRON', 'Bruno', 'BERNAVILLE', null),
(103, '14 Rue Neuve', '62111', '1967-02-10', 'HOSSART@gamil.com', 'HOSSART', 'Marc', 'SAILLY AU BOIS', null),
(104, '2 Rue du Moulin', '80270', '1978-02-26', 'CLOP@gamil.com', 'CLOP', 'Guillaume', 'VERGIES ', null),
(105, '1 Rue d en Haut', '80640', '1988-05-06', 'DEVIENNE@gamil.com', 'DEVIENNE', 'Damien', 'GOUY L HOPITAL', null),
(106, '70 Grande Rue ', '80300', '1998-10-10', 'DELPLANQUE@gamil.com', 'DELPLANQUE', 'Florian', 'MEAULTE', null),
(107, '6 Rue de Vaux', '80490', '1990-05-16', 'DUCHEMIN@gamil.com', 'DUCHEMIN', 'Vincent', 'FRUCOURT', null),
(108, '4 Rue du Bois', '80140', '1968-12-15', 'PEGARD@gamil.com', 'PEGARD', 'Matthieu', 'FONTAINE LE SEC', null),
(109, '14 Grande Rue', '80200', '1984-02-10', 'LEPOIX@gamil.com', 'LEPOIX', 'Pierre', 'SAINT CHRIST BRIOST', null),
(110, '1 Rue de Crécy', '80370', '1994-02-06', 'MARQUANT@gamil.com', 'MARQUANT ', 'Florine', 'CONTEVILLE ', null),
(111, '22 Rue Gaston Morin', '80620', '1992-12-16', 'PATTE@gamil.com', 'PATTE', 'Nicolas', 'DOMART EN PONTHIEU', null),
(112, '2 Rue de la République', '80490', '1981-02-16', 'RIGOLLE@gamil.com', 'RIGOLLE', 'Benoît', 'HALLENCOURT', null),
(113, '17 Rue des Héritages ', '80300', '1969-12-11', 'BAUWIN@gamil.com', 'BAUWIN ', 'Claudie', 'MIRAUMONT', null),
(114, '42 route du Coq Gaulois Digeon', '80290', '1978-05-26', 'DARTOIS@gamil.com', 'DARTOIS', 'Etienne ', 'DIGEON', null),
(115, '7 Rue des Prés', '80300', '1982-02-16', 'DUCANCHEZ@gamil.com', 'DUCANCHEZ', 'Pauline', 'MORLANCOURT', null),
(116, '13 Rue du Château', '80210', '1985-02-16', 'FRANCOIS@gamil.com', 'FRANCOIS', 'Maxime', 'MONS BOUBERT', null),
(117, '16 Route de Conteuille', '80370', '1991-02-16', 'LALOUX@gamil.com', 'LALOUX', 'Arnaud', 'BERNATRE', null),
(118, 'Ferme Le Bel Air', '80250', '1991-08-06', 'LEROUX@gamil.com', 'LEROUX', 'Antoine', 'LA FALOISE', null),
(119, '100 Rue Bréant', '80132', '1986-09-16', 'LEVEQUE@gamil.com', 'LEVEQUE', 'Pierre', 'HAUTVILLERS OUVILLE', null),
(120, '4 Bis Rue de Moreuil ', '80134', '1988-07-18', 'MACHART@gamil.com', 'MACHART', 'Laurent', 'HANGEST EN SANTERRE', null),
(121, '4 Rue Boulanger', '80290', '1978-03-19', 'ROBITAILLE@gamil.com', 'ROBITAILLE', 'Hugues', 'CAULIERES', null),
(122, '200 Rue Jean Jaurès', '80470', '1993-04-17', 'THIBAUT@gamil.com', 'THIBAUT', 'Quentin', 'DREUIL LES AMIENS', null),
(123, '17 Rue Fursy Lesage', '80800', '1987-01-12', 'TONDELLIER@gamil.com', 'TONDELLIER', 'Quentin', 'CACHY', null),
(124, '9 Rue du 22ème RMVE', '80890', '1989-09-16', 'VANDYCKE@gamil.com', 'VAN DYCKE', 'Aurélie', 'CONDE FOLIE', null),
(125, 'La Molière de terre - Chemin de la corde', '80410', '1988-02-14', 'BRUNET@gamil.com', 'BRUNET ', 'Edouard', 'CAYEUX SUR MER', null),
(126, '13 Rue d Amiens', '80310', '1989-01-11', 'GOURGUECHON@gamil.com', 'GOURGUECHON', 'Benoît', 'SAINT VAAST EN CHAUSSEE ', null),
(127, '26 Rue du Moulin', '80120', '1990-03-20', 'Aline@gamil.com', 'BOITEL LANDRIEUX', 'Aline', 'RUE', null),
(128, '13 rue Principale - Saigneville', '80230', '1979-07-22', 'PIOLE@gamil.com', 'PIOLE', 'Julien', 'PETIT PORT', null),
(129, 'Ferme de Mezoutre', '80150', '1977-05-15', 'Louis@gamil.com', 'PIOLE', 'Louis', 'VIRONCHAUX ', null),
(130, '17 Rue Alexis Carrel', '80400', '1969-04-25', 'TARDIEUX@gamil.com', 'TARDIEUX', 'Fabien', 'HAM', null),
(131, 'La Mare du Bois', '76390', '1991-12-29', 'VERMERSCH@gamil.com', 'VERMERSCH', 'Elie', 'HAUDRICOURT', null); |
/*
Navicat MySQL Data Transfer
Source Server : po
Source Server Version : 50525
Source Host : localhost:3306
Source Database : spruce
Target Server Type : MYSQL
Target Server Version : 50525
File Encoding : 65001
Date: 2013-05-09 10:23:58
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for `metadata_1_followed`
-- ----------------------------
DROP TABLE IF EXISTS `metadata_1_followed`;
CREATE TABLE `metadata_1_followed` (
`source_id` int(10) unsigned NOT NULL,
`type` tinyint(1) NOT NULL,
`count` int(10) unsigned NOT NULL,
`state` tinyint(4) NOT NULL,
`updated_at` bigint(20) unsigned NOT NULL,
`created_at` int(10) unsigned NOT NULL,
PRIMARY KEY (`source_id`,`type`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='negative direction';
-- ----------------------------
-- Records of metadata_1_followed
-- ----------------------------
-- ----------------------------
-- Table structure for `metadata_1_following`
-- ----------------------------
DROP TABLE IF EXISTS `metadata_1_following`;
CREATE TABLE `metadata_1_following` (
`source_id` int(10) unsigned NOT NULL,
`type` tinyint(1) NOT NULL,
`count` int(10) unsigned NOT NULL,
`state` tinyint(4) NOT NULL,
`updated_at` bigint(20) unsigned NOT NULL,
`created_at` int(10) unsigned NOT NULL,
PRIMARY KEY (`source_id`,`type`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='positive direction';
-- ----------------------------
-- Records of metadata_1_following
-- ----------------------------
-- ----------------------------
-- Table structure for `rs_1_followed`
-- ----------------------------
DROP TABLE IF EXISTS `rs_1_followed`;
CREATE TABLE `rs_1_followed` (
`source_id` int(10) unsigned NOT NULL,
`target_id` int(10) unsigned NOT NULL,
`type` tinyint(1) NOT NULL,
`state` tinyint(4) NOT NULL,
`created_at` int(10) unsigned NOT NULL,
`updated_at` bigint(20) unsigned NOT NULL,
PRIMARY KEY (`source_id`,`target_id`,`type`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='negative direction';
-- ----------------------------
-- Records of rs_1_followed
-- ----------------------------
-- ----------------------------
-- Table structure for `rs_1_following`
-- ----------------------------
DROP TABLE IF EXISTS `rs_1_following`;
CREATE TABLE `rs_1_following` (
`source_id` int(10) unsigned NOT NULL,
`target_id` int(10) unsigned NOT NULL,
`type` tinyint(1) NOT NULL,
`state` tinyint(4) NOT NULL,
`created_at` int(10) unsigned NOT NULL,
`updated_at` bigint(20) unsigned NOT NULL,
PRIMARY KEY (`source_id`,`target_id`,`type`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='positive direction';
-- ----------------------------
-- Records of rs_1_following
-- ----------------------------
|
/*
Navicat SQLite Data Transfer
Source Server : localhost
Source Server Version : 30706
Source Host : :0
Target Server Type : SQLite
Target Server Version : 30706
File Encoding : 65001
Date: 2014-10-26 23:33:11
*/
PRAGMA foreign_keys = OFF;
-- ----------------------------
-- Table structure for "main"."gangs"
-- ----------------------------
DROP TABLE "main"."gangs";
CREATE TABLE "gangs" (
"id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
"name" TEXT(16) NOT NULL,
"description" TEXT(64),
"level" INTEGER NOT NULL
);
-- ----------------------------
-- Records of gangs
-- ----------------------------
-- ----------------------------
-- Table structure for "main"."items"
-- ----------------------------
DROP TABLE "main"."items";
CREATE TABLE "items" (
"id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
"item_id" INTEGER NOT NULL,
"player_id" INTEGER NOT NULL,
"exp" INTEGER NOT NULL,
CONSTRAINT "foreign_player_id" FOREIGN KEY ("player_id") REFERENCES "players" ("id") ON DELETE CASCADE ON UPDATE RESTRICT
);
-- ----------------------------
-- Records of items
-- ----------------------------
-- ----------------------------
-- Table structure for "main"."players"
-- ----------------------------
DROP TABLE "main"."players";
CREATE TABLE "players" (
"id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
"name" TEXT(16) NOT NULL,
"gang_id" INTEGER,
"last_login" TEXT(20) NOT NULL,
"level" INTEGER NOT NULL,
"gold" INTEGER NOT NULL,
"gem" INTEGER NOT NULL,
CONSTRAINT "foreign_gang_id" FOREIGN KEY ("gang_id") REFERENCES "gangs" ("id") ON DELETE SET NULL ON UPDATE SET NULL
);
-- ----------------------------
-- Records of players
-- ----------------------------
-- ----------------------------
-- Table structure for "main"."sqlite_sequence"
-- ----------------------------
DROP TABLE "main"."sqlite_sequence";
CREATE TABLE sqlite_sequence(name,seq);
-- ----------------------------
-- Records of sqlite_sequence
-- ----------------------------
-- ----------------------------
-- View structure for "main"."gang_members"
-- ----------------------------
DROP VIEW IF EXISTS "main"."gang_members";
CREATE VIEW gang_members
as
select gangs.*, count(*) as members
from players
join gangs on players.gang_id = gangs.id
group by gangs.id
order by members desc;
-- ----------------------------
-- View structure for "main"."gang_players"
-- ----------------------------
DROP VIEW IF EXISTS "main"."gang_players";
CREATE VIEW "gang_players" AS
select players.name, gangs.name as gang_name, players.level, players.gold, players.gem, count(*) as item_num, sum(items.exp) as item_exps
from items
join players on items.player_id = players.id
join gangs on players.gang_id = gangs.id
group by players.id
order by gangs.level desc, gangs.id, players.level desc;
-- ----------------------------
-- View structure for "main"."players_level"
-- ----------------------------
DROP VIEW IF EXISTS "main"."players_level";
CREATE VIEW "players_level" AS
select level, avg(gold), avg(gem), count(*)
from players
group by level
order by level desc;
-- ----------------------------
-- Indexes structure for table items
-- ----------------------------
CREATE INDEX "main"."index_player_id"
ON "items" ("player_id" ASC);
-- ----------------------------
-- Indexes structure for table players
-- ----------------------------
CREATE INDEX "main"."index_gang_id"
ON "players" ("gang_id" ASC);
|
/*
Name: Articles saved details
Data source: 4
Created By: Admin
Last Update At: 2016-04-14T18:24:25.906105+00:00
*/
SELECT v.post_prop20 AS Article,
a.title_long AS Title,
a.,
a.locale,
FROM
(SELECT post_prop20,
page_url,
FROM (TABLE_QUERY(djomniture:cipomniture_djmansionglobal,'CONCAT(REPLACE(table_id,"_","-"),"-01") BETWEEN STRFTIME_UTC_USEC("{{startdate}}", "%Y-%m-01") and STRFTIME_UTC_USEC("{{enddate}}", "%Y-%m-31")'))
WHERE post_page_event='100'
AND DATE(date_time) >= DATE('{{startdate}}')
AND DATE(date_time) <= DATE('{{enddate}}')
AND (post_prop25 = "articleSaved")
GROUP BY post_prop20,
page_url) v
LEFT JOIN [djomniture:devspark.MG_Articles] AS a ON v.post_prop20=a.id
ORDER BY Title ASC
|
delete
from compra
where id = :id |
update events_list
set date = $1, event = $2, description = $3
where id = $4
returning * |
-- 字典表
create table dictionary (
id bigserial not null,
parent_id bigint not null,
tenant_id bigint not null default 0,
app_module VARCHAR(50),
type VARCHAR(50) not null,
item_name VARCHAR(100) not null,
item_value VARCHAR(100) null,
description VARCHAR(100) null,
extdata VARCHAR(200) null,
sort_id SMALLINT not null default 99,
is_deletable BOOLEAN not null default TRUE,
is_editable BOOLEAN not null default TRUE,
is_deleted BOOLEAN not null default FALSE,
create_time timestamp not null default CURRENT_TIMESTAMP,
constraint PK_dictionary primary key (id)
);
-- 添加备注
comment on column dictionary.id is 'ID';
comment on column dictionary.parent_id is '父ID';
comment on column dictionary.tenant_id is '租户ID';
comment on column dictionary.app_module is '应用模块';
comment on column dictionary.type is '字典类型';
comment on column dictionary.item_name is '显示名';
comment on column dictionary.item_value is '存储值';
comment on column dictionary.description is '描述说明';
comment on column dictionary.extdata is '扩展JSON';
comment on column dictionary.sort_id is '排序号';
comment on column dictionary.is_editable is '是否可改';
comment on column dictionary.is_deletable is '是否可删';
comment on column dictionary.is_deleted is '删除标记';
comment on column dictionary.create_time is '创建时间';
comment on table dictionary is '数据字典';
-- 创建索引
create index idx_directory on dictionary(type, item_value);
create index idx_directory_tenant on dictionary(tenant_id);
|
-- SQL Query
-- 1. Tampilkan Kode,Nama, Gaji, Nama Departemen dari tabel karyawan
USE belajar_oop
SELECT
TK.kode AS 'Kode',
TK.nama AS 'Nama',
CONCAT('Rp. ', FORMAT(TK.gaji, '##,###0'), ',00') AS 'Gaji',
TD.nama AS 'Departemen'
FROM
tkaryawan TK INNER JOIN tdepartemen TD
ON
TK.departemen_id = TD.id;
-- 2. Tampilkan Kode,Nama, Gaji, Nama Departemen dari tabel karyawan, urutkan berdasarkan kode karyawan
-- Sama seperti nomor 1 dengan tambahan ORDER BY tkaryawan.kode
USE belajar_oop
SELECT
TK.kode AS 'Kode',
TK.nama AS 'Nama',
CONCAT('Rp. ', FORMAT(TK.gaji, '##,###0'), ',00') AS 'Gaji',
TD.nama AS 'Departemen'
FROM
tkaryawan TK INNER JOIN tdepartemen TD
ON
TK.departemen_id = TD.id
ORDER BY 'Kode';
-- 3. Tampilkan Kode,Nama, Gaji, Nama Departemen dari tablle karyawan , urutkan berdasarkan nama departemen
-- Sama seperti nomor 2, ubah ORDER BY
USE belajar_oop
SELECT
TK.kode AS 'Kode',
TK.nama AS 'Nama',
CONCAT('Rp. ', FORMAT(TK.gaji, '##,###0'), ',00') AS 'Gaji',
TD.nama AS 'Departemen'
FROM
tkaryawan TK INNER JOIN tdepartemen TD
ON
TK.departemen_id = TD.id
ORDER BY TD.nama;
-- 4. Tampilkan kode,nama, gaji dari table karyawan yang tidak mempunyai departemen
-- Ubah INNER JOIN menjadi LEFT OUTER JOIN dan tambahkan kondisi departemen_id yg bernilai NULL
USE belajar_oop
SELECT
TK.kode AS 'Kode',
TK.nama AS 'Nama',
CONCAT('Rp. ', FORMAT(TK.gaji, '##,###0'), ',00') AS 'Gaji',
TD.nama AS 'Departemen'
FROM
tkaryawan TK LEFT OUTER JOIN tdepartemen TD
ON
TK.departemen_id = TD.id
WHERE
TK.departemen_id is NULL;
-- 5. Tampilkan kode,nama, gaji dari table karyawan yang hanya mempunyai departemen
USE belajar_oop
SELECT
TK.kode AS 'Kode',
TK.nama AS 'Nama',
CONCAT('Rp. ', FORMAT(TK.gaji, '##,###0'), ',00') AS 'Gaji',
TD.nama AS 'Departemen'
FROM
tkaryawan TK RIGHT OUTER JOIN tdepartemen TD
ON
TK.departemen_id = TD.id
WHERE
TK.departemen_id IS NOT NULL;
-- 6. Tampilkan 10 karyawan dengan gaji tertinggi
USE belajar_oop
SELECT TOP(10)
Nama,
CONCAT('Rp. ', FORMAT(Gaji, '##,###0'), ',00') AS 'Gaji'
FROM tkaryawan
ORDER BY Gaji DESC
-- 7. Tampilkan total gaji per departemen urutkan berdasarkan nominal gaji (ascending)
USE belajar_oop;
SELECT
TD.nama,
CONCAT('Rp. ', FORMAT(SUM(TK.gaji), '##,###0'), ',00') AS 'Gaji'
FROM
tkaryawan TK INNER JOIN tdepartemen TD
ON TK.departemen_id = TD.id
GROUP BY TD.nama;
-- 8. Tampilkan total gaji yang harus dikeluarkan perusahaan sebulan
USE belajar_oop;
SELECT
CONCAT('Rp. ', FORMAT(SUM(TK.gaji), '##,###0'), ',00') AS 'Gaji'
FROM
tkaryawan TK
-- 9. Tampilkan Nama Departemen, Jumlah Karyawan, Total Gaji nya kemudian urutkan berdasarkan jumlah karyawan terbanyak
USE belajar_oop;
SELECT
TD.nama as 'Departemen',
COUNT(TK.id) AS 'Jumlah Karyawan',
CONCAT('Rp. ', FORMAT(SUM(TK.gaji), '##,###0'), ',00') AS 'Total Gaji'
FROM
tkaryawan TK LEFT OUTER JOIN tdepartemen TD
ON TK.departemen_id = TD.id
GROUP BY TD.nama
ORDER BY 'Jumlah Karyawan' DESC;
|
CREATE PROCEDURE sp_ser_replace_Bank(@BANK_CODE NVARCHAR(50),
@ACCOUNT_NUMBER NVARCHAR(255),
@ServicechargePercentage Decimal(18,6),
@RealisationType int)
AS
UPDATE Bank SET RealisationType = @RealisationType,
ServicechargePercentage = @ServicechargePercentage
WHERE BankCode = @BANK_CODE and Account_Number = @ACCOUNT_NUMBER
SELECT @ACCOUNT_NUMBER
|
/*write a SQL query to list the names of all people who have directed a movie that received a rating of at least 9.0.
Your query should output a table with a single column for the name of each person.
If a person directed more than one movie that received a rating of at least 9.0, they should only appear in your results once.*/
SELECT DISTINCT p.name
FROM people AS p
INNER JOIN ratings AS r
ON r.rating >= 9.0
INNER JOIN directors AS d
ON r.movie_id = d.movie_id AND p.id = d.person_id; |
SELECT * FROM streams
WHERE stream_id = $1; |
-- phpMyAdmin SQL Dump
-- version 4.7.9
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1:3306
-- Generation Time: Jul 21, 2018 at 05:27 PM
-- Server version: 5.7.21
-- PHP Version: 5.6.35
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: `register`
--
-- --------------------------------------------------------
--
-- Table structure for table `new_record`
--
DROP TABLE IF EXISTS `new_record`;
CREATE TABLE IF NOT EXISTS `new_record` (
`id` int(50) NOT NULL AUTO_INCREMENT,
`name` varchar(100) NOT NULL,
`image` varchar(100) NOT NULL,
`comment` varchar(50) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=22 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `new_record`
--
INSERT INTO `new_record` (`id`, `name`, `image`, `comment`) VALUES
(10, 'Rakesh Roy', 'images/27535813_334094600422446_356606853_o.jpg', 'My Dear friend'),
(20, 'Adf', 'images/2017-07-15.png', 'rgre'),
(21, 'tetgtg', 'images/2017-08-02 (2).png', 'ttet4t5');
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
DROP TABLE IF EXISTS `users`;
CREATE TABLE IF NOT EXISTS `users` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`username` varchar(50) NOT NULL,
`email` varchar(50) NOT NULL,
`password` varchar(50) NOT NULL,
`trn_date` datetime NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;
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 NDV(urldomain)
from edb.edb_keyword
where search_event_date between 20181001 and 20181031
and captify_region = 'US'
and property_id not in (select property_id
from edb.edb_keyword
where search_event_date between 20180201 and 20180228
and captify_region = 'US') |
create table accounts.accounts (
user_name text primary key,
pass_word text
);
create table familytree.familytree (
person text primary key,
parent1 text,
parent2 text,
user_name text
);
select * from accounts.accounts;
select * from familytree.familytree; |
USE test;
DROP TABLE IF EXISTS part;
CREATE TABLE part (
id INT(11) PRIMARY KEY NOT NULL AUTO_INCREMENT,
name VARCHAR(100) NOT NULL,
essential BIT DEFAULT FALSE NOT NULL,
quantity INT(10)
)
ENGINE = InnoDB
DEFAULT CHARACTER SET = 'utf8'
COLLATE='utf8_general_ci';
CREATE UNIQUE INDEX part_name_uniq ON part (name);
INSERT INTO part (name, essential, quantity)
VALUES
('Деталь 01', true, 8)
, ('Деталь 02', true, 9)
, ('Деталь 03', true, 10)
, ('Деталь 04', false, 10)
, ('Деталь 05', false, 10)
, ('Деталь 06', false, 10)
, ('Деталь 07', false, 10)
, ('Деталь 08', false, 10)
, ('Деталь 09', false, 10)
, ('Деталь 10', false, 10)
, ('Деталь 11', false, 10)
, ('Деталь 12', false, 10); |
-- phpMyAdmin SQL Dump
-- version 4.8.5
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Mar 25, 2020 at 01:18 AM
-- Server version: 10.1.38-MariaDB
-- PHP Version: 7.3.2
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: `dbmaster`
--
-- --------------------------------------------------------
--
-- Table structure for table `carts`
--
CREATE TABLE `carts` (
`_id` int(11) UNSIGNED NOT NULL,
`id_user` int(11) UNSIGNED NOT NULL,
`id_item` int(11) UNSIGNED NOT NULL,
`name_item` varchar(60) NOT NULL,
`total_items` int(11) UNSIGNED DEFAULT '0',
`total_price` decimal(10,2) UNSIGNED NOT NULL,
`is_check_out` tinyint(1) DEFAULT '0',
`created_at` datetime DEFAULT CURRENT_TIMESTAMP,
`updated_at` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `carts`
--
INSERT INTO `carts` (`_id`, `id_user`, `id_item`, `name_item`, `total_items`, `total_price`, `is_check_out`, `created_at`, `updated_at`) VALUES
(1, 5, 4, 'SUPER SUPREME', 1, '86000.00', 1, '2020-03-19 14:00:50', '2020-03-20 16:37:07'),
(2, 5, 1, 'Cheesy Galore', 1, '76000.00', 1, '2020-03-20 16:36:36', '2020-03-20 16:37:07'),
(5, 6, 1, 'Cheesy Galore', 1, '76000.00', 1, '2020-03-23 02:45:19', '2020-03-23 02:46:04'),
(6, 6, 1, 'Cheesy Galore', 1, '76000.00', 1, '2020-03-23 02:46:22', '2020-03-23 02:46:30'),
(7, 6, 1, 'Cheesy Galore', 1, '76000.00', 1, '2020-03-23 02:54:29', '2020-03-23 02:54:36'),
(8, 6, 12, 'Bucket Drummer Stick', 3, '294000.00', 1, '2020-03-23 10:03:38', '2020-03-23 10:04:50'),
(9, 6, 1, 'Cheesy Galore', 1, '76000.00', 0, '2020-03-23 10:26:12', '2020-03-23 10:26:27');
-- --------------------------------------------------------
--
-- Table structure for table `itemcategories`
--
CREATE TABLE `itemcategories` (
`_id` int(11) UNSIGNED NOT NULL,
`name` varchar(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `itemcategories`
--
INSERT INTO `itemcategories` (`_id`, `name`) VALUES
(6, 'Chikken KFC'),
(7, 'Donnut J.CO'),
(8, 'Coffee Starbucks'),
(9, 'Pizza PH'),
(10, 'Burger McD');
-- --------------------------------------------------------
--
-- Table structure for table `itemreviews`
--
CREATE TABLE `itemreviews` (
`_id` int(11) UNSIGNED NOT NULL,
`id_user` int(11) UNSIGNED DEFAULT '0',
`id_item` int(11) UNSIGNED DEFAULT '0',
`rating` tinyint(1) UNSIGNED DEFAULT '0',
`review` text,
`created_at` datetime DEFAULT CURRENT_TIMESTAMP,
`updated_at` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `items`
--
CREATE TABLE `items` (
`_id` int(11) UNSIGNED NOT NULL,
`id_restaurant` int(11) UNSIGNED NOT NULL,
`id_category` int(11) UNSIGNED DEFAULT '0',
`name` varchar(60) NOT NULL,
`price` decimal(10,2) UNSIGNED NOT NULL,
`quantity` int(11) UNSIGNED DEFAULT '0',
`description` text,
`images` text,
`created_at` datetime DEFAULT CURRENT_TIMESTAMP,
`updated_at` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `items`
--
INSERT INTO `items` (`_id`, `id_restaurant`, `id_category`, `name`, `price`, `quantity`, `description`, `images`, `created_at`, `updated_at`) VALUES
(1, 8, 9, 'Cheesy Galore', '76000.00', 11, NULL, 'uploads/1584600574647.png', '2020-03-19 13:49:34', '2020-03-23 02:54:36'),
(9, 8, 9, 'Double Cheese', '75000.00', 15, NULL, 'uploads/1584922995913.jpeg', '2020-03-23 07:23:15', NULL),
(10, 7, 8, 'Mocha Coffee', '35000.00', 20, NULL, 'uploads/1584923073279.jpeg', '2020-03-23 07:24:33', NULL),
(11, 6, 7, 'Chocolate Nut', '10000.00', 15, NULL, 'uploads/1584923122524.jpeg', '2020-03-23 07:25:22', NULL),
(12, 5, 6, 'Bucket Drummer Stick', '98000.00', 12, NULL, 'uploads/1584923182243.jpeg', '2020-03-23 07:26:22', '2020-03-23 10:04:50'),
(13, 9, 9, 'MEAT LOVERS CHEESY MAYO', '84000.00', 12, NULL, 'uploads/1584923285202.jpeg', '2020-03-23 07:28:05', NULL),
(14, 11, 7, 'Chocolate Super', '13000.00', 15, NULL, 'uploads/1584923329844.jpeg', '2020-03-23 07:28:49', NULL),
(15, 10, 8, 'Chocolate Hot', '37000.00', 15, NULL, 'uploads/1584923382760.jpeg', '2020-03-23 07:29:42', NULL),
(16, 12, 6, 'Bucket Extra Large', '110000.00', 10, NULL, 'uploads/1584923436393.jpeg', '2020-03-23 07:30:36', NULL),
(17, 11, 7, 'Chocolate Cheese', '13000.00', 21, NULL, 'uploads/1584923493678.jpeg', '2020-03-23 07:31:33', NULL),
(18, 9, 9, 'SUPER SUPREME', '74000.00', 13, NULL, 'uploads/1584923550861.jpeg', '2020-03-23 07:32:30', NULL);
-- --------------------------------------------------------
--
-- Table structure for table `restaurants`
--
CREATE TABLE `restaurants` (
`_id` int(11) UNSIGNED NOT NULL,
`id_owner` int(11) UNSIGNED NOT NULL,
`name` varchar(40) NOT NULL,
`logo` text,
`address` text,
`description` text,
`created_at` datetime DEFAULT CURRENT_TIMESTAMP,
`upated_at` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `restaurants`
--
INSERT INTO `restaurants` (`_id`, `id_owner`, `name`, `logo`, `address`, `description`, `created_at`, `upated_at`) VALUES
(5, 3, 'KFC Bogor', 'uploads/1584599736979.jpeg', 'Jl Sukasari III no.47, Bogor Timur, Kota Bogor', 'Buka Perdana, dan Tiada dua.', '2020-03-16 19:54:50', '2020-03-23 03:33:19'),
(6, 3, 'J.CO Bogor', 'uploads/1584363338060.jpeg', 'Jl Sukasari III no.47, Bogor Timur, Kota Bogor', 'Buka Perdana, dan Tiada dua.', '2020-03-16 19:55:38', '2020-03-23 03:33:20'),
(7, 3, 'Starbucks Bogor', 'uploads/1584363371558.jpeg', 'Jl Sukasari III no.47, Bogor Timur, Kota Bogor', 'Buka Perdana, dan Tiada dua.', '2020-03-16 19:56:11', '2020-03-23 03:33:20'),
(8, 3, 'Pizza Hut Bogor', 'uploads/1584363395548.jpeg', 'Jl Sukasari III no.47, Bogor Timur, Kota Bogor', 'Buka Perdana, dan Tiada dua.', '2020-03-16 19:56:35', '2020-03-23 03:33:20'),
(9, 5, 'Pizza Hut Bogor', 'uploads/1584363433048.jpeg', 'Jl Sukasari III no.47, Bogor Timur, Kota Bogor', 'Buka Perdana, dan Tiada dua.', '2020-03-16 19:57:13', '2020-03-23 03:33:20'),
(10, 5, 'Starbucks Bogor', 'uploads/1584363451207.jpeg', 'Jl Sukasari III no.47, Bogor Timur, Kota Bogor', 'Buka Perdana, dan Tiada dua.', '2020-03-16 19:57:31', '2020-03-23 03:33:20'),
(11, 5, 'J.CO Bogor', 'uploads/1584363470664.jpeg', 'Jl Sukasari III no.47, Bogor Timur, Kota Bogor', 'Buka Perdana, dan Tiada dua.', '2020-03-16 19:57:50', '2020-03-23 03:33:20'),
(12, 5, 'KFC Bogor', 'uploads/1584909250759.jpeg', 'Jl Sukasari III no.47, Bogor Timur, Kota Bogor', 'Buka Perdana, dan Tiada dua.', '2020-03-16 19:58:59', '2020-03-23 03:34:10'),
(13, 5, 'KFC 2', 'uploads/1584932944187.jpeg', 'Jl. Kramat 5 No.1 kel, RT.5/RW.9, Kenari, Kec. Senen, Kota Jakarta Pusat, Daerah Khusus Ibukota Jakarta 10430', NULL, '2020-03-23 10:09:04', NULL);
-- --------------------------------------------------------
--
-- Table structure for table `transactions`
--
CREATE TABLE `transactions` (
`_id` int(11) UNSIGNED NOT NULL,
`id_user` int(11) UNSIGNED NOT NULL,
`list_item` text,
`total_price` decimal(10,2) UNSIGNED NOT NULL,
`created_at` datetime DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `transactions`
--
INSERT INTO `transactions` (`_id`, `id_user`, `list_item`, `total_price`, `created_at`) VALUES
(1, 6, '7', '76000.00', '2020-03-23 02:54:36'),
(2, 6, '8', '294000.00', '2020-03-23 10:04:50');
-- --------------------------------------------------------
--
-- Table structure for table `userprofile`
--
CREATE TABLE `userprofile` (
`_id` int(11) UNSIGNED NOT NULL,
`id_user` int(11) UNSIGNED NOT NULL,
`fullname` varchar(70) DEFAULT NULL,
`email` varchar(40) DEFAULT NULL,
`code_verify` varchar(60) DEFAULT NULL,
`balance` decimal(10,2) UNSIGNED DEFAULT '0.00',
`gender` enum('male','female','other') DEFAULT NULL,
`address` text,
`picture` text,
`created_at` datetime DEFAULT CURRENT_TIMESTAMP,
`updated_at` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `userprofile`
--
INSERT INTO `userprofile` (`_id`, `id_user`, `fullname`, `email`, `code_verify`, `balance`, `gender`, `address`, `picture`, `created_at`, `updated_at`) VALUES
(3, 3, 'Treido Alde Ristivan', 'ristivantreido@gmail.com', NULL, '20011.00', 'male', 'Jl. Kramat 5 No.1 kel, RT.5/RW.9, Kenari, Kec. Senen, Kota Jakarta Pusat, Daerah Khusus Ibukota Jakarta 10430', 'uploads/1584904544137.jpeg', '2020-03-15 19:11:18', '2020-03-23 02:15:44'),
(4, 4, 'Treido alde ristivan', 'ristivantreido@gmail.com', NULL, '0.00', 'male', 'Jl. Kramat 5 No.1 kel, RT.5/RW.9, Kenari, Kec. Senen, Kota Jakarta Pusat, Daerah Khusus Ibukota Jakarta 10430', 'uploads/1584908417364.jpeg', '2020-03-15 21:31:10', '2020-03-23 03:20:17'),
(5, 5, NULL, 'ristivantreido@gmail.com', NULL, '9850000.00', NULL, NULL, NULL, '2020-03-16 10:38:33', '2020-03-22 21:46:27'),
(6, 6, 'Treido ', 'ristivantreido@gmail.com', NULL, '9478000.00', 'male', 'Jl. Kramat 5 No.1 kel, RT.5/RW.9, Kenari, Kec. Senen, Kota Jakarta Pusat, Daerah Khusus Ibukota Jakarta 10430', 'uploads/1584932757361.png', '2020-03-16 15:09:44', '2020-03-23 10:05:57'),
(7, 7, NULL, 'ristivantreido@gmail.com', NULL, '0.00', NULL, NULL, NULL, '2020-03-21 15:08:13', '2020-03-21 15:09:22');
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
CREATE TABLE `users` (
`_id` int(11) UNSIGNED NOT NULL,
`username` varchar(40) NOT NULL,
`password` varchar(100) NOT NULL,
`status` tinyint(1) DEFAULT '0',
`is_admin` tinyint(1) DEFAULT '0',
`is_superadmin` tinyint(1) DEFAULT '0',
`created_at` datetime DEFAULT CURRENT_TIMESTAMP,
`updated_at` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `users`
--
INSERT INTO `users` (`_id`, `username`, `password`, `status`, `is_admin`, `is_superadmin`, `created_at`, `updated_at`) VALUES
(3, 'treido2', '$2a$10$zSO.XHDZ87VQQfADkgQE1Ow9V/h.DjmlhSqT6LwUwcGHe4H7otK3C', 1, 1, 0, '2020-03-15 19:11:18', '2020-03-22 22:50:41'),
(4, 'treido1', '$2a$10$JSbEYrDVZUD0vei6lvmJ4eohsuWorULBJVUTXhyQToGvdzE28gqFS', 1, 0, 1, '2020-03-15 21:31:10', '2020-03-15 21:40:03'),
(5, 'treido3', '$2a$10$kUFFegBai8xpZGzzmkiOauWeI8RI2b6pr.vWm/Ql/i37Pqn835j22', 1, 1, 0, '2020-03-16 10:38:33', '2020-03-16 15:57:39'),
(6, 'treido4', '$2a$10$jP.pdnyRRWwSt/9fr4hH4.uJbhNjeUPNAhYYD7oyTbeUuKOownN8C', 1, 0, 0, '2020-03-16 15:09:44', '2020-03-22 23:04:58'),
(7, 'treido5', '$2a$10$hWhHhzfpKpB8OVX8xk1sA.w1rN.8hKGf.XgMAcUeg/YgJVUDjexhO', 1, 0, 0, '2020-03-21 15:08:13', '2020-03-21 15:09:21');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `carts`
--
ALTER TABLE `carts`
ADD PRIMARY KEY (`_id`),
ADD KEY `FK_User_Cart` (`id_user`);
--
-- Indexes for table `itemcategories`
--
ALTER TABLE `itemcategories`
ADD PRIMARY KEY (`_id`);
--
-- Indexes for table `itemreviews`
--
ALTER TABLE `itemreviews`
ADD PRIMARY KEY (`_id`),
ADD KEY `FK_User_Review` (`id_user`),
ADD KEY `FK_Item_Review` (`id_item`);
--
-- Indexes for table `items`
--
ALTER TABLE `items`
ADD PRIMARY KEY (`_id`),
ADD KEY `FK_Restaurant` (`id_restaurant`),
ADD KEY `FK_Category` (`id_category`);
--
-- Indexes for table `restaurants`
--
ALTER TABLE `restaurants`
ADD PRIMARY KEY (`_id`),
ADD KEY `FK_Owner` (`id_owner`);
--
-- Indexes for table `transactions`
--
ALTER TABLE `transactions`
ADD PRIMARY KEY (`_id`);
--
-- Indexes for table `userprofile`
--
ALTER TABLE `userprofile`
ADD PRIMARY KEY (`_id`),
ADD KEY `FK_User` (`id_user`);
--
-- Indexes for table `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`_id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `carts`
--
ALTER TABLE `carts`
MODIFY `_id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;
--
-- AUTO_INCREMENT for table `itemcategories`
--
ALTER TABLE `itemcategories`
MODIFY `_id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11;
--
-- AUTO_INCREMENT for table `itemreviews`
--
ALTER TABLE `itemreviews`
MODIFY `_id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `items`
--
ALTER TABLE `items`
MODIFY `_id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=19;
--
-- AUTO_INCREMENT for table `restaurants`
--
ALTER TABLE `restaurants`
MODIFY `_id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=14;
--
-- AUTO_INCREMENT for table `transactions`
--
ALTER TABLE `transactions`
MODIFY `_id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `userprofile`
--
ALTER TABLE `userprofile`
MODIFY `_id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;
--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
MODIFY `_id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `carts`
--
ALTER TABLE `carts`
ADD CONSTRAINT `FK_User_Cart` FOREIGN KEY (`id_user`) REFERENCES `users` (`_id`) ON DELETE CASCADE;
--
-- Constraints for table `itemreviews`
--
ALTER TABLE `itemreviews`
ADD CONSTRAINT `FK_Item_Review` FOREIGN KEY (`id_item`) REFERENCES `items` (`_id`) ON DELETE SET NULL,
ADD CONSTRAINT `FK_User_Review` FOREIGN KEY (`id_user`) REFERENCES `users` (`_id`) ON DELETE SET NULL;
--
-- Constraints for table `items`
--
ALTER TABLE `items`
ADD CONSTRAINT `FK_Category` FOREIGN KEY (`id_category`) REFERENCES `itemcategories` (`_id`) ON DELETE SET NULL,
ADD CONSTRAINT `FK_Restaurant` FOREIGN KEY (`id_restaurant`) REFERENCES `restaurants` (`_id`) ON DELETE CASCADE;
--
-- Constraints for table `restaurants`
--
ALTER TABLE `restaurants`
ADD CONSTRAINT `FK_Owner` FOREIGN KEY (`id_owner`) REFERENCES `users` (`_id`) ON DELETE CASCADE;
--
-- Constraints for table `userprofile`
--
ALTER TABLE `userprofile`
ADD CONSTRAINT `FK_User` FOREIGN KEY (`id_user`) REFERENCES `users` (`_id`) ON DELETE CASCADE;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
update DB_PROFILE_DATA2.dbo.TB_IMAGEM
set IMG_CAMINHO_ARQUIVO = '\\tbswww30\FILES\DROGASIL\'+ ltrim(rtrim(b.Diretorio))+'\',
IMG_URL_ARQUIVO = 'http://tbswww30/FILES/DROGASIL/imagem/'+ SUBSTRING(ltrim(rtrim(b.Diretorio)), 1, 6)+'/'+ SUBSTRING(ltrim(rtrim(b.Diretorio)),8,6) +'/',
IMG_FLAG_STATUS = 'A',
IMG_NOME_ARQUIVO = ltrim(rtrim(b.nome_img))+'.tif'
--set DB_PROFILE_DATA2.dbo.TB_IMAGEM.IMG_CAMINHO_ARQUIVO = '\\tbsfs02.interfile.com.br\IMG2\BS\RHDROGASIL\imagem\'+ SUBSTRING(IMG_CAMINHO_ARQUIVO, 1, 6)+'\'+ SUBSTRING(IMG_CAMINHO_ARQUIVO, 7, 6)+'\'
from DB_PROFILE_DATA2.dbo.TB_IMAGEM a, TOTAL_DROGASIL.dbo.Imagem b
where a.IMG_MODELO_SCANNER = b.Imagem_id
and b.Diretorio like '2001%'
|
create database employee;
use employee;
|
CREATE OR REPLACE PROCEDURE "AddPatientRecommendation" (
"observationSpecName" IN VARCHAR2,
"frequencyName" IN VARCHAR2,
"threshold" IN INTEGER,
"patientSSN" IN VARCHAR2,
"recommendationId" OUT INTEGER)
AS
BEGIN
"AddGeneralRecommendation" ("observationSpecName",
"frequencyName",
"threshold",
"recommendationId");
INSERT INTO RECOMMENDATIONFORPATIENT (RECOMMENDATIONID, PATIENTSSN)
VALUES ("recommendationId", "patientSSN");
END;
/
|
/*Retrieve customer information (all fields) where customer_id is 20*/
USE sakila;
SELECT * FROM customer WHERE customer_id = 20;
/*Retrieve customer information (all fields) where customer_id is BETWEEN 20 and 60*/
USE sakila;
SELECT * FROM customer WHERE customer_id BETWEEN 20 AND 60;
/*Retrieve customer information (all fields) WHERE first_name starts with L*/
USE sakila;
SELECT * FROM customer WHERE first_name LIKE 'L%';
/*Retrieve customer information (all fields) WHERE first_name includes L.*/
USE sakila;
SELECT * FROM customer WHERE first_name LIKE '%L%';
/*Retrieve customer information (all fields) WHERE first_name ends with L.*/
USE sakila;
SELECT * FROM customer WHERE first_name LIKE '%L';
/*Retrieve customer information (all fields) WHERE last_name starts with C and have the results be shown, starting with the record where it was created most recently.*/
USE sakila;
SELECT * FROM customer WHERE last_name LIKE 'C%' ORDER BY create_date;
/*Retrieve customer information (all fields) WHERE last_name includes NN. Only have it retrieve the top 5 records, where the first record shown is the oldest customer (in terms of the create_date)*/
USE sakila;
SELECT * FROM customer WHERE last_name LIKE '%NN%' ORDER BY create_date DESC LIMIT 5;
/*Retrieve customer information (customer_id, first_name, last_name, and email address only) for customers with the following customer_id 515, 181, 582, 503, 29, 85.*/
USE sakila;
SELECT customer_id, first_name, last_name, email FROM customer WHERE customer_id IN (515, 181, 582, 503, 29, 85);
/*Retrieve customer information where store_id is 2. Now when displaying the columns, instead of the column name be 'email', have it appear as 'email_address'.*/
USE sakila;
SELECT *, email AS email_Address FROM customer WHERE store_id =2;
/*Retrieve customer information (only the first_name, last_name, and email) but order the result with the email address in the DESC order.*/
USE sakila;
SELECT first_name, last_name, email FROM customer ORDER BY email DESC;
/*Retrieve only 'active' customer information (only the customer_id, first_name, last_name, and email) and where their record was created in the month of February.*/
USE sakila;
SELECT customer_id, first_name, last_name, email FROM customer WHERE MONTH(create_date) = 2;
/*Retrieve customer records (email field as well as email_length field) where the customer with the longest email address is shown first. If customers have the same length of email address, order the list by the email field in the ASC order (meaning it shows email address that starts with 'A' first).*/
USE sakila;
SELECT email, LENGTH(email) AS email_length FROM customer;
/*Now retrieve top 100 customer records with the shortest email address.*/
USE sakila;
SELECT * FROM customer ORDER BY LENGTH(email) ASC LIMIT 100;
|
-- phpMyAdmin SQL Dump
-- version 4.7.0
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Apr 03, 2018 at 09:17 AM
-- Server version: 10.1.25-MariaDB
-- PHP Version: 7.1.7
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: `gamebytes`
--
-- --------------------------------------------------------
--
-- Table structure for table `bookings`
--
CREATE TABLE `bookings` (
`bk_id` varchar(8) NOT NULL,
`id` varchar(8) DEFAULT NULL,
`g_id` varchar(8) DEFAULT NULL,
`l_id` varchar(8) DEFAULT NULL,
`book_date` date DEFAULT NULL,
`book_timestart` varchar(4) DEFAULT NULL,
`book_timeend` varchar(4) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `center_manager`
--
CREATE TABLE `center_manager` (
`cm_id` varchar(8) NOT NULL,
`cm_fname` varchar(20) DEFAULT NULL,
`cm_lname` varchar(20) DEFAULT NULL,
`cm_phno` varchar(10) DEFAULT NULL,
`l_id` varchar(8) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `center_manager`
--
INSERT INTO `center_manager` (`cm_id`, `cm_fname`, `cm_lname`, `cm_phno`, `l_id`) VALUES
('GBA8Y7', 'Akeem', 'Gutierrez', '7913936703', 'L07'),
('GBC2S5', 'Duncan', 'Stewart', '3038621209', 'L01'),
('GBD0V4', 'Dai', 'Duran', '6488226017', 'L15'),
('GBD2A5', 'Victor', 'Sanchez', '9887866545', 'L25'),
('GBG2P9', 'Mariam', 'Adams', '9539842876', 'L12'),
('GBH2D0', 'Keane', 'Figueroa', '9582635303', 'L04'),
('GBH9P1', 'Cedric', 'French', '7027279637', 'L03'),
('GBJ9C7', 'Jada', 'Brock', '9783493205', 'L06'),
('GBK5V4', 'Harper', 'Summers', '7276037731', 'L18'),
('GBK8A7', 'Wyatt', 'Miranda', '2951835286', 'L10'),
('GBL8I1', 'Brooke', 'Hansen', '6816529903', 'L16'),
('GBN6K1', 'Hilary', 'Parrish', '3803191567', 'L20'),
('GBO4X5', 'Tanya', 'Page', '5795695319', 'L17'),
('GBQ4H4', 'Amena', 'Jackson', '2798665658', 'L09'),
('GBS0S4', 'Macey', 'Wooten', '3568648077', 'L13'),
('GBS8G2', 'Isaiah', 'Stark', '7472799484', 'L14'),
('GBT0M5', 'Yvonne', 'Richards', '7895213350', 'L02'),
('GBT9F9', 'Jarrod', 'Houston', '7463668807', 'L05'),
('GBU1M2', 'Priscilla', 'Stanley', '1596673352', 'L08'),
('GBW5X5', 'Avye', 'Barnes', '4236153784', 'L23'),
('GBY1L0', 'Callum', 'Potts', '3122483563', 'L22'),
('GBY2H6', 'Boris', 'Cantu', '2545412091', 'L24'),
('GBY5U0', 'Christine', 'Patton', '2622690049', 'L19'),
('GBY7Q2', 'Briar', 'Wiggins', '4223399371', 'L21'),
('GBZ1R8', 'Remedios', 'Gross', '8713860810', 'L11');
-- --------------------------------------------------------
--
-- Table structure for table `console`
--
CREATE TABLE `console` (
`c_id` varchar(8) NOT NULL,
`c_name` varchar(20) DEFAULT NULL,
`c_release` decimal(4,0) DEFAULT NULL,
`c_href` varchar(30) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `console`
--
INSERT INTO `console` (`c_id`, `c_name`, `c_release`, `c_href`) VALUES
('PC', 'Desktop', '1990', ''),
('PS3', 'Play Station 3', '2006', ''),
('PS4', 'Play Station 4', '2013', ''),
('Wii', 'Wii', '2006', ''),
('X1', 'Xbox One', '2013', ''),
('X360', 'Xbox 360', '2005', '');
-- --------------------------------------------------------
--
-- Table structure for table `game`
--
CREATE TABLE `game` (
`g_id` varchar(8) NOT NULL,
`g_name` varchar(30) DEFAULT NULL,
`g_publisher` varchar(20) DEFAULT NULL,
`g_price` decimal(4,0) DEFAULT NULL,
`g_href` varchar(30) DEFAULT NULL,
`g_release` decimal(4,0) DEFAULT NULL,
`r_id` varchar(8) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `game`
--
INSERT INTO `game` (`g_id`, `g_name`, `g_publisher`, `g_price`, `g_href`, `g_release`, `r_id`) VALUES
('BF1', 'Battlefield 1', 'Electronic Arts', '100', '', '2017', '18'),
('BF4', 'Battlefield 4', 'Electronic Arts', '30', '', '2013', '18'),
('BFH', 'Battlefield: Hardline', 'Electronic Arts', '50', '', '2015', '16'),
('CODBO', 'Call Of Duty: Black Ops', 'Ubisoft', '70', '', '2010', '18'),
('CODBO2', 'Call Of Duty: Black Ops 2', 'Ubisoft', '100', '', '2016', '18'),
('CODG', 'Call Of Duty: Ghosts', 'Ubisoft', '100', '', '2018', '12'),
('CODMW1', 'Call Of Duty: Modern Warfare 1', 'Ubisoft', '20', '', '2007', '16'),
('CODMW2', 'Call Of Duty: Modern Warfare 2', 'Ubisoft', '50', '', '2008', '16'),
('CODMW3', 'Call Of Duty: Modern Warfare 3', 'Ubisoft', '70', '', '2013', '18'),
('CODWW', 'Call Of Duty: World War', 'Ubisoft', '100', '', '2014', '18'),
('CS1.6', 'Counter Strike 1.6', 'Ubisoft', '30', '', '2006', '18'),
('CSGO', 'Counter Strike: Global Offensi', 'Ubisoft', '70', '', '2010', '18'),
('F15', 'Fifa 15', 'Electronic Arts', '30', '', '2014', '3'),
('F16', 'Fifa 16', 'Electronic Arts', '50', '', '2015', '3'),
('F17', 'Fifa 17', 'Electronic Arts', '70', '', '2016', '3'),
('F18', 'Fifa 18', 'Electronic Arts', '100', '', '2017', '3'),
('NFL17', 'NFL 2017', 'Electronic Arts', '50', '', '2016', '3'),
('NFL18', 'NFL 2018', 'Electronic Arts', '70', '', '2017', '3'),
('NFSMW', 'Need For Speed: Most Wanted', 'Electronic Arts', '50', '', '2012', '7'),
('NFSPB', 'Need For Speed: Payback', 'Electronic Arts', '100', '', '2017', '7'),
('TF', 'Titanfall', 'Electronic Arts', '50', '', '2014', '16'),
('UFC3', 'UFC 3', 'Electronic Arts', '100', '', '2018', '12');
-- --------------------------------------------------------
--
-- Table structure for table `game_genre`
--
CREATE TABLE `game_genre` (
`g_id` varchar(8) NOT NULL,
`genre_id` varchar(8) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `game_genre`
--
INSERT INTO `game_genre` (`g_id`, `genre_id`) VALUES
('BF1', 'Act'),
('BF1', 'Adv'),
('BF4', 'Act'),
('BF4', 'Adv'),
('BFH', 'Act'),
('BFH', 'Sim'),
('CODBO', 'Act'),
('CODBO', 'FPS'),
('CODBO', 'RPG'),
('CODBO2', 'Act'),
('CODBO2', 'FPS'),
('CODBO2', 'RPG'),
('CODG', 'Act'),
('CODG', 'FPS'),
('CODG', 'Str'),
('CODMW1', 'Act'),
('CODMW1', 'FPS'),
('CODMW1', 'Str'),
('CODMW2', 'Act'),
('CODMW2', 'FPS'),
('CODMW2', 'Str'),
('CODMW3', 'Act'),
('CODMW3', 'FPS'),
('CODMW3', 'Str'),
('CODWW', 'Act'),
('CODWW', 'FPS'),
('CODWW', 'Str'),
('CS1.6', 'FPS'),
('CS1.6', 'RPG'),
('CS1.6', 'Str'),
('CSGO', 'FPS'),
('CSGO', 'RPG'),
('CSGO', 'Str'),
('F15', 'RPG'),
('F15', 'Spo'),
('F16', 'RPG'),
('F16', 'Spo'),
('F17', 'RPG'),
('F17', 'Spo'),
('F18', 'RPG'),
('F18', 'Spo'),
('NFL17', 'RPG'),
('NFL17', 'Spo'),
('NFL18', 'RPG'),
('NFL18', 'Spo'),
('NFSMW', 'Adv'),
('NFSMW', 'Rac'),
('NFSPB', 'Adv'),
('NFSPB', 'Rac'),
('TF', 'Adv'),
('TF', 'Sim'),
('UFC3', 'Act'),
('UFC3', 'Sim');
-- --------------------------------------------------------
--
-- Table structure for table `game_location`
--
CREATE TABLE `game_location` (
`g_id` varchar(8) NOT NULL,
`l_id` varchar(8) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `game_location`
--
INSERT INTO `game_location` (`g_id`, `l_id`) VALUES
('CODMW2', 'L14'),
('CODMW2', 'L16'),
('CODMW2', 'L24'),
('CODMW3', 'L04'),
('CODMW3', 'L05'),
('CODMW3', 'L09'),
('CODMW3', 'L10'),
('CODMW3', 'L12'),
('CODWW', 'L15'),
('CODWW', 'L16'),
('CODWW', 'L17'),
('CS1.6', 'L03'),
('CSGO', 'L01'),
('CSGO', 'L22'),
('F15', 'L03'),
('F15', 'L07'),
('F15', 'L09'),
('F15', 'L22'),
('F15', 'L23'),
('F16', 'L06'),
('F16', 'L07'),
('F16', 'L18'),
('F16', 'L24'),
('F17', 'L06'),
('F17', 'L09'),
('F17', 'L14'),
('F17', 'L21'),
('F18', 'L01'),
('F18', 'L08'),
('F18', 'L20'),
('F18', 'L21'),
('F18', 'L23'),
('F18', 'L24'),
('NFL17', 'L06'),
('NFL17', 'L18'),
('NFL17', 'L19'),
('NFL18', 'L03'),
('NFL18', 'L13'),
('NFSMW', 'L02'),
('NFSMW', 'L04'),
('NFSMW', 'L19'),
('NFSMW', 'L23'),
('NFSPB', 'L05'),
('NFSPB', 'L06'),
('NFSPB', 'L08'),
('NFSPB', 'L09'),
('NFSPB', 'L14'),
('NFSPB', 'L16'),
('NFSPB', 'L21'),
('TF', 'L06'),
('TF', 'L09'),
('TF', 'L14');
-- --------------------------------------------------------
--
-- Table structure for table `game_reviews`
--
CREATE TABLE `game_reviews` (
`g_r_title` varchar(20) DEFAULT NULL,
`g_r_review` varchar(50) DEFAULT NULL,
`g_r_stars` decimal(2,0) DEFAULT NULL,
`g_id` varchar(8) NOT NULL,
`m_id` varchar(8) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `game_reviews`
--
INSERT INTO `game_reviews` (`g_r_title`, `g_r_review`, `g_r_stars`, `g_id`, `m_id`) VALUES
('HIGHLY RECOMMENDED', 'a purus. Duis elementum, dui quis accumsan convall', '4', 'BF4', 'M08'),
('THE BEST', 'Nullam ut nisi a odio semper cursus. Integer molli', '1', 'CODBO', 'M14'),
('BAD', 'montes, nascetur ridiculus mus. Aenean eget magna.', '3', 'CODBO', 'M24'),
('SPECTACULAR', 'ut, pellentesque eget, dictum placerat, augue. Sed', '2', 'CODBO2', 'M04'),
('AMAZING', 'Ut tincidunt orci quis lectus. Nullam suscipit, es', '1', 'CODG', 'M08'),
('BEST GAME EVER', 'Proin vel arcu eu odio tristique pharetra. Quisque', '4', 'CS1.6', 'M23'),
('AWFUL', 'fames ac turpis egestas. Aliquam fringilla cursus ', '1', 'F16', 'M13'),
('BEST GAME EVER', 'litora torquent per conubia nostra, per inceptos h', '2', 'F16', 'M23'),
('TERRIBLE', 'non, bibendum sed, est. Nunc laoreet lectus quis m', '4', 'F17', 'M13'),
('TERRIBLE', 'scelerisque scelerisque dui. Suspendisse ac metus ', '5', 'F17', 'M17'),
('MUST PLAY', 'luctus felis purus ac tellus. Suspendisse sed dolo', '4', 'F17', 'M24'),
('BAD', 'magna a tortor. Nunc commodo auctor velit. Aliquam', '3', 'F18', 'M01'),
('THE BEST', 'molestie dapibus ligula. Aliquam erat volutpat. Nu', '4', 'F18', 'M05'),
('HIGHLY RECOMMENDED', 'malesuada. Integer id magna et ipsum cursus vestib', '3', 'F18', 'M06'),
('TERRIBLE', 'auctor, velit eget laoreet posuere, enim nisl elem', '3', 'NFL17', 'M01'),
('THE BEST', 'morbi tristique senectus et netus et malesuada fam', '3', 'NFL17', 'M24'),
('HIGHLY RECOMMENDED', 'a, dui. Cras pellentesque. Sed dictum. Proin eget ', '1', 'NFL18', 'M03'),
('MUST PLAY', 'pede, nonummy ut, molestie in, tempus eu, ligula. ', '3', 'NFSMW', 'M22'),
('BEST GAME EVER', 'amet ante. Vivamus non lorem vitae odio sagittis s', '5', 'NFSPB', 'M10'),
('SPECTACULAR', 'sit amet, dapibus id, blandit at, nisi. Cum sociis', '1', 'NFSPB', 'M13'),
('MUST PLAY', 'quis, pede. Praesent eu dui. Cum sociis natoque pe', '5', 'TF', 'M03');
-- --------------------------------------------------------
--
-- Table structure for table `genre`
--
CREATE TABLE `genre` (
`genre_id` varchar(8) NOT NULL,
`genre_name` varchar(20) DEFAULT NULL,
`genre_desc` varchar(200) DEFAULT NULL,
`genre_href` varchar(30) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `genre`
--
INSERT INTO `genre` (`genre_id`, `genre_name`, `genre_desc`, `genre_href`) VALUES
('Act', 'Action', 'Action games, as one of the most popular ones currently, provide a great deal of fun for those who do not necessarily need a great story within the game.', ''),
('Adv', 'Adventure', 'These games require you to think before you make a decision that may change the entire course of the game. For those who find enjoyment in playing particular stories this is a genre to try out.', ''),
('FPS', 'FPS', 'First-person shooter (FPS) is a video game genre centered around gun and other weapon-based combat in a first-person perspective; that is, the player experiences the action through the eyes of the pro', ''),
('Rac', 'Racing', 'The racing video game genre is the genre of video games, either in the first-person or third-person perspective, in which the player partakes in a racing competition with any type of land, water, air ', ''),
('RPG', 'RPG', 'RPG is a genre in which player takes control over the character, plays the role, and simply decides its fate. It also involves the growth of the character that is played and allows character customiza', ''),
('Sim', 'Simulators', 'The aim of those games is to simulate specific aspect of real world. And believe me when I say it – there is a simulator game to absolutely everything!', ''),
('Spo', 'Sports', 'Everybody loves a dose of sports games. Whether it’s football, basketball or racing, everyone can find something for themselves. Their aim is to simulate real sports.', ''),
('Str', 'Strategy', 'Strategy video game is a video game that focuses on skillful thinking and planning to achieve victory. It emphasizes strategic, tactical, and sometimes logistical challenges.', '');
-- --------------------------------------------------------
--
-- Table structure for table `guest`
--
CREATE TABLE `guest` (
`guest_id` varchar(8) NOT NULL,
`guest_phno` varchar(10) DEFAULT NULL,
`guest_fname` varchar(20) DEFAULT NULL,
`guest_lname` varchar(20) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `guest`
--
INSERT INTO `guest` (`guest_id`, `guest_phno`, `guest_fname`, `guest_lname`) VALUES
('16010524', '7637403807', 'Jena', 'Tran'),
('16060725', '3693612629', 'Irma', 'Hutchinson'),
('16090627', '8859453364', 'Dieter', 'Barlow'),
('16150603', '8485317520', 'Oprah', 'Elliott'),
('16160418', '7571087710', 'Price', 'Henson'),
('16170628', '4178184439', 'Barrett', 'Bradford'),
('16230809', '7297006414', 'Carly', 'Warren'),
('16361101', '6999852919', 'Colt', 'Reynolds'),
('16410722', '9935525803', 'Sylvester', 'Hamilton'),
('16411217', '8567273062', 'Scott', 'Navarro'),
('16451016', '3242009528', 'Montana', 'Wolf'),
('16500506', '9629826971', 'Kirk', 'Day'),
('16510111', '0699056299', 'Adam', 'Ayers'),
('16510820', '8333112118', 'Jasmine', 'Norman'),
('16530311', '1927175402', 'Adena', 'Sargent'),
('16540914', '4023667549', 'Erin', 'Deleon'),
('16550313', '4759556366', 'Brianna', 'Goff'),
('16580320', '8374670438', 'Raphael', 'Mccullough'),
('16580924', '2346625224', 'Lareina', 'Morton'),
('16720226', '7628343404', 'William', 'Keller'),
('16740702', '7765717257', 'Colin', 'Ellis'),
('16740714', '7354936999', 'Sebastian', 'York'),
('16830608', '2296087179', 'Bert', 'Stevens'),
('16830627', '5058784289', 'Sacha', 'Finch'),
('16851121', '9021718392', 'Bruce', 'Maddox'),
('16861206', '4570629459', 'Lionel', 'Charles'),
('16870720', '9484248768', 'Nasim', 'Gardner'),
('16950714', '3199362494', 'Keith', 'Boyle'),
('16951123', '4209070568', 'Kathleen', 'Henry'),
('16951223', '2970349546', 'Gareth', 'Griffith');
-- --------------------------------------------------------
--
-- Table structure for table `leaderboard`
--
CREATE TABLE `leaderboard` (
`m_id` varchar(8) DEFAULT NULL,
`g_id` varchar(8) NOT NULL,
`points` decimal(5,0) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `location`
--
CREATE TABLE `location` (
`l_id` varchar(8) NOT NULL,
`l_name` varchar(10) DEFAULT NULL,
`l_address` varchar(50) DEFAULT NULL,
`l_areacode` varchar(6) DEFAULT NULL,
`l_href` varchar(30) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `location`
--
INSERT INTO `location` (`l_id`, `l_name`, `l_address`, `l_areacode`, `l_href`) VALUES
('L01', 'Rogue Game', '14, 2nd B Main, 2nd Stage, Peenya', '560011', ''),
('L02', 'Karma Game', '483, 3, Beml Layt, Rajarajeshwari Nagar', '560001', ''),
('L03', 'Abacus Gam', '6, M S Ramarah Industrial Estate, Mathikere', '560054', ''),
('L04', 'The Vineya', '10, 2 A Cross, 1st Main, 1st Stage, Baseveshwara N', '560079', ''),
('L05', 'Nova Games', '71/7, Kanakapura Main Road, Jaraganahalli, JP Naga', '560078', ''),
('L06', 'The Sapphi', '4, Edgha Bld, B S A Road, Tannery Road', '560005', ''),
('L07', 'The Polar ', '217, 27th Cross, Opp Post Office, Jayanagar', '560011', ''),
('L08', 'The Galler', '63/4, 10th Main, 4th Block, Jayanagar', '560011', ''),
('L09', 'The Silver', 'Block B-2, B B Road,allasandra, Yelahanka', '560065', ''),
('L10', 'The French', '827/6, 827/6 Ramamurthyngrmnrd Bglr-43, Ramamurthy', '560033', ''),
('L11', 'Fire n Ice', '39/c, K R Road, Near Cauvery Ford, Yelachenahalli', '560078', ''),
('L12', 'Ivy Games', '127/2, 4 Main Rajajinagar Indl Town, Near Hyundai ', '560044', ''),
('L13', 'The Tower ', 'Hesraghata, Near Ammaji Kalana Matapa, Hessaraghat', '560088', ''),
('L14', 'Purity Gam', '13/20, New Galic Complex, Apmc Yard, Yeshwanthpur', '560012', ''),
('L15', 'Sunset Gam', '16, NGV, Koramangla', '560014', ''),
('L16', 'The Brimst', '100/1, Arabic College Mn Rd, Opp Bilal Cplx, Venka', '560011', ''),
('L17', 'The Origin', '31, 4th Main, Chamarajpet', '560018', ''),
('L18', 'The Cool C', '11, 5th Main Road, Indiranagar', '560071', ''),
('L19', 'City Plaza', '#22, 12th Main, Indiranagar', '560055', ''),
('L20', 'The Pepper', '#3, Puttenhalli, JP Nagar', '560078', ''),
('L21', 'Basil Game', '75, 6th Cross, RR Nagar', '560071', ''),
('L22', 'The Empero', '654/3d, Thangiamma Rd, R S Palya, Kanakapura', '560011', ''),
('L23', 'Starlight ', 'Hotelmaurya, Race Course Road', '560089', ''),
('L24', 'The Lamb G', '28/29, Mallasandra', '560007', ''),
('L25', 'Shambles G', '9, GC Esquire Center, MG Road', '560001', '');
-- --------------------------------------------------------
--
-- Table structure for table `location_reviews`
--
CREATE TABLE `location_reviews` (
`l_r_title` varchar(20) DEFAULT NULL,
`l_r_review` varchar(50) DEFAULT NULL,
`l_r_stars` decimal(2,0) DEFAULT NULL,
`l_id` varchar(8) NOT NULL,
`m_id` varchar(8) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `location_reviews`
--
INSERT INTO `location_reviews` (`l_r_title`, `l_r_review`, `l_r_stars`, `l_id`, `m_id`) VALUES
('AMBIANCE ON POINT ', 'libero. Donec consectetuer mauris id sapien. Cras ', '3', 'L01', 'M11'),
('SPECTACULAR', 'massa lobortis ultrices. Vivamus rhoncus. Donec es', '4', 'L04', 'M08'),
('AMBIANCE ON POINT ', 'nascetur ridiculus mus. Proin vel arcu eu odio tri', '1', 'L04', 'M10'),
('AMAZING', 'aliquet molestie tellus. Aenean egestas hendrerit ', '8', 'L04', 'M12'),
('SPECTACULAR', 'mi. Aliquam gravida mauris ut mi. Duis risus odio,', '10', 'L05', 'M04'),
('AWFUL', 'eros. Proin ultrices. Duis volutpat nunc sit amet ', '7', 'L05', 'M09'),
('GOOD', 'imperdiet, erat nonummy ultricies ornare, elit eli', '3', 'L05', 'M18'),
('HIGHLY RECOMMENDED', 'dictum mi, ac mattis velit justo nec ante. Maecena', '1', 'L07', 'M07'),
('BAD', 'orci. Ut sagittis lobortis mauris. Suspendisse ali', '4', 'L07', 'M09'),
('HIGHLY RECOMMENDED', 'urna suscipit nonummy. Fusce fermentum fermentum a', '8', 'L08', 'M05'),
('TERRIBLE', 'at, egestas a, scelerisque sed, sapien. Nunc pulvi', '7', 'L08', 'M13'),
('HIGHLY RECOMMENDED', 'tempus scelerisque, lorem ipsum sodales purus, in ', '5', 'L08', 'M24'),
('TERRIBLE', 'fermentum risus, at fringilla purus mauris a nunc.', '8', 'L10', 'M10'),
('AMAZING', 'vestibulum lorem, sit amet ultricies sem magna nec', '7', 'L10', 'M17'),
('BAD', 'pharetra. Quisque ac libero nec ligula consectetue', '5', 'L11', 'M23'),
('AWFUL', 'euismod est arcu ac orci. Ut semper pretium neque.', '9', 'L12', 'M17'),
('BEST', 'natoque penatibus et magnis dis parturient montes,', '10', 'L13', 'M05'),
('AWFUL', 'orci lacus vestibulum lorem, sit amet ultricies se', '7', 'L15', 'M07'),
('AWFUL', 'a, scelerisque sed, sapien. Nunc pulvinar arcu et ', '3', 'L16', 'M01'),
('HIGHLY RECOMMENDED', 'ac sem ut dolor dapibus gravida. Aliquam tincidunt', '3', 'L16', 'M06'),
('AMBIANCE ON POINT ', 'nunc id enim. Curabitur massa. Vestibulum accumsan', '2', 'L16', 'M13'),
('AMBIANCE ON POINT ', 'turpis. Aliquam adipiscing lobortis risus. In mi p', '10', 'L17', 'M15'),
('AMBIANCE ON POINT ', 'vel est tempor bibendum. Donec felis orci, adipisc', '2', 'L18', 'M10'),
('AWFUL', 'Donec elementum, lorem ut aliquam iaculis, lacus p', '8', 'L18', 'M16'),
('AWFUL', 'dui, in sodales elit erat vitae risus. Duis a mi', '10', 'L19', 'M14'),
('AWFUL', 'urna. Nullam lobortis quam a felis ullamcorper viv', '4', 'L20', 'M13'),
('AMBIANCE ON POINT ', 'dictum eu, placerat eget, venenatis a, magna. Lore', '5', 'L20', 'M19'),
('GOOD', 'porttitor tellus non magna. Nam ligula elit, preti', '9', 'L21', 'M13'),
('HIGHLY RECOMMENDED', 'gravida non, sollicitudin a, malesuada id, erat. E', '1', 'L23', 'M08'),
('HIGHLY RECOMMENDED', 'nibh. Phasellus nulla. Integer vulputate, risus a ', '7', 'L24', 'M03');
-- --------------------------------------------------------
--
-- Table structure for table `member`
--
CREATE TABLE `member` (
`m_id` varchar(8) NOT NULL,
`m_password` varchar(50) NOT NULL,
`m_phno` varchar(10) DEFAULT NULL,
`m_fname` varchar(20) DEFAULT NULL,
`m_lname` varchar(20) DEFAULT NULL,
`m_address` varchar(100) DEFAULT NULL,
`m_startdate` date DEFAULT NULL,
`m_enddate` date DEFAULT NULL,
`m_href` varchar(30) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `member`
--
INSERT INTO `member` (`m_id`, `m_password`, `m_phno`, `m_fname`, `m_lname`, `m_address`, `m_startdate`, `m_enddate`, `m_href`) VALUES
('M01', 'hello123', '9035239025', 'Aditya', 'Pandey', 'JP Nagar', '2018-02-01', '2019-02-01', ''),
('M02', 'hello123', '9090112215', 'Aditya', 'Pandey', 'Banashankari', '2018-02-01', '2019-02-01', ''),
('M03', 'hello123', '9035232335', 'Aditya', 'Pandey', 'JP Nagar', '2018-02-01', '2019-02-01', ''),
('M04', 'hello123', '9217800826', 'Danika', 'Unruh', 'JP Nagar', '2018-01-17', '2019-01-17', ''),
('M05', 'hello123', '9337800826', 'Carolyne', 'Durrant', 'Jaya Nagar', '2018-01-17', '2019-01-17', ''),
('M06', 'hello123', '9314800826', 'Rupert', 'Sande', 'RR Nagar', '2018-01-17', '2019-01-17', ''),
('M07', 'hello123', '9314470826', 'Theodore', 'Grego', 'RR Nagar', '2018-01-17', '2019-01-17', ''),
('M08', 'hello123', '9317888826', 'Akilah', 'Rozar', 'RT Nagar', '2018-01-17', '2019-01-17', ''),
('M09', 'hello123', '9317801216', 'Corina', 'Griffy', 'BG Road', '2018-01-17', '2019-01-17', ''),
('M10', 'hello123', '9111822826', 'Liberty', 'Shepard', 'Jaya Nagar', '2018-01-17', '2019-01-17', ''),
('M11', 'hello123', '8277803826', 'Kathel', 'Dalzell', 'RT Nagar', '2018-01-17', '2019-01-17', ''),
('M12', 'hello123', '9112300827', 'Maegan', 'Loth', 'Kanakapura', '2018-01-17', '2019-01-17', ''),
('M13', 'hello123', '9317812323', 'Erasmo', 'Mendez', 'Koramangla', '2018-01-17', '2019-01-17', ''),
('M14', 'hello123', '9000200822', 'Abbie', 'Varnell', 'Banashankari', '2018-01-17', '2019-01-17', ''),
('M15', 'hello123', '9317833822', 'Mendy', 'Reagan', 'Koramangla', '2018-01-17', '2019-01-17', ''),
('M16', 'hello123', '9317823823', 'Domenica', 'Wellman', 'Kanakapura', '2018-01-17', '2019-01-17', ''),
('M17', 'hello123', '9317855822', 'Alta', 'Mclendon', 'RR Nagar', '2018-01-17', '2019-01-17', ''),
('M18', 'hello123', '9317854826', 'Eusebia', 'Henegar', 'Banashankari', '2018-01-17', '2019-01-17', ''),
('M19', 'hello123', '9317834827', 'Dot', 'Bolster', 'Indiranagar', '2018-01-17', '2019-01-17', ''),
('M20', 'hello123', '9317842825', 'Larae', 'Mccon', 'Kanakapura', '2018-01-17', '2019-01-17', ''),
('M21', 'hello123', '9317800826', 'Shemika', 'Janas', 'Indiranagar', '2018-01-17', '2019-01-17', ''),
('M22', 'hello123', '9317855524', 'Vasiliki', 'Quesada', 'JP Nagar', '2018-01-17', '2019-01-17', ''),
('M23', 'hello123', '9317800237', 'Era', 'Bohnert', 'Nagar', '2018-01-17', '2019-01-17', ''),
('M24', 'hello123', '9317240820', 'Jodee', 'Venema', 'JP Nagar', '2018-01-17', '2019-01-17', ''),
('M25', 'hello123', '9317990820', 'Kimberley', 'Cutlip', 'Indiranagar', '2018-01-17', '2019-01-17', ''),
('M26', 'hello123', '9317900877', 'Javier', 'Creager', 'Kanakapura', '2018-01-17', '2019-01-17', ''),
('M27', 'hello123', '9317910827', 'Frida', 'Castello', 'Kanakapura', '2018-01-17', '2019-01-17', ''),
('M28', 'hello123', '9317823825', 'Gail', 'Villalba', 'Banashankari', '2018-01-17', '2019-01-17', ''),
('M29', 'hello123', '9317834082', 'Myrle', 'Kimler', 'JP Nagar', '2018-01-17', '2019-01-17', ''),
('M30', 'hello123', '9317303421', 'Thersa', 'Mcdonald', 'Banashankari', '2018-01-17', '2019-01-17', ''),
('M31', 'hello123', '9317840826', 'Charmaine', 'Dupras', 'Kanakapura', '2018-01-17', '2019-01-17', ''),
('M32', 'hello123', '8886740831', 'Mikel', 'Weissinger', 'Banashankari', '2018-01-17', '2019-01-17', '');
-- --------------------------------------------------------
--
-- Table structure for table `pegi_rating`
--
CREATE TABLE `pegi_rating` (
`r_id` varchar(8) NOT NULL,
`r_name` varchar(50) DEFAULT NULL,
`r_reason` varchar(200) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `pegi_rating`
--
INSERT INTO `pegi_rating` (`r_id`, `r_name`, `r_reason`) VALUES
('12', 'Suitable for persons 12 and older.', 'Contains one or a combination of the following content(s): Bad Language, Violence, Sex, Gambling, Fear'),
('16', 'Suitable for persons 16 and older.', 'Contains one or a combination of the following content(s): Bad Language, Violence, Sex, Drugs, Gambling'),
('18', 'Suitable only for persons 18 and older.', 'Contains one or a combination of the following content(s): Bad Language, Violence, Sex, Drugs, Gambling'),
('3', 'Suitable for persons 3 and older.', 'Contains one or a combination of the following content(s): Online'),
('7', 'Suitable for persons 7 and older.', 'Contains one or a combination of the following content(s): Violence, Fear');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `bookings`
--
ALTER TABLE `bookings`
ADD PRIMARY KEY (`bk_id`),
ADD KEY `g_id` (`g_id`),
ADD KEY `l_id` (`l_id`),
ADD KEY `id` (`id`);
--
-- Indexes for table `center_manager`
--
ALTER TABLE `center_manager`
ADD PRIMARY KEY (`cm_id`,`l_id`),
ADD KEY `l_id` (`l_id`);
--
-- Indexes for table `console`
--
ALTER TABLE `console`
ADD PRIMARY KEY (`c_id`);
--
-- Indexes for table `game`
--
ALTER TABLE `game`
ADD PRIMARY KEY (`g_id`),
ADD KEY `r_id` (`r_id`);
--
-- Indexes for table `game_genre`
--
ALTER TABLE `game_genre`
ADD PRIMARY KEY (`g_id`,`genre_id`),
ADD KEY `genre_id` (`genre_id`);
--
-- Indexes for table `game_location`
--
ALTER TABLE `game_location`
ADD PRIMARY KEY (`g_id`,`l_id`),
ADD KEY `l_id` (`l_id`);
--
-- Indexes for table `game_reviews`
--
ALTER TABLE `game_reviews`
ADD PRIMARY KEY (`g_id`,`m_id`),
ADD KEY `m_id` (`m_id`);
--
-- Indexes for table `genre`
--
ALTER TABLE `genre`
ADD PRIMARY KEY (`genre_id`);
--
-- Indexes for table `guest`
--
ALTER TABLE `guest`
ADD PRIMARY KEY (`guest_id`);
--
-- Indexes for table `leaderboard`
--
ALTER TABLE `leaderboard`
ADD PRIMARY KEY (`g_id`),
ADD KEY `m_id` (`m_id`);
--
-- Indexes for table `location`
--
ALTER TABLE `location`
ADD PRIMARY KEY (`l_id`);
--
-- Indexes for table `location_reviews`
--
ALTER TABLE `location_reviews`
ADD PRIMARY KEY (`l_id`,`m_id`),
ADD KEY `m_id` (`m_id`);
--
-- Indexes for table `member`
--
ALTER TABLE `member`
ADD PRIMARY KEY (`m_id`);
--
-- Indexes for table `pegi_rating`
--
ALTER TABLE `pegi_rating`
ADD PRIMARY KEY (`r_id`);
--
-- Constraints for dumped tables
--
--
-- Constraints for table `bookings`
--
ALTER TABLE `bookings`
ADD CONSTRAINT `bookings_ibfk_1` FOREIGN KEY (`g_id`) REFERENCES `game` (`g_id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `bookings_ibfk_2` FOREIGN KEY (`l_id`) REFERENCES `location` (`l_id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `bookings_ibfk_3` FOREIGN KEY (`id`) REFERENCES `member` (`m_id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `center_manager`
--
ALTER TABLE `center_manager`
ADD CONSTRAINT `center_manager_ibfk_1` FOREIGN KEY (`l_id`) REFERENCES `location` (`l_id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `game`
--
ALTER TABLE `game`
ADD CONSTRAINT `game_ibfk_1` FOREIGN KEY (`r_id`) REFERENCES `pegi_rating` (`r_id`) ON DELETE SET NULL ON UPDATE CASCADE;
--
-- Constraints for table `game_genre`
--
ALTER TABLE `game_genre`
ADD CONSTRAINT `game_genre_ibfk_1` FOREIGN KEY (`g_id`) REFERENCES `game` (`g_id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `game_genre_ibfk_2` FOREIGN KEY (`genre_id`) REFERENCES `genre` (`genre_id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `game_location`
--
ALTER TABLE `game_location`
ADD CONSTRAINT `game_location_ibfk_1` FOREIGN KEY (`g_id`) REFERENCES `game` (`g_id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `game_location_ibfk_2` FOREIGN KEY (`l_id`) REFERENCES `location` (`l_id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `game_reviews`
--
ALTER TABLE `game_reviews`
ADD CONSTRAINT `game_reviews_ibfk_1` FOREIGN KEY (`g_id`) REFERENCES `game` (`g_id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `game_reviews_ibfk_2` FOREIGN KEY (`m_id`) REFERENCES `member` (`m_id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `leaderboard`
--
ALTER TABLE `leaderboard`
ADD CONSTRAINT `leaderboard_ibfk_1` FOREIGN KEY (`g_id`) REFERENCES `game` (`g_id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `leaderboard_ibfk_2` FOREIGN KEY (`m_id`) REFERENCES `member` (`m_id`) ON DELETE SET NULL ON UPDATE CASCADE;
--
-- Constraints for table `location_reviews`
--
ALTER TABLE `location_reviews`
ADD CONSTRAINT `location_reviews_ibfk_1` FOREIGN KEY (`l_id`) REFERENCES `location` (`l_id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `location_reviews_ibfk_2` FOREIGN KEY (`m_id`) REFERENCES `member` (`m_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 id FROM posts WHERE thread = ? ORDER BY id LIMIT 1 |
-- archived_log_hist_matrix.sql
-- acquired from Patricia Shea @
/*
values of 0 are normal at the beginning and as there is likely no data
DAY DOW 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23
------------ ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
2018-MAR-02 FRI 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 6 20 19 15 19 46 13
2018-MAR-03 SAT 16 14 22 18 13 12 14 22 14 14 15 18 14 14 14 16 15 15 17 19 79 81 45 13
2018-MAR-04 SUN 14 13 14 12 14 12 14 18 17 13 15 16 17 13 16 14 16 17 15 13 15 14 42 12
2018-MAR-05 MON 15 13 13 13 14 13 13 20 16 14 15 22 16 14 16 14 16 17 16 13 41 18 53 14
2018-MAR-06 TUE 15 17 27 17 13 12 14 22 16 13 24 24 17 14 16 13 17 24 32 28 15 20 54 14
2018-MAR-07 WED 18 26 19 12 14 12 13 20 19 17 19 23 17 15 16 15 16 18 22 27 26 35 61 19
2018-MAR-08 THU 23 22 21 13 13 12 15 21 22 17 16 23 17 15 18 15 18 22 54 27 16 19 15 14
2018-MAR-09 FRI 18 20 20 12 13 12 14 21 15 14 17 22 17 13 17 14 16 18 22 17 14 19 46 13
2018-MAR-10 SAT 16 12 14 20 15 12 14 21 13 13 16 18 14 13 14 13 15 14 18 14 14 16 19 27
2018-MAR-11 SUN 30 12 0 14 13 12 14 19 17 12 14 19 15 13 16 15 15 17 16 13 15 15 40 12
2018-MAR-12 MON 15 13 13 12 14 12 14 20 14 19 17 20 17 13 17 14 15 18 16 17 46 23 53 13
2018-MAR-13 TUE 16 19 26 15 13 12 14 22 25 21 20 23 17 14 18 15 17 28 27 30 17 22 53 15
2018-MAR-14 WED 16 21 18 12 14 12 14 22 16 13 17 24 17 14 17 14 15 18 19 24 28 35 66 18
2018-MAR-15 THU 19 15 14 22 15 12 13 22 15 13 17 23 17 13 17 13 16 18 21 16 14 18 30 34
2018-MAR-16 FRI 16 18 19 12 14 12 13 21 17 17 17 22 17 14 16 14 17 18 21 18 14 19 15 13
2018-MAR-17 SAT 16 16 23 12 14 12 14 21 13 12 16 20 16 12 15 13 15 9 0 0 0 0 0 0
16 rows selected.
0 in other locations would indicate no log switches and hence no archive logs
*/
set linesize 200 trimspool on
set pagesize 100
set tab off
col day format a12
col dow format a4
col 00 format a4 head ' 00'
col 01 format a4 head ' 01'
col 02 format a4 head ' 02'
col 03 format a4 head ' 03'
col 04 format a4 head ' 04'
col 05 format a4 head ' 05'
col 06 format a4 head ' 06'
col 07 format a4 head ' 07'
col 08 format a4 head ' 08'
col 09 format a4 head ' 09'
col 10 format a4 head ' 10'
col 11 format a4 head ' 11'
col 12 format a4 head ' 12'
col 13 format a4 head ' 13'
col 14 format a4 head ' 14'
col 15 format a4 head ' 15'
col 16 format a4 head ' 16'
col 17 format a4 head ' 17'
col 18 format a4 head ' 18'
col 19 format a4 head ' 19'
col 20 format a4 head ' 20'
col 21 format a4 head ' 21'
col 22 format a4 head ' 22'
col 23 format a4 head ' 23'
SELECT
to_char(first_time,'YYYY-MON-DD') day,
to_char(first_time,'DY') dow,
to_char(sum(decode(to_char(first_time,'HH24'),'00',1,0)),'990') "00",
to_char(sum(decode(to_char(first_time,'HH24'),'01',1,0)),'990') "01",
to_char(sum(decode(to_char(first_time,'HH24'),'02',1,0)),'990') "02",
to_char(sum(decode(to_char(first_time,'HH24'),'03',1,0)),'990') "03",
to_char(sum(decode(to_char(first_time,'HH24'),'04',1,0)),'990') "04",
to_char(sum(decode(to_char(first_time,'HH24'),'05',1,0)),'990') "05",
to_char(sum(decode(to_char(first_time,'HH24'),'06',1,0)),'990') "06",
to_char(sum(decode(to_char(first_time,'HH24'),'07',1,0)),'990') "07",
to_char(sum(decode(to_char(first_time,'HH24'),'08',1,0)),'990') "08",
to_char(sum(decode(to_char(first_time,'HH24'),'09',1,0)),'990') "09",
to_char(sum(decode(to_char(first_time,'HH24'),'10',1,0)),'990') "10",
to_char(sum(decode(to_char(first_time,'HH24'),'11',1,0)),'990') "11",
to_char(sum(decode(to_char(first_time,'HH24'),'12',1,0)),'990') "12",
to_char(sum(decode(to_char(first_time,'HH24'),'13',1,0)),'990') "13",
to_char(sum(decode(to_char(first_time,'HH24'),'14',1,0)),'990') "14",
to_char(sum(decode(to_char(first_time,'HH24'),'15',1,0)),'990') "15",
to_char(sum(decode(to_char(first_time,'HH24'),'16',1,0)),'990') "16",
to_char(sum(decode(to_char(first_time,'HH24'),'17',1,0)),'990') "17",
to_char(sum(decode(to_char(first_time,'HH24'),'18',1,0)),'990') "18",
to_char(sum(decode(to_char(first_time,'HH24'),'19',1,0)),'990') "19",
to_char(sum(decode(to_char(first_time,'HH24'),'20',1,0)),'990') "20",
to_char(sum(decode(to_char(first_time,'HH24'),'21',1,0)),'990') "21",
to_char(sum(decode(to_char(first_time,'HH24'),'22',1,0)),'990') "22",
to_char(sum(decode(to_char(first_time,'HH24'),'23',1,0)),'990') "23"
from v$log_history
where first_time > sysdate - 15
GROUP by
to_char(first_time,'YYYY-MON-DD'),to_char(first_time,'DY')
order by 1
/
|
--select
-- Items.ServerItem,
-- ItemVersions.Encoding
--into T#
--from
-- Items
-- inner join ItemVersions on ItemVersions.Item_Id = Items.Id
--group by
-- Items.ServerItem, ItemVersions.Encoding
--order by
-- Items.ServerItem
|
SELECT *
FROM report.purchase |
/*
Navicat Premium Data Transfer
Source Server : localmysql5.7
Source Server Type : MySQL
Source Server Version : 50724
Source Host : localhost:3306
Source Schema : jpa
Target Server Type : MySQL
Target Server Version : 50724
File Encoding : 65001
Date: 07/11/2019 16:33:30
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for cst_customer
-- ----------------------------
DROP TABLE IF EXISTS `cst_customer`;
CREATE TABLE `cst_customer` (
`cust_id` bigint(32) NOT NULL AUTO_INCREMENT COMMENT '客户编号(主键)',
`cust_name` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '客户名称(公司名称)',
`cust_source` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '客户信息来源',
`cust_industry` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '客户所属行业',
`cust_level` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '客户级别',
`cust_address` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '客户联系地址',
`cust_phone` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '客户联系电话',
PRIMARY KEY (`cust_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 105 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of cst_customer
-- ----------------------------
INSERT INTO `cst_customer` VALUES (103, 'TBD云集中心', '网络', '商业办公', 'VIP客户', '昌平区北七家镇', '010-84389340');
INSERT INTO `cst_customer` VALUES (104, 'TBD云集中心', '网络', '商业办公', 'VIP客户', '昌平区北七家镇', '010-84389340');
-- ----------------------------
-- Table structure for cst_linkman
-- ----------------------------
DROP TABLE IF EXISTS `cst_linkman`;
CREATE TABLE `cst_linkman` (
`lkm_id` bigint(32) NOT NULL AUTO_INCREMENT COMMENT '联系人编号(主键)',
`lkm_name` varchar(16) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '联系人姓名',
`lkm_gender` char(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '联系人性别',
`lkm_phone` varchar(16) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '联系人办公电话',
`lkm_mobile` varchar(16) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '联系人手机',
`lkm_email` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '联系人邮箱',
`lkm_position` varchar(16) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '联系人职位',
`lkm_memo` varchar(512) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '联系人备注',
`lkm_cust_id` bigint(32) NOT NULL COMMENT '客户id(外键)',
PRIMARY KEY (`lkm_id`) USING BTREE,
INDEX `FK_cst_linkman_lkm_cust_id`(`lkm_cust_id`) USING BTREE,
CONSTRAINT `FK_cst_linkman_lkm_cust_id` FOREIGN KEY (`lkm_cust_id`) REFERENCES `cst_customer` (`cust_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE = InnoDB AUTO_INCREMENT = 10 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of cst_linkman
-- ----------------------------
INSERT INTO `cst_linkman` VALUES (8, 'TBD联系人', 'male', '010-34785348', '13811111111', '98354834@qq.com', '老师', '还行吧', 103);
INSERT INTO `cst_linkman` VALUES (9, 'TBD联系人', 'male', '010-34785348', '13811111111', '98354834@qq.com', '老师', '还行吧', 104);
-- ----------------------------
-- Table structure for sys_role
-- ----------------------------
DROP TABLE IF EXISTS `sys_role`;
CREATE TABLE `sys_role` (
`role_id` bigint(20) NOT NULL AUTO_INCREMENT,
`role_memo` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`role_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
PRIMARY KEY (`role_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of sys_role
-- ----------------------------
INSERT INTO `sys_role` VALUES (1, NULL, 'java程序员');
INSERT INTO `sys_role` VALUES (2, NULL, 'java程序员');
-- ----------------------------
-- Table structure for sys_user
-- ----------------------------
DROP TABLE IF EXISTS `sys_user`;
CREATE TABLE `sys_user` (
`user_id` bigint(20) NOT NULL AUTO_INCREMENT,
`user_code` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`user_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`user_password` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`user_state` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
PRIMARY KEY (`user_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of sys_user
-- ----------------------------
INSERT INTO `sys_user` VALUES (1, NULL, '小李', NULL, NULL);
INSERT INTO `sys_user` VALUES (2, NULL, '小李', NULL, NULL);
-- ----------------------------
-- Table structure for sys_user_role
-- ----------------------------
DROP TABLE IF EXISTS `sys_user_role`;
CREATE TABLE `sys_user_role` (
`sys_user_id` bigint(20) NOT NULL,
`sys_role_id` bigint(20) NOT NULL,
PRIMARY KEY (`sys_user_id`, `sys_role_id`) USING BTREE,
INDEX `FK1ef5794xnbirtsnudta6p32on`(`sys_role_id`) USING BTREE,
CONSTRAINT `FK1ef5794xnbirtsnudta6p32on` FOREIGN KEY (`sys_role_id`) REFERENCES `sys_role` (`role_id`) ON DELETE RESTRICT ON UPDATE RESTRICT,
CONSTRAINT `FKsbjvgfdwwy5rfbiag1bwh9x2b` FOREIGN KEY (`sys_user_id`) REFERENCES `sys_user` (`user_id`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of sys_user_role
-- ----------------------------
INSERT INTO `sys_user_role` VALUES (1, 1);
INSERT INTO `sys_user_role` VALUES (2, 2);
SET FOREIGN_KEY_CHECKS = 1;
|
SELECT * FROM turnos.turno;
CREATE TABLE `atendidos` (
`idatendido` int(11) NOT NULL AUTO_INCREMENT,
`idturno` int(11) NOT NULL,
`idTramite` int(11) NOT NULL,
`horaIn` datetime NOT NULL,
`horaOut` datetime NOT NULL,
PRIMARY KEY (`idatendido`),
KEY `idTramite` (`idTramite`),
CONSTRAINT `fk_idtramite` FOREIGN KEY (`idTramite`) REFERENCES `tramites` (`idTramite`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci;
CREATE TABLE `cola` (
`idcola` int(11) NOT NULL AUTO_INCREMENT,
`idturno` int(11) NOT NULL,
PRIMARY KEY (`idcola`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci;
CREATE TABLE `conteo` (
`idconteo` int(11) NOT NULL AUTO_INCREMENT,
`idTramite` tinyint(4) NOT NULL DEFAULT '0',
`total` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`idconteo`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci;
CREATE TABLE `tramites` (
`idTramite` int(11) NOT NULL AUTO_INCREMENT,
`tramite` varchar(128) CHARACTER SET utf8 NOT NULL,
`clave` varchar(4) CHARACTER SET utf8 NOT NULL,
`es_tp` tinyint(4) NOT NULL DEFAULT '0',
PRIMARY KEY (`idTramite`)
) ENGINE=InnoDB AUTO_INCREMENT=22 DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci;
CREATE TABLE `turno` (
`idturno` int(11) NOT NULL AUTO_INCREMENT,
`numero` varchar(4) CHARACTER SET utf8 NOT NULL,
`tramite` varchar(128) CHARACTER SET utf8 NOT NULL,
`idTramite` int(11) NOT NULL,
`clave` varchar(4) COLLATE utf8_spanish_ci DEFAULT NULL,
`hora` datetime NOT NULL,
`estatus` tinyint(4) NOT NULL DEFAULT '0',
PRIMARY KEY (`idturno`)
) ENGINE=InnoDB AUTO_INCREMENT=70 DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci;
CREATE TABLE `ventanilla` (
`idVentanilla` int(11) NOT NULL AUTO_INCREMENT,
`ventanilla` varchar(16) COLLATE utf8_spanish_ci NOT NULL,
`contrasena` varchar(16) COLLATE utf8_spanish_ci NOT NULL,
`conectado` tinyint(4) NOT NULL DEFAULT '0',
`estatus` tinyint(4) NOT NULL,
PRIMARY KEY (`idVentanilla`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci;
|
CREATE TABLE account (
id INTEGER PRIMARY KEY AUTOINCREMENT,
account varchar(16) NOT NULL,
balance NUMERIC NOT NULL default 0,
limitat NUMERIC NOT NULL default 0
);
CREATE INDEX account_account ON account(account);
CREATE TABLE service (
id INTEGER PRIMARY KEY AUTOINCREMENT,
service varchar(16) NOT NULL,
cost NUMERIC NOT NULL default 0,
period INTEGER
);
CREATE INDEX service_name ON service(service);
CREATE TABLE user (
id INTEGER PRIMARY KEY AUTOINCREMENT,
account varchar(16) NOT NULL,
username varchar(64) NOT NULL default ''
);
CREATE INDEX user_account ON user(account);
CREATE INDEX user_name ON user(username);
CREATE TABLE userservice (
username varchar(64) NOT NULL default '' ,
service varchar(16) NOT NULL,
enabled BOOLEAN default TRUE
);
CREATE INDEX userservice_user ON userservice(username);
CREATE INDEX userservice_service ON userservice(service);
CREATE INDEX userservice_enabled ON userservice(enabled);
CREATE TABLE fiscal (
id INTEGER PRIMARY KEY AUTOINCREMENT,
account varchar(16) NOT NULL,
uuid varchar(64) NOT NULL ,
type INTEGER NOT NULL default 0,
ammount NUMERIC NOT NULL default 0
);
CREATE INDEX fiscal_account ON fiscal(account);
|
-- phpMyAdmin SQL Dump
-- version 4.7.7
-- https://www.phpmyadmin.net/
--
-- Host: localhost:3306
-- Generation Time: Sep 16, 2018 at 12:29 AM
-- Server version: 10.1.35-MariaDB-cll-lve
-- PHP Version: 5.6.30
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `massynxt_msb_salam`
--
-- --------------------------------------------------------
--
-- Table structure for table `tbaccountbalance`
--
CREATE TABLE `tbaccountbalance` (
`id` int(11) NOT NULL,
`hisabKhat` varchar(10) NOT NULL,
`amount` varchar(70) NOT NULL,
`moneyStatus` int(11) NOT NULL DEFAULT '0',
`accDate` varchar(30) NOT NULL,
`description` text NOT NULL,
`customerId` int(11) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `tbaccountbalance`
--
INSERT INTO `tbaccountbalance` (`id`, `hisabKhat`, `amount`, `moneyStatus`, `accDate`, `description`, `customerId`) VALUES
(10, '001', '80000', 1, '2017-11-07', 'মেমো নং - ১', 6),
(11, '002', '25000', 1, '2017-11-07', 'মেমো নং - ২', 13),
(12, '001', '35600', 1, '2017-11-07', 'মেমো নং - ৩', 14),
(13, '002', '25000', 1, '2017-11-07', 'বকেয়া টাকা', 6),
(14, '001', '50000', 2, '2017-11-07', 'বাংলাদেশ কৃষি ব্যাংক লিমিটেড - এ টাকা স্থানান্তর করা হয়েছে', 0),
(15, '002', '50000', 1, '2017-11-07', 'নগদ হিসাব - থেকে টাকা স্থানান্তর করা হয়েছে', 0),
(16, '001', '0', 1, '2018-03-25', 'মেমো নং - ৪', 6),
(17, '001', '0', 1, '2018-03-25', 'মেমো নং - ৫', 6),
(18, '001', '5000', 1, '2018-03-25', 'মেমো নং - ৬', 0),
(19, '001', '25000', 1, '2018-03-28', '', 13),
(20, '022', '0', 1, '2018-08-23', 'মেমো নং - ৭', 22),
(21, '022', '0', 1, '2018-08-23', 'মেমো নং - ৮', 22),
(22, '022', '0', 1, '2018-08-23', 'মেমো নং - ৯', 22),
(23, '022', '0', 1, '2018-08-23', 'মেমো নং - ১০', 22),
(24, '022', '0', 1, '2018-09-03', 'মেমো নং - ১১', 22),
(25, '001', '0', 1, '2018-09-11', 'মেমো নং - ১২', 0),
(26, '001', '0', 1, '2018-09-11', 'মেমো নং - ১৩', 0),
(27, '001', '0', 1, '2018-09-11', 'মেমো নং - ১৪', 22);
-- --------------------------------------------------------
--
-- Table structure for table `tbcashtransfer`
--
CREATE TABLE `tbcashtransfer` (
`id` int(11) NOT NULL,
`fromAccount` int(11) NOT NULL,
`toAccount` int(11) NOT NULL,
`ctDate` date NOT NULL,
`amount` varchar(50) NOT NULL,
`description` text NOT NULL,
`timeDate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`txtVoucher` varchar(20) NOT NULL,
`txtMedia` text NOT NULL,
`executiveId` varchar(20) NOT NULL,
`txtCheckDate` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `tbcashtransfer`
--
INSERT INTO `tbcashtransfer` (`id`, `fromAccount`, `toAccount`, `ctDate`, `amount`, `description`, `timeDate`, `txtVoucher`, `txtMedia`, `executiveId`, `txtCheckDate`) VALUES
(2, 1, 2, '2017-11-07', '50000', '', '2017-11-07 09:13:39', '', 'কাওছার আহমেদ', '5', '0');
-- --------------------------------------------------------
--
-- Table structure for table `tbcategory`
--
CREATE TABLE `tbcategory` (
`item_id` int(11) NOT NULL,
`item_name` varchar(200) NOT NULL,
`type_id` int(11) NOT NULL,
`sort` int(11) NOT NULL,
`created_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `tbcategory`
--
INSERT INTO `tbcategory` (`item_id`, `item_name`, `type_id`, `sort`, `created_date`) VALUES
(9, 'টিন', 5, 1, '2015-09-22 02:39:57'),
(10, 'শিট ', 5, 2, '2015-09-22 02:40:17'),
(11, 'টুয়া', 5, 3, '2015-09-22 02:40:37'),
(12, 'সিমেন্ট', 9, 6, '2015-09-22 02:40:56'),
(13, 'রড', 9, 5, '2015-09-22 02:41:15'),
(14, 'আরামিট', 5, 4, '2015-09-22 02:41:35'),
(15, 'কয়েল', 4, 0, '2018-03-25 06:09:44'),
(16, 'বার', 3, 0, '2018-03-25 06:14:08');
-- --------------------------------------------------------
--
-- Table structure for table `tbchart_account`
--
CREATE TABLE `tbchart_account` (
`ca_id` int(3) UNSIGNED ZEROFILL NOT NULL,
`ca_code` int(3) UNSIGNED ZEROFILL NOT NULL,
`original_cal_id` int(3) UNSIGNED ZEROFILL NOT NULL,
`cal_sector` varchar(200) NOT NULL,
`parent_owner` varchar(200) NOT NULL,
`region_id` int(11) NOT NULL,
`address` varchar(200) NOT NULL,
`phone` varchar(200) NOT NULL,
`national_id_no` varchar(200) NOT NULL,
`balance` varchar(200) NOT NULL,
`created_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `tbchart_account`
--
INSERT INTO `tbchart_account` (`ca_id`, `ca_code`, `original_cal_id`, `cal_sector`, `parent_owner`, `region_id`, `address`, `phone`, `national_id_no`, `balance`, `created_date`) VALUES
(001, 001, 001, 'নগদ হিসাব', 'কামাল', 1, 'Dhaka', '1212121212', '56566-56454-454545', '5000', '2015-12-12 04:16:55'),
(002, 002, 001, 'বাংলাদেশ কৃষি ব্যাংক লিমিটেড', 'ড়াহিম মিয়া', 4, 'জামালপুর', '০১৯১১৭৬২১৪৭', '২৫৬০-৭৮২৫৯৬-৩৬৯৮', '৫০০০', '2015-12-12 04:20:09'),
(003, 003, 001, 'অগ্রণী ব্যাংক ২-০৯১৩৭৩৮', 'মিলন', 6, 'ণয়া তুলা, ঢাকা', '০১৯৭৮৫৮৬৪৪৭', '৯৯৯৯-৯৯৯৯-৯৯৯৯৯-৯৯৯৯', '৬০০০', '2015-12-12 05:13:42'),
(006, 070, 003, 'দুই ভাই এন্টারপ্রাইজ/গিয়াসপুর', 'হাজী বকুল মিয়া', 1, 'গিয়াসপুর', '১২১২১২১২১২১২', '২৫২৫-৩৬৩৬-৯৯৯-৯৯৯৯', '১২৫০.২৫', '2016-02-06 08:39:23'),
(007, 227, 003, 'দুলাল ট্রেডার্স', 'দুলাল হোসেন', 37, 'কালিয়াকৈর, গাজীপুর', '১২১২১২১২', '১১১১-২২২২২-৫৫৫৫৫-৬৬৬৬', '৯৮৯৮৯-৩৬৫৬৩৬-৮৭৮৯৫২', '2016-02-06 10:29:00'),
(008, 002, 004, 'মেসার্স সাজ্জাদ এন্টারপ্রাইজ/সাভার', 'মোহাম্মদ আব্দুস সালাম', 7, 'ডগর মোড়া, রেডিও কলোনী বাসস্ট্যান্ড', '+৮৮০২৭৭৪৭৩০৬', '৩৩১২২০১৮০৪৩৬৪', '১২৬৯৫৫৭৪', '2016-02-06 11:31:59'),
(009, 001, 004, 'নগত বিক্রেতা', '', 7, '', '', '', '0', '2016-02-08 10:59:41'),
(011, 002, 004, 'পিএইচপি স্টিল মিলস লিঃ(১)', '', 9, 'বড় কুমিরা, সীতাকুণ্ড#', '', '', '0', '2016-02-08 11:23:26'),
(012, 003, 004, 'আরামিট লিমিটেড (অয়ন)', 'কামাল', 9, 'বড় কুমিরা, সীতাকুণ্ড#', '১২১২১২১২১২', '১২১২১২১২', '০.০০', '2016-02-09 12:14:50'),
(013, 004, 003, 'নাজমুল এন্টার প্রাইজ', 'কামাল', 8, 'কালিয়াকৈর, গাজীপুর', '১২১২১২১২', '১১১১-২২২২২-৫৫৫৫৫-৬৬৬৬', '০.০০', '2016-02-09 12:18:15'),
(014, 001, 003, 'আক্কাছ এন্ড সন্স', 'আক্কাছ আলী', 35, 'ভড়াডোবা বাজার,', '০১৮২৪১৬৮৯৯৬', '', '', '2016-02-15 11:41:00'),
(015, 001, 009, 'বিক্রয়', 'কারিম', 42, 'কালিয়াকৈর, গাজীপুর', '১২১২১২১২১২', '১২১২১-১২১২১২-১২১২১-১২১২১', '৫৫৫০.৮৫', '2016-04-12 19:32:36'),
(016, 002, 009, 'লোন/হাওলাদ', 'মোহাম্মদ আব্দুস সালাম', 37, 'বড় কুমিরা, সীতাকুণ্ড#', '১২১২১২১২১২', '১১১১-২২২২২-৫৫৫৫৫-৬৬৬৬', '১২৬৯৫৫৭৪', '2016-04-12 19:33:07'),
(017, 003, 009, 'কমিশন', 'কালাম', 33, 'কালিয়াকৈর, গাজীপুর', '১২১২১২১২', '৩৩১২২০১৮০৪৩৬৪', '০.০০', '2016-04-12 19:33:46'),
(019, 005, 009, 'রিজেক্ট মালামাল বিক্রয়', 'ড়াহিম মিয়া', 42, 'কালিয়াকৈর, গাজীপুর', '১২১২১২১২', '১১১১-২২২২২-৫৫৫৫৫-৬৬৬৬', '০.০০', '2016-04-12 19:35:06'),
(020, 001, 011, 'বিবিধ ব্যাংক হইতে প্রাপ্তি', 'কালাম', 43, 'বড় কুমিরা, সীতাকুণ্ড#', '১২১২১২১২১২', '১১১১-২২২২২-৫৫৫৫৫-৬৬৬৬', '০.০০', '2016-04-12 19:35:56'),
(021, 001, 008, 'মোঃ বেনজির আহম্মেদ (ম্যনেজার)', 'ড়াহিম', 43, 'কালিয়াকৈর, গাজীপুর', '১২১২১২১২১২১২', '১১১১-২২২২২-৫৫৫৫৫-৬৬৬৬', '০.০০', '2016-04-12 19:50:55'),
(022, 1111, 005, 'supplier নগদ হিসাব', 'কামাল', 41, '111', '111111111111', '1111111111111111111', '1111', '2018-08-16 15:47:35'),
(023, 006, 005, 'sompod', 'BSRM', 0, '', '', '', '', '2018-09-11 08:02:55');
-- --------------------------------------------------------
--
-- Table structure for table `tbhead_account`
--
CREATE TABLE `tbhead_account` (
`h_acc_id` int(3) UNSIGNED ZEROFILL NOT NULL,
`acc_code` int(11) NOT NULL,
`acc_sector` varchar(200) NOT NULL,
`acc_type` varchar(200) NOT NULL,
`created_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `tbhead_account`
--
INSERT INTO `tbhead_account` (`h_acc_id`, `acc_code`, `acc_sector`, `acc_type`, `created_date`) VALUES
(001, 0, 'নগদ ও ব্যাংক হিসাব', 'সম্পদ', '2015-09-16 05:00:23'),
(002, 0, 'খরচ হিসাব', 'খরচ', '2015-09-16 05:02:50'),
(003, 0, 'ক্রেতা হিসাব', 'সম্পদ', '2015-09-16 05:03:34'),
(004, 4, 'testtest', 'খরচ', '2018-04-12 17:00:48'),
(005, 5, 'ক্রয় কৃত পণ্য হিসাব', 'সম্পদ', '2018-08-14 16:45:51');
-- --------------------------------------------------------
--
-- Table structure for table `tbinvoice`
--
CREATE TABLE `tbinvoice` (
`id` int(11) NOT NULL,
`invoiceNumber` int(11) NOT NULL DEFAULT '0',
`customerId` int(11) NOT NULL,
`inDate` date NOT NULL,
`inTime` varchar(50) NOT NULL,
`executiveId` int(11) NOT NULL,
`txtTotalPrice` varchar(40) NOT NULL DEFAULT '0',
`txtDiscount` varchar(30) NOT NULL DEFAULT '0',
`txtLabourExp` varchar(30) NOT NULL DEFAULT '0',
`txtCarRent` varchar(30) NOT NULL DEFAULT '0',
`txtAcceptedMoney` varchar(30) NOT NULL DEFAULT '0',
`preDue` varchar(20) NOT NULL,
`txtChalanNo` varchar(200) NOT NULL,
`txtCarNumber` varchar(200) NOT NULL,
`txtMediaPerson` varchar(200) NOT NULL,
`rpChartHeadId` varchar(20) NOT NULL,
`inType` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `tbinvoice`
--
INSERT INTO `tbinvoice` (`id`, `invoiceNumber`, `customerId`, `inDate`, `inTime`, `executiveId`, `txtTotalPrice`, `txtDiscount`, `txtLabourExp`, `txtCarRent`, `txtAcceptedMoney`, `preDue`, `txtChalanNo`, `txtCarNumber`, `txtMediaPerson`, `rpChartHeadId`, `inType`) VALUES
(1, 1, 6, '2017-11-07', '03:01:23 pm', 5, '108025', '0.00', '850.00', '3000.00', '80000', '0', '1001', 'ঢাকা চ - ২১৪৫৮৮', 'মামুন খান', '001', 1),
(2, 2, 13, '2017-11-07', '03:04:08 pm', 5, '50800', '0', '450', '1500', '25000', '0', '1002', 'ঢাকা চ - ২১৪৫৮৮', 'মামুন খান', '002', 2),
(3, 3, 14, '2017-11-07', '03:08:27 pm', 5, '35900', '2550', '750', '1500', '35600', '0', '1003', 'ঢাকা চ - ২১৪৫৮৮', 'মামুন খান', '001', 2),
(4, 4, 6, '2018-03-25', '03:27:29 am', 5, '0', '0.00', '0.00', '0.00', '0', '6875', '232323', '3232', '23', '001', 1),
(5, 5, 6, '2018-03-25', '11:34:58 am', 5, '0', '0.00', '0.00', '0.00', '0', '6875', '', '', '', '001', 2),
(6, 6, 0, '2018-03-25', '12:26:36 pm', 5, '9565', '0.00', '0.00', '0.00', '5000', '0', '000789', '', '', '001', 2),
(7, 7, 22, '2018-08-23', '09:29:27 pm', 10, '11', '0.00', '0.00', '0.00', '0', '0', '11', '11', '11', '022', 1),
(8, 8, 22, '2018-08-23', '09:29:54 pm', 10, '11', '0.00', '0.00', '0.00', '0', '11', '', '', '', '022', 1),
(9, 9, 22, '2018-08-23', '09:48:37 pm', 10, '11', '0.00', '0.00', '0.00', '0', '22', '11', '11', '11', '022', 1),
(10, 10, 22, '2018-08-23', '09:52:34 pm', 10, '11', '0.00', '0.00', '0.00', '0', '33', '11', '11', '11', '022', 1),
(11, 11, 22, '2018-09-03', '12:31:28 am', 10, '11', '0.00', '0.00', '0.00', '0', '44', '11', '11', '11', '022', 1),
(12, 12, 0, '2018-09-11', '01:50:00 pm', 10, '37880', '2000', '1000', '500.00', '0', '0', '', '', '', '001', 2),
(13, 13, 0, '2018-09-11', '01:56:33 pm', 10, '8360', '0.00', '0.00', '0.00', '0', '0', '', '', '', '001', 2),
(14, 14, 22, '2018-09-11', '02:05:49 pm', 10, '350', '0.00', '0.00', '0.00', '0', '55', '', '', '', '001', 1);
-- --------------------------------------------------------
--
-- Table structure for table `tbitem_type`
--
CREATE TABLE `tbitem_type` (
`type_id` int(11) NOT NULL,
`type_name` varchar(100) NOT NULL,
`sort_order` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `tbitem_type`
--
INSERT INTO `tbitem_type` (`type_id`, `type_name`, `sort_order`) VALUES
(3, 'কেজি', 4),
(4, 'টন', 2),
(5, 'পিস', 1),
(9, 'ব্যাগ', 3),
(15, 'বান', 0),
(16, 'স্কয়ার ফিট', 0);
-- --------------------------------------------------------
--
-- Table structure for table `tblocation`
--
CREATE TABLE `tblocation` (
`l_id` int(11) NOT NULL,
`l_name` varchar(200) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `tblocation`
--
INSERT INTO `tblocation` (`l_id`, `l_name`) VALUES
(7, 'সাভার -ঢাকা।'),
(9, 'গাজীপুর মহানগর।'),
(31, 'শ্রীপুর-গাজীপুর।'),
(32, 'কাপাসিয়া-গাজীপুর।'),
(33, 'কালিগঞ্জ-গাজীপুর।'),
(34, 'কালিয়াকৈর-গাজীপুর।'),
(35, 'ভালুকা-ময়মসিংহ।'),
(36, 'মির্জাপুর-টাঙ্গাইল।'),
(37, 'ধামরাই-ঢাকা।'),
(41, 'আশুলিয়া-ঢাকা |'),
(42, 'টংগী-গাজীপুর।'),
(43, 'ঢাকা মহানগর-উওর।');
-- --------------------------------------------------------
--
-- Table structure for table `tbpayments`
--
CREATE TABLE `tbpayments` (
`id` int(11) NOT NULL,
`fromAccount` int(11) NOT NULL,
`toAccount` int(11) NOT NULL,
`ctDate` date NOT NULL,
`amount` varchar(50) NOT NULL,
`description` text NOT NULL,
`timeDate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`txtVoucher` varchar(20) NOT NULL,
`txtMedia` text NOT NULL,
`executiveId` varchar(20) NOT NULL,
`txtCheckDate` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `tbreceivable_payments`
--
CREATE TABLE `tbreceivable_payments` (
`id` int(11) NOT NULL,
`rpDate` date NOT NULL,
`rpTime` varchar(200) NOT NULL,
`hisabKhat` varchar(20) NOT NULL,
`customerId` int(11) NOT NULL,
`rpCredit` varchar(50) NOT NULL DEFAULT '0',
`rpDebit` varchar(50) NOT NULL DEFAULT '0',
`invoiceId` varchar(20) NOT NULL,
`paymentBy` varchar(200) NOT NULL,
`description` text NOT NULL,
`executiveId` int(11) NOT NULL,
`preDue` varchar(50) NOT NULL DEFAULT '0',
`chequeDate` varchar(50) NOT NULL DEFAULT '0',
`voucherNumber` varchar(50) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `tbreceivable_payments`
--
INSERT INTO `tbreceivable_payments` (`id`, `rpDate`, `rpTime`, `hisabKhat`, `customerId`, `rpCredit`, `rpDebit`, `invoiceId`, `paymentBy`, `description`, `executiveId`, `preDue`, `chequeDate`, `voucherNumber`) VALUES
(22, '2017-11-07', '03:01:23 pm', '001', 6, '111875.00', '80000', '1', 'মামুন খান', 'মেমো নং - ১', 5, '0', '0', '0'),
(23, '2017-11-07', '03:04:08 pm', '002', 13, '52750.00', '25000', '2', 'মামুন খান', 'মেমো নং - ২', 5, '0', '0', '0'),
(24, '2017-11-07', '03:08:27 pm', '001', 14, '35600.00', '35600', '3', 'মামুন খান', 'মেমো নং - ৩', 5, '0', '0', '0'),
(25, '2017-11-07', '', '002', 6, '0', '25000', '', 'সাব্বির মিয়া', 'বকেয়া টাকা', 5, '31875', '07-11-2017', ''),
(26, '2018-03-25', '03:27:29 am', '001', 6, '0.00', '0', '4', '23', 'মেমো নং - ৪', 5, '0', '0', '0'),
(27, '2018-03-25', '11:34:58 am', '001', 6, '0.00', '0', '5', '', 'মেমো নং - ৫', 5, '0', '0', '0'),
(28, '2018-03-25', '12:26:36 pm', '001', 0, '9565.00', '5000', '6', '', 'মেমো নং - ৬', 5, '0', '0', '0'),
(29, '2018-03-28', '', '001', 13, '0', '25000', '', '', '', 5, '27750', '28-03-2018', ''),
(30, '2018-08-23', '09:29:27 pm', '022', 22, '11.00', '0', '7', '11', 'মেমো নং - ৭', 10, '0', '0', '0'),
(31, '2018-08-23', '09:29:54 pm', '022', 22, '11.00', '0', '8', '', 'মেমো নং - ৮', 10, '0', '0', '0'),
(32, '2018-08-23', '09:48:37 pm', '022', 22, '11.00', '0', '9', '11', 'মেমো নং - ৯', 10, '0', '0', '0'),
(33, '2018-08-23', '09:52:34 pm', '022', 22, '11.00', '0', '10', '11', 'মেমো নং - ১০', 10, '0', '0', '0'),
(34, '2018-09-03', '12:31:28 am', '022', 22, '11.00', '0', '11', '11', 'মেমো নং - ১১', 10, '0', '0', '0'),
(35, '2018-09-11', '01:50:00 pm', '001', 0, '37380.00', '0', '12', '', 'মেমো নং - ১২', 10, '0', '0', '0'),
(36, '2018-09-11', '01:56:33 pm', '001', 0, '8360.00', '0', '13', '', 'মেমো নং - ১৩', 10, '0', '0', '0'),
(37, '2018-09-11', '02:05:49 pm', '001', 22, '350.00', '0', '14', '', 'মেমো নং - ১৪', 10, '0', '0', '0');
-- --------------------------------------------------------
--
-- Table structure for table `tbreceive_amount`
--
CREATE TABLE `tbreceive_amount` (
`id` int(11) NOT NULL,
`tbrpId` int(11) NOT NULL,
`preDue` varchar(200) NOT NULL,
`chequeDate` varchar(50) NOT NULL,
`voucherNumber` varchar(30) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `tbrod_cement`
--
CREATE TABLE `tbrod_cement` (
`rc_id` int(11) NOT NULL,
`category` int(11) NOT NULL,
`code` varchar(200) NOT NULL,
`item` varchar(200) NOT NULL,
`unit` int(11) NOT NULL,
`stock` varchar(200) NOT NULL,
`main_stock` int(11) DEFAULT NULL,
`buy_price` varchar(200) NOT NULL,
`sell_price` varchar(200) NOT NULL,
`created_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`supplier_id` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `tbrod_cement`
--
INSERT INTO `tbrod_cement` (`rc_id`, `category`, `code`, `item`, `unit`, `stock`, `main_stock`, `buy_price`, `sell_price`, `created_date`, `supplier_id`) VALUES
(2, 13, '201', '২০ মিমি বিএসআরএম', 3, '3100', NULL, '', '78', '2015-09-22 04:15:06', 2),
(4, 12, '102', 'হোলসিম সিমেন্ট', 9, '1850', NULL, '', '385', '2016-01-03 13:10:11', 2),
(7, 12, '103', 'সেভেন রিংস সিমেন্ট', 9, '1975', NULL, '0', '390', '2017-11-07 08:46:14', 2),
(8, 12, '104', 'ফ্রেশ সিমেন্ট', 9, '2095', 15, '0', '400', '2017-11-07 08:48:38', 2),
(9, 13, '202', '৩০ মিমি বিএসআরএম', 3, '48800', NULL, '0', '84', '2017-11-07 08:50:23', 2),
(10, 13, '203', '৪০ মিমি বিএসআরএম', 3, '6000', NULL, '0', '90', '2017-11-07 08:51:05', 2),
(11, 13, '1111', '1111', 5, '500', NULL, '0', '111', '2018-08-07 07:57:29', NULL);
-- --------------------------------------------------------
--
-- Table structure for table `tbrod_cement_sale`
--
CREATE TABLE `tbrod_cement_sale` (
`id` int(11) NOT NULL,
`invoiceNumber` varchar(50) NOT NULL,
`itemId` varchar(10) NOT NULL,
`txtUnitPrice` varchar(20) NOT NULL,
`txtQuantity` varchar(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `tbrod_cement_sale`
--
INSERT INTO `tbrod_cement_sale` (`id`, `invoiceNumber`, `itemId`, `txtUnitPrice`, `txtQuantity`) VALUES
(5, '1', '7', '385', '25'),
(6, '1', '9', '82', '1200'),
(7, '11', '11', '11', '500'),
(8, '14', '8', '350', '2095');
-- --------------------------------------------------------
--
-- Table structure for table `tbsuppliers_purchases_details`
--
CREATE TABLE `tbsuppliers_purchases_details` (
`id` int(11) NOT NULL,
`invoiceNumber` varchar(191) NOT NULL,
`itemId` varchar(191) NOT NULL,
`txtUnitPrice` varchar(191) NOT NULL,
`txtQuantity` varchar(191) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `tbsuppliers_purchases_details`
--
INSERT INTO `tbsuppliers_purchases_details` (`id`, `invoiceNumber`, `itemId`, `txtUnitPrice`, `txtQuantity`) VALUES
(1, '7', '', '', ''),
(2, '8', '', '', ''),
(3, '9', '11', '11', '400'),
(4, '9', '', '11', '400'),
(5, '10', '11', '11', '400');
-- --------------------------------------------------------
--
-- Table structure for table `tbtin_sheet_tua`
--
CREATE TABLE `tbtin_sheet_tua` (
`tst_id` int(11) NOT NULL,
`code` varchar(100) NOT NULL,
`category` varchar(200) NOT NULL,
`categoryId` varchar(50) NOT NULL,
`unit_type` int(11) NOT NULL,
`type` int(11) DEFAULT '0',
`created_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `tbtin_sheet_tua`
--
INSERT INTO `tbtin_sheet_tua` (`tst_id`, `code`, `category`, `categoryId`, `unit_type`, `type`, `created_date`) VALUES
(1, '301', '০.৩৬০ মিমি সুপার', '9', 15, 0, '2017-11-07 08:57:05'),
(2, '302', '০.৩৮০ মিমি সুপার', '9', 15, 0, '2017-11-07 08:58:36'),
(3, '11', '123 tua', '11', 5, 1, '2018-03-23 15:19:50'),
(4, '334', 'tua', '11', 5, 1, '2018-03-25 06:03:54'),
(5, '120', 'টিন ১২০ মিমি', '9', 4, 0, '2018-03-28 07:05:49'),
(6, '150', '১৫০', '9', 5, 0, '2018-09-03 11:27:28'),
(7, '170', '১৭০ মি লি সুপার', '9', 5, 0, '2018-09-03 11:35:00'),
(8, '320', '320', '15', 4, 0, '2018-09-11 07:39:02');
-- --------------------------------------------------------
--
-- Table structure for table `tbtin_sheet_tua_sale`
--
CREATE TABLE `tbtin_sheet_tua_sale` (
`id` int(11) NOT NULL,
`invoiceNumber` int(11) NOT NULL,
`item_id` int(11) NOT NULL,
`s6feet` varchar(100) NOT NULL DEFAULT '0',
`s7feet` varchar(100) NOT NULL DEFAULT '0',
`s8feet` varchar(100) NOT NULL DEFAULT '0',
`s9feet` varchar(100) NOT NULL DEFAULT '0',
`s10feet` varchar(100) NOT NULL DEFAULT '0',
`s11feet` varchar(100) NOT NULL DEFAULT '0',
`s12feet` varchar(100) NOT NULL DEFAULT '0',
`s13feet` varchar(100) NOT NULL DEFAULT '0',
`s6feet_pr` varchar(50) NOT NULL DEFAULT '0',
`s7feet_pr` varchar(50) NOT NULL DEFAULT '0',
`s8feet_pr` varchar(50) NOT NULL DEFAULT '0',
`s9feet_pr` varchar(50) NOT NULL DEFAULT '0',
`s10feet_pr` varchar(50) NOT NULL DEFAULT '0',
`s11feet_pr` varchar(50) NOT NULL DEFAULT '0',
`s12feet_pr` varchar(50) NOT NULL DEFAULT '0',
`s13feet_pr` varchar(50) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `tbtin_sheet_tua_sale`
--
INSERT INTO `tbtin_sheet_tua_sale` (`id`, `invoiceNumber`, `item_id`, `s6feet`, `s7feet`, `s8feet`, `s9feet`, `s10feet`, `s11feet`, `s12feet`, `s13feet`, `s6feet_pr`, `s7feet_pr`, `s8feet_pr`, `s9feet_pr`, `s10feet_pr`, `s11feet_pr`, `s12feet_pr`, `s13feet_pr`) VALUES
(14, 2, 1, '12', '0', '0', '0', '0', '0', '0', '0', '2300', '0', '0', '0', '0', '0', '0', '0'),
(15, 2, 2, '0', '0', '8', '0', '0', '0', '0', '0', '0', '0', '2900', '0', '0', '0', '0', '0'),
(16, 3, 1, '8', '7', '0', '0', '0', '0', '0', '0', '2300', '2500', '0', '0', '0', '0', '0', '0'),
(17, 5, 1, '1', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0'),
(18, 6, 1, '2', '7', '9', '3', '6', '0', '0', '0', '300', '325', '350', '380', '400', '0', '0', '0'),
(19, 12, 2, '8', '0', '6', '0', '0', '0', '0', '0', '2560', '0', '2900', '0', '0', '0', '0', '0'),
(20, 13, 2, '1', '0', '2', '0', '0', '0', '0', '0', '2560', '0', '2900', '0', '0', '0', '0', '0');
-- --------------------------------------------------------
--
-- Table structure for table `tbtin_sheet_tua_stock`
--
CREATE TABLE `tbtin_sheet_tua_stock` (
`id` int(11) NOT NULL,
`item_id` int(11) NOT NULL,
`s6feet` varchar(100) NOT NULL,
`stock_s6feet` int(11) DEFAULT NULL,
`s7feet` varchar(100) NOT NULL,
`stock_s7feet` int(11) DEFAULT NULL,
`s8feet` varchar(100) NOT NULL,
`stock_s8feet` int(11) DEFAULT NULL,
`s9feet` varchar(100) NOT NULL,
`stock_s9feet` int(11) DEFAULT NULL,
`s10feet` varchar(100) NOT NULL,
`stock_s10feet` int(11) DEFAULT NULL,
`s11feet` varchar(100) NOT NULL,
`stock_s11feet` int(11) DEFAULT NULL,
`s12feet` varchar(100) NOT NULL,
`stock_s12feet` int(11) DEFAULT NULL,
`s13feet` varchar(100) NOT NULL,
`stock_s13feet` int(11) DEFAULT NULL,
`s6feet_pr` varchar(50) NOT NULL DEFAULT '0',
`s7feet_pr` varchar(50) NOT NULL DEFAULT '0',
`s8feet_pr` varchar(50) NOT NULL DEFAULT '0',
`s9feet_pr` varchar(50) NOT NULL DEFAULT '0',
`s10feet_pr` varchar(50) NOT NULL DEFAULT '0',
`s11feet_pr` varchar(50) NOT NULL DEFAULT '0',
`s12feet_pr` varchar(50) NOT NULL DEFAULT '0',
`s13feet_pr` varchar(50) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `tbtin_sheet_tua_stock`
--
INSERT INTO `tbtin_sheet_tua_stock` (`id`, `item_id`, `s6feet`, `stock_s6feet`, `s7feet`, `stock_s7feet`, `s8feet`, `stock_s8feet`, `s9feet`, `stock_s9feet`, `s10feet`, `stock_s10feet`, `s11feet`, `stock_s11feet`, `s12feet`, `stock_s12feet`, `s13feet`, `stock_s13feet`, `s6feet_pr`, `s7feet_pr`, `s8feet_pr`, `s9feet_pr`, `s10feet_pr`, `s11feet_pr`, `s12feet_pr`, `s13feet_pr`) VALUES
(4, 1, '7', 2, '3', 2, '1', 2, '7', 2, '4', 2, '10', 2, '10', 2, '10', 2, '0', '0', '0', '0', '0', '0', '0', '0'),
(5, 2, '141', NULL, '0', NULL, '144', NULL, '0', NULL, '0', NULL, '0', NULL, '0', NULL, '0', NULL, '2560', '0', '2900', '0', '0', '0', '0', '0'),
(6, 3, '1', 1, '1', 0, '1', 0, '1', 0, '1', 0, '1', 0, '1', 0, '1', 0, '11', '11', '11', '11', '11', '11', '11', '11'),
(7, 4, '50', NULL, '0', NULL, '0', NULL, '0', NULL, '0', NULL, '0', NULL, '0', NULL, '0', NULL, '', '0', '0', '0', '0', '0', '0', '0'),
(8, 5, '40', NULL, '78', NULL, '567', NULL, '455', NULL, '46', NULL, '567', NULL, '54', NULL, '65', NULL, '', '', '', '', '', '', '', ''),
(9, 6, '100', NULL, '101', NULL, '100', NULL, '0', NULL, '0', NULL, '0', NULL, '0', NULL, '0', NULL, '', '', '', '0', '0', '0', '0', '0'),
(10, 7, '180', NULL, '105', NULL, '102', NULL, '101', NULL, '103', NULL, '0', NULL, '0', NULL, '0', NULL, '', '', '', '', '', '0', '0', '0'),
(11, 8, '4', NULL, '0', NULL, '0', NULL, '0', NULL, '0', NULL, '0', NULL, '0', NULL, '0', NULL, '', '0', '0', '0', '0', '0', '0', '0');
-- --------------------------------------------------------
--
-- Table structure for table `tbtmp_rod_cement_sale`
--
CREATE TABLE `tbtmp_rod_cement_sale` (
`id` int(11) NOT NULL,
`tmpId` varchar(50) NOT NULL,
`itemId` varchar(10) NOT NULL,
`txtUnitPrice` varchar(20) NOT NULL,
`txtQuantity` varchar(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `tbtmp_rod_cement_sale`
--
INSERT INTO `tbtmp_rod_cement_sale` (`id`, `tmpId`, `itemId`, `txtUnitPrice`, `txtQuantity`) VALUES
(1, '599074', '4', '385', '2'),
(2, '599074', '7', '390', '2'),
(3, '445505', '10', '90', '65'),
(4, '994677', '2', '78', '2'),
(5, '445505', '2', '78', '23'),
(6, '125765', '4', '385', '1'),
(7, '167373', '4', '385', '10'),
(8, '729058', '4', '385', '1'),
(9, '114720', '4', '385', '11'),
(10, '117079', '4', '385', '1');
-- --------------------------------------------------------
--
-- Table structure for table `tbtmp_tin_sheet_tua_sale`
--
CREATE TABLE `tbtmp_tin_sheet_tua_sale` (
`id` int(11) NOT NULL,
`tmpId` int(11) NOT NULL,
`item_id` int(11) NOT NULL,
`s6feet` varchar(100) NOT NULL DEFAULT '0',
`s7feet` varchar(100) NOT NULL DEFAULT '0',
`s8feet` varchar(100) NOT NULL DEFAULT '0',
`s9feet` varchar(100) NOT NULL DEFAULT '0',
`s10feet` varchar(100) NOT NULL DEFAULT '0',
`s11feet` varchar(100) NOT NULL DEFAULT '0',
`s12feet` varchar(100) NOT NULL DEFAULT '0',
`s13feet` varchar(100) NOT NULL DEFAULT '0',
`s6feet_pr` varchar(50) NOT NULL DEFAULT '0',
`s7feet_pr` varchar(50) NOT NULL DEFAULT '0',
`s8feet_pr` varchar(50) NOT NULL DEFAULT '0',
`s9feet_pr` varchar(50) NOT NULL DEFAULT '0',
`s10feet_pr` varchar(50) NOT NULL DEFAULT '0',
`s11feet_pr` varchar(50) NOT NULL DEFAULT '0',
`s12feet_pr` varchar(50) NOT NULL DEFAULT '0',
`s13feet_pr` varchar(50) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `tbtmp_tin_sheet_tua_sale`
--
INSERT INTO `tbtmp_tin_sheet_tua_sale` (`id`, `tmpId`, `item_id`, `s6feet`, `s7feet`, `s8feet`, `s9feet`, `s10feet`, `s11feet`, `s12feet`, `s13feet`, `s6feet_pr`, `s7feet_pr`, `s8feet_pr`, `s9feet_pr`, `s10feet_pr`, `s11feet_pr`, `s12feet_pr`, `s13feet_pr`) VALUES
(1, 79976, 1, '3', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0'),
(2, 79976, 5, '6', '0', '0', '0', '0', '0', '0', '0', '11', '0', '0', '0', '0', '0', '0', '0');
-- --------------------------------------------------------
--
-- Table structure for table `tbtools`
--
CREATE TABLE `tbtools` (
`id` int(11) NOT NULL,
`purpose` varchar(250) NOT NULL,
`br_id` int(11) NOT NULL,
`companyName` text NOT NULL,
`slogan` text NOT NULL,
`email` text NOT NULL,
`phone` text NOT NULL,
`address` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `tbtools`
--
INSERT INTO `tbtools` (`id`, `purpose`, `br_id`, `companyName`, `slogan`, `email`, `phone`, `address`) VALUES
(1, 'invoice', 1, 'মেসার্স সালাম এন্ড ব্রাদার্স', '*** জিনিস যেটা ভাল দাম তার একটু বেশি ***', 'salambrothers@gmail.com', '০২-৭৭৪৭৩০৬, ০১৮৭৮১০২৭২০', 'ঢাকা-আরিচা রোড-,১০৬ ডগরমোড়া ,সাভার ,ঢাকা।');
-- --------------------------------------------------------
--
-- Table structure for table `tbusers`
--
CREATE TABLE `tbusers` (
`id` int(11) NOT NULL,
`name` varchar(255) NOT NULL,
`phone` varchar(255) NOT NULL,
`email` varchar(255) NOT NULL,
`address` text NOT NULL,
`type` int(11) NOT NULL,
`password` varchar(200) NOT NULL,
`username` varchar(200) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `tbusers`
--
INSERT INTO `tbusers` (`id`, `name`, `phone`, `email`, `address`, `type`, `password`, `username`) VALUES
(9, 'Samsujjaman', '01672331428', 'samsujjamanbappy@gmail.com', 'Uttara', 2, '9996535e07258a7bbfd8b132435c5962', 'Samsujjaman'),
(10, 'সামসুজ্বাজামান বাপ্পি', '০১৮২৪১৬৮৯৯৬ ', 'samsujjamanbappy@gmail.com', '', 2, '69de285a4d70065f82056ad48d39df4c', 'bappy'),
(11, 'Ripon', '01720589853', 'r@gmail.com', '1234', 5, '827ccb0eea8a706c4c34a16891f84e7b', '123');
-- --------------------------------------------------------
--
-- Table structure for table `tsuppliers`
--
CREATE TABLE `tsuppliers` (
`id` int(11) NOT NULL,
`name` varchar(255) NOT NULL,
`phone` varchar(255) NOT NULL,
`email` varchar(255) NOT NULL,
`address` text NOT NULL,
`username` varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `tsuppliers`
--
INSERT INTO `tsuppliers` (`id`, `name`, `phone`, `email`, `address`, `username`) VALUES
(2, 'test', '01720589853', 'r@gmail.com', '123', 'test'),
(3, 'holsim cement', 'ddfmfhmhdmfh', 'bgnfmhfmfhm', 'dfhhgnn', 'fhhryjryjyrdssv');
-- --------------------------------------------------------
--
-- Table structure for table `tsuppliers_details`
--
CREATE TABLE `tsuppliers_details` (
`id` int(11) NOT NULL,
`supplier_id` int(11) NOT NULL,
`tbrod_cement_id` int(11) DEFAULT NULL,
`tbtin_sheet_tua_id` int(11) DEFAULT NULL,
`purchases_price` int(11) NOT NULL,
`item` int(11) NOT NULL,
`inDate` date NOT NULL,
`inTime` varchar(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `tsuppliers_details`
--
INSERT INTO `tsuppliers_details` (`id`, `supplier_id`, `tbrod_cement_id`, `tbtin_sheet_tua_id`, `purchases_price`, `item`, `inDate`, `inTime`) VALUES
(3, 2, 11, NULL, 1111, 1111, '2018-08-01', '03:01:23 pm'),
(4, 2, 11, NULL, 1500, 200, '2018-08-08', '06:15:42 pm'),
(5, 2, 11, NULL, 11, 300, '2018-08-08', '06:17:36 pm'),
(6, 2, 11, NULL, 111, 100, '2018-08-08', '06:20:43 pm'),
(7, 3, 8, NULL, 200, 100, '2018-08-08', '10:43:59 pm');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `tbaccountbalance`
--
ALTER TABLE `tbaccountbalance`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `tbcashtransfer`
--
ALTER TABLE `tbcashtransfer`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `tbcategory`
--
ALTER TABLE `tbcategory`
ADD PRIMARY KEY (`item_id`);
--
-- Indexes for table `tbchart_account`
--
ALTER TABLE `tbchart_account`
ADD PRIMARY KEY (`ca_id`);
--
-- Indexes for table `tbhead_account`
--
ALTER TABLE `tbhead_account`
ADD PRIMARY KEY (`h_acc_id`);
--
-- Indexes for table `tbinvoice`
--
ALTER TABLE `tbinvoice`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `tbitem_type`
--
ALTER TABLE `tbitem_type`
ADD PRIMARY KEY (`type_id`);
--
-- Indexes for table `tblocation`
--
ALTER TABLE `tblocation`
ADD PRIMARY KEY (`l_id`);
--
-- Indexes for table `tbpayments`
--
ALTER TABLE `tbpayments`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `tbreceivable_payments`
--
ALTER TABLE `tbreceivable_payments`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `tbreceive_amount`
--
ALTER TABLE `tbreceive_amount`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `tbrod_cement`
--
ALTER TABLE `tbrod_cement`
ADD PRIMARY KEY (`rc_id`),
ADD KEY `supplier_id` (`supplier_id`);
--
-- Indexes for table `tbrod_cement_sale`
--
ALTER TABLE `tbrod_cement_sale`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `tbsuppliers_purchases_details`
--
ALTER TABLE `tbsuppliers_purchases_details`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `tbtin_sheet_tua`
--
ALTER TABLE `tbtin_sheet_tua`
ADD PRIMARY KEY (`tst_id`);
--
-- Indexes for table `tbtin_sheet_tua_sale`
--
ALTER TABLE `tbtin_sheet_tua_sale`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `tbtin_sheet_tua_stock`
--
ALTER TABLE `tbtin_sheet_tua_stock`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `tbtmp_rod_cement_sale`
--
ALTER TABLE `tbtmp_rod_cement_sale`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `tbtmp_tin_sheet_tua_sale`
--
ALTER TABLE `tbtmp_tin_sheet_tua_sale`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `tbtools`
--
ALTER TABLE `tbtools`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `tbusers`
--
ALTER TABLE `tbusers`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `tsuppliers`
--
ALTER TABLE `tsuppliers`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `tsuppliers_details`
--
ALTER TABLE `tsuppliers_details`
ADD PRIMARY KEY (`id`),
ADD KEY `supplier_id` (`supplier_id`),
ADD KEY `supplier_id_2` (`supplier_id`),
ADD KEY `tbrod_cement_id` (`tbrod_cement_id`),
ADD KEY `tbtin_sheet_tua_id` (`tbtin_sheet_tua_id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `tbaccountbalance`
--
ALTER TABLE `tbaccountbalance`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=28;
--
-- AUTO_INCREMENT for table `tbcashtransfer`
--
ALTER TABLE `tbcashtransfer`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `tbcategory`
--
ALTER TABLE `tbcategory`
MODIFY `item_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=17;
--
-- AUTO_INCREMENT for table `tbchart_account`
--
ALTER TABLE `tbchart_account`
MODIFY `ca_id` int(3) UNSIGNED ZEROFILL NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=24;
--
-- AUTO_INCREMENT for table `tbhead_account`
--
ALTER TABLE `tbhead_account`
MODIFY `h_acc_id` int(3) UNSIGNED ZEROFILL NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
--
-- AUTO_INCREMENT for table `tbinvoice`
--
ALTER TABLE `tbinvoice`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=15;
--
-- AUTO_INCREMENT for table `tbitem_type`
--
ALTER TABLE `tbitem_type`
MODIFY `type_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=17;
--
-- AUTO_INCREMENT for table `tblocation`
--
ALTER TABLE `tblocation`
MODIFY `l_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=44;
--
-- AUTO_INCREMENT for table `tbpayments`
--
ALTER TABLE `tbpayments`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `tbreceivable_payments`
--
ALTER TABLE `tbreceivable_payments`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=38;
--
-- AUTO_INCREMENT for table `tbreceive_amount`
--
ALTER TABLE `tbreceive_amount`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `tbrod_cement`
--
ALTER TABLE `tbrod_cement`
MODIFY `rc_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12;
--
-- AUTO_INCREMENT for table `tbrod_cement_sale`
--
ALTER TABLE `tbrod_cement_sale`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;
--
-- AUTO_INCREMENT for table `tbsuppliers_purchases_details`
--
ALTER TABLE `tbsuppliers_purchases_details`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
--
-- AUTO_INCREMENT for table `tbtin_sheet_tua`
--
ALTER TABLE `tbtin_sheet_tua`
MODIFY `tst_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;
--
-- AUTO_INCREMENT for table `tbtin_sheet_tua_sale`
--
ALTER TABLE `tbtin_sheet_tua_sale`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=21;
--
-- AUTO_INCREMENT for table `tbtin_sheet_tua_stock`
--
ALTER TABLE `tbtin_sheet_tua_stock`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12;
--
-- AUTO_INCREMENT for table `tbtmp_rod_cement_sale`
--
ALTER TABLE `tbtmp_rod_cement_sale`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11;
--
-- AUTO_INCREMENT for table `tbtmp_tin_sheet_tua_sale`
--
ALTER TABLE `tbtmp_tin_sheet_tua_sale`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT for table `tbtools`
--
ALTER TABLE `tbtools`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `tbusers`
--
ALTER TABLE `tbusers`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12;
--
-- AUTO_INCREMENT for table `tsuppliers`
--
ALTER TABLE `tsuppliers`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT for table `tsuppliers_details`
--
ALTER TABLE `tsuppliers_details`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `tbrod_cement`
--
ALTER TABLE `tbrod_cement`
ADD CONSTRAINT `tbrod_cement_suppliers_foreign_key` FOREIGN KEY (`supplier_id`) REFERENCES `tsuppliers` (`id`) ON DELETE SET NULL ON UPDATE CASCADE;
--
-- Constraints for table `tsuppliers_details`
--
ALTER TABLE `tsuppliers_details`
ADD CONSTRAINT `suppliers_details_suppliers_foreign_key` FOREIGN KEY (`supplier_id`) REFERENCES `tsuppliers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `tbrod_cement_suppliers_details_foreign_key` FOREIGN KEY (`tbrod_cement_id`) REFERENCES `tbrod_cement` (`rc_id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `tbtin_sheet_tua_suppliers_details_foreign_key` FOREIGN KEY (`tbtin_sheet_tua_id`) REFERENCES `tbtin_sheet_tua` (`tst_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 */;
|
-- phpMyAdmin SQL Dump
-- version 4.9.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Dec 16, 2019 at 04:21 AM
-- Server version: 10.4.8-MariaDB
-- PHP Version: 7.3.11
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: `donasi`
--
-- --------------------------------------------------------
--
-- Table structure for table `donaturs`
--
CREATE TABLE `donaturs` (
`id` bigint(20) UNSIGNED NOT NULL,
`nama` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`jumlah_donasi` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL,
`no_wa` varchar(15) COLLATE utf8mb4_unicode_ci NOT NULL,
`gambar` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `donaturs`
--
INSERT INTO `donaturs` (`id`, `nama`, `jumlah_donasi`, `no_wa`, `gambar`, `created_at`, `updated_at`) VALUES
(20, 'Toniyansyah Wahyudi', '10.000', '08558886129', 'gambars/XqIqTegD8S5TtDyXfawJcjqMOL7VYSGvy9RJMSEY.jpeg', '2019-12-10 23:50:43', '2019-12-11 20:20:07'),
(21, 'waw', '100.000', '0555−5555−5555', 'gambars/0k8jiASzllW5I5OIwiSF5NaPjZXze5rOKDJBcGNT.jpeg', '2019-12-11 01:45:40', '2019-12-11 01:45:40'),
(22, 'Arif', '50.000', '0854−4444−44444', 'gambars/R2ZsMFwdU95rd5AqjRkleAllSX98MN7Osh7sUzl8.jpeg', '2019-12-12 00:11:36', '2019-12-12 00:11:36'),
(24, 'isal', '90.000', '0785−5454−64655', 'gambars/B3K2NZA2d4rWs4NHMKep7GlqqwPy1KwRIDnHnkiB.jpeg', '2019-12-12 00:25:54', '2019-12-12 00:25:54'),
(25, 'petet', '40.000', '5865−4564−68545', 'gambars/Enc1ZTkJCZq2TcxQssPTb901Vg9USEJyhCfE8to6.jpeg', '2019-12-12 00:30:40', '2019-12-12 00:30:40'),
(26, 'Toniyansyah Wahyudi', '1.000.000', '0855−8886−129', 'gambars/mvfdHzlOF0mMcy6N6qnulaI1GxQd1Vt2hqWxdjcP.jpeg', '2019-12-12 00:33:46', '2019-12-12 00:33:46');
-- --------------------------------------------------------
--
-- Table structure for table `failed_jobs`
--
CREATE TABLE `failed_jobs` (
`id` bigint(20) UNSIGNED NOT NULL,
`connection` text COLLATE utf8mb4_unicode_ci NOT NULL,
`queue` text COLLATE utf8mb4_unicode_ci NOT NULL,
`payload` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
`exception` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
`failed_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `migrations`
--
CREATE TABLE `migrations` (
`id` int(10) UNSIGNED NOT NULL,
`migration` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`batch` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `migrations`
--
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES
(1, '2014_10_12_000000_create_users_table', 1),
(2, '2014_10_12_100000_create_password_resets_table', 1),
(3, '2019_08_19_000000_create_failed_jobs_table', 1),
(4, '2019_12_10_023930_create_donaturs_table', 1);
-- --------------------------------------------------------
--
-- Table structure for table `password_resets`
--
CREATE TABLE `password_resets` (
`email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`token` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `password_resets`
--
INSERT INTO `password_resets` (`email`, `token`, `created_at`) VALUES
('admin@mail.com', '$2y$10$EzFQNkrO29VHBAkC.55xzOaPBmYvbc1jXUunM6IzK3P6eMoUUGiyq', '2019-12-11 01:10:02'),
('toniyansyah205@gmail.com', '$2y$10$2LEk9ZhpUHW8nf5vjGoi2.7zcVIwaR/WrQAicfkHKttHoxNFBpm72', '2019-12-11 02:01:46');
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
CREATE TABLE `users` (
`id` bigint(20) UNSIGNED NOT NULL,
`name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`email_verified_at` timestamp NULL DEFAULT NULL,
`password` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`remember_token` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `users`
--
INSERT INTO `users` (`id`, `name`, `email`, `email_verified_at`, `password`, `remember_token`, `created_at`, `updated_at`) VALUES
(2, 'admin', 'admin@mail.com', NULL, '$2y$10$UUW/tOHg.YoI6kV.QPKYDO/fD/izhRFRReJ9ksP6egk/PT1oZqwkC', NULL, '2019-12-11 01:11:35', '2019-12-11 01:11:35');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `donaturs`
--
ALTER TABLE `donaturs`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `failed_jobs`
--
ALTER TABLE `failed_jobs`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `migrations`
--
ALTER TABLE `migrations`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `password_resets`
--
ALTER TABLE `password_resets`
ADD KEY `password_resets_email_index` (`email`);
--
-- Indexes for table `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `users_email_unique` (`email`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `donaturs`
--
ALTER TABLE `donaturs`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=27;
--
-- AUTO_INCREMENT for table `failed_jobs`
--
ALTER TABLE `failed_jobs`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `migrations`
--
ALTER TABLE `migrations`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
Begin Transaction;
Drop Table If Exists [regions];
CREATE TABLE [regions] (
[id] INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
[parent_id] INT NOT NULL,
[name] TEXT NOT NULL,
[notes] TEXT,
[basic_type_id] INT,
[level] INT,
[is_leaf] BOOLEAN,
[shoot_sequence_num] INT,
[standard_ir_file_name] TEXT,
[standard_ir_content_type] CHAR,
[standard_ir_file_size] INT,
[standard_ir_updated_at] DATETIME,
[standard_ir_md5] [TEXT(32)],
[standard_ir_unsatisfy] BOOLEAN,
UNIQUE([parent_id], [name]));
Commit Transaction;
|
SELECT A.Name Employee
FROM Employee A, Employee B
WHERE A.ManagerId = B.Id AND A.Salary > B.Salary
|
SET @dbName = 'name_of_database';
SELECT `TABLE_NAME`
FROM `information_schema`.`TABLES`
WHERE
`TABLE_SCHEMA` = @dbName
; |
declare
l_msg long;
l_status number;
begin
dbms_alert.register('WAITING');
for i in 1 .. 999999 loop
dbms_application_info.set_client_info( i );
dbms_alert.waitone('WAITING', l_msg, l_status, 0);
exit when l_status = 0;
for x in (select * from t order by 1, 2, 3, 4)
loop
null;
end loop;
end loop;
end;
/
|
-- MySQL dump 10.13 Distrib 5.7.17, for Win64 (x86_64)
--
-- Host: 127.0.0.1 Database: bd_pan
-- ------------------------------------------------------
-- Server version 5.5.5-10.4.6-MariaDB
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES 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 `partidas`
--
DROP TABLE IF EXISTS `partidas`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `partidas` (
`idpartidas` int(11) NOT NULL AUTO_INCREMENT,
`descripcion` varchar(45) DEFAULT NULL,
`total` varchar(45) DEFAULT NULL,
`solicitudes_folio` int(11) NOT NULL,
PRIMARY KEY (`idpartidas`),
KEY `fk_partidas_solicitudes_idx` (`solicitudes_folio`),
CONSTRAINT `fk_partidas_solicitudes` FOREIGN KEY (`solicitudes_folio`) REFERENCES `solicitudes` (`folio`) 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 `partidas`
--
LOCK TABLES `partidas` WRITE;
/*!40000 ALTER TABLE `partidas` DISABLE KEYS */;
/*!40000 ALTER TABLE `partidas` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `proveedor`
--
DROP TABLE IF EXISTS `proveedor`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `proveedor` (
`idproveedor` int(11) NOT NULL AUTO_INCREMENT,
`razon_social` varchar(100) DEFAULT NULL,
`nombre_contacto` varchar(45) DEFAULT NULL,
`RFC` varchar(20) DEFAULT NULL,
`banco` varchar(45) DEFAULT NULL,
`clabe` varchar(18) DEFAULT NULL,
`direccion` varchar(45) DEFAULT NULL,
`telefono` varchar(45) DEFAULT NULL,
`celular` varchar(45) DEFAULT NULL,
`correo` varchar(45) DEFAULT NULL,
`ciudad` varchar(45) DEFAULT NULL,
`estado` varchar(45) DEFAULT NULL,
`id_ine` varchar(45) DEFAULT NULL,
PRIMARY KEY (`idproveedor`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `proveedor`
--
LOCK TABLES `proveedor` WRITE;
/*!40000 ALTER TABLE `proveedor` DISABLE KEYS */;
/*!40000 ALTER TABLE `proveedor` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `solicitudes`
--
DROP TABLE IF EXISTS `solicitudes`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `solicitudes` (
`folio` int(11) NOT NULL AUTO_INCREMENT,
`Fecha` date DEFAULT NULL,
`Nombre` varchar(45) DEFAULT NULL,
`area` varchar(45) DEFAULT NULL,
`denominacion_comision` varchar(450) DEFAULT NULL,
`estado_origen` varchar(45) DEFAULT NULL,
`ciudad_origen` varchar(45) DEFAULT NULL,
`estado_destino` varchar(45) DEFAULT NULL,
`ciudad_destino` varchar(45) DEFAULT NULL,
`fecha_inicio` date DEFAULT NULL,
`fecha_fin` date DEFAULT NULL,
`motivo` varchar(45) DEFAULT NULL,
`estado` varchar(45) DEFAULT 'pendiente',
`total` varchar(45) DEFAULT NULL,
`pago_prov` int(11) DEFAULT NULL,
`usuarios_idusuarios` int(11) NOT NULL,
PRIMARY KEY (`folio`),
KEY `fk_solicitudes_usuarios1_idx` (`usuarios_idusuarios`),
CONSTRAINT `fk_solicitudes_usuarios1` FOREIGN KEY (`usuarios_idusuarios`) REFERENCES `usuarios` (`idusuarios`) 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 `solicitudes`
--
LOCK TABLES `solicitudes` WRITE;
/*!40000 ALTER TABLE `solicitudes` DISABLE KEYS */;
/*!40000 ALTER TABLE `solicitudes` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `usuarios`
--
DROP TABLE IF EXISTS `usuarios`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `usuarios` (
`idusuarios` int(11) NOT NULL AUTO_INCREMENT,
`nombre` varchar(45) DEFAULT NULL,
`apellidos` varchar(45) DEFAULT NULL,
`telefono` varchar(45) DEFAULT NULL,
`correo` varchar(45) DEFAULT NULL,
`departamento` varchar(45) DEFAULT NULL,
`comite_municipal` varchar(45) DEFAULT NULL,
`delegacion` varchar(45) DEFAULT NULL,
`comision` varchar(45) DEFAULT NULL,
`celular` varchar(45) DEFAULT NULL,
`password` text DEFAULT NULL,
`nivel` int(11) DEFAULT NULL,
`estado` int(11) DEFAULT 1,
PRIMARY KEY (`idusuarios`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `usuarios`
--
LOCK TABLES `usuarios` WRITE;
/*!40000 ALTER TABLE `usuarios` DISABLE KEYS */;
INSERT INTO `usuarios` VALUES (1,'Carlos Humberto','Romero Callejas','2288387334','carlos920228@gmail.com','sistemas','xalapa','xalapa','1','2288387334','0',1,1),(4,'Juan','Perez','8141516','perez@gmail.com','Sistemas','Xalapa','Xalapa','Xalapa','2288387334','perez',0,1);
/*!40000 ALTER TABLE `usuarios` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2019-10-23 19:02:09
|
--------------------------------------------------------
-- DDL for Table MOBILEUM_ASP_HOUR
--------------------------------------------------------
CREATE TABLE MOBILEUM_ASP_HOUR
( PAIS CHAR(3 CHAR),
FECHA DATE,
CNT_LLAMADAS NUMBER,
CNT_POLITICA_RESTRICCION NUMBER,
CNT_BOLQ_REL_TIPO_GEST NUMBER,
CNT_BLOQ_RAN_REL NUMBER,
CNT_PERMITIERON_CONTINUAR NUMBER,
CNT_CONECTADAS_VOICE_MAIL NUMBER,
CNT_CONECTADA_ANUNCIO_SWITCH NUMBER
)
NOCOMPRESS NOLOGGING
TABLESPACE TBS_HOUR ;
COMMENT ON COLUMN MOBILEUM_ASP_HOUR.PAIS IS 'Pais. Ej. ARG';
COMMENT ON COLUMN MOBILEUM_ASP_HOUR.FECHA IS 'Rango horario.';
COMMENT ON COLUMN MOBILEUM_ASP_HOUR.CNT_LLAMADAS IS 'Cantidad de llamadas totales.';
COMMENT ON COLUMN MOBILEUM_ASP_HOUR.CNT_POLITICA_RESTRICCION IS 'Cantidad de llamadas que matchearon alguna política de restricción.';
COMMENT ON COLUMN MOBILEUM_ASP_HOUR.CNT_BOLQ_REL_TIPO_GEST IS 'Cantidad de llamadas bloqueadas con release tipo congestión.';
COMMENT ON COLUMN MOBILEUM_ASP_HOUR.CNT_BLOQ_RAN_REL IS 'Cantidad de llamadas bloqueadas con random releases.';
COMMENT ON COLUMN MOBILEUM_ASP_HOUR.CNT_PERMITIERON_CONTINUAR IS 'Cantidad de llamadas que se permitieron continuar.';
COMMENT ON COLUMN MOBILEUM_ASP_HOUR.CNT_CONECTADAS_VOICE_MAIL IS 'Cantidad de llamadas conectadas al Voice Mail.';
COMMENT ON COLUMN MOBILEUM_ASP_HOUR.CNT_CONECTADA_ANUNCIO_SWITCH IS 'Cantidad de llamadas conectadas a un anuncio en el switch.';
COMMENT ON TABLE MOBILEUM_ASP_HOUR IS 'Tabla contenedora de datos correspondientes a plataforma MOBILEUM, proveedor ANTISPAMMING (ASP)';
--------------------------------------------------------
-- DDL for Index MOBILEUM_ASP_HOUR_PK
--------------------------------------------------------
CREATE UNIQUE INDEX MOBILEUM_ASP_HOUR_PK ON MOBILEUM_ASP_HOUR (PAIS, FECHA)
TABLESPACE TBS_HOUR ;
--------------------------------------------------------
-- Constraints for Table MOBILEUM_ASP_HOUR
--------------------------------------------------------
ALTER TABLE MOBILEUM_ASP_HOUR ADD CONSTRAINT MOBILEUM_ASP_HOUR_PK PRIMARY KEY (PAIS, FECHA) ENABLE;
ALTER TABLE MOBILEUM_ASP_HOUR MODIFY (CNT_CONECTADA_ANUNCIO_SWITCH NOT NULL ENABLE);
ALTER TABLE MOBILEUM_ASP_HOUR MODIFY (CNT_CONECTADAS_VOICE_MAIL NOT NULL ENABLE);
ALTER TABLE MOBILEUM_ASP_HOUR MODIFY (CNT_PERMITIERON_CONTINUAR NOT NULL ENABLE);
ALTER TABLE MOBILEUM_ASP_HOUR MODIFY (CNT_BLOQ_RAN_REL NOT NULL ENABLE);
ALTER TABLE MOBILEUM_ASP_HOUR MODIFY (CNT_BOLQ_REL_TIPO_GEST NOT NULL ENABLE);
ALTER TABLE MOBILEUM_ASP_HOUR MODIFY (CNT_POLITICA_RESTRICCION NOT NULL ENABLE);
ALTER TABLE MOBILEUM_ASP_HOUR MODIFY (CNT_LLAMADAS NOT NULL ENABLE);
ALTER TABLE MOBILEUM_ASP_HOUR MODIFY (FECHA NOT NULL ENABLE);
ALTER TABLE MOBILEUM_ASP_HOUR MODIFY (PAIS NOT NULL ENABLE);
|
'''
执行用时:246 ms, 在所有 MySQL 提交中击败了94.02% 的用户
内存消耗:0 B, 在所有 MySQL 提交中击败了100.00% 的用户
通过测试用例:15 / 15
'''
# Write your MySQL query statement below
select sell_date,
count(distinct product) as num_sold,
group_concat(distinct product order by product separator ',') as products
from activities
group by sell_date
order by sell_date
|
-- Question on 'The Pad'
SELECT CONCAT(name, '(', substring(occupation, 1, 1), ')') AS names
FROM occupations
ORDER BY name;
SELECT CONCAT('There are a total of ', COUNT(occupation), ' ', LOWER(occupation), 's.')
FROM occupations
GROUP BY occupation
ORDER BY COUNT(occupation);
-- Question on 'Occupation'
WITH main_table AS (
SELECT *
FROM occupations
ORDER BY name
), doctor AS (
SELECT ROW_NUMBER() OVER () id, name
FROM main_table
WHERE occupation LIKE 'Doctor'
), professor AS (
SELECT ROW_NUMBER() OVER () id, name
FROM main_table
WHERE occupation LIKE 'Professor'
), singer AS (
SELECT ROW_NUMBER() OVER () id, name
FROM main_table
WHERE occupation LIKE 'Singer'
), actor AS (
SELECT ROW_NUMBER() OVER () id, name
FROM main_table
WHERE occupation LIKE 'Actor'
)
-- Select cluase when Null should be in string
/*
SELECT CASE WHEN (d.name IS Null) THEN 'Null' ELSE d.name END Doctor,
p.name Professor,
CASE WHEN (s.name IS Null) THEN 'Null' ELSE s.name END Singer,
CASE WHEN (a.name IS Null) THEN 'Null' ELSE a.name END Actor
*/
-- Select cluase when it should be Null
SELECT d.name Doctor, p.name Professor, s.name Singer, a.name Actor
FROM professor p
LEFT JOIN doctor d
ON p.id = d.id
LEFT JOIN singer s
ON p.id = s.id
LEFT JOIN actor a
ON p.id = a.id;
-- Question on Binary Tree Node
SELECT n, CASE WHEN (p IS Null) THEN 'Root'
WHEN (n IN (SELECT DISTINCT p FROM BST)) THEN 'Inner'
ELSE 'Leaf'
END type
FROM BST
ORDER BY n;
-- Question on 'SQL Project Planning'
-- Approach 1
SELECT Start_Date, MIN(End_Date)
FROM (
SELECT Start_Date FROM Projects WHERE Start_Date NOT IN (SELECT End_Date FROM Projects)
) AS s,
(
SELECT End_Date FROM Projects WHERE End_Date NOT IN (SELECT Start_Date FROM Projects)
) AS e
WHERE Start_Date < End_Date
GROUP BY Start_Date
ORDER BY DATEDIFF(MIN(End_Date), Start_Date), Start_Date;
-- Approach 2
Select Start_Date, MIN(End_Date)
From (
Select b.Start_Date
From Projects as a
RIGHT Join Projects as b
ON b.Start_Date = a.End_Date
WHERE a.Start_Date IS NULL
) sd,
(Select a.End_Date
From Projects as a
Left Join Projects as b
ON b.Start_Date = a.End_Date
WHERE b.End_Date IS NULL
) ed
Where Start_Date < End_Date
GROUP BY Start_Date
ORDER BY datediff(MIN(End_Date), Start_Date), Start_Date
-- Medium - New Companies
SELECT c.company_code, c.founder, COUNT(DISTINCT e.lead_manager_code) total_lm,
COUNT(DISTINCT e.senior_manager_code) total_sm,
COUNT(DISTINCT e.manager_code) total_m,
COUNT(DISTINCT e.employee_code) total_emp
FROM Employee e
JOIN Company c
ON c.company_code = e.company_code
GROUP BY 1, 2
ORDER BY 1;
-- Medium -
SELECT CASE WHEN ((A + B) <= C) OR ((B + C) <= A) OR ((A + C) <= B) THEN 'Not A Triangle'
WHEN (A = B) AND (B = C) THEN 'Equilateral'
WHEN (A = B) OR (B = C) OR (A = C) THEN 'Isosceles'
ELSE 'Scalene' END AS Types
FROM triangles;
-- https://www.hackerrank.com/challenges/weather-observation-station-18/problem
SELECT ROUND((MAX(lat_n) - MIN(lat_n)) + (MAX(long_w) - MIN(long_w)), 4) s
FROM station;
SELECT ROUND(SQRT(POWER((MAX(lat_n) - MIN(lat_n)), 2) + POWER((MAX(long_w) - MIN(long_w)), 2)), 4) s
FROM station;
SELECT CEILING(AVG(salary) - AVG(CAST(REPLACE(CONCAT(salary, ''), '0', '') AS SIGNED)))
FROM employees; |
CREATE USER "mundosde" WITH PASSWORD E'md5777935f8f1e4928ef6155b24be296eb9';
|
Create Procedure mERP_Sp_CountMargin
AS
Select Count(*) from tbl_mERP_MarginDetail MDet Inner Join tbl_mERP_MarginAbstract MAbs
On MAbs.marginID = MDet.MarginID
where dbo.StripTimefromDate(CreationDate) = DATEADD(D, 0, DATEDIFF(D, 0, GETDATE()))
and MAbs.ReceiveDocID <> 0
|
WITH
RECURSIVE PSE
(
------------EXPLOSION TRACKING----------------
LVL, PLINE, CLINE, MAST, MPLT, PRNT, COLD,
------------PROCUREMENT-----------------------
STAT, REPL,
------------ROUTING---------------------------
SEQ, DEP, RESC, OPC, REPP, REFF, XREFF,
------------BILL OF MATERIALS-----------------
RQBY, BACK, SCRP, EFF, QTY, BQTY, RQTY, ERQTY,
------------UOM CONVERSIONS-------------------
UNTI, BUOM, CONV,
------------SOURCING--------------------------
CPLNT, SPLNT,
------------CURRENCY--------------------------
CPC, SPC, FXR
) AS
(
SELECT
0,
VARCHAR (SUBSTR (DIGITS (INT (RANK () OVER (ORDER BY A.V6PART ASC, A.V6PLNT ASC))), 6, 5), 100) ||
CASE WHEN AOSEQ# < 10
THEN SUBSTR (DIGITS (- AOSEQ# + 9), 2, 3)
ELSE ''
END AS PLINE,
VARCHAR (SUBSTR (DIGITS (INT (RANK () OVER (ORDER BY A.V6PART ASC, A.V6PLNT ASC))), 6, 5), 100) || SUBSTR (DIGITS (- AOSEQ# + 10), 2, 3) AS CLINE,
A.V6PART,
A.V6PLNT,
A.V6PART,
A.V6PART,
A.V6STAT,
A.V6RPLN,
AOSEQ#,
AODEPT,
COALESCE (APVEND, AORESC),
COALESCE (APODES, AOOPNM),
AOREPP,
ROUND (FLOAT (1 / IFNULL (AOEFC1, 1)), 8),
ROUND (FLOAT (1 / IFNULL (AOEFC1, 1)), 8),
'R',
' ',
1,
1,
1,
1,
1,
1,
A.V6UNTI,
A.V6UNTI,
FLOAT (1),
A.V6PLNT,
CASE A.V6RPLN WHEN '3' THEN A.V6TPLN ELSE A.V6PLNT END,
SUBSTR (CC.A215, 152, 2),
SUBSTR (SC.A215, 152, 2),
B86SRTE
FROM
QGPL.FFBSUPP SALES
LEFT OUTER JOIN LGDAT.STKA A ON
V6PART = SALES.PART AND
V6PLNT = SALES.PLNT
LEFT OUTER JOIN LGDAT.FUTHDR ON
AOPART = A.V6PART AND
AOPLNT = CASE A.V6RPLN WHEN '3' THEN A.V6TPLN ELSE A.V6PLNT END
LEFT OUTER JOIN LGDAT.FUTHDO ON
APPART = A.V6PART AND
APPLNT = CASE A.V6TPLN WHEN '' THEN A.V6PLNT ELSE A.V6TPLN END AND
A.V6RPLN = 1
LEFT OUTER JOIN LGDAT.PLNT CP ON
CP.YAPLNT = A.V6PLNT
LEFT OUTER JOIN LGDAT.PLNT SP ON
SP.YAPLNT = CASE A.V6RPLN WHEN '3' THEN A.V6TPLN ELSE A.V6PLNT END
LEFT OUTER JOIN LGDAT.CODE CC ON
LTRIM (RTRIM (CC.A9)) = CP.YACOMP AND
CC.A2 = 'AA'
LEFT OUTER JOIN LGDAT.CODE SC ON
LTRIM (RTRIM (SC.A9)) = SP.YACOMP AND
SC.A2 = 'AA'
LEFT OUTER JOIN LGDAT.CRET ON
B86COMN = SP.YACOMP AND
B86CURC = SUBSTR (CC.A215, 152, 2) AND
B86RTTY = 'S'
UNION ALL
SELECT
PSE.LVL + 1,
CASE WHEN AOSEQ# < 10
THEN PSE.CLINE || '-' || REPEAT ('0', 3 - LENGTH (VARCHAR (M.AQLIN#))) || VARCHAR (M.AQLIN#) || SUBSTR (DIGITS (COALESCE (- AOSEQ# + 9, AQSEQ#)), 2, 3)
ELSE VARCHAR (PSE.CLINE, 100)
END,
PSE.CLINE || '-' || REPEAT ('0', 3 - LENGTH (VARCHAR (M.AQLIN#))) || VARCHAR (M.AQLIN#) || SUBSTR (DIGITS (COALESCE (- AOSEQ# + 10, AQSEQ#)), 2, 3),
PSE.MAST,
PSE.MPLT,
PSE.COLD,
M.AQMTLP,
A.V6STAT,
A.V6RPLN,
COALESCE (AOSEQ#, AQSEQ#),
AODEPT,
COALESCE (APVEND, AORESC),
COALESCE (APODES, AOOPNM),
AOREPP,
ROUND (FLOAT (1 / IFNULL (AOEFC1, 1)), 8),
ROUND (FLOAT (1 / IFNULL (AOEFC1, 1)), 8) * PSE.XREFF,
M.AQRQBY,
M.AQBACK,
FLOAT (1 - M.AQSCRP / 100),
1,
M.AQQPPC,
M.AQQTYM,
FLOAT (M.AQQPPC / M.AQQTYM) / FLOAT (1 - M.AQSCRP / 100) * CASE M.AQRQBY WHEN 'B' THEN - 1 ELSE 1 END,
FLOAT (M.AQQPPC / M.AQQTYM) * FLOAT (PSE.ERQTY) / FLOAT (1 - M.AQSCRP / 100) * CASE M.AQRQBY WHEN 'B' THEN - 1 ELSE 1 END,
A.V6UNTI,
M.AQUNIT,
FLOAT (COALESCE (U.MULT_BY, 1)) * FLOAT (COALESCE (U2.MULT_BY, 1)) * PSE.CONV,
M.AQPLNT,
CASE A.V6RPLN WHEN '3' THEN A.V6TPLN ELSE M.AQPLNT END,
SUBSTR (CC.A215, 152, 2),
SUBSTR (SC.A215, 152, 2),
B86SRTE * PSE.FXR
FROM
PSE PSE
INNER JOIN LGDAT.FUTHDM M ON
M.AQPART = PSE.COLD AND
M.AQPLNT = PSE.SPLNT AND
M.AQSEQ# = IFNULL (PSE.SEQ, M.AQSEQ#) AND
----------MOD 10/20/15-------------
PSE.REPL <> '2'
LEFT OUTER JOIN LGDAT.STKA A ON
A.V6PART = M.AQMTLP AND
A.V6PLNT = M.AQPLNT
LEFT OUTER JOIN LGDAT.STKA A2 ON
A2.V6PART = M.AQMTLP AND
A2.V6PLNT = A.V6TPLN
LEFT OUTER JOIN LGDAT.FUTHDR ON
AOPART = M.AQMTLP AND
AOPLNT = CASE A.V6TPLN WHEN '' THEN A.V6PLNT ELSE A.V6TPLN END AND
A.V6RPLN = 1
LEFT OUTER JOIN LGDAT.FUTHDO ON
APPART = M.AQMTLP AND
APPLNT = CASE A.V6TPLN WHEN '' THEN A.V6PLNT ELSE A.V6TPLN END AND
A.V6RPLN = 1
LEFT OUTER JOIN
(
SELECT
IHUNT1 AS UNT1, IHUNT2 AS UNT2, IHCNV2 / IHCNV1 AS MULT_BY
FROM
LGDAT.PUNIT
WHERE
IHPART = '&&GLOBAL'
UNION ALL
SELECT
IHUNT2 AS UNT1, IHUNT1 AS UNT2, IHCNV1 / IHCNV2 AS MULT_BY
FROM
LGDAT.PUNIT
WHERE
IHPART = '&&GLOBAL'
) U ON
U.UNT1 = M.AQUNIT AND
U.UNT2 = A.V6UNTI
LEFT OUTER JOIN
(
SELECT
IHUNT1 AS UNT1, IHUNT2 AS UNT2, IHCNV2 / IHCNV1 AS MULT_BY
FROM
LGDAT.PUNIT
WHERE
IHPART = '&&GLOBAL'
UNION ALL
SELECT
IHUNT2 AS UNT1, IHUNT1 AS UNT2, IHCNV1 / IHCNV2 AS MULT_BY
FROM
LGDAT.PUNIT
WHERE
IHPART = '&&GLOBAL'
) U2 ON
LTRIM (RTRIM (U2.UNT1)) = A.V6UNTI AND
LTRIM (RTRIM (U2.UNT2)) = A2.V6UNTI
LEFT OUTER JOIN LGDAT.PLNT CP ON
CP.YAPLNT = M.AQPLNT
LEFT OUTER JOIN LGDAT.PLNT SP ON
SP.YAPLNT = CASE A.V6RPLN WHEN '3' THEN A.V6TPLN ELSE M.AQPLNT END
LEFT OUTER JOIN LGDAT.CODE CC ON
LTRIM (RTRIM (CC.A9)) = CP.YACOMP AND
CC.A2 = 'AA'
LEFT OUTER JOIN LGDAT.CODE SC ON
LTRIM (RTRIM (SC.A9)) = SP.YACOMP AND
SC.A2 = 'AA'
LEFT OUTER JOIN LGDAT.CRET ON
B86COMN = SP.YACOMP AND
B86CURC = SUBSTR (CC.A215, 152, 2) AND
B86RTTY = 'S'
WHERE
LVL <= 10
AND PSE.REPL <> '4'
)
SELECT
MAST,
MPLT,
REPEAT ('. ', LVL) || LVL AS TLVL,
REPEAT ('. ', LVL) || COLD TPART,
REPEAT ('. ', LVL) || COALESCE (AWDES1, AVDES1) DESCR,
PLINE,
CLINE,
PSE.COLD PART,
CPLNT,
STAT,
REPL,
SPLNT,
SEQ,
AAOSRV OUTS,
DEP,
RESC,
OPC,
AOREPP,
REFF,
XREFF,
RQBY,
BACK,
IFNULL (MM.AVMAJG, MP.AWMAJG) MAJG,
IFNULL (MM.AVMING, MP.AWMING) || ' - ' || RTRIM (MMGP.BRDES) MING,
IFNULL (MM.AVGLCD, MP.AWGLDC) GLCD,
IFNULL (MM.AVGLED, MP.AWGLED) GLED,
SCRP,
--QTY, BQTY,
RQTY,
ERQTY,
ERQTY * (1 / XREFF - 1) ERQTYS,
UNTI,
BUOM,
CONV,
CPC,
SPC,
--FXR,
--COALESCE(IP.COCURR, IR.Y3FUT1) AS CURR,
COALESCE (IP.COSDAT, IR.Y3SDAT, IM.CNSDAT) DT,
IP.COSUC BASE,
IP.COSFC FRT,
IP.COSDC DUTY,
IP.COS1C MISC1,
IP.COS2C MISC2,
-------------------------MOD 10/20/15-----------------------------
CASE REPL WHEN '2' THEN IP.COSCC WHEN '3' THEN IR.Y3SOC ELSE 0 END AS CURR,
IR.Y3SSHC "S&H",
APFCSO "FRT-TO",
APFCSI "FRT-FROM",
APUNCS SUBC,
AORUNS RUNTIME,
AO#MEN / AO#MCH RUNCREW,
AOSETP SETTIME,
V6OPTR RUNSIZE,
AOSCRW SETCREW,
CASE R9LABR WHEN 0 THEN R8STDR ELSE R9LABR END LABRATE,
CASE R9BRDR WHEN 0 THEN R8BRDR ELSE R9BRDR END FIXRATE,
CASE R9VBRD WHEN 0 THEN R8VBRD ELSE R9VBRD END VARRATE,
CASE WHEN AAOSRV = 'Y'
THEN 0
ELSE
CASE R9LABR
WHEN 0 THEN
AASTDR
ELSE
R9LABR
END
/ AORUNS
* AO#MEN
/ AO#MCH
END LABRUN,
CASE WHEN AAOSRV = 'Y'
THEN 0
ELSE
CASE R9BRDR
WHEN 0 THEN
AABRDR
ELSE
R9BRDR
END
/ AORUNS
END FIXRUN,
CASE WHEN AAOSRV = 'Y'
THEN 0
ELSE
CASE R9VBRD
WHEN 0 THEN
AAVBRD
ELSE
R9VBRD
END
/ AORUNS
END VARRUN,
CASE R9LABR WHEN 0 THEN R8STDR ELSE R9LABR END * AOSETP * AOSCRW / V6OPTR LABSET,
CASE R9BRDR WHEN 0 THEN R8BRDR ELSE R9BRDR END * AOSETP / V6OPTR FIXSET,
CASE R9VBRD WHEN 0 THEN R8VBRD ELSE R9VBRD END * AOSETP / V6OPTR VARSET,
----------EXTENDED VALUES----------
IP.COSUC * ERQTY BASEX,
IP.COSFC * ERQTY FRTX,
IP.COSDC * ERQTY DUTYX,
IP.COS1C * ERQTY MULT1X,
IP.COS2C * ERQTY MULT2X,
IR.Y3SSHC * ERQTY SHIPHX,
APFCSO * ERQTY OSFTX,
APFCSI * ERQTY OSFFX,
CASE REPL WHEN '2' THEN IP.COSCC WHEN '3' THEN IR.Y3SOC ELSE 0 END * ERQTY AS CURRX,
APUNCS * ERQTY SUBCX,
CASE WHEN AAOSRV = 'Y' THEN 0 ELSE CASE R9LABR WHEN 0 THEN R8STDR ELSE R9LABR END / AORUNS * AO#MEN / AO#MCH * ERQTY END LABRX,
CASE WHEN AAOSRV = 'Y' THEN 0 ELSE CASE R9BRDR WHEN 0 THEN R8BRDR ELSE R9BRDR END / AORUNS * ERQTY END FIXRX,
CASE WHEN AAOSRV = 'Y' THEN 0 ELSE CASE R9VBRD WHEN 0 THEN R8VBRD ELSE R9VBRD END / AORUNS * ERQTY END VARRX,
CASE R9LABR WHEN 0 THEN R8STDR ELSE R9LABR END * AOSETP * AOSCRW / V6OPTR * ERQTY LABSX,
CASE R9BRDR WHEN 0 THEN R8BRDR ELSE R9BRDR END * AOSETP / V6OPTR * ERQTY FIXSX,
CASE R9VBRD WHEN 0 THEN R8VBRD ELSE R9VBRD END * AOSETP / V6OPTR * ERQTY VARSX,
--------SCRAP----------
IP.COSUC * ERQTY * (1 / XREFF - 1) BASEXS,
IP.COSFC * ERQTY * (1 / XREFF - 1) FRTXS,
IP.COSDC * ERQTY * (1 / XREFF - 1) DUTYXS,
IP.COS1C * ERQTY * (1 / XREFF - 1) MULT1XS,
IP.COS2C * ERQTY * (1 / XREFF - 1) MULT2XS,
IR.Y3SSHC * ERQTY * (1 / XREFF - 1) SHIPHXS,
APFCSO * ERQTY * (1 / XREFF - 1) OSFTXS,
APFCSI * ERQTY * (1 / XREFF - 1) OSFFXS,
CASE PSE.LVL WHEN '0' THEN 0 ELSE CASE REPL WHEN '2' THEN IP.COSCC WHEN '3' THEN IR.Y3SOC ELSE 0 END * ERQTY * (1 / XREFF - 1) END AS CURRXS,
APUNCS * ERQTY * (1 / XREFF - 1) SUBCXS,
CASE WHEN AAOSRV = 'Y' THEN 0 ELSE CASE R9LABR WHEN 0 THEN R8STDR ELSE R9LABR END / AORUNS * AO#MEN / AO#MCH * ERQTY * (1 / XREFF - 1) END LABRXS,
CASE WHEN AAOSRV = 'Y' THEN 0 ELSE CASE R9BRDR WHEN 0 THEN R8BRDR ELSE R9BRDR END / AORUNS * ERQTY * (1 / XREFF - 1) END FIXRXS,
CASE WHEN AAOSRV = 'Y' THEN 0 ELSE CASE R9VBRD WHEN 0 THEN R8VBRD ELSE R9VBRD END / AORUNS * ERQTY * (1 / XREFF - 1) END VARRXS,
CASE R9LABR WHEN 0 THEN R8STDR ELSE R9LABR END * AOSETP * AOSCRW / V6OPTR * ERQTY * (1 / XREFF - 1) LABSXS,
CASE R9BRDR WHEN 0 THEN R8BRDR ELSE R9BRDR END * AOSETP / V6OPTR * ERQTY * (1 / XREFF - 1) FIXSXS,
CASE R9VBRD WHEN 0 THEN R8VBRD ELSE R9VBRD END * AOSETP / V6OPTR * ERQTY * (1 / XREFF - 1) VARSXS
FROM
PSE PSE
LEFT OUTER JOIN LGDAT.FTCSTM IM ON
IM.CNPART = PSE.COLD AND
IM.CNPLNT = PSE.SPLNT
LEFT OUTER JOIN LGDAT.FTCSTP IP ON
IP.COPART = PSE.COLD AND
IP.COPLNT = PSE.SPLNT
LEFT OUTER JOIN LGDAT.FTCSTR IR ON
IR.Y3PART = PSE.COLD AND
IR.Y3PLNT = PSE.CPLNT
LEFT OUTER JOIN LGDAT.FUTHDO ON
APPART = COLD AND
APPLNT = SPLNT AND
APSEQ# = SEQ AND
APVEND = RESC
LEFT OUTER JOIN LGDAT.FUTHDR ON
AOPART = COLD AND
AOPLNT = SPLNT AND
AOSEQ# = SEQ
LEFT OUTER JOIN LGDAT.STKA ON
V6PART = COLD AND
V6PLNT = SPLNT
LEFT OUTER JOIN LGDAT.FRESRE ON
R9PLNT = SPLNT AND
R9DEPT = PSE.DEP AND
R9RESC = RESC
LEFT OUTER JOIN LGDAT.DEPTS ON
AADEPT = AODEPT
LEFT OUTER JOIN LGDAT.FDEPTS ON
AODEPT = R8DEPT
LEFT OUTER JOIN LGDAT.STKMM MM ON
MM.AVPART = PSE.COLD
LEFT OUTER JOIN LGDAT.STKMP MP ON
MP.AWPART = PSE.COLD
LEFT OUTER JOIN LGDAT.MMGP MMGP ON
MMGP.BRMGRP = COALESCE (AWMING, AVMING) AND
MMGP.BRGRP = COALESCE (AWMAJG, AVMAJG)
ORDER BY CLINE ASC
FETCH FIRST 10 ROWS ONLY |
CREATE TABLE IF NOT EXISTS extremum (
extremum_id int(10) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
name varchar(1000) NOT NULL
);
|
-- +migrate Up
ALTER TABLE instances ADD COLUMN refresh_token text;
-- +migrate Down
ALTER TABLE instances DROP COLUMN refresh_token;
|
BEGIN TRAN
select * from sysmnu
where prnt_id = 17475
where mnu_id = 1747
--where descr64 = 'Confirm Shipping'
--delete from sysmnu where mnu_id = 17479
select * from sysmnu where descr64 = 'WMS Pick Pack'
select * from sysmnu where descr64 = 'WMS Pick Tickets'
update sysmnu set seq_no = seq_no + 1 where prnt_id = (select max(mnu_id) from sysmnu where descr64 = 'Shipping' and prnt_id = (select
max(mnu_id) from sysmnu where descr64 = 'Billing/Picking/Shipping' and m_type = 'M')) and seq_no >= 0
INSERT INTO Pwfunc
(fnc_id,descr30,term_id,exename,param,app_type,option_exp,settings,mpackage_0,mpackage_1,mpackage_2,mpackage_3,mpackage_4,mpackage_5,mpackage_6,mpackage_7,slic,sparam,origin,icon,pwreg,rtype,descr64,helpcontext,syscreated,syscreator,sysmodified,sysmodifier,sysguid)
Values ('66960000015', NULL, 0, 'WMS PickPack 2006.exe','-V', 'X', NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL, 11506, 1, 'N',
'WMS Pick Pack', NULL, getdate(), 1, getdate() , 1, newid() )
INSERT INTO sysmnu (root_id, sysguid, prnt_id, seq_no, m_type, fnc_id, descr64, keyshortcut,tree_level) select (SELECT TOP 1 mnu_id FROM
sysmnu WHERE fnc_id = 'Go Menu 1' AND m_type = 'G'),newid(), (select mnu_id from sysmnu where descr64 = 'Shipping' and prnt_id = (select
mnu_id from sysmnu where descr64 = 'Billing/Picking/Shipping' and m_type = 'M')), 0, 'F', '66960000015', 'WMS Pick Pack', 'P',4
UPDATE syscrc SET ewfCrc = ewfCrc + 1
ROLLBACK |
CREATE SCHEMA demo AUTHORIZATION postgres;
CREATE TABLE IF NOT EXISTS demo.dates
(
id bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 9223372036854775807 CACHE 1 ),
date date NOT NULL,
CONSTRAINT dates_pkey PRIMARY KEY (id)
)
TABLESPACE pg_default;
ALTER TABLE demo.dates OWNER to postgres; |
-- 185. 部门工资前三高的所有员工
-- Employee 表包含所有员工信息,每个员工有其对应的工号 Id,姓名 Name,工资 Salary 和部门编号 DepartmentId 。
--
-- +----+-------+--------+--------------+
-- | Id | Name | Salary | DepartmentId |
-- +----+-------+--------+--------------+
-- | 1 | Joe | 85000 | 1 |
-- | 2 | Henry | 80000 | 2 |
-- | 3 | Sam | 60000 | 2 |
-- | 4 | Max | 90000 | 1 |
-- | 5 | Janet | 69000 | 1 |
-- | 6 | Randy | 85000 | 1 |
-- | 7 | Will | 70000 | 1 |
-- +----+-------+--------+--------------+
-- Department 表包含公司所有部门的信息。
--
-- +----+----------+
-- | Id | Name |
-- +----+----------+
-- | 1 | IT |
-- | 2 | Sales |
-- +----+----------+
-- 编写一个 SQL 查询,找出每个部门获得前三高工资的所有员工。例如,根据上述给定的表,查询结果应返回:
--
-- +------------+----------+--------+
-- | Department | Employee | Salary |
-- +------------+----------+--------+
-- | IT | Max | 90000 |
-- | IT | Randy | 85000 |
-- | IT | Joe | 85000 |
-- | IT | Will | 70000 |
-- | Sales | Henry | 80000 |
-- | Sales | Sam | 60000 |
-- +------------+----------+--------+
-- 解释:
--
-- IT 部门中,Max 获得了最高的工资,Randy 和 Joe 都拿到了第二高的工资,Will 的工资排第三。销售部门(Sales)只有两名员工,Henry 的工资最高,Sam 的工资排第二。
--
-- 来源:力扣(LeetCode)
-- 链接:https://leetcode-cn.com/problems/department-top-three-salaries
-- 著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。
SELECT
d.NAME AS Department,
e.NAME AS Employee,
e.Salary
FROM
( SELECT *, dense_rank () over ( PARTITION BY DepartmentId ORDER BY Salary DESC ) AS ranking FROM Employee ) AS e
JOIN Department AS d ON e.DepartmentId = d.Id
WHERE
e.ranking <= 3; |
USE TelerikAcademy
INSERT INTO Users (Username, [Password], FullName)
SELECT LOWER(LEFT(FirstName, 3) + LastName),
LOWER(LEFT(FirstName, 3) + LastName),
FirstName + ' ' + LastName
FROM Employees |
-- +micrate Up
CREATE TABLE users (
id BIGSERIAL PRIMARY KEY,
email VARCHAR NOT NULL UNIQUE,
hashed_password VARCHAR NOT NULL,
-- This is a temporary column to be used to ensure we only have one user for now, until I implement
-- permission levels
singleton BOOL NOT NULL UNIQUE DEFAULT TRUE,
created_at TIMESTAMP,
updated_at TIMESTAMP
);
-- +micrate Down
DROP TABLE IF EXISTS users;
|
--配置表
create table sys_time (cur_year varchar2(4));
create materialized view log on sys_time nologging with rowid,sequence (cur_year) including new values;
insert into sys_time(cur_year) select to_char(sysdate,'yyyy') from dual;
commit;
begin
sys.dbms_scheduler.create_job(job_name => 'QYRK.JOB_UPDATE_CUR_YEAR',
job_type => 'PLSQL_BLOCK',
job_action => 'begin update sys_time set cur_year=to_char(sysdate,''yyyy''); commit; end;',
start_date => sysdate,
repeat_interval => 'Freq=Yearly;Interval=1;ByMonth=1;ByMonthDay=1;ByHour=00;ByMinute=00;BySecond=00',
end_date => to_date(null),
job_class => 'DEFAULT_JOB_CLASS',
enabled => true,
auto_drop => false,
comments => 'update sys_time table''s cur_year colum to current year');
end;
/
begin
dbms_scheduler.run_job(job_name => 'QYRK.JOB_UPDATE_CUR_YEAR');
end;
/
/*
基表物化视图日志创建
*/
create materialized view log on sys_userinfo nologging with rowid,sequence (userid,ssjg,qwzt) including new values;
create materialized view log on sys_jgxxb nologging with rowid,sequence (jgid,jgbm) including new values;
create materialized view log on sys_xqxxb nologging with rowid,sequence (xqid,ssdept) including new values;
create materialized view log on sys_ldwhb nologging with rowid,sequence (ldid,jgid,ldlx,xqid,zrruserid) including new values;
create materialized view log on qyxx_kpryglb nologging with rowid,sequence (kpxxid,cyid,rklx,sfczr,guanliid,jgid,ldid,hm) including new values;
create materialized view log on qyxx_kpxxb nologging with rowid,sequence (kpxxid,ldhm) including new values;
create materialized view log on qyxx_cpjtxx nologging with rowid,sequence (cyid,csny,hjxxdz,zzmm) including new values;
create materialized view log on ylfn_ylfnjbxx nologging with rowid,sequence (ylzd4) including new values;
create materialized view log on qyxx_kpryglbhjry nologging with rowid,sequence (kpxxid) including new values;
create materialized view log on qyxx_djwbry nologging with rowid,sequence (cyid) including new values;
create materialized view log on qyxx_kcxx nologging with rowid,sequence (cyid) including new values;
create materialized view log on qyxx_cyszbjxx nologging with rowid,sequence (cyid) including new values;
create materialized view log on qyxx_jyfwxx nologging with rowid,sequence (cyid) including new values;
create materialized view log on qyxx_cjry nologging with rowid,sequence (cyid) including new values;
create materialized view log on wqww_flgry nologging with rowid,sequence (cyid) including new values;
create materialized view log on wqww_xsjjry nologging with rowid,sequence (cyid) including new values;
create materialized view log on qyxx_txxx nologging with rowid,sequence (cyid) including new values;
create materialized view log on qyxx_czcsry nologging with rowid,sequence (cyid) including new values;
create materialized view log on qyxx_ybsbxx nologging with rowid,sequence (cyid) including new values;
create materialized view log on qyxx_cxyljz nologging with rowid,sequence (cyid) including new values;
create materialized view log on qyxx_jjjzxx nologging with rowid,sequence (cyid) including new values;
create materialized view log on qyxx_scjrxx nologging with rowid,sequence (cyid) including new values;
create materialized view log on qyxx_tsrqxx nologging with rowid,sequence (cyid) including new values;
create materialized view log on qyxx_xytyry nologging with rowid,sequence (cyid) including new values;
create materialized view log on qyxx_jkxxjc nologging with rowid,sequence (cyid) including new values;
create materialized view log on qyxx_bfwwxx nologging with rowid,sequence (cyid) including new values;
create materialized view log on qyxx_jyqkxx nologging with rowid,sequence (cyid) including new values;
create materialized view log on wqww_fzxczyz nologging with rowid,sequence (cyid) including new values;
create materialized view log on wqww_sqjzry nologging with rowid,sequence (cyid) including new values;
create materialized view log on qyxx_sjzdryxx nologging with rowid,sequence (cyid) including new values;
create materialized view log on qyxx_xdryxx nologging with rowid,sequence (cyid) including new values;
create materialized view log on qyxx_wxjsbryxx nologging with rowid,sequence (cyid) including new values;
create materialized view log on qyxx_zdqsnryxx nologging with rowid,sequence (cyid) including new values;
create materialized view log on qyxx_rmtjy nologging with rowid,sequence (cyid) including new values;
create materialized view log on qyxx_ldlzxxy nologging with rowid,sequence (cyid) including new values;
--create materialized view log on qyxx_zjxyxx nologging with rowid,sequence (cyid) including new values;
create materialized view log on qyxx_yfdxwh nologging with rowid,sequence (cyid) including new values;
create materialized view log on ggyj_ckinfo nologging with rowid,sequence (ckinfoid,ssjg) including new values;
create materialized view log on zzww_zxjbxx nologging with rowid,sequence (jbid,clsysjgxx,shjg,zrruserid) including new values;
create materialized view log on ggyj_yjsjinfo nologging with rowid,sequence (yjsjinfoid,ssjg) including new values;
create materialized view log on fxpg_info nologging with rowid,sequence (infoid,ssjg) including new values;
create materialized view log on dtj_tjhzinfo nologging with rowid,sequence (tjbaseinfoid,tjbm,sfdqky) including new values;
create materialized view log on sys_deptinfo nologging with rowid,sequence (deptid,ssjgid) including new values;
create materialized view log on szmz_mbfqydw nologging with rowid,sequence (mbfqyid,ssdq) including new values;
create materialized view log on szmz_shtt nologging with rowid,sequence (shttid,ssdq) including new values;
--2014
create materialized view log on xz_xsqsn nologging with rowid,sequence (CYID) including new values;
create materialized view log on xz_azbhz nologging with rowid,sequence (CYID) including new values;
create materialized view log on qyxx_xfzdry nologging with rowid,sequence (CYID) including new values;
create materialized view log on qyxx_zjxyxx nologging with rowid,sequence (CYID) including new values;
create materialized view log on xz_lset nologging with rowid,sequence (CYID) including new values;
create materialized view log on qyxx_lsfn nologging with rowid,sequence (CYID) including new values;
/*
基础物化视图创建
*/
create materialized view mv_jg_info nologging
build immediate
refresh fast on commit
disable query rewrite
as
--全机构列表
select b.jgid, b.jgbm,count(*) cnt
from sys_userinfo a, sys_jgxxb b
where a.ssjg = b.jgid
group by b.jgid, b.jgbm;
create materialized view mv_zrr_info nologging
build immediate
refresh fast on commit
disable query rewrite
as
--全责任人列表
select a.userid, b.jgbm,a.rowid user_rid,b.rowid jg_rid
from sys_userinfo a, sys_jgxxb b
where a.ssjg = b.jgid(+)
and qwzt = 1;
create materialized view log on mv_jg_info nologging with rowid,sequence (jgid,jgbm) including new values;
create materialized view log on mv_zrr_info nologging with rowid,sequence (userid,jgbm) including new values;
-----------------------------------------------------------------------------------------------
--机构类统计指标物化视图 Begin
-----------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------
--户况图统计指标物化视图 Begin
----------------------------------------------------------------------------------------
create materialized view mv_jg_dy_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--30919 党员信息数据字典中添加的id
select f.jgbm, count(*) num
from QYXX_KPRYGLB a, QYXX_CPJTXX e, SYS_JGXXB f
where a.CYID = e.CYID
and a.jgid = f.jgid
and e.zzmm = 43
group by f.jgbm;
create materialized view mv_jg_xq_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6148 小区数量
select b.jgbm,count(a.xqid) num,count(*) cnt
from sys_xqxxb a, sys_jgxxb b
where a.ssdept = b.jgid
group by b.jgbm;
create materialized view mv_jg_ld_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6149 楼栋数量
select b.jgbm,count(a.ldid) num,count(*) cnt
from SYS_LDWHB a, sys_jgxxb b
where a.jgid = b.jgid
and a.ldlx = 282
group by b.jgbm;
create materialized view mv_jg_jjly_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6150 经济楼宇数量
select b.jgbm, count(a.ldid) num,count(*) cnt
from SYS_LDWHB a, sys_jgxxb b
where a.jgid = b.jgid
and a.ldlx <> 282
group by b.jgbm;
create materialized view mv_jg_ldrk_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6151 流动人口数量
select f.jgbm, count(a.KPXXID) num, count(*) cnt
from QYXX_KPRYGLB a,
QYXX_KPXXB b,
SYS_LDWHB c,
SYS_XQXXB d,
QYXX_CPJTXX e,
SYS_JGXXB f,
SYS_USERINFO g
where a.CYID = e.CYID
and a.KPXXID = b.KPXXID
and b.LDHM = c.LDID
and c.XQID = d.xqid
and c.JGID = f.jgid
and c.ZRRUSERID = g.userid
and a.RKLX in (20, 21)
group by f.jgbm;
/*
select f.jgbm, count(a.KPXXID) num, count(*) cnt
from QYXX_KPRYGLB a,
SYS_JGXXB f
where a.jgid=f.jgid
and a.RKLX in (20, 21)
group by f.jgbm;
*/
create materialized view mv_jg_kp_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6152 卡片数
select d.jgbm, count(a.KPXXID) num,count(*) cnt
from QYXX_KPXXB a, SYS_LDWHB b, SYS_XQXXB c, SYS_JGXXB d, SYS_USERINFO e
where a.LDHM = b.ldid
and b.JGID = d.jgid
and b.XQID = c.xqid
and b.ZRRUSERID = e.userid
group by d.jgbm;
/*
select d.jgbm, count(a.KPXXID) num,count(*) cnt
from QYXX_KPXXB a, SYS_LDWHB b, SYS_JGXXB d
where a.LDHM = b.ldid
and b.JGID = d.jgid
and b.ZRRUSERID is not null
group by d.jgbm;
*/
create materialized view mv_jg_zzrk_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6153 在住人口数
select e.jgbm, count(*) num
from qyxx_kpryglb a, qyxx_kpxxb b, sys_ldwhb c, sys_jgxxb e
where a.kpxxid = b.kpxxid
and b.ldhm = c.ldid
and c.jgid = e.jgid
and a.sfczr = 'N'
group by e.jgbm;
/*
select e.jgbm, count(*) num
from qyxx_kpryglb a, sys_jgxxb e
where a.jgid = e.jgid
and a.sfczr = 'N'
group by e.jgbm;
*/
create materialized view mv_jg_ylfn_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6154 育龄妇女数
select b.jgbm, count(*) num
from YLFN_YLFNJBXX q,
QYXX_KPRYGLB a,
SYS_JGXXB b,
SYS_LDWHB c,
QYXX_KPXXB f,
QYXX_CPJTXX g
where a.KPXXID = f.KPXXID
and f.LDHM = c.LDID
and b.jgid = c.jgid
and a.CYID = g.CYID
and q.YLZD4 = a.GUANLIID
group by b.jgbm;
/*
select b.jgbm, count(*) num
from YLFN_YLFNJBXX q,
QYXX_KPRYGLB a,
SYS_JGXXB b
where b.jgid = a.jgid
and q.YLZD4 = a.GUANLIID
group by b.jgbm;
*/
create materialized view mv_jg_czrk_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6155 常住人口数
select e.jgbm, count(*) num
from qyxx_kpryglb a, qyxx_kpxxb b, sys_ldwhb c, sys_jgxxb e
where a.kpxxid = b.kpxxid
and b.ldhm = c.ldid
and c.jgid = e.jgid
and a.sfczr = 'N'
and a.rklx = 19
group by e.jgbm;
/*
select e.jgbm, count(*) num
from qyxx_kpryglb a, sys_jgxxb e
where a.jgid = e.jgid
and a.sfczr = 'N'
and a.rklx = 19
group by e.jgbm;
*/
create materialized view mv_jg_lrrk_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6156 流入人口数
select e.jgbm, count(*) num
from qyxx_kpryglb a, qyxx_kpxxb b, sys_ldwhb c, sys_jgxxb e
where a.kpxxid = b.kpxxid
and b.ldhm = c.ldid
and c.jgid = e.jgid
and a.sfczr = 'N'
and a.rklx = 21
group by e.jgbm;
/*
select e.jgbm, count(*) num
from qyxx_kpryglb a, sys_jgxxb e
where a.jgid = e.jgid
and a.sfczr = 'N'
and a.rklx = 21
group by e.jgbm;
*/
create materialized view mv_jg_hjrk_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6157 户籍人口数
select e.jgbm, count(*) num
from Qyxx_Kpryglbhjry a, qyxx_kpxxb b, sys_ldwhb c, sys_jgxxb e
where a.kpxxid = b.kpxxid
and b.ldhm = c.ldid
and c.jgid = e.jgid
group by e.jgbm;
/*
select e.jgbm, count(*) num
from Qyxx_Kpryglbhjry a, sys_jgxxb e
where a.jgid = e.jgid
group by e.jgbm;
*/
create materialized view mv_jg_csrk_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6158 出生人口数
select f.jgbm, count(*) num
from QYXX_KPRYGLB a, QYXX_CPJTXX e, SYS_JGXXB f,sys_time t
where a.CYID = e.CYID
and a.jgid = f.jgid
and to_char(e.CSNY, 'yyyy') = t.cur_year
group by f.jgbm;
create materialized view mv_jg_dbh_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6159 低保户
select f.jgbm, count(a.cyid) num,count(*) cnt
from QYXX_KPRYGLB a, SYS_JGXXB f,QYXX_DJWBRY r
where a.JGID = f.jgid and a.CYID = r.CYID
group by f.jgbm;
create materialized view mv_jg_kch_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6160 空巢户 空巢老人
select f.jgbm, count(a.cyid) num,count(*) cnt
from QYXX_KPRYGLB a, SYS_JGXXB f,QYXX_KCXX r
where a.JGID = f.jgid and a.CYID = r.CYID
group by f.jgbm;
create materialized view mv_jg_szbj_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6168 生殖保健
select f.jgbm, count(a.cyid) num,count(*) cnt
from QYXX_KPRYGLB a, SYS_JGXXB f,qyxx_cyszbjxx r
where a.JGID = f.jgid
and a.CYID = r.CYID
group by f.jgbm;
create materialized view mv_jg_jyfw_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6169 就业服务
select f.jgbm, count(a.cyid) num,count(*) cnt
from QYXX_KPRYGLB a, SYS_JGXXB f, qyxx_jyfwxx r
where a.JGID = f.jgid
and a.CYID = r.CYID
group by f.jgbm;
create materialized view mv_jg_cjry_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6170 残疾人员
select f.jgbm, count(a.cyid) num, count(*) cnt
from QYXX_KPRYGLB a, SYS_JGXXB f, qyxx_cjry r
where a.JGID = f.jgid
and a.CYID = r.CYID
group by f.jgbm;
create materialized view mv_jg_flgry_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6171 法轮功人员信息
select f.jgbm, count(a.cyid) num,count(*) cnt
from QYXX_KPRYGLB a, SYS_JGXXB f,wqww_flgry r
where a.JGID = f.jgid
and a.CYID = r.CYID
group by f.jgbm;
create materialized view mv_jg_xsjjry_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6172 刑释解教人员信息
select f.jgbm, count(a.cyid) num,count(*) cnt
from QYXX_KPRYGLB a, SYS_JGXXB f,wqww_xsjjry r
where a.JGID = f.jgid
and a.CYID = r.CYID
group by f.jgbm;
create materialized view mv_jg_txxx_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6173 退休信息
select f.jgbm, count(a.cyid) num,count(*) cnt
from QYXX_KPRYGLB a, SYS_JGXXB f,qyxx_txxx r
where a.JGID = f.jgid
and a.CYID = r.CYID
group by f.jgbm;
create materialized view mv_jg_czcsry_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6174 参战参试
select f.jgbm, count(a.cyid) num,count(*) cnt
from QYXX_KPRYGLB a, SYS_JGXXB f,qyxx_czcsry r
where a.JGID = f.jgid
and a.CYID = r.CYID
group by f.jgbm;
create materialized view mv_jg_ybsb_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6175 医保社保
select f.jgbm, count(a.cyid) num,count(*) cnt
from QYXX_KPRYGLB a, SYS_JGXXB f,qyxx_ybsbxx r
where a.JGID = f.jgid
and a.CYID = r.CYID
group by f.jgbm;
create materialized view mv_jg_cxyljz_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6176 城乡医疗
select f.jgbm, count(a.cyid) num,count(*) cnt
from QYXX_KPRYGLB a, SYS_JGXXB f,qyxx_cxyljz r
where a.JGID = f.jgid
and a.CYID = r.CYID
group by f.jgbm;
create materialized view mv_jg_jjjz_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6177 救灾救济
select f.jgbm, count(a.cyid) num,count(*) cnt
from QYXX_KPRYGLB a, SYS_JGXXB f,qyxx_jjjzxx r
where a.JGID = f.jgid
and a.CYID = r.CYID
group by f.jgbm;
create materialized view mv_jg_scjr_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6178 伤残军人
select f.jgbm, count(a.cyid) num,count(*) cnt
from QYXX_KPRYGLB a, SYS_JGXXB f,qyxx_scjrxx r
where a.JGID = f.jgid
and a.CYID = r.CYID
group by f.jgbm;
create materialized view mv_jg_tsrq_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6179 特殊人群
select f.jgbm, count(a.cyid) num,count(*) cnt
from QYXX_KPRYGLB a, SYS_JGXXB f,qyxx_tsrqxx r
where a.JGID = f.jgid
and a.CYID = r.CYID
group by f.jgbm;
create materialized view mv_jg_xytyry_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6180 现役退役
select f.jgbm, count(a.cyid) num,count(*) cnt
from QYXX_KPRYGLB a, SYS_JGXXB f,qyxx_xytyry r
where a.JGID = f.jgid
and a.CYID = r.CYID
group by f.jgbm;
create materialized view mv_jg_jkxxjc_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6181 健康检查
select f.jgbm, count(a.cyid) num,count(*) cnt
from QYXX_KPRYGLB a, SYS_JGXXB f,qyxx_jkxxjc r
where a.JGID = f.jgid
and a.CYID = r.CYID
group by f.jgbm;
create materialized view mv_jg_bfwwxx_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6182 帮扶慰问
select f.jgbm, count(a.cyid) num,count(*) cnt
from QYXX_KPRYGLB a, SYS_JGXXB f,qyxx_bfwwxx r
where a.JGID = f.jgid
and a.CYID = r.CYID
group by f.jgbm;
create materialized view mv_jg_jyqkxx_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6183 教育情况
select f.jgbm, count(a.cyid) num,count(*) cnt
from QYXX_KPRYGLB a, SYS_JGXXB f,qyxx_jyqkxx r
where a.JGID = f.jgid
and a.CYID = r.CYID
group by f.jgbm;
create materialized view mv_jg_fzxczyz_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6184 法制宣传志愿者
select f.jgbm, count(a.cyid) num,count(*) cnt
from QYXX_KPRYGLB a, SYS_JGXXB f,wqww_fzxczyz r
where a.JGID = f.jgid
and a.CYID = r.CYID
group by f.jgbm;
create materialized view mv_jg_sqjzry_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6185 社区矫正人员
select f.jgbm, count(a.cyid) num,count(*) cnt
from QYXX_KPRYGLB a, SYS_JGXXB f,wqww_sqjzry r
where a.JGID = f.jgid
and a.CYID = r.CYID
group by f.jgbm;
create materialized view mv_jg_sjzdry_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6186 涉军重点人员
select f.jgbm, count(a.cyid) num,count(*) cnt
from QYXX_KPRYGLB a, SYS_JGXXB f,qyxx_sjzdryxx r
where a.JGID = f.jgid
and a.CYID = r.CYID
group by f.jgbm;
create materialized view mv_jg_xdry_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6187 吸毒人员
select f.jgbm, count(a.cyid) num,count(*) cnt
from QYXX_KPRYGLB a, SYS_JGXXB f,qyxx_xdryxx r
where a.JGID = f.jgid
and a.CYID = r.CYID
group by f.jgbm;
create materialized view mv_jg_wxjsbry_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6188 危险精神病人员
select f.jgbm, count(a.cyid) num,count(*) cnt
from QYXX_KPRYGLB a, SYS_JGXXB f,qyxx_wxjsbryxx r
where a.JGID = f.jgid
and a.CYID = r.CYID
group by f.jgbm;
create materialized view mv_jg_zdqsnry_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6189 重点青少年人员
select f.jgbm, count(a.cyid) num,count(*) cnt
from QYXX_KPRYGLB a, SYS_JGXXB f,qyxx_zdqsnryxx r
where a.JGID = f.jgid
and a.CYID = r.CYID
group by f.jgbm;
create materialized view mv_jg_rmtjy_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6190 人民调解员
select f.jgbm, count(a.cyid) num,count(*) cnt
from QYXX_KPRYGLB a, SYS_JGXXB f,qyxx_rmtjy r
where a.JGID = f.jgid
and a.CYID = r.CYID
group by f.jgbm;
create materialized view mv_jg_ldlzxxy_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6191 楼栋长信息员
select f.jgbm, count(a.cyid) num,count(*) cnt
from QYXX_KPRYGLB a, SYS_JGXXB f,qyxx_ldlzxxy r
where a.JGID = f.jgid
and a.CYID = r.CYID
group by f.jgbm;
create materialized view mv_jg_zjxy_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6192 宗教信仰信息
select f.jgbm, count(a.cyid) num,count(*) cnt
from QYXX_KPRYGLB a, SYS_JGXXB f,qyxx_zjxyxx r
where a.JGID = f.jgid
and a.CYID = r.CYID
group by f.jgbm;
create materialized view mv_jg_yfdxwh_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6193 优抚对象信息
select f.jgbm, count(a.cyid) num,count(*) cnt
from QYXX_KPRYGLB a, SYS_JGXXB f,qyxx_yfdxwh r
where a.JGID = f.jgid
and a.CYID = r.CYID
group by f.jgbm;
----------------------------------------------------------------------------------------
--户况图统计指标物化视图 End
----------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------
--新统计指标物化视图 Begin
----------------------------------------------------------------------------------------
create materialized view mv_jg_wzxx_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--16248 物资信息
select t.jgbm,count(q.CKINFOID) num,count(*) cnt
from GGYJ_CKINFO q, sys_jgxxb t
where q.ssjg = t.jgid
group by t.jgbm;
create materialized view mv_jg_jbxx_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--16249 信访事件
select t.jgbm,count(q.JBID) num,count(*) cnt
from ZZWW_ZXJBXX q, sys_jgxxb t
where q.CLSYSJGXX = t.jgid
and q.SHJG = 0
group by t.jgbm;
create materialized view mv_jg_yjsjinfo_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--16250 公共应急事件
select t.jgbm, count(q.YJSJINFOID) num, count(*) cnt
from GGYJ_YJSJINFO q, sys_jgxxb t
where q.SSJG = t.jgid
group by t.jgbm;
create materialized view mv_jg_fxpginfo_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--16251 风险评估事件
select t.jgbm, count(q.INFOID) num, count(*) cnt
from FXPG_INFO q, sys_jgxxb t
where q.SSJG = t.jgid
group by t.jgbm;
----------------
create materialized view mv_jg_tjhzinfo_base nologging
build immediate
refresh fast on demand
disable query rewrite
as
select t.jgbm, q.TJBASEINFOID, count(*) cnt
from DTJ_TJHZINFO q, SYS_DEPTINFO d, sys_jgxxb t
where q.TJBM = d.DEPTID
and d.SSJGID = t.jgid
and q.SFDQKY = 'Y'
group by t.jgbm, q.TJBASEINFOID;
create materialized view log on mv_jg_tjhzinfo_base nologging with rowid,sequence (jgbm,TJBASEINFOID) including new values;
create materialized view mv_jg_tjhzinfo_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--16252 大调解事件
select jgbm, count(TJBASEINFOID) num, count(*) cnt
from mv_jg_tjhzinfo_base
group by jgbm;
----------------
create materialized view mv_jg_shtt_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--16268 社会团体
select t.jgbm, count(q.SHTTID) num, count(*) cnt
from SZMZ_SHTT q, sys_jgxxb t
where q.SSDQ = t.jgid
group by t.jgbm;
create materialized view mv_jg_fqydw_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--16269 非企业单位
select t.jgbm, count(q.MBFQYID) num, count(*) cnt
from SZMZ_MBFQYDW q, sys_jgxxb t
where q.SSDQ = t.jgid
group by t.jgbm;
-------------------
create materialized view mv_jg_zhs_base nologging
build immediate
refresh fast on demand
disable query rewrite
as
select b.jgbm, a.kpxxid, nvl(a.hm, 1) hm,count(*) cnt
from qyxx_kpryglb a, sys_jgxxb b
where a.jgid = b.jgid
group by b.jgbm, a.kpxxid,nvl(a.hm, 1);
create materialized view log on mv_jg_zhs_base nologging with rowid,sequence (jgbm,kpxxid,hm) including new values;
create materialized view mv_jg_zhs_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--16288 总户数
select jgbm, count(hm) num,count(*) cnt
from mv_jg_zhs_base
group by jgbm;
-------------------------
create materialized view mv_jg_ghrk_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--40008 挂户人口数
select f.jgbm, count(a.KPXXID) num, count(*) cnt
from QYXX_KPRYGLB a,
QYXX_KPXXB b,
SYS_LDWHB c,
SYS_XQXXB d,
QYXX_CPJTXX e,
SYS_JGXXB f,
SYS_USERINFO g
where a.CYID = e.CYID
and a.KPXXID = b.KPXXID
and b.LDHM = c.LDID
and c.XQID = d.xqid
and c.JGID = f.jgid
and c.ZRRUSERID = g.userid
and a.RKLX = 621
group by f.jgbm;
--2014
--闲散青少年
create materialized view MV_JG_xsqsn_AGG nologging
build immediate
refresh fast on demand
disable query rewrite
as
select f.jgbm, count(a.cyid) num,count(*) cnt
from QYXX_KPRYGLB a, SYS_JGXXB f,xz_xsqsn r
where a.JGID = f.jgid
and a.CYID = r.CYID
group by f.jgbm;
-- 艾滋病患者
create materialized view MV_JG_azbhz_AGG nologging
build immediate
refresh fast on demand
disable query rewrite
as
select f.jgbm, count(a.cyid) num,count(*) cnt
from QYXX_KPRYGLB a, SYS_JGXXB f,xz_azbhz r
where a.JGID = f.jgid
and a.CYID = r.CYID
group by f.jgbm;
--信访重点人员
create materialized view MV_JG_xfzdry_AGG nologging
build immediate
refresh fast on demand
disable query rewrite
AS
select f.jgbm, count(a.cyid) num,count(*) cnt
from QYXX_KPRYGLB a, SYS_JGXXB f,qyxx_xfzdry r
where a.JGID = f.jgid
and a.CYID = r.CYID
group by f.jgbm;
--宗教信仰信息
create materialized view MV_JG_zjxyxx_AGG nologging
build immediate
refresh fast on demand
disable query rewrite
as
select f.jgbm, count(a.cyid) num,count(*) cnt
from QYXX_KPRYGLB a, SYS_JGXXB f,qyxx_zjxyxx r
where a.JGID = f.jgid
and a.CYID = r.CYID
group by f.jgbm;
--留守儿童
create materialized view MV_JG_lset_AGG nologging
build immediate
refresh fast on demand
disable query rewrite
AS
select f.jgbm, count(a.cyid) num,count(*) cnt
from QYXX_KPRYGLB a, SYS_JGXXB f,xz_lset r
where a.JGID = f.jgid
and a.CYID = r.CYID
group by f.jgbm;
--留守妇女
create materialized view MV_JG_lsfn_AGG nologging
build immediate
refresh fast on demand
disable query rewrite
AS
select f.jgbm, count(a.cyid) num,count(*) cnt
from QYXX_KPRYGLB a, SYS_JGXXB f,qyxx_lsfn r
where a.JGID = f.jgid
and a.CYID = r.CYID
group by f.jgbm;
--两新组织中 的社会团体 2014 lzqiang 添加
create materialized view MV_JG_lxzz_shtt_AGG nologging
build immediate
refresh fast on demand
disable query rewrite
AS
select f.jgbm, count(r.org_id) num,count(*) cnt
FROM XT_ORG r,SYS_JGXXB f
WHERE r.reseau = f.jgid
AND r.Lb = 200021 --社会团体
group by f.jgbm;
--两新组织中 民办企业非单位 2014 lzqiang 添加
create materialized view MV_JG_lxzz_mbqyfdw_AGG nologging
build immediate
refresh fast on demand
disable query rewrite
AS
select f.jgbm, count(r.org_id) num,count(*) cnt
FROM XT_ORG r,SYS_JGXXB f
WHERE r.reseau = f.jgid
AND r.Lb = 200023 --民办企业非单位
group by f.jgbm;
--lzqiang 20140825 服刑人员
create materialized view MV_JG_fxry_AGG nologging
build immediate
refresh fast on demand
disable query rewrite
AS
select f.jgbm, count(a.cyid) num,count(*) cnt
from QYXX_KPRYGLB a, SYS_JGXXB f,qyxx_fxry r
where a.JGID = f.jgid
and a.CYID = r.CYID
group by f.jgbm;
/*
select f.jgbm, count(a.KPXXID) num, count(*) cnt
from QYXX_KPRYGLB a,
SYS_JGXXB f
where a.JGID = f.jgid
and a.RKLX = 621
group by f.jgbm;
*/
----------------------------------------------------------------------------------------
--新统计指标物化视图 End
----------------------------------------------------------------------------------------
/*
level0物化视图的日志创建
*/
create materialized view log on mv_jg_xq_agg nologging with rowid,sequence (jgbm,num) including new values;
create materialized view log on mv_jg_ld_agg nologging with rowid,sequence (jgbm,num) including new values;
create materialized view log on mv_jg_jjly_agg nologging with rowid,sequence (jgbm,num) including new values;
create materialized view log on mv_jg_ldrk_agg nologging with rowid,sequence (jgbm,num) including new values;
create materialized view log on mv_jg_kp_agg nologging with rowid,sequence (jgbm,num) including new values;
create materialized view log on mv_jg_zzrk_agg nologging with rowid,sequence (jgbm,num) including new values;
create materialized view log on mv_jg_ylfn_agg nologging with rowid,sequence (jgbm,num) including new values;
create materialized view log on mv_jg_czrk_agg nologging with rowid,sequence (jgbm,num) including new values;
create materialized view log on mv_jg_lrrk_agg nologging with rowid,sequence (jgbm,num) including new values;
create materialized view log on mv_jg_hjrk_agg nologging with rowid,sequence (jgbm,num) including new values;
create materialized view log on mv_jg_csrk_agg nologging with rowid,sequence (jgbm,num) including new values;
create materialized view log on mv_jg_dbh_agg nologging with rowid,sequence (jgbm,num) including new values;
create materialized view log on mv_jg_kch_agg nologging with rowid,sequence (jgbm,num) including new values;
create materialized view log on mv_jg_szbj_agg nologging with rowid,sequence (jgbm,num) including new values;
create materialized view log on mv_jg_jyfw_agg nologging with rowid,sequence (jgbm,num) including new values;
create materialized view log on mv_jg_cjry_agg nologging with rowid,sequence (jgbm,num) including new values;
create materialized view log on mv_jg_flgry_agg nologging with rowid,sequence (jgbm,num) including new values;
create materialized view log on mv_jg_xsjjry_agg nologging with rowid,sequence (jgbm,num) including new values;
create materialized view log on mv_jg_txxx_agg nologging with rowid,sequence (jgbm,num) including new values;
create materialized view log on mv_jg_czcsry_agg nologging with rowid,sequence (jgbm,num) including new values;
create materialized view log on mv_jg_ybsb_agg nologging with rowid,sequence (jgbm,num) including new values;
create materialized view log on mv_jg_cxyljz_agg nologging with rowid,sequence (jgbm,num) including new values;
create materialized view log on mv_jg_jjjz_agg nologging with rowid,sequence (jgbm,num) including new values;
create materialized view log on mv_jg_scjr_agg nologging with rowid,sequence (jgbm,num) including new values;
create materialized view log on mv_jg_tsrq_agg nologging with rowid,sequence (jgbm,num) including new values;
create materialized view log on mv_jg_xytyry_agg nologging with rowid,sequence (jgbm,num) including new values;
create materialized view log on mv_jg_jkxxjc_agg nologging with rowid,sequence (jgbm,num) including new values;
create materialized view log on mv_jg_bfwwxx_agg nologging with rowid,sequence (jgbm,num) including new values;
create materialized view log on mv_jg_jyqkxx_agg nologging with rowid,sequence (jgbm,num) including new values;
create materialized view log on mv_jg_fzxczyz_agg nologging with rowid,sequence (jgbm,num) including new values;
create materialized view log on mv_jg_sqjzry_agg nologging with rowid,sequence (jgbm,num) including new values;
create materialized view log on mv_jg_sjzdry_agg nologging with rowid,sequence (jgbm,num) including new values;
create materialized view log on mv_jg_xdry_agg nologging with rowid,sequence (jgbm,num) including new values;
create materialized view log on mv_jg_wxjsbry_agg nologging with rowid,sequence (jgbm,num) including new values;
create materialized view log on mv_jg_zdqsnry_agg nologging with rowid,sequence (jgbm,num) including new values;
create materialized view log on mv_jg_rmtjy_agg nologging with rowid,sequence (jgbm,num) including new values;
create materialized view log on mv_jg_ldlzxxy_agg nologging with rowid,sequence (jgbm,num) including new values;
create materialized view log on mv_jg_zjxy_agg nologging with rowid,sequence (jgbm,num) including new values;
create materialized view log on mv_jg_yfdxwh_agg nologging with rowid,sequence (jgbm,num) including new values;
create materialized view log on mv_jg_zhs_agg nologging with rowid,sequence (jgbm,num) including new values;
create materialized view log on mv_jg_fqydw_agg nologging with rowid,sequence (jgbm,num) including new values;
create materialized view log on mv_jg_shtt_agg nologging with rowid,sequence (jgbm,num) including new values;
create materialized view log on mv_jg_tjhzinfo_agg nologging with rowid,sequence (jgbm,num) including new values;
create materialized view log on mv_jg_fxpginfo_agg nologging with rowid,sequence (jgbm,num) including new values;
create materialized view log on mv_jg_yjsjinfo_agg nologging with rowid,sequence (jgbm,num) including new values;
create materialized view log on mv_jg_jbxx_agg nologging with rowid,sequence (jgbm,num) including new values;
create materialized view log on mv_jg_wzxx_agg nologging with rowid,sequence (jgbm,num) including new values;
create materialized view log on mv_jg_ghrk_agg nologging with rowid,sequence (jgbm,num) including new values;
--2014
create materialized view log on MV_JG_xsqsn_AGG nologging with rowid,sequence (jgbm,num) including new values;
create materialized view log on MV_JG_azbhz_AGG nologging with rowid,sequence (jgbm,num) including new values;
create materialized view log on MV_JG_xfzdry_AGG nologging with rowid,sequence (jgbm,num) including new values;
create materialized view log on MV_JG_zjxyxx_AGG nologging with rowid,sequence (jgbm,num) including new values;
create materialized view log on MV_JG_lset_AGG nologging with rowid,sequence (jgbm,num) including new values;
create materialized view log on MV_JG_lsfn_AGG nologging with rowid,sequence (jgbm,num) including new values;
--gaobin 20140812
create materialized view log on mv_jg_dy_agg nologging with rowid,sequence (jgbm,num) including new values;
--lzqiang 20140825
create materialized view log on MV_JG_lxzz_shtt_AGG nologging with rowid,sequence (jgbm,num) including new values;
create materialized view log on MV_JG_lxzz_mbqyfdw_AGG nologging with rowid,sequence (jgbm,num) including new values;
create materialized view log on MV_JG_fxry_AGG nologging with rowid,sequence (jgbm,num) including new values;
/*
创建机构汇总物化视图
*/
create materialized view mv_jg_dataid nologging
build immediate
refresh fast on demand
disable query rewrite
as
(--6148 小区数量
select b.jgid,b.jgbm,6148 dataid,sum(num) num,2 bs,count(num) cntn,count(*) cnt from mv_jg_xq_agg a,mv_jg_info b where regexp_like(a.jgbm,b.jgbm) group by b.jgid,b.jgbm
union all
--6149 楼栋数量
select b.jgid,b.jgbm,6149 dataid,sum(num) num,2 bs,count(num) cntn,count(*) cnt from mv_jg_ld_agg a,mv_jg_info b where regexp_like(a.jgbm,b.jgbm) group by b.jgid,b.jgbm
union all
--6150 经济楼宇数量
select b.jgid,b.jgbm,6150 dataid,sum(num) num,2 bs,count(num) cntn,count(*) cnt from mv_jg_jjly_agg a,mv_jg_info b where regexp_like(a.jgbm,b.jgbm) group by b.jgid,b.jgbm
union all
--6151 流动人口数量
select b.jgid,b.jgbm,6151 dataid,sum(num) num,2 bs,count(num) cntn,count(*) cnt from mv_jg_ldrk_agg a,mv_jg_info b where regexp_like(a.jgbm,b.jgbm) group by b.jgid,b.jgbm
union all
--6152 卡片数
select b.jgid,b.jgbm,6152 dataid,sum(num) num,2 bs,count(num) cntn,count(*) cnt from mv_jg_kp_agg a,mv_jg_info b where regexp_like(a.jgbm,b.jgbm) group by b.jgid,b.jgbm
union all
--6153 在住人口数
select b.jgid,b.jgbm,6153 dataid,sum(num) num,2 bs,count(num) cntn,count(*) cnt from mv_jg_zzrk_agg a,mv_jg_info b where regexp_like(a.jgbm,b.jgbm) group by b.jgid,b.jgbm
union all
--6154 育龄妇女数
select b.jgid,b.jgbm,6154 dataid,sum(num) num,2 bs,count(num) cntn,count(*) cnt from mv_jg_ylfn_agg a,mv_jg_info b where regexp_like(a.jgbm,b.jgbm) group by b.jgid,b.jgbm
union all
--6155 常住人口数
select b.jgid,b.jgbm,6155 dataid,sum(num) num,2 bs,count(num) cntn,count(*) cnt from mv_jg_czrk_agg a,mv_jg_info b where regexp_like(a.jgbm,b.jgbm) group by b.jgid,b.jgbm
union all
--6156 流入人口数
select b.jgid,b.jgbm,6156 dataid,sum(num) num,2 bs,count(num) cntn,count(*) cnt from mv_jg_lrrk_agg a,mv_jg_info b where regexp_like(a.jgbm,b.jgbm) group by b.jgid,b.jgbm
union all
--6157 户籍人口数
select b.jgid,b.jgbm,6157 dataid,sum(num) num,2 bs,count(num) cntn,count(*) cnt from mv_jg_hjrk_agg a,mv_jg_info b where regexp_like(a.jgbm,b.jgbm) group by b.jgid,b.jgbm
union all
--6158 出生人口数
select b.jgid,b.jgbm,6158 dataid,sum(num) num,2 bs,count(num) cntn,count(*) cnt from mv_jg_csrk_agg a,mv_jg_info b where regexp_like(a.jgbm,b.jgbm) group by b.jgid,b.jgbm
union all
--6159 低保户
select b.jgid,b.jgbm,6159 dataid,sum(num) num,2 bs,count(num) cntn,count(*) cnt from mv_jg_dbh_agg a,mv_jg_info b where regexp_like(a.jgbm,b.jgbm) group by b.jgid,b.jgbm
union all
--6160 空巢户
select b.jgid,b.jgbm,6160 dataid,sum(num) num,2 bs,count(num) cntn,count(*) cnt from mv_jg_kch_agg a,mv_jg_info b where regexp_like(a.jgbm,b.jgbm) group by b.jgid,b.jgbm
union all
--6168 生殖保健
select b.jgid,b.jgbm,6168 dataid,sum(num) num,2 bs,count(num) cntn,count(*) cnt from mv_jg_szbj_agg a,mv_jg_info b where regexp_like(a.jgbm,b.jgbm) group by b.jgid,b.jgbm
union all
--6169 就业服务
select b.jgid,b.jgbm,6169 dataid,sum(num) num,2 bs,count(num) cntn,count(*) cnt from mv_jg_jyfw_agg a,mv_jg_info b where regexp_like(a.jgbm,b.jgbm) group by b.jgid,b.jgbm
union all
--6170 残疾人员
select b.jgid,b.jgbm,6170 dataid,sum(num) num,2 bs,count(num) cntn,count(*) cnt from mv_jg_cjry_agg a,mv_jg_info b where regexp_like(a.jgbm,b.jgbm) group by b.jgid,b.jgbm
union all
--6171 法轮功人员信息
select b.jgid,b.jgbm,6171 dataid,sum(num) num,2 bs,count(num) cntn,count(*) cnt from mv_jg_flgry_agg a,mv_jg_info b where regexp_like(a.jgbm,b.jgbm) group by b.jgid,b.jgbm
union all
--6172 刑释解教人员信息
select b.jgid,b.jgbm,6172 dataid,sum(num) num,2 bs,count(num) cntn,count(*) cnt from mv_jg_xsjjry_agg a,mv_jg_info b where regexp_like(a.jgbm,b.jgbm) group by b.jgid,b.jgbm
union all
--6173 退休信息
select b.jgid,b.jgbm,6173 dataid,sum(num) num,2 bs,count(num) cntn,count(*) cnt from mv_jg_txxx_agg a,mv_jg_info b where regexp_like(a.jgbm,b.jgbm) group by b.jgid,b.jgbm
union all
--6174 参战参试
select b.jgid,b.jgbm,6174 dataid,sum(num) num,2 bs,count(num) cntn,count(*) cnt from mv_jg_czcsry_agg a,mv_jg_info b where regexp_like(a.jgbm,b.jgbm) group by b.jgid,b.jgbm
union all
--6175 医保社保
select b.jgid,b.jgbm,6175 dataid,sum(num) num,2 bs,count(num) cntn,count(*) cnt from mv_jg_ybsb_agg a,mv_jg_info b where regexp_like(a.jgbm,b.jgbm) group by b.jgid,b.jgbm
union all
--6176 城乡医疗
select b.jgid,b.jgbm,6176 dataid,sum(num) num,2 bs,count(num) cntn,count(*) cnt from mv_jg_cxyljz_agg a,mv_jg_info b where regexp_like(a.jgbm,b.jgbm) group by b.jgid,b.jgbm
union all
--6177 救灾救济
select b.jgid,b.jgbm,6177 dataid,sum(num) num,2 bs,count(num) cntn,count(*) cnt from mv_jg_jjjz_agg a,mv_jg_info b where regexp_like(a.jgbm,b.jgbm) group by b.jgid,b.jgbm
union all
--6178 伤残军人
select b.jgid,b.jgbm,6178 dataid,sum(num) num,2 bs,count(num) cntn,count(*) cnt from mv_jg_scjr_agg a,mv_jg_info b where regexp_like(a.jgbm,b.jgbm) group by b.jgid,b.jgbm
union all
--6179 特殊人群
select b.jgid,b.jgbm,6179 dataid,sum(num) num,2 bs,count(num) cntn,count(*) cnt from mv_jg_tsrq_agg a,mv_jg_info b where regexp_like(a.jgbm,b.jgbm) group by b.jgid,b.jgbm
union all
--6180 现役退役
select b.jgid,b.jgbm,6180 dataid,sum(num) num,2 bs,count(num) cntn,count(*) cnt from mv_jg_xytyry_agg a,mv_jg_info b where regexp_like(a.jgbm,b.jgbm) group by b.jgid,b.jgbm
union all
--6181 健康检查
select b.jgid,b.jgbm,6181 dataid,sum(num) num,2 bs,count(num) cntn,count(*) cnt from mv_jg_jkxxjc_agg a,mv_jg_info b where regexp_like(a.jgbm,b.jgbm) group by b.jgid,b.jgbm
union all
--6182 帮扶慰问
select b.jgid,b.jgbm,6182 dataid,sum(num) num,2 bs,count(num) cntn,count(*) cnt from mv_jg_bfwwxx_agg a,mv_jg_info b where regexp_like(a.jgbm,b.jgbm) group by b.jgid,b.jgbm
union all
--6183 教育情况
select b.jgid,b.jgbm,6183 dataid,sum(num) num,2 bs,count(num) cntn,count(*) cnt from mv_jg_jyqkxx_agg a,mv_jg_info b where regexp_like(a.jgbm,b.jgbm) group by b.jgid,b.jgbm
union all
--6184 法制宣传志愿者
select b.jgid,b.jgbm,6184 dataid,sum(num) num,2 bs,count(num) cntn,count(*) cnt from mv_jg_fzxczyz_agg a,mv_jg_info b where regexp_like(a.jgbm,b.jgbm) group by b.jgid,b.jgbm
union all
--6185 社区矫正人员
select b.jgid,b.jgbm,6185 dataid,sum(num) num,2 bs,count(num) cntn,count(*) cnt from mv_jg_sqjzry_agg a,mv_jg_info b where regexp_like(a.jgbm,b.jgbm) group by b.jgid,b.jgbm
union all
--6186 涉军重点人员
select b.jgid,b.jgbm,6186 dataid,sum(num) num,2 bs,count(num) cntn,count(*) cnt from mv_jg_sjzdry_agg a,mv_jg_info b where regexp_like(a.jgbm,b.jgbm) group by b.jgid,b.jgbm
union all
--6187 吸毒人员
select b.jgid,b.jgbm,6187 dataid,sum(num) num,2 bs,count(num) cntn,count(*) cnt from mv_jg_xdry_agg a,mv_jg_info b where regexp_like(a.jgbm,b.jgbm) group by b.jgid,b.jgbm
union all
--6188 危险精神病人员
select b.jgid,b.jgbm,6188 dataid,sum(num) num,2 bs,count(num) cntn,count(*) cnt from mv_jg_wxjsbry_agg a,mv_jg_info b where regexp_like(a.jgbm,b.jgbm) group by b.jgid,b.jgbm
union all
--6189 重点青少年人员
select b.jgid,b.jgbm,6189 dataid,sum(num) num,2 bs,count(num) cntn,count(*) cnt from mv_jg_zdqsnry_agg a,mv_jg_info b where regexp_like(a.jgbm,b.jgbm) group by b.jgid,b.jgbm
union all
--6190 人民调解员
select b.jgid,b.jgbm,6190 dataid,sum(num) num,2 bs,count(num) cntn,count(*) cnt from mv_jg_rmtjy_agg a,mv_jg_info b where regexp_like(a.jgbm,b.jgbm) group by b.jgid,b.jgbm
union all
--6191 楼栋长信息员
select b.jgid,b.jgbm,6191 dataid,sum(num) num,2 bs,count(num) cntn,count(*) cnt from mv_jg_ldlzxxy_agg a,mv_jg_info b where regexp_like(a.jgbm,b.jgbm) group by b.jgid,b.jgbm
union all
--6192 宗教信仰信息
select b.jgid,b.jgbm,6192 dataid,sum(num) num,2 bs,count(num) cntn,count(*) cnt from mv_jg_zjxy_agg a,mv_jg_info b where regexp_like(a.jgbm,b.jgbm) group by b.jgid,b.jgbm
union all
--6193 优抚对象信息
select b.jgid,b.jgbm,6193 dataid,sum(num) num,2 bs,count(num) cntn,count(*) cnt from mv_jg_yfdxwh_agg a,mv_jg_info b where regexp_like(a.jgbm,b.jgbm) group by b.jgid,b.jgbm
union all
--16248 物资信息
select b.jgid,b.jgbm,16248 dataid,sum(num) num,2 bs,count(num) cntn,count(*) cnt from mv_jg_wzxx_agg a,mv_jg_info b where regexp_like(a.jgbm,b.jgbm) group by b.jgid,b.jgbm
union all
--16249 信访事件
select b.jgid,b.jgbm,16249 dataid,sum(num) num,2 bs,count(num) cntn,count(*) cnt from mv_jg_jbxx_agg a,mv_jg_info b where regexp_like(a.jgbm,b.jgbm) group by b.jgid,b.jgbm
union all
--16250 公共应急事件
select b.jgid,b.jgbm,16250 dataid,sum(num) num,2 bs,count(num) cntn,count(*) cnt from mv_jg_yjsjinfo_agg a,mv_jg_info b where regexp_like(a.jgbm,b.jgbm) group by b.jgid,b.jgbm
union all
--16251 风险评估事件
select b.jgid,b.jgbm,16251 dataid,sum(num) num,2 bs,count(num) cntn,count(*) cnt from mv_jg_fxpginfo_agg a,mv_jg_info b where regexp_like(a.jgbm,b.jgbm) group by b.jgid,b.jgbm
union all
--16252 大调解事件
select b.jgid,b.jgbm,16252 dataid,sum(num) num,2 bs,count(num) cntn,count(*) cnt from mv_jg_tjhzinfo_agg a,mv_jg_info b where regexp_like(a.jgbm,b.jgbm) group by b.jgid,b.jgbm
union all
--16268 社会团体
select b.jgid,b.jgbm,16268 dataid,sum(num) num,2 bs,count(num) cntn,count(*) cnt from mv_jg_shtt_agg a,mv_jg_info b where regexp_like(a.jgbm,b.jgbm) group by b.jgid,b.jgbm
union all
--16269 非企业单位
select b.jgid,b.jgbm,16269 dataid,sum(num) num,2 bs,count(num) cntn,count(*) cnt from mv_jg_fqydw_agg a,mv_jg_info b where regexp_like(a.jgbm,b.jgbm) group by b.jgid,b.jgbm
union all
--16288 总户数
select b.jgid,b.jgbm,16288 dataid,sum(num) num,2 bs,count(num) cntn,count(*) cnt from mv_jg_zhs_agg a,mv_jg_info b where regexp_like(a.jgbm,b.jgbm) group by b.jgid,b.jgbm
union all
--40008 挂户人口数
select b.jgid,b.jgbm,40008 dataid,sum(num) num,2 bs,count(num) cntn,count(*) cnt from mv_jg_ghrk_agg a,mv_jg_info b where regexp_like(a.jgbm,b.jgbm) group by b.jgid,b.jgbm
union all
--60000 闲散青少年
select b.jgid,b.jgbm,60000 dataid,sum(num) num,2 bs,count(num) cntn,count(*) cnt from MV_JG_xsqsn_AGG a,mv_jg_info b where regexp_like(a.jgbm,b.jgbm) group by b.jgid,b.jgbm
union all
--60001 艾滋病患者
select b.jgid,b.jgbm,60001 dataid,sum(num) num,2 bs,count(num) cntn,count(*) cnt from MV_JG_azbhz_AGG a,mv_jg_info b where regexp_like(a.jgbm,b.jgbm) group by b.jgid,b.jgbm
union all
--60002 信访重点人员
select b.jgid,b.jgbm,60002 dataid,sum(num) num,2 bs,count(num) cntn,count(*) cnt from MV_JG_xfzdry_AGG a,mv_jg_info b where regexp_like(a.jgbm,b.jgbm) group by b.jgid,b.jgbm
union all
--60003 宗教信仰人员
select b.jgid,b.jgbm,60003 dataid,sum(num) num,2 bs,count(num) cntn,count(*) cnt from MV_JG_zjxyxx_AGG a,mv_jg_info b where regexp_like(a.jgbm,b.jgbm) group by b.jgid,b.jgbm
union all
--60004
select b.jgid,b.jgbm,60004 dataid,sum(num) num,2 bs,count(num) cntn,count(*) cnt from MV_JG_lset_AGG a,mv_jg_info b where regexp_like(a.jgbm,b.jgbm) group by b.jgid,b.jgbm
union all
--60005 留守妇女
select b.jgid,b.jgbm,60005 dataid,sum(num) num,2 bs,count(num) cntn,count(*) cnt from MV_JG_lsfn_AGG a,mv_jg_info b where regexp_like(a.jgbm,b.jgbm) group by b.jgid,b.jgbm
union all
--30919 党员信息
select b.jgid,b.jgbm,30919 dataid,sum(num) num,2 bs,count(num) cntn,count(*) cnt from mv_jg_dy_agg a,mv_jg_info b where regexp_like(a.jgbm,b.jgbm) group by b.jgid,b.jgbm
union all
--30939 社会团体(两新组织)
select b.jgid,b.jgbm,30939 dataid,sum(num) num,2 bs,count(num) cntn,count(*) cnt from mv_jg_dy_agg a,MV_JG_lxzz_shtt_AGG b where regexp_like(a.jgbm,b.jgbm) group by b.jgid,b.jgbm
union all
--30940 民办企业非单位(两新组织)
select b.jgid,b.jgbm,30940 dataid,sum(num) num,2 bs,count(num) cntn,count(*) cnt from mv_jg_dy_agg a,MV_JG_lxzz_mbqyfdw_AGG b where regexp_like(a.jgbm,b.jgbm) group by b.jgid,b.jgbm
union all
--30941 服刑人员
select b.jgid,b.jgbm,30941 dataid,sum(num) num,2 bs,count(num) cntn,count(*) cnt from mv_jg_dy_agg a,MV_JG_fxry_AGG b where regexp_like(a.jgbm,b.jgbm) group by b.jgid,b.jgbm
);
----------------------------------------------------------------------------------------
--机构类统计指标物化视图 End
----------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------
--责任人类统计指标物化视图 Begin
----------------------------------------------------------------------------------------
-------------------
create materialized view mv_zrr_dy_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--30919 党员信息
select f.ZRRUSERID, count(*) num
from QYXX_KPRYGLB a, QYXX_CPJTXX e, sys_ldwhb f,SYS_USERINFO g
where a.cyid=e.cyid
and a.ldid=f.ldid
and f.ZRRUSERID = g.userid
and e.zzmm = 43
group by f.ZRRUSERID;
create materialized view mv_zrr_xq_base nologging
build immediate
refresh fast on demand
disable query rewrite
as
select p.zrruserid, t.xqid,count(*) cnt
from sys_ldwhb p, sys_xqxxb t
where p.xqid = t.xqid
group by p.zrruserid, t.xqid;
create materialized view log on mv_zrr_xq_base nologging with rowid,sequence (zrruserid,xqid) including new values;
create materialized view mv_zrr_xq_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6148 小区数量
select a.zrruserid, count(a.xqid) num,count(*) cnt
from mv_zrr_xq_base a
group by a.zrruserid;
-------------------------
create materialized view mv_zrr_ld_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6149 楼栋数量
select z.zrruserid, count(z.ldid) num, count(*) cnt
from SYS_LDWHB z
where z.ldlx = 282
group by z.zrruserid;
create materialized view mv_zrr_jjly_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6150 经济楼宇数量
select z.zrruserid, count(z.ldid) num, count(*) cnt
from SYS_LDWHB z
where z.ldlx <> 282
group by z.zrruserid;
create materialized view mv_zrr_ldrk_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6151 流动人口数量
select c.ZRRUSERID, count(a.KPXXID) num, count(*) cnt
from QYXX_KPRYGLB a,
QYXX_KPXXB b,
SYS_LDWHB c,
SYS_XQXXB d,
QYXX_CPJTXX e,
SYS_JGXXB f,
SYS_USERINFO g
where a.CYID = e.CYID
and a.KPXXID = b.KPXXID
and b.LDHM = c.LDID
and c.XQID = d.xqid
and c.JGID = f.jgid
and c.ZRRUSERID = g.userid
and a.RKLX in (20, 21)
group by c.ZRRUSERID;
/*
select c.ZRRUSERID, count(a.KPXXID) num, count(*) cnt
from QYXX_KPRYGLB a,
SYS_LDWHB c
where a.LDID = c.LDID
and a.RKLX in (20, 21)
group by c.ZRRUSERID;
*/
create materialized view mv_zrr_kp_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6152 卡片数
select b.ZRRUSERID, count(a.KPXXID) num, count(*) cnt
from QYXX_KPXXB a, SYS_LDWHB b, SYS_XQXXB c, SYS_JGXXB d, SYS_USERINFO e
where a.LDHM = b.ldid
and b.JGID = d.jgid
and b.XQID = c.xqid
and b.ZRRUSERID = e.userid
group by b.ZRRUSERID;
/*
select b.ZRRUSERID, count(a.KPXXID) num, count(*) cnt
from QYXX_KPXXB a, SYS_LDWHB b
where a.LDHM = b.ldid
group by b.ZRRUSERID;
*/
create materialized view mv_zrr_zzrk_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6153 在住人口数
select c.ZRRUSERID, count(a.KPXXID) num, count(*) cnt
from QYXX_KPRYGLB a,
QYXX_KPXXB b,
SYS_LDWHB c,
SYS_XQXXB d,
QYXX_CPJTXX e,
SYS_JGXXB f,
SYS_USERINFO g
where a.CYID = e.CYID
and a.KPXXID = b.KPXXID
and b.LDHM = c.LDID
and c.XQID = d.xqid
and c.JGID = f.jgid
and c.ZRRUSERID = g.userid
and a.KPXXID is not null
group by c.ZRRUSERID;
/*
select c.ZRRUSERID, count(a.KPXXID) num, count(*) cnt
from QYXX_KPRYGLB a,
SYS_LDWHB c
where a.LDID = c.LDID
and a.KPXXID is not null
group by c.ZRRUSERID;
*/
create materialized view mv_zrr_ylfn_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6154 育龄妇女数
select c.ZRRUSERID, count(*) num
from YLFN_YLFNJBXX q,
QYXX_KPRYGLB a,
SYS_JGXXB b,
SYS_LDWHB c,
QYXX_KPXXB f,
QYXX_CPJTXX g
where a.KPXXID = f.KPXXID
and f.LDHM = c.LDID
and b.jgid = c.jgid
and a.CYID = g.CYID
and q.YLZD4 = a.GUANLIID
group by c.ZRRUSERID;
/*
select c.ZRRUSERID, count(*) num
from YLFN_YLFNJBXX q,
QYXX_KPRYGLB a,
SYS_LDWHB c
where a.LDID = c.LDID
and q.YLZD4 = a.GUANLIID
group by c.ZRRUSERID;
*/
create materialized view mv_zrr_czrk_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6155 常住人口数
select c.ZRRUSERID, count(a.KPXXID) num, count(*) cnt
from QYXX_KPRYGLB a,
QYXX_KPXXB b,
SYS_LDWHB c,
SYS_XQXXB d,
QYXX_CPJTXX e,
SYS_JGXXB f,
SYS_USERINFO g
where a.CYID = e.CYID
and a.KPXXID = b.KPXXID
and b.LDHM = c.LDID
and c.XQID = d.xqid
and c.JGID = f.jgid
and c.ZRRUSERID = g.userid
and a.RKLX = 19
group by c.ZRRUSERID;
/*
select c.ZRRUSERID, count(a.KPXXID) num, count(*) cnt
from QYXX_KPRYGLB a,
SYS_LDWHB c
where a.LDID = c.LDID
and a.RKLX = 19
group by c.ZRRUSERID;
*/
create materialized view mv_zrr_lrrk_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6156 流入人口数
select c.ZRRUSERID, count(a.KPXXID) num, count(*) cnt
from QYXX_KPRYGLB a,
QYXX_KPXXB b,
SYS_LDWHB c,
SYS_XQXXB d,
QYXX_CPJTXX e,
SYS_JGXXB f,
SYS_USERINFO g
where a.CYID = e.CYID
and a.KPXXID = b.KPXXID
and b.LDHM = c.LDID
and c.XQID = d.xqid
and c.JGID = f.jgid
and c.ZRRUSERID = g.userid
and a.RKLX = 21
group by c.ZRRUSERID;
/*
*/
create materialized view mv_zrr_hjrk_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6157 户籍人口数
select c.ZRRUSERID, count(a.KPXXID) num, count(*) cnt
from QYXX_KPRYGLB a,
QYXX_KPXXB b,
SYS_LDWHB c,
SYS_XQXXB d,
QYXX_CPJTXX e,
SYS_JGXXB f,
SYS_USERINFO g
where a.CYID = e.CYID
and a.KPXXID = b.KPXXID
and b.LDHM = c.LDID
and c.XQID = d.xqid
and c.JGID = f.jgid
and c.ZRRUSERID = g.userid
and e.HJXXDZ = c.JGID
group by c.ZRRUSERID;
/*
*/
create materialized view mv_zrr_csrk_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6158 出生人口数
select c.ZRRUSERID, count(a.KPXXID) num, count(*) cnt
from QYXX_KPRYGLB a,
QYXX_KPXXB b,
SYS_LDWHB c,
SYS_XQXXB d,
QYXX_CPJTXX e,
SYS_JGXXB f,
SYS_USERINFO g,
sys_time t
where a.CYID = e.CYID
and a.KPXXID = b.KPXXID
and b.LDHM = c.LDID
and c.XQID = d.xqid
and c.JGID = f.jgid
and c.ZRRUSERID = g.userid
and to_char(e.CSNY, 'yyyy') = t.cur_year
group by c.ZRRUSERID;
/*
*/
create materialized view mv_zrr_dbh_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6159 低保户
select c.ZRRUSERID, count(a.KPXXID) num, count(*) cnt
from QYXX_KPRYGLB a,
QYXX_KPXXB b,
SYS_LDWHB c,
SYS_XQXXB d,
QYXX_CPJTXX e,
SYS_JGXXB f,
SYS_USERINFO g,
QYXX_DJWBRY r
where a.CYID = e.CYID
and a.KPXXID = b.KPXXID
and b.LDHM = c.LDID
and c.XQID = d.xqid
and c.JGID = f.jgid
and c.ZRRUSERID = g.userid
and e.CYID = r.CYID
group by c.ZRRUSERID;
/*
*/
create materialized view mv_zrr_kch_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6160 空巢户
select c.ZRRUSERID, count(a.KPXXID) num, count(*) cnt
from QYXX_KPRYGLB a,
QYXX_KPXXB b,
SYS_LDWHB c,
SYS_XQXXB d,
QYXX_CPJTXX e,
SYS_JGXXB f,
SYS_USERINFO g,
QYXX_KCXX r
where a.CYID = e.CYID
and a.KPXXID = b.KPXXID
and b.LDHM = c.LDID
and c.XQID = d.xqid
and c.JGID = f.jgid
and c.ZRRUSERID = g.userid
and e.CYID = r.CYID
group by c.ZRRUSERID;
/*
*/
create materialized view mv_zrr_szbj_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6168 生殖保健
select c.ZRRUSERID, count(a.KPXXID) num, count(*) cnt
from QYXX_KPRYGLB a,
QYXX_KPXXB b,
SYS_LDWHB c,
SYS_XQXXB d,
QYXX_CPJTXX e,
SYS_JGXXB f,
SYS_USERINFO g,
qyxx_cyszbjxx r
where a.CYID = e.CYID
and a.KPXXID = b.KPXXID
and b.LDHM = c.LDID
and c.XQID = d.xqid
and c.JGID = f.jgid
and c.ZRRUSERID = g.userid
and e.CYID = r.CYID
group by c.ZRRUSERID;
/*
*/
create materialized view mv_zrr_jyfw_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6169 就业服务
select c.ZRRUSERID, count(a.KPXXID) num, count(*) cnt
from QYXX_KPRYGLB a,
QYXX_KPXXB b,
SYS_LDWHB c,
SYS_XQXXB d,
QYXX_CPJTXX e,
SYS_JGXXB f,
SYS_USERINFO g,
qyxx_jyfwxx r
where a.CYID = e.CYID
and a.KPXXID = b.KPXXID
and b.LDHM = c.LDID
and c.XQID = d.xqid
and c.JGID = f.jgid
and c.ZRRUSERID = g.userid
and e.CYID = r.CYID
group by c.ZRRUSERID;
/*
*/
create materialized view mv_zrr_cjry_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6170 残疾人员
select c.ZRRUSERID, count(a.KPXXID) num, count(*) cnt
from QYXX_KPRYGLB a,
QYXX_KPXXB b,
SYS_LDWHB c,
SYS_XQXXB d,
QYXX_CPJTXX e,
SYS_JGXXB f,
SYS_USERINFO g,
qyxx_cjry r
where a.CYID = e.CYID
and a.KPXXID = b.KPXXID
and b.LDHM = c.LDID
and c.XQID = d.xqid
and c.JGID = f.jgid
and c.ZRRUSERID = g.userid
and e.CYID = r.CYID
group by c.ZRRUSERID;
/*
*/
create materialized view mv_zrr_flgry_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6171 法轮功人员信息
select c.ZRRUSERID, count(a.KPXXID) num, count(*) cnt
from QYXX_KPRYGLB a,
QYXX_KPXXB b,
SYS_LDWHB c,
SYS_XQXXB d,
QYXX_CPJTXX e,
SYS_JGXXB f,
SYS_USERINFO g,
wqww_flgry r
where a.CYID = e.CYID
and a.KPXXID = b.KPXXID
and b.LDHM = c.LDID
and c.XQID = d.xqid
and c.JGID = f.jgid
and c.ZRRUSERID = g.userid
and e.CYID = r.CYID
group by c.ZRRUSERID;
/*
*/
create materialized view mv_zrr_xsjjry_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6172 刑释解教人员信息
select c.ZRRUSERID, count(a.KPXXID) num, count(*) cnt
from QYXX_KPRYGLB a,
QYXX_KPXXB b,
SYS_LDWHB c,
SYS_XQXXB d,
QYXX_CPJTXX e,
SYS_JGXXB f,
SYS_USERINFO g,
wqww_xsjjry r
where a.CYID = e.CYID
and a.KPXXID = b.KPXXID
and b.LDHM = c.LDID
and c.XQID = d.xqid
and c.JGID = f.jgid
and c.ZRRUSERID = g.userid
and e.CYID = r.CYID
group by c.ZRRUSERID;
/*
*/
create materialized view mv_zrr_txxx_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6173 退休信息
select c.ZRRUSERID, count(a.KPXXID) num, count(*) cnt
from QYXX_KPRYGLB a,
QYXX_KPXXB b,
SYS_LDWHB c,
SYS_XQXXB d,
QYXX_CPJTXX e,
SYS_JGXXB f,
SYS_USERINFO g,
qyxx_txxx r
where a.CYID = e.CYID
and a.KPXXID = b.KPXXID
and b.LDHM = c.LDID
and c.XQID = d.xqid
and c.JGID = f.jgid
and c.ZRRUSERID = g.userid
and e.CYID = r.CYID
group by c.ZRRUSERID;
/*
*/
create materialized view mv_zrr_czcsry_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6174 参战参试
select c.ZRRUSERID, count(a.KPXXID) num, count(*) cnt
from QYXX_KPRYGLB a,
QYXX_KPXXB b,
SYS_LDWHB c,
SYS_XQXXB d,
QYXX_CPJTXX e,
SYS_JGXXB f,
SYS_USERINFO g,
qyxx_czcsry r
where a.CYID = e.CYID
and a.KPXXID = b.KPXXID
and b.LDHM = c.LDID
and c.XQID = d.xqid
and c.JGID = f.jgid
and c.ZRRUSERID = g.userid
and e.CYID = r.CYID
group by c.ZRRUSERID;
/*
*/
create materialized view mv_zrr_ybsb_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6175 医保社保
select c.ZRRUSERID, count(a.KPXXID) num, count(*) cnt
from QYXX_KPRYGLB a,
QYXX_KPXXB b,
SYS_LDWHB c,
SYS_XQXXB d,
QYXX_CPJTXX e,
SYS_JGXXB f,
SYS_USERINFO g,
qyxx_ybsbxx r
where a.CYID = e.CYID
and a.KPXXID = b.KPXXID
and b.LDHM = c.LDID
and c.XQID = d.xqid
and c.JGID = f.jgid
and c.ZRRUSERID = g.userid
and e.CYID = r.CYID
group by c.ZRRUSERID;
/*
*/
create materialized view mv_zrr_cxyljz_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6176 城乡医疗
select c.ZRRUSERID, count(a.KPXXID) num, count(*) cnt
from QYXX_KPRYGLB a,
QYXX_KPXXB b,
SYS_LDWHB c,
SYS_XQXXB d,
QYXX_CPJTXX e,
SYS_JGXXB f,
SYS_USERINFO g,
qyxx_cxyljz r
where a.CYID = e.CYID
and a.KPXXID = b.KPXXID
and b.LDHM = c.LDID
and c.XQID = d.xqid
and c.JGID = f.jgid
and c.ZRRUSERID = g.userid
and e.CYID = r.CYID
group by c.ZRRUSERID;
/*
*/
create materialized view mv_zrr_jjjz_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6177 救灾救济
select c.ZRRUSERID, count(a.KPXXID) num, count(*) cnt
from QYXX_KPRYGLB a,
QYXX_KPXXB b,
SYS_LDWHB c,
SYS_XQXXB d,
QYXX_CPJTXX e,
SYS_JGXXB f,
SYS_USERINFO g,
qyxx_jjjzxx r
where a.CYID = e.CYID
and a.KPXXID = b.KPXXID
and b.LDHM = c.LDID
and c.XQID = d.xqid
and c.JGID = f.jgid
and c.ZRRUSERID = g.userid
and e.CYID = r.CYID
group by c.ZRRUSERID;
/*
*/
create materialized view mv_zrr_scjr_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6178 伤残军人
select c.ZRRUSERID, count(a.KPXXID) num, count(*) cnt
from QYXX_KPRYGLB a,
QYXX_KPXXB b,
SYS_LDWHB c,
SYS_XQXXB d,
QYXX_CPJTXX e,
SYS_JGXXB f,
SYS_USERINFO g,
qyxx_scjrxx r
where a.CYID = e.CYID
and a.KPXXID = b.KPXXID
and b.LDHM = c.LDID
and c.XQID = d.xqid
and c.JGID = f.jgid
and c.ZRRUSERID = g.userid
and e.CYID = r.CYID
group by c.ZRRUSERID;
/*
*/
create materialized view mv_zrr_tsrq_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6179 特殊人群
select c.ZRRUSERID, count(a.KPXXID) num, count(*) cnt
from QYXX_KPRYGLB a,
QYXX_KPXXB b,
SYS_LDWHB c,
SYS_XQXXB d,
QYXX_CPJTXX e,
SYS_JGXXB f,
SYS_USERINFO g,
qyxx_tsrqxx r
where a.CYID = e.CYID
and a.KPXXID = b.KPXXID
and b.LDHM = c.LDID
and c.XQID = d.xqid
and c.JGID = f.jgid
and c.ZRRUSERID = g.userid
and e.CYID = r.CYID
group by c.ZRRUSERID;
/*
*/
create materialized view mv_zrr_xytyry_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6180 现役退役
select c.ZRRUSERID, count(a.KPXXID) num, count(*) cnt
from QYXX_KPRYGLB a,
QYXX_KPXXB b,
SYS_LDWHB c,
SYS_XQXXB d,
QYXX_CPJTXX e,
SYS_JGXXB f,
SYS_USERINFO g,
qyxx_xytyry r
where a.CYID = e.CYID
and a.KPXXID = b.KPXXID
and b.LDHM = c.LDID
and c.XQID = d.xqid
and c.JGID = f.jgid
and c.ZRRUSERID = g.userid
and e.CYID = r.CYID
group by c.ZRRUSERID;
/*
*/
create materialized view mv_zrr_jkxxjc_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6181 健康检查
select c.ZRRUSERID, count(a.KPXXID) num, count(*) cnt
from QYXX_KPRYGLB a,
QYXX_KPXXB b,
SYS_LDWHB c,
SYS_XQXXB d,
QYXX_CPJTXX e,
SYS_JGXXB f,
SYS_USERINFO g,
qyxx_jkxxjc r
where a.CYID = e.CYID
and a.KPXXID = b.KPXXID
and b.LDHM = c.LDID
and c.XQID = d.xqid
and c.JGID = f.jgid
and c.ZRRUSERID = g.userid
and e.CYID = r.CYID
group by c.ZRRUSERID;
/*
*/
create materialized view mv_zrr_bfww_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6182 帮扶慰问
select c.ZRRUSERID, count(a.KPXXID) num, count(*) cnt
from QYXX_KPRYGLB a,
QYXX_KPXXB b,
SYS_LDWHB c,
SYS_XQXXB d,
QYXX_CPJTXX e,
SYS_JGXXB f,
SYS_USERINFO g,
qyxx_bfwwxx r
where a.CYID = e.CYID
and a.KPXXID = b.KPXXID
and b.LDHM = c.LDID
and c.XQID = d.xqid
and c.JGID = f.jgid
and c.ZRRUSERID = g.userid
and e.CYID = r.CYID
group by c.ZRRUSERID;
/*
*/
create materialized view mv_zrr_jyqk_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6183 教育情况
select c.ZRRUSERID, count(a.KPXXID) num, count(*) cnt
from QYXX_KPRYGLB a,
QYXX_KPXXB b,
SYS_LDWHB c,
SYS_XQXXB d,
QYXX_CPJTXX e,
SYS_JGXXB f,
SYS_USERINFO g,
qyxx_jyqkxx r
where a.CYID = e.CYID
and a.KPXXID = b.KPXXID
and b.LDHM = c.LDID
and c.XQID = d.xqid
and c.JGID = f.jgid
and c.ZRRUSERID = g.userid
and e.CYID = r.CYID
group by c.ZRRUSERID;
/*
*/
create materialized view mv_zrr_fzxczyz_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6184 法制宣传志愿者
select c.ZRRUSERID, count(a.KPXXID) num, count(*) cnt
from QYXX_KPRYGLB a,
QYXX_KPXXB b,
SYS_LDWHB c,
SYS_XQXXB d,
QYXX_CPJTXX e,
SYS_JGXXB f,
SYS_USERINFO g,
wqww_fzxczyz r
where a.CYID = e.CYID
and a.KPXXID = b.KPXXID
and b.LDHM = c.LDID
and c.XQID = d.xqid
and c.JGID = f.jgid
and c.ZRRUSERID = g.userid
and e.CYID = r.CYID
group by c.ZRRUSERID;
/*
*/
create materialized view mv_zrr_sqjzry_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6185 社区矫正人员
select c.ZRRUSERID, count(a.KPXXID) num, count(*) cnt
from QYXX_KPRYGLB a,
QYXX_KPXXB b,
SYS_LDWHB c,
SYS_XQXXB d,
QYXX_CPJTXX e,
SYS_JGXXB f,
SYS_USERINFO g,
wqww_sqjzry r
where a.CYID = e.CYID
and a.KPXXID = b.KPXXID
and b.LDHM = c.LDID
and c.XQID = d.xqid
and c.JGID = f.jgid
and c.ZRRUSERID = g.userid
and e.CYID = r.CYID
group by c.ZRRUSERID;
/*
*/
create materialized view mv_zrr_sjzdry_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6186 涉军重点人员
select c.ZRRUSERID, count(a.KPXXID) num, count(*) cnt
from QYXX_KPRYGLB a,
QYXX_KPXXB b,
SYS_LDWHB c,
SYS_XQXXB d,
QYXX_CPJTXX e,
SYS_JGXXB f,
SYS_USERINFO g,
qyxx_sjzdryxx r
where a.CYID = e.CYID
and a.KPXXID = b.KPXXID
and b.LDHM = c.LDID
and c.XQID = d.xqid
and c.JGID = f.jgid
and c.ZRRUSERID = g.userid
and e.CYID = r.CYID
group by c.ZRRUSERID;
/*
*/
create materialized view mv_zrr_xdry_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6187 吸毒人员
select c.ZRRUSERID, count(a.KPXXID) num, count(*) cnt
from QYXX_KPRYGLB a,
QYXX_KPXXB b,
SYS_LDWHB c,
SYS_XQXXB d,
QYXX_CPJTXX e,
SYS_JGXXB f,
SYS_USERINFO g,
qyxx_xdryxx r
where a.CYID = e.CYID
and a.KPXXID = b.KPXXID
and b.LDHM = c.LDID
and c.XQID = d.xqid
and c.JGID = f.jgid
and c.ZRRUSERID = g.userid
and e.CYID = r.CYID
group by c.ZRRUSERID;
/*
*/
create materialized view mv_zrr_wxjsbry_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6188 危险精神病人员
select c.ZRRUSERID, count(a.KPXXID) num, count(*) cnt
from QYXX_KPRYGLB a,
QYXX_KPXXB b,
SYS_LDWHB c,
SYS_XQXXB d,
QYXX_CPJTXX e,
SYS_JGXXB f,
SYS_USERINFO g,
qyxx_wxjsbryxx r
where a.CYID = e.CYID
and a.KPXXID = b.KPXXID
and b.LDHM = c.LDID
and c.XQID = d.xqid
and c.JGID = f.jgid
and c.ZRRUSERID = g.userid
and e.CYID = r.CYID
group by c.ZRRUSERID;
/*
*/
create materialized view mv_zrr_zdqsnry_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6189 重点青少年人员
select c.ZRRUSERID, count(a.KPXXID) num, count(*) cnt
from QYXX_KPRYGLB a,
QYXX_KPXXB b,
SYS_LDWHB c,
SYS_XQXXB d,
QYXX_CPJTXX e,
SYS_JGXXB f,
SYS_USERINFO g,
qyxx_zdqsnryxx r
where a.CYID = e.CYID
and a.KPXXID = b.KPXXID
and b.LDHM = c.LDID
and c.XQID = d.xqid
and c.JGID = f.jgid
and c.ZRRUSERID = g.userid
and e.CYID = r.CYID
group by c.ZRRUSERID;
/*
*/
create materialized view mv_zrr_rmtjy_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6190 人民调解员
select c.ZRRUSERID, count(a.KPXXID) num, count(*) cnt
from QYXX_KPRYGLB a,
QYXX_KPXXB b,
SYS_LDWHB c,
SYS_XQXXB d,
QYXX_CPJTXX e,
SYS_JGXXB f,
SYS_USERINFO g,
qyxx_rmtjy r
where a.CYID = e.CYID
and a.KPXXID = b.KPXXID
and b.LDHM = c.LDID
and c.XQID = d.xqid
and c.JGID = f.jgid
and c.ZRRUSERID = g.userid
and e.CYID = r.CYID
group by c.ZRRUSERID;
/*
*/
create materialized view mv_zrr_ldlzxxy_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6191 楼栋长信息员
select c.ZRRUSERID, count(a.KPXXID) num, count(*) cnt
from QYXX_KPRYGLB a,
QYXX_KPXXB b,
SYS_LDWHB c,
SYS_XQXXB d,
QYXX_CPJTXX e,
SYS_JGXXB f,
SYS_USERINFO g,
qyxx_ldlzxxy r
where a.CYID = e.CYID
and a.KPXXID = b.KPXXID
and b.LDHM = c.LDID
and c.XQID = d.xqid
and c.JGID = f.jgid
and c.ZRRUSERID = g.userid
and e.CYID = r.CYID
group by c.ZRRUSERID;
/*
*/
create materialized view mv_zrr_zjxy_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6192 宗教信仰信息
select c.ZRRUSERID, count(a.KPXXID) num, count(*) cnt
from QYXX_KPRYGLB a,
QYXX_KPXXB b,
SYS_LDWHB c,
SYS_XQXXB d,
QYXX_CPJTXX e,
SYS_JGXXB f,
SYS_USERINFO g,
qyxx_zjxyxx r
where a.CYID = e.CYID
and a.KPXXID = b.KPXXID
and b.LDHM = c.LDID
and c.XQID = d.xqid
and c.JGID = f.jgid
and c.ZRRUSERID = g.userid
and e.CYID = r.CYID
group by c.ZRRUSERID;
/*
*/
create materialized view mv_zrr_yfdxwh_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6193 优抚对象信息
select c.ZRRUSERID, count(a.KPXXID) num, count(*) cnt
from QYXX_KPRYGLB a,
QYXX_KPXXB b,
SYS_LDWHB c,
SYS_XQXXB d,
QYXX_CPJTXX e,
SYS_JGXXB f,
SYS_USERINFO g,
qyxx_yfdxwh r
where a.CYID = e.CYID
and a.KPXXID = b.KPXXID
and b.LDHM = c.LDID
and c.XQID = d.xqid
and c.JGID = f.jgid
and c.ZRRUSERID = g.userid
and e.CYID = r.CYID
group by c.ZRRUSERID;
create materialized view MV_ZRR_GYS_AGG nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6194 党员数
select c.zrruserid,count(a.KPXXID) num,count(*) cnt
from QYXX_KPRYGLB a,
QYXX_KPXXB b,
SYS_LDWHB c,
SYS_XQXXB d,
QYXX_CPJTXX e,
SYS_JGXXB f,
SYS_USERINFO g
where a.CYID = e.CYID
and a.KPXXID = b.KPXXID
and b.LDHM = c.LDID
and c.XQID = d.xqid
and c.JGID = f.jgid
and c.ZRRUSERID = g.userid
and e.zzmm = 43
group by c.zrruserid;
----------------------------------------------------------------------------------------
--新统计指标物化视图 Begin
----------------------------------------------------------------------------------------
create materialized view mv_zrr_jbxx_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--16249 信访事件
select ZRRUSERID, count(JBID) num,count(*) cnt
from ZZWW_ZXJBXX
where SHJG = 0
group by ZRRUSERID;
------------------------------------
create materialized view mv_zrr_zhs_base nologging
build immediate
refresh fast on demand
disable query rewrite
as
select b.zrruserid, a.kpxxid, nvl(a.hm, 1) hm,count(*) cnt
from qyxx_kpryglb a, sys_ldwhb b
where a.ldid = b.ldid
and b.zrruserid is not null
group by b.zrruserid, a.kpxxid,nvl(a.hm, 1);
create materialized view log on mv_zrr_zhs_base nologging with rowid,sequence (zrruserid,kpxxid,hm) including new values;
create materialized view mv_zrr_zhs_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--16288 总户数
select zrruserid, count(hm) num,count(*) cnt
from mv_zrr_zhs_base
group by zrruserid;
--------------------------------------
create materialized view mv_zrr_ghrk_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--40008 挂户人口数
select c.ZRRUSERID, count(a.KPXXID) num,count(*) cnt
from QYXX_KPRYGLB a,
QYXX_KPXXB b,
SYS_LDWHB c,
SYS_XQXXB d,
QYXX_CPJTXX e,
SYS_JGXXB f,
SYS_USERINFO g
where a.CYID = e.CYID
and a.KPXXID = b.KPXXID
and b.LDHM = c.LDID
and c.XQID = d.xqid
and c.JGID = f.jgid
and c.ZRRUSERID = g.userid
and a.RKLX = 621
group by c.ZRRUSERID;
/*
*/
----------------------------------------------------------------------------------------
--新统计指标物化视图 End
----------------------------------------------------------------------------------------
/*
agg物化视图视图日志创建
*/
create materialized view log on mv_zrr_xq_agg nologging with rowid,sequence (zrruserid,num) including new values;
create materialized view log on mv_zrr_ld_agg nologging with rowid,sequence (zrruserid,num) including new values;
create materialized view log on mv_zrr_jjly_agg nologging with rowid,sequence (zrruserid,num) including new values;
create materialized view log on mv_zrr_ldrk_agg nologging with rowid,sequence (zrruserid,num) including new values;
create materialized view log on mv_zrr_kp_agg nologging with rowid,sequence (zrruserid,num) including new values;
create materialized view log on mv_zrr_zzrk_agg nologging with rowid,sequence (zrruserid,num) including new values;
create materialized view log on mv_zrr_ylfn_agg nologging with rowid,sequence (zrruserid,num) including new values;
create materialized view log on mv_zrr_czrk_agg nologging with rowid,sequence (zrruserid,num) including new values;
create materialized view log on mv_zrr_lrrk_agg nologging with rowid,sequence (zrruserid,num) including new values;
create materialized view log on mv_zrr_hjrk_agg nologging with rowid,sequence (zrruserid,num) including new values;
create materialized view log on mv_zrr_csrk_agg nologging with rowid,sequence (zrruserid,num) including new values;
create materialized view log on mv_zrr_dbh_agg nologging with rowid,sequence (zrruserid,num) including new values;
create materialized view log on mv_zrr_kch_agg nologging with rowid,sequence (zrruserid,num) including new values;
create materialized view log on mv_zrr_szbj_agg nologging with rowid,sequence (zrruserid,num) including new values;
create materialized view log on mv_zrr_jyfw_agg nologging with rowid,sequence (zrruserid,num) including new values;
create materialized view log on mv_zrr_cjry_agg nologging with rowid,sequence (zrruserid,num) including new values;
create materialized view log on mv_zrr_flgry_agg nologging with rowid,sequence (zrruserid,num) including new values;
create materialized view log on mv_zrr_xsjjry_agg nologging with rowid,sequence (zrruserid,num) including new values;
create materialized view log on mv_zrr_txxx_agg nologging with rowid,sequence (zrruserid,num) including new values;
create materialized view log on mv_zrr_czcsry_agg nologging with rowid,sequence (zrruserid,num) including new values;
create materialized view log on mv_zrr_ybsb_agg nologging with rowid,sequence (zrruserid,num) including new values;
create materialized view log on mv_zrr_cxyljz_agg nologging with rowid,sequence (zrruserid,num) including new values;
create materialized view log on mv_zrr_jjjz_agg nologging with rowid,sequence (zrruserid,num) including new values;
create materialized view log on mv_zrr_scjr_agg nologging with rowid,sequence (zrruserid,num) including new values;
create materialized view log on mv_zrr_tsrq_agg nologging with rowid,sequence (zrruserid,num) including new values;
create materialized view log on mv_zrr_xytyry_agg nologging with rowid,sequence (zrruserid,num) including new values;
create materialized view log on mv_zrr_jkxxjc_agg nologging with rowid,sequence (zrruserid,num) including new values;
create materialized view log on mv_zrr_bfww_agg nologging with rowid,sequence (zrruserid,num) including new values;
create materialized view log on mv_zrr_jyqk_agg nologging with rowid,sequence (zrruserid,num) including new values;
create materialized view log on mv_zrr_fzxczyz_agg nologging with rowid,sequence (zrruserid,num) including new values;
create materialized view log on mv_zrr_sqjzry_agg nologging with rowid,sequence (zrruserid,num) including new values;
create materialized view log on mv_zrr_sjzdry_agg nologging with rowid,sequence (zrruserid,num) including new values;
create materialized view log on mv_zrr_xdry_agg nologging with rowid,sequence (zrruserid,num) including new values;
create materialized view log on mv_zrr_wxjsbry_agg nologging with rowid,sequence (zrruserid,num) including new values;
create materialized view log on mv_zrr_zdqsnry_agg nologging with rowid,sequence (zrruserid,num) including new values;
create materialized view log on mv_zrr_rmtjy_agg nologging with rowid,sequence (zrruserid,num) including new values;
create materialized view log on mv_zrr_ldlzxxy_agg nologging with rowid,sequence (zrruserid,num) including new values;
create materialized view log on mv_zrr_zjxy_agg nologging with rowid,sequence (zrruserid,num) including new values;
create materialized view log on mv_zrr_yfdxwh_agg nologging with rowid,sequence (zrruserid,num) including new values;
create materialized view log on mv_zrr_jbxx_agg nologging with rowid,sequence (ZRRUSERID,num) including new values;
create materialized view log on mv_zrr_zhs_agg nologging with rowid,sequence (ZRRUSERID,num) including new values;
create materialized view log on mv_zrr_ghrk_agg nologging with rowid,sequence (zrruserid,num) including new values;
create materialized view log on mv_zrr_gys_agg nologging with rowid,sequence (zrruserid,num) including new values;
--gaobin
create materialized view log on mv_zrr_dy_agg nologging with rowid,sequence (ZRRUSERID,num) including new values;
alter table MV_ZRR_GHRK_AGG add constraint UN_ZRR_GHRK unique(zrruserid) using index nologging;
alter table MV_ZRR_ZHS_AGG add constraint UN_ZRR_ZHS unique(zrruserid) using index nologging;
alter table MV_ZRR_JBXX_AGG add constraint UN_ZRR_JBXX unique(zrruserid) using index nologging;
alter table MV_ZRR_YFDXWH_AGG add constraint UN_ZRR_YFDXWH unique(zrruserid) using index nologging;
alter table MV_ZRR_ZJXY_AGG add constraint UN_ZRR_ZJXY unique(zrruserid) using index nologging;
alter table MV_ZRR_LDLZXXY_AGG add constraint UN_ZRR_LDLZXXY unique(zrruserid) using index nologging;
alter table MV_ZRR_RMTJY_AGG add constraint UN_ZRR_RMTJY unique(zrruserid) using index nologging;
alter table MV_ZRR_ZDQSNRY_AGG add constraint UN_ZRR_ZDQSNRY unique(zrruserid) using index nologging;
alter table MV_ZRR_WXJSBRY_AGG add constraint UN_ZRR_WXJSBRY unique(zrruserid) using index nologging;
alter table MV_ZRR_XDRY_AGG add constraint UN_ZRR_XDRY unique(zrruserid) using index nologging;
alter table MV_ZRR_SJZDRY_AGG add constraint UN_ZRR_SJZDRY unique(zrruserid) using index nologging;
alter table MV_ZRR_SQJZRY_AGG add constraint UN_ZRR_SQJZRY unique(zrruserid) using index nologging;
alter table MV_ZRR_FZXCZYZ_AGG add constraint UN_ZRR_FZXCZYZ unique(zrruserid) using index nologging;
alter table MV_ZRR_JYQK_AGG add constraint UN_ZRR_JYQK unique(zrruserid) using index nologging;
alter table MV_ZRR_BFWW_AGG add constraint UN_ZRR_BFWW unique(zrruserid) using index nologging;
alter table MV_ZRR_JKXXJC_AGG add constraint UN_ZRR_JKXXJC unique(zrruserid) using index nologging;
alter table MV_ZRR_XYTYRY_AGG add constraint UN_ZRR_XYTYRY unique(zrruserid) using index nologging;
alter table MV_ZRR_TSRQ_AGG add constraint UN_ZRR_TSRQ unique(zrruserid) using index nologging;
alter table MV_ZRR_JJJZ_AGG add constraint UN_ZRR_JJJZ unique(zrruserid) using index nologging;
alter table MV_ZRR_CXYLJZ_AGG add constraint UN_ZRR_CXYLJZ unique(zrruserid) using index nologging;
alter table MV_ZRR_SCJR_AGG add constraint UN_ZRR_SCJR unique(zrruserid) using index nologging;
alter table MV_ZRR_YBSB_AGG add constraint UN_ZRR_YBSB unique(zrruserid) using index nologging;
alter table MV_ZRR_CZCSRY_AGG add constraint UN_ZRR_CZCSRY unique(zrruserid) using index nologging;
alter table MV_ZRR_TXXX_AGG add constraint UN_ZRR_TXXX unique(zrruserid) using index nologging;
alter table MV_ZRR_XSJJRY_AGG add constraint UN_ZRR_XSJJRY unique(zrruserid) using index nologging;
alter table MV_ZRR_FLGRY_AGG add constraint UN_ZRR_FLGRY unique(zrruserid) using index nologging;
alter table MV_ZRR_CJRY_AGG add constraint UN_ZRR_CJRY unique(zrruserid) using index nologging;
alter table MV_ZRR_JYFW_AGG add constraint UN_ZRR_JYFW unique(zrruserid) using index nologging;
alter table MV_ZRR_SZBJ_AGG add constraint UN_ZRR_SZBJ unique(zrruserid) using index nologging;
alter table MV_ZRR_KCH_AGG add constraint UN_ZRR_KCH unique(zrruserid) using index nologging;
alter table MV_ZRR_DBH_AGG add constraint UN_ZRR_DBH unique(zrruserid) using index nologging;
alter table MV_ZRR_CSRK_AGG add constraint UN_ZRR_CSRK unique(zrruserid) using index nologging;
alter table MV_ZRR_HJRK_AGG add constraint UN_ZRR_HJRK unique(zrruserid) using index nologging;
alter table MV_ZRR_LRRK_AGG add constraint UN_ZRR_LRRK unique(zrruserid) using index nologging;
alter table MV_ZRR_CZRK_AGG add constraint UN_ZRR_CZRK unique(zrruserid) using index nologging;
alter table MV_ZRR_YLFN_AGG add constraint UN_ZRR_YLFN unique(zrruserid) using index nologging;
alter table MV_ZRR_ZZRK_AGG add constraint UN_ZRR_ZZRK unique(zrruserid) using index nologging;
alter table MV_ZRR_KP_AGG add constraint UN_ZRR_KP unique(zrruserid) using index nologging;
alter table MV_ZRR_LDRK_AGG add constraint UN_ZRR_LDRK unique(zrruserid) using index nologging;
alter table MV_ZRR_JJLY_AGG add constraint UN_ZRR_JJLY unique(zrruserid) using index nologging;
alter table MV_ZRR_LD_AGG add constraint UN_ZRR_LD unique(zrruserid) using index nologging;
alter table MV_ZRR_XQ_AGG add constraint UN_ZRR_XQ unique(zrruserid) using index nologging;
alter table MV_ZRR_GYS_AGG add constraint UN_ZRR_GYS unique(zrruserid) using index nologging;
--gaobin
alter table mv_zrr_dy_agg add constraint un_zrr_dy unique(ZRRUSERID) using index nologging;
/*
创建责任人汇总物化视图
*/
create materialized view mv_zrr_dataid nologging
build immediate
refresh fast on demand
disable query rewrite
as
(--6148 小区数量
select a.userid,6148 dataid, nvl(b.num,0) num,1 bs, a.rowid zrr_rid, b.rowid ld_rid from mv_zrr_info a, mv_zrr_xq_agg b where a.userid = b.zrruserid(+)
union all
--6149 楼栋数量
select a.userid,6149 dataid, nvl(b.num,0) num,1 bs, a.rowid zrr_rid, b.rowid ld_rid from mv_zrr_info a, mv_zrr_ld_agg b where a.userid = b.zrruserid(+)
union all
--6150 经济楼宇数量
select a.userid,6150 dataid, nvl(b.num,0) num,1 bs, a.rowid zrr_rid, b.rowid ld_rid from mv_zrr_info a, mv_zrr_jjly_agg b where a.userid = b.zrruserid(+)
union all
--6151 流动人口数量
select a.userid,6151 dataid, nvl(b.num,0) num,1 bs, a.rowid zrr_rid, b.rowid ld_rid from mv_zrr_info a, mv_zrr_ldrk_agg b where a.userid = b.zrruserid(+)
union all
--6152 卡片数
select a.userid,6152 dataid, nvl(b.num,0) num,1 bs, a.rowid zrr_rid, b.rowid ld_rid from mv_zrr_info a, mv_zrr_kp_agg b where a.userid = b.zrruserid(+)
union all
--6153 在住人口数
select a.userid,6153 dataid, nvl(b.num,0) num,1 bs, a.rowid zrr_rid, b.rowid ld_rid from mv_zrr_info a, mv_zrr_zzrk_agg b where a.userid = b.zrruserid(+)
union all
--6154 育龄妇女数
select a.userid,6154 dataid, nvl(b.num,0) num,1 bs, a.rowid zrr_rid, b.rowid ld_rid from mv_zrr_info a, mv_zrr_ylfn_agg b where a.userid = b.zrruserid(+)
union all
--6155 常住人口数
select a.userid,6155 dataid, nvl(b.num,0) num,1 bs, a.rowid zrr_rid, b.rowid ld_rid from mv_zrr_info a, mv_zrr_czrk_agg b where a.userid = b.zrruserid(+)
union all
--6156 流入人口数
select a.userid,6156 dataid, nvl(b.num,0) num,1 bs, a.rowid zrr_rid, b.rowid ld_rid from mv_zrr_info a, mv_zrr_lrrk_agg b where a.userid = b.zrruserid(+)
union all
--6157 户籍人口数
select a.userid,6157 dataid, nvl(b.num,0) num,1 bs, a.rowid zrr_rid, b.rowid ld_rid from mv_zrr_info a, mv_zrr_hjrk_agg b where a.userid = b.zrruserid(+)
union all
--6158 出生人口数
select a.userid,6158 dataid, nvl(b.num,0) num,1 bs, a.rowid zrr_rid, b.rowid ld_rid from mv_zrr_info a, mv_zrr_csrk_agg b where a.userid = b.zrruserid(+)
union all
--6159 低保户
select a.userid,6159 dataid, nvl(b.num,0) num,1 bs, a.rowid zrr_rid, b.rowid ld_rid from mv_zrr_info a, mv_zrr_dbh_agg b where a.userid = b.zrruserid(+)
union all
--6160 空巢户
select a.userid,6160 dataid, nvl(b.num,0) num,1 bs, a.rowid zrr_rid, b.rowid ld_rid from mv_zrr_info a, mv_zrr_kch_agg b where a.userid = b.zrruserid(+)
union all
--6168 生殖保健
select a.userid,6168 dataid, nvl(b.num,0) num,1 bs, a.rowid zrr_rid, b.rowid ld_rid from mv_zrr_info a, mv_zrr_szbj_agg b where a.userid = b.zrruserid(+)
union all
--6169 就业服务
select a.userid,6169 dataid, nvl(b.num,0) num,1 bs, a.rowid zrr_rid, b.rowid ld_rid from mv_zrr_info a, mv_zrr_jyfw_agg b where a.userid = b.zrruserid(+)
union all
--6170 残疾人员
select a.userid,6170 dataid, nvl(b.num,0) num,1 bs, a.rowid zrr_rid, b.rowid ld_rid from mv_zrr_info a, mv_zrr_cjry_agg b where a.userid = b.zrruserid(+)
union all
--6171 法轮功人员信息
select a.userid,6171 dataid, nvl(b.num,0) num,1 bs, a.rowid zrr_rid, b.rowid ld_rid from mv_zrr_info a, mv_zrr_flgry_agg b where a.userid = b.zrruserid(+)
union all
--6172 刑释解教人员信息
select a.userid,6172 dataid, nvl(b.num,0) num,1 bs, a.rowid zrr_rid, b.rowid ld_rid from mv_zrr_info a, mv_zrr_xsjjry_agg b where a.userid = b.zrruserid(+)
union all
--6173 退休信息
select a.userid,6173 dataid, nvl(b.num,0) num,1 bs, a.rowid zrr_rid, b.rowid ld_rid from mv_zrr_info a, mv_zrr_txxx_agg b where a.userid = b.zrruserid(+)
union all
--6174 参战参试
select a.userid,6174 dataid, nvl(b.num,0) num,1 bs, a.rowid zrr_rid, b.rowid ld_rid from mv_zrr_info a, mv_zrr_czcsry_agg b where a.userid = b.zrruserid(+)
union all
--6175 医保社保
select a.userid,6175 dataid, nvl(b.num,0) num,1 bs, a.rowid zrr_rid, b.rowid ld_rid from mv_zrr_info a, mv_zrr_ybsb_agg b where a.userid = b.zrruserid(+)
union all
--6176 城乡医疗
select a.userid,6176 dataid, nvl(b.num,0) num,1 bs, a.rowid zrr_rid, b.rowid ld_rid from mv_zrr_info a, mv_zrr_cxyljz_agg b where a.userid = b.zrruserid(+)
union all
--6177 救灾救济
select a.userid,6177 dataid, nvl(b.num,0) num,1 bs, a.rowid zrr_rid, b.rowid ld_rid from mv_zrr_info a, mv_zrr_jjjz_agg b where a.userid = b.zrruserid(+)
union all
--6178 伤残军人
select a.userid,6178 dataid, nvl(b.num,0) num,1 bs, a.rowid zrr_rid, b.rowid ld_rid from mv_zrr_info a, mv_zrr_scjr_agg b where a.userid = b.zrruserid(+)
union all
--6179 特殊人群
select a.userid,6179 dataid, nvl(b.num,0) num,1 bs, a.rowid zrr_rid, b.rowid ld_rid from mv_zrr_info a, mv_zrr_tsrq_agg b where a.userid = b.zrruserid(+)
union all
--6180 现役退役
select a.userid,6180 dataid, nvl(b.num,0) num,1 bs, a.rowid zrr_rid, b.rowid ld_rid from mv_zrr_info a, mv_zrr_xytyry_agg b where a.userid = b.zrruserid(+)
union all
--6181 健康检查
select a.userid,6181 dataid, nvl(b.num,0) num,1 bs, a.rowid zrr_rid, b.rowid ld_rid from mv_zrr_info a, mv_zrr_jkxxjc_agg b where a.userid = b.zrruserid(+)
union all
--6182 帮扶慰问
select a.userid,6182 dataid, nvl(b.num,0) num,1 bs, a.rowid zrr_rid, b.rowid ld_rid from mv_zrr_info a, mv_zrr_bfww_agg b where a.userid = b.zrruserid(+)
union all
--6183 教育情况
select a.userid,6183 dataid, nvl(b.num,0) num,1 bs, a.rowid zrr_rid, b.rowid ld_rid from mv_zrr_info a, mv_zrr_jyqk_agg b where a.userid = b.zrruserid(+)
union all
--6184 法制宣传志愿者
select a.userid,6184 dataid, nvl(b.num,0) num,1 bs, a.rowid zrr_rid, b.rowid ld_rid from mv_zrr_info a, mv_zrr_fzxczyz_agg b where a.userid = b.zrruserid(+)
union all
--6185 社区矫正人员
select a.userid,6185 dataid, nvl(b.num,0) num,1 bs, a.rowid zrr_rid, b.rowid ld_rid from mv_zrr_info a, mv_zrr_sqjzry_agg b where a.userid = b.zrruserid(+)
union all
--6186 涉军重点人员
select a.userid,6186 dataid, nvl(b.num,0) num,1 bs, a.rowid zrr_rid, b.rowid ld_rid from mv_zrr_info a, mv_zrr_sjzdry_agg b where a.userid = b.zrruserid(+)
union all
--6187 吸毒人员
select a.userid,6187 dataid, nvl(b.num,0) num,1 bs, a.rowid zrr_rid, b.rowid ld_rid from mv_zrr_info a, mv_zrr_xdry_agg b where a.userid = b.zrruserid(+)
union all
--6188 危险精神病人员
select a.userid,6188 dataid, nvl(b.num,0) num,1 bs, a.rowid zrr_rid, b.rowid ld_rid from mv_zrr_info a, mv_zrr_wxjsbry_agg b where a.userid = b.zrruserid(+)
union all
--6189 重点青少年人员
select a.userid,6189 dataid, nvl(b.num,0) num,1 bs, a.rowid zrr_rid, b.rowid ld_rid from mv_zrr_info a, mv_zrr_zdqsnry_agg b where a.userid = b.zrruserid(+)
union all
--6190 人民调解员
select a.userid,6190 dataid, nvl(b.num,0) num,1 bs, a.rowid zrr_rid, b.rowid ld_rid from mv_zrr_info a, mv_zrr_rmtjy_agg b where a.userid = b.zrruserid(+)
union all
--6191 楼栋长信息员
select a.userid,6191 dataid, nvl(b.num,0) num,1 bs, a.rowid zrr_rid, b.rowid ld_rid from mv_zrr_info a, mv_zrr_ldlzxxy_agg b where a.userid = b.zrruserid(+)
union all
--6192 宗教信仰信息
select a.userid,6192 dataid, nvl(b.num,0) num,1 bs, a.rowid zrr_rid, b.rowid ld_rid from mv_zrr_info a, mv_zrr_zjxy_agg b where a.userid = b.zrruserid(+)
union all
--6193 优抚对象信息
select a.userid,6193 dataid, nvl(b.num,0) num,1 bs, a.rowid zrr_rid, b.rowid ld_rid from mv_zrr_info a, mv_zrr_yfdxwh_agg b where a.userid = b.zrruserid(+)
union all
--6194 党员数
select a.userid,6194 dataid, nvl(b.num,0) num,1 bs, a.rowid zrr_rid, b.rowid ld_rid from mv_zrr_info a, mv_zrr_gys_agg b where a.userid = b.zrruserid(+)
union all
--16249 信访事件
select a.userid, 16249 dataid, nvl(b.num,0) num, 1 bs, a.rowid zrr_rid, b.rowid ld_rid from mv_zrr_info a, mv_zrr_jbxx_agg b where a.userid = b.zrruserid(+)
union all
--16288 总户数
select a.userid, 16288 dataid, nvl(b.num,0) num, 1 bs, a.rowid zrr_rid, b.rowid ld_rid from mv_zrr_info a, mv_zrr_zhs_agg b where a.userid = b.zrruserid(+)
union all
--40008 挂户人口数
select a.userid, 40008 dataid, nvl(b.num,0) num, 1 bs, a.rowid zrr_rid, b.rowid ld_rid from mv_zrr_info a, mv_zrr_ghrk_agg b where a.userid = b.zrruserid(+)
union all
--30919党员数
select a.userid, 30919 dataid, nvl(b.num,0) num, 1 bs, a.rowid zrr_rid, b.rowid ld_rid from mv_zrr_info a, mv_zrr_dy_agg b where a.userid = b.zrruserid(+)
);
----------------------------------------------------------------------------------------
--责任人类统计指标物化视图 End
----------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------
--楼栋类统计指标物化视图 Begin
----------------------------------------------------------------------------------------
--6148 小区数量
--6149 楼栋数量
--6150 经济楼宇数量
create materialized view mv_ld_ldrk_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6151 流动人口数量
select a.ldid, count(a.kpxxid) num,count(*) cnt
from qyxx_kpryglb a
where a.RKLX in (20, 21)
group by a.ldid;
create materialized view mv_ld_kp_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6152 卡片数
select b.ldid, count(KPXXID) num,count(*) cnt
from QYXX_KPXXB a, SYS_LDWHB b
where a.LDHM = b.ldid
group by b.ldid;
create materialized view mv_ld_zzrk_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6153 在住人口数
select a.ldid, count(a.kpxxid) num,count(*) cnt
from qyxx_kpryglb a
group by a.ldid;
create materialized view mv_ld_lyfn_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6154 育龄妇女数
select a.ldid, count(*) num,count(*) cnt
from YLFN_YLFNJBXX q, QYXX_KPRYGLB a
where q.YLZD4 = a.GUANLIID
group by a.ldid;
create materialized view mv_ld_czrk_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6155 常住人口数
select a.ldid, count(a.KPXXID) num,count(*) cnt
from QYXX_KPRYGLB a
where a.RKLX = 19
group by a.ldid;
create materialized view mv_ld_lrrk_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6156 流入人口数
select a.ldid, count(a.KPXXID) num, count(*) cnt
from QYXX_KPRYGLB a
where a.RKLX = 21
group by a.ldid;
--6157 户籍人口数
--6158 出生人口数
create materialized view mv_ld_dbh_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6159 低保户
select a.ldid, count(a.KPXXID) num, count(*) cnt
from QYXX_KPRYGLB a,QYXX_DJWBRY r
where a.CYID = r.CYID
group by a.ldid;
create materialized view mv_ld_kch_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6160 空巢户
select a.ldid, count(a.KPXXID) num, count(*) cnt
from QYXX_KPRYGLB a,QYXX_KCXX r
where a.CYID = r.CYID
group by a.ldid;
create materialized view mv_ld_szbj_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6168 生殖保健
select a.ldid, count(a.KPXXID) num, count(*) cnt
from QYXX_KPRYGLB a,qyxx_cyszbjxx r
where a.CYID = r.CYID
group by a.ldid;
create materialized view mv_ld_jyfw_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6169 就业服务
select a.ldid, count(a.KPXXID) num, count(*) cnt
from QYXX_KPRYGLB a,qyxx_jyfwxx r
where a.CYID = r.CYID
group by a.ldid;
create materialized view mv_ld_cjry_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6170 残疾人员
select a.ldid, count(a.KPXXID) num, count(*) cnt
from QYXX_KPRYGLB a,qyxx_cjry r
where a.CYID = r.CYID
group by a.ldid;
create materialized view mv_ld_flgry_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6171 法轮功人员信息
select a.ldid, count(a.KPXXID) num, count(*) cnt
from QYXX_KPRYGLB a,wqww_flgry r
where a.CYID = r.CYID
group by a.ldid;
create materialized view mv_ld_xsjjry_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6172 刑释解教人员信息
select a.ldid, count(a.KPXXID) num, count(*) cnt
from QYXX_KPRYGLB a,wqww_xsjjry r
where a.CYID = r.CYID
group by a.ldid;
create materialized view mv_ld_txxx_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6173 退休信息
select a.ldid, count(a.KPXXID) num, count(*) cnt
from QYXX_KPRYGLB a,qyxx_txxx r
where a.CYID = r.CYID
group by a.ldid;
create materialized view mv_ld_czcsry_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6174 参战参试
select a.ldid, count(a.KPXXID) num, count(*) cnt
from QYXX_KPRYGLB a,qyxx_czcsry r
where a.CYID = r.CYID
group by a.ldid;
create materialized view mv_ld_ybsb_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6175 医保社保
select a.ldid, count(a.KPXXID) num, count(*) cnt
from QYXX_KPRYGLB a,qyxx_ybsbxx r
where a.CYID = r.CYID
group by a.ldid;
create materialized view mv_ld_cxyljz_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6176 城乡医疗
select a.ldid, count(a.KPXXID) num, count(*) cnt
from QYXX_KPRYGLB a,qyxx_cxyljz r
where a.CYID = r.CYID
group by a.ldid;
create materialized view mv_ld_jjjz_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6177 救灾救济
select a.ldid, count(a.KPXXID) num, count(*) cnt
from QYXX_KPRYGLB a,qyxx_jjjzxx r
where a.CYID = r.CYID
group by a.ldid;
create materialized view mv_ld_scjr_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6178 伤残军人
select a.ldid, count(a.KPXXID) num, count(*) cnt
from QYXX_KPRYGLB a,qyxx_scjrxx r
where a.CYID = r.CYID
group by a.ldid;
create materialized view mv_ld_tsrq_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6179 特殊人群
select a.ldid, count(a.KPXXID) num, count(*) cnt
from QYXX_KPRYGLB a,qyxx_tsrqxx r
where a.CYID = r.CYID
group by a.ldid;
create materialized view mv_ld_xytyry_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6180 现役退役
select a.ldid, count(a.KPXXID) num, count(*) cnt
from QYXX_KPRYGLB a,qyxx_xytyry r
where a.CYID = r.CYID
group by a.ldid;
create materialized view mv_ld_jkxxjc_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6181 健康检查
select a.ldid, count(a.KPXXID) num, count(*) cnt
from QYXX_KPRYGLB a,qyxx_jkxxjc r
where a.CYID = r.CYID
group by a.ldid;
create materialized view mv_ld_bfww_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6182 帮扶慰问
select a.ldid, count(a.KPXXID) num, count(*) cnt
from QYXX_KPRYGLB a,qyxx_bfwwxx r
where a.CYID = r.CYID
group by a.ldid;
create materialized view mv_ld_jyqk_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6183 教育情况
select a.ldid, count(a.KPXXID) num, count(*) cnt
from QYXX_KPRYGLB a,qyxx_jyqkxx r
where a.CYID = r.CYID
group by a.ldid;
create materialized view mv_ld_fzxczyz_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6184 法制宣传志愿者
select a.ldid, count(a.KPXXID) num, count(*) cnt
from QYXX_KPRYGLB a,wqww_fzxczyz r
where a.CYID = r.CYID
group by a.ldid;
create materialized view mv_ld_sqjzry_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6185 社区矫正人员
select a.ldid, count(a.KPXXID) num, count(*) cnt
from QYXX_KPRYGLB a,wqww_sqjzry r
where a.CYID = r.CYID
group by a.ldid;
create materialized view mv_ld_sjzdry_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6186 涉军重点人员
select a.ldid, count(a.KPXXID) num, count(*) cnt
from QYXX_KPRYGLB a,qyxx_sjzdryxx r
where a.CYID = r.CYID
group by a.ldid;
create materialized view mv_ld_xdry_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6187 吸毒人员
select a.ldid, count(a.KPXXID) num, count(*) cnt
from QYXX_KPRYGLB a,qyxx_xdryxx r
where a.CYID = r.CYID
group by a.ldid;
create materialized view mv_ld_wxjsbry_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6188 危险精神病人员
select a.ldid, count(a.KPXXID) num, count(*) cnt
from QYXX_KPRYGLB a,qyxx_wxjsbryxx r
where a.CYID = r.CYID
group by a.ldid;
create materialized view mv_ld_zdqsnry_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6189 重点青少年人员
select a.ldid, count(a.KPXXID) num, count(*) cnt
from QYXX_KPRYGLB a,qyxx_zdqsnryxx r
where a.CYID = r.CYID
group by a.ldid;
create materialized view mv_ld_rmtjy_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6190 人民调解员
select a.ldid, count(a.KPXXID) num, count(*) cnt
from QYXX_KPRYGLB a,qyxx_rmtjy r
where a.CYID = r.CYID
group by a.ldid;
create materialized view mv_ld_ldlzxxy_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6191 楼栋长信息员
select a.ldid, count(a.KPXXID) num, count(*) cnt
from QYXX_KPRYGLB a,qyxx_ldlzxxy r
where a.CYID = r.CYID
group by a.ldid;
create materialized view mv_ld_zjxy_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6192 宗教信仰信息
select a.ldid, count(a.KPXXID) num, count(*) cnt
from QYXX_KPRYGLB a,qyxx_zjxyxx r
where a.CYID = r.CYID
group by a.ldid;
create materialized view mv_ld_yfdxwh_agg nologging
build immediate
refresh fast on demand
disable query rewrite
as
--6193 优抚对象信息
select a.ldid, count(a.KPXXID) num, count(*) cnt
from QYXX_KPRYGLB a,qyxx_yfdxwh r
where a.CYID = r.CYID
group by a.ldid;
--2014
create materialized view MV_LD_xsqsn_AGG nologging
build immediate
refresh fast on demand
disable query rewrite
as
select a.ldid, count(a.KPXXID) num, count(*) cnt
from QYXX_KPRYGLB a,xz_xsqsn r
where a.CYID = r.CYID
group by a.ldid;
create materialized view MV_LD_azbhz_AGG nologging
build immediate
refresh fast on demand
disable query rewrite
as
select a.ldid, count(a.KPXXID) num, count(*) cnt
from QYXX_KPRYGLB a,xz_azbhz r
where a.CYID = r.CYID
group by a.ldid;
create materialized view MV_LD_xfzdry_AGG nologging
build immediate
refresh fast on demand
disable query rewrite
as
select a.ldid, count(a.KPXXID) num, count(*) cnt
from QYXX_KPRYGLB a,qyxx_xfzdry r
where a.CYID = r.CYID
group by a.ldid;
create materialized view MV_LD_zjxyxx_AGG nologging
build immediate
refresh fast on demand
disable query rewrite
as
select a.ldid, count(a.KPXXID) num, count(*) cnt
from QYXX_KPRYGLB a,qyxx_zjxyxx r
where a.CYID = r.CYID
group by a.ldid;
create materialized view MV_LD_lset_AGG nologging
build immediate
refresh fast on demand
disable query rewrite
as
select a.ldid, count(a.KPXXID) num, count(*) cnt
from QYXX_KPRYGLB a,xz_lset r
where a.CYID = r.CYID
group by a.ldid;
create materialized view MV_LD_lsfn_AGG nologging
build immediate
refresh fast on demand
disable query rewrite
as
select a.ldid, count(a.KPXXID) num, count(*) cnt
from QYXX_KPRYGLB a,qyxx_lsfn r
where a.CYID = r.CYID
group by a.ldid;
/*
agg物化视图视图日志创建
*/
create materialized view log on mv_ld_ldrk_agg nologging with rowid,sequence (ldid,num) including new values;
create materialized view log on mv_ld_kp_agg nologging with rowid,sequence (ldid,num) including new values;
create materialized view log on mv_ld_zzrk_agg nologging with rowid,sequence (ldid,num) including new values;
create materialized view log on mv_ld_lyfn_agg nologging with rowid,sequence (ldid,num) including new values;
create materialized view log on mv_ld_czrk_agg nologging with rowid,sequence (ldid,num) including new values;
create materialized view log on mv_ld_lrrk_agg nologging with rowid,sequence (ldid,num) including new values;
create materialized view log on mv_ld_dbh_agg nologging with rowid,sequence (ldid,num) including new values;
create materialized view log on mv_ld_kch_agg nologging with rowid,sequence (ldid,num) including new values;
create materialized view log on mv_ld_szbj_agg nologging with rowid,sequence (ldid,num) including new values;
create materialized view log on mv_ld_jyfw_agg nologging with rowid,sequence (ldid,num) including new values;
create materialized view log on mv_ld_cjry_agg nologging with rowid,sequence (ldid,num) including new values;
create materialized view log on mv_ld_flgry_agg nologging with rowid,sequence (ldid,num) including new values;
create materialized view log on mv_ld_xsjjry_agg nologging with rowid,sequence (ldid,num) including new values;
create materialized view log on mv_ld_txxx_agg nologging with rowid,sequence (ldid,num) including new values;
create materialized view log on mv_ld_czcsry_agg nologging with rowid,sequence (ldid,num) including new values;
create materialized view log on mv_ld_ybsb_agg nologging with rowid,sequence (ldid,num) including new values;
create materialized view log on mv_ld_cxyljz_agg nologging with rowid,sequence (ldid,num) including new values;
create materialized view log on mv_ld_jjjz_agg nologging with rowid,sequence (ldid,num) including new values;
create materialized view log on mv_ld_scjr_agg nologging with rowid,sequence (ldid,num) including new values;
create materialized view log on mv_ld_tsrq_agg nologging with rowid,sequence (ldid,num) including new values;
create materialized view log on mv_ld_xytyry_agg nologging with rowid,sequence (ldid,num) including new values;
create materialized view log on mv_ld_jkxxjc_agg nologging with rowid,sequence (ldid,num) including new values;
create materialized view log on mv_ld_bfww_agg nologging with rowid,sequence (ldid,num) including new values;
create materialized view log on mv_ld_jyqk_agg nologging with rowid,sequence (ldid,num) including new values;
create materialized view log on mv_ld_fzxczyz_agg nologging with rowid,sequence (ldid,num) including new values;
create materialized view log on mv_ld_sqjzry_agg nologging with rowid,sequence (ldid,num) including new values;
create materialized view log on mv_ld_sjzdry_agg nologging with rowid,sequence (ldid,num) including new values;
create materialized view log on mv_ld_xdry_agg nologging with rowid,sequence (ldid,num) including new values;
create materialized view log on mv_ld_wxjsbry_agg nologging with rowid,sequence (ldid,num) including new values;
create materialized view log on mv_ld_zdqsnry_agg nologging with rowid,sequence (ldid,num) including new values;
create materialized view log on mv_ld_rmtjy_agg nologging with rowid,sequence (ldid,num) including new values;
create materialized view log on mv_ld_ldlzxxy_agg nologging with rowid,sequence (ldid,num) including new values;
create materialized view log on mv_ld_zjxy_agg nologging with rowid,sequence (ldid,num) including new values;
create materialized view log on mv_ld_yfdxwh_agg nologging with rowid,sequence (ldid,num) including new values;
--2014
create materialized view log on MV_LD_xsqsn_AGG nologging with rowid,sequence (ldid,num) including new values;
create materialized view log on MV_LD_azbhz_AGG nologging with rowid,sequence (ldid,num) including new values;
create materialized view log on MV_LD_xfzdry_AGG nologging with rowid,sequence (ldid,num) including new values;
create materialized view log on MV_LD_zjxyxx_AGG nologging with rowid,sequence (ldid,num) including new values;
create materialized view log on MV_LD_lset_AGG nologging with rowid,sequence (ldid,num) including new values;
create materialized view log on MV_LD_lsfn_AGG nologging with rowid,sequence (ldid,num) including new values;
/*
创建楼栋汇总物化视图
*/
create materialized view mv_ld_dataid nologging
build immediate
refresh fast on demand
disable query rewrite
as
(--6151 流动人口数量
select ldid userid,6151 dataid,num,3 bs,rowid rid from mv_ld_ldrk_agg
union all
--6152 卡片数
select ldid userid,6152 dataid,num,3 bs,rowid rid from mv_ld_kp_agg
union all
--6153 在住人口数
select ldid userid,6153 dataid,num,3 bs,rowid rid from mv_ld_zzrk_agg
union all
--6154 育龄妇女数
select ldid userid,6154 dataid,num,3 bs,rowid rid from mv_ld_lyfn_agg
union all
--6155 常住人口数
select ldid userid,6155 dataid,num,3 bs,rowid rid from mv_ld_czrk_agg
union all
--6156 流入人口数
select ldid userid,6156 dataid,num,3 bs,rowid rid from mv_ld_lrrk_agg
union all
--6159 低保户
select ldid userid,6159 dataid,num,3 bs,rowid rid from mv_ld_dbh_agg
union all
--6160 空巢户
select ldid userid,6160 dataid,num,3 bs,rowid rid from mv_ld_kch_agg
union all
--6168 生殖保健
select ldid userid,6168 dataid,num,3 bs,rowid rid from mv_ld_szbj_agg
union all
--6169 就业服务
select ldid userid,6169 dataid,num,3 bs,rowid rid from mv_ld_jyfw_agg
union all
--6170 残疾人员
select ldid userid,6170 dataid,num,3 bs,rowid rid from mv_ld_cjry_agg
union all
--6171 法轮功人员信息
select ldid userid,6171 dataid,num,3 bs,rowid rid from mv_ld_flgry_agg
union all
--6172 刑释解教人员信息
select ldid userid,6172 dataid,num,3 bs,rowid rid from mv_ld_xsjjry_agg
union all
--6173 退休信息
select ldid userid,6173 dataid,num,3 bs,rowid rid from mv_ld_txxx_agg
union all
--6174 参战参试
select ldid userid,6174 dataid,num,3 bs,rowid rid from mv_ld_czcsry_agg
union all
--6175 医保社保
select ldid userid,6175 dataid,num,3 bs,rowid rid from mv_ld_ybsb_agg
union all
--6176 城乡医疗
select ldid userid,6176 dataid,num,3 bs,rowid rid from mv_ld_cxyljz_agg
union all
--6177 救灾救济
select ldid userid,6177 dataid,num,3 bs,rowid rid from mv_ld_jjjz_agg
union all
--6178 伤残军人
select ldid userid,6178 dataid,num,3 bs,rowid rid from mv_ld_scjr_agg
union all
--6179 特殊人群
select ldid userid,6179 dataid,num,3 bs,rowid rid from mv_ld_tsrq_agg
union all
--6180 现役退役
select ldid userid,6180 dataid,num,3 bs,rowid rid from mv_ld_xytyry_agg
union all
--6181 健康检查
select ldid userid,6181 dataid,num,3 bs,rowid rid from mv_ld_jkxxjc_agg
union all
--6182 帮扶慰问
select ldid userid,6182 dataid,num,3 bs,rowid rid from mv_ld_bfww_agg
union all
--6183 教育情况
select ldid userid,6183 dataid,num,3 bs,rowid rid from mv_ld_jyqk_agg
union all
--6184 法制宣传志愿者
select ldid userid,6184 dataid,num,3 bs,rowid rid from mv_ld_fzxczyz_agg
union all
--6185 社区矫正人员
select ldid userid,6185 dataid,num,3 bs,rowid rid from mv_ld_sqjzry_agg
union all
--6186 涉军重点人员
select ldid userid,6186 dataid,num,3 bs,rowid rid from mv_ld_sjzdry_agg
union all
--6187 吸毒人员
select ldid userid,6187 dataid,num,3 bs,rowid rid from mv_ld_xdry_agg
union all
--6188 危险精神病人员
select ldid userid,6188 dataid,num,3 bs,rowid rid from mv_ld_wxjsbry_agg
union all
--6189 重点青少年人员
select ldid userid,6189 dataid,num,3 bs,rowid rid from mv_ld_zdqsnry_agg
union all
--6190 人民调解员
select ldid userid,6190 dataid,num,3 bs,rowid rid from mv_ld_rmtjy_agg
union all
--6191 楼栋长信息员
select ldid userid,6191 dataid,num,3 bs,rowid rid from mv_ld_ldlzxxy_agg
union all
--6192 宗教信仰信息
select ldid userid,6192 dataid,num,3 bs,rowid rid from mv_ld_zjxy_agg
union all
--6193 优抚对象信息
select ldid userid,6193 dataid,num,3 bs,rowid rid from mv_ld_yfdxwh_agg
union all
--60000 闲散青少年
select ldid userid,60000 dataid,num,3 bs,rowid rid from MV_LD_xsqsn_AGG
union all
--60001 艾滋病患者
select ldid userid,60001 dataid,num,3 bs,rowid rid from MV_LD_azbhz_AGG
union all
--60002 信访重点人员
select ldid userid,60002 dataid,num,3 bs,rowid rid from MV_LD_xfzdry_AGG
union all
--60003 宗教信仰人员
select ldid userid,60003 dataid,num,3 bs,rowid rid from MV_LD_zjxyxx_AGG
union all
--60004 留守儿童
select ldid userid,60004 dataid,num,3 bs,rowid rid from MV_LD_lset_AGG
union all
--60005 留守妇女
select ldid userid,60005 dataid,num,3 bs,rowid rid from MV_LD_lsfn_AGG
);
----------------------------------------------------------------------------------------
--楼栋类统计指标物化视图 End
----------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------
--预警和通报类统计指标物化视图 Begin
----------------------------------------------------------------------------------------
--创建临时表
create global temporary table temp_tbyj_dataid
(jgid number,
jgbm varchar2(25),
dataid number,
num number,
bs number,
refresh_time date)
on commit preserve rows;
--创建结果表
create table tjxx_tbyj_dataid
(
userid number,
jgbm varchar2(25),
dataid number,
num number,
bs number,
refresh_time date
);
/*
create materialized view mv_tbyj_110_c nologging
build immediate
refresh complete on demand
disable query rewrite
as
--6208 城市110
select jg.jgid, jg.jgbm, 6208 dataid, nvl(sum(num),0) num, 2 bs
from mv_jg_info jg
inner join (select b.jgbm, count(cs110id) num
from cs110 a, sys_jgxxb b
where a.jbjgid = b.jgid
and shr is null
group by b.jgbm) o
on regexp_like(o.jgbm, jg.jgbm)
group by jg.jgid, jg.jgbm;
create materialized view mv_tbyj_noid_c nologging
build immediate
refresh complete on demand
disable query rewrite
as
--6209 无身份证(预警提示)
select jg.jgid, jg.jgbm, 6209 dataid, nvl(sum(num),0) num, 2 bs
from mv_jg_info jg
inner join (select b.jgbm, count(g.cyid) num
from qyxx_kpryglb a, sys_jgxxb b, qyxx_cpjtxx g
where a.jgid = b.jgid
and a.cyid = g.cyid
and a.sfczr = 'N'
and g.sfzh is null
group by b.jgbm) o
on regexp_like(o.jgbm, jg.jgbm)
group by jg.jgid, jg.jgbm;
create materialized view mv_tbyj_szbj_c nologging
build immediate
refresh complete on demand
disable query rewrite
as
--6210 生殖保健(预警提示)
select jg.jgid, jg.jgbm, 6210 dataid, nvl(sum(num),0) num, 2 bs
from mv_jg_info jg
inner join (select b.jgbm, count(guanliid) num
from qyxx_kpryglb a,
sys_jgxxb b,
sys_ldwhb c,
sys_xqxxb d,
sys_userinfo e,
qyxx_kpxxb f,
qyxx_cpjtxx g
where a.kpxxid = f.kpxxid
and f.ldhm = c.ldid
and c.xqid = d.xqid
and c.zrruserid = e.userid
and b.jgid = c.jgid
and a.cyid = g.cyid
and a.cyid in
(select p.cyid
from qyxx_cyszbjxx p
where 1 = 1
and ((p.syzlx = 265 and p.syzjhm is null and
months_between(sysdate, p.syzfzsj) > 4) or
(p.syzlx = 264 and sysj is null and
months_between(sysdate, p.syzfzsj) > 4)))
group by b.jgbm) o
on regexp_like(o.jgbm, jg.jgbm)
group by jg.jgid, jg.jgbm;
create materialized view mv_tbyj_hywjg_c nologging
build immediate
refresh complete on demand
disable query rewrite
as
--6211 怀孕无结果(预警提示)
select jg.jgid, jg.jgbm, 6211 dataid, nvl(sum(num),0) num, 2 bs
from mv_jg_info jg
inner join (select f.jgbm, count(a.kpxxid) num
from qyxx_kpryglb a,
qyxx_kpxxb b,
sys_ldwhb c,
sys_ldwhb d,
qyxx_cpjtxx e,
sys_jgxxb f,
sys_userinfo g
where a.cyid = e.cyid
and a.kpxxid = b.kpxxid
and b.ldhm = c.ldid
and c.xqid = d.xqid
and c.jgid = f.jgid
and c.zrruserid = g.userid
and e.cyid in
(select cyid
from qyxx_cyszbjxx
where 1 = 1
and syjssj is null
and hyjg is null
and (sysdate - to_date(to_char(sysj, 'yyyy-MM-dd'),
'yyyy-MM-dd')) > 300
and (sysdate - to_date(to_char(sysj, 'yyyy-MM-dd'),
'yyyy-MM-dd')) < 720)
group by f.jgbm) o
on regexp_like(o.jgbm, jg.jgbm)
group by jg.jgid, jg.jgbm;
create materialized view mv_tbyj_dcjy_c nologging
build immediate
refresh complete on demand
disable query rewrite
as
--6212 待产节育(预警提示)
select jg.jgid, jg.jgbm, 6212 dataid, nvl(sum(num),0) num, 2 bs
from mv_jg_info jg
inner join (select f.jgbm, count(a.kpxxid) num
from qyxx_kpryglb a,
qyxx_kpxxb b,
sys_ldwhb c,
sys_ldwhb d,
qyxx_cpjtxx e,
sys_jgxxb f,
sys_userinfo g
where a.cyid = e.cyid
and a.kpxxid = b.kpxxid
and b.ldhm = c.ldid
and c.xqid = d.xqid
and c.jgid = f.jgid
and c.zrruserid = g.userid
and e.cyid in
(select cyid
from qyxx_cyszbjxx
where 1 = 1
and (syjssj is null and
(sysdate - to_date(to_char(sysj, 'yyyy-MM-dd'),
'yyyy-MM-dd')) > 265 and
(sysdate - to_date(to_char(sysj, 'yyyy-MM-dd'),
'yyyy-MM-dd')) < 720)
or (hyjg is null and syjssj is not null and
(sysdate - to_date(to_char(syjssj, 'yyyy-MM-dd'),
'yyyy-MM-dd')) > 42 and
(sysdate - to_date(to_char(syjssj, 'yyyy-MM-dd'),
'yyyy-MM-dd')) < 720))
group by f.jgbm) o
on regexp_like(o.jgbm, jg.jgbm)
group by jg.jgid, jg.jgbm;
create materialized view mv_tbyj_scjy_c nologging
build immediate
refresh complete on demand
disable query rewrite
as
--6213 生产待节育(预警提示)
select jg.jgid, jg.jgbm, 6213 dataid, nvl(sum(num),0) num, 2 bs
from mv_jg_info jg
inner join (select f.jgbm, count(a.kpxxid) num
from qyxx_kpryglb a,
qyxx_kpxxb b,
sys_ldwhb c,
sys_ldwhb d,
qyxx_cpjtxx e,
sys_jgxxb f,
sys_userinfo g
where a.cyid = e.cyid
and a.kpxxid = b.kpxxid
and b.ldhm = c.ldid
and c.xqid = d.xqid
and c.jgid = f.jgid
and c.zrruserid = g.userid
and e.cyid in
(select q.cyid
from qyxx_cyszbjxx q
where 1 = 1
and q.hyjg = 130
and (q.jylx is null or q.jysj is null))
group by f.jgbm) o
on regexp_like(o.jgbm, jg.jgbm)
group by jg.jgid, jg.jgbm;
create materialized view mv_tbyj_dyjry_c nologging
build immediate
refresh complete on demand
disable query rewrite
as
--6214 待孕检人员(预警提示)
select jg.jgid, jg.jgbm, 6214 dataid, nvl(sum(num),0) num, 2 bs
from mv_jg_info jg
inner join (select f.jgbm, count(a.kpxxid) num
from qyxx_kpryglb a,
qyxx_kpxxb b,
sys_ldwhb c,
sys_ldwhb d,
qyxx_cpjtxx e,
sys_jgxxb f,
sys_userinfo g
where a.cyid = e.cyid
and a.kpxxid = b.kpxxid
and b.ldhm = c.ldid
and c.xqid = d.xqid
and c.jgid = f.jgid
and c.zrruserid = g.userid
and e.xb = '女'
and e.nl >= 14
and e.nl <= 41
and e.cyid not in (select cyid
from qyxx_jkxxjc
where jclx = 211
and to_char(jcrq, 'yyyy-MM-dd') >= (case
when extract(month from sysdate) between 3 and 8 then
to_char(sysdate, 'yyyy') || '-03'
else
to_char(sysdate, 'yyyy') || '-09'
end)
and to_char(jcrq, 'yyyy-MM-dd') <= (case
when extract(month from sysdate) between 3 and 8 then
to_char(sysdate, 'yyyy') || '-09'
else
to_char(sysdate, 'yyyy') || '-12'
end))
group by f.jgbm) o
on regexp_like(o.jgbm, jg.jgbm)
group by jg.jgid, jg.jgbm;
create materialized view mv_tbyj_dhjry_c nologging
build immediate
refresh complete on demand
disable query rewrite
as
--6215 待环检人员(预警提示)
select jg.jgid, jg.jgbm, 6215 dataid, nvl(sum(num),0) num, 2 bs
from mv_jg_info jg
inner join (select f.jgbm, count(a.kpxxid) num
from qyxx_kpryglb a,
qyxx_kpxxb b,
sys_ldwhb c,
sys_ldwhb d,
qyxx_cpjtxx e,
sys_jgxxb f,
sys_userinfo g
where a.cyid = e.cyid
and a.kpxxid = b.kpxxid
and b.ldhm = c.ldid
and c.xqid = d.xqid
and c.jgid = f.jgid
and c.zrruserid = g.userid
and e.xb = '女'
and e.nl >= 14
and e.nl <= 41
and e.cyid not in
(select cyid
from qyxx_jkxxjc
where jclx = 212
and to_char(jcrq, 'yyyy-MM-dd') >= (case
when extract(month from sysdate) between 3 and 8 then
to_char(sysdate, 'yyyy') || '-06'
else
to_char(sysdate, 'yyyy') || '-12'
end)
and to_char(jcrq, 'yyyy-MM-dd') <= (case
when extract(month from sysdate) between 3 and 8 then
to_char(sysdate, 'yyyy') || '-12'
else
to_char(sysdate, 'yyyy') + 1 || '-06'
end))
group by f.jgbm) o
on regexp_like(o.jgbm, jg.jgbm)
group by jg.jgid, jg.jgbm;
--6216 督办(综治维稳)
create materialized view mv_tbyj_zzww_jgdb1_c nologging
build immediate
refresh complete on demand
disable query rewrite
as
--6216 督办(综治维稳) 部门为null
select jg.jgid, jg.jgbm, 6216 dataid, nvl(sum(num), 0) num, -1 bs
from mv_jg_info jg
inner join (select clsysjgxx, count(*) num
from zzww_zxjbxx a
where 1 = 1
and sfdeptview = 1
and deptid is null and (shjg in (0, 4) and
jbid not in (select jbid
from zzww_lbjxfxx
where lbbm is null
and sljg in (0))
or jbid in (select jbid
from zzww_lbjxfxx
where lbbm is null
and sljg = 0))
and ylzd2 = 1
group by clsysjgxx) o
on jg.jgid = o.clsysjgxx
group by jg.jgid, jg.jgbm;
create materialized view mv_tbyj_zzww_jgdb2_c nologging
build immediate
refresh complete on demand
disable query rewrite
as
--6216 督办(综治维稳) 部门不为null
select jg.jgid, jg.jgbm, 6216 dataid, nvl(sum(num), 0) num, o.deptid bs
from tmp_org jg
inner join (select clsysjgxx, deptid, count(*) num
from zzww_zxjbxx
where 1 = 1
and sfdeptview = 1
and deptid is not null and (shjg in (0, 4) and
jbid not in (select jbid
from zzww_lbjxfxx
where lbbm is not null
and sljg in (0))
or jbid in (select jbid
from zzww_lbjxfxx
where lbbm is not null
and sljg = 0))
and ylzd2 = 1
group by clsysjgxx, deptid) o
on jg.jgid = o.clsysjgxx
group by jg.jgid, jg.jgbm, o.deptid;
create materialized view mv_tbyj_zzww_jgdb3_c nologging
build immediate
refresh complete on demand
disable query rewrite
as
--6216 督办(综治维稳) 责任人
select z.userid, z.jgbm, 6216 dataid, nvl(num, 0) num, 1 bs
from mv_zrr_info z
inner join (select zrruserid, count(*) num
from zzww_zxjbxx
where 1 = 1
and sfdeptview = 1
and ylzd2 = 1
group by zrruserid) o
on z.userid = o.zrruserid;
--6217 待办(综治维稳)
create materialized view mv_tbyj_zzww_jgdab1_c nologging
build immediate
refresh complete on demand
disable query rewrite
as
--6217 待办(综治维稳) 部门为null
select jg.jgid, jg.jgbm, 6217 dataid, nvl(sum(num), 0) num, -1 bs
from mv_jg_info jg
inner join (select clsysjgxx, count(*) num
from zzww_zxjbxx a
where 1 = 1
and sfdeptview = 1
and deptid is null and (shjg in (0, 4) and
jbid not in (select jbid
from zzww_lbjxfxx
where lbbm is null
and sljg in (0))
or jbid in (select jbid
from zzww_lbjxfxx
where lbbm is null
and sljg = 0))
group by clsysjgxx) o
on jg.jgid = o.clsysjgxx
group by jg.jgid, jg.jgbm;
create materialized view mv_tbyj_zzww_jgdab2_c nologging
build immediate
refresh complete on demand
disable query rewrite
as
--6217 待办(综治维稳) 部门不为null
select jg.jgid, jg.jgbm, 6217 dataid, nvl(sum(num), 0) num, o.deptid bs
from mv_jg_info jg
inner join (select clsysjgxx, deptid, count(*) num
from zzww_zxjbxx
where 1 = 1
and sfdeptview = 1
and deptid is not null and (shjg in (0, 4) and
jbid not in (select jbid
from zzww_lbjxfxx
where lbbm is not null
and sljg in (0))
or jbid in (select jbid
from zzww_lbjxfxx
where lbbm is not null
and sljg = 0))
group by clsysjgxx, deptid) o
on jg.jgid = o.clsysjgxx
group by jg.jgid, jg.jgbm, o.deptid;
create materialized view mv_tbyj_zzww_jgdab3_c nologging
build immediate
refresh complete on demand
disable query rewrite
as
--6217 待办(综治维稳) 责任人
select z.userid, z.jgbm, 6217 dataid, nvl(num, 0) num, 1 bs
from mv_zrr_info z
inner join (select zrruserid, count(*) num
from zzww_zxjbxx
where 1 = 1
and sfdeptview = 1
group by zrruserid) o
on z.userid = o.zrruserid;
create materialized view mv_tbyj_ga_ldrk_c nologging
build immediate
refresh complete on demand
disable query rewrite
as
--6218 流动人口(公安)
select jg.jgid, jg.jgbm, 6218 dataid, nvl(sum(num),0) num, 2 bs
from mv_jg_info jg
inner join (select b.jgbm, count(xlrkid) num
from gabm_xlldrk a, sys_jgxxb b
where a.tbzjg = b.jgid
and (shjg = 0 or shjg = 3)
group by b.jgbm) o
on regexp_like(o.jgbm, jg.jgbm)
group by jg.jgid, jg.jgbm;
create materialized view mv_tbyj_ga_hjrk_c nologging
build immediate
refresh complete on demand
disable query rewrite
as
--6219 户籍(公安)
select jg.jgid, jg.jgbm, 6219 dataid, nvl(sum(num),0) num, 2 bs
from mv_jg_info jg
inner join (select b.jgbm, count(hjxgid) num
from gabm_hjxxxg a, sys_jgxxb b
where a.tbzjg = b.jgid
and (shjg = 0 or shjg = 3)
group by b.jgbm) o
on regexp_like(o.jgbm, jg.jgbm)
group by jg.jgid, jg.jgbm;
create materialized view mv_tbyj_mz_jiehun_c nologging
build immediate
refresh complete on demand
disable query rewrite
as
--6220 结婚(民政)
select jg.jgid, jg.jgbm, 6220 dataid, nvl(sum(num),0) num, 2 bs
from mv_jg_info jg
inner join (select b.jgbm, count(mztbid) num
from mzbm_mzbmtb a, sys_jgxxb b
where a.tbzjg = b.jgid
and (shjg = 0 or shjg = 3)
group by b.jgbm) o
on regexp_like(o.jgbm, jg.jgbm)
group by jg.jgid, jg.jgbm;
create materialized view mv_tbyj_mz_lysy_c nologging
build immediate
refresh complete on demand
disable query rewrite
as
--6221 收养(民政)
select jg.jgid, jg.jgbm, 6221 dataid, nvl(sum(num),0) num, 2 bs
from mv_jg_info jg
inner join (select b.jgbm, count(syylid) num
from mzbm_ylsy a, sys_jgxxb b
where a.tbzjg = b.jgid
and (shjg = 0 or shjg = 3)
group by b.jgbm) o
on regexp_like(o.jgbm, jg.jgbm)
group by jg.jgid, jg.jgbm;
create materialized view mv_tbyj_mz_lhtb_c nologging
build immediate
refresh complete on demand
disable query rewrite
as
--6222 离婚(民政)
select jg.jgid, jg.jgbm, 6222 dataid, nvl(sum(num),0) num, 2 bs
from mv_jg_info jg
inner join (select b.jgbm, count(tbid) num
from mzbm_lhtb a, sys_jgxxb b
where a.tbzjg = b.jgid
and (shjg = 0 or shjg = 3)
group by b.jgbm) o
on regexp_like(o.jgbm, jg.jgbm)
group by jg.jgid, jg.jgbm;
create materialized view mv_tbyj_gs_xlldrk_c nologging
build immediate
refresh complete on demand
disable query rewrite
as
--6223 营业人员(工商)
select jg.jgid, jg.jgbm, 6223 dataid, nvl(sum(num),0) num, 2 bs
from mv_jg_info jg
inner join (select b.jgbm, count(xlrkid) num
from gsbm_xlldrk a, sys_jgxxb b
where a.tbzjg = b.jgid
and (shjg = 0 or shjg = 3)
group by b.jgbm) o
on regexp_like(o.jgbm, jg.jgbm)
group by jg.jgid, jg.jgbm;
create materialized view mv_tbyj_gs_ygryrk_c nologging
build immediate
refresh complete on demand
disable query rewrite
as
--6224 佣工人员(工商)
select jg.jgid, jg.jgbm, 6224 dataid, nvl(sum(num),0) num, 2 bs
from mv_jg_info jg
inner join (select b.jgbm, count(xlrkid) num
from gsbm_ygryrk a, sys_jgxxb b
where a.tbzjg = b.jgid
and (shjg = 0 or shjg = 3)
group by b.jgbm) o
on regexp_like(o.jgbm, jg.jgbm)
group by jg.jgid, jg.jgbm;
create materialized view mv_tbyj_rlzy_xlldrk_c nologging
build immediate
refresh complete on demand
disable query rewrite
as
--6225 流动人员(人力资源)
select jg.jgid, jg.jgbm, 6225 dataid, nvl(sum(num),0) num, 2 bs
from mv_jg_info jg
inner join (select b.jgbm, count(xlrkid) num
from rlzy_xlldrk a, sys_jgxxb b
where a.tbzjg = b.jgid
and (shjg = 0 or shjg = 3)
group by b.jgbm) o
on regexp_like(o.jgbm, jg.jgbm)
group by jg.jgid, jg.jgbm;
create materialized view mv_tbyj_jt_xlldrk_c nologging
build immediate
refresh complete on demand
disable query rewrite
as
--6226 流动人员(交通部门)
select jg.jgid, jg.jgbm, 6226 dataid, nvl(sum(num),0) num, 2 bs
from mv_jg_info jg
inner join (select b.jgbm, count(xlrkid) num
from jtbm_xlldrk a, sys_jgxxb b
where a.tbzjg = b.jgid
and (shjg = 0 or shjg = 3)
group by b.jgbm) o
on regexp_like(o.jgbm, jg.jgbm)
group by jg.jgid, jg.jgbm;
*/
--创建通报预警类指标统计存储过程
create or replace procedure sys_tbyj_dataid as
begin
insert into temp_tbyj_dataid (jgid,jgbm,dataid,num,bs,refresh_time)
--6208 城市110
select jg.jgid, jg.jgbm, 6208 dataid, nvl(sum(num),0) num, 2 bs,sysdate
from mv_jg_info jg
inner join (select b.jgbm, count(cs110id) num
from cs110 a, sys_jgxxb b
where a.jbjgid = b.jgid
and shr is null
group by b.jgbm) o
on regexp_like(o.jgbm, jg.jgbm)
group by jg.jgid, jg.jgbm;
insert into temp_tbyj_dataid (jgid,jgbm,dataid,num,bs,refresh_time)
--6209 无身份证(预警提示)
select jg.jgid, jg.jgbm, 6209 dataid, nvl(sum(num),0) num, 2 bs,sysdate
from mv_jg_info jg
inner join (select b.jgbm, count(g.cyid) num
from qyxx_kpryglb a, sys_jgxxb b, qyxx_cpjtxx g
where a.jgid = b.jgid
and a.cyid = g.cyid
and a.sfczr = 'N'
and g.sfzh is null
group by b.jgbm) o
on regexp_like(o.jgbm, jg.jgbm)
group by jg.jgid, jg.jgbm;
insert into temp_tbyj_dataid (jgid,jgbm,dataid,num,bs,refresh_time)
--6210 生殖保健(预警提示)
select jg.jgid, jg.jgbm, 6210 dataid, nvl(sum(num),0) num, 2 bs,sysdate
from mv_jg_info jg
inner join (select b.jgbm, count(guanliid) num
from qyxx_kpryglb a,
sys_jgxxb b,
sys_ldwhb c,
sys_xqxxb d,
sys_userinfo e,
qyxx_kpxxb f,
qyxx_cpjtxx g
where a.kpxxid = f.kpxxid
and f.ldhm = c.ldid
and c.xqid = d.xqid
and c.zrruserid = e.userid
and b.jgid = c.jgid
and a.cyid = g.cyid
and a.cyid in
(select p.cyid
from qyxx_cyszbjxx p
where 1 = 1
and ((p.syzlx = 265 and p.syzjhm is null and
months_between(sysdate, p.syzfzsj) > 4) or
(p.syzlx = 264 and sysj is null and
months_between(sysdate, p.syzfzsj) > 4)))
group by b.jgbm) o
on regexp_like(o.jgbm, jg.jgbm)
group by jg.jgid, jg.jgbm;
insert into temp_tbyj_dataid (jgid,jgbm,dataid,num,bs,refresh_time)
--6211 怀孕无结果(预警提示)
select jg.jgid, jg.jgbm, 6211 dataid, nvl(sum(num),0) num, 2 bs,sysdate
from mv_jg_info jg
inner join (select f.jgbm, count(a.kpxxid) num
from qyxx_kpryglb a,
qyxx_kpxxb b,
sys_ldwhb c,
sys_ldwhb d,
qyxx_cpjtxx e,
sys_jgxxb f,
sys_userinfo g
where a.cyid = e.cyid
and a.kpxxid = b.kpxxid
and b.ldhm = c.ldid
and c.xqid = d.xqid
and c.jgid = f.jgid
and c.zrruserid = g.userid
and e.cyid in
(select cyid
from qyxx_cyszbjxx
where 1 = 1
and syjssj is null
and hyjg is null
and (sysdate - to_date(to_char(sysj, 'yyyy-MM-dd'),
'yyyy-MM-dd')) > 300
and (sysdate - to_date(to_char(sysj, 'yyyy-MM-dd'),
'yyyy-MM-dd')) < 720)
group by f.jgbm) o
on regexp_like(o.jgbm, jg.jgbm)
group by jg.jgid, jg.jgbm;
insert into temp_tbyj_dataid (jgid,jgbm,dataid,num,bs,refresh_time)
--6212 待产节育(预警提示)
select jg.jgid, jg.jgbm, 6212 dataid, nvl(sum(num),0) num, 2 bs,sysdate
from mv_jg_info jg
inner join (select f.jgbm, count(a.kpxxid) num
from qyxx_kpryglb a,
qyxx_kpxxb b,
sys_ldwhb c,
sys_ldwhb d,
qyxx_cpjtxx e,
sys_jgxxb f,
sys_userinfo g
where a.cyid = e.cyid
and a.kpxxid = b.kpxxid
and b.ldhm = c.ldid
and c.xqid = d.xqid
and c.jgid = f.jgid
and c.zrruserid = g.userid
and e.cyid in
(select cyid
from qyxx_cyszbjxx
where 1 = 1
and (syjssj is null and
(sysdate - to_date(to_char(sysj, 'yyyy-MM-dd'),
'yyyy-MM-dd')) > 265 and
(sysdate - to_date(to_char(sysj, 'yyyy-MM-dd'),
'yyyy-MM-dd')) < 720)
or (hyjg is null and syjssj is not null and
(sysdate - to_date(to_char(syjssj, 'yyyy-MM-dd'),
'yyyy-MM-dd')) > 42 and
(sysdate - to_date(to_char(syjssj, 'yyyy-MM-dd'),
'yyyy-MM-dd')) < 720))
group by f.jgbm) o
on regexp_like(o.jgbm, jg.jgbm)
group by jg.jgid, jg.jgbm;
insert into temp_tbyj_dataid (jgid,jgbm,dataid,num,bs,refresh_time)
--6213 生产待节育(预警提示)
select jg.jgid, jg.jgbm, 6213 dataid, nvl(sum(num),0) num, 2 bs,sysdate
from mv_jg_info jg
inner join (select f.jgbm, count(a.kpxxid) num
from qyxx_kpryglb a,
qyxx_kpxxb b,
sys_ldwhb c,
sys_ldwhb d,
qyxx_cpjtxx e,
sys_jgxxb f,
sys_userinfo g
where a.cyid = e.cyid
and a.kpxxid = b.kpxxid
and b.ldhm = c.ldid
and c.xqid = d.xqid
and c.jgid = f.jgid
and c.zrruserid = g.userid
and e.cyid in
(select q.cyid
from qyxx_cyszbjxx q
where 1 = 1
and q.hyjg = 130
and (q.jylx is null or q.jysj is null))
group by f.jgbm) o
on regexp_like(o.jgbm, jg.jgbm)
group by jg.jgid, jg.jgbm;
insert into temp_tbyj_dataid (jgid,jgbm,dataid,num,bs,refresh_time)
--6214 待孕检人员(预警提示)
select jg.jgid, jg.jgbm, 6214 dataid, nvl(sum(num),0) num, 2 bs,sysdate
from mv_jg_info jg
inner join (select f.jgbm, count(a.kpxxid) num
from qyxx_kpryglb a,
qyxx_kpxxb b,
sys_ldwhb c,
sys_ldwhb d,
qyxx_cpjtxx e,
sys_jgxxb f,
sys_userinfo g
where a.cyid = e.cyid
and a.kpxxid = b.kpxxid
and b.ldhm = c.ldid
and c.xqid = d.xqid
and c.jgid = f.jgid
and c.zrruserid = g.userid
and e.xb = '女'
and e.nl >= 14
and e.nl <= 41
and e.cyid not in (select cyid
from qyxx_jkxxjc
where jclx = 211
and to_char(jcrq, 'yyyy-MM-dd') >= (case
when extract(month from sysdate) between 3 and 8 then
to_char(sysdate, 'yyyy') || '-03'
else
to_char(sysdate, 'yyyy') || '-09'
end)
and to_char(jcrq, 'yyyy-MM-dd') <= (case
when extract(month from sysdate) between 3 and 8 then
to_char(sysdate, 'yyyy') || '-09'
else
to_char(sysdate, 'yyyy') || '-12'
end))
group by f.jgbm) o
on regexp_like(o.jgbm, jg.jgbm)
group by jg.jgid, jg.jgbm;
insert into temp_tbyj_dataid (jgid,jgbm,dataid,num,bs,refresh_time)
--6215 待环检人员(预警提示)
select jg.jgid, jg.jgbm, 6215 dataid, nvl(sum(num),0) num, 2 bs,sysdate
from mv_jg_info jg
inner join (select f.jgbm, count(a.kpxxid) num
from qyxx_kpryglb a,
qyxx_kpxxb b,
sys_ldwhb c,
sys_ldwhb d,
qyxx_cpjtxx e,
sys_jgxxb f,
sys_userinfo g
where a.cyid = e.cyid
and a.kpxxid = b.kpxxid
and b.ldhm = c.ldid
and c.xqid = d.xqid
and c.jgid = f.jgid
and c.zrruserid = g.userid
and e.xb = '女'
and e.nl >= 14
and e.nl <= 41
and e.cyid not in
(select cyid
from qyxx_jkxxjc
where jclx = 212
and to_char(jcrq, 'yyyy-MM-dd') >= (case
when extract(month from sysdate) between 3 and 8 then
to_char(sysdate, 'yyyy') || '-06'
else
to_char(sysdate, 'yyyy') || '-12'
end)
and to_char(jcrq, 'yyyy-MM-dd') <= (case
when extract(month from sysdate) between 3 and 8 then
to_char(sysdate, 'yyyy') || '-12'
else
to_char(sysdate, 'yyyy') + 1 || '-06'
end))
group by f.jgbm) o
on regexp_like(o.jgbm, jg.jgbm)
group by jg.jgid, jg.jgbm;
--6216 督办(综治维稳)
insert into temp_tbyj_dataid (jgid,jgbm,dataid,num,bs,refresh_time)
--6216 督办(综治维稳) 部门为null
select jg.jgid, jg.jgbm, 6216 dataid, nvl(sum(num), 0) num, -1 bs,sysdate
from mv_jg_info jg
inner join (select clsysjgxx, count(*) num
from zzww_zxjbxx a
where 1 = 1
and sfdeptview = 1
and deptid is null and (shjg in (0, 4) and
jbid not in (select jbid
from zzww_lbjxfxx
where lbbm is null
and sljg in (0))
or jbid in (select jbid
from zzww_lbjxfxx
where lbbm is null
and sljg = 0))
and ylzd2 = 1
group by clsysjgxx) o
on jg.jgid = o.clsysjgxx
group by jg.jgid, jg.jgbm;
insert into temp_tbyj_dataid (jgid,jgbm,dataid,num,bs,refresh_time)
--6216 督办(综治维稳) 部门不为null
select jg.jgid, jg.jgbm, 6216 dataid, nvl(sum(num), 0) num, o.deptid bs,sysdate
from tmp_org jg
inner join (select clsysjgxx, deptid, count(*) num
from zzww_zxjbxx
where 1 = 1
and sfdeptview = 1
and deptid is not null and (shjg in (0, 4) and
jbid not in (select jbid
from zzww_lbjxfxx
where lbbm is not null
and sljg in (0))
or jbid in (select jbid
from zzww_lbjxfxx
where lbbm is not null
and sljg = 0))
and ylzd2 = 1
group by clsysjgxx, deptid) o
on jg.jgid = o.clsysjgxx
group by jg.jgid, jg.jgbm, o.deptid;
insert into temp_tbyj_dataid (jgid,jgbm,dataid,num,bs,refresh_time)
--6216 督办(综治维稳) 责任人
select z.userid, z.jgbm, 6216 dataid, nvl(num, 0) num, 1 bs,sysdate
from mv_zrr_info z
inner join (select zrruserid, count(*) num
from zzww_zxjbxx
where 1 = 1
and sfdeptview = 1
and ylzd2 = 1
group by zrruserid) o
on z.userid = o.zrruserid;
--6217 待办(综治维稳)
insert into temp_tbyj_dataid (jgid,jgbm,dataid,num,bs,refresh_time)
--6217 待办(综治维稳) 部门为null
select jg.jgid, jg.jgbm, 6217 dataid, nvl(sum(num), 0) num, -1 bs,sysdate
from mv_jg_info jg
inner join (select clsysjgxx, count(*) num
from zzww_zxjbxx a
where 1 = 1
and sfdeptview = 1
and deptid is null and (shjg in (0, 4) and
jbid not in (select jbid
from zzww_lbjxfxx
where lbbm is null
and sljg in (0))
or jbid in (select jbid
from zzww_lbjxfxx
where lbbm is null
and sljg = 0))
group by clsysjgxx) o
on jg.jgid = o.clsysjgxx
group by jg.jgid, jg.jgbm;
insert into temp_tbyj_dataid (jgid,jgbm,dataid,num,bs,refresh_time)
--6217 待办(综治维稳) 部门不为null
select jg.jgid, jg.jgbm, 6217 dataid, nvl(sum(num), 0) num, o.deptid bs,sysdate
from mv_jg_info jg
inner join (select clsysjgxx, deptid, count(*) num
from zzww_zxjbxx
where 1 = 1
and sfdeptview = 1
and deptid is not null and (shjg in (0, 4) and
jbid not in (select jbid
from zzww_lbjxfxx
where lbbm is not null
and sljg in (0))
or jbid in (select jbid
from zzww_lbjxfxx
where lbbm is not null
and sljg = 0))
group by clsysjgxx, deptid) o
on jg.jgid = o.clsysjgxx
group by jg.jgid, jg.jgbm, o.deptid;
insert into temp_tbyj_dataid (jgid,jgbm,dataid,num,bs,refresh_time)
--6217 待办(综治维稳) 责任人
select z.userid, z.jgbm, 6217 dataid, nvl(num, 0) num, 1 bs,sysdate
from mv_zrr_info z
inner join (select zrruserid, count(*) num
from zzww_zxjbxx
where 1 = 1
and sfdeptview = 1
group by zrruserid) o
on z.userid = o.zrruserid;
insert into temp_tbyj_dataid (jgid,jgbm,dataid,num,bs,refresh_time)
--6218 流动人口(公安)
select jg.jgid, jg.jgbm, 6218 dataid, nvl(sum(num),0) num, 2 bs,sysdate
from mv_jg_info jg
inner join (select b.jgbm, count(xlrkid) num
from gabm_xlldrk a, sys_jgxxb b
where a.tbzjg = b.jgid
and (shjg = 0 or shjg = 3)
group by b.jgbm) o
on regexp_like(o.jgbm, jg.jgbm)
group by jg.jgid, jg.jgbm;
insert into temp_tbyj_dataid (jgid,jgbm,dataid,num,bs,refresh_time)
--6219 户籍(公安)
select jg.jgid, jg.jgbm, 6219 dataid, nvl(sum(num),0) num, 2 bs,sysdate
from mv_jg_info jg
inner join (select b.jgbm, count(hjxgid) num
from gabm_hjxxxg a, sys_jgxxb b
where a.tbzjg = b.jgid
and (shjg = 0 or shjg = 3)
group by b.jgbm) o
on regexp_like(o.jgbm, jg.jgbm)
group by jg.jgid, jg.jgbm;
insert into temp_tbyj_dataid (jgid,jgbm,dataid,num,bs,refresh_time)
--6220 结婚(民政)
select jg.jgid, jg.jgbm, 6220 dataid, nvl(sum(num),0) num, 2 bs,sysdate
from mv_jg_info jg
inner join (select b.jgbm, count(mztbid) num
from mzbm_mzbmtb a, sys_jgxxb b
where a.tbzjg = b.jgid
and (shjg = 0 or shjg = 3)
group by b.jgbm) o
on regexp_like(o.jgbm, jg.jgbm)
group by jg.jgid, jg.jgbm;
insert into temp_tbyj_dataid (jgid,jgbm,dataid,num,bs,refresh_time)
--6221 收养(民政)
select jg.jgid, jg.jgbm, 6221 dataid, nvl(sum(num),0) num, 2 bs,sysdate
from mv_jg_info jg
inner join (select b.jgbm, count(syylid) num
from mzbm_ylsy a, sys_jgxxb b
where a.tbzjg = b.jgid
and (shjg = 0 or shjg = 3)
group by b.jgbm) o
on regexp_like(o.jgbm, jg.jgbm)
group by jg.jgid, jg.jgbm;
insert into temp_tbyj_dataid (jgid,jgbm,dataid,num,bs,refresh_time)
--6222 离婚(民政)
select jg.jgid, jg.jgbm, 6222 dataid, nvl(sum(num),0) num, 2 bs,sysdate
from mv_jg_info jg
inner join (select b.jgbm, count(tbid) num
from mzbm_lhtb a, sys_jgxxb b
where a.tbzjg = b.jgid
and (shjg = 0 or shjg = 3)
group by b.jgbm) o
on regexp_like(o.jgbm, jg.jgbm)
group by jg.jgid, jg.jgbm;
insert into temp_tbyj_dataid (jgid,jgbm,dataid,num,bs,refresh_time)
--6223 营业人员(工商)
select jg.jgid, jg.jgbm, 6223 dataid, nvl(sum(num),0) num, 2 bs,sysdate
from mv_jg_info jg
inner join (select b.jgbm, count(xlrkid) num
from gsbm_xlldrk a, sys_jgxxb b
where a.tbzjg = b.jgid
and (shjg = 0 or shjg = 3)
group by b.jgbm) o
on regexp_like(o.jgbm, jg.jgbm)
group by jg.jgid, jg.jgbm;
insert into temp_tbyj_dataid (jgid,jgbm,dataid,num,bs,refresh_time)
--6224 佣工人员(工商)
select jg.jgid, jg.jgbm, 6224 dataid, nvl(sum(num),0) num, 2 bs,sysdate
from mv_jg_info jg
inner join (select b.jgbm, count(xlrkid) num
from gsbm_ygryrk a, sys_jgxxb b
where a.tbzjg = b.jgid
and (shjg = 0 or shjg = 3)
group by b.jgbm) o
on regexp_like(o.jgbm, jg.jgbm)
group by jg.jgid, jg.jgbm;
insert into temp_tbyj_dataid (jgid,jgbm,dataid,num,bs,refresh_time)
--6225 流动人员(人力资源)
select jg.jgid, jg.jgbm, 6225 dataid, nvl(sum(num),0) num, 2 bs,sysdate
from mv_jg_info jg
inner join (select b.jgbm, count(xlrkid) num
from rlzy_xlldrk a, sys_jgxxb b
where a.tbzjg = b.jgid
and (shjg = 0 or shjg = 3)
group by b.jgbm) o
on regexp_like(o.jgbm, jg.jgbm)
group by jg.jgid, jg.jgbm;
insert into temp_tbyj_dataid (jgid,jgbm,dataid,num,bs,refresh_time)
--6226 流动人员(交通部门)
select jg.jgid, jg.jgbm, 6226 dataid, nvl(sum(num),0) num, 2 bs,sysdate
from mv_jg_info jg
inner join (select b.jgbm, count(xlrkid) num
from jtbm_xlldrk a, sys_jgxxb b
where a.tbzjg = b.jgid
and (shjg = 0 or shjg = 3)
group by b.jgbm) o
on regexp_like(o.jgbm, jg.jgbm)
group by jg.jgid, jg.jgbm;
------插入目标表
execute immediate 'truncate table tjxx_tbyj_dataid';
insert /*+ APPEND */ into tjxx_tbyj_dataid
select * from temp_tbyj_dataid;
commit;
end sys_tbyj_dataid;
/
begin
sys.dbms_scheduler.create_job(job_name => 'QYRK.JOB_TBYJ_DATA',
job_type => 'STORED_PROCEDURE',
job_action => 'sys_tbyj_dataid',
start_date => sysdate,
repeat_interval => 'Freq=Minutely;Interval=10',
end_date => to_date(null),
job_class => 'DEFAULT_JOB_CLASS',
enabled => true,
auto_drop => false,
comments => '生成通报预警类指标数据.');
end;
/
--begin
-- dbms_scheduler.run_job(job_name => 'QYRK.JOB_TBYJ_DATA');
--end;
--/
----------------------------------------------------------------------------------------
--预警和通报类统计指标物化视图 End
----------------------------------------------------------------------------------------
/*************************************************************/
--总视图
/*************************************************************/
create or replace view tjxx_jbxxtj as
select null tjid,jgid userid,jgbm,dataid,num,bs from mv_jg_dataid --户况图信息(机构)
union all
--户况图信息(责任人)
select null tjid,userid,null,dataid,num,bs from mv_zrr_dataid
union all
--户况图信息(楼栋)
select null tjid,userid,null,dataid,num,bs from mv_ld_dataid
union all
--通报预警类指示
select null tjid,userid,jgbm,dataid,num,bs from tjxx_tbyj_dataid;
/*
--6208 城市110
select jgid,jgbm,dataid,num,bs from mv_tbyj_110_c
union all
--6209 无身份证(预警提示)
select jgid,jgbm,dataid,num,bs from mv_tbyj_noid_c
union all
--6210 生殖保健(预警提示)
select jgid,jgbm,dataid,num,bs from mv_tbyj_szbj_c
union all
--6211 怀孕无结果(预警提示)
select jgid,jgbm,dataid,num,bs from mv_tbyj_hywjg_c
union all
--6212 待产节育(预警提示)
select jgid,jgbm,dataid,num,bs from mv_tbyj_dcjy_c
union all
--6213 生产待节育(预警提示)
select jgid,jgbm,dataid,num,bs from mv_tbyj_scjy_c
union all
--6214 待孕检人员(预警提示)
select jgid,jgbm,dataid,num,bs from mv_tbyj_dyjry_c
union all
--6215 待环检人员(预警提示)
select jgid,jgbm,dataid,num,bs from mv_tbyj_dhjry_c
union all
--6216 督办(综治维稳) 部门为null
select jgid,jgbm,dataid,num,bs from mv_tbyj_zzww_jgdb1_c
union all
--6216 督办(综治维稳) 部门不为null
select jgid,jgbm,dataid,num,bs from mv_tbyj_zzww_jgdb2_c
union all
--6216 督办(综治维稳) 责任人
select userid,jgbm,dataid,num,bs from mv_tbyj_zzww_jgdb3_c
union all
--6217 待办(综治维稳) 部门为null
select jgid,jgbm,dataid,num,bs from mv_tbyj_zzww_jgdab1_c
union all
--6217 待办(综治维稳) 部门不为null
select jgid,jgbm,dataid,num,bs from mv_tbyj_zzww_jgdab2_c
union all
--6217 待办(综治维稳) 责任人
select userid,jgbm,dataid,num,bs from mv_tbyj_zzww_jgdab3_c
union all
--6218 流动人口(公安)
select jgid,jgbm,dataid,num,bs from mv_tbyj_ga_ldrk_c
union all
--6219 户籍(公安)
select jgid,jgbm,dataid,num,bs from mv_tbyj_ga_hjrk_c
union all
--6220 结婚(民政)
select jgid,jgbm,dataid,num,bs from mv_tbyj_mz_jiehun_c
union all
--6221 收养(民政)
select jgid,jgbm,dataid,num,bs from mv_tbyj_mz_lysy_c
union all
--6222 离婚(民政)
select jgid,jgbm,dataid,num,bs from mv_tbyj_mz_lhtb_c
union all
--6223 营业人员(工商)
select jgid,jgbm,dataid,num,bs from mv_tbyj_gs_xlldrk_c
union all
--6224 佣工人员(工商)
select jgid,jgbm,dataid,num,bs from mv_tbyj_gs_ygryrk_c
union all
--6225 流动人员(人力资源)
select jgid,jgbm,dataid,num,bs from mv_tbyj_rlzy_xlldrk_c
union all
--6226 流动人员(交通部门)
select jgid,jgbm,dataid,num,bs from mv_tbyj_jt_xlldrk_c;
*/
-----------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------
--创建完全刷新组
--begin
-- dbms_refresh.make(name => 'refgroup1',
-- list => 'MV_TBYJ_110_C,
-- MV_TBYJ_NOID_C,
-- MV_TBYJ_SZBJ_C,
-- MV_TBYJ_HYWJG_C,
-- MV_TBYJ_DCJY_C,
-- MV_TBYJ_SCJY_C,
-- MV_TBYJ_DYJRY_C,
-- MV_TBYJ_DHJRY_C,
-- MV_TBYJ_ZZWW_JGDAB3_C,
-- MV_TBYJ_ZZWW_JGDB3_C,
-- MV_TBYJ_GA_LDRK_C,
-- MV_TBYJ_GA_HJRK_C,
-- MV_TBYJ_MZ_JIEHUN_C,
-- MV_TBYJ_MZ_LYSY_C,
-- MV_TBYJ_MZ_LHTB_C,
-- MV_TBYJ_GS_XLLDRK_C,
-- MV_TBYJ_GS_YGRYRK_C,
-- MV_TBYJ_RLZY_XLLDRK_C,
-- MV_TBYJ_JT_XLLDRK_C,
-- MV_TBYJ_ZZWW_JGDB1_C,
-- MV_TBYJ_ZZWW_JGDB2_C,
-- MV_TBYJ_ZZWW_JGDAB1_C,
-- MV_TBYJ_ZZWW_JGDAB2_C',
-- next_date => sysdate,
-- interval => 'sysdate + 1 / 144');
--end;
--/
--创建快速刷新组
begin
dbms_refresh.make(name => 'refgroup2',
list => 'MV_JG_BFWWXX_AGG,
MV_JG_CJRY_AGG,
MV_JG_CSRK_AGG,
MV_JG_CXYLJZ_AGG,
MV_JG_CZCSRY_AGG,
MV_JG_CZRK_AGG,
MV_JG_DATAID,
MV_JG_DBH_AGG,
MV_JG_FLGRY_AGG,
MV_JG_FQYDW_AGG,
MV_JG_FXPGINFO_AGG,
MV_JG_FZXCZYZ_AGG,
MV_JG_GHRK_AGG,
MV_JG_HJRK_AGG,
MV_JG_JBXX_AGG,
MV_JG_JJJZ_AGG,
MV_JG_JJLY_AGG,
MV_JG_JKXXJC_AGG,
MV_JG_JYFW_AGG,
MV_JG_JYQKXX_AGG,
MV_JG_KCH_AGG,
MV_JG_KP_AGG,
MV_JG_LDLZXXY_AGG,
MV_JG_LDRK_AGG,
MV_JG_LD_AGG,
MV_JG_LRRK_AGG,
MV_JG_RMTJY_AGG,
MV_JG_SCJR_AGG,
MV_JG_SHTT_AGG,
MV_JG_SJZDRY_AGG,
MV_JG_SQJZRY_AGG,
MV_JG_SZBJ_AGG,
MV_JG_TJHZINFO_AGG,
MV_JG_TJHZINFO_BASE,
MV_JG_TSRQ_AGG,
MV_JG_TXXX_AGG,
MV_JG_WXJSBRY_AGG,
MV_JG_WZXX_AGG,
MV_JG_XDRY_AGG,
MV_JG_XQ_AGG,
MV_JG_XSJJRY_AGG,
MV_JG_XYTYRY_AGG,
MV_JG_YBSB_AGG,
MV_JG_YFDXWH_AGG,
MV_JG_YJSJINFO_AGG,
MV_JG_YLFN_AGG,
MV_JG_ZDQSNRY_AGG,
MV_JG_ZHS_AGG,
MV_JG_ZHS_BASE,
MV_JG_ZJXY_AGG,
MV_JG_ZZRK_AGG,
mv_jg_dy_agg,
MV_LD_BFWW_AGG,
MV_LD_CJRY_AGG,
MV_LD_CXYLJZ_AGG,
MV_LD_CZCSRY_AGG,
MV_LD_CZRK_AGG,
MV_LD_DATAID,
MV_LD_DBH_AGG,
MV_LD_FLGRY_AGG,
MV_LD_FZXCZYZ_AGG,
MV_LD_JJJZ_AGG,
MV_LD_JKXXJC_AGG,
MV_LD_JYFW_AGG,
MV_LD_JYQK_AGG,
MV_LD_KCH_AGG,
MV_LD_KP_AGG,
MV_LD_LDLZXXY_AGG,
MV_LD_LDRK_AGG,
MV_LD_LRRK_AGG,
MV_LD_LYFN_AGG,
MV_LD_RMTJY_AGG,
MV_LD_SCJR_AGG,
MV_LD_SJZDRY_AGG,
MV_LD_SQJZRY_AGG,
MV_LD_SZBJ_AGG,
MV_LD_TSRQ_AGG,
MV_LD_TXXX_AGG,
MV_LD_WXJSBRY_AGG,
MV_LD_XDRY_AGG,
MV_LD_XSJJRY_AGG,
MV_LD_XYTYRY_AGG,
MV_LD_YBSB_AGG,
MV_LD_YFDXWH_AGG,
MV_LD_ZDQSNRY_AGG,
MV_LD_ZJXY_AGG,
MV_LD_ZZRK_AGG,
MV_ZRR_BFWW_AGG,
MV_ZRR_CJRY_AGG,
MV_ZRR_CSRK_AGG,
MV_ZRR_CXYLJZ_AGG,
MV_ZRR_CZCSRY_AGG,
MV_ZRR_CZRK_AGG,
MV_ZRR_DATAID,
MV_ZRR_DBH_AGG,
MV_ZRR_FLGRY_AGG,
MV_ZRR_FZXCZYZ_AGG,
MV_ZRR_GHRK_AGG,
MV_ZRR_HJRK_AGG,
MV_ZRR_JBXX_AGG,
MV_ZRR_JJJZ_AGG,
MV_ZRR_JJLY_AGG,
MV_ZRR_JKXXJC_AGG,
MV_ZRR_JYFW_AGG,
MV_ZRR_JYQK_AGG,
MV_ZRR_KCH_AGG,
MV_ZRR_KP_AGG,
MV_ZRR_LDLZXXY_AGG,
MV_ZRR_LDRK_AGG,
MV_ZRR_LD_AGG,
MV_ZRR_LRRK_AGG,
MV_ZRR_RMTJY_AGG,
MV_ZRR_SCJR_AGG,
MV_ZRR_SJZDRY_AGG,
MV_ZRR_SQJZRY_AGG,
MV_ZRR_SZBJ_AGG,
MV_ZRR_TSRQ_AGG,
MV_ZRR_TXXX_AGG,
MV_ZRR_WXJSBRY_AGG,
MV_ZRR_XDRY_AGG,
MV_ZRR_XQ_AGG,
MV_ZRR_XQ_BASE,
MV_ZRR_XSJJRY_AGG,
MV_ZRR_XYTYRY_AGG,
MV_ZRR_YBSB_AGG,
MV_ZRR_YFDXWH_AGG,
MV_ZRR_YLFN_AGG,
MV_ZRR_ZDQSNRY_AGG,
MV_ZRR_ZHS_AGG,
MV_ZRR_ZHS_BASE,
MV_ZRR_ZJXY_AGG,
MV_ZRR_ZZRK_AGG,
MV_ZRR_GYS_AGG,
mv_zrr_dy_agg,
MV_JG_xsqsn_AGG,
MV_LD_xsqsn_AGG,
MV_JG_azbhz_AGG,
MV_LD_azbhz_AGG,
MV_JG_xfzdry_AGG,
MV_LD_xfzdry_AGG,
MV_JG_zjxyxx_AGG,
MV_LD_zjxyxx_AGG,
MV_JG_lset_AGG,
MV_LD_lset_AGG,
MV_JG_lsfn_AGG,
MV_LD_lsfn_AGG',
next_date => sysdate,
interval => 'sysdate + 10 /(1440*60)');
end;
/
commit;
--------------------------------------------------------------------------------
----创建维护任务
create or replace procedure sys_maintain_mv as
begin
--重编译失效物化视图
for c_co in (select owner, mview_name
from user_mviews
where compile_state <> 'VALID') loop
begin
execute immediate 'alter materialized view ' || c_co.owner || '.' ||c_co.mview_name || ' compile';
exception
when others then
null;
end;
end loop;
--刷新staleness物化视图
for c_re in (select owner,mview_name from user_mviews where staleness <> 'FRESH') loop
begin
dbms_mview.refresh(list => c_re.owner||'.'||c_re.mview_name,method => '?',nested => true);
exception
when others then
null;
end;
end loop;
end;
/
--定时维护任务
begin
sys.dbms_scheduler.create_job(job_name => 'QYRK.JOB_MAINTAIN_MV',
job_type => 'STORED_PROCEDURE',
job_action => 'sys_maintain_mv',
start_date => sysdate,
repeat_interval => 'Freq=Minutely;Interval=5',
end_date => to_date(null),
job_class => 'DEFAULT_JOB_CLASS',
enabled => false,
auto_drop => false,
comments => 'recompile and refresh unusable or staleness materialized view');
end;
/
--begin
-- dbms_scheduler.run_job(job_name => 'QYRK.JOB_MAINTAIN_MV');
--end;
--/
--定时清楚JOB日志
begin
sys.dbms_scheduler.create_job(job_name => 'QYRK.JOB_PURGE_LOG',
job_type => 'PLSQL_BLOCK',
job_action => 'begin dbms_scheduler.purge_log; end;',
start_date => sysdate,
repeat_interval => 'Freq=Daily;Interval=1;ByHour=10;ByMinute=00;BySecond=00',
end_date => to_date(null),
job_class => 'DEFAULT_JOB_CLASS',
enabled => true,
auto_drop => false,
comments => 'purge job''s logs everyday.');
end;
/
--begin
-- dbms_scheduler.run_job(job_name => 'QYRK.JOB_PURGE_LOG');
--end;
--/
--select 'alter table '||table_name||' drop constraint '||constraint_name||' cascade;' from user_constraints where constraint_type='U' and table_name like 'MV%';
|
CREATE DATABASE SISTEMA;
USE SISTEMA;
CREATE TABLE USUARIOS
(
ID INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
NOME VARCHAR(80) NOT NULL,
-- VARCHAR OU ELE VAI OCUPAR A QUANTIDADE MAXIMA DENTRO DE SEU PARENTESES OU APENAS A QUANTIDADE EM QUE O USUARIO DIGITAR.
-- CHAR ELE VAI SEMPRE OCUPAR A QUANTIDADE DE CARACTERESES DENTRO DE SEU PARENTES INDEPENDETE DO VALOR INSERIDO NELE. (ESPACOS EM BRANCO)
EMAIL VARCHAR(80) NOT NULL UNIQUE,
SENHA CHAR(32) NOT NULL
-- USAMOS CHAR() PARA PODE USAR UMA CRIPTOGRAFIA NO PHP
); |
INSERT INTO tbl_certificates (id, course_id, student_id, status)
VALUES (1, 1, 1, 'APROBADO'); |
-- Role: "Tourplaner_User"
-- DROP ROLE "Tourplaner_User";
CREATE ROLE "Tourplaner_User" WITH
LOGIN
NOSUPERUSER
INHERIT
NOCREATEDB
NOCREATEROLE
NOREPLICATION
ENCRYPTED PASSWORD 'SCRAM-SHA-256$4096:N9GV3cByrOql5A7g2tBihg==$k9u/FhDOf6BAYdFCzwnUESUxtkiCcSbqjlJpyHGt9Ns=:oPtyvR6qB+QWyCGA/WwCWOIgTU7preS4ilPh0GavkkQ='; |
SELECT * FROM repos r JOIN LATERAL (
SELECT * FROM issues i WHERE i.repo_id = r.id
) new_issues ON (true);
|
create table if not exists users (
user_id integer primary key autoincrement,
user_name text not null,
pwd text not null,
department text,
num text
);
create table if not exists assets(
asset_id text primary key,
asset_name text not null,
usage text not null
);
drop table if exists borrows;
create table borrows(
user_name text not null,
asset_id text not null,
date_borrow text not null,
date_return text not null,
primary key (user_name, asset_id)
);
drop table if exists histroys;
create table histroys(
histroy_id integer primary key autoincrement,
asset_id text not null,
user_name text not null,
date_borrow text not null,
date_return text,
status text not null default 'not return'
);
|
/* -*- coding: utf-8 -*- */
--
-- 部品表 (Bill of material)
--
-- 製品、部品
create table products (
id integer primary key
, name varchar(255) not null unique
);
insert into products (id, name)
values (201, '製品A')
, (202, '製品B')
, (301, '中間品E')
, (302, '中間品F')
, (401, '部品J')
, (402, '部品K')
;
-- 部品表
create table bill_of_materials (
parent_id integer references products(id)
, child_id integer references products(id)
, count integer not null
, primary key(parent_id, child_id)
);
create index bill_of_materials_child_id_idx
on bill_of_materials(child_id);
insert into bill_of_materials(parent_id, child_id, count)
values (201, 301, 2)
, (201, 302, 3)
, (202, 301, 1)
, (202, 302, 4)
, (301, 401, 10)
, (301, 402, 20)
, (302, 401, 25)
, (302, 402, 15)
;
/*
drop table bill_of_materials;
drop table products;
*/
|
-- MySQL dump 10.13 Distrib 8.0.16, for Win64 (x86_64)
--
-- Host: localhost Database: marthagoshen
-- ------------------------------------------------------
-- Server version 5.7.24
/*!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 */;
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 `payment`
--
DROP TABLE IF EXISTS `payment`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
SET character_set_client = utf8mb4 ;
CREATE TABLE `payment` (
`invoiceid` int(11) NOT NULL AUTO_INCREMENT,
`date` date NOT NULL,
`amount` double NOT NULL,
`paytype` enum('cash','check') NOT NULL,
`checkno` varchar(45) DEFAULT NULL,
`receivefrom` varchar(50) NOT NULL,
`building` varchar(10) NOT NULL,
`period` varchar(50) NOT NULL,
`receiveby` int(7) NOT NULL,
`unit` varchar(6) NOT NULL,
`billid` int(10) NOT NULL,
PRIMARY KEY (`invoiceid`),
KEY `receiveby_idx` (`receiveby`),
KEY `billid_idx` (`billid`),
CONSTRAINT `billid` FOREIGN KEY (`billid`) REFERENCES `billing` (`billid`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `receiveby` FOREIGN KEY (`receiveby`) REFERENCES `employee` (`empid`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `payment`
--
LOCK TABLES `payment` WRITE;
/*!40000 ALTER TABLE `payment` DISABLE KEYS */;
/*!40000 ALTER TABLE `payment` 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-06-18 9:51:31
|
CREATE OR REPLACE VIEW Tids_In_Facility_View AS
SELECT
a.facility_id AS facility_id,
a.tid_id || ',' || i.id AS tid_id,
a.trans_seq AS trans_seq,
a.recv_seq AS recv_seq,
a.certified AS certified,
a.certified_recv AS certified_recv,
t.name || ' - ' || it.namelbl || ' ' || i.name AS tid
FROM
tid_facility_map a,
tids t,
interfaces i,
interface_types it
WHERE
i.interface_type_id = it.id
AND i.id = a.interface_id
AND t.id = a.tid_id
;
COMMIT; |
USE worldcup;
SELECT SUM(IF(isFrench == true,1,0))/COUNT(*) * 100 AS FrenchPercentage,
SUM(IF(isEnglish == true,1,0))/COUNT(*) * 100 AS EnglishPercentage, SUM(IF(isSpanish == true,1,0))/COUNT(*) * 100 AS SpanishPercentage
FROM logData
WHERE requestType = "GET" AND isHTML = true AND statusCode = 200; |
# 4/ Lister pour chaque contrôle, la moyenne de la classe que vous avez créé
SELECT C.name, ASS.matiere, AVG(G.mark) AS Moyenne
FROM assessment ASS, grade G, class C
WHERE G.assessment_id = ASS.id
AND ASS.class_id = C.id
GROUP BY ASS.matiere, C.name
HAVING AVG(G.mark); |
select * from
(select week(rtime),sum(carbs),sum(dynamic_carbs), sum(carbs) - sum(dynamic_carbs) as diff
from insulin_carb_smoothed
where year(rtime)=2017
group by week(rtime)) as T
order by diff desc;
select min(rtime),max(rtime)
from insulin_carb_smoothed
where year(rtime)=2017 and week(rtime) = 29;
select date(rtime),sum(carbs),sum(dynamic_carbs),sum(carbs) - sum(dynamic_carbs) as diff
from insulin_carb_smoothed
where year(rtime)=2017 and week(rtime) = 29
group by date(rtime);
select 'off by a lot: ',date(rtime),sum(carbs),sum(dynamic_carbs),sum(carbs) - sum(dynamic_carbs) as diff
from insulin_carb_smoothed
where date(rtime) = '2017-07-21';
# the details
select rtime,carbs,dynamic_carbs
from insulin_carb_smoothed
where date(rtime) = '2017-07-21';
# the following is normal
select 'breakfast is fine',sum(carbs),sum(dynamic_carbs)
from insulin_carb_smoothed
where date(rtime) = '2017-07-21' and time(rtime) >= '07:35:00' and time(rtime) <= '10:35:00';
select *
from insulin_carb_smoothed
where date(rtime) = '2017-07-21' and time(rtime) = '21:25:00';
select week,Asum,Bsum,Asum-Bsum as diff from
(select week(rtime) as week, sum(carbs) as Asum, sum(dynamic_carbs) as Bsum
from insulin_carb_smoothed
where year(rtime)=2017
group by week(rtime)) as A
order by diff desc;
select Aweek,Asum,Bsum,Asum-Bsum as diff from
(select week(rtime) as Aweek, sum(carbs) as Asum
from insulin_carb_smoothed
where year(rtime)=2017
group by week(rtime)) as A,
(select week(rtime) as Bweek, sum(dynamic_carbs) as Bsum
from insulin_carb_smoothed
where year(rtime)=2017
group by week(rtime)) as B
where Aweek = Bweek
order by diff desc;
# both of the preceding queries show week 29 to be off by a lot, namely 252 carbs.
select Aweek,Asum,Bsum,Asum-Bsum as diff from
(select week(rtime) as Aweek, sum(carbs) as Asum
from insulin_carb_smoothed
where year(rtime)=2017 and carb_code in ('breakfast','lunch','snack','dinner','rescue')
group by week(rtime)) as A,
(select week(rtime) as Bweek, sum(dynamic_carbs) as Bsum
from insulin_carb_smoothed
where year(rtime)=2017
group by week(rtime)) as B
where Aweek = Bweek
order by diff desc;
-- the preceding shows negligible differences, so the trouble is definitely the outside meals.
-- I thought I'd fixed the problem, but I guess not.
select carb_code,sum(carbs)
from insulin_carb_smoothed
where year(rtime) = 2017 and week(rtime) = 29
group by carb_code;
-- The difference is almost certainly the after9 carbs, because the
-- preceding query shows there are 252 carbs labeled after9, which is
-- the difference.
-- You can ignore the rest of this file
# Week 46 in 2017 is off by a lot, namely 213 carbs; is it the outside meals?
select 'sum all',sum(carbs)
from insulin_carb_smoothed
where year(rtime) = 2017 and week(rtime) = 29;
select 'sum meals',sum(carbs)
from insulin_carb_smoothed
where year(rtime) = 2017 and week(rtime) = 29
and carb_code in ('breakfast','lunch','snack','dinner','rescue');
select 'sum outside',sum(carbs)
from insulin_carb_smoothed
where year(rtime) = 2017 and week(rtime) = 29
and carb_code in ('before6','after9')
select 'sum dc',sum(dynamic_carbs)
from insulin_carb_smoothed
where year(rtime) = 2017 and week(rtime) = 29;
-- The preceding for week 46 showed dc sum is 1613, which is the sum
-- all, which I did not expect. In other words, its as if the dynamic
-- carbs *does* include the outside meals
-- for week 29, we get 1170 total carbs, 749 from normal meals and 421 from outside meals, but dc totals 917
select rtime,carb_code,carbs
from insulin_carb_smoothed
where year(rtime)=2017 and week(rtime)=29 and carb_code not in ('breakfast','lunch','snack','dinner');
select rtime,carb_code,carbs,dynamic_insulin
from insulin_carb_smoothed
where date(rtime)='2017-07-19';
|
/*
Unable to sync crowd user directory - query did not return a unique result
Scenario 2: duplicate row in cwd_user
link: https://confluence.atlassian.com/stashkb/unable-to-sync-crowd-user-directory-query-did-not-return-a-unique-result-664993976.html
*/
SELECT *
FROM cwd_user
WHERE external_id in
(SELECT external_id
FROM cwd_user
GROUP BY external_id
HAVING COUNT(*) > 1); |
INSERT INTO burgers (burger_name, devoured)
VALUES ('Crispy Chicken', '1'),
VALUES ('Double Cheese', '0'),
VALUES ('Creamy Fish', '1'); |
ALTER TABLE task_records ADD COLUMN SCHEDULE_ID BIGINT;
CREATE TABLE TASK_PARAM (
ID BIGINT,
NAME VARCHAR(255),
TYPE VARCHAR(255),
VALUE VARCHAR(255),
DESCRIPTION VARCHAR(255),
SCHEDULE_ID BIGINT,
PRIMARY KEY (ID));
ALTER TABLE TASK_PARAM ADD CONSTRAINT FK_task_param_schedules FOREIGN KEY (SCHEDULE_ID) REFERENCES SCHEDULES (ID);
INSERT INTO SEQUENCE(SEQ_NAME, SEQ_COUNT) values ('TPARAM_ID',1);
|
--1.插入新记录
CREATE PROC supp_InsertSupplier
@SupplierID nvarchar(6),
@SupplierName nvarchar(80),
@SpellingCode nvarchar(20),
@Address nvarchar(80),
@ZipCode char(6),
@Tel nvarchar(20),
@Fax nvarchar(20),
@BankName nvarchar(40),
@BankAccount nvarchar(50),
@Contacter nvarchar(20),
@Email nvarchar(30)
as
insert TBL_Supplier values(@SupplierID,@SupplierName,@SpellingCode,@Address,@ZipCode,@Tel,@Fax,@BankName,@BankAccount,@Contacter,@Email)
return
exec supp_InsertSupplier '2','供应商','供应商的Code','供应商地址','邮编','电话','不知道','工商银行','4564654654654564654','这个不知道','123456@qq.com'
--2.删除记录
create proc supp_DeleteSupplierBySupplierID
@SupplierID nvarchar(6)
as
delete TBL_Supplier where SupplierID=@SupplierID
return
exec supp_DeleteSupplierBySupplierID '1'
--3.更新记录
create proc supp_UpdateSupplierBySupplierID
@SupplierID nvarchar(6),
@SupplierName nvarchar(80),
@SpellingCode nvarchar(20),
@Address nvarchar(80),
@ZipCode char(6),
@Tel nvarchar(20),
@Fax nvarchar(20),
@BankName nvarchar(40),
@BankAccount nvarchar(50),
@Contacter nvarchar(20),
@Email nvarchar(30)
as
update TBL_Supplier
set SupplierName=@SupplierName,SpellingCode=@SpellingCode,Address=@Address,ZipCode=@ZipCode,Tel=@Tel,Fax=@Fax,BankName=@BankName,BankAccount=@BankAccount,@Contacter=@Contacter,Email=@Email
where SupplierID=@SupplierID
return
exec supp_UpdateSupplierBySupplierID '1','供应商2','供应商的Code2','供应商地址2','邮编2','电话2','不知道2','工商银行2','45646546546545646542','这个不知道2','2123456@qq.com'
--4.查询所有记录
create proc supp_GetAllSupplier
as
select * from TBL_Supplier
return
exec supp_GetAllSupplier
--5.根据SupplierID查询记录
create proc supp_GetAllSupplierBySupplierID
@SupplierID nvarchar(6)
as
select * from TBL_Supplier where SupplierID=@SupplierID
return
exec supp_GetAllSupplierBySupplierID '1' |
--
-- PostgreSQL database dump
--
-- Dumped from database version 9.6.1
-- Dumped by pg_dump version 9.6.1
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SET check_function_bodies = false;
SET client_min_messages = warning;
SET row_security = off;
DROP DATABASE IF EXISTS postgres;
--
-- Name: postgres; Type: DATABASE; Schema: -; Owner: postgres
--
CREATE DATABASE postgres WITH TEMPLATE = template0 ENCODING = 'UTF8' LC_COLLATE = 'Bosnian (Latin)_Bosnia and Herzegovina.1250' LC_CTYPE = 'Bosnian (Latin)_Bosnia and Herzegovina.1250';
ALTER DATABASE postgres OWNER TO postgres;
\connect postgres
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SET check_function_bodies = false;
SET client_min_messages = warning;
SET row_security = off;
--
-- Name: postgres; Type: COMMENT; Schema: -; Owner: postgres
--
COMMENT ON DATABASE postgres IS 'default administrative connection database';
--
-- 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';
--
-- Name: adminpack; Type: EXTENSION; Schema: -; Owner:
--
CREATE EXTENSION IF NOT EXISTS adminpack WITH SCHEMA pg_catalog;
--
-- Name: EXTENSION adminpack; Type: COMMENT; Schema: -; Owner:
--
COMMENT ON EXTENSION adminpack IS 'administrative functions for PostgreSQL';
SET search_path = public, pg_catalog;
SET default_tablespace = '';
SET default_with_oids = false;
--
-- Name: challenges; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE challenges (
id integer NOT NULL,
sender character varying(30) NOT NULL,
recipient character varying(30) NOT NULL,
dateofcreation timestamp without time zone NOT NULL,
delivered boolean NOT NULL,
response character varying(30)
);
ALTER TABLE challenges OWNER TO postgres;
--
-- Name: challenges_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE challenges_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE challenges_id_seq OWNER TO postgres;
--
-- Name: challenges_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE challenges_id_seq OWNED BY challenges.id;
--
-- Name: player; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE player (
username character varying(30) NOT NULL,
firstname character varying(30) NOT NULL,
lastname character varying(30) NOT NULL,
password character varying(64) NOT NULL,
lat double precision DEFAULT 0,
lon double precision DEFAULT 0,
isonline boolean DEFAULT false NOT NULL
);
ALTER TABLE player OWNER TO postgres;
--
-- Name: playerpokemon; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE playerpokemon (
username character varying(30) NOT NULL,
pokemontypeid integer NOT NULL,
customname character varying(30)
);
ALTER TABLE playerpokemon OWNER TO postgres;
--
-- Name: pokemontype; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE pokemontype (
id integer NOT NULL,
name character varying(30) NOT NULL,
x integer,
y integer,
rarity integer DEFAULT 0 NOT NULL,
catchchance double precision DEFAULT 0 NOT NULL,
hp integer DEFAULT 0 NOT NULL,
attack integer DEFAULT 0 NOT NULL,
defense integer DEFAULT 0 NOT NULL
);
ALTER TABLE pokemontype OWNER TO postgres;
--
-- Name: sentpokemons; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE sentpokemons (
id integer NOT NULL,
pokemontypeid integer NOT NULL,
lat double precision DEFAULT 0 NOT NULL,
lon double precision DEFAULT 0 NOT NULL,
expired boolean DEFAULT false NOT NULL,
expiretimestamp timestamp without time zone NOT NULL
);
ALTER TABLE sentpokemons OWNER TO postgres;
--
-- Name: sentpokemons_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE sentpokemons_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE sentpokemons_id_seq OWNER TO postgres;
--
-- Name: sentpokemons_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE sentpokemons_id_seq OWNED BY sentpokemons.id;
--
-- Name: challenges id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY challenges ALTER COLUMN id SET DEFAULT nextval('challenges_id_seq'::regclass);
--
-- Name: sentpokemons id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY sentpokemons ALTER COLUMN id SET DEFAULT nextval('sentpokemons_id_seq'::regclass);
--
-- Data for Name: challenges; Type: TABLE DATA; Schema: public; Owner: postgres
--
INSERT INTO challenges (id, sender, recipient, dateofcreation, delivered, response) VALUES (21, 'javelin472@gmail.com', 'ognjen.bostjancic@outlook.com', '2017-03-21 12:21:05.170836', true, 'accept');
--
-- Name: challenges_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--
SELECT pg_catalog.setval('challenges_id_seq', 21, true);
--
-- Data for Name: player; Type: TABLE DATA; Schema: public; Owner: postgres
--
INSERT INTO player (username, firstname, lastname, password, lat, lon, isonline) VALUES ('javelin33@hotmail.com', 'Ognjen', 'Bostjancic', 'f6689b2444cb5bffeb6bd3b636f97755c10214f0894bfa490152700322369b1f', 43.878006800000001, 18.4101918, false);
INSERT INTO player (username, firstname, lastname, password, lat, lon, isonline) VALUES ('javelin472@gmail.com', 'Ognjen', 'Bostjancic', 'f6689b2444cb5bffeb6bd3b636f97755c10214f0894bfa490152700322369b1f', 43.854870099999999, 18.398841600000001, true);
INSERT INTO player (username, firstname, lastname, password, lat, lon, isonline) VALUES ('ognjen.bostjancic@outlook.com', 'Ognjen', 'Bostjancic', 'f6689b2444cb5bffeb6bd3b636f97755c10214f0894bfa490152700322369b1f', 43.854852799999996, 18.3987999, true);
--
-- Data for Name: playerpokemon; Type: TABLE DATA; Schema: public; Owner: postgres
--
INSERT INTO playerpokemon (username, pokemontypeid, customname) VALUES ('ognjen.bostjancic@outlook.com', 11, '76');
INSERT INTO playerpokemon (username, pokemontypeid, customname) VALUES ('ognjen.bostjancic@outlook.com', 20, 'a');
INSERT INTO playerpokemon (username, pokemontypeid, customname) VALUES ('ognjen.bostjancic@outlook.com', 16, 'mjau');
INSERT INTO playerpokemon (username, pokemontypeid, customname) VALUES ('ognjen.bostjancic@outlook.com', 13, 'sdf');
INSERT INTO playerpokemon (username, pokemontypeid, customname) VALUES ('ognjen.bostjancic@outlook.com', 13, 'sdf');
--
-- Data for Name: pokemontype; Type: TABLE DATA; Schema: public; Owner: postgres
--
INSERT INTO pokemontype (id, name, x, y, rarity, catchchance, hp, attack, defense) VALUES (2, 'Bulbasaur', 0, 0, 2, 0.16, 20, 3, 2);
INSERT INTO pokemontype (id, name, x, y, rarity, catchchance, hp, attack, defense) VALUES (3, 'Charmander', 3, 0, 2, 0.16, 20, 3, 2);
INSERT INTO pokemontype (id, name, x, y, rarity, catchchance, hp, attack, defense) VALUES (4, 'Gengar', 9, 3, 1, 0.80000000000000004, 30, 3, 3);
INSERT INTO pokemontype (id, name, x, y, rarity, catchchance, hp, attack, defense) VALUES (5, 'Jigglypuff', 10, 1, 4, 0.40000000000000002, 50, 2, 1);
INSERT INTO pokemontype (id, name, x, y, rarity, catchchance, hp, attack, defense) VALUES (6, 'Squirtle', 6, 0, 2, 0.16, 20, 3, 3);
INSERT INTO pokemontype (id, name, x, y, rarity, catchchance, hp, attack, defense) VALUES (7, 'Caterpie', 9, 0, 5, 0.40000000000000002, 20, 2, 2);
INSERT INTO pokemontype (id, name, x, y, rarity, catchchance, hp, attack, defense) VALUES (8, 'Weedle', 12, 0, 5, 0.40000000000000002, 20, 2, 2);
INSERT INTO pokemontype (id, name, x, y, rarity, catchchance, hp, attack, defense) VALUES (9, 'Pidgey', 15, 0, 5, 0.40000000000000002, 20, 2, 2);
INSERT INTO pokemontype (id, name, x, y, rarity, catchchance, hp, attack, defense) VALUES (10, 'Rattata', 18, 0, 5, 0.40000000000000002, 20, 3, 2);
INSERT INTO pokemontype (id, name, x, y, rarity, catchchance, hp, attack, defense) VALUES (11, 'Sandshrew', 26, 0, 3, 0.40000000000000002, 20, 4, 4);
INSERT INTO pokemontype (id, name, x, y, rarity, catchchance, hp, attack, defense) VALUES (12, 'Clefairy', 6, 1, 4, 0.23999999999999999, 30, 2, 2);
INSERT INTO pokemontype (id, name, x, y, rarity, catchchance, hp, attack, defense) VALUES (13, 'Zubat', 12, 1, 5, 0.40000000000000002, 20, 2, 2);
INSERT INTO pokemontype (id, name, x, y, rarity, catchchance, hp, attack, defense) VALUES (14, 'Oddish', 14, 1, 5, 0.47999999999999998, 20, 3, 3);
INSERT INTO pokemontype (id, name, x, y, rarity, catchchance, hp, attack, defense) VALUES (15, 'Diglett', 21, 1, 1, 0.40000000000000002, 10, 3, 1);
INSERT INTO pokemontype (id, name, x, y, rarity, catchchance, hp, attack, defense) VALUES (16, 'Meowth', 23, 1, 5, 0.40000000000000002, 20, 2, 2);
INSERT INTO pokemontype (id, name, x, y, rarity, catchchance, hp, attack, defense) VALUES (17, 'Psyduck', 25, 1, 1, 0.40000000000000002, 20, 3, 2);
INSERT INTO pokemontype (id, name, x, y, rarity, catchchance, hp, attack, defense) VALUES (18, 'Growlithe', 1, 2, 3, 0.23999999999999999, 20, 4, 2);
INSERT INTO pokemontype (id, name, x, y, rarity, catchchance, hp, attack, defense) VALUES (19, 'Poliwag', 3, 2, 4, 0.40000000000000002, 20, 3, 2);
INSERT INTO pokemontype (id, name, x, y, rarity, catchchance, hp, attack, defense) VALUES (20, 'Abra', 6, 2, 3, 0.40000000000000002, 10, 1, 1);
INSERT INTO pokemontype (id, name, x, y, rarity, catchchance, hp, attack, defense) VALUES (1, 'Pikachu', 24, 0, 2, 0.16, 20, 3, 2);
--
-- Name: sentpokemons_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--
SELECT pg_catalog.setval('sentpokemons_id_seq', 2196, true);
--
-- Name: challenges challenges_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY challenges
ADD CONSTRAINT challenges_pkey PRIMARY KEY (id);
--
-- Name: player player_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY player
ADD CONSTRAINT player_pkey PRIMARY KEY (username);
--
-- Name: pokemontype pokemontype_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY pokemontype
ADD CONSTRAINT pokemontype_pkey PRIMARY KEY (id);
--
-- Name: sentpokemons sentpokemons_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY sentpokemons
ADD CONSTRAINT sentpokemons_pkey PRIMARY KEY (id);
--
-- Name: challenges challenges_recipient_player_username_fk; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY challenges
ADD CONSTRAINT challenges_recipient_player_username_fk FOREIGN KEY (recipient) REFERENCES player(username);
--
-- Name: challenges challenges_sender_player_username_fk; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY challenges
ADD CONSTRAINT challenges_sender_player_username_fk FOREIGN KEY (sender) REFERENCES player(username);
--
-- Name: playerpokemon playerpokemon_player_username_fk; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY playerpokemon
ADD CONSTRAINT playerpokemon_player_username_fk FOREIGN KEY (username) REFERENCES player(username);
--
-- Name: playerpokemon playerpokemon_pokemontype_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY playerpokemon
ADD CONSTRAINT playerpokemon_pokemontype_id_fk FOREIGN KEY (pokemontypeid) REFERENCES pokemontype(id);
--
-- PostgreSQL database dump complete
--
|
------------- CREATE USER -----------------------------------
SELECT * FROM master.sys.server_principals;
SELECT * FROM sysusers;
CREATE LOGIN student WITH PASSWORD = 'student';
CREATE USER student FOR LOGIN student;
USE parking GRANT ALL PRIVILEGES TO student;
EXECUTE AS USER = 'student';
SELECT * FROM fn_my_permissions(NULL, 'DATABASE');
SELECT * FROM fn_my_permissions(NULL, 'SERVER');
REVERT;
|
-- phpMyAdmin SQL Dump
-- version 4.9.1
-- https://www.phpmyadmin.net/
--
-- Хост: 127.0.0.1
-- Время создания: Дек 04 2019 г., 17:32
-- Версия сервера: 10.4.8-MariaDB
-- Версия PHP: 7.3.11
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 */;
--
-- База данных: `travellers_reviews`
--
-- --------------------------------------------------------
--
-- Структура таблицы `continent`
--
CREATE TABLE `continent` (
`id` int(10) UNSIGNED NOT NULL,
`name` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Дамп данных таблицы `continent`
--
INSERT INTO `continent` (`id`, `name`) VALUES
(1, 'Africa'),
(2, 'Asia');
-- --------------------------------------------------------
--
-- Структура таблицы `country`
--
CREATE TABLE `country` (
`id` int(10) UNSIGNED NOT NULL,
`name` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Дамп данных таблицы `country`
--
INSERT INTO `country` (`id`, `name`) VALUES
(2, 'Egypt'),
(3, 'Afghanistan'),
(4, 'Turkey');
-- --------------------------------------------------------
--
-- Структура таблицы `country_continent_xref`
--
CREATE TABLE `country_continent_xref` (
`country_id` int(10) UNSIGNED NOT NULL,
`continent_id` int(10) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Дамп данных таблицы `country_continent_xref`
--
INSERT INTO `country_continent_xref` (`country_id`, `continent_id`) VALUES
(3, 1),
(2, 2),
(3, 2),
(2, 1),
(4, 1);
-- --------------------------------------------------------
--
-- Структура таблицы `migration`
--
CREATE TABLE `migration` (
`version` varchar(180) NOT NULL,
`apply_time` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Дамп данных таблицы `migration`
--
INSERT INTO `migration` (`version`, `apply_time`) VALUES
('m000000_000000_base', 1575345804),
('m130524_201442_init', 1575345813),
('m190124_110200_add_verification_token_column_to_user_table', 1575345813);
-- --------------------------------------------------------
--
-- Структура таблицы `review`
--
CREATE TABLE `review` (
`id` int(10) UNSIGNED NOT NULL,
`place` varchar(100) NOT NULL,
`country_id` int(10) UNSIGNED NOT NULL,
`user_id` int(10) NOT NULL,
`review` varchar(1000) NOT NULL,
`image_url` varchar(200) NOT NULL,
`trip_start` datetime DEFAULT NULL,
`trip_end` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Дамп данных таблицы `review`
--
INSERT INTO `review` (`id`, `place`, `country_id`, `user_id`, `review`, `image_url`, `trip_start`, `trip_end`) VALUES
(6, 'sasasa', 2, 1, 'ewx', 'uploads/reviews/sasasa87016.png', NULL, NULL);
-- --------------------------------------------------------
--
-- Структура таблицы `user`
--
CREATE TABLE `user` (
`id` int(11) NOT NULL,
`username` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`auth_key` varchar(32) COLLATE utf8_unicode_ci NOT NULL,
`password_hash` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`password_reset_token` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`email` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`status` smallint(6) NOT NULL DEFAULT 10,
`created_at` int(11) NOT NULL,
`updated_at` int(11) NOT NULL,
`verification_token` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Дамп данных таблицы `user`
--
INSERT INTO `user` (`id`, `username`, `auth_key`, `password_hash`, `password_reset_token`, `email`, `status`, `created_at`, `updated_at`, `verification_token`) VALUES
(1, 'tester', 'bN3dZfDeMi9ofy3Q734zfWymj26BAsQR', '$2y$13$BoBwC4sHUplFvh8ZXm8zqed47MaD.nZjwf2PzvTTlfpruCdKnQRuq', NULL, 'tester@tester.com', 9, 1575346643, 1575346643, 'bDMte92HzQGvlp_JAoocLlfdAcWJ--ER_1575346643');
--
-- Индексы сохранённых таблиц
--
--
-- Индексы таблицы `continent`
--
ALTER TABLE `continent`
ADD PRIMARY KEY (`id`);
--
-- Индексы таблицы `country`
--
ALTER TABLE `country`
ADD PRIMARY KEY (`id`);
--
-- Индексы таблицы `country_continent_xref`
--
ALTER TABLE `country_continent_xref`
ADD KEY `fk_continent_continent_xref` (`continent_id`),
ADD KEY `fk_country_country_xref` (`country_id`);
--
-- Индексы таблицы `migration`
--
ALTER TABLE `migration`
ADD PRIMARY KEY (`version`);
--
-- Индексы таблицы `review`
--
ALTER TABLE `review`
ADD PRIMARY KEY (`id`),
ADD KEY `fk_review_country` (`country_id`),
ADD KEY `fk_review_user` (`user_id`);
--
-- Индексы таблицы `user`
--
ALTER TABLE `user`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `username` (`username`),
ADD UNIQUE KEY `email` (`email`),
ADD UNIQUE KEY `password_reset_token` (`password_reset_token`);
--
-- AUTO_INCREMENT для сохранённых таблиц
--
--
-- AUTO_INCREMENT для таблицы `continent`
--
ALTER TABLE `continent`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT для таблицы `country`
--
ALTER TABLE `country`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT для таблицы `review`
--
ALTER TABLE `review`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;
--
-- AUTO_INCREMENT для таблицы `user`
--
ALTER TABLE `user`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- Ограничения внешнего ключа сохраненных таблиц
--
--
-- Ограничения внешнего ключа таблицы `country_continent_xref`
--
ALTER TABLE `country_continent_xref`
ADD CONSTRAINT `fk_continent_continent_xref` FOREIGN KEY (`continent_id`) REFERENCES `continent` (`id`),
ADD CONSTRAINT `fk_country_country_xref` FOREIGN KEY (`country_id`) REFERENCES `country` (`id`);
--
-- Ограничения внешнего ключа таблицы `review`
--
ALTER TABLE `review`
ADD CONSTRAINT `fk_review_country` FOREIGN KEY (`country_id`) REFERENCES `country` (`id`),
ADD CONSTRAINT `fk_review_user` FOREIGN KEY (`user_id`) REFERENCES `user` (`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 */;
|
/*
Name: Plan_Cache_Queries.sql
Purpose: Find most resource-intensive queries in plan cache.
Date updated: 2015/04/03
Permissions needed to run: VIEW SERVER STATE
Notes:
Four options for sorting in WHERE clause.
Adapted from Troubleshooting SQL Server A Guide for the Accidental DBA http://www.red-gate.com/community/books/accidental-dba.
*/
INSERT INTO Concurrency.hlthchk.OptimizerInfo
([Counter],
Occurrence,
[Value])
select [counter],
occurrence,
[value]
from sys.dm_exec_query_optimizer_info
--SELECT TOP (10)
-- REPLACE(SUBSTRING(ST.text, ( QS.statement_start_offset / 2 ) + 1, 100), CHAR(13) + CHAR(10), ' '),
INSERT INTO Concurrency.hlthchk.PlanCache
(StatementText
,ExecutionCount
,TotalWorkerTimeMs
,AvgWorkerTimeMs
,TotalLogicalReads
,AvgLogicalReads
,TotalElapsedTimeMs
,AvgElapsedTimeMs
,CreationTime
,LastExecutionTime
,HoursInCache
,DatabaseName)
SELECT TOP (10)
SUBSTRING(ST.text, ( QS.statement_start_offset / 2 ) + 1,
( ( CASE statement_end_offset
WHEN -1 THEN DATALENGTH(st.text)
ELSE QS.statement_end_offset
END - QS.statement_start_offset ) / 2 ) + 1) AS statement_text ,
execution_count ,
total_worker_time / 1000 AS total_worker_time_ms ,
( total_worker_time / 1000 ) / execution_count AS avg_worker_time_ms ,
total_logical_reads ,
total_logical_reads / execution_count AS avg_logical_reads ,
total_elapsed_time / 1000 AS total_elapsed_time_ms ,
( total_elapsed_time / 1000 ) / execution_count AS avg_elapsed_time_ms ,
qs.creation_time,
qs.last_execution_time,
DATEDIFF(hh, qs.creation_time, qs.last_execution_time) AS hours_in_cache,
--qp.query_plan,
ISNULL(DB_NAME(st.dbid), 'N/A') AS DatabaseName--, --Only available for ad hoc or prepared statements
--qs.plan_handle
FROM sys.dm_exec_query_stats qs
CROSS APPLY sys.dm_exec_sql_text(qs.sql_handle) st
CROSS APPLY sys.dm_exec_query_plan(qs.plan_handle) qp
ORDER BY
total_worker_time DESC
--total_logical_reads DESC
--total_elapsed_time_ms DESC
--execution_count DESC |
--- Author: Francisco Munoz Alvarez
--- Date : 20/07/2013
--- Script: chapter7_examples.sql
--- Description: All examples done on chapter 7
SQL> SELECT type, records_total, records_used,con_id
2 FROM V$controlfile_record_section;
SQL> oradebug setmypid
> oradebug dump controlf 5
SQL> oradebug tracefile_name
/u01/app/oracle/diag/rdbms/acdb/acdb/trace/acdb_ora_7502.trc
SQL> exit
--- Creating RMAn Catalog
$ RMAN target sysbackup CATALOG=rcat_owner/rcat@rcatdb
sqlplus sys/oracle@apdb as sysdba
SQL> CREATE TABLESPACE rcat_tbs
2 DATAFILE
3 '/u01/app/oracle/oradata/acdb/apdb/rcattbs.dbf' size 400m;
SQL> create user rcat_adm identified by rcat
2 default tablespace rcat_tbs
3 quota unlimited on rcat_tbs temporary tablespace temp;
SQL> grant connect, resource, recovery_catalog_owner to rcat_adm;
SQL> CREATE USER rcat_adm IDENTIFIED BY rcat
2 DEFAULT TABLESPACE rcat_tbs
3 QUOTA UNLIMITED ON rcat_tbs TEMPORARY TABLESPACE temp;
SQL> GRANT connect, resource, recovery_catalog_owner TO rcat_adm;
$ rman target / catalog=rcat_adm/rcat@apdb
RMAN> CREATE CATALOG;
RMAN> exit
$ rman target / catalog=rcat_adm/rcat@apdb
RMAN> REPORT SCHEMA;
RMAN> REGISTER DATABASE;
RMAN> REPORT SCHEMA;
--- Resynchronization of Catalog with Control File
RMAN> RESYNC CATALOG;
--- Consolidation of Catalogs
$ rman target
RMAN> CONNECT CATALOG rcat_adm/rcat
RMAN> IMPORT CATALOG rcv11/rcat@orcl1123;
RMAN> exit
SQL> CONNECT rcv11/rcat
SQL> SELECT * FROM rcver;
$ rman target / catalog=rcv11/rcat@orcl1123
RMAN> UPGRADE CATALOG;
RMAN> UPGRADE CATALOG;
SQL> SELECT * FROM rcver;
$ rman target / catalog=rcat_adm/rcat
RMAN> IMPORT CATALOG rcv11/rcat@orcl1123;
$ rman target / catalog=rcv11/rcat
RMAN> LIST INCARNATION;
RMAN> REPORT SCHEMA;
RMAN> LIST INCARNATION;
--- Creating Virtual Catalog
$ sqlplus / as sysdba
SQL> CREATE USER vpsuser IDENTIFIED BY vpcpwd DEFAULT TABLESPACE users QUOTA UNLIMITED ON users;
SQL> GRANT recovery_catalog_owner TO vpsuser;
$ rman target / catalog=rcat_adm/rcat
RMAN> GRANT catalog FOR DATABASE orcl1123 TO vpsuser
RMAN> GRANT REGISTER DATABASE TO vpsuser;
RMAN> exit
$ rman target / catalog=vpsuser/vpcpwd
RMAN> CREATE VIRTUAL CATALOG;
RMAN> LIST INCARNATION;
RMAN> LIST db_unique_name ALL;
RMAN> REVOKE CATALOG FOR DATABASE orcl1123 FROM vpcuser;
$ rman target / catalog=vpcuser/vpcpwd
RMAN> DROP CATALOG;
RMAN> DROP CATALOG;
--- Creating and Managing Stored Scripts
RMAN> CREATE SCRIPT test_scr{
2> BACKUP TABLESPACE system;
3> }
RMAN> LIST SCRIPT NAMES;
RMAN> PRINT SCRIPT test_scr;
RMAN> run{execute script test_scr;}
RMAN> REPLACE SCRIPT test_scr
2> {backup tablespace sysaux;}
RMAN> PRINT SCRIPT test_scr;
RMAN> DELETE SCRIPT test_scr;
RMAN> LIST SCRIPTS NAME;
$ rman TARGET / CATALOG rcat@rcatdb SCRIPT '/u01/app/oracle/fbkp.cmd';
--- Catalog non-catalog backups
RMAN> CATALOG datafilecopy '/u01/app/oracle/system01.dbf';
--- Unregister Database
RMAN> UNREGISTER DATABASE;
$ rman target / catalog=rcat_adm/rcat
RMAN> DROP CATALOG;
RMAN> DROP CATALOG;
--- Reporting in RMAN
RMAN> LIST BACKUP SUMMARY;
RMAN> LIST BACKUP BY FILE;
RMAN> LIST BACKUP;
/
|
set hive.exec.dynamic.partition.mode=nonstrict;
SET hive.exec.max.dynamic.partitions=100000;
SET hive.exec.max.dynamic.partitions.pernode=100000;
#天模组
insert overwrite table T_HDRC_MODEL_DAY partition (day)
select BDID ,BDD1 ,BDD2 ,BDD3 ,BDD4 ,BDD5,(case when BDD5=1 then BDD2 else 0 end) as newmerchantNo,
(BDM1+BDM9-(BDM17+BDM25+BDM33+BDM49)) as CDM1 ,
(BDM2+BDM10-(BDM18+BDM26+BDM34+BDM50)) as CDM2,
BDM57 as CDM3,
(BDM57-(BDM2+BDM10-(BDM18+BDM26+BDM34+BDM50))) as CDM4,
(BDM55+BDM56) as CDM5,(BDM42+BDM48) as CDM6,
(BDM18+BDM24+BDM26+BDM32+BDM34+BDM40) as CDM7,
(BDM9-BDM25) as CDM8,(BDM3+BDM11-(BDM19+BDM27+BDM35+BDM51)) as CDM9 ,
(BDM5+BDM13-(BDM21+BDM29+BDM37+BDM53)) as CDM10,
(case when BDD5=1 then (BDM1+BDM9-(BDM17+BDM25+BDM33+BDM49)) else 0 end) as CDM11,
(case when BDD5=1 then (BDM2+BDM10-(BDM18+BDM26+BDM34+BDM50)) else 0 end) as CDM12,
(case when BDD5=0 then (BDM1+BDM9-(BDM17+BDM25+BDM33+BDM49)) else 0 end) as CDM13,
(case when BDD5=0 then (BDM2+BDM10-(BDM18+BDM26+BDM34+BDM50)) else 0 end) as CDM14,
(case when BDD4=02 or BDD4=01 then (BDM1+BDM9-(BDM17+BDM25+BDM33+BDM49)) else 0 end) as CDM15,
BDD1 from T_HDRC_TYPE_DAY where BDD1 = ${hivevar:lastdate} ; |
/*
SQLyog Ultimate v12.4.1 (64 bit)
MySQL - 5.7.18-log : Database - game_user
*********************************************************************
*/
/*!40101 SET NAMES utf8 */;
/*!40101 SET SQL_MODE=''*/;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
CREATE DATABASE /*!32312 IF NOT EXISTS*/`game_user` /*!40100 DEFAULT CHARACTER SET utf8mb4 */;
USE `game_user`;
/*Table structure for table `bulletin_board` */
CREATE TABLE `bulletin_board` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`channel_id` int(11) DEFAULT '-999' COMMENT '渠道',
`s_times` int(11) DEFAULT NULL COMMENT '开始时间戳',
`e_times` int(11) DEFAULT NULL COMMENT '结束时间戳',
`icon` varchar(255) CHARACTER SET utf8 DEFAULT '""' COMMENT 'icon',
`title` varchar(255) CHARACTER SET utf8 DEFAULT NULL COMMENT '标题',
`content` text CHARACTER SET utf8 COMMENT '内容',
`sort` int(11) DEFAULT '1' COMMENT '显示权重,越大显示在越前面',
`op_state` int(2) DEFAULT '0' COMMENT '操作状态, 0不生效 1生效',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8mb4;
/*Table structure for table `channel` */
CREATE TABLE `channel` (
`channel_id` int(11) NOT NULL COMMENT '渠道id',
`channel_name` varchar(255) CHARACTER SET utf8 DEFAULT NULL COMMENT '渠道描述',
`call_mod` varchar(255) DEFAULT NULL,
PRIMARY KEY (`channel_id`),
UNIQUE KEY `channel_id` (`channel_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*Table structure for table `channel_recharge` */
CREATE TABLE `channel_recharge` (
`channel_id` int(11) NOT NULL,
`recharge_id` int(11) NOT NULL,
`recharge_name` varchar(255) DEFAULT NULL,
`call_mod` varchar(255) DEFAULT NULL,
PRIMARY KEY (`channel_id`,`recharge_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*Table structure for table `client_version` */
CREATE TABLE `client_version` (
`channel_id` int(11) NOT NULL,
`version` varchar(255) CHARACTER SET utf8 NOT NULL DEFAULT '' COMMENT '小于等于该版本',
`comment` varchar(255) DEFAULT NULL,
`goto_link` varchar(1024) CHARACTER SET utf8 DEFAULT '',
`s_url` varchar(1024) CHARACTER SET utf8 DEFAULT '',
`s_port` int(11) DEFAULT '0',
`op_state` int(11) DEFAULT '0' COMMENT '操作状态, 0不生效 1生效',
PRIMARY KEY (`channel_id`,`version`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='配置某个发行版本是强更还是分流到渠道服';
/*Table structure for table `config` */
CREATE TABLE `config` (
`k` int(11) NOT NULL,
`comment` varchar(255) CHARACTER SET utf8 DEFAULT '',
`v` varchar(2048) CHARACTER SET utf8 DEFAULT '',
`op_state` int(11) DEFAULT '0',
PRIMARY KEY (`k`),
UNIQUE KEY `k` (`k`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*Table structure for table `feedback` */
CREATE TABLE `feedback` (
`uid` int(11) NOT NULL,
`auto_id` int(11) NOT NULL,
`channel_id` int(11) DEFAULT '-999',
`version` varchar(32) CHARACTER SET utf8 DEFAULT NULL,
`udid` varchar(255) CHARACTER SET utf8 DEFAULT NULL,
`ip` varchar(32) CHARACTER SET utf8 DEFAULT NULL,
`c_times` int(11) DEFAULT NULL,
`u_times` int(11) DEFAULT '0',
`msg` varchar(1024) CHARACTER SET utf8 DEFAULT NULL,
`contact` varchar(32) CHARACTER SET utf8 DEFAULT NULL,
`status` int(11) DEFAULT '0' COMMENT '0:已反馈 1:已查看 2:已处理 3:玩家删除',
PRIMARY KEY (`uid`,`auto_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*Table structure for table `orders` */
CREATE TABLE `orders` (
`order_id` varchar(64) CHARACTER SET utf8 NOT NULL COMMENT '游戏订单号',
`c_times` int(11) NOT NULL COMMENT '创建时间戳',
`e_times` int(11) DEFAULT NULL COMMENT '完成时间戳',
`uid` int(11) NOT NULL COMMENT '角色id',
`channel_id` int(11) DEFAULT NULL COMMENT '渠道',
`recharge_id` int(11) DEFAULT NULL COMMENT '支付平台',
`goods_id` int(11) NOT NULL COMMENT '道具id',
`goods_num` int(11) DEFAULT '1' COMMENT '道具数量',
`amount` int(11) DEFAULT '0' COMMENT '金额 单位:分',
`currency` varchar(255) CHARACTER SET utf8 DEFAULT NULL COMMENT '货币类型',
`status` int(11) DEFAULT '0' COMMENT '0:已创建 1:通知到服务器 2:充值成功 4:放弃充值 5:充值失败',
`is_pro` int(1) DEFAULT '0' COMMENT '0:测试环境 1:生产环境',
`order_num` varchar(255) CHARACTER SET utf8 DEFAULT NULL COMMENT '平台订单号',
`out_order` varchar(255) CHARACTER SET utf8 DEFAULT NULL COMMENT '第三方平台订单号',
`out_order_info` varchar(2048) DEFAULT NULL COMMENT '订单相信信息',
PRIMARY KEY (`order_id`),
KEY `uid` (`uid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*Table structure for table `orders_err` */
CREATE TABLE `orders_err` (
`order_id` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`msg` varchar(2048) COLLATE utf8mb4_unicode_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*Table structure for table `switch` */
CREATE TABLE `switch` (
`channel_id` int(11) NOT NULL DEFAULT '-999',
`comment` varchar(1024) CHARACTER SET utf8 DEFAULT NULL,
`switchs` varchar(1024) CHARACTER SET utf8 DEFAULT NULL COMMENT '放入该列表的功能表示需要关闭',
`op_state` int(11) DEFAULT '0',
PRIMARY KEY (`channel_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*Table structure for table `user` */
CREATE TABLE `user` (
`uin` int(11) NOT NULL AUTO_INCREMENT,
`c_times` int(11) DEFAULT NULL COMMENT '账号创建时间戳',
`user_name` varchar(255) CHARACTER SET utf8 DEFAULT NULL,
`pwd` varchar(255) CHARACTER SET utf8 DEFAULT NULL,
`channel_id` int(11) DEFAULT '-999' COMMENT '渠道',
`sdk_openid` varchar(255) CHARACTER SET utf8 DEFAULT NULL COMMENT '第三方平台的openid',
`sdk_token` varchar(1024) CHARACTER SET utf8 DEFAULT NULL,
`udid` varchar(255) CHARACTER SET utf8 DEFAULT NULL COMMENT '设备号',
`ins` varchar(8) CHARACTER SET utf8 DEFAULT NULL COMMENT '国际编码',
`tel` varchar(32) CHARACTER SET utf8 DEFAULT NULL COMMENT '手机号',
`login_type` int(1) DEFAULT NULL COMMENT '1:游客登陆 2:账户登陆 3:sdk登陆 4:手机号登陆',
`ban_times` int(11) DEFAULT NULL COMMENT '封号截至时间',
PRIMARY KEY (`uin`),
UNIQUE KEY `tel` (`tel`),
UNIQUE KEY `user_name` (`user_name`),
UNIQUE KEY `udid` (`channel_id`,`udid`),
UNIQUE KEY `sdk_openid` (`channel_id`,`sdk_openid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*Table structure for table `user_band` */
CREATE TABLE `user_band` (
`channel_id` int(11) NOT NULL,
`open_id` varchar(255) CHARACTER SET utf8 NOT NULL COMMENT '账号绑定功能',
`uin` int(11) DEFAULT NULL,
PRIMARY KEY (`channel_id`,`open_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*Table structure for table `user_info` */
CREATE TABLE `user_info` (
`uin` int(11) NOT NULL,
`token` varchar(32) DEFAULT '',
`gmt_offset` int(11) DEFAULT '28800' COMMENT '时差',
`nick` varchar(255) CHARACTER SET utf8 DEFAULT '' COMMENT '用户昵称',
`sex` int(11) DEFAULT '0' COMMENT '性别',
`head_img` varchar(1024) CHARACTER SET utf8 DEFAULT '' COMMENT '头像',
`address` varchar(1024) CHARACTER SET utf8 DEFAULT '' COMMENT '地址',
PRIMARY KEY (`uin`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
Problem Statement:-
Order_Tbl has four columns namely ORDER_DAY, ORDER_ID, PRODUCT_ID, QUANTITY, and PRICE
PART A
Write a SQL query to get all the products that got sold on both the days and the number of times the product is sold.
PART B
Write a SQL query to get products that were ordered on 02-May-2015 but not on 01-May-2015.
SOLUTION
PART A
SELECT PRODUCT_ID,COUNT(PRODUCT_ID) AS [COUNT],Count(distinct ORDER_DAY)
FROM Order_Tbl
GROUP BY PRODUCT_ID
HAVING Count(distinct ORDER_DAY) > 1
PART B
Using Subquery
SELECT DISTINCT(PRODUCT_ID) FROM Order_Tbl
WHERE ORDER_DAY = '2015-05-02'
AND PRODUCT_ID NOT in (
SELECT PRODUCT_ID from Order_Tbl where ORDER_DAY =
'2015-05-01')
Using Join
SELECT A.PRODUCT_ID--,B.PRODUCT_ID
FROM (
(
SELECT PRODUCT_ID
FROM Order_Tbl WHERE ORDER_DAY='2015-05-02'
)A
LEFT JOIN
(
SELECT PRODUCT_ID
FROM Order_Tbl WHERE ORDER_DAY='2015-05-01'
)B
ON A.PRODUCT_ID=B.PRODUCT_ID
)
WHERE B.PRODUCT_ID IS NULL
Using EXCEPT Query
SELECT PRODUCT_ID
FROM Order_Tbl WHERE ORDER_DAY='2015-05-02'
EXCEPT
SELECT PRODUCT_ID
FROM Order_Tbl WHERE ORDER_DAY='2015-05-01'
|
CREATE TABLE smses(
smsc TEXT,
tc TEXT,
destination TEXT,
source TEXT,
service TEXT,
url TEXT,
mask TEXT,
status TEXT,
boxc TEXT
); |
USE cap28_rtinder;
ALTER DATABASE cap28_rtinder CHARACTER SET utf8 COLLATE utf8_unicode_ci;
DROP TABLE IF EXISTS follow;
DROP TABLE IF EXISTS profile;
CREATE TABLE IF NOT EXISTS profile(
profileActivationToken CHAR(32),
profileAvatarCloudinaryId CHAR(32),
profileAvatarUrl VARCHAR(255),
profileEmail VARCHAR(128) NOT NULL,
profileFirstName VARCHAR(32) NOT NULL,
profileHash CHAR(97) NOT NULL,
profileId BINARY(16) NOT NULL,
profileLastName VARCHAR(32) NOT NULL,
profileUserName VARCHAR(32) NOT NULL,
UNIQUE (profileEmail),
UNIQUE (profileUserName),
PRIMARY KEY (profileId)
); |
CREATE DATABASE mydb;
USE mydb;
CREATE USER myuser WITH PASSWORD 'mypassword';
ALTER DATABASE mydb OWNER TO myuser;
-- In under postgres user for mydb
CREATE EXTENSION postgis;
CREATE EXTENSION postgis_topology;
CREATE EXTENSION fuzzystrmatch;
CREATE EXTENSION postgis_tiger_geocoder;
|
-- phpMyAdmin SQL Dump
-- version 4.8.2
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Waktu pembuatan: 20 Agu 2018 pada 14.55
-- Versi server: 10.1.34-MariaDB
-- Versi PHP: 7.2.7
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: `skripsimamdani`
--
-- --------------------------------------------------------
--
-- Struktur dari tabel `tabelsuhu`
--
CREATE TABLE `tabelsuhu` (
`id_suhu` int(11) NOT NULL,
`suhu` varchar(10) NOT NULL,
`kelembapan` varchar(10) NOT NULL,
`durasi` varchar(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data untuk tabel `tabelsuhu`
--
INSERT INTO `tabelsuhu` (`id_suhu`, `suhu`, `kelembapan`, `durasi`) VALUES
(89, '33.0', '36.0', '25'),
(90, '33.0', '35.0', '25'),
(91, '32.0', '39.0', '24'),
(92, '30.0', '42.0', '19'),
(93, '29.0', '48.0', '15'),
(94, '29.0', '48.0', '15'),
(95, '29.0', '50.0', '14'),
(96, '28.0', '50.0', '14'),
(97, '28.0', '53.0', '14'),
(98, '27.0', '56.0', '12'),
(99, '26.0', '63.0', '11'),
(100, '25.0', '63.0', '12'),
(101, '24.0', '67.0', '10'),
(102, '24.0', '67.0', '10'),
(103, '24.0', '67.0', '10'),
(104, '24.0', '67.0', '10'),
(105, '23.0', '69.0', '8'),
(106, '23.0', '71.0', '7'),
(107, '23.0', '71.0', '7'),
(108, '23.0', '75.0', '3'),
(109, '23.0', '72.0', '6'),
(110, '22.0', '73.0', '5'),
(111, '23.0', '72.0', '6'),
(112, '22.0', '75.0', '3'),
(113, '22.0', '75.0', '3'),
(114, '22.0', '76.0', '3'),
(115, '22.0', '77.0', '2'),
(116, '22.0', '79.0', '0');
-- --------------------------------------------------------
--
-- Struktur dari tabel `tabeltanggal`
--
CREATE TABLE `tabeltanggal` (
`waktu` datetime NOT NULL,
`isi` varchar(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data untuk tabel `tabeltanggal`
--
INSERT INTO `tabeltanggal` (`waktu`, `isi`) VALUES
('2018-08-14 15:00:00', '10'),
('2018-08-14 15:15:00', '8');
--
-- Indexes for dumped tables
--
--
-- Indeks untuk tabel `tabelsuhu`
--
ALTER TABLE `tabelsuhu`
ADD PRIMARY KEY (`id_suhu`);
--
-- AUTO_INCREMENT untuk tabel yang dibuang
--
--
-- AUTO_INCREMENT untuk tabel `tabelsuhu`
--
ALTER TABLE `tabelsuhu`
MODIFY `id_suhu` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=121;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
insert into player(team_no, back_no,country,name_kr,name_en,birthday,position,height,weight) values(2, 1,"스페인","케파 아리사발라가","Kepa Arrizabalaga","1994년 10월 03일","GK", 186, 85);
insert into player(team_no, back_no,country,name_kr,name_en,birthday,position,height,weight) values(2, 2,"독일","안토니오 뤼디거","Antonio Rüdiger","1993년 03월 03일","DF", 190, 85);
insert into player(team_no, back_no,country,name_kr,name_en,birthday,position,height,weight) values(2, 3,"스페인","마르코스 알론소","Marcos Alonso","1990년 12월 28일","DF", 188, 87);
insert into player(team_no, back_no,country,name_kr,name_en,birthday,position,height,weight) values(2, 4,"스페인","세스크 파브레가스","Cesc Fàbregas","1987년 05월 04일","MF", 179, 77);
insert into player(team_no, back_no,country,name_kr,name_en,birthday,position,height,weight) values(2, 5,"이탈리아","조르지뉴","Jorginho","1991년 12월 20일","MF", 180, 67);
insert into player(team_no, back_no,country,name_kr,name_en,birthday,position,height,weight) values(2, 6,"잉글랜드","대니 드링크워터","Danny Drinkwater","1990년 03월 05일","MF", 177, 81);
insert into player(team_no, back_no,country,name_kr,name_en,birthday,position,height,weight) values(2, 7,"프랑스","은골로 캉테","N’Golo Kanté","1991년 03월 29일","MF", 168, 72);
insert into player(team_no, back_no,country,name_kr,name_en,birthday,position,height,weight) values(2, 8,"잉글랜드","로스 바클리","Ross Barkley","1993년 12월 05일","MF", 185, 87 );
insert into player(team_no, back_no,country,name_kr,name_en,birthday,position,height,weight) values(2, 10,"벨기에","에덴 아자르","Eden Hazard","1991년 01월 07일","MF", 173, 76);
insert into player(team_no, back_no,country,name_kr,name_en,birthday,position,height,weight) values(2, 11,"스페인","페드로 로드리게스","Pedro Rodríguez","1987년 07월 28일","MF", 169, 65);
insert into player(team_no, back_no,country,name_kr,name_en,birthday,position,height,weight) values(2, 12,"잉글랜드","루벤 로프터스치크","Ruben Loftus-Cheek","1996년 01월 23일","MF", 191, 88);
insert into player(team_no, back_no,country,name_kr,name_en,birthday,position,height,weight) values(2, 13,"아르헨티나","윌리 카바예로","Willy Caballero","1981년 09월 28일","GK", 186, 81);
insert into player(team_no, back_no,country,name_kr,name_en,birthday,position,height,weight) values(2, 15,"나이지리아","빅터 모지스","Victor Moses","1990년 12월 12일","MF", 177, 77);
insert into player(team_no, back_no,country,name_kr,name_en,birthday,position,height,weight) values(2, 17,"크로아티아","마테오 코바치치","Mateo Kovačić","1994년 05월 06일","MF", 176, 78);
insert into player(team_no, back_no,country,name_kr,name_en,birthday,position,height,weight) values(2, 18,"프랑스","올리비에 지루","Olivier Giroud","1986년 09월 30일","FW", 193, 92);
insert into player(team_no, back_no,country,name_kr,name_en,birthday,position,height,weight) values(2, 20,"잉글랜드","칼럼 허드슨오도이","Callum Hudson-Odoi","2000년 11월 07일","MF", 177, 75);
insert into player(team_no, back_no,country,name_kr,name_en,birthday,position,height,weight) values(2, 21,"이탈리아","다비데 차파코스타","Davide Zappacosta","1992년 06월 11일","DF", 182, 72);
insert into player(team_no, back_no,country,name_kr,name_en,birthday,position,height,weight) values(2, 22,"브라질","윌리안 보르지스","Willian Borges","1988년 08월 09일","MF", 175, 78);
insert into player(team_no, back_no,country,name_kr,name_en,birthday,position,height,weight) values(2, 24,"잉글랜드","게리 케이힐","Gary Cahill","1985년 12월 19일","DF", 193, 88);
insert into player(team_no, back_no,country,name_kr,name_en,birthday,position,height,weight) values(2, 27,"덴마크","안드레아스 크리스텐센","Andreas Christensen","1996년 04월 10일","DF", 187, 81);
insert into player(team_no, back_no,country,name_kr,name_en,birthday,position,height,weight) values(2, 28,"스페인","세사르 아스필리쿠에타","César Azpilicueta","1989년 08월 28일","DF", 178, 76);
insert into player(team_no, back_no,country,name_kr,name_en,birthday,position,height,weight) values(2, 29,"스페인","알바로 모라타","Álvaro Morata","1992년 10월 23일","FW", 189, 85);
insert into player(team_no, back_no,country,name_kr,name_en,birthday,position,height,weight) values(2, 30,"브라질","다비드 루이스","David Luiz","1987년 04월 22일","DF", 189, 86);
insert into player(team_no, back_no,country,name_kr,name_en,birthday,position,height,weight) values(2, 31,"잉글랜드","로버트 그린","Robert Green","1980년 01월 18일","GK", 188, 92);
insert into player(team_no, back_no,country,name_kr,name_en,birthday,position,height,weight) values(2, 32,"브라질","루카스 피아존","Lucas Piazon","1994년 01월 20일","MF", 182, 73);
insert into player(team_no, back_no,country,name_kr,name_en,birthday,position,height,weight) values(2, 33,"이탈리아","이메르송 팔미에리","Emerson Palmier","1994년 08월 03일","DF", 175, 77);
insert into player(team_no, back_no,country,name_kr,name_en,birthday,position,height,weight) values(2, 44,"웨일스","에단 암파두","Ethan Ampadu","2000년 09월 14일","DF", 182, 72);
insert into player(team_no, back_no,country,name_kr,name_en,birthday,position,height,weight) values(2, 59,"폴란드","마르신 불카","Marcin Bułka","1999년 10월 04일","GK", 196, 90);
|
CREATE TABLE IF NOT EXISTS
"meteoeudb"."public".foi
(
oid bigserial NOT NULL,
id CHARACTER VARYING(256) NOT NULL,
geom geometry NOT NULL,
metadata jsonb,
PRIMARY KEY (oid),
CONSTRAINT foi_id_ix1 UNIQUE (id)
)
;
CREATE TABLE IF NOT EXISTS
"meteoeudb"."public".observation
(
oid bigserial NOT NULL,
time timestamp NOT NULL,
foi_ref bigint NOT NULL,
data jsonb NOT NULL,
PRIMARY KEY (oid),
CONSTRAINT observation_fk1 FOREIGN KEY (foi_ref) REFERENCES
"meteoeudb"."public"."foi" ("oid")
)
; |
select
'pr_auth,All' as repo_group,
round(count(distinct dup_user_login) / {{n}}, 2) as authors
from
gha_pull_requests
where
created_at >= '{{from}}'
and created_at < '{{to}}'
and (lower(dup_user_login) {{exclude_bots}})
union select sub.repo_group,
round(count(distinct sub.author) / {{n}}, 2) as authors
from (
select 'pr_auth,' || coalesce(ecf.repo_group, r.repo_group) as repo_group,
pr.dup_user_login as author
from
gha_repos r,
gha_pull_requests pr
left join
gha_events_commits_files ecf
on
ecf.event_id = pr.event_id
where
pr.dup_repo_id = r.id
and pr.dup_repo_name = r.name
and pr.created_at >= '{{from}}'
and pr.created_at < '{{to}}'
and (lower(pr.dup_user_login) {{exclude_bots}})
) sub
where
sub.repo_group is not null
group by
sub.repo_group
order by
authors desc,
repo_group asc
;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.