text stringlengths 6 9.38M |
|---|
/*正式上线数据*/
INSERT INTO MERCHANT_CATEGORY(ID,NAME) values(1,'ROOT');
insert into resources (id,path,description) values(1,'/manager/member/info/**','会员信息管理资源');
insert into resources (id,path,description) values(2,'/manager/member/consume/**','会员消费查询资源');
insert into resources (id,path,description) values(3,'/manager/member/level/**','会员等级管理资源');
insert into resources (id,path,description) values(4,'/manager/saleploycreate/**','营销活动创建资源');
insert into resources (id,path,description) values(5,'/manager/saleploy/**','营销活动管理资源');
insert into resources (id,path,description) values(6,'/manager/sms/**','短信管理资源');
insert into resources (id,path,description) values(7,'/manager/child/**','门店查询资源');
insert into resources (id,path,description) values(8,'/manager/comment/**','点评管理资源');
insert into resources (id,path,description) values(9,'/manager/internal/merchant/**','商户资料管理资源');
insert into resources (id,path,description) values(10,'/manager/internal/pos/**','POS终端查询资源');
insert into resources (id,path,description) values(11,'/manager/security/operator/**','帐户管理资源');
insert into resources (id,path,description) values(12,'/manager/security/self/**','个人管理资源');
insert into resources (id,path,description) values(13,'/manager/security/log/**','操作日志资源');
insert into resources (id,path,description) values(14,'/manager/report/memberinfo/**','会员信息报表资源');
insert into resources (id,path,description) values(15,'/manager/report/memberconsume/**','会员消费报表');
insert into resources (id,path,description) values(16,'/manager/report/memberpoint/**','积分报表');
insert into resources (id,path,description) values(17,'/manager/report/saleploy/**','营销报表资源');
insert into ROLE (id,role_group,name,entry_index,logo,description,SHORT_CUT) values(1,1,'会员信息管理','/manager/member/info/info.htm','/manager/image/dev/T_01.jpg','会员信息管理',1);
insert into ROLE (id,role_group,name,entry_index,logo,description,SHORT_CUT) values(2,1,'会员消费查询','/manager/member/consume/consume.htm','/manager/image/dev/T_06.jpg','会员消费查询',0);
insert into ROLE (id,role_group,name,entry_index,logo,description,SHORT_CUT) values(3,1,'会员等级管理','/manager/member/level/view.htm','/manager/image/dev/T_07.jpg','会员等级管理',0);
insert into ROLE (id,role_group,name,entry_index,logo,description,SHORT_CUT) values(4,2,'发布营销活动','/manager/saleploycreate/create_one.htm','/manager/image/dev/T_17.jpg','创建营销活动',1);
insert into ROLE (id,role_group,name,entry_index,logo,description,SHORT_CUT) values(5,2,'营销活动管理','/manager/saleploy/list.htm','/manager/image/dev/T_02.jpg','营销活动管理',1);
insert into ROLE (id,role_group,name,entry_index,logo,description,SHORT_CUT) values(6,2,'短信管理','/manager/sms/view.htm','/manager/image/dev/T_05.jpg','短信管理',1);
insert into ROLE (id,role_group,name,entry_index,logo,description,SHORT_CUT) values(7,3,'门店查询','/manager/child/list.htm','/manager/image/dev/T_06.jpg','门店查询',0);
insert into ROLE (id,role_group,name,entry_index,logo,description,SHORT_CUT) values(8,4,'点评管理','/manager/comment/list.htm','/manager/image/dev/T_07.jpg','点评管理',0);
insert into ROLE (id,role_group,name,entry_index,logo,description,SHORT_CUT) values(9,5,'商户资料管理','/manager/internal/merchant/index.htm','/manager/image/dev/T_08.jpg','商户资料管理',0);
insert into ROLE (id,role_group,name,entry_index,logo,description,SHORT_CUT) values(10,5,'POS终端查询','/manager/internal/pos/list.htm','/manager/image/dev/T_09.jpg','POS终端查询',0);
insert into ROLE (id,role_group,name,entry_index,logo,description,SHORT_CUT) values(11,6,'帐户管理','/manager/security/operator/list.htm','/manager/image/dev/T_04.jpg','管理员帐户管理',1);
insert into ROLE (id,role_group,name,entry_index,logo,description,SHORT_CUT) values(12,6,'密码修改','/manager/security/self/','/manager/image/dev/T_11.jpg','个人管理',0);
insert into ROLE (id,role_group,name,entry_index,logo,description,SHORT_CUT) values(13,6,'操作日志','/manager/security/log/list.htm','/manager/image/dev/T_11.jpg','管理员操作日志',0);
insert into ROLE (id,role_group,name,entry_index,logo,description,SHORT_CUT) values(14,7,'会员信息报表','/manager/report/memberinfo/today.htm','/manager/image/dev/T_12.jpg','会员信息报表',0);
insert into ROLE (id,role_group,name,entry_index,logo,description,SHORT_CUT) values(15,7,'会员消费报表','/manager/report/memberconsume/today.htm','/manager/image/dev/T_13.jpg','会员消费报表',1);
insert into ROLE (id,role_group,name,entry_index,logo,description,SHORT_CUT) values(16,7,'积分报表','/manager/report/memberpoint/find.htm','/manager/image/dev/T_14.jpg','积分报表',0);
insert into ROLE (id,role_group,name,entry_index,logo,description,SHORT_CUT) values(17,7,'营销报表','/manager/report/saleploy/find.htm','/manager/image/dev/T_03.jpg','会员信息报表资源',0);
insert into role_resource (id,role_id,resource_id)values(1,1,1);
insert into role_resource (id,role_id,resource_id)values(2,2,2);
insert into role_resource (id,role_id,resource_id)values(3,3,3);
insert into role_resource (id,role_id,resource_id)values(4,4,4);
insert into role_resource (id,role_id,resource_id)values(5,5,5);
insert into role_resource (id,role_id,resource_id)values(6,6,6);
insert into role_resource (id,role_id,resource_id)values(7,7,7);
insert into role_resource (id,role_id,resource_id)values(8,8,8);
insert into role_resource (id,role_id,resource_id)values(9,9,9);
insert into role_resource (id,role_id,resource_id)values(10,10,10);
insert into role_resource (id,role_id,resource_id)values(11,11,11);
insert into role_resource (id,role_id,resource_id)values(12,12,12);
insert into role_resource (id,role_id,resource_id)values(13,13,13);
insert into role_resource (id,role_id,resource_id)values(14,14,14);
insert into role_resource (id,role_id,resource_id)values(15,15,15);
insert into role_resource (id,role_id,resource_id)values(16,16,16);
insert into role_resource (id,role_id,resource_id)values(17,17,17);
insert into manager (id,merchant_id,type,mobile,password,status,create_date,last_login_date)
VALUES(1,null,1,'13888888888','47a0b74c9c802fb1f65fd86bdcc6ed9afad2cebe',1,TO_DATE('2010-08-26 12:12:12','yyyy-mm-dd hh24:mi:ss'),TO_DATE('2010-08-26 12:12:12','yyyy-mm-dd hh24:mi:ss'));
insert into manager (id,merchant_id,type,mobile,password,status,create_date,last_login_date)
VALUES(2,null,1,'13888888889','47a0b74c9c802fb1f65fd86bdcc6ed9afad2cebe',1,TO_DATE('2010-08-26 12:12:12','yyyy-mm-dd hh24:mi:ss'),TO_DATE('2010-08-26 12:12:12','yyyy-mm-dd hh24:mi:ss'));
insert into manager_role (id,employee_id,role_id)values(1,1,1);
insert into manager_role (id,employee_id,role_id)values(2,1,2);
insert into manager_role (id,employee_id,role_id)values(3,1,3);
insert into manager_role (id,employee_id,role_id)values(4,1,4);
insert into manager_role (id,employee_id,role_id)values(5,1,5);
insert into manager_role (id,employee_id,role_id)values(6,1,6);
insert into manager_role (id,employee_id,role_id)values(7,1,7);
insert into manager_role (id,employee_id,role_id)values(8,1,8);
insert into manager_role (id,employee_id,role_id)values(9,1,9);
insert into manager_role (id,employee_id,role_id)values(10,1,10);
insert into manager_role (id,employee_id,role_id)values(11,1,11);
insert into manager_role (id,employee_id,role_id)values(12,1,12);
insert into manager_role (id,employee_id,role_id)values(13,1,13);
insert into manager_role (id,employee_id,role_id)values(14,1,14);
insert into manager_role (id,employee_id,role_id)values(15,1,15);
insert into manager_role (id,employee_id,role_id)values(16,1,16);
insert into manager_role (id,employee_id,role_id)values(17,1,17);
insert into manager_role (id,employee_id,role_id)values(18,2,1);
insert into manager_role (id,employee_id,role_id)values(19,2,2);
insert into manager_role (id,employee_id,role_id)values(20,2,3);
insert into manager_role (id,employee_id,role_id)values(21,2,4);
insert into manager_role (id,employee_id,role_id)values(22,2,5);
insert into manager_role (id,employee_id,role_id)values(23,2,6);
insert into manager_role (id,employee_id,role_id)values(24,2,7);
insert into manager_role (id,employee_id,role_id)values(25,2,8);
insert into manager_role (id,employee_id,role_id)values(26,2,9);
insert into manager_role (id,employee_id,role_id)values(27,2,10);
insert into manager_role (id,employee_id,role_id)values(28,2,11);
insert into manager_role (id,employee_id,role_id)values(29,2,12);
insert into manager_role (id,employee_id,role_id)values(30,2,13);
insert into manager_role (id,employee_id,role_id)values(31,2,14);
insert into manager_role (id,employee_id,role_id)values(32,2,15);
insert into manager_role (id,employee_id,role_id)values(33,2,16);
insert into manager_role (id,employee_id,role_id)values(34,2,17);
/*测试数据*/
INSERT INTO MEMBER_GROUP(ID) VALUES(1);
INSERT INTO MERCHANT (
ID,
MEMBER_GROUP_ID,
CODE,
NAME,
STATUS,
SHORT_NAME,
PARENT_ORGANIZATION,
BUSINESS_ADDRESS,
CONTACT_NAME,
CONTACT_TELEPHONE,
WIFI,
CREATE_DATE)
VALUES (1,1,'123321','测试用商户',1,'WC','A','B','C','D',1,TO_DATE('2010-08-26 12:12:12','yyyy-mm-dd hh24:mi:ss'));
insert into manager (id,merchant_id,type,mobile,password,status,create_date)
VALUES(3,1,2,'13880284172','47a0b74c9c802fb1f65fd86bdcc6ed9afad2cebe',1,TO_DATE('2010-08-26 12:12:12','yyyy-mm-dd hh24:mi:ss'));
insert into manager_role (id,employee_id,role_id)values(35,3,1);
insert into manager_role (id,employee_id,role_id)values(36,3,2);
insert into manager_role (id,employee_id,role_id)values(37,3,3);
insert into manager_role (id,employee_id,role_id)values(38,3,4);
insert into manager_role (id,employee_id,role_id)values(39,3,5);
insert into manager_role (id,employee_id,role_id)values(40,3,6);
insert into manager_role (id,employee_id,role_id)values(41,3,7);
insert into manager_role (id,employee_id,role_id)values(42,3,8);
insert into manager_role (id,employee_id,role_id)values(43,3,9);
insert into manager_role (id,employee_id,role_id)values(44,3,10);
insert into manager_role (id,employee_id,role_id)values(45,3,11);
insert into manager_role (id,employee_id,role_id)values(46,3,12);
insert into manager_role (id,employee_id,role_id)values(47,3,13);
insert into manager_role (id,employee_id,role_id)values(48,3,14);
insert into manager_role (id,employee_id,role_id)values(49,3,15);
insert into manager_role (id,employee_id,role_id)values(50,3,16);
insert into manager_role (id,employee_id,role_id)values(51,3,17);
|
SELECT
j25_cbsubs_subscriptions.user_id AS 'Member No',
j25_users.name AS Name,
j25_cbsubs_subscriptions.id as 'Subscription ID',
j25_cbsubs_subscriptions.status AS 'Membership Status',
DATE_FORMAT(j25_cbsubs_subscriptions.last_renewed_date, '%d-%m-%Y') AS 'Date Renewed',
DATE_FORMAT(j25_cbsubs_subscriptions.expiry_date, '%d-%m-%Y') AS 'Expiry date'
From j25_cbsubs_subscriptions
LEFT JOIN j25_users ON j25_cbsubs_subscriptions.user_id = j25_users.id
ORDER BY j25_cbsubs_subscriptions.user_id
|
with start_date as (
select '{{start_date}}' as string,
'{{start_date}}'::date as date,
'{{start_date}}'::timestamp as timestamp,
date_trunc('month', '{{start_date}}'::date) as month_date
), dates as (
select (select month_date from start_date) + (interval '1' month * generate_series(0,month_count::int)) as f,
(select month_date from start_date) + (interval '1' month * (1 + generate_series(0,month_count::int))) as t,
to_char((select month_date from start_date) + (interval '1' month * generate_series(0,month_count::int)), 'MM/YYYY') as rel
from (
select (date_part('year', now()) - date_part('year', (select date from start_date))) * 12 + (date_part('month', now()) - date_part('month', (select date from start_date))) as month_count
) sub
)
select
d.rel,
d.f,
d.t,
max(f.stargazers_count) as stars
from
dates d,
gha_forkees f
where
f.dup_created_at >= d.f
and f.dup_created_at < d.t
group by
d.rel,
d.f,
d.t
order by
d.f
;
|
-- 코드를 입력하세요
SELECT ANIMAL_ID, NAME
FROM ANIMAL_INS
WHERE (NAME LIKE '%EL%'
or NAME LIKE '%el%' )
and ANIMAL_TYPE = 'Dog'
order by NAME;
# select name from animal_ins
# where name
# like '%el%'
# or '%EL%'
# and animal_type = 'dog' |
/* FIT9132 2019 S1 Assignment 2 Q3 ANSWERS
Student Name:tianxin hang
Student ID:26792923
Comments to your marker:
*/
SET AUTOCOMMIT OFF;
/* (i)*/
CREATE OR REPLACE TRIGGER change_item_code AFTER
UPDATE OF item_code ON item
FOR EACH ROW
BEGIN
IF updating THEN
UPDATE item_treatment
SET
item_code = :new.item_code
WHERE
item_code = :old.item_code;
dbms_output.put_line('ITEM_CODE '
|| :old.item_code
|| ' has changed to '
|| :new.item_code);
END IF;
END;
/
/* Test Harness*/
SET SERVEROUTPUT ON
SET ECHO ON
/* Prior state*/
SELECT
*
FROM
item;
SELECT
*
FROM
item_treatment;
/* Test trigger */
UPDATE item
SET
item_code = 'KNR56'
WHERE
item_code = 'KN056';
/* Post state*/
SELECT
*
FROM
item;
qqq1
SELECT
*
FROM
item_treatment;
/* Undo changes*/
ROLLBACK;
SET ECHO OFF;
/* (ii)*/
CREATE OR REPLACE TRIGGER check_patient_name BEFORE
INSERT ON patient
FOR EACH ROW
BEGIN
IF :new.patient_fname IS NULL AND :new.patient_lname IS NULL THEN
raise_application_error(-20000, 'fname and lname can not be both null');
END IF;
END;
/
/* Test Harness */
SET ECHO ON
/* Test Trigger*/
INSERT INTO patient VALUES (
'111111',
'',
'',
'25 cambro rd clayton vic 3168',
TO_DATE('11-12-1986', 'DD-MM-YYYY'),
'0322739597'
);
/* although not stricly required, closes transaction*/
ROLLBACK;
SET ECHO OFF;
/* (iii)*/
CREATE OR REPLACE TRIGGER adjust_item_stock AFTER
INSERT OR DELETE OR UPDATE ON item_treatment
FOR EACH ROW
BEGIN
IF inserting THEN
UPDATE item
SET
item_stock = item_stock - :new.it_qty_used
WHERE
item_code = :new.item_code;
dbms_output.put_line(:new.item_code
|| ' HAS COMSUMED '
|| :new.it_qty_used
|| ' IN PROCEDURE '
|| :new.adprc_no);
END IF;
IF deleting THEN
raise_application_error(-20000, 'ITEM USED INFORMATION CAN NOT BE DELETED'
);
END IF;
IF updating THEN
raise_application_error(-20000, 'ITEM USED INFORMATION CAN NOT BE UPDATED'
);
END IF;
END;
/
/* Test Harness*/
SET ECHO ON
/* Prior state*/
SELECT
*
FROM
item;
SELECT
*
FROM
item_treatment;
/* Test trigger */
/* Test Insert*/
INSERT INTO item_treatment (
adprc_no,
item_code,
it_qty_used,
it_item_total_cost
) VALUES (
0100312,
'NE001',
2,
34.5
);
/* Post state*/
SELECT
*
FROM
item;
SELECT
*
FROM
item_treatment;
/* Test Delete*/
DELETE FROM item_treatment
WHERE
adprc_no = 100312
AND item_code = 'AN002';
/* Test Update*/
UPDATE item_treatment
SET
it_qty_used = 2
WHERE
adprc_no = 100312
AND item_code = 'AN002';
/* Undo changes*/
ROLLBACK;
SET ECHO OFF; |
-- phpMyAdmin SQL Dump
-- version 4.5.1
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: Dec 07, 2017 at 05:06 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: `kopma`
--
-- --------------------------------------------------------
--
-- Table structure for table `tt_barang`
--
CREATE TABLE `tt_barang` (
`kode_barang` char(5) NOT NULL,
`kategori` varchar(10) NOT NULL,
`nama_barang` varchar(100) NOT NULL,
`harga_modal` int(12) NOT NULL,
`harga_jual` int(12) NOT NULL,
`file_gambar` varchar(100) NOT NULL,
`berat` int(10) NOT NULL,
`bahan` varchar(100) NOT NULL,
`panjang` int(10) NOT NULL,
`lebar` int(10) NOT NULL,
`tebal` int(10) NOT NULL,
`tali_panjang` varchar(100) NOT NULL,
`bag_charm` varchar(100) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Dumping data for table `tt_barang`
--
INSERT INTO `tt_barang` (`kode_barang`, `kategori`, `nama_barang`, `harga_modal`, `harga_jual`, `file_gambar`, `berat`, `bahan`, `panjang`, `lebar`, `tebal`, `tali_panjang`, `bag_charm`) VALUES
('W-1', 'Wan', 'TAS HITAM IMPORT, HANDBAG, SHOULDER BAG', 145000, 170000, '1.jpg', 900, 'KULIT PU', 22, 26, 9, 'ada', 'ada'),
('W-2', 'Wan', 'TAS ABU-ABU IMPORT, HANDBAG, SHOULDER BAG', 145000, 170000, '2.jpg', 900, 'KULIT PU', 22, 26, 9, 'ada', 'ada'),
('W-3', 'Wan', 'TAS UNGU IMPORT, HANDBAG, SHOULDER BAG', 145000, 170000, '3.jpg', 900, 'KULIT PU', 22, 26, 9, 'ada', 'ada'),
('W-4', 'Wan', 'TAS ABU-ABU IMPORT, HANDBAG, SHOULDER BAG', 160000, 180000, '4.jpg', 700, 'KULIT PU', 24, 29, 10, 'ada', 'ada'),
('A-1', 'Anak', 'TAS ANAK CEWE PINK, IMPORT SHOULDER BAG', 72000, 90000, '5.jpg', 100, ' COTTON CREPE', 16, 17, 4, 'ADA', 'TIDAK ADA'),
('A-2', 'Anak', 'TAS ANAK CEWE UNGU, IMPORT SHOULDER BAG', 72000, 90000, '6.jpg', 100, ' COTTON CREPE', 16, 17, 4, 'ADA', 'TIDAK ADA'),
('A-3', 'Anak', 'TAS ANAK CEWE BABI PINK, IMPORT SHOULDER BAG', 65000, 80000, '7.jpg', 100, ' COTTON CREPE', 16, 18, 5, 'ADA', 'TIDAK ADA'),
('A-4', 'Anak', 'TAS ANAK CEWE KUCING, IMPORT SHOULDER BAG', 65000, 80000, '8.jpg', 100, ' COTTON CREPE', 16, 18, 5, 'ADA', 'TIDAK ADA'),
('MU-1', 'MU', 'TAS MAKE UP CLASSY NAVY TRAVEL POUCH', 36000, 50000, '9.jpg', 200, 'NYLON MESH', 22, 18, 8, 'TIDAK ADA', 'TIDAK ADA'),
('MU-2', 'MU', 'TAS MAKE UP JEWELRY DIOR UNGU IMPORT, DOUBLE ZIPPER', 185000, 200000, '10.jpg', 2000, 'NYLON MESH', 19, 21, 13, 'TIDAK ADA', 'TIDAK ADA'),
('MU-3', 'MU', 'TAS MAKE UP 3IN1 PINK ZEBRA IMPORT WATER PROOF', 25000, 40000, '11.jpeg', 170, 'NYLON MESH', 20, 16, 8, 'ADA', 'TIDAK ADA'),
('PRI-1', 'Pria', 'TAS RANSEL HIJAU LORENG ARMY', 105000, 120000, '12.jpg', 500, 'DINIR', 35, 40, 12, 'TIDAK ADA', 'TIDAK ADA'),
('W-5', 'Wan', 'TAS RANSEL JANSPORT HITAM +SLOT LAPTOP', 70000, 90000, '13.jpg', 500, 'CANVAS(LUAR), SATIN POLOS(DALAM)', 40, 35, 10, 'TIDAK ADA', 'TIDAK ADA'),
('PRI-2', 'Pria', 'TAS RANSEL ADIDAS BIRU ANTI AIR +SLOT LAPTOP', 100000, 120000, '14.jpg', 400, 'CORDURA PREMIUM', 40, 35, 14, 'TIDAK ADA', 'TIDAK ADA'),
('PRO-1', 'Prom', 'TAS MERAH IMPORT, HANDBAG, SHOULDER BAG', 120000, 130000, '15.jpg', 95, 'PU', 31, 28, 0, 'ADA', 'TIDAK ADA');
-- --------------------------------------------------------
--
-- Table structure for table `tt_cara_pesan`
--
CREATE TABLE `tt_cara_pesan` (
`no` int(10) NOT NULL,
`judul` varchar(150) NOT NULL,
`isi` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `tt_cara_pesan`
--
INSERT INTO `tt_cara_pesan` (`no`, `judul`, `isi`) VALUES
(1, 'PESAN VIA', 'Website (Cepat, No Waiting-List, LOGIN dulu), \nWa/SMS [081 335 68 2030], \nLINE [@tokotasmurah]'),
(2, 'FORMAT PESAN VIA WA/SMS/LINE', 'Kodebarang + Nama Pemesan + Alamat + Bank Tujuan (BCA/BNI) + No Hp'),
(3, 'CEK ONGKOS KIRIM', 'POS: http://www.posindonesia.co.id/tarif/ atau JNE: www.jne.co.id - Pengiriman dari Tulungagung'),
(4, 'Bank Tujuan', 'BCA : Ngo My Ling - 048 344 12468 atau BNI Ngo My Ling - 1268 3144 1246');
-- --------------------------------------------------------
--
-- Table structure for table `tt_faq`
--
CREATE TABLE `tt_faq` (
`no` int(10) NOT NULL,
`judul` varchar(100) NOT NULL,
`isi` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `tt_faq`
--
INSERT INTO `tt_faq` (`no`, `judul`, `isi`) VALUES
(1, 'APAKAH HARGA TERTERA SUDAH TERMASUK ONGKOS KIRIM ?', 'Pengiriman kami dari Jakarta (kode pos 10640). Harga tertera belum termasuk Ongkos Kirim. Keterangan ongkos kirim bisa di check di :\nPOS : http://www.posindonesia.co.id/tarif/\nJNE : http://www.jne.co.id/home.php'),
(2, 'BAGAIMANA JIKA SUDAH BAYAR TETAPI STOCK BARANG TERNYATA KOSONG ?', 'Ini bisa saja terjadi (dengan alasan apapun), solusi yg kami tawarkan adalah refund uang yg sudah ditransfer / ganti model lain sesuai kemauan pembeli\r\n\r\nProses REFUND (kembali uang) hanya dapat di transfer ke rekening BCA & BNI (tidak bank lain).'),
(3, 'APABILA SAYA SUDAH ORDER, DAPATKAH ORDER SAYA DISIMPAN SAMPAI MINGGU DEPAN?', 'Persediaan barang kami dapat berubah setiap waktu, jadi apabila sudah order sebaiknya langsung melakukan pembayaran setelah status order menjadi "TUNGGU PEMBAYARAN”\n\n# Untuk informasi lebih lanjut, dapat menghubungi kami pribadi');
-- --------------------------------------------------------
--
-- Table structure for table `tt_invoice`
--
CREATE TABLE `tt_invoice` (
`kode_invoice` int(10) NOT NULL,
`tanggal` datetime NOT NULL,
`deadline` datetime NOT NULL,
`username` varchar(100) NOT NULL,
`status` enum('paid','unpaid','canceled') NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `tt_invoice`
--
INSERT INTO `tt_invoice` (`kode_invoice`, `tanggal`, `deadline`, `username`, `status`) VALUES
(1, '2017-05-26 05:22:31', '2017-05-27 05:22:31', 'user', ''),
(2, '2017-09-11 11:35:07', '2017-09-12 11:35:07', 'user', ''),
(3, '2017-11-28 16:32:17', '2017-11-29 16:32:17', 'user', 'unpaid');
-- --------------------------------------------------------
--
-- Table structure for table `tt_keranjang_belanja`
--
CREATE TABLE `tt_keranjang_belanja` (
`kode_keranjang` int(10) NOT NULL,
`username_pelanggan` varchar(100) NOT NULL,
`kode_barang` varchar(100) NOT NULL,
`total_harga` int(100) NOT NULL,
`tanggal` date NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `tt_keranjang_belanja`
--
INSERT INTO `tt_keranjang_belanja` (`kode_keranjang`, `username_pelanggan`, `kode_barang`, `total_harga`, `tanggal`) VALUES
(1, 'gab', 'W-1', 150000, '2016-05-09');
-- --------------------------------------------------------
--
-- Table structure for table `tt_pesanan`
--
CREATE TABLE `tt_pesanan` (
`kode_pesanan` int(10) NOT NULL,
`kode_invoice` int(10) NOT NULL,
`nama_barang` varchar(50) NOT NULL,
`harga` int(9) NOT NULL,
`options` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `tt_pesanan`
--
INSERT INTO `tt_pesanan` (`kode_pesanan`, `kode_invoice`, `nama_barang`, `harga`, `options`) VALUES
(1, 1, 'W-1', 170000, ''),
(2, 2, 'PRO-1', 130000, ''),
(3, 2, 'PRI-1', 120000, ''),
(4, 3, 'PRO-1', 130000, ''),
(5, 3, 'W-1', 170000, ''),
(6, 3, 'PRI-1', 120000, '');
-- --------------------------------------------------------
--
-- Table structure for table `tt_user`
--
CREATE TABLE `tt_user` (
`username` varchar(100) NOT NULL,
`password` varchar(100) NOT NULL,
`nama` varchar(100) NOT NULL,
`email` varchar(100) NOT NULL,
`no_hp` bigint(255) NOT NULL,
`jenis_kelamin` varchar(10) NOT NULL,
`tanggal_lahir` varchar(100) NOT NULL,
`privileges` int(11) NOT NULL,
`status` varchar(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `tt_user`
--
INSERT INTO `tt_user` (`username`, `password`, `nama`, `email`, `no_hp`, `jenis_kelamin`, `tanggal_lahir`, `privileges`, `status`) VALUES
('admin', 'admin', 'gabrielle', 'gab@gmail.com', 81335123456, 'perempuan', '1998-08-15', 1, 'login'),
('test', 'test', 'test', 'test@test.com', 1234567, 'perempuan', '2000-01-01', 0, 'login'),
('user', 'user', 'gab', 'resugab@gmail.com', 813353219399, 'perempuan', '2000-10-01', 0, 'login'),
('users', 'pass', 'gab', 'linkherzg@gmail.com', 897868, 'P', '0000-00-00', 0, 'login');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `tt_barang`
--
ALTER TABLE `tt_barang`
ADD PRIMARY KEY (`kode_barang`);
--
-- Indexes for table `tt_cara_pesan`
--
ALTER TABLE `tt_cara_pesan`
ADD PRIMARY KEY (`no`);
--
-- Indexes for table `tt_faq`
--
ALTER TABLE `tt_faq`
ADD PRIMARY KEY (`no`);
--
-- Indexes for table `tt_invoice`
--
ALTER TABLE `tt_invoice`
ADD PRIMARY KEY (`kode_invoice`);
--
-- Indexes for table `tt_keranjang_belanja`
--
ALTER TABLE `tt_keranjang_belanja`
ADD PRIMARY KEY (`kode_keranjang`);
--
-- Indexes for table `tt_pesanan`
--
ALTER TABLE `tt_pesanan`
ADD PRIMARY KEY (`kode_pesanan`);
--
-- Indexes for table `tt_user`
--
ALTER TABLE `tt_user`
ADD PRIMARY KEY (`username`),
ADD UNIQUE KEY `email` (`email`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `tt_invoice`
--
ALTER TABLE `tt_invoice`
MODIFY `kode_invoice` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT for table `tt_keranjang_belanja`
--
ALTER TABLE `tt_keranjang_belanja`
MODIFY `kode_keranjang` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `tt_pesanan`
--
ALTER TABLE `tt_pesanan`
MODIFY `kode_pesanan` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
/*!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 */;
|
-- Distributions
SET SEARCH_PATH TO markus;
DROP TABLE IF EXISTS q1;
-- You must not change this table definition.
CREATE TABLE q1 (
assignment_id integer,
average_mark_percent real,
num_80_100 integer,
num_60_79 integer,
num_50_59 integer,
num_0_49 integer
);
-- You may find it convenient to do this for each of the views
-- that define your intermediate steps. (But give them better names!)
DROP VIEW IF EXISTS assignment_max_mark CASCADE;
DROP VIEW IF EXISTS group_true_mark CASCADE;
-- Define views for your intermediate steps here.
-- Question One
-- For each assignment, report the average grade, the number of grades between 80 and 100 percent inclusive
-- the number of grades between 60 and 79 percent inclusive, the number of grades between 50 and 59 percent
-- inclusive, and the number of grades below 50 percent. Where there were no grades in a given range, report 0
-- Find the weighted sum of each assignment -- Assume that each assignment has a rubirc
create view assignment_max_mark as
select assignment_id, cast (sum(out_of * weight) as float) as max_mark
from RubricItem
group by assignment_id;
-- Find the true total mark in percentage
create view group_true_mark as
select assignment_id, group_id, ( cast(mark as float) / cast (max_mark as float))*100.0 as true_mark
from AssignmentGroup
natural left join Result
natural left join assignment_max_mark;
-- Use case to count each assignment stats
insert into q1 (
select assignment_id, avg(true_mark),
count(case when true_mark >= 80 and true_mark <= 100 then 1 end) as num_80_100,
count(case when true_mark >= 60 and true_mark < 80 then 1 end) as num_60_79,
count(case when true_mark >= 50 and true_mark < 60 then 1 end) as num_50_59,
count(case when true_mark >= 0 and true_mark < 50 then 1 end) as num_0_49
from group_true_mark group by assignment_id
); |
-- Use DATE_TRUNC to pull month level information about the first order ever placed in the orders table.
SELECT DATE_TRUNC('month', MIN(occurred_at)) AS min_month
FROM orders;
-- Use the results of the previous query to find only the orders that took place in the same month and year as the first order, and then pull the average for each type of paper qty in this month
SELECT DATE_TRUNC('month', occurred_at),
AVG(standard_qty) AS avg_standard,
AVG(gloss_qty) AS avg_gloss,
AVG(poster_qty) AS avg_poster
FROM orders
WHERE DATE_TRUNC('month', occurred_at) = (
SELECT DATE_TRUNC('month', MIN(occurred_at)) AS min_month
FROM orders)
GROUP BY 1; |
SELECT c3.sel_profile_value.profile_value_name AS moment
,c3.sel_profile_value.profile_type_id AS typee
,ROUND(percent / percent_network, 2) AS indexx
FROM
(
SELECT profile_value
,volume
,((SUM(volume)) / (SUM(SUM(volume)) OVER())) AS percent
,volume_network
,((SUM(volume_network)) / (SUM(SUM(volume_network)) OVER())) AS percent_network
FROM
(
SELECT profile_value
,COUNT(*) AS volume
FROM edb.edb_user_moments
WHERE dsp_source_id = 1
AND confidence >= 60
AND dsp_user_id IS NOT NULL
AND profile_value NOT IN (46,48,62)
AND profile_type in (2,3,4,5)
AND dsp_user_id != ''
AND dsp_user_id != '0'
AND dsp_user_id > '1'
AND event_date >= 20180101
AND dsp_user_id IN
(
SELECT dsp_user_id
FROM edb.edb_captify_standard_feed
WHERE dsp_source_id = 1 --Change if necessary
AND dsp_user_id IS NOT NULL
AND dsp_user_id != ''
AND dsp_user_id != '0'
AND dsp_user_id > '1' --Only needed for Appnexus
AND insertion_order_id = 6139
AND sf_event_date >= 20180101
GROUP BY dsp_user_id
)
GROUP BY profile_value
ORDER BY volume DESC
) brand
JOIN
(
SELECT profile_value AS profile_value_network
,COUNT(*) AS volume_network
FROM edb.edb_user_moments
WHERE dsp_source_id = 1
AND confidence >= 60
AND dsp_user_id IS NOT NULL
AND profile_value NOT IN (46,48,62)
AND profile_type in (2,3,4,5)
AND dsp_user_id != ''
AND dsp_user_id != '0'
AND dsp_user_id > '1'
AND event_date >= 20180101
GROUP BY profile_value_network
ORDER BY volume_network DESC
) network ON brand.profile_value = network.profile_value_network
WHERE profile_value IS NOT NULL
AND profile_value_network IS NOT NULL
GROUP BY profile_value, volume, volume_network
ORDER BY volume DESC
) finall
LEFT JOIN c3.sel_profile_value ON finall.profile_value = c3.sel_profile_value.profile_value_id
GROUP BY moment,typee, indexx
ORDER BY indexx DESC |
-- This is the first comment.
-- This is the 2nd comment.
-- This is ignored.
-- CMD
TOP-COMMENT
-- END
-- OUTPUT
-- This is the first comment.
-- This is the 2nd comment.
-- END
|
DROP TABLE Posts;
DROP TABLE Users;
CREATE TABLE Users (
username VARCHAR(12) NOT NULL UNIQUE,
password VARCHAR(15) NOT NULL,
joindate DATE DEFAULT CURRENT_DATE,
id INT NOT NULL GENERATED ALWAYS AS IDENTITY PRIMARY KEY
);
CREATE TABLE Posts (
content VARCHAR(140) NOT NULL,
authorid INT NOT NULL,
postdate DATE DEFAULT CURRENT_DATE,
id INT NOT NULL GENERATED ALWAYS AS IDENTITY PRIMARY KEY
);
INSERT INTO Users (username, password, joindate) VALUES
('johndoe', 'password', '2013-05-09'),
('jilljack', 'password', '2013-10-31');
INSERT INTO Posts (content, authorid, postdate) VALUES
('I''m a white-hat hacking my wonky Twonky server.', 1, '2013-05-09'),
('My wonky Twonky server conked out.', 1, '2014-06-23'),
('I see good reason not to configure Twonky.', 2, '2013-11-01');
|
set hive.execution.engine=spark;
drop table if exists dws.dws_fact_work_measure;
create table if not exists dws.dws_fact_work_measure (
date_key string COMMENT '日期代理键',
product_key string COMMENT '产品代理键',
sub_company_name string comment '子公司',
apply_no string COMMENT '订单编号',
product_version string COMMENT '版本',
start_time timestamp COMMENT '环节开始时间',
end_time timestamp COMMENT '环节完结时间',
jiedian_name string COMMENT '服务节点',
sub_department_name string comment '子部门',
jingban_user string comment '节点经办人'
);
insert overwrite table dws.dws_fact_work_measure
SELECT
cast(dd.id as string) date_key
,cast(dp.id as string) product_key
,a.branch_name sub_company_name
,a.apply_no
,a.product_version
,a.start_time
,a.end_time
,a.jiedian_name
,a.department_name sub_department_name
,a.jingban_user
FROM dws.tmp_fact_work_measure a
left join dws.dimension_date dd on to_date(a.apply_time) = dd.calendar
left join dws.dimension_product dp on a.product_name = dp.product_name
|
ALTER TABLE mhac.game_results
ADD CONSTRAINT ux_game_period UNIQUE (game_id, period); |
-- --------------------------------------------------------
-- Host: 127.0.0.1
-- Server version: 10.1.19-MariaDB - mariadb.org binary distribution
-- Server OS: Win64
-- HeidiSQL Version: 9.3.0.4984
-- --------------------------------------------------------
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET NAMES utf8mb4 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
-- Dumping database structure for crossride
CREATE DATABASE IF NOT EXISTS `crossride` /*!40100 DEFAULT CHARACTER SET utf8 */;
USE `crossride`;
-- Dumping structure for table crossride.person
CREATE TABLE IF NOT EXISTS `person` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`name` varchar(255) DEFAULT NULL,
`email` varchar(255) DEFAULT NULL,
`registration_number` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;
-- Dumping data for table crossride.person: ~2 rows (approximately)
/*!40000 ALTER TABLE `person` DISABLE KEYS */;
INSERT INTO `person` (`id`, `name`, `email`, `registration_number`) VALUES
(1, 'masud', 'masud@yahoo.com', '01712'),
(2, 'rassel', 'rassel@gmail.com', '01835'),
(3, 'abdullah', 'abdullah@yahoo.com', '01914');
/*!40000 ALTER TABLE `person` ENABLE KEYS */;
-- Dumping structure for table crossride.ride
CREATE TABLE IF NOT EXISTS `ride` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`driver_id` bigint(20) DEFAULT NULL,
`rider_id` bigint(20) DEFAULT NULL,
`start_time` varchar(255) DEFAULT NULL,
`end_time` varchar(255) DEFAULT NULL,
`distance` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `fk_address_person_driver` (`driver_id`),
KEY `fk_address_person_rider` (`rider_id`),
CONSTRAINT `fk_address_person_driver` FOREIGN KEY (`driver_id`) REFERENCES `person` (`id`) ON DELETE CASCADE,
CONSTRAINT `fk_address_person_rider` FOREIGN KEY (`rider_id`) REFERENCES `person` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;
-- Dumping data for table crossride.ride: ~0 rows (approximately)
/*!40000 ALTER TABLE `ride` DISABLE KEYS */;
INSERT INTO `ride` (`id`, `driver_id`, `rider_id`, `start_time`, `end_time`, `distance`) VALUES
(1, 1, 2, '2018-08-24 09:30', '2018-08-24 10:00', 7),
(2, 1, 3, '2018-08-24 09:20', '2018-08-24 09:45', 5),
(3, 2, 1, '2018-08-24 09:15', '2018-08-24 09:30', 6);
/*!40000 ALTER TABLE `ride` ENABLE KEYS */;
/*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */;
/*!40014 SET FOREIGN_KEY_CHECKS=IF(@OLD_FOREIGN_KEY_CHECKS IS NULL, 1, @OLD_FOREIGN_KEY_CHECKS) */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
SELECT * FROM emp_manager AS em
ORDER BY em.emp_no;
SELECT
e1.*
FROM emp_manager AS e1
JOIN
emp_manager AS e2
ON e1.emp_no = e2.manager_no;
|
-- MySQL dump 10.13 Distrib 5.6.33, for debian-linux-gnu (x86_64)
/*!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 `ANALYSIS_JOB`
--
DROP TABLE IF EXISTS `ANALYSIS_JOB`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ANALYSIS_JOB` (
`JOB_ID` bigint(20) NOT NULL AUTO_INCREMENT,
`JOB_OPERATOR` varchar(15) COLLATE utf8_unicode_ci NOT NULL,
`PIPELINE_ID` tinyint(4) NOT NULL,
`SUBMIT_TIME` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`COMPLETE_TIME` datetime DEFAULT NULL,
`ANALYSIS_STATUS_ID` tinyint(4) NOT NULL,
`RE_RUN_COUNT` tinyint(4) DEFAULT '0',
`INPUT_FILE_NAME` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`RESULT_DIRECTORY` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`EXTERNAL_RUN_IDS` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`SAMPLE_ID` int(11) DEFAULT NULL,
`IS_PRODUCTION_RUN` bit(1) DEFAULT NULL,
`EXPERIMENT_TYPE_ID` tinyint(4) DEFAULT NULL,
`RUN_STATUS_ID` tinyint(4) DEFAULT NULL,
`INSTRUMENT_PLATFORM` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`INSTRUMENT_MODEL` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
PRIMARY KEY (`JOB_ID`),
UNIQUE KEY `UC_ANALYSIS_JOB` (`PIPELINE_ID`,`EXTERNAL_RUN_IDS`),
UNIQUE KEY `ANALYSIS_JOB_JOB_ID_EXTERNAL_RUN_IDS_b5a286e3_uniq` (`JOB_ID`,`EXTERNAL_RUN_IDS`),
UNIQUE KEY `ANALYSIS_JOB_PIPELINE_ID_EXTERNAL_RUN_IDS_d48405ed_uniq` (`PIPELINE_ID`,`EXTERNAL_RUN_IDS`),
KEY `ANALYSIS_JOB_E_TYPE_ID_IDX` (`EXPERIMENT_TYPE_ID`),
KEY `ANALYSIS_JOB_ANALYSIS_STATUS_ID_1381ce70_fk_ANALYSIS_` (`ANALYSIS_STATUS_ID`),
KEY `ANALYSIS_JOB_SAMPLE_ID_d0086595_fk_SAMPLE_SAMPLE_ID` (`SAMPLE_ID`),
FULLTEXT KEY `run_instrument_platform_ts_idx` (`INSTRUMENT_PLATFORM`),
FULLTEXT KEY `run_instrument_model_ts_idx` (`INSTRUMENT_MODEL`),
CONSTRAINT `ANALYSIS_JOB_ANALYSIS_STATUS_ID_1381ce70_fk_ANALYSIS_` FOREIGN KEY (`ANALYSIS_STATUS_ID`) REFERENCES `ANALYSIS_STATUS` (`ANALYSIS_STATUS_ID`),
CONSTRAINT `ANALYSIS_JOB_EXPERIMENT_TYPE_ID_be46185e_fk_EXPERIMEN` FOREIGN KEY (`EXPERIMENT_TYPE_ID`) REFERENCES `EXPERIMENT_TYPE` (`EXPERIMENT_TYPE_ID`),
CONSTRAINT `ANALYSIS_JOB_PIPELINE_ID_b97b1941_fk_PIPELINE_` FOREIGN KEY (`PIPELINE_ID`) REFERENCES `PIPELINE_RELEASE` (`PIPELINE_ID`),
CONSTRAINT `ANALYSIS_JOB_SAMPLE_ID_d0086595_fk_SAMPLE_SAMPLE_ID` FOREIGN KEY (`SAMPLE_ID`) REFERENCES `SAMPLE` (`SAMPLE_ID`)
) ENGINE=InnoDB AUTO_INCREMENT=136371 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Table to track all analysis runs in production.';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `ANALYSIS_JOB_ANN`
--
DROP TABLE IF EXISTS `ANALYSIS_JOB_ANN`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ANALYSIS_JOB_ANN` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`UNITS` varchar(25) COLLATE utf8_unicode_ci DEFAULT NULL,
`var_id` int(11) NOT NULL,
`VAR_VAL_UCV` varchar(4000) COLLATE utf8_unicode_ci DEFAULT NULL,
`JOB_ID` bigint(20) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `ANALYSIS_JOB_ANN_JOB_ID_var_id_59085dcf_uniq` (`JOB_ID`,`var_id`),
KEY `ANALYSIS_JOB_ANN_var_id_4c70c723_fk_SUMMARY_VARIABLE_NAMES_id` (`var_id`),
CONSTRAINT `ANALYSIS_JOB_ANN_JOB_ID_001ee98f_fk_ANALYSIS_JOB_JOB_ID` FOREIGN KEY (`JOB_ID`) REFERENCES `ANALYSIS_JOB` (`JOB_ID`),
CONSTRAINT `ANALYSIS_JOB_ANN_var_id_4c70c723_fk_SUMMARY_VARIABLE_NAMES_id` FOREIGN KEY (`var_id`) REFERENCES `SUMMARY_VARIABLE_NAMES` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=973622 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `ANALYSIS_STATUS`
--
DROP TABLE IF EXISTS `ANALYSIS_STATUS`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ANALYSIS_STATUS` (
`ANALYSIS_STATUS_ID` tinyint(4) NOT NULL AUTO_INCREMENT,
`ANALYSIS_STATUS` varchar(25) CHARACTER SET utf8 NOT NULL,
PRIMARY KEY (`ANALYSIS_STATUS_ID`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `BIOME_HIERARCHY_TREE`
--
DROP TABLE IF EXISTS `BIOME_HIERARCHY_TREE`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `BIOME_HIERARCHY_TREE` (
`BIOME_ID` smallint(6) NOT NULL DEFAULT '0',
`BIOME_NAME` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`LFT` smallint(6) NOT NULL,
`RGT` smallint(6) NOT NULL,
`DEPTH` tinyint(4) NOT NULL,
`LINEAGE` varchar(500) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`BIOME_ID`),
UNIQUE KEY `BIOME_HIERARCHY_TREE_BIOME_ID_BIOME_NAME_273ccaf6_uniq` (`BIOME_ID`,`BIOME_NAME`),
FULLTEXT KEY `biome_biome_name_ts_idx` (`BIOME_NAME`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `BLACKLISTED_STUDY`
--
DROP TABLE IF EXISTS `BLACKLISTED_STUDY`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `BLACKLISTED_STUDY` (
`EXT_STUDY_ID` varchar(18) COLLATE utf8_unicode_ci NOT NULL COMMENT 'This is the external unique (non-EMG) ID for the study, e.g. SRPXXXXXX for SRA studies',
`ERROR_TYPE_ID` tinyint(4) NOT NULL COMMENT 'Foreign key to the study error type table.',
`ANALYZER` varchar(15) COLLATE utf8_unicode_ci NOT NULL COMMENT 'Person who tried to analyse this study.',
`PIPELINE_ID` tinyint(4) DEFAULT NULL COMMENT 'Optional. The pipeline version used to run this study.',
`DATE_BLACKLISTED` date NOT NULL COMMENT 'The date when the study has been marked as blacklisted.',
`COMMENT` text COLLATE utf8_unicode_ci COMMENT 'Use this field to add more detailed information about the issue.',
PRIMARY KEY (`EXT_STUDY_ID`),
KEY `ERROR_TYPE_ID` (`ERROR_TYPE_ID`),
CONSTRAINT `BLACKLISTED_STUDY_ibfk_1` FOREIGN KEY (`ERROR_TYPE_ID`) REFERENCES `STUDY_ERROR_TYPE` (`ERROR_ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `EXPERIMENT_TYPE`
--
DROP TABLE IF EXISTS `EXPERIMENT_TYPE`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `EXPERIMENT_TYPE` (
`EXPERIMENT_TYPE_ID` tinyint(4) NOT NULL AUTO_INCREMENT,
`EXPERIMENT_TYPE` varchar(30) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`EXPERIMENT_TYPE_ID`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `GSC_CV_CV`
--
DROP TABLE IF EXISTS `GSC_CV_CV`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `GSC_CV_CV` (
`VAR_NAME` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`VAR_VAL_CV` varchar(60) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
PRIMARY KEY (`VAR_VAL_CV`),
UNIQUE KEY `GSC_CV_CV_PK` (`VAR_VAL_CV`),
UNIQUE KEY `GSC_CV_CV_U1` (`VAR_NAME`,`VAR_VAL_CV`),
UNIQUE KEY `GSC_CV_CV_VAR_NAME_VAR_VAL_CV_3a82d86e_uniq` (`VAR_NAME`,`VAR_VAL_CV`),
CONSTRAINT `GSC_CV_CV_ibfk_1` FOREIGN KEY (`VAR_NAME`) REFERENCES `VARIABLE_NAMES` (`VAR_NAME`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `PIPELINE_RELEASE`
--
DROP TABLE IF EXISTS `PIPELINE_RELEASE`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `PIPELINE_RELEASE` (
`PIPELINE_ID` tinyint(4) NOT NULL AUTO_INCREMENT,
`DESCRIPTION` text COLLATE utf8_unicode_ci,
`CHANGES` text COLLATE utf8_unicode_ci NOT NULL,
`RELEASE_VERSION` varchar(20) COLLATE utf8_unicode_ci NOT NULL,
`RELEASE_DATE` date NOT NULL,
PRIMARY KEY (`PIPELINE_ID`),
UNIQUE KEY `PIPELINE_RELEASE_PIPELINE_ID_RELEASE_VERSION_d40fe384_uniq` (`PIPELINE_ID`,`RELEASE_VERSION`),
FULLTEXT KEY `pipeline_description_ts_idx` (`DESCRIPTION`),
FULLTEXT KEY `pipeline_changes_ts_idx` (`CHANGES`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `PIPELINE_RELEASE_TOOL`
--
DROP TABLE IF EXISTS `PIPELINE_RELEASE_TOOL`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `PIPELINE_RELEASE_TOOL` (
`PIPELINE_ID` tinyint(4) NOT NULL,
`TOOL_ID` smallint(6) NOT NULL,
`TOOL_GROUP_ID` decimal(6,3) NOT NULL,
`HOW_TOOL_USED_DESC` longtext COLLATE utf8_unicode_ci,
PRIMARY KEY (`PIPELINE_ID`,`TOOL_ID`),
UNIQUE KEY `pipeline_tool_group_uqidx` (`PIPELINE_ID`,`TOOL_GROUP_ID`),
UNIQUE KEY `PIPELINE_RELEASE_TOOL_PIPELINE_ID_TOOL_ID_8b32b863_uniq` (`PIPELINE_ID`,`TOOL_ID`),
UNIQUE KEY `PIPELINE_RELEASE_TOOL_PIPELINE_ID_TOOL_GROUP_ID_d3d9c1b2_uniq` (`PIPELINE_ID`,`TOOL_GROUP_ID`),
KEY `PIPELINE_RELEASE_TOOL_TOOL_ID_cf450cf4_fk_PIPELINE_TOOL_TOOL_ID` (`TOOL_ID`),
CONSTRAINT `PIPELINE_RELEASE_TOOL_TOOL_ID_cf450cf4_fk_PIPELINE_TOOL_TOOL_ID` FOREIGN KEY (`TOOL_ID`) REFERENCES `PIPELINE_TOOL` (`TOOL_ID`),
CONSTRAINT `PIPELINE_RELEASE_TOO_PIPELINE_ID_2804b066_fk_PIPELINE_` FOREIGN KEY (`PIPELINE_ID`) REFERENCES `PIPELINE_RELEASE` (`PIPELINE_ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `PIPELINE_TOOL`
--
DROP TABLE IF EXISTS `PIPELINE_TOOL`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `PIPELINE_TOOL` (
`TOOL_ID` smallint(6) NOT NULL AUTO_INCREMENT,
`TOOL_NAME` varchar(30) COLLATE utf8_unicode_ci DEFAULT NULL,
`DESCRIPTION` longtext COLLATE utf8_unicode_ci,
`WEB_LINK` varchar(500) COLLATE utf8_unicode_ci DEFAULT NULL,
`VERSION` varchar(30) COLLATE utf8_unicode_ci DEFAULT NULL,
`EXE_COMMAND` varchar(500) COLLATE utf8_unicode_ci DEFAULT NULL,
`INSTALLATION_DIR` varchar(200) COLLATE utf8_unicode_ci DEFAULT NULL,
`CONFIGURATION_FILE` longtext COLLATE utf8_unicode_ci,
`NOTES` text COLLATE utf8_unicode_ci,
PRIMARY KEY (`TOOL_ID`),
UNIQUE KEY `PIPELINE_TOOL_TOOL_NAME_VERSION_97623d54_uniq` (`TOOL_NAME`,`VERSION`)
) ENGINE=InnoDB AUTO_INCREMENT=24 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `PUBLICATION`
--
DROP TABLE IF EXISTS `PUBLICATION`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `PUBLICATION` (
`PUB_ID` int(11) NOT NULL AUTO_INCREMENT,
`AUTHORS` varchar(4000) COLLATE utf8_unicode_ci DEFAULT NULL,
`DOI` varchar(1500) COLLATE utf8_unicode_ci DEFAULT NULL,
`ISBN` varchar(100) CHARACTER SET utf8 DEFAULT NULL,
`ISO_JOURNAL` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`ISSUE` varchar(55) COLLATE utf8_unicode_ci DEFAULT NULL,
`MEDLINE_JOURNAL` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`PUB_ABSTRACT` longtext COLLATE utf8_unicode_ci,
`PUBMED_CENTRAL_ID` int(11) DEFAULT NULL,
`PUBMED_ID` int(11) NOT NULL DEFAULT '0',
`PUB_TITLE` varchar(740) COLLATE utf8_unicode_ci NOT NULL,
`RAW_PAGES` varchar(30) COLLATE utf8_unicode_ci DEFAULT NULL,
`URL` varchar(740) COLLATE utf8_unicode_ci DEFAULT NULL,
`VOLUME` varchar(55) COLLATE utf8_unicode_ci DEFAULT NULL,
`PUBLISHED_YEAR` smallint(6) DEFAULT NULL,
`PUB_TYPE` varchar(150) COLLATE utf8_unicode_ci DEFAULT NULL,
PRIMARY KEY (`PUB_ID`),
FULLTEXT KEY `publication_publication_title_ts_idx` (`PUB_TITLE`),
FULLTEXT KEY `publication_pub_abstract_ts_idx` (`PUB_ABSTRACT`)
) ENGINE=InnoDB AUTO_INCREMENT=560 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `SAMPLE`
--
DROP TABLE IF EXISTS `SAMPLE`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `SAMPLE` (
`SAMPLE_ID` int(11) NOT NULL AUTO_INCREMENT COMMENT 'The unique identifier assigned by a trigger on the database that assignes the next number in the series. This is effectively an EMG accession number, but we have no intention of ever discolsing this to external users.',
`ANALYSIS_COMPLETED` date DEFAULT NULL COMMENT 'This is the date that analysis was (last) completed on. It is the trigger used in the current web-app to display the analysis results page, if this is null there will never be the button on the sample page to be able to show the analsyis results.',
`COLLECTION_DATE` date DEFAULT NULL COMMENT 'The date the sample was collected, this value is now also present in the sample_ann table, and so can be deleted from this table AFTER the web-app has been changed to get the date from the sample_ann table instead.',
`GEO_LOC_NAME` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'The (country) name of the location the sample was collected from, this value is now also present in the sample_ann table, and so can be deleted from this table AFTER the web-app has been changed to get the data from the sample_ann table instead.',
`IS_PUBLIC` tinyint(4) DEFAULT NULL,
`METADATA_RECEIVED` datetime DEFAULT CURRENT_TIMESTAMP,
`SAMPLE_DESC` longtext COLLATE utf8_unicode_ci,
`SEQUENCEDATA_ARCHIVED` datetime DEFAULT NULL,
`SEQUENCEDATA_RECEIVED` datetime DEFAULT NULL,
`ENVIRONMENT_BIOME` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`ENVIRONMENT_FEATURE` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`ENVIRONMENT_MATERIAL` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`STUDY_ID` int(11) DEFAULT NULL,
`SAMPLE_NAME` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`SAMPLE_ALIAS` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`HOST_TAX_ID` int(11) DEFAULT NULL,
`EXT_SAMPLE_ID` varchar(20) COLLATE utf8_unicode_ci NOT NULL,
`SPECIES` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`LATITUDE` decimal(7,4) DEFAULT NULL,
`LONGITUDE` decimal(7,4) DEFAULT NULL,
`LAST_UPDATE` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`SUBMISSION_ACCOUNT_ID` varchar(15) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Defines which users do have permission to access that sample/study. It is a reference to ERAPRO''s submission_account table',
`BIOME_ID` smallint(6) DEFAULT NULL,
PRIMARY KEY (`SAMPLE_ID`),
UNIQUE KEY `SAMPLE_SAMPLE_ID_EXT_SAMPLE_ID_cb53919e_uniq` (`SAMPLE_ID`,`EXT_SAMPLE_ID`),
KEY `SAMPLE_BIOME_ID_b2075860_fk_BIOME_HIERARCHY_TREE_BIOME_ID` (`BIOME_ID`),
KEY `SAMPLE_STUDY_ID_4a1200e5_fk_STUDY_STUDY_ID` (`STUDY_ID`),
FULLTEXT KEY `sample_sample_name_ts_idx` (`SAMPLE_NAME`),
FULLTEXT KEY `sample_sample_desc_ts_idx` (`SAMPLE_DESC`),
CONSTRAINT `SAMPLE_BIOME_ID_b2075860_fk_BIOME_HIERARCHY_TREE_BIOME_ID` FOREIGN KEY (`BIOME_ID`) REFERENCES `BIOME_HIERARCHY_TREE` (`BIOME_ID`),
CONSTRAINT `SAMPLE_STUDY_ID_4a1200e5_fk_STUDY_STUDY_ID` FOREIGN KEY (`STUDY_ID`) REFERENCES `STUDY` (`STUDY_ID`)
) ENGINE=InnoDB AUTO_INCREMENT=104956 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `SAMPLE_ANN`
--
DROP TABLE IF EXISTS `SAMPLE_ANN`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `SAMPLE_ANN` (
`SAMPLE_ID` int(11) NOT NULL COMMENT 'Internal sample ID from SAMPLE table',
`VAR_VAL_CV` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'The value of the variable defined in VAR_ID where that variable must use a controlled vocabulary, this value must be in GSC_CV_CV',
`UNITS` varchar(25) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'The UNITS of the value given in VAR_VAL_UCV',
`VAR_ID` smallint(6) NOT NULL COMMENT 'The variable ID from the VARIABLE_NAMES table',
`VAR_VAL_UCV` varchar(4000) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'The value for the varible defined by VAR_ID',
PRIMARY KEY (`SAMPLE_ID`,`VAR_ID`),
UNIQUE KEY `SAMPLE_ANN_PK` (`SAMPLE_ID`,`VAR_ID`),
UNIQUE KEY `SAMPLE_ANN_SAMPLE_ID_VAR_ID_934ec87c_uniq` (`SAMPLE_ID`,`VAR_ID`),
KEY `VAR_ID` (`VAR_ID`),
KEY `VAR_VAL_CV` (`VAR_VAL_CV`),
FULLTEXT KEY `sample_ann_var_val_ucv_ts_idx` (`VAR_VAL_UCV`),
CONSTRAINT `SAMPLE_ANN_ibfk_1` FOREIGN KEY (`VAR_ID`) REFERENCES `VARIABLE_NAMES` (`VAR_ID`),
CONSTRAINT `SAMPLE_ANN_ibfk_2` FOREIGN KEY (`SAMPLE_ID`) REFERENCES `SAMPLE` (`SAMPLE_ID`),
CONSTRAINT `SAMPLE_ANN_ibfk_3` FOREIGN KEY (`VAR_VAL_CV`) REFERENCES `GSC_CV_CV` (`VAR_VAL_CV`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `SAMPLE_PUBLICATION`
--
DROP TABLE IF EXISTS `SAMPLE_PUBLICATION`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `SAMPLE_PUBLICATION` (
`SAMPLE_ID` int(11) NOT NULL COMMENT 'sample_id from the sample table, of the sample associated with this publication',
`PUB_ID` int(11) NOT NULL COMMENT 'publication ID from publication table',
PRIMARY KEY (`SAMPLE_ID`,`PUB_ID`),
UNIQUE KEY `SAMPLE_PUBLICATION_SAMPLE_ID_PUB_ID_8167fbc0_uniq` (`SAMPLE_ID`,`PUB_ID`),
KEY `SAMPLE_PUBLICATION_PUB_ID_70cffbdb_fk_PUBLICATION_PUB_ID` (`PUB_ID`),
CONSTRAINT `SAMPLE_PUBLICATION_PUB_ID_70cffbdb_fk_PUBLICATION_PUB_ID` FOREIGN KEY (`PUB_ID`) REFERENCES `PUBLICATION` (`PUB_ID`),
CONSTRAINT `SAMPLE_PUBLICATION_SAMPLE_ID_aef56607_fk_SAMPLE_SAMPLE_ID` FOREIGN KEY (`SAMPLE_ID`) REFERENCES `SAMPLE` (`SAMPLE_ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `STUDY`
--
DROP TABLE IF EXISTS `STUDY`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `STUDY` (
`STUDY_ID` int(11) NOT NULL AUTO_INCREMENT,
`CENTRE_NAME` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'The center_name used by SRA, it must be in the SRA schema, table CV_CENTER_NAME, which also should contain the description of that acronym (but doesn''t always!)',
`EXPERIMENTAL_FACTOR` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'This is metadata about the study, its to give an easy look up for time series studies or things where the study wass designed to test a particular variable, e.g. time, depth, disease etc...',
`IS_PUBLIC` tinyint(4) DEFAULT NULL COMMENT '1 for public, 0 for private (As of Aug2012 this is set manually in both Production and Web databases)',
`PUBLIC_RELEASE_DATE` date DEFAULT NULL COMMENT 'The date originally specified by the submitter of when their data should be released to public, can be changed by submitter in SRA and we should sync with SRA.',
`STUDY_ABSTRACT` longtext COLLATE utf8_unicode_ci COMMENT 'The submitter provided description of the project/study.',
`EXT_STUDY_ID` varchar(20) COLLATE utf8_unicode_ci NOT NULL,
`STUDY_NAME` varchar(300) COLLATE utf8_unicode_ci DEFAULT NULL,
`STUDY_STATUS` varchar(30) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'not used, should be deprecated',
`DATA_ORIGINATION` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Where did the data come from, this could be HARVESTED for stuff taken from SRA, or SUBMITTED for stuff that is brokered to SRA through EMG',
`AUTHOR_EMAIL` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Email address of contact person for study, WILL be shown publicly on Study page',
`AUTHOR_NAME` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Name of contact person for study, WILL be shown publicly on Study page',
`LAST_UPDATE` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'The date any update was made to the row, this is auto-updated in PROD by a trigger, but not in any others (e.g. web, test or dev)',
`SUBMISSION_ACCOUNT_ID` varchar(15) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Defines which users do have permission to access that sample/study. It is a reference to ERAPRO''s submission_account table',
`BIOME_ID` smallint(6) DEFAULT NULL COMMENT 'Links to an entry in the biome hierarchy table, which is a controlled vocabulary.',
`RESULT_DIRECTORY` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Path to the results directory for this study',
`FIRST_CREATED` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'The date when the study has been created in EMG for the first time. Usually happens when a new study is loaded from ENA into EMG using the webuploader tool.',
`PROJECT_ID` varchar(18) COLLATE utf8_unicode_ci DEFAULT NULL,
PRIMARY KEY (`STUDY_ID`),
UNIQUE KEY `STUDY_EXT_STUDY_ID_f6f37592_uniq` (`EXT_STUDY_ID`),
UNIQUE KEY `STUDY_STUDY_ID_EXT_STUDY_ID_57cd9758_uniq` (`STUDY_ID`,`EXT_STUDY_ID`),
KEY `STUDY_BIOME_ID_IDX` (`BIOME_ID`),
FULLTEXT KEY `study_study_name_ts_idx` (`STUDY_NAME`),
FULLTEXT KEY `study_study_abstract_ts_idx` (`STUDY_ABSTRACT`),
CONSTRAINT `STUDY_BIOME_ID_232e46ec_fk_BIOME_HIERARCHY_TREE_BIOME_ID` FOREIGN KEY (`BIOME_ID`) REFERENCES `BIOME_HIERARCHY_TREE` (`BIOME_ID`)
) ENGINE=InnoDB AUTO_INCREMENT=1973 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `STUDY_ERROR_TYPE`
--
DROP TABLE IF EXISTS `STUDY_ERROR_TYPE`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `STUDY_ERROR_TYPE` (
`ERROR_ID` tinyint(4) NOT NULL DEFAULT '0' COMMENT 'Primary key.',
`ERROR_TYPE` varchar(50) COLLATE utf8_unicode_ci NOT NULL COMMENT 'Represents the name of the issue.',
`DESCRIPTION` text COLLATE utf8_unicode_ci NOT NULL COMMENT 'Describes the issue.',
PRIMARY KEY (`ERROR_ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `STUDY_PUBLICATION`
--
DROP TABLE IF EXISTS `STUDY_PUBLICATION`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `STUDY_PUBLICATION` (
`STUDY_ID` int(11) NOT NULL COMMENT 'the study id of the study with this publication',
`PUB_ID` int(11) NOT NULL COMMENT 'publication ID from the publication table',
PRIMARY KEY (`STUDY_ID`,`PUB_ID`),
UNIQUE KEY `STUDY_PUBLICATION_STUDY_ID_PUB_ID_25f2b6f8_uniq` (`STUDY_ID`,`PUB_ID`),
KEY `STUDY_PUBLICATION_PUB_ID_7876a21d_fk_PUBLICATION_PUB_ID` (`PUB_ID`),
CONSTRAINT `STUDY_PUBLICATION_PUB_ID_7876a21d_fk_PUBLICATION_PUB_ID` FOREIGN KEY (`PUB_ID`) REFERENCES `PUBLICATION` (`PUB_ID`),
CONSTRAINT `STUDY_PUBLICATION_STUDY_ID_f1ddea67_fk_STUDY_STUDY_ID` FOREIGN KEY (`STUDY_ID`) REFERENCES `STUDY` (`STUDY_ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `SUMMARY_VARIABLE_NAMES`
--
DROP TABLE IF EXISTS `SUMMARY_VARIABLE_NAMES`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `SUMMARY_VARIABLE_NAMES` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`VAR_NAME` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`DESCRIPTION` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `VAR_NAME` (`VAR_NAME`),
UNIQUE KEY `SUMMARY_VARIABLE_NAMES_VAR_NAME_DESCRIPTION_9476338b_uniq` (`VAR_NAME`,`DESCRIPTION`)
) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `VARIABLE_NAMES`
--
DROP TABLE IF EXISTS `VARIABLE_NAMES`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `VARIABLE_NAMES` (
`VAR_ID` smallint(6) NOT NULL AUTO_INCREMENT COMMENT ' variable identifier, unique sequenctial number auto generated',
`VAR_NAME` varchar(50) COLLATE utf8_unicode_ci NOT NULL COMMENT 'Unique human readable name as given by GSC (or other authority)',
`DEFINITION` longtext COLLATE utf8_unicode_ci COMMENT 'Definition of variable, as given by GSC (or other authority)',
`VALUE_SYNTAX` varchar(250) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'how the GSC (or other authority) has defined the value for the term should be given',
`ALIAS` varchar(30) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Short name, or INSDC name given by GSC, should be less than 20char and contain no spaces',
`AUTHORITY` varchar(30) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'person or organisation that created/defined the variable (usualy GSC)',
`SRA_XML_ATTRIBUTE` varchar(30) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Where the ATTRIBUTE should be in the SRA XML schema, (NB currently (Aug2012) almost everything goes in SRA.SAMPLE which is technically wrong!)',
`REQUIRED_FOR_MIMARKS_COMPLIANC` varchar(1) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'If a value for the variable is required for GSC MIMARKS compliance (as of Aug2012)',
`REQUIRED_FOR_MIMS_COMPLIANCE` varchar(1) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Is a value required for GSC MIMS compliance (as of Aug 2012)',
`GSC_ENV_PACKAGES` varchar(250) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'which (if any) of the GSC environmental packages is this variable part of',
`COMMENTS` varchar(250) COLLATE utf8_unicode_ci DEFAULT NULL,
PRIMARY KEY (`VAR_ID`,`VAR_NAME`),
UNIQUE KEY `VAR_NAME` (`VAR_NAME`),
UNIQUE KEY `VAR_ID` (`VAR_ID`),
UNIQUE KEY `VARIABLE_NAMES_PK` (`VAR_ID`,`VAR_NAME`),
UNIQUE KEY `VARIABLE_NAMES_VAR_ID_VAR_NAME_e353e1f1_uniq` (`VAR_ID`,`VAR_NAME`)
) ENGINE=InnoDB AUTO_INCREMENT=938 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `auth_group`
--
DROP TABLE IF EXISTS `auth_group`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `auth_group` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(80) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `auth_group_permissions`
--
DROP TABLE IF EXISTS `auth_group_permissions`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `auth_group_permissions` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`group_id` int(11) NOT NULL,
`permission_id` int(11) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `auth_group_permissions_group_id_permission_id_0cd325b0_uniq` (`group_id`,`permission_id`),
KEY `auth_group_permissio_permission_id_84c5c92e_fk_auth_perm` (`permission_id`),
CONSTRAINT `auth_group_permissio_permission_id_84c5c92e_fk_auth_perm` FOREIGN KEY (`permission_id`) REFERENCES `auth_permission` (`id`),
CONSTRAINT `auth_group_permissions_group_id_b120cbf9_fk_auth_group_id` FOREIGN KEY (`group_id`) REFERENCES `auth_group` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `auth_permission`
--
DROP TABLE IF EXISTS `auth_permission`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `auth_permission` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`content_type_id` int(11) NOT NULL,
`codename` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `auth_permission_content_type_id_codename_01ab375a_uniq` (`content_type_id`,`codename`),
CONSTRAINT `auth_permission_content_type_id_2f476e4b_fk_django_co` FOREIGN KEY (`content_type_id`) REFERENCES `django_content_type` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=82 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `auth_user`
--
DROP TABLE IF EXISTS `auth_user`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `auth_user` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`password` varchar(128) COLLATE utf8_unicode_ci NOT NULL,
`last_login` datetime(6) DEFAULT NULL,
`is_superuser` tinyint(1) NOT NULL,
`username` varchar(150) COLLATE utf8_unicode_ci NOT NULL,
`first_name` varchar(30) COLLATE utf8_unicode_ci NOT NULL,
`last_name` varchar(30) COLLATE utf8_unicode_ci NOT NULL,
`email` varchar(254) COLLATE utf8_unicode_ci NOT NULL,
`is_staff` tinyint(1) NOT NULL,
`is_active` tinyint(1) NOT NULL,
`date_joined` datetime(6) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `username` (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `auth_user_groups`
--
DROP TABLE IF EXISTS `auth_user_groups`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `auth_user_groups` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`group_id` int(11) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `auth_user_groups_user_id_group_id_94350c0c_uniq` (`user_id`,`group_id`),
KEY `auth_user_groups_group_id_97559544_fk_auth_group_id` (`group_id`),
CONSTRAINT `auth_user_groups_group_id_97559544_fk_auth_group_id` FOREIGN KEY (`group_id`) REFERENCES `auth_group` (`id`),
CONSTRAINT `auth_user_groups_user_id_6a12ed8b_fk_auth_user_id` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `auth_user_user_permissions`
--
DROP TABLE IF EXISTS `auth_user_user_permissions`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `auth_user_user_permissions` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`permission_id` int(11) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `auth_user_user_permissions_user_id_permission_id_14a6b632_uniq` (`user_id`,`permission_id`),
KEY `auth_user_user_permi_permission_id_1fbb5f2c_fk_auth_perm` (`permission_id`),
CONSTRAINT `auth_user_user_permi_permission_id_1fbb5f2c_fk_auth_perm` FOREIGN KEY (`permission_id`) REFERENCES `auth_permission` (`id`),
CONSTRAINT `auth_user_user_permissions_user_id_a95ead1b_fk_auth_user_id` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `authtoken_token`
--
DROP TABLE IF EXISTS `authtoken_token`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `authtoken_token` (
`key` varchar(40) COLLATE utf8_unicode_ci NOT NULL,
`created` datetime(6) NOT NULL,
`user_id` int(11) NOT NULL,
PRIMARY KEY (`key`),
UNIQUE KEY `user_id` (`user_id`),
CONSTRAINT `authtoken_token_user_id_35299eff_fk_auth_user_id` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `django_content_type`
--
DROP TABLE IF EXISTS `django_content_type`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `django_content_type` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`app_label` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`model` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `django_content_type_app_label_model_76bd3d3b_uniq` (`app_label`,`model`)
) ENGINE=InnoDB AUTO_INCREMENT=28 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `django_migrations`
--
DROP TABLE IF EXISTS `django_migrations`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `django_migrations` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`app` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`applied` datetime(6) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=18 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `django_session`
--
DROP TABLE IF EXISTS `django_session`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `django_session` (
`session_key` varchar(40) COLLATE utf8_unicode_ci NOT NULL,
`session_data` longtext COLLATE utf8_unicode_ci NOT NULL,
`expire_date` datetime(6) NOT NULL,
PRIMARY KEY (`session_key`),
KEY `django_session_expire_date_a5c62663` (`expire_date`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!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-10-12 14:22:13
|
insert into role values(1,"ROLE_ADMIN");
insert into role values(2,"ROLE_CUSTOMER");
insert into role values(3,"ROLE_FACULTY");
insert into user values("admin",1,"admin");
insert into user_role values("admin",1);
insert into admin values(1,"FairField","IOWA","1000 N 4th Street","52557",
NULL,"admin@yogastudio.com","admin","01-707712987","admin"); |
-- This file should undo anything in `up.sql`
DROP TABLE IF EXISTS word_entry_tags;
DROP TABLE IF EXISTS word_entry_notes; |
create proc sp_put_PRHeader
( @VendorID nvarchar(15), @BillID int , @AdjustmentDate datetime, @DocumentID int, @ForumId nvarchar(50), @Value Decimal(18,6), @Balance Decimal(18,6), @Status int)
as
INSERT INTO AdjustmentReturnAbstract_Received
( VendorID, BillID, AdjustmentDate, DocumentID, ForumId, Value, Balance, Status )
VALUES
( @VendorID, @BillID, @AdjustmentDate, @DocumentID, @ForumId, @Value, @Balance, @Status)
SELECT @@IDENTITY
|
/*PROC LOGIN*/
DELIMITER ;;
CREATE PROCEDURE IF NOT EXISTS usp_login(
IN username varchar(20),
IN password varchar(50)
)
BEGIN
SELECT cliente_id, cliente_tipo, cliente_username, cliente_nome, cliente_apelido, cliente_datanasc, cliente_morada, cliente_codigopostal, cliente_idpais, cliente_nif, cliente_tele, cliente_email, cliente_img_path
FROM cliente WHERE cliente_username like username AND cliente_password like password;
END;;
/*PROC REGISTO CLIENTE*/
DELIMITER ;;
CREATE PROCEDURE IF NOT EXISTS usp_register_user(
IN username varchar(20),
IN password varchar(50),
IN nome varchar(20),
IN apelido varchar(20),
IN datanasc date,
IN morada varchar(100),
IN codigopostal varchar(11),
IN idpais int,
IN nif int,
IN tele int,
IN email varchar(100),
IN img varchar(10000)
)
BEGIN
INSERT INTO cliente (cliente_username,cliente_password,cliente_nome,cliente_apelido,cliente_datanasc,cliente_morada,cliente_codigopostal,cliente_idpais,cliente_nif,cliente_tele,cliente_email,cliente_tipo,cliente_img_path)
VALUES (username,password,nome,apelido,datanasc,morada,codigopostal,idpais,nif,tele,email,0,img);
END;;
/*PROC REGISTO ADMIn*/
DELIMITER ;;
CREATE PROCEDURE IF NOT EXISTS usp_register_admin(
IN username varchar(20),
IN password varchar(50),
IN nome varchar(20),
IN apelido varchar(20),
IN datanasc date,
IN morada varchar(100),
IN codigopostal varchar(11),
IN idpais int,
IN nif int,
IN tele int,
IN email varchar(100),
IN img varchar(10000)
)
BEGIN
INSERT INTO cliente (cliente_username,cliente_password,cliente_nome,cliente_apelido,cliente_datanasc,cliente_morada,cliente_codigopostal,cliente_idpais,cliente_nif,cliente_tele,cliente_email,cliente_tipo,cliente_img_path)
VALUES (username,password,nome,apelido,datanasc,morada,codigopostal,idpais,nif,tele,email,1,img);
END;;
/*PROC EDITAR TB Cliente*/
DELIMITER ;;
CREATE PROCEDURE IF NOT EXISTS usp_edit_cliente(
IN id int,
IN password varchar(50),
IN nome varchar(20),
IN apelido varchar(20),
IN datanasc date,
IN morada varchar(100),
IN codigopostal varchar(11),
IN idpais int,
IN nif int,
IN tele int,
IN email varchar(100)
)
BEGIN
UPDATE cliente SET
cliente_password = password,
cliente_nome = nome,
cliente_apelido = apelido,
cliente_datanasc = datanasc,
cliente_morada = morada,
cliente_codigopostal = codigopostal,
cliente_idpais = idpais,
cliente_nif = nif,
cliente_tele = tele,
cliente_email = email
WHERE cliente_id = id;
END;;
|
#TRIGGERS
drop trigger if exists upd_rnccn_utrancell_h;
delimiter //
create trigger upd_rnccn_utrancell_h before insert on RNCCN_UTRANCELL_H
for each row
begin
set NEW.CI = getCellId_Cell(NEW.UtranCell);
set NEW.LAC = getLocationCode_Cell(NEW.UtranCell);
set NEW.NodeBName = getNodeBfromCell(NEW.CI,NEW.LAC);
end;
//
delimiter ;
drop trigger if exists upd_rnccn_utrancell_a1_h;
delimiter //
create trigger upd_rnccn_utrancell_a1_h before insert on RNCCN_UTRANCELL_A1_H
for each row
begin
set NEW.CI = getCellId_Cell(NEW.UtranCell);
set NEW.LAC = getLocationCode_Cell(NEW.UtranCell);
set NEW.NodeBName = getNodeBfromCell(NEW.CI,NEW.LAC);
end;
//
delimiter ;
drop trigger if exists upd_rnccn_utrancell_a2_h;
delimiter //
create trigger upd_rnccn_utrancell_a2_h before insert on RNCCN_UTRANCELL_A2_H
for each row
begin
set NEW.CI = getCellId_Cell(NEW.UtranCell);
set NEW.LAC = getLocationCode_Cell(NEW.UtranCell);
set NEW.NodeBName = getNodeBfromCell(NEW.CI,NEW.LAC);
end
//
delimiter ;
drop trigger if exists upd_rnccn_utrancell_a3_h;
delimiter //
create trigger upd_rnccn_utrancell_a3_h before insert on RNCCN_UTRANCELL_A3_H
for each row
begin
set NEW.CI = getCellId_Cell(NEW.UtranCell);
set NEW.LAC = getLocationCode_Cell(NEW.UtranCell);
set NEW.NodeBName = getNodeBfromCell(NEW.CI,NEW.LAC);
end
//
delimiter ;
drop trigger if exists upd_rnccn_utrancell_a4_h;
delimiter //
create trigger upd_rnccn_utrancell_a4_h before insert on RNCCN_UTRANCELL_A4_H
for each row
begin
set NEW.CI = getCellId_Cell(NEW.UtranCell);
set NEW.LAC = getLocationCode_Cell(NEW.UtranCell);
set NEW.NodeBName = getNodeBfromCell(NEW.CI,NEW.LAC);
end
//
delimiter ;
drop trigger if exists upd_rnccn_utrancell_a5_h;
delimiter //
create trigger upd_rnccn_utrancell_a5_h before insert on RNCCN_UTRANCELL_A5_H
for each row
begin
set NEW.CI = getCellId_Cell(NEW.UtranCell);
set NEW.LAC = getLocationCode_Cell(NEW.UtranCell);
set NEW.NodeBName = getNodeBfromCell(NEW.CI,NEW.LAC);
end
//
delimiter ;
drop trigger if exists upd_rnccn_utrancell_d;
delimiter //
create trigger upd_rnccn_utrancell_d before insert on RNCCN_UTRANCELL_D
for each row
begin
set NEW.CI = getCellId_Cell(NEW.UtranCell);
set NEW.LAC = getLocationCode_Cell(NEW.UtranCell);
set NEW.NodeBName = getNodeBfromCell(NEW.CI,NEW.LAC);
set NEW.GRANULARITY = '86400';
end
//
delimiter ;
drop trigger if exists upd_rnccn_utrancell_a1_d;
delimiter //
create trigger upd_rnccn_utrancell_a1_d before insert on RNCCN_UTRANCELL_A1_D
for each row
begin
set NEW.CI = getCellId_Cell(NEW.UtranCell);
set NEW.LAC = getLocationCode_Cell(NEW.UtranCell);
set NEW.NodeBName = getNodeBfromCell(NEW.CI,NEW.LAC);
set NEW.GRANULARITY = '86400';
end
//
delimiter ;
drop trigger if exists upd_rnccn_utrancell_a2_d;
delimiter //
create trigger upd_rnccn_utrancell_a2_d before insert on RNCCN_UTRANCELL_A2_D
for each row
begin
set NEW.CI = getCellId_Cell(NEW.UtranCell);
set NEW.LAC = getLocationCode_Cell(NEW.UtranCell);
set NEW.NodeBName = getNodeBfromCell(NEW.CI,NEW.LAC);
set NEW.GRANULARITY = '86400';
end
//
delimiter ;
drop trigger if exists upd_rnccn_utrancell_a3_d;
delimiter //
create trigger upd_rnccn_utrancell_a3_d before insert on RNCCN_UTRANCELL_A3_D
for each row
begin
set NEW.CI = getCellId_Cell(NEW.UtranCell);
set NEW.LAC = getLocationCode_Cell(NEW.UtranCell);
set NEW.NodeBName = getNodeBfromCell(NEW.CI,NEW.LAC);
set NEW.GRANULARITY = '86400';
end
//
delimiter ;
drop trigger if exists upd_rnccn_utrancell_a4_d;
delimiter //
create trigger upd_rnccn_utrancell_a4_d before insert on RNCCN_UTRANCELL_A4_D
for each row
begin
set NEW.CI = getCellId_Cell(NEW.UtranCell);
set NEW.LAC = getLocationCode_Cell(NEW.UtranCell);
set NEW.NodeBName = getNodeBfromCell(NEW.CI,NEW.LAC);
set NEW.GRANULARITY = '86400';
end
//
delimiter ;
drop trigger if exists upd_rnccn_utrancell_a5_d;
delimiter //
create trigger upd_rnccn_utrancell_a5_d before insert on RNCCN_UTRANCELL_A5_D
for each row
begin
set NEW.CI = getCellId_Cell(NEW.UtranCell);
set NEW.LAC = getLocationCode_Cell(NEW.UtranCell);
set NEW.NodeBName = getNodeBfromCell(NEW.CI,NEW.LAC);
set NEW.GRANULARITY = '86400';
end
//
delimiter ;
drop trigger if exists upd_rnccn_tmu_d;
delimiter //
create trigger upd_rnccn_tmu_d before insert on RNCCN_TMU_D
for each row
begin
set NEW.GRANULARITY = '86400';
end;
//
delimiter ;
drop trigger if exists upd_rnccn_neighbouringrnc_d;
delimiter //
create trigger upd_rnccn_neighbouringrnc_d before insert on RNCCN_NEIGHBOURINGRNC_D
for each row
begin
set NEW.GRANULARITY = '86400';
end;
//
delimiter ;
drop trigger if exists upd_rnccn_neighbouringrnc_a1_d;
delimiter //
create trigger upd_rnccn_neighbouringrnc_a1_d before insert on RNCCN_NEIGHBOURINGRNC_A1_D
for each row
begin
set NEW.GRANULARITY = '86400';
end;
//
delimiter ;
drop trigger if exists upd_rnccn_neighbouringrnc_a2_d;
delimiter //
create trigger upd_rnccn_neighbouringrnc_a2_d before insert on RNCCN_NEIGHBOURINGRNC_A2_D
for each row
begin
set NEW.GRANULARITY = '86400';
end;
//
delimiter ;
drop trigger if exists upd_rnccn_iubifaal2_d;
delimiter //
create trigger upd_rnccn_iubifaal2_d before insert on RNCCN_IUBIFAAL2_D
for each row
begin
set NEW.GRANULARITY = '86400';
end;
//
delimiter ;
drop trigger if exists upd_rnccn_function_d;
delimiter //
create trigger upd_rnccn_function_d before insert on RNCCN_RNCFUNCTION_D
for each row
begin
set NEW.GRANULARITY = '86400';
end;
//
delimiter ;
drop trigger if exists upd_rnccn_function_a1_d;
delimiter //
create trigger upd_rnccn_function_a1_d before insert on RNCCN_RNCFUNCTION_A1_D
for each row
begin
set NEW.GRANULARITY = '86400';
end;
//
delimiter ;
drop trigger if exists upd_rnccn_function_a2_d;
delimiter //
create trigger upd_rnccn_function_a2_d before insert on RNCCN_RNCFUNCTION_A2_D
for each row
begin
set NEW.GRANULARITY = '86400';
end;
//
delimiter ;
drop trigger if exists upd_nodeb_btscell_h;
delimiter //
create trigger upd_nodeb_btscell_h before insert on NODEB_BTSCELL_H
for each row
begin
set NEW.CI = getCellId(NEW.NAME,NEW.BtsCell);
set NEW.LAC = getLocationCode(NEW.NAME,NEW.BtsCell);
set NEW.RncName = getRncfromNodeB(NEW.NAME);
end;
//
delimiter ;
drop trigger if exists upd_nodeb_btscell_d;
delimiter //
create trigger upd_nodeb_btscell_d before insert on NODEB_BTSCELL_D
for each row
begin
set NEW.CI = getCellId(NEW.NAME,NEW.BtsCell);
set NEW.LAC = getLocationCode(NEW.NAME,NEW.BtsCell);
set NEW.RncName = getRncfromNodeB(NEW.NAME);
set NEW.GRANULARITY = '86400';
end;
//
delimiter ;
drop trigger if exists upd_nodeb_hsservice_h;
delimiter //
create trigger upd_nodeb_hsservice_h before insert on NODEB_HSDPASERVICE_H
for each row
begin
set NEW.CI = getCellId(NEW.NAME,NEW.BtsCell);
set NEW.LAC = getLocationCode(NEW.NAME,NEW.BtsCell);
set NEW.RncName = getRncfromNodeB(NEW.NAME);
end;
//
delimiter ;
drop trigger if exists upd_nodeb_hsservice_a1_h;
delimiter //
create trigger upd_nodeb_hsservice_a1_h before insert on NODEB_HSDPASERVICE_A1_H
for each row
begin
set NEW.CI = getCellId(NEW.NAME,NEW.BtsCell);
set NEW.LAC = getLocationCode(NEW.NAME,NEW.BtsCell);
set NEW.RncName = getRncfromNodeB(NEW.NAME);
end;
//
delimiter ;
drop trigger if exists upd_nodeb_hsservice_d;
delimiter //
create trigger upd_nodeb_hsservice_d before insert on NODEB_HSDPASERVICE_D
for each row
begin
set NEW.CI = getCellId(NEW.NAME,NEW.BtsCell);
set NEW.LAC = getLocationCode(NEW.NAME,NEW.BtsCell);
set NEW.RncName = getRncfromNodeB(NEW.NAME);
set NEW.GRANULARITY = '86400';
end;
//
delimiter ;
drop trigger if exists upd_nodeb_hsservice_a1_d;
delimiter //
create trigger upd_nodeb_hsservice_a1_d before insert on NODEB_HSDPASERVICE_A1_D
for each row
begin
set NEW.CI = getCellId(NEW.NAME,NEW.BtsCell);
set NEW.LAC = getLocationCode(NEW.NAME,NEW.BtsCell);
set NEW.RncName = getRncfromNodeB(NEW.NAME);
set NEW.GRANULARITY = '86400';
end;
//
delimiter ;
drop trigger if exists upd_nodeb_imagroup_h;
delimiter //
create trigger upd_nodeb_imagroup_h before insert on NODEB_IMAGROUP_H
for each row
begin
set NEW.RncName = getRncfromNodeB(NEW.NAME);
end;
//
delimiter ;
drop trigger if exists upd_nodeb_imagroup_d;
delimiter //
create trigger upd_nodeb_imagroup_d before insert on NODEB_IMAGROUP_D
for each row
begin
set NEW.RncName = getRncfromNodeB(NEW.NAME);
set NEW.GRANULARITY = '86400';
end;
//
delimiter ;
drop trigger if exists upd_nodeb_aal2_h;
delimiter //
create trigger upd_nodeb_aal2_h before insert on NODEB_AAL2_H
for each row
begin
set NEW.RncName = getRncfromNodeB(NEW.NAME);
end;
//
delimiter ;
drop trigger if exists upd_nodeb_aal2_d;
delimiter //
create trigger upd_nodeb_aal2_d before insert on NODEB_AAL2_D
for each row
begin
set NEW.RncName = getRncfromNodeB(NEW.NAME);
set NEW.GRANULARITY = '86400';
end;
//
delimiter ;
drop trigger if exists upd_nodeb_aal5_h;
delimiter //
create trigger upd_nodeb_aal5_h before insert on NODEB_AAL5_H
for each row
begin
set NEW.RncName = getRncfromNodeB(NEW.NAME);
end;
//
delimiter ;
drop trigger if exists upd_nodeb_aal5_d;
delimiter //
create trigger upd_nodeb_aal5_d before insert on NODEB_AAL5_D
for each row
begin
set NEW.RncName = getRncfromNodeB(NEW.NAME);
set NEW.GRANULARITY = '86400';
end;
//
delimiter ;
drop trigger if exists upd_nodeb_atm_h;
delimiter //
create trigger upd_nodeb_atm_h before insert on NODEB_ATM_H
for each row
begin
set NEW.RncName = getRncfromNodeB(NEW.NAME);
end;
//
delimiter ;
drop trigger if exists upd_nodeb_atm_d;
delimiter //
create trigger upd_nodeb_atm_d before insert on NODEB_ATM_D
for each row
begin
set NEW.RncName = getRncfromNodeB(NEW.NAME);
set NEW.GRANULARITY = '86400';
end;
//
delimiter ;
drop trigger if exists upd_nodeb_ccm_h;
delimiter //
create trigger upd_nodeb_ccm_h before insert on NODEB_CCM_H
for each row
begin
set NEW.RncName = getRncfromNodeB(NEW.NAME);
end;
//
delimiter ;
drop trigger if exists upd_nodeb_ccm_d;
delimiter //
create trigger upd_nodeb_ccm_d before insert on NODEB_CCM_D
for each row
begin
set NEW.RncName = getRncfromNodeB(NEW.NAME);
set NEW.GRANULARITY = '86400';
end;
//
delimiter ;
drop trigger if exists upd_nodeb_cem_h;
delimiter //
create trigger upd_nodeb_cem_h before insert on NODEB_CEM_H
for each row
begin
set NEW.RncName = getRncfromNodeB(NEW.NAME);
end;
//
delimiter ;
drop trigger if exists upd_nodeb_cem_d;
delimiter //
create trigger upd_nodeb_cem_d before insert on NODEB_CEM_D
for each row
begin
set NEW.RncName = getRncfromNodeB(NEW.NAME);
set NEW.GRANULARITY = '86400';
end;
//
delimiter ;
drop trigger if exists upd_nodeb_hsresource_h;
delimiter //
create trigger upd_nodeb_hsresource_h before insert on NODEB_HSDPARESOURCE_H
for each row
begin
set NEW.RncName = getRncfromNodeB(NEW.NAME);
end;
//
delimiter ;
drop trigger if exists upd_nodeb_hsresource_d;
delimiter //
create trigger upd_nodeb_hsresource_d before insert on NODEB_HSDPARESOURCE_D
for each row
begin
set NEW.RncName = getRncfromNodeB(NEW.NAME);
set NEW.GRANULARITY = '86400';
end;
//
delimiter ;
drop trigger if exists upd_nodeb_ip_h;
delimiter //
create trigger upd_nodeb_ip_h before insert on NODEB_IPINTERFACE_H
for each row
begin
set NEW.RncName = getRncfromNodeB(NEW.NAME);
end;
//
delimiter ;
drop trigger if exists upd_nodeb_ipran_h;
delimiter //
create trigger upd_nodeb_ipran_h before insert on NODEB_IPRAN_H
for each row
begin
set NEW.RncName = getRncfromNodeB(NEW.NAME);
end;
//
delimiter ;
drop trigger if exists upd_nodeb_ipran_d;
delimiter //
create trigger upd_nodeb_ipran_d before insert on NODEB_IPRAN_D
for each row
begin
set NEW.RncName = getRncfromNodeB(NEW.NAME);
set NEW.GRANULARITY = '86400';
end;
//
delimiter ;
drop trigger if exists upd_nodeb_ip_d;
delimiter //
create trigger upd_nodeb_ip_d before insert on NODEB_IPINTERFACE_D
for each row
begin
set NEW.RncName = getRncfromNodeB(NEW.NAME);
set NEW.GRANULARITY = '86400';
end;
//
delimiter ;
drop trigger if exists upd_nodeb_lcellgroup_h;
delimiter //
create trigger upd_nodeb_lcellgroup_h before insert on NODEB_LOCALCELLGROUP_H
for each row
begin
set NEW.RncName = getRncfromNodeB(NEW.NAME);
end;
//
delimiter ;
drop trigger if exists upd_nodeb_lcellgroup_d;
delimiter //
create trigger upd_nodeb_lcellgroup_d before insert on NODEB_LOCALCELLGROUP_D
for each row
begin
set NEW.RncName = getRncfromNodeB(NEW.NAME);
set NEW.GRANULARITY = '86400';
end;
//
delimiter ;
drop trigger if exists upd_nodeb_equip_h;
delimiter //
create trigger upd_nodeb_equip_h before insert on NODEB_NODEBEQUIPMENT_H
for each row
begin
set NEW.RncName = getRncfromNodeB(NEW.NAME);
end;
//
delimiter ;
drop trigger if exists upd_nodeb_equip_d;
delimiter //
create trigger upd_nodeb_equip_d before insert on NODEB_NODEBEQUIPMENT_D
for each row
begin
set NEW.RncName = getRncfromNodeB(NEW.NAME);
set NEW.GRANULARITY = '86400';
end;
//
delimiter ;
drop trigger if exists upd_nodeb_passive_h;
delimiter //
create trigger upd_nodeb_passive_h before insert on NODEB_PASSIVECOMPONENTPA_H
for each row
begin
set NEW.RncName = getRncfromNodeB(NEW.NAME);
end;
//
delimiter ;
drop trigger if exists upd_nodeb_passive_d;
delimiter //
create trigger upd_nodeb_passive_d before insert on NODEB_PASSIVECOMPONENTPA_D
for each row
begin
set NEW.RncName = getRncfromNodeB(NEW.NAME);
set NEW.GRANULARITY = '86400';
end;
//
delimiter ;
drop trigger if exists upd_nodeb_pcm_h;
delimiter //
create trigger upd_nodeb_pcm_h before insert on NODEB_PCMLINK_H
for each row
begin
set NEW.RncName = getRncfromNodeB(NEW.NAME);
end;
//
delimiter ;
drop trigger if exists upd_nodeb_pcm_d;
delimiter //
create trigger upd_nodeb_pcm_d before insert on NODEB_PCMLINK_D
for each row
begin
set NEW.RncName = getRncfromNodeB(NEW.NAME);
set NEW.GRANULARITY = '86400';
end;
//
delimiter ;
drop trigger if exists upd_nodeb_trm_h;
delimiter //
create trigger upd_nodeb_trm_h before insert on NODEB_TRM_H
for each row
begin
set NEW.RncName = getRncfromNodeB(NEW.NAME);
end;
//
delimiter ;
drop trigger if exists upd_nodeb_trm_d;
delimiter //
create trigger upd_nodeb_trm_d before insert on NODEB_TRM_D
for each row
begin
set NEW.RncName = getRncfromNodeB(NEW.NAME);
set NEW.GRANULARITY = '86400';
end;
//
delimiter ;
drop trigger if exists upd_nodeb_rrh_h;
delimiter //
create trigger upd_nodeb_rrh_h before insert on NODEB_RRH_H
for each row
begin
set NEW.RncName = getRncfromNodeB(NEW.NAME);
end;
//
delimiter ;
|
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';
CREATE SCHEMA IF NOT EXISTS `vd_mall` DEFAULT CHARACTER SET utf8;
USE `vd_mall`;
-- -----------------------------------------------------
-- Table `vd_mall`.`users`
-- -----------------------------------------------------
CREATE TABLE `user`(
`id` int(11) NOT NULL AUTO_INCREMENT,
`username` varchar(45) DEFAULT NULL COMMENT '登入用户名',
`password` varchar(64) DEFAULT NULL COMMENT '密码',
`avatar` varchar(500) DEFAULT NULL COMMENT '头像地址',
`nickname` varchar(45) DEFAULT NULL COMMENT '昵称',
`sex` tinyint(1) DEFAULT 0 COMMENT '性别 0-男 1-女',
`enabled` tinyint(1) DEFAULT 1 COMMENT '账号状态 0-禁用 1-启用',
`account_non_expired` tinyint(1) DEFAULT 1 COMMENT '账号过期 0-过期 1-正常',
`account_non_locked` tinyint(1) DEFAULT 1 COMMENT '账号状态 0-锁定 1-正常',
`credentials_non_expired` tinyint(1) DEFAULT NULL COMMENT '凭证过期 0-过期 1-正常',
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
PRIMARY KEY (`id`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8 COMMENT ='用户表';
SET SQL_MODE = @OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS = @OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS = @OLD_UNIQUE_CHECKS; |
-- Select all the employees who were born between January 1, 1952 and December 31, 1955 and their titles and title date ranges
-- Order the results by emp_no
SELECT Distinct titles.title,titles.emp_no,employees.first_name,employees.last_name,titles.from_date,titles.to_date
FROM employees, titles
WHERE birth_date between '1952-01-01' AND '1955-12-31'
ORDER BY emp_no;
-- Select only the current title for each employee
SELECT Distinct titles.title,titles.emp_no,employees.first_name,employees.last_name,titles.from_date,titles.to_date
FROM employees, titles
WHERE to_date = '9999-01-01'
ORDER BY emp_no;
-- Count the total number of employees about to retire by their current job title
SELECT
COUNT (title),title
FROM titles,employees
WHERE birth_date between '1952-01-01' AND '1955-12-31'
GROUP BY title
-- Count the total number of employees per department
SELECT dept_name, COUNT(*)"No of Emp"
FROM departments GROUP BY dept_name;
-- Bonus: Find the highest salary per department and department manager
SELECT departments.dept_name, employees.first_name,employees.last_name, salaries.salary
FROM departments,employees,salaries
WHERE salary IN
(SELECT MAX(salary)AS Highest
FROM salaries
GROUP BY dept_name)
|
CREATE OR REPLACE VIEW V_DTYS13014 AS
SELECT 0 hzbz, 2 rowes, NULL c1, NULL c2,
de042 c3,
pc,
de042,
'000' de084,
(SELECT SUM(n6)
FROM dtys13002 b
WHERE a.de042 = b.de042
AND a.pc = b.pc
GROUP BY de042, pc) n2,
(SELECT SUM(n7)
FROM dtys13002 b
WHERE a.de042 = b.de042
AND a.pc = b.pc
GROUP BY de042, pc) n3,
(SELECT SUM(n9)
FROM dtys13002 b
WHERE a.de042 = b.de042
AND a.pc = b.pc
GROUP BY de042, pc) n4,
(SELECT SUM(n10)
FROM dtys13002 b
WHERE a.de042 = b.de042
AND a.pc = b.pc
GROUP BY de042, pc) n5,
(SELECT SUM(n13)
FROM dtys13002 b
WHERE a.de042 = b.de042
AND a.pc = b.pc
GROUP BY de042, pc) n6,
(SELECT SUM(n14)
FROM dtys13002 b
WHERE a.de042 = b.de042
AND a.pc = b.pc
GROUP BY de042, pc) n7,
(SELECT SUM(n12)
FROM dtys13002 b
WHERE a.de042 = b.de042
AND a.pc = b.pc
GROUP BY de042, pc) n8,
1 bz
FROM dtys13002 a WHERE TRIM(a.de084) IS NOT NULL
GROUP BY de042, pc
UNION
SELECT 0 hzbz, 3 rowes, substr(de084, 1, 3) c1,
substr(de084, 4, 2) c2,
de084 c3,
pc,
de042,
de084,
(SELECT SUM(n6)
FROM dtys13002 b
WHERE a.de042 = b.de042
AND a.pc = b.pc
AND a.de084 = b.de084
GROUP BY de042, de084, pc) n2,
(SELECT SUM(n7)
FROM dtys13002 b
WHERE a.de042 = b.de042
AND a.pc = b.pc
AND a.de084 = b.de084
GROUP BY de042, de084, pc) n3,
(SELECT SUM(n9)
FROM dtys13002 b
WHERE a.de042 = b.de042
AND a.pc = b.pc
AND a.de084 = b.de084
GROUP BY de042, de084, pc) n4,
(SELECT SUM(n10)
FROM dtys13002 b
WHERE a.de042 = b.de042
AND a.pc = b.pc
AND a.de084 = b.de084
GROUP BY de042, de084, pc) n5,
(SELECT SUM(n13)
FROM dtys13002 b
WHERE a.de042 = b.de042
AND a.pc = b.pc
AND a.de084 = b.de084
GROUP BY de042, de084, pc) n6,
(SELECT SUM(n14)
FROM dtys13002 b
WHERE a.de042 = b.de042
AND a.pc = b.pc
AND a.de084 = b.de084
GROUP BY de042, de084, pc) n7,
(SELECT SUM(n12)
FROM dtys13002 b
WHERE a.de042 = b.de042
AND a.pc = b.pc
AND a.de084 = b.de084
GROUP BY de042, de084, pc) n8,
1 bz
FROM dtys13002 a WHERE TRIM(a.de084) IS NOT NULL
GROUP BY de042, de084, pc
UNION
SELECT 0 hzbz, 2 rowes, NULL c1, NULL c2,
de042 c3,
pc,
de042,
'000' de084,
(SELECT SUM(n6)
FROM dtys13002s b
WHERE a.de042 = b.de042
AND a.pc = b.pc
GROUP BY de042, pc) n2,
(SELECT SUM(n7)
FROM dtys13002s b
WHERE a.de042 = b.de042
AND a.pc = b.pc
GROUP BY de042, pc) n3,
(SELECT SUM(n9)
FROM dtys13002s b
WHERE a.de042 = b.de042
AND a.pc = b.pc
GROUP BY de042, pc) n4,
(SELECT SUM(n10)
FROM dtys13002s b
WHERE a.de042 = b.de042
AND a.pc = b.pc
GROUP BY de042, pc) n5,
(SELECT SUM(n13)
FROM dtys13002s b
WHERE a.de042 = b.de042
AND a.pc = b.pc
GROUP BY de042, pc) n6,
(SELECT SUM(n14)
FROM dtys13002s b
WHERE a.de042 = b.de042
AND a.pc = b.pc
GROUP BY de042, pc) n7,
(SELECT SUM(n12)
FROM dtys13002s b
WHERE a.de042 = b.de042
AND a.pc = b.pc
GROUP BY de042, pc) n8,
1 bz
FROM dtys13002s a WHERE TRIM(a.de084) IS NOT NULL
GROUP BY de042, pc
UNION
SELECT 0 hzbz, 3 rowes, substr(de084, 1, 3) c1,
substr(de084, 4, 2) c2,
de084 c3,
pc,
de042,
de084,
(SELECT SUM(n6)
FROM dtys13002s b
WHERE a.de042 = b.de042
AND a.pc = b.pc
AND a.de084 = b.de084
GROUP BY de042, de084, pc) n2,
(SELECT SUM(n7)
FROM dtys13002s b
WHERE a.de042 = b.de042
AND a.pc = b.pc
AND a.de084 = b.de084
GROUP BY de042, de084, pc) n3,
(SELECT SUM(n9)
FROM dtys13002s b
WHERE a.de042 = b.de042
AND a.pc = b.pc
AND a.de084 = b.de084
GROUP BY de042, de084, pc) n4,
(SELECT SUM(n10)
FROM dtys13002s b
WHERE a.de042 = b.de042
AND a.pc = b.pc
AND a.de084 = b.de084
GROUP BY de042, de084, pc) n5,
(SELECT SUM(n13)
FROM dtys13002s b
WHERE a.de042 = b.de042
AND a.pc = b.pc
AND a.de084 = b.de084
GROUP BY de042, de084, pc) n6,
(SELECT SUM(n14)
FROM dtys13002s b
WHERE a.de042 = b.de042
AND a.pc = b.pc
AND a.de084 = b.de084
GROUP BY de042, de084, pc) n7,
(SELECT SUM(n12)
FROM dtys13002s b
WHERE a.de042 = b.de042
AND a.pc = b.pc
AND a.de084 = b.de084
GROUP BY de042, de084, pc) n8,
0 bz
FROM dtys13002s a WHERE TRIM(a.de084) IS NOT NULL
GROUP BY de042, de084, pc
ORDER BY bz, pc, de042, rowes, de084
--;
|
alter table weibos add COLUMN deleted INTEGER NOT NULL DEFAULT 0;
|
ALTER PROCEDURE SP_ALMACENAMIENTO_VALIDA_POSICION_EXIST
@POSICION VARCHAR(100),
@BOD_CODIGO VARCHAR(10),
@EMP_CODIGO INT
AS
BEGIN
-- CREADO POR <max.llaupi@espol.cl>
-- VERSIÓN 21 - 04 - 2017
-- CONSULTAMOS SI EL POSICION INGRESADO TIENE PRODUCTOS ASOCIADOS A LA BODEGA Y EMPRESA ACTUAL
SELECT
layz_codigo,
unit_codigo
FROM layout
WHERE lay_posicion = @POSICION
AND bod_codigo = @BOD_CODIGO
AND emp_codigo = @EMP_CODIGO
AND lay_estado = 1
END |
-- ex03_select.sql
/*
select 문
- DML, DQL
- 사용 빈도가 가장 높다.
- 목적: 데이터베이스로부터 원하는 데이터를 가져오는 명령어(읽기)
select 컬럼리스트 from 테이블명 where 검색조건
- 자세한 내용: google 검색 > sql 11g select documentation
a. select 컬럼리스트
b. from 테이블명
c. where 검색조건
문장을 구성하는 각 절들은 실행 순서가 이미 정해져 있다.
1. from 테이블명
2. where 검색조건
3. select 컬럼리스트
1. select 절 : 해당 테이블에서 가져올 컬럼을 지정한다.
2. from 절 : 데이터를 가져올 테이블을 지정한다.
*/
select * -- 2
from employees; -- 1
-- 현재 접근 가능한 테이블 목록
select * from tabs; -- tabs(tables) : 시스템 테이블
-- 모든 테이블은 사용자에게 종속되어있다. 사용자(scheme, 스키마)가 달라지면 영역이 바뀌기 때문에 접근 가능 테이블 목록도 달라진다.
select * from departments; -- 본인 영역
select * from hr.departments; -- 남의 영역
-- 권한을 받으면 내 소유가 아닌 테이블도 볼 수 있다. (관리자는 모두 볼 수 있음)
-- 소유주.해당테이블
-- scott
-- DEPT
-- EMP
-- BONUS
-- SALGRADE
-- select 컬럼리스트 유형
-- 1. *(all) : 모든 컬럼
select * from EMP;
-- 2. 컬럼명
select ename from emp;
select ename, job, hiredate from emp;
select ename, length(ename) from emp;
-- ORA-00904: "WEIGHT": invalid identifier
-- 모를 때 에러코드로 검색하는게 가장 빠르다. ORA-00904
select ename, weight from emp;
-- ORA-00942: table or view does not exist
select ename from empp;
select ename from emp; -- 오타가 안났는데 오류가 나면, 접속 계정 확인하기
-- 정석 (근데 이렇게 잘 안씀, 다 생략한다)
select scott.emp.ename from scott.emp;
desc emp; -- 테이블의 스키마를 보여준다.
|
UPDATE npc_template SET gfxID=9073,sex=0 WHERE id=40006; |
create database ngan_hang;
create table ngan_hang.customers(
customer_number int (11) not null,
fullname varchar(50) not null,
address varchar (250) not null,
email varchar (50),
phone int (10),
PRIMARY KEY (customer_number));
create table ngan_hang.accounts(
account_number int (11) not null,
account_type varchar(50) not null,
date date,
balance float (11.0) not null,
customer_number int (11) not null,
primary key(account_number),
foreign key(customer_number)references customers(customer_number));
create table ngan_hang.transactions(
tran_number int (11) not null,
date date,
amounts varchar (12) not null,
descriptions varchar(50),
account_number int (11) not null,
primary key(tran_number),
foreign key(account_number)references accounts(account_number));
|
-- user table, username must be unique
create table if not exists `user_user` (
`id` int unsigned auto_increment,
`username` varchar(255) not null,
`password` varchar(255) not null,
`created_at` timestamp default current_timestamp,
`updated_at` timestamp default now() on update now(),
primary key(`id`),
unique index `index_username`(`username`)
)ENGINE InnoDB default charset=utf8;
-- follower table, only store follow relationship, not include be followed relation
create table if not exists `user_follow` (
`id` int unsigned auto_increment,
`from_name` varchar(255) not null,
`to_name` varchar(255) not null,
`created_at` timestamp default current_timestamp,
`updated_at` timestamp default now() on update now(),
primary key(`id`),
index `index_to`(`to_name`),
unique index `union_index`(`from_name`, `to_name`)
)ENGINE InnoDB default charset=utf8;
-- blog table
create table if not exists `blog_blog` (
`id` int unsigned auto_increment,
`author` varchar(255) not null,
`content` varchar(1000) not null,
`created_at` timestamp default current_timestamp,
`updated_at` timestamp default now() on update now(),
primary key(`id`),
index `index_author`(`author`)
)ENGINE InnoDB default charset=utf8; |
--
-- Struktura tabulky `guessNumber`
--
CREATE TABLE IF NOT EXISTS `guessNumber` (
`id` int(11) NOT NULL,
`twitchUser_id` int(11) NOT NULL,
`channel_id` int(11) NOT NULL,
`points` int(11) NOT NULL,
`created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`modified` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`twitchUserName` varchar(255) COLLATE utf8_czech_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci;
--
-- Klíče pro tabulku `guessNumber`
--
ALTER TABLE `guessNumber`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT pro tabulku `guessNumber`
--
ALTER TABLE `guessNumber`
MODIFY `id` 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 */; |
ALTER TABLE users ADD CONSTRAINT dups UNIQUE(email, username);
|
use ods;
create table if not exists dwd.dwd_orders_repay_record (
apply_no STRING COMMENT '订单编号',
category STRING COMMENT '类别',
report_date timestamp COMMENT ' 汇总日期',
product_name STRING COMMENT '产品名称',
borrowing_amount double COMMENT ' 借款金额',
platform_value_date timestamp COMMENT ' (平台)借款起息日',
platform_due_date timestamp COMMENT ' (平台)借款到期日',
fixed_term double COMMENT ' 预估用款期限',
product_term double COMMENT ' 产品期限',
house_type STRING COMMENT '房屋类型',
product_term_and_charge_way_name STRING COMMENT '收费方式',
channelpricetotal_fee_value double COMMENT ' 渠道价费率',
commissionfeeratetotal_fee_value double COMMENT ' 代收返佣费率',
overduerateperday_fee_value double COMMENT ' 超期费率',
contractfeeratetotal_fee_value double COMMENT ' 合同费率合计',
city_name STRING COMMENT '分公司',
branch_name STRING COMMENT '子公司',
main_borrower_name STRING COMMENT '主借款人姓名',
main_borrower_card STRING COMMENT '身份证',
fund_package_name STRING COMMENT '资金类型',
charge_name STRING COMMENT '(客户)借款 - 收款户名',
charge_open_bank_name STRING COMMENT '(客户)借款 - 收款银行',
charge_number STRING COMMENT '(客户)借款 - 收款账号',
partner_insurance_name STRING COMMENT '合作保险 / 合作机构',
contract_start_date timestamp COMMENT ' 借款合同起始日',
contract_end_date timestamp COMMENT ' 借款合同到期日',
contract_no STRING COMMENT ' 借款合同',
sendloancommand_time timestamp COMMENT ' 发送放款指令时间',
sales_branch_name STRING COMMENT '市场部',
sales_user_name STRING COMMENT '渠道经理',
returnconfirm_time TIMESTAMP COMMENT ' 资金归还确认时间',
repaymentresult_time TIMESTAMP COMMENT ' 资金归还核销时间',
loan_return_time TIMESTAMP COMMENT ' 资金归还时间',
fact_xf DOUBLE COMMENT ' 实还息费',
fact_bx DOUBLE COMMENT ' 实还本息',
interview_time TIMESTAMP COMMENT ' 面签时间'
);
with tmp_house as (
SELECT
house_no,
name_,
ROW_NUMBER() OVER (PARTITION BY house_no
ORDER BY tmp.create_time asc) rn
FROM ods_bpms_biz_house tmp
join ods_bpms_sys_dic dic on tmp.house_type = dic.key_ AND dic.type_id_ = '10000028440005'
where house_no is NOT NULL and house_no<>''
),
tmp_fee_detail as (
select t.`apply_no`,
max(( case when lower(t.`fee_define_no`)='channelpricetotal' then t.`fee_value` else null end )) channelpricetotal_fee_value,
max(( case when lower(t.`fee_define_no`)='commissionfeeratetotal' then t.`fee_value` else null end )) commissionfeeratetotal_fee_value,
max(( case when lower(t.`fee_define_no`)='overduerateperday' then t.`fee_value` else null end )) overduerateperday_fee_value,
max(( case when lower(t.`fee_define_no`)='contractfeeratetotal' then t.`fee_value` else null end )) contractfeeratetotal_fee_value
from ods_bpms_biz_fee_detial t group by t.`apply_no`
),
tmp_sys_org as
(
SELECT
org1.CODE_ code_
, org2.NAME_ name_
FROM ` ods_bpms_sys_org` org1
left join ods_bpms_sys_org org2 on org1.PARENT_ID_ = org2.ID_
where org1.GRADE_ = '3'
union
SELECT
org1.CODE_ code_
, org1.NAME_ name_
FROM ` ods_bpms_sys_org` org1
left join ods_bpms_sys_org org2 on org1.PARENT_ID_ = org2.ID_
where org1.GRADE_ = '2'
),
tmp_charge_account as (
select apply_no,
charge_name, -- 划回收款方(公司账号) 失败
charge_open_bank_name,
charge_number,
ROW_NUMBER() OVER ( PARTITION BY apply_no ORDER BY create_time desc ) rn
from ods_bpms_biz_charge_account
),
tmp_p2p as (
select apply_no,
task_name,
create_time contract_start_date, -- 借款合同起始日
ROW_NUMBER() OVER ( PARTITION BY apply_no, task_name ORDER BY create_time desc ) rn
from ods_bpms_biz_p2p_ret
),
tmp_record as (
select t2.apply_no,
MAX((CASE WHEN lower(t2.matter_key)='sendloancommand' THEN t2.handle_time ELSE NULL END)) sendloancommand_time,
MAX((CASE WHEN lower(t2.matter_key)='returnconfirm' THEN t2.handle_time ELSE NULL END)) returnconfirm_time,
MAX((CASE WHEN lower(t2.matter_key)='sendloancommand' THEN t2.remark ELSE NULL END)) sendloancommand_remark
from
ods_bpms_biz_order_matter_record_common t2 join
(select apply_no,matter_key_new,max(rn) rn from ods_bpms_biz_order_matter_record_common
where handle_time>='${var:logdate}' and handle_time < date_add('${var:logdate}',1)
group by apply_no,matter_key_new) b on b.apply_no=t2.apply_no and b.rn=t2.rn and b.matter_key_new=t2.matter_key_new
group by t2.apply_no
),
tmp_record_intervew as (
select t2.apply_no,
MAX((CASE WHEN lower(t2.matter_key)='interview' THEN t2.handle_time ELSE NULL END)) interview_time
from ods_bpms_biz_order_matter_record_common t2
left join tmp_record t on t2.apply_no = t.apply_no
where t2.handle_time< t.returnconfirm_time
GROUP BY t2.`apply_no`
),
tmp_p2p_extend as (
select apply_no,
`key`,
create_time create_time, -- 借款合同起始日
ROW_NUMBER() OVER ( PARTITION BY apply_no, `key` ORDER BY create_time desc ) rn
from ods_bpms_biz_p2p_ret_extend
)
insert into dwd.`dwd_orders_repay_record`
select * from (
select
bao.apply_no -- 订单编号
,'returnconfirm'
,cast('${var:logdate}' as timestamp)
,bao.product_name -- 产品名称
,bfs.borrowing_amount -- 借款金额
,bfs.platform_value_date-- (平台)借款起息日
,bfs.platform_due_date-- (平台)借款到期日
,bfs.fixed_term -- 预估用款期限
,cast(bfs.product_term as double) -- 产品期限
,th.house_type -- 房屋类型 -- 房产用途
,bfs.product_term_and_charge_way_name -- 收费方式
,tfd.channelpricetotal_fee_value -- 渠道价费率
,tfd.commissionfeeratetotal_fee_value -- 代收返佣费率
,tfd.overduerateperday_fee_value -- 超期费率
,tfd.contractfeeratetotal_fee_value -- 合同费率合计
,regexp_replace(regexp_replace(regexp_replace(regexp_replace(regexp_replace(regexp_replace(so.name_,'公司',''),'无锡','南外'),'苏州','南外'),'合肥','南外'),'南通(南京)事业部','南外'),'南外分','南外') city_name -- 分公司
,regexp_replace(so.name_,'南通(南京)事业部','南外') branch_name -- 子公司
,bc.`name` main_borrower_name -- 主借款人姓名
,bc.id_card_no main_borrower_card -- 身份证
,blfp.fund_package_name -- 资金类型
,tcg.charge_name -- (客户)借款-收款户名
,tcg.charge_open_bank_name -- (客户)借款-收款银行
,tcg.charge_number -- (客户)借款-收款账号
,replace(bao.partner_insurance_name, ' ', '') partner_insurance_name -- 合作保险/合作机构
,tp.contract_start_date contract_start_date -- 借款合同起始日
,date_add(tp.contract_start_date, cast(bfs.product_term as bigint)) contract_end_date -- 借款合同到期日
,ifnull(bpe.VALUE, bir.contract_no) contract_no -- 借款合同
, NULL
,bao.sales_branch_name sales_org_name -- 市场部
,bao.sales_user_name --渠道经理,
,t666.returnconfirm_time -- 资金归还确认时间
,tpg.create_time repaymentresult_time -- 资金归还核销时间
,case when (instr(bao.partner_insurance_name, '云南信托') > 0 or
instr(bao.partner_insurance_name, '湖南信托-主动管理') > 0)
then
cast (tpg.create_time as timestamp)
else cast (t666.returnconfirm_time as timestamp) end loan_return_time -- 资金归还时间
,ifnull(cfm.fact_re_interest, 0) + ifnull(cfm.fact_re_penalty, 0) fact_xf-- 实还息费
,ifnull(cfm.fact_re_interest, 0) + ifnull(cfm.fact_re_penalty, 0) + ifnull(bfs.borrowing_amount, 0) fact_bx -- 实还本息 实还息费+放款本金(借款金额)
,interview_time
from (select *
from ods_bpms_biz_order_matter_record_wx_common t666) t666
left join ods_bpms_biz_apply_order_common bao on t666.apply_no = bao.apply_no
left join (select
bfs.*,
tmp.name_ product_term_and_charge_way_name
from ods_bpms_biz_fee_summary bfs
left join ods_bpms_sys_dic tmp on tmp.key_ = bfs.product_term_and_charge_way
WHERE tmp.type_id_ = '10000045260203') bfs on bao.apply_no = bfs.apply_no
left join (select
house_no,
name_ house_type
from tmp_house
where rn = 1) th on th.house_no = bao.house_no
left join tmp_fee_detail tfd on tfd.apply_no = bao.apply_no
left join (select
apply_no,
is_actual_borrower_name,
customer_no
from ods_bpms_biz_customer_rel
where is_actual_borrower_name = 'Y') bcr on bao.apply_no = bcr.apply_no
left join ods_bpms_biz_customer bc on bcr.customer_no = bc.cust_no
left join ods_bpms_biz_lm_fund_package blfp on bfs.fund_package_code = blfp.fund_package_code
left join (select *
from tmp_charge_account
where rn = 1) tcg on tcg.apply_no = bao.apply_no
left join (select *
from tmp_p2p
where rn = 1 and task_name = 'TEAM_ORG_APPROVE') tp on tp.apply_no = bao.apply_no
left join (SELECT
apply_no,
contract_no
FROM ods_bpms_biz_isr_mixed) bir on bir.apply_no = bao.apply_no
left join (SELECT
apply_no,
VALUE
FROM ods_bpms_biz_p2p_ret_extend tmp
WHERE tmp.`key` = 'contractNo') bpe on bpe.apply_no = bao.apply_no
left join tmp_sys_org so on so.CODE_ = bao.branch_id
left join (select *
from tmp_p2p_extend
where rn = 1 and `key` = 'repaymentResult') tpg on tpg.apply_no = bao.apply_no
left join ods_bpms_c_fund_module_common cfm on bao.apply_no = cfm.apply_no
left join tmp_record_intervew tri on tri.apply_no = bao.apply_no
where bao.apply_status_name not in ('已终止', '拒绝')
)T where loan_return_time>='${var:logdate}' and loan_return_time < date_add('${var:logdate}',1) |
USE ims;
CREATE TABLE `vendor` (
`VendorID` int(10) unsigned NOT NULL,
`OrganizationID` int(10) unsigned DEFAULT NULL,
`SPOCID` int(10) unsigned DEFAULT NULL,
`VendorTypeID` int(10) unsigned DEFAULT NULL,
PRIMARY KEY (`VendorID`),
KEY `OrganizationID_idx` (`OrganizationID`),
KEY `SPOCID_FK_idx` (`SPOCID`),
KEY `VendorType_FK_idx` (`VendorTypeID`),
CONSTRAINT `OrganizationID_FK` FOREIGN KEY (`OrganizationID`) REFERENCES `organization` (`OrganizationID`) ON DELETE SET NULL ON UPDATE CASCADE,
CONSTRAINT `SPOCID_FK` FOREIGN KEY (`SPOCID`) REFERENCES `spoc_details` (`SPOCDetailsID`) ON DELETE SET NULL ON UPDATE CASCADE,
CONSTRAINT `VendorType_FK` FOREIGN KEY (`VendorTypeID`) REFERENCES `vendor_type` (`VendorTypeID`) ON DELETE SET NULL ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
create table cars(id int,car_name varchar(20),car_type varchar(20),brand varchar(20));
insert into cars values (1,"i10","hatchback","Hyundai");
insert into cars values (2,"i20","hatchback","Hyundai");
insert into cars values (3,"XUV","SUV","Mahendra");
insert into cars values (4,"City","sedan","Honda");
insert into cars values (5,"Verna","sedan","Hyundai"); |
Drop Table userprofile;
CREATE TABLE `userprofile` (
id int auto_increment,
`firstname` varchar(255) NOT NULL,
`lastname` varchar(255) NOT NULL,
`username` varchar(255) NOT NULL,
`password` varchar(255) NOT NULL,
`cartProducts` varchar(255) DEFAULT NULL,
`email` varchar(255) DEFAULT NULL,
primary key(id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
|
Spool .\dbschemas.log;
@db_users.sql
Spool off;
connect ofb/ofb
spool .\ofb.log;
@ofb.sql
spool off;
spool .\ofb_template_data.log;
@ofb_template_data.sql
spool off;
exit |
-- Create Database.
CREATE DATABASE SocMulDB;
USE SocMulDB;
-- Create USER for Database.
CREATE LOGIN SocMulUser WITH PASSWORD = 'socMul@2020';
-- Multiplication table.
CREATE TABLE MULTIPLICATION (
MULTIPLICATION_ID INT NOT NULL,
OPERAND_1 INT NOT NULL,
OPERAND_2 INT NOT NULL,
PRIMARY KEY (MULTIPLICATION_ID)
);
-- User table.
CREATE TABLE SOC_MUL_USER (
USER_ID INT NOT NULL,
ALIAS VARCHAR(100) NOT NULL,
PRIMARY KEY (USER_ID)
);
-- Multiplication result attempt table.
CREATE TABLE MULTIPLICATION_RESULT_ATTEMPT (
ID INT NOT NULL,
CORRECT BIT,
RESULT_ATTEMPT INT NOT NULL,
MULTIPLICATION_ID INT NOT NULL,
USER_ID INT NOT NULL,
PRIMARY KEY (ID),
FOREIGN KEY (MULTIPLICATION_ID) REFERENCES MULTIPLICATION(MULTIPLICATION_ID),
FOREIGN KEY (USER_ID) REFERENCES SOC_MUL_USER(USER_ID)
);
-- Create STATIC_CONFIGURATION_TABLE.
CREATE TABLE STATIC_CONFIGURATION (
CONFIGURATION_NAME VARCHAR(25) NOT NULL,
CONFIGURATION_VALUE INT NOT NULL,
PRIMARY KEY (CONFIGURATION_NAME));
--- Static data values.
INSERT INTO STATIC_CONFIGURATION(CONFIGURATION_NAME, CONFIGURATION_VALUE) VALUES('USER_ID_COUNT', 0)
INSERT INTO STATIC_CONFIGURATION(CONFIGURATION_NAME, CONFIGURATION_VALUE) VALUES('MULTIPLICATION_ID_COUNT', 0);
INSERT INTO STATIC_CONFIGURATION(CONFIGURATION_NAME, CONFIGURATION_VALUE) VALUES('MRA_ID', 0);
|
ALTER TABLE `logs_logbooks`
DROP COLUMN `state`,
DROP COLUMN `created`,
DROP COLUMN `status_id`,
DROP INDEX `logs_logbooks_status_id_fk`,
DROP FOREIGN KEY `logs_logbooks_status_id_fk`; |
/* Создание процедуры определения результата Заказ создан */
CREATE PROCEDURE /*PREFIX*/DR_CREATE_ORDER
(
ORDER_ID VARCHAR(32),
ACTION_ID VARCHAR(32),
RESULT_ID VARCHAR(32)
)
RETURNS
(
DETECTED INTEGER
)
AS
DECLARE CNT INTEGER;
BEGIN
DETECTED=0;
SELECT COUNT(*)
FROM /*PREFIX*/ORDERS
WHERE ORDER_ID=:ORDER_ID
INTO CNT;
IF (CNT=1) THEN
DETECTED=1;
SUSPEND;
END
--
/* Фиксация изменений */
COMMIT |
Insert into "AD_REF_LIST"
("AD_REF_LIST_ID","AD_CLIENT_ID","AD_ORG_ID","ISACTIVE","CREATED","CREATEDBY",
"UPDATED","UPDATEDBY","VALUE","NAME","DESCRIPTION","AD_REFERENCE_ID","VALIDFROM",
"VALIDTO","ENTITYTYPE")
values
(50040,0,0,'Y',to_date('02.03.07','DD.MM.RR'),0,to_date('02.03.07','DD.MM.RR'),
0,'S','Run silently - Take Defaults',null,50007,null,null,'D');
COMMIT;
|
/* Create database. */
DROP DATABASE IF EXISTS pucaratest;
CREATE DATABASE pucaratest;
USE pucaratest;
/* Grant all privileges to the root user. */
GRANT ALL ON pucaratest.* TO 'root'@'localhost';
/* Create 'category' table. */
DROP TABLE IF EXISTS category;
CREATE TABLE category (
`id` SMALLINT NOT NULL AUTO_INCREMENT,
`name` VARCHAR(20) NOT NULL UNIQUE,
`description` VARCHAR(50) NULL,
PRIMARY KEY (`id`)
);
ALTER TABLE category AUTO_INCREMENT = 100;
/* Create 'product' table. */
DROP TABLE IF EXISTS product;
/*
a. Add a new column final cost and rename 'cost' by 'initial cost'.
b. Change percentage as double.
*/
CREATE TABLE product (
`barcode` VARCHAR(15) NOT NULL,
`description` VARCHAR(50) NOT NULL UNIQUE,
`initialcost` DOUBLE NOT NULL,
`finalcost` DOUBLE NOT NULL,
`percentage` DOUBLE NOT NULL,
`date` DATETIME NOT NULL,
`stock` SMALLINT DEFAULT '0' NOT NULL,
`minstock` SMALLINT DEFAULT '0' NOT NULL,
`categoryid` SMALLINT NOT NULL,
`bypercentage` TINYINT(1) NOT NULL,
PRIMARY KEY (`barcode`)
);
ALTER TABLE `product`
ADD CONSTRAINT `product_category_id` FOREIGN KEY (`categoryid`) REFERENCES `category` (`id`);
CREATE INDEX product_barcode_index ON product (barcode);
CREATE INDEX product_description_index ON product (description);
/* Create 'supplier' table. */
DROP TABLE IF EXISTS supplier;
CREATE TABLE supplier (
`id` SMALLINT NOT NULL AUTO_INCREMENT,
`description` VARCHAR(50) NOT NULL UNIQUE,
`address` VARCHAR(30) NULL,
`phone` VARCHAR(20) NULL,
PRIMARY KEY (`id`)
);
ALTER TABLE supplier AUTO_INCREMENT = 1000;
/* Create 'provides' table. */
DROP TABLE IF EXISTS provides;
CREATE TABLE provides (
`barcode` VARCHAR(15) NOT NULL,
`supplier_id` SMALLINT NOT NULL,
PRIMARY KEY (`barcode`, `supplier_id`)
);
ALTER TABLE `provides`
ADD CONSTRAINT `barcode_fk` FOREIGN KEY (`barcode`) REFERENCES `product` (`barcode`);
ALTER TABLE `provides`
ADD CONSTRAINT `supplier_id_fk` FOREIGN KEY (`supplier_id`) REFERENCES `supplier` (`id`);
/* Create 'sale' table. */
DROP TABLE IF EXISTS sale;
CREATE TABLE sale (
`id` INT NOT NULL AUTO_INCREMENT,
`date` DATETIME NOT NULL,
`gain` DOUBLE NOT NULL,
PRIMARY KEY (`id`)
);
ALTER TABLE sale AUTO_INCREMENT = 1000;
CREATE INDEX sale_data_index ON sale (date);
/* Create 'sale_detail' table. */
DROP TABLE IF EXISTS sale_detail;
CREATE TABLE sale_detail (
`id` INT NOT NULL AUTO_INCREMENT,
`number_of_products` SMALLINT NOT NULL,
PRIMARY KEY (`id`)
);
ALTER TABLE sale_detail AUTO_INCREMENT = 100;
/* Create 'x_sale_sale_detail' table. */
DROP TABLE IF EXISTS x_sale_sale_detail;
CREATE TABLE x_sale_sale_detail (
`sale_id` INT NOT NULL,
`sale_detail_id` INT NOT NULL UNIQUE,
PRIMARY KEY (`sale_id`, `sale_detail_id`)
);
ALTER TABLE `x_sale_sale_detail`
ADD CONSTRAINT `x_sale_id` FOREIGN KEY (`sale_id`) REFERENCES `sale` (`id`);
ALTER TABLE `x_sale_sale_detail`
ADD CONSTRAINT `x_sale_detail_id` FOREIGN KEY (`sale_detail_id`) REFERENCES `sale_detail` (`id`);
/* Create 'x_sale_sale_detail_product' table. */
DROP TABLE IF EXISTS x_sale_sale_detail_product;
CREATE TABLE x_sale_sale_detail_product (
`sale_id` INT NOT NULL,
`sale_detail_id` INT NOT NULL,
`barcode` VARCHAR(15) NOT NULL,
`count` SMALLINT NOT NULL,
PRIMARY KEY (`sale_id`, `sale_detail_id`, `barcode`)
);
ALTER TABLE `x_sale_sale_detail_product`
ADD CONSTRAINT `x_sale_sale_detail_fk_si` FOREIGN KEY (`sale_id`) REFERENCES `x_sale_sale_detail` (`sale_id`);
ALTER TABLE `x_sale_sale_detail_product`
ADD CONSTRAINT `x_sale_sale_detail_fk2_ssd` FOREIGN KEY (`sale_detail_id`) REFERENCES `x_sale_sale_detail` (`sale_detail_id`);
ALTER TABLE `x_sale_sale_detail_product`
ADD CONSTRAINT `product_sale_fk` FOREIGN KEY (`barcode`) REFERENCES `product` (`barcode`);
/* Create 'purchase' table. */
DROP TABLE IF EXISTS purchase;
CREATE TABLE purchase (
`id` INT NOT NULL AUTO_INCREMENT,
`description` VARCHAR(50) NOT NULL,
`date` DATETIME NOT NULL,
`expense` DOUBLE NOT NULL,
PRIMARY KEY (`id`)
);
ALTER TABLE purchase AUTO_INCREMENT = 1000;
CREATE INDEX purchase_date_index ON purchase (date);
/* Create 'purchase_detail' table. */
DROP TABLE IF EXISTS purchase_detail;
CREATE TABLE purchase_detail (
`id` INT NOT NULL AUTO_INCREMENT,
`number_of_products` SMALLINT NOT NULL,
PRIMARY KEY (`id`)
);
ALTER TABLE purchase_detail AUTO_INCREMENT = 100;
/* Create 'x_purchase_purchase_detail' table. */
DROP TABLE IF EXISTS x_purchase_purchase_detail;
CREATE TABLE x_purchase_purchase_detail (
`purchase_id` INT NOT NULL,
`purchase_detail_id` INT NOT NULL UNIQUE,
PRIMARY KEY (`purchase_id`, `purchase_detail_id`)
);
ALTER TABLE `x_purchase_purchase_detail`
ADD CONSTRAINT `x_purchase_id` FOREIGN KEY (`purchase_id`) REFERENCES `purchase` (`id`);
ALTER TABLE `x_purchase_purchase_detail`
ADD CONSTRAINT `x_purchase_detail_id` FOREIGN KEY (`purchase_detail_id`) REFERENCES `purchase_detail` (`id`);
/* Create 'x_purchase_purchase_detail_product' table. */
DROP TABLE IF EXISTS x_purchase_purchase_detail_product;
CREATE TABLE x_purchase_purchase_detail_product (
`purchase_id` INT NOT NULL,
`purchase_detail_id` INT NOT NULL,
`barcode` VARCHAR(15) NOT NULL,
`count` SMALLINT NOT NULL,
PRIMARY KEY (`purchase_id`, `purchase_detail_id`, `barcode`)
);
ALTER TABLE `x_purchase_purchase_detail_product` ADD CONSTRAINT `x_purchase_purchase_detail_fk1` FOREIGN KEY (`purchase_id`)
REFERENCES `x_purchase_purchase_detail` (`purchase_id`);
ALTER TABLE `x_purchase_purchase_detail_product` ADD CONSTRAINT `x_purchase_purchase_detail_fk2` FOREIGN KEY (`purchase_detail_id`)
REFERENCES `x_purchase_purchase_detail` (`purchase_detail_id`);
ALTER TABLE `x_purchase_purchase_detail_product`
ADD CONSTRAINT `product_purchase_fk` FOREIGN KEY (`barcode`) REFERENCES `product` (`barcode`);
/* Populate 'category' table. */
INSERT INTO category (`name`, `description`) VALUES ('almacén', 'descripción de categoría');
INSERT INTO category (`name`, `description`) VALUES ('kiosco', 'descripción de categoría');
INSERT INTO category (`name`, `description`) VALUES ('juguetería', 'descripción de categoría');
INSERT INTO category (`name`, `description`) VALUES ('librería', 'descripción de categoría');
/* Populate 'product' table. */
INSERT INTO product (`barcode`, `description`, `initialcost`, `finalcost`, `percentage`, `date`, `stock`, `minstock`, `categoryid`, `bypercentage`) VALUES ('7790040994904', 'chocolate blanco arcor 30gr', '9.25', '12.025', 30, NOW(), 1000, 5, 101, 1);
INSERT INTO product (`barcode`, `description`, `initialcost`, `finalcost`, `percentage`, `date`, `stock`, `minstock`, `categoryid`, `bypercentage`) VALUES ('7792216994357', 'sal dos anclas 200gr', '7.50', '9.0', 20, '2014-01-22 12:15:11', 1000, 5, 100, 1);
INSERT INTO product (`barcode`, `description`, `initialcost`, `finalcost`, `percentage`, `date`, `stock`, `minstock`, `categoryid`, `bypercentage`) VALUES ('7792218734238', 'alcohol en gel moscu 50ml', '4.00', '5.40', 35, '2014-01-12 10:10:08', 1000, 5, 100, 1);
INSERT INTO product (`barcode`, `description`, `initialcost`, `finalcost`, `percentage`, `date`, `stock`, `minstock`, `categoryid`, `bypercentage`) VALUES ('7798152010109', 'block a5 80 hojas 210x148', '3.00', '4.05', 35, '2014-01-12 10:10:08', 1000, 5, 103, 1);
INSERT INTO product (`barcode`, `description`, `initialcost`, `finalcost`, `percentage`, `date`, `stock`, `minstock`, `categoryid`, `bypercentage`) VALUES ('7798010921646', 'cuaderno maraton 42 hojas rayadas', '5.5', '7.425', 35, '2014-01-12 10:10:08', 1000, 5, 103, 1);
/* Populate 'supplier' table. */
INSERT INTO supplier (`description`, `address`, `phone`) VALUES ('distribuidora los gordos', 'puan 2342', '2281422343');
INSERT INTO supplier (`description`, `address`, `phone`) VALUES ('distribuidora barderrama', 'av. colon 234', '2281412312');
INSERT INTO supplier (`description`, `address`, `phone`) VALUES ('distribuidora quilmes', 'av. piazza 1337', '2281429300');
/* Populate 'provides' table. */
INSERT INTO provides (`barcode`, `supplier_id`) VALUES ('7790040994904', 1001);
INSERT INTO provides (`barcode`, `supplier_id`) VALUES ('7792216994357', 1001);
INSERT INTO provides (`barcode`, `supplier_id`) VALUES ('7792218734238', 1002);
INSERT INTO provides (`barcode`, `supplier_id`) VALUES ('7792218734238', 1000);
/* Populate 'sale' table. */
INSERT INTO sale (`date`,`gain`) VALUES (NOW(), '23.70');
INSERT INTO sale (`date`,`gain`) VALUES (NOW(), '13.00');
INSERT INTO sale (`date`,`gain`) VALUES (NOW(), '31.50');
/* Populate 'sale_detail' table. */
INSERT INTO sale_detail (`number_of_products`) VALUES (2);
INSERT INTO sale_detail (`number_of_products`) VALUES (8);
INSERT INTO sale_detail (`number_of_products`) VALUES (5);
/* Populate 'x_sale_sale_detail' table. */
INSERT INTO x_sale_sale_detail (`sale_id`, `sale_detail_id`) VALUES (1000, 100);
INSERT INTO x_sale_sale_detail (`sale_id`, `sale_detail_id`) VALUES (1001, 101);
INSERT INTO x_sale_sale_detail (`sale_id`, `sale_detail_id`) VALUES (1002, 102);
/* Populate 'x_sale_sale_detail_product' table. */
INSERT INTO x_sale_sale_detail_product (`sale_id`, `sale_detail_id`, `barcode`, `count`) VALUES (1000, 100, '7790040994904', 1);
INSERT INTO x_sale_sale_detail_product (`sale_id`, `sale_detail_id`, `barcode`, `count`) VALUES (1000, 100, '7792216994357', 1);
INSERT INTO x_sale_sale_detail_product (`sale_id`, `sale_detail_id`, `barcode`, `count`) VALUES (1001, 101, '7790040994904', 1);
INSERT INTO x_sale_sale_detail_product (`sale_id`, `sale_detail_id`, `barcode`, `count`) VALUES (1001, 101, '7792216994357', 4);
INSERT INTO x_sale_sale_detail_product (`sale_id`, `sale_detail_id`, `barcode`, `count`) VALUES (1001, 101, '7792218734238', 3);
INSERT INTO x_sale_sale_detail_product (`sale_id`, `sale_detail_id`, `barcode`, `count`) VALUES (1002, 102, '7792218734238', 5);
/* Populate 'purchase' table. */
INSERT INTO purchase (`description`, `date`, `expense`) VALUES ('compra los chinos', NOW(), '273.70');
INSERT INTO purchase (`description`, `date`, `expense`) VALUES ('pago haberes xx', NOW(), '130.00');
INSERT INTO purchase (`description`, `date`, `expense`) VALUES ('boleta de luz mar 2014', NOW(), '431.50');
/* Populate 'purchase_detail' table. */
-- INSERT INTO purchase_detail (`number_of_products`) VALUES (14);
-- INSERT INTO purchase_detail (`number_of_products`) VALUES (41);
-- INSERT INTO purchase_detail (`number_of_products`) VALUES (15);
/* Populate 'x_purchase_purchase_detail' table. */
-- INSERT INTO x_purchase_purchase_detail (`purchase_id`, `purchase_detail_id`) VALUES (1000, 100);
-- INSERT INTO x_purchase_purchase_detail (`purchase_id`, `purchase_detail_id`) VALUES (1001, 101);
-- INSERT INTO x_purchase_purchase_detail (`purchase_id`, `purchase_detail_id`) VALUES (1002, 102);
/* Populate 'x_purchase_purchase_detail_product' table. */
-- INSERT INTO x_purchase_purchase_detail_product (`purchase_id`, `purchase_detail_id`, `barcode`, `count`) VALUES (1000, 100, '7790040994904', 4);
-- INSERT INTO x_purchase_purchase_detail_product (`purchase_id`, `purchase_detail_id`, `barcode`, `count`) VALUES (1000, 100, '7792216994357', 10);
-- INSERT INTO x_purchase_purchase_detail_product (`purchase_id`, `purchase_detail_id`, `barcode`, `count`) VALUES (1001, 101, '7790040994904', 5);
-- INSERT INTO x_purchase_purchase_detail_product (`purchase_id`, `purchase_detail_id`, `barcode`, `count`) VALUES (1001, 101, '7792216994357', 22);
-- INSERT INTO x_purchase_purchase_detail_product (`purchase_id`, `purchase_detail_id`, `barcode`, `count`) VALUES (1001, 101, '7792218734238', 14);
-- INSERT INTO x_purchase_purchase_detail_product (`purchase_id`, `purchase_detail_id`, `barcode`, `count`) VALUES (1002, 102, '7792218734238', 15);
/* Create views */
CREATE VIEW product_view AS
SELECT barcode, description, stock, minstock, finalcost FROM product;
CREATE VIEW daily_report_view AS
select SUM(s.gain) AS gain, SUM(sd.number_of_products) AS count from x_sale_sale_detail xssd inner join sale s on (xssd.sale_id = s.id) inner join sale_detail sd on (sd.id = xssd.sale_detail_id) where DATE(s.date) = DATE(NOW());
CREATE VIEW daily_purchase_report_view AS
select p.description as description, p.expense as expense, p.date as date from purchase p where date(p.date) = curdate();
/* Import From CSV */
-- LOAD DATA INFILE '/tmp/products.csv' INTO TABLE product
-- FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
-- LINES TERMINATED BY '\n';
|
USE `arenafifadb`;
DELIMITER $$
DROP PROCEDURE IF EXISTS `spGetAllTimesFasePreCopaOfCampeonato` $$
CREATE PROCEDURE `spGetAllTimesFasePreCopaOfCampeonato`(pIdCamp INTEGER)
begin
select P.*, T.NM_Time, T.DS_Tipo
from TB_TIMES_FASE_PRECOPA P, TB_TIME T
where P.ID_Time = T.ID_Time and P.ID_CAMPEONATO = pIdCamp
order by T.NM_TIME;
End$$
DELIMITER ;
DELIMITER $$
DROP PROCEDURE IF EXISTS `spUpdateTimesFasePreCopaNewTime` $$
CREATE PROCEDURE `spUpdateTimesFasePreCopaNewTime`(
pIdCamp INTEGER,
pIdTimeOld INTEGER,
pIdTimeNew INTEGER
)
Begin
update `TB_TIMES_FASE_PRECOPA`
set ID_TIME = pIdTimeNew
where ID_CAMPEONATO = pIdCamp and ID_TIME = pIdTimeOld;
End$$
DELIMITER ;
DELIMITER $$
DROP PROCEDURE IF EXISTS `spDeleteAllTimesFasePreCopaOfCampeonato` $$
CREATE PROCEDURE `spDeleteAllTimesFasePreCopaOfCampeonato`(pIdCamp INTEGER)
Begin
delete from `TB_TIMES_FASE_PRECOPA`
where ID_CAMPEONATO = pIdCamp;
End$$
DELIMITER ;
DELIMITER $$
DROP PROCEDURE IF EXISTS `spAddLoadTimesFasePreCopaOfCampeonato` $$
CREATE PROCEDURE `spAddLoadTimesFasePreCopaOfCampeonato`(
pIdCamp INTEGER,
pIdsTime VARCHAR(250)
)
Begin
DECLARE _next VARCHAR(250) DEFAULT NULL;
DECLARE _nextlen INTEGER DEFAULT NULL;
DECLARE _idTime VARCHAR(5) DEFAULT NULL;
DECLARE strDelimiter CHAR(1) DEFAULT ',';
call `arenafifadb`.`spDeleteAllTimesFasePreCopaOfCampeonato`(pIdCamp);
iterator:
LOOP
IF LENGTH(TRIM(pIdsTime)) = 0 OR pIdsTime IS NULL THEN
LEAVE iterator;
END IF;
SET _next = SUBSTRING_INDEX(pIdsTime,strDelimiter,1);
SET _nextlen = LENGTH(_next);
SET _idTime = TRIM(_next);
insert into `TB_TIMES_FASE_PRECOPA` (`ID_CAMPEONATO`, `ID_TIME`, `ID_ORDEM_SORTEIO`)
values (pIdCamp, pIdTime, Null);
SET pIdsTime = INSERT(pIdsTime,1,_nextlen + 1,'');
END LOOP;
End$$
DELIMITER ;
|
/*
Navicat MySQL Data Transfer
Source Server : localhost
Source Server Version : 50540
Source Host : localhost:3306
Source Database : onlinekefu
Target Server Type : MYSQL
Target Server Version : 50540
File Encoding : 65001
Date: 2016-03-12 17:27:42
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for `kl_kefu`
-- ----------------------------
DROP TABLE IF EXISTS `kl_kefu`;
CREATE TABLE `kl_kefu` (
`kefu_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`pid` int(11) NOT NULL DEFAULT '0',
`name` varchar(255) DEFAULT NULL,
`username` varchar(255) NOT NULL,
`password` varchar(255) NOT NULL,
`room_id` varchar(255) NOT NULL,
PRIMARY KEY (`kefu_id`)
) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of kl_kefu
-- ----------------------------
INSERT INTO `kl_kefu` VALUES ('1', '0', '客服丹丹', 'admin', 'adminrootkl', '666666');
INSERT INTO `kl_kefu` VALUES ('2', '0', '客服丽丽', 'keli', 'adminrootkl', '666666');
|
# --- Created by Ebean DDL
# To stop Ebean DDL generation, remove this comment and start using Evolutions
# --- !Ups
create table ingredient (
id bigint not null,
name varchar(255),
frozen boolean,
category varchar(255),
base_type varchar(255),
photo varchar(255),
constraint pk_ingredient primary key (id)
);
create sequence ingredient_seq;
create table measure_ingredient (
id bigint not null,
measure varchar(255),
quantity float,
recipe_id bigint,
ingredient_id bigint,
constraint pk_measure_ingredient primary key (id)
);
create sequence measure_ingredient_seq;
create table recipe (
id bigint not null,
name varchar(255),
score integer,
author varchar(255),
difficulty integer,
photo varchar(255),
portions integer,
constraint pk_recipe primary key (id)
);
create sequence recipe_seq;
create table task (
id bigint not null,
name varchar(255),
description varchar(255),
seconds integer,
recipe_id bigint,
photo varchar(255),
constraint pk_task primary key (id)
);
create sequence task_seq;
alter table measure_ingredient add constraint fk_measure_ingredient_recipe_id foreign key (recipe_id) references recipe (id) on delete restrict on update restrict;
create index ix_measure_ingredient_recipe_id on measure_ingredient (recipe_id);
alter table measure_ingredient add constraint fk_measure_ingredient_ingredient_id foreign key (ingredient_id) references ingredient (id) on delete restrict on update restrict;
create index ix_measure_ingredient_ingredient_id on measure_ingredient (ingredient_id);
alter table task add constraint fk_task_recipe_id foreign key (recipe_id) references recipe (id) on delete restrict on update restrict;
create index ix_task_recipe_id on task (recipe_id);
# --- !Downs
alter table measure_ingredient drop constraint if exists fk_measure_ingredient_recipe_id;
drop index if exists ix_measure_ingredient_recipe_id;
alter table measure_ingredient drop constraint if exists fk_measure_ingredient_ingredient_id;
drop index if exists ix_measure_ingredient_ingredient_id;
alter table task drop constraint if exists fk_task_recipe_id;
drop index if exists ix_task_recipe_id;
drop table if exists ingredient;
drop sequence if exists ingredient_seq;
drop table if exists measure_ingredient;
drop sequence if exists measure_ingredient_seq;
drop table if exists recipe;
drop sequence if exists recipe_seq;
drop table if exists task;
drop sequence if exists task_seq;
|
UPDATE links_general.ref_familyname , links_frequency.familyname_a
SET
links_general.ref_familyname.standard = links_frequency.familyname_a.name_b ,
links_general.ref_familyname.standard_code = 'o' ,
links_general.ref_familyname.standard_source = 'LS1'
WHERE
links_general.ref_familyname.original = links_frequency.familyname_a.name_1 AND
links_general.ref_familyname.standard_code = 'x' AND
links_general.ref_familyname.standard IS NULL AND
links_frequency.familyname_a.name_b IS NOT NULL ;
UPDATE links_general.ref_firstname , links_frequency.firstname_a
SET
links_general.ref_firstname.standard = links_frequency.firstname_a.name_b ,
links_general.ref_firstname.standard_code = 'o' ,
links_general.ref_firstname.standard_source = 'LS1'
WHERE
links_general.ref_firstname.original = links_frequency.firstname_a.name_1 AND
links_general.ref_firstname.standard_code = 'x' AND
links_general.ref_firstname.standard IS NULL AND
links_frequency.firstname_a.name_b IS NOT NULL |
CREATE DATABASE `dingdangcat` CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_bin';
|
-- =============================================
-- Author: <Shaik Mohammad Rafeeq>
-- Create date: <11/25/2018>
-- Description: <Get Generic error info>
-- =============================================
CREATE PROCEDURE USP_CT_GetErrorInfo
AS
SELECT
ERROR_NUMBER() AS ErrorNumber
,ERROR_SEVERITY() AS ErrorSeverity
,ERROR_STATE() AS ErrorState
,ERROR_PROCEDURE() AS ErrorProcedure
,ERROR_LINE() AS ErrorLine
,ERROR_MESSAGE() AS ErrorMessage; |
-- MySQL Script generated by MySQL Workbench
-- Sat Aug 18 13:08:03 2018
-- Model: New Model Version: 1.0
-- MySQL Workbench Forward Engineering
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION';
-- -----------------------------------------------------
-- Schema mydb
-- -----------------------------------------------------
-- -----------------------------------------------------
-- Schema mydb
-- -----------------------------------------------------
CREATE SCHEMA IF NOT EXISTS `mydb` DEFAULT CHARACTER SET utf8 ;
USE `mydb` ;
-- -----------------------------------------------------
-- Table `mydb`.`Administrators`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `mydb`.`Administrators` (
`idAdministrator` INT NOT NULL AUTO_INCREMENT,
`Name` VARCHAR(45) NULL,
`LastName` VARCHAR(45) NULL,
PRIMARY KEY (`idAdministrator`))
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `mydb`.`Faculty`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `mydb`.`Faculty` (
`idFaculty` INT NOT NULL AUTO_INCREMENT,
`Name` VARCHAR(45) NULL,
`EnrolleesLimit` INT NULL,
`Administrator_id` INT NULL,
`Enrollee_id` VARCHAR(45) NULL,
PRIMARY KEY (`idFaculty`),
CONSTRAINT `fk_Faculty_Administrators1`
FOREIGN KEY (`Administrator_id`)
REFERENCES `mydb`.`Administrators` (`idAdministrator`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
CREATE INDEX `fk_Faculty_Administrators1_idx` ON `mydb`.`Faculty` (`Administrator_id` ASC) VISIBLE;
-- -----------------------------------------------------
-- Table `mydb`.`Certificate`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `mydb`.`Certificate` (
`idCertificate` INT NOT NULL AUTO_INCREMENT,
`SchoolSubjectsId` VARCHAR(45) NULL,
`SubjectScore` DECIMAL NULL,
`AverageScore` DECIMAL NULL,
PRIMARY KEY (`idCertificate`))
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `mydb`.`Enrollees`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `mydb`.`Enrollees` (
`idEnrollee` INT NOT NULL AUTO_INCREMENT,
`Name` VARCHAR(45) NULL,
`LastName` VARCHAR(45) NULL,
`Faculty_id` INT NOT NULL,
`Certificate_id` INT NOT NULL,
PRIMARY KEY (`idEnrollee`, `Faculty_id`, `Certificate_id`),
CONSTRAINT `fk_Enrollees_Faculty`
FOREIGN KEY (`Faculty_id`)
REFERENCES `mydb`.`Faculty` (`idFaculty`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_Enrollees_Certificate1`
FOREIGN KEY (`Certificate_id`)
REFERENCES `mydb`.`Certificate` (`idCertificate`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
CREATE INDEX `fk_Enrollees_Faculty_idx` ON `mydb`.`Enrollees` (`Faculty_id` ASC) VISIBLE;
CREATE INDEX `fk_Enrollees_Certificate1_idx` ON `mydb`.`Enrollees` (`Certificate_id` ASC) VISIBLE;
-- -----------------------------------------------------
-- Table `mydb`.`SchoolSubjects`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `mydb`.`SchoolSubjects` (
`idSchoolSubjects` INT NOT NULL AUTO_INCREMENT,
`Name` VARCHAR(45) NULL,
`Certificate_idCertificate` INT NOT NULL,
PRIMARY KEY (`idSchoolSubjects`),
CONSTRAINT `fk_SchoolSubjects_Certificate1`
FOREIGN KEY (`Certificate_idCertificate`)
REFERENCES `mydb`.`Certificate` (`idCertificate`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
CREATE INDEX `fk_SchoolSubjects_Certificate1_idx` ON `mydb`.`SchoolSubjects` (`Certificate_idCertificate` ASC) VISIBLE;
SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
|
-- do NOT add blank lines
-- do NOT add a slash or semi-colon terminator
-- this script is called from inside a SQL statement
--
-- as seen in dba_hist_active_sess_history
-- this is only needed for 10g and lower
-- 11g+ use the v$sqlcommand view
-- Order is crucial, as the rownum will be the same as the stored opcode value
select
rownum id, column_value opcode
from (
table(
sys.odcivarchar2list(
'CREATE_TABLE',
'INSERT',
'SELECT',
'CREATE_CLUSTER',
'ALTER_CLUSTER',
'UPDATE',
'DELETE',
'DROP_CLUSTER',
'CREATE_INDEX',
'DROP_INDEX',
'ALTER_INDEX',
'DROP_TABLE',
'CREATE_SEQUENCE',
'ALTER_SEQUENCE',
'ALTER_TABLE',
'DROP_SEQUENCE',
'GRANT_OBJECT',
'REVOKE_OBJECT',
'CREATE_SYNONYM',
'DROP_SYNONYM',
'CREATE_VIEW',
'DROP_VIEW',
'VALIDATE_INDEX',
'CREATE_PROCEDURE',
'ALTER_PROCEDURE',
'LOCK',
'NO-OP',
'RENAME',
'COMMENT',
'AUDIT_OBJECT',
'NOAUDIT_OBJECT',
'CREATE_DATABASE_LINK',
'DROP_DATABASE_LINK',
'CREATE_DATABASE',
'ALTER_DATABASE',
'CREATE_ROLLBACK_SEG',
'ALTER_ROLLBACK_SEG',
'DROP_ROLLBACK_SEG',
'CREATE_TABLESPACE',
'ALTER_TABLESPACE',
'DROP_TABLESPACE',
'ALTER_SESSION',
'ALTER_USER',
'COMMIT',
'ROLLBACK',
'SAVEPOINT',
'PL/SQL_EXECUTE',
'SET_TRANSACTION',
'ALTER_SYSTEM',
'EXPLAIN',
'CREATE_USER',
'CREATE_ROLE',
'DROP_USER',
'DROP_ROLE',
'SET_ROLE',
'CREATE_SCHEMA',
'CREATE_CONTROL_FILE',
'CREATE_TRIGGER',
'ALTER_TRIGGER',
'DROP_TRIGGER',
'ANALYZE_TABLE',
'ANALYZE_INDEX',
'ANALYZE_CLUSTER',
'CREATE_PROFILE',
'DROP_PROFILE',
'ALTER_PROFILE',
'DROP_PROCEDURE',
'ALTER_RESOURCE_COST',
'CREATE_MATERIALIZED_VIEW_LOG',
'ALTER_MATERIALIZED_VIEW_LOG',
'DROP_MATERIALIZED_VIEW_LOG',
'CREATE_MATERIALIZED_VIEW',
'ALTER_MATERIALIZED_VIEW',
'DROP_MATERIALIZED_VIEW',
'CREATE_TYPE',
'DROP_TYPE',
'ALTER_ROLE',
'ALTER_TYPE',
'CREATE_TYPE_BODY',
'ALTER_TYPE_BODY',
'DROP_TYPE_BODY',
'DROP_LIBRARY',
'TRUNCATE_TABLE',
'TRUNCATE_CLUSTER',
'CREATE_FUNCTION',
'ALTER_FUNCTION',
'DROP_FUNCTION',
'CREATE_PACKAGE',
'ALTER_PACKAGE',
'DROP_PACKAGE',
'CREATE_PACKAGE_BODY',
'ALTER_PACKAGE_BODY',
'DROP_PACKAGE_BODY',
'LOGON',
'LOGOFF',
'LOGOFF_BY_CLEANUP',
'SESSION_REC',
'SYSTEM_AUDIT',
'SYSTEM_NOAUDIT',
'AUDIT_DEFAULT',
'NOAUDIT_DEFAULT',
'SYSTEM_GRANT',
'SYSTEM_REVOKE',
'CREATE_PUBLIC_SYNONYM',
'DROP_PUBLIC_SYNONYM',
'CREATE_PUBLIC_DATABASE_LINK',
'DROP_PUBLIC_DATABASE_LINK',
'GRANT_ROLE',
'REVOKE_ROLE',
'EXECUTE_PROCEDURE',
'USER_COMMENT',
'ENABLE_TRIGGER',
'DISABLE_TRIGGER',
'ENABLE_ALL_TRIGGERS',
'DISABLE_ALL_TRIGGERS',
'NETWORK_ERROR',
'EXECUTE_TYPE',
'CREATE_DIRECTORY',
'DROP_DIRECTORY',
'CREATE_LIBRARY',
'CREATE_JAVA',
'ALTER_JAVA',
'DROP_JAVA',
'CREATE_OPERATOR',
'CREATE_INDEXTYPE',
'DROP_INDEXTYPE',
'DROP_OPERATOR',
'ASSOCIATE_STATISTICS',
'DISASSOCIATE_STATISTICS',
'CALL_METHOD',
'CREATE_SUMMARY',
'ALTER_SUMMARY',
'DROP_SUMMARY',
'CREATE_DIMENSION',
'ALTER_DIMENSION',
'DROP_DIMENSION',
'CREATE_CONTEXT',
'DROP_CONTEXT',
'ALTER_OUTLINE',
'CREATE_OUTLINE',
'DROP_OUTLINE',
'UPDATE_INDEXES',
'ALTER OPERATOR')
)
)
|
/*
Navicat MySQL Data Transfer
Source Server : localhost_3306
Source Server Version : 50129
Source Host : localhost:3306
Source Database : phpsystem_db
Target Server Type : MYSQL
Target Server Version : 50129
File Encoding : 65001
Date: 2016-10-24 20:59
*/
use course;
SET FOREIGN_KEY_CHECKS=0;
-- -- ----------------------------
-- -- Table structure for `t_admin`
-- -- ----------------------------
-- DROP TABLE IF EXISTS `t_admin`;
-- CREATE TABLE `t_admin` (
-- `username` varchar(20) NOT NULL DEFAULT '',
-- `password` varchar(32) DEFAULT NULL,
-- PRIMARY KEY (`username`)
-- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- -- ----------------------------
-- -- Records of t_admin
-- -- ----------------------------
-- INSERT INTO `t_admin` VALUES ('admin2', '123');
-- ----------------------------
-- Table structure for `t_book`
-- ----------------------------
DROP TABLE IF EXISTS `imooc_user`;
CREATE TABLE `imooc_user` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'id',
`username` varchar(60) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT 'username',
`password` char(32) DEFAULT NULL COMMENT '',
`email` varchar(100) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT 'username',
-- `bookType` int(11) NOT NULL COMMENT '图书所在类别',
-- `price` float NOT NULL COMMENT '图书价格',
-- `count` int(11) NOT NULL COMMENT '库存',
-- `publish` varchar(20) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL COMMENT '出版社',
-- `publishDate` datetime DEFAULT NULL,
-- `photo` varchar(100) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT '图书图片',
PRIMARY KEY (`id`)
-- KEY `bookType` (`bookType`),
-- CONSTRAINT `t_book_ibfk_1` FOREIGN KEY (`bookType`) REFERENCES `t_bookclass` (`bookClassId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of t_book
-- ----------------------------
INSERT INTO `imooc_user` VALUES ('1', 'zhangxiaoyun', '789256', 'zxy_7981@qq.com');
-- INSERT INTO `t_book` VALUES ('112', 'php程序设计', '7', '36', '18', '电子科技大学出版社', '2008-01-16 00:00:00', '../upload/2013/07/01844900.jpg');
-- INSERT INTO `t_book` VALUES ('113', '安卓程序设计', '7', '13.5', '12', '理工大学出版社', '2009-05-20 00:00:00', '../upload/2013/07/37044500.jpg');
-- INSERT INTO `t_book` VALUES ('114', 'asp程序设计', '7', '35', '19', '理工大学', '2013-07-17 00:00:00', '../upload/2013/07/19957400.jpg');
-- INSERT INTO `t_book` VALUES ('115', '中国近代史', '5', '28', '25', '四川大学出版社', '2013-07-09 00:00:00', '../upload/2013/07/79494300.jpg');
-- INSERT INTO `t_book` VALUES ('116', '中国古代史', '5', '40', '18', '电子科技大学', '2013-07-02 00:00:00', '../upload/2013/07/15688400.jpg');
-- INSERT INTO `t_book` VALUES ('119', 'ceshi', '5', '12.5', '12', 'fafafa', '2013-07-01 00:00:00', '../upload/NoImage.jpg');
-- -- ----------------------------
-- -- Table structure for `t_bookclass`
-- -- ----------------------------
-- DROP TABLE IF EXISTS `t_bookclass`;
-- CREATE TABLE `t_bookclass` (
-- `bookClassId` int(11) NOT NULL AUTO_INCREMENT,
-- -- `bookClassName` varchar(50) DEFAULT NULL,
-- `bookClassName` varchar(100) DEFAULT NULL,
-- PRIMARY KEY (`bookClassId`)
-- ) ENGINE=InnoDB AUTO_INCREMENT=26 DEFAULT CHARSET=utf8;
-- -- ----------------------------
-- -- Records of t_bookclass
-- -- ----------------------------
-- INSERT INTO `t_bookclass` VALUES ('5', '历史类');
-- INSERT INTO `t_bookclass` VALUES ('7', '计算机');
-- INSERT INTO `t_bookclass` VALUES ('25', '地理类');
|
{% macro deduplicate_data(column_names, order_by, relation) %}
{% set dedup_query %}
SELECT
* EXCEPT(row_number)
FROM (
SELECT
*,
ROW_NUMBER()
OVER (PARTITION BY {{ column_names }} order by {{ order_by }} desc ) row_number
FROM
{{ relation }}
)
WHERE
row_number = 1
{% endset %}
{{ return(dedup_query) }}
{% endmacro %}
{% macro get_dedup_methods() %}
{{ return(deduplicate_data('payment_method, order_id', 'id', ref('raw_payments'))) }}
{% endmacro %}
|
-- dropSQLIndex.sql --
USE CS144;
ALTER IGNORE TABLE Item DROP INDEX SellerIndex;
ALTER IGNORE TABLE Item DROP INDEX BuyPriceIndex;
ALTER IGNORE TABLE Item DROP INDEX EndTimeIndex;
ALTER IGNORE TABLE Bid DROP INDEX BidderIndex;
|
/****** Object: StoredProcedure [dbo].[prc_CWI_GetJobMediaBuyAttributes] Script Date: 5/13/2014 10:15:27 PM ******/
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[prc_CWI_GetJobMediaBuyAttributes]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[prc_CWI_GetJobMediaBuyAttributes]
GO
/****** Object: StoredProcedure [dbo].[prc_CWI_GetJobMediaBuyAttributes] Script Date: 5/13/2014 10:15:27 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[prc_CWI_GetJobMediaBuyAttributes]') AND type in (N'P', N'PC'))
BEGIN
EXEC dbo.sp_executesql @statement = N'/*******************************************************************
* PROCEDURE: [prc_CWI_GetJobMediaBuyAttributes]
* Purpose : This PROC would be called TO get the media buy attributes
* Invoked from : JobMediaBuyRundate.aspx
* CREATED: Mohankumar 13MAY14
* MODIFICATION HISTORY
* DATE AUTHOR DESCRIPTION
**********************************************************************
Execution example :
**********************************************************************
prc_CWI_GetJobMediaBuyAttributes 123
**********************************************************************/
CREATE PROC [dbo].[prc_CWI_GetJobMediaBuyAttributes]
@inMediaBuyId bigint
AS
BEGIN
SELECT
J.IsCancelled IsJobCancelled ,
J.IsQuote,
J.InvoiceId,
JMB.JobId,
VendorId,
MMRPO,
StatusId,
ExpectedCost,
ExpectedInvoice,
ActualCost,
ActualInvoice,
IsActualCostFreeze,
IsActualInvoiceFreeze,
IsComplimentary,
IsComplimentaryInvoice,
IsRemoved,
DNR,
CancelledDate,
JMB.IsCancelled,
CostType,
QuotedCost,
QuotedDate,
QuotedBy,
JMB.CreatedBy,
JMB.CreatedOn,
JMB.ModifiedBy,
JMB.ModifiedOn,
ActionComment = CASE
WHEN J.InvoiceId IS NOT NULL THEN ''Job is invoiced. ''
WHEN J.iscancelled = 1 THEN ''Job is cancelled. ''
WHEN JMB.IsCancelled = 1 THEN ''Media buy is cancelled. ''
WHEN JMB.IsRemoved = 1 THEN ''Media buy is removed. ''
WHEN JMB.DNR = 1 THEN ''Media buy is DNR. ''
ELSE '''' END
FROM CWI_JobMediaBuy JMB
INNER JOIN CWI_Job J
ON J.Id = JMB.JobId
WHERE
JMB.ID = @inMediaBuyId
END
'
END
GO
|
-- phpMyAdmin SQL Dump
-- version 3.5.2.2
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: Mar 11, 2014 at 08:16 PM
-- Server version: 5.5.27
-- PHP Version: 5.4.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 utf8 */;
--
-- Database: `profile`
--
-- --------------------------------------------------------
--
-- Table structure for table `content_s1`
--
CREATE TABLE IF NOT EXISTS `content_s1` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`heading` varchar(200) NOT NULL,
`content` text NOT NULL,
`order` int(1) NOT NULL,
`visibility` int(1) NOT NULL,
`children` text NOT NULL,
`parent` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=8 ;
--
-- Dumping data for table `content_s1`
--
INSERT INTO `content_s1` (`id`, `heading`, `content`, `order`, `visibility`, `children`, `parent`) VALUES
(1, 'root', '', 1, 1, '2,3,4', 0),
(2, 'project', 'the main projects', 1, 1, '5,6', 1),
(3, 'extra activities', 'the extra curicullar activities', 1, 1, '7', 0),
(4, 'position hold', 'the major position hold', 1, 1, '', 1),
(5, 'festember games', 'made a suedo 3d game for festember without any game engine', 1, 1, '', 2),
(6, 'digital fortress', 'a hacking based event', 1, 1, '', 2),
(7, 'basketball', 'i love playing games when i get free time.', 1, 1, '', 3);
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
--Bitmap Index Examples
CREATE BITMAP INDEX typeid_i ON books (SYS_TYPEID(author));
--The following creates a bitmap index on the table oe.hash_products, which was created in "Hash Partitioning Example":
CREATE BITMAP INDEX product_bm_ix
ON hash_products(list_price)
LOCAL(PARTITION ix_p1 TABLESPACE tbs_01,
PARTITION ix_p2,
PARTITION ix_p3 TABLESPACE tbs_02,
PARTITION ix_p4 TABLESPACE tbs_03)
TABLESPACE tbs_04;
--Because hash_products is a partitioned table, the bitmap join index must be locally partitioned. In this example, the user must have quota on tablespaces specified. See CREATE TABLESPACE for examples that create tablespaces tbs_01, tbs_02, tbs_03, and tbs_04.
--The next series of statements shows how one might create a bitmap join index on a fact table using a join with a dimension table.
CREATE TABLE hash_products
( product_id NUMBER(6)
, product_name VARCHAR2(50)
, product_description VARCHAR2(2000)
, category_id NUMBER(2)
, weight_class NUMBER(1)
, warranty_period INTERVAL YEAR TO MONTH
, supplier_id NUMBER(6)
, product_status VARCHAR2(20)
, list_price NUMBER(8,2)
, min_price NUMBER(8,2)
, catalog_url VARCHAR2(50)
, CONSTRAINT pk_product_id PRIMARY KEY (product_id)
, CONSTRAINT product_status_lov_demo
CHECK (product_status in ('orderable'
,'planned'
,'under development'
,'obsolete')
) )
PARTITION BY HASH (product_id)
PARTITIONS 5
STORE IN (example);
CREATE TABLE sales_quota
( product_id NUMBER(6)
, customer_name VARCHAR2(50)
, order_qty NUMBER(6)
,CONSTRAINT u_product_id UNIQUE(product_id)
);
CREATE BITMAP INDEX product_bm_ix
ON hash_products(list_price)
FROM hash_products h, sales_quota s
WHERE h.product_id = s.product_id
LOCAL(PARTITION ix_p1 TABLESPACE example,
PARTITION ix_p2,
PARTITION ix_p3 TABLESPACE example,
PARTITION ix_p4,
PARTITION ix_p5 TABLESPACE example)
TABLESPACE example;
|
create user bgr@'%' identified by 'alterbo159753';
grant all on hiscore.* to bgr@'%';
select * from record ;
select
*
FROM
record
ORDER BY
score desc
, date DESC
LIMIT 1
;
INSERT INTO
RECORD
VALUES(
'test'
,10
,SYSDATE()
);
select sysdate(); |
CREATE Procedure spr_Vendor_Rating_Items (@Vendor nvarchar(20),
@FromDate Datetime,
@ToDate Datetime)
As
Select Distinct GRNDetail.Product_Code,
"Item Code" = GRNDetail.Product_Code,
"Item Name" = Items.ProductName,
"Quantity Supplied" = Isnull(sum(case Batch_Products.Free
when 0 then
IsNull(Batch_Products.QuantityReceived,0)
End),0),
"Free Quantity" = Isnull(sum(case Batch_Products.Free
when 1 then
IsNull(Batch_Products.QuantityReceived,0)
End),0),
"Value" = IsNull(sum(case Batch_Products.Free
when 0 then
IsNull((Batch_Products.QuantityReceived),0)
End * Batch_Products.PurchasePrice),0)
From GRNDetail, GRNAbstract, Items,Batch_Products Where
GRNAbstract.VendorID = @Vendor And
GRNDetail.GRNID = GRNAbstract.GRNID And
IsNull(GRNAbstract.GRNStatus, 0) & 128 = 0 And
IsNull(GRNAbstract.GRNStatus, 0) & 32 = 0 And
GRNAbstract.GRNDate Between @FromDate And @ToDate And
GRNDetail.Product_Code = Items.Product_Code
And Batch_Products.Product_Code = Items.Product_Code
And GRNAbstract.GRNID = Batch_Products.GRN_ID
group by GRNDetail.Product_Code,Items.ProductName
|
# ************************************************************
# Sequel Pro SQL dump
# Version 4541
#
# http://www.sequelpro.com/
# https://github.com/sequelpro/sequelpro
#
# Host: 127.0.0.1 (MySQL 5.6.26)
# Database: SHOPPING_CART
# Generation Time: 2017-02-22 12:42:34 +0000
# ************************************************************
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
# Dump of table ORDER_DETAILS
# ------------------------------------------------------------
DROP TABLE IF EXISTS `ORDER_DETAILS`;
CREATE TABLE `ORDER_DETAILS` (
`OD_ID` int(11) NOT NULL AUTO_INCREMENT,
`OD_PRODUCT_ID` int(11) NOT NULL,
`OD_QTY` int(3) NOT NULL,
`OD_UNITPRICE` int(11) NOT NULL,
`OD_TOTALPRICE` int(11) NOT NULL,
`OD_ORDER_ID` int(11) NOT NULL,
PRIMARY KEY (`OD_ID`),
KEY `FOREIGN_KEY_OD_PRODUCTID` (`OD_PRODUCT_ID`),
KEY `FOREIGN_KEY_OD_ORDERID` (`OD_ORDER_ID`),
CONSTRAINT `FOREIGN_KEY_OD_ORDERID` FOREIGN KEY (`OD_ORDER_ID`) REFERENCES `ORDERS` (`ORDER_ID`),
CONSTRAINT `FOREIGN_KEY_OD_PRODUCTID` FOREIGN KEY (`OD_PRODUCT_ID`) REFERENCES `PRODUCT` (`PRODUCT_ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
create table chat(
num int primary key auto_increment,
id varchar(20),
regdate datetime,
content varchar(1000)
)
|
ALTER TABLE beancounter_employee ALTER COLUMN "hourly_rate" TYPE numeric(6, 2);
|
/*
* PostgreSQL DML for creating the role and database for Pluralsight's
* course Apache Camel Introduction to Integration. This should be run
* for initial setup or when the database needs to be re-loaded.
*/
-- Role: order
-- Password: order
CREATE ROLE orders LOGIN
ENCRYPTED PASSWORD 'md55f038b5aa5a392661ff3a8494829bd9e'
NOSUPERUSER INHERIT NOCREATEDB NOCREATEROLE NOREPLICATION;
COMMENT ON ROLE orders IS 'Orders role';
-- Database: order
CREATE DATABASE orders
WITH OWNER = orders
ENCODING = 'UTF8'
TABLESPACE = pg_default
LC_COLLATE = 'English_United States.1252'
LC_CTYPE = 'English_United States.1252'
CONNECTION LIMIT = -1;
-- Schema: order
CREATE SCHEMA orders AUTHORIZATION orders;
|
USE taxi;
CREATE TABLE drivers (
id int IDENTITY(1,1) primary key,
name varchar(100) not null,
);
CREATE TABLE cars (
id int IDENTITY(1,1) primary key,
number varchar(100) not null UNIQUE,
);
CREATE TABLE cars_to_drivers (
id int IDENTITY(1,1) primary key,
driver_id int REFERENCES drivers (id),
cars_id int REFERENCES cars (id),
using_time datetime DEFAULT GETDATE()
); |
CREATE TABLE regiao(
id SERIAL PRIMARY KEY,
nome VARCHAR(50) NOT NULL,
geom GEOMETRY NOT NULL
)
|
# ************************************************************
# Sequel Ace SQL dump
# Versión 3034
#
# https://sequel-ace.com/
# https://github.com/Sequel-Ace/Sequel-Ace
#
# Equipo: localhost (MySQL 5.5.5-10.4.18-MariaDB)
# Base de datos: tasca_m8
# Generation Time: 2021-06-17 15:22:59 +0000
# ************************************************************
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
SET NAMES utf8mb4;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE='NO_AUTO_VALUE_ON_ZERO', SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
# Volcado de tabla product
# ------------------------------------------------------------
DROP TABLE IF EXISTS `product`;
CREATE TABLE `product` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(150) NOT NULL DEFAULT '',
`quantity` int(11) NOT NULL,
`price` float NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
LOCK TABLES `product` WRITE;
/*!40000 ALTER TABLE `product` DISABLE KEYS */;
INSERT INTO `product` (`id`, `name`, `quantity`, `price`)
VALUES
(1,'pear',6,0.45),
(2,'flam',1,8),
(3,'milk',4,1.12),
(5,'nesteas',1,6),
(6,'soapp',4,2.5);
/*!40000 ALTER TABLE `product` ENABLE KEYS */;
UNLOCK TABLES;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
INSERT into groups(id, title, description) VALUES (1, 'group1', 'testGroup1');
INSERT into groups(id, title, description) VALUES (2, 'group2', 'testGroup2');
INSERT into groups(id, title, description) VALUES (3, 'group3', 'testGroup3');
|
-- phpMyAdmin SQL Dump
-- version 4.2.12deb2+deb8u1build0.15.04.1
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Dec 17, 2015 at 02:58 PM
-- Server version: 5.6.27-0ubuntu0.15.04.1
-- PHP Version: 5.6.4-4ubuntu6.4
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
--
-- Database: `opendns`
--
-- --------------------------------------------------------
--
-- Table structure for table `links`
--
CREATE TABLE IF NOT EXISTS `links` (
`id` int(6) unsigned NOT NULL,
`link` text NOT NULL,
`safe` enum('true','false') NOT NULL,
`hash` char(32) NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=20 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `links`
--
INSERT INTO `links` (`id`, `link`, `safe`, `hash`) VALUES
(3, 'dsfsdfsf', 'false', '1'),
(4, 'google.com?val=max', 'true', '2'),
(5, 'http://www.google.com:80', 'true', '3'),
(6, 'http://google.com/something/bla', 'false', 'abe80e135510110587e6ad40e40f2ed4'),
(19, 'http://google.com/something/bla/s1', 'true', 'b7c21037cd8d2f4247f07fd4c6ef0b11'),
(18, 'http://google.com/something/bla/s', 'false', 'beb23c3d5c268c73f8cf5143dc228202'),
(8, 'ftp:///max.co', 'false', 'da92cbd57acaadefed56ae6c2979d7f2'),
(7, 'lalala.coo', 'false', 'f8e9248a6b1316e25726168c16e383d8');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `links`
--
ALTER TABLE `links`
ADD PRIMARY KEY (`hash`), ADD UNIQUE KEY `idIndex` (`id`), ADD KEY `hashesIndex` (`hash`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `links`
--
ALTER TABLE `links`
MODIFY `id` int(6) unsigned NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=20;
/*!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 */;
|
.ifndef INCLUDED_CYFITTERGNU_INC
.set INCLUDED_CYFITTERGNU_INC, 1
.include "cydevicegnu_trm.inc"
/* BLE_bless_isr */
.set BLE_bless_isr__INTC_CLR_EN_REG, CYREG_CM0_ICER
.set BLE_bless_isr__INTC_CLR_PD_REG, CYREG_CM0_ICPR
.set BLE_bless_isr__INTC_MASK, 0x1000
.set BLE_bless_isr__INTC_NUMBER, 12
.set BLE_bless_isr__INTC_PRIOR_MASK, 0xC0
.set BLE_bless_isr__INTC_PRIOR_NUM, 3
.set BLE_bless_isr__INTC_PRIOR_REG, CYREG_CM0_IPR3
.set BLE_bless_isr__INTC_SET_EN_REG, CYREG_CM0_ISER
.set BLE_bless_isr__INTC_SET_PD_REG, CYREG_CM0_ISPR
/* BLE_cy_m0s8_ble */
.set BLE_cy_m0s8_ble__ADC_BUMP1, CYREG_BLE_BLERD_ADC_BUMP1
.set BLE_cy_m0s8_ble__ADC_BUMP2, CYREG_BLE_BLERD_ADC_BUMP2
.set BLE_cy_m0s8_ble__ADV_CH_TX_POWER, CYREG_BLE_BLELL_ADV_CH_TX_POWER
.set BLE_cy_m0s8_ble__ADV_CONFIG, CYREG_BLE_BLELL_ADV_CONFIG
.set BLE_cy_m0s8_ble__ADV_INTERVAL_TIMEOUT, CYREG_BLE_BLELL_ADV_INTERVAL_TIMEOUT
.set BLE_cy_m0s8_ble__ADV_INTR, CYREG_BLE_BLELL_ADV_INTR
.set BLE_cy_m0s8_ble__ADV_NEXT_INSTANT, CYREG_BLE_BLELL_ADV_NEXT_INSTANT
.set BLE_cy_m0s8_ble__ADV_PARAMS, CYREG_BLE_BLELL_ADV_PARAMS
.set BLE_cy_m0s8_ble__ADV_SCN_RSP_TX_FIFO, CYREG_BLE_BLELL_ADV_SCN_RSP_TX_FIFO
.set BLE_cy_m0s8_ble__ADV_TX_DATA_FIFO, CYREG_BLE_BLELL_ADV_TX_DATA_FIFO
.set BLE_cy_m0s8_ble__AGC, CYREG_BLE_BLERD_AGC
.set BLE_cy_m0s8_ble__BALUN, CYREG_BLE_BLERD_BALUN
.set BLE_cy_m0s8_ble__BB_BUMP1, CYREG_BLE_BLERD_BB_BUMP1
.set BLE_cy_m0s8_ble__BB_BUMP2, CYREG_BLE_BLERD_BB_BUMP2
.set BLE_cy_m0s8_ble__BB_XO, CYREG_BLE_BLERD_BB_XO
.set BLE_cy_m0s8_ble__BB_XO_CAPTRIM, CYREG_BLE_BLERD_BB_XO_CAPTRIM
.set BLE_cy_m0s8_ble__CE_CNFG_STS_REGISTER, CYREG_BLE_BLELL_CE_CNFG_STS_REGISTER
.set BLE_cy_m0s8_ble__CE_LENGTH, CYREG_BLE_BLELL_CE_LENGTH
.set BLE_cy_m0s8_ble__CFG_1_FCAL, CYREG_BLE_BLERD_CFG_1_FCAL
.set BLE_cy_m0s8_ble__CFG_2_FCAL, CYREG_BLE_BLERD_CFG_2_FCAL
.set BLE_cy_m0s8_ble__CFG_3_FCAL, CYREG_BLE_BLERD_CFG_3_FCAL
.set BLE_cy_m0s8_ble__CFG_4_FCAL, CYREG_BLE_BLERD_CFG_4_FCAL
.set BLE_cy_m0s8_ble__CFG_5_FCAL, CYREG_BLE_BLERD_CFG_5_FCAL
.set BLE_cy_m0s8_ble__CFG_6_FCAL, CYREG_BLE_BLERD_CFG_6_FCAL
.set BLE_cy_m0s8_ble__CFG1, CYREG_BLE_BLERD_CFG1
.set BLE_cy_m0s8_ble__CFG2, CYREG_BLE_BLERD_CFG2
.set BLE_cy_m0s8_ble__CFGCTRL, CYREG_BLE_BLERD_CFGCTRL
.set BLE_cy_m0s8_ble__CLOCK_CONFIG, CYREG_BLE_BLELL_CLOCK_CONFIG
.set BLE_cy_m0s8_ble__COMMAND_REGISTER, CYREG_BLE_BLELL_COMMAND_REGISTER
.set BLE_cy_m0s8_ble__CONN_CE_COUNTER, CYREG_BLE_BLELL_CONN_CE_COUNTER
.set BLE_cy_m0s8_ble__CONN_CE_INSTANT, CYREG_BLE_BLELL_CONN_CE_INSTANT
.set BLE_cy_m0s8_ble__CONN_CH_TX_POWER, CYREG_BLE_BLELL_CONN_CH_TX_POWER
.set BLE_cy_m0s8_ble__CONN_CONFIG, CYREG_BLE_BLELL_CONN_CONFIG
.set BLE_cy_m0s8_ble__CONN_INDEX, CYREG_BLE_BLELL_CONN_INDEX
.set BLE_cy_m0s8_ble__CONN_INTERVAL, CYREG_BLE_BLELL_CONN_INTERVAL
.set BLE_cy_m0s8_ble__CONN_INTR, CYREG_BLE_BLELL_CONN_INTR
.set BLE_cy_m0s8_ble__CONN_INTR_MASK, CYREG_BLE_BLELL_CONN_INTR_MASK
.set BLE_cy_m0s8_ble__CONN_PARAM1, CYREG_BLE_BLELL_CONN_PARAM1
.set BLE_cy_m0s8_ble__CONN_PARAM2, CYREG_BLE_BLELL_CONN_PARAM2
.set BLE_cy_m0s8_ble__CONN_REQ_WORD0, CYREG_BLE_BLELL_CONN_REQ_WORD0
.set BLE_cy_m0s8_ble__CONN_REQ_WORD1, CYREG_BLE_BLELL_CONN_REQ_WORD1
.set BLE_cy_m0s8_ble__CONN_REQ_WORD10, CYREG_BLE_BLELL_CONN_REQ_WORD10
.set BLE_cy_m0s8_ble__CONN_REQ_WORD11, CYREG_BLE_BLELL_CONN_REQ_WORD11
.set BLE_cy_m0s8_ble__CONN_REQ_WORD2, CYREG_BLE_BLELL_CONN_REQ_WORD2
.set BLE_cy_m0s8_ble__CONN_REQ_WORD3, CYREG_BLE_BLELL_CONN_REQ_WORD3
.set BLE_cy_m0s8_ble__CONN_REQ_WORD4, CYREG_BLE_BLELL_CONN_REQ_WORD4
.set BLE_cy_m0s8_ble__CONN_REQ_WORD5, CYREG_BLE_BLELL_CONN_REQ_WORD5
.set BLE_cy_m0s8_ble__CONN_REQ_WORD6, CYREG_BLE_BLELL_CONN_REQ_WORD6
.set BLE_cy_m0s8_ble__CONN_REQ_WORD7, CYREG_BLE_BLELL_CONN_REQ_WORD7
.set BLE_cy_m0s8_ble__CONN_REQ_WORD8, CYREG_BLE_BLELL_CONN_REQ_WORD8
.set BLE_cy_m0s8_ble__CONN_REQ_WORD9, CYREG_BLE_BLELL_CONN_REQ_WORD9
.set BLE_cy_m0s8_ble__CONN_RXMEM_BASE_ADDR, CYREG_BLE_BLELL_CONN_RXMEM_BASE_ADDR
.set BLE_cy_m0s8_ble__CONN_STATUS, CYREG_BLE_BLELL_CONN_STATUS
.set BLE_cy_m0s8_ble__CONN_TXMEM_BASE_ADDR, CYREG_BLE_BLELL_CONN_TXMEM_BASE_ADDR
.set BLE_cy_m0s8_ble__CONN_UPDATE_NEW_INTERVAL, CYREG_BLE_BLELL_CONN_UPDATE_NEW_INTERVAL
.set BLE_cy_m0s8_ble__CONN_UPDATE_NEW_LATENCY, CYREG_BLE_BLELL_CONN_UPDATE_NEW_LATENCY
.set BLE_cy_m0s8_ble__CONN_UPDATE_NEW_SL_INTERVAL, CYREG_BLE_BLELL_CONN_UPDATE_NEW_SL_INTERVAL
.set BLE_cy_m0s8_ble__CONN_UPDATE_NEW_SUP_TO, CYREG_BLE_BLELL_CONN_UPDATE_NEW_SUP_TO
.set BLE_cy_m0s8_ble__CTR1, CYREG_BLE_BLERD_CTR1
.set BLE_cy_m0s8_ble__DATA_CHANNELS_H0, CYREG_BLE_BLELL_DATA_CHANNELS_H0
.set BLE_cy_m0s8_ble__DATA_CHANNELS_H1, CYREG_BLE_BLELL_DATA_CHANNELS_H1
.set BLE_cy_m0s8_ble__DATA_CHANNELS_L0, CYREG_BLE_BLELL_DATA_CHANNELS_L0
.set BLE_cy_m0s8_ble__DATA_CHANNELS_L1, CYREG_BLE_BLELL_DATA_CHANNELS_L1
.set BLE_cy_m0s8_ble__DATA_CHANNELS_M0, CYREG_BLE_BLELL_DATA_CHANNELS_M0
.set BLE_cy_m0s8_ble__DATA_CHANNELS_M1, CYREG_BLE_BLELL_DATA_CHANNELS_M1
.set BLE_cy_m0s8_ble__DATA_LIST_ACK_UPDATE__STATUS, CYREG_BLE_BLELL_DATA_LIST_ACK_UPDATE__STATUS
.set BLE_cy_m0s8_ble__DATA_LIST_SENT_UPDATE__STATUS, CYREG_BLE_BLELL_DATA_LIST_SENT_UPDATE__STATUS
.set BLE_cy_m0s8_ble__DATA_MEM_DESCRIPTOR0, CYREG_BLE_BLELL_DATA_MEM_DESCRIPTOR0
.set BLE_cy_m0s8_ble__DATA_MEM_DESCRIPTOR1, CYREG_BLE_BLELL_DATA_MEM_DESCRIPTOR1
.set BLE_cy_m0s8_ble__DATA_MEM_DESCRIPTOR2, CYREG_BLE_BLELL_DATA_MEM_DESCRIPTOR2
.set BLE_cy_m0s8_ble__DATA_MEM_DESCRIPTOR3, CYREG_BLE_BLELL_DATA_MEM_DESCRIPTOR3
.set BLE_cy_m0s8_ble__DATA_MEM_DESCRIPTOR4, CYREG_BLE_BLELL_DATA_MEM_DESCRIPTOR4
.set BLE_cy_m0s8_ble__DATA0, CYREG_BLE_BLELL_DATA0
.set BLE_cy_m0s8_ble__DATA1, CYREG_BLE_BLELL_DATA1
.set BLE_cy_m0s8_ble__DATA10, CYREG_BLE_BLELL_DATA10
.set BLE_cy_m0s8_ble__DATA11, CYREG_BLE_BLELL_DATA11
.set BLE_cy_m0s8_ble__DATA12, CYREG_BLE_BLELL_DATA12
.set BLE_cy_m0s8_ble__DATA13, CYREG_BLE_BLELL_DATA13
.set BLE_cy_m0s8_ble__DATA2, CYREG_BLE_BLELL_DATA2
.set BLE_cy_m0s8_ble__DATA3, CYREG_BLE_BLELL_DATA3
.set BLE_cy_m0s8_ble__DATA4, CYREG_BLE_BLELL_DATA4
.set BLE_cy_m0s8_ble__DATA5, CYREG_BLE_BLELL_DATA5
.set BLE_cy_m0s8_ble__DATA6, CYREG_BLE_BLELL_DATA6
.set BLE_cy_m0s8_ble__DATA7, CYREG_BLE_BLELL_DATA7
.set BLE_cy_m0s8_ble__DATA8, CYREG_BLE_BLELL_DATA8
.set BLE_cy_m0s8_ble__DATA9, CYREG_BLE_BLELL_DATA9
.set BLE_cy_m0s8_ble__DBG_1, CYREG_BLE_BLERD_DBG_1
.set BLE_cy_m0s8_ble__DBG_2, CYREG_BLE_BLERD_DBG_2
.set BLE_cy_m0s8_ble__DBG_3, CYREG_BLE_BLERD_DBG_3
.set BLE_cy_m0s8_ble__DBG_BB, CYREG_BLE_BLERD_DBG_BB
.set BLE_cy_m0s8_ble__DBUS, CYREG_BLE_BLERD_DBUS
.set BLE_cy_m0s8_ble__DC, CYREG_BLE_BLERD_DC
.set BLE_cy_m0s8_ble__DCCAL, CYREG_BLE_BLERD_DCCAL
.set BLE_cy_m0s8_ble__DEV_PUB_ADDR_H, CYREG_BLE_BLELL_DEV_PUB_ADDR_H
.set BLE_cy_m0s8_ble__DEV_PUB_ADDR_L, CYREG_BLE_BLELL_DEV_PUB_ADDR_L
.set BLE_cy_m0s8_ble__DEV_PUB_ADDR_M, CYREG_BLE_BLELL_DEV_PUB_ADDR_M
.set BLE_cy_m0s8_ble__DEVICE_RAND_ADDR_H, CYREG_BLE_BLELL_DEVICE_RAND_ADDR_H
.set BLE_cy_m0s8_ble__DEVICE_RAND_ADDR_L, CYREG_BLE_BLELL_DEVICE_RAND_ADDR_L
.set BLE_cy_m0s8_ble__DEVICE_RAND_ADDR_M, CYREG_BLE_BLELL_DEVICE_RAND_ADDR_M
.set BLE_cy_m0s8_ble__DIAG1, CYREG_BLE_BLERD_DIAG1
.set BLE_cy_m0s8_ble__DPLL_CONFIG, CYREG_BLE_BLELL_DPLL_CONFIG
.set BLE_cy_m0s8_ble__DSM1, CYREG_BLE_BLERD_DSM1
.set BLE_cy_m0s8_ble__DSM2, CYREG_BLE_BLERD_DSM2
.set BLE_cy_m0s8_ble__DSM3, CYREG_BLE_BLERD_DSM3
.set BLE_cy_m0s8_ble__DSM4, CYREG_BLE_BLERD_DSM4
.set BLE_cy_m0s8_ble__DSM5, CYREG_BLE_BLERD_DSM5
.set BLE_cy_m0s8_ble__DSM6, CYREG_BLE_BLERD_DSM6
.set BLE_cy_m0s8_ble__DTM_RX_PKT_COUNT, CYREG_BLE_BLELL_DTM_RX_PKT_COUNT
.set BLE_cy_m0s8_ble__ENC_CONFIG, CYREG_BLE_BLELL_ENC_CONFIG
.set BLE_cy_m0s8_ble__ENC_INTR, CYREG_BLE_BLELL_ENC_INTR
.set BLE_cy_m0s8_ble__ENC_INTR_EN, CYREG_BLE_BLELL_ENC_INTR_EN
.set BLE_cy_m0s8_ble__ENC_KEY0, CYREG_BLE_BLELL_ENC_KEY0
.set BLE_cy_m0s8_ble__ENC_KEY1, CYREG_BLE_BLELL_ENC_KEY1
.set BLE_cy_m0s8_ble__ENC_KEY2, CYREG_BLE_BLELL_ENC_KEY2
.set BLE_cy_m0s8_ble__ENC_KEY3, CYREG_BLE_BLELL_ENC_KEY3
.set BLE_cy_m0s8_ble__ENC_KEY4, CYREG_BLE_BLELL_ENC_KEY4
.set BLE_cy_m0s8_ble__ENC_KEY5, CYREG_BLE_BLELL_ENC_KEY5
.set BLE_cy_m0s8_ble__ENC_KEY6, CYREG_BLE_BLELL_ENC_KEY6
.set BLE_cy_m0s8_ble__ENC_KEY7, CYREG_BLE_BLELL_ENC_KEY7
.set BLE_cy_m0s8_ble__ENC_PARAMS, CYREG_BLE_BLELL_ENC_PARAMS
.set BLE_cy_m0s8_ble__EVENT_ENABLE, CYREG_BLE_BLELL_EVENT_ENABLE
.set BLE_cy_m0s8_ble__EVENT_INTR, CYREG_BLE_BLELL_EVENT_INTR
.set BLE_cy_m0s8_ble__FCAL_TEST, CYREG_BLE_BLERD_FCAL_TEST
.set BLE_cy_m0s8_ble__FPD_TEST, CYREG_BLE_BLERD_FPD_TEST
.set BLE_cy_m0s8_ble__FSM, CYREG_BLE_BLERD_FSM
.set BLE_cy_m0s8_ble__IM, CYREG_BLE_BLERD_IM
.set BLE_cy_m0s8_ble__INIT_CONFIG, CYREG_BLE_BLELL_INIT_CONFIG
.set BLE_cy_m0s8_ble__INIT_INTERVAL, CYREG_BLE_BLELL_INIT_INTERVAL
.set BLE_cy_m0s8_ble__INIT_INTR, CYREG_BLE_BLELL_INIT_INTR
.set BLE_cy_m0s8_ble__INIT_NEXT_INSTANT, CYREG_BLE_BLELL_INIT_NEXT_INSTANT
.set BLE_cy_m0s8_ble__INIT_PARAM, CYREG_BLE_BLELL_INIT_PARAM
.set BLE_cy_m0s8_ble__INIT_SCN_ADV_RX_FIFO, CYREG_BLE_BLELL_INIT_SCN_ADV_RX_FIFO
.set BLE_cy_m0s8_ble__INIT_WINDOW, CYREG_BLE_BLELL_INIT_WINDOW
.set BLE_cy_m0s8_ble__IQMIS, CYREG_BLE_BLERD_IQMIS
.set BLE_cy_m0s8_ble__IV_MASTER0, CYREG_BLE_BLELL_IV_MASTER0
.set BLE_cy_m0s8_ble__IV_MASTER1, CYREG_BLE_BLELL_IV_MASTER1
.set BLE_cy_m0s8_ble__IV_SLAVE0, CYREG_BLE_BLELL_IV_SLAVE0
.set BLE_cy_m0s8_ble__IV_SLAVE1, CYREG_BLE_BLELL_IV_SLAVE1
.set BLE_cy_m0s8_ble__KVCAL, CYREG_BLE_BLERD_KVCAL
.set BLE_cy_m0s8_ble__LDO, CYREG_BLE_BLERD_LDO
.set BLE_cy_m0s8_ble__LDO_BYPASS, CYREG_BLE_BLERD_LDO_BYPASS
.set BLE_cy_m0s8_ble__LE_PING_TIMER_ADDR, CYREG_BLE_BLELL_LE_PING_TIMER_ADDR
.set BLE_cy_m0s8_ble__LE_PING_TIMER_NEXT_EXP, CYREG_BLE_BLELL_LE_PING_TIMER_NEXT_EXP
.set BLE_cy_m0s8_ble__LE_PING_TIMER_OFFSET, CYREG_BLE_BLELL_LE_PING_TIMER_OFFSET
.set BLE_cy_m0s8_ble__LE_PING_TIMER_WRAP_COUNT, CYREG_BLE_BLELL_LE_PING_TIMER_WRAP_COUNT
.set BLE_cy_m0s8_ble__LE_RF_TEST_MODE, CYREG_BLE_BLELL_LE_RF_TEST_MODE
.set BLE_cy_m0s8_ble__LF_CLK_CTRL, CYREG_BLE_BLESS_LF_CLK_CTRL
.set BLE_cy_m0s8_ble__LL_CLK_EN, CYREG_BLE_BLESS_LL_CLK_EN
.set BLE_cy_m0s8_ble__LL_DSM_CTRL, CYREG_BLE_BLESS_LL_DSM_CTRL
.set BLE_cy_m0s8_ble__LL_DSM_INTR_STAT, CYREG_BLE_BLESS_LL_DSM_INTR_STAT
.set BLE_cy_m0s8_ble__LLH_FEATURE_CONFIG, CYREG_BLE_BLELL_LLH_FEATURE_CONFIG
.set BLE_cy_m0s8_ble__MIC_IN0, CYREG_BLE_BLELL_MIC_IN0
.set BLE_cy_m0s8_ble__MIC_IN1, CYREG_BLE_BLELL_MIC_IN1
.set BLE_cy_m0s8_ble__MIC_OUT0, CYREG_BLE_BLELL_MIC_OUT0
.set BLE_cy_m0s8_ble__MIC_OUT1, CYREG_BLE_BLELL_MIC_OUT1
.set BLE_cy_m0s8_ble__MODEM, CYREG_BLE_BLERD_MODEM
.set BLE_cy_m0s8_ble__MONI, CYREG_BLE_BLERD_MONI
.set BLE_cy_m0s8_ble__NEXT_CE_INSTANT, CYREG_BLE_BLELL_NEXT_CE_INSTANT
.set BLE_cy_m0s8_ble__NEXT_RESP_TIMER_EXP, CYREG_BLE_BLELL_NEXT_RESP_TIMER_EXP
.set BLE_cy_m0s8_ble__NEXT_SUP_TO, CYREG_BLE_BLELL_NEXT_SUP_TO
.set BLE_cy_m0s8_ble__OFFSET_TO_FIRST_INSTANT, CYREG_BLE_BLELL_OFFSET_TO_FIRST_INSTANT
.set BLE_cy_m0s8_ble__PACKET_COUNTER0, CYREG_BLE_BLELL_PACKET_COUNTER0
.set BLE_cy_m0s8_ble__PACKET_COUNTER1, CYREG_BLE_BLELL_PACKET_COUNTER1
.set BLE_cy_m0s8_ble__PACKET_COUNTER2, CYREG_BLE_BLELL_PACKET_COUNTER2
.set BLE_cy_m0s8_ble__PDU_ACCESS_ADDR_H_REGISTER, CYREG_BLE_BLELL_PDU_ACCESS_ADDR_H_REGISTER
.set BLE_cy_m0s8_ble__PDU_ACCESS_ADDR_L_REGISTER, CYREG_BLE_BLELL_PDU_ACCESS_ADDR_L_REGISTER
.set BLE_cy_m0s8_ble__PDU_RESP_TIMER, CYREG_BLE_BLELL_PDU_RESP_TIMER
.set BLE_cy_m0s8_ble__PEER_ADDR_H, CYREG_BLE_BLELL_PEER_ADDR_H
.set BLE_cy_m0s8_ble__PEER_ADDR_L, CYREG_BLE_BLELL_PEER_ADDR_L
.set BLE_cy_m0s8_ble__PEER_ADDR_M, CYREG_BLE_BLELL_PEER_ADDR_M
.set BLE_cy_m0s8_ble__POC_REG__TIM_CONTROL, CYREG_BLE_BLELL_POC_REG__TIM_CONTROL
.set BLE_cy_m0s8_ble__RCCAL, CYREG_BLE_BLERD_RCCAL
.set BLE_cy_m0s8_ble__READ_IQ_1, CYREG_BLE_BLERD_READ_IQ_1
.set BLE_cy_m0s8_ble__READ_IQ_2, CYREG_BLE_BLERD_READ_IQ_2
.set BLE_cy_m0s8_ble__READ_IQ_3, CYREG_BLE_BLERD_READ_IQ_3
.set BLE_cy_m0s8_ble__READ_IQ_4, CYREG_BLE_BLERD_READ_IQ_4
.set BLE_cy_m0s8_ble__RECEIVE_TRIG_CTRL, CYREG_BLE_BLELL_RECEIVE_TRIG_CTRL
.set BLE_cy_m0s8_ble__RF_CONFIG, CYREG_BLE_BLESS_RF_CONFIG
.set BLE_cy_m0s8_ble__RMAP, CYREG_BLE_BLERD_RMAP
.set BLE_cy_m0s8_ble__RSSI, CYREG_BLE_BLERD_RSSI
.set BLE_cy_m0s8_ble__RX, CYREG_BLE_BLERD_RX
.set BLE_cy_m0s8_ble__RX_BUMP1, CYREG_BLE_BLERD_RX_BUMP1
.set BLE_cy_m0s8_ble__RX_BUMP2, CYREG_BLE_BLERD_RX_BUMP2
.set BLE_cy_m0s8_ble__SCAN_CONFIG, CYREG_BLE_BLELL_SCAN_CONFIG
.set BLE_cy_m0s8_ble__SCAN_INTERVAL, CYREG_BLE_BLELL_SCAN_INTERVAL
.set BLE_cy_m0s8_ble__SCAN_INTR, CYREG_BLE_BLELL_SCAN_INTR
.set BLE_cy_m0s8_ble__SCAN_NEXT_INSTANT, CYREG_BLE_BLELL_SCAN_NEXT_INSTANT
.set BLE_cy_m0s8_ble__SCAN_PARAM, CYREG_BLE_BLELL_SCAN_PARAM
.set BLE_cy_m0s8_ble__SCAN_WINDOW, CYREG_BLE_BLELL_SCAN_WINDOW
.set BLE_cy_m0s8_ble__SL_CONN_INTERVAL, CYREG_BLE_BLELL_SL_CONN_INTERVAL
.set BLE_cy_m0s8_ble__SLAVE_LATENCY, CYREG_BLE_BLELL_SLAVE_LATENCY
.set BLE_cy_m0s8_ble__SLAVE_TIMING_CONTROL, CYREG_BLE_BLELL_SLAVE_TIMING_CONTROL
.set BLE_cy_m0s8_ble__SLV_WIN_ADJ, CYREG_BLE_BLELL_SLV_WIN_ADJ
.set BLE_cy_m0s8_ble__SUP_TIMEOUT, CYREG_BLE_BLELL_SUP_TIMEOUT
.set BLE_cy_m0s8_ble__SY, CYREG_BLE_BLERD_SY
.set BLE_cy_m0s8_ble__SY_BUMP1, CYREG_BLE_BLERD_SY_BUMP1
.set BLE_cy_m0s8_ble__SY_BUMP2, CYREG_BLE_BLERD_SY_BUMP2
.set BLE_cy_m0s8_ble__TEST, CYREG_BLE_BLERD_TEST
.set BLE_cy_m0s8_ble__TEST2_SY, CYREG_BLE_BLERD_TEST2_SY
.set BLE_cy_m0s8_ble__THRSHD1, CYREG_BLE_BLERD_THRSHD1
.set BLE_cy_m0s8_ble__THRSHD2, CYREG_BLE_BLERD_THRSHD2
.set BLE_cy_m0s8_ble__THRSHD3, CYREG_BLE_BLERD_THRSHD3
.set BLE_cy_m0s8_ble__THRSHD4, CYREG_BLE_BLERD_THRSHD4
.set BLE_cy_m0s8_ble__THRSHD5, CYREG_BLE_BLERD_THRSHD5
.set BLE_cy_m0s8_ble__TIM_COUNTER_L, CYREG_BLE_BLELL_TIM_COUNTER_L
.set BLE_cy_m0s8_ble__TRANSMIT_WINDOW_OFFSET, CYREG_BLE_BLELL_TRANSMIT_WINDOW_OFFSET
.set BLE_cy_m0s8_ble__TRANSMIT_WINDOW_SIZE, CYREG_BLE_BLELL_TRANSMIT_WINDOW_SIZE
.set BLE_cy_m0s8_ble__TX, CYREG_BLE_BLERD_TX
.set BLE_cy_m0s8_ble__TX_BUMP1, CYREG_BLE_BLERD_TX_BUMP1
.set BLE_cy_m0s8_ble__TX_BUMP2, CYREG_BLE_BLERD_TX_BUMP2
.set BLE_cy_m0s8_ble__TX_EN_EXT_DELAY, CYREG_BLE_BLELL_TX_EN_EXT_DELAY
.set BLE_cy_m0s8_ble__TX_RX_ON_DELAY, CYREG_BLE_BLELL_TX_RX_ON_DELAY
.set BLE_cy_m0s8_ble__TX_RX_SYNTH_DELAY, CYREG_BLE_BLELL_TX_RX_SYNTH_DELAY
.set BLE_cy_m0s8_ble__TXRX_HOP, CYREG_BLE_BLELL_TXRX_HOP
.set BLE_cy_m0s8_ble__WAKEUP_CONFIG, CYREG_BLE_BLELL_WAKEUP_CONFIG
.set BLE_cy_m0s8_ble__WAKEUP_CONTROL, CYREG_BLE_BLELL_WAKEUP_CONTROL
.set BLE_cy_m0s8_ble__WCO_CONFIG, CYREG_BLE_BLESS_WCO_CONFIG
.set BLE_cy_m0s8_ble__WCO_STATUS, CYREG_BLE_BLESS_WCO_STATUS
.set BLE_cy_m0s8_ble__WCO_TRIM, CYREG_BLE_BLESS_WCO_TRIM
.set BLE_cy_m0s8_ble__WHITELIST_BASE_ADDR, CYREG_BLE_BLELL_WHITELIST_BASE_ADDR
.set BLE_cy_m0s8_ble__WIN_MIN_STEP_SIZE, CYREG_BLE_BLELL_WIN_MIN_STEP_SIZE
.set BLE_cy_m0s8_ble__WINDOW_WIDEN_INTVL, CYREG_BLE_BLELL_WINDOW_WIDEN_INTVL
.set BLE_cy_m0s8_ble__WINDOW_WIDEN_WINOFF, CYREG_BLE_BLELL_WINDOW_WIDEN_WINOFF
.set BLE_cy_m0s8_ble__WL_ADDR_TYPE, CYREG_BLE_BLELL_WL_ADDR_TYPE
.set BLE_cy_m0s8_ble__WL_ENABLE, CYREG_BLE_BLELL_WL_ENABLE
.set BLE_cy_m0s8_ble__XTAL_CLK_DIV_CONFIG, CYREG_BLE_BLESS_XTAL_CLK_DIV_CONFIG
/* CTS */
.set CTS__0__DR, CYREG_GPIO_PRT2_DR
.set CTS__0__DR_CLR, CYREG_GPIO_PRT2_DR_CLR
.set CTS__0__DR_INV, CYREG_GPIO_PRT2_DR_INV
.set CTS__0__DR_SET, CYREG_GPIO_PRT2_DR_SET
.set CTS__0__HSIOM, CYREG_HSIOM_PORT_SEL2
.set CTS__0__HSIOM_MASK, 0x0000F000
.set CTS__0__HSIOM_SHIFT, 12
.set CTS__0__INTCFG, CYREG_GPIO_PRT2_INTR_CFG
.set CTS__0__INTR, CYREG_GPIO_PRT2_INTR
.set CTS__0__INTR_CFG, CYREG_GPIO_PRT2_INTR_CFG
.set CTS__0__INTSTAT, CYREG_GPIO_PRT2_INTR
.set CTS__0__MASK, 0x08
.set CTS__0__PA__CFG0, CYREG_UDB_PA2_CFG0
.set CTS__0__PA__CFG1, CYREG_UDB_PA2_CFG1
.set CTS__0__PA__CFG10, CYREG_UDB_PA2_CFG10
.set CTS__0__PA__CFG11, CYREG_UDB_PA2_CFG11
.set CTS__0__PA__CFG12, CYREG_UDB_PA2_CFG12
.set CTS__0__PA__CFG13, CYREG_UDB_PA2_CFG13
.set CTS__0__PA__CFG14, CYREG_UDB_PA2_CFG14
.set CTS__0__PA__CFG2, CYREG_UDB_PA2_CFG2
.set CTS__0__PA__CFG3, CYREG_UDB_PA2_CFG3
.set CTS__0__PA__CFG4, CYREG_UDB_PA2_CFG4
.set CTS__0__PA__CFG5, CYREG_UDB_PA2_CFG5
.set CTS__0__PA__CFG6, CYREG_UDB_PA2_CFG6
.set CTS__0__PA__CFG7, CYREG_UDB_PA2_CFG7
.set CTS__0__PA__CFG8, CYREG_UDB_PA2_CFG8
.set CTS__0__PA__CFG9, CYREG_UDB_PA2_CFG9
.set CTS__0__PC, CYREG_GPIO_PRT2_PC
.set CTS__0__PC2, CYREG_GPIO_PRT2_PC2
.set CTS__0__PORT, 2
.set CTS__0__PS, CYREG_GPIO_PRT2_PS
.set CTS__0__SHIFT, 3
.set CTS__DR, CYREG_GPIO_PRT2_DR
.set CTS__DR_CLR, CYREG_GPIO_PRT2_DR_CLR
.set CTS__DR_INV, CYREG_GPIO_PRT2_DR_INV
.set CTS__DR_SET, CYREG_GPIO_PRT2_DR_SET
.set CTS__INTCFG, CYREG_GPIO_PRT2_INTR_CFG
.set CTS__INTR, CYREG_GPIO_PRT2_INTR
.set CTS__INTR_CFG, CYREG_GPIO_PRT2_INTR_CFG
.set CTS__INTSTAT, CYREG_GPIO_PRT2_INTR
.set CTS__MASK, 0x08
.set CTS__PA__CFG0, CYREG_UDB_PA2_CFG0
.set CTS__PA__CFG1, CYREG_UDB_PA2_CFG1
.set CTS__PA__CFG10, CYREG_UDB_PA2_CFG10
.set CTS__PA__CFG11, CYREG_UDB_PA2_CFG11
.set CTS__PA__CFG12, CYREG_UDB_PA2_CFG12
.set CTS__PA__CFG13, CYREG_UDB_PA2_CFG13
.set CTS__PA__CFG14, CYREG_UDB_PA2_CFG14
.set CTS__PA__CFG2, CYREG_UDB_PA2_CFG2
.set CTS__PA__CFG3, CYREG_UDB_PA2_CFG3
.set CTS__PA__CFG4, CYREG_UDB_PA2_CFG4
.set CTS__PA__CFG5, CYREG_UDB_PA2_CFG5
.set CTS__PA__CFG6, CYREG_UDB_PA2_CFG6
.set CTS__PA__CFG7, CYREG_UDB_PA2_CFG7
.set CTS__PA__CFG8, CYREG_UDB_PA2_CFG8
.set CTS__PA__CFG9, CYREG_UDB_PA2_CFG9
.set CTS__PC, CYREG_GPIO_PRT2_PC
.set CTS__PC2, CYREG_GPIO_PRT2_PC2
.set CTS__PORT, 2
.set CTS__PS, CYREG_GPIO_PRT2_PS
.set CTS__SHIFT, 3
/* UART_rx_wake */
.set UART_rx_wake__0__DR, CYREG_GPIO_PRT3_DR
.set UART_rx_wake__0__DR_CLR, CYREG_GPIO_PRT3_DR_CLR
.set UART_rx_wake__0__DR_INV, CYREG_GPIO_PRT3_DR_INV
.set UART_rx_wake__0__DR_SET, CYREG_GPIO_PRT3_DR_SET
.set UART_rx_wake__0__HSIOM, CYREG_HSIOM_PORT_SEL3
.set UART_rx_wake__0__HSIOM_GPIO, 0
.set UART_rx_wake__0__HSIOM_I2C, 14
.set UART_rx_wake__0__HSIOM_I2C_SDA, 14
.set UART_rx_wake__0__HSIOM_MASK, 0x000F0000
.set UART_rx_wake__0__HSIOM_SHIFT, 16
.set UART_rx_wake__0__HSIOM_UART, 9
.set UART_rx_wake__0__HSIOM_UART_RX, 9
.set UART_rx_wake__0__INTCFG, CYREG_GPIO_PRT3_INTR_CFG
.set UART_rx_wake__0__INTR, CYREG_GPIO_PRT3_INTR
.set UART_rx_wake__0__INTR_CFG, CYREG_GPIO_PRT3_INTR_CFG
.set UART_rx_wake__0__INTSTAT, CYREG_GPIO_PRT3_INTR
.set UART_rx_wake__0__MASK, 0x10
.set UART_rx_wake__0__PA__CFG0, CYREG_UDB_PA3_CFG0
.set UART_rx_wake__0__PA__CFG1, CYREG_UDB_PA3_CFG1
.set UART_rx_wake__0__PA__CFG10, CYREG_UDB_PA3_CFG10
.set UART_rx_wake__0__PA__CFG11, CYREG_UDB_PA3_CFG11
.set UART_rx_wake__0__PA__CFG12, CYREG_UDB_PA3_CFG12
.set UART_rx_wake__0__PA__CFG13, CYREG_UDB_PA3_CFG13
.set UART_rx_wake__0__PA__CFG14, CYREG_UDB_PA3_CFG14
.set UART_rx_wake__0__PA__CFG2, CYREG_UDB_PA3_CFG2
.set UART_rx_wake__0__PA__CFG3, CYREG_UDB_PA3_CFG3
.set UART_rx_wake__0__PA__CFG4, CYREG_UDB_PA3_CFG4
.set UART_rx_wake__0__PA__CFG5, CYREG_UDB_PA3_CFG5
.set UART_rx_wake__0__PA__CFG6, CYREG_UDB_PA3_CFG6
.set UART_rx_wake__0__PA__CFG7, CYREG_UDB_PA3_CFG7
.set UART_rx_wake__0__PA__CFG8, CYREG_UDB_PA3_CFG8
.set UART_rx_wake__0__PA__CFG9, CYREG_UDB_PA3_CFG9
.set UART_rx_wake__0__PC, CYREG_GPIO_PRT3_PC
.set UART_rx_wake__0__PC2, CYREG_GPIO_PRT3_PC2
.set UART_rx_wake__0__PORT, 3
.set UART_rx_wake__0__PS, CYREG_GPIO_PRT3_PS
.set UART_rx_wake__0__SHIFT, 4
.set UART_rx_wake__DR, CYREG_GPIO_PRT3_DR
.set UART_rx_wake__DR_CLR, CYREG_GPIO_PRT3_DR_CLR
.set UART_rx_wake__DR_INV, CYREG_GPIO_PRT3_DR_INV
.set UART_rx_wake__DR_SET, CYREG_GPIO_PRT3_DR_SET
.set UART_rx_wake__INTCFG, CYREG_GPIO_PRT3_INTR_CFG
.set UART_rx_wake__INTR, CYREG_GPIO_PRT3_INTR
.set UART_rx_wake__INTR_CFG, CYREG_GPIO_PRT3_INTR_CFG
.set UART_rx_wake__INTSTAT, CYREG_GPIO_PRT3_INTR
.set UART_rx_wake__MASK, 0x10
.set UART_rx_wake__PA__CFG0, CYREG_UDB_PA3_CFG0
.set UART_rx_wake__PA__CFG1, CYREG_UDB_PA3_CFG1
.set UART_rx_wake__PA__CFG10, CYREG_UDB_PA3_CFG10
.set UART_rx_wake__PA__CFG11, CYREG_UDB_PA3_CFG11
.set UART_rx_wake__PA__CFG12, CYREG_UDB_PA3_CFG12
.set UART_rx_wake__PA__CFG13, CYREG_UDB_PA3_CFG13
.set UART_rx_wake__PA__CFG14, CYREG_UDB_PA3_CFG14
.set UART_rx_wake__PA__CFG2, CYREG_UDB_PA3_CFG2
.set UART_rx_wake__PA__CFG3, CYREG_UDB_PA3_CFG3
.set UART_rx_wake__PA__CFG4, CYREG_UDB_PA3_CFG4
.set UART_rx_wake__PA__CFG5, CYREG_UDB_PA3_CFG5
.set UART_rx_wake__PA__CFG6, CYREG_UDB_PA3_CFG6
.set UART_rx_wake__PA__CFG7, CYREG_UDB_PA3_CFG7
.set UART_rx_wake__PA__CFG8, CYREG_UDB_PA3_CFG8
.set UART_rx_wake__PA__CFG9, CYREG_UDB_PA3_CFG9
.set UART_rx_wake__PC, CYREG_GPIO_PRT3_PC
.set UART_rx_wake__PC2, CYREG_GPIO_PRT3_PC2
.set UART_rx_wake__PORT, 3
.set UART_rx_wake__PS, CYREG_GPIO_PRT3_PS
.set UART_rx_wake__SHIFT, 4
.set UART_rx_wake__SNAP, CYREG_GPIO_PRT3_INTR
/* UART_RX_WAKEUP_IRQ */
.set UART_RX_WAKEUP_IRQ__INTC_CLR_EN_REG, CYREG_CM0_ICER
.set UART_RX_WAKEUP_IRQ__INTC_CLR_PD_REG, CYREG_CM0_ICPR
.set UART_RX_WAKEUP_IRQ__INTC_MASK, 0x08
.set UART_RX_WAKEUP_IRQ__INTC_NUMBER, 3
.set UART_RX_WAKEUP_IRQ__INTC_PRIOR_MASK, 0xC0000000
.set UART_RX_WAKEUP_IRQ__INTC_PRIOR_NUM, 3
.set UART_RX_WAKEUP_IRQ__INTC_PRIOR_REG, CYREG_CM0_IPR0
.set UART_RX_WAKEUP_IRQ__INTC_SET_EN_REG, CYREG_CM0_ISER
.set UART_RX_WAKEUP_IRQ__INTC_SET_PD_REG, CYREG_CM0_ISPR
/* UART_SCB */
.set UART_SCB__CTRL, CYREG_SCB1_CTRL
.set UART_SCB__EZ_DATA0, CYREG_SCB1_EZ_DATA0
.set UART_SCB__EZ_DATA1, CYREG_SCB1_EZ_DATA1
.set UART_SCB__EZ_DATA10, CYREG_SCB1_EZ_DATA10
.set UART_SCB__EZ_DATA11, CYREG_SCB1_EZ_DATA11
.set UART_SCB__EZ_DATA12, CYREG_SCB1_EZ_DATA12
.set UART_SCB__EZ_DATA13, CYREG_SCB1_EZ_DATA13
.set UART_SCB__EZ_DATA14, CYREG_SCB1_EZ_DATA14
.set UART_SCB__EZ_DATA15, CYREG_SCB1_EZ_DATA15
.set UART_SCB__EZ_DATA16, CYREG_SCB1_EZ_DATA16
.set UART_SCB__EZ_DATA17, CYREG_SCB1_EZ_DATA17
.set UART_SCB__EZ_DATA18, CYREG_SCB1_EZ_DATA18
.set UART_SCB__EZ_DATA19, CYREG_SCB1_EZ_DATA19
.set UART_SCB__EZ_DATA2, CYREG_SCB1_EZ_DATA2
.set UART_SCB__EZ_DATA20, CYREG_SCB1_EZ_DATA20
.set UART_SCB__EZ_DATA21, CYREG_SCB1_EZ_DATA21
.set UART_SCB__EZ_DATA22, CYREG_SCB1_EZ_DATA22
.set UART_SCB__EZ_DATA23, CYREG_SCB1_EZ_DATA23
.set UART_SCB__EZ_DATA24, CYREG_SCB1_EZ_DATA24
.set UART_SCB__EZ_DATA25, CYREG_SCB1_EZ_DATA25
.set UART_SCB__EZ_DATA26, CYREG_SCB1_EZ_DATA26
.set UART_SCB__EZ_DATA27, CYREG_SCB1_EZ_DATA27
.set UART_SCB__EZ_DATA28, CYREG_SCB1_EZ_DATA28
.set UART_SCB__EZ_DATA29, CYREG_SCB1_EZ_DATA29
.set UART_SCB__EZ_DATA3, CYREG_SCB1_EZ_DATA3
.set UART_SCB__EZ_DATA30, CYREG_SCB1_EZ_DATA30
.set UART_SCB__EZ_DATA31, CYREG_SCB1_EZ_DATA31
.set UART_SCB__EZ_DATA4, CYREG_SCB1_EZ_DATA4
.set UART_SCB__EZ_DATA5, CYREG_SCB1_EZ_DATA5
.set UART_SCB__EZ_DATA6, CYREG_SCB1_EZ_DATA6
.set UART_SCB__EZ_DATA7, CYREG_SCB1_EZ_DATA7
.set UART_SCB__EZ_DATA8, CYREG_SCB1_EZ_DATA8
.set UART_SCB__EZ_DATA9, CYREG_SCB1_EZ_DATA9
.set UART_SCB__I2C_CFG, CYREG_SCB1_I2C_CFG
.set UART_SCB__I2C_CTRL, CYREG_SCB1_I2C_CTRL
.set UART_SCB__I2C_M_CMD, CYREG_SCB1_I2C_M_CMD
.set UART_SCB__I2C_S_CMD, CYREG_SCB1_I2C_S_CMD
.set UART_SCB__I2C_STATUS, CYREG_SCB1_I2C_STATUS
.set UART_SCB__INTR_CAUSE, CYREG_SCB1_INTR_CAUSE
.set UART_SCB__INTR_I2C_EC, CYREG_SCB1_INTR_I2C_EC
.set UART_SCB__INTR_I2C_EC_MASK, CYREG_SCB1_INTR_I2C_EC_MASK
.set UART_SCB__INTR_I2C_EC_MASKED, CYREG_SCB1_INTR_I2C_EC_MASKED
.set UART_SCB__INTR_M, CYREG_SCB1_INTR_M
.set UART_SCB__INTR_M_MASK, CYREG_SCB1_INTR_M_MASK
.set UART_SCB__INTR_M_MASKED, CYREG_SCB1_INTR_M_MASKED
.set UART_SCB__INTR_M_SET, CYREG_SCB1_INTR_M_SET
.set UART_SCB__INTR_RX, CYREG_SCB1_INTR_RX
.set UART_SCB__INTR_RX_MASK, CYREG_SCB1_INTR_RX_MASK
.set UART_SCB__INTR_RX_MASKED, CYREG_SCB1_INTR_RX_MASKED
.set UART_SCB__INTR_RX_SET, CYREG_SCB1_INTR_RX_SET
.set UART_SCB__INTR_S, CYREG_SCB1_INTR_S
.set UART_SCB__INTR_S_MASK, CYREG_SCB1_INTR_S_MASK
.set UART_SCB__INTR_S_MASKED, CYREG_SCB1_INTR_S_MASKED
.set UART_SCB__INTR_S_SET, CYREG_SCB1_INTR_S_SET
.set UART_SCB__INTR_SPI_EC, CYREG_SCB1_INTR_SPI_EC
.set UART_SCB__INTR_SPI_EC_MASK, CYREG_SCB1_INTR_SPI_EC_MASK
.set UART_SCB__INTR_SPI_EC_MASKED, CYREG_SCB1_INTR_SPI_EC_MASKED
.set UART_SCB__INTR_TX, CYREG_SCB1_INTR_TX
.set UART_SCB__INTR_TX_MASK, CYREG_SCB1_INTR_TX_MASK
.set UART_SCB__INTR_TX_MASKED, CYREG_SCB1_INTR_TX_MASKED
.set UART_SCB__INTR_TX_SET, CYREG_SCB1_INTR_TX_SET
.set UART_SCB__RX_CTRL, CYREG_SCB1_RX_CTRL
.set UART_SCB__RX_FIFO_CTRL, CYREG_SCB1_RX_FIFO_CTRL
.set UART_SCB__RX_FIFO_RD, CYREG_SCB1_RX_FIFO_RD
.set UART_SCB__RX_FIFO_RD_SILENT, CYREG_SCB1_RX_FIFO_RD_SILENT
.set UART_SCB__RX_FIFO_STATUS, CYREG_SCB1_RX_FIFO_STATUS
.set UART_SCB__RX_MATCH, CYREG_SCB1_RX_MATCH
.set UART_SCB__SPI_CTRL, CYREG_SCB1_SPI_CTRL
.set UART_SCB__SPI_STATUS, CYREG_SCB1_SPI_STATUS
.set UART_SCB__SS0_POSISTION, 0
.set UART_SCB__SS1_POSISTION, 1
.set UART_SCB__SS2_POSISTION, 2
.set UART_SCB__SS3_POSISTION, 3
.set UART_SCB__STATUS, CYREG_SCB1_STATUS
.set UART_SCB__TX_CTRL, CYREG_SCB1_TX_CTRL
.set UART_SCB__TX_FIFO_CTRL, CYREG_SCB1_TX_FIFO_CTRL
.set UART_SCB__TX_FIFO_STATUS, CYREG_SCB1_TX_FIFO_STATUS
.set UART_SCB__TX_FIFO_WR, CYREG_SCB1_TX_FIFO_WR
.set UART_SCB__UART_CTRL, CYREG_SCB1_UART_CTRL
.set UART_SCB__UART_FLOW_CTRL, CYREG_SCB1_UART_FLOW_CTRL
.set UART_SCB__UART_RX_CTRL, CYREG_SCB1_UART_RX_CTRL
.set UART_SCB__UART_RX_STATUS, CYREG_SCB1_UART_RX_STATUS
.set UART_SCB__UART_TX_CTRL, CYREG_SCB1_UART_TX_CTRL
/* UART_SCB_IRQ */
.set UART_SCB_IRQ__INTC_CLR_EN_REG, CYREG_CM0_ICER
.set UART_SCB_IRQ__INTC_CLR_PD_REG, CYREG_CM0_ICPR
.set UART_SCB_IRQ__INTC_MASK, 0x400
.set UART_SCB_IRQ__INTC_NUMBER, 10
.set UART_SCB_IRQ__INTC_PRIOR_MASK, 0xC00000
.set UART_SCB_IRQ__INTC_PRIOR_NUM, 3
.set UART_SCB_IRQ__INTC_PRIOR_REG, CYREG_CM0_IPR2
.set UART_SCB_IRQ__INTC_SET_EN_REG, CYREG_CM0_ISER
.set UART_SCB_IRQ__INTC_SET_PD_REG, CYREG_CM0_ISPR
/* UART_SCBCLK */
.set UART_SCBCLK__CTRL_REGISTER, CYREG_PERI_PCLK_CTL2
.set UART_SCBCLK__DIV_ID, 0x00000040
.set UART_SCBCLK__DIV_REGISTER, CYREG_PERI_DIV_16_CTL0
.set UART_SCBCLK__PA_DIV_ID, 0x000000FF
/* UART_tx */
.set UART_tx__0__DR, CYREG_GPIO_PRT3_DR
.set UART_tx__0__DR_CLR, CYREG_GPIO_PRT3_DR_CLR
.set UART_tx__0__DR_INV, CYREG_GPIO_PRT3_DR_INV
.set UART_tx__0__DR_SET, CYREG_GPIO_PRT3_DR_SET
.set UART_tx__0__HSIOM, CYREG_HSIOM_PORT_SEL3
.set UART_tx__0__HSIOM_GPIO, 0
.set UART_tx__0__HSIOM_I2C, 14
.set UART_tx__0__HSIOM_I2C_SCL, 14
.set UART_tx__0__HSIOM_MASK, 0x00F00000
.set UART_tx__0__HSIOM_SHIFT, 20
.set UART_tx__0__HSIOM_UART, 9
.set UART_tx__0__HSIOM_UART_TX, 9
.set UART_tx__0__INTCFG, CYREG_GPIO_PRT3_INTR_CFG
.set UART_tx__0__INTR, CYREG_GPIO_PRT3_INTR
.set UART_tx__0__INTR_CFG, CYREG_GPIO_PRT3_INTR_CFG
.set UART_tx__0__INTSTAT, CYREG_GPIO_PRT3_INTR
.set UART_tx__0__MASK, 0x20
.set UART_tx__0__OUT_SEL, CYREG_UDB_PA3_CFG10
.set UART_tx__0__OUT_SEL_SHIFT, 10
.set UART_tx__0__OUT_SEL_VAL, -1
.set UART_tx__0__PA__CFG0, CYREG_UDB_PA3_CFG0
.set UART_tx__0__PA__CFG1, CYREG_UDB_PA3_CFG1
.set UART_tx__0__PA__CFG10, CYREG_UDB_PA3_CFG10
.set UART_tx__0__PA__CFG11, CYREG_UDB_PA3_CFG11
.set UART_tx__0__PA__CFG12, CYREG_UDB_PA3_CFG12
.set UART_tx__0__PA__CFG13, CYREG_UDB_PA3_CFG13
.set UART_tx__0__PA__CFG14, CYREG_UDB_PA3_CFG14
.set UART_tx__0__PA__CFG2, CYREG_UDB_PA3_CFG2
.set UART_tx__0__PA__CFG3, CYREG_UDB_PA3_CFG3
.set UART_tx__0__PA__CFG4, CYREG_UDB_PA3_CFG4
.set UART_tx__0__PA__CFG5, CYREG_UDB_PA3_CFG5
.set UART_tx__0__PA__CFG6, CYREG_UDB_PA3_CFG6
.set UART_tx__0__PA__CFG7, CYREG_UDB_PA3_CFG7
.set UART_tx__0__PA__CFG8, CYREG_UDB_PA3_CFG8
.set UART_tx__0__PA__CFG9, CYREG_UDB_PA3_CFG9
.set UART_tx__0__PC, CYREG_GPIO_PRT3_PC
.set UART_tx__0__PC2, CYREG_GPIO_PRT3_PC2
.set UART_tx__0__PORT, 3
.set UART_tx__0__PS, CYREG_GPIO_PRT3_PS
.set UART_tx__0__SHIFT, 5
.set UART_tx__DR, CYREG_GPIO_PRT3_DR
.set UART_tx__DR_CLR, CYREG_GPIO_PRT3_DR_CLR
.set UART_tx__DR_INV, CYREG_GPIO_PRT3_DR_INV
.set UART_tx__DR_SET, CYREG_GPIO_PRT3_DR_SET
.set UART_tx__INTCFG, CYREG_GPIO_PRT3_INTR_CFG
.set UART_tx__INTR, CYREG_GPIO_PRT3_INTR
.set UART_tx__INTR_CFG, CYREG_GPIO_PRT3_INTR_CFG
.set UART_tx__INTSTAT, CYREG_GPIO_PRT3_INTR
.set UART_tx__MASK, 0x20
.set UART_tx__PA__CFG0, CYREG_UDB_PA3_CFG0
.set UART_tx__PA__CFG1, CYREG_UDB_PA3_CFG1
.set UART_tx__PA__CFG10, CYREG_UDB_PA3_CFG10
.set UART_tx__PA__CFG11, CYREG_UDB_PA3_CFG11
.set UART_tx__PA__CFG12, CYREG_UDB_PA3_CFG12
.set UART_tx__PA__CFG13, CYREG_UDB_PA3_CFG13
.set UART_tx__PA__CFG14, CYREG_UDB_PA3_CFG14
.set UART_tx__PA__CFG2, CYREG_UDB_PA3_CFG2
.set UART_tx__PA__CFG3, CYREG_UDB_PA3_CFG3
.set UART_tx__PA__CFG4, CYREG_UDB_PA3_CFG4
.set UART_tx__PA__CFG5, CYREG_UDB_PA3_CFG5
.set UART_tx__PA__CFG6, CYREG_UDB_PA3_CFG6
.set UART_tx__PA__CFG7, CYREG_UDB_PA3_CFG7
.set UART_tx__PA__CFG8, CYREG_UDB_PA3_CFG8
.set UART_tx__PA__CFG9, CYREG_UDB_PA3_CFG9
.set UART_tx__PC, CYREG_GPIO_PRT3_PC
.set UART_tx__PC2, CYREG_GPIO_PRT3_PC2
.set UART_tx__PORT, 3
.set UART_tx__PS, CYREG_GPIO_PRT3_PS
.set UART_tx__SHIFT, 5
/* Timer_cy_m0s8_tcpwm_1 */
.set Timer_cy_m0s8_tcpwm_1__CC, CYREG_TCPWM_CNT0_CC
.set Timer_cy_m0s8_tcpwm_1__CC_BUFF, CYREG_TCPWM_CNT0_CC_BUFF
.set Timer_cy_m0s8_tcpwm_1__COUNTER, CYREG_TCPWM_CNT0_COUNTER
.set Timer_cy_m0s8_tcpwm_1__CTRL, CYREG_TCPWM_CNT0_CTRL
.set Timer_cy_m0s8_tcpwm_1__INTR, CYREG_TCPWM_CNT0_INTR
.set Timer_cy_m0s8_tcpwm_1__INTR_MASK, CYREG_TCPWM_CNT0_INTR_MASK
.set Timer_cy_m0s8_tcpwm_1__INTR_MASKED, CYREG_TCPWM_CNT0_INTR_MASKED
.set Timer_cy_m0s8_tcpwm_1__INTR_SET, CYREG_TCPWM_CNT0_INTR_SET
.set Timer_cy_m0s8_tcpwm_1__PERIOD, CYREG_TCPWM_CNT0_PERIOD
.set Timer_cy_m0s8_tcpwm_1__PERIOD_BUFF, CYREG_TCPWM_CNT0_PERIOD_BUFF
.set Timer_cy_m0s8_tcpwm_1__STATUS, CYREG_TCPWM_CNT0_STATUS
.set Timer_cy_m0s8_tcpwm_1__TCPWM_CMD, CYREG_TCPWM_CMD
.set Timer_cy_m0s8_tcpwm_1__TCPWM_CMDCAPTURE_MASK, 0x01
.set Timer_cy_m0s8_tcpwm_1__TCPWM_CMDCAPTURE_SHIFT, 0
.set Timer_cy_m0s8_tcpwm_1__TCPWM_CMDRELOAD_MASK, 0x100
.set Timer_cy_m0s8_tcpwm_1__TCPWM_CMDRELOAD_SHIFT, 8
.set Timer_cy_m0s8_tcpwm_1__TCPWM_CMDSTART_MASK, 0x1000000
.set Timer_cy_m0s8_tcpwm_1__TCPWM_CMDSTART_SHIFT, 24
.set Timer_cy_m0s8_tcpwm_1__TCPWM_CMDSTOP_MASK, 0x10000
.set Timer_cy_m0s8_tcpwm_1__TCPWM_CMDSTOP_SHIFT, 16
.set Timer_cy_m0s8_tcpwm_1__TCPWM_CTRL, CYREG_TCPWM_CTRL
.set Timer_cy_m0s8_tcpwm_1__TCPWM_CTRL_MASK, 0x01
.set Timer_cy_m0s8_tcpwm_1__TCPWM_CTRL_SHIFT, 0
.set Timer_cy_m0s8_tcpwm_1__TCPWM_INTR_CAUSE, CYREG_TCPWM_INTR_CAUSE
.set Timer_cy_m0s8_tcpwm_1__TCPWM_INTR_CAUSE_MASK, 0x01
.set Timer_cy_m0s8_tcpwm_1__TCPWM_INTR_CAUSE_SHIFT, 0
.set Timer_cy_m0s8_tcpwm_1__TCPWM_NUMBER, 0
.set Timer_cy_m0s8_tcpwm_1__TR_CTRL0, CYREG_TCPWM_CNT0_TR_CTRL0
.set Timer_cy_m0s8_tcpwm_1__TR_CTRL1, CYREG_TCPWM_CNT0_TR_CTRL1
.set Timer_cy_m0s8_tcpwm_1__TR_CTRL2, CYREG_TCPWM_CNT0_TR_CTRL2
/* Status_LED */
.set Status_LED__0__DR, CYREG_GPIO_PRT2_DR
.set Status_LED__0__DR_CLR, CYREG_GPIO_PRT2_DR_CLR
.set Status_LED__0__DR_INV, CYREG_GPIO_PRT2_DR_INV
.set Status_LED__0__DR_SET, CYREG_GPIO_PRT2_DR_SET
.set Status_LED__0__HSIOM, CYREG_HSIOM_PORT_SEL2
.set Status_LED__0__HSIOM_MASK, 0x0F000000
.set Status_LED__0__HSIOM_SHIFT, 24
.set Status_LED__0__INTCFG, CYREG_GPIO_PRT2_INTR_CFG
.set Status_LED__0__INTR, CYREG_GPIO_PRT2_INTR
.set Status_LED__0__INTR_CFG, CYREG_GPIO_PRT2_INTR_CFG
.set Status_LED__0__INTSTAT, CYREG_GPIO_PRT2_INTR
.set Status_LED__0__MASK, 0x40
.set Status_LED__0__PA__CFG0, CYREG_UDB_PA2_CFG0
.set Status_LED__0__PA__CFG1, CYREG_UDB_PA2_CFG1
.set Status_LED__0__PA__CFG10, CYREG_UDB_PA2_CFG10
.set Status_LED__0__PA__CFG11, CYREG_UDB_PA2_CFG11
.set Status_LED__0__PA__CFG12, CYREG_UDB_PA2_CFG12
.set Status_LED__0__PA__CFG13, CYREG_UDB_PA2_CFG13
.set Status_LED__0__PA__CFG14, CYREG_UDB_PA2_CFG14
.set Status_LED__0__PA__CFG2, CYREG_UDB_PA2_CFG2
.set Status_LED__0__PA__CFG3, CYREG_UDB_PA2_CFG3
.set Status_LED__0__PA__CFG4, CYREG_UDB_PA2_CFG4
.set Status_LED__0__PA__CFG5, CYREG_UDB_PA2_CFG5
.set Status_LED__0__PA__CFG6, CYREG_UDB_PA2_CFG6
.set Status_LED__0__PA__CFG7, CYREG_UDB_PA2_CFG7
.set Status_LED__0__PA__CFG8, CYREG_UDB_PA2_CFG8
.set Status_LED__0__PA__CFG9, CYREG_UDB_PA2_CFG9
.set Status_LED__0__PC, CYREG_GPIO_PRT2_PC
.set Status_LED__0__PC2, CYREG_GPIO_PRT2_PC2
.set Status_LED__0__PORT, 2
.set Status_LED__0__PS, CYREG_GPIO_PRT2_PS
.set Status_LED__0__SHIFT, 6
.set Status_LED__DR, CYREG_GPIO_PRT2_DR
.set Status_LED__DR_CLR, CYREG_GPIO_PRT2_DR_CLR
.set Status_LED__DR_INV, CYREG_GPIO_PRT2_DR_INV
.set Status_LED__DR_SET, CYREG_GPIO_PRT2_DR_SET
.set Status_LED__INTCFG, CYREG_GPIO_PRT2_INTR_CFG
.set Status_LED__INTR, CYREG_GPIO_PRT2_INTR
.set Status_LED__INTR_CFG, CYREG_GPIO_PRT2_INTR_CFG
.set Status_LED__INTSTAT, CYREG_GPIO_PRT2_INTR
.set Status_LED__MASK, 0x40
.set Status_LED__PA__CFG0, CYREG_UDB_PA2_CFG0
.set Status_LED__PA__CFG1, CYREG_UDB_PA2_CFG1
.set Status_LED__PA__CFG10, CYREG_UDB_PA2_CFG10
.set Status_LED__PA__CFG11, CYREG_UDB_PA2_CFG11
.set Status_LED__PA__CFG12, CYREG_UDB_PA2_CFG12
.set Status_LED__PA__CFG13, CYREG_UDB_PA2_CFG13
.set Status_LED__PA__CFG14, CYREG_UDB_PA2_CFG14
.set Status_LED__PA__CFG2, CYREG_UDB_PA2_CFG2
.set Status_LED__PA__CFG3, CYREG_UDB_PA2_CFG3
.set Status_LED__PA__CFG4, CYREG_UDB_PA2_CFG4
.set Status_LED__PA__CFG5, CYREG_UDB_PA2_CFG5
.set Status_LED__PA__CFG6, CYREG_UDB_PA2_CFG6
.set Status_LED__PA__CFG7, CYREG_UDB_PA2_CFG7
.set Status_LED__PA__CFG8, CYREG_UDB_PA2_CFG8
.set Status_LED__PA__CFG9, CYREG_UDB_PA2_CFG9
.set Status_LED__PC, CYREG_GPIO_PRT2_PC
.set Status_LED__PC2, CYREG_GPIO_PRT2_PC2
.set Status_LED__PORT, 2
.set Status_LED__PS, CYREG_GPIO_PRT2_PS
.set Status_LED__SHIFT, 6
/* TimerClock */
.set TimerClock__CTRL_REGISTER, CYREG_PERI_PCLK_CTL7
.set TimerClock__DIV_ID, 0x00000041
.set TimerClock__DIV_REGISTER, CYREG_PERI_DIV_16_CTL1
.set TimerClock__PA_DIV_ID, 0x000000FF
/* Connected_LED */
.set Connected_LED__0__DR, CYREG_GPIO_PRT3_DR
.set Connected_LED__0__DR_CLR, CYREG_GPIO_PRT3_DR_CLR
.set Connected_LED__0__DR_INV, CYREG_GPIO_PRT3_DR_INV
.set Connected_LED__0__DR_SET, CYREG_GPIO_PRT3_DR_SET
.set Connected_LED__0__HSIOM, CYREG_HSIOM_PORT_SEL3
.set Connected_LED__0__HSIOM_MASK, 0x0F000000
.set Connected_LED__0__HSIOM_SHIFT, 24
.set Connected_LED__0__INTCFG, CYREG_GPIO_PRT3_INTR_CFG
.set Connected_LED__0__INTR, CYREG_GPIO_PRT3_INTR
.set Connected_LED__0__INTR_CFG, CYREG_GPIO_PRT3_INTR_CFG
.set Connected_LED__0__INTSTAT, CYREG_GPIO_PRT3_INTR
.set Connected_LED__0__MASK, 0x40
.set Connected_LED__0__PA__CFG0, CYREG_UDB_PA3_CFG0
.set Connected_LED__0__PA__CFG1, CYREG_UDB_PA3_CFG1
.set Connected_LED__0__PA__CFG10, CYREG_UDB_PA3_CFG10
.set Connected_LED__0__PA__CFG11, CYREG_UDB_PA3_CFG11
.set Connected_LED__0__PA__CFG12, CYREG_UDB_PA3_CFG12
.set Connected_LED__0__PA__CFG13, CYREG_UDB_PA3_CFG13
.set Connected_LED__0__PA__CFG14, CYREG_UDB_PA3_CFG14
.set Connected_LED__0__PA__CFG2, CYREG_UDB_PA3_CFG2
.set Connected_LED__0__PA__CFG3, CYREG_UDB_PA3_CFG3
.set Connected_LED__0__PA__CFG4, CYREG_UDB_PA3_CFG4
.set Connected_LED__0__PA__CFG5, CYREG_UDB_PA3_CFG5
.set Connected_LED__0__PA__CFG6, CYREG_UDB_PA3_CFG6
.set Connected_LED__0__PA__CFG7, CYREG_UDB_PA3_CFG7
.set Connected_LED__0__PA__CFG8, CYREG_UDB_PA3_CFG8
.set Connected_LED__0__PA__CFG9, CYREG_UDB_PA3_CFG9
.set Connected_LED__0__PC, CYREG_GPIO_PRT3_PC
.set Connected_LED__0__PC2, CYREG_GPIO_PRT3_PC2
.set Connected_LED__0__PORT, 3
.set Connected_LED__0__PS, CYREG_GPIO_PRT3_PS
.set Connected_LED__0__SHIFT, 6
.set Connected_LED__DR, CYREG_GPIO_PRT3_DR
.set Connected_LED__DR_CLR, CYREG_GPIO_PRT3_DR_CLR
.set Connected_LED__DR_INV, CYREG_GPIO_PRT3_DR_INV
.set Connected_LED__DR_SET, CYREG_GPIO_PRT3_DR_SET
.set Connected_LED__INTCFG, CYREG_GPIO_PRT3_INTR_CFG
.set Connected_LED__INTR, CYREG_GPIO_PRT3_INTR
.set Connected_LED__INTR_CFG, CYREG_GPIO_PRT3_INTR_CFG
.set Connected_LED__INTSTAT, CYREG_GPIO_PRT3_INTR
.set Connected_LED__MASK, 0x40
.set Connected_LED__PA__CFG0, CYREG_UDB_PA3_CFG0
.set Connected_LED__PA__CFG1, CYREG_UDB_PA3_CFG1
.set Connected_LED__PA__CFG10, CYREG_UDB_PA3_CFG10
.set Connected_LED__PA__CFG11, CYREG_UDB_PA3_CFG11
.set Connected_LED__PA__CFG12, CYREG_UDB_PA3_CFG12
.set Connected_LED__PA__CFG13, CYREG_UDB_PA3_CFG13
.set Connected_LED__PA__CFG14, CYREG_UDB_PA3_CFG14
.set Connected_LED__PA__CFG2, CYREG_UDB_PA3_CFG2
.set Connected_LED__PA__CFG3, CYREG_UDB_PA3_CFG3
.set Connected_LED__PA__CFG4, CYREG_UDB_PA3_CFG4
.set Connected_LED__PA__CFG5, CYREG_UDB_PA3_CFG5
.set Connected_LED__PA__CFG6, CYREG_UDB_PA3_CFG6
.set Connected_LED__PA__CFG7, CYREG_UDB_PA3_CFG7
.set Connected_LED__PA__CFG8, CYREG_UDB_PA3_CFG8
.set Connected_LED__PA__CFG9, CYREG_UDB_PA3_CFG9
.set Connected_LED__PC, CYREG_GPIO_PRT3_PC
.set Connected_LED__PC2, CYREG_GPIO_PRT3_PC2
.set Connected_LED__PORT, 3
.set Connected_LED__PS, CYREG_GPIO_PRT3_PS
.set Connected_LED__SHIFT, 6
/* TimerInterrupt */
.set TimerInterrupt__INTC_CLR_EN_REG, CYREG_CM0_ICER
.set TimerInterrupt__INTC_CLR_PD_REG, CYREG_CM0_ICPR
.set TimerInterrupt__INTC_MASK, 0x20000
.set TimerInterrupt__INTC_NUMBER, 17
.set TimerInterrupt__INTC_PRIOR_MASK, 0xC000
.set TimerInterrupt__INTC_PRIOR_NUM, 3
.set TimerInterrupt__INTC_PRIOR_REG, CYREG_CM0_IPR4
.set TimerInterrupt__INTC_SET_EN_REG, CYREG_CM0_ISER
.set TimerInterrupt__INTC_SET_PD_REG, CYREG_CM0_ISPR
/* Miscellaneous */
.set CYDEV_BCLK__HFCLK__HZ, 16000000
.set CYDEV_BCLK__HFCLK__KHZ, 16000
.set CYDEV_BCLK__HFCLK__MHZ, 16
.set CYDEV_BCLK__SYSCLK__HZ, 16000000
.set CYDEV_BCLK__SYSCLK__KHZ, 16000
.set CYDEV_BCLK__SYSCLK__MHZ, 16
.set CYDEV_CHIP_DIE_LEOPARD, 1
.set CYDEV_CHIP_DIE_PSOC4A, 12
.set CYDEV_CHIP_DIE_PSOC5LP, 19
.set CYDEV_CHIP_DIE_PSOC5TM, 20
.set CYDEV_CHIP_DIE_TMA4, 2
.set CYDEV_CHIP_DIE_UNKNOWN, 0
.set CYDEV_CHIP_FAMILY_FM0P, 4
.set CYDEV_CHIP_FAMILY_FM3, 5
.set CYDEV_CHIP_FAMILY_FM4, 6
.set CYDEV_CHIP_FAMILY_PSOC3, 1
.set CYDEV_CHIP_FAMILY_PSOC4, 2
.set CYDEV_CHIP_FAMILY_PSOC5, 3
.set CYDEV_CHIP_FAMILY_UNKNOWN, 0
.set CYDEV_CHIP_FAMILY_USED, CYDEV_CHIP_FAMILY_PSOC4
.set CYDEV_CHIP_JTAG_ID, 0x0E09119E
.set CYDEV_CHIP_MEMBER_3A, 1
.set CYDEV_CHIP_MEMBER_4A, 12
.set CYDEV_CHIP_MEMBER_4C, 18
.set CYDEV_CHIP_MEMBER_4D, 8
.set CYDEV_CHIP_MEMBER_4E, 4
.set CYDEV_CHIP_MEMBER_4F, 13
.set CYDEV_CHIP_MEMBER_4G, 2
.set CYDEV_CHIP_MEMBER_4H, 11
.set CYDEV_CHIP_MEMBER_4I, 17
.set CYDEV_CHIP_MEMBER_4J, 9
.set CYDEV_CHIP_MEMBER_4K, 10
.set CYDEV_CHIP_MEMBER_4L, 16
.set CYDEV_CHIP_MEMBER_4M, 15
.set CYDEV_CHIP_MEMBER_4N, 6
.set CYDEV_CHIP_MEMBER_4O, 5
.set CYDEV_CHIP_MEMBER_4P, 14
.set CYDEV_CHIP_MEMBER_4Q, 7
.set CYDEV_CHIP_MEMBER_4U, 3
.set CYDEV_CHIP_MEMBER_5A, 20
.set CYDEV_CHIP_MEMBER_5B, 19
.set CYDEV_CHIP_MEMBER_FM3, 24
.set CYDEV_CHIP_MEMBER_FM4, 25
.set CYDEV_CHIP_MEMBER_PDL_FM0P_TYPE1, 21
.set CYDEV_CHIP_MEMBER_PDL_FM0P_TYPE2, 22
.set CYDEV_CHIP_MEMBER_PDL_FM0P_TYPE3, 23
.set CYDEV_CHIP_MEMBER_UNKNOWN, 0
.set CYDEV_CHIP_MEMBER_USED, CYDEV_CHIP_MEMBER_4F
.set CYDEV_CHIP_DIE_EXPECT, CYDEV_CHIP_MEMBER_USED
.set CYDEV_CHIP_DIE_ACTUAL, CYDEV_CHIP_DIE_EXPECT
.set CYDEV_CHIP_REV_LEOPARD_ES1, 0
.set CYDEV_CHIP_REV_LEOPARD_ES2, 1
.set CYDEV_CHIP_REV_LEOPARD_ES3, 3
.set CYDEV_CHIP_REV_LEOPARD_PRODUCTION, 3
.set CYDEV_CHIP_REV_PSOC4A_ES0, 17
.set CYDEV_CHIP_REV_PSOC4A_PRODUCTION, 17
.set CYDEV_CHIP_REV_PSOC5LP_ES0, 0
.set CYDEV_CHIP_REV_PSOC5LP_PRODUCTION, 0
.set CYDEV_CHIP_REV_PSOC5TM_ES0, 0
.set CYDEV_CHIP_REV_PSOC5TM_ES1, 1
.set CYDEV_CHIP_REV_PSOC5TM_PRODUCTION, 1
.set CYDEV_CHIP_REV_TMA4_ES, 17
.set CYDEV_CHIP_REV_TMA4_ES2, 33
.set CYDEV_CHIP_REV_TMA4_PRODUCTION, 17
.set CYDEV_CHIP_REVISION_3A_ES1, 0
.set CYDEV_CHIP_REVISION_3A_ES2, 1
.set CYDEV_CHIP_REVISION_3A_ES3, 3
.set CYDEV_CHIP_REVISION_3A_PRODUCTION, 3
.set CYDEV_CHIP_REVISION_4A_ES0, 17
.set CYDEV_CHIP_REVISION_4A_PRODUCTION, 17
.set CYDEV_CHIP_REVISION_4C_PRODUCTION, 0
.set CYDEV_CHIP_REVISION_4D_PRODUCTION, 0
.set CYDEV_CHIP_REVISION_4E_PRODUCTION, 0
.set CYDEV_CHIP_REVISION_4F_PRODUCTION, 0
.set CYDEV_CHIP_REVISION_4F_PRODUCTION_256DMA, 0
.set CYDEV_CHIP_REVISION_4F_PRODUCTION_256K, 0
.set CYDEV_CHIP_REVISION_4G_ES, 17
.set CYDEV_CHIP_REVISION_4G_ES2, 33
.set CYDEV_CHIP_REVISION_4G_PRODUCTION, 17
.set CYDEV_CHIP_REVISION_4H_PRODUCTION, 0
.set CYDEV_CHIP_REVISION_4I_PRODUCTION, 0
.set CYDEV_CHIP_REVISION_4J_PRODUCTION, 0
.set CYDEV_CHIP_REVISION_4K_PRODUCTION, 0
.set CYDEV_CHIP_REVISION_4L_PRODUCTION, 0
.set CYDEV_CHIP_REVISION_4M_PRODUCTION, 0
.set CYDEV_CHIP_REVISION_4N_PRODUCTION, 0
.set CYDEV_CHIP_REVISION_4O_PRODUCTION, 0
.set CYDEV_CHIP_REVISION_4P_PRODUCTION, 0
.set CYDEV_CHIP_REVISION_4Q_PRODUCTION, 0
.set CYDEV_CHIP_REVISION_4U_PRODUCTION, 0
.set CYDEV_CHIP_REVISION_5A_ES0, 0
.set CYDEV_CHIP_REVISION_5A_ES1, 1
.set CYDEV_CHIP_REVISION_5A_PRODUCTION, 1
.set CYDEV_CHIP_REVISION_5B_ES0, 0
.set CYDEV_CHIP_REVISION_5B_PRODUCTION, 0
.set CYDEV_CHIP_REVISION_FM3_PRODUCTION, 0
.set CYDEV_CHIP_REVISION_FM4_PRODUCTION, 0
.set CYDEV_CHIP_REVISION_PDL_FM0P_TYPE1_PRODUCTION, 0
.set CYDEV_CHIP_REVISION_PDL_FM0P_TYPE2_PRODUCTION, 0
.set CYDEV_CHIP_REVISION_PDL_FM0P_TYPE3_PRODUCTION, 0
.set CYDEV_CHIP_REVISION_USED, CYDEV_CHIP_REVISION_4F_PRODUCTION
.set CYDEV_CHIP_REV_EXPECT, CYDEV_CHIP_REVISION_USED
.set CYDEV_CONFIG_READ_ACCELERATOR, 1
.set CYDEV_CONFIG_UNUSED_IO_AllowButWarn, 0
.set CYDEV_CONFIG_UNUSED_IO, CYDEV_CONFIG_UNUSED_IO_AllowButWarn
.set CYDEV_CONFIG_UNUSED_IO_AllowWithInfo, 1
.set CYDEV_CONFIG_UNUSED_IO_Disallowed, 2
.set CYDEV_CONFIGURATION_COMPRESSED, 1
.set CYDEV_CONFIGURATION_MODE_COMPRESSED, 0
.set CYDEV_CONFIGURATION_MODE, CYDEV_CONFIGURATION_MODE_COMPRESSED
.set CYDEV_CONFIGURATION_MODE_DMA, 2
.set CYDEV_CONFIGURATION_MODE_UNCOMPRESSED, 1
.set CYDEV_DEBUG_PROTECT_KILL, 4
.set CYDEV_DEBUG_PROTECT_OPEN, 1
.set CYDEV_DEBUG_PROTECT, CYDEV_DEBUG_PROTECT_OPEN
.set CYDEV_DEBUG_PROTECT_PROTECTED, 2
.set CYDEV_DEBUGGING_DPS_Disable, 3
.set CYDEV_DEBUGGING_DPS, CYDEV_DEBUGGING_DPS_Disable
.set CYDEV_DEBUGGING_DPS_SWD, 2
.set CYDEV_DEBUGGING_ENABLE, 0
.set CYDEV_DFT_SELECT_CLK0, 10
.set CYDEV_DFT_SELECT_CLK1, 11
.set CYDEV_HEAP_SIZE, 0x200
.set CYDEV_IMO_TRIMMED_BY_USB, 0
.set CYDEV_IMO_TRIMMED_BY_WCO, 0
.set CYDEV_IS_EXPORTING_CODE, 0
.set CYDEV_IS_IMPORTING_CODE, 0
.set CYDEV_PROJ_TYPE, 0
.set CYDEV_PROJ_TYPE_BOOTLOADER, 1
.set CYDEV_PROJ_TYPE_LAUNCHER, 5
.set CYDEV_PROJ_TYPE_LOADABLE, 2
.set CYDEV_PROJ_TYPE_LOADABLEANDBOOTLOADER, 4
.set CYDEV_PROJ_TYPE_MULTIAPPBOOTLOADER, 3
.set CYDEV_PROJ_TYPE_STANDARD, 0
.set CYDEV_STACK_SIZE, 0x0400
.set CYDEV_USE_BUNDLED_CMSIS, 1
.set CYDEV_VARIABLE_VDDA, 1
.set CYDEV_VDDA_MV, 3300
.set CYDEV_VDDD_MV, 3300
.set CYDEV_VDDR_MV, 3300
.set CYDEV_WDT_GENERATE_ISR, 1
.set CYIPBLOCK_m0s8bless_VERSION, 1
.set CYIPBLOCK_m0s8cpussv2_VERSION, 1
.set CYIPBLOCK_m0s8csd_VERSION, 1
.set CYIPBLOCK_m0s8ioss_VERSION, 1
.set CYIPBLOCK_m0s8lcd_VERSION, 2
.set CYIPBLOCK_m0s8peri_VERSION, 1
.set CYIPBLOCK_m0s8scb_VERSION, 2
.set CYIPBLOCK_m0s8srssv2_VERSION, 1
.set CYIPBLOCK_m0s8tcpwm_VERSION, 2
.set CYIPBLOCK_m0s8udbif_VERSION, 1
.set CYIPBLOCK_s8pass4al_VERSION, 1
.set CYDEV_BOOTLOADER_ENABLE, 0
.endif
|
/*
Warnings:
- Added the required column `pair_id` to the `User` table without a default value. This is not possible if the table is not empty.
*/
-- DropForeignKey
ALTER TABLE "User" DROP CONSTRAINT "User_id_fkey";
-- AlterTable
ALTER TABLE "User" ADD COLUMN "pair_id" INTEGER NOT NULL;
-- AddForeignKey
ALTER TABLE "User" ADD FOREIGN KEY ("pair_id") REFERENCES "Pair"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
--<ScriptOptions statementTerminator=";"/>
CREATE TABLE kullanici (
ID INT NOT NULL,
ADI VARCHAR(255),
DURUM INT,
SOYADI VARCHAR(255),
PRIMARY KEY (ID)
) ENGINE=InnoDB;
|
-- List tables
SHOW TABLES;
|
-- PL/SQL : 선언부(create...) / 실행부(Begin-End)
-- 선언부
create or replace procedure InsertBook(
mybookid in number,-- in 입력 매개변수라는 뜻
mybookname in varchar2,
mypublisher in varchar2,
myprice in number)
as
begin
insert into book(bookid,bookname,publisher,price)
values(mybookid,mybookname,mypublisher,myprice);
end;
/
EXEC InsertBook(13,'스포츠과학','마당과학서적',25000);
select * from book;
create or replace procedure bookinsertorupdate(
mybookid number,
mybookname varchar2,
mypublisher varchar2,
myprice int)
as
mycount number; -- 지역변수선언
begin
select count(*) into mycount from book
where bookname like mybookname; -- 같은 이름의 도서가 몇권인지 검색
if mycount !=0 then -- 같은 도서가 있으면
update book set price=myprice
where bookname like mybookname;
else
insert into book(bookid,bookname,publisher,price)
values(mybookid,mybookname,mypublisher,myprice);
end if;
end;
/
-- 신규도서 입력
EXEC bookinsertorupdate(15,'스포츠 즐거움','마당과학서적',25000);
select * from book;
-- 가격이 업데이트
EXEC bookinsertorupdate(15,'스포츠 즐거움','마당과학서적',20000);
select * from book;
-- Book 테이블에 저장된 도서의 평균가격을 반환하는 프로시저(AveragePrice)
create or replace procedure AveragePrice1(
AverageVal out number) -- out : 출력 매개변수의 의미
as
begin
select round(avg(price),2) into AverageVal from book where price is not null;
end;
/
-- 프로시저 실행
-- DBMS_OUTPUT.PUT_LINE : 출력 명령어
SET SERVEROUTPUT ON;
DECLARE
AverageVal NUMBER;
begin
AveragePrice1(AverageVal);
DBMS_OUTPUT.PUT_LINE('도서의 평균가격 : ' || AverageVal);
end;
-- CURSOR : 커서를 생성(작업 영역 설정)
-- OPEN : 커서의 사용를 시작
-- FETCH : 행 데이터 가져옴
-- CLOSE : 커서의 사용을 끝냄
-- 커서를 사용한 전체이익금액을 반환하는 프로시져 (Interest)
create or replace procedure Interest
as
myInterest NUMERIC; -- 지역변수
price NUMERIC; -- 지역변수
CURSOR interestCURSOR is select saleprice from orders; -- 커서 변수 선언
begin
myInterest :=0.0;
open interestCURSOR;
loop
fetch interestCURSOR into price;
exit when interestCURSOR%notfound;
if price >= 20000 then
myinterest :=myinterest+price*0.1;
else
myinterest :=myinterest+price*0.05;
end if;
end loop;
close interestCURSOR;
DBMS_OUTPUT.PUT_LINE('전체 이익 금액 : ' || myinterest);
end;
/
SET SERVEROUTPUT ON;
exec interest;
|
-- Create a database and a table
-- The table must be in the database created
CREATE DATABASE IF NOT EXISTS hbtn_0d_usa;
CREATE TABLE IF NOT EXISTS hbtn_0d_usa.states (id INT PRIMARY KEY AUTO_INCREMENT, name VARCHAR(256) NOT NULL);
|
REM ------------------------------------------------------------------------
REM REQUIREMENTS:
REM
REM ------------------------------------------------------------------------
REM PURPOSE:
REM
REM ------------------------------------------------------------------------
set linesize 96
set pages 100
set feedback off
set verify off
set head off
col sessions_current for 999
col sessions_highwater for 999
col sga for 9999.9
col MB for 999,999
col phyrds for 99999
col phywrts for 99999
col tranx for 999999
col miss for 9.99
col startup_time for a9 trunc
SELECT count(*)
FROM dba_tables
WHERE owner='OPS$ORACLE'
AND table_name='DBA_EXP'
;
SELECT count(*)
FROM dba_tables
WHERE owner='OPS$ORACLE'
AND table_name='DBA_PROD'
;
SELECT count(*)
FROM v$database
WHERE log_mode='ARCHIVELOG'
;
exit
|
# ************************************************************
# Sequel Pro SQL dump
# Version 4096
#
# http://www.sequelpro.com/
# http://code.google.com/p/sequel-pro/
#
# Host: 127.0.0.1 (MySQL 5.7.15)
# Database: test
# Generation Time: 2016-12-06 10:07:08 +0000
# ************************************************************
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
# Dump of table produce
# ------------------------------------------------------------
DROP TABLE IF EXISTS `produce`;
CREATE TABLE `produce` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(32) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
# Dump of table schema
# ------------------------------------------------------------
DROP TABLE IF EXISTS `schema`;
CREATE TABLE `schema` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(64) NOT NULL,
`produceid` int(11) NOT NULL,
`power` text NOT NULL,
`des` varchar(256) NOT NULL DEFAULT '',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
# Dump of table sys_menu
# ------------------------------------------------------------
DROP TABLE IF EXISTS `sys_menu`;
CREATE TABLE `sys_menu` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`parentid` int(11) NOT NULL DEFAULT '0',
`model` varchar(64) NOT NULL DEFAULT '',
`action` varchar(64) NOT NULL DEFAULT '',
`name` varchar(64) NOT NULL DEFAULT '',
`visible` bit(1) NOT NULL DEFAULT b'0',
`ctype` tinyint(3) NOT NULL COMMENT '0:系统相关,1:游戏相关',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
# Dump of table user
# ------------------------------------------------------------
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`uname` varchar(128) NOT NULL DEFAULT '',
`pwd` char(32) NOT NULL DEFAULT '',
`enabled` tinyint(1) NOT NULL,
`qq` varchar(64) NOT NULL DEFAULT '',
`lastTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`groupid` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
UNIQUE KEY `iuname` (`uname`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
# Dump of table user_power
# ------------------------------------------------------------
DROP TABLE IF EXISTS `user_power`;
CREATE TABLE `user_power` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`userid` int(11) NOT NULL,
`produceid` int(11) NOT NULL,
`powers` text,
PRIMARY KEY (`id`),
KEY `userid` (`userid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
# Dump of table user_schema
# ------------------------------------------------------------
DROP TABLE IF EXISTS `user_schema`;
CREATE TABLE `user_schema` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`userid` int(11) NOT NULL,
`schemaid` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
DROP TABLE hospitals;
CREATE EXTERNAL TABLE hospitals
(
provider_id string,
hospital_name string,
address string,
city string,
state string,
zip_code string,
county_name string,
phone_number string,
hospital_type string,
hospital_ownership string,
emergency_service string,
meet_EHRS string,
hospital_overall_rating string,
hospital_overall_rating_footnote string,
mortality_national_comparison string,
mortality_national_comparison_footnote string,
safety_of_care_comparison string,
safety_of_care_comparison_footnote string,
readmission_national_comparison string,
readmission_national_comparison_footnote string,
patient_experience_comparison string,
patient_experiene_comparison_footnote string,
effectiveness_of_care_comparison string,
effectiveness_of_care_comparison_footnote string,
timeliness_of_care_comparison string,
timeliness_of_care_comparison_footnote string,
efficient_use_of_medical_imaging_comparison string,
efficient_use_of_medical_imaging_comparison_footnote string
)
ROW FORMAT SERDE
'org.apache.hadoop.hive.serde2.OpenCSVSerde'
WITH SERDEPROPERTIES(
"separatorChar"=",",
"quoteChar"='"',
"escapeChar"="\\"
)
STORED AS TEXTFILE
LOCATION "/user/w205/hospital_compare/hospitals"
;
|
-----------------------
--DML
-----------------------
drop table dept01;
create table dept01
as
select * from dept where 1<0;
desc dept01;
-- 새로운 부서 정보를 입력: 행단위 입력
-- insert into 테이블 이름 (입력하고자 하는 컬럼들) values(데이터들)
-- 입력 컬럼의 순서와 입력 데이터의 순서는 같아야한다.
insert into dept01 (deptno, dname, loc) values (10, 'MANAGER', 'SEOUL');
insert into dept01 values(20,'DESIGN', 'BUSAN');
insert into dept01 (loc, deptno, dname) values('London',30, 'BUSAN');
insert into dept01 (deptno, dname) values(40,'DEV');
desc dept01;
select * from dept01;
create table dept02(
deptno number(2) not null,
dname varchar2(20) not null,
loc varchar2(20) default 'SEOUL'
);
insert into dept02 (deptno, dname, loc) values (10, 'MANAGER', 'SEOUL');
insert into dept02 (deptno, dname) values(40,'DEV');
insert into dept02 values(40,'DEV'); -- 오류 : 입력 할 컬럼 수가 다름
--loc null이 아닐때 삽입 가능
--alter table dept02 modify(loc varchar2(30) default'SEOUL' null);
insert into dept02 (deptno, dname, loc) values (20, 'MANAGER', null); --null 값으로 입력됨
insert into dept02 (deptno, dname, loc) values (30, 'MANAGER', ''); --null 값으로 입력
insert into dept02 (deptno, dname) values (30, 'MANAGER', ''); -- 오류 발생, 컬럼 목록 수가 다름
delete from dept02 where dname='test';
--loc not null일 때
alter table dept02 modify(loc varchar2(20) default'SEOUL' not null); --제약 조건 변경
insert into dept02 (deptno ,dname, loc) values(60,'test', 'locTest');--불가능
insert into dept02 (deptno, dname, loc) values (30, 'MANAGER', ''); --추가 불가능
select * from dept02;
desc dept02;
--서브쿼리를 이용해서 여러 테이블에 한번에 데이터 삽입
--테스트 테이블 emp_hir : empno, ename, hiredate
-- 테스트 테이블 emp_mgt : empno, enmae, mgr
--emp 테이블의 구조를 가져옴
create table emp_hir
as
select empno, ename, hiredate from emp where 1<0;
create table emp_mgr
as
select empno, ename, mgr from emp where 1<0;
desc emp_hir;
desc emp_mgr;
-- 두 개의 테이블에 emp 테이터를 기반으로 삽입 ◆
insert all
into emp_hir values(empno, ename, hiredate)
into emp_mgr values(empno, ename, mgr)
select empno, ename, hiredate, mgr
from emp
;
select * from emp_hir;
select * from emp_mgr;
-- 예제)) INSERT ALL 명령문에
--WHEN 절을 추가해서 조건을 제시하여 조건에 맞는 행만 추출하여 테이블에 추가합니다
--EMP_HIR02 테이블에는 1982 년 01 월01 일 이후에 입사한 사원들의 번호, 사원 명, 입사일을 추가
--EMP_SAL 테이블에는 급여가 2000 이상인 사원들의 번호, 사원 명, 급여를 추가
create table emp_hir02
as
select empno,ename, hiredate from emp where 1<0;
create table emp_sal
as
select empno,ename,sal from emp where 1<0;
desc emp_hir02;
desc emp_sal;
insert all
when hiredate > '82/01/01' then
into emp_hir02 values(empno, ename, hiredate)
when sal>=2000 then
into emp_sal values(empno, ename, sal)
select empno, ename, hiredate, sal from emp
;
----------------------------
--DML 수정, 삭제
-----------------------------
--UPDATE
drop table emp01;
create table emp01
as
select * from emp
;
-- 컬럼 데이터 변경( 수정 )
-- UPDATE 테이블 이름 SET [컬럼이름1]=변경 할 값, [컬럼이름2]=변경 할 값, .... WHERE 행을 찾는 조건식
-- 모든행 컬럼 수정
-- WHERE 절이 없는 경우 테이블의 모든 행이 영향을 받음
select * from emp01;
--예제 1)) 모든 사원의 부서번호를 30번으로 수정
update emp01
set deptno=30
;
select * from emp01;
--예제 2)) 모든 사원의 급여를 10% 인상( UPDATE문 )
update emp01
--set sal=sal*0.1
set sal = sal * 1.1
;
select * from emp01;
-- 예제 3)) 모든 사원의 입사일을 오늘 날짜로 수정
update emp01
set hiredate=sysdate
;
update emp
set hiredate=sysdate;
select * from emp;
commit;
rollback;
select * from emp01;
drop table emp01;
--특정 행만 변경할 때
--예제 1)) 부서번호가 10번인 사원의 부서번호를 30번으로 수정
update emp01
set deptno=30
where deptno=10;
select * from emp01;
-- 예제 2)) 급여가 3000 이상인 사원만 급여를 10% 인상
update emp01
set sal=sal*1.1
where sal>=3000
;
select * from emp01;
--예제 3)) 1987년에 입사한 사원의 입사일이 오늘로 수정
-- => 87년 입사한 사람 출력하는 방법 1
select * from emp
where hiredate between '1987/01/01' and '1987/12/31';
-- => 87년 입사한 사람 출력하는 방법 2
select * from emp
where substr(hiredate,1,2)='87';
update emp01
set hiredate=sysdate
where substr(hiredate,1,2)='87'
;
select * from emp01;
-- 두개 이상의 컬럼 값 변경
--예제 1)) SCOTT 사원의 부서번호는 20번으로, 직급은 MANAGER로 한꺼번에 수정
update emp01
set deptno=10, job='MANAGER'
where ename='SCOTT';
select * from emp where ename='SCOTT';
select * from emp01 where ename='SCOTT'; --직급 변경
--예제 2)) SCOTT 사원의 입사일자는 오늘로, 급여를 50 으로 커미션을 4000 으로 수정
update emp01
set sal=50, comm=4000, hiredate=sysdate
where ename='SCOTT';
select * from emp01 where ename='SCOTT';
--서브 쿼리를 이용하여 두 개 이상의 컬럼값 변경
-- 예제 1)) 20번 부서의 지역명을 40번 부서의 지역명으로 변경하기 위해서 서브 쿼리문을 사용해 봅시다 => 한개의 컬럼 변경
-- 방법1
select * from dept01;
drop table dept01;
create table dept01
as
select * from dept;
update dept01
set loc=(
select loc from dept01 where deptno=40
)
where deptno=20
;
--예제 2))부서번호가 20인 부서의 부서명과 지역명을 부서 번호가 40번인 부서와 동일하게 변경 => 두개 컬럼 변경
update dept01
set dname=(select dname from dept01 where deptno=40),
loc=(select loc from dept01 where deptno=40)
where deptno=20;
update dept01
set (dname, loc)=(select dname, loc from dept01 where deptno=40)
where deptno=20;
select * from dept01;
rollback;
-----------------------------------
--DML 삭제
------------------------------------
--DELETE FROM 테이블 이름 WHERE 행을 찾을 조건식
--모든 행을 삭제한다
--WHERE 절이 없으면 모든행에 영향을 받음
--예제 ) 부서 테이블의 모든 행을 삭제
delete from dept01;
select * from dept01;
-- 특정 행 만 삭제 - where절 이용
--예제 )) 부서 테이블에서 30번 부서만 삭제
rollback;
delete from dept01 where deptno=30;
select * from dept01;
--서브 쿼리를 이용해서 행 삭제
--예제 ))사원 테이블에서 부서명이 SALES인 사원을 모두 삭제
rollback;
select deptno from dept where dname='SALES';
select * from emp01;
delete from emp01 where deptno = (
select deptno from dept where dname='SALES'
);
select * from emp01;
|
-- Table definitions for the tournament project.
--
-- Put your SQL 'create table' statements in this file; also 'create view'
-- statements if you choose to use it.
--
-- You can write comments in this file by starting them with two dashes, like
-- these lines here.
-- Drop the database
DROP DATABASE IF EXISTS tournament;
CREATE DATABASE tournament;
\c tournament
-- DROP old tables
-- DROP old views
-- DROP VIEW IF EXISTS wins;
-- DROP VIEW IF EXISTS standings;
-- DROP TABLE IF EXISTS players CASCADE ;
-- DROP TABLE IF EXISTS matches CASCADE ;
-- Creating players table with id and player name
CREATE TABLE players (
id SERIAL PRIMARY KEY,
player_name VARCHAR(71)
);
-- Creating matches table with match_id, winner, and loser
CREATE TABLE matches (
match_id SERIAL PRIMARY KEY,
winner INT REFERENCES players(id) NOT NULL,
loser INT REFERENCES players(id) NOT NULL
);
-- Creating a view to show player id, player name, wins, and total matches
CREATE VIEW standings AS
SELECT players.id, players.player_name,
(SELECT count(matches.winner) FROM matches
WHERE players.id = matches.winner)
AS wins,
(SELECT count(matches.match_id) FROM matches
WHERE players.id = matches.winner
OR players.id = matches.loser)
AS matches
FROM players
ORDER BY wins; |
/******** Commonly Used Functions for Time Series ***********/
/* we will assume last digit of server_id is department id */
CREATE VIEW time_series.vw_utilization AS(
SELECT *, server_id % 10 AS dept_id
FROM time_series.utilization
);
SELECT * FROM time_series.vw_utilization
LIMIT 5;
--------------------- LEAD() function ---------------------------
-- LEAD() looks forwards and allows us to compare condition with the next nth row of current row.
-- we can also put offset of how many next rows we want to get.
-- next 1 row
SELECT dept_id, server_id, cpu_utilization,
LEAD(cpu_utilization) OVER (PARTITION BY dept_id ORDER BY cpu_utilization DESC)
FROM time_series.vw_utilization
WHERE event_time BETWEEN '2019-03-05' AND '2019-03-06';
-- next 3 row
SELECT dept_id, server_id, cpu_utilization,
LEAD(cpu_utilization, 3) OVER (PARTITION BY dept_id ORDER BY cpu_utilization DESC)
FROM time_series.vw_utilization
WHERE event_time BETWEEN '2019-03-05' AND '2019-03-06';
|
--
-- Update sql for MailWizz EMA from version 1.4.0 to 1.4.1
-- |
create table `group` (
id int(11) not null auto_increment,
name varchar(255),
primary key (id)
);
create table group_role (
id int(11) not null auto_increment,
group_id int(11),
role_id int(11),
role_type_id int(11),
foreign key (group_id) references `group` (id) on delete cascade,
foreign key (role_id) references role (id) on delete cascade,
foreign key (role_type_id) references role_type (id) on delete cascade,
primary key (id)
);
insert into role_type values (4,'Role Agent', 1);
insert into user_type values (4,'Agent', 1);
create table config (
id int(11) not null auto_increment,
keyword text,
value text,
primary key (id)
);
insert into config (`keyword`, value) values ('cms_preference',''); |
---
--- Copyright 2012 Johns Hopkins University
---
--- Licensed under the Apache License, Version 2.0 (the "License");
--- you may not use this file except in compliance with the License.
--- You may obtain a copy of the License at
---
--- http://www.apache.org/licenses/LICENSE-2.0
---
--- Unless required by applicable law or agreed to in writing, software
--- distributed under the License is distributed on an "AS IS" BASIS,
--- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
--- See the License for the specific language governing permissions and
--- limitations under the License.
---
--- Can't yet insert into the project table because the DAO tests will complain
--- INSERT INTO project VALUES ('project:/1', '1234', 'Project One', 'Project seeded by BootstrapData.sql', '0', '0', '0', '0', 'NSF')
--- INSERT INTO relationships VALUES ('admin', 'project:/1', 'IS_ADMINISTRATOR_FOR')
--- INSERT INTO relationships VALUES ('project:/1', 'admin', 'IS_ADMINISTERED_BY')
--- INSERT INTO relationships VALUES ('chunkymonkey@benandjerrys.com', 'project:/1', 'IS_ADMINISTRATOR_FOR')
--- INSERT INTO relationships VALUES ('project:/1', 'chunkymonkey@benandjerrys.com', 'IS_ADMINISTERED_BY')
---
---
--- Disciplines
---
INSERT INTO DISCIPLINE VALUES ('dc:discipline:Biology', 'Biology')
INSERT INTO DISCIPLINE VALUES ('dc:discipline:Astronomy', 'Astronomy')
INSERT INTO DISCIPLINE VALUES ('dc:discipline:EarthScience', 'Earth Science')
INSERT INTO DISCIPLINE VALUES ('dc:discipline:SocialScience', 'Social Science')
INSERT INTO DISCIPLINE VALUES ('dc:discipline:None', 'None')
---
--- Relationships between Disciplines and MetadataFormats (Obverse)
---
INSERT INTO relationships VALUES ('dc:discipline:Biology', 'dc:format:metadata/TaxonX', 'AGGREGATES')
INSERT INTO relationships VALUES ('dc:discipline:Biology', 'dc:format:metadata/EML', 'AGGREGATES')
INSERT INTO relationships VALUES ('dc:discipline:Biology', 'dc:format:metadata/DarwinCore', 'AGGREGATES')
INSERT INTO relationships VALUES ('dc:discipline:Biology', 'dc:format:metadata/DarwinCoreArchive', 'AGGREGATES')
INSERT INTO relationships VALUES ('dc:discipline:Biology', 'dc:format:metadata/TaxonConceptSchema', 'AGGREGATES')
INSERT INTO relationships VALUES ('dc:discipline:Biology', 'dc:format:metadata/AudubonCore', 'AGGREGATES')
INSERT INTO relationships VALUES ('dc:discipline:EarthScience', 'dc:format:metadata/CGDSMFGDC', 'AGGREGATES')
INSERT INTO relationships VALUES ('dc:discipline:EarthScience', 'dc:format:metadata/ISO19115', 'AGGREGATES')
INSERT INTO relationships VALUES ('dc:discipline:EarthScience', 'dc:format:metadata/NASADIF', 'AGGREGATES')
INSERT INTO relationships VALUES ('dc:discipline:EarthScience', 'dataconservancy.org:formats:file:metadata:fgdc:xml', 'AGGREGATES')
INSERT INTO relationships VALUES ('dc:discipline:Astronomy', 'dc:format:metadata/AVM', 'AGGREGATES')
INSERT INTO relationships VALUES ('dc:discipline:Astronomy', 'dc:format:metadata/STC', 'AGGREGATES')
INSERT INTO relationships VALUES ('dc:discipline:Astronomy', 'dc:format:metadata/FITS', 'AGGREGATES')
INSERT INTO relationships VALUES ('dc:discipline:None', 'dc:format:metadata/None', 'AGGREGATES')
---
--- Relationships between Disciplines and MetadataFormats (Inverse)
---
INSERT INTO relationships VALUES ('dc:format:metadata/TaxonX', 'dc:discipline:Biology', 'IS_AGGREGATED_BY')
INSERT INTO relationships VALUES ('dc:format:metadata/EML', 'dc:discipline:Biology', 'IS_AGGREGATED_BY')
INSERT INTO relationships VALUES ('dc:format:metadata/DarwinCore', 'dc:discipline:Biology', 'IS_AGGREGATED_BY')
INSERT INTO relationships VALUES ('dc:format:metadata/DarwinCoreArchive', 'dc:discipline:Biology', 'IS_AGGREGATED_BY')
INSERT INTO relationships VALUES ('dc:format:metadata/TaxonConceptSchema', 'dc:discipline:Biology', 'IS_AGGREGATED_BY')
INSERT INTO relationships VALUES ('dc:format:metadata/AudubonCore', 'dc:discipline:Biology', 'IS_AGGREGATED_BY')
INSERT INTO relationships VALUES ('dc:format:metadata/CGDSMFGDC', 'dc:discipline:EarthScience', 'IS_AGGREGATED_BY')
INSERT INTO relationships VALUES ('dc:format:metadata/ISO19115', 'dc:discipline:EarthScience', 'IS_AGGREGATED_BY')
INSERT INTO relationships VALUES ('dc:format:metadata/NASADIF', 'dc:discipline:EarthScience', 'IS_AGGREGATED_BY')
INSERT INTO relationships VALUES ('dataconservancy.org:formats:file:metadata:fgdc:xml', 'dc:discipline:EarthScience', 'IS_AGGREGATED_BY')
INSERT INTO relationships VALUES ('dc:format:metadata/AVM', 'dc:discipline:Astronomy', 'IS_AGGREGATED_BY')
INSERT INTO relationships VALUES ('dc:format:metadata/STC', 'dc:discipline:Astronomy', 'IS_AGGREGATED_BY')
INSERT INTO relationships VALUES ('dc:format:metadata/FITS', 'dc:discipline:Astronomy', 'IS_AGGREGATED_BY')
INSERT INTO relationships VALUES ('dc:format:metadata/None', 'dc:discipline:None', 'IS_AGGREGATED_BY')
---
--- Metadata Format business properties
---
INSERT INTO METADATA_FORMAT_PROPERTIES VALUES ('dataconservancy.org:formats:file:xsd:2004', '10', true)
INSERT INTO METADATA_FORMAT_PROPERTIES VALUES ('dataconservancy.org:formats:file:metadata:fgdc:xml', '10', true)
|
CREATE TABLE IF NOT EXISTS "Cliente" (
"codigoCliente" INTEGER NOT NULL,
"dni" VARCHAR(9) NOT NULL,
PRIMARY KEY("codigoCliente" AUTOINCREMENT),
FOREIGN KEY("dni") REFERENCES "Persona"("dni")
); |
DROP TABLE IF EXISTS Sugar;
DROP TABLE IF EXISTS Goals;
DROP TABLE IF EXISTS Diary;
DROP TABLE IF EXISTS Food;
DROP TABLE IF EXISTS User;
CREATE TABLE User (
userId INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
userName VARCHAR(100) NOT NULL,
name VARCHAR(100) NOT NULL,
gender VARCHAR(1) NOT NULL,
dob DATE NOT NULL,
height DECIMAL(3, 2) NOT NULL,
weight DECIMAL(4, 2) NOT NULL,
password VARCHAR(100) NOT NULL,
points INTEGER NOT NULL,
CONSTRAINT userName_unique UNIQUE (userName)
);
CREATE TABLE Food (
foodId INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
name VARCHAR(100) NOT NULL,
calories DECIMAL(5,2),
sugar DECIMAL(5, 2),
fat DECIMAL(5, 2),
saturates DECIMAL(5, 2),
carbs DECIMAL(5, 2),
salt DECIMAL(5, 4),
protein DECIMAL(5, 2),
CONSTRAINT name_unique UNIQUE (name)
);
CREATE TABLE Diary (
diaryId INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
theDate DATE NOT NULL,
userId INTEGER NOT NULL,
foodId INTEGER NOT NULL,
CONSTRAINT fk_userId FOREIGN KEY (userId) REFERENCES User(userId),
CONSTRAINT fk_foodId FOREIGN KEY (foodId) REFERENCES Food(foodId)
);
CREATE TABLE Goals (
goalId INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
userId INTEGER NOT NULL,
targetSugar DECIMAL (5, 2),
targetCalories DECIMAL(5, 2),
targetFat DECIMAL(5, 2),
targetSaturates DECIMAL(5, 2),
targetCarbs DECIMAL(5, 2),
targetSalt DECIMAL(5, 2),
targetProtein DECIMAL(5, 2),
CONSTRAINT unique_userId UNIQUE (userId),
CONSTRAINT fk_userId FOREIGN KEY (userId) REFERENCES User(userId)
);
CREATE TABLE Sugar (
goalId INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
userId INTEGER NOT NULL,
allowance DECIMAL(5, 2),
reduction DECIMAL(5, 2),
CONSTRAINT unique_userId UNIQUE (userId),
CONSTRAINT fk_userId FOREIGN KEY (userId) REFERENCES User(userId)
);
|
SELECT count(assistance_requests) as total_assistances, name
FROM students
JOIN assistance_requests ON students.id = student_id
WHERE students.name = 'Elliot Dickinson'
GROUP BY students.name;
|
/*
Navicat Premium Data Transfer
Source Server : 本地
Source Server Type : MySQL
Source Server Version : 80026
Source Host : localhost:3306
Source Schema : stu_info
Target Server Type : MySQL
Target Server Version : 80026
File Encoding : 65001
Date: 31/08/2021 10:16:10
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for t_achievement
-- ----------------------------
DROP TABLE IF EXISTS `t_achievement`;
CREATE TABLE `t_achievement` (
`id` int NOT NULL AUTO_INCREMENT COMMENT '编号',
`sno` int NOT NULL COMMENT '学号',
`semester` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '学期',
`Chinese` varchar(3) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '语文',
`mathematics` varchar(3) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '数学',
`English` varchar(3) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '英语',
`physics` varchar(3) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '物理',
`chemistry` varchar(3) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '化学',
`biology` varchar(3) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '生物',
`geography` varchar(3) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '地理',
`history` varchar(3) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '历史',
`politics` varchar(3) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '政治',
`sports` varchar(3) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '体育',
`music` varchar(3) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '音乐',
`practice` varchar(3) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '实践',
`java` varchar(3) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0',
`cplus` varchar(3) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0',
`python` varchar(3) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0',
`c` varchar(3) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0',
`html` varchar(3) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0',
`css` varchar(3) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0',
`javascript` varchar(3) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 10 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for t_class
-- ----------------------------
DROP TABLE IF EXISTS `t_class`;
CREATE TABLE `t_class` (
`sclassno` int NOT NULL COMMENT '班级编号',
`sclassname` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '班级名称',
PRIMARY KEY (`sclassno`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for t_stu
-- ----------------------------
DROP TABLE IF EXISTS `t_stu`;
CREATE TABLE `t_stu` (
`sno` int NOT NULL COMMENT '学号',
`sname` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '姓名',
`idno` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '身份证号',
`age` varchar(11) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '年龄',
`sex` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '1' COMMENT '性别,‘0’女,‘1’男',
`hometown` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '籍贯',
`nationality` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '民族',
`address` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '家庭住址',
`phone` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '电话号码',
`sclassno` varchar(11) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '学生班级编号',
PRIMARY KEY (`sno`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for t_teacher
-- ----------------------------
DROP TABLE IF EXISTS `t_teacher`;
CREATE TABLE `t_teacher` (
`tno` int NOT NULL COMMENT '账号',
`tname` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '姓名',
`tpassword` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '密码',
`phone` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '电话号码',
`email` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '邮箱地址',
`admin` int NULL DEFAULT 0 COMMENT '系统权限',
PRIMARY KEY (`tno`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
SET FOREIGN_KEY_CHECKS = 1;
|
.mode column
.headers on
PRAGMA foreign_keys = ON;
-- Querying data
-- Every month the following reports need to be run:
-- Find the top 5 offices with the most sales for that month.
SELECT "1. Finding the top 5 offices with the most sales for that month (Feb.)";
SELECT "---------------------------------";
SELECT Office Office_ID , COUNT (*) NO_Sold FROM Houses
INNER JOIN Sales ON Houses.ID=Sales.HouseID
WHERE strftime('%m', Sales.SoldDate) = "02"
GROUP BY Office
ORDER BY NO_Sold DESC
Limit 5;
-- Find the top 5 estate agents who have sold the most (include their contact details and their sales details so that it is easy contact them and congratulate them).
SELECT "2. Finding the top 5 estate agents who have sold the most";
SELECT "---------------------------------";
SELECT Agent.ID as "Agent ID", Agent.FirstName as "First Name" , Agent.LastName as "Last Name" ,
Agent.Email as "Email",Agent.Phone as "Phone Number" ,
COUNT (*) NO_Sold FROM Sales
INNER JOIN Agent ON Sales.SellingAgent=Agent.ID
WHERE strftime('%m', Sales.SoldDate) = "02"
GROUP BY Agent.ID
ORDER BY NO_Sold DESC
Limit 5;
-- Calculate the commission that each estate agent must receive and store the results in a separate table.
SELECT "3. Calculating the commission that each estate agent must receive";
SELECT "-----------------------------------------------------";
INSERT INTO CommissionSummary (AgentID, TotalComission)
SELECT SellingAgent as "Agent ID", SUM (Commission) FROM AgentCommission
GROUP BY SellingAgent;
SELECT * FROM CommissionSummary;
-- For all houses that were sold that month, calculate the average number of days that the house was on the market.
SELECT "4. Calculating the average number of days that the house was on the market";
SELECT "-----------------------------------------------------";
SELECT Round (AVG (julianday (Sales.SoldDate) - julianday (Houses.DateListing))) as "Average number of days that the house was on the market" FROM Sales
INNER JOIN Houses ON Houses.ID=Sales.HouseID
WHERE strftime('%m', Sales.SoldDate) = "02";
-- For all houses that were sold that month, calculate the average selling price
SELECT "5. Calculating the average selling price";
SELECT "-----------------------------------------------------";
SELECT ROUND( AVG (FinalPrice)) as "Average Selling Price" From Sales
WHERE strftime('%m', Sales.SoldDate) = "02";
-- Find the zip codes with the top 5 average sales prices
SELECT "6. Finding the zip codes with the top 5 average sales prices";
SELECT "-----------------------------------------------------";
SELECT Houses.ZipCode ,ROUND( AVG (FinalPrice)) as "Average Selling Price" From Sales
INNER JOIN Houses ON Houses.ID=Sales.HouseID
WHERE strftime('%m', Sales.SoldDate) = "02"
GROUP BY Houses.ZipCode
ORDER BY "Average Selling Price" DESC
LIMIT 5; |
CREATE procedure sp_ser_bookstock_issue_fmcg(@PRODUCT_CODE nvarchar(15),
@TRACK_BATCH int, @CAPTURE_PRICE int)
AS
IF @CAPTURE_PRICE = 1
BEGIN
IF @TRACK_BATCH = 1
BEGIN
Select Batch_Number 'batch', Expiry 'expiry', SUM(Quantity) 'qty', SalePrice 'price', PKD,
Isnull(Free, 0) 'free', IsNull(Max(TaxSuffered), 0) 'TaxSuffered',
isnull(PurchasePrice, 0) 'Purchaseprice'
From Batch_Products where Product_Code= @PRODUCT_CODE AND
Quantity > 0 And ISNULL(Damage, 0) = 0
Group By Batch_Number, Expiry, SalePrice, PKD, Isnull(Free, 0), isnull(PurchasePrice , 0)
Order By Isnull(Free, 0), MIN(Batch_Code)
END
ELSE
BEGIN
Select '' 'batch', '' 'expiry', SUM(Quantity) 'qty', SalePrice 'price', PKD, Isnull(Free, 0) 'free',
IsNull(Max(TaxSuffered), 0) 'TaxSuffered', isnull(PurchasePrice, 0) 'Purchaseprice'
From Batch_Products where Product_Code= @PRODUCT_CODE AND Quantity > 0 And
ISNULL(Damage, 0) = 0
Group By SalePrice, PKD, Isnull(Free, 0), isnull(PurchasePrice , 0)
Order By Isnull(Free, 0), MIN(Batch_Code)
END
END
ELSE --- Option CSP Capture Price
BEGIN
IF @TRACK_BATCH = 1
BEGIN
Select Batch_Number 'batch', Expiry 'expiry', SUM(Quantity) 'qty', 0 'price', PKD,
Isnull(Free, 0) 'free', IsNull(Max(TaxSuffered), 0) 'TaxSuffered', isnull(PurchasePrice, 0) 'Purchaseprice'
From Batch_Products where Product_Code= @PRODUCT_CODE AND
Quantity > 0 And ISNULL(Damage, 0) = 0
Group By Batch_Number, Expiry, PKD, Isnull(Free, 0), isnull(SalePrice , 0), isnull(PurchasePrice, 0)
Order By Isnull(Free, 0), MIN(Batch_Code)
END
ELSE /* PKD = 1 */
BEGIN
Select '' 'batch', '' 'expiry', SUM(Quantity) 'qty', 0 'price', '' 'PKD', Isnull(Free, 0) 'free',
IsNull(Max(TaxSuffered), 0) 'TaxSuffered', isnull(PurchasePrice, 0) 'Purchaseprice'
From Batch_Products
where Product_Code= @PRODUCT_CODE AND Quantity > 0 And
ISNULL(Damage, 0) = 0
Group By isnull(Free,0) ,isnull(SalePrice, 0), isnull(PurchasePrice, 0)
Order By Isnull(Free, 0), MIN(Batch_Code)
END
END
|
/**
* Pull 2015-2016 Words Read Data
*/
SELECT
s.local_student_id,
field_words_read_aug15 AS aug,
field_words_read_sep15 AS sep,
field_words_read_oct15 AS oct,
field_words_read_nov15 AS nov,
field_words_read_dec15 AS dec,
field_words_read_jan16 AS jan,
field_words_read_feb16 AS feb,
field_words_read_mar16 AS mar,
field_words_read_apr16 AS apr,
field_words_read_may16 AS may
FROM dna_repositories.repository_147 r
INNER JOIN public.students s ON r.student_id = s.student_id |
INSERT INTO "game" VALUES(0,"2018-2-21 13:40:36.877952", "2018-2-25 13:40:36.877952", 10, 10, 5);
INSERT INTO "game" VALUES(1,"2018-2-22 12:40:36.877952", null, 10, 10, 5);
INSERT INTO "game" VALUES(2,"2018-2-23 12:40:36.877952", null, 12, 12, 10);
INSERT INTO "player" VALUES(0, "Fu1L_s41V0_n05CoP3_720", 0);
INSERT INTO "player" VALUES(1, "Captain Haddock", 0);
INSERT INTO "player" VALUES(2, "SUBMARINEGOD", 0);
INSERT INTO "player" VALUES(0, "Delete me!", 1);
INSERT INTO "player" VALUES(1, "Just another player", 1);
INSERT INTO "ship" VALUES(0, 0, 0, 2, 3, 2, 6, "frigate");
INSERT INTO "ship" VALUES(1, 0, 0, 3, 6, 6, 6, "submarine");
INSERT INTO "ship" VALUES(2, 1, 0, 3, 6, 4, 4, "submarine");
INSERT INTO "ship" VALUES(3, 1, 0, 9, 5, 9, 9, "carrier");
INSERT INTO "turn" VALUES(0, 0, 0);
INSERT INTO "turn" VALUES(0, 1, 0);
INSERT INTO "turn" VALUES(0, 2, 0);
INSERT INTO "turn" VALUES(1, 0, 0);
INSERT INTO "turn" VALUES(0, 0, 1);
INSERT INTO "shot" VALUES(0, 0, 0, 4, 4, "single");
INSERT INTO "shot" VALUES(0, 1, 0, 3, 3, "single");
INSERT INTO "shot" VALUES(0, 2, 0, 2, 3, "single");
INSERT INTO "shot" VALUES(1, 0, 0, 5, 4, "single");
INSERT INTO "shot" VALUES(0, 0, 1, 2, 2, "bomb");
|
SET NAMES utf8;
SET time_zone = '+00:00';
SET foreign_key_checks = 0;
SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
SET NAMES utf8mb4;
CREATE DATABASE `testdb` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci */ /*!80016 DEFAULT ENCRYPTION='N' */;
USE `testdb`;
DROP TABLE IF EXISTS `drink`;
CREATE TABLE `drink` (
`ID` int NOT NULL,
`who` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
`drink` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
`sugar` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
`ice` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
DROP TABLE IF EXISTS `movielist`;
CREATE TABLE `movielist` (
`ID` int NOT NULL,
`idre` varchar(60) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
`moviename` varchar(60) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
INSERT INTO `movielist` (`ID`, `idre`, `moviename`) VALUES
(1, '1292052', '肖申克的救赎');
DROP TABLE IF EXISTS `new_table`;
CREATE TABLE `new_table` (
`ID` int NOT NULL,
`Name` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
`text` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
INSERT INTO `new_table` (`ID`, `Name`, `text`) VALUES
(53, NULL, NULL);
DROP TABLE IF EXISTS `page3`;
CREATE TABLE `page3` (
`ID` int NOT NULL,
`name` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
`text` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
`input1` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
`input2` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
INSERT INTO `page3` (`ID`, `name`, `text`, `input1`, `input2`) VALUES
(1, '我是第一頁', '測試用內文1', NULL, NULL),
(2, '我是第二頁', '測試用內文2', NULL, NULL),
(3, '我是第三頁', '測試用內文3', NULL, NULL);
DROP TABLE IF EXISTS `product`;
CREATE TABLE `product` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT,
`created_at` datetime(3) DEFAULT NULL,
`updated_at` datetime(3) DEFAULT NULL,
`deleted_at` datetime(3) DEFAULT NULL,
`code` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci,
`price` bigint unsigned DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `idx_products_deleted_at` (`deleted_at`),
KEY `idx_product_deleted_at` (`deleted_at`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
INSERT INTO `product` (`id`, `created_at`, `updated_at`, `deleted_at`, `code`, `price`) VALUES
(1, '2021-03-29 12:28:35.568', '2021-03-29 12:28:35.579', NULL, 'F42', 200),
(2, '2021-03-29 12:29:58.794', '2021-03-29 12:29:58.801', NULL, 'F42', 200),
(3, '2021-03-29 12:30:58.603', '2021-03-29 12:30:58.622', NULL, 'F42', 200),
(4, '2021-03-29 12:31:36.760', '2021-03-29 12:31:36.768', '2021-03-29 12:31:36.770', 'F42', 200),
(5, '2021-03-29 12:31:48.726', '2021-03-29 12:31:48.736', '2021-03-29 12:34:08.422', 'F42', 200);
DROP TABLE IF EXISTS `weather`;
CREATE TABLE `weather` (
`ID` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci NOT NULL,
`Name` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
`Text` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
INSERT INTO `weather` (`ID`, `Name`, `Text`) VALUES
('1', '台北', '台北很冷,22度'),
('2', '台中', '台中普通,25度'),
('3', '台南', '台南很熱,29度'),
('4', '高雄', '高雄很熱,31度');
CREATE DATABASE `zmemberdb` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci */ /*!80016 DEFAULT ENCRYPTION='N' */;
USE `zmemberdb`;
DROP TABLE IF EXISTS `logintime`;
CREATE TABLE `logintime` (
`id` int NOT NULL AUTO_INCREMENT,
`account` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
`login_time` int DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
INSERT INTO `logintime` (`id`, `account`, `login_time`) VALUES
(1, 'admin', 1620713800),
(2, 'jared', 1620713846),
(3, 'jared', 1620713900);
DROP TABLE IF EXISTS `member`;
CREATE TABLE `member` (
`id` int NOT NULL AUTO_INCREMENT,
`account` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
`password` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
`jwt` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
INSERT INTO `member` (`id`, `account`, `password`, `jwt`, `updated_at`) VALUES
(1, 'admin', '21232f297a57a5a743894a0e4a801fc3', 'indontneedthis', '2021-05-11 07:07:26'),
(2, 'jared', 'b620e68b3bf4387bf7c43d51bd12910b', NULL, '2021-05-11 07:07:26');
|
CREATE PROCEDURE [actual].[pDel_task]
AS
TRUNCATE TABLE [actual].[task] |
-- phpMyAdmin SQL Dump
-- version 4.8.4
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Apr 25, 2019 at 06:59 PM
-- Server version: 10.1.37-MariaDB
-- PHP Version: 7.3.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 utf8mb4 */;
--
-- Database: `phac`
--
-- --------------------------------------------------------
--
-- Table structure for table `forums`
--
CREATE TABLE `forums` (
`id` int(11) NOT NULL,
`title` varchar(30) NOT NULL,
`forum_id` varchar(8) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `forums`
--
INSERT INTO `forums` (`id`, `title`, `forum_id`) VALUES
(1, 'General', 'qrUmqJNW'),
(2, 'PCA', 'NveVPVLS'),
(3, 'ARC', 'lVSQBbwo'),
(4, 'Security', 'BOqobVvo'),
(5, 'Impact', 'ABzYFyQx'),
(6, 'Finance', 'NbBfQVHE'),
(7, 'Golf', 'KKEXVecK'),
(8, 'Clubhouse', 'yJcgmXwm'),
(9, 'Fitness', 'tCnSNHbd');
-- --------------------------------------------------------
--
-- Table structure for table `login_tokens`
--
CREATE TABLE `login_tokens` (
`id` int(11) NOT NULL,
`token` char(64) NOT NULL,
`user_id` varchar(8) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `login_tokens`
--
INSERT INTO `login_tokens` (`id`, `token`, `user_id`) VALUES
(0, '60e6c8fe879c670e3d45f747c250b3914ff7b8cc', '1Hovw2l3'),
(0, 'bb06ff839dd4e87f7dd4c3d9310d9281d5985e1e', '1Hovw2l3'),
(0, '158b4e076e418146fd80a1a5bb6d6ced61f26a53', 'S92ksGgh'),
(0, '9a6ca55e28e2e6255dc52789d464531c886c623e', 'S92ksGgh'),
(0, '6c2c7f83ef64366459d286dc834790e947b988d0', '1Hovw2l3'),
(0, 'e4e00d9d5c73fa0c021de1dfc515bf3270713335', '1Hovw2l3');
-- --------------------------------------------------------
--
-- Table structure for table `posts`
--
CREATE TABLE `posts` (
`id` int(11) NOT NULL,
`forum_id` varchar(8) NOT NULL,
`post_id` varchar(8) NOT NULL,
`user_id` varchar(8) NOT NULL,
`title` text NOT NULL,
`message` longtext NOT NULL,
`pinned` tinyint(1) NOT NULL,
`upvotes` int(11) NOT NULL,
`downvotes` int(11) NOT NULL,
`post_img` varchar(255) NOT NULL,
`date` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `posts`
--
INSERT INTO `posts` (`id`, `forum_id`, `post_id`, `user_id`, `title`, `message`, `pinned`, `upvotes`, `downvotes`, `post_img`, `date`) VALUES
(1, '', 'qEZS47RV', '1Hovw2l3', '', '', 0, 0, 0, '', '2019-04-19 04:23:00'),
(2, 'qrUmqJNW', 'cnVPLfsI', '1Hovw2l3', 'sdfsdf', 'sdfsd', 0, 0, 0, '', '2019-04-19 04:28:00'),
(3, 'qrUmqJNW', 'WXuSCUaq', '1Hovw2l3', 'sdfsdf', 'sdfsf', 0, 0, 0, 'uploads/1Hovw2l3/Fr4DeQSker.png', '2019-04-19 04:28:13'),
(4, 'qrUmqJNW', 'WfDj5PMn', '1Hovw2l3', 'fdsgf', 'sdfsdf', 0, 0, 0, 'uploads/1Hovw2l3/NmPIVtnkch.png', '2019-04-19 10:32:58'),
(5, 'lVSQBbwo', 'CRAazp6W', '1Hovw2l3', 'adasd', 'asdasd', 0, 0, 0, 'uploads/1Hovw2l3/7V0zXFNzh2.png', '2019-04-19 12:08:58');
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
CREATE TABLE `users` (
`id` int(11) NOT NULL,
`user_id` varchar(8) NOT NULL,
`email` text NOT NULL,
`password` varchar(60) NOT NULL,
`firstname` varchar(30) NOT NULL,
`lastname` varchar(30) NOT NULL,
`verified` tinyint(1) NOT NULL DEFAULT '0',
`profile_img` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `users`
--
INSERT INTO `users` (`id`, `user_id`, `email`, `password`, `firstname`, `lastname`, `verified`, `profile_img`) VALUES
(4, '1Hovw2l3', 'kaifergerstrom@gmail.com', '$2y$10$qKjLqZ1BrsH/W3kjemKrheCynUBe3GdpaLHBxl7HkBMbm5zdtO0ae', 'Kai', 'Fergerstrom', 1, 'default.png'),
(7, 'S92ksGgh', 'paola@lavu.net', '$2y$10$qKjLqZ1BrsH/W3kjemKrheCynUBe3GdpaLHBxl7HkBMbm5zdtO0ae', 'Paola', 'Fergerstrom', 1, 'default.png'),
(8, '0hZ7DK4e', 'asdasda@asdasd.asd', '$2y$10$vJvmj1XTvOZs8n9q/Y4qp.T3cX72sXy4OY2HQF1NFFvbMeEdFFgJa', 'asdasd', 'asdasd', 0, 'default.png');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `forums`
--
ALTER TABLE `forums`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `posts`
--
ALTER TABLE `posts`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `memberid` (`user_id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `forums`
--
ALTER TABLE `forums`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;
--
-- AUTO_INCREMENT for table `posts`
--
ALTER TABLE `posts`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
/* Создание таблицы приложений */
CREATE TABLE /*PREFIX*/APPLICATIONS
(
APPLICATION_ID VARCHAR2(32) NOT NULL,
NAME VARCHAR2(100) NOT NULL,
DESCRIPTION VARCHAR2(250),
LOCKED INTEGER DEFAULT 0 NOT NULL,
PRIMARY KEY (APPLICATION_ID)
)
--
/* Создание просмотра таблицы приложений */
CREATE VIEW /*PREFIX*/S_APPLICATIONS
AS
SELECT * FROM /*PREFIX*/APPLICATIONS
--
/* Создание процедуры добавления приложения */
CREATE OR REPLACE PROCEDURE /*PREFIX*/I_APPLICATION
(
APPLICATION_ID IN VARCHAR2,
NAME IN VARCHAR2,
DESCRIPTION IN VARCHAR2,
LOCKED IN INTEGER
)
AS
BEGIN
INSERT INTO /*PREFIX*/APPLICATIONS (APPLICATION_ID,NAME,DESCRIPTION,LOCKED)
VALUES (APPLICATION_ID,NAME,DESCRIPTION,LOCKED);
END;
--
/* Создание процедуры изменения приложения */
CREATE OR REPLACE PROCEDURE /*PREFIX*/U_APPLICATION
(
APPLICATION_ID IN VARCHAR2,
NAME IN VARCHAR2,
DESCRIPTION IN VARCHAR2,
LOCKED IN INTEGER,
OLD_APPLICATION_ID IN VARCHAR2
)
AS
BEGIN
UPDATE /*PREFIX*/APPLICATIONS
SET APPLICATION_ID=U_APPLICATION.APPLICATION_ID,
NAME=U_APPLICATION.NAME,
DESCRIPTION=U_APPLICATION.DESCRIPTION,
LOCKED=U_APPLICATION.LOCKED
WHERE APPLICATION_ID=OLD_APPLICATION_ID;
END;
--
/* Создание процедуры удаления приложения */
CREATE OR REPLACE PROCEDURE /*PREFIX*/D_APPLICATION
(
OLD_APPLICATION_ID IN VARCHAR2
)
AS
BEGIN
DELETE FROM /*PREFIX*/APPLICATIONS
WHERE APPLICATION_ID=OLD_APPLICATION_ID;
END;
--
/* Фиксация изменений */
COMMIT |
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for `boyo_gamelist`
-- ----------------------------
DROP TABLE IF EXISTS `boyo_gamelist`;
CREATE TABLE `boyo_gamelist` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增id',
`name` varchar(20) NOT NULL COMMENT 'game_name',
`logimg` varchar(50) NOT NULL COMMENT 'game_log picture',
`game_id` int(10) DEFAULT NULL COMMENT 'game id',
`gameurl` varchar(50) NOT NULL COMMENT 'game play url',
`status` int(1) NOT NULL DEFAULT '0' COMMENT 'visaul status',
`category` int(5) DEFAULT NULL COMMENT '一级类目',
`updatetime` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=30 DEFAULT CHARSET=utf8;
ALTER TABLE `boyo_app` ADD `gameUrl` VARCHAR( 300 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL AFTER `officalSiteUrl`;
ALTER TABLE `boyo_app` ADD `players` int(11) NOT NULL AFTER `spaceName`;
ALTER TABLE `boyo_app` ADD `defaultPlayers` int(11) NOT NULL AFTER `players`;
update `boyo_app` set `gameUrl`=`officalSiteUrl`;
update `boyo_operate` set `operation`='{"default":["index"],"user":["index","export","list","adduser","update","delete"],"advertisement":["index","create","view","update","delete"],"news":["index","create","view","update","delete"],"app":["index","create","view","update","delete","publish","lock"],"appitem":["index","create","view","update","delete"],"gameserver":["index","view","update","create"],"gamecategory":["index","create","view","update","delete"],"bill":["index"],"statistic":["index","export"],"operate":["index","create","update","view","delete"],"externalgames":["index","update","create","view","delete"],"platform":["index","create"],"platformgameserver":["index","create"]}' where `name`='admin' or `name`='administrator'; |
Create Procedure Sp_IsLeafLevelCategory(@CategoryID Int)
as
Begin
If Not Exists(Select * From ItemCategories where ParentID = @CategoryID)
Select 1
else
Select 0
End
|
drop database if exists dbdragon;
create database dbdragon;
use dbdragon;
CREATE TABLE dragons
(
dragon varchar(45),
sexe char(1),
longueur int(5),
nb_ecaille int(10),
feu boolean,
comp_amoureux varchar(45)
);
CREATE TABLE repas
(
dragon varchar(45),
produit varchar(45),
quantite int(10)
);
CREATE TABLE nourritures
(
produit varchar(45),
calories int(10)
);
CREATE TABLE aime
(
dragonaimant varchar(45),
dragonaime varchar(45),
force_amour varchar(45)
);
INSERT INTO dragons VALUES ('Smaug', 'M', 152, 1857, TRUE, 'macho');
INSERT INTO dragons VALUES ('Birdurh', 'M', 258, 4787, FALSE, 'timide');
INSERT INTO dragons VALUES ('Négueth', 'F', 128,1581, TRUE, 'sincère');
INSERT INTO dragons VALUES ('MissToc', 'F', 183, 2781, FALSE, 'superflu');
INSERT INTO dragons VALUES ('Bolong', 'M', 213, 2751, TRUE, 'macho');
INSERT INTO dragons VALUES ('Miloch', 'M', 83, 718, TRUE, 'timide');
INSERT INTO dragons VALUES ('Nessie', 'M', 168, 1721, FALSE, 'absent');
INSERT INTO dragons VALUES ('Tarak', 'F', 123, 851, TRUE, 'timide');
INSERT INTO dragons VALUES ('Solong', 'M', 173, 1481, TRUE, 'sincère');
INSERT INTO repas VALUES ('Smaug','cacahuète',1000);
INSERT INTO repas VALUES ('Smaug','pomme',16);
INSERT INTO repas VALUES ('Birdurh','oeuf',4);
INSERT INTO repas VALUES ('Négueth','orange',6);
INSERT INTO repas VALUES ('Négueth','oeuf',1);
INSERT INTO repas VALUES ('Miloch','vert',53);
INSERT INTO repas VALUES ('Miloch','cacahuète',100);
INSERT INTO repas VALUES ('Nessie','poisson',20);
INSERT INTO repas VALUES ('Tarak','pomme',10);
INSERT INTO repas VALUES ('Tarak','orange',10);
INSERT INTO repas VALUES ('Solong','oeuf',6);
INSERT INTO repas VALUES ('Solong','poisson',1);
INSERT INTO repas VALUES ('Solong','orange',2);
INSERT INTO nourritures VALUES ('pomme',7);
INSERT INTO nourritures VALUES ('cacahuète',10);
INSERT INTO nourritures VALUES ('orange',25);
INSERT INTO nourritures VALUES ('oeuf',15);
INSERT INTO nourritures VALUES ('vert',3);
INSERT INTO nourritures VALUES ('poisson',35);
INSERT INTO aime VALUES ('Smaug','Négueth','passionnément');
INSERT INTO aime VALUES ('Birdurh','Négueth','beaucoup');
INSERT INTO aime VALUES ('Négueth','Miloch','à la folie');
INSERT INTO aime VALUES ('Miloch','Négueth','à la folie');
INSERT INTO aime VALUES ('Tarak','Bolong','un peu ');
INSERT INTO aime VALUES ('Solong','Tarak','beaucoup');
|
/*Programs*/
INSERT INTO programs VALUES('Data','DAI');
INSERT INTO programs VALUES('IT','IT');
INSERT INTO programs VALUES('Sjöfart och logistik','SJL');
INSERT INTO programs VALUES('Tekniskfysik', 'TFY');
/*Students*/
INSERT INTO students VALUES(1,1,'Gabriel','Data');
INSERT INTO students VALUES(2,2,'Isak','Data');
INSERT INTO students VALUES(3,3,'Rasumus','IT');
INSERT INTO students VALUES(4,4,'Hampus','IT');
INSERT INTO students VALUES(5,5,'Oskar','Tekniskfysik');
INSERT INTO students VALUES(6,6,'Magnus','Tekniskfysik');
INSERT INTO students VALUES(7,7,'Hugo','Sjöfart och logistik');
INSERT INTO students VALUES(8,8,'Daniel','Sjöfart och logistik');
INSERT INTO students VALUES(9,9,'Nicklas','Sjöfart och logistik');
INSERT INTO students VALUES(10,10,'Olle', 'IT');
/*Departments*/
INSERT INTO departments VALUES('FYS','Fysik');
INSERT INTO departments VALUES('SJÖ','Sjöfart');
INSERT INTO departments VALUES('D&I','Data och IT');
/*hosts*/
INSERT INTO host VALUES('D&I','Data');
INSERT INTO host VALUES('D&I','IT');
INSERT INTO host VALUES('SJÖ','Sjöfart och logistik');
INSERT INTO host VALUES('FYS','Tekniskfysik');
/*branches*/
INSERT INTO branches VALUES('Super programer','Data');
INSERT INTO branches VALUES('Bad programer','IT');
INSERT INTO branches VALUES('Isbergskrock', 'Sjöfart och logistik');
INSERT INTO branches VALUES('Space explorer', 'Tekniskfysik');
/*courses*/
INSERT INTO courses VALUES('TDA357', 7.5, 'D&I');
INSERT INTO courses VALUES('LIM456',7.5, 'D&I');
INSERT INTO courses VALUES('BPI888',7.5,'D&I');
INSERT INTO courses VALUES('SBK042',7.5,'D&I');
INSERT INTO courses VALUES('APD567',7.5,'D&I');
INSERT INTO courses VALUES('WPI888',7.5,'D&I');
INSERT INTO courses VALUES('SOP345',7.5,'SJÖ');
INSERT INTO courses VALUES('BDP456',7.5,'SJÖ');
INSERT INTO courses VALUES('FFS222',7.5,'SJÖ');
INSERT INTO courses VALUES('LIP332',7.5,'FYS');
INSERT INTO courses VALUES('BUP123',7.5,'FYS');
INSERT Into courses VALUES('EVF999',7.5,'FYS');
INSERT INTO courses VALUES('LIM001',7.5,'D&I');
INSERT INTO courses VALUES('LIM002',7.5,'D&I');
INSERT INTO courses VALUES('LIM003',7.5,'FYS');
/*mandatoryForProgram*/
INSERT INTO mandatoryForProgram VALUES('Data','TDA357');
INSERT INTO mandatoryForProgram VALUES('Data','APD567');
INSERT INTO mandatoryForProgram VALUES('IT','WPI888');
INSERT INTO mandatoryForProgram VALUES('IT','TDA357');
INSERT INTO mandatoryForProgram VALUES('Sjöfart och logistik','SOP345');
INSERT INTO mandatoryForProgram VALUES('Sjöfart och logistik','BDP456');
INSERT INTO mandatoryForProgram VALUES('Tekniskfysik','EVF999');
INSERT INTO mandatoryForProgram VALUES('Tekniskfysik','TDA357');
/*mandatoryForBranch*/
INSERT INTO mandatoryForBranch VALUES('Super programer','Data','BPI888');
INSERT INTO mandatoryForBranch VALUES('Bad programer','IT','APD567');
INSERT INTO mandatoryForBranch VALUES('Isbergskrock','Sjöfart och logistik','FFS222');
INSERT INTO mandatoryForBranch VALUES('Space explorer','Tekniskfysik','BUP123');
/*recommended*/
INSERT INTO recommended VALUES('Super programer','Data','LIM456');
INSERT INTO recommended VALUES('Bad programer','IT','SBK042');
INSERT INTO recommended VALUES('Isbergskrock','Sjöfart och logistik','EVF999');
INSERT INTO recommended VALUES('Space explorer','Tekniskfysik','TDA357');
/*classification*/
INSERT INTO classifications VALUES('Math');
INSERT INTO classifications VALUES('Research');
INSERT INTO classifications VALUES('Seminar');
/*hasClassification*/
INSERT INTO hasClassification VALUES('TDA357','Math');
INSERT INTO hasClassification VALUES('TDA357','Research');
INSERT INTO hasClassification VALUES('LIP332','Math');
INSERT INTO hasClassification VALUES('LIP332','Research');
INSERT INTO hasClassification VALUES('LIP332','Seminar');
INSERT INTO hasClassification VALUES('EVF999','Seminar');
INSERT INTO hasClassification VALUES('EVF999','Math');
INSERT INTO hasClassification VALUES('LIM001','Seminar');
/*limitedCourse*/
INSERT INTO limitedCourses VALUES('TDA357',100);
INSERT INTO limitedCourses VALUES('FFS222',5);
INSERT INTO limitedCourses VALUES('LIM001',2);
INSERT INTO limitedCourses VALUES('LIM002',2);
INSERT INTO limitedCourses VALUES('LIM003',2);
/*requires*/
INSERT INTO requires VALUES('BPI888','TDA357');
INSERT INTO requires VALUES('EVF999','LIP332');
/*registratedTo*/
INSERT INTO registeredto VALUES(6,'TDA357');
INSERT INTO registeredto VALUES(2,'TDA357');
INSERT INTO registeredto VALUES(1,'WPI888');
INSERT INTO registeredto VALUES(2,'WPI888');
INSERT INTO registeredto VALUES(3,'APD567');
INSERT INTO registeredto VALUES(4,'WPI888');
INSERT INTO registeredto VALUES(1,'LIM001');
INSERT INTO registeredto VALUES(2,'LIM001');
INSERT INTO registeredto VALUES(3,'LIM002');
INSERT INTO registeredto VALUES(4,'LIM002');
INSERT INTO registeredto VALUES(5,'LIM003');
INSERT INTO registeredto VALUES(6,'LIM003');
/*hasRead*/
INSERT INTO hasRead VALUES(1,'LIP332','4');
INSERT INTO hasRead VALUES(2,'LIP332','U');
INSERT INTO hasRead VALUES(4,'LIP332','3');
INSERT INTO hasRead VALUES(5,'LIP332','5');
insert into hasread values(1,'APD567','4');
insert into hasread values(1,'TDA357','4');
insert into hasread values(1,'BPI888','4');
insert into hasread values(1,'EVF999','5');
/*queue*/
INSERT INTO queue VALUES(9,'LIM003','2016-12-2 12:22:55');
INSERT INTO queue VALUES(5,'LIM001','2016-12-6 14:44:20');
INSERT INTO queue VALUES(8,'LIM002','2016-12-3 14:54:20');
INSERT INTO queue VALUES(3,'LIM001','2016-12-6 14:44:10');
INSERT INTO queue VALUES(10,'LIM003','2016-12-6 16:11:50');
INSERT INTO queue VALUES(7,'LIM002','2016-12-6 14:44:20');
INSERT INTO queue VALUES(4,'LIM001','2016-12-7 14:44:10');
/*isPartOf*/
insert into ispartof values(1,'Super programer', 'Data');
|
-- Find the sales in terms of total dollars for all orders in each year, ordered from greatest to least. Do you notice any trends in the yearly sales totals?
SELECT DATE_PART('year', occurred_at) yyyy, SUM(total_amt_usd)
FROM orders
GROUP BY DATE_PART('year', occurred_at)
ORDER BY yyyy;
-- Which month did Parch & Posey have the greatest sales in terms of total dollars? Are all months evenly represented by the dataset?
SELECT DATE_PART('month', occurred_at) ord_month, SUM(total_amt_usd) total
FROM orders
WHERE occurred_at BETWEEN '2014-01-01' AND '2017-01-01'
GROUP BY 1
ORDER BY total DESC;
-- Which year did Parch & Posey have the greatest sales in terms of total number of orders? Are all years evenly represented by the dataset?
SELECT DATE_PART('year', occurred_at) yyyy, COUNT(*) total_sales
FROM orders
GROUP BY 1
ORDER BY 2 DESC
LIMIT 1;
-- Which month did Parch & Posey have the greatest sales in terms of total number of orders? Are all months evenly represented by the dataset?
SELECT DATE_PART('month', occurred_at) ord_month, COUNT(*) total_sales
FROM orders
WHERE occurred_at BETWEEN '2014-01-01' AND '2017-01-01'
GROUP BY 1
ORDER BY total_sales DESC;
-- In which month of which year did Walmart spend the most on gloss paper in terms of dollars?
SELECT DATE_PART('year', o.occurred_at) ord_year, DATE_PART('month', o.occurred_at) ord_month, a.name, SUM(gloss_amt_usd) total_spent
FROM orders o
JOIN accounts a
ON a.id = o.account_id
GROUP BY 1, 2, 3
HAVING a.name = 'Walmart'
ORDER BY total_spent DESC;
|
use Equipo2_final;
-- pacientes
INSERT INTO PACIENTE (idPaciente, FName, Lname, Sexo, Email, Fechanacimiento) VALUES(1, 'Priscila', 'Treviño', 'F', 'pris123@outlook.com', '1960-02-10' );
INSERT INTO PACIENTE (idPaciente, FName, Lname, Sexo, Email, Fechanacimiento) VALUES(2, 'Demetrio', 'Osuna', 'M', 'eldeme1999@gmail.com', '1989-10-07');
INSERT INTO PACIENTE (idPaciente, FName, Lname, Sexo, Email, Fechanacimiento) VALUES(3, 'Marina', 'Garza', 'F', 'margar95@hotmail.com', '1999-10-01');
INSERT INTO PACIENTE (idPaciente, FName, Lname, Sexo,Email, Fechanacimiento) VALUES(4, 'Carlos', 'Mendoza', 'M', 'carlospower@gmail.com', '1991-04-09');
-- doctores
INSERT INTO DOCTOR (idDoctor, cedula, FName, LName) VALUES (1, 16227469, 'Gerardo', 'Ayala');
INSERT INTO DOCTOR (idDoctor, cedula, FName, LName) VALUES (2, 21794582, 'Miguel', 'Bocard');
INSERT INTO DOCTOR (idDoctor, cedula, FName, LName) VALUES (3, 35614827, 'Saul', 'Pinto');
-- consultas
INSERT INTO Consulta (idConsulta, idPaciente, idDoctor, fecha, costo, peea) VALUES (1, 1, 2, '2020-01-25', 500, 'depresion') ;
INSERT INTO Consulta (idConsulta, idPaciente, idDoctor, fecha, costo, peea) VALUES (2, 1, 1,'2020-02-02', 500, 'problemas de relacion') ;
INSERT INTO Consulta (idConsulta, idPaciente, idDoctor, fecha, costo, peea) VALUES (3, 1, 2, '2020-02-21', 650, 'falta de motivacion') ;
INSERT INTO Consulta (idConsulta, idPaciente, idDoctor, fecha, costo, peea) VALUES (4, 1, 3, '2020-03-05', 750, 'obseciones') ;
INSERT INTO Consulta (idConsulta, idPaciente, idDoctor, fecha, costo, peea) VALUES (5, 1, 1,'2020-03-24', 860, 'malos pensamientos') ;
INSERT INTO Consulta (idConsulta, idPaciente, idDoctor, fecha, costo, peea) VALUES (6, 2, 2, '2020-01-15', 500, 'depresion') ;
INSERT INTO Consulta (idConsulta, idPaciente, idDoctor, fecha, costo, peea) VALUES (7, 2, 3,'2020-01-30', 500, 'insomnia') ;
INSERT INTO Consulta (idConsulta, idPaciente, idDoctor, fecha, costo, peea) VALUES (8, 2, 1,'2020-02-14', 700, 'falta de motivacion') ;
INSERT INTO Consulta (idConsulta, idPaciente, idDoctor, fecha, costo, peea) VALUES (9, 2, 2,'2020-03-30', 820, 'depresion') ;
INSERT INTO Consulta (idConsulta, idPaciente, idDoctor, fecha, costo, peea) VALUES (10, 2, 2,'2020-03-30', 820, 'depresion') ;
INSERT INTO Consulta (idConsulta, idPaciente, idDoctor, fecha, costo, peea) VALUES (11, 3, 1,'2020-01-14', 500, 'problemas de relacion') ;
INSERT INTO Consulta (idConsulta, idPaciente, idDoctor, fecha, costo, peea) VALUES (12, 3, 2,'2020-02-03', 500, 'malos pensamientos') ;
INSERT INTO Consulta (idConsulta, idPaciente, idDoctor, fecha, costo, peea) VALUES (13, 3, 1,'2020-02-23', 600, 'depresion') ;
INSERT INTO Consulta (idConsulta, idPaciente, idDoctor, fecha, costo, peea) VALUES (14, 3, 1,'2020-03-01', 750, 'malos pensamientos') ;
INSERT INTO Consulta (idConsulta, idPaciente, idDoctor, fecha, costo, peea) VALUES (15, 3, 1,'2020-03-17', 800, 'insomnia') ;
INSERT INTO Consulta (idConsulta, idPaciente, idDoctor, fecha, costo, peea) VALUES (16, 4, 2,'2020-02-10', 500, 'insomnia') ;
INSERT INTO Consulta (idConsulta, idPaciente, idDoctor, fecha, costo, peea) VALUES (17, 4, 1,'2020-03-02', 500, 'insomnia') ;
INSERT INTO Consulta (idConsulta, idPaciente, idDoctor, fecha, costo, peea) VALUES (18, 4, 2,'2020-03-21', 670, 'depresion') ;
INSERT INTO Consulta (idConsulta, idPaciente, idDoctor, fecha, costo, peea) VALUES (19, 4, 2,'2020-04-01', 700, 'insomnia') ;
INSERT INTO Consulta (idConsulta, idPaciente, idDoctor, fecha, costo, peea) VALUES (20, 2, 2,'2020-03-30', 820, 'depresion') ;
-- insertar pruebas
INSERT INTO Prueba (idPrueba, nombre) VALUES (1, 'Examen de depresión de Hamilton');
-- insertar preguntas
INSERT INTO Pregunta VALUES
(1, 'Humor depresivo (tristeza, desesperanza, desamparo, sentimiento de inutilidad', 1),
(2, 'Sentimientos de culpa', 1),
(3, 'Suicidio', 1),
(4, 'Insomnio precoz', 1),
(5, 'Insomnio intermedio', 1),
(6, 'Insomnio tardío', 1),
(7, 'Trabajo y actividades', 1),
(8, 'Inhibición psicomotora (lentitud de pensamiento y lenguaje, facultad de
concentración disminuida, disminución de la actividad motora)', 1),
(9, 'Agitación psicomotora', 1),
(10, 'Ansiedad psíquica', 1),
(11, 'Ansiedad somática (signos físicos de ansiedad: gastrointestinales: sequedad de boca, diarrea, eructos, indigestión, etc; cardiovasculares: palpitaciones, cefaleas; respiratorios: hiperventilación, suspiros; frecuencia de micción incrementada; transpiración)', 1),
(12, 'Síntomas somáticos gastrointestinales' , 1),
(13, 'Síntomas somáticos generales', 1),
(14, 'Síntomas genitales (tales como: disminución de la líbido y trastornos menstruales', 1),
(15, 'Hipocondría', 1),
(16, 'Pérdida de peso', 1),
(17, 'Introspección', 1);
-- insertar instancia_prueba
INSERT INTO Instancia_Prueba VALUES
(1, 1, 1),
(2, 3, 1),
(3, 5, 1),
(4, 7, 1),
(5, 9, 1),
(6, 11, 1),
(7, 13, 1),
(8, 15, 1),
(9, 17, 1),
(10, 19, 1);
-- insertar respuestas
INSERT INTO Respuesta VALUES
(1, 1, 1, 0),
(2, 1, 2, 3),
(3, 1, 3, 4),
(4, 1, 4, 1),
(5, 1, 5, 2),
(6, 1, 6, 0),
(7, 1, 7, 3),
(8, 1, 8, 2),
(9, 1, 9, 0),
(10, 1, 10, 1),
(11, 1, 11, 1),
(12, 1, 12, 2),
(13, 1, 13, 1),
(14, 1, 14, 2),
(15, 1, 15, 0),
(16, 1, 16, 0),
(17, 1, 17, 2),
(18, 2, 1, 3),
(19, 2, 2, 2),
(20, 2, 3, 0),
(21, 2, 4, 0),
(22, 2, 5, 1),
(23, 2, 6, 1),
(24, 2, 7, 3),
(25, 2, 8, 2),
(26, 2, 9, 0),
(27, 2, 10, 0),
(28, 2, 11, 0),
(29, 2, 12, 0),
(30, 2, 13, 0),
(31, 2, 14, 1),
(32, 2, 15, 2),
(33, 2, 16, 1),
(34, 2, 17, 3),
(35, 3, 1, 2),
(36, 3, 2, 2),
(37, 3, 3, 2),
(38, 3, 4, 0),
(39, 3, 5, 1),
(40, 3, 6, 0),
(41, 3, 7, 1),
(42, 3, 8, 1),
(43, 3, 9, 0),
(44, 3, 10, 4),
(45, 3, 11, 1),
(46, 3, 12, 0),
(47, 3, 13, 1),
(48, 3, 14, 1),
(49, 3, 15, 1),
(50, 3, 16, 1),
(51, 3, 17, 0),
(52, 4, 1, 1),
(53, 4, 2, 3),
(54, 4, 3, 4),
(55, 4, 4, 1),
(56, 4, 5, 0),
(57, 4, 6, 0),
(58, 4, 7, 2),
(59, 4, 8, 3),
(60, 4, 9, 0),
(61, 4, 10, 1),
(62, 4, 11, 0),
(63, 4, 12, 0),
(64, 4, 13, 1),
(65, 4, 14, 0),
(66, 4, 15, 2),
(67, 4, 16, 2),
(68, 4, 17, 2),
(69, 5, 1, 0),
(70, 5, 2, 0),
(71, 5, 3, 0),
(72, 5, 4, 0),
(73, 5, 5, 0),
(74, 5, 6, 0),
(75, 5, 7, 0),
(76, 5, 8, 0),
(77, 5, 9, 0),
(78, 5, 10, 0),
(79, 5, 11, 0),
(80, 5, 12, 0),
(81, 5, 13, 0),
(82, 5, 14, 0),
(83, 5, 15, 0),
(84, 5, 16, 0),
(85, 5, 17, 1),
(86, 6, 1, 1),
(87, 6, 2, 4),
(88, 6, 3, 2),
(89, 6, 4, 0),
(90, 6, 5, 0),
(91, 6, 6, 2),
(92, 6, 7, 1),
(93, 6, 8, 1),
(94, 6, 9, 0),
(95, 6, 10, 0),
(96, 6, 11, 1),
(97, 6, 12, 0),
(98, 6, 13, 2),
(99, 6, 14, 1),
(100, 6, 15, 1),
(101, 6, 16, 2),
(102, 6, 17, 1),
(103, 7, 1, 0),
(104, 7, 2, 0),
(105, 7, 3, 4),
(106, 7, 4, 2),
(107, 7, 5, 0),
(108, 7, 6, 0),
(109, 7, 7, 3),
(110, 7, 8, 3),
(111, 7, 9, 2),
(112, 7, 10, 1),
(113, 7, 11, 3),
(114, 7, 12, 2),
(115, 7, 13, 1),
(116, 7, 14, 0),
(117, 7, 15, 1),
(118, 7, 16, 2),
(119, 7, 17, 1),
(120, 8, 1, 0),
(121, 8, 2, 2),
(122, 8, 3, 0),
(123, 8, 4, 1),
(124, 8, 5, 1),
(125, 8, 6, 0),
(126, 8, 7, 1),
(127, 8, 8, 1),
(128, 8, 9, 3),
(129, 8, 10, 2),
(130, 8, 11, 1),
(131, 8, 12, 2),
(132, 8, 13, 1),
(133, 8, 14, 2),
(134, 8, 15, 3),
(135, 8, 16, 2),
(136, 8, 17, 2),
(137, 9, 1, 4),
(138, 9, 2, 3),
(139, 9, 3, 1),
(140, 9, 4, 0),
(141, 9, 5, 1),
(142, 9, 6, 0),
(143, 9, 7, 1),
(144, 9, 8, 2),
(145, 9, 9, 1),
(146, 9, 10, 0),
(147, 9, 11, 1),
(148, 9, 12, 0),
(149, 9, 13, 2),
(150, 9, 14, 2),
(151, 9, 15, 3),
(152, 9, 16, 0),
(153, 9, 17, 3),
(154, 10, 1, 1),
(155, 10, 2, 1),
(156, 10, 3, 1),
(157, 10, 4, 0),
(158, 10, 5, 0),
(159, 10, 6, 1),
(160, 10, 7, 0),
(161, 10, 8, 1),
(162, 10, 9, 0),
(163, 10, 10, 1),
(164, 10, 11, 0),
(165, 10, 12, 1),
(166, 10, 13, 0),
(167, 10, 14, 1),
(168, 10, 15, 0),
(169, 10, 16, 1),
(170, 10, 17, 0);
-- diagnosticos
INSERT INTO Diagnostico VALUES
(1,NULL,'V62.3','Z55.9','Academic or educational problem'),
(2,NULL,'V62.4','Z60.3','Acculturation difficulty'),
(3,NULL,'308.3','F43.0','Acute stress disorder'),
(4,NULL,NULL,NULL,'Adjustment disorder'),
(5,NULL,'309.9','F43.20','Adjustment disorder, Unspecified'),
(6,NULL,'309.24','F43.22','Adjustment disorder, With anxiety'),
(7,NULL,'309','F43.21','Adjustment disorder, With depressed mood'),
(8,NULL,'309.3','F43.24','Adjustment disorder, With disturbance of conduct'),
(9,NULL,'309.28','F43.23','Adjustment disorder, With mixed anxiety and depressed mood'),
(10,NULL,'309.4','F43.25','Adjustment disorder, With mixed disturbance of emotions and conduct'),
(11,NULL,'V71.01','Z72.811','Adult antisocial behavior'),
(12,NULL,NULL,NULL,'Adult physical abuse by nonspouse or nonpartner, Confirmed'),
(13,NULL,'995.81','T74.11XA','Adult physical abuse by nonspouse or nonpartner, Confirmed, Initial encounter'),
(14,NULL,'995.81','T74.11XD','Adult physical abuse by nonspouse or nonpartner, Confirmed, Subsequent encounter'),
(15,NULL,NULL,NULL,'Adult physical abuse by nonspouse or nonpartner, Suspected'),
(16,NULL,'995.81','T76.11XA','Adult physical abuse by nonspouse or nonpartner, Suspected, Initial encounter'),
(17,NULL,'995.81','T76.11XD','Adult physical abuse by nonspouse or nonpartner, Suspected, Subsequent encounter'),
(18,NULL,NULL,NULL,'Adult psychological abuse by nonspouse or nonpartner, Confirmed'),
(19,NULL,'995.82','T74.31XA','Adult psychological abuse by nonspouse or nonpartner, Confirmed, Initial encounter'),
(20,NULL,'995.82','T74.31XD','Adult psychological abuse by nonspouse or nonpartner, Confirmed, Subsequent encounter'),
(21,NULL,NULL,NULL,'Adult psychological abuse by nonspouse or nonpartner, Suspected'),
(22,NULL,'995.82','T76.31XA','Adult psychological abuse by nonspouse or nonpartner, Suspected, Initial encounter'),
(23,NULL,'995.82','T76.31XD','Adult psychological abuse by nonspouse or nonpartner, Suspected, Subsequent encounter'),
(24,NULL,NULL,NULL,'Adult sexual abuse by nonspouse or nonpartner, Confirmed'),
(25,NULL,'995.83','T74.21XA','Adult sexual abuse by nonspouse or nonpartner, Confirmed, Initial encounter'),
(26,NULL,'995.83','T74.21XD','Adult sexual abuse by nonspouse or nonpartner, Confirmed, Subsequent encounter'),
(27,NULL,NULL,NULL,'Adult sexual abuse by nonspouse or nonpartner, Suspected'),
(28,NULL,'995.83','T76.21XA','Adult sexual abuse by nonspouse or nonpartner, Suspected, Initial encounter'),
(29,NULL,'995.83','T76.21XD','Adult sexual abuse by nonspouse or nonpartner, Suspected, Subsequent encounter'),
(30,NULL,'307','F98.5','Adult-onset fluency disorder'),
(31,NULL,'300.22','F40.00','Agoraphobia'),
(32,NULL,'303',NULL,'Alcohol intoxication'),
(33,NULL,'291',NULL,'Alcohol intoxication delirium'),
(34,NULL,NULL,'F10.121','Alcohol intoxication delirium, With mild use disorder'),
(35,NULL,NULL,'F10.221','Alcohol intoxication delirium, With moderate or severe use disorder'),
(36,NULL,NULL,'F10.921','Alcohol intoxication delirium, Without use disorder'),
(37,NULL,NULL,'F10.129','Alcohol intoxication, With mild use disorder'),
(38,NULL,NULL,'F10.229','Alcohol intoxication, With moderate or severe use disorder'),
(39,NULL,NULL,'F10.929','Alcohol intoxication, Without use disorder'),
(40,NULL,NULL,NULL,'Alcohol use disorder'),
(41,NULL,'305','F10.10','Alcohol use disorder, Mild'),
(42,NULL,'303.9','F10.20','Alcohol use disorder, Moderate'),
(43,NULL,'303.9','F10.20','Alcohol use disorder, Severe'),
(44,NULL,'291.81',NULL,'Alcohol withdrawal'),
(45,NULL,'291','F10.231','Alcohol withdrawal delirium'),
(46,NULL,NULL,'F10.232','Alcohol withdrawal, With perceptual disturbances'),
(47,NULL,NULL,'F10.239','Alcohol withdrawal, Without perceptual disturbances'),
(48,NULL,'291.89',NULL,'Alcohol-induced anxiety disorder'),
(49,NULL,NULL,'F10.180','Alcohol-induced anxiety disorder, With mild use disorder'),
(50,NULL,NULL,'F10.280','Alcohol-induced anxiety disorder, With moderate or severe use disorder'),
(51,NULL,NULL,'F10.980','Alcohol-induced anxiety disorder, Without use disorder'),
(52,NULL,'291.89',NULL,'Alcohol-induced bipolar and related disorder'),
(53,NULL,NULL,'F10.14','Alcohol-induced bipolar and related disorder, With mild use disorder'),
(54,NULL,NULL,'F10.24','Alcohol-induced bipolar and related disorder, With moderate or severe use disorder'),
(55,NULL,NULL,'F10.94','Alcohol-induced bipolar and related disorder, Without use disorder'),
(56,NULL,'291.89',NULL,'Alcohol-induced depressive disorder'),
(57,NULL,NULL,'F10.14','Alcohol-induced depressive disorder, With mild use disorder'),
(58,NULL,NULL,'F10.24','Alcohol-induced depressive disorder, With moderate or severe use disorder'),
(59,NULL,NULL,'F10.94','Alcohol-induced depressive disorder, Without use disorder'),
(60,NULL,'291.1',NULL,'Alcohol-induced major neurocognitive disorder, Amnestic confabulatory type'),
(61,NULL,NULL,'F10.26','Alcohol-induced major neurocognitive disorder, Amnestic confabulatory type, With moderate or severe use disorder'),
(62,NULL,NULL,'F10.96','Alcohol-induced major neurocognitive disorder, Amnestic confabulatory type, Without use disorder'),
(63,NULL,'291.2',NULL,'Alcohol-induced major neurocognitive disorder, Nonamnestic confabulatory type'),
(64,NULL,NULL,'F10.27','Alcohol-induced major neurocognitive disorder, Nonamnestic confabulatory type, With moderate or severe use disorder'),
(65,NULL,NULL,'F10.97','Alcohol-induced major neurocognitive disorder, Nonamnestic confabulatory type, Without use disorder'),
(66,NULL,'291.89',NULL,'Alcohol-induced mild neurocognitive disorder'),
(67,NULL,NULL,'F10.288','Alcohol-induced mild neurocognitive disorder, With moderate or severe use disorder'),
(68,NULL,NULL,'F10.988','Alcohol-induced mild neurocognitive disorder, Without use disorder'),
(69,NULL,'291.9',NULL,'Alcohol-induced psychotic disorder'),
(70,NULL,NULL,'F10.159','Alcohol-induced psychotic disorder, With mild use disorder'),
(71,NULL,NULL,'F10.259','Alcohol-induced psychotic disorder, With moderate or severe use disorder'),
(72,NULL,NULL,'F10.959','Alcohol-induced psychotic disorder, Without use disorder'),
(73,NULL,'291.89',NULL,'Alcohol-induced sexual dysfunction'),
(74,NULL,NULL,'F10.181','Alcohol-induced sexual dysfunction, With mild use disorder'),
(75,NULL,NULL,'F10.281','Alcohol-induced sexual dysfunction, With moderate or severe use disorder'),
(76,NULL,NULL,'F10.981','Alcohol-induced sexual dysfunction, Without use disorder'),
(77,NULL,'291.82',NULL,'Alcohol-induced sleep disorder'),
(78,NULL,NULL,'F10.182','Alcohol-induced sleep disorder, With mild use disorder'),
(79,NULL,NULL,'F10.282','Alcohol-induced sleep disorder, With moderate or severe use disorder'),
(80,NULL,NULL,'F10.982','Alcohol-induced sleep disorder, Without use disorder'),
(81,NULL,'292.81',NULL,'Amphetamine (or other stimulant) intoxication delirium'),
(82,NULL,NULL,'F15.121','Amphetamine (or other stimulant) intoxication delirium, With mild use disorder'),
(83,NULL,NULL,'F15.221','Amphetamine (or other stimulant) intoxication delirium, With moderate or severe use disorder'),
(84,NULL,NULL,'F15.921','Amphetamine (or other stimulant) intoxication delirium, Without use disorder'),
(85,NULL,'292.89',NULL,'Amphetamine (or other stimulant)-induced anxiety disorder'),
(86,NULL,NULL,'F15.180','Amphetamine (or other stimulant)-induced anxiety disorder, With mild use disorder'),
(87,NULL,NULL,'F15.280','Amphetamine (or other stimulant)-induced anxiety disorder, With moderate or severe use disorder'),
(88,NULL,NULL,'F15.980','Amphetamine (or other stimulant)-induced anxiety disorder, Without use disorder'),
(89,NULL,'292.84',NULL,'Amphetamine (or other stimulant)-induced bipolar and related disorder'),
(90,NULL,NULL,'F15.14','Amphetamine (or other stimulant)-induced bipolar and related disorder, With mild use disorder'),
(91,NULL,NULL,'F15.24','Amphetamine (or other stimulant)-induced bipolar and related disorder, With moderate or severe use disorder'),
(92,NULL,NULL,'F15.94','Amphetamine (or other stimulant)-induced bipolar and related disorder, Without use disorder'),
(93,NULL,NULL,'F15.921','Amphetamine (or other stimulant)-induced delirium'),
(94,NULL,'292.84',NULL,'Amphetamine (or other stimulant)-induced depressive disorder'),
(95,NULL,NULL,'F15.14','Amphetamine (or other stimulant)-induced depressive disorder, With mild use disorder'),
(96,NULL,NULL,'F15.24','Amphetamine (or other stimulant)-induced depressive disorder, With moderate or severe use disorder'),
(97,NULL,NULL,'F15.94','Amphetamine (or other stimulant)-induced depressive disorder, Without use disorder'),
(98,NULL,'292.89',NULL,'Amphetamine (or other stimulant)-induced obsessive-compulsive and related disorder'),
(99,NULL,NULL,'F15.188','Amphetamine (or other stimulant)-induced obsessive-compulsive and related disorder, With mild use disorder'),
(100,NULL,NULL,'F15.288','Amphetamine (or other stimulant)-induced obsessive-compulsive and related disorder, With moderate or severe use disorder'),
(101,NULL,NULL,'F15.988','Amphetamine (or other stimulant)-induced obsessive-compulsive and related disorder, Without use disorder'),
(102,NULL,'292.9',NULL,'Amphetamine (or other stimulant)-induced psychotic disorder'),
(103,NULL,NULL,'F15.159','Amphetamine (or other stimulant)-induced psychotic disorder, With mild use disorder'),
(104,NULL,NULL,'F15.259','Amphetamine (or other stimulant)-induced psychotic disorder, With moderate or severe use disorder'),
(105,NULL,NULL,'F15.959','Amphetamine (or other stimulant)-induced psychotic disorder, Without use disorder'),
(106,NULL,'292.89',NULL,'Amphetamine (or other stimulant)-induced sexual dysfunction'),
(107,NULL,NULL,'F15.181','Amphetamine (or other stimulant)-induced sexual dysfunction, With mild use disorder'),
(108,NULL,NULL,'F15.281','Amphetamine (or other stimulant)-induced sexual dysfunction, With moderate or severe use disorder'),
(109,NULL,NULL,'F15.981','Amphetamine (or other stimulant)-induced sexual dysfunction, Without use disorder'),
(110,NULL,'292.85',NULL,'Amphetamine (or other stimulant)-induced sleep disorder'),
(111,NULL,NULL,'F15.182','Amphetamine (or other stimulant)-induced sleep disorder, With mild use disorder'),
(112,NULL,NULL,'F15.282','Amphetamine (or other stimulant)-induced sleep disorder, With moderate or severe use disorder'),
(113,NULL,NULL,'F15.982','Amphetamine (or other stimulant)-induced sleep disorder, Without use disorder'),
(114,NULL,'292.89',NULL,'Amphetamine or other stimulant intoxication'),
(115,NULL,NULL,NULL,'Amphetamine or other stimulant intoxication, With perceptual disturbances'),
(116,NULL,NULL,'F15.122','Amphetamine or other stimulant intoxication, With perceptual disturbances, With mild use disorder'),
(117,NULL,NULL,'F15.222','Amphetamine or other stimulant intoxication, With perceptual disturbances, With moderate or severe use disorder'),
(118,NULL,NULL,'F15.922','Amphetamine or other stimulant intoxication, With perceptual disturbances, Without use disorder'),
(119,NULL,NULL,NULL,'Amphetamine or other stimulant intoxication, Without perceptual disturbances'),
(120,NULL,NULL,'F15.129','Amphetamine or other stimulant intoxication, Without perceptual disturbances, With mild use disorder'),
(121,NULL,NULL,'F15.229','Amphetamine or other stimulant intoxication, Without perceptual disturbances, With moderate or severe use disorder'),
(122,NULL,NULL,'F15.929','Amphetamine or other stimulant intoxication, Without perceptual disturbances, Without use disorder'),
(123,NULL,'292','F15.23','Amphetamine or other stimulant withdrawal'),
(124,NULL,NULL,NULL,'Amphetamine-type substance use disorder'),
(125,NULL,'305.7','F15.10','Amphetamine-type substance use disorder, Mild'),
(126,NULL,'304.4','F15.20','Amphetamine-type substance use disorder, Moderate'),
(127,NULL,'304.4','F15.20','Amphetamine-type substance use disorder, Severe'),
(128,NULL,'307.1',NULL,'Anorexia nervosa'),
(129,NULL,NULL,'F50.02','Anorexia nervosa, Binge-eating/purging type'),
(130,NULL,NULL,'F50.01','Anorexia nervosa, Restricting type'),
(131,NULL,NULL,NULL,'Antidepressant discontinuation syndrome'),
(132,NULL,'995.29','T43.205A','Antidepressant discontinuation syndrome, Initial encounter'),
(133,NULL,'995.29','T43.205S','Antidepressant discontinuation syndrome, Sequelae'),
(134,NULL,'995.29','T43.205D','Antidepressant discontinuation syndrome, Subsequent encounter'),
(135,NULL,'301.7','F60.2','Antisocial personality disorder'),
(136,NULL,'293.84','F06.4','Anxiety disorder due to another medical condition'),
(137,NULL,NULL,NULL,'Attention-deficit/hyperactivity disorder'),
(138,NULL,'314.01','F90.2','Attention-deficit/hyperactivity disorder, Combined presentation'),
(139,NULL,'314.01','F90.1','Attention-deficit/hyperactivity disorder, Predominantly hyperactive/impulsive presentation'),
(140,NULL,'314','F90.0','Attention-deficit/hyperactivity disorder, Predominantly inattentive presentation'),
(141,NULL,'299','F84.0','Autism spectrum disorder'),
(142,NULL,'347','G47.419','Autosomal dominant cerebellar ataxia, deafness, and narcolepsy'),
(143,NULL,'347','G47.419','Autosomal dominant narcolepsy, obesity, and type 2 diabetes'),
(144,NULL,'301.82','F60.6','Avoidant personality disorder'),
(145,NULL,'307.59','F50.8','Avoidant/restrictive food intake disorder'),
(146,NULL,'307.51','F50.8','Binge-eating disorder'),
(147,NULL,'293.83',NULL,'Bipolar and related disorder due to another medical condition'),
(148,NULL,NULL,'F06.33','Bipolar and related disorder due to another medical condition, With manic features'),
(149,NULL,NULL,'F06.33','Bipolar and related disorder due to another medical condition, With manic- or hypomanic-like episodes'),
(150,NULL,NULL,'F06.34','Bipolar and related disorder due to another medical condition, With mixed features'),
(151,NULL,NULL,NULL,'Bipolar I disorder, Current or most recent episode depressed'),
(152,NULL,'296.56','F31.76','Bipolar I disorder, Current or most recent episode depressed, In full remission'),
(153,NULL,'296.55','F31.75','Bipolar I disorder, Current or most recent episode depressed, In partial remission'),
(154,NULL,'296.51','F31.31','Bipolar I disorder, Current or most recent episode depressed, Mild'),
(155,NULL,'296.52','F31.32','Bipolar I disorder, Current or most recent episode depressed, Moderate'),
(156,NULL,'296.53','F31.4','Bipolar I disorder, Current or most recent episode depressed, Severe'),
(157,NULL,'296.5','F31.9','Bipolar I disorder, Current or most recent episode depressed, Unspecified'),
(158,NULL,'296.54','F31.5','Bipolar I disorder, Current or most recent episode depressed, With psychotic features'),
(159,NULL,'296.4','F31.0','Bipolar I disorder, Current or most recent episode hypomanic'),
(160,NULL,'296.46','F31.74','Bipolar I disorder, Current or most recent episode hypomanic, In full remission'),
(161,NULL,'296.45','F31.73','Bipolar I disorder, Current or most recent episode hypomanic, In partial remission'),
(162,NULL,'296.4','F31.9','Bipolar I disorder, Current or most recent episode hypomanic, Unspecified'),
(163,NULL,NULL,NULL,'Bipolar I disorder, Current or most recent episode manic'),
(164,NULL,'296.46','F31.74','Bipolar I disorder, Current or most recent episode manic, In full remission'),
(165,NULL,'296.45','F31.73','Bipolar I disorder, Current or most recent episode manic, In partial remission'),
(166,NULL,'296.41','F31.11','Bipolar I disorder, Current or most recent episode manic, Mild'),
(167,NULL,'296.42','F31.12','Bipolar I disorder, Current or most recent episode manic, Moderate'),
(168,NULL,'296.43','F31.13','Bipolar I disorder, Current or most recent episode manic, Severe'),
(169,NULL,'296.4','F31.9','Bipolar I disorder, Current or most recent episode manic, Unspecified'),
(170,NULL,'296.44','F31.2','Bipolar I disorder, Current or most recent episode manic, With psychotic features'),
(171,NULL,'296.7','F31.9','Bipolar I disorder, Current or most recent episode unspecified'),
(172,NULL,'296.89','F31.81','Bipolar II disorder'),
(173,NULL,'300.7','F45.22','Body dysmorphic disorder'),
(174,NULL,'V62.89','R41.83','Borderline intellectual functioning'),
(175,NULL,'301.83','F60.3','Borderline personality disorder'),
(176,NULL,'298.8','F23','Brief psychotic disorder'),
(177,NULL,'307.51','F50.2','Bulimia nervosa'),
(178,NULL,'305.9','F15.929','Caffeine intoxication'),
(179,NULL,'292','F15.93','Caffeine withdrawal'),
(180,NULL,'292.89',NULL,'Caffeine-induced anxiety disorder'),
(181,NULL,NULL,'F15.180','Caffeine-induced anxiety disorder, With mild use disorder'),
(182,NULL,NULL,'F15.280','Caffeine-induced anxiety disorder, With moderate or severe use disorder'),
(183,NULL,NULL,'F15.980','Caffeine-induced anxiety disorder, Without use disorder'),
(184,NULL,'292.85',NULL,'Caffeine-induced sleep disorder'),
(185,NULL,NULL,'F15.182','Caffeine-induced sleep disorder, With mild use disorder'),
(186,NULL,NULL,'F15.282','Caffeine-induced sleep disorder, With moderate or severe use disorder'),
(187,NULL,NULL,'F15.982','Caffeine-induced sleep disorder, Without use disorder'),
(188,NULL,'292.89',NULL,'Cannabis intoxication'),
(189,NULL,'292.81',NULL,'Cannabis intoxication delirium'),
(190,NULL,NULL,'F12.121','Cannabis intoxication delirium, With mild use disorder'),
(191,NULL,NULL,'F12.221','Cannabis intoxication delirium, With moderate or severe use disorder'),
(192,NULL,NULL,'F12.921','Cannabis intoxication delirium, Without use disorder'),
(193,NULL,NULL,NULL,'Cannabis intoxication, With perceptual disturbances'),
(194,NULL,NULL,'F12.122','Cannabis intoxication, With perceptual disturbances, With mild use disorder'),
(195,NULL,NULL,'F12.222','Cannabis intoxication, With perceptual disturbances, With moderate or severe use disorder'),
(196,NULL,NULL,'F12.922','Cannabis intoxication, With perceptual disturbances, Without use disorder'),
(197,NULL,NULL,NULL,'Cannabis intoxication, Without perceptual disturbances'),
(198,NULL,NULL,'F12.129','Cannabis intoxication, Without perceptual disturbances, With mild use disorder'),
(199,NULL,NULL,'F12.229','Cannabis intoxication, Without perceptual disturbances, With moderate or severe use disorder'),
(200,NULL,NULL,'F12.929','Cannabis intoxication, Without perceptual disturbances, Without use disorder'),
(201,NULL,NULL,NULL,'Cannabis use disorder'),
(202,NULL,'305.2','F12.10','Cannabis use disorder, Mild'),
(203,NULL,'304.3','F12.20','Cannabis use disorder, Moderate'),
(204,NULL,'304.3','F12.20','Cannabis use disorder, Severe'),
(205,NULL,'292','F12.288','Cannabis withdrawal'),
(206,NULL,'292.89',NULL,'Cannabis-induced anxiety disorder'),
(207,NULL,NULL,'F12.180','Cannabis-induced anxiety disorder, With mild use disorder'),
(208,NULL,NULL,'F12.280','Cannabis-induced anxiety disorder, With moderate or severe use disorder'),
(209,NULL,NULL,'F12.980','Cannabis-induced anxiety disorder, Without use disorder'),
(210,NULL,'292.9',NULL,'Cannabis-induced psychotic disorder'),
(211,NULL,NULL,'F12.159','Cannabis-induced psychotic disorder, With mild use disorder'),
(212,NULL,NULL,'F12.259','Cannabis-induced psychotic disorder, With moderate or severe use disorder'),
(213,NULL,NULL,'F12.959','Cannabis-induced psychotic disorder, Without use disorder'),
(214,NULL,'292.85',NULL,'Cannabis-induced sleep disorder'),
(215,NULL,NULL,'F12.188','Cannabis-induced sleep disorder, With mild use disorder'),
(216,NULL,NULL,'F12.288','Cannabis-induced sleep disorder, With moderate or severe use disorder'),
(217,NULL,NULL,'F12.988','Cannabis-induced sleep disorder, Without use disorder'),
(218,NULL,'293.89','F06.1','Catatonia associated with another mental disorder (catatonia specifier)'),
(219,NULL,'293.89','F06.1','Catatonic disorder due to another medical condition'),
(220,NULL,NULL,NULL,'Central sleep apnea'),
(221,NULL,'780.57','G47.37','Central sleep apnea comorbid with opioid use'),
(222,NULL,'786.04','R06.3','Cheyne-Stokes breathing'),
(223,NULL,'V61.29','Z62.898','Child affected by parental relationship distress'),
(224,NULL,NULL,NULL,'Child neglect, Confirmed'),
(225,NULL,'995.52','T74.02XA','Child neglect, Confirmed, Initial encounter'),
(226,NULL,'995.52','T74.02XD','Child neglect, Confirmed, Subsequent encounter'),
(227,NULL,NULL,NULL,'Child neglect, Suspected'),
(228,NULL,'995.52','T76.02XA','Child neglect, Suspected, Initial encounter'),
(229,NULL,'995.52','T76.02XD','Child neglect, Suspected, Subsequent encounter'),
(230,NULL,'V71.02','Z72.810','Child or adolescent antisocial behavior'),
(231,NULL,NULL,NULL,'Child physical abuse, Confirmed'),
(232,NULL,'995.54','T74.12XA','Child physical abuse, Confirmed, Initial encounter'),
(233,NULL,'995.54','T74.12XD','Child physical abuse, Confirmed, Subsequent encounter'),
(234,NULL,NULL,NULL,'Child physical abuse, Suspected'),
(235,NULL,'995.54','T76.12XA','Child physical abuse, Suspected, Initial encounter'),
(236,NULL,'995.54','T76.12XD','Child physical abuse, Suspected, Subsequent encounter'),
(237,NULL,NULL,NULL,'Child psychological abuse, Confirmed'),
(238,NULL,'995.51','T74.32XA','Child psychological abuse, Confirmed, Initial encounter'),
(239,NULL,'995.51','T74.32XD','Child psychological abuse, Confirmed, Subsequent encounter'),
(240,NULL,NULL,NULL,'Child psychological abuse, Suspected'),
(241,NULL,'995.51','T76.32XA','Child psychological abuse, Suspected, Initial encounter'),
(242,NULL,'995.51','T76.32XD','Child psychological abuse, Suspected, Subsequent encounter'),
(243,NULL,NULL,NULL,'Child sexual abuse, Confirmed'),
(244,NULL,'995.53','T74.22XA','Child sexual abuse, Confirmed, Initial encounter'),
(245,NULL,'995.53','T74.22XD','Child sexual abuse, Confirmed, Subsequent encounter'),
(246,NULL,NULL,NULL,'Child sexual abuse, Suspected'),
(247,NULL,'995.53','T76.22XA','Child sexual abuse, Suspected, Initial encounter'),
(248,NULL,'995.53','T76.22XD','Child sexual abuse, Suspected, Subsequent encounter'),
(249,NULL,'315.35','F80.81','Childhood-onset fluency disorder (stuttering)'),
(250,NULL,NULL,NULL,'Circadian rhythm sleep-wake disorders');
INSERT INTO Diagnostico VALUES
(251,NULL,'307.45','G47.22','Circadian rhythm sleep-wake disorders, Advanced sleep phase type'),
(252,NULL,'307.45','G47.21','Circadian rhythm sleep-wake disorders, Delayed sleep phase type'),
(253,NULL,'307.45','G47.23','Circadian rhythm sleep-wake disorders, Irregular sleep-wake type'),
(254,NULL,'307.45','G47.24','Circadian rhythm sleep-wake disorders, Non-24-hour sleep-wake type'),
(255,NULL,'307.45','G47.26','Circadian rhythm sleep-wake disorders, Shift work type'),
(256,NULL,'307.45','G47.20','Circadian rhythm sleep-wake disorders, Unspecified type'),
(257,NULL,'292.89',NULL,'Cocaine intoxication'),
(258,NULL,'292.81',NULL,'Cocaine intoxication delirium'),
(259,NULL,NULL,'F14.121','Cocaine intoxication delirium, With mild use disorder'),
(260,NULL,NULL,'F14.221','Cocaine intoxication delirium, With moderate or severe use disorder'),
(261,NULL,NULL,'F14.921','Cocaine intoxication delirium, Without use disorder'),
(262,NULL,NULL,NULL,'Cocaine intoxication, With perceptual disturbances'),
(263,NULL,NULL,'F14.122','Cocaine intoxication, With perceptual disturbances, With mild use disorder'),
(264,NULL,NULL,'F14.222','Cocaine intoxication, With perceptual disturbances, With moderate or severe use disorder'),
(265,NULL,NULL,'F14.922','Cocaine intoxication, With perceptual disturbances, Without use disorder'),
(266,NULL,NULL,NULL,'Cocaine intoxication, Without perceptual disturbances'),
(267,NULL,NULL,'F14.129','Cocaine intoxication, Without perceptual disturbances, With mild use disorder'),
(268,NULL,NULL,'F14.229','Cocaine intoxication, Without perceptual disturbances, With moderate or severe use disorder'),
(269,NULL,NULL,'F14.929','Cocaine intoxication, Without perceptual disturbances, Without use disorder'),
(270,NULL,NULL,NULL,'Cocaine use disorder'),
(271,NULL,'305.6','F14.10','Cocaine use disorder, Mild'),
(272,NULL,'304.2','F14.20','Cocaine use disorder, Moderate'),
(273,NULL,'304.2','F14.20','Cocaine use disorder, Severe'),
(274,NULL,'292','F14.23','Cocaine withdrawal'),
(275,NULL,'292.89',NULL,'Cocaine-induced anxiety disorder'),
(276,NULL,NULL,'F14.180','Cocaine-induced anxiety disorder, With mild use disorder'),
(277,NULL,NULL,'F14.280','Cocaine-induced anxiety disorder, With moderate or severe use disorder'),
(278,NULL,NULL,'F14.980','Cocaine-induced anxiety disorder, Without use disorder'),
(279,NULL,'292.84',NULL,'Cocaine-induced bipolar and related disorder'),
(280,NULL,NULL,'F14.14','Cocaine-induced bipolar and related disorder, With mild use disorder'),
(281,NULL,NULL,'F14.24','Cocaine-induced bipolar and related disorder, With moderate or severe use disorder'),
(282,NULL,NULL,'F14.94','Cocaine-induced bipolar and related disorder, Without use disorder'),
(283,NULL,'292.84',NULL,'Cocaine-induced depressive disorder'),
(284,NULL,NULL,'F14.14','Cocaine-induced depressive disorder, With mild use disorder'),
(285,NULL,NULL,'F14.24','Cocaine-induced depressive disorder, With moderate or severe use disorder'),
(286,NULL,NULL,'F14.94','Cocaine-induced depressive disorder, Without use disorder'),
(287,NULL,'292.89',NULL,'Cocaine-induced obsessive-compulsive and related disorder'),
(288,NULL,NULL,'F14.188','Cocaine-induced obsessive-compulsive and related disorder, With mild use disorder'),
(289,NULL,NULL,'F14.288','Cocaine-induced obsessive-compulsive and related disorder, With moderate or severe use disorder'),
(290,NULL,NULL,'F14.988','Cocaine-induced obsessive-compulsive and related disorder, Without use disorder'),
(291,NULL,'292.9',NULL,'Cocaine-induced psychotic disorder'),
(292,NULL,NULL,'F14.159','Cocaine-induced psychotic disorder, With mild use disorder'),
(293,NULL,NULL,'F14.259','Cocaine-induced psychotic disorder, With moderate or severe use disorder'),
(294,NULL,NULL,'F14.959','Cocaine-induced psychotic disorder, Without use disorder'),
(295,NULL,'292.89',NULL,'Cocaine-induced sexual dysfunction'),
(296,NULL,NULL,'F14.181','Cocaine-induced sexual dysfunction, With mild use disorder'),
(297,NULL,NULL,'F14.281','Cocaine-induced sexual dysfunction, With moderate or severe use disorder'),
(298,NULL,NULL,'F14.981','Cocaine-induced sexual dysfunction, Without use disorder'),
(299,NULL,'292.85',NULL,'Cocaine-induced sleep disorder'),
(300,NULL,NULL,'F14.182','Cocaine-induced sleep disorder, With mild use disorder'),
(301,NULL,NULL,'F14.282','Cocaine-induced sleep disorder, With moderate or severe use disorder'),
(302,NULL,NULL,'F14.982','Cocaine-induced sleep disorder, Without use disorder'),
(303,NULL,'327.26','G47.36','Comorbid sleep-related hypoventilation'),
(304,NULL,NULL,NULL,'Conduct disorder'),
(305,NULL,'312.82','F91.2','Conduct disorder, Adolescent-onset type'),
(306,NULL,'312.81','F91.1','Conduct disorder, Childhood-onset type'),
(307,NULL,'312.89','F91.9','Conduct disorder, Unspecified onset'),
(308,NULL,'327.25','G47.35','Congenital central alveolar hypoventilation'),
(309,NULL,'300.11',NULL,'Conversion disorder (functional neurological symptom disorder)'),
(310,NULL,NULL,'F44.4','Conversion disorder (functional neurological symptom disorder), With abnormal movement'),
(311,NULL,NULL,'F44.6','Conversion disorder (functional neurological symptom disorder), With anesthesia or sensory loss'),
(312,NULL,NULL,'F44.5','Conversion disorder (functional neurological symptom disorder), With attacks or seizures'),
(313,NULL,NULL,'F44.7','Conversion disorder (functional neurological symptom disorder), With mixed symptoms'),
(314,NULL,NULL,'F44.6','Conversion disorder (functional neurological symptom disorder), With special sensory symptoms'),
(315,NULL,NULL,'F44.4','Conversion disorder (functional neurological symptom disorder), With speech symptoms'),
(316,NULL,NULL,'F44.4','Conversion disorder (functional neurological symptom disorder), With swallowing symptoms'),
(317,NULL,NULL,'F44.4','Conversion disorder (functional neurological symptom disorder), With weakness/paralysis'),
(318,NULL,'V62.5','Z65.0','Conviction in civil or criminal proceedings without imprisonment'),
(319,NULL,'301.13','F34.0','Cyclothymic disorder'),
(320,NULL,'302.74','F52.32','Delayed ejaculation'),
(321,NULL,NULL,NULL,'Delirium'),
(322,NULL,'293','F05','Delirium due to another medical condition'),
(323,NULL,'293','F05','Delirium due to multiple etiologies'),
(324,NULL,'297.1','F22','Delusional disorder'),
(325,NULL,'301.6','F60.7','Dependent personality disorder'),
(326,NULL,'300.6','F48.1','Depersonalization/derealization disorder'),
(327,NULL,'293.83',NULL,'Depressive disorder due to another medical condition'),
(328,NULL,NULL,'F06.31','Depressive disorder due to another medical condition, With depressive features'),
(329,NULL,NULL,'F06.32','Depressive disorder due to another medical condition, With major depressive-like episode'),
(330,NULL,NULL,'F06.34','Depressive disorder due to another medical condition, With mixed features'),
(331,NULL,'315.4','F82','Developmental coordination disorder'),
(332,NULL,'V60.89','Z59.2','Discord with neighbor, lodger, or landlord'),
(333,NULL,'V62.89','Z64.4','Discord with social service provider, including probation officer, case manager, or social services worker'),
(334,NULL,'313.89','F94.2','Disinhibited social engagement disorder'),
(335,NULL,'V61.03','Z63.5','Disruption of family by separation or divorce'),
(336,NULL,'296.99','F34.8','Disruptive mood dysregulation disorder'),
(337,NULL,'300.12','F44.0','Dissociative amnesia'),
(338,NULL,'300.13','F44.1','Dissociative amnesia, with dissociative fugue'),
(339,NULL,'300.14','F44.81','Dissociative identity disorder'),
(340,NULL,'307.7','F98.1','Encopresis'),
(341,NULL,'307.6','F98.0','Enuresis'),
(342,NULL,'302.72','F52.21','Erectile disorder'),
(343,NULL,'698.4','L98.1','Excoriation (skin-picking) disorder'),
(344,NULL,'302.4','F65.2','Exhibitionistic disorder'),
(345,NULL,'V62.22','Z65.5','Exposure to disaster, war, or other hostilities'),
(346,NULL,'V60.2','Z59.5','Extreme poverty'),
(347,NULL,'300.19','F68.10','Factitious disorder'),
(348,NULL,'302.73','F52.31','Female orgasmic disorder'),
(349,NULL,'302.72','F52.22','Female sexual interest/arousal disorder'),
(350,NULL,'302.81','F65.0','Fetishistic disorder'),
(351,NULL,'302.89','F65.81','Frotteuristic disorder'),
(352,1,'312.31','F63.0','Gambling disorder'),
(353,NULL,'302.85','F64.1','Gender dysphoria in adolescents and adults'),
(354,NULL,'302.6','F64.2','Gender dysphoria in children'),
(355,NULL,'300.02','F41.1','Generalized anxiety disorder'),
(356,NULL,'302.76','F52.6','Genito-pelvic pain/penetration disorder'),
(357,NULL,'315.8','F88','Global developmental delay'),
(358,NULL,'292.89','F16.983','Hallucinogen persisting perception disorder'),
(359,NULL,'V61.8','Z63.8','High expressed emotion level within family'),
(360,NULL,'301.5','F60.4','Histrionic personality disorder'),
(361,NULL,'300.3','F42','Hoarding disorder'),
(362,NULL,'V60.0','Z59.0','Homelessness'),
(363,NULL,'780.54','G47.10','Hypersomnolence disorder'),
(364,NULL,'327.21','G47.31','Idiopathic central sleep apnea'),
(365,NULL,'327.24','G47.34','Idiopathic hypoventilation'),
(366,NULL,'300.7','F45.21','Illness anxiety disorder'),
(367,NULL,'V62.5','Z65.1','Imprisonment or other incarceration'),
(368,NULL,'V60.1','Z59.1','Inadequate housing'),
(369,NULL,'292.89',NULL,'Inhalant intoxication'),
(370,NULL,'292.81',NULL,'Inhalant intoxication delirium'),
(371,NULL,NULL,'F18.121','Inhalant intoxication delirium, With mild use disorder'),
(372,NULL,NULL,'F18.221','Inhalant intoxication delirium, With moderate or severe use disorder'),
(373,NULL,NULL,'F18.921','Inhalant intoxication delirium, Without use disorder'),
(374,NULL,NULL,'F18.129','Inhalant intoxication, With mild use disorder'),
(375,NULL,NULL,'F18.229','Inhalant intoxication, With moderate or severe use disorder'),
(376,NULL,NULL,'F18.929','Inhalant intoxication, Without use disorder'),
(377,NULL,NULL,NULL,'Inhalant use disorder'),
(378,NULL,'305.9','F18.10','Inhalant use disorder, Mild'),
(379,NULL,'304.6','F18.20','Inhalant use disorder, Moderate'),
(380,NULL,'304.6','F18.20','Inhalant use disorder, Severe'),
(381,NULL,'292.89',NULL,'Inhalant-induced anxiety disorder'),
(382,NULL,NULL,'F18.180','Inhalant-induced anxiety disorder, With mild use disorder'),
(383,NULL,NULL,'F18.280','Inhalant-induced anxiety disorder, With moderate or severe use disorder'),
(384,NULL,NULL,'F18.980','Inhalant-induced anxiety disorder, Without use disorder'),
(385,NULL,'292.84',NULL,'Inhalant-induced depressive disorder'),
(386,NULL,NULL,'F18.14','Inhalant-induced depressive disorder, With mild use disorder'),
(387,NULL,NULL,'F18.24','Inhalant-induced depressive disorder, With moderate or severe use disorder'),
(388,NULL,NULL,'F18.94','Inhalant-induced depressive disorder, Without use disorder'),
(389,NULL,'292.82',NULL,'Inhalant-induced major neurocognitive disorder'),
(390,NULL,NULL,'F18.17','Inhalant-induced major neurocognitive disorder, With mild use disorder'),
(391,NULL,NULL,'F18.27','Inhalant-induced major neurocognitive disorder, With moderate or severe use disorder'),
(392,NULL,NULL,'F18.97','Inhalant-induced major neurocognitive disorder, Without use disorder'),
(393,NULL,'292.89',NULL,'Inhalant-induced mild neurocognitive disorder'),
(394,NULL,NULL,'F18.188','Inhalant-induced mild neurocognitive disorder, With mild use disorder'),
(395,NULL,NULL,'F18.288','Inhalant-induced mild neurocognitive disorder, With moderate or severe use disorder'),
(396,NULL,NULL,'F18.988','Inhalant-induced mild neurocognitive disorder, Without use disorder'),
(397,NULL,'292.9',NULL,'Inhalant-induced psychotic disorder'),
(398,NULL,NULL,'F18.159','Inhalant-induced psychotic disorder, With mild use disorder'),
(399,NULL,NULL,'F18.259','Inhalant-induced psychotic disorder, With moderate or severe use disorder'),
(400,NULL,NULL,'F18.959','Inhalant-induced psychotic disorder, Without use disorder'),
(401,NULL,'780.52','G47.00','Insomnia disorder'),
(402,NULL,'V60.2','Z59.7','Insufficient social insurance or welfare support'),
(403,NULL,'319',NULL,'Intellectual disability (intellectual developmental disorder)'),
(404,NULL,'317','F70','Intellectual disability (intellectual developmental disorder), Mild'),
(405,NULL,'318','F71','Intellectual disability (intellectual developmental disorder), Moderate'),
(406,NULL,'318.2','F73','Intellectual disability (intellectual developmental disorder), Profound'),
(407,NULL,'318.1','F72','Intellectual disability (intellectual developmental disorder), Severe'),
(408,NULL,'312.34','F63.81','Intermittent explosive disorder'),
(409,NULL,'312.32','F63.2','Kleptomania'),
(410,NULL,'V60.2','Z59.4','Lack of adequate food or safe drinking water'),
(411,NULL,'315.39','F80.9','Language disorder'),
(412,NULL,'V60.2','Z59.6','Low income'),
(413,NULL,NULL,NULL,'Major depressive disorder, Recurrent episode'),
(414,NULL,'296.36','F33.42','Major depressive disorder, Recurrent episode, In full remission'),
(415,NULL,'296.35','F33.41','Major depressive disorder, Recurrent episode, In partial remission'),
(416,NULL,'296.31','F33.0','Major depressive disorder, Recurrent episode, Mild'),
(417,NULL,'296.32','F33.1','Major depressive disorder, Recurrent episode, Moderate'),
(418,NULL,'296.33','F33.2','Major depressive disorder, Recurrent episode, Severe'),
(419,NULL,'296.3','F33.9','Major depressive disorder, Recurrent episode, Unspecified'),
(420,NULL,'296.34','F33.3','Major depressive disorder, Recurrent episode, With psychotic features'),
(421,NULL,NULL,NULL,'Major depressive disorder, Single episode'),
(422,NULL,'296.26','F32.5','Major depressive disorder, Single episode, In full remission'),
(423,NULL,'296.25','F32.4','Major depressive disorder, Single episode, In partial remission'),
(424,NULL,'296.21','F32.0','Major depressive disorder, Single episode, Mild'),
(425,NULL,'296.22','F32.1','Major depressive disorder, Single episode, Moderate'),
(426,NULL,'296.23','F32.2','Major depressive disorder, Single episode, Severe'),
(427,NULL,'296.2','F32.9','Major depressive disorder, Single episode, Unspecified'),
(428,NULL,'296.24','F32.3','Major depressive disorder, Single episode, With psychotic features'),
(429,NULL,'331.9','G31.9','Major frontotemporal neurocognitive disorder, Possible'),
(430,NULL,NULL,NULL,'[Frontotemporal disease +] Major frontotemporal neurocognitive disorder, Probable'),
(431,NULL,'[331.19 +] 294.11','[G31.09 +] F02.81','[Frontotemporal disease +] Major frontotemporal neurocognitive disorder, Probable, With behavioral disturbance'),
(432,NULL,'[331.19 +] 294.10','[G31.09 +] F02.80','[Frontotemporal disease +] Major frontotemporal neurocognitive disorder, Probable, Without behavioral disturbance'),
(433,NULL,'[331.19 +] 331.9','[G31.09 +] G31.9','Major neurocognitive disorder due to Alzheimer''s disease, Possible'),
(434,NULL,NULL,NULL,'[Alzheimer''s disease +] Major neurocognitive disorder due to Alzheimer''s disease, Probable'),
(435,NULL,'[331.0 +] 294.11','[G30.9 +] F02.81','[Alzheimer''s disease +] Major neurocognitive disorder due to Alzheimer''s disease, Probable, With behavioral disturbance'),
(436,NULL,'[331.0 +] 294.10','[G30.9 +] F02.80','[Alzheimer''s disease +] Major neurocognitive disorder due to Alzheimer''s disease, Probable, Without behavioral disturbance'),
(437,NULL,NULL,NULL,'Major neurocognitive disorder due to another medical condition'),
(438,NULL,'294.11','F02.81','Major neurocognitive disorder due to another medical condition, With behavioral disturbance'),
(439,NULL,'294.1','F02.80','Major neurocognitive disorder due to another medical condition, Without behavioral disturbance'),
(440,NULL,NULL,NULL,'[HIV infection +] Major neurocognitive disorder due to HIV infection'),
(441,NULL,'[042 +] 294.11','[B20 +] F02.81','[HIV infection +] Major neurocognitive disorder due to HIV infection, With behavioral disturbance'),
(442,NULL,'[042 +] 294.10','[B20 +] F02.80','[HIV infection +] Major neurocognitive disorder due to HIV infection, Without behavioral disturbance'),
(443,NULL,NULL,NULL,'[Huntington''s disease +] Major neurocognitive disorder due to Huntington''s disease'),
(444,NULL,'[333.4 +] 294.11','[G10 +] F02.81','[Huntington''s disease +] Major neurocognitive disorder due to Huntington''s disease, With behavioral disturbance'),
(445,NULL,'[333.4 +] 294.10','[G10 +] F02.80','[Huntington''s disease +] Major neurocognitive disorder due to Huntington''s disease, Without behavioral disturbance'),
(446,NULL,NULL,NULL,'Major neurocognitive disorder due to multiple etiologies'),
(447,NULL,'294.11','F02.81','Major neurocognitive disorder due to multiple etiologies, With behavioral disturbance'),
(448,NULL,'294.1','F02.80','Major neurocognitive disorder due to multiple etiologies, Without behavioral disturbance'),
(449,NULL,'331.9','G31.9','Major neurocognitive disorder due to Parkinson''s disease, Possible'),
(450,NULL,NULL,NULL,'[Parkinson''s disease +] Major neurocognitive disorder due to Parkinson''s disease, Probable'),
(451,NULL,'[332.0 +] 294.11','[G20 +] F02.81','[Parkinson''s disease +] Major neurocognitive disorder due to Parkinson''s disease, Probable, With behavioral disturbance'),
(452,NULL,'[332.0 +] 294.10','[G20 +] F02.80','[Parkinson''s disease +] Major neurocognitive disorder due to Parkinson''s disease, Probable, Without behavioral disturbance'),
(453,NULL,NULL,NULL,'[Prion disease +] Major neurocognitive disorder due to prion disease'),
(454,NULL,'[046.79 +] 294.11','[A81.9 +] F02.81','[Prion disease +] Major neurocognitive disorder due to prion disease, With behavioral disturbance'),
(455,NULL,'[046.79 +] 294.10','[A81.9 +] F02.80','[Prion disease +] Major neurocognitive disorder due to prion disease, Without behavioral disturbance'),
(456,NULL,NULL,NULL,'[Late effect of intracranial injury without skull fracture (ICD-9-CM) / Diffuse traumatic brain injury with loss of consciousness of unspecified duration, sequela (ICD-10-CM) +] Major neurocognitive disorder due to traumatic brain injury'),
(457,NULL,'[907.0 +] 294.11','[S06.2X9S +] F02.81','[Late effect of intracranial injury without skull fracture (ICD-9-CM) / Diffuse traumatic brain injury with loss of consciousness of unspecified duration, sequela (ICD-10-CM) +] Major neurocognitive disorder due to traumatic brain injury, With behavioral disturbance'),
(458,NULL,'[907.0 +] 294.10','[S06.2X9S +] F02.80','[Late effect of intracranial injury without skull fracture (ICD-9-CM) / Diffuse traumatic brain injury with loss of consciousness of unspecified duration, sequela (ICD-10-CM) +] Major neurocognitive disorder due to traumatic brain injury, Without behavioral disturbance'),
(459,NULL,'331.9','G31.9','Major neurocognitive disorder with Lewy bodies, Possible'),
(460,NULL,NULL,NULL,'[Lewy body disease +] Major neurocognitive disorder with Lewy bodies, Probable'),
(461,NULL,'[331.82 +] 294.11','[G31.83 +] F02.81','[Lewy body disease +] Major neurocognitive disorder with Lewy bodies, Probable, With behavioral disturbance'),
(462,NULL,'[331.82 +] 294.10','[G31.83 +] F02.80','[Lewy body disease +] Major neurocognitive disorder with Lewy bodies, Probable, Without behavioral disturbance'),
(463,NULL,'331.9','G31.9','Major vascular neurocognitive disorder, Possible'),
(464,NULL,NULL,NULL,'Major vascular neurocognitive disorder, Probable'),
(465,NULL,'290.4','F01.51','Major vascular neurocognitive disorder, Probable, With behavioral disturbance'),
(466,NULL,'290.4','F01.50','Major vascular neurocognitive disorder, Probable, Without behavioral disturbance'),
(467,NULL,'302.71','F52.0','Male hypoactive sexual desire disorder'),
(468,NULL,'V65.2','Z76.5','Malingering'),
(469,NULL,'333.99','G25.71','Medication-induced acute akathisia'),
(470,NULL,'333.72','G24.02','Medication-induced acute dystonia'),
(471,NULL,'292.81','see specific substances','Medication-induced delirium'),
(472,NULL,'292.81','see specific substances','Medication-induced delirium'),
(473,NULL,'333.1','G25.1','Medication-induced postural tremor'),
(474,NULL,'331.83','G31.84','Mild frontotemporal neurocognitive disorder'),
(475,NULL,'331.83','G31.84','Mild neurocognitive disorder due to Alzheimer''s disease'),
(476,NULL,'331.83','G31.84','Mild neurocognitive disorder due to another medical condition'),
(477,NULL,'331.83','G31.84','Mild neurocognitive disorder due to HIV infection'),
(478,NULL,'331.83','G31.84','Mild neurocognitive disorder due to Huntington''s disease'),
(479,NULL,'331.83','G31.84','Mild neurocognitive disorder due to multiple etiologies'),
(480,NULL,'331.83','G31.84','Mild neurocognitive disorder due to Parkinson''s disease'),
(481,NULL,'331.83','G31.84','Mild neurocognitive disorder due to prion disease'),
(482,NULL,'331.83','G31.84','Mild neurocognitive disorder due to traumatic brain injury'),
(483,NULL,'331.83','G31.84','Mild neurocognitive disorder with Lewy bodies'),
(484,NULL,'331.83','G31.84','Mild vascular neurocognitive disorder'),
(485,NULL,'301.81','F60.81','Narcissistic personality disorder'),
(486,NULL,NULL,NULL,'Narcolepsy'),
(487,NULL,'347.1','G47.429','Narcolepsy secondary to another medical condition'),
(488,NULL,'347.01','G47.411','Narcolepsy with cataplexy but without hypocretin deficiency'),
(489,NULL,'347','G47.419','Narcolepsy without cataplexy but with hypocretin deficiency'),
(490,NULL,'333.92','G21.0','Neuroleptic malignant syndrome'),
(491,NULL,'332.1','G21.11','Neuroleptic-induced parkinsonism'),
(492,NULL,'307.47','F51.5','Nightmare disorder'),
(493,NULL,'V71.09','Z03.89','No Diagnosis or Condition on Axis I / No Diagnosis on Axis II [DSM-IV]'),
(494,NULL,'V15.81','Z91.19','Nonadherence to medical treatment'),
(495,NULL,NULL,NULL,'Non-rapid eye movement sleep arousal disorders'),
(496,NULL,'307.46','F51.4','Non-rapid eye movement sleep arousal disorders, Sleep terror type'),
(497,NULL,'307.46','F51.3','Non-rapid eye movement sleep arousal disorders, Sleepwalking type'),
(498,NULL,'294.8','F06.8','Obsessive-compulsive and related disorder due to another medical condition'),
(499,1,'300.3','F42','Obsessive-compulsive disorder'),
(500,NULL,'301.4','F60.5','Obsessive-compulsive personality disorder');
INSERT INTO Diagnostico VALUES
(501,NULL,'327.23','G47.33','Obstructive sleep apnea hypopnea'),
(502,NULL,'292.89',NULL,'Opioid intoxication'),
(503,NULL,'292.81',NULL,'Opioid intoxication delirium'),
(504,NULL,NULL,'F11.121','Opioid intoxication delirium, With mild use disorder'),
(505,NULL,NULL,'F11.221','Opioid intoxication delirium, With moderate or severe use disorder'),
(506,NULL,NULL,'F11.921','Opioid intoxication delirium, Without use disorder'),
(507,NULL,NULL,NULL,'Opioid intoxication, With perceptual disturbances'),
(508,NULL,NULL,'F11.122','Opioid intoxication, With perceptual disturbances, With mild use disorder'),
(509,NULL,NULL,'F11.222','Opioid intoxication, With perceptual disturbances, With moderate or severe use disorder'),
(510,NULL,NULL,'F11.922','Opioid intoxication, With perceptual disturbances, Without use disorder'),
(511,NULL,NULL,NULL,'Opioid intoxication, Without perceptual disturbances'),
(512,NULL,NULL,'F11.129','Opioid intoxication, Without perceptual disturbances, With mild use disorder'),
(513,NULL,NULL,'F11.229','Opioid intoxication, Without perceptual disturbances, With moderate or severe use disorder'),
(514,NULL,NULL,'F11.929','Opioid intoxication, Without perceptual disturbances, Without use disorder'),
(515,NULL,NULL,NULL,'Opioid use disorder'),
(516,NULL,'305.5','F11.10','Opioid use disorder, Mild'),
(517,NULL,'304','F11.20','Opioid use disorder, Moderate'),
(518,NULL,'304','F11.20','Opioid use disorder, Severe'),
(519,NULL,'292','F11.23','Opioid withdrawal'),
(520,NULL,'292','F11.23','Opioid withdrawal delirium'),
(521,NULL,'292.89',NULL,'Opioid-induced anxiety disorder'),
(522,NULL,NULL,'F11.188','Opioid-induced anxiety disorder, With mild use disorder'),
(523,NULL,NULL,'F11.288','Opioid-induced anxiety disorder, With moderate or severe use disorder'),
(524,NULL,NULL,'F11.988','Opioid-induced anxiety disorder, Without use disorder'),
(525,NULL,NULL,'F11.921','Opioid-induced delirium'),
(526,NULL,'292.84',NULL,'Opioid-induced depressive disorder'),
(527,NULL,NULL,'F11.14','Opioid-induced depressive disorder, With mild use disorder'),
(528,NULL,NULL,'F11.24','Opioid-induced depressive disorder, With moderate or severe use disorder'),
(529,NULL,NULL,'F11.94','Opioid-induced depressive disorder, Without use disorder'),
(530,NULL,'292.89',NULL,'Opioid-induced sexual dysfunction'),
(531,NULL,NULL,'F11.181','Opioid-induced sexual dysfunction, With mild use disorder'),
(532,NULL,NULL,'F11.281','Opioid-induced sexual dysfunction, With moderate or severe use disorder'),
(533,NULL,NULL,'F11.981','Opioid-induced sexual dysfunction, Without use disorder'),
(534,NULL,'292.85',NULL,'Opioid-induced sleep disorder'),
(535,NULL,NULL,'F11.182','Opioid-induced sleep disorder, With mild use disorder'),
(536,NULL,NULL,'F11.282','Opioid-induced sleep disorder, With moderate or severe use disorder'),
(537,NULL,NULL,'F11.982','Opioid-induced sleep disorder, Without use disorder'),
(538,NULL,'313.81','F91.3','Oppositional defiant disorder'),
(539,NULL,'292.89',NULL,'Other (or unknown) substance intoxication'),
(540,NULL,'292.81',NULL,'Other (or unknown) substance intoxication delirium'),
(541,NULL,NULL,'F19.121','Other (or unknown) substance intoxication delirium, With mild use disorder'),
(542,NULL,NULL,'F19.221','Other (or unknown) substance intoxication delirium, With moderate or severe use disorder'),
(543,NULL,NULL,'F19.921','Other (or unknown) substance intoxication delirium, Without use disorder'),
(544,NULL,NULL,'F19.129','Other (or unknown) substance intoxication, With mild use disorder'),
(545,NULL,NULL,'F19.229','Other (or unknown) substance intoxication, With moderate or severe use disorder'),
(546,NULL,NULL,'F19.929','Other (or unknown) substance intoxication, Without use disorder'),
(547,NULL,NULL,NULL,'Other (or unknown) substance use disorder'),
(548,NULL,'305.9','F19.10','Other (or unknown) substance use disorder, Mild'),
(549,NULL,'304.9','F19.20','Other (or unknown) substance use disorder, Moderate'),
(550,NULL,'304.9','F19.20','Other (or unknown) substance use disorder, Severe'),
(551,NULL,'292','F19.239','Other (or unknown) substance withdrawal'),
(552,NULL,'292','F19.231','Other (or unknown) substance withdrawal delirium'),
(553,NULL,'292.89',NULL,'Other (or unknown) substance-induced anxiety disorder'),
(554,NULL,NULL,'F19.180','Other (or unknown) substance-induced anxiety disorder, With mild use disorder'),
(555,NULL,NULL,'F19.280','Other (or unknown) substance-induced anxiety disorder, With moderate or severe use disorder'),
(556,NULL,NULL,'F19.980','Other (or unknown) substance-induced anxiety disorder, Without use disorder'),
(557,1,'292.84',NULL,'Other (or unknown) substance-induced bipolar and related disorder'),
(558,NULL,NULL,'F19.14','Other (or unknown) substance-induced bipolar and related disorder, With mild use disorder'),
(559,NULL,NULL,'F19.24','Other (or unknown) substance-induced bipolar and related disorder, With moderate or severe use disorder'),
(560,NULL,NULL,'F19.94','Other (or unknown) substance-induced bipolar and related disorder, Without use disorder'),
(561,NULL,NULL,'F19.921','Other (or unknown) substance-induced delirium'),
(562,1,'292.84',NULL,'Other (or unknown) substance-induced depressive disorder'),
(563,NULL,NULL,'F19.14','Other (or unknown) substance-induced depressive disorder, With mild use disorder'),
(564,NULL,NULL,'F19.24','Other (or unknown) substance-induced depressive disorder, With moderate or severe use disorder'),
(565,NULL,NULL,'F19.94','Other (or unknown) substance-induced depressive disorder, Without use disorder'),
(566,NULL,'292.82',NULL,'Other (or unknown) substance-induced major neurocognitive disorder'),
(567,NULL,NULL,'F19.17','Other (or unknown) substance-induced major neurocognitive disorder, With mild use disorder'),
(568,NULL,NULL,'F19.27','Other (or unknown) substance-induced major neurocognitive disorder, With moderate or severe use disorder'),
(569,NULL,NULL,'F19.97','Other (or unknown) substance-induced major neurocognitive disorder, Without use disorder'),
(570,NULL,'292.89',NULL,'Other (or unknown) substance-induced mild neurocognitive disorder'),
(571,NULL,NULL,'F19.188','Other (or unknown) substance-induced mild neurocognitive disorder, With mild use disorder'),
(572,NULL,NULL,'F19.288','Other (or unknown) substance-induced mild neurocognitive disorder, With moderate or severe use disorder'),
(573,NULL,NULL,'F19.988','Other (or unknown) substance-induced mild neurocognitive disorder, Without use disorder'),
(574,NULL,'292.89',NULL,'Other (or unknown) substance-induced obsessive-compulsive and related disorder'),
(575,NULL,NULL,'F19.188','Other (or unknown) substance-induced obsessive-compulsive and related disorder, With mild use disorder'),
(576,NULL,NULL,'F19.288','Other (or unknown) substance-induced obsessive-compulsive and related disorder, With moderate or severe use disorder'),
(577,NULL,NULL,'F19.988','Other (or unknown) substance-induced obsessive-compulsive and related disorder, Without use disorder'),
(578,NULL,'292.9',NULL,'Other (or unknown) substance-induced psychotic disorder'),
(579,NULL,NULL,'F19.159','Other (or unknown) substance-induced psychotic disorder, With mild use disorder'),
(580,NULL,NULL,'F19.259','Other (or unknown) substance-induced psychotic disorder, With moderate or severe use disorder'),
(581,NULL,NULL,'F19.959','Other (or unknown) substance-induced psychotic disorder, Without use disorder'),
(582,NULL,'292.89',NULL,'Other (or unknown) substance-induced sexual dysfunction'),
(583,NULL,NULL,'F19.181','Other (or unknown) substance-induced sexual dysfunction, With mild use disorder'),
(584,NULL,NULL,'F19.281','Other (or unknown) substance-induced sexual dysfunction, With moderate or severe use disorder'),
(585,NULL,NULL,'F19.981','Other (or unknown) substance-induced sexual dysfunction, Without use disorder'),
(586,NULL,'292.85',NULL,'Other (or unknown) substance-induced sleep disorder'),
(587,NULL,NULL,'F19.182','Other (or unknown) substance-induced sleep disorder, With mild use disorder'),
(588,NULL,NULL,'F19.282','Other (or unknown) substance-induced sleep disorder, With moderate or severe use disorder'),
(589,NULL,NULL,'F19.982','Other (or unknown) substance-induced sleep disorder, Without use disorder'),
(590,NULL,NULL,NULL,'Other adverse effect of medication'),
(591,NULL,'995.2','T50.905A','Other adverse effect of medication, Initial encounter'),
(592,NULL,'995.2','T50.905S','Other adverse effect of medication, Sequelae'),
(593,NULL,'995.2','T50.905D','Other adverse effect of medication, Subsequent encounter'),
(594,NULL,NULL,NULL,'Other circumstances related to adult abuse by nonspouse or nonpartner'),
(595,NULL,'V62.83','Z69.82','Other circumstances related to adult abuse by nonspouse or nonpartner, Encounter for mental health services for perpetrator of nonspousal adult abuse'),
(596,NULL,'V65.49','Z69.81','Other circumstances related to adult abuse by nonspouse or nonpartner, Encounter for mental health services for victim of nonspousal adult abuse'),
(597,NULL,NULL,NULL,'Other circumstances related to child neglect'),
(598,NULL,'V62.83','Z69.021','Other circumstances related to child neglect, Encounter for mental health services for perpetrator of nonparental child neglect'),
(599,NULL,'V61.22','Z69.011','Other circumstances related to child neglect, Encounter for mental health services for perpetrator of parental child neglect'),
(600,NULL,'V61.21','Z69.010','Other circumstances related to child neglect, Encounter for mental health services for victim of child neglect by parent'),
(601,NULL,'V61.21','Z69.020','Other circumstances related to child neglect, Encounter for mental health services for victim of nonparental child neglect'),
(602,NULL,NULL,NULL,'Other circumstances related to child physical abuse'),
(603,NULL,'V62.83','Z69.021','Other circumstances related to child physical abuse, Encounter for mental health services for perpetrator of nonparental child abuse'),
(604,NULL,'V61.22','Z69.011','Other circumstances related to child physical abuse, Encounter for mental health services for perpetrator of parental child abuse'),
(605,NULL,'V61.21','Z69.010','Other circumstances related to child physical abuse, Encounter for mental health services for victim of child abuse by parent'),
(606,NULL,'V61.21','Z69.020','Other circumstances related to child physical abuse, Encounter for mental health services for victim of nonparental child abuse'),
(607,NULL,NULL,NULL,'Other circumstances related to child psychological abuse'),
(608,NULL,'V62.83','Z69.021','Other circumstances related to child psychological abuse, Encounter for mental health services for perpetrator of nonparental child psychological abuse'),
(609,NULL,'V61.22','Z69.011','Other circumstances related to child psychological abuse, Encounter for mental health services for perpetrator of parental child psychological abuse'),
(610,NULL,'V61.21','Z69.010','Other circumstances related to child psychological abuse, Encounter for mental health services for victim of child psychological abuse by parent'),
(611,NULL,'V61.21','Z69.020','Other circumstances related to child psychological abuse, Encounter for mental health services for victim of nonparental child psychological abuse'),
(612,NULL,NULL,NULL,'Other circumstances related to child sexual abuse'),
(613,NULL,'V62.83','Z69.021','Other circumstances related to child sexual abuse, Encounter for mental health services for perpetrator of nonparental child sexual abuse'),
(614,NULL,'V61.22','Z69.011','Other circumstances related to child sexual abuse, Encounter for mental health services for perpetrator of parental child sexual abuse'),
(615,NULL,'V61.21','Z69.010','Other circumstances related to child sexual abuse, Encounter for mental health services for victim of child sexual abuse by parent'),
(616,NULL,'V61.21','Z69.020','Other circumstances related to child sexual abuse, Encounter for mental health services for victim of nonparental child sexual abuse'),
(617,NULL,NULL,NULL,'Other circumstances related to spouse or partner abuse, Psychological'),
(618,NULL,'V61.12','Z69.12','Other circumstances related to spouse or partner abuse, Psychological, Encounter for mental health services for perpetrator of spouse or partner psychological abuse'),
(619,NULL,'V61.11','Z69.11','Other circumstances related to spouse or partner abuse, Psychological, Encounter for mental health services for victim of spouse or partner psychological abuse'),
(620,NULL,NULL,NULL,'Other circumstances related to spouse or partner neglect'),
(621,NULL,'V61.12','Z69.12','Other circumstances related to spouse or partner neglect, Encounter for mental health services for perpetrator of spouse or partner neglect'),
(622,NULL,'V61.11','Z69.11','Other circumstances related to spouse or partner neglect, Encounter for mental health services for victim of spouse or partner neglect'),
(623,NULL,NULL,NULL,'Other circumstances related to spouse or partner violence, Physical'),
(624,NULL,'V61.12','Z69.12','Other circumstances related to spouse or partner violence, Physical, Encounter for mental health services for perpetrator of spouse or partner violence'),
(625,NULL,'V61.11','Z69.11','Other circumstances related to spouse or partner violence, Physical, Encounter for mental health services for victim of spouse or partner violence'),
(626,NULL,NULL,NULL,'Other circumstances related to spouse or partner violence, Sexual'),
(627,NULL,'V61.12','Z69.12','Other circumstances related to spouse or partner violence, Sexual, Encounter for mental health services for perpetrator of spouse or partner violence'),
(628,NULL,'V61.11','Z69.81','Other circumstances related to spouse or partner violence, Sexual, Encounter for mental health services for victim of spouse or partner violence'),
(629,NULL,'V65.40','Z71.9','Other counseling or consultation'),
(630,NULL,'292.89',NULL,'Other hallucinogen intoxication'),
(631,NULL,'292.81',NULL,'Other hallucinogen intoxication delirium'),
(632,NULL,NULL,'F16.121','Other hallucinogen intoxication delirium, With mild use disorder'),
(633,NULL,NULL,'F16.221','Other hallucinogen intoxication delirium, With moderate or severe use disorder'),
(634,NULL,NULL,'F16.921','Other hallucinogen intoxication delirium, Without use disorder'),
(635,NULL,NULL,'F16.129','Other hallucinogen intoxication, With mild use disorder'),
(636,NULL,NULL,'F16.229','Other hallucinogen intoxication, With moderate or severe use disorder'),
(637,NULL,NULL,'F16.929','Other hallucinogen intoxication, Without use disorder'),
(638,NULL,NULL,NULL,'Other hallucinogen use disorder'),
(639,NULL,'305.3','F16.10','Other hallucinogen use disorder, Mild'),
(640,NULL,'304.5','F16.20','Other hallucinogen use disorder, Moderate'),
(641,NULL,'304.5','F16.20','Other hallucinogen use disorder, Severe'),
(642,NULL,'292.89',NULL,'Other hallucinogen-induced anxiety disorder'),
(643,NULL,NULL,'F16.180','Other hallucinogen-induced anxiety disorder, With mild use disorder'),
(644,NULL,NULL,'F16.280','Other hallucinogen-induced anxiety disorder, With moderate or severe use disorder'),
(645,NULL,NULL,'F16.980','Other hallucinogen-induced anxiety disorder, Without use disorder'),
(646,NULL,'292.84',NULL,'Other hallucinogen-induced bipolar and related disorder'),
(647,NULL,NULL,'F16.14','Other hallucinogen-induced bipolar and related disorder, With mild use disorder'),
(648,NULL,NULL,'F16.24','Other hallucinogen-induced bipolar and related disorder, With moderate or severe use disorder'),
(649,NULL,NULL,'F16.94','Other hallucinogen-induced bipolar and related disorder, Without use disorder'),
(650,NULL,'292.84',NULL,'Other hallucinogen-induced depressive disorder'),
(651,NULL,NULL,'F16.14','Other hallucinogen-induced depressive disorder, With mild use disorder'),
(652,NULL,NULL,'F16.24','Other hallucinogen-induced depressive disorder, With moderate or severe use disorder'),
(653,NULL,NULL,'F16.94','Other hallucinogen-induced depressive disorder, Without use disorder'),
(654,NULL,'292.9',NULL,'Other hallucinogen-induced psychotic disorder'),
(655,NULL,NULL,'F16.159','Other hallucinogen-induced psychotic disorder, With mild use disorder'),
(656,NULL,NULL,'F16.259','Other hallucinogen-induced psychotic disorder, With moderate or severe use disorder'),
(657,NULL,NULL,'F16.959','Other hallucinogen-induced psychotic disorder, Without use disorder'),
(658,NULL,'333.99','G25.79','Other medication-induced movement disorder'),
(659,NULL,'332.1','G21.19','Other medication-induced parkinsonism'),
(660,NULL,NULL,NULL,'Other or unspecified stimulant use disorder'),
(661,NULL,'305.7','F15.10','Other or unspecified stimulant use disorder, Mild'),
(662,NULL,'304.4','F15.20','Other or unspecified stimulant use disorder, Moderate'),
(663,NULL,'304.4','F15.20','Other or unspecified stimulant use disorder, Severe'),
(664,NULL,'V15.49','Z91.49','Other personal history of psychological trauma'),
(665,NULL,'V15.89','Z91.89','Other personal risk factors'),
(666,NULL,'V62.29','Z56.9','Other problem related to employment'),
(667,NULL,'V62.89','Z65.8','Other problem related to psychosocial circumstances'),
(668,NULL,'300.09','F41.8','Other specified anxiety disorder'),
(669,NULL,'314.01','F90.8','Other specified attention-deficit/hyperactivity disorder'),
(670,NULL,'296.89','F31.89','Other specified bipolar and related disorder'),
(671,NULL,'780.09','R41.0','Other specified delirium'),
(672,NULL,'311','F32.8','Other specified depressive disorder'),
(673,NULL,'312.89','F91.8','Other specified disruptive, impulse-control, and conduct disorder'),
(674,NULL,'300.15','F44.89','Other specified dissociative disorder'),
(675,NULL,NULL,NULL,'Other specified elimination disorder'),
(676,NULL,'787.6','R15.9','Other specified elimination disorder, With fecal symptoms'),
(677,NULL,'788.39','N39.498','Other specified elimination disorder, With urinary symptoms'),
(678,NULL,'307.59','F50.8','Other specified feeding or eating disorder'),
(679,NULL,'302.6','F64.8','Other specified gender dysphoria'),
(680,NULL,'780.54','G47.19','Other specified hypersomnolence disorder'),
(681,NULL,'780.52','G47.09','Other specified insomnia disorder'),
(682,NULL,'300.9','F99','Other specified mental disorder'),
(683,NULL,'294.8','F06.8','Other specified mental disorder due to another medical condition'),
(684,NULL,'315.8','F88','Other specified neurodevelopmental disorder'),
(685,NULL,'300.3','F42','Other specified obsessive-compulsive and related disorder'),
(686,NULL,'302.89','F65.89','Other specified paraphilic disorder'),
(687,NULL,'301.89','F60.89','Other specified personality disorder'),
(688,NULL,'298.8','F28','Other specified schizophrenia spectrum and other psychotic disorder'),
(689,NULL,'302.79','F52.8','Other specified sexual dysfunction'),
(690,NULL,'780.59','G47.8','Other specified sleep-wake disorder'),
(691,NULL,'300.89','F45.8','Other specified somatic symptom and related disorder'),
(692,NULL,'307.2','F95.8','Other specified tic disorder'),
(693,NULL,'309.89','F43.8','Other specified trauma- and stressor-related disorder'),
(694,NULL,'278','E66.9','Overweight or obesity'),
(695,NULL,NULL,NULL,'Panic attack specifier'),
(696,1,'300.01','F41.0','Panic disorder'),
(697,NULL,'301','F60.0','Paranoid personality disorder'),
(698,NULL,'V61.20','Z62.820','Parent-child relational problem'),
(699,NULL,'302.2','F65.4','Pedophilic disorder'),
(700,NULL,'307.22','F95.1','Persistent (chronic) motor or vocal tic disorder'),
(701,NULL,'300.4','F34.1','Persistent depressive disorder (dysthymia)'),
(702,NULL,'V15.42','Z62.812','Personal history (past history) of neglect in childhood'),
(703,NULL,'V15.41','Z62.810','Personal history (past history) of physical abuse in childhood'),
(704,NULL,'V15.42','Z62.811','Personal history (past history) of psychological abuse in childhood'),
(705,NULL,'V15.41','Z62.810','Personal history (past history) of sexual abuse in childhood'),
(706,NULL,'V15.42','Z91.412','Personal history (past history) of spouse or partner neglect'),
(707,NULL,'V15.42','Z91.411','Personal history (past history) of spouse or partner psychological abuse'),
(708,NULL,'V15.41','Z91.410','Personal history (past history) of spouse or partner violence, Physical'),
(709,NULL,'V15.41','Z91.410','Personal history (past history) of spouse or partner violence, Sexual'),
(710,NULL,'V62.22','Z91.82','Personal history of military deployment'),
(711,NULL,'V15.59','Z91.5','Personal history of self-harm'),
(712,NULL,'310.1','F07.0','Personality change due to another medical condition'),
(713,NULL,'V62.89','Z60.0','Phase of life problem'),
(714,NULL,'292.89',NULL,'Phencyclidine intoxication'),
(715,NULL,'292.81',NULL,'Phencyclidine intoxication delirium'),
(716,NULL,NULL,'F16.121','Phencyclidine intoxication delirium, With mild use disorder'),
(717,NULL,NULL,'F16.221','Phencyclidine intoxication delirium, With moderate or severe use disorder'),
(718,NULL,NULL,'F16.921','Phencyclidine intoxication delirium, Without use disorder'),
(719,NULL,NULL,'F16.129','Phencyclidine intoxication, With mild use disorder'),
(720,NULL,NULL,'F16.229','Phencyclidine intoxication, With moderate or severe use disorder'),
(721,NULL,NULL,'F16.929','Phencyclidine intoxication, Without use disorder'),
(722,NULL,NULL,NULL,'Phencyclidine use disorder'),
(723,NULL,'305.9','F16.10','Phencyclidine use disorder, Mild'),
(724,NULL,'304.6','F16.20','Phencyclidine use disorder, Moderate'),
(725,NULL,'304.6','F16.20','Phencyclidine use disorder, Severe'),
(726,NULL,'292.89',NULL,'Phencyclidine-induced anxiety disorder'),
(727,NULL,NULL,'F16.180','Phencyclidine-induced anxiety disorder, With mild use disorder'),
(728,NULL,NULL,'F16.280','Phencyclidine-induced anxiety disorder, With moderate or severe use disorder'),
(729,NULL,NULL,'F16.980','Phencyclidine-induced anxiety disorder, Without use disorder'),
(730,NULL,'292.84',NULL,'Phencyclidine-induced bipolar and related disorder'),
(731,NULL,NULL,'F16.14','Phencyclidine-induced bipolar and related disorder, With mild use disorder'),
(732,NULL,NULL,'F16.24','Phencyclidine-induced bipolar and related disorder, With moderate or severe use disorder'),
(733,NULL,NULL,'F16.94','Phencyclidine-induced bipolar and related disorder, Without use disorder'),
(734,NULL,'292.84',NULL,'Phencyclidine-induced depressive disorder'),
(735,NULL,NULL,'F16.14','Phencyclidine-induced depressive disorder, With mild use disorder'),
(736,NULL,NULL,'F16.24','Phencyclidine-induced depressive disorder, With moderate or severe use disorder'),
(737,NULL,NULL,'F16.94','Phencyclidine-induced depressive disorder, Without use disorder'),
(738,NULL,'292.9',NULL,'Phencyclidine-induced psychotic disorder'),
(739,NULL,NULL,'F16.159','Phencyclidine-induced psychotic disorder, With mild use disorder'),
(740,NULL,NULL,'F16.259','Phencyclidine-induced psychotic disorder, With moderate or severe use disorder'),
(741,NULL,NULL,'F16.959','Phencyclidine-induced psychotic disorder, Without use disorder'),
(742,NULL,'307.52',NULL,'Pica'),
(743,NULL,NULL,'F50.8','Pica, In adults'),
(744,NULL,NULL,'F98.3','Pica, In children'),
(745,NULL,'309.81','F43.10','Posttraumatic stress disorder'),
(746,NULL,'302.75','F52.4','Premature (early) ejaculation'),
(747,NULL,'625.4','N94.3','Premenstrual dysphoric disorder'),
(748,NULL,'V62.21','Z56.82','Problem related to current military deployment status'),
(749,NULL,'V69.9','Z72.9','Problem related to lifestyle'),
(750,NULL,'V60.3','Z60.2','Problem related to living alone');
INSERT INTO Diagnostico VALUES
(751,NULL,'V60.6','Z59.3','Problem related to living in a residential institution'),
(752,NULL,'V61.5','Z64.1','Problems related to multiparity'),
(753,NULL,'V62.5','Z65.3','Problems related to other legal circumstances'),
(754,NULL,'V62.5','Z65.2','Problems related to release from prison'),
(755,NULL,'V61.7','Z64.0','Problems related to unwanted pregnancy'),
(756,NULL,'307.21','F95.0','Provisional tic disorder'),
(757,NULL,'316','F54','Psychological factors affecting other medical conditions'),
(758,NULL,NULL,NULL,'Psychotic disorder due to another medical condition'),
(759,NULL,'293.81','F06.2','Psychotic disorder due to another medical condition, With delusions'),
(760,NULL,'293.82','F06.0','Psychotic disorder due to another medical condition, With hallucinations'),
(761,NULL,'312.33','F63.1','Pyromania'),
(762,NULL,'327.42','G47.52','Rapid eye movement sleep behavior disorder'),
(763,NULL,'313.89','F94.1','Reactive attachment disorder'),
(764,NULL,'V61.10','Z63.0','Relationship distress with spouse or intimate partner'),
(765,NULL,'V62.89','Z65.8','Religious or spiritual problem'),
(766,NULL,'333.94','G25.81','Restless legs syndrome'),
(767,NULL,'307.53','F98.21','Rumination disorder'),
(768,NULL,NULL,NULL,'Schizoaffective disorder'),
(769,NULL,'295.7','F25.0','Schizoaffective disorder, Bipolar type'),
(770,1,'295.7','F25.1','Schizoaffective disorder, Depressive type'),
(771,NULL,'301.2','F60.1','Schizoid personality disorder'),
(772,1,'295.9','F20.9','Schizophrenia'),
(773,NULL,'295.4','F20.81','Schizophreniform disorder'),
(774,NULL,'301.22','F21','Schizotypal personality disorder'),
(775,NULL,'292.89',NULL,'Sedative, hypnotic, or anxiolytic intoxication'),
(776,NULL,'292.81',NULL,'Sedative, hypnotic, or anxiolytic intoxication delirium'),
(777,NULL,NULL,'F13.121','Sedative, hypnotic, or anxiolytic intoxication delirium, With mild use disorder'),
(778,NULL,NULL,'F13.221','Sedative, hypnotic, or anxiolytic intoxication delirium, With moderate or severe use disorder'),
(779,NULL,NULL,'F13.921','Sedative, hypnotic, or anxiolytic intoxication delirium, Without use disorder'),
(780,NULL,NULL,'F13.129','Sedative, hypnotic, or anxiolytic intoxication, With mild use disorder'),
(781,NULL,NULL,'F13.229','Sedative, hypnotic, or anxiolytic intoxication, With moderate or severe use disorder'),
(782,NULL,NULL,'F13.929','Sedative, hypnotic, or anxiolytic intoxication, Without use disorder'),
(783,NULL,NULL,NULL,'Sedative, hypnotic, or anxiolytic use disorder'),
(784,NULL,'305.4','F13.10','Sedative, hypnotic, or anxiolytic use disorder, Mild'),
(785,NULL,'304.1','F13.20','Sedative, hypnotic, or anxiolytic use disorder, Moderate'),
(786,NULL,'304.1','F13.20','Sedative, hypnotic, or anxiolytic use disorder, Severe'),
(787,NULL,'292',NULL,'Sedative, hypnotic, or anxiolytic withdrawal'),
(788,NULL,'292','F13.231','Sedative, hypnotic, or anxiolytic withdrawal delirium'),
(789,NULL,NULL,'F13.232','Sedative, hypnotic, or anxiolytic withdrawal, With perceptual disturbances'),
(790,NULL,NULL,'F13.239','Sedative, hypnotic, or anxiolytic withdrawal, Without perceptual disturbances'),
(791,NULL,'292.89',NULL,'Sedative-, hypnotic-, or anxiolytic-induced anxiety disorder'),
(792,NULL,NULL,'F13.180','Sedative-, hypnotic-, or anxiolytic-induced anxiety disorder, With mild use disorder'),
(793,NULL,NULL,'F13.280','Sedative-, hypnotic-, or anxiolytic-induced anxiety disorder, With moderate or severe use disorder'),
(794,NULL,NULL,'F13.980','Sedative-, hypnotic-, or anxiolytic-induced anxiety disorder, Without use disorder'),
(795,NULL,'292.84',NULL,'Sedative-, hypnotic-, or anxiolytic-induced bipolar and related disorder'),
(796,NULL,NULL,'F13.14','Sedative-, hypnotic-, or anxiolytic-induced bipolar and related disorder, With mild use disorder'),
(797,NULL,NULL,'F13.24','Sedative-, hypnotic-, or anxiolytic-induced bipolar and related disorder, With moderate or severe use disorder'),
(798,NULL,NULL,'F13.94','Sedative-, hypnotic-, or anxiolytic-induced bipolar and related disorder, Without use disorder'),
(799,NULL,NULL,'F13.921','Sedative-, hypnotic-, or anxiolytic-induced delirium'),
(800,NULL,'292.84',NULL,'Sedative-, hypnotic-, or anxiolytic-induced depressive disorder'),
(801,NULL,NULL,'F13.14','Sedative-, hypnotic-, or anxiolytic-induced depressive disorder, With mild use disorder'),
(802,NULL,NULL,'F13.24','Sedative-, hypnotic-, or anxiolytic-induced depressive disorder, With moderate or severe use disorder'),
(803,NULL,NULL,'F13.94','Sedative-, hypnotic-, or anxiolytic-induced depressive disorder, Without use disorder'),
(804,NULL,'292.82',NULL,'Sedative-, hypnotic-, or anxiolytic-induced major neurocognitive disorder'),
(805,NULL,NULL,'F13.27','Sedative-, hypnotic-, or anxiolytic-induced major neurocognitive disorder, With moderate or severe use disorder'),
(806,NULL,NULL,'F13.97','Sedative-, hypnotic-, or anxiolytic-induced major neurocognitive disorder, Without use disorder'),
(807,NULL,'292.89',NULL,'Sedative-, hypnotic-, or anxiolytic-induced mild neurocognitive disorder'),
(808,NULL,NULL,'F13.288','Sedative-, hypnotic-, or anxiolytic-induced mild neurocognitive disorder, With moderate or severe use disorder'),
(809,NULL,NULL,'F13.988','Sedative-, hypnotic-, or anxiolytic-induced mild neurocognitive disorder, Without use disorder'),
(810,NULL,'292.9',NULL,'Sedative-, hypnotic-, or anxiolytic-induced psychotic disorder'),
(811,NULL,NULL,'F13.159','Sedative-, hypnotic-, or anxiolytic-induced psychotic disorder, With mild use disorder'),
(812,NULL,NULL,'F13.259','Sedative-, hypnotic-, or anxiolytic-induced psychotic disorder, With moderate or severe use disorder'),
(813,NULL,NULL,'F13.959','Sedative-, hypnotic-, or anxiolytic-induced psychotic disorder, Without use disorder'),
(814,NULL,'292.89',NULL,'Sedative-, hypnotic-, or anxiolytic-induced sexual dysfunction'),
(815,NULL,NULL,'F13.181','Sedative-, hypnotic-, or anxiolytic-induced sexual dysfunction, With mild use disorder'),
(816,NULL,NULL,'F13.281','Sedative-, hypnotic-, or anxiolytic-induced sexual dysfunction, With moderate or severe use disorder'),
(817,NULL,NULL,'F13.981','Sedative-, hypnotic-, or anxiolytic-induced sexual dysfunction, Without use disorder'),
(818,NULL,'292.85',NULL,'Sedative-, hypnotic-, or anxiolytic-induced sleep disorder'),
(819,NULL,NULL,'F13.182','Sedative-, hypnotic-, or anxiolytic-induced sleep disorder, With mild use disorder'),
(820,NULL,NULL,'F13.282','Sedative-, hypnotic-, or anxiolytic-induced sleep disorder, With moderate or severe use disorder'),
(821,NULL,NULL,'F13.982','Sedative-, hypnotic-, or anxiolytic-induced sleep disorder, Without use disorder'),
(822,NULL,'313.23','F94.0','Selective mutism'),
(823,NULL,'309.21','F93.0','Separation anxiety disorder'),
(824,NULL,'V65.49','Z70.9','Sex counseling'),
(825,NULL,'302.83','F65.51','Sexual masochism disorder'),
(826,NULL,'302.84','F65.52','Sexual sadism disorder'),
(827,NULL,'V61.8','Z62.891','Sibling relational problem'),
(828,NULL,NULL,NULL,'Sleep-related hypoventilation'),
(829,NULL,'315.39','F80.89','Social (pragmatic) communication disorder'),
(830,NULL,'300.23','F40.10','Social anxiety disorder (social phobia)'),
(831,NULL,'V62.4','Z60.4','Social exclusion or rejection'),
(832,NULL,'300.82','F45.1','Somatic symptom disorder'),
(833,NULL,NULL,NULL,'Specific learning disorder'),
(834,NULL,'315.1','F81.2','Specific learning disorder, With impairment in mathematics'),
(835,NULL,'315','F81.0','Specific learning disorder, With impairment in reading'),
(836,NULL,'315.2','F81.81','Specific learning disorder, With impairment in written expression'),
(837,NULL,NULL,NULL,'Specific phobia'),
(838,NULL,'300.29','F40.218','Specific phobia, Animal'),
(839,NULL,'300.29',NULL,'Specific phobia, Blood-injection-injury'),
(840,NULL,NULL,'F40.230','Specific phobia, Fear of blood'),
(841,NULL,NULL,'F40.231','Specific phobia, Fear of injections and transfusions'),
(842,NULL,NULL,'F40.233','Specific phobia, Fear of injury'),
(843,NULL,NULL,'F40.232','Specific phobia, Fear of other medical care'),
(844,NULL,'300.29','F40.228','Specific phobia, Natural environment'),
(845,NULL,'300.29','F40.298','Specific phobia, Other'),
(846,NULL,'300.29','F40.248','Specific phobia, Situational'),
(847,NULL,'315.39','F80.0','Speech sound disorder'),
(848,NULL,NULL,NULL,'Spouse or partner abuse, Psychological, Confirmed'),
(849,NULL,'995.82','T74.31XA','Spouse or partner abuse, Psychological, Confirmed, Initial encounter'),
(850,NULL,'995.82','T74.31XD','Spouse or partner abuse, Psychological, Confirmed, Subsequent encounter'),
(851,NULL,NULL,NULL,'Spouse or partner abuse, Psychological, Suspected'),
(852,NULL,'995.82','T76.31XA','Spouse or partner abuse, Psychological, Suspected, Initial encounter'),
(853,NULL,'995.82','T76.31XD','Spouse or partner abuse, Psychological, Suspected, Subsequent encounter'),
(854,NULL,NULL,NULL,'Spouse or partner neglect, Confirmed'),
(855,NULL,'995.85','T74.01XA','Spouse or partner neglect, Confirmed, Initial encounter'),
(856,NULL,'995.85','T74.01XD','Spouse or partner neglect, Confirmed, Subsequent encounter'),
(857,NULL,NULL,NULL,'Spouse or partner neglect, Suspected'),
(858,NULL,'995.85','T76.01XA','Spouse or partner neglect, Suspected, Initial encounter'),
(859,NULL,'995.85','T76.01XD','Spouse or partner neglect, Suspected, Subsequent encounter'),
(860,NULL,NULL,NULL,'Spouse or partner violence, Physical, Confirmed'),
(861,NULL,'995.81','T74.11XA','Spouse or partner violence, Physical, Confirmed, Initial encounter'),
(862,NULL,'995.81','T74.11XD','Spouse or partner violence, Physical, Confirmed, Subsequent encounter'),
(863,NULL,NULL,NULL,'Spouse or partner Violence, Physical, Suspected'),
(864,NULL,'995.81','T76.11XA','Spouse or partner Violence, Physical, Suspected, Initial encounter'),
(865,NULL,'995.81','T76.11XD','Spouse or partner Violence, Physical, Suspected, Subsequent encounter'),
(866,NULL,NULL,NULL,'Spouse or partner Violence, Sexual, Confirmed'),
(867,NULL,'995.83','T74.21XA','Spouse or partner Violence, Sexual, Confirmed, Initial encounter'),
(868,NULL,'995.83','T74.21XD','Spouse or partner Violence, Sexual, Confirmed, Subsequent encounter'),
(869,NULL,NULL,NULL,'Spouse or partner Violence, Sexual, Suspected'),
(870,NULL,'995.83','T76.21XA','Spouse or partner Violence, Sexual, Suspected, Initial encounter'),
(871,NULL,'995.83','T76.21XD','Spouse or partner Violence, Sexual, Suspected, Subsequent encounter'),
(872,NULL,'307.3','F98.4','Stereotypic movement disorder'),
(873,NULL,'see specific substances','see specific substances','Stimulant intoxication'),
(874,NULL,'see specific substances','see specific substances','Stimulant use disorder'),
(875,NULL,'see specific substances','see specific substances','Stimulant withdrawal'),
(876,NULL,'see specific substances','see specific substances','Substance intoxication delirium'),
(877,NULL,'see specific substances','see specific substances','Substance intoxication delirium'),
(878,NULL,'see specific substances','see specific substances','Substance withdrawal delirium'),
(879,NULL,'see specific substances','see specific substances','Substance withdrawal delirium'),
(880,NULL,'see specific substances','see specific substances','Substance/medication-induced anxiety disorder'),
(881,NULL,'see specific substances','see specific substances','Substance/medication-induced bipolar and related disorder'),
(882,NULL,'see specific substances','see specific substances','Substance/medication-induced depressive disorder'),
(883,NULL,'see specific substances','see specific substances','Substance/medication-induced major or mild neurocognitive disorder'),
(884,NULL,'see specific substances','see specific substances','Substance/medication-induced obsessive-compulsive and related disorder'),
(885,NULL,'see specific substances','see specific substances','Substance/medication-induced psychotic disorder'),
(886,NULL,'see specific substances','see specific substances','Substance/medication-induced sexual dysfunction'),
(887,NULL,'see specific substances','see specific substances','Substance/medication-induced sleep disorder'),
(888,NULL,'333.99','G25.71','Tardive akathisia'),
(889,NULL,'333.85','G24.01','Tardive dyskinesia'),
(890,NULL,'333.72','G24.09','Tardive dystonia'),
(891,NULL,'V62.4','Z60.5','Target of (perceived) adverse discrimination or persecution'),
(892,NULL,NULL,NULL,'Tobacco use disorder'),
(893,NULL,'305.1','Z72.0','Tobacco use disorder, Mild'),
(894,NULL,'305.1','F17.200','Tobacco use disorder, Moderate'),
(895,NULL,'305.1','F17.200','Tobacco use disorder, Severe'),
(896,NULL,'292','F17.203','Tobacco withdrawal'),
(897,NULL,'292.85',NULL,'Tobacco-induced sleep disorder'),
(898,NULL,NULL,'F17.208','Tobacco-induced sleep disorder, With moderate or severe use disorder'),
(899,NULL,'307.23','F95.2','Tourette''s disorder'),
(900,NULL,'302.3','F65.1','Transvestic disorder'),
(901,NULL,'312.39','F63.3','Trichotillomania (hair-pulling disorder)'),
(902,NULL,'V63.9','Z75.3','Unavailability or inaccessibility of health care facilities'),
(903,NULL,'V63.8','Z75.4','Unavailability or inaccessibility of other helping agencies'),
(904,NULL,'V62.82','Z63.4','Uncomplicated bereavement'),
(905,NULL,'291.9','F10.99','Unspecified alcohol-related disorder'),
(906,NULL,NULL,'F15.99','Unspecified amphetamine or other stimulant-related disorder'),
(907,NULL,'300','F41.9','Unspecified anxiety disorder'),
(908,NULL,'314.01','F90.9','Unspecified attention-deficit/hyperactivity disorder'),
(909,NULL,'296.8','F31.9','Unspecified bipolar and related disorder'),
(910,NULL,'292.9','F15.99','Unspecified caffeine-related disorder'),
(911,NULL,'292.9','F12.99','Unspecified cannabis-related disorder'),
(912,NULL,'[781.99 +] 293.89','[R29.818 +] F06.1','[Other symptoms involving nervous and musculoskeletal systems +] Unspecified catatonia'),
(913,NULL,NULL,'F14.99','Unspecified cocaine-related disorder'),
(914,NULL,'307.9','F80.9','Unspecified communication disorder'),
(915,NULL,'780.09','R41.0','Unspecified delirium'),
(916,NULL,'311','F32.9','Unspecified depressive disorder'),
(917,NULL,'312.9','F91.9','Unspecified disruptive, impulse-control, and conduct disorder'),
(918,NULL,'300.15','F44.9','Unspecified dissociative disorder'),
(919,NULL,NULL,NULL,'Unspecified elimination disorder'),
(920,NULL,'787.6','R15.9','Unspecified elimination disorder, With fecal symptoms'),
(921,NULL,'788.3','R32','Unspecified elimination disorder, With urinary symptoms'),
(922,NULL,'307.5','F50.9','Unspecified feeding or eating disorder'),
(923,NULL,'302.6','F64.9','Unspecified gender dysphoria'),
(924,NULL,'292.9','F16.99','Unspecified hallucinogen-related disorder'),
(925,NULL,'V60.9','Z59.9','Unspecified housing or economic problem'),
(926,NULL,'780.54','G47.10','Unspecified hypersomnolence disorder'),
(927,NULL,'292.9','F18.99','Unspecified inhalant-related disorder'),
(928,NULL,'780.52','G47.00','Unspecified insomnia disorder'),
(929,NULL,'319','F79','Unspecified intellectual disability (intellectual developmental disorder)'),
(930,NULL,'300.9','F99','Unspecified mental disorder'),
(931,NULL,'294.9','F09','Unspecified mental disorder due to another medical condition'),
(932,NULL,'799.59','R41.9','Unspecified neurocognitive disorder'),
(933,NULL,'315.9','F89','Unspecified neurodevelopmental disorder'),
(934,NULL,'300.3','F42','Unspecified obsessive-compulsive and related disorder'),
(935,NULL,'292.9','F11.99','Unspecified opioid-related disorder'),
(936,NULL,'292.9','F19.99','Unspecified other (or unknown) substance-related disorder'),
(937,NULL,'302.9','F65.9','Unspecified paraphilic disorder'),
(938,NULL,'301.9','F60.9','Unspecified personality disorder'),
(939,NULL,'292.9','F16.99','Unspecified phencyclidine-related disorder'),
(940,NULL,'V62.9','Z60.9','Unspecified problem related to social environment'),
(941,NULL,'V62.9','Z65.9','Unspecified problem related to unspecified psychosocial circumstances'),
(942,NULL,'298.9','F29','Unspecified schizophrenia spectrum and other psychotic disorder'),
(943,NULL,'292.9','F13.99','Unspecified sedative-, hypnotic-, or anxiolytic-related disorder'),
(944,NULL,'302.7','F52.9','Unspecified sexual dysfunction'),
(945,NULL,'780.59','G47.9','Unspecified sleep-wake disorder'),
(946,NULL,'300.82','F45.9','Unspecified somatic symptom and related disorder'),
(947,NULL,'292.9',NULL,'Unspecified stimulant-related disorder'),
(948,NULL,'307.2','F95.9','Unspecified tic disorder'),
(949,NULL,'292.9','F17.209','Unspecified tobacco-related disorder'),
(950,NULL,'309.9','F43.9','Unspecified trauma- and stressor-related disorder'),
(951,NULL,'V61.8','Z62.29','Upbringing away from parents'),
(952,NULL,'V62.89','Z65.4','Victim of crime'),
(953,NULL,'V62.89','Z65.4','Victim of terrorism or torture'),
(954,NULL,'302.82','F65.3','Voyeuristic disorder'),
(955,NULL,'V40.31','Z91.83','Wandering associated with a mental disorder');
-- insert diagnostico consultas
INSERT INTO Diagnostico_consulta VALUES
(1, 346),
(1, 234),
(2, 54),
(3, 391),
(4, 943),
(4, 190),
(5, 149),
(9, 904),
(6, 853),
(7, 490),
(8, 394),
(9, 392);
-- insert medicamentos
INSERT INTO Medicamento VALUES
(1,'ACXION','AP','30 MG','C/30','FENTERMINA',NULL),
(2,'ADEPSIQUE','TAB','10MG','C/30','AMITRIPTILINA. DIAZEPAM. PERFENAZINA',NULL),
(3,'ADEPSIQUE','TAB','10MG','C/90','AMITRIPTILINA. DIAZEPAM. PERFENAZINA',NULL),
(4,'ALZAM','TAB','0.25MG','C/30','ALPRAZOLAM',NULL),
(5,'ALZAM','TAB','0.50MG','C/30','ALPRAZOLAM',NULL),
(6,'ALZAM','TAB','1MG','C/30','ALPRAZOLAM',NULL),
(7,'ALZAM',NULL,'2MG','C/30','ALPRAZOLAM',NULL),
(8,'ANAFRANIL','TAB','25MG','C/30','CLOMIPREMINA',NULL),
(9,'ANAFRANIL RTD','GRAG','75MG','C/10','CLOMIPREMINA',NULL),
(10,'ANAPSIQUE',NULL,'50MG','C/20','AMITRIPTILINA',NULL),
(11,'ANAPSIQUE','TAB','25MG','C/50','AMITRIPTILINA',NULL),
(12,'ASENLIX','CAP','30MG','C/60','CLOBENZOREX',NULL),
(13,'ATIVAN','TAB','2MG','C/80','LORAZEPAM','Ansiolítico'),
(14,'ATIVAN','TAB','1MG','C/80','LORAZEPAM','Ansiolítico'),
(15,'ATIVAN','TAB','2MG','C/40','LORAZEPAM','Ansiolítico'),
(16,'ATIVAN','TAB','2MG','C/80','LORAZEPAM','Ansiolítico'),
(17,'ATIVAN',NULL,'1MG','C/40','LORAZEPAM','Ansiolítico'),
(18,'BROSPINA','AMP','0.3MG','C/6','BUPRENORFINA','Analgésico narcótico'),
(19,'BUFIGEN','AMP','10MG/1ML','C/5','NALBUFINA','Analgésico y adyuvante anestésico'),
(20,'BUFIGEN',NULL,'100MG/10ML',NULL,'NALBUFINA','Analgésico y adyuvante anestésico'),
(21,'CARBOLIT LC','TAB','300MG','C/50','CARBONATO DE LITIO',NULL),
(22,'CARBOLIT LC','TAB','450MG','C/50','CARBONATO DE LITIO',NULL),
(23,'CARBOLIT','TAB','300MG','C/50','CARBONATO DE LITIO',NULL),
(24,'CLOPSINE','TABS','25MG','C/30','CLOZAPINA',NULL),
(25,'CLOPSINE','TAB','100MG','C/30','CLOZAPINA',NULL),
(26,'CONCERTA','TAB','18MG','C/30','METILFENIDATO','Tratamiento para el trastorno de Deficit de atención con Hiperactividad'),
(27,'CONCERTA','TAB','36MG','C/30','METILFENIDATO','Tratamiento para el trastorno de Deficit de atención con Hiperactividad'),
(28,'CONCERTA','TAB','27MG','C/30','METILFENIDATO','Tratamiento para el trastorno de Deficit de atención con Hiperactividad'),
(29,'CONCERTA','TAB','54MG','C/30','METILFENIDATO','Tratamiento para el trastorno de Deficit de atención con Hiperactividad'),
(30,'DIAZEPAM','TAB','10MG','C/20','DIAZEPAM',NULL),
(31,'DORMICUM',NULL,'15MG/3ML','C/5','MIDAZOLAM','Hipnógeno de corta duración'),
(32,'DORMICUM','INY','5MG/5ML','C/5','MIDAZOLAM','Hipnógeno de corta duración'),
(33,'DORMICUM',NULL,'7.5MG','C/30','MIDAZOLAM','Hipnógeno de corta duración'),
(34,'ERGOCAF',NULL,'1/100MG','C/20','ERGOTAMINA Y CAFEINA','Antimigrañoso'),
(35,'ERGOTRATE','INY','0.2MG/1ML','C/6','ERGOMETRINA',NULL),
(36,'ERGOTRATE','TAB','0.2MG','20','ERGOMETRINA',NULL),
(37,'ESBELCAPS','CAP',NULL,'C/30','FENOPROPOREX.DIAZEPAM',NULL),
(38,'FARMAPRAM','TAB','0.25MG','C/30','ALPRAZOLAM','Ansiolítico'),
(39,'FARMAPRAM','TAB','0.50MG','C/30','ALPRAZOLAM','Ansiolítico'),
(40,'FARMAPRAM','TAB','2.0MG','C/30','ALPRAZOLAM','Ansiolítico'),
(41,'FARMAPRAM','TAB','1MG','C/30','ALPRAZOLAM','Ansiolítico'),
(42,'FENABBOTT','TAB','100MG','C/40','FENOBARBITAL',NULL),
(43,'FLUPAZINE',NULL,'5MG','C/30','TRIFLUOPERAZINA',NULL),
(44,'FLUPAZINE','TAB','10MG','C/30','TRIFLUOPERAZINA',NULL),
(45,'FRISIUM',NULL,'10MG','C/30','COMP.(CLOBAZAM)','Ansiolítico'),
(46,'HALCION','TAB','0.125MG','C/30','TRIAZOLAM','Hipnótico'),
(47,'HALCION','TAB','0.25MG','C/30','TRIAZOLAM','Hipnótico'),
(48,'HALOPERIDOL','INY','5MG','C/6','HALOPERIDOL',NULL),
(49,'IFA LOSE','TAB','1MG','C/30','MAZINDOL',NULL),
(50,'IFA LOSE','TAB','2MG','C/30','MAZINDOL',NULL),
(51,'IFA ACXION','TAB','30MG','C/30','FENTERMINA',NULL),
(52,'KRIADEX','TAB','2MG','C/30','CLONAZEPAN','Antiepiléptico'),
(53,'KRIADEX','TAB','2MG','C/60.','CLONAZEPAN','Antiepiléptico'),
(54,'KRIADEX','GTS','2.5MG/1ML',NULL,'CLONAZEPAN','Antiepiléptico'),
(55,'KRIADEX',NULL,'1MG/ML','C/5','CLONAZEPAN','Antiepiléptico'),
(56,'LARGACTIL',NULL,'25MG','C/50','CLORPROMAZINA',NULL),
(57,'LARGACTIL',NULL,'100MG','C/20','CLORPROMAZINA',NULL),
(58,'LEPTOPSIQUE',NULL,'10MG','C/20','PERFENAZINA','Antipsicótico. neuroléptico desinhibidor para uso psiquiátrico.'),
(59,'LEPTOPSIQUE','TAB','4MG','C/30','PERFENAZINA','Antipsicótico. neuroléptico desinhibidor para uso psiquiátrico.'),
(60,'LERTUS',NULL,'50MG',NULL,'DICLOFENACO-CODEINA',NULL),
(61,'LEXOTAN',NULL,'3MG','C/30','BROMAZEPAM','Ansiolítico diurno a dosis menores.'),
(62,'LEXOTAN',NULL,'3MG','C/100','BROMAZEPAM','Ansiolítico diurno a dosis menores.'),
(63,'LEXOTAN',NULL,'6MG','C/30','BROMAZEPAM','Ansiolítico diurno a dosis menores.'),
(64,'LEXOTAN',NULL,'6MG','C/100','BROMAZEPAM','Ansiolítico diurno a dosis menores.'),
(65,'LOZAM','TAB','1MG','C/40','LORAZEPAN',NULL),
(66,'LOZAM','TAB','2MG','C/40','LORAZEPAM',NULL),
(67,'LOZAM','INY','1MG','C/3','LORAZEPAM',NULL),
(68,'LOZAM','INY','1GR','C/10','LORAZEPAM',NULL),
(69,'MIOLASTAN',NULL,'25MG','C/20','TETRAZEPAM',NULL),
(70,'MOTIVAL','TAB','10MG/0.5MG','C/60','NORTRIPTILINA.FLUFENAZINA','Tranquilizante y estabilizador emocional.'),
(71,'MZ1','TAB','1MG','C/30','MAZINDOL',NULL),
(72,'NEOBES','CAP','75MG','C/30','ANFEPRAMONA',NULL),
(73,'NEOTREX','CAP','10MG','C/30','ISOTRETINOÍNA',NULL),
(74,'NEOTREX','CAP','20MG','C/30','ISOTRETINOÍNA',NULL),
(75,'NEUPAX','TAB','0.25MG','C/30','ALPRAZOLAM','Ansiolítico.'),
(76,'NEUPAX','TAB','0.50MG','C/30','ALPRAZOLAM','Ansiolítico.'),
(77,'NEUPAX','TAB','0.50MG','C/90','ALPRAZOLAM','Ansiolítico.'),
(78,'NEUPAX','TAB','2MG','C/30','ALPRAZOLAN','Ansiolítico.'),
(79,'NEUPAX','TAB','1MG','C/30','ALPRAZOLAN','Ansiolítico.'),
(80,'NEUPAX','SUBLIN','50MG','C/15','ALPRAZOLAN','Ansiolítico.'),
(81,'NEUPAX','DUO S','0.25/50MG','C/30','ALPRAZOLAN','Ansiolítico.'),
(82,'NEUPAX','SOL GTAS','0.75NG/ML',NULL,'ALPRAZOLAN','Ansiolítico.'),
(83,'NITREST','TAB','10MG','C/10','ZOLPIDEM','Hipnótico de corta duración.'),
(84,'NOCTE','TAB','10MG','C/10','ZOLPIDEM','Hipnótico de corta duración.'),
(85,'NOCTE','TAB','10MG','C/30','ZOLPIDEM','Hipnótico de corta duración.'),
(86,'NUMENCIAL',NULL,'50/2.5MG','C/30','SULPIRIDA. DIAZEPAM','Ansiolítico y antidepresivo. Regulador emocional. coadyuvante de padecimientos psicosomáticos.'),
(87,'OBECLOX','CAP','30MG','C/30','CLOBENZOREX',NULL),
(88,'ORATANE','CAP','20MG','C/30','ISOTRETINOINA',NULL),
(89,'ORATANE','CAP','20MG','C/30','ISOTRETINOINA',NULL),
(90,'ORTOPSIQUE','TAB','10MG','C/20','DIAZEPAM',NULL),
(91,'ORTOPSIQUE','INY','10MG/2ML','C/5','DIAZEPAM',NULL),
(92,'OTEDRAM','TAB','3MG','C/30','BROMAZEPAM',NULL),
(93,'PANAZECLOX','SOL GTS',NULL,NULL,'CLONAZEPAM',NULL),
(94,'PANAZECLOX','TAB','2MG','C/30','CLONAZEPAM',NULL),
(95,'PANAZECLOX','TAB','2MG','C/100','CLONAZEPAM',NULL),
(96,'PISALPRA','TAB','0.25MG','C/30','ALPRAZOLAM',NULL),
(97,'PISALPRA','TAB','0.50MG','C/30','ALPRAZOLAM',NULL),
(98,'PISALPRA',NULL,'2MG','C/30','ALPRAZOLAM',NULL),
(99,'PONTIRIDE',NULL,'200MG','C/20','SULPIRIDA',NULL),
(100,'PONTIRIDE','TAB','50MG','C/50','SULPIRIDA',NULL),
(101,'QUAL','TAB',NULL,'C/20','PARACETAMOL. DEXTROPROPOXIFENO. DIAZEPAM','Analgésico. tranquilizante.'),
(102,'REDOTEX','CAP',NULL,'C/30','CLORHIDRATO DE D-NORPSEUDOEFEDRINA. TRIYODOTIRONINA SODICA. SULFATO DE ATROPINA. ALOÍNA. DIAZEPAM',NULL),
(103,'REDOTEX','CAP',NULL,'C/30','CLORHIDRATO DE D-NORPSEUDOEFEDRINA. TRIYODOTIRONINA SODICA. SULFATO DE ATROPINA. ALOÍNA. DIAZEPAM',NULL),
(104,'REFRACTYL','SOL GTS','5ML','0.01','CICLOPENTOLATO',NULL),
(105,'RELACUM',NULL,'5MG/5ML',NULL,'MIDAZOLAM','Sedante-hiptótico.'),
(106,'RELAZEPAM',NULL,'10MG/2ML','C/6','DIAZEPAM',NULL),
(107,'RITALIN','TAB','10MG','C/30','CLORHIDRATO DE METOLFENIDATO','Tratamiento para el trastorno de Deficit de atención con Hiperactividad'),
(108,'RITALIN','CPR','10MG','C60','CLORHIDRATO DE METOLFENIDATO','Tratamiento para el trastorno de Deficit de atención con Hiperactividad'),
(109,'RITALIN LA','CAP','20MG','C/30','CLORHIDRATO DE METOLFENIDATO','Estimulante del Sistema nervioso central'),
(110,'RITALIN LA','CAP','30MG','C/30','CLORHIDRATO DE METOLFENIDATO','Estimulante del Sistema nervioso central'),
(111,'RITALIN LA','CAP','40MG','C30','CLORHIDRATO DE METOLFENIDATO','Estimulante del Sistema nervioso central'),
(112,'RIVOTRIL',NULL,'2MG','C/30','CLONAZEPAM','Antiepiléptico.'),
(113,'RIVOTRIL',NULL,'2MG','C/100','CLONAZEPAN','Antiepiléptico.'),
(114,'RIVOTRIL','GTS','2.5MG/10ML',NULL,'CLONAZEPAN','Antiepiléptico.'),
(115,'RIVOTRIL',NULL,'0.5MG','C/30','CLONAZEPAN','Antiepiléptico.'),
(116,'ROACCUTAN','CAP','20MG','C/30','ISOTRETINOÍNA',NULL),
(117,'ROACCUTAN',NULL,'10MG',NULL,'ISOTRETINOINA',NULL),
(118,'SINOGAN','INY','25MG','C/10','LEVOMEPROMAZINA','Neuropléjico. neuroléptico sedativo. ansiolítico. hipnógeno y analgésico.'),
(119,'SINOGAN',NULL,'25MG','C/20','LEVOMEPROMAZINA','Neuropléjico. neuroléptico sedativo. ansiolítico. hipnógeno y analgésico.'),
(120,'SOLORO','PARCHES','7',NULL,'BUPRENORFINA',NULL),
(121,'SOLORO','PARCHES','7','PARCHE','BUPRENORFINA',NULL),
(122,'SOLUCAPS','CAP','2MG','C/30','MAZINDOL',NULL),
(123,'STELABID','GRAG','1MG','C/25','ISOPROPAMIDA',NULL),
(124,'STELAZINE','GRAG','5MG','C/30','TRIFLUOPERAZINA','Neurolíptico.'),
(125,'STILNOX','TAB','6.25M','C/14','ZOLPIDEM','Tratamiento del insomnio.'),
(126,'STILNOX','TAB','12.5M','C/14','ZOLPIDEM','Tratamiento del insomnio.'),
(127,'STILNOX','TAB','12.5M','C/28','ZOLPIDEM','Tratamiento del insomnio.'),
(128,'STILNOX','TAB','10MG','C/10','ZOLPIDEM','Tratamiento del insomnio.'),
(129,'STILNOX','TAB','10MG','C/30','ZOLPIDEM','Tratamiento del insomnio.'),
(130,'SYDOLIL','TAB','1/50MG','C/36','ERGOTAMINA. CAFEÍNA. ACIDO ACETILSALICILICO','Antimigrañoso.'),
(131,'TAFIL','TAB','0.25MG','C/30','ALPRAZOLAM','Tranquilizante indicado en estados de ansiedad. Útil en el tratamiento agudo de crisis de angustia (pánico).'),
(132,'TAFIL','TAB','0.25MG','C/90','ALPRAZOLAM','Tranquilizante indicado en estados de ansiedad. Útil en el tratamiento agudo de crisis de angustia (pánico).'),
(133,'TAFIL','TAB','0.50MG','C/30','ALPRAZOLAM','Tranquilizante indicado en estados de ansiedad. Útil en el tratamiento agudo de crisis de angustia (pánico).'),
(134,'TAFIL','TAB','0.50MG','C/90','ALPRAZOLAM','Tranquilizante indicado en estados de ansiedad. Útil en el tratamiento agudo de crisis de angustia (pánico).'),
(135,'TAFIL','TAB','1MG','C/30','ALPRAZOLAM','Tranquilizante indicado en estados de ansiedad. Útil en el tratamiento agudo de crisis de angustia (pánico).'),
(136,'TAFIL','TAB','1MG','C/90','ALPRAZOLAM','Tranquilizante indicado en estados de ansiedad. Útil en el tratamiento agudo de crisis de angustia (pánico).'),
(137,'TAFIL','TAB','2MG','C/30','ALPRAZOLAM','Tranquilizante indicado en estados de ansiedad. Útil en el tratamiento agudo de crisis de angustia (pánico).'),
(138,'TAFIL','TAB','1MG','C/30','ALPRAZOLAM','Tranquilizante indicado en estados de ansiedad. Útil en el tratamiento agudo de crisis de angustia (pánico).'),
(139,'TAFIL','GTS','20ML',NULL,'ALPRAZOLAM','Tranquilizante indicado en estados de ansiedad. Útil en el tratamiento agudo de crisis de angustia (pánico).'),
(140,'TAFIL','TAB','0.5MG','C/30','ALPRAZOLAM','Tranquilizante indicado en estados de ansiedad. Útil en el tratamiento agudo de crisis de angustia (pánico).'),
(141,'TALPRAMIN','TAB','25MG','C/20','IMIPRAMINA',NULL),
(142,'TASEDAN','TAB','2MG','C/60','ESTAZOLAM','Tranquilizante. Inductor del sueño.'),
(143,'TAZUN','TAB','0.25G','C/30','ALPRAZOLAM','Ansiolítico.'),
(144,'TEMGESIC',NULL,'0.3MG/1ML','C/6','BUPRENORFINA',NULL),
(145,'TEMGESIC','TAB SUBLINGUAL',NULL,'C/10','BUPRENORFINA',NULL),
(146,'TERFAMEX',NULL,'15MG','C/30','FENTERMINA',NULL),
(147,'TERFAMEX','CAPS','30MG','C/30','FENTERMINA',NULL),
(148,'TOFRANIL','GRAG','10MG','C/60','IMIPRAMINA',NULL),
(149,'TOFRANIL','GRAG','25MG','C/20','IMIPRAMINA',NULL),
(150,'TOLVON','TAB','30MG','C/10','MIANSERINA','Antidepresivo.'),
(151,'TORANTSITA','TAB','0.5MG','C/30','ALPRAZOLAM','Antidepresivo.'),
(152,'TORANTSITA','TAB','0.25','C/30','ALPRAZOLAM','Antidepresivo.'),
(153,'TRADEA','TAB','20MG','C/30','METILFENIDATO',NULL),
(154,'TRADEA','TAB','54MG','C/30','METILFENIDATO',NULL),
(155,'TRADEA','TAB','10MG','C/30','METILFENIDATO',NULL),
(156,'TRADEA','TAB','10MG','C/60','METILFENIDATO',NULL),
(157,'TRADEA',NULL,'36MG','C/30','METILFENIDATO',NULL),
(158,'TRANSTEC','PARCHES','52.5MCG/H 30MG','C/4','BUPRENORFINA','Analgésico opioide semisintético.'),
(159,'TRANSTEC','PARCHES','35MCG/H','C/20','BUPRENORFINA','Analgésico opioide semisintético.'),
(160,'TRANXENE','CAP','5MG','C/30','CLORAZEPATO DIPOTASICO','Ansiolítico sedante.'),
(161,'TRANXENE',NULL,'10MG','C/30','CLORAZEPATO DIPOTASICO','Ansiolítico sedante.'),
(162,'TREVISSAGE','CAP','10MG','C/30','ISOTRETINOINA',NULL),
(163,'TREVISSAGE','CAP','20MG','C/30','ISOTRETINOINA',NULL),
(164,'TRYPTANOL','GRAG','25MG','C/50','AMITRIPTILINA',NULL),
(165,'TYLEX','CAP CD','500MG','C/30','PARACETAMOL','Analgésico no narcotico. antipirético.'),
(166,'VALIUM',NULL,'10MG','C/20','DIAZEPAM','Ansiolítico. tensiolítico. sedante. hipnógeno. miorrelajante. estabilizador neurovegetativo.'),
(167,'VALIUM',NULL,'10MG','C/90','DIAZEPAM','Ansiolítico. tensiolítico. sedante. hipnógeno. miorrelajante. estabilizador neurovegetativo.'),
(168,'VALIUM',NULL,'10MG','C/5','DIAZEPAM','Ansiolítico. tensiolítico. sedante. hipnógeno. miorrelajante. estabilizador neurovegetativo.'),
(169,'VICTAN',NULL,'2MG','C/30','LOFLAZEPATO DE ETILO','Ansiolítico.');
-- insert recetas
insert into receta (idReceta, idConsulta, idMedicamento) values (1, 3, 1);
insert into receta (idReceta, idConsulta, idMedicamento) values (2, 5, 4);
insert into receta (idReceta, idConsulta, idMedicamento) values (3, 4, 140);
insert into receta (idReceta, idConsulta, idMedicamento) values (4, 5, 129);
insert into receta (idReceta, idConsulta, idMedicamento) values (5, 7, 49);
insert into receta (idReceta, idConsulta, idMedicamento) values (6, 8, 3);
insert into receta (idReceta, idConsulta, idMedicamento) values (7, 9, 1);
insert into receta (idReceta, idConsulta, idMedicamento) values (8, 4, 1);
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.