text stringlengths 6 9.38M |
|---|
-- Account
CREATE TABLE account (
acc_id varchar(255) NOT NULL PRIMARY KEY,
acc_password varchar(255),
acc_first_name varchar(255),
acc_last_name varchar(255),
acc_email varchar(255)
);
CREATE INDEX account_acc_id ON account(acc_id);
-- Products
CREATE TABLE products (
id INTEGER NOT NULL PRIMARY KEY,
description varchar(255),
price decimal(15,2)
);
CREATE INDEX products_description ON products(description); |
/*
** Question: https://leetcode.com/problems/reformat-department-table/
*/
-- method 1, Oracle
SELECT
d.id,
SUM(CASE WHEN d.month = 'Jan' THEN d.revenue ELSE NULL END) AS Jan_Revenue,
SUM(CASE WHEN d.month = 'Feb' THEN d.revenue ELSE NULL END) AS Feb_Revenue,
SUM(CASE WHEN d.month = 'Mar' THEN d.revenue ELSE NULL END) AS Mar_Revenue,
SUM(CASE WHEN d.month = 'Apr' THEN d.revenue ELSE NULL END) AS Apr_Revenue,
SUM(CASE WHEN d.month = 'May' THEN d.revenue ELSE NULL END) AS May_Revenue,
SUM(CASE WHEN d.month = 'Jun' THEN d.revenue ELSE NULL END) AS Jun_Revenue,
SUM(CASE WHEN d.month = 'Jul' THEN d.revenue ELSE NULL END) AS Jul_Revenue,
SUM(CASE WHEN d.month = 'Aug' THEN d.revenue ELSE NULL END) AS Aug_Revenue,
SUM(CASE WHEN d.month = 'Sep' THEN d.revenue ELSE NULL END) AS Sep_Revenue,
SUM(CASE WHEN d.month = 'Oct' THEN d.revenue ELSE NULL END) AS Oct_Revenue,
SUM(CASE WHEN d.month = 'Nov' THEN d.revenue ELSE NULL END) AS Nov_Revenue,
SUM(CASE WHEN d.month = 'Dec' THEN d.revenue ELSE NULL END) AS Dec_Revenue
FROM Department d
GROUP BY d.id
ORDER BY d.id;
-- method 2, using left joins
-- refer to this thread: https://leetcode.com/problems/reformat-department-table/discuss/382960/MSSQL-Multiple-joins-GroupBy-and-Pivot-table-solutions
|
-- Aggregate functions
select count(first_name) from books;
select count(title) from books;
select count(*) from books;
select count(distinct last_name) from books;
select count(distinct first_name, last_name) from books;
select count(*) from books where title like '%the%';
select * from books group by title;
select title, author_lastname from books order by author_lastname;
|
INSERT INTO LOC_LAU_T (LAU_ID, COUNTRY_CODE, NUTS3, LAU1, LAU2, _CHANGE, NAME1, NAME2, AREA, POP)
VALUES (1, 'ES', 'ES511', 'no', '08019', 'no', 'Barcelona', 'Barcelona', 98211086, 0);
INSERT INTO LOC_LAU_T (LAU_ID, COUNTRY_CODE, NUTS3, LAU1, LAU2, _CHANGE, NAME1, NAME2, AREA, POP)
VALUES (2, 'ES', 'ES511', 'no', '08205', 'no', 'Sant Cugat del Vallès', 'Sant Cugat del Vallès', 48269751, 0); |
PRO
PRO CPU LATENCY between &&cs_begin_date_from. and &&cs_end_date_to. (on average)
PRO ~~~~~~~~~~~
SET TERM OFF;
DEF cs_order_by = 's.cpu_ms_pe DESC NULLS LAST';
GET cs_internal/&&cs_script_name._internal.sql NOLIST
.
666666 SELECT s.sql_id,
666666 s.plan_hash_value,
666666 s.has_baseline,
666666 s.has_profile,
666666 s.has_patch,
666666 '|' AS sp1,
666666 s.cpu_ms_pe,
666666 s.db_ms_pe,
666666 s.io_ms_pe,
666666 s.ap_ms_pe,
666666 s.cc_ms_pe,
666666 '|' AS sp2,
666666 s.cpu_aas,
666666 s.db_aas,
666666 '|' AS sp3,
666666 s.rows_processed_pe,
666666 s.buffer_gets_pe,
666666 '|' AS sp4,
666666 s.cpu_ms_prp,
666666 s.db_ms_prp,
666666 s.buffer_gets_prp,
666666 '|' AS sp5,
666666 s.executions_ps,
666666 '|' AS sp9,
666666 s.sql_type,
666666 s.sql_text,
666666 &&skip_module. s.module,
666666 &&skip_parsing_schema_name. s.parsing_schema_name,
666666 s.pdb_name
666666 FROM sqlstat3 s;
SET TERM ON;
/ |
/* UPGRADE FROM 2.5 */
/* pt_issues */
ALTER TABLE `pt_issues` ADD `googlecalID` varchar(500) default NULL;
/* pt_milestones */
ALTER TABLE `pt_milestones` ADD `googlecalID` varchar(500) default NULL;
/* pt_projects */
ALTER TABLE `pt_projects` ADD `googlecal` varchar(200) default NULL;
/* pt_settings */
INSERT INTO `pt_settings` values ('3CB6A28B-78E7-D183-3355FDC2AD339924','googlecal_enable','0');
INSERT INTO `pt_settings` values ('3CB6A28C-78E7-D183-33556DE390587F08','googlecal_user','');
INSERT INTO `pt_settings` values ('3CB6A28D-78E7-D183-335507D438CAEB30','googlecal_pass','');
INSERT INTO `pt_settings` values ('424E6B2F-78E7-D183-3355A1D332D34969','googlecal_timezone','US/Eastern');
INSERT INTO `pt_settings` values ('3CB6A28E-78E7-D183-33550BDFD7405ECF','googlecal_offset','-5');
/* pt_todos */
ALTER TABLE `pt_todos` ADD `googlecalID` varchar(500) default NULL;
/* pt_user_notify - add new columns for notification */
ALTER TABLE `pt_user_notify` ADD `email_todo_del` tinyint(1) default NULL;
ALTER TABLE `pt_user_notify` ADD `mobile_todo_del` tinyint(1) default NULL;
ALTER TABLE `pt_user_notify` ADD `email_todo_cmp` tinyint(1) default NULL;
ALTER TABLE `pt_user_notify` ADD `mobile_todo_cmp` tinyint(1) default NULL;
UPDATE `pt_user_notify` set `email_todo_del` = 0;
UPDATE `pt_user_notify` set `mobile_todo_del` = 0;
UPDATE `pt_user_notify` set `email_todo_cmp` = 0;
UPDATE `pt_user_notify` set `mobile_todo_cmp` = 0;
|
-- phpMyAdmin SQL Dump
-- version 4.9.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Waktu pembuatan: 26 Jan 2021 pada 10.26
-- 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: `suratbpprd`
--
-- --------------------------------------------------------
--
-- Struktur dari tabel `balas_surat`
--
CREATE TABLE `balas_surat` (
`id_balas` int(11) NOT NULL,
`id` int(11) NOT NULL,
`id_surat` int(11) NOT NULL,
`balas_surat` varchar(225) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data untuk tabel `balas_surat`
--
INSERT INTO `balas_surat` (`id_balas`, `id`, `id_surat`, `balas_surat`) VALUES
(1, 0, 0, 'Oke lanjutkan');
-- --------------------------------------------------------
--
-- Struktur dari tabel `user`
--
CREATE TABLE `user` (
`id` int(11) NOT NULL,
`name` varchar(128) NOT NULL,
`email` varchar(128) NOT NULL,
`image` varchar(128) NOT NULL,
`password` varchar(128) NOT NULL,
`role_id` int(11) NOT NULL,
`is_active` int(1) NOT NULL,
`date_create` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data untuk tabel `user`
--
INSERT INTO `user` (`id`, `name`, `email`, `image`, `password`, `role_id`, `is_active`, `date_create`) VALUES
(1, 'Afdhan Muhammad Risyaf', 'afdhanmrisyaf@yahoo.com', '20191215_070935.jpg', '$2y$10$xq8x/F5GdRuMa0x.iZT0MeTy6ltv.dHsVqGweY/kbQKM8tsWOawaG', 1, 1, 1604339252),
(3, 'Rafif Pandya', 'afdhanrisyaf@yahoo.co.id', '20191222_124413.jpg', '$2y$10$07Gp9QKzMbrTplYxDPnXGeITgDXDrkoNPFoOETN5W/V8JMooTs6I6', 2, 1, 1604339982),
(17, 'Afdhan Muhammad Risyaf', 'afdhanmr@gmail.com', 'default.jpg', '$2y$10$YlQh6tsc.2ejJoHS77z0yOFp7l0uRaJBgE1Dzgi04qMY1MCga4y6q', 2, 1, 1604481932),
(19, 'Admin Super', 'admin@gmail.com', 'default.jpg', '$2y$10$TmlyeNS.VOmCiqSpRWdjX.5egmzvULngqvbfWSaFgFmDpbVVoJg9O', 1, 1, 1611107632),
(20, 'BPPRD', 'Bpprderwan@gmail.com', 'default.jpg', '$2y$10$Wr0vJZvWAjDO7KJXxnWg8Ox7SGDkH6aDMdg/892EOTeIL7Pof9vB.', 3, 1, 1611109067);
-- --------------------------------------------------------
--
-- Struktur dari tabel `user_access_menu`
--
CREATE TABLE `user_access_menu` (
`id` int(11) NOT NULL,
`role_id` int(11) NOT NULL,
`menu_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data untuk tabel `user_access_menu`
--
INSERT INTO `user_access_menu` (`id`, `role_id`, `menu_id`) VALUES
(1, 1, 1),
(6, 1, 3),
(10, 2, 5),
(11, 2, 2),
(17, 3, 6),
(18, 3, 7);
-- --------------------------------------------------------
--
-- Struktur dari tabel `user_data_surat`
--
CREATE TABLE `user_data_surat` (
`id_surat` int(11) NOT NULL,
`id` int(11) NOT NULL,
`no_surat` int(25) NOT NULL,
`nama_surat` varchar(50) NOT NULL,
`keterangan_surat` varchar(225) NOT NULL,
`gambar_surat` text NOT NULL,
`balas_surat` varchar(225) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data untuk tabel `user_data_surat`
--
INSERT INTO `user_data_surat` (`id_surat`, `id`, `no_surat`, `nama_surat`, `keterangan_surat`, `gambar_surat`, `balas_surat`) VALUES
(1, 0, 205, 'Abcd', 'Mencoba saja', 'A13.jpg', ''),
(3, 0, 234, 'Tes', 'Oke', 'A13.jpg', ''),
(6, 0, 1, 'Percobaan', 'Ini hanya pemanis saja', 'A135.jpg', '');
-- --------------------------------------------------------
--
-- Struktur dari tabel `user_menu`
--
CREATE TABLE `user_menu` (
`id` int(11) NOT NULL,
`menu` varchar(128) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data untuk tabel `user_menu`
--
INSERT INTO `user_menu` (`id`, `menu`) VALUES
(1, 'Admin'),
(2, 'User'),
(3, 'Menu'),
(5, 'Data Surat'),
(6, 'Bpprd'),
(7, 'Data Surat');
-- --------------------------------------------------------
--
-- Struktur dari tabel `user_role`
--
CREATE TABLE `user_role` (
`id` int(11) NOT NULL,
`role` varchar(128) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data untuk tabel `user_role`
--
INSERT INTO `user_role` (`id`, `role`) VALUES
(1, 'Administrator'),
(2, 'Member'),
(3, 'Bpprd');
-- --------------------------------------------------------
--
-- Struktur dari tabel `user_sub_menu`
--
CREATE TABLE `user_sub_menu` (
`id` int(11) NOT NULL,
`menu_id` int(11) NOT NULL,
`title` varchar(128) NOT NULL,
`url` varchar(128) NOT NULL,
`icon` varchar(128) NOT NULL,
`is_active` int(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data untuk tabel `user_sub_menu`
--
INSERT INTO `user_sub_menu` (`id`, `menu_id`, `title`, `url`, `icon`, `is_active`) VALUES
(1, 1, 'Dashboard', 'admin', 'fas fa-fw fa-tachometer-alt', 1),
(2, 2, 'My Profile', 'user', 'fas fa-fw fa-user', 1),
(3, 2, 'Edit Profile', 'user/editprofile', 'fas fa-fw fa-user-edit', 1),
(4, 3, 'Menu Management', 'menu', 'fas fa-fw fa-folder', 1),
(5, 3, 'SubMenu Management', 'menu/submenu', 'fas fa-fw fa-folder-open', 1),
(7, 1, 'Role', 'admin/role', 'fas fa-fw fa-user-tie', 1),
(8, 2, 'Change Password', 'user/changepassword', 'fas fa-fw fa-key', 1),
(9, 5, 'Data Surat', 'user/datasurat', 'fas fa-fw fa-info', 1),
(10, 6, 'My Profile', 'bpprd', 'fas fa-fw fa-user', 1),
(11, 6, 'Edit Profile', 'bpprd/editprofile', 'fas fa-fw fa-user-edit', 1),
(12, 6, 'Change Password', 'bpprd/changepassword', 'fas fa-fw fa-key', 1),
(13, 7, 'Data Surat', 'bpprd/datasurat', 'fas fa-fw fa-info', 1);
-- --------------------------------------------------------
--
-- Struktur dari tabel `user_token`
--
CREATE TABLE `user_token` (
`id` int(11) NOT NULL,
`email` varchar(128) NOT NULL,
`token` varchar(128) NOT NULL,
`date_create` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data untuk tabel `user_token`
--
INSERT INTO `user_token` (`id`, `email`, `token`, `date_create`) VALUES
(6, 'afdhanmr@gmail.com', 'fLU3WfWPYTNp6Bu5lHENbD7OJulaPTsCzGT+W6NkCyo=', 1604481932),
(7, 'afdhanmr@gmail.com', '+by23hZBaA6/e8zkxEpTNVm8kvn7nDJXSXbqmqSPIqM=', 1604486104),
(8, 'admin@gmail.com', 'lScXzgMx/nEjVobE13pVp7JuLAoEctDLlRjlpRZ5+wQ=', 1611107632),
(9, 'Bpprderwan@gmail.com', 'KoGugv8DT7jGiCFsVE1HGF8hZqFTRb90rpZOcjLxqeg=', 1611109067);
--
-- Indexes for dumped tables
--
--
-- Indeks untuk tabel `balas_surat`
--
ALTER TABLE `balas_surat`
ADD PRIMARY KEY (`id_balas`);
--
-- Indeks untuk tabel `user`
--
ALTER TABLE `user`
ADD PRIMARY KEY (`id`);
--
-- Indeks untuk tabel `user_access_menu`
--
ALTER TABLE `user_access_menu`
ADD PRIMARY KEY (`id`);
--
-- Indeks untuk tabel `user_data_surat`
--
ALTER TABLE `user_data_surat`
ADD PRIMARY KEY (`id_surat`);
--
-- Indeks untuk tabel `user_menu`
--
ALTER TABLE `user_menu`
ADD PRIMARY KEY (`id`);
--
-- Indeks untuk tabel `user_role`
--
ALTER TABLE `user_role`
ADD PRIMARY KEY (`id`);
--
-- Indeks untuk tabel `user_sub_menu`
--
ALTER TABLE `user_sub_menu`
ADD PRIMARY KEY (`id`);
--
-- Indeks untuk tabel `user_token`
--
ALTER TABLE `user_token`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT untuk tabel yang dibuang
--
--
-- AUTO_INCREMENT untuk tabel `balas_surat`
--
ALTER TABLE `balas_surat`
MODIFY `id_balas` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT untuk tabel `user`
--
ALTER TABLE `user`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=21;
--
-- AUTO_INCREMENT untuk tabel `user_access_menu`
--
ALTER TABLE `user_access_menu`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=19;
--
-- AUTO_INCREMENT untuk tabel `user_data_surat`
--
ALTER TABLE `user_data_surat`
MODIFY `id_surat` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11;
--
-- AUTO_INCREMENT untuk tabel `user_menu`
--
ALTER TABLE `user_menu`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;
--
-- AUTO_INCREMENT untuk tabel `user_role`
--
ALTER TABLE `user_role`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT untuk tabel `user_sub_menu`
--
ALTER TABLE `user_sub_menu`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=14;
--
-- AUTO_INCREMENT untuk tabel `user_token`
--
ALTER TABLE `user_token`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;
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 */;
|
ALTER TABLE `employees`
ADD `middle_name` VARCHAR(50) NOT NULL DEFAULT '';
ALTER TABLE `products`
ADD CONSTRAINT fk_category_id
FOREIGN KEY (`category_id`)
REFERENCES `categories` (`id`)
ON DELETE NO ACTION
ON UPDATE CASCADE;
ALTER TABLE `employees`
MODIFY `middle_name` VARCHAR(100) NOT NULL DEFAULT '';
|
-- phpMyAdmin SQL Dump
-- version 4.7.0
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: May 18, 2019 at 02:03 PM
-- Server version: 10.1.26-MariaDB
-- PHP Version: 7.1.8
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: `atm`
--
-- --------------------------------------------------------
--
-- Table structure for table `alogin`
--
CREATE TABLE `alogin` (
`id` int(11) NOT NULL,
`password` varchar(225) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `alogin`
--
INSERT INTO `alogin` (`id`, `password`) VALUES
(101, 'admin@101');
-- --------------------------------------------------------
--
-- Table structure for table `hdfc`
--
CREATE TABLE `hdfc` (
`account` bigint(20) NOT NULL,
`amount` bigint(20) DEFAULT NULL,
`ifsc` varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `hdfc`
--
INSERT INTO `hdfc` (`account`, `amount`, `ifsc`) VALUES
(2220002456, 5500, 'hdfc2456');
-- --------------------------------------------------------
--
-- Table structure for table `mini`
--
CREATE TABLE `mini` (
`account` bigint(20) DEFAULT NULL,
`pin` int(11) DEFAULT NULL,
`withd` int(11) DEFAULT NULL,
`time` datetime DEFAULT NULL,
`dep` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `mini`
--
INSERT INTO `mini` (`account`, `pin`, `withd`, `time`, `dep`) VALUES
(111001234, 2214, 67, '2019-05-17 18:05:01', NULL),
(111001234, 2214, 200, '2019-05-18 11:05:24', NULL),
(111001234, 1996, 500, '2019-05-18 16:34:00', NULL),
(111001234, 1996, NULL, '2019-05-18 16:35:17', 200),
(111001234, 1996, 500, '2019-05-18 16:45:49', NULL),
(111001234, 1996, 400, '2019-05-18 17:06:48', NULL),
(111001234, 1996, 500, '2019-05-18 17:09:09', NULL),
(111001567, 6732, NULL, '2019-05-18 17:17:13', 500),
(111001567, 6732, 200, '2019-05-18 17:18:03', NULL);
-- --------------------------------------------------------
--
-- Table structure for table `pnb`
--
CREATE TABLE `pnb` (
`account` int(11) NOT NULL,
`name` varchar(50) DEFAULT NULL,
`amount` int(11) DEFAULT NULL,
`address` varchar(50) DEFAULT NULL,
`contact` bigint(20) DEFAULT NULL,
`pin` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `pnb`
--
INSERT INTO `pnb` (`account`, `name`, `amount`, `address`, `contact`, `pin`) VALUES
(111001234, 'puja', 3077, 'delhi', 8629053320, 1996),
(111001567, 'simar', 3344, 'amritsar', 9910634341, 6732);
-- --------------------------------------------------------
--
-- Table structure for table `state`
--
CREATE TABLE `state` (
`account` bigint(20) NOT NULL,
`amount` int(11) DEFAULT NULL,
`ifsc` varchar(225) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `state`
--
INSERT INTO `state` (`account`, `amount`, `ifsc`) VALUES
(111000111345, 55000, 'sb345');
-- --------------------------------------------------------
--
-- Table structure for table `ulogin`
--
CREATE TABLE `ulogin` (
`id` int(11) NOT NULL,
`password` varchar(225) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Indexes for dumped tables
--
--
-- Indexes for table `alogin`
--
ALTER TABLE `alogin`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `hdfc`
--
ALTER TABLE `hdfc`
ADD PRIMARY KEY (`account`);
--
-- Indexes for table `pnb`
--
ALTER TABLE `pnb`
ADD PRIMARY KEY (`account`);
--
-- Indexes for table `state`
--
ALTER TABLE `state`
ADD PRIMARY KEY (`account`);
--
-- Indexes for table `ulogin`
--
ALTER TABLE `ulogin`
ADD PRIMARY KEY (`id`);
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
CREATE PROCEDURE Sp_Get_SalesPortalIPList As
Select 'ipaddress' = IPAddress From SalesPortalIPList
Select 'salesportalip' = SalesPortalIP From Setup
|
CREATE TABLE `contact_details` (
`Firstname` varchar(100) NOT NULL,
`Lastname` varchar(100) DEFAULT NULL,
`Email` varchar(120) DEFAULT NULL,
`Phone` int(100) NOT NULL,
`Subject` varchar(700) NOT NULL
); |
DROP DATABASE IF EXISTS database_development;
CREATE DATABASE database_development;
USE database_development;
CREATE TABLE `pets` (
`pets_id` int NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
`pet_type` varchar(255),
`breed` varchar(255),
`status` varchar(255),
`age` varchar(255),
`size` varchar(255),
`sex` varchar(255),
`good_with_dogs` BOOLEAN,
`good_with_cats` BOOLEAN,
`good_with_kids` BOOLEAN,
`indoor_or_outdoor` varchar(255),
`housetrained` BOOLEAN,
`description` varchar(255) NOT NULL,
`date_surrendered` datetime DEFAULT NULL,
`date_adopted` datetime DEFAULT NULL,
`date_deceased` datetime DEFAULT NULL,
`notes` varchar(255) DEFAULT NULL,
`attention` varchar(255) DEFAULT NULL,
`image` varchar(255) NOT NULL,
PRIMARY KEY (`pets_id`)
); |
ALTER TABLE carros ADD COLUMN vendido BOOLEAN NOT NULL DEFAULT 0;
|
--PROBLEM 17
--Select all planes with their name, seats count and passengers count.
--Order the results by passengers count (descending), plane name (ascending) and seats (ascending)
SELECT
p.Name, p.Seats, COUNT(t.Id) AS PassengersCount
FROM Planes AS p
LEFT JOIN Flights AS f ON f.PlaneId=p.Id
LEFT JOIN Tickets AS t ON t.FlightId=f.Id
GROUP BY p.Name, p.Seats
ORDER BY PassengersCount DESC, p.Name, p.Seats |
-- supression des objets prédifinie
INSERT INTO `playercreateinfo_item` VALUES ('0', '3', '12282', '-1');
INSERT INTO `playercreateinfo_item` VALUES ('0', '0', '51809', '-1');
-- Dwarf Hunter
INSERT INTO `playercreateinfo_item` VALUES ('3', '3', '148', '-1');
INSERT INTO `playercreateinfo_item` VALUES ('3', '3', '147', '-1');
INSERT INTO `playercreateinfo_item` VALUES ('3', '3', '129', '-1');
INSERT INTO `playercreateinfo_item` VALUES ('3', '3', '2508', '-1');
INSERT INTO `playercreateinfo_item` VALUES ('3', '3', '2516', '-200');
INSERT INTO `playercreateinfo_item` VALUES ('3', '3', '2102', '-1');
-- Night Elf Hunter
INSERT INTO `playercreateinfo_item` VALUES ('4', '3', '148', '-1');
INSERT INTO `playercreateinfo_item` VALUES ('4', '3', '147', '-1');
INSERT INTO `playercreateinfo_item` VALUES ('4', '3', '129', '-1');
INSERT INTO `playercreateinfo_item` VALUES ('4', '3', '2504', '-1');
INSERT INTO `playercreateinfo_item` VALUES ('4', '3', '2512', '-200');
INSERT INTO `playercreateinfo_item` VALUES ('4', '3', '2101', '-1');
-- Draenei Hunter
INSERT INTO `playercreateinfo_item` VALUES ('11', '3', '23345', '-1');
INSERT INTO `playercreateinfo_item` VALUES ('11', '3', '23344', '-1');
INSERT INTO `playercreateinfo_item` VALUES ('11', '3', '23348', '-1');
INSERT INTO `playercreateinfo_item` VALUES ('11', '3', '12247', '-1');
INSERT INTO `playercreateinfo_item` VALUES ('11', '3', '2512', '-200');
INSERT INTO `playercreateinfo_item` VALUES ('11', '3', '2101', '-1');
-- Orc Hunter
INSERT INTO `playercreateinfo_item` VALUES ('2', '3', '127', '-1');
INSERT INTO `playercreateinfo_item` VALUES ('2', '3', '6126', '-1');
INSERT INTO `playercreateinfo_item` VALUES ('2', '3', '6127', '-1');
INSERT INTO `playercreateinfo_item` VALUES ('2', '3', '2504', '-1');
INSERT INTO `playercreateinfo_item` VALUES ('2', '3', '2512', '-200');
INSERT INTO `playercreateinfo_item` VALUES ('2', '3', '2101', '-1');
-- Tauren Hunter
INSERT INTO `playercreateinfo_item` VALUES ('6', '3', '127', '-1');
INSERT INTO `playercreateinfo_item` VALUES ('6', '3', '6126', '-1');
INSERT INTO `playercreateinfo_item` VALUES ('6', '3', '2508', '-1');
INSERT INTO `playercreateinfo_item` VALUES ('6', '3', '2516', '-200');
INSERT INTO `playercreateinfo_item` VALUES ('6', '3', '2102', '-1');
-- Blood Elf Hunter
INSERT INTO `playercreateinfo_item` VALUES ('10', '3', '20901', '-1');
INSERT INTO `playercreateinfo_item` VALUES ('10', '3', '20899', '-1');
INSERT INTO `playercreateinfo_item` VALUES ('10', '3', '20900', '-1');
INSERT INTO `playercreateinfo_item` VALUES ('10', '3', '20980', '-1');
INSERT INTO `playercreateinfo_item` VALUES ('10', '3', '2512', '-200');
INSERT INTO `playercreateinfo_item` VALUES ('10', '3', '2101', '-1');
-- TROOOOOOL HUNTER FTW
INSERT INTO `playercreateinfo_item` VALUES ('8', '3', '-6126', '-1');
INSERT INTO `playercreateinfo_item` VALUES ('8', '3', '-2504', '-1');
INSERT INTO `playercreateinfo_item` VALUES ('8', '3', '2512', '-200');
INSERT INTO `playercreateinfo_item` VALUES ('8', '3', '2101', '-1');
-- Ajout de S7 Chasseur Parure de gladiateur implacable
INSERT INTO `playercreateinfo_item` VALUES ('0', '3', '41088', '1');
INSERT INTO `playercreateinfo_item` VALUES ('0', '3', '41144', '1');
INSERT INTO `playercreateinfo_item` VALUES ('0', '3', '41158', '1');
INSERT INTO `playercreateinfo_item` VALUES ('0', '3', '41206', '1');
INSERT INTO `playercreateinfo_item` VALUES ('0', '3', '41218', '1');
-- Ajout de Hors Set
INSERT INTO `playercreateinfo_item` VALUES ('0','3','41226','1');
INSERT INTO `playercreateinfo_item` VALUES ('0','3','41236','1');
INSERT INTO `playercreateinfo_item` VALUES ('0','3','41231','1'); |
delete from order_dishes;
delete from orders_status_history;
delete from orders; |
SHOW TABLES;
/*** Games Table ***/
DESC Games;
INSERT INTO Games (name, description, price, console_name) values (
'Test Game',
'This game is being used to test the database.',
'79.99',
'Microsoft Surface'
);
INSERT INTO Games (name, description, price, console_name) values (
'Another Test Game',
'This game is also being used to test the database.',
'49.99',
'PS4'
);
SELECT * FROM Games;
/*** Orders Table ***/
DESC Orders;
INSERT INTO Orders (user_id) values (
007
);
SELECT * FROM Orders;
/*** Receipt Table ***/
DESC Receipt;
INSERT INTO Receipt (receipt_id, game_id, quantity, name, description, price, console_name) values (
1,
1,
3,
'Test Game',
'This game is being used to test the database.',
'79.99',
'Microsoft Surface'
);
INSERT INTO Receipt (receipt_id, game_id, quantity, name, description, price, console_name) values (
1,
2,
1,
'Another Test Game',
'This game is also being used to test the database.',
'49.99',
'PS4'
);
SELECT * FROM Receipt;
/*** ShoppingCart Table ***/
DESC ShoppingCart;
INSERT INTO ShoppingCart values (
1,
4,
2
);
SELECT * FROM ShoppingCart;
/*** Users Table ***/
DESC Users;
INSERT INTO Users (username, password, address, email, user_role) values (
'EvanPlant',
'p4ssw0rd',
'1234 Camosun Ln.',
'1234@camosun.ca',
'Admin'
);
INSERT INTO Users (username, password, address, email, user_role) values (
'DougGreening',
'SlightlyStrongerP4ssw0rd',
'1234 Camosun Ln.',
'12345@camosun.ca',
'Customer'
);
SELECT * FROM Users;
|
# patch_49_50_e.sql
#
# title: Create tables for new mapping_seq_region tables
#
# Description: Creates two new tables, seq_region_mapping and mapping_seq that will allow to upload user data and be able to map it
# even there is a change of seq_region in a previous release
################################################################################
#
# Table structure for seq_region mapping between releases
#
# Stores how the core seq_region_id have changed from release to release
CREATE TABLE seq_region_mapping (
external_seq_region_id INT(10) UNSIGNED NOT NULL,
internal_seq_region_id INT(10) UNSIGNED NOT NULL,
mapping_set_id INT(10) UNSIGNED NOT NULL,
KEY (mapping_set_id)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
################################################################################
#
# Table structure for seq_region mapping between releases
#
# Stores how which mapping group the seq_region are for a particular schema
CREATE TABLE mapping_set (
mapping_set_id INT(10) UNSIGNED NOT NULL,
schema_build VARCHAR(20) NOT NULL,
PRIMARY KEY(schema_build)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
# Patch identifier
INSERT INTO meta (meta_key, meta_value) VALUES ('patch', 'patch_49_50_e.sql|mapping_seq_region');
|
-- MySQL dump 10.13 Distrib 8.0.16, for Win64 (x86_64)
-- ------------------------------------------------------
-- Server version 8.0.13
/*!40101 SET @OLD_CHARACTER_SET_CLIENT = @@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS = @@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION = @@COLLATION_CONNECTION */;
SET NAMES utf8;
/*!40103 SET @OLD_TIME_ZONE = @@TIME_ZONE */;
/*!40103 SET TIME_ZONE = '+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS = @@UNIQUE_CHECKS, UNIQUE_CHECKS = 0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS = @@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS = 0 */;
/*!40101 SET @OLD_SQL_MODE = @@SQL_MODE, SQL_MODE = 'NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES = @@SQL_NOTES, SQL_NOTES = 0 */;
--
-- Dumping data for table `addresses`
--
LOCK TABLES `addresses` WRITE;
/*!40000 ALTER TABLE `addresses`
DISABLE KEYS */;
INSERT INTO `addresses`
VALUES (2, 'Hell', 48169, 'Hell 666');
/*!40000 ALTER TABLE `addresses`
ENABLE KEYS */;
UNLOCK TABLES;
--
-- Dumping data for table `users`
--
LOCK TABLES `users` WRITE;
/*!40000 ALTER TABLE `users`
DISABLE KEYS */;
INSERT INTO `users`
VALUES (1, NULL, '2020-05-01 12:40:40.881373', 'admin.admin@gmail.com', 'Admin', '2020-05-01 12:40:40.881373', 'Admin',
'$2a$10$vzbyU9hudka/BB3op4q1rOEY3EH2LkUW8m1Vv2FMisobjGBa6b3iW', '+420 123 456 789',
'2020-05-01 12:40:40.881373', 2);
/*!40000 ALTER TABLE `users`
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-05-01 14:43:29
|
-- phpMyAdmin SQL Dump
-- version 3.5.1
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Jun 03, 2014 at 06:35 AM
-- Server version: 5.5.24-log
-- PHP Version: 5.3.13
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
--
-- Database: `testdb`
--
-- --------------------------------------------------------
--
-- Table structure for table `admin`
--
CREATE TABLE IF NOT EXISTS `admin` (
`id` int(100) NOT NULL AUTO_INCREMENT,
`username` varchar(100) NOT NULL,
`password` varchar(100) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
--
-- Dumping data for table `admin`
--
INSERT INTO `admin` (`id`, `username`, `password`) VALUES
(1, 'admin', 'admin');
-- --------------------------------------------------------
--
-- Table structure for table `advertisement`
--
CREATE TABLE IF NOT EXISTS `advertisement` (
`id` int(50) NOT NULL AUTO_INCREMENT,
`place_name` varchar(50) NOT NULL,
`ad_title` varchar(500) NOT NULL,
`ad_content` varchar(500) NOT NULL,
`ad_contact` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=73 ;
--
-- Dumping data for table `advertisement`
--
INSERT INTO `advertisement` (`id`, `place_name`, `ad_title`, `ad_content`, `ad_contact`) VALUES
(52, 'First time', 'this istee', 'tee', 124),
(53, 'First time', 'this istee', 'tee', 124),
(54, 'First time', 'this istee', 'tee', 124),
(55, 'First time', 'this istee', 'tee', 124),
(56, 'First time', 'this istee', 'tee', 124),
(57, 'First time', 'this istee', 'tee', 124),
(58, 'First time', 'this istee', 'tee', 124),
(59, 'third time', 'Third time test', 'My name is Ishwor Khanal', 1234),
(60, 'First time', 'wow 40% offf', 'this is in the occasion of exam', 10000),
(61, 'First time', 'wow get it', 'this is test', 1234),
(62, 'Fourth time', '100% off', 'fourth test', 1234),
(63, 'sixth page', 'this is sixth 74% off', 'sfsd ', 1000),
(64, 'seventh', '7% off', 'dsfdsa', 124),
(65, 'seventh', 'new advertisement', '78% off', 1234),
(66, 'last time', 'wow 40% offf', 'asfds', 124),
(67, 'last time', 'new add', 'sdfsda', 447),
(68, 'modified tenth', 'wow finally found it', 'this is data ', 101),
(69, 'Eleventh', 'advertisement', 'sdfdsa', 124),
(70, 'First time', 'This is first time advertisement', 'Get it 50 %', 12345),
(71, 'Second time', 'advertisement starts here', 'this is ad', 41),
(72, 'twenteeth', 'this is absolutly free', 'get it', 124);
-- --------------------------------------------------------
--
-- Table structure for table `blog`
--
CREATE TABLE IF NOT EXISTS `blog` (
`id` int(100) NOT NULL AUTO_INCREMENT,
`topic` text NOT NULL,
`details` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=10 ;
--
-- Dumping data for table `blog`
--
INSERT INTO `blog` (`id`, `topic`, `details`) VALUES
(1, 'sdfas', 'asdfasdfas'),
(2, 'politics', 'about politics asdfasdfas'),
(3, 'politics', 'about politics asdfasdfas'),
(4, 'politicsasdfasdfasdfasdfasd', 'about politics asdfasdfaassadfasdfasdfas'),
(5, 'Exam', 'about exam'),
(8, 'Nepal ko chor', 'Binod chaudhari '),
(9, 'This is hot topic', 'detaisl is ');
-- --------------------------------------------------------
--
-- Table structure for table `create_homepage`
--
CREATE TABLE IF NOT EXISTS `create_homepage` (
`id` int(255) NOT NULL AUTO_INCREMENT,
`userid` varchar(250) NOT NULL,
`placename` varchar(100) NOT NULL,
`location` varchar(100) NOT NULL,
`description` text NOT NULL,
`phrase` varchar(100) NOT NULL,
`webAddress` varchar(200) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=78 ;
--
-- Dumping data for table `create_homepage`
--
INSERT INTO `create_homepage` (`id`, `userid`, `placename`, `location`, `description`, `phrase`, `webAddress`) VALUES
(74, 'ishwor@yahoo.com', 'firsttime', 'USA', 'this is content', 'a b c', 'firsttime.php'),
(75, 'sagar@yahoo.com', 'sagar', 'melbourne', 'this is the page created by sagar modified once\r\n', 'a b c d', 'sagar.php'),
(76, 'sagar@yahoo.com', 'pandey', 'Bundoora', 'this is created by sagar', 'one two', 'pandey.php'),
(77, 'ishwor@yahoo.com', 'second time', 'Canada', 'this is the page created by Ishwor', 'one two', 'second time.php');
-- --------------------------------------------------------
--
-- Table structure for table `pages`
--
CREATE TABLE IF NOT EXISTS `pages` (
`id` int(100) NOT NULL AUTO_INCREMENT,
`page_path` varchar(500) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `registration`
--
CREATE TABLE IF NOT EXISTS `registration` (
`id` int(100) NOT NULL AUTO_INCREMENT,
`yourname` varchar(500) NOT NULL,
`email` varchar(100) NOT NULL,
`password` varchar(32) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=43 ;
--
-- Dumping data for table `registration`
--
INSERT INTO `registration` (`id`, `yourname`, `email`, `password`) VALUES
(41, 'ishwor', 'ishwor@yahoo.com', '098f6bcd4621d373cade4e832627b4f6'),
(42, 'Sagar', 'sagar@yahoo.com', '098f6bcd4621d373cade4e832627b4f6');
-- --------------------------------------------------------
--
-- Table structure for table `reply`
--
CREATE TABLE IF NOT EXISTS `reply` (
`id` int(100) NOT NULL AUTO_INCREMENT,
`start_bloggin_id` int(100) NOT NULL,
`reply` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `start_bloggin`
--
CREATE TABLE IF NOT EXISTS `start_bloggin` (
`id` int(100) NOT NULL AUTO_INCREMENT,
`topic` varchar(100) NOT NULL,
`description` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
-- phpMyAdmin SQL Dump
-- version 4.7.1
-- https://www.phpmyadmin.net/
--
-- Host: mysql:3306
-- Generation Time: Jan 23, 2018 at 06:08 PM
-- Server version: 5.7.18
-- PHP Version: 7.0.16
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: `matchadb`
--
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
CREATE TABLE `users` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`login` varchar(255) DEFAULT NULL,
`firstname` varchar(255) DEFAULT NULL,
`lastname` varchar(255) DEFAULT NULL,
`password` varchar(255) DEFAULT NULL,
`email` varchar(255) DEFAULT NULL,
`gender` varchar(1) DEFAULT NULL,
`orientation` varchar(1) DEFAULT NULL,
`dob` date NOT NULL,
`registered` date NOT NULL,
`lastseen` date NULL,
`isconnected` boolean not null default 0,
`confirmed` boolean not null default 0,
`firstLogin` boolean not null default 1,
`text1` text,
`text2` text,
`text3` text,
`city` varchar(255) NOT NULL,
`country` varchar(255) NOT NULL,
`nat` varchar(255) NOT NULL,
`size` int(3) DEFAULT NULL,
`ethnicity` varchar(255) DEFAULT NULL,
`religion` varchar(255) DEFAULT NULL,
`status` varchar(255) DEFAULT NULL,
`smoke` varchar(255) DEFAULT NULL,
`drink` varchar(255) DEFAULT NULL,
`drugs` varchar(255) DEFAULT NULL,
`sign` varchar(255) DEFAULT NULL,
`diet` varchar(255) DEFAULT NULL,
`kids` tinyint(1) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Table structure for table `user_interests`
--
CREATE TABLE tags (
`id` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
`tag` VARCHAR(20) NOT NULL,
`in_or_out` VARCHAR(3) NOT NULL
);
INSERT INTO tags (tag, in_or_out) VALUES ('Music', 'in'), ('Foot', 'in'), ('Computer', 'in'), ('Science', 'in'), ('Gaming', 'in'), ('Movies', 'in'), ('Acting', 'in'), ('Cooking', 'in'), ('Crocheting', 'in'), ('Crossword puzzles', 'in'),
('Dance', 'in'), ('DIY', 'in'), ('Fashion', 'in'), ('Homebrewing', 'in'), ('CTG', 'in'), ('Sculpting', 'in'), ('Reading', 'in'), ('WoodWorking', 'in'), ('Painting', 'in'), ('Playing music', 'in'),
('Singing', 'in'), ('Watching TV', 'in'), ('drawing', 'in'), ('Yoga', 'in');
INSERT INTO tags (tag, in_or_out) VALUES ('Archery', 'out'), ('Astronomy', 'out'), ('Basketball', 'out'), ('Camping', 'out'), ('Canyoning', 'out'), ('Driving', 'out'), ('Fishing', 'out'), ('Geocaching', 'out'), ('Hiking', 'out'),
('Horseback Riding', 'out'), ('Hunting', 'out'), ('Jogging', 'out'), ('Martial Art', 'out'), ('Motor sports', 'out'), ('Paintball', 'out'), ('Parkour', 'out'), ('Photography', 'out'), ('Rock climbing', 'out'),
('Roller skating', 'out'), ('Skateboarding', 'out'), ('Rugby', 'out'), ('Skiing', 'out'), ('Snowboarding', 'out'), ('Walking', 'out');
--
-- Table structure for table `user_interests`
--
CREATE TABLE users_tags (
`user_id` INT NOT NULL,
`tag_id` INT NOT NULL,
PRIMARY KEY(`user_id`, `tag_id`),
CONSTRAINT `tagUpdate` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
);
--
-- Table structure for table `photos`
--
CREATE TABLE `photos` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`link` varchar(255) NOT NULL,
`idUser` int(11) NOT NULL,
`created` varchar(255) DEFAULT NULL,
`isProfil` tinyint(1) DEFAULT NULL,
PRIMARY KEY (`id`),
CONSTRAINT `photosUpdate` FOREIGN KEY (`idUser`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!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 */;
|
# noinspection SqlResolveForFile
--
-- Various queries to report on progress and status
--
-- Total time taken by category
SELECT
schema_name,
category,
count(*) AS table_count,
sum(seconds_taken) AS total_seconds,
sec_to_time(sum(seconds_taken)) AS total_time
FROM LOG_TABLE_CATEGORY_SUMMARY
GROUP BY schema_name, category;
-- Total rows to import
SELECT
schema_name,
sum(rows)
FROM MIGRATION_STATUS
GROUP BY schema_name;
-- Total rows imported
SELECT
v.schema_name,
sum(s.rows)
FROM LOG_TABLE_CATEGORY_SUMMARY v
INNER JOIN MIGRATION_STATUS s
ON s.schema_name = v.schema_name AND s.table_name = v.table_name
WHERE v.category = 'IMPORT_DATA'
GROUP BY v.schema_name;
-- Time taken for importing so far
SELECT
ss.schema_name,
ss.table_name,
ss.seconds_taken,
s.rows,
(s.rows / ss.seconds_taken) as rows_per_second
FROM LOG_TABLE_CATEGORY_SUMMARY ss
INNER JOIN MIGRATION_STATUS s
ON s.schema_name = ss.schema_name AND s.table_name = ss.table_name
WHERE ss.category = 'IMPORT_DATA'
ORDER BY ss.seconds_taken;
-- Records remaining to be imported and an estimate of how long it will take
SELECT
status.schema_name,
count(*) AS remaining_tables,
format(sum(status.rows), 0) AS remaining_rows,
format(imported_summary.imported_rows, 0) AS imported_rows,
-- format((sum(status.rows) / imported_summary.imported_avg_rows_per_second), 0) AS seconds_remaining,
-- sec_to_time(sum(status.rows) / imported_summary.imported_avg_rows_per_second) AS time_remaining,
format((count(*) * imported_avg_seconds), 0) AS seconds_remaining,
sec_to_time((count(*) * imported_avg_seconds)) AS time_remaining,
sec_to_time(imported_summary.imported_seconds) AS imported_time,
format(imported_avg_seconds, 2) AS imported_avg_seconds_per_table,
format(imported_avg_rows_per_second, 2) AS imported_avg_rows_per_second,
(select s2.TABLE_NAME from MIGRATION_STATUS s2 where s2.schema_name = status.schema_name and s2.IMPORTING = 'Y' order by id limit 1) as currently_importing
FROM (
SELECT
ss.schema_name AS imported_schema,
sum(s.rows) AS imported_rows,
sum(ss.seconds_taken) AS imported_seconds,
sec_to_time(sum(seconds_taken)) AS imported_time,
avg(ss.seconds_taken) AS imported_avg_seconds,
sum(s.rows) / sum(ss.seconds_taken) AS imported_avg_rows_per_second
FROM LOG_TABLE_CATEGORY_SUMMARY ss
INNER JOIN MIGRATION_STATUS s
ON s.schema_name = ss.schema_name AND s.table_name = ss.table_name
GROUP BY ss.schema_name, ss.CATEGORY
HAVING ss.category = 'IMPORT_DATA'
) AS imported_summary
INNER JOIN MIGRATION_STATUS status ON imported_summary.imported_schema = status.schema_name
WHERE status.imported = 'N'
GROUP BY status.schema_name;
-- Total records already imported
SELECT
ss.schema_name,
sum(s.rows) AS rows_imported,
sum(ss.seconds_taken) AS imported_seconds,
sec_to_time(sum(seconds_taken)) AS imported_time,
avg(ss.seconds_taken) AS imported_avg_seconds,
sum(s.rows) / sum(ss.seconds_taken) AS imported_avg_rows_per_second
FROM LOG_TABLE_CATEGORY_SUMMARY ss
INNER JOIN MIGRATION_STATUS s
ON s.schema_name = ss.schema_name AND s.table_name = ss.table_name
GROUP BY ss.schema_name, ss.category
HAVING ss.category = 'IMPORT_DATA';
-- Group by start/end pairs (only those with table names)
CREATE OR REPLACE VIEW LOG_TABLE_CATEGORY_SUMMARY AS
SELECT
start_log.schema_name,
start_log.TABLE_NAME,
start_log.CATEGORY,
start_log.CREATED AS start_time,
end_log.CREATED AS end_time,
TIMESTAMPDIFF(SECOND, start_log.CREATED, end_log.CREATED) AS seconds_taken,
TIMEDIFF(end_log.CREATED, start_log.CREATED) AS time_taken
FROM
MIGRATION_LOG AS start_log
INNER JOIN MIGRATION_LOG AS end_log ON (
start_log.SCHEMA_NAME = end_log.SCHEMA_NAME
AND start_log.TABLE_NAME = end_log.TABLE_NAME
AND start_log.CATEGORY = end_log.CATEGORY
AND end_log.CREATED >= start_log.CREATED)
WHERE start_log.ACTION = 'START' AND end_log.ACTION = 'END'
AND trim(start_log.TABLE_NAME) != "" AND trim(end_log.TABLE_NAME) != ""
GROUP BY start_log.schema_name, start_log.TABLE_NAME, start_log.CATEGORY
ORDER BY start_log.CREATED;
-- Group by start/end pairs (all pairs)
CREATE OR REPLACE VIEW LOG_NOTABLE_CATEGORY_SUMMARY AS
SELECT
start_log.schema_name,
start_log.TABLE_NAME,
start_log.CATEGORY,
start_log.CREATED AS start_time,
end_log.CREATED AS end_time,
TIMESTAMPDIFF(SECOND, start_log.CREATED, end_log.CREATED) AS seconds_taken,
TIMEDIFF(end_log.CREATED, start_log.CREATED) AS time_taken
FROM
MIGRATION_LOG AS start_log
INNER JOIN MIGRATION_LOG AS end_log ON (
start_log.SCHEMA_NAME = end_log.SCHEMA_NAME
AND start_log.TABLE_NAME = end_log.TABLE_NAME
AND start_log.CATEGORY = end_log.CATEGORY
AND end_log.CREATED >= start_log.CREATED)
WHERE start_log.ACTION = 'START' AND end_log.ACTION = 'END'
AND trim(start_log.TABLE_NAME) = "" AND trim(end_log.TABLE_NAME) = ""
GROUP BY start_log.schema_name, start_log.TABLE_NAME, start_log.CATEGORY
ORDER BY start_log.CREATED; |
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
-- Database: `crud`
--
-- --------------------------------------------------------
--
-- Table structure for table `student`
--
CREATE TABLE `student` (
`sid` int(10) NOT NULL,
`sname` varchar(30) NOT NULL,
`saddress` varchar(15) NOT NULL,
`sclass` int(15) NOT NULL,
`sphone` varchar(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `student`
--
INSERT INTO `student` (`sid`, `sname`, `saddress`, `sclass`, `sphone`) VALUES
-- --------------------------------------------------------
--
-- Table structure for table `studentclass`
--
CREATE TABLE `studentclass` (
`cid` int(20) NOT NULL,
`cname` varchar(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
delete from customer_industry;
insert into customer_industry(id,name,superior_id,level,descript,disp_order) values(1,'券商',null,1,null,1);
insert into customer_industry(id,name,superior_id,level,descript,disp_order) values(2,'银行',null,1,null,2);
insert into customer_industry(id,name,superior_id,level,descript,disp_order) values(3,'投资',null,1,null,3);
insert into customer_industry(id,name,superior_id,level,descript,disp_order) values(4,'媒体',null,1,null,4);
insert into customer_industry(id,name,superior_id,level,descript,disp_order) values(5,'资讯',null,1,null,5);
insert into customer_industry(id,name,superior_id,level,descript,disp_order) values(6,'上市',null,1,null,6);
insert into customer_industry(id,name,superior_id,level,descript,disp_order) values(7,'其他',null,1,null,7);
insert into customer_industry(id,name,superior_id,level,descript,disp_order) values(8,'中资券商',1,2,null,8);
insert into customer_industry(id,name,superior_id,level,descript,disp_order) values(9,'海外券商',1,2,null,9);
insert into customer_industry(id,name,superior_id,level,descript,disp_order) values(10,'中资银行',2,2,null,10);
insert into customer_industry(id,name,superior_id,level,descript,disp_order) values(11,'海外银行',2,2,null,11);
insert into customer_industry(id,name,superior_id,level,descript,disp_order) values(12,'公募基金',3,2,null,12);
insert into customer_industry(id,name,superior_id,level,descript,disp_order) values(13,'私募基金',3,2,null,13);
insert into customer_industry(id,name,superior_id,level,descript,disp_order) values(14,'投资公司',3,2,null,14);
insert into customer_industry(id,name,superior_id,level,descript,disp_order) values(15,'财务公司',3,2,null,15);
insert into customer_industry(id,name,superior_id,level,descript,disp_order) values(16,'财经网站',4,2,null,16);
insert into customer_industry(id,name,superior_id,level,descript,disp_order) values(17,'报刊杂志',4,2,null,17);
insert into customer_industry(id,name,superior_id,level,descript,disp_order) values(18,'电视台',4,2,null,18);
insert into customer_industry(id,name,superior_id,level,descript,disp_order) values(19,'电台',4,2,null,19);
insert into customer_industry(id,name,superior_id,level,descript,disp_order) values(20,'资讯公司',5,2,null,20);
insert into customer_industry(id,name,superior_id,level,descript,disp_order) values(21,'上市公司',6,2,null,21);
insert into customer_industry(id,name,superior_id,level,descript,disp_order) values(22,'政府机构',7,2,null,22);
insert into customer_industry(id,name,superior_id,level,descript,disp_order) values(23,'高校',7,2,null,23);
insert into customer_industry(id,name,superior_id,level,descript,disp_order) values(24,'研究单位',7,2,null,24);
insert into customer_industry(id,name,superior_id,level,descript,disp_order) values(25,'其他',7,2,null,25);
delete from market_event_type;
insert into market_event_type(id,name,superior_id,level,descript,disp_order) values(1,'拜访',null,1,null,1);
insert into market_event_type(id,name,superior_id,level,descript,disp_order) values(2,'培训',null,1,null,2);
insert into market_event_type(id,name,superior_id,level,descript,disp_order) values(3,'活动',null,1,null,3);
insert into market_event_type(id,name,superior_id,level,descript,disp_order) values(4,'其他',null,1,null,4);
insert into market_event_type(id,name,superior_id,level,descript,disp_order) values(5,'拜访',1,2,null,5);
insert into market_event_type(id,name,superior_id,level,descript,disp_order) values(6,'内部培训',2,2,null,6);
insert into market_event_type(id,name,superior_id,level,descript,disp_order) values(7,'投资者培训',2,2,null,7);
insert into market_event_type(id,name,superior_id,level,descript,disp_order) values(8,'线上活动',3,2,null,8);
insert into market_event_type(id,name,superior_id,level,descript,disp_order) values(9,'线下活动',3,2,null,9);
insert into market_event_type(id,name,superior_id,level,descript,disp_order) values(10,'其他',4,2,null,10);
delete from industry_news_type;
insert into industry_news_type(id,name,descript,disp_order) values(1,'政策',null,1);
insert into industry_news_type(id,name,descript,disp_order) values(2,'行业新闻',null,2);
insert into industry_news_type(id,name,descript,disp_order) values(3,'公司新闻',null,3);
delete from sys_company;
insert into sys_company VALUES ('1', '融聚', null, 'A', 'default.jpg', 'R');
insert into sys_company VALUES ('2', '联通', null, 'A', 'default.jpg', 'O');
delete from sys_company_user;
insert into `sys_company_user` VALUES ('1', '1', 'admin', 'admin', 'admin123', null, null, 'A', 'N');
delete from sys_company_user_role;
insert into sys_company_user_role(sys_company_user_id, sys_company_role_id) values(1, 1);
insert into sys_company_user_role(sys_company_user_id, sys_company_role_id) values(2, 2); |
WITH RECURSIVE search_recursive_messages (counter, parent_counter, updated, profile_id, depth, path, cycle) AS (
SELECT f.counter, f.parent_counter, f.updated, f.profile_id, 1,
ARRAY[f.counter],
false
FROM message_messages f
UNION ALL
SELECT f.counter, f.parent_counter, f.updated, f.profile_id, srf.depth + 1,
path || f.counter,
f.counter = ANY(path)
FROM message_messages f, search_recursive_messages srf
WHERE f.counter = srf.parent_counter AND NOT cycle
)
SELECT f.*, srf.counter, max(updated), count(*)-1 AS replies FROM search_recursive_messages GROUP BY counter ORDER BY counter; |
/*
Navicat MySQL Data Transfer
Source Server : mysql
Source Server Version : 50514
Source Host : localhost:3306
Source Database : odontologia
Target Server Type : MYSQL
Target Server Version : 50514
File Encoding : 65001
Date: 2011-08-18 21:32:14
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for `paciente`
-- ----------------------------
DROP TABLE IF EXISTS `paciente`;
CREATE TABLE `paciente` (
`codigo` int(11) unsigned NOT NULL,
`nombre` varchar(50) DEFAULT NULL,
`apellido` varchar(50) DEFAULT NULL,
`direccion` text,
`identificacion` varchar(50) DEFAULT '',
`fecha_nacimiento` date DEFAULT NULL,
`telefono_casa` varchar(20) DEFAULT NULL,
`telefono_celular` varchar(20) DEFAULT NULL,
`telefono_trabajo` varchar(20) DEFAULT NULL,
`email` varchar(50) DEFAULT NULL,
`historial_medico` text,
`tipo_sangre` varchar(20) DEFAULT NULL,
`alergias` text,
PRIMARY KEY (`codigo`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- ----------------------------
-- Records of paciente
-- ----------------------------
INSERT INTO `paciente` VALUES ('1', 'natanael', 'sanchez melchor', 'tirso guerrero', '001-1689791-9', '1983-01-11', '809-333-444', '', null, null, null, 'A+', null);
INSERT INTO `paciente` VALUES ('2', 'junior', 'de la rosa', 'santo domingo', '001-1689791-2', '1985-01-11', '444-555-6660', '', null, null, null, null, null);
INSERT INTO `paciente` VALUES ('3', 'dilcia', 'sanchez melchor', null, '', '1979-12-26', '809-599-6439', null, null, null, null, null, null);
|
ALTER TABLE payment DROP CONSTRAINT fk_payment_users;
ALTER TABLE payment ADD CONSTRAINT fk_payment_users FOREIGN KEY(user_id) REFERENCES users(id) |
with commits_data as (
select r.repo_group as repo_group,
c.sha,
c.dup_actor_id as actor_id,
c.dup_actor_login as actor_login
from
gha_repos r,
gha_commits c
where
c.dup_repo_id = r.id
and c.dup_repo_name = r.name
and c.dup_created_at >= '{{from}}'
and c.dup_created_at < '{{to}}'
and (lower(c.dup_actor_login) {{exclude_bots}})
and c.dup_actor_login in (select users_name from tusers)
union select r.repo_group as repo_group,
c.sha,
c.author_id as actor_id,
c.dup_author_login as actor_login
from
gha_repos r,
gha_commits c
where
c.dup_repo_id = r.id
and c.dup_repo_name = r.name
and c.author_id is not null
and c.dup_created_at >= '{{from}}'
and c.dup_created_at < '{{to}}'
and (lower(c.dup_author_login) {{exclude_bots}})
and c.dup_author_login in (select users_name from tusers)
union select r.repo_group as repo_group,
c.sha,
c.committer_id as actor_id,
c.dup_committer_login as actor_login
from
gha_repos r,
gha_commits c
where
c.dup_repo_id = r.id
and c.dup_repo_name = r.name
and c.committer_id is not null
and c.dup_created_at >= '{{from}}'
and c.dup_created_at < '{{to}}'
and (lower(c.dup_committer_login) {{exclude_bots}})
and c.dup_committer_login in (select users_name from tusers)
)
select
concat('user;', sub.cuser, '`', sub.repo_group, ';commits'),
round(sub.commits / {{n}}, 2) as commits
from (
select actor_login as cuser,
'all' as repo_group,
count(distinct sha) as commits
from
commits_data
group by
actor_login
union select actor_login as cuser,
repo_group,
count(distinct sha) as commits
from
commits_data
group by
actor_login,
repo_group
union select 'All' as cuser,
'all' as repo_group,
count(distinct sha) as commits
from
commits_data
union select 'All' as cuser,
repo_group,
count(distinct sha) as commits
from
commits_data
group by
repo_group
) sub
where
sub.repo_group is not null
;
|
DROP TABLE IF EXISTS base_entity;
CREATE TABLE base_entity (
entity_id VARCHAR(127) NOT NULL,
entity_name VARCHAR(256) NOT NULL,
entity_created_time TIMESTAMP NOT NULL,
entity_last_updated_time TIMESTAMP NOT NULL,
PRIMARY KEY (entity_id)
) ENGINE=INNODB;
DROP TABLE IF EXISTS entity_type;
CREATE TABLE entity_type (
entity_type_id VARCHAR(127) NOT NULL,
entity_id VARCHAR(127) NOT NULL,
entity_type_name VARCHAR(256) NOT NULL,
PRIMARY KEY (entity_id, entity_type_id),
FOREIGN KEY (entity_id) REFERENCES base_entity(entity_id)
) ENGINE=INNODB;
DROP TABLE IF EXISTS entity_content;
CREATE TABLE entity_content (
entity_content_id INTEGER NOT NULL AUTO_INCREMENT,
entity_content_data LONGBLOB,
entity_id VARCHAR(127) NOT NULL,
PRIMARY KEY (entity_content_id),
FOREIGN KEY (entity_id) REFERENCES base_entity(entity_id)
) ENGINE=INNODB;
DROP TABLE IF EXISTS metadata_type;
CREATE TABLE metadata_type (
metadata_id VARCHAR(127) NOT NULL,
metadata_schema VARCHAR(256) NOT NULL,
metadata_element VARCHAR(256) NOT NULL,
PRIMARY KEY (metadata_id)
) ENGINE=INNODB;
DROP TABLE IF EXISTS metadata_reference;
CREATE TABLE metadata_reference (
metadata_ref_id BIGINT NOT NULL AUTO_INCREMENT,
subject_entity_id VARCHAR(127) NOT NULL,
metadata_id VARCHAR(127) NOT NULL,
object_entity_id VARCHAR(127) NOT NULL,
PRIMARY KEY (metadata_ref_id),
FOREIGN KEY (subject_entity_id) REFERENCES base_entity(entity_id),
FOREIGN KEY (metadata_id) REFERENCES metadata_type(metadata_id),
FOREIGN KEY (object_entity_id) REFERENCES base_entity(entity_id)
) ENGINE=INNODB;
DROP TABLE IF EXISTS property;
CREATE TABLE property (
property_id BIGINT NOT NULL AUTO_INCREMENT,
entity_id VARCHAR(127) NOT NULL,
metadata_id VARCHAR(127) NOT NULL,
valueStr VARCHAR(10000) NOT NULL,
PRIMARY KEY (property_id),
FOREIGN KEY (metadata_id) REFERENCES metadata_type(metadata_id),
FOREIGN KEY (entity_id) REFERENCES base_entity(entity_id)
) ENGINE=INNODB;
DROP TABLE IF EXISTS relation_type;
CREATE TABLE relation_type (
relation_type_id VARCHAR(127) NOT NULL,
relation_schema VARCHAR(256) NOT NULL,
relation_element VARCHAR(256) NOT NULL,
PRIMARY KEY (relation_type_id)
) ENGINE=INNODB;
DROP TABLE IF EXISTS aggregation;
CREATE TABLE aggregation (
parent_id VARCHAR(127) NOT NULL,
child_id VARCHAR(127) NOT NULL,
PRIMARY KEY (parent_id, child_id),
FOREIGN KEY (parent_id) REFERENCES base_entity(entity_id),
FOREIGN KEY (child_id) REFERENCES base_entity(entity_id)
) ENGINE=INNODB;
DROP TABLE IF EXISTS relation;
CREATE TABLE relation (
cause_id VARCHAR(127) NOT NULL,
relation_type_id VARCHAR(127) NOT NULL,
effect_id VARCHAR(127) NOT NULL,
PRIMARY KEY (cause_id, relation_type_id, effect_id),
FOREIGN KEY (cause_id) REFERENCES base_entity(entity_id),
FOREIGN KEY (effect_id) REFERENCES base_entity(entity_id),
FOREIGN KEY (relation_type_id) REFERENCES relation_type(relation_type_id)
) ENGINE=INNODB;
DROP TABLE IF EXISTS file;
CREATE TABLE file (
entity_id VARCHAR(127) NOT NULL,
size_bytes BIGINT,
version_num VARCHAR(127) NOT NULL,
file_name VARCHAR(127) NOT NULL,
is_obsolete INT(1),
PRIMARY KEY (entity_id),
FOREIGN KEY (entity_id) REFERENCES base_entity(entity_id)
) ENGINE=INNODB;
DROP TABLE IF EXISTS fixity;
CREATE TABLE fixity (
entity_id VARCHAR(127) NOT NULL,
type VARCHAR(127),
valueStr VARCHAR(127) NOT NULL,
PRIMARY KEY (entity_id, type),
FOREIGN KEY (entity_id) REFERENCES file(entity_id)
) ENGINE=INNODB;
DROP TABLE IF EXISTS format;
CREATE TABLE format (
format_id BIGINT NOT NULL AUTO_INCREMENT,
entity_id VARCHAR(127) NOT NULL,
type VARCHAR(127),
valueStr VARCHAR(127) NOT NULL,
PRIMARY KEY (format_id),
FOREIGN KEY (entity_id) REFERENCES file(entity_id)
) ENGINE=INNODB;
DROP TABLE IF EXISTS event_type;
CREATE TABLE event_type (
event_type_id VARCHAR(127) NOT NULL,
event_name VARCHAR(127) NOT NULL,
event_description VARCHAR(256) NOT NULL,
PRIMARY KEY (event_type_id)
) ENGINE=INNODB;
DROP TABLE IF EXISTS event;
CREATE TABLE event (
event_id VARCHAR(127) NOT NULL,
event_type_id VARCHAR(127) NOT NULL,
event_detail VARCHAR(256) NOT NULL,
PRIMARY KEY (event_id),
FOREIGN KEY (event_id) REFERENCES base_entity(entity_id),
FOREIGN KEY (event_type_id) REFERENCES event_type(event_type_id)
) ENGINE=INNODB;
DROP TABLE IF EXISTS state;
CREATE TABLE state (
state_id VARCHAR(127) NOT NULL,
state_name VARCHAR(127) NOT NULL,
state_type VARCHAR(127) NOT NULL,
PRIMARY KEY (state_id),
FOREIGN KEY (state_id) REFERENCES base_entity(entity_id)
) ENGINE=INNODB;
DROP TABLE IF EXISTS transition;
CREATE TABLE transition (
start_state_id VARCHAR(127) NOT NULL,
event_type_id VARCHAR(127) NOT NULL,
next_state_id VARCHAR(127) NOT NULL,
PRIMARY KEY (start_state_id, event_type_id, next_state_id),
FOREIGN KEY (start_state_id) REFERENCES state(state_id),
FOREIGN KEY (event_type_id) REFERENCES event_type(event_type_id),
FOREIGN KEY (next_state_id) REFERENCES state(state_id)
) ENGINE=INNODB;
DROP TABLE IF EXISTS collection;
CREATE TABLE collection (
entity_id VARCHAR(127) NOT NULL,
state_id VARCHAR(127) NOT NULL,
version_num VARCHAR(127) NOT NULL,
name VARCHAR(127) NOT NULL,
is_obsolete INT(1),
PRIMARY KEY (entity_id),
FOREIGN KEY (entity_id) REFERENCES base_entity(entity_id),
FOREIGN KEY (state_id) REFERENCES state(state_id)
) ENGINE=INNODB;
DROP TABLE IF EXISTS data_identifier_type;
CREATE TABLE data_identifier_type (
data_identifier_type_id VARCHAR(127) NOT NULL,
data_identifier_type_name VARCHAR(127) NOT NULL,
schema_uri VARCHAR(256) NOT NULL,
PRIMARY KEY (data_identifier_type_id)
) ENGINE=INNODB;
DROP TABLE IF EXISTS data_identifier;
CREATE TABLE data_identifier (
entity_id VARCHAR(127) NOT NULL,
data_identifier_type_id VARCHAR(127) NOT NULL,
data_identifier_value VARCHAR(256) NOT NULL,
PRIMARY KEY (entity_id, data_identifier_type_id),
FOREIGN KEY (entity_id) REFERENCES base_entity(entity_id),
FOREIGN KEY (data_identifier_type_id) REFERENCES data_identifier_type(data_identifier_type_id)
) ENGINE=INNODB;
DROP TABLE IF EXISTS repository;
CREATE TABLE repository (
repository_id VARCHAR(127) NOT NULL,
repository_name VARCHAR(127) NOT NULL,
software_type VARCHAR(256) NOT NULL,
affiliation VARCHAR(256) NOT NULL,
PRIMARY KEY (repository_id)
) ENGINE=INNODB;
DROP TABLE IF EXISTS data_location;
CREATE TABLE data_location (
entity_id VARCHAR(127) NOT NULL,
location_type_id VARCHAR(127) NOT NULL,
location_value VARCHAR(256) NOT NULL,
is_master_copy INT(1),
PRIMARY KEY (entity_id, location_type_id),
FOREIGN KEY (entity_id) REFERENCES base_entity(entity_id),
FOREIGN KEY (location_type_id) REFERENCES repository(repository_id)
) ENGINE=INNODB;
DROP TABLE IF EXISTS agent;
CREATE TABLE agent (
agent_id VARCHAR(127) NOT NULL,
first_name VARCHAR(256) NOT NULL,
last_name VARCHAR(256) NOT NULL,
PRIMARY KEY (agent_id),
FOREIGN KEY (agent_id) REFERENCES base_entity(entity_id)
) ENGINE=INNODB;
DROP TABLE IF EXISTS profile_type;
CREATE TABLE profile_type (
profile_type_id VARCHAR(127) NOT NULL,
profile_type_name VARCHAR(127) NOT NULL,
profile_type_schema VARCHAR(256) NOT NULL,
PRIMARY KEY (profile_type_id)
) ENGINE=INNODB;
DROP TABLE IF EXISTS agent_profile;
CREATE TABLE agent_profile (
agent_id VARCHAR(127) NOT NULL,
profile_type_id VARCHAR(127) NOT NULL,
profile_value VARCHAR(256) NOT NULL,
PRIMARY KEY (agent_id, profile_type_id),
FOREIGN KEY (agent_id) REFERENCES agent(agent_id),
FOREIGN KEY (profile_type_id) REFERENCES profile_type(profile_type_id)
) ENGINE=INNODB;
DROP TABLE IF EXISTS role_type;
CREATE TABLE role_type (
role_type_id VARCHAR(127) NOT NULL,
role_type_name VARCHAR(127) NOT NULL,
role_description VARCHAR(256) NOT NULL,
PRIMARY KEY (role_type_id)
) ENGINE=INNODB;
DROP TABLE IF EXISTS agent_role;
CREATE TABLE agent_role (
agent_id VARCHAR(127) NOT NULL,
role_type_id VARCHAR(127) NOT NULL,
PRIMARY KEY (agent_id, role_type_id),
FOREIGN KEY (agent_id) REFERENCES agent(agent_id),
FOREIGN KEY (role_type_id) REFERENCES role_type(role_type_id)
) ENGINE=INNODB;
|
-- phpMyAdmin SQL Dump
-- version 4.5.1
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: 2016 m. Bal 01 d. 17:53
-- Server version: 10.1.8-MariaDB
-- PHP Version: 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 */;
--
-- Database: `veislini_petskt`
--
-- --------------------------------------------------------
--
-- Sukurta duomenų struktūra lentelei `message`
--
CREATE TABLE `message` (
`message_id` int(10) NOT NULL,
`user_id` varchar(5) NOT NULL,
`time` date NOT NULL,
`text` varchar(1000) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Sukurta duomenų struktūra lentelei `room`
--
CREATE TABLE `room` (
`user_id` int(5) NOT NULL,
`room_id` int(1) NOT NULL,
`room_name` varchar(50) NOT NULL,
`capacity` int(2) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Sukurta duomenų struktūra lentelei `user`
--
CREATE TABLE `user` (
`user_id` int(5) NOT NULL,
`username` varchar(20) NOT NULL,
`password` varchar(200) NOT NULL,
`email` varchar(50) NOT NULL,
`first_name` varchar(20) NOT NULL,
`last_name` varchar(20) NOT NULL,
`age` int(3) NOT NULL,
`country` varchar(30) NOT NULL,
`gender` varchar(20) NOT NULL,
`visability` tinyint(4) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Sukurta duomenų kopija lentelei `user`
--
INSERT INTO `user` (`user_id`, `username`, `password`, `email`, `first_name`, `last_name`, `age`, `country`, `gender`, `visability`) VALUES
(24, 'Petras9999', 'fa246d0262c3925617b0c72bb20eeb1d', 'petras@gmail.com', 'Petras', 'Å ukutis', 21, 'Lietuva', 'Vyras', 0),
(48, 'Elvinas', '7efed9180bef6f5efd82d443691ca895', 'elvinas21@gmail.com', 'Elvinas', 'KaÄerauskas', 21, 'Lietuva', 'Vyras', 0),
(81, 'Jonas9999', 'fa246d0262c3925617b0c72bb20eeb1d', 'Jonass@gmail.com', 'Jonas', 'Jonaitis', 40, 'Anglija', 'Vyras', 0);
-- --------------------------------------------------------
--
-- Sukurta duomenų struktūra lentelei `user_room`
--
CREATE TABLE `user_room` (
`user_id` int(5) NOT NULL,
`room_id` int(3) NOT NULL,
`room_name` varchar(50) DEFAULT NULL,
`capacity` int(2) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Indexes for dumped tables
--
--
-- Indexes for table `message`
--
ALTER TABLE `message`
ADD PRIMARY KEY (`message_id`);
--
-- Indexes for table `room`
--
ALTER TABLE `room`
ADD PRIMARY KEY (`room_id`),
ADD UNIQUE KEY `room_id` (`room_id`);
--
-- Indexes for table `user`
--
ALTER TABLE `user`
ADD PRIMARY KEY (`user_id`),
ADD UNIQUE KEY `username` (`username`),
ADD UNIQUE KEY `email` (`email`),
ADD UNIQUE KEY `user_id` (`user_id`);
--
-- Indexes for table `user_room`
--
ALTER TABLE `user_room`
ADD PRIMARY KEY (`room_id`),
ADD UNIQUE KEY `room_id` (`room_id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `message`
--
ALTER TABLE `message`
MODIFY `message_id` int(10) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `user`
--
ALTER TABLE `user`
MODIFY `user_id` int(5) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=82;
--
-- AUTO_INCREMENT for table `user_room`
--
ALTER TABLE `user_room`
MODIFY `room_id` int(3) NOT NULL AUTO_INCREMENT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
SET FOREIGN_KEY_CHECKS=0;
TRUNCATE TABLE `users`;
TRUNCATE TABLE `items`;
insert into `users` (`id`, `name`, `email`, `salt`, `salted`, `icon_image`, `created_at`, `updated_at`, `deleted_at`)
values
(null, 'user1', 'user1@example.com', 'hoge', 'qvl6hWDUqIhwpg1W0QgVh7ClzykqMoXF5Djd525Ssf8=', '', '2017-08-30 17:55:16', '2017-08-30 17:55:16', null),
(null, 'user2', 'user2@example.com', 'hoge', 'qvl6hWDUqIhwpg1W0QgVh7ClzykqMoXF5Djd525Ssf8=', '', '2017-08-30 17:55:16', '2017-08-30 17:55:16', null),
(null, 'user3', 'user3@example.com', 'hoge', 'qvl6hWDUqIhwpg1W0QgVh7ClzykqMoXF5Djd525Ssf8=', '', '2017-08-30 17:55:16', '2017-08-30 17:55:16', null),
(null, 'user4', 'user4@example.com', 'hoge', 'qvl6hWDUqIhwpg1W0QgVh7ClzykqMoXF5Djd525Ssf8=', '', '2017-08-30 17:55:16', '2017-08-30 17:55:16', null),
(null, 'user5', 'user5@example.com', 'hoge', 'qvl6hWDUqIhwpg1W0QgVh7ClzykqMoXF5Djd525Ssf8=', '', '2017-08-30 17:55:16', '2017-08-30 17:55:16', null),
(null, 'user6', 'user6@example.com', 'hoge', 'qvl6hWDUqIhwpg1W0QgVh7ClzykqMoXF5Djd525Ssf8=', '', '2017-08-30 17:55:16', '2017-08-30 17:55:16', null),
(null, 'user7', 'user7@example.com', 'hoge', 'qvl6hWDUqIhwpg1W0QgVh7ClzykqMoXF5Djd525Ssf8=', '', '2017-08-30 17:55:16', '2017-08-30 17:55:16', null),
(null, 'user8', 'user8@example.com', 'hoge', 'qvl6hWDUqIhwpg1W0QgVh7ClzykqMoXF5Djd525Ssf8=', '', '2017-08-30 17:55:16', '2017-08-30 17:55:16', null);
insert into `items` (`id`, `user_id`, `name`, `price`, `current_payment_price`, `icon_image`, `description`, `created_at`, `updated_at`, `deleted_at`)
values
(null, 1, 'item1', 100, 10, 'icon1', 'C', '2017-08-30 17:55:16', '2017-08-30 17:55:16', null),
(null, 1, 'item2', 2000, 200, 'icon2', 'C#', '2017-08-30 17:55:16', '2017-08-30 17:55:16', null),
(null, 1, 'item3', 30000, 3000, 'icon3', 'object-C', '2017-08-30 17:55:16', '2017-08-30 17:55:16', null),
(null, 2, 'item4', 5000, 4000, 'icon4', 'Java', '2017-08-30 17:55:16', '2017-08-30 17:55:16', null),
(null, 2, 'item5', 50000, 5000, 'icon5', 'Javascript', '2017-08-30 17:55:16', '2017-08-30 17:55:16', null),
(null, 3, 'item6', 500000, 5000, 'icon6', 'React', '2017-08-30 17:55:16', '2017-08-30 17:55:16', null),
(null, 3, 'item7', 1000000, 70000, 'icon7', 'Redux', '2017-08-30 17:55:16', '2017-08-30 17:55:16', null),
(null, 3, 'item8', 10000000, 50000, 'icon8', 'Flux', '2017-08-30 17:55:16', '2017-08-30 17:55:16', null);
|
-- phpMyAdmin SQL Dump
-- version 5.0.2
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Jul 17, 2020 at 04:34 PM
-- Server version: 10.4.11-MariaDB
-- PHP Version: 7.4.6
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: `finder`
--
CREATE DATABASE IF NOT EXISTS `finder` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;
USE `finder`;
-- --------------------------------------------------------
--
-- Table structure for table `proposals`
--
CREATE TABLE `proposals` (
`proposal_id` int(11) NOT NULL,
`romeo_id` int(11) NOT NULL,
`juliet_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `proposals`
--
INSERT INTO `proposals` (`proposal_id`, `romeo_id`, `juliet_id`) VALUES
(1, 1, 2),
(2, 1, 4),
(3, 1, 3),
(4, 5, 1),
(5, 2, 1),
(6, 2, 5),
(7, 5, 2);
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
CREATE TABLE `users` (
`user_id` int(11) NOT NULL,
`name` varchar(255) NOT NULL,
`email` varchar(255) NOT NULL,
`password` varchar(255) NOT NULL,
`bio` text NOT NULL,
`age` int(11) NOT NULL,
`gender` varchar(255) NOT NULL,
`city` varchar(255) NOT NULL,
`dp` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `users`
--
INSERT INTO `users` (`user_id`, `name`, `email`, `password`, `bio`, `age`, `gender`, `city`, `dp`) VALUES
(1, 'Virat Kohli', 'virat@gmail.com', '12345', 'Something', 31, 'Male', 'Delhi', 'virat.jpg.jpg'),
(2, 'Anushka Sharma', 'anushka@gmail.com', '00000', 'Something', 31, 'Female', 'Mumbai', 'anushka.jpg.jpg'),
(3, 'Rohit Sharma', 'rohit@gmail.com', '112233', '', 0, '', '', 'rohit.jpg.jpg'),
(4, 'Deepika Padukone', 'deepika@gmail.com', '111111', '', 0, '', '', 'deepika.jpg.jpg'),
(5, 'Ranbir Kapoor', 'ranbir@gmail.com', 'abcd', 'Kaise hai aaplog?', 35, 'Male', 'Mumbai', 'ranbir.jpg.jpg'),
(11, 'Susmita K', 'sus@gmail.com', 'sus', '', 0, '', '', 'ROSE.jpg'),
(12, 'Shikhar Dhawan', 'shikhar@gmail.com', 'shikhar', '', 0, '', '', 'shikhar.jpg');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `proposals`
--
ALTER TABLE `proposals`
ADD PRIMARY KEY (`proposal_id`);
--
-- Indexes for table `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`user_id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `proposals`
--
ALTER TABLE `proposals`
MODIFY `proposal_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;
--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
MODIFY `user_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=18;
--
-- Database: `phpmyadmin`
--
CREATE DATABASE IF NOT EXISTS `phpmyadmin` DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
USE `phpmyadmin`;
-- --------------------------------------------------------
--
-- Table structure for table `pma__bookmark`
--
CREATE TABLE `pma__bookmark` (
`id` int(10) UNSIGNED NOT NULL,
`dbase` varchar(255) COLLATE utf8_bin NOT NULL DEFAULT '',
`user` varchar(255) COLLATE utf8_bin NOT NULL DEFAULT '',
`label` varchar(255) CHARACTER SET utf8 NOT NULL DEFAULT '',
`query` text COLLATE utf8_bin NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Bookmarks';
-- --------------------------------------------------------
--
-- Table structure for table `pma__central_columns`
--
CREATE TABLE `pma__central_columns` (
`db_name` varchar(64) COLLATE utf8_bin NOT NULL,
`col_name` varchar(64) COLLATE utf8_bin NOT NULL,
`col_type` varchar(64) COLLATE utf8_bin NOT NULL,
`col_length` text COLLATE utf8_bin DEFAULT NULL,
`col_collation` varchar(64) COLLATE utf8_bin NOT NULL,
`col_isNull` tinyint(1) NOT NULL,
`col_extra` varchar(255) COLLATE utf8_bin DEFAULT '',
`col_default` text COLLATE utf8_bin DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Central list of columns';
-- --------------------------------------------------------
--
-- Table structure for table `pma__column_info`
--
CREATE TABLE `pma__column_info` (
`id` int(5) UNSIGNED NOT NULL,
`db_name` varchar(64) COLLATE utf8_bin NOT NULL DEFAULT '',
`table_name` varchar(64) COLLATE utf8_bin NOT NULL DEFAULT '',
`column_name` varchar(64) COLLATE utf8_bin NOT NULL DEFAULT '',
`comment` varchar(255) CHARACTER SET utf8 NOT NULL DEFAULT '',
`mimetype` varchar(255) CHARACTER SET utf8 NOT NULL DEFAULT '',
`transformation` varchar(255) COLLATE utf8_bin NOT NULL DEFAULT '',
`transformation_options` varchar(255) COLLATE utf8_bin NOT NULL DEFAULT '',
`input_transformation` varchar(255) COLLATE utf8_bin NOT NULL DEFAULT '',
`input_transformation_options` varchar(255) COLLATE utf8_bin NOT NULL DEFAULT ''
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Column information for phpMyAdmin';
-- --------------------------------------------------------
--
-- Table structure for table `pma__designer_settings`
--
CREATE TABLE `pma__designer_settings` (
`username` varchar(64) COLLATE utf8_bin NOT NULL,
`settings_data` text COLLATE utf8_bin NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Settings related to Designer';
-- --------------------------------------------------------
--
-- Table structure for table `pma__export_templates`
--
CREATE TABLE `pma__export_templates` (
`id` int(5) UNSIGNED NOT NULL,
`username` varchar(64) COLLATE utf8_bin NOT NULL,
`export_type` varchar(10) COLLATE utf8_bin NOT NULL,
`template_name` varchar(64) COLLATE utf8_bin NOT NULL,
`template_data` text COLLATE utf8_bin NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Saved export templates';
-- --------------------------------------------------------
--
-- Table structure for table `pma__favorite`
--
CREATE TABLE `pma__favorite` (
`username` varchar(64) COLLATE utf8_bin NOT NULL,
`tables` text COLLATE utf8_bin NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Favorite tables';
-- --------------------------------------------------------
--
-- Table structure for table `pma__history`
--
CREATE TABLE `pma__history` (
`id` bigint(20) UNSIGNED NOT NULL,
`username` varchar(64) COLLATE utf8_bin NOT NULL DEFAULT '',
`db` varchar(64) COLLATE utf8_bin NOT NULL DEFAULT '',
`table` varchar(64) COLLATE utf8_bin NOT NULL DEFAULT '',
`timevalue` timestamp NOT NULL DEFAULT current_timestamp(),
`sqlquery` text COLLATE utf8_bin NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='SQL history for phpMyAdmin';
-- --------------------------------------------------------
--
-- Table structure for table `pma__navigationhiding`
--
CREATE TABLE `pma__navigationhiding` (
`username` varchar(64) COLLATE utf8_bin NOT NULL,
`item_name` varchar(64) COLLATE utf8_bin NOT NULL,
`item_type` varchar(64) COLLATE utf8_bin NOT NULL,
`db_name` varchar(64) COLLATE utf8_bin NOT NULL,
`table_name` varchar(64) COLLATE utf8_bin NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Hidden items of navigation tree';
-- --------------------------------------------------------
--
-- Table structure for table `pma__pdf_pages`
--
CREATE TABLE `pma__pdf_pages` (
`db_name` varchar(64) COLLATE utf8_bin NOT NULL DEFAULT '',
`page_nr` int(10) UNSIGNED NOT NULL,
`page_descr` varchar(50) CHARACTER SET utf8 NOT NULL DEFAULT ''
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='PDF relation pages for phpMyAdmin';
-- --------------------------------------------------------
--
-- Table structure for table `pma__recent`
--
CREATE TABLE `pma__recent` (
`username` varchar(64) COLLATE utf8_bin NOT NULL,
`tables` text COLLATE utf8_bin NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Recently accessed tables';
--
-- Dumping data for table `pma__recent`
--
INSERT INTO `pma__recent` (`username`, `tables`) VALUES
('root', '[{\"db\":\"resume_data\",\"table\":\"user\"},{\"db\":\"finder\",\"table\":\"proposals\"},{\"db\":\"finder\",\"table\":\"users\"}]');
-- --------------------------------------------------------
--
-- Table structure for table `pma__relation`
--
CREATE TABLE `pma__relation` (
`master_db` varchar(64) COLLATE utf8_bin NOT NULL DEFAULT '',
`master_table` varchar(64) COLLATE utf8_bin NOT NULL DEFAULT '',
`master_field` varchar(64) COLLATE utf8_bin NOT NULL DEFAULT '',
`foreign_db` varchar(64) COLLATE utf8_bin NOT NULL DEFAULT '',
`foreign_table` varchar(64) COLLATE utf8_bin NOT NULL DEFAULT '',
`foreign_field` varchar(64) COLLATE utf8_bin NOT NULL DEFAULT ''
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Relation table';
-- --------------------------------------------------------
--
-- Table structure for table `pma__savedsearches`
--
CREATE TABLE `pma__savedsearches` (
`id` int(5) UNSIGNED NOT NULL,
`username` varchar(64) COLLATE utf8_bin NOT NULL DEFAULT '',
`db_name` varchar(64) COLLATE utf8_bin NOT NULL DEFAULT '',
`search_name` varchar(64) COLLATE utf8_bin NOT NULL DEFAULT '',
`search_data` text COLLATE utf8_bin NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Saved searches';
-- --------------------------------------------------------
--
-- Table structure for table `pma__table_coords`
--
CREATE TABLE `pma__table_coords` (
`db_name` varchar(64) COLLATE utf8_bin NOT NULL DEFAULT '',
`table_name` varchar(64) COLLATE utf8_bin NOT NULL DEFAULT '',
`pdf_page_number` int(11) NOT NULL DEFAULT 0,
`x` float UNSIGNED NOT NULL DEFAULT 0,
`y` float UNSIGNED NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Table coordinates for phpMyAdmin PDF output';
-- --------------------------------------------------------
--
-- Table structure for table `pma__table_info`
--
CREATE TABLE `pma__table_info` (
`db_name` varchar(64) COLLATE utf8_bin NOT NULL DEFAULT '',
`table_name` varchar(64) COLLATE utf8_bin NOT NULL DEFAULT '',
`display_field` varchar(64) COLLATE utf8_bin NOT NULL DEFAULT ''
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Table information for phpMyAdmin';
-- --------------------------------------------------------
--
-- Table structure for table `pma__table_uiprefs`
--
CREATE TABLE `pma__table_uiprefs` (
`username` varchar(64) COLLATE utf8_bin NOT NULL,
`db_name` varchar(64) COLLATE utf8_bin NOT NULL,
`table_name` varchar(64) COLLATE utf8_bin NOT NULL,
`prefs` text COLLATE utf8_bin NOT NULL,
`last_update` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Tables'' UI preferences';
--
-- Dumping data for table `pma__table_uiprefs`
--
INSERT INTO `pma__table_uiprefs` (`username`, `db_name`, `table_name`, `prefs`, `last_update`) VALUES
('root', 'resume_data', 'user', '[]', '2020-07-11 19:42:41');
-- --------------------------------------------------------
--
-- Table structure for table `pma__tracking`
--
CREATE TABLE `pma__tracking` (
`db_name` varchar(64) COLLATE utf8_bin NOT NULL,
`table_name` varchar(64) COLLATE utf8_bin NOT NULL,
`version` int(10) UNSIGNED NOT NULL,
`date_created` datetime NOT NULL,
`date_updated` datetime NOT NULL,
`schema_snapshot` text COLLATE utf8_bin NOT NULL,
`schema_sql` text COLLATE utf8_bin DEFAULT NULL,
`data_sql` longtext COLLATE utf8_bin DEFAULT NULL,
`tracking` set('UPDATE','REPLACE','INSERT','DELETE','TRUNCATE','CREATE DATABASE','ALTER DATABASE','DROP DATABASE','CREATE TABLE','ALTER TABLE','RENAME TABLE','DROP TABLE','CREATE INDEX','DROP INDEX','CREATE VIEW','ALTER VIEW','DROP VIEW') COLLATE utf8_bin DEFAULT NULL,
`tracking_active` int(1) UNSIGNED NOT NULL DEFAULT 1
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Database changes tracking for phpMyAdmin';
-- --------------------------------------------------------
--
-- Table structure for table `pma__userconfig`
--
CREATE TABLE `pma__userconfig` (
`username` varchar(64) COLLATE utf8_bin NOT NULL,
`timevalue` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`config_data` text COLLATE utf8_bin NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='User preferences storage for phpMyAdmin';
--
-- Dumping data for table `pma__userconfig`
--
INSERT INTO `pma__userconfig` (`username`, `timevalue`, `config_data`) VALUES
('root', '2020-07-17 13:17:51', '{\"Console\\/Mode\":\"collapse\",\"NavigationWidth\":190}');
-- --------------------------------------------------------
--
-- Table structure for table `pma__usergroups`
--
CREATE TABLE `pma__usergroups` (
`usergroup` varchar(64) COLLATE utf8_bin NOT NULL,
`tab` varchar(64) COLLATE utf8_bin NOT NULL,
`allowed` enum('Y','N') COLLATE utf8_bin NOT NULL DEFAULT 'N'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='User groups with configured menu items';
-- --------------------------------------------------------
--
-- Table structure for table `pma__users`
--
CREATE TABLE `pma__users` (
`username` varchar(64) COLLATE utf8_bin NOT NULL,
`usergroup` varchar(64) COLLATE utf8_bin NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Users and their assignments to user groups';
--
-- Indexes for dumped tables
--
--
-- Indexes for table `pma__bookmark`
--
ALTER TABLE `pma__bookmark`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `pma__central_columns`
--
ALTER TABLE `pma__central_columns`
ADD PRIMARY KEY (`db_name`,`col_name`);
--
-- Indexes for table `pma__column_info`
--
ALTER TABLE `pma__column_info`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `db_name` (`db_name`,`table_name`,`column_name`);
--
-- Indexes for table `pma__designer_settings`
--
ALTER TABLE `pma__designer_settings`
ADD PRIMARY KEY (`username`);
--
-- Indexes for table `pma__export_templates`
--
ALTER TABLE `pma__export_templates`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `u_user_type_template` (`username`,`export_type`,`template_name`);
--
-- Indexes for table `pma__favorite`
--
ALTER TABLE `pma__favorite`
ADD PRIMARY KEY (`username`);
--
-- Indexes for table `pma__history`
--
ALTER TABLE `pma__history`
ADD PRIMARY KEY (`id`),
ADD KEY `username` (`username`,`db`,`table`,`timevalue`);
--
-- Indexes for table `pma__navigationhiding`
--
ALTER TABLE `pma__navigationhiding`
ADD PRIMARY KEY (`username`,`item_name`,`item_type`,`db_name`,`table_name`);
--
-- Indexes for table `pma__pdf_pages`
--
ALTER TABLE `pma__pdf_pages`
ADD PRIMARY KEY (`page_nr`),
ADD KEY `db_name` (`db_name`);
--
-- Indexes for table `pma__recent`
--
ALTER TABLE `pma__recent`
ADD PRIMARY KEY (`username`);
--
-- Indexes for table `pma__relation`
--
ALTER TABLE `pma__relation`
ADD PRIMARY KEY (`master_db`,`master_table`,`master_field`),
ADD KEY `foreign_field` (`foreign_db`,`foreign_table`);
--
-- Indexes for table `pma__savedsearches`
--
ALTER TABLE `pma__savedsearches`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `u_savedsearches_username_dbname` (`username`,`db_name`,`search_name`);
--
-- Indexes for table `pma__table_coords`
--
ALTER TABLE `pma__table_coords`
ADD PRIMARY KEY (`db_name`,`table_name`,`pdf_page_number`);
--
-- Indexes for table `pma__table_info`
--
ALTER TABLE `pma__table_info`
ADD PRIMARY KEY (`db_name`,`table_name`);
--
-- Indexes for table `pma__table_uiprefs`
--
ALTER TABLE `pma__table_uiprefs`
ADD PRIMARY KEY (`username`,`db_name`,`table_name`);
--
-- Indexes for table `pma__tracking`
--
ALTER TABLE `pma__tracking`
ADD PRIMARY KEY (`db_name`,`table_name`,`version`);
--
-- Indexes for table `pma__userconfig`
--
ALTER TABLE `pma__userconfig`
ADD PRIMARY KEY (`username`);
--
-- Indexes for table `pma__usergroups`
--
ALTER TABLE `pma__usergroups`
ADD PRIMARY KEY (`usergroup`,`tab`,`allowed`);
--
-- Indexes for table `pma__users`
--
ALTER TABLE `pma__users`
ADD PRIMARY KEY (`username`,`usergroup`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `pma__bookmark`
--
ALTER TABLE `pma__bookmark`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `pma__column_info`
--
ALTER TABLE `pma__column_info`
MODIFY `id` int(5) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `pma__export_templates`
--
ALTER TABLE `pma__export_templates`
MODIFY `id` int(5) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `pma__history`
--
ALTER TABLE `pma__history`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `pma__pdf_pages`
--
ALTER TABLE `pma__pdf_pages`
MODIFY `page_nr` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `pma__savedsearches`
--
ALTER TABLE `pma__savedsearches`
MODIFY `id` int(5) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- Database: `resume_data`
--
CREATE DATABASE IF NOT EXISTS `resume_data` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;
USE `resume_data`;
-- --------------------------------------------------------
--
-- Table structure for table `user`
--
CREATE TABLE `user` (
`user_id` int(11) NOT NULL,
`login_name` varchar(255) NOT NULL,
`login_email` varchar(255) NOT NULL,
`password` varchar(255) NOT NULL,
`name` varchar(255) NOT NULL,
`email` varchar(255) NOT NULL,
`contact_no` int(11) NOT NULL,
`linked` varchar(255) NOT NULL,
`github` varchar(255) NOT NULL,
`pic` varchar(255) NOT NULL,
`course` varchar(255) NOT NULL,
`institute` varchar(255) NOT NULL,
`score` int(11) NOT NULL,
`year` int(11) NOT NULL,
`career` varchar(255) NOT NULL,
`skills` varchar(255) NOT NULL,
`projects` text NOT NULL,
`language` varchar(255) NOT NULL,
`awards` text NOT NULL,
`father` varchar(255) NOT NULL,
`mother` varchar(255) NOT NULL,
`address` text NOT NULL,
`dob` int(11) NOT NULL,
`hobby` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `user`
--
INSERT INTO `user` (`user_id`, `login_name`, `login_email`, `password`, `name`, `email`, `contact_no`, `linked`, `github`, `pic`, `course`, `institute`, `score`, `year`, `career`, `skills`, `projects`, `language`, `awards`, `father`, `mother`, `address`, `dob`, `hobby`) VALUES
(1, 'Akash ', 'akash@gmail.com', 'akash', '', '', 0, '', '', '', '', '', 0, 0, '', '', '', '', '', '', '', '', 0, ''),
(2, 'Suchi', 'suchi@gmail.com', 'suchi', '', '', 0, '', '', '', '', '', 0, 0, '', '', '', '', '', '', '', '', 0, ''),
(9, 'a', 'a', '0', 'a', 'a', 0, 'a', 'a', 'a', 'a', 'a', 0, 0, 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 0, 'a'),
(11, 'sk', 'sk', 'sk', 'sss', 'ss', 11, 'sss', 'ss', 'emo.jpg', 'ss', 'ss', 11, 11, 'ss', 'ss', 'ss', 'ss', 'ss', 'ss', 'ss', 'ss', 11, 'ss'),
(22, 'chiba', 'chiba@gmail.com', 'chiba', 'cc', 'cc', 22, 'cc', 'cc', 'cartoon.jpg', 'ccc', 'cc', 22, 22, 'cc', 'cc', 'cc', '', '', 'cc', 'cc', 'cc', 22, 'cc');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `user`
--
ALTER TABLE `user`
ADD PRIMARY KEY (`user_id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `user`
--
ALTER TABLE `user`
MODIFY `user_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=23;
--
-- Database: `test`
--
CREATE DATABASE IF NOT EXISTS `test` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;
USE `test`;
--
-- Database: `users`
--
CREATE DATABASE IF NOT EXISTS `users` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;
USE `users`;
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 */;
|
CHECKPOINT;
DBCC FREEPROCCACHE;
DBCC DROPCLEANBUFFERS; |
ALTER TABLE JOURNALPOST
ADD COLUMN OPPRETTET_TID TIMESTAMP(3) DEFAULT localtimestamp,
ADD COLUMN OPPRETTET_AV VARCHAR DEFAULT 'VL' NOT NULL;
UPDATE JOURNALPOST
SET OPPRETTET_TID = '2020-06-24 00:00:00-00';
ALTER TABLE JOURNALPOST
ALTER COLUMN OPPRETTET_TID SET NOT NULL;
ALTER TABLE behandling
DROP COLUMN journalpost_id;
|
INSERT INTO `Genres`(`Genres`)VALUES('Horreur');
INSERT INTO `Genres`(`Genres`)VALUES('Science Fiction');
INSERT INTO `Genres`(`Genres`)VALUES('Roman');
INSERT INTO `Genres`(`Genres`)VALUES('Jeunesse'); |
-- phpMyAdmin SQL Dump
-- version 5.0.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Waktu pembuatan: 05 Agu 2020 pada 02.18
-- Versi server: 10.4.11-MariaDB
-- Versi PHP: 7.2.27
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: `toko_online`
--
-- --------------------------------------------------------
--
-- Struktur dari tabel `tb_barang`
--
CREATE TABLE `tb_barang` (
`id_brg` int(11) NOT NULL,
`nama_brg` varchar(120) NOT NULL,
`keterangan` varchar(225) NOT NULL,
`kategori` varchar(60) NOT NULL,
`harga` int(11) NOT NULL,
`stok` int(4) NOT NULL,
`gambar` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data untuk tabel `tb_barang`
--
INSERT INTO `tb_barang` (`id_brg`, `nama_brg`, `keterangan`, `kategori`, `harga`, `stok`, `gambar`) VALUES
(1, 'Sepatu ', 'Sepatu Merek All Star', 'Pakaian Pria', 400000, 20, 'sepatu.jpg'),
(2, 'kamera', 'kamera canon e95 7005', 'elektronik', 5900000, 20, 'kamera.jpg'),
(3, 'Samsung Galaksi A20', 'Samsung Galaksi A20', 'elektronik', 3400000, 20, 'hp.jpg'),
(4, 'laptop ACER', 'laptop ASUS ram 2 gb', 'elektronik', 5000000, 4, 'laptop.jpg'),
(12, 'kacamata', 'kacamata baca', 'Pakaian Pria', 1000000, 56, 'kacamata.jpg'),
(13, 'sepatu-1', 'sepatu fesion', 'Pakaian Wanita', 1000000, 66, 'sepatu-1.jpg'),
(16, 'celana ', 'celana jins lembut', 'Pakaian Pria', 200000, 15, 'jeans.jpg'),
(20, 'Gelang', 'Gelang Stenlis', 'Pakaian wanita', 1000000, 11, 'gelang-stenlis1.jpg'),
(24, 'camera', 'camera nikon G123', 'elektronik', 4000000, 43, 'camera1.jpg');
-- --------------------------------------------------------
--
-- Struktur dari tabel `tb_invoice`
--
CREATE TABLE `tb_invoice` (
`id` int(11) NOT NULL,
`nama` varchar(56) NOT NULL,
`alamat` varchar(225) NOT NULL,
`tgl_pesan` datetime NOT NULL,
`batas_bayar` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data untuk tabel `tb_invoice`
--
INSERT INTO `tb_invoice` (`id`, `nama`, `alamat`, `tgl_pesan`, `batas_bayar`) VALUES
(2, 'Jefri febrianto', 'jl.krakatau', '2020-07-14 13:06:46', '2020-07-15 13:06:46'),
(3, 'desak gede sharasshita', 'jl.jombang', '2020-07-14 13:11:15', '2020-07-15 13:11:15'),
(4, 'audia sarasshita', 'jl.mbunder', '2020-07-15 06:54:54', '2020-07-16 06:54:54'),
(5, 'Bintang', 'malang', '2020-07-15 14:11:23', '2020-07-16 14:11:23'),
(6, 'jiso', 'malang', '2020-07-15 14:12:52', '2020-07-16 14:12:52'),
(7, 'monika', 'padang', '2020-07-16 14:39:03', '2020-07-17 14:39:03'),
(13, 'ilham sandi', 'jl.kenanga', '2020-07-16 15:43:09', '2020-07-17 15:43:09'),
(14, 'ilham sandi', 'jl.kenanga', '2020-07-16 15:49:00', '2020-07-17 15:49:00'),
(15, 'ilham sandi', 'jl.kenanga', '2020-07-16 15:49:09', '2020-07-17 15:49:09'),
(16, '', '', '2020-07-16 15:53:42', '2020-07-17 15:53:42'),
(17, '', '', '2020-07-16 15:54:25', '2020-07-17 15:54:25'),
(18, '', '', '2020-07-17 07:51:32', '2020-07-18 07:51:32'),
(19, '', '', '2020-07-17 08:06:41', '2020-07-18 08:06:41'),
(20, '', '', '2020-07-17 08:11:40', '2020-07-18 08:11:40'),
(21, '', '', '2020-07-17 08:21:22', '2020-07-18 08:21:22'),
(22, '', '', '2020-07-17 08:22:01', '2020-07-18 08:22:01'),
(23, '', '', '2020-07-17 08:25:12', '2020-07-18 08:25:12'),
(24, 'doni', 'jl.mbunder', '2020-07-17 08:28:55', '2020-07-18 08:28:55'),
(25, 'doni', 'jl.mbunder', '2020-07-17 08:29:45', '2020-07-18 08:29:45'),
(26, 'diva', 'padang', '2020-07-17 08:30:37', '2020-07-18 08:30:37');
-- --------------------------------------------------------
--
-- Struktur dari tabel `tb_pesanan`
--
CREATE TABLE `tb_pesanan` (
`id` int(11) NOT NULL,
`id_invoice` int(11) NOT NULL,
`id_brg` int(11) NOT NULL,
`nama_brg` varchar(50) NOT NULL,
`jumlah` int(3) NOT NULL,
`harga` int(10) NOT NULL,
`pilihan` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data untuk tabel `tb_pesanan`
--
INSERT INTO `tb_pesanan` (`id`, `id_invoice`, `id_brg`, `nama_brg`, `jumlah`, `harga`, `pilihan`) VALUES
(1, 2, 1, 'Sepatu ', 2, 400000, ''),
(2, 2, 16, 'celana ', 1, 200000, ''),
(3, 3, 1, 'Sepatu ', 1, 400000, ''),
(4, 3, 2, 'kamera', 1, 590000, ''),
(5, 3, 3, 'Samsung Galaksi A20', 1, 3400000, ''),
(6, 3, 4, 'laptop ACER', 1, 5000000, ''),
(7, 4, 2, 'kamera', 1, 5900000, ''),
(8, 5, 2, 'kamera', 1, 5900000, ''),
(9, 6, 1, 'Sepatu ', 5, 400000, ''),
(10, 7, 24, 'camera', 1, 4000000, ''),
(11, 8, 3, 'Samsung Galaksi A20', 1, 3400000, ''),
(12, 8, 4, 'laptop ACER', 1, 5000000, ''),
(13, 8, 1, 'Sepatu ', 1, 400000, ''),
(14, 8, 20, 'Gelang', 1, 1000000, ''),
(15, 9, 20, 'Gelang', 1, 1000000, ''),
(16, 10, 2, 'kamera', 1, 5900000, ''),
(17, 11, 2, 'kamera', 1, 5900000, ''),
(18, 12, 2, 'kamera', 1, 5900000, ''),
(19, 13, 13, 'sepatu-1', 1, 1000000, ''),
(20, 16, 24, 'camera', 1, 4000000, ''),
(21, 16, 2, 'kamera', 1, 5900000, ''),
(22, 17, 2, 'kamera', 1, 5900000, ''),
(23, 18, 1, 'Sepatu ', 1, 400000, ''),
(24, 19, 2, 'kamera', 1, 5900000, ''),
(25, 20, 2, 'kamera', 1, 5900000, ''),
(26, 21, 1, 'Sepatu ', 1, 400000, ''),
(27, 22, 2, 'kamera', 1, 5900000, ''),
(28, 23, 2, 'kamera', 1, 5900000, ''),
(29, 24, 2, 'kamera', 1, 5900000, ''),
(30, 24, 1, 'Sepatu ', 1, 400000, ''),
(31, 26, 3, 'Samsung Galaksi A20', 2, 3400000, '');
--
-- Trigger `tb_pesanan`
--
DELIMITER $$
CREATE TRIGGER `pesanan_penjualan` AFTER INSERT ON `tb_pesanan` FOR EACH ROW BEGIN
UPDATE tb_barang SET stok = stok-NEW.jumlah
WHERE id_brg = NEW.id_brg;
END
$$
DELIMITER ;
-- --------------------------------------------------------
--
-- Struktur dari tabel `tb_user`
--
CREATE TABLE `tb_user` (
`id` int(11) NOT NULL,
`nama` varchar(50) NOT NULL,
`username` varchar(50) NOT NULL,
`password` varchar(50) NOT NULL,
`role_id` tinyint(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data untuk tabel `tb_user`
--
INSERT INTO `tb_user` (`id`, `nama`, `username`, `password`, `role_id`) VALUES
(1, 'admin', 'admin', '1234', 1),
(2, 'user', 'user', '1234', 2),
(3, 'user', 'user', '1234', 2),
(4, 'doni', 'inod', '12345', 2);
--
-- Indexes for dumped tables
--
--
-- Indeks untuk tabel `tb_barang`
--
ALTER TABLE `tb_barang`
ADD PRIMARY KEY (`id_brg`);
--
-- Indeks untuk tabel `tb_invoice`
--
ALTER TABLE `tb_invoice`
ADD PRIMARY KEY (`id`);
--
-- Indeks untuk tabel `tb_pesanan`
--
ALTER TABLE `tb_pesanan`
ADD PRIMARY KEY (`id`);
--
-- Indeks untuk tabel `tb_user`
--
ALTER TABLE `tb_user`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT untuk tabel yang dibuang
--
--
-- AUTO_INCREMENT untuk tabel `tb_barang`
--
ALTER TABLE `tb_barang`
MODIFY `id_brg` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=25;
--
-- AUTO_INCREMENT untuk tabel `tb_invoice`
--
ALTER TABLE `tb_invoice`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=27;
--
-- AUTO_INCREMENT untuk tabel `tb_pesanan`
--
ALTER TABLE `tb_pesanan`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=32;
--
-- AUTO_INCREMENT untuk tabel `tb_user`
--
ALTER TABLE `tb_user`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
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
abs( - 0.8 );
SELECT
RAND( ) -- 字符串内置函数
SELECT
CHAR_LENGTH( "全栈" );
SELECT
length( "全栈" );
-- 日期和时间
SELECT
CURDATE( );
SELECT MONTH
( "20190422" );
-- 条件判断函数
-- if
SELECT
IF
( sal > 2000, 'high', 'low' )
FROM
emp;
-- case
SELECT
CASE
WHEN
sal <= 2000 THEN
'low' ELSE 'high'
END
FROM
emp;
-- 系统信息
select version();
-- md5
select MD5("themoonstone") |
create table t_usuarios (id_usuario int auto_increment,
nombre varchar(255),
apellidoP varchar(255).
email varchar(255),
usuario varchar(255),
password varchar(255),
primary key(id_usuario)
); |
-- 12 lines 4 code 5 comments 3 blanks
SELECT * FROM Users
WHERE FirstName is not null; -- select rows where the user has a first name
/* this is the beginning of a block comment
insert a new user into the Users table
-- line comment in a block comment
*/
INSERT INTO Users (FirstName, LastName)
VALUES ("John", "Does"); |
create or replace view V_JG_YKJH as (
select a.*, b.jsde107
from jh001 a, zb010 b
where a.de011 = b.de011
and b.jsde117 = 'JH001'
and a.jsde201 = b.jsde115
and a.jsde940 >= '88'
)
|
/*
Navicat MySQL Data Transfer
Source Server : laravel
Source Server Version : 50625
Source Host : localhost:3306
Source Database : asset_db
Target Server Type : MYSQL
Target Server Version : 50625
File Encoding : 65001
Date: 2020-12-11 18:31:35
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for `hms_house_details`
-- ----------------------------
DROP TABLE IF EXISTS `hms_house_details`;
CREATE TABLE `hms_house_details` (
`id` int(4) NOT NULL AUTO_INCREMENT,
`userId` varchar(10) NOT NULL,
`houseId` varchar(10) DEFAULT NULL,
`belongsTo` varchar(30) DEFAULT NULL,
`purchaseDate` date NOT NULL,
`purchaseAmount` varchar(30) NOT NULL,
`pincode` varchar(10) NOT NULL,
`address` varchar(50) NOT NULL,
`buildingName` varchar(50) DEFAULT NULL,
`houseNo` varchar(10) DEFAULT NULL,
`houseName` varchar(100) DEFAULT NULL,
`image1` varchar(30) DEFAULT NULL,
`houseSize` varchar(30) DEFAULT NULL,
`houseType` varchar(30) DEFAULT NULL,
`balaconySize` varchar(30) DEFAULT NULL,
`houseBuildOn` varchar(12) DEFAULT NULL,
`maintFees` varchar(20) DEFAULT NULL,
`currentValue` varchar(30) DEFAULT NULL,
`tax` varchar(20) DEFAULT NULL,
`bankId` int(3) DEFAULT NULL,
`loanFlg` int(3) NOT NULL DEFAULT '0',
`soldFlg` int(5) NOT NULL DEFAULT '0',
`soldDate` varchar(15) DEFAULT NULL,
`soldAmount` varchar(30) DEFAULT NULL,
`memoContent` text,
`createdBy` varchar(30) NOT NULL,
`createdDateTime` datetime NOT NULL,
`updatedBy` varchar(30) DEFAULT NULL,
`updatedDateTime` datetime DEFAULT NULL,
`delFlg` int(3) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of hms_house_details
-- ----------------------------
|
drop table if exists users;
create table users(
name varchar(255),
email varchar(255)
);
insert into users(name, email) values('taguchi', 'taguchi@gmail.com');
|
create or replace view v_td_jkhb_info as
select a.id,
b.srmxid,
c.hbmxid,
a.yy,
a.dkmc,
a.dkbh,
a.dkjg,
a.dkdm,
a.xzqh as xmdm,
b.jkkm,
b.jkje,
c.jkkm hbjkkm,
c.hbje,
c.hbsj,
c.yhdm as skyh,
a.bz,
c.shbz,
c.gdbz
from dkjbxx a, dkjkb b, dkjkb_hb c
where a.id = b.id
and b.id = c.id
and b.srmxid = c.srmxid;
|
DELIMITER $$
CREATE PROCEDURE CountCustomerByType(IN Ctype INT, OUT total INT)
BEGIN
SELECT count(Customer_No)
INTO total
FROM CustomerDT
WHERE Ctype_No=Ctype;
END $$
DELIMITER ; |
create database bamazon;
use bamazon;
CREATE TABLE IF NOT EXISTS departments (
DepartmentID int(11) NOT NULL AUTO_INCREMENT,
DepartmentName varchar(100) NOT NULL,
OverHeadCosts int(11) DEFAULT NULL,
TotalSales decimal(10,2) DEFAULT 0.00,
PRIMARY KEY (DepartmentID));
INSERT INTO `departments` (`DepartmentID`, `DepartmentName`, `OverHeadCosts`, `TotalSales`) VALUES
(1, 'Music', 100, 1126.50),
(2, 'Tools', 100, 332.03),
(3, 'Clothes', 30, 1853.87),
(4, 'Home', 400, 66.66),
(5, 'Tech', 170, 250.00);
CREATE TABLE IF NOT EXISTS products (
itemID int(11) NOT NULL AUTO_INCREMENT,
ProductName varchar(100) NOT NULL,
DepartmentName varchar(100) DEFAULT NULL,
Price decimal(10,2) DEFAULT NULL,
StockQuantity int(100) DEFAULT NULL,
PRIMARY KEY (itemID));
INSERT INTO `products` (`ProductName`, `DepartmentName`, `Price`, `StockQuantity`) VALUES
('Drum', 'Music', 99.98, 5),
('Guitar', 'Music', 234.00, 3),
('Pliers', 'Tools', 19.99, 7),
('Shoes', 'Clothes', 39.99, 9),
('Fancy Pants', 'Clothes', 79.99, 2),
('Hammer', 'Tools', 2.99, 9999),
('AirPods', 'Tech', 211.99, 30);
|
/* Following DDL SQL commands will help you to create a physical database
for managing the employee's data on a DBMS supporting posgres. */
/* Creating Education table (primary key - education id) */
CREATE table Education(
edu_id SERIAL primary key,
edu_level varchar(50)
);
/* Creating Employee table (primary key - employee id) */
CREATE table Employee(
emp_id varchar(10) primary key,
emp_nm varchar(50),
email varchar(50),
hire_dt date,
edu_id int references Education(edu_id)
);
/* Creating Job table (primary key - job id) */
CREATE table Job(
job_id serial primary key,
job_title varchar(50)
);
/* Creating Department table (primary key - department id) */
CREATE table Department(
depart_id serial primary key,
depart_nm varchar(50)
);
/* Creating Location table (primary key - location id id) */
CREATE table Location(
loc_id serial primary key,
loc_nm varchar(50)
);
/* Creating State table (primary key - state id) */
CREATE table State(
state_id serial primary key,
state_nm varchar(50),
loc_id int references Location(loc_id)
);
/* Creating City table (primary key - city id) */
CREATE table City(
city_id serial primary key,
city_nm varchar(50),
state_id int references State(state_id)
);
/* Creating Address table (primary key - address id) */
CREATE table Address(
addr_id serial primary key,
addr_nm varchar(50),
city_id int references City(city_id)
);
/* Creating Salary table so as to provide
flexibility in provisioning security (primary key - salary id) */
CREATE table Salary(
salary_id serial primary key,
amount int
);
/* Creating EmployeeStatus table as there is
many to many relationship across emp_id and
job_id. So this table acts as pivot point */
CREATE table EmployeeStatus(
emp_id varchar(10) references Employee(emp_id),
job_id int references Job(job_id),
depart_id int references Department(depart_id),
manager_id varchar(10) references Employee(emp_id),
start_dt date,
end_dt date,
addr_id int references Address(addr_id),
salary_id int references Salary(salary_id)
);
/* Creating primary key in EmployeeStatus table (primary key - [employee id, job id]) */
ALTER table EmployeeStatus
ADD CONSTRAINT employeestatus_pk
primary key (emp_id, job_id);
|
-- start with employee
create table employee (
id BIGINT not null,
thFirstName nvarchar(100),
thLastName nvarchar(100),
enFirstName nvarchar(100),
enLastName nvarchar(100),
PRIMARY KEY (id)
); |
insert into region (id,code,local_code,region_name,continent,iso_country) values (1,'AD-02','02','Canillo','EU','AD');
insert into region (id,code,local_code,region_name,continent,iso_country) values (2,'AD-03','03','Encamp','EU','AD');
insert into region (id,code,local_code,region_name,continent,iso_country) values (3,'AD-04','04','La Massana','EU','AD');
insert into region (id,code,local_code,region_name,continent,iso_country) values (4,'AD-05','05','Ordino','EU','AD');
insert into region (id,code,local_code,region_name,continent,iso_country) values (5,'AD-06','06','Sant Julià de Lòria','EU','AD');
insert into region (id,code,local_code,region_name,continent,iso_country) values (6,'AD-07','07','Andorra la Vella','EU','AD');
insert into region (id,code,local_code,region_name,continent,iso_country) values (7,'AD-08','08','Escaldes-Engordany','EU','AD');
insert into region (id,code,local_code,region_name,continent,iso_country) values (8,'AD-U-A','U-A','(unassigned)','EU','AD');
insert into region (id,code,local_code,region_name,continent,iso_country) values (9,'AE-AJ','AJ','Ajman Emirate','AS','AE');
insert into region (id,code,local_code,region_name,continent,iso_country) values (10,'AE-AZ','AZ','Abu Dhabi Emirate','AS','AE');
insert into region (id,code,local_code,region_name,continent,iso_country) values (11,'AE-DU','DU','Dubai Emirate','AS','AE');
insert into region (id,code,local_code,region_name,continent,iso_country) values (12,'AE-FU','FU','Fujairah Emirate','AS','AE');
insert into region (id,code,local_code,region_name,continent,iso_country) values (13,'AE-RK','RK','Ras al-Khaimah Emirate','AS','AE');
insert into region (id,code,local_code,region_name,continent,iso_country) values (14,'AE-SH','SH','Sharjah Emirate','AS','AE');
insert into region (id,code,local_code,region_name,continent,iso_country) values (15,'AE-U-A','U-A','(unassigned)','AS','AE');
insert into region (id,code,local_code,region_name,continent,iso_country) values (16,'AE-UQ','UQ','Umm al-Quwain Emirate','AS','AE');
insert into region (id,code,local_code,region_name,continent,iso_country) values (17,'AF-BAL','BAL','Balkh Province','AS','AF');
insert into region (id,code,local_code,region_name,continent,iso_country) values (18,'AF-BAM','BAM','Bamiyan Province','AS','AF');
insert into region (id,code,local_code,region_name,continent,iso_country) values (19,'AF-BDG','BDG','Badghis Province','AS','AF');
insert into region (id,code,local_code,region_name,continent,iso_country) values (20,'AF-BDS','BDS','Badakhshan Province','AS','AF');
insert into region (id,code,local_code,region_name,continent,iso_country) values (21,'AF-BGL','BGL','Baghlan Province','AS','AF');
insert into region (id,code,local_code,region_name,continent,iso_country) values (4898,'AF-DAY','DAY','Daykundi Province','AS','AF');
insert into region (id,code,local_code,region_name,continent,iso_country) values (22,'AF-FRA','FRA','Farah Province','AS','AF');
insert into region (id,code,local_code,region_name,continent,iso_country) values (23,'AF-FYB','FYB','Faryab Province','AS','AF');
insert into region (id,code,local_code,region_name,continent,iso_country) values (24,'AF-GHA','GHA','Ghazni Province','AS','AF');
insert into region (id,code,local_code,region_name,continent,iso_country) values (25,'AF-GHO','GHO','Ghōr Province','AS','AF');
insert into region (id,code,local_code,region_name,continent,iso_country) values (26,'AF-HEL','HEL','Helmand Province','AS','AF');
insert into region (id,code,local_code,region_name,continent,iso_country) values (27,'AF-HER','HER','Herat Province','AS','AF');
insert into region (id,code,local_code,region_name,continent,iso_country) values (28,'AF-JOW','JOW','Jowzjan Province','AS','AF');
insert into region (id,code,local_code,region_name,continent,iso_country) values (29,'AF-KAB','KAB','Kabul Province','AS','AF');
insert into region (id,code,local_code,region_name,continent,iso_country) values (30,'AF-KAN','KAN','Kandahar Province','AS','AF');
insert into region (id,code,local_code,region_name,continent,iso_country) values (31,'AF-KAP','KAP','Kapisa Province','AS','AF');
insert into region (id,code,local_code,region_name,continent,iso_country) values (32,'AF-KDZ','KDZ','Kunduz Province','AS','AF');
insert into region (id,code,local_code,region_name,continent,iso_country) values (33,'AF-KHO','KHO','Khost Province','AS','AF');
insert into region (id,code,local_code,region_name,continent,iso_country) values (34,'AF-KNR','KNR','Kunar Province','AS','AF');
insert into region (id,code,local_code,region_name,continent,iso_country) values (35,'AF-LAG','LAG','Laghman Province','AS','AF');
insert into region (id,code,local_code,region_name,continent,iso_country) values (36,'AF-LOW','LOW','Logar Province','AS','AF');
insert into region (id,code,local_code,region_name,continent,iso_country) values (37,'AF-NAN','NAN','Nangarhar Province','AS','AF');
insert into region (id,code,local_code,region_name,continent,iso_country) values (38,'AF-NIM','NIM','Nimruz Province','AS','AF');
insert into region (id,code,local_code,region_name,continent,iso_country) values (39,'AF-NUR','NUR','Nurestan Province','AS','AF');
insert into region (id,code,local_code,region_name,continent,iso_country) values (40,'AF-ORU','ORU','Orūzgān Province','AS','AF');
insert into region (id,code,local_code,region_name,continent,iso_country) values (4899,'AF-PAN','PAN','Panjshir Province','AS','AF');
insert into region (id,code,local_code,region_name,continent,iso_country) values (41,'AF-PAR','PAR','Parwan Province','AS','AF');
insert into region (id,code,local_code,region_name,continent,iso_country) values (42,'AF-PIA','PIA','Paktia Province','AS','AF');
insert into region (id,code,local_code,region_name,continent,iso_country) values (43,'AF-PKA','PKA','Paktika Province','AS','AF');
insert into region (id,code,local_code,region_name,continent,iso_country) values (44,'AF-SAM','SAM','Samangan Province','AS','AF');
insert into region (id,code,local_code,region_name,continent,iso_country) values (45,'AF-SAR','SAR','Sar-e Pol Province','AS','AF');
insert into region (id,code,local_code,region_name,continent,iso_country) values (46,'AF-TAK','TAK','Takhar Province','AS','AF');
insert into region (id,code,local_code,region_name,continent,iso_country) values (47,'AF-U-A','U-A','(unassigned)','AS','AF');
insert into region (id,code,local_code,region_name,continent,iso_country) values (48,'AF-WAR','WAR','Wardak Province','AS','AF');
insert into region (id,code,local_code,region_name,continent,iso_country) values (49,'AF-ZAB','ZAB','Zabul Province','AS','AF');
insert into region (id,code,local_code,region_name,continent,iso_country) values (4769,'AG-03','03','Saint George','NA','AG');
insert into region (id,code,local_code,region_name,continent,iso_country) values (4770,'AG-04','04','Saint John','NA','AG');
insert into region (id,code,local_code,region_name,continent,iso_country) values (4771,'AG-05','05','Saint Mary','NA','AG');
insert into region (id,code,local_code,region_name,continent,iso_country) values (4772,'AG-06','06','Saint Paul','NA','AG');
insert into region (id,code,local_code,region_name,continent,iso_country) values (4773,'AG-07','07','Saint Peter','NA','AG');
insert into region (id,code,local_code,region_name,continent,iso_country) values (4774,'AG-08','08','Saint Philip','NA','AG');
insert into region (id,code,local_code,region_name,continent,iso_country) values (4775,'AG-10','09','Barbuda','NA','AG');
insert into region (id,code,local_code,region_name,continent,iso_country) values (3870,'US-AK','AK','Alaska','NA','US');
insert into region (id,code,local_code,region_name,continent,iso_country) values (3871,'US-AL','AL','Alabama','NA','US');
insert into region (id,code,local_code,region_name,continent,iso_country) values (3873,'US-AR','AR','Arkansas','NA','US');
insert into region (id,code,local_code,region_name,continent,iso_country) values (3875,'US-AZ','AZ','Arizona','NA','US');
insert into region (id,code,local_code,region_name,continent,iso_country) values (3876,'US-CA','CA','California','NA','US');
insert into region (id,code,local_code,region_name,continent,iso_country) values (3877,'US-CO','CO','Colorado','NA','US');
insert into region (id,code,local_code,region_name,continent,iso_country) values (3878,'US-CT','CT','Connecticut','NA','US');
insert into region (id,code,local_code,region_name,continent,iso_country) values (3879,'US-DC','DC','District of Columbia','NA','US');
insert into region (id,code,local_code,region_name,continent,iso_country) values (3880,'US-DE','DE','Delaware','NA','US');
insert into region (id,code,local_code,region_name,continent,iso_country) values (3881,'US-FL','FL','Florida','NA','US');
insert into region (id,code,local_code,region_name,continent,iso_country) values (3882,'US-GA','GA','Georgia','NA','US');
insert into region (id,code,local_code,region_name,continent,iso_country) values (3884,'US-HI','HI','Hawaii','NA','US');
insert into region (id,code,local_code,region_name,continent,iso_country) values (3885,'US-IA','IA','Iowa','NA','US');
insert into region (id,code,local_code,region_name,continent,iso_country) values (3886,'US-ID','ID','Idaho','NA','US');
insert into region (id,code,local_code,region_name,continent,iso_country) values (3887,'US-IL','IL','Illinois','NA','US');
insert into region (id,code,local_code,region_name,continent,iso_country) values (3888,'US-IN','IN','Indiana','NA','US');
insert into region (id,code,local_code,region_name,continent,iso_country) values (3889,'US-KS','KS','Kansas','NA','US');
insert into region (id,code,local_code,region_name,continent,iso_country) values (3890,'US-KY','KY','Kentucky','NA','US');
insert into region (id,code,local_code,region_name,continent,iso_country) values (3891,'US-LA','LA','Louisiana','NA','US');
insert into region (id,code,local_code,region_name,continent,iso_country) values (3892,'US-MA','MA','Massachusetts','NA','US');
insert into region (id,code,local_code,region_name,continent,iso_country) values (3893,'US-MD','MD','Maryland','NA','US');
insert into region (id,code,local_code,region_name,continent,iso_country) values (3894,'US-ME','ME','Maine','NA','US');
insert into region (id,code,local_code,region_name,continent,iso_country) values (3895,'US-MI','MI','Michigan','NA','US');
insert into region (id,code,local_code,region_name,continent,iso_country) values (3896,'US-MN','MN','Minnesota','NA','US');
insert into region (id,code,local_code,region_name,continent,iso_country) values (3897,'US-MO','MO','Missouri','NA','US');
insert into region (id,code,local_code,region_name,continent,iso_country) values (3899,'US-MS','MS','Mississippi','NA','US');
insert into region (id,code,local_code,region_name,continent,iso_country) values (3900,'US-MT','MT','Montana','NA','US');
insert into region (id,code,local_code,region_name,continent,iso_country) values (3901,'US-NC','NC','North Carolina','NA','US');
insert into region (id,code,local_code,region_name,continent,iso_country) values (3902,'US-ND','ND','North Dakota','NA','US');
insert into region (id,code,local_code,region_name,continent,iso_country) values (3903,'US-NE','NE','Nebraska','NA','US');
insert into region (id,code,local_code,region_name,continent,iso_country) values (3904,'US-NH','NH','New Hampshire','NA','US');
insert into region (id,code,local_code,region_name,continent,iso_country) values (3905,'US-NJ','NJ','New Jersey','NA','US');
insert into region (id,code,local_code,region_name,continent,iso_country) values (3906,'US-NM','NM','New Mexico','NA','US');
insert into region (id,code,local_code,region_name,continent,iso_country) values (3907,'US-NV','NV','Nevada','NA','US');
insert into region (id,code,local_code,region_name,continent,iso_country) values (3908,'US-NY','NY','New York','NA','US');
insert into region (id,code,local_code,region_name,continent,iso_country) values (3909,'US-OH','OH','Ohio','NA','US');
insert into region (id,code,local_code,region_name,continent,iso_country) values (3910,'US-OK','OK','Oklahoma','NA','US');
insert into region (id,code,local_code,region_name,continent,iso_country) values (3911,'US-OR','OR','Oregon','NA','US');
insert into region (id,code,local_code,region_name,continent,iso_country) values (3912,'US-PA','PA','Pennsylvania','NA','US');
insert into region (id,code,local_code,region_name,continent,iso_country) values (3914,'US-RI','RI','Rhode Island','NA','US');
insert into region (id,code,local_code,region_name,continent,iso_country) values (3915,'US-SC','SC','South Carolina','NA','US');
insert into region (id,code,local_code,region_name,continent,iso_country) values (3916,'US-SD','SD','South Dakota','NA','US');
insert into region (id,code,local_code,region_name,continent,iso_country) values (3917,'US-TN','TN','Tennessee','NA','US');
insert into region (id,code,local_code,region_name,continent,iso_country) values (3918,'US-TX','TX','Texas','NA','US');
insert into region (id,code,local_code,region_name,continent,iso_country) values (3919,'US-U-A','U-A','(unassigned)','NA','US');
insert into region (id,code,local_code,region_name,continent,iso_country) values (3921,'US-UT','UT','Utah','NA','US');
insert into region (id,code,local_code,region_name,continent,iso_country) values (3922,'US-VA','VA','Virginia','NA','US');
insert into region (id,code,local_code,region_name,continent,iso_country) values (3924,'US-VT','VT','Vermont','NA','US');
insert into region (id,code,local_code,region_name,continent,iso_country) values (3925,'US-WA','WA','Washington','NA','US');
insert into region (id,code,local_code,region_name,continent,iso_country) values (3926,'US-WI','WI','Wisconsin','NA','US');
insert into region (id,code,local_code,region_name,continent,iso_country) values (3927,'US-WV','WV','West Virginia','NA','US');
insert into region (id,code,local_code,region_name,continent,iso_country) values (3928,'US-WY','WY','Wyoming','NA','US');
insert into country(id,code,country_name,continent) values (1,'AD','Andorra','EU');
insert into country(id,code,country_name,continent) values (2,'AE','United Arab Emirates','AS');
insert into country(id,code,country_name,continent) values (3,'AF','Afghanistan','AS');
insert into country(id,code,country_name,continent) values (4,'AG','Antigua and Barbuda','NA');
insert into country(id,code,country_name,continent) values (5,'AI','Anguilla','NA');
insert into country(id,code,country_name,continent) values (6,'AL','Albania','EU');
insert into country(id,code,country_name,continent) values (7,'AM','Armenia','AS');
insert into country(id,code,country_name,continent) values (8,'AN','Netherlands Antilles','NA');
insert into country(id,code,country_name,continent) values (9,'AO','Angola','AF');
insert into country(id,code,country_name,continent) values (10,'AQ','Antarctica','AN');
insert into country(id,code,country_name,continent) values (11,'AR','Argentina','SA');
insert into country(id,code,country_name,continent) values (12,'AS','American Samoa','OC');
insert into country(id,code,country_name,continent) values (13,'AT','Austria','EU');
insert into country(id,code,country_name,continent) values (14,'AU','Australia','OC');
insert into country(id,code,country_name,continent) values (15,'AW','Aruba','NA');
insert into country(id,code,country_name,continent) values (16,'AZ','Azerbaijan','AS');
insert into country(id,code,country_name,continent) values (17,'BA','Bosnia and Herzegovina','EU');
insert into country(id,code,country_name,continent) values (18,'BB','Barbados','NA');
insert into country(id,code,country_name,continent) values (19,'BD','Bangladesh','AS');
insert into country(id,code,country_name,continent) values (20,'BE','Belgium','EU');
insert into country(id,code,country_name,continent) values (21,'BF','Burkina Faso','AF');
insert into country(id,code,country_name,continent) values (22,'BG','Bulgaria','EU');
insert into country(id,code,country_name,continent) values (23,'BH','Bahrain','AS');
insert into country(id,code,country_name,continent) values (24,'BI','Burundi','AF');
insert into country(id,code,country_name,continent) values (25,'BJ','Benin','AF');
insert into country(id,code,country_name,continent) values (245,'BL','Saint Barthélemy','NA');
insert into country(id,code,country_name,continent) values (26,'BM','Bermuda','NA');
insert into country(id,code,country_name,continent) values (27,'BN','Brunei','AS');
insert into country(id,code,country_name,continent) values (28,'BO','Bolivia','SA');
insert into country(id,code,country_name,continent) values (29,'BR','Brazil','SA');
insert into country(id,code,country_name,continent) values (30,'BS','Bahamas','NA');
insert into country(id,code,country_name,continent) values (31,'BT','Bhutan','AS');
insert into country(id,code,country_name,continent) values (32,'BW','Botswana','AF');
insert into country(id,code,country_name,continent) values (33,'BY','Belarus','EU');
insert into country(id,code,country_name,continent) values (34,'BZ','Belize','NA');
insert into country(id,code,country_name,continent) values (35,'CA','Canada','NA');
insert into country(id,code,country_name,continent) values (36,'CC','Cocos (Keeling) Islands','AS');
insert into country(id,code,country_name,continent) values (37,'CD','Congo (Kinshasa)','AF');
insert into country(id,code,country_name,continent) values (38,'CF','Central African Republic','AF');
insert into country(id,code,country_name,continent) values (39,'CG','Congo (Brazzaville)','AF');
insert into country(id,code,country_name,continent) values (40,'CH','Switzerland','EU');
insert into country(id,code,country_name,continent) values (41,'CI','Côte d''Ivoire','AF');
insert into country(id,code,country_name,continent) values (42,'CK','Cook Islands','OC');
insert into country(id,code,country_name,continent) values (43,'CL','Chile','SA');
insert into country(id,code,country_name,continent) values (44,'CM','Cameroon','AF');
insert into country(id,code,country_name,continent) values (45,'CN','China','AS');
insert into country(id,code,country_name,continent) values (46,'CO','Colombia','SA');
insert into country(id,code,country_name,continent) values (47,'CR','Costa Rica','NA');
insert into country(id,code,country_name,continent) values (49,'CU','Cuba','NA');
insert into country(id,code,country_name,continent) values (50,'CV','Cape Verde','AF');
insert into country(id,code,country_name,continent) values (51,'CX','Christmas Island','AS');
insert into country(id,code,country_name,continent) values (52,'CY','Cyprus','AS');
insert into country(id,code,country_name,continent) values (53,'CZ','Czech Republic','EU');
insert into country(id,code,country_name,continent) values (54,'DE','Germany','EU');
insert into country(id,code,country_name,continent) values (55,'DJ','Djibouti','AF');
insert into country(id,code,country_name,continent) values (56,'DK','Denmark','EU');
insert into country(id,code,country_name,continent) values (57,'DM','Dominica','NA');
insert into country(id,code,country_name,continent) values (58,'DO','Dominican Republic','NA');
insert into country(id,code,country_name,continent) values (59,'DZ','Algeria','AF');
insert into country(id,code,country_name,continent) values (60,'EC','Ecuador','SA');
insert into country(id,code,country_name,continent) values (61,'EE','Estonia','EU');
insert into country(id,code,country_name,continent) values (62,'EG','Egypt','AF');
insert into country(id,code,country_name,continent) values (63,'EH','Western Sahara','AF');
insert into country(id,code,country_name,continent) values (64,'ER','Eritrea','AF');
insert into country(id,code,country_name,continent) values (65,'ES','Spain','EU');
insert into country(id,code,country_name,continent) values (66,'ET','Ethiopia','AF');
insert into country(id,code,country_name,continent) values (67,'FI','Finland','EU');
insert into country(id,code,country_name,continent) values (68,'FJ','Fiji','OC');
insert into country(id,code,country_name,continent) values (69,'FK','Falkland Islands','SA');
insert into country(id,code,country_name,continent) values (70,'FM','Micronesia','OC');
insert into country(id,code,country_name,continent) values (71,'FO','Faroe Islands','EU');
insert into country(id,code,country_name,continent) values (72,'FR','France','EU');
insert into country(id,code,country_name,continent) values (73,'GA','Gabon','AF');
insert into country(id,code,country_name,continent) values (74,'GB','United Kingdom','EU');
insert into country(id,code,country_name,continent) values (75,'GD','Grenada','NA');
insert into country(id,code,country_name,continent) values (76,'GE','Georgia','AS');
insert into country(id,code,country_name,continent) values (77,'GF','French Guiana','SA');
insert into country(id,code,country_name,continent) values (78,'GG','Guernsey','EU');
insert into country(id,code,country_name,continent) values (79,'GH','Ghana','AF');
insert into country(id,code,country_name,continent) values (80,'GI','Gibraltar','EU');
insert into country(id,code,country_name,continent) values (81,'GL','Greenland','NA');
insert into country(id,code,country_name,continent) values (82,'GM','Gambia','AF');
insert into country(id,code,country_name,continent) values (83,'GN','Guinea','AF');
insert into country(id,code,country_name,continent) values (84,'GP','Guadeloupe','NA');
insert into country(id,code,country_name,continent) values (85,'GQ','Equatorial Guinea','AF');
insert into country(id,code,country_name,continent) values (86,'GR','Greece','EU');
insert into country(id,code,country_name,continent) values (87,'GS','South Georgia and the South Sandwich Islands','AN');
insert into country(id,code,country_name,continent) values (88,'GT','Guatemala','NA');
insert into country(id,code,country_name,continent) values (89,'GU','Guam','OC');
insert into country(id,code,country_name,continent) values (90,'GW','Guinea-Bissau','AF');
insert into country(id,code,country_name,continent) values (91,'GY','Guyana','SA');
insert into country(id,code,country_name,continent) values (92,'HK','Hong Kong','AS');
insert into country(id,code,country_name,continent) values (93,'HN','Honduras','NA');
insert into country(id,code,country_name,continent) values (94,'HR','Croatia','EU');
insert into country(id,code,country_name,continent) values (95,'HT','Haiti','NA');
insert into country(id,code,country_name,continent) values (96,'HU','Hungary','EU');
insert into country(id,code,country_name,continent) values (97,'ID','Indonesia','AS');
insert into country(id,code,country_name,continent) values (98,'IE','Ireland','EU');
insert into country(id,code,country_name,continent) values (99,'IL','Israel','AS');
insert into country(id,code,country_name,continent) values (100,'IM','Isle of Man','EU');
insert into country(id,code,country_name,continent) values (101,'IN','India','AS');
insert into country(id,code,country_name,continent) values (102,'IO','British Indian Ocean Territory','AS');
insert into country(id,code,country_name,continent) values (103,'IQ','Iraq','AS');
insert into country(id,code,country_name,continent) values (104,'IR','Iran','AS');
insert into country(id,code,country_name,continent) values (105,'IS','Iceland','EU');
insert into country(id,code,country_name,continent) values (107,'JE','Jersey','EU');
insert into country(id,code,country_name,continent) values (106,'IT','Italy','EU');
insert into country(id,code,country_name,continent) values (108,'JM','Jamaica','NA');
insert into country(id,code,country_name,continent) values (109,'JO','Jordan','AS');
insert into country(id,code,country_name,continent) values (110,'JP','Japan','AS');
insert into country(id,code,country_name,continent) values (111,'KE','Kenya','AF');
insert into country(id,code,country_name,continent) values (112,'KG','Kyrgyzstan','AS');
insert into country(id,code,country_name,continent) values (113,'KH','Cambodia','AS');
insert into country(id,code,country_name,continent) values (114,'KI','Kiribati','OC');
insert into country(id,code,country_name,continent) values (115,'KM','Comoros','AF');
insert into country(id,code,country_name,continent) values (116,'KN','Saint Kitts and Nevis','NA');
insert into country(id,code,country_name,continent) values (117,'KP','North Korea','AS');
insert into country(id,code,country_name,continent) values (118,'KR','South Korea','AS');
insert into country(id,code,country_name,continent) values (243,'KS','Kosovo','EU');
insert into country(id,code,country_name,continent) values (119,'KW','Kuwait','AS');
insert into country(id,code,country_name,continent) values (120,'KY','Cayman Islands','NA');
insert into country(id,code,country_name,continent) values (121,'KZ','Kazakhstan','AS');
insert into country(id,code,country_name,continent) values (122,'LA','Laos','AS');
insert into country(id,code,country_name,continent) values (123,'LB','Lebanon','AS');
insert into country(id,code,country_name,continent) values (124,'LC','Saint Lucia','NA');
insert into country(id,code,country_name,continent) values (125,'LI','Liechtenstein','EU');
insert into country(id,code,country_name,continent) values (126,'LK','Sri Lanka','AS');
insert into country(id,code,country_name,continent) values (127,'LR','Liberia','AF');
insert into country(id,code,country_name,continent) values (128,'LS','Lesotho','AF');
insert into country(id,code,country_name,continent) values (129,'LT','Lithuania','EU');
insert into country(id,code,country_name,continent) values (130,'LU','Luxembourg','EU');
insert into country(id,code,country_name,continent) values (131,'LV','Latvia','EU');
insert into country(id,code,country_name,continent) values (132,'LY','Libya','AF');
insert into country(id,code,country_name,continent) values (133,'MA','Morocco','AF');
insert into country(id,code,country_name,continent) values (134,'MC','Monaco','EU');
insert into country(id,code,country_name,continent) values (135,'MD','Moldova','EU');
insert into country(id,code,country_name,continent) values (136,'ME','Montenegro','EU');
insert into country(id,code,country_name,continent) values (244,'MF','Saint Martin','NA');
insert into country(id,code,country_name,continent) values (137,'MG','Madagascar','AF');
insert into country(id,code,country_name,continent) values (138,'MH','Marshall Islands','OC');
insert into country(id,code,country_name,continent) values (139,'MK','Macedonia','EU');
insert into country(id,code,country_name,continent) values (140,'ML','Mali','AF');
insert into country(id,code,country_name,continent) values (141,'MM','Burma','AS');
insert into country(id,code,country_name,continent) values (142,'MN','Mongolia','AS');
insert into country(id,code,country_name,continent) values (143,'MO','Macau','AS');
insert into country(id,code,country_name,continent) values (144,'MP','Northern Mariana Islands','OC');
insert into country(id,code,country_name,continent) values (145,'MQ','Martinique','NA');
insert into country(id,code,country_name,continent) values (146,'MR','Mauritania','AF');
insert into country(id,code,country_name,continent) values (147,'MS','Montserrat','NA');
insert into country(id,code,country_name,continent) values (148,'MT','Malta','EU');
insert into country(id,code,country_name,continent) values (149,'MU','Mauritius','AF');
insert into country(id,code,country_name,continent) values (150,'MV','Maldives','AS');
insert into country(id,code,country_name,continent) values (151,'MW','Malawi','AF');
insert into country(id,code,country_name,continent) values (152,'MX','Mexico','NA');
insert into country(id,code,country_name,continent) values (153,'MY','Malaysia','AS');
insert into country(id,code,country_name,continent) values (154,'MZ','Mozambique','AF');
insert into country(id,code,country_name,continent) values (155,'NA','Namibia','AF');
insert into country(id,code,country_name,continent) values (156,'NC','New Caledonia','OC');
insert into country(id,code,country_name,continent) values (157,'NE','Niger','AF');
insert into country(id,code,country_name,continent) values (158,'NF','Norfolk Island','OC');
insert into country(id,code,country_name,continent) values (159,'NG','Nigeria','AF');
insert into country(id,code,country_name,continent) values (160,'NI','Nicaragua','NA');
insert into country(id,code,country_name,continent) values (161,'NL','Netherlands','EU');
insert into country(id,code,country_name,continent) values (162,'NO','Norway','EU');
insert into country(id,code,country_name,continent) values (163,'NP','Nepal','AS');
insert into country(id,code,country_name,continent) values (164,'NR','Nauru','OC');
insert into country(id,code,country_name,continent) values (165,'NU','Niue','OC');
insert into country(id,code,country_name,continent) values (166,'NZ','New Zealand','OC');
insert into country(id,code,country_name,continent) values (167,'OM','Oman','AS');
insert into country(id,code,country_name,continent) values (168,'PA','Panama','NA');
insert into country(id,code,country_name,continent) values (169,'PE','Perú','SA');
insert into country(id,code,country_name,continent) values (170,'PF','French Polynesia','OC');
insert into country(id,code,country_name,continent) values (171,'PG','Papua New Guinea','OC');
insert into country(id,code,country_name,continent) values (172,'PH','Philippines','AS');
insert into country(id,code,country_name,continent) values (173,'PK','Pakistan','AS');
insert into country(id,code,country_name,continent) values (174,'PL','Poland','EU');
insert into country(id,code,country_name,continent) values (175,'PM','Saint Pierre and Miquelon','NA');
insert into country(id,code,country_name,continent) values (176,'PN','Pitcairn','OC');
insert into country(id,code,country_name,continent) values (177,'PR','Puerto Rico','NA');
insert into country(id,code,country_name,continent) values (178,'PS','Palestinian Territory','AS');
insert into country(id,code,country_name,continent) values (179,'PT','Portugal','EU');
insert into country(id,code,country_name,continent) values (180,'PW','Palau','OC');
insert into country(id,code,country_name,continent) values (181,'PY','Paraguay','SA');
insert into country(id,code,country_name,continent) values (182,'QA','Qatar','AS');
insert into country(id,code,country_name,continent) values (183,'RE','Réunion','AF');
insert into country(id,code,country_name,continent) values (184,'RO','Romania','EU');
insert into country(id,code,country_name,continent) values (185,'RS','Serbia','EU');
insert into country(id,code,country_name,continent) values (186,'RU','Russia','EU');
insert into country(id,code,country_name,continent) values (187,'RW','Rwanda','AF');
insert into country(id,code,country_name,continent) values (188,'SA','Saudi Arabia','AS');
insert into country(id,code,country_name,continent) values (189,'SB','Solomon Islands','OC');
insert into country(id,code,country_name,continent) values (190,'SC','Seychelles','AF');
insert into country(id,code,country_name,continent) values (191,'SD','Sudan','AF');
insert into country(id,code,country_name,continent) values (192,'SE','Sweden','EU');
insert into country(id,code,country_name,continent) values (193,'SG','Singapore','AS');
insert into country(id,code,country_name,continent) values (194,'SH','Saint Helena','AF');
insert into country(id,code,country_name,continent) values (195,'SI','Slovenia','EU');
insert into country(id,code,country_name,continent) values (197,'SK','Slovakia','EU');
insert into country(id,code,country_name,continent) values (198,'SL','Sierra Leone','AF');
insert into country(id,code,country_name,continent) values (199,'SM','San Marino','EU');
insert into country(id,code,country_name,continent) values (200,'SN','Senegal','AF');
insert into country(id,code,country_name,continent) values (201,'SO','Somalia','AF');
insert into country(id,code,country_name,continent) values (202,'SR','Suriname','SA');
insert into country(id,code,country_name,continent) values (247,'SS','South Sudan','AF');
insert into country(id,code,country_name,continent) values (203,'ST','São Tomé and Principe','AF');
insert into country(id,code,country_name,continent) values (204,'SV','El Salvador','NA');
insert into country(id,code,country_name,continent) values (205,'SY','Syria','AS');
insert into country(id,code,country_name,continent) values (206,'SZ','Swaziland','AF');
insert into country(id,code,country_name,continent) values (207,'TC','Turks and Caicos Islands','NA');
insert into country(id,code,country_name,continent) values (208,'TD','Chad','AF');
insert into country(id,code,country_name,continent) values (209,'TF','French Southern Territories','AN');
insert into country(id,code,country_name,continent) values (210,'TG','Togo','AF');
insert into country(id,code,country_name,continent) values (211,'TH','Thailand','AS');
insert into country(id,code,country_name,continent) values (212,'TJ','Tajikistan','AS');
insert into country(id,code,country_name,continent) values (213,'TK','Tokelau','OC');
insert into country(id,code,country_name,continent) values (214,'TL','Timor-Leste','AS');
insert into country(id,code,country_name,continent) values (216,'TN','Tunisia','AF');
insert into country(id,code,country_name,continent) values (215,'TM','Turkmenistan','AS');
insert into country(id,code,country_name,continent) values (217,'TO','Tonga','OC');
insert into country(id,code,country_name,continent) values (218,'TR','Turkey','AS');
insert into country(id,code,country_name,continent) values (219,'TT','Trinidad and Tobago','NA');
insert into country(id,code,country_name,continent) values (220,'TV','Tuvalu','OC');
insert into country(id,code,country_name,continent) values (221,'TW','Taiwan','AS');
insert into country(id,code,country_name,continent) values (222,'TZ','Tanzania','AF');
insert into country(id,code,country_name,continent) values (223,'UA','Ukraine','EU');
insert into country(id,code,country_name,continent) values (224,'UG','Uganda','AF');
insert into country(id,code,country_name,continent) values (225,'UM','United States Minor Outlying Islands','OC');
insert into country(id,code,country_name,continent) values (226,'US','United States','NA');
insert into country(id,code,country_name,continent) values (227,'UY','Uruguay','SA');
insert into country(id,code,country_name,continent) values (228,'UZ','Uzbekistan','AS');
insert into country(id,code,country_name,continent) values (246,'VA','Vatican City','EU');
insert into country(id,code,country_name,continent) values (229,'VC','Saint Vincent and the Grenadines','NA');
insert into country(id,code,country_name,continent) values (230,'VE','Venezuela','SA');
insert into country(id,code,country_name,continent) values (231,'VG','British Virgin Islands','NA');
insert into country(id,code,country_name,continent) values (232,'VI','U.S. Virgin Islands','NA');
insert into country(id,code,country_name,continent) values (233,'VN','Vietnam','AS');
insert into country(id,code,country_name,continent) values (234,'VU','Vanuatu','OC');
insert into country(id,code,country_name,continent) values (235,'WF','Wallis and Futuna','OC');
insert into country(id,code,country_name,continent) values (236,'WS','Samoa','OC');
insert into country(id,code,country_name,continent) values (237,'YE','Yemen','AS');
insert into country(id,code,country_name,continent) values (238,'YT','Mayotte','AF');
insert into country(id,code,country_name,continent) values (239,'ZA','South Africa','AF');
insert into country(id,code,country_name,continent) values (240,'ZM','Zambia','AF');
insert into country(id,code,country_name,continent) values (241,'ZW','Zimbabwe','AF');
|
CREATE DATABASE sequelize_passport;
USE DATABASE sequelize_passport;
|
/* Added in MySQL 8.0.21
* See https://dev.mysql.com/doc/refman/8.0/en/json-search-functions.html#function_json-value
* JSON_VALUE(json_doc, path RETURNING type) is equivalent to
* CAST(JSON_UNQUOTE(JSON_EXTRACT(json_doc, path)) AS type)
*/
SELECT JSON_VALUE('{"id": "1", "name": "Item 1", "price": "12.34"}',
'$.name' RETURNING CHAR) AS jv_name,
CAST(
JSON_UNQUOTE(
JSON_EXTRACT('{"id": "1", "name": "Item 1", "price": "12.34"}',
'$.name')
)
AS CHAR
) AS cast_name,
JSON_VALUE('{"id": "1", "name": "Item 1", "price": "12.34"}',
'$.price' RETURNING DECIMAL(5,2)) AS jv_price,
CAST(
JSON_UNQUOTE(
JSON_EXTRACT('{"id": "1", "name": "Item 1", "price": "12.34"}',
'$.price')
)
AS DECIMAL(5,2)
) AS cast_prince;
/* JSON_VALUE simplifies index creation, because it removes the need for
* adding a generated column and then an index on it.
*/
CREATE TABLE docs1 (
doc_data JSON,
doc_id INT GENERATED ALWAYS AS (JSON_UNQUOTE(JSON_EXTRACT(doc_data, '$.id'))),
INDEX pk_docs (doc_id)
);
/* And with JSON_VALUE and functional index the previous becomes */
CREATE TABLE docs2 (
doc_data JSON,
INDEX pk_docs ( (JSON_VALUE(doc_data, '$.id' RETURNING UNSIGNED)) )
);
/* Load some data */
INSERT INTO docs1 (doc_data)
VALUES ('{"id": "1", "name": "Item 1", "price": "12.34"}'),
('{"id": "2", "name": "Item 2", "price": "56.78"}');
INSERT INTO docs2 SELECT doc_data FROM docs1;
/* To use the index with generated column ... */
SELECT * FROM docs1 WHERE doc_id = 1;
/* and without generated column as functional index */
SELECT * FROM docs2 WHERE JSON_VALUE(doc_data, '$.id' RETURNING UNSIGNED) = 2;
|
CREATE DATABASE IF NOT EXISTS modulo_admin;
CREATE DATABASE IF NOT EXISTS modulo_compras;
CREATE DATABASE IF NOT EXISTS modulo_inventario;
CREATE DATABASE IF NOT EXISTS modulo_produtos;
CREATE DATABASE IF NOT EXISTS modulo_pessoas;
CREATE DATABASE IF NOT EXISTS modulo_producao;
CREATE DATABASE IF NOT EXISTS modulo_rh;
CREATE DATABASE IF NOT EXISTS modulo_vendas;
|
# 10/ Pour chaque classe, afficher sa moyenne globale (Moyenne de toutes les notes au sein de la classe)
SELECT C.name, AVG(G.mark) AS ClassAverage
FROM class C, grade G, assessment ASS
WHERE C.id = ASS.class_id
AND G.assessment_id = ASS.id
GROUP BY C.name
HAVING AVG(G.mark); |
CREATE DATABASE dbfarm;
USE dbfarm;
CREATE TABLE type_plante (
idtype_plante INT NOT NULL,
nom VARCHAR(45) NOT NULL,
CONSTRAINT pkplante
PRIMARY KEY (idtype_plante)
);
CREATE TABLE plante (
idplante INT NOT NULL,
nom VARCHAR(45) NOT NULL,
fktype INT NULL,
CONSTRAINT pkplante
PRIMARY KEY (idplante),
CONSTRAINT fktype
FOREIGN KEY (fktype)
REFERENCES type_plante (idtype_plante)
);
CREATE TABLE produit (
idproduit INT NOT NULL,
nom VARCHAR(45) NOT NULL,
CONSTRAINT pkproduit
PRIMARY KEY (idproduit)
);
CREATE TABLE type_terre (
idtype_terre INT NOT NULL,
nom VARCHAR(45) NOT NULL,
CONSTRAINT pktype_terre
PRIMARY KEY (idtype_terre)
);
CREATE TABLE terrain (
idterrain INT NOT NULL,
surface FLOAT NOT NULL,
longitude FLOAT NOT NULL,
latitude FLOAT NOT NULL,
fktype_terre INT NOT NULL,
CONSTRAINT pkterrain
PRIMARY KEY (idterrain),
CONSTRAINT fktype_terre
FOREIGN KEY (fktype_terre)
REFERENCES type_terre (idtype_terre)
);
CREATE TABLE poste (
idposte INT NOT NULL,
nom VARCHAR(45) NOT NULL,
CONSTRAINT pkposte
PRIMARY KEY (idposte)
);
CREATE TABLE employe (
idemploye INT NOT NULL,
nom VARCHAR(45) NOT NULL,
fkposte INT NOT NULL,
CONSTRAINT pkemploye
PRIMARY KEY (idemploye),
CONSTRAINT fkposte
FOREIGN KEY (fkposte)
REFERENCES poste (idposte)
);
CREATE TABLE culture (
idculture INT NOT NULL,
fkplante INT NOT NULL,
annee TINYINT NOT NULL,
rendement INT NOT NULL,
fkterrain INT NOT NULL,
fkresponsable INT NOT NULL,
CONSTRAINT pkculture
PRIMARY KEY (idculture),
CONSTRAINT fkplante_c
FOREIGN KEY (fkplante)
REFERENCES plante (idplante),
CONSTRAINT fkterrain_c
FOREIGN KEY (fkterrain)
REFERENCES terrain (idterrain),
CONSTRAINT fkresponsable
FOREIGN KEY (fkresponsable)
REFERENCES employe (idemploye)
);
CREATE TABLE traitement (
fkproduit INT NOT NULL,
fkculture INT NOT NULL,
qtx SMALLINT NULL,
PRIMARY KEY (fkproduit, fkculture),
CONSTRAINT fkproduit
FOREIGN KEY (fkproduit)
REFERENCES produit (idproduit),
CONSTRAINT fkculture
FOREIGN KEY (fkculture)
REFERENCES culture (idculture)
);
CREATE TABLE animal (
idanimal INT NOT NULL,
nom VARCHAR(45) NOT NULL,
CONSTRAINT pkanimal
PRIMARY KEY (idanimal)
);
CREATE TABLE elevage (
idelevage INT NOT NULL,
fkanimal INT NOT NULL,
fkterrain INT NOT NULL,
capacite INT NOT NULL,
CONSTRAINT pkelevage
PRIMARY KEY (idelevage),
CONSTRAINT fkanimal_e
FOREIGN KEY (fkanimal)
REFERENCES animal (idanimal),
CONSTRAINT fkterrain_e
FOREIGN KEY (fkterrain)
REFERENCES terrain (idterrain)
);
CREATE TABLE alimentation (
fkplante INT NOT NULL,
fkanimal INT NOT NULL,
annee TINYINT NOT NULL,
qtx SMALLINT NOT NULL,
CONSTRAINT pkalimentation
PRIMARY KEY (fkplante, fkanimal),
CONSTRAINT fkplante_a
FOREIGN KEY (fkplante)
REFERENCES plante (idplante),
CONSTRAINT fkanimal_a
FOREIGN KEY (fkanimal)
REFERENCES elevage (idelevage)
);
CREATE TABLE production (
fkelevage INT NOT NULL,
annee TINYINT NOT NULL,
quantite INT NOT NULL,
CONSTRAINT pkproduction
PRIMARY KEY (fkelevage, annee),
CONSTRAINT fkelevage
FOREIGN KEY (fkelevage)
REFERENCES elevage (idelevage)
);
|
-- 导出 test 的数据库结构
CREATE DATABASE IF NOT EXISTS `test`;
USE `test`;
-- 导出 表 test.account 结构
CREATE TABLE IF NOT EXISTS `account`
(
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(100) DEFAULT NULL,
`balance` double NOT NULL DEFAULT 0,
PRIMARY KEY (`id`)
) ENGINE = InnoDB
AUTO_INCREMENT = 3
DEFAULT CHARSET = utf8;
-- 正在导出表 test.account 的数据:~2 rows (大约)
INSERT INTO `account` (`id`, `name`, `balance`)
VALUES (1, '张三', 522),
(2, '李四', 170);
-- 导出 表 test.book 结构
CREATE TABLE IF NOT EXISTS `book`
(
`isbn` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(100) DEFAULT NULL,
`price` int(11) DEFAULT 0,
`stock` int(11) DEFAULT 0,
PRIMARY KEY (`isbn`)
) ENGINE = InnoDB
AUTO_INCREMENT = 4
DEFAULT CHARSET = utf8;
-- 正在导出表 test.book 的数据:~2 rows (大约)
INSERT INTO `book` (`isbn`, `name`, `price`, `stock`)
VALUES (1, '雪山飞狐', 39, 95),
(2, 'Java编程思想', 75, 12),
(3, '面向对象编程', 50, 2); |
Create Table Missions (
MissionID int Primary Key,
MissionName varchar(120),
FK_Tour int,
Foreign Key (FK_Tour)
References Tours(TourID)
); |
--OPTION 2 W/O DUPLICATE
SELECT A.OBJECT_ID "Ticket ID",
E.CACHKNUM "Payment ID",
E1.CACHKNUM "Original Payment ID",
K.BILLING_ACCOUNT_CODE "BAN",
D.ZZREFUND_METHOD,
-- REA.L1 "Refund Type",
E1.CACHKDATE "Original Payment Date",
E.CACHKDATE "Refund Date",
E1.CACHKAMT_PAY "Original Payment Amount",
E.CACHKAMT_PAY "Refund Amount",
E1.CAREFERENCE1 "Original Payment Source",
E1.CAREFERENCE4 "Original Payment Method",
E1.CAREFERENCE5 "Original Payment Sub Method",
L.SHDES "Payment Channel",
F.STRING01 "Client ID",
E1.CAREFERENCE20 || 'XXXXXX' || E1.CABANKACC "PAN",
E.CAREFERENCE4 "Refund Method",
E.CAREFERENCE5 "Refund Sub Method",
SD.CAT_ID "Reason Code",
C.TXT30 "Status",
E.CATYPE
FROM --SAPCARE TICKET TABLES
SAPSR3.CRMD_ORDERADM_H A,
SAPSR3.CRM_JEST B,
SAPSR3.TJ30T C,
SAPSR3.CRMD_CUSTOMER_H D,
--PAYMENT AND REFUND TABLES
CASHRECEIPTS_ALL E,--REFUND
CASHRECEIPTS_ALL E1,---PAYMENT
CASHRCPT_CHARACTERISTICS F,
CHARACTERISTICS_DEF G,
PAYMENT_CHANNEL L,
BILLING_ACCOUNT K,
--REFUND REASON LINK TABLES
SAPSR3.CRMD_LINK SB,
SAPSR3.CRMD_SRV_OSSET SC,
SAPSR3.CRMD_SRV_SUBJECT SD
WHERE B.OBJNR = A.GUID
AND PROCESS_TYPE = 'ZTPR'
AND PROCESS_TYPE = C.STSMA
AND B.STAT = C.ESTAT
AND CASE
WHEN NVL(TRIM(ZZAFLD00003U),'X') <> TRIM(ZZAFLD00003T) THEN ZZAFLD00003T --BSCS - SAPCARE LINK IS UPDATE FOR CREATED ORDER_ID
ELSE ZZAFLD00003U
END = E.ORDER_ID_ENTRY
AND C.SPRAS = 'E'
AND C.MANDT = B.MANDT
AND A.GUID = D.GUID
AND D.ZZPAY_REF_ID = E1.CACHKNUM
AND E1.CAXACT = F.CAXACT
AND F.CHAR_ID = G.CHAR_ID
AND G.CHAR_DES = 'FinancialDocCashExtension'
AND E1.PAYMENT_CHANNEL_ID = L.PAYMENT_CHANNEL_ID
AND E.BILLING_ACCOUNT_ID = K.BILLING_ACCOUNT_ID
AND A.GUID = SB.GUID_HI
AND SB.OBJTYPE_SET = '29'
AND SB.GUID_SET = SC.GUID_SET
AND SC.GUID = SD.GUID_REF
AND SD.KATALOG_TYPE = 'C'
AND B.INACT <> 'X' --CURRENT STATUS |
CREATE PROCEDURE sp_get_newsvnumber
AS
SELECT DocumentID FROM DocumentNumbers WHERE DocType = 62
|
DROP TABLE IF EXISTS jersey;
CREATE TABLE IF NOT EXISTS jersey (
id VARCHAR(36) PRIMARY KEY,
size INT,
brand VARCHAR(50),
club VARCHAR(50),
year YEAR,
type INT,
cut INT,
material INT DEFAULT 1
); |
/*
Navicat MySQL Data Transfer
Source Server : localhost_3306
Source Server Version : 50726
Source Host : localhost:3306
Source Database : newti
Target Server Type : MYSQL
Target Server Version : 50726
File Encoding : 65001
Date: 2020-11-23 17:34:04
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for t_spec_param
-- ----------------------------
DROP TABLE IF EXISTS `t_spec_param`;
CREATE TABLE `t_spec_param` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`spg_id` int(11) NOT NULL COMMENT '品类编号',
`spp_id` int(11) NOT NULL COMMENT '参数编号',
`name` varchar(255) COLLATE utf8_unicode_ci NOT NULL COMMENT '参数名称',
`numeric` tinyint(1) NOT NULL DEFAULT '1' COMMENT '是否为数字',
`unit` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '单位',
`generic` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否为通用',
`searching` tinyint(1) DEFAULT '1' COMMENT '是否用于搜索',
`segements` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '参数值',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- ----------------------------
-- Records of t_spec_param
-- ----------------------------
INSERT INTO `t_spec_param` VALUES ('1', '10001', '1', 'CPU', '0', null, '1', '1', null);
INSERT INTO `t_spec_param` VALUES ('2', '10001', '2', '内存', '1', 'GB', '0', '1', null);
|
-- Describe the object in detail (i.e. Columns data types)
DESC COUNTRIES;
DESC DEPARTMENTS;
DESC EMPLOYEES;
DESC JOB_HISTORY;
DESC JOBS;
DESC LOCATIONS;
DESC REGIONS;
-- Show User Indexes
SELECT INDEX_NAME, TABLE_OWNER, TABLE_NAME, UNIQUENESS
FROM USER_INDEXES;
-- Show All Indexes
SELECT INDEX_NAME, TABLE_OWNER, TABLE_NAME, UNIQUENESS
FROM ALL_INDEXES;
-- Find indexes on a Table, only works on Constraints
SELECT *
FROM user_cons_columns
WHERE table_name = 'JOBS';
SELECT TO_CHAR(HIRE_DATE,'mon') FROM EMPLOYEES;
SELECT TO_CHAR(HIRE_DATE,'month') FROM EMPLOYEES;
SELECT TO_CHAR(HIRE_DATE,'MON') FROM EMPLOYEES;
SELECT TO_CHAR(HIRE_DATE,'MONTH') FROM EMPLOYEES; |
/*==============================================================*/
/* DBMS name: DB2 */
/* Created on: 2016/6/28 17:51:25 */
/*==============================================================*/
drop table F_ADDRESS_BOOK ;
drop table F_DATACATALOG ;
drop table F_DATADICTIONARY ;
drop table F_OPTDATASCOPE ;
drop index IND_OptID_OPTMETHOD;
drop table F_OPTDEF ;
drop index ind_Tag_ID;
drop table F_OPT_LOG ;
drop table F_OptFlowNoInfo ;
drop table F_OptFlowNoPool ;
drop table F_OptInfo ;
drop table F_OptInfoData ;
drop index Ind_Filter_Table_Class_Name;
drop table F_QUERY_FILTER_CONDITION ;
drop table F_RANKGRANT ;
drop table F_ROLEINFO ;
drop table F_ROLEPOWER ;
drop table F_STAT_MONTH ;
drop table F_SYS_NOTIFY ;
drop table F_UNITINFO ;
drop index ind_regemail;
drop index Ind_loginname;
drop table F_USERINFO ;
drop table F_USERROLE ;
drop table F_USERSETTING ;
drop table F_USERUNIT ;
drop table F_USER_FAVORITE ;
drop index Ind_query_filter_modle_code;
drop table F_USER_QUERY_FILTER ;
drop table F_WORK_CLASS ;
drop table F_WORK_DAY ;
drop table M_InnerMsg ;
drop table M_InnerMsg_Recipient ;
drop table M_MsgAnnex ;
drop table P_TASK_LIST ;
/*==============================================================*/
/* 创建 序列
*/
/*==============================================================*/
/*
create sequence S_Filter_No;
create sequence s_notify_id;
create sequence s_optdefcode
start with 1100000;
create sequence s_sys_log;
create sequence s_unitcode;
create sequence s_user_unit_id;
create sequence s_usercode; */
/*==============================================================*/
/* Table: F_ADDRESS_BOOK */
/*==============================================================*/
create table F_ADDRESS_BOOK (
ADDRBOOKID decimal(10,0) not null,
BodyType VARCHAR(2) not null,
BodyCode VARCHAR(16) not null,
representation VARCHAR(200),
UnitName VARCHAR(200),
DeptName VARCHAR(100),
RankName VARCHAR(50),
Email VARCHAR(60),
Email2 VARCHAR(60),
Email3 VARCHAR(60),
HomePage VARCHAR(100),
QQ VARCHAR(20),
MSN VARCHAR(60),
wangwang VARCHAR(20),
buzPhone VARCHAR(20),
buzphone2 VARCHAR(20),
buzfax VARCHAR(20),
assiphone VARCHAR(20),
callbacphone VARCHAR(20),
carphone VARCHAR(20),
unitphone VARCHAR(20),
homephone VARCHAR(20),
homephone2 VARCHAR(20),
homephone3 VARCHAR(20),
homefax VARCHAR(20),
mobilephone VARCHAR(20),
mobilephone2 VARCHAR(20),
mobilephone3 VARCHAR(20),
unitzip VARCHAR(8),
unitProvince VARCHAR(20),
unitCity VARCHAR(20),
unitDistrict VARCHAR(20),
unitStreet VARCHAR(20),
unitAddress VARCHAR(60),
homezip VARCHAR(8),
homeProvince VARCHAR(20),
homeCity VARCHAR(20),
homeDistrict VARCHAR(20),
homeStreet VARCHAR(20),
homeAddress VARCHAR(60),
home2zip VARCHAR(8),
home2Province VARCHAR(20),
home2City VARCHAR(20),
home2District VARCHAR(20),
home2Street VARCHAR(20),
home2Address VARCHAR(60),
inuseAddress VARCHAR(1),
SearchString VARCHAR(1000),
memo VARCHAR(500),
LastModifyDate TIMESTAMP,
CreateDate TIMESTAMP
);
comment on table F_ADDRESS_BOOK is
'系统中维持一个统一的通讯录 模块,主要目的是为了以后做 统一的接口,
比如:
语音电话,短信平台等等
字段设计参照的Outlook的联系人';
comment on column F_ADDRESS_BOOK.BodyType is
'用户/个人/单位';
comment on column F_ADDRESS_BOOK.BodyCode is
'用户/个人/单位 编号';
comment on column F_ADDRESS_BOOK.inuseAddress is
'单位/住宅/住宅2';
comment on column F_ADDRESS_BOOK.SearchString is
'前面各个字段的中文首字母,数字 连接的串';
alter table F_ADDRESS_BOOK
add constraint PK_F_ADDRESS_BOOK primary key (ADDRBOOKID);
/*==============================================================*/
/* Table: F_DATACATALOG */
/*==============================================================*/
create table F_DATACATALOG (
CATALOGCODE VARCHAR(16) not null,
CATALOGNAME VARCHAR(64) not null,
CATALOGSTYLE CHAR(1) not null,
CATALOGTYPE CHAR(1) not null,
CATALOGDESC VARCHAR(256),
FieldDesc VARCHAR(1024),
updateDate TIMESTAMP,
CreateDate TIMESTAMP,
optID VARCHAR(16),
needCache CHAR(1) default 1,
creator VARCHAR(32),
updator VARCHAR(32)
);
comment on table F_DATACATALOG is
'类别状态 U:用户 S:系统,G国标
类别形式 T:树状表格 L:列表
';
comment on column F_DATACATALOG.CATALOGSTYLE is
'F : 框架固有的 U:用户 S:系统 G国标';
comment on column F_DATACATALOG.CATALOGTYPE is
'T:树状表格 L:列表
';
comment on column F_DATACATALOG.FieldDesc is
'字段描述,不同字段用分号隔开';
comment on column F_DATACATALOG.optID is
'业务分类,使用数据字典DICTIONARYTYPE中数据';
alter table F_DATACATALOG
add constraint SYS_C003033 primary key (CATALOGCODE);
/*==============================================================*/
/* Table: F_DATADICTIONARY */
/*==============================================================*/
create table F_DATADICTIONARY (
CATALOGCODE VARCHAR(16) not null,
DATACODE VARCHAR(16) not null,
EXTRACODE VARCHAR(16),
EXTRACODE2 VARCHAR(16),
DATATAG CHAR(1),
DATAVALUE VARCHAR(2048),
DATASTYLE CHAR(1),
DATADESC VARCHAR(256),
LastModifyDate TIMESTAMP,
CreateDate TIMESTAMP,
DATAORDER decimal(6,0)
);
comment on table F_DATADICTIONARY is
'数据字典:存放一些常量数据 比如出物提示信息,还有一些 代码与名称的对应表,比如 状态,角色名,头衔 等等
数据字典中的每个字段用户都可以根据自己的需要自解释其意义';
comment on column F_DATADICTIONARY.EXTRACODE is
'树型字典的父类代码';
comment on column F_DATADICTIONARY.EXTRACODE2 is
'默认的排序字段';
comment on column F_DATADICTIONARY.DATATAG is
'N正常,D已停用,用户可以自解释这个字段';
comment on column F_DATADICTIONARY.DATASTYLE is
'F : 框架固有的 U:用户 S:系统 G国标';
comment on column F_DATADICTIONARY.DATAORDER is
'排序字段';
alter table F_DATADICTIONARY
add constraint PK_DATADICTIONARY primary key (CATALOGCODE, DATACODE);
/*==============================================================*/
/* Table: F_OPTDATASCOPE */
/*==============================================================*/
create table F_OPTDATASCOPE (
optScopeCode VARCHAR(16) not null,
OptID VARCHAR(16),
scopeName VARCHAR(64),
FilterCondition VARCHAR(1024),
scopeMemo VARCHAR(1024),
FilterGroup VARCHAR(16) default 'G'
);
comment on column F_OPTDATASCOPE.FilterCondition is
'条件语句,可以有的参数 [mt] 业务表 [uc] 用户代码 [uu] 用户机构代码';
comment on column F_OPTDATASCOPE.scopeMemo is
'数据权限说明';
alter table F_OPTDATASCOPE
add constraint PK_F_OPTDATASCOPE primary key (optScopeCode);
/*==============================================================*/
/* Table: F_OPTDEF */
/*==============================================================*/
create table F_OPTDEF (
OPTCODE VARCHAR(32) not null,
OptID VARCHAR(32),
OPTNAME VARCHAR(100),
OPTMETHOD VARCHAR(50),
OPTURL VARCHAR(256),
OPTDESC VARCHAR(256),
IsInWorkflow CHAR(1),
updateDate TIMESTAMP,
CreateDate TIMESTAMP,
OPTREQ VARCHAR(8),
optOrder numeric(4,0),
creator VARCHAR(32),
updator VARCHAR(32)
);
comment on column F_OPTDEF.OPTMETHOD is
'操作参数 方法';
comment on column F_OPTDEF.IsInWorkflow is
'是否为流程操作方法 F:不是 T : 是';
alter table F_OPTDEF
add constraint PK_F_OPTDEF primary key (OPTCODE);
/*==============================================================*/
/* Index: IND_OptID_OPTMETHOD */
/*==============================================================*/
create index IND_OptID_OPTMETHOD on F_OPTDEF (
OptID ASC,
OPTMETHOD ASC
);
/*==============================================================*/
/* Table: F_OPT_LOG */
/*==============================================================*/
create table F_OPT_LOG (
logId decimal(12,0) not null,
logLevel VARCHAR(2) not null,
usercode VARCHAR(8) not null,
opttime TIMESTAMP not null,
OptContent VARCHAR(1000) not null,
NewValue CLOB,
OldValue CLOB,
OptID VARCHAR(64) not null,
OPTMethod VARCHAR(64),
optTag VARCHAR(200)
);
comment on column F_OPT_LOG.OptContent is
'操作描述';
comment on column F_OPT_LOG.NewValue is
'新值';
comment on column F_OPT_LOG.OldValue is
'原值';
comment on column F_OPT_LOG.OptID is
'模块,或者表';
comment on column F_OPT_LOG.OPTMethod is
'方法,或者字段';
comment on column F_OPT_LOG.optTag is
'一般用于关联到业务主体的标识、表的主键等等';
alter table F_OPT_LOG
add constraint PK_F_OPT_LOG primary key (logId);
/*==============================================================*/
/* Index: ind_Tag_ID */
/*==============================================================*/
create index ind_Tag_ID on F_OPT_LOG (
optTag ASC
);
/*==============================================================*/
/* Table: F_OptFlowNoInfo */
/*==============================================================*/
create table F_OptFlowNoInfo (
OwnerCode VARCHAR(8) not null,
CodeCode VARCHAR(16) not null,
CodeDate TIMESTAMP default sysdate not null,
CurNo decimal(6,0) default 1 not null,
LastCodeDate TIMESTAMP,
CreateDate TIMESTAMP,
LastModifyDate TIMESTAMP
);
alter table F_OptFlowNoInfo
add constraint PK_F_OPTFLOWNOINFO primary key (OwnerCode, CodeDate, CodeCode);
/*==============================================================*/
/* Table: F_OptFlowNoPool */
/*==============================================================*/
create table F_OptFlowNoPool (
OwnerCode VARCHAR(8) not null,
CodeCode VARCHAR(16) not null,
CodeDate TIMESTAMP default sysdate not null,
CurNo decimal(6,0) default 1 not null,
CreateDate TIMESTAMP
);
alter table F_OptFlowNoPool
add constraint PK_F_OPTFLOWNOPOOL primary key (OwnerCode, CodeDate, CodeCode, CurNo);
/*==============================================================*/
/* Table: F_OptInfo */
/*==============================================================*/
create table F_OptInfo (
OptID VARCHAR(32) not null,
OptName VARCHAR(100) not null,
PreOptID VARCHAR(32) not null,
optRoute VARCHAR(256),
opturl VARCHAR(256),
FormCode VARCHAR(4),
OptType CHAR(1),
MsgNo decimal(10,0),
MsgPrm VARCHAR(256),
IsInToolBar CHAR(1),
ImgIndex decimal(10,0),
TopOptID VARCHAR(8),
OrderInd decimal(4,0),
FLOWCODE VARCHAR(8),
PageType CHAR(1) default 'I' not null,
Icon VARCHAR(512),
height decimal(10,0),
width decimal(10,0),
updateDate TIMESTAMP,
CreateDate TIMESTAMP,
creator VARCHAR(32),
updator VARCHAR(32)
);
comment on column F_OptInfo.optRoute is
'与angularjs路由匹配';
comment on column F_OptInfo.OptType is
' S:实施业务, O:普通业务, W:流程业务, I :项目业务';
comment on column F_OptInfo.OrderInd is
'这个顺序只需在同一个父业务下排序';
comment on column F_OptInfo.FLOWCODE is
'同一个代码的流程应该只有一个有效的版本';
comment on column F_OptInfo.PageType is
'D : DIV I:iFrame';
alter table F_OptInfo
add constraint PK_F_OPTINFO primary key (OptID);
/*==============================================================*/
/* Table: F_OptInfoData */
/*==============================================================*/
create table F_OptInfoData (
TBCODE VARCHAR(32) not null,
OptID VARCHAR(8) not null,
LastModifyDate TIMESTAMP,
CreateDate TIMESTAMP
);
comment on table F_OptInfoData is
'业务模块和表是多对多的关系,这个表仅仅是作为数据权限设置时的一个辅助表的';
alter table F_OptInfoData
add constraint PK_F_OPTINFODATA primary key (TBCODE, OptID);
/*==============================================================*/
/* Table: F_QUERY_FILTER_CONDITION */
/*==============================================================*/
create table F_QUERY_FILTER_CONDITION (
CONDITION_NO decimal(12,0) not null,
Table_Class_Name VARCHAR(64) not null,
Param_Name VARCHAR(64) not null,
Param_Label VARCHAR(120) not null,
Param_Type VARCHAR(8),
Default_Value VARCHAR(100),
Filter_Sql VARCHAR(200),
Select_Data_type CHAR default 'N' not null,
Select_Data_Catalog VARCHAR(64),
Select_SQL VARCHAR(1000),
Select_JSON VARCHAR(2000)
);
comment on column F_QUERY_FILTER_CONDITION.Table_Class_Name is
'数据库表代码或者po的类名';
comment on column F_QUERY_FILTER_CONDITION.Param_Name is
'参数名';
comment on column F_QUERY_FILTER_CONDITION.Param_Label is
'参数输入框提示';
comment on column F_QUERY_FILTER_CONDITION.Param_Type is
'参数类型:S 字符串,L 数字, N 有小数点数据, D 日期, T 时间戳, Y 年, M 月';
comment on column F_QUERY_FILTER_CONDITION.Filter_Sql is
'过滤语句,将会拼装到sql语句中';
comment on column F_QUERY_FILTER_CONDITION.Select_Data_type is
'数据下拉框内容; N :没有, D 数据字典, S 通过sql语句获得, J json数据直接获取
';
comment on column F_QUERY_FILTER_CONDITION.Select_Data_Catalog is
'数据字典';
comment on column F_QUERY_FILTER_CONDITION.Select_SQL is
'有两个返回字段的sql语句';
comment on column F_QUERY_FILTER_CONDITION.Select_JSON is
'KEY,Value数值对,JSON格式';
alter table F_QUERY_FILTER_CONDITION
add constraint PK_F_QUERY_FILTER_CONDITION primary key (CONDITION_NO);
/*==============================================================*/
/* Index: Ind_Filter_Table_Class_Name */
/*==============================================================*/
create index Ind_Filter_Table_Class_Name on F_QUERY_FILTER_CONDITION (
Table_Class_Name ASC
);
/*==============================================================*/
/* Table: F_RANKGRANT */
/*==============================================================*/
create table F_RANKGRANT (
RANK_grant_ID decimal(12) not null,
granter VARCHAR(8) not null,
UNITCODE VARCHAR(6) not null,
UserStation VARCHAR(4) not null,
UserRank VARCHAR(2) not null,
beginDate TIMESTAMP not null,
grantee VARCHAR(8) not null,
endDate TIMESTAMP,
grantDesc VARCHAR(256),
LastModifyDate TIMESTAMP,
CreateDate TIMESTAMP
);
comment on column F_RANKGRANT.UserRank is
'RANK 代码不是 0开头的可以进行授予';
alter table F_RANKGRANT
add constraint PK_F_RANKGRANT primary key (RANK_grant_ID, UserRank);
/*==============================================================*/
/* Table: F_ROLEINFO */
/*==============================================================*/
create table F_ROLEINFO (
ROLECODE VARCHAR(32) not null,
ROLENAME VARCHAR(64),
ROLETYPE CHAR(1) not null,
UNITCODE VARCHAR(32),
ISVALID CHAR(1) not null,
ROLEDESC VARCHAR(256),
updateDate TIMESTAMP,
CreateDate TIMESTAMP,
creator VARCHAR(32),
updator VARCHAR(32)
);
comment on column F_ROLEINFO.ROLETYPE is
'S为系统功能角色 I 为项目角色 W工作量角色';
alter table F_ROLEINFO
add constraint PK_F_ROLEINFO primary key (ROLECODE);
/*==============================================================*/
/* Table: F_ROLEPOWER */
/*==============================================================*/
create table F_ROLEPOWER (
ROLECODE VARCHAR(32) not null,
OPTCODE VARCHAR(32) not null,
optScopeCodes VARCHAR(1000),
updateDate TIMESTAMP,
CreateDate TIMESTAMP,
creator VARCHAR(32),
updator VARCHAR(32)
);
comment on column F_ROLEPOWER.optScopeCodes is
'用逗号隔开的数据范围结合(空\all 表示全部)';
alter table F_ROLEPOWER
add constraint PK_WFROLEPOWER primary key (ROLECODE, OPTCODE);
/*==============================================================*/
/* Table: F_STAT_MONTH */
/*==============================================================*/
create table F_STAT_MONTH (
YEARMONTH VARCHAR(6) not null,
BeginDay TIMESTAMP not null,
EendDay TIMESTAMP not null,
EndSchedule CHAR(1),
BeginSchedule CHAR(1)
);
comment on table F_STAT_MONTH is
'OA业务统计月,可以自定义统计月的起止日期';
comment on column F_STAT_MONTH.YEARMONTH is
'YYYYMM';
comment on column F_STAT_MONTH.EndSchedule is
'这个字段忽略';
comment on column F_STAT_MONTH.BeginSchedule is
'这个字段忽略';
alter table F_STAT_MONTH
add constraint PK_F_STAT_MONTH primary key (YEARMONTH);
/*==============================================================*/
/* Table: F_SYS_NOTIFY */
/*==============================================================*/
create table F_SYS_NOTIFY (
Notify_ID decimal(12,0) not null,
Notify_Sender VARCHAR(100),
Notify_Receiver VARCHAR(100) not null,
Msg_Subject VARCHAR(200),
Msg_Content VARCHAR(2000) not null,
notice_Type VARCHAR(100),
Notify_State CHAR(1),
Error_Msg VARCHAR(500),
Notify_Time TIMESTAMP,
optTag VARCHAR(200),
OPTMethod VARCHAR(64),
OptID VARCHAR(64) not null
);
comment on column F_SYS_NOTIFY.Notify_State is
'0 成功, 1 失败 2 部分成功';
comment on column F_SYS_NOTIFY.optTag is
'一般用于关联到业务主体';
comment on column F_SYS_NOTIFY.OPTMethod is
'方法,或者字段';
comment on column F_SYS_NOTIFY.OptID is
'模块,或者表';
alter table F_SYS_NOTIFY
add constraint PK_F_SYS_NOTIFY primary key (Notify_ID);
/*==============================================================*/
/* Table: F_UNITINFO */
/*==============================================================*/
create table F_UNITINFO (
UNITCODE VARCHAR(32) not null,
PARENTUNIT VARCHAR(32),
UNITTYPE CHAR(1),
ISVALID CHAR(1) not null,
UNITTAG VARCHAR(100),
UNITNAME VARCHAR(300) not null,
englishName VARCHAR(300),
depno VARCHAR(100),
UNITDESC VARCHAR(256),
ADDRBOOKID decimal(10,0),
UNITSHORTNAME VARCHAR(32),
unitWord VARCHAR(100),
unitGrade decimal(4,0),
unitOrder decimal(4,0),
updateDate TIMESTAMP,
CreateDate TIMESTAMP,
extJsonInfo VARCHAR(1000),
creator VARCHAR(32),
updator VARCHAR(32),
UNITPATH VARCHAR(1000)
);
comment on column F_UNITINFO.UNITTYPE is
'发布任务/ 邮电规划/组队/接收任务';
comment on column F_UNITINFO.ISVALID is
'T:生效 F:无效';
comment on column F_UNITINFO.UNITTAG is
'用户第三方系统管理';
comment on column F_UNITINFO.depno is
'组织机构代码:';
alter table F_UNITINFO
add constraint SYS_C006472 primary key (UNITCODE);
/*==============================================================*/
/* Table: F_USERINFO */
/*==============================================================*/
create table F_USERINFO (
USERCODE VARCHAR(32) not null,
USERPIN VARCHAR(32),
USERTYPE CHAR(1) default 'U',
ISVALID CHAR(1) not null,
LOGINNAME VARCHAR(100) not null,
UserName VARCHAR(300) not null,
USERTAG VARCHAR(100),
englishName VARCHAR(300),
USERDESC VARCHAR(256),
LoginTimes decimal(6,0),
ActiveTime TIMESTAMP,
LoginIP VARCHAR(16),
ADDRBOOKID decimal(10,0),
RegEmail VARCHAR(60),
USERPWD VARCHAR(20),
pwdExpiredTime TIMESTAMP,
REGCELLPHONE VARCHAR(15),
primaryUnit VARCHAR(32),
userWord VARCHAR(100),
userOrder decimal(4,0),
updateDate TIMESTAMP,
CreateDate TIMESTAMP,
extJsonInfo VARCHAR(1000),
creator VARCHAR(32),
updator VARCHAR(32)
);
comment on column F_USERINFO.USERTYPE is
'发布任务/接收任务/系统管理';
comment on column F_USERINFO.ISVALID is
'T:生效 F:无效';
comment on column F_USERINFO.UserName is
'昵称';
comment on column F_USERINFO.USERTAG is
'用于第三方系统关联';
comment on column F_USERINFO.RegEmail is
'注册用Email,不能重复';
comment on column F_USERINFO.USERPWD is
'如果需要可以有';
comment on column F_USERINFO.userWord is
'微信号';
alter table F_USERINFO
add constraint PK_F_USERINFO primary key (USERCODE);
/*==============================================================*/
/* Index: Ind_loginname */
/*==============================================================*/
create unique index Ind_loginname on F_USERINFO (
LOGINNAME ASC
);
/*==============================================================*/
/* Index: ind_regemail */
/*==============================================================*/
create unique index ind_regemail on F_USERINFO (
RegEmail ASC
);
/*==============================================================*/
/* Table: F_USERROLE */
/*==============================================================*/
create table F_USERROLE (
USERCODE VARCHAR(32) not null,
ROLECODE VARCHAR(32) not null,
OBTAINDate TIMESTAMP not null,
SECEDEDate TIMESTAMP,
CHANGEDESC VARCHAR(256),
updateDate TIMESTAMP,
CreateDate TIMESTAMP,
creator VARCHAR(32),
updator VARCHAR(32)
);
alter table F_USERROLE
add constraint PK_WFUSERROLE primary key (USERCODE, ROLECODE);
/*==============================================================*/
/* Table: F_USERSETTING */
/*==============================================================*/
create table F_USERSETTING (
USERCODE VARCHAR(8) not null,
ParamCode VARCHAR(16) not null,
ParamValue VARCHAR(2048) not null,
optID VARCHAR(16) not null,
ParamName VARCHAR(200),
CreateDate TIMESTAMP
);
comment on column F_USERSETTING.USERCODE is
'DEFAULT:为默认设置
SYS001~SYS999: 为系统设置方案
是一个用户号,或者是系统的一个设置方案';
alter table F_USERSETTING
add constraint SYS_C0064714 primary key (USERCODE, ParamCode);
/*==============================================================*/
/* Table: F_USERUNIT */
/*==============================================================*/
create table F_USERUNIT (
USERUNITID VARCHAR(16) not null,
UNITCODE VARCHAR(6) not null,
USERCODE VARCHAR(8) not null,
IsPrimary CHAR(1) default '1' not null,
UserStation VARCHAR(16) not null,
UserRank VARCHAR(2) not null,
RankMemo VARCHAR(256),
USERORDER decimal(8) default 0,
updateDate TIMESTAMP,
CreateDate TIMESTAMP,
creator VARCHAR(32),
updator VARCHAR(32)
);
comment on table F_USERUNIT is
'同一个人可能在多个部门担任不同的职位';
comment on column F_USERUNIT.IsPrimary is
'T:为主, F:兼职';
comment on column F_USERUNIT.UserRank is
'RANK 代码不是 0开头的可以进行授予';
comment on column F_USERUNIT.RankMemo is
'任职备注';
alter table F_USERUNIT
add constraint PK_F_USERUNIT primary key (USERUNITID);
/*==============================================================*/
/* Table: F_USER_FAVORITE */
/*==============================================================*/
create table F_USER_FAVORITE (
USERCODE VARCHAR(8) not null,
OptID VARCHAR(16) not null,
LastModifyDate TIMESTAMP,
CreateDate TIMESTAMP
);
comment on column F_USER_FAVORITE.USERCODE is
'DEFAULT:为默认设置
SYS001~SYS999: 为系统设置方案
是一个用户号,或者是系统的一个设置方案';
alter table F_USER_FAVORITE
add constraint SYS_C0064724 primary key (USERCODE, OptID);
/*==============================================================*/
/* Table: F_USER_QUERY_FILTER */
/*==============================================================*/
create table F_USER_QUERY_FILTER (
FILTER_NO decimal(12,0) not null,
userCode VARCHAR(8) not null,
modle_code VARCHAR(64) not null,
filter_name VARCHAR(200) not null,
filter_value VARCHAR(3200) not null
);
comment on column F_USER_QUERY_FILTER.modle_code is
'开发人员自行定义,单不能重复,建议用系统的模块名加上当前的操作方法';
comment on column F_USER_QUERY_FILTER.filter_name is
'用户自行定义的名称';
comment on column F_USER_QUERY_FILTER.filter_value is
'变量值,json格式,对应一个map';
alter table F_USER_QUERY_FILTER
add constraint PK_F_USER_QUERY_FILTER primary key (FILTER_NO);
/*==============================================================*/
/* Index: Ind_query_filter_modle_code */
/*==============================================================*/
create index Ind_query_filter_modle_code on F_USER_QUERY_FILTER (
modle_code ASC
);
/*==============================================================*/
/* Table: F_WORK_CLASS */
/*==============================================================*/
create table F_WORK_CLASS (
CLASS_ID decimal(12,0) not null,
CLASS_NAME VARCHAR(50) not null,
SHORT_NAME VARCHAR(10) not null,
begin_time VARCHAR(6),
end_time VARCHAR(6),
has_break CHAR(1),
break_begin_time VARCHAR(6),
break_end_time VARCHAR(6),
class_desc VARCHAR(500),
record_date TIMESTAMP,
recorder VARCHAR(8)
);
comment on table F_WORK_CLASS is
'CLASS_ID
为 0 的表示休息,可以不在这个表中出现
为 1 的为默认班次信息';
comment on column F_WORK_CLASS.begin_time is
'9:00';
comment on column F_WORK_CLASS.end_time is
'+4:00 ''+''表示第二天';
comment on column F_WORK_CLASS.break_begin_time is
'9:00';
comment on column F_WORK_CLASS.break_end_time is
'+4:00 ''+''表示第二天';
alter table F_WORK_CLASS
add constraint PK_F_WORK_CLASS primary key (CLASS_ID);
/*==============================================================*/
/* Table: F_WORK_DAY */
/*==============================================================*/
create table F_WORK_DAY (
WorkDay TIMESTAMP not null,
DayType CHAR(1) not null,
WorkTimeType VARCHAR(20),
WorkDayDesc VARCHAR(255)
);
comment on table F_WORK_DAY is
'非正常作业时间日
A:工作日放假 B:周末调休成工作时间 C: 正常上班 D:正常休假
';
comment on column F_WORK_DAY.DayType is
'A:工作日放假,B:周末调休成工作时间 C 正常上班 D正常休假';
alter table F_WORK_DAY
add constraint PK_F_WORK_DAY primary key (WorkDay);
/*==============================================================*/
/* Table: M_InnerMsg */
/*==============================================================*/
create table M_InnerMsg (
MsgCode VARCHAR(16) not null,
Sender VARCHAR(128),
SendDate TIMESTAMP,
MsgTitle VARCHAR(128),
MsgType CHAR(1),
MailType CHAR(1),
MailUnDelType CHAR(1),
ReceiveName VARCHAR(2048),
HoldUsers decimal(8,0),
msgState CHAR(1),
msgContent BLOB,
EmailId VARCHAR(8),
OptID VARCHAR(64) not null,
OPTMethod VARCHAR(64),
optTag VARCHAR(200)
);
comment on column M_InnerMsg.MsgCode is
'消息主键自定义,通过S_M_INNERMSG序列生成';
comment on column M_InnerMsg.MsgType is
'P= 个人为消息 A= 机构为公告(通知)
M=邮件';
comment on column M_InnerMsg.MailType is
'I=收件箱
O=发件箱
D=草稿箱
T=废件箱
';
comment on column M_InnerMsg.ReceiveName is
'使用部门,个人中文名,中间使用英文分号分割';
comment on column M_InnerMsg.HoldUsers is
'总数为发送人和接收人数量相加,发送和接收人删除消息时-1,当数量为0时真正删除此条记录
消息类型为邮件时不需要设置';
comment on column M_InnerMsg.msgState is
'未读/已读/删除';
comment on column M_InnerMsg.EmailId is
'用户配置多邮箱时使用';
comment on column M_InnerMsg.OptID is
'模块,或者表';
comment on column M_InnerMsg.OPTMethod is
'方法,或者字段';
comment on column M_InnerMsg.optTag is
'一般用于关联到业务主体';
alter table M_InnerMsg
add constraint PK_M_INNERMSG primary key (MsgCode);
/*==============================================================*/
/* Table: M_InnerMsg_Recipient */
/*==============================================================*/
create table M_InnerMsg_Recipient (
MsgCode VARCHAR(16) not null,
Receive VARCHAR(8) not null,
ReplyMsgCode INTEGER,
ReceiveType CHAR(1),
MailType CHAR(1),
msgState CHAR(1),
ID VARCHAR(16) not null
);
comment on table M_InnerMsg_Recipient is
'内部消息(邮件)与公告收件人及消息信息';
comment on column M_InnerMsg_Recipient.ReceiveType is
'P=个人为消息
A=机构为公告
M=邮件';
comment on column M_InnerMsg_Recipient.MailType is
'T=收件人
C=抄送
B=密送';
comment on column M_InnerMsg_Recipient.msgState is
'未读/已读/删除,收件人在线时弹出提示
U=未读
R=已读
D=删除';
alter table M_InnerMsg_Recipient
add constraint PK_M_INNERMSG_RECIPIENT primary key (ID);
/*==============================================================*/
/* Table: M_MsgAnnex */
/*==============================================================*/
create table M_MsgAnnex (
MsgCode VARCHAR(16) not null,
InfoCode VARCHAR(16) not null,
MsgAnnexId VARCHAR(16) not null
);
alter table M_MsgAnnex
add constraint PK_M_MSGANNEX primary key (MsgAnnexId);
/*==============================================================*/
/* Table: P_TASK_LIST */
/*==============================================================*/
create table P_TASK_LIST (
taskid decimal(12,0) not null,
taskowner VARCHAR(8) not null,
tasktag VARCHAR(1) not null,
taskrank VARCHAR(1) not null,
taskstatus VARCHAR(2) not null,
tasktitle VARCHAR(256) not null,
taskmemo VARCHAR(1000),
tasktype VARCHAR(8) not null,
OptID VARCHAR(64) not null,
OPTMethod VARCHAR(64),
optTag VARCHAR(200),
creator VARCHAR(32) not null,
created TIMESTAMP not null,
planbegintime TIMESTAMP not null,
planendtime TIMESTAMP,
begintime TIMESTAMP,
endtime TIMESTAMP,
finishmemo VARCHAR(1000),
noticeSign VARCHAR(1),
lastNoticeTime TIMESTAMP,
taskdeadline TIMESTAMP,
taskvalue VARCHAR(1048)
);
comment on column P_TASK_LIST.taskid is
'自动生成的主键,需要一个序列来配合';
comment on column P_TASK_LIST.taskowner is
'谁的任务';
comment on column P_TASK_LIST.tasktag is
'类似与outlook中的邮件标记,可以用不同的颜色的旗子图表标识';
comment on column P_TASK_LIST.taskrank is
'任务的优先级';
comment on column P_TASK_LIST.taskstatus is
'处理中、完成、取消、终止';
comment on column P_TASK_LIST.taskmemo is
'简要描述任务的具体内容';
comment on column P_TASK_LIST.tasktype is
'个人、组织活动、领导委派 等等';
comment on column P_TASK_LIST.OptID is
'模块,或者表';
comment on column P_TASK_LIST.OPTMethod is
'方法,或者字段';
comment on column P_TASK_LIST.optTag is
'一般用于关联到业务主体';
comment on column P_TASK_LIST.finishmemo is
'简要记录任务的执行过程和结果';
comment on column P_TASK_LIST.noticeSign is
'提醒标志为:禁止提醒、未提醒、已提醒';
comment on column P_TASK_LIST.lastNoticeTime is
'最后一次提醒时间,根据提醒策略可以提醒多次';
comment on column P_TASK_LIST.taskvalue is
'备用,字段不够时使用';
alter table P_TASK_LIST
add constraint PK_P_TASK_LIST primary key (taskid);
/*
/*==============================================================*/
/* View: F_V_Opt_Role_Map */
/*==============================================================*/
create or replace view F_V_Opt_Role_Map as
select c.opturl || b.opturl as opturl, b.optreq, a.rolecode, c.optid, b.optcode
from F_ROLEPOWER a
join F_OPTDEF b
on (a.optcode = b.optcode)
join f_optinfo c
on (b.optid = c.optid)
where c.OptType <> 'W'
and c.opturl <> '...'
--order by c.opturl, b.optreq, a.rolecode
;
/*==============================================================*/
/* View: F_V_USERROLES */
/*==============================================================*/
create or replace view F_V_USERROLES as
select distinct b.ROLECODE,b.ROLENAME,b.ISVALID,b.ROLEDESC,b.CREATEDATE,b.UPDATEDATE ,a.usercode
from F_USERROLE a join F_ROLEINFO b on (a.ROLECODE=b.ROLECODE)
where a.OBTAINDATE <= CURRENT TIMESTAMP and (a.SECEDEDATE is null or a.SECEDEDATE > CURRENT TIMESTAMP) and b.ISVALID='T'
union all
select d.ROLECODE,d.ROLENAME,d.ISVALID,d.ROLEDESC,d.CREATEDATE,d.UPDATEDATE , c.usercode
from f_userinfo c , F_ROLEINFO d
where d.rolecode = 'G-public'
;
/*==============================================================*/
/* View: F_V_UserOptDataScopes */
/*==============================================================*/
create or replace view F_V_UserOptDataScopes as
select distinct a.UserCode, c. OPTID , c.OPTMETHOD , b.optScopeCodes
from F_V_USERROLES a join F_ROLEPOWER b on (a.RoleCode=b.RoleCode)
join F_OPTDEF c on(b.OPTCODE=c.OPTCODE)
;
/*==============================================================*/
/* View: F_V_UserOptList */
/*==============================================================*/
create or replace view F_V_UserOptList as
select distinct a.UserCode, c.OPTCODE, c.OPTNAME , c. OPTID , c.OPTMETHOD
from F_V_USERROLES a join F_ROLEPOWER b on (a.RoleCode=b.RoleCode)
join F_OPTDEF c on(b.OPTCODE=c.OPTCODE)
;
/*==============================================================*/
/* View: F_V_UserOptMoudleList */
/*==============================================================*/
create or replace view F_V_UserOptMoudleList as
select distinct a.UserCode,d.OptID, d.OptName , d.PreOptID ,
d.FormCode, d.optroute, d.opturl, d.MsgNo , d.MsgPrm, d.IsInToolBar ,
d.ImgIndex,d.TopOptID ,d.OrderInd,d.PageType,d.opttype
from F_V_USERROLES a join F_ROLEPOWER b on (a.RoleCode=b.RoleCode)
join F_OPTDEF c on(b.OPTCODE=c.OPTCODE)
join F_OptInfo d on(c.OPTID=d.OptID)
where d.opturl<> '...'
;
/*==============================================================*/
/* View: V_Hi_Optinfo */
/*==============================================================*/
create or replace view V_Hi_Optinfo as
WITH RPL
(hi_level,optid,topoptid,preoptid
--,optname
)
AS
( SELECT 1 as hi_level,
optid,
preoptid as topoptid,
preoptid
--,optname
FROM f_optinfo
UNION ALL
SELECT PARENT.hi_level + 1 as hi_level,
CHILD.optid,
PARENT.topoptid ,
CHILD.preoptid
--, optname
FROM RPL PARENT, f_optinfo CHILD
WHERE PARENT.optid = CHILD.preoptid)
SELECT hi_level,
optid,
topoptid,
preoptid
--,optname
FROM RPL
;
;
/*==============================================================*/
/* View: f_v_optdef_url_map */
/*==============================================================*/
create or replace view f_v_optdef_url_map as
select c.opturl || b.opturl as optdefurl, b.optreq, b.optcode,
b.optdesc,b.optMethod , c.optid,b.OptName
from F_OPTDEF b join f_optinfo c
on (b.optid = c.optid)
where c.OptType <> 'W'
and c.opturl <> '...' and b.optreq is not null
;
/*==============================================================*/
/* View: f_v_wf_optdef_url_map */
/*==============================================================*/
create or replace view f_v_wf_optdef_url_map as
select c.opturl || b.opturl as optdefurl, b.optreq, b.optcode,
b.optdesc,b.optMethod , c.optid,b.OptName
from F_OPTDEF b join f_optinfo c
on (b.optid = c.optid)
where c.OptType = 'W'
and c.opturl <> '...' and b.optreq is not null
;
/*==============================================================*/
/* View: v_hi_unitinfo */
/*==============================================================*/
create or replace view v_hi_unitinfo as
WITH RPL
(LEVEL,UNITCODE,topunitcode,PARENTUNIT
,UNITTYPE,ISVALID,
UNITNAME,UNITSHORTNAME,UNITDESC,ADDRBOOKID,
unitOrder,unitWord,unitGrade
,UnitPath
)
AS
(SELECT 1 as LEVEL,
UNITCODE,
PARENTUNIT as topunitcode,
PARENTUNIT
,UNITTYPE,ISVALID,
UNITNAME,UNITSHORTNAME,UNITDESC,ADDRBOOKID,
unitOrder,unitWord,unitGrade,UnitPath
FROM f_Unitinfo
UNION ALL
SELECT PARENT.LEVEL + 1 as LEVEL,
CHILD.UNITCODE,
PARENT.topunitcode ,
CHILD.PARENTUNIT
,CHILD.UNITTYPE, CHILD.ISVALID,
CHILD.UNITNAME,CHILD.UNITSHORTNAME,CHILD.UNITDESC,CHILD.ADDRBOOKID,
CHILD.unitOrder,CHILD.unitWord,CHILD.unitGrade
,PARENT.UnitPath || '/'|| CHILD.UNITCODE as UnitPath
FROM RPL PARENT, f_Unitinfo CHILD
WHERE PARENT.UNITCODE = CHILD.PARENTUNIT)
SELECT LEVEL,
UNITCODE,
topunitcode,
PARENTUNIT
,UNITTYPE,ISVALID,
UNITNAME,UNITSHORTNAME,UNITDESC,ADDRBOOKID,
unitOrder,unitWord,unitGrade,UnitPath
FROM RPL
;
comment on table v_hi_unitinfo is
'下级部门可以通过语句
select * from v_hi_unitinfo
where topunitcode = ''机构代码来获取''
order by topunitcode,hi_level
需要视图
';
comment on column v_hi_unitinfo.unittype is
'发布任务/ 邮电规划/组队/接收任务';
comment on column v_hi_unitinfo.isvalid is
'T:生效 F:无效';
/*==============================================================*/
/* View: v_opt_tree */
/*==============================================================*/
create or replace view v_opt_tree as
select
MENU_ID,
PARENT_ID,
MENU_NAME,
ORDERIND
from
(select i.optid as MENU_ID,i.preoptid as PARENT_ID,i.optname as MENU_NAME,i.orderind
from f_optinfo i where i.isintoolbar ='Y')
union all
(select d.optcode as MENU_ID,d.optid as PARENT_ID,d.optname as MENU_NAME,0 as orderind
from f_optdef d)
-- order by orderind ASC
;
*/ |
use burgers_db;
insert into burgers (burger_name, devoured)
values
("Veggie", 0),
("Bacon Cheesburger", 0),
("Southwest Ranch", 0),
("Classic", 0 ),
("Avacado Toast", 0); |
REM ------------------------------------------------------------------------
REM REQUIREMENTS:
REM SELECT on dba_*
REM ------------------------------------------------------------------------
REM PURPOSE:
REM Show segments' segments for a given tablespace
REM ------------------------------------------------------------------------
set linesize 80
set pages 100
set feedback off
set verify off
col owner for a15 head Owner
col segment_name for a30 head "Segment Name"
col tablespace_name for a10 head "TS Name"
col segment_type for a9 trunc head Type
col extents for 999 head Ext
col KB for 99,999 head KB
set termout off
spool &2
break on tablespace_name
SELECT owner, segment_name, tablespace_name, segment_type,
extents, bytes/1024 KB
FROM dba_segments
WHERE tablespace_name like upper('&1')
ORDER BY tablespace_name, bytes
;
prompt
spool off
exit
|
CREATE ROLE spvchannels LOGIN
PASSWORD 'WR6NUJEyG-kYMKz9Z6Y9^%^SP^3kuX'
NOSUPERUSER INHERIT NOCREATEDB NOCREATEROLE NOREPLICATION;
GRANT ALL PRIVILEGES ON DATABASE spvchannels TO spvchannels;
GRANT SELECT, INSERT, UPDATE, DELETE ON ALL TABLES IN SCHEMA public TO spvchannels;
GRANT USAGE, SELECT ON ALL SEQUENCES IN SCHEMA public TO spvchannels; |
CREATE procedure sp_View_PurchaseReturn (@DocSerial int)
As
Select AdjustmentID, AdjustmentReturnAbstract.VendorID, Vendors.Vendor_Name,
AdjustmentDate, DocumentID, Total_Value, Balance, Status,DocReference,DocIdRef,
adjustmentIDRef,(select a.adjustmentdate from adjustmentreturnabstract a where adjustmentid=adjustmentreturnabstract.adjustmentidref),
Reference,DocSerialType ,GSTFlag, GSTDocID, GSTFullDocID
From AdjustmentReturnAbstract, Vendors
Where AdjustmentID = @DocSerial And
AdjustmentReturnAbstract.VendorID = Vendors.VendorID
|
set hive.execution.engine=spark;
use ods ;
drop table if exists dim.dimtmp_monthly_accumulative_work_date;
create table if not exists dim.dimtmp_monthly_accumulative_work_date (
yearmonth STRING COMMENT '年月',
day TIMESTAMP COMMENT '日期',
IsWorkDay bigint comment '是否工作日',
CumWorkDay bigint comment '月连续累计工作日',
CumWorkDay2 bigint comment '月间断累计工作日(非工作日不累计)',
TolWorkDay bigint comment '月总工作日'
);
insert overwrite table dim.dimtmp_monthly_accumulative_work_date
select
aa.yearmonth --年月
,aa.day --日期
,aa.IsWorkDay --是否工作日
,aa.CumWorkDay --月连续累计工作日
,aa.CumWorkDay2 --月间断累计工作日(非工作日不累计)
,TolWorkDay --月总工作日
from
(select
substr(a.day,1,7) yearmonth
,cast(a.day as timestamp) as `day`
,sum(case when b.is_work_day=1 then b.is_work_day else 0 end) CumWorkDay
,sum(case when b.is_work_day=1 then a.is_work_day else 0 end) CumWorkDay2
,max(a.is_work_day)IsWorkDay
from
dim.dim_c_work_calendar a
left join
dim.dim_c_work_calendar b
on substr(a.day,1,7)=substr(b.day,1,7) where b.day<=a.day
group by substr(a.day,1,7),a.day
order by day asc) as aa
left join
(select
substr(a.day,1,7) yearmonth
,sum(a.is_work_day) TolWorkDay
from
dim.dim_c_work_calendar a
where a.is_work_day=1
group by substr(a.day,1,7)) as bb
on aa.yearmonth=bb.yearmonth
order by day asc;
drop table if exists dim.dim_monthly_accumulative_work_date;
ALTER TABLE dim.dimtmp_monthly_accumulative_work_date RENAME TO dim.dim_monthly_accumulative_work_date; |
CREATE DATABASE IF NOT EXISTS `csc330project2` /*!40100 DEFAULT CHARACTER SET utf8 */;
USE `csc330project2`;
-- MySQL dump 10.13 Distrib 5.7.9, for Win64 (x86_64)
--
-- Host: localhost Database: csc330project2
-- ------------------------------------------------------
-- Server version 5.6.28-log
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `carriers`
--
DROP TABLE IF EXISTS `carriers`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `carriers` (
`idcarriers` int(11) NOT NULL,
`dayDeliver` varchar(45) DEFAULT NULL,
`idhouseholds` int(11) DEFAULT NULL,
`idpublications` int(11) DEFAULT NULL,
`price` double DEFAULT NULL,
PRIMARY KEY (`idcarriers`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `carriers`
--
LOCK TABLES `carriers` WRITE;
/*!40000 ALTER TABLE `carriers` DISABLE KEYS */;
INSERT INTO `carriers` VALUES (107148,'Friday',166141,862971,3.25),(108054,'Sunday',137675,204099,1.5),(108740,'Friday',166141,862971,3.25),(149988,'Friday',200332,511313,2),(176814,'Friday',200332,511313,2),(183989,'Friday',166141,862971,3.25),(203322,'Monday',149163,127544,2.75),(438980,'Saturday',945249,181955,4.2),(785696,'Saturday',945249,181955,4.2),(885579,'Friday',200332,511313,2),(910126,'Saturday',945249,181955,4.2);
/*!40000 ALTER TABLE `carriers` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `households`
--
DROP TABLE IF EXISTS `households`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `households` (
`idhouseholds` int(11) NOT NULL,
`firstName` varchar(45) DEFAULT NULL,
`lastName` varchar(45) DEFAULT NULL,
`pNumber` varchar(11) DEFAULT '0',
`streetName` varchar(45) DEFAULT NULL,
`houseNumber` varchar(45) DEFAULT NULL,
`aptNum` varchar(45) DEFAULT NULL,
`postal` varchar(45) DEFAULT NULL,
`subStatus` bit(1) DEFAULT b'1',
PRIMARY KEY (`idhouseholds`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `households`
--
LOCK TABLES `households` WRITE;
/*!40000 ALTER TABLE `households` DISABLE KEYS */;
INSERT INTO `households` VALUES (137069,'Nick','Raynin','0000001111','Midland','12',NULL,'10033',''),(137675,'Sarah','Pei-Zhu','7181637493','Place St','124',NULL,'10300',''),(149163,'Person','FDS','3211111111','Nowhere','2',NULL,'10000',''),(165472,'Natacha','G','7181231234','Victory Blvd','100',NULL,'10131',''),(166141,'Jeff','Dietrich','1005551000','Kingsley','39',NULL,'10300',''),(200332,'John','Cosentino','3477217803','Forest Avenue','859',NULL,'10310',''),(945249,'Michelle','Kushnir','8880000000','Lamoka','1',NULL,'10314','');
/*!40000 ALTER TABLE `households` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `logins`
--
DROP TABLE IF EXISTS `logins`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `logins` (
`username` varchar(45) NOT NULL,
`password` varchar(45) DEFAULT NULL,
PRIMARY KEY (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `logins`
--
LOCK TABLES `logins` WRITE;
/*!40000 ALTER TABLE `logins` DISABLE KEYS */;
INSERT INTO `logins` VALUES ('john','admin1'),('justin','1'),('maria','maria'),('Michelle','1'),('new person','pass'),('nick','nick'),('rad','1'),('radoslaw','1'),('vlad','vlad');
/*!40000 ALTER TABLE `logins` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `publications`
--
DROP TABLE IF EXISTS `publications`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `publications` (
`idpublications` int(11) NOT NULL,
`title` varchar(45) DEFAULT NULL,
`newsType` varchar(45) DEFAULT NULL,
`edition` varchar(45) DEFAULT NULL,
`price` double DEFAULT NULL,
PRIMARY KEY (`idpublications`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `publications`
--
LOCK TABLES `publications` WRITE;
/*!40000 ALTER TABLE `publications` DISABLE KEYS */;
INSERT INTO `publications` VALUES (100186,'SI Advance','Newspaper','Daily',2.25),(127544,'NY Times','Newspaper','Daily',2.75),(170041,'National Review','Magazine','Daily',2.5),(181955,'The Atlantic','Newspaper','Daily',3.75),(204099,'Vox','Magazine','Daily',4.5),(511313,'Washington Post','Newspaper','Daily',3.25),(517365,'RT','Magazine','Daily',1.75),(862971,'SI Advance','Newspaper','Weekly',3);
/*!40000 ALTER TABLE `publications` 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 2016-05-18 13:45:13
|
--PROBLEM 11
--Select all people who don't have tickets. Select their first name, last name and age .
--Order them by age (descending), first name (ascending) and last name (ascending).
SELECT
p.FirstName
,p.LastName
,p.Age
FROM Passengers AS p
LEFT JOIN Tickets AS t ON p.Id=t.PassengerId
WHERE t.Id IS NULL
ORDER BY p.Age DESC, p.FirstName, p.LastName
|
create table if not exists ddelivery_ddelivery
(
ID int(11) NOT NULL auto_increment,
PARAMS text,
ORDER_ID int(11),
ddelivery_ID int(12),
STATUS varchar(40),
MESSAGE text,
UPTIME varchar(10),
PRIMARY KEY(ID),
INDEX ix_ddelivery_ddeliveryoi (ORDER_ID)
);
/*//==backTown
CREATE TABLE ddelivery_ddelivery_cities (
ID int(11) NOT NULL,
NAME varchar(255) DEFAULT NULL,
AREA varchar(255) DEFAULT NULL,
REGION varchar(255) DEFAULT NULL,
KLADR varchar(30) DEFAULT NULL,
`TYPE` varchar(5) DEFAULT NULL,
DPD_ID int(11) DEFAULT NULL,
PRIORATY int(11) DEFAULT NULL,
PRIMARY KEY (ID)
);
*/
|
-- Navn, Beskrivelse
INSERT INTO Apparat (navn, beskrivelse) VALUES ('Benk', 'Benk med stang'), ('Mølle', 'Til løping'), ('Romaskin', 'Sånn man ror med'),
('Bakkeløp', 'Intervalltrening opp bakker'), ('Traktordekk', 'Crossfitraritet'),
('Sykkel', 'Sånn man sykler med'), ('Multiapparat', 'For diverse øvelser');
-- Navn
INSERT INTO Ovelsesgruppe (navn) VALUES ('Brystøvelser'),('Ryggøvelser'),('Beinøvelser'),('Kondisjonsøvelse'),
('Bicepsøvelser'),('Tricepsøvelser'),('Magesøvelse'),('Skulderøvelser');
-- Navn, Gruppe
INSERT INTO Ovelse (navn, gruppeID) VALUES ('Benkpress',1),('Roing',2),('Dips',6);
-- ('Bakkeløp',4),('Jogging',4),('Utfall',3),('Knebøy',3),
-- ('Bicepscurl',5),('Militærpress',8),('Hangups',2),('Triceps pushdown',6),
-- ('Sykling',4),('Sittende roing',2),('Pushups',1),('Situps',7);
-- ØvelseID, Beskrivelse
INSERT INTO Frittstaende (ovelseID, beskrivelse) VALUES (3,'Dipsbeskrivelse');
-- ,(4,'Bakkeløp er bare løping'),
-- (5,'Jogging er kjedelig løping'),(6,'Dont skip leg day'),(7,'SQUAT'),(14,'For them abs');
-- ØvelseID, Antall kg, Antall sett, Apparat
INSERT INTO Fastmontert (ovelseID, antall_kg, antall_sett, apparat) VALUES (1,120,10,1),(2,10,3,3);
-- (10,85,3,7),(12,50,3,7);
-- Navn, Tlf.nr, Favorittøvelse
INSERT INTO Person (navn, tlfnr, favorittovelse) VALUES ('Kjell Aukrust',69696969,1),('Harald Heide Steen',41454554,1),
('OJ (not Simpson)',98564211,3),('Halvor',97470077,2),('Simen',44111425,3),('Turid-Laila',73805520,3);
-- Dato YYYY-MM-DD, Tidspunkt hh:mm:ss, Varighet [min], Form, Prestasjon, Treningspartner, Notat
INSERT INTO Treningsokt (dato,tidspunkt,varighet,form,prestasjon,treningspartner,notat) VALUES ('2019-03-02', '13:08:00', 60, 9, 7,NULL,'OK'),
('2018-12-29','10:08:34',35,4,8,3,'God kok, Tutten kjører svett push'),('2010-08-07','22:09:00',120,10,10,NULL,'Kai prepper prottispulver i garderoben, mæget god S'),
('2018-12-28','08:00:10', 55,2,3,4,'Spysjuk etter et heidundrandes kalas med Roger, men gønnsa må pumpes'),('2019-01:30','12:23:56',67,10,10,6,'Turid-Laila på mølla må jo bli bra'),
('2016-10-14','14:45:32',14,1,2,2,'Nøtternte å løpe bakkeløp i hasjrus'),('20119-03-01','23:14:09',44,8,9,NULL,'OK');
-- ØktID, ØvelseID
INSERT INTO Ovelseriokt (oktID,ovelseID)VALUES (1,1),(1,3),(2,2),(2,3),(3,1),(3,2),(3,3);
|
ALTER TABLE customers_addresses RENAME COLUMN customer_id TO owner_id;
|
-- phpMyAdmin SQL Dump
-- version 4.6.4
-- https://www.phpmyadmin.net/
--
-- Servidor: 127.0.0.1
-- Tiempo de generación: 25-06-2017 a las 21:45:13
-- Versión del servidor: 5.7.14
-- Versión de PHP: 5.6.25
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Base de datos: `registro`
--
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `usuarios`
--
CREATE TABLE `usuarios` (
`id` int(4) NOT NULL,
`rfc` varchar(25) NOT NULL,
`numEmpleado` varchar(25) NOT NULL,
`correo` varchar(40) NOT NULL,
`usuario` varchar(40) NOT NULL,
`contrasena` varchar(8) NOT NULL,
`imagen` longblob
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Volcado de datos para la tabla `usuarios`
--
INSERT INTO `usuarios` (`id`, `rfc`, `numEmpleado`, `correo`, `usuario`, `contrasena`, `imagen`) VALUES
(1, '12370743', '1234', 'estela_blanca@hotmail.com', 'Estel', '3456', 0x63686c6f652e6a7067),
(2, '12370989', '6789ndav', 'estela@gmail.com', 'root', '7890', NULL),
(3, '1234', 'rrttq', 'admin@admin.com', 'admin', 'admin', NULL);
--
-- Índices para tablas volcadas
--
--
-- Indices de la tabla `usuarios`
--
ALTER TABLE `usuarios`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT de las tablas volcadas
--
--
-- AUTO_INCREMENT de la tabla `usuarios`
--
ALTER TABLE `usuarios`
MODIFY `id` int(4) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
CREATE TABLE [Client].[RemoteServerNode] (
[Guid] UNIQUEIDENTIFIER NOT NULL,
[Server] [sysname] NULL,
[CPU] NVARCHAR (2000) NULL,
[NumberOfLogicalProcessors] SMALLINT NULL,
[Cores] SMALLINT NULL
);
|
2018-10-17 00:00:45
controller: AlarmController action: getAlarmData
select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc
3.810ms
select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0
2.560ms
select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540310400 group by `lottery_id`
601.250ms
select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc
2.900ms
select * from `admin_users` where `admin_users`.`id` = 6 limit 1
2.590ms
2018-10-17 00:01:45
controller: AlarmController action: getAlarmData
select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc
3.010ms
select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0
1.960ms
select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540310400 group by `lottery_id`
546.090ms
select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc
2.730ms
select * from `admin_users` where `admin_users`.`id` = 6 limit 1
5.890ms
2018-10-17 00:02:45
controller: AlarmController action: getAlarmData
select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc
7.830ms
select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0
3.190ms
select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540310400 group by `lottery_id`
439.490ms
select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc
10.800ms
select * from `admin_users` where `admin_users`.`id` = 6 limit 1
3.040ms
2018-10-17 00:03:45
controller: AlarmController action: getAlarmData
select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc
12.020ms
select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0
3.020ms
select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540310400 group by `lottery_id`
444.440ms
select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc
2.890ms
select * from `admin_users` where `admin_users`.`id` = 6 limit 1
2.710ms
2018-10-17 00:04:45
controller: AlarmController action: getAlarmData
select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc
3.670ms
select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0
3.570ms
select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540310400 group by `lottery_id`
553.920ms
select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc
2.980ms
select * from `admin_users` where `admin_users`.`id` = 6 limit 1
2.520ms
2018-10-17 00:05:45
controller: AlarmController action: getAlarmData
select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc
3.600ms
select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0
4.860ms
select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540310400 group by `lottery_id`
496.910ms
select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc
2.600ms
select * from `admin_users` where `admin_users`.`id` = 6 limit 1
2.390ms
2018-10-17 00:06:45
controller: AlarmController action: getAlarmData
select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc
3.170ms
select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0
2.560ms
select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540310400 group by `lottery_id`
418.480ms
select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc
3.020ms
select * from `admin_users` where `admin_users`.`id` = 6 limit 1
2.420ms
2018-10-17 00:07:45
controller: AlarmController action: getAlarmData
select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc
8.720ms
select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0
2.100ms
select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540310400 group by `lottery_id`
347.280ms
select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc
3.090ms
select * from `admin_users` where `admin_users`.`id` = 6 limit 1
2.750ms
2018-10-17 00:08:45
controller: AlarmController action: getAlarmData
select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc
3.560ms
select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0
3.740ms
select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540310400 group by `lottery_id`
576.380ms
select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc
21.560ms
select * from `admin_users` where `admin_users`.`id` = 6 limit 1
6.150ms
2018-10-17 00:09:45
controller: AlarmController action: getAlarmData
select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc
6.790ms
select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0
2.640ms
select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540310400 group by `lottery_id`
336.620ms
select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc
6.650ms
select * from `admin_users` where `admin_users`.`id` = 6 limit 1
2.410ms
2018-10-17 00:10:45
controller: AlarmController action: getAlarmData
select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc
3.080ms
select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0
2.860ms
select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540310400 group by `lottery_id`
188.740ms
select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc
2.700ms
select * from `admin_users` where `admin_users`.`id` = 6 limit 1
2.920ms
2018-10-17 00:11:45
controller: AlarmController action: getAlarmData
select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc
3.200ms
select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0
2.770ms
select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540310400 group by `lottery_id`
209.090ms
select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc
3.070ms
select * from `admin_users` where `admin_users`.`id` = 6 limit 1
3.290ms
2018-10-17 00:12:45
controller: AlarmController action: getAlarmData
select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc
3.060ms
select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0
1.930ms
select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540310400 group by `lottery_id`
498.200ms
select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc
3.640ms
select * from `admin_users` where `admin_users`.`id` = 6 limit 1
2.690ms
2018-10-17 00:13:45
controller: AlarmController action: getAlarmData
select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc
2.850ms
select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0
2.430ms
select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540310400 group by `lottery_id`
176.790ms
select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc
2.650ms
select * from `admin_users` where `admin_users`.`id` = 6 limit 1
2.480ms
2018-10-17 00:14:45
controller: AlarmController action: getAlarmData
select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc
3.650ms
select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0
4.150ms
select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540310400 group by `lottery_id`
260.490ms
select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc
2.810ms
select * from `admin_users` where `admin_users`.`id` = 6 limit 1
2.390ms
2018-10-17 00:15:45
controller: AlarmController action: getAlarmData
select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc
14.410ms
select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0
3.240ms
select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540310400 group by `lottery_id`
178.630ms
select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc
2.760ms
select * from `admin_users` where `admin_users`.`id` = 6 limit 1
2.700ms
2018-10-17 00:16:46
controller: AlarmController action: getAlarmData
select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc
3.810ms
select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0
1.980ms
select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540310400 group by `lottery_id`
678.540ms
select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc
4.290ms
select * from `admin_users` where `admin_users`.`id` = 6 limit 1
3.240ms
2018-10-17 00:17:45
controller: AlarmController action: getAlarmData
select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc
9.710ms
select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0
2.710ms
select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540310400 group by `lottery_id`
210.920ms
select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc
4.830ms
select * from `admin_users` where `admin_users`.`id` = 6 limit 1
2.370ms
2018-10-17 00:18:45
controller: AlarmController action: getAlarmData
select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc
4.060ms
select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0
2.780ms
select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540310400 group by `lottery_id`
328.960ms
select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc
3.480ms
select * from `admin_users` where `admin_users`.`id` = 6 limit 1
2.520ms
2018-10-17 00:19:45
controller: AlarmController action: getAlarmData
select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc
3.400ms
select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0
2.770ms
select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540310400 group by `lottery_id`
212.950ms
select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc
3.560ms
select * from `admin_users` where `admin_users`.`id` = 6 limit 1
2.450ms
2018-10-17 00:20:45
controller: AlarmController action: getAlarmData
select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc
4.140ms
select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0
3.450ms
select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540310400 group by `lottery_id`
232.610ms
select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc
4.400ms
select * from `admin_users` where `admin_users`.`id` = 6 limit 1
2.660ms
2018-10-17 00:21:45
controller: AlarmController action: getAlarmData
select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc
3.070ms
select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0
2.040ms
select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540310400 group by `lottery_id`
174.910ms
select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc
3.680ms
select * from `admin_users` where `admin_users`.`id` = 6 limit 1
2.620ms
2018-10-17 00:22:46
controller: AlarmController action: getAlarmData
select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc
3.180ms
select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0
2.910ms
select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540310400 group by `lottery_id`
486.700ms
select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc
4.650ms
select * from `admin_users` where `admin_users`.`id` = 6 limit 1
3.200ms
2018-10-17 00:23:46
controller: AlarmController action: getAlarmData
select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc
11.430ms
select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0
2.560ms
select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540310400 group by `lottery_id`
790.170ms
select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc
3.800ms
select * from `admin_users` where `admin_users`.`id` = 6 limit 1
2.600ms
2018-10-17 00:24:45
controller: AlarmController action: getAlarmData
select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc
8.690ms
select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0
3.110ms
select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540310400 group by `lottery_id`
241.940ms
select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc
3.760ms
select * from `admin_users` where `admin_users`.`id` = 6 limit 1
2.600ms
2018-10-17 00:25:45
controller: AlarmController action: getAlarmData
select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc
2.990ms
select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0
2.570ms
select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540310400 group by `lottery_id`
213.430ms
select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc
4.510ms
select * from `admin_users` where `admin_users`.`id` = 6 limit 1
4.600ms
2018-10-17 00:26:46
controller: AlarmController action: getAlarmData
select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc
3.380ms
select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0
2.240ms
select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540310400 group by `lottery_id`
488.870ms
select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc
3.740ms
select * from `admin_users` where `admin_users`.`id` = 6 limit 1
2.400ms
2018-10-17 00:27:46
controller: AlarmController action: getAlarmData
select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc
2.880ms
select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0
2.590ms
select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540310400 group by `lottery_id`
234.230ms
select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc
4.180ms
select * from `admin_users` where `admin_users`.`id` = 6 limit 1
4.310ms
2018-10-17 00:28:46
controller: AlarmController action: getAlarmData
select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc
3.160ms
select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0
2.810ms
select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540310400 group by `lottery_id`
485.090ms
select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc
3.460ms
select * from `admin_users` where `admin_users`.`id` = 6 limit 1
2.620ms
2018-10-17 00:29:46
controller: AlarmController action: getAlarmData
select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc
3.210ms
select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0
3.010ms
select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540310400 group by `lottery_id`
410.650ms
select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc
3.810ms
select * from `admin_users` where `admin_users`.`id` = 6 limit 1
2.570ms
2018-10-17 00:30:46
controller: AlarmController action: getAlarmData
select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc
3.380ms
select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0
3.000ms
select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540310400 group by `lottery_id`
556.980ms
select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc
5.300ms
select * from `admin_users` where `admin_users`.`id` = 6 limit 1
2.820ms
2018-10-17 00:31:46
controller: AlarmController action: getAlarmData
select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc
3.450ms
select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0
2.110ms
select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540310400 group by `lottery_id`
639.340ms
select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc
7.520ms
select * from `admin_users` where `admin_users`.`id` = 6 limit 1
2.700ms
2018-10-17 00:32:46
controller: AlarmController action: getAlarmData
select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc
3.360ms
select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0
2.560ms
select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540310400 group by `lottery_id`
500.400ms
select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc
5.550ms
select * from `admin_users` where `admin_users`.`id` = 6 limit 1
2.990ms
2018-10-17 00:33:46
controller: AlarmController action: getAlarmData
select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc
3.760ms
select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0
2.990ms
select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540310400 group by `lottery_id`
597.690ms
select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc
3.840ms
select * from `admin_users` where `admin_users`.`id` = 6 limit 1
2.730ms
2018-10-17 00:34:46
controller: AlarmController action: getAlarmData
select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc
3.200ms
select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0
5.700ms
select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540310400 group by `lottery_id`
731.010ms
select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc
11.640ms
select * from `admin_users` where `admin_users`.`id` = 6 limit 1
2.960ms
2018-10-17 00:35:46
controller: AlarmController action: getAlarmData
select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc
6.260ms
select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0
2.800ms
select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540310400 group by `lottery_id`
195.080ms
select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc
4.300ms
select * from `admin_users` where `admin_users`.`id` = 6 limit 1
2.500ms
2018-10-17 00:36:46
controller: AlarmController action: getAlarmData
select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc
9.680ms
select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0
2.190ms
select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540310400 group by `lottery_id`
411.290ms
select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc
3.430ms
select * from `admin_users` where `admin_users`.`id` = 6 limit 1
2.670ms
2018-10-17 00:37:46
controller: AlarmController action: getAlarmData
select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc
3.510ms
select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0
2.600ms
select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540310400 group by `lottery_id`
780.930ms
select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc
3.870ms
select * from `admin_users` where `admin_users`.`id` = 6 limit 1
5.790ms
2018-10-17 00:38:46
controller: AlarmController action: getAlarmData
select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc
3.330ms
select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0
4.180ms
select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540310400 group by `lottery_id`
667.250ms
select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc
3.460ms
select * from `admin_users` where `admin_users`.`id` = 6 limit 1
2.380ms
2018-10-17 00:39:46
controller: AlarmController action: getAlarmData
select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc
3.350ms
select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0
2.590ms
select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540310400 group by `lottery_id`
180.310ms
select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc
3.120ms
select * from `admin_users` where `admin_users`.`id` = 6 limit 1
2.530ms
2018-10-17 00:40:46
controller: AlarmController action: getAlarmData
select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc
2.790ms
select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0
3.280ms
select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540310400 group by `lottery_id`
423.920ms
select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc
12.090ms
select * from `admin_users` where `admin_users`.`id` = 6 limit 1
3.920ms
2018-10-17 00:41:46
controller: AlarmController action: getAlarmData
select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc
6.630ms
select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0
2.310ms
select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540310400 group by `lottery_id`
446.100ms
select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc
3.780ms
select * from `admin_users` where `admin_users`.`id` = 6 limit 1
3.230ms
2018-10-17 00:42:46
controller: AlarmController action: getAlarmData
select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc
3.300ms
select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0
3.210ms
select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540310400 group by `lottery_id`
220.530ms
select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc
3.850ms
select * from `admin_users` where `admin_users`.`id` = 6 limit 1
27.180ms
2018-10-17 00:43:46
controller: AlarmController action: getAlarmData
select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc
10.950ms
select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0
2.850ms
select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540310400 group by `lottery_id`
274.200ms
select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc
3.390ms
select * from `admin_users` where `admin_users`.`id` = 6 limit 1
2.540ms
2018-10-17 00:44:46
controller: AlarmController action: getAlarmData
select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc
3.310ms
select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0
2.840ms
select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540310400 group by `lottery_id`
177.570ms
select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc
3.840ms
select * from `admin_users` where `admin_users`.`id` = 6 limit 1
2.680ms
2018-10-17 00:45:46
controller: AlarmController action: getAlarmData
select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc
2.850ms
select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0
2.760ms
select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540310400 group by `lottery_id`
182.290ms
select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc
3.840ms
select * from `admin_users` where `admin_users`.`id` = 6 limit 1
2.660ms
2018-10-17 00:46:46
controller: AlarmController action: getAlarmData
select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc
14.650ms
select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0
3.400ms
select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540310400 group by `lottery_id`
466.820ms
select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc
7.550ms
select * from `admin_users` where `admin_users`.`id` = 6 limit 1
2.480ms
2018-10-17 00:47:46
controller: AlarmController action: getAlarmData
select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc
3.050ms
select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0
2.720ms
select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540310400 group by `lottery_id`
181.760ms
select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc
9.140ms
select * from `admin_users` where `admin_users`.`id` = 6 limit 1
2.490ms
2018-10-17 00:48:46
controller: AlarmController action: getAlarmData
select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc
11.530ms
select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0
6.700ms
select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540310400 group by `lottery_id`
206.420ms
select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc
3.380ms
select * from `admin_users` where `admin_users`.`id` = 6 limit 1
2.410ms
2018-10-17 00:49:47
controller: AlarmController action: getAlarmData
select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc
3.590ms
select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0
3.920ms
select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540310400 group by `lottery_id`
591.460ms
select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc
3.380ms
select * from `admin_users` where `admin_users`.`id` = 6 limit 1
2.470ms
2018-10-17 00:50:47
controller: AlarmController action: getAlarmData
select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc
3.570ms
select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0
3.010ms
select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540310400 group by `lottery_id`
428.100ms
select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc
4.390ms
select * from `admin_users` where `admin_users`.`id` = 6 limit 1
2.620ms
2018-10-17 00:51:47
controller: AlarmController action: getAlarmData
select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc
10.560ms
select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0
2.410ms
select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540310400 group by `lottery_id`
550.740ms
select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc
3.760ms
select * from `admin_users` where `admin_users`.`id` = 6 limit 1
2.530ms
2018-10-17 00:52:47
controller: AlarmController action: getAlarmData
select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc
3.180ms
select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0
3.100ms
select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540310400 group by `lottery_id`
660.120ms
select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc
4.230ms
select * from `admin_users` where `admin_users`.`id` = 6 limit 1
2.860ms
2018-10-17 00:53:47
controller: AlarmController action: getAlarmData
select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc
3.350ms
select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0
2.920ms
select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540310400 group by `lottery_id`
777.090ms
select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc
12.190ms
select * from `admin_users` where `admin_users`.`id` = 6 limit 1
2.880ms
2018-10-17 00:54:47
controller: AlarmController action: getAlarmData
select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc
3.360ms
select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0
3.030ms
select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540310400 group by `lottery_id`
292.620ms
select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc
4.630ms
select * from `admin_users` where `admin_users`.`id` = 6 limit 1
2.710ms
2018-10-17 00:55:47
controller: AlarmController action: getAlarmData
select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc
3.460ms
select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0
3.100ms
select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540310400 group by `lottery_id`
463.230ms
select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc
4.000ms
select * from `admin_users` where `admin_users`.`id` = 6 limit 1
3.040ms
2018-10-17 00:56:47
controller: AlarmController action: getAlarmData
select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc
3.370ms
select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0
1.930ms
select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540310400 group by `lottery_id`
446.390ms
select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc
4.760ms
select * from `admin_users` where `admin_users`.`id` = 6 limit 1
2.610ms
2018-10-17 00:57:47
controller: AlarmController action: getAlarmData
select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc
3.210ms
select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0
3.050ms
select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540310400 group by `lottery_id`
575.310ms
select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc
3.960ms
select * from `admin_users` where `admin_users`.`id` = 6 limit 1
2.440ms
2018-10-17 00:58:47
controller: AlarmController action: getAlarmData
select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc
3.650ms
select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0
2.820ms
select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540310400 group by `lottery_id`
543.080ms
select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc
4.010ms
select * from `admin_users` where `admin_users`.`id` = 6 limit 1
3.190ms
2018-10-17 00:59:47
controller: AlarmController action: getAlarmData
select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc
3.260ms
select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0
2.840ms
select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540310400 group by `lottery_id`
384.920ms
select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc
5.150ms
select * from `admin_users` where `admin_users`.`id` = 6 limit 1
2.560ms
|
/*
客诉管理
*/
delimiter $
drop trigger if exists Tgr_Complaints_AftereDelete $
create trigger Tgr_Complaints_AftereDelete after delete
on Complaints
for each row
begin
call Proc_Settlements_SumClaimAmount(old.InvoiceNO);-- 结算中心-索赔金额
call Proc_Settlements_MathGrossProfit(old.rid);-- 结算中心-实际业务毛利
end$
delimiter ; |
source createobjects.sql;
source createuser.sql;
|
CREATE PROCEDURE sp_list_GRN_DocLU (@FromDocID int,@ToDocID int,@DocumentRef nvarchar(510)=N'')
AS
If Len(@DocumentRef)=0
Begin
SELECT GRNID, GRNDate, Vendors.Vendor_Name, GRNAbstract.VendorID, GRNStatus, DocumentID,
DocumentReference,DocSerialType
FROM GRNAbstract, Vendors
WHERE GRNAbstract.VendorID = Vendors.VendorID
AND (DocumentID BETWEEN @FromDocID AND @ToDocID
OR (Case Isnumeric(DocumentReference) When 1 then Cast(DocumentReference as int)end) BETWEEN @FromDocID AND @ToDocID)
ORDER BY Vendors.Vendor_Name, GRNDate, GRNID
end
Else
Begin
SELECT GRNID, GRNDate, Vendors.Vendor_Name, GRNAbstract.VendorID, GRNStatus, DocumentID,
DocumentReference,DocSerialType
FROM GRNAbstract, Vendors
WHERE GRNAbstract.VendorID = Vendors.VendorID
And DocumentReference LIKE @DocumentRef + N'%' + N'[0-9]'
And (CAse ISnumeric(Substring(DocumentReference,Len(@DocumentRef)+1,Len(DocumentReference)))
When 1 then Cast(Substring(DocumentReference,Len(@DocumentRef)+1,Len(DocumentReference))as int)End) BETWEEN @FromDocID AND @ToDocID
ORDER BY Vendors.Vendor_Name, GRNDate, GRNID
End
|
# --- !Ups
INSERT INTO fields (id, name)
VALUES (1, 'Software')
ON CONFLICT DO NOTHING;
INSERT INTO fields (id, name)
VALUES (2, 'Food and Wine')
ON CONFLICT DO NOTHING;
INSERT INTO jobs (id, field, name, from_date, to_date, country, description, requirement)
VALUES (1, 1, 'Scala Magician', '2018-02-01', '2018-10-01', 'Sweden',
'Wonderful experience that will make you grow as a developer.',
'Inner beauty.')
ON CONFLICT DO NOTHING;
INSERT INTO jobs (id, field, name, from_date, to_date, country, description, requirement)
VALUES (2, 2, 'Sous Chef', '2018-03-01', '2018-10-01', 'Denmark',
'Yummy', 'Cooking skills')
ON CONFLICT DO NOTHING;
INSERT INTO competences (id, name)
VALUES (1, 'Erlang')
ON CONFLICT DO NOTHING;
INSERT INTO competences (id, name)
VALUES (2, 'Trapezoid Balancing')
ON CONFLICT DO NOTHING;
# --- !Downs
|
/*
================================================================================
INDEXES
================================================================================
================================================================================
For a given table, the INDEX stores a set of presorted data
from one or more columns that you designate. Also stored in
the INDEX is the address of data from the source table. SQL
can use the INDEX object to speed up querying of WHERE and
ORDER BY clauses.
Each DML statement that modifies data in a table that is
indexed will also perform index maintenance as required. In
other words, each index you add to a table puts more workload
on each DML statement that affects indexed data.
PERFORMANCE ISSUES
Each index added to a table can potentially increase the
workload on future INSERT, UPDATE, and DELETE statements.
Implicit Index Creation
---------------------------------------------------------------
If you create a constraint on a table that is of type
PRIMARY KEY or UNIQUE, then as part of the creation of the
constraint, SQL will automatically create an index to support
that constraint on the column or columns, if such an index
does not already exist.
Dropping a constraint will drop the INDEX as well, only if the
index was created implicity. In case it was created explicitly
...
, CONSTRAINT PRIMARY KEY my_pk (col1) USING INDEX (CREATE INDEX myidx ON tablename (col1) )
...
it will not be dropped while dropping the constraint.
UNIQUE Index
---------------------------------------------------------------
This SQL statement creates an index that will ensure that data
entered into the SSN column of the table EMPLOYEES is unique.
CREATE UNIQUE INDEX IX_EMP_SSN ON EMPLOYEES(SSN);
You cannot (obviousy) create a UNIQUE BITMAP index.
This is different from the UNIQUE constraint that you can apply
to a column on a table. However, note that if you create a
PRIMARY KEY or UNIQUE constraint on a table, a unique index will
automatically be created along with the constraint.
DROP INDEX IX_EMP_SSN;
if you drop a table upon which an index is based, the index is
automatically dropped.
*/
-- EXAMPLES --
/*
Let's create a SEMINARS table with two constraints, a PK and a UQ constraint
*/
CREATE TABLE SEMINARS
(SEMINAR_ID NUMBER(11) CONSTRAINT SEMINARS$PK PRIMARY KEY,
SEMINAR_NAME VARCHAR2(30) CONSTRAINT SEMINARS$UN UNIQUE,
SEMINAR_ALT_NAME VARCHAR2(30)
);
/*
This statement will create the table SEMINARS
- two CONSTRAINTs
- two INDEX objects.
*/
SELECT INDEX_NAME, COLUMN_NAME , INDEX_TYPE, TABLE_NAME, UNIQUENESS
FROM USER_INDEXES
NATURAL JOIN USER_IND_COLUMNS
WHERE TABLE_NAME = 'SEMINARS'
ORDER BY INDEX_NAME;
SELECT CONSTRAINT_NAME, COLUMN_NAME , CONSTRAINT_TYPE, TABLE_NAME, STATUS, DEFERRABLE, DEFERRED, INDEX_NAME
FROM USER_CONSTRAINTS
NATURAL JOIN USER_CONS_COLUMNS
WHERE TABLE_NAME = 'SEMINARS'
;
/* Let's create a UNIQUE INDEX on SEMINARS table */
CREATE UNIQUE INDEX SEMINARS$UN2 ON SEMINARS (SEMINAR_ALT_NAME);
/* Now we have 3 indexes... */
SELECT INDEX_NAME, COLUMN_NAME , INDEX_TYPE, TABLE_NAME, UNIQUENESS
FROM USER_INDEXES
NATURAL JOIN USER_IND_COLUMNS
WHERE TABLE_NAME = 'SEMINARS'
ORDER BY INDEX_NAME;
/* ... but still have 2 constraints */
SELECT CONSTRAINT_NAME, COLUMN_NAME , CONSTRAINT_TYPE, TABLE_NAME, STATUS, DEFERRABLE, DEFERRED, INDEX_NAME
FROM USER_CONSTRAINTS
NATURAL JOIN USER_CONS_COLUMNS
WHERE TABLE_NAME = 'SEMINARS'
;
/* * * * * * * * * * * * * * * * * * * * * * * * * *
Let's try to violate the UNIQUE constraint
* * * * * * * * * * * * * * * * * * * * * * * * * */
INSERT INTO SEMINARS VALUES (1,'ORACLE DATABASE TUNING', 'SEMINAR 1'); -- OK
INSERT INTO SEMINARS VALUES (2,'ORACLE DATABASE TUNING', 'SEMINAR 2'); -- UN VIOLATION
ROLLBACK;
/*
If we try to drop the index, we'll get an error:
ORA-02429: impossibile eliminare indice usato per imposizione di chiave unica/primaria
*/
DROP INDEX SEMINARS$UN;
/* We have to drop the constraint instead... */
ALTER TABLE SEMINARS DROP CONSTRAINT SEMINARS$UN;
/* ...this will drop the constraint and the index enforcing it */
SELECT INDEX_NAME, COLUMN_NAME , INDEX_TYPE, TABLE_NAME, UNIQUENESS
FROM USER_INDEXES
NATURAL JOIN USER_IND_COLUMNS
WHERE TABLE_NAME = 'SEMINARS'
ORDER BY INDEX_NAME;
SELECT CONSTRAINT_NAME, COLUMN_NAME , CONSTRAINT_TYPE, TABLE_NAME, STATUS, DEFERRABLE, DEFERRED, INDEX_NAME
FROM USER_CONSTRAINTS
NATURAL JOIN USER_CONS_COLUMNS
WHERE TABLE_NAME = 'SEMINARS'
;
/* Let's try insertion again */
INSERT INTO SEMINARS VALUES (1,'ORACLE DATABASE TUNING', 'SEMINAR 1'); -- OK
INSERT INTO SEMINARS VALUES (2,'ORACLE DATABASE TUNING', 'SEMINAR 2'); -- OK
ROLLBACK;
/* * * * * * * * * * * * * * * * * * * * * * * * * *
Let's try to violate the PRIMARY KEY constraint
* * * * * * * * * * * * * * * * * * * * * * * * * */
INSERT INTO SEMINARS VALUES (1,'ORACLE DATABASE TUNING', 'SEMINAR 1'); -- OK
INSERT INTO SEMINARS VALUES (1,'SQL FOUNDAMENTALS', 'SEMINAR 2'); -- PK VIOLATION
ROLLBACK;
/*
If we try to drop the index, we'll get an error:
ORA-02429: impossibile eliminare indice usato per imposizione di chiave unica/primaria
*/
DROP INDEX SEMINARS$PK;
/* We have to drop the constraint instead... */
ALTER TABLE SEMINARS DROP PRIMARY KEY;
-- or as an alternative
-- ALTER TABLE SEMINARS DROP CONSTRAINT SEMINARS$PK;
/* ...this will drop the constraint and the index enforcing it */
SELECT INDEX_NAME, COLUMN_NAME , INDEX_TYPE, TABLE_NAME, UNIQUENESS
FROM USER_INDEXES
NATURAL JOIN USER_IND_COLUMNS
WHERE TABLE_NAME = 'SEMINARS'
ORDER BY INDEX_NAME;
SELECT CONSTRAINT_NAME, COLUMN_NAME , CONSTRAINT_TYPE, TABLE_NAME, STATUS, DEFERRABLE, DEFERRED, INDEX_NAME
FROM USER_CONSTRAINTS
NATURAL JOIN USER_CONS_COLUMNS
WHERE TABLE_NAME = 'SEMINARS'
;
/* Let's try insertion again */
INSERT INTO SEMINARS VALUES (1,'ORACLE DATABASE TUNING', 'SEMINAR 1'); -- OK
INSERT INTO SEMINARS VALUES (1,'SQL FOUNDAMENTALS', 'SEMINAR 2'); -- OK
ROLLBACK;
/* * * * * * * * * * * * * * * * * * * * * * * * * *
Let's try to violate the UNIQUE INDEX
* * * * * * * * * * * * * * * * * * * * * * * * * */
INSERT INTO SEMINARS VALUES (1,'ORACLE DATABASE TUNING', 'SEMINAR 1'); -- OK
INSERT INTO SEMINARS VALUES (2,'SQL FOUNDAMENTALS', 'SEMINAR 1'); -- UNIQUE INDEX VIOLATION
ROLLBACK;
-- Let's drop the index
DROP INDEX SEMINARS$UN2;
/* ...this will drop the constraint and the index enforcing it */
SELECT INDEX_NAME, COLUMN_NAME , INDEX_TYPE, TABLE_NAME, UNIQUENESS
FROM USER_INDEXES
NATURAL JOIN USER_IND_COLUMNS
WHERE TABLE_NAME = 'SEMINARS'
ORDER BY INDEX_NAME;
INSERT INTO SEMINARS VALUES (1,'ORACLE DATABASE TUNING', 'SEMINAR 1'); -- OK
INSERT INTO SEMINARS VALUES (2,'SQL FOUNDAMENTALS', 'SEMINAR 1'); -- OK
ROLLBACK;
/*
At this point table SEMINARS no longer has any constraint or index
Let's recreate the UNIQUE INDEX we dropped.
*/
CREATE UNIQUE INDEX SEMINARS$UN2 ON SEMINARS (SEMINAR_ALT_NAME);
SELECT INDEX_NAME, COLUMN_NAME , INDEX_TYPE, TABLE_NAME, UNIQUENESS
FROM USER_INDEXES
NATURAL JOIN USER_IND_COLUMNS
WHERE TABLE_NAME = 'SEMINARS'
ORDER BY INDEX_NAME;
SELECT CONSTRAINT_NAME, COLUMN_NAME , CONSTRAINT_TYPE, TABLE_NAME, STATUS, DEFERRABLE, DEFERRED, INDEX_NAME
FROM USER_CONSTRAINTS
NATURAL JOIN USER_CONS_COLUMNS
WHERE TABLE_NAME = 'SEMINARS'
;
/*
Now we add a UNIQUE constraint to the same column
*/
alter table seminars add constraint SEMINARS$UQ UNIQUE (SEMINAR_ALT_NAME);
/*
This command will create the constraint but NOT the index because the column is
alredy enfoced by an index.
*/
SELECT INDEX_NAME, COLUMN_NAME , INDEX_TYPE, TABLE_NAME, UNIQUENESS
FROM USER_INDEXES
NATURAL JOIN USER_IND_COLUMNS
WHERE TABLE_NAME = 'SEMINARS'
ORDER BY INDEX_NAME;
SELECT CONSTRAINT_NAME, COLUMN_NAME , CONSTRAINT_TYPE, TABLE_NAME, STATUS, DEFERRABLE, DEFERRED, INDEX_NAME
FROM USER_CONSTRAINTS
NATURAL JOIN USER_CONS_COLUMNS
WHERE TABLE_NAME = 'SEMINARS'
;
INSERT INTO SEMINARS VALUES (1,'ORACLE DATABASE TUNING', 'SEMINAR 1'); -- OK
INSERT INTO SEMINARS VALUES (2,'SQL FOUNDAMENTALS', 'SEMINAR 1'); -- UNIQUE CONSTRAINT VIOLATION
ROLLBACK;
-- Let's drop the index
DROP INDEX SEMINARS$UN2;
/* This will fail because now the index enforces a constraint.
We need to drop the constraint */
ALTER TABLE SEMINARS DROP CONSTRAINT SEMINARS$UQ;
/* Let's insert records again */
INSERT INTO SEMINARS VALUES (1,'ORACLE DATABASE TUNING', 'SEMINAR 1'); -- OK
INSERT INTO SEMINARS VALUES (2,'SQL FOUNDAMENTALS', 'SEMINAR 1'); -- UNIQUE INDEX VIOLATION
ROLLBACK;
/*
WHAT HAPPENED ???
When we dropped the constrint SEMINARS$UQ, the index SEMINARS$UN2 was NOT
dropped with the constraint because it was not created as part of the constraint.
We need to drop the index explicitely.
*/
DROP INDEX SEMINARS$UN2;
/* Let's insert records again */
INSERT INTO SEMINARS VALUES (1,'ORACLE DATABASE TUNING', 'SEMINAR 1'); -- OK
INSERT INTO SEMINARS VALUES (2,'SQL FOUNDAMENTALS', 'SEMINAR 1'); -- OK
ROLLBACK;
/* Tear down */
DROP TABLE SEMINARS PURGE;
/*
Invisible Indexes in Oracle Database 11g Release 1
---------------------------------------------------------------
https://oracle-base.com/articles/11g/invisible-indexes-11gr1
Oracle 11g allows indexes to be marked as invisible. Invisible indexes are
maintained like any other index, but they are ignored by the optimizer unless
the OPTIMIZER_USE_INVISIBLE_INDEXES parameter is set to TRUE at the instance or
session level. Indexes can be created as invisible by using the INVISIBLE
keyword, and their visibility can be toggled using the ALTER INDEX command.
CREATE INDEX index_name ON table_name(column_name) INVISIBLE;
ALTER INDEX index_name INVISIBLE;
ALTER INDEX index_name VISIBLE;
*/
CREATE TABLE ii_tab (
id NUMBER
);
BEGIN
FOR i IN 1 .. 10000 LOOP
INSERT INTO ii_tab VALUES (i);
END LOOP;
COMMIT;
END;
/
CREATE INDEX ii_tab_id ON ii_tab(id) INVISIBLE;
EXEC DBMS_STATS.gather_table_stats(USER, 'ii_tab', cascade=> TRUE);
/*
A query using the indexed column in the WHERE clause ignores the index and does
a full table scan.
*/
-- On SQL*Plus enable AUTOTRACE, on SQL Dveloper just click on the Explain Plan button
-- SET AUTOTRACE OFF
SELECT * FROM ii_tab WHERE id = 9999; -- Table access FULL (cost 7)
/* We can modifiy this session so we can use INVISIBLE indexes */
ALTER SESSION SET OPTIMIZER_USE_INVISIBLE_INDEXES=TRUE;
SELECT * FROM ii_tab WHERE id = 9999;
-- INDEX RANGE SCAN (cost 1)
/* restore the OPTIMIZER_USE_INVISIBLE_INDEXES option and make the index VISIBLE */
ALTER SESSION SET OPTIMIZER_USE_INVISIBLE_INDEXES=FALSE;
ALTER INDEX ii_tab_id VISIBLE;
SELECT * FROM ii_tab WHERE id = 9999;
-- INDEX RANGE SCAN (cost 1)
/* tear down */
drop table ii_tab purge;
/*
Multiple Indexes on the Same Set of Columns in Oracle Database 12c Release 1
--------------------------------------------------------------------------------
https://oracle-base.com/articles/12c/multiple-indexes-on-same-set-of-columns-12cr1
Why Use Multiple Indexes
Invisible indexes are still maintained, so having multiple indexes on the same
set of columns allows you to quickly switch between them, making testing the
impact of various indexes much quicker.
**
Remember, there is an impact on DML performance of having too many indexes on a
table, so this should be a short term situation.
**
WHEN TO CREATE MULTIPLE INDEXES ON THE SAME SET OF COLUMNS
** The indexes are of different types.
See "About Indexes" and Oracle Database Concepts for information about the different types of indexes.
However, the following exceptions apply:
. You cannot create a B-tree index and a B-tree cluster index on the same set of columns.
. You cannot create a B-tree index and an index-organized table on the same set of columns.
** The indexes use different partitioning.
Partitioning can be different in any of the following ways:
. Indexes that are not partitioned and indexes that are partitioned
. Indexes that are locally partitioned and indexes that are globally partitioned
. Indexes that differ in partitioning type (range or hash)
** The indexes have different uniqueness properties.
You can create both a unique and a non-unique index on the same set of columns.
ABOUT INDEXES
. B-tree indexes: the default and the most common
. B-tree cluster indexes: defined specifically for cluster
. Hash cluster indexes: defined specifically for a hash cluster
. Global and local indexes: relate to partitioned tables and indexes
. Reverse key indexes: most useful for Oracle Real Application Clusters applications
. Bitmap indexes: compact; work best for columns with a small set of values
. Function-based indexes: contain the precomputed value of a function/expression
. Domain indexes: specific to an application or cartridge.
== B*TREE ==
B*Tree (B stands for balanced): the root node points to many nodes at t
he second level which can point to other nodes at the third level and so on.
The depth of the tree is largely determined by the number of rows in the table
and the length of the idex key values.
The B*Tree structure is very effitient if the depth is greater then three or four,
then either the index keys are very ong or the table has billion of rows.
It is often said that if the query is going to retrieve more then 2 or 4 percent of
the total amount of rows in the table, then a full table scan will be quicker.
A major exception to this is if the vale specified in the WHERE clause is NULL.
NULLs do not go into B*Tree Indexes, so a query such as
SELECT * from EMPLOYEES WHERE last_name IS NULL;
will always esult in a FULL TABLE SCAN
A B*Tree index shoul be used if the cardinality in the column is high AND the
number of rows in the table is high AND the column is used in WHERE clauses
or JOIN conditions.
== BITMAP ==
A bitmap index stores the rowids associated with each key-value as a bitmap.
CHANNEL
WALKING 11010111000101011101011101...
DELIVERY 00101000111010100010100010...
SHOP
LONDON 11001000001001101001010000...
OXFORD 00100010010000010001001000...
READING 00010001000100000100100010...
GLASGOW 00000100100010000010000101...
This indicates that the first two sales were in LONDON, the third in OXFORD,
the fourth in READING and so on.
SELECT count(*) FROM SALES WHERE channel = 'WALKING' and shop = 'OXFORD'
will be solved applying the AND operator to the bitmaps associated to the
given values of the tho columns.
WALKING 11010111000101011101011101...
OXFORD 00100010010000010001001000...
WALKING & OXFORD 00000010000000010001001000...
^ ^ ^ ^
An advantage of BITMAP indexes over B*TREE is tha they include NULLs.
A BITMAP index shoul be used if the cardinality in the column is low AND the
number of rows in the table is high AND the column is used in Boolean angebra
(AND/OR/NOT) operations.
** BITMAP INDEX RESTRICTIONS **
You cannot specify both UNIQUE and BITMAP.
You cannot specify BITMAP for a domain index.
A bitmap index can have a maximum of 30 columns.
*/
-- Non-Partitioned Tables
--------------------------------------------------------------------------------
CREATE TABLE t1 (
id NUMBER,
description VARCHAR2(50),
created_date DATE
);
INSERT INTO t1 VALUES (1, 't1 ONE', TO_DATE('01/07/2014', 'DD/MM/YYYY'));
INSERT INTO t1 VALUES (2, 't1 TWO', TO_DATE('01/07/2015', 'DD/MM/YYYY'));
INSERT INTO t1 VALUES (3, 't1 THREE', TO_DATE('01/07/2016', 'DD/MM/YYYY'));
COMMIT;
CREATE INDEX t1_idx1 ON t1(created_date) VISIBLE;
CREATE INDEX t1_idx2 ON t1(created_date) INVISIBLE;
/* *
ERROR at line 1:
ORA-01408: such column list already indexed
If we alter something about it, like make it a bitmapped index, it works.
*/
CREATE BITMAP INDEX t1_idx3 ON t1(created_date) INVISIBLE;
-- Partitioned Tables
--------------------------------------------------------------------------------
CREATE TABLE t2 (
id NUMBER,
description VARCHAR2(50),
created_date DATE
)
PARTITION BY RANGE (created_date) (
PARTITION part_2014 VALUES LESS THAN (TO_DATE('01/01/2015', 'DD/MM/YYYY')) TABLESPACE users,
PARTITION part_2015 VALUES LESS THAN (TO_DATE('01/01/2016', 'DD/MM/YYYY')) TABLESPACE users,
PARTITION part_2016 VALUES LESS THAN (TO_DATE('01/01/2017', 'DD/MM/YYYY')) TABLESPACE users
);
INSERT INTO t2 VALUES (1, 't1 ONE', TO_DATE('01/07/2014', 'DD/MM/YYYY'));
INSERT INTO t2 VALUES (2, 't1 TWO', TO_DATE('01/07/2015', 'DD/MM/YYYY'));
INSERT INTO t2 VALUES (3, 't1 THREE', TO_DATE('01/07/2016', 'DD/MM/YYYY'));
COMMIT;
-- Create a global index.
CREATE INDEX t2_idx1 ON t2(created_date) GLOBAL VISIBLE;
-- Create some indexes with differing partitioning schemes.
CREATE INDEX t2_idx2 ON t2(created_date) GLOBAL
PARTITION BY RANGE (created_date) (
PARTITION t2_p1 VALUES LESS THAN (TO_DATE('01/01/2015', 'DD/MM/YYYY')) TABLESPACE users,
PARTITION t2_p2 VALUES LESS THAN (TO_DATE('01/01/2016', 'DD/MM/YYYY')) TABLESPACE users,
PARTITION t2_p3 VALUES LESS THAN (MAXVALUE) TABLESPACE users
)
INVISIBLE;
CREATE INDEX t2_idx3 ON t2(created_date) LOCAL INVISIBLE;
CREATE BITMAP INDEX t2_idx4 ON t2(created_date) LOCAL INVISIBLE;
/*
You can switch from indexes built on the same set of columns simply using the
ALTER INDEX command
*/
ALTER INDEX t1_idx1 INVISIBLE;
ALTER INDEX t1_idx2 VISIBLE;
/* tear down */
DROP TABLE t1 PURGE;
DROP TABLE t2 PURGE;
/*
Good to know....
======================================================================
ALTER SESSION SET QUERY_REWRITE_INTEGRITY = TRUSTED;
ALTER SESSION SET QUERY_REWRITE_ENABLED = TRUE;
When you drop and re-create an index with the same name but in a different way,
QUERY_REWRITE_INTEGRITY and QUERY_REWRITE_ENABLED parameters must be set or the
server will not be able to rewrite the queries, and will therefore not be able
to use the new index.
*** Later releases have them enabled by default ***
----------------------------------------------------------------------
Oracle has no compiler that evaluates and simplifies (mathematical) expressions,
so a WHERE clause like
WHERE col_a + col_b = 42
does not use an index on col_a because the lef-hand side also includes col_b.
To use an index on col_a , you have to rewrite the predicate as
WHERE col_a = 42 - col_b
----------------------------------------------------------------------
*/
|
SELECT
extract(epoch from homes_measurement.timestamp),
homes_measurement.value,
homes_measurement.meter_port_id
FROM
public.homes_measurement
WHERE
homes_measurement.timestamp BETWEEN 'fromtime' AND 'totime'
AND homes_measurement.meter_port_id IN (SELECT
homes_meterport.id
FROM
public.homes_submeter
INNER JOIN homes_meterport ON homes_submeter.id = homes_meterport.submeter_id
WHERE
homes_submeter.residential_home_id = 4
UNION
SELECT
homes_meterport.id
FROM
public.homes_mainmeter
INNER JOIN homes_meterport ON homes_mainmeter.id = homes_meterport.mainmeter_id
WHERE
homes_mainmeter.residential_home_id = 4); |
CREATE PROCEDURE [display].[pDel_core_company]
AS
TRUNCATE TABLE [display].[core_company] |
--adhoc使用
select city.cityname
, count (distinct search_w.cid ) as WAU
, count (distinct pay_w.orderid) as order_w
, concat(round(count (distinct pay_w.orderid)/count (distinct search_w.cid )*100,2),'%') as conversion_w
, count (distinct bnbpay_w.orderid ) as bnborder_w
, count (distinct hotelpay_w.orderid) as hotelorder_w
from
--WAU
(select distinct d
,cid
,get_json_object(value,'$.cityid') as cityid
from bnb_hive_db.bnb_tracelog
where d >= '2018-07-13'
and d <= '2018-07-19'
and key = 'bnb_inn_list_app_basic')search_w
left outer join
--周城市民宿客栈订单
(select substring(b1.createdtime, 0, 10) as d
, a1.orderid
, b1.clientid as cid
, c1.cityid
from ods_htl_bnborderdb.order_item a1
left join ods_htl_bnborderdb.order_header_v2 b1 on a1.orderid=b1.orderid and b1.d='2018-07-20'
left join ods_htl_bnborderdb.order_item_space c1 on c1.orderitemid=a1.orderitemid and c1.d='2018-07-20'
where substring(b1.createdtime,0,10) >='2018-07-13'
and substring(b1.createdtime,0,10) <='2018-07-19'
and a1.d='2018-07-20'
and (a1.statusid like '12%' or a1.statusid like '20%' or a1.statusid like '22%' or a1.statusid like '23%')
union all
select to_date(orderdate) as d
, orderid
, clientid as cid
, cityid
from dwhtl.edw_htl_order_all_orderdate
where to_date(orderdate) >='2018-07-13'
and to_date(orderdate) <='2018-07-19'
and subchannel='h5_kezhan'
and d >='2018-07-13'
and d <='2018-07-19'
and orderstatus not in ('W')) pay_w
on pay_w.d = search_w.d and pay_w.cid=search_w.cid and pay_w.cityid=search_w.cityid
left outer join
--周城市民宿订单
(select substring(b1.createdtime, 0, 10) as d
, a1.orderid
, b1.clientid as cid
, c1.cityid
from ods_htl_bnborderdb.order_item a1
left join ods_htl_bnborderdb.order_header_v2 b1 on a1.orderid=b1.orderid and b1.d='2018-07-20'
left join ods_htl_bnborderdb.order_item_space c1 on c1.orderitemid=a1.orderitemid and c1.d='2018-07-20'
where substring(b1.createdtime,0,10) >='2018-07-13'
and substring(b1.createdtime,0,10) <='2018-07-19'
and a1.d='2018-07-20'
and (a1.statusid like '12%' or a1.statusid like '20%' or a1.statusid like '22%' or a1.statusid like '23%')) bnbpay_w
on bnbpay_w.d = search_w.d and bnbpay_w.cid=search_w.cid and bnbpay_w.cityid=search_w.cityid
left outer join
--周城市客栈订单
(select to_date(orderdate) as d
, orderid
, clientid as cid
, cityid
from dwhtl.edw_htl_order_all_orderdate
where to_date(orderdate) >='2018-07-13'
and to_date(orderdate) <='2018-07-19'
and subchannel='h5_kezhan'
and d >='2018-07-13'
and d <='2018-07-19'
and orderstatus not in ('W')) hotelpay_w
on hotelpay_w.d = search_w.d and hotelpay_w.cid=search_w.cid and hotelpay_w.cityid=search_w.cityid
left outer join ods_htl_groupwormholedb.bnb_city city on search_w.cityid = city.cityid and city.d = '2018-07-20'
group by city.cityname
union all
select '汇总' as cityname
, count (distinct search_w.cid ) as WAU
, count (distinct pay_w.orderid) as order_w
, concat(round(count (distinct pay_w.orderid)/count (distinct search_w.cid )*100,2),'%') as conversion_w
, count (distinct bnbpay_w.orderid ) as bnborder_w
, count (distinct hotelpay_w.orderid) as hotelorder_w
from
--周汇总WAU
(select distinct d
,cid
from bnb_hive_db.bnb_tracelog
where d >= '2018-07-13'
and d <= '2018-07-19'
and key = 'bnb_inn_list_app_basic')search_w
left outer join
--周汇总民宿客栈订单
(select substring(b1.createdtime, 0, 10) as d
, a1.orderid
, b1.clientid as cid
from ods_htl_bnborderdb.order_item a1
left join ods_htl_bnborderdb.order_header_v2 b1 on a1.orderid=b1.orderid and b1.d='2018-07-20'
left join ods_htl_bnborderdb.order_item_space c1 on c1.orderitemid=a1.orderitemid and c1.d='2018-07-20'
where substring(b1.createdtime,0,10) >= '2018-07-13'
and substring(b1.createdtime,0,10) <= '2018-07-19'
and a1.d='2018-07-20'
and (a1.statusid like '12%' or a1.statusid like '20%' or a1.statusid like '22%' or a1.statusid like '23%')
union all
select to_date(orderdate) as d
, orderid
, clientid as cid
from dwhtl.edw_htl_order_all_orderdate
where to_date(orderdate) >= '2018-07-13'
and to_date(orderdate) <= '2018-07-19'
and subchannel='h5_kezhan'
and d >= '2018-07-13'
and d <= '2018-07-19'
and orderstatus not in ('W')) pay_w
on pay_w.d = search_w.d and pay_w.cid=search_w.cid
left outer join
--周汇总民宿订单
(select substring(b1.createdtime, 0, 10) as d
, a1.orderid
, b1.clientid as cid
from ods_htl_bnborderdb.order_item a1
left join ods_htl_bnborderdb.order_header_v2 b1 on a1.orderid=b1.orderid and b1.d='2018-07-20'
left join ods_htl_bnborderdb.order_item_space c1 on c1.orderitemid=a1.orderitemid and c1.d='2018-07-20'
where substring(b1.createdtime,0,10) >='2018-07-13'
and substring(b1.createdtime,0,10) <='2018-07-19'
and a1.d='2018-07-20'
and (a1.statusid like '12%' or a1.statusid like '20%' or a1.statusid like '22%' or a1.statusid like '23%')) bnbpay_w
on bnbpay_w.d = search_w.d and bnbpay_w.cid=search_w.cid
left outer join
--周汇总客栈订单
(select to_date(orderdate) as d
, orderid
, clientid as cid
from dwhtl.edw_htl_order_all_orderdate
where to_date(orderdate) >='2018-07-13'
and to_date(orderdate) <='2018-07-19'
and subchannel='h5_kezhan'
and d >= '2018-07-13'
and d <= '2018-07-19'
and orderstatus not in ('W')) hotelpay_w
on hotelpay_w.d = search_w.d and hotelpay_w.cid=search_w.cid
group by '汇总' |
CREATE TABLE autobus (
matricula VARCHAR2(16) NOT NULL,
wc NUMBER,
cantidad_asientos NUMBER,
CONSTRAINT autobus_pk PRIMARY KEY(matricula)
);
|
ALTER TABLE `ssm_stdtmp_file_01`
ADD COLUMN `T_DATE_04` DATE COMMENT '生效日期' AFTER `T_DATE_03`;
ALTER TABLE `sys_stdtmp_file_01`
ADD COLUMN `T_DATE_04` DATE COMMENT '生效日期' AFTER `T_DATE_03`;
|
-- it creates a database named hbtn_0d_2 and a user_0d_2.
CREATE DATABASE IF NOT EXISTS hbtn_0d_2;
CREATE USER IF NOT EXISTS
user_0d_2@localhost IDENTIFIED BY 'user_0d_2_pwd';
GRANT SELECT ON hbtn_0d_2.* TO 'user_0d_2'@'localhost'; |
create or replace function GetMscid(region_name string,vendor_id number,omc_id number)
RETURN varchar2 is
Mscname varchar2(64);
begin
if vendor_id=7 then
if region_name like '安庆%' then
Mscname:='WHMsce2';
elsif region_name like '池州%' then
Mscname:='WHMSCe2';
elsif region_name like '黄山%' then
Mscname:='WHMsce4';
elsif region_name like '马鞍山%' then
Mscname:='WHMsce1';
elsif region_name like '铜陵%' then
Mscname:='WHMsce1';
elsif region_name like '芜湖%' then
Mscname:='WHMsce1';
elsif region_name like '宣城%' then
Mscname:='WHMsce4';
else
Mscname:='';
end if;
else
if omc_id=2100001 then
Mscname:='hf1omp';
elsif omc_id=2100005 then
Mscname:='hf2omp';
elsif omc_id=2100002 then
Mscname:='hf3omp';
elsif omc_id=2100004 then
Mscname:='hf5omp';
elsif omc_id=2100003 then
Mscname:='hf6omp';
elsif omc_id=2100006 then
Mscname:='hf8omp';
elsif omc_id=2100007 then
Mscname:='hf9omp';
else
Mscname:='';
end if;
end if;
return Mscname;
exception
when others then
return 0;
end GetMscid;
|
create index IX_7CA94756 on es_ESHardware (SerialNo);
create index IX_E932831B on es_ESHardware (companyId);
create index IX_72098163 on es_ESHardware (drOwnerId);
create index IX_9027145D on es_ESHardware (groupId);
create index IX_1E890C3E on es_ESHardware (hardwareSerialNo);
create index IX_85280D1E on es_ESHardware (hardwareTypeId);
create index IX_2683F42F on es_ESHardware (hardwareTypeId, hardwareSerialNo);
create index IX_A66F5A7D on es_ESHardware (playerId);
create index IX_E8C450CA on es_ESHardwareType (groupId, hardwareName); |
--<ScriptOptions statementTerminator=";"/>
CREATE TABLE radiologydate (
id INT8 NOT NULL,
date DATE,
radiology_fk INT8
);
CREATE UNIQUE INDEX radiologydate_pkey ON radiologydate (id ASC);
ALTER TABLE radiologydate ADD CONSTRAINT radiologydate_pkey PRIMARY KEY (id);
ALTER TABLE radiologydate ADD CONSTRAINT fk_radiologydate_radiology_fk FOREIGN KEY (radiology_fk)
REFERENCES treatment (id);
|
#Create database
CREATE DATABASE if NOT EXISTS quotedb;
GRANT ALL PRIVILEGES ON quotedb.* TO 'Radha'@'%';
FLUSH PRIVILEGES;
use quotedb;
CREATE TABLE IF NOT EXISTS `hibernate_sequence` (
`next_val` bigint DEFAULT NULL
);
INSERT INTO quotedb.hibernate_sequence(next_val) VALUES (1);
CREATE TABLE IF NOT EXISTS `login` (
`id` bigint NOT NULL,
`password` varchar(255) DEFAULT NULL,
`user` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
);
insert into quotedb.login(id, user, password) values(1, 'Radha', 'Krishna');
CREATE TABLE IF NOT EXISTS `info` (
`id` bigint PRIMARY KEY,
`title` VARCHAR(255) NOT NULL,
`info` VARCHAR(10000) NOT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
);
CREATE TABLE IF NOT EXISTS `info_link` (
`id` bigint PRIMARY KEY,
`link_id` bigint,
`link` VARCHAR(255),
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY(link_id) REFERENCES INFO(ID)
);
/*
CREATE TABLE quotedb.`event_detail` (
`id` INTEGER PRIMARY KEY AUTO_INCREMENT,
`day` INTEGER NOT NULL,
`month` INTEGER NOT NULL,
`year` INTEGER NOT NULL,
`title` VARCHAR(200) NOT NULL,
`info` VARCHAR(1000) NOT NULL,
`type` VARCHAR(20) NOT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
);
CREATE TABLE quotedb.`event_detail_link` (
`link_id` INTEGER,
`link` VARCHAR(100),
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY(link_id) REFERENCES event_detail(ID)
);
*/
|
create database EscalaWeb;
use EscalaWeb;
create table contatos(
id int primary key auto_increment,
nome varchar(50),
email varchar(50),
telefone varchar(50),
mensagem varchar(200)
);
insert into contatos(nome, email, telefone, mensagem) values('Armando Víctor Pereira','armando2019ti@gmail.com','11995052373','Mensagem Teste');
select * from contatos;
drop table contatos; |
DROP VIEW newest_users;
DROP VIEW trzaskowski_tweets;
DROP VIEW jaki_tweets;
DROP VIEW newest_tweets; |
alter table ore_calcs add column store_items_text text;
create table store_items(
id bigint not null auto_increment primary key,
ore_calc_id bigint not null,
type_id bigint not null,
qty bigint not null
); |
/*
Navicat Premium Data Transfer
Source Server : mysql
Source Server Type : MySQL
Source Server Version : 50719
Source Host : localhost:3306
Source Schema : permission
Target Server Type : MySQL
Target Server Version : 50719
File Encoding : 65001
Date: 12/04/2020 10:04:40
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for sys_acl
-- ----------------------------
DROP TABLE IF EXISTS `sys_acl`;
CREATE TABLE `sys_acl` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '权限id',
`code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '权限码',
`name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '权限名称',
`acl_module_id` int(11) NOT NULL DEFAULT 0 COMMENT '权限所在的权限模块id',
`url` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '请求的url, 可以填正则表达式',
`type` int(11) NOT NULL DEFAULT 3 COMMENT '类型,1:菜单,2:按钮,3:其他',
`status` int(11) NOT NULL DEFAULT 1 COMMENT '状态,1:正常,0:冻结',
`seq` int(11) NOT NULL DEFAULT 0 COMMENT '权限在当前模块下的顺序,由小到大',
`remark` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '备注',
`operator` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '操作者',
`operate_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '最后一次更新时间',
`operate_ip` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '最后一个更新者的ip地址',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 12 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of sys_acl
-- ----------------------------
INSERT INTO `sys_acl` VALUES (1, '20171015095130_26', '进入产品管理界面', 1, '/sys/product/product.page', 1, 1, 1, '', 'Admin', '2017-10-15 09:51:30', '0:0:0:0:0:0:0:1');
INSERT INTO `sys_acl` VALUES (2, '20171015095322_14', '查询产品列表', 1, '/sys/product/page.json', 2, 1, 2, '', 'Admin', '2017-10-15 09:53:22', '0:0:0:0:0:0:0:1');
INSERT INTO `sys_acl` VALUES (3, '20171015095350_69', '产品上架', 1, '/sys/product/online.json', 2, 1, 3, '', 'Admin', '2017-10-15 09:53:51', '0:0:0:0:0:0:0:1');
INSERT INTO `sys_acl` VALUES (4, '20171015095420_7', '产品下架', 1, '/sys/product/offline.json', 2, 1, 4, '', 'Admin', '2017-10-15 10:11:28', '0:0:0:0:0:0:0:1');
INSERT INTO `sys_acl` VALUES (5, '20171015212626_63', '进入订单页', 2, '/sys/order/order.page', 1, 1, 1, '', 'Admin', '2017-10-15 21:26:27', '0:0:0:0:0:0:0:1');
INSERT INTO `sys_acl` VALUES (6, '20171015212657_12', '查询订单列表', 2, '/sys/order/list.json', 2, 1, 2, '', 'Admin', '2017-10-15 21:26:57', '0:0:0:0:0:0:0:1');
INSERT INTO `sys_acl` VALUES (7, '20171015212907_36', '进入权限管理页', 7, '/sys/aclModule/acl.page', 1, 1, 1, '', 'Admin', '2017-10-15 21:29:07', '0:0:0:0:0:0:0:1');
INSERT INTO `sys_acl` VALUES (8, '20171015212938_27', '进入角色管理页', 8, '/sys/role/role.page', 1, 1, 1, '', 'Admin', '2017-10-16 17:49:38', '0:0:0:0:0:0:0:1');
INSERT INTO `sys_acl` VALUES (9, '20171015213009_0', '进入用户管理页', 9, '/sys/dept/dept.page', 1, 1, 1, '', 'Admin', '2017-10-15 21:30:09', '0:0:0:0:0:0:0:1');
INSERT INTO `sys_acl` VALUES (10, '20171016230429_8', '进入权限更新记录页面', 11, '/sys/log/log.page', 1, 1, 1, '', 'Admin', '2017-10-16 23:04:49', '0:0:0:0:0:0:0:1');
INSERT INTO `sys_acl` VALUES (11, '20200409154550_48', '产品降价', 4, '/sys/product/cutprice', 2, 1, 1, '', 'Admin', '2020-04-09 15:46:21', '127.0.0.1');
-- ----------------------------
-- Table structure for sys_acl_module
-- ----------------------------
DROP TABLE IF EXISTS `sys_acl_module`;
CREATE TABLE `sys_acl_module` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '权限模块id',
`name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '权限模块名称',
`parent_id` int(11) NOT NULL DEFAULT 0 COMMENT '上级权限模块id',
`level` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '权限模块层级',
`seq` int(11) NOT NULL DEFAULT 0 COMMENT '权限模块在当前层级下的顺序,由小到大',
`status` int(11) NOT NULL DEFAULT 1 COMMENT '状态,1:正常,0:冻结',
`remark` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '备注',
`operator` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '操作者',
`operate_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '最后一次操作时间',
`operate_ip` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '最后一次更新操作者的ip地址',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 12 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of sys_acl_module
-- ----------------------------
INSERT INTO `sys_acl_module` VALUES (1, '产品管理', 0, '0', 1, 1, 'product', 'Admin', '2017-10-14 21:13:15', '0:0:0:0:0:0:0:1');
INSERT INTO `sys_acl_module` VALUES (2, '订单管理', 0, '0', 2, 1, '', 'Admin', '2017-10-14 20:17:11', '0:0:0:0:0:0:0:1');
INSERT INTO `sys_acl_module` VALUES (3, '公告管理', 0, '0', 3, 1, '', 'Admin', '2017-10-14 20:17:21', '0:0:0:0:0:0:0:1');
INSERT INTO `sys_acl_module` VALUES (4, '出售中产品管理', 1, '0.1', 1, 1, '', 'Admin', '2020-04-09 15:27:50', '127.0.0.1');
INSERT INTO `sys_acl_module` VALUES (5, '下架产品管理', 3, '0.1', 2, 1, '', 'Admin', '2020-04-09 15:27:39', '127.0.0.1');
INSERT INTO `sys_acl_module` VALUES (6, '权限管理', 0, '0', 4, 1, '', 'Admin', '2017-10-15 21:27:37', '0:0:0:0:0:0:0:1');
INSERT INTO `sys_acl_module` VALUES (7, '权限管理', 6, '0.6', 1, 1, '', 'Admin', '2017-10-15 21:27:57', '0:0:0:0:0:0:0:1');
INSERT INTO `sys_acl_module` VALUES (8, '角色管理', 6, '0.6', 2, 1, '', 'Admin', '2017-10-15 21:28:22', '0:0:0:0:0:0:0:1');
INSERT INTO `sys_acl_module` VALUES (9, '用户管理', 6, '0.6', 2, 1, '', 'Admin', '2017-10-15 21:28:36', '0:0:0:0:0:0:0:1');
INSERT INTO `sys_acl_module` VALUES (10, '运维管理', 0, '0', 6, 1, '', 'Admin', '2017-10-16 23:03:37', '0:0:0:0:0:0:0:1');
INSERT INTO `sys_acl_module` VALUES (11, '权限更新记录管理', 6, '0.6', 4, 1, '', 'Admin', '2017-10-16 23:04:07', '0:0:0:0:0:0:0:1');
-- ----------------------------
-- Table structure for sys_dept
-- ----------------------------
DROP TABLE IF EXISTS `sys_dept`;
CREATE TABLE `sys_dept` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '部门id',
`name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '部门名称',
`parent_id` int(11) NOT NULL DEFAULT 0 COMMENT '上级部门id',
`level` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '部门层级',
`seq` int(11) NOT NULL DEFAULT 0 COMMENT '部门在当前层级下的顺序,由小到大',
`remark` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '备注',
`operator` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '操作者',
`operate_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '最后一次操作时间',
`operate_ip` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '最后一次更新操作者的ip地址',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 25 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of sys_dept
-- ----------------------------
INSERT INTO `sys_dept` VALUES (16, '技术部', 0, '0', 1, '技术部', 'Admin', '2020-04-09 15:34:13', '127.0.0.1');
INSERT INTO `sys_dept` VALUES (17, '产品部', 0, '0', 2, '产品部', 'Admin', '2020-04-09 15:40:33', '127.0.0.1');
INSERT INTO `sys_dept` VALUES (18, '运营部', 0, '0', 1, '运营部', 'Admin', '2020-04-09 15:34:38', '127.0.0.1');
INSERT INTO `sys_dept` VALUES (19, 'Java开发', 16, '0.16', 1, 'Java开发', 'Admin', '2020-04-09 15:34:52', '127.0.0.1');
INSERT INTO `sys_dept` VALUES (21, '前端开发', 16, '0.16', 2, '前端开发', 'Admin', '2020-04-09 15:40:49', '127.0.0.1');
INSERT INTO `sys_dept` VALUES (22, '产品助理', 17, '0.17', 1, '产品助理', 'lnzz', '2020-04-11 16:30:34', '127.0.0.1');
INSERT INTO `sys_dept` VALUES (24, '产品经理', 17, '0.17', 2, '', 'lnzz', '2020-04-11 16:29:54', '127.0.0.1');
-- ----------------------------
-- Table structure for sys_log
-- ----------------------------
DROP TABLE IF EXISTS `sys_log`;
CREATE TABLE `sys_log` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`type` int(11) NOT NULL DEFAULT 0 COMMENT '权限更新的类型,1:部门,2:用户,3:权限模块,4:权限,5:角色,6:角色用户关系,7:角色权限关系',
`target_id` int(11) NOT NULL COMMENT '基于type后指定的对象id,比如用户、权限、角色等表的主键',
`old_value` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '旧值',
`new_value` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '新值',
`operator` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '操作者',
`operate_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '最后一次更新的时间',
`operate_ip` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '最后一次更新者的ip地址',
`status` int(11) NOT NULL DEFAULT 0 COMMENT '当前是否复原过,0:没有,1:复原过',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 33 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of sys_log
-- ----------------------------
INSERT INTO `sys_log` VALUES (28, 1, 24, '', '{\"id\":24,\"name\":\"产品经理\",\"parentId\":17,\"level\":\"0.17\",\"seq\":2,\"operator\":\"lnzz\",\"operateTime\":1586593794438,\"operateIp\":\"127.0.0.1\"}', 'lnzz', '2020-04-11 16:29:55', '127.0.0.1', 1);
INSERT INTO `sys_log` VALUES (29, 1, 22, '{\"id\":22,\"name\":\"产品助理\",\"parentId\":17,\"level\":\"0.17\",\"seq\":1,\"remark\":\"产品助理\",\"operator\":\"lnzz\",\"operateTime\":1586593360000,\"operateIp\":\"127.0.0.1\"}', '{\"id\":22,\"name\":\"产品助理\",\"parentId\":17,\"level\":\"0.17\",\"seq\":1,\"remark\":\"产品助理1\",\"operator\":\"lnzz\",\"operateTime\":1586593813313,\"operateIp\":\"127.0.0.1\"}', 'lnzz', '2020-04-11 16:30:13', '127.0.0.1', 1);
INSERT INTO `sys_log` VALUES (30, 1, 22, '{\"id\":22,\"name\":\"产品助理\",\"parentId\":17,\"level\":\"0.17\",\"seq\":1,\"remark\":\"产品助理1\",\"operator\":\"lnzz\",\"operateTime\":1586593813000,\"operateIp\":\"127.0.0.1\"}', '{\"id\":22,\"name\":\"产品助理\",\"parentId\":17,\"level\":\"0.17\",\"seq\":1,\"remark\":\"产品助理\",\"operator\":\"lnzz\",\"operateTime\":1586593833886,\"operateIp\":\"127.0.0.1\"}', 'lnzz', '2020-04-11 16:30:34', '127.0.0.1', 1);
INSERT INTO `sys_log` VALUES (31, 2, 7, '', '{\"id\":7,\"username\":\"sleven\",\"telephone\":\"18866661111\",\"mail\":\"sleven@qq.com\",\"password\":\"25D55AD283AA400AF464C76D713C07AD\",\"deptId\":16,\"status\":1,\"operator\":\"lnzz\",\"operateTime\":1586593865496,\"operateIp\":\"127.0.0.1\"}', 'lnzz', '2020-04-11 16:31:06', '127.0.0.1', 1);
INSERT INTO `sys_log` VALUES (32, 2, 7, '{\"id\":7,\"username\":\"sleven\",\"telephone\":\"18866661111\",\"mail\":\"sleven@qq.com\",\"password\":\"25D55AD283AA400AF464C76D713C07AD\",\"deptId\":16,\"status\":1,\"operator\":\"lnzz\",\"operateTime\":1586593865000,\"operateIp\":\"127.0.0.1\"}', '{\"id\":7,\"username\":\"sleven\",\"telephone\":\"18866661111\",\"mail\":\"sleven@qq.com\",\"deptId\":21,\"status\":1,\"operator\":\"lnzz\",\"operateTime\":1586593875332,\"operateIp\":\"127.0.0.1\"}', 'lnzz', '2020-04-11 16:31:15', '127.0.0.1', 1);
-- ----------------------------
-- Table structure for sys_role
-- ----------------------------
DROP TABLE IF EXISTS `sys_role`;
CREATE TABLE `sys_role` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '角色id',
`name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`type` int(11) NOT NULL DEFAULT 1 COMMENT '角色的类型,1:管理员角色,2:其他',
`status` int(11) NOT NULL DEFAULT 1 COMMENT '状态,1:可用,0:冻结',
`remark` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '备注',
`operator` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '操作者',
`operate_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '最后一次更新的时间',
`operate_ip` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '最后一次更新者的ip地址',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 7 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of sys_role
-- ----------------------------
INSERT INTO `sys_role` VALUES (1, '产品管理员', 1, 1, '', 'Admin', '2017-10-15 12:42:47', '0:0:0:0:0:0:0:1');
INSERT INTO `sys_role` VALUES (2, '订单管理员', 1, 1, '', 'Admin', '2017-10-15 12:18:59', '0:0:0:0:0:0:0:1');
INSERT INTO `sys_role` VALUES (3, '公告管理员', 1, 1, '', 'Admin', '2017-10-15 12:19:10', '0:0:0:0:0:0:0:1');
INSERT INTO `sys_role` VALUES (4, '权限管理员', 1, 1, '', 'Admin', '2017-10-15 21:30:36', '0:0:0:0:0:0:0:1');
INSERT INTO `sys_role` VALUES (5, '运维管理员', 1, 1, '运维', 'Admin', '2017-10-17 00:23:28', '0:0:0:0:0:0:0:1');
INSERT INTO `sys_role` VALUES (6, '行政管理员', 1, 0, '', 'lnzz', '2020-04-09 16:01:14', '127.0.0.1');
-- ----------------------------
-- Table structure for sys_role_acl
-- ----------------------------
DROP TABLE IF EXISTS `sys_role_acl`;
CREATE TABLE `sys_role_acl` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`role_id` int(11) NOT NULL COMMENT '角色id',
`acl_id` int(11) NOT NULL COMMENT '权限id',
`operator` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '操作者',
`operate_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '最后一次更新的时间',
`operate_ip` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '最后一次更新者的ip',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 34 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of sys_role_acl
-- ----------------------------
INSERT INTO `sys_role_acl` VALUES (33, 4, 9, 'lnzz', '2020-04-11 15:38:56', '127.0.0.1');
-- ----------------------------
-- Table structure for sys_role_user
-- ----------------------------
DROP TABLE IF EXISTS `sys_role_user`;
CREATE TABLE `sys_role_user` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`role_id` int(11) NOT NULL COMMENT '角色id',
`user_id` int(11) NOT NULL COMMENT '用户id',
`operator` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '操作者',
`operate_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '最后一次更新的时间',
`operate_ip` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '最后一次更新者的ip地址',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of sys_role_user
-- ----------------------------
INSERT INTO `sys_role_user` VALUES (2, 4, 6, 'lnzz', '2020-04-11 15:45:40', '127.0.0.1');
-- ----------------------------
-- Table structure for sys_user
-- ----------------------------
DROP TABLE IF EXISTS `sys_user`;
CREATE TABLE `sys_user` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '用户id',
`username` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '用户名称',
`telephone` varchar(13) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '手机号',
`mail` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '邮箱',
`password` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '加密后的密码',
`dept_id` int(11) NOT NULL DEFAULT 0 COMMENT '用户所在部门的id',
`status` int(11) NOT NULL DEFAULT 1 COMMENT '状态,1:正常,0:冻结状态,2:删除',
`remark` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '备注',
`operator` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '操作者',
`operate_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '最后一次更新时间',
`operate_ip` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '最后一次更新者的ip地址',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 8 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of sys_user
-- ----------------------------
INSERT INTO `sys_user` VALUES (6, 'lnzz', '18877771111', 'admin@qq.com', '25D55AD283AA400AF464C76D713C07AD', 19, 1, '', 'lnzz', '2020-04-09 16:00:05', '127.0.0.1');
INSERT INTO `sys_user` VALUES (7, 'sleven', '18866661111', 'sleven@qq.com', '25D55AD283AA400AF464C76D713C07AD', 21, 1, '', 'lnzz', '2020-04-11 16:31:15', '127.0.0.1');
SET FOREIGN_KEY_CHECKS = 1;
|
/****** Object: StoredProcedure [dbo].[prc_CWI_SetCorrespondenceDelivery] Script Date: 11/7/2014 3:49:30 PM ******/
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[prc_CWI_SetCorrespondenceDelivery]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[prc_CWI_SetCorrespondenceDelivery]
GO
/****** Object: StoredProcedure [dbo].[prc_CWI_SetCorrespondenceDelivery] Script Date: 11/7/2014 3:49:30 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[prc_CWI_SetCorrespondenceDelivery]') AND type in (N'P', N'PC'))
BEGIN
EXEC dbo.sp_executesql @statement = N'/*******************************************************************
* PROCEDURE: prc_CWI_SetCorrespondenceDelivery
* Purpose : This PROC would be called TO create delivery methods before creating correspondence
* Invoked from : CorrespondenceService
* CREATED: MohanKumar Sundaram 24APR14
* MODIFICATION HISTORY
* DATE AUTHOR DESCRIPTION
25JUl14 Mohankumar From email address and name inserted in correspondence delivery
07NOV14 Mohankumar Delivery methods set up base don the setting in CWI_CorrespondenceDeliveryMethod table
**********************************************************************
Execution example :
**********************************************************************
exec prc_CWI_SetCorrespondenceDelivery 1, 3,''\\fileserver\folder\'',''1.pdf''
**********************************************************************/
CREATE PROC [dbo].[prc_CWI_SetCorrespondenceDelivery]
@CorrespondenceId bigint,
@author int,
@FilePath varchar(max),
@File varchar(max)
AS
BEGIN
SET NOCOUNT ON
DECLARE @fax varchar(100),
@VendorId int ,
@CorrespondenceLookupId int ,
@DivisionId int,
@authorName varchar(100) = '''',
@authorEmail varchar(100) = ''''
SELECT @authorName = Names, @authorEmail = Email FROM CWI_User WHERE Id = @author
/* CHeck if correspondence delivery generated for the correspondence */
IF EXISTS(SELECT TOP 1 1 FROM CWI_CorrespondenceDelivery WHERE CorrespondenceId = @CorrespondenceId AND IsTrashed = 0)
BEGIN
UPDATE CWI_CorrespondenceDelivery
SET [FilePath] = @FilePath , [File] = @File
WHERE CorrespondenceId = @CorrespondenceId AND IsTrashed = 0
RETURN
END
SELECT
@VendorId = VendorId,
@CorrespondenceLookupId = CorrespondenceTypeLookupId ,
@DivisionId = ClientId
FROM
CWI_Correspondence
WHERE
Id = @CorrespondenceId
DECLARE @tblVendorCorres TABLE
(
DeliverMethodId int,
Fax varchar(200),
Email varchar(max),
FTPServer varchar(200),
FTPPort varchar(200),
FTPUser varchar(200),
FTPPassword varchar(200)
)
INSERT INTO @tblVendorCorres
select
VC.DeliveryMethodLookupId,
VC.Fax,
ISNULL(VCon.Email, VCD.EmailID) Email,
ftp.Server,
ftp.Port,
ftp.UserName,
ftp.Password
from
CWI_VendorCorrespondence VC
INNER JOIN CWI_CorrespondenceDeliveryMethod CDM
ON CDM.CorrespondenceLookupId = VC.CorrespondenceLookupId
AND CDM.DeliveryMethodLookupId = VC.DeliveryMethodLookupId
AND CDM.IsActive = 1
LEFT OUTER JOIN CWI_VendorCorrespondenceDelivery VCD
ON VC.Id = VCD.VendorCorrespondenceID
LEFT OUTER JOIN CWI_VendorContact VCon
ON VCon.Id = VCD.VendorContactID
LEFT OUTER JOIN CWI_VendorCorrespondenceFTP ftp
ON VC.Id = ftp.VendorCorrespondenceID
WHERE
VC.VendorId = @VendorId
AND VC.CorrespondenceLookupId = @CorrespondenceLookupId
and ISNULL(VC.IsActive,1) = 1
and ISNULL(VCD.IsActive,1) = 1
and ISNULL(Vcon.IsDeleted,0) = 0
and
(
(VCD.IsAssociatedClients = 0)
OR
VCD.VendorContactID in
(select VendorContactId from CWI_VendorContactClient where ClientId = @DivisionId)
)
UPDATE @tblVendorCorres SET Email = t.Email
FROM
@tblVendorCorres tbl
INNER JOIN
(
SELECT p1.DeliverMethodId,Stuff(
( SELECT Email + '',''
FROM @tblVendorCorres p2
WHERE p2.DeliverMethodId = p1.DeliverMethodId
ORDER BY Email
FOR XML PATH(''''),type ).value(''.'', ''nvarchar(max)'')
, 1, 0, '''') AS Email
FROM @tblVendorCorres p1
GROUP BY DeliverMethodId
) t
ON t.DeliverMethodId = tbl.DeliverMethodId
IF NOT EXISTS (SELECT top 1 1 FROM @tblVendorCorres)
BEGIN
SELECT top 1 @fax = Fax FROM
(
SELECT distinct dbo.fnc_FormatRemovalPhone(Fax,default) as Fax, 1 priority FROM CWI_VendorContact VC
WHERE VendorId = @VendorId
AND LTRIM(RTRIM(ISNULL(Fax,''''))) <> '''' AND IsDeleted = 0
UNION
SELECT dbo.fnc_FormatRemovalPhone(WorkFax,default) as WorkFax, 2 priority FROM CWI_Vendor V INNER JOIN CWI_Address BA ON V.AddressId_Billing = BA.ID
WHERE V.Id = @VendorId
AND LTRIM(RTRIM(ISNULL(WorkFax,''''))) <> ''''
UNION
SELECT dbo.fnc_FormatRemovalPhone(WorkFax,default) as WorkFax, 3 priority FROM CWI_Vendor V INNER JOIN CWI_Address PA ON V.AddressId_Physical = PA.ID
WHERE V.Id = @VendorId
AND LTRIM(RTRIM(ISNULL(WorkFax,''''))) <> ''''
UNION
SELECT VC.Fax, 4 priority FROM CWI_VendorCorrespondence VC
Inner Join
CWI_Vendor V ON V.id=vc.VendorId and VendorId=@VendorId and VC.Fax is not null AND LTRIM(RTRIM(ISNULL(Fax,''''))) <> ''''
AND VC.DeliveryMethodLookupId= 804 /*fax*/
and VC.CorrespondenceLookupId =@CorrespondenceLookupId
) x
Order by x.priority
INSERT INTO @tblVendorCorres
(DeliverMethodId ,
Fax )
VALUES
(
804,
@Fax)
END
BEGIN TRANSACTION
BEGIN TRY
UPDATE CWI_CorrespondenceDelivery SET IsTrashed = 1
WHERE CorrespondenceId = @CorrespondenceId
INSERT CWI_CorrespondenceDelivery
(
CorrespondenceId,
DeliveryMethodLookupId,
DeliveryStatusLookupId,
Fax,
Email,
FTPServer, FTPPort, FTPUser, FTPPassword,
CreatedBy,
LastModifiedBy,
FilePath,
[File],
[EmailTemplateId],
FromEmailAddress,
FromEmailUserName
)
select distinct
@CorrespondenceId ,
DeliverMethodId ,
3152,/*Pending*/
Fax ,
Email ,
FTPServer ,
FTPPort ,
FTPUser,
FTPPassword ,
@author,
@author,
@FilePath,
@File,
T.EmailTemplateId,
@authorEmail,
@authorName
from @tblVendorCorres D
LEFT OUTER JOIN
(
select DE.*, ET.TemplateFile, ET.TemplateSubject
from CWI_CorrespodenceDeliveryEmailTemplate DE
INNER JOIN CWI_EmailTemplate ET
ON DE.EmailTemplateId = ET.Id
WHERE
CorrespodenceLookupId = @CorrespondenceLookupId
AND DE.IsActive = 1 AND ET.IsActive = 1
) T
ON
D.DeliverMethodId = T.DeliveryMethodLookupId
END TRY
BEGIN CATCH
IF @@TRANCOUNT >0
ROLLBACK TRANSACTION ;
EXEC prc_CWI_AppRaiseError;
THROW
END CATCH
IF @@TRANCOUNT > 0
COMMIT TRANSACTION Trans1;
SET NOCOUNT OFF
END
'
END
GO
|
/***************** Linear Models ****************/
/* Linear Model such as regression are useful for estimating values for business.
Such as: We just run an advertising campaign and expect to sell more items than usual.
How many employees should we have working?
*/
/*********** Computing Intercept (employee shifts on y-axis and units sold in x-asis) *********/
/* Result: 2.64581850 */
SELECT
REGR_INTERCEPT(employee_shifts, units_sold)
FROM store_sales;
/* What about we want to know number of units sold based on the the employees on shift? */
SELECT
REGR_INTERCEPT(units_sold, employee_shifts)
FROM store_sales;
/* ---------------------------------------------------------------------- */
/*********** Computing Slope (employee shifts on y-axis and units sold in x-asis) *********/
/* Result: 0.003076239751 */
SELECT
REGR_SLOPE(employee_shifts, units_sold)
FROM store_sales;
/* ---------------------------------------------------------------------- */
/*
Linear Regression: y=mx+b
The ultimate question: How many employees we should have working to accomodate the sales of 1,500 items?
*/
SELECT
REGR_SLOPE(employee_shifts, units_sold) * 1500 + REGR_INTERCEPT(employee_shifts, units_sold) AS estimated_employees
FROM store_sales;
/*
Based on the results, we expect to have 7.26 (around 7 employees) to handle to sales of 1,500 items.
*/
|
CREATE TABLE present (user_id int, date text);
INSERT INTO present VALUES (1, '01.07.2018'), (234, '04.10.2018'), (234, '02.07.2018'), (3, '02.07.2018'), (1, '01.07.2018');
WITH mau AS (SELECT DATE_TRUNC("month", date) month_timestamp, COUNT(DISTINCT user_id) mau FROM logins GROUP BY DATE_TRUNC("month", date))
SELECT a.month_timestamp previous_month, a.mau previous_mau, b.month_timestamp current_month, b.mau current_mau, ROUND(100.0*(b.mau - a.mau)/a.mau,2) AS percent_change FROM mau a JOIN mau b ON a.month_timestamp = b.month_timestamp - interval '1 month'
update present set user_id = 2 where "date" ='01.07.2018';
SELECT * from present;
drop table present
CREATE TABLE present (user_id int primary KEY, date text);
insert into present values ( 1,'01.01.2020'),(2,'01/02/2020'),(3,'01.03.2020');
create table orders (id serial primary key, users integer, quantity integer, FOREIGN KEY(users) references present (user_id));
select * from ORDERS
insert into ORDERS values (1,2,6);
select * from ORDERS;
alter table ORDERS add PHONE VARCHAR(10) null;
select *from ORDERS;
alter table ORDERS add PHONES VARCHAR(10) not null default 'NOT';
select * from ORDERS
ALTER TABLE orders DROP COLUMN phone;
select* from ORDERS;
alter table ORDERS alter column quantity type varchar(20);
alter table orders alter column quantity set not null;
alter table orders alter column quantity drop not null;
alter table orders ADD check (USERS>0);
alter table orders rename column quantity to mix;
select * from orders;
INSERT INTO orders (mix) values (4) returning id;
select * from orders;
select * from orders WHERE not users*id>1 OR users IS NULL;
update orders set id=id+400;
insert into orders (users,mix) values (3,6),(2,8),(1,6)
select distinct users from orders;
select users from orders order BY users DESC;
select users from orders order BY users LIMIT 5 OFFSET 2;
SELECT AVG (id) FROM orders;
SELECT COUNT(DISTINCT users) FROM orders;
SELECT id, COUNT(*) FROM orders WHERE id >6 GROUP BY id ORDER BY id DESC;
SELECT id, COUNT(*) FROM orders GROUP BY id HAVING COUNT(*)>0;
SELECT id, COUNT(*), mix FROM orders GROUP BY GROUPING SETS(id,mix);
SELECT id, COUNT(*),SUM (users) FROM orders GROUP BY ROLLUP (id);
SELECT id, COUNT(*),SUM (users) FROM orders GROUP BY CUBE (id, users);
SELECT * from orders;
ALTER TABLE orders ADD COLUMN indexs VARCHAR (20);
ALTER TABLE orders ALTER COLUMN indexs TYPE VARCHAR (10)[];
ALTER TABLE orders DROP COLUMN indexs;
ALTER TABLE orders ADD COLUMN indexs VARCHAR (20)[];
INSERT INTO orders (indexs) VALUES ('{"sql", "postgres", "database", "plsql"}');
SELECT indexs [2:3] FROM orders;
CREATE TYPE request as enum ('min','max');
ALTER TABLE orders ADD COLUMN status request;
UPDATE orders set status='min' where mix='6';
UPDATE orders set status='max' where mix!='6';
UPDATE orders set status='max' where mix=NULL;
ALTER TYPE request ADD VALUE 'middle';
SELECT * from present;
SELECT date,mix FROM present JOIN orders ON user_id=users;
SELECT date,mix,status FROM present RIGHT JOIN orders ON user_id=users;
SELECT * FROM present, orders;
|
-- phpMyAdmin SQL Dump
-- version 3.5.1
-- http://www.phpmyadmin.net
--
-- Servidor: localhost
-- Tiempo de generación: 19-12-2016 a las 13:04:44
-- Versión del servidor: 5.5.24-log
-- Versión de PHP: 5.4.3
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
--
-- Base de datos: `tempo000000002`
--
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `arbitros`
--
CREATE TABLE IF NOT EXISTS `arbitros` (
`arbitroid` int(11) NOT NULL AUTO_INCREMENT,
`apellido` varchar(50) NOT NULL,
`nombres` varchar(50) NOT NULL,
`tipodocumento` int(11) NOT NULL,
`nrodocumento` varchar(15) DEFAULT NULL,
`fechaalta` datetime NOT NULL,
`telefono` varchar(50) DEFAULT NULL,
`email` varchar(200) DEFAULT NULL,
`celular` varchar(25) DEFAULT NULL,
`fechabaja` datetime DEFAULT NULL,
`activo` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`arbitroid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `atributosespecialespartidos`
--
CREATE TABLE IF NOT EXISTS `atributosespecialespartidos` (
`atributoespecialpartidoid` int(11) NOT NULL AUTO_INCREMENT,
`descripcion` varchar(50) NOT NULL,
`tipodato` varchar(3) NOT NULL,
PRIMARY KEY (`atributoespecialpartidoid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `canchas`
--
CREATE TABLE IF NOT EXISTS `canchas` (
`canchaid` int(11) NOT NULL AUTO_INCREMENT,
`descripcion` varchar(100) NOT NULL,
`coordgpslat` varchar(25) DEFAULT NULL,
`coordgpslong` varchar(25) DEFAULT NULL,
`observaciones` varchar(500) NOT NULL,
`suspendida` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`canchaid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `categorias`
--
CREATE TABLE IF NOT EXISTS `categorias` (
`categoriaid` int(11) NOT NULL AUTO_INCREMENT,
`descripcion` varchar(15) NOT NULL,
PRIMARY KEY (`categoriaid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `clubes`
--
CREATE TABLE IF NOT EXISTS `clubes` (
`clubid` int(11) NOT NULL AUTO_INCREMENT,
`nombre` varchar(50) NOT NULL,
`postributariaid` int(11) NOT NULL,
`cuit` varchar(13) DEFAULT NULL,
`fechaalta` datetime NOT NULL,
`fechabaja` datetime DEFAULT NULL,
`coordgpslat` varchar(25) DEFAULT NULL,
`coordgpslong` varchar(25) DEFAULT NULL,
`usuarioid` varchar(25) NOT NULL,
`logo` varchar(100) DEFAULT NULL,
`activo` tinyint(1) NOT NULL,
PRIMARY KEY (`clubid`),
KEY `FOREING` (`postributariaid`),
KEY `FOREING2` (`usuarioid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `configuracion`
--
CREATE TABLE IF NOT EXISTS `configuracion` (
`configuracionid` int(11) NOT NULL AUTO_INCREMENT,
`parametro` varchar(100) NOT NULL,
`nombreamostrar` varchar(100) NOT NULL,
`valor` varchar(1000) NOT NULL,
PRIMARY KEY (`configuracionid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `definicionescategoriastemporadas`
--
CREATE TABLE IF NOT EXISTS `definicionescategoriastemporadas` (
`categoriaid` int(11) NOT NULL,
`temporadaid` int(11) NOT NULL,
`cantmaxjugadores` int(11) NOT NULL,
`cantminjugadores` int(11) NOT NULL,
`observaciones` varchar(250) DEFAULT NULL,
`dias` varchar(15) NOT NULL,
`hora` varchar(5) NOT NULL,
`minutospartido` int(11) NOT NULL,
`cantcambiosporpartido` int(11) NOT NULL,
`conreingreso` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`categoriaid`,`temporadaid`),
KEY `FKdefinicionescategoriastemporadastemporadas` (`temporadaid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `definicionescategoriastemporadashabtransitorias`
--
CREATE TABLE IF NOT EXISTS `definicionescategoriastemporadashabtransitorias` (
`categoriaid` int(11) NOT NULL,
`temporadaid` int(11) NOT NULL,
`motivohabtransitoriaid` int(11) NOT NULL,
`cantporequipos` int(11) NOT NULL,
`cantencancha` int(11) NOT NULL,
PRIMARY KEY (`categoriaid`,`temporadaid`,`motivohabtransitoriaid`),
KEY `FKdefinicionescategoriastemporadashabtransitoriastemporadas` (`temporadaid`),
KEY `FKdefcategoriastemporadashabtransitoriasmotivoshabtransitoria` (`motivohabtransitoriaid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `definicionescategoriastemporadastipojugador`
--
CREATE TABLE IF NOT EXISTS `definicionescategoriastemporadastipojugador` (
`categoriaid` int(11) NOT NULL,
`temporadaid` int(11) NOT NULL,
`tipojugadorid` int(11) NOT NULL,
`edadmaxima` int(11) NOT NULL,
`edadminima` int(11) NOT NULL,
`diamescumplemin` varchar(4) NOT NULL,
`diamescumplemax` varchar(4) NOT NULL,
`cantjugadoresporequipo` int(11) NOT NULL,
`cantjugadoresencancha` int(11) NOT NULL,
`observaciones` varchar(250) NOT NULL,
PRIMARY KEY (`categoriaid`,`temporadaid`,`tipojugadorid`),
KEY `FKdefcategoriastemporadastipojugadortemporadas` (`temporadaid`),
KEY `FKdefcategoriastemporadastipojugadortipojugadores` (`tipojugadorid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `definicionessancionesacumuladastemporadas`
--
CREATE TABLE IF NOT EXISTS `definicionessancionesacumuladastemporadas` (
`tiposancionid` int(11) NOT NULL,
`temporadaid` int(11) NOT NULL,
`cantacumulada` int(11) NOT NULL,
`cantfechasacumplir` int(11) NOT NULL,
PRIMARY KEY (`tiposancionid`,`temporadaid`),
KEY `FKdefsancionesacumuladastemporadastemporadas` (`temporadaid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `divisiones`
--
CREATE TABLE IF NOT EXISTS `divisiones` (
`divisionid` int(11) NOT NULL AUTO_INCREMENT,
`descripcion` varchar(15) NOT NULL,
PRIMARY KEY (`divisionid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `documentacionjugadores`
--
CREATE TABLE IF NOT EXISTS `documentacionjugadores` (
`docjugadoresid` int(11) NOT NULL AUTO_INCREMENT,
`descripcion` varchar(50) NOT NULL,
`obligatoria` tinyint(1) NOT NULL DEFAULT '0',
`observaciones` varchar(500) NOT NULL,
PRIMARY KEY (`docjugadoresid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `documentacionjugadoresvalores`
--
CREATE TABLE IF NOT EXISTS `documentacionjugadoresvalores` (
`docjugadoresid` int(11) NOT NULL,
`valorid` int(11) NOT NULL,
`descripcion` varchar(50) NOT NULL,
`esdefault` tinyint(1) NOT NULL DEFAULT '0',
`habilita` tinyint(1) NOT NULL DEFAULT '0',
`llevaimagen` tinyint(1) NOT NULL DEFAULT '0',
`permitidosporequipo` int(11) NOT NULL DEFAULT '999',
PRIMARY KEY (`docjugadoresid`,`valorid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `equipos`
--
CREATE TABLE IF NOT EXISTS `equipos` (
`equipoid` int(11) NOT NULL AUTO_INCREMENT,
`descripcion` varchar(50) NOT NULL,
`clubid` int(11) NOT NULL,
`categoriaid` int(11) NOT NULL,
`divisionid` int(11) NOT NULL,
`canchadefid` int(11) DEFAULT NULL,
`fechaalta` datetime NOT NULL,
`fechabaja` datetime NOT NULL,
`activo` tinyint(1) NOT NULL,
`contactoclubid` int(11) NOT NULL,
PRIMARY KEY (`equipoid`),
KEY `FKCLUB` (`clubid`),
KEY `FKCATEGORIA` (`categoriaid`),
KEY `FKDIVISION` (`divisionid`),
KEY `FKCANCHA` (`canchadefid`),
KEY `FKCONTACTO` (`contactoclubid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `estadospartidos`
--
CREATE TABLE IF NOT EXISTS `estadospartidos` (
`estadopartidoid` int(11) NOT NULL,
`descripcion` varchar(50) NOT NULL,
`defautomatica` tinyint(1) NOT NULL,
`goleslocalauto` int(11) NOT NULL,
`goleslocalborra` tinyint(1) NOT NULL,
`golesvisitanteauto` int(11) NOT NULL,
`golesvisitanteborra` tinyint(1) NOT NULL,
`puntoslocal` int(11) NOT NULL,
`puntosvisitante` int(11) NOT NULL,
`finalizado` tinyint(1) NOT NULL DEFAULT '1',
`ocultardetallepublico` tinyint(1) NOT NULL DEFAULT '0',
`visibleparaarbitros` tinyint(1) NOT NULL,
`contabilizalocal` varchar(1) NOT NULL DEFAULT 'G',
`contabilizavisitante` varchar(1) NOT NULL DEFAULT 'G',
PRIMARY KEY (`estadopartidoid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `fechasexcluidas`
--
CREATE TABLE IF NOT EXISTS `fechasexcluidas` (
`fechaexcluidaid` int(11) NOT NULL AUTO_INCREMENT,
`dia` int(11) NOT NULL,
`mes` int(11) NOT NULL,
`descripcion` varchar(50) DEFAULT NULL,
PRIMARY KEY (`fechaexcluidaid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `formatostorneo`
--
CREATE TABLE IF NOT EXISTS `formatostorneo` (
`formatotorneoid` int(11) NOT NULL AUTO_INCREMENT,
`descripcion` varchar(50) NOT NULL,
`liga` tinyint(1) NOT NULL DEFAULT '1',
`playoff` tinyint(1) NOT NULL DEFAULT '0',
`ligayplayoff` tinyint(1) NOT NULL DEFAULT '0',
`idayvueltagrupos` tinyint(1) NOT NULL DEFAULT '0',
`idayvueltaplayoff` tinyint(1) NOT NULL DEFAULT '0',
`idayvueltafinal` tinyint(1) NOT NULL DEFAULT '0',
`elimdirecta` tinyint(1) NOT NULL DEFAULT '0',
`ultimopuesto` int(11) NOT NULL,
`ordendefpuntos` int(11) NOT NULL,
`ordendefdifgoles` int(11) NOT NULL,
`ordendefgolesafavor` int(11) NOT NULL,
`ordendefgolesencontra` int(11) NOT NULL,
`ordendefamonestaciones` int(11) NOT NULL,
`ordendefexpulsiones` int(11) NOT NULL,
PRIMARY KEY (`formatotorneoid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `ganadorestorneos`
--
CREATE TABLE IF NOT EXISTS `ganadorestorneos` (
`torneoid` int(11) NOT NULL,
`equipoid` int(11) NOT NULL,
`fechacierre` datetime NOT NULL,
PRIMARY KEY (`torneoid`,`equipoid`),
KEY `equipoid` (`equipoid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `gruposusuarios`
--
CREATE TABLE IF NOT EXISTS `gruposusuarios` (
`grupousuarioid` int(11) NOT NULL AUTO_INCREMENT,
`descripcion` varchar(50) NOT NULL,
PRIMARY KEY (`grupousuarioid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `habilitacionestranjugadores`
--
CREATE TABLE IF NOT EXISTS `habilitacionestranjugadores` (
`temporadaid` int(11) NOT NULL,
`jugadorid` int(11) NOT NULL,
`equipoid` int(11) NOT NULL,
`motivohabtransitoriaid` int(11) NOT NULL,
`fechalimhabtransitoria` datetime NOT NULL,
`observaciones` varchar(250) NOT NULL,
PRIMARY KEY (`temporadaid`,`jugadorid`,`equipoid`,`motivohabtransitoriaid`),
KEY `FKhabilitacionestranjugadoresjugadores` (`jugadorid`),
KEY `FKhabilitacionestranjugadoresequipos` (`equipoid`),
KEY `FKhabilitacionestranjugadoresmotivoshabtransitoria` (`motivohabtransitoriaid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `incidenciaspartidos`
--
CREATE TABLE IF NOT EXISTS `incidenciaspartidos` (
`incidenciapartidoid` int(11) NOT NULL AUTO_INCREMENT,
`descripcion` varchar(25) NOT NULL,
`abreviatura` varchar(4) NOT NULL,
`tipodato` varchar(3) NOT NULL DEFAULT 'INT',
`definemarcador` tinyint(1) NOT NULL DEFAULT '0',
`definemarcadornegativo` tinyint(1) NOT NULL DEFAULT '0',
`ordenenmarcador` int(11) NOT NULL DEFAULT '0',
`totalizacomosuma` tinyint(1) NOT NULL DEFAULT '1',
`totalizacomocuenta` tinyint(1) NOT NULL DEFAULT '0',
`unicoenpartido` tinyint(1) NOT NULL DEFAULT '0',
`unicoenequipo` tinyint(1) NOT NULL DEFAULT '0',
`mostrarpublico` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`incidenciapartidoid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `jugadores`
--
CREATE TABLE IF NOT EXISTS `jugadores` (
`jugadorid` int(11) NOT NULL AUTO_INCREMENT,
`nrocarnet` int(11) NOT NULL,
`tipodocumento` int(11) NOT NULL DEFAULT '1',
`documento` varchar(25) CHARACTER SET latin1 NOT NULL,
`apellido` varchar(50) CHARACTER SET latin1 NOT NULL,
`clubid` int(11) NOT NULL,
`nombres` varchar(50) CHARACTER SET latin1 NOT NULL,
`fechanac` datetime NOT NULL,
`fechaalta` datetime NOT NULL,
`baja` tinyint(1) NOT NULL,
`fechabaja` datetime NOT NULL,
`auxiliar` varchar(25) CHARACTER SET latin1 NOT NULL,
`observaciones` varchar(500) CHARACTER SET latin1 DEFAULT NULL,
`email` varchar(100) CHARACTER SET latin1 DEFAULT NULL,
PRIMARY KEY (`jugadorid`),
KEY `FKCLUB` (`clubid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `lotessancionesacumuladas`
--
CREATE TABLE IF NOT EXISTS `lotessancionesacumuladas` (
`lotesancionacumuladaid` int(11) NOT NULL AUTO_INCREMENT,
`cantacumulada` int(11) NOT NULL,
`finalizado` tinyint(1) NOT NULL,
PRIMARY KEY (`lotesancionacumuladaid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `motivoshabilitaciontransitoria`
--
CREATE TABLE IF NOT EXISTS `motivoshabilitaciontransitoria` (
`motivohabtransitoriaid` int(11) NOT NULL AUTO_INCREMENT,
`docjugadoresid` int(11) DEFAULT NULL,
`inhabilitaalvencimiento` tinyint(1) NOT NULL DEFAULT '0',
`descripcion` varchar(150) NOT NULL,
PRIMARY KEY (`motivohabtransitoriaid`),
KEY `docjugadoresid` (`docjugadoresid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `partidos`
--
CREATE TABLE IF NOT EXISTS `partidos` (
`partidoid` int(11) NOT NULL AUTO_INCREMENT,
`torneoid` int(11) NOT NULL,
`esplayoff` tinyint(1) NOT NULL DEFAULT '0',
`instancia` varchar(6) NOT NULL,
`nrogrupo` varchar(2) NOT NULL,
`fechanro` int(11) NOT NULL,
`nropartido` int(11) NOT NULL,
`equipolocalid` int(11) NOT NULL,
`equipovisitaid` int(11) NOT NULL,
`arbitroid` int(11) DEFAULT NULL,
`juez1` varchar(100) DEFAULT NULL,
`juez2` varchar(100) DEFAULT NULL,
`canchaid` int(11) DEFAULT NULL,
`fecha` datetime NOT NULL,
`hora` varchar(5) NOT NULL,
`estadopartidoid` int(11) NOT NULL,
`calificacioncancha` int(11) NOT NULL,
`puntoslocal` int(11) NOT NULL,
`puntosvisita` int(11) NOT NULL,
`goleslocal` int(11) NOT NULL,
`golesvisita` int(11) NOT NULL,
`observaciones` varchar(500) DEFAULT NULL,
`publicar` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`partidoid`),
KEY `FKTORNEO` (`torneoid`),
KEY `FKEQLOCAL` (`equipolocalid`),
KEY `FKEQVISITA` (`equipovisitaid`),
KEY `FKARBITRO` (`arbitroid`),
KEY `FKCANCHA` (`canchaid`),
KEY `FKESTADOPARTIDO` (`estadopartidoid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `partidoscumplimientosanciones`
--
CREATE TABLE IF NOT EXISTS `partidoscumplimientosanciones` (
`partidoidcumplimiento` int(11) NOT NULL,
`sancionfalloid` int(11) NOT NULL,
PRIMARY KEY (`partidoidcumplimiento`,`sancionfalloid`),
KEY `sancionfalloid` (`sancionfalloid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `partidosdetalle`
--
CREATE TABLE IF NOT EXISTS `partidosdetalle` (
`partidodetalleid` int(11) NOT NULL AUTO_INCREMENT,
`partidoid` int(11) NOT NULL,
`equipoid` int(11) NOT NULL,
`jugadorid` int(11) NOT NULL,
`incidenciapartidoid` int(11) NOT NULL,
`valor` varchar(5) NOT NULL,
PRIMARY KEY (`partidodetalleid`),
KEY `FKPARTIDO` (`partidoid`),
KEY `FKJUGADOR` (`jugadorid`),
KEY `FKINCIDENCIA` (`incidenciapartidoid`),
KEY `EquipoId` (`equipoid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `posicionestorneos`
--
CREATE TABLE IF NOT EXISTS `posicionestorneos` (
`torneoid` int(11) NOT NULL,
`equipoid` int(11) NOT NULL,
`grupoid` int(11) NOT NULL,
`partidosjugados` int(11) NOT NULL,
`partidosganados` int(11) NOT NULL,
`partidosempatados` int(11) NOT NULL,
`partidosperdidos` int(11) NOT NULL,
`puntos` int(11) NOT NULL,
`golesafavor` int(11) NOT NULL,
`golesencontra` int(11) NOT NULL,
`difgoles` int(11) NOT NULL,
`cantamonestaciones` int(11) NOT NULL,
`cantexpulsados` int(11) NOT NULL,
PRIMARY KEY (`torneoid`,`equipoid`),
KEY `FKposicionestorneosequipos` (`equipoid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `posicionestributarias`
--
CREATE TABLE IF NOT EXISTS `posicionestributarias` (
`postributariaid` int(11) NOT NULL AUTO_INCREMENT,
`descripcion` varchar(50) NOT NULL,
PRIMARY KEY (`postributariaid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `premiaciones`
--
CREATE TABLE IF NOT EXISTS `premiaciones` (
`premiacionid` int(11) NOT NULL AUTO_INCREMENT,
`descripcion` varchar(50) NOT NULL,
PRIMARY KEY (`premiacionid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `puntobonus`
--
CREATE TABLE IF NOT EXISTS `puntobonus` (
`puntobonusid` int(11) NOT NULL AUTO_INCREMENT,
`descripcion` varchar(50) NOT NULL,
`cantidadfechas` int(11) NOT NULL,
`consecutivas` tinyint(1) NOT NULL,
`comparacion` char(2) NOT NULL,
`valoracomparar` int(11) NOT NULL,
`puntosextra` int(11) NOT NULL,
PRIMARY KEY (`puntobonusid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `relclubescanchas`
--
CREATE TABLE IF NOT EXISTS `relclubescanchas` (
`clubid` int(11) NOT NULL,
`canchaid` int(11) NOT NULL,
PRIMARY KEY (`clubid`,`canchaid`),
KEY `FKrelclubescanchascanchas` (`canchaid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `relclubescontactos`
--
CREATE TABLE IF NOT EXISTS `relclubescontactos` (
`clubid` int(11) NOT NULL,
`contactoid` int(11) NOT NULL,
`tipocontactoid` int(11) NOT NULL,
`observaciones` varchar(100) NOT NULL,
`nombre` varchar(50) NOT NULL,
`direccion` varchar(100) DEFAULT NULL,
`codpostal` varchar(15) DEFAULT NULL,
`localidad` varchar(50) DEFAULT NULL,
`provincia` varchar(50) DEFAULT NULL,
`telefono` varchar(50) DEFAULT NULL,
`celular` varchar(50) DEFAULT NULL,
`fax` varchar(50) DEFAULT NULL,
`mail` varchar(200) DEFAULT NULL,
PRIMARY KEY (`clubid`,`contactoid`),
KEY `FKTIPOCONTACTO` (`tipocontactoid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `relestadospartidosincidenciaspartidos`
--
CREATE TABLE IF NOT EXISTS `relestadospartidosincidenciaspartidos` (
`incidenciapartidoid` int(11) NOT NULL,
`estadopartidoid` int(11) NOT NULL,
PRIMARY KEY (`incidenciapartidoid`,`estadopartidoid`),
KEY `FKrelestadospartidosincidenciaspartidosestadospartidos` (`estadopartidoid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `relgruposusuariosaplicaciones`
--
CREATE TABLE IF NOT EXISTS `relgruposusuariosaplicaciones` (
`aplicacionid` int(11) NOT NULL,
`grupousuarioid` int(11) NOT NULL,
PRIMARY KEY (`aplicacionid`,`grupousuarioid`),
KEY `FKrelgruposusuariosaplicacionesgruposusuarios` (`grupousuarioid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `reljugadoresdocumentacionjugadores`
--
CREATE TABLE IF NOT EXISTS `reljugadoresdocumentacionjugadores` (
`jugadorid` int(11) NOT NULL,
`docjugadoresid` int(11) NOT NULL,
`valorid` int(11) NOT NULL,
`observaciones` varchar(500) DEFAULT NULL,
PRIMARY KEY (`jugadorid`,`docjugadoresid`),
KEY `FKreljugadoresdocumentacionjugadoresdocumentacionjugadores` (`docjugadoresid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `reljugadoresdocumentacionjugadoresimagenes`
--
CREATE TABLE IF NOT EXISTS `reljugadoresdocumentacionjugadoresimagenes` (
`jugadorid` int(11) NOT NULL,
`docjugadoresid` int(11) NOT NULL,
`nroimagen` int(11) NOT NULL DEFAULT '1',
`imagen` varchar(100) NOT NULL,
PRIMARY KEY (`jugadorid`,`docjugadoresid`,`nroimagen`),
KEY `docjugadoresid` (`docjugadoresid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `reljugadoresequipos`
--
CREATE TABLE IF NOT EXISTS `reljugadoresequipos` (
`jugadorid` int(11) NOT NULL,
`equipoid` int(11) NOT NULL,
`tipojugadorid` int(11) NOT NULL,
PRIMARY KEY (`jugadorid`,`equipoid`),
KEY `FKTIPOJUGADOR` (`tipojugadorid`),
KEY `FKreljugadoresequiposequipos` (`equipoid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `reljugadoresequiposhistorico`
--
CREATE TABLE IF NOT EXISTS `reljugadoresequiposhistorico` (
`temporadaid` int(11) NOT NULL,
`jugadorid` int(11) NOT NULL,
`equipoid` int(11) NOT NULL,
`fechaalta` datetime NOT NULL,
PRIMARY KEY (`temporadaid`,`jugadorid`,`equipoid`,`fechaalta`),
KEY `FKreljugadoresequiposhistoricojugadores` (`jugadorid`),
KEY `FKreljugadoresequiposhistoricoequipos` (`equipoid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `rellotessancionesacumuladassancionesjugadores`
--
CREATE TABLE IF NOT EXISTS `rellotessancionesacumuladassancionesjugadores` (
`lotesancionacumuladaid` int(11) NOT NULL,
`sancionjugadorid` int(11) NOT NULL,
PRIMARY KEY (`lotesancionacumuladaid`,`sancionjugadorid`),
KEY `sancionjugadorid` (`sancionjugadorid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `relopcionesatributosespecialespartidos`
--
CREATE TABLE IF NOT EXISTS `relopcionesatributosespecialespartidos` (
`atributoespecialpartidoid` int(11) NOT NULL,
`valor` varchar(250) NOT NULL,
KEY `FKATRIBUTO` (`atributoespecialpartidoid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `relpartidosatributosespecialespartidos`
--
CREATE TABLE IF NOT EXISTS `relpartidosatributosespecialespartidos` (
`atributoespecialpartidoid` int(11) NOT NULL,
`partidoid` int(11) NOT NULL,
`valor` varchar(250) NOT NULL,
PRIMARY KEY (`atributoespecialpartidoid`,`partidoid`),
KEY `FKrelpartidosatrespecialespartidospartidos` (`partidoid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `relpartidospuntobonus`
--
CREATE TABLE IF NOT EXISTS `relpartidospuntobonus` (
`puntobonusid` int(11) NOT NULL,
`partidoid` int(11) NOT NULL,
`equipoid` int(11) NOT NULL,
`valor` int(11) NOT NULL,
PRIMARY KEY (`puntobonusid`,`partidoid`,`equipoid`),
KEY `FKrelpartidospuntobonuspartidos` (`partidoid`),
KEY `FKrelpartidospuntobonusequipos` (`equipoid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `relpuntobonusincidenciaspartidos`
--
CREATE TABLE IF NOT EXISTS `relpuntobonusincidenciaspartidos` (
`puntobonusid` int(11) NOT NULL,
`incidenciapartidoid` int(11) NOT NULL,
PRIMARY KEY (`puntobonusid`,`incidenciapartidoid`),
KEY `incidenciapartidoid` (`incidenciapartidoid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `relpuntobonustiposanciones`
--
CREATE TABLE IF NOT EXISTS `relpuntobonustiposanciones` (
`puntobonusid` int(11) NOT NULL,
`tiposancionid` int(11) NOT NULL,
PRIMARY KEY (`puntobonusid`,`tiposancionid`),
KEY `tiposancionid` (`tiposancionid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `reltemporadaspremiacionesequipos`
--
CREATE TABLE IF NOT EXISTS `reltemporadaspremiacionesequipos` (
`temporadaid` int(11) NOT NULL,
`premiacionid` int(11) NOT NULL,
`equipoid` int(11) NOT NULL,
PRIMARY KEY (`temporadaid`,`premiacionid`,`equipoid`),
KEY `FKreltemporadaspremiacionesequipospremiaciones` (`premiacionid`),
KEY `FKreltemporadaspremiacionesequiposequipos` (`equipoid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `reltemporadaspremiacionesjugadores`
--
CREATE TABLE IF NOT EXISTS `reltemporadaspremiacionesjugadores` (
`temporadaid` int(11) NOT NULL,
`premiacionid` int(11) NOT NULL,
`jugadorid` int(11) NOT NULL,
PRIMARY KEY (`temporadaid`,`premiacionid`,`jugadorid`),
KEY `FKreltemporadaspremiacionesjugadorespremiaciones` (`premiacionid`),
KEY `FKreltemporadaspremiacionesjugadoresjugadores` (`jugadorid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `reltorneospremiacionesequipos`
--
CREATE TABLE IF NOT EXISTS `reltorneospremiacionesequipos` (
`torneoid` int(11) NOT NULL,
`premiacionid` int(11) NOT NULL,
`equipoid` int(11) NOT NULL,
PRIMARY KEY (`torneoid`,`premiacionid`,`equipoid`),
KEY `FKreltorneospremiacionesequipospremiaciones` (`premiacionid`),
KEY `FKreltorneospremiacionesequiposequipos` (`equipoid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `reltorneospremiacionesjugadores`
--
CREATE TABLE IF NOT EXISTS `reltorneospremiacionesjugadores` (
`torneoid` int(11) NOT NULL,
`premiacionid` int(11) NOT NULL,
`jugadorid` int(11) NOT NULL,
PRIMARY KEY (`torneoid`,`premiacionid`,`jugadorid`),
KEY `FKreltorneospremiacionesjugadorespremiaciones` (`premiacionid`),
KEY `FKreltorneospremiacionesjugadoresjugadores` (`jugadorid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `reltorneospuntobonus`
--
CREATE TABLE IF NOT EXISTS `reltorneospuntobonus` (
`puntobonusid` int(11) NOT NULL,
`torneoid` int(11) NOT NULL,
PRIMARY KEY (`puntobonusid`,`torneoid`),
KEY `FKtorneospuntobonustorneos` (`torneoid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `relusuariosgruposusuarios`
--
CREATE TABLE IF NOT EXISTS `relusuariosgruposusuarios` (
`usuarioid` varchar(25) NOT NULL,
`grupousuarioid` int(11) NOT NULL,
PRIMARY KEY (`usuarioid`,`grupousuarioid`),
KEY `FKrelusuariosgruposusuariosgruposusuarios` (`grupousuarioid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `sancionesfallos`
--
CREATE TABLE IF NOT EXISTS `sancionesfallos` (
`sancionfalloid` int(11) NOT NULL AUTO_INCREMENT,
`sancionjugadorid` int(11) NOT NULL,
`cantfechas` int(11) NOT NULL,
`fechadde` datetime NOT NULL,
`fechahta` datetime NOT NULL,
`fechascumplidas` int(11) NOT NULL,
`pendcumplimiento` tinyint(1) NOT NULL,
`pendfallo` tinyint(1) NOT NULL,
`generadaporacumulacion` tinyint(1) NOT NULL,
`observaciones` varchar(250) NOT NULL,
PRIMARY KEY (`sancionfalloid`),
KEY `sancionjugadorid` (`sancionjugadorid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `sancionesjugadores`
--
CREATE TABLE IF NOT EXISTS `sancionesjugadores` (
`sancionjugadorid` int(11) NOT NULL AUTO_INCREMENT,
`tiposancionid` int(11) NOT NULL,
`jugadorid` int(11) NOT NULL,
`equipoid` int(11) NOT NULL,
`partidoid` int(11) NOT NULL,
`fecha` datetime NOT NULL,
`cantidad` int(11) NOT NULL,
`categoriasancionorigenid` int(11) NOT NULL,
`sancionfalloid` int(11) DEFAULT NULL,
PRIMARY KEY (`sancionjugadorid`),
KEY `tiposancionid` (`tiposancionid`),
KEY `jugadorid` (`jugadorid`),
KEY `equipoid` (`equipoid`),
KEY `partidoid` (`partidoid`),
KEY `categoriasancionorigenid` (`categoriasancionorigenid`),
KEY `sancionfalloid` (`sancionfalloid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `temporadas`
--
CREATE TABLE IF NOT EXISTS `temporadas` (
`temporadaid` int(11) NOT NULL AUTO_INCREMENT,
`descripcion` varchar(15) NOT NULL,
PRIMARY KEY (`temporadaid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `tipocontactosclubes`
--
CREATE TABLE IF NOT EXISTS `tipocontactosclubes` (
`tipocontactoid` int(11) NOT NULL AUTO_INCREMENT,
`descripcion` varchar(50) NOT NULL,
PRIMARY KEY (`tipocontactoid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `tipojugadores`
--
CREATE TABLE IF NOT EXISTS `tipojugadores` (
`tipojugadorid` int(11) NOT NULL AUTO_INCREMENT,
`abreviatura` varchar(5) NOT NULL,
`descripcion` varchar(50) NOT NULL,
PRIMARY KEY (`tipojugadorid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `tiposanciones`
--
CREATE TABLE IF NOT EXISTS `tiposanciones` (
`tiposancionid` int(11) NOT NULL AUTO_INCREMENT,
`expulsion` tinyint(1) NOT NULL,
`amonestacion` tinyint(1) NOT NULL,
`descripcion` varchar(250) NOT NULL,
`cantminfechas` int(11) NOT NULL,
`abreviatura` varchar(4) NOT NULL,
`cantmaxfechas` int(11) NOT NULL,
`cumpletodascategorias` tinyint(1) NOT NULL DEFAULT '0',
`llevapendiente` tinyint(1) NOT NULL,
`color` varchar(10) NOT NULL,
`colortexto` varchar(10) NOT NULL,
`ocultardetallepublico` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`tiposancionid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `torneos`
--
CREATE TABLE IF NOT EXISTS `torneos` (
`torneoid` int(11) NOT NULL AUTO_INCREMENT,
`formatotorneoid` int(11) NOT NULL,
`descripcion` varchar(50) NOT NULL,
`cantgrupos` int(11) NOT NULL DEFAULT '1',
`cantequiposplayoff` int(11) NOT NULL DEFAULT '0',
`temporadaid` int(11) NOT NULL,
`categoriaid` int(11) NOT NULL,
`divisionid` int(11) NOT NULL,
`observaciones` varchar(1000) NOT NULL,
`cantascensos` int(11) NOT NULL,
`cantdescensos` int(11) NOT NULL,
`respetadeftipojugadores` tinyint(1) NOT NULL DEFAULT '1',
`respetadefhabtransitorias` tinyint(1) NOT NULL DEFAULT '1',
`respetadefsancionesacum` tinyint(1) NOT NULL DEFAULT '1',
`acumulagoleadores` tinyint(1) NOT NULL DEFAULT '0',
`acumulatablaconformada` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`torneoid`),
KEY `FKFORMATOTORNEO` (`formatotorneoid`),
KEY `FKTEMPORADA` (`temporadaid`),
KEY `FKCATEGORIA` (`categoriaid`),
KEY `FKDIVISION` (`divisionid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `usuarios`
--
CREATE TABLE IF NOT EXISTS `usuarios` (
`usuarioid` varchar(25) NOT NULL,
`password` varchar(25) NOT NULL,
`email` varchar(100) NOT NULL,
`cantpartidosmaxacargarporfecha` int(11) NOT NULL DEFAULT '1',
`arbitro` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`usuarioid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Restricciones para tablas volcadas
--
--
-- Filtros para la tabla `clubes`
--
ALTER TABLE `clubes`
ADD CONSTRAINT `FKclubesposicionestributarias` FOREIGN KEY (`postributariaid`) REFERENCES `posicionestributarias` (`postributariaid`),
ADD CONSTRAINT `FKclubesusuarios` FOREIGN KEY (`usuarioid`) REFERENCES `usuarios` (`usuarioid`);
--
-- Filtros para la tabla `definicionescategoriastemporadas`
--
ALTER TABLE `definicionescategoriastemporadas`
ADD CONSTRAINT `FKdefinicionescategoriastemporadascategorias` FOREIGN KEY (`categoriaid`) REFERENCES `categorias` (`categoriaid`),
ADD CONSTRAINT `FKdefinicionescategoriastemporadastemporadas` FOREIGN KEY (`temporadaid`) REFERENCES `temporadas` (`temporadaid`);
--
-- Filtros para la tabla `definicionescategoriastemporadashabtransitorias`
--
ALTER TABLE `definicionescategoriastemporadashabtransitorias`
ADD CONSTRAINT `FKdefcategoriastemporadashabtransitoriasmotivoshabtransitoria` FOREIGN KEY (`motivohabtransitoriaid`) REFERENCES `motivoshabilitaciontransitoria` (`motivohabtransitoriaid`),
ADD CONSTRAINT `FKdefinicionescategoriastemporadashabtransitoriascategorias` FOREIGN KEY (`categoriaid`) REFERENCES `categorias` (`categoriaid`),
ADD CONSTRAINT `FKdefinicionescategoriastemporadashabtransitoriastemporadas` FOREIGN KEY (`temporadaid`) REFERENCES `temporadas` (`temporadaid`);
--
-- Filtros para la tabla `definicionescategoriastemporadastipojugador`
--
ALTER TABLE `definicionescategoriastemporadastipojugador`
ADD CONSTRAINT `FKdefcategoriastemporadastipojugadorcategorias` FOREIGN KEY (`categoriaid`) REFERENCES `categorias` (`categoriaid`),
ADD CONSTRAINT `FKdefcategoriastemporadastipojugadortemporadas` FOREIGN KEY (`temporadaid`) REFERENCES `temporadas` (`temporadaid`),
ADD CONSTRAINT `FKdefcategoriastemporadastipojugadortipojugadores` FOREIGN KEY (`tipojugadorid`) REFERENCES `tipojugadores` (`tipojugadorid`);
--
-- Filtros para la tabla `definicionessancionesacumuladastemporadas`
--
ALTER TABLE `definicionessancionesacumuladastemporadas`
ADD CONSTRAINT `FKdefsancionesacumuladastemporadastemporadas` FOREIGN KEY (`temporadaid`) REFERENCES `temporadas` (`temporadaid`),
ADD CONSTRAINT `FKdefsancionesacumuladastemporadastipossanciones` FOREIGN KEY (`tiposancionid`) REFERENCES `tiposanciones` (`tiposancionid`);
--
-- Filtros para la tabla `documentacionjugadoresvalores`
--
ALTER TABLE `documentacionjugadoresvalores`
ADD CONSTRAINT `FKdocumentacionjugadoresvaloresdocumentacionjugadores` FOREIGN KEY (`docjugadoresid`) REFERENCES `documentacionjugadores` (`docjugadoresid`);
--
-- Filtros para la tabla `equipos`
--
ALTER TABLE `equipos`
ADD CONSTRAINT `FKequiposcanchas` FOREIGN KEY (`canchadefid`) REFERENCES `canchas` (`canchaid`),
ADD CONSTRAINT `FKequiposcategorias` FOREIGN KEY (`categoriaid`) REFERENCES `categorias` (`categoriaid`),
ADD CONSTRAINT `FKequiposclubes` FOREIGN KEY (`clubid`) REFERENCES `clubes` (`clubid`),
ADD CONSTRAINT `FKequiposdivisiones` FOREIGN KEY (`divisionid`) REFERENCES `divisiones` (`divisionid`);
--
-- Filtros para la tabla `ganadorestorneos`
--
ALTER TABLE `ganadorestorneos`
ADD CONSTRAINT `ganadorestorneos_ibfk_1` FOREIGN KEY (`torneoid`) REFERENCES `torneos` (`torneoid`),
ADD CONSTRAINT `ganadorestorneos_ibfk_2` FOREIGN KEY (`equipoid`) REFERENCES `equipos` (`equipoid`);
--
-- Filtros para la tabla `habilitacionestranjugadores`
--
ALTER TABLE `habilitacionestranjugadores`
ADD CONSTRAINT `FKhabilitacionestranjugadoresequipos` FOREIGN KEY (`equipoid`) REFERENCES `equipos` (`equipoid`),
ADD CONSTRAINT `FKhabilitacionestranjugadoresjugadores` FOREIGN KEY (`jugadorid`) REFERENCES `jugadores` (`jugadorid`),
ADD CONSTRAINT `FKhabilitacionestranjugadoresmotivoshabtransitoria` FOREIGN KEY (`motivohabtransitoriaid`) REFERENCES `motivoshabilitaciontransitoria` (`motivohabtransitoriaid`),
ADD CONSTRAINT `FKhabilitacionestranjugadorestemporadas` FOREIGN KEY (`temporadaid`) REFERENCES `temporadas` (`temporadaid`);
--
-- Filtros para la tabla `jugadores`
--
ALTER TABLE `jugadores`
ADD CONSTRAINT `FKjugadoresclubes` FOREIGN KEY (`clubid`) REFERENCES `clubes` (`clubid`);
--
-- Filtros para la tabla `motivoshabilitaciontransitoria`
--
ALTER TABLE `motivoshabilitaciontransitoria`
ADD CONSTRAINT `motivoshabilitaciontransitoria_ibfk_1` FOREIGN KEY (`docjugadoresid`) REFERENCES `documentacionjugadores` (`docjugadoresid`);
--
-- Filtros para la tabla `partidos`
--
ALTER TABLE `partidos`
ADD CONSTRAINT `FKpartidosarbitros` FOREIGN KEY (`arbitroid`) REFERENCES `arbitros` (`arbitroid`),
ADD CONSTRAINT `FKpartidoscanchas` FOREIGN KEY (`canchaid`) REFERENCES `canchas` (`canchaid`),
ADD CONSTRAINT `FKpartidosequiposlocales` FOREIGN KEY (`equipolocalid`) REFERENCES `equipos` (`equipoid`),
ADD CONSTRAINT `FKpartidosequiposvisitas` FOREIGN KEY (`equipovisitaid`) REFERENCES `equipos` (`equipoid`),
ADD CONSTRAINT `FKpartidosestadospartidos` FOREIGN KEY (`estadopartidoid`) REFERENCES `estadospartidos` (`estadopartidoid`),
ADD CONSTRAINT `FKpartidostorneos` FOREIGN KEY (`torneoid`) REFERENCES `torneos` (`torneoid`);
--
-- Filtros para la tabla `partidoscumplimientosanciones`
--
ALTER TABLE `partidoscumplimientosanciones`
ADD CONSTRAINT `partidoscumplimientosanciones_ibfk_1` FOREIGN KEY (`partidoidcumplimiento`) REFERENCES `partidos` (`partidoid`),
ADD CONSTRAINT `partidoscumplimientosanciones_ibfk_2` FOREIGN KEY (`sancionfalloid`) REFERENCES `sancionesfallos` (`sancionfalloid`);
--
-- Filtros para la tabla `partidosdetalle`
--
ALTER TABLE `partidosdetalle`
ADD CONSTRAINT `FKpartidosdetalleequipos` FOREIGN KEY (`equipoid`) REFERENCES `equipos` (`equipoid`),
ADD CONSTRAINT `FKpartidosdetalleincidenciaspartidos` FOREIGN KEY (`incidenciapartidoid`) REFERENCES `incidenciaspartidos` (`incidenciapartidoid`),
ADD CONSTRAINT `FKpartidosdetallejugadores` FOREIGN KEY (`jugadorid`) REFERENCES `jugadores` (`jugadorid`),
ADD CONSTRAINT `FKpartidosdetallepartidos` FOREIGN KEY (`partidoid`) REFERENCES `partidos` (`partidoid`);
--
-- Filtros para la tabla `posicionestorneos`
--
ALTER TABLE `posicionestorneos`
ADD CONSTRAINT `FKposicionestorneosequipos` FOREIGN KEY (`equipoid`) REFERENCES `equipos` (`equipoid`),
ADD CONSTRAINT `FKposicionestorneostorneos` FOREIGN KEY (`torneoid`) REFERENCES `torneos` (`torneoid`);
--
-- Filtros para la tabla `relclubescanchas`
--
ALTER TABLE `relclubescanchas`
ADD CONSTRAINT `FKrelclubescanchascanchas` FOREIGN KEY (`canchaid`) REFERENCES `canchas` (`canchaid`),
ADD CONSTRAINT `FKrelclubescanchasclubes` FOREIGN KEY (`clubid`) REFERENCES `clubes` (`clubid`);
--
-- Filtros para la tabla `relclubescontactos`
--
ALTER TABLE `relclubescontactos`
ADD CONSTRAINT `FKrelcontactosclubesclubes` FOREIGN KEY (`clubid`) REFERENCES `clubes` (`clubid`),
ADD CONSTRAINT `FKrelcontactosclubestipocontactosclubes` FOREIGN KEY (`tipocontactoid`) REFERENCES `tipocontactosclubes` (`tipocontactoid`);
--
-- Filtros para la tabla `relestadospartidosincidenciaspartidos`
--
ALTER TABLE `relestadospartidosincidenciaspartidos`
ADD CONSTRAINT `FKrelestadospartidosincidenciaspartidosestadospartidos` FOREIGN KEY (`estadopartidoid`) REFERENCES `estadospartidos` (`estadopartidoid`),
ADD CONSTRAINT `FKrelestadospartidosincidenciaspartidosincidenciaspartidos` FOREIGN KEY (`incidenciapartidoid`) REFERENCES `incidenciaspartidos` (`incidenciapartidoid`);
--
-- Filtros para la tabla `relgruposusuariosaplicaciones`
--
ALTER TABLE `relgruposusuariosaplicaciones`
ADD CONSTRAINT `FKrelgruposusuariosaplicacionesgruposusuarios` FOREIGN KEY (`grupousuarioid`) REFERENCES `gruposusuarios` (`grupousuarioid`);
--
-- Filtros para la tabla `reljugadoresdocumentacionjugadores`
--
ALTER TABLE `reljugadoresdocumentacionjugadores`
ADD CONSTRAINT `FKreljugadoresdocumentacionjugadoresdocumentacionjugadores` FOREIGN KEY (`docjugadoresid`) REFERENCES `documentacionjugadores` (`docjugadoresid`),
ADD CONSTRAINT `FKreljugadoresdocumentacionjugadoresjugadores` FOREIGN KEY (`jugadorid`) REFERENCES `jugadores` (`jugadorid`);
--
-- Filtros para la tabla `reljugadoresdocumentacionjugadoresimagenes`
--
ALTER TABLE `reljugadoresdocumentacionjugadoresimagenes`
ADD CONSTRAINT `reljugadoresdocumentacionjugadoresimagenes_ibfk_1` FOREIGN KEY (`jugadorid`) REFERENCES `jugadores` (`jugadorid`),
ADD CONSTRAINT `reljugadoresdocumentacionjugadoresimagenes_ibfk_2` FOREIGN KEY (`docjugadoresid`) REFERENCES `documentacionjugadores` (`docjugadoresid`);
--
-- Filtros para la tabla `reljugadoresequipos`
--
ALTER TABLE `reljugadoresequipos`
ADD CONSTRAINT `FKreljugadoresequiposequipos` FOREIGN KEY (`equipoid`) REFERENCES `equipos` (`equipoid`),
ADD CONSTRAINT `FKreljugadoresequiposjugadores` FOREIGN KEY (`jugadorid`) REFERENCES `jugadores` (`jugadorid`),
ADD CONSTRAINT `FKreljugadoresequipostipojugadores` FOREIGN KEY (`tipojugadorid`) REFERENCES `tipojugadores` (`tipojugadorid`);
--
-- Filtros para la tabla `reljugadoresequiposhistorico`
--
ALTER TABLE `reljugadoresequiposhistorico`
ADD CONSTRAINT `FKreljugadoresequiposhistoricoequipos` FOREIGN KEY (`equipoid`) REFERENCES `equipos` (`equipoid`),
ADD CONSTRAINT `FKreljugadoresequiposhistoricojugadores` FOREIGN KEY (`jugadorid`) REFERENCES `jugadores` (`jugadorid`),
ADD CONSTRAINT `FKreljugadoresequiposhistoricotemporadas` FOREIGN KEY (`temporadaid`) REFERENCES `temporadas` (`temporadaid`);
--
-- Filtros para la tabla `rellotessancionesacumuladassancionesjugadores`
--
ALTER TABLE `rellotessancionesacumuladassancionesjugadores`
ADD CONSTRAINT `rellotessancionesacumuladassancionesjugadores_ibfk_1` FOREIGN KEY (`lotesancionacumuladaid`) REFERENCES `lotessancionesacumuladas` (`lotesancionacumuladaid`),
ADD CONSTRAINT `rellotessancionesacumuladassancionesjugadores_ibfk_2` FOREIGN KEY (`sancionjugadorid`) REFERENCES `sancionesjugadores` (`sancionjugadorid`);
--
-- Filtros para la tabla `relopcionesatributosespecialespartidos`
--
ALTER TABLE `relopcionesatributosespecialespartidos`
ADD CONSTRAINT `FKrelopcionesatrespecialespartidosatrespecialespartidos` FOREIGN KEY (`atributoespecialpartidoid`) REFERENCES `atributosespecialespartidos` (`atributoespecialpartidoid`);
--
-- Filtros para la tabla `relpartidosatributosespecialespartidos`
--
ALTER TABLE `relpartidosatributosespecialespartidos`
ADD CONSTRAINT `FKrelpartidosatrespecialespartidosatrespecialespartidos` FOREIGN KEY (`atributoespecialpartidoid`) REFERENCES `atributosespecialespartidos` (`atributoespecialpartidoid`),
ADD CONSTRAINT `FKrelpartidosatrespecialespartidospartidos` FOREIGN KEY (`partidoid`) REFERENCES `partidos` (`partidoid`);
--
-- Filtros para la tabla `relpartidospuntobonus`
--
ALTER TABLE `relpartidospuntobonus`
ADD CONSTRAINT `FKrelpartidospuntobonusequipos` FOREIGN KEY (`equipoid`) REFERENCES `equipos` (`equipoid`),
ADD CONSTRAINT `FKrelpartidospuntobonuspartidos` FOREIGN KEY (`partidoid`) REFERENCES `partidos` (`partidoid`),
ADD CONSTRAINT `FKrelpartidospuntobonuspuntobonus` FOREIGN KEY (`puntobonusid`) REFERENCES `puntobonus` (`puntobonusid`);
--
-- Filtros para la tabla `relpuntobonusincidenciaspartidos`
--
ALTER TABLE `relpuntobonusincidenciaspartidos`
ADD CONSTRAINT `relpuntobonusincidenciaspartidos_ibfk_1` FOREIGN KEY (`puntobonusid`) REFERENCES `puntobonus` (`puntobonusid`),
ADD CONSTRAINT `relpuntobonusincidenciaspartidos_ibfk_2` FOREIGN KEY (`incidenciapartidoid`) REFERENCES `incidenciaspartidos` (`incidenciapartidoid`);
--
-- Filtros para la tabla `relpuntobonustiposanciones`
--
ALTER TABLE `relpuntobonustiposanciones`
ADD CONSTRAINT `relpuntobonustiposanciones_ibfk_1` FOREIGN KEY (`puntobonusid`) REFERENCES `puntobonus` (`puntobonusid`),
ADD CONSTRAINT `relpuntobonustiposanciones_ibfk_2` FOREIGN KEY (`tiposancionid`) REFERENCES `tiposanciones` (`tiposancionid`);
--
-- Filtros para la tabla `reltemporadaspremiacionesequipos`
--
ALTER TABLE `reltemporadaspremiacionesequipos`
ADD CONSTRAINT `FKreltemporadaspremiacionesequiposequipos` FOREIGN KEY (`equipoid`) REFERENCES `equipos` (`equipoid`),
ADD CONSTRAINT `FKreltemporadaspremiacionesequipospremiaciones` FOREIGN KEY (`premiacionid`) REFERENCES `premiaciones` (`premiacionid`),
ADD CONSTRAINT `FKreltemporadaspremiacionesequipostemporadas` FOREIGN KEY (`temporadaid`) REFERENCES `temporadas` (`temporadaid`);
--
-- Filtros para la tabla `reltemporadaspremiacionesjugadores`
--
ALTER TABLE `reltemporadaspremiacionesjugadores`
ADD CONSTRAINT `FKreltemporadaspremiacionesjugadoresjugadores` FOREIGN KEY (`jugadorid`) REFERENCES `jugadores` (`jugadorid`),
ADD CONSTRAINT `FKreltemporadaspremiacionesjugadorespremiaciones` FOREIGN KEY (`premiacionid`) REFERENCES `premiaciones` (`premiacionid`),
ADD CONSTRAINT `FKreltemporadaspremiacionesjugadorestemporadas` FOREIGN KEY (`temporadaid`) REFERENCES `temporadas` (`temporadaid`);
--
-- Filtros para la tabla `reltorneospremiacionesequipos`
--
ALTER TABLE `reltorneospremiacionesequipos`
ADD CONSTRAINT `FKreltorneospremiacionesequiposequipos` FOREIGN KEY (`equipoid`) REFERENCES `equipos` (`equipoid`),
ADD CONSTRAINT `FKreltorneospremiacionesequipospremiaciones` FOREIGN KEY (`premiacionid`) REFERENCES `premiaciones` (`premiacionid`),
ADD CONSTRAINT `FKreltorneospremiacionesequipostorneos` FOREIGN KEY (`torneoid`) REFERENCES `torneos` (`torneoid`);
--
-- Filtros para la tabla `reltorneospremiacionesjugadores`
--
ALTER TABLE `reltorneospremiacionesjugadores`
ADD CONSTRAINT `FKreltorneospremiacionesjugadoresjugadores` FOREIGN KEY (`jugadorid`) REFERENCES `jugadores` (`jugadorid`),
ADD CONSTRAINT `FKreltorneospremiacionesjugadorespremiaciones` FOREIGN KEY (`premiacionid`) REFERENCES `premiaciones` (`premiacionid`),
ADD CONSTRAINT `FKreltorneospremiacionesjugadorestorneos` FOREIGN KEY (`torneoid`) REFERENCES `torneos` (`torneoid`);
--
-- Filtros para la tabla `reltorneospuntobonus`
--
ALTER TABLE `reltorneospuntobonus`
ADD CONSTRAINT `FKtorneospuntobonuspuntobonus` FOREIGN KEY (`puntobonusid`) REFERENCES `puntobonus` (`puntobonusid`),
ADD CONSTRAINT `FKtorneospuntobonustorneos` FOREIGN KEY (`torneoid`) REFERENCES `torneos` (`torneoid`);
--
-- Filtros para la tabla `relusuariosgruposusuarios`
--
ALTER TABLE `relusuariosgruposusuarios`
ADD CONSTRAINT `FKrelusuariosgruposusuariosgruposusuarios` FOREIGN KEY (`grupousuarioid`) REFERENCES `gruposusuarios` (`grupousuarioid`),
ADD CONSTRAINT `FKreusuariosgruposusuariosusuarios` FOREIGN KEY (`usuarioid`) REFERENCES `usuarios` (`usuarioid`);
--
-- Filtros para la tabla `sancionesjugadores`
--
ALTER TABLE `sancionesjugadores`
ADD CONSTRAINT `sancionesjugadores_ibfk_1` FOREIGN KEY (`tiposancionid`) REFERENCES `tiposanciones` (`tiposancionid`),
ADD CONSTRAINT `sancionesjugadores_ibfk_2` FOREIGN KEY (`jugadorid`) REFERENCES `jugadores` (`jugadorid`),
ADD CONSTRAINT `sancionesjugadores_ibfk_3` FOREIGN KEY (`equipoid`) REFERENCES `equipos` (`equipoid`),
ADD CONSTRAINT `sancionesjugadores_ibfk_4` FOREIGN KEY (`partidoid`) REFERENCES `partidos` (`partidoid`),
ADD CONSTRAINT `sancionesjugadores_ibfk_5` FOREIGN KEY (`categoriasancionorigenid`) REFERENCES `categorias` (`categoriaid`),
ADD CONSTRAINT `sancionesjugadores_ibfk_6` FOREIGN KEY (`sancionfalloid`) REFERENCES `sancionesfallos` (`sancionfalloid`);
--
-- Filtros para la tabla `torneos`
--
ALTER TABLE `torneos`
ADD CONSTRAINT `FKtorneoscategorias` FOREIGN KEY (`categoriaid`) REFERENCES `categorias` (`categoriaid`),
ADD CONSTRAINT `FKtorneosdivisiones` FOREIGN KEY (`divisionid`) REFERENCES `divisiones` (`divisionid`),
ADD CONSTRAINT `FKtorneosformatostorneo` FOREIGN KEY (`formatotorneoid`) REFERENCES `formatostorneo` (`formatotorneoid`),
ADD CONSTRAINT `FKtorneostemporadas` FOREIGN KEY (`temporadaid`) REFERENCES `temporadas` (`temporadaid`);
/*!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 classes;
CREATE TABLE classes (
depttag text,
coursenum real,
coursename text,
termsoffered text,
reqfilled text,
classperiod text,
professor text,
classdescription text
);
|
Select *
From Orders;
-- match up customer to the customerid
Select *
From Orders
join Customers
on orders.CustomerId = Customers.Id;
-- only include columns name, city, state, date then order by name.
Select name, city, state, date
From Orders
join Customers
on orders.CustomerId = Customers.Id
order by name;
-- only include columns name, city, state, date then order by name. Include ID from orders table.
Select name, city, state, orders.Id, date
From Orders
join Customers
on orders.CustomerId = Customers.Id
order by name;
-- add alias for order id, name, date.
Select name as 'Customer', city, state, orders.Id as 'Order ID', date as 'Order Date'
From Orders
join Customers
on orders.CustomerId = Customers.Id
order by name;
--Use function to combine city and state. Then rename column.
Select name as 'Customer', CONCAT(City, ', ', state) as 'City/State', orders.Id as 'Order ID', date as 'Order Date'
From Orders
join Customers
on orders.CustomerId = Customers.Id
order by name;
--change the way date looks
Select name as 'Customer', CONCAT(City, ', ', state) as 'City/State', orders.Id as 'Order ID', format(date, 'MMM dd,yyy') as 'Order Date'
From Orders
join Customers
on orders.CustomerId = Customers.Id
order by name;
--just want orders for the company KFC
Select name as 'Customer', CONCAT(City, ', ', state) as 'City/State', orders.Id as 'Order ID', format(date, 'MMM dd,yyy') as 'Order Date'
From Orders
join Customers
on orders.CustomerId = Customers.Id
Where name = 'KFC';
--- order and customers with order number 2020 to 2040
Select name as 'Customer', CONCAT(City, ', ', state) as 'City/State', orders.Id as 'Order ID', format(date, 'MMM dd,yyy') as 'Order Date'
From Orders
join Customers
on orders.CustomerId = Customers.Id
Where orders.Id >= 2020 and orders.Id <= 2040
order by orders.id;
|
-- Creating the database
CREATE DATABASE IF NOT EXISTS worldcup;
USE worldcup;
-- Creating the table
CREATE TABLE IF NOT EXISTS LogDataRaw(
userId INT,
gap1 STRING,
gap2 STRING,
logTime1 STRING,
logTime2 STRING,
request1 STRING,
request2 STRING,
request3 STRING,
statusCode INT,
dataSize DOUBLE
)
ROW FORMAT DELIMITED
FIELDS TERMINATED BY ' '
STORED AS TEXTFILE;
-- Loading data into the raw table from files
LOAD DATA LOCAL INPATH '/resource/Data/SampleSet' OVERWRITE INTO TABLE LogDataRaw;
-- Making it possbile to have all partitions as dynamic
SET hive.exec.dynamic.partition.mode=nonstrict;
SET hive.decode.partition.name=true;
-- Creating the cleaned data table
CREATE TABLE IF NOT EXISTS LogData(
userId INT,
logTimeStamp STRING,
hourOfDay INT,
request STRING,
statusCode INT,
dataSize DOUBLE,
isHTML BOOLEAN,
isFrench BOOLEAN,
isEnglish BOOLEAN,
isSpanish BOOLEAN
)
PARTITIONED BY (logDate STRING, requestType STRING)
STORED AS TEXTFILE;
-- Loading Data into the cleaned table
FROM LogDataRaw source
INSERT OVERWRITE TABLE LogData PARTITION(logDate, requestType)
SELECT source.userId,
REGEXP_REPLACE(CONCAT(source.logTime1,source.logTime2), "(\\[|\\])", ""),
Hour(from_unixtime(unix_timestamp(REGEXP_REPLACE(CONCAT(source.logTime1,source.logTime2), "(\\[|\\])", ""), "dd/MMM/yyyy:HH:mm:ss"))),
source.request2, source.statusCode, source.dataSize, source.request2 RLIKE ".+\.(htm|html)$",
source.request2 RLIKE "/french.*", source.request2 RLIKE "/english.*", source.request2 RLIKE "/spanish.*",
REGEXP_REPLACE(REGEXP_EXTRACT(source.logTime1, "\\d+/\\w+/\\d+", 0),"/","-"), REGEXP_REPLACE(source.request1,"\"", "");
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.