text
stringlengths
6
9.38M
Set @num1=1; set @num2=1; select group_concat(number1 separator '&') from (select number1 from (select number1, case when number1%number2=0 then 1 else 0 end as divisor from (select @num1:=@num1+1 number1 from information_schema.tables t1,information_schema.tables t2 where @num1<1000) a, (select @num2:=@num2+1 number2 from information_schema.tables t3,information_schema.tables t4 where @num2<1000) b where number2<=number1 order by number1) c group by number1 having sum(divisor)=1) e ;
create table tornus_users ( id serial not null primary key, user_name varchar not null unique, visible_name varchar not null unique, state varchar not null, user_type varchar not null, data_auth jsonb, data jsonb, last_login timestamp with time zone, created_at timestamp with time zone not null default now(), updated_at timestamp with time zone not null default now(), created_by integer not null, updated_by integer not null, version integer not null default 0 ); insert into tornus_users (id, user_name, visible_name, state, user_type, created_by, updated_by) values (1, 'system', 'System', 'system', 'system', 1, 1); alter table tornus_users add constraint fk_tornus_users_created foreign key (created_by) references tornus_users(id); alter table tornus_users add constraint fk_tornus_users_updated foreign key (updated_by) references tornus_users(id); create unique index idx_tornus_users_name on tornus_users(user_name); create unique index idx_tornus_users_visible_name on tornus_users(visible_name); create table tornus_groups ( id serial not null primary key, group_name varchar not null unique, state varchar not null, data jsonb, created_at timestamp with time zone not null default now(), updated_at timestamp with time zone not null default now(), created_by integer not null references tornus_users, updated_by integer not null references tornus_users, version integer not null default 0 ); create unique index idx_tornus_groups on tornus_groups(group_name); create table tornus_groups_users ( id serial not null primary key, group_id integer not null references tornus_groups, user_id integer not null references tornus_users, created_at timestamp with time zone not null default now(), updated_at timestamp with time zone not null default now(), created_by integer not null references tornus_users, updated_by integer not null references tornus_users, version integer not null default 0 ); create unique index idx_tornus_groups_users on tornus_groups_users(group_id, user_id); create table tornus_compos ( path varchar not null primary key, parent_path varchar, parent_order integer not null default 0, klass varchar not null, data jsonb not null, title varchar not null, description varchar, created_at timestamp with time zone not null default now(), updated_at timestamp with time zone not null default now(), created_by integer not null references tornus_users, updated_by integer not null references tornus_users, version integer not null default 0 ); create index idx_tornus_compos_klass on tornus_compos(klass); create index idx_tornus_compos_parent on tornus_compos(parent_path); alter table tornus_compos add constraint fk_tornus_compos_parent foreign key (parent_path) references tornus_compos(path); insert into tornus_compos (path, klass, data, title, description, created_by, updated_by) values ('app', 'App', '{"title":"Tornus.1"}', 'Application', '', 1, 1); insert into tornus_compos (parent_path, path, klass, data, title, description, created_by, updated_by) values ('app', 'app/admin', 'Module', '{"title":"Admin", "description":"Administration features"}', 'Admin', 'Administration features', 1, 1); create table tornus_sessions ( id serial not null primary key, ses_token varchar not null unique, ip varchar not null, agent varchar not null, login_at timestamp with time zone, user_id integer references tornus_users, logout_at timestamp with time zone, expires_at timestamp with time zone, expired boolean, data jsonb, created_at timestamp with time zone not null default now(), updated_at timestamp with time zone not null default now(), created_by integer not null references tornus_users default 1, updated_by integer not null references tornus_users default 1, version integer not null default 0 ); create unique index idx_unique_tornus_sessions_ses_token on tornus_sessions(ses_token); create index idx_unique_tornus_sessions_expires on tornus_sessions(expires_at); create index idx_unique_tornus_sessions_user on tornus_sessions(user_id); create table tornus_audit ( id serial not null primary key, request_at timestamp with time zone not null default now(), response_at timestamp with time zone, elapsed int, request jsonb, status varchar not null, response jsonb, error_info jsonb, user_id integer references tornus_users, session_id integer references tornus_sessions, target varchar, verb varchar, subject jsonb, table_name varchar, table_id integer, change jsonb, before jsonb ); create index idx_unique_tornus_audit_request on tornus_audit(request_at); create index idx_unique_tornus_audit_response on tornus_audit(response_at); create index idx_unique_tornus_audit_status on tornus_audit(status); create index idx_unique_tornus_audit_user on tornus_audit(user_id); create index idx_unique_tornus_audit_session on tornus_audit(session_id); create index idx_unique_tornus_audit_target on tornus_audit(target); create index idx_unique_tornus_audit_verb on tornus_audit(verb); create index idx_unique_tornus_audit_table on tornus_audit(table_name); create index idx_unique_tornus_audit_table_id on tornus_audit(table_id); create table tornus_mold ( path varchar not null primary key, klass varchar not null, data jsonb not null, title varchar not null ); create index idx_tornus_compos_klass on tornus_compos(klass);
-- -- Table structure for table `bnd` -- DROP TABLE IF EXISTS `bnd`; CREATE TABLE `bnd` ( `id` int(10) unsigned NOT NULL auto_increment, `gilde` int(10) unsigned NOT NULL, `bnd` int(10) unsigned NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM; -- -- Table structure for table `gilde` -- DROP TABLE IF EXISTS `gilde`; CREATE TABLE `gilde` ( `id` int(10) unsigned NOT NULL auto_increment, `gildenname` varchar(30) NOT NULL, `pass` varchar(30) NOT NULL, `master_pass` varchar(30) NOT NULL, `server` varchar(20) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM; -- -- Table structure for table `logs` -- DROP TABLE IF EXISTS `logs`; CREATE TABLE `logs` ( `id` int(10) unsigned NOT NULL auto_increment, `server` varchar(20) NOT NULL, `gilde` varchar(30) NOT NULL, `besitzer` varchar(30) NOT NULL, `datum` datetime NOT NULL, `user` varchar(30) NOT NULL, `see` text NOT NULL, `land` text NOT NULL, `typ` tinyint(1) NOT NULL, `see_off` int(10) unsigned NOT NULL default '0', `see_deff` int(10) unsigned NOT NULL default '0', `see_bev` int(10) unsigned NOT NULL default '0', `see_verluste` int(10) unsigned NOT NULL, `land_off` int(10) unsigned NOT NULL default '0', `land_deff` int(10) unsigned NOT NULL default '0', `land_bev` int(10) unsigned NOT NULL default '0', `land_verluste` int(10) unsigned NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM;
-- phpMyAdmin SQL Dump -- version 5.0.4 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Generation Time: Mar 13, 2021 at 05:23 AM -- Server version: 10.4.17-MariaDB -- PHP Version: 8.0.2 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; START TRANSACTION; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8mb4 */; -- -- Database: `classroom` -- -- -------------------------------------------------------- -- -- Table structure for table `classroom` -- CREATE TABLE `classroom` ( `classroom_id` int(11) NOT NULL, `classroom_no` int(11) NOT NULL, `student_id` int(11) NOT NULL, `no1` int(11) DEFAULT NULL, `date1` int(11) DEFAULT NULL, `no2` int(11) DEFAULT NULL, `date2` timestamp NULL DEFAULT NULL, `no3` int(11) DEFAULT NULL, `date3` timestamp NULL DEFAULT NULL, `no4` int(11) DEFAULT NULL, `date4` timestamp NULL DEFAULT NULL, `no5` int(11) DEFAULT NULL, `date5` timestamp NULL DEFAULT NULL, `no6` int(11) DEFAULT NULL, `date6` timestamp NULL DEFAULT NULL, `no7` int(11) DEFAULT NULL, `date7` timestamp NULL DEFAULT NULL, `no8` int(11) DEFAULT NULL, `date8` timestamp NULL DEFAULT NULL, `no9` int(11) DEFAULT NULL, `date9` timestamp NULL DEFAULT NULL, `no10` int(11) DEFAULT NULL, `date10` timestamp NULL DEFAULT NULL, `no11` int(11) DEFAULT NULL, `date11` timestamp NULL DEFAULT NULL, `no12` int(11) DEFAULT NULL, `date12` timestamp NULL DEFAULT NULL, `no13` int(11) DEFAULT NULL, `date13` timestamp NULL DEFAULT NULL, `no14` int(11) DEFAULT NULL, `date14` timestamp NULL DEFAULT NULL, `no15` int(11) DEFAULT NULL, `date15` timestamp NULL DEFAULT NULL, `no16` int(11) DEFAULT NULL, `date16` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -------------------------------------------------------- -- -- Table structure for table `student` -- CREATE TABLE `student` ( `id` int(4) NOT NULL, `title` int(1) NOT NULL, `first_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `last_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `student_id` varchar(13) COLLATE utf8_unicode_ci NOT NULL, `student_no` int(3) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -- Dumping data for table `student` -- INSERT INTO `student` (`id`, `title`, `first_name`, `last_name`, `student_id`, `student_no`) VALUES (1, 1, 'กัญญารัตน์', 'สร้อยสัมฤทธิ์', '1160102060028', 1), (2, 2, 'ไววิทย์', 'สาธุธรรม', '1160102060044', 2), (3, 3, 'ศิวภัทร ', 'พูลศิลป์', '1160102060051', 3), (4, 4, 'กรรณิการ์', 'ุพันธ์ชมภู', '1160102060077', 4), (5, 5, 'ธวัลพร', 'ชื่นเพ็ง', '1160102060101', 5), (6, 6, 'ศุภกานต์', 'จิตประไพ', '1160102060119', 6), (7, 7, 'โสภณวิชญ์', 'เนระแก', '1160102060127', 7), (8, 8, 'นพรัตน์', 'อำพันศรี', '1160102060135', 8), (9, 9, 'เบญญาภา', 'บุญยง', '1160102060143', 9), (10, 10, 'อมรา', 'อมรึก', '1160102060150', 10), (11, 11, 'สรวิชญ์', 'เกตุศีระ', '1160102060169', 11), (12, 12, 'ธนวัฒน์ ', 'แนบชัยภูมิ', '1160102060176', 12), (13, 13, 'ศุภรักษ์', 'อุดมแก้ว', '1160102060184', 13), (14, 14, 'ณัฏฐณิชา', 'ทะเสนฮด', '1160102060192', 14), (15, 15, 'วีรภัทร', 'รอดสิน', '1160102060218', 15), (16, 16, 'ภาคภูมิ', 'เงินสมบัติ', '1160102060226', 16), (17, 17, 'วิชิต', 'คชสุวรรณ', '1160102060234', 17), (18, 18, 'กนกวรรณ', 'พ่วงศร', '1160102060259', 18), (19, 19, 'นราธิป', 'พุฒิเสถียร', '1160102060267', 19), (20, 20, 'พรธิรา ', 'ดวงพายัพ', '1160102060275', 20), (21, 21, 'อนุชา', 'อินทร์ประเทือง', '1160102060309', 21), (22, 22, 'ณัฐมล', 'ไม้ฝาก', '1160102060317', 22), (23, 23, 'สหรัฐ', 'ร่มไทรทอง', '1160102060333', 23), (24, 24, 'ศิวกร', 'คุณากันต์', '1160102060341', 24), (25, 25, 'ธารา', 'ผลอุดม', '1160102060358', 25), (26, 26, 'จิรัฐติพล', 'นาคทองดี', '1160102060366', 26), (27, 27, 'ปวรุตม์', 'บุตรจันทรํ', '1160102060374', 28), (29, 29, 'ณัฐกานต์', 'ทองสุทธิ์', '1160102060382', 29), (30, 30, 'นพพล', 'และนุช', '1160102060390', 30), (31, 31, 'ธีรพงษ์', 'บัวสุวรรณ', '1160102060408', 31), (32, 32, 'ธนกร', 'กลางอรัญ', '1160102060424', 32), (33, 33, 'ธนวัฒน์', 'รจนาสม', '1160102060432', 33), (34, 34, 'วันใหม่', 'ศุภราทิตย์', '1160102060440', 34), (35, 35, 'ณัฐพจน์', 'จันทร์รอด', '1160102060457', 35); -- -------------------------------------------------------- -- -- Table structure for table `subject` -- CREATE TABLE `subject` ( `id_subject` int(3) NOT NULL, `number_subject` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `teacher_number` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `subject_name` text COLLATE utf8_unicode_ci NOT NULL, `class_room` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `class_time` datetime NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -- Dumping data for table `subject` -- INSERT INTO `subject` (`id_subject`, `number_subject`, `teacher_number`, `subject_name`, `class_room`, `class_time`) VALUES (1, '023223201', '1', 'การสนับสนุนทางเทคนิค', 'ห้องปฏิบัติการคอมพิวเตอร์ ศษ2-304', '0000-00-00 00:00:00'), (2, '023214151', '2', 'โครงงานเทคโนโลยีสารสนเทศการศึกษา', 'ห้องบรรยาย ศษ2-306', '0000-00-00 00:00:00'), (3, '023233071', '3', 'เทคโนโลยีมัลติมีเดียและเเอนิเมชั่น', 'ห้องปฏิบัติการคอมพิวเตอร์ ศษ2-308', '0000-00-00 00:00:00'); -- -------------------------------------------------------- -- -- Table structure for table `teacher` -- CREATE TABLE `teacher` ( `teacher_id` int(4) NOT NULL, `title` int(1) NOT NULL, `first_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `last_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `subject` int(1) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -- Dumping data for table `teacher` -- INSERT INTO `teacher` (`teacher_id`, `title`, `first_name`, `last_name`, `subject`) VALUES (1, 1, 'ดร.กิติภูมิ', 'วิภาหัสน์', 23223201), (2, 2, 'ดร.ปริญญา', 'บรรณเภสัช', 23214151), (3, 3, 'ผศ.ดร.ปิยนันท์', 'ปานนิ่ม', 23233071); -- -- Indexes for dumped tables -- -- -- Indexes for table `classroom` -- ALTER TABLE `classroom` ADD PRIMARY KEY (`classroom_id`); -- -- Indexes for table `student` -- ALTER TABLE `student` ADD PRIMARY KEY (`id`); -- -- Indexes for table `subject` -- ALTER TABLE `subject` ADD PRIMARY KEY (`id_subject`); -- -- Indexes for table `teacher` -- ALTER TABLE `teacher` ADD PRIMARY KEY (`teacher_id`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `classroom` -- ALTER TABLE `classroom` MODIFY `classroom_id` int(11) NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `student` -- ALTER TABLE `student` MODIFY `id` int(4) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=36; -- -- AUTO_INCREMENT for table `subject` -- ALTER TABLE `subject` MODIFY `id_subject` int(3) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; -- -- AUTO_INCREMENT for table `teacher` -- ALTER TABLE `teacher` MODIFY `teacher_id` int(4) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; COMMIT; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
SELECT NAME FROM STUDENTS WHERE MARKS > 75 ORDER BY SUBSTR(NAME, -3) ASC, ID ASC;
use native_db; CREATE TABLE IF NOT EXISTS `saved_searches` ( `id` int(10) primary key NOT NULL AUTO_INCREMENT, `user_id` int(10) NOT NULL, `content_id` int(10) NOT NULL, `createdAt` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `updatedAt` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' );
select starttime from cd.bookings WHERE memid = (SELECT memid FROM cd.members WHERE surname ILIKE '%farrell' AND firstname ILIKE '%david')
DELETE FROM reservation; DELETE FROM lending ; DELETE FROM books; DELETE FROM books_reservation; INSERT INTO books_reservation( id, next_return_date, number, possible) VALUES (-1, '2020-01-15 14:00:00' ,0, 60), (-2,'2020-01-15 14:00:00' , 2, 60), (-3, '2020-01-15 14:00:00', 2, 60), (-4, '2020-01-15 14:00:00', 2, 60), (-5, '2020-01-15 14:00:00', 60, 60), (-6, '2020-01-15 14:00:00' , 3, 60), (-7, '2020-01-15 14:00:00' , 0, 60); INSERT INTO books( id_book_reservation,id, availability, id_cover, isbn, review, summary, title, id_author,id_coauthor, id_edition, id_language, id_theme) VALUES (-1,-1, 0, 'a0841cf1-1fe9-4bc0-8c9c-377b70bcc848', '9782409001000', 30, 'Initiation, exemples et exercices corrigés', 'UML 2.5', 3,2, 1, 1, 3), (-2,-2, 3, '4a66b149-2b77-49e2-a49c-2250c4275890', '9782409005824', 30, 'Apprenez le mapping objet-relationnel (ORM) avec Java', 'JPA et Java Hibernate', 1,null, 1, 1, 3), (-3,-3, 0, '1cb6e756-f073-4cb8-a37e-aa462845b670', '9782409013843', 30, 'Le socle technique des applications Java EE', 'Java Spring', 5,null, 1, 1, 3), (-4,-4, 0, 'be863f03-d00e-443b-aab2-b625dc2ef5d0', '9782409014499', 30, 'Construisez vos applications réactives avec une architecture micro-services en environnement Java EE', 'Java Spring', 5,null, 1, 1, 3), (-5,-5, 0, 'b1d08817-1122-483c-a8fc-8a524a665f36', '9782746065093', 30, 'Maîtrisez l infrastructure d un projet Java EE ', 'Apache Maven', 6,null, 1, 1, 3), (-6,-6, 0, '6e0a0725-736a-4a54-9520-5b250af89321', '9782746090170', 30, 'Echanger des données au format JSON', 'Développer des services REST en Java', 7,null, 1, 1, 3), (-7,-7, 10, '796b17f6-699f-43e4-837e-bfa51c161cc5', '9782746092150', 30, 'Concepts et implémentation en C#', 'L intelligence Artificielle pour les développeurs', 4,null, 1, 1, 3); INSERT INTO lending( id, end_date, id_user, renewal, return_date, start_date, id_books) VALUES (-1, '2019-12-29 14:00:00', -1, 0, null , '2019-12-01 14:00:00', -1), (-2, '2020-01-30 14:00:00', -1, 0, null , '2020-01-02 14:00:00', -2); INSERT INTO reservation( id, id_user_reservation, notification_date, reservation_date, state, id_books) VALUES (-1, -2, null, '2019-12-16 09:00:00', 'En cours', -1), (-2, -3, null, '2019-12-16 10:00:00', 'En cours', -1), (-3, -3, null, '2019-12-16 11:00:00', 'En cours', -2), (-4, -2, null, '2019-12-16 12:00:00', 'En cours', -2), (-5, -1, null, '2019-12-15 12:00:00', 'En cours', -3), (-6, -2, null, '2019-12-16 12:00:00', 'En cours', -3), (-7, -2, null, '2019-12-15 12:00:00', 'En cours', -4), (-9, -1, '2019-12-05 12:00:00', '2019-12-09 12:00:00', 'En cours', -6), (-10, -2, null, '2019-12-10 12:00:00', 'En cours', -6), (-11, -3, null, '2019-12-11 12:00:00', 'En cours', -6);
DROP DATABASE IF EXISTS sge; CREATE database sge; connect sge; CREATE TABLE imobiliaria ( id INT NOT NULL AUTO_INCREMENT, nome VARCHAR(50) NOT NULL, cpf VARCHAR(14) NOT NULL UNIQUE, senha VARCHAR(8) NOT NULL, PRIMARY KEY (id) ); CREATE TABLE morador ( id INT NOT NULL AUTO_INCREMENT, nome VARCHAR(50) NOT NULL, cpf VARCHAR(14) NOT NULL UNIQUE, telefone VARCHAR(20) NOT NULL, endereco VARCHAR(100) NOT NULL, recebe INT NOT NULL, excluido INT NOT NULL, senha VARCHAR(8) NOT NULL, PRIMARY KEY (id) ); CREATE TABLE encomenda ( id INT NOT NULL AUTO_INCREMENT, nome VARCHAR(50) NOT NULL, cadastrada_morador_id INT NOT NULL, entregador_id INT NOT NULL, data_cadastro TIMESTAMP NOT NULL, previsao_data_entrega TIMESTAMP NULL, foi_entregue INT NOT NULL, entregador_pegou INT NOT NULL, excluido INT NOT NULL, PRIMARY KEY (id), FOREIGN KEY (cadastrada_morador_id) REFERENCES morador (id), FOREIGN KEY (entregador_id) REFERENCES morador (id) ); CREATE TABLE historico_entrega ( id INT NOT NULL AUTO_INCREMENT, morador_entrega_id INT NOT NULL, morador_recebe_id INT NOT NULL, encomenda_id INT NOT NULL UNIQUE, data_entrega TIMESTAMP NOT NULL, cod_entrega VARCHAR(50) NOT NULL, PRIMARY KEY (id), FOREIGN KEY (morador_entrega_id) REFERENCES morador (id), FOREIGN KEY (morador_recebe_id) REFERENCES morador (id), FOREIGN KEY (encomenda_id) REFERENCES encomenda (id) ); CREATE TABLE entrega_realizada ( id INT NOT NULL AUTO_INCREMENT, morador_entrega_id INT NOT NULL, qnt_entregas INT NOT NULL, PRIMARY KEY (id), FOREIGN KEY (morador_entrega_id) REFERENCES morador (id) ); CREATE TABLE valor_entrega ( id INT NOT NULL AUTO_INCREMENT, valor_base_por_entrega DECIMAL(18,2) NOT NULL, PRIMARY KEY (id) ); CREATE TABLE area_do_site( id INT NOT NULL AUTO_INCREMENT, nome_pagina VARCHAR(255) NOT NULL, ativa INT NOT NULL, PRIMARY KEY (id) ); CREATE TABLE autorizacao_usuario( morador_id INT NOT NULL, area_do_site_id INT NOT NULL, FOREIGN KEY (morador_id) REFERENCES morador (id), FOREIGN KEY (area_do_site_id) REFERENCES area_do_site (id) ); INSERT INTO morador (id, nome, cpf, telefone, endereco, recebe, excluido, senha) VALUES (1, '1 recebedor', 1, 1, 1, 1, 0, 1); INSERT INTO morador (id, nome, cpf, telefone, endereco, recebe, excluido, senha) VALUES (2, '2 recebedor', 2, 2, 2, 1, 0, 2); INSERT INTO morador (id, nome, cpf, telefone, endereco, recebe, excluido, senha) VALUES (3, '3 morador', 3, 3, 3, 0, 0, 3); INSERT INTO morador (id, nome, cpf, telefone, endereco, recebe, excluido, senha) VALUES (4, '4 morador', 4, 4, 4, 0, 0, 4); INSERT INTO valor_entrega (id, valor_base_por_entrega) VALUES (1, 1.00);
CREATE TABLE userinfo(name VARCHAR(16) NOT NULL PRIMARY KEY,password VARCHAR(16) NOT NULL) insert into userinfo values ('test','9981') insert into userinfo values ('ace','5598') insert into userinfo values ('first','9989') insert into userinfo values ('yeah','998') insert into userinfo values ('zzz','9978') insert into userinfo values ('kyung','99998') insert into userinfo values ('1234','99778') insert into userinfo values ('12366','99811') insert into userinfo values ('15311','95598') insert into userinfo values ('15322','95598') insert into userinfo values ('15333','95598') insert into userinfo values ('15223','95598') insert into userinfo values ('1513','95598') insert into userinfo values ('1523','95598') insert into userinfo values ('1543','955198') insert into userinfo values ('15993','95598') insert into userinfo values ('1tt53','95598') insert into userinfo values ('16653','95598') insert into userinfo values ('19953','95598')
/* Navicat Premium Data Transfer Source Server : hh Source Server Type : MySQL Source Server Version : 80022 Source Host : 127.0.0.1:3306 Source Schema : blog Target Server Type : MySQL Target Server Version : 80022 File Encoding : 65001 Date: 09/08/2021 21:03:53 */ SET NAMES utf8mb4; SET FOREIGN_KEY_CHECKS = 0; -- ---------------------------- -- Table structure for blog -- ---------------------------- DROP TABLE IF EXISTS `blog`; CREATE TABLE `blog` ( `id` bigint NOT NULL AUTO_INCREMENT, `appreciation` bit(1) NOT NULL DEFAULT b'0', `commentabled` bit(1) NOT NULL DEFAULT b'0', `content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL, `create_time` datetime(6) NULL DEFAULT CURRENT_TIMESTAMP(6), `first_picture` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL, `flag` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL, `published` bit(1) NOT NULL DEFAULT b'0', `recommend` bit(1) NOT NULL DEFAULT b'0', `share_statement` bit(1) NOT NULL DEFAULT b'0', `title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL, `update_time` datetime(6) NULL DEFAULT NULL, `views` int NULL DEFAULT 0, `type_id` bigint NULL DEFAULT NULL, `introduction` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL, PRIMARY KEY (`id`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Table structure for blog_tag -- ---------------------------- DROP TABLE IF EXISTS `blog_tag`; CREATE TABLE `blog_tag` ( `id` bigint NOT NULL AUTO_INCREMENT, `blogs_id` bigint NOT NULL, `tags_id` bigint NOT NULL, PRIMARY KEY (`id`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 319 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Table structure for comment -- ---------------------------- DROP TABLE IF EXISTS `comment`; CREATE TABLE `comment` ( `id` bigint NOT NULL AUTO_INCREMENT, `blog_id` bigint NULL DEFAULT NULL, `nickname` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL, `email` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL, `create_time` datetime(6) NULL DEFAULT CURRENT_TIMESTAMP(6), `content` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL, `avatar` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL, `superior_id` bigint NULL DEFAULT NULL, `if_admin` bit(1) NOT NULL DEFAULT b'0', PRIMARY KEY (`id`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 72 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Table structure for tag -- ---------------------------- DROP TABLE IF EXISTS `tag`; CREATE TABLE `tag` ( `id` bigint NOT NULL AUTO_INCREMENT, `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL, PRIMARY KEY (`id`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 55 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Table structure for type -- ---------------------------- DROP TABLE IF EXISTS `type`; CREATE TABLE `type` ( `id` bigint NOT NULL AUTO_INCREMENT, `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL, PRIMARY KEY (`id`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 118 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Table structure for user -- ---------------------------- DROP TABLE IF EXISTS `user`; CREATE TABLE `user` ( `id` bigint NOT NULL AUTO_INCREMENT, `avatar` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL, `email` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL, `password` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL, `username` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL, PRIMARY KEY (`id`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic; SET FOREIGN_KEY_CHECKS = 1;
CREATE TABLE IF NOT EXISTS `hammer_spam` ( `iSpamID` INT NOT NULL AUTO_INCREMENT, `cEmail` TEXT NOT NULL, `iIP` INT NOT NULL, PRIMARY KEY (`iSpamID`) ) ENGINE=InnoDB;
update houses set image_url=$2 where house_id=$1 returning *;
UPDATE BURI_STATE SET PROCESS_DATE = CURRENT_TIMESTAMP, ABORT_DATE = CURRENT_TIMESTAMP WHERE PROCESS_DATE > CURRENT_TIMESTAMP AND STATE_ID = /*savingStateId*/1 ;
#create database ROOMIE; drop table COMMENTS; drop table STUDENT; drop table ROOM; drop table PREFERENCE; drop table DORMITORY; create table PREFERENCE ( Student_ID int, Smokes bool default false, Sleep_Start_Time time, Sleep_End_Time time, Music_Preference varchar(255), Hobby varchar(255), primary key (Student_ID) ); create table DORMITORY ( Dorm_ID varchar(255), Dorm_Name varchar(255), Location varchar(255), Fee int, Total_Capacity int, primary key (Dorm_ID) ); create table ROOM ( Room_ID varchar(255), Dorm_ID varchar(255), Floor int, Capacity int, primary key (Room_ID), foreign key (Dorm_ID) references DORMITORY(Dorm_ID) ); create table STUDENT ( Student_ID int, First_Name varchar(255) not null, Last_Name varchar(255) not null, Age int, Major varchar(255), Club varchar(255), Phone_Number varchar(255), Room_ID varchar(255), primary key (Student_ID), foreign key (Room_ID) references ROOM(Room_ID) ); create table COMMENTS ( Comment_ID int not null auto_increment, Student_ID int, Room_ID varchar(255), Content text, primary key (Comment_ID), foreign key (Student_ID) references STUDENT(Student_ID), foreign key (Room_ID) references ROOM(Room_ID) ); #Inserting dummy data for DORMITORY insert into DORMITORY (Dorm_ID, Dorm_Name, Location, Fee, Total_Capacity) values ("N20", "성실관", "North", 420000, 400) ; #Inserting dummy data for ROOM insert into ROOM (Room_ID, Dorm_ID, Floor, Capacity) values ("N20_228", "N20", 2, 2) ; #Inserting dummy data for STUDENT insert into STUDENT (Student_ID, First_Name, Last_Name, Age, Major, Club, Phone_Number, Room_ID) values (20130736, "Andrew", "Kim", 24, "Computer Science", "PASSION", "000-1234-5678", "N20_228") ; #Inserting dummy data for PREFERENCE insert into PREFERENCE (Student_ID, Smokes, Sleep_Start_Time, Sleep_End_Time, Music_Preference, Hobby) values (20130736, False, "22:00:00", "06:00:00", "Orchestra", "Game") ; #Inserting dummy data for COMMENTS insert into COMMENTS (Student_ID, Room_ID, Content) values (20130736, "N20_228", "This room sucks man") ;
-- 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 video_store -- ----------------------------------------------------- -- ----------------------------------------------------- -- Schema video_store -- ----------------------------------------------------- CREATE SCHEMA IF NOT EXISTS `video_store` DEFAULT CHARACTER SET utf8 ; USE `video_store` ; -- ----------------------------------------------------- -- Table `video_store`.`customer` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `video_store`.`customer` ( `customer_id` INT(11) NOT NULL, `customer_name` VARCHAR(255) NULL DEFAULT NULL, `customer_address` VARCHAR(255) NULL DEFAULT NULL, `customer_city` VARCHAR(50) NULL DEFAULT NULL, `customer_state` VARCHAR(25) NULL DEFAULT NULL, `customer_postal` VARCHAR(10) NULL DEFAULT NULL, `customer_number` VARCHAR(20) NULL DEFAULT NULL, `customer_balance` DECIMAL(10,2) NULL DEFAULT NULL, PRIMARY KEY (`customer_id`), UNIQUE INDEX `customer_number_UNIQUE` (`customer_number` ASC) VISIBLE) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8; -- ----------------------------------------------------- -- Table `video_store`.`video` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `video_store`.`video` ( `video_id` INT(11) NOT NULL, `video_rented` VARCHAR(50) NULL DEFAULT NULL, `video_name` VARCHAR(255) NULL DEFAULT NULL, `video_genre` VARCHAR(50) NULL DEFAULT NULL, `video_release_date` DATE NULL DEFAULT NULL, `video_director` VARCHAR(255) NULL DEFAULT NULL, PRIMARY KEY (`video_id`)) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8; -- ----------------------------------------------------- -- Table `video_store`.`rental` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `video_store`.`rental` ( `rental_id` INT(11) NOT NULL, `video_id` INT(11) NOT NULL, `customer_id` INT(11) NOT NULL, `checkout_date` VARCHAR(45) NULL DEFAULT NULL, `due_date` VARCHAR(45) NULL DEFAULT NULL, `return_date` VARCHAR(45) NULL DEFAULT NULL, `fee_charge` VARCHAR(45) NULL DEFAULT NULL, PRIMARY KEY (`rental_id`, `video_id`, `customer_id`), INDEX `fk_video_id_idx` (`video_id` ASC) VISIBLE, INDEX `fk_customer_id_idx` (`customer_id` ASC) VISIBLE, CONSTRAINT `fk_customer_id` FOREIGN KEY (`customer_id`) REFERENCES `video_store`.`customer` (`customer_id`), CONSTRAINT `fk_video_id` FOREIGN KEY (`video_id`) REFERENCES `video_store`.`video` (`video_id`)) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8; USE `video_store` ; -- ----------------------------------------------------- -- procedure show_cust_info -- ----------------------------------------------------- DELIMITER $$ USE `video_store`$$ CREATE DEFINER=`root`@`localhost` PROCEDURE `show_cust_info`(user_entry varchar(255)) BEGIN SELECT customer_id, customer_name, customer_address, customer_city, customer_state, customer_postal, customer_number, customer_balance FROM customer WHERE user_entry LIKE customer_id OR user_entry LIKE customer_name OR user_entry LIKE customer_address OR user_entry LIKE customer_city OR user_entry LIKE customer_state OR user_entry LIKE customer_postal OR user_entry LIKE customer_number OR user_entry LIKE customer_balance; END$$ DELIMITER ; -- ----------------------------------------------------- -- procedure show_mov_info -- ----------------------------------------------------- DELIMITER $$ USE `video_store`$$ CREATE DEFINER=`root`@`localhost` PROCEDURE `show_mov_info`(user_entry varchar(255)) BEGIN SELECT video_id, video_rented, video_name, video_genre, video_release_date, video_director FROM video WHERE user_entry LIKE video_id OR user_entry LIKE video_rented OR user_entry LIKE video_name OR user_entry LIKE video_genre OR user_entry LIKE video_release_date OR user_entry LIKE video_director; END$$ DELIMITER ; SET SQL_MODE=@OLD_SQL_MODE; SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET AUTOCOMMIT = 0; START TRANSACTION; CREATE TABLE `users` ( `id` int(11) NOT NULL, `username` text NOT NULL, `password` text NOT NULL, `hwid` text, `ban` int(11) NOT NULL DEFAULT '0', `type` int(11) NOT NULL DEFAULT '0' ) ENGINE=InnoDB DEFAULT CHARSET=latin1; ALTER TABLE `users` ADD PRIMARY KEY (`id`); ALTER TABLE `users` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; INSERT INTO `users` ( `id`, `username`, `password`, `hwid`, `ban`, `type` ) VALUES ( NULL, 'admin', '$2y$14$FSbl7AzNenEmcWV1V7UnAupxfEpChbjIYR0CjAQZJvZpDjtbC5Iua', NULL, '0', '100'); COMMIT;
CREATE TABLE [icb].[Claim] ( [Id] INT IDENTITY (1, 1) NOT NULL, [Name] NVARCHAR (50) NOT NULL, [Description] NVARCHAR (100) NOT NULL, [CreatedBy] NVARCHAR (50) NOT NULL, [CreatedOn] DATETIME CONSTRAINT [DF_Claim_CreatedOn] DEFAULT (getdate()) NOT NULL, [ModifiedBy] NVARCHAR (50) NULL, [ModifiedOn] DATETIME NULL, CONSTRAINT [PK_Claim] PRIMARY KEY CLUSTERED ([Id] ASC) );
-- Generated by Oracle SQL Developer Data Modeler 17.2.0.188.1104 -- at: 2017-09-06 12:36:47 CST -- site: Oracle Database 11g -- type: Oracle Database 11g CREATE TABLE asignacion_rol ( id NUMBER NOT NULL, nombre VARCHAR2(100 CHAR) NOT NULL, descripcion CLOB NOT NULL, usuario_id NUMBER NOT NULL, roles_id NUMBER NOT NULL, fecha_creacion DATE NOT NULL, activo CHAR(1) NOT NULL, usuario_creacion NUMBER NOT NULL ); ALTER TABLE asignacion_rol ADD CONSTRAINT asignacion_rol_pk PRIMARY KEY ( id ); CREATE TABLE opcion ( id NUMBER NOT NULL, nombre VARCHAR2(100) NOT NULL, descripcion CLOB NOT NULL, fecha_creacion DATE NOT NULL, usuario_creacion NUMBER NOT NULL, activo CHAR(1) NOT NULL ); ALTER TABLE opcion ADD CONSTRAINT opcion_pk PRIMARY KEY ( id ); CREATE TABLE permiso ( id NUMBER NOT NULL, usuario_permiso NUMBER NOT NULL, nombre VARCHAR2(150 CHAR) NOT NULL, referencia INTEGER NOT NULL, descripcion CLOB NOT NULL, fecha_creacion DATE NOT NULL, usuario_creacion NUMBER NOT NULL, activo CHAR(1) NOT NULL ); ALTER TABLE permiso ADD CONSTRAINT permiso_pk PRIMARY KEY ( id ); CREATE TABLE roles ( id NUMBER NOT NULL, nombre VARCHAR2(20 CHAR) NOT NULL, descripcion CLOB NOT NULL, usuario_id NUMBER NOT NULL, fecha_ingreso DATE NOT NULL, activo CHAR(1) NOT NULL ); ALTER TABLE roles ADD CONSTRAINT roles_pk PRIMARY KEY ( id ); CREATE TABLE sub_opcion ( id NUMBER NOT NULL, nombre VARCHAR2(100 CHAR) NOT NULL, url VARCHAR2(100 CHAR) NOT NULL, descripcion CLOB NOT NULL, fecha_creacion DATE NOT NULL, activo CHAR(1) NOT NULL, usuario_id NUMBER NOT NULL, opcion_id NUMBER NOT NULL ); ALTER TABLE sub_opcion ADD CONSTRAINT sub_opcion_pk PRIMARY KEY ( id ); CREATE TABLE usuario ( id NUMBER NOT NULL, primer_nombre VARCHAR2(50 CHAR) NOT NULL, segundo_nombre VARCHAR2(50 CHAR), primer_apellido VARCHAR2(50 CHAR) NOT NULL, segundo_apellido VARCHAR2(50 CHAR), nombre_usuario VARCHAR2(20 CHAR) NOT NULL, contrasenia CLOB NOT NULL, fecha_ingreso DATE NOT NULL, activo CHAR(1) NOT NULL ); CREATE UNIQUE INDEX nombre_usuario_unique ON usuario ( nombre_usuario ASC ); ALTER TABLE usuario ADD CONSTRAINT usuario_pk PRIMARY KEY ( id ); ALTER TABLE asignacion_rol ADD CONSTRAINT asignacion_rol_roles_fk FOREIGN KEY ( roles_id ) REFERENCES roles ( id ) NOT DEFERRABLE; ALTER TABLE asignacion_rol ADD CONSTRAINT asignacion_rol_usuario_fk FOREIGN KEY ( usuario_id ) REFERENCES usuario ( id ) NOT DEFERRABLE; ALTER TABLE asignacion_rol ADD CONSTRAINT asignacion_rol_usuario_fkv2 FOREIGN KEY ( usuario_creacion ) REFERENCES usuario ( id ) NOT DEFERRABLE; ALTER TABLE opcion ADD CONSTRAINT opcion_usuario_fk FOREIGN KEY ( usuario_creacion ) REFERENCES usuario ( id ) NOT DEFERRABLE; ALTER TABLE permiso ADD CONSTRAINT permiso_usuario_fk FOREIGN KEY ( usuario_permiso ) REFERENCES usuario ( id ) NOT DEFERRABLE; ALTER TABLE permiso ADD CONSTRAINT permiso_usuario_fkv2 FOREIGN KEY ( usuario_creacion ) REFERENCES usuario ( id ) NOT DEFERRABLE; ALTER TABLE roles ADD CONSTRAINT roles_usuario_fk FOREIGN KEY ( usuario_id ) REFERENCES usuario ( id ) NOT DEFERRABLE; ALTER TABLE sub_opcion ADD CONSTRAINT sub_opcion_opcion_fk FOREIGN KEY ( opcion_id ) REFERENCES opcion ( id ) NOT DEFERRABLE; ALTER TABLE sub_opcion ADD CONSTRAINT sub_opcion_usuario_fk FOREIGN KEY ( usuario_id ) REFERENCES usuario ( id ) NOT DEFERRABLE; -- Oracle SQL Developer Data Modeler Summary Report: -- -- CREATE TABLE 6 -- CREATE INDEX 1 -- ALTER TABLE 15 -- CREATE VIEW 0 -- ALTER VIEW 0 -- CREATE PACKAGE 0 -- CREATE PACKAGE BODY 0 -- CREATE PROCEDURE 0 -- CREATE FUNCTION 0 -- CREATE TRIGGER 0 -- ALTER TRIGGER 0 -- CREATE COLLECTION TYPE 0 -- CREATE STRUCTURED TYPE 0 -- CREATE STRUCTURED TYPE BODY 0 -- CREATE CLUSTER 0 -- CREATE CONTEXT 0 -- CREATE DATABASE 0 -- CREATE DIMENSION 0 -- CREATE DIRECTORY 0 -- CREATE DISK GROUP 0 -- CREATE ROLE 0 -- CREATE ROLLBACK SEGMENT 0 -- CREATE SEQUENCE 0 -- CREATE MATERIALIZED VIEW 0 -- CREATE SYNONYM 0 -- CREATE TABLESPACE 0 -- CREATE USER 0 -- -- DROP TABLESPACE 0 -- DROP DATABASE 0 -- -- REDACTION POLICY 0 -- -- ORDS DROP SCHEMA 0 -- ORDS ENABLE SCHEMA 0 -- ORDS ENABLE OBJECT 0 -- -- ERRORS 0 -- WARNINGS 0
SELECT TOP 1 PROCESS_NO, PROCESS_TEMPLATE_ID FROM PROCESS_NODE_STATUS WHERE CONTACT_KEY = /*key*/'' AND PROCESS_TYPE = CAST(/*processType*/'1' AS CHAR(2)) AND NODE_STATUS = CAST('1' AS CHAR(1))
-- MySQL dump 10.13 Distrib 5.7.17, for macos10.12 (x86_64) -- -- Host: ssddb.ck6ywww2iqip.sa-east-1.rds.amazonaws.com Database: DataWarehouse -- ------------------------------------------------------ -- Server version 5.7.23-log /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; SET @MYSQLDUMP_TEMP_LOG_BIN = @@SESSION.SQL_LOG_BIN; SET @@SESSION.SQL_LOG_BIN= 0; -- -- GTID state at the beginning of the backup -- SET @@GLOBAL.GTID_PURGED=''; -- -- Dumping data for table `dim_cargo` -- LOCK TABLES `dim_cargo` WRITE; /*!40000 ALTER TABLE `dim_cargo` DISABLE KEYS */; INSERT INTO `dim_cargo` VALUES (1,'Representante de ventas'),(2,'Vicepresidente comercial'),(3,'Gerente de ventas'),(4,'Coordinador ventas interno'); /*!40000 ALTER TABLE `dim_cargo` ENABLE KEYS */; UNLOCK TABLES; SET @@SESSION.SQL_LOG_BIN = @MYSQLDUMP_TEMP_LOG_BIN; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; -- Dump completed on 2018-11-13 21:33:55
SET search_path TO A2; -- Add below your SQL statements. -- For each of the queries below, your final statement should populate the respective answer table (queryX) with the correct tuples. It should look something like: -- INSERT INTO queryX (SELECT … <complete your SQL query here> …) -- where X is the correct index [1, …,10]. -- You can create intermediate views (as needed). Remember to drop these views after you have populated the result tables query1, query2, ... -- You can use the "\i a2.sql" command in psql to execute the SQL commands in this file. -- Good Luck! --Query 1 statements INSERT INTO query1 --Query 2 statements INSERT INTO query2 --Query 3 statements INSERT INTO query3 --Query 4 statements INSERT INTO query4 --Query 5 statements INSERT INTO query5 --Query 6 statements INSERT INTO query6 --Query 7 statements INSERT INTO query7 --Query 8 statements INSERT INTO query8 --Query 9 statements INSERT INTO query9 --Query 10 statements INSERT INTO query10
SELECT A.VariedadID, A.Campaña, iif(isnull(A.TotalExportacion) or A.TotalExportacion=0,0,iif(isnull(B.TotalMonto),0,B.TotalMonto)/A.TotalExportacion) AS PrecioTotal, iif(isnull(A.TotalExportacion) or A.TotalExportacion=0,0,iif(isnull(B.TotalMontoDolares),0,B.TotalMontoDolares)/A.TotalExportacion) AS PrecioTotalDolares, iif(isnull(A.TotalExportacion) or A.TotalExportacion=0,0,iif(isnull(B.PagoEfectivo),0,B.PagoEfectivo)/A.TotalExportacion) AS PrecioEfectivo, iif(isnull(A.TotalExportacion) or A.TotalExportacion=0,0,iif(isnull(B.DepositoBanco),0,B.DepositoBanco)/A.TotalExportacion) AS PrecioDeposito FROM (SELECT A.VariedadID, A.Campaña, SUM(A.TotalExportacion) AS TotalExportacion FROM TB_VentaProceso AS A GROUP BY A.VariedadID, A.Campaña) AS A LEFT JOIN (SELECT A.VariedadID, A.Campaña, SUM(iif(B.MonedaID="01",A.MontoSoles,A.MontoDolares*B.TipoCambio)) AS TotalMonto, SUM(A.MontoDolares) AS TotalMontoDolares, SUM(iif(D.CuentaTipoID="02",iif(B.MonedaID="01",A.MontoSoles,A.MontoDolares*B.TipoCambio),0)) AS PagoEfectivo, SUM(iif(D.CuentaTipoID="01",iif(B.MonedaID="01",A.MontoSoles,A.MontoDolares*B.TipoCambio),0)) AS DepositoBanco FROM (TB_CobranzaDetalle AS A LEFT JOIN TB_Cobranza AS B ON A.CobranzaID=B.CobranzaID) LEFT JOIN TB_Cuenta AS D ON B.CuentaID=D.CuentaID WHERE VariedadID IS NOT NULL AND Campaña IS NOT NULL GROUP BY A.VariedadID, A.Campaña) AS B ON A.VariedadID=B.VariedadID AND A.Campaña=B.Campaña
CREATE TABLE `headlines` ( `id` int(11) NOT NULL AUTO_INCREMENT, `title` varchar(200) DEFAULT NULL, `timestamp` datetime DEFAULT NULL, `storylink` varchar(200) DEFAULT NULL, `sport` varchar(45) DEFAULT NULL, `participants` varchar(45) DEFAULT NULL, `writer` varchar(45) DEFAULT NULL, `sitecontributor` varchar(45) DEFAULT NULL, `sourcesite` varchar(45) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `PHONE_ACTIVATION_TIME_BK`; CREATE TABLE `PHONE_ACTIVATION_TIME_BK` AS SELECT `CIMEI`, `SLIVED_TIME`, `SOFTWARE_VERSION`, `EXTERNAL_MODEL`, `GROUP_TITLE`, `SUMMARY_DATE` FROM `phone_dashboard`.`PHONE_ACTIVATION_TIME` WHERE `SUMMARY_DATE` IN ( '20160122', '20160123', '20160124' ) GROUP BY `CIMEI`, `SLIVED_TIME`, `SOFTWARE_VERSION`, `EXTERNAL_MODEL`, `GROUP_TITLE`, `SUMMARY_DATE` ; -- Delete DELETE FROM `phone_dashboard`.`PHONE_ACTIVATION_TIME` WHERE `SUMMARY_DATE` IN ( '20160122', '20160123', '20160124' ) -- Insert INSERT INTO `phone_dashboard`.`PHONE_ACTIVATION_TIME` SELECT * FROM `PHONE_ACTIVATION_TIME_BK` WHERE `SUMMARY_DATE` IN ( '20160122', '20160123', '20160124' )
select * from benn.football_conference_history
/* Post-Deployment Script Template -------------------------------------------------------------------------------------- This file contains SQL statements that will be appended to the build script. Use SQLCMD syntax to include a file in the post-deployment script. Example: :r .\myfile.sql Use SQLCMD syntax to reference a variable in the post-deployment script. Example: :setvar TableName MyTable SELECT * FROM [$(TableName)] -------------------------------------------------------------------------------------- */ IF NOT EXISTS (SELECT * FROM dbo.Genres) BEGIN TRUNCATE TABLE dbo.Genres INSERT INTO dbo.Genres([Name]) VALUES ('Action'), ('Adventure'), ('Comedy') TRUNCATE TABLE dbo.Roles INSERT INTO dbo.Roles([Name]) VALUES ('Admin'), ('User'), ('Actor') TRUNCATE TABLE dbo.People INSERT INTO dbo.People(RoleID, Email, [Password], [Name]) VALUES (1, 'ktghsu@hotmail.com', '123', 'Gordon Hsu'), (2, 'TestUser@yahoo.com', '123', 'User Hsu'), (3, 'TestActor1@yahoo.com', '123', 'Actor1 Hsu'), (3, 'TestActor2@yahoo.com', '123', 'Actor2 Hsu'), (3, 'TestActor3@yahoo.com', '123', 'Actor3 Hsu'), (3, 'TestActor4@yahoo.com', '123', 'Actor4 Hsu'), (3, 'TestActor5@yahoo.com', '123', 'Actor5 Hsu') TRUNCATE TABLE dbo.Movies INSERT INTO dbo.Movies(Title, Summary, ReleaseDate, InTheaters, Poster) VALUES ('Spider-Man: Far From Home', 'Summary for Spider-Man: Far From Home', '12/15/2019', 1, 'https://m.media-amazon.com/images/M/MV5BMGZlNTY1ZWUtYTMzNC00ZjUyLWE0MjQtMTMxN2E3ODYxMWVmXkEyXkFqcGdeQXVyMDM2NDM2MQ@@._V1_SY1000_CR0,0,674,1000_AL_.jpg'), ('Moana', 'Summary for Moana', '10/25/2030', 0, 'https://m.media-amazon.com/images/M/MV5BMjI4MzU5NTExNF5BMl5BanBnXkFtZTgwNzY1MTEwMDI@._V1_SY1000_CR0,0,674,1000_AL_.jpg'), ('Inception', 'Summary for Inception', '11/30/2010', 1, 'https://m.media-amazon.com/images/M/MV5BMjAxMzY3NjcxNF5BMl5BanBnXkFtZTcwNTI5OTM0Mw@@._V1_SY1000_CR0,0,675,1000_AL_.jpg') TRUNCATE TABLE dbo.MovieActors INSERT INTO dbo.MovieActors(PersonId, MovieId, [Character], [Order]) VALUES (3, 1, 'Character 1', 1), (4, 1, 'Character 2', 2), (5, 1, 'Character 3', 3), (3, 2, 'Character 4', 3), (6, 2, 'Character 5', 1), (7, 3, 'Character 6', 1) TRUNCATE TABLE dbo.MovieGenres INSERT INTO dbo.MovieGenres(MovieId, GenreId) VALUES (1, 1), (1, 2), (1, 3), (2, 1), (2, 2), (3, 1) TRUNCATE TABLE dbo.MovieRatings INSERT INTO dbo.MovieRatings(MovieId, UserId, Rate, RatingDate) VALUES (1, 1, 5, '12/31/2020'), (1, 2, 4, '12/31/2020'), (1, 3, 4, '12/31/2020'), (2, 1, 5, '12/31/2020'), (3, 1, 5, '12/31/2020') END
#script to update the submitted ppt file stored on challenges.epals.com update wp_postmeta set meta_value = replace(meta_value, '.ppt', '.mp4') where post_id in ( select uploaded_files_ids from wp_postmeta_backup as postmeta inner join ( select submit_time, max(if(`field_name`='uploaded_files_ids', `field_value`, null )) AS 'uploaded_files_ids', max(if(`field_name`='uploaded_files', `field_value`, null )) AS 'uploaded_files' from wp_cf7dbplugin_submits group by submit_time ) as submittedFiles on postmeta.post_id = submittedFiles.uploaded_files_ids where postmeta.meta_key = '_wp_attached_file' and postmeta.meta_value like '%ppt' and postmeta.meta_value like 'http://challenges.epals.com%' order by uploaded_files_ids ) and meta_key = '_wp_attached_file';
/** * One enumeration should be with using enum mysql type and second as a db relation. */ USE learning_through_test; CREATE TABLE Task ( task_id MEDIUMINT UNSIGNED AUTO_INCREMENT NOT NULL, PRIMARY KEY(task_id), title VARCHAR(128) NOT NULL, status MEDIUMINT UNSIGNED NOT NULL, priority VARCHAR(10) NOT NULL ) ENGINE = InnoDB;
(SELECT 'gender' AS TYPE, IF(sex = '' OR sex = 'null' OR sex = '(null)', '其他', sex) AS item, Ifnull(Count(*), 0) AS value, Now() AS time_stamp FROM yz_app_person_db.ps_attribute WHERE del_status = 0 AND account_id >= 20000 GROUP BY item) -- 性别分布 UNION ALL (SELECT 'birth_year', IF(birth_date = '', '其他', Year(birth_date)) AS birth_decade, -- concat(substring(birth_date, 3, 1), '0后') Ifnull(Count(*), 0), Now() FROM yz_app_person_db.ps_attribute WHERE del_status = 0 AND account_id >= 20000 GROUP BY birth_decade) -- 年龄分布 UNION ALL (SELECT 'degree', IF(highest_education = '' OR highest_education = 'null' OR highest_education = '全部', '其他', highest_education) AS h_edu, Ifnull(Count(*), 0), Now() FROM yz_app_person_db.ps_attribute WHERE del_status = 0 AND account_id >= 20000 GROUP BY h_edu) -- 教育程度分布
CREATE TABLE IF NOT EXISTS `performance` ( `id` int(11) NOT NULL AUTO_INCREMENT, `equipmentId` int(11) NOT NULL COMMENT '设备id', `intervalId` int(11) NOT NULL COMMENT '区间id', `fpt` decimal(8,2) DEFAULT NULL COMMENT '白屏时间', `tti` decimal(8,2) DEFAULT NULL COMMENT '首次可交互时间', `ready` decimal(8,2) DEFAULT NULL COMMENT 'HTML加载完成时间', `loadTime` decimal(8,2) DEFAULT NULL COMMENT '页面完全加载时间', `firstbyte` decimal(8,2) DEFAULT NULL COMMENT '首包时间', `compressionRatio` decimal(8,2) DEFAULT NULL COMMENT '压缩比例', `type` varchar(50) DEFAULT NULL COMMENT '页面打开方式', `createTime` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
DELETE FROM Users; ALTER TABLE Users AUTO_INCREMENT = 1; DELETE FROM IdTypes; ALTER TABLE IdTypes AUTO_INCREMENT = 1; DELETE FROM Area; ALTER TABLE Area AUTO_INCREMENT = 1; DELETE FROM Countries; ALTER TABLE Countries AUTO_INCREMENT = 1; -- IdTypes INSERT INTO IdTypes(Name) VALUES("CEDULA DE CIUDADANIA"); INSERT INTO IdTypes(Name) VALUES("CEDULA DE EXTRANJERIA"); INSERT INTO IdTypes(Name) VALUES("PASAPORTE"); INSERT INTO IdTypes(Name) VALUES("PERMISO ESPECIAL"); -- Area INSERT INTO Area(Name) VALUES("ADMINISTRACION"); INSERT INTO Area(Name) VALUES("FINANCIERA"); INSERT INTO Area(Name) VALUES("COMPRAS"); INSERT INTO Area(Name) VALUES("INFRAESTRUCTURA"); INSERT INTO Area(Name) VALUES("TALENTO HUMANO"); INSERT INTO Area(Name) VALUES("SERVICIOS VARIOS"); INSERT INTO Area(Name) VALUES("OTROS"); -- Countries INSERT INTO Countries(Name) VALUES("COLOMBIA"); INSERT INTO Countries(Name) VALUES("ESTADOS UNIDOS"); -- Users INSERT INTO Users(FirstLastName,SecondLastName,FirstName,OtherNames,CountryID,IdTypes,IdentificationDocument,Email,StartDate,AreaID,Status,RegisterDate) VALUES ("GARZON", "LOPEZ", "XAVIER", "", 1, 1, "1144114411", "xavier.garzon@cidenet.com.co", "2021-03-25 14:00:00", 1, "ACTIVO", NOW()); INSERT INTO Users(FirstLastName,SecondLastName,FirstName,OtherNames,CountryID,IdTypes,IdentificationDocument,Email,StartDate,AreaID,Status,RegisterDate) VALUES ("PALACIO", "GUZMAN", "MICHAEL", "ANDRES", 1, 1, "1133224412", "michael.palacio@cidenet.com.co", "2021-03-26 10:00:00", 4, "ACTIVO", NOW()); INSERT INTO Users(FirstLastName,SecondLastName,FirstName,OtherNames,CountryID,IdTypes,IdentificationDocument,Email,StartDate,AreaID,Status,RegisterDate) VALUES ("PALACIO", "MARTINEZ", "MICHAEL", "DARIO", 1, 1, "2233224413", "michael.palacio3@cidenet.com.co", "2021-03-26 10:30:00", 3, "ACTIVO", NOW()); INSERT INTO Users(FirstLastName,SecondLastName,FirstName,OtherNames,CountryID,IdTypes,IdentificationDocument,Email,StartDate,AreaID,Status,RegisterDate) VALUES ("GARZON", "GUTIERREZ", "XAVIER", "", 2, 1, "1144114422", "xavier.garzon@cidenet.com.us", "2021-03-25 21:40:00", 2, "ACTIVO", NOW()); INSERT INTO Users(FirstLastName,SecondLastName,FirstName,OtherNames,CountryID,IdTypes,IdentificationDocument,Email,StartDate,AreaID,Status,RegisterDate) VALUES ("GARZON", "GUTIERREZ", "XAVIER", "ANTONIO", 2, 2, "TR-0105454", "xavier.garzon5@cidenet.com.us", "2021-03-25 21:45:00", 1, "ACTIVO", NOW()); INSERT INTO Users(FirstLastName,SecondLastName,FirstName,OtherNames,CountryID,IdTypes,IdentificationDocument,Email,StartDate,AreaID,Status,RegisterDate) VALUES ("GOMEZ", "HERNANDEZ", "ANDRES", "ANDRES", 1, 1, "1133224651", "andres.gomez@cidenet.com.co", "2021-03-26 09:00:00", 1, "ACTIVO", NOW()); INSERT INTO Users(FirstLastName,SecondLastName,FirstName,OtherNames,CountryID,IdTypes,IdentificationDocument,Email,StartDate,AreaID,Status,RegisterDate) VALUES ("HERNANDEZ", "GONZALEZ", "ANDRES", "", 1, 1, "1033224411", "andres.hernandez@cidenet.com.co", "2021-03-26 10:00:00", 2, "ACTIVO", NOW()); INSERT INTO Users(FirstLastName,SecondLastName,FirstName,OtherNames,CountryID,IdTypes,IdentificationDocument,Email,StartDate,AreaID,Status,RegisterDate) VALUES ("PAZ", "FERNADEZ", "MARCO", "DE LA CALLE", 2, 1, "1666224411", "marco.paz@cidenet.com.us", "2021-03-26 11:00:00", 4, "ACTIVO", NOW()); INSERT INTO Users(FirstLastName,SecondLastName,FirstName,OtherNames,CountryID,IdTypes,IdentificationDocument,Email,StartDate,AreaID,Status,RegisterDate) VALUES ("PINEDA", "DUQUE", "ANDREA", "", 1, 1, "1109024411", "andrea.pineda@cidenet.com.co", "2021-03-26 12:00:00", 5, "ACTIVO", NOW()); INSERT INTO Users(FirstLastName,SecondLastName,FirstName,OtherNames,CountryID,IdTypes,IdentificationDocument,Email,StartDate,AreaID,Status,RegisterDate) VALUES ("RODRIGUEZ", "MARIN", "SOFIA", "", 2, 1, "2133224411", "sofia.rodriguez@cidenet.com.us", "2021-03-26 14:00:00", 6, "ACTIVO", NOW()); INSERT INTO Users(FirstLastName,SecondLastName,FirstName,OtherNames,CountryID,IdTypes,IdentificationDocument,Email,StartDate,AreaID,Status,RegisterDate) VALUES ("ESTUPINAN", "TAVAREZ", "MARIANA", "", 2, 1, "4133224411", "mariana.estupinan@cidenet.com.us", "2021-03-26 15:00:00", 7, "ACTIVO", NOW());
IF EXISTS(SELECT * FROM sys.tables where [name] = 'RecommendedPrices') BEGIN INSERT INTO [prod].[RecommendedPrices]([Balance], [MinPrice], [MaxPrice]) VALUES (2399, 0, 2000), (3400, 0, 2400), (4399, 0, 3400), (5499, 0, 4400), (6499, 0, 5400), (7499, 0, 6400), (9000, 0, 7400), (9999999, 0, 3400) END
ALTER TABLE `company` ADD COLUMN `COUNTRY` int(11) AFTER `ADDRESS_2`, CHANGE COLUMN `CITY` `CITY` varchar(50) CHARACTER SET cp1251 DEFAULT NULL AFTER `COUNTRY`, CHANGE COLUMN `STATE` `STATE` int(11) DEFAULT NULL AFTER `CITY`, CHANGE COLUMN `ZIP` `ZIP` varchar(10) CHARACTER SET cp1251 DEFAULT NULL AFTER `STATE`, CHANGE COLUMN `TYPE` `TYPE` int(11) DEFAULT NULL AFTER `ZIP`, CHANGE COLUMN `INSPECTION_COMPANY` `INSPECTION_COMPANY` int(11) DEFAULT NULL AFTER `TYPE`, CHANGE COLUMN `PRIMARY_CONTACT` `PRIMARY_CONTACT` int(11) DEFAULT NULL AFTER `INSPECTION_COMPANY`, CHANGE COLUMN `BRANDING` `BRANDING` int(1) DEFAULT '0' AFTER `PRIMARY_CONTACT`, CHANGE COLUMN `LOGO_FILE` `LOGO_FILE` varchar(100) DEFAULT NULL AFTER `BRANDING`, CHANGE COLUMN `COLOR_THEME` `COLOR_THEME` int(1) DEFAULT '0' AFTER `LOGO_FILE`; ALTER TABLE `company` ADD FOREIGN KEY (`COUNTRY`) REFERENCES `dictionary` (`ID`) ON UPDATE CASCADE ON DELETE SET NULL; ALTER TABLE `dictionary` ADD COLUMN `PARENT_ID` int(11) AFTER `ID`, CHANGE COLUMN `CATEGORY` `CATEGORY` varchar(50) CHARACTER SET cp1251 NOT NULL AFTER `PARENT_ID`, CHANGE COLUMN `ITEM` `ITEM` varchar(50) CHARACTER SET cp1251 NOT NULL AFTER `CATEGORY`, CHANGE COLUMN `DESCRIPTION` `DESCRIPTION` varchar(255) CHARACTER SET cp1251 DEFAULT NULL AFTER `ITEM`, CHANGE COLUMN `VALUE_ORDER` `VALUE_ORDER` int(11) DEFAULT NULL AFTER `DESCRIPTION`; ALTER TABLE `dictionary` ADD FOREIGN KEY (`PARENT_ID`) REFERENCES `dictionary` (`ID`) ON UPDATE CASCADE ON DELETE SET NULL; update dictionary set parent_id = 999 where category = 'State'; update company set country = 999; update building set country = 999; insert into dictionary(parent_id, category, item, description) values (1000, 'State', 'AB', 'Alberta'), (1000, 'State', 'BC', 'British Columbia'), (1000, 'State', 'MB', 'Manitoba'), (1000, 'State', 'NB', 'New Brunswick'), (1000, 'State', 'NL', 'Newfoundland and Labrador'), (1000, 'State', 'NS', 'Nova Scotia'), (1000, 'State', 'NT', 'Northwest Territories'), (1000, 'State', 'NU', 'Ninavut'), (1000, 'State', 'ON', 'Ontario'), (1000, 'State', 'PE', 'Prince Edward Island'), (1000, 'State', 'QC', 'Quebec'), (1000, 'State', 'SK', 'Saskatchewan'), (1000, 'State', 'YT', 'Yukon'); update `doordata`.`dictionary` set `VALUE_ORDER`='10' where `ID`='948'; update `doordata`.`dictionary` set `VALUE_ORDER`='20' where `ID`='949'; update `doordata`.`dictionary` set `VALUE_ORDER`='30' where `ID`='950'; update `doordata`.`dictionary` set `VALUE_ORDER`='40' where `ID`='951'; update `doordata`.`dictionary` set `VALUE_ORDER`='50' where `ID`='952'; update `doordata`.`dictionary` set `VALUE_ORDER`='60' where `ID`='953'; update `doordata`.`dictionary` set `VALUE_ORDER`='70' where `ID`='954'; update `doordata`.`dictionary` set `VALUE_ORDER`='80' where `ID`='955'; update `doordata`.`dictionary` set `VALUE_ORDER`='90' where `ID`='956'; update `doordata`.`dictionary` set `VALUE_ORDER`='100' where `ID`='957'; update `doordata`.`dictionary` set `VALUE_ORDER`='110' where `ID`='958'; update `doordata`.`dictionary` set `VALUE_ORDER`='120' where `ID`='959'; update `doordata`.`dictionary` set `VALUE_ORDER`='130' where `ID`='960'; update `doordata`.`dictionary` set `VALUE_ORDER`='140' where `ID`='961'; update `doordata`.`dictionary` set `VALUE_ORDER`='150' where `ID`='962'; update `doordata`.`dictionary` set `VALUE_ORDER`='160' where `ID`='963'; update `doordata`.`dictionary` set `VALUE_ORDER`='170' where `ID`='964'; update `doordata`.`dictionary` set `VALUE_ORDER`='180' where `ID`='965'; update `doordata`.`dictionary` set `VALUE_ORDER`='190' where `ID`='966'; update `doordata`.`dictionary` set `VALUE_ORDER`='200' where `ID`='967'; update `doordata`.`dictionary` set `VALUE_ORDER`='210' where `ID`='968'; update `doordata`.`dictionary` set `VALUE_ORDER`='220' where `ID`='969'; update `doordata`.`dictionary` set `VALUE_ORDER`='230' where `ID`='970'; update `doordata`.`dictionary` set `VALUE_ORDER`='240' where `ID`='971'; update `doordata`.`dictionary` set `VALUE_ORDER`='250' where `ID`='972'; update `doordata`.`dictionary` set `VALUE_ORDER`='260' where `ID`='973'; update `doordata`.`dictionary` set `VALUE_ORDER`='270' where `ID`='974'; update `doordata`.`dictionary` set `VALUE_ORDER`='280' where `ID`='975'; update `doordata`.`dictionary` set `VALUE_ORDER`='290' where `ID`='976'; update `doordata`.`dictionary` set `VALUE_ORDER`='300' where `ID`='977'; update `doordata`.`dictionary` set `VALUE_ORDER`='310' where `ID`='978'; update `doordata`.`dictionary` set `VALUE_ORDER`='320' where `ID`='979'; update `doordata`.`dictionary` set `VALUE_ORDER`='330' where `ID`='980'; update `doordata`.`dictionary` set `VALUE_ORDER`='340' where `ID`='981'; update `doordata`.`dictionary` set `VALUE_ORDER`='350' where `ID`='982'; update `doordata`.`dictionary` set `VALUE_ORDER`='360' where `ID`='983'; update `doordata`.`dictionary` set `VALUE_ORDER`='370' where `ID`='984'; update `doordata`.`dictionary` set `VALUE_ORDER`='380' where `ID`='985'; update `doordata`.`dictionary` set `VALUE_ORDER`='390' where `ID`='986'; update `doordata`.`dictionary` set `VALUE_ORDER`='400' where `ID`='987'; update `doordata`.`dictionary` set `VALUE_ORDER`='410' where `ID`='988'; update `doordata`.`dictionary` set `VALUE_ORDER`='420' where `ID`='989'; update `doordata`.`dictionary` set `VALUE_ORDER`='430' where `ID`='990'; update `doordata`.`dictionary` set `VALUE_ORDER`='440' where `ID`='991'; update `doordata`.`dictionary` set `VALUE_ORDER`='450' where `ID`='992'; update `doordata`.`dictionary` set `VALUE_ORDER`='460' where `ID`='993'; update `doordata`.`dictionary` set `VALUE_ORDER`='470' where `ID`='994'; update `doordata`.`dictionary` set `VALUE_ORDER`='480' where `ID`='995'; update `doordata`.`dictionary` set `VALUE_ORDER`='490' where `ID`='996'; update `doordata`.`dictionary` set `VALUE_ORDER`='500' where `ID`='997'; update `doordata`.`dictionary` set `VALUE_ORDER`='510' where `ID`='998'; update `doordata`.`dictionary` set `VALUE_ORDER`='520' where `item`='AB' and category = 'State'; update `doordata`.`dictionary` set `VALUE_ORDER`='530' where `item`='BC' and category = 'State'; update `doordata`.`dictionary` set `VALUE_ORDER`='540' where `item`='MB' and category = 'State'; update `doordata`.`dictionary` set `VALUE_ORDER`='550' where `item`='NB' and category = 'State'; update `doordata`.`dictionary` set `VALUE_ORDER`='550' where `item`='NL' and category = 'State'; update `doordata`.`dictionary` set `VALUE_ORDER`='550' where `item`='NS' and category = 'State'; update `doordata`.`dictionary` set `VALUE_ORDER`='550' where `item`='NT' and category = 'State'; update `doordata`.`dictionary` set `VALUE_ORDER`='550' where `item`='NU' and category = 'State'; update `doordata`.`dictionary` set `VALUE_ORDER`='550' where `item`='ON' and category = 'State'; update `doordata`.`dictionary` set `VALUE_ORDER`='550' where `item`='PE' and category = 'State'; update `doordata`.`dictionary` set `VALUE_ORDER`='550' where `item`='QC' and category = 'State'; update `doordata`.`dictionary` set `VALUE_ORDER`='550' where `item`='SK' and category = 'State'; update `doordata`.`dictionary` set `VALUE_ORDER`='550' where `item`='YT' and category = 'State';
DELETE FROM updates;
CREATE USER [dbuser] FOR LOGIN [dbuser];
/* Warnings: - You are about to drop the `Profile` table. If the table is not empty, all the data it contains will be lost. - You are about to drop the `_FamilyToUser` table. If the table is not empty, all the data it contains will be lost. */ -- DropForeignKey ALTER TABLE "Profile" DROP CONSTRAINT "Profile_userId_fkey"; -- DropForeignKey ALTER TABLE "_FamilyToUser" DROP CONSTRAINT "_FamilyToUser_A_fkey"; -- DropForeignKey ALTER TABLE "_FamilyToUser" DROP CONSTRAINT "_FamilyToUser_B_fkey"; -- AlterTable ALTER TABLE "Meal" ALTER COLUMN "description" DROP NOT NULL; -- DropTable DROP TABLE "Profile"; -- DropTable DROP TABLE "_FamilyToUser"; -- CreateTable CREATE TABLE "_UserFamilies" ( "A" INTEGER NOT NULL, "B" INTEGER NOT NULL ); -- CreateIndex CREATE UNIQUE INDEX "_UserFamilies_AB_unique" ON "_UserFamilies"("A", "B"); -- CreateIndex CREATE INDEX "_UserFamilies_B_index" ON "_UserFamilies"("B"); -- AddForeignKey ALTER TABLE "_UserFamilies" ADD FOREIGN KEY ("A") REFERENCES "Family"("id") ON DELETE CASCADE ON UPDATE CASCADE; -- AddForeignKey ALTER TABLE "_UserFamilies" ADD FOREIGN KEY ("B") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
/* Navicat MySQL Data Transfer Source Server : localhost Source Server Version : 50539 Source Host : localhost:3306 Source Database : seckill Target Server Type : MYSQL Target Server Version : 50539 File Encoding : 65001 Date: 2016-12-08 17:55:45 */ SET FOREIGN_KEY_CHECKS=0; -- ---------------------------- -- Table structure for `seckill` -- ---------------------------- DROP TABLE IF EXISTS `seckill`; CREATE TABLE `seckill` ( `seckill_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '商品库存id', `name` varchar(20) NOT NULL COMMENT '商品名称', `number` int(11) NOT NULL COMMENT '库存数量', `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `start_time` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT '秒杀开启时间', `end_time` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT '秒杀结束时间', PRIMARY KEY (`seckill_id`), KEY `idx_start_time` (`start_time`), KEY `idx_end_time` (`end_time`), KEY `idx_create_time` (`create_time`) ) ENGINE=InnoDB AUTO_INCREMENT=1004 DEFAULT CHARSET=utf8 COMMENT='秒杀库存表'; -- ---------------------------- -- Records of seckill -- ---------------------------- INSERT INTO `seckill` VALUES ('1000', '1000元秒杀iphone7', '595', '2016-12-06 17:54:45', '2016-12-06 00:00:00', '2016-12-13 00:00:00'); INSERT INTO `seckill` VALUES ('1001', '800元秒杀iphone6', '600', '2016-12-06 17:54:45', '2016-12-12 00:00:00', '2016-12-13 00:00:00'); INSERT INTO `seckill` VALUES ('1002', '600元秒杀小米5', '500', '2016-12-06 17:54:45', '2016-12-12 00:00:00', '2016-12-13 00:00:00'); INSERT INTO `seckill` VALUES ('1003', '500元秒杀华为荣耀8', '400', '2016-12-06 17:54:45', '2016-12-12 00:00:00', '2016-12-13 00:00:00'); -- ---------------------------- -- Table structure for `success_killed` -- ---------------------------- DROP TABLE IF EXISTS `success_killed`; CREATE TABLE `success_killed` ( `seckill_id` bigint(20) NOT NULL COMMENT '秒杀商品id', `user_phone` bigint(20) NOT NULL COMMENT '用户手机号', `state` tinyint(4) NOT NULL DEFAULT '-1' COMMENT '状态标识:-1:无效;0:成功;1:已付款;2:已发货', `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', PRIMARY KEY (`seckill_id`,`user_phone`), KEY `idx_create_time` (`create_time`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='秒杀成功明细表'; -- ---------------------------- -- Records of success_killed -- ---------------------------- INSERT INTO `success_killed` VALUES ('1000', '15201351122', '0', '2016-12-07 20:02:40'); INSERT INTO `success_killed` VALUES ('1000', '15201351133', '0', '2016-12-08 09:24:47'); INSERT INTO `success_killed` VALUES ('1000', '15201351234', '0', '2016-12-07 19:59:54'); INSERT INTO `success_killed` VALUES ('1001', '15201351234', '0', '2016-12-07 15:09:49'); INSERT INTO `success_killed` VALUES ('1001', '15201358461', '-1', '2016-12-07 14:57:19'); INSERT INTO `success_killed` VALUES ('1002', '15201351111', '-1', '2016-12-07 14:57:06'); INSERT INTO `success_killed` VALUES ('1002', '15201358400', '-1', '2016-12-07 14:56:53'); INSERT INTO `success_killed` VALUES ('1002', '15201358461', '-1', '2016-12-07 14:55:38');
DROP TABLE IF EXISTS `goods`; CREATE TABLE `goods` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `goods_name` varchar(50) DEFAULT NULL, `order_taker` varchar(50) DEFAULT NULL, `publish_man` varchar(50) DEFAULT NULL, `status` int(11) NOT NULL DEFAULT '0', `start_place` varchar(50) DEFAULT NULL, `start_province` varchar(20) DEFAULT NULL, `start_city` varchar(20) DEFAULT NULL, `start_area` varchar(20) DEFAULT NULL, `start_place_detail` varchar(255) DEFAULT NULL, `end_place` varchar(50) DEFAULT NULL, `end_province` varchar(20) DEFAULT NULL, `end_city` varchar(20) DEFAULT NULL, `end_area` varchar(20) DEFAULT NULL, `end_place_detail` varchar(255) DEFAULT NULL, `car_long` varchar(50) DEFAULT NULL, `car_type` varchar(50) DEFAULT NULL, `price_source` varchar(10) DEFAULT NULL, `load_type` varchar(20) DEFAULT NULL, `load_time` bigint(20) DEFAULT NULL, `pay_type` varchar(10) DEFAULT NULL, `price` int(11) DEFAULT NULL, `comment` varchar(150) DEFAULT NULL, `goods_weight` int(11) DEFAULT NULL, `goods_volume` int(11) DEFAULT NULL, `create_time` datetime DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=28 DEFAULT CHARSET=utf8;
-- phpMyAdmin SQL Dump -- version 4.7.4 -- https://www.phpmyadmin.net/ -- -- Servidor: localhost -- Tiempo de generación: 19-12-2017 a las 19:08:48 -- Versión del servidor: 10.1.28-MariaDB -- Versión de PHP: 7.1.11 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET AUTOCOMMIT = 0; START TRANSACTION; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8mb4 */; -- -- Base de datos: `booksnet` -- -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `book` -- CREATE TABLE `book` ( `id` int(11) NOT NULL, `title` tinytext NOT NULL, `author` tinytext NOT NULL, `genre` tinytext NOT NULL, `publication` tinytext NOT NULL, `image` tinytext NOT NULL, `description` tinytext NOT NULL, `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Volcado de datos para la tabla `book` -- INSERT INTO `book` (`id`, `title`, `author`, `genre`, `publication`, `image`, `description`, `created_at`, `updated_at`) VALUES (1, 'gdfgfdg', 'dfgdfg', 'dfgdfg', '2017-12-21', 'dfgdfg', 'dfgfdgdfg', '2017-12-15 18:57:13', '2017-12-15 18:57:13'); -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `invitacion` -- CREATE TABLE `invitacion` ( `id` int(11) NOT NULL, `email` tinytext NOT NULL, `used` int(11) NOT NULL, `created_at` int(11) NOT NULL, `updated_at` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Volcado de datos para la tabla `invitacion` -- INSERT INTO `invitacion` (`id`, `email`, `used`, `created_at`, `updated_at`) VALUES (1, 'sdkgjbsdg@gmail.com', 0, 2017, 2017), (2, 'manolito@gmail.com', 0, 2017, 2017), (3, '', 0, 2017, 2017), (4, 'wwwww@gamail.com', 0, 2017, 2017), (5, 'jdsfbosdgjnosgnosbn@gmail.com', 0, 2017, 2017); -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `user` -- CREATE TABLE `user` ( `id` int(11) NOT NULL, `name` text NOT NULL, `email` text NOT NULL, `password` text NOT NULL, `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Volcado de datos para la tabla `user` -- INSERT INTO `user` (`id`, `name`, `email`, `password`, `created_at`, `updated_at`) VALUES (8, 'thinway', 'thinway@ymail.com', '$2y$10$ftG6n.AecTx55kb41WPNcOwzLI4TDpZccPFD8TlQ2dO.ist/DN9gm', '2017-12-05 22:06:44', '2017-12-05 22:06:44'), (0, 'gdsfgsdfg', 'wwww@gmail.com', '$2y$10$OvcN2IjzzJNHreQY4HA7uOnGko.T.jmyOpt/D1r5U7QONVzewoZP.', '2017-12-15 19:44:04', '2017-12-15 19:44:04'), (0, 'pepito', 'pepito@gmail.com', '$2y$10$yGPVuYmrXOfkdO2aEwnfWe2sxDuaExezlzb0PkaGIobwQLjiPXvNq', '2017-12-15 22:46:13', '2017-12-15 22:46:13'), (0, 'joselito', 'pepe@gmail.com', '$2y$10$DcjS3Vq.3UNJ0zRFqU.eSONrJPwo6CLHKrRDQlziI1m.CYwL5pAUW', '2017-12-15 22:52:02', '2017-12-15 22:52:02'); -- -- Índices para tablas volcadas -- -- -- Indices de la tabla `book` -- ALTER TABLE `book` ADD PRIMARY KEY (`id`); -- -- Indices de la tabla `invitacion` -- ALTER TABLE `invitacion` ADD PRIMARY KEY (`id`); -- -- AUTO_INCREMENT de las tablas volcadas -- -- -- AUTO_INCREMENT de la tabla `book` -- ALTER TABLE `book` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; -- -- AUTO_INCREMENT de la tabla `invitacion` -- ALTER TABLE `invitacion` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6; COMMIT; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
DROP TABLE IF EXISTS Toys; DROP TABLE IF EXISTS cattoys; DROP TABLE IF EXISTS Cats; CREATE TABLE Cats ( ID SERIAL PRIMARY KEY, Name VARCHAR(255), Color VARCHAR(255), Breed VARCHAR(255) ); CREATE TABLE Toys ( ID SERIAL PRIMARY KEY, Price INT, Color VARCHAR(255), Name VARCHAR(255) ); CREATE TABLE cattoys ( ID SERIAL PRIMARY KEY, CatID INT NOT NULL, ToyID INT, FOREIGN KEY (CatID) REFERENCES Cats(id), FOREIGN KEY (ToyID) REFERENCES Toys(id) ); INSERT INTO Cats ( Name, Color, Breed ) VALUES ( 'Swaggy', 'Tabby', 'Mixed' ); INSERT INTO Cats ( Name, Color, Breed ) VALUES ( 'Rabies', 'Black', 'Burmese' ); INSERT INTO Cats ( Name, Color, Breed ) VALUES ( 'Archimedes', 'Blue', 'Burmese' ); INSERT INTO Cats ( Name, Color, Breed ) VALUES ( 'Pythagoras', 'White', 'Burmese' ); INSERT INTO Cats ( Name, Color, Breed ) VALUES ( 'Oppenheimer', 'Sphynx', 'Burmese' ); INSERT INTO Toys ( Price, Color, Name ) VALUES ( 5000, 'Diamond', 'Julia''s diamond necklace' ); INSERT INTO Toys ( Price, Color, Name ) VALUES ( 5000, 'toy colored', 'toy' ); INSERT INTO Toys ( Price, Color, Name ) VALUES ( 0, 'white, black, brown, red', 'Dead Mouse' ); INSERT INTO Toys ( Price, Color, Name ) VALUES ( 2000, 'Black', 'Leather Couch' ); INSERT INTO Toys ( Price, Color, Name ) VALUES ( 1, 'Red', 'Ball of yarn' ); INSERT INTO Toys ( Price, Color, Name ) VALUES ( 1, 'Green', 'Cucumber' ); INSERT INTO cattoys ( CatID, ToyID ) VALUES ( 1, 5 ); INSERT INTO cattoys ( CatID, ToyID ) VALUES ( 2, 3 ); INSERT INTO cattoys ( CatID, ToyID ) VALUES ( 3, 3 ); INSERT INTO cattoys ( CatID, ToyID ) VALUES ( 4, 2 ); INSERT INTO cattoys ( CatID, ToyID ) VALUES ( 5, 1 );
drop table if exists opus_hack.groups; drop table if exists opus_hack.categories; drop table if exists opus_hack.param_info; drop table if exists opus_hack.images drop table if exists opus_hack.partables create table opus_hack.groups select * from groups; create table opus_hack.categories select * from categories; create table opus_hack.param_info select * from param_info; create table opus_hack.images select * from images; create table opus_hack.partables like partables; insert into opus_hack.partables select * from partables create table opus_hack.django_admin_log like django_admin_log; create table opus_hack.django_content_type like django_content_type; create table opus_hack.django_session like django_session; create table opus_hack.django_site like django_site ; insert into opus_hack.django_admin_log select * from django_admin_log; insert into opus_hack.django_content_type select * from django_content_type; insert into opus_hack.django_session select * from django_session; insert into opus_hack.django_site select * from django_site; drop table if exists opus_hack.guide_example; drop table if exists opus_hack.guide_group; drop table if exists opus_hack.guide_keyvalue; drop table if exists opus_hack.guide_resource; create table opus_hack.guide_example select * from guide_example; create table opus_hack.guide_group select * from guide_group; create table opus_hack.guide_keyvalue select * from guide_keyvalue; create table opus_hack.guide_resource select * from guide_resource;
-- MySQL Script generated by MySQL Workbench -- 05/24/15 00:18:54 -- Model: New Model Version: 1.0 -- MySQL Workbench Forward Engineering SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0; SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0; SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES'; -- ----------------------------------------------------- -- Schema lanche -- ----------------------------------------------------- -- ----------------------------------------------------- -- Schema lanche -- ----------------------------------------------------- CREATE SCHEMA IF NOT EXISTS `lanche` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ; USE `lanche` ; -- ----------------------------------------------------- -- Table `lanche`.`Lanche` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `lanche`.`Lanche` ( `idLanche` INT NOT NULL AUTO_INCREMENT, `descricao` VARCHAR(45) NOT NULL, `preco` DECIMAL(10,2) NOT NULL, `dtCadastro` DATETIME NULL, `dtModificacao` DATETIME NULL, `ativo` TINYINT(1) NOT NULL DEFAULT 1, PRIMARY KEY (`idLanche`)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `lanche`.`Opcionais` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `lanche`.`Opcionais` ( `idOpcionais` INT NOT NULL AUTO_INCREMENT, `descricao` VARCHAR(45) NOT NULL, `precoAdicional` DECIMAL(10,2) NOT NULL DEFAULT 0, `permiteMaisQueUm` TINYINT(1) NULL, `dtCadastro` DATETIME NULL, `dtModificacao` DATETIME NULL, PRIMARY KEY (`idOpcionais`)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `lanche`.`LancheXOpcionais` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `lanche`.`LancheXOpcionais` ( `fkLanche` INT NOT NULL, `fkOpcionais` INT NOT NULL, `dtCadastro` DATETIME NULL, INDEX `fk_Lanche_has_Opcionais_Opcionais1_idx` (`fkOpcionais` ASC), INDEX `fk_Lanche_has_Opcionais_Lanche_idx` (`fkLanche` ASC), PRIMARY KEY (`fkLanche`, `fkOpcionais`), CONSTRAINT `fk_Lanche_has_Opcionais_Lanche` FOREIGN KEY (`fkLanche`) REFERENCES `lanche`.`Lanche` (`idLanche`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `fk_Lanche_has_Opcionais_Opcionais1` FOREIGN KEY (`fkOpcionais`) REFERENCES `lanche`.`Opcionais` (`idOpcionais`) ON DELETE CASCADE ON UPDATE CASCADE) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `lanche`.`Usuario` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `lanche`.`Usuario` ( `idUsuario` INT NOT NULL AUTO_INCREMENT, `nome` VARCHAR(45) NOT NULL, `sobrenome` VARCHAR(100) NOT NULL, `dataNascimento` DATE NULL, `turma` VARCHAR(45) NULL, `funcao` INT NOT NULL DEFAULT 1 COMMENT '1 Aluno\n2 Professor\n3 Atendente', `password` VARCHAR(200) NOT NULL, `ativo` TINYINT(1) NOT NULL DEFAULT 0, PRIMARY KEY (`idUsuario`)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `lanche`.`Pedido` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `lanche`.`Pedido` ( `idPedido` INT NOT NULL AUTO_INCREMENT, `fkUsuario` INT NULL, `dtCriacao` DATETIME NULL, `dtModificacao` DATETIME NULL, `status` INT NULL DEFAULT 0, PRIMARY KEY (`idPedido`), INDEX `fk_usuario_idx` (`fkUsuario` ASC), CONSTRAINT `fk_usuario` FOREIGN KEY (`fkUsuario`) REFERENCES `lanche`.`Usuario` (`idUsuario`) ON DELETE RESTRICT ON UPDATE CASCADE) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `lanche`.`ItemPedido` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `lanche`.`ItemPedido` ( `idItemPedido` INT NOT NULL AUTO_INCREMENT, `numItem` INT NOT NULL, `fkLanche` INT NOT NULL, `fkPedido` INT NOT NULL, `quantidade` INT NOT NULL DEFAULT 0, PRIMARY KEY (`idItemPedido`), INDEX `fk_Lanche_has_Pedido_Pedido1_idx` (`fkPedido` ASC), INDEX `fk_Lanche_has_Pedido_Lanche1_idx` (`fkLanche` ASC), CONSTRAINT `fk_Lanche_has_Pedido_Lanche1` FOREIGN KEY (`fkLanche`) REFERENCES `lanche`.`Lanche` (`idLanche`) ON DELETE RESTRICT ON UPDATE CASCADE, CONSTRAINT `fk_Lanche_has_Pedido_Pedido1` FOREIGN KEY (`fkPedido`) REFERENCES `lanche`.`Pedido` (`idPedido`) ON DELETE CASCADE ON UPDATE CASCADE) ENGINE = InnoDB COMMENT = ' '; -- ----------------------------------------------------- -- Table `lanche`.`OpcionaisItemPedido` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `lanche`.`OpcionaisItemPedido` ( `fkItemPedido` INT NOT NULL, `fkOpcionais` INT NOT NULL, `quantidade` INT NOT NULL DEFAULT 1, PRIMARY KEY (`fkItemPedido`, `fkOpcionais`), INDEX `fk_ItemPedido_has_Opcionais_Opcionais1_idx` (`fkOpcionais` ASC), INDEX `fk_ItemPedido_has_Opcionais_ItemPedido1_idx` (`fkItemPedido` ASC), CONSTRAINT `fk_ItemPedido_has_Opcionais_ItemPedido1` FOREIGN KEY (`fkItemPedido`) REFERENCES `lanche`.`ItemPedido` (`idItemPedido`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `fk_ItemPedido_has_Opcionais_Opcionais1` FOREIGN KEY (`fkOpcionais`) REFERENCES `lanche`.`Opcionais` (`idOpcionais`) ON DELETE RESTRICT ON UPDATE CASCADE) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `lanche`.`HistoricoPrecos` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `lanche`.`HistoricoPrecos` ( `idHistoricoPrecos` INT NOT NULL AUTO_INCREMENT, `fkLanche` INT NOT NULL, `dtHistorico` DATETIME NULL, `precoAnterior` DECIMAL(10,2) NULL, PRIMARY KEY (`idHistoricoPrecos`), INDEX `fk_HistoricoPrecos_Lanche1_idx` (`fkLanche` ASC), CONSTRAINT `fk_HistoricoPrecos_Lanche1` FOREIGN KEY (`fkLanche`) REFERENCES `lanche`.`Lanche` (`idLanche`) ON DELETE CASCADE ON UPDATE CASCADE) ENGINE = InnoDB; SET SQL_MODE=@OLD_SQL_MODE; SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
CREATE TABLE `ship` ( `shipping_id` VARCHAR(40) NOT NULL, `item_id` VARCHAR(40) NOT NULL, `quantity` INTEGER(40) NOT NULL, `weight_KG` INTEGER(40) NOT NULL, `shipper_name` VARCHAR(40) NOT NULL, `shipper_email` VARCHAR(40) NOT NULL, `receiver_name` VARCHAR(40) NOT NULL, `receiver_address` VARCHAR(40) NOT NULL, `receiver_contact` VARCHAR(40) NOT NULL, `Import_time` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`shipping_id`) ); select sum(quantity) from ship where item_id = "item1"; INSERT INTO stock(quantity) VALUES 1 where item_id = `item1`; select sum(quantity) from ship where item_id = "item1"; drop tables ship; select * from ship; CREATE TABLE `additem` ( `additem_id` int(40) NOT NULL, `item_id` VARCHAR(40) NOT NULL, `quantity` INTEGER(40) NOT NULL, `add_time` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ); ALTER TABLE `additem` ADD PRIMARY KEY (`additem_id`); ALTER TABLE `additem` MODIFY `additem_id` int(40) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; drop tables additem; select * from additem; INSERT INTO additem(item_id, quantity) VALUES("item1", 70); INSERT INTO additem(item_id, quantity) VALUES("item2", 1); INSERT INTO additem(item_id, quantity) VALUES("item3", 1); INSERT INTO additem(item_id, quantity) VALUES("item4", 1); select additem-ship as stock from (select sum(quantity) as additem from additem where item_id = "item1") as additem, (select sum(quantity) as ship from ship where item_id = "item1") as ship; INSERT INTO additem(item_id, quantity) VALUES("item1", 123); select sum(quantity) as additem from additem where item_id = "item1"; select sum(quantity) as ship from ship where item_id = "item1"; select sum(a.quantity),sum(b.quantity) as stock from additem a, ship b where a.item_id = b.item_id and a.item_id = "item1"; select sum(a.quantity-b.quantity) as stock from additem a, ship b where a.item_id = b.item_id and a.item_id = "item2"; select sum(a.quantity-b.quantity) as stock from additem a, ship b where a.item_id = b.item_id and a.item_id = "item3"; select sum(a.quantity-b.quantity) as stock from additem a, ship b where a.item_id = b.item_id and a.item_id = "item4"; insert into ship(shipping_id, item_id, quantity, weight_KG, shipper_name, shipper_email, receiver_name, receiver_address, receiver_contact) VALUES('ship1','item1',88,88,'EDMOND','SB@www','YIN','Tsim Sha Tsui SCOPE CP3LT1','999'),('ship2','item2',87,87,'Cheeper','0NX@www','COW','Tsim Sha Tsui SCOPE L1-2301','911'),('ship3','item1',54,54,'EDMOND','SB@www','YIN','Tsim Sha Tsui SCOPE CP3LT1','999')
# --- Created by Ebean DDL # To stop Ebean DDL generation, remove this comment and start using Evolutions # --- !Ups create table payment_history ( id number(19) not null, receipt_id varchar2(255), sales_man_id number(19), sales_date timestamp, prev_due number(19,4), paid number(19,4), current_due number(19,4), constraint pk_payment_history primary key (id)) ; create table product ( id number(19) not null, product_name varchar2(255), product_code varchar2(255), product_price number(19,4), product_quantity number(19,4), constraint pk_product primary key (id)) ; create table receipts ( id number(19) not null, receipt_id varchar2(255), product_id number(19), product_quantity number(19,4), sales_man_id number(19), sales_date timestamp, total_price number(19,4), constraint pk_receipts primary key (id)) ; create table sales_man ( id number(19) not null, sales_name varchar2(255), sales_address varchar2(255), sales_contact varchar2(255), sales_tot_due number(19,4), constraint pk_sales_man primary key (id)) ; create sequence payment_history_seq; create sequence product_seq; create sequence receipts_seq; create sequence sales_man_seq; alter table receipts add constraint fk_receipts_productId_1 foreign key (product_id) references product (id); create index ix_receipts_productId_1 on receipts (product_id); # --- !Downs drop table payment_history cascade constraints purge; drop table product cascade constraints purge; drop table receipts cascade constraints purge; drop table sales_man cascade constraints purge; drop sequence payment_history_seq; drop sequence product_seq; drop sequence receipts_seq; drop sequence sales_man_seq;
select * from UserSegmentation.EngagedUsers
-- phpMyAdmin SQL Dump -- version 4.9.1 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Waktu pembuatan: 21 Jul 2020 pada 16.12 -- Versi server: 10.4.8-MariaDB -- Versi PHP: 7.3.11 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET AUTOCOMMIT = 0; START TRANSACTION; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8mb4 */; -- -- Database: `db_sikopsi` -- -- -------------------------------------------------------- -- -- Struktur dari tabel `admin` -- CREATE TABLE `admin` ( `id_admin` int(2) NOT NULL, `nama_admin` varchar(64) NOT NULL, `username_admin` varchar(64) NOT NULL, `pswd_admin` varchar(64) NOT NULL, `lvl_admin` varchar(1) NOT NULL, `img_admin` varchar(128) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data untuk tabel `admin` -- INSERT INTO `admin` (`id_admin`, `nama_admin`, `username_admin`, `pswd_admin`, `lvl_admin`, `img_admin`) VALUES (4, 'Administrator', 'adminku', '$2y$10$1mmp4qxzsK9O9dGfDfHx9.foIzUmViKmcCS7gZ3aXglS3qbq9fo/S', '1', 'adminku.png'), (12, 'Syahrul Mubarok', 'syahrul', '$2y$10$YBZ.JqMfZmrKNOPCgk424OHKV49Gy/W9J/iaAgr7tA4jkKPpBnAVW', '2', 'default.png'); -- -------------------------------------------------------- -- -- Struktur dari tabel `anggota` -- CREATE TABLE `anggota` ( `id_anggota` int(11) NOT NULL, `nama_anggota` varchar(128) NOT NULL, `alamat_anggota` varchar(512) NOT NULL, `rt_anggota` varchar(4) NOT NULL, `rw_anggota` varchar(4) NOT NULL, `desa_anggota` varchar(64) NOT NULL, `kec_anggota` varchar(64) NOT NULL, `kab_anggota` varchar(64) NOT NULL, `prov_anggota` varchar(64) NOT NULL, `nohp_anggota` varchar(14) NOT NULL, `usaha_anggota` varchar(64) NOT NULL, `kd_resort` varchar(2) NOT NULL, `id_hari` int(2) NOT NULL, `id_admin` int(2) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data untuk tabel `anggota` -- INSERT INTO `anggota` (`id_anggota`, `nama_anggota`, `alamat_anggota`, `rt_anggota`, `rw_anggota`, `desa_anggota`, `kec_anggota`, `kab_anggota`, `prov_anggota`, `nohp_anggota`, `usaha_anggota`, `kd_resort`, `id_hari`, `id_admin`) VALUES (10, 'Syahrul Mubarok', 'Pengawinan', '24', '05', 'tembok luwung', 'adiwerna', 'tegal', 'jawa tengah', '0822892712', 'Freelancer', 'C', 2, 4), (11, 'Ari Setiawan', 'slawi', '02', '02', 'slawi', 'slawi', 'tegal', 'jateng', '0820802', 'videografi', 'E', 3, 4); -- -------------------------------------------------------- -- -- Struktur dari tabel `angsuran` -- CREATE TABLE `angsuran` ( `id_angsuran` int(11) NOT NULL, `tgl_angsuran` date NOT NULL, `angsuran_ke` varchar(4) NOT NULL, `nominal_angsuran` int(12) NOT NULL, `id_admin` int(2) NOT NULL, `no_peminjaman` varchar(12) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data untuk tabel `angsuran` -- INSERT INTO `angsuran` (`id_angsuran`, `tgl_angsuran`, `angsuran_ke`, `nominal_angsuran`, `id_admin`, `no_peminjaman`) VALUES (9, '2020-07-14', '1', 144000, 4, '20200713-002'), (10, '2020-07-15', '2', 144000, 4, '20200713-002'), (11, '2020-07-16', '3', 144000, 4, '20200713-002'), (12, '2020-07-17', '4', 144000, 4, '20200713-002'), (13, '2020-07-18', '5', 144000, 4, '20200713-002'), (14, '2020-07-19', '6', 144000, 4, '20200713-002'), (15, '2020-07-20', '7', 144000, 4, '20200713-002'), (16, '2020-07-21', '8', 144000, 4, '20200713-002'), (17, '2020-07-22', '9', 144000, 4, '20200713-002'), (18, '2020-07-24', '10', 144000, 4, '20200713-002'); -- -------------------------------------------------------- -- -- Struktur dari tabel `berita` -- CREATE TABLE `berita` ( `id_berita` int(11) NOT NULL, `judul_berita` varchar(256) NOT NULL, `isi_berita` text NOT NULL, `tgl_berita` date NOT NULL, `img_berita` varchar(128) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data untuk tabel `berita` -- INSERT INTO `berita` (`id_berita`, `judul_berita`, `isi_berita`, `tgl_berita`, `img_berita`) VALUES (1, 'Hello World', '<p><span style=\"font-size: 1.5rem; font-family: \" times=\"\" new=\"\" roman\";\"=\"\">Lorem ipsum dolor, sit amet consectetur adipisicing elit. Quam ipsa delectus saepe optio nesciunt! Beatae at sed vitae, cumque dolorum fugit laudantium dolor reprehenderit aperiam quaerat vel? Illo, quo obcaecati</span></p>', '2020-04-24', 'f0531bdac0a2f8cb5a31a85d979c127e.png'); -- -------------------------------------------------------- -- -- Struktur dari tabel `hari` -- CREATE TABLE `hari` ( `id_hari` int(2) NOT NULL, `nama_hari` varchar(7) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data untuk tabel `hari` -- INSERT INTO `hari` (`id_hari`, `nama_hari`) VALUES (1, 'Senin'), (2, 'Selasa'), (3, 'Rabu'), (4, 'Kamis'), (5, 'Jum\'at'), (6, 'Sabtu'); -- -------------------------------------------------------- -- -- Struktur dari tabel `karyawan` -- CREATE TABLE `karyawan` ( `id_karyawan` int(11) NOT NULL, `nama_karyawan` varchar(64) NOT NULL, `tgl_lahir` date NOT NULL, `alamat` text NOT NULL, `masa_kerja` int(5) NOT NULL, `jabatan` varchar(16) NOT NULL, `diangkat` date NOT NULL, `golongan` varchar(2) NOT NULL, `kd_resort` varchar(2) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data untuk tabel `karyawan` -- INSERT INTO `karyawan` (`id_karyawan`, `nama_karyawan`, `tgl_lahir`, `alamat`, `masa_kerja`, `jabatan`, `diangkat`, `golongan`, `kd_resort`) VALUES (2, 'Novita Sari', '1998-10-10', 'Slawi', 2, 'Admin', '2017-02-12', 'A', '-'); -- -------------------------------------------------------- -- -- Struktur dari tabel `peminjaman` -- CREATE TABLE `peminjaman` ( `no_peminjaman` varchar(12) NOT NULL, `tgl_drop` date NOT NULL, `pinjaman_pokok` int(11) NOT NULL, `jasa_peminjaman` int(12) NOT NULL, `jasa_pelayanan` int(12) NOT NULL, `resiko_kredit` int(12) NOT NULL, `total_pinjaman` int(12) NOT NULL, `angsuran` int(4) NOT NULL, `id_anggota` int(11) NOT NULL, `id_admin` int(2) NOT NULL, `keterangan` varchar(6) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data untuk tabel `peminjaman` -- INSERT INTO `peminjaman` (`no_peminjaman`, `tgl_drop`, `pinjaman_pokok`, `jasa_peminjaman`, `jasa_pelayanan`, `resiko_kredit`, `total_pinjaman`, `angsuran`, `id_anggota`, `id_admin`, `keterangan`) VALUES ('20200713-001', '2020-07-13', 930000, 83700, 83700, 18600, 1116000, 10, 11, 4, 'Proses'), ('20200713-002', '2020-07-13', 1200000, 108000, 108000, 24000, 1440000, 10, 10, 4, 'Lunas'); -- -------------------------------------------------------- -- -- Struktur dari tabel `resort` -- CREATE TABLE `resort` ( `kd_resort` varchar(2) NOT NULL, `nama_resort` varchar(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data untuk tabel `resort` -- INSERT INTO `resort` (`kd_resort`, `nama_resort`) VALUES ('B', 'BUGENVIL'), ('C', 'CEMPAKA'), ('D', 'DAHLIA'), ('E', 'ESTER'), ('F', 'FLAMBOYAN'), ('G', 'GADING'), ('H', 'HARUM'); -- -------------------------------------------------------- -- -- Struktur dari tabel `simpanan` -- CREATE TABLE `simpanan` ( `id_simpanan` int(11) NOT NULL, `no_peminjaman` varchar(12) NOT NULL, `id_anggota` int(11) NOT NULL, `tgl_drop_simpanan` date NOT NULL, `simpanan` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data untuk tabel `simpanan` -- INSERT INTO `simpanan` (`id_simpanan`, `no_peminjaman`, `id_anggota`, `tgl_drop_simpanan`, `simpanan`) VALUES (10, '20200713-002', 10, '2020-07-13', 60000); -- -- Indexes for dumped tables -- -- -- Indeks untuk tabel `admin` -- ALTER TABLE `admin` ADD PRIMARY KEY (`id_admin`); -- -- Indeks untuk tabel `anggota` -- ALTER TABLE `anggota` ADD PRIMARY KEY (`id_anggota`), ADD KEY `id_admin` (`id_admin`), ADD KEY `id_hari` (`id_hari`), ADD KEY `kd_resort` (`kd_resort`); -- -- Indeks untuk tabel `angsuran` -- ALTER TABLE `angsuran` ADD PRIMARY KEY (`id_angsuran`), ADD KEY `id_admin` (`id_admin`), ADD KEY `no_peminjaman` (`no_peminjaman`); -- -- Indeks untuk tabel `berita` -- ALTER TABLE `berita` ADD PRIMARY KEY (`id_berita`); -- -- Indeks untuk tabel `hari` -- ALTER TABLE `hari` ADD PRIMARY KEY (`id_hari`); -- -- Indeks untuk tabel `karyawan` -- ALTER TABLE `karyawan` ADD PRIMARY KEY (`id_karyawan`), ADD KEY `kd_resort` (`kd_resort`); -- -- Indeks untuk tabel `peminjaman` -- ALTER TABLE `peminjaman` ADD PRIMARY KEY (`no_peminjaman`), ADD KEY `id_anggota` (`id_anggota`), ADD KEY `id_admin` (`id_admin`); -- -- Indeks untuk tabel `resort` -- ALTER TABLE `resort` ADD PRIMARY KEY (`kd_resort`); -- -- Indeks untuk tabel `simpanan` -- ALTER TABLE `simpanan` ADD PRIMARY KEY (`id_simpanan`), ADD KEY `id_anggota` (`id_anggota`), ADD KEY `no_peminjaman` (`no_peminjaman`); -- -- AUTO_INCREMENT untuk tabel yang dibuang -- -- -- AUTO_INCREMENT untuk tabel `admin` -- ALTER TABLE `admin` MODIFY `id_admin` int(2) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=13; -- -- AUTO_INCREMENT untuk tabel `anggota` -- ALTER TABLE `anggota` MODIFY `id_anggota` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12; -- -- AUTO_INCREMENT untuk tabel `angsuran` -- ALTER TABLE `angsuran` MODIFY `id_angsuran` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=19; -- -- AUTO_INCREMENT untuk tabel `berita` -- ALTER TABLE `berita` MODIFY `id_berita` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; -- -- AUTO_INCREMENT untuk tabel `hari` -- ALTER TABLE `hari` MODIFY `id_hari` int(2) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7; -- -- AUTO_INCREMENT untuk tabel `karyawan` -- ALTER TABLE `karyawan` MODIFY `id_karyawan` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3; -- -- AUTO_INCREMENT untuk tabel `simpanan` -- ALTER TABLE `simpanan` MODIFY `id_simpanan` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11; -- -- Ketidakleluasaan untuk tabel pelimpahan (Dumped Tables) -- -- -- Ketidakleluasaan untuk tabel `anggota` -- ALTER TABLE `anggota` ADD CONSTRAINT `anggota_ibfk_1` FOREIGN KEY (`id_admin`) REFERENCES `admin` (`id_admin`), ADD CONSTRAINT `anggota_ibfk_2` FOREIGN KEY (`id_hari`) REFERENCES `hari` (`id_hari`), ADD CONSTRAINT `anggota_ibfk_3` FOREIGN KEY (`kd_resort`) REFERENCES `resort` (`kd_resort`); -- -- Ketidakleluasaan untuk tabel `angsuran` -- ALTER TABLE `angsuran` ADD CONSTRAINT `angsuran_ibfk_1` FOREIGN KEY (`id_admin`) REFERENCES `admin` (`id_admin`), ADD CONSTRAINT `angsuran_ibfk_3` FOREIGN KEY (`no_peminjaman`) REFERENCES `peminjaman` (`no_peminjaman`); -- -- Ketidakleluasaan untuk tabel `peminjaman` -- ALTER TABLE `peminjaman` ADD CONSTRAINT `peminjaman_ibfk_1` FOREIGN KEY (`id_anggota`) REFERENCES `anggota` (`id_anggota`), ADD CONSTRAINT `peminjaman_ibfk_2` FOREIGN KEY (`id_admin`) REFERENCES `admin` (`id_admin`); -- -- Ketidakleluasaan untuk tabel `simpanan` -- ALTER TABLE `simpanan` ADD CONSTRAINT `simpanan_ibfk_2` FOREIGN KEY (`id_anggota`) REFERENCES `anggota` (`id_anggota`), ADD CONSTRAINT `simpanan_ibfk_3` FOREIGN KEY (`no_peminjaman`) REFERENCES `peminjaman` (`no_peminjaman`); 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 */;
DROP TABLE IF EXISTS clubs; CREATE TABLE clubs ( id INT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT, name VARCHAR(255) NOT NULL, country VARCHAR(255), city VARCHAR(255), created_at DATETIME DEFAULT current_timestamp(), updated_at DATETIME DEFAULT current_timestamp() ON UPDATE current_timestamp()); CREATE INDEX clubs_name_idx ON clubs(name); DROP TABLE IF EXISTS players; CREATE TABLE players ( id INT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT, club_id INT UNSIGNED, first_name VARCHAR(255) NOT NULL, last_name VARCHAR(255) NOT NULL, patronymic VARCHAR(255) COMMENT 'Отчество', created_at DATETIME DEFAULT current_timestamp(), updated_at DATETIME DEFAULT current_timestamp() ON UPDATE current_timestamp(), CONSTRAINT players_club_id_fk FOREIGN KEY (club_id) REFERENCES clubs(id) ON DELETE SET NULL); CREATE INDEX players_last_name_idx ON players(last_name); DROP TABLE IF EXISTS tournaments; CREATE TABLE tournaments ( id INT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT, name VARCHAR(255) NOT NULL COMMENT 'Название турнира', type ENUM('cup','championat') NOT NULL COMMENT 'Тип турнира', date_start DATE COMMENT 'Дата начала турнира', date_finish DATE COMMENT 'Дата окончания турнира', created_at DATETIME DEFAULT current_timestamp(), updated_at DATETIME DEFAULT current_timestamp() ON UPDATE current_timestamp()); CREATE INDEX tournaments_name_idx ON tournaments(name); DROP TABLE IF EXISTS tournaments_clubs; CREATE TABLE tournaments_clubs ( tournament_id INT UNSIGNED NOT NULL, club_id INT UNSIGNED NOT NULL, matches_complited TINYINT UNSIGNED NOT NULL COMMENT 'Колличество проведенных матчей клубом в данном турнире', matches_win TINYINT UNSIGNED NOT NULL COMMENT 'Колличество выигранных матчей клубом в данном турнире', matches_draw TINYINT UNSIGNED NOT NULL COMMENT 'Колличество ничейных матчей клубом в данном турнире', matches_loose TINYINT UNSIGNED NOT NULL COMMENT 'Колличество проигранных матчей клубом в данном турнире', goals TINYINT UNSIGNED NOT NULL COMMENT 'Колличество забитых голов клубом в данном турнире', goals_against TINYINT UNSIGNED NOT NULL COMMENT 'Колличество пропущенных голов клубом в данном турнире', points TINYINT UNSIGNED NOT NULL COMMENT 'Колличество заработанных очков клубом в данном турнире', created_at DATETIME DEFAULT current_timestamp(), updated_at DATETIME DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (tournament_id,club_id), CONSTRAINT tournaments_clubs_tournament_id_fk FOREIGN KEY (tournament_id) REFERENCES tournaments(id) ON DELETE CASCADE, CONSTRAINT tournaments_clubs_club_id_fk FOREIGN KEY (club_id) REFERENCES clubs(id) ON DELETE CASCADE); DROP TABLE IF EXISTS profile_players; CREATE TABLE profile_players( id INT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT, player_id INT UNSIGNED NOT NULL, gender CHAR(1) NOT NULL, birthday DATE, country VARCHAR(255), number TINYINT UNSIGNED COMMENT 'Игровой номер игрока', amplua ENUM ('goalkeeper', 'defender', 'midfielder', 'forward') NOT NULL, height TINYINT UNSIGNED COMMENT 'Рост игрока', weight TINYINT UNSIGNED COMMENT 'Вес игрока', created_at DATETIME DEFAULT current_timestamp(), updated_at DATETIME DEFAULT current_timestamp() ON UPDATE current_timestamp(), CONSTRAINT profile_players_player_id_fk FOREIGN KEY (player_id) REFERENCES players(id) ON DELETE CASCADE); DROP TABLE IF EXISTS referees; CREATE TABLE referees ( id INT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT, first_name VARCHAR(255) NOT NULL, last_name VARCHAR(255) NOT NULL, patronymic VARCHAR(255), country VARCHAR(255), created_at DATETIME DEFAULT current_timestamp(), updated_at DATETIME DEFAULT current_timestamp() ON UPDATE current_timestamp()); DROP TABLE IF EXISTS stadiums; CREATE TABLE stadiums ( id INT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT, name VARCHAR(255) COMMENT 'Название стадиона', city VARCHAR(255), capacity INT UNSIGNED COMMENT 'Вместимость стадиона', created_at DATETIME DEFAULT current_timestamp(), updated_at DATETIME DEFAULT current_timestamp() ON UPDATE current_timestamp()); DROP TABLE IF EXISTS matches; CREATE TABLE matches ( id INT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT, home_club_id INT UNSIGNED NOT NULL, visiting_club_id INT UNSIGNED NOT NULL, tournament_id INT UNSIGNED NOT NULL, stadium_id INT UNSIGNED NOT NULL, referee_id INT UNSIGNED NOT NULL, start_time DATETIME NOT NULL COMMENT 'Дата и время начала матча', status ENUM ('not started', 'continue', 'finished') NOT NULL, created_at DATETIME DEFAULT current_timestamp(), updated_at DATETIME DEFAULT current_timestamp() ON UPDATE current_timestamp(), CONSTRAINT matches_home_club_id_fk FOREIGN KEY (home_club_id) REFERENCES clubs(id) ON DELETE NO ACTION, CONSTRAINT matches_visiting_club_id_fk FOREIGN KEY (visiting_club_id) REFERENCES clubs(id) ON DELETE NO ACTION, CONSTRAINT matches_tournament_id_fk FOREIGN KEY (tournament_id) REFERENCES tournaments(id) ON DELETE NO ACTION, CONSTRAINT matches_stadium_id_fk FOREIGN KEY (stadium_id) REFERENCES stadiums(id) ON DELETE NO ACTION, CONSTRAINT matches_referee_id_fk FOREIGN KEY (referee_id) REFERENCES referees(id) ON DELETE NO ACTION); DROP TABLE IF EXISTS matches_players; CREATE TABLE matches_players ( match_id INT UNSIGNED NOT NULL, player_id INT UNSIGNED NOT NULL, minute_in TINYINT UNSIGNED NOT NULL COMMENT 'Минута выхода игрока на поле', minute_out TINYINT UNSIGNED NOT NULL COMMENT 'Минута выхода игрока на поле', created_at DATETIME DEFAULT current_timestamp(), updated_at DATETIME DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (match_id,player_id), CONSTRAINT matches_players_match_id_fk FOREIGN KEY (match_id) REFERENCES matches(id) ON DELETE NO ACTION, CONSTRAINT matches_players_player_id_fk FOREIGN KEY (player_id) REFERENCES players(id) ON DELETE NO ACTION); DROP TABLE IF EXISTS goals; CREATE TABLE goals ( id SERIAL PRIMARY KEY, match_id INT UNSIGNED NOT NULL, club_id INT UNSIGNED NOT NULL, player_id INT UNSIGNED NOT NULL, minute_scored TINYINT UNSIGNED NOT NULL COMMENT 'Минута на которой был забит гол', created_at DATETIME DEFAULT current_timestamp(), updated_at DATETIME DEFAULT current_timestamp() ON UPDATE current_timestamp(), CONSTRAINT goals_match_id_fk FOREIGN KEY (match_id) REFERENCES matches(id) ON DELETE NO ACTION, CONSTRAINT goals_club_id_fk FOREIGN KEY (club_id) REFERENCES clubs(id) ON DELETE NO ACTION, CONSTRAINT goals_player_id_fk FOREIGN KEY (player_id) REFERENCES players(id) ON DELETE NO ACTION); DROP TABLE IF EXISTS passes; CREATE TABLE passes ( id SERIAL PRIMARY KEY, match_id INT UNSIGNED NOT NULL, player_id INT UNSIGNED NOT NULL, minute_pass TINYINT UNSIGNED NOT NULL COMMENT 'Минута на которой был выполнен голевой пас', created_at DATETIME DEFAULT current_timestamp(), updated_at DATETIME DEFAULT current_timestamp() ON UPDATE current_timestamp(), CONSTRAINT passes_match_id_fk FOREIGN KEY (match_id) REFERENCES matches(id) ON DELETE NO ACTION, CONSTRAINT passes_player_id_fk FOREIGN KEY (player_id) REFERENCES players(id) ON DELETE NO ACTION); DROP TABLE IF EXISTS cards; CREATE TABLE cards ( id INT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT, match_id INT UNSIGNED NOT NULL, club_id INT UNSIGNED NOT NULL, player_id INT UNSIGNED NOT NULL, color ENUM ('yellow', 'red') COMMENT 'Вид карточки', minute_get TINYINT UNSIGNED NOT NULL COMMENT 'Минута на которой получена карточка', created_at DATETIME DEFAULT current_timestamp(), updated_at DATETIME DEFAULT current_timestamp() ON UPDATE current_timestamp(), CONSTRAINT cards_match_id_fk FOREIGN KEY (match_id) REFERENCES matches(id) ON DELETE NO ACTION, CONSTRAINT cards_club_id_fk FOREIGN KEY (club_id) REFERENCES clubs(id) ON DELETE NO ACTION, CONSTRAINT cards_player_id_fk FOREIGN KEY (player_id) REFERENCES players(id) ON DELETE NO ACTION); DROP TABLE IF EXISTS statistic_matches; CREATE TABLE statistic_matches ( match_id INT UNSIGNED NOT NULL, club_id INT UNSIGNED NOT NULL, attempts TINYINT UNSIGNED COMMENT 'Колличество ударов', attempts_on_target TINYINT UNSIGNED COMMENT 'Колличество ударов в створ ворот', fouls TINYINT UNSIGNED COMMENT 'Колличество фолов', corners TINYINT UNSIGNED COMMENT 'Колличество угловых', offcides TINYINT UNSIGNED COMMENT 'Колличество оффсайдов', posessions TINYINT UNSIGNED COMMENT 'Процент владения мячом', attempts_blocked TINYINT UNSIGNED COMMENT 'Колличество заблокированных ударов', free_kicks TINYINT UNSIGNED COMMENT 'Колличество штрафных ударов', goal_kicks TINYINT UNSIGNED COMMENT 'Колличество ударов от ворот', outs TINYINT UNSIGNED COMMENT 'Колличество аутов', created_at DATETIME DEFAULT current_timestamp(), updated_at DATETIME DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (match_id,club_id), CONSTRAINT statistic_matches_match_id_fk FOREIGN KEY (match_id) REFERENCES matches(id) ON DELETE NO ACTION, CONSTRAINT statistic_matches_club_id_fk FOREIGN KEY (club_id) REFERENCES clubs(id) ON DELETE NO ACTION); DROP TABLE IF EXISTS tournaments_players; CREATE TABLE tournaments_players ( tournament_id INT UNSIGNED NOT NULL, player_id INT UNSIGNED NOT NULL, matches_complited TINYINT UNSIGNED NOT NULL COMMENT 'Колличество сыгранных матчей', matches_in_start TINYINT UNSIGNED NOT NULL COMMENT 'Колличество матчей в основе', matches_on_replace TINYINT UNSIGNED NOT NULL COMMENT 'Колличество матчей в которых игрок вышел на замену', matches_replaced TINYINT UNSIGNED NOT NULL COMMENT 'Колличество матчей в которых игрок был заменен', matches_in_reserve TINYINT UNSIGNED NOT NULL COMMENT 'Колличество матчей в запасе', minutes_on_field INT UNSIGNED NOT NULL COMMENT 'Колличество минут на поле', goals_scored TINYINT UNSIGNED NOT NULL COMMENT 'Колличество голов забил игрок', goals_conceded TINYINT UNSIGNED NOT NULL COMMENT 'Колличество голов пропущено, если амплуа goalkeeper', passes_complited TINYINT UNSIGNED NOT NULL COMMENT 'Колличество голевых пасов', yellow_cards TINYINT UNSIGNED NOT NULL COMMENT 'Колличество полученных желтных карточек', red_cards TINYINT UNSIGNED NOT NULL COMMENT 'Колличество полученных красных карточек', created_at DATETIME DEFAULT current_timestamp(), updated_at DATETIME DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (tournament_id,player_id), CONSTRAINT tournaments_players_tournament_id_fk FOREIGN KEY (tournament_id) REFERENCES tournaments(id) ON DELETE CASCADE, CONSTRAINT tournaments_players_player_id_fk FOREIGN KEY (player_id) REFERENCES players(id) ON DELETE CASCADE); DROP TABLE IF EXISTS media; CREATE TABLE media ( id INT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT, name VARCHAR(255) NOT NULL UNIQUE COMMENT 'Ссылка на файл', type ENUM ('image', 'video'), created_at DATETIME DEFAULT current_timestamp(), updated_at DATETIME DEFAULT current_timestamp() ON UPDATE current_timestamp()); DROP TABLE IF EXISTS authors; CREATE TABLE authors ( id INT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT, first_name VARCHAR(255) NOT NULL, last_name VARCHAR(255) NOT NULL, patronymic VARCHAR(255), created_at DATETIME DEFAULT current_timestamp(), updated_at DATETIME DEFAULT current_timestamp() ON UPDATE current_timestamp()); DROP TABLE IF EXISTS articles; CREATE TABLE articles ( id INT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT, author_id INT UNSIGNED NOT NULL, media_id INT UNSIGNED NOT NULL, date_publication DATETIME, head TEXT NOT NULL, body TEXT NOT NULL, created_at DATETIME DEFAULT current_timestamp(), updated_at DATETIME DEFAULT current_timestamp() ON UPDATE current_timestamp(), CONSTRAINT posts_author_id_fk FOREIGN KEY (author_id) REFERENCES authors(id) ON DELETE NO ACTION, CONSTRAINT posts_media_id_fk FOREIGN KEY (media_id) REFERENCES media(id) ON DELETE NO ACTION);
/* We're going to introduce some data quality here that needs to be carried through when using this table: - text with less than 2 characters is skipped - images with x or y < 100 are skipped - words who's x0, x1, y0, or y1 are within 10 of the edge of the image are skipped */ CREATE TABLE text_extent SELECT occid, min(area_x0) as min_area_x0, min(area_y0) as min_area_y0, max(area_x1) as max_area_x1, max(area_y1) as max_area_y1, min(line_x0) as min_line_x0, min(line_y0) as min_line_y0, max(line_x1) as max_line_x1, max(line_y1) as max_line_y1, min(word_x0) as min_word_x0, min(word_y0) as min_word_y0, max(word_x1) as max_word_x1, max(word_y1) as max_word_y1 FROM hocr_results WHERE x > 100 AND y > 100 AND area_x0 > 10 AND area_y0 > 10 AND area_x1 < (x - 10) AND area_y1 < (y - 10) AND line_x0 > 10 AND line_y0 > 10 AND line_x1 < (x - 10) AND line_y1 < (y - 10) AND word_x0 > 10 AND word_y0 > 10 AND word_x1 < (x - 10) AND word_y1 < (y - 10) AND LENGTH(TRIM(text))>1 GROUP BY occid; CREATE INDEX IF NOT EXISTS text_extent_occid ON text_extent(occid);
SET SQL DIALECT 3; SET NAMES NONE; CREATE DATABASE '127.0.0.1:C:\Interbase_DB\MEETINGORGANIZER.GDB' USER 'SYSDBA' PASSWORD 'masterkey' PAGE_SIZE 1024 DEFAULT CHARACTER SET NONE; /******************************************************************************/ /**** Generators ****/ /******************************************************************************/ CREATE GENERATOR GEN_AUTLOG_ID; SET GENERATOR GEN_AUTLOG_ID TO 0; CREATE GENERATOR GEN_MEETING_ID; SET GENERATOR GEN_MEETING_ID TO 0; CREATE GENERATOR GEN_MSGLOG_ID; SET GENERATOR GEN_MSGLOG_ID TO 0; CREATE GENERATOR GEN_ROOM_ID; SET GENERATOR GEN_ROOM_ID TO 0; CREATE GENERATOR GEN_USERS_ID; SET GENERATOR GEN_USERS_ID TO 0; /******************************************************************************/ /**** Tables ****/ /******************************************************************************/ CREATE TABLE AUTLOG ( AUTLOG_ID INTEGER NOT NULL, LOGINNAME VARCHAR(10), LOGINDATE DATE, LOGINTIME TIME ); CREATE TABLE MEETING ( MEETING_ID INTEGER NOT NULL, TOPIC VARCHAR(100), DURATION INTEGER, STARTDATE DATE, STARTTIME TIME, USER_ID INTEGER NOT NULL, ROOM_ID INTEGER NOT NULL, LASTCHANGE TIMESTAMP ); CREATE TABLE MSGLOG ( MSGLOG_ID INTEGER NOT NULL, EMAIL VARCHAR(60), MSG VARCHAR(256), SENT CHAR(1) ); CREATE TABLE PARTICIPANT ( USER_ID INTEGER NOT NULL, MEETING_ID INTEGER NOT NULL ); CREATE TABLE ROOM ( ROOM_ID INTEGER NOT NULL, LOCATION VARCHAR(50), NAME VARCHAR(30), CAPACITY INTEGER ); CREATE TABLE TIMESLOTS ( MEETINGTIME TIME NOT NULL ); CREATE TABLE USERS ( USER_ID INTEGER NOT NULL, NAME VARCHAR(40), EMAIL VARCHAR(60), PHONE VARCHAR(20), LOGIN VARCHAR(10), PASSW VARCHAR(10), ISADMIN CHAR(1) ); /******************************************************************************/ /**** Primary Keys ****/ /******************************************************************************/ ALTER TABLE AUTLOG ADD CONSTRAINT AUTLOG_PK PRIMARY KEY (AUTLOG_ID); ALTER TABLE MEETING ADD CONSTRAINT MEETING_PK PRIMARY KEY (MEETING_ID); ALTER TABLE MSGLOG ADD CONSTRAINT MSGLOG_PK PRIMARY KEY (MSGLOG_ID); ALTER TABLE PARTICIPANT ADD CONSTRAINT PARTICIPANT_PK PRIMARY KEY (USER_ID, MEETING_ID); ALTER TABLE ROOM ADD CONSTRAINT ROOM_PK PRIMARY KEY (ROOM_ID); ALTER TABLE TIMESLOTS ADD CONSTRAINT PK_TIMESLOTS PRIMARY KEY (MEETINGTIME); ALTER TABLE USERS ADD CONSTRAINT USERS_PK PRIMARY KEY (USER_ID); /******************************************************************************/ /**** Foreign Keys ****/ /******************************************************************************/ ALTER TABLE MEETING ADD CONSTRAINT MEETING_ROOM_FK FOREIGN KEY (ROOM_ID) REFERENCES ROOM (ROOM_ID); ALTER TABLE MEETING ADD CONSTRAINT MEETING_USERS_FK FOREIGN KEY (USER_ID) REFERENCES USERS (USER_ID); ALTER TABLE PARTICIPANT ADD CONSTRAINT PARTICIPANT_MEETING_FK FOREIGN KEY (MEETING_ID) REFERENCES MEETING (MEETING_ID); ALTER TABLE PARTICIPANT ADD CONSTRAINT PARTICIPANT_USERS_FK FOREIGN KEY (USER_ID) REFERENCES USERS (USER_ID); /******************************************************************************/ /**** Triggers ****/ /******************************************************************************/ SET TERM ^ ; /******************************************************************************/ /**** Triggers for tables ****/ /******************************************************************************/ /* Trigger: AUTLOG_BI */ CREATE TRIGGER AUTLOG_BI FOR AUTLOG ACTIVE BEFORE INSERT POSITION 0 AS BEGIN IF ((NEW.AUTLOG_ID IS NULL) OR (NEW.AUTLOG_ID = 0)) THEN NEW.AUTLOG_ID = GEN_ID(GEN_AUTLOG_ID,1); END ^ /* Trigger: MEETING_BI */ CREATE TRIGGER MEETING_BI FOR MEETING ACTIVE BEFORE INSERT POSITION 0 AS BEGIN IF ((NEW.MEETING_ID IS NULL) OR (NEW.MEETING_ID = 0)) THEN NEW.MEETING_ID = GEN_ID(GEN_MEETING_ID,1); END ^ /* Trigger: MSGLOG_BI */ CREATE TRIGGER MSGLOG_BI FOR MSGLOG ACTIVE BEFORE INSERT POSITION 0 AS BEGIN IF ((NEW.MSGLOG_ID IS NULL) OR (NEW.MSGLOG_ID = 0)) THEN NEW.MSGLOG_ID = GEN_ID(GEN_MSGLOG_ID,1); END ^ /* Trigger: ROOM_BI */ CREATE TRIGGER ROOM_BI FOR ROOM ACTIVE BEFORE INSERT POSITION 0 AS BEGIN IF ((NEW.ROOM_ID IS NULL) OR (NEW.ROOM_ID = 0)) THEN NEW.ROOM_ID = GEN_ID(GEN_ROOM_ID,1); END ^ /* Trigger: USERS_BI */ CREATE TRIGGER USERS_BI FOR USERS ACTIVE BEFORE INSERT POSITION 0 AS BEGIN IF ((NEW.USER_ID IS NULL) OR (NEW.USER_ID = 0)) THEN NEW.USER_ID = GEN_ID(GEN_USERS_ID,1); END ^ SET TERM ; ^ INSERT INTO USERS (USER_ID, NAME, EMAIL, PHONE, LOGIN, PASSW, ISADMIN) VALUES (0, 'Borland', 'esteam@borland.com', '1234567890', 'borland', 'borland', 'Y'); COMMIT;
-- MySQL Workbench Synchronization SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0; SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0; SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL'; DROP SCHEMA IF EXISTS `mydb` ; ALTER TABLE `game_of_thrones`.`AreaConnections` DROP FOREIGN KEY `fk_AreaConnections_nMainAreaID_Areas_nAreaID`, DROP FOREIGN KEY `fk_AreaConnections_nSurroundingAreaID_Areas_nAreaID`; ALTER TABLE `game_of_thrones`.`HouseAreaUnits` DROP FOREIGN KEY `fk_HouseAreaUnits_HouseAreas_nHouseAreaID`, DROP FOREIGN KEY `fk_HouseAreaUnits_Units_nUnitID`; ALTER TABLE `game_of_thrones`.`HouseAreas` DROP FOREIGN KEY `fk_HouseAreas_Areas_nAreaID`, DROP FOREIGN KEY `fk_HouseAreas_Houses_nHouseID`; CREATE TABLE IF NOT EXISTS `game_of_thrones`.`HouseCards` ( `nHouseCardID` INT(11) NOT NULL AUTO_INCREMENT COMMENT '', `cPersonName` VARCHAR(70) NOT NULL COMMENT '', `nHouseID` INT(11) NOT NULL COMMENT '', `nCombatStrength` INT(11) NOT NULL COMMENT '', PRIMARY KEY (`cPersonName`) COMMENT '', UNIQUE INDEX `uc_HouseCards_nHouseCardID` (`nHouseCardID` ASC) COMMENT '', INDEX `fk_HouseCards_Houses_nHouseID` (`nHouseID` ASC) COMMENT '', CONSTRAINT `fk_HouseCards_Houses_nHouseID` FOREIGN KEY (`nHouseID`) REFERENCES `game_of_thrones`.`Houses` (`nHouseID`) ON DELETE CASCADE ON UPDATE CASCADE) ENGINE = InnoDB AUTO_INCREMENT = 64 DEFAULT CHARACTER SET = latin1 COLLATE = latin1_swedish_ci; ALTER TABLE `game_of_thrones`.`AreaConnections` ADD CONSTRAINT `fk_AreaConnections_nMainAreaID_Areas_nAreaID` FOREIGN KEY (`nMainAreaID`) REFERENCES `game_of_thrones`.`Areas` (`nAreaID`) ON DELETE CASCADE ON UPDATE CASCADE, ADD CONSTRAINT `fk_AreaConnections_nSurroundingAreaID_Areas_nAreaID` FOREIGN KEY (`nSurroundingAreaID`) REFERENCES `game_of_thrones`.`Areas` (`nAreaID`) ON DELETE CASCADE ON UPDATE CASCADE; ALTER TABLE `game_of_thrones`.`HouseAreaUnits` ADD CONSTRAINT `fk_HouseAreaUnits_HouseAreas_nHouseAreaID` FOREIGN KEY (`nHouseAreaID`) REFERENCES `game_of_thrones`.`HouseAreas` (`nHouseAreaID`) ON DELETE CASCADE ON UPDATE CASCADE, ADD CONSTRAINT `fk_HouseAreaUnits_Units_nUnitID` FOREIGN KEY (`nUnitID`) REFERENCES `game_of_thrones`.`Units` (`nUnitID`) ON DELETE CASCADE ON UPDATE CASCADE; ALTER TABLE `game_of_thrones`.`HouseAreas` ADD CONSTRAINT `fk_HouseAreas_Areas_nAreaID` FOREIGN KEY (`nAreaID`) REFERENCES `game_of_thrones`.`Areas` (`nAreaID`) ON DELETE CASCADE ON UPDATE CASCADE, ADD CONSTRAINT `fk_HouseAreas_Houses_nHouseID` FOREIGN KEY (`nHouseID`) REFERENCES `game_of_thrones`.`Houses` (`nHouseID`) ON DELETE CASCADE ON UPDATE CASCADE; USE `game_of_thrones`; DROP procedure IF EXISTS `game_of_thrones`.`Utils_generateClass`; DELIMITER $$ USE `game_of_thrones`$$ CREATE DEFINER=`root`@`localhost` PROCEDURE `Utils_generateClass`(IN `@table` TEXT, IN `@singular` TEXT, IN `@plural` TEXT) BEGIN DECLARE sel TEXT; DECLARE class TEXT; DROP TABLE IF EXISTS myCols; DROP TABLE IF EXISTS myClass; CREATE TEMPORARY TABLE myClass( nID INT NOT NULL AUTO_INCREMENT PRIMARY KEY, myLine text, group_index int default 0 ); CREATE TEMPORARY TABLE myCols( nID INT NOT NULL AUTO_INCREMENT PRIMARY KEY, col_name text, col_type text, col_index int, group_index int default 0 ); INSERT INTO myCols(col_name, col_type, col_index) SELECT COLUMN_NAME, CASE WHEN DATA_TYPE = 'tinyint' THEN 'bool' WHEN DATA_TYPE IN ('text', 'varchar') THEN 'string' ELSE DATA_TYPE END, ORDINAL_POSITION - 1 FROM information_schema.COLUMNS WHERE table_schema = 'game_of_thrones' AND table_name = `@table`; INSERT INTO myClass(myLine) VALUES (CONCAT('module db_generated.', LCASE(`@plural`),';')) ,('import std.stdio;') ,('import db_generated.base;') ,('import std.variant;') ,('import std.conv;') ,('import mysql.connection;') ,('import mysql.protocol.commands;') ,('import mysql.result;') ,('import std.signals;\n') ,(CONCAT('class ', `@singular`, ' : ACBaseObject')) ,('{'); INSERT INTO myClass(myLine) SELECT CONCAT( REPEAT(' ', 4), 'private ', col_type, ' _', col_name, ';\n', REPEAT(' ', 4), 'public @property ', col_type, ' ', col_name, '()\n', REPEAT(' ', 4), '{\n', REPEAT(' ', 8), 'return _', col_name, ';\n', REPEAT(' ', 4), '}\n', REPEAT(' ', 4), 'public @property void ', col_name, '(', col_type, ' value)\n', REPEAT(' ', 4), '{\n', REPEAT(' ', 8), 'if (value != _', col_name, ')\n', REPEAT(' ', 8), '{\n', REPEAT(' ', 12), '_', col_name, ' = value;\n', REPEAT(' ', 12), 'notify("', col_name, '");\n', REPEAT(' ', 8), '}\n', REPEAT(' ', 4), '}' ) AS property FROM myCols; INSERT INTO myClass(myLine) VALUES (CONCAT(REPEAT(' ', 4), 'this(Row p', `@singular`, ')')) ,(CONCAT(REPEAT(' ', 4), '{')); INSERT INTO myClass(myLine) SELECT CONCAT( REPEAT(' ', 8), '_', col_name, ' = ', CASE WHEN col_type = 'bool' THEN CONCAT('to!(bool)','(p',`@singular`,'[',col_index,'].get!(byte));') ELSE CONCAT('p', `@singular`, '[', col_index, '].get!(', col_type, ');') END ) FROM myCols; INSERT INTO myClass(myLine) VALUES (CONCAT(REPEAT(' ', 4), '}')) ,(CONCAT(REPEAT(' ', 4), 'override bool isValid()')) ,(CONCAT(REPEAT(' ', 4), '{')) ,(CONCAT(REPEAT(' ', 8), 'return true;')) ,(CONCAT(REPEAT(' ', 4), '}')) ,(CONCAT(REPEAT(' ', 4), 'override void printInfo()')) ,(CONCAT(REPEAT(' ', 4), '{')) ,(CONCAT(REPEAT(' ', 8), 'writeln(')); INSERT INTO myClass(myLine) SELECT CONCAT( REPEAT(' ', 16), '" ', col_name, ' = ", ', col_name, ',' ) FROM myCols; INSERT INTO myClass(myLine) VALUES (CONCAT(REPEAT(' ', 16), '"");')) ,(CONCAT(REPEAT(' ', 4), '}')) ,('}') ,(CONCAT('class ', `@plural`, ' : ACBaseCollection!(', `@singular`, ')')) ,('{') ,('public:') ,(CONCAT(REPEAT(' ', 4), 'override string selectStatement()')) ,(CONCAT(REPEAT(' ', 4), '{')); -- this is where I need to figure out the select statement -- DECLARE sel TEXT; SET sel := ''; SELECT GROUP_CONCAT(col_name SEPARATOR ', ') FROM myCols GROUP BY group_index INTO sel; -- SET sel = SUBSTRING(sel, 2); INSERT INTO myClass(myLine) VALUES (CONCAT(REPEAT(' ', 8), 'return "SELECT ', sel, ' FROM ', `@table`, '";')) ,(CONCAT(REPEAT(' ', 4), '}')) ,(CONCAT(REPEAT(' ', 4), 'this(Command command)')) ,(CONCAT(REPEAT(' ', 4), '{')) ,(CONCAT(REPEAT(' ', 8), 'super(command);')) ,(CONCAT(REPEAT(' ', 4), '}')) ,('}'); SELECT myLine FROM myClass ORDER BY nID; -- SET class := ''; -- SELECT -- GROUP_CONCAT(myLine SEPARATOR '\n') -- FROM -- myClass -- GROUP BY -- group_index -- ORDER BY -- nID -- INTO -- class; -- -- SELECT class; DROP TABLE IF EXISTS myCols; DROP TABLE IF EXISTS myClass; END$$ DELIMITER ; SET SQL_MODE=@OLD_SQL_MODE; SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
CREATE PROCEDURE `imp_caspio_bankinfo` () BEGIN Delete from bank_rate_grid where bank_id in (Select bank_id from imp_brg); Insert into bank_rate_grid (bank_id, brg_tier_name, brg_rate, brg_score_start,brg_score_end, brg_model_year_start, brg_model_year_end, brg_mileage_start, brg_mileage_end, brg_term, brg_FE_percent,brg_FE_cap , brg_BE_percent , brg_BE_cap, brg_notes) Select bank_id, brg_tier_name, brg_rate, brg_score_start,brg_score_end, brg_model_year_start, brg_model_year_end, brg_mileage_start, brg_mileage_end, brg_term, brg_FE_percent,brg_FE_cap , brg_BE_percent , brg_BE_cap, brg_notes From Imp_brg; END
DROP DATABASE bdgdb; CREATE DATABASE bdgdb; USE bdgdb; CREATE TABLE transactions ( txId INT PRIMARY KEY, header VARCHAR(100) NOT NULL, amount DECIMAL NOT NULL, dot DATE NOT NULL, type CHAR(20) NOT NULL );
create table zone_blog.article_info ( article_id varchar(30) not null comment '文章id' primary key, title varchar(100) null comment '标题', content_md longtext null comment '内容md', content_html longtext null comment '内容html', summary varchar(255) null, author_id varchar(30) null comment '作者id', post_time datetime null comment '发布时间', categories varchar(100) null comment '分类目录', tags varchar(100) null comment '标签', status varchar(2) null comment '状态', comment_ids varchar(255) null comment '评论id', is_open varchar(1) not null comment '是否公开', is_deleted varchar(1) null, create_time datetime null, create_by varchar(30) null, update_time datetime null, update_by varchar(30) null ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; create table zone_blog.category_info ( category_id varchar(30) not null comment '分类id' primary key, category_name varchar(50) null comment '分类名称', author_id varchar(30) not null, is_deleted varchar(1) null, create_time datetime null, create_by varchar(30) null, update_time datetime null, update_by varchar(30) null ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; create table zone_blog.tag_info ( tag_id varchar(30) not null comment '分类id' primary key, tag_name varchar(50) null comment '分类名称', author_id varchar(30) not null, is_deleted varchar(1) null, create_time datetime null, create_by varchar(30) null, update_time datetime null, update_by varchar(30) null ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
#host_id can be null DELIMITER // CREATE FUNCTION addEvent(location VARCHAR(30), startHr INT, startMin INT, endHr INT, endMin INT, host_id INT) RETURNS INT BEGIN DECLARE ret INT; INSERT INTO event(location, startHr, startMin, endHr, endMin, host_id) values(location, startHr, startMin, endHr, endMin, host_id); SELECT MAX(event_id) INTO ret FROM event; RETURN ret; END// DELIMITER ;
INSERT INTO `ecommerce_database`.`PRODUCT` SET ?;
/* Formatted on 21/07/2014 18:44:49 (QP5 v5.227.12220.39754) */ CREATE OR REPLACE FORCE VIEW MCRE_OWN.V_MCRES_WRK_TO_CALC_UO_SP_ITF ( COD_ABI, COD_AUTORIZZAZIONE, LINE ) AS SELECT -- -- 20121113 AG Creazione vista -- 20121114 AG Aggiunto NVL su COD_ABI -- 20121128 AG Agginto NVL su es.val_tot -- 20121218 AG Aggiunto filtro su flg_docs_archiviati -- 20130108 AG Agginto filtro su causale per calcolo esborso posizione -- 20130523 AP aggiunto nuovo esborso al tracciato -- 20130529 AP aggiunti campi cod_abi e cod_autorizzazione per flaggatura s.cod_abi, s.cod_autorizzazione, TO_CHAR (SYSDATE - 1 / 3, 'yyyymmdd') -- id_dper || NVL (s.cod_abi, '00000') -- cod_abi || SUBSTR (s.cod_ndg, 4) -- cod_ndg || RPAD (NVL (p.cod_uo_pratica, ' '), 5, ' ') -- cod_uo_pratica = cod_uo_proponente || RPAD (s.cod_autorizzazione, 20, ' ') -- cod_autorizzazione || RPAD (NVL (s.cod_autorizzazione_padre, ' '), 20, ' ') -- cod_autorizzazione_padre || TO_CHAR (SYSDATE, 'yyyymmdd') -- dta_contabile || TO_CHAR (SYSDATE, 'yyyymmdd') -- dta_valuta || RPAD (NVL (r.cod_rapporto, ' '), 17, '0') -- cod_rapporto, || LPAD (NVL (c.val_importo * 100, 0), 15, '0') -- val_importo_contropartita || NVL (s.cod_causale, ' ') -- cod_causale || LPAD (NVL (s.val_importo_valore, 0) * 100, 15, '0') -- val_importo_spesa || LPAD ( (NVL (es.val_tot, 0) + NVL (s.val_importo_valore, 0)) * 100, 15, '0') -- val_totale_esborsi_pos || NVL (p.flg_gestione, 'E') -- tipo gestione || NVL (s.cod_tipo_autorizzazione, ' ') -- cod_tipo_autorizzazione = tipologia spesa || RPAD (NVL (p.cod_matr_pratica, ' '), 7, ' ') -- matricola del gestore della pratica legale || LPAD ( (NVL (es2.val_tot, 0) + NVL (s.val_importo_valore, 0)) * 100, 15, '0') -- val_totale_spese -- line FROM t_mcres_app_spese_itf s, t_mcres_app_rapporti_itf r, t_mcres_app_pratiche p, t_mcres_app_contropartite_itf c, ( -- totale esborso posizione SELECT cod_abi, cod_ndg, SUM (val_importo_valore) val_tot FROM t_mcres_app_sp_spese WHERE 0 = 0 AND cod_stato IN ('CO') AND cod_causale = 'A' GROUP BY cod_abi, cod_ndg) es, ( -- totale esborso posizione SELECT cod_abi, cod_ndg, SUM (val_importo_valore) val_tot FROM t_mcres_app_sp_spese WHERE 0 = 0 AND cod_stato IN ('CO') GROUP BY cod_abi, cod_ndg) es2 WHERE 0 = 0 AND s.cod_autorizzazione = r.cod_autorizzazione(+) AND s.cod_abi = p.cod_abi AND s.cod_ndg = p.cod_ndg AND s.val_anno_pratica = p.val_anno AND s.cod_pratica = p.cod_pratica AND s.cod_abi = es.cod_abi(+) AND s.cod_ndg = es.cod_ndg(+) -- AP 23/05/2013 AND s.cod_abi = es2.cod_abi(+) AND s.cod_ndg = es2.cod_ndg(+) -- --and p.flg_attiva = 1 AND s.cod_autorizzazione = c.cod_autorizzazione --- --AP 13/06/2013 --and s.cod_tipo_autorizzazione != '5' AND flg_inviata_per_calc_uo_od = 0 AND flg_docs_archiviati = 1 AND flg_fornitore_non_censito = 0;
-- phpMyAdmin SQL Dump -- version 3.3.9 -- http://www.phpmyadmin.net -- -- Host: localhost -- Generation Time: Jun 15, 2012 at 03:37 PM -- Server version: 5.5.8 -- PHP Version: 5.3.5 SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8 */; -- -- Database: `bala0069` -- -- -------------------------------------------------------- -- -- Table structure for table `movies` -- CREATE TABLE IF NOT EXISTS `movies` ( `id` int(11) NOT NULL AUTO_INCREMENT, `movie_title` varchar(100) NOT NULL, `release_date` date NOT NULL, `director` varchar(50) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=11 ; -- -- Dumping data for table `movies` -- INSERT INTO `movies` (`id`, `movie_title`, `release_date`, `director`) VALUES (2, 'Lord of the Rings: The Fellowship of the Ring', '2001-12-12', 'Peter Jackson'), (4, 'Shrek', '2000-05-05', 'Erika Balarezo'), (6, 'Toy Story 3', '2010-02-11', 'Lee Unkrich'), (8, 'Inception', '2012-07-10', 'Christopher Nolan'), (9, 'Madagascar 3', '0000-00-00', 'Eric Darnell'), (10, 'Titanic', '1997-12-19', 'James Cameron');
--Verify inserted data select * from locations;
/* create table temp_test_clients (id integer); create table temp_test_clients_1 as select * from temp_test_clients where 1=0; create table temp_test_clients_2 as select * from temp_test_clients where 1=0; insert into temp_test_clients (id) values (0); insert into temp_test_clients (id) values (1); insert into temp_test_clients (id) values (2); insert into temp_test_clients (id) values (3); insert into temp_test_clients (id) values (4); */ begin for z in (select id from temp_test_clients) loop if mod(z.id,2) = 1 then insert into temp_test_clients_1 (id) values (z.id); else insert into temp_test_clients_2 (id) values (z.id); end if; end loop; commit; end;
/* Formatted on 17/06/2014 18:14:37 (QP5 v5.227.12220.39754) */ CREATE OR REPLACE FORCE VIEW MCRE_OWN.VTMCRE0_APP_AGENDA ( ID, ID_UTENTE, COD_NDG, COD_ABI_CARTOLARIZZATO, DTA_INIZIO_APPUNTAMENTO, DESCRIZIONE, DTA_FINE_APPUNTAMENTO, DESC_NOME_CONTROPARTE, COD_GRUPPO_ECONOMICO, VAL_ANA_GRE ) AS SELECT /*-+ ORDERED */ A.ID, A.ID_UTENTE, A.COD_NDG, A.COD_ABI_CARTOLARIZZATO, A.DTA_INIZIO_APPUNTAMENTO, A.DESCRIZIONE, A.DTA_FINE_APPUNTAMENTO, F.DESC_NOME_CONTROPARTE, F.COD_GRUPPO_ECONOMICO, F.DESC_GRUPPO_ECONOMICO VAL_ANA_GRE FROM T_MCRE0_APP_AGENDA A, -- todo_verificare che sia sufficiente lavorare sulla partizione attiva VTMCRE0_APP_UPD_FIELDS_ALL F WHERE A.COD_ABI_CARTOLARIZZATO = F.COD_ABI_CARTOLARIZZATO(+) AND A.COD_NDG = F.COD_NDG(+); GRANT DELETE, INSERT, REFERENCES, SELECT, UPDATE, ON COMMIT REFRESH, QUERY REWRITE, DEBUG, FLASHBACK ON MCRE_OWN.VTMCRE0_APP_AGENDA TO MCRE_USR;
SELECT s.identifier, ROUND(AVG(ps.base_stat)) as base_stat FROM pokemon_abilities pa JOIN pokemon p ON pa.pokemon_id = p.id JOIN pokemon_stats ps ON p.id = ps.pokemon_id JOIN stats s ON ps.stat_id = s.id WHERE pa.ability_id = :id GROUP BY s.identifier
CREATE DATABASE IF NOT EXISTS Team8db; USE Team8db; CREATE TABLE IF NOT EXISTS PlayerInfo( 'id' int, 'name' varchar(32), 'count' int, 'claer' boolean, 'item_id' int ); ENGINE=InnoDB; CHARSET=utf8; TRUNCATE TABLE PlayerInfo;
/* Formatted on 21/07/2014 18:33:17 (QP5 v5.227.12220.39754) */ CREATE OR REPLACE FORCE VIEW MCRE_OWN.V_MCRE0_APP_ARCHIVIO_TRACCIATO ( DTA_UPD, COD_RAMO_CALCOLATO, COD_DIVISIONE, COD_COMPARTO, COD_ABI_CARTOLARIZZATO, COD_ABI_ISTITUTO, COD_STRUTTURA_COMPETENTE_DC, COD_STRUTTURA_COMPETENTE_RG, COD_STRUTTURA_COMPETENTE_AR, COD_STRUTTURA_COMPETENTE_FI, COD_NDG, DESC_NOME_CONTROPARTE, COD_SNDG, COD_GRUPPO_ECONOMICO, VAL_ANA_GRE, COD_PROCESSO, COD_PROCESSO_MESE_PRE, SCGB_COD_STATO_SIS, COD_STATO_SIS_MESE_PRE, COD_STATO, COD_STATO_PRE, DTA_DECORRENZA_STATO, DTA_SCADENZA_STATO, NUM_GG_SERVIZIO, NUM_GG_SCONFINO, COD_TIPO_PORTAFOGLIO, DESC_TIPO_PORT, SCSB_ACC_CASSA, SCSB_ACC_FIRMA, SCSB_ACC_SOSTITUZIONI, SCSB_ACC_TOT, SCSB_UTI_CASSA, SCSB_UTI_FIRMA, SCSB_UTI_SOSTITUZIONI, SCSB_UTI_TOT, SCGB_ACC_TOT, SCGB_UTI_TOT, GEB_ACC_TOT, GEGB_UTI_TOT, GB_VAL_MAU, COD_MATRICOLA, COGNOME, DTA_UTENTE_ASSEGNATO, COD_RAE, COD_SAE, COD_SEGMENTO_REGOLAMENTARE, VAL_UTI_CASSA_SISBA, VAL_UTI_FIRMA_SISBA, VAL_TOT_MORA_SISBA, VAL_TOT_RATEO_SISBA, VAL_TOT_UTI_SISBA, VAL_DUBBIO_ESITO_CASSA_SISBA, VAL_DUBBIO_ESITO_FIRMA_SISBA, VAL_DUBBIO_ATT_SISBA, VAL_DUBBIO_ESITO_DERIVATI, VAL_TOT_DUBBIO_ESITO_NT_ATT, DTA_ULTIMA_REVISIONE_PEF, COD_ULTIMO_ODE, DTA_ULTIMA_DELIBERA, VAL_TIPO_DELIBERA, VAL_RETTIFICA_DELIBERA, VAL_OD_ULTIMA_DELIBERA, VAL_OD_ULTIMA_DELIBERA_NOTE ) AS SELECT DTA_UPD, SUBSTR (LPAD (NVL (COD_RAMO_CALCOLATO, ' '), 6, ' '), 2, 5) COD_RAMO_CALCOLATO, LPAD (NVL (COD_DIVISIONE, ' '), 3, ' ') COD_DIVISIONE, SUBSTR (LPAD (NVL (COD_COMPARTO, ' '), 6, ' '), 2, 5) COD_COMPARTO, LPAD (NVL (COD_ABI_CARTOLARIZZATO, ' '), 5, ' ') COD_ABI_CARTOLARIZZATO, LPAD (NVL (COD_ABI_ISTITUTO, ' '), 5, ' ') COD_ABI_ISTITUTO, LPAD (NVL (COD_STRUTTURA_COMPETENTE_DC, ' '), 5, ' ') COD_STRUTTURA_COMPETENTE_DC, LPAD (NVL (COD_STRUTTURA_COMPETENTE_RG, ' '), 5, ' ') COD_STRUTTURA_COMPETENTE_RG, LPAD (NVL (COD_STRUTTURA_COMPETENTE_AR, ' '), 5, ' ') COD_STRUTTURA_COMPETENTE_AR, LPAD (NVL (COD_STRUTTURA_COMPETENTE_FI, ' '), 5, ' ') COD_STRUTTURA_COMPETENTE_FI, LPAD (NVL (COD_NDG, ' '), 16, ' ') COD_NDG, RPAD (NVL (DESC_NOME_CONTROPARTE, ' '), 50, ' ') DESC_NOME_CONTROPARTE, LPAD (NVL (COD_SNDG, ' '), 16, ' ') COD_SNDG, LPAD (NVL (COD_GRUPPO_ECONOMICO, ' '), 8, ' ') COD_GRUPPO_ECONOMICO, RPAD (NVL (VAL_ANA_GRE, ' '), 60, ' ') VAL_ANA_GRE, LPAD (NVL (COD_PROCESSO, ' '), 2, ' ') COD_PROCESSO, LPAD (NVL (COD_PROCESSO_MESE_PRE, ' '), 2, ' ') COD_PROCESSO_MESE_PRE, LPAD (NVL (SCGB_COD_STATO_SIS, ' '), 3, ' ') SCGB_COD_STATO_SIS, LPAD (NVL (COD_STATO_SIS_MESE_PRE, ' '), 3, ' ') COD_STATO_SIS_MESE_PRE, LPAD (NVL (COD_STATO, ' '), 2, ' ') COD_STATO, LPAD (NVL (COD_STATO_PRE, ' '), 2, ' ') COD_STATO_PRE, LPAD (NVL (TO_CHAR (DTA_DECORRENZA_STATO, 'DDMMYY'), ' '), 6, ' ') DTA_DECORRENZA_STATO, LPAD (NVL (TO_CHAR (DTA_SCADENZA_STATO, 'DDMMYY'), ' '), 6, ' ') DTA_SCADENZA_STATO, LPAD (NVL (NUM_GG_SERVIZIO, 0), 4, '0') NUM_GG_SERVIZIO, LPAD (NVL (NUM_GG_SCONFINO, 0), 4, '0') NUM_GG_SCONFINO, LPAD (NVL (COD_TIPO_PORTAFOGLIO, ' '), 1, ' ') COD_TIPO_PORTAFOGLIO, RPAD (NVL (DESC_TIPO_PORT, ' '), 30, ' ') DESC_TIPO_PORT, LPAD (NVL (ROUND (SCSB_ACC_CASSA, 2), 0), 15, '0') SCSB_ACC_CASSA, LPAD (NVL (ROUND (SCSB_ACC_FIRMA, 2), 0), 15, '0') SCSB_ACC_FIRMA, LPAD (NVL (ROUND (SCSB_ACC_SOSTITUZIONI, 2), 0), 15, '0') SCSB_ACC_SOSTITUZIONI, LPAD (NVL (ROUND (SCSB_ACC_TOT, 2), 0), 15, '0') SCSB_ACC_TOT, LPAD (NVL (ROUND (SCSB_UTI_CASSA, 2), 0), 15, '0') SCSB_UTI_CASSA, LPAD (NVL (ROUND (SCSB_UTI_FIRMA, 2), 0), 15, '0') SCSB_UTI_FIRMA, LPAD (NVL (ROUND (SCSB_UTI_SOSTITUZIONI, 2), 0), 15, '0') SCSB_UTI_SOSTITUZIONI, LPAD (NVL (ROUND (SCSB_UTI_TOT, 2), 0), 15, '0') SCSB_UTI_TOT, LPAD (NVL (ROUND (SCGB_ACC_TOT, 2), 0), 15, '0') SCGB_ACC_TOT, LPAD (NVL (ROUND (SCGB_UTI_TOT, 2), 0), 15, '0') SCGB_UTI_TOT, LPAD (NVL (ROUND (GEB_ACC_TOT, 2), 0), 15, '0') GEB_ACC_TOT, LPAD (NVL (ROUND (GEGB_UTI_TOT, 2), 0), 15, '0') GEGB_UTI_TOT, LPAD (NVL (ROUND (GB_VAL_MAU, 2), 0), 15, '0') GB_VAL_MAU, LPAD (NVL (COD_MATRICOLA, ' '), 7, ' ') COD_MATRICOLA, RPAD (NVL (COGNOME, ' '), 25, ' ') COGNOME, LPAD (NVL (TO_CHAR (DTA_UTENTE_ASSEGNATO, 'DDMMYY'), ' '), 6, ' ') DTA_UTENTE_ASSEGNATO, LPAD (NVL (COD_RAE, ' '), 3, ' ') COD_RAE, LPAD (NVL (COD_SAE, ' '), 3, ' ') COD_SAE, LPAD (NVL (COD_SEGMENTO_REGOLAMENTARE, ' '), 20, ' ') COD_SEGMENTO_REGOLAMENTARE, LPAD (NVL (ROUND (VAL_UTI_CASSA_SISBA, 2), 0), 15, '0') VAL_UTI_CASSA_SISBA, LPAD (NVL (ROUND (VAL_UTI_FIRMA_SISBA, 2), 0), 15, '0') VAL_UTI_FIRMA_SISBA, LPAD (NVL (ROUND (VAL_TOT_MORA_SISBA, 2), 0), 15, '0') VAL_TOT_MORA_SISBA, LPAD (NVL (ROUND (VAL_TOT_RATEO_SISBA, 2), 0), 15, '0') VAL_TOT_RATEO_SISBA, LPAD (NVL (ROUND (VAL_TOT_UTI_SISBA, 2), 0), 15, '0') VAL_TOT_UTI_SISBA, LPAD (NVL (ROUND (VAL_DUBBIO_ESITO_CASSA_SISBA, 2), 0), 15, '0') VAL_DUBBIO_ESITO_CASSA_SISBA, LPAD (NVL (ROUND (VAL_DUBBIO_ESITO_FIRMA_SISBA, 2), 0), 15, '0') VAL_DUBBIO_ESITO_FIRMA_SISBA, LPAD (NVL (ROUND (VAL_DUBBIO_ATT_SISBA, 2), 0), 15, '0') VAL_DUBBIO_ATT_SISBA, LPAD (NVL (ROUND (VAL_DUBBIO_ESITO_DERIVATI, 2), 0), 15, '0') VAL_DUBBIO_ESITO_DERIVATI, LPAD (NVL (ROUND (VAL_TOT_DUBBIO_ESITO_NT_ATT, 2), 0), 15, '0') VAL_TOT_DUBBIO_ESITO_NT_ATT, LPAD (NVL (TO_CHAR (DTA_ULTIMA_REVISIONE_PEF, 'DDMMYY'), ' '), 6, ' ') DTA_ULTIMA_REVISIONE_PEF, RPAD (NVL (COD_ULTIMO_ODE, ' '), 5, ' ') COD_ULTIMO_ODE, LPAD (NVL (TO_CHAR (DTA_ULTIMA_DELIBERA, 'DDMMYY'), ' '), 6, ' ') DTA_ULTIMA_DELIBERA, LPAD (NVL (VAL_TIPO_DELIBERA, ' '), 2, ' ') VAL_TIPO_DELIBERA, LPAD (NVL (ROUND (VAL_RETTIFICA_DELIBERA, 2), 0), 15, '0') VAL_RETTIFICA_DELIBERA, RPAD (NVL (VAL_OD_ULTIMA_DELIBERA, ' '), 2, ' ') VAL_OD_ULTIMA_DELIBERA, RPAD (NVL (VAL_OD_ULTIMA_DELIBERA_NOTE, ' '), 5, ' ') VAL_OD_ULTIMA_DELIBERA_NOTE -- val_archivio FROM MCRE_OWN.V_MCRE0_APP_ARCHIVIO;
-- phpMyAdmin SQL Dump -- version 4.9.0.1 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Generation Time: Nov 24, 2019 at 12:12 AM -- Server version: 10.4.6-MariaDB -- PHP Version: 7.3.9 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET AUTOCOMMIT = 0; START TRANSACTION; SET time_zone = "+00:00"; -- -- Database: `shatter` -- -- -------------------------------------------------------- -- -- Table structure for table `setting` -- CREATE TABLE `setting` ( `id` int(20) UNSIGNED NOT NULL, `module` varchar(60) NOT NULL, `setting_key` varchar(60) NOT NULL, `setting_value` varchar(250) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Indexes for dumped tables -- -- -- Indexes for table `setting` -- ALTER TABLE `setting` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `setting_key` (`setting_key`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `setting` -- ALTER TABLE `setting` MODIFY `id` int(20) UNSIGNED NOT NULL AUTO_INCREMENT; COMMIT;
/*Task c2 Version 1 Level 2*/ /*create table propety dimension*/ drop table property_dim CASCADE CONSTRAINTS PURGE ; create table property_dim as select * from MONRE.property; /*add and update propert_dim with property_scale*/ alter table property_dim add (property_scale varchar2(15)); update property_dim set property_scale = 'Extra Small' where property_no_of_bedrooms <= 1; update property_dim set property_scale = 'Small' where property_no_of_bedrooms >= 2 and property_no_of_bedrooms <= 3; update property_dim set property_scale = 'Medium' where property_no_of_bedrooms >= 3 and property_no_of_bedrooms <= 6; update property_dim set property_scale = 'Large' where property_no_of_bedrooms >= 6 and property_no_of_bedrooms <= 10; update property_dim set property_scale = 'Extra Large' where property_no_of_bedrooms > 10; /*create table address dimension*/ drop table address_dim CASCADE CONSTRAINTS PURGE ; create table address_dim as select * from monre.address; /*create table postcode dimension*/ drop table postcode_dim CASCADE CONSTRAINTS PURGE ; create table postcode_dim as select * from MONRE.postcode; /*create table state dimension*/ drop table state_dim CASCADE CONSTRAINTS PURGE ; create table state_dim as select * from MONRE.state; /*create table agent office dimension*/ drop table office_dim CASCADE CONSTRAINTS PURGE ; create table office_dim as select * from MONRE.office; /*create table agent office bridge*/ drop table agent_office_bridge CASCADE CONSTRAINTS PURGE ; create table agent_office_bridge as select a.person_id, o.office_name from MONRE.agent a, MONRE.office o, MONRE.agent_office ao where ao.person_id = a.person_id and o.office_id = ao.office_id; /*create table agent dimension*/ drop table agent_dim CASCADE CONSTRAINTS PURGE ; create table agent_dim as select a.person_id, a.salary, 1.0 / count(o.office_name) as weightfactor, listagg(o.office_name, '_') within group(order by o.office_name) as officeNameList from MONRE.agent a, MONRE.office o, MONRE.agent_office ao where ao.person_id = a.person_id and o.office_id = ao.office_id group by a.person_id, a.salary; /*create table sale dimension*/ drop table sale_dim CASCADE CONSTRAINTS PURGE ; create table sale_dim as select * from MONRE.sale; /*create table rent dimension*/ drop table rent_dim CASCADE CONSTRAINTS PURGE ; create table rent_dim as select * from monre.rent; /*add and update rent dimension with rental_period*/ alter table rent_dim add (rental_period varchar2(15)); update rent_dim set rental_period ='Short' where months_between(to_date(rent_end_date), to_date(rent_start_date)) < 6; update rent_dim set rental_period ='Medium' where months_between(to_date(rent_end_date), to_date(rent_start_date)) >= 6 and months_between(to_date(rent_end_date), to_date(rent_start_date)) <= 12; update rent_dim set rental_period ='Long' where months_between(to_date(rent_end_date), to_date(rent_start_date)) > 12; /*create table time dimension*/ drop table time_rent_dim cascade CONSTRAINTS PURGE ; create table time_rent_dim as select distinct to_char(rent_start_date,'YYYYMM') as time_rent_id, to_char(rent_start_date, 'Month') as time_rent_month, to_char(rent_start_date, 'YYYY') as time_rent_year from monre.rent; /*create table time dimension*/ drop table time_sale_dim cascade CONSTRAINTS PURGE ; create table time_sale_dim as select distinct to_char(sale_date,'YYYYMM') as time_sale_id, to_char(sale_date, 'Month') as time_sale_month, to_char(sale_date, 'YYYY') as time_sale_year from monre.sale; /*create table season dimension*/ DROP TABLE season_dim CASCADE CONSTRAINTS PURGE; CREATE TABLE season_dim ( season_id VARCHAR2(10), season_desc VARCHAR2(20), begin_date DATE, end_date DATE ); /*populate season dimension for Summer, Autumn, Winter, Spring*/ INSERT INTO season_dim VALUES ( 'S1', 'Summer', TO_DATE('01-12', 'DD-MM'), TO_DATE('29-02', 'DD-MM') ); INSERT INTO season_dim VALUES ( 'S2', 'Autumn', TO_DATE('01-03', 'DD-MM'), TO_DATE('31-05', 'DD-MM') ); INSERT INTO season_dim VALUES ( 'S3', 'Winter', TO_DATE('01-06', 'DD-MM'), TO_DATE('31-08', 'DD-MM') ); INSERT INTO season_dim VALUES ( 'S4', 'Spring', TO_DATE('01-09', 'DD-MM'), TO_DATE('30-11', 'DD-MM') ); /*create table client wish dimension*/ drop table client_wish_dim CASCADE CONSTRAINTS PURGE ; create table client_wish_dim as select * from MONRE.client_wish; /*create table person dimension*/ drop table person_dim CASCADE CONSTRAINTS PURGE ; create table person_dim as select * from MONRE.person; /*create table client dimension*/ drop table client_dim CASCADE CONSTRAINTS PURGE ; create table client_dim as select * from MONRE.client; /*add and update client dimension with budget_range*/ alter table client_dim add ( budget_range varchar2(15)); update client_dim set budget_range = 'Low' where max_budget >= 0 and max_budget <= 1000; update client_dim set budget_range = 'Medium' where max_budget >= 1001 and max_budget <= 100000; update client_dim set budget_range = 'High' where max_budget >= 100001 and max_budget <= 1000000; /*create table feature dimension*/ drop table feature_dim cascade constraints purge; create table feature_dim as select * from MONRE.feature; /*create table property feature dimesnion*/ drop table property_feature_dim CASCADE CONSTRAINTS PURGE; create table property_feature_dim as select * from MONRE.property_feature; /*create table visit dimension*/ drop table visit_dim CASCADE CONSTRAINTS PURGE; create table visit_dim as select client_person_id, agent_person_id, property_id, duration, visit_date, to_char(visit_date, 'DY, MON, YYYY') as visit_date2 from MONRE.visit; /*create table property advertisement slow changinging dimension type 2*/ drop table property_advert_SCD2 CASCADE CONSTRAINTS PURGE; create table property_advert_SCD2 as select a.advert_id ||'_'|| rank()over(partition by a.advert_id order by to_date(p.property_date_added, 'DD/MM/YYYY')asc) as advert_id, pa.property_id, p.property_date_added as advertisemet_date, case when p.property_date_added is null then 'N' else 'Y' end as CurrentFlag from MONRE.advertisement a, MONRE.property_advert pa, MONRE.property p where a.advert_id = pa.advert_id(+) and pa.property_id = p.property_id(+); /*create table MonRE_temp_fact_v1*/ drop table MonRE_temp_fact_v1 cascade CONSTRAINTS PURGE ; create table MonRE_temp_fact_v1 as select pr.property_id, s.sale_id, a.salary, s.price sale_price, s.sale_date, to_char(s.sale_date,'YYYYMM') as time_sale_id, a.person_id agent_person, c.person_id client_person, v.property_id visit_property, v.visit_date from monre.sale s join monre.property pr on pr.property_id = s.property_id left join MONRE.visit v on pr.property_id = v.property_id left join MONRE.agent a on s.agent_person_id = a.person_id left join MONRE.client c on s.client_person_id = c.person_id; /*add acolumn in the MonRE_temp_fact_v1 to store season id*/ alter table MonRE_temp_fact_v1 add (season_id varchar2(10)); update MonRE_temp_fact_v1 set season_id = 'S1' where to_char(visit_date, 'MM') = '12' or to_char(visit_date, 'MM') = '01' or to_char(visit_date, 'MM') = '02'; update MonRE_temp_fact_v1 set season_id = 'S2' where to_char(visit_date, 'MM') = '03' or to_char(visit_date, 'MM') = '04' or to_char(visit_date, 'MM') = '05'; update MonRE_temp_fact_v1 set season_id = 'S3' where to_char(visit_date, 'MM') = '06' or to_char(visit_date, 'MM') = '07' or to_char(visit_date, 'MM') = '08'; update MonRE_temp_fact_v1 set season_id = 'S4' where to_char(visit_date, 'MM') = '09' or to_char(visit_date, 'MM') = '10' or to_char(visit_date, 'MM') = '11'; /*create table MonRE_temp_fact_v2*/ drop table MonRE_temp_fact_v2 cascade CONSTRAINTS PURGE; create table MonRE_temp_fact_v2 as select pr.property_id, r.rent_id, r.rent_start_date, r.rent_end_date, to_char(r.rent_start_date,'YYYYMM') as time_rent_id, r.price rent_price, a.salary, a.person_id agent_person, c.person_id client_person, v.property_id visit_property, v.visit_date from monre.rent r join monre.property pr on pr.property_id = r.property_id left join MONRE.visit v on pr.property_id = v.property_id left join MONRE.agent a on r.agent_person_id = a.person_id left join MONRE.client c on r.client_person_id = c.person_id; /*add acolumn in the MonRE_temp_fact_v2 to store season id*/ alter table MonRE_temp_fact_v2 add (season_id varchar2(10)); update MonRE_temp_fact_v2 set season_id = 'S1' where to_char(visit_date, 'MM') = '12' or to_char(visit_date, 'MM') = '01' or to_char(visit_date, 'MM') = '02'; update MonRE_temp_fact_v2 set season_id = 'S2' where to_char(visit_date, 'MM') = '03' or to_char(visit_date, 'MM') = '04' or to_char(visit_date, 'MM') = '05'; update MonRE_temp_fact_v2 set season_id = 'S3' where to_char(visit_date, 'MM') = '06' or to_char(visit_date, 'MM') = '07' or to_char(visit_date, 'MM') = '08'; update MonRE_temp_fact_v2 set season_id = 'S4' where to_char(visit_date, 'MM') = '09' or to_char(visit_date, 'MM') = '10' or to_char(visit_date, 'MM') = '11'; /*create table monre_fact_v1 */ drop table monre_sale_fact_v1 cascade constraints purge; create table monre_sale_fact_v1 as select distinct t1.property_id, t1.sale_id, t1.season_id, t1.agent_person, t1.client_person, t1.time_sale_id, count(distinct t1.sale_date) as total_number_of_sale, count(distinct t1.agent_person) as total_number_of_agents, count(distinct t1.client_person) as total_number_of_clients, count(distinct t1.property_id) as total_number_of_properties, count(t1.visit_property) as total_number_of_property_visit, sum(distinct t1.sale_price) as total_sales, sum(distinct t1.salary) as total_agent_earning from monre_temp_fact_v1 t1 group by t1.property_id, t1.sale_id,t1.season_id, t1.agent_person, t1.client_person, t1.time_sale_id; /*create table monre_rent_fact_v1*/ drop table monre_rent_fact_v1 cascade constraints purge; create table monre_rent_fact_v1 as select distinct t2.property_id, t2.rent_id, t2.season_id, t2.agent_person, t2.client_person, t2.time_rent_id, count(distinct t2.rent_start_date) as total_number_of_rent, count(distinct t2.agent_person) as total_number_of_agents, count(distinct t2.client_person) as total_number_of_clients, count(distinct t2.property_id) as total_number_of_properties, count(t2.visit_property) as total_number_of_property_visit, sum(distinct t2.rent_price) as total_rental, sum(distinct t2.salary) as total_agent_earning from monre_temp_fact_v2 t2 group by t2.property_id, t2.rent_id, t2.season_id, t2.agent_person, t2.client_person, t2.time_rent_id; /*---------------------------------------------------------------------------------------------*/ /*Task c2 - Star Schema Version 2 *Level 0: No Aggregation* */ /*create table property dimension*/ drop table property_dim_v2 CASCADE CONSTRAINTS PURGE; create table property_dim_v2 as select * from MONRE.property; /*create table address dimension*/ drop table address_dim_v2 CASCADE CONSTRAINTS PURGE; create table address_dim_v2 as select * from monre.address; /*create table postcode dimension*/ drop table postcode_dim_v2 CASCADE CONSTRAINTS PURGE; create table postcode_dim_v2 as select * from MONRE.postcode; /*create table state dimension*/ drop table state_dim_v2 CASCADE CONSTRAINTS PURGE; create table state_dim_v2 as select * from MONRE.state; /*create table agent office dimension*/ drop table office_dim_v2 CASCADE CONSTRAINTS PURGE; create table office_dim_v2 as select * from MONRE.office; /*create table agent dimension*/ drop table agent_dim_v2 CASCADE CONSTRAINTS PURGE; create table agent_dim_v2 as select * from MONRE.agent; /*create table agent office bridge*/ drop table agent_office_bridge_v2 CASCADE CONSTRAINTS PURGE; create table agent_office_bridge_v2 as select a.person_id, o.office_id from MONRE.agent a, MONRE.office o, MONRE.agent_office ao where ao.person_id = a.person_id and o.office_id = ao.office_id; /*create table sale dimension*/ drop table sale_dim_v2 CASCADE CONSTRAINTS PURGE; create table sale_dim_v2 as select * from MONRE.sale; /*create table rent dimension*/ drop table rent_dim_v2 CASCADE CONSTRAINTS PURGE; create table rent_dim_v2 as select * from monre.rent; /*create table client wish dimension*/ drop table client_wish_dim_v2 CASCADE CONSTRAINTS PURGE; create table client_wish_dim_v2 as select * from MONRE.client_wish; /*create table person dimension*/ drop table person_dim_v2 CASCADE CONSTRAINTS PURGE; create table person_dim_v2 as select * from MONRE.person; /*create table client dimension*/ drop table client_dim_v2 CASCADE CONSTRAINTS PURGE; create table client_dim_v2 as select * from MONRE.client; /*create table feature dimension*/ drop table feature_dim_v2 CASCADE CONSTRAINTS PURGE; create table feature_dim_v2 as select * from MONRE.feature; /*create table property feature dimesnion*/ drop table property_feature_dim_v2 CASCADE CONSTRAINTS PURGE; create table property_feature_dim_v2 as select * from MONRE.property_feature; /*create table visit dimension*/ drop table visit_dim_v2 CASCADE CONSTRAINTS PURGE; create table visit_dim_v2 as select * from MONRE.visit; /*create table advertisement dimension*/ drop table advertisement_dim_v2 CASCADE CONSTRAINTS PURGE; create table advertisement_dim_v2 as select * from MONRE.advertisement; /*create table property advertisement dimension*/ drop table property_advert_dim_v2 CASCADE CONSTRAINTS PURGE; create table property_advert_dim_v2 as select pa.property_id, pa.advert_id, pa.agent_person_id, pa.cost from MONRE.property_advert pa, MONRE.advertisement a where pa.advert_id = a.advert_id; /*create table MonRE_rent_fact_v2*/ drop table MonRE_rent_fact_v2 cascade constraints purge; create table MonRE_rent_fact_v2 as select distinct r.rent_id, p.property_id, a.person_id agent, c.person_id client, v.visit_date, r.rent_start_date, r.rent_end_date, r.price, count(distinct r.rent_start_date) as total_number_of_rent, count(distinct a.person_id) as total_number_of_agents, count(distinct c.person_id) as total_number_of_clients, count(distinct p.property_id) as total_number_of_properties, count(distinct v.property_id) as total_number_of_property_visit, sum(distinct r.price) as total_rental, sum(distinct a.salary) as total_agent_earning from monre.rent r join monre.property p on r.property_id = p.property_id left join monre.visit v on p.property_id = v.property_id left join monre.agent a on r.agent_person_id = a.person_id left join monre.client c on r.client_person_id = c.person_id group by r.rent_id, p.property_id, a.person_id, a.salary, c.person_id, v.property_id, v.visit_date, r.rent_start_date, r.rent_end_date, r.price; /*create table MonRE_sale_fact_v2*/ drop table MonRE_sale_fact_v2 cascade constraints purge; create table MonRE_sale_fact_v2 as select distinct s.sale_id, p.property_id, a.person_id agent, c.person_id client, v.visit_date, s.sale_date, s.price sale_price, count(distinct s.sale_date) as total_number_of_sale, count(distinct a.person_id) as total_number_of_agents, count(distinct c.person_id) as total_number_of_clients, count(distinct p.property_id) as total_number_of_properties, count(v.property_id) as total_number_of_property_visit, sum(distinct s.price) as total_sales, sum(distinct a.salary) as total_agent_earning from monre.sale s join monre.property p on s.property_id = p.property_id left join monre.visit v on p.property_id = v.property_id left join monre.agent a on s.agent_person_id = a.person_id left join monre.client c on s.client_person_id = c.person_id group by s.sale_id, p.property_id, a.person_id, c.person_id, v.visit_date, s.sale_date, s.price;
USE StudyTree; DROP PROCEDURE IF EXISTS get_study_groups; DELIMITER // CREATE PROCEDURE get_study_groups (IN uid INT) BEGIN SELECT c.id, c.number, d.short_name, sg.start_time, sg.end_time, sg.id group_id FROM study_groups sg join classes c ON sg.class_id = c.id join users_to_classes uc ON c.id = uc.class_id join users u ON u.id = uc.user_id join departments d on d.id = c.department_id WHERE u.id = uid AND sg.id NOT IN (SELECT study_group_id FROM users_to_study_groups WHERE user_id = uid); END // DELIMITER ;
ALTER TABLE PERSON_FIN_INT_DISCLOSURE ADD CONSTRAINT UQ_PERSON_FIN_INT_DISCLOSURE UNIQUE (ENTITY_NUMBER, SEQUENCE_NUMBER) /
/* Navicat Premium Data Transfer Source Server : localhost Source Server Type : MySQL Source Server Version : 50726 Source Host : localhost:3306 Source Schema : laravel Target Server Type : MySQL Target Server Version : 50726 File Encoding : 65001 Date: 20/09/2020 19:08:25 */ SET NAMES utf8mb4; SET FOREIGN_KEY_CHECKS = 0; -- ---------------------------- -- Table structure for admin_permission_role -- ---------------------------- DROP TABLE IF EXISTS `admin_permission_role`; CREATE TABLE `admin_permission_role` ( `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, `role_id` int(11) NOT NULL, `permission_id` int(11) NOT NULL, `created_at` timestamp(0) NULL DEFAULT NULL, `updated_at` timestamp(0) NULL DEFAULT NULL, PRIMARY KEY (`id`) USING BTREE ) ENGINE = MyISAM AUTO_INCREMENT = 9 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Fixed; -- ---------------------------- -- Records of admin_permission_role -- ---------------------------- INSERT INTO `admin_permission_role` VALUES (5, 6, 6, NULL, NULL); INSERT INTO `admin_permission_role` VALUES (2, 5, 6, NULL, NULL); INSERT INTO `admin_permission_role` VALUES (3, 5, 7, NULL, NULL); INSERT INTO `admin_permission_role` VALUES (6, 7, 6, NULL, NULL); INSERT INTO `admin_permission_role` VALUES (7, 7, 7, NULL, NULL); INSERT INTO `admin_permission_role` VALUES (8, 7, 8, NULL, NULL); -- ---------------------------- -- Table structure for admin_permissions -- ---------------------------- DROP TABLE IF EXISTS `admin_permissions`; CREATE TABLE `admin_permissions` ( `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, `name` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', `description` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', `created_at` timestamp(0) NULL DEFAULT NULL, `updated_at` timestamp(0) NULL DEFAULT NULL, PRIMARY KEY (`id`) USING BTREE ) ENGINE = MyISAM AUTO_INCREMENT = 9 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of admin_permissions -- ---------------------------- INSERT INTO `admin_permissions` VALUES (6, 'posts', '文章模块', '2020-06-27 11:53:00', '2020-06-27 12:23:54'); INSERT INTO `admin_permissions` VALUES (7, 'topics', '专题模块', '2020-06-27 11:53:14', '2020-06-27 12:23:50'); INSERT INTO `admin_permissions` VALUES (8, 'system', '系统模块', '2020-06-28 20:42:28', '2020-06-28 20:42:28'); -- ---------------------------- -- Table structure for admin_role_user -- ---------------------------- DROP TABLE IF EXISTS `admin_role_user`; CREATE TABLE `admin_role_user` ( `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, `role_id` int(11) NOT NULL, `user_id` int(11) NOT NULL, PRIMARY KEY (`id`) USING BTREE ) ENGINE = MyISAM AUTO_INCREMENT = 10 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Fixed; -- ---------------------------- -- Records of admin_role_user -- ---------------------------- INSERT INTO `admin_role_user` VALUES (8, 7, 15); INSERT INTO `admin_role_user` VALUES (9, 6, 19); -- ---------------------------- -- Table structure for admin_roles -- ---------------------------- DROP TABLE IF EXISTS `admin_roles`; CREATE TABLE `admin_roles` ( `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, `name` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `description` varchar(250) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `delete_time` tinyint(20) NOT NULL DEFAULT 0, `created_at` timestamp(0) NULL DEFAULT NULL, `updated_at` timestamp(0) NULL DEFAULT NULL, PRIMARY KEY (`id`) USING BTREE ) ENGINE = MyISAM AUTO_INCREMENT = 8 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of admin_roles -- ---------------------------- INSERT INTO `admin_roles` VALUES (7, '管理员', '管理员', 0, '2020-06-28 20:42:56', '2020-06-28 20:42:56'); -- ---------------------------- -- Table structure for admin_users -- ---------------------------- DROP TABLE IF EXISTS `admin_users`; CREATE TABLE `admin_users` ( `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, `username` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `password` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `is_show` tinyint(3) NOT NULL, `remember_token` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL, `created_at` timestamp(0) NULL DEFAULT NULL, `updated_at` timestamp(0) NULL DEFAULT NULL, PRIMARY KEY (`id`) USING BTREE ) ENGINE = MyISAM AUTO_INCREMENT = 20 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of admin_users -- ---------------------------- INSERT INTO `admin_users` VALUES (19, 'admin1', '$2y$10$E9ELuLMEQjmq647QeZujQ.ISbfhsQF7u53deFnv1JQPzosAu6WUVO', 1, NULL, '2020-06-22 12:45:51', '2020-09-14 22:22:19'); INSERT INTO `admin_users` VALUES (15, 'admin', '$2y$10$coktYiH9rUl6Zhbv8vaKh.ruF.VqbOcDYuFX4AH/hsPnCIltySmoa', 1, NULL, '2020-06-22 12:34:35', '2020-06-28 20:43:16'); -- ---------------------------- -- Table structure for comments -- ---------------------------- DROP TABLE IF EXISTS `comments`; CREATE TABLE `comments` ( `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, `post_id` int(11) NOT NULL DEFAULT 0, `content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `user_id` int(11) NOT NULL DEFAULT 0, `created_at` timestamp(0) NULL DEFAULT NULL, `updated_at` timestamp(0) NULL DEFAULT NULL, PRIMARY KEY (`id`) USING BTREE ) ENGINE = MyISAM AUTO_INCREMENT = 9 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of comments -- ---------------------------- INSERT INTO `comments` VALUES (3, 50, '这是一条测试评论', 1, '2020-05-21 16:08:25', '2020-05-21 16:08:25'); INSERT INTO `comments` VALUES (4, 50, '这是一条测试评论', 1, '2020-05-21 17:03:55', '2020-05-21 17:03:55'); INSERT INTO `comments` VALUES (5, 50, '这是一条测试评论', 2, '2020-05-21 17:04:09', '2020-05-21 17:04:09'); INSERT INTO `comments` VALUES (6, 50, '这是一条测试评论', 2, '2020-05-21 17:09:15', '2020-05-21 17:09:15'); INSERT INTO `comments` VALUES (7, 49, '111', 1, '2020-05-21 17:44:09', '2020-05-21 17:44:09'); INSERT INTO `comments` VALUES (8, 51, '1', 1, '2020-06-08 09:36:18', '2020-06-08 09:36:18'); -- ---------------------------- -- Table structure for fans -- ---------------------------- DROP TABLE IF EXISTS `fans`; CREATE TABLE `fans` ( `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, `fan_id` int(11) NOT NULL DEFAULT 0, `star_id` int(11) NOT NULL DEFAULT 0, `created_at` timestamp(0) NULL DEFAULT NULL, `updated_at` timestamp(0) NULL DEFAULT NULL, PRIMARY KEY (`id`) USING BTREE ) ENGINE = MyISAM AUTO_INCREMENT = 13 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Fixed; -- ---------------------------- -- Records of fans -- ---------------------------- INSERT INTO `fans` VALUES (12, 1, 2, '2020-06-23 22:47:13', '2020-06-23 22:47:13'); INSERT INTO `fans` VALUES (11, 2, 1, '2020-06-23 21:07:53', '2020-06-23 21:07:53'); -- ---------------------------- -- Table structure for migrations -- ---------------------------- DROP TABLE IF EXISTS `migrations`; CREATE TABLE `migrations` ( `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, `migration` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `batch` int(11) NOT NULL, PRIMARY KEY (`id`) USING BTREE ) ENGINE = MyISAM AUTO_INCREMENT = 14 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of migrations -- ---------------------------- INSERT INTO `migrations` VALUES (1, '2014_10_12_000000_create_users_table', 1); INSERT INTO `migrations` VALUES (2, '2019_08_19_000000_create_failed_jobs_table', 1); INSERT INTO `migrations` VALUES (3, '2020_05_15_070547_create_posts_table', 1); INSERT INTO `migrations` VALUES (4, '2020_05_21_151603_create_comments_table', 2); INSERT INTO `migrations` VALUES (5, '2020_05_21_171122_create_zans_comments_table', 3); INSERT INTO `migrations` VALUES (6, '2020_05_21_171336_create_zans_table', 4); INSERT INTO `migrations` VALUES (7, '2020_06_02_185232_create_topics_table', 5); INSERT INTO `migrations` VALUES (8, '2020_06_02_185502_create_post_topics_table', 5); INSERT INTO `migrations` VALUES (9, '2020_06_03_113220_alter_usets_table', 6); INSERT INTO `migrations` VALUES (10, '2020_06_08_095318_create_fans_table', 7); INSERT INTO `migrations` VALUES (11, '2020_06_21_160605_create_admin_users_table', 8); INSERT INTO `migrations` VALUES (12, '2020_06_24_102910_create_admin_roles_table', 9); INSERT INTO `migrations` VALUES (13, '2020_06_24_104425_create_permission_and_roles_table', 10); -- ---------------------------- -- Table structure for post_topics -- ---------------------------- DROP TABLE IF EXISTS `post_topics`; CREATE TABLE `post_topics` ( `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, `post_id` int(11) NOT NULL DEFAULT 0, `topic_id` int(11) NOT NULL DEFAULT 0, `created_at` timestamp(0) NULL DEFAULT NULL, `updated_at` timestamp(0) NULL DEFAULT NULL, PRIMARY KEY (`id`) USING BTREE ) ENGINE = MyISAM AUTO_INCREMENT = 20 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Fixed; -- ---------------------------- -- Records of post_topics -- ---------------------------- INSERT INTO `post_topics` VALUES (19, 57, 2, '2020-06-23 22:47:04', '2020-06-23 22:47:04'); INSERT INTO `post_topics` VALUES (16, 57, 1, '2020-06-23 16:18:48', '2020-06-23 16:18:48'); -- ---------------------------- -- Table structure for posts -- ---------------------------- DROP TABLE IF EXISTS `posts`; CREATE TABLE `posts` ( `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, `title` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', `content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `status` tinyint(3) NOT NULL DEFAULT 0 COMMENT '0未知1通过,-1删除', `user_id` int(11) NOT NULL DEFAULT 0, `delete_time` bigint(11) NOT NULL DEFAULT 0 COMMENT '删除时间,', `created_at` timestamp(0) NULL DEFAULT NULL, `updated_at` timestamp(0) NULL DEFAULT NULL, PRIMARY KEY (`id`) USING BTREE ) ENGINE = MyISAM AUTO_INCREMENT = 59 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of posts -- ---------------------------- INSERT INTO `posts` VALUES (58, '这里是标题', '<p>2222222222222222222</p>', 1, 1, 1592916586, '2020-06-23 16:19:38', '2020-06-23 20:49:46'); INSERT INTO `posts` VALUES (57, '这里是标题', '<p>``````````</p>', 1, 1, 0, '2020-06-23 16:18:36', '2020-06-23 19:28:52'); -- ---------------------------- -- Table structure for topics -- ---------------------------- DROP TABLE IF EXISTS `topics`; CREATE TABLE `topics` ( `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, `name` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', `status` tinyint(3) NOT NULL, `delete_time` bigint(20) NOT NULL DEFAULT 0, `created_at` timestamp(0) NULL DEFAULT NULL, `updated_at` timestamp(0) NULL DEFAULT NULL, PRIMARY KEY (`id`) USING BTREE ) ENGINE = MyISAM AUTO_INCREMENT = 9 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of topics -- ---------------------------- INSERT INTO `topics` VALUES (8, '感情11111', 1, 0, '2020-06-24 10:03:11', '2020-06-24 16:37:11'); -- ---------------------------- -- Table structure for users -- ---------------------------- DROP TABLE IF EXISTS `users`; CREATE TABLE `users` ( `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, `name` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `email` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `email_verified_at` timestamp(0) NULL DEFAULT NULL, `password` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `remember_token` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL, `created_at` timestamp(0) NULL DEFAULT NULL, `updated_at` timestamp(0) NULL DEFAULT NULL, `avatar` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, PRIMARY KEY (`id`) USING BTREE, UNIQUE INDEX `users_email_unique`(`email`) USING BTREE ) ENGINE = MyISAM AUTO_INCREMENT = 3 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of users -- ---------------------------- INSERT INTO `users` VALUES (1, 'admin1', 'admin@qq.com', NULL, '$2y$10$JVHf5obh4TpI2qIBY2lxR.D.vE85TRigPjpHGuvkAhauVx8Kw5wze', 'vxRHfzOy6Fbu5s7FL9viGu7s6FFRYlHanUiyjBE6WB51ptLkmtBS5mhIzZ4x', '2020-05-16 11:25:57', '2020-06-08 09:36:36', 'http://laravel.com/storage/2020-06/M338FwW1KFS670TGEvyTF3p50PkRZOx62CtmnYKs.jpeg'); INSERT INTO `users` VALUES (2, 'admins', 'admins@qq.com', NULL, '$2y$10$hi22qDsot.snh47YYBjN9OTRzwEeh/hpjNdXjifq/FM/3Nx5k70q2', 'JXBXpAFlwfxKGR7GkbiJllcOLHegOYWFrvaDPhHgtNL5WKT7h8JD5L5XfDlN', '2020-05-16 13:05:49', '2020-05-16 13:05:49', ''); -- ---------------------------- -- Table structure for zans -- ---------------------------- DROP TABLE IF EXISTS `zans`; CREATE TABLE `zans` ( `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, `user_id` int(11) NOT NULL DEFAULT 0, `post_id` int(11) NOT NULL DEFAULT 0, `created_at` timestamp(0) NULL DEFAULT NULL, `updated_at` timestamp(0) NULL DEFAULT NULL, PRIMARY KEY (`id`) USING BTREE ) ENGINE = MyISAM AUTO_INCREMENT = 12 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Fixed; -- ---------------------------- -- Records of zans -- ---------------------------- INSERT INTO `zans` VALUES (11, 2, 57, '2020-06-23 21:07:44', '2020-06-23 21:07:44'); SET FOREIGN_KEY_CHECKS = 1;
create table cart( num number primary key, type varchar(100), id varchar(100), item_img varchar(100), item_number varchar(100), item_name varchar(100), item_type varchar(100), item_size varchar(100), item_amount number default 0, item_price number default 0, cz_date date default sysdate ); desc cart select * from cart drop table cart
/** * Used at method CommonShisetsuService.existShisetsuAvailableService() * @author ThuanLM * @version $Id: CommonShisetsuService_existShisetsuAvailableService_Sel_01.sql 10749 2014-07-03 08:01:43Z p_re_mintoan $ */ SELECT SAS.SHISETSU_CD FROM BY_SHISETSU_AVAILABLE_SERVICE SAS WHERE SAS.SHISETSU_CD = /*shisetsuCd*/'000000001' AND SAS.AVAILABLE_SERVICE_KBN = /*availableServiceKbn*/'132'
insert into course (course_id, course_name,creation_date,last_updated_date) values(1001, 'React Training',sysdate(),sysdate()); insert into course (course_id, course_name,creation_date,last_updated_date) values(1002, 'Swift Training',sysdate(),sysdate()); insert into course (course_id, course_name,creation_date,last_updated_date) values(1003, 'Angular Training',sysdate(),sysdate()); insert into passport (id,number) values (3001,'EFG23232'); insert into passport (id,number) values (3002,'ABC23232'); insert into passport (id,number) values (3003,'IJK23232'); insert into student (id,name,passport_id) values(2001,'Anantha',3001); insert into student (id,name,passport_id) values(2002,'Anjitha',3002); insert into student (id,name,passport_id) values(2003,'Jaya',3003); insert into review (id,rating,description,course_course_id) values(4001,'5','Awesome Tutorials',1001); insert into review (id,rating,description,course_course_id) values(4002,'4','Good tutorials',1001); insert into review (id,rating,description,course_course_id) values(4003,'5','Superb tutorials',1003); insert into course_student (student_id,course_id) values(2001,1001); insert into course_student (student_id,course_id) values(2002,1001); insert into course_student (student_id,course_id) values(2001,1002); insert into course_student (student_id,course_id) values(2003,1001);
CREATE TABLE IF NOT EXISTS member ( name VARCHAR(255), pass VARCHAR(255) ) CHARSET=utf8;
-- --------------------------------------------------------------------------- -- -- gEDA - GPL Electronic Design Automation -- gparts - gEDA Parts Manager -- Copyright (C) 2009 Edward C. Hennessy -- Copyright (C) 2009 gEDA Contributors (see ChangeLog for details) -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA -- -- --------------------------------------------------------------------------- -- -- Create additional tables for storing discrete semiconductors. -- -- These tables store additional information to allow quick selection of -- discrete semiconductor components. -- -- --------------------------------------------------------------------------- -- -- Create a table for diodes. -- -- This table can be used for most diodes, including small-signal, small-signal -- Schottky, rectifiers and Schottky rectifiers. -- -- TODO Should this table include additional fields to indicate the diode type? -- (e.g. Small-signal, Rectifier, Schottky, etc...) -- CREATE TABLE Diode ( PartID INTEGER PRIMARY KEY, PackageID INTEGER NOT NULL, MaxReverseVoltage FLOAT, TypForwardVoltage FLOAT, AveForwardCurrent FLOAT ); -- --------------------------------------------------------------------------- -- -- Create a table for diodes. -- CREATE TABLE MOSFET ( PartID INTEGER PRIMARY KEY, PackageID INTEGER NOT NULL, Polarity TEXT, MaxDrainSourceVoltage FLOAT, MaxDrainCurrent FLOAT, TypGateThresholdVoltage FLOAT, PowerDissipation FLOAT ); -- --------------------------------------------------------------------------- -- -- Create a table for TVS diodes. -- -- TODO What is the best way to indicate bidirectional or unidirectional? The -- type may be apparent from the symbol. Then, an additional field would not -- be required. -- CREATE TABLE TVSDiode ( PartID INTEGER PRIMARY KEY, PackageID INTEGER NOT NULL, WorkingVoltage FLOAT, BreakdownVoltage FLOAT ); -- --------------------------------------------------------------------------- -- -- Create a table for zener diodes. -- CREATE TABLE ZenerDiode ( PartID INTEGER PRIMARY KEY, PackageID INTEGER NOT NULL, ZenerVoltage FLOAT ); -- --------------------------------------------------------------------------- -- -- Create a table for bipolar junction transistors. -- CREATE TABLE BJT ( PartID INTEGER PRIMARY KEY, PackageID INTEGER NOT NULL, Polarity TEXT, IC FLOAT, FT FLOAT, PD FLOAT ); -- --------------------------------------------------------------------------- -- -- Create a view for diodes. -- CREATE VIEW DiodeV AS SELECT Part.PartID, Company.CompanyName, Part.PartNumber, Package.PackageName, Diode.MaxReverseVoltage AS 'VR', Diode.TypForwardVoltage AS 'VF', Diode.AveForwardCurrent AS 'IF', Device.DeviceID FROM Diode JOIN Part USING ( PartID ) JOIN Package USING ( PackageID ) JOIN Company USING ( CompanyID ) JOIN Device USING ( DeviceID ); -- --------------------------------------------------------------------------- -- -- Create a view for MOSFETs -- CREATE VIEW MOSFETV AS SELECT Part.PartID, Company.CompanyName, Part.PartNumber, Package.PackageName, MOSFET.Polarity, MOSFET.MaxDrainSourceVoltage AS 'VDSS', MOSFET.MaxDrainCurrent AS 'ID', MOSFET.TypGateThresholdVoltage AS 'VGS', MOSFET.PowerDissipation AS 'PD', Device.DeviceID, Device.DeviceName FROM MOSFET JOIN Part USING ( PartID ) JOIN Package USING ( PackageID ) JOIN Company USING ( CompanyID ) JOIN Device USING ( DeviceID ); -- --------------------------------------------------------------------------- -- -- Create a view for rectifier diodes. -- -- Rectifier diodes are stored in the diode table, but are selected for -- a average forward current greater than or equal to 500 mA. -- -- Diodes where the average forward current is null are selected also. -- This way prevents parts from getting "lost" by not appearing in -- either table. -- CREATE VIEW RectifierDiodeV AS SELECT Part.PartID, Company.CompanyName, Part.PartNumber, Package.PackageName, Diode.MaxReverseVoltage AS 'VR', Diode.TypForwardVoltage AS 'VF', Diode.AveForwardCurrent AS 'IF', Device.DeviceID FROM Diode JOIN Part USING ( PartID ) JOIN Package USING ( PackageID ) JOIN Company USING ( CompanyID ) JOIN Device USING ( DeviceID ) WHERE Diode.AveForwardCurrent IS NULL OR Diode.AveForwardCurrent >= 0.5; -- --------------------------------------------------------------------------- -- -- Create a view for Switching diodes. -- -- Switching diodes are stored in the diode table, but are selected for -- a average forward current less than 500 mA. -- -- Diodes where the average forward current is null are selected also. -- This way prevents parts from getting "lost" by not appearing in -- either table. -- CREATE VIEW SwitchingDiodeV AS SELECT Part.PartID, Company.CompanyName, Part.PartNumber, Package.PackageName, Diode.MaxReverseVoltage AS 'VR', Diode.TypForwardVoltage AS 'VF', Diode.AveForwardCurrent AS 'IF', Device.DeviceID FROM Diode JOIN Part USING ( PartID ) JOIN Package USING ( PackageID ) JOIN Company USING ( CompanyID ) JOIN Device USING ( DeviceID ) WHERE Diode.AveForwardCurrent IS NULL OR Diode.AveForwardCurrent < 0.5; -- --------------------------------------------------------------------------- -- -- Create a view for TVS diodes. -- CREATE VIEW TVSDiodeV AS SELECT Part.PartID, Company.CompanyName, Part.PartNumber, TVSDiode.WorkingVoltage AS 'VRWM', TVSDiode.BreakdownVoltage AS 'VBR' FROM TVSDiode JOIN Part USING ( PartID ) JOIN Company USING ( CompanyID ); -- --------------------------------------------------------------------------- -- -- Create a view for zener diodes. -- CREATE VIEW ZenerDiodeV AS SELECT Part.PartID, Company.CompanyName, Part.PartNumber, Package.PackageName, ZenerDiode.ZenerVoltage AS 'VZ', Device.DeviceID, Device.DeviceName FROM ZenerDiode JOIN Part USING ( PartID ) JOIN Package USING ( PackageID ) JOIN Company USING ( CompanyID ) JOIN Device USING ( DeviceID ); -- --------------------------------------------------------------------------- -- -- Create a view for BJTs. -- CREATE VIEW BJTV AS SELECT Part.PartID, Company.CompanyName, Part.PartNumber, Package.PackageName, BJT.Polarity, BJT.IC, BJT.FT, BJT.PD, Device.DeviceID, Device.DeviceName FROM BJT JOIN Part USING ( PartID ) JOIN Package USING ( PackageID ) JOIN Company USING ( CompanyID ) JOIN Device USING ( DeviceID );
INSERT INTO camera (id, number, id_parking) VALUES (1, 'test_camera_utm', 1); INSERT INTO car (id, number, id_user) VALUES (1, 'CAB123', 1); INSERT INTO car (id, number, id_user) VALUES (2, 'CME987', 1); INSERT INTO car (id, number, id_user) VALUES (3, 'CTX436', 1);
CREATE TABLE IF NOT EXISTS experiment ( id INTEGER PRIMARY KEY, description TEXT, datetime TEXT, -- ISO8601 model TEXT, dataset TEXT, trials INTEGER, training_split REAL, optimisation_strategy TEXT, max_epochs INTEGER, optimiser TEXT, metric TEXT ); CREATE TABLE IF NOT EXISTS trial ( id INTEGER PRIMARY KEY, experiment_id INTEGER REFERENCES experiment(id), trial_number INTEGER, learning_rate REAL, batch_size INTEGER, hidden_channels INTEGER, dropout_probability REAL, representation_size INTEGER, hidden_layers INTEGER, embedding_dimensions INTEGER ); CREATE TABLE IF NOT EXISTS fold ( id INTEGER PRIMARY KEY, trial_id INTEGER REFERENCES trial(id), fold_number INTEGER, duration_secs REAL, train_loss REAL, val_loss REAL, test_loss REAL, epochs INT );
-- MySQL dump 10.13 Distrib 5.7.30, for Linux (x86_64) -- -- Host: localhost Database: App_Covid -- ------------------------------------------------------ -- Server version 5.7.30-0ubuntu0.18.04.1 /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -- -- Table structure for table `consul_med` -- DROP TABLE IF EXISTS `consul_med`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `consul_med` ( `id` int(11) NOT NULL AUTO_INCREMENT, `nif` int(11) NOT NULL, `medico_nome` varchar(45) DEFAULT NULL, `especialidade` varchar(20) DEFAULT NULL, `obser` varchar(30) DEFAULT NULL, `data` varchar(10) DEFAULT NULL, PRIMARY KEY (`id`,`nif`), KEY `nif` (`nif`), CONSTRAINT `consul_med_ibfk_1` FOREIGN KEY (`nif`) REFERENCES `infpes` (`nif`) ) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `consul_med` -- LOCK TABLES `consul_med` WRITE; /*!40000 ALTER TABLE `consul_med` DISABLE KEYS */; INSERT INTO `consul_med` VALUES (1,209432143,'Miguel Oliveira','Medicina Geral',NULL,'01-03-2020'),(2,209432143,'Miguel Fereira','Medicina Geral',NULL,'12-03-2020'),(3,215654970,'Yuri Ferreira','Medicina Interna',NULL,'15-04-2020'),(4,322548962,'Yuri Ferreira','Pneumologia','diabéticos','23-02-2020'),(5,239456876,'Ana Pereira','Medecina Geral',NULL,'09-03-2020'),(6,245965453,'David Duarte','Cardiologia','insuficiência cardíaca','12-05-2020'),(7,356986149,'Luís Guerreiro','Pneumologia',NULL,'22-05-2020'); /*!40000 ALTER TABLE `consul_med` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `examcompl` -- DROP TABLE IF EXISTS `examcompl`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `examcompl` ( `exam_id` int(11) NOT NULL AUTO_INCREMENT, `id` int(11) NOT NULL, `nome` varchar(30) NOT NULL, `data` varchar(10) NOT NULL, `obser` varchar(20) DEFAULT NULL, `resultado` varchar(20) DEFAULT NULL, PRIMARY KEY (`exam_id`,`id`), KEY `id` (`id`), CONSTRAINT `examcompl_ibfk_1` FOREIGN KEY (`id`) REFERENCES `consul_med` (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `examcompl` -- LOCK TABLES `examcompl` WRITE; /*!40000 ALTER TABLE `examcompl` DISABLE KEYS */; INSERT INTO `examcompl` VALUES (1,1,'Exame Covid-19','01-03-2020','Negativo','01-03-2020'),(2,2,'Exame Covid-19','12-03-2020','Positivo','12-03-2020'),(3,4,'Exame Covid-19','23-02-2020','Positivo','23-02-2020'),(4,5,'Exame Covid-19','09-03-2020','Negativo','09-03-2020'),(5,6,'Exame Covid-19','12-05-2020','Positivo','12-05-2020'); /*!40000 ALTER TABLE `examcompl` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `infpes` -- DROP TABLE IF EXISTS `infpes`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `infpes` ( `nif` int(11) NOT NULL AUTO_INCREMENT, `nome` varchar(45) NOT NULL, `data_de_nascimento` varchar(10) NOT NULL, `email` varchar(60) NOT NULL, `telefone` int(11) NOT NULL, `codigo_postal` varchar(8) NOT NULL, `localidade` varchar(50) NOT NULL, PRIMARY KEY (`nif`) ) ENGINE=InnoDB AUTO_INCREMENT=356986150 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `infpes` -- LOCK TABLES `infpes` WRITE; /*!40000 ALTER TABLE `infpes` DISABLE KEYS */; INSERT INTO `infpes` VALUES (209432143,'Alvaro Chines','10-10-1990','alvarones@gmail.com',954684596,'2840-433','Pinhal de Frades'),(215654970,'Claudio Mardinez','25-04-1995','mardinezo@gmail.com',934564786,'2865-678','Quinta das Laranjeiras'),(239456876,'Daniel Nunes','04-03-1998','dnunes@gmail.com',965322766,'2965-261','Lagamecas'),(245965453,'Isabel Andrade','05-07-1999','isadrade@gmail.com',914567845,'2670-377','Loures'),(322548962,'Ana Rodrigues','06-09-2000','anarodr@gmail.com',963243877,'2840-732','Casal do Marco'),(356986149,'Sara Manuela','12-02-2001','samanu@gmail.com',934586943,'2520/267','Peniche'); /*!40000 ALTER TABLE `infpes` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `medicacao` -- DROP TABLE IF EXISTS `medicacao`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `medicacao` ( `med_id` int(11) NOT NULL AUTO_INCREMENT, `id` int(11) NOT NULL, `nome` varchar(30) NOT NULL, `dose` varchar(20) DEFAULT NULL, `tratamento` varchar(20) DEFAULT NULL, PRIMARY KEY (`med_id`,`id`), KEY `id` (`id`), CONSTRAINT `medicacao_ibfk_1` FOREIGN KEY (`id`) REFERENCES `consul_med` (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `medicacao` -- LOCK TABLES `medicacao` WRITE; /*!40000 ALTER TABLE `medicacao` DISABLE KEYS */; INSERT INTO `medicacao` VALUES (1,4,'paracetamol','1000mg','3 vez ao dia'),(2,5,'ibuprofeno','200mg','2 vez ao dia'),(3,6,'paracetamol','1000mg','3 vez ao dia'); /*!40000 ALTER TABLE `medicacao` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `sintomas` -- DROP TABLE IF EXISTS `sintomas`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `sintomas` ( `id` int(11) NOT NULL, `sintoma` varchar(30) NOT NULL, PRIMARY KEY (`id`), CONSTRAINT `sintomas_ibfk_1` FOREIGN KEY (`id`) REFERENCES `consul_med` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `sintomas` -- LOCK TABLES `sintomas` WRITE; /*!40000 ALTER TABLE `sintomas` DISABLE KEYS */; INSERT INTO `sintomas` VALUES (4,'febre'),(5,'dores musculares'),(6,'falta de ar'); /*!40000 ALTER TABLE `sintomas` ENABLE KEYS */; UNLOCK TABLES; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; -- Dump completed on 2020-07-05 18:54:03
--liquibase formatted sql -- see: http://www.liquibase.org/ --changeset contact@contactopensource.com:9 --preconditions onFail:HALT onError:HALT --precondition-sql-check expectedResult:0 SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'geo_points' CREATE TABLE geo_points ( id uuid not null primary key, -- Programming-related tenant_id uuid, -- for optional multi-tenant installation typecast text, -- for optional single table inheritance state text, -- for optional state machine transition -- Update-related updated_at_timestamp_utc timestamp, -- example: 2020-01-01T00:00:00 always UTC updated_at_clock_counter bigint, -- example: 123456789 as suitable for a vector clock updated_by_text text, -- example: explanation of who updated the contact, why, how, etc. -- Geo-related latitude numeric(20,12), -- example: '37.8199' is 37.8199° N which is Golden Gate Bridge longitude numeric(20,12), -- example: '122.4783' is 122.4783° W (Golden Gate Bridge) altitude numeric(20,12), -- example: '67.056' is 67.056 meters to local surface of the earth elevation numeric(20,12) -- example: '67.056' is 67.056 meters to global sea level ); -- Programming-related CREATE INDEX ix_geo_points_tenant_id on geo_points(tenant_id);; CREATE INDEX ix_geo_points_typecast on geo_points(typecast); CREATE INDEX ix_geo_points_state on geo_points(state); -- Update-related CREATE INDEX ix_geo_points_updated_at_timestamp_utc on geo_points(updated_at_timestamp_utc); CREATE INDEX ix_geo_points_updated_at_clock_counter on geo_points(updated_at_clock_counter); CREATE INDEX ix_geo_points_updated_by_text on geo_points(updated_by_text); -- Geo-related CREATE INDEX ix_geo_points_latitude on geo_points(latitude); CREATE INDEX ix_geo_points_longitude on geo_points(longitude); CREATE INDEX ix_geo_points_altitude on geo_points(altitude); CREATE INDEX ix_geo_points_elevation on geo_points(elevation); --rollback drop table geo_points;
SELECT DISTINCT sudac.id, sudac.ime , sudac.prezime, rangsuca.naziv AS rang , LISTAGG((natjecanje.naziv || ' - ' || vrstaekipe.uzrast), ', ') AS natjecanje FROM sudac JOIN rangsuca ON sudac.id_rang = rangsuca.id JOIN lista ON sudac.id = lista.id_sudac JOIN natjecanje ON lista.id_natjecanje = natjecanje.id JOIN vrstaekipe ON vrstaekipe.id = natjecanje.id_vrsta JOIN mjesto ON sudac.pbr_stanovanja = mjesto.pbr WHERE mjesto.naziv = 'Zagreb' AND natjecanje.sezona = '2003/2004' GROUP BY sudac.id, sudac.ime, sudac.prezime, rangsuca.naziv ORDER BY sudac.id
CREATE DATABASE abibas_search IF NOT EXISTS; \c abibas_search CREATE TABLE IF NOT EXISTS products ( id BIGSERIAL NOT NULL PRIMARY_KEY, keyword VARCHAR, item_name VARCHAR, category VARCHAR, stars: INTEGER, pictures: VARCHAR );
SELECT -- 契約情報.全項目 C.* FROM -- 契約情報 CONTRACT_INFO C, -- T (SELECT F.CONTRACT_NO FROM FILE_NEGATION_WORKTABLE F WHERE F.SESSION_ID = /*sessionId*/'' GROUP BY F.CONTRACT_NO ) AS T WHERE -- 契約情報.契約番号 = T.契約番号 C.CONTRACT_NO = T.CONTRACT_NO
/* Navicat MySQL Data Transfer Source Server : mysql Source Server Version : 50718 Source Host : localhost:3306 Source Database : dadamgsystem Target Server Type : MYSQL Target Server Version : 50718 File Encoding : 65001 Date: 2017-10-24 00:02:46 */ SET FOREIGN_KEY_CHECKS=0; -- ---------------------------- -- Table structure for permission -- ---------------------------- DROP TABLE IF EXISTS `permission`; CREATE TABLE `permission` ( `id` int(11) NOT NULL, `name` varchar(255) DEFAULT NULL, `info` varchar(255) DEFAULT NULL, `createdTime` datetime DEFAULT NULL, `modifiyTime` datetime DEFAULT NULL, `createdUser` varchar(255) DEFAULT NULL, `modifiyUser` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of permission -- ----------------------------
-- phpMyAdmin SQL Dump -- version 4.5.1 -- http://www.phpmyadmin.net -- -- Hostiteľ: 127.0.0.1 -- Čas generovania: Št 31.Dec 2015, 13:26 -- Verzia serveru: 10.1.8-MariaDB -- Verzia PHP: 5.6.14 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 */; -- -- Databáza: `semestralka` -- -- -------------------------------------------------------- -- -- Štruktúra tabuľky pre tabuľku `conversations` -- CREATE TABLE `conversations` ( `id` int(11) NOT NULL, `sender_id` int(10) NOT NULL, `recipient_id` int(10) NOT NULL, `title` varchar(50) COLLATE utf8_slovak_ci NOT NULL, `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, `updated_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_slovak_ci; -- -------------------------------------------------------- -- -- Štruktúra tabuľky pre tabuľku `followers` -- CREATE TABLE `followers` ( `user_id` int(10) NOT NULL, `follower_id` int(10) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_slovak_ci; -- -------------------------------------------------------- -- -- Štruktúra tabuľky pre tabuľku `messages` -- CREATE TABLE `messages` ( `id` int(11) NOT NULL, `conversation_id` int(11) NOT NULL, `sender_id` int(11) NOT NULL, `text` longtext COLLATE utf8_slovak_ci NOT NULL, `new` tinyint(1) NOT NULL DEFAULT '1', `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_slovak_ci; -- -------------------------------------------------------- -- -- Štruktúra tabuľky pre tabuľku `notifications` -- CREATE TABLE `notifications` ( `id` int(11) NOT NULL, `user_id` int(11) NOT NULL, `text` varchar(150) COLLATE utf8_slovak_ci NOT NULL, `link` varchar(150) CHARACTER SET latin1 NOT NULL, `new` tinyint(1) NOT NULL DEFAULT '1' ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_slovak_ci; -- -------------------------------------------------------- -- -- Štruktúra tabuľky pre tabuľku `posts` -- CREATE TABLE `posts` ( `id` int(11) NOT NULL, `user_id` int(11) NOT NULL, `type` int(2) NOT NULL, `privacy` tinyint(1) NOT NULL, `title` varchar(50) COLLATE utf8_slovak_ci NOT NULL, `text` longtext COLLATE utf8_slovak_ci NOT NULL, `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, `updated_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_slovak_ci; -- -------------------------------------------------------- -- -- Štruktúra tabuľky pre tabuľku `users` -- CREATE TABLE `users` ( `id` int(11) NOT NULL, `email` varchar(100) CHARACTER SET latin1 NOT NULL, `password` varchar(255) COLLATE utf8_slovak_ci NOT NULL, `nick` varchar(50) COLLATE utf8_slovak_ci NOT NULL, `avatar` varchar(255) COLLATE utf8_slovak_ci NOT NULL DEFAULT 'unknown.png', `profile` text COLLATE utf8_slovak_ci NOT NULL, `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, `updated_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_slovak_ci; -- -- Kľúče pre exportované tabuľky -- -- -- Indexy pre tabuľku `conversations` -- ALTER TABLE `conversations` ADD PRIMARY KEY (`id`); -- -- Indexy pre tabuľku `messages` -- ALTER TABLE `messages` ADD PRIMARY KEY (`id`); -- -- Indexy pre tabuľku `notifications` -- ALTER TABLE `notifications` ADD PRIMARY KEY (`id`); -- -- Indexy pre tabuľku `posts` -- ALTER TABLE `posts` ADD PRIMARY KEY (`id`); -- -- Indexy pre tabuľku `users` -- ALTER TABLE `users` ADD PRIMARY KEY (`id`); -- -- AUTO_INCREMENT pre exportované tabuľky -- -- -- AUTO_INCREMENT pre tabuľku `conversations` -- ALTER TABLE `conversations` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11; -- -- AUTO_INCREMENT pre tabuľku `messages` -- ALTER TABLE `messages` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=20; -- -- AUTO_INCREMENT pre tabuľku `notifications` -- ALTER TABLE `notifications` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=44; -- -- AUTO_INCREMENT pre tabuľku `posts` -- ALTER TABLE `posts` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=14; -- -- AUTO_INCREMENT pre tabuľku `users` -- ALTER TABLE `users` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8; /*!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 */;
-- -- Table structure for table `note` -- DROP TABLE IF EXISTS `note`; CREATE TABLE IF NOT EXISTS `note` ( `id` int(11) NOT NULL AUTO_INCREMENT, `content` text CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=latin1; -- -- Dumping data for table `note` -- INSERT INTO `note` (`id`, `content`) VALUES (1, 'abababa'), (2, 'fdfggdgdfg'), (3, 'rhtyhrtrtyry'); /*!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 */;
-- 1.Consulta contemplando contagem ou totalização -- Contabilização do total de pedidos no sistema use minha_loja_gama; SELECT count(*) from pedidos; -- 2.Consulta contemplando a junção entre 2 tabelas -- Consulta sobre o endereço de cada cliente use minha_loja_gama; SELECT * from clientes inner join enderecos on clientes.idCliente = enderecos.clienteEndereco_Cliente; -- Consulta sobre o pedido de cada cliente SELECT * from clientes inner join pedidos on clientes.idCliente = pedidos.clientePedido_Cliente; -- 3.Consulta contemplando a junção entre 3 tabelas use minha_loja_gama; -- Consulta sobre o endereço de cada cliente e sua cidade e estado use minha_loja_gama; SELECT * from clientes inner join enderecos on clientes.idCliente = enderecos.clienteEndereco_Cliente inner join cidadeestado on enderecos.cidadeestadoEndereco_CidadeEstado = cidadeestado.idCidadeestado; -- Consulta sobre o pedido de cada cliente e qual o produto do pedido SELECT * from clientes inner join pedidos on clientes.idCliente = pedidos.clientePedido_Cliente inner join produtospedido on produtospedido.idProdutoPedido_Pedido = pedidos.idPedido; -- 4.Consulta contemplando a junção entre 2 tabelas + uma operação de totalização e agrupamento -- Calculo do total do inventário de cada produto use minha_loja_gama; SELECT produtos.idProduto, produtos.codProduto, produtos.nomeProduto, produtos.precoProduto, estoque.qtdEstoque, SUM(precoProduto * qtdEstoque) as totalInvetario from produtos inner join estoque on produtos.idProduto = estoque.produtoEstoque_Produto group by produtos.idProduto; -- 5.Consulta contemplando a junção entre 3 ou mais tabelas + uma operação de totalização e agrupamento -- Calculo do total do inventário de cada produto com o seu respectivo departamento use minha_loja_gama; SELECT produtos.idProduto, produtos.codProduto, produtos.nomeProduto, produtos.precoProduto, estoque.qtdEstoque, departamentos.nomeDepartamento, SUM(precoProduto * qtdEstoque) as totalInvetario from produtos inner join estoque on produtos.idProduto = estoque.produtoEstoque_Produto inner join departamentos on produtos.departamentoProduto_Departamento = departamentos.idDepartamento group by produtos.idProduto;
select * from pheno where category = 'procedure' or category = 'disorder' order by pheno_id; select naire_name, question_name, answer_name, pheno_name, value, body1, body2 from munjin2 where qualifier_name = 'Body structure' order by body1; update munjin2 set body1 = '传波钱' where value = '传波钱'; update munjin2 set (body1, body2) = ('传波钱', '坷弗率 酒贰') where value = '坷弗率 酒贰 传波钱'; update munjin2 set (body1, body2) = ('传波钱', '哭率 困') where value = '哭率 困 传波钱'; update munjin2 set (body1, body2) = ('传波钱', '哭率 酒贰') where value = '哭率 酒贰 传波钱'; update munjin2 set (body1, body2) = ('传波钱', '坷弗率 困') where value = '坷弗率 困 传波钱'; select value, count(*) from munjin2 where qualifier_name = 'Body structure' group by value order by count(*) desc; select * from munjin2 where value like '%传波钱%' and qualifier_name = 'Body structure';
/******************************************************************************* * File Name: cyfittergnu.inc * * PSoC Creator 4.2 * * Description: * * This file is automatically generated by PSoC Creator. * ******************************************************************************** * Copyright (c) 2007-2018 Cypress Semiconductor. All rights reserved. * You may use this file only in accordance with the license, terms, conditions, * disclaimers, and limitations in the end user license agreement accompanying * the software package with which this file was provided. ********************************************************************************/ .ifndef INCLUDED_CYFITTERGNU_INC .set INCLUDED_CYFITTERGNU_INC, 1 .include "cydevicegnu_trm.inc" /* PWM_1 */ .set PWM_1_cy_m0s8_tcpwm_1__CC, CYREG_TCPWM_CNT1_CC .set PWM_1_cy_m0s8_tcpwm_1__CC_BUFF, CYREG_TCPWM_CNT1_CC_BUFF .set PWM_1_cy_m0s8_tcpwm_1__COUNTER, CYREG_TCPWM_CNT1_COUNTER .set PWM_1_cy_m0s8_tcpwm_1__CTRL, CYREG_TCPWM_CNT1_CTRL .set PWM_1_cy_m0s8_tcpwm_1__INTR, CYREG_TCPWM_CNT1_INTR .set PWM_1_cy_m0s8_tcpwm_1__INTR_MASK, CYREG_TCPWM_CNT1_INTR_MASK .set PWM_1_cy_m0s8_tcpwm_1__INTR_MASKED, CYREG_TCPWM_CNT1_INTR_MASKED .set PWM_1_cy_m0s8_tcpwm_1__INTR_SET, CYREG_TCPWM_CNT1_INTR_SET .set PWM_1_cy_m0s8_tcpwm_1__PERIOD, CYREG_TCPWM_CNT1_PERIOD .set PWM_1_cy_m0s8_tcpwm_1__PERIOD_BUFF, CYREG_TCPWM_CNT1_PERIOD_BUFF .set PWM_1_cy_m0s8_tcpwm_1__STATUS, CYREG_TCPWM_CNT1_STATUS .set PWM_1_cy_m0s8_tcpwm_1__TCPWM_CMD, CYREG_TCPWM_CMD .set PWM_1_cy_m0s8_tcpwm_1__TCPWM_CMDCAPTURE_MASK, 0x02 .set PWM_1_cy_m0s8_tcpwm_1__TCPWM_CMDCAPTURE_SHIFT, 1 .set PWM_1_cy_m0s8_tcpwm_1__TCPWM_CMDRELOAD_MASK, 0x200 .set PWM_1_cy_m0s8_tcpwm_1__TCPWM_CMDRELOAD_SHIFT, 9 .set PWM_1_cy_m0s8_tcpwm_1__TCPWM_CMDSTART_MASK, 0x2000000 .set PWM_1_cy_m0s8_tcpwm_1__TCPWM_CMDSTART_SHIFT, 25 .set PWM_1_cy_m0s8_tcpwm_1__TCPWM_CMDSTOP_MASK, 0x20000 .set PWM_1_cy_m0s8_tcpwm_1__TCPWM_CMDSTOP_SHIFT, 17 .set PWM_1_cy_m0s8_tcpwm_1__TCPWM_CTRL, CYREG_TCPWM_CTRL .set PWM_1_cy_m0s8_tcpwm_1__TCPWM_CTRL_MASK, 0x02 .set PWM_1_cy_m0s8_tcpwm_1__TCPWM_CTRL_SHIFT, 1 .set PWM_1_cy_m0s8_tcpwm_1__TCPWM_INTR_CAUSE, CYREG_TCPWM_INTR_CAUSE .set PWM_1_cy_m0s8_tcpwm_1__TCPWM_INTR_CAUSE_MASK, 0x02 .set PWM_1_cy_m0s8_tcpwm_1__TCPWM_INTR_CAUSE_SHIFT, 1 .set PWM_1_cy_m0s8_tcpwm_1__TCPWM_NUMBER, 1 .set PWM_1_cy_m0s8_tcpwm_1__TR_CTRL0, CYREG_TCPWM_CNT1_TR_CTRL0 .set PWM_1_cy_m0s8_tcpwm_1__TR_CTRL1, CYREG_TCPWM_CNT1_TR_CTRL1 .set PWM_1_cy_m0s8_tcpwm_1__TR_CTRL2, CYREG_TCPWM_CNT1_TR_CTRL2 /* UART_1 */ .set UART_1_SCB__BIST_CONTROL, CYREG_SCB1_BIST_CONTROL .set UART_1_SCB__BIST_DATA, CYREG_SCB1_BIST_DATA .set UART_1_SCB__CTRL, CYREG_SCB1_CTRL .set UART_1_SCB__EZ_DATA00, CYREG_SCB1_EZ_DATA00 .set UART_1_SCB__EZ_DATA01, CYREG_SCB1_EZ_DATA01 .set UART_1_SCB__EZ_DATA02, CYREG_SCB1_EZ_DATA02 .set UART_1_SCB__EZ_DATA03, CYREG_SCB1_EZ_DATA03 .set UART_1_SCB__EZ_DATA04, CYREG_SCB1_EZ_DATA04 .set UART_1_SCB__EZ_DATA05, CYREG_SCB1_EZ_DATA05 .set UART_1_SCB__EZ_DATA06, CYREG_SCB1_EZ_DATA06 .set UART_1_SCB__EZ_DATA07, CYREG_SCB1_EZ_DATA07 .set UART_1_SCB__EZ_DATA08, CYREG_SCB1_EZ_DATA08 .set UART_1_SCB__EZ_DATA09, CYREG_SCB1_EZ_DATA09 .set UART_1_SCB__EZ_DATA10, CYREG_SCB1_EZ_DATA10 .set UART_1_SCB__EZ_DATA11, CYREG_SCB1_EZ_DATA11 .set UART_1_SCB__EZ_DATA12, CYREG_SCB1_EZ_DATA12 .set UART_1_SCB__EZ_DATA13, CYREG_SCB1_EZ_DATA13 .set UART_1_SCB__EZ_DATA14, CYREG_SCB1_EZ_DATA14 .set UART_1_SCB__EZ_DATA15, CYREG_SCB1_EZ_DATA15 .set UART_1_SCB__EZ_DATA16, CYREG_SCB1_EZ_DATA16 .set UART_1_SCB__EZ_DATA17, CYREG_SCB1_EZ_DATA17 .set UART_1_SCB__EZ_DATA18, CYREG_SCB1_EZ_DATA18 .set UART_1_SCB__EZ_DATA19, CYREG_SCB1_EZ_DATA19 .set UART_1_SCB__EZ_DATA20, CYREG_SCB1_EZ_DATA20 .set UART_1_SCB__EZ_DATA21, CYREG_SCB1_EZ_DATA21 .set UART_1_SCB__EZ_DATA22, CYREG_SCB1_EZ_DATA22 .set UART_1_SCB__EZ_DATA23, CYREG_SCB1_EZ_DATA23 .set UART_1_SCB__EZ_DATA24, CYREG_SCB1_EZ_DATA24 .set UART_1_SCB__EZ_DATA25, CYREG_SCB1_EZ_DATA25 .set UART_1_SCB__EZ_DATA26, CYREG_SCB1_EZ_DATA26 .set UART_1_SCB__EZ_DATA27, CYREG_SCB1_EZ_DATA27 .set UART_1_SCB__EZ_DATA28, CYREG_SCB1_EZ_DATA28 .set UART_1_SCB__EZ_DATA29, CYREG_SCB1_EZ_DATA29 .set UART_1_SCB__EZ_DATA30, CYREG_SCB1_EZ_DATA30 .set UART_1_SCB__EZ_DATA31, CYREG_SCB1_EZ_DATA31 .set UART_1_SCB__I2C_CFG, CYREG_SCB1_I2C_CFG .set UART_1_SCB__I2C_CTRL, CYREG_SCB1_I2C_CTRL .set UART_1_SCB__I2C_M_CMD, CYREG_SCB1_I2C_M_CMD .set UART_1_SCB__I2C_S_CMD, CYREG_SCB1_I2C_S_CMD .set UART_1_SCB__I2C_STATUS, CYREG_SCB1_I2C_STATUS .set UART_1_SCB__INTR_CAUSE, CYREG_SCB1_INTR_CAUSE .set UART_1_SCB__INTR_I2C_EC, CYREG_SCB1_INTR_I2C_EC .set UART_1_SCB__INTR_I2C_EC_MASK, CYREG_SCB1_INTR_I2C_EC_MASK .set UART_1_SCB__INTR_I2C_EC_MASKED, CYREG_SCB1_INTR_I2C_EC_MASKED .set UART_1_SCB__INTR_M, CYREG_SCB1_INTR_M .set UART_1_SCB__INTR_M_MASK, CYREG_SCB1_INTR_M_MASK .set UART_1_SCB__INTR_M_MASKED, CYREG_SCB1_INTR_M_MASKED .set UART_1_SCB__INTR_M_SET, CYREG_SCB1_INTR_M_SET .set UART_1_SCB__INTR_RX, CYREG_SCB1_INTR_RX .set UART_1_SCB__INTR_RX_MASK, CYREG_SCB1_INTR_RX_MASK .set UART_1_SCB__INTR_RX_MASKED, CYREG_SCB1_INTR_RX_MASKED .set UART_1_SCB__INTR_RX_SET, CYREG_SCB1_INTR_RX_SET .set UART_1_SCB__INTR_S, CYREG_SCB1_INTR_S .set UART_1_SCB__INTR_S_MASK, CYREG_SCB1_INTR_S_MASK .set UART_1_SCB__INTR_S_MASKED, CYREG_SCB1_INTR_S_MASKED .set UART_1_SCB__INTR_S_SET, CYREG_SCB1_INTR_S_SET .set UART_1_SCB__INTR_SPI_EC, CYREG_SCB1_INTR_SPI_EC .set UART_1_SCB__INTR_SPI_EC_MASK, CYREG_SCB1_INTR_SPI_EC_MASK .set UART_1_SCB__INTR_SPI_EC_MASKED, CYREG_SCB1_INTR_SPI_EC_MASKED .set UART_1_SCB__INTR_TX, CYREG_SCB1_INTR_TX .set UART_1_SCB__INTR_TX_MASK, CYREG_SCB1_INTR_TX_MASK .set UART_1_SCB__INTR_TX_MASKED, CYREG_SCB1_INTR_TX_MASKED .set UART_1_SCB__INTR_TX_SET, CYREG_SCB1_INTR_TX_SET .set UART_1_SCB__RX_CTRL, CYREG_SCB1_RX_CTRL .set UART_1_SCB__RX_FIFO_CTRL, CYREG_SCB1_RX_FIFO_CTRL .set UART_1_SCB__RX_FIFO_RD, CYREG_SCB1_RX_FIFO_RD .set UART_1_SCB__RX_FIFO_RD_SILENT, CYREG_SCB1_RX_FIFO_RD_SILENT .set UART_1_SCB__RX_FIFO_STATUS, CYREG_SCB1_RX_FIFO_STATUS .set UART_1_SCB__RX_MATCH, CYREG_SCB1_RX_MATCH .set UART_1_SCB__SPI_CTRL, CYREG_SCB1_SPI_CTRL .set UART_1_SCB__SPI_STATUS, CYREG_SCB1_SPI_STATUS .set UART_1_SCB__SS0_POSISTION, 0 .set UART_1_SCB__SS1_POSISTION, 1 .set UART_1_SCB__SS2_POSISTION, 2 .set UART_1_SCB__SS3_POSISTION, 3 .set UART_1_SCB__STATUS, CYREG_SCB1_STATUS .set UART_1_SCB__TX_CTRL, CYREG_SCB1_TX_CTRL .set UART_1_SCB__TX_FIFO_CTRL, CYREG_SCB1_TX_FIFO_CTRL .set UART_1_SCB__TX_FIFO_STATUS, CYREG_SCB1_TX_FIFO_STATUS .set UART_1_SCB__TX_FIFO_WR, CYREG_SCB1_TX_FIFO_WR .set UART_1_SCB__UART_CTRL, CYREG_SCB1_UART_CTRL .set UART_1_SCB__UART_RX_CTRL, CYREG_SCB1_UART_RX_CTRL .set UART_1_SCB__UART_RX_STATUS, CYREG_SCB1_UART_RX_STATUS .set UART_1_SCB__UART_TX_CTRL, CYREG_SCB1_UART_TX_CTRL .set UART_1_SCBCLK__DIVIDER_MASK, 0x0000FFFF .set UART_1_SCBCLK__ENABLE, CYREG_CLK_DIVIDER_B00 .set UART_1_SCBCLK__ENABLE_MASK, 0x80000000 .set UART_1_SCBCLK__MASK, 0x80000000 .set UART_1_SCBCLK__REGISTER, CYREG_CLK_DIVIDER_B00 .set UART_1_tx__0__DM__MASK, 0x38000 .set UART_1_tx__0__DM__SHIFT, 15 .set UART_1_tx__0__DR, CYREG_PRT0_DR .set UART_1_tx__0__HSIOM, CYREG_HSIOM_PORT_SEL0 .set UART_1_tx__0__HSIOM_GPIO, 0 .set UART_1_tx__0__HSIOM_I2C, 14 .set UART_1_tx__0__HSIOM_I2C_SDA, 14 .set UART_1_tx__0__HSIOM_MASK, 0x00F00000 .set UART_1_tx__0__HSIOM_SHIFT, 20 .set UART_1_tx__0__HSIOM_SPI, 15 .set UART_1_tx__0__HSIOM_SPI_MISO, 15 .set UART_1_tx__0__HSIOM_UART, 9 .set UART_1_tx__0__HSIOM_UART_TX, 9 .set UART_1_tx__0__INTCFG, CYREG_PRT0_INTCFG .set UART_1_tx__0__INTSTAT, CYREG_PRT0_INTSTAT .set UART_1_tx__0__MASK, 0x20 .set UART_1_tx__0__OUT_SEL, CYREG_UDB_PA0_CFG10 .set UART_1_tx__0__OUT_SEL_SHIFT, 10 .set UART_1_tx__0__OUT_SEL_VAL, -1 .set UART_1_tx__0__PA__CFG0, CYREG_UDB_PA0_CFG0 .set UART_1_tx__0__PA__CFG1, CYREG_UDB_PA0_CFG1 .set UART_1_tx__0__PA__CFG10, CYREG_UDB_PA0_CFG10 .set UART_1_tx__0__PA__CFG11, CYREG_UDB_PA0_CFG11 .set UART_1_tx__0__PA__CFG12, CYREG_UDB_PA0_CFG12 .set UART_1_tx__0__PA__CFG13, CYREG_UDB_PA0_CFG13 .set UART_1_tx__0__PA__CFG14, CYREG_UDB_PA0_CFG14 .set UART_1_tx__0__PA__CFG2, CYREG_UDB_PA0_CFG2 .set UART_1_tx__0__PA__CFG3, CYREG_UDB_PA0_CFG3 .set UART_1_tx__0__PA__CFG4, CYREG_UDB_PA0_CFG4 .set UART_1_tx__0__PA__CFG5, CYREG_UDB_PA0_CFG5 .set UART_1_tx__0__PA__CFG6, CYREG_UDB_PA0_CFG6 .set UART_1_tx__0__PA__CFG7, CYREG_UDB_PA0_CFG7 .set UART_1_tx__0__PA__CFG8, CYREG_UDB_PA0_CFG8 .set UART_1_tx__0__PA__CFG9, CYREG_UDB_PA0_CFG9 .set UART_1_tx__0__PC, CYREG_PRT0_PC .set UART_1_tx__0__PC2, CYREG_PRT0_PC2 .set UART_1_tx__0__PORT, 0 .set UART_1_tx__0__PS, CYREG_PRT0_PS .set UART_1_tx__0__SHIFT, 5 .set UART_1_tx__DR, CYREG_PRT0_DR .set UART_1_tx__INTCFG, CYREG_PRT0_INTCFG .set UART_1_tx__INTSTAT, CYREG_PRT0_INTSTAT .set UART_1_tx__MASK, 0x20 .set UART_1_tx__PA__CFG0, CYREG_UDB_PA0_CFG0 .set UART_1_tx__PA__CFG1, CYREG_UDB_PA0_CFG1 .set UART_1_tx__PA__CFG10, CYREG_UDB_PA0_CFG10 .set UART_1_tx__PA__CFG11, CYREG_UDB_PA0_CFG11 .set UART_1_tx__PA__CFG12, CYREG_UDB_PA0_CFG12 .set UART_1_tx__PA__CFG13, CYREG_UDB_PA0_CFG13 .set UART_1_tx__PA__CFG14, CYREG_UDB_PA0_CFG14 .set UART_1_tx__PA__CFG2, CYREG_UDB_PA0_CFG2 .set UART_1_tx__PA__CFG3, CYREG_UDB_PA0_CFG3 .set UART_1_tx__PA__CFG4, CYREG_UDB_PA0_CFG4 .set UART_1_tx__PA__CFG5, CYREG_UDB_PA0_CFG5 .set UART_1_tx__PA__CFG6, CYREG_UDB_PA0_CFG6 .set UART_1_tx__PA__CFG7, CYREG_UDB_PA0_CFG7 .set UART_1_tx__PA__CFG8, CYREG_UDB_PA0_CFG8 .set UART_1_tx__PA__CFG9, CYREG_UDB_PA0_CFG9 .set UART_1_tx__PC, CYREG_PRT0_PC .set UART_1_tx__PC2, CYREG_PRT0_PC2 .set UART_1_tx__PORT, 0 .set UART_1_tx__PS, CYREG_PRT0_PS .set UART_1_tx__SHIFT, 5 /* Clock_1 */ .set Clock_1__DIVIDER_MASK, 0x0000FFFF .set Clock_1__ENABLE, CYREG_CLK_DIVIDER_A00 .set Clock_1__ENABLE_MASK, 0x80000000 .set Clock_1__MASK, 0x80000000 .set Clock_1__REGISTER, CYREG_CLK_DIVIDER_A00 /* Clock_2 */ .set Clock_2__DIVIDER_MASK, 0x0000FFFF .set Clock_2__ENABLE, CYREG_CLK_DIVIDER_C00 .set Clock_2__ENABLE_MASK, 0x80000000 .set Clock_2__MASK, 0x80000000 .set Clock_2__REGISTER, CYREG_CLK_DIVIDER_C00 /* Timer_1 */ .set Timer_1_cy_m0s8_tcpwm_1__CC, CYREG_TCPWM_CNT0_CC .set Timer_1_cy_m0s8_tcpwm_1__CC_BUFF, CYREG_TCPWM_CNT0_CC_BUFF .set Timer_1_cy_m0s8_tcpwm_1__COUNTER, CYREG_TCPWM_CNT0_COUNTER .set Timer_1_cy_m0s8_tcpwm_1__CTRL, CYREG_TCPWM_CNT0_CTRL .set Timer_1_cy_m0s8_tcpwm_1__INTR, CYREG_TCPWM_CNT0_INTR .set Timer_1_cy_m0s8_tcpwm_1__INTR_MASK, CYREG_TCPWM_CNT0_INTR_MASK .set Timer_1_cy_m0s8_tcpwm_1__INTR_MASKED, CYREG_TCPWM_CNT0_INTR_MASKED .set Timer_1_cy_m0s8_tcpwm_1__INTR_SET, CYREG_TCPWM_CNT0_INTR_SET .set Timer_1_cy_m0s8_tcpwm_1__PERIOD, CYREG_TCPWM_CNT0_PERIOD .set Timer_1_cy_m0s8_tcpwm_1__PERIOD_BUFF, CYREG_TCPWM_CNT0_PERIOD_BUFF .set Timer_1_cy_m0s8_tcpwm_1__STATUS, CYREG_TCPWM_CNT0_STATUS .set Timer_1_cy_m0s8_tcpwm_1__TCPWM_CMD, CYREG_TCPWM_CMD .set Timer_1_cy_m0s8_tcpwm_1__TCPWM_CMDCAPTURE_MASK, 0x01 .set Timer_1_cy_m0s8_tcpwm_1__TCPWM_CMDCAPTURE_SHIFT, 0 .set Timer_1_cy_m0s8_tcpwm_1__TCPWM_CMDRELOAD_MASK, 0x100 .set Timer_1_cy_m0s8_tcpwm_1__TCPWM_CMDRELOAD_SHIFT, 8 .set Timer_1_cy_m0s8_tcpwm_1__TCPWM_CMDSTART_MASK, 0x1000000 .set Timer_1_cy_m0s8_tcpwm_1__TCPWM_CMDSTART_SHIFT, 24 .set Timer_1_cy_m0s8_tcpwm_1__TCPWM_CMDSTOP_MASK, 0x10000 .set Timer_1_cy_m0s8_tcpwm_1__TCPWM_CMDSTOP_SHIFT, 16 .set Timer_1_cy_m0s8_tcpwm_1__TCPWM_CTRL, CYREG_TCPWM_CTRL .set Timer_1_cy_m0s8_tcpwm_1__TCPWM_CTRL_MASK, 0x01 .set Timer_1_cy_m0s8_tcpwm_1__TCPWM_CTRL_SHIFT, 0 .set Timer_1_cy_m0s8_tcpwm_1__TCPWM_INTR_CAUSE, CYREG_TCPWM_INTR_CAUSE .set Timer_1_cy_m0s8_tcpwm_1__TCPWM_INTR_CAUSE_MASK, 0x01 .set Timer_1_cy_m0s8_tcpwm_1__TCPWM_INTR_CAUSE_SHIFT, 0 .set Timer_1_cy_m0s8_tcpwm_1__TCPWM_NUMBER, 0 .set Timer_1_cy_m0s8_tcpwm_1__TR_CTRL0, CYREG_TCPWM_CNT0_TR_CTRL0 .set Timer_1_cy_m0s8_tcpwm_1__TR_CTRL1, CYREG_TCPWM_CNT0_TR_CTRL1 .set Timer_1_cy_m0s8_tcpwm_1__TR_CTRL2, CYREG_TCPWM_CNT0_TR_CTRL2 /* UltraSone_1_Echo */ .set UltraSone_1_Echo__0__DM__MASK, 0xE00000 .set UltraSone_1_Echo__0__DM__SHIFT, 21 .set UltraSone_1_Echo__0__DR, CYREG_PRT3_DR .set UltraSone_1_Echo__0__HSIOM, CYREG_HSIOM_PORT_SEL3 .set UltraSone_1_Echo__0__HSIOM_MASK, 0xF0000000 .set UltraSone_1_Echo__0__HSIOM_SHIFT, 28 .set UltraSone_1_Echo__0__INTCFG, CYREG_PRT3_INTCFG .set UltraSone_1_Echo__0__INTSTAT, CYREG_PRT3_INTSTAT .set UltraSone_1_Echo__0__MASK, 0x80 .set UltraSone_1_Echo__0__PA__CFG0, CYREG_UDB_PA3_CFG0 .set UltraSone_1_Echo__0__PA__CFG1, CYREG_UDB_PA3_CFG1 .set UltraSone_1_Echo__0__PA__CFG10, CYREG_UDB_PA3_CFG10 .set UltraSone_1_Echo__0__PA__CFG11, CYREG_UDB_PA3_CFG11 .set UltraSone_1_Echo__0__PA__CFG12, CYREG_UDB_PA3_CFG12 .set UltraSone_1_Echo__0__PA__CFG13, CYREG_UDB_PA3_CFG13 .set UltraSone_1_Echo__0__PA__CFG14, CYREG_UDB_PA3_CFG14 .set UltraSone_1_Echo__0__PA__CFG2, CYREG_UDB_PA3_CFG2 .set UltraSone_1_Echo__0__PA__CFG3, CYREG_UDB_PA3_CFG3 .set UltraSone_1_Echo__0__PA__CFG4, CYREG_UDB_PA3_CFG4 .set UltraSone_1_Echo__0__PA__CFG5, CYREG_UDB_PA3_CFG5 .set UltraSone_1_Echo__0__PA__CFG6, CYREG_UDB_PA3_CFG6 .set UltraSone_1_Echo__0__PA__CFG7, CYREG_UDB_PA3_CFG7 .set UltraSone_1_Echo__0__PA__CFG8, CYREG_UDB_PA3_CFG8 .set UltraSone_1_Echo__0__PA__CFG9, CYREG_UDB_PA3_CFG9 .set UltraSone_1_Echo__0__PC, CYREG_PRT3_PC .set UltraSone_1_Echo__0__PC2, CYREG_PRT3_PC2 .set UltraSone_1_Echo__0__PORT, 3 .set UltraSone_1_Echo__0__PS, CYREG_PRT3_PS .set UltraSone_1_Echo__0__SHIFT, 7 .set UltraSone_1_Echo__DR, CYREG_PRT3_DR .set UltraSone_1_Echo__INTCFG, CYREG_PRT3_INTCFG .set UltraSone_1_Echo__INTSTAT, CYREG_PRT3_INTSTAT .set UltraSone_1_Echo__MASK, 0x80 .set UltraSone_1_Echo__PA__CFG0, CYREG_UDB_PA3_CFG0 .set UltraSone_1_Echo__PA__CFG1, CYREG_UDB_PA3_CFG1 .set UltraSone_1_Echo__PA__CFG10, CYREG_UDB_PA3_CFG10 .set UltraSone_1_Echo__PA__CFG11, CYREG_UDB_PA3_CFG11 .set UltraSone_1_Echo__PA__CFG12, CYREG_UDB_PA3_CFG12 .set UltraSone_1_Echo__PA__CFG13, CYREG_UDB_PA3_CFG13 .set UltraSone_1_Echo__PA__CFG14, CYREG_UDB_PA3_CFG14 .set UltraSone_1_Echo__PA__CFG2, CYREG_UDB_PA3_CFG2 .set UltraSone_1_Echo__PA__CFG3, CYREG_UDB_PA3_CFG3 .set UltraSone_1_Echo__PA__CFG4, CYREG_UDB_PA3_CFG4 .set UltraSone_1_Echo__PA__CFG5, CYREG_UDB_PA3_CFG5 .set UltraSone_1_Echo__PA__CFG6, CYREG_UDB_PA3_CFG6 .set UltraSone_1_Echo__PA__CFG7, CYREG_UDB_PA3_CFG7 .set UltraSone_1_Echo__PA__CFG8, CYREG_UDB_PA3_CFG8 .set UltraSone_1_Echo__PA__CFG9, CYREG_UDB_PA3_CFG9 .set UltraSone_1_Echo__PC, CYREG_PRT3_PC .set UltraSone_1_Echo__PC2, CYREG_PRT3_PC2 .set UltraSone_1_Echo__PORT, 3 .set UltraSone_1_Echo__PS, CYREG_PRT3_PS .set UltraSone_1_Echo__SHIFT, 7 .set UltraSone_1_Echo_intr__INTC_CLR_EN_REG, CYREG_CM0_ICER .set UltraSone_1_Echo_intr__INTC_CLR_PD_REG, CYREG_CM0_ICPR .set UltraSone_1_Echo_intr__INTC_MASK, 0x10000 .set UltraSone_1_Echo_intr__INTC_NUMBER, 16 .set UltraSone_1_Echo_intr__INTC_PRIOR_MASK, 0xC0 .set UltraSone_1_Echo_intr__INTC_PRIOR_NUM, 3 .set UltraSone_1_Echo_intr__INTC_PRIOR_REG, CYREG_CM0_IPR4 .set UltraSone_1_Echo_intr__INTC_SET_EN_REG, CYREG_CM0_ISER .set UltraSone_1_Echo_intr__INTC_SET_PD_REG, CYREG_CM0_ISPR /* UltraSone_1_Trig */ .set UltraSone_1_Trig__0__DM__MASK, 0xE00000 .set UltraSone_1_Trig__0__DM__SHIFT, 21 .set UltraSone_1_Trig__0__DR, CYREG_PRT0_DR .set UltraSone_1_Trig__0__HSIOM, CYREG_HSIOM_PORT_SEL0 .set UltraSone_1_Trig__0__HSIOM_MASK, 0xF0000000 .set UltraSone_1_Trig__0__HSIOM_SHIFT, 28 .set UltraSone_1_Trig__0__INTCFG, CYREG_PRT0_INTCFG .set UltraSone_1_Trig__0__INTSTAT, CYREG_PRT0_INTSTAT .set UltraSone_1_Trig__0__MASK, 0x80 .set UltraSone_1_Trig__0__OUT_SEL, CYREG_UDB_PA0_CFG10 .set UltraSone_1_Trig__0__OUT_SEL_SHIFT, 14 .set UltraSone_1_Trig__0__OUT_SEL_VAL, 2 .set UltraSone_1_Trig__0__PA__CFG0, CYREG_UDB_PA0_CFG0 .set UltraSone_1_Trig__0__PA__CFG1, CYREG_UDB_PA0_CFG1 .set UltraSone_1_Trig__0__PA__CFG10, CYREG_UDB_PA0_CFG10 .set UltraSone_1_Trig__0__PA__CFG11, CYREG_UDB_PA0_CFG11 .set UltraSone_1_Trig__0__PA__CFG12, CYREG_UDB_PA0_CFG12 .set UltraSone_1_Trig__0__PA__CFG13, CYREG_UDB_PA0_CFG13 .set UltraSone_1_Trig__0__PA__CFG14, CYREG_UDB_PA0_CFG14 .set UltraSone_1_Trig__0__PA__CFG2, CYREG_UDB_PA0_CFG2 .set UltraSone_1_Trig__0__PA__CFG3, CYREG_UDB_PA0_CFG3 .set UltraSone_1_Trig__0__PA__CFG4, CYREG_UDB_PA0_CFG4 .set UltraSone_1_Trig__0__PA__CFG5, CYREG_UDB_PA0_CFG5 .set UltraSone_1_Trig__0__PA__CFG6, CYREG_UDB_PA0_CFG6 .set UltraSone_1_Trig__0__PA__CFG7, CYREG_UDB_PA0_CFG7 .set UltraSone_1_Trig__0__PA__CFG8, CYREG_UDB_PA0_CFG8 .set UltraSone_1_Trig__0__PA__CFG9, CYREG_UDB_PA0_CFG9 .set UltraSone_1_Trig__0__PC, CYREG_PRT0_PC .set UltraSone_1_Trig__0__PC2, CYREG_PRT0_PC2 .set UltraSone_1_Trig__0__PORT, 0 .set UltraSone_1_Trig__0__PS, CYREG_PRT0_PS .set UltraSone_1_Trig__0__SHIFT, 7 .set UltraSone_1_Trig__DR, CYREG_PRT0_DR .set UltraSone_1_Trig__INTCFG, CYREG_PRT0_INTCFG .set UltraSone_1_Trig__INTSTAT, CYREG_PRT0_INTSTAT .set UltraSone_1_Trig__MASK, 0x80 .set UltraSone_1_Trig__PA__CFG0, CYREG_UDB_PA0_CFG0 .set UltraSone_1_Trig__PA__CFG1, CYREG_UDB_PA0_CFG1 .set UltraSone_1_Trig__PA__CFG10, CYREG_UDB_PA0_CFG10 .set UltraSone_1_Trig__PA__CFG11, CYREG_UDB_PA0_CFG11 .set UltraSone_1_Trig__PA__CFG12, CYREG_UDB_PA0_CFG12 .set UltraSone_1_Trig__PA__CFG13, CYREG_UDB_PA0_CFG13 .set UltraSone_1_Trig__PA__CFG14, CYREG_UDB_PA0_CFG14 .set UltraSone_1_Trig__PA__CFG2, CYREG_UDB_PA0_CFG2 .set UltraSone_1_Trig__PA__CFG3, CYREG_UDB_PA0_CFG3 .set UltraSone_1_Trig__PA__CFG4, CYREG_UDB_PA0_CFG4 .set UltraSone_1_Trig__PA__CFG5, CYREG_UDB_PA0_CFG5 .set UltraSone_1_Trig__PA__CFG6, CYREG_UDB_PA0_CFG6 .set UltraSone_1_Trig__PA__CFG7, CYREG_UDB_PA0_CFG7 .set UltraSone_1_Trig__PA__CFG8, CYREG_UDB_PA0_CFG8 .set UltraSone_1_Trig__PA__CFG9, CYREG_UDB_PA0_CFG9 .set UltraSone_1_Trig__PC, CYREG_PRT0_PC .set UltraSone_1_Trig__PC2, CYREG_PRT0_PC2 .set UltraSone_1_Trig__PORT, 0 .set UltraSone_1_Trig__PS, CYREG_PRT0_PS .set UltraSone_1_Trig__SHIFT, 7 /* Miscellaneous */ .set CYDEV_BCLK__HFCLK__HZ, 24000000 .set CYDEV_BCLK__HFCLK__KHZ, 24000 .set CYDEV_BCLK__HFCLK__MHZ, 24 .set CYDEV_BCLK__SYSCLK__HZ, 24000000 .set CYDEV_BCLK__SYSCLK__KHZ, 24000 .set CYDEV_BCLK__SYSCLK__MHZ, 24 .set CYDEV_CHIP_DIE_LEOPARD, 1 .set CYDEV_CHIP_DIE_PSOC4A, 18 .set CYDEV_CHIP_DIE_PSOC5LP, 2 .set CYDEV_CHIP_DIE_PSOC5TM, 3 .set CYDEV_CHIP_DIE_TMA4, 4 .set CYDEV_CHIP_DIE_UNKNOWN, 0 .set CYDEV_CHIP_FAMILY_FM0P, 5 .set CYDEV_CHIP_FAMILY_FM3, 6 .set CYDEV_CHIP_FAMILY_FM4, 7 .set CYDEV_CHIP_FAMILY_PSOC3, 1 .set CYDEV_CHIP_FAMILY_PSOC4, 2 .set CYDEV_CHIP_FAMILY_PSOC5, 3 .set CYDEV_CHIP_FAMILY_PSOC6, 4 .set CYDEV_CHIP_FAMILY_UNKNOWN, 0 .set CYDEV_CHIP_FAMILY_USED, CYDEV_CHIP_FAMILY_PSOC4 .set CYDEV_CHIP_JTAG_ID, 0x04C81193 .set CYDEV_CHIP_MEMBER_3A, 1 .set CYDEV_CHIP_MEMBER_4A, 18 .set CYDEV_CHIP_MEMBER_4D, 13 .set CYDEV_CHIP_MEMBER_4E, 6 .set CYDEV_CHIP_MEMBER_4F, 19 .set CYDEV_CHIP_MEMBER_4G, 4 .set CYDEV_CHIP_MEMBER_4H, 17 .set CYDEV_CHIP_MEMBER_4I, 23 .set CYDEV_CHIP_MEMBER_4J, 14 .set CYDEV_CHIP_MEMBER_4K, 15 .set CYDEV_CHIP_MEMBER_4L, 22 .set CYDEV_CHIP_MEMBER_4M, 21 .set CYDEV_CHIP_MEMBER_4N, 10 .set CYDEV_CHIP_MEMBER_4O, 7 .set CYDEV_CHIP_MEMBER_4P, 20 .set CYDEV_CHIP_MEMBER_4Q, 12 .set CYDEV_CHIP_MEMBER_4R, 8 .set CYDEV_CHIP_MEMBER_4S, 11 .set CYDEV_CHIP_MEMBER_4T, 9 .set CYDEV_CHIP_MEMBER_4U, 5 .set CYDEV_CHIP_MEMBER_4V, 16 .set CYDEV_CHIP_MEMBER_5A, 3 .set CYDEV_CHIP_MEMBER_5B, 2 .set CYDEV_CHIP_MEMBER_6A, 24 .set CYDEV_CHIP_MEMBER_FM3, 28 .set CYDEV_CHIP_MEMBER_FM4, 29 .set CYDEV_CHIP_MEMBER_PDL_FM0P_TYPE1, 25 .set CYDEV_CHIP_MEMBER_PDL_FM0P_TYPE2, 26 .set CYDEV_CHIP_MEMBER_PDL_FM0P_TYPE3, 27 .set CYDEV_CHIP_MEMBER_UNKNOWN, 0 .set CYDEV_CHIP_MEMBER_USED, CYDEV_CHIP_MEMBER_4A .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_4D_PRODUCTION, 0 .set CYDEV_CHIP_REVISION_4E_CCG2_NO_USBPD, 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_4R_PRODUCTION, 0 .set CYDEV_CHIP_REVISION_4S_PRODUCTION, 0 .set CYDEV_CHIP_REVISION_4T_PRODUCTION, 0 .set CYDEV_CHIP_REVISION_4U_PRODUCTION, 0 .set CYDEV_CHIP_REVISION_4V_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_6A_ES, 17 .set CYDEV_CHIP_REVISION_6A_NO_UDB, 33 .set CYDEV_CHIP_REVISION_6A_PRODUCTION, 33 .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_4A_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_AllowWithInfo, 1 .set CYDEV_CONFIG_UNUSED_IO_Disallowed, 2 .set CYDEV_CONFIG_UNUSED_IO, CYDEV_CONFIG_UNUSED_IO_Disallowed .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_SWD, 2 .set CYDEV_DEBUGGING_DPS, CYDEV_DEBUGGING_DPS_SWD .set CYDEV_DEBUGGING_ENABLE, 1 .set CYDEV_DFT_SELECT_CLK0, 1 .set CYDEV_DFT_SELECT_CLK1, 2 .set CYDEV_HEAP_SIZE, 0x80 .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_WDT_GENERATE_ISR, 1 .set CYIPBLOCK_M0S8_CTBM_VERSION, 0 .set CYIPBLOCK_m0s8cpuss_VERSION, 0 .set CYIPBLOCK_m0s8csd_VERSION, 0 .set CYIPBLOCK_m0s8gpio2_VERSION, 0 .set CYIPBLOCK_m0s8hsiom4a_VERSION, 0 .set CYIPBLOCK_m0s8lcd_VERSION, 0 .set CYIPBLOCK_m0s8lpcomp_VERSION, 0 .set CYIPBLOCK_m0s8pclk_VERSION, 0 .set CYIPBLOCK_m0s8sar_VERSION, 0 .set CYIPBLOCK_m0s8scb_VERSION, 0 .set CYIPBLOCK_m0s8srssv2_VERSION, 1 .set CYIPBLOCK_m0s8tcpwm_VERSION, 0 .set CYIPBLOCK_m0s8udbif_VERSION, 0 .set CYIPBLOCK_S8_GPIO_VERSION, 2 .set CYDEV_BOOTLOADER_ENABLE, 0 .endif
DELETE FROM `weenie` WHERE class_Id IN (42852,43065,43066,43067,43020);
/************************************************ * misc table * ************************************************/ CREATE TABLE IF NOT EXISTS misc ( id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT UNIQUE NOT NULL, value TEXT, vtype TEXT NOT NULL ); INSERT INTO misc (name, value, vtype) VALUES ('language', 'Chinese', 'STRING'); INSERT INTO misc (name, value, vtype) VALUES ('rtsp_auth', '0', 'BOOLEAN'); /************************************************ * base_info table * ************************************************/ CREATE TABLE IF NOT EXISTS base_info ( id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT UNIQUE NOT NULL, value TEXT NOT NULL, rw INTEGER ); INSERT INTO base_info (name, value, rw) VALUES ('device_name', 'ipcam', 1); INSERT INTO base_info (name, value, rw) VALUES ('location', 'China', 1); INSERT INTO base_info (name, value, rw) VALUES ('comment', '', 1); INSERT INTO base_info (name, value, rw) VALUES ('manufacturer', 'SZYC', 0); INSERT INTO base_info (name, value, rw) VALUES ('model', 'DCTX-003', 0); INSERT INTO base_info (name, value, rw) VALUES ('firmware', '1.0.0', 0); INSERT INTO base_info (name, value, rw) VALUES ('serial', 'NCD1081A16000001', 0); INSERT INTO base_info (name, value, rw) VALUES ('hardware', 'Rev.1', 0); INSERT INTO base_info (name, value, rw) VALUES ('device_type', '3', 0); /************************************************ * users table * ************************************************/ CREATE TABLE IF NOT EXISTS users ( id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT UNIQUE NOT NULL, password TEXT NOT NULL, role TEXT NOT NULL ); INSERT INTO users (name, password, role) VALUES ('admin', '123456', 'administrator'); INSERT INTO users (name, password, role) VALUES ('operator', '123456', 'operator'); INSERT INTO users (name, password, role) VALUES ('user', '123456', 'user'); /************************************************ * datetime table * ************************************************/ CREATE TABLE IF NOT EXISTS datetime ( id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT UNIQUE NOT NULL, value TEXT, vtype TEXT NOT NULL ); INSERT INTO datetime (name, value, vtype) VALUES ('timezone', 'ChinaStandardTime-8', 'STRING'); INSERT INTO datetime (name, value, vtype) VALUES ('use_ntp', '0', 'BOOLEAN'); INSERT INTO datetime (name, value, vtype) VALUES ('ntp_server', 'pool.ntp.org', 'STRING'); /************************************************ * video table * ************************************************/ CREATE TABLE IF NOT EXISTS video ( id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT UNIQUE NOT NULL, value TEXT, vtype TEXT NOT NULL ); INSERT INTO video (name, value, vtype) VALUES ('flip', '0', 'BOOLEAN'); INSERT INTO video (name, value, vtype) VALUES ('mirror', '0', 'BOOLEAN'); INSERT INTO video (name, value, vtype) VALUES ('profile', 'baseline', 'STRING'); /* Main profile */ INSERT INTO video (name, value, vtype) VALUES ('master:frame_rate', '10', 'INTEGER'); INSERT INTO video (name, value, vtype) VALUES ('master:bit_rate', 'CBR', 'STRING'); INSERT INTO video (name, value, vtype) VALUES ('master:bit_rate_value', '2048', 'INTEGER'); INSERT INTO video (name, value, vtype) VALUES ('master:resolution', '720P', 'STRING'); INSERT INTO video (name, value, vtype) VALUES ('master:stream_path', '0', 'STRING'); /* Sub profile */ INSERT INTO video (name, value, vtype) VALUES ('slave:frame_rate', '10', 'INTEGER'); INSERT INTO video (name, value, vtype) VALUES ('slave:bit_rate', 'CBR', 'STRING'); INSERT INTO video (name, value, vtype) VALUES ('slave:bit_rate_value', '1024', 'INTEGER'); INSERT INTO video (name, value, vtype) VALUES ('slave:resolution', 'D1', 'STRING'); INSERT INTO video (name, value, vtype) VALUES ('slave:stream_path', '1', 'STRING'); /************************************************ * image table * ************************************************/ CREATE TABLE IF NOT EXISTS image ( id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT UNIQUE NOT NULL, value TEXT, vtype TEXT NOT NULL ); INSERT INTO image (name, value, vtype) VALUES ('watermark', '0', 'BOOLEAN'); INSERT INTO image (name, value, vtype) VALUES ('3ddnr', '0', 'BOOLEAN'); INSERT INTO image (name, value, vtype) VALUES ('brightness', '128', 'INTEGER'); INSERT INTO image (name, value, vtype) VALUES ('chrominance', '128', 'INTEGER'); INSERT INTO image (name, value, vtype) VALUES ('contrast', '128', 'INTEGER'); INSERT INTO image (name, value, vtype) VALUES ('saturation', '128', 'INTEGER'); INSERT INTO image (name, value, vtype) VALUES ('scenario', '50Hz', 'STRING'); /************************************************ * privacy_block table * ************************************************/ CREATE TABLE IF NOT EXISTS privacy_block ( id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT UNIQUE NOT NULL, enable INTEGER NOT NULL, left INTEGER NOT NULL, top INTEGER NOT NULL, width INTEGER NOT NULL, height INTEGER NOT NULL, color INTEGER NOT NULL ); INSERT INTO privacy_block (name, enable, left, top, width, height, color) VALUES ('region1', 0, 0, 0, 67, 90, 0); INSERT INTO privacy_block (name, enable, left, top, width, height, color) VALUES ('region2', 0, 0, 0, 67, 90, 0); /************************************************ * day_night_mode table * ************************************************/ CREATE TABLE IF NOT EXISTS day_night_mode ( id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT UNIQUE NOT NULL, value INTEGER NOT NULL ); INSERT INTO day_night_mode (name, value) VALUES ('force_night_mode', 0); INSERT INTO day_night_mode (name, value) VALUES ('night_mode_threshold', 30); INSERT INTO day_night_mode (name, value) VALUES ('ir_intensity', 50); /************************************************ * osd table * ************************************************/ CREATE TABLE IF NOT EXISTS osd ( id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT UNIQUE NOT NULL, isshow BOOLEAN, size INTEGER, left INTEGER, top INTEGER, color INTEGER ); INSERT INTO osd (name, isshow, size, left, top, color) VALUES ('master:datetime', 1, 36, 10, 10, 0); INSERT INTO osd (name, isshow, size, left, top, color) VALUES ('master:device_name', 0, 36, 10, 10, 0); INSERT INTO osd (name, isshow, size, left, top, color) VALUES ('master:comment', 0, 36, 10, 42, 0); INSERT INTO osd (name, isshow, size, left, top, color) VALUES ('master:frame_rate', 0, 36, 10, 928, 0); INSERT INTO osd (name, isshow, size, left, top, color) VALUES ('master:bit_rate', 0, 36, 10, 960, 0); INSERT INTO osd (name, isshow, size, left, top, color) VALUES ('slave:datetime', 1, 24, 10, 10, 0); INSERT INTO osd (name, isshow, size, left, top, color) VALUES ('slave:device_name', 0, 24, 10, 10, 0); INSERT INTO osd (name, isshow, size, left, top, color) VALUES ('slave:comment', 0, 24, 10, 42, 0); INSERT INTO osd (name, isshow, size, left, top, color) VALUES ('slave:frame_rate', 0, 24, 10, 928, 0); INSERT INTO osd (name, isshow, size, left, top, color) VALUES ('slave:bit_rate', 0, 24, 10, 960, 0); /************************************************ * szyc table * ************************************************/ CREATE TABLE IF NOT EXISTS szyc ( id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT UNIQUE NOT NULL, value TEXT ); INSERT INTO szyc (name, value) VALUES ('train_num', '000000'); INSERT INTO szyc (name, value) VALUES ('carriage_num', '1'); INSERT INTO szyc (name, value) VALUES ('position_num', '1'); /************************************************ * network table * ************************************************/ CREATE TABLE IF NOT EXISTS network ( id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT UNIQUE NOT NULL, value TEXT NOT NULL ); INSERT INTO network (name, value) VALUES ('method', 'static'); /************************************************ * network_static table * ************************************************/ CREATE TABLE IF NOT EXISTS network_static ( id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT UNIQUE NOT NULL, value TEXT ); INSERT INTO network_static (name, value) VALUES ('ipaddr', '192.168.110.71'); INSERT INTO network_static (name, value) VALUES ('netmask', '255.255.0.0'); INSERT INTO network_static (name, value) VALUES ('gateway', '192.168.0.1'); INSERT INTO network_static (name, value) VALUES ('dns1', '192.168.0.1'); INSERT INTO network_static (name, value) VALUES ('dns2', ''); /************************************************ * network_pppoe table * ************************************************/ CREATE TABLE IF NOT EXISTS network_pppoe ( id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT UNIQUE NOT NULL, value TEXT ); INSERT INTO network_pppoe (name, value) VALUES ('username', ''); INSERT INTO network_pppoe (name, value) VALUES ('password', ''); /************************************************ * network_port table * ************************************************/ CREATE TABLE IF NOT EXISTS network_port ( id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT UNIQUE NOT NULL, value INTEGER UNIQUE NOT NULL ); INSERT INTO network_port (name, value) VALUES ('http', 80); INSERT INTO network_port (name, value) VALUES ('ftp', 21); INSERT INTO network_port (name, value) VALUES ('rtsp', 554); /************************************************ * event_input table * ************************************************/ CREATE TABLE IF NOT EXISTS event_input ( id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT UNIQUE NOT NULL, enable INTEGER NOT NULL, mon TEXT NOT NULL, tue TEXT NOT NULL, wed TEXT NOT NULL, thu TEXT NOT NULL, fri TEXT NOT NULL, sat TEXT NOT NULL, sun TEXT NOT NULL ); INSERT INTO event_input (name, enable, mon, tue, wed, thu, fri, sat, sun) VALUES ('input1', 0, '', '', '', '', '', '', ''); /************************************************ * event_output table * ************************************************/ CREATE TABLE IF NOT EXISTS event_output ( id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT UNIQUE NOT NULL, normal TEXT NOT NULL, period INTEGER NOT NULL ); INSERT INTO event_output (name, normal, period) VALUES ('output1', 'open', 10); /************************************************ * event_motion table * ************************************************/ CREATE TABLE IF NOT EXISTS event_motion ( id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT UNIQUE NOT NULL, enable INTEGER NOT NULL, sensitivity INTEGER NOT NULL, left INTEGER NOT NULL, top INTEGER NOT NULL, width INTEGER NOT NULL, height INTEGER NOT NULL, mon TEXT NOT NULL, tue TEXT NOT NULL, wed TEXT NOT NULL, thu TEXT NOT NULL, fri TEXT NOT NULL, sat TEXT NOT NULL, sun TEXT NOT NULL ); INSERT INTO event_motion (name, enable, sensitivity, left, top, width, height, mon, tue, wed, thu, fri, sat, sun) VALUES ('region1', 0, 50, 0, 0, 67, 90, '', '', '', '', '', '', ''); INSERT INTO event_motion (name, enable, sensitivity, left, top, width, height, mon, tue, wed, thu, fri, sat, sun) VALUES ('region2', 0, 50, 0, 0, 67, 90, '', '', '', '', '', '', ''); /************************************************ * event_cover table * ************************************************/ CREATE TABLE IF NOT EXISTS event_cover ( id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT UNIQUE NOT NULL, enable INTEGER NOT NULL, sensitivity INTEGER NOT NULL, left INTEGER NOT NULL, top INTEGER NOT NULL, width INTEGER NOT NULL, height INTEGER NOT NULL, mon TEXT NOT NULL, tue TEXT NOT NULL, wed TEXT NOT NULL, thu TEXT NOT NULL, fri TEXT NOT NULL, sat TEXT NOT NULL, sun TEXT NOT NULL ); INSERT INTO event_cover (name, enable, sensitivity, left, top, width, height, mon, tue, wed, thu, fri, sat, sun) VALUES ('region1', 1, 60, 0, 0, 1000, 1000, '', '', '', '', '', '', ''); INSERT INTO event_cover (name, enable, sensitivity, left, top, width, height, mon, tue, wed, thu, fri, sat, sun) VALUES ('region2', 0, 50, 0, 0, 67, 90, '', '', '', '', '', '', ''); /************************************************ * event_proc table * ************************************************/ CREATE TABLE IF NOT EXISTS event_proc ( id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT UNIQUE NOT NULL, record INTEGER NOT NULL, sound INTEGER NOT NULL, output1 INTEGER NOT NULL ); INSERT INTO event_proc (name, record, sound, output1) VALUES ('input1', 0, 0, 0); INSERT INTO event_proc (name, record, sound, output1) VALUES ('motion', 0, 0, 0); INSERT INTO event_proc (name, record, sound, output1) VALUES ('cover', 0, 0, 0); /************************************************ * record_schedule table * ************************************************/ CREATE TABLE IF NOT EXISTS record_schedule ( id INTEGER PRIMARY KEY AUTOINCREMENT, mon TEXT NOT NULL, tue TEXT NOT NULL, wed TEXT NOT NULL, thu TEXT NOT NULL, fri TEXT NOT NULL, sat TEXT NOT NULL, sun TEXT NOT NULL ); INSERT INTO record_schedule (mon, tue, wed, thu, fri, sat, sun) VALUES ('', '', '', '', '', '', ''); /************************************************ * record_strategy table * ************************************************/ CREATE TABLE IF NOT EXISTS record_strategy ( id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT UNIQUE NOT NULL, value TEXT, vtype TEXT NOT NULL ); INSERT INTO record_strategy (name, value, vtype) VALUES ('nr_file_switch', 'size', 'STRING'); INSERT INTO record_strategy (name, value, vtype) VALUES ('nr_file_size', '50', 'INTEGER'); INSERT INTO record_strategy (name, value, vtype) VALUES ('nr_file_period', '10', 'INTEGER'); INSERT INTO record_strategy (name, value, vtype) VALUES ('er_file_period', '10', 'INTEGER'); INSERT INTO record_strategy (name, value, vtype) VALUES ('storage_full', 'stop', 'STRING');
USE `mydb`; insert into Rezervacija (datumPocetka, datumZavrsetka, idKlijenta, idTipaSobe) values ('2017/12/01', '2017/12/06', 1309990169955, 2); insert into Rezervacija (datumPocetka, datumZavrsetka, idKlijenta, idTipaSobe) values ('2017/12/09', '2017/12/16', 1309992169955, 3); insert into Rezervacija (datumPocetka, datumZavrsetka, idKlijenta, idTipaSobe) values ('2017/12/11', '2017/12/26', 1309991169955, 1);
SELECT * FROM city_list WHERE country like 'Brazil';
ALTER TABLE SONGS ADD COLUMN ARTIST_IMAGE_ATTRIBUTION text;
insert into inventory(customer, color_code, category, warehouse, in, out, quantity) values('customer 1', 'color code 1', 'category 1', 'warehouse 1', 100, 10, 90); insert into inventory(customer, color_code, category, warehouse, in, out, quantity) values('customer 2', 'color code 2', 'category 2', 'warehouse 2', 100, 0, 100); insert into inventory_log(inventory_id, operation_type, quantity) values (1, 0, 100); insert into inventory_log(inventory_id, operation_type, quantity) values (1, 1, 10); insert into inventory_log(inventory_id, operation_type, quantity) values (1, 0, 100); insert into inventory_log(inventory_id, operation_type, quantity) values (1, 1, 10); insert into inventory_log(inventory_id, operation_type, quantity) values (1, 0, 100); insert into inventory_log(inventory_id, operation_type, quantity) values (1, 1, 10); insert into inventory_log(inventory_id, operation_type, quantity) values (1, 0, 100); insert into inventory_log(inventory_id, operation_type, quantity) values (1, 1, 10); insert into inventory_log(inventory_id, operation_type, quantity) values (1, 0, 100); insert into inventory_log(inventory_id, operation_type, quantity) values (1, 1, 10); insert into inventory_log(inventory_id, operation_type, quantity) values (1, 0, 100); insert into inventory_log(inventory_id, operation_type, quantity) values (1, 1, 10); insert into inventory_log(inventory_id, operation_type, quantity) values (1, 0, 100); insert into inventory_log(inventory_id, operation_type, quantity) values (1, 1, 10); insert into inventory_log(inventory_id, operation_type, quantity) values (1, 0, 100); insert into inventory_log(inventory_id, operation_type, quantity) values (1, 1, 10); insert into inventory_log(inventory_id, operation_type, quantity) values (1, 0, 100); insert into inventory_log(inventory_id, operation_type, quantity) values (1, 1, 10); insert into inventory_log(inventory_id, operation_type, quantity) values (1, 0, 100); insert into inventory_log(inventory_id, operation_type, quantity) values (1, 1, 10); insert into inventory_log(inventory_id, operation_type, quantity) values (2, 0, 100);
use delala; CREATE TABLE post_categories ( id VARCHAR(255) PRIMARY KEY UNIQUE NOT NULL, name VARCHAR(255) UNIQUE NOT NULL );
-- -------------------------------------------------------- -- Host: 127.0.0.1 -- Server version: 10.0.21-MariaDB - mariadb.org binary distribution -- Server OS: Win64 -- HeidiSQL Version: 9.1.0.4867 -- -------------------------------------------------------- /*!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 structure for table peq.loottable CREATE TABLE IF NOT EXISTS `loottable` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(255) NOT NULL DEFAULT '', `mincash` int(11) unsigned NOT NULL DEFAULT '0', `maxcash` int(11) unsigned NOT NULL DEFAULT '0', `avgcoin` int(10) unsigned NOT NULL DEFAULT '0', `done` tinyint(3) NOT NULL DEFAULT '0', `min_expansion` tinyint(4) unsigned NOT NULL DEFAULT '0', `max_expansion` tinyint(4) unsigned NOT NULL DEFAULT '0', `content_flags` varchar(100) DEFAULT NULL, `content_flags_disabled` varchar(100) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=110262 DEFAULT CHARSET=latin1 PACK_KEYS=0; -- Dumping data for table peq.loottable: ~24 rows (approximately) /*!40000 ALTER TABLE `loottable` DISABLE KEYS */; INSERT INTO `loottable` (`id`, `name`, `mincash`, `maxcash`, `avgcoin`, `done`, `min_expansion`, `max_expansion`, `content_flags`, `content_flags_disabled`) VALUES (414, 'Goblin_Janitor', 110, 748, 0, 1, 0, 0, NULL, NULL), (3669, 'An_Evil_Eye_Prisoner', 660, 4378, 0, 1, 0, 0, NULL, NULL), (4287, 'A_Slime_Elemental', 506, 3362, 0, 1, 0, 0, NULL, NULL), (4586, 'A_Goblin_Trainee', 154, 1038, 0, 1, 0, 0, NULL, NULL), (11528, 'a_goblin_worker', 1, 22, 0, 1, 0, 0, NULL, NULL), (14205, 'runnyeye_gobby_no_loot', 286, 1360, 0, 1, 0, 0, NULL, NULL), (97732, '97732_a_goblin_scavenger_MAGELO-GEN', 6, 600, 0, 0, 0, 0, NULL, NULL), (97734, '97734_a_Runnyeye_Conscript_MAGELO-GEN', 5, 500, 0, 0, 0, 0, NULL, NULL), (97738, '97738_a_goblin_runt_MAGELO-GEN', 9, 900, 0, 0, 0, 0, NULL, NULL), (97754, '97754_a_Pickclaw_Slayspell_MAGELO-GEN', 22, 2200, 0, 0, 0, 0, NULL, NULL), (97767, '97767_a_Sporali_worker_MAGELO-GEN', 0, 0, 0, 0, 0, 0, NULL, NULL), (97769, '97769_a_goblin_neophyte_MAGELO-GEN', 11, 1100, 0, 0, 0, 0, NULL, NULL), (97814, '97814_a_Sporali_gatherer_MAGELO-GEN', 0, 0, 0, 0, 0, 0, NULL, NULL), (97900, '97900_a_Runnyeye_Trustee_MAGELO-GEN', 10, 1000, 0, 0, 0, 0, NULL, NULL), (110240, '#A_Goblin_Captain', 84, 280, 0, 0, 0, 0, NULL, NULL), (110241, '#The_Goblin_King', 96, 320, 0, 0, 0, 0, NULL, NULL), (110242, 'a_goblin', 48, 160, 0, 0, 0, 0, NULL, NULL), (110243, 'a_goblin', 42, 140, 0, 0, 0, 0, NULL, NULL), (110244, 'a_goblin', 36, 120, 0, 0, 0, 0, NULL, NULL), (110245, 'A_Goblin_Captain', 66, 220, 0, 0, 0, 0, NULL, NULL), (110246, 'a_goblin_wizard', 48, 160, 0, 0, 0, 0, NULL, NULL), (110247, 'a_goblin_cleric', 42, 140, 0, 0, 0, 0, NULL, NULL), (110248, 'a_goblin_mindripper', 48, 160, 0, 0, 0, 0, NULL, NULL), (110261, 'a_goblin', 84, 280, 0, 0, 0, 0, NULL, NULL); /*!40000 ALTER TABLE `loottable` 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 */;
INSERT IGNORE INTO concept (document, id, name, description) VALUES (1, 'CM_DiscoveryCode', 'Discovery code', 'Discovery (core) coding scheme '); SELECT @scm := dbid FROM concept WHERE id = 'CM_DiscoveryCode'; INSERT IGNORE INTO concept (document, id, scheme, code, name, description) VALUES -- GENERAL/GLOBAL -- (1, 'CM_Org_Barts', @scm, 'CM_Org_Barts', 'Barts Hospital', 'Barts NHS Trust Hospital'), (1, 'CM_Sys_Cerner', @scm, 'CM_Sys_Cerner', 'Cerner Millennium', 'Cerner Millennium system'), (1, 'DM_ambulanceNumber', @scm, 'DM_ambulanceNumber', 'Ambulance number', 'Ambulance number'); -- ******************** EMERGENCY ******************** -- Context maps INSERT INTO map_context_meta (provider, `system`, `schema`, `table`, `column`, node) VALUES ('CM_Org_Barts', 'CM_Sys_Cerner', 'CDS', 'emergency', 'department_type', '/CDS/EMGCY/DPT_TYP'), -- NHS DD ('CM_Org_Barts', 'CM_Sys_Cerner', 'CDS', 'emergency', 'arrival_mode', '/CDS/EMGCY/ARRVL_MD'), -- SNOMED ('CM_Org_Barts', 'CM_Sys_Cerner', 'CDS', 'emergency', 'attendance_category', '/CDS/EMGCY/ATTNDNC_CTGRY'), -- NHS DD ('CM_Org_Barts', 'CM_Sys_Cerner', 'CDS', 'emergency', 'attendance_source', '/CDS/EMGCY/ATTNDNC_SRC'), -- SNOMED ('CM_Org_Barts', 'CM_Sys_Cerner', 'CDS', 'emergency', 'treatment_function_code', '/BRTS/CRNR/CDS/TRTMNT_FNCTN'), -- BARTS/CERNER code ('CM_Org_Barts', 'CM_Sys_Cerner', 'CDS', 'emergency', 'discharge_status', '/CDS/EMGCY/DSCHRG_STTS'), -- SNOMED ('CM_Org_Barts', 'CM_Sys_Cerner', 'CDS', 'emergency', 'discharge_destination', '/CDS/EMGCY/DSCHRG_DSTNTN'), -- SNOMED ('CM_Org_Barts', 'CM_Sys_Cerner', 'CDS', 'emergency', 'discharge_follow_up', '/CDS/EMGCY/DSCHRG_FLLW_UP'), -- SNOMED ('CM_Org_Barts', 'CM_Sys_Cerner', 'CDS', 'emergency', 'referred_to_services', '/CDS/EMGCY/RFRRD_SRVCS'), -- SNOMED -- NEW CONTEXTS 30/05/2022 -- ('CM_Org_Barts', 'CM_Sys_Cerner', 'CDS', 'emergency', 'follow_up', '/CDS/EMGCY/FLLW_UP'), -- SNOMED ('CM_Org_Barts', 'CM_Sys_Cerner', 'CDS', 'emergency', 'ambulance_number', '/BRTS/CRNR/CDS/EMGCY/AMBLNC_NMBR'); -- Property only -- Node maps INSERT INTO map_node_meta (node, concept) VALUES ('/BRTS/CRNR/CDS/EMGCY/AMBLNC_NMBR', 'DM_ambulanceNumber') -- BARTS/CERNER code ; -- ******************** INPATIENT ******************** -- Context maps INSERT INTO map_context_meta (provider, `system`, `schema`, `table`, `column`, node) VALUES ('CM_Org_Barts', 'CM_Sys_Cerner', 'CDS', 'inpatient', 'admission_method_code', '/CDS/INPTNT/ADMSSN_MTHD'), -- NHS DD ('CM_Org_Barts', 'CM_Sys_Cerner', 'CDS', 'inpatient', 'admission_source_code', '/CDS/INPTNT/ADMSSN_SRC'), -- NHS DD ('CM_Org_Barts', 'CM_Sys_Cerner', 'CDS', 'inpatient', 'patient_classification', '/CDS/INPTNT/PTNT_CLSSFCTN'), -- NHS DD ('CM_Org_Barts', 'CM_Sys_Cerner', 'CDS', 'inpatient', 'discharge_destination_code', '/CDS/INPTNT/DSCHRG_DSTNTN'), -- NHS DD ('CM_Org_Barts', 'CM_Sys_Cerner', 'CDS', 'inpatient', 'discharge_method', '/CDS/INPTNT/DSCHRG_MTHD'), -- NHS DD ('CM_Org_Barts', 'CM_Sys_Cerner', 'CDS', 'inpatient', 'administrative_category_code', '/CDS/INPTNT/ADMNSTRV_CTGRY'), -- NHS DD ('CM_Org_Barts', 'CM_Sys_Cerner', 'CDS', 'inpatient', 'treatment_function_code', '/BRTS/CRNR/CDS/TRTMNT_FNCTN'), -- BARTS/CERNER code ('CM_Org_Barts', 'CM_Sys_Cerner', 'CDS', 'inpatient', 'live_or_still_birth_indicator', '/CDS/INPTNT/LV_STLL_BRTH_INDCTR'), -- NHS DD ('CM_Org_Barts', 'CM_Sys_Cerner', 'CDS', 'inpatient', 'delivery_method', '/CDS/INPTNT/DLVRY_MTHD'), -- NHS DD ('CM_Org_Barts', 'CM_Sys_Cerner', 'CDS', 'inpatient', 'gender', '/CDS/INPTNT/GNDR'), -- NHS DD -- NEW CONTEXTS 30/05/2022 -- ('CM_Org_Barts', 'CM_Sys_Cerner', 'CDS', 'inpatient', 'wards', '/CDS/INPTNT/WRDS'), -- NHS DD -- ('CM_Org_Barts', 'CM_Sys_Cerner', 'CDS', 'inpatient', 'maternity_birth' '/CDS/INPTNT/MTRNTY_BRTH'), -- NHS DD -- ('CM_Org_Barts', 'CM_Sys_Cerner', 'CDS', 'inpatient', 'maternity_delivery', '/CDS/INPTNT/MTRNTY_DLVRY'); -- NHS DD -- ******************** OUTPATIENT ******************** -- Context maps INSERT INTO map_context_meta (provider, `system`, `schema`, `table`, `column`, node) VALUES ('CM_Org_Barts', 'CM_Sys_Cerner', 'CDS', 'outpatient', 'appt_attended_code', '/CDS/OUTPTNT/APPT_ATTNDD'), -- NHS DD ('CM_Org_Barts', 'CM_Sys_Cerner', 'CDS', 'outpatient', 'appt_outcome_code', '/CDS/OUTPTNT/OUTCM'), -- NHS DD ('CM_Org_Barts', 'CM_Sys_Cerner', 'CDS', 'outpatient', 'administrative_category_code', '/CDS/OUTPTNT/ADMNSTRTV_CTGRY'), -- NHS DD ('CM_Org_Barts', 'CM_Sys_Cerner', 'CDS', 'outpatient', 'referral_source', '/CDS/OUTPTNT/RFRRL_SRC'), -- NHS DD ('CM_Org_Barts', 'CM_Sys_Cerner', 'CDS', 'outpatient', 'treatment_function_code', '/BRTS/CRNR/CDS/TRTMNT_FNCTN'); -- BARTS/CERNER code -- ******************** CRITICAL CARE ******************** -- Context maps INSERT INTO map_context_meta (provider, `system`, `schema`, `table`, `column`, node) VALUES ('CM_Org_Barts', 'CM_Sys_Cerner', 'CDS', 'critical', 'critical_care_type_id', '/CDS/CRTCL/CRTCL_CR_TYP'), -- NHS DD ('CM_Org_Barts', 'CM_Sys_Cerner', 'CDS', 'critical', 'care_unit_function', '/CDS/CRTCL/CR_UNT_FNCTN'), -- NHS DD ('CM_Org_Barts', 'CM_Sys_Cerner', 'CDS', 'critical', 'admission_source_code', '/CDS/CRTCL/ADMSSN_SRC'), -- NHS DD ('CM_Org_Barts', 'CM_Sys_Cerner', 'CDS', 'critical', 'admission_type_code', '/CDS/CRTCL/ADMSSN_TYP'), -- NHS DD ('CM_Org_Barts', 'CM_Sys_Cerner', 'CDS', 'critical', 'admission_location', '/CDS/CRTCL/ADMSSN_LCTN'), -- NHS DD ('CM_Org_Barts', 'CM_Sys_Cerner', 'CDS', 'critical', 'discharge_status_code', '/CDS/CRTCL/DSCHRG_STTS'), -- NHS DD ('CM_Org_Barts', 'CM_Sys_Cerner', 'CDS', 'critical', 'discharge_destination', '/CDS/CRTCL/DSCHRG_DSTNTN'), -- NHS DD ('CM_Org_Barts', 'CM_Sys_Cerner', 'CDS', 'critical', 'discharge_location', '/CDS/CRTCL/DSCHRG_LCTN'), -- NHS DD -- NEW CONTEXTS 30/05/2022 -- ('CM_Org_Barts', 'CM_Sys_Cerner', 'CDS', 'critical', 'critical_care_type', '/CDS/CRTCL/CRTCL_CR_TYP'), -- NHS DD -- ('CM_Org_Barts', 'CM_Sys_Cerner', 'CDS', 'critical', 'critical_care', '/CDS/CRTCL/CRTCL_CR'); -- NHS DD -- ******************** TREATMENT FUNCTION CODES ******************** -- Node maps INSERT INTO map_node_meta (node, concept) VALUES ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', 'DM_treatmentFunctionAdmit') -- BARTS/CERNER code ; -- Value maps INSERT INTO map_node_value_meta (node, value, scheme, concept) VALUES ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3768934', 'BartsCerner', 'CM_TrtmntFnc100'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3768935', 'BartsCerner', 'CM_TrtmntFnc101'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '6521783', 'BartsCerner', 'CM_TrtmntFnc101'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '117710513', 'BartsCerner', 'CM_TrtmntFnc101'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3768973', 'BartsCerner', 'CM_TrtmntFnc102'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '6521701', 'BartsCerner', 'CM_TrtmntFnc102'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '6521786', 'BartsCerner', 'CM_TrtmntFnc102'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3768923', 'BartsCerner', 'CM_TrtmntFnc103'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3768970', 'BartsCerner', 'CM_TrtmntFnc104'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3768979', 'BartsCerner', 'CM_TrtmntFnc105'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '6521714', 'BartsCerner', 'CM_TrtmntFnc105'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3768965', 'BartsCerner', 'CM_TrtmntFnc106'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3768974', 'BartsCerner', 'CM_TrtmntFnc107'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '163299897', 'BartsCerner', 'CM_TrtmntFnc108'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3768936', 'BartsCerner', 'CM_TrtmntFnc110'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '117708316', 'BartsCerner', 'CM_TrtmntFnc110'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '117709260', 'BartsCerner', 'CM_TrtmntFnc110'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '117709832', 'BartsCerner', 'CM_TrtmntFnc110'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3768933', 'BartsCerner', 'CM_TrtmntFnc120'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '6521760', 'BartsCerner', 'CM_TrtmntFnc120'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '313020', 'BartsCerner', 'CM_TrtmntFnc130'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '6174973', 'BartsCerner', 'CM_TrtmntFnc130'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '6175005', 'BartsCerner', 'CM_TrtmntFnc130'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '6521726', 'BartsCerner', 'CM_TrtmntFnc130'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3768937', 'BartsCerner', 'CM_TrtmntFnc140'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3768938', 'BartsCerner', 'CM_TrtmntFnc141'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3768939', 'BartsCerner', 'CM_TrtmntFnc142'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3768940', 'BartsCerner', 'CM_TrtmntFnc143'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3768929', 'BartsCerner', 'CM_TrtmntFnc144'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3768941', 'BartsCerner', 'CM_TrtmntFnc150'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3768942', 'BartsCerner', 'CM_TrtmntFnc160'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3768967', 'BartsCerner', 'CM_TrtmntFnc161'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '313003', 'BartsCerner', 'CM_TrtmntFnc170'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3768944', 'BartsCerner', 'CM_TrtmntFnc171'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '6175001', 'BartsCerner', 'CM_TrtmntFnc171'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3768968', 'BartsCerner', 'CM_TrtmntFnc172'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3768972', 'BartsCerner', 'CM_TrtmntFnc173'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3768969', 'BartsCerner', 'CM_TrtmntFnc174'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3768930', 'BartsCerner', 'CM_TrtmntFnc180'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '4467020', 'BartsCerner', 'CM_TrtmntFnc190'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '6521741', 'BartsCerner', 'CM_TrtmntFnc190'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3768945', 'BartsCerner', 'CM_TrtmntFnc191'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3768928', 'BartsCerner', 'CM_TrtmntFnc192'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '4467021', 'BartsCerner', 'CM_TrtmntFnc211'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '117707696', 'BartsCerner', 'CM_TrtmntFnc211'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '4467022', 'BartsCerner', 'CM_TrtmntFnc212'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '4467023', 'BartsCerner', 'CM_TrtmntFnc213'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '4467024', 'BartsCerner', 'CM_TrtmntFnc214'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '4467025', 'BartsCerner', 'CM_TrtmntFnc215'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '4467026', 'BartsCerner', 'CM_TrtmntFnc216'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '4467027', 'BartsCerner', 'CM_TrtmntFnc217'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3928166', 'BartsCerner', 'CM_TrtmntFnc218'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3928169', 'BartsCerner', 'CM_TrtmntFnc219'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3928144', 'BartsCerner', 'CM_TrtmntFnc220'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3928165', 'BartsCerner', 'CM_TrtmntFnc221'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3928164', 'BartsCerner', 'CM_TrtmntFnc222'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '163299957', 'BartsCerner', 'CM_TrtmntFnc223'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3928170', 'BartsCerner', 'CM_TrtmntFnc241'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3928147', 'BartsCerner', 'CM_TrtmntFnc242'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3928174', 'BartsCerner', 'CM_TrtmntFnc251'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3928180', 'BartsCerner', 'CM_TrtmntFnc252'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3928146', 'BartsCerner', 'CM_TrtmntFnc253'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3928176', 'BartsCerner', 'CM_TrtmntFnc254'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3928148', 'BartsCerner', 'CM_TrtmntFnc255'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3928177', 'BartsCerner', 'CM_TrtmntFnc256'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3928161', 'BartsCerner', 'CM_TrtmntFnc257'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3928149', 'BartsCerner', 'CM_TrtmntFnc258'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3928156', 'BartsCerner', 'CM_TrtmntFnc259'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '6521698', 'BartsCerner', 'CM_TrtmntFnc259'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3928153', 'BartsCerner', 'CM_TrtmntFnc260'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3928155', 'BartsCerner', 'CM_TrtmntFnc261'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3928160', 'BartsCerner', 'CM_TrtmntFnc262'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '71843418', 'BartsCerner', 'CM_TrtmntFnc263'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '6174997', 'BartsCerner', 'CM_TrtmntFnc264'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3928159', 'BartsCerner', 'CM_TrtmntFnc280'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3840186', 'BartsCerner', 'CM_TrtmntFnc290'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3928152', 'BartsCerner', 'CM_TrtmntFnc291'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3768946', 'BartsCerner', 'CM_TrtmntFnc300'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '6521691', 'BartsCerner', 'CM_TrtmntFnc300'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3768943', 'BartsCerner', 'CM_TrtmntFnc301'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '117704757', 'BartsCerner', 'CM_TrtmntFnc301'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '326409423', 'BartsCerner', 'CM_TrtmntFnc301'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3768947', 'BartsCerner', 'CM_TrtmntFnc302'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3768922', 'BartsCerner', 'CM_TrtmntFnc303'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '6174980', 'BartsCerner', 'CM_TrtmntFnc303'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '6521692', 'BartsCerner', 'CM_TrtmntFnc303'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '6521728', 'BartsCerner', 'CM_TrtmntFnc303'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '23718840', 'BartsCerner', 'CM_TrtmntFnc303'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '6182528', 'BartsCerner', 'CM_TrtmntFnc304'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3768949', 'BartsCerner', 'CM_TrtmntFnc305'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3928158', 'BartsCerner', 'CM_TrtmntFnc306'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '6521737', 'BartsCerner', 'CM_TrtmntFnc306'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3768924', 'BartsCerner', 'CM_TrtmntFnc307'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '6175000', 'BartsCerner', 'CM_TrtmntFnc307'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '35472688', 'BartsCerner', 'CM_TrtmntFnc307'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3768966', 'BartsCerner', 'CM_TrtmntFnc308'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3768978', 'BartsCerner', 'CM_TrtmntFnc309'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3768950', 'BartsCerner', 'CM_TrtmntFnc310'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3768951', 'BartsCerner', 'CM_TrtmntFnc311'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3768952', 'BartsCerner', 'CM_TrtmntFnc313'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '313027', 'BartsCerner', 'CM_TrtmntFnc314'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3768953', 'BartsCerner', 'CM_TrtmntFnc315'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3768976', 'BartsCerner', 'CM_TrtmntFnc316'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3768981', 'BartsCerner', 'CM_TrtmntFnc317'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3768963', 'BartsCerner', 'CM_TrtmntFnc318'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '66871717', 'BartsCerner', 'CM_TrtmntFnc318'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3768980', 'BartsCerner', 'CM_TrtmntFnc319'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3768910', 'BartsCerner', 'CM_TrtmntFnc320'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '117702682', 'BartsCerner', 'CM_TrtmntFnc320'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '215885962', 'BartsCerner', 'CM_TrtmntFnc320'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '215886742', 'BartsCerner', 'CM_TrtmntFnc320'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '215887515', 'BartsCerner', 'CM_TrtmntFnc320'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '215888652', 'BartsCerner', 'CM_TrtmntFnc320'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3768927', 'BartsCerner', 'CM_TrtmntFnc321'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3768962', 'BartsCerner', 'CM_TrtmntFnc322'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3928179', 'BartsCerner', 'CM_TrtmntFnc323'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3768948', 'BartsCerner', 'CM_TrtmntFnc324'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '71843422', 'BartsCerner', 'CM_TrtmntFnc325'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '6521752', 'BartsCerner', 'CM_TrtmntFnc327'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '71843258', 'BartsCerner', 'CM_TrtmntFnc328'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '71843259', 'BartsCerner', 'CM_TrtmntFnc329'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3768954', 'BartsCerner', 'CM_TrtmntFnc330'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '117704147', 'BartsCerner', 'CM_TrtmntFnc330'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '163300530', 'BartsCerner', 'CM_TrtmntFnc331'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3768955', 'BartsCerner', 'CM_TrtmntFnc340'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '6175006', 'BartsCerner', 'CM_TrtmntFnc340'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '6233025', 'BartsCerner', 'CM_TrtmntFnc340'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3768971', 'BartsCerner', 'CM_TrtmntFnc341'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '71843420', 'BartsCerner', 'CM_TrtmntFnc342'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '71843247', 'BartsCerner', 'CM_TrtmntFnc343'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '163300661', 'BartsCerner', 'CM_TrtmntFnc344'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '163300859', 'BartsCerner', 'CM_TrtmntFnc345'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '163302228', 'BartsCerner', 'CM_TrtmntFnc346'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3768956', 'BartsCerner', 'CM_TrtmntFnc350'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '6174971', 'BartsCerner', 'CM_TrtmntFnc350'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3768977', 'BartsCerner', 'CM_TrtmntFnc352'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3768957', 'BartsCerner', 'CM_TrtmntFnc360'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3768958', 'BartsCerner', 'CM_TrtmntFnc361'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '6174998', 'BartsCerner', 'CM_TrtmntFnc361'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '6174999', 'BartsCerner', 'CM_TrtmntFnc361'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '6175011', 'BartsCerner', 'CM_TrtmntFnc361'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '6232618', 'BartsCerner', 'CM_TrtmntFnc361'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '183705329', 'BartsCerner', 'CM_TrtmntFnc361'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3768959', 'BartsCerner', 'CM_TrtmntFnc370'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '6175007', 'BartsCerner', 'CM_TrtmntFnc370'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '6183642', 'BartsCerner', 'CM_TrtmntFnc371'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '313019', 'BartsCerner', 'CM_TrtmntFnc400'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '6175010', 'BartsCerner', 'CM_TrtmntFnc400'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '6181751', 'BartsCerner', 'CM_TrtmntFnc401'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3768911', 'BartsCerner', 'CM_TrtmntFnc410'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '6521759', 'BartsCerner', 'CM_TrtmntFnc410'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3768932', 'BartsCerner', 'CM_TrtmntFnc420'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3768912', 'BartsCerner', 'CM_TrtmntFnc421'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3768931', 'BartsCerner', 'CM_TrtmntFnc422'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '6175004', 'BartsCerner', 'CM_TrtmntFnc422'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '6175008', 'BartsCerner', 'CM_TrtmntFnc422'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '6175009', 'BartsCerner', 'CM_TrtmntFnc422'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '179427781', 'BartsCerner', 'CM_TrtmntFnc422'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3768925', 'BartsCerner', 'CM_TrtmntFnc424'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3928157', 'BartsCerner', 'CM_TrtmntFnc430'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '6174978', 'BartsCerner', 'CM_TrtmntFnc430'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3768913', 'BartsCerner', 'CM_TrtmntFnc450'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '117702019', 'BartsCerner', 'CM_TrtmntFnc450'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3768914', 'BartsCerner', 'CM_TrtmntFnc460'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3768961', 'BartsCerner', 'CM_TrtmntFnc501'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3916375', 'BartsCerner', 'CM_TrtmntFnc501'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3928183', 'BartsCerner', 'CM_TrtmntFnc501'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3768915', 'BartsCerner', 'CM_TrtmntFnc502'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '6175003', 'BartsCerner', 'CM_TrtmntFnc502'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '6521693', 'BartsCerner', 'CM_TrtmntFnc502'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '6521694', 'BartsCerner', 'CM_TrtmntFnc502'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '6521734', 'BartsCerner', 'CM_TrtmntFnc502'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '6521761', 'BartsCerner', 'CM_TrtmntFnc502'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '6521784', 'BartsCerner', 'CM_TrtmntFnc502'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '117703272', 'BartsCerner', 'CM_TrtmntFnc502'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3768926', 'BartsCerner', 'CM_TrtmntFnc503'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '6521690', 'BartsCerner', 'CM_TrtmntFnc503'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3768916', 'BartsCerner', 'CM_TrtmntFnc560'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '313022', 'BartsCerner', 'CM_TrtmntFnc650'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '117706364', 'BartsCerner', 'CM_TrtmntFnc650'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '117706911', 'BartsCerner', 'CM_TrtmntFnc650'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '333406451', 'BartsCerner', 'CM_TrtmntFnc650'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3928168', 'BartsCerner', 'CM_TrtmntFnc651'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '333406704', 'BartsCerner', 'CM_TrtmntFnc651'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3928178', 'BartsCerner', 'CM_TrtmntFnc652'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '333407095', 'BartsCerner', 'CM_TrtmntFnc652'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3928175', 'BartsCerner', 'CM_TrtmntFnc653'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3928151', 'BartsCerner', 'CM_TrtmntFnc654'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '333406866', 'BartsCerner', 'CM_TrtmntFnc654'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '403948617', 'BartsCerner', 'CM_TrtmntFnc654'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3928171', 'BartsCerner', 'CM_TrtmntFnc655'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '313000', 'BartsCerner', 'CM_TrtmntFnc656'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '313023', 'BartsCerner', 'CM_TrtmntFnc657'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3928172', 'BartsCerner', 'CM_TrtmntFnc658'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '71843507', 'BartsCerner', 'CM_TrtmntFnc659'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '71843249', 'BartsCerner', 'CM_TrtmntFnc660'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '71843257', 'BartsCerner', 'CM_TrtmntFnc661'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '71843414', 'BartsCerner', 'CM_TrtmntFnc662'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '163306560', 'BartsCerner', 'CM_TrtmntFnc663'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3768960', 'BartsCerner', 'CM_TrtmntFnc700'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3768975', 'BartsCerner', 'CM_TrtmntFnc710'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3768917', 'BartsCerner', 'CM_TrtmntFnc711'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3768918', 'BartsCerner', 'CM_TrtmntFnc712'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3768919', 'BartsCerner', 'CM_TrtmntFnc713'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3768920', 'BartsCerner', 'CM_TrtmntFnc715'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '313001', 'BartsCerner', 'CM_TrtmntFnc720'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '313002', 'BartsCerner', 'CM_TrtmntFnc721'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '313007', 'BartsCerner', 'CM_TrtmntFnc722'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '313005', 'BartsCerner', 'CM_TrtmntFnc723'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '313008', 'BartsCerner', 'CM_TrtmntFnc724'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '163306756', 'BartsCerner', 'CM_TrtmntFnc725'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '163306927', 'BartsCerner', 'CM_TrtmntFnc726'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '163307027', 'BartsCerner', 'CM_TrtmntFnc727'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3768921', 'BartsCerner', 'CM_TrtmntFnc800'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '6174976', 'BartsCerner', 'CM_TrtmntFnc800'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '6174982', 'BartsCerner', 'CM_TrtmntFnc800'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '6174995', 'BartsCerner', 'CM_TrtmntFnc800'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '6175002', 'BartsCerner', 'CM_TrtmntFnc800'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3768964', 'BartsCerner', 'CM_TrtmntFnc811'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '6179756', 'BartsCerner', 'CM_TrtmntFnc812'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '3928145', 'BartsCerner', 'CM_TrtmntFnc822'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '71843251', 'BartsCerner', 'CM_TrtmntFnc834'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '6183485', 'BartsCerner', 'CM_TrtmntFnc840'), ('/BRTS/CRNR/CDS/TRTMNT_FNCTN', '163307287', 'BartsCerner', 'CM_TrtmntFnc920');
CREATE OR REPLACE TABLE {{.scratch_schema}}.channel_engagement_staged{{.entropy}} AS( SELECT -- get some basic info pv.page_view_id, pv.start_tstamp, pv.page_url, -- Add in our custom link click metrics lc.link_clicks, lc.first_link_clicked, lc.last_link_clicked, -- channel definition CASE WHEN pv.refr_medium = 'search' AND (REGEXP_CONTAINS(lower(pv.mkt_medium), '%(cpc|ppc|sem|paidsearch)%') OR REGEXP_CONTAINS(lower(pv.mkt_source), '%(cpc|ppc|sem|paidsearch)%')) THEN 'paidsearch' WHEN lower(pv.mkt_medium) LIKE '%paidsearch%' OR lower(pv.mkt_source) LIKE '%paidsearch%' THEN 'paidsearch' WHEN REGEXP_CONTAINS(lower(pv.mkt_source), '%(adwords|google_paid|googleads)%') OR REGEXP_CONTAINS(lower(pv.mkt_medium), '%(adwords|google_paid|googleads)%') THEN 'paidsearch' WHEN lower(pv.mkt_source) LIKE '%google%' AND lower(pv.mkt_medium) LIKE '%ads%' THEN 'paidsearch' WHEN pv.refr_urlhost in ('www.googleadservices.com','googleads.g.doubleclick.net') then 'paidsearch' WHEN REGEXP_CONTAINS(lower(pv.mkt_medium), '%(cpv|cpa|cpp|content-text|advertising|ads)%') THEN 'advertising' WHEN REGEXP_CONTAINS(lower(pv.mkt_medium), '%(display|cpm|banner)%') THEN 'display' WHEN pv.refr_medium IS NULL AND pv.page_url NOT LIKE '%utm_%' THEN 'direct' WHEN (LOWER(pv.refr_medium) = 'search' AND pv.mkt_medium IS NULL) OR (LOWER(pv.refr_medium) = 'search' AND LOWER(pv.mkt_medium) = 'organic') THEN 'organicsearch' WHEN pv.refr_medium = 'social' OR REGEXP_CONTAINS(LOWER(pv.mkt_source),'^((.*(facebook|linkedin|instagram|insta|slideshare|social|tweet|twitter|youtube|lnkd|pinterest|googleplus|instagram|plus.google.com|quora|reddit|t.co|twitch|viadeo|xing|youtube).*)|(yt|fb|li))$') OR REGEXP_CONTAINS(LOWER(pv.mkt_medium),'^(.*)(social|facebook|linkedin|twitter|instagram|tweet)(.*)$') THEN 'social' WHEN pv.refr_medium = 'email' OR lower(pv.mkt_medium) LIKE '_mail' THEN 'email' WHEN lower(pv.mkt_medium) LIKE 'affiliate' THEN 'affiliate' WHEN pv.refr_medium = 'unknown' or lower(pv.mkt_medium) LIKE 'referral' OR lower(pv.mkt_medium) LIKE 'referal' THEN 'referral' WHEN pv.refr_medium = 'internal' then 'internal' ELSE 'others' END AS channel, -- some metrics to measure engagement CASE WHEN pv.engaged_time_in_s = 0 THEN TRUE ELSE FALSE END AS bounced_page_view, (pv.vertical_percentage_scrolled / 100) * 0.3 + (pv.engaged_time_in_s / 600) * 0.7 AS engagement_score FROM -- Query from staged table to get most recent according to incremental logic {{.scratch_schema}}.page_views_staged{{.entropy}} pv LEFT JOIN -- Join on the joinkey {{.scratch_schema}}.link_clicks{{.entropy}} lc ON pv.page_view_id = lc.page_view_id )
CREATE TABLE endpoints ( id INT NOT NULL AUTO_INCREMENT, name VARCHAR(100) NOT NULL, url TEXT NOT NULL, `interval` INT NOT NULL, userId INT NOT NULL, lastCheckedAt DATETIME NULL, nextRunAt DATETIME NULL, createdAt DATETIME NOT NULL, PRIMARY KEY (id), INDEX index_user_id (userId) ) DEFAULT CHARSET=utf8
-- phpMyAdmin SQL Dump -- version 4.6.6deb5 -- https://www.phpmyadmin.net/ -- -- Host: localhost:3306 -- Generation Time: 2019-01-05 12:38:12 -- 服务器版本: 5.7.21-1 -- PHP Version: 7.1.16-1+b1 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: `gp` -- -- -------------------------------------------------------- -- -- 表的结构 `data_answer` -- CREATE TABLE `data_answer` ( `id` int(11) NOT NULL, `sid` int(11) NOT NULL, `answer` varchar(255) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -------------------------------------------------------- -- -- 表的结构 `data_question` -- CREATE TABLE `data_question` ( `id` int(11) NOT NULL, `aid` int(255) NOT NULL, `question` varchar(255) CHARACTER SET utf8 NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- 表的结构 `subject` -- CREATE TABLE `subject` ( `id` int(11) NOT NULL, `name` varchar(20) CHARACTER SET utf8 NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- 转存表中的数据 `subject` -- INSERT INTO `subject` (`id`, `name`) VALUES (1, '电路'); -- -------------------------------------------------------- -- -- 表的结构 `submission` -- CREATE TABLE `submission` ( `id` int(11) NOT NULL, `sid` int(11) NOT NULL, `question` varchar(255) CHARACTER SET utf8 NOT NULL, `aid` int(11) DEFAULT NULL, `submitter` varchar(50) CHARACTER SET utf8 DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- 表的结构 `user` -- CREATE TABLE `user` ( `id` int(11) NOT NULL, `account` varchar(50) CHARACTER SET utf8 NOT NULL, `secret` varchar(50) CHARACTER SET utf8 NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- 转存表中的数据 `user` -- INSERT INTO `user` (`id`, `account`, `secret`) VALUES (1, 'admin', 'e10adc3949ba59abbe56e057f20f883e'); -- -------------------------------------------------------- -- -- 表的结构 `user_subject` -- CREATE TABLE `user_subject` ( `id` int(11) NOT NULL, `uid` int(11) NOT NULL, `sid` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- 转存表中的数据 `user_subject` -- INSERT INTO `user_subject` (`id`, `uid`, `sid`) VALUES (1, 1, 1); -- -- Indexes for dumped tables -- -- -- Indexes for table `data_answer` -- ALTER TABLE `data_answer` ADD PRIMARY KEY (`id`), ADD KEY `subject_answer` (`sid`); -- -- Indexes for table `data_question` -- ALTER TABLE `data_question` ADD PRIMARY KEY (`id`), ADD KEY `answer_question` (`aid`); -- -- Indexes for table `subject` -- ALTER TABLE `subject` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `name` (`name`); -- -- Indexes for table `submission` -- ALTER TABLE `submission` ADD PRIMARY KEY (`id`), ADD KEY `subject_submission` (`sid`) USING BTREE, ADD KEY `answer_submission` (`aid`) USING BTREE; -- -- Indexes for table `user` -- ALTER TABLE `user` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `account` (`account`); -- -- Indexes for table `user_subject` -- ALTER TABLE `user_subject` ADD PRIMARY KEY (`id`), ADD KEY `user_subject_uid` (`uid`), ADD KEY `user_subject_sid` (`sid`); -- -- 在导出的表使用AUTO_INCREMENT -- -- -- 使用表AUTO_INCREMENT `data_answer` -- ALTER TABLE `data_answer` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; -- -- 使用表AUTO_INCREMENT `data_question` -- ALTER TABLE `data_question` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; -- -- 使用表AUTO_INCREMENT `subject` -- ALTER TABLE `subject` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; -- -- 使用表AUTO_INCREMENT `submission` -- ALTER TABLE `submission` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; -- -- 使用表AUTO_INCREMENT `user` -- ALTER TABLE `user` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; -- -- 使用表AUTO_INCREMENT `user_subject` -- ALTER TABLE `user_subject` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; -- -- 限制导出的表 -- -- -- 限制表 `data_answer` -- ALTER TABLE `data_answer` ADD CONSTRAINT `subject_answer` FOREIGN KEY (`sid`) REFERENCES `subject` (`id`); -- -- 限制表 `data_question` -- ALTER TABLE `data_question` ADD CONSTRAINT `answer_question` FOREIGN KEY (`aid`) REFERENCES `data_answer` (`id`); -- -- 限制表 `submission` -- ALTER TABLE `submission` ADD CONSTRAINT `answer id` FOREIGN KEY (`aid`) REFERENCES `data_answer` (`id`), ADD CONSTRAINT `subject id` FOREIGN KEY (`sid`) REFERENCES `subject` (`id`); -- -- 限制表 `user_subject` -- ALTER TABLE `user_subject` ADD CONSTRAINT `user_subject_sid` FOREIGN KEY (`sid`) REFERENCES `subject` (`id`), ADD CONSTRAINT `user_subject_uid` FOREIGN KEY (`uid`) REFERENCES `user` (`id`); /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
' PB_BitmapGraphics.inc ' FUNCTION funGetBitmapSize(strBitmapFile AS STRING, _ lngWidth AS LONG, _ lngHeight AS LONG) AS LONG ' get the size of a bitmap from the file LOCAL lngFile AS LONG ' TRY lngFile = FREEFILE OPEN strBitmapFile FOR BINARY AS lngFile GET #lngFile, 19, lngWidth GET #lngFile, 23, lngHeight FUNCTION = %TRUE ' CATCH FUNCTION = %FALSE FINALLY CLOSE lngFile END TRY ' END FUNCTION ' FUNCTION funPasteBitmap(strBitmap AS STRING, _ strBitmapMask AS STRING, _ lngWidth AS LONG, _ lngHeight AS LONG, _ lngXstart AS LONG, _ lngYstart AS LONG, _ lngGraphic AS LONG) AS LONG ' paste a bitmap and its mask to a graphics control LOCAL hBmp AS DWORD LOCAL hBmpMask AS DWORD ' GRAPHIC BITMAP LOAD strBitmapMask, lngWidth, lngHeight TO hBmpMask GRAPHIC BITMAP LOAD strBitmap, lngWidth, lngHeight TO hBmp ' GRAPHIC COPY hBmpMask, lngGraphic TO _ (lngXstart, lngYstart), %MIX_MASKSRC GRAPHIC COPY hBmp, lngGraphic TO _ (lngXstart, lngYstart), %MIX_MERGESRC END FUNCTION