text stringlengths 6 9.38M |
|---|
--// Increase_Schedule_id_column_size
-- Migration SQL that makes the change goes here.
alter table Schedule modify id varchar(255) not null;
--//@UNDO
-- SQL to undo the change goes here.
|
/*$tempViewSQL*/
SELECT
--SUM(与信残リース料)
ISNULL(SUM(CREDIT_BALANCE_LEASE),0) AS CREDIT_BALANCE_LEASE,
--SUM(与信残元本)
ISNULL(SUM(CREDIT_BALANCE_PRINCIPAL),0) AS CREDIT_BALANCE_PRINCIPAL
FROM
--与信残高明細VIEW
CREDIT_BALANCE_DETAIL_VIEW
WHERE
--契約状況 >= 30:検収済
CONTRACT_CONDITION >= /*alreadyAcceptanceCheck*/''
--取引先コード = パラメータ.取引先コード
/*IF(customerCode != null)*/
AND CUSTOMER_CODE = /*customerCode*/''
/*END*/
/*IF(agencyCode != null)*/
--代理店 = パラメータ.取引先コード
AND AGENCY_CUST_CODE = /*agencyCode*/''
/*END*/
--契約番号<>パラメータ.契約番号
/*IF(contractNo != null)*/
AND CONTRACT_NO <> /*contractNo*/''
/*END*/
-- modify @20150911 for redmine #3598
AND CURRENCY_ID = /*keyCurrencyId*/ |
-- phpMyAdmin SQL Dump
-- version 4.5.1
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: Jan 06, 2017 at 02:50 PM
-- Server version: 10.1.19-MariaDB
-- PHP Version: 5.6.28
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: `student`
--
-- --------------------------------------------------------
--
-- Table structure for table `details`
--
CREATE TABLE `details` (
`Name` varchar(25) NOT NULL,
`SRN` varchar(13) NOT NULL,
`Password` varchar(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `details`
--
INSERT INTO `details` (`Name`, `SRN`, `Password`) VALUES
('Pradyumna', '01FB14ECS152', '1234'),
('Pramod', '01fb14ecs154', '4578');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `details`
--
ALTER TABLE `details`
ADD PRIMARY KEY (`SRN`),
ADD UNIQUE KEY `SRN` (`SRN`);
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
use SVV_MyBase;
select СДЕЛКИ.Название_кредита, СДЕЛКИ.Фирма_клиент, КРЕДИТЫ.Сумма
from СДЕЛКИ inner join КРЕДИТЫ
on СДЕЛКИ.Название_кредита like КРЕДИТЫ.Название_кредита
----
select СДЕЛКИ.Название_кредита, СДЕЛКИ.Фирма_клиент, КРЕДИТЫ.Сумма
from СДЕЛКИ inner join КРЕДИТЫ
on СДЕЛКИ.Название_кредита like КРЕДИТЫ.Название_кредита
where КРЕДИТЫ.Название_кредита like '%старт%'
----
select КРЕДИТЫ.Сумма, КРЕДИТЫ.Название_кредита, isnull(СДЕЛКИ.Фирма_клиент, '***' )
from КРЕДИТЫ left join СДЕЛКИ
on СДЕЛКИ.Название_кредита like КРЕДИТЫ.Название_кредита
---
select КЛИЕНТЫ.Фирма_клиент,isnull( СДЕЛКИ.Название_кредита, '***') as [Кредит]
from СДЕЛКИ right join КЛИЕНТЫ
on СДЕЛКИ.Фирма_клиент Like КЛИЕНТЫ.Фирма_клиент
---
select СДЕЛКИ.Фирма_клиент, КРЕДИТЫ.Название_кредита,
case
when(КРЕДИТЫ.Сумма between 50000 and 100000) then 'малый'
when(КРЕДИТЫ.Сумма between 100000 and 150000) then 'средний'
when(КРЕДИТЫ.Сумма between 150000 and 250000) then 'большой'
when(КРЕДИТЫ.Сумма between 250000 and 500000) then 'очень большой'
end
from СДЕЛКИ inner join КРЕДИТЫ
on СДЕЛКИ.Название_кредита like КРЕДИТЫ.Название_кредита |
SELECT StationsT.StationID, StationsT.Station, LinkerT.Passangers, LinkerT.LineID,
AVG(LinkerT.Passangers) OVER(PARTITION BY StationsT.StationID, StationsT.Station) AS AVGPassangers,
MIN(LinkerT.Passangers) OVER(PARTITION BY StationsT.StationID, StationsT.Station) AS MINPassangers,
MAX(LinkerT.Passangers) OVER(PARTITION BY StationsT.StationID, StationsT.Station) AS MAXPassangers
FROM StationsT JOIN LinkerT ON StationsT.StationID = LinkerT.StationID |
Insert into TSACHANO.EMPLOYEE1 (EMPLOYEE_ID,FIRST_NAME,LAST_NAME,EMAIL,
PHONE_NUMBER,HIRE_DATE,JOB_ID,SALARY,COMMISSION_PCT,MANAGER_ID,
DEPARTMENT_ID)
values ('310','TOMASZ','SACHANOWKSI',
'KFEENEY','650.507.9822',to_date('06/05/23','RR/MM/DD'),
'SH_CLERK','333',null,'101','50');
Insert into TSACHANO.EMPLOYEE1 (EMPLOYEE_ID,FIRST_NAME,LAST_NAME,EMAIL,
PHONE_NUMBER,HIRE_DATE,JOB_ID,SALARY,COMMISSION_PCT,MANAGER_ID,
DEPARTMENT_ID)
values ('312','TOMASZ','SACHANOWKSI',
'KFEENEY','650.507.9822',to_date('06/05/23','RR/MM/DD'),
'SH_CLERK','-333',null,'101','50');
UPDATE EMPLOYEE1 SET SALARY=1000 WHERE EMPLOYEE_ID=310;
UPDATE EMPLOYEE1 SET SAKARY=-1000 WHERE EMPLOYEE_ID=310;
DELETE FROM employee1 WHERE employee_id > 309; |
insert into user_info (id,user_name,age,address) values (2,'张三丰',23,'湖北武当山');
insert into user_info (id,user_name,age,address) values (4,'王重阳',34,'湖南长沙');
|
drop table if exists Items;
drop table if exists Bids;
drop table if exists Users;
drop table if exists Categories;
CREATE table Items(
ItemID STRING PRIMARY KEY,
SellerID STRING,
Country STRING,
Location STRING,
Name STRING,
Buy_Price FLOAT,
First_Bid FLOAT,
Currently FLOAT,
Num_of_Bids FLOAT,
Description STRING,
Started DATE,
End DATE,
FOREIGN KEY (SellerID) REFERENCES Users(UserID));
CREATE table Users(
UserID STRING PRIMARY KEY,
Rating INT,
Country STRING,
Location STRING);
CREATE table Bids(
BidderID STRING,
ItemID STRING,
Amount FLOAT,
Time DATE,
PRIMARY KEY (BidderID, Time),
FOREIGN KEY (ItemID) REFERENCES Items(ItemID));
CREATE table Categories(
ItemID STRING,
Category STRING,
PRIMARY KEY(ItemID, Category)
FOREIGN KEY (ItemID) REFERENCES Items(ItemID)); |
create database request;
\connect request
SET client_encoding TO 'UTF8';
create table roles (
id serial primary key,
role varchar(2000) unique
);
create table rules (
id serial primary key,
rule varchar(2000) unique
);
create table roles_rules (
role_id int references roles(id),
rule_id int references rules(id),
PRIMARY KEY (role_id, rule_id)
);
create table users (
id serial primary key,
username varchar(2000) unique,
role_id int references roles(id)
);
create table categories (
id serial primary key,
category varchar(2000) unique
);
create table states (
id serial primary key,
state varchar(2000) unique
);
create table items (
id serial primary key,
item varchar(2000) unique,
create_user_id int references users(id),
execute_user_id int references users(id),
category_id int references categories(id),
state_id int references states(id)
);
create table comments (
id serial primary key,
comment text,
user_id int references users(id),
item_id int references items(id)
);
create table attaches (
id serial primary key,
attach bytea,
item_id int references items(id)
);
insert into roles(role) values ('Системный администратор');
insert into roles(role) values ('Сетевой администратор');
insert into roles(role) values ('Инженер-системотехник');
insert into roles(role) values ('Начальник отдела');
insert into roles(role) values ('Пользователь');
insert into rules(rule) values ('Создание');
insert into rules(rule) values ('Комментирование');
insert into rules(rule) values ('Делегирование');
insert into rules(rule) values ('Закрытие');
insert into rules(rule) values ('Удаление');
insert into roles_rules(role_id, rule_id) select roles.id, rules.id from roles, rules where role = 'Пользователь' and rule = 'Создание';
insert into roles_rules(role_id, rule_id) select roles.id, rules.id from roles, rules where role = 'Пользователь' and rule = 'Комментирование';
insert into roles_rules(role_id, rule_id) select roles.id, rules.id from roles, rules where role = 'Начальник отдела' and rule = 'Удаление';
insert into roles_rules(role_id, rule_id) select roles.id, rules.id from roles, rules where role = 'Начальник отдела' and rule = 'Делегирование';
insert into roles_rules(role_id, rule_id) select roles.id, rules.id from roles, rules where role = 'Начальник отдела' and rule = 'Закрытие';
insert into roles_rules(role_id, rule_id) select roles.id, rules.id from roles, rules where role = 'Системный администратор' and rule = 'Комментирование';
insert into roles_rules(role_id, rule_id) select roles.id, rules.id from roles, rules where role = 'Системный администратор' and rule = 'Закрытие';
insert into roles_rules(role_id, rule_id) select roles.id, rules.id from roles, rules where role = 'Системный администратор' and rule = 'Делегирование';
insert into roles_rules(role_id, rule_id) select roles.id, rules.id from roles, rules where role = 'Сетевой администратор' and rule = 'Комментирование';
insert into roles_rules(role_id, rule_id) select roles.id, rules.id from roles, rules where role = 'Сетевой администратор' and rule = 'Закрытие';
insert into roles_rules(role_id, rule_id) select roles.id, rules.id from roles, rules where role = 'Сетевой администратор' and rule = 'Делегирование';
insert into roles_rules(role_id, rule_id) select roles.id, rules.id from roles, rules where role = 'Инженер-системотехник' and rule = 'Комментирование';
insert into roles_rules(role_id, rule_id) select roles.id, rules.id from roles, rules where role = 'Инженер-системотехник' and rule = 'Закрытие';
insert into users(username, role_id) select 'Иванов', roles.id from roles where role = 'Системный администратор';
insert into users(username, role_id) select 'Петров', roles.id from roles where role = 'Сетевой администратор';
insert into users(username, role_id) select 'Сидоров', roles.id from roles where role = 'Инженер-системотехник';
insert into users(username, role_id) select 'Царёв', roles.id from roles where role = 'Начальник отдела';
insert into users(username, role_id) select 'Пчёлкина', roles.id from roles where role = 'Пользователь';
insert into users(username, role_id) select 'Хохлова', roles.id from roles where role = 'Пользователь';
insert into categories(category) values ('Обслуживание оргтехники');
insert into categories(category) values ('Установка и настройка ОС');
insert into categories(category) values ('Настройка почты и интернет');
insert into categories(category) values ('Подключение к локальной сети');
insert into states(state) values ('Новая');
insert into states(state) values ('Принята в работу');
insert into states(state) values ('Отменена пользователем');
insert into states(state) values ('Закрыта');
with cr_users as (select * from users), ex_users as (select * from users)
insert into items(item, create_user_id, execute_user_id, category_id, state_id)
select 'Подключить принтер', cr_users.id, ex_users.id, categories.id, states.id
from cr_users, ex_users, categories, states
where cr_users.username = 'Пчёлкина' and ex_users.username = 'Сидоров' and category = 'Обслуживание оргтехники' and state = 'Новая';
with cr_users as (select * from users), ex_users as (select * from users)
insert into items(item, create_user_id, execute_user_id, category_id, state_id)
select 'Настроить почту', cr_users.id, ex_users.id, categories.id, states.id
from cr_users, ex_users, categories, states
where cr_users.username = 'Хохлова' and ex_users.username = 'Петров' and category = 'Настройка почты и интернет' and state = 'Новая';
with cr_users as (select * from users), ex_users as (select * from users)
insert into items(item, create_user_id, execute_user_id, category_id, state_id)
select 'Переустановить систему', cr_users.id, ex_users.id, categories.id, states.id
from cr_users, ex_users, categories, states
where cr_users.username = 'Пчёлкина' and ex_users.username = 'Сидоров' and category = 'Установка и настройка ОС' and state = 'Новая';
insert into comments(comment, user_id, item_id) select 'Просьба исполнить заявку в течении дня', users.id, items.id from users, items
where username = 'Пчёлкина' and item = 'Подключить принтер';
insert into comments(comment, user_id, item_id) select 'Будет настроена к концу завтрашнего дня', users.id, items.id from users, items
where username = 'Иванов' and item = 'Настроить почту';
|
CREATE TABLE [ERP].[MovimientoTransferenciaMasivaCuenta] (
[ID] INT IDENTITY (1, 1) NOT NULL,
[IdCuentaEmisor] INT NOT NULL,
[IdCategoriaTipoMovimientoEmisor] INT NOT NULL,
[IdMovimientoTesoreriaEmisor] INT NULL,
[IdTalonarioEmisor] INT NULL,
[NumeroChequeEmisor] INT NULL,
[FechaEmisor] DATETIME NULL,
[FechaVencimientoEmisor] DATETIME NULL,
[TipoCambioEmisor] DECIMAL (14, 5) NULL,
[MontoEmisor] DECIMAL (14, 5) NULL,
[AjusteEmisor] DECIMAL (14, 5) NULL,
[DocumentoEmisor] VARCHAR (25) NULL,
[ObservacionEmisor] VARCHAR (MAX) NULL,
[OrdenDeEmisor] VARCHAR (MAX) NULL,
[FlagChequeDiferido] BIT NULL,
[FlagCheque] BIT NULL,
[FechaRegistro] DATETIME NULL,
[UsuarioRegistro] VARCHAR (250) NULL,
[FechaModificado] DATETIME NULL,
[UsuarioModifico] VARCHAR (250) NULL,
[IdEmpresa] INT NULL,
[Flag] BIT NULL,
[FlagBorrador] BIT NULL,
[Orden] INT NULL,
PRIMARY KEY CLUSTERED ([ID] ASC),
FOREIGN KEY ([IdCategoriaTipoMovimientoEmisor]) REFERENCES [Maestro].[CategoriaTipoMovimiento] ([ID]),
FOREIGN KEY ([IdCuentaEmisor]) REFERENCES [ERP].[Cuenta] ([ID]),
FOREIGN KEY ([IdMovimientoTesoreriaEmisor]) REFERENCES [ERP].[MovimientoTesoreria] ([ID])
);
|
insert into users (username, password , enabled )
values ( 'user',
'pass',
true
);
insert into users (username, password , enabled )
values ( 'admin',
'admin',
true
);
insert into authorities (username, authority)
values ('user' , 'USER_ROLE') ;
insert into authorities (username, authority)
values ('admin' , 'ADMIN_ROLE') ;
select * from users;
select * from authorities;
select * from user;
select * from company;
select * from login_user;
insert into login_user (user_name , password , roles)
values ("user" , "user" ,"USER");
insert into login_user (user_name , password , roles)
values ("admin" , "admin" ,"ADMIN");
UPDATE login_user
SET roles = "ROLE_ADMIN"
WHERE user_name = "admin";
|
set define off;
-- ACN eTS-Contracts00002771
BEGIN HARMONY.DOIT('select ''eTS-Contracts00002771'' from dual');END;
/
begin
harmony.doit('ALTER TABLE HARMONY.TAREA ADD REPORT_APPENDIX5 NUMBER(1,0) default 0');
end;
/
UPDATE HARMONY.TAREA SET REPORT_APPENDIX5 = 1 WHERE NAME IN ('gXRS', 'P2P');
commit; |
USE mavenfuzzyfactory;
-- Analyzing advertisement traffic
SELECT
website_sessions.utm_content,
COUNT(website_sessions.website_session_id) AS sessions,
COUNT(orders.order_id) AS orders,
COUNT(orders.order_id) / COUNT(website_sessions.website_session_id) AS session_to_order_conv_rate
FROM
website_sessions
LEFT JOIN
orders ON website_sessions.website_session_id = orders.website_session_id
WHERE
website_sessions.website_session_id BETWEEN 1000 AND 2000 -- Arbitrary range
GROUP BY website_sessions.utm_content
ORDER BY sessions DESC;
/*
utm_content sessions orders session_to_order_conv_rate
g_ad_1 975 35 0.0359
NULL 18 0 0.0000
g_ad_2 6 0 0.0000
b_ad_2 2 0 0.0000
*/
-- ASSIGNMENT-1 (2012-04-12)
/*
1. We've been live for almost a month now and we're starting to generate sales.
Can you help me understand where the bulk of our website sessions coming from,through yesterday?
I'd like to see breakdown by UTM source, campaign and referring domain if possible.
*/
SELECT
utm_source,
utm_campaign,
http_referer,
COUNT(website_session_id) AS sessions
FROM
website_sessions
WHERE
created_at < '2012-04-12'
GROUP BY utm_source , utm_campaign , http_referer
ORDER BY sessions DESC;
/*
utm_source utm_campaign http_referer sessions
gsearch nonbrand https://www.gsearch.com 3613
NULL NULL NULL 28
NULL NULL https://www.gsearch.com 27
gsearch brand https://www.gsearch.com 26
bsearch brand https://www.bsearch.com 7
NULL NULL https://www.bsearch.com 7
*/
-- ASSIGNMENT-2 (2012-04-14)
/*
2. Sounds like gsearch nonbrand is our major traffic source, but we need to understand
if those sessions are driving sales.
Could you please calculate the conversion rate(CVR) from session to order? Based on
what we're paying for clicks, we'll need a CVR of at least 4% to make th numbers work.
If we're much lower, we'll need to reduce the bids. If we're higher, we can increase
bids to drive more volume.
*/
SELECT
COUNT(website_sessions.website_session_id) AS sessions,
COUNT(orders.order_id) AS orders,
COUNT(orders.order_id) / COUNT(website_sessions.website_session_id) AS session_to_order_conversion_rate
FROM
website_sessions
LEFT JOIN
orders ON website_sessions.website_session_id = orders.website_session_id
WHERE
website_sessions.created_at < '2012-04-14'
AND website_sessions.utm_source = 'gsearch'
AND website_sessions.utm_campaign = 'nonbrand';
/*
sessions orders session_to_order_conversion_rate
3895 112 0.0288
*/
-- BID OPTIMIZATION
-- ASSIGNMENT-3 (2012-05-10)
/*
3. Based on your conversion rate analysis, we bid down gsearch nonbrand on 2012-04-15.
Can you pull gsearch nonbrand trended session volume, by week, to see if bid changes
caused volume to drop at all?
*/
SELECT
MIN(DATE(created_at)) AS week_start_date,
COUNT(website_session_id) AS sessions
FROM
website_sessions
WHERE
created_at < '2012-05-10'
AND utm_source = 'gsearch'
AND utm_campaign = 'nonbrand'
GROUP BY WEEK(created_at);
/*
week_start_date sessions
2012-03-19 896
2012-03-25 956
2012-04-01 1152
2012-04-08 983
2012-04-15 621
2012-04-22 594
2012-04-29 681
2012-05-06 399
*/
-- ASSIGNMENT-4 (2012-05-11)
/*
4. I was trying to use our site on my mobile device the other day, and the experience
was not great.
Could you pull conversion rates from session to order, by device type?
If desktop performance is better than on my mobile we may be able to bid up for
desktop specifically to get more volume?
*/
SELECT
website_sessions.device_type,
COUNT(website_sessions.website_session_id) AS sessions,
COUNT(orders.order_id) AS orders,
COUNT(orders.order_id) / COUNT(website_sessions.website_session_id) AS session_to_order_conersion_rate
FROM
website_sessions
LEFT JOIN
orders ON website_sessions.website_session_id = orders.website_session_id
WHERE
website_sessions.created_at < '2012-05-11'
AND website_sessions.utm_source = 'gsearch'
AND website_sessions.utm_campaign = 'nonbrand'
GROUP BY website_sessions.device_type;
/*
device_type sessions orders session_to_order_conersion_rate
mobile 2492 24 0.0096
desktop 3911 146 0.0373
*/
-- ASSIGNMENT-5 (2012-06-09)
/*
5. After your device-level analysis of conversion rates, we realized desktop was doing well,
so we bid our gsearch nonbrand desktop campaigns up on 2012-05-19.
Could you pull weekly trends for both desktop and mobile so we can see the impact on volume?
You can use 2012-04-15 until the bid change as a baseline.
*/
SELECT
MIN(DATE(created_at)) AS week_start_date,
COUNT(CASE WHEN device_type = 'desktop' THEN website_session_id ELSE NULL END) AS dtop_session,
COUNT(CASE WHEN device_type = 'mobile' THEN website_session_id ELSE NULL END) AS mobile_session
FROM
website_sessions
WHERE
created_at BETWEEN '2012-04-15' AND '2012-06-09'
AND utm_source = 'gsearch'
AND utm_campaign = 'nonbrand'
GROUP BY WEEK(created_at);
/*
week_start_date dtop_session mobile_session
2012-04-15 383 238
2012-04-22 360 234
2012-04-29 425 256
2012-05-06 430 282
2012-05-13 403 214
2012-05-20 661 190
2012-05-27 585 183
2012-06-03 582 157
*/ |
CREATE PROC [ERP].[Usp_Upd_Trabajador_Desactivar]
@ID INT,
@UsuarioElimino VARCHAR(250),
@FechaEliminado DATETIME
AS
BEGIN
UPDATE [ERP].[Trabajador] SET
Flag = 0,
[UsuarioElimino] = @UsuarioElimino,
[FechaEliminado] = @FechaEliminado
WHERE ID = @ID
END
|
select * from dba_scheduler_window_groups
/
|
select to_char(date_shipped, 'DD-MM-YY') as DIA, count(*) as AUTORIZADOS
from shp_w01.shipment
where service_id = 81
and site_id = 'MLA'
and date_shipped between to_date('01-11-13 00:00:00','DD-MM-YY HH24:MI:SS') and to_date('30-11-13 23:59:59','DD-MM-YY HH24:MI:SS')
and index_field not like '%test%' and index_field not like 'Test' and index_field not like 'TEST'
group by to_char(date_shipped, 'DD-MM-YY')
order by 1;
select COUNT(*)
from shp_w01.shipment
where service_id = 81
and site_id = 'MLA'
and date_shipped between to_date('01-11-13 00:00:00','DD-MM-YY HH24:MI:SS') and to_date('30-11-13 23:59:59','DD-MM-YY HH24:MI:SS')
and index_field not like '%test%' and index_field not like '%Test%' and index_field not like '%TEST%';
select to_char(date_shipped, 'DD-MM-YY') as DIA, count(*) as DESPACHADOS
from shp_w01.shipment
where service_id = 81
and site_id = 'MLA'
and ((date_shipped between to_date('01-11-13 00:00:00','DD-MM-YY HH24:MI:SS') and to_date('30-11-13 23:59:59','DD-MM-YY HH24:MI:SS'))
or (date_shipped is null and date_delivered between to_date('01-11-13 00:00:00','DD-MM-YY HH24:MI:SS') and to_date('30-11-13 23:59:59','DD-MM-YY HH24:MI:SS')))
and index_field not like '%test%' and index_field not like '%Test%' and index_field not like '%TEST%'
group by to_char(date_shipped, 'DD-MM-YY')
order by 1;
select *
from shp_w01.shipment
where service_id = 81
and date_created > sysdate - 1;
select *
from all_indexes
where owner = 'SHP_W01' and table_name = 'SHIPMENT';
select table_owner,index_name,column_position pos,substr(column_name, 1, 30) column_name
from all_ind_columns
where table_name = upper('shipment')
order by table_owner, index_name, pos;
select * /*+ full(te) parallel(te,3) */
from shp_w01.tracking_events te
where date_created > sysdate-12/24 and count_repeat > 50;
|
SELECT OBJECT_NAME(S.[OBJECT_ID]) AS [OBJECT NAME],
I.[NAME] AS [INDEX NAME],
USER_SEEKS,
USER_SCANS,
USER_LOOKUPS,
USER_UPDATES
FROM SYS.DM_DB_INDEX_USAGE_STATS AS S
INNER JOIN SYS.INDEXES AS I ON I.[OBJECT_ID] = S.[OBJECT_ID] AND I.INDEX_ID = S.INDEX_ID
WHERE OBJECTPROPERTY(S.[OBJECT_ID],'IsUserTable') = 1
AND S.database_id = DB_ID()
--AND user_seeks = 0
--AND user_scans = 0
--AND user_lookups = 0 |
UPDATE client
SET cl_date = NOW();
UPDATE ink
SET in_date = NOW();
UPDATE machine
SET ma_date = NOW();
UPDATE material
SET mt_date = NOW();
UPDATE materialtype
SET maty_date = NOW();
UPDATE product
SET pr_date = NOW();
UPDATE supplier
SET su_date = NOW();
UPDATE wo
SET wo_date = NOW();
UPDATE zone
SET zo_date = NOW();
--select * from pg_timezone_names where utc_offset = '-06:00:00';
|
-- ======
-- Description:
-- 1. Drops if exists features.distance_time_from_alert
-- 2. Creates various features based on the count of alerts, referrals, and persons found at various lookback windows & distances. More details on dimensions below.
-- 2a. State of alert: Alerts x referrals x persons found
-- 2b. Alert origin: Mobile app x phone x website
-- 2c. Time: 7 days, 28 days, 60 days 6 months
-- 2d. Distance: 50m, 250m, 1000m, 5000m
-- 3. Creates index on the alert column so that subsequent joins are fast
-- Last Updated: Aug 29, 2019
-- ======
DROP TABLE IF EXISTS features.distance_time_from_alert;
SELECT * INTO features.distance_time_from_alert from (
select cohort.alert, features.*
from
(
select
c.alert,
c.datetime_opened as aod,
c.location,
c.region
from semantic.alerts c
) as cohort
inner join lateral (
select
-- alert-level 50m features
count(a.alert)
filter (
where a.datetime_opened >= cohort.aod::date - interval '7 days'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location, 50)
)
as alerts_within_50m_7d,
count(a.alert)
filter (
where a.datetime_opened >= cohort.aod::date - interval '7 days'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location, 50)
and a.alert_origin = 'web'
)
as alerts_within_50m_7d_web_origin,
count(a.alert)
filter (
where a.datetime_opened >= cohort.aod::date - interval '7 days'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location, 50)
and a.alert_origin = 'phone'
)
as alerts_within_50m_7d_phone_origin,
count(a.alert)
filter (
where a.datetime_opened >= cohort.aod::date - interval '7 days'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location, 50)
and a.alert_origin = 'mobile app'
)
as alerts_within_50m_7d_mobile_app_origin,
count(a.alert)
filter (
where a.datetime_opened >= cohort.aod::date - interval '28 days'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location, 50)
) as alerts_within_50m_28d,
count(a.alert)
filter (
where a.datetime_opened >= cohort.aod::date - interval '28 days'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location, 50)
and a.alert_origin = 'web'
)
as alerts_within_50m_28d_web_origin,
count(a.alert)
filter (
where a.datetime_opened >= cohort.aod::date - interval '28 days'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location, 50)
and a.alert_origin = 'phone'
)
as alerts_within_50m_28d_phone_origin,
count(a.alert)
filter (
where a.datetime_opened >= cohort.aod::date - interval '28 days'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location, 50)
and a.alert_origin = 'mobile app'
)
as alerts_within_50m_28d_mobile_app_origin,
count(a.alert)
filter (
where a.datetime_opened >= cohort.aod::date - interval '60 days'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location, 50)
)
as alerts_within_50m_60d,
count(a.alert)
filter (
where a.datetime_opened >= cohort.aod::date - interval '60 days'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location, 50)
and a.alert_origin = 'web'
)
as alerts_within_50m_60d_web_origin,
count(a.alert)
filter (
where a.datetime_opened >= cohort.aod::date - interval '60 days'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location, 50)
and a.alert_origin = 'phone'
)
as alerts_within_50m_60d_phone_origin,
count(a.alert)
filter (
where a.datetime_opened >= cohort.aod::date - interval '60 days'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location, 50)
and a.alert_origin = 'mobile app'
)
as alerts_within_50m_60d_mobile_app_origin,
count(a.alert)
filter (
where a.datetime_opened >= cohort.aod::date - interval '6 months'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location, 50)
)
as alerts_within_50m_6mo,
count(a.alert)
filter (
where a.datetime_opened >= cohort.aod::date - interval '6 months'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location, 50)
and a.alert_origin = 'web'
)
as alerts_within_50m_6mo_web_origin,
count(a.alert)
filter (
where a.datetime_opened >= cohort.aod::date - interval '6 months'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location, 50)
and a.alert_origin = 'phone'
)
as alerts_within_50m_6mo_phone_origin,
count(a.alert)
filter (
where a.datetime_opened >= cohort.aod::date - interval '6 months'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location, 50)
and a.alert_origin = 'mobile app'
)
as alerts_within_50m_6mo_mobile_app_origin,
-- alert-level 250m features
count(a.alert)
filter (
where a.datetime_opened >= cohort.aod::date - interval '7 days'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location, 250)
)
as alerts_within_250m_7d,
count(a.alert)
filter (
where a.datetime_opened >= cohort.aod::date - interval '7 days'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location, 250)
and a.alert_origin = 'web'
)
as alerts_within_250m_7d_web_origin,
count(a.alert)
filter (
where a.datetime_opened >= cohort.aod::date - interval '7 days'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location, 250)
and a.alert_origin = 'phone'
)
as alerts_within_250m_7d_phone_origin,
count(a.alert)
filter (
where a.datetime_opened >= cohort.aod::date - interval '7 days'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location, 250)
and a.alert_origin = 'mobile app'
)
as alerts_within_250m_7d_mobile_app_origin,
count(a.alert)
filter (
where a.datetime_opened >= cohort.aod::date - interval '28 days'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location, 250)
) as alerts_within_250m_28d,
count(a.alert)
filter (
where a.datetime_opened >= cohort.aod::date - interval '28 days'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location, 250)
and a.alert_origin = 'web'
)
as alerts_within_250m_28d_web_origin,
count(a.alert)
filter (
where a.datetime_opened >= cohort.aod::date - interval '28 days'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location, 250)
and a.alert_origin = 'phone'
)
as alerts_within_250m_28d_phone_origin,
count(a.alert)
filter (
where a.datetime_opened >= cohort.aod::date - interval '28 days'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location, 250)
and a.alert_origin = 'mobile app'
)
as alerts_within_250m_28d_mobile_app_origin,
count(a.alert)
filter (
where a.datetime_opened >= cohort.aod::date - interval '60 days'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location, 250)
)
as alerts_within_250m_60d,
count(a.alert)
filter (
where a.datetime_opened >= cohort.aod::date - interval '60 days'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location, 250)
and a.alert_origin = 'web'
)
as alerts_within_250m_60d_web_origin,
count(a.alert)
filter (
where a.datetime_opened >= cohort.aod::date - interval '60 days'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location, 250)
and a.alert_origin = 'phone'
)
as alerts_within_250m_60d_phone_origin,
count(a.alert)
filter (
where a.datetime_opened >= cohort.aod::date - interval '60 days'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location, 250)
and a.alert_origin = 'mobile app'
)
as alerts_within_250m_60d_mobile_app_origin,
count(a.alert)
filter (
where a.datetime_opened >= cohort.aod::date - interval '6 months'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location, 250)
)
as alerts_within_250m_6mo,
count(a.alert)
filter (
where a.datetime_opened >= cohort.aod::date - interval '6 months'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location, 250)
and a.alert_origin = 'web'
)
as alerts_within_250m_6mo_web_origin,
count(a.alert)
filter (
where a.datetime_opened >= cohort.aod::date - interval '6 months'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location, 250)
and a.alert_origin = 'phone'
)
as alerts_within_250m_6mo_phone_origin,
count(a.alert)
filter (
where a.datetime_opened >= cohort.aod::date - interval '6 months'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location, 250)
and a.alert_origin = 'mobile app'
)
as alerts_within_250m_6mo_mobile_app_origin,
-- alert-level 1km features
count(a.alert)
filter (
where a.datetime_opened >= cohort.aod::date - interval '7 days'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location, 1000)
)
as alerts_within_1000m_7d,
count(a.alert)
filter (
where a.datetime_opened >= cohort.aod::date - interval '7 days'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location, 1000)
and a.alert_origin = 'web'
)
as alerts_within_1000m_7d_web_origin,
count(a.alert)
filter (
where a.datetime_opened >= cohort.aod::date - interval '7 days'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location, 1000)
and a.alert_origin = 'phone'
)
as alerts_within_1000m_7d_phone_origin,
count(a.alert)
filter (
where a.datetime_opened >= cohort.aod::date - interval '7 days'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location, 1000)
and a.alert_origin = 'mobile app'
)
as alerts_within_1000m_7d_mobile_app_origin,
count(a.alert)
filter (
where a.datetime_opened >= cohort.aod::date - interval '28 days'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location, 1000)
) as alerts_within_1000m_28d,
count(a.alert)
filter (
where a.datetime_opened >= cohort.aod::date - interval '28 days'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location, 1000)
and a.alert_origin = 'web'
)
as alerts_within_1000m_28d_web_origin,
count(a.alert)
filter (
where a.datetime_opened >= cohort.aod::date - interval '28 days'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location, 1000)
and a.alert_origin = 'phone'
)
as alerts_within_1000m_28d_phone_origin,
count(a.alert)
filter (
where a.datetime_opened >= cohort.aod::date - interval '28 days'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location, 1000)
and a.alert_origin = 'mobile app'
)
as alerts_within_1000m_28d_mobile_app_origin,
count(a.alert)
filter (
where a.datetime_opened >= cohort.aod::date - interval '60 days'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location, 1000)
)
as alerts_within_1000m_60d,
count(a.alert)
filter (
where a.datetime_opened >= cohort.aod::date - interval '60 days'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location, 1000)
and a.alert_origin = 'web'
)
as alerts_within_1000m_60d_web_origin,
count(a.alert)
filter (
where a.datetime_opened >= cohort.aod::date - interval '60 days'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location,1000)
and a.alert_origin = 'phone'
)
as alerts_within_1000m_60d_phone_origin,
count(a.alert)
filter (
where a.datetime_opened >= cohort.aod::date - interval '60 days'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location, 1000)
and a.alert_origin = 'mobile app'
)
as alerts_within_1000m_60d_mobile_app_origin,
count(a.alert)
filter (
where a.datetime_opened >= cohort.aod::date - interval '6 months'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location, 1000)
)
as alerts_within_1000m_6mo,
count(a.alert)
filter (
where a.datetime_opened >= cohort.aod::date - interval '6 months'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location, 1000)
and a.alert_origin = 'web'
)
as alerts_within_1000m_6mo_web_origin,
count(a.alert)
filter (
where a.datetime_opened >= cohort.aod::date - interval '6 months'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location, 1000)
and a.alert_origin = 'phone'
)
as alerts_within_1000m_6mo_phone_origin,
count(a.alert)
filter (
where a.datetime_opened >= cohort.aod::date - interval '6 months'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location, 1000)
and a.alert_origin = 'mobile app'
)
as alerts_within_1000m_6mo_mobile_app_origin,
-- alert-level 5000m features
count(a.alert)
filter (
where a.datetime_opened >= cohort.aod::date - interval '7 days'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location, 5000)
)
as alerts_within_5000m_7d,
count(a.alert)
filter (
where a.datetime_opened >= cohort.aod::date - interval '7 days'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location, 5000)
and a.alert_origin = 'web'
)
as alerts_within_5000m_7d_web_origin,
count(a.alert)
filter (
where a.datetime_opened >= cohort.aod::date - interval '7 days'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location, 5000)
and a.alert_origin = 'phone'
)
as alerts_within_5000m_7d_phone_origin,
count(a.alert)
filter (
where a.datetime_opened >= cohort.aod::date - interval '7 days'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location, 5000)
and a.alert_origin = 'mobile app'
)
as alerts_within_5000m_7d_mobile_app_origin,
count(a.alert)
filter (
where a.datetime_opened >= cohort.aod::date - interval '28 days'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location, 5000)
) as alerts_within_5000m_28d,
count(a.alert)
filter (
where a.datetime_opened >= cohort.aod::date - interval '28 days'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location, 5000)
and a.alert_origin = 'web'
)
as alerts_within_5000m_28d_web_origin,
count(a.alert)
filter (
where a.datetime_opened >= cohort.aod::date - interval '28 days'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location, 5000)
and a.alert_origin = 'phone'
)
as alerts_within_5000m_28d_phone_origin,
count(a.alert)
filter (
where a.datetime_opened >= cohort.aod::date - interval '28 days'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location, 5000)
and a.alert_origin = 'mobile app'
)
as alerts_within_5000m_28d_mobile_app_origin,
count(a.alert)
filter (
where a.datetime_opened >= cohort.aod::date - interval '60 days'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location, 5000)
)
as alerts_within_5000m_60d,
count(a.alert)
filter (
where a.datetime_opened >= cohort.aod::date - interval '60 days'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location, 5000)
and a.alert_origin = 'web'
)
as alerts_within_5000m_60d_web_origin,
count(a.alert)
filter (
where a.datetime_opened >= cohort.aod::date - interval '60 days'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location,5000)
and a.alert_origin = 'phone'
)
as alerts_within_5000m_60d_phone_origin,
count(a.alert)
filter (
where a.datetime_opened >= cohort.aod::date - interval '60 days'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location, 5000)
and a.alert_origin = 'mobile app'
)
as alerts_within_5000m_60d_mobile_app_origin,
count(a.alert)
filter (
where a.datetime_opened >= cohort.aod::date - interval '6 months'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location, 5000)
)
as alerts_within_5000m_6mo,
count(a.alert)
filter (
where a.datetime_opened >= cohort.aod::date - interval '6 months'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location, 5000)
and a.alert_origin = 'web'
)
as alerts_within_5000m_6mo_web_origin,
count(a.alert)
filter (
where a.datetime_opened >= cohort.aod::date - interval '6 months'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location, 5000)
and a.alert_origin = 'phone'
)
as alerts_within_5000m_6mo_phone_origin,
count(a.alert)
filter (
where a.datetime_opened >= cohort.aod::date - interval '6 months'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location, 5000)
and a.alert_origin = 'mobile app'
)
as alerts_within_5000m_6mo_mobile_app_origin,
-- referral-level 50m features
COALESCE(sum(a.referral_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '7 days'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location, 50)
),0)
as referrals_within_50m_7d,
COALESCE(sum(a.referral_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '7 days'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'web'
and ST_DWithin(cohort.location, a.location, 50)
),0)
as referrals_within_50m_7d_web_origin,
COALESCE(sum(a.referral_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '7 days'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'phone'
and ST_DWithin(cohort.location, a.location, 50)
),0)
as referrals_within_50m_7d_phone_origin,
COALESCE(sum(a.referral_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '7 days'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'mobile app'
and ST_DWithin(cohort.location, a.location, 50)
),0)
as referrals_within_50m_7d_mobile_app_origin,
COALESCE(sum(a.referral_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '28 days'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location, 50)
),0)
as referrals_within_50m_28d,
COALESCE(sum(a.referral_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '28 days'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'web'
and ST_DWithin(cohort.location, a.location, 50)
),0)
as referrals_within_50m_28d_web_origin,
COALESCE(sum(a.referral_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '28 days'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'phone'
and ST_DWithin(cohort.location, a.location, 50)
),0)
as referrals_within_50m_28d_phone_origin,
COALESCE(sum(a.referral_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '28 days'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'mobile app'
and ST_DWithin(cohort.location, a.location, 50)
),0)
as referrals_within_50m_28d_mobile_app_origin,
COALESCE(sum(a.referral_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '60 days'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location, 50)
),0)
as referrals_within_50m_60d,
COALESCE(sum(a.referral_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '60 days'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'web'
and ST_DWithin(cohort.location, a.location, 50)
),0)
as referrals_within_50m_60d_web_origin,
COALESCE(sum(a.referral_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '60 days'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'phone'
and ST_DWithin(cohort.location, a.location, 50)
),0)
as referrals_within_50m_60d_phone_origin,
COALESCE(sum(a.referral_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '60 days'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'mobile app'
and ST_DWithin(cohort.location, a.location, 50)
),0)
as referrals_within_50m_60d_mobile_app_origin,
COALESCE(sum(a.referral_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '6 months'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location, 50)
),0)
as referrals_within_50m_6mo,
COALESCE(sum(a.referral_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '6 months'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'web'
and ST_DWithin(cohort.location, a.location, 50)
),0)
as referrals_within_50m_6mo_web_origin,
COALESCE(sum(a.referral_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '6 months'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'phone'
and ST_DWithin(cohort.location, a.location, 50)
),0)
as referrals_within_50m_6mo_phone_origin,
COALESCE(sum(a.referral_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '6 months'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'mobile app'
and ST_DWithin(cohort.location, a.location, 50)
),0)
as referrals_within_50m_6mo_mobile_app_origin,
-- referral 250m features
-- referral-level 250m features
COALESCE(sum(a.referral_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '7 days'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location, 250)
),0)
as referrals_within_250m_7d,
COALESCE(sum(a.referral_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '7 days'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'web'
and ST_DWithin(cohort.location, a.location, 250)
),0)
as referrals_within_250m_7d_web_origin,
COALESCE(sum(a.referral_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '7 days'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'phone'
and ST_DWithin(cohort.location, a.location, 250)
),0)
as referrals_within_250m_7d_phone_origin,
COALESCE(sum(a.referral_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '7 days'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'mobile app'
and ST_DWithin(cohort.location, a.location, 250)
),0)
as referrals_within_250m_7d_mobile_app_origin,
COALESCE(sum(a.referral_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '28 days'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location, 250)
),0)
as referrals_within_250m_28d,
COALESCE(sum(a.referral_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '28 days'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'web'
and ST_DWithin(cohort.location, a.location, 250)
),0)
as referrals_within_250m_28d_web_origin,
COALESCE(sum(a.referral_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '28 days'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'phone'
and ST_DWithin(cohort.location, a.location, 250)
),0)
as referrals_within_250m_28d_phone_origin,
COALESCE(sum(a.referral_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '28 days'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'mobile app'
and ST_DWithin(cohort.location, a.location, 250)
),0)
as referrals_within_250m_28d_mobile_app_origin,
COALESCE(sum(a.referral_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '60 days'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location, 250)
),0)
as referrals_within_250m_60d,
COALESCE(sum(a.referral_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '60 days'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'web'
and ST_DWithin(cohort.location, a.location, 250)
),0)
as referrals_within_250m_60d_web_origin,
COALESCE(sum(a.referral_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '60 days'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'phone'
and ST_DWithin(cohort.location, a.location, 250)
),0)
as referrals_within_250m_60d_phone_origin,
COALESCE(sum(a.referral_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '60 days'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'mobile app'
and ST_DWithin(cohort.location, a.location, 250)
),0)
as referrals_within_250m_60d_mobile_app_origin,
COALESCE(sum(a.referral_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '6 months'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location, 250)
),0)
as referrals_within_250m_6mo,
COALESCE(sum(a.referral_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '6 months'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'web'
and ST_DWithin(cohort.location, a.location, 250)
),0)
as referrals_within_250m_6mo_web_origin,
COALESCE(sum(a.referral_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '6 months'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'phone'
and ST_DWithin(cohort.location, a.location, 250)
),0)
as referrals_within_250m_6mo_phone_origin,
COALESCE(sum(a.referral_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '6 months'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'mobile app'
and ST_DWithin(cohort.location, a.location, 250)
),0)
as referrals_within_250m_6mo_mobile_app_origin,
-- referral-level 1000m features
COALESCE(sum(a.referral_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '7 days'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location, 1000)
),0)
as referrals_within_1000m_7d,
COALESCE(sum(a.referral_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '7 days'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'web'
and ST_DWithin(cohort.location, a.location, 1000)
),0)
as referrals_within_1000m_7d_web_origin,
COALESCE(sum(a.referral_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '7 days'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'phone'
and ST_DWithin(cohort.location, a.location, 1000)
),0)
as referrals_within_1000m_7d_phone_origin,
COALESCE(sum(a.referral_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '7 days'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'mobile app'
and ST_DWithin(cohort.location, a.location, 1000)
),0)
as referrals_within_1000m_7d_mobile_app_origin,
COALESCE(sum(a.referral_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '28 days'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location, 1000)
),0)
as referrals_within_1000m_28d,
COALESCE(sum(a.referral_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '28 days'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'web'
and ST_DWithin(cohort.location, a.location, 1000)
),0)
as referrals_within_1000m_28d_web_origin,
COALESCE(sum(a.referral_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '28 days'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'phone'
and ST_DWithin(cohort.location, a.location, 1000)
),0)
as referrals_within_1000m_28d_phone_origin,
COALESCE(sum(a.referral_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '28 days'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'mobile app'
and ST_DWithin(cohort.location, a.location, 1000)
),0)
as referrals_within_1000m_28d_mobile_app_origin,
COALESCE(sum(a.referral_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '60 days'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location, 1000)
),0)
as referrals_within_1000m_60d,
COALESCE(sum(a.referral_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '60 days'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'web'
and ST_DWithin(cohort.location, a.location, 1000)
),0)
as referrals_within_1000m_60d_web_origin,
COALESCE(sum(a.referral_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '60 days'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'phone'
and ST_DWithin(cohort.location, a.location, 1000)
),0)
as referrals_within_1000m_60d_phone_origin,
COALESCE(sum(a.referral_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '60 days'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'mobile app'
and ST_DWithin(cohort.location, a.location, 1000)
),0)
as referrals_within_1000m_60d_mobile_app_origin,
COALESCE(sum(a.referral_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '6 months'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location, 1000)
),0)
as referrals_within_1000m_6mo,
COALESCE(sum(a.referral_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '6 months'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'web'
and ST_DWithin(cohort.location, a.location, 1000)
),0)
as referrals_within_1000m_6mo_web_origin,
COALESCE(sum(a.referral_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '6 months'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'phone'
and ST_DWithin(cohort.location, a.location, 1000)
),0)
as referrals_within_1000m_6mo_phone_origin,
COALESCE(sum(a.referral_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '6 months'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'mobile app'
and ST_DWithin(cohort.location, a.location, 1000)
),0)
as referrals_within_1000m_6mo_mobile_app_origin,
-- referral-level 5000m features
COALESCE(sum(a.referral_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '7 days'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location, 5000)
),0)
as referrals_within_5000m_7d,
COALESCE(sum(a.referral_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '7 days'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'web'
and ST_DWithin(cohort.location, a.location, 5000)
),0)
as referrals_within_5000m_7d_web_origin,
COALESCE(sum(a.referral_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '7 days'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'phone'
and ST_DWithin(cohort.location, a.location, 5000)
),0)
as referrals_within_5000m_7d_phone_origin,
COALESCE(sum(a.referral_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '7 days'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'mobile app'
and ST_DWithin(cohort.location, a.location, 5000)
),0)
as referrals_within_5000m_7d_mobile_app_origin,
COALESCE(sum(a.referral_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '28 days'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location, 5000)
),0)
as referrals_within_5000m_28d,
COALESCE(sum(a.referral_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '28 days'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'web'
and ST_DWithin(cohort.location, a.location, 5000)
),0)
as referrals_within_5000m_28d_web_origin,
COALESCE(sum(a.referral_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '28 days'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'phone'
and ST_DWithin(cohort.location, a.location, 5000)
),0)
as referrals_within_5000m_28d_phone_origin,
COALESCE(sum(a.referral_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '28 days'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'mobile app'
and ST_DWithin(cohort.location, a.location, 5000)
),0)
as referrals_within_5000m_28d_mobile_app_origin,
COALESCE(sum(a.referral_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '60 days'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location, 5000)
),0)
as referrals_within_5000m_60d,
COALESCE(sum(a.referral_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '60 days'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'web'
and ST_DWithin(cohort.location, a.location, 5000)
),0)
as referrals_within_5000m_60d_web_origin,
COALESCE(sum(a.referral_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '60 days'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'phone'
and ST_DWithin(cohort.location, a.location, 5000)
),0)
as referrals_within_5000m_60d_phone_origin,
COALESCE(sum(a.referral_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '60 days'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'mobile app'
and ST_DWithin(cohort.location, a.location, 5000)
),0)
as referrals_within_5000m_60d_mobile_app_origin,
COALESCE(sum(a.referral_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '6 months'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location, 5000)
),0)
as referrals_within_5000m_6mo,
COALESCE(sum(a.referral_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '6 months'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'web'
and ST_DWithin(cohort.location, a.location, 5000)
),0)
as referrals_within_5000m_6mo_web_origin,
COALESCE(sum(a.referral_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '6 months'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'phone'
and ST_DWithin(cohort.location, a.location, 5000)
),0)
as referrals_within_5000m_6mo_phone_origin,
COALESCE(sum(a.referral_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '6 months'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'mobile app'
and ST_DWithin(cohort.location, a.location, 5000)
),0)
as referrals_within_5000m_6mo_mobile_app_origin,
-- person found-level 50m features
COALESCE(sum(a.person_found_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '7 days'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location, 50)
),0)
as persons_found_within_50m_7d,
COALESCE(sum(a.person_found_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '7 days'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'web'
and ST_DWithin(cohort.location, a.location, 50)
),0)
as persons_found_within_50m_7d_web_origin,
COALESCE(sum(a.person_found_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '7 days'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'phone'
and ST_DWithin(cohort.location, a.location, 50)
),0)
as persons_found_within_50m_7d_phone_origin,
COALESCE(sum(a.person_found_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '7 days'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'mobile app'
and ST_DWithin(cohort.location, a.location, 50)
),0)
as persons_found_within_50m_7d_mobile_app_origin,
COALESCE(sum(a.person_found_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '28 days'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location, 50)
),0)
as persons_found_within_50m_28d,
COALESCE(sum(a.person_found_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '28 days'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'web'
and ST_DWithin(cohort.location, a.location, 50)
),0)
as persons_found_within_50m_28d_web_origin,
COALESCE(sum(a.person_found_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '28 days'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'phone'
and ST_DWithin(cohort.location, a.location, 50)
),0)
as persons_found_within_50m_28d_phone_origin,
COALESCE(sum(a.person_found_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '28 days'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'mobile app'
and ST_DWithin(cohort.location, a.location, 50)
),0)
as persons_found_within_50m_28d_mobile_app_origin,
COALESCE(sum(a.person_found_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '60 days'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location, 50)
),0)
as persons_found_within_50m_60d,
COALESCE(sum(a.person_found_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '60 days'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'web'
and ST_DWithin(cohort.location, a.location, 50)
),0)
as persons_found_within_50m_60d_web_origin,
COALESCE(sum(a.person_found_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '60 days'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'phone'
and ST_DWithin(cohort.location, a.location, 50)
),0)
as persons_found_within_50m_60d_phone_origin,
COALESCE(sum(a.person_found_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '60 days'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'mobile app'
and ST_DWithin(cohort.location, a.location, 50)
),0)
as persons_found_within_50m_60d_mobile_app_origin,
COALESCE(sum(a.person_found_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '6 months'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location, 50)
),0)
as persons_found_within_50m_6mo,
COALESCE(sum(a.person_found_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '6 months'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'web'
and ST_DWithin(cohort.location, a.location, 50)
),0)
as persons_found_within_50m_6mo_web_origin,
COALESCE(sum(a.person_found_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '6 months'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'phone'
and ST_DWithin(cohort.location, a.location, 50)
),0)
as persons_found_within_50m_6mo_phone_origin,
COALESCE(sum(a.person_found_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '6 months'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'mobile app'
and ST_DWithin(cohort.location, a.location, 50)
),0)
as persons_found_within_50m_6mo_mobile_app_origin,
-- person found-level 250m features
-- person found-level 250m features
COALESCE(sum(a.person_found_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '7 days'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location, 250)
),0)
as persons_found_within_250m_7d,
COALESCE(sum(a.person_found_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '7 days'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'web'
and ST_DWithin(cohort.location, a.location, 250)
),0)
as persons_found_within_250m_7d_web_origin,
COALESCE(sum(a.person_found_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '7 days'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'phone'
and ST_DWithin(cohort.location, a.location, 250)
),0)
as persons_found_within_250m_7d_phone_origin,
COALESCE(sum(a.person_found_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '7 days'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'mobile app'
and ST_DWithin(cohort.location, a.location, 250)
),0)
as persons_found_within_250m_7d_mobile_app_origin,
COALESCE(sum(a.person_found_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '28 days'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location, 250)
),0)
as persons_found_within_250m_28d,
COALESCE(sum(a.person_found_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '28 days'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'web'
and ST_DWithin(cohort.location, a.location, 250)
),0)
as persons_found_within_250m_28d_web_origin,
COALESCE(sum(a.person_found_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '28 days'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'phone'
and ST_DWithin(cohort.location, a.location, 250)
),0)
as persons_found_within_250m_28d_phone_origin,
COALESCE(sum(a.person_found_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '28 days'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'mobile app'
and ST_DWithin(cohort.location, a.location, 250)
),0)
as persons_found_within_250m_28d_mobile_app_origin,
COALESCE(sum(a.person_found_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '60 days'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location, 250)
),0)
as persons_found_within_250m_60d,
COALESCE(sum(a.person_found_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '60 days'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'web'
and ST_DWithin(cohort.location, a.location, 250)
),0)
as persons_found_within_250m_60d_web_origin,
COALESCE(sum(a.person_found_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '60 days'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'phone'
and ST_DWithin(cohort.location, a.location, 250)
),0)
as persons_found_within_250m_60d_phone_origin,
COALESCE(sum(a.person_found_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '60 days'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'mobile app'
and ST_DWithin(cohort.location, a.location, 250)
),0)
as persons_found_within_250m_60d_mobile_app_origin,
COALESCE(sum(a.person_found_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '6 months'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location, 250)
),0)
as persons_found_within_250m_6mo,
COALESCE(sum(a.person_found_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '6 months'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'web'
and ST_DWithin(cohort.location, a.location, 250)
),0)
as persons_found_within_250m_6mo_web_origin,
COALESCE(sum(a.person_found_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '6 months'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'phone'
and ST_DWithin(cohort.location, a.location, 250)
),0)
as persons_found_within_250m_6mo_phone_origin,
COALESCE(sum(a.person_found_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '6 months'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'mobile app'
and ST_DWithin(cohort.location, a.location, 250)
),0)
as persons_found_within_250m_6mo_mobile_app_origin,
-- person found 1km features
-- person found-level 1000m features
COALESCE(sum(a.person_found_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '7 days'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location, 1000)
),0)
as persons_found_within_1000m_7d,
COALESCE(sum(a.person_found_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '7 days'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'web'
and ST_DWithin(cohort.location, a.location, 1000)
),0)
as persons_found_within_1000m_7d_web_origin,
COALESCE(sum(a.person_found_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '7 days'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'phone'
and ST_DWithin(cohort.location, a.location, 1000)
),0)
as persons_found_within_1000m_7d_phone_origin,
COALESCE(sum(a.person_found_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '7 days'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'mobile app'
and ST_DWithin(cohort.location, a.location, 1000)
),0)
as persons_found_within_1000m_7d_mobile_app_origin,
COALESCE(sum(a.person_found_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '28 days'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location, 1000)
),0)
as persons_found_within_1000m_28d,
COALESCE(sum(a.person_found_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '28 days'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'web'
and ST_DWithin(cohort.location, a.location, 1000)
),0)
as persons_found_within_1000m_28d_web_origin,
COALESCE(sum(a.person_found_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '28 days'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'phone'
and ST_DWithin(cohort.location, a.location, 1000)
),0)
as persons_found_within_1000m_28d_phone_origin,
COALESCE(sum(a.person_found_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '28 days'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'mobile app'
and ST_DWithin(cohort.location, a.location, 1000)
),0)
as persons_found_within_1000m_28d_mobile_app_origin,
COALESCE(sum(a.person_found_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '60 days'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location, 1000)
),0)
as persons_found_within_1000m_60d,
COALESCE(sum(a.person_found_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '60 days'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'web'
and ST_DWithin(cohort.location, a.location, 1000)
),0)
as persons_found_within_1000m_60d_web_origin,
COALESCE(sum(a.person_found_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '60 days'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'phone'
and ST_DWithin(cohort.location, a.location, 1000)
),0)
as persons_found_within_1000m_60d_phone_origin,
COALESCE(sum(a.person_found_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '60 days'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'mobile app'
and ST_DWithin(cohort.location, a.location, 1000)
),0)
as persons_found_within_1000m_60d_mobile_app_origin,
COALESCE(sum(a.person_found_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '6 months'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location, 1000)
),0)
as persons_found_within_1000m_6mo,
COALESCE(sum(a.person_found_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '6 months'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'web'
and ST_DWithin(cohort.location, a.location, 1000)
),0)
as persons_found_within_1000m_6mo_web_origin,
COALESCE(sum(a.person_found_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '6 months'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'phone'
and ST_DWithin(cohort.location, a.location, 1000)
),0)
as persons_found_within_1000m_6mo_phone_origin,
COALESCE(sum(a.person_found_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '6 months'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'mobile app'
and ST_DWithin(cohort.location, a.location, 1000)
),0)
as persons_found_within_1000m_6mo_mobile_app_origin,
-- person found 5km features
-- person found-level 5000m features
COALESCE(sum(a.person_found_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '7 days'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location, 5000)
),0)
as persons_found_within_5000m_7d,
COALESCE(sum(a.person_found_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '7 days'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'web'
and ST_DWithin(cohort.location, a.location, 5000)
),0)
as persons_found_within_5000m_7d_web_origin,
COALESCE(sum(a.person_found_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '7 days'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'phone'
and ST_DWithin(cohort.location, a.location, 5000)
),0)
as persons_found_within_5000m_7d_phone_origin,
COALESCE(sum(a.person_found_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '7 days'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'mobile app'
and ST_DWithin(cohort.location, a.location, 5000)
),0)
as persons_found_within_5000m_7d_mobile_app_origin,
COALESCE(sum(a.person_found_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '28 days'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location, 5000)
),0)
as persons_found_within_5000m_28d,
COALESCE(sum(a.person_found_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '28 days'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'web'
and ST_DWithin(cohort.location, a.location, 5000)
),0)
as persons_found_within_5000m_28d_web_origin,
COALESCE(sum(a.person_found_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '28 days'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'phone'
and ST_DWithin(cohort.location, a.location, 5000)
),0)
as persons_found_within_5000m_28d_phone_origin,
COALESCE(sum(a.person_found_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '28 days'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'mobile app'
and ST_DWithin(cohort.location, a.location, 5000)
),0)
as persons_found_within_5000m_28d_mobile_app_origin,
COALESCE(sum(a.person_found_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '60 days'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location, 5000)
),0)
as persons_found_within_5000m_60d,
COALESCE(sum(a.person_found_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '60 days'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'web'
and ST_DWithin(cohort.location, a.location, 5000)
),0)
as persons_found_within_5000m_60d_web_origin,
COALESCE(sum(a.person_found_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '60 days'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'phone'
and ST_DWithin(cohort.location, a.location, 5000)
),0)
as persons_found_within_5000m_60d_phone_origin,
COALESCE(sum(a.person_found_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '60 days'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'mobile app'
and ST_DWithin(cohort.location, a.location, 5000)
),0)
as persons_found_within_5000m_60d_mobile_app_origin,
COALESCE(sum(a.person_found_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '6 months'
and a.datetime_opened::date < cohort.aod::date
and ST_DWithin(cohort.location, a.location, 5000)
),0)
as persons_found_within_5000m_6mo,
COALESCE(sum(a.person_found_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '6 months'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'web'
and ST_DWithin(cohort.location, a.location, 5000)
),0)
as persons_found_within_5000m_6mo_web_origin,
COALESCE(sum(a.person_found_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '6 months'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'phone'
and ST_DWithin(cohort.location, a.location, 5000)
),0)
as persons_found_within_5000m_6mo_phone_origin,
COALESCE(sum(a.person_found_flag)
filter (
where a.datetime_opened >= cohort.aod::date - interval '6 months'
and a.datetime_opened::date < cohort.aod::date
and a.alert_origin = 'mobile app'
and ST_DWithin(cohort.location, a.location, 5000)
),0)
as persons_found_within_5000m_6mo_mobile_app_origin
from
(select *, case when outcome_summary like '%person found%' then 1 else 0 end as person_found_flag from semantic.alerts) a
where ST_DWithin(a.location,cohort.location,0)
group by a.location
) as features on true
) b;
CREATE INDEX distance_time_from_alert_alert_ix on features.distance_time_from_alert (alert);
|
CREATE DATABASE IF NOT EXISTS `nstpdb` /*!40100 DEFAULT CHARACTER SET utf8 */;
USE `nstpdb`;
-- MySQL dump 10.13 Distrib 5.7.18, for Linux (x86_64)
--
-- Host: 192.168.10.10 Database: nstpdb
-- ------------------------------------------------------
-- Server version 5.7.17-0ubuntu0.16.04.2
/*!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 `classcodes`
--
DROP TABLE IF EXISTS `classcodes`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `classcodes` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`class_code_desc` varchar(45) NOT NULL,
`instructor_full_name` varchar(45) NOT NULL,
`school_year` varchar(45) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `classcodes`
--
LOCK TABLES `classcodes` WRITE;
/*!40000 ALTER TABLE `classcodes` DISABLE KEYS */;
/*!40000 ALTER TABLE `classcodes` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `events`
--
DROP TABLE IF EXISTS `events`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `events` (
`event_id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(45) DEFAULT NULL,
`school_year` varchar(45) DEFAULT NULL,
PRIMARY KEY (`event_id`) KEY_BLOCK_SIZE=8
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 KEY_BLOCK_SIZE=16;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `events`
--
LOCK TABLES `events` WRITE;
/*!40000 ALTER TABLE `events` DISABLE KEYS */;
INSERT INTO `events` VALUES (1,'Event 1','2015 - 2016'),(2,'Event 2','2016 - 2017');
/*!40000 ALTER TABLE `events` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `studentattendance`
--
DROP TABLE IF EXISTS `studentattendance`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `studentattendance` (
`attendance_id` int(11) NOT NULL AUTO_INCREMENT,
`event_id` int(11) DEFAULT NULL,
`class_code` int(11) DEFAULT NULL,
`student_id` int(11) NOT NULL,
`first_name` varchar(45) NOT NULL,
`course` varchar(45) NOT NULL,
`year` varchar(4) NOT NULL,
PRIMARY KEY (`attendance_id`),
KEY `student_attendance_event_idx` (`event_id`),
KEY `fk_studentattendance_1_idx` (`class_code`),
CONSTRAINT `fk_studentattendance_1` FOREIGN KEY (`class_code`) REFERENCES `classcodes` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `student_attendance_event` FOREIGN KEY (`event_id`) REFERENCES `events` (`event_id`) ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `studentattendance`
--
LOCK TABLES `studentattendance` WRITE;
/*!40000 ALTER TABLE `studentattendance` DISABLE KEYS */;
/*!40000 ALTER TABLE `studentattendance` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `visitorattendance`
--
DROP TABLE IF EXISTS `visitorattendance`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `visitorattendance` (
`attendance_id` int(11) NOT NULL,
`event_id` int(11) DEFAULT NULL,
`full_name` varchar(45) DEFAULT NULL,
`date_attended` date DEFAULT NULL,
PRIMARY KEY (`attendance_id`),
KEY `visitor_attendance_event_idx` (`event_id`),
CONSTRAINT `visitor_attendance_event` FOREIGN KEY (`event_id`) REFERENCES `events` (`event_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `visitorattendance`
--
LOCK TABLES `visitorattendance` WRITE;
/*!40000 ALTER TABLE `visitorattendance` DISABLE KEYS */;
/*!40000 ALTER TABLE `visitorattendance` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2017-07-13 15:45:05
|
SELECT id_departamento, nombre_departamento
FROM unc_esq_peliculas.departamento
WHERE jefe_departamento IS NULL; |
SELECT
--連番
A.SEQ_NO AS SEQ_NO,
--実施日時
A.CREDIT_REPORTS_CREATE_TIME AS RUNDATE ,
--処理ステータスID
A.CREDIT_STATUS AS STATUS_ID ,
--処理ステータス
CODE1.CODE_NAME AS STATUS ,
--ファイルパス
A.CREDIT_REPORTS_FILE_PATH AS FILE_PATH ,
--ファイル名
A.CREDIT_REPORTS_FILE_NAME AS FILE_NAME ,
--備考
A.MEMO AS MEMO,
--更新者
B.USER_NAME AS RUNMAN,
A.BRANCH_CODE,
C.BRANCH_NAME
FROM
-- 会計・経営ファイル作成管理テーブル
ACCOUNTING_REPORTS_CREATE_HISTORY A
--コードマスタ1--処理ステータス
LEFT JOIN CODE_MASTER CODE1
ON
CODE1.CODE_ID = A.CREDIT_STATUS
AND CODE1.CODE_TYPE=CAST(/*dto.sumUpStatus*/ AS CHAR(3))
AND CODE1.COUNTRY_ID=/*dto.countryId*/
LEFT JOIN
-- ユーザーマスタ
LEASE_USER B
ON
-- 会計・経営ファイル作成管理.更新者=ユーザーマスタ.ユーザーID(+)
A.MODIFY_USER = B.USER_ID
LEFT JOIN
BRANCH_MST C
ON
A.BRANCH_CODE = C.BRANCH_CODE
AND C.COUNTRY_ID = /*dto.countryId*/
WHERE
-- 会計・経営ファイル作成管理.帳票ID=ctr0012r01
A.REPORT_ID=CAST(/*dto.selectedReportId*/ AS CHAR(10))
-- 会計・経営ファイル作成管理.実施日時 >= (業務日付 - 画面.履歴表示期間)
AND A.CREDIT_REPORTS_CREATE_TIME >=DATEADD(MONTH, -CAST(/*dto.historySearch*/ AS NUMERIC), /*dtType*/)
/*IF "2".equals(dto.actionFlg)*/
AND A.BRANCH_CODE IN /*dto.aplBranch*/()
/*END*/
ORDER BY
--連番
A.SEQ_NO DESC |
-- phpMyAdmin SQL Dump
-- version 4.1.14
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: Oct 16, 2014 at 04:58 PM
-- Server version: 5.6.17
-- PHP Version: 5.5.12
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
--
-- Database: `ft_database`
--
-- --------------------------------------------------------
--
-- Table structure for table `jeu`
--
CREATE TABLE IF NOT EXISTS `jeu` (
`id_jeu` int(11) NOT NULL AUTO_INCREMENT,
`nom` varchar(255) NOT NULL,
`url_image` varchar(255) NOT NULL,
`studio_developpement` varchar(255) NOT NULL,
`description` varchar(255) NOT NULL,
`avis_ft` varchar(255) NOT NULL,
`site_web` varchar(255) NOT NULL,
PRIMARY KEY (`id_jeu`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `news`
--
CREATE TABLE IF NOT EXISTS `news` (
`id_news` int(11) NOT NULL AUTO_INCREMENT,
`titre` varchar(255) NOT NULL,
`image` varchar(255) NOT NULL,
`synopsis` varchar(500) NOT NULL,
`redacteur` int(11) NOT NULL,
PRIMARY KEY (`id_news`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=6 ;
--
-- Dumping data for table `news`
--
INSERT INTO `news` (`id_news`, `titre`, `image`, `synopsis`, `redacteur`) VALUES
(1, 'L''étoile serait en fait cancérigène, une découverte macabre pour Luigi...', 'news1.jpg', '"Putain de merde !" s''exclame le pauvre Luigi en lisant le journal la veille au matin. Les étoiles sont cancérigènes ? Il en a mangé toute sa vie sans se méfier ! Le jeune homosexuel italien se rue donc rapidement vers l''hôpital le plus proche, la moustache au vent. A peine arrivé, il agresse un médecin pour qu''on lui fasse des analyses. Le lendemain, les résultats tombent. Luigi est condamné... à rester le j2. Pour le reste, ça va. C''est Mario qui bouffe les étoiles. Bien fait pour sa gueule !', 1),
(2, 'Un réseau de drogues démantelé au royaume champignon !!!', 'news2.jpg', 'Envie d''un petit champignon ? Besoin d''un petit pétard ? Hé bien avant hier, il vous fallait contacter un certain "It''s-a-me !" Mario. Mais dorénavant, vous pouvez vous assoir dessus ! Ce criminel a été arrêté par les forces de l''ordre. Le brigadier Bowser raconte : "on a eu un tuyau de son entourage, quelqu''un de proche, vous savez ?". A ce moment même, on aperçoit la princesse Peach en tenue de cuir qui sort de la chambre du brigadier. "Attend pupuce, j''arrive..."', 1),
(3, 'Bob l''éponge trouvé ivre mort dans une orgie d''un carrefour parisien...', 'news3.png', 'Cest avec étonnement que Joséphine, caissière depuis maintenant 56 ans à carrefour, découvre en arrivant au travail un Bob l''éponge ivre mort : "Je nai pas compris tout de suite ce qu''il se passait... Il était là, par terre, imbibé d''alcool, entourée d''une vingtaine d''autres éponges, complètement nues. Il y avait du produit vaisselle partout !". La caissière, traumatisée à vie, ainsi que son employeur, ont décidé de porter plainte. Le jugement aura lieu au tribunal de Bikini Bottom.', 1),
(4, 'Ceci est le titre de la news 4 donc tranquille pète un coup', 'news4.jpg', '"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."', 1),
(5, 'Ceci est le titre de la news 5 donc tranquille pète un coup', 'news5.jpg', '"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."', 1);
-- --------------------------------------------------------
--
-- Table structure for table `personnage`
--
CREATE TABLE IF NOT EXISTS `personnage` (
`id_personnage` int(11) NOT NULL AUTO_INCREMENT,
`pseudo` varchar(255) NOT NULL,
`niveau` varchar(255) NOT NULL,
`id_serveur` varchar(255) NOT NULL,
PRIMARY KEY (`id_personnage`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `user`
--
CREATE TABLE IF NOT EXISTS `user` (
`id_user` int(11) NOT NULL AUTO_INCREMENT,
`mail` varchar(255) NOT NULL,
`nom` varchar(255) NOT NULL,
`prenom` varchar(255) NOT NULL,
`pseudo` varchar(255) NOT NULL,
`motdepasse` varchar(20) NOT NULL,
PRIMARY KEY (`id_user`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;
--
-- Dumping data for table `user`
--
INSERT INTO `user` (`id_user`, `mail`, `nom`, `prenom`, `pseudo`, `motdepasse`) VALUES
(1, 'florian.chassot@gmail.com', 'Chassot', 'Florian', 'Millambeur', '123456');
-- --------------------------------------------------------
--
-- Table structure for table `youtube`
--
CREATE TABLE IF NOT EXISTS `youtube` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`nom` varchar(40) CHARACTER SET utf8 NOT NULL COMMENT 'nom de la video',
`lien` text CHARACTER SET utf8 NOT NULL COMMENT 'lien de la video',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='Table permettant de stocker les différents lien de vidéo youtube' AUTO_INCREMENT=2 ;
--
-- Dumping data for table `youtube`
--
INSERT INTO `youtube` (`id`, `nom`, `lien`) VALUES
(1, 'Video de test', '//www.youtube.com/embed/DcJFdCmN98s');
/*!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 */;
|
-- MySQL dump 10.13 Distrib 5.7.17, for macos10.12 (x86_64)
--
-- Host: 127.0.0.1 Database: ecommerce
-- ------------------------------------------------------
-- Server version 5.7.17
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `compra`
--
DROP TABLE IF EXISTS `compra`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `compra` (
`idcompra` int(11) NOT NULL AUTO_INCREMENT,
`idpessoa` varchar(45) NOT NULL,
`idproduto` varchar(45) NOT NULL,
`status` varchar(45) DEFAULT NULL,
`data` datetime DEFAULT NULL,
PRIMARY KEY (`idcompra`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `compra`
--
LOCK TABLES `compra` WRITE;
/*!40000 ALTER TABLE `compra` DISABLE KEYS */;
INSERT INTO `compra` VALUES (4,'14','18','Analise','2017-05-02 00:00:00'),(5,'14','9','Analise','2017-05-02 10:04:17'),(6,'14','10','Analise','2017-05-02 10:04:17'),(7,'14','9','Analise','2017-05-02 11:32:14'),(8,'18','11','Analise','2017-05-02 12:34:01'),(9,'18','11','Analise','2017-05-13 09:10:44');
/*!40000 ALTER TABLE `compra` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2017-05-24 8:37:39
|
/* Usuários e permissões de acesso */
/* Criação de Usuários */
/*
CREATE USER especificação_de_usuario [, especificação_de_usuario] ...
especificação_de_usuario:
user [IDENTIFIED BY [PASSWORD] 'senha']
user:
'nome_do_usuario'@'nome_do_servidor'
*/
CREATE USER 'denilson'@'localhost' IDENTIFIED BY '0192';
/* Exclusão de usuários */
DROP USER 'denilson'@'localhost';
/* Permissões de acesso */
/* Concessão de permissão */
/*
GRANT
priv_type [(column_list)]
[, priv_type [(column_list)]] ...
ON [object_type] priv_level
TO user_specification [, user_specification] ...
[REQUIRE {NONE | ssl_option [[AND] ssl_option] ...}]
[WITH with_option ...]
object_type:
TABLE
| FUNCTION
| PROCEDURE
priv_level:
*
| *.*
| db_name.*
| db_name.tbl_name
| tbl_name
| db_name.routine_name
user_specification:
user [IDENTIFIED BY [PASSWORD] 'password']
ssl_option:
SSL
| X509
| CIPHER 'cipher'
| ISSUER 'issuer'
| SUBJECT 'subject'
with_option:
GRANT OPTION
| MAX_QUERIES_PER_HOUR count
| MAX_UPDATES_PER_HOUR count
| MAX_CONNECTIONS_PER_HOUR count
| MAX_USER_CONNECTIONS count
*/
-- Concede ao usuário 'denilson' em 'localhost' todos os privilégios à tabela Funcionario
GRANT ALL ON Empresa.Funcionario TO 'denilson'@'localhost';
-- Concede ao usuário 'denilson' em 'localhost' o direito de executar SELECT e INSERT na tabela Departamento
GRANT SELECT, INSERT ON Empresa.Departamento TO 'denilson'@'localhost';
-- Concede ao usuário 'denilson' em 'localhost' o direito de alterar a coluna 'NomeDepto' na table Departamento
GRANT UPDATE (nomeDepto) ON Empresa.Departamento TO 'denilson'@'localhost';
/* Revogação de permissão */
/*
REVOKE
priv_type [(column_list)]
[, priv_type [(column_list)]] ...
ON [object_type] priv_level
FROM user [, user] ...
REVOKE ALL PRIVILEGES, GRANT OPTION
FROM user [, user] ...
*/
-- Revoga, do usuário 'denilson' em 'localhost', o direito de alterar a coluna 'NomeDepto' na table Departamento.
REVOKE UPDATE (nomeDepto) ON Empresa.Departamento FROM 'denilson'@'localhost';
-- Revoga, do usuário 'denilson' em 'localhost', todos os privilégios sobre tabela Funcionario
REVOKE ALL ON Empresa.Funcionario FROM 'denilson'@'localhost';
-- Mais informações: http://dev.mysql.com/doc/refman/5.0/en/grant.html#grant-privileges
|
SELECT IIF(s.Grade < 8, "NULL", s.Name), s.Grade, s.Marks
FROM (SELECT Students.*,CASE WHEN Marks BETWEEN 0 AND 9 THEN 1
WHEN Marks BETWEEN 10 AND 19 THEN 2
WHEN Marks BETWEEN 20 AND 29 THEN 3
WHEN Marks BETWEEN 30 AND 39 THEN 4
WHEN Marks BETWEEN 40 AND 49 THEN 5
WHEN Marks BETWEEN 50 AND 59 THEN 6
WHEN Marks BETWEEN 60 AND 69 THEN 7
WHEN Marks BETWEEN 70 AND 79 THEN 8
WHEN Marks BETWEEN 80 AND 89 THEN 9
WHEN Marks BETWEEN 90 AND 100 THEN 10
END AS Grade
FROM Students) AS s
ORDER BY Grade DESC, Name ASC; |
DROP TABLE IF EXISTS `mctable`;
CREATE TABLE `mctable`
(
`ID` int(10) NOT NULL AUTO_INCREMENT,
`m_tinyint` tinyint(4) DEFAULT NULL,
`m_smallint` smallint(5) unsigned DEFAULT NULL,
`m_int` int(10) unsigned DEFAULT NULL,
`m_bigint` bigint(20) unsigned DEFAULT NULL,
`m_double` char(255) DEFAULT NULL,
`m_char5` char(5) DEFAULT NULL,
`m_varchar5` varchar(5) DEFAULT NULL,
`m_text` text DEFAULT NULL,
`m_datetime` datetime DEFAULT NULL,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
CREATE TABLE
`id_status_users` (
`id_status` INT NOT NULL AUTO_INCREMENT,
`status_name` VARCHAR(20),
PRIMARY KEY (`id_status`)
);
CREATE TABLE
`users` (
`id` INT NOT NULL AUTO_INCREMENT,
`phone_users` CHAR(10) NOT NULL,
`password` VARCHAR(40) NOT NULL,
`sms_pas` VARCHAR(10) NOT NULL,
`id_status_users` TINYINT NOT NULL,
`name_user` VARCHAR(25),
`family_users` VARCHAR(30),
`date_birthday` DATE,
`email_users` VARCHAR(50),
`referal_from` VARCHAR(20),
`referal_My` VARCHAR(20),
FOREIGN KEY (id_status_users) REFERENCES `id_status_users`(id_status),
PRIMARY KEY(`id`)
); |
INSERT INTO endpoint(ep, d, base) VALUES
(
'EP',
'D',
'BASE'
);
INSERT INTO resource(path, ct, rt, if, anchor, endpoint) VALUES
(
'coap://local-proxy-old.example.com:5683/sensors/temp',
41,
'temperature',
'',
'coap://spurious.example.com:5683',
1
),
(
'coap://local-proxy-old.example.com:5683/sensors/light',
41,
'light-lux',
'sensor',
'coap://spurious.example.com:5683',
1
);
|
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL';
DROP SCHEMA IF EXISTS `${artifactId}`;
CREATE SCHEMA `${artifactId}`;
USE `${artifactId}`;
--
-- Table structure for table `user`
--
CREATE TABLE user (
user_id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
first_name VARCHAR(50) NOT NULL,
last_name VARCHAR(50) NOT NULL,
username VARCHAR(150) NOT NULL UNIQUE,
password VARCHAR(32) NOT NULL,
email VARCHAR(255) DEFAULT NULL UNIQUE,
picture LONGBLOB DEFAULT NULL,
active BOOLEAN NOT NULL DEFAULT TRUE,
password_expired BOOLEAN NOT NULL DEFAULT TRUE,
last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (user_id)
)ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Table structure for table `role`
--
CREATE TABLE role (
role_id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
name VARCHAR(64) NOT NULL,
description TEXT DEFAULT NULL,
last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (role_id)
)ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Table structure for table `user_role`
--
CREATE TABLE user_role (
user_id BIGINT UNSIGNED NOT NULL,
role_id BIGINT UNSIGNED NOT NULL,
last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (user_id , role_id),
CONSTRAINT user_role_user FOREIGN KEY (user_id) REFERENCES user (user_id) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT user_role_role FOREIGN KEY (role_id) REFERENCES role (role_id) ON DELETE CASCADE ON UPDATE CASCADE
)ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Administration User for the schema `${artifactId}`
--
DROP USER IF EXISTS '${artifactId}'@'localhost';
CREATE USER '${artifactId}'@'localhost' IDENTIFIED BY '${artifactId}' PASSWORD EXPIRE NEVER;
GRANT ALL ON `${artifactId}`.* TO '${artifactId}'@'localhost';
GRANT SELECT, INSERT ON `${artifactId}`.* TO '${artifactId}'@'localhost';
SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS; |
PROMPT
SET ECHO ON
SELECT * FROM SEDZIA_INFO;
SET ECHO OFF
PROMPT |
/*
SQLyog Community v11.24 (32 bit)
MySQL - 5.6.21 : Database - klinik
*********************************************************************
*/
/*!40101 SET NAMES utf8 */;
/*!40101 SET SQL_MODE=''*/;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
CREATE DATABASE /*!32312 IF NOT EXISTS*/`klinik` /*!40100 DEFAULT CHARACTER SET latin1 */;
USE `klinik`;
/*Table structure for table `beli` */
DROP TABLE IF EXISTS `beli`;
CREATE TABLE `beli` (
`id_beli` int(10) unsigned NOT NULL AUTO_INCREMENT,
`id_obat` int(10) unsigned DEFAULT NULL,
`tgltrans` date DEFAULT NULL,
`no_faktur` varchar(32) DEFAULT NULL,
`distributor` varchar(32) DEFAULT NULL,
`jlh_beli` int(10) DEFAULT NULL,
PRIMARY KEY (`id_beli`),
KEY `id_obat` (`id_obat`),
CONSTRAINT `beli_ibfk_1` FOREIGN KEY (`id_obat`) REFERENCES `obat` (`id_obat`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=30 DEFAULT CHARSET=latin1;
/*Data for the table `beli` */
/*Table structure for table `jual` */
DROP TABLE IF EXISTS `jual`;
CREATE TABLE `jual` (
`id_jual` int(10) unsigned NOT NULL AUTO_INCREMENT,
`tgltrans` date DEFAULT NULL,
`no_resep` varchar(32) DEFAULT NULL,
`distributor` varchar(32) DEFAULT NULL,
`no_batch` varchar(32) DEFAULT NULL,
`ed` varchar(32) DEFAULT NULL,
PRIMARY KEY (`id_jual`)
) ENGINE=InnoDB AUTO_INCREMENT=116 DEFAULT CHARSET=latin1;
/*Data for the table `jual` */
/*Table structure for table `kartu_bersalin` */
DROP TABLE IF EXISTS `kartu_bersalin`;
CREATE TABLE `kartu_bersalin` (
`id_kartu_bersalin` int(10) unsigned NOT NULL AUTO_INCREMENT,
`id_pasien` int(10) unsigned DEFAULT NULL,
PRIMARY KEY (`id_kartu_bersalin`),
KEY `id_pasien` (`id_pasien`),
CONSTRAINT `kartu_bersalin_ibfk_1` FOREIGN KEY (`id_pasien`) REFERENCES `pasien` (`id_pasien`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=latin1;
/*Data for the table `kartu_bersalin` */
/*Table structure for table `kartu_rawat_inap` */
DROP TABLE IF EXISTS `kartu_rawat_inap`;
CREATE TABLE `kartu_rawat_inap` (
`id_kri` int(10) unsigned NOT NULL AUTO_INCREMENT,
`id_pasien` int(10) unsigned DEFAULT NULL,
PRIMARY KEY (`id_kri`),
KEY `id_pasien` (`id_pasien`),
CONSTRAINT `kartu_rawat_inap_ibfk_1` FOREIGN KEY (`id_pasien`) REFERENCES `pasien` (`id_pasien`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=latin1;
/*Data for the table `kartu_rawat_inap` */
/*Table structure for table `kartu_rawat_umum` */
DROP TABLE IF EXISTS `kartu_rawat_umum`;
CREATE TABLE `kartu_rawat_umum` (
`id_kru` int(10) unsigned NOT NULL AUTO_INCREMENT,
`id_pasien` int(10) unsigned DEFAULT NULL,
PRIMARY KEY (`id_kru`),
KEY `id_pasien` (`id_pasien`),
CONSTRAINT `kartu_rawat_umum_ibfk_1` FOREIGN KEY (`id_pasien`) REFERENCES `pasien` (`id_pasien`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=latin1;
/*Data for the table `kartu_rawat_umum` */
/*Table structure for table `kartu_usg` */
DROP TABLE IF EXISTS `kartu_usg`;
CREATE TABLE `kartu_usg` (
`id_kartu_usg` int(10) unsigned NOT NULL AUTO_INCREMENT,
`id_pasien` int(10) unsigned DEFAULT NULL,
PRIMARY KEY (`id_kartu_usg`),
KEY `id_pasien` (`id_pasien`),
CONSTRAINT `kartu_usg_ibfk_1` FOREIGN KEY (`id_pasien`) REFERENCES `pasien` (`id_pasien`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=36 DEFAULT CHARSET=latin1;
/*Data for the table `kartu_usg` */
/*Table structure for table `laporan` */
DROP TABLE IF EXISTS `laporan`;
CREATE TABLE `laporan` (
`id_laporan` int(10) NOT NULL AUTO_INCREMENT,
`tgl` date DEFAULT NULL,
`keterangan` varchar(30) DEFAULT NULL,
`masuk` int(30) DEFAULT NULL,
`keluar` int(30) DEFAULT NULL,
`sisa` int(30) DEFAULT NULL,
`untung` int(30) DEFAULT NULL,
`id_obat` int(10) unsigned DEFAULT NULL,
PRIMARY KEY (`id_laporan`),
KEY `id_obat` (`id_obat`),
CONSTRAINT `laporan_obat_ibfk_1` FOREIGN KEY (`id_obat`) REFERENCES `obat` (`id_obat`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=140 DEFAULT CHARSET=latin1;
/*Data for the table `laporan` */
/*Table structure for table `list_penjualan` */
DROP TABLE IF EXISTS `list_penjualan`;
CREATE TABLE `list_penjualan` (
`id_list_penjualan` int(10) unsigned NOT NULL AUTO_INCREMENT,
`nama_obat` varchar(25) DEFAULT NULL,
`qty` int(10) DEFAULT NULL,
`harga_satuan` int(10) DEFAULT NULL,
`total` int(10) DEFAULT NULL,
`id_jual` int(10) unsigned DEFAULT NULL,
`id_obat` int(10) unsigned DEFAULT NULL,
PRIMARY KEY (`id_list_penjualan`),
KEY `id_jual` (`id_jual`),
KEY `id_obat` (`id_obat`),
CONSTRAINT `list_penjualan_ibfk_1` FOREIGN KEY (`id_jual`) REFERENCES `jual` (`id_jual`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `list_penjualan_ibfk_2` FOREIGN KEY (`id_obat`) REFERENCES `obat` (`id_obat`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=33 DEFAULT CHARSET=latin1;
/*Data for the table `list_penjualan` */
/*Table structure for table `obat` */
DROP TABLE IF EXISTS `obat`;
CREATE TABLE `obat` (
`id_obat` int(10) unsigned NOT NULL AUTO_INCREMENT,
`nama` varchar(32) DEFAULT NULL,
`jumlah` int(10) unsigned DEFAULT NULL,
`hargabeli` int(10) unsigned DEFAULT NULL,
`hargajual` int(10) unsigned DEFAULT NULL,
`tgl_kadaluarsa` date DEFAULT NULL,
`satuan_brg` enum('Botol','Tube','Kotak','Strip','Biji','Kapsul','Kg','Mg') DEFAULT NULL,
PRIMARY KEY (`id_obat`)
) ENGINE=InnoDB AUTO_INCREMENT=20 DEFAULT CHARSET=latin1;
/*Data for the table `obat` */
/*Table structure for table `pasien` */
DROP TABLE IF EXISTS `pasien`;
CREATE TABLE `pasien` (
`id_pasien` int(10) unsigned NOT NULL AUTO_INCREMENT,
`nama` varchar(32) DEFAULT NULL,
`tanggal_lahir` date NOT NULL,
`alamat` varchar(32) DEFAULT NULL,
`pekerjaan` varchar(32) DEFAULT NULL,
`jenis_kelamin` enum('Perempuan','Laki - Laki') DEFAULT NULL,
`suku` varchar(32) DEFAULT NULL,
`agama` enum('Kristen Protestan','Islam','Katolik','Hindu/Budha') DEFAULT NULL,
`tel` varchar(32) DEFAULT NULL,
PRIMARY KEY (`id_pasien`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=latin1;
/*Data for the table `pasien` */
/*Table structure for table `suplier` */
DROP TABLE IF EXISTS `suplier`;
CREATE TABLE `suplier` (
`id_suplier` int(10) unsigned NOT NULL AUTO_INCREMENT,
`nama_supplier` varchar(32) DEFAULT NULL,
`alamat` varchar(32) DEFAULT NULL,
`no_tel` varchar(32) DEFAULT NULL,
PRIMARY KEY (`id_suplier`),
KEY `id_suplier` (`id_suplier`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;
/*Data for the table `suplier` */
/*Table structure for table `tbersalin` */
DROP TABLE IF EXISTS `tbersalin`;
CREATE TABLE `tbersalin` (
`id_bersalin` int(10) unsigned NOT NULL AUTO_INCREMENT,
`id_kartu_bersalin` int(10) unsigned NOT NULL,
`tgl` date DEFAULT NULL,
`keterangan` text,
PRIMARY KEY (`id_bersalin`),
KEY `id_kartu_bersalin` (`id_kartu_bersalin`),
CONSTRAINT `tbersalin_ibfk_1` FOREIGN KEY (`id_kartu_bersalin`) REFERENCES `kartu_bersalin` (`id_kartu_bersalin`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=32 DEFAULT CHARSET=latin1;
/*Data for the table `tbersalin` */
/*Table structure for table `trawat_inap` */
DROP TABLE IF EXISTS `trawat_inap`;
CREATE TABLE `trawat_inap` (
`id_rawat_inap` int(10) unsigned NOT NULL AUTO_INCREMENT,
`id_kri` int(10) unsigned NOT NULL,
`tgl` date DEFAULT NULL,
`keterangan` text,
PRIMARY KEY (`id_rawat_inap`),
KEY `id_kri` (`id_kri`),
CONSTRAINT `trawat_inap_ibfk_1` FOREIGN KEY (`id_kri`) REFERENCES `kartu_rawat_inap` (`id_kri`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=36 DEFAULT CHARSET=latin1;
/*Data for the table `trawat_inap` */
/*Table structure for table `trawat_umum` */
DROP TABLE IF EXISTS `trawat_umum`;
CREATE TABLE `trawat_umum` (
`id_rawatumum` int(10) unsigned NOT NULL AUTO_INCREMENT,
`id_kru` int(10) unsigned NOT NULL,
`tgl` date DEFAULT NULL,
`historia_morbi` text,
`terapi` text,
PRIMARY KEY (`id_rawatumum`),
KEY `id_kru` (`id_kru`),
CONSTRAINT `trawat_umum_ibfk_1` FOREIGN KEY (`id_kru`) REFERENCES `kartu_rawat_umum` (`id_kru`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=latin1;
/*Data for the table `trawat_umum` */
/*Table structure for table `tusg` */
DROP TABLE IF EXISTS `tusg`;
CREATE TABLE `tusg` (
`id_usg` int(10) unsigned NOT NULL AUTO_INCREMENT,
`id_kartu_usg` int(10) unsigned DEFAULT NULL,
`nama_suami` varchar(32) DEFAULT NULL,
`grafida` varchar(32) DEFAULT NULL,
`hpht` varchar(32) DEFAULT NULL,
`ttp` varchar(32) DEFAULT NULL,
`td_bb` varchar(32) DEFAULT NULL,
`keluhan` text,
`usia_kehaliman` varchar(32) DEFAULT NULL,
`terapi` text,
`keterangan` text,
`tgl` date DEFAULT NULL,
PRIMARY KEY (`id_usg`),
KEY `id_kartu_usg` (`id_kartu_usg`),
CONSTRAINT `tusg_ibfk_1` FOREIGN KEY (`id_kartu_usg`) REFERENCES `kartu_usg` (`id_kartu_usg`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=44 DEFAULT CHARSET=latin1;
/*Data for the table `tusg` */
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
BEGIN TRANSACTION;
-- Bob
-- • Find the users who have checked in more than 10 locations every day in the last week.
SELECT DISTINCT person_id
--, datepart(DAY, checkin_time) AS Day, COUNT(location_id) AS count
FROM CheckInOut
WHERE checkin_time <= GETDATE() AND checkin_time >= dateadd(DAY, -7, GETDATE())
GROUP BY person_id, datepart(DAY, checkin_time)
HAVING COUNT(location_id) > 10
;
-- • Find all the couples such that each couple has checked in at least 2 common locations on 1 Jan 2021.
SELECT person1_id, person2_id
FROM Family, CheckInOut AS C1, CheckInOut AS C2
WHERE relation_type = 'Married' AND CONVERT(DATE, C1.checkin_time) = '2021-01-01' AND CONVERT(DATE, C2.checkin_time) = '2021-01-01' AND Family.person1_id = C1.person_id AND Family.person2_id = C2.person_id AND C1.location_id = C2.location_id
GROUP BY person1_id, person2_id
HAVING COUNT(*) > 1
;
COMMIT; |
CREATE TABLE statistic_archive
(
player_id CHARACTER(32) NOT NULL,
statistic VARCHAR(32) NOT NULL,
value INTEGER NOT NULL,
date VARCHAR(32) NOT NULL,
PRIMARY KEY (player_id, statistic, date)
);
|
create database salomon_1401;
grant all privileges on salomon_1401.* to 'salomon'@'localhost';
flush privileges;
|
--
-- PostgreSQL database dump
--
-- Dumped from database version 12.6
-- Dumped by pg_dump version 12.6
-- Started on 2021-04-27 17:43:48
--
-- TOC entry 2848 (class 0 OID 33770)
-- Dependencies: 212
-- Data for Name: bill; Type: TABLE DATA; Schema: public; Owner: postgres
--
INSERT INTO public.bill VALUES (1001, '2020-08-12', 715.52, 3, '891-60-9531', 542);
INSERT INTO public.bill VALUES (1002, '2020-12-17', 154.27, 18, '895-33-6350', 698);
INSERT INTO public.bill VALUES (1003, '2020-11-03', 534.04, 44, '308-45-9846', 438);
INSERT INTO public.bill VALUES (1004, '2020-03-24', 330.93, 27, '700-33-5604', 682);
INSERT INTO public.bill VALUES (1005, '2020-11-24', 202.91, 13, '420-30-9321', 680);
INSERT INTO public.bill VALUES (1006, '2021-02-12', 194.80, 37, '106-87-8320', 607);
INSERT INTO public.bill VALUES (1007, '2020-11-16', 657.71, 15, '821-63-1866', 759);
INSERT INTO public.bill VALUES (1008, '2020-12-04', 362.79, 30, '130-04-2954', 756);
INSERT INTO public.bill VALUES (1009, '2020-05-12', 109.47, 48, '859-70-2679', 463);
INSERT INTO public.bill VALUES (1010, '2020-11-05', 887.79, 48, '617-60-3835', 605);
INSERT INTO public.bill VALUES (1011, '2020-06-17', 958.01, 41, '894-22-1683', 551);
INSERT INTO public.bill VALUES (1012, '2020-10-22', 779.21, 18, '373-06-5551', 710);
INSERT INTO public.bill VALUES (1013, '2020-05-29', 517.00, 20, '311-97-8133', 736);
INSERT INTO public.bill VALUES (1014, '2021-02-08', 844.25, 38, '324-95-9280', 784);
INSERT INTO public.bill VALUES (1015, '2020-07-03', 416.33, 31, '261-64-7553', 722);
INSERT INTO public.bill VALUES (1016, '2021-02-10', 116.81, 7, '423-41-8286', 766);
INSERT INTO public.bill VALUES (1017, '2020-04-06', 387.22, 15, '524-98-3141', 721);
INSERT INTO public.bill VALUES (1018, '2020-06-12', 654.78, 37, '827-11-8484', 694);
INSERT INTO public.bill VALUES (1019, '2021-02-19', 271.27, 40, '769-09-1796', 450);
INSERT INTO public.bill VALUES (1020, '2021-02-20', 998.39, 9, '406-21-7190', 658);
INSERT INTO public.bill VALUES (1021, '2020-12-12', 407.13, 25, '387-15-1222', 435);
INSERT INTO public.bill VALUES (1022, '2020-12-27', 36.67, 8, '197-04-8723', 403);
INSERT INTO public.bill VALUES (1023, '2020-09-09', 55.11, 46, '135-96-9835', 660);
INSERT INTO public.bill VALUES (1024, '2021-01-05', 155.32, 2, '331-21-5399', 619);
INSERT INTO public.bill VALUES (1025, '2020-08-26', 990.55, 31, '111-14-7325', 670);
INSERT INTO public.bill VALUES (1026, '2020-06-03', 181.38, 39, '855-06-7121', 652);
INSERT INTO public.bill VALUES (1027, '2020-05-09', 37.08, 10, '306-92-1963', 465);
INSERT INTO public.bill VALUES (1028, '2020-06-14', 889.20, 4, '279-12-9632', 599);
INSERT INTO public.bill VALUES (1029, '2020-04-03', 254.65, 44, '627-48-3358', 514);
INSERT INTO public.bill VALUES (1030, '2020-04-16', 642.59, 23, '674-97-2426', 495);
INSERT INTO public.bill VALUES (1031, '2021-02-02', 792.33, 16, '537-31-8239', 592);
INSERT INTO public.bill VALUES (1032, '2021-01-31', 73.81, 17, '528-95-2018', 578);
INSERT INTO public.bill VALUES (1033, '2020-05-06', 964.39, 37, '341-69-3046', 727);
INSERT INTO public.bill VALUES (1034, '2020-07-25', 678.56, 8, '253-07-6690', 625);
INSERT INTO public.bill VALUES (1035, '2020-04-29', 832.31, 42, '339-70-7797', 750);
INSERT INTO public.bill VALUES (1036, '2020-07-29', 749.40, 34, '438-48-3707', 779);
INSERT INTO public.bill VALUES (1037, '2020-11-28', 402.47, 25, '746-28-4579', 475);
INSERT INTO public.bill VALUES (1038, '2020-07-13', 461.53, 8, '804-18-7034', 691);
INSERT INTO public.bill VALUES (1039, '2021-02-04', 169.36, 17, '313-67-5744', 587);
INSERT INTO public.bill VALUES (1040, '2020-06-15', 783.24, 44, '741-64-9442', 561);
INSERT INTO public.bill VALUES (1041, '2020-05-15', 405.34, 14, '855-06-7121', 452);
INSERT INTO public.bill VALUES (1042, '2021-02-10', 907.35, 13, '802-24-3883', 421);
INSERT INTO public.bill VALUES (1043, '2020-12-17', 82.73, 28, '634-13-9626', 427);
INSERT INTO public.bill VALUES (1044, '2020-09-14', 73.79, 5, '483-89-9065', 688);
INSERT INTO public.bill VALUES (1045, '2020-04-05', 908.11, 39, '305-23-7157', 726);
INSERT INTO public.bill VALUES (1046, '2021-01-29', 137.24, 11, '638-35-7002', 540);
INSERT INTO public.bill VALUES (1047, '2020-09-19', 920.70, 26, '718-37-1802', 624);
INSERT INTO public.bill VALUES (1048, '2020-12-19', 394.51, 9, '297-02-3365', 648);
INSERT INTO public.bill VALUES (1049, '2021-02-12', 91.88, 28, '581-24-5493', 519);
INSERT INTO public.bill VALUES (1050, '2020-09-15', 982.79, 10, '361-06-7035', 583);
INSERT INTO public.bill VALUES (1051, '2021-01-02', 209.30, 48, '285-70-8122', 493);
INSERT INTO public.bill VALUES (1052, '2021-01-27', 326.01, 20, '591-24-3906', 683);
INSERT INTO public.bill VALUES (1053, '2020-03-22', 807.47, 38, '194-42-6806', 517);
INSERT INTO public.bill VALUES (1054, '2020-06-19', 818.44, 41, '524-98-3141', 521);
INSERT INTO public.bill VALUES (1055, '2020-08-21', 31.55, 47, '781-79-6386', 570);
INSERT INTO public.bill VALUES (1056, '2021-02-24', 348.27, 25, '737-50-7454', 692);
INSERT INTO public.bill VALUES (1057, '2020-03-27', 267.18, 1, '114-68-9844', 617);
INSERT INTO public.bill VALUES (1058, '2020-10-29', 880.94, 45, '865-52-4622', 767);
INSERT INTO public.bill VALUES (1059, '2020-09-06', 452.45, 16, '317-07-7984', 533);
INSERT INTO public.bill VALUES (1060, '2020-04-18', 584.15, 15, '406-21-7190', 458);
INSERT INTO public.bill VALUES (1061, '2021-02-02', 597.48, 2, '691-47-3831', 701);
INSERT INTO public.bill VALUES (1062, '2020-12-21', 826.35, 45, '741-64-9442', 761);
INSERT INTO public.bill VALUES (1063, '2020-10-29', 343.36, 4, '893-57-6313', 406);
INSERT INTO public.bill VALUES (1064, '2021-02-03', 959.45, 47, '830-07-9619', 598);
INSERT INTO public.bill VALUES (1065, '2020-07-20', 556.43, 16, '607-26-8450', 657);
INSERT INTO public.bill VALUES (1066, '2020-11-10', 193.87, 36, '693-28-5127', 555);
INSERT INTO public.bill VALUES (1067, '2021-01-17', 531.72, 16, '582-86-4934', 588);
INSERT INTO public.bill VALUES (1068, '2020-12-24', 482.60, 13, '197-04-8723', 603);
INSERT INTO public.bill VALUES (1069, '2020-10-13', 144.54, 11, '167-57-3236', 777);
INSERT INTO public.bill VALUES (1070, '2020-03-29', 691.29, 25, '638-35-7002', 740);
INSERT INTO public.bill VALUES (1071, '2020-10-18', 280.01, 49, '160-64-9216', 538);
INSERT INTO public.bill VALUES (1072, '2020-03-25', 740.30, 21, '711-84-1767', 466);
INSERT INTO public.bill VALUES (1073, '2020-04-14', 197.66, 16, '525-84-3768', 518);
INSERT INTO public.bill VALUES (1074, '2020-10-27', 852.14, 46, '831-82-4898', 499);
INSERT INTO public.bill VALUES (1075, '2020-11-11', 61.24, 5, '777-92-6773', 539);
INSERT INTO public.bill VALUES (1076, '2020-12-18', 860.55, 39, '122-51-3962', 502);
INSERT INTO public.bill VALUES (1077, '2021-01-26', 812.20, 28, '831-82-4898', 699);
INSERT INTO public.bill VALUES (1078, '2020-06-21', 616.19, 17, '135-96-9835', 460);
INSERT INTO public.bill VALUES (1079, '2020-07-08', 41.96, 25, '423-41-8286', 566);
INSERT INTO public.bill VALUES (1080, '2020-03-16', 492.21, 20, '489-97-8536', 728);
INSERT INTO public.bill VALUES (1081, '2020-07-14', 551.20, 18, '106-87-8320', 407);
INSERT INTO public.bill VALUES (1082, '2020-07-19', 48.95, 26, '171-82-5490', 412);
INSERT INTO public.bill VALUES (1083, '2020-12-22', 534.05, 12, '431-49-6049', 753);
INSERT INTO public.bill VALUES (1084, '2020-05-29', 531.13, 6, '146-10-1440', 651);
INSERT INTO public.bill VALUES (1085, '2020-07-01', 328.02, 16, '330-29-1479', 418);
INSERT INTO public.bill VALUES (1086, '2020-07-26', 96.24, 35, '535-64-4181', 668);
INSERT INTO public.bill VALUES (1087, '2020-07-20', 21.79, 47, '315-97-9802', 611);
INSERT INTO public.bill VALUES (1088, '2020-11-27', 142.64, 33, '278-10-6456', 453);
INSERT INTO public.bill VALUES (1089, '2020-11-26', 28.58, 35, '828-18-9959', 640);
INSERT INTO public.bill VALUES (1090, '2020-07-23', 818.33, 4, '335-66-4286', 709);
INSERT INTO public.bill VALUES (1091, '2020-09-22', 636.10, 34, '792-63-5889', 800);
INSERT INTO public.bill VALUES (1092, '2020-03-20', 676.14, 10, '796-32-1291', 780);
INSERT INTO public.bill VALUES (1093, '2020-10-11', 246.52, 12, '342-97-1760', 757);
INSERT INTO public.bill VALUES (1094, '2020-09-06', 757.85, 17, '279-12-9632', 799);
INSERT INTO public.bill VALUES (1095, '2021-03-11', 422.93, 14, '416-10-1678', 597);
INSERT INTO public.bill VALUES (1096, '2020-08-12', 137.54, 21, '422-77-1425', 416);
INSERT INTO public.bill VALUES (1097, '2020-04-18', 194.34, 35, '442-19-9751', 456);
INSERT INTO public.bill VALUES (1098, '2020-12-10', 261.67, 28, '417-89-3625', 769);
INSERT INTO public.bill VALUES (1099, '2020-12-01', 119.54, 25, '171-68-9165', 420);
INSERT INTO public.bill VALUES (1100, '2020-04-03', 25.86, 39, '891-60-9531', 742);
INSERT INTO public.bill VALUES (1101, '2020-04-08', 488.01, 27, '171-82-5490', 612);
INSERT INTO public.bill VALUES (1102, '2020-04-09', 504.51, 12, '718-37-1802', 424);
INSERT INTO public.bill VALUES (1103, '2020-07-23', 10.11, 45, '282-29-0172', 541);
INSERT INTO public.bill VALUES (1104, '2020-11-18', 402.46, 3, '167-57-3236', 577);
INSERT INTO public.bill VALUES (1105, '2020-04-29', 820.58, 33, '502-46-8681', 484);
INSERT INTO public.bill VALUES (1106, '2020-11-08', 472.34, 31, '269-80-6183', 433);
INSERT INTO public.bill VALUES (1107, '2020-08-13', 951.47, 3, '284-76-6973', 455);
INSERT INTO public.bill VALUES (1108, '2020-07-29', 963.43, 9, '785-43-4078', 476);
INSERT INTO public.bill VALUES (1109, '2020-06-22', 417.58, 2, '497-19-9946', 593);
INSERT INTO public.bill VALUES (1110, '2020-12-08', 270.07, 3, '456-99-8949', 402);
INSERT INTO public.bill VALUES (1111, '2020-07-31', 914.90, 48, '190-38-7627', 790);
INSERT INTO public.bill VALUES (1112, '2021-02-14', 459.24, 35, '850-48-5054', 535);
INSERT INTO public.bill VALUES (1113, '2020-08-15', 445.78, 25, '497-19-9946', 793);
INSERT INTO public.bill VALUES (1114, '2020-07-14', 284.35, 12, '324-57-9038', 552);
INSERT INTO public.bill VALUES (1115, '2021-03-12', 764.67, 29, '688-63-6921', 704);
INSERT INTO public.bill VALUES (1116, '2020-06-20', 60.03, 16, '339-70-7797', 550);
INSERT INTO public.bill VALUES (1117, '2020-05-26', 624.73, 10, '792-63-5889', 600);
INSERT INTO public.bill VALUES (1118, '2021-03-10', 773.27, 12, '872-40-1702', 608);
INSERT INTO public.bill VALUES (1119, '2021-02-05', 667.40, 48, '387-15-1222', 635);
INSERT INTO public.bill VALUES (1120, '2021-01-04', 609.19, 48, '746-28-4579', 675);
INSERT INTO public.bill VALUES (1121, '2020-10-15', 312.40, 16, '831-34-7615', 749);
INSERT INTO public.bill VALUES (1122, '2020-05-05', 228.79, 42, '844-10-6433', 604);
INSERT INTO public.bill VALUES (1123, '2020-07-04', 491.78, 6, '540-72-9092', 520);
INSERT INTO public.bill VALUES (1124, '2020-08-05', 696.75, 24, '175-86-9910', 544);
INSERT INTO public.bill VALUES (1125, '2021-01-25', 466.02, 5, '456-99-8949', 602);
INSERT INTO public.bill VALUES (1126, '2020-10-21', 655.74, 2, '669-75-7839', 516);
INSERT INTO public.bill VALUES (1127, '2020-12-08', 299.96, 43, '596-81-2155', 596);
INSERT INTO public.bill VALUES (1128, '2021-01-07', 317.27, 50, '332-86-5913', 439);
INSERT INTO public.bill VALUES (1129, '2020-11-08', 399.19, 15, '613-91-4963', 474);
INSERT INTO public.bill VALUES (1130, '2020-03-23', 941.22, 1, '130-54-3954', 422);
INSERT INTO public.bill VALUES (1131, '2020-11-08', 175.59, 31, '239-85-2599', 481);
INSERT INTO public.bill VALUES (1132, '2020-10-21', 154.93, 43, '238-78-7869', 441);
INSERT INTO public.bill VALUES (1133, '2021-02-11', 144.80, 18, '706-53-2012', 573);
INSERT INTO public.bill VALUES (1134, '2021-01-16', 170.57, 41, '269-44-1204', 429);
INSERT INTO public.bill VALUES (1135, '2020-05-15', 911.98, 33, '441-15-0611', 462);
INSERT INTO public.bill VALUES (1136, '2020-10-02', 316.04, 10, '121-66-5829', 461);
INSERT INTO public.bill VALUES (1137, '2020-07-26', 67.57, 25, '853-23-7610', 724);
INSERT INTO public.bill VALUES (1138, '2020-08-03', 289.12, 44, '333-70-2735', 487);
INSERT INTO public.bill VALUES (1139, '2020-09-06', 209.98, 24, '885-53-8761', 585);
INSERT INTO public.bill VALUES (1140, '2021-02-17', 289.92, 16, '407-35-3767', 442);
INSERT INTO public.bill VALUES (1141, '2020-04-10', 742.00, 15, '233-77-1145', 706);
INSERT INTO public.bill VALUES (1142, '2020-08-15', 783.03, 39, '850-48-5054', 735);
INSERT INTO public.bill VALUES (1143, '2020-11-30', 60.39, 36, '634-21-4907', 525);
INSERT INTO public.bill VALUES (1144, '2020-10-22', 462.49, 2, '690-36-5703', 646);
INSERT INTO public.bill VALUES (1145, '2020-04-07', 630.58, 29, '608-92-6531', 763);
INSERT INTO public.bill VALUES (1146, '2020-04-02', 280.45, 40, '252-31-7038', 565);
INSERT INTO public.bill VALUES (1147, '2020-10-26', 473.24, 44, '777-40-5753', 732);
INSERT INTO public.bill VALUES (1148, '2020-08-04', 666.35, 15, '114-60-6562', 705);
INSERT INTO public.bill VALUES (1149, '2020-04-26', 856.30, 31, '708-10-1729', 669);
INSERT INTO public.bill VALUES (1150, '2020-11-10', 274.76, 5, '121-66-5829', 661);
INSERT INTO public.bill VALUES (1151, '2020-04-05', 832.66, 17, '531-32-9679', 630);
INSERT INTO public.bill VALUES (1152, '2021-02-22', 640.41, 9, '844-10-6433', 404);
INSERT INTO public.bill VALUES (1153, '2020-06-03', 85.44, 32, '342-97-1760', 557);
INSERT INTO public.bill VALUES (1154, '2020-04-09', 677.68, 50, '827-74-6194', 708);
INSERT INTO public.bill VALUES (1155, '2020-04-25', 379.76, 39, '476-84-8190', 581);
INSERT INTO public.bill VALUES (1156, '2020-04-13', 264.28, 24, '591-24-3906', 483);
INSERT INTO public.bill VALUES (1157, '2021-01-04', 205.20, 49, '421-99-4032', 546);
INSERT INTO public.bill VALUES (1158, '2021-02-26', 364.00, 16, '324-95-9280', 584);
INSERT INTO public.bill VALUES (1159, '2020-08-10', 616.18, 13, '463-56-0367', 743);
INSERT INTO public.bill VALUES (1160, '2020-08-06', 264.31, 23, '442-89-4276', 654);
INSERT INTO public.bill VALUES (1161, '2020-11-24', 439.30, 38, '238-78-7869', 641);
INSERT INTO public.bill VALUES (1162, '2020-06-13', 369.75, 37, '407-35-3767', 642);
INSERT INTO public.bill VALUES (1163, '2020-07-04', 114.72, 21, '123-72-8856', 511);
INSERT INTO public.bill VALUES (1164, '2020-04-30', 741.69, 11, '621-16-2830', 513);
INSERT INTO public.bill VALUES (1165, '2020-05-15', 895.36, 40, '781-28-8216', 789);
INSERT INTO public.bill VALUES (1166, '2021-02-15', 889.43, 18, '112-92-8786', 496);
INSERT INTO public.bill VALUES (1167, '2020-05-12', 463.93, 3, '130-84-7136', 445);
INSERT INTO public.bill VALUES (1168, '2020-04-25', 38.60, 20, '463-56-0367', 543);
INSERT INTO public.bill VALUES (1169, '2021-02-10', 710.13, 7, '804-18-7034', 491);
INSERT INTO public.bill VALUES (1170, '2020-06-11', 261.42, 4, '161-64-6552', 729);
INSERT INTO public.bill VALUES (1171, '2020-10-18', 889.03, 47, '800-82-8019', 530);
INSERT INTO public.bill VALUES (1172, '2020-05-30', 39.00, 49, '730-21-1798', 667);
INSERT INTO public.bill VALUES (1173, '2020-04-13', 999.87, 6, '279-63-2455', 703);
INSERT INTO public.bill VALUES (1174, '2020-10-22', 701.02, 16, '830-55-1805', 500);
INSERT INTO public.bill VALUES (1175, '2020-10-11', 826.34, 32, '898-94-2029', 673);
INSERT INTO public.bill VALUES (1176, '2021-02-04', 260.94, 27, '894-04-6573', 786);
INSERT INTO public.bill VALUES (1177, '2021-02-17', 77.82, 20, '297-31-5935', 554);
INSERT INTO public.bill VALUES (1178, '2020-06-07', 237.56, 18, '731-48-0865', 609);
INSERT INTO public.bill VALUES (1179, '2020-07-24', 604.55, 12, '499-16-2726', 697);
INSERT INTO public.bill VALUES (1180, '2020-12-03', 61.25, 47, '269-80-6183', 633);
INSERT INTO public.bill VALUES (1181, '2020-08-29', 653.35, 12, '501-47-2330', 431);
INSERT INTO public.bill VALUES (1182, '2021-01-07', 963.63, 24, '466-92-4188', 659);
INSERT INTO public.bill VALUES (1183, '2020-10-19', 489.43, 40, '485-26-5862', 595);
INSERT INTO public.bill VALUES (1184, '2020-12-28', 235.34, 22, '535-64-4181', 468);
INSERT INTO public.bill VALUES (1185, '2020-06-17', 460.31, 44, '130-84-7136', 645);
INSERT INTO public.bill VALUES (1186, '2020-08-12', 999.84, 6, '112-92-8786', 696);
INSERT INTO public.bill VALUES (1187, '2020-06-28', 752.64, 47, '258-25-3270', 428);
INSERT INTO public.bill VALUES (1188, '2020-05-15', 588.59, 1, '588-65-6257', 512);
INSERT INTO public.bill VALUES (1189, '2020-05-27', 371.16, 31, '844-98-1873', 747);
INSERT INTO public.bill VALUES (1190, '2020-06-26', 487.52, 31, '476-84-8190', 781);
INSERT INTO public.bill VALUES (1191, '2020-06-06', 249.58, 4, '830-07-9619', 798);
INSERT INTO public.bill VALUES (1192, '2020-04-29', 776.06, 22, '311-97-8133', 536);
INSERT INTO public.bill VALUES (1193, '2021-01-19', 477.50, 11, '537-62-9080', 564);
INSERT INTO public.bill VALUES (1194, '2020-07-10', 724.28, 5, '766-98-2531', 775);
INSERT INTO public.bill VALUES (1195, '2020-12-03', 242.59, 49, '297-26-6079', 594);
INSERT INTO public.bill VALUES (1196, '2021-01-25', 430.64, 5, '520-48-8620', 464);
INSERT INTO public.bill VALUES (1197, '2020-05-09', 607.38, 46, '297-02-3365', 448);
INSERT INTO public.bill VALUES (1198, '2020-10-14', 715.44, 27, '815-94-3494', 686);
INSERT INTO public.bill VALUES (1199, '2020-08-28', 689.17, 50, '194-42-6806', 717);
INSERT INTO public.bill VALUES (1200, '2020-06-11', 94.90, 24, '717-16-6306', 636);
INSERT INTO public.bill VALUES (1201, '2020-10-16', 375.02, 25, '169-71-4896', 610);
INSERT INTO public.bill VALUES (1202, '2020-11-09', 86.75, 11, '749-68-8658', 760);
INSERT INTO public.bill VALUES (1203, '2020-07-16', 530.44, 30, '349-29-4069', 426);
INSERT INTO public.bill VALUES (1204, '2021-02-14', 658.60, 44, '502-88-5986', 758);
INSERT INTO public.bill VALUES (1205, '2020-03-17', 301.78, 3, '448-68-1388', 615);
INSERT INTO public.bill VALUES (1206, '2020-05-10', 825.63, 22, '537-31-8239', 792);
INSERT INTO public.bill VALUES (1207, '2020-04-24', 436.33, 31, '378-01-7884', 423);
INSERT INTO public.bill VALUES (1208, '2020-08-06', 596.37, 19, '279-63-2455', 503);
INSERT INTO public.bill VALUES (1209, '2021-02-08', 402.61, 37, '421-99-4032', 746);
INSERT INTO public.bill VALUES (1210, '2020-08-31', 178.29, 43, '416-10-1678', 797);
INSERT INTO public.bill VALUES (1211, '2021-03-06', 256.07, 14, '828-18-9959', 440);
INSERT INTO public.bill VALUES (1212, '2020-10-12', 953.68, 18, '258-25-3270', 628);
INSERT INTO public.bill VALUES (1213, '2020-08-03', 917.58, 37, '885-53-8761', 785);
INSERT INTO public.bill VALUES (1214, '2020-03-30', 762.90, 13, '175-86-9910', 744);
INSERT INTO public.bill VALUES (1215, '2021-02-27', 943.88, 24, '636-11-0395', 613);
INSERT INTO public.bill VALUES (1216, '2020-09-08', 216.81, 29, '420-50-9400', 582);
INSERT INTO public.bill VALUES (1217, '2021-01-26', 741.94, 41, '409-61-9170', 576);
INSERT INTO public.bill VALUES (1218, '2020-10-23', 568.16, 39, '785-43-4078', 676);
INSERT INTO public.bill VALUES (1219, '2021-01-17', 441.20, 32, '146-10-1440', 451);
INSERT INTO public.bill VALUES (1220, '2020-11-08', 558.15, 39, '894-66-0320', 414);
INSERT INTO public.bill VALUES (1221, '2020-03-15', 695.39, 33, '431-49-6049', 553);
INSERT INTO public.bill VALUES (1222, '2020-12-18', 431.83, 18, '665-45-1087', 637);
INSERT INTO public.bill VALUES (1223, '2020-10-22', 976.52, 6, '822-80-6004', 562);
INSERT INTO public.bill VALUES (1224, '2020-08-12', 791.63, 36, '772-02-5384', 489);
INSERT INTO public.bill VALUES (1225, '2020-07-16', 425.15, 13, '894-64-5232', 678);
INSERT INTO public.bill VALUES (1226, '2020-08-06', 604.98, 43, '649-73-5632', 523);
INSERT INTO public.bill VALUES (1227, '2020-04-15', 699.00, 42, '429-87-7955', 731);
INSERT INTO public.bill VALUES (1228, '2021-03-04', 860.54, 10, '430-34-5471', 574);
INSERT INTO public.bill VALUES (1229, '2020-05-28', 68.96, 12, '621-16-2830', 713);
INSERT INTO public.bill VALUES (1230, '2020-11-30', 350.18, 2, '252-31-7038', 765);
INSERT INTO public.bill VALUES (1231, '2020-06-29', 692.00, 6, '502-88-5986', 558);
INSERT INTO public.bill VALUES (1232, '2020-10-08', 966.37, 36, '464-67-0081', 449);
INSERT INTO public.bill VALUES (1233, '2020-04-02', 532.28, 19, '872-40-1702', 408);
INSERT INTO public.bill VALUES (1234, '2020-09-24', 847.75, 5, '261-64-7553', 522);
INSERT INTO public.bill VALUES (1235, '2020-03-28', 224.28, 50, '531-09-6549', 591);
INSERT INTO public.bill VALUES (1236, '2020-08-23', 853.17, 6, '730-21-1798', 467);
INSERT INTO public.bill VALUES (1237, '2020-06-17', 153.62, 5, '747-46-0365', 479);
INSERT INTO public.bill VALUES (1238, '2020-11-13', 570.10, 49, '662-61-4662', 643);
INSERT INTO public.bill VALUES (1239, '2020-07-14', 654.75, 6, '282-29-0172', 741);
INSERT INTO public.bill VALUES (1240, '2020-04-01', 391.08, 42, '122-51-3962', 702);
INSERT INTO public.bill VALUES (1241, '2020-08-19', 282.56, 10, '596-81-2155', 796);
INSERT INTO public.bill VALUES (1242, '2020-07-19', 213.77, 15, '830-55-1805', 700);
INSERT INTO public.bill VALUES (1243, '2021-03-04', 122.15, 9, '522-81-5796', 632);
INSERT INTO public.bill VALUES (1244, '2020-11-16', 359.33, 47, '114-60-6562', 505);
INSERT INTO public.bill VALUES (1245, '2020-09-06', 824.43, 27, '286-49-0067', 444);
INSERT INTO public.bill VALUES (1246, '2020-07-29', 25.31, 20, '749-68-8658', 560);
INSERT INTO public.bill VALUES (1247, '2020-11-09', 511.86, 23, '317-07-7984', 733);
INSERT INTO public.bill VALUES (1248, '2020-05-25', 535.59, 12, '171-68-9165', 620);
INSERT INTO public.bill VALUES (1249, '2020-11-04', 77.65, 30, '827-74-6194', 508);
INSERT INTO public.bill VALUES (1250, '2020-08-18', 933.23, 28, '161-64-6552', 529);
INSERT INTO public.bill VALUES (1251, '2020-07-22', 867.89, 8, '308-45-9846', 638);
INSERT INTO public.bill VALUES (1252, '2021-01-22', 543.20, 19, '485-26-5862', 795);
INSERT INTO public.bill VALUES (1253, '2020-08-22', 891.64, 32, '781-28-8216', 589);
INSERT INTO public.bill VALUES (1254, '2020-04-01', 201.15, 33, '636-11-0395', 413);
INSERT INTO public.bill VALUES (1255, '2021-02-26', 144.52, 20, '651-98-1227', 672);
INSERT INTO public.bill VALUES (1256, '2020-05-07', 381.62, 45, '345-42-2198', 647);
INSERT INTO public.bill VALUES (1257, '2020-10-28', 255.21, 21, '577-26-5611', 671);
INSERT INTO public.bill VALUES (1258, '2020-04-13', 632.77, 42, '406-68-9330', 548);
INSERT INTO public.bill VALUES (1259, '2020-05-04', 11.58, 17, '800-82-8019', 730);
INSERT INTO public.bill VALUES (1260, '2020-06-29', 376.58, 24, '442-89-4276', 454);
INSERT INTO public.bill VALUES (1261, '2020-11-04', 344.12, 46, '613-91-4963', 674);
INSERT INTO public.bill VALUES (1262, '2020-12-25', 862.98, 13, '528-95-2018', 778);
INSERT INTO public.bill VALUES (1263, '2020-08-30', 28.77, 3, '627-48-3358', 714);
INSERT INTO public.bill VALUES (1264, '2020-12-10', 114.35, 13, '361-06-7035', 783);
INSERT INTO public.bill VALUES (1265, '2020-06-18', 131.41, 4, '781-79-6386', 770);
INSERT INTO public.bill VALUES (1266, '2020-06-16', 128.05, 9, '582-86-4934', 788);
INSERT INTO public.bill VALUES (1267, '2021-03-05', 111.45, 5, '898-94-2029', 473);
INSERT INTO public.bill VALUES (1268, '2020-06-07', 229.91, 35, '335-66-4286', 509);
INSERT INTO public.bill VALUES (1269, '2020-10-27', 512.51, 34, '747-46-0365', 679);
INSERT INTO public.bill VALUES (1270, '2020-09-04', 746.58, 14, '634-13-9626', 627);
INSERT INTO public.bill VALUES (1271, '2020-10-17', 947.77, 31, '214-45-5502', 534);
INSERT INTO public.bill VALUES (1272, '2021-02-26', 127.75, 35, '865-52-4622', 567);
INSERT INTO public.bill VALUES (1273, '2020-08-24', 601.01, 35, '448-68-1388', 415);
INSERT INTO public.bill VALUES (1274, '2020-08-27', 256.69, 50, '651-98-1227', 472);
INSERT INTO public.bill VALUES (1275, '2021-03-03', 148.09, 13, '269-44-1204', 629);
INSERT INTO public.bill VALUES (1276, '2020-10-22', 208.70, 40, '324-57-9038', 752);
INSERT INTO public.bill VALUES (1277, '2020-08-06', 143.95, 30, '847-33-0183', 715);
INSERT INTO public.bill VALUES (1278, '2020-06-13', 775.41, 38, '522-81-5796', 432);
INSERT INTO public.bill VALUES (1279, '2020-07-09', 782.49, 36, '297-26-6079', 794);
INSERT INTO public.bill VALUES (1280, '2020-06-04', 965.19, 17, '674-97-2426', 695);
INSERT INTO public.bill VALUES (1281, '2020-07-13', 657.62, 45, '284-76-6973', 655);
INSERT INTO public.bill VALUES (1282, '2020-08-04', 15.32, 21, '442-19-9751', 656);
INSERT INTO public.bill VALUES (1283, '2020-05-20', 829.35, 21, '891-07-7591', 507);
INSERT INTO public.bill VALUES (1284, '2020-03-16', 918.42, 43, '315-97-9802', 411);
INSERT INTO public.bill VALUES (1285, '2020-08-09', 320.48, 6, '544-19-8618', 572);
INSERT INTO public.bill VALUES (1286, '2020-09-27', 331.22, 36, '769-09-1796', 650);
INSERT INTO public.bill VALUES (1287, '2020-06-21', 413.47, 1, '406-68-9330', 748);
INSERT INTO public.bill VALUES (1288, '2020-10-14', 700.77, 45, '649-73-5632', 723);
INSERT INTO public.bill VALUES (1289, '2020-05-04', 277.57, 27, '690-36-5703', 446);
INSERT INTO public.bill VALUES (1290, '2021-01-12', 150.75, 41, '693-28-5127', 755);
INSERT INTO public.bill VALUES (1291, '2020-06-13', 278.79, 47, '430-34-5471', 774);
INSERT INTO public.bill VALUES (1292, '2021-01-06', 667.34, 9, '821-63-1866', 559);
INSERT INTO public.bill VALUES (1293, '2020-10-14', 466.04, 44, '444-25-8716', 571);
INSERT INTO public.bill VALUES (1294, '2020-12-05', 921.77, 41, '214-45-5502', 734);
INSERT INTO public.bill VALUES (1295, '2021-02-06', 335.92, 8, '483-89-9065', 488);
INSERT INTO public.bill VALUES (1296, '2020-11-09', 855.12, 48, '330-29-1479', 618);
INSERT INTO public.bill VALUES (1297, '2021-02-16', 26.89, 33, '422-77-1425', 616);
INSERT INTO public.bill VALUES (1298, '2020-03-15', 927.65, 3, '802-24-3883', 621);
INSERT INTO public.bill VALUES (1299, '2020-06-18', 618.26, 42, '341-69-3046', 527);
INSERT INTO public.bill VALUES (1300, '2020-09-13', 998.77, 43, '893-57-6313', 606);
INSERT INTO public.bill VALUES (1301, '2020-05-10', 344.24, 13, '772-02-5384', 689);
INSERT INTO public.bill VALUES (1302, '2020-05-01', 936.52, 38, '577-26-5611', 471);
INSERT INTO public.bill VALUES (1303, '2020-09-22', 404.04, 32, '891-07-7591', 707);
INSERT INTO public.bill VALUES (1304, '2020-12-11', 855.64, 28, '502-46-8681', 684);
INSERT INTO public.bill VALUES (1305, '2020-12-30', 147.31, 12, '669-75-7839', 716);
INSERT INTO public.bill VALUES (1306, '2020-10-30', 517.66, 23, '622-62-2062', 537);
INSERT INTO public.bill VALUES (1307, '2020-08-07', 977.00, 26, '894-04-6573', 586);
INSERT INTO public.bill VALUES (1308, '2020-07-07', 236.06, 27, '815-94-3494', 486);
INSERT INTO public.bill VALUES (1309, '2020-09-17', 15.53, 27, '525-84-3768', 718);
INSERT INTO public.bill VALUES (1310, '2020-11-23', 299.44, 18, '844-98-1873', 547);
INSERT INTO public.bill VALUES (1311, '2020-04-03', 122.70, 40, '581-24-5493', 719);
INSERT INTO public.bill VALUES (1312, '2020-08-06', 365.47, 15, '771-78-9747', 401);
INSERT INTO public.bill VALUES (1313, '2020-11-10', 284.53, 37, '540-72-9092', 720);
INSERT INTO public.bill VALUES (1314, '2020-04-05', 256.01, 35, '607-26-8450', 457);
INSERT INTO public.bill VALUES (1315, '2020-12-12', 502.20, 42, '253-07-6690', 425);
INSERT INTO public.bill VALUES (1316, '2020-08-25', 490.67, 1, '420-30-9321', 480);
INSERT INTO public.bill VALUES (1317, '2020-08-09', 165.97, 32, '285-70-8122', 693);
INSERT INTO public.bill VALUES (1318, '2020-07-11', 496.72, 1, '169-71-4896', 410);
INSERT INTO public.bill VALUES (1319, '2020-05-12', 588.55, 28, '566-46-0543', 677);
INSERT INTO public.bill VALUES (1320, '2020-10-26', 543.04, 29, '537-62-9080', 764);
INSERT INTO public.bill VALUES (1321, '2021-01-14', 515.92, 27, '822-80-6004', 762);
INSERT INTO public.bill VALUES (1322, '2020-09-01', 50.57, 43, '297-31-5935', 754);
INSERT INTO public.bill VALUES (1323, '2021-02-03', 460.94, 39, '708-10-1729', 469);
INSERT INTO public.bill VALUES (1324, '2020-05-19', 889.99, 9, '895-33-6350', 498);
INSERT INTO public.bill VALUES (1325, '2020-10-20', 703.90, 46, '566-46-0543', 477);
INSERT INTO public.bill VALUES (1326, '2020-04-25', 288.53, 2, '501-47-2330', 631);
INSERT INTO public.bill VALUES (1327, '2020-03-19', 557.69, 32, '742-40-3860', 545);
INSERT INTO public.bill VALUES (1328, '2020-05-16', 301.09, 4, '777-40-5753', 532);
INSERT INTO public.bill VALUES (1329, '2020-07-27', 957.29, 39, '239-85-2599', 681);
INSERT INTO public.bill VALUES (1330, '2020-08-10', 791.10, 39, '706-53-2012', 773);
INSERT INTO public.bill VALUES (1331, '2020-04-11', 93.20, 10, '845-83-0191', 434);
INSERT INTO public.bill VALUES (1332, '2021-02-06', 431.90, 48, '499-16-2726', 497);
INSERT INTO public.bill VALUES (1333, '2021-01-26', 702.10, 23, '800-86-8968', 485);
INSERT INTO public.bill VALUES (1334, '2020-04-24', 757.56, 31, '617-60-3835', 405);
INSERT INTO public.bill VALUES (1335, '2021-01-13', 617.70, 45, '464-67-0081', 649);
INSERT INTO public.bill VALUES (1336, '2020-10-29', 823.69, 8, '286-49-0067', 644);
INSERT INTO public.bill VALUES (1337, '2020-07-07', 672.81, 42, '531-09-6549', 791);
INSERT INTO public.bill VALUES (1338, '2021-01-04', 107.30, 11, '305-23-7157', 526);
INSERT INTO public.bill VALUES (1339, '2021-01-23', 250.74, 27, '190-38-7627', 590);
INSERT INTO public.bill VALUES (1340, '2021-01-16', 15.05, 15, '742-40-3860', 745);
INSERT INTO public.bill VALUES (1341, '2020-11-18', 154.02, 14, '438-48-3707', 579);
INSERT INTO public.bill VALUES (1342, '2020-09-04', 46.21, 3, '531-32-9679', 430);
INSERT INTO public.bill VALUES (1343, '2021-01-29', 893.06, 47, '831-34-7615', 549);
INSERT INTO public.bill VALUES (1344, '2020-05-22', 507.59, 6, '711-84-1767', 666);
INSERT INTO public.bill VALUES (1345, '2020-11-11', 584.06, 27, '489-97-8536', 528);
INSERT INTO public.bill VALUES (1346, '2020-10-19', 244.73, 2, '688-63-6921', 504);
INSERT INTO public.bill VALUES (1347, '2020-06-08', 848.01, 7, '894-22-1683', 751);
INSERT INTO public.bill VALUES (1348, '2020-09-30', 522.68, 19, '304-42-2033', 768);
INSERT INTO public.bill VALUES (1349, '2020-08-11', 458.28, 36, '429-87-7955', 531);
INSERT INTO public.bill VALUES (1350, '2021-03-03', 221.45, 49, '345-42-2198', 447);
INSERT INTO public.bill VALUES (1351, '2020-09-30', 897.22, 42, '444-25-8716', 771);
INSERT INTO public.bill VALUES (1352, '2020-11-12', 650.89, 44, '662-61-4662', 443);
INSERT INTO public.bill VALUES (1353, '2020-11-25', 92.96, 44, '544-19-8618', 772);
INSERT INTO public.bill VALUES (1354, '2020-11-17', 170.15, 40, '827-11-8484', 494);
INSERT INTO public.bill VALUES (1355, '2020-09-16', 88.67, 31, '378-01-7884', 623);
INSERT INTO public.bill VALUES (1356, '2021-02-18', 290.80, 39, '518-31-3273', 690);
INSERT INTO public.bill VALUES (1357, '2020-06-11', 636.37, 15, '114-68-9844', 417);
INSERT INTO public.bill VALUES (1358, '2020-10-29', 13.25, 43, '420-50-9400', 782);
INSERT INTO public.bill VALUES (1359, '2021-01-27', 510.99, 40, '691-47-3831', 501);
INSERT INTO public.bill VALUES (1360, '2020-07-24', 136.66, 18, '331-21-5399', 419);
INSERT INTO public.bill VALUES (1361, '2020-09-26', 26.15, 39, '717-16-6306', 436);
INSERT INTO public.bill VALUES (1362, '2020-10-07', 878.97, 35, '894-66-0320', 614);
INSERT INTO public.bill VALUES (1363, '2021-01-28', 654.86, 9, '588-65-6257', 712);
INSERT INTO public.bill VALUES (1364, '2020-07-10', 147.37, 27, '123-72-8856', 711);
INSERT INTO public.bill VALUES (1365, '2020-07-17', 915.15, 2, '700-33-5604', 482);
INSERT INTO public.bill VALUES (1366, '2020-04-21', 561.60, 44, '313-67-5744', 787);
INSERT INTO public.bill VALUES (1367, '2021-03-01', 34.14, 38, '847-33-0183', 515);
INSERT INTO public.bill VALUES (1368, '2020-10-21', 587.04, 7, '441-15-0611', 662);
INSERT INTO public.bill VALUES (1369, '2020-05-17', 348.43, 14, '731-48-0865', 409);
INSERT INTO public.bill VALUES (1370, '2020-06-17', 241.03, 23, '894-64-5232', 478);
INSERT INTO public.bill VALUES (1371, '2020-07-31', 501.80, 22, '373-06-5551', 510);
INSERT INTO public.bill VALUES (1372, '2020-09-10', 897.65, 30, '466-92-4188', 459);
INSERT INTO public.bill VALUES (1373, '2020-08-20', 266.81, 27, '233-77-1145', 506);
INSERT INTO public.bill VALUES (1374, '2020-05-09', 365.93, 24, '417-89-3625', 569);
INSERT INTO public.bill VALUES (1375, '2021-02-10', 504.56, 38, '518-31-3273', 490);
INSERT INTO public.bill VALUES (1376, '2020-12-29', 539.85, 46, '771-78-9747', 601);
INSERT INTO public.bill VALUES (1377, '2020-12-18', 733.21, 23, '665-45-1087', 437);
INSERT INTO public.bill VALUES (1378, '2021-03-09', 47.81, 21, '608-92-6531', 563);
INSERT INTO public.bill VALUES (1379, '2020-03-20', 311.12, 15, '160-64-9216', 738);
INSERT INTO public.bill VALUES (1380, '2021-01-21', 402.67, 41, '304-42-2033', 568);
INSERT INTO public.bill VALUES (1381, '2020-12-27', 72.03, 48, '777-92-6773', 739);
INSERT INTO public.bill VALUES (1382, '2021-02-10', 483.17, 28, '130-54-3954', 622);
INSERT INTO public.bill VALUES (1383, '2021-03-07', 74.41, 49, '634-21-4907', 725);
INSERT INTO public.bill VALUES (1384, '2020-08-20', 272.05, 30, '409-61-9170', 776);
INSERT INTO public.bill VALUES (1385, '2020-10-05', 547.91, 26, '111-14-7325', 470);
INSERT INTO public.bill VALUES (1386, '2020-10-11', 740.18, 9, '332-86-5913', 639);
INSERT INTO public.bill VALUES (1387, '2021-01-14', 490.93, 5, '306-92-1963', 665);
INSERT INTO public.bill VALUES (1388, '2021-03-11', 103.58, 30, '349-29-4069', 626);
INSERT INTO public.bill VALUES (1389, '2020-08-22', 700.25, 5, '278-10-6456', 653);
INSERT INTO public.bill VALUES (1390, '2020-04-24', 289.39, 45, '520-48-8620', 664);
INSERT INTO public.bill VALUES (1391, '2020-07-16', 373.27, 32, '853-23-7610', 524);
INSERT INTO public.bill VALUES (1392, '2020-06-05', 880.97, 17, '800-86-8968', 685);
INSERT INTO public.bill VALUES (1393, '2020-04-27', 70.55, 23, '859-70-2679', 663);
INSERT INTO public.bill VALUES (1394, '2020-10-11', 175.20, 29, '333-70-2735', 687);
INSERT INTO public.bill VALUES (1395, '2020-07-02', 232.61, 46, '766-98-2531', 575);
INSERT INTO public.bill VALUES (1396, '2020-10-17', 628.20, 22, '737-50-7454', 492);
INSERT INTO public.bill VALUES (1397, '2021-01-05', 660.92, 17, '845-83-0191', 634);
INSERT INTO public.bill VALUES (1398, '2020-06-20', 746.04, 27, '130-04-2954', 556);
INSERT INTO public.bill VALUES (1399, '2020-12-13', 381.75, 7, '796-32-1291', 580);
INSERT INTO public.bill VALUES (1400, '2020-09-23', 352.36, 13, '622-62-2062', 737);
-- Completed on 2021-04-27 17:43:48
--
-- PostgreSQL database dump complete
--
|
DROP SCHEMA IF EXISTS expresspg_test CASCADE;
REVOKE ALL ON DATABASE expresspg_test FROM expresspg_test_app;
DROP ROLE expresspg_test_app;
|
/*
Warnings:
- You are about to drop the column `propertyId` on the `Owner` table. All the data in the column will be lost.
*/
-- DropIndex
DROP INDEX "Owner.propertyId_unique";
-- DropForeignKey
ALTER TABLE "Owner" DROP CONSTRAINT "Owner_propertyId_fkey";
-- DropForeignKey
ALTER TABLE "Property" DROP CONSTRAINT "Property_ownerId_fkey";
-- AlterTable
ALTER TABLE "Owner" DROP COLUMN "propertyId";
-- AlterTable
ALTER TABLE "Property" ADD COLUMN "userId" INTEGER;
-- AddForeignKey
ALTER TABLE "Property" ADD FOREIGN KEY("ownerId")REFERENCES "Owner"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "Property" ADD FOREIGN KEY("userId")REFERENCES "User"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
create database PS14396_DangTanTai_Lab8;
use PS14396_DangTanTai_Lab8;
-- lab 8
-- phần 1
-- a
create unique index uni_id_dt_kh on khachhang(DienThoai);
-- b
create unique index uni_id_email_kh on khachhang(DienThoai);
select * from khachhang;
-- phần 2
-- tạo user
create user 'taihandsome'@'%' identified by 'taihandsomemoiloginduoc';
GRANT ALL PRIVILEGES ON * . * TO 'taihandsome'@'%';
FLUSH PRIVILEGES;
|
CREATE DEFINER=`root`@`localhost` PROCEDURE `MantenimientoUsuarios`(
IN _Accion VARCHAR(15),
IN _UsrId INT,
IN _UsrIdentidad VARCHAR(20),
IN _UsrNombre VARCHAR(40),
IN _UsrApellido VARCHAR(40),
IN _UsrCorreo VARCHAR(60),
IN _UsrUsuario VARCHAR(40),
IN _UsrContrasenia VARCHAR(128),
IN _UsrEstado VARCHAR(40),
IN _AreId INT,
OUT _Estado VARCHAR(15)
)
BEGIN
SET _Estado = "OK";
IF _Accion LIKE '%insertar%' THEN
IF (SELECT COUNT(UsrId) FROM usuarios WHERE UsrIdentidad = _UsrIdentidad) !=0 THEN
SET _Estado = "errIdentidad";
END IF;
IF (SELECT COUNT(UsrId) FROM usuarios WHERE UsrCorreo = _UsrCorreo) !=0 THEN
SET _Estado = "errCorreo";
END IF;
IF (SELECT COUNT(UsrId) FROM usuarios WHERE UsrUsuario = _UsrUsuario) !=0 THEN
SET _Estado = "errUsuario";
END IF;
IF _Estado = "OK" THEN
INSERT INTO usuarios
VALUES
(
_UsrId,
_UsrIdentidad,
_UsrNombre,
_UsrApellido,
_UsrCorreo,
_UsrUsuario,
_UsrContrasenia,
_UsrEstado,
_AreId
);
END IF;
END IF;
IF _Accion LIKE '%editar%' THEN
IF (SELECT COUNT(UsrId) FROM usuarios WHERE UsrId != _UsrId AND UsrIdentidad = _UsrIdentidad) != 0 THEN
SET _Estado = "errIdentidad";
END IF;
IF (SELECT COUNT(UsrId) FROM usuarios WHERE UsrId != _UsrId AND UsrCorreo = _UsrCorreo) != 0 THEN
SET _Estado = "errCorreo";
END IF;
IF (SELECT COUNT(UsrId) FROM usuarios WHERE UsrId != _UsrId AND UsrUsuario = _UsrUsuario) !=0 THEN
SET _Estado = "errUsuario";
END IF;
IF _Estado = "OK" THEN
IF _UsrContrasenia IS NULL OR _UsrContrasenia = "" THEN
UPDATE usuarios SET
UsrIdentidad = _UsrIdentidad,
UsrNombre = _UsrNombre,
UsrApellido = _UsrApellido,
UsrCorreo = _UsrCorreo,
UsrUsuario = _UsrUsuario,
UsrEstado = _UsrEstado,
AreId = _AreId
WHERE UsrId = _UsrId;
ELSE
UPDATE usuarios SET
UsrIdentidad = _UsrIdentidad,
UsrNombre = _UsrNombre,
UsrApellido = _UsrApellido,
UsrCorreo = _UsrCorreo,
UsrUsuario = _UsrUsuario,
UsrContrasenia = _UsrContrasenia,
UsrEstado = _UsrEstado,
AreId = _AreId
WHERE UsrId = _UsrId;
END IF;
END IF;
END IF;
END |
drop table if exists CONTACT;
drop table if exists C_PHONE;
drop table if exists C_EMAIL;
drop table if exists C_ADDRESS;
drop table if exists USER;
drop table if exists C_DATE;
drop table if exists C_INSTANT_MESSAGING;
drop table if exists C_URL;
drop table if exists C_SOCIAL_NETWORK;
CREATE TABLE CONTACT (
ID_contact bigint auto_increment,
FK_ID_user bigint,
name varchar(50),
surname varchar(50),
company varchar(30),
birthday date,
relationship varchar(100),
note varchar(2000),
register_date datetime,
last_modification datetime,
PRIMARY KEY (ID_contact),
KEY FK (FK_ID_user)
);
CREATE TABLE C_PHONE (
ID_phone bigint auto_increment,
FK_ID_contact bigint,
number int,
description varchar(20),
PRIMARY KEY (ID_phone),
KEY FK (FK_ID_contact)
);
CREATE TABLE C_EMAIL (
ID_email bigint auto_increment,
FK_ID_contact bigint,
email varchar(40),
description varchar(20),
PRIMARY KEY (ID_email),
KEY FK (FK_ID_contact)
);
CREATE TABLE C_ADDRESS (
ID_address bigint auto_increment,
FK_ID_contact bigint,
address varchar(50),
description varchar(20),
PRIMARY KEY (ID_address),
KEY FK (FK_ID_contact)
);
CREATE TABLE USER (
ID_user bigint auto_increment,
username varchar(30),
password varchar(64),
email varchar(60),
name varchar(30),
surname varchar(30),
register_date datetime,
last_modification datetime,
PRIMARY KEY (ID_user)
);
CREATE TABLE C_DATE (
ID_date bigint auto_increment,
FK_ID_contact bigint,
date Date,
description varchar(20),
PRIMARY KEY (ID_date),
KEY FK (FK_ID_contact)
);
CREATE TABLE C_INSTANT_MESSAGING (
ID_messaging bigint auto_increment,
FK_ID_contact bigint,
instant_messaging varchar(50),
description varchar(20),
PRIMARY KEY (ID_messaging),
KEY FK (FK_ID_contact)
);
CREATE TABLE C_URL (
ID_url bigint auto_increment,
FK_ID_contact bigint,
url varchar(40),
description varchar(20),
PRIMARY KEY (ID_url),
KEY FK (FK_ID_contact)
);
CREATE TABLE C_SOCIAL_NETWORK (
ID_social_network bigint auto_increment,
FK_ID_contact bigint,
profile varchar(50),
description varchar(20),
PRIMARY KEY (ID_social_network),
KEY FK (FK_ID_contact)
); |
create table etl_job_schsch(
sch_cd varchar2(64) NOT NULL
,sch_name varchar2(64)
,sch_desc varchar2(512)
,sch_start_dt timestamp
,sch_end_dt timestamp
,sch_minute varchar2(200)
,sch_hour varchar2(100)
,sch_day_of_month varchar2(70)
,sch_month_of_year varchar2(70)
,sch_day_of_week varchar2(70)
,record_status varchar2(1)
,create_by varchar2(64)
,create_dt timestamp
,modify_by varchar2(64)
,modify_dt timestamp
,loc_cd varchar2(16)
,org_cd varchar2(16)
,grp_cd varchar2(16) not null
) |
-- User [User]
alter table `user` add column `registrationdate` date;
alter table `user` add column `birthdate` date;
-- TaskExecution [ent14]
alter table `taskexecution` add column `executiontime` datetime;
-- Task [ent6]
alter table `task` add column `maxexecutiontime` time;
-- Worker [ent7]
alter table `worker` add column `accuracyscore` double precision;
-- Item [ent9]
alter table `item` add column `imageurl` varchar(255);
|
DELETE FROM customer WHERE id=15 AND branch_id=3; |
/*
ascm.sql
pvddl newsdc ascm.sql -server w6
*/
Drop Table Ascm IN DICTIONARY #
Create Table Ascm using 'Ascm.DAT' with replace (
StaffNo Char( 8) default '' not null //ΠυNo
, Name Char(40) default '' not null //Ό
, Dt Date not null //ϊt
, Kubun Char(20) default '' not null //ζͺ
, Awh Currency default 0 not null //ΐ
, Shift Char(10) default '' not null //VtgNo
, ShiftNm Char(20) default '' not null //ΌΜΔΌ
, BegTm Time //oΞ
, FinTM Time //ήΞ
, Late Currency default 0 not null //x
, Early Currency default 0 not null //ή
, Extra Currency default 0 not null //ΚcΖ
, Night Currency default 0 not null //[ιcΖ
, H1Extra Currency default 0 not null //@θxc
, H1Night Currency default 0 not null //@θx[
, H2Extra Currency default 0 not null //θxc
, H2Night Currency default 0 not null //θx[
, PTO Currency default 0 not null //LxΙ
, Actual Currency default 0 not null //ΚΤ
, Memo Char(80) default '' not null //υl
, PRIMARY KEY (
StaffNo
, Dt
)
) #
|
ALTER TABLE em_tsede
ADD CONSTRAINT sede_estado_chk
CHECK (sede_estado in ('A','I')); |
# Apaga o banco de dados fake_instagram
DROP DATABASE IF EXISTS fake_instagram;
# Criando o banco de dados
CREATE DATABASE fake_instagram;
# Dizendo que vou usar o bd fake_instagram;
USE fake_instagram;
-- MySQL Workbench Forward Engineering
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES';
-- -----------------------------------------------------
-- Schema mydb
-- -----------------------------------------------------
-- -----------------------------------------------------
-- Schema fake_instagram
-- -----------------------------------------------------
-- -----------------------------------------------------
-- Schema fake_instagram
-- -----------------------------------------------------
-- CREATE SCHEMA IF NOT EXISTS `fake_instagram` DEFAULT CHARACTER SET utf8mb4 ;
-- USE `fake_instagram` ;
-- -----------------------------------------------------
-- Table `fake_instagram`.`usuarios`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `fake_instagram`.`usuarios` (
`id` INT NOT NULL AUTO_INCREMENT,
`nome` VARCHAR(100) NOT NULL,
`email` VARCHAR(45) NOT NULL,
`senha` VARCHAR(256) NOT NULL,
`username` VARCHAR(45) NOT NULL,
`foto` VARCHAR(100) NULL,
PRIMARY KEY (`id`),
UNIQUE INDEX `email_UNIQUE` (`email` ASC))
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `fake_instagram`.`posts`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `fake_instagram`.`posts` (
`id` INT NOT NULL AUTO_INCREMENT,
`media` VARCHAR(100) NULL,
`tipo` ENUM('video', 'foto') NULL,
`descricao` VARCHAR(100) NULL,
`usuario_id` INT NOT NULL,
PRIMARY KEY (`id`),
INDEX `fk_posts_usuarios_idx` (`usuario_id` ASC),
CONSTRAINT `fk_posts_usuarios`
FOREIGN KEY (`usuario_id`)
REFERENCES `fake_instagram`.`usuarios` (`id`)
ON DELETE CASCADE
ON UPDATE CASCADE)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `fake_instagram`.`comentarios`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `fake_instagram`.`comentarios` (
`id` INT NOT NULL AUTO_INCREMENT,
`usuario_id` INT NOT NULL,
`post_id` INT NOT NULL,
`texto` VARCHAR(100) NOT NULL,
PRIMARY KEY (`id`),
INDEX `fk_comentarios_post_idx` (`post_id` ASC),
INDEX `fk_comentarios_usuarios_idx` (`usuario_id` ASC),
CONSTRAINT `fk_comentarios_post`
FOREIGN KEY (`post_id`)
REFERENCES `fake_instagram`.`posts` (`id`)
ON DELETE CASCADE
ON UPDATE CASCADE,
CONSTRAINT `fk_comentarios_usuarios`
FOREIGN KEY (`usuario_id`)
REFERENCES `fake_instagram`.`usuarios` (`id`)
ON DELETE CASCADE
ON UPDATE CASCADE)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `fake_instagram`.`curtidas`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `fake_instagram`.`curtidas` (
`id` INT NOT NULL,
`usuario_id` INT NOT NULL,
`post_id` INT NOT NULL,
PRIMARY KEY (`id`),
INDEX `fk_curtidas_usuarios1_idx` (`usuario_id` ASC),
INDEX `fk_curtidas_posts1_idx` (`post_id` ASC),
CONSTRAINT `fk_curtidas_usuarios1`
FOREIGN KEY (`usuario_id`)
REFERENCES `fake_instagram`.`usuarios` (`id`)
ON DELETE CASCADE
ON UPDATE CASCADE,
CONSTRAINT `fk_curtidas_posts1`
FOREIGN KEY (`post_id`)
REFERENCES `fake_instagram`.`posts` (`id`)
ON DELETE CASCADE
ON UPDATE CASCADE)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `fake_instagram`.`seguidores`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `fake_instagram`.`seguidores` (
`id` INT NOT NULL AUTO_INCREMENT,
`seguidor_id` INT NULL,
`seguido_id` INT NULL,
PRIMARY KEY (`id`),
INDEX `fk_seguidor_idx` (`seguidor_id` ASC),
INDEX `fk_seguido_idx` (`seguido_id` ASC),
CONSTRAINT `fk_seguidor`
FOREIGN KEY (`seguidor_id`)
REFERENCES `fake_instagram`.`usuarios` (`id`)
ON DELETE CASCADE
ON UPDATE CASCADE,
CONSTRAINT `fk_seguido`
FOREIGN KEY (`seguido_id`)
REFERENCES `fake_instagram`.`usuarios` (`id`)
ON DELETE CASCADE
ON UPDATE CASCADE)
ENGINE = InnoDB;
SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
|
CREATE SEQUENCE VND.SEQ_AGENDAMENTO_BACKLOG_LOG
START WITH 1
INCREMENT BY 1
MINVALUE 0
NOCACHE
NOCYCLE
NOORDER;
|
/**
* Use for method SeiyakuDownloadAuthService.updateClientSeiyakuConfirm()
* @author ThuanLM
* @version $Id: AuthService_updateClientSeiyakuConfirm_Upd_01.sql 16128 2014-07-23 06:21:20Z p_chan_toan $
*/
UPDATE
BY_CLIENT_SEIYAKU_CONFIRM BCL
SET
BCL.LAST_LOGIN_EXECUTE_DATE = /*lastLoginExecuteDate*/'2014-07-06'
/*IF continuousLoginErrorCount != "0" || isAccountUnLock == "1"*/
,BCL.CONTINUOUS_LOGIN_ERROR_COUNT = /*continuousLoginErrorCount*/'1'
/*END*/
/*IF accountLockDate != null || isAccountUnLock == "1"*/
,BCL.ACCOUNT_LOCK_DATE = /*accountLockDate*/'2014-07-06'
/*END*/
/*IF lastLoginSuccessDate != null*/
,BCL.LAST_LOGIN_SUCCESS_DATE = /*lastLoginSuccessDate*/'2014/06/20'
/*END*/
,BCL.UPDATE_DATE = /*updateDate*/'2014-07-06'
,BCL.UPDATE_USER_ID = /*updateUserId*/'n.m.h'
,BCL.UPDATE_MODULE_ID = /*updateModuleId*/'xxx'
WHERE
BCL.SEIYAKU_CONFIRM_DL_ID = /*seiyakuConfirmDlId*/'987979879798797979797979797973987979879879797998646549898465465439879654' |
select u.name as "Тренер",
-- lt.name as "Занятие",
-- from_unixtime(unix_timestamp(l.start_date_time)+10800) as 'Начало',
count(case when lu.status_id = 2 then 1 else null end) as 'Пришли',
count(lu.id) as 'Записались'
from lesson l
left join lesson_user lu on lu.lesson_id = l.id
join lesson_set set2 on l.lesson_set_id = set2.id
join lesson_type lt on set2.lesson_type_id = lt.id
join user u on set2.trainer_user_id = u.id
where month(start_date_time) ='2'
group by u.name -- l.id
order by u.name, l.start_date_time;
select u.name as "Тренер",
lt.name as "Занятие",
from_unixtime(unix_timestamp(l.start_date_time)+10800) as 'Начало',
count(case when lu.status_id = 2 then 1 else null end) as 'Пришли',
count(lu.id) as 'Записались'
from lesson l
left join lesson_user lu on lu.lesson_id = l.id
join lesson_set set2 on l.lesson_set_id = set2.id
join lesson_type lt on set2.lesson_type_id = lt.id
join user u on set2.trainer_user_id = u.id
where month(l.start_date_time) = '2'
group by l.id, u2.id
order by u.name, l.start_date_time
select u.name as "Тренер",
lt.name as "Занятие",
from_unixtime(unix_timestamp(l.start_date_time)+10800) as 'Начало',
case when lu.status_id = 2 then 'Пришли' else 'Не Пришли' end,
-- count(lu.id) as 'Записались'
u2.name,
u2.phone
from lesson l
left join lesson_user lu on lu.lesson_id = l.id
join user u2 on lu.user_id = u2.id
join lesson_set set2 on l.lesson_set_id = set2.id
join lesson_type lt on set2.lesson_type_id = lt.id
join user u on set2.trainer_user_id = u.id
where month(l.start_date_time) = '2' and u.id = 27
group by l.id, u2.id
order by u.name, l.start_date_time |
create or replace package app_config_sql
/**
* Project: app_util<br/>
* Description: App tool for data management.
* @author Vinhpt
* @headcom
*/
as
-- global config
/** */
g_config pljson;
-- manipulate config
/** */
procedure get_config;
-- manipulate private attributes
/** */
procedure set_private_attributes;
-- get sql
/** */
function get_create_table_sql return varchar2;
function get_insert_sql return varchar2;
function get_config_sql return varchar2;
end app_config_sql;
/ |
-- phpMyAdmin SQL Dump
-- version 4.5.4.1
-- http://www.phpmyadmin.net
--
-- Client : localhost
-- Généré le : Mer 13 Février 2019 à 09:17
-- Version du serveur : 5.7.11
-- Version de PHP : 7.0.3
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Base de données : `insc_jd`
--
-- --------------------------------------------------------
--
-- Structure de la table `calender`
--
CREATE TABLE `calender` (
`id_calender` int(11) NOT NULL,
`date_user` date NOT NULL,
`nb_insc` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Structure de la table `user`
--
CREATE TABLE `user` (
`id_insc` int(11) NOT NULL,
`user` text NOT NULL,
`date_user` date NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Index pour les tables exportées
--
--
-- Index pour la table `calender`
--
ALTER TABLE `calender`
ADD PRIMARY KEY (`id_calender`);
--
-- Index pour la table `user`
--
ALTER TABLE `user`
ADD PRIMARY KEY (`id_insc`);
--
-- AUTO_INCREMENT pour les tables exportées
--
--
-- AUTO_INCREMENT pour la table `calender`
--
ALTER TABLE `calender`
MODIFY `id_calender` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT pour la table `user`
--
ALTER TABLE `user`
MODIFY `id_insc` int(11) NOT NULL AUTO_INCREMENT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
create database AgustinNicoloso;
use AgustinNicoloso;
create table usuario(
id_usuario int auto_increment,
email varchar(50),
nombre varchar(50),
password varchar(50),
constraint pk_usuario primary key(id_usuario),
constraint unq_email unique(email)
);
create table vehiculo(
id_vehiculo int auto_increment,
usuario varchar(50),
titulo varchar(50),
descripcion varchar(50),
anio int,
precio int,
foto varchar(50),
constraint pk_vehiculo primary key(id_vehiculo)
);
create table propiedad(
id_propiedad int auto_increment,
usuario varchar(50),
titulo varchar(50),
descripcion varchar(50),
habitaciones int,
parking varchar(10),
precio int,
foto varchar(50),
constraint pk_propiedad primary key(id_propiedad)
);
|
--------------------------------------------------------
-- Archivo creado - viernes-octubre-12-2018
--------------------------------------------------------
--------------------------------------------------------
-- DDL for Table MUNICIPIO
--------------------------------------------------------
CREATE TABLE "BMONTOYA"."MUNICIPIO"
( "ID" NUMBER(*,0),
"NOMBRE" VARCHAR2(255 BYTE)
) SEGMENT CREATION IMMEDIATE
PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
TABLESPACE "MID_TERM" ;
REM INSERTING into BMONTOYA.MUNICIPIO
SET DEFINE OFF;
Insert into BMONTOYA.MUNICIPIO (ID,NOMBRE) values ('10','LETICIA (CT)');
Insert into BMONTOYA.MUNICIPIO (ID,NOMBRE) values ('11','ANDES');
Insert into BMONTOYA.MUNICIPIO (ID,NOMBRE) values ('12','APARTADO');
Insert into BMONTOYA.MUNICIPIO (ID,NOMBRE) values ('13','BARBOSA');
Insert into BMONTOYA.MUNICIPIO (ID,NOMBRE) values ('14','BELLO');
Insert into BMONTOYA.MUNICIPIO (ID,NOMBRE) values ('15','CAUCASIA');
Insert into BMONTOYA.MUNICIPIO (ID,NOMBRE) values ('16','CIUDAD BOLIVAR');
Insert into BMONTOYA.MUNICIPIO (ID,NOMBRE) values ('17','DON MATĂ?AS');
Insert into BMONTOYA.MUNICIPIO (ID,NOMBRE) values ('18','ITUANGO');
Insert into BMONTOYA.MUNICIPIO (ID,NOMBRE) values ('19','JARDIN');
Insert into BMONTOYA.MUNICIPIO (ID,NOMBRE) values ('20','LA CEJA');
Insert into BMONTOYA.MUNICIPIO (ID,NOMBRE) values ('21','MEDELLĂ?N (CT)');
Insert into BMONTOYA.MUNICIPIO (ID,NOMBRE) values ('22','RIONEGRO');
Insert into BMONTOYA.MUNICIPIO (ID,NOMBRE) values ('23','SALGAR');
Insert into BMONTOYA.MUNICIPIO (ID,NOMBRE) values ('24','SANTAFE DE ANTIOQUIA');
Insert into BMONTOYA.MUNICIPIO (ID,NOMBRE) values ('25','VALDIVIA');
Insert into BMONTOYA.MUNICIPIO (ID,NOMBRE) values ('26','ARAUCA (CT)');
--------------------------------------------------------
-- DDL for Index SYS_C006988
--------------------------------------------------------
CREATE UNIQUE INDEX "BMONTOYA"."SYS_C006988" ON "BMONTOYA"."MUNICIPIO" ("ID")
PCTFREE 10 INITRANS 2 MAXTRANS 255
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
TABLESPACE "MID_TERM" ;
--------------------------------------------------------
-- Constraints for Table MUNICIPIO
--------------------------------------------------------
ALTER TABLE "BMONTOYA"."MUNICIPIO" ADD PRIMARY KEY ("ID")
USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
TABLESPACE "MID_TERM" ENABLE;
ALTER TABLE "BMONTOYA"."MUNICIPIO" MODIFY ("ID" NOT NULL ENABLE);
|
---Q1 Afficher dans l'ordre alphabétique et sur une seule colonne, les noms et prénoms des employés qui ont des enfants. Présenter d'abord ceux qui en ont le plus.
SELECT concat (emp_lastname,' ',emp_firstname) AS employé, emp_children AS NB_enfants
FROM employees
ORDER BY emp_children DESC, emp_lastname ASC
--Q2 Y-a-t-il des clients étrangers ? Afficher leur nom, prénom et pays de résidence.
SELECT cus_lastname, cus_firstname, cus_countries_id
FROM customers
WHERE cus_countries_id <> 'FR'
--Q3 Afficher par ordre alphabétique les villes de résidence des clients ainsi que le code (ou le nom) du pays.
SELECT cus_city, cus_countries_id,cou_name
FROM customers,countries
WHERE cus_countries_id =cou_id
ORDER BY cus_city ASC
--Q4 Afficher le nom des clients dont les fiches ont été modifiées
SELECT cus_lastname, cus_update_date
FROM customers
WHERE cus_update_date IS NOT NULL
--Q5.(La commerciale Coco Merce veut consulter la fiche d'un client, mais la seule chose dont elle se souvienne est qu'il habite une ville genre 'divos'. Pouvez-vous l'aider ?
SELECT cus_id, CONCAT(cus_lastname,' ',cus_firstname),cus_city
FROM customers
WHERE cus_city LIKE '%divos%'
--Q6. Quel est le produit dont le prix de vente est le moins cher ? Afficher le prix, l'id et le nom du produit.
SELECT pro_id, pro_name ,pro_price
FROM products
ORDER BY pro_price ASC
LIMIT 1
--Q7. Lister les produits qui n'ont jamais été vendus
SELECT pro_id,pro_ref,pro_name FROM products
where pro_id not in (select ode_pro_id from orders_details);
--Q8. Afficher les produits commandés par Madame Pikatchien.
/*select pro_id, pro_ref ,pro_color , pro_name ,cus_id ,cus_lastname, ord_id , ode_id
FROM products , customers, orders_details, orders
WHERE ord_cus_id = cus_id and cus_lastname='pikatchien'*/
SELECT pro_id,pro_ref,pro_name,cus_id,ord_id,ode_id FROM products
JOIN orders_details
ON products.pro_id=orders_details.ode_pro_id
JOIN orders
ON orders_details.ode_ord_id=orders.ord_id
JOIN customers
ON orders.ord_cus_id=customers.cus_id
WHERE cus_lastname="Pikatchien";
--Q9. Afficher le catalogue des produits par catégorie, le nom des produits et de la catégorie doivent être affichés.
SELECT cat_id , cat_name , pro_name
from categories,products
WHERE pro_cat_id = cat_id
ORDER BY cat_name ASC
--Q10. Afficher l'organigramme du magasin de Compiègne Afficher le nom et prénom des employés, classés par ordre alphabétique, ainsi que celui de leur supérieur hiérarchique (et éventuellement leurs postes respectifs, si vous y parvenez).
SELECT CONCAT(emp1.emp_lastname,' ', emp1.emp_firstname) as Employé, pos_libelle as Poste, CONCAT(emp2.emp_lastname,' ',emp2. emp_firstname) as Supérieur
FROM employees as emp1
JOIN posts on pos_id = emp1.emp_pos_id
JOIN employees as emp2 on emp2.emp_id =emp1.emp_superior_id
JOIN shops on sho_id = emp1.emp_sho_id
WHERE sho_id=3
ORDER BY emp1.emp_lastname;
--Q11. Quel produit a été vendu avec la remise la plus élevée ? Afficher le montant de la remise, le numéro et le nom du produit, le numéro de commande et de ligne de commande.
SELECT ode_discount , pro_id , pro_name , ord_id , ode_id
FROM orders
JOIN orders_details on ode_ord_id=ord_id
JOIN products on pro_id=ode_pro_id
WHERE ode_discount = (SELECT max(ode_discount) FROM orders_details);
--Q12. Combien y-a-t-il de clients canadiens ? Afficher dans une colonne intitulée 'Nb clients Canada'
SELECT count(cus_id) as 'Nb clients Canada'FROM customers
WHERE cus_countries_id='CA';
--Q13. Afficher le détail des commandes de 2020.
SELECT ode_id,ode_unit_price,ode_discount,ode_quantity,ode_ord_id,ode_pro_id ,ord_order_date FROM orders_details
JOIN orders
ON orders_details.ode_ord_id=orders.ord_id
where YEAR(ord_order_date)=2020;
--Q14. Afficher les coordonnées des fournisseurs pour lesquels des commandes ont été passées.
SELECT pro_sup_id FROM suppliers, products
WHERE suppliers.sup_id=products.pro_sup_id
GROUP BY pro_sup_id;
--Q15. Quel est le chiffre d'affaires de 2020 ?
select sum((ode_unit_price-(ode_unit_price*ode_discount/100))*ode_quantity) as chiffre_aff FROM orders_details
JOIN orders on orders_details.ode_ord_id=orders.ord_id
WHERE YEAR(ord_order_date)=2020;
--Q16. Quel est le panier moyen ?
select (sum((ode_unit_price-(ode_unit_price*ode_discount/100))*ode_quantity))/count(DISTINCT(ord_id)) as prix_panier FROM orders_details
JOIN orders on orders_details.ode_ord_id=orders.ord_id ;
--Q16. Lister le total de chaque commande par total décroissant (Afficher numéro de commande, date, total et nom du client).
SELECT ord_id as numéro_de_commande,cus_lastname as nom_du_client ,ord_order_date as 'date',sum((ode_unit_price-(ode_unit_price*ode_discount/100))*ode_quantity) as total from orders_details
JOIN orders
on orders_details.ode_ord_id = orders.ord_id
JOIN customers
ON orders.ord_cus_id = customers.cus_id
GROUP BY ord_id
ORDER BY sum((ode_unit_price-(ode_unit_price*ode_discount/100))*ode_quantity) DESC;
--Q17. Quel est le panier moyen ?
select (sum((ode_unit_price-(ode_unit_price*ode_discount/100))*ode_quantity))/count(DISTINCT(ord_id)) as prix_panier FROM orders_details
JOIN orders on orders_details.ode_ord_id=orders.ord_id ;
--Q18. La version 2020 du produit barb004 s'appelle désormais Camper et, bonne nouvelle, son prix subit une baisse de 10%.
UPDATE products
SET
pro_name = 'Camper',
pro_price = pro_price*0.9,
pro_update_date = CURRENT_TIME()
WHERE pro_ref = 'barb004';
--Q19. L'inflation en France en 2019 a été de 1,1%, appliquer cette augmentation à la gamme de parasols.
UPDATE products
set pro_price = pro_price * 1.011, pro_update_date = CURRENT_TIME()
where pro_id= 25 or pro_id= 27;
--Q20. Supprimer les produits non vendus de la catégorie "Tondeuses électriques". Vous devez utiliser une sous-requête sans indiquer de valeurs de clés.
DELETE* FROM products
WHERE pro_cat_id = (select `cat_id` from `categories` where `cat_name`="Tondeuses électriques") and `pro_id` not in (select `ode_pro_id` from `orders_details`); |
-- ******** 21/01/2020
-- Add 'type' to dataset
CREATE TABLE `dataset_type` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(50) NOT NULL,
`description` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
);
create table if not exists dataset
(
id int auto_increment
primary key,
title varchar(255) charset utf8 not null,
description text not null,
type int null,
uuid varchar(64) charset utf8 not null,
user_id int not null,
date_created datetime default CURRENT_TIMESTAMP null,
date_modified datetime default CURRENT_TIMESTAMP null,
constraint uuid
unique (uuid),
constraint dataset_dataset_type_id_fk
foreign key (type) references dataset_type (id),
constraint datasets___user_id
foreign key (user_id) references user (id)
on delete cascade
);
create index datasets__user_id
on dataset (user_id);
-- JC 16/12/2019
-- Dataset permissions table
create table if not exists dataset_permission
(
role_id int not null,
dataset_id int not null,
v int default 0 not null,
r int default 0 not null,
w int default 0 not null,
d int default 0 not null,
g int default 0 not null,
primary key (role_id, dataset_id),
constraint dataset_permission___dataset_id
foreign key (dataset_id) references dataset (id)
on delete cascade,
constraint dataset_permission___role_id
foreign key (role_id) references role (id)
on delete cascade
)
collate = utf8mb4_unicode_ci;
create index dataset_permission_role_id_dataset_id_index
on dataset_permission (role_id, dataset_id);
create index dataset_permission_role_id_index
on dataset_permission (role_id);
-- also use the following to populate for existing datasets:
-- v & r permission for logged in users
INSERT INTO dataset_permission (role_id, dataset_id, v, r)
SELECT -1, id, 1, 1
FROM dataset;
-- v permission for anonymous users
INSERT INTO dataset_permission (role_id, dataset_id, v)
SELECT -2, id, 1
FROM dataset;
-- all permissions for dataset owners
INSERT INTO dataset_permission (role_id, dataset_id, v, r, w, d, g)
SELECT 0, id, 1, 1, 1, 1, 1
FROM dataset;
-- TODO Move these to related modules 'file' and 'stream'
INSERT INTO dataset_type (id, name, description) VALUES (1, 'stream', 'Datasets that support live streaming of JSON data from sensors or other Internet conencted devices');
INSERT INTO dataset_type (id, name, description) VALUES (2, 'file', 'Datasets consisting of static files');
create table if not exists metadata
(
id int auto_increment
primary key,
name varchar(50) charset utf8 not null,
description text charset utf8 null
)
collate = utf8mb4_unicode_ci;
INSERT INTO metadata (id, name, description) VALUES (1, 'latitude', 'X latitiude coordinate (WGS84)');
INSERT INTO metadata (id, name, description) VALUES (2, 'longitude', 'Y longitude coordiante (WGS84)');
INSERT INTO metadata (id, name, description) VALUES (3, 'attribution', 'Dataset attribution');
INSERT INTO metadata (id, name, description) VALUES (4, 'tags', 'Dataset tags');
-- ******** 21/01/2020
-- Add dataset metadata
create table if not exists dataset__metadata
(
id int auto_increment
primary key,
dataset_id int not null,
meta_id int not null,
value varchar(255) charset utf8 not null,
constraint dataset__metadata__dataset_id
foreign key (dataset_id) references dataset (id)
on delete cascade,
constraint dataset__metadata__metadata_id
foreign key (meta_id) references metadata (id)
on delete cascade
)
collate = utf8mb4_unicode_ci;
create index dataset_id
on dataset__metadata (dataset_id);
create index meta_id
on dataset__metadata (meta_id);
create index value
on dataset__metadata (value);
-- JC 23/03/2020
-- Dataset Owners
create table if not exists owner
(
id int auto_increment
primary key,
name varchar(250) not null,
constraint owner_name_uindex
unique (name)
);
create table if not exists dataset__owner
(
id int auto_increment
primary key,
dataset_id int not null,
owner_id int not null,
constraint dataset__owner_dataset_id_fk
foreign key (dataset_id) references dataset (id)
on delete cascade,
constraint dataset__owner_owner_id_fk
foreign key (owner_id) references owner (id)
on delete cascade
);
-- JC 23/03/2020
-- Dataset licences
create table if not exists licence
(
id int auto_increment
primary key,
name varchar(250) null,
description text null,
uri varchar(250) null,
constraint licence_name_uindex
unique (name)
);
create table if not exists dataset__licence
(
id int auto_increment
primary key,
dataset_id int not null,
licence_id int not null,
constraint dataset__licence_dataset_id_fk
foreign key (dataset_id) references dataset (id)
on delete cascade,
constraint dataset__licence_licence_id_fk
foreign key (licence_id) references licence (id)
on delete cascade
);
-- Some sample licences
INSERT INTO licence (id, name, description, uri) VALUES (1, 'Apache License', 'This is the description of the Apache licence', 'https://www.apache.org/licenses/LICENSE-2.0');
INSERT INTO licence (id, name, description, uri) VALUES (2, 'Creative Commons', 'Description of Creative Commons licence', 'https://creativecommons.org/licenses/by/4.0/');
INSERT INTO licence (id, name, description, uri) VALUES (3, 'Open Government Licence', null, 'http://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/');
INSERT INTO licence (id, name, description, uri) VALUES (4, 'Koubachi Platform Terms of Service', null, 'https://datahub.mksmart.org/policy/koubachi-platform-terms-of-service/');
INSERT INTO licence (id, name, description, uri) VALUES (5, 'Flickr APIs Terms of Use', null, 'https://www.flickr.com/help/terms/api');
|
-- +micrate Up
CREATE TABLE urls (
id BIGSERIAL PRIMARY KEY,
address VARCHAR,
item_id BIGINT,
created_at TIMESTAMP,
updated_at TIMESTAMP
);
CREATE INDEX url_item_id_idx ON urls (item_id);
-- +micrate Down
DROP TABLE IF EXISTS urls;
|
-- select_fi_list
SELECT
fi_seq,
fi_no,
fi_noti_yn,
DATE_FORMAT(fi_noti_date, "%Y%m%d") AS fi_noti_date,
DATE_FORMAT(fi_delivery_date, "%Y%m%d") AS fi_delivery_date,
member_seq
FROM
tb_fertilization_info
WHERE
member_seq = '';
--select_fi_one
SELECT
fi_seq,
fi_no,
fi_noti_yn,
DATE_FORMAT(fi_noti_date, "%Y%m%d") AS fi_noti_date,
DATE_FORMAT(fi_delivery_date, "%Y%m%d") AS fi_delivery_date,
member_seq
FROM
tb_fertilization_info
WHERE
member_seq = ''
AND
fi_seq = '';
--select_delivery_ready_list
SELECT
fi_seq,
fi_no,
fi_noti_yn,
DATE_FORMAT(fi_noti_yn, "%Y%m%d") AS fi_noti_date,
DATE_FORMAT(fi_delivery_date, "%Y%m%d") AS fi_delivery_date,
member_seq
FROM
tb_fertilization_info
WHERE
fi_delivery_date
IN(
SELECT
DATE_FORMAT(fi_delivery_date, "%Y%m%d")
FROM
tb_fertilization_info
WHERE
fi_delivery_date <= ''
AND
fi_seq = ''
AND
member_seq = '';
)
--select_fi_max_seq
SELECT
COALESCE(MAX(fi_seq),1) as fi_seq
FROM
tb_fertilization_info;
--delete_expire_fi(modify)
DELETE t1.*, t2.* FROM
tb_cattle_info t1, tb_reg_info t2
WHERE
t1.cattle_seq = t2.cattle_seq
AND
t1.cattle_seq
IN(
SELECT sub.cattle_seq FROM(
SELECT
cattle_seq
FROM
tb_cattle_info
WHERE
cattle_out_date = DATE_FORMAT(NOW(), "%Y%m%d")
AND
member_seq = #member_seq#
)AS sub
);
--delete_fi_one
DELETE FROM
tb_fertilization_info
WHERE
fi_seq = ''
AND
member_seq = '';
--update_fi_delivery_date
UPDATE
tb_fertilization_info
SET
fi_delivery_date = ''
WHERE
fi_seq = ''
AND
member_seq = '';
--insert_fi
INSERT INTO
tb_fertilization_info
(
fi_seq,
fi_no,
fi_noti_yn,
fi_noti_date,
fi_delivery_date,
member_seq
)
VALUES
(
'',
'',
'',
'',
''
);
-- select_fd_list
SELECT
fd_seq,
DATE_FORMAT(fd_reg_date, "%Y%m%d") AS fd_reg_date,
fi_seq
FROM
tb_fertilization_date
WHERE
fd_seq = '';
AND
member_seq='';
-- select_fd_one
SELECT
fd_seq,
DATE_FORMAT(fd_reg_date, "%Y%m%d") AS fd_reg_date,
fi_seq
FROM
tb_fertilization_date
WHERE
fd_seq = ''
AND
fi_seq = ''
AND
member_seq='';
--delete_fd_one
DELETE FROM
tb_fertilization_date
WHERE
fd_seq = ''
AND
fi_seq = ''
AND
member_seq='';
--delete_fd_list
DELETE FROM
tb_fertilization_date
WHERE
fd_seq = ''
AND
member_seq='';
--insert_fd
INSERT INTO
tb_fertilization_date
(
fd_reg_date,
fi_seq,
member_seq
)
VALUES
(
'',
'',
''
)
|
-- 시퀀스추가
CREATE SEQUENCE SQ_LCMS_TOC_SEQ
START WITH 1
MAXVALUE 9223372036854775807
MINVALUE 0
NOCYCLE
CACHE 10
NOORDER
;
CREATE SEQUENCE SEQ_LCMS_METADATA_SEQ
START WITH 1
MAXVALUE 9999999999
MINVALUE 1
NOCYCLE
CACHE 10
NOORDER
;
INSERT INTO TB_LCMS_METADATA_MAP ( SEARCH_YN, ELEMENT_PATH, ELEMENT_NAME, ELEMENT_TITLE, READONLY,
METATYPE, OBJ_TYPE, PRE_GROUP ) VALUES (
'N', 'lom/general/title', 'string', '타이틀', 'Y', 'LOM', 'ITM', 1);
INSERT INTO TB_LCMS_METADATA_MAP ( SEARCH_YN, ELEMENT_PATH, ELEMENT_NAME, ELEMENT_TITLE, READONLY,
METATYPE, OBJ_TYPE, PRE_GROUP ) VALUES (
'N', 'lom/general/title', 'string', '타이틀', 'Y', 'LOM', 'ORG', 1);
INSERT INTO TB_LCMS_METADATA_MAP ( SEARCH_YN, ELEMENT_PATH, ELEMENT_NAME, ELEMENT_TITLE, READONLY,
METATYPE, OBJ_TYPE, PRE_GROUP ) VALUES (
'N', 'lom/general/title', 'string', '타이틀', 'Y', 'LOM', 'COA', 1);
INSERT INTO TB_LCMS_METADATA_MAP ( SEARCH_YN, ELEMENT_PATH, ELEMENT_NAME, ELEMENT_TITLE, READONLY,
METATYPE, OBJ_TYPE, PRE_GROUP ) VALUES (
'N', 'lom/general/keyword', 'string', '키워드', 'Y', 'LOM', 'SCO', 1);
INSERT INTO TB_LCMS_METADATA_MAP ( SEARCH_YN, ELEMENT_PATH, ELEMENT_NAME, ELEMENT_TITLE, READONLY,
METATYPE, OBJ_TYPE, PRE_GROUP ) VALUES (
'N', 'lom/general/keyword', 'string', '키워드', 'Y', 'LOM', 'COA', 1);
INSERT INTO TB_LCMS_METADATA_MAP ( SEARCH_YN, ELEMENT_PATH, ELEMENT_NAME, ELEMENT_TITLE, READONLY,
METATYPE, OBJ_TYPE, PRE_GROUP ) VALUES (
'N', 'lom/general/keyword', 'string', '키워드', 'Y', 'LOM', 'ORG', 1);
INSERT INTO TB_LCMS_METADATA_MAP ( SEARCH_YN, ELEMENT_PATH, ELEMENT_NAME, ELEMENT_TITLE, READONLY,
METATYPE, OBJ_TYPE, PRE_GROUP ) VALUES (
'N', 'lom/general/keyword', 'string', '키워드', 'Y', 'LOM', 'ITM', 1);
INSERT INTO TB_LCMS_METADATA_MAP ( SEARCH_YN, ELEMENT_PATH, ELEMENT_NAME, ELEMENT_TITLE, READONLY,
METATYPE, OBJ_TYPE, PRE_GROUP ) VALUES (
'N', 'lom/general/description', 'string', '설명', 'Y', 'LOM', 'SCO', 1);
INSERT INTO TB_LCMS_METADATA_MAP ( SEARCH_YN, ELEMENT_PATH, ELEMENT_NAME, ELEMENT_TITLE, READONLY,
METATYPE, OBJ_TYPE, PRE_GROUP ) VALUES (
'N', 'lom/general/description', 'string', '설명', 'Y', 'LOM', 'ITM', 1);
INSERT INTO TB_LCMS_METADATA_MAP ( SEARCH_YN, ELEMENT_PATH, ELEMENT_NAME, ELEMENT_TITLE, READONLY,
METATYPE, OBJ_TYPE, PRE_GROUP ) VALUES (
'N', 'lom/general/description', 'string', '설명', 'Y', 'LOM', 'ORG', 1);
INSERT INTO TB_LCMS_METADATA_MAP ( SEARCH_YN, ELEMENT_PATH, ELEMENT_NAME, ELEMENT_TITLE, READONLY,
METATYPE, OBJ_TYPE, PRE_GROUP ) VALUES (
'N', 'lom/general/description', 'string', '설명', 'Y', 'LOM', 'COA', 1);
INSERT INTO TB_LCMS_METADATA_MAP ( SEARCH_YN, ELEMENT_PATH, ELEMENT_NAME, ELEMENT_TITLE, READONLY,
METATYPE, OBJ_TYPE, PRE_GROUP ) VALUES (
'N', 'lom/technical', 'format', '강의유형', 'Y', 'LOM', 'SCO', 1);
INSERT INTO TB_LCMS_METADATA_MAP ( SEARCH_YN, ELEMENT_PATH, ELEMENT_NAME, ELEMENT_TITLE, READONLY,
METATYPE, OBJ_TYPE, PRE_GROUP ) VALUES (
'N', 'lom/technical', 'format', '강의유형', 'Y', 'LOM', 'ITM', 1);
INSERT INTO TB_LCMS_METADATA_MAP ( SEARCH_YN, ELEMENT_PATH, ELEMENT_NAME, ELEMENT_TITLE, READONLY,
METATYPE, OBJ_TYPE, PRE_GROUP ) VALUES (
'N', 'lom/technical', 'format', '강의유형', 'Y', 'LOM', 'ORG', 1);
INSERT INTO TB_LCMS_METADATA_MAP ( SEARCH_YN, ELEMENT_PATH, ELEMENT_NAME, ELEMENT_TITLE, READONLY,
METATYPE, OBJ_TYPE, PRE_GROUP ) VALUES (
'N', 'lom/technical', 'format', '강의유형', 'Y', 'LOM', 'COA', 1);
INSERT INTO TB_LCMS_METADATA_MAP ( SEARCH_YN, ELEMENT_PATH, ELEMENT_NAME, ELEMENT_TITLE, READONLY,
METATYPE, OBJ_TYPE, PRE_GROUP ) VALUES (
'N', 'lom/educational/difficulty', 'value', '난이도', 'Y', 'LOM', 'SCO', 1);
INSERT INTO TB_LCMS_METADATA_MAP ( SEARCH_YN, ELEMENT_PATH, ELEMENT_NAME, ELEMENT_TITLE, READONLY,
METATYPE, OBJ_TYPE, PRE_GROUP ) VALUES (
'N', 'lom/educational/difficulty', 'value', '난이도', 'Y', 'LOM', 'ITM', 1);
INSERT INTO TB_LCMS_METADATA_MAP ( SEARCH_YN, ELEMENT_PATH, ELEMENT_NAME, ELEMENT_TITLE, READONLY,
METATYPE, OBJ_TYPE, PRE_GROUP ) VALUES (
'N', 'lom/educational/difficulty', 'value', '난이도', 'Y', 'LOM', 'ORG', 1);
INSERT INTO TB_LCMS_METADATA_MAP ( SEARCH_YN, ELEMENT_PATH, ELEMENT_NAME, ELEMENT_TITLE, READONLY,
METATYPE, OBJ_TYPE, PRE_GROUP ) VALUES (
'N', 'lom/educational/difficulty', 'value', '난이도', 'Y', 'LOM', 'COA', 1);
INSERT INTO TB_LCMS_METADATA_MAP ( SEARCH_YN, ELEMENT_PATH, ELEMENT_NAME, ELEMENT_TITLE, READONLY,
METATYPE, OBJ_TYPE, PRE_GROUP ) VALUES (
'N', 'lom/educational/description', 'string', '총학습분량', 'Y', 'LOM', 'SCO', 1);
INSERT INTO TB_LCMS_METADATA_MAP ( SEARCH_YN, ELEMENT_PATH, ELEMENT_NAME, ELEMENT_TITLE, READONLY,
METATYPE, OBJ_TYPE, PRE_GROUP ) VALUES (
'N', 'lom/educational/description', 'string', '총학습분량', 'Y', 'LOM', 'ITM', 1);
INSERT INTO TB_LCMS_METADATA_MAP ( SEARCH_YN, ELEMENT_PATH, ELEMENT_NAME, ELEMENT_TITLE, READONLY,
METATYPE, OBJ_TYPE, PRE_GROUP ) VALUES (
'N', 'lom/educational/description', 'string', '총학습분량', 'Y', 'LOM', 'ORG', 1);
INSERT INTO TB_LCMS_METADATA_MAP ( SEARCH_YN, ELEMENT_PATH, ELEMENT_NAME, ELEMENT_TITLE, READONLY,
METATYPE, OBJ_TYPE, PRE_GROUP ) VALUES (
'N', 'lom/educational/description', 'string', '총학습분량', 'Y', 'LOM', 'COA', 1);
INSERT INTO TB_LCMS_METADATA_MAP ( SEARCH_YN, ELEMENT_PATH, ELEMENT_NAME, ELEMENT_TITLE, READONLY,
METATYPE, OBJ_TYPE, PRE_GROUP ) VALUES (
'N', 'lom/general', 'language', '언어', 'Y', 'LOM', 'SCO', 1);
INSERT INTO TB_LCMS_METADATA_MAP ( SEARCH_YN, ELEMENT_PATH, ELEMENT_NAME, ELEMENT_TITLE, READONLY,
METATYPE, OBJ_TYPE, PRE_GROUP ) VALUES (
'N', 'lom/general/title', 'string', '타이틀', 'Y', 'LOM', 'SCO', 1);
INSERT INTO TB_LCMS_METADATA_MAP ( SEARCH_YN, ELEMENT_PATH, ELEMENT_NAME, ELEMENT_TITLE, READONLY,
METATYPE, OBJ_TYPE, PRE_GROUP ) VALUES (
'N', 'lom/general', 'language', '언어', 'Y', 'LOM', 'ITM', 1);
INSERT INTO TB_LCMS_METADATA_MAP ( SEARCH_YN, ELEMENT_PATH, ELEMENT_NAME, ELEMENT_TITLE, READONLY,
METATYPE, OBJ_TYPE, PRE_GROUP ) VALUES (
'N', 'lom/general', 'language', '언어', 'Y', 'LOM', 'ORG', 1);
INSERT INTO TB_LCMS_METADATA_MAP ( SEARCH_YN, ELEMENT_PATH, ELEMENT_NAME, ELEMENT_TITLE, READONLY,
METATYPE, OBJ_TYPE, PRE_GROUP ) VALUES (
'N', 'lom/general', 'language', '언어', 'Y', 'LOM', 'COA', 1);
INSERT INTO TB_LCMS_METADATA_MAP ( SEARCH_YN, ELEMENT_PATH, ELEMENT_NAME, ELEMENT_TITLE, READONLY,
METATYPE, OBJ_TYPE, PRE_GROUP ) VALUES (
'N', 'lom/lifeCycle/version', 'string', '버전', 'Y', 'LOM', 'SCO', 1);
INSERT INTO TB_LCMS_METADATA_MAP ( SEARCH_YN, ELEMENT_PATH, ELEMENT_NAME, ELEMENT_TITLE, READONLY,
METATYPE, OBJ_TYPE, PRE_GROUP ) VALUES (
'N', 'lom/lifeCycle/version', 'string', '버전', 'Y', 'LOM', 'ITM', 1);
INSERT INTO TB_LCMS_METADATA_MAP ( SEARCH_YN, ELEMENT_PATH, ELEMENT_NAME, ELEMENT_TITLE, READONLY,
METATYPE, OBJ_TYPE, PRE_GROUP ) VALUES (
'N', 'lom/lifeCycle/version', 'string', '버전', 'Y', 'LOM', 'ORG', 1);
INSERT INTO TB_LCMS_METADATA_MAP ( SEARCH_YN, ELEMENT_PATH, ELEMENT_NAME, ELEMENT_TITLE, READONLY,
METATYPE, OBJ_TYPE, PRE_GROUP ) VALUES (
'N', 'lom/lifeCycle/version', 'string', '버전', 'Y', 'LOM', 'COA', 1);
INSERT INTO TB_LCMS_METADATA_MAP ( SEARCH_YN, ELEMENT_PATH, ELEMENT_NAME, ELEMENT_TITLE, READONLY,
METATYPE, OBJ_TYPE, PRE_GROUP ) VALUES (
'N', 'lom/lifeCycle/status', 'value', '버전상태', 'Y', 'LOM', 'SCO', 1);
INSERT INTO TB_LCMS_METADATA_MAP ( SEARCH_YN, ELEMENT_PATH, ELEMENT_NAME, ELEMENT_TITLE, READONLY,
METATYPE, OBJ_TYPE, PRE_GROUP ) VALUES (
'N', 'lom/lifeCycle/status', 'value', '버전상태', 'Y', 'LOM', 'ITM', 1);
INSERT INTO TB_LCMS_METADATA_MAP ( SEARCH_YN, ELEMENT_PATH, ELEMENT_NAME, ELEMENT_TITLE, READONLY,
METATYPE, OBJ_TYPE, PRE_GROUP ) VALUES (
'N', 'lom/lifeCycle/status', 'value', '버전상태', 'Y', 'LOM', 'ORG', 1);
INSERT INTO TB_LCMS_METADATA_MAP ( SEARCH_YN, ELEMENT_PATH, ELEMENT_NAME, ELEMENT_TITLE, READONLY,
METATYPE, OBJ_TYPE, PRE_GROUP ) VALUES (
'N', 'lom/lifeCycle/status', 'value', '버전상태', 'Y', 'LOM', 'COA', 1);
INSERT INTO TB_LCMS_METADATA_MAP ( SEARCH_YN, ELEMENT_PATH, ELEMENT_NAME, ELEMENT_TITLE, READONLY,
METATYPE, OBJ_TYPE, PRE_GROUP ) VALUES (
'N', 'lom/lifeCycle/contribute/role', 'value', '담당교수', 'Y', 'LOM', 'SCO', 1);
INSERT INTO TB_LCMS_METADATA_MAP ( SEARCH_YN, ELEMENT_PATH, ELEMENT_NAME, ELEMENT_TITLE, READONLY,
METATYPE, OBJ_TYPE, PRE_GROUP ) VALUES (
'N', 'lom/lifeCycle/contribute/role', 'value', '담당교수', 'Y', 'LOM', 'ITM', 1);
INSERT INTO TB_LCMS_METADATA_MAP ( SEARCH_YN, ELEMENT_PATH, ELEMENT_NAME, ELEMENT_TITLE, READONLY,
METATYPE, OBJ_TYPE, PRE_GROUP ) VALUES (
'N', 'lom/lifeCycle/contribute/role', 'value', '담당교수', 'Y', 'LOM', 'ORG', 1);
INSERT INTO TB_LCMS_METADATA_MAP ( SEARCH_YN, ELEMENT_PATH, ELEMENT_NAME, ELEMENT_TITLE, READONLY,
METATYPE, OBJ_TYPE, PRE_GROUP ) VALUES (
'N', 'lom/lifeCycle/contribute/role', 'value', '담당교수', 'Y', 'LOM', 'COA', 1);
INSERT INTO TB_LCMS_METADATA_MAP ( SEARCH_YN, ELEMENT_PATH, ELEMENT_NAME, ELEMENT_TITLE, READONLY,
METATYPE, OBJ_TYPE, PRE_GROUP ) VALUES (
'N', 'lom/lifeCycle/contribute', 'entity', '개발업체명', 'Y', 'LOM', 'SCO', 1);
INSERT INTO TB_LCMS_METADATA_MAP ( SEARCH_YN, ELEMENT_PATH, ELEMENT_NAME, ELEMENT_TITLE, READONLY,
METATYPE, OBJ_TYPE, PRE_GROUP ) VALUES (
'N', 'lom/lifeCycle/contribute', 'entity', '개발업체명', 'Y', 'LOM', 'ITM', 1);
INSERT INTO TB_LCMS_METADATA_MAP ( SEARCH_YN, ELEMENT_PATH, ELEMENT_NAME, ELEMENT_TITLE, READONLY,
METATYPE, OBJ_TYPE, PRE_GROUP ) VALUES (
'N', 'lom/lifeCycle/contribute', 'entity', '개발업체명', 'Y', 'LOM', 'ORG', 1);
INSERT INTO TB_LCMS_METADATA_MAP ( SEARCH_YN, ELEMENT_PATH, ELEMENT_NAME, ELEMENT_TITLE, READONLY,
METATYPE, OBJ_TYPE, PRE_GROUP ) VALUES (
'N', 'lom/lifeCycle/contribute', 'entity', '개발업체명', 'Y', 'LOM', 'COA', 1);
INSERT INTO TB_LCMS_METADATA_MAP ( SEARCH_YN, ELEMENT_PATH, ELEMENT_NAME, ELEMENT_TITLE, READONLY,
METATYPE, OBJ_TYPE, PRE_GROUP ) VALUES (
'N', 'lom/lifeCycle/contribute/date', 'dateTime', '제작날짜', 'Y', 'LOM', 'SCO', 1);
INSERT INTO TB_LCMS_METADATA_MAP ( SEARCH_YN, ELEMENT_PATH, ELEMENT_NAME, ELEMENT_TITLE, READONLY,
METATYPE, OBJ_TYPE, PRE_GROUP ) VALUES (
'N', 'lom/lifeCycle/contribute/date', 'dateTime', '제작날짜', 'Y', 'LOM', 'ITM', 1);
INSERT INTO TB_LCMS_METADATA_MAP ( SEARCH_YN, ELEMENT_PATH, ELEMENT_NAME, ELEMENT_TITLE, READONLY,
METATYPE, OBJ_TYPE, PRE_GROUP ) VALUES (
'N', 'lom/lifeCycle/contribute/date', 'dateTime', '제작날짜', 'Y', 'LOM', 'ORG', 1);
INSERT INTO TB_LCMS_METADATA_MAP ( SEARCH_YN, ELEMENT_PATH, ELEMENT_NAME, ELEMENT_TITLE, READONLY,
METATYPE, OBJ_TYPE, PRE_GROUP ) VALUES (
'N', 'lom/lifeCycle/contribute/date', 'dateTime', '제작날짜', 'Y', 'LOM', 'COA', 1);
INSERT INTO TB_LCMS_METADATA_MAP ( SEARCH_YN, ELEMENT_PATH, ELEMENT_NAME, ELEMENT_TITLE, READONLY,
METATYPE, OBJ_TYPE, PRE_GROUP ) VALUES (
'N', 'lom/rights/cost', 'value', '유료/무료', 'Y', 'LOM', 'SCO', 1);
INSERT INTO TB_LCMS_METADATA_MAP ( SEARCH_YN, ELEMENT_PATH, ELEMENT_NAME, ELEMENT_TITLE, READONLY,
METATYPE, OBJ_TYPE, PRE_GROUP ) VALUES (
'N', 'lom/rights/cost', 'value', '유료/무료', 'Y', 'LOM', 'ITM', 1);
INSERT INTO TB_LCMS_METADATA_MAP ( SEARCH_YN, ELEMENT_PATH, ELEMENT_NAME, ELEMENT_TITLE, READONLY,
METATYPE, OBJ_TYPE, PRE_GROUP ) VALUES (
'N', 'lom/rights/cost', 'value', '유료/무료', 'Y', 'LOM', 'ORG', 1);
INSERT INTO TB_LCMS_METADATA_MAP ( SEARCH_YN, ELEMENT_PATH, ELEMENT_NAME, ELEMENT_TITLE, READONLY,
METATYPE, OBJ_TYPE, PRE_GROUP ) VALUES (
'N', 'lom/rights/cost', 'value', '유료/무료', 'Y', 'LOM', 'COA', 1);
INSERT INTO TB_LCMS_METADATA_MAP ( SEARCH_YN, ELEMENT_PATH, ELEMENT_NAME, ELEMENT_TITLE, READONLY,
METATYPE, OBJ_TYPE, PRE_GROUP ) VALUES (
'N', 'lom/general/title', 'string', '타이틀', 'Y', 'LOM', 'TEMPLATE', 1);
INSERT INTO TB_LCMS_METADATA_MAP ( SEARCH_YN, ELEMENT_PATH, ELEMENT_NAME, ELEMENT_TITLE, READONLY,
METATYPE, OBJ_TYPE, PRE_GROUP ) VALUES (
'N', 'lom/general/keyword', 'string', '키워드', 'Y', 'LOM', 'TEMPLATE', 1);
INSERT INTO TB_LCMS_METADATA_MAP ( SEARCH_YN, ELEMENT_PATH, ELEMENT_NAME, ELEMENT_TITLE, READONLY,
METATYPE, OBJ_TYPE, PRE_GROUP ) VALUES (
'N', 'lom/general/description', 'string', '설명', 'Y', 'LOM', 'TEMPLATE', 1);
INSERT INTO TB_LCMS_METADATA_MAP ( SEARCH_YN, ELEMENT_PATH, ELEMENT_NAME, ELEMENT_TITLE, READONLY,
METATYPE, OBJ_TYPE, PRE_GROUP ) VALUES (
'N', 'lom/technical', 'format', '강의유형', 'Y', 'LOM', 'TEMPLATE', 1);
INSERT INTO TB_LCMS_METADATA_MAP ( SEARCH_YN, ELEMENT_PATH, ELEMENT_NAME, ELEMENT_TITLE, READONLY,
METATYPE, OBJ_TYPE, PRE_GROUP ) VALUES (
'N', 'lom/educational/difficulty', 'value', '난이도', 'Y', 'LOM', 'TEMPLATE', 1);
INSERT INTO TB_LCMS_METADATA_MAP ( SEARCH_YN, ELEMENT_PATH, ELEMENT_NAME, ELEMENT_TITLE, READONLY,
METATYPE, OBJ_TYPE, PRE_GROUP ) VALUES (
'N', 'lom/educational/description', 'string', '총학습분량', 'Y', 'LOM', 'TEMPLATE'
, 1);
INSERT INTO TB_LCMS_METADATA_MAP ( SEARCH_YN, ELEMENT_PATH, ELEMENT_NAME, ELEMENT_TITLE, READONLY,
METATYPE, OBJ_TYPE, PRE_GROUP ) VALUES (
'N', 'lom/general', 'language', '언어', 'Y', 'LOM', 'TEMPLATE', 1);
INSERT INTO TB_LCMS_METADATA_MAP ( SEARCH_YN, ELEMENT_PATH, ELEMENT_NAME, ELEMENT_TITLE, READONLY,
METATYPE, OBJ_TYPE, PRE_GROUP ) VALUES (
'N', 'lom/lifeCycle/version', 'string', '버전', 'Y', 'LOM', 'TEMPLATE', 1);
INSERT INTO TB_LCMS_METADATA_MAP ( SEARCH_YN, ELEMENT_PATH, ELEMENT_NAME, ELEMENT_TITLE, READONLY,
METATYPE, OBJ_TYPE, PRE_GROUP ) VALUES (
'N', 'lom/lifeCycle/status', 'value', '버전상태', 'Y', 'LOM', 'TEMPLATE', 1);
INSERT INTO TB_LCMS_METADATA_MAP ( SEARCH_YN, ELEMENT_PATH, ELEMENT_NAME, ELEMENT_TITLE, READONLY,
METATYPE, OBJ_TYPE, PRE_GROUP ) VALUES (
'N', 'lom/lifeCycle/contribute/role', 'value', '담당교수', 'Y', 'LOM', 'TEMPLATE'
, 1);
INSERT INTO TB_LCMS_METADATA_MAP ( SEARCH_YN, ELEMENT_PATH, ELEMENT_NAME, ELEMENT_TITLE, READONLY,
METATYPE, OBJ_TYPE, PRE_GROUP ) VALUES (
'N', 'lom/lifeCycle/contribute', 'entity', '개발업체명', 'Y', 'LOM', 'TEMPLATE', 1);
INSERT INTO TB_LCMS_METADATA_MAP ( SEARCH_YN, ELEMENT_PATH, ELEMENT_NAME, ELEMENT_TITLE, READONLY,
METATYPE, OBJ_TYPE, PRE_GROUP ) VALUES (
'N', 'lom/lifeCycle/contribute/date', 'dateTime', '제작날짜', 'Y', 'LOM', 'TEMPLATE'
, 1);
INSERT INTO TB_LCMS_METADATA_MAP ( SEARCH_YN, ELEMENT_PATH, ELEMENT_NAME, ELEMENT_TITLE, READONLY,
METATYPE, OBJ_TYPE, PRE_GROUP ) VALUES (
'N', 'lom/rights/cost', 'value', '유료/무료', 'Y', 'LOM', 'TEMPLATE', 1);
INSERT INTO TB_LCMS_METADATA_MAP ( SEARCH_YN, ELEMENT_PATH, ELEMENT_NAME, ELEMENT_TITLE, READONLY,
METATYPE, OBJ_TYPE, PRE_GROUP ) VALUES (
'N', 'kem/general/title', 'string', '제목', 'Y', 'KEM', 'COA', 1);
INSERT INTO TB_LCMS_METADATA_MAP ( SEARCH_YN, ELEMENT_PATH, ELEMENT_NAME, ELEMENT_TITLE, READONLY,
METATYPE, OBJ_TYPE, PRE_GROUP ) VALUES (
'N', 'kem/general/title', 'string', '제목', 'Y', 'KEM', 'ORG', 1);
INSERT INTO TB_LCMS_METADATA_MAP ( SEARCH_YN, ELEMENT_PATH, ELEMENT_NAME, ELEMENT_TITLE, READONLY,
METATYPE, OBJ_TYPE, PRE_GROUP ) VALUES (
'N', 'kem/general/title', 'string', '제목', 'Y', 'KEM', 'SCO', 1);
INSERT INTO TB_LCMS_METADATA_MAP ( SEARCH_YN, ELEMENT_PATH, ELEMENT_NAME, ELEMENT_TITLE, READONLY,
METATYPE, OBJ_TYPE, PRE_GROUP ) VALUES (
'N', 'kem/general/title', 'string', '제목', 'Y', 'KEM', 'ITM', 1);
INSERT INTO TB_LCMS_METADATA_MAP ( SEARCH_YN, ELEMENT_PATH, ELEMENT_NAME, ELEMENT_TITLE, READONLY,
METATYPE, OBJ_TYPE, PRE_GROUP ) VALUES (
'N', 'kem/general/subTitle', 'string', '부제', 'Y', 'KEM', 'ORG', 1);
INSERT INTO TB_LCMS_METADATA_MAP ( SEARCH_YN, ELEMENT_PATH, ELEMENT_NAME, ELEMENT_TITLE, READONLY,
METATYPE, OBJ_TYPE, PRE_GROUP ) VALUES (
'N', 'kem/general/subTitle', 'string', '부제', 'Y', 'KEM', 'COA', 1);
INSERT INTO TB_LCMS_METADATA_MAP ( SEARCH_YN, ELEMENT_PATH, ELEMENT_NAME, ELEMENT_TITLE, READONLY,
METATYPE, OBJ_TYPE, PRE_GROUP ) VALUES (
'N', 'kem/general/subTitle', 'string', '부제', 'Y', 'KEM', 'SCO', 1);
INSERT INTO TB_LCMS_METADATA_MAP ( SEARCH_YN, ELEMENT_PATH, ELEMENT_NAME, ELEMENT_TITLE, READONLY,
METATYPE, OBJ_TYPE, PRE_GROUP ) VALUES (
'N', 'kem/general/subTitle', 'string', '부제', 'Y', 'KEM', 'ITM', 1);
INSERT INTO TB_LCMS_METADATA_MAP ( SEARCH_YN, ELEMENT_PATH, ELEMENT_NAME, ELEMENT_TITLE, READONLY,
METATYPE, OBJ_TYPE, PRE_GROUP ) VALUES (
'N', 'kem/general/tableOfContents', 'string', '목차', 'Y', 'KEM', 'COA', 1);
INSERT INTO TB_LCMS_METADATA_MAP ( SEARCH_YN, ELEMENT_PATH, ELEMENT_NAME, ELEMENT_TITLE, READONLY,
METATYPE, OBJ_TYPE, PRE_GROUP ) VALUES (
'N', 'kem/general/tableOfContents', 'string', '목차', 'Y', 'KEM', 'ORG', 1);
INSERT INTO TB_LCMS_METADATA_MAP ( SEARCH_YN, ELEMENT_PATH, ELEMENT_NAME, ELEMENT_TITLE, READONLY,
METATYPE, OBJ_TYPE, PRE_GROUP ) VALUES (
'N', 'kem/general/tableOfContents', 'string', '목차', 'Y', 'KEM', 'ITM', 1);
INSERT INTO TB_LCMS_METADATA_MAP ( SEARCH_YN, ELEMENT_PATH, ELEMENT_NAME, ELEMENT_TITLE, READONLY,
METATYPE, OBJ_TYPE, PRE_GROUP ) VALUES (
'N', 'kem/general/tableOfContents', 'string', '목차', 'Y', 'KEM', 'SCO', 1);
INSERT INTO TB_LCMS_METADATA_MAP ( SEARCH_YN, ELEMENT_PATH, ELEMENT_NAME, ELEMENT_TITLE, READONLY,
METATYPE, OBJ_TYPE, PRE_GROUP ) VALUES (
'N', 'kem/educational/pedagogy/teachingMethod', 'string', '교수방법', 'Y', 'KEM', 'COA'
, 1);
INSERT INTO TB_LCMS_METADATA_MAP ( SEARCH_YN, ELEMENT_PATH, ELEMENT_NAME, ELEMENT_TITLE, READONLY,
METATYPE, OBJ_TYPE, PRE_GROUP ) VALUES (
'N', 'kem/educational/pedagogy/teachingMethod', 'string', '교수방법', 'Y', 'KEM', 'SCO'
, 1);
INSERT INTO TB_LCMS_METADATA_MAP ( SEARCH_YN, ELEMENT_PATH, ELEMENT_NAME, ELEMENT_TITLE, READONLY,
METATYPE, OBJ_TYPE, PRE_GROUP ) VALUES (
'N', 'kem/educational/pedagogy/teachingMethod', 'string', '교수방법', 'Y', 'KEM', 'ITM'
, 1);
INSERT INTO TB_LCMS_METADATA_MAP ( SEARCH_YN, ELEMENT_PATH, ELEMENT_NAME, ELEMENT_TITLE, READONLY,
METATYPE, OBJ_TYPE, PRE_GROUP ) VALUES (
'N', 'kem/educational/pedagogy/teachingMethod', 'string', '교수방법', 'Y', 'KEM', 'ORG'
, 1);
INSERT INTO TB_LCMS_METADATA_MAP ( SEARCH_YN, ELEMENT_PATH, ELEMENT_NAME, ELEMENT_TITLE, READONLY,
METATYPE, OBJ_TYPE, PRE_GROUP ) VALUES (
'N', 'kem/educational/pedagogy/environment', 'string', '환경', 'Y', 'KEM', 'COA', 1);
INSERT INTO TB_LCMS_METADATA_MAP ( SEARCH_YN, ELEMENT_PATH, ELEMENT_NAME, ELEMENT_TITLE, READONLY,
METATYPE, OBJ_TYPE, PRE_GROUP ) VALUES (
'N', 'kem/educational/pedagogy/environment', 'string', '환경', 'Y', 'KEM', 'ORG', 1);
INSERT INTO TB_LCMS_METADATA_MAP ( SEARCH_YN, ELEMENT_PATH, ELEMENT_NAME, ELEMENT_TITLE, READONLY,
METATYPE, OBJ_TYPE, PRE_GROUP ) VALUES (
'N', 'kem/educational/pedagogy/environment', 'string', '환경', 'Y', 'KEM', 'ITM', 1);
INSERT INTO TB_LCMS_METADATA_MAP ( SEARCH_YN, ELEMENT_PATH, ELEMENT_NAME, ELEMENT_TITLE, READONLY,
METATYPE, OBJ_TYPE, PRE_GROUP ) VALUES (
'N', 'kem/educational/pedagogy/environment', 'string', '환경', 'Y', 'KEM', 'SCO', 1);
INSERT INTO TB_LCMS_METADATA_MAP ( SEARCH_YN, ELEMENT_PATH, ELEMENT_NAME, ELEMENT_TITLE, READONLY,
METATYPE, OBJ_TYPE, PRE_GROUP ) VALUES (
'N', 'kem/educational/pedagogy/assessment', 'string', '평가', 'Y', 'KEM', 'COA', 1);
INSERT INTO TB_LCMS_METADATA_MAP ( SEARCH_YN, ELEMENT_PATH, ELEMENT_NAME, ELEMENT_TITLE, READONLY,
METATYPE, OBJ_TYPE, PRE_GROUP ) VALUES (
'N', 'kem/educational/pedagogy/assessment', 'string', '평가', 'Y', 'KEM', 'ORG', 1);
INSERT INTO TB_LCMS_METADATA_MAP ( SEARCH_YN, ELEMENT_PATH, ELEMENT_NAME, ELEMENT_TITLE, READONLY,
METATYPE, OBJ_TYPE, PRE_GROUP ) VALUES (
'N', 'kem/educational/pedagogy/assessment', 'string', '평가', 'Y', 'KEM', 'ITM', 1);
commit;
|
DROP DATABASE IF EXISTS sample;
CREATE DATABASE sample;
USE sample;
CREATE TABLE emp(
code INTEGER PRIMARY KEY ,
name TEXT,
age INTEGER,
tel TEXT
);
-- INSERT INTO emp VALUES (1,);
insert into emp values (1,"鈴木",30,"03-1111-1111");
insert into emp values (2,"佐藤",28,"043-2222-2222");
insert into emp values (3,"田中",46,"05-3333-3333");
insert into emp values (4,"山田",57,"076-4444-4444");
insert into emp values (5,"木村",31,"076-5555-5555");
select * from emp; |
-- phpMyAdmin SQL Dump
-- version 4.5.5.1
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: Mar 23, 2017 at 04:13 PM
-- Server version: 5.7.11
-- PHP Version: 5.6.19
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `variateur`
--
-- --------------------------------------------------------
--
-- Table structure for table `adresse_ip`
--
CREATE TABLE `adresse_ip` (
`id` int(255) NOT NULL,
`ipadress` varchar(255) NOT NULL,
`Vitnom` varchar(255) NOT NULL,
`Inom` varchar(255) NOT NULL,
`Vnom` varchar(255) NOT NULL,
`Pnom` varchar(255) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Dumping data for table `adresse_ip`
--
INSERT INTO `adresse_ip` (`id`, `ipadress`, `Vitnom`, `Inom`, `Vnom`, `Pnom`) VALUES
(1, '172.16.121.85', '100', '300', '200', '400');
-- --------------------------------------------------------
--
-- Table structure for table `consigne`
--
CREATE TABLE `consigne` (
`id` int(255) NOT NULL,
`frequence` varchar(255) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Dumping data for table `consigne`
--
INSERT INTO `consigne` (`id`, `frequence`) VALUES
(1, '0');
-- --------------------------------------------------------
--
-- Table structure for table `courant`
--
CREATE TABLE `courant` (
`id` int(11) NOT NULL,
`courant` varchar(255) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Dumping data for table `courant`
--
INSERT INTO `courant` (`id`, `courant`) VALUES
(1, '1,5 A');
-- --------------------------------------------------------
--
-- Table structure for table `membres`
--
CREATE TABLE `membres` (
`Num_membre` int(32) NOT NULL,
`login` char(255) DEFAULT NULL,
`motdepass` char(255) DEFAULT NULL,
`groupe` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `membres`
--
INSERT INTO `membres` (`Num_membre`, `login`, `motdepass`, `groupe`) VALUES
(1, 'USER', '6eb0c61201a96afc99cbf180f1c8d93c0a9fd8c8', 'Simple utilisateur'),
(2, 'Thier', '7a85f4764bbd6daf1c3545efbbf0f279a6dc0beb', 'Simple utilisateur'),
(3, 'Quentin', '03e7c389511baccb5e28b21d845c243fa10dd58c', 'Simple utilisateur'),
(4, 'Alex', '60c6d277a8bd81de7fdde19201bf9c58a3df08f4', 'Administrateur'),
(5, 'Try', '72677028b4d0d41af475041fdbe030f7c7146d2c', 'Simple utilisateur'),
(6, 'Mik', '406bcabd9a6da455ab1881b83041063ce99648db', 'Simple utilisateur');
-- --------------------------------------------------------
--
-- Table structure for table `reglages`
--
CREATE TABLE `reglages` (
`id` int(255) NOT NULL,
`connexion_variateur` varchar(255) NOT NULL,
`testmoteur` varchar(32) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Dumping data for table `reglages`
--
INSERT INTO `reglages` (`id`, `connexion_variateur`, `testmoteur`) VALUES
(1, 'on', 'off');
-- --------------------------------------------------------
--
-- Table structure for table `sens`
--
CREATE TABLE `sens` (
`id` int(11) NOT NULL,
`sens` varchar(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `sens`
--
INSERT INTO `sens` (`id`, `sens`) VALUES
(1, '0');
-- --------------------------------------------------------
--
-- Table structure for table `vitesse`
--
CREATE TABLE `vitesse` (
`id` int(11) NOT NULL,
`vitesse` varchar(255) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Dumping data for table `vitesse`
--
INSERT INTO `vitesse` (`id`, `vitesse`) VALUES
(1, '3000'),
(2, '3000'),
(3, '3000'),
(4, '3000'),
(5, '3000'),
(6, '3000'),
(7, '3000'),
(8, '3000'),
(9, '3000'),
(10, '3000'),
(11, '3000'),
(12, '3000'),
(13, '3000'),
(14, '3000'),
(15, '3000'),
(16, '3000'),
(17, '3000'),
(18, '3000'),
(19, '3000'),
(20, '3000');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `adresse_ip`
--
ALTER TABLE `adresse_ip`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `consigne`
--
ALTER TABLE `consigne`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `courant`
--
ALTER TABLE `courant`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `membres`
--
ALTER TABLE `membres`
ADD PRIMARY KEY (`Num_membre`);
--
-- Indexes for table `reglages`
--
ALTER TABLE `reglages`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `sens`
--
ALTER TABLE `sens`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `vitesse`
--
ALTER TABLE `vitesse`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `adresse_ip`
--
ALTER TABLE `adresse_ip`
MODIFY `id` int(255) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `consigne`
--
ALTER TABLE `consigne`
MODIFY `id` int(255) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `courant`
--
ALTER TABLE `courant`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=34;
--
-- AUTO_INCREMENT for table `membres`
--
ALTER TABLE `membres`
MODIFY `Num_membre` int(32) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
--
-- AUTO_INCREMENT for table `reglages`
--
ALTER TABLE `reglages`
MODIFY `id` int(255) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `sens`
--
ALTER TABLE `sens`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `vitesse`
--
ALTER TABLE `vitesse`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=21;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
-- +migrate up
ALTER TABLE "public"."bingo_plays"
ADD COLUMN "round" integer;
-- +migrate down
ALTER TABLE "public"."bingo_plays"
DROP COLUMN "round";
|
select funnelstage as title, median, mean from roberto_salcido899.funneltestv2_sheet1
|
-- phpMyAdmin SQL Dump
-- version 4.8.3
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Nov 13, 2018 at 10:14 PM
-- Server version: 10.1.36-MariaDB
-- PHP Version: 7.2.10
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+03: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: `flintstones_db`
--
CREATE DATABASE IF NOT EXISTS `flintstones_db` DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_520_ci;
USE `flintstones_db`;
-- --------------------------------------------------------
--
-- Table structure for table `allocate_item`
--
CREATE TABLE `allocate_item` (
`id` int(11) NOT NULL,
`request_id` int(11) NOT NULL,
`equipment_id` varchar(50) COLLATE utf8_unicode_520_ci NOT NULL,
`allocate_from` int(11) NOT NULL,
`allocate_to` int(11) NOT NULL,
`transportation_cost` decimal(10,0) NOT NULL,
`allocation_date` date NOT NULL,
`om_approved` tinyint(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_520_ci;
-- --------------------------------------------------------
--
-- Table structure for table `allocation_request`
--
CREATE TABLE `allocation_request` (
`id` int(11) NOT NULL,
`machine_id` int(11) NOT NULL,
`unit` varchar(30) COLLATE utf8_unicode_520_ci NOT NULL,
`quantity` int(11) NOT NULL,
`site_id` int(11) NOT NULL,
`delivery_date` date NOT NULL,
`duration` int(11) NOT NULL,
`work_type` varchar(100) COLLATE utf8_unicode_520_ci NOT NULL,
`work_zone` varchar(150) COLLATE utf8_unicode_520_ci NOT NULL,
`volume_of_work` varchar(100) COLLATE utf8_unicode_520_ci NOT NULL,
`requested_by` varchar(15) COLLATE utf8_unicode_520_ci NOT NULL,
`remark` varchar(200) COLLATE utf8_unicode_520_ci NOT NULL,
`request_status` int(11) NOT NULL DEFAULT '1',
`allocated_item_no` int(11) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_520_ci;
-- --------------------------------------------------------
--
-- Table structure for table `department`
--
CREATE TABLE `department` (
`id` int(11) NOT NULL,
`department_name` varchar(100) COLLATE utf8_unicode_520_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_520_ci;
--
-- Dumping data for table `department`
--
INSERT INTO `department` (`id`, `department_name`) VALUES
(1, 'Human Resource'),
(2, 'Finance'),
(3, 'Equipment'),
(4, 'Engineering'),
(5, 'Drivers'),
(6, 'Technicians'),
(7, 'Contract'),
(8, 'Marketing'),
(9, 'Operators');
-- --------------------------------------------------------
--
-- Table structure for table `equipment_list`
--
CREATE TABLE `equipment_list` (
`equipment_id` varchar(50) COLLATE utf8_unicode_520_ci NOT NULL,
`machine_id` int(11) NOT NULL,
`plate_number` varchar(50) COLLATE utf8_unicode_520_ci NOT NULL,
`manufactured_year` year(4) NOT NULL,
`current_location` int(11) NOT NULL,
`current_status` int(11) NOT NULL,
`Investment_cost` decimal(10,0) NOT NULL,
`serviced_every` int(11) NOT NULL,
`equipment_type` int(11) NOT NULL,
`insurance_status` int(11) NOT NULL,
`operator_id` varchar(15) COLLATE utf8_unicode_520_ci DEFAULT NULL,
`registered_date` date NOT NULL,
`depreciated_cost` decimal(10,0) NOT NULL DEFAULT '0',
`supplied_by` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_520_ci;
-- --------------------------------------------------------
--
-- Table structure for table `equipment_productivity_control`
--
CREATE TABLE `equipment_productivity_control` (
`id` int(11) NOT NULL,
`Date` date NOT NULL,
`equipment_id` varchar(50) COLLATE utf8_unicode_520_ci NOT NULL,
`activity_detail` varchar(300) COLLATE utf8_unicode_520_ci NOT NULL,
`morning_start_at` decimal(10,0) NOT NULL,
`morning_end_at` decimal(10,0) NOT NULL,
`afternoon_start_at` decimal(10,0) NOT NULL,
`afternoon_end_at` decimal(10,0) NOT NULL,
`Idle_time` float NOT NULL,
`idle_reason` varchar(150) COLLATE utf8_unicode_520_ci NOT NULL,
`fuel_used` decimal(10,0) NOT NULL,
`site_productivity` decimal(10,0) NOT NULL,
`user_id` varchar(15) COLLATE utf8_unicode_520_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_520_ci;
-- --------------------------------------------------------
--
-- Table structure for table `equipment_purchase_request`
--
CREATE TABLE `equipment_purchase_request` (
`id` int(11) NOT NULL,
`group_id` varchar(30) COLLATE utf8_unicode_520_ci NOT NULL,
`machine_id` int(11) NOT NULL,
`unit` varchar(30) COLLATE utf8_unicode_520_ci NOT NULL,
`quantity` int(11) NOT NULL,
`site_id` int(11) NOT NULL,
`reason` varchar(500) COLLATE utf8_unicode_520_ci NOT NULL,
`price` decimal(10,0) NOT NULL,
`remarks` varchar(500) COLLATE utf8_unicode_520_ci NOT NULL,
`om_approved` tinyint(1) NOT NULL,
`om_remarks` varchar(500) COLLATE utf8_unicode_520_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_520_ci;
-- --------------------------------------------------------
--
-- Table structure for table `equipment_status`
--
CREATE TABLE `equipment_status` (
`status_id` int(11) NOT NULL,
`status_name` varchar(20) COLLATE utf8_unicode_520_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_520_ci;
--
-- Dumping data for table `equipment_status`
--
INSERT INTO `equipment_status` (`status_id`, `status_name`) VALUES
(1, 'In Store'),
(2, 'Working'),
(3, 'On Maintainance'),
(4, 'Not Working'),
(5, 'Sold'),
(6, 'Renturned'),
(7, 'Being Serviced');
-- --------------------------------------------------------
--
-- Table structure for table `equipment_type`
--
CREATE TABLE `equipment_type` (
`id` int(11) NOT NULL,
`type_name` varchar(50) COLLATE utf8_unicode_520_ci NOT NULL,
`equipment_type_abbr` varchar(2) COLLATE utf8_unicode_520_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_520_ci;
--
-- Dumping data for table `equipment_type`
--
INSERT INTO `equipment_type` (`id`, `type_name`, `equipment_type_abbr`) VALUES
(3, 'Rented', 'RT'),
(4, 'Purchased', 'PR');
-- --------------------------------------------------------
--
-- Table structure for table `insurance_payment`
--
CREATE TABLE `insurance_payment` (
`id` int(11) NOT NULL,
`equipment_id` varchar(50) COLLATE utf8_unicode_520_ci NOT NULL,
`value_payed` decimal(10,0) NOT NULL,
`payment_date` date NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_520_ci;
-- --------------------------------------------------------
--
-- Table structure for table `insurance_statuses`
--
CREATE TABLE `insurance_statuses` (
`id` int(11) NOT NULL,
`insurance_status_name` varchar(25) COLLATE utf8_unicode_520_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_520_ci;
--
-- Dumping data for table `insurance_statuses`
--
INSERT INTO `insurance_statuses` (`id`, `insurance_status_name`) VALUES
(1, 'Insured'),
(2, 'Not Insured');
-- --------------------------------------------------------
--
-- Table structure for table `machines`
--
CREATE TABLE `machines` (
`machine_id` int(11) NOT NULL,
`machine_name` varchar(200) COLLATE utf8_unicode_520_ci NOT NULL,
`major_functions` int(11) NOT NULL,
`machine_model` varchar(30) COLLATE utf8_unicode_520_ci NOT NULL,
`machine_product_unit` varchar(50) COLLATE utf8_unicode_520_ci NOT NULL DEFAULT 'km per hour',
`machine_capacity` int(11) NOT NULL,
`machine_group` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_520_ci;
--
-- Dumping data for table `machines`
--
INSERT INTO `machines` (`machine_id`, `machine_name`, `major_functions`, `machine_model`, `machine_product_unit`, `machine_capacity`, `machine_group`) VALUES
(1, 'Big Mixer-750L-diesel', 1, 'BIG', 'Hours', 750, 1),
(2, 'BIG Mixer-750-Electrical', 1, 'big', 'hours', 750, 1),
(3, 'SMALL MIXER-350L-Electrical', 1, 'small', 'hours', 350, 1),
(4, 'SMALL MIXER-350L-Diesel', 1, 'small', 'hours', 350, 1),
(5, 'VIBRATOR ENGINE', 1, '', 'hours', 0, 1),
(6, 'VIBRATOR HOSE', 1, '', 'hours', 0, 1),
(7, 'BATCHING PLANT', 1, '', 'hours', 0, 2),
(8, 'TRUCKMIXER', 1, 'ZZ1257N4048W', 'hours', 9, 2),
(9, 'NEW TRUCKMIXER', 1, 'SY309C', 'hours', 9, 2),
(10, 'KOBELKO CRANE', 1, 'RR70M', 'hours', 0, 2),
(11, 'FIORI', 1, 'DB-260', 'hours', 2, 2),
(12, 'FIORI 2', 1, 'DB460', 'hours', 3, 2),
(13, 'CONCRETE PUMP new', 1, 'SANY HBT6013C-5D', 'hours', 9, 2),
(14, 'CONCRETE PUMP ', 1, 'SANY', 'hours', 9, 2),
(15, 'Dozer', 2, 'DZ-117 ', 'hours', 158, 2),
(16, 'LOADER', 2, 'SIEM 659B', 'hours', 3, 2),
(17, 'LOADER 2', 2, 'XCMG', 'hours', 3, 2),
(18, 'JACK HAMMER', 2, '', 'hours', 0, 2),
(19, 'POWER PLUS GRADER', 2, 'PP14G-VI', 'hours', 0, 2),
(20, 'POWER PLUS ROLLER', 2, 'CV302PD3', 'hours', 0, 2),
(21, 'BACK HOE LOADER CAT', 2, '420D', 'hours', 1, 2),
(22, 'BACK HOE LOADER CAT 2', 2, '428B', 'hours', 1, 2);
-- --------------------------------------------------------
--
-- Table structure for table `machine_functions`
--
CREATE TABLE `machine_functions` (
`id` int(11) NOT NULL,
`machine_function_name` varchar(50) COLLATE utf8_unicode_520_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_520_ci;
--
-- Dumping data for table `machine_functions`
--
INSERT INTO `machine_functions` (`id`, `machine_function_name`) VALUES
(1, 'Concreting equipment'),
(2, 'Earth work equipment'),
(3, ' Construction Vehicle'),
(4, 'Laboratory equipment'),
(5, 'Material hoisting equipment'),
(6, 'Rebar cutter and Aluminum eqt'),
(7, 'Support and Utility service'),
(8, 'Vehicles'),
(9, 'other');
-- --------------------------------------------------------
--
-- Table structure for table `machine_groups`
--
CREATE TABLE `machine_groups` (
`machine_group_id` int(11) NOT NULL,
`machine_group_name` varchar(50) COLLATE utf8_unicode_520_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_520_ci;
--
-- Dumping data for table `machine_groups`
--
INSERT INTO `machine_groups` (`machine_group_id`, `machine_group_name`) VALUES
(1, 'Light duty machine'),
(2, 'Heavy duty machine'),
(3, 'Small Vehicles'),
(4, 'Trucks'),
(5, 'Others');
-- --------------------------------------------------------
--
-- Table structure for table `maintainance_priority`
--
CREATE TABLE `maintainance_priority` (
`id` int(11) NOT NULL,
`priority_name` varchar(20) COLLATE utf8_unicode_520_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_520_ci;
--
-- Dumping data for table `maintainance_priority`
--
INSERT INTO `maintainance_priority` (`id`, `priority_name`) VALUES
(1, 'Low'),
(2, 'Medium'),
(3, 'High');
-- --------------------------------------------------------
--
-- Table structure for table `maintainance_request`
--
CREATE TABLE `maintainance_request` (
`maintainance_id` int(11) NOT NULL,
`equipment_id` varchar(50) COLLATE utf8_unicode_520_ci NOT NULL,
`maintainance_request_date` date NOT NULL,
`maintainance_requested_completion` date NOT NULL,
`maintainance_problem` varchar(1000) COLLATE utf8_unicode_520_ci NOT NULL,
`requested_by` varchar(15) COLLATE utf8_unicode_520_ci NOT NULL,
`request_status` int(11) NOT NULL DEFAULT '1',
`em_approved` tinyint(1) NOT NULL DEFAULT '0',
`work_order_Id` varchar(25) COLLATE utf8_unicode_520_ci DEFAULT NULL,
`maintainance_sparepart_cost` int(11) DEFAULT NULL,
`maintainance_labor_cost` int(11) DEFAULT NULL,
`maintainance_status` int(11) NOT NULL DEFAULT '1',
`maintainance_priority` int(11) DEFAULT NULL,
`maintainance_completion_date` date DEFAULT NULL,
`om_approved` tinyint(1) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_520_ci;
-- --------------------------------------------------------
--
-- Table structure for table `maintainance_status`
--
CREATE TABLE `maintainance_status` (
`id` int(11) NOT NULL,
`maintainance_status` varchar(20) COLLATE utf8_unicode_520_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_520_ci;
--
-- Dumping data for table `maintainance_status`
--
INSERT INTO `maintainance_status` (`id`, `maintainance_status`) VALUES
(1, 'Pending'),
(2, 'On-Progress'),
(3, 'Completed');
-- --------------------------------------------------------
--
-- Table structure for table `project_list`
--
CREATE TABLE `project_list` (
`id` int(11) NOT NULL,
`Code` varchar(5) COLLATE utf8_unicode_520_ci NOT NULL,
`Name` varchar(30) COLLATE utf8_unicode_520_ci NOT NULL,
`Status` varchar(15) COLLATE utf8_unicode_520_ci NOT NULL DEFAULT 'On Progress'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_520_ci;
-- --------------------------------------------------------
--
-- Table structure for table `request_status`
--
CREATE TABLE `request_status` (
`id` int(11) NOT NULL,
`name` varchar(15) COLLATE utf8_unicode_520_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_520_ci;
--
-- Dumping data for table `request_status`
--
INSERT INTO `request_status` (`id`, `name`) VALUES
(1, 'unseen'),
(2, 'seen'),
(3, 'approved'),
(4, 'Discarded'),
(5, 'completed');
-- --------------------------------------------------------
--
-- Table structure for table `service_request`
--
CREATE TABLE `service_request` (
`id` int(11) NOT NULL,
`equipment_id` varchar(50) COLLATE utf8_unicode_520_ci NOT NULL,
`request_date` date NOT NULL,
`requested_by` varchar(15) COLLATE utf8_unicode_520_ci NOT NULL,
`service_status` int(11) NOT NULL DEFAULT '1',
`em_approved` tinyint(1) NOT NULL,
`om_approved` tinyint(1) NOT NULL,
`service_completion_date` date NOT NULL,
`service_labor_cost` decimal(10,0) NOT NULL,
`service_sparepart_cost` decimal(10,0) NOT NULL,
`serviced_at` decimal(10,0) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_520_ci;
-- --------------------------------------------------------
--
-- Table structure for table `sparepart_purchase`
--
CREATE TABLE `sparepart_purchase` (
`id` int(11) NOT NULL,
`work_id` varchar(25) COLLATE utf8_unicode_520_ci NOT NULL,
`item_description` varchar(500) COLLATE utf8_unicode_520_ci NOT NULL,
`Unit` varchar(15) COLLATE utf8_unicode_520_ci NOT NULL,
`qty` int(11) NOT NULL,
`om_approved` tinyint(1) NOT NULL DEFAULT '0',
`date_purchased` date DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_520_ci;
-- --------------------------------------------------------
--
-- Table structure for table `supplier_info`
--
CREATE TABLE `supplier_info` (
`supplier_id` int(11) NOT NULL,
`supplier_name` varchar(100) COLLATE utf8_unicode_520_ci NOT NULL,
`supplier_address` varchar(200) COLLATE utf8_unicode_520_ci NOT NULL,
`supplier_phone1` varchar(15) COLLATE utf8_unicode_520_ci NOT NULL,
`supplier_phone2` varchar(15) COLLATE utf8_unicode_520_ci NOT NULL,
`supplier_po_box` varchar(15) COLLATE utf8_unicode_520_ci NOT NULL,
`supplier_email` varchar(50) COLLATE utf8_unicode_520_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_520_ci;
-- --------------------------------------------------------
--
-- Table structure for table `transact_history`
--
CREATE TABLE `transact_history` (
`transact_id` int(11) NOT NULL,
`transact_time` datetime NOT NULL,
`transact_summary` varchar(100) COLLATE utf8_unicode_520_ci NOT NULL,
`userid` varchar(15) COLLATE utf8_unicode_520_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_520_ci;
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
CREATE TABLE `users` (
`user_id` varchar(15) COLLATE utf8_unicode_520_ci NOT NULL,
`user_name` varchar(25) COLLATE utf8_unicode_520_ci NOT NULL,
`user_fathername` varchar(25) COLLATE utf8_unicode_520_ci NOT NULL,
`user_department` int(11) NOT NULL,
`user_location` int(11) NOT NULL,
`user_email` varchar(50) COLLATE utf8_unicode_520_ci NOT NULL,
`user_phone` bigint(13) NOT NULL,
`user_password` varchar(32) COLLATE utf8_unicode_520_ci NOT NULL,
`user_level` int(11) NOT NULL,
`user_status` tinyint(1) NOT NULL DEFAULT '1'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_520_ci;
--
-- Dumping data for table `users`
--
INSERT INTO `users` (`user_id`, `user_name`, `user_fathername`, `user_department`, `user_location`, `user_email`, `user_phone`, `user_password`, `user_level`, `user_status`) VALUES
('AD-000', 'System', 'Admin', 6, 51, 'ok', 973111473, '789456123', 7, 0),
('FL-0001', 'Abiy', 'Melaku', 4, 51, 'abmlk@gmail.com', 251920320186, 'ab@123', 5, 1),
('MK200', 'Samuel', 'Rahimeto', 7, 43, 'samirahmt', 973111473, '0973111473', 7, 0);
-- --------------------------------------------------------
--
-- Table structure for table `user_levels`
--
CREATE TABLE `user_levels` (
`id` int(11) NOT NULL,
`user_level_name` varchar(150) COLLATE utf8_unicode_520_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_520_ci;
--
-- Dumping data for table `user_levels`
--
INSERT INTO `user_levels` (`id`, `user_level_name`) VALUES
(1, 'Senior Mechanic'),
(2, 'Site Engineer'),
(3, 'Project Manager'),
(4, 'Equipment Manager'),
(5, 'Operation Manager'),
(7, 'System Admin'),
(8, 'Equipment Foreman');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `allocate_item`
--
ALTER TABLE `allocate_item`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `equipment_id_2` (`equipment_id`,`allocate_to`),
ADD KEY `equipment_id` (`equipment_id`);
--
-- Indexes for table `allocation_request`
--
ALTER TABLE `allocation_request`
ADD PRIMARY KEY (`id`),
ADD KEY `machine_id` (`machine_id`),
ADD KEY `site_id` (`site_id`),
ADD KEY `request_status` (`request_status`),
ADD KEY `requested_by` (`requested_by`);
--
-- Indexes for table `department`
--
ALTER TABLE `department`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `equipment_list`
--
ALTER TABLE `equipment_list`
ADD PRIMARY KEY (`equipment_id`),
ADD KEY `current_status` (`current_status`),
ADD KEY `machine_id` (`machine_id`),
ADD KEY `current_location` (`current_location`),
ADD KEY `equipment_type` (`equipment_type`),
ADD KEY `operator_id` (`operator_id`),
ADD KEY `insurance_status` (`insurance_status`);
--
-- Indexes for table `equipment_productivity_control`
--
ALTER TABLE `equipment_productivity_control`
ADD PRIMARY KEY (`id`),
ADD KEY `user_id` (`user_id`),
ADD KEY `equipment_id` (`equipment_id`);
--
-- Indexes for table `equipment_purchase_request`
--
ALTER TABLE `equipment_purchase_request`
ADD PRIMARY KEY (`id`),
ADD KEY `machine_id` (`machine_id`),
ADD KEY `site_id` (`site_id`);
--
-- Indexes for table `equipment_status`
--
ALTER TABLE `equipment_status`
ADD PRIMARY KEY (`status_id`);
--
-- Indexes for table `equipment_type`
--
ALTER TABLE `equipment_type`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `insurance_payment`
--
ALTER TABLE `insurance_payment`
ADD PRIMARY KEY (`id`),
ADD KEY `equipment_id` (`equipment_id`);
--
-- Indexes for table `insurance_statuses`
--
ALTER TABLE `insurance_statuses`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `machines`
--
ALTER TABLE `machines`
ADD PRIMARY KEY (`machine_id`),
ADD KEY `major_functions` (`major_functions`),
ADD KEY `machin_group` (`machine_group`);
--
-- Indexes for table `machine_functions`
--
ALTER TABLE `machine_functions`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `machine_groups`
--
ALTER TABLE `machine_groups`
ADD PRIMARY KEY (`machine_group_id`);
--
-- Indexes for table `maintainance_priority`
--
ALTER TABLE `maintainance_priority`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `maintainance_request`
--
ALTER TABLE `maintainance_request`
ADD PRIMARY KEY (`maintainance_id`),
ADD UNIQUE KEY `work_order_Id_2` (`work_order_Id`),
ADD KEY `equipment_id` (`equipment_id`),
ADD KEY `inspecter_id` (`requested_by`),
ADD KEY `maintainance_priority` (`maintainance_priority`),
ADD KEY `maintainance_status` (`maintainance_status`),
ADD KEY `request_status` (`request_status`),
ADD KEY `work_order_Id` (`work_order_Id`);
--
-- Indexes for table `maintainance_status`
--
ALTER TABLE `maintainance_status`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `project_list`
--
ALTER TABLE `project_list`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `request_status`
--
ALTER TABLE `request_status`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `service_request`
--
ALTER TABLE `service_request`
ADD PRIMARY KEY (`id`),
ADD KEY `equipment_id` (`equipment_id`),
ADD KEY `requested_by` (`requested_by`),
ADD KEY `service_status` (`service_status`);
--
-- Indexes for table `sparepart_purchase`
--
ALTER TABLE `sparepart_purchase`
ADD PRIMARY KEY (`id`),
ADD KEY `work_id` (`work_id`);
--
-- Indexes for table `supplier_info`
--
ALTER TABLE `supplier_info`
ADD PRIMARY KEY (`supplier_id`);
--
-- Indexes for table `transact_history`
--
ALTER TABLE `transact_history`
ADD PRIMARY KEY (`transact_id`),
ADD KEY `userid` (`userid`);
--
-- Indexes for table `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`user_id`),
ADD UNIQUE KEY `user_email` (`user_email`),
ADD KEY `user_department` (`user_department`),
ADD KEY `user_location` (`user_location`),
ADD KEY `user_level` (`user_level`),
ADD KEY `user_status` (`user_status`),
ADD KEY `user_level_2` (`user_level`);
--
-- Indexes for table `user_levels`
--
ALTER TABLE `user_levels`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `allocate_item`
--
ALTER TABLE `allocate_item`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `allocation_request`
--
ALTER TABLE `allocation_request`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `department`
--
ALTER TABLE `department`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;
--
-- AUTO_INCREMENT for table `equipment_productivity_control`
--
ALTER TABLE `equipment_productivity_control`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `equipment_purchase_request`
--
ALTER TABLE `equipment_purchase_request`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `equipment_status`
--
ALTER TABLE `equipment_status`
MODIFY `status_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;
--
-- AUTO_INCREMENT for table `equipment_type`
--
ALTER TABLE `equipment_type`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT for table `insurance_payment`
--
ALTER TABLE `insurance_payment`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `insurance_statuses`
--
ALTER TABLE `insurance_statuses`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `machines`
--
ALTER TABLE `machines`
MODIFY `machine_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=23;
--
-- AUTO_INCREMENT for table `machine_functions`
--
ALTER TABLE `machine_functions`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;
--
-- AUTO_INCREMENT for table `machine_groups`
--
ALTER TABLE `machine_groups`
MODIFY `machine_group_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
--
-- AUTO_INCREMENT for table `maintainance_priority`
--
ALTER TABLE `maintainance_priority`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT for table `maintainance_request`
--
ALTER TABLE `maintainance_request`
MODIFY `maintainance_id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `maintainance_status`
--
ALTER TABLE `maintainance_status`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT for table `project_list`
--
ALTER TABLE `project_list`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `request_status`
--
ALTER TABLE `request_status`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
--
-- AUTO_INCREMENT for table `service_request`
--
ALTER TABLE `service_request`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `sparepart_purchase`
--
ALTER TABLE `sparepart_purchase`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `supplier_info`
--
ALTER TABLE `supplier_info`
MODIFY `supplier_id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `transact_history`
--
ALTER TABLE `transact_history`
MODIFY `transact_id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `user_levels`
--
ALTER TABLE `user_levels`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `allocation_request`
--
ALTER TABLE `allocation_request`
ADD CONSTRAINT `allocation_request_ibfk_1` FOREIGN KEY (`machine_id`) REFERENCES `machines` (`machine_id`),
ADD CONSTRAINT `allocation_request_ibfk_2` FOREIGN KEY (`site_id`) REFERENCES `project_list` (`id`),
ADD CONSTRAINT `allocation_request_ibfk_3` FOREIGN KEY (`request_status`) REFERENCES `request_status` (`id`),
ADD CONSTRAINT `allocation_request_ibfk_4` FOREIGN KEY (`requested_by`) REFERENCES `users` (`user_id`);
--
-- Constraints for table `equipment_list`
--
ALTER TABLE `equipment_list`
ADD CONSTRAINT `equipment_list_ibfk_1` FOREIGN KEY (`machine_id`) REFERENCES `machines` (`machine_id`),
ADD CONSTRAINT `equipment_list_ibfk_2` FOREIGN KEY (`current_location`) REFERENCES `project_list` (`id`),
ADD CONSTRAINT `equipment_list_ibfk_3` FOREIGN KEY (`current_status`) REFERENCES `equipment_status` (`status_id`),
ADD CONSTRAINT `equipment_list_ibfk_4` FOREIGN KEY (`equipment_type`) REFERENCES `equipment_type` (`id`),
ADD CONSTRAINT `equipment_list_ibfk_5` FOREIGN KEY (`insurance_status`) REFERENCES `insurance_statuses` (`id`);
--
-- Constraints for table `equipment_productivity_control`
--
ALTER TABLE `equipment_productivity_control`
ADD CONSTRAINT `equipment_productivity_control_ibfk_1` FOREIGN KEY (`equipment_id`) REFERENCES `equipment_list` (`equipment_id`),
ADD CONSTRAINT `equipment_productivity_control_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `users` (`user_id`);
--
-- Constraints for table `equipment_purchase_request`
--
ALTER TABLE `equipment_purchase_request`
ADD CONSTRAINT `equipment_purchase_request_ibfk_1` FOREIGN KEY (`machine_id`) REFERENCES `machines` (`machine_id`),
ADD CONSTRAINT `equipment_purchase_request_ibfk_2` FOREIGN KEY (`site_id`) REFERENCES `project_list` (`id`);
--
-- Constraints for table `insurance_payment`
--
ALTER TABLE `insurance_payment`
ADD CONSTRAINT `insurance_payment_ibfk_1` FOREIGN KEY (`equipment_id`) REFERENCES `equipment_list` (`equipment_id`);
--
-- Constraints for table `machines`
--
ALTER TABLE `machines`
ADD CONSTRAINT `machines_ibfk_1` FOREIGN KEY (`major_functions`) REFERENCES `machine_functions` (`id`),
ADD CONSTRAINT `machines_ibfk_2` FOREIGN KEY (`machine_group`) REFERENCES `machine_groups` (`machine_group_id`);
--
-- Constraints for table `maintainance_request`
--
ALTER TABLE `maintainance_request`
ADD CONSTRAINT `maintainance_request_ibfk_1` FOREIGN KEY (`requested_by`) REFERENCES `users` (`user_id`),
ADD CONSTRAINT `maintainance_request_ibfk_2` FOREIGN KEY (`equipment_id`) REFERENCES `equipment_list` (`equipment_id`),
ADD CONSTRAINT `maintainance_request_ibfk_4` FOREIGN KEY (`maintainance_priority`) REFERENCES `maintainance_priority` (`id`),
ADD CONSTRAINT `maintainance_request_ibfk_5` FOREIGN KEY (`request_status`) REFERENCES `request_status` (`id`);
--
-- Constraints for table `service_request`
--
ALTER TABLE `service_request`
ADD CONSTRAINT `service_request_ibfk_1` FOREIGN KEY (`service_status`) REFERENCES `maintainance_status` (`id`),
ADD CONSTRAINT `service_request_ibfk_2` FOREIGN KEY (`equipment_id`) REFERENCES `equipment_list` (`equipment_id`),
ADD CONSTRAINT `service_request_ibfk_3` FOREIGN KEY (`requested_by`) REFERENCES `users` (`user_id`);
--
-- Constraints for table `transact_history`
--
ALTER TABLE `transact_history`
ADD CONSTRAINT `transact_history_ibfk_1` FOREIGN KEY (`userid`) REFERENCES `users` (`user_id`);
--
-- Constraints for table `users`
--
ALTER TABLE `users`
ADD CONSTRAINT `users_ibfk_1` FOREIGN KEY (`user_level`) REFERENCES `user_levels` (`id`),
ADD CONSTRAINT `users_ibfk_2` FOREIGN KEY (`user_department`) REFERENCES `department` (`id`),
ADD CONSTRAINT `users_ibfk_3` FOREIGN KEY (`user_location`) REFERENCES `project_list` (`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 */;
|
-- phpMyAdmin SQL Dump
-- version 4.6.6deb5ubuntu0.5
-- https://www.phpmyadmin.net/
--
-- Host: localhost
-- Generation Time: May 25, 2021 at 04:01 AM
-- Server version: 5.7.34-0ubuntu0.18.04.1
-- PHP Version: 7.2.24-0ubuntu0.18.04.7
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: `movie_sys`
--
-- --------------------------------------------------------
--
-- Table structure for table `acounting`
--
CREATE TABLE `acounting` (
`employee_ID` int(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `acounting`
--
INSERT INTO `acounting` (`employee_ID`) VALUES
(153989),
(162402),
(231469),
(380086),
(386158),
(477616),
(539712);
-- --------------------------------------------------------
--
-- Table structure for table `cinemas`
--
CREATE TABLE `cinemas` (
`cinema_ID` int(10) NOT NULL,
`address` varchar(120) NOT NULL,
`cinema_name` varchar(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `cinemas`
--
INSERT INTO `cinemas` (`cinema_ID`, `address`, `cinema_name`) VALUES
(10676, '48 Sunset Drive,ARAMAC', ' The White Flare Opera House'),
(12024, '45 Woodwark Crescent,SILVER VALLEY', 'The Image Theater'),
(12198, '68 McDowall Street,COES CREEK', 'The Patriot Theatre'),
(16493, '88 Bapaume Road,OMAN AMA', 'The Grand Fountain Theatre'),
(21941, '95 Lowe Street,MORABY', 'The Sapphire Theatre'),
(25929, '70 Railway Street,EVANSLEA', 'The Sunset Opera House'),
(26434, '97 Mt Berryman Road,CRESSBROOK CREEK', 'The Phoenix Cinema'),
(27671, '37 Passage Avenue,YAM ISLAND', 'The Monument Theater'),
(29106, '70 Mt Berryman Road,GLENAVEN', 'The Capital Assembly Hall'),
(30130, '29 Chapel Close,CAIRNS NORTH', 'The Dreamland Amphitheater'),
(30172, '81 Brentwood Drive,HURRICANE', 'The Emerald Cinema'),
(31435, '49 Begley Street,COOKTOWN', 'The Guardian Cinema'),
(42367, '34 Brentwood Drive,LAKELAND', 'The Ellipse Assembly Hall'),
(43175, '65 Ronald Crescent,MOUNT ALMA', 'The Vision Theatre'),
(43999, '68 Shirley Street,COOMERA', 'The Harmony Cinema'),
(45619, '12 Martens Place,BULIMBA', 'The Prism Theatre'),
(46649, '56 Hunter Street,TOOWOOMBA SOUTH', 'The Fortune Concert Hall'),
(46799, '23 Bayview Close,MOUNT MORGAN', 'The Infinity Concert Hall'),
(49413, '78 Seninis Road,TOWNSVILLE DC', 'The Major Cinema'),
(50969, '10 Derry Street,NORLEY', 'The Golden Gate Concert Hall'),
(52279, '8 Old Gayndah Road,TINANA SOUTH', 'The Paradise Opera House'),
(53771, '49 Begley Street,COOKTOWN', 'The Dominion Theatre'),
(56767, '10 South Molle Boulevard,NICHOLSON', 'The Nebula Theater'),
(64129, '24 Woodwark Crescent,MUNDERRA', 'The Ecstasy Cinema'),
(69870, '73 Goebels Road,KENTVILLE', 'The Unison Theater'),
(71350, '97 Hillsdale Road,ARAMARA', 'The Royal Hall Assembly Hall'),
(72604, '65 Treasure Island Avenue,BURLEIGH DC', 'The Angel Opera House'),
(81988, '78 Bapaume Road,RAVENSBOURNE', 'The Galaxy Theater'),
(89124, '95 Creek Street,PIRRINUAN', 'The Exalted Amphitheater'),
(96443, '33 Bayview Close,ST LAWRENCE', 'The Lunar Cinema');
-- --------------------------------------------------------
--
-- Table structure for table `employees`
--
CREATE TABLE `employees` (
`employee_ID` int(10) NOT NULL,
`employee_name` varchar(50) NOT NULL,
`gender` varchar(10) NOT NULL,
`employee_phone_number` int(10) NOT NULL,
`cinema_ID` int(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `employees`
--
INSERT INTO `employees` (`employee_ID`, `employee_name`, `gender`, `employee_phone_number`, `cinema_ID`) VALUES
(153989, 'Jack', 'M', 70260337, 49413),
(162402, 'Diana', 'F', 47978356, 56767),
(193819, 'Benjamin', 'M', 26240422, 12198),
(214352, 'Theresa', 'F', 31955389, 50969),
(231469, 'Ralph', 'M', 31628028, 30130),
(263480, 'Daniel', 'M', 70151081, 12024),
(301576, 'Wayne', 'M', 70123193, 46649),
(335732, 'Brenda', 'F', 48081482, 26434),
(380086, 'Carol', 'F', 21633600, 42367),
(386158, 'Melissa', 'F', 21660537, 29106),
(388642, 'Ruby', 'F', 42323165, 30172),
(408351, 'Diane', 'F', 21579367, 31435),
(426038, 'Joan', 'F', 21663768, 96443),
(428945, 'Joe', 'M', 21990421, 25929),
(441771, 'Cheryl', 'F', 21528893, 52279),
(474599, 'Maria', 'F', 42366855, 43175),
(477253, 'Anne', 'F', 60563513, 45619),
(477616, 'Frances', 'F', 21081997, 89124),
(499687, 'Patrick', 'M', 31981269, 43999),
(528509, 'Paula', 'F', 25253176, 27671),
(539712, 'Nancy', 'F', 22933651, 64129),
(560455, 'Carolyn', 'F', 23988287, 71350),
(622406, 'Thomas', 'M', 31467936, 72604),
(677509, 'Lois', 'F', 30357284, 46799),
(683826, 'Roger', 'M', 20649731, 16493),
(890290, 'Julia', 'F', 42393910, 21941),
(912990, 'Joshua', 'M', 21727993, 10676),
(940761, 'Brenda', 'F', 22594549, 53771),
(969580, 'Matthew', 'M', 23697276, 81988),
(979607, 'Carol', 'F', 22528342, 69870);
-- --------------------------------------------------------
--
-- Table structure for table `engineer`
--
CREATE TABLE `engineer` (
`employee_ID` int(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `engineer`
--
INSERT INTO `engineer` (`employee_ID`) VALUES
(263480),
(335732),
(386158),
(388642),
(426038),
(428945),
(474599),
(477253),
(560455),
(683826),
(969580),
(979607);
-- --------------------------------------------------------
--
-- Table structure for table `manager`
--
CREATE TABLE `manager` (
`employee_ID` int(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `manager`
--
INSERT INTO `manager` (`employee_ID`) VALUES
(193819),
(408351),
(428945),
(499687),
(677509),
(940761);
-- --------------------------------------------------------
--
-- Table structure for table `movies`
--
CREATE TABLE `movies` (
`movie_ID` int(10) NOT NULL,
`detail` varchar(350) DEFAULT NULL,
`name` varchar(100) NOT NULL,
`release_date` date DEFAULT NULL,
`duration` int(20) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `movies`
--
INSERT INTO `movies` (`movie_ID`, `detail`, `name`, `release_date`, `duration`) VALUES
(21052822, 'Following the events at home, the Abbott family now face the terrors of the outside world. Forced to venture into the unknown, they realize the creatures that hunt by sound are not the only threats lurking beyond the sand path.', 'A Quiet Place Part II', '2021-05-28', 97),
(21060410, 'The Warrens investigate a murder that may be linked to a demonic possession.', 'The Conjuring: The Devil Made Me Do It ', '2021-06-04', 112),
(21061633, 'The bodyguard Michael Bryce continues his friendship with assassin Darius Kincaid as they try to save Darius\'s wife Sonia.', 'Hitman\'s Wife\'s Bodyguard', '2021-06-16', 122),
(21061841, 'THE SPARKS BROTHERS, is a musical odyssey through five weird and wonderful decades with Ron and Russell Mael celebrating the inspiring legacy of Sparks.', 'The Sparks Brothers', '2021-06-18', 135),
(21070252, 'All the rules are broken as a sect of lawless marauders decides that the annual Purge does not stop at daybreak and instead should never end.', 'The Forever Purge', '2021-07-02', 89),
(21071047, 'NBA superstar LeBron James teams up with Bugs Bunny and the rest of the Looney Tunes for this long-awaited sequel.', 'Space Jam: A New Legacy', '2021-07-10', 129),
(21073017, 'A fantasy re-telling of the medieval story of Sir Gawain and the Green Knight.', 'The Green Knight ', '2021-07-30', 104),
(21080654, 'Supervillains Harley Quinn, Bloodsport, Peacemaker and a collection of nutty cons at Belle Reve prison join the super-secret, super-shady Task Force X as they are dropped off at the remote, enemy-infused island of Corto Maltese.', 'The Suicide Squad', '2021-08-06', 114),
(21081457, 'A bank teller discovers that he\'s actually an NPC inside a brutal, open world video game.', 'Free Guy', '2021-08-14', 135),
(21082722, 'A \"spiritual sequel\" to the horror film Candyman (1992) that returns to the now-gentrified Chicago neighborhood where the legend began.', 'Candyman', '2021-08-27', 103),
(21090212, 'The movie, based on Marvel Comics, will focus on Shang-Chi; \'The Master of Kung-Fu\'.', 'Shang-Chi and the Legend of the Ten Rings', '2021-09-02', 137),
(21091774, 'The Templeton brothers have become adults and drifted away from each other, but a new boss baby with a cutting-edge approach is about to bring them together again - and inspire a new family business', 'The Boss Baby: Family Business', '2021-09-17', 117),
(21092496, 'Sequel to the 2018 film \'Venom\'.', 'Venom: Let There Be Carnage', '2021-09-24', 100),
(21100119, 'Feature adaptation of Frank Herbert\'s science fiction novel, about the son of a noble family entrusted with the protection of the most valuable asset and most vital element in the galaxy.', 'Dune', '2021-10-01', 131),
(21100720, 'James Bond has left active service. His peace is short-lived when Felix Leiter, an old friend from the CIA, turns up asking for help, leading Bond onto the trail of a mysterious villain armed with dangerous new technology.', 'No Time to Die', '2021-10-07', 163),
(21102270, 'A young girl, passionate about fashion design, is mysteriously able to enter the 1960s where she encounters her idol, a dazzling wannabe singer. But 1960s London is not what it seems, and time seems to fall apart with shady consequences.', 'Last Night in Soho', '2021-10-22', 82),
(21102910, 'In an isolated Oregon town, a middle-school teacher and her sheriff brother become embroiled with her enigmatic student, whose dark secrets lead to terrifying encounters with a legendary ancestral creature who came before them.', 'Antlers', '2021-10-29', 99),
(21110500, 'The saga of the Eternals, a race of immortal beings who lived on Earth and shaped its history and civilizations.', 'Eternals', '2021-11-05', 112),
(21112584, 'Set in 1998, this \'Resident Evil\' origin story explains the secrets of the Spencer Mansion and Raccoon City.', 'Resident Evil: Welcome to Raccoon City', '2021-11-25', 149),
(21121052, 'An adaptation of the 1957 musical, West Side Story explores forbidden love and the rivalry between the Jets and the Sharks, two teenage street gangs of different ethnic backgrounds.', 'West Side Story', '2021-12-10', 96),
(21121700, 'A continuation of Spider-Man Far From Home', 'Spider-Man: No Way Home', '2021-12-17', 136),
(22011742, 'When a top-secret weapon falls into mercenary hands, a wild card CIA agent joins forces with three international agents on a lethal mission to retrieve it, while staying a step ahead of a mysterious woman who\'s tracking their every move.', 'The 355', '2022-01-07', 95),
(22012870, 'Biochemist Michael Morbius tries to cure himself of a rare blood disease, but he inadvertently infects himself with a form of vampirism instead.', 'Morbius', '2022-01-28', 85),
(22020430, 'The birth of Batman (6 pieces) at the beginning of its birth, Batman was not different from the popular novels with detective themes at that time except wearing bat clothes. He is not so much a hero as a detective.', 'The Batman', '2022-03-04', 92),
(22021166, 'While on vacation on the Nile, Hercule Poirot must investigate the murder of a young heiress.', 'Death on the Nile', '2022-02-11', 136),
(22021835, 'The story is a prequel to the games, starring Holland as a younger Drake, showing us details of how he came to meet and befriend Sully.', 'Uncharted ', '2022-02-18', 121),
(22032584, 'Sequel to the 2016 Marvel film \'Doctor Strange\'.', 'Doctor Strange in the Multiverse of Madness', '2022-03-25', 87),
(22040812, 'Set in Iceland at the turn of the 10th century, a Nordic prince sets out on a mission of revenge after his father is murdered.', 'The Northman', '2022-04-08', 129),
(22040888, 'After settling in Green Hills, Sonic is ready for more freedom, and Tom and Maddie agree to leave him home while they go on vacation. But, no sooner are they gone, when Dr. Robotnik comes back, this time with a new partner, Knuckles, in search for an emerald that has the power to both build and destroy civilizations. ', 'Sonic the Hedgehog 2', '2022-04-08', 132),
(22050642, 'The sequel to Thor: Ragnarok and the fourth movie in the Thor saga.', 'Thor: Love and Thunder', '2022-05-06', 105);
-- --------------------------------------------------------
--
-- Table structure for table `movies_movie_stars`
--
CREATE TABLE `movies_movie_stars` (
`movie_ID` int(10) NOT NULL,
`movie_stars` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `movies_movie_stars`
--
INSERT INTO `movies_movie_stars` (`movie_ID`, `movie_stars`) VALUES
(21052822, 'Emily Blunt, Millicent Simmonds, Cillian Murphy'),
(21060410, 'Patrick Wilson, Vera Farmiga, Ruairi O\'Connor'),
(21061633, 'Ryan Reynolds, Frank Grillo, Samuel L. Jackson'),
(21061841, 'Ron Mael, Russell Mael, Beck '),
(21070252, 'Ana de la Reguera, Josh Lucas, Cassidy Freeman'),
(21071047, 'LeBron James, Zendaya, Sonequa Martin-Green'),
(21073017, 'Dev Patel, Alicia Vikander, Joel Edgerton'),
(21080654, 'Margot Robbie, Idris Elba, John Cena'),
(21081457, 'Ryan Reynolds, Jodie Comer, Taika Waititi'),
(21082722, 'Yahya Abdul-Mateen II, Teyonah Parris, Nathan Stewart-Jarrett '),
(21090212, 'Simu Liu, Awkwafina, Tony Chiu-Wai Leung '),
(21091774, 'James Marsden, Jeff Goldblum, Lisa Kudrow'),
(21092496, 'Tom Hardy, Michelle Williams, Stephen Graham'),
(21100119, 'Timothée Chalamet, Rebecca Ferguson, Zendaya '),
(21100720, 'Daniel Craig, Ana de Armas, Rami Malek '),
(21102270, 'Jessie Mei Li, Anya Taylor-Joy, Matt Smith'),
(21102910, 'Keri Russell, Jesse Plemons, Jeremy T. Thomas'),
(21110500, 'Angelina Jolie, Richard Madden, Salma Hayek '),
(21112584, 'Kaya Scodelario, Robbie Amell, Hannah John-Kamen '),
(21121700, 'Angourie Rice, Tom Holland, Zendaya '),
(22011742, 'Jessica Chastain, Lupita Nyong\'o, Diane Kruger'),
(22012870, 'Archie Renaux, Jared Leto, Matt Smith '),
(22020430, 'Andy Serkis, Robert Pattinson, Colin Farrell'),
(22021166, 'Kenneth Branagh, Gal Gadot, Tom Bateman'),
(22021835, 'Tom Holland, Mark Wahlberg, Antonio Banderas'),
(22032584, 'Rachel McAdams, Elizabeth Olsen, Benedict Cumberbatch'),
(22040812, 'Anya Taylor-Joy, Alexander Skarsgård, Nicole Kidman'),
(22040888, 'Jim Carrey, James Marsden, Ben Schwartz'),
(22050642, 'Chris Hemsworth, Karen Gillan, Matt Damon');
-- --------------------------------------------------------
--
-- Table structure for table `movies_type`
--
CREATE TABLE `movies_type` (
`movie_ID` int(10) NOT NULL,
`type` varchar(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `movies_type`
--
INSERT INTO `movies_type` (`movie_ID`, `type`) VALUES
(21052822, 'Drama, Horror, Sci-Fi '),
(21060410, 'Horror, Mystery, Thriller'),
(21061633, 'Action, Comedy, Crime'),
(21061841, 'Documentary, Music '),
(21070252, 'Action, Horror, Sci-Fi '),
(21071047, 'Animation, Adventure, Comedy'),
(21073017, ' Adventure, Drama, Fantasy'),
(21080654, 'Action, Adventure, Comedy'),
(21081457, 'Action, Comedy, Sci-Fi'),
(21082722, 'Horror, Thriller '),
(21090212, 'Action, Adventure, Fantasy'),
(21091774, ' Animation, Adventure, Comedy'),
(21092496, 'Action, Sci-Fi, Thriller '),
(21100119, ' Adventure, Drama, Sci-Fi'),
(21100720, 'Action, Adventure, Thriller '),
(21102270, 'Drama, Horror, Thriller'),
(21102910, 'Horror, Mystery '),
(21110500, 'Action, Adventure, Drama '),
(21112584, 'Action, Horror, Mystery '),
(21121052, 'Crime, Drama, Musical'),
(21121700, 'Action, Adventure, Sci-Fi'),
(22011742, ' Action, Thriller'),
(22012870, 'Action, Adventure, Drama '),
(22020430, 'Action, Crime, Drama'),
(22021166, 'Crime, Drama, Mystery'),
(22021835, 'Action, Adventure'),
(22032584, 'Action, Adventure, Fantasy '),
(22040812, 'Action, Adventure, Drama'),
(22040888, 'Animation, Action, Adventure '),
(22050642, 'Action, Adventure, Fantasy ');
-- --------------------------------------------------------
--
-- Table structure for table `movie_halls`
--
CREATE TABLE `movie_halls` (
`hall_ID` int(10) NOT NULL,
`hall_name` varchar(20) NOT NULL,
`total_seats_number` int(3) NOT NULL,
`cinema_ID` int(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `movie_halls`
--
INSERT INTO `movie_halls` (`hall_ID`, `hall_name`, `total_seats_number`, `cinema_ID`) VALUES
(1, 'Alpha', 50, 46799),
(2, 'Beta', 50, 53771),
(3, 'Charlie', 50, 25929),
(4, 'Delta', 50, 31435),
(5, 'Echo', 50, 12198),
(6, 'Fox', 50, 43999),
(7, 'Garry', 50, 64129),
(8, 'Harry', 50, 42367),
(9, 'Island', 50, 89124),
(10, 'Jack', 50, 56767);
-- --------------------------------------------------------
--
-- Table structure for table `projectionist`
--
CREATE TABLE `projectionist` (
`employee_ID` int(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `projectionist`
--
INSERT INTO `projectionist` (`employee_ID`) VALUES
(214352),
(301576),
(388642),
(426038),
(441771),
(477616),
(528509),
(622406),
(890290),
(912990),
(969580),
(979607);
-- --------------------------------------------------------
--
-- Table structure for table `ratings`
--
CREATE TABLE `ratings` (
`user_ID` int(10) NOT NULL,
`rating_ID` int(10) NOT NULL,
`context` varchar(300) NOT NULL,
`movie_ID` int(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `ratings`
--
INSERT INTO `ratings` (`user_ID`, `rating_ID`, `context`, `movie_ID`) VALUES
(17204422, 13216210, 'You\'re such a wonderful person — but you got problems. I can stare for a thousand years. What you like is in the limo.', 21080654),
(17612229, 47405621, 'Hey, that\'s far out so you heard him too! Don\'t pick fights with the bullies or the cads. I found my teacher crouching in his overalls.', 21073017),
(20773535, 32123440, 'Look at those cavemen go. Don\'t pick fights with the bullies or the cads.', 21090212),
(21885820, 58594273, 'You\'re too old to lose it, too young to choose it. Far out!', 21100119),
(23065620, 10152140, 'I would not challenge a giant. What you like is in the limo. She asked for my love and I gave her a dangerous mind.', 21071047),
(25167281, 52259926, 'It\'s the terror of knowing what this world is about — watching some good friends screaming, \"Let me out!\". ', 21102910),
(25585288, 80123343, 'We believe in you. It\'s War-hol, actually.', 22032584),
(37755463, 28309548, 'So softly a supergod cries. Beware the savage jaw of 1984.', 21100720),
(38618106, 42133976, 'Somewhere, someone\'s calling me when the chips are down. Turn to the right! I watch the ripples change their size, but never leave the stream.', 22011742),
(43280085, 37873187, 'Oh no love, you\'re not alone. Have you sought fortune evasive and shy? Dignity is valuable, but our lives are valuable too.', 21110500),
(43290930, 41723901, 'Hey, that\'s far out so you heard him too! He makes you laugh, he brings you out in style.', 21092496),
(44233570, 37721184, 'As they pulled you out of the oxygen tent, you asked for the latest party. It\'s a very modern world, but nobody\'s perfect.', 22021835),
(44864915, 48948135, 'He was awful nice — really quite out of sight. Tell my wife I love her very much. If you think we\'re gonna make it, you better hang on to yourself.', 21102270),
(46932562, 79069061, 'Far out! Beware the savage jaw of 1984.', 21060410),
(48168316, 68015536, 'Pale blinds drawn all day. Hey, that\'s far out so you heard him too!', 21052822),
(50396071, 32372569, 'The sun machine is coming down, and we\'re gonna have a party. She asked for my love and I gave her a dangerous mind.', 21112584),
(55267055, 58216667, 'Lady Stardust sang his songs of darkness and disgrace. His name was always Buddy, and he\'d shrug and ask to stay.', 22040888),
(57046306, 60451157, 'I watch the ripples change their size, but never leave the stream. So softly a supergod cries.', 22012870),
(59775064, 68194311, 'If you think we\'re gonna make it, you better hang on to yourself. Never look back, walk tall, act fine.', 21091774),
(63334571, 61275531, 'Pale blinds drawn all day. What you like is in the limo. I\'m a space invader.', 21121700),
(67659416, 10786406, 'Breaking up is hard, but keeping dark is hateful. Never look back, walk tall, act fine.', 22040812),
(68592894, 87348133, 'I never thought I\'d need so many people. No death for the perfect men.', 21061633),
(71869359, 35880889, 'I\'m glad that you\'re older than me. Look at those cavemen go. You were a talented child.', 22021166),
(76475445, 63820277, 'Is it any wonder I reject you first? I found my teacher crouching in his overalls.', 21082722),
(77116445, 32187831, 'Oh no, don\'t say it\'s true. I\'m happy, hope you\'re happy too. Far out!', 22050642),
(77180757, 96173201, 'They\'re travelling the holy land opening telegrams. You\'re too old to lose it, too young to choose it. Tell my wife I love her very much.', 21070252),
(79868528, 36599767, 'Sometimes I feel the need to move on; so I pack a bag and move on. Don\'t tell your papa or he\'ll get us locked up in fright!', 21061841),
(82980018, 27110692, 'He treats you well and makes you up real fine. I found my teacher crouching in his overalls.', 21081457),
(94913812, 81183567, 'Tell my wife I love her very much. Sordid details following.', 22020430),
(95769868, 39220508, 'I can stare for a thousand years. The return of the Thin White Duke.', 21121052);
-- --------------------------------------------------------
--
-- Table structure for table `sections`
--
CREATE TABLE `sections` (
`section_ID` int(10) NOT NULL,
`date` date NOT NULL,
`price` int(50) NOT NULL,
`movie_ID` int(10) NOT NULL,
`hall_ID` int(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `sections`
--
INSERT INTO `sections` (`section_ID`, `date`, `price`, `movie_ID`, `hall_ID`) VALUES
(12, '2021-12-05', 180, 21121052, 4),
(13, '2022-02-01', 150, 22020430, 4),
(15, '2021-10-19', 150, 22040812, 3),
(17, '2021-08-19', 150, 22032584, 10),
(21, '2021-10-19', 180, 21102270, 5),
(29, '2022-05-09', 160, 21092496, 7),
(30, '2021-07-06', 150, 22021166, 3),
(33, '2022-10-15', 160, 21052822, 1),
(35, '2021-06-03', 160, 21090212, 2),
(36, '2021-06-13', 160, 21080654, 8),
(41, '2022-08-24', 180, 21121700, 1),
(45, '2022-12-14', 160, 21071047, 6),
(49, '2022-04-08', 180, 21112584, 2),
(52, '2022-05-11', 180, 21110500, 1),
(53, '2021-07-19', 160, 21060410, 2),
(56, '2022-04-13', 160, 21070252, 5),
(57, '2022-02-16', 180, 21100720, 6),
(61, '2021-10-26', 160, 21081457, 9),
(62, '2021-10-14', 150, 22040888, 2),
(65, '2021-09-30', 150, 22021835, 8),
(66, '2022-12-26', 160, 21082722, 10),
(72, '2021-09-12', 180, 22012870, 9),
(74, '2022-07-14', 160, 21073017, 7),
(81, '2021-07-13', 180, 21100119, 4),
(83, '2022-11-13', 180, 22011742, 10),
(86, '2022-04-20', 160, 21061841, 4),
(88, '2021-07-08', 150, 22050642, 4),
(90, '2022-03-01', 160, 21091774, 3),
(92, '2021-10-30', 180, 21102910, 5),
(98, '2021-12-20', 160, 21061633, 3);
-- --------------------------------------------------------
--
-- Table structure for table `tickets`
--
CREATE TABLE `tickets` (
`ticket_ID` int(10) NOT NULL,
`seat_number` int(10) NOT NULL,
`section_ID` int(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `tickets`
--
INSERT INTO `tickets` (`ticket_ID`, `seat_number`, `section_ID`) VALUES
(14010, 19, 61),
(15304, 3, 29),
(16542, 26, 57),
(16850, 49, 45),
(22009, 13, 35),
(26175, 7, 49),
(27294, 32, 21),
(27317, 39, 90),
(32737, 6, 13),
(32898, 34, 17),
(36566, 4, 15),
(43179, 42, 36),
(45126, 27, 41),
(45644, 40, 52),
(49671, 11, 66),
(50036, 37, 33),
(52319, 24, 83),
(52380, 30, 86),
(54971, 41, 72),
(59163, 21, 81),
(62520, 15, 92),
(65223, 29, 65),
(69131, 48, 53),
(70514, 35, 12),
(79653, 47, 62),
(81804, 43, 88),
(91081, 33, 74),
(96374, 45, 98),
(97415, 17, 56),
(98270, 25, 30);
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
CREATE TABLE `users` (
`user_ID` int(20) NOT NULL,
`user_name` varchar(30) NOT NULL,
`password` varchar(30) NOT NULL,
`user_phone_number` int(10) NOT NULL,
`ticket_ID` int(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `users`
--
INSERT INTO `users` (`user_ID`, `user_name`, `password`, `user_phone_number`, `ticket_ID`) VALUES
(17204422, 'Jason', 'OGxRA60K6d', 1915221952, 36566),
(17612229, 'Enoch', 'K627hmrnCzHGRwa', 1887963537, 97415),
(20773535, 'Travers', 'qjFd5khj4G48GY9tsh', 1821520575, 52319),
(21885820, 'Deborah', 'kMqX4VMjak', 1926336060, 70514),
(23065620, 'White', 'gPuWYEBDlqt1G', 1879289929, 26175),
(25167281, 'Jemima', 'QB8OocJZ318L6aL', 1919932049, 16542),
(25585288, 'Grain', 'TLSJcvy34kimgo9Ig', 1850790415, 59163),
(37755463, 'Shamus', 'YHOnqatMN2HmI', 1926562166, 65223),
(38618106, 'Eli', 'WQVmJbegG1LLQV6Y4', 1755066834, 79653),
(43280085, 'Simon', 'K5i6GTZpv51RFX8c', 1988744289, 50036),
(43290930, 'Lars', 'DrHI0QpyppC2U3BH', 1899131153, 45126),
(44233570, 'Edgar', 'nl3g3GfXdzpjNvJ', 1752743427, 49671),
(44864915, 'Ruth', '7N9LqI7NqHRRS', 1896090378, 22009),
(46932562, 'Royce', 'IcR0DoqclHAspvc', 1915509044, 32898),
(48168316, 'Sloane', '7ZB3u6S8EajBw2ZjEQPXqxYZx', 1833640945, 91081),
(50396071, 'Stanley', 'n4syr6iwJB7XGnye', 1714084497, 52380),
(55267055, 'Michael', '6EcL0x70', 1862824434, 16850),
(57046306, 'Silas', 'kaaGljiN1qIKmACEbvk', 1904813003, 98270),
(59775064, 'Howard', 'MN6z09ICFbx6qx0e', 1889192332, 69131),
(63334571, 'Eloise', '3qeUCogyZPr7ps', 1762780586, 45644),
(67659416, 'Hardy', 'bM6SAeD7', 1882591439, 81804),
(68592894, 'Ward', 'gf6b7LH90LxXj', 1831789106, 54971),
(71869359, 'Forest', 'VBpWiBGC1Lsl', 1819824426, 14010),
(76475445, 'Konrad', '9rLpR14C7RkQZ', 1914027571, 32737),
(77116445, 'Kurt', 'XIEnxjA6Sij', 1800714564, 96374),
(77180757, 'Effie', 'd6Rp2WHCBmMypcQqUV7N63c', 1981498564, 27294),
(79868528, 'Rosa', 'FiocjEAvw', 1972717435, 15304),
(82980018, 'Quenna', 'eRrQjDTcfDOLk1m', 1713376145, 27317),
(94913812, 'Marcus', 'prVsEaGZxX', 1713194080, 43179),
(95769868, 'Imogene', 'M3mErtMp9404UqHG', 1985486618, 62520);
--
-- Indexes for dumped tables
--
--
-- Indexes for table `acounting`
--
ALTER TABLE `acounting`
ADD PRIMARY KEY (`employee_ID`);
--
-- Indexes for table `cinemas`
--
ALTER TABLE `cinemas`
ADD PRIMARY KEY (`cinema_ID`);
--
-- Indexes for table `employees`
--
ALTER TABLE `employees`
ADD PRIMARY KEY (`employee_ID`),
ADD KEY `cinema_ID` (`cinema_ID`);
--
-- Indexes for table `engineer`
--
ALTER TABLE `engineer`
ADD PRIMARY KEY (`employee_ID`);
--
-- Indexes for table `manager`
--
ALTER TABLE `manager`
ADD PRIMARY KEY (`employee_ID`);
--
-- Indexes for table `movies`
--
ALTER TABLE `movies`
ADD PRIMARY KEY (`movie_ID`);
--
-- Indexes for table `movies_movie_stars`
--
ALTER TABLE `movies_movie_stars`
ADD PRIMARY KEY (`movie_ID`,`movie_stars`),
ADD KEY `movie_ID` (`movie_ID`);
--
-- Indexes for table `movies_type`
--
ALTER TABLE `movies_type`
ADD PRIMARY KEY (`movie_ID`,`type`),
ADD KEY `movie_ID` (`movie_ID`);
--
-- Indexes for table `movie_halls`
--
ALTER TABLE `movie_halls`
ADD PRIMARY KEY (`hall_ID`),
ADD KEY `cinema_ID` (`cinema_ID`);
--
-- Indexes for table `projectionist`
--
ALTER TABLE `projectionist`
ADD PRIMARY KEY (`employee_ID`);
--
-- Indexes for table `ratings`
--
ALTER TABLE `ratings`
ADD PRIMARY KEY (`user_ID`,`rating_ID`),
ADD KEY `user_ID` (`user_ID`),
ADD KEY `movie_ID` (`movie_ID`),
ADD KEY `user_ID_2` (`user_ID`),
ADD KEY `movie_ID_2` (`movie_ID`);
--
-- Indexes for table `sections`
--
ALTER TABLE `sections`
ADD PRIMARY KEY (`section_ID`),
ADD KEY `movie_ID` (`movie_ID`),
ADD KEY `hall_ID` (`hall_ID`);
--
-- Indexes for table `tickets`
--
ALTER TABLE `tickets`
ADD PRIMARY KEY (`ticket_ID`),
ADD KEY `section_ID` (`section_ID`);
--
-- Indexes for table `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`user_ID`),
ADD KEY `ticket_ID` (`ticket_ID`);
--
-- Constraints for dumped tables
--
--
-- Constraints for table `employees`
--
ALTER TABLE `employees`
ADD CONSTRAINT `employees__cinema_ID` FOREIGN KEY (`cinema_ID`) REFERENCES `cinemas` (`cinema_ID`);
--
-- Constraints for table `movies_movie_stars`
--
ALTER TABLE `movies_movie_stars`
ADD CONSTRAINT `movies_movie_stars__movie_ID` FOREIGN KEY (`movie_ID`) REFERENCES `movies` (`movie_ID`);
--
-- Constraints for table `movies_type`
--
ALTER TABLE `movies_type`
ADD CONSTRAINT `movies_type__movie_ID` FOREIGN KEY (`movie_ID`) REFERENCES `movies` (`movie_ID`);
--
-- Constraints for table `movie_halls`
--
ALTER TABLE `movie_halls`
ADD CONSTRAINT `movie_hall__cinema_ID` FOREIGN KEY (`cinema_ID`) REFERENCES `cinemas` (`cinema_ID`);
--
-- Constraints for table `ratings`
--
ALTER TABLE `ratings`
ADD CONSTRAINT `ratings__movie_ID` FOREIGN KEY (`movie_ID`) REFERENCES `movies` (`movie_ID`),
ADD CONSTRAINT `ratings__user_ID` FOREIGN KEY (`user_ID`) REFERENCES `users` (`user_ID`);
--
-- Constraints for table `sections`
--
ALTER TABLE `sections`
ADD CONSTRAINT `sections__hall_ID` FOREIGN KEY (`hall_ID`) REFERENCES `movie_halls` (`hall_ID`),
ADD CONSTRAINT `sections__movie_ID` FOREIGN KEY (`movie_ID`) REFERENCES `movies` (`movie_ID`);
--
-- Constraints for table `tickets`
--
ALTER TABLE `tickets`
ADD CONSTRAINT `tickets__section_ID` FOREIGN KEY (`section_ID`) REFERENCES `sections` (`section_ID`);
--
-- Constraints for table `users`
--
ALTER TABLE `users`
ADD CONSTRAINT `users__ticket_ID` FOREIGN KEY (`ticket_ID`) REFERENCES `tickets` (`ticket_ID`);
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
/**
*
* @author Hanln
* @version $Id: TopService_getShisetsuEventList_Sel_01.sql 12474 2014-07-09 02:28:34Z p_re_han $
*/
SELECT
EVT.EVENT_NO
,EVT.EVENT_NAME
,EVT.EVENT_PREIOD
,EVT.EVENT_CONTENTS
FROM
BY_SHISETSU_EVENT EVT
WHERE
EVT.SHISETSU_CD = /*shisetsuCd*/'000002092'
AND EVT.EVENT_LIMIT_DATE >= /*eventLimitDate*/sysdate+1
AND EVT.DELETE_FLG ='0'
ORDER BY EVT.EVENT_NO |
--------------------------------------------------------
-- File created - Friday-January-26-2018
--------------------------------------------------------
--------------------------------------------------------
-- DDL for Procedure CREATE_DIMENSION
--------------------------------------------------------
set define off;
CREATE OR REPLACE PROCEDURE "SYSTEM"."CREATE_DIMENSION" AS
CURSOR CountTable IS
SELECT *
FROM count_table;
ParT Parent_Table%ROWTYPE;
parent_code varchar2(10);
lowest_count_product varchar2(10);
highest_count_product varchar2(10);
no_children_id varchar2(10);
no_parent_id varchar2(10);
max_count_products number;
min_count_products number;
sqlqry clob;
parent_position number;
product_code COUNT_TABLE.product_code%TYPE;
max_count number;
max_row number;
parent_id number;
children_id number;
count_product number;
previous_max_count number;
current_count number;
prev_prod_count number;
min_count number;
CountT count_table%ROWTYPE;
BEGIN
EXECUTE IMMEDIATE ('DROP TABLE DIMENSION_TABLE');
EXECUTE IMMEDIATE ('CREATE TABLE DIMENSION_TABLE(
product_code VARCHAR2(100),
product varchar2(10)
)');
EXECUTE IMMEDIATE ('INSERT INTO DIMENSION_TABLE
SELECT product_code, product
FROM SAMPLE_RAW
GROUP BY product_code, product
ORDER BY 1');
EXECUTE IMMEDIATE ('ALTER TABLE DIMENSION_TABLE
ADD
PARENT_ID varchar2(10)');
OPEN CountTable;
LOOP
FETCH CountTable INTO CountT;
EXIT WHEN CountTable%NOTFOUND;
EXECUTE IMMEDIATE ('UPDATE DIMENSION_TABLE
SET PARENT_ID = '||CountT.product_code||'
WHERE PRODUCT_CODE = '||CountT.product_code);
END LOOP;
CLOSE CountTable;
--INSERT VALUES FOR PARENT_ID
-- OPEN ParentT;
-- LOOP
-- FETCH ParentT INTO ParT;
-- EXIT WHEN ParentT%NOTFOUND;
-- execute immediate ('UPDATE DIMENSION_TABLE
-- SET parent_id = '||ParT.parent_id||'
-- WHERE product_code = '''||ParT.product_code||'''');
-- END LOOP;
-- CLose ParentT;
-- select max(count_product) into max_count_products from COUNT_TABLE;
-- select max(product_code) into highest_count_product
-- from COUNT_TABLE
-- where count_product = max_count_products
-- AND ROWNUM <= 1;
--
-- select max(parent_id) into no_parent_id
-- from PARENT_TABLE;
--
-- execute immediate ('UPDATE DIMENSION_TABLE
-- SET parent_id = '||no_parent_id||'
-- WHERE product_code = '''||highest_count_product||'''');
--
-- execute immediate('select * from dimension_table');
--
-- select MAX(count_product) into max_count from COUNT_TABLE;
-- select MAX(rownum) into max_row from COUNT_TABLE;
-- select MIN(count_product) into min_count from COUNT_TABLE;
--
-- current_count := 1;
-- count_product := min_count;
--
-- FOR I IN 1..max_row LOOP
--
-- select product_code, count_product into product_code, count_product
-- from (SELECT product_code, count_product, ROWNUM AS RN FROM COUNT_TABLE)
-- where RN = I;
-- if count_product != max_count then
-- if prev_prod_count != count_product then
-- parent_id := current_count + 1;
-- current_count := current_count + 1;
-- else
-- parent_id := current_count;
-- end if;
-- execute immediate ('UPDATE DIMENSION_TABLE
-- SET parent_id ='||parent_id||'
-- WHERE product_code = '||product_code);
-- prev_prod_count := count_product;
-- end if;
-- END LOOP;
--
-- select MAX(count_product) into max_count_products from COUNT_TABLE;
-- select max(product_code) into highest_count_product
-- from COUNT_TABLE
-- where count_product = max_count_products
-- AND ROWNUM <= 1;
--
-- select max(parent_id) into no_parent_id
-- from PARENT_TABLE;
--
-- sqlqry := 'UPDATE DIMENSION_TABLE
-- SET parent_id = '||no_parent_id||'
-- WHERE parent_id = -1';
-- execute immediate (sqlqry);
--
-- current_count := 1;
-- count_product := min_count;
--
-- prev_prod_count := null;
--
-- --INSERT VALUES FOR CHILDREN_ID
-- FOR I IN 1..max_row LOOP
--
-- select product_code, count_product into product_code, count_product
-- from (SELECT product_code, count_product, ROWNUM AS RN FROM COUNT_TABLE)
-- where RN = I;
--
-- if count_product != min_count then
-- if prev_prod_count != count_product then
-- children_id := current_count + 1;
-- current_count := current_count + 1;
-- else
-- children_id := current_count;
-- end if;
-- execute immediate ('UPDATE DIMENSION_TABLE
-- SET children_id ='''||children_id||'''
-- WHERE product_code = '''||product_code||'''');
-- prev_prod_count := count_product;
-- end if;
-- END LOOP;
--
-- select MIN(count_product) into min_count_products from COUNT_TABLE;
-- select product_code into lowest_count_product
-- from COUNT_TABLE
-- where count_product = min_count_products
-- AND ROWNUM <= 1;
--
-- select max(children_id) into no_children_id
-- from CHILDREN_TABLE;
--
-- sqlqry := 'UPDATE DIMENSION_TABLE
-- SET children_id = '||no_children_id||'
-- WHERE children_id = -1';
-- execute immediate (sqlqry);
EXECUTE IMMEDIATE ('ALTER TABLE DIMENSION_TABLE
ADD Parent_Count number
');
END CREATE_DIMENSION;
/
|
use proj_library;
create view bestMember as select substring(m.jumin,8,1) as sex,m.member_no as member_no, m.kor_name, m.admin, rental_date,b.cate_b_no,b.cate_m_no,b.cate_s_no
FROM book_rental_info i join `member` m on i.member_no=m.member_no join book b on i.book_code=b.book_code;
/*drop view bestMember;*/
create view bestsaler as select left(i.book_code,8) as bc, b.title, b.author ,p.pub_name,left(i.rental_date,7)as rental_date,b.cate_b_no,b.cate_m_no,b.cate_s_no,c.cate_b_name
FROM book_rental_info i join book b on i.book_code=b.book_code join publisher p on b.pub_no=p.pub_no join category_b c on c.cate_b_no=b.cate_b_no;
show create view bestsaler;
/*drop view bestsaler;*/
create
or replace
view `overduepopup` as select
`m`.`kor_name` as `kor_name`,
`b`.`title` as `title`,
`r`.`rental_date` as `rental_date`,
`r`.`return_schedule` as `return_schedule`,
`m`.`phone` as `phone`,
`r`.`return_date` as `return_date`,
`b`.`book_code` as `book_code`,
`r`.`member_no` as `member_no`
from
((`book_rental_info` `r`
join `member` `m` on
((`r`.`member_no` = `m`.`member_no`)))
join `book` `b` on
((`r`.`book_code` = `b`.`book_code`)))
where
return_date is null
group by
`m`.`kor_name`;
/*drop view OverduePopup;*/
SELECT kor_name, title, rental_date, return_schedule, phone, return_date
FROM proj_library.overduepopup;
---- 프로시저 생성하기 -----
delimiter $$
CREATE PROCEDURE `proj_library`.`search_membername`(in korname char(50))
begin
select kor_name, member_no, phone, jumin
from member
where kor_name regexp korname;
end
delimiter ;
------ search_membernoRent ------
DELIMITER $$
CREATE DEFINER=`user_library`@`localhost` PROCEDURE `proj_library`.`search_membernoRent`(in memberno char(50))
begin
select b.book_code, title, rental_date, return_schedule
from member m join book_rental_info r on m.member_no = r.member_no
join book b on b.book_code = r.book_code
where m.member_no regexp memberno;
END
DELIMITER ;
--------- search_phone ------------
delimiter $$
CREATE PROCEDURE `proj_library`.`search_phone`(in phonenum char(30))
begin
select kor_name, member_no, phone, jumin
from member
where phone regexp phonenum;
END
delimiter ;
------- search_memberno--------
DELIMITER $$
CREATE DEFINER=`user_library`@`localhost` PROCEDURE `proj_library`.`search_memberno`(in memberno char(50))
begin
select kor_name, member_no, jumin, phone
from `member`
where member_no regexp memberno;
END
DELIMITER ;
/*post 서동준꺼*/
LOAD data LOCAL INFILE 'D:/workspace-project/java_web_male/DataFiles/대구광역시.txt' INTO table post
character set 'euckr'
fields TERMINATED by '|'
IGNORE 1 lines
(@zipcode,@sido,@d,@sigungu,@d,@eupmyeon,@d,@d,@doro,@d,@d,@building1,@building2,@d,@d,@d,@d,@d,@d,@d,@d,@d,@d,@d,@d,@d)
set zipcode=@zipcode, sido=@sido, sigungu=@sigungu, eupmyeon=@eupmyeon, doro=@doro, building1=@building1, building2=@building2
CREATE INDEX idx_post_sido On post(sido);
CREATE INDEX idx_post_doro ON post(doro);
/*post 재영이꺼*/
LOAD data LOCAL INFILE 'C:/Users/lenovo/git/java_web_male/DataFiles/대구광역시.txt' INTO table post
character set 'euckr'
fields TERMINATED by '|'
IGNORE 1 lines
(@zipcode,@sido,@d,@sigungu,@d,@eupmyeon,@d,@d,@doro,@d,@d,@building1,@building2,@d,@d,@d,@d,@d,@d,@d,@d,@d,@d,@d,@d,@d)
set zipcode=@zipcode, sido=@sido, sigungu=@sigungu, eupmyeon=@eupmyeon, doro=@doro, building1=@building1, building2=@building2
|
DROP DATABASE IF EXISTS `final`;
CREATE DATABASE IF NOT EXISTS `final`;
USE `final`;
--
--
--
ALTER TABLE final.member MODIFY member_id VARCHAR(255);
ALTER TABLE final.member MODIFY member_gender_id VARCHAR(255);
ALTER TABLE final.member ADD PRIMARY KEY (member_id);
ALTER TABLE final.gender MODIFY member_gender_id VARCHAR(255);
ALTER TABLE final.gender ADD PRIMARY KEY (member_gender_id);
ALTER TABLE final.drugname MODIFY drug_ndc VARCHAR(255);
ALTER TABLE final.drugname MODIFY drug_form_code VARCHAR(255);
ALTER TABLE final.drugname MODIFY drug_brand_generic_code VARCHAR(255);
ALTER TABLE final.drugname ADD PRIMARY KEY (drug_ndc);
ALTER TABLE final.drugform MODIFY drug_form_code VARCHAR(255);
ALTER TABLE final.drugform ADD PRIMARY KEY (drug_form_code);
ALTER TABLE final.drugbrand MODIFY drug_brand_generic_code VARCHAR(255);
ALTER TABLE final.drugbrand ADD PRIMARY KEY (drug_brand_generic_code);
ALTER TABLE final.claim MODIFY member_id VARCHAR(255);
ALTER TABLE final.claim MODIFY drug_ndc VARCHAR(255);
ALTER TABLE final.member
ADD FOREIGN KEY member_member_gender_id_fk(member_gender_id)
REFERENCES final.gender(member_gender_id)
ON DELETE RESTRICT
ON UPDATE RESTRICT;
ALTER TABLE final.drugname
ADD FOREIGN KEY drugname_drug_form_code_fk(drug_form_code)
REFERENCES final.drugform(drug_form_code)
ON DELETE RESTRICT
ON UPDATE RESTRICT;
ALTER TABLE final.drugname
ADD FOREIGN KEY drugname_drug_brand_generic_code_fk(drug_brand_generic_code)
REFERENCES final.drugbrand(drug_brand_generic_code)
ON DELETE RESTRICT
ON UPDATE RESTRICT;
ALTER TABLE final.claim
ADD FOREIGN KEY claim_member_id_fk(member_id)
REFERENCES final.member(member_id)
ON DELETE CASCADE
ON UPDATE CASCADE;
ALTER TABLE final.claim
ADD FOREIGN KEY claim_drug_ndc_fk(drug_ndc)
REFERENCES final.drugname(drug_ndc)
ON DELETE RESTRICT
ON UPDATE RESTRICT;
--
--
--
SELECT d.drug_name, COUNT(a.fill_date) AS no_of_prescriptions
FROM drugname d
INNER JOIN claim a ON d.drug_ndc = a.drug_ndc
GROUP BY d.drug_name
ORDER BY d.drug_name;
--
--
--
DROP TABLE IF EXISTS `f42`;
CREATE TABLE `f42` AS
SELECT a.member_id, a.fill_date, a.copay, a.insurancepaid, f.member_age
FROM claim a
INNER JOIN final.member f ON a.member_id = f.member_id;
SELECT COUNT(fill_date) AS total_prescreptions, COUNT(DISTINCT member_id) AS unique_members, SUM(copay)as total_copay, SUM(insurancepaid) as total_insurancepaid,
CASE
WHEN member_age >= 65 THEN "age 65+"
WHEN member_age < 65 THEN "age < 65"
END AS age
FROM f42
group by age
order by age;
--
--
--
DROP TABLE IF EXISTS `f43`;
CREATE TABLE `f43` AS
SELECT f.member_id, f.member_first_name, f.member_last_name, d.drug_name, a.fill_date, a.insurancepaid
FROM final.member f
INNER JOIN claim a ON a.member_id = f.member_id
INNER JOIN drugname d ON d.drug_ndc = a.drug_ndc;
SELECT z.member_id, z.member_first_name, z.member_last_name, z.drug_name, z.mr_filldate, z.mr_insurancepaid
FROM (SELECT DISTINCT member_id,
member_first_name,
member_last_name,
drug_name,
fill_date AS mr_filldate,
insurancepaid AS mr_insurancepaid,
ROW_NUMBER() OVER (PARTITION BY member_id ORDER BY member_id, fill_date DESC) AS FLAG
FROM f43) AS z
WHERE FLAG = 1;
--
--
--
|
/*
SQL practice in Udacity's 'Programming for Data Science' Nanodegree Program
SQL > Lesson 8 > Project: Investigate the 'Sakila DVD rental database'
Section 13: Question Set #2
Question 2:
We would like to know who were our top 10 paying customers, how many payments
they made on a monthly basis during 2007, and what was the amount of the
monthly payments. Can you write a query to capture the customer name,
month and year of payment, and total payment amount for each month by these
top 10 paying customers?
Check your Solution:
The following table header provides a preview of what your table should look
like. The results are sorted first by customer name and then for each month.
As you can see, total amounts per month are listed for each customer.
HINT: One way to solve is to use a subquery, limit within the subquery, and
use concatenation to generate the customer name.
*/
/*--------------------------- Correct Solution ------------------------------*/
WITH top_customers AS (
SELECT DISTINCT c.first_name || ' ' || c.last_name AS full_name,
SUM(p.amount) OVER ( PARTITION BY (c.first_name || c.last_name))
FROM customer c
JOIN payment p
ON c.customer_id = p.customer_id
ORDER BY 2 DESC
LIMIT 10),
payment_details AS (
SELECT c.first_name || ' ' || c.last_name AS full_name,
DATE_TRUNC('month', p.payment_date) AS pay_month,
DATE_PART('year', p.payment_date) AS pay_year,
p.amount
FROM customer c
JOIN payment p
ON c.customer_id = p.customer_id)
SELECT pd.pay_month,
tc.full_name,
COUNT(pd.amount) AS pay_count_per_month,
SUM(pd.amount) AS pay_amount_per_month
FROM top_customers tc
JOIN payment_details pd
ON tc.full_name = pd.full_name
WHERE pd.pay_year = 2007
GROUP BY 1, 2
ORDER BY 2, 1;
/*
Output 34 results
Note:
You cannot use WINDOW funtions in the main query to calculate COUNT and SUM
calculations, as there are grouped by more than one category. If you use
WINDOW functions then the result will have runnig_count and running_sum
instead of COUNT and SUM. See the below quey for reference, the result is
not a correct solution as it contains running_count and running_sum.
*/
/*----------------- Incorrect Solution, only for reference ------------------*/
WITH top_customers AS (
SELECT DISTINCT c.first_name || ' ' || c.last_name AS full_name,
SUM(p.amount) OVER ( PARTITION BY (c.first_name || c.last_name))
FROM customer c
JOIN payment p
ON c.customer_id = p.customer_id
ORDER BY 2 DESC
LIMIT 10),
payment_details AS (
SELECT c.first_name || ' ' || c.last_name AS full_name,
DATE_TRUNC('month', p.payment_date) AS pay_month,
DATE_PART('year', p.payment_date) AS pay_year,
p.amount
FROM customer c
JOIN payment p
ON c.customer_id = p.customer_id)
SELECT DISTINCT pd.pay_month,
tc.full_name,
COUNT(pd.amount) OVER (PARTITION BY tc.full_name ORDER BY pd.pay_month) AS pay_count_per_month,
SUM(pd.amount) OVER (PARTITION BY tc.full_name ORDER BY pd.pay_month) AS pay_amount_per_month
FROM top_customers tc
JOIN payment_details pd
ON tc.full_name = pd.full_name
WHERE pd.pay_year = 2007
ORDER BY 2, 1;
/*
Output 34 results
but with running_count and running_sum instead of COUNT and SUM
*/
/* Peer Query Approach 1*/
SELECT DATE_TRUNC('month', p.payment_date) AS pay_mon,
CONCAT (c.first_name, ' ', c.last_name),
COUNT(payment_id) AS month_count
FROM payment p
JOIN customer c
ON p.customer_id = c.customer_id
GROUP BY 1, 2, p.customer_id
HAVING p.customer_id in (SELECT id
FROM(
SELECT customer_id id,
sum(amount) payment_sum
FROM payment
GROUP BY 1
ORDER BY 2 DESC
LIMIT 10
) t1
)
ORDER BY 2, 1
/* Peer Query Approach 1*/
SELECT DATE_TRUNC('month', p.payment_date) AS pay_mon,
CONCAT (c.first_name, ' ', c.last_name) AS full_name,
COUNT(payment_id) AS month_count
FROM (
SELECT customer_id,
SUM(amount) payment_sum
FROM payment
GROUP BY 1
ORDER BY 2 DESC
LIMIT 10) t1
JOIN payment p
ON t1.customer_id = p.customer_id
JOIN customer c
ON p.customer_id = c.customer_id
GROUP BY 1, 2
ORDER BY 2, 1
|
DROP SEQUENCE billID;
DROP TABLE Bill;
DROP INDEX XPKBill;
DROP INDEX XIF4Bill;
DROP INDEX XIF5Bill;
DROP INDEX XIF6Bill;
DROP SEQUENCE shippingItemID;
DROP TABLE ShippingItem;
DROP INDEX XPKShippingItem;
DROP INDEX XIF1ShippingItem;
DROP INDEX XIF2ShippingItem;
DROP SEQUENCE shippingID;
DROP TABLE Shipping;
DROP INDEX XPKShipping;
DROP INDEX XIF3Shipping;
DROP INDEX XIF4Shipping;
DROP SEQUENCE orderDetailID;
DROP TABLE OrderDetail;
DROP INDEX XPKOrderDetail;
DROP INDEX XIF3OrderDetail;
DROP INDEX XIF4OrderDetail;
DROP SEQUENCE orderTitleID;
DROP TABLE OrderTitle;
DROP INDEX XPKOrderTitle;
DROP INDEX XIF2OrderTitle;
DROP SEQUENCE itemID;
DROP TABLE Item;
DROP INDEX XPKItem;
DROP SEQUENCE customerID;
DROP TABLE Customer;
DROP INDEX XPKCustomer;
|
/* Formatted on 21/07/2014 18:44:09 (QP5 v5.227.12220.39754) */
CREATE OR REPLACE FORCE VIEW MCRE_OWN.V_MCRES_FEN_RETT_DRCYTD_POS
(
COD_ABI,
COD_NDG,
COD_SNDG,
COD_FILIALE_AREA,
COD_DIVISIONE,
VAL_DRC_YTD,
FLG_GAR_REALI,
FLG_GAR_REALI_PERSONALI
)
AS
WITH --- VG 08/11/2011 -1
DIVISIONE
AS (SELECT DISTINCT
CP.COD_ABI,
CP.COD_NDG,
CP.COD_SNDG,
CP.COD_FILIALE_AREA,
CASE
WHEN O.COD_DIV IN ('DIVRE', 'DIVCI', 'DIVPR')
THEN
1
WHEN O.COD_DIV IN ('DIVCC', 'DIVLC', 'DIVFI', 'DIVES')
THEN
2
ELSE
3
END
COD_DIVISIONE
FROM T_MCRES_APP_SISBA_CP CP,
V_MCRES_ULTIMA_ACQ_FILE F,
T_MCRE0_APP_STRUTTURA_ORG O
WHERE CP.COD_ABI = F.COD_ABI
AND CP.ID_DPER = F.ID_DPER
AND F.COD_FLUSSO = 'SISBA_CP'
AND CP.COD_ABI = O.COD_ABI_ISTITUTO
AND CP.COD_FILIALE = O.COD_STRUTTURA_COMPETENTE),
POSIZIONI
AS ( SELECT DISTINCT d.COD_ABI,
d.COD_NDG,
1 val_esiste,
SUM (C.VAL_UTI_RET - C.VAL_ATT) val_anno_cp
FROM T_MCRES_APP_DELIBERE D,
T_MCRES_APP_SISBA_CP C,
V_MCRES_APP_ULTIMO_ANNOMESEabi a
WHERE D.COD_DELIBERA = 'NS'
AND d.COD_ABI = c.COD_ABI
AND D.COD_NDG = C.COD_NDG
AND D.COD_ABI = A.COD_ABI
AND SUBSTR (C.ID_DPER, 1, 6) =
SUBSTR (A.VAL_ANNOMESE_ULTIMO_SISBA_CP, 1, 4)
- 1
|| 12
AND TO_CHAR (DTA_INSERIMENTO_DELIBERA, 'YYYY') =
SUBSTR (A.VAL_ANNOMESE_ULTIMO_SISBA_CP, 1, 4)
AND C.COD_STATO_RISCHIO = 'S'
GROUP BY d.COD_ABI, d.COD_NDG),
RAPPORTI
AS ( SELECT P.COD_ABI,
P.COD_NDG,
SUM (
(-1 * R.VAL_IMP_GBV_INIZIALE)
- (-1 * R.VAL_IMP_NBV_INIZIALE))
val_rapporti_iniziale,
SUM (val_anno_cp) val_anno_cp
FROM T_MCRES_APP_RAPPORTI R, POSIZIONI P
WHERE P.COD_ABI = R.COD_ABI AND P.COD_NDG = R.COD_NDG
GROUP BY P.COD_ABI, P.COD_NDG),
RV_YTD
AS ( SELECT E.COD_ABI,
E.COD_NDG,
SUM (E.VAL_rvytd) VAL_RETTIFICA_anno,
NVL (VAL_ESISTE, 0) FLG_GRUPPO_A,
E.FLG_GAR_REALI,
E.FLG_GAR_REALI_PERSONALI
FROM v_mcres_fen_rett_rvytd_pos E, POSIZIONI p
WHERE E.COD_ABI = P.COD_ABI(+) AND E.COD_NDG = P.COD_NDG(+)
GROUP BY E.COD_ABI,
E.COD_NDG,
NVL (VAL_ESISTE, 0),
E.FLG_GAR_REALI,
E.FLG_GAR_REALI_PERSONALI)
SELECT E.COD_ABI,
E.COD_NDG,
COD_SNDG,
cod_filiale_area,
NVL (COD_DIVISIONE, 3) COD_DIVISIONE,
SUM (
CASE
WHEN flg_gruppo_a = 1
THEN
NVL (E.VAL_RETTIFICA_anno, 0)
- NVL (R.VAL_RAPPORTI_INIZIALE, 0)
- NVL (r.val_anno_cp, 0)
ELSE
NVL (E.VAL_RETTIFICA_ANNO, 0)
END)
VAL_DRC_ytd,
FLG_GAR_REALI,
FLG_GAR_REALI_PERSONALI
FROM RAPPORTI R, RV_YTD E, DIVISIONE d
WHERE e.COD_ABI = r.COD_ABI(+)
AND E.COD_NDG = R.COD_NDG(+)
AND e.COD_ABI = d.COD_ABI(+)
AND E.COD_NDG = D.COD_NDG(+)
GROUP BY E.COD_ABI,
E.COD_NDG,
NVL (COD_DIVISIONE, 3),
COD_SNDG,
cod_filiale_area,
FLG_GAR_REALI,
FLG_GAR_REALI_PERSONALI;
|
-- phpMyAdmin SQL Dump
-- version 3.5.8.1deb1
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Oct 12, 2013 at 05:27 PM
-- Server version: 5.5.32-0ubuntu0.13.04.1
-- PHP Version: 5.4.9-4ubuntu2.3
SET FOREIGN_KEY_CHECKS=0;
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 utf8 */;
--
-- Database: `phinale`
--
DROP DATABASE IF EXISTS `phinale`;
CREATE DATABASE `phinale` DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
USE `phinale`;
-- --------------------------------------------------------
--
-- Table structure for table `config`
--
-- Creation: Oct 05, 2013 at 09:59 PM
--
DROP TABLE IF EXISTS `config`;
CREATE TABLE IF NOT EXISTS `config` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(48) COLLATE utf8_unicode_ci NOT NULL,
`value` text COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=5 ;
--
-- Dumping data for table `config`
--
INSERT INTO `config` (`id`, `name`, `value`) VALUES
(1, 'movie.dir', '/home/escudeiro/Videos'),
(2, 'movie.search-interval', '1'),
(3, 'movie.last-search', ''),
(4, 'movie.ext', 'avi,mkv,mp4');
-- --------------------------------------------------------
--
-- Table structure for table `movie`
--
-- Creation: Oct 05, 2013 at 11:41 PM
--
DROP TABLE IF EXISTS `movie`;
CREATE TABLE IF NOT EXISTS `movie` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`year` year(4) DEFAULT NULL,
`description` tinytext COLLATE utf8_unicode_ci,
`created_at` datetime NOT NULL,
`updated_at` datetime NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `ixuq` (`name`,`year`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=55 ;
--
-- Dumping data for table `movie`
--
INSERT INTO `movie` (`id`, `name`, `year`, `description`, `created_at`, `updated_at`) VALUES
(53, 'Pacific Rim', 2013, NULL, '2013-10-12 04:51:56', '2013-10-12 04:51:56'),
(54, 'Oblivion', 2013, NULL, '2013-10-12 04:51:56', '2013-10-12 04:51:56');
-- --------------------------------------------------------
--
-- Table structure for table `movie_attribute`
--
-- Creation: Oct 12, 2013 at 10:56 AM
--
DROP TABLE IF EXISTS `movie_attribute`;
CREATE TABLE IF NOT EXISTS `movie_attribute` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`movie_id` bigint(20) unsigned NOT NULL,
`class` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`culture` varchar(16) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`file` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`content` text COLLATE utf8_unicode_ci,
`created_at` datetime NOT NULL,
`updated_at` datetime NOT NULL,
PRIMARY KEY (`id`),
KEY `movie_id` (`movie_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=21 ;
--
-- Dumping data for table `movie_attribute`
--
INSERT INTO `movie_attribute` (`id`, `movie_id`, `class`, `culture`, `file`, `content`, `created_at`, `updated_at`) VALUES
(13, 53, 'Movie', '-', '/home/escudeiro/Videos/Pacific Rim (2013)/Pacific Rim.mkv', 'Pacific Rim.mkv', '2013-10-12 04:51:56', '2013-10-12 04:51:56'),
(14, 53, 'Fanart', '-', '/home/escudeiro/Videos/Pacific Rim (2013)/Pacific Rim-fanart.jpg', '', '2013-10-12 04:51:56', '2013-10-12 04:51:56'),
(15, 53, 'Poster', '-', '/home/escudeiro/Videos/Pacific Rim (2013)/folder.jpg', '', '2013-10-12 04:51:56', '2013-10-12 04:51:56'),
(16, 53, 'Trailer', '-', '/home/escudeiro/Videos/Pacific Rim (2013)/Pacific Rim-trailer.mov', '', '2013-10-12 04:51:56', '2013-10-12 04:51:56'),
(17, 54, 'Fanart', '-', '/home/escudeiro/Videos/Oblivion (2013)/Oblivion-fanart.jpg', '', '2013-10-12 04:51:56', '2013-10-12 04:51:56'),
(18, 54, 'Movie', '-', '/home/escudeiro/Videos/Oblivion (2013)/Oblivion.avi', 'Oblivion.avi', '2013-10-12 04:51:56', '2013-10-12 04:51:56'),
(19, 54, 'Sub', 'pt', '/home/escudeiro/Videos/Oblivion (2013)/Oblivion.pt.srt', 'Portuguese', '2013-10-12 04:51:56', '2013-10-12 04:51:56'),
(20, 54, 'Trailer', '-', '/home/escudeiro/Videos/Oblivion (2013)/Oblivion-trailer.mov', '', '2013-10-12 04:51:56', '2013-10-12 04:51:56');
--
-- Constraints for dumped tables
--
--
-- Constraints for table `movie_attribute`
--
ALTER TABLE `movie_attribute`
ADD CONSTRAINT `movie_attribute_ibfk_1` FOREIGN KEY (`movie_id`) REFERENCES `movie` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
SET FOREIGN_KEY_CHECKS=1;
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 favorites (name) VALUES ('charmander');
INSERT INTO favorites (name) VALUES ('gloom');
INSERT INTO favorites (name) VALUES ('rattata');
INSERT INTO favorites (name) VALUES ('pidgey'); |
CREATE DATABASE IF NOT EXISTS `parking` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */;
USE `parking`;
-- MySQL dump 10.13 Distrib 8.0.13, for Win64 (x86_64)
--
-- Host: localhost Database: parking
-- ------------------------------------------------------
-- Server version 8.0.13
/*!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 `bookdata`
--
DROP TABLE IF EXISTS `bookdata`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
SET character_set_client = utf8mb4 ;
CREATE TABLE `bookdata` (
`idbookdata` int(11) NOT NULL AUTO_INCREMENT,
`lot` varchar(45) NOT NULL,
`datein` varchar(45) NOT NULL,
`timein` varchar(45) NOT NULL,
`timeout` varchar(45) NOT NULL,
`name` varchar(45) DEFAULT NULL,
`license` varchar(45) DEFAULT NULL,
`phone` varchar(45) DEFAULT NULL,
`other` varchar(99) DEFAULT NULL,
`check` varchar(45) DEFAULT NULL,
PRIMARY KEY (`idbookdata`)
) ENGINE=InnoDB AUTO_INCREMENT=105 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `bookdata`
--
LOCK TABLES `bookdata` WRITE;
/*!40000 ALTER TABLE `bookdata` DISABLE KEYS */;
INSERT INTO `bookdata` VALUES (95,'A5','19/12/2018','12:00','14:00','GG','58','-','','0'),(101,'Z5','30/12/2018','9:00','14:00','Owen','กข57','-','','0'),(102,'B1','20/12/2018','13:00','16:00','mez','88','-','','0'),(103,'L5','21/12/2018','10:00','14:00','Fluke','คล67','021345687','','0'),(104,'B5','30/12/2018','14:00','17:00','KP','ขจ58','-','มีรอยถลอกหลังรถ','0');
/*!40000 ALTER TABLE `bookdata` 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 2018-12-18 23:52:02
|
#
# Oracle R Enterprise Book - by Brendan Tierney
# Published by : McGraw-Hill / Oracle Press
#
# Chapter 9 : Creating ORE Scripts : SQL file
#
-- Create a user defined R script
BEGIN
sys.rqScriptCreate('DEMO_LM_APPLY',
'function(dat, ds_name) {
ore.load(ds_name)
pre <- predict(mod, newdata=dat, supplemental.cols="alcohol")
res <- cbind(dat, PRED=pre)
res <- res[,c("alcohol", "PRED")]
} ');
END;
-- Create a global R Script
BEGIN sys.rqScriptDrop('DEMO_LM_APPLY'); END;
BEGIN
sys.rqScriptCreate('DEMO_LM_APPLY',
'function(dat, ds_name) {
ore.load(ds_name)
pre <- predict(mod, newdata=dat, supplemental.cols="alcohol")
res <- cbind(dat, PRED=pre)
res <- res[,c("alcohol", "PRED")]
} ', TRUE);
END;
-- Run the apply script on the new data
select *
from table(rqTableEval(cursor(select * from white_wine),
cursor(select 1 as "ore.connect", 'DEMO_LM_DS' as "ds_name" from dual),
'select 1 as "alcohol", 1 as "PRED" from dual',
'DEMO_LM_APPLY') );
-- Recreate an ORE Script and make it private.
BEGIN
sys.rqScriptCreate('DEMO_LM_APPLY',
'function(dat, ds_name) {
ore.load(ds_name)
pre <- predict(mod, newdata=dat, supplemental.cols="alcohol")
res <- cbind(dat, PRED=pre)
res <- res[,c("alcohol", "PRED")]
} ', FALSE, TRUE);
END;
-- Run the script using the rqTableEval function
select *
from table(rqTableEval(cursor(select * from white_wine),
cursor(select 1 as "ore.connect", 'DEMO_LM_DS' as "ds_name" from dual),
'select 1 as "alcohol", 1 as "PRED" from dual',
'DEMO_LM_APPLY') );
--
-- Using the sys.rqScriptDrop function to remove an ORE script
BEGIN
sys.rqScriptDrop('DEMO_LM_APPLY');
END;
--
-- Grant the DMUSER user access to the DEMO_LM_APPLY ORE script
BEGIN
rqGrant('DEMO_LM_APPLY', 'rqscript', 'DMUSER');
END;
--
-- Grant the DMUSER user access to the DEMO_LM_APPLY ORE script
BEGIN
rqRevoke('DEMO_LM_APPLY', 'rqscript', 'DMUSER');
END;
--
-- Viewing the scripts in the ORE script repository
--
select * from all_rq_scripts;
select * from user_rq_scripts;
select * from user_rq_script_privs;
select * from sys.rq_scripts;
select * from sys.rq_scripts where owner='RQSYS';
|
# Write your MySQL query statement below
# the number of customers who had at least one bill with an amount strictly greater than 500
SELECT COUNT(DISTINCT customer_id) AS rich_count
FROM STORE
WHERE amount > 500
|
-- Months
-- You must not change the next 2 lines or the table definition.
SET SEARCH_PATH TO uber, public;
drop table if exists q1 cascade;
create table q1(
client_id INTEGER,
email VARCHAR(30),
months INTEGER
);
DROP VIEW IF EXISTS Rides CASCADE;
DROP VIEW IF EXISTS UniqueMonths CASCADE;
-- These are the rides that were completed. The datetimes used here are
-- those of the request, not the drop off
CREATE VIEW Rides AS
SELECT Dropoff.request_id request_id, Request.datetime datetime, client_id
FROM Dropoff JOIN Request on Dropoff.request_id=Request.request_id;
-- These are the unique months that a given client has had ride(s) in
CREATE VIEW UniqueMonths AS
SELECT DISTINCT cast(extract(year from datetime) as varchar(7)) ||
cast(extract(month from datetime) as varchar(7)) as month, client_id
FROM Rides ;
-- LEFT JOIN here is used to preserve clients with no rides
insert into q1
SELECT Client.client_id,email,count(month)
FROM Client LEFT JOIN UniqueMonths ON Client.client_id=UniqueMonths.client_id
GROUP BY Client.client_id;
|
CREATE USER zabbix IDENTIFIED BY <PASSWORD>;
-- Grant access to the zabbix user.
GRANT CONNECT, CREATE SESSION TO zabbix;
GRANT SELECT ON v_$instance TO zabbix;
GRANT SELECT ON v_$database TO zabbix;
GRANT SELECT ON v_$sysmetric TO zabbix;
GRANT SELECT ON v_$system_parameter TO zabbix;
GRANT SELECT ON v_$session TO zabbix;
GRANT SELECT ON v_$recovery_file_dest TO zabbix;
GRANT SELECT ON v_$active_session_history TO zabbix;
GRANT SELECT ON v_$osstat TO zabbix;
GRANT SELECT ON v_$restore_point TO zabbix;
GRANT SELECT ON v_$restore_point TO zabbix;
GRANT SELECT ON v_$process TO zabbix;
GRANT SELECT ON v_$datafile TO zabbix;
GRANT SELECT ON v_$pgastat TO zabbix;
GRANT SELECT ON v_$sgastat TO zabbix;
GRANT SELECT ON v_$log TO zabbix;
GRANT SELECT ON v_$archive_dest TO zabbix;
GRANT SELECT ON v_$asm_diskgroup TO zabbix;
GRANT SELECT ON sys.dba_data_files TO zabbix;
GRANT SELECT ON DBA_TABLESPACES TO zabbix;
GRANT SELECT ON DBA_TABLESPACE_USAGE_METRICS TO zabbix;
GRANT SELECT ON DBA_USERS TO zabbix;
-- Required for v$restore_point
grant SELECT_CATALOG_ROLE to zabbix;
-- Additional grants
grant select on dba_objects to zabbix;
grant select on dba_indexes to zabbix;
grant select on dba_ind_partitions to zabbix;
grant select on dba_segments to zabbix; |
CREATE EXTENSION IF NOT EXISTS postgres_fdw;
DROP SERVER IF EXISTS temporal_db CASCADE;
CREATE SERVER temporal_db
FOREIGN DATA WRAPPER postgres_fdw
OPTIONS (host 'localhost', port '5432', dbname 'temporal');
CREATE USER MAPPING FOR postgres
SERVER temporal_db
OPTIONS (user 'postgres', password '<pwd>');
ALTER SERVER temporal_db OPTIONS (add use_remote_estimate 'true',add fetch_size '50000');
DROP SCHEMA IF EXISTS temporal CASCADE;
CREATE SCHEMA temporal;
IMPORT FOREIGN SCHEMA public FROM SERVER temporal_db INTO temporal;
|
--
-- EXTENDCOMMENT-2 : Add the possibility to notify a mailing list when a comment is added.
--
ALTER TABLE extend_comment_config ADD COLUMN id_mailing_list INT DEFAULT 0 NOT NULL;
ALTER TABLE extend_comment_config ADD COLUMN authorize_sub_comments SMALLINT default 0 NOT NULL;
ALTER TABLE extend_comment_config ADD COLUMN use_bbcode SMALLINT default 1 NOT NULL;
ALTER TABLE extend_comment_config ADD COLUMN admin_badge LONG VARCHAR NOT NULL;
ALTER TABLE extend_comment_config ADD COLUMN message_comment_created LONG VARCHAR NOT NULL;
ALTER TABLE extend_comment ADD COLUMN date_last_modif TIMESTAMP;
ALTER TABLE extend_comment ADD COLUMN id_parent_comment INT DEFAULT 0 NOT NULL;
ALTER TABLE extend_comment ADD COLUMN is_admin_comment SMALLINT DEFAULT 0 NOT NULL;
UPDATE extend_comment_config SET admin_badge = '<span class="badge badge-warning">#i18n{module.extend.comment.comment_info.labelAdminComment}</span>';
|
/* Formatted on 21/07/2014 18:37:22 (QP5 v5.227.12220.39754) */
CREATE OR REPLACE FORCE VIEW MCRE_OWN.V_MCRE0_PCR_SCSB
(
ID_DPER_SCSB,
FLG_LAST_RUN,
ID_DPER,
COD_ABI_ISTITUTO,
COD_ABI_CARTOLARIZZATO,
COD_NDG,
COD_SNDG,
SCSB_ACC_CONSEGNE,
SCSB_ACC_CONSEGNE_DT,
SCSB_UTI_CONSEGNE,
SCSB_UTI_CONSEGNE_DT,
SCSB_UTI_MASSIMALI,
SCSB_UTI_SOSTITUZIONI,
SCSB_UTI_RISCHI_INDIRETTI,
SCSB_UTI_MASSIMALI_DT,
SCSB_UTI_SOSTITUZIONI_DT,
SCSB_UTI_RISCHI_INDIRETTI_DT,
SCSB_ACC_MASSIMALI,
SCSB_ACC_SOSTITUZIONI,
SCSB_ACC_RISCHI_INDIRETTI,
SCSB_ACC_MASSIMALI_DT,
SCSB_ACC_SOSTITUZIONI_DT,
SCSB_ACC_RISCHI_INDIRETTI_DT,
SCSB_UTI_CASSA,
SCSB_UTI_FIRMA,
SCSB_UTI_TOT,
SCSB_ACC_CASSA,
SCSB_ACC_FIRMA,
SCSB_ACC_TOT,
SCSB_UTI_CASSA_BT,
SCSB_UTI_CASSA_MLT,
SCSB_UTI_SMOBILIZZO,
SCSB_UTI_FIRMA_DT,
SCSB_ACC_CASSA_BT,
SCSB_ACC_CASSA_MLT,
SCSB_ACC_SMOBILIZZO,
SCSB_ACC_FIRMA_DT,
SCSB_TOT_GAR,
SCSB_DTA_RIFERIMENTO,
DTA_INS,
DTA_UPD,
MY_RNK
)
AS
SELECT ID_DPER_SCSB,
FLG_LAST_RUN,
ID_DPER,
COD_ABI_ISTITUTO,
COD_ABI_CARTOLARIZZATO,
COD_NDG,
COD_SNDG,
SCSB_ACC_CONSEGNE,
SCSB_ACC_CONSEGNE_DT,
SCSB_UTI_CONSEGNE,
SCSB_UTI_CONSEGNE_DT,
SCSB_UTI_MASSIMALI,
SCSB_UTI_SOSTITUZIONI,
SCSB_UTI_RISCHI_INDIRETTI,
SCSB_UTI_MASSIMALI_DT,
SCSB_UTI_SOSTITUZIONI_DT,
SCSB_UTI_RISCHI_INDIRETTI_DT,
SCSB_ACC_MASSIMALI,
SCSB_ACC_SOSTITUZIONI,
SCSB_ACC_RISCHI_INDIRETTI,
SCSB_ACC_MASSIMALI_DT,
SCSB_ACC_SOSTITUZIONI_DT,
SCSB_ACC_RISCHI_INDIRETTI_DT,
SCSB_UTI_CASSA,
SCSB_UTI_FIRMA,
SCSB_UTI_TOT,
SCSB_ACC_CASSA,
SCSB_ACC_FIRMA,
SCSB_ACC_TOT,
SCSB_UTI_CASSA_BT,
SCSB_UTI_CASSA_MLT,
SCSB_UTI_SMOBILIZZO,
SCSB_UTI_FIRMA_DT,
SCSB_ACC_CASSA_BT,
SCSB_ACC_CASSA_MLT,
SCSB_ACC_SMOBILIZZO,
SCSB_ACC_FIRMA_DT,
SCSB_TOT_GAR,
SCSB_DTA_RIFERIMENTO,
DTA_INS,
DTA_UPD,
my_rnk
FROM (SELECT RANK ()
OVER (PARTITION BY --COD_ABI_ISTITUTO,
COD_NDG, COD_ABI_CARTOLARIZZATO
ORDER BY ID_DPER_SCSB DESC)
my_rnk,
COD_ABI_ISTITUTO,
COD_ABI_CARTOLARIZZATO,
COD_NDG,
COD_SNDG,
ID_DPER_SCSB,
FLG_LAST_RUN,
ID_DPER,
CASE
WHEN ID_DPER_SCSB < ID_DPER THEN NULL
ELSE SCSB_ACC_CONSEGNE
END
SCSB_ACC_CONSEGNE,
CASE
WHEN ID_DPER_SCSB < ID_DPER THEN NULL
ELSE SCSB_ACC_CONSEGNE_DT
END
SCSB_ACC_CONSEGNE_DT,
CASE
WHEN ID_DPER_SCSB < ID_DPER THEN NULL
ELSE SCSB_UTI_CONSEGNE
END
SCSB_UTI_CONSEGNE,
CASE
WHEN ID_DPER_SCSB < ID_DPER THEN NULL
ELSE SCSB_UTI_CONSEGNE_DT
END
SCSB_UTI_CONSEGNE_DT,
CASE
WHEN ID_DPER_SCSB < ID_DPER THEN NULL
ELSE SCSB_UTI_MASSIMALI
END
SCSB_UTI_MASSIMALI,
CASE
WHEN ID_DPER_SCSB < ID_DPER THEN NULL
ELSE SCSB_UTI_SOSTITUZIONI
END
SCSB_UTI_SOSTITUZIONI,
CASE
WHEN ID_DPER_SCSB < ID_DPER THEN NULL
ELSE SCSB_UTI_RISCHI_INDIRETTI
END
SCSB_UTI_RISCHI_INDIRETTI,
CASE
WHEN ID_DPER_SCSB < ID_DPER THEN NULL
ELSE SCSB_UTI_MASSIMALI_DT
END
SCSB_UTI_MASSIMALI_DT,
CASE
WHEN ID_DPER_SCSB < ID_DPER THEN NULL
ELSE SCSB_UTI_SOSTITUZIONI_DT
END
SCSB_UTI_SOSTITUZIONI_DT,
CASE
WHEN ID_DPER_SCSB < ID_DPER THEN NULL
ELSE SCSB_UTI_RISCHI_INDIRETTI_DT
END
SCSB_UTI_RISCHI_INDIRETTI_DT,
CASE
WHEN ID_DPER_SCSB < ID_DPER THEN NULL
ELSE SCSB_ACC_MASSIMALI
END
SCSB_ACC_MASSIMALI,
CASE
WHEN ID_DPER_SCSB < ID_DPER THEN NULL
ELSE SCSB_ACC_SOSTITUZIONI
END
SCSB_ACC_SOSTITUZIONI,
CASE
WHEN ID_DPER_SCSB < ID_DPER THEN NULL
ELSE SCSB_ACC_RISCHI_INDIRETTI
END
SCSB_ACC_RISCHI_INDIRETTI,
CASE
WHEN ID_DPER_SCSB < ID_DPER THEN NULL
ELSE SCSB_ACC_MASSIMALI_DT
END
SCSB_ACC_MASSIMALI_DT,
CASE
WHEN ID_DPER_SCSB < ID_DPER THEN NULL
ELSE SCSB_ACC_SOSTITUZIONI_DT
END
SCSB_ACC_SOSTITUZIONI_DT,
CASE
WHEN ID_DPER_SCSB < ID_DPER THEN NULL
ELSE SCSB_ACC_RISCHI_INDIRETTI_DT
END
SCSB_ACC_RISCHI_INDIRETTI_DT,
CASE
WHEN ID_DPER_SCSB < ID_DPER THEN NULL
ELSE SCSB_UTI_CASSA
END
SCSB_UTI_CASSA,
CASE
WHEN ID_DPER_SCSB < ID_DPER THEN NULL
ELSE SCSB_UTI_FIRMA
END
SCSB_UTI_FIRMA,
CASE
WHEN ID_DPER_SCSB < ID_DPER THEN NULL
ELSE SCSB_UTI_TOT
END
SCSB_UTI_TOT,
CASE
WHEN ID_DPER_SCSB < ID_DPER THEN NULL
ELSE SCSB_ACC_CASSA
END
SCSB_ACC_CASSA,
CASE
WHEN ID_DPER_SCSB < ID_DPER THEN NULL
ELSE SCSB_ACC_FIRMA
END
SCSB_ACC_FIRMA,
CASE
WHEN ID_DPER_SCSB < ID_DPER THEN NULL
ELSE SCSB_ACC_TOT
END
SCSB_ACC_TOT,
CASE
WHEN ID_DPER_SCSB < ID_DPER THEN NULL
ELSE SCSB_UTI_CASSA_BT
END
SCSB_UTI_CASSA_BT,
CASE
WHEN ID_DPER_SCSB < ID_DPER THEN NULL
ELSE SCSB_UTI_CASSA_MLT
END
SCSB_UTI_CASSA_MLT,
CASE
WHEN ID_DPER_SCSB < ID_DPER THEN NULL
ELSE SCSB_UTI_SMOBILIZZO
END
SCSB_UTI_SMOBILIZZO,
CASE
WHEN ID_DPER_SCSB < ID_DPER THEN NULL
ELSE SCSB_UTI_FIRMA_DT
END
SCSB_UTI_FIRMA_DT,
CASE
WHEN ID_DPER_SCSB < ID_DPER THEN NULL
ELSE SCSB_ACC_CASSA_BT
END
SCSB_ACC_CASSA_BT,
CASE
WHEN ID_DPER_SCSB < ID_DPER THEN NULL
ELSE SCSB_ACC_CASSA_MLT
END
SCSB_ACC_CASSA_MLT,
CASE
WHEN ID_DPER_SCSB < ID_DPER THEN NULL
ELSE SCSB_ACC_SMOBILIZZO
END
SCSB_ACC_SMOBILIZZO,
CASE
WHEN ID_DPER_SCSB < ID_DPER THEN NULL
ELSE SCSB_ACC_FIRMA_DT
END
SCSB_ACC_FIRMA_DT,
CASE
WHEN ID_DPER_SCSB < ID_DPER THEN NULL
ELSE SCSB_TOT_GAR
END
SCSB_TOT_GAR,
CASE
WHEN ID_DPER_SCSB < ID_DPER THEN NULL
ELSE SCSB_DTA_RIFERIMENTO
END
SCSB_DTA_RIFERIMENTO,
DTA_INS,
DTA_UPD
FROM (SELECT pcr.id_dper id_dper_scsb,
pcr.FLG_LAST_RUN,
xx.id_dper,
XX.COD_ABI_ISTITUTO,
XX.COD_ABI_CARTOLARIZZATO,
XX.COD_NDG,
val_tot_ACC_CONSEGNE SCSB_ACC_CONSEGNE,
val_tot_ACC_CONSEGNE_DT SCSB_ACC_CONSEGNE_DT,
val_tot_UTI_CONSEGNE SCSB_UTI_CONSEGNE,
val_tot_UTI_CONSEGNE_DT SCSB_UTI_CONSEGNE_DT,
val_tot_uti_MASSIMALI scsb_uti_massimali,
val_tot_uti_sostituzioni scsb_uti_sostituzioni,
val_tot_uti_rischi_indiretti
scsb_uti_rischi_indiretti,
val_tot_dett_uti_MASSIMALI scsb_uti_massimali_dt,
val_tot_dett_uti_sostituzioni
scsb_uti_sostituzioni_dt,
val_tot_dett_uti_rischi_ind
scsb_uti_rischi_indiretti_dt,
val_tot_acc_MASSIMALI scsb_acc_massimali,
val_tot_acc_sostituzioni scsb_acc_sostituzioni,
val_tot_acc_rischi_indiretti
scsb_acc_rischi_indiretti,
val_tot_dett_acc_MASSIMALI scsb_acc_massimali_dt,
val_tot_dett_acc_sostituzioni
scsb_acc_sostituzioni_dt,
val_tot_dett_acc_rischi_ind
scsb_acc_rischi_indiretti_dt,
val_tot_uti_cassa scsb_uti_cassa,
val_tot_uti_firma scsb_uti_firma,
(val_tot_uti_cassa + val_tot_uti_firma)
scsb_uti_tot,
val_tot_acc_cassa scsb_acc_cassa,
val_tot_acc_firma scsb_acc_firma,
(val_tot_acc_cassa + val_tot_acc_firma)
scsb_acc_tot,
val_tot_dett_uti_cassa_bt scsb_uti_cassa_bt,
val_tot_dett_uti_cassa_mlt scsb_uti_cassa_mlt,
val_tot_dett_uti_smobilizzo scsb_uti_smobilizzo,
val_tot_dett_uti_firma scsb_uti_firma_dt,
val_tot_dett_acc_cassa_bt scsb_acc_cassa_bt,
val_tot_dett_acc_cassa_mlt scsb_acc_cassa_mlt,
val_tot_dett_acc_smobilizzo scsb_acc_smobilizzo,
val_tot_dett_acc_firma scsb_acc_firma_dt,
val_tot_gar scsb_tot_gar,
dta_riferimento scsb_dta_riferimento,
xx.cod_sndg,
SYSDATE dta_ins,
SYSDATE dta_upd
FROM ( SELECT cod_abi_istituto,
cod_ndg,
pcr.id_dper,
r.FLG_LAST_RUN,
SUM (
CASE
WHEN cl.cod_classe_appl_cf = 'CO'
THEN
pcr.val_imp_uti_cli
ELSE
0
END)
val_tot_uti_CONSEGNE,
SUM (
CASE
WHEN cl.cod_classe_appl_cf = 'CO'
THEN
pcr.val_imp_uti_cli
ELSE
0
END)
val_tot_uti_CONSEGNE_DT,
SUM (
CASE
WHEN cl.cod_classe_appl_cf = 'CO'
THEN
pcr.val_imp_ACC_cli
ELSE
0
END)
val_tot_ACC_CONSEGNE,
SUM (
CASE
WHEN cl.cod_classe_appl_cf = 'CO'
THEN
pcr.val_imp_ACC_cli
ELSE
0
END)
val_tot_ACC_CONSEGNE_DT,
SUM (
CASE
WHEN cl.cod_classe_appl_cf = 'ST'
THEN
pcr.val_imp_uti_cli
ELSE
0
END)
val_tot_uti_sostituzioni,
SUM (
CASE
WHEN cl.cod_classe_appl_cf = 'MS'
THEN
pcr.val_imp_uti_cli
ELSE
0
END)
val_tot_uti_massimali,
SUM (
CASE
WHEN cl.cod_classe_appl_cf = 'RI'
THEN
pcr.val_imp_uti_cli
ELSE
0
END)
val_tot_uti_rischi_indiretti,
SUM (
CASE
WHEN cl.cod_classe_appl_cf = 'ST'
THEN
pcr.val_imp_acc_cli
ELSE
0
END)
val_tot_acc_sostituzioni,
SUM (
CASE
WHEN cl.cod_classe_appl_cf = 'MS'
THEN
pcr.val_imp_acc_cli
ELSE
0
END)
val_tot_acc_massimali,
SUM (
CASE
WHEN cl.cod_classe_appl_cf = 'RI'
THEN
pcr.val_imp_acc_cli
ELSE
0
END)
val_tot_acc_rischi_indiretti,
SUM (
CASE
WHEN cl.cod_classe_appl_cf = 'ST'
THEN
pcr.val_imp_uti_cli
ELSE
0
END)
val_tot_dett_uti_sostituzioni,
SUM (
CASE
WHEN cl.cod_classe_appl_cf = 'MS'
THEN
pcr.val_imp_uti_cli
ELSE
0
END)
val_tot_dett_uti_massimali,
SUM (
CASE
WHEN cl.cod_classe_appl_cf = 'RI'
THEN
pcr.val_imp_uti_cli
ELSE
0
END)
val_tot_dett_uti_rischi_ind,
SUM (
CASE
WHEN cl.cod_classe_appl_cf = 'ST'
THEN
pcr.val_imp_acc_cli
ELSE
0
END)
val_tot_dett_acc_sostituzioni,
SUM (
CASE
WHEN cl.cod_classe_appl_cf = 'MS'
THEN
pcr.val_imp_acc_cli
ELSE
0
END)
val_tot_dett_acc_massimali,
SUM (
CASE
WHEN cl.cod_classe_appl_cf = 'RI'
THEN
pcr.val_imp_acc_cli
ELSE
0
END)
val_tot_dett_acc_rischi_ind,
---------------------- OLD
SUM (
CASE
WHEN cl.cod_classe_appl_cf = 'CA'
THEN
pcr.val_imp_uti_cli
ELSE
0
END)
val_tot_uti_cassa,
SUM (
CASE
WHEN cl.cod_classe_appl_cf = 'FI'
THEN
pcr.val_imp_uti_cli
ELSE
0
END)
val_tot_uti_firma,
SUM (
CASE
WHEN cl.cod_classe_appl_cf = 'CA'
THEN
pcr.val_imp_acc_cli
ELSE
0
END)
val_tot_acc_cassa,
SUM (
CASE
WHEN cl.cod_classe_appl_cf = 'FI'
THEN
pcr.val_imp_acc_cli
ELSE
0
END)
val_tot_acc_firma,
MAX (val_imp_gar_tot) val_tot_gar,
--stesso valore su tutte le Forme Tecniche
SUM (
CASE
WHEN cl.cod_classe_appl_dett = 'CB'
THEN
pcr.val_imp_uti_cli
ELSE
0
END)
val_tot_dett_uti_cassa_bt,
SUM (
CASE
WHEN cl.cod_classe_appl_dett = 'CM'
THEN
pcr.val_imp_uti_cli
ELSE
0
END)
val_tot_dett_uti_cassa_mlt,
SUM (
CASE
WHEN cl.cod_classe_appl_dett = 'SM'
THEN
pcr.val_imp_uti_cli
ELSE
0
END)
val_tot_dett_uti_smobilizzo,
SUM (
CASE
WHEN cl.cod_classe_appl_dett = 'FI'
THEN
pcr.val_imp_uti_cli
ELSE
0
END)
val_tot_dett_uti_firma,
SUM (
CASE
WHEN cl.cod_classe_appl_dett = 'CB'
THEN
pcr.val_imp_acc_cli
ELSE
0
END)
val_tot_dett_acc_cassa_bt,
SUM (
CASE
WHEN cl.cod_classe_appl_dett = 'CM'
THEN
pcr.val_imp_acc_cli
ELSE
0
END)
val_tot_dett_acc_cassa_mlt,
SUM (
CASE
WHEN cl.cod_classe_appl_dett = 'SM'
THEN
pcr.val_imp_acc_cli
ELSE
0
END)
val_tot_dett_acc_smobilizzo,
SUM (
CASE
WHEN cl.cod_classe_appl_dett = 'FI'
THEN
pcr.val_imp_acc_cli
ELSE
0
END)
val_tot_dett_acc_firma,
MAX (pcr.dta_riferimento) dta_riferimento
FROM t_mcre0_dwh_pscb pcr, -- t_mcre0_app_pcr_sc_sb pcr,
t_mcre0_app_natura_ftecnica cl,
(SELECT id_dper,
CASE
WHEN RANK ()
OVER (
ORDER BY id_dper DESC) =
1
THEN
1
ELSE
0
END
flg_last_run
FROM ( SELECT DISTINCT id_dper
FROM t_mcre0_dwh_pgb --T_MCRE0_APP_PCR_GB
ORDER BY id_dper DESC)
WHERE ROWNUM < 3) r
WHERE pcr.cod_forma_tecnica = cl.cod_ftecnica
AND pcr.id_dper = r.id_dper
GROUP BY pcr.cod_abi_istituto,
pcr.cod_ndg,
pcr.id_dper,
r.flg_last_run) pcr,
(SELECT cod_sndg,
cod_abi_cartolarizzato,
cod_abi_istituto,
cod_ndg,
id_dper
FROM t_mcre0_day_fg) xx
WHERE xx.cod_abi_istituto = pcr.cod_abi_istituto
AND xx.cod_ndg = pcr.cod_ndg))
WHERE my_rnk = 1;
|
DROP TABLE dentists;
DROP TABLE patients;
DROP TABLE invoices;
DROP TABLE efforts;
DROP TABLE materials;
DELETE FROM databasechangelog;
DELETE FROM databasechangeloglock; |
.headers on
.nullvalue '-null-'
.mode csv
-- -- 01
SELECT * FROM Survey WHERE quant = 'sal' AND (person != 'lake' OR person IS NULL);
|
-- phpMyAdmin SQL Dump
-- version 4.1.12
-- http://www.phpmyadmin.net
--
-- Хост: localhost
-- Час створення: Трв 22 2015 р., 08:39
-- Версія сервера: 5.7.5-m15
-- Версія PHP: 5.4.36
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 */;
--
-- База даних: `mathmaps`
--
-- --------------------------------------------------------
--
-- Структура таблиці `link`
--
CREATE TABLE IF NOT EXISTS `link` (
`higher_note_id` int(11) NOT NULL,
`lower_note_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Дамп даних таблиці `link`
--
INSERT INTO `link` (`higher_note_id`, `lower_note_id`) VALUES
(101, 38),
(38, 39),
(101, 39),
(35, 41),
(38, 41),
(101, 41),
(35, 42),
(101, 42),
(100, 44),
(100, 45),
(35, 46),
(43, 46),
(44, 46),
(100, 60),
(43, 61),
(100, 61),
(100, 62),
(62, 63),
(100, 63),
(61, 68),
(63, 68),
(69, 68),
(101, 69),
(100, 70),
(72, 71),
(101, 71),
(92, 78),
(63, 80),
(79, 80),
(79, 81),
(81, 82),
(45, 84),
(81, 84),
(80, 85),
(80, 87),
(80, 88),
(90, 91),
(89, 92),
(82, 94),
(60, 96),
(100, 96),
(96, 97),
(43, 100),
(35, 101);
-- --------------------------------------------------------
--
-- Структура таблиці `note`
--
CREATE TABLE IF NOT EXISTS `note` (
`note_id` int(11) NOT NULL,
`name` varchar(45) NOT NULL,
`publishing_status` int(11) DEFAULT NULL,
`rank` int(11) DEFAULT NULL,
`text` varchar(10000) NOT NULL,
`note_type_id` int(11) DEFAULT NULL
) ENGINE=InnoDB AUTO_INCREMENT=102 DEFAULT CHARSET=utf8;
--
-- Дамп даних таблиці `note`
--
INSERT INTO `note` (`note_id`, `name`, `publishing_status`, `rank`, `text`, `note_type_id`) VALUES
(4, 'Означення метрики', 0, NULL, 'dfasdsadasd', 1),
(19, 'фівафівафі', 0, NULL, 'вафівафіва', 1),
(20, 'фівафівафі', 0, NULL, 'вафівафіваіва', 1),
(32, 'Топологія', 0, NULL, '\\newcommand{definitio}{Означення}[section]\r\n\\begin{definitio}\r\nНехай $X$ --- непорожня. Сім''я підмножин \\tau в $X$ називається топологією, якщо:\r\n$ 1. \\oslash \\in \\tau;\r\n 2. x \\in \\tau;\r\n 3. \\forall U,V \\in \\tau, U\\cap V \\in \\tau;\r\n 4. Якщо сім''я U_\\alpha\\in\\tau;\r\n$\r\n\\end{definitio}', 1),
(35, 'Топологія', 2, NULL, 'Нехай $X - $ непорожня. Сім''я підмножин $\\tau$ в $X$ називається топологією, якщо:<br>\r\n1. $\\oslash \\in \\tau;$ <br>\r\n2. $ x \\in \\tau;$ <br>\r\n3. $\\forall U, V \\in \\tau, U \\cap V \\in \\tau $; <br>\r\n4. Cім''я $U_\\alpha\\in\\tau$; <br>\r\n\r\n', 1),
(37, 'Топологія', 0, NULL, 'Нехай $X --- $ непорожня. Сім''я підмножин $\\tau$ в $X$ називається топологією, якщо:\r\n$\r\n\\begin{enumerate}\r\n\\item \\oslash \\in \\tau;\r\n\\item x \\in \\tau;\r\n\\item \\forall U,V \\in \\tau, U\\cap V \\in \\tau;\r\n\\item Якщо сім''я U_\\alpha\\in\\tau;\r\n$\r\n', 1),
(38, 'Неперервне відображення', 2, NULL, 'Нехай $(X,\\tau_{x})$, $(X,\\tau_{y}) -$ топологічні простори.\r\n$F:X\\rightarrow X -$ відображення. <br>\r\n$F$ називається неперервним в точці $x_0\\in X$, якщо для будь-якого околу $\\;V\\;$ точки $f(x_0)\\in X$ існує окіл $U$ точки $x_0\\in X$ такий, що: $F(U)\\subset V$ тобто $\\forall x\\in U, F(X)\\in V$.', 1),
(39, 'Гомеоморфізм', 2, NULL, 'Відображення $F$ між топологічними просторами $X$ та $Y$ називається ${\\it гомеоморфізмом} $, якщо:<br>\r\n1. $F - $ бієктивне;<br>\r\n2. $F - $ неперевне;<br>\r\n3. $F^{-1} - $ неперервне.', 1),
(41, 'Індуктивна топологія', 2, NULL, 'Нехай $(X,\\tau_{x}) - $ топологічни простір, $Y-$ деяка множина, $\\{F_{\\alpha}\\}$ сім''я відображень $F_{\\alpha}:X\\rightarrow X$.<br>\r\nВизначимо топологію на $X$, так щоб всі $F_{\\alpha}$ були неперервними.\r\nНайсильніша топологія на $X$ така, що всі $F_{\\alpha}$ будуть неперервними називається ${\\it індуктивною}$ топологією, породженою сім''єю\r\n$\\{F_{\\alpha}\\}$. Ця топологія породжена передбазою $F_{\\alpha}(U),U\\in\\tau_x$.', 1),
(42, 'Проективна топологія', 2, NULL, 'Нехай $X - $ множина,$(X,\\tau_{y}) - $ топологічний простір.\r\n$F_{\\alpha}:X\\rightarrow X - $ сім''я відображень. Визначимо топологію на $X$, так що всі $F_{\\alpha}$ були неперервними.\r\nНайслабша топологія на $X$ для якої всі $F_{\\alpha}$ будуть неперервними називається ${\\itпроективною}$ топологією породженою $\\{F_{\\alpha}\\}$. Ця топологія задається передбазою $F_{\\alpha}^{-1}(V), V\\in\\tau_y$', 1),
(43, 'Метрика', 2, NULL, 'Нехай $X - $ непорожня множина. Функція $d:X\\times X\\rightarrow R$ називається метрикою на $X$, якщо:<br>\r\n1. $d(x,y)\\geq0\\quad\\quad\\quad\\quad\\quad\\quad\\forall x,y\\in X$;<br>\r\n2. $d(x,y)=0\\quad\\quad\\quad<=>\\quad\\quad x=y$;<br>\r\n3. $d(x,y)=d(y,x)\\quad\\quad\\quad\\quad\\quad\\forall x,y\\in X$;<br>\r\n4. $d(x,y)\\leq d(x,z)+d(z,y)\\quad\\forall x,y,z\\in~X$.<br>', 1),
(44, 'Відкрита куля', 2, NULL, 'Відкритою кулею в метричному просторі $ (X,d) $ з центром в точці $ x_0 $ радіуса $r$ називається множина $ B_r (x_0)= \\{ x\\in X | d(x,x_0) < r \\}$', 1),
(45, 'Замкнена куля', 2, NULL, 'Замкненою кулею в метричному просторі $(X,d)$ з центром в точці $x_0$ радіуса $r$ називається множина\r\n$$B_r(x_0)=\\{x\\in X|d(x,x_0)\\leq r\\}$$', 1),
(46, 'Асоціативна топологія', 2, NULL, 'Топологія породжена передбазою відкритих куль називається ${\\itасоціативною}$ з метрикою $d$', 1),
(60, 'Підпростір метричного простору', 2, NULL, 'Нехай $(X,d) - $ метричний простір. Тоді метричний простір$ ~(X_0,d_0)$ називається підпростором $(X,d)$, якщо: <br>\r\n1. $X_0\\subset X$<br>\r\n2. $\\forall x,y\\in X_0,\\quad d_0(x,y)=d(x,y)$', 1),
(61, 'Ізометрична ізоморфність просторів', 2, NULL, 'Метричний простір $(X,d_x)$ називається ${\\itізометрично\\,ізоморфним\\,простором}\\,(X,d_y)$, якщо існує бієктивне відображення: $F:X\\rightarrow X$, що зберігає метрику\r\n$$d_x(x_1,x_2)=d_y(F(x_1),F(x_2))\\quad\\quad\\quad \\forall x_1,x_2\\in X$$\r\n$F$ називається ${\\itізометричним\\,ізоморфізмом}$.', 1),
(62, 'Фундаментальна послідовність', 2, NULL, 'Нехай $(X,d) - $метричний простір<br>\r\nПослідовність $\\{x_n\\}\\subset X$ називається ${\\itфундаментальною}$, якщо\r\n$\\forall \\epsilon>0, \\exists n_0\\in N$ що $\\forall m,n>n_0$<br>\r\n$d(x_n,x_m)<\\epsilon$ ', 1),
(63, 'Повний метричний простір', 2, NULL, 'Метричний простір $X$ називається ${\\itповним}$, якщо кожна фундаментальна послідовність в $X$ має границю в $X$', 1),
(68, 'Поповнення простору', 2, NULL, 'Нехай $(X,d_x) - $ метричний простір. Метричний простір $(Y,d_y)$ називається $\\textit{поповненням простору}\\quad(X,d_x)$ якщо:<br>\r\n1. $\\exists I:X\\rightarrow Y$ ізометричне вкладення;<br>\r\n2. $X$ є всюди щільним в $Y$;<br>\r\n3. $(Y,d_y) - $ повний.<br>', 1),
(69, 'Всюди щільна підмножина', 2, NULL, 'Підмножина $A$ топологічного простору $X$ є ${\\bf щільною}$ у підмножині $B$, якщо замикання $A$ містить $B$<br>\r\n$\\overline{A}\\supset B$<br>\r\n$A$ називається ${\\bf всюди щільною}$ підмножиною, якщо $\\overline{A}= X$.<br>\r\n$A$ всюди щільна підмножина, тоді і тільки тоді, коли:<br>\r\n$\\forall U,\\quad U\\subset X,\\quad \\exists x_0\\in A, \\mbox{що}\\quad x_0\\in U$.', 1),
(70, 'Нерухома точка', 2, NULL, 'Нехай $(X,d) - $ метричний простір. $F:X\\rightarrow X$.<br>\r\nСкажемо, що $x_0\\in X$ є ${\\bfнерухомою\\,точкою}$ відображення $F$, якщо $F(x_0)=~x_0$<br>', 1),
(71, 'Компактний простір', 2, NULL, 'Топологічний простір $X$ називаєтся ${\\bfкомпактним}$, якщо з будь-якого відкритого покриття $\\{U_{\\alpha}\\}$ цього простору можна вибрати скінчення підпокриття $U_{\\alpha_1},\\ldots,U_{\\alpha_n}$ ', 1),
(72, 'Відкрите покриття простору', 2, NULL, 'Відкритим покриттям простору $X$ називається сім''я відкритих множин $\\{U_{\\alpha}\\}$, що $\\bigcup_{\\alpha}U_{\\alpha}\\supset X$. Підпокриття це підмножина в $\\{U_{\\alpha}\\}$, яка також є покриттям.', 1),
(77, 'Стисне відображення', 2, NULL, 'Відображення $F:X\\rightarrow X$ називається ${\\bfстикуючим(стисним)}$, якщо $\\exists\\lambda, 0\\leq\\lambda<1,\\quad\\mbox{що}\\;\\forall x,y\\in X$\r\n$$d(F(x),F(y))\\leq\\lambda d(x,y)$$', 1),
(78, 'Скінченновимірний базис', 2, NULL, '$\\newcommand{\\p}[2][n]{#2_{1},#2_{2},\\ldots, #2_{#1}}$\r\nЯкщо в лінійному просторі $X$ існує скінченний базис Гамеля $\\{\\p{e}\\}$, то $X$ називається ${\\bfскінченновимірним}$ ($n$-вимірним) <br>\r\n$$\\dim X=n$$\r\nВ іншому випадку $X$ називається ${\\bfнескінченновимірним}$ $\\dim X=\\infty$', 1),
(79, 'Норма на просторі', 2, NULL, '$\\newcommand{\\BBR}{\\mathbb{R}}$\r\nНехай $X$$-$лінійний простір над полем дійсних чисел $\\BBR$.<br>\r\nФункція $||x||$ визначена на $X$ зі значенням в $\\BBR$ називається ${\\bfнормою}$, якщо:<br>\r\n1. $||x||\\geq 0, \\forall x\\in X$.<br>\r\n2. $||x||=0 \\Leftrightarrow x=0$.<br>\r\n3. $||\\lambda x||=\\lambda||x||, \\quad \\forall \\lambda\\in\\BBR, x\\in X$.<br>\r\n4. Нерівність трикутника<br>\r\n$||x+y||\\leq||x||+||y||$', 1),
(80, 'Банаховий простір', 2, NULL, 'Повний нормований простір називається ${\\bfбанаховим}$ простором', 1),
(81, 'Лінійний оператор', 2, NULL, '$\\newcommand{\\BBR}{\\mathbb{R}}$\r\nНехай $X,Y$$-$ нормовані простори. Відображення $A:X\\rightarrow Y$ називаться ${\\bfлінійним\\,оператором}$, якщо:<br> \r\n1. $A(x_1+x_2)=A(x_1)+A(x_2),\\quad \\forall x_1,x_2\\in X$.<br>\r\n2. $A(\\lambda x)=\\lambda A(x), \\quad \\forall\\lambda\\in\\BBR, x\\in X$. ', 1),
(82, 'Лінійний функціонал', 2, NULL, 'Лінійний оператор з $X$ в $X$ називається ${\\bfлінійним\\,функціоналом}.$', 1),
(83, 'Ізоморфізм', 2, NULL, 'Лінійний оператор $A$ з нормованого простору $X$ в нормований простір $Y$ називається ${\\bfізоморфізмом}$, якщо: <br>\r\n$A$$-$бієктивний, $A$$-$неперервний і $A^{-1}$$-$неперервний.', 1),
(84, 'Обмежений лінійний оператор', 2, NULL, 'Лінійний оператор $A:X\\rightarrow Y(X,Y-\\text{нормовані})$ називається ${\\bfобмеженим}$, <br> якщо $A - $обмежений на $\\overline{B_1(0)}$$-$кулі в $X$ радіуса 1 з центром в нулі. Тобто $$\\sup_{||x||\\leq1}{||A(x)||<\\infty}$$', 1),
(85, 'Пряма сума просторів', 2, NULL, 'Нехай $X,Y$$-$банахові простори. ${\\bfПрямою\\;сумою}$ просторів $X\\oplus Y$ називають банахів простір, елементи якого мають вигляд $x+y$, де $x\\in X, y\\in Y$ і це зображення єдине.<br>\r\n$||x+y||=\\max(||x||,||y||)$. Пряма сума ізоморфна до декартового добутку <br>\r\n$$X\\times Y=\\{(x,y)|x\\in X,y\\in Y\\}$$\r\n$$||(x,y)||=\\max(||x||,||y||)$$\r\nОчевидно, що $X$ є замкненим підпротором в $X\\oplus Y$', 1),
(87, 'Доповнювальний і доповнюваний простори', 2, NULL, 'Нехай $Z$$-$банахів простір. $X$$-$замкнений підпростір. $X$$-$називається ${\\bfдоповнювальним}$ в $Z$, якщо існує замкнений підпростір $Y\\subset Z$, що $Z=X\\oplus Y$. $Y$$-$називається ${\\bfдоповнюваним}$ до $X$.', 1),
(88, 'Оператор-проектор', 2, NULL, 'Нехай $Z-$банахів простір. $X$$-$замкнений підпростір. Оператор $P:Z\\rightarrow X$ називається ${\\bfпроектором}$, якщо<br>\r\n1. $P$ є сюр''єктивним.<br>\r\n2. $P(P(Z))=P(Z), \\forall z\\in Z$.', 1),
(89, 'Лінійно незалежна і лінійно залежна сім`ї', 2, NULL, '$\\newcommand{\\p}[2][n]{#2_{1},#2_{2},\\ldots, #2_{#1}}$\r\nНехай $X$$-$деякий лінійний простір. Сім''я ненульових векторів $\\{z_{\\alpha}\\}$$-$називається ${\\bfлінійно\\; незалежною}$ ($\\alpha$ пробігає деяку множину індексів) якщо з того, що <br>\r\n$$\\lambda_1\\alpha_1+\\lambda_2\\alpha_2+\\ldots+\\lambda_n\\alpha_n=0$$ для деяких числел $\\p{\\lambda}$ випливає, що $\\lambda_1=\\ldots=\\lambda_n=0$. <br>\r\nВ іншому випадку $\\{z_{\\alpha}\\}$ називаєтсья ${\\bf лінійно\\,залежною}$.', 1),
(90, 'Відношення порядку', 2, NULL, 'Нехай $\\{z_{\\alpha}\\}$ і $\\{y_{\\beta}\\}$ дві лінійно незалежні сім''ї. Введомо порядок $\\{z_{\\alpha}\\}\\leq\\{y_{\\beta}\\}$, якщо\r\n$\\{z_{\\alpha}\\}\\subseteq\\{y_{\\beta}\\}$<br>\r\nЗауважимо, що введення $\\leq$ відношення є відношенням часткового порядку.', 1),
(91, 'Ланцюг', 2, NULL, 'Підмножина частково впорядкованої множини називається ${\\bfланцюгом}$, якщо вона є лінійно впорядкована (тобто будь-які два елемента з цієї підмножини можна порівняти)', 1),
(92, 'Лінійний базис або базис Гамеля', 2, NULL, '${\\bfЛінійним\\,базисом}$ (базисом Гамеля) в лінійному просторі називається максимальна сім''я лінійно незалежних векторів.', 1),
(93, 'Базис Шаудера', 2, NULL, '$\\newcommand{\\BBR}{\\mathbb{R}}$\r\nЛінійно незалежна послідовність $\\{e_{\\infty}\\}$ банахового простору $X$ називається ${\\bf базисом Шаудера}$(топологічним базисом), якщо для будь-~якого $x\\in X$ існує послідовність чисел $\\{\\lambda_n\\}\\subset \\BBR $ така, що <br>\r\n$x=\\sum_{n=1}^{\\infty}{\\lambda_ne_n}=\\lim_{m\\rightarrow\\infty}\\sum_{n=1}^{\\infty}{\\lambda_ne_n}$, тобто<br> $||x-\\sum_{n=1}^{m}{\\lambda_ne_n}||\\rightarrow0$, при $m\\rightarrow\\infty$', 1),
(94, 'Продовження функціоналу', 2, NULL, 'Нехай $X$$-$нормований простір, $X_0$$-$підпростір в $X$. Нехай $f_0$$-$лінійний неперервний функціонал на $X_0$, тобто $f\\in X_0$. Тоді функціонал $f\\in X$ називаєтся ${\\bfпродовженням}$ функціоналу $f_0$, якщо $f(x)=f_0(x), \\forall x\\in X_0$', 1),
(96, 'Епсилон-сітка', 2, NULL, 'Нехай $X-$ метричний простір, $X_0\\subset X-$ підпростір.<br>\r\nПідмножина $M\\subset X$ називається $\\epsilon$-${\\bfсіткою}$ підпростору $X_0$, якщо:<br>\r\n$\\forall x_0\\in X_0, \\exists a\\in M,\\, \\text{що}\\, d(x_0,a) $', 1),
(97, 'Цілком обмежений простір', 2, NULL, 'Підпростір $X$ називається ${\\bfцілком \\;обмежений}$, якщо:<br>\r\n$\\forall\\epsilon>0\\quad\\exists$ скінченнa ${\\bf \\epsilon}$-${\\bfсітка}$ підпростору $X_0$', 1),
(98, 'Одностайно неперервна сім`я функцій', 2, NULL, 'Сім''я функцій $\\{\\Phi_{\\alpha}|\\Phi_{\\alpha}(t)\\in[a,b]\\}$ називається ${\\bf одностайно\\,неперервною}$, якщо:<br>\r\n$\\forall\\epsilon>0,\\exists\\delta>0, \\text{що}\\;\\forall\\,t_1,t_2\\in[a,b],<br> \\text{що} |t_1-t_2|<\\delta \\Rightarrow |\\Phi_{\\alpha}(t_1)-\\Phi_{\\alpha}(t_2)|<\\epsilon, \\forall\\alpha$', 1),
(99, 'Обмежена сім`я функцій', 2, NULL, 'Сім''я функцій $\\{\\Phi_{\\alpha}\\}$ називається ${\\bf обмеженою}$, якщо:<br>\r\n$\\forall C>0,$ що $|\\Phi_{\\alpha}(t)|$<C, <br>\r\n$\\forall\\alpha, \\forall t \\in [a,b]$ ', 1),
(100, 'Метричний простір', 2, NULL, '$\\textbf{Метричний простір}$ — це пара $(X,d)$, яка складається з деякої множини $X$ елементів і метрики $d$, визначеної для будь-якої пари елементів цієї множини.', 1),
(101, 'Топологічний простір', 2, NULL, '$\\textbf{Топологічний простір}$ — це впорядкована пара $(X, \\tau)$, де $X$ — множина, а $\\tau$ — топологія.', 1);
-- --------------------------------------------------------
--
-- Структура таблиці `note_type`
--
CREATE TABLE IF NOT EXISTS `note_type` (
`note_type_id` int(11) NOT NULL,
`type` varchar(16) NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8;
--
-- Дамп даних таблиці `note_type`
--
INSERT INTO `note_type` (`note_type_id`, `type`) VALUES
(1, 'Означення'),
(2, 'Задача'),
(3, 'Теорема'),
(4, 'Твердження'),
(5, 'Приклад'),
(6, 'Зауваження');
-- --------------------------------------------------------
--
-- Структура таблиці `user`
--
CREATE TABLE IF NOT EXISTS `user` (
`username` varchar(16) NOT NULL,
`email` varchar(45) NOT NULL,
`enabled` tinyint(1) NOT NULL,
`password` varchar(16) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Дамп даних таблиці `user`
--
INSERT INTO `user` (`username`, `email`, `enabled`, `password`) VALUES
('itsme', 'eladelmv@gmail.com', 1, 'letmein'),
('Maxwellt', 'maksimvinnik@gmail.com', 1, '111111'),
('Rufus', 'cortesius@mail.ua', 1, '258258258qw');
-- --------------------------------------------------------
--
-- Структура таблиці `user_note`
--
CREATE TABLE IF NOT EXISTS `user_note` (
`user_note_id` int(11) NOT NULL,
`status` int(11) NOT NULL,
`note_id` int(11) NOT NULL,
`username` varchar(16) NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=145 DEFAULT CHARSET=utf8;
--
-- Дамп даних таблиці `user_note`
--
INSERT INTO `user_note` (`user_note_id`, `status`, `note_id`, `username`) VALUES
(28, 1, 35, 'Maxwellt'),
(30, 1, 38, 'Maxwellt'),
(31, 1, 39, 'Maxwellt'),
(33, 1, 41, 'Maxwellt'),
(34, 1, 42, 'Maxwellt'),
(35, 1, 43, 'Maxwellt'),
(36, 1, 44, 'Maxwellt'),
(37, 1, 45, 'Maxwellt'),
(38, 1, 46, 'Maxwellt'),
(52, 1, 60, 'Maxwellt'),
(53, 1, 61, 'Maxwellt'),
(54, 1, 62, 'Maxwellt'),
(55, 1, 63, 'Maxwellt'),
(60, 1, 68, 'Maxwellt'),
(61, 1, 69, 'Maxwellt'),
(62, 1, 70, 'Maxwellt'),
(63, 1, 71, 'Maxwellt'),
(64, 1, 72, 'Maxwellt'),
(69, 1, 77, 'Maxwellt'),
(70, 1, 78, 'Rufus'),
(71, 1, 79, 'Rufus'),
(72, 1, 80, 'Rufus'),
(73, 1, 81, 'Rufus'),
(74, 1, 82, 'Rufus'),
(75, 1, 83, 'Rufus'),
(76, 1, 84, 'Rufus'),
(77, 1, 85, 'Rufus'),
(79, 1, 87, 'Rufus'),
(80, 1, 88, 'Rufus'),
(81, 1, 89, 'Rufus'),
(82, 1, 90, 'Rufus'),
(83, 1, 91, 'Rufus'),
(84, 1, 92, 'Rufus'),
(85, 1, 93, 'Rufus'),
(86, 1, 94, 'Rufus'),
(88, 1, 96, 'Rufus'),
(89, 1, 97, 'Rufus'),
(90, 1, 98, 'Rufus'),
(91, 1, 99, 'Rufus'),
(92, 1, 46, 'itsme'),
(93, 1, 69, 'itsme'),
(94, 1, 44, 'itsme'),
(95, 1, 72, 'itsme'),
(97, 1, 39, 'itsme'),
(98, 1, 45, 'itsme'),
(100, 1, 71, 'itsme'),
(101, 1, 38, 'itsme'),
(102, 1, 70, 'itsme'),
(103, 1, 63, 'itsme'),
(104, 1, 68, 'itsme'),
(107, 1, 93, 'itsme'),
(108, 1, 80, 'itsme'),
(109, 1, 90, 'itsme'),
(110, 1, 87, 'itsme'),
(111, 1, 96, 'itsme'),
(112, 1, 91, 'itsme'),
(113, 1, 92, 'itsme'),
(114, 1, 81, 'itsme'),
(115, 1, 82, 'itsme'),
(116, 1, 89, 'itsme'),
(117, 1, 43, 'itsme'),
(118, 1, 79, 'itsme'),
(119, 1, 99, 'itsme'),
(120, 1, 84, 'itsme'),
(121, 1, 98, 'itsme'),
(122, 1, 88, 'itsme'),
(131, 1, 94, 'itsme'),
(132, 1, 42, 'itsme'),
(133, 1, 85, 'itsme'),
(134, 1, 60, 'itsme'),
(135, 1, 78, 'itsme'),
(136, 1, 77, 'itsme'),
(137, 1, 35, 'itsme'),
(138, 1, 62, 'itsme'),
(139, 1, 97, 'itsme'),
(140, 1, 61, 'itsme'),
(141, 1, 83, 'itsme'),
(142, 1, 41, 'itsme'),
(143, 1, 100, 'itsme'),
(144, 1, 101, 'itsme');
-- --------------------------------------------------------
--
-- Структура таблиці `user_roles`
--
CREATE TABLE IF NOT EXISTS `user_roles` (
`user_role_id` int(11) NOT NULL,
`role` varchar(45) NOT NULL,
`username` varchar(16) NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;
--
-- Дамп даних таблиці `user_roles`
--
INSERT INTO `user_roles` (`user_role_id`, `role`, `username`) VALUES
(1, 'ROLE_USER', 'Maxwellt'),
(2, 'ROLE_USER', 'itsme'),
(3, 'ROLE_ADMIN', 'itsme'),
(4, 'ROLE_USER', 'Rufus');
--
-- Індекси збережених таблиць
--
--
-- Індекси таблиці `link`
--
ALTER TABLE `link`
ADD PRIMARY KEY (`lower_note_id`,`higher_note_id`), ADD KEY `FK_H_NOTE_TO_L_NOTE` (`lower_note_id`), ADD KEY `FK_L_NOTE_TO_H_NOTE` (`higher_note_id`);
--
-- Індекси таблиці `note`
--
ALTER TABLE `note`
ADD PRIMARY KEY (`note_id`), ADD KEY `FK_105lhx05vyp824xw6jbfsccuf` (`note_type_id`);
--
-- Індекси таблиці `note_type`
--
ALTER TABLE `note_type`
ADD PRIMARY KEY (`note_type_id`);
--
-- Індекси таблиці `user`
--
ALTER TABLE `user`
ADD PRIMARY KEY (`username`), ADD UNIQUE KEY `UK_ob8kqyqqgmefl0aco34akdtpe` (`email`);
--
-- Індекси таблиці `user_note`
--
ALTER TABLE `user_note`
ADD PRIMARY KEY (`user_note_id`), ADD KEY `FK_k9jhcyiij1mhd3p2l63fon34a` (`note_id`), ADD KEY `FK_5pfoiqjauemr1g3kagl2xs66y` (`username`);
--
-- Індекси таблиці `user_roles`
--
ALTER TABLE `user_roles`
ADD PRIMARY KEY (`user_role_id`), ADD KEY `FK_9ry105icat2dux14oyixybw9l` (`username`);
--
-- AUTO_INCREMENT для збережених таблиць
--
--
-- AUTO_INCREMENT для таблиці `note`
--
ALTER TABLE `note`
MODIFY `note_id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=102;
--
-- AUTO_INCREMENT для таблиці `note_type`
--
ALTER TABLE `note_type`
MODIFY `note_type_id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=7;
--
-- AUTO_INCREMENT для таблиці `user_note`
--
ALTER TABLE `user_note`
MODIFY `user_note_id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=145;
--
-- AUTO_INCREMENT для таблиці `user_roles`
--
ALTER TABLE `user_roles`
MODIFY `user_role_id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=5;
--
-- Обмеження зовнішнього ключа збережених таблиць
--
--
-- Обмеження зовнішнього ключа таблиці `link`
--
ALTER TABLE `link`
ADD CONSTRAINT `FK_H_NOTE_TO_L_NOTE` FOREIGN KEY (`lower_note_id`) REFERENCES `note` (`note_id`),
ADD CONSTRAINT `FK_L_NOTE_TO_H_NOTE` FOREIGN KEY (`higher_note_id`) REFERENCES `note` (`note_id`);
--
-- Обмеження зовнішнього ключа таблиці `note`
--
ALTER TABLE `note`
ADD CONSTRAINT `FK_105lhx05vyp824xw6jbfsccuf` FOREIGN KEY (`note_type_id`) REFERENCES `note_type` (`note_type_id`);
--
-- Обмеження зовнішнього ключа таблиці `user_note`
--
ALTER TABLE `user_note`
ADD CONSTRAINT `FK_5pfoiqjauemr1g3kagl2xs66y` FOREIGN KEY (`username`) REFERENCES `user` (`username`),
ADD CONSTRAINT `FK_k9jhcyiij1mhd3p2l63fon34a` FOREIGN KEY (`note_id`) REFERENCES `note` (`note_id`);
--
-- Обмеження зовнішнього ключа таблиці `user_roles`
--
ALTER TABLE `user_roles`
ADD CONSTRAINT `FK_9ry105icat2dux14oyixybw9l` FOREIGN KEY (`username`) REFERENCES `user` (`username`);
/*!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.0.1
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
--
-- База данных: `page_gen`
--
-- --------------------------------------------------------
--
-- Структура таблицы `blocks`
--
CREATE TABLE `blocks` (
`id` int(11) NOT NULL,
`ucode` varchar(48) NOT NULL COMMENT 'латинские буквы,_,цифры',
`dictum` varchar(6144) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Дамп данных таблицы `blocks`
--
INSERT INTO `blocks` (`id`, `ucode`, `dictum`) VALUES
(1, 'title', 'Каркас для лендинг-пейдж'),
(2, 'description', 'Скрипт для создания посадочной страницы'),
(3, 'keywords', 'каркас,frame,лендинг,landing'),
(5, 'h1', 'Каркас для посадочной страницы'),
(6, 'readme', '<h3>Вступление</h3>\r\nШаблон (`/view/front/tamplates/page.php`) представляет собой обычный html+css+js.<br>\r\n\r\nПриложение умышленно написано просто. Все константы определены в /index.php.<br>\r\nЕсли будет нужно расширить функциональность приложения, а это почти наверняка будет<br>\r\nвам нужно, создайте свои контроллеры.<br>\r\n\r\n<h3>Как развернуть приложение</h3>\r\n\r\nИмпортируйте `/files/data/db.sql` в вашу базу данных.<br>\r\nСодержимое данного репозитория положите в корень вашего сайта.<br> \r\nВпишите в `/library/config/config.php` значения для вашей базы данных.<br>\r\nПерейдите по адресу `yoursite.com/staff/viewForm`, используйте demo@demo.ru / qwerty<br>\r\nдля входа в админ.часть.'),
(7, 'company', '«Побочный эффект»'),
(9, 'hello', 'href=\"files/others/hello.pdf\"\r\ntext=\"Скачать файл hello.pdf\"\r\n'),
(10, 'image_dog', 'src=\"files/images/image_dog.jpg\"\r\nalt=\"image_dog\"\r\nwidth=\"400\"\r\n'),
(11, 'a_image_dog', '; если у вас есть загруженная картинка, то её можно представить ссылкой\r\nhref=\"files/images/image_dog.jpg\"\r\ntext=\"Открыть в Lightbox\"');
-- --------------------------------------------------------
--
-- Структура таблицы `users`
--
CREATE TABLE `users` (
`id` int(11) NOT NULL,
`email` varchar(50) NOT NULL,
`hash` varchar(255) NOT NULL,
`role` varchar(15) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Дамп данных таблицы `users`
--
INSERT INTO `users` (`id`, `email`, `hash`, `role`) VALUES
(1, 'demo@demo.ru', '$2y$10$j7BfwKINhwQheQyNKxNq5eFmwMAjoQUwCKSc/oJvY.4ATAcowfUny', 'Administrator');
--
-- Индексы сохранённых таблиц
--
--
-- Индексы таблицы `blocks`
--
ALTER TABLE `blocks`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `uniq_code` (`ucode`);
--
-- Индексы таблицы `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT для сохранённых таблиц
--
--
-- AUTO_INCREMENT для таблицы `blocks`
--
ALTER TABLE `blocks`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12;
--
-- AUTO_INCREMENT для таблицы `users`
--
ALTER TABLE `users`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
COMMIT;
|
select
'gpssh -h ' || hostname || ' -v -e '''
||'gpddboost --readFile --from-file=' || file_name || ' | '
|| 'PGOPTIONS="-c gp_session_role=utility" psql -h '|| hostname || ' -p ' || port || ' -d ' || :v_Target_DB || ' -U gpadmin '
|| E'''&\n'
|| 'plist['|| id_file ||']=$!'
from (select row_number() over() as id_file,file_name
from db_refresh.refresh_list_dump_file
where dump_timestampkey = :v_dump_timestampkey) S1
inner join (select *, max(content) over () as max_content
,row_number() over(order by port,hostname) as id_content_join
from gp_segment_configuration
where role = 'p'
and content >=0 ) T1
on mod(S1.id_file,T1.max_content + 1 ) + 1 = T1.id_content_join
order by id_file
|
CREATE TABLE [crm].[destinatarios_remitentes] (
[id_destinatario_remitente] INT IDENTITY (1, 1) NOT NULL,
[activo] BIT NULL,
[id_segmento] INT NULL,
[id_cliente] INT NULL,
[codigo] VARCHAR (20) NULL,
[contacto_email] VARCHAR (100) NULL,
[contacto_nombres] VARCHAR (100) NULL,
[contacto_telefonos] VARCHAR (50) NULL,
[digito_verificacion] VARCHAR (1) NULL,
[id_ciudad] INT NULL,
[direccion] VARCHAR (150) NULL,
[direccion_estandarizada] VARCHAR (150) NULL,
[indicaciones_direccion] VARCHAR (150) NULL,
[latitud] NUMERIC (18, 15) NULL,
[longitud] NUMERIC (18, 15) NULL,
[fecha_actualizacion] DATETIME2 (0) NULL,
[identificacion_type] VARCHAR (2) NULL,
[nombre] VARCHAR (100) NULL,
[nombre_comercial] VARCHAR (100) NULL,
[numero_identificacion] VARCHAR (20) NULL,
[usuario_actualizacion] VARCHAR (50) NULL,
CONSTRAINT [PK_destinatarios_remitentes] PRIMARY KEY CLUSTERED ([id_destinatario_remitente] ASC) WITH (FILLFACTOR = 80),
CONSTRAINT [FK_destinatarios_remitentes] FOREIGN KEY ([id_cliente]) REFERENCES [crm].[clientes] ([id_cliente])
);
|
drop table foo;
drop table bar1;
drop table bar2;
create table foo (x1 int, x2 int, x3 int);
create table bar1 (x1 int, x2 int, x3 int) distributed randomly;
create table bar2 (x1 int, x2 int, x3 int) distributed randomly;
insert into foo select i,i+1,i+2 from generate_series(1,10) i;
insert into bar1 select i,i+1,i+2 from generate_series(1,1000) i;
insert into bar2 select i,i+1,i+2 from generate_series(1,1000) i;
select DumpPlanXML('select x2 from foo where x1 in (select x2 from bar1)'); -- produces result node
select RestorePlanXML(DumpPlanXML('select x2 from foo where x1 in (select x2 from bar1)')); -- produces result node
select DumpPlanXML('select 1');
select RestorePlanXML(DumpPlanXML('select 1'));
|
/* 1) List all the books in the library sorting them by author and title. */
SELECT Title,Author_name FROM library.BOOK JOIN library.BOOK_AUTHORS ON library.BOOK.Book_id = library.BOOK_AUTHORS.Book_id ORDER BY Author_name;
SELECT Title,Author_name FROM library.BOOK JOIN library.BOOK_AUTHORS ON library.BOOK.Book_id = library.BOOK_AUTHORS.Book_id ORDER BY Title;
/* 2) List all the books in the library by publisher and title. */
SELECT Title,Publisher_name FROM library.BOOK;
/* 3) For each branch print the number of copies of each book. Sort by branch id, publisher then book title. */
SELECT Branch_id, Branch_name, Book_id, Title, Publisher_name, No_Of_Copies FROM (library.LIBRARY_BRANCH NATURAL JOIN library.BOOK NATURAL JOIN library.BOOK_COPIES) GROUP BY Branch_id,Book_id,No_of_copies ORDER BY Branch_id;
SELECT Branch_id, Branch_name, Book_id, Title, Publisher_name, No_Of_Copies FROM (library.LIBRARY_BRANCH NATURAL JOIN library.BOOK NATURAL JOIN library.BOOK_COPIES) GROUP BY Branch_id,Book_id,No_of_copies ORDER BY Publisher_name;
SELECT Branch_id, Branch_name, Book_id, Title, Publisher_name, No_Of_Copies FROM (library.LIBRARY_BRANCH NATURAL JOIN library.BOOK NATURAL JOIN library.BOOK_COPIES) GROUP BY Branch_id,Book_id,No_of_copies ORDER BY Title;
/* 4) How many copies of the book titled Harry Potter are owned by the library branch whose name is ‘Vijayanagar’? */
SELECT No_of_copies AS Vijayanagar_Harry_Potter_Copies FROM ((library.BOOK NATURAL JOIN library.BOOK_COPIES) NATURAL JOIN library.LIBRARY_BRANCH) WHERE Title='Harry Potter' AND Branch_name='Vijayanagar';
/* 5) How many copies of the book titled War and Peace are owned by each library branch? */
SELECT Branch_name, No_of_copies AS No_of_copies_War_and_Peace FROM ((library.BOOK NATURAL JOIN library.BOOK_COPIES) NATURAL JOIN library.LIBRARY_BRANCH) WHERE Title='War and Peace';
/* 6) For each book authored (or co-authored) by J. K. Rowling, retrieve the title and the number of copies owned by the library branch whose name is Central. */
SELECT Title, No_of_copies AS JK_Rowling_Central FROM ((( library.BOOK_AUTHORS NATURAL JOIN library.BOOK) NATURAL JOIN library.BOOK_COPIES) NATURAL JOIN library.LIBRARY_BRANCH) WHERE Author_name='JK Rowling' AND Branch_name='Central';
/* 7) For each library branch, retrieve the branch name and the total number of books loaned out from that branch. Sort it in descending order of total number of books and branch name. */
SELECT Branch_name,COUNT(*) AS Books_Loaned_Out FROM (library.BOOK_LOANS NATURAL JOIN library.LIBRARY_BRANCH) GROUP BY Branch_name ORDER BY COUNT(*) DESC;
SELECT Branch_name,COUNT(*) AS Books_Loaned_Out FROM (library.BOOK_LOANS NATURAL JOIN library.LIBRARY_BRANCH) GROUP BY Branch_name ORDER BY Branch_name DESC;
/* 8) Retrieve the names, addresses, and number of books checked out for all borrowers who have more than five books checked out. Sort the output. */
SELECT B.Name, B.Address, COUNT(*) AS Books_Checked_Out FROM library.BORROWER B, library.BOOK_LOANS L WHERE B.Card_no = L.Card_no GROUP BY B.Card_no HAVING COUNT(*)>5 ORDER BY books_checked_out;
/* 9) For each book that is loaned out from the Vijayanagar branch and whose Due_date is today, retrieve the book title, the borrower’s name, and the borrower’s address. */
SELECT B.Title, BR.Name, BR.Address FROM library.BOOK B, library.BORROWER BR, library.BOOK_LOANS BL, library.LIBRARY_BRANCH LB WHERE LB.Branch_name = 'Vijayanagar' AND LB.Branch_id = BL.Branch_id AND BL.Due_date = 'today' AND BL.Card_no = BR.Card_no AND BL.Book_id = B.Book_id;
/* 10) Retrieve the names of all borrowers who do not have any books checked out. */
SELECT Name FROM library.BORROWER B WHERE NOT EXISTS (SELECT * FROM library.BOOK_LOANS L WHERE B.Card_no = L.Card_no);
|
-- staff 테이블 삭제
DROP TABLE staff;
-- staff 테이블 추가
CREATE TABLE staff
(
no NUMBER,
name VARCHAR2(100),
department VARCHAR2(100),
hireDate DATE,
PRIMARY KEY(no)
);
SELECT no, name, department, hireDate FROM staff;
SELECT MAX(no) FROM staff; |
/* Formatted on 21/07/2014 18:41:40 (QP5 v5.227.12220.39754) */
CREATE OR REPLACE FORCE VIEW MCRE_OWN.V_MCRES_APP_ANZIANITA_TRIM_NEW
(
COD_LABEL_TRIM,
VAL_NUM_POS
)
AS
SELECT cod_label_trim,
(SUM (val_tot_gg) / SUM (val_tot_posizioni)) / 365 val_num_pos
FROM t_mcres_fen_anzianita_trim
GROUP BY cod_label_trim;
|
-- phpMyAdmin SQL Dump
-- version 4.9.5
-- https://www.phpmyadmin.net/
--
-- Host: localhost:3307
-- Generation Time: Sep 23, 2021 at 12:44 PM
-- Server version: 5.7.24
-- PHP Version: 7.4.1
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `cognate`
--
-- --------------------------------------------------------
--
-- Table structure for table `register`
--
CREATE TABLE `register` (
`id` int(33) NOT NULL,
`firstname` varchar(32) NOT NULL,
`lastname` varchar(32) NOT NULL,
`image` text NOT NULL,
`phone` varchar(10) NOT NULL,
`email` varchar(30) NOT NULL,
`password` varchar(50) NOT NULL,
`confirm_password` varchar(50) NOT NULL,
`instagram` varchar(40) NOT NULL,
`facebook` varchar(40) NOT NULL,
`twitter` varchar(40) NOT NULL,
`youtube` varchar(500) NOT NULL,
`Location` varchar(225) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `register`
--
INSERT INTO `register` (`id`, `firstname`, `lastname`, `image`, `phone`, `email`, `password`, `confirm_password`, `instagram`, `facebook`, `twitter`, `youtube`, `Location`) VALUES
(1, 'Sharma', 'Pradap', 'profile.png', '9678236714', 'sharma@gmail.com', '26b5c3f86027614d7c3bbec4238a97f8', '26b5c3f86027614d7c3bbec4238a97f8', 'instagram.com', 'facebook.com', 'twitter.com', 'youtube.com', ''),
(2, 'Varun', 'Gupta', 'profile.png', '9754370257', 'varun@gmail.com', 'd41d8cd98f00b204e9800998ecf8427e', 'd41d8cd98f00b204e9800998ecf8427e', 'instagram.com', 'facebook.com', 'twitter.com', 'youtube.com', ''),
(3, 'Meera', 'Madhavan', 'profile.png', '9374183645', 'meera@gmail.com', 'd41d8cd98f00b204e9800998ecf8427e', 'd41d8cd98f00b204e9800998ecf8427e', 'instagram.com', 'facebook.com', 'twitter.com', 'youtube.com', ''),
(4, 'Pavithra', 'Sharma', 'profile.png', '9374812934', 'pavithra@gmail.com', '7fc92d58888fcffcff11434c1407fe88', '7fc92d58888fcffcff11434c1407fe88', 'instagram.com', 'facebook.com', 'twitter.com', 'youtube.com', ''),
(5, 'Preethi', 'Sharma', 'profile.png', '9754370257', 'preethi@gmail.com', '601757150822d642bd21743439a8efd4', '601757150822d642bd21743439a8efd4', 'instagram.com', 'facebook.com', 'twitter.com', 'youtube.com', ''),
(6, 'Thennarasan', 'Boovaragan', 'profile.png', '9754370257', 'thennarasan@gmail.com', '041937bdc743495ae248748592b82d57', '041937bdc743495ae248748592b82d57', 'instagram.com', 'facebook.com', 'twitter.com', 'youtube.com', ''),
(7, 'Ramya', 'Rajendiran', 'profile.png', '9248610456', 'Ramya1999@gmail.com', '88e00fd00ba330b8fa467a8877a014a4', '88e00fd00ba330b8fa467a8877a014a4', 'https://instagram.com/', 'https://facebook.com/', 'https://twitter.com/', 'https://youtube.com', 'srimushnam'),
(8, 'Sundar', 'Rajan', 'profile.png', '9824756102', 'Sundar20@gmail.com', 'dc647eb65e6711e155375218212b3964', 'dc647eb65e6711e155375218212b3964', 'https://instagram.com/', 'https://facebook.com/', 'https://twitter.com/', 'https://www.youtube.com/embed/cRCOVzkGVJM', 'Srimushnam'),
(9, 'Thapar', 'Singh', 'profile.png', '9837672819', '07.ramyar@gmail.com', '2b5fa564a1259b97bc238fbfa719b076', '2b5fa564a1259b97bc238fbfa719b076', 'https://instagram.com/', 'https://facebook.com/', 'https://twitter.com/', 'https://www.youtube.com/embed/B9YKnNtFqds?playlist=B9YKnNtFqds&', 'Srimushnam'),
(10, 'Test', 'Name', 'profile.png', '9824756102', 'thapar@gmail.com', '8b1a9953c4611296a827abf8c47804d7', '8b1a9953c4611296a827abf8c47804d7', 'https://instagram.com/', 'https://facebook.com/', 'https://twitter.com/', 'https://www.youtube.com/embed/B9YKnNtFqds?playlist=B9YKnNtFqds&', 'Srimushnam');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `register`
--
ALTER TABLE `register`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `register`
--
ALTER TABLE `register`
MODIFY `id` int(33) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11;
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 */;
|
SET FOREIGN_KEY_CHECKS=0;
TRUNCATE authorized_cust_shipper;
TRUNCATE authorized_cust_vehicle;
TRUNCATE booking_history;
TRUNCATE bhistory_upload;
TRUNCATE booking;
TRUNCATE passenger;
TRUNCATE booking_cargo;
TRUNCATE cargo;
TRUNCATE paid_misc_fees;
TRUNCATE price_history;
TRUNCATE seat_lock;
TRUNCATE transaction;
TRUNCATE upgrades;
TRUNCATE voyage;
TRUNCATE refunded_tkts;
/*TRUNCATE route;*/
/*TRUNCATE vessel;*/
SET FOREIGN_KEY_CHECKS=1;
|
#Address_Book_DB
#Create database and use it
create database addressbook-service;
use addressbook_service;
#create addressBook table
create table addressbook
(
first_name varchar(150) not null,
last_name varchar(150) not null,
address varchar(400),
city varchar(20),
state varchar(20),
zip int unsigned,
phone_number int unsigned,
email_id varchar(100) not null,
primary key (email_id)
);
#ability to insert new contacts
insert into addressbook
(first_name,last_name,address,city,state,zip,phone_number,email_id)
values('Kanishk','Kumar','Sh-3/40','Varanasi','UP',221003,89385384,'kasn@gmail.com'),
('Adarsh','Amasn','sds-34','Giridih','Bihar',4645,767564545,'asas@gmail.com');
#ability to edit contacts using name
update addressbook
set city='Jamshedpur' where first_name='Kanishk';
#ability to delete a person using name
delete from addressbook where first_name='Kanishk' and last_name='Kumar';
#ability to get person froma city or state
select * from addressbook where city='Varanasi' or state='UP';
#ability to count by state and city
select city,count(*) from addressbook group by city;
select state,count(*) from addressbook group by state;
#Getting contacts sorted based on first_name
select * from addressbook where city='Varanasi' order by first_name;
#ability to alter addressbook for name and type
alter table addressbook add addressbook_name varchar(30) after email_id;
alter table addressbook add addressbook_type varchar(30) after addressbook_name;
update addressbook set addressbook_name='Friend' where first_name='Kanishk';
update addressbook set addressbook_type='Friends' where first_name='Kanishk';
update addressbook set addressbook_type='Family' where first_name='Adarsh';
update addressbook set addressbook_name='HomeDetails' where first_name='Adarsh';
#ability to count by type
select addressbook_type, count(*) from addressbook group by addressbook_type;
#ability to add contacts in family and friends
insert into addressbook
(first_name,last_name,address,city,state,zip,phone_number,email_id,addressbook_name,addressbook_type)
values
('Suresh','Singh','u-34','Meerut','UP',2423,546575645,'assd@gmsd.com','FriendsForever','Friends'),
('Ramesh','Singhaniya','sfs-34','isadud','MP',2424,787656578,'hgbg@fb.com','OfficePeople','Family');
#UC12
CREATE TABLE user_details
(
user_id int NOT NULL,
first_name VARCHAR(100) NOT NULL,
last_name VARCHAR(100) NOT NULL,
PRIMARY KEY(user_id)
);
CREATE TABLE location
(
user_id int NOT NULL,
address VARCHAR(150) NOT NULL,
city VARCHAR(50) NOT NULL,
state VARCHAR(50) NOT NULL,
zip VARCHAR(10) NOT NULL,
PRIMARY KEY(user_id),
FOREIGN KEY(user_id) references user_details(user_id)
);
CREATE TABLE Contact
(
user_id int,
phone VARCHAR(20),
email VARCHAR(50),
FOREIGN KEY(user_id) REFERENCES user_details(user_id)
);
CREATE TABLE contact_type
(
type_id int,
type_of_contact VARCHAR(50),
PRIMARY KEY(type_id)
);
CREATE TABLE link_usertype
(
user_id int,
type_id int,
FOREIGN KEY(user_id) references user_details(user_id),
FOREIGN KEY(type_id) references contact_type(type_id)
);
INSERT INTO user_details VALUES
(1, 'Kanishk', 'kumar'),
(2, 'Aadarsh', 'singh'),
(3, 'Shibac', 'chalas');
INSERT INTO location VALUES
(1,'sdfs-45', 'Agra', 'MP', '54556'),
(2,'gk-f43', 'Delhi','FD', '232'),
(3,'Sh-3/40', 'Varanasi', 'UP', '995');
INSERT INTO Contact VALUES
(1,'2222222222', 'kanishk@email.com'),
(2,'1111111111', 'alaloa@email.com'),
(3,'5756565665', 'shibasaie@email.com');
INSERT INTO contact_type VALUES
(11,'Friends'),
(12,'Family');
INSERT INTO link_usertype VALUES
(1,11),
(1,12),
(2,11),
(3,12);
#UC13
SELECT * from (user_details inner join location on user_details.user_id=location.user_id)
where city='Agra' or state='MP';
SELECT count(user_details.user_id) from (use_details inner join on location user_details.user_id=location.user_id)
where city='Agra' or state= 'MP';
SELECT * from user_details inner join location on user_details.user_id=location.user_id
where city='Agra' order by firstname;
SELECT count(user_id) from user_details inner join contact on user_details.user_id=contact.user_id
where type_of_contact='Family';
|
create database teste01;
show databases;
use teste01;
create table contatos(
nome varchar(30) not null,
telefonde varchar(30) not null
);
show tables;
drop table contatos;
create table contatos(
codigo int primary key auto_increment,
nome varchar(30) not null,
sobrenome varchar(30) not null,
ddd int (2) not null,
telefone varchar(9) not null,
data_nasc date null,
email varchar(30) null
);
drop table contatos;
show tables;
alter table contatos
add ativo smallint not null after email;
describe contatos;
alter table contatos
change telefone fone varchar(9) not null;
insert into contatos values(null,"Bruno","Matheus",47,"912345678","1995-09-14","bruno@gmail.com",1);
select * from contatos;
update contatos set
sobrenome = "Mateus" where codigo = 1;
update contatos set
ddd = 48,
email = "brunoo@gmail.com"
where codigo =1;
drop database teste01; |
insert into schloss.messages
(name, payload, topic) select
'user_registered' , json_build_object('name' , 'joe-' || i) , 'users'
from generate_series(1, 1) i;
insert into schloss.messages
(name, payload, topic, caused_by) select
'user_changed_password' , json_build_object('new_hash' , random()) , 'users', message_id
from schloss.messages
where name = 'user_registered';
insert into schloss.messages
(name, payload, topic, caused_by) select
'user_bought_product' , json_build_object('product_id' , random()) , 'users', message_id
from schloss.messages
where name = 'user_registered';
insert into schloss.messages
(name, payload, topic, caused_by) select
'user_paid' , json_build_object('amount' , random()) , 'users', message_id
from schloss.messages
where name = 'user_bought_product';
insert into schloss.messages
(name, payload, topic, caused_by) select
'user_received_product' , json_build_object('amount' , random()) , 'users', message_id
from schloss.messages
where name = 'user_paid';
insert into schloss.messages
(name, payload, topic, caused_by) select
'user_sent_feedback' , json_build_object('amount' , random()) , 'users', message_id
from schloss.messages
where name = 'user_received_product';
|
create table users(
id BIGSERIAL PRIMARY KEY ,
username varchar(65) unique not null ,
email varchar(65) ,
password varchar (65) not null,
active boolean
);
|
CREATE TABLE math_expression (
id INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 100, INCREMENT BY 1) PRIMARY KEY,
expression VARCHAR (45),
result FLOAT
);
|
-- show databases
-- because Batch 3 is the best!
CREATE DATABASE IF NOT EXISTS hbtn_0c_0; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.