blob_id stringlengths 40 40 | language stringclasses 1
value | repo_name stringlengths 5 133 | path stringlengths 3 276 | src_encoding stringclasses 33
values | length_bytes int64 23 9.61M | score float64 2.52 5.28 | int_score int64 3 5 | detected_licenses listlengths 0 44 | license_type stringclasses 2
values | text stringlengths 23 9.43M | download_success bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|
40ba1d8001d59029e815709cae67e6823ce2bd06 | SQL | Greta741/lePets | /database/roles.sql | UTF-8 | 1,880 | 2.90625 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 4.4.12
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: Dec 13, 2016 at 01:24 PM
-- Server version: 5.6.25
-- PHP Version: 5.6.11
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: `pets`
--
-- --------------------------------------------------------
--
-- Table structure for table `roles`
--
CREATE TABLE IF NOT EXISTS `roles` (
`id` int(11) NOT NULL,
`pavadinimas` varchar(50) COLLATE utf8_lithuanian_ci NOT NULL,
`lygis` int(11) NOT NULL,
`priskyrimo_laikas` datetime DEFAULT CURRENT_TIMESTAMP,
`aprasymas` varchar(200) COLLATE utf8_lithuanian_ci DEFAULT NULL
) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8 COLLATE=utf8_lithuanian_ci;
--
-- Dumping data for table `roles`
--
INSERT INTO `roles` (`id`, `pavadinimas`, `lygis`, `priskyrimo_laikas`, `aprasymas`) VALUES
(10, 'Registruotas vartotojas', 1, '2016-12-13 14:23:09', 'Paprastas registruotas vartotojas.'),
(11, 'Moderatorius', 3, '2016-12-13 14:23:27', NULL),
(12, 'Administratorius', 10, '2016-12-13 14:23:54', 'Sistemos administratorius'),
(13, 'Veislyno savininkas', 2, '2016-12-13 14:24:17', NULL);
--
-- Indexes for dumped tables
--
--
-- Indexes for table `roles`
--
ALTER TABLE `roles`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `roles`
--
ALTER TABLE `roles`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=14;
/*!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 */;
| true |
ff54c6f0d544bbd7dd975c61fadefd2948376cc6 | SQL | PavelRavvich/NLPCoach | /src/main/resources/db.sql | UTF-8 | 437 | 2.625 | 3 | [] | no_license | CREATE DATABASE nlp ENCODING 'UTF8';
CREATE TABLE IF NOT EXISTS comment (
);
CREATE TABLE IF NOT EXISTS phrases (
id SERIAL NOT NULL ,
x INTEGER NOT NULL ,
y TIMESTAMP NOT NULL ,
PRIMARY KEY (id)
);
INSERT INTO phrases (id, jsonPhrase)
VALUES (DEFAULT , '{"jsonPhrase":{"I ":false,"do not ":false,"want ":false,"this ":true,"due to ":false,"future ":false,"fail.":true}}');
DELETE FROM phrases WHERE id = 1; | true |
a1ed685c4d46203db48e25d3e4a90b84e7c78c44 | SQL | BurntLeftovers/cs50 | /pset7-movies/7.sql | UTF-8 | 162 | 3.578125 | 4 | [] | no_license | SELECT movies.title, ratings.rating
FROM movies
INNER JOIN ratings ON movies.id = ratings.movie_id
WHERE movies.year = '2010'
ORDER BY ratings.rating DESC, title; | true |
0eed55d4eaf8385637a5a87726a7d12ec0b28b7e | SQL | 3280382/rdesj | /schema/oracle/system/Dictionary.sql | UTF-8 | 859 | 2.953125 | 3 | [] | no_license | drop table SYS_DICTIONARY;
create table SYS_DICTIONARY
(
ID number(12) not null primary key,
PARENT_ID number(12),
NODES_TYPE varchar(10),
PARENT_KEY varchar(200),
KEY varchar(200) not null,
ALIAS varchar(200),
VALUE varchar(200),
VALUETYPE varchar(200),
VALIDATION varchar(1000),
VALUE1 varchar(200),
VALUETYPE1 varchar(200),
VALIDATION1 varchar(1000),
SORT_ORDER varchar(200),
ENABLE number(12) default 1,
VISUALABLE number(12) default 1,
DISPLAY_TYPE varchar(10),
EDITABLE number(12) default 1,
DESCRIPTION varchar(2000),
CREATED_DATE timestamp with time zone default sysdate,
MODIFIED_DATE timestamp with time zone
);
drop sequence SEQ_SYS_DICTIONARY_ID;
create sequence SEQ_SYS_DICTIONARY_ID
increment by 1 minvalue 10000 maxvalue 99999999999999999 start with 100000000 cache 20 cycle;
| true |
37be598a27e3aa37d06a27199fa7ce3d5e2430bf | SQL | j7ng/CLFY_SA | /SA/Tables/BATCH_JOB_EXECUTION_PARAMS.sql | UTF-8 | 418 | 2.703125 | 3 | [] | no_license | CREATE TABLE sa.batch_job_execution_params (
job_execution_id NUMBER(19) NOT NULL,
type_cd VARCHAR2(6 BYTE) NOT NULL,
key_name VARCHAR2(100 BYTE) NOT NULL,
string_val VARCHAR2(250 BYTE),
date_val TIMESTAMP,
long_val NUMBER(19),
double_val NUMBER,
identifying CHAR NOT NULL,
CONSTRAINT job_exec_params_fk FOREIGN KEY (job_execution_id) REFERENCES sa.batch_job_execution (job_execution_id)
); | true |
1d7fb98c182f4024b02a96ae7cfae8b3a6111f73 | SQL | vyasishanatc194/property-api-php | /property_system.sql | UTF-8 | 2,027 | 3.421875 | 3 | [] | no_license | -- Adminer 4.6.3 MySQL dump
SET NAMES utf8;
SET time_zone = '+00:00';
SET foreign_key_checks = 0;
SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
SET NAMES utf8mb4;
DROP TABLE IF EXISTS `property_type`;
CREATE TABLE `property_type` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`title` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL,
`description` text COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `property_type_title_index` (`title`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
DROP TABLE IF EXISTS `properties`;
CREATE TABLE `properties` (
`uuid` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
`property_type_id` int(10) unsigned DEFAULT '0',
`county` varchar(60) COLLATE utf8mb4_unicode_ci NOT NULL,
`country` varchar(60) COLLATE utf8mb4_unicode_ci NOT NULL,
`town` varchar(60) COLLATE utf8mb4_unicode_ci NOT NULL,
`description` text COLLATE utf8mb4_unicode_ci,
`address` varchar(200) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`image_full` varchar(200) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`image_thumbnail` varchar(200) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`image_local` varchar(200) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`latitude` decimal(9,6) DEFAULT NULL,
`longitude` decimal(9,6) DEFAULT NULL,
`num_bedrooms` tinyint(3) unsigned DEFAULT '0',
`num_bathrooms` tinyint(3) unsigned DEFAULT '0',
`price` decimal(12,2) unsigned DEFAULT '0.00',
`type` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`created_from` enum('local','live') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'local',
`postcode` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
KEY `properties_uuid_index` (`uuid`),
KEY `properties_property_type_id_index` (`property_type_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- 2020-07-04 12:58:59 | true |
18b270b5eb2422b586ffc2a077c6bbb187bf9e0b | SQL | LGalassi/cs50-2020-psets | /psets/pset7/movies/10.sql | UTF-8 | 215 | 3.53125 | 4 | [] | no_license | SELECT DISTINCT name
FROM people
JOIN directors
ON people.id = directors.person_id
JOIN movies
ON directors.movie_id = movies.id
JOIN ratings
ON movies.id = ratings.movie_id
WHERE rating >= 9.0; | true |
8aac7f4626438b3d2159c93721e62b1ab88c0f8b | SQL | Melanjnk/egg | /docker/local/mysql/dump/egg.sql | UTF-8 | 3,535 | 3.296875 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 5.0.4
-- https://www.phpmyadmin.net/
--
-- Хост: db
-- Время создания: Дек 28 2020 г., 11:04
-- Версия сервера: 10.5.8-MariaDB-1:10.5.8+maria~focal
-- Версия PHP: 7.4.13
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 */;
--
-- База данных: `egg`
--
-- --------------------------------------------------------
--
-- Структура таблицы `orders`
--
CREATE TABLE `orders` (
`id` int(11) NOT NULL,
`subtotal` decimal(10,2) NOT NULL,
`city_id` int(11) NOT NULL,
`user_id` int(11) NOT NULL,
`created` datetime NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Дамп данных таблицы `orders`
--
INSERT INTO `orders` (`id`, `subtotal`, `city_id`, `user_id`, `created`) VALUES
(1, '1055.55', 1, 1, '2020-12-28 13:32:31'),
(2, '2000.11', 1, 2, '2020-12-09 13:32:31'),
(3, '500.00', 1, 2, '2020-12-29 10:33:43'),
(4, '100.00', 2, 2, '2020-12-28 10:33:43');
-- --------------------------------------------------------
--
-- Структура таблицы `questions`
--
CREATE TABLE `questions` (
`id` int(11) NOT NULL,
`catalog_id` int(11) NOT NULL,
`user_id` int(11) NOT NULL,
`title` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Дамп данных таблицы `questions`
--
INSERT INTO `questions` (`id`, `catalog_id`, `user_id`, `title`) VALUES
(1, 1, 1, 'ques 1'),
(2, 1, 1, 'ques 2'),
(3, 2, 2, 'ques 3'),
(4, 3, 2, 'ques 4'),
(5, 1, 2, 'ques 5');
-- --------------------------------------------------------
--
-- Структура таблицы `users`
--
CREATE TABLE `users` (
`id` int(11) NOT NULL,
`name` varchar(40) NOT NULL,
`phone` varchar(20) NOT NULL,
`email` varchar(255) NOT NULL,
`created` datetime NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Дамп данных таблицы `users`
--
INSERT INTO `users` (`id`, `name`, `phone`, `email`, `created`) VALUES
(1, 'kim', '+79554531215', 'k.kim@gmail.com', '2020-12-28 09:29:24'),
(2, 'kum', '+79554531216', 'k2.kim@gmail.com', '2020-12-28 09:29:24'),
(3, 'kom', '+79554531217', 'kom@gmail.com', '2020-12-28 10:35:53');
--
-- Индексы сохранённых таблиц
--
--
-- Индексы таблицы `orders`
--
ALTER TABLE `orders`
ADD PRIMARY KEY (`id`);
--
-- Индексы таблицы `questions`
--
ALTER TABLE `questions`
ADD PRIMARY KEY (`id`);
--
-- Индексы таблицы `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT для сохранённых таблиц
--
--
-- AUTO_INCREMENT для таблицы `orders`
--
ALTER TABLE `orders`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT для таблицы `questions`
--
ALTER TABLE `questions`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
--
-- AUTO_INCREMENT для таблицы `users`
--
ALTER TABLE `users`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true |
899d940bc723287ddfef326ee1571d89c3fd386d | SQL | Shebara/ship-app | /db.sql | UTF-8 | 5,190 | 3.109375 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 5.0.2
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Aug 06, 2020 at 02:43 PM
-- Server version: 10.4.13-MariaDB
-- PHP Version: 7.2.31
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: `ship_app`
--
-- --------------------------------------------------------
--
-- Table structure for table `notifications`
--
CREATE TABLE `notifications` (
`id` int(11) NOT NULL,
`title` varchar(255) NOT NULL,
`content` varchar(5000) NOT NULL,
`ranks` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `password_requests`
--
CREATE TABLE `password_requests` (
`token` varchar(255) NOT NULL,
`user_id` int(11) NOT NULL,
`date` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `ranks`
--
CREATE TABLE `ranks` (
`id` int(11) NOT NULL,
`name` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `ranks`
--
INSERT INTO `ranks` (`id`, `name`) VALUES
(1, 'Administrator');
-- --------------------------------------------------------
--
-- Table structure for table `ships`
--
CREATE TABLE `ships` (
`id` int(11) NOT NULL,
`name` varchar(255) NOT NULL,
`serial_number` char(8) NOT NULL,
`image_url` varchar(255) NOT NULL DEFAULT ''
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
CREATE TABLE `users` (
`id` int(11) NOT NULL,
`name` varchar(255) NOT NULL,
`surname` varchar(255) NOT NULL,
`email` varchar(255) NOT NULL,
`password` varchar(255) NOT NULL DEFAULT '',
`registered_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `users`
--
INSERT INTO `users` (`id`, `name`, `surname`, `email`, `password`, `registered_at`) VALUES
(1, 'Admin', 'Adminson', 'admin@shipapp.dev', '*4ACFE3202A5FF5CF467898FC58AAB1D615029441', '2020-08-05 11:10:20');
-- --------------------------------------------------------
--
-- Table structure for table `user_notification`
--
CREATE TABLE `user_notification` (
`user_id` int(11) NOT NULL,
`notification_id` int(11) NOT NULL,
`seen` tinyint(1) NOT NULL,
`hidden` tinyint(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `user_sessions`
--
CREATE TABLE `user_sessions` (
`id` int(11) NOT NULL,
`token` varchar(255) NOT NULL,
`started_at` timestamp NOT NULL DEFAULT current_timestamp(),
`remember` tinyint(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `user_settings`
--
CREATE TABLE `user_settings` (
`id` int(11) NOT NULL,
`rank` int(11) NOT NULL,
`disabled` tinyint(1) NOT NULL DEFAULT 0,
`ship` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `user_settings`
--
INSERT INTO `user_settings` (`id`, `rank`, `disabled`, `ship`) VALUES
(1, 1, 0, NULL);
--
-- Indexes for dumped tables
--
--
-- Indexes for table `notifications`
--
ALTER TABLE `notifications`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `password_requests`
--
ALTER TABLE `password_requests`
ADD PRIMARY KEY (`token`);
--
-- Indexes for table `ranks`
--
ALTER TABLE `ranks`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `ships`
--
ALTER TABLE `ships`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `serial_number` (`serial_number`);
--
-- Indexes for table `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `email` (`email`);
--
-- Indexes for table `user_notification`
--
ALTER TABLE `user_notification`
ADD UNIQUE KEY `user_id` (`user_id`,`notification_id`);
--
-- Indexes for table `user_sessions`
--
ALTER TABLE `user_sessions`
ADD PRIMARY KEY (`token`);
--
-- Indexes for table `user_settings`
--
ALTER TABLE `user_settings`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `notifications`
--
ALTER TABLE `notifications`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `ranks`
--
ALTER TABLE `ranks`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `ships`
--
ALTER TABLE `ships`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
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 */;
| true |
cfeeb691aff696f1b6c95afcdf04910479d8047c | SQL | chejuho/itfreeswebapp | /Kankokujin/sql/create_category.sql | UTF-8 | 674 | 2.859375 | 3 | [] | no_license |
DROP TABLE IF EXISTS t_category;
CREATE TABLE t_category (
user_id varchar(20) NOT NULL DEFAULT '',
code varchar(4) NOT NULL DEFAULT '',
name varchar(200) NOT NULL DEFAULT '',
level int(2) NOT NULL DEFAULT '0',
orderNo int(3) NOT NULL DEFAULT '0',
oya_code varchar(4) DEFAULT NULL,
PRIMARY KEY (user_id,code)
) TYPE=MyISAM;
DROP TABLE IF EXISTS t_bookmark;
CREATE TABLE t_bookmark (
id int(11) NOT NULL AUTO_INCREMENT,
user_id varchar(20) NOT NULL DEFAULT '',
code varchar(4) DEFAULT NULL,
title varchar(200) DEFAULT NULL,
url varchar(200) DEFAULT NULL,
detail varchar(200) DEFAULT NULL,
PRIMARY KEY (id)
) TYPE=MyISAM;
| true |
b9558e7a71346c4389912d5742574ad0af8587d2 | SQL | clsr0901/clsr-blog | /src/main/resources/schema.sql | UTF-8 | 3,364 | 3.671875 | 4 | [] | no_license | CREATE TABLE IF NOT EXISTS blog.t_user (
id bigint(20) NOT NULL AUTO_INCREMENT,
avatar varchar(200) NOT NULL DEFAULT '' COMMENT '用户头像',
email varchar(50) DEFAULT '' COMMENT '用户邮箱',
password varchar(50) NOT NULL COMMENT '密码',
username varchar(100) NOT NULL COMMENT '用户名',
phone varchar(11) DEFAULT '' COMMENT '用户手机号',
instruction varchar(255) DEFAULT '' COMMENT '一句话自我介绍',
create timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (id),
UNIQUE INDEX phone (phone),
UNIQUE INDEX UK_ob8kqyqqgmefl0aco34akdtpe (email),
UNIQUE INDEX UK_sb8bbouer5wak8vyiiy4pf2bx (username)
)
ENGINE = MYISAM
AUTO_INCREMENT = 3
AVG_ROW_LENGTH = 52
CHARACTER SET utf8
COLLATE utf8_general_ci
COMMENT = '用户表';
CREATE TABLE IF NOT EXISTS blog.t_blog (
id int(11) NOT NULL AUTO_INCREMENT,
userId int(11) NOT NULL COMMENT '用户ID',
content blob NOT NULL COMMENT '博客内容',
hit int(11) NOT NULL DEFAULT 0 COMMENT '点赞数',
view int(11) NOT NULL DEFAULT 0 COMMENT '观看数',
sticky tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否置顶',
highlight tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否加精',
createtime timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
update_time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
PRIMARY KEY (id),
INDEX userId (userId)
)
ENGINE = MYISAM
AUTO_INCREMENT = 3
AVG_ROW_LENGTH = 52
CHARACTER SET utf8
COLLATE utf8_general_ci
COMMENT = '博客表';
CREATE TABLE blog.t_message (
id int(11) NOT NULL AUTO_INCREMENT,
destUserId int(11) NOT NULL COMMENT '目标人id',
sourceUserId int(11) NOT NULL COMMENT '留言人id',
message text NOT NULL COMMENT '留言信息',
createTime datetime DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (id)
)
ENGINE = INNODB
AUTO_INCREMENT = 27
AVG_ROW_LENGTH = 655
CHARACTER SET utf8
COLLATE utf8_general_ci
COMMENT = '留言表';
CREATE TABLE blog.t_comment (
id int(11) NOT NULL AUTO_INCREMENT,
blogId int(11) NOT NULL COMMENT '博客id',
content text NOT NULL COMMENT '评论内容',
action int(2) NOT NULL DEFAULT 0 COMMENT '0 评论, 1 回复',
sourceUserId int(11) NOT NULL COMMENT '评论人id',
destUserId int(11) DEFAULT NULL COMMENT '目标人id,回复才有',
createtime datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
PRIMARY KEY (id)
)
ENGINE = INNODB
AUTO_INCREMENT = 1
CHARACTER SET utf8
COLLATE utf8_general_ci
COMMENT = '博客评论表';
CREATE TABLE blog.t_source (
id int(11) NOT NULL AUTO_INCREMENT,
name varchar(255) NOT NULL DEFAULT '' COMMENT '文件名',
uid varchar(32) NOT NULL DEFAULT '' COMMENT '文件md5值',
url varchar(100) NOT NULL DEFAULT '' COMMENT '文件路径',
createtime datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
userid int(11) NOT NULL COMMENT '创建人id',
length int(11) NOT NULL COMMENT '文件大小',
mime varchar(20) NOT NULL COMMENT '文件mime',
type int(2) NOT NULL DEFAULT 1 COMMENT '文件类型: 0 文本txt, 1 图片audio, 2 音频audio,3 视频video, 4 其他文件zip',
PRIMARY KEY (id),
UNIQUE INDEX md5 (uid)
)
ENGINE = INNODB
AUTO_INCREMENT = 40
AVG_ROW_LENGTH = 3276
CHARACTER SET utf8
COLLATE utf8_general_ci
COMMENT = '资源文件表'; | true |
bc35eb7e4dbe4213cf81c68ef865d7822816ff7f | SQL | J-N/swganh | /data/sql/galaxy/scripts/guild.sql | UTF-8 | 759 | 3.421875 | 3 | [
"MIT"
] | permissive | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET NAMES utf8 */;
/*!40014 SET FOREIGN_KEY_CHECKS=0 */;
DROP TABLE IF EXISTS `guild`;
CREATE TABLE IF NOT EXISTS `guild` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`tag` tinytext,
`guild_list` int(11) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `FK098764576308` (`guild_list`),
CONSTRAINT `FK098764576308` FOREIGN KEY (`guild_list`) REFERENCES `guild_members` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='guild object';
DELETE FROM `guild`;
/*!40000 ALTER TABLE `guild` DISABLE KEYS */;
/*!40000 ALTER TABLE `guild` ENABLE KEYS */;
/*!40014 SET FOREIGN_KEY_CHECKS=1 */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
| true |
6791786d1b0a75d11ee7d0c1c0d5513b4f65eee7 | SQL | leedabee/databricks-forum-support-notebooks | /db-forum-20881/db-forum-20881-unable-to-handle-columns-enclosed-by-characters.sql | UTF-8 | 3,706 | 3.59375 | 4 | [] | no_license | -- Databricks notebook source
select "hello"
-- COMMAND ----------
-- MAGIC %python
-- MAGIC
-- MAGIC # This is demonstrating the use of 'magic' commands in databricks, allowing you to switch between languages in one notebook. Since you created the notebook as SQL, that's the default language for a block. You override using the % syntax
-- MAGIC
-- MAGIC print('hello')
-- COMMAND ----------
-- We're back in SQL, for now
-- Below let's see the filesystem root, hopefully you see your ADLS mount: /mnt/ADLS/files/. Check out the docs for dbutils to see what else you can do at the filesystem level
-- COMMAND ----------
-- MAGIC %fs ls
-- COMMAND ----------
-- DROP TABLE IF exists all_export_results;
CREATE TABLE all_export_results
(RECORD_NUMBER STRING,
APPROVED_BY STRING,
APPROVED_ON STRING)
USING CSV
OPTIONS (delimiter ',', header 'true')
LOCATION '/mnt/ADLS/files/all_export_results'
-- COMMAND ----------
SELECT * FROM all_export_results
-- COMMAND ----------
-- MAGIC %python
-- MAGIC # Now let's expose this table via python/pyspark DataFrame API
-- MAGIC
-- MAGIC df = sqlContext.table('all_export_results')
-- MAGIC display(df)
-- COMMAND ----------
-- MAGIC %python
-- MAGIC # Note that you can ALSO interact with the table you created by using the SparkContext and an inline sql query
-- MAGIC
-- MAGIC display(spark.sql("SELECT * from all_export_results"))
-- COMMAND ----------
-- MAGIC %scala
-- MAGIC // same thing in scala
-- MAGIC
-- MAGIC display(spark.sql("SELECT * from all_export_results"))
-- COMMAND ----------
-- MAGIC %python
-- MAGIC # and then use string functions to do some cleaning like you need, for example
-- MAGIC
-- MAGIC display(spark.sql("""
-- MAGIC SELECT REPLACE(APPROVED_BY, '#','') AS APPROVED_BY_CLEAN
-- MAGIC from all_export_results
-- MAGIC """))
-- COMMAND ----------
-- So now let's clean the table you created via Spark SQL, using pyspark Dataframes
-- COMMAND ----------
-- MAGIC %python
-- MAGIC
-- MAGIC from pyspark.sql.functions import regexp_replace, col
-- MAGIC
-- MAGIC df = sqlContext.table('all_export_results')
-- MAGIC clean_df = df.select(*(regexp_replace(col(c),'#','').alias(c) for c in df.columns))
-- MAGIC display(clean_df)
-- COMMAND ----------
-- MAGIC %python
-- MAGIC
-- MAGIC # We do need to register a new table in SparkContext if you want to work with it in SQL. That is,
-- MAGIC sqlContext.registerDataFrameAsTable(clean_df, 'all_export_results_clean')
-- COMMAND ----------
SELECT * from all_export_results_clean
-- COMMAND ----------
-- MAGIC %python
-- MAGIC # This would be a more elegant overall solution
-- MAGIC # 1. read data using DataFrameReader (vs. using the create table ... location statement)
-- MAGIC # this allows you to leverage the inferSchema and header options
-- MAGIC # and never have to spell out the schema of each of your data files
-- MAGIC # 2. transform the data with DataFrames, allowing you to use that star expansion
-- MAGIC # 3. save the dataframe
-- MAGIC # 4. if you have ~100 data files, you can easily wrap a for loop around all of this
-- MAGIC # .. I would point you to python docs for basic file IO and looping
-- MAGIC
-- MAGIC from pyspark.sql.functions import regexp_replace, col
-- MAGIC
-- MAGIC t_df = spark.read.csv('/mnt/ADLS/files/all_export_results', header=True, inferSchema=True)
-- MAGIC t_clean_df = t_df.select(*(regexp_replace(col(c),'#','').alias(c) for c in t_df.columns))
-- MAGIC sqlContext.registerDataFrameAsTable(t_clean_df, 't_all_export_results')
-- MAGIC display(spark.sql("SELECT * FROM t_all_export_results"))
| true |
a2adcc82a0081b36f26f3cdcf89128ba089f128d | SQL | ochukai/green-apple | /sql/table.sql | UTF-8 | 4,569 | 2.78125 | 3 | [
"MIT"
] | permissive | -- Table "public.doctor_bound_info"
-- Column | Type | Modifiers
-- -----------------+-----------------------------+----------------------------------------------------------------
-- id | integer | not null default nextval('doctor_bound_info_id_seq'::regclass)
-- doctor_id | integer | not null
-- phone_num | character varying(50) | not null
-- password | character varying(200) | not null
-- pwd_update_time | timestamp(6) with time zone |
-- is_login | boolean | not null
-- create_time | timestamp(6) with time zone | not null
-- is_deleted | boolean | not null
insert into doctor_bound_info (doctor_id, phone_num, password, create_time, is_login, is_deleted)
select id, phone_num, password, now(), 'f', 'f'
from doctor d
where d.id = 41108;
-- Table "public.doctor"
-- Column | Type | Modifiers
-- ----------------------------+-----------------------------+-----------------------------------------------------
-- id | integer | not null default nextval('doctor_id_seq'::regclass)
-- user_type | character varying(3) | not null
-- sex | character varying(1) |
-- password | character varying(200) |
-- phone_num | character varying(50) | not null default '18612345678'::character varying
-- real_name | character varying(200) |
-- header_pic | character varying(100) |
-- register_time | timestamp(6) with time zone | not null
-- title_aca | character varying(4) |
-- title_med | character varying(4) |
-- specialty_id | integer |
-- feature | character varying(1000) |
-- department_id | integer |
-- last_update_time | timestamp(6) with time zone | not null
-- pwd_update_time | timestamp(6) with time zone |
-- pwd_create_time | timestamp(6) with time zone |
-- account_status | character varying(3) | not null
-- bio | text |
-- device_token | character varying(200) |
-- push_user_id | character varying(200) |
-- push_channel_id | character varying(200) |
-- tools | smallint |
-- hospital_id | integer |
-- dept_phone | character varying(20) |
-- referer | character varying(10) |
-- internal_remark | text |
-- phone_fee | smallint |
-- phone_fee_unit | smallint |
-- registered | boolean | not null
-- link_to_id | integer |
-- last_login_time | timestamp(6) with time zone |
-- app_version | character varying(20) |
-- device_type | character varying(20) |
-- device_id | character varying(50) |
-- os | character varying(10) |
-- os_version | character varying(10) |
-- channel | character varying(10) |
-- is_login | boolean | not null
-- last_verified_time | timestamp(6) with time zone |
-- extra | character varying(10) | not null
-- wx_openid | character varying(50) | not null
-- auth_pic | character varying(100) |
-- sales_id | integer |
-- auth_pic_status | character varying(3) | not null
-- membership_level | character varying(3) | not null
-- continuous_login_day_count | integer | not null
insert into user_gift(user_type, user_id, gift_id, amount, create_time, update_time, history_amount)
values('PAT', 21, 1, 10, now(), now(), 0)
update user_gift set amount = 10 where id = 8;
| true |
a9ec3b5579011ae1ad59feefc5bfb5f421b405ed | SQL | LeoCavalcante07/BugsBunny_modulo_2 | /back_up_bugsBunny/db_bugs_bunny_tbl_fale_conosco.sql | UTF-8 | 2,594 | 2.984375 | 3 | [] | no_license | -- MySQL dump 10.13 Distrib 8.0.12, for Win64 (x86_64)
--
-- Host: localhost Database: db_bugs_bunny
-- ------------------------------------------------------
-- Server version 8.0.12
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
SET NAMES utf8 ;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `tbl_fale_conosco`
--
DROP TABLE IF EXISTS `tbl_fale_conosco`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
SET character_set_client = utf8mb4 ;
CREATE TABLE `tbl_fale_conosco` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`nome` varchar(40) NOT NULL,
`telefone` varchar(15) DEFAULT NULL,
`celular` varchar(15) DEFAULT NULL,
`sexo` char(1) NOT NULL,
`profissao` varchar(30) NOT NULL,
`email` varchar(40) DEFAULT NULL,
`homePage` varchar(100) DEFAULT NULL,
`linkFacebook` varchar(100) DEFAULT NULL,
`informacoesProduto` varchar(100) DEFAULT NULL,
`critica` text,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `tbl_fale_conosco`
--
LOCK TABLES `tbl_fale_conosco` WRITE;
/*!40000 ALTER TABLE `tbl_fale_conosco` DISABLE KEYS */;
INSERT INTO `tbl_fale_conosco` VALUES (12,'John','(134)1324-5245','(545)45454-5454','m','Programador','john@le','homepage','http://localhost/leonardo/bugsBunny/modulo_1/CMS/admFaleConosco.php#','daora','aaaa'),(13,'teste do marcel','1231233132','1231233132-','m','alguma coisa','teste@teste.com','http://www.uol.com.br','http://www.uol.com.br/teste','teste','sdf sdf sdf');
/*!40000 ALTER TABLE `tbl_fale_conosco` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2018-12-12 16:54:01
| true |
3df7af5632e085dbfaacbc267f149b08bf958595 | SQL | Dev-Davis/candy_tracker_api | /create_tables.sql | UTF-8 | 3,804 | 3.640625 | 4 | [] | no_license |
IF not exists (SELECT * FROM sys.tables WHERE [name] = 'Candy')
BEGIN
CREATE TABLE [Candy]
(
[Id] UNIQUEIDENTIFIER PRIMARY KEY DEFAULT NEWID(),
[Name] NVARCHAR(255) not null,
[TypeId] INT not null,
[Size] INT not null,
[ImgUrl] NVARCHAR(max) not null
)
END
ELSE
PRINT 'Candy table already exists'
IF not exists (SELECT * FROM sys.tables WHERE [name] = 'Type')
BEGIN
CREATE TABLE [Type]
(
[Id] INT PRIMARY KEY IDENTITY (1,1),
[Name] NVARCHAR(255) not null
)
END
ELSE
PRINT 'Type table already exists!'
IF not exists (SELECT * FROM sys.tables WHERE [name] = 'Trade')
BEGIN
CREATE TABLE [Trade]
(
[Id] UNIQUEIDENTIFIER PRIMARY KEY DEFAULT NEWID(),
[UserCandyId] UNIQUEIDENTIFIER not null
)
END
ELSE
PRINT 'Trade table already exists!'
IF not exists (SELECT * FROM sys.tables WHERE [name] = 'User')
BEGIN
CREATE TABLE [User]
(
[Id] UNIQUEIDENTIFIER PRIMARY KEY DEFAULT NEWID(),
[FirstName] NVARCHAR(255) not null,
[LastName] NVARCHAR(255) not null,
[FavoriteTypeOfCandyId] INT not null,
[AmountOfCandyEaten] INT not null default(0),
[AmountOfCandyDonated] INT not null default(0)
)
END
ELSE
PRINT 'User table already exists'
IF not exists (SELECT * FROM sys.tables WHERE [name] = 'UserCandy')
BEGIN
CREATE TABLE [UserCandy]
(
[Id] UNIQUEIDENTIFIER PRIMARY KEY DEFAULT NEWID(),
[UserId] UNIQUEIDENTIFIER not null,
[CandyId] UNIQUEIDENTIFIER not null
)
END
ELSE
PRINT 'UserCandy table already exists'
IF not exists (SELECT * FROM sys.foreign_keys WHERE [name] = 'FK_Candy_Type')
BEGIN
ALTER TABLE [Candy]
ADD CONSTRAINT FK_Candy_Type
FOREIGN KEY (TypeId)
REFERENCES [Type] (Id)
END
ELSE
PRINT 'Foreign key FK_Candy_Type already exists'
IF not exists (SELECT * FROM sys.foreign_keys WHERE [name] = 'FK_UserCandy_User')
BEGIN
ALTER TABLE [UserCandy]
ADD CONSTRAINT FK_UserCandy_User
FOREIGN KEY (UserId)
REFERENCES [User] (Id)
END
ELSE
PRINT 'Foregin key FK_UserCandy_User already eists'
IF not exists (SELECT * FROM sys.foreign_keys WHERE [name] = 'FK_UserCandy_Candy')
BEGIN
ALTER TABLE [UserCandy]
ADD CONSTRAINT FK_UserCandy_Candy
FOREIGN KEY (CandyId)
REFERENCES [Candy] (Id)
END
ELSE
PRINT 'Foregin key FK_UserCandy_Candy already eists'
IF not exists (SELECT * FROM sys.foreign_keys WHERE [name] = 'FK_User_Type')
BEGIN
ALTER TABLE [User]
ADD CONSTRAINT FK_User_Type
FOREIGN KEY (FavoriteTypeOfCandyId)
REFERENCES [Type] (Id)
END
ELSE
PRINT 'Foregin key FK_User_Type already eists'
IF not exists (SELECT * FROM sys.foreign_keys WHERE [name] = 'FK_Trade_UserCandy')
BEGIN
ALTER TABLE [Trade]
ADD CONSTRAINT FK_Trade_UserCandy
FOREIGN KEY (UserCandyId)
REFERENCES [UserCandy] (Id)
END
ELSE
PRINT 'Foregin key FK_Trade_UserCandy already eists'
/************************************
INSERT INTO [Type]([Name])
VALUES ('Gummy'),
('Jelly Beans'),
('Lollipops and Suckers'),
('Rock Candy'),
('Taffy'),
('Asian'),
('Bite Size'),
('Bubble Gum'),
('Bulk Chocolates'),
('Mini Packs'),
('Candy Bars'),
('Candy Coated Popcorn'),
('Candy Sticks'),
('CBD Candy'),
('Chewing Gum'),
('Chewy Candy'),
('Fizzies'),
('Fruit Drops'),
('Giant Candy'),
('Gumballs'),
('Gumdrops'),
('Hard Candy'),
('Jawbreakers'),
('Liquid Candy'),
('Little Candy'),
('Movie Theatre Candy'),
('Novelty Candy'),
('Powder & Particle'),
('Ribbon Candy'),
('Spicy Candy'),
('Sweet Tarts Candy')
***********************************/
/*
INSERT INTO [User]([FirstName], [LastName], [FavoriteTypeOfCandyId])
VALUES ('Greg', 'Stephen', 2)
*/
SELECT u.FirstName + ' ' + u.LastName as FullName, t.Name AS FavoriteCandy
FROM [User] u
JOIN [Type] t
ON u.FavoriteTypeOfCandyId = t.Id
SELECT c.Id, c.Name, c.Price, t.Name
FROM Candy c
JOIN [Type] t
ON c.TypeId = t.Id | true |
45750b3c573a104938fe08cef647c04f599cdb46 | SQL | Diyatho/FlashCard-Study-App | /backend/database/cardschema.sql | UTF-8 | 1,169 | 4.125 | 4 | [] | no_license | BEGIN TRANSACTION;
DROP TABLE IF EXISTS deck_cards;
DROP TABLE IF EXISTS card_keyword;
DROP TABLE IF EXISTS deck;
DROP TABLE IF EXISTS keyword;
DROP TABLE IF EXISTS cards;
DROP TABLE IF EXISTS subject;
CREATE TABLE subject (
subject_id serial PRIMARY KEY,
subject_name varchar (50)
);
CREATE TABLE cards (
card_id serial PRIMARY KEY,
question varchar (1000) NOT NULL,
answer varchar (1000) NOT NULL,
subject_id integer REFERENCES subject (subject_id),
creator_id integer REFERENCES users (user_id)
);
CREATE TABLE keyword (
keyword_id serial PRIMARY KEY,
keyword varchar (50) NOT NULL
);
CREATE TABLE card_keyword (
card_id integer REFERENCES cards (card_id),
keyword_id integer REFERENCES keyword (keyword_id),
CONSTRAINT pk_card_id_keyword_id PRIMARY KEY (card_id, keyword_id)
);
CREATE TABLE deck (
deck_id serial PRIMARY KEY,
deck_name varchar (50) NOT NULL,
description varchar (500) ,
creator_id integer REFERENCES users (user_id)
);
CREATE TABLE deck_cards (
deck_id integer REFERENCES deck (deck_id),
card_id integer REFERENCES cards (card_id),
CONSTRAINT pk_deck_id_card_id PRIMARY KEY (deck_id, card_id)
);
COMMIT TRANSACTION;
| true |
d64ad48fcbb5ea7f21fdefe6b87d4db8d824cde1 | SQL | openit/Oracle_SQL_Scripts | /rc_rman_cont.sql | UTF-8 | 679 | 2.515625 | 3 | [] | no_license | PROMPT ##############################################################################
PROMPT Run the rc_rman_info_all.sql First to get the details needed for this script
PROMPT ##############################################################################
select btype, btype_key, session_key, session_recid, db_name, creation_time, resetlogs_change#, resetlogs_time, checkpoint_change#, checkpoint_time from RMAN.RC_BACKUP_CONTROLFILE_DETAILS
where session_recid='&session_recid';
select db_id, bp_key, recid, bs_key, backup_type, handle, media from RMAN.RC_BACKUP_PIECE where bs_key between '&bs_key_from' and '&bs_key_to';
-- Spfile info (look into this if needed) | true |
c9ba0afc03671cdd1797625f0a0b6e91e1d768db | SQL | KPess/SQL-Afternoon-1 | /sql-1-afternoon.sql | UTF-8 | 3,519 | 3.734375 | 4 | [] | no_license | CREATE TABLE person (
person_id SERIAL,
name VARCHAR(100),
age INT,
height INT,
city VARCHAR(100),
favorite_color VARCHAR(100)
);
INSERT INTO person (
name,
age,
height,
city,
favorite_color
) VALUES (
'Kevin Pessetto', 31, 185, 'Dallas', 'Blurquoise');
INSERT INTO person (
name,
age,
height,
city,
favorite_color
) VALUES (
'David Newman', 600, 600, 'Dallas', 'Gray');
INSERT INTO person (
name,
age,
height,
city,
favorite_color
) VALUES (
'Rachel M', 700, 700, 'Dallas', 'Black');
INSERT INTO person (
name,
age,
height,
city,
favorite_color
) VALUES (
'Mark Nagel', 800, 800, 'Dallas', 'Lightning');
INSERT INTO person (
name,
age,
height,
city,
favorite_color
) VALUES (
'Chris Biediger', 900, 900, 'Dallas', 'Clear');
SELECT * FROM person
ORDER BY height DESC;
SELECT * FROM person
ORDER BY height ASC;
SELECT * FROM person
ORDER BY age DESC;
SELECT * FROM person
WHERE age > 20;
SELECT * FROM person
WHERE age = 18;
SELECT * FROM person
WHERE age > 30 OR age <20;
SELECT * FROM person
WHERE age != 27;
SELECT * FROM person
WHERE favorite_color != 'red';
SELECT * FROM person
WHERE favorite_color != 'red' AND favorite_color != 'blue';
SELECT * FROM person
WHERE favorite_color = 'orange' OR favorite_color = 'green';
SELECT * FROM person
WHERE favorite_color IN ('orange', 'blue', 'green');
SELECT * FROM person
WHERE favorite_color IN ('yellow' || 'purple');
ORDERS SECTION
CREATE TABLE orders (
person_id SERIAL,
product_name TEXT,
product_price INT,
quantity INT)
INSERT INTO orders ( person_id, product_name, product_price, quantity )
VALUES ( 0, 'Bacon', 8.00, 40);
INSERT INTO orders ( person_id, product_name, product_price, quantity )
VALUES ( 1, 'Corn', 5.00, 4);
INSERT INTO orders ( person_id, product_name, product_price, quantity )
VALUES ( 2, 'Gravy', 3.00, 1);
INSERT INTO orders ( person_id, product_name, product_price, quantity )
VALUES ( 3, 'Biscuits', 2.50, 8);
INSERT INTO orders ( person_id, product_name, product_price, quantity )
VALUES ( 0, 'Eggs', 2.50, 12);
SELECT * FROM orders
SELECT SUM(quantity) FROM orders
SELECT SUM(product_price * quantity) FROM orders
SELECT SUM(product_price * quantity) FROM orders WHERE person_id = 0;
ARTIST SECTION
INSERT INTO artist (artist_id, name) VALUES (276, 'Slack Basseth');
INSERT INTO artist (artist_id, name) VALUES (277, 'AB/DB');
INSERT INTO artist (artist_id, name) VALUES (278, 'Hurple Durpleberries');
SELECT * FROM artist ORDER BY name DESC LIMIT 10;
SELECT * FROM artist ORDER BY name ASC LIMIT 5;
SELECT * FROM artist WHERE name LIKE 'Black%';
SELECT * FROM artist WHERE name iLIKE '%black%';
EMPLOYEE SECTION
SELECT first_name, last_name FROM employee WHERE city = 'Calgary'
SELECT birth_date FROM employee ORDER BY birth_date DESC LIMIT 1;
SELECT MIN(birth_date) FROM employee;
SELECT first_name, last_name FROM employee WHERE reports_to = 2;
SELECT COUNT(*) FROM employee WHERE city = 'Lethbridge';
INVOICE SECTION
SELECT COUNT(*) FROM invoice WHERE billing_country = 'USA';
SELECT MAX(total) FROM invoice;
SELECT MIN(total) FROM invoice;
SELECT * FROM invoice WHERE total > 5;
SELECT COUNT(*) FROM invoice WHERE total < 5;
SELECT COUNT(*) FROM invoice WHERE billing_state IN ('CA', 'TX', 'AZ');
SELECT SUM(TOTAL)/COUNT(*) FROM invoice;
SELECT SUM(total) FROM invoice; | true |
c3632691c2d423702b7eb8e6df1e8ab2cdcf4dda | SQL | kmulligan01/Bamazon | /bamazon.sql | UTF-8 | 949 | 3.375 | 3 | [] | no_license | -- Create a database called 'bamazon' and switch into it for this activity --
CREATE DATABASE bamazon;
USE bamazon;
-- Create a table called 'product' which will contain the store inventory --
CREATE TABLE product (
item_id INT(11) AUTO_INCREMENT NOT NULL,
product_name VARCHAR(30) NOT NULL,
department_name VARCHAR(20) NOT NULL,
price INT(100) NOT NULL,
stock_quantity INT(11) NOT NULL,
PRIMARY KEY (item_id)
);
-- Insert data into the 'product' table --
INSERT INTO product (product_name, department_name, price, stock_quantity)
VALUES ('timex watch', 'jewelry' 30, 50),
('glue', 'office', 15, 44),
('speaker', 'electronics', 30, 50),
('hat', 'clothing', 20, 40),
('coffee cup', 'kitchen', 5, 17),
('dish towel', 'kitchen', 5, 205),
('shoes', 'clothing', 50, 30),
('earbuds', 'electronics', 20, 50),
('ring', 'jewelry', 200, 5),
('necklace', 'jewelry', 100, 135);
| true |
571f1b520a0c78188d3ee9c8b6c4b86b793948b3 | SQL | cmehta1/Retail-Business-Management-System | /app/1.sql | UTF-8 | 745 | 2.6875 | 3 | [] | no_license |
/*Here we have created sequence pur_# to get value os purchase id starting from 100000 and incremented by 1 every time we need to enter value of it into the table*/
create sequence pur_# minvalue 100000 maxvalue 999999 start with 100000 increment by 1;
/*Here we have created sequence sup_# to get value os supplier id starting from 1000 and incremented by 1 every time we need to enter value of it into the table*/
create sequence sup_# minvalue 1000 maxvalue 9999 start with 1000 increment by 1;
/*Here we have created sequence pur_# to get value os log id starting from 10000 and incremented by 1 every time we need to enter value of it into the table*/
create sequence log_# minvalue 10000 maxvalue 99999 start with 10000 increment by 1;
| true |
abdece3467f933d9ac6796e233b748c7a79e7859 | SQL | lcagney/MSDS-Practicum-2 | /Code/combine_dataset.sql | UTF-8 | 621 | 3.421875 | 3 | [] | no_license | --dataset from https://data.world/kcmillersean/billboard-hot-100-1958-2017, combined with the following sql
SELECT a.weekid as weekid,week_position,a.song as song,a.performer as performer,weeks_on_chart,peak_position
,spotify_track_duration_ms,spotify_track_explicit,danceability,energy,c.key,loudness,mode,speechiness
,acousticness,instrumentalness,liveness,valence,tempo,time_signature
FROM hot_stuff_2 as a
join(
SELECT max(weekid) as weekid, songid
FROM hot_stuff_2
GROUP BY songid) as b
on b.weekid = a.weekid and b.songid = a.songid
join hot_100_audio_features as c
on c.songid = a.songid
| true |
d79576eb4270924a747ddca5c88c328d6ca331bf | SQL | adityatoshniwal/pgadmin4 | /web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/default/create_column_int_identity.sql | UTF-8 | 555 | 2.578125 | 3 | [
"PostgreSQL"
] | permissive | -- Column: testschema."table_2_$%{}[]()&*^!@""'`\/#"."col_3_$%{}[]()&*^!@""'`\/#"
-- ALTER TABLE IF EXISTS testschema."table_2_$%{}[]()&*^!@""'`\/#" DROP COLUMN IF EXISTS "col_3_$%{}[]()&*^!@""'`\/#";
ALTER TABLE IF EXISTS testschema."table_2_$%{}[]()&*^!@""'`\/#"
ADD COLUMN IF NOT EXISTS "col_3_$%{}[]()&*^!@""'`\/#" bigint NOT NULL GENERATED ALWAYS AS IDENTITY ( CYCLE INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 99999 CACHE 10 );
COMMENT ON COLUMN testschema."table_2_$%{}[]()&*^!@""'`\/#"."col_3_$%{}[]()&*^!@""'`\/#"
IS 'Comment for create';
| true |
107b94e2895d2d102ca9f335f7f1d61628749bf3 | SQL | cannli/vue-dianshang | /apiLearn-master/sql/db/exapp.sql | UTF-8 | 6,518 | 2.9375 | 3 | [] | no_license | /*
Navicat MySQL Data Transfer
Source Server : exapp
Source Server Version : 50709
Source Host : localhost:3306
Source Database : exapp
Target Server Type : MYSQL
Target Server Version : 50709
File Encoding : 65001
Date: 2020-05-23 23:12:38
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for `cate`
-- ----------------------------
DROP TABLE IF EXISTS `cate`;
CREATE TABLE `cate` (
`id` int(11) NOT NULL,
`category` varchar(255) NOT NULL,
`status` tinyint(4) DEFAULT NULL,
`create_time` datetime DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of cate
-- ----------------------------
INSERT INTO `cate` VALUES ('1', 'phone', '0', '2020-05-15 23:30:13');
INSERT INTO `cate` VALUES ('2', 'tv', '1', '2020-05-16 23:34:06');
-- ----------------------------
-- Table structure for `follow`
-- ----------------------------
DROP TABLE IF EXISTS `follow`;
CREATE TABLE `follow` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`follow_id` int(11) NOT NULL,
`user_id` int(11) NOT NULL,
`create_time` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of follow
-- ----------------------------
INSERT INTO `follow` VALUES ('1', '1', '2', '1590246372091');
-- ----------------------------
-- Table structure for `image`
-- ----------------------------
DROP TABLE IF EXISTS `image`;
CREATE TABLE `image` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`url` varchar(255) NOT NULL,
`user_id` int(11) DEFAULT NULL,
`create_time` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=26 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of image
-- ----------------------------
INSERT INTO `image` VALUES ('1', 'http://localhost:3000/uploads/QQ.png', '1', '1590165228811');
INSERT INTO `image` VALUES ('2', 'http://localhost:3000/uploads/apple.png', '1', '1590165228625');
INSERT INTO `image` VALUES ('3', 'http://localhost:3000/uploads/apple.png', '1', '1590165335479');
INSERT INTO `image` VALUES ('4', 'http://localhost:3000/uploads/QQ.png', '1', '1590165335650');
INSERT INTO `image` VALUES ('5', 'http://localhost:3000/uploads/apple.png', '1', '1590165506825');
INSERT INTO `image` VALUES ('6', 'http://localhost:3000/uploads/QQ.png', '1', '1590165506975');
INSERT INTO `image` VALUES ('7', 'http://localhost:3000/uploads/apple.png', '1', '1590165665954');
INSERT INTO `image` VALUES ('8', 'http://localhost:3000/uploads/QQ (2).png', '1', '1590165666111');
INSERT INTO `image` VALUES ('9', 'http://localhost:3000/uploads/QQ (1).png', '1', '1590165666128');
INSERT INTO `image` VALUES ('10', 'http://localhost:3000/uploads/QQ.png', '1', '1590165666122');
INSERT INTO `image` VALUES ('11', 'http://localhost:3000/uploads/apple.png', '1', '1590165803764');
INSERT INTO `image` VALUES ('12', 'http://localhost:3000/uploads/QQ (2).png', '1', '1590165803931');
INSERT INTO `image` VALUES ('13', 'http://localhost:3000/uploads/QQ.png', '1', '1590165803936');
INSERT INTO `image` VALUES ('14', 'http://localhost:3000/uploads/QQ (1).png', '1', '1590165803942');
INSERT INTO `image` VALUES ('15', '111', '1', '111');
INSERT INTO `image` VALUES ('16', '111', '1', '111');
INSERT INTO `image` VALUES ('17', '111', '1', '111');
INSERT INTO `image` VALUES ('18', 'http://localhost:3000/uploads/apple.png', '1', '1590167099935');
INSERT INTO `image` VALUES ('19', 'http://localhost:3000/uploads/QQ (2).png', '1', '1590167099940');
INSERT INTO `image` VALUES ('20', 'http://localhost:3000/uploads/QQ.png', '1', '1590167099944');
INSERT INTO `image` VALUES ('21', 'http://localhost:3000/uploads/QQ (1).png', '1', '1590167099961');
INSERT INTO `image` VALUES ('22', 'http://localhost:3000/uploads/apple.png', '1', '1590167159292');
INSERT INTO `image` VALUES ('23', 'http://localhost:3000/uploads/QQ (2).png', '1', '1590167159298');
INSERT INTO `image` VALUES ('24', 'http://localhost:3000/uploads/QQ.png', '1', '1590167159302');
INSERT INTO `image` VALUES ('25', 'http://localhost:3000/uploads/QQ (1).png', '1', '1590167159305');
-- ----------------------------
-- Table structure for `post`
-- ----------------------------
DROP TABLE IF EXISTS `post`;
CREATE TABLE `post` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`title` varchar(255) NOT NULL,
`url` varchar(255) NOT NULL,
`path` varchar(255) DEFAULT NULL,
`isopen` tinyint(4) DEFAULT '0',
`create_time` bigint(20) DEFAULT NULL,
`posting` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of post
-- ----------------------------
INSERT INTO `post` VALUES ('1', '1', '测试标题', 'http://localhost:3000/uploads/apple.png', '测试路径', '0', '1590243835593', 'http://localhost:3000/uploads/apple.png');
-- ----------------------------
-- Table structure for `user`
-- ----------------------------
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`username` varchar(255) DEFAULT NULL,
`userpic` varchar(255) DEFAULT NULL,
`password` varchar(255) DEFAULT NULL,
`phone` varchar(11) DEFAULT NULL,
`email` varchar(255) DEFAULT NULL,
`status` tinyint(4) DEFAULT NULL,
`create_time` datetime DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of user
-- ----------------------------
INSERT INTO `user` VALUES ('1', '啦啦啦', 'http://localhost:3000/public/uploads/apple.png', '123456', '15033333333', 'zhidong@q.com', null, '2020-05-17 00:23:48');
INSERT INTO `user` VALUES ('2', 'zhidong2', '111', '123', '18533333333', 'zhidong@163.com', null, '2020-05-23 22:52:51');
-- ----------------------------
-- Table structure for `userinfo`
-- ----------------------------
DROP TABLE IF EXISTS `userinfo`;
CREATE TABLE `userinfo` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`age` tinyint(3) DEFAULT NULL,
`job` varchar(128) DEFAULT NULL,
`path` varchar(512) DEFAULT NULL,
`birthday` datetime DEFAULT NULL,
`sex` tinyint(1) DEFAULT NULL,
PRIMARY KEY (`id`,`user_id`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of userinfo
-- ----------------------------
INSERT INTO `userinfo` VALUES ('1', '1', '33', '程序员', '北京', '1985-12-02 00:00:00', '1');
| true |
949ec3dd92742d177b5cb31097857e9f4985afa1 | SQL | dbillue/AV | /AV/SQL Scripts/PLSQL/Package_Mng_Dept_Projects_Procs_Function_Calls.sql | UTF-8 | 1,961 | 3.75 | 4 | [] | no_license | /*****************************
Author: Duane Billue / Oracle
Date: 2019-11-05
Description: PACKAGE manage_dept_proj proc and function calls
*****************************/
-- Query nested table using TABLE function
SELECT t1.DEPT_ID, t1.NAME, t1.BUDGET, t2.*
FROM DEPARTMENT t1,
TABLE(t1.Projects) t2 ORDER BY t1.DEPT_ID, t2.PROJECT_NO;
--===================================
-- Procedure allocate_new_proj_list
-- EXECUTE allocate_new_proj_list (25, 'HR', 5000000); ##Reference procedure for code##
--===================================
-- Function get_dept_project
/*
DECLARE
v_proj_list type_projectlist;
BEGIN
v_proj_list := get_dept_project(20);
FOR i IN 1..v_proj_list.LAST LOOP
DBMS_OUTPUT.PUT_LINE('Project Number: ' || v_proj_list(i).project_no);
DBMS_OUTPUT.PUT_LINE('Project Title: ' || v_proj_list(i).title);
DBMS_OUTPUT.PUT_LINE('Project Cost: ' || v_proj_list(i).cost);
END LOOP;
END;
*/
--===================================
-- Function manipulate_project
/*
DECLARE
v_projs type_projectlist;
BEGIN
v_projs := manipulate_project(20);
FOR i IN 1..v_projs.LAST LOOP
DBMS_OUTPUT.PUT_LINE('Project Number: ' || v_projs(i).project_no);
DBMS_OUTPUT.PUT_LINE('Project Title: ' || v_projs(i).title);
DBMS_OUTPUT.PUT_LINE('Project Cost: ' || v_projs(i).cost);
END LOOP;
END;
*/
--===================================
-- Function check_costs
/*
DECLARE
v_project_list type_projectlist;
BEGIN
v_project_list := manage_dept_proj.manipulate_project(25);
IF manage_dept_proj.check_costs(v_project_list) THEN
DBMS_OUTPUT.PUT_LINE('At least one project exceeded budget.');
ELSE
DBMS_OUTPUT.PUT_LINE('All projects within budget....excellent.');
END IF;
END;
*/
--===================================
-- Procedure update_a_project
/*
DECLARE
v_project type_project;
BEGIN
v_project := type_project(4, 'End of Year Employee Tax Forms', 25000);
update_a_project (25, v_project, 2);
END;
*/ | true |
b8171132386efafdf6d9ae91dfa1398249ab2e83 | SQL | laughing1990/aplan-fork | /aplanmis-data-exchange/sql/多规三张表视图.sql | UTF-8 | 1,834 | 3.5625 | 4 | [] | no_license | -- 3.4.3地方项目用地红线界址信息表
CREATE VIEW spgl_xmydhxjzxxb_view
AS
SELECT `file`.`SYS_FILE_ID` AS `DFSJZJ`, '000000' AS `XZQHDM`, `file`.`xmdm` AS `XMDM`, `file`.`SYS_FILE_ID` AS `JZWJXH`, `file`.`FILE_NAME` AS `JZWJMC`
, `file`.`CMP` AS `JZWJSM`, `file`.`ejz` AS `JZWJFJ`, 1 AS `SJYXBS`, `file`.`CDT` AS `MODIFY_TIME`
FROM `sys_file` `file`
WHERE `file`.`iszip` = 'needzip';
-- 3.4.4项目前期意见信息表
CREATE VIEW spgl_xmqqyjxxb_view
AS
SELECT `hist`.`DBID_` AS `DFSJZJ`, '000000' AS `XZQHDM`, `info`.`CENTRAL_CODE` AS `XMDM`, `hist`.`DBID_` AS `QQYJSLBM`, `hist`.`ASSIGNEE_` AS `BLDWDM`
, `hist`.`ASSIGNEE_NAME` AS `BLDWMC`, `step`.`CREATE_DATE` AS `FKSJ`, `step`.`CONTACTS` AS `BLR`, `hist`.`HANDLE_COMMENTS` AS `QQYJ`, `file`.`FILE_NAME` AS `FJMC`
, `file`.`SYS_FILE_ID` AS `FJID`, `step`.`CREATE_DATE` AS `MODIFY_TIME`, 1 AS `SJYXBS`, '' AS `SJWXYY`
FROM `jbpm4_hist_task` `hist`
JOIN `wf_bus_instance` `inst` ON `hist`.`EXECUTION_` = `inst`.`PROC_INST_ID`
JOIN `xm_project_info` `info` ON `inst`.`MASTER_ENTITY_KEY` = `info`.`ID`
JOIN `xm_proj_appr_step` `step` ON `hist`.`DBID_` = `step`.`TASK_INSTANCE_ID`
LEFT JOIN `sys_file` `file` ON `hist`.`DBID_` = `file`.`MEMO1`
WHERE (`hist`.`STATE_` = 'completed')
AND (`hist`.`IS_MAIN_TASK` = 0)
AND (`hist`.`HANDLE_COMMENTS_TIME` >= '2019-07-07')
AND (`hist`.`HANDLE_COMMENTS_TIME` <= '2020-08-08')
AND (`info`.`CENTRAL_CODE` IS NOT NULL);
-- 3.7.1地方规划控制线信息表
CREATE VIEW spgl_dfghkzxxxb_view
AS
SELECT `file`.`SYS_FILE_ID` AS `DFSJZJ`, '000000' AS `XZQHDM`, `file`.`SYS_FILE_ID` AS `KZXWJXH`, `file`.`FILE_NAME` AS `KZXWJMC`, '2018-01-01' AS `KZXSYKSSJ`
, '云浮控制线数据' AS `KZXWJSM`, `file`.`ejz` AS `KZXWJFJ`, `file`.`CDT` AS `MODIFY_TIME`, 1 AS `SJYXBS`
FROM `sys_file` `file`
WHERE `file`.`iszip` = 'kzxzip'; | true |
eb17c6977a7c9d7a665454b34bef1c1164d8211b | SQL | Xinli0623/Streaming-Finance-Data-with-AWS-Lambda | /query.sql | UTF-8 | 173 | 2.640625 | 3 | [] | no_license | SELECT name,hour,max(high) AS max_high
FROM
(SELECT *,SUBSTRING(Datetime,12,2) AS hour
FROM project3.sta9760xinliproject3)
GROUP BY name,hour
ORDER BY name, hour; | true |
1fad32b272cb4d757a0508b44bd263a413ec7754 | SQL | codegdo/portal | /express/src/database/entities/portal.table.sql | UTF-8 | 6,760 | 3.984375 | 4 | [] | no_license | -- dbo
CREATE TABLE IF NOT EXISTS dbo.feature (
id SERIAL NOT NULL,
name VARCHAR(45) NOT NULL,
price NUMERIC(8,2),
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
--
PRIMARY KEY(id)
);
CREATE TABLE IF NOT EXISTS dbo.feature_module (
feature_id INT NOT NULL,
module_id INT NOT NULL,
org_id INT,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
--
PRIMARY KEY(feature_id, module_id),
FOREIGN KEY(feature_id) REFERENCES dbo.feature(id) ON DELETE CASCADE,
FOREIGN KEY(module_id) REFERENCES dbo.module(id) ON DELETE CASCADE
);
CREATE TABLE IF NOT EXISTS dbo.module (
id SERIAL NOT NULL,
name VARCHAR(45) NOT NULL,
sort_order INTEGER DEFAULT 0,
sort_group INTEGER DEFAULT 0,
is_external BOOLEAN DEFAULT FALSE,
is_internal BOOLEAN DEFAULT FALSE,
is_subscription BOOLEAN DEFAULT FALSE,
is_active BOOLEAN DEFAULT TRUE,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP(6),
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP(6),
--
PRIMARY KEY(id)
);
CREATE TABLE IF NOT EXISTS dbo.page (
id SERIAL,
name TEXT,
type VARCHAR(45) CHECK(type in ('view', 'form')),
parent_id INT,
sort_order INTEGER DEFAULT 0,
is_external BOOLEAN DEFAULT TRUE,
is_internal BOOLEAN DEFAULT TRUE,
is_active BOOLEAN,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
--
PRIMARY KEY(id)
);
CREATE TABLE IF NOT EXISTS dbo.module_page (
module_id INT NOT NULL,
page_id INT NOT NULL,
org_id INT,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
--
PRIMARY KEY(module_id, page_id),
FOREIGN KEY(module_id) REFERENCES dbo.module(id) ON DELETE CASCADE,
FOREIGN KEY(page_id) REFERENCES dbo.page(id) ON DELETE CASCADE
);
CREATE INDEX idx_module_page ON dbo.module_page(module_id, page_id);
CREATE TABLE IF NOT EXISTS dbo.plan (
id SERIAL NOT NULL,
name VARCHAR(45),
duration INT,
--
PRIMARY KEY(id)
);
CREATE TABLE IF NOT EXISTS dbo.emailtype (
id SERIAL NOT NULL,
name VARCHAR(45) NOT NULL,
--
PRIMARY KEY(id)
);
CREATE TABLE IF NOT EXISTS dbo.roletype (
id SERIAL NOT NULL,
name roletype_enum NOT NULL,
--
PRIMARY KEY(id)
);
CREATE TYPE dbo.roletype_enum AS ENUM ('system', 'internal', 'external');
CREATE TYPE org.templatetype_enum AS ENUM('internal', 'external', 'general');
-- org
CREATE TABLE IF NOT EXISTS org.email (
id SERIAL NOT NULL,
name VARCHAR(45) NOT NULL,
format VARCHAR(45) CHECK(format in ('html', 'text')),
subject VARCHAR(255) NOT NULL,
body TEXT,
json TEXT,
is_active BOOLEAN DEFAULT TRUE,
emailtype_id INT,
org_id INT,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
created_by VARCHAR(45) DEFAULT CURRENT_USER,
updated_by VARCHAR(45) DEFAULT CURRENT_USER,
--
PRIMARY KEY(id),
FOREIGN KEY(emailtype_id) REFERENCES dbo.emailtype(id) ON DELETE CASCADE
);
CREATE TABLE IF NOT EXISTS org.template (
id SERIAL NOT NULL,
name VARCHAR(45),
type templatetype_enum,
json TEXT,
html TEXT,
style TEXT,
is_active BOOLEAN,
org_id INT,
--
PRIMARY KEY(id)
);
CREATE TABLE IF NOT EXISTS org.subscription (
module_id INT NOT NULL,
org_id INT NOT NULL,
plan_id INT,
is_renewed BOOLEAN,
is_trial BOOLEAN,
start_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
end_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
--
PRIMARY KEY(module_id, org_id),
FOREIGN KEY(module_id) REFERENCES dbo.module(id) ON DELETE CASCADE,
FOREIGN KEY(org_id) REFERENCES sec.organization(id) ON DELETE CASCADE,
FOREIGN KEY(plan_id) REFERENCES dbo.plan(id)
);
-- sec
CREATE TABLE IF NOT EXISTS sec.session (
id TEXT NOT NULL,
json TEXT,
expired_at BIGINT,
--
PRIMARY KEY(id)
);
CREATE TABLE IF NOT EXISTS sec.token (
id TEXT NOT NULL,
json TEXT,
expired_at BIGINT,
--
PRIMARY KEY(id)
);
CREATE TABLE IF NOT EXISTS sec.role (
id SERIAL NOT NULL,
name VARCHAR(45) NOT NULL,
description VARCHAR(255),
is_owner BOOLEAN DEFAULT FALSE,
org_id INT,
roletype_id INT,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
created_by VARCHAR(45) DEFAULT CURRENT_USER,
updated_by VARCHAR(45) DEFAULT CURRENT_USER,
--
PRIMARY KEY(id),
FOREIGN KEY(roletype_id) REFERENCES dbo.roletype(id) ON DELETE SET NULL
);
CREATE TABLE IF NOT EXISTS sec.policy (
id SERIAL NOT NULL,
name VARCHAR(45) NOT NULL,
description VARCHAR(255),
json TEXT,
is_active BOOLEAN DEFAULT TRUE,
org_id INT,
roletype_id INT,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
--
PRIMARY KEY(id),
FOREIGN KEY(roletype_id) REFERENCES dbo.roletype(id) ON DELETE SET NULL
);
CREATE INDEX idx_role_policy ON sec.role_policy(role_id, policy_id);
CREATE TABLE IF NOT EXISTS sec.role_policy (
role_id INT NOT NULL,
policy_id INT NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
--
PRIMARY KEY(role_id, policy_id),
FOREIGN KEY(role_id) REFERENCES sec.role(id) ON DELETE CASCADE,
FOREIGN KEY(policy_id) REFERENCES sec.policy(id) ON DELETE CASCADE
);
CREATE TABLE IF NOT EXISTS sec.user (
id SERIAL NOT NULL,
email VARCHAR(45),
username VARCHAR(45),
password VARCHAR(75),
salt VARCHAR(75),
json TEXT,
is_active BOOLEAN DEFAULT FALSE,
role_id INT,
org_id INT,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
created_by VARCHAR(45) DEFAULT CURRENT_USER,
updated_by VARCHAR(45) DEFAULT CURRENT_USER,
--
PRIMARY KEY(id),
UNIQUE(username),
FOREIGN KEY(role_id) REFERENCES sec.role(id)
);
CREATE TABLE IF NOT EXISTS sec.organization (
id SERIAL NOT NULL,
name VARCHAR(45) NOT NULL,
street_address VARCHAR(45),
city VARCHAR(45),
postal_code VARCHAR(15),
phone VARCHAR(15),
fax VARCHAR(15),
website VARCHAR(45),
subdomain VARCHAR(45) NOT NULL,
is_active BOOLEAN DEFAULT TRUE,
territory_id INT,
owner_id INT,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
created_by VARCHAR(45) DEFAULT CURRENT_USER,
updated_by VARCHAR(45) DEFAULT CURRENT_USER,
--
PRIMARY KEY(id),
UNIQUE(subdomain, owner_id),
FOREIGN KEY(owner_id) REFERENCES sec.user(id)
);
-- DROP
DROP TABLE IF EXISTS
dbo.module,
dbo.page,
dbo.roletype,
org.company,
org.contact,
org.subscription,
org.template,
sec.organization,
sec.policy,
sec.role,
sec.role_policy,
sec.session,
sec.token,
sec.user CASCADE;
DROP TYPE IF EXISTS
dbo.roletype_enum,
org.templatetype_enum;
| true |
627ae013d7fd50e364ed34825f9fddd9afd57cda | SQL | kongshuaifu/Deploy_CobubRazor | /sql_script/razor_dw.sql | UTF-8 | 267,158 | 3.625 | 4 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 4.4.14
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: 2017-07-25 17:25:53
-- 服务器版本: 5.6.26
-- PHP Version: 5.6.12
use razor_dw;
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: `razor_dw`
--
DELIMITER $$
--
-- 存储过程
--
CREATE DEFINER=`admin`@`localhost` PROCEDURE `rundaily`(IN `yesterday` DATE)
NO SQL
begin
declare csession varchar(128);
declare clastsession varchar(128);
declare cactivityid int;
declare clastactivityid int;
declare cproductsk int;
declare clastproductsk int;
declare s datetime;
declare e datetime;
declare single int;
declare endflag int;
declare seq int;
DECLARE col VARCHAR(16);
DECLARE days INT;
DECLARE d INT;
declare usinglogcursor cursor
for
select product_sk,session_id,activity_sk from razor_fact_usinglog f, razor_dim_date d where f.date_sk = d.date_sk
and d.datevalue = yesterday;
declare continue handler for not found set endflag = 1;
set endflag = 0;
set clastactivityid = -1;
set single = 0;
insert into razor_log(op_type,op_name,op_starttime)
values('rundaily','-----start rundaily-----',now());
set s = now();
open usinglogcursor;
repeat
fetch usinglogcursor into cproductsk,csession,cactivityid;
if csession=clastsession then
update razor_sum_accesspath set count=count+1
where product_sk=cproductsk and fromid=clastactivityid
and toid=cactivityid and jump=seq;
if row_count()=0 then
insert into razor_sum_accesspath(product_sk,fromid,toid,jump,count)
select cproductsk,clastactivityid,cactivityid,seq,1;
end if;
set seq = seq +1;
else
update razor_sum_accesspath set count=count+1
where product_sk=clastproductsk and fromid=clastactivityid
and toid=-999 and jump=seq;
if row_count()=0 then
insert into razor_sum_accesspath(product_sk,fromid,toid,jump,count)
select clastproductsk,clastactivityid,-999,seq,1;
end if;
set seq = 1;
end if;
set clastsession = csession;
set clastactivityid = cactivityid;
set clastproductsk = cproductsk;
until endflag=1 end repeat;
close usinglogcursor;
set e = now();
insert into razor_log(op_type,op_name,op_starttime,op_date,affected_rows,duration)
values('rundaily','razor_sum_accesspath',s,e,row_count(),TIMESTAMPDIFF(SECOND,s,e));
set s = now();
-- generate the count of new users for yesterday
-- for channels, versions
INSERT INTO razor_sum_reserveusers_daily
(startdate_sk,
enddate_sk,
product_id,
version_name,
channel_name,
usercount)
SELECT (SELECT date_sk
FROM razor_dim_date
WHERE datevalue = yesterday) startdate_sk,
(SELECT date_sk
FROM razor_dim_date
WHERE datevalue = yesterday) enddate_sk,
ifnull(p.product_id,-1),
ifnull(p.version_name,'all'),
ifnull(p.channel_name,'all'),
Count(DISTINCT f.deviceidentifier) count
FROM razor_fact_clientdata f,
razor_dim_date d,
razor_dim_product p
WHERE f.date_sk = d.date_sk
AND d.datevalue = yesterday
AND f.product_sk = p.product_sk
AND p.product_active = 1
AND p.channel_active = 1
AND p.version_active = 1
AND f.isnew = 1
GROUP BY p.product_id,
p.version_name,
p.channel_name with rollup
union
SELECT (SELECT date_sk
FROM razor_dim_date
WHERE datevalue = yesterday) startdate_sk,
(SELECT date_sk
FROM razor_dim_date
WHERE datevalue = yesterday) enddate_sk,
ifnull(p.product_id,-1),
ifnull(p.version_name,'all'),
ifnull(p.channel_name,'all'),
Count(DISTINCT f.deviceidentifier) count
FROM razor_fact_clientdata f,
razor_dim_date d,
razor_dim_product p
WHERE f.date_sk = d.date_sk
AND d.datevalue = yesterday
AND f.product_sk = p.product_sk
AND p.product_active = 1
AND p.channel_active = 1
AND p.version_active = 1
AND f.isnew = 1
GROUP BY p.product_id,
p.channel_name,
p.version_name with rollup
ON DUPLICATE KEY UPDATE usercount=VALUES(usercount);
set e = now();
insert into razor_log(op_type,op_name,op_starttime,op_date,affected_rows,duration)
values('rundaily','razor_sum_reserveusers_daily new users for app,version,channel dimensions',s,e,row_count(),TIMESTAMPDIFF(SECOND,s,e));
set d = 1;
while d<=8 do
begin
set col = concat('day',d);
set days = -d;
set s = now();
-- 8 days for app,channel, version
SET @sql=concat(
'insert into razor_sum_reserveusers_daily(startdate_sk, enddate_sk, product_id, version_name,channel_name,',
col,
')
Select
(select date_sk from razor_dim_date where datevalue= date_add(\'',yesterday,'\',interval ',days,' DAY)) startdate,
(select date_sk from razor_dim_date where datevalue= date_add(\'',yesterday,'\',interval ',days,' DAY)) enddate,
ifnull(p.product_id,-1),ifnull(p.version_name,\'all\'),ifnull(p.channel_name,\'all\'),
count(distinct f.deviceidentifier)
from
razor_fact_clientdata f, razor_dim_date d, razor_dim_product p where f.date_sk = d.date_sk
and f.product_sk = p.product_sk and d.datevalue = \'',yesterday,'\' and p.product_active=1
and p.channel_active=1 and p.version_active=1 and exists
(select 1 from razor_fact_clientdata ff, razor_dim_product pp, razor_dim_date dd where ff.product_sk = pp.product_sk
and ff.date_sk = dd.date_sk and pp.product_id = p.product_id and dd.datevalue between
date_add(\'',yesterday,'\',interval ',days,' DAY) and
date_add(\'',yesterday,'\',interval ',days,' DAY) and ff.deviceidentifier = f.deviceidentifier and pp.product_active=1
and pp.channel_active=1 and pp.version_active=1 and ff.isnew=1) group by p.product_id,p.version_name,p.channel_name with rollup
union
Select
(select date_sk from razor_dim_date where datevalue= date_add(\'',yesterday,'\',interval ',days,' DAY)) startdate,
(select date_sk from razor_dim_date where datevalue= date_add(\'',yesterday,'\',interval ',days,' DAY)) enddate,
ifnull(p.product_id,-1),ifnull(p.version_name,\'all\'),ifnull(p.channel_name,\'all\'),
count(distinct f.deviceidentifier)
from
razor_fact_clientdata f, razor_dim_date d, razor_dim_product p where f.date_sk = d.date_sk
and f.product_sk = p.product_sk and d.datevalue = \'',yesterday,'\' and p.product_active=1
and p.channel_active=1 and p.version_active=1 and exists
(select 1 from razor_fact_clientdata ff, razor_dim_product pp, razor_dim_date dd where ff.product_sk = pp.product_sk
and ff.date_sk = dd.date_sk and pp.product_id = p.product_id and dd.datevalue between
date_add(\'',yesterday,'\',interval ',days,' DAY) and
date_add(\'',yesterday,'\',interval ',days,' DAY) and ff.deviceidentifier = f.deviceidentifier and pp.product_active=1
and pp.channel_active=1 and pp.version_active=1 and ff.isnew=1) group by p.product_id,p.channel_name,p.version_name with rollup
on duplicate key update ',col,'=values(',col,');');
PREPARE sl FROM @sql;
EXECUTE sl;
DEALLOCATE PREPARE sl;
set e = now();
insert into razor_log(op_type,op_name,op_starttime,op_date,affected_rows,duration)
values('rundaily',concat('razor_sum_reserveusers_daily DAY ',-d,' reserve users for app,channel,version dimensions'),s,e,row_count(),TIMESTAMPDIFF(SECOND,s,e));
set d = d + 1;
end;
end while;
set s = now();
insert into razor_sum_accesslevel(product_sk,fromid,toid,level,count)
select product_sk,fromid,toid,min(jump),sum(count) from razor_sum_accesspath group by product_sk,fromid,toid
on duplicate key update count = values(count);
set e = now();
insert into razor_log(op_type,op_name,op_starttime,op_date,affected_rows,duration)
values('rundaily','razor_sum_accesslevel',s,e,row_count(),TIMESTAMPDIFF(SECOND,s,e));
set s = now();
update razor_fact_clientdata a,razor_fact_clientdata b,razor_dim_date c,
razor_dim_product d,razor_dim_product f set a.isnew=0 where
((a.date_sk>b.date_sk) or (a.date_sk=b.date_sk and a.dataid>b.dataid))
and a.isnew=1
and a.date_sk=c.date_sk and c.datevalue between DATE_SUB(yesterday,INTERVAL 7 DAY) and yesterday
and a.product_sk=d.product_sk
and b.product_sk=f.product_sk
and a.deviceidentifier=b.deviceidentifier and d.product_id=f.product_id;
set e = now();
insert into razor_log(op_type,op_name,op_starttime,op_date,affected_rows,duration)
values('rundaily','razor_fact_clientdata recalculate new users',s,e,row_count(),TIMESTAMPDIFF(SECOND,s,e));
set s = now();
update razor_fact_clientdata a,razor_fact_clientdata b,razor_dim_date c,
razor_dim_product d,razor_dim_product f set a.isnew_channel=0 where
((a.date_sk>b.date_sk) or (a.date_sk=b.date_sk and a.dataid>b.dataid))
and a.isnew_channel=1
and a.date_sk=c.date_sk and c.datevalue between DATE_SUB(yesterday,INTERVAL 7 DAY) and yesterday
and a.product_sk=d.product_sk
and b.product_sk=f.product_sk
and a.deviceidentifier=b.deviceidentifier and d.product_id=f.product_id and d.channel_id=f.channel_id;
set e = now();
insert into razor_log(op_type,op_name,op_starttime,op_date,affected_rows,duration)
values('rundaily','razor_fact_clientdata recalculate new users for channel',s,e,row_count(),TIMESTAMPDIFF(SECOND,s,e));
insert into razor_log(op_type,op_name,op_starttime)
values('rundaily','-----finish rundaily-----',now());
end$$
CREATE DEFINER=`admin`@`localhost` PROCEDURE `rundim`()
NO SQL
begin
declare s datetime;
declare e datetime;
insert into razor_log(op_type,op_name,op_starttime)
values('rundim','-----start rundim-----',now());
/* dim location */
set s = now();
update razor_db.razor_clientdata
set region = 'unknown'
where (region = '') or (region is null);
update razor_db.razor_clientdata
set city = 'unknown'
where (city = '') or (city is null);
insert into razor_dim_location
(country,
region,
city)
select distinct country,
region,
city
from razor_db.razor_clientdata a
where not exists (select 1
from razor_dim_location b
where a.country = b.country
and a.region = b.region
and a.city = b.city);
set e = now();
insert into razor_log(op_type,op_name,op_starttime,op_date,affected_rows,duration)
values('rundim','razor_dim_location',s,e,row_count(),TIMESTAMPDIFF(SECOND,s,e));
/* dim devicebrand */
set s = now();
insert into razor_dim_devicebrand(devicebrand_name)
select distinct devicename
from razor_db.razor_clientdata a
where not exists (select 1
from razor_dim_devicebrand b
where a.devicename = b.devicebrand_name);
insert into razor_dim_deviceos
(deviceos_name)
select distinct osversion
from razor_db.razor_clientdata a
where not exists (select *
from razor_dim_deviceos b
where b.deviceos_name = a.osversion);
set e = now();
insert into razor_log(op_type,op_name,op_starttime,op_date,affected_rows,duration)
values('rundim','razor_dim_deviceos',s,e,row_count(),TIMESTAMPDIFF(SECOND,s,e));
/* dim devicelanguage */
set s = now();
insert into razor_dim_devicelanguage
(devicelanguage_name)
select distinct language
from razor_db.razor_clientdata a
where not exists (select *
from razor_dim_devicelanguage b
where a.language = b.devicelanguage_name);
set e = now();
insert into razor_log(op_type,op_name,op_starttime,op_date,affected_rows,duration)
values('rundim','razor_dim_devicelanguage',s,e,row_count(),TIMESTAMPDIFF(SECOND,s,e));
/* dim resolution */
set s = now();
insert into razor_dim_deviceresolution
(deviceresolution_name)
select distinct resolution
from razor_db.razor_clientdata a
where not exists (select *
from razor_dim_deviceresolution b
where a.resolution = b.deviceresolution_name);
set e = now();
insert into razor_log(op_type,op_name,op_starttime,op_date,affected_rows,duration)
values('rundim','razor_dim_deviceresolution',s,e,row_count(),TIMESTAMPDIFF(SECOND,s,e));
/* dim devicesupplier */
set s = now();
insert into razor_dim_devicesupplier (mccmnc)
select distinct a.service_supplier
from razor_db.razor_clientdata a
where not exists (select *
from razor_dim_devicesupplier b
where a.service_supplier = b.mccmnc);
set e = now();
insert into razor_log(op_type,op_name,op_starttime,op_date,affected_rows,duration)
values('rundim','razor_dim_devicesupplier',s,e,row_count(),TIMESTAMPDIFF(SECOND,s,e));
/* dim product */
set s = now();
update
razor_dim_product dp,
razor_db.razor_product p,
razor_db.razor_channel_product cp,
razor_db.razor_channel c,
razor_db.razor_clientdata cd,
razor_db.razor_product_category pc,
razor_db.razor_platform pf
set
dp.product_name = p.name,
dp.product_type = pc.name,
dp.product_active = p.active,
dp.channel_name = c.channel_name,
dp.channel_active = c.active,
dp.product_key = cd.productkey,
dp.version_name = cd.version,
dp.platform = pf.name
where
p.id = cp.product_id and
cp.channel_id = c.channel_id and
cp.productkey = cd.productkey and
p.category = pc.id and
c.platform = pf.id and
dp.product_id = p.id and
dp.channel_id = c.channel_id and
dp.version_name = cd.version and
dp.userid = cp.user_id and
(dp.product_name <> p.name or
dp.product_type <> pc.name or
dp.product_active = p.active or
dp.channel_name = c.channel_name or
dp.channel_active = c.active or
dp.product_key = cd.productkey or
dp.version_name = cd.version or
dp.platform <> pf.name );
insert into razor_dim_product
(product_id,
product_name,
product_type,
product_active,
channel_id,
channel_name,
channel_active,
product_key,
version_name,
version_active,
userid,
platform)
select distinct
p.id,
p.name,
pc.name,
p.active,
c.channel_id,
c.channel_name,
c.active,
cd.productkey,
cd.version,
1,
cp.user_id,
pf.name
from razor_db.razor_product p inner join
razor_db.razor_channel_product cp on p.id = cp.product_id inner join
razor_db.razor_channel c on cp.channel_id = c.channel_id inner join
razor_db.razor_product_category pc on p.category = pc.id inner join
razor_db.razor_platform pf on c.platform = pf.id inner join (select distinct
productkey,version from razor_db.razor_clientdata) cd on cp.productkey = cd.productkey
and not exists (select 1
from razor_dim_product dp
where dp.product_id = p.id and
dp.channel_id = c.channel_id and
dp.version_name = cd.version and
dp.userid = cp.user_id);
set e = now();
insert into razor_log(op_type,op_name,op_starttime,op_date,affected_rows,duration)
values('rundim','razor_dim_product',s,e,row_count(),TIMESTAMPDIFF(SECOND,s,e));
/* dim network */
set s = now();
insert into razor_dim_network
(networkname)
select distinct cd.network
from razor_db.razor_clientdata cd
where not exists (select 1
from razor_dim_network nw
where nw.networkname = cd.network);
set e = now();
insert into razor_log(op_type,op_name,op_starttime,op_date,affected_rows,duration)
values('rundim','razor_dim_network',s,e,row_count(),TIMESTAMPDIFF(SECOND,s,e));
/* dim activity */
set s = now();
insert into razor_dim_activity (activity_name,product_id)
select distinct f.activities,p.id
from razor_db.razor_clientusinglog f,razor_db.razor_product p,razor_db.razor_channel_product cp
where
f.appkey = cp.productkey and
cp.product_id = p.id
and not exists (select 1
from razor_dim_activity a
where a.activity_name = f.activities
and a.product_id = p.id);
set e = now();
insert into razor_log(op_type,op_name,op_starttime,op_date,affected_rows,duration)
values('rundim','razor_dim_activity',s,e,row_count(),TIMESTAMPDIFF(SECOND,s,e));
/* dim errortitle */
set s = now();
insert into razor_dim_errortitle
(title_name,isfix)
select distinct f.title,0
from razor_db.razor_errorlog f
where not exists (select *
from razor_dim_errortitle ee
where ee.title_name = f.title);
set e = now();
insert into razor_log(op_type,op_name,op_starttime,op_date,affected_rows,duration)
values('rundim','razor_dim_errortitle',s,e,row_count(),TIMESTAMPDIFF(SECOND,s,e));
/* dim event */
set s = now();
update razor_dim_event e,razor_db.razor_event_defination d
set e.eventidentifier = d.event_identifier,
e.eventname = d.event_name,
e.product_id = d.product_id,
e.active = d.active
where e.event_id = d.event_id and (e.eventidentifier <> d.event_identifier or e.eventname<>d.event_name or e.product_id <> d.product_id or e.active <> d.active);
insert into razor_dim_event (eventidentifier,eventname,active,product_id,createtime,event_id)
select distinct event_identifier,event_name,active,product_id,create_date,f.event_id
from razor_db.razor_event_defination f
where not exists (select *
from razor_dim_event ee
where ee.eventidentifier = f.event_identifier
and ee.eventname = f.event_name
and ee.active = f.active
and ee.product_id = f.product_id
and ee.createtime = f.create_date);
set e = now();
insert into razor_log(op_type,op_name,op_starttime,op_date,affected_rows,duration)
values('rundim','razor_dim_event',s,e,row_count(),TIMESTAMPDIFF(SECOND,s,e));
insert into razor_log(op_type,op_name,op_starttime)
values('rundim','-----finish rundim-----',now());
end$$
CREATE DEFINER=`admin`@`localhost` PROCEDURE `runfact`(IN `starttime` DATETIME, IN `endtime` DATETIME)
NO SQL
begin
declare s datetime;
declare e datetime;
insert into razor_log(op_type,op_name,op_starttime)
values('runfact','-----start runfact-----',now());
set s = now();
insert into razor_fact_clientdata
(product_sk,
deviceos_sk,
deviceresolution_sk,
devicelanguage_sk,
devicebrand_sk,
devicesupplier_sk,
location_sk,
date_sk,
hour_sk,
deviceidentifier,
clientdataid,
network_sk,
useridentifier
)
select i.product_sk,
b.deviceos_sk,
d.deviceresolution_sk,
e.devicelanguage_sk,
c.devicebrand_sk,
f.devicesupplier_sk,
h.location_sk,
g.date_sk,
hour(a.date),
a.deviceid,
a.id,
n.network_sk,
a.useridentifier
from razor_db.razor_clientdata a,
razor_dim_deviceos b,
razor_dim_devicebrand c,
razor_dim_deviceresolution d,
razor_dim_devicelanguage e,
razor_dim_devicesupplier f,
razor_dim_date g,
razor_dim_location h,
razor_dim_product i,
razor_dim_network n
where
a.osversion = b.deviceos_name
and a.devicename = c.devicebrand_name
and a.resolution = d.deviceresolution_name
and a.language = e.devicelanguage_name
and a.service_supplier = f.mccmnc
and date(a.date) = g.datevalue
and a.country = h.country
and a.region = h.region
and a.city = h.city
and a.productkey = i.product_key
and i.product_active = 1 and i.channel_active = 1 and i.version_active = 1
and a.version = i.version_name
and a.network = n.networkname
and a.insertdate between starttime and endtime;
set e = now();
insert into razor_log(op_type,op_name,op_starttime,op_date,affected_rows,duration)
values('runfact','razor_fact_clientdata',s,e,row_count(),TIMESTAMPDIFF(SECOND,s,e));
set s = now();
insert into razor_fact_usinglog
(product_sk,
date_sk,
activity_sk,
session_id,
duration,
activities,
starttime,
endtime,
uid)
select p.product_sk,
d.date_sk,
a.activity_sk,
u.session_id,
u.duration,
u.activities,
u.start_millis,
end_millis,
u.id
from razor_db.razor_clientusinglog u,
razor_dim_date d,
razor_dim_product p,
razor_dim_activity a
where date(u.start_millis) = d.datevalue and
u.appkey = p.product_key
and p.product_id=a.product_id
and u.version = p.version_name
and u.activities = a.activity_name
and u.insertdate between starttime and endtime;
set e = now();
insert into razor_log(op_type,op_name,op_starttime,op_date,affected_rows,duration)
values('runfact','razor_fact_usinglog',s,e,row_count(),TIMESTAMPDIFF(SECOND,s,e));
set s = now();
insert into razor_fact_errorlog
(date_sk,
product_sk,
osversion_sk,
title_sk,
deviceidentifier,
activity,
time,
title,
stacktrace,
isfix,
id
)
select d.date_sk,
p.product_sk,
o.deviceos_sk,
t.title_sk,
b.devicebrand_sk,
e.activity,
e.time,
e.title,
e.stacktrace,
e.isfix,
e.id
from razor_db.razor_errorlog e,
razor_dim_product p,
razor_dim_date d,
razor_dim_deviceos o,
razor_dim_errortitle t,
razor_dim_devicebrand b
where e.appkey = p.product_key
and e.version = p.version_name
and date(e.time) = d.datevalue
and e.os_version = o.deviceos_name
and e.title = t.title_name
and e.device = b.devicebrand_name
and p.product_active = 1 and p.channel_active = 1 and p.version_active = 1
and e.insertdate between starttime and endtime;
set e = now();
insert into razor_log(op_type,op_name,op_starttime,op_date,affected_rows,duration)
values('runfact','razor_fact_errorlog',s,e,row_count(),TIMESTAMPDIFF(SECOND,s,e));
set s = now();
insert into razor_fact_event
(event_sk,
product_sk,
date_sk,
deviceid,
category,
event,
label,
attachment,
clientdate,
number)
select e.event_sk,
p.product_sk,
d.date_sk,
f.deviceid,
f.category,
f.event,
f.label,
f.attachment,
f.clientdate,
f.num
from razor_db.razor_eventdata f,
razor_dim_event e,
razor_dim_product p,
razor_dim_date d
where f.event_id = e.event_id
and e.product_id = p.product_id
and f.version = p.version_name
and f.productkey = p.product_key
and p.product_active = 1 and p.channel_active = 1 and p.version_active = 1
and date(f.clientdate) = d.datevalue
and f.insertdate between starttime and endtime;
set e = now();
insert into razor_log(op_type,op_name,op_starttime,op_date,affected_rows,duration)
values('runfact','razor_fact_event',s,e,row_count(),TIMESTAMPDIFF(SECOND,s,e));
set s = now();
insert into razor_log(op_type,op_name,op_starttime)
values('runfact','-----finish runfact-----',now());
end$$
CREATE DEFINER=`admin`@`localhost` PROCEDURE `runmonthly`(IN `begindate` DATE, IN `enddate` DATE)
NO SQL
begin
declare s datetime;
declare e datetime;
DECLARE col VARCHAR(16);
DECLARE months INT;
DECLARE m INT;
insert into razor_log(op_type,op_name,op_starttime)
values('runmonthly','-----start runmonthly-----',now());
set s = now();
-- new users for monthly reserve. for each channel, each version
INSERT INTO razor_sum_reserveusers_monthly
(startdate_sk,
enddate_sk,
product_id,
version_name,
channel_name,
usercount)
SELECT (SELECT date_sk
FROM razor_dim_date
WHERE datevalue = begindate) startdate_sk,
(SELECT date_sk
FROM razor_dim_date
WHERE datevalue = enddate) enddate_sk,
ifnull(p.product_id,-1),
ifnull(p.version_name,'all'),
ifnull(p.channel_name,'all'),
Count(DISTINCT f.deviceidentifier) count
FROM razor_fact_clientdata f,
razor_dim_date d,
razor_dim_product p
WHERE f.date_sk = d.date_sk
AND d.datevalue BETWEEN begindate AND enddate
AND f.product_sk = p.product_sk
AND p.product_active = 1
AND p.channel_active = 1
AND p.version_active = 1
AND f.isnew = 1
GROUP BY p.product_id,
p.version_name,
p.channel_name with rollup
union
SELECT (SELECT date_sk
FROM razor_dim_date
WHERE datevalue = begindate) startdate_sk,
(SELECT date_sk
FROM razor_dim_date
WHERE datevalue = enddate) enddate_sk,
ifnull(p.product_id,-1),
ifnull(p.version_name,'all'),
ifnull(p.channel_name,'all'),
Count(DISTINCT f.deviceidentifier) count
FROM razor_fact_clientdata f,
razor_dim_date d,
razor_dim_product p
WHERE f.date_sk = d.date_sk
AND d.datevalue BETWEEN begindate AND enddate
AND f.product_sk = p.product_sk
AND p.product_active = 1
AND p.channel_active = 1
AND p.version_active = 1
AND f.isnew = 1
GROUP BY p.product_id,
p.channel_name,
p.version_name with rollup
ON DUPLICATE KEY UPDATE usercount=VALUES(usercount);
set e = now();
insert into razor_log(op_type,op_name,op_starttime,op_date,affected_rows,duration)
values('runmonthly','razor_sum_reserveusers_monthly new users for app,version,channel dimensions',s,e,row_count(),TIMESTAMPDIFF(SECOND,s,e));
set m = 1;
while m<=8 do
begin
set col = concat('month',m);
set months = -m;
set s = now();
-- 8 months for each channel, each version
SET @sql=Concat(
'insert into razor_sum_reserveusers_monthly(startdate_sk, enddate_sk, product_id,version_name,channel_name,',
col,
') Select
(select date_sk from razor_dim_date where datevalue = date_add(\'',begindate,'\',interval ',months,' MONTH)) startdate,
(select date_sk from razor_dim_date where datevalue = last_day(\'',enddate,'\' + interval ',months,' MONTH)) enddate,
ifnull(p.product_id,-1),ifnull(p.version_name,\'all\'),ifnull(p.channel_name,\'all\'),
count(distinct f.deviceidentifier)
from
razor_fact_clientdata f, razor_dim_date d, razor_dim_product p where f.date_sk = d.date_sk and
f.product_sk = p.product_sk and d.datevalue between \'',begindate,'\' and \'',enddate,'\' and p.product_active = 1
and p.channel_active = 1 and p.version_active = 1 and exists
(select 1 from razor_fact_clientdata ff, razor_dim_product pp, razor_dim_date dd
where ff.product_sk = pp.product_sk and ff.date_sk = dd.date_sk and pp.product_id = p.product_id and
dd.datevalue between date_add(\'',begindate,'\',interval ',months,' MONTH) and last_day(\'',enddate,'\' + interval ',months,' MONTH) and
ff.deviceidentifier = f.deviceidentifier and pp.product_active = 1 and pp.channel_active = 1 and
pp.version_active = 1 and ff.isnew = 1 ) group by p.product_id,p.version_name,p.channel_name with rollup
union
Select
(select date_sk from razor_dim_date where datevalue = date_add(\'',begindate,'\',interval ',months,' MONTH)) startdate,
(select date_sk from razor_dim_date where datevalue = last_day(\'',enddate,'\' + interval ',months,' MONTH)) enddate,
ifnull(p.product_id,-1),ifnull(p.version_name,\'all\'),ifnull(p.channel_name,\'all\'),
count(distinct f.deviceidentifier)
from
razor_fact_clientdata f, razor_dim_date d, razor_dim_product p where f.date_sk = d.date_sk and
f.product_sk = p.product_sk and d.datevalue between \'',begindate,'\' and \'',enddate,'\' and p.product_active = 1
and p.channel_active = 1 and p.version_active = 1 and exists
(select 1 from razor_fact_clientdata ff, razor_dim_product pp, razor_dim_date dd
where ff.product_sk = pp.product_sk and ff.date_sk = dd.date_sk and pp.product_id = p.product_id and
dd.datevalue between date_add(\'',begindate,'\',interval ',months,' MONTH) and last_day(\'',enddate,'\' + interval ',months,' MONTH) and
ff.deviceidentifier = f.deviceidentifier and pp.product_active = 1 and pp.channel_active = 1 and
pp.version_active = 1 and ff.isnew = 1 ) group by p.product_id,p.channel_name,p.version_name with rollup
on duplicate key update ',
col,
'= values(',
col,
');');
PREPARE sl FROM @sql;
EXECUTE sl;
DEALLOCATE PREPARE sl;
set e = now();
insert into razor_log(op_type,op_name,op_starttime,op_date,affected_rows,duration)
values('runmonthly',concat('razor_sum_reserveusers_monthly MONTH ',-m,' reserve users for app,channel,version dimensions'),s,e,row_count(),TIMESTAMPDIFF(SECOND,s,e));
set s = now();
set m = m + 1;
end;
end while;
set s = now();
INSERT INTO razor_sum_basic_activeusers
(product_id,
month_activeuser,
month_percent)
SELECT p.product_id,
Count(DISTINCT f.deviceidentifier) activeusers,
Count(DISTINCT f.deviceidentifier) / (SELECT
Count(DISTINCT ff.deviceidentifier)
FROM razor_fact_clientdata ff,
razor_dim_date dd,
razor_dim_product pp
WHERE dd.datevalue <= enddate
AND
pp.product_id = p.product_id
AND pp.product_active = 1
AND pp.channel_active = 1
AND pp.version_active = 1
AND
ff.product_sk = pp.product_sk
AND ff.date_sk = dd.date_sk)
percent
FROM razor_fact_clientdata f,
razor_dim_date d,
razor_dim_product p
WHERE d.datevalue BETWEEN begindate AND enddate
AND p.product_active = 1
AND p.channel_active = 1
AND p.version_active = 1
AND f.product_sk = p.product_sk
AND f.date_sk = d.date_sk
GROUP BY p.product_id
ON DUPLICATE KEY UPDATE month_activeuser=VALUES(month_activeuser),month_percent=VALUES(month_percent);
set e = now();
insert into razor_log(op_type,op_name,op_starttime,op_date,affected_rows,duration)
values('runmonthly','razor_sum_basic_activeusers active users and percent',s,e,row_count(),TIMESTAMPDIFF(SECOND,s,e));
set s = now();
INSERT INTO razor_sum_basic_channel_activeusers
(date_sk,
product_id,
channel_id,
activeuser,
percent,
flag)
SELECT (SELECT date_sk
FROM razor_dim_date
WHERE datevalue = begindate) startdate,
p.product_id,
p.channel_id,
Count(DISTINCT f.deviceidentifier) activeusers,
Count(DISTINCT f.deviceidentifier) / (SELECT
Count(DISTINCT ff.deviceidentifier)
FROM razor_fact_clientdata ff,
razor_dim_date dd,
razor_dim_product pp
WHERE dd.datevalue <= enddate
AND
pp.product_id = p.product_id
AND
pp.channel_id = p.channel_id
AND pp.product_active = 1
AND pp.channel_active = 1
AND pp.version_active = 1
AND
ff.product_sk = pp.product_sk
AND
ff.date_sk = dd.date_sk),
1
FROM razor_fact_clientdata f,
razor_dim_date d,
razor_dim_product p
WHERE d.datevalue BETWEEN begindate AND enddate
AND p.product_active = 1
AND p.channel_active = 1
AND p.version_active = 1
AND f.product_sk = p.product_sk
AND f.date_sk = d.date_sk
GROUP BY p.product_id,
p.channel_id
ON DUPLICATE KEY UPDATE activeuser = VALUES(activeuser),percent=VALUES(percent);
set e = now();
insert into razor_log(op_type,op_name,op_starttime,op_date,affected_rows,duration)
values('runmonthly','razor_sum_basic_channel_activeusers channel activeusers and percent',s,e,row_count(),TIMESTAMPDIFF(SECOND,s,e));
insert into razor_log(op_type,op_name,op_starttime)
values('runmonthly','-----finish runmonthly-----',now());
end$$
CREATE DEFINER=`admin`@`localhost` PROCEDURE `runsum`(IN `today` DATE)
NO SQL
begin
declare s datetime;
declare e datetime;
insert into razor_log(op_type,op_name,op_starttime)
values('runsum','-----start runsum-----',now());
-- update fact_clientdata
set s = now();
update razor_fact_clientdata a,
razor_fact_clientdata b,
razor_dim_date c,
razor_dim_product d,
razor_dim_product f
set a.isnew=0
where ((a.date_sk>b.date_sk) or (a.date_sk=b.date_sk and a.dataid>b.dataid))
and a.isnew=1
and a.date_sk=c.date_sk
and c.datevalue=today
and a.product_sk=d.product_sk
and b.product_sk=f.product_sk
and a.deviceidentifier=b.deviceidentifier
and d.product_id=f.product_id;
set e = now();
insert into razor_log(op_type,op_name,op_date,affected_rows,duration)
values('runsum','razor_fact_clientdata update',e,row_count(),TIMESTAMPDIFF(SECOND,s,e));
set s = now();
update razor_fact_clientdata a,
razor_fact_clientdata b,
razor_dim_date c,
razor_dim_product d,
razor_dim_product f
set a.isnew_channel=0
where ((a.date_sk>b.date_sk) or (a.date_sk=b.date_sk and a.dataid>b.dataid))
and a.isnew_channel=1
and a.date_sk=c.date_sk
and c.datevalue=today
and a.product_sk=d.product_sk
and b.product_sk=f.product_sk
and a.deviceidentifier=b.deviceidentifier
and d.product_id=f.product_id
and d.channel_id=f.channel_id;
set e = now();
insert into razor_log(op_type,op_name,op_date,affected_rows,duration)
values('runsum','razor_fact_clientdata update',e,row_count(),TIMESTAMPDIFF(SECOND,s,e));
-- sum usinglog for each sessions
set s = now();
insert into razor_fact_usinglog_daily
(product_sk,
date_sk,
session_id,
duration)
select f.product_sk,
d.date_sk,
f.session_id,
sum(f.duration)
from razor_fact_usinglog f,
razor_dim_date d
where
d.datevalue = today and f.date_sk = d.date_sk
group by f.product_sk,d.date_sk,f.session_id on duplicate key update duration = values(duration);
set e = now();
insert into razor_log(op_type,op_name,op_date,affected_rows,duration)
values('runsum','razor_fact_usinglog_daily',e,row_count(),TIMESTAMPDIFF(SECOND,s,e));
-- sum_basic_product
set s = now();
insert into razor_sum_basic_product(product_id,date_sk,sessions)
select p.product_id, d.date_sk,count(f.deviceidentifier)
from razor_fact_clientdata f,
razor_dim_date d,
razor_dim_product p
where d.datevalue = today
and f.date_sk = d.date_sk
and f.product_sk=p.product_sk
group by p.product_id on duplicate key update sessions = values(sessions);
insert into razor_sum_basic_product(product_id,date_sk,startusers)
select p.product_id, d.date_sk,count(distinct f.deviceidentifier)
from razor_fact_clientdata f,
razor_dim_date d,
razor_dim_product p
where d.datevalue = today
and f.date_sk = d.date_sk
and p.product_sk=f.product_sk
group by p.product_id on duplicate key update startusers = values(startusers);
insert into razor_sum_basic_product(product_id,date_sk,newusers)
select p.product_id, f.date_sk,sum(f.isnew)
from razor_fact_clientdata f,
razor_dim_date d,
razor_dim_product p
where d.datevalue = today
and f.date_sk = d.date_sk
and p.product_sk = f.product_sk
and p.product_active = 1
and p.channel_active = 1
and p.version_active = 1
group by p.product_id,f.date_sk on duplicate key update newusers = values(newusers);
insert into razor_sum_basic_product(product_id,date_sk,upgradeusers)
select p.product_id, d.date_sk,
count(distinct f.deviceidentifier)
from razor_fact_clientdata f,
razor_dim_date d,
razor_dim_product p
where d.datevalue = today
and f.date_sk = d.date_sk
and p.product_sk = f.product_sk
and p.product_active = 1
and p.channel_active = 1
and p.version_active = 1
and exists
(select 1
from razor_fact_clientdata ff,
razor_dim_date dd, razor_dim_product pp
where dd.datevalue < today
and ff.date_sk = dd.date_sk
and pp.product_sk = ff.product_sk
and pp.product_id = p.product_id
and pp.product_active = 1
and pp.channel_active = 1
and pp.version_active = 1
and f.deviceidentifier = ff.deviceidentifier
and STRCMP( pp.version_name, p.version_name ) < 0)
group by p.product_id,d.date_sk on duplicate key update upgradeusers = values(upgradeusers);
insert into razor_sum_basic_product(product_id,date_sk,allusers)
select f.product_id,
(
select date_sk
from razor_dim_date
where datevalue=today) date_sk,
sum(f.newusers)
from razor_sum_basic_product f,
razor_dim_date d
where d.date_sk=f.date_sk
and d.datevalue<=today
group by f.product_id on duplicate key update allusers = values(allusers);
insert into razor_sum_basic_product(product_id,date_sk,allsessions)
select f.product_id,(select date_sk from razor_dim_date where datevalue=today) date_sk,sum(f.sessions)
from razor_sum_basic_product f,
razor_dim_date d
where d.datevalue<=today
and d.date_sk=f.date_sk
group by f.product_id on duplicate key update allsessions = values(allsessions);
insert into razor_sum_basic_product(product_id,date_sk,usingtime)
select p.product_id,f.date_sk,sum(duration)
from razor_fact_usinglog_daily f,
razor_dim_product p,
razor_dim_date d
where f.date_sk = d.date_sk
and d.datevalue = today
and f.product_sk=p.product_sk
group by p.product_id on duplicate key update usingtime = values(usingtime);
set e = now();
insert into razor_log(op_type,op_name,op_date,affected_rows,duration)
values('runsum','razor_sum_basic_product',e,row_count(),TIMESTAMPDIFF(SECOND,s,e));
-- sum_basic_channel
set s = now();
insert into razor_sum_basic_channel(product_id,channel_id,date_sk,sessions)
select p.product_id,p.channel_id,d.date_sk,count(f.deviceidentifier)
from razor_fact_clientdata f,
razor_dim_date d,
razor_dim_product p
where d.datevalue = today
and f.date_sk = d.date_sk
and f.product_sk=p.product_sk
group by p.product_id,p.channel_id on duplicate key update sessions = values(sessions);
insert into razor_sum_basic_channel(product_id,channel_id,date_sk,startusers)
select p.product_id,p.channel_id, d.date_sk,count(distinct f.deviceidentifier)
from razor_fact_clientdata f,
razor_dim_date d,
razor_dim_product p
where d.datevalue = today
and f.date_sk = d.date_sk
and p.product_sk=f.product_sk
group by p.product_id,p.channel_id on duplicate key update startusers = values(startusers);
insert into razor_sum_basic_channel(product_id,channel_id,date_sk,newusers)
select p.product_id,p.channel_id,f.date_sk,sum(f.isnew_channel)
from razor_fact_clientdata f,
razor_dim_date d,
razor_dim_product p
where d.datevalue = today
and f.date_sk = d.date_sk
and p.product_sk = f.product_sk
and p.product_active = 1
and p.channel_active = 1
and p.version_active = 1
group by p.product_id,p.channel_id,f.date_sk on duplicate key update newusers = values(newusers);
insert into razor_sum_basic_channel(product_id,channel_id,date_sk,upgradeusers)
select p.product_id,p.channel_id,d.date_sk,
count(distinct f.deviceidentifier)
from razor_fact_clientdata f,
razor_dim_date d,
razor_dim_product p
where d.datevalue = today
and f.date_sk = d.date_sk
and p.product_sk = f.product_sk
and p.product_active = 1
and p.channel_active = 1
and p.version_active = 1
and exists
(select 1
from razor_fact_clientdata ff,
razor_dim_date dd,
razor_dim_product pp
where dd.datevalue < today
and ff.date_sk = dd.date_sk
and pp.product_sk = ff.product_sk
and pp.product_id = p.product_id
and pp.channel_id=p.channel_id
and pp.product_active = 1
and pp.channel_active = 1
and pp.version_active = 1
and f.deviceidentifier = ff.deviceidentifier
and STRCMP( pp.version_name, p.version_name ) < 0)
group by p.product_id,p.channel_id,d.date_sk on duplicate key update upgradeusers = values(upgradeusers);
insert into razor_sum_basic_channel(product_id,channel_id,date_sk,allusers)
select f.product_id,f.channel_id,
(select date_sk
from razor_dim_date
where datevalue=today) date_sk,
sum(f.newusers)
from razor_sum_basic_channel f,
razor_dim_date d
where d.date_sk=f.date_sk
and d.datevalue<=today
group by f.product_id,f.channel_id on duplicate key update allusers = values(allusers);
insert into razor_sum_basic_channel(product_id,channel_id,date_sk,allsessions)
select f.product_id,f.channel_id,(select date_sk from razor_dim_date where datevalue=today) date_sk,
sum(f.sessions)
from razor_sum_basic_channel f,
razor_dim_date d
where d.datevalue<=today
and d.date_sk=f.date_sk
group by f.product_id,f.channel_id on duplicate key update allsessions = values(allsessions);
insert into razor_sum_basic_channel(product_id,channel_id,date_sk,usingtime)
select p.product_id,p.channel_id,f.date_sk,sum(duration)
from razor_fact_usinglog_daily f,
razor_dim_product p,
razor_dim_date d where f.date_sk = d.date_sk
and d.datevalue = today and f.product_sk=p.product_sk
group by p.product_id,p.channel_id on duplicate key update usingtime = values(usingtime);
set e = now();
insert into razor_log(op_type,op_name,op_date,affected_rows,duration)
values('runsum','razor_sum_basic_channel',e,row_count(),TIMESTAMPDIFF(SECOND,s,e));
-- sum_basic_product_version
set s = now();
insert into razor_sum_basic_product_version(product_id,date_sk,version_name,sessions)
select p.product_id, d.date_sk,p.version_name,count(f.deviceidentifier)
from razor_fact_clientdata f,
razor_dim_date d,
razor_dim_product p
where d.datevalue = today
and f.date_sk = d.date_sk
and f.product_sk=p.product_sk
group by p.product_id,p.version_name on duplicate key update sessions = values(sessions);
insert into razor_sum_basic_product_version(product_id,date_sk,version_name,startusers)
select p.product_id, d.date_sk,p.version_name,count(distinct f.deviceidentifier)
from razor_fact_clientdata f,
razor_dim_date d,
razor_dim_product p
where d.datevalue = today
and f.date_sk = d.date_sk
and p.product_sk=f.product_sk
group by p.product_id,p.version_name on duplicate key update startusers = values(startusers);
insert into razor_sum_basic_product_version(product_id,date_sk,version_name,newusers)
select p.product_id, f.date_sk,p.version_name,sum(f.isnew)
from razor_fact_clientdata f,
razor_dim_date d,
razor_dim_product p
where d.datevalue = today
and f.date_sk = d.date_sk
and p.product_sk = f.product_sk
and p.product_active = 1
and p.channel_active = 1
and p.version_active = 1
group by p.product_id,p.version_name,f.date_sk
on duplicate key update newusers = values(newusers);
insert into razor_sum_basic_product_version(product_id,date_sk,version_name,upgradeusers)
select p.product_id, d.date_sk,p.version_name,
count(distinct f.deviceidentifier)
from razor_fact_clientdata f,
razor_dim_date d,
razor_dim_product p
where d.datevalue = today
and f.date_sk = d.date_sk
and p.product_sk = f.product_sk
and p.product_active = 1
and p.channel_active = 1
and p.version_active = 1
and exists
(select 1
from razor_fact_clientdata ff,
razor_dim_date dd,
razor_dim_product pp
where dd.datevalue < today
and ff.date_sk = dd.date_sk
and pp.product_sk = ff.product_sk
and pp.product_id = p.product_id
and pp.product_active = 1
and pp.channel_active = 1
and pp.version_active = 1
and f.deviceidentifier = ff.deviceidentifier
and STRCMP( pp.version_name, p.version_name ) < 0)
group by p.product_id,p.version_name,d.date_sk on duplicate key update upgradeusers = values(upgradeusers);
insert into razor_sum_basic_product_version(product_id,date_sk,version_name,allusers)
select f.product_id,
(select date_sk
from razor_dim_date
where datevalue=today) date_sk,
f.version_name,
sum(f.newusers)
from razor_sum_basic_product_version f,
razor_dim_date d
where d.date_sk=f.date_sk
and d.datevalue<=today
group by f.product_id,f.version_name on duplicate key update allusers = values(allusers);
insert into razor_sum_basic_product_version(product_id,date_sk,version_name,allsessions)
select f.product_id,(select date_sk from razor_dim_date where datevalue=today) date_sk,f.version_name,sum(f.sessions)
from razor_sum_basic_product_version f,
razor_dim_date d
where d.datevalue<=today
and d.date_sk=f.date_sk
group by f.product_id,f.version_name on duplicate key update allsessions = values(allsessions);
insert into razor_sum_basic_product_version(product_id,date_sk,version_name,usingtime)
select p.product_id,f.date_sk,p.version_name,sum(duration)
from razor_fact_usinglog_daily f,
razor_dim_product p,
razor_dim_date d
where f.date_sk = d.date_sk
and d.datevalue = today
and f.product_sk=p.product_sk
group by p.product_id,p.version_name on duplicate key update usingtime = values(usingtime);
set e = now();
insert into razor_log(op_type,op_name,op_date,affected_rows,duration)
values('runsum','razor_sum_basic_product_version',e,row_count(),TIMESTAMPDIFF(SECOND,s,e));
set s = now();
-- update segment_sk column
update razor_fact_usinglog_daily f,razor_dim_segment_usinglog s,razor_dim_date d
set f.segment_sk = s.segment_sk
where f.duration >= s.startvalue
and f.duration < s.endvalue
and f.date_sk = d.date_sk
and d.datevalue = today;
set e = now();
insert into razor_log(op_type,op_name,op_date,affected_rows,duration)
values('runsum','razor_fact_usinglog_daily update',e,row_count(),TIMESTAMPDIFF(SECOND,s,e));
set s = now();
-- sum_basic_byhour --
Insert into razor_sum_basic_byhour(product_sk,date_sk,hour_sk,
sessions)
Select f.product_sk, f.date_sk,f.hour_sk,
count(f.deviceidentifier) from razor_fact_clientdata f, razor_dim_date d
where d.datevalue = today and f.date_sk = d.date_sk
group by f.product_sk,f.date_sk,f.hour_sk on duplicate
key update sessions = values(sessions);
Insert into razor_sum_basic_byhour(product_sk,date_sk,hour_sk,
startusers)
Select f.product_sk, f.date_sk,f.hour_sk,
count(distinct f.deviceidentifier) from
razor_fact_clientdata f, razor_dim_date d where d.datevalue = today
and f.date_sk = d.date_sk group by f.product_sk,d.date_sk,
f.hour_sk on duplicate key update startusers = values(startusers);
Insert into razor_sum_basic_byhour(product_sk,date_sk,hour_sk,newusers)
Select f.product_sk, f.date_sk,f.hour_sk,count(distinct f.deviceidentifier) from razor_fact_clientdata f, razor_dim_date d, razor_dim_product p where d.datevalue = today and f.date_sk = d.date_sk and p.product_sk = f.product_sk and p.product_active = 1 and p.channel_active = 1 and p.version_active = 1 and not exists (select 1 from razor_fact_clientdata ff, razor_dim_date dd, razor_dim_product pp where dd.datevalue < today and ff.date_sk = dd.date_sk and pp.product_sk = ff.product_sk and p.product_id = pp.product_id and pp.product_active = 1 and pp.channel_active = 1 and pp.version_active = 1 and f.deviceidentifier = ff.deviceidentifier) group by f.product_sk,f.date_sk,f.hour_sk on duplicate key update newusers = values(newusers);
set e = now();
insert into razor_log(op_type,op_name,op_date,affected_rows,duration)
values('runsum','razor_sum_basic_byhour',e,row_count(),TIMESTAMPDIFF(SECOND,s,e));
set s = now();
-- sum_usinglog_activity --
insert into razor_sum_usinglog_activity(date_sk,product_sk,activity_sk,accesscount,totaltime)
select d.date_sk,p.product_sk,a.activity_sk, count(*), sum(duration)
from razor_fact_usinglog f, razor_dim_product p, razor_dim_date d, razor_dim_activity a
where f.date_sk = d.date_sk and f.activity_sk = a.activity_sk
and d.datevalue =today
and f.product_sk = p.product_sk
and p.product_active = 1 and p.channel_active = 1 and p.version_active = 1
group by d.date_sk,p.product_sk,a.activity_sk
on duplicate key update accesscount = values(accesscount),totaltime = values(totaltime);
insert into razor_sum_usinglog_activity(date_sk,product_sk,activity_sk,exitcount)
select tt.date_sk,tt.product_sk, tt.activity_sk,count(*)
from
(select * from(
select d.date_sk,session_id,p.product_sk,f.activity_sk,endtime
from razor_fact_usinglog f,
razor_dim_product p,
razor_dim_date d
where f.date_sk = d.date_sk
and d.datevalue = today
and f.product_sk = p.product_sk
order by session_id,
endtime desc) t group by t.session_id) tt
group by tt.date_sk,tt.product_sk,tt.activity_sk
order by tt. date_sk,tt.product_sk,tt.activity_sk on duplicate key update
exitcount = values(exitcount);
set e = now();
insert into razor_log(op_type,op_name,op_date,affected_rows,duration)
values('runsum','razor_sum_usinglog_activity',e,row_count(),TIMESTAMPDIFF(SECOND,s,e));
set s = now();
insert into razor_fact_launch_daily
(product_sk,
date_sk,
segment_sk,
accesscount)
select rightf.product_sk,
rightf.date_sk,
rightf.segment_sk,
ifnull(ffff.num,0)
from (select fff.product_sk,
fff.date_sk,
fff.segment_sk,
count(fff.segment_sk) num
from (select fs.datevalue,
dd.date_sk,
fs.product_sk,
fs.deviceidentifier,
fs.times,
ss.segment_sk
from (select d.datevalue,
p.product_sk,
deviceidentifier,
count(* ) times
from razor_fact_clientdata f,
razor_dim_date d,
razor_dim_product p
where d.datevalue = today
and f.date_sk = d.date_sk
and p.product_sk = f.product_sk
group by d.datevalue,p.product_sk,deviceidentifier) fs,
razor_dim_segment_launch ss,
razor_dim_date dd
where fs.times between ss.startvalue and ss.endvalue
and dd.datevalue = fs.datevalue) fff
group by fff.date_sk,fff.segment_sk,fff.product_sk
order by fff.date_sk,
fff.segment_sk,
fff.product_sk) ffff right join (select fff.date_sk,fff.product_sk,sss.segment_sk
from (select distinct d.date_sk,p.product_sk
from razor_fact_clientdata f,razor_dim_date d,razor_dim_product p
where d.datevalue=today and f.date_sk=d.date_sk and p.product_sk = f.product_sk) fff cross join
razor_dim_segment_launch sss) rightf on ffff.date_sk=rightf.date_sk and
ffff.product_sk=rightf.product_sk and ffff.segment_sk=rightf.segment_sk
on duplicate key update accesscount = values(accesscount);
set e = now();
insert into razor_log(op_type,op_name,op_date,affected_rows,duration)
values('runsum','razor_fact_launch_daily',e,row_count(),TIMESTAMPDIFF(SECOND,s,e));
set s = now();
insert into razor_sum_location(product_id,date_sk,location_sk,sessions)
select p.product_id,d.date_sk,l.location_sk, count(*)
from razor_fact_clientdata f,
razor_dim_product p,
razor_dim_date d,
razor_dim_location l
where f.date_sk = d.date_sk
and d.datevalue = today
and f.location_sk = l.location_sk
and f.product_sk = p.product_sk
group by p.product_id,d.date_sk,l.location_sk
on duplicate key update sessions = values(sessions);
insert into razor_sum_location(product_id,date_sk,location_sk,newusers)
select p.product_id,d.date_sk,l.location_sk, count(distinct f.deviceidentifier)
from razor_fact_clientdata f,
razor_dim_product p,
razor_dim_date d,
razor_dim_location l
where f.date_sk = d.date_sk
and d.datevalue = today
and f.location_sk = l.location_sk
and f.product_sk = p.product_sk
and f.isnew = 1
group by p.product_id,d.date_sk,l.location_sk
on duplicate key update newusers = values(newusers);
set e = now();
insert into razor_log(op_type,op_name,op_date,affected_rows,duration)
values('runsum','razor_sum_location',e,row_count(),TIMESTAMPDIFF(SECOND,s,e));
set s = now();
insert into razor_sum_devicebrand(product_id,date_sk,devicebrand_sk,sessions)
select p.product_id,d.date_sk,b.devicebrand_sk, count(*)
from razor_fact_clientdata f,
razor_dim_product p,
razor_dim_date d,
razor_dim_devicebrand b
where f.date_sk = d.date_sk
and d.datevalue = today
and f.devicebrand_sk = b.devicebrand_sk
and f.product_sk = p.product_sk
group by p.product_id,d.date_sk,b.devicebrand_sk
on duplicate key update sessions = values(sessions);
insert into razor_sum_devicebrand(product_id,date_sk,devicebrand_sk,newusers)
select p.product_id,d.date_sk,b.devicebrand_sk, count(distinct f.deviceidentifier)
from razor_fact_clientdata f,
razor_dim_product p,
razor_dim_date d,
razor_dim_devicebrand b
where f.date_sk = d.date_sk
and d.datevalue = today
and f.devicebrand_sk = b.devicebrand_sk
and f.product_sk = p.product_sk
and f.isnew = 1
group by p.product_id,d.date_sk,b.devicebrand_sk
on duplicate key update newusers = values(newusers);
set e = now();
insert into razor_log(op_type,op_name,op_date,affected_rows,duration)
values('runsum','razor_sum_devicebrand',e,row_count(),TIMESTAMPDIFF(SECOND,s,e));
set s = now();
insert into razor_sum_deviceos(product_id,date_sk,deviceos_sk,sessions)
select p.product_id,d.date_sk,o.deviceos_sk, count(*)
from razor_fact_clientdata f,
razor_dim_product p,
razor_dim_date d,
razor_dim_deviceos o
where f.date_sk = d.date_sk
and d.datevalue = today
and f.deviceos_sk = o.deviceos_sk
and f.product_sk = p.product_sk
group by p.product_id,d.date_sk,o.deviceos_sk
on duplicate key update sessions = values(sessions);
insert into razor_sum_deviceos(product_id,date_sk,deviceos_sk,newusers)
select p.product_id,d.date_sk,o.deviceos_sk, count(distinct f.deviceidentifier)
from razor_fact_clientdata f,
razor_dim_product p,
razor_dim_date d,
razor_dim_deviceos o
where f.date_sk = d.date_sk
and d.datevalue = today
and f.deviceos_sk = o.deviceos_sk
and f.product_sk = p.product_sk
and f.isnew = 1
group by p.product_id,d.date_sk,o.deviceos_sk
on duplicate key update newusers = values(newusers);
set e = now();
insert into razor_log(op_type,op_name,op_date,affected_rows,duration)
values('runsum','razor_sum_deviceos',e,row_count(),TIMESTAMPDIFF(SECOND,s,e));
set s = now();
insert into razor_sum_deviceresolution(product_id,date_sk,deviceresolution_sk,sessions)
select p.product_id,d.date_sk,r.deviceresolution_sk, count(*)
from razor_fact_clientdata f,
razor_dim_product p,
razor_dim_date d,
razor_dim_deviceresolution r
where f.date_sk = d.date_sk
and d.datevalue = today
and f.deviceresolution_sk = r.deviceresolution_sk
and f.product_sk = p.product_sk
group by p.product_id,d.date_sk,r.deviceresolution_sk
on duplicate key update sessions = values(sessions);
insert into razor_sum_deviceresolution(product_id,date_sk,deviceresolution_sk,newusers)
select p.product_id,d.date_sk,r.deviceresolution_sk, count(distinct f.deviceidentifier)
from razor_fact_clientdata f,
razor_dim_product p,
razor_dim_date d,
razor_dim_deviceresolution r
where f.date_sk = d.date_sk
and d.datevalue = today
and f.deviceresolution_sk = r.deviceresolution_sk
and f.product_sk = p.product_sk
and f.isnew = 1
group by p.product_id,d.date_sk,r.deviceresolution_sk
on duplicate key update newusers = values(newusers);
set e = now();
insert into razor_log(op_type,op_name,op_date,affected_rows,duration)
values('runsum','razor_sum_deviceresolution',e,row_count(),TIMESTAMPDIFF(SECOND,s,e));
set s = now();
insert into razor_sum_devicesupplier(product_id,date_sk,devicesupplier_sk,sessions)
select p.product_id,d.date_sk,s.devicesupplier_sk, count(*)
from razor_fact_clientdata f,
razor_dim_product p,
razor_dim_date d,
razor_dim_devicesupplier s
where f.date_sk = d.date_sk
and d.datevalue = today
and f.devicesupplier_sk = s.devicesupplier_sk
and f.product_sk = p.product_sk
group by p.product_id,d.date_sk,s.devicesupplier_sk
on duplicate key update sessions = values(sessions);
insert into razor_sum_devicesupplier(product_id,date_sk,devicesupplier_sk,newusers)
select p.product_id,d.date_sk,s.devicesupplier_sk, count(distinct f.deviceidentifier)
from razor_fact_clientdata f,
razor_dim_product p,
razor_dim_date d,
razor_dim_devicesupplier s
where f.date_sk = d.date_sk
and d.datevalue = today
and f.devicesupplier_sk = s.devicesupplier_sk
and f.product_sk = p.product_sk
and f.isnew = 1
group by p.product_id,d.date_sk,s.devicesupplier_sk
on duplicate key update newusers = values(newusers);
set e = now();
insert into razor_log(op_type,op_name,op_date,affected_rows,duration)
values('runsum','razor_sum_devicesupplier',e,row_count(),TIMESTAMPDIFF(SECOND,s,e));
set s = now();
insert into razor_sum_devicenetwork(product_id,date_sk,devicenetwork_sk,sessions)
select p.product_id,d.date_sk,n.network_sk, count(*)
from razor_fact_clientdata f,
razor_dim_product p,
razor_dim_date d,
razor_dim_network n
where f.date_sk = d.date_sk
and d.datevalue = today
and f.network_sk = n.network_sk
and f.product_sk = p.product_sk
group by p.product_id,d.date_sk,n.network_sk
on duplicate key update sessions = values(sessions);
insert into razor_sum_devicenetwork(product_id,date_sk,devicenetwork_sk,newusers)
select p.product_id,d.date_sk,n.network_sk, count(distinct f.deviceidentifier)
from razor_fact_clientdata f,
razor_dim_product p,
razor_dim_date d,
razor_dim_network n
where f.date_sk = d.date_sk
and d.datevalue = today
and f.network_sk = n.network_sk
and f.product_sk = p.product_sk
and f.isnew = 1
group by p.product_id,d.date_sk,n.network_sk
on duplicate key update newusers = values(newusers);
set e = now();
insert into razor_log(op_type,op_name,op_date,affected_rows,duration)
values('runsum','razor_sum_devicenetwork',e,row_count(),TIMESTAMPDIFF(SECOND,s,e));
set s = now();
insert into razor_sum_event(product_sk,date_sk,event_sk, total)
SELECT product_sk,f.date_sk,event_sk,sum(number) FROM `razor_fact_event` f,
razor_dim_date d
where f.date_sk = d.date_sk and d.datevalue = today
group by product_sk,f.date_sk,event_sk
on duplicate key update total=values(total);
insert into razor_log(op_type,op_name,op_date,affected_rows,duration)
values('runsum','razor_sum_event',e,row_count(),TIMESTAMPDIFF(SECOND,s,e));
insert into razor_log(op_type,op_name,op_starttime)
values('runsum','-----finish runsum-----',now());
end$$
CREATE DEFINER=`admin`@`localhost` PROCEDURE `runweekly`(IN `begindate` DATE, IN `enddate` DATE)
NO SQL
begin
DECLARE s datetime;
DECLARE e datetime;
DECLARE col VARCHAR(16);
DECLARE days INT;
DECLARE w INT;
insert into razor_log(op_type,op_name,op_starttime)
values('runweekly','-----start runweekly-----',now());
set s = now();
-- generate the count of new users for last week
-- for channels, versions
INSERT INTO razor_sum_reserveusers_weekly
(startdate_sk,
enddate_sk,
product_id,
version_name,
channel_name,
usercount)
SELECT (SELECT date_sk
FROM razor_dim_date
WHERE datevalue = begindate) startdate_sk,
(SELECT date_sk
FROM razor_dim_date
WHERE datevalue = enddate) enddate_sk,
ifnull(p.product_id,-1),
ifnull(p.version_name,'all'),
ifnull(p.channel_name,'all'),
Count(DISTINCT f.deviceidentifier) count
FROM razor_fact_clientdata f,
razor_dim_date d,
razor_dim_product p
WHERE f.date_sk = d.date_sk
AND d.datevalue BETWEEN begindate AND enddate
AND f.product_sk = p.product_sk
AND p.product_active = 1
AND p.channel_active = 1
AND p.version_active = 1
AND f.isnew = 1
GROUP BY p.product_id,
p.version_name,
p.channel_name with rollup
union
SELECT (SELECT date_sk
FROM razor_dim_date
WHERE datevalue = begindate) startdate_sk,
(SELECT date_sk
FROM razor_dim_date
WHERE datevalue = enddate) enddate_sk,
ifnull(p.product_id,-1),
ifnull(p.version_name,'all'),
ifnull(p.channel_name,'all'),
Count(DISTINCT f.deviceidentifier) count
FROM razor_fact_clientdata f,
razor_dim_date d,
razor_dim_product p
WHERE f.date_sk = d.date_sk
AND d.datevalue BETWEEN begindate AND enddate
AND f.product_sk = p.product_sk
AND p.product_active = 1
AND p.channel_active = 1
AND p.version_active = 1
AND f.isnew = 1
GROUP BY p.product_id,
p.channel_name,
p.version_name with rollup
ON DUPLICATE KEY UPDATE usercount=VALUES(usercount);
set e = now();
insert into razor_log(op_type,op_name,op_starttime,op_date,affected_rows,duration)
values('runweekly','razor_sum_reserveusers_weekly new users for app,version,channel dimensions',s,e,row_count(),TIMESTAMPDIFF(SECOND,s,e));
set w = 1;
while w<=8 do
begin
set col = concat('week',w);
set days = -w*7;
set s = now();
-- 8 weeks for app,channel, version
SET @sql=concat(
'insert into razor_sum_reserveusers_weekly(startdate_sk, enddate_sk, product_id, version_name,channel_name,',
col,
')
Select
(select date_sk from razor_dim_date where datevalue= date_add(\'',begindate,'\',interval ',days,' DAY)) startdate,
(select date_sk from razor_dim_date where datevalue= date_add(\'',enddate,'\',interval ',days,' DAY)) enddate,
ifnull(p.product_id,-1),ifnull(p.version_name,\'all\'),ifnull(p.channel_name,\'all\'),
count(distinct f.deviceidentifier)
from
razor_fact_clientdata f, razor_dim_date d, razor_dim_product p where f.date_sk = d.date_sk
and f.product_sk = p.product_sk and d.datevalue between \'',begindate,'\' and \'',enddate,'\' and p.product_active=1
and p.channel_active=1 and p.version_active=1 and exists
(select 1 from razor_fact_clientdata ff, razor_dim_product pp, razor_dim_date dd where ff.product_sk = pp.product_sk
and ff.date_sk = dd.date_sk and pp.product_id = p.product_id and dd.datevalue between
date_add(\'',begindate,'\',interval ',days,' DAY) and
date_add(\'',enddate,'\',interval ',days,' DAY) and ff.deviceidentifier = f.deviceidentifier and pp.product_active=1
and pp.channel_active=1 and pp.version_active=1 and ff.isnew=1) group by p.product_id,p.version_name,p.channel_name with rollup
union
Select
(select date_sk from razor_dim_date where datevalue= date_add(\'',begindate,'\',interval ',days,' DAY)) startdate,
(select date_sk from razor_dim_date where datevalue= date_add(\'',enddate,'\',interval ',days,' DAY)) enddate,
ifnull(p.product_id,-1),ifnull(p.version_name,\'all\'),ifnull(p.channel_name,\'all\'),
count(distinct f.deviceidentifier)
from
razor_fact_clientdata f, razor_dim_date d, razor_dim_product p where f.date_sk = d.date_sk
and f.product_sk = p.product_sk and d.datevalue between \'',begindate,'\' and \'',enddate,'\' and p.product_active=1
and p.channel_active=1 and p.version_active=1 and exists
(select 1 from razor_fact_clientdata ff, razor_dim_product pp, razor_dim_date dd where ff.product_sk = pp.product_sk
and ff.date_sk = dd.date_sk and pp.product_id = p.product_id and dd.datevalue between
date_add(\'',begindate,'\',interval ',days,' DAY) and
date_add(\'',enddate,'\',interval ',days,' DAY) and ff.deviceidentifier = f.deviceidentifier and pp.product_active=1
and pp.channel_active=1 and pp.version_active=1 and ff.isnew=1) group by p.product_id,p.channel_name,p.version_name with rollup
on duplicate key update ',col,'=values(',col,');');
PREPARE sl FROM @sql;
EXECUTE sl;
DEALLOCATE PREPARE sl;
set e = now();
insert into razor_log(op_type,op_name,op_starttime,op_date,affected_rows,duration)
values('runweekly',concat('razor_sum_reserveusers_weekly WEEK ',-w,' reserve users for app,channel,version dimensions'),s,e,row_count(),TIMESTAMPDIFF(SECOND,s,e));
set w = w + 1;
end;
end while;
set s = now();
INSERT INTO razor_sum_basic_activeusers
(product_id,
week_activeuser,
week_percent)
SELECT p.product_id,
Count(DISTINCT f.deviceidentifier) activeusers,
Count(DISTINCT f.deviceidentifier) / (SELECT
Count(DISTINCT ff.deviceidentifier)
FROM razor_fact_clientdata ff,
razor_dim_date dd,
razor_dim_product pp
WHERE dd.datevalue <= enddate
AND
p.product_id = pp.product_id
AND pp.product_active = 1
AND pp.channel_active = 1
AND pp.version_active = 1
AND
ff.product_sk = pp.product_sk
AND ff.date_sk = dd.date_sk)
percent
FROM razor_fact_clientdata f,
razor_dim_date d,
razor_dim_product p
WHERE d.datevalue BETWEEN begindate AND enddate
AND p.product_active = 1
AND p.channel_active = 1
AND p.version_active = 1
AND f.product_sk = p.product_sk
AND f.date_sk = d.date_sk
GROUP BY p.product_id
ON DUPLICATE KEY UPDATE week_activeuser = VALUES(week_activeuser),week_percent = VALUES(week_percent);
set e = now();
insert into razor_log(op_type,op_name,op_starttime,op_date,affected_rows,duration)
values('runweekly','razor_sum_basic_activeusers week activeuser and percent',s,e,row_count(),TIMESTAMPDIFF(SECOND,s,e));
set s = now();
INSERT INTO razor_sum_basic_channel_activeusers
(date_sk,
product_id,
channel_id,
activeuser,
percent,
flag)
SELECT (SELECT date_sk
FROM razor_dim_date
WHERE datevalue = begindate) startdate,
p.product_id,
p.channel_id,
Count(DISTINCT f.deviceidentifier) activeusers,
Count(DISTINCT f.deviceidentifier) / (SELECT
Count(DISTINCT ff.deviceidentifier)
FROM razor_fact_clientdata ff,
razor_dim_date dd,
razor_dim_product pp
WHERE dd.datevalue <= enddate
AND
pp.product_id = p.product_id
AND
pp.channel_id = p.channel_id
AND pp.product_active = 1
AND pp.channel_active = 1
AND pp.version_active = 1
AND
ff.product_sk = pp.product_sk
AND ff.date_sk = dd.date_sk)
,
0
FROM razor_fact_clientdata f,
razor_dim_date d,
razor_dim_product p
WHERE d.datevalue BETWEEN begindate AND enddate
AND p.product_active = 1
AND p.channel_active = 1
AND p.version_active = 1
AND f.product_sk = p.product_sk
AND f.date_sk = d.date_sk
GROUP BY p.product_id,
p.channel_id
ON DUPLICATE KEY UPDATE activeuser = VALUES(activeuser),percent=VALUES(percent);
set e = now();
insert into razor_log(op_type,op_name,op_starttime,op_date,affected_rows,duration)
values('runweekly','razor_sum_basic_channel_activeusers each channel active user and percent',s,e,row_count(),TIMESTAMPDIFF(SECOND,s,e));
insert into razor_log(op_type,op_name,op_starttime)
values('runweekly','-----finish runweekly-----',now());
end$$
DELIMITER ;
-- --------------------------------------------------------
--
-- 表的结构 `razor_deviceid_pushid`
--
CREATE TABLE IF NOT EXISTS `razor_deviceid_pushid` (
`did` int(11) unsigned NOT NULL,
`deviceid` varchar(128) NOT NULL,
`pushid` varchar(128) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- 表的结构 `razor_deviceid_userid`
--
CREATE TABLE IF NOT EXISTS `razor_deviceid_userid` (
`did` int(11) unsigned NOT NULL,
`deviceid` varchar(128) NOT NULL,
`userid` varchar(128) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- 表的结构 `razor_dim_activity`
--
CREATE TABLE IF NOT EXISTS `razor_dim_activity` (
`activity_sk` int(11) NOT NULL,
`activity_name` varchar(512) NOT NULL,
`product_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- 表的结构 `razor_dim_date`
--
CREATE TABLE IF NOT EXISTS `razor_dim_date` (
`date_sk` int(11) NOT NULL,
`datevalue` date NOT NULL,
`year` int(11) NOT NULL,
`quarter` int(11) NOT NULL,
`month` int(11) NOT NULL,
`week` int(11) NOT NULL,
`dayofweek` int(11) NOT NULL,
`day` int(11) NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=4019 DEFAULT CHARSET=utf8;
--
-- 转存表中的数据 `razor_dim_date`
--
INSERT INTO `razor_dim_date` (`date_sk`, `datevalue`, `year`, `quarter`, `month`, `week`, `dayofweek`, `day`) VALUES
(1828, '2015-01-01', 2015, 1, 1, 0, 4, 2),
(1829, '2015-01-02', 2015, 1, 1, 0, 5, 3),
(1830, '2015-01-03', 2015, 1, 1, 1, 6, 4),
(1831, '2015-01-04', 2015, 1, 1, 1, 0, 5),
(1832, '2015-01-05', 2015, 1, 1, 1, 1, 6),
(1833, '2015-01-06', 2015, 1, 1, 1, 2, 7),
(1834, '2015-01-07', 2015, 1, 1, 1, 3, 8),
(1835, '2015-01-08', 2015, 1, 1, 1, 4, 9),
(1836, '2015-01-09', 2015, 1, 1, 1, 5, 10),
(1837, '2015-01-10', 2015, 1, 1, 2, 6, 11),
(1838, '2015-01-11', 2015, 1, 1, 2, 0, 12),
(1839, '2015-01-12', 2015, 1, 1, 2, 1, 13),
(1840, '2015-01-13', 2015, 1, 1, 2, 2, 14),
(1841, '2015-01-14', 2015, 1, 1, 2, 3, 15),
(1842, '2015-01-15', 2015, 1, 1, 2, 4, 16),
(1843, '2015-01-16', 2015, 1, 1, 2, 5, 17),
(1844, '2015-01-17', 2015, 1, 1, 3, 6, 18),
(1845, '2015-01-18', 2015, 1, 1, 3, 0, 19),
(1846, '2015-01-19', 2015, 1, 1, 3, 1, 20),
(1847, '2015-01-20', 2015, 1, 1, 3, 2, 21),
(1848, '2015-01-21', 2015, 1, 1, 3, 3, 22),
(1849, '2015-01-22', 2015, 1, 1, 3, 4, 23),
(1850, '2015-01-23', 2015, 1, 1, 3, 5, 24),
(1851, '2015-01-24', 2015, 1, 1, 4, 6, 25),
(1852, '2015-01-25', 2015, 1, 1, 4, 0, 26),
(1853, '2015-01-26', 2015, 1, 1, 4, 1, 27),
(1854, '2015-01-27', 2015, 1, 1, 4, 2, 28),
(1855, '2015-01-28', 2015, 1, 1, 4, 3, 29),
(1856, '2015-01-29', 2015, 1, 1, 4, 4, 30),
(1857, '2015-01-30', 2015, 1, 1, 4, 5, 31),
(1858, '2015-01-31', 2015, 1, 2, 5, 6, 1),
(1859, '2015-02-01', 2015, 1, 2, 5, 0, 2),
(1860, '2015-02-02', 2015, 1, 2, 5, 1, 3),
(1861, '2015-02-03', 2015, 1, 2, 5, 2, 4),
(1862, '2015-02-04', 2015, 1, 2, 5, 3, 5),
(1863, '2015-02-05', 2015, 1, 2, 5, 4, 6),
(1864, '2015-02-06', 2015, 1, 2, 5, 5, 7),
(1865, '2015-02-07', 2015, 1, 2, 6, 6, 8),
(1866, '2015-02-08', 2015, 1, 2, 6, 0, 9),
(1867, '2015-02-09', 2015, 1, 2, 6, 1, 10),
(1868, '2015-02-10', 2015, 1, 2, 6, 2, 11),
(1869, '2015-02-11', 2015, 1, 2, 6, 3, 12),
(1870, '2015-02-12', 2015, 1, 2, 6, 4, 13),
(1871, '2015-02-13', 2015, 1, 2, 6, 5, 14),
(1872, '2015-02-14', 2015, 1, 2, 7, 6, 15),
(1873, '2015-02-15', 2015, 1, 2, 7, 0, 16),
(1874, '2015-02-16', 2015, 1, 2, 7, 1, 17),
(1875, '2015-02-17', 2015, 1, 2, 7, 2, 18),
(1876, '2015-02-18', 2015, 1, 2, 7, 3, 19),
(1877, '2015-02-19', 2015, 1, 2, 7, 4, 20),
(1878, '2015-02-20', 2015, 1, 2, 7, 5, 21),
(1879, '2015-02-21', 2015, 1, 2, 8, 6, 22),
(1880, '2015-02-22', 2015, 1, 2, 8, 0, 23),
(1881, '2015-02-23', 2015, 1, 2, 8, 1, 24),
(1882, '2015-02-24', 2015, 1, 2, 8, 2, 25),
(1883, '2015-02-25', 2015, 1, 2, 8, 3, 26),
(1884, '2015-02-26', 2015, 1, 2, 8, 4, 27),
(1885, '2015-02-27', 2015, 1, 2, 8, 5, 28),
(1886, '2015-02-28', 2015, 1, 3, 9, 6, 1),
(1887, '2015-03-01', 2015, 1, 3, 9, 0, 2),
(1888, '2015-03-02', 2015, 1, 3, 9, 1, 3),
(1889, '2015-03-03', 2015, 1, 3, 9, 2, 4),
(1890, '2015-03-04', 2015, 1, 3, 9, 3, 5),
(1891, '2015-03-05', 2015, 1, 3, 9, 4, 6),
(1892, '2015-03-06', 2015, 1, 3, 9, 5, 7),
(1893, '2015-03-07', 2015, 1, 3, 10, 6, 8),
(1894, '2015-03-08', 2015, 1, 3, 10, 0, 9),
(1895, '2015-03-09', 2015, 1, 3, 10, 1, 10),
(1896, '2015-03-10', 2015, 1, 3, 10, 2, 11),
(1897, '2015-03-11', 2015, 1, 3, 10, 3, 12),
(1898, '2015-03-12', 2015, 1, 3, 10, 4, 13),
(1899, '2015-03-13', 2015, 1, 3, 10, 5, 14),
(1900, '2015-03-14', 2015, 1, 3, 11, 6, 15),
(1901, '2015-03-15', 2015, 1, 3, 11, 0, 16),
(1902, '2015-03-16', 2015, 1, 3, 11, 1, 17),
(1903, '2015-03-17', 2015, 1, 3, 11, 2, 18),
(1904, '2015-03-18', 2015, 1, 3, 11, 3, 19),
(1905, '2015-03-19', 2015, 1, 3, 11, 4, 20),
(1906, '2015-03-20', 2015, 1, 3, 11, 5, 21),
(1907, '2015-03-21', 2015, 1, 3, 12, 6, 22),
(1908, '2015-03-22', 2015, 1, 3, 12, 0, 23),
(1909, '2015-03-23', 2015, 1, 3, 12, 1, 24),
(1910, '2015-03-24', 2015, 1, 3, 12, 2, 25),
(1911, '2015-03-25', 2015, 1, 3, 12, 3, 26),
(1912, '2015-03-26', 2015, 1, 3, 12, 4, 27),
(1913, '2015-03-27', 2015, 1, 3, 12, 5, 28),
(1914, '2015-03-28', 2015, 1, 3, 13, 6, 29),
(1915, '2015-03-29', 2015, 1, 3, 13, 0, 30),
(1916, '2015-03-30', 2015, 1, 3, 13, 1, 31),
(1917, '2015-03-31', 2015, 2, 4, 13, 2, 1),
(1918, '2015-04-01', 2015, 2, 4, 13, 3, 2),
(1919, '2015-04-02', 2015, 2, 4, 13, 4, 3),
(1920, '2015-04-03', 2015, 2, 4, 13, 5, 4),
(1921, '2015-04-04', 2015, 2, 4, 14, 6, 5),
(1922, '2015-04-05', 2015, 2, 4, 14, 0, 6),
(1923, '2015-04-06', 2015, 2, 4, 14, 1, 7),
(1924, '2015-04-07', 2015, 2, 4, 14, 2, 8),
(1925, '2015-04-08', 2015, 2, 4, 14, 3, 9),
(1926, '2015-04-09', 2015, 2, 4, 14, 4, 10),
(1927, '2015-04-10', 2015, 2, 4, 14, 5, 11),
(1928, '2015-04-11', 2015, 2, 4, 15, 6, 12),
(1929, '2015-04-12', 2015, 2, 4, 15, 0, 13),
(1930, '2015-04-13', 2015, 2, 4, 15, 1, 14),
(1931, '2015-04-14', 2015, 2, 4, 15, 2, 15),
(1932, '2015-04-15', 2015, 2, 4, 15, 3, 16),
(1933, '2015-04-16', 2015, 2, 4, 15, 4, 17),
(1934, '2015-04-17', 2015, 2, 4, 15, 5, 18),
(1935, '2015-04-18', 2015, 2, 4, 16, 6, 19),
(1936, '2015-04-19', 2015, 2, 4, 16, 0, 20),
(1937, '2015-04-20', 2015, 2, 4, 16, 1, 21),
(1938, '2015-04-21', 2015, 2, 4, 16, 2, 22),
(1939, '2015-04-22', 2015, 2, 4, 16, 3, 23),
(1940, '2015-04-23', 2015, 2, 4, 16, 4, 24),
(1941, '2015-04-24', 2015, 2, 4, 16, 5, 25),
(1942, '2015-04-25', 2015, 2, 4, 17, 6, 26),
(1943, '2015-04-26', 2015, 2, 4, 17, 0, 27),
(1944, '2015-04-27', 2015, 2, 4, 17, 1, 28),
(1945, '2015-04-28', 2015, 2, 4, 17, 2, 29),
(1946, '2015-04-29', 2015, 2, 4, 17, 3, 30),
(1947, '2015-04-30', 2015, 2, 5, 17, 4, 1),
(1948, '2015-05-01', 2015, 2, 5, 17, 5, 2),
(1949, '2015-05-02', 2015, 2, 5, 18, 6, 3),
(1950, '2015-05-03', 2015, 2, 5, 18, 0, 4),
(1951, '2015-05-04', 2015, 2, 5, 18, 1, 5),
(1952, '2015-05-05', 2015, 2, 5, 18, 2, 6),
(1953, '2015-05-06', 2015, 2, 5, 18, 3, 7),
(1954, '2015-05-07', 2015, 2, 5, 18, 4, 8),
(1955, '2015-05-08', 2015, 2, 5, 18, 5, 9),
(1956, '2015-05-09', 2015, 2, 5, 19, 6, 10),
(1957, '2015-05-10', 2015, 2, 5, 19, 0, 11),
(1958, '2015-05-11', 2015, 2, 5, 19, 1, 12),
(1959, '2015-05-12', 2015, 2, 5, 19, 2, 13),
(1960, '2015-05-13', 2015, 2, 5, 19, 3, 14),
(1961, '2015-05-14', 2015, 2, 5, 19, 4, 15),
(1962, '2015-05-15', 2015, 2, 5, 19, 5, 16),
(1963, '2015-05-16', 2015, 2, 5, 20, 6, 17),
(1964, '2015-05-17', 2015, 2, 5, 20, 0, 18),
(1965, '2015-05-18', 2015, 2, 5, 20, 1, 19),
(1966, '2015-05-19', 2015, 2, 5, 20, 2, 20),
(1967, '2015-05-20', 2015, 2, 5, 20, 3, 21),
(1968, '2015-05-21', 2015, 2, 5, 20, 4, 22),
(1969, '2015-05-22', 2015, 2, 5, 20, 5, 23),
(1970, '2015-05-23', 2015, 2, 5, 21, 6, 24),
(1971, '2015-05-24', 2015, 2, 5, 21, 0, 25),
(1972, '2015-05-25', 2015, 2, 5, 21, 1, 26),
(1973, '2015-05-26', 2015, 2, 5, 21, 2, 27),
(1974, '2015-05-27', 2015, 2, 5, 21, 3, 28),
(1975, '2015-05-28', 2015, 2, 5, 21, 4, 29),
(1976, '2015-05-29', 2015, 2, 5, 21, 5, 30),
(1977, '2015-05-30', 2015, 2, 5, 22, 6, 31),
(1978, '2015-05-31', 2015, 2, 6, 22, 0, 1),
(1979, '2015-06-01', 2015, 2, 6, 22, 1, 2),
(1980, '2015-06-02', 2015, 2, 6, 22, 2, 3),
(1981, '2015-06-03', 2015, 2, 6, 22, 3, 4),
(1982, '2015-06-04', 2015, 2, 6, 22, 4, 5),
(1983, '2015-06-05', 2015, 2, 6, 22, 5, 6),
(1984, '2015-06-06', 2015, 2, 6, 23, 6, 7),
(1985, '2015-06-07', 2015, 2, 6, 23, 0, 8),
(1986, '2015-06-08', 2015, 2, 6, 23, 1, 9),
(1987, '2015-06-09', 2015, 2, 6, 23, 2, 10),
(1988, '2015-06-10', 2015, 2, 6, 23, 3, 11),
(1989, '2015-06-11', 2015, 2, 6, 23, 4, 12),
(1990, '2015-06-12', 2015, 2, 6, 23, 5, 13),
(1991, '2015-06-13', 2015, 2, 6, 24, 6, 14),
(1992, '2015-06-14', 2015, 2, 6, 24, 0, 15),
(1993, '2015-06-15', 2015, 2, 6, 24, 1, 16),
(1994, '2015-06-16', 2015, 2, 6, 24, 2, 17),
(1995, '2015-06-17', 2015, 2, 6, 24, 3, 18),
(1996, '2015-06-18', 2015, 2, 6, 24, 4, 19),
(1997, '2015-06-19', 2015, 2, 6, 24, 5, 20),
(1998, '2015-06-20', 2015, 2, 6, 25, 6, 21),
(1999, '2015-06-21', 2015, 2, 6, 25, 0, 22),
(2000, '2015-06-22', 2015, 2, 6, 25, 1, 23),
(2001, '2015-06-23', 2015, 2, 6, 25, 2, 24),
(2002, '2015-06-24', 2015, 2, 6, 25, 3, 25),
(2003, '2015-06-25', 2015, 2, 6, 25, 4, 26),
(2004, '2015-06-26', 2015, 2, 6, 25, 5, 27),
(2005, '2015-06-27', 2015, 2, 6, 26, 6, 28),
(2006, '2015-06-28', 2015, 2, 6, 26, 0, 29),
(2007, '2015-06-29', 2015, 2, 6, 26, 1, 30),
(2008, '2015-06-30', 2015, 3, 7, 26, 2, 1),
(2009, '2015-07-01', 2015, 3, 7, 26, 3, 2),
(2010, '2015-07-02', 2015, 3, 7, 26, 4, 3),
(2011, '2015-07-03', 2015, 3, 7, 26, 5, 4),
(2012, '2015-07-04', 2015, 3, 7, 27, 6, 5),
(2013, '2015-07-05', 2015, 3, 7, 27, 0, 6),
(2014, '2015-07-06', 2015, 3, 7, 27, 1, 7),
(2015, '2015-07-07', 2015, 3, 7, 27, 2, 8),
(2016, '2015-07-08', 2015, 3, 7, 27, 3, 9),
(2017, '2015-07-09', 2015, 3, 7, 27, 4, 10),
(2018, '2015-07-10', 2015, 3, 7, 27, 5, 11),
(2019, '2015-07-11', 2015, 3, 7, 28, 6, 12),
(2020, '2015-07-12', 2015, 3, 7, 28, 0, 13),
(2021, '2015-07-13', 2015, 3, 7, 28, 1, 14),
(2022, '2015-07-14', 2015, 3, 7, 28, 2, 15),
(2023, '2015-07-15', 2015, 3, 7, 28, 3, 16),
(2024, '2015-07-16', 2015, 3, 7, 28, 4, 17),
(2025, '2015-07-17', 2015, 3, 7, 28, 5, 18),
(2026, '2015-07-18', 2015, 3, 7, 29, 6, 19),
(2027, '2015-07-19', 2015, 3, 7, 29, 0, 20),
(2028, '2015-07-20', 2015, 3, 7, 29, 1, 21),
(2029, '2015-07-21', 2015, 3, 7, 29, 2, 22),
(2030, '2015-07-22', 2015, 3, 7, 29, 3, 23),
(2031, '2015-07-23', 2015, 3, 7, 29, 4, 24),
(2032, '2015-07-24', 2015, 3, 7, 29, 5, 25),
(2033, '2015-07-25', 2015, 3, 7, 30, 6, 26),
(2034, '2015-07-26', 2015, 3, 7, 30, 0, 27),
(2035, '2015-07-27', 2015, 3, 7, 30, 1, 28),
(2036, '2015-07-28', 2015, 3, 7, 30, 2, 29),
(2037, '2015-07-29', 2015, 3, 7, 30, 3, 30),
(2038, '2015-07-30', 2015, 3, 7, 30, 4, 31),
(2039, '2015-07-31', 2015, 3, 8, 30, 5, 1),
(2040, '2015-08-01', 2015, 3, 8, 31, 6, 2),
(2041, '2015-08-02', 2015, 3, 8, 31, 0, 3),
(2042, '2015-08-03', 2015, 3, 8, 31, 1, 4),
(2043, '2015-08-04', 2015, 3, 8, 31, 2, 5),
(2044, '2015-08-05', 2015, 3, 8, 31, 3, 6),
(2045, '2015-08-06', 2015, 3, 8, 31, 4, 7),
(2046, '2015-08-07', 2015, 3, 8, 31, 5, 8),
(2047, '2015-08-08', 2015, 3, 8, 32, 6, 9),
(2048, '2015-08-09', 2015, 3, 8, 32, 0, 10),
(2049, '2015-08-10', 2015, 3, 8, 32, 1, 11),
(2050, '2015-08-11', 2015, 3, 8, 32, 2, 12),
(2051, '2015-08-12', 2015, 3, 8, 32, 3, 13),
(2052, '2015-08-13', 2015, 3, 8, 32, 4, 14),
(2053, '2015-08-14', 2015, 3, 8, 32, 5, 15),
(2054, '2015-08-15', 2015, 3, 8, 33, 6, 16),
(2055, '2015-08-16', 2015, 3, 8, 33, 0, 17),
(2056, '2015-08-17', 2015, 3, 8, 33, 1, 18),
(2057, '2015-08-18', 2015, 3, 8, 33, 2, 19),
(2058, '2015-08-19', 2015, 3, 8, 33, 3, 20),
(2059, '2015-08-20', 2015, 3, 8, 33, 4, 21),
(2060, '2015-08-21', 2015, 3, 8, 33, 5, 22),
(2061, '2015-08-22', 2015, 3, 8, 34, 6, 23),
(2062, '2015-08-23', 2015, 3, 8, 34, 0, 24),
(2063, '2015-08-24', 2015, 3, 8, 34, 1, 25),
(2064, '2015-08-25', 2015, 3, 8, 34, 2, 26),
(2065, '2015-08-26', 2015, 3, 8, 34, 3, 27),
(2066, '2015-08-27', 2015, 3, 8, 34, 4, 28),
(2067, '2015-08-28', 2015, 3, 8, 34, 5, 29),
(2068, '2015-08-29', 2015, 3, 8, 35, 6, 30),
(2069, '2015-08-30', 2015, 3, 8, 35, 0, 31),
(2070, '2015-08-31', 2015, 3, 9, 35, 1, 1),
(2071, '2015-09-01', 2015, 3, 9, 35, 2, 2),
(2072, '2015-09-02', 2015, 3, 9, 35, 3, 3),
(2073, '2015-09-03', 2015, 3, 9, 35, 4, 4),
(2074, '2015-09-04', 2015, 3, 9, 35, 5, 5),
(2075, '2015-09-05', 2015, 3, 9, 36, 6, 6),
(2076, '2015-09-06', 2015, 3, 9, 36, 0, 7),
(2077, '2015-09-07', 2015, 3, 9, 36, 1, 8),
(2078, '2015-09-08', 2015, 3, 9, 36, 2, 9),
(2079, '2015-09-09', 2015, 3, 9, 36, 3, 10),
(2080, '2015-09-10', 2015, 3, 9, 36, 4, 11),
(2081, '2015-09-11', 2015, 3, 9, 36, 5, 12),
(2082, '2015-09-12', 2015, 3, 9, 37, 6, 13),
(2083, '2015-09-13', 2015, 3, 9, 37, 0, 14),
(2084, '2015-09-14', 2015, 3, 9, 37, 1, 15),
(2085, '2015-09-15', 2015, 3, 9, 37, 2, 16),
(2086, '2015-09-16', 2015, 3, 9, 37, 3, 17),
(2087, '2015-09-17', 2015, 3, 9, 37, 4, 18),
(2088, '2015-09-18', 2015, 3, 9, 37, 5, 19),
(2089, '2015-09-19', 2015, 3, 9, 38, 6, 20),
(2090, '2015-09-20', 2015, 3, 9, 38, 0, 21),
(2091, '2015-09-21', 2015, 3, 9, 38, 1, 22),
(2092, '2015-09-22', 2015, 3, 9, 38, 2, 23),
(2093, '2015-09-23', 2015, 3, 9, 38, 3, 24),
(2094, '2015-09-24', 2015, 3, 9, 38, 4, 25),
(2095, '2015-09-25', 2015, 3, 9, 38, 5, 26),
(2096, '2015-09-26', 2015, 3, 9, 39, 6, 27),
(2097, '2015-09-27', 2015, 3, 9, 39, 0, 28),
(2098, '2015-09-28', 2015, 3, 9, 39, 1, 29),
(2099, '2015-09-29', 2015, 3, 9, 39, 2, 30),
(2100, '2015-09-30', 2015, 4, 10, 39, 3, 1),
(2101, '2015-10-01', 2015, 4, 10, 39, 4, 2),
(2102, '2015-10-02', 2015, 4, 10, 39, 5, 3),
(2103, '2015-10-03', 2015, 4, 10, 40, 6, 4),
(2104, '2015-10-04', 2015, 4, 10, 40, 0, 5),
(2105, '2015-10-05', 2015, 4, 10, 40, 1, 6),
(2106, '2015-10-06', 2015, 4, 10, 40, 2, 7),
(2107, '2015-10-07', 2015, 4, 10, 40, 3, 8),
(2108, '2015-10-08', 2015, 4, 10, 40, 4, 9),
(2109, '2015-10-09', 2015, 4, 10, 40, 5, 10),
(2110, '2015-10-10', 2015, 4, 10, 41, 6, 11),
(2111, '2015-10-11', 2015, 4, 10, 41, 0, 12),
(2112, '2015-10-12', 2015, 4, 10, 41, 1, 13),
(2113, '2015-10-13', 2015, 4, 10, 41, 2, 14),
(2114, '2015-10-14', 2015, 4, 10, 41, 3, 15),
(2115, '2015-10-15', 2015, 4, 10, 41, 4, 16),
(2116, '2015-10-16', 2015, 4, 10, 41, 5, 17),
(2117, '2015-10-17', 2015, 4, 10, 42, 6, 18),
(2118, '2015-10-18', 2015, 4, 10, 42, 0, 19),
(2119, '2015-10-19', 2015, 4, 10, 42, 1, 20),
(2120, '2015-10-20', 2015, 4, 10, 42, 2, 21),
(2121, '2015-10-21', 2015, 4, 10, 42, 3, 22),
(2122, '2015-10-22', 2015, 4, 10, 42, 4, 23),
(2123, '2015-10-23', 2015, 4, 10, 42, 5, 24),
(2124, '2015-10-24', 2015, 4, 10, 43, 6, 25),
(2125, '2015-10-25', 2015, 4, 10, 43, 0, 26),
(2126, '2015-10-26', 2015, 4, 10, 43, 1, 27),
(2127, '2015-10-27', 2015, 4, 10, 43, 2, 28),
(2128, '2015-10-28', 2015, 4, 10, 43, 3, 29),
(2129, '2015-10-29', 2015, 4, 10, 43, 4, 30),
(2130, '2015-10-30', 2015, 4, 10, 43, 5, 31),
(2131, '2015-10-31', 2015, 4, 11, 44, 6, 1),
(2132, '2015-11-01', 2015, 4, 11, 44, 0, 2),
(2133, '2015-11-02', 2015, 4, 11, 44, 1, 3),
(2134, '2015-11-03', 2015, 4, 11, 44, 2, 4),
(2135, '2015-11-04', 2015, 4, 11, 44, 3, 5),
(2136, '2015-11-05', 2015, 4, 11, 44, 4, 6),
(2137, '2015-11-06', 2015, 4, 11, 44, 5, 7),
(2138, '2015-11-07', 2015, 4, 11, 45, 6, 8),
(2139, '2015-11-08', 2015, 4, 11, 45, 0, 9),
(2140, '2015-11-09', 2015, 4, 11, 45, 1, 10),
(2141, '2015-11-10', 2015, 4, 11, 45, 2, 11),
(2142, '2015-11-11', 2015, 4, 11, 45, 3, 12),
(2143, '2015-11-12', 2015, 4, 11, 45, 4, 13),
(2144, '2015-11-13', 2015, 4, 11, 45, 5, 14),
(2145, '2015-11-14', 2015, 4, 11, 46, 6, 15),
(2146, '2015-11-15', 2015, 4, 11, 46, 0, 16),
(2147, '2015-11-16', 2015, 4, 11, 46, 1, 17),
(2148, '2015-11-17', 2015, 4, 11, 46, 2, 18),
(2149, '2015-11-18', 2015, 4, 11, 46, 3, 19),
(2150, '2015-11-19', 2015, 4, 11, 46, 4, 20),
(2151, '2015-11-20', 2015, 4, 11, 46, 5, 21),
(2152, '2015-11-21', 2015, 4, 11, 47, 6, 22),
(2153, '2015-11-22', 2015, 4, 11, 47, 0, 23),
(2154, '2015-11-23', 2015, 4, 11, 47, 1, 24),
(2155, '2015-11-24', 2015, 4, 11, 47, 2, 25),
(2156, '2015-11-25', 2015, 4, 11, 47, 3, 26),
(2157, '2015-11-26', 2015, 4, 11, 47, 4, 27),
(2158, '2015-11-27', 2015, 4, 11, 47, 5, 28),
(2159, '2015-11-28', 2015, 4, 11, 48, 6, 29),
(2160, '2015-11-29', 2015, 4, 11, 48, 0, 30),
(2161, '2015-11-30', 2015, 4, 12, 48, 1, 1),
(2162, '2015-12-01', 2015, 4, 12, 48, 2, 2),
(2163, '2015-12-02', 2015, 4, 12, 48, 3, 3),
(2164, '2015-12-03', 2015, 4, 12, 48, 4, 4),
(2165, '2015-12-04', 2015, 4, 12, 48, 5, 5),
(2166, '2015-12-05', 2015, 4, 12, 49, 6, 6),
(2167, '2015-12-06', 2015, 4, 12, 49, 0, 7),
(2168, '2015-12-07', 2015, 4, 12, 49, 1, 8),
(2169, '2015-12-08', 2015, 4, 12, 49, 2, 9),
(2170, '2015-12-09', 2015, 4, 12, 49, 3, 10),
(2171, '2015-12-10', 2015, 4, 12, 49, 4, 11),
(2172, '2015-12-11', 2015, 4, 12, 49, 5, 12),
(2173, '2015-12-12', 2015, 4, 12, 50, 6, 13),
(2174, '2015-12-13', 2015, 4, 12, 50, 0, 14),
(2175, '2015-12-14', 2015, 4, 12, 50, 1, 15),
(2176, '2015-12-15', 2015, 4, 12, 50, 2, 16),
(2177, '2015-12-16', 2015, 4, 12, 50, 3, 17),
(2178, '2015-12-17', 2015, 4, 12, 50, 4, 18),
(2179, '2015-12-18', 2015, 4, 12, 50, 5, 19),
(2180, '2015-12-19', 2015, 4, 12, 51, 6, 20),
(2181, '2015-12-20', 2015, 4, 12, 51, 0, 21),
(2182, '2015-12-21', 2015, 4, 12, 51, 1, 22),
(2183, '2015-12-22', 2015, 4, 12, 51, 2, 23),
(2184, '2015-12-23', 2015, 4, 12, 51, 3, 24),
(2185, '2015-12-24', 2015, 4, 12, 51, 4, 25),
(2186, '2015-12-25', 2015, 4, 12, 51, 5, 26),
(2187, '2015-12-26', 2015, 4, 12, 52, 6, 27),
(2188, '2015-12-27', 2015, 4, 12, 52, 0, 28),
(2189, '2015-12-28', 2015, 4, 12, 52, 1, 29),
(2190, '2015-12-29', 2015, 4, 12, 52, 2, 30),
(2191, '2015-12-30', 2015, 4, 12, 52, 3, 31),
(2192, '2015-12-31', 2016, 1, 1, 0, 4, 1),
(2193, '2016-01-01', 2016, 1, 1, 0, 5, 2),
(2194, '2016-01-02', 2016, 1, 1, 1, 6, 3),
(2195, '2016-01-03', 2016, 1, 1, 1, 0, 4),
(2196, '2016-01-04', 2016, 1, 1, 1, 1, 5),
(2197, '2016-01-05', 2016, 1, 1, 1, 2, 6),
(2198, '2016-01-06', 2016, 1, 1, 1, 3, 7),
(2199, '2016-01-07', 2016, 1, 1, 1, 4, 8),
(2200, '2016-01-08', 2016, 1, 1, 1, 5, 9),
(2201, '2016-01-09', 2016, 1, 1, 2, 6, 10),
(2202, '2016-01-10', 2016, 1, 1, 2, 0, 11),
(2203, '2016-01-11', 2016, 1, 1, 2, 1, 12),
(2204, '2016-01-12', 2016, 1, 1, 2, 2, 13),
(2205, '2016-01-13', 2016, 1, 1, 2, 3, 14),
(2206, '2016-01-14', 2016, 1, 1, 2, 4, 15),
(2207, '2016-01-15', 2016, 1, 1, 2, 5, 16),
(2208, '2016-01-16', 2016, 1, 1, 3, 6, 17),
(2209, '2016-01-17', 2016, 1, 1, 3, 0, 18),
(2210, '2016-01-18', 2016, 1, 1, 3, 1, 19),
(2211, '2016-01-19', 2016, 1, 1, 3, 2, 20),
(2212, '2016-01-20', 2016, 1, 1, 3, 3, 21),
(2213, '2016-01-21', 2016, 1, 1, 3, 4, 22),
(2214, '2016-01-22', 2016, 1, 1, 3, 5, 23),
(2215, '2016-01-23', 2016, 1, 1, 4, 6, 24),
(2216, '2016-01-24', 2016, 1, 1, 4, 0, 25),
(2217, '2016-01-25', 2016, 1, 1, 4, 1, 26),
(2218, '2016-01-26', 2016, 1, 1, 4, 2, 27),
(2219, '2016-01-27', 2016, 1, 1, 4, 3, 28),
(2220, '2016-01-28', 2016, 1, 1, 4, 4, 29),
(2221, '2016-01-29', 2016, 1, 1, 4, 5, 30),
(2222, '2016-01-30', 2016, 1, 1, 5, 6, 31),
(2223, '2016-01-31', 2016, 1, 2, 5, 0, 1),
(2224, '2016-02-01', 2016, 1, 2, 5, 1, 2),
(2225, '2016-02-02', 2016, 1, 2, 5, 2, 3),
(2226, '2016-02-03', 2016, 1, 2, 5, 3, 4),
(2227, '2016-02-04', 2016, 1, 2, 5, 4, 5),
(2228, '2016-02-05', 2016, 1, 2, 5, 5, 6),
(2229, '2016-02-06', 2016, 1, 2, 6, 6, 7),
(2230, '2016-02-07', 2016, 1, 2, 6, 0, 8),
(2231, '2016-02-08', 2016, 1, 2, 6, 1, 9),
(2232, '2016-02-09', 2016, 1, 2, 6, 2, 10),
(2233, '2016-02-10', 2016, 1, 2, 6, 3, 11),
(2234, '2016-02-11', 2016, 1, 2, 6, 4, 12),
(2235, '2016-02-12', 2016, 1, 2, 6, 5, 13),
(2236, '2016-02-13', 2016, 1, 2, 7, 6, 14),
(2237, '2016-02-14', 2016, 1, 2, 7, 0, 15),
(2238, '2016-02-15', 2016, 1, 2, 7, 1, 16),
(2239, '2016-02-16', 2016, 1, 2, 7, 2, 17),
(2240, '2016-02-17', 2016, 1, 2, 7, 3, 18),
(2241, '2016-02-18', 2016, 1, 2, 7, 4, 19),
(2242, '2016-02-19', 2016, 1, 2, 7, 5, 20),
(2243, '2016-02-20', 2016, 1, 2, 8, 6, 21),
(2244, '2016-02-21', 2016, 1, 2, 8, 0, 22),
(2245, '2016-02-22', 2016, 1, 2, 8, 1, 23),
(2246, '2016-02-23', 2016, 1, 2, 8, 2, 24),
(2247, '2016-02-24', 2016, 1, 2, 8, 3, 25),
(2248, '2016-02-25', 2016, 1, 2, 8, 4, 26),
(2249, '2016-02-26', 2016, 1, 2, 8, 5, 27),
(2250, '2016-02-27', 2016, 1, 2, 9, 6, 28),
(2251, '2016-02-28', 2016, 1, 2, 9, 0, 29),
(2252, '2016-02-29', 2016, 1, 3, 9, 1, 1),
(2253, '2016-03-01', 2016, 1, 3, 9, 2, 2),
(2254, '2016-03-02', 2016, 1, 3, 9, 3, 3),
(2255, '2016-03-03', 2016, 1, 3, 9, 4, 4),
(2256, '2016-03-04', 2016, 1, 3, 9, 5, 5),
(2257, '2016-03-05', 2016, 1, 3, 10, 6, 6),
(2258, '2016-03-06', 2016, 1, 3, 10, 0, 7),
(2259, '2016-03-07', 2016, 1, 3, 10, 1, 8),
(2260, '2016-03-08', 2016, 1, 3, 10, 2, 9),
(2261, '2016-03-09', 2016, 1, 3, 10, 3, 10),
(2262, '2016-03-10', 2016, 1, 3, 10, 4, 11),
(2263, '2016-03-11', 2016, 1, 3, 10, 5, 12),
(2264, '2016-03-12', 2016, 1, 3, 11, 6, 13),
(2265, '2016-03-13', 2016, 1, 3, 11, 0, 14),
(2266, '2016-03-14', 2016, 1, 3, 11, 1, 15),
(2267, '2016-03-15', 2016, 1, 3, 11, 2, 16),
(2268, '2016-03-16', 2016, 1, 3, 11, 3, 17),
(2269, '2016-03-17', 2016, 1, 3, 11, 4, 18),
(2270, '2016-03-18', 2016, 1, 3, 11, 5, 19),
(2271, '2016-03-19', 2016, 1, 3, 12, 6, 20),
(2272, '2016-03-20', 2016, 1, 3, 12, 0, 21),
(2273, '2016-03-21', 2016, 1, 3, 12, 1, 22),
(2274, '2016-03-22', 2016, 1, 3, 12, 2, 23),
(2275, '2016-03-23', 2016, 1, 3, 12, 3, 24),
(2276, '2016-03-24', 2016, 1, 3, 12, 4, 25),
(2277, '2016-03-25', 2016, 1, 3, 12, 5, 26),
(2278, '2016-03-26', 2016, 1, 3, 13, 6, 27),
(2279, '2016-03-27', 2016, 1, 3, 13, 0, 28),
(2280, '2016-03-28', 2016, 1, 3, 13, 1, 29),
(2281, '2016-03-29', 2016, 1, 3, 13, 2, 30),
(2282, '2016-03-30', 2016, 1, 3, 13, 3, 31),
(2283, '2016-03-31', 2016, 2, 4, 13, 4, 1),
(2284, '2016-04-01', 2016, 2, 4, 13, 5, 2),
(2285, '2016-04-02', 2016, 2, 4, 14, 6, 3),
(2286, '2016-04-03', 2016, 2, 4, 14, 0, 4),
(2287, '2016-04-04', 2016, 2, 4, 14, 1, 5),
(2288, '2016-04-05', 2016, 2, 4, 14, 2, 6),
(2289, '2016-04-06', 2016, 2, 4, 14, 3, 7),
(2290, '2016-04-07', 2016, 2, 4, 14, 4, 8),
(2291, '2016-04-08', 2016, 2, 4, 14, 5, 9),
(2292, '2016-04-09', 2016, 2, 4, 15, 6, 10),
(2293, '2016-04-10', 2016, 2, 4, 15, 0, 11),
(2294, '2016-04-11', 2016, 2, 4, 15, 1, 12),
(2295, '2016-04-12', 2016, 2, 4, 15, 2, 13),
(2296, '2016-04-13', 2016, 2, 4, 15, 3, 14),
(2297, '2016-04-14', 2016, 2, 4, 15, 4, 15),
(2298, '2016-04-15', 2016, 2, 4, 15, 5, 16),
(2299, '2016-04-16', 2016, 2, 4, 16, 6, 17),
(2300, '2016-04-17', 2016, 2, 4, 16, 0, 18),
(2301, '2016-04-18', 2016, 2, 4, 16, 1, 19),
(2302, '2016-04-19', 2016, 2, 4, 16, 2, 20),
(2303, '2016-04-20', 2016, 2, 4, 16, 3, 21),
(2304, '2016-04-21', 2016, 2, 4, 16, 4, 22),
(2305, '2016-04-22', 2016, 2, 4, 16, 5, 23),
(2306, '2016-04-23', 2016, 2, 4, 17, 6, 24),
(2307, '2016-04-24', 2016, 2, 4, 17, 0, 25),
(2308, '2016-04-25', 2016, 2, 4, 17, 1, 26),
(2309, '2016-04-26', 2016, 2, 4, 17, 2, 27),
(2310, '2016-04-27', 2016, 2, 4, 17, 3, 28),
(2311, '2016-04-28', 2016, 2, 4, 17, 4, 29),
(2312, '2016-04-29', 2016, 2, 4, 17, 5, 30),
(2313, '2016-04-30', 2016, 2, 5, 18, 6, 1),
(2314, '2016-05-01', 2016, 2, 5, 18, 0, 2),
(2315, '2016-05-02', 2016, 2, 5, 18, 1, 3),
(2316, '2016-05-03', 2016, 2, 5, 18, 2, 4),
(2317, '2016-05-04', 2016, 2, 5, 18, 3, 5),
(2318, '2016-05-05', 2016, 2, 5, 18, 4, 6),
(2319, '2016-05-06', 2016, 2, 5, 18, 5, 7),
(2320, '2016-05-07', 2016, 2, 5, 19, 6, 8),
(2321, '2016-05-08', 2016, 2, 5, 19, 0, 9),
(2322, '2016-05-09', 2016, 2, 5, 19, 1, 10),
(2323, '2016-05-10', 2016, 2, 5, 19, 2, 11),
(2324, '2016-05-11', 2016, 2, 5, 19, 3, 12),
(2325, '2016-05-12', 2016, 2, 5, 19, 4, 13),
(2326, '2016-05-13', 2016, 2, 5, 19, 5, 14),
(2327, '2016-05-14', 2016, 2, 5, 20, 6, 15),
(2328, '2016-05-15', 2016, 2, 5, 20, 0, 16),
(2329, '2016-05-16', 2016, 2, 5, 20, 1, 17),
(2330, '2016-05-17', 2016, 2, 5, 20, 2, 18),
(2331, '2016-05-18', 2016, 2, 5, 20, 3, 19),
(2332, '2016-05-19', 2016, 2, 5, 20, 4, 20),
(2333, '2016-05-20', 2016, 2, 5, 20, 5, 21),
(2334, '2016-05-21', 2016, 2, 5, 21, 6, 22),
(2335, '2016-05-22', 2016, 2, 5, 21, 0, 23),
(2336, '2016-05-23', 2016, 2, 5, 21, 1, 24),
(2337, '2016-05-24', 2016, 2, 5, 21, 2, 25),
(2338, '2016-05-25', 2016, 2, 5, 21, 3, 26),
(2339, '2016-05-26', 2016, 2, 5, 21, 4, 27),
(2340, '2016-05-27', 2016, 2, 5, 21, 5, 28),
(2341, '2016-05-28', 2016, 2, 5, 22, 6, 29),
(2342, '2016-05-29', 2016, 2, 5, 22, 0, 30),
(2343, '2016-05-30', 2016, 2, 5, 22, 1, 31),
(2344, '2016-05-31', 2016, 2, 6, 22, 2, 1),
(2345, '2016-06-01', 2016, 2, 6, 22, 3, 2),
(2346, '2016-06-02', 2016, 2, 6, 22, 4, 3),
(2347, '2016-06-03', 2016, 2, 6, 22, 5, 4),
(2348, '2016-06-04', 2016, 2, 6, 23, 6, 5),
(2349, '2016-06-05', 2016, 2, 6, 23, 0, 6),
(2350, '2016-06-06', 2016, 2, 6, 23, 1, 7),
(2351, '2016-06-07', 2016, 2, 6, 23, 2, 8),
(2352, '2016-06-08', 2016, 2, 6, 23, 3, 9),
(2353, '2016-06-09', 2016, 2, 6, 23, 4, 10),
(2354, '2016-06-10', 2016, 2, 6, 23, 5, 11),
(2355, '2016-06-11', 2016, 2, 6, 24, 6, 12),
(2356, '2016-06-12', 2016, 2, 6, 24, 0, 13),
(2357, '2016-06-13', 2016, 2, 6, 24, 1, 14),
(2358, '2016-06-14', 2016, 2, 6, 24, 2, 15),
(2359, '2016-06-15', 2016, 2, 6, 24, 3, 16),
(2360, '2016-06-16', 2016, 2, 6, 24, 4, 17),
(2361, '2016-06-17', 2016, 2, 6, 24, 5, 18),
(2362, '2016-06-18', 2016, 2, 6, 25, 6, 19),
(2363, '2016-06-19', 2016, 2, 6, 25, 0, 20),
(2364, '2016-06-20', 2016, 2, 6, 25, 1, 21),
(2365, '2016-06-21', 2016, 2, 6, 25, 2, 22),
(2366, '2016-06-22', 2016, 2, 6, 25, 3, 23),
(2367, '2016-06-23', 2016, 2, 6, 25, 4, 24),
(2368, '2016-06-24', 2016, 2, 6, 25, 5, 25),
(2369, '2016-06-25', 2016, 2, 6, 26, 6, 26),
(2370, '2016-06-26', 2016, 2, 6, 26, 0, 27),
(2371, '2016-06-27', 2016, 2, 6, 26, 1, 28),
(2372, '2016-06-28', 2016, 2, 6, 26, 2, 29),
(2373, '2016-06-29', 2016, 2, 6, 26, 3, 30),
(2374, '2016-06-30', 2016, 3, 7, 26, 4, 1),
(2375, '2016-07-01', 2016, 3, 7, 26, 5, 2),
(2376, '2016-07-02', 2016, 3, 7, 27, 6, 3),
(2377, '2016-07-03', 2016, 3, 7, 27, 0, 4),
(2378, '2016-07-04', 2016, 3, 7, 27, 1, 5),
(2379, '2016-07-05', 2016, 3, 7, 27, 2, 6),
(2380, '2016-07-06', 2016, 3, 7, 27, 3, 7),
(2381, '2016-07-07', 2016, 3, 7, 27, 4, 8),
(2382, '2016-07-08', 2016, 3, 7, 27, 5, 9),
(2383, '2016-07-09', 2016, 3, 7, 28, 6, 10),
(2384, '2016-07-10', 2016, 3, 7, 28, 0, 11),
(2385, '2016-07-11', 2016, 3, 7, 28, 1, 12),
(2386, '2016-07-12', 2016, 3, 7, 28, 2, 13),
(2387, '2016-07-13', 2016, 3, 7, 28, 3, 14),
(2388, '2016-07-14', 2016, 3, 7, 28, 4, 15),
(2389, '2016-07-15', 2016, 3, 7, 28, 5, 16),
(2390, '2016-07-16', 2016, 3, 7, 29, 6, 17),
(2391, '2016-07-17', 2016, 3, 7, 29, 0, 18),
(2392, '2016-07-18', 2016, 3, 7, 29, 1, 19),
(2393, '2016-07-19', 2016, 3, 7, 29, 2, 20),
(2394, '2016-07-20', 2016, 3, 7, 29, 3, 21),
(2395, '2016-07-21', 2016, 3, 7, 29, 4, 22),
(2396, '2016-07-22', 2016, 3, 7, 29, 5, 23),
(2397, '2016-07-23', 2016, 3, 7, 30, 6, 24),
(2398, '2016-07-24', 2016, 3, 7, 30, 0, 25),
(2399, '2016-07-25', 2016, 3, 7, 30, 1, 26),
(2400, '2016-07-26', 2016, 3, 7, 30, 2, 27),
(2401, '2016-07-27', 2016, 3, 7, 30, 3, 28),
(2402, '2016-07-28', 2016, 3, 7, 30, 4, 29),
(2403, '2016-07-29', 2016, 3, 7, 30, 5, 30),
(2404, '2016-07-30', 2016, 3, 7, 31, 6, 31),
(2405, '2016-07-31', 2016, 3, 8, 31, 0, 1),
(2406, '2016-08-01', 2016, 3, 8, 31, 1, 2),
(2407, '2016-08-02', 2016, 3, 8, 31, 2, 3),
(2408, '2016-08-03', 2016, 3, 8, 31, 3, 4),
(2409, '2016-08-04', 2016, 3, 8, 31, 4, 5),
(2410, '2016-08-05', 2016, 3, 8, 31, 5, 6),
(2411, '2016-08-06', 2016, 3, 8, 32, 6, 7),
(2412, '2016-08-07', 2016, 3, 8, 32, 0, 8),
(2413, '2016-08-08', 2016, 3, 8, 32, 1, 9),
(2414, '2016-08-09', 2016, 3, 8, 32, 2, 10),
(2415, '2016-08-10', 2016, 3, 8, 32, 3, 11),
(2416, '2016-08-11', 2016, 3, 8, 32, 4, 12),
(2417, '2016-08-12', 2016, 3, 8, 32, 5, 13),
(2418, '2016-08-13', 2016, 3, 8, 33, 6, 14),
(2419, '2016-08-14', 2016, 3, 8, 33, 0, 15),
(2420, '2016-08-15', 2016, 3, 8, 33, 1, 16),
(2421, '2016-08-16', 2016, 3, 8, 33, 2, 17),
(2422, '2016-08-17', 2016, 3, 8, 33, 3, 18),
(2423, '2016-08-18', 2016, 3, 8, 33, 4, 19),
(2424, '2016-08-19', 2016, 3, 8, 33, 5, 20),
(2425, '2016-08-20', 2016, 3, 8, 34, 6, 21),
(2426, '2016-08-21', 2016, 3, 8, 34, 0, 22),
(2427, '2016-08-22', 2016, 3, 8, 34, 1, 23),
(2428, '2016-08-23', 2016, 3, 8, 34, 2, 24),
(2429, '2016-08-24', 2016, 3, 8, 34, 3, 25),
(2430, '2016-08-25', 2016, 3, 8, 34, 4, 26),
(2431, '2016-08-26', 2016, 3, 8, 34, 5, 27),
(2432, '2016-08-27', 2016, 3, 8, 35, 6, 28),
(2433, '2016-08-28', 2016, 3, 8, 35, 0, 29),
(2434, '2016-08-29', 2016, 3, 8, 35, 1, 30),
(2435, '2016-08-30', 2016, 3, 8, 35, 2, 31),
(2436, '2016-08-31', 2016, 3, 9, 35, 3, 1),
(2437, '2016-09-01', 2016, 3, 9, 35, 4, 2),
(2438, '2016-09-02', 2016, 3, 9, 35, 5, 3),
(2439, '2016-09-03', 2016, 3, 9, 36, 6, 4),
(2440, '2016-09-04', 2016, 3, 9, 36, 0, 5),
(2441, '2016-09-05', 2016, 3, 9, 36, 1, 6),
(2442, '2016-09-06', 2016, 3, 9, 36, 2, 7),
(2443, '2016-09-07', 2016, 3, 9, 36, 3, 8),
(2444, '2016-09-08', 2016, 3, 9, 36, 4, 9),
(2445, '2016-09-09', 2016, 3, 9, 36, 5, 10),
(2446, '2016-09-10', 2016, 3, 9, 37, 6, 11),
(2447, '2016-09-11', 2016, 3, 9, 37, 0, 12),
(2448, '2016-09-12', 2016, 3, 9, 37, 1, 13),
(2449, '2016-09-13', 2016, 3, 9, 37, 2, 14),
(2450, '2016-09-14', 2016, 3, 9, 37, 3, 15),
(2451, '2016-09-15', 2016, 3, 9, 37, 4, 16),
(2452, '2016-09-16', 2016, 3, 9, 37, 5, 17),
(2453, '2016-09-17', 2016, 3, 9, 38, 6, 18),
(2454, '2016-09-18', 2016, 3, 9, 38, 0, 19),
(2455, '2016-09-19', 2016, 3, 9, 38, 1, 20),
(2456, '2016-09-20', 2016, 3, 9, 38, 2, 21),
(2457, '2016-09-21', 2016, 3, 9, 38, 3, 22),
(2458, '2016-09-22', 2016, 3, 9, 38, 4, 23),
(2459, '2016-09-23', 2016, 3, 9, 38, 5, 24),
(2460, '2016-09-24', 2016, 3, 9, 39, 6, 25),
(2461, '2016-09-25', 2016, 3, 9, 39, 0, 26),
(2462, '2016-09-26', 2016, 3, 9, 39, 1, 27),
(2463, '2016-09-27', 2016, 3, 9, 39, 2, 28),
(2464, '2016-09-28', 2016, 3, 9, 39, 3, 29),
(2465, '2016-09-29', 2016, 3, 9, 39, 4, 30),
(2466, '2016-09-30', 2016, 4, 10, 39, 5, 1),
(2467, '2016-10-01', 2016, 4, 10, 40, 6, 2),
(2468, '2016-10-02', 2016, 4, 10, 40, 0, 3),
(2469, '2016-10-03', 2016, 4, 10, 40, 1, 4),
(2470, '2016-10-04', 2016, 4, 10, 40, 2, 5),
(2471, '2016-10-05', 2016, 4, 10, 40, 3, 6),
(2472, '2016-10-06', 2016, 4, 10, 40, 4, 7),
(2473, '2016-10-07', 2016, 4, 10, 40, 5, 8),
(2474, '2016-10-08', 2016, 4, 10, 41, 6, 9),
(2475, '2016-10-09', 2016, 4, 10, 41, 0, 10),
(2476, '2016-10-10', 2016, 4, 10, 41, 1, 11),
(2477, '2016-10-11', 2016, 4, 10, 41, 2, 12),
(2478, '2016-10-12', 2016, 4, 10, 41, 3, 13),
(2479, '2016-10-13', 2016, 4, 10, 41, 4, 14),
(2480, '2016-10-14', 2016, 4, 10, 41, 5, 15),
(2481, '2016-10-15', 2016, 4, 10, 42, 6, 16),
(2482, '2016-10-16', 2016, 4, 10, 42, 0, 17),
(2483, '2016-10-17', 2016, 4, 10, 42, 1, 18),
(2484, '2016-10-18', 2016, 4, 10, 42, 2, 19),
(2485, '2016-10-19', 2016, 4, 10, 42, 3, 20),
(2486, '2016-10-20', 2016, 4, 10, 42, 4, 21),
(2487, '2016-10-21', 2016, 4, 10, 42, 5, 22),
(2488, '2016-10-22', 2016, 4, 10, 43, 6, 23),
(2489, '2016-10-23', 2016, 4, 10, 43, 0, 24),
(2490, '2016-10-24', 2016, 4, 10, 43, 1, 25),
(2491, '2016-10-25', 2016, 4, 10, 43, 2, 26),
(2492, '2016-10-26', 2016, 4, 10, 43, 3, 27),
(2493, '2016-10-27', 2016, 4, 10, 43, 4, 28),
(2494, '2016-10-28', 2016, 4, 10, 43, 5, 29),
(2495, '2016-10-29', 2016, 4, 10, 44, 6, 30),
(2496, '2016-10-30', 2016, 4, 10, 44, 0, 31),
(2497, '2016-10-31', 2016, 4, 11, 44, 1, 1),
(2498, '2016-11-01', 2016, 4, 11, 44, 2, 2),
(2499, '2016-11-02', 2016, 4, 11, 44, 3, 3),
(2500, '2016-11-03', 2016, 4, 11, 44, 4, 4),
(2501, '2016-11-04', 2016, 4, 11, 44, 5, 5),
(2502, '2016-11-05', 2016, 4, 11, 45, 6, 6),
(2503, '2016-11-06', 2016, 4, 11, 45, 0, 7),
(2504, '2016-11-07', 2016, 4, 11, 45, 1, 8),
(2505, '2016-11-08', 2016, 4, 11, 45, 2, 9),
(2506, '2016-11-09', 2016, 4, 11, 45, 3, 10),
(2507, '2016-11-10', 2016, 4, 11, 45, 4, 11),
(2508, '2016-11-11', 2016, 4, 11, 45, 5, 12),
(2509, '2016-11-12', 2016, 4, 11, 46, 6, 13),
(2510, '2016-11-13', 2016, 4, 11, 46, 0, 14),
(2511, '2016-11-14', 2016, 4, 11, 46, 1, 15),
(2512, '2016-11-15', 2016, 4, 11, 46, 2, 16),
(2513, '2016-11-16', 2016, 4, 11, 46, 3, 17),
(2514, '2016-11-17', 2016, 4, 11, 46, 4, 18),
(2515, '2016-11-18', 2016, 4, 11, 46, 5, 19),
(2516, '2016-11-19', 2016, 4, 11, 47, 6, 20),
(2517, '2016-11-20', 2016, 4, 11, 47, 0, 21),
(2518, '2016-11-21', 2016, 4, 11, 47, 1, 22),
(2519, '2016-11-22', 2016, 4, 11, 47, 2, 23),
(2520, '2016-11-23', 2016, 4, 11, 47, 3, 24),
(2521, '2016-11-24', 2016, 4, 11, 47, 4, 25),
(2522, '2016-11-25', 2016, 4, 11, 47, 5, 26),
(2523, '2016-11-26', 2016, 4, 11, 48, 6, 27),
(2524, '2016-11-27', 2016, 4, 11, 48, 0, 28),
(2525, '2016-11-28', 2016, 4, 11, 48, 1, 29),
(2526, '2016-11-29', 2016, 4, 11, 48, 2, 30),
(2527, '2016-11-30', 2016, 4, 12, 48, 3, 1),
(2528, '2016-12-01', 2016, 4, 12, 48, 4, 2),
(2529, '2016-12-02', 2016, 4, 12, 48, 5, 3),
(2530, '2016-12-03', 2016, 4, 12, 49, 6, 4),
(2531, '2016-12-04', 2016, 4, 12, 49, 0, 5),
(2532, '2016-12-05', 2016, 4, 12, 49, 1, 6),
(2533, '2016-12-06', 2016, 4, 12, 49, 2, 7),
(2534, '2016-12-07', 2016, 4, 12, 49, 3, 8),
(2535, '2016-12-08', 2016, 4, 12, 49, 4, 9),
(2536, '2016-12-09', 2016, 4, 12, 49, 5, 10),
(2537, '2016-12-10', 2016, 4, 12, 50, 6, 11),
(2538, '2016-12-11', 2016, 4, 12, 50, 0, 12),
(2539, '2016-12-12', 2016, 4, 12, 50, 1, 13),
(2540, '2016-12-13', 2016, 4, 12, 50, 2, 14),
(2541, '2016-12-14', 2016, 4, 12, 50, 3, 15),
(2542, '2016-12-15', 2016, 4, 12, 50, 4, 16),
(2543, '2016-12-16', 2016, 4, 12, 50, 5, 17),
(2544, '2016-12-17', 2016, 4, 12, 51, 6, 18),
(2545, '2016-12-18', 2016, 4, 12, 51, 0, 19),
(2546, '2016-12-19', 2016, 4, 12, 51, 1, 20),
(2547, '2016-12-20', 2016, 4, 12, 51, 2, 21),
(2548, '2016-12-21', 2016, 4, 12, 51, 3, 22),
(2549, '2016-12-22', 2016, 4, 12, 51, 4, 23),
(2550, '2016-12-23', 2016, 4, 12, 51, 5, 24),
(2551, '2016-12-24', 2016, 4, 12, 52, 6, 25),
(2552, '2016-12-25', 2016, 4, 12, 52, 0, 26),
(2553, '2016-12-26', 2016, 4, 12, 52, 1, 27),
(2554, '2016-12-27', 2016, 4, 12, 52, 2, 28),
(2555, '2016-12-28', 2016, 4, 12, 52, 3, 29),
(2556, '2016-12-29', 2016, 4, 12, 52, 4, 30),
(2557, '2016-12-30', 2016, 4, 12, 52, 5, 31),
(2558, '2016-12-31', 2017, 1, 1, 1, 6, 1),
(2559, '2017-01-01', 2017, 1, 1, 1, 0, 2),
(2560, '2017-01-02', 2017, 1, 1, 1, 1, 3),
(2561, '2017-01-03', 2017, 1, 1, 1, 2, 4),
(2562, '2017-01-04', 2017, 1, 1, 1, 3, 5),
(2563, '2017-01-05', 2017, 1, 1, 1, 4, 6),
(2564, '2017-01-06', 2017, 1, 1, 1, 5, 7),
(2565, '2017-01-07', 2017, 1, 1, 2, 6, 8),
(2566, '2017-01-08', 2017, 1, 1, 2, 0, 9),
(2567, '2017-01-09', 2017, 1, 1, 2, 1, 10),
(2568, '2017-01-10', 2017, 1, 1, 2, 2, 11),
(2569, '2017-01-11', 2017, 1, 1, 2, 3, 12),
(2570, '2017-01-12', 2017, 1, 1, 2, 4, 13),
(2571, '2017-01-13', 2017, 1, 1, 2, 5, 14),
(2572, '2017-01-14', 2017, 1, 1, 3, 6, 15),
(2573, '2017-01-15', 2017, 1, 1, 3, 0, 16),
(2574, '2017-01-16', 2017, 1, 1, 3, 1, 17),
(2575, '2017-01-17', 2017, 1, 1, 3, 2, 18),
(2576, '2017-01-18', 2017, 1, 1, 3, 3, 19),
(2577, '2017-01-19', 2017, 1, 1, 3, 4, 20),
(2578, '2017-01-20', 2017, 1, 1, 3, 5, 21),
(2579, '2017-01-21', 2017, 1, 1, 4, 6, 22),
(2580, '2017-01-22', 2017, 1, 1, 4, 0, 23),
(2581, '2017-01-23', 2017, 1, 1, 4, 1, 24),
(2582, '2017-01-24', 2017, 1, 1, 4, 2, 25),
(2583, '2017-01-25', 2017, 1, 1, 4, 3, 26),
(2584, '2017-01-26', 2017, 1, 1, 4, 4, 27),
(2585, '2017-01-27', 2017, 1, 1, 4, 5, 28),
(2586, '2017-01-28', 2017, 1, 1, 5, 6, 29),
(2587, '2017-01-29', 2017, 1, 1, 5, 0, 30),
(2588, '2017-01-30', 2017, 1, 1, 5, 1, 31),
(2589, '2017-01-31', 2017, 1, 2, 5, 2, 1),
(2590, '2017-02-01', 2017, 1, 2, 5, 3, 2),
(2591, '2017-02-02', 2017, 1, 2, 5, 4, 3),
(2592, '2017-02-03', 2017, 1, 2, 5, 5, 4),
(2593, '2017-02-04', 2017, 1, 2, 6, 6, 5),
(2594, '2017-02-05', 2017, 1, 2, 6, 0, 6),
(2595, '2017-02-06', 2017, 1, 2, 6, 1, 7),
(2596, '2017-02-07', 2017, 1, 2, 6, 2, 8),
(2597, '2017-02-08', 2017, 1, 2, 6, 3, 9),
(2598, '2017-02-09', 2017, 1, 2, 6, 4, 10),
(2599, '2017-02-10', 2017, 1, 2, 6, 5, 11),
(2600, '2017-02-11', 2017, 1, 2, 7, 6, 12),
(2601, '2017-02-12', 2017, 1, 2, 7, 0, 13),
(2602, '2017-02-13', 2017, 1, 2, 7, 1, 14),
(2603, '2017-02-14', 2017, 1, 2, 7, 2, 15),
(2604, '2017-02-15', 2017, 1, 2, 7, 3, 16),
(2605, '2017-02-16', 2017, 1, 2, 7, 4, 17),
(2606, '2017-02-17', 2017, 1, 2, 7, 5, 18),
(2607, '2017-02-18', 2017, 1, 2, 8, 6, 19),
(2608, '2017-02-19', 2017, 1, 2, 8, 0, 20),
(2609, '2017-02-20', 2017, 1, 2, 8, 1, 21),
(2610, '2017-02-21', 2017, 1, 2, 8, 2, 22),
(2611, '2017-02-22', 2017, 1, 2, 8, 3, 23),
(2612, '2017-02-23', 2017, 1, 2, 8, 4, 24),
(2613, '2017-02-24', 2017, 1, 2, 8, 5, 25),
(2614, '2017-02-25', 2017, 1, 2, 9, 6, 26),
(2615, '2017-02-26', 2017, 1, 2, 9, 0, 27),
(2616, '2017-02-27', 2017, 1, 2, 9, 1, 28),
(2617, '2017-02-28', 2017, 1, 3, 9, 2, 1),
(2618, '2017-03-01', 2017, 1, 3, 9, 3, 2),
(2619, '2017-03-02', 2017, 1, 3, 9, 4, 3),
(2620, '2017-03-03', 2017, 1, 3, 9, 5, 4),
(2621, '2017-03-04', 2017, 1, 3, 10, 6, 5),
(2622, '2017-03-05', 2017, 1, 3, 10, 0, 6),
(2623, '2017-03-06', 2017, 1, 3, 10, 1, 7),
(2624, '2017-03-07', 2017, 1, 3, 10, 2, 8),
(2625, '2017-03-08', 2017, 1, 3, 10, 3, 9),
(2626, '2017-03-09', 2017, 1, 3, 10, 4, 10),
(2627, '2017-03-10', 2017, 1, 3, 10, 5, 11),
(2628, '2017-03-11', 2017, 1, 3, 11, 6, 12),
(2629, '2017-03-12', 2017, 1, 3, 11, 0, 13),
(2630, '2017-03-13', 2017, 1, 3, 11, 1, 14),
(2631, '2017-03-14', 2017, 1, 3, 11, 2, 15),
(2632, '2017-03-15', 2017, 1, 3, 11, 3, 16),
(2633, '2017-03-16', 2017, 1, 3, 11, 4, 17),
(2634, '2017-03-17', 2017, 1, 3, 11, 5, 18),
(2635, '2017-03-18', 2017, 1, 3, 12, 6, 19),
(2636, '2017-03-19', 2017, 1, 3, 12, 0, 20),
(2637, '2017-03-20', 2017, 1, 3, 12, 1, 21),
(2638, '2017-03-21', 2017, 1, 3, 12, 2, 22),
(2639, '2017-03-22', 2017, 1, 3, 12, 3, 23),
(2640, '2017-03-23', 2017, 1, 3, 12, 4, 24),
(2641, '2017-03-24', 2017, 1, 3, 12, 5, 25),
(2642, '2017-03-25', 2017, 1, 3, 13, 6, 26),
(2643, '2017-03-26', 2017, 1, 3, 13, 0, 27),
(2644, '2017-03-27', 2017, 1, 3, 13, 1, 28),
(2645, '2017-03-28', 2017, 1, 3, 13, 2, 29),
(2646, '2017-03-29', 2017, 1, 3, 13, 3, 30),
(2647, '2017-03-30', 2017, 1, 3, 13, 4, 31),
(2648, '2017-03-31', 2017, 2, 4, 13, 5, 1),
(2649, '2017-04-01', 2017, 2, 4, 14, 6, 2),
(2650, '2017-04-02', 2017, 2, 4, 14, 0, 3),
(2651, '2017-04-03', 2017, 2, 4, 14, 1, 4),
(2652, '2017-04-04', 2017, 2, 4, 14, 2, 5),
(2653, '2017-04-05', 2017, 2, 4, 14, 3, 6),
(2654, '2017-04-06', 2017, 2, 4, 14, 4, 7),
(2655, '2017-04-07', 2017, 2, 4, 14, 5, 8),
(2656, '2017-04-08', 2017, 2, 4, 15, 6, 9),
(2657, '2017-04-09', 2017, 2, 4, 15, 0, 10),
(2658, '2017-04-10', 2017, 2, 4, 15, 1, 11),
(2659, '2017-04-11', 2017, 2, 4, 15, 2, 12),
(2660, '2017-04-12', 2017, 2, 4, 15, 3, 13),
(2661, '2017-04-13', 2017, 2, 4, 15, 4, 14),
(2662, '2017-04-14', 2017, 2, 4, 15, 5, 15),
(2663, '2017-04-15', 2017, 2, 4, 16, 6, 16),
(2664, '2017-04-16', 2017, 2, 4, 16, 0, 17),
(2665, '2017-04-17', 2017, 2, 4, 16, 1, 18),
(2666, '2017-04-18', 2017, 2, 4, 16, 2, 19),
(2667, '2017-04-19', 2017, 2, 4, 16, 3, 20),
(2668, '2017-04-20', 2017, 2, 4, 16, 4, 21),
(2669, '2017-04-21', 2017, 2, 4, 16, 5, 22),
(2670, '2017-04-22', 2017, 2, 4, 17, 6, 23),
(2671, '2017-04-23', 2017, 2, 4, 17, 0, 24),
(2672, '2017-04-24', 2017, 2, 4, 17, 1, 25),
(2673, '2017-04-25', 2017, 2, 4, 17, 2, 26),
(2674, '2017-04-26', 2017, 2, 4, 17, 3, 27),
(2675, '2017-04-27', 2017, 2, 4, 17, 4, 28),
(2676, '2017-04-28', 2017, 2, 4, 17, 5, 29),
(2677, '2017-04-29', 2017, 2, 4, 18, 6, 30),
(2678, '2017-04-30', 2017, 2, 5, 18, 0, 1),
(2679, '2017-05-01', 2017, 2, 5, 18, 1, 2),
(2680, '2017-05-02', 2017, 2, 5, 18, 2, 3),
(2681, '2017-05-03', 2017, 2, 5, 18, 3, 4),
(2682, '2017-05-04', 2017, 2, 5, 18, 4, 5),
(2683, '2017-05-05', 2017, 2, 5, 18, 5, 6),
(2684, '2017-05-06', 2017, 2, 5, 19, 6, 7),
(2685, '2017-05-07', 2017, 2, 5, 19, 0, 8),
(2686, '2017-05-08', 2017, 2, 5, 19, 1, 9),
(2687, '2017-05-09', 2017, 2, 5, 19, 2, 10),
(2688, '2017-05-10', 2017, 2, 5, 19, 3, 11),
(2689, '2017-05-11', 2017, 2, 5, 19, 4, 12),
(2690, '2017-05-12', 2017, 2, 5, 19, 5, 13),
(2691, '2017-05-13', 2017, 2, 5, 20, 6, 14),
(2692, '2017-05-14', 2017, 2, 5, 20, 0, 15),
(2693, '2017-05-15', 2017, 2, 5, 20, 1, 16),
(2694, '2017-05-16', 2017, 2, 5, 20, 2, 17),
(2695, '2017-05-17', 2017, 2, 5, 20, 3, 18),
(2696, '2017-05-18', 2017, 2, 5, 20, 4, 19),
(2697, '2017-05-19', 2017, 2, 5, 20, 5, 20),
(2698, '2017-05-20', 2017, 2, 5, 21, 6, 21),
(2699, '2017-05-21', 2017, 2, 5, 21, 0, 22),
(2700, '2017-05-22', 2017, 2, 5, 21, 1, 23),
(2701, '2017-05-23', 2017, 2, 5, 21, 2, 24),
(2702, '2017-05-24', 2017, 2, 5, 21, 3, 25),
(2703, '2017-05-25', 2017, 2, 5, 21, 4, 26),
(2704, '2017-05-26', 2017, 2, 5, 21, 5, 27),
(2705, '2017-05-27', 2017, 2, 5, 22, 6, 28),
(2706, '2017-05-28', 2017, 2, 5, 22, 0, 29),
(2707, '2017-05-29', 2017, 2, 5, 22, 1, 30),
(2708, '2017-05-30', 2017, 2, 5, 22, 2, 31),
(2709, '2017-05-31', 2017, 2, 6, 22, 3, 1),
(2710, '2017-06-01', 2017, 2, 6, 22, 4, 2),
(2711, '2017-06-02', 2017, 2, 6, 22, 5, 3),
(2712, '2017-06-03', 2017, 2, 6, 23, 6, 4),
(2713, '2017-06-04', 2017, 2, 6, 23, 0, 5),
(2714, '2017-06-05', 2017, 2, 6, 23, 1, 6),
(2715, '2017-06-06', 2017, 2, 6, 23, 2, 7),
(2716, '2017-06-07', 2017, 2, 6, 23, 3, 8),
(2717, '2017-06-08', 2017, 2, 6, 23, 4, 9),
(2718, '2017-06-09', 2017, 2, 6, 23, 5, 10),
(2719, '2017-06-10', 2017, 2, 6, 24, 6, 11),
(2720, '2017-06-11', 2017, 2, 6, 24, 0, 12),
(2721, '2017-06-12', 2017, 2, 6, 24, 1, 13),
(2722, '2017-06-13', 2017, 2, 6, 24, 2, 14),
(2723, '2017-06-14', 2017, 2, 6, 24, 3, 15),
(2724, '2017-06-15', 2017, 2, 6, 24, 4, 16),
(2725, '2017-06-16', 2017, 2, 6, 24, 5, 17),
(2726, '2017-06-17', 2017, 2, 6, 25, 6, 18),
(2727, '2017-06-18', 2017, 2, 6, 25, 0, 19),
(2728, '2017-06-19', 2017, 2, 6, 25, 1, 20),
(2729, '2017-06-20', 2017, 2, 6, 25, 2, 21),
(2730, '2017-06-21', 2017, 2, 6, 25, 3, 22),
(2731, '2017-06-22', 2017, 2, 6, 25, 4, 23),
(2732, '2017-06-23', 2017, 2, 6, 25, 5, 24),
(2733, '2017-06-24', 2017, 2, 6, 26, 6, 25),
(2734, '2017-06-25', 2017, 2, 6, 26, 0, 26),
(2735, '2017-06-26', 2017, 2, 6, 26, 1, 27),
(2736, '2017-06-27', 2017, 2, 6, 26, 2, 28),
(2737, '2017-06-28', 2017, 2, 6, 26, 3, 29),
(2738, '2017-06-29', 2017, 2, 6, 26, 4, 30),
(2739, '2017-06-30', 2017, 3, 7, 26, 5, 1),
(2740, '2017-07-01', 2017, 3, 7, 27, 6, 2),
(2741, '2017-07-02', 2017, 3, 7, 27, 0, 3),
(2742, '2017-07-03', 2017, 3, 7, 27, 1, 4),
(2743, '2017-07-04', 2017, 3, 7, 27, 2, 5),
(2744, '2017-07-05', 2017, 3, 7, 27, 3, 6),
(2745, '2017-07-06', 2017, 3, 7, 27, 4, 7),
(2746, '2017-07-07', 2017, 3, 7, 27, 5, 8),
(2747, '2017-07-08', 2017, 3, 7, 28, 6, 9),
(2748, '2017-07-09', 2017, 3, 7, 28, 0, 10),
(2749, '2017-07-10', 2017, 3, 7, 28, 1, 11),
(2750, '2017-07-11', 2017, 3, 7, 28, 2, 12),
(2751, '2017-07-12', 2017, 3, 7, 28, 3, 13),
(2752, '2017-07-13', 2017, 3, 7, 28, 4, 14),
(2753, '2017-07-14', 2017, 3, 7, 28, 5, 15),
(2754, '2017-07-15', 2017, 3, 7, 29, 6, 16),
(2755, '2017-07-16', 2017, 3, 7, 29, 0, 17),
(2756, '2017-07-17', 2017, 3, 7, 29, 1, 18),
(2757, '2017-07-18', 2017, 3, 7, 29, 2, 19),
(2758, '2017-07-19', 2017, 3, 7, 29, 3, 20),
(2759, '2017-07-20', 2017, 3, 7, 29, 4, 21),
(2760, '2017-07-21', 2017, 3, 7, 29, 5, 22),
(2761, '2017-07-22', 2017, 3, 7, 30, 6, 23),
(2762, '2017-07-23', 2017, 3, 7, 30, 0, 24),
(2763, '2017-07-24', 2017, 3, 7, 30, 1, 25),
(2764, '2017-07-25', 2017, 3, 7, 30, 2, 26),
(2765, '2017-07-26', 2017, 3, 7, 30, 3, 27),
(2766, '2017-07-27', 2017, 3, 7, 30, 4, 28),
(2767, '2017-07-28', 2017, 3, 7, 30, 5, 29),
(2768, '2017-07-29', 2017, 3, 7, 31, 6, 30),
(2769, '2017-07-30', 2017, 3, 7, 31, 0, 31),
(2770, '2017-07-31', 2017, 3, 8, 31, 1, 1),
(2771, '2017-08-01', 2017, 3, 8, 31, 2, 2),
(2772, '2017-08-02', 2017, 3, 8, 31, 3, 3),
(2773, '2017-08-03', 2017, 3, 8, 31, 4, 4),
(2774, '2017-08-04', 2017, 3, 8, 31, 5, 5),
(2775, '2017-08-05', 2017, 3, 8, 32, 6, 6),
(2776, '2017-08-06', 2017, 3, 8, 32, 0, 7),
(2777, '2017-08-07', 2017, 3, 8, 32, 1, 8),
(2778, '2017-08-08', 2017, 3, 8, 32, 2, 9),
(2779, '2017-08-09', 2017, 3, 8, 32, 3, 10),
(2780, '2017-08-10', 2017, 3, 8, 32, 4, 11),
(2781, '2017-08-11', 2017, 3, 8, 32, 5, 12),
(2782, '2017-08-12', 2017, 3, 8, 33, 6, 13),
(2783, '2017-08-13', 2017, 3, 8, 33, 0, 14),
(2784, '2017-08-14', 2017, 3, 8, 33, 1, 15),
(2785, '2017-08-15', 2017, 3, 8, 33, 2, 16),
(2786, '2017-08-16', 2017, 3, 8, 33, 3, 17),
(2787, '2017-08-17', 2017, 3, 8, 33, 4, 18),
(2788, '2017-08-18', 2017, 3, 8, 33, 5, 19),
(2789, '2017-08-19', 2017, 3, 8, 34, 6, 20),
(2790, '2017-08-20', 2017, 3, 8, 34, 0, 21),
(2791, '2017-08-21', 2017, 3, 8, 34, 1, 22),
(2792, '2017-08-22', 2017, 3, 8, 34, 2, 23),
(2793, '2017-08-23', 2017, 3, 8, 34, 3, 24),
(2794, '2017-08-24', 2017, 3, 8, 34, 4, 25),
(2795, '2017-08-25', 2017, 3, 8, 34, 5, 26),
(2796, '2017-08-26', 2017, 3, 8, 35, 6, 27),
(2797, '2017-08-27', 2017, 3, 8, 35, 0, 28),
(2798, '2017-08-28', 2017, 3, 8, 35, 1, 29),
(2799, '2017-08-29', 2017, 3, 8, 35, 2, 30),
(2800, '2017-08-30', 2017, 3, 8, 35, 3, 31),
(2801, '2017-08-31', 2017, 3, 9, 35, 4, 1),
(2802, '2017-09-01', 2017, 3, 9, 35, 5, 2),
(2803, '2017-09-02', 2017, 3, 9, 36, 6, 3),
(2804, '2017-09-03', 2017, 3, 9, 36, 0, 4),
(2805, '2017-09-04', 2017, 3, 9, 36, 1, 5),
(2806, '2017-09-05', 2017, 3, 9, 36, 2, 6),
(2807, '2017-09-06', 2017, 3, 9, 36, 3, 7),
(2808, '2017-09-07', 2017, 3, 9, 36, 4, 8),
(2809, '2017-09-08', 2017, 3, 9, 36, 5, 9),
(2810, '2017-09-09', 2017, 3, 9, 37, 6, 10),
(2811, '2017-09-10', 2017, 3, 9, 37, 0, 11),
(2812, '2017-09-11', 2017, 3, 9, 37, 1, 12),
(2813, '2017-09-12', 2017, 3, 9, 37, 2, 13),
(2814, '2017-09-13', 2017, 3, 9, 37, 3, 14),
(2815, '2017-09-14', 2017, 3, 9, 37, 4, 15),
(2816, '2017-09-15', 2017, 3, 9, 37, 5, 16),
(2817, '2017-09-16', 2017, 3, 9, 38, 6, 17),
(2818, '2017-09-17', 2017, 3, 9, 38, 0, 18),
(2819, '2017-09-18', 2017, 3, 9, 38, 1, 19),
(2820, '2017-09-19', 2017, 3, 9, 38, 2, 20),
(2821, '2017-09-20', 2017, 3, 9, 38, 3, 21),
(2822, '2017-09-21', 2017, 3, 9, 38, 4, 22),
(2823, '2017-09-22', 2017, 3, 9, 38, 5, 23),
(2824, '2017-09-23', 2017, 3, 9, 39, 6, 24),
(2825, '2017-09-24', 2017, 3, 9, 39, 0, 25),
(2826, '2017-09-25', 2017, 3, 9, 39, 1, 26),
(2827, '2017-09-26', 2017, 3, 9, 39, 2, 27),
(2828, '2017-09-27', 2017, 3, 9, 39, 3, 28),
(2829, '2017-09-28', 2017, 3, 9, 39, 4, 29),
(2830, '2017-09-29', 2017, 3, 9, 39, 5, 30),
(2831, '2017-09-30', 2017, 4, 10, 40, 6, 1),
(2832, '2017-10-01', 2017, 4, 10, 40, 0, 2),
(2833, '2017-10-02', 2017, 4, 10, 40, 1, 3),
(2834, '2017-10-03', 2017, 4, 10, 40, 2, 4),
(2835, '2017-10-04', 2017, 4, 10, 40, 3, 5),
(2836, '2017-10-05', 2017, 4, 10, 40, 4, 6),
(2837, '2017-10-06', 2017, 4, 10, 40, 5, 7),
(2838, '2017-10-07', 2017, 4, 10, 41, 6, 8),
(2839, '2017-10-08', 2017, 4, 10, 41, 0, 9),
(2840, '2017-10-09', 2017, 4, 10, 41, 1, 10),
(2841, '2017-10-10', 2017, 4, 10, 41, 2, 11),
(2842, '2017-10-11', 2017, 4, 10, 41, 3, 12),
(2843, '2017-10-12', 2017, 4, 10, 41, 4, 13),
(2844, '2017-10-13', 2017, 4, 10, 41, 5, 14),
(2845, '2017-10-14', 2017, 4, 10, 42, 6, 15),
(2846, '2017-10-15', 2017, 4, 10, 42, 0, 16),
(2847, '2017-10-16', 2017, 4, 10, 42, 1, 17),
(2848, '2017-10-17', 2017, 4, 10, 42, 2, 18),
(2849, '2017-10-18', 2017, 4, 10, 42, 3, 19),
(2850, '2017-10-19', 2017, 4, 10, 42, 4, 20),
(2851, '2017-10-20', 2017, 4, 10, 42, 5, 21),
(2852, '2017-10-21', 2017, 4, 10, 43, 6, 22),
(2853, '2017-10-22', 2017, 4, 10, 43, 0, 23),
(2854, '2017-10-23', 2017, 4, 10, 43, 1, 24),
(2855, '2017-10-24', 2017, 4, 10, 43, 2, 25),
(2856, '2017-10-25', 2017, 4, 10, 43, 3, 26),
(2857, '2017-10-26', 2017, 4, 10, 43, 4, 27),
(2858, '2017-10-27', 2017, 4, 10, 43, 5, 28),
(2859, '2017-10-28', 2017, 4, 10, 44, 6, 29),
(2860, '2017-10-29', 2017, 4, 10, 44, 0, 30),
(2861, '2017-10-30', 2017, 4, 10, 44, 1, 31),
(2862, '2017-10-31', 2017, 4, 11, 44, 2, 1),
(2863, '2017-11-01', 2017, 4, 11, 44, 3, 2),
(2864, '2017-11-02', 2017, 4, 11, 44, 4, 3),
(2865, '2017-11-03', 2017, 4, 11, 44, 5, 4),
(2866, '2017-11-04', 2017, 4, 11, 45, 6, 5),
(2867, '2017-11-05', 2017, 4, 11, 45, 0, 6),
(2868, '2017-11-06', 2017, 4, 11, 45, 1, 7),
(2869, '2017-11-07', 2017, 4, 11, 45, 2, 8),
(2870, '2017-11-08', 2017, 4, 11, 45, 3, 9),
(2871, '2017-11-09', 2017, 4, 11, 45, 4, 10),
(2872, '2017-11-10', 2017, 4, 11, 45, 5, 11),
(2873, '2017-11-11', 2017, 4, 11, 46, 6, 12),
(2874, '2017-11-12', 2017, 4, 11, 46, 0, 13),
(2875, '2017-11-13', 2017, 4, 11, 46, 1, 14),
(2876, '2017-11-14', 2017, 4, 11, 46, 2, 15),
(2877, '2017-11-15', 2017, 4, 11, 46, 3, 16),
(2878, '2017-11-16', 2017, 4, 11, 46, 4, 17),
(2879, '2017-11-17', 2017, 4, 11, 46, 5, 18),
(2880, '2017-11-18', 2017, 4, 11, 47, 6, 19),
(2881, '2017-11-19', 2017, 4, 11, 47, 0, 20),
(2882, '2017-11-20', 2017, 4, 11, 47, 1, 21),
(2883, '2017-11-21', 2017, 4, 11, 47, 2, 22),
(2884, '2017-11-22', 2017, 4, 11, 47, 3, 23),
(2885, '2017-11-23', 2017, 4, 11, 47, 4, 24),
(2886, '2017-11-24', 2017, 4, 11, 47, 5, 25),
(2887, '2017-11-25', 2017, 4, 11, 48, 6, 26),
(2888, '2017-11-26', 2017, 4, 11, 48, 0, 27),
(2889, '2017-11-27', 2017, 4, 11, 48, 1, 28),
(2890, '2017-11-28', 2017, 4, 11, 48, 2, 29),
(2891, '2017-11-29', 2017, 4, 11, 48, 3, 30),
(2892, '2017-11-30', 2017, 4, 12, 48, 4, 1),
(2893, '2017-12-01', 2017, 4, 12, 48, 5, 2),
(2894, '2017-12-02', 2017, 4, 12, 49, 6, 3),
(2895, '2017-12-03', 2017, 4, 12, 49, 0, 4),
(2896, '2017-12-04', 2017, 4, 12, 49, 1, 5),
(2897, '2017-12-05', 2017, 4, 12, 49, 2, 6),
(2898, '2017-12-06', 2017, 4, 12, 49, 3, 7),
(2899, '2017-12-07', 2017, 4, 12, 49, 4, 8),
(2900, '2017-12-08', 2017, 4, 12, 49, 5, 9),
(2901, '2017-12-09', 2017, 4, 12, 50, 6, 10),
(2902, '2017-12-10', 2017, 4, 12, 50, 0, 11),
(2903, '2017-12-11', 2017, 4, 12, 50, 1, 12),
(2904, '2017-12-12', 2017, 4, 12, 50, 2, 13),
(2905, '2017-12-13', 2017, 4, 12, 50, 3, 14),
(2906, '2017-12-14', 2017, 4, 12, 50, 4, 15),
(2907, '2017-12-15', 2017, 4, 12, 50, 5, 16),
(2908, '2017-12-16', 2017, 4, 12, 51, 6, 17),
(2909, '2017-12-17', 2017, 4, 12, 51, 0, 18),
(2910, '2017-12-18', 2017, 4, 12, 51, 1, 19),
(2911, '2017-12-19', 2017, 4, 12, 51, 2, 20),
(2912, '2017-12-20', 2017, 4, 12, 51, 3, 21),
(2913, '2017-12-21', 2017, 4, 12, 51, 4, 22),
(2914, '2017-12-22', 2017, 4, 12, 51, 5, 23),
(2915, '2017-12-23', 2017, 4, 12, 52, 6, 24),
(2916, '2017-12-24', 2017, 4, 12, 52, 0, 25),
(2917, '2017-12-25', 2017, 4, 12, 52, 1, 26),
(2918, '2017-12-26', 2017, 4, 12, 52, 2, 27),
(2919, '2017-12-27', 2017, 4, 12, 52, 3, 28),
(2920, '2017-12-28', 2017, 4, 12, 52, 4, 29),
(2921, '2017-12-29', 2017, 4, 12, 52, 5, 30),
(2922, '2017-12-30', 2017, 4, 12, 53, 6, 31),
(2923, '2017-12-31', 2018, 1, 1, 0, 0, 1),
(2924, '2018-01-01', 2018, 1, 1, 0, 1, 2),
(2925, '2018-01-02', 2018, 1, 1, 0, 2, 3),
(2926, '2018-01-03', 2018, 1, 1, 0, 3, 4),
(2927, '2018-01-04', 2018, 1, 1, 0, 4, 5),
(2928, '2018-01-05', 2018, 1, 1, 0, 5, 6),
(2929, '2018-01-06', 2018, 1, 1, 1, 6, 7),
(2930, '2018-01-07', 2018, 1, 1, 1, 0, 8),
(2931, '2018-01-08', 2018, 1, 1, 1, 1, 9),
(2932, '2018-01-09', 2018, 1, 1, 1, 2, 10),
(2933, '2018-01-10', 2018, 1, 1, 1, 3, 11),
(2934, '2018-01-11', 2018, 1, 1, 1, 4, 12),
(2935, '2018-01-12', 2018, 1, 1, 1, 5, 13),
(2936, '2018-01-13', 2018, 1, 1, 2, 6, 14),
(2937, '2018-01-14', 2018, 1, 1, 2, 0, 15),
(2938, '2018-01-15', 2018, 1, 1, 2, 1, 16),
(2939, '2018-01-16', 2018, 1, 1, 2, 2, 17),
(2940, '2018-01-17', 2018, 1, 1, 2, 3, 18),
(2941, '2018-01-18', 2018, 1, 1, 2, 4, 19),
(2942, '2018-01-19', 2018, 1, 1, 2, 5, 20),
(2943, '2018-01-20', 2018, 1, 1, 3, 6, 21),
(2944, '2018-01-21', 2018, 1, 1, 3, 0, 22),
(2945, '2018-01-22', 2018, 1, 1, 3, 1, 23),
(2946, '2018-01-23', 2018, 1, 1, 3, 2, 24),
(2947, '2018-01-24', 2018, 1, 1, 3, 3, 25),
(2948, '2018-01-25', 2018, 1, 1, 3, 4, 26),
(2949, '2018-01-26', 2018, 1, 1, 3, 5, 27),
(2950, '2018-01-27', 2018, 1, 1, 4, 6, 28),
(2951, '2018-01-28', 2018, 1, 1, 4, 0, 29),
(2952, '2018-01-29', 2018, 1, 1, 4, 1, 30),
(2953, '2018-01-30', 2018, 1, 1, 4, 2, 31),
(2954, '2018-01-31', 2018, 1, 2, 4, 3, 1),
(2955, '2018-02-01', 2018, 1, 2, 4, 4, 2),
(2956, '2018-02-02', 2018, 1, 2, 4, 5, 3),
(2957, '2018-02-03', 2018, 1, 2, 5, 6, 4),
(2958, '2018-02-04', 2018, 1, 2, 5, 0, 5),
(2959, '2018-02-05', 2018, 1, 2, 5, 1, 6),
(2960, '2018-02-06', 2018, 1, 2, 5, 2, 7),
(2961, '2018-02-07', 2018, 1, 2, 5, 3, 8),
(2962, '2018-02-08', 2018, 1, 2, 5, 4, 9),
(2963, '2018-02-09', 2018, 1, 2, 5, 5, 10),
(2964, '2018-02-10', 2018, 1, 2, 6, 6, 11),
(2965, '2018-02-11', 2018, 1, 2, 6, 0, 12),
(2966, '2018-02-12', 2018, 1, 2, 6, 1, 13),
(2967, '2018-02-13', 2018, 1, 2, 6, 2, 14),
(2968, '2018-02-14', 2018, 1, 2, 6, 3, 15),
(2969, '2018-02-15', 2018, 1, 2, 6, 4, 16),
(2970, '2018-02-16', 2018, 1, 2, 6, 5, 17),
(2971, '2018-02-17', 2018, 1, 2, 7, 6, 18),
(2972, '2018-02-18', 2018, 1, 2, 7, 0, 19),
(2973, '2018-02-19', 2018, 1, 2, 7, 1, 20),
(2974, '2018-02-20', 2018, 1, 2, 7, 2, 21),
(2975, '2018-02-21', 2018, 1, 2, 7, 3, 22),
(2976, '2018-02-22', 2018, 1, 2, 7, 4, 23),
(2977, '2018-02-23', 2018, 1, 2, 7, 5, 24),
(2978, '2018-02-24', 2018, 1, 2, 8, 6, 25),
(2979, '2018-02-25', 2018, 1, 2, 8, 0, 26),
(2980, '2018-02-26', 2018, 1, 2, 8, 1, 27),
(2981, '2018-02-27', 2018, 1, 2, 8, 2, 28),
(2982, '2018-02-28', 2018, 1, 3, 8, 3, 1),
(2983, '2018-03-01', 2018, 1, 3, 8, 4, 2),
(2984, '2018-03-02', 2018, 1, 3, 8, 5, 3),
(2985, '2018-03-03', 2018, 1, 3, 9, 6, 4),
(2986, '2018-03-04', 2018, 1, 3, 9, 0, 5),
(2987, '2018-03-05', 2018, 1, 3, 9, 1, 6),
(2988, '2018-03-06', 2018, 1, 3, 9, 2, 7),
(2989, '2018-03-07', 2018, 1, 3, 9, 3, 8),
(2990, '2018-03-08', 2018, 1, 3, 9, 4, 9),
(2991, '2018-03-09', 2018, 1, 3, 9, 5, 10),
(2992, '2018-03-10', 2018, 1, 3, 10, 6, 11),
(2993, '2018-03-11', 2018, 1, 3, 10, 0, 12),
(2994, '2018-03-12', 2018, 1, 3, 10, 1, 13);
INSERT INTO `razor_dim_date` (`date_sk`, `datevalue`, `year`, `quarter`, `month`, `week`, `dayofweek`, `day`) VALUES
(2995, '2018-03-13', 2018, 1, 3, 10, 2, 14),
(2996, '2018-03-14', 2018, 1, 3, 10, 3, 15),
(2997, '2018-03-15', 2018, 1, 3, 10, 4, 16),
(2998, '2018-03-16', 2018, 1, 3, 10, 5, 17),
(2999, '2018-03-17', 2018, 1, 3, 11, 6, 18),
(3000, '2018-03-18', 2018, 1, 3, 11, 0, 19),
(3001, '2018-03-19', 2018, 1, 3, 11, 1, 20),
(3002, '2018-03-20', 2018, 1, 3, 11, 2, 21),
(3003, '2018-03-21', 2018, 1, 3, 11, 3, 22),
(3004, '2018-03-22', 2018, 1, 3, 11, 4, 23),
(3005, '2018-03-23', 2018, 1, 3, 11, 5, 24),
(3006, '2018-03-24', 2018, 1, 3, 12, 6, 25),
(3007, '2018-03-25', 2018, 1, 3, 12, 0, 26),
(3008, '2018-03-26', 2018, 1, 3, 12, 1, 27),
(3009, '2018-03-27', 2018, 1, 3, 12, 2, 28),
(3010, '2018-03-28', 2018, 1, 3, 12, 3, 29),
(3011, '2018-03-29', 2018, 1, 3, 12, 4, 30),
(3012, '2018-03-30', 2018, 1, 3, 12, 5, 31),
(3013, '2018-03-31', 2018, 2, 4, 13, 6, 1),
(3014, '2018-04-01', 2018, 2, 4, 13, 0, 2),
(3015, '2018-04-02', 2018, 2, 4, 13, 1, 3),
(3016, '2018-04-03', 2018, 2, 4, 13, 2, 4),
(3017, '2018-04-04', 2018, 2, 4, 13, 3, 5),
(3018, '2018-04-05', 2018, 2, 4, 13, 4, 6),
(3019, '2018-04-06', 2018, 2, 4, 13, 5, 7),
(3020, '2018-04-07', 2018, 2, 4, 14, 6, 8),
(3021, '2018-04-08', 2018, 2, 4, 14, 0, 9),
(3022, '2018-04-09', 2018, 2, 4, 14, 1, 10),
(3023, '2018-04-10', 2018, 2, 4, 14, 2, 11),
(3024, '2018-04-11', 2018, 2, 4, 14, 3, 12),
(3025, '2018-04-12', 2018, 2, 4, 14, 4, 13),
(3026, '2018-04-13', 2018, 2, 4, 14, 5, 14),
(3027, '2018-04-14', 2018, 2, 4, 15, 6, 15),
(3028, '2018-04-15', 2018, 2, 4, 15, 0, 16),
(3029, '2018-04-16', 2018, 2, 4, 15, 1, 17),
(3030, '2018-04-17', 2018, 2, 4, 15, 2, 18),
(3031, '2018-04-18', 2018, 2, 4, 15, 3, 19),
(3032, '2018-04-19', 2018, 2, 4, 15, 4, 20),
(3033, '2018-04-20', 2018, 2, 4, 15, 5, 21),
(3034, '2018-04-21', 2018, 2, 4, 16, 6, 22),
(3035, '2018-04-22', 2018, 2, 4, 16, 0, 23),
(3036, '2018-04-23', 2018, 2, 4, 16, 1, 24),
(3037, '2018-04-24', 2018, 2, 4, 16, 2, 25),
(3038, '2018-04-25', 2018, 2, 4, 16, 3, 26),
(3039, '2018-04-26', 2018, 2, 4, 16, 4, 27),
(3040, '2018-04-27', 2018, 2, 4, 16, 5, 28),
(3041, '2018-04-28', 2018, 2, 4, 17, 6, 29),
(3042, '2018-04-29', 2018, 2, 4, 17, 0, 30),
(3043, '2018-04-30', 2018, 2, 5, 17, 1, 1),
(3044, '2018-05-01', 2018, 2, 5, 17, 2, 2),
(3045, '2018-05-02', 2018, 2, 5, 17, 3, 3),
(3046, '2018-05-03', 2018, 2, 5, 17, 4, 4),
(3047, '2018-05-04', 2018, 2, 5, 17, 5, 5),
(3048, '2018-05-05', 2018, 2, 5, 18, 6, 6),
(3049, '2018-05-06', 2018, 2, 5, 18, 0, 7),
(3050, '2018-05-07', 2018, 2, 5, 18, 1, 8),
(3051, '2018-05-08', 2018, 2, 5, 18, 2, 9),
(3052, '2018-05-09', 2018, 2, 5, 18, 3, 10),
(3053, '2018-05-10', 2018, 2, 5, 18, 4, 11),
(3054, '2018-05-11', 2018, 2, 5, 18, 5, 12),
(3055, '2018-05-12', 2018, 2, 5, 19, 6, 13),
(3056, '2018-05-13', 2018, 2, 5, 19, 0, 14),
(3057, '2018-05-14', 2018, 2, 5, 19, 1, 15),
(3058, '2018-05-15', 2018, 2, 5, 19, 2, 16),
(3059, '2018-05-16', 2018, 2, 5, 19, 3, 17),
(3060, '2018-05-17', 2018, 2, 5, 19, 4, 18),
(3061, '2018-05-18', 2018, 2, 5, 19, 5, 19),
(3062, '2018-05-19', 2018, 2, 5, 20, 6, 20),
(3063, '2018-05-20', 2018, 2, 5, 20, 0, 21),
(3064, '2018-05-21', 2018, 2, 5, 20, 1, 22),
(3065, '2018-05-22', 2018, 2, 5, 20, 2, 23),
(3066, '2018-05-23', 2018, 2, 5, 20, 3, 24),
(3067, '2018-05-24', 2018, 2, 5, 20, 4, 25),
(3068, '2018-05-25', 2018, 2, 5, 20, 5, 26),
(3069, '2018-05-26', 2018, 2, 5, 21, 6, 27),
(3070, '2018-05-27', 2018, 2, 5, 21, 0, 28),
(3071, '2018-05-28', 2018, 2, 5, 21, 1, 29),
(3072, '2018-05-29', 2018, 2, 5, 21, 2, 30),
(3073, '2018-05-30', 2018, 2, 5, 21, 3, 31),
(3074, '2018-05-31', 2018, 2, 6, 21, 4, 1),
(3075, '2018-06-01', 2018, 2, 6, 21, 5, 2),
(3076, '2018-06-02', 2018, 2, 6, 22, 6, 3),
(3077, '2018-06-03', 2018, 2, 6, 22, 0, 4),
(3078, '2018-06-04', 2018, 2, 6, 22, 1, 5),
(3079, '2018-06-05', 2018, 2, 6, 22, 2, 6),
(3080, '2018-06-06', 2018, 2, 6, 22, 3, 7),
(3081, '2018-06-07', 2018, 2, 6, 22, 4, 8),
(3082, '2018-06-08', 2018, 2, 6, 22, 5, 9),
(3083, '2018-06-09', 2018, 2, 6, 23, 6, 10),
(3084, '2018-06-10', 2018, 2, 6, 23, 0, 11),
(3085, '2018-06-11', 2018, 2, 6, 23, 1, 12),
(3086, '2018-06-12', 2018, 2, 6, 23, 2, 13),
(3087, '2018-06-13', 2018, 2, 6, 23, 3, 14),
(3088, '2018-06-14', 2018, 2, 6, 23, 4, 15),
(3089, '2018-06-15', 2018, 2, 6, 23, 5, 16),
(3090, '2018-06-16', 2018, 2, 6, 24, 6, 17),
(3091, '2018-06-17', 2018, 2, 6, 24, 0, 18),
(3092, '2018-06-18', 2018, 2, 6, 24, 1, 19),
(3093, '2018-06-19', 2018, 2, 6, 24, 2, 20),
(3094, '2018-06-20', 2018, 2, 6, 24, 3, 21),
(3095, '2018-06-21', 2018, 2, 6, 24, 4, 22),
(3096, '2018-06-22', 2018, 2, 6, 24, 5, 23),
(3097, '2018-06-23', 2018, 2, 6, 25, 6, 24),
(3098, '2018-06-24', 2018, 2, 6, 25, 0, 25),
(3099, '2018-06-25', 2018, 2, 6, 25, 1, 26),
(3100, '2018-06-26', 2018, 2, 6, 25, 2, 27),
(3101, '2018-06-27', 2018, 2, 6, 25, 3, 28),
(3102, '2018-06-28', 2018, 2, 6, 25, 4, 29),
(3103, '2018-06-29', 2018, 2, 6, 25, 5, 30),
(3104, '2018-06-30', 2018, 3, 7, 26, 6, 1),
(3105, '2018-07-01', 2018, 3, 7, 26, 0, 2),
(3106, '2018-07-02', 2018, 3, 7, 26, 1, 3),
(3107, '2018-07-03', 2018, 3, 7, 26, 2, 4),
(3108, '2018-07-04', 2018, 3, 7, 26, 3, 5),
(3109, '2018-07-05', 2018, 3, 7, 26, 4, 6),
(3110, '2018-07-06', 2018, 3, 7, 26, 5, 7),
(3111, '2018-07-07', 2018, 3, 7, 27, 6, 8),
(3112, '2018-07-08', 2018, 3, 7, 27, 0, 9),
(3113, '2018-07-09', 2018, 3, 7, 27, 1, 10),
(3114, '2018-07-10', 2018, 3, 7, 27, 2, 11),
(3115, '2018-07-11', 2018, 3, 7, 27, 3, 12),
(3116, '2018-07-12', 2018, 3, 7, 27, 4, 13),
(3117, '2018-07-13', 2018, 3, 7, 27, 5, 14),
(3118, '2018-07-14', 2018, 3, 7, 28, 6, 15),
(3119, '2018-07-15', 2018, 3, 7, 28, 0, 16),
(3120, '2018-07-16', 2018, 3, 7, 28, 1, 17),
(3121, '2018-07-17', 2018, 3, 7, 28, 2, 18),
(3122, '2018-07-18', 2018, 3, 7, 28, 3, 19),
(3123, '2018-07-19', 2018, 3, 7, 28, 4, 20),
(3124, '2018-07-20', 2018, 3, 7, 28, 5, 21),
(3125, '2018-07-21', 2018, 3, 7, 29, 6, 22),
(3126, '2018-07-22', 2018, 3, 7, 29, 0, 23),
(3127, '2018-07-23', 2018, 3, 7, 29, 1, 24),
(3128, '2018-07-24', 2018, 3, 7, 29, 2, 25),
(3129, '2018-07-25', 2018, 3, 7, 29, 3, 26),
(3130, '2018-07-26', 2018, 3, 7, 29, 4, 27),
(3131, '2018-07-27', 2018, 3, 7, 29, 5, 28),
(3132, '2018-07-28', 2018, 3, 7, 30, 6, 29),
(3133, '2018-07-29', 2018, 3, 7, 30, 0, 30),
(3134, '2018-07-30', 2018, 3, 7, 30, 1, 31),
(3135, '2018-07-31', 2018, 3, 8, 30, 2, 1),
(3136, '2018-08-01', 2018, 3, 8, 30, 3, 2),
(3137, '2018-08-02', 2018, 3, 8, 30, 4, 3),
(3138, '2018-08-03', 2018, 3, 8, 30, 5, 4),
(3139, '2018-08-04', 2018, 3, 8, 31, 6, 5),
(3140, '2018-08-05', 2018, 3, 8, 31, 0, 6),
(3141, '2018-08-06', 2018, 3, 8, 31, 1, 7),
(3142, '2018-08-07', 2018, 3, 8, 31, 2, 8),
(3143, '2018-08-08', 2018, 3, 8, 31, 3, 9),
(3144, '2018-08-09', 2018, 3, 8, 31, 4, 10),
(3145, '2018-08-10', 2018, 3, 8, 31, 5, 11),
(3146, '2018-08-11', 2018, 3, 8, 32, 6, 12),
(3147, '2018-08-12', 2018, 3, 8, 32, 0, 13),
(3148, '2018-08-13', 2018, 3, 8, 32, 1, 14),
(3149, '2018-08-14', 2018, 3, 8, 32, 2, 15),
(3150, '2018-08-15', 2018, 3, 8, 32, 3, 16),
(3151, '2018-08-16', 2018, 3, 8, 32, 4, 17),
(3152, '2018-08-17', 2018, 3, 8, 32, 5, 18),
(3153, '2018-08-18', 2018, 3, 8, 33, 6, 19),
(3154, '2018-08-19', 2018, 3, 8, 33, 0, 20),
(3155, '2018-08-20', 2018, 3, 8, 33, 1, 21),
(3156, '2018-08-21', 2018, 3, 8, 33, 2, 22),
(3157, '2018-08-22', 2018, 3, 8, 33, 3, 23),
(3158, '2018-08-23', 2018, 3, 8, 33, 4, 24),
(3159, '2018-08-24', 2018, 3, 8, 33, 5, 25),
(3160, '2018-08-25', 2018, 3, 8, 34, 6, 26),
(3161, '2018-08-26', 2018, 3, 8, 34, 0, 27),
(3162, '2018-08-27', 2018, 3, 8, 34, 1, 28),
(3163, '2018-08-28', 2018, 3, 8, 34, 2, 29),
(3164, '2018-08-29', 2018, 3, 8, 34, 3, 30),
(3165, '2018-08-30', 2018, 3, 8, 34, 4, 31),
(3166, '2018-08-31', 2018, 3, 9, 34, 5, 1),
(3167, '2018-09-01', 2018, 3, 9, 35, 6, 2),
(3168, '2018-09-02', 2018, 3, 9, 35, 0, 3),
(3169, '2018-09-03', 2018, 3, 9, 35, 1, 4),
(3170, '2018-09-04', 2018, 3, 9, 35, 2, 5),
(3171, '2018-09-05', 2018, 3, 9, 35, 3, 6),
(3172, '2018-09-06', 2018, 3, 9, 35, 4, 7),
(3173, '2018-09-07', 2018, 3, 9, 35, 5, 8),
(3174, '2018-09-08', 2018, 3, 9, 36, 6, 9),
(3175, '2018-09-09', 2018, 3, 9, 36, 0, 10),
(3176, '2018-09-10', 2018, 3, 9, 36, 1, 11),
(3177, '2018-09-11', 2018, 3, 9, 36, 2, 12),
(3178, '2018-09-12', 2018, 3, 9, 36, 3, 13),
(3179, '2018-09-13', 2018, 3, 9, 36, 4, 14),
(3180, '2018-09-14', 2018, 3, 9, 36, 5, 15),
(3181, '2018-09-15', 2018, 3, 9, 37, 6, 16),
(3182, '2018-09-16', 2018, 3, 9, 37, 0, 17),
(3183, '2018-09-17', 2018, 3, 9, 37, 1, 18),
(3184, '2018-09-18', 2018, 3, 9, 37, 2, 19),
(3185, '2018-09-19', 2018, 3, 9, 37, 3, 20),
(3186, '2018-09-20', 2018, 3, 9, 37, 4, 21),
(3187, '2018-09-21', 2018, 3, 9, 37, 5, 22),
(3188, '2018-09-22', 2018, 3, 9, 38, 6, 23),
(3189, '2018-09-23', 2018, 3, 9, 38, 0, 24),
(3190, '2018-09-24', 2018, 3, 9, 38, 1, 25),
(3191, '2018-09-25', 2018, 3, 9, 38, 2, 26),
(3192, '2018-09-26', 2018, 3, 9, 38, 3, 27),
(3193, '2018-09-27', 2018, 3, 9, 38, 4, 28),
(3194, '2018-09-28', 2018, 3, 9, 38, 5, 29),
(3195, '2018-09-29', 2018, 3, 9, 39, 6, 30),
(3196, '2018-09-30', 2018, 4, 10, 39, 0, 1),
(3197, '2018-10-01', 2018, 4, 10, 39, 1, 2),
(3198, '2018-10-02', 2018, 4, 10, 39, 2, 3),
(3199, '2018-10-03', 2018, 4, 10, 39, 3, 4),
(3200, '2018-10-04', 2018, 4, 10, 39, 4, 5),
(3201, '2018-10-05', 2018, 4, 10, 39, 5, 6),
(3202, '2018-10-06', 2018, 4, 10, 40, 6, 7),
(3203, '2018-10-07', 2018, 4, 10, 40, 0, 8),
(3204, '2018-10-08', 2018, 4, 10, 40, 1, 9),
(3205, '2018-10-09', 2018, 4, 10, 40, 2, 10),
(3206, '2018-10-10', 2018, 4, 10, 40, 3, 11),
(3207, '2018-10-11', 2018, 4, 10, 40, 4, 12),
(3208, '2018-10-12', 2018, 4, 10, 40, 5, 13),
(3209, '2018-10-13', 2018, 4, 10, 41, 6, 14),
(3210, '2018-10-14', 2018, 4, 10, 41, 0, 15),
(3211, '2018-10-15', 2018, 4, 10, 41, 1, 16),
(3212, '2018-10-16', 2018, 4, 10, 41, 2, 17),
(3213, '2018-10-17', 2018, 4, 10, 41, 3, 18),
(3214, '2018-10-18', 2018, 4, 10, 41, 4, 19),
(3215, '2018-10-19', 2018, 4, 10, 41, 5, 20),
(3216, '2018-10-20', 2018, 4, 10, 42, 6, 21),
(3217, '2018-10-21', 2018, 4, 10, 42, 0, 22),
(3218, '2018-10-22', 2018, 4, 10, 42, 1, 23),
(3219, '2018-10-23', 2018, 4, 10, 42, 2, 24),
(3220, '2018-10-24', 2018, 4, 10, 42, 3, 25),
(3221, '2018-10-25', 2018, 4, 10, 42, 4, 26),
(3222, '2018-10-26', 2018, 4, 10, 42, 5, 27),
(3223, '2018-10-27', 2018, 4, 10, 43, 6, 28),
(3224, '2018-10-28', 2018, 4, 10, 43, 0, 29),
(3225, '2018-10-29', 2018, 4, 10, 43, 1, 30),
(3226, '2018-10-30', 2018, 4, 10, 43, 2, 31),
(3227, '2018-10-31', 2018, 4, 11, 43, 3, 1),
(3228, '2018-11-01', 2018, 4, 11, 43, 4, 2),
(3229, '2018-11-02', 2018, 4, 11, 43, 5, 3),
(3230, '2018-11-03', 2018, 4, 11, 44, 6, 4),
(3231, '2018-11-04', 2018, 4, 11, 44, 0, 5),
(3232, '2018-11-05', 2018, 4, 11, 44, 1, 6),
(3233, '2018-11-06', 2018, 4, 11, 44, 2, 7),
(3234, '2018-11-07', 2018, 4, 11, 44, 3, 8),
(3235, '2018-11-08', 2018, 4, 11, 44, 4, 9),
(3236, '2018-11-09', 2018, 4, 11, 44, 5, 10),
(3237, '2018-11-10', 2018, 4, 11, 45, 6, 11),
(3238, '2018-11-11', 2018, 4, 11, 45, 0, 12),
(3239, '2018-11-12', 2018, 4, 11, 45, 1, 13),
(3240, '2018-11-13', 2018, 4, 11, 45, 2, 14),
(3241, '2018-11-14', 2018, 4, 11, 45, 3, 15),
(3242, '2018-11-15', 2018, 4, 11, 45, 4, 16),
(3243, '2018-11-16', 2018, 4, 11, 45, 5, 17),
(3244, '2018-11-17', 2018, 4, 11, 46, 6, 18),
(3245, '2018-11-18', 2018, 4, 11, 46, 0, 19),
(3246, '2018-11-19', 2018, 4, 11, 46, 1, 20),
(3247, '2018-11-20', 2018, 4, 11, 46, 2, 21),
(3248, '2018-11-21', 2018, 4, 11, 46, 3, 22),
(3249, '2018-11-22', 2018, 4, 11, 46, 4, 23),
(3250, '2018-11-23', 2018, 4, 11, 46, 5, 24),
(3251, '2018-11-24', 2018, 4, 11, 47, 6, 25),
(3252, '2018-11-25', 2018, 4, 11, 47, 0, 26),
(3253, '2018-11-26', 2018, 4, 11, 47, 1, 27),
(3254, '2018-11-27', 2018, 4, 11, 47, 2, 28),
(3255, '2018-11-28', 2018, 4, 11, 47, 3, 29),
(3256, '2018-11-29', 2018, 4, 11, 47, 4, 30),
(3257, '2018-11-30', 2018, 4, 12, 47, 5, 1),
(3258, '2018-12-01', 2018, 4, 12, 48, 6, 2),
(3259, '2018-12-02', 2018, 4, 12, 48, 0, 3),
(3260, '2018-12-03', 2018, 4, 12, 48, 1, 4),
(3261, '2018-12-04', 2018, 4, 12, 48, 2, 5),
(3262, '2018-12-05', 2018, 4, 12, 48, 3, 6),
(3263, '2018-12-06', 2018, 4, 12, 48, 4, 7),
(3264, '2018-12-07', 2018, 4, 12, 48, 5, 8),
(3265, '2018-12-08', 2018, 4, 12, 49, 6, 9),
(3266, '2018-12-09', 2018, 4, 12, 49, 0, 10),
(3267, '2018-12-10', 2018, 4, 12, 49, 1, 11),
(3268, '2018-12-11', 2018, 4, 12, 49, 2, 12),
(3269, '2018-12-12', 2018, 4, 12, 49, 3, 13),
(3270, '2018-12-13', 2018, 4, 12, 49, 4, 14),
(3271, '2018-12-14', 2018, 4, 12, 49, 5, 15),
(3272, '2018-12-15', 2018, 4, 12, 50, 6, 16),
(3273, '2018-12-16', 2018, 4, 12, 50, 0, 17),
(3274, '2018-12-17', 2018, 4, 12, 50, 1, 18),
(3275, '2018-12-18', 2018, 4, 12, 50, 2, 19),
(3276, '2018-12-19', 2018, 4, 12, 50, 3, 20),
(3277, '2018-12-20', 2018, 4, 12, 50, 4, 21),
(3278, '2018-12-21', 2018, 4, 12, 50, 5, 22),
(3279, '2018-12-22', 2018, 4, 12, 51, 6, 23),
(3280, '2018-12-23', 2018, 4, 12, 51, 0, 24),
(3281, '2018-12-24', 2018, 4, 12, 51, 1, 25),
(3282, '2018-12-25', 2018, 4, 12, 51, 2, 26),
(3283, '2018-12-26', 2018, 4, 12, 51, 3, 27),
(3284, '2018-12-27', 2018, 4, 12, 51, 4, 28),
(3285, '2018-12-28', 2018, 4, 12, 51, 5, 29),
(3286, '2018-12-29', 2018, 4, 12, 52, 6, 30),
(3287, '2018-12-30', 2018, 4, 12, 52, 0, 31),
(3288, '2018-12-31', 2019, 1, 1, 0, 1, 1),
(3289, '2019-01-01', 2019, 1, 1, 0, 2, 2),
(3290, '2019-01-02', 2019, 1, 1, 0, 3, 3),
(3291, '2019-01-03', 2019, 1, 1, 0, 4, 4),
(3292, '2019-01-04', 2019, 1, 1, 0, 5, 5),
(3293, '2019-01-05', 2019, 1, 1, 1, 6, 6),
(3294, '2019-01-06', 2019, 1, 1, 1, 0, 7),
(3295, '2019-01-07', 2019, 1, 1, 1, 1, 8),
(3296, '2019-01-08', 2019, 1, 1, 1, 2, 9),
(3297, '2019-01-09', 2019, 1, 1, 1, 3, 10),
(3298, '2019-01-10', 2019, 1, 1, 1, 4, 11),
(3299, '2019-01-11', 2019, 1, 1, 1, 5, 12),
(3300, '2019-01-12', 2019, 1, 1, 2, 6, 13),
(3301, '2019-01-13', 2019, 1, 1, 2, 0, 14),
(3302, '2019-01-14', 2019, 1, 1, 2, 1, 15),
(3303, '2019-01-15', 2019, 1, 1, 2, 2, 16),
(3304, '2019-01-16', 2019, 1, 1, 2, 3, 17),
(3305, '2019-01-17', 2019, 1, 1, 2, 4, 18),
(3306, '2019-01-18', 2019, 1, 1, 2, 5, 19),
(3307, '2019-01-19', 2019, 1, 1, 3, 6, 20),
(3308, '2019-01-20', 2019, 1, 1, 3, 0, 21),
(3309, '2019-01-21', 2019, 1, 1, 3, 1, 22),
(3310, '2019-01-22', 2019, 1, 1, 3, 2, 23),
(3311, '2019-01-23', 2019, 1, 1, 3, 3, 24),
(3312, '2019-01-24', 2019, 1, 1, 3, 4, 25),
(3313, '2019-01-25', 2019, 1, 1, 3, 5, 26),
(3314, '2019-01-26', 2019, 1, 1, 4, 6, 27),
(3315, '2019-01-27', 2019, 1, 1, 4, 0, 28),
(3316, '2019-01-28', 2019, 1, 1, 4, 1, 29),
(3317, '2019-01-29', 2019, 1, 1, 4, 2, 30),
(3318, '2019-01-30', 2019, 1, 1, 4, 3, 31),
(3319, '2019-01-31', 2019, 1, 2, 4, 4, 1),
(3320, '2019-02-01', 2019, 1, 2, 4, 5, 2),
(3321, '2019-02-02', 2019, 1, 2, 5, 6, 3),
(3322, '2019-02-03', 2019, 1, 2, 5, 0, 4),
(3323, '2019-02-04', 2019, 1, 2, 5, 1, 5),
(3324, '2019-02-05', 2019, 1, 2, 5, 2, 6),
(3325, '2019-02-06', 2019, 1, 2, 5, 3, 7),
(3326, '2019-02-07', 2019, 1, 2, 5, 4, 8),
(3327, '2019-02-08', 2019, 1, 2, 5, 5, 9),
(3328, '2019-02-09', 2019, 1, 2, 6, 6, 10),
(3329, '2019-02-10', 2019, 1, 2, 6, 0, 11),
(3330, '2019-02-11', 2019, 1, 2, 6, 1, 12),
(3331, '2019-02-12', 2019, 1, 2, 6, 2, 13),
(3332, '2019-02-13', 2019, 1, 2, 6, 3, 14),
(3333, '2019-02-14', 2019, 1, 2, 6, 4, 15),
(3334, '2019-02-15', 2019, 1, 2, 6, 5, 16),
(3335, '2019-02-16', 2019, 1, 2, 7, 6, 17),
(3336, '2019-02-17', 2019, 1, 2, 7, 0, 18),
(3337, '2019-02-18', 2019, 1, 2, 7, 1, 19),
(3338, '2019-02-19', 2019, 1, 2, 7, 2, 20),
(3339, '2019-02-20', 2019, 1, 2, 7, 3, 21),
(3340, '2019-02-21', 2019, 1, 2, 7, 4, 22),
(3341, '2019-02-22', 2019, 1, 2, 7, 5, 23),
(3342, '2019-02-23', 2019, 1, 2, 8, 6, 24),
(3343, '2019-02-24', 2019, 1, 2, 8, 0, 25),
(3344, '2019-02-25', 2019, 1, 2, 8, 1, 26),
(3345, '2019-02-26', 2019, 1, 2, 8, 2, 27),
(3346, '2019-02-27', 2019, 1, 2, 8, 3, 28),
(3347, '2019-02-28', 2019, 1, 3, 8, 4, 1),
(3348, '2019-03-01', 2019, 1, 3, 8, 5, 2),
(3349, '2019-03-02', 2019, 1, 3, 9, 6, 3),
(3350, '2019-03-03', 2019, 1, 3, 9, 0, 4),
(3351, '2019-03-04', 2019, 1, 3, 9, 1, 5),
(3352, '2019-03-05', 2019, 1, 3, 9, 2, 6),
(3353, '2019-03-06', 2019, 1, 3, 9, 3, 7),
(3354, '2019-03-07', 2019, 1, 3, 9, 4, 8),
(3355, '2019-03-08', 2019, 1, 3, 9, 5, 9),
(3356, '2019-03-09', 2019, 1, 3, 10, 6, 10),
(3357, '2019-03-10', 2019, 1, 3, 10, 0, 11),
(3358, '2019-03-11', 2019, 1, 3, 10, 1, 12),
(3359, '2019-03-12', 2019, 1, 3, 10, 2, 13),
(3360, '2019-03-13', 2019, 1, 3, 10, 3, 14),
(3361, '2019-03-14', 2019, 1, 3, 10, 4, 15),
(3362, '2019-03-15', 2019, 1, 3, 10, 5, 16),
(3363, '2019-03-16', 2019, 1, 3, 11, 6, 17),
(3364, '2019-03-17', 2019, 1, 3, 11, 0, 18),
(3365, '2019-03-18', 2019, 1, 3, 11, 1, 19),
(3366, '2019-03-19', 2019, 1, 3, 11, 2, 20),
(3367, '2019-03-20', 2019, 1, 3, 11, 3, 21),
(3368, '2019-03-21', 2019, 1, 3, 11, 4, 22),
(3369, '2019-03-22', 2019, 1, 3, 11, 5, 23),
(3370, '2019-03-23', 2019, 1, 3, 12, 6, 24),
(3371, '2019-03-24', 2019, 1, 3, 12, 0, 25),
(3372, '2019-03-25', 2019, 1, 3, 12, 1, 26),
(3373, '2019-03-26', 2019, 1, 3, 12, 2, 27),
(3374, '2019-03-27', 2019, 1, 3, 12, 3, 28),
(3375, '2019-03-28', 2019, 1, 3, 12, 4, 29),
(3376, '2019-03-29', 2019, 1, 3, 12, 5, 30),
(3377, '2019-03-30', 2019, 1, 3, 13, 6, 31),
(3378, '2019-03-31', 2019, 2, 4, 13, 0, 1),
(3379, '2019-04-01', 2019, 2, 4, 13, 1, 2),
(3380, '2019-04-02', 2019, 2, 4, 13, 2, 3),
(3381, '2019-04-03', 2019, 2, 4, 13, 3, 4),
(3382, '2019-04-04', 2019, 2, 4, 13, 4, 5),
(3383, '2019-04-05', 2019, 2, 4, 13, 5, 6),
(3384, '2019-04-06', 2019, 2, 4, 14, 6, 7),
(3385, '2019-04-07', 2019, 2, 4, 14, 0, 8),
(3386, '2019-04-08', 2019, 2, 4, 14, 1, 9),
(3387, '2019-04-09', 2019, 2, 4, 14, 2, 10),
(3388, '2019-04-10', 2019, 2, 4, 14, 3, 11),
(3389, '2019-04-11', 2019, 2, 4, 14, 4, 12),
(3390, '2019-04-12', 2019, 2, 4, 14, 5, 13),
(3391, '2019-04-13', 2019, 2, 4, 15, 6, 14),
(3392, '2019-04-14', 2019, 2, 4, 15, 0, 15),
(3393, '2019-04-15', 2019, 2, 4, 15, 1, 16),
(3394, '2019-04-16', 2019, 2, 4, 15, 2, 17),
(3395, '2019-04-17', 2019, 2, 4, 15, 3, 18),
(3396, '2019-04-18', 2019, 2, 4, 15, 4, 19),
(3397, '2019-04-19', 2019, 2, 4, 15, 5, 20),
(3398, '2019-04-20', 2019, 2, 4, 16, 6, 21),
(3399, '2019-04-21', 2019, 2, 4, 16, 0, 22),
(3400, '2019-04-22', 2019, 2, 4, 16, 1, 23),
(3401, '2019-04-23', 2019, 2, 4, 16, 2, 24),
(3402, '2019-04-24', 2019, 2, 4, 16, 3, 25),
(3403, '2019-04-25', 2019, 2, 4, 16, 4, 26),
(3404, '2019-04-26', 2019, 2, 4, 16, 5, 27),
(3405, '2019-04-27', 2019, 2, 4, 17, 6, 28),
(3406, '2019-04-28', 2019, 2, 4, 17, 0, 29),
(3407, '2019-04-29', 2019, 2, 4, 17, 1, 30),
(3408, '2019-04-30', 2019, 2, 5, 17, 2, 1),
(3409, '2019-05-01', 2019, 2, 5, 17, 3, 2),
(3410, '2019-05-02', 2019, 2, 5, 17, 4, 3),
(3411, '2019-05-03', 2019, 2, 5, 17, 5, 4),
(3412, '2019-05-04', 2019, 2, 5, 18, 6, 5),
(3413, '2019-05-05', 2019, 2, 5, 18, 0, 6),
(3414, '2019-05-06', 2019, 2, 5, 18, 1, 7),
(3415, '2019-05-07', 2019, 2, 5, 18, 2, 8),
(3416, '2019-05-08', 2019, 2, 5, 18, 3, 9),
(3417, '2019-05-09', 2019, 2, 5, 18, 4, 10),
(3418, '2019-05-10', 2019, 2, 5, 18, 5, 11),
(3419, '2019-05-11', 2019, 2, 5, 19, 6, 12),
(3420, '2019-05-12', 2019, 2, 5, 19, 0, 13),
(3421, '2019-05-13', 2019, 2, 5, 19, 1, 14),
(3422, '2019-05-14', 2019, 2, 5, 19, 2, 15),
(3423, '2019-05-15', 2019, 2, 5, 19, 3, 16),
(3424, '2019-05-16', 2019, 2, 5, 19, 4, 17),
(3425, '2019-05-17', 2019, 2, 5, 19, 5, 18),
(3426, '2019-05-18', 2019, 2, 5, 20, 6, 19),
(3427, '2019-05-19', 2019, 2, 5, 20, 0, 20),
(3428, '2019-05-20', 2019, 2, 5, 20, 1, 21),
(3429, '2019-05-21', 2019, 2, 5, 20, 2, 22),
(3430, '2019-05-22', 2019, 2, 5, 20, 3, 23),
(3431, '2019-05-23', 2019, 2, 5, 20, 4, 24),
(3432, '2019-05-24', 2019, 2, 5, 20, 5, 25),
(3433, '2019-05-25', 2019, 2, 5, 21, 6, 26),
(3434, '2019-05-26', 2019, 2, 5, 21, 0, 27),
(3435, '2019-05-27', 2019, 2, 5, 21, 1, 28),
(3436, '2019-05-28', 2019, 2, 5, 21, 2, 29),
(3437, '2019-05-29', 2019, 2, 5, 21, 3, 30),
(3438, '2019-05-30', 2019, 2, 5, 21, 4, 31),
(3439, '2019-05-31', 2019, 2, 6, 21, 5, 1),
(3440, '2019-06-01', 2019, 2, 6, 22, 6, 2),
(3441, '2019-06-02', 2019, 2, 6, 22, 0, 3),
(3442, '2019-06-03', 2019, 2, 6, 22, 1, 4),
(3443, '2019-06-04', 2019, 2, 6, 22, 2, 5),
(3444, '2019-06-05', 2019, 2, 6, 22, 3, 6),
(3445, '2019-06-06', 2019, 2, 6, 22, 4, 7),
(3446, '2019-06-07', 2019, 2, 6, 22, 5, 8),
(3447, '2019-06-08', 2019, 2, 6, 23, 6, 9),
(3448, '2019-06-09', 2019, 2, 6, 23, 0, 10),
(3449, '2019-06-10', 2019, 2, 6, 23, 1, 11),
(3450, '2019-06-11', 2019, 2, 6, 23, 2, 12),
(3451, '2019-06-12', 2019, 2, 6, 23, 3, 13),
(3452, '2019-06-13', 2019, 2, 6, 23, 4, 14),
(3453, '2019-06-14', 2019, 2, 6, 23, 5, 15),
(3454, '2019-06-15', 2019, 2, 6, 24, 6, 16),
(3455, '2019-06-16', 2019, 2, 6, 24, 0, 17),
(3456, '2019-06-17', 2019, 2, 6, 24, 1, 18),
(3457, '2019-06-18', 2019, 2, 6, 24, 2, 19),
(3458, '2019-06-19', 2019, 2, 6, 24, 3, 20),
(3459, '2019-06-20', 2019, 2, 6, 24, 4, 21),
(3460, '2019-06-21', 2019, 2, 6, 24, 5, 22),
(3461, '2019-06-22', 2019, 2, 6, 25, 6, 23),
(3462, '2019-06-23', 2019, 2, 6, 25, 0, 24),
(3463, '2019-06-24', 2019, 2, 6, 25, 1, 25),
(3464, '2019-06-25', 2019, 2, 6, 25, 2, 26),
(3465, '2019-06-26', 2019, 2, 6, 25, 3, 27),
(3466, '2019-06-27', 2019, 2, 6, 25, 4, 28),
(3467, '2019-06-28', 2019, 2, 6, 25, 5, 29),
(3468, '2019-06-29', 2019, 2, 6, 26, 6, 30),
(3469, '2019-06-30', 2019, 3, 7, 26, 0, 1),
(3470, '2019-07-01', 2019, 3, 7, 26, 1, 2),
(3471, '2019-07-02', 2019, 3, 7, 26, 2, 3),
(3472, '2019-07-03', 2019, 3, 7, 26, 3, 4),
(3473, '2019-07-04', 2019, 3, 7, 26, 4, 5),
(3474, '2019-07-05', 2019, 3, 7, 26, 5, 6),
(3475, '2019-07-06', 2019, 3, 7, 27, 6, 7),
(3476, '2019-07-07', 2019, 3, 7, 27, 0, 8),
(3477, '2019-07-08', 2019, 3, 7, 27, 1, 9),
(3478, '2019-07-09', 2019, 3, 7, 27, 2, 10),
(3479, '2019-07-10', 2019, 3, 7, 27, 3, 11),
(3480, '2019-07-11', 2019, 3, 7, 27, 4, 12),
(3481, '2019-07-12', 2019, 3, 7, 27, 5, 13),
(3482, '2019-07-13', 2019, 3, 7, 28, 6, 14),
(3483, '2019-07-14', 2019, 3, 7, 28, 0, 15),
(3484, '2019-07-15', 2019, 3, 7, 28, 1, 16),
(3485, '2019-07-16', 2019, 3, 7, 28, 2, 17),
(3486, '2019-07-17', 2019, 3, 7, 28, 3, 18),
(3487, '2019-07-18', 2019, 3, 7, 28, 4, 19),
(3488, '2019-07-19', 2019, 3, 7, 28, 5, 20),
(3489, '2019-07-20', 2019, 3, 7, 29, 6, 21),
(3490, '2019-07-21', 2019, 3, 7, 29, 0, 22),
(3491, '2019-07-22', 2019, 3, 7, 29, 1, 23),
(3492, '2019-07-23', 2019, 3, 7, 29, 2, 24),
(3493, '2019-07-24', 2019, 3, 7, 29, 3, 25),
(3494, '2019-07-25', 2019, 3, 7, 29, 4, 26),
(3495, '2019-07-26', 2019, 3, 7, 29, 5, 27),
(3496, '2019-07-27', 2019, 3, 7, 30, 6, 28),
(3497, '2019-07-28', 2019, 3, 7, 30, 0, 29),
(3498, '2019-07-29', 2019, 3, 7, 30, 1, 30),
(3499, '2019-07-30', 2019, 3, 7, 30, 2, 31),
(3500, '2019-07-31', 2019, 3, 8, 30, 3, 1),
(3501, '2019-08-01', 2019, 3, 8, 30, 4, 2),
(3502, '2019-08-02', 2019, 3, 8, 30, 5, 3),
(3503, '2019-08-03', 2019, 3, 8, 31, 6, 4),
(3504, '2019-08-04', 2019, 3, 8, 31, 0, 5),
(3505, '2019-08-05', 2019, 3, 8, 31, 1, 6),
(3506, '2019-08-06', 2019, 3, 8, 31, 2, 7),
(3507, '2019-08-07', 2019, 3, 8, 31, 3, 8),
(3508, '2019-08-08', 2019, 3, 8, 31, 4, 9),
(3509, '2019-08-09', 2019, 3, 8, 31, 5, 10),
(3510, '2019-08-10', 2019, 3, 8, 32, 6, 11),
(3511, '2019-08-11', 2019, 3, 8, 32, 0, 12),
(3512, '2019-08-12', 2019, 3, 8, 32, 1, 13),
(3513, '2019-08-13', 2019, 3, 8, 32, 2, 14),
(3514, '2019-08-14', 2019, 3, 8, 32, 3, 15),
(3515, '2019-08-15', 2019, 3, 8, 32, 4, 16),
(3516, '2019-08-16', 2019, 3, 8, 32, 5, 17),
(3517, '2019-08-17', 2019, 3, 8, 33, 6, 18),
(3518, '2019-08-18', 2019, 3, 8, 33, 0, 19),
(3519, '2019-08-19', 2019, 3, 8, 33, 1, 20),
(3520, '2019-08-20', 2019, 3, 8, 33, 2, 21),
(3521, '2019-08-21', 2019, 3, 8, 33, 3, 22),
(3522, '2019-08-22', 2019, 3, 8, 33, 4, 23),
(3523, '2019-08-23', 2019, 3, 8, 33, 5, 24),
(3524, '2019-08-24', 2019, 3, 8, 34, 6, 25),
(3525, '2019-08-25', 2019, 3, 8, 34, 0, 26),
(3526, '2019-08-26', 2019, 3, 8, 34, 1, 27),
(3527, '2019-08-27', 2019, 3, 8, 34, 2, 28),
(3528, '2019-08-28', 2019, 3, 8, 34, 3, 29),
(3529, '2019-08-29', 2019, 3, 8, 34, 4, 30),
(3530, '2019-08-30', 2019, 3, 8, 34, 5, 31),
(3531, '2019-08-31', 2019, 3, 9, 35, 6, 1),
(3532, '2019-09-01', 2019, 3, 9, 35, 0, 2),
(3533, '2019-09-02', 2019, 3, 9, 35, 1, 3),
(3534, '2019-09-03', 2019, 3, 9, 35, 2, 4),
(3535, '2019-09-04', 2019, 3, 9, 35, 3, 5),
(3536, '2019-09-05', 2019, 3, 9, 35, 4, 6),
(3537, '2019-09-06', 2019, 3, 9, 35, 5, 7),
(3538, '2019-09-07', 2019, 3, 9, 36, 6, 8),
(3539, '2019-09-08', 2019, 3, 9, 36, 0, 9),
(3540, '2019-09-09', 2019, 3, 9, 36, 1, 10),
(3541, '2019-09-10', 2019, 3, 9, 36, 2, 11),
(3542, '2019-09-11', 2019, 3, 9, 36, 3, 12),
(3543, '2019-09-12', 2019, 3, 9, 36, 4, 13),
(3544, '2019-09-13', 2019, 3, 9, 36, 5, 14),
(3545, '2019-09-14', 2019, 3, 9, 37, 6, 15),
(3546, '2019-09-15', 2019, 3, 9, 37, 0, 16),
(3547, '2019-09-16', 2019, 3, 9, 37, 1, 17),
(3548, '2019-09-17', 2019, 3, 9, 37, 2, 18),
(3549, '2019-09-18', 2019, 3, 9, 37, 3, 19),
(3550, '2019-09-19', 2019, 3, 9, 37, 4, 20),
(3551, '2019-09-20', 2019, 3, 9, 37, 5, 21),
(3552, '2019-09-21', 2019, 3, 9, 38, 6, 22),
(3553, '2019-09-22', 2019, 3, 9, 38, 0, 23),
(3554, '2019-09-23', 2019, 3, 9, 38, 1, 24),
(3555, '2019-09-24', 2019, 3, 9, 38, 2, 25),
(3556, '2019-09-25', 2019, 3, 9, 38, 3, 26),
(3557, '2019-09-26', 2019, 3, 9, 38, 4, 27),
(3558, '2019-09-27', 2019, 3, 9, 38, 5, 28),
(3559, '2019-09-28', 2019, 3, 9, 39, 6, 29),
(3560, '2019-09-29', 2019, 3, 9, 39, 0, 30),
(3561, '2019-09-30', 2019, 4, 10, 39, 1, 1),
(3562, '2019-10-01', 2019, 4, 10, 39, 2, 2),
(3563, '2019-10-02', 2019, 4, 10, 39, 3, 3),
(3564, '2019-10-03', 2019, 4, 10, 39, 4, 4),
(3565, '2019-10-04', 2019, 4, 10, 39, 5, 5),
(3566, '2019-10-05', 2019, 4, 10, 40, 6, 6),
(3567, '2019-10-06', 2019, 4, 10, 40, 0, 7),
(3568, '2019-10-07', 2019, 4, 10, 40, 1, 8),
(3569, '2019-10-08', 2019, 4, 10, 40, 2, 9),
(3570, '2019-10-09', 2019, 4, 10, 40, 3, 10),
(3571, '2019-10-10', 2019, 4, 10, 40, 4, 11),
(3572, '2019-10-11', 2019, 4, 10, 40, 5, 12),
(3573, '2019-10-12', 2019, 4, 10, 41, 6, 13),
(3574, '2019-10-13', 2019, 4, 10, 41, 0, 14),
(3575, '2019-10-14', 2019, 4, 10, 41, 1, 15),
(3576, '2019-10-15', 2019, 4, 10, 41, 2, 16),
(3577, '2019-10-16', 2019, 4, 10, 41, 3, 17),
(3578, '2019-10-17', 2019, 4, 10, 41, 4, 18),
(3579, '2019-10-18', 2019, 4, 10, 41, 5, 19),
(3580, '2019-10-19', 2019, 4, 10, 42, 6, 20),
(3581, '2019-10-20', 2019, 4, 10, 42, 0, 21),
(3582, '2019-10-21', 2019, 4, 10, 42, 1, 22),
(3583, '2019-10-22', 2019, 4, 10, 42, 2, 23),
(3584, '2019-10-23', 2019, 4, 10, 42, 3, 24),
(3585, '2019-10-24', 2019, 4, 10, 42, 4, 25),
(3586, '2019-10-25', 2019, 4, 10, 42, 5, 26),
(3587, '2019-10-26', 2019, 4, 10, 43, 6, 27),
(3588, '2019-10-27', 2019, 4, 10, 43, 0, 28),
(3589, '2019-10-28', 2019, 4, 10, 43, 1, 29),
(3590, '2019-10-29', 2019, 4, 10, 43, 2, 30),
(3591, '2019-10-30', 2019, 4, 10, 43, 3, 31),
(3592, '2019-10-31', 2019, 4, 11, 43, 4, 1),
(3593, '2019-11-01', 2019, 4, 11, 43, 5, 2),
(3594, '2019-11-02', 2019, 4, 11, 44, 6, 3),
(3595, '2019-11-03', 2019, 4, 11, 44, 0, 4),
(3596, '2019-11-04', 2019, 4, 11, 44, 1, 5),
(3597, '2019-11-05', 2019, 4, 11, 44, 2, 6),
(3598, '2019-11-06', 2019, 4, 11, 44, 3, 7),
(3599, '2019-11-07', 2019, 4, 11, 44, 4, 8),
(3600, '2019-11-08', 2019, 4, 11, 44, 5, 9),
(3601, '2019-11-09', 2019, 4, 11, 45, 6, 10),
(3602, '2019-11-10', 2019, 4, 11, 45, 0, 11),
(3603, '2019-11-11', 2019, 4, 11, 45, 1, 12),
(3604, '2019-11-12', 2019, 4, 11, 45, 2, 13),
(3605, '2019-11-13', 2019, 4, 11, 45, 3, 14),
(3606, '2019-11-14', 2019, 4, 11, 45, 4, 15),
(3607, '2019-11-15', 2019, 4, 11, 45, 5, 16),
(3608, '2019-11-16', 2019, 4, 11, 46, 6, 17),
(3609, '2019-11-17', 2019, 4, 11, 46, 0, 18),
(3610, '2019-11-18', 2019, 4, 11, 46, 1, 19),
(3611, '2019-11-19', 2019, 4, 11, 46, 2, 20),
(3612, '2019-11-20', 2019, 4, 11, 46, 3, 21),
(3613, '2019-11-21', 2019, 4, 11, 46, 4, 22),
(3614, '2019-11-22', 2019, 4, 11, 46, 5, 23),
(3615, '2019-11-23', 2019, 4, 11, 47, 6, 24),
(3616, '2019-11-24', 2019, 4, 11, 47, 0, 25),
(3617, '2019-11-25', 2019, 4, 11, 47, 1, 26),
(3618, '2019-11-26', 2019, 4, 11, 47, 2, 27),
(3619, '2019-11-27', 2019, 4, 11, 47, 3, 28),
(3620, '2019-11-28', 2019, 4, 11, 47, 4, 29),
(3621, '2019-11-29', 2019, 4, 11, 47, 5, 30),
(3622, '2019-11-30', 2019, 4, 12, 48, 6, 1),
(3623, '2019-12-01', 2019, 4, 12, 48, 0, 2),
(3624, '2019-12-02', 2019, 4, 12, 48, 1, 3),
(3625, '2019-12-03', 2019, 4, 12, 48, 2, 4),
(3626, '2019-12-04', 2019, 4, 12, 48, 3, 5),
(3627, '2019-12-05', 2019, 4, 12, 48, 4, 6),
(3628, '2019-12-06', 2019, 4, 12, 48, 5, 7),
(3629, '2019-12-07', 2019, 4, 12, 49, 6, 8),
(3630, '2019-12-08', 2019, 4, 12, 49, 0, 9),
(3631, '2019-12-09', 2019, 4, 12, 49, 1, 10),
(3632, '2019-12-10', 2019, 4, 12, 49, 2, 11),
(3633, '2019-12-11', 2019, 4, 12, 49, 3, 12),
(3634, '2019-12-12', 2019, 4, 12, 49, 4, 13),
(3635, '2019-12-13', 2019, 4, 12, 49, 5, 14),
(3636, '2019-12-14', 2019, 4, 12, 50, 6, 15),
(3637, '2019-12-15', 2019, 4, 12, 50, 0, 16),
(3638, '2019-12-16', 2019, 4, 12, 50, 1, 17),
(3639, '2019-12-17', 2019, 4, 12, 50, 2, 18),
(3640, '2019-12-18', 2019, 4, 12, 50, 3, 19),
(3641, '2019-12-19', 2019, 4, 12, 50, 4, 20),
(3642, '2019-12-20', 2019, 4, 12, 50, 5, 21),
(3643, '2019-12-21', 2019, 4, 12, 51, 6, 22),
(3644, '2019-12-22', 2019, 4, 12, 51, 0, 23),
(3645, '2019-12-23', 2019, 4, 12, 51, 1, 24),
(3646, '2019-12-24', 2019, 4, 12, 51, 2, 25),
(3647, '2019-12-25', 2019, 4, 12, 51, 3, 26),
(3648, '2019-12-26', 2019, 4, 12, 51, 4, 27),
(3649, '2019-12-27', 2019, 4, 12, 51, 5, 28),
(3650, '2019-12-28', 2019, 4, 12, 52, 6, 29),
(3651, '2019-12-29', 2019, 4, 12, 52, 0, 30),
(3652, '2019-12-30', 2019, 4, 12, 52, 1, 31),
(3653, '2019-12-31', 2020, 1, 1, 0, 2, 1),
(3654, '2020-01-01', 2020, 1, 1, 0, 3, 2),
(3655, '2020-01-02', 2020, 1, 1, 0, 4, 3),
(3656, '2020-01-03', 2020, 1, 1, 0, 5, 4),
(3657, '2020-01-04', 2020, 1, 1, 1, 6, 5),
(3658, '2020-01-05', 2020, 1, 1, 1, 0, 6),
(3659, '2020-01-06', 2020, 1, 1, 1, 1, 7),
(3660, '2020-01-07', 2020, 1, 1, 1, 2, 8),
(3661, '2020-01-08', 2020, 1, 1, 1, 3, 9),
(3662, '2020-01-09', 2020, 1, 1, 1, 4, 10),
(3663, '2020-01-10', 2020, 1, 1, 1, 5, 11),
(3664, '2020-01-11', 2020, 1, 1, 2, 6, 12),
(3665, '2020-01-12', 2020, 1, 1, 2, 0, 13),
(3666, '2020-01-13', 2020, 1, 1, 2, 1, 14),
(3667, '2020-01-14', 2020, 1, 1, 2, 2, 15),
(3668, '2020-01-15', 2020, 1, 1, 2, 3, 16),
(3669, '2020-01-16', 2020, 1, 1, 2, 4, 17),
(3670, '2020-01-17', 2020, 1, 1, 2, 5, 18),
(3671, '2020-01-18', 2020, 1, 1, 3, 6, 19),
(3672, '2020-01-19', 2020, 1, 1, 3, 0, 20),
(3673, '2020-01-20', 2020, 1, 1, 3, 1, 21),
(3674, '2020-01-21', 2020, 1, 1, 3, 2, 22),
(3675, '2020-01-22', 2020, 1, 1, 3, 3, 23),
(3676, '2020-01-23', 2020, 1, 1, 3, 4, 24),
(3677, '2020-01-24', 2020, 1, 1, 3, 5, 25),
(3678, '2020-01-25', 2020, 1, 1, 4, 6, 26),
(3679, '2020-01-26', 2020, 1, 1, 4, 0, 27),
(3680, '2020-01-27', 2020, 1, 1, 4, 1, 28),
(3681, '2020-01-28', 2020, 1, 1, 4, 2, 29),
(3682, '2020-01-29', 2020, 1, 1, 4, 3, 30),
(3683, '2020-01-30', 2020, 1, 1, 4, 4, 31),
(3684, '2020-01-31', 2020, 1, 2, 4, 5, 1),
(3685, '2020-02-01', 2020, 1, 2, 5, 6, 2),
(3686, '2020-02-02', 2020, 1, 2, 5, 0, 3),
(3687, '2020-02-03', 2020, 1, 2, 5, 1, 4),
(3688, '2020-02-04', 2020, 1, 2, 5, 2, 5),
(3689, '2020-02-05', 2020, 1, 2, 5, 3, 6),
(3690, '2020-02-06', 2020, 1, 2, 5, 4, 7),
(3691, '2020-02-07', 2020, 1, 2, 5, 5, 8),
(3692, '2020-02-08', 2020, 1, 2, 6, 6, 9),
(3693, '2020-02-09', 2020, 1, 2, 6, 0, 10),
(3694, '2020-02-10', 2020, 1, 2, 6, 1, 11),
(3695, '2020-02-11', 2020, 1, 2, 6, 2, 12),
(3696, '2020-02-12', 2020, 1, 2, 6, 3, 13),
(3697, '2020-02-13', 2020, 1, 2, 6, 4, 14),
(3698, '2020-02-14', 2020, 1, 2, 6, 5, 15),
(3699, '2020-02-15', 2020, 1, 2, 7, 6, 16),
(3700, '2020-02-16', 2020, 1, 2, 7, 0, 17),
(3701, '2020-02-17', 2020, 1, 2, 7, 1, 18),
(3702, '2020-02-18', 2020, 1, 2, 7, 2, 19),
(3703, '2020-02-19', 2020, 1, 2, 7, 3, 20),
(3704, '2020-02-20', 2020, 1, 2, 7, 4, 21),
(3705, '2020-02-21', 2020, 1, 2, 7, 5, 22),
(3706, '2020-02-22', 2020, 1, 2, 8, 6, 23),
(3707, '2020-02-23', 2020, 1, 2, 8, 0, 24),
(3708, '2020-02-24', 2020, 1, 2, 8, 1, 25),
(3709, '2020-02-25', 2020, 1, 2, 8, 2, 26),
(3710, '2020-02-26', 2020, 1, 2, 8, 3, 27),
(3711, '2020-02-27', 2020, 1, 2, 8, 4, 28),
(3712, '2020-02-28', 2020, 1, 2, 8, 5, 29),
(3713, '2020-02-29', 2020, 1, 3, 9, 6, 1),
(3714, '2020-03-01', 2020, 1, 3, 9, 0, 2),
(3715, '2020-03-02', 2020, 1, 3, 9, 1, 3),
(3716, '2020-03-03', 2020, 1, 3, 9, 2, 4),
(3717, '2020-03-04', 2020, 1, 3, 9, 3, 5),
(3718, '2020-03-05', 2020, 1, 3, 9, 4, 6),
(3719, '2020-03-06', 2020, 1, 3, 9, 5, 7),
(3720, '2020-03-07', 2020, 1, 3, 10, 6, 8),
(3721, '2020-03-08', 2020, 1, 3, 10, 0, 9),
(3722, '2020-03-09', 2020, 1, 3, 10, 1, 10),
(3723, '2020-03-10', 2020, 1, 3, 10, 2, 11),
(3724, '2020-03-11', 2020, 1, 3, 10, 3, 12),
(3725, '2020-03-12', 2020, 1, 3, 10, 4, 13),
(3726, '2020-03-13', 2020, 1, 3, 10, 5, 14),
(3727, '2020-03-14', 2020, 1, 3, 11, 6, 15),
(3728, '2020-03-15', 2020, 1, 3, 11, 0, 16),
(3729, '2020-03-16', 2020, 1, 3, 11, 1, 17),
(3730, '2020-03-17', 2020, 1, 3, 11, 2, 18),
(3731, '2020-03-18', 2020, 1, 3, 11, 3, 19),
(3732, '2020-03-19', 2020, 1, 3, 11, 4, 20),
(3733, '2020-03-20', 2020, 1, 3, 11, 5, 21),
(3734, '2020-03-21', 2020, 1, 3, 12, 6, 22),
(3735, '2020-03-22', 2020, 1, 3, 12, 0, 23),
(3736, '2020-03-23', 2020, 1, 3, 12, 1, 24),
(3737, '2020-03-24', 2020, 1, 3, 12, 2, 25),
(3738, '2020-03-25', 2020, 1, 3, 12, 3, 26),
(3739, '2020-03-26', 2020, 1, 3, 12, 4, 27),
(3740, '2020-03-27', 2020, 1, 3, 12, 5, 28),
(3741, '2020-03-28', 2020, 1, 3, 13, 6, 29),
(3742, '2020-03-29', 2020, 1, 3, 13, 0, 30),
(3743, '2020-03-30', 2020, 1, 3, 13, 1, 31),
(3744, '2020-03-31', 2020, 2, 4, 13, 2, 1),
(3745, '2020-04-01', 2020, 2, 4, 13, 3, 2),
(3746, '2020-04-02', 2020, 2, 4, 13, 4, 3),
(3747, '2020-04-03', 2020, 2, 4, 13, 5, 4),
(3748, '2020-04-04', 2020, 2, 4, 14, 6, 5),
(3749, '2020-04-05', 2020, 2, 4, 14, 0, 6),
(3750, '2020-04-06', 2020, 2, 4, 14, 1, 7),
(3751, '2020-04-07', 2020, 2, 4, 14, 2, 8),
(3752, '2020-04-08', 2020, 2, 4, 14, 3, 9),
(3753, '2020-04-09', 2020, 2, 4, 14, 4, 10),
(3754, '2020-04-10', 2020, 2, 4, 14, 5, 11),
(3755, '2020-04-11', 2020, 2, 4, 15, 6, 12),
(3756, '2020-04-12', 2020, 2, 4, 15, 0, 13),
(3757, '2020-04-13', 2020, 2, 4, 15, 1, 14),
(3758, '2020-04-14', 2020, 2, 4, 15, 2, 15),
(3759, '2020-04-15', 2020, 2, 4, 15, 3, 16),
(3760, '2020-04-16', 2020, 2, 4, 15, 4, 17),
(3761, '2020-04-17', 2020, 2, 4, 15, 5, 18),
(3762, '2020-04-18', 2020, 2, 4, 16, 6, 19),
(3763, '2020-04-19', 2020, 2, 4, 16, 0, 20),
(3764, '2020-04-20', 2020, 2, 4, 16, 1, 21),
(3765, '2020-04-21', 2020, 2, 4, 16, 2, 22),
(3766, '2020-04-22', 2020, 2, 4, 16, 3, 23),
(3767, '2020-04-23', 2020, 2, 4, 16, 4, 24),
(3768, '2020-04-24', 2020, 2, 4, 16, 5, 25),
(3769, '2020-04-25', 2020, 2, 4, 17, 6, 26),
(3770, '2020-04-26', 2020, 2, 4, 17, 0, 27),
(3771, '2020-04-27', 2020, 2, 4, 17, 1, 28),
(3772, '2020-04-28', 2020, 2, 4, 17, 2, 29),
(3773, '2020-04-29', 2020, 2, 4, 17, 3, 30),
(3774, '2020-04-30', 2020, 2, 5, 17, 4, 1),
(3775, '2020-05-01', 2020, 2, 5, 17, 5, 2),
(3776, '2020-05-02', 2020, 2, 5, 18, 6, 3),
(3777, '2020-05-03', 2020, 2, 5, 18, 0, 4),
(3778, '2020-05-04', 2020, 2, 5, 18, 1, 5),
(3779, '2020-05-05', 2020, 2, 5, 18, 2, 6),
(3780, '2020-05-06', 2020, 2, 5, 18, 3, 7),
(3781, '2020-05-07', 2020, 2, 5, 18, 4, 8),
(3782, '2020-05-08', 2020, 2, 5, 18, 5, 9),
(3783, '2020-05-09', 2020, 2, 5, 19, 6, 10),
(3784, '2020-05-10', 2020, 2, 5, 19, 0, 11),
(3785, '2020-05-11', 2020, 2, 5, 19, 1, 12),
(3786, '2020-05-12', 2020, 2, 5, 19, 2, 13),
(3787, '2020-05-13', 2020, 2, 5, 19, 3, 14),
(3788, '2020-05-14', 2020, 2, 5, 19, 4, 15),
(3789, '2020-05-15', 2020, 2, 5, 19, 5, 16),
(3790, '2020-05-16', 2020, 2, 5, 20, 6, 17),
(3791, '2020-05-17', 2020, 2, 5, 20, 0, 18),
(3792, '2020-05-18', 2020, 2, 5, 20, 1, 19),
(3793, '2020-05-19', 2020, 2, 5, 20, 2, 20),
(3794, '2020-05-20', 2020, 2, 5, 20, 3, 21),
(3795, '2020-05-21', 2020, 2, 5, 20, 4, 22),
(3796, '2020-05-22', 2020, 2, 5, 20, 5, 23),
(3797, '2020-05-23', 2020, 2, 5, 21, 6, 24),
(3798, '2020-05-24', 2020, 2, 5, 21, 0, 25),
(3799, '2020-05-25', 2020, 2, 5, 21, 1, 26),
(3800, '2020-05-26', 2020, 2, 5, 21, 2, 27),
(3801, '2020-05-27', 2020, 2, 5, 21, 3, 28),
(3802, '2020-05-28', 2020, 2, 5, 21, 4, 29),
(3803, '2020-05-29', 2020, 2, 5, 21, 5, 30),
(3804, '2020-05-30', 2020, 2, 5, 22, 6, 31),
(3805, '2020-05-31', 2020, 2, 6, 22, 0, 1),
(3806, '2020-06-01', 2020, 2, 6, 22, 1, 2),
(3807, '2020-06-02', 2020, 2, 6, 22, 2, 3),
(3808, '2020-06-03', 2020, 2, 6, 22, 3, 4),
(3809, '2020-06-04', 2020, 2, 6, 22, 4, 5),
(3810, '2020-06-05', 2020, 2, 6, 22, 5, 6),
(3811, '2020-06-06', 2020, 2, 6, 23, 6, 7),
(3812, '2020-06-07', 2020, 2, 6, 23, 0, 8),
(3813, '2020-06-08', 2020, 2, 6, 23, 1, 9),
(3814, '2020-06-09', 2020, 2, 6, 23, 2, 10),
(3815, '2020-06-10', 2020, 2, 6, 23, 3, 11),
(3816, '2020-06-11', 2020, 2, 6, 23, 4, 12),
(3817, '2020-06-12', 2020, 2, 6, 23, 5, 13),
(3818, '2020-06-13', 2020, 2, 6, 24, 6, 14),
(3819, '2020-06-14', 2020, 2, 6, 24, 0, 15),
(3820, '2020-06-15', 2020, 2, 6, 24, 1, 16),
(3821, '2020-06-16', 2020, 2, 6, 24, 2, 17),
(3822, '2020-06-17', 2020, 2, 6, 24, 3, 18),
(3823, '2020-06-18', 2020, 2, 6, 24, 4, 19),
(3824, '2020-06-19', 2020, 2, 6, 24, 5, 20),
(3825, '2020-06-20', 2020, 2, 6, 25, 6, 21),
(3826, '2020-06-21', 2020, 2, 6, 25, 0, 22),
(3827, '2020-06-22', 2020, 2, 6, 25, 1, 23),
(3828, '2020-06-23', 2020, 2, 6, 25, 2, 24),
(3829, '2020-06-24', 2020, 2, 6, 25, 3, 25),
(3830, '2020-06-25', 2020, 2, 6, 25, 4, 26),
(3831, '2020-06-26', 2020, 2, 6, 25, 5, 27),
(3832, '2020-06-27', 2020, 2, 6, 26, 6, 28),
(3833, '2020-06-28', 2020, 2, 6, 26, 0, 29),
(3834, '2020-06-29', 2020, 2, 6, 26, 1, 30),
(3835, '2020-06-30', 2020, 3, 7, 26, 2, 1),
(3836, '2020-07-01', 2020, 3, 7, 26, 3, 2),
(3837, '2020-07-02', 2020, 3, 7, 26, 4, 3),
(3838, '2020-07-03', 2020, 3, 7, 26, 5, 4),
(3839, '2020-07-04', 2020, 3, 7, 27, 6, 5),
(3840, '2020-07-05', 2020, 3, 7, 27, 0, 6),
(3841, '2020-07-06', 2020, 3, 7, 27, 1, 7),
(3842, '2020-07-07', 2020, 3, 7, 27, 2, 8),
(3843, '2020-07-08', 2020, 3, 7, 27, 3, 9),
(3844, '2020-07-09', 2020, 3, 7, 27, 4, 10),
(3845, '2020-07-10', 2020, 3, 7, 27, 5, 11),
(3846, '2020-07-11', 2020, 3, 7, 28, 6, 12),
(3847, '2020-07-12', 2020, 3, 7, 28, 0, 13),
(3848, '2020-07-13', 2020, 3, 7, 28, 1, 14),
(3849, '2020-07-14', 2020, 3, 7, 28, 2, 15),
(3850, '2020-07-15', 2020, 3, 7, 28, 3, 16),
(3851, '2020-07-16', 2020, 3, 7, 28, 4, 17),
(3852, '2020-07-17', 2020, 3, 7, 28, 5, 18),
(3853, '2020-07-18', 2020, 3, 7, 29, 6, 19),
(3854, '2020-07-19', 2020, 3, 7, 29, 0, 20),
(3855, '2020-07-20', 2020, 3, 7, 29, 1, 21),
(3856, '2020-07-21', 2020, 3, 7, 29, 2, 22),
(3857, '2020-07-22', 2020, 3, 7, 29, 3, 23),
(3858, '2020-07-23', 2020, 3, 7, 29, 4, 24),
(3859, '2020-07-24', 2020, 3, 7, 29, 5, 25),
(3860, '2020-07-25', 2020, 3, 7, 30, 6, 26),
(3861, '2020-07-26', 2020, 3, 7, 30, 0, 27),
(3862, '2020-07-27', 2020, 3, 7, 30, 1, 28),
(3863, '2020-07-28', 2020, 3, 7, 30, 2, 29),
(3864, '2020-07-29', 2020, 3, 7, 30, 3, 30),
(3865, '2020-07-30', 2020, 3, 7, 30, 4, 31),
(3866, '2020-07-31', 2020, 3, 8, 30, 5, 1),
(3867, '2020-08-01', 2020, 3, 8, 31, 6, 2),
(3868, '2020-08-02', 2020, 3, 8, 31, 0, 3),
(3869, '2020-08-03', 2020, 3, 8, 31, 1, 4),
(3870, '2020-08-04', 2020, 3, 8, 31, 2, 5),
(3871, '2020-08-05', 2020, 3, 8, 31, 3, 6),
(3872, '2020-08-06', 2020, 3, 8, 31, 4, 7),
(3873, '2020-08-07', 2020, 3, 8, 31, 5, 8),
(3874, '2020-08-08', 2020, 3, 8, 32, 6, 9),
(3875, '2020-08-09', 2020, 3, 8, 32, 0, 10),
(3876, '2020-08-10', 2020, 3, 8, 32, 1, 11),
(3877, '2020-08-11', 2020, 3, 8, 32, 2, 12),
(3878, '2020-08-12', 2020, 3, 8, 32, 3, 13),
(3879, '2020-08-13', 2020, 3, 8, 32, 4, 14),
(3880, '2020-08-14', 2020, 3, 8, 32, 5, 15),
(3881, '2020-08-15', 2020, 3, 8, 33, 6, 16),
(3882, '2020-08-16', 2020, 3, 8, 33, 0, 17),
(3883, '2020-08-17', 2020, 3, 8, 33, 1, 18),
(3884, '2020-08-18', 2020, 3, 8, 33, 2, 19),
(3885, '2020-08-19', 2020, 3, 8, 33, 3, 20),
(3886, '2020-08-20', 2020, 3, 8, 33, 4, 21),
(3887, '2020-08-21', 2020, 3, 8, 33, 5, 22),
(3888, '2020-08-22', 2020, 3, 8, 34, 6, 23),
(3889, '2020-08-23', 2020, 3, 8, 34, 0, 24),
(3890, '2020-08-24', 2020, 3, 8, 34, 1, 25),
(3891, '2020-08-25', 2020, 3, 8, 34, 2, 26),
(3892, '2020-08-26', 2020, 3, 8, 34, 3, 27),
(3893, '2020-08-27', 2020, 3, 8, 34, 4, 28),
(3894, '2020-08-28', 2020, 3, 8, 34, 5, 29),
(3895, '2020-08-29', 2020, 3, 8, 35, 6, 30),
(3896, '2020-08-30', 2020, 3, 8, 35, 0, 31),
(3897, '2020-08-31', 2020, 3, 9, 35, 1, 1),
(3898, '2020-09-01', 2020, 3, 9, 35, 2, 2),
(3899, '2020-09-02', 2020, 3, 9, 35, 3, 3),
(3900, '2020-09-03', 2020, 3, 9, 35, 4, 4),
(3901, '2020-09-04', 2020, 3, 9, 35, 5, 5),
(3902, '2020-09-05', 2020, 3, 9, 36, 6, 6),
(3903, '2020-09-06', 2020, 3, 9, 36, 0, 7),
(3904, '2020-09-07', 2020, 3, 9, 36, 1, 8),
(3905, '2020-09-08', 2020, 3, 9, 36, 2, 9),
(3906, '2020-09-09', 2020, 3, 9, 36, 3, 10),
(3907, '2020-09-10', 2020, 3, 9, 36, 4, 11),
(3908, '2020-09-11', 2020, 3, 9, 36, 5, 12),
(3909, '2020-09-12', 2020, 3, 9, 37, 6, 13),
(3910, '2020-09-13', 2020, 3, 9, 37, 0, 14),
(3911, '2020-09-14', 2020, 3, 9, 37, 1, 15),
(3912, '2020-09-15', 2020, 3, 9, 37, 2, 16),
(3913, '2020-09-16', 2020, 3, 9, 37, 3, 17),
(3914, '2020-09-17', 2020, 3, 9, 37, 4, 18),
(3915, '2020-09-18', 2020, 3, 9, 37, 5, 19),
(3916, '2020-09-19', 2020, 3, 9, 38, 6, 20),
(3917, '2020-09-20', 2020, 3, 9, 38, 0, 21),
(3918, '2020-09-21', 2020, 3, 9, 38, 1, 22),
(3919, '2020-09-22', 2020, 3, 9, 38, 2, 23),
(3920, '2020-09-23', 2020, 3, 9, 38, 3, 24),
(3921, '2020-09-24', 2020, 3, 9, 38, 4, 25),
(3922, '2020-09-25', 2020, 3, 9, 38, 5, 26),
(3923, '2020-09-26', 2020, 3, 9, 39, 6, 27),
(3924, '2020-09-27', 2020, 3, 9, 39, 0, 28),
(3925, '2020-09-28', 2020, 3, 9, 39, 1, 29),
(3926, '2020-09-29', 2020, 3, 9, 39, 2, 30),
(3927, '2020-09-30', 2020, 4, 10, 39, 3, 1),
(3928, '2020-10-01', 2020, 4, 10, 39, 4, 2),
(3929, '2020-10-02', 2020, 4, 10, 39, 5, 3),
(3930, '2020-10-03', 2020, 4, 10, 40, 6, 4),
(3931, '2020-10-04', 2020, 4, 10, 40, 0, 5),
(3932, '2020-10-05', 2020, 4, 10, 40, 1, 6),
(3933, '2020-10-06', 2020, 4, 10, 40, 2, 7),
(3934, '2020-10-07', 2020, 4, 10, 40, 3, 8),
(3935, '2020-10-08', 2020, 4, 10, 40, 4, 9),
(3936, '2020-10-09', 2020, 4, 10, 40, 5, 10),
(3937, '2020-10-10', 2020, 4, 10, 41, 6, 11),
(3938, '2020-10-11', 2020, 4, 10, 41, 0, 12),
(3939, '2020-10-12', 2020, 4, 10, 41, 1, 13),
(3940, '2020-10-13', 2020, 4, 10, 41, 2, 14),
(3941, '2020-10-14', 2020, 4, 10, 41, 3, 15),
(3942, '2020-10-15', 2020, 4, 10, 41, 4, 16),
(3943, '2020-10-16', 2020, 4, 10, 41, 5, 17),
(3944, '2020-10-17', 2020, 4, 10, 42, 6, 18),
(3945, '2020-10-18', 2020, 4, 10, 42, 0, 19),
(3946, '2020-10-19', 2020, 4, 10, 42, 1, 20),
(3947, '2020-10-20', 2020, 4, 10, 42, 2, 21),
(3948, '2020-10-21', 2020, 4, 10, 42, 3, 22),
(3949, '2020-10-22', 2020, 4, 10, 42, 4, 23),
(3950, '2020-10-23', 2020, 4, 10, 42, 5, 24),
(3951, '2020-10-24', 2020, 4, 10, 43, 6, 25),
(3952, '2020-10-25', 2020, 4, 10, 43, 0, 26),
(3953, '2020-10-26', 2020, 4, 10, 43, 1, 27),
(3954, '2020-10-27', 2020, 4, 10, 43, 2, 28),
(3955, '2020-10-28', 2020, 4, 10, 43, 3, 29),
(3956, '2020-10-29', 2020, 4, 10, 43, 4, 30),
(3957, '2020-10-30', 2020, 4, 10, 43, 5, 31),
(3958, '2020-10-31', 2020, 4, 11, 44, 6, 1),
(3959, '2020-11-01', 2020, 4, 11, 44, 0, 2),
(3960, '2020-11-02', 2020, 4, 11, 44, 1, 3),
(3961, '2020-11-03', 2020, 4, 11, 44, 2, 4),
(3962, '2020-11-04', 2020, 4, 11, 44, 3, 5),
(3963, '2020-11-05', 2020, 4, 11, 44, 4, 6),
(3964, '2020-11-06', 2020, 4, 11, 44, 5, 7),
(3965, '2020-11-07', 2020, 4, 11, 45, 6, 8),
(3966, '2020-11-08', 2020, 4, 11, 45, 0, 9),
(3967, '2020-11-09', 2020, 4, 11, 45, 1, 10),
(3968, '2020-11-10', 2020, 4, 11, 45, 2, 11),
(3969, '2020-11-11', 2020, 4, 11, 45, 3, 12),
(3970, '2020-11-12', 2020, 4, 11, 45, 4, 13),
(3971, '2020-11-13', 2020, 4, 11, 45, 5, 14),
(3972, '2020-11-14', 2020, 4, 11, 46, 6, 15),
(3973, '2020-11-15', 2020, 4, 11, 46, 0, 16),
(3974, '2020-11-16', 2020, 4, 11, 46, 1, 17),
(3975, '2020-11-17', 2020, 4, 11, 46, 2, 18),
(3976, '2020-11-18', 2020, 4, 11, 46, 3, 19),
(3977, '2020-11-19', 2020, 4, 11, 46, 4, 20),
(3978, '2020-11-20', 2020, 4, 11, 46, 5, 21),
(3979, '2020-11-21', 2020, 4, 11, 47, 6, 22),
(3980, '2020-11-22', 2020, 4, 11, 47, 0, 23),
(3981, '2020-11-23', 2020, 4, 11, 47, 1, 24),
(3982, '2020-11-24', 2020, 4, 11, 47, 2, 25),
(3983, '2020-11-25', 2020, 4, 11, 47, 3, 26),
(3984, '2020-11-26', 2020, 4, 11, 47, 4, 27),
(3985, '2020-11-27', 2020, 4, 11, 47, 5, 28),
(3986, '2020-11-28', 2020, 4, 11, 48, 6, 29),
(3987, '2020-11-29', 2020, 4, 11, 48, 0, 30),
(3988, '2020-11-30', 2020, 4, 12, 48, 1, 1),
(3989, '2020-12-01', 2020, 4, 12, 48, 2, 2),
(3990, '2020-12-02', 2020, 4, 12, 48, 3, 3),
(3991, '2020-12-03', 2020, 4, 12, 48, 4, 4),
(3992, '2020-12-04', 2020, 4, 12, 48, 5, 5),
(3993, '2020-12-05', 2020, 4, 12, 49, 6, 6),
(3994, '2020-12-06', 2020, 4, 12, 49, 0, 7),
(3995, '2020-12-07', 2020, 4, 12, 49, 1, 8),
(3996, '2020-12-08', 2020, 4, 12, 49, 2, 9),
(3997, '2020-12-09', 2020, 4, 12, 49, 3, 10),
(3998, '2020-12-10', 2020, 4, 12, 49, 4, 11),
(3999, '2020-12-11', 2020, 4, 12, 49, 5, 12),
(4000, '2020-12-12', 2020, 4, 12, 50, 6, 13),
(4001, '2020-12-13', 2020, 4, 12, 50, 0, 14),
(4002, '2020-12-14', 2020, 4, 12, 50, 1, 15),
(4003, '2020-12-15', 2020, 4, 12, 50, 2, 16),
(4004, '2020-12-16', 2020, 4, 12, 50, 3, 17),
(4005, '2020-12-17', 2020, 4, 12, 50, 4, 18),
(4006, '2020-12-18', 2020, 4, 12, 50, 5, 19),
(4007, '2020-12-19', 2020, 4, 12, 51, 6, 20),
(4008, '2020-12-20', 2020, 4, 12, 51, 0, 21),
(4009, '2020-12-21', 2020, 4, 12, 51, 1, 22),
(4010, '2020-12-22', 2020, 4, 12, 51, 2, 23),
(4011, '2020-12-23', 2020, 4, 12, 51, 3, 24),
(4012, '2020-12-24', 2020, 4, 12, 51, 4, 25),
(4013, '2020-12-25', 2020, 4, 12, 51, 5, 26),
(4014, '2020-12-26', 2020, 4, 12, 52, 6, 27),
(4015, '2020-12-27', 2020, 4, 12, 52, 0, 28),
(4016, '2020-12-28', 2020, 4, 12, 52, 1, 29),
(4017, '2020-12-29', 2020, 4, 12, 52, 2, 30),
(4018, '2020-12-30', 2020, 4, 12, 52, 3, 31);
-- --------------------------------------------------------
--
-- 表的结构 `razor_dim_devicebrand`
--
CREATE TABLE IF NOT EXISTS `razor_dim_devicebrand` (
`devicebrand_sk` int(11) NOT NULL,
`devicebrand_name` varchar(60) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- 表的结构 `razor_dim_devicelanguage`
--
CREATE TABLE IF NOT EXISTS `razor_dim_devicelanguage` (
`devicelanguage_sk` int(11) NOT NULL,
`devicelanguage_name` varchar(60) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- 表的结构 `razor_dim_deviceos`
--
CREATE TABLE IF NOT EXISTS `razor_dim_deviceos` (
`deviceos_sk` int(11) NOT NULL,
`deviceos_name` varchar(256) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- 表的结构 `razor_dim_deviceresolution`
--
CREATE TABLE IF NOT EXISTS `razor_dim_deviceresolution` (
`deviceresolution_sk` int(11) NOT NULL,
`deviceresolution_name` varchar(60) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- 表的结构 `razor_dim_devicesupplier`
--
CREATE TABLE IF NOT EXISTS `razor_dim_devicesupplier` (
`devicesupplier_sk` int(11) NOT NULL,
`mccmnc` varchar(16) NOT NULL,
`devicesupplier_name` varchar(128) NOT NULL DEFAULT 'unknown',
`countrycode` varchar(8) DEFAULT NULL,
`countryname` varchar(128) DEFAULT NULL
) ENGINE=InnoDB AUTO_INCREMENT=1068 DEFAULT CHARSET=utf8;
--
-- 转存表中的数据 `razor_dim_devicesupplier`
--
INSERT INTO `razor_dim_devicesupplier` (`devicesupplier_sk`, `mccmnc`, `devicesupplier_name`, `countrycode`, `countryname`) VALUES
(1, '20201', 'Cosmote Greece', '202', 'GR'),
(2, '20205', 'Vodafone - Panafon Greece', '202', 'GR'),
(3, '20209', 'Info Quest S.A. Greece', '202', 'GR'),
(4, '20210', 'Telestet Greece', '202', 'GR'),
(5, '20402', 'Tele2 (Netherlands) B.V.', '204', 'NL'),
(6, '20404', 'Vodafone Libertel N.V. Netherlands', '204', 'NL'),
(7, '20408', 'KPN Telecom B.V. Netherlands', '204', 'NL'),
(8, '20412', 'BT Ignite Nederland B.V.', '204', 'NL'),
(9, '20416', 'BEN Nederland B.V.', '204', 'NL'),
(10, '20420', 'Dutchtone N.V. Netherlands', '204', 'NL'),
(11, '20421', 'NS Railinfrabeheer B.V. Netherlands', '204', 'NL'),
(12, '20601', 'Proximus Belgium', '206', 'BE'),
(13, '20610', 'Mobistar Belgium', '206', 'BE'),
(14, '20620', 'Base Belgium', '206', 'BE'),
(15, '20801', 'Orange', '208', 'FR'),
(16, '20802', 'Orange', '208', 'FR'),
(17, '20805', 'Globalstar Europe France', '208', 'FR'),
(18, '20806', 'Globalstar Europe France', '208', 'FR'),
(19, '20807', 'Globalstar Europe France', '208', 'FR'),
(20, '20810', 'SFR', '208', 'FR'),
(21, '20811', 'SFR', '208', 'FR'),
(22, '20813', 'SFR', '208', 'FR'),
(23, '20815', 'Free Mobile', '208', 'FR'),
(24, '20816', 'Free Mobile', '208', 'FR'),
(25, '20820', 'Bouygues Telecom', '208', 'FR'),
(26, '20821', 'Bouygues Telecom', '208', 'FR'),
(27, '20823', 'Virgin Mobile', '208', 'FR'),
(28, '20825', 'Lycamobile', '208', 'FR'),
(29, '20826', 'NRJ Mobile', '208', 'FR'),
(30, '20827', 'Afone Mobile', '208', 'FR'),
(31, '20830', 'Symacom', '208', 'FR'),
(32, '20888', 'Bouygues Telecom', '208', 'FR'),
(33, '21303', 'MobilandAndorra', '213', 'AD'),
(34, '21401', 'Vodafone Spain', '214', 'ES'),
(35, '21403', 'Amena Spain', '214', 'ES'),
(36, '21404', 'Xfera Spain', '214', 'ES'),
(37, '21407', 'Movistar Spain', '214', 'ES'),
(38, '21601', 'Pannon GSM Hungary', '216', 'HU'),
(39, '21630', 'T-Mobile Hungary', '216', 'HU'),
(40, '21670', 'Vodafone Hungary', '216', 'HU'),
(41, '21803', 'Eronet Mobile Communications Ltd. Bosnia and Herzegovina', '218', 'BA'),
(42, '21805', 'MOBIS (Mobilina Srpske) Bosnia and Herzegovina', '218', 'BA'),
(43, '21890', 'GSMBIH Bosnia and Herzegovina', '218', 'BA'),
(44, '21901', 'Cronet Croatia', '219', 'HR'),
(45, '21910', 'VIPnet Croatia', '219', 'HR'),
(46, '22001', 'Mobtel Serbia', '220', 'YU'),
(47, '22002', 'Promonte GSM Serbia', '220', 'YU'),
(48, '22003', 'Telekom Srbija', '220', 'YU'),
(49, '22004', 'Monet Serbia', '220', 'YU'),
(50, '22201', 'Telecom Italia Mobile (TIM)', '222', 'IT'),
(51, '22202', 'Elsacom Italy', '222', 'IT'),
(52, '22210', 'Omnitel Pronto Italia (OPI)', '222', 'IT'),
(53, '22277', 'IPSE 2000 Italy', '222', 'IT'),
(54, '22288', 'Wind Italy', '222', 'IT'),
(55, '22298', 'Blu Italy', '222', 'IT'),
(56, '22299', 'H3G Italy', '222', 'IT'),
(57, '22601', 'Vodafone Romania SA', '226', 'RO'),
(58, '22603', 'Cosmorom Romania', '226', 'RO'),
(59, '22610', 'Orange Romania', '226', 'RO'),
(60, '22801', 'Swisscom GSM', '228', 'CH'),
(61, '22802', 'Sunrise GSM Switzerland', '228', 'CH'),
(62, '22803', 'Orange Switzerland', '228', 'CH'),
(63, '22805', 'Togewanet AG Switzerland', '228', 'CH'),
(64, '22806', 'SBB AG Switzerland', '228', 'CH'),
(65, '22807', 'IN&Phone SA Switzerland', '228', 'CH'),
(66, '22808', 'Tele2 Telecommunications AG Switzerland', '228', 'CH'),
(67, '22812', 'Sunrise UMTS Switzerland', '228', 'CH'),
(68, '22850', '3G Mabile AG Switzerland', '228', 'CH'),
(69, '22851', 'Global Networks Schweiz AG', '228', 'CH'),
(70, '23001', 'RadioMobil a.s., T-Mobile Czech Rep.', '230', 'CZ'),
(71, '23002', 'Eurotel Praha, spol. Sro., Eurotel Czech Rep.', '230', 'CZ'),
(72, '23003', 'Cesky Mobil a.s., Oskar', '230', 'CZ'),
(73, '23099', 'Cesky Mobil a.s., R&D Centre', '230', 'CZ'),
(74, '23101', 'Orange, GSM Slovakia', '231', 'SK'),
(75, '23102', 'Eurotel, GSM & NMT Slovakia', '231', 'SK'),
(76, '23104', 'Eurotel, UMTS Slovakia', '231', 'SK'),
(77, '23105', 'Orange, UMTS Slovakia', '231', 'SK'),
(78, '23201', 'A1 Austria', '232', 'AT'),
(79, '23203', 'T-Mobile Austria', '232', 'AT'),
(80, '23205', 'One Austria', '232', 'AT'),
(81, '23207', 'tele.ring Austria', '232', 'AT'),
(82, '23208', 'Telefonica Austria', '232', 'AT'),
(83, '23209', 'One Austria', '232', 'AT'),
(84, '23210', 'Hutchison 3G Austria', '232', 'AT'),
(85, '23402', 'O2 UK Ltd.', '234', 'GB'),
(86, '23410', 'O2 UK Ltd.', '234', 'GB'),
(87, '23411', 'O2 UK Ltd.', '234', 'GB'),
(88, '23412', 'Railtrack Plc UK', '234', 'GB'),
(89, '23415', 'Vodafone', '234', 'GB'),
(90, '23420', 'Hutchison 3G UK Ltd.', '234', 'GB'),
(91, '23430', 'T-Mobile UK', '234', 'GB'),
(92, '23431', 'T-Mobile UK', '234', 'GB'),
(93, '23432', 'T-Mobile UK', '234', 'GB'),
(94, '23433', 'Orange UK', '234', 'GB'),
(95, '23434', 'Orange UK', '234', 'GB'),
(96, '23450', 'Jersey Telecom UK', '234', 'GB'),
(97, '23455', 'Guensey Telecom UK', '234', 'GB'),
(98, '23458', 'Manx Telecom UK', '234', 'GB'),
(99, '23475', 'Inquam Telecom (Holdings) Ltd. UK', '234', 'GB'),
(100, '23801', 'TDC Mobil Denmark', '238', 'DK'),
(101, '23802', 'Sonofon Denmark', '238', 'DK'),
(102, '23803', 'MIGway A/S Denmark', '238', 'DK'),
(103, '23806', 'Hi3G Denmark', '238', 'DK'),
(104, '23807', 'Barablu Mobile Ltd. Denmark', '238', 'DK'),
(105, '23810', 'TDC Mobil Denmark', '238', 'DK'),
(106, '23820', 'Telia Denmark', '238', 'DK'),
(107, '23830', 'Telia Mobile Denmark', '238', 'DK'),
(108, '23877', 'Tele2 Denmark', '238', 'DK'),
(109, '24001', 'Telia Sonera AB Sweden', '240', 'SE'),
(110, '24002', 'H3G Access AB Sweden', '240', 'SE'),
(111, '24003', 'Nordisk Mobiltelefon AS Sweden', '240', 'SE'),
(112, '24004', '3G Infrastructure Services AB Sweden', '240', 'SE'),
(113, '24005', 'Svenska UMTS-Nat AB', '240', 'SE'),
(114, '24006', 'Telenor Sverige AB', '240', 'SE'),
(115, '24007', 'Tele2 Sverige AB', '240', 'SE'),
(116, '24008', 'Telenor Sverige AB', '240', 'SE'),
(117, '24009', 'Telenor Mobile Sverige', '240', 'SE'),
(118, '24010', 'Swefour AB Sweden', '240', 'SE'),
(119, '24011', 'Linholmen Science Park AB Sweden', '240', 'SE'),
(120, '24020', 'Wireless Maingate Message Services AB Sweden', '240', 'SE'),
(121, '24021', 'Banverket Sweden', '240', 'SE'),
(122, '24201', 'Telenor Mobil AS Norway', '242', 'NO'),
(123, '24202', 'Netcom GSM AS Norway', '242', 'NO'),
(124, '24203', 'Teletopia Mobile Communications AS Norway', '242', 'NO'),
(125, '24204', 'Tele2 Norge AS', '242', 'NO'),
(126, '24404', 'Finnet Networks Ltd.', '244', 'FI'),
(127, '24405', 'Elisa Matkapuhelinpalvelut Ltd. Finland', '244', 'FI'),
(128, '24409', 'Finnet Group', '244', 'FI'),
(129, '24412', 'Finnet Networks Ltd.', '244', 'FI'),
(130, '24414', 'Alands Mobiltelefon AB Finland', '244', 'FI'),
(131, '24416', 'Oy Finland Tele2 AB', '244', 'FI'),
(132, '24421', 'Saunalahti Group Ltd. Finland', '244', 'FI'),
(133, '24491', 'Sonera Carrier Networks Oy Finland', '244', 'FI'),
(134, '24601', 'Omnitel Lithuania', '246', 'LT'),
(135, '24602', 'Bit GSM Lithuania', '246', 'LT'),
(136, '24603', 'Tele2 Lithuania', '246', 'LT'),
(137, '24701', 'Latvian Mobile Phone', '247', 'LV'),
(138, '24702', 'Tele2 Latvia', '247', 'LV'),
(139, '24703', 'Telekom Baltija Latvia', '247', 'LV'),
(140, '24704', 'Beta Telecom Latvia', '247', 'LV'),
(141, '24801', 'EMT GSM Estonia', '248', 'EE'),
(142, '24802', 'RLE Estonia', '248', 'EE'),
(143, '24803', 'Tele2 Estonia', '248', 'EE'),
(144, '24804', 'OY Top Connect Estonia', '248', 'EE'),
(145, '24805', 'AS Bravocom Mobiil Estonia', '248', 'EE'),
(146, '24806', 'OY ViaTel Estonia', '248', 'EE'),
(147, '25001', 'Mobile Telesystems Russia', '250', 'RU'),
(148, '25002', 'Megafon Russia', '250', 'RU'),
(149, '25003', 'Nizhegorodskaya Cellular Communications Russia', '250', 'RU'),
(150, '25004', 'Sibchallenge Russia', '250', 'RU'),
(151, '25005', 'Mobile Comms System Russia', '250', 'RU'),
(152, '25007', 'BM Telecom Russia', '250', 'RU'),
(153, '25010', 'Don Telecom Russia', '250', 'RU'),
(154, '25011', 'Orensot Russia', '250', 'RU'),
(155, '25012', 'Baykal Westcom Russia', '250', 'RU'),
(156, '25013', 'Kuban GSM Russia', '250', 'RU'),
(157, '25016', 'New Telephone Company Russia', '250', 'RU'),
(158, '25017', 'Ermak RMS Russia', '250', 'RU'),
(159, '25019', 'Volgograd Mobile Russia', '250', 'RU'),
(160, '25020', 'ECC Russia', '250', 'RU'),
(161, '25028', 'Extel Russia', '250', 'RU'),
(162, '25039', 'Uralsvyazinform Russia', '250', 'RU'),
(163, '25044', 'Stuvtelesot Russia', '250', 'RU'),
(164, '25092', 'Printelefone Russia', '250', 'RU'),
(165, '25093', 'Telecom XXI Russia', '250', 'RU'),
(166, '25099', 'Bec Line GSM Russia', '250', 'RU'),
(167, '25501', 'Ukrainian Mobile Communication, UMC', '255', 'UA'),
(168, '25502', 'Ukranian Radio Systems, URS', '255', 'UA'),
(169, '25503', 'Kyivstar Ukraine', '255', 'UA'),
(170, '25504', 'Golden Telecom, GT Ukraine', '255', 'UA'),
(171, '25506', 'Astelit Ukraine', '255', 'UA'),
(172, '25507', 'Ukrtelecom Ukraine', '255', 'UA'),
(173, '25701', 'MDC Velcom Belarus', '257', 'BY'),
(174, '25702', 'MTS Belarus', '257', 'BY'),
(175, '25901', 'Voxtel Moldova', '259', 'MD'),
(176, '25902', 'Moldcell Moldova', '259', 'MD'),
(177, '26001', 'Plus GSM (Polkomtel S.A.) Poland', '260', 'PL'),
(178, '26002', 'ERA GSM (Polska Telefonia Cyfrowa Sp. Z.o.o.)', '260', 'PL'),
(179, '26003', 'Idea (Polska Telefonia Komorkowa Centertel Sp. Z.o.o)', '260', 'PL'),
(180, '26004', 'Tele2 Polska (Tele2 Polska Sp. Z.o.o.)', '260', 'PL'),
(181, '26005', 'IDEA (UMTS)/PTK Centertel sp. Z.o.o. Poland', '260', 'PL'),
(182, '26006', 'Netia Mobile Poland', '260', 'PL'),
(183, '26007', 'Premium internet Poland', '260', 'PL'),
(184, '26008', 'E-Telko Poland', '260', 'PL'),
(185, '26009', 'Telekomunikacja Kolejowa (GSM-R) Poland', '260', 'PL'),
(186, '26010', 'Telefony Opalenickie Poland', '260', 'PL'),
(187, '26201', 'T-Mobile Deutschland GmbH', '262', 'DE'),
(188, '26202', 'Vodafone D2 GmbH Germany', '262', 'DE'),
(189, '26203', 'E-Plus Mobilfunk GmbH & Co. KG Germany', '262', 'DE'),
(190, '26204', 'Vodafone D2 GmbH Germany', '262', 'DE'),
(191, '26205', 'E-Plus Mobilfunk GmbH & Co. KG Germany', '262', 'DE'),
(192, '26206', 'T-Mobile Deutschland GmbH', '262', 'DE'),
(193, '26207', 'O2 (Germany) GmbH & Co. OHG', '262', 'DE'),
(194, '26208', 'O2 (Germany) GmbH & Co. OHG', '262', 'DE'),
(195, '26209', 'Vodafone D2 GmbH Germany', '262', 'DE'),
(196, '26210', 'Arcor AG & Co. Germany', '262', 'DE'),
(197, '26211', 'O2 (Germany) GmbH & Co. OHG', '262', 'DE'),
(198, '26212', 'Dolphin Telecom (Deutschland) GmbH', '262', 'DE'),
(199, '26213', 'Mobilcom Multimedia GmbH Germany', '262', 'DE'),
(200, '26214', 'Group 3G UMTS GmbH (Quam) Germany', '262', 'DE'),
(201, '26215', 'Airdata AG Germany', '262', 'DE'),
(202, '26276', 'Siemens AG, ICMNPGUSTA Germany', '262', 'DE'),
(203, '26277', 'E-Plus Mobilfunk GmbH & Co. KG Germany', '262', 'DE'),
(204, '26601', 'Gibtel GSM Gibraltar', '266', 'GI'),
(205, '26801', 'Vodafone Telecel - Comunicacoes Pessoais, S.A. Portugal', '268', 'PT'),
(206, '26803', 'Optimus - Telecomunicacoes, S.A. Portugal', '268', 'PT'),
(207, '26805', 'Oniway - Inforcomunicacoes, S.A. Portugal', '268', 'PT'),
(208, '26806', 'TMN - Telecomunicacoes Moveis Nacionais, S.A. Portugal', '268', 'PT'),
(209, '27001', 'P&T Luxembourg', '270', 'LU'),
(210, '27077', 'Tango Luxembourg', '270', 'LU'),
(211, '27099', 'Voxmobile S.A. Luxembourg', '270', 'LU'),
(212, '27201', 'Vodafone Ireland Plc', '272', 'IE'),
(213, '27202', 'Digifone mm02 Ltd. Ireland', '272', 'IE'),
(214, '27203', 'Meteor Mobile Communications Ltd. Ireland', '272', 'IE'),
(215, '27207', 'Eircom Ireland', '272', 'IE'),
(216, '27209', 'Clever Communications Ltd. Ireland', '272', 'IE'),
(217, '27401', 'Iceland Telecom Ltd.', '274', 'IS'),
(218, '27402', 'Tal hf Iceland', '274', 'IS'),
(219, '27403', 'Islandssimi GSM ehf Iceland', '274', 'IS'),
(220, '27404', 'IMC Islande ehf', '274', 'IS'),
(221, '27601', 'AMC Albania', '276', 'AL'),
(222, '27602', 'Vodafone Albania', '276', 'AL'),
(223, '27801', 'Vodafone Malta', '278', 'MT'),
(224, '27821', 'go mobile Malta', '278', 'MT'),
(225, '28001', 'CYTA Cyprus', '280', 'CY'),
(226, '28010', 'Scancom (Cyprus) Ltd.', '280', 'CY'),
(227, '28201', 'Geocell Ltd. Georgia', '282', 'GE'),
(228, '28202', 'Magti GSM Ltd. Georgia', '282', 'GE'),
(229, '28203', 'Iberiatel Ltd. Georgia', '282', 'GE'),
(230, '28204', 'Mobitel Ltd. Georgia', '282', 'GE'),
(231, '28301', 'ARMGSM', '283', 'AM'),
(232, '28401', 'M-Tel GSM BG Bulgaria', '284', 'BG'),
(233, '28405', 'Globul Bulgaria', '284', 'BG'),
(234, '28601', 'Turkcell Turkey', '286', 'TR'),
(235, '28602', 'Telsim GSM Turkey', '286', 'TR'),
(236, '28603', 'Aria Turkey', '286', 'TR'),
(237, '28604', 'Aycell Turkey', '286', 'TR'),
(238, '28801', 'Faroese Telecom - GSM', '288', 'FO'),
(239, '28802', 'Kall GSM Faroe Islands', '288', 'FO'),
(240, '29001', 'Tele Greenland', '290', 'GR'),
(241, '29201', 'SMT - San Marino Telecom', '292', 'SM'),
(242, '29340', 'SI Mobil Slovenia', '293', 'SI'),
(243, '29341', 'Mobitel Slovenia', '293', 'SI'),
(244, '29369', 'Akton d.o.o. Slovenia', '293', 'SI'),
(245, '29370', 'Tusmobil d.o.o. Slovenia', '293', 'SI'),
(246, '29401', 'Mobimak Macedonia', '294', 'MK'),
(247, '29402', 'MTS Macedonia', '294', 'MK'),
(248, '29501', 'Telecom FL AG Liechtenstein', '295', 'LI'),
(249, '29502', 'Viag Europlatform AG Liechtenstein', '295', 'LI'),
(250, '29505', 'Mobilkom (Liechstein) AG', '295', 'LI'),
(251, '29577', 'Tele2 AG Liechtenstein', '295', 'LI'),
(252, '30236', 'Clearnet Canada', '302', 'CA'),
(253, '30237', 'Microcell Canada', '302', 'CA'),
(254, '30262', 'Ice Wireless Canada', '302', 'CA'),
(255, '30263', 'Aliant Mobility Canada', '302', 'CA'),
(256, '30264', 'Bell Mobility Canada', '302', 'CA'),
(257, '302656', 'Tbay Mobility Canada', '302', 'CA'),
(258, '30266', 'MTS Mobility Canada', '302', 'CA'),
(259, '30267', 'CityTel Mobility Canada', '302', 'CA'),
(260, '30268', 'Sask Tel Mobility Canada', '302', 'CA'),
(261, '30271', 'Globalstar Canada', '302', 'CA'),
(262, '30272', 'Rogers Wireless Canada', '302', 'CA'),
(263, '30286', 'Telus Mobility Canada', '302', 'CA'),
(264, '30801', 'St. Pierre-et-Miquelon Telecom', '308', 'CA'),
(265, '310010', 'MCI USA', '310', 'US'),
(266, '310012', 'Verizon Wireless USA', '310', 'US'),
(267, '310013', 'Mobile Tel Inc. USA', '310', 'US'),
(268, '310014', 'Testing USA', '310', 'US'),
(269, '310016', 'Cricket Communications USA', '310', 'US'),
(270, '310017', 'North Sight Communications Inc. USA', '310', 'US'),
(271, '310020', 'Union Telephone Company USA', '310', 'US'),
(272, '310030', 'Centennial Communications USA', '310', 'US'),
(273, '310034', 'Nevada Wireless LLC USA', '310', 'US'),
(274, '310040', 'Concho Cellular Telephone Co., Inc. USA', '310', 'US'),
(275, '310050', 'ACS Wireless Inc. USA', '310', 'US'),
(276, '310060', 'Consolidated Telcom USA', '310', 'US'),
(277, '310070', 'Highland Cellular, Inc. USA', '310', 'US'),
(278, '310080', 'Corr Wireless Communications LLC USA', '310', 'US'),
(279, '310090', 'Edge Wireless LLC USA', '310', 'US'),
(280, '310100', 'New Mexico RSA 4 East Ltd. Partnership USA', '310', 'US'),
(281, '310120', 'Sprint USA', '310', 'US'),
(282, '310130', 'Carolina West Wireless USA', '310', 'US'),
(283, '310140', 'GTA Wireless LLC USA', '310', 'US'),
(284, '310150', 'Cingular Wireless USA', '310', 'US'),
(285, '310160', 'T-Mobile USA', '310', 'US'),
(286, '310170', 'Cingular Wireless USA', '310', 'US'),
(287, '310180', 'West Central Wireless USA', '310', 'US'),
(288, '310190', 'Alaska Wireless Communications LLC USA', '310', 'US'),
(289, '310200', 'T-Mobile USA', '310', 'US'),
(290, '310210', 'T-Mobile USA', '310', 'US'),
(291, '310220', 'T-Mobile USA', '310', 'US'),
(292, '310230', 'T-Mobile USA', '310', 'US'),
(293, '310240', 'T-Mobile USA', '310', 'US'),
(294, '310250', 'T-Mobile USA', '310', 'US'),
(295, '310260', 'T-Mobile USA', '310', 'US'),
(296, '310270', 'T-Mobile USA', '310', 'US'),
(297, '310280', 'Contennial Puerto Rio License Corp. USA', '310', 'US'),
(298, '310290', 'Nep Cellcorp Inc. USA', '310', 'US'),
(299, '310300', 'Get Mobile Inc. USA', '310', 'US'),
(300, '310310', 'T-Mobile USA', '310', 'US'),
(301, '310320', 'Bug Tussel Wireless LLC USA', '310', 'US'),
(302, '310330', 'AN Subsidiary LLC USA', '310', 'US'),
(303, '310340', 'High Plains Midwest LLC, dba Wetlink Communications USA', '310', 'US'),
(304, '310350', 'Mohave Cellular L.P. USA', '310', 'US'),
(305, '310360', 'Cellular Network Partnership dba Pioneer Cellular USA', '310', 'US'),
(306, '310370', 'Guamcell Cellular and Paging USA', '310', 'US'),
(307, '310380', 'AT&T Wireless Services Inc. USA', '310', 'US'),
(308, '310390', 'TX-11 Acquistion LLC USA', '310', 'US'),
(309, '310400', 'Wave Runner LLC USA', '310', 'US'),
(310, '310410', 'Cingular Wireless USA', '310', 'US'),
(311, '310420', 'Cincinnati Bell Wireless LLC USA', '310', 'US'),
(312, '310430', 'Alaska Digitel LLC USA', '310', 'US'),
(313, '310440', 'Numerex Corp. USA', '310', 'US'),
(314, '310450', 'North East Cellular Inc. USA', '310', 'US'),
(315, '310460', 'TMP Corporation USA', '310', 'US'),
(316, '310470', 'Guam Wireless Telephone Company USA', '310', 'US'),
(317, '310480', 'Choice Phone LLC USA', '310', 'US'),
(318, '310490', 'Triton PCS USA', '310', 'US'),
(319, '310500', 'Public Service Cellular, Inc. USA', '310', 'US'),
(320, '310510', 'Airtel Wireless LLC USA', '310', 'US'),
(321, '310520', 'VeriSign USA', '310', 'US'),
(322, '310530', 'West Virginia Wireless USA', '310', 'US'),
(323, '310540', 'Oklahoma Western Telephone Company USA', '310', 'US'),
(324, '310560', 'American Cellular Corporation USA', '310', 'US'),
(325, '310570', 'MTPCS LLC USA', '310', 'US'),
(326, '310580', 'PCS ONE USA', '310', 'US'),
(327, '310590', 'Western Wireless Corporation USA', '310', 'US'),
(328, '310600', 'New Cell Inc. dba Cellcom USA', '310', 'US'),
(329, '310610', 'Elkhart Telephone Co. Inc. dba Epic Touch Co. USA', '310', 'US'),
(330, '310620', 'Coleman County Telecommunications Inc. (Trans Texas PCS) USA', '310', 'US'),
(331, '310630', 'Comtel PCS Mainstreet LP USA', '310', 'US'),
(332, '310640', 'Airadigm Communications USA', '310', 'US'),
(333, '310650', 'Jasper Wireless Inc. USA', '310', 'US'),
(334, '310660', 'T-Mobile USA', '310', 'US'),
(335, '310670', 'Northstar USA', '310', 'US'),
(336, '310680', 'Noverr Publishing, Inc. dba NPI Wireless USA', '310', 'US'),
(337, '310690', 'Conestoga Wireless Company USA', '310', 'US'),
(338, '310700', 'Cross Valiant Cellular Partnership USA', '310', 'US'),
(339, '310710', 'Arctic Slopo Telephone Association Cooperative USA', '310', 'US'),
(340, '310720', 'Wireless Solutions International Inc. USA', '310', 'US'),
(341, '310730', 'Sea Mobile USA', '310', 'US'),
(342, '310740', 'Telemetrix Technologies USA', '310', 'US'),
(343, '310750', 'East Kentucky Network LLC dba Appalachian Wireless USA', '310', 'US'),
(344, '310760', 'Panhandle Telecommunications Systems Inc. USA', '310', 'US'),
(345, '310770', 'Iowa Wireless Services LP USA', '310', 'US'),
(346, '310790', 'PinPoint Communications Inc. USA', '310', 'US'),
(347, '310800', 'T-Mobile USA', '310', 'US'),
(348, '310810', 'Brazos Cellular Communications Ltd. USA', '310', 'US'),
(349, '310820', 'Triton PCS License Company LLC USA', '310', 'US'),
(350, '310830', 'Caprock Cellular Ltd. Partnership USA', '310', 'US'),
(351, '310840', 'Edge Mobile LLC USA', '310', 'US'),
(352, '310850', 'Aeris Communications, Inc. USA', '310', 'US'),
(353, '310870', 'Kaplan Telephone Company Inc. USA', '310', 'US'),
(354, '310880', 'Advantage Cellular Systems, Inc. USA', '310', 'US'),
(355, '310890', 'Rural Cellular Corporation USA', '310', 'US'),
(356, '310900', 'Taylor Telecommunications Ltd. USA', '310', 'US'),
(357, '310910', 'Southern IL RSA Partnership dba First Cellular of Southern USA', '310', 'US'),
(358, '310940', 'Poka Lambro Telecommunications Ltd. USA', '310', 'US'),
(359, '310950', 'Texas RSA 1 dba XIT Cellular USA', '310', 'US'),
(360, '310970', 'Globalstar USA', '310', 'US'),
(361, '310980', 'AT&T Wireless Services Inc. USA', '310', 'US'),
(362, '310990', 'Alaska Digitel USA', '310', 'US'),
(363, '311000', 'Mid-Tex Cellular Ltd. USA', '311', 'US'),
(364, '311010', 'Chariton Valley Communications Corp., Inc. USA', '311', 'US'),
(365, '311020', 'Missouri RSA No. 5 Partnership USA', '311', 'US'),
(366, '311030', 'Indigo Wireless, Inc. USA', '311', 'US'),
(367, '311040', 'Commet Wireless, LLC USA', '311', 'US'),
(368, '311070', 'Easterbrooke Cellular Corporation USA', '311', 'US'),
(369, '311080', 'Pine Telephone Company dba Pine Cellular USA', '311', 'US'),
(370, '311090', 'Siouxland PCS USA', '311', 'US'),
(371, '311100', 'High Plains Wireless L.P. USA', '311', 'US'),
(372, '311110', 'High Plains Wireless L.P. USA', '311', 'US'),
(373, '311120', 'Choice Phone LLC USA', '311', 'US'),
(374, '311130', 'Amarillo License L.P. USA', '311', 'US'),
(375, '311140', 'MBO Wireless Inc./Cross Telephone Company USA', '311', 'US'),
(376, '311150', 'Wilkes Cellular Inc. USA', '311', 'US'),
(377, '311160', 'Endless Mountains Wireless, LLC USA', '311', 'US'),
(378, '311180', 'Cingular Wireless, Licensee Pacific Telesis Mobile Services, LLC USA', '311', 'US'),
(379, '311190', 'Cellular Properties Inc. USA', '311', 'US'),
(380, '311200', 'ARINC USA', '311', 'US'),
(381, '311210', 'Farmers Cellular Telephone USA', '311', 'US'),
(382, '311230', 'Cellular South Inc. USA', '311', 'US'),
(383, '311250', 'Wave Runner LLC USA', '311', 'US'),
(384, '311260', 'SLO Cellular Inc. dba CellularOne of San Luis Obispo USA', '311', 'US'),
(385, '311270', 'Alltel Communications Inc. USA', '311', 'US'),
(386, '311271', 'Alltel Communications Inc. USA', '311', 'US'),
(387, '311272', 'Alltel Communications Inc. USA', '311', 'US'),
(388, '311273', 'Alltel Communications Inc. USA', '311', 'US'),
(389, '311274', 'Alltel Communications Inc. USA', '311', 'US'),
(390, '311275', 'Alltel Communications Inc. USA', '311', 'US'),
(391, '311276', 'Alltel Communications Inc. USA', '311', 'US'),
(392, '311277', 'Alltel Communications Inc. USA', '311', 'US'),
(393, '311278', 'Alltel Communications Inc. USA', '311', 'US'),
(394, '311279', 'Alltel Communications Inc. USA', '311', 'US'),
(395, '311280', 'Verizon Wireless USA', '311', 'US'),
(396, '311281', 'Verizon Wireless USA', '311', 'US'),
(397, '311282', 'Verizon Wireless USA', '311', 'US'),
(398, '311283', 'Verizon Wireless USA', '311', 'US'),
(399, '311284', 'Verizon Wireless USA', '311', 'US'),
(400, '311285', 'Verizon Wireless USA', '311', 'US'),
(401, '311286', 'Verizon Wireless USA', '311', 'US'),
(402, '311287', 'Verizon Wireless USA', '311', 'US'),
(403, '311288', 'Verizon Wireless USA', '311', 'US'),
(404, '311289', 'Verizon Wireless USA', '311', 'US'),
(405, '311290', 'Pinpoint Wireless Inc. USA', '311', 'US'),
(406, '311320', 'Commnet Wireless LLC USA', '311', 'US'),
(407, '311340', 'Illinois Valley Cellular USA', '311', 'US'),
(408, '311380', 'New Dimension Wireless Ltd. USA', '311', 'US'),
(409, '311390', 'Midwest Wireless Holdings LLC USA', '311', 'US'),
(410, '311400', 'Salmon PCS LLC USA', '311', 'US'),
(411, '311410', 'Iowa RSA No.2 Ltd Partnership USA', '311', 'US'),
(412, '311420', 'Northwest Missouri Cellular Limited Partnership USA', '311', 'US'),
(413, '311430', 'RSA 1 Limited Partnership dba Cellular 29 Plus USA', '311', 'US'),
(414, '311440', 'Bluegrass Cellular LLC USA', '311', 'US'),
(415, '311450', 'Panhandle Telecommunication Systems Inc. USA', '311', 'US'),
(416, '316010', 'Nextel Communications Inc. USA', '316', 'US'),
(417, '316011', 'Southern Communications Services Inc. USA', '316', 'US'),
(418, '334020', 'Telcel Mexico', '334', 'MX'),
(419, '338020', 'Cable & Wireless Jamaica Ltd.', '338', 'JM'),
(420, '338050', 'Mossel (Jamaica) Ltd.', '338', 'JM'),
(421, '34001', 'Orange Carabe Mobiles Guadeloupe', '340', 'FW'),
(422, '34002', 'Outremer Telecom Guadeloupe', '340', 'FW'),
(423, '34003', 'Saint Martin et Saint Barthelemy Telcell Sarl Guadeloupe', '340', 'FW'),
(424, '34020', 'Bouygues Telecom Caraibe Guadeloupe', '340', 'FW'),
(425, '342600', 'Cable & Wireless (Barbados) Ltd.', '342', 'BB '),
(426, '342820', 'Sunbeach Communications Barbados', '342', 'BB '),
(427, '344030', 'APUA PCS Antigua ', '344', 'AG'),
(428, '344920', 'Cable & Wireless (Antigua)', '344', 'AG'),
(429, '344930', 'AT&T Wireless (Antigua)', '344', 'AG'),
(430, '346140', 'Cable & Wireless (Cayman)', '346', 'KY'),
(431, '348570', 'Caribbean Cellular Telephone, Boatphone Ltd.', '348', 'BVI'),
(432, '35001', 'Telecom', '350', 'BM'),
(433, '36251', 'TELCELL GSM Netherlands Antilles', '362', 'AN'),
(434, '36269', 'CT GSM Netherlands Antilles', '362', 'AN'),
(435, '36291', 'SETEL GSM Netherlands Antilles', '362', 'AN'),
(436, '36301', 'Setar GSM Aruba', '363', 'AW'),
(437, '365010', 'Weblinks Limited Anguilla', '365', 'AI'),
(438, '36801', 'ETECSA Cuba', '368', 'CU'),
(439, '37001', 'Orange Dominicana, S.A.', '370', 'DO'),
(440, '37002', 'Verizon Dominicana S.A.', '370', 'DO'),
(441, '37003', 'Tricom S.A. Dominican Rep.', '370', 'DO'),
(442, '37004', 'CentennialDominicana', '370', 'DO'),
(443, '37201', 'Comcel Haiti', '372', 'HT'),
(444, '37202', 'Digicel Haiti', '372', 'HT'),
(445, '37203', 'Rectel Haiti', '372', 'HT'),
(446, '37412', 'TSTT Mobile Trinidad and Tobago', '374', 'TT'),
(447, '374130', 'Digicel Trinidad and Tobago Ltd.', '374', 'TT'),
(448, '374140', 'LaqTel Ltd. Trinidad and Tobago', '374', 'TT'),
(449, '40001', 'Azercell Limited Liability Joint Venture', '400', 'AZ'),
(450, '40002', 'Bakcell Limited Liability Company Azerbaijan', '400', 'AZ'),
(451, '40003', 'Catel JV Azerbaijan', '400', 'AZ'),
(452, '40004', 'Azerphone LLC', '400', 'AZ'),
(453, '40101', 'Kar-Tel llc Kazakhstan', '401', 'KZ'),
(454, '40102', 'TSC Kazak Telecom Kazakhstan', '401', 'KZ'),
(455, '40211', 'Bhutan Telecom Ltd', '402', 'BT '),
(456, '40217', 'B-Mobile of Bhutan Telecom', '402', 'BT '),
(457, '40401', 'Aircell Digilink India Ltd.,', '404', 'IN'),
(458, '40402', 'Bharti Mobile Ltd. India', '404', 'IN'),
(459, '40403', 'Bharti Telenet Ltd. India', '404', 'IN'),
(460, '40404', 'Idea Cellular Ltd. India', '404', 'IN'),
(461, '40405', 'Fascel Ltd. India', '404', 'IN'),
(462, '40406', 'Bharti Mobile Ltd. India', '404', 'IN'),
(463, '40407', 'Idea Cellular Ltd. India', '404', 'IN'),
(464, '40409', 'Reliance Telecom Private Ltd. India', '404', 'IN'),
(465, '40410', 'Bharti Cellular Ltd. India', '404', 'IN'),
(466, '40411', 'Sterling Cellular Ltd. India', '404', 'IN'),
(467, '40412', 'Escotel Mobile Communications Pvt Ltd. India', '404', 'IN'),
(468, '40413', 'Hutchinson Essar South Ltd. India', '404', 'IN'),
(469, '40414', 'Spice Communications Ltd. India', '404', 'IN'),
(470, '40415', 'Aircell Digilink India Ltd.', '404', 'IN'),
(471, '40416', 'Hexcom India', '404', 'IN'),
(472, '40418', 'Reliance Telecom Private Ltd. India', '404', 'IN'),
(473, '40419', 'Escotel Mobile Communications Pvt Ltd. India', '404', 'IN'),
(474, '40420', 'Hutchinson Max Telecom India', '404', 'IN'),
(475, '40421', 'BPL Mobile Communications Ltd. India', '404', 'IN'),
(476, '40422', 'Idea Cellular Ltd. India', '404', 'IN'),
(477, '40424', 'Idea Cellular Ltd. India', '404', 'IN'),
(478, '40427', 'BPL Cellular Ltd. India', '404', 'IN'),
(479, '40430', 'Usha Martin Telecom Ltd. India', '404', 'IN'),
(480, '40431', 'Bharti Mobinet Ltd. India', '404', 'IN'),
(481, '40434', 'Bharat Sanchar Nigam Ltd. (BSNL) India', '404', 'IN'),
(482, '40436', 'Reliance Telecom Private Ltd. India', '404', 'IN'),
(483, '40438', 'Bharat Sanchar Nigam Ltd. (BSNL) India', '404', 'IN'),
(484, '40440', 'Bharti Mobinet Ltd. India', '404', 'IN'),
(485, '40441', 'RPG Cellular India', '404', 'IN'),
(486, '40442', 'Aircel Ltd. India', '404', 'IN'),
(487, '40443', 'BPL Mobile Cellular Ltd. India', '404', 'IN'),
(488, '40444', 'Spice Communications Ltd. India', '404', 'IN'),
(489, '40446', 'BPL Cellular Ltd. India', '404', 'IN'),
(490, '40449', 'Bharti Mobile Ltd. India', '404', 'IN'),
(491, '40450', 'Reliance Telecom Private Ltd. India', '404', 'IN'),
(492, '40451', 'Bharat Sanchar Nigam Ltd. (BSNL) India', '404', 'IN'),
(493, '40452', 'Reliance Telecom Private Ltd. India', '404', 'IN'),
(494, '40453', 'Bharat Sanchar Nigam Ltd. (BSNL) India', '404', 'IN'),
(495, '40454', 'Bharat Sanchar Nigam Ltd. (BSNL) India', '404', 'IN'),
(496, '40455', 'Bharat Sanchar Nigam Ltd. (BSNL) India', '404', 'IN'),
(497, '40456', 'Escotel Mobile Communications Pvt Ltd. India', '404', 'IN'),
(498, '40457', 'Bharat Sanchar Nigam Ltd. (BSNL) India', '404', 'IN'),
(499, '40458', 'Bharat Sanchar Nigam Ltd. (BSNL) India', '404', 'IN'),
(500, '40459', 'Bharat Sanchar Nigam Ltd. (BSNL) India', '404', 'IN'),
(501, '40460', 'Aircell Digilink India Ltd.', '404', 'IN'),
(502, '40462', 'Bharat Sanchar Nigam Ltd. (BSNL) India', '404', 'IN'),
(503, '40464', 'Bharat Sanchar Nigam Ltd. (BSNL) India', '404', 'IN'),
(504, '40466', 'Bharat Sanchar Nigam Ltd. (BSNL) India', '404', 'IN'),
(505, '40467', 'Reliance Telecom Private Ltd. India', '404', 'IN'),
(506, '40468', 'Mahanagar Telephone Nigam Ltd. India', '404', 'IN'),
(507, '40469', 'Mahanagar Telephone Nigam Ltd. India', '404', 'IN'),
(508, '40470', 'Hexicom India', '404', 'IN'),
(509, '40471', 'Bharat Sanchar Nigam Ltd. (BSNL) India', '404', 'IN'),
(510, '40472', 'Bharat Sanchar Nigam Ltd. (BSNL) India', '404', 'IN'),
(511, '40473', 'Bharat Sanchar Nigam Ltd. (BSNL) India', '404', 'IN'),
(512, '40474', 'Bharat Sanchar Nigam Ltd. (BSNL) India', '404', 'IN'),
(513, '40475', 'Bharat Sanchar Nigam Ltd. (BSNL) India', '404', 'IN'),
(514, '40476', 'Bharat Sanchar Nigam Ltd. (BSNL) India', '404', 'IN'),
(515, '40477', 'Bharat Sanchar Nigam Ltd. (BSNL) India', '404', 'IN'),
(516, '40478', 'BTA Cellcom Ltd. India', '404', 'IN'),
(517, '40480', 'Bharat Sanchar Nigam Ltd. (BSNL) India', '404', 'IN'),
(518, '40481', 'Bharat Sanchar Nigam Ltd. (BSNL) India', '404', 'IN'),
(519, '40482', 'Escorts Telecom Ltd. India', '404', 'IN'),
(520, '40483', 'Reliable Internet Services Ltd. India', '404', 'IN'),
(521, '40484', 'Hutchinson Essar South Ltd. India', '404', 'IN'),
(522, '40485', 'Reliance Telecom Private Ltd. India', '404', 'IN'),
(523, '40486', 'Hutchinson Essar South Ltd. India', '404', 'IN'),
(524, '40487', 'Escorts Telecom Ltd. India', '404', 'IN'),
(525, '40488', 'Escorts Telecom Ltd. India', '404', 'IN'),
(526, '40489', 'Escorts Telecom Ltd. India', '404', 'IN'),
(527, '40490', 'Bharti Cellular Ltd. India', '404', 'IN'),
(528, '40492', 'Bharti Cellular Ltd. India', '404', 'IN'),
(529, '40493', 'Bharti Cellular Ltd. India', '404', 'IN'),
(530, '40494', 'Bharti Cellular Ltd. India', '404', 'IN'),
(531, '40495', 'Bharti Cellular Ltd. India', '404', 'IN'),
(532, '40496', 'Bharti Cellular Ltd. India', '404', 'IN'),
(533, '40497', 'Bharti Cellular Ltd. India', '404', 'IN'),
(534, '40498', 'Bharti Cellular Ltd. India', '404', 'IN'),
(535, '41001', 'Mobilink Pakistan', '410', 'PK'),
(536, '41003', 'PAK Telecom Mobile Ltd. (UFONE) Pakistan', '410', 'PK'),
(537, '41201', 'AWCC Afghanistan', '412', 'AF'),
(538, '41220', 'Roshan Afghanistan', '412', 'AF'),
(539, '41230', 'New1 Afghanistan', '412', 'AF'),
(540, '41240', 'Areeba Afghanistan', '412', 'AF'),
(541, '41288', 'Afghan Telecom', '412', 'AF'),
(542, '41302', 'MTN Network Ltd. Sri Lanka', '413', 'LK'),
(543, '41303', 'Celtel Lanka Ltd. Sri Lanka', '413', 'LK'),
(544, '41401', 'Myanmar Post and Telecommunication', '414', 'MM'),
(545, '41532', 'Cellis Lebanon', '415', 'LB'),
(546, '41533', 'Cellis Lebanon', '415', 'LB'),
(547, '41534', 'Cellis Lebanon', '415', 'LB'),
(548, '41535', 'Cellis Lebanon', '415', 'LB'),
(549, '41536', 'Libancell', '415', 'LB'),
(550, '41537', 'Libancell', '415', 'LB'),
(551, '41538', 'Libancell', '415', 'LB'),
(552, '41539', 'Libancell', '415', 'LB'),
(553, '41601', 'Fastlink Jordan', '416', 'JO'),
(554, '41602', 'Xpress Jordan', '416', 'JO'),
(555, '41603', 'Umniah Jordan', '416', 'JO'),
(556, '41677', 'Mobilecom Jordan', '416', 'JO'),
(557, '41701', 'Syriatel', '417', 'SY'),
(558, '41702', 'Spacetel Syria', '417', 'SY'),
(559, '41709', 'Syrian Telecom', '417', 'SY'),
(560, '41902', 'Mobile Telecommunications Company Kuwait', '419', 'KW'),
(561, '41903', 'Wataniya Telecom Kuwait', '419', 'KW'),
(562, '42001', 'Saudi Telecom', '420', 'SA'),
(563, '42101', 'Yemen Mobile Phone Company', '421', 'YE'),
(564, '42102', 'Spacetel Yemen', '421', 'YE'),
(565, '42202', 'Oman Mobile Telecommunications Company (Oman Mobile)', '422', 'OM'),
(566, '42203', 'Oman Qatari Telecommunications Company (Nawras)', '422', 'OM'),
(567, '42204', 'Oman Telecommunications Company (Omantel)', '422', 'OM'),
(568, '42402', 'Etisalat United Arab Emirates', '424', 'AE'),
(569, '42501', 'Partner Communications Co. Ltd. Israel', '425', 'IL'),
(570, '42502', 'Cellcom Israel Ltd.', '425', 'IL'),
(571, '42503', 'Pelephone Communications Ltd. Israel', '425', 'IL'),
(572, '42601', 'BHR Mobile Plus Bahrain', '426', 'BH'),
(573, '42701', 'QATARNET', '427', 'QA'),
(574, '42899', 'Mobicom Mongolia', '428', 'MN'),
(575, '42901', 'Nepal Telecommunications', '429', 'NP'),
(576, '43211', 'Telecommunication Company of Iran (TCI)', '432', 'IR'),
(577, '43214', 'Telecommunication Kish Co. (KIFZO) Iran', '432', 'IR'),
(578, '43219', 'Telecommunication Company of Iran (TCI) Isfahan Celcom', '432', 'IR'),
(579, '43401', 'Buztel Uzbekistan', '434', 'UZ'),
(580, '43402', 'Uzmacom Uzbekistan', '434', 'UZ'),
(581, '43404', 'Daewoo Unitel Uzbekistan', '434', 'UZ'),
(582, '43405', 'Coscom Uzbekistan', '434', 'UZ'),
(583, '43407', 'Uzdunrobita Uzbekistan', '434', 'UZ'),
(584, '43601', 'JC Somoncom Tajikistan', '436', 'TJ'),
(585, '43602', 'CJSC Indigo Tajikistan', '436', 'TJ'),
(586, '43603', 'TT mobile Tajikistan', '436', 'TJ'),
(587, '43604', 'Josa Babilon-T Tajikistan', '436', 'TJ'),
(588, '43605', 'CTJTHSC Tajik-tel', '436', 'TJ'),
(589, '43701', 'Bitel GSM Kyrgyzstan', '437', 'KG'),
(590, '43801', 'Barash Communication Technologies (BCTI) Turkmenistan', '438', 'TM'),
(591, '43802', 'TM-Cell Turkmenistan', '438', 'TM'),
(592, '44001', 'NTT DoCoMo, Inc. Japan', '440', 'JP'),
(593, '44002', 'NTT DoCoMo Kansai, Inc. Japan', '440', 'JP'),
(594, '44003', 'NTT DoCoMo Hokuriku, Inc. Japan', '440', 'JP'),
(595, '44004', 'Vodafone Japan', '440', 'JP'),
(596, '44006', 'Vodafone Japan', '440', 'JP'),
(597, '44007', 'KDDI Corporation Japan', '440', 'JP'),
(598, '44008', 'KDDI Corporation Japan', '440', 'JP'),
(599, '44009', 'NTT DoCoMo Kansai Inc. Japan', '440', 'JP'),
(600, '44010', 'NTT DoCoMo Kansai Inc. Japan', '440', 'JP'),
(601, '44011', 'NTT DoCoMo Tokai Inc. Japan', '440', 'JP'),
(602, '44012', 'NTT DoCoMo Inc. Japan', '440', 'JP'),
(603, '44013', 'NTT DoCoMo Inc. Japan', '440', 'JP'),
(604, '44014', 'NTT DoCoMo Tohoku Inc. Japan', '440', 'JP'),
(605, '44015', 'NTT DoCoMo Inc. Japan', '440', 'JP'),
(606, '44016', 'NTT DoCoMo Inc. Japan', '440', 'JP'),
(607, '44017', 'NTT DoCoMo Inc. Japan', '440', 'JP'),
(608, '44018', 'NTT DoCoMo Tokai Inc. Japan', '440', 'JP'),
(609, '44019', 'NTT DoCoMo Hokkaido Japan', '440', 'JP'),
(610, '44020', 'NTT DoCoMo Hokuriku Inc. Japan', '440', 'JP'),
(611, '44021', 'NTT DoCoMo Inc. Japan', '440', 'JP'),
(612, '44022', 'NTT DoCoMo Kansai Inc. Japan', '440', 'JP'),
(613, '44023', 'NTT DoCoMo Tokai Inc. Japan', '440', 'JP'),
(614, '44024', 'NTT DoCoMo Chugoku Inc. Japan', '440', 'JP'),
(615, '44025', 'NTT DoCoMo Hokkaido Inc. Japan', '440', 'JP'),
(616, '44026', 'NTT DoCoMo Kyushu Inc. Japan', '440', 'JP'),
(617, '44027', 'NTT DoCoMo Tohoku Inc. Japan', '440', 'JP'),
(618, '44028', 'NTT DoCoMo Shikoku Inc. Japan', '440', 'JP'),
(619, '44029', 'NTT DoCoMo Inc. Japan', '440', 'JP'),
(620, '44030', 'NTT DoCoMo Inc. Japan', '440', 'JP'),
(621, '44031', 'NTT DoCoMo Kansai Inc. Japan', '440', 'JP'),
(622, '44032', 'NTT DoCoMo Inc. Japan', '440', 'JP'),
(623, '44033', 'NTT DoCoMo Tokai Inc. Japan', '440', 'JP'),
(624, '44034', 'NTT DoCoMo Kyushu Inc. Japan', '440', 'JP'),
(625, '44035', 'NTT DoCoMo Kansai Inc. Japan', '440', 'JP'),
(626, '44036', 'NTT DoCoMo Inc. Japan', '440', 'JP'),
(627, '44037', 'NTT DoCoMo Inc. Japan', '440', 'JP'),
(628, '44038', 'NTT DoCoMo Inc. Japan', '440', 'JP'),
(629, '44039', 'NTT DoCoMo Inc. Japan', '440', 'JP'),
(630, '44040', 'Vodafone Japan', '440', 'JP'),
(631, '44041', 'Vodafone Japan', '440', 'JP'),
(632, '44042', 'Vodafone Japan', '440', 'JP'),
(633, '44043', 'Vodafone Japan', '440', 'JP'),
(634, '44044', 'Vodafone Japan', '440', 'JP'),
(635, '44045', 'Vodafone Japan', '440', 'JP'),
(636, '44046', 'Vodafone Japan', '440', 'JP'),
(637, '44047', 'Vodafone Japan', '440', 'JP'),
(638, '44048', 'Vodafone Japan', '440', 'JP'),
(639, '44049', 'NTT DoCoMo Inc. Japan', '440', 'JP'),
(640, '44050', 'KDDI Corporation Japan', '440', 'JP'),
(641, '44051', 'KDDI Corporation Japan', '440', 'JP'),
(642, '44052', 'KDDI Corporation Japan', '440', 'JP'),
(643, '44053', 'KDDI Corporation Japan', '440', 'JP'),
(644, '44054', 'KDDI Corporation Japan', '440', 'JP'),
(645, '44055', 'KDDI Corporation Japan', '440', 'JP'),
(646, '44056', 'KDDI Corporation Japan', '440', 'JP'),
(647, '44058', 'NTT DoCoMo Kansai Inc. Japan', '440', 'JP'),
(648, '44060', 'NTT DoCoMo Kansai Inc. Japan', '440', 'JP'),
(649, '44061', 'NTT DoCoMo Chugoku Inc. Japan', '440', 'JP'),
(650, '44062', 'NTT DoCoMo Kyushu Inc. Japan', '440', 'JP'),
(651, '44063', 'NTT DoCoMo Inc. Japan', '440', 'JP'),
(652, '44064', 'NTT DoCoMo Inc. Japan', '440', 'JP'),
(653, '44065', 'NTT DoCoMo Shikoku Inc. Japan', '440', 'JP'),
(654, '44066', 'NTT DoCoMo Inc. Japan', '440', 'JP'),
(655, '44067', 'NTT DoCoMo Tohoku Inc. Japan', '440', 'JP'),
(656, '44068', 'NTT DoCoMo Kyushu Inc. Japan', '440', 'JP'),
(657, '44069', 'NTT DoCoMo Inc. Japan', '440', 'JP'),
(658, '44070', 'KDDI Corporation Japan', '440', 'JP'),
(659, '44071', 'KDDI Corporation Japan', '440', 'JP'),
(660, '44072', 'KDDI Corporation Japan', '440', 'JP'),
(661, '44073', 'KDDI Corporation Japan', '440', 'JP'),
(662, '44074', 'KDDI Corporation Japan', '440', 'JP'),
(663, '44075', 'KDDI Corporation Japan', '440', 'JP'),
(664, '44076', 'KDDI Corporation Japan', '440', 'JP'),
(665, '44077', 'KDDI Corporation Japan', '440', 'JP'),
(666, '44078', 'Okinawa Cellular Telephone Japan', '440', 'JP'),
(667, '44079', 'KDDI Corporation Japan', '440', 'JP'),
(668, '44080', 'TU-KA Cellular Tokyo Inc. Japan', '440', 'JP'),
(669, '44081', 'TU-KA Cellular Tokyo Inc. Japan', '440', 'JP'),
(670, '44082', 'TU-KA Phone Kansai Inc. Japan', '440', 'JP'),
(671, '44083', 'TU-KA Cellular Tokai Inc. Japan', '440', 'JP'),
(672, '44084', 'TU-KA Phone Kansai Inc. Japan', '440', 'JP'),
(673, '44085', 'TU-KA Cellular Tokai Inc. Japan', '440', 'JP'),
(674, '44086', 'TU-KA Cellular Tokyo Inc. Japan', '440', 'JP'),
(675, '44087', 'NTT DoCoMo Chugoku Inc. Japan', '440', 'JP'),
(676, '44088', 'KDDI Corporation Japan', '440', 'JP'),
(677, '44089', 'KDDI Corporation Japan', '440', 'JP'),
(678, '44090', 'Vodafone Japan', '440', 'JP'),
(679, '44092', 'Vodafone Japan', '440', 'JP'),
(680, '44093', 'Vodafone Japan', '440', 'JP'),
(681, '44094', 'Vodafone Japan', '440', 'JP'),
(682, '44095', 'Vodafone Japan', '440', 'JP'),
(683, '44096', 'Vodafone Japan', '440', 'JP'),
(684, '44097', 'Vodafone Japan', '440', 'JP'),
(685, '44098', 'Vodafone Japan', '440', 'JP'),
(686, '44099', 'NTT DoCoMo Inc. Japan', '440', 'JP'),
(687, '44140', 'NTT DoCoMo Inc. Japan', '441', 'JP'),
(688, '44141', 'NTT DoCoMo Inc. Japan', '441', 'JP'),
(689, '44142', 'NTT DoCoMo Inc. Japan', '441', 'JP'),
(690, '44143', 'NTT DoCoMo Kansai Inc. Japan', '441', 'JP'),
(691, '44144', 'NTT DoCoMo Chugoku Inc. Japan', '441', 'JP'),
(692, '44145', 'NTT DoCoMo Shikoku Inc. Japan', '441', 'JP'),
(693, '44150', 'TU-KA Cellular Tokyo Inc. Japan', '441', 'JP'),
(694, '44151', 'TU-KA Phone Kansai Inc. Japan', '441', 'JP'),
(695, '44161', 'Vodafone Japan', '441', 'JP'),
(696, '44162', 'Vodafone Japan', '441', 'JP'),
(697, '44163', 'Vodafone Japan', '441', 'JP'),
(698, '44164', 'Vodafone Japan', '441', 'JP'),
(699, '44165', 'Vodafone Japan', '441', 'JP'),
(700, '44170', 'KDDI Corporation Japan', '441', 'JP'),
(701, '44190', 'NTT DoCoMo Inc. Japan', '441', 'JP'),
(702, '44191', 'NTT DoCoMo Inc. Japan', '441', 'JP'),
(703, '44192', 'NTT DoCoMo Inc. Japan', '441', 'JP'),
(704, '44193', 'NTT DoCoMo Hokkaido Inc. Japan', '441', 'JP'),
(705, '44194', 'NTT DoCoMo Tohoku Inc. Japan', '441', 'JP'),
(706, '44198', 'NTT DoCoMo Kyushu Inc. Japan', '441', 'JP'),
(707, '44199', 'NTT DoCoMo Kyushu Inc. Japan', '441', 'JP'),
(708, '45201', 'Mobifone Vietnam', '452', 'VN'),
(709, '45202', 'Vinaphone Vietnam', '452', 'VN'),
(710, '45400', 'CSL', '454', 'HK'),
(711, '45401', 'MVNO/CITIC Hong Kong', '454', 'HK'),
(712, '45402', '3G Radio System/HKCSL3G Hong Kong', '454', 'HK'),
(713, '45403', 'Hutchison 3G', '454', 'HK'),
(714, '45404', 'GSM900/GSM1800/Hutchison Hong Kong', '454', 'HK'),
(715, '45405', 'CDMA/Hutchison Hong Kong', '454', 'HK'),
(716, '45406', 'SMC', '454', 'HK'),
(717, '45407', 'MVNO/China Unicom International Ltd. Hong Kong', '454', 'HK'),
(718, '45408', 'MVNO/Trident Hong Kong', '454', 'HK'),
(719, '45409', 'MVNO/China Motion Telecom (HK) Ltd. Hong Kong', '454', 'HK'),
(720, '45410', 'GSM1800New World PCS Ltd. Hong Kong', '454', 'HK'),
(721, '45411', 'MVNO/CHKTL Hong Kong', '454', 'HK'),
(722, '45412', 'PEOPLES', '454', 'HK'),
(723, '45415', '3G Radio System/SMT3G Hong Kong', '454', 'HK'),
(724, '45416', 'GSM1800/Mandarin Communications Ltd. Hong Kong', '454', 'HK'),
(725, '45418', 'GSM7800/Hong Kong CSL Ltd.', '454', 'HK'),
(726, '45419', 'Sunday3G', '454', 'HK'),
(727, '45500', 'Smartone Mobile Communications (Macao) Ltd.', '455', 'MO'),
(728, '45501', 'CTM GSM Macao', '455', 'MO'),
(729, '45503', 'Hutchison Telecom Macao', '455', 'MO'),
(730, '45601', 'Mobitel (Cam GSM) Cambodia', '456', 'KH'),
(731, '45602', 'Samart (Casacom) Cambodia', '456', 'KH'),
(732, '45603', 'S Telecom (CDMA) (reserved) Cambodia', '456', 'KH'),
(733, '45618', 'Camshin (Shinawatra) Cambodia', '456', 'KH'),
(734, '45701', 'Lao Telecommunications', '457', 'LA'),
(735, '45702', 'ETL Mobile Lao', '457', 'LA'),
(736, '45708', 'Millicom Lao', '457', 'LA'),
(737, '46000', 'China Mobile', '460', 'CN'),
(738, '46001', 'China Unicom', '460', 'CN'),
(739, '46002', 'China Mobile', '460', 'CN'),
(740, '46003', 'China Telecom', '460', 'CN'),
(741, '46004', 'China Satellite Global Star Network', '460', 'CN'),
(742, '46601', 'Far EasTone', '466', 'TW'),
(743, '46606', 'TUNTEX', '466', 'TW'),
(744, '46668', 'ACeS', '466', 'TW'),
(745, '46688', 'KGT', '466', 'TW'),
(746, '46689', 'KGT', '466', 'TW'),
(747, '46692', 'Chunghwa', '466', 'TW'),
(748, '46693', 'MobiTai', '466', 'TW'),
(749, '46697', 'TWN GSM', '466', 'TW'),
(750, '46699', 'TransAsia', '466', 'TW'),
(751, '47001', 'GramenPhone Bangladesh', '470', 'BD'),
(752, '47002', 'Aktel Bangladesh', '470', 'BD'),
(753, '47003', 'Mobile 2000 Bangladesh', '470', 'BD'),
(754, '47201', 'DhiMobile Maldives', '472', 'MV'),
(755, '50200', 'Art900 Malaysia', '502', 'MY'),
(756, '50212', 'Maxis Malaysia', '502', 'MY'),
(757, '50213', 'TM Touch Malaysia', '502', 'MY'),
(758, '50216', 'DiGi', '502', 'MY'),
(759, '50217', 'TimeCel Malaysia', '502', 'MY'),
(760, '50219', 'CelCom Malaysia', '502', 'MY'),
(761, '50501', 'Telstra Corporation Ltd. Australia', '505', 'AU'),
(762, '50502', 'Optus Mobile Pty. Ltd. Australia', '505', 'AU'),
(763, '50503', 'Vodafone Network Pty. Ltd. Australia', '505', 'AU'),
(764, '50504', 'Department of Defence Australia', '505', 'AU'),
(765, '50505', 'The Ozitel Network Pty. Ltd. Australia', '505', 'AU'),
(766, '50506', 'Hutchison 3G Australia Pty. Ltd.', '505', 'AU'),
(767, '50507', 'Vodafone Network Pty. Ltd. Australia', '505', 'AU'),
(768, '50508', 'One.Tel GSM 1800 Pty. Ltd. Australia', '505', 'AU'),
(769, '50509', 'Airnet Commercial Australia Ltd.', '505', 'AU'),
(770, '50511', 'Telstra Corporation Ltd. Australia', '505', 'AU'),
(771, '50512', 'Hutchison Telecommunications (Australia) Pty. Ltd.', '505', 'AU'),
(772, '50514', 'AAPT Ltd. Australia', '505', 'AU'),
(773, '50515', '3GIS Pty Ltd. (Telstra & Hutchison 3G) Australia', '505', 'AU'),
(774, '50524', 'Advanced Communications Technologies Pty. Ltd. Australia', '505', 'AU'),
(775, '50571', 'Telstra Corporation Ltd. Australia', '505', 'AU'),
(776, '50572', 'Telstra Corporation Ltd. Australia', '505', 'AU'),
(777, '50588', 'Localstar Holding Pty. Ltd. Australia', '505', 'AU'),
(778, '50590', 'Optus Ltd. Australia', '505', 'AU'),
(779, '50599', 'One.Tel GSM 1800 Pty. Ltd. Australia', '505', 'AU'),
(780, '51000', 'PSN Indonesia', '510', 'ID'),
(781, '51001', 'Satelindo Indonesia', '510', 'ID'),
(782, '51008', 'Natrindo (Lippo Telecom) Indonesia', '510', 'ID'),
(783, '51010', 'Telkomsel Indonesia', '510', 'ID'),
(784, '51011', 'Excelcomindo Indonesia', '510', 'ID'),
(785, '51021', 'Indosat - M3 Indonesia', '510', 'ID'),
(786, '51028', 'Komselindo Indonesia', '510', 'ID'),
(787, '51501', 'Islacom Philippines', '515', 'PH'),
(788, '51502', 'Globe Telecom Philippines', '515', 'PH'),
(789, '51503', 'Smart Communications Philippines', '515', 'PH'),
(790, '51505', 'Digitel Philippines', '515', 'PH'),
(791, '52000', 'CAT CDMA Thailand', '520', 'TH'),
(792, '52001', 'AIS GSM Thailand', '520', 'TH'),
(793, '52015', 'ACT Mobile Thailand', '520', 'TH'),
(794, '52501', 'SingTel ST GSM900 Singapore', '525', 'SG'),
(795, '52502', 'SingTel ST GSM1800 Singapore', '525', 'SG'),
(796, '52503', 'MobileOne Singapore', '525', 'SG'),
(797, '52505', 'STARHUB-SGP', '525', 'SG'),
(798, '52512', 'Digital Trunked Radio Network Singapore', '525', 'SG'),
(799, '52811', 'DST Com Brunei ', '528', 'BN'),
(800, '53000', 'Reserved for AMPS MIN based IMSIs New Zealand', '530', 'NZ'),
(801, '53001', 'Vodafone New Zealand GSM Mobile Network', '530', 'NZ'),
(802, '53002', 'Teleom New Zealand CDMA Mobile Network', '530', 'NZ'),
(803, '53003', 'Walker Wireless Ltd. New Zealand', '530', 'NZ'),
(804, '53028', 'Econet Wireless New Zealand GSM Mobile Network', '530', 'NZ'),
(805, '53701', 'Pacific Mobile Communications Papua New Guinea', '537', 'PG'),
(806, '53702', 'Dawamiba PNG Ltd Papua New Guinea', '537', 'PG'),
(807, '53703', 'Digicel Ltd Papua New Guinea', '537', 'PG'),
(808, '53901', 'Tonga Communications Corporation', '539', 'TO'),
(809, '53943', 'Shoreline Communication Tonga', '539', 'TO'),
(810, '54101', 'SMILE Vanuatu', '541', 'VU'),
(811, '54201', 'Vodafone Fiji', '542', 'FJ'),
(812, '54411', 'Blue Sky', '544', 'AS'),
(813, '54601', 'OPT Mobilis New Caledonia', '546', 'NC'),
(814, '54720', 'Tikiphone French Polynesia', '547', 'PF'),
(815, '54801', 'Telecom Cook', '548', 'CK'),
(816, '54901', 'Telecom Samoa Cellular Ltd.', '549', 'WS'),
(817, '54927', 'GoMobile SamoaTel Ltd', '549', 'WS'),
(818, '55001', 'FSM Telecom Micronesia', '550', 'FM'),
(819, '55201', 'Palau National Communications Corp. (a.k.a. PNCC)', '552', 'PW'),
(820, '60201', 'EMS - Mobinil Egypt', '602', 'EG'),
(821, '60202', 'Vodafone Egypt', '602', 'EG'),
(822, '60301', 'Algrie Telecom', '603', 'DZ'),
(823, '60302', 'Orascom Telecom Algrie', '603', 'DZ'),
(824, '60400', 'Meditelecom (GSM) Morocco', '604', 'MA'),
(825, '60401', 'Ittissalat Al Maghrid Morocco', '604', 'MA'),
(826, '60502', 'Tunisie Telecom', '605', 'TN'),
(827, '60503', 'Orascom Telecom Tunisia', '605', 'TN'),
(828, '60701', 'Gamcel Gambia', '607', 'GM'),
(829, '60702', 'Africell Gambia', '607', 'GM'),
(830, '60703', 'Comium Services Ltd Gambia', '607', 'GM'),
(831, '60801', 'Sonatel Senegal', '608', 'SN'),
(832, '60802', 'Sentel GSM Senegal', '608', 'SN'),
(833, '60901', 'Mattel S.A.', '609', 'MR'),
(834, '60902', 'Chinguitel S.A. ', '609', 'MR'),
(835, '60910', 'Mauritel Mobiles ', '609', 'MR'),
(836, '61001', 'Malitel', '610', 'ML'),
(837, '61101', 'Spacetel Guinea', '611', 'GN'),
(838, '61102', 'Sotelgui Guinea', '611', 'GN'),
(839, '61202', 'Atlantique Cellulaire Cote d Ivoire', '612', 'CI'),
(840, '61203', 'Orange Cote dIvoire', '612', 'CI'),
(841, '61204', 'Comium Cote d Ivoire', '612', 'CI'),
(842, '61205', 'Loteny Telecom Cote d Ivoire', '612', 'CI'),
(843, '61206', 'Oricel Cote d Ivoire', '612', 'CI'),
(844, '61207', 'Aircomm Cote d Ivoire', '612', 'CI'),
(845, '61302', 'Celtel Burkina Faso', '613', 'BF'),
(846, '61303', 'Telecel Burkina Faso', '613', 'BF'),
(847, '61401', 'Sahel.Com Niger', '614', 'NE'),
(848, '61402', 'Celtel Niger', '614', 'NE'),
(849, '61403', 'Telecel Niger', '614', 'NE'),
(850, '61501', 'Togo Telecom', '615', 'TG'),
(851, '61601', 'Libercom Benin', '616', 'BJ'),
(852, '61602', 'Telecel Benin', '616', 'BJ'),
(853, '61603', 'Spacetel Benin', '616', 'BJ'),
(854, '61701', 'Cellplus Mauritius', '617', 'MU'),
(855, '61702', 'Mahanagar Telephone (Mauritius) Ltd.', '617', 'MU'),
(856, '61710', 'Emtel Mauritius', '617', 'MU'),
(857, '61804', 'Comium Liberia', '618', 'LR'),
(858, '61901', 'Celtel Sierra Leone', '619', 'SL'),
(859, '61902', 'Millicom Sierra Leone', '619', 'SL'),
(860, '61903', 'Africell Sierra Leone', '619', 'SL'),
(861, '61904', 'Comium (Sierra Leone) Ltd.', '619', 'SL'),
(862, '61905', 'Lintel (Sierra Leone) Ltd.', '619', 'SL'),
(863, '61925', 'Mobitel Sierra Leone', '619', 'SL'),
(864, '61940', 'Datatel (SL) Ltd GSM Sierra Leone', '619', 'SL'),
(865, '61950', 'Dtatel (SL) Ltd CDMA Sierra Leone', '619', 'SL'),
(866, '62001', 'Spacefon Ghana', '620', 'GH'),
(867, '62002', 'Ghana Telecom Mobile', '620', 'GH'),
(868, '62003', 'Mobitel Ghana', '620', 'GH'),
(869, '62004', 'Kasapa Telecom Ltd. Ghana', '620', 'GH'),
(870, '62120', 'Econet Wireless Nigeria Ltd.', '621', 'NG'),
(871, '62130', 'MTN Nigeria Communications', '621', 'NG'),
(872, '62140', 'Nigeria Telecommunications Ltd.', '621', 'NG'),
(873, '62201', 'Celtel Chad', '622', 'TD'),
(874, '62202', 'Tchad Mobile', '622', 'TD'),
(875, '62301', 'Centrafrique Telecom Plus (CTP)', '623', 'CF'),
(876, '62302', 'Telecel Centrafrique (TC)', '623', 'CF'),
(877, '62303', 'Celca (Socatel) Central African Rep.', '623', 'CF'),
(878, '62401', 'Mobile Telephone Networks Cameroon', '624', 'CM'),
(879, '62402', 'Orange Cameroun', '624', 'CM'),
(880, '62501', 'Cabo Verde Telecom', '625', 'CV'),
(881, '62601', 'Companhia Santomese de Telecomunicacoes', '626', 'ST'),
(882, '62701', 'Guinea Ecuatorial de Telecomunicaciones Sociedad Anonima', '627', 'GQ'),
(883, '62801', 'Libertis S.A. Gabon', '628', 'GA'),
(884, '62802', 'Telecel Gabon S.A.', '628', 'GA'),
(885, '62803', 'Celtel Gabon S.A.', '628', 'GA'),
(886, '62901', 'Celtel Congo', '629', 'CG'),
(887, '62910', 'Libertis Telecom Congo', '629', 'CG'),
(888, '63001', 'Vodacom Congo RDC sprl', '630', 'CD'),
(889, '63005', 'Supercell Sprl Congo', '630', 'CD'),
(890, '63086', 'Congo-Chine Telecom s.a.r.l.', '630', 'CD'),
(891, '63102', 'Unitel Angola', '631', 'AO'),
(892, '63201', 'Guinetel S.A. Guinea-Bissau', '632', 'GW'),
(893, '63202', 'Spacetel Guine-Bissau S.A.', '632', 'GW'),
(894, '63301', 'Cable & Wireless (Seychelles) Ltd.', '633', 'SC'),
(895, '63302', 'Mediatech International Ltd. Seychelles', '633', 'SC'),
(896, '63310', 'Telecom (Seychelles) Ltd.', '633', 'SC'),
(897, '63401', 'SD Mobitel Sudan', '634', 'MZ'),
(898, '63402', 'Areeba-Sudan', '634', 'MZ'),
(899, '63510', 'MTN Rwandacell', '635', 'RW'),
(900, '63601', 'ETH MTN Ethiopia', '636', 'ET'),
(901, '63730', 'Golis Telecommunications Company Somalia', '637', 'SO'),
(902, '63801', 'Evatis Djibouti', '638', 'DJ'),
(903, '63902', 'Safaricom Ltd. Kenya', '639', 'KE'),
(904, '63903', 'Kencell Communications Ltd. Kenya', '639', 'KE'),
(905, '64002', 'MIC (T) Ltd. Tanzania', '640', 'TZ'),
(906, '64003', 'Zantel Tanzania', '640', 'TZ'),
(907, '64004', 'Vodacom (T) Ltd. Tanzania', '640', 'TZ'),
(908, '64005', 'Celtel (T) Ltd. Tanzania', '640', 'TZ');
INSERT INTO `razor_dim_devicesupplier` (`devicesupplier_sk`, `mccmnc`, `devicesupplier_name`, `countrycode`, `countryname`) VALUES
(909, '64101', 'Celtel Uganda', '641', 'UG'),
(910, '64110', 'MTN Uganda Ltd.', '641', 'UG'),
(911, '64111', 'Uganda Telecom Ltd.', '641', 'UG'),
(912, '64201', 'Spacetel Burundi', '642', 'BI'),
(913, '64202', 'Safaris Burundi', '642', 'BI'),
(914, '64203', 'Telecel Burundi Company', '642', 'BI'),
(915, '64301', 'T.D.M. GSM Mozambique', '643', 'MZ'),
(916, '64304', 'VM Sarl Mozambique', '643', 'MZ'),
(917, '64501', 'Celtel Zambia Ltd.', '645', 'ZM'),
(918, '64502', 'Telecel Zambia Ltd.', '645', 'ZM'),
(919, '64503', 'Zamtel Zambia', '645', 'ZM'),
(920, '64601', 'MADACOM Madagascar', '646', 'MG'),
(921, '64602', 'Orange Madagascar', '646', 'MG'),
(922, '64604', 'Telecom Malagasy Mobile Madagascar', '646', 'MG'),
(923, '64700', 'Orange La Reunion', '647', 'RE'),
(924, '64702', 'Outremer Telecom', '647', 'RE'),
(925, '64710', 'Societe Reunionnaise du Radiotelephone', '647', 'RE'),
(926, '64801', 'Net One Zimbabwe', '648', 'ZW'),
(927, '64803', 'Telecel Zimbabwe', '648', 'ZW'),
(928, '64804', 'Econet Zimbabwe', '648', 'ZW'),
(929, '64901', 'Mobile Telecommunications Ltd. Namibia', '649', 'NA'),
(930, '64903', 'Powercom Pty Ltd Namibia', '649', 'NA'),
(931, '65001', 'Telekom Network Ltd. Malawi', '650', 'MW'),
(932, '65010', 'Celtel ltd. Malawi', '650', 'MW'),
(933, '65101', 'Vodacom Lesotho (pty) Ltd.', '651', 'LS'),
(934, '65102', 'Econet Ezin-cel Lesotho', '651', 'LS'),
(935, '65201', 'Mascom Wireless (Pty) Ltd. Botswana', '652', 'BW'),
(936, '65202', 'Orange Botswana (Pty) Ltd.', '652', 'BW'),
(937, '65310', 'Swazi MTN', '653', 'SZ'),
(938, '65401', 'HURI - SNPT Comoros', '654', 'KM'),
(939, '65501', 'Vodacom (Pty) Ltd. South Africa', '655', 'ZA'),
(940, '65506', 'Sentech (Pty) Ltd. South Africa', '655', 'ZA'),
(941, '65507', 'Cell C (Pty) Ltd. South Africa', '655', 'ZA'),
(942, '65510', 'Mobile Telephone Networks South Africa', '655', 'ZA'),
(943, '65511', 'SAPS Gauteng South Africa', '655', 'ZA'),
(944, '65521', 'Cape Town Metropolitan Council South Africa', '655', 'ZA'),
(945, '65530', 'Bokamoso Consortium South Africa', '655', 'ZA'),
(946, '65531', 'Karabo Telecoms (Pty) Ltd. South Africa', '655', 'ZA'),
(947, '65532', 'Ilizwi Telecommunications South Africa', '655', 'ZA'),
(948, '65533', 'Thinta Thinta Telecommunications South Africa', '655', 'ZA'),
(949, '65534', 'Bokone Telecoms South Africa', '655', 'ZA'),
(950, '65535', 'Kingdom Communications South Africa', '655', 'ZA'),
(951, '65536', 'Amatole Telecommunication Services South Africa', '655', 'ZA'),
(952, '70267', 'Belize Telecommunications Ltd., GSM 1900', '702', 'BZ'),
(953, '70268', 'International Telecommunications Ltd. (INTELCO) Belize', '702', 'BZ'),
(954, '70401', 'Servicios de Comunicaciones Personales Inalambricas, S.A. Guatemala', '704', 'GT'),
(955, '70402', 'Comunicaciones Celulares S.A. Guatemala', '704', 'GT'),
(956, '70403', 'Telefonica Centroamerica Guatemala S.A.', '704', 'GT'),
(957, '70601', 'CTE Telecom Personal, S.A. de C.V. El Salvador', '706', 'SV'),
(958, '70602', 'Digicel, S.A. de C.V. El Salvador', '706', 'SV'),
(959, '70603', 'Telemovil El Salvador, S.A.', '706', 'SV'),
(960, '708001', 'Megatel Honduras', '708', 'HN'),
(961, '708002', 'Celtel Honduras', '708', 'HN'),
(962, '708040', 'Digicel Honduras', '708', 'HN'),
(963, '71021', 'Empresa Nicaraguense de Telecomunicaciones, S.A. (ENITEL)', '710', 'NI'),
(964, '71073', 'Servicios de Comunicaciones, S.A. (SERCOM) Nicaragua', '710', 'NI'),
(965, '71201', 'Instituto Costarricense de Electricidad - ICE', '712', 'CR'),
(966, '71401', 'Cable & Wireless Panama S.A.', '714', 'PA'),
(967, '71402', 'BSC de Panama S.A.', '714', 'PA'),
(968, '71610', 'TIM Peru', '716', 'PE'),
(969, '722010', 'Compaia de Radiocomunicaciones Moviles S.A. Argentina', '722', 'AR'),
(970, '722020', 'Nextel Argentina srl', '722', 'AR'),
(971, '722070', 'Telefonica Comunicaciones Personales S.A. Argentina', '722', 'AR'),
(972, '722310', 'CTI PCS S.A. Argentina', '722', 'AR'),
(973, '722320', 'Compaia de Telefonos del Interior Norte S.A. Argentina', '722', 'AR'),
(974, '722330', 'Compaia de Telefonos del Interior S.A. Argentina', '722', 'AR'),
(975, '722341', 'Telecom Personal S.A. Argentina', '722', 'AR'),
(976, '72400', 'Telet Brazil', '724', 'BR'),
(977, '72401', 'CRT Cellular Brazil', '724', 'BR'),
(978, '72402', 'Global Telecom Brazil', '724', 'BR'),
(979, '72403', 'CTMR Cel Brazil', '724', 'BR'),
(980, '72404', 'BCP Brazil', '724', 'BR'),
(981, '72405', 'Telesc Cel Brazil', '724', 'BR'),
(982, '72406', 'Tess Brazil', '724', 'BR'),
(983, '72407', 'Sercontel Cel Brazil', '724', 'BR'),
(984, '72408', 'Maxitel MG Brazil', '724', 'BR'),
(985, '72409', 'Telepar Cel Brazil', '724', 'BR'),
(986, '72410', 'ATL Algar Brazil', '724', 'BR'),
(987, '72411', 'Telems Cel Brazil', '724', 'BR'),
(988, '72412', 'Americel Brazil', '724', 'BR'),
(989, '72413', 'Telesp Cel Brazil', '724', 'BR'),
(990, '72414', 'Maxitel BA Brazil', '724', 'BR'),
(991, '72415', 'CTBC Cel Brazil', '724', 'BR'),
(992, '72416', 'BSE Brazil', '724', 'BR'),
(993, '72417', 'Ceterp Cel Brazil', '724', 'BR'),
(994, '72418', 'Norte Brasil Tel', '724', 'BR'),
(995, '72419', 'Telemig Cel Brazil', '724', 'BR'),
(996, '72421', 'Telerj Cel Brazil', '724', 'BR'),
(997, '72423', 'Telest Cel Brazil', '724', 'BR'),
(998, '72425', 'Telebrasilia Cel', '724', 'BR'),
(999, '72427', 'Telegoias Cel Brazil', '724', 'BR'),
(1000, '72429', 'Telemat Cel Brazil', '724', 'BR'),
(1001, '72431', 'Teleacre Cel Brazil', '724', 'BR'),
(1002, '72433', 'Teleron Cel Brazil', '724', 'BR'),
(1003, '72435', 'Telebahia Cel Brazil', '724', 'BR'),
(1004, '72437', 'Telergipe Cel Brazil', '724', 'BR'),
(1005, '72439', 'Telasa Cel Brazil', '724', 'BR'),
(1006, '72441', 'Telpe Cel Brazil', '724', 'BR'),
(1007, '72443', 'Telepisa Cel Brazil', '724', 'BR'),
(1008, '72445', 'Telpa Cel Brazil', '724', 'BR'),
(1009, '72447', 'Telern Cel Brazil', '724', 'BR'),
(1010, '72448', 'Teleceara Cel Brazil', '724', 'BR'),
(1011, '72451', 'Telma Cel Brazil', '724', 'BR'),
(1012, '72453', 'Telepara Cel Brazil', '724', 'BR'),
(1013, '72455', 'Teleamazon Cel Brazil', '724', 'BR'),
(1014, '72457', 'Teleamapa Cel Brazil', '724', 'BR'),
(1015, '72459', 'Telaima Cel Brazil', '724', 'BR'),
(1016, '73001', 'Entel Telefonica Movil Chile', '730', 'CL'),
(1017, '73002', 'Telefonica Movil Chile', '730', 'CL'),
(1018, '73003', 'Smartcom Chile', '730', 'CL'),
(1019, '73004', 'Centennial Cayman Corp. Chile S.A.', '730', 'CL'),
(1020, '73005', 'Multikom S.A. Chile', '730', 'CL'),
(1021, '73010', 'Entel Chile', '730', 'CL'),
(1022, '732001', 'Colombia Telecomunicaciones S.A. - Telecom', '732', 'CO'),
(1023, '732002', 'Edatel S.A. Colombia', '732', 'CO'),
(1024, '732101', 'Comcel S.A. Occel S.A./Celcaribe Colombia', '732', 'CO'),
(1025, '732102', 'Bellsouth Colombia S.A.', '732', 'CO'),
(1026, '732103', 'Colombia Movil S.A.', '732', 'CO'),
(1027, '732111', 'Colombia Movil S.A.', '732', 'CO'),
(1028, '732123', 'Telfonica Moviles Colombia S.A.', '732', 'CO'),
(1029, '73401', 'Infonet Venezuela', '734', 'VE'),
(1030, '73402', 'Corporacion Digitel Venezuela', '734', 'VE'),
(1031, '73403', 'Digicel Venezuela', '734', 'VE'),
(1032, '73404', 'Telcel, C.A. Venezuela', '734', 'VE'),
(1033, '73601', 'Nuevatel S.A. Bolivia', '736', 'BO'),
(1034, '73602', 'ENTEL S.A. Bolivia', '736', 'BO'),
(1035, '73603', 'Telecel S.A. Bolivia', '736', 'BO'),
(1036, '73801', 'Cel*Star (Guyana) Inc.', '738', 'GY'),
(1037, '74000', 'Otecel S.A. - Bellsouth Ecuador', '740', 'EC'),
(1038, '74001', 'Porta GSM Ecuador', '740', 'EC'),
(1039, '74002', 'Telecsa S.A. Ecuador', '740', 'EC'),
(1040, '74401', 'Hola Paraguay S.A.', '744', 'PY'),
(1041, '74402', 'Hutchison Telecom S.A. Paraguay', '744', 'PY'),
(1042, '74403', 'Compania Privada de Comunicaciones S.A. Paraguay', '744', 'PY'),
(1043, '74602', 'Telesur Suriname', '746', 'SR'),
(1044, '74800', 'Ancel TDMA Uruguay', '748', 'UY'),
(1045, '74801', 'Ancel GSM Uruguay', '748', 'UY'),
(1046, '74803', 'Ancel Uruguay', '748', 'UY'),
(1047, '74807', 'Movistar Uruguay', '748', 'UY'),
(1048, '74810', 'CTI Movil Uruguay', '748', 'UY'),
(1049, '90101', 'ICO Global Communications', '901', 'International Mobile, shared code'),
(1050, '90102', 'Sense Communications International AS', '901', 'International Mobile, shared code'),
(1051, '90103', 'Iridium Satellite, LLC (GMSS)', '901', 'International Mobile, shared code'),
(1052, '90104', 'Globalstar International Mobile', '901', 'International Mobile, shared code'),
(1053, '90105', 'Thuraya RMSS Network', '901', 'International Mobile, shared code'),
(1054, '90106', 'Thuraya Satellite Telecommunications Company', '901', 'International Mobile, shared code'),
(1055, '90107', 'Ellipso International Mobile', '901', 'International Mobile, shared code'),
(1056, '90108', 'GSM International Mobile', '901', 'International Mobile, shared code'),
(1057, '90109', 'Tele1 Europe', '901', 'International Mobile, shared code'),
(1058, '90110', 'Asia Cellular Satellite (AceS)', '901', 'International Mobile, shared code'),
(1059, '90111', 'Inmarsat Ltd.', '901', 'International Mobile, shared code'),
(1060, '90112', 'Maritime Communications Partner AS (MCP network)', '901', 'International Mobile, shared code'),
(1061, '90113', 'Global Networks, Inc.', '901', 'International Mobile, shared code'),
(1062, '90114', 'Telenor GSM - services in aircraft', '901', 'International Mobile, shared code'),
(1063, '90115', 'SITA GSM services in aircraft', '901', 'International Mobile, shared code'),
(1064, '90116', 'Jasper Systems, Inc.', '901', 'International Mobile, shared code'),
(1065, '90117', 'Jersey Telecom', '901', 'International Mobile, shared code'),
(1066, '90118', 'Cingular Wireless', '901', 'International Mobile, shared code'),
(1067, '90119', 'Vodaphone Malta', '901', 'International Mobile, shared code');
-- --------------------------------------------------------
--
-- 表的结构 `razor_dim_errortitle`
--
CREATE TABLE IF NOT EXISTS `razor_dim_errortitle` (
`title_sk` int(11) NOT NULL,
`title_name` text NOT NULL,
`isfix` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- 表的结构 `razor_dim_event`
--
CREATE TABLE IF NOT EXISTS `razor_dim_event` (
`event_sk` int(11) NOT NULL,
`eventidentifier` varchar(50) NOT NULL,
`eventname` varchar(50) NOT NULL,
`active` int(11) NOT NULL,
`product_id` int(11) NOT NULL,
`createtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`event_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- 表的结构 `razor_dim_location`
--
CREATE TABLE IF NOT EXISTS `razor_dim_location` (
`location_sk` int(11) NOT NULL,
`country` varchar(60) NOT NULL,
`region` varchar(60) NOT NULL,
`city` varchar(60) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- 表的结构 `razor_dim_network`
--
CREATE TABLE IF NOT EXISTS `razor_dim_network` (
`network_sk` int(11) NOT NULL,
`networkname` varchar(256) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- 表的结构 `razor_dim_product`
--
CREATE TABLE IF NOT EXISTS `razor_dim_product` (
`product_sk` int(11) NOT NULL,
`product_id` int(11) NOT NULL,
`product_name` varchar(256) NOT NULL,
`product_type` varchar(128) NOT NULL,
`product_active` tinyint(4) NOT NULL,
`channel_id` int(11) NOT NULL,
`channel_name` varchar(256) NOT NULL,
`channel_active` tinyint(4) NOT NULL,
`product_key` varchar(256) DEFAULT NULL,
`version_name` varchar(64) NOT NULL,
`version_active` tinyint(4) NOT NULL,
`userid` int(11) NOT NULL,
`platform` varchar(128) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- 表的结构 `razor_dim_segment_launch`
--
CREATE TABLE IF NOT EXISTS `razor_dim_segment_launch` (
`segment_sk` int(11) NOT NULL,
`segment_name` varchar(128) NOT NULL,
`startvalue` int(11) NOT NULL,
`endvalue` int(11) NOT NULL,
`effective_date` date NOT NULL,
`expiry_date` date NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8;
--
-- 转存表中的数据 `razor_dim_segment_launch`
--
INSERT INTO `razor_dim_segment_launch` (`segment_sk`, `segment_name`, `startvalue`, `endvalue`, `effective_date`, `expiry_date`) VALUES
(1, '1-2', 1, 2, '0000-00-00', '9999-12-31'),
(2, '3-5', 3, 5, '0000-00-00', '9999-12-31'),
(3, '6-9', 6, 9, '0000-00-00', '9999-12-31'),
(4, '10-19', 10, 19, '0000-00-00', '9999-12-31'),
(5, '20-49', 20, 49, '0000-00-00', '9999-12-31'),
(6, '50', 50, 2147483647, '0000-00-00', '9999-12-31');
-- --------------------------------------------------------
--
-- 表的结构 `razor_dim_segment_usinglog`
--
CREATE TABLE IF NOT EXISTS `razor_dim_segment_usinglog` (
`segment_sk` int(11) NOT NULL,
`segment_name` varchar(128) NOT NULL,
`startvalue` int(11) NOT NULL,
`endvalue` int(11) NOT NULL,
`effective_date` date NOT NULL,
`expiry_date` date NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8;
--
-- 转存表中的数据 `razor_dim_segment_usinglog`
--
INSERT INTO `razor_dim_segment_usinglog` (`segment_sk`, `segment_name`, `startvalue`, `endvalue`, `effective_date`, `expiry_date`) VALUES
(1, '0-3', 0, 3000, '0000-00-00', '9999-12-31'),
(2, '3-10', 3000, 10000, '0000-00-00', '9999-12-31'),
(3, '10-30', 10000, 30000, '0000-00-00', '9999-12-31'),
(4, '30-60', 30000, 60000, '0000-00-00', '9999-12-31'),
(5, '1-3', 60000, 180000, '0000-00-00', '9999-12-31'),
(6, '3-10', 180000, 600000, '0000-00-00', '9999-12-31'),
(7, '10-30', 600000, 1800000, '0000-00-00', '9999-12-31'),
(8, '30', 1800000, 2147483647, '0000-00-00', '9999-12-31');
-- --------------------------------------------------------
--
-- 表的结构 `razor_fact_clientdata`
--
CREATE TABLE IF NOT EXISTS `razor_fact_clientdata` (
`dataid` int(11) NOT NULL,
`product_sk` int(11) NOT NULL,
`deviceos_sk` int(11) NOT NULL,
`deviceresolution_sk` int(11) NOT NULL,
`devicelanguage_sk` int(11) NOT NULL,
`devicebrand_sk` int(11) NOT NULL,
`devicesupplier_sk` int(11) NOT NULL,
`location_sk` int(11) NOT NULL,
`date_sk` int(11) NOT NULL,
`deviceidentifier` varchar(256) NOT NULL,
`clientdataid` int(11) NOT NULL,
`network_sk` int(11) NOT NULL,
`hour_sk` int(11) NOT NULL,
`isnew` tinyint(4) NOT NULL DEFAULT '1',
`isnew_channel` tinyint(4) NOT NULL DEFAULT '1',
`useridentifier` varchar(256) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- 表的结构 `razor_fact_errorlog`
--
CREATE TABLE IF NOT EXISTS `razor_fact_errorlog` (
`errorid` int(11) NOT NULL,
`date_sk` int(11) NOT NULL,
`product_sk` int(11) NOT NULL,
`osversion_sk` int(11) NOT NULL,
`title_sk` int(11) NOT NULL,
`deviceidentifier` int(11) NOT NULL,
`activity` varchar(512) NOT NULL,
`time` datetime NOT NULL,
`title` text NOT NULL,
`stacktrace` text NOT NULL,
`isfix` int(11) NOT NULL,
`id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- 表的结构 `razor_fact_event`
--
CREATE TABLE IF NOT EXISTS `razor_fact_event` (
`eventid` int(11) NOT NULL,
`event_sk` int(11) NOT NULL,
`product_sk` int(11) NOT NULL,
`date_sk` int(11) NOT NULL,
`deviceid` varchar(50) DEFAULT NULL,
`category` varchar(50) DEFAULT NULL,
`event` varchar(50) NOT NULL,
`label` varchar(50) DEFAULT NULL,
`attachment` varchar(50) DEFAULT NULL,
`clientdate` datetime NOT NULL,
`number` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- 表的结构 `razor_fact_launch_daily`
--
CREATE TABLE IF NOT EXISTS `razor_fact_launch_daily` (
`launchid` int(11) NOT NULL,
`product_sk` int(11) NOT NULL,
`date_sk` int(11) NOT NULL,
`segment_sk` int(11) NOT NULL DEFAULT '0',
`accesscount` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- 表的结构 `razor_fact_usinglog`
--
CREATE TABLE IF NOT EXISTS `razor_fact_usinglog` (
`usingid` int(11) NOT NULL,
`product_sk` int(11) NOT NULL,
`date_sk` int(11) NOT NULL,
`activity_sk` int(11) NOT NULL,
`session_id` varchar(64) NOT NULL,
`duration` int(11) NOT NULL,
`activities` varchar(512) NOT NULL,
`starttime` datetime NOT NULL,
`endtime` datetime NOT NULL,
`uid` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- 表的结构 `razor_fact_usinglog_daily`
--
CREATE TABLE IF NOT EXISTS `razor_fact_usinglog_daily` (
`usingid` int(11) NOT NULL,
`product_sk` int(11) NOT NULL,
`date_sk` int(11) NOT NULL,
`session_id` varchar(64) NOT NULL,
`segment_sk` int(11) NOT NULL DEFAULT '0',
`duration` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- 表的结构 `razor_hour24`
--
CREATE TABLE IF NOT EXISTS `razor_hour24` (
`hour` tinyint(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- 转存表中的数据 `razor_hour24`
--
INSERT INTO `razor_hour24` (`hour`) VALUES
(0),
(1),
(2),
(3),
(4),
(5),
(6),
(7),
(8),
(9),
(10),
(11),
(12),
(13),
(14),
(15),
(16),
(17),
(18),
(19),
(20),
(21),
(22),
(23);
-- --------------------------------------------------------
--
-- 表的结构 `razor_log`
--
CREATE TABLE IF NOT EXISTS `razor_log` (
`id` int(11) NOT NULL,
`op_type` varchar(128) NOT NULL,
`op_name` varchar(256) NOT NULL,
`op_starttime` datetime DEFAULT NULL,
`op_date` datetime DEFAULT NULL,
`affected_rows` int(11) DEFAULT NULL,
`duration` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- 表的结构 `razor_sum_accesslevel`
--
CREATE TABLE IF NOT EXISTS `razor_sum_accesslevel` (
`pid` int(11) NOT NULL,
`product_sk` int(11) DEFAULT NULL,
`fromid` int(11) NOT NULL,
`toid` int(11) NOT NULL,
`level` int(11) DEFAULT NULL,
`count` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- 表的结构 `razor_sum_accesspath`
--
CREATE TABLE IF NOT EXISTS `razor_sum_accesspath` (
`pid` int(11) NOT NULL,
`product_sk` int(11) DEFAULT NULL,
`fromid` int(11) NOT NULL,
`toid` int(11) NOT NULL,
`jump` int(11) DEFAULT NULL,
`count` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- 表的结构 `razor_sum_basic_activeusers`
--
CREATE TABLE IF NOT EXISTS `razor_sum_basic_activeusers` (
`product_id` int(11) NOT NULL,
`week_activeuser` int(11) NOT NULL DEFAULT '0',
`month_activeuser` int(11) NOT NULL DEFAULT '0',
`week_percent` float NOT NULL DEFAULT '0',
`month_percent` float NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- 表的结构 `razor_sum_basic_byhour`
--
CREATE TABLE IF NOT EXISTS `razor_sum_basic_byhour` (
`fid` int(11) NOT NULL,
`product_sk` int(11) NOT NULL,
`date_sk` int(11) NOT NULL,
`hour_sk` tinyint(11) NOT NULL,
`sessions` int(11) NOT NULL DEFAULT '0',
`startusers` int(11) NOT NULL DEFAULT '0',
`newusers` int(11) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- 表的结构 `razor_sum_basic_channel`
--
CREATE TABLE IF NOT EXISTS `razor_sum_basic_channel` (
`sid` int(11) NOT NULL,
`product_id` int(11) NOT NULL,
`channel_id` int(11) NOT NULL,
`date_sk` int(11) NOT NULL,
`sessions` int(11) NOT NULL DEFAULT '0',
`startusers` int(11) NOT NULL DEFAULT '0',
`newusers` int(11) NOT NULL DEFAULT '0',
`upgradeusers` int(11) NOT NULL DEFAULT '0',
`allusers` int(11) NOT NULL DEFAULT '0',
`allsessions` int(11) NOT NULL DEFAULT '0',
`usingtime` int(11) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- 表的结构 `razor_sum_basic_channel_activeusers`
--
CREATE TABLE IF NOT EXISTS `razor_sum_basic_channel_activeusers` (
`pid` int(11) NOT NULL,
`date_sk` int(11) NOT NULL,
`product_id` int(11) NOT NULL,
`channel_id` int(11) NOT NULL,
`activeuser` int(11) NOT NULL DEFAULT '0',
`percent` float NOT NULL DEFAULT '0',
`flag` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- 表的结构 `razor_sum_basic_product`
--
CREATE TABLE IF NOT EXISTS `razor_sum_basic_product` (
`sid` int(11) NOT NULL,
`product_id` int(11) NOT NULL,
`date_sk` int(11) NOT NULL,
`sessions` int(11) NOT NULL DEFAULT '0',
`startusers` int(11) NOT NULL DEFAULT '0',
`newusers` int(11) NOT NULL DEFAULT '0',
`upgradeusers` int(11) NOT NULL DEFAULT '0',
`allusers` int(11) NOT NULL DEFAULT '0',
`allsessions` int(11) NOT NULL DEFAULT '0',
`usingtime` int(11) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- 表的结构 `razor_sum_basic_product_version`
--
CREATE TABLE IF NOT EXISTS `razor_sum_basic_product_version` (
`sid` int(11) NOT NULL,
`product_id` int(11) NOT NULL,
`date_sk` int(11) NOT NULL,
`version_name` varchar(64) NOT NULL,
`sessions` int(11) NOT NULL DEFAULT '0',
`startusers` int(11) NOT NULL DEFAULT '0',
`newusers` int(11) NOT NULL DEFAULT '0',
`upgradeusers` int(11) NOT NULL DEFAULT '0',
`allusers` int(11) NOT NULL DEFAULT '0',
`allsessions` int(11) NOT NULL DEFAULT '0',
`usingtime` int(11) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- 表的结构 `razor_sum_devicebrand`
--
CREATE TABLE IF NOT EXISTS `razor_sum_devicebrand` (
`did` int(11) unsigned NOT NULL,
`product_id` int(11) NOT NULL,
`date_sk` int(11) NOT NULL,
`devicebrand_sk` int(11) NOT NULL,
`sessions` int(11) NOT NULL DEFAULT '0',
`newusers` int(11) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- 表的结构 `razor_sum_devicenetwork`
--
CREATE TABLE IF NOT EXISTS `razor_sum_devicenetwork` (
`did` int(11) unsigned NOT NULL,
`product_id` int(11) NOT NULL,
`date_sk` int(11) NOT NULL,
`devicenetwork_sk` int(11) NOT NULL,
`sessions` int(11) NOT NULL DEFAULT '0',
`newusers` int(11) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- 表的结构 `razor_sum_deviceos`
--
CREATE TABLE IF NOT EXISTS `razor_sum_deviceos` (
`did` int(11) unsigned NOT NULL,
`product_id` int(11) NOT NULL,
`date_sk` int(11) NOT NULL,
`deviceos_sk` int(11) NOT NULL,
`sessions` int(11) NOT NULL DEFAULT '0',
`newusers` int(11) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- 表的结构 `razor_sum_deviceresolution`
--
CREATE TABLE IF NOT EXISTS `razor_sum_deviceresolution` (
`did` int(11) unsigned NOT NULL,
`product_id` int(11) NOT NULL,
`date_sk` int(11) NOT NULL,
`deviceresolution_sk` int(11) NOT NULL,
`sessions` int(11) NOT NULL DEFAULT '0',
`newusers` int(11) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- 表的结构 `razor_sum_devicesupplier`
--
CREATE TABLE IF NOT EXISTS `razor_sum_devicesupplier` (
`did` int(11) unsigned NOT NULL,
`product_id` int(11) NOT NULL,
`date_sk` int(11) NOT NULL,
`devicesupplier_sk` int(11) NOT NULL,
`sessions` int(11) NOT NULL DEFAULT '0',
`newusers` int(11) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- 表的结构 `razor_sum_event`
--
CREATE TABLE IF NOT EXISTS `razor_sum_event` (
`eid` int(11) unsigned NOT NULL,
`product_sk` int(11) NOT NULL,
`date_sk` int(11) NOT NULL,
`event_sk` int(11) NOT NULL,
`total` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- 表的结构 `razor_sum_location`
--
CREATE TABLE IF NOT EXISTS `razor_sum_location` (
`lid` int(11) unsigned NOT NULL,
`product_id` int(11) NOT NULL,
`date_sk` int(11) NOT NULL,
`location_sk` int(11) NOT NULL,
`sessions` int(11) NOT NULL DEFAULT '0',
`newusers` int(11) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- 表的结构 `razor_sum_reserveusers_daily`
--
CREATE TABLE IF NOT EXISTS `razor_sum_reserveusers_daily` (
`rid` int(11) NOT NULL,
`startdate_sk` int(11) NOT NULL,
`enddate_sk` int(11) NOT NULL,
`product_id` int(11) NOT NULL,
`version_name` varchar(128) NOT NULL,
`channel_name` varchar(128) NOT NULL,
`usercount` int(11) NOT NULL DEFAULT '0',
`day1` int(11) NOT NULL DEFAULT '0',
`day2` int(11) NOT NULL DEFAULT '0',
`day3` int(11) NOT NULL DEFAULT '0',
`day4` int(11) NOT NULL DEFAULT '0',
`day5` int(11) NOT NULL DEFAULT '0',
`day6` int(11) NOT NULL DEFAULT '0',
`day7` int(11) NOT NULL DEFAULT '0',
`day8` int(11) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- 表的结构 `razor_sum_reserveusers_monthly`
--
CREATE TABLE IF NOT EXISTS `razor_sum_reserveusers_monthly` (
`rid` int(11) NOT NULL,
`startdate_sk` int(11) NOT NULL,
`enddate_sk` int(11) NOT NULL,
`product_id` int(11) NOT NULL,
`version_name` varchar(128) NOT NULL,
`channel_name` varchar(128) NOT NULL,
`usercount` int(11) NOT NULL DEFAULT '0',
`month1` int(11) NOT NULL DEFAULT '0',
`month2` int(11) NOT NULL DEFAULT '0',
`month3` int(11) NOT NULL DEFAULT '0',
`month4` int(11) NOT NULL DEFAULT '0',
`month5` int(11) NOT NULL DEFAULT '0',
`month6` int(11) NOT NULL DEFAULT '0',
`month7` int(11) NOT NULL DEFAULT '0',
`month8` int(11) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- 表的结构 `razor_sum_reserveusers_weekly`
--
CREATE TABLE IF NOT EXISTS `razor_sum_reserveusers_weekly` (
`rid` int(11) NOT NULL,
`startdate_sk` int(11) NOT NULL,
`enddate_sk` int(11) NOT NULL,
`product_id` int(11) NOT NULL,
`version_name` varchar(128) NOT NULL,
`channel_name` varchar(128) NOT NULL,
`usercount` int(11) NOT NULL DEFAULT '0',
`week1` int(11) NOT NULL DEFAULT '0',
`week2` int(11) NOT NULL DEFAULT '0',
`week3` int(11) NOT NULL DEFAULT '0',
`week4` int(11) NOT NULL DEFAULT '0',
`week5` int(11) NOT NULL DEFAULT '0',
`week6` int(11) NOT NULL DEFAULT '0',
`week7` int(11) NOT NULL DEFAULT '0',
`week8` int(11) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- 表的结构 `razor_sum_usinglog_activity`
--
CREATE TABLE IF NOT EXISTS `razor_sum_usinglog_activity` (
`usingid` int(11) NOT NULL,
`date_sk` int(11) NOT NULL,
`product_sk` int(11) NOT NULL,
`activity_sk` int(11) DEFAULT NULL,
`accesscount` int(11) NOT NULL DEFAULT '0',
`totaltime` int(11) NOT NULL DEFAULT '0',
`exitcount` int(11) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Indexes for dumped tables
--
--
-- Indexes for table `razor_deviceid_pushid`
--
ALTER TABLE `razor_deviceid_pushid`
ADD PRIMARY KEY (`did`),
ADD UNIQUE KEY `deviceid` (`deviceid`,`pushid`),
ADD KEY `pushid` (`pushid`);
--
-- Indexes for table `razor_deviceid_userid`
--
ALTER TABLE `razor_deviceid_userid`
ADD PRIMARY KEY (`did`),
ADD UNIQUE KEY `deviceid` (`deviceid`,`userid`),
ADD KEY `userid` (`userid`);
--
-- Indexes for table `razor_dim_activity`
--
ALTER TABLE `razor_dim_activity`
ADD PRIMARY KEY (`activity_sk`),
ADD KEY `activity_name` (`activity_name`(255),`product_id`);
--
-- Indexes for table `razor_dim_date`
--
ALTER TABLE `razor_dim_date`
ADD PRIMARY KEY (`date_sk`),
ADD KEY `year` (`year`,`month`,`day`),
ADD KEY `year_2` (`year`,`week`),
ADD KEY `datevalue` (`datevalue`);
--
-- Indexes for table `razor_dim_devicebrand`
--
ALTER TABLE `razor_dim_devicebrand`
ADD PRIMARY KEY (`devicebrand_sk`),
ADD KEY `devicebrand_name` (`devicebrand_name`);
--
-- Indexes for table `razor_dim_devicelanguage`
--
ALTER TABLE `razor_dim_devicelanguage`
ADD PRIMARY KEY (`devicelanguage_sk`),
ADD KEY `devicelanguage_name` (`devicelanguage_name`);
--
-- Indexes for table `razor_dim_deviceos`
--
ALTER TABLE `razor_dim_deviceos`
ADD PRIMARY KEY (`deviceos_sk`),
ADD KEY `deviceos_name` (`deviceos_name`(255));
--
-- Indexes for table `razor_dim_deviceresolution`
--
ALTER TABLE `razor_dim_deviceresolution`
ADD PRIMARY KEY (`deviceresolution_sk`),
ADD KEY `deviceresolution_name` (`deviceresolution_name`);
--
-- Indexes for table `razor_dim_devicesupplier`
--
ALTER TABLE `razor_dim_devicesupplier`
ADD PRIMARY KEY (`devicesupplier_sk`),
ADD KEY `devicesupplier_name` (`devicesupplier_name`),
ADD KEY `mccmnc` (`mccmnc`);
--
-- Indexes for table `razor_dim_errortitle`
--
ALTER TABLE `razor_dim_errortitle`
ADD PRIMARY KEY (`title_sk`),
ADD KEY `title_name` (`title_name`(255));
--
-- Indexes for table `razor_dim_event`
--
ALTER TABLE `razor_dim_event`
ADD PRIMARY KEY (`event_sk`);
--
-- Indexes for table `razor_dim_location`
--
ALTER TABLE `razor_dim_location`
ADD PRIMARY KEY (`location_sk`),
ADD KEY `country` (`country`,`region`,`city`);
--
-- Indexes for table `razor_dim_network`
--
ALTER TABLE `razor_dim_network`
ADD PRIMARY KEY (`network_sk`);
--
-- Indexes for table `razor_dim_product`
--
ALTER TABLE `razor_dim_product`
ADD PRIMARY KEY (`product_sk`),
ADD UNIQUE KEY `product_id` (`product_id`,`channel_id`,`version_name`,`userid`);
--
-- Indexes for table `razor_dim_segment_launch`
--
ALTER TABLE `razor_dim_segment_launch`
ADD PRIMARY KEY (`segment_sk`);
--
-- Indexes for table `razor_dim_segment_usinglog`
--
ALTER TABLE `razor_dim_segment_usinglog`
ADD PRIMARY KEY (`segment_sk`);
--
-- Indexes for table `razor_fact_clientdata`
--
ALTER TABLE `razor_fact_clientdata`
ADD PRIMARY KEY (`dataid`),
ADD KEY `deviceidentifier` (`deviceidentifier`(255)),
ADD KEY `product_sk` (`product_sk`,`date_sk`,`deviceidentifier`(255));
--
-- Indexes for table `razor_fact_errorlog`
--
ALTER TABLE `razor_fact_errorlog`
ADD PRIMARY KEY (`errorid`);
--
-- Indexes for table `razor_fact_event`
--
ALTER TABLE `razor_fact_event`
ADD PRIMARY KEY (`eventid`),
ADD KEY `date_sk` (`date_sk`,`product_sk`);
--
-- Indexes for table `razor_fact_launch_daily`
--
ALTER TABLE `razor_fact_launch_daily`
ADD PRIMARY KEY (`launchid`),
ADD UNIQUE KEY `product_sk` (`product_sk`,`date_sk`,`segment_sk`);
--
-- Indexes for table `razor_fact_usinglog`
--
ALTER TABLE `razor_fact_usinglog`
ADD PRIMARY KEY (`usingid`);
--
-- Indexes for table `razor_fact_usinglog_daily`
--
ALTER TABLE `razor_fact_usinglog_daily`
ADD PRIMARY KEY (`usingid`),
ADD UNIQUE KEY `product_sk` (`product_sk`,`date_sk`,`session_id`);
--
-- Indexes for table `razor_hour24`
--
ALTER TABLE `razor_hour24`
ADD PRIMARY KEY (`hour`);
--
-- Indexes for table `razor_log`
--
ALTER TABLE `razor_log`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `razor_sum_accesslevel`
--
ALTER TABLE `razor_sum_accesslevel`
ADD PRIMARY KEY (`pid`),
ADD UNIQUE KEY `date_sk` (`product_sk`,`fromid`,`toid`,`level`);
--
-- Indexes for table `razor_sum_accesspath`
--
ALTER TABLE `razor_sum_accesspath`
ADD PRIMARY KEY (`pid`),
ADD UNIQUE KEY `date_sk` (`product_sk`,`fromid`,`toid`,`jump`);
--
-- Indexes for table `razor_sum_basic_activeusers`
--
ALTER TABLE `razor_sum_basic_activeusers`
ADD PRIMARY KEY (`product_id`);
--
-- Indexes for table `razor_sum_basic_byhour`
--
ALTER TABLE `razor_sum_basic_byhour`
ADD PRIMARY KEY (`fid`),
ADD UNIQUE KEY `product_sk` (`product_sk`,`date_sk`,`hour_sk`);
--
-- Indexes for table `razor_sum_basic_channel`
--
ALTER TABLE `razor_sum_basic_channel`
ADD PRIMARY KEY (`sid`),
ADD UNIQUE KEY `channel_id` (`product_id`,`channel_id`,`date_sk`);
--
-- Indexes for table `razor_sum_basic_channel_activeusers`
--
ALTER TABLE `razor_sum_basic_channel_activeusers`
ADD PRIMARY KEY (`pid`),
ADD UNIQUE KEY `date_sk` (`date_sk`,`product_id`,`channel_id`,`flag`);
--
-- Indexes for table `razor_sum_basic_product`
--
ALTER TABLE `razor_sum_basic_product`
ADD PRIMARY KEY (`sid`),
ADD UNIQUE KEY `product_id` (`product_id`,`date_sk`);
--
-- Indexes for table `razor_sum_basic_product_version`
--
ALTER TABLE `razor_sum_basic_product_version`
ADD PRIMARY KEY (`sid`),
ADD UNIQUE KEY `product_id` (`product_id`,`date_sk`,`version_name`);
--
-- Indexes for table `razor_sum_devicebrand`
--
ALTER TABLE `razor_sum_devicebrand`
ADD PRIMARY KEY (`did`),
ADD UNIQUE KEY `index_devicebrand` (`product_id`,`date_sk`,`devicebrand_sk`);
--
-- Indexes for table `razor_sum_devicenetwork`
--
ALTER TABLE `razor_sum_devicenetwork`
ADD PRIMARY KEY (`did`),
ADD UNIQUE KEY `index_devicenetwork` (`product_id`,`date_sk`,`devicenetwork_sk`);
--
-- Indexes for table `razor_sum_deviceos`
--
ALTER TABLE `razor_sum_deviceos`
ADD PRIMARY KEY (`did`),
ADD UNIQUE KEY `index_deviceos` (`product_id`,`date_sk`,`deviceos_sk`);
--
-- Indexes for table `razor_sum_deviceresolution`
--
ALTER TABLE `razor_sum_deviceresolution`
ADD PRIMARY KEY (`did`),
ADD UNIQUE KEY `index_deviceresolution` (`product_id`,`date_sk`,`deviceresolution_sk`);
--
-- Indexes for table `razor_sum_devicesupplier`
--
ALTER TABLE `razor_sum_devicesupplier`
ADD PRIMARY KEY (`did`),
ADD UNIQUE KEY `index_devicesupplier` (`product_id`,`date_sk`,`devicesupplier_sk`);
--
-- Indexes for table `razor_sum_event`
--
ALTER TABLE `razor_sum_event`
ADD PRIMARY KEY (`eid`),
ADD UNIQUE KEY `product_sk` (`product_sk`,`date_sk`,`event_sk`);
--
-- Indexes for table `razor_sum_location`
--
ALTER TABLE `razor_sum_location`
ADD PRIMARY KEY (`lid`),
ADD UNIQUE KEY `index_location` (`product_id`,`date_sk`,`location_sk`);
--
-- Indexes for table `razor_sum_reserveusers_daily`
--
ALTER TABLE `razor_sum_reserveusers_daily`
ADD PRIMARY KEY (`rid`),
ADD UNIQUE KEY `startdate_sk` (`startdate_sk`,`enddate_sk`,`product_id`,`version_name`,`channel_name`);
--
-- Indexes for table `razor_sum_reserveusers_monthly`
--
ALTER TABLE `razor_sum_reserveusers_monthly`
ADD PRIMARY KEY (`rid`),
ADD UNIQUE KEY `startdate_sk` (`startdate_sk`,`enddate_sk`,`product_id`,`version_name`,`channel_name`);
--
-- Indexes for table `razor_sum_reserveusers_weekly`
--
ALTER TABLE `razor_sum_reserveusers_weekly`
ADD PRIMARY KEY (`rid`),
ADD UNIQUE KEY `startdate_sk` (`startdate_sk`,`enddate_sk`,`product_id`,`version_name`,`channel_name`);
--
-- Indexes for table `razor_sum_usinglog_activity`
--
ALTER TABLE `razor_sum_usinglog_activity`
ADD PRIMARY KEY (`usingid`),
ADD UNIQUE KEY `date_sk` (`date_sk`,`product_sk`,`activity_sk`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `razor_deviceid_pushid`
--
ALTER TABLE `razor_deviceid_pushid`
MODIFY `did` int(11) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `razor_deviceid_userid`
--
ALTER TABLE `razor_deviceid_userid`
MODIFY `did` int(11) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `razor_dim_activity`
--
ALTER TABLE `razor_dim_activity`
MODIFY `activity_sk` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `razor_dim_date`
--
ALTER TABLE `razor_dim_date`
MODIFY `date_sk` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=4019;
--
-- AUTO_INCREMENT for table `razor_dim_devicebrand`
--
ALTER TABLE `razor_dim_devicebrand`
MODIFY `devicebrand_sk` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `razor_dim_devicelanguage`
--
ALTER TABLE `razor_dim_devicelanguage`
MODIFY `devicelanguage_sk` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `razor_dim_deviceos`
--
ALTER TABLE `razor_dim_deviceos`
MODIFY `deviceos_sk` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `razor_dim_deviceresolution`
--
ALTER TABLE `razor_dim_deviceresolution`
MODIFY `deviceresolution_sk` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `razor_dim_devicesupplier`
--
ALTER TABLE `razor_dim_devicesupplier`
MODIFY `devicesupplier_sk` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=1068;
--
-- AUTO_INCREMENT for table `razor_dim_errortitle`
--
ALTER TABLE `razor_dim_errortitle`
MODIFY `title_sk` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `razor_dim_event`
--
ALTER TABLE `razor_dim_event`
MODIFY `event_sk` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `razor_dim_location`
--
ALTER TABLE `razor_dim_location`
MODIFY `location_sk` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `razor_dim_network`
--
ALTER TABLE `razor_dim_network`
MODIFY `network_sk` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `razor_dim_product`
--
ALTER TABLE `razor_dim_product`
MODIFY `product_sk` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `razor_dim_segment_launch`
--
ALTER TABLE `razor_dim_segment_launch`
MODIFY `segment_sk` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=7;
--
-- AUTO_INCREMENT for table `razor_dim_segment_usinglog`
--
ALTER TABLE `razor_dim_segment_usinglog`
MODIFY `segment_sk` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=9;
--
-- AUTO_INCREMENT for table `razor_fact_clientdata`
--
ALTER TABLE `razor_fact_clientdata`
MODIFY `dataid` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `razor_fact_errorlog`
--
ALTER TABLE `razor_fact_errorlog`
MODIFY `errorid` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `razor_fact_event`
--
ALTER TABLE `razor_fact_event`
MODIFY `eventid` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `razor_fact_launch_daily`
--
ALTER TABLE `razor_fact_launch_daily`
MODIFY `launchid` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `razor_fact_usinglog`
--
ALTER TABLE `razor_fact_usinglog`
MODIFY `usingid` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `razor_fact_usinglog_daily`
--
ALTER TABLE `razor_fact_usinglog_daily`
MODIFY `usingid` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `razor_log`
--
ALTER TABLE `razor_log`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `razor_sum_accesslevel`
--
ALTER TABLE `razor_sum_accesslevel`
MODIFY `pid` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `razor_sum_accesspath`
--
ALTER TABLE `razor_sum_accesspath`
MODIFY `pid` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `razor_sum_basic_byhour`
--
ALTER TABLE `razor_sum_basic_byhour`
MODIFY `fid` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `razor_sum_basic_channel`
--
ALTER TABLE `razor_sum_basic_channel`
MODIFY `sid` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `razor_sum_basic_channel_activeusers`
--
ALTER TABLE `razor_sum_basic_channel_activeusers`
MODIFY `pid` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `razor_sum_basic_product`
--
ALTER TABLE `razor_sum_basic_product`
MODIFY `sid` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `razor_sum_basic_product_version`
--
ALTER TABLE `razor_sum_basic_product_version`
MODIFY `sid` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `razor_sum_devicebrand`
--
ALTER TABLE `razor_sum_devicebrand`
MODIFY `did` int(11) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `razor_sum_devicenetwork`
--
ALTER TABLE `razor_sum_devicenetwork`
MODIFY `did` int(11) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `razor_sum_deviceos`
--
ALTER TABLE `razor_sum_deviceos`
MODIFY `did` int(11) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `razor_sum_deviceresolution`
--
ALTER TABLE `razor_sum_deviceresolution`
MODIFY `did` int(11) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `razor_sum_devicesupplier`
--
ALTER TABLE `razor_sum_devicesupplier`
MODIFY `did` int(11) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `razor_sum_event`
--
ALTER TABLE `razor_sum_event`
MODIFY `eid` int(11) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `razor_sum_location`
--
ALTER TABLE `razor_sum_location`
MODIFY `lid` int(11) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `razor_sum_reserveusers_daily`
--
ALTER TABLE `razor_sum_reserveusers_daily`
MODIFY `rid` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `razor_sum_reserveusers_monthly`
--
ALTER TABLE `razor_sum_reserveusers_monthly`
MODIFY `rid` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `razor_sum_reserveusers_weekly`
--
ALTER TABLE `razor_sum_reserveusers_weekly`
MODIFY `rid` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `razor_sum_usinglog_activity`
--
ALTER TABLE `razor_sum_usinglog_activity`
MODIFY `usingid` int(11) NOT NULL AUTO_INCREMENT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true |
1dbe238ddd0e8109a5234eb28ebea09e32a021fc | SQL | enedyboy/Senin_141111251_FerikEnedyWijaya | /Senin_141111251_FerikEnedy/project.sql | UTF-8 | 10,982 | 3.125 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 4.2.7.1
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: Dec 27, 2016 at 06:44 AM
-- Server version: 5.5.39
-- PHP Version: 5.4.31
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: `project`
--
-- --------------------------------------------------------
--
-- Table structure for table `barang`
--
CREATE TABLE IF NOT EXISTS `barang` (
`ID` int(10) NOT NULL,
`Kode` varchar(10) DEFAULT NULL,
`Nama` varchar(20) DEFAULT NULL,
`Stock` decimal(20,0) DEFAULT NULL,
`Harga_Beli` decimal(20,0) DEFAULT NULL,
`Harga_Jual` decimal(20,0) DEFAULT NULL,
`Created_At` datetime DEFAULT NULL,
`Edited_At` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=10 ;
--
-- Dumping data for table `barang`
--
INSERT INTO `barang` (`ID`, `Kode`, `Nama`, `Stock`, `Harga_Beli`, `Harga_Jual`, `Created_At`, `Edited_At`) VALUES
(1, 'a1', 'asdlksadl', '5', '103809138', '1005100', '2016-12-24 15:58:24', '2016-12-24 15:58:24'),
(2, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(3, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(4, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(6, 'abc123', 'Buku Tulis Aa', '66', '200000', '7000000', '2016-12-25 09:55:27', '2016-12-25 09:55:27'),
(7, '', 'asdasd', '0', '0', '0', '2016-12-25 09:59:14', NULL),
(8, '', '', '0', '0', '0', '2016-12-25 10:28:49', NULL),
(9, '01a', 'bintang', '6', '23123123', '52131231', '2016-12-26 16:57:50', NULL);
-- --------------------------------------------------------
--
-- Table structure for table `customer`
--
CREATE TABLE IF NOT EXISTS `customer` (
`ID` int(10) NOT NULL,
`Nama` varchar(20) DEFAULT NULL,
`Alamat` varchar(50) DEFAULT NULL,
`NoHp` varchar(12) DEFAULT NULL,
`Gender` varchar(12) DEFAULT NULL,
`Created_at` datetime DEFAULT NULL,
`Editied_at` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=5 ;
--
-- Dumping data for table `customer`
--
INSERT INTO `customer` (`ID`, `Nama`, `Alamat`, `NoHp`, `Gender`, `Created_at`, `Editied_at`) VALUES
(1, 'asdasdasd', 'oajsdoi', '08123123123', 'Laki-Laki', '2016-12-24 15:57:33', '2016-12-24 15:57:33'),
(2, 'rei', 'abc', '05645645646', NULL, '2016-12-25 23:43:51', '2016-12-26 02:39:12'),
(3, 'rei2123', 'cek123', '123123123', NULL, '2016-12-25 23:43:57', '2016-12-26 00:17:40');
-- --------------------------------------------------------
--
-- Table structure for table `pembelian`
--
CREATE TABLE IF NOT EXISTS `pembelian` (
`id` int(11) NOT NULL,
`kode` varchar(20) NOT NULL,
`id_supplier` int(11) NOT NULL,
`created_at` datetime NOT NULL,
`updated_at` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=18 ;
--
-- Dumping data for table `pembelian`
--
INSERT INTO `pembelian` (`id`, `kode`, `id_supplier`, `created_at`, `updated_at`) VALUES
(2, 'test', 6, '2016-12-22 16:40:41', '2016-12-22 16:40:41'),
(3, 'Inp1', 6, '2016-12-22 16:41:42', '2016-12-22 16:41:42'),
(4, 'test2', 6, '2016-12-22 16:43:07', '2016-12-22 16:43:07'),
(5, 'test32', 6, '2016-12-22 16:44:08', '2016-12-22 16:44:08'),
(6, 'testestt', 3, '2016-12-22 16:44:25', '2016-12-22 16:44:25'),
(7, 'testestete', 3, '2016-12-22 16:44:56', '2016-12-22 16:44:56'),
(8, 'safdsfads', 3, '2016-12-22 16:45:32', '2016-12-22 16:45:32'),
(9, 'test2131232131', 3, '2016-12-22 16:47:02', '2016-12-22 16:47:02'),
(11, 'asd', 1, '2016-12-26 18:16:29', '2016-12-26 18:16:29'),
(12, 'bac', 1, '2016-12-26 18:18:08', '2016-12-26 18:18:08'),
(13, '01', 1, '2016-12-26 23:23:37', '2016-12-26 23:23:37'),
(14, '04', 1, '2016-12-26 23:39:30', '2016-12-26 23:39:30'),
(15, 'j3', 1, '2016-12-26 23:40:12', '2016-12-26 23:40:12'),
(16, 'abc12', 1, '2016-12-26 23:40:52', '2016-12-26 23:40:52'),
(17, '', 6, '2016-12-27 00:33:49', '2016-12-27 00:33:49');
-- --------------------------------------------------------
--
-- Table structure for table `pembelian_detail`
--
CREATE TABLE IF NOT EXISTS `pembelian_detail` (
`id` int(11) NOT NULL,
`kode_pembelian` varchar(100) NOT NULL,
`id_barang` int(11) NOT NULL,
`harga_barang` decimal(10,0) NOT NULL,
`kuantitas` int(11) NOT NULL,
`created_at` datetime NOT NULL,
`updated_at` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=18 ;
--
-- Dumping data for table `pembelian_detail`
--
INSERT INTO `pembelian_detail` (`id`, `kode_pembelian`, `id_barang`, `harga_barang`, `kuantitas`, `created_at`, `updated_at`) VALUES
(2, 'test', 6, '100000', 2, '2016-12-22 16:40:41', '2016-12-22 16:43:02'),
(3, 'lnp1', 6, '100000', 1, '2016-12-22 16:41:42', '2016-12-22 18:33:01'),
(4, 'test2', 6, '100000', 1, '2016-12-22 16:43:07', '2016-12-22 16:43:07'),
(5, 'test32', 6, '100000', 1, '2016-12-22 16:44:08', '2016-12-22 16:44:08'),
(6, 'testestt', 5, '100000', 1, '2016-12-22 16:44:25', '2016-12-22 16:44:25'),
(7, 'testestete', 5, '100000', 2, '2016-12-22 16:44:56', '2016-12-22 16:44:56'),
(8, 'safdsfads', 5, '100000', 12, '2016-12-22 16:45:32', '2016-12-22 16:45:32'),
(9, 'test2131232131', 5, '100000', 1, '2016-12-22 16:47:02', '2016-12-22 16:47:02'),
(10, '04', 1, '0', 0, '2016-12-26 23:39:30', '2016-12-26 23:39:30'),
(11, 'j3', 1, '0', 0, '2016-12-26 23:40:12', '2016-12-26 23:40:12'),
(12, 'abc12', 1, '103809138', 6, '2016-12-26 23:40:52', '2016-12-26 23:40:52'),
(13, 'abc12', 1, '103809138', 12, '2016-12-26 23:42:34', '2016-12-26 23:42:34'),
(14, 'test2', 6, '200000', 7, '2016-12-26 23:44:15', '2016-12-26 23:44:15'),
(15, 'test2', 6, '200000', 7, '2016-12-26 23:44:35', '2016-12-26 23:44:35'),
(16, 'test2', 1, '103809138', 6, '2016-12-26 23:46:08', '2016-12-26 23:46:08'),
(17, '', 6, '200000', 6, '2016-12-27 00:33:49', '2016-12-27 00:33:49');
-- --------------------------------------------------------
--
-- Table structure for table `penjualan`
--
CREATE TABLE IF NOT EXISTS `penjualan` (
`id` int(11) NOT NULL,
`kode` varchar(20) NOT NULL,
`id_customer` int(11) NOT NULL,
`created_at` datetime NOT NULL,
`updated_at` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=12 ;
--
-- Dumping data for table `penjualan`
--
INSERT INTO `penjualan` (`id`, `kode`, `id_customer`, `created_at`, `updated_at`) VALUES
(1, 'FAK-001', 3, '2016-12-22 14:05:45', '2016-12-22 14:05:45'),
(2, 'FAK-002', 3, '2016-12-22 14:46:43', '2016-12-22 14:46:43'),
(3, 'FAK-003', 3, '2016-12-22 15:25:55', '2016-12-22 15:25:55'),
(5, 'FAK-006', 3, '2016-12-27 05:28:34', '2016-12-27 05:28:34'),
(6, 'FAK-004', 2, '2016-12-27 05:28:58', '2016-12-27 05:28:58'),
(7, 'FAK-0010', 1, '2016-12-27 05:33:05', '2016-12-27 05:33:05'),
(8, 'Fak-1001', 1, '2016-12-27 05:33:54', '2016-12-27 05:33:54'),
(9, 'FAK002', 1, '2016-12-27 05:36:54', '2016-12-27 05:36:54'),
(10, 'FAK01', 1, '2016-12-27 05:37:58', '2016-12-27 05:37:58'),
(11, 'a', 3, '2016-12-27 05:41:38', '2016-12-27 05:41:38');
-- --------------------------------------------------------
--
-- Table structure for table `penjualan_detail`
--
CREATE TABLE IF NOT EXISTS `penjualan_detail` (
`id` int(11) NOT NULL,
`kode_penjualan` varchar(50) NOT NULL,
`id_barang` int(11) NOT NULL,
`harga_barang` decimal(10,2) NOT NULL,
`kuantitas` int(11) NOT NULL,
`created_at` datetime NOT NULL,
`updated_at` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=7 ;
--
-- Dumping data for table `penjualan_detail`
--
INSERT INTO `penjualan_detail` (`id`, `kode_penjualan`, `id_barang`, `harga_barang`, `kuantitas`, `created_at`, `updated_at`) VALUES
(1, 'FAK-001', 6, '100000.00', 15, '2016-12-22 15:14:02', '2016-12-22 18:26:40'),
(2, 'FAK-003', 6, '100000.00', 4, '2016-12-22 15:25:55', '2016-12-22 15:25:58'),
(3, 'FAK01', 1, '1005100.00', 9, '2016-12-27 05:37:58', '2016-12-27 05:37:58'),
(4, 'FAK01', 1, '1005100.00', 6, '2016-12-27 05:38:39', '2016-12-27 05:38:39'),
(5, 'FAK-002', 6, '7000000.00', 8, '2016-12-27 05:39:55', '2016-12-27 05:39:55'),
(6, 'a', 1, '1005100.00', 2, '2016-12-27 05:41:38', '2016-12-27 05:41:38');
-- --------------------------------------------------------
--
-- Table structure for table `supplier`
--
CREATE TABLE IF NOT EXISTS `supplier` (
`ID` int(10) NOT NULL,
`Kode` varchar(10) DEFAULT NULL,
`Nama` varchar(20) DEFAULT NULL,
`Alamat` varchar(50) DEFAULT NULL,
`Kota` varchar(30) DEFAULT NULL,
`Contact` varchar(15) DEFAULT NULL,
`Created_at` datetime DEFAULT NULL,
`Join_at` datetime DEFAULT NULL,
`Edit_at` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=8 ;
--
-- Dumping data for table `supplier`
--
INSERT INTO `supplier` (`ID`, `Kode`, `Nama`, `Alamat`, `Kota`, `Contact`, `Created_at`, `Join_at`, `Edit_at`) VALUES
(1, 's1', 'rinaldi', 'va', 'medan', '909132810293', '2016-12-24 15:58:46', '2016-12-24 22:58:30', '2016-12-26 14:57:23'),
(6, 's2', 'hutabarat', 'cengal', 'jakarta', '08213151231', '2016-12-26 14:58:49', '2016-12-26 14:58:49', '2016-12-26 23:44:04');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `barang`
--
ALTER TABLE `barang`
ADD PRIMARY KEY (`ID`);
--
-- Indexes for table `customer`
--
ALTER TABLE `customer`
ADD PRIMARY KEY (`ID`);
--
-- Indexes for table `pembelian`
--
ALTER TABLE `pembelian`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `pembelian_detail`
--
ALTER TABLE `pembelian_detail`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `penjualan`
--
ALTER TABLE `penjualan`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `penjualan_detail`
--
ALTER TABLE `penjualan_detail`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `supplier`
--
ALTER TABLE `supplier`
ADD PRIMARY KEY (`ID`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `barang`
--
ALTER TABLE `barang`
MODIFY `ID` int(10) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=10;
--
-- AUTO_INCREMENT for table `customer`
--
ALTER TABLE `customer`
MODIFY `ID` int(10) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT for table `pembelian`
--
ALTER TABLE `pembelian`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=18;
--
-- AUTO_INCREMENT for table `pembelian_detail`
--
ALTER TABLE `pembelian_detail`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=18;
--
-- AUTO_INCREMENT for table `penjualan`
--
ALTER TABLE `penjualan`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=12;
--
-- AUTO_INCREMENT for table `penjualan_detail`
--
ALTER TABLE `penjualan_detail`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=7;
--
-- AUTO_INCREMENT for table `supplier`
--
ALTER TABLE `supplier`
MODIFY `ID` int(10) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=8;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true |
c14f1e4d3ce7c8efa11a8a11ca4f3d27aa522ca7 | SQL | ducrz/Curso-Oracle-Developer-SQL-e-PL-SQL. | /conteudo/modulo2/temporaria.sql | UTF-8 | 1,901 | 4.03125 | 4 | [] | no_license | -- Sequencia exemplo 1
--A clausula indica que os dados devem ser excluidos no final da transacao ou no final da sessao.
-- criando tabela temporaria
CREATE GLOBAL TEMPORARY TABLE minha_temp (
id NUMBER,
nome VARCHAR2(20)
)
ON COMMIT DELETE ROWS;
-- Inserindo, mas nao realizando commit, .
INSERT INTO minha_temp VALUES (1, 'Teste1');
INSERT INTO minha_temp VALUES (2, 'Teste2');
INSERT INTO minha_temp VALUES (3, 'Teste3');
-- analisando counteudo
SELECT COUNT(*) FROM minha_temp;
select * from minha_temp;
-- Commit and check contents.
COMMIT;
-- analisando counteudo
SELECT COUNT(*) FROM minha_temp;
-- sequencia exemplo 2
--A clausula indica que as linhas devem persistir alem do final da transacao.
-- Eles serao removidos apenas no final da sessao.
CREATE GLOBAL TEMPORARY TABLE minha_temp (
id NUMBER,
nome VARCHAR2(20)
)
ON COMMIT PRESERVE ROWS;
-- Inserindo, realizando commit, .
INSERT INTO minha_temp VALUES (1, 'Teste1');
INSERT INTO minha_temp VALUES (2, 'Teste2');
INSERT INTO minha_temp VALUES (3, 'Teste3');
commit;
-- analisando counteudo
SELECT COUNT(*) FROM minha_temp;
-- desconecta
--reconecta
SELECT COUNT(*) FROM minha_temp;
--carregando uma tabela temp com dados de uma tabela normal
--criando tabela
CREATE global temporary TABLE empregados_temp
(
EMPLOYEE_ID NUMBER(6, 0) NOT NULL
, FIRST_NAME VARCHAR2(20 BYTE)
, LAST_NAME VARCHAR2(25 BYTE) NOT NULL
, COMMISSION_PCT NUMBER(2, 2)
) ON COMMIT DELETE ROWS;
--inserindo registros na temp
insert into empregados_temp
select a.EMPLOYEE_ID,a.FIRST_NAME,a.LAST_NAME,a.COMMISSION_PCT
from HR.EMPLOYEES a;
--verificando dados antes do committ
select count(*) from empregados_temp;
commit;
--verificando dados apos do committ
select count(*) from empregados_temp;
drop table empregados_temp;
drop table minha_temp;
| true |
1e599810872821a1f92f209573c367bb8576b0a0 | SQL | Psayta/Jump_Data_Project | /DataNorm.sql | UTF-8 | 469 | 3.703125 | 4 | [] | no_license | --identifying duplicates
SELECT movie_name, language, year_of_release, COUNT(*)
FROM amazon_movie2
GROUP BY movie_name, language, year_of_release
HAVING COUNT(*) > 1;
--deleted duplicates
DELETE FROM Amazon_Movies2 WHERE movie_name IN (
SELECT max(MOVIE_NAME)
FROM AMAZON_MOVIES2
GROUP BY MOVIE_NAME, language, year_of_release
HAVING COUNT(*) > 1
);
--deleting running time
Alter Table Amazon_movies2
DROP COLUMN Running_Time;
| true |
ead4655cdfaa960cbb7951318697d7a7409a2f0c | SQL | kHeNoTbB/Oracle | /PLSQL/07_PLSQL_Table.sql | UTF-8 | 1,705 | 3.84375 | 4 | [] | no_license | /******************************************************************
PL/SQL 테이블
* 일종의 배열이라고 생각하면 이해하기 쉬움
* 테이블 크기에 제한이 없으며, 행의 크기는 데이터가 들어옴에 따라 자동 증가함
* Binary_integer 타입의 인덱스 번호가 순서대로 정해짐
* 하나의 테이블에 한 개의 컬럼 데이터를 저장함
TYPE prdname_table IS TABLE OF varchar2(30)
INDEX BY BINARY_INTEGER;
prdname_tab prdname_table
******************************************************************/
CREATE OR REPLACE PROCEDURE table_example
(v_deptno IN emp.deptno%TYPE)
IS
TYPE empno_table IS TABLE OF emp.empno%TYPE
INDEX BY BINARY_INTEGER;
TYPE ename_table IS TABLE OF emp.ename%TYPE
INDEX BY BINARY_INTEER;
TYPE sal_table IS TABLE OF emp.sal%TYPE
INDEX BY BINARY_INTEGER;
--테이블 타입으로 변수를 선언해서 사용함
empno_tab empno_table;
ename_tab ename_table;
sal_tab sal_table;
i BINARY_INTEER := 0;
BEGIN
DBMS_OUTPUT.ENABLE;
FOR emp_list IN(SELECT empno
, ename
, sal
FROM emp
WHERE deptno = v_deptno)
LOOP
i := i+1;
empno_tab(i) := emp_list.empno;
ename_tab(i) := emp_list.ename;
sal_tab(i) := emp_list.sal;
END LOOP;
-- 1부터 i까지 for문 실행
FOR cnt IN 1..i LOOP
DBMS_OUTPUT.PUT_LINE( '사원번호 : ' || empno_tab(cnt) );
DBMS_OUTPUT.PUT_LINE( '사원이름 : ' || ename_tab(cnt) );
DBMS_OUTPUT.PUT_LINE( '사원급여 : ' || sal_tab(cnt));
END LOOP;
END;
SET SERVEROUTPUT ON;
EXECUTE table_example(10);
| true |
615a69c4192d8c5f4864b2644d6d22a121a159d7 | SQL | simsim466/foodcourt | /target/classes/db/initDB.sql | UTF-8 | 2,551 | 4.125 | 4 | [] | no_license | DROP TABLE user_roles IF EXISTS;
DROP TABLE meals_dishes IF EXISTS;
DROP TABLE votes IF EXISTS;
DROP TABLE dishes IF EXISTS;
DROP TABLE meals IF EXISTS;
DROP TABLE restaurants IF EXISTS;
DROP TABLE users IF EXISTS;
DROP SEQUENCE global_seq IF EXISTS;
CREATE SEQUENCE GLOBAL_SEQ AS INTEGER START WITH 1000;
CREATE TABLE users
(
id INTEGER GENERATED BY DEFAULT AS SEQUENCE GLOBAL_SEQ PRIMARY KEY,
name VARCHAR(255) NOT NULL,
password VARCHAR(255) NOT NULL
/*last_vote_meal_id INTEGER NOT NULL
last_vote_date TIMESTAMP DEFAULT now()*/
);
CREATE UNIQUE INDEX users_unique_idx ON users (name);
CREATE TABLE restaurants
(
id INTEGER GENERATED BY DEFAULT AS SEQUENCE GLOBAL_SEQ PRIMARY KEY,
name VARCHAR(255) NOT NULL,
creator_user_id INTEGER NOT NULL,
CONSTRAINT restaurants_unique_idx UNIQUE (name),
FOREIGN KEY (creator_user_id) REFERENCES users (id) ON DELETE CASCADE
);
/*
CREATE UNIQUE INDEX restaurants_unique_idx ON restaurants (name);
*/
CREATE TABLE meals
(
id INTEGER GENERATED BY DEFAULT AS SEQUENCE GLOBAL_SEQ PRIMARY KEY,
/*votes_number INTEGER NOT NULL,*/
date TIMESTAMP NOT NULL,
restaurant_id INTEGER NOT NULL,
CONSTRAINT meals_unique_idx UNIQUE (restaurant_id, date),
foreign key (restaurant_id) references restaurants (id) ON DELETE CASCADE
);
CREATE TABLE dishes
(
id INTEGER GENERATED BY DEFAULT AS SEQUENCE GLOBAL_SEQ PRIMARY KEY,
name VARCHAR(255) NOT NULL,
price INT NOT NULL,
CONSTRAINT dishes_unique_idx UNIQUE (name, price)
);
create table meals_dishes
(
meal_id INTEGER NOT NULL,
dish_id INTEGER NOT NULL,
CONSTRAINT meals_dishes_unique_idx UNIQUE (meal_id, dish_id),
FOREIGN KEY (meal_id) REFERENCES meals (id) ON DELETE CASCADE,
FOREIGN KEY (dish_id) REFERENCES dishes (id) ON DELETE CASCADE
);
create table user_roles
(
user_id INTEGER NOT NULL,
role VARCHAR(255) NOT NULL,
CONSTRAINT user_roles_unique_idx UNIQUE (user_id, role),
FOREIGN KEY (user_id) REFERENCES users (id) ON DELETE CASCADE
);
CREATE TABLE votes
(
id INTEGER GENERATED BY DEFAULT AS SEQUENCE GLOBAL_SEQ PRIMARY KEY,
user_id INTEGER NOT NULL,
meal_id INTEGER NOT NULL,
CONSTRAINT user_meal_unique_idx UNIQUE (user_id, meal_id),
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE,
FOREIGN KEY (meal_id) REFERENCES meals(id) ON DELETE CASCADE
);
| true |
880d6610a78505a1d80cdfe604f049d22ba01ca7 | SQL | Ikinglong/Teacher_Salary | /web/Sql_Script/Constant_parameter.sql | UTF-8 | 300 | 2.65625 | 3 | [] | no_license | drop table if exists constant_parameter;
create table constant_parameter(
id int primary key not null COMMENT '参数id',
item_name varchar(16) not null COMMENT '参数名称',
value double not null comment '参数值'
) comment ='常量参数表,包括五险比例、公积金比例'; | true |
eeddd976744acf95c62bdd1bee5690c2e915c727 | SQL | Bootz/IceCreamdb | /arctic_world/auctionhouse.sql | UTF-8 | 2,951 | 2.703125 | 3 | [] | no_license | /*
Navicat MySQL Data Transfer
Source Server : arcticdev
Source Server Version : 50509
Source Host : localhost:3306
Source Database : arctic_world
Target Server Type : MYSQL
Target Server Version : 50509
File Encoding : 65001
Date: 2012-04-04 17:26:12
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for `auctionhouse`
-- ----------------------------
DROP TABLE IF EXISTS `auctionhouse`;
CREATE TABLE `auctionhouse` (
`id` int(32) NOT NULL AUTO_INCREMENT,
`creature_entry` bigint(64) unsigned NOT NULL DEFAULT '0',
`group` int(32) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
UNIQUE KEY `a` (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=39 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- ----------------------------
-- Records of auctionhouse
-- ----------------------------
INSERT INTO `auctionhouse` VALUES ('1', '8661', '7');
INSERT INTO `auctionhouse` VALUES ('2', '8669', '1');
INSERT INTO `auctionhouse` VALUES ('3', '8670', '1');
INSERT INTO `auctionhouse` VALUES ('4', '8671', '1');
INSERT INTO `auctionhouse` VALUES ('5', '8672', '2');
INSERT INTO `auctionhouse` VALUES ('6', '8673', '2');
INSERT INTO `auctionhouse` VALUES ('7', '8674', '2');
INSERT INTO `auctionhouse` VALUES ('8', '8719', '1');
INSERT INTO `auctionhouse` VALUES ('9', '8720', '1');
INSERT INTO `auctionhouse` VALUES ('10', '8721', '2');
INSERT INTO `auctionhouse` VALUES ('11', '8722', '2');
INSERT INTO `auctionhouse` VALUES ('12', '8723', '1');
INSERT INTO `auctionhouse` VALUES ('13', '8724', '2');
INSERT INTO `auctionhouse` VALUES ('14', '9856', '2');
INSERT INTO `auctionhouse` VALUES ('15', '9857', '7');
INSERT INTO `auctionhouse` VALUES ('16', '9858', '7');
INSERT INTO `auctionhouse` VALUES ('17', '9859', '1');
INSERT INTO `auctionhouse` VALUES ('18', '15659', '1');
INSERT INTO `auctionhouse` VALUES ('19', '15675', '2');
INSERT INTO `auctionhouse` VALUES ('20', '15676', '2');
INSERT INTO `auctionhouse` VALUES ('21', '15677', '7');
INSERT INTO `auctionhouse` VALUES ('22', '15678', '1');
INSERT INTO `auctionhouse` VALUES ('23', '15679', '1');
INSERT INTO `auctionhouse` VALUES ('24', '15681', '7');
INSERT INTO `auctionhouse` VALUES ('25', '15682', '2');
INSERT INTO `auctionhouse` VALUES ('26', '15683', '2');
INSERT INTO `auctionhouse` VALUES ('27', '15684', '2');
INSERT INTO `auctionhouse` VALUES ('28', '15686', '2');
INSERT INTO `auctionhouse` VALUES ('29', '16627', '2');
INSERT INTO `auctionhouse` VALUES ('30', '16628', '2');
INSERT INTO `auctionhouse` VALUES ('31', '16629', '2');
INSERT INTO `auctionhouse` VALUES ('32', '16707', '1');
INSERT INTO `auctionhouse` VALUES ('33', '17627', '2');
INSERT INTO `auctionhouse` VALUES ('34', '17628', '2');
INSERT INTO `auctionhouse` VALUES ('35', '17629', '2');
INSERT INTO `auctionhouse` VALUES ('36', '18348', '1');
INSERT INTO `auctionhouse` VALUES ('37', '18349', '1');
INSERT INTO `auctionhouse` VALUES ('38', '18761', '2');
| true |
3aee4e5aa38153ff0dd0b2df6c66b7f8d9ca94a0 | SQL | Ekirapapaul/possible-config | /openmrs/reports/Nutrition_Program/Integrated_Management_of_Acute_Malnutrition_IMAM_Program.sql | UTF-8 | 5,319 | 4.125 | 4 | [] | no_license |
SELECT
final.`Age Group` AS 'Age Group',
final.`Sex` AS 'Sex',
sum(final.`Children at End of Last Month`) AS 'Children at End of Last Month',
sum(final.`New Admission`) AS 'New Admission',
sum(final.`Re-admission`) AS 'Re-admission',
sum(final.`Transfer In`) AS 'Transfer In',
sum(final.`Discharge - Recovered`) AS 'Discharge - Recovered',
sum(final.`Discharge - Death`) AS 'Discharge - Death',
sum(final.`Discharge - Defaulter`) AS 'Discharge - Defaulter',
sum(final.`Discharge - Not Improved`) AS 'Discharge - Not Improved',
sum(final.`Discharge - Refer to Hospital`) AS 'Discharge - Refer to Hospital',
sum(final.`Transfer Out`) AS 'Transfer Out',
sum(final.`Children at End of This Month`) AS 'Children at End of This Month'
FROM
(SELECT
withoutDefaulters.*,
defaultersCount.Count As 'Discharge - Defaulter'
FROM
(SELECT
if(age < 6, '< 6 month', '6-59 month') AS 'Age Group',
gender AS 'Sex',
COUNT(DISTINCT lastMonthPatient) AS 'Children at End of Last Month',
SUM(IF(adtType = 'NEW', 1, 0)) AS 'New Admission',
SUM(IF(adtType = 'Defaulter – DF', 1, 0)) AS 'Re-admission',
SUM(IF(adtType = 'Transfer In', 1, 0)) AS 'Transfer In',
SUM(IF(adtType = 'Recovered', 1, 0)) AS 'Discharge - Recovered',
SUM(IF(adtType = 'Death', 1, 0)) AS 'Discharge - Death',
SUM(IF(adtType = 'Not Improved', 1, 0)) AS 'Discharge - Not Improved',
SUM(IF(adtType = 'IMAM, Refer to Hospital', 1, 0)) AS 'Discharge - Refer to Hospital',
SUM(IF(adtType = 'Transfer Out - TO', 1, 0)) AS 'Transfer Out',
COUNT(DISTINCT thisMonthPatient) AS 'Children at End of This Month'
FROM (
SELECT
TIMESTAMPDIFF(MONTH, p.birthdate, v.date_started) AS age,
oAdtType.answer_full_name AS adtType,
p.gender AS gender,
if(oAdtType.obs_datetime >= DATE('#startDate#'), p.person_id, NULL) thisMonthPatient,
if(oAdtType.obs_datetime < DATE('#startDate#'), p.person_id, NULL) lastMonthPatient
FROM person p
JOIN visit v ON p.person_id = v.patient_id
JOIN encounter e ON v.visit_id = e.visit_id
JOIN nonVoidedQuestionAnswerObs oAdtType ON e.encounter_id = oAdtType.encounter_id
WHERE !p.voided AND !v.voided AND !e.voided
AND
DATE(oAdtType.obs_datetime) BETWEEN DATE_SUB(DATE('#startDate#'), INTERVAL 1 MONTH) AND DATE('#endDate#')
AND TIMESTAMPDIFF(MONTH, p.birthdate, v.date_started) < 60
AND (oAdtType.question_full_name = 'Admission Type' OR
oAdtType.question_full_name = 'Status At Discharge')) IMAM
GROUP BY `Age Group`,`Sex`) as withoutDefaulters
LEFT JOIN (SELECT
count(DISTINCT t3.patient_id) AS `Count`,
IF(TIMESTAMPDIFF(MONTH, p.birthdate, v.date_started) < 6, '< 6 month', '6-59 month') AS 'Age Group',
p.gender AS `Sex`
FROM nonVoidedQuestionAnswerObs prevObs
LEFT JOIN nonVoidedQuestionAnswerObs currentObs
ON currentObs.person_id = prevObs.person_id
AND currentObs.obs_datetime <= DATE_ADD(prevObs.obs_datetime, INTERVAL 28 DAY)
AND currentObs.obs_datetime > prevObs.obs_datetime
AND DATE(currentObs.obs_datetime) <= '#endDate#'
AND currentObs.question_full_name = 'Admission Type'
INNER JOIN patient_identifier t3 ON
prevObs.person_id = t3.patient_id AND t3.identifier_type = 3 AND !t3.voided
INNER JOIN encounter e ON e.encounter_id = prevObs.encounter_id AND !e.voided
INNER JOIN visit v ON v.visit_id = e.visit_id AND !v.voided
INNER JOIN person p ON p.person_id = prevObs.person_id AND !p.voided
WHERE
currentObs.obs_id IS NULL
AND prevObs.obs_datetime >= DATE_SUB('#startDate#', INTERVAL 28 DAY)
AND DATE(prevObs.obs_datetime) <= DATE_SUB('#endDate#', INTERVAL 28 DAY)
AND prevObs.question_full_name = 'Admission Type'
AND TIMESTAMPDIFF(MONTH, p.birthdate, v.date_started) < 60
GROUP BY `Age Group`, `Sex`) as defaultersCount ON defaultersCount.Sex = withoutDefaulters.Sex
AND withoutDefaulters.`Age Group` = defaultersCount.`Age Group`
UNION ALL SELECT '< 6 month','F',0,0,0,0,0,0,0,0,0,0,0
UNION ALL SELECT '< 6 month','M',0,0,0,0,0,0,0,0,0,0,0
UNION ALL SELECT '< 6 month','O',0,0,0,0,0,0,0,0,0,0,0
UNION ALL SELECT '6-59 month','F',0,0,0,0,0,0,0,0,0,0,0
UNION ALL SELECT '6-59 month','M',0,0,0,0,0,0,0,0,0,0,0
UNION ALL SELECT '6-59 month','O',0,0,0,0,0,0,0,0,0,0,0) final
GROUP BY final.`Age Group`,final.`Sex`
ORDER BY final.`Age Group` DESC; | true |
7989c25cd4d728cce075a4c5ec7946203cd3b65e | SQL | mozilla/marketing-analytics | /telemetry/snippetReporting/tempExploreAssaRouterEventsDailyTable.sql | UTF-8 | 534 | 3.09375 | 3 | [] | no_license | -- Used to pull data by client_id to load into pyspark for comparison to mainsummary aDAU / DAU Pulls
SELECT
date,
impression_id as client_id,
release_channel,
SUM(CASE WHEN event = 'IMPRESSION' THEN 1 ELSE 0 END) as impressions,
SUM(CASE WHEN event = 'CLICK_BUTTON' THEN 1 ELSE 0 END) as clicks,
SUM(CASE WHEN event = 'BLOCK' THEN 1 ELSE 0 END) as blocks
FROM assa_router_events_daily
WHERE
source = 'snippets_user_event'
AND date = '2018-10-15'
GROUP BY 1,2,3
HAVING impressions > 9
ORDER BY 4 DESC
| true |
8f080ffef5afc7e2d29e5fa015b415e709a48c60 | SQL | neskoc/databas | /skolan/ddl_more_tables.sql | UTF-8 | 1,393 | 3.796875 | 4 | [] | no_license | --
-- file: dml_join.sql
-- Joina tabell.
-- By necu20 for course databas.
-- 2021-01-30
--
USE skolan;
SET NAMES 'utf8';
--
-- Update table larare and larare_pre to use same charset
-- and collation.
--
ALTER TABLE larare CONVERT TO CHARSET utf8 COLLATE utf8_swedish_ci;
ALTER TABLE larare_pre CONVERT TO CHARSET utf8 COLLATE utf8_swedish_ci;
DROP TABLE IF EXISTS kurstillfalle;
DROP TABLE IF EXISTS kurs;
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
CREATE TABLE kurs
(
kod CHAR(6) PRIMARY KEY NOT NULL,
namn VARCHAR(40),
poang FLOAT,
niva CHAR(3)
)
ENGINE INNODB
CHARSET utf8
COLLATE utf8_swedish_ci
;
--
-- Create table: kurstillfalle
--
CREATE TABLE kurstillfalle
(
id INT AUTO_INCREMENT NOT NULL,
kurskod CHAR(6) NOT NULL,
kursansvarig CHAR(3) NOT NULL,
lasperiod INT NOT NULL,
PRIMARY KEY (id),
FOREIGN KEY (kurskod) REFERENCES kurs(kod),
FOREIGN KEY (kursansvarig) REFERENCES larare(akronym)
)
ENGINE=INNODB
CHARSET utf8
COLLATE utf8_swedish_ci
;
--
-- Ange vilket sätt som tabeller skall lagras på + teckenkodning
--
CREATE TABLE t1 (i INT) ENGINE MYISAM CHARSET utf8 COLLATE utf8_swedish_ci;
CREATE TABLE t2 (
i INT
)
ENGINE INNODB
CHARSET utf8
COLLATE utf8_swedish_ci
;
-- Visa SQL-koden för CREATE TABLE
SHOW CREATE TABLE kurs; -- lägg till \g i mysql cli för att visa rad för rad
SHOW CREATE TABLE kurstillfalle; | true |
75f584f5b4f7fd65e70883af899e36b20cda35d9 | SQL | ZveroBoy340/Japan_Form | /japan.sql | UTF-8 | 2,281 | 3.15625 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 5.0.2
-- https://www.phpmyadmin.net/
--
-- Хост: 127.0.0.1:3306
-- Время создания: Фев 02 2021 г., 17:30
-- Версия сервера: 5.7.29
-- Версия PHP: 7.3.17
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 */;
--
-- База данных: `japan`
--
-- --------------------------------------------------------
--
-- Структура таблицы `billing`
--
CREATE TABLE `billing` (
`id` int(11) NOT NULL,
`name` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
`country` varchar(30) COLLATE utf8mb4_unicode_ci NOT NULL,
`city` varchar(30) COLLATE utf8mb4_unicode_ci NOT NULL,
`address` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`apartment` varchar(30) COLLATE utf8mb4_unicode_ci NOT NULL,
`delivery_date` date NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Дамп данных таблицы `billing`
--
INSERT INTO `billing` (`id`, `name`, `country`, `city`, `address`, `apartment`, `delivery_date`) VALUES
(185, 'fghfgh', 'Japan', 'fghfgh', 'fghfgh', 'Not filled', '2021-02-02'),
(186, 'fghfgh', 'Japan', 'fghgf', 'hfghfgh', 'Not filled', '2021-02-02'),
(187, 'rtygfhfg dfgfdg', 'Japan', 'fghfgh', 'fghfgh', 'Not filled', '2021-02-02'),
(188, 'fghfgh dfgfg', 'Japan', 'fghfgh', 'fghfgh', 'Not filled', '2021-02-02'),
(189, 'hgfh hfghfgh', 'Japan', 'hfgh', 'gfhgh', 'Not filled', '2021-02-02');
--
-- Индексы сохранённых таблиц
--
--
-- Индексы таблицы `billing`
--
ALTER TABLE `billing`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT для сохранённых таблиц
--
--
-- AUTO_INCREMENT для таблицы `billing`
--
ALTER TABLE `billing`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=190;
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 */;
| true |
428ecbca58e6b2b0b33cc3e4280dae817d2577e0 | SQL | agliznetsov/insert-demo | /src/main/resources/alter-table.sql | UTF-8 | 3,553 | 4.09375 | 4 | [] | no_license | select name, setting from pg_settings where name like '%wal_size%' or name like '%checkpoint%' order by name;
-- 150M
SELECT reltuples, relname FROM pg_catalog.pg_class WHERE relname = 'attributes_copy';
-- 1m 31s
ALTER TABLE attributes_copy ADD CONSTRAINT fk_attributes_1 FOREIGN KEY (type) REFERENCES attribute_types (id);
-- 1m 31s
ALTER TABLE attributes_copy ADD CONSTRAINT fk_attributes_2 FOREIGN KEY (owner) REFERENCES representations (id);
ALTER TABLE attributes_copy
ADD CONSTRAINT fk_attributes_1 FOREIGN KEY (type) REFERENCES attribute_types (id),
ADD CONSTRAINT fk_attributes_2 FOREIGN KEY (owner) REFERENCES representations (id);
ALTER TABLE attributes_copy DISABLE TRIGGER ALL;
ALTER TABLE attributes_copy ENABLE TRIGGER ALL;
alter table attributes_copy drop constraint attributes_copy_pkey1;
-- attributes 5 indexes total time: 1104s 1.47 sec per 1M index
SELECT tablename, indexname FROM pg_indexes where indexname like '%attributes%';
-- 5m 14s
alter table attributes_copy add constraint attributes_copy_pkey1 primary key (id);
-- 5m 17s
create index idx_attributes_1 on attributes_copy (id) where (((attr_type)::text = 'SA'::text) AND (expression_long IS NOT NULL));
-- 3m 34s
create index idx_attributes_2 on attributes_copy (owner, type);
-- 2m 7s
create index idx_attributes_3 on attributes_copy (type);
-- 2m 12s
create index idx_attributes_4 on attributes_copy (owner);
-- 25M
SELECT reltuples, relname FROM pg_catalog.pg_class WHERE relname = 'attributes_flat';
-- 1m 2s
create index idx_attributes_flat_1 on attributes_flat (owner);
-- relations 7 indexes total time : 7 * 75M * 1.47 = 770s
--create index idx_relations_source_target on relations (source, target);
--create index idx_relations_type_source on relations (type, source);
--create index relation_source on relations (source);
--create index idx_relations_type_target on relations (type, target);
--create index relation_target on relations (target);
--create index relation_type on relations (type);
-- representations 17 indexes 17 * 25M * 1.47 = 624s
--create unique index idx_representations_signifier_vocabulary on representations (signifier, vocabulary);
--create index repr_creationdate on representations (creationdate);
--create index repr_rep_type on representations (rep_type);
--create index idx_repr_signifier_lower on representations (lower(signifier::text));
--create index idx_repr_display_name_lower on representations (lower(display_name::text));
--create index idx_repr_display_name_id on representations (display_name, id);
--create index term_signifier on representations (signifier, id);
--create index repr_creator on representations (creator);
--create index repr_status on representations (status);
--create index repr_type on representations (asset_type);
--create index repr_vocabulary on representations (vocabulary);
--create index idx_representations_rl_asset_type_id on representations (asset_type, id) where ((rep_type)::text = 'RL'::text);
--create index idx_representations_wd_asset_type_id on representations (asset_type, id) where ((rep_type)::text = 'WD'::text);
--create index idx_representations_cr_asset_type_id on representations (asset_type, id) where ((rep_type)::text = 'CR'::text);
--create index idx_representations_vocabulary_display_name_id on representations (vocabulary, display_name, id);
--create index idx_representations_asset_type_display_name_id on representations (asset_type, display_name, id);
| true |
4bfb59c1fc226034625de12868faf52a72f5b9f4 | SQL | dhirutech/HexadLMServices | /postgresql_hdb_schemas.sql | UTF-8 | 2,573 | 3.984375 | 4 | [] | no_license | CREATE SCHEMA hexad;
CREATE TABLE hexad.user (
user_id int4 NOT NULL GENERATED BY DEFAULT AS IDENTITY,
user_name text NOT NULL,
password text NOT NULL,
first_name text NOT NULL,
las_name text NOT NULL,
email text NOT NULL,
phone text NULL,
address text NOT NULL,
dob timestamp NULL,
isactive bool NOT NULL DEFAULT true,
created_date timestamp NULL,
created_by int4 NULL,
updated_date timestamp NULL,
updated_by int4 NULL,
CONSTRAINT user_pkey PRIMARY KEY (user_id)
);
CREATE TABLE hexad.role (
role_id int4 NOT NULL GENERATED BY DEFAULT AS IDENTITY,
role_name text NOT NULL,
is_active bool NOT NULL DEFAULT true,
created_date timestamp NULL,
created_by int4 NULL,
updated_date timestamp NULL,
updated_by int4 NULL,
CONSTRAINT role_pkey PRIMARY KEY (role_id)
);
CREATE TABLE hexad.user_role (
user_role_id int4 NOT NULL GENERATED BY DEFAULT AS IDENTITY,
user_id int4 NOT NULL,
role_id int4 NOT NULL,
created_date timestamp NULL,
created_by int4 NULL,
updated_date timestamp NULL,
updated_by int4 NULL,
CONSTRAINT user_role_pkey PRIMARY KEY (user_role_id),
CONSTRAINT user_role_user_fkey FOREIGN KEY (user_id) REFERENCES hexad.user(user_id),
CONSTRAINT user_role_role_fkey FOREIGN KEY (role_id) REFERENCES hexad.role(role_id)
);
CREATE TABLE hexad.book (
book_id int4 NOT NULL GENERATED BY DEFAULT AS IDENTITY,
title text NOT NULL,
author text NULL,
isbn text NULL,
publication text NULL,
yearofpub timestamp NULL,
is_active bool NOT NULL DEFAULT true,
created_date timestamp NULL,
created_by int4 NULL,
updated_date timestamp NULL,
updated_by int4 NULL,
CONSTRAINT book_pkey PRIMARY KEY (book_id)
);
CREATE TABLE hexad.book_store (
book_store_id int4 NOT NULL GENERATED BY DEFAULT AS IDENTITY,
book_id int4 NOT NULL,
stock_count int4 NOT NULL,
created_date timestamp NULL,
created_by int4 NULL,
updated_date timestamp NULL,
updated_by int4 NULL,
CONSTRAINT pk_book_store PRIMARY KEY (book_store_id),
CONSTRAINT uniquectm_const_book UNIQUE (book_id),
CONSTRAINT book_store_book_fkey FOREIGN KEY (book_id) REFERENCES hexad.book(book_id)
);
CREATE TABLE hexad.user_book (
user_book_id int4 NOT NULL GENERATED BY DEFAULT AS IDENTITY,
user_id int4 NOT NULL,
book_id int4 NOT NULL,
created_date timestamp NULL,
created_by int4 NULL,
updated_date timestamp NULL,
updated_by int4 NULL,
CONSTRAINT pk_user_book PRIMARY KEY (user_book_id),
CONSTRAINT user_book_user_fkey FOREIGN KEY (user_id) REFERENCES hexad.user(user_id),
CONSTRAINT user_book_book_fkey FOREIGN KEY (book_id) REFERENCES hexad.book(book_id)
); | true |
0209de3a518fdd163f30e56183babd5d7c7fda37 | SQL | mutedalien/conspect | /PHP_2/less_8/ДЗ new/untitled8/test.sql | UTF-8 | 3,876 | 3.28125 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 4.8.3
-- https://www.phpmyadmin.net/
--
-- Хост: 127.0.0.1:3306
-- Время создания: Фев 28 2019 г., 21:06
-- Версия сервера: 5.6.41
-- Версия PHP: 5.5.38
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 */;
--
-- База данных: `test`
--
-- --------------------------------------------------------
--
-- Структура таблицы `basket`
--
CREATE TABLE `basket` (
`order_id` int(11) NOT NULL,
`user_id` varchar(11) NOT NULL,
`product_id` varchar(11) NOT NULL,
`count` varchar(55) NOT NULL,
`status` int(1) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Структура таблицы `products`
--
CREATE TABLE `products` (
`id` int(11) NOT NULL,
`image` varchar(55) NOT NULL,
`title` varchar(55) NOT NULL,
`content` varchar(255) NOT NULL,
`price` varchar(55) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Дамп данных таблицы `products`
--
INSERT INTO `products` (`id`, `image`, `title`, `content`, `price`) VALUES
(1, 'img/1.jpg', 'product 1', 'first product', '10'),
(2, 'img/2.jpg', 'product 2', 'second product', '20'),
(3, 'img/3.jpg', 'product 3', 'third product', '30'),
(4, 'img/4.jpg', 'product 4', '4 product', '22'),
(5, 'img/5.jpg', 'product 5', '5 product', '55'),
(6, 'img/6.jpg', 'product 6', '6 product', '66'),
(7, 'img/7.jpg', 'product 7', '7 product', '77'),
(8, 'img/8.jpg', 'product 8', '8 product', '88'),
(9, 'img/9.jpg', 'product 9', '9 product', '99'),
(10, 'img/10.jpg', 'product 10', '10 product', '1010'),
(11, 'img/11.jpg', 'product 11', '11 product', '1111'),
(12, 'img/12.jpg', 'product 12', '12 product', '1212'),
(13, 'img/13.jpg', 'product 13', '13 product', '1313'),
(14, 'img/14.jpg', 'product 14', '14 product', '1414'),
(15, 'img/15.jpg', 'product 15', '15 product', '1515');
-- --------------------------------------------------------
--
-- Структура таблицы `users`
--
CREATE TABLE `users` (
`id` int(11) NOT NULL,
`name` varchar(55) NOT NULL,
`login` varchar(55) NOT NULL,
`password` varchar(255) NOT NULL,
`role` int(1) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Дамп данных таблицы `users`
--
INSERT INTO `users` (`id`, `name`, `login`, `password`, `role`) VALUES
(6, 'aidar', 'admin', 'f0d587897834a73c4ca8290d3b13742781dc9bdb52d04dc20036dbd8313ed055', 1),
(7, 'asdasd', 'dvvd', 'c011728eed899c6e4694f44f761f5f8a81dc9bdb52d04dc20036dbd8313ed055', 0),
(8, 'Alex', 'Alex', 'bec7b6bd40fc9229a12c69107b27380a202cb962ac59075b964b07152d234b70', 0);
--
-- Индексы сохранённых таблиц
--
--
-- Индексы таблицы `basket`
--
ALTER TABLE `basket`
ADD PRIMARY KEY (`order_id`);
--
-- Индексы таблицы `products`
--
ALTER TABLE `products`
ADD PRIMARY KEY (`id`);
--
-- Индексы таблицы `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT для сохранённых таблиц
--
--
-- AUTO_INCREMENT для таблицы `basket`
--
ALTER TABLE `basket`
MODIFY `order_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=29;
--
-- AUTO_INCREMENT для таблицы `products`
--
ALTER TABLE `products`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=16;
--
-- AUTO_INCREMENT для таблицы `users`
--
ALTER TABLE `users`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true |
7e5e4461308179617dfe805f5493b651235c0c67 | SQL | AlexandraSova/Homework | /DataBase/CreateDataBase/create_tables.sql | UTF-8 | 2,582 | 3.6875 | 4 | [] | no_license |
--CREATE DATABASE shop1;
CREATE TABLE address
(
id serial NOT NULL,
country character varying(100) NOT NULL,
region character varying(100) NOT NULL,
city character varying(100) NOT NULL,
street character varying(100) NOT NULL,
house character varying(10)NOT NULL,
flat character varying(10)NOT NULL,
CONSTRAINT pk_address_id PRIMARY KEY (id)
);
CREATE TABLE manager
(
id serial NOT NULL,
fio name,
birthday date,
phone character varying(25),
CONSTRAINT pk_manager_id PRIMARY KEY (id)
);
CREATE TABLE client
(
id serial NOT NULL,
fio name NOT NULL,
birthday date,
phone character varying(25) NOT NULL,
manager_id bigint,
address_id bigint NOT NULL,
CONSTRAINT pk_client_id PRIMARY KEY (id),
CONSTRAINT fk_address_id FOREIGN KEY (address_id) REFERENCES address (id) MATCH SIMPLE
ON UPDATE CASCADE
ON DELETE RESTRICT,
CONSTRAINT fk_manager_id FOREIGN KEY (manager_id)REFERENCES manager (id) MATCH SIMPLE
ON UPDATE CASCADE
ON DELETE NO ACTION
);
CREATE TABLE order
(
id serial NOT NULL,
start date NOT NULL,
finish date NOT NULL,
manager_id bigint NOT NULL,
client_id bigint NOT NULL,
CONSTRAINT pk_order_id PRIMARY KEY (id),
CONSTRAINT fk_client_id FOREIGN KEY (client_id) REFERENCES client (id) MATCH SIMPLE
ON UPDATE CASCADE
ON DELETE CASCADE,
CONSTRAINT fk_manager_id FOREIGN KEY (manager_id) REFERENCES manager (id) MATCH SIMPLE
ON UPDATE CASCADE
ON DELETE NO ACTION
);
CREATE TABLE type
(
id serial NOT NULL,
name character varying(100) NOT NULL,
CONSTRAINT pk_type_id PRIMARY KEY (id)
);
CREATE TABLE product
(
id serial NOT NULL,
name character varying(1000) NOT NULL,
price numeric NOT NULL CHECK (price>0),
colour character varying(100),
type_id bigint,
amount integer,
material character varying(100),
print character varying,
description text,
characteristics json,
CONSTRAINT pk_product_id PRIMARY KEY (id),
CONSTRAINT fk_type_id FOREIGN KEY (type_id) REFERENCES type (id) MATCH SIMPLE
ON UPDATE CASCADE
ON DELETE RESTRICT
);
CREATE TABLE item
(
id serial NOT NULL,
order_id bigint NOT NULL,
product_id bigint NOT NULL,
amount integer NOT NULL,
CONSTRAINT pk_item_id PRIMARY KEY (id),
CONSTRAINT fk_order_id FOREIGN KEY (order_id) REFERENCES order (id) MATCH SIMPLE
ON UPDATE CASCADE
ON DELETE CASCADE,
CONSTRAINT fk_product_id FOREIGN KEY (product_id) REFERENCES product (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE SET NULL
); | true |
b729b5645e3fbd3a52900d62aa0375cf6393a3e4 | SQL | ricokritzer/TriasAnalyser | /Studienarbeit/Data/SQL/select/SELECT_CancelledHours.sql | UTF-8 | 514 | 3.703125 | 4 | [] | no_license | DROP TABLE CancelledHours;
CREATE TABLE CancelledHours(
id int PRIMARY KEY,
cancelled decimal(8),
total decimal(8),
percentage decimal(8,5));
INSERT INTO CancelledHours(id, total) SELECT HOUR(Stop.timetabledTime) h, count(*) FROM Stop GROUP BY h;
UPDATE CancelledHours SET cancelled = (SELECT COUNT(*) FROM Stop WHERE CancelledHours.id = HOUR(Stop.timetabledTime) AND realtime IS NULL);
UPDATE CancelledHours SET percentage = cancelled/total * 100;
SELECT * FROM CancelledHours; | true |
55a0e08f724740f7f7b0fb26c20dfcf32b194549 | SQL | binoymvee/thunderbuild | /db/thunder_cloud_specification.sql | UTF-8 | 2,104 | 2.953125 | 3 | [] | no_license | --
-- Dumping data for table `thunder_cloud_specification`
--
INSERT INTO `thunder_cloud_specification` (`id`, `role_id`, `spec_category`, `spec_name`, `spec_column`, `default_value`) VALUES
(NULL, 1, 'keystone', 'Openstack Endpoint Host', 'openstack::endpoints::host', 'controller'),
(NULL, 1, 'messaging_server', 'Messaging Server Endpoint Host', 'openstack::endpoints::mq::host', 'controller'),
(NULL, 1, 'database', 'Database Server Endpoint Host', 'openstack::endpoints::db::host', 'loadbalancer'),
(NULL, 1, 'compute', 'Network Service Type', 'openstack::compute::network::service_type', 'neutron'),
(NULL, 1, 'cinder', 'The Default Store of Image', 'openstack::image::api::default_store', 'file'),
(NULL, 1, 'Neutron', 'Nova Metadata API Service IP', 'openstack::network::metadata::nova_metadata_ip', 'controller'),
(NULL, 1, 'Neutron', 'Type of Network to Allocate for Tenant Networks', 'openstack::network::openvswitch::tenant_network_type', 'gre'),
(NULL, 1, 'Neutron', 'Interface to use for external bridge', 'openstack::network::l3::external_network_bridge_interface', 'eth1'),
(NULL, 1, 'common', 'Set to True in the Server and the Agents to Enable Support for GRE', 'openstack::network::openvswitch::enable_tunneling', 'True'),
(NULL, 1, 'Neutron', 'The Type of Tunnel Network', 'openstack::network::openvswitch::tunnel_type', 'gre'),
(NULL, 3, 'cinder', 'Volume Driver', 'openstack::block-storage::volume::driver', 'cinder.volume.drivers.lvm.LVMISCSIDriver'),
(NULL, 1, 'dashborad', 'The hostname of dashbaord to add in apache conf. If not give we can access it through default IP of controller', 'openstack::dashboard::server_hostname', 'nil'),
(NULL, 3, 'cinder', 'Block Device Disk Name', 'openstack::block-storage::volume::block_devices', '/dev/sdb1'),
(NULL, 4, 'swift', 'Git Repository Creation Server IP', 'openstack::object-storage::git_builder_ip', 'controller'),
(NULL, '1', 'database', 'Mysql Root Password', 'mysql::server_root_password', 'root'),
(NULL, '1', 'messaging_server', 'Messaging Server Type', 'openstack::mq::service_type', 'rabbitmq');
| true |
23afbb21eb5bf3397d98f646867d05b09fecc08e | SQL | devtb12/sql-2-afternoon | /Answers/1-Solution.sql | UTF-8 | 2,916 | 2.671875 | 3 | [] | no_license | -- `$/
-- __ O$
-- _.-" ) $'
-- .-"`. .-": o ___ ($o
-- .-".- .' ,st+. .' , \ ($
-- :_..-+"" : T "^T==^\-._ $\
-- """"-, ' / `-:-// / )$/
-- : / / :/ / /dP
-- : : / : )^-:_.l
-- / `.___, \ .-,
-- : : : / .q$$$$$$b \$$$p, /
-- : : :$$$$$$$$$b T$$$$b .' /
-- : _.:$$$$$$$$$$ T$$P^" /l
-- .__L_.: .q$ :$$$$$$$$$$$$$_ TP .-" /
-- :$$$$$$.q$$$$$ $$$$$$$$$$$$$$$$b / / .' /
-- $$$$$$$$$$$$$ $$$$$$$$P^" "^Tb$b/ .' :
-- :$$$$$$$$$$$$ $$$$P^jp, `$$_.+'
-- $$$$$$$$$$$$$ :$$$.d$$`- _.-d$$ / :
-- '^T$$$$$P^^"/ :$$$$$$P d$$/
-- : $$$$$$P"-. .--$$P/ :
-- $$$$P'( , d$$:b .$
-- : :$$P .-dP-' $^'$$bqqpd$$
-- `. "" ' s") .' d$$$$$$$$'
-- \ / :$$$$$$$P'
-- _ "-, '. T$$$$P'
-- / "-.' : .--.___.`^^'
-- / . : .'
-- ),sss. \ : There is
-- : TP""Tb. no plan
-- Tb dP : B.
-- : TbdP
-- \ $P /
-- `-.___.-'
-- Solution --
-- #1
SELECT * FROM invoice i
JOIN invoice_line il ON il.invoice_id = i.invoice_id
WHERE il.unit_price > 0.99
--#2
SELECT i.invoice_date, c.first_name, c.last_name, i.total FROM invoice i
JOIN customer c ON i.customer_id = c.customer_id
--#3
SELECT c.first_name, c.last_name, e.first_name, e.last_name
FROM customer c
JOIN employee e ON c.support_rep_id = e.employee_id
--#4
SELECT al.title, ar.name FROM album al
JOIN artist ar ON al.artist_id= ar.artist_id
--#5
SELECT pt.track_id FROM playlist_track pt
JOIN playlist p ON p.playlist_id = pt.playlist_id
WHERE p.name = 'Music'
--#6
SELECT t.name FROM track t
JOIN playlist_track pt ON pt.track_id = t.track_id
WHERE pt.playlist_id = 5
--#7
SELECT t.name, p.name FROM track t
JOIN playlist_track pt ON t.track_id = pt.track_id
JOIN playlist p ON pt.playlist_id = p.playlist_id
--#8
SELECT t.name, a.title FROM track t
JOIN album a ON t.album_id = a.album_id
JOIN genre g ON g.genre_id = t.genre_id
WHERE g.name = 'Alternative & Punk' | true |
e33a4a2f5d7e8f751da572e09b40efc8549a034d | SQL | ghassanbasrak/ch_clients_portal | /DB/code4.sql | UTF-8 | 13,228 | 3.28125 | 3 | [
"MIT"
] | permissive | -- phpMyAdmin SQL Dump
-- version 5.0.4
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Jun 22, 2021 at 01:32 PM
-- Server version: 10.4.17-MariaDB
-- PHP Version: 7.4.13
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: `code4`
--
-- --------------------------------------------------------
--
-- Table structure for table `clients`
--
CREATE TABLE `clients` (
`id` int(11) NOT NULL,
`full_name` varchar(50) NOT NULL,
`phone_number` varchar(50) DEFAULT NULL,
`address` text DEFAULT NULL,
`email` varchar(100) NOT NULL,
`password` varchar(255) NOT NULL,
`company_name` varchar(255) NOT NULL,
`created_at` datetime NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `clients`
--
INSERT INTO `clients` (`id`, `full_name`, `phone_number`, `address`, `email`, `password`, `company_name`, `created_at`) VALUES
(33, 'Ali khrezaty', '0923232323', 'abdulrahman', 'aboooooodeh@gmail.com', 'password', 'Education Technology', '2021-06-21 18:13:47'),
(34, 'Ahmad Zaher Khrezaty', '0948842976', 'El furkan', 'ahmad.khrezaty@gmail.com', 'password', 'Education Technology', '2021-06-22 03:07:09');
-- --------------------------------------------------------
--
-- Table structure for table `client_database`
--
CREATE TABLE `client_database` (
`id` int(11) NOT NULL,
`client_id` int(11) DEFAULT NULL,
`server_name` varchar(100) DEFAULT NULL,
`database_name` varchar(100) DEFAULT NULL,
`database_username` varchar(100) DEFAULT NULL,
`database_password` varchar(100) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `client_database`
--
INSERT INTO `client_database` (`id`, `client_id`, `server_name`, `database_name`, `database_username`, `database_password`) VALUES
(8, 33, 'code', 'db23', 'rootChange', 'password'),
(9, 34, 'server', 'database', 'user', 'passChange');
-- --------------------------------------------------------
--
-- Table structure for table `invoices`
--
CREATE TABLE `invoices` (
`id` int(11) NOT NULL,
`client_id` int(11) NOT NULL,
`total` bigint(20) NOT NULL,
`sub_total` bigint(20) NOT NULL,
`discount` bigint(20) NOT NULL,
`type` enum('1','2','3') NOT NULL,
`created_at` datetime NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `invoices`
--
INSERT INTO `invoices` (`id`, `client_id`, `total`, `sub_total`, `discount`, `type`, `created_at`) VALUES
(20, 33, 200, 210, 10, '3', '2021-06-21 18:18:02'),
(21, 34, 200, 200, 0, '1', '2021-06-22 06:21:25'),
(22, 34, 1400, 1400, 0, '1', '2021-06-22 06:21:52');
-- --------------------------------------------------------
--
-- Table structure for table `invoice_item`
--
CREATE TABLE `invoice_item` (
`id` int(11) NOT NULL,
`invoice_id` int(11) NOT NULL,
`service_id` int(11) NOT NULL,
`price` bigint(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `invoice_item`
--
INSERT INTO `invoice_item` (`id`, `invoice_id`, `service_id`, `price`) VALUES
(44, 20, 1, 50),
(45, 20, 3, 100),
(46, 20, 5, 60),
(47, 21, 1, 50),
(48, 21, 6, 150),
(49, 22, 7, 200),
(50, 22, 8, 200),
(51, 22, 12, 1000);
-- --------------------------------------------------------
--
-- Table structure for table `oauth_access_tokens`
--
CREATE TABLE `oauth_access_tokens` (
`access_token` varchar(40) NOT NULL,
`client_id` varchar(80) NOT NULL,
`user_id` varchar(80) DEFAULT NULL,
`expires` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`scope` varchar(4000) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `oauth_access_tokens`
--
INSERT INTO `oauth_access_tokens` (`access_token`, `client_id`, `user_id`, `expires`, `scope`) VALUES
('365ef3b72db63182c449c785e5ad397c2d2b2ee9', 'testclient', 'ahmadzaher', '2030-06-19 07:19:02', 'app');
-- --------------------------------------------------------
--
-- Table structure for table `oauth_authorization_codes`
--
CREATE TABLE `oauth_authorization_codes` (
`authorization_code` varchar(40) NOT NULL,
`client_id` varchar(80) NOT NULL,
`user_id` varchar(80) DEFAULT NULL,
`redirect_uri` varchar(2000) DEFAULT NULL,
`expires` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`scope` varchar(4000) DEFAULT NULL,
`id_token` varchar(1000) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `oauth_clients`
--
CREATE TABLE `oauth_clients` (
`client_id` varchar(80) NOT NULL,
`client_secret` varchar(80) DEFAULT NULL,
`redirect_uri` varchar(2000) DEFAULT NULL,
`grant_types` varchar(80) DEFAULT NULL,
`scope` varchar(4000) DEFAULT NULL,
`user_id` varchar(80) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `oauth_clients`
--
INSERT INTO `oauth_clients` (`client_id`, `client_secret`, `redirect_uri`, `grant_types`, `scope`, `user_id`) VALUES
('testclient', 'testsecret', NULL, 'password', 'app', NULL);
-- --------------------------------------------------------
--
-- Table structure for table `oauth_jwt`
--
CREATE TABLE `oauth_jwt` (
`client_id` varchar(80) NOT NULL,
`subject` varchar(80) DEFAULT NULL,
`public_key` varchar(2000) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `oauth_refresh_tokens`
--
CREATE TABLE `oauth_refresh_tokens` (
`refresh_token` varchar(40) NOT NULL,
`client_id` varchar(80) NOT NULL,
`user_id` varchar(80) DEFAULT NULL,
`expires` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`scope` varchar(4000) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `oauth_refresh_tokens`
--
INSERT INTO `oauth_refresh_tokens` (`refresh_token`, `client_id`, `user_id`, `expires`, `scope`) VALUES
('dfff76839e39314208e19e803e335c73ff8aa57b', 'testclient', 'ahmadzaher', '2021-07-01 06:19:02', 'app');
-- --------------------------------------------------------
--
-- Table structure for table `oauth_scopes`
--
CREATE TABLE `oauth_scopes` (
`scope` varchar(80) NOT NULL,
`is_default` tinyint(1) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `oauth_users`
--
CREATE TABLE `oauth_users` (
`username` varchar(80) NOT NULL,
`password` varchar(80) DEFAULT NULL,
`first_name` varchar(80) DEFAULT NULL,
`last_name` varchar(80) DEFAULT NULL,
`email` varchar(80) DEFAULT NULL,
`email_verified` tinyint(1) DEFAULT NULL,
`scope` varchar(4000) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `oauth_users`
--
INSERT INTO `oauth_users` (`username`, `password`, `first_name`, `last_name`, `email`, `email_verified`, `scope`) VALUES
('admin', 'password', 'Admin', NULL, 'admin@admin.com', 1, 'app'),
('ahmadzaher', '5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8', 'Ahmad', 'Zaher', 'ahmad.khrezaty@gmail.com', 1, 'app'),
('username', 'password', 'Ahmad', 'Khrezaty', 'admin@admin.com', 1, 'app');
-- --------------------------------------------------------
--
-- Table structure for table `services`
--
CREATE TABLE `services` (
`id` int(11) NOT NULL,
`name` varchar(255) NOT NULL,
`price` bigint(20) NOT NULL,
`description` text DEFAULT NULL,
`create_at` datetime NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `services`
--
INSERT INTO `services` (`id`, `name`, `price`, `description`, `create_at`) VALUES
(1, 'Auto comment', 50, 'description', '2021-06-17 16:28:16'),
(3, 'Auto reply', 100, 'This is auto reply service', '2021-06-17 16:28:33'),
(4, 'Messanger bot', 100, '', '2021-06-17 16:29:37'),
(5, 'Postback', 60, 'This is postback service', '2021-06-17 16:29:37'),
(6, 'update 6', 150, '', '2021-06-18 02:18:07'),
(7, 'new service updated', 200, 'this is all description', '2021-06-18 02:22:46'),
(8, 'new service', 200, '', '2021-06-18 16:57:05'),
(12, 'from website', 1000, 'Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry\'s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.', '2021-06-21 07:19:47'),
(13, 'new from website', 23, '', '2021-06-21 07:20:17'),
(14, 'asdfsdaf', 1000, 'fasdfasdf', '2021-06-21 17:48:56'),
(15, 'asdfsdaf', 1000, 'fasdfasdf', '2021-06-21 17:49:11');
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
CREATE TABLE `users` (
`id` int(11) NOT NULL,
`full_name` varchar(50) NOT NULL,
`email` varchar(100) NOT NULL,
`password` varchar(255) NOT NULL,
`role` varchar(50) NOT NULL DEFAULT 'staff',
`phone_number` varchar(50) DEFAULT NULL,
`address` text DEFAULT NULL,
`created_at` datetime NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `users`
--
INSERT INTO `users` (`id`, `full_name`, `email`, `password`, `role`, `phone_number`, `address`, `created_at`) VALUES
(4, 'Ahmad Zaher Khrezaty', 'ahmad.khrezaty@gmail.com', 'password', 'manager', '0948842976', 'al_hamidiah', '2021-06-18 04:45:29'),
(9, 'Hisham Hisham', 'hisham.changed@gmail.com', 'password', 'financial', '0948842976', 'al_hamidiah', '2021-06-19 05:12:11'),
(10, 'abdulwahab', 'abdo@gmail.com', 'password', 'financial', '0948842976', 'halap', '2021-06-19 05:12:45'),
(11, 'Sara rihawi', 'sara@gmail.com', 'password', 'editor', '0948842976', 'El furkan', '2021-06-21 07:39:23');
-- --------------------------------------------------------
--
-- Table structure for table `websites`
--
CREATE TABLE `websites` (
`id` int(11) NOT NULL,
`name` varchar(255) NOT NULL,
`username` varchar(255) DEFAULT NULL,
`password` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `websites`
--
INSERT INTO `websites` (`id`, `name`, `username`, `password`) VALUES
(8, 'code52323', 'roota', 'wwww'),
(9, 'code', 'rootchanged', 'pass'),
(11, 'code2', 'zozo', 'pass');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `clients`
--
ALTER TABLE `clients`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `client_database`
--
ALTER TABLE `client_database`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `invoices`
--
ALTER TABLE `invoices`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `invoice_item`
--
ALTER TABLE `invoice_item`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `oauth_access_tokens`
--
ALTER TABLE `oauth_access_tokens`
ADD PRIMARY KEY (`access_token`);
--
-- Indexes for table `oauth_authorization_codes`
--
ALTER TABLE `oauth_authorization_codes`
ADD PRIMARY KEY (`authorization_code`);
--
-- Indexes for table `oauth_clients`
--
ALTER TABLE `oauth_clients`
ADD PRIMARY KEY (`client_id`);
--
-- Indexes for table `oauth_refresh_tokens`
--
ALTER TABLE `oauth_refresh_tokens`
ADD PRIMARY KEY (`refresh_token`);
--
-- Indexes for table `oauth_scopes`
--
ALTER TABLE `oauth_scopes`
ADD PRIMARY KEY (`scope`);
--
-- Indexes for table `oauth_users`
--
ALTER TABLE `oauth_users`
ADD PRIMARY KEY (`username`);
--
-- Indexes for table `services`
--
ALTER TABLE `services`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `websites`
--
ALTER TABLE `websites`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `clients`
--
ALTER TABLE `clients`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=35;
--
-- AUTO_INCREMENT for table `client_database`
--
ALTER TABLE `client_database`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;
--
-- AUTO_INCREMENT for table `invoices`
--
ALTER TABLE `invoices`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=23;
--
-- AUTO_INCREMENT for table `invoice_item`
--
ALTER TABLE `invoice_item`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=52;
--
-- AUTO_INCREMENT for table `services`
--
ALTER TABLE `services`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=16;
--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12;
--
-- AUTO_INCREMENT for table `websites`
--
ALTER TABLE `websites`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12;
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 */;
| true |
926a63817b7388e221bc4bc73f74354536ada358 | SQL | winter111/web | /02_PHP/day06/xuezi/xuezi.sql | UTF-8 | 1,096 | 2.765625 | 3 | [] | no_license | SET NAMES UTF8;
DROP DATABASE IF EXISTS xuezi;
CREATE DATABASE xuezi CHARSET=UTF8;
USE xuezi;
#创建笔记本型号表
#创建笔记本表xz_laptop
#创建笔记本图片表xz_laptop_pic
#创建用户信息表xz_user
CREATE TABLE xz_user(
uid INT PRIMARY KEY AUTO_INCREMENT,
uname VARCHAR(32) UNIQUE NOT NULL,
upwd VARCHAR(32),
email VARCHAR(64),
phone VARCHAR(16),
avatar VARCHAR(64) DEFAULT 'img/avatar/default.jpg',
user_name VARCHAR(32),
gender INT
);
INSERT INTO xz_user VALUES
(NULL,'TOM','123456','1104543@.COM','1356159546','img/avatar/default.png','丁然',1),
(NULL,'TIM','123456','1104543@.COM','1356239546','img/avatar/default.png','赵大猪',1),
(NULL,'TOC','123456','1104543@.COM','1352269546','img/avatar/default.png','刘晓雅',1),
(NULL,'TONNY','123456','1104543@.COM','1326289546','img/avatar/default.png','秦豆',1);
#创建用户收货地址表xz_receiver_address
#创建用户购物车表xz_shopping_cart
#创建订单表xz_order
#创建订单详情表xz_index_detail
#首页轮播广告条目表xz_index_carouse
| true |
fd142a76f3e2741936a18a7db173adb00f9f994d | SQL | hammer-mt/ViralAnalytics | /services/extract.sql | UTF-8 | 3,529 | 3.1875 | 3 | [] | no_license | -- Retrieves the latest document change events for all live documents.
-- timestamp: The Firestore timestamp at which the event took place.
-- operation: One of INSERT, UPDATE, DELETE, IMPORT.
-- event_id: The id of the event that triggered the cloud function mirrored the event.
-- data: A raw JSON payload of the current state of the document.
SELECT
document_name,
timestamp,
JSON_EXTRACT_SCALAR(data, '$.userHash') AS userHash,
JSON_EXTRACT_SCALAR(data, '$.refHash') AS refHash,
JSON_EXTRACT_SCALAR(data, '$.href') AS href,
JSON_EXTRACT_SCALAR(data, '$.title') AS title,
JSON_EXTRACT_SCALAR(data, '$.property') AS property,
JSON_EXTRACT_SCALAR(data, '$.referrer') AS referrer,
JSON_EXTRACT_SCALAR(data, '$.userAgent') AS userAgent,
JSON_EXTRACT_SCALAR(data, '$.timeZone') AS timeZone,
JSON_EXTRACT_SCALAR(data, '$.locale') AS locale,
JSON_EXTRACT_SCALAR(data, '$.timeZoneOffset') AS timeZoneOffset,
JSON_EXTRACT_SCALAR(data, '$.width') AS width,
JSON_EXTRACT_SCALAR(data, '$.height') AS height,
JSON_EXTRACT_SCALAR(data, '$.colorDepth') AS colorDepth,
JSON_EXTRACT_SCALAR(data, '$.cookieEnabled') AS cookieEnabled,
JSON_EXTRACT_SCALAR(data, '$.doNotTrack') AS doNotTrack,
JSON_EXTRACT_SCALAR(data, '$.protocol') AS protocol,
JSON_EXTRACT_SCALAR(data, '$.hostname') AS hostname,
JSON_EXTRACT_SCALAR(data, '$.port') AS port,
JSON_EXTRACT_SCALAR(data, '$.hash') AS urlhash,
JSON_EXTRACT_SCALAR(data, '$.pathname') AS pathname,
JSON_EXTRACT_SCALAR(data, '$.search') AS search,
JSON_EXTRACT_SCALAR(data, '$.x-appengine-country') AS country,
JSON_EXTRACT_SCALAR(data, '$.x-appengine-region') AS region,
JSON_EXTRACT_SCALAR(data, '$.x-appengine-city') AS city,
JSON_EXTRACT_SCALAR(data, '$.x-appengine-citylatlong') AS citylatlong,
JSON_EXTRACT_SCALAR(data, '$.sessionHash') AS sessionHash,
JSON_EXTRACT_SCALAR(data, '$.sessionCount') AS sessionCount,
JSON_EXTRACT_SCALAR(data, '$.pageviewCount') AS pageviewCount,
JSON_EXTRACT_SCALAR(data, '$.bookmarked') AS bookmarked,
JSON_EXTRACT_SCALAR(data, '$.sessionReferrer') AS sessionReferrer,
JSON_EXTRACT_SCALAR(data, '$.sessionParams') AS sessionParams,
JSON_EXTRACT_SCALAR(data, '$.sessionRefHash') AS sessionRefHash,
JSON_EXTRACT_SCALAR(data, '$.localStorageCheck') AS localStorageCheck,
JSON_EXTRACT_SCALAR(data, '$.sessionStorageCheck') AS sessionStorageCheck,
JSON_EXTRACT_SCALAR(data, '$.userReferrer') AS userReferrer,
JSON_EXTRACT_SCALAR(data, '$.userParams') AS userParams,
JSON_EXTRACT_SCALAR(data, '$.userRefHash') AS userRefHash,
JSON_EXTRACT_SCALAR(data, '$.eventName') AS eventName,
JSON_EXTRACT_SCALAR(data, '$.eventMeta') AS eventMeta,
JSON_EXTRACT_SCALAR(data, '$.timestamp') AS localTimestamp
FROM
(
SELECT
document_name,
FIRST_VALUE(timestamp) OVER(
PARTITION BY document_name
ORDER BY
timestamp DESC
) AS timestamp,
FIRST_VALUE(operation) OVER(
PARTITION BY document_name
ORDER BY
timestamp DESC
) AS operation,
FIRST_VALUE(data) OVER(
PARTITION BY document_name
ORDER BY
timestamp DESC
) AS data,
FIRST_VALUE(operation) OVER(
PARTITION BY document_name
ORDER BY
timestamp DESC
) = "DELETE" AS is_deleted
FROM
`genial-core-277717.firestore_export.posts_raw_changelog`
ORDER BY
document_name,
timestamp DESC
)
WHERE
NOT is_deleted
GROUP BY
document_name,
timestamp,
data | true |
0dce5f176966fd3848c01ab0934a88cd4f9dbacf | SQL | OnePlc/PLC_X_Room | /data/data_furniture.sql | UTF-8 | 2,648 | 3.171875 | 3 | [
"BSD-3-Clause"
] | permissive |
--
-- -- Core Form - Furniture Form Fields
--
INSERT INTO `core_form_field` (`Field_ID`, `type`, `label`, `fieldkey`, `tab`, `form`, `class`, `url_view`, `url_list`, `show_widget_left`, `allow_clear`, `readonly`, `tbl_cached_name`, `tbl_class`, `tbl_permission`) VALUES
(NULL, 'select', 'Article', 'article_idfs', 'roomfurniture-base', 'roomfurniture-single', 'col-md-2', '', '/article/api/list/0', 0, 1, 0, 'entitytag-single', 'OnePlace\\Article\\Model\\ArticleTable','add-OnePlace\\Article\\Controller\\ArticleController'),
(NULL, 'select', 'Condition', 'condition_idfs', 'roomfurniture-base', 'roomfurniture-single', 'col-md-2', '', '/tag/api/list/roomfurniture-single/condition', 0, 1, 0, 'entitytag-single', 'OnePlace\\Tag\\Model\\EntityTagTable','add-OnePlace\\Room\\Controller\\ConditionController'),
(NULL, 'select', 'Room', 'room_idfs', 'roomfurniture-base', 'roomfurniture-single', 'col-md-2', '', '/room/api/list/0', 0, 1, 0, 'entitytag-single', 'OnePlace\\Room\\Model\\RoomTable','add-OnePlace\\Room\\Controller\\RoomController'),
(NULL, 'textarea', 'Description', 'description', 'roomfurniture-base', 'roomfurniture-single', 'col-md-12', '', '', 0, 1, 0, '', '', '');
--
-- Core Form - Room Furniture Parial
--
INSERT INTO `core_form_field` (`Field_ID`, `type`, `label`, `fieldkey`, `tab`, `form`, `class`, `url_view`, `url_list`, `show_widget_left`, `allow_clear`, `readonly`, `tbl_cached_name`, `tbl_class`, `tbl_permission`) VALUES
(NULL, 'partial', 'Furniture', 'room_furniture', 'roomfurniture', 'room-single', 'col-md-12', '', '', 0, 1, 0, '', '', '');
--
-- Core Form Tabs
--
INSERT INTO `core_form_tab` (`Tab_ID`, `form`, `title`, `subtitle`, `icon`, `counter`, `sort_id`, `filter_check`, `filter_value`) VALUES
('roomfurniture', 'room-single', 'Furniture', 'Room furnishings', 'fas fa-couch ', '', 1, '', '');
--
-- Permissions
--
INSERT INTO `permission` (`permission_key`, `module`, `label`, `nav_label`, `nav_href`, `show_in_menu`) VALUES
('add', 'OnePlace\\Room\\Controller\\ConditionController', 'Add Condition', '', '', 0);
--
-- Buttons
--
INSERT INTO `core_form_button` (`Button_ID`, `label`, `icon`, `title`, `href`, `class`, `append`, `form`, `mode`, `filter_check`, `filter_value`) VALUES
(NULL, 'Add Furniture', 'fas fa-plus', 'Add Furniture', '/room/furniture/add', 'primary', '', 'room-view', 'link', '', '');
--
-- Custom Tags
--
-- todo: add select before and check if tag exists
--
INSERT INTO `core_tag` (`Tag_ID`, `tag_key`, `tag_label`, `created_by`, `created_date`, `modified_by`, `modified_date`) VALUES
(NULL, 'condition', 'Condition', '1', '0000-00-00 00:00:00', '1', '0000-00-00 00:00:00'); | true |
619430b41f99501d5b3f6be2d88881d01b18083b | SQL | larsjohanssonblank/dbt-utils-sqlserver | /integration_tests/models/cross_db_utils/test_date_trunc.sql | UTF-8 | 659 | 3.515625 | 4 | [
"Apache-2.0"
] | permissive |
with data as (
select * from {{ ref('data_date_trunc') }}
)
{% if target.type == 'sqlserver' %}
select
{{dbt_utils_sqlserver.date_trunc('day', 'updated_at') }} as actual,
day(day) as expected
from data
union all
select
{{ dbt_utils_sqlserver.date_trunc('month', 'updated_at') }} as actual,
month(month) as expected
from data
{% else %}
select
cast({{dbt_utils_sqlserver.date_trunc('day', 'updated_at') }} as date) as actual,
day as expected
from data
union all
select
cast({{ dbt_utils_sqlserver.date_trunc('month', 'updated_at') }} as date) as actual,
month as expected
from data
{% endif %} | true |
50cfb510fd558499b82b77244fa17bbce70020e7 | SQL | AbelSpecs/gripecita-china | /Entrega 02 - Final/Funciones, Modulos y Simulaciones.sql | UTF-8 | 24,039 | 3.359375 | 3 | [] | no_license | -----------------------------------------------------------------------------------------------------------------------------
-- Funciones
-----------------------------------------------------------------------------------------------------------------------------
create or replace function edad_a (fecha_nac date) return number is
begin
return (round(((sysdate - fecha_nac)/365),0));
end;
/
--devuleve true si lo tiene
create or replace function comprobar_sintoma (persona per_sin.pasaporte_persona_ps%type, sintoma per_sin.id_sintoma_ps%type) return boolean is
CURSOR sintoma_persona IS select * from per_sin where pasaporte_persona_ps = persona and id_sintoma_ps = sintoma;
registro per_sin%rowtype;
presencia boolean := false;
begin
open sintoma_persona;
fetch sintoma_persona into registro;
if (sintoma_persona%found) then
presencia := true;
fetch sintoma_persona into registro;
end if;
close sintoma_persona;
return presencia;
end;
/
--devuleve true si lo tiene
create or replace function comprobar_patologia (persona per_sin.pasaporte_persona_ps%type, patologia per_pat.id_patologia_pp%type) return boolean is
CURSOR patologia_persona IS select * from per_pat where pasaporte_persona_pp = persona and id_patologia_pp = patologia;
registro per_pat%rowtype;
presencia boolean := false;
begin
open patologia_persona;
fetch patologia_persona into registro;
if (patologia_persona%found) then
presencia := true;
fetch patologia_persona into registro;
end if;
close patologia_persona;
return presencia;
end;
/
create or replace function cantidad_sintomas (persona per_sin.pasaporte_persona_ps%type) return number is
cantidad number := 0;
begin
select count(*) into cantidad from per_sin where pasaporte_persona_ps = persona;
return cantidad;
end;
/
create or replace function cantidad_patologias (persona per_sin.pasaporte_persona_ps%type) return number is
cantidad number := 0;
begin
select count(*) into cantidad from per_pat where pasaporte_persona_pp = persona;
return cantidad;
end;
/
-----------------------------------------------------------------------------------------------------------------------------
-- Procedimiento de Infeccion
-----------------------------------------------------------------------------------------------------------------------------
create or replace procedure modulo_infeccion (id_persona persona.pasaporte_persona%type) is
cant_sintomas number;
sintoma_agregar per_sin.id_sintoma_ps%type := 1;
begin
dbms_output.put_line('Iniciando el modulo de Infeccion . . .');
select round(dbms_random.value(1,8),0) into cant_sintomas from dual;
dbms_output.put_line('cantidad de sintomas a insertar '|| cant_sintomas);
while sintoma_agregar <= cant_sintomas loop
--comprobar que el sintoma no lo tiene la persona en la misma fecha
if (comprobar_sintoma(id_persona, sintoma_agregar) = false) then
insert into per_sin values (sysdate, 'Si', id_persona, sintoma_agregar);
end if;
dbms_output.put_line('inserto sintoma ' || sintoma_agregar);
sintoma_agregar := sintoma_agregar + 1;
end loop;
end;
/
-----------------------------------------------------------------------------------------------------------------------------
-- Procedimiento de comprobacion de Sintomas y Patologias
-----------------------------------------------------------------------------------------------------------------------------
create or replace function comprobar_sintoma (persona per_sin.pasaporte_persona_ps%type, sintoma per_sin.id_sintoma_ps%type) return boolean is
CURSOR sintoma_persona IS select * from per_sin where pasaporte_persona_ps = persona and id_sintoma_ps = sintoma;
registro per_sin%rowtype;
presencia boolean := false;
begin
open sintoma_persona;
fetch sintoma_persona into registro;
if (sintoma_persona%found) then
presencia := true;
fetch sintoma_persona into registro;
end if;
close sintoma_persona;
return presencia;
end;
/
create or replace function comprobar_patologia (persona per_sin.pasaporte_persona_ps%type, patologia per_pat.id_patologia_pp%type) return boolean is
CURSOR patologia_persona IS select * from per_pat where pasaporte_persona_pp = persona and id_patologia_pp = patologia;
registro per_pat%rowtype;
presencia boolean := false;
begin
open patologia_persona;
fetch patologia_persona into registro;
if (patologia_persona%found) then
presencia := true;
fetch patologia_persona into registro;
end if;
close patologia_persona;
return presencia;
end;
-----------------------------------------------------------------------------------------------------------------------------
-- Procedimiento Centro Salud
-----------------------------------------------------------------------------------------------------------------------------
create or replace procedure modulo_centro_salud (csalud centro_salud.id_csalud%type, persona persona.pasaporte_persona%type, inserto OUT number) is
cursor insumos_csalud is select * from inventario where id_csalud_inventario = csalud;
registro_insumos inventario%rowtype;
cant_camas number;
camas_dis number;
camas_ocu number;
temporal number := 0;
begin
dbms_output.put_line('Iniciando el modulo Centro de Salud . . .');
--comprobar insumos del centro de salud
inserto := -1;
open insumos_csalud;
fetch insumos_csalud into registro_insumos;
while(insumos_csalud%found)loop
if (registro_insumos.cantidad_inventario < 100) then
update inventario set cantidad_inventario = registro_insumos.cantidad_inventario + 1000 where id_csalud_inventario = csalud;
end if;
fetch insumos_csalud into registro_insumos;
end loop;
--comprobar disponibilidad de camas
select camas_csalud into cant_camas from centro_salud where id_csalud = csalud;
select count(*) into camas_ocu from his_medico where id_csalud_histm = csalud and fecfinalingreso_histm is null;
camas_dis := cant_camas - camas_ocu;
if( camas_dis > 0) then
dbms_output.put_line('Hay camas disponibles '|| camas_dis);
begin
select coalesce(pasaporte_persona_histm, 0) into temporal from his_medico where pasaporte_persona_histm = persona and id_csalud_histm = csalud;
EXCEPTION
WHEN no_data_found THEN
temporal := null;
end;
if (temporal is null) then
insert into his_medico (pasaporte_persona_histm, id_csalud_histm, fecasistencia_histm, feciinicialingreso_histm) values
(persona, csalud, sysdate, sysdate);
update centro_salud set camas_csalud = camas_dis - 1 where id_csalud = csalud;
end if;
inserto := 1;
else
--no hay camas disponibles, reasignar a otro csalud
--insertar otro csalud por estado
dbms_output.put_line('NO hay camas disponibles');
inserto := 0;
end if;
end;
-----------------------------------------------------------------------------------------------------------------------------
-- Procedimiento de Supervivencia
-----------------------------------------------------------------------------------------------------------------------------
SET SERVEROUTPUT ON;
create or replace function modulo_supervivencia(id_p persona.pasaporte_persona%type) return date
is
fechad date;
contp number:=0;
numeroR number;
fechaDead timestamp;
i patologia.nombre_patologia%type;
cursor c1 is select pt.nombre_patologia as patologia from patologia pt, per_pat pp, persona p where p.pasaporte_persona = pp.pasaporte_persona_pp
and pp.id_patologia_pp = pt.id_patologia and p.pasaporte_persona = id_p;
begin
dbms_output.put_line('Iniciando el modulo de Supervivencia . . .');
dbms_output.put_line('La persona '|| id_p ||' morira?');
open c1;
fetch c1 into i;
while(c1%found)loop
if(i = 'Asma' or i = 'Neumonia' or i = 'Riesgo cardiovascular'
or i = 'Diabetes' or i = 'Insuficiencia cardiaca') then------- Verificacion de patologias
contp:= contp + 1;
end if;
fetch c1 into i;
end loop;
close c1;
-- Aqui devuelve si ya habia fallecido previamente
select fechadef_persona into fechaDead from persona where pasaporte_persona = id_p;
if (fechaDead is null) then
if(contp > 0) then
numeroR:= round(DBMS_RANDOM.value(0,1),0); -------numero aleatorio
if(numeroR = 1) then
dbms_output.put_line('Detition: '|| numeroR);
update persona set fechadef_persona = sysdate where pasaporte_persona = id_p;
-- Aqui devuelve si fallecio en el update
select fechadef_persona into fechad from persona where pasaporte_persona = id_p;
dbms_output.put_line('1. La persona '||id_p||' fallecio el '||fechad);
return fechad;
else
dbms_output.put_line('Detition: '|| numeroR);
return null;
end if;
else
dbms_output.put_line('0. La persona '||id_p||' no tiene las patologias');
return null;
end if;
else
dbms_output.put_line('0. La persona '||id_p||' fallecio el '||fechaDead);
return null;
end if;
end modulo_supervivencia;
-----------------------------------------------------------------------------------------------------------------------------
-- Procedimiento para Alterar Sintomas de una Persona
-----------------------------------------------------------------------------------------------------------------------------
create or replace procedure alteracionSintomas (pasaporte persona.pasaporte_persona%type, cant_sintomas_ret OUT number)
is
cant_sintomas number;
cant_patologias number;
cont number := 1;
cont2 number := 1;
sintoma_agregar per_sin.id_sintoma_ps%type := 1;
patologia_insertar per_pat.id_patologia_pp%type := 1;
begin
dbms_output.put_line('Iniciando el modulo de Alteracion de Sintomas . . .');
cant_sintomas := round(dbms_random.value(0,8),0);
cant_sintomas_ret := cant_sintomas;
dbms_output.put_line('Cantidad de sintomas a agregar: '|| cant_sintomas);
if (cant_sintomas <> 0)then
--Agregar la cantidad de sintomas
while sintoma_agregar <= cant_sintomas loop
--Comprobar que la persona no tenga el sintoma
if (comprobar_sintoma(pasaporte, sintoma_agregar) = false) then
insert into per_sin values(sysdate,'No',pasaporte,sintoma_agregar);
end if;
sintoma_agregar := sintoma_agregar + 1;
end loop;
if (cant_sintomas > 5) then
--Genero patologias a la persona
cant_patologias := round(dbms_random.value(1,15),0);
--Comprobar si la persona tiene la patologia a insertar
dbms_output.put_line('Cantidad de patoligias a agregar: '|| cant_patologias);
while patologia_insertar <= cant_patologias loop
--comprobar que la persona no tenga el sintoma
if (comprobar_patologia(pasaporte, patologia_insertar) = false) then
insert into per_pat values (pasaporte, patologia_insertar);
end if;
dbms_output.put_line('Patologia a insertar = '||patologia_insertar);
patologia_insertar := patologia_insertar + 1;
end loop;
end if;
else
--Elimino los sintomas y asigno fechaFinalIngreso a la persona
dbms_output.put_line('Se todos eliminaran los sintomas');
dbms_output.put_line('Se curo la persona '||pasaporte);
delete from per_sin where pasaporte_persona_ps = pasaporte;
update his_medico set fecfinalingreso_histm = sysdate where pasaporte_persona_histm = pasaporte;
end if;
end;
-- execute alteracionSintomas(15);
-- SELECT * FROM persona WHERE pasaporte_persona not in (SELECT pasaporte_persona_ps FROM per_sin);
-- SELECT * FROM per_sin WHERE pasaporte_persona_ps = 15;
-----------------------------------------------------------------------------------------------------------------------------
-- Simulacion de Infectar Poblacion
-----------------------------------------------------------------------------------------------------------------------------
create or replace procedure inicia_simulacion (modelo aislamiento.tipo_aislamiento%type)is
lugar_infectar lugar.id_lugar%type := 0;
cantper_Sanos number;
cantper_infectar number;
usuario_random persona.pasaporte_persona%type;
centro_medico centro_salud.id_csalud%type;
cant_sintomas number;
fecha_def date;
cont number;
csalud_ret number;
min_ciudad lugar.id_lugar%type := 0;
max_ciudad lugar.id_lugar%type := 0;
begin
dbms_output.put_line('----------Simulacion Infectar Poblacion------------');
select min(id_lugar) into min_ciudad from lugar where tipo_lugar = 'Ciudad';
select max(id_lugar) into max_ciudad from lugar where tipo_lugar = 'Ciudad';
for lugar_infectar in min_ciudad..max_ciudad loop
dbms_output.put_line('');
dbms_output.put_line('--------------------------Ciudad a infecatar '||lugar_infectar||'------------------------------');
select count(*) into cantper_Sanos from persona where id_lugar_persona = lugar_infectar and status_persona = 'Sano';
dbms_output.put_line('cantidad de personas sanas '||cantper_sanos||' en la ciudad '||lugar_infectar);
if modelo = 3 then
cantper_infectar := round(cantper_sanos * 0.25,0);
dbms_output.put_line('cantidad de personas a infectar '||cantper_infectar||' en la ciudad '||lugar_infectar);
for cont in 1..cantper_infectar loop
--selecciono persona random a infectar
SELECT pasaporte_persona INTO usuario_random
FROM (select * from persona where id_lugar_persona = lugar_infectar and status_persona = 'Sano' order by DBMS_RANDOM.VALUE) where rownum = 1;
dbms_output.put_line('');
dbms_output.put_line('--------------------------Persona #'||usuario_random||'-----------------------------');
modulo_infeccion(usuario_random);
if (cantidad_sintomas(usuario_random) >= 6) then
--presenta m�s de 6 sintomas
--actualizo persona a infectada
select id_csalud into centro_medico from centro_salud where id_lugar_csalud = lugar_infectar;
dbms_output.put_line('---------------Persona #'||usuario_random||' asignada al Centro de salud '|| centro_medico ||'---------------');
update persona set status_persona = 'Infectado' where pasaporte_persona = usuario_random;
--empiezo modulo centro salud
modulo_centro_salud(centro_medico,usuario_random, csalud_ret);
if (cantidad_sintomas(usuario_random) = 8) then
--empiezo modulo alteracion de sintomas
alteracionSintomas(usuario_random, cant_sintomas);
if (cant_sintomas = 8) then
fecha_def := modulo_supervivencia(usuario_random);
if(fecha_def is not null) then
update persona set fechadef_persona = fecha_def where pasaporte_persona = usuario_random;
end if;
elsif (cant_sintomas < 4) then
--asigno recuperado y asigno fecha final ingreso
update persona set status_persona = 'Recuperado' where pasaporte_persona = usuario_random;
update his_medico set fecfinalingreso_histm = sysdate where pasaporte_persona_histm = usuario_random;
end if;
end if;
else
--presenta menos de 6 sintomas
--Aislo a la persona
update persona set status_persona = 'Aislado' where pasaporte_persona = usuario_random;
end if;
end loop;
ELSE
--cuando modelo <> 3
cantper_infectar := round(cantper_sanos * DBMS_RANDOM.VALUE,0);
dbms_output.put_line('cantidad de personas a infectar '||cantper_infectar||' en la ciudad '||lugar_infectar);
for cont in 1..cantper_infectar loop
--selecciono persona random a infectar
SELECT pasaporte_persona INTO usuario_random
FROM (select * from persona where id_lugar_persona = lugar_infectar and status_persona = 'Sano' order by DBMS_RANDOM.VALUE) where rownum = 1;
dbms_output.put_line('');
dbms_output.put_line('--------------------------Persona #'||usuario_random||'-----------------------------');
modulo_infeccion(usuario_random);
if (cantidad_sintomas(usuario_random) >= 6) then
--presenta m�s de 6 sintomas
--actualizo persona a infectada
select id_csalud into centro_medico from centro_salud where id_lugar_csalud = lugar_infectar;
dbms_output.put_line('---------------Persona #'||usuario_random||' asignada al Centro de salud '|| centro_medico ||'---------------');
update persona set status_persona = 'Infectado' where pasaporte_persona = usuario_random;
--empiezo modulo centro salud
modulo_centro_salud(centro_medico,usuario_random, csalud_ret);
if (cantidad_sintomas(usuario_random) = 8) then
--empiezo modulo alteracion de sintomas
alteracionSintomas(usuario_random, cant_sintomas);
if (cant_sintomas = 8) then
fecha_def := modulo_supervivencia(usuario_random);
--aqui falta algo
if(fecha_def is not null) then
update persona set fechadef_persona = fecha_def where pasaporte_persona = usuario_random;
end if;
elsif (cant_sintomas < 4) then
--asigno recuperado y asigno fecha final ingreso
update persona set status_persona = 'Recuperado' where pasaporte_persona = usuario_random;
update his_medico set fecfinalingreso_histm = sysdate where pasaporte_persona_histm = usuario_random;
end if;
end if;
else
--presenta menos de 6 sintomas
--Aislo a la persona
update persona set status_persona = 'Aislado' where pasaporte_persona = usuario_random;
end if;
end loop;
end if;
end loop;
for i in 1..5 loop
Frontera(i);
end loop;
end;
/
SET SERVEROUTPUT ON;
execute inicia_simulacion(3);
commit;
/
-----------------------------------------------------------------------------------------------------------------------------
-- Simulacion de Aislamiento de Poblacion que Viajo
-----------------------------------------------------------------------------------------------------------------------------
SET SERVEROUTPUT ON;
-----------------------------------------------------------------------------------------------------------------------------
-- Simulacion de Aislamiento de Poblacion que Viajo
-----------------------------------------------------------------------------------------------------------------------------
create or replace procedure simulacionAislarPoblacionViajo
is
viajeros SYS_REFCURSOR;
fecha_def timestamp;
inserto_en_csalud number := -2;
centro number := 0;
cant_sintomas number := 0;
pasaporte persona.pasaporte_persona%type := 0;
status persona.status_persona%type;
fechaiviaje vuelo.fechai_vuelo%type;
ciudad lugar.id_lugar%type := 0;
min_ciudad lugar.id_lugar%type := 0;
max_ciudad lugar.id_lugar%type := 0;
fechaDef timestamp;
begin
dbms_output.put_line('----------Simulacion Aislamiento de Poblacion que Viajo------------');
select min(id_lugar) into min_ciudad from lugar where tipo_lugar = 'Ciudad';
select max(id_lugar) into max_ciudad from lugar where tipo_lugar = 'Ciudad';
for ciudad in min_ciudad..max_ciudad
loop
dbms_output.put_line('--------------------------Ciudad #'||ciudad||'------------------------------');
open viajeros for select pasaporte_persona, status_persona, max(vuelo.fechai_vuelo) from persona, vuelo, per_vue
where pasaporte_persona = pasaporte_persona_pv
and numero_vuelo = numero_vuelo_pv and fechadef_persona is null
and id_lugar_persona = ciudad
group by pasaporte_persona, status_persona;
fetch viajeros into pasaporte, status, fechaiviaje;
while(viajeros%found)loop
dbms_output.put_line('--------------------------Persona #'||pasaporte||'-----------------------------');
select fechadef_persona into fechaDef from persona where pasaporte_persona = pasaporte;
if (fechaDef is null) then
select id_csalud into centro from centro_salud where id_lugar_csalud = ciudad order by camas_csalud desc fetch first 1 rows only ;
dbms_output.put_line('Persona #'||pasaporte||' asignada al Centro de Salud '|| centro);
modulo_centro_salud(centro, pasaporte, inserto_en_csalud);
if (inserto_en_csalud = 1) then
update persona set status_persona = 'Aislado' where pasaporte_persona = pasaporte;
dbms_output.put_line('Persona '||pasaporte||' Aislada');
-- Llamo a Modulo de Alteracion de Sintomas
alteracionSintomas(pasaporte,cant_sintomas);
if (cant_sintomas = 8) then
fecha_def := modulo_supervivencia(pasaporte);
if (fecha_def is null) then
update persona set status_persona = 'Infectado' where pasaporte_persona = pasaporte;
dbms_output.put_line('Persona '||pasaporte||' Infectada');
end if;
elsif (cant_sintomas < 4)then
update persona set status_persona = 'Sano' where pasaporte_persona = pasaporte;
update his_medico set fecfinalingreso_histm = sysdate where pasaporte_persona_histm = pasaporte;
dbms_output.put_line('Persona '||pasaporte||' Sana');
else
update persona set status_persona = 'Infectado' where pasaporte_persona = pasaporte;
dbms_output.put_line('Persona '||pasaporte||' Infectada');
end if;
end if;
end if;
dbms_output.put_line('-------------------------------------------------------------------');
fetch viajeros into pasaporte, status, fechaiviaje;
end loop;
dbms_output.put_line('-------------------------------------------------------------------');
end loop;
commit;
end;
/
SET SERVEROUTPUT ON;
-- Llamada para ejecutar la Simulacion
execute simulacionAislarPoblacionViajo;
| true |
b33fcf28055b650be36ba59dd0696e503d3ce127 | SQL | cvick32/mastery-with-sql | /chapter_4_exercises.sql | UTF-8 | 3,951 | 4.59375 | 5 | [] | no_license | -- 4.1 Write a query to return the total count of customers in the customer table and the count of how many customers provided an email address
select count(*) as "# customers", count(email) as "# customers with email" from customer;
-- 4.2 Building on the previous exercise, now return an additional result showing the percentage of
-- customers with an email address (as a helpful hint, if you're getting 0 try multiplying the fraction
-- by 100.0 - we'll examine why this is necessary in an upcoming chapter on data types)
select count(*) as "# customers", count(email) as "# customers with email",
100.0 * count(email) / count(*) as "% with email" from customer;
-- 4.3 Write a query to return the number of distinct customers who have made payments
select count(distinct customer_id) as count from payment;
-- 4.4 What is the average length of time films are rented out for
select avg(return_date - rental_date) from rental;
-- 4.5 Write a query to return the sum total of all payment amounts received
select sum(amount) from payment;
-- 4.6 List the number of films each actor has appeared in and order the results from most popular to least
select actor_id, count(*) as num_films
from film_actor
group by actor_id
order by num_films desc;
-- 4.7 List the customers who have made over 40 rentals
select customer_id
from rental
group by customer_id
having count(*) > 40;
-- 4.8 We want to compare how the staff are performing against each other on a month to month basis. So for
-- each month and year, show for each staff member how many payments they handled, the total amount of money
-- they accepted, and the average payment amount
select
date_part('year', payment_date) as year,
date_part('month', payment_date) as month, staff_id,
count(*) as num_payments,
sum(amount) as payment_total,
avg(amount) as avg_payment_total
from payment
group by
date_part('year', payment_date),
date_part('month', payment_date),
staff_id;
-- 4.9 Write a query to show the number of rentals that were returned within 3 days, the number returned
-- in 3 or more days, and the number never returned (for the logical comparison check you can use the
-- following code snippet to compare against an interval: where return_date - rental_date < interval '3 days')
select
count(*) filter(where return_date - rental_date < interval '3 days') as "lt 3 days",
count(*) filter(where return_date - rental_date >= interval '3 days') as "gt 3 days",
count(*) filter(where return_date is null) as "never returned"
from rental;
-- 4.10 Write a query to give counts of the films by their length in groups of 0 - 1hrs,
-- 1 - 2hrs, 2 - 3hrs, and 3hrs+ (note: you might get slightly different numbers if doing
-- inclusive or exclusive grouping - but don't sweat it!)
select
case
when length between 0 and 59 then '0-1hrs'
when length between 60 and 119 then '1-2hrs'
when length between 120 and 179 then '2-3hrs'
else '3hrs+'
end as len,
count(*)
from film
group by 1
order by 1;
-- 4.12 Write a query to return the average rental duration for each customer in descending order
select customer_id, avg(return_date - rental_date) as avg_rent_dur
from rental
group by customer_id
order by avg_rent_dur desc;
-- 4.13 Return a list of customer where all payments they’ve made have been over $2 (lookup the bool_and aggregate function which will be useful here)
select customer_id
from payment
group by customer_id
having bool_and(amount > 2);
-- 4.14 As a final fun finish to this chapter, run the following query to see a cool way you can generate ascii histogram charts.
-- Look up the repeat function (you'll find it under 'String Functions and Operators') to see how it works and change
-- the output character...and don't worry, I'll explain the ::int bit in the next chapter!
select rating, repeat('*', (count(*) / 10)::int) as "count/10"
from film
where rating is not null
group by rating;
| true |
03a8f2e42803e48f59dab462adad03ba6d1db37a | SQL | oncicaradupopovici/Pet | /Pet.Migrations/SqlScripts/Views/003.vwExpenseByCategory.sql | UTF-8 | 418 | 3.859375 | 4 | [] | no_license | create view vwExpenseByCategory
as
select
agg.ExpenseMonth,
agg.ExpenseCategoryId,
agg.value,
c.Name as ExpenseCategoryName,
row_number() over (order by agg.ExpenseMonth, agg.ExpenseCategoryId) as Id
from (
select ExpenseMonth, ExpenseCategoryId, sum(value) as value
from Expense
group by ExpenseMonth, ExpenseCategoryId
) agg
left join ExpenseCategory c on agg.ExpenseCategoryId = c.ExpenseCategoryId | true |
fe414b77f88e1a4156cbdbb9dbe1abc45df3dcf8 | SQL | gchandra10/dbpracticequeries | /hashingexample.sql | UTF-8 | 1,015 | 3.6875 | 4 | [] | no_license | drop table users;
CREATE TABLE users (
id INT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'UNSIGNED means cannot take negative values'
,first_name VARCHAR(50) NOT NULL
,last_name VARCHAR(50) NOT NULL
,email VARCHAR(255) DEFAULT 'noname@noname.com' NOT NULL
,full_name VARCHAR(150) AS (concat(first_name, ' ', last_name)) COMMENT 'This is a Generated Column and its VIRTUAL column and doesnt take up space'
,pwd VARCHAR(255) DEFAULT NULL COMMENT 'This is default NULL'
,PRIMARY KEY (id) COMMENT 'Creating PRIMARY KEY as separate line item'
,UNIQUE KEY email (email) COMMENT 'Creating UNIQUE KEY as separate line item'
);
INSERT INTO users (first_name, last_name, email, pwd) VALUES ('Rachael','Green','user1@example.com', MD5('pass123'));
INSERT INTO users (first_name, last_name, pwd) VALUES ('Cosmo','Kramer', SHA1('pass123'));
INSERT INTO users (first_name, last_name, email, pwd) VALUES ('Sheldon','Cooper', 'bazinga@cooper.com', SHA2('pass123',512));
select * from users;
describe users;
| true |
c32f21cd8d2020c77242022f6a08f1777d03bb12 | SQL | nemesis-umbrella/HorarioAPI | /sql/Postgres/s_asistencia_postgres.sql | UTF-8 | 3,555 | 3.765625 | 4 | [
"MIT"
] | permissive | -- SQLite
--
-- Creación de la BD s_asistencia
--
-- Creación de tablas catalogo
--
CREATE TABLE ct_estado(
id_estado INTEGER PRIMARY KEY,
descripcion VARCHAR(50)
);
CREATE TABLE ct_carrera(
clave_carrera CHAR(5) PRIMARY KEY,
descripcion VARCHAR(50)
);
CREATE TABLE ct_materia(
id_materia SERIAL PRIMARY KEY,
nombre VARCHAR(50),
creditos INTEGER
);
--
-- Creación de tablas
--
CREATE TABLE dt_profesor(
clave_empleado NUMERIC(10) PRIMARY KEY,
nombre VARCHAR(50),
apellidos VARCHAR(100),
id_estado INTEGER,
CONSTRAINT fk_estado_prof FOREIGN KEY(id_estado) REFERENCES ct_estado(id_estado)
);
CREATE TABLE dt_alumno(
matricula NUMERIC(11) PRIMARY KEY,
nombre varchar(50),
apellidos varchar(100),
id_estado INTEGER,
clave_carrera CHAR(5),
CONSTRAINT fk_estado_alum FOREIGN KEY(id_estado) REFERENCES ct_estado(id_estado),
CONSTRAINT fk_carrera_alum FOREIGN KEY(clave_carrera) REFERENCES ct_carrera(clave_carrera)
);
--
-- Creación de tablas intermedias
--
CREATE TABLE dt_carrera_materia(
clave_carrera CHAR(5),
id_materia INTEGER,
CONSTRAINT UC_car_mat UNIQUE (clave_carrera,id_materia),
CONSTRAINT fk_carrera_clave FOREIGN KEY (clave_carrera) REFERENCES ct_carrera(clave_carrera),
CONSTRAINT fk_carrera_materia FOREIGN KEY (id_materia) REFERENCES ct_materia(id_materia)
);
CREATE TABLE dt_materia_profesor(
id_mat_prof SERIAL PRIMARY KEY,
id_materia INTEGER,
clave_empleado NUMERIC(10),
CONSTRAINT UC_materia_prof UNIQUE(id_materia,clave_empleado),
CONSTRAINT fk_materia_prof FOREIGN KEY(id_materia) REFERENCES ct_materia(id_materia),
CONSTRAINT fk_materia_prof_cve FOREIGN KEY(clave_empleado) REFERENCES dt_profesor(clave_empleado)
);
CREATE TABLE dt_clase_horario(
id_clase_horario SERIAL PRIMARY KEY,
id_mat_prof INTEGER,
lun_ini TIME,
lun_fin TIME,
mar_ini TIME,
mar_fin TIME,
mie_ini TIME,
mie_fin TIME,
jue_ini TIME,
jue_fin TIME,
vie_ini TIME,
vie_fin TIME,
sab_ini TIME,
sab_fin TIME,
id_estado INTEGER,
CONSTRAINT fk_cls_hor_mat_prof FOREIGN KEY(id_mat_prof) REFERENCES dt_materia_profesor(id_mat_prof),
CONSTRAINT fk_estado_clase_horario FOREIGN KEY(id_estado) REFERENCES ct_estado(id_estado)
);
CREATE TABLE dt_alum_clase_horario(
id_alum_clas_hor SERIAL PRIMARY KEY,
matricula NUMERIC(11),
id_clase_horario INTEGER,
id_estado INTEGER,
CONSTRAINT fk_alum_horario FOREIGN KEY(matricula) REFERENCES dt_alumno(matricula) ON DELETE CASCADE,
CONSTRAINT fk_alum_clas_horario FOREIGN KEY(id_clase_horario) REFERENCES dt_clase_horario(id_clase_horario),
CONSTRAINT fk_estado_hor_alumn FOREIGN KEY(id_estado) REFERENCES ct_estado(id_estado)
);
CREATE TABLE dt_asistencia(
no_asistencia SERIAL PRIMARY KEY,
id_alum_clas_hor INTEGER,
matricula NUMERIC(11),
fecha DATE,
hora_entrada TIME,
hora_salida TIME,
puntualidad NUMERIC(1),
CONSTRAINT fk_asist_alum_horario FOREIGN KEY(id_alum_clas_hor) REFERENCES dt_alum_clase_horario(id_alum_clas_hor),
CONSTRAINT fk_asist_alum_matricula FOREIGN KEY(matricula) REFERENCES dt_alumno(matricula) ON DELETE CASCADE
);
| true |
daea315a5f4ec6afd8af5c9c95a0e4796ee6c092 | SQL | MarcceloSelv/DBA | /Performance/Top20Queries2/IO.sql | UTF-8 | 1,528 | 3.96875 | 4 | [] | no_license | ;with high_io_queries as
(
select top 20
query_hash,
sum(total_logical_reads + total_logical_writes) io,
sum(execution_count) executionCount
from sys.dm_exec_query_stats
where query_hash <> 0x0
and execution_count > 15
group by query_hash
order by sum(total_logical_reads + total_logical_writes) / (sum(execution_count) + 0.0) desc
)
select @@servername as servername,
coalesce(db_name(st.dbid), db_name(ST.dbid), 'Resource') AS [DatabaseName],
coalesce(object_name(ST.objectid, ST.dbid), '<none>') as [object_name],
qs.query_hash,
qs.total_logical_reads + total_logical_writes as total_io,
qs.execution_count,
cast((total_logical_reads + total_logical_writes) / (execution_count + 0.0) as money) as average_io,
io as total_io_for_query,
SUBSTRING(ST.TEXT,(QS.statement_start_offset + 2) / 2,
(CASE
WHEN QS.statement_end_offset = -1 THEN LEN(CONVERT(NVARCHAR(MAX),ST.text)) * 2
ELSE QS.statement_end_offset
END - QS.statement_start_offset) / 2) as sql_text
--,qp.query_plan
from sys.dm_exec_query_stats qs
join high_io_queries fq
on fq.query_hash = qs.query_hash
cross apply sys.dm_exec_sql_text(qs.sql_handle) st
--cross apply sys.dm_exec_query_plan (qs.plan_handle) qp
--outer apply sys.dm_exec_plan_attributes(qs.plan_handle) pa
--where pa.attribute = 'dbid'
order by fq.io / (executionCount + 0.0) desc,
fq.query_hash,
qs.total_logical_reads + total_logical_writes desc
option (recompile) | true |
05afb15eeba0ebdd8e21abd985dace0f3c6cc34e | SQL | seanxinhao/DBFinalProject | /partB/partB-8.sql | UTF-8 | 2,689 | 3.53125 | 4 | [] | no_license | clear column
set linesize 300
column id format A2
column "employee name" format A20
column JAVA1 format 9
column JAVA2 format 9
column J2EE format 9
column SQL1 format 9
column SQL2 format 9
column PRJM1 format 9
column PRJM2 format 9
column RUBY format 9
column PYTHO format 9
column MOBDA format 9
column "Latest Date Acquired" heading "Latest|Date|Acquired" format A12
column count(code) heading "Number|of|Skills" format 99
select decode(emp_num, null, ' ', emp_num) id,
decode(emp_first || ' ' || emp_last, ' ', 'Number of Trainings', emp_first || ' ' || emp_last) "Employee Name",
sum(decode(code, 'JAVA1', 1, 0)) "JAVA1",
decode(emp_num, null, ' ', nvl(to_char(max(case when code = 'JAVA1' then date_acquired else null end), 'dd-Mon-yyyy'), ' ')) as "Latest Date Acquired",
sum(decode(code, 'JAVA2', 1, 0)) "JAVA2",
decode(emp_num, null, ' ', nvl(to_char(max(case when code = 'JAVA2' then date_acquired else null end), 'dd-Mon-yyyy'), ' ')) as "Latest Date Acquired",
sum(decode(code, 'J2EE', 1, 0)) "J2EE",
decode(emp_num, null, ' ', nvl(to_char(max(case when code = 'J2EE' then date_acquired else null end), 'dd-Mon-yyyy'), ' ')) as "Latest Date Acquired",
sum(decode(code, 'MOBDA', 1, 0)) "MOBDA",
decode(emp_num, null, ' ', nvl(to_char(max(case when code = 'MOBDA' then date_acquired else null end), 'dd-Mon-yyyy'), ' ')) as "Latest Date Acquired",
sum(decode(code, 'PRJM1', 1, 0)) "PRJM1",
decode(emp_num, null, ' ', nvl(to_char(max(case when code = 'PRJM1' then date_acquired else null end), 'dd-Mon-yyyy'), ' ')) as "Latest Date Acquired",
sum(decode(code, 'PRJM2', 1, 0)) "PRJM2",
decode(emp_num, null, ' ', nvl(to_char(max(case when code = 'PRJM2' then date_acquired else null end), 'dd-Mon-yyyy'), ' ')) as "Latest Date Acquired",
sum(decode(code, 'PYTHO', 1, 0)) "PYTHO",
decode(emp_num, null, ' ', nvl(to_char(max(case when code = 'PYTHO' then date_acquired else null end), 'dd-Mon-yyyy'), ' ')) as "Latest Date Acquired",
sum(decode(code, 'RUBY', 1, 0)) "RUBY",
decode(emp_num, null, ' ', nvl(to_char(max(case when code = 'RUBY' then date_acquired else null end), 'dd-Mon-yyyy'), ' ')) as "Latest Date Acquired",
sum(decode(code, 'SQL1', 1, 0)) "SQL1",
decode(emp_num, null, ' ', nvl(to_char(max(case when code = 'SQL1' then date_acquired else null end), 'dd-Mon-yyyy'), ' ')) as "Latest Date Acquired",
sum(decode(code, 'SQL2', 1, 0)) "SQL2",
decode(emp_num, null, ' ', nvl(to_char(max(case when code = 'SQL2' then date_acquired else null end), 'dd-Mon-yyyy'), ' ')) as "Latest Date Acquired",
count(code)
from employee join training using (emp_num)
group by GROUPING SETS ((emp_num, emp_first, emp_last), ());
set linesize 180
| true |
aaa88b8a3af7937fb42cd8ddda38ed407e035512 | SQL | oshiete-karen/bot | /config/migration.sql | UTF-8 | 1,022 | 3.5 | 4 | [] | no_license | CREATE DATABASE oshiete_karen DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
CREATE TABLE user (
id MEDIUMINT unsigned NOT NULL AUTO_INCREMENT,
mid VARCHAR(36) NOT NULL,
name VARCHAR(36) NOT NULL, -- LINEの名前って何バイトまでだっけ
google_credentials_json TEXT,
PRIMARY KEY (`id`)
);
ALTER TABLE user
MODIFY COLUMN name VARCHAR(36) DEFAULT NULL,
MODIFY COLUMN mid VARCHAR(36) NOT NULL UNIQUE;
CREATE TABLE credential (
user_id MEDIUMINT unsigned PRIMARY KEY,
client_id TEXT NOT NULL,
access_token TEXT NOT NULL,
refresh_token TEXT NOT NULL,
expiration_time_millis BIGINT UNSIGNED,
scope TEXT NOT NULL,
FOREIGN KEY (`user_id`) REFERENCES user (`id`),
UNIQUE (client_id(255), access_token(255), refresh_token(255))
);
ALTER TABLE user
DROP google_credentials_json;
CREATE TABLE events (
id VARCHAR(36) PRIMARY KEY,
user_id MEDIUMINT unsigned NOT NULL,
summary TEXT NOT NULL,
start DATETIME,
end DATETIME,
FOREIGN KEY (`user_id`) REFERENCES user (`id`)
);
| true |
7203efcdb00606c77c5af95358494280d4539e68 | SQL | iumairhasan/SQLPractise | /views.sql | WINDOWS-1252 | 1,394 | 3.9375 | 4 | [] | no_license |
/*
Create a view to include the encryption and
schemabinding options. Encryption protects the
view query definition. Schemabinding means the
definition of the database object(s) on which
the view is defined can not be changed without
first dropping the view.
*/
CREATE VIEW vwEmployeeContactInfo1
WITH ENCRYPTION, SCHEMABINDING
AS
SELECT e.[BusinessEntityID] as [ContactID], FirstName,
MiddleName, LastName, JobTitle
FROM Person.Person c
INNER JOIN HumanResources.Employee e
ON c.BusinessEntityID = e.BusinessEntityID;
select *
from vwEmployeeContactInfo1
exec sp_helptext vwEmployeeContactInfo1;
drop view vwEmployeeContactInfo1;
CREATE VIEW vwEmployeeContactInfo124
AS
SELECT e.[BusinessEntityID] as [ContactID], FirstName,
MiddleName, LastName, JobTitle
FROM Person.Person c
INNER JOIN HumanResources.Employee e
ON c.BusinessEntityID = e.BusinessEntityID;
-- Select from the view
SELECT * FROM vwEmployeeContactInfo124;
-- See the script that generated the view
EXEC sp_helptext vwEmployeeContactInfo124;
DROP VIEW vwEmployeeContactInfo124;
/*
Alter the view to remove schemabinding must
restate everything, including changes.
*/
ALTER VIEW vwEmployeeContactInfo124
WITH ENCRYPTION
AS
SELECT e.[BusinessEntityID] as [ContactID], FirstName,
MiddleName, LastName, JobTitle
FROM Person.Person c
INNER JOIN HumanResources.Employee e
ON c.BusinessEntityID = e.BusinessEntityID; | true |
24078e19ce00e9dc2fedf60cdddceac6175e60fd | SQL | humber42/tyke-backends | /schoolar-management-service/src/main/resources/db/migration/V11__adding_career_to_group.sql | UTF-8 | 184 | 2.921875 | 3 | [] | no_license | ALTER TABLE public.grupo ADD id_carrera int NULL;
ALTER TABLE public.grupo
ADD CONSTRAINT grupo_carrera_id_fk
FOREIGN KEY (id_carrera) REFERENCES public.carrera (id) ON DELETE CASCADE; | true |
c9c55f373a4413f22bf4f45c71f17938199c5e9c | SQL | Bpara001/CS_UCR | /cs166/lab3/excercise1.sql | UTF-8 | 1,208 | 2.984375 | 3 | [] | no_license | RESTRICT=No ACTION=defualt
CREATE TABLE Professor (ssn INTEGER NOT NULL,
name text,
age INTEGER,
rank text,
specialty text,
PRIMARY KEY(ssn)
ON DELETE NO ACTION
));
CREATE TABLE Dept ( dno INTEGER NOT NULL,
dname text,
office text,
ssn INTEGER,
PRIMARY KEY(dno)
FOREIGN KEY (ssn) REFERENCES Professor(ssn)
ON DELETE NO ACTION
));
CREATE TABLE Project ( pno INTEGER NOT NULL,
sponser text,
start_date DATE,
end_date DATE,
budget FLOAT,
PRIMARY KEY(pno)
ON DELETE NO ACTION
));
CREATE TABLE Graduate( ssn INTEGER NOT NULL,
name text,
age INTEGER,
deg_pg text,
PRIMARY KEY(snn)
ON DELETE NO ACTION
));
CREATE TABLE work_dept( ssn INTEGER NOT NULL,
duno INTEGER NOT NULL,
time_pc FLOAT,
PRIMARY KEY(ssn,dno),
FOREIGN KEY (ssn) REFERENCES Professor(ssn),
FOREIGN KEY (dno) REFERENCES Dept(dno)
));
CREATE TABLE runs( ssn INTEGER NOT NULL,
duno INTEGER NOT NULL,
PRIMARY KEY(ssn,dno),
FOREIGN KEY (ssn) REFERENCES Professor(ssn),
FOREIGN KEY (dno) REFERENCES Dept(dno)
));
| true |
33730cb33fb047f6e49ab6757b68a27fb8bf6476 | SQL | wladko0/sql-scripts-macola-wisys-epicor | /PO-AllPurchaseOrders-Updated_4_19_12.sql | UTF-8 | 1,890 | 3.375 | 3 | [] | no_license | SELECT CASE WHEN PL.qty_received < PL.qty_ordered THEN 'OPEN'
ELSE 'RECEIVED'
END AS [Status], PH.ord_no AS [PH.ord_no], PH.vend_no AS [PH.vend_no], AP.vend_name AS [AP.vend_name], PH.ord_dt AS [PH.ord_dt], PL.vend_no AS [PL.vend_no],
PL.item_no AS [PL.item_no], PL.vend_item_no AS [PL.vend_item_no],
PL.mn_no AS [PL.mn_no], PL.sb_no AS [PL.sb_no], PL.var_mn_no AS [PL.var_mn_no], PL.var_sb_no AS [PL.var_sb_no], PL.acc_mn_no AS [PL.acc_mn_no],
PL.acc_sb_no AS [PL.acc_sb_no], PL.exp_unit_cost AS [PL.exp_unit_cost], PL.act_unit_cost AS [PL.act_unit_cost], PL.std_cost AS [PL.std_cost],
PL.qty_ordered AS [PL.qty_ordered], PL.qty_ord_chg_amt AS [PL.qty_ord_chg_amt], PL.qty_released AS [PL.qty_released], PL.qty_received AS [PL.qty_received],
PL.qty_remaining AS [PL.qty_remaining], PL.qty_inv AS [PL.qty_inv],
PL.dollars_inv AS [PL.dollars_inv], PL.request_dt AS [PL.request_dt], PL.promise_dt AS [PL.promise_dt], PL.receipt_dt AS [PL.receipt_dt],
PL.oe_ord_no AS [PL.oe_ord_no], PL.var_qty_mn_no AS [PL.var_qty_mn_no], PL.var_qty_sb_no AS [PL.var_qty_sb_no], FL.chk_no AS [Check #],
FL.chk_dt AS [Check Date], FL.inv_no AS [Inv #], SH.flat_amt AS [Landed Cost]
FROM dbo.poordhdr_sql AS PH INNER JOIN
dbo.poordlin_sql AS PL ON PL.ord_no = PH.ord_no AND PL.vend_no = PH.vend_no INNER JOIN
dbo.apvenfil_sql AS AP ON AP.vend_no = PH.vend_no LEFT OUTER JOIN
dbo.humres AS HR ON PL.byr_plnr = HR.res_id LEFT OUTER JOIN
dbo.poshpfil_sql AS PS ON PS.ship_to_cd = PH.ship_to_cd LEFT OUTER JOIN
apopnfil_sql AS FL ON FL.ap_po_no = PH.ord_no LEFT OUTER JOIN
popurcst_sql AS SH ON SH.ord_no = PL.ord_no AND SH.line_no = PL.line_no
WHERE ord_dt > '01/01/2011' | true |
f479db72ea4fe5e196feb8b211af9bff38407e22 | SQL | Niyati16/it635 | /libproject.sql | UTF-8 | 4,375 | 3.375 | 3 | [
"MIT"
] | permissive | -- MySQL dump 10.13 Distrib 5.7.21, for Linux (x86_64)
--
-- Host: localhost Database: libproject
-- ------------------------------------------------------
-- Server version 5.7.21-0ubuntu0.16.04.1
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `BOOKS`
--
DROP TABLE IF EXISTS `BOOKS`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `BOOKS` (
`ISBN` int(10) NOT NULL,
`book_title` varchar(50) DEFAULT NULL,
`description` varchar(50) DEFAULT NULL,
`author` varchar(50) DEFAULT NULL,
`issue_date` date DEFAULT NULL,
`return_date` date DEFAULT NULL,
`status` varchar(50) DEFAULT NULL,
`read_id` int(10) DEFAULT NULL,
PRIMARY KEY (`ISBN`),
KEY `read_id` (`read_id`),
CONSTRAINT `BOOKS_ibfk_1` FOREIGN KEY (`read_id`) REFERENCES `READER` (`read_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `BOOKS`
--
LOCK TABLES `BOOKS` WRITE;
/*!40000 ALTER TABLE `BOOKS` DISABLE KEYS */;
INSERT INTO `BOOKS` VALUES (111111,'Hamlet','Literature','Shakespeare','2018-02-25','2018-03-17','issued',2),(121212,'Nemesis','Suspence','Agatha',NULL,NULL,'available',NULL),(141414,'Regeneration','History','Barker',NULL,NULL,'available',NULL),(151515,'Inheritence','Fantasy','Christopher',NULL,NULL,'available',NULL),(222222,'Macbeth','Literature','Shakespeare','2018-02-24','2018-03-16','issued',3),(333333,'Kim','Politics','Kipling','2018-02-05','2018-02-27','overdue',4);
/*!40000 ALTER TABLE `BOOKS` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `LOGIN`
--
DROP TABLE IF EXISTS `LOGIN`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `LOGIN` (
`id` int(10) NOT NULL,
`read_id` int(10) DEFAULT NULL,
`log_name` varchar(50) DEFAULT NULL,
`log_password` varchar(50) DEFAULT NULL,
`type` char(1) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `read_id` (`read_id`),
CONSTRAINT `LOGIN_ibfk_1` FOREIGN KEY (`read_id`) REFERENCES `READER` (`read_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `LOGIN`
--
LOCK TABLES `LOGIN` WRITE;
/*!40000 ALTER TABLE `LOGIN` DISABLE KEYS */;
INSERT INTO `LOGIN` VALUES (1,1,'beth','beth1234','R'),(2,2,'mike','mike1999','R'),(3,3,'david','david001','R'),(4,4,'rebecca','rebe123','R'),(21,NULL,'lisa','lisa123','L'),(22,NULL,'joe','joe999','L');
/*!40000 ALTER TABLE `LOGIN` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `READER`
--
DROP TABLE IF EXISTS `READER`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `READER` (
`read_id` int(10) NOT NULL,
`reader_name` varchar(50) DEFAULT NULL,
`reg_date` date NOT NULL,
PRIMARY KEY (`read_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `READER`
--
LOCK TABLES `READER` WRITE;
/*!40000 ALTER TABLE `READER` DISABLE KEYS */;
INSERT INTO `READER` VALUES (1,'beth','2018-02-25'),(2,'mike','2017-05-09'),(3,'david','2017-01-24'),(4,'rebecca','2016-09-05');
/*!40000 ALTER TABLE `READER` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2018-03-01 20:39:06
| true |
83b6e458e269d64c048d10de7c403fe7b1e6428b | SQL | Nokias34/node-auth-jwt-3 | /testdb2.sql | UTF-8 | 6,229 | 3.21875 | 3 | [] | no_license | -- MySQL dump 10.13 Distrib 5.7.30, for Linux (x86_64)
--
-- Host: localhost Database: testdb2
-- ------------------------------------------------------
-- Server version 5.7.30-0ubuntu0.18.04.1
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `articles`
--
DROP TABLE IF EXISTS `articles`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `articles` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`title` varchar(255) DEFAULT NULL,
`description` varchar(255) DEFAULT NULL,
`published` tinyint(1) DEFAULT NULL,
`createdAt` datetime NOT NULL,
`updatedAt` datetime NOT NULL,
`userId` int(11) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `userId` (`userId`),
CONSTRAINT `articles_ibfk_1` FOREIGN KEY (`userId`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `articles`
--
LOCK TABLES `articles` WRITE;
/*!40000 ALTER TABLE `articles` DISABLE KEYS */;
INSERT INTO `articles` VALUES (1,'irfan91 test','irfan91 test',1,'2020-06-22 08:59:22','2020-06-22 08:59:59',1),(2,'irfan91 test 2','irfan91 test 2',1,'2020-06-22 08:59:45','2020-06-22 09:00:07',1),(3,'irfan92 test','irfan92 test',0,'2020-06-22 09:00:58','2020-06-22 09:00:58',2),(4,'irfan92 test 2','irfan92 test 2',0,'2020-06-22 09:01:18','2020-06-22 09:01:18',2),(5,'irfan92 test 3','irfan92 test 3',1,'2020-06-22 09:01:33','2020-06-22 09:01:41',2),(6,'sa','tets',0,'2020-06-23 13:10:43','2020-06-23 13:10:43',1);
/*!40000 ALTER TABLE `articles` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `images`
--
DROP TABLE IF EXISTS `images`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `images` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`type` varchar(255) DEFAULT NULL,
`name` varchar(255) DEFAULT NULL,
`createdAt` datetime NOT NULL,
`updatedAt` datetime NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `images`
--
LOCK TABLES `images` WRITE;
/*!40000 ALTER TABLE `images` DISABLE KEYS */;
/*!40000 ALTER TABLE `images` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `roles`
--
DROP TABLE IF EXISTS `roles`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `roles` (
`id` int(11) NOT NULL,
`name` varchar(255) DEFAULT NULL,
`createdAt` datetime NOT NULL,
`updatedAt` datetime NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `roles`
--
LOCK TABLES `roles` WRITE;
/*!40000 ALTER TABLE `roles` DISABLE KEYS */;
INSERT INTO `roles` VALUES (1,'user','2020-06-22 08:51:59','2020-06-22 08:51:59'),(2,'moderator','2020-06-22 08:51:59','2020-06-22 08:51:59'),(3,'admin','2020-06-22 08:51:59','2020-06-22 08:51:59');
/*!40000 ALTER TABLE `roles` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `user_roles`
--
DROP TABLE IF EXISTS `user_roles`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `user_roles` (
`createdAt` datetime NOT NULL,
`updatedAt` datetime NOT NULL,
`roleId` int(11) NOT NULL,
`userId` int(11) NOT NULL,
PRIMARY KEY (`roleId`,`userId`),
KEY `userId` (`userId`),
CONSTRAINT `user_roles_ibfk_1` FOREIGN KEY (`roleId`) REFERENCES `roles` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `user_roles_ibfk_2` FOREIGN KEY (`userId`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `user_roles`
--
LOCK TABLES `user_roles` WRITE;
/*!40000 ALTER TABLE `user_roles` DISABLE KEYS */;
INSERT INTO `user_roles` VALUES ('2020-06-22 08:57:55','2020-06-22 08:57:55',1,1),('2020-06-22 08:58:48','2020-06-22 08:58:48',1,2);
/*!40000 ALTER TABLE `user_roles` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `users`
--
DROP TABLE IF EXISTS `users`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `users` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`username` varchar(255) DEFAULT NULL,
`email` varchar(255) DEFAULT NULL,
`password` varchar(255) DEFAULT NULL,
`createdAt` datetime NOT NULL,
`updatedAt` datetime NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `users`
--
LOCK TABLES `users` WRITE;
/*!40000 ALTER TABLE `users` DISABLE KEYS */;
INSERT INTO `users` VALUES (1,'irfan91','irfan91@gmail.com','$2a$08$N04G0WzJZl9.v5dDI1SSQ.LTPPFGCHx0CnPTGlfFeLHIxgLq9.vGi','2020-06-22 08:57:54','2020-06-22 08:57:54'),(2,'irfan92','irfan92@gmail.com','$2a$08$.JyLCNBzc9tW/6PBrvvzVe59v8Csh31EeusU9rokpzpr6rRj.vBty','2020-06-22 08:58:48','2020-06-22 08:58:48');
/*!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-06-24 20:29:27
| true |
0c44955749f488028182f573eeb09a2b3b7de6a0 | SQL | twickatwk/codingchallenges | /Leetcode/SQL/getSecondHighestSalary.sql | UTF-8 | 185 | 3.515625 | 4 | [] | no_license |
-- this query will return the second highest salary from the employee table
select max(salary) as "SecondHighestSalary"
from employee
where salary < (select max(salary) from employee) | true |
be387adbe1810e6aee09d04d9657ba1497e61761 | SQL | manickaa/cs340-Final-Project | /queries/DML.sql | UTF-8 | 16,594 | 4.03125 | 4 | [
"BSD-3-Clause"
] | permissive | -- Name: GROUP-25 Aishwarya Manicka Ravichandran and Amy Robertson
-- Description: Data Manipulation queries for tourism database
----------------------------------------
--------- Queries for Customer ---------
-----------------------------------------
--
-- SELECT query for `customers` display
--
SELECT customers.customer_ID as customer_ID, customers.first_name as first_name, customers.middle_name as middle_name,
customers.last_name as last_name,customers.street_no as street_no,
customers.city as city, customers.state as state, customers.country as country,
customers.postal_code as postal_code, customers.phone_number as phone_number,
customers.email_id as email_id, customers.passport_number as passport_number,
customers.passport_countryofissue as passport_countryofissue
FROM customers
GROUP BY customers.customer_ID
ORDER BY customers.customer_ID;
--
-- SELECT query for 'email_id' in dropdown
--
SELECT customer_ID, email_id FROM customers ORDER BY customer_ID;
--
-- SELECT query for inserting the available info to update customer
--
SELECT customer_ID as customer_ID,first_name as first_name,
last_name as last_name, street_no as street_no, city as city,
state as state, country as country, postal_code as postal_code,
phone_number as phone_number,
email_id as email_id
FROM customers WHERE customer_ID = :customer_IDInput;
--
-- SELECT query for filtering the customer based on email_id
--
SELECT customers.customer_ID as customer_ID, customers.first_name as first_name,
customers.middle_name as middle_name, customers.last_name as last_name,
customers.street_no as street_no, customers.city as city,
customers.state as state, customers.country as country,
customers.postal_code as postal_code, customers.phone_number as phone_number,
customers.email_id as email_id, customers.passport_number as passport_number,
customers.passport_countryofissue as passport_countryofissue
FROM customers
WHERE customers.customer_ID = :customer_IDInput;
--
-- Add new customer
--
INSERT INTO customer (first_name, last_name, middle_name, street_no, city, state, country, postal_code,
phone_number, email_id, passport_number, passport_countryofissue, passport_expirydate)
VALUES (:fnameInput, :lnameInput, :mname_Input, street_Input, country_Input, postal_codeInput,
phone_numberInput, email_idInput, passport_numberInput, passport_countryofissueInput, passport_expirydateInput);
--
-- Update Customer
--
UPDATE customers
SET first_name = :first_nameInput, last_name = :last_nameInput, street = :streetInput,
city = :cityInput, state = :stateInput, country = :countryInput, postal_code=:postal_codeInput, phone_number = :phone_numberInput,
email_id = :email_idInput
WHERE customer_ID = :corresponding_ID_in_td;
----------------------------------------
--------- Queries for Booking ----------
-----------------------------------------
--
-- SELECT query for `bookings` display
--
SELECT bookings.booking_ID as booking_ID,
DATE_FORMAT(bookings.booking_date, '%m/%d/%Y') as booking_date,
DATE_FORMAT(bookings.departure_date, '%m/%d/%Y') as departure_date,
DATE_FORMAT(bookings.arrival_date, '%m/%d/%Y') as arrival_date,
bookings.number_adults as number_adults,
bookings.number_children as number_children,
bookings.travelLocation_ID as travelLocation_ID,
bookings.customer_ID as customer_ID
FROM bookings
LEFT JOIN travel_location ON bookings.travelLocation_ID = travel_location.travelLocation_ID
LEFT JOIN customers ON bookings.customer_ID = customers.customer_ID
GROUP BY bookings.booking_ID
ORDER BY bookings.booking_ID;
--
-- SELECT query for customer name in dropdown
--
SELECT customer_ID, CONCAT(first_name, ' ', last_name) AS customer_name
FROM customers ORDER BY customer_ID;
--
-- SELECT query to display the bookings in the table filtered based on the customer name
--
SELECT bookings.booking_ID as booking_ID,
DATE_FORMAT(bookings.booking_date, '%m/%d/%Y') as booking_date,
DATE_FORMAT(bookings.departure_date, '%m/%d/%Y') as departure_date,
DATE_FORMAT(bookings.arrival_date, '%m/%d/%Y') as arrival_date,
bookings.number_adults as number_adults,
bookings.number_children as number_children,
bookings.travelLocation_ID as travelLocation_ID,
bookings.customer_ID as customer_ID
FROM bookings
LEFT JOIN travel_location ON bookings.travelLocation_ID = travel_location.travelLocation_ID
LEFT JOIN customers ON bookings.customer_ID = customers.customer_ID
WHERE customers.customer_ID = :customer_IDInput
GROUP BY bookings.booking_ID
ORDER BY bookings.booking_ID
--
-- SELECT query to get city names in dropdown
--
SELECT travelLocation_ID, city FROM travel_location
ORDER BY travelLocation_ID;
--
-- Add new booking
--
INSERT INTO bookings(customer_ID, travelLocation_ID, departure_date, arrival_date, number_adults, number_children)
VALUES(:customer_IDInput, :travel_locationInput, :departure_dateInput, :arrival_dateInput, :number_adultsInput, :number_childrenInput);
--
-- Delete booking
--
DELETE FROM booking WHERE booking_ID = :corresponding_ID_in_td;
--------------------------------------------
--------- Queries for Travel Location -------
---------------------------------------------
--
-- SELECT query for `travel_location` display
--
SELECT travel_location.travelLocation_ID AS location_ID, travel_location.city AS city, travel_location.country as country,
FORMAT(travel_location.amount_perAdult, 2) AS price_adult, FORMAT(travel_location.amount_perChild,2) AS price_child,
COUNT(bookings.booking_ID) AS count_bookings, COUNT(tour_guide.tourGuide_ID) AS count_guides,
SUM(number_adults) + SUM(number_children) AS adults_kids,
ROUND(AVG(ratings.rating),2) AS ave_review
FROM travel_location
LEFT JOIN bookings ON travel_location.travelLocation_ID = bookings.travelLocation_ID
LEFT JOIN assignment ON bookings.booking_ID = assignment.booking_ID
LEFT JOIN tour_guide ON assignment.tourGuide_ID = tour_guide.tourGuide_ID
LEFT JOIN ratings ON travel_location.travelLocation_ID = ratings.travelLocation_ID
GROUP BY travel_location.travelLocation_ID
ORDER BY travel_location.travelLocation_ID;
-- Display all options (search with selected city/country)
SELECT travel_location.travelLocation_ID AS location_ID, travel_location.city AS city, travel_location.country as country,
FORMAT(travel_location.amount_perAdult, 2) AS price_adult, FORMAT(travel_location.amount_perChild,2) AS price_child,
COUNT(bookings.booking_ID) AS count_bookings, COUNT(tour_guide.tourGuide_ID) AS count_guides,
SUM(number_adults) + SUM(number_children) AS adults_kids,
ROUND(AVG(ratings.rating),2) AS ave_review
FROM travel_location
LEFT JOIN bookings ON travel_location.travelLocation_ID = bookings.travelLocation_ID
LEFT JOIN assignment ON bookings.booking_ID = assignment.booking_ID
LEFT JOIN tour_guide ON assignment.tourGuide_ID = tour_guide.tourGuide_ID
LEFT JOIN ratings ON travel_location.travelLocation_ID = ratings.travelLocation_ID
WHERE travel_location.city = :city_input AND travel_location.country = :county_input
GROUP BY travel_location.travelLocation_ID
ORDER BY travel_location.travelLocation_ID;
--Add & display new Travel Location data based on form submission
INSERT INTO travel_location (city, country) VALUES (:city_input, :country_input);
--
-- Update query for travel_location
--
UPDATE travel_location SET amount_perAdult=:amount_perAdultInput, amount_perChild=:amount_perChildInput WHERE travelLocation_ID=:travel_locationIDInput
--
-- query for locations in dropdown
--
SELECT travel_location.travelLocation_ID as location_ID,
CONCAT(travel_location.city, ', ', travel_location.country) AS location_name
FROM travel_location;
----------------------------------------
--------- Queries for Tour guide -------
-----------------------------------------
--
-- SELECT query for `tour_guide` display
--
SELECT tour_guide.tourGuide_ID as guide_ID, tour_guide.first_Name as first_name, tour_guide.last_Name as last_name,
COUNT(assignment.tourGuide_travelLocation) AS count_assignments,
COUNT(travel_location.travelLocation_ID) AS count_locations
FROM tour_guide
LEFT JOIN assignment ON tour_guide.tourGuide_ID = assignment.tourGuide_ID
LEFT JOIN travel_location ON assignment.travelLocation_ID = travel_location.travelLocation_ID
GROUP BY tour_guide.tourGuide_ID
ORDER BY tour_guide.tourGuide_ID;
--
-- SELECT query for gettin guide first and last name to populate update form
--
SELECT tourGUide_ID AS guide_ID, first_Name AS first_name, last_Name AS last_name FROM tour_guide WHERE tourGuide_ID = :tour_guideID_input;
--
-- SELECT query that searches for guides with first name similar to user input
--
SELECT tour_guide.tourGuide_ID as guide_ID, tour_guide.first_Name as first_name, tour_guide.last_Name as last_name,
COUNT(assignment.tourGuide_travelLocation) AS count_assignments,
COUNT(travel_location.travelLocation_ID) AS count_locations
FROM tour_guide
LEFT JOIN assignment ON tour_guide.tourGuide_ID = assignment.tourGuide_ID
LEFT JOIN travel_location ON assignment.travelLocation_ID = travel_location.travelLocation_ID
WHERE tour_guide.first_Name LIKE mysql.pool.escape(req.params.s + '%');
--
-- Update query for tour guide
--
UPDATE tour_guide SET first_Name=:first_nameInput, last_Name=:last_nameInput WHERE tourGuide_ID=:tour_guideID_input;
--
-- Insert query for tour guide
--
INSERT INTO tour_guide(first_name, last_name) VALUES(:first_nameInput,:last_nameInput);
--
-- Delete query for tour guide
--
DELETE FROM tour_guide WHERE tourGuide_ID = :tour_guideID_input;
----------------------------------------
--------- Queries for Assignments -------
-----------------------------------------
--
-- SELECT queries for assignment display
--
SELECT assignment.tourGuide_travelLocation AS assignment_ID, assignment.booking_ID AS booking_ID,
CONCAT(tour_guide.first_name, ' ', tour_guide.last_name) AS guide,
CONCAT(travel_location.city, ', ', travel_location.country) AS destination,
CONCAT(customers.first_name, ' ', customers.last_name) AS customer,
DATE_FORMAT(bookings.departure_date, '%m/%d/%Y') AS departure_date,
DATE_FORMAT(bookings.arrival_date, '%m/%d/%Y') AS arrival_date,
SUM(bookings.number_adults) AS count_adults,
SUM(bookings.number_children) AS count_kids
FROM assignment
LEFT JOIN tour_guide ON assignment.tourGuide_ID = tour_guide.tourGuide_ID
LEFT JOIN travel_location ON assignment.travelLocation_ID = travel_location.travelLocation_ID
LEFT JOIN bookings ON assignment.booking_ID = bookings.booking_ID
LEFT JOIN customers ON bookings.customer_ID = customers.customer_ID
GROUP BY assignment.tourGuide_travelLocation
ORDER BY assignment.tourGuide_travelLocation
--
--SELECT query that gets guide names & display in dropdown
--
SELECT tour_guide.tourGuide_ID as guide_ID, CONCAT(tour_guide.first_name, ' ', tour_guide.last_name) as guide_full_name
FROM tour_guide ORDER BY guide_full_name;
--
-- SELECT query that gets locations in dropdown
--
SELECT travel_location.travelLocation_ID as location_ID,
CONCAT(travel_location.city, ', ', travel_location.country) AS location_name
FROM travel_location;
--
-- SELECT query that gets the assignment information for update
--
SELECT assignment.tourGuide_travelLocation AS assignment_ID, assignment.booking_ID as booking_ID,
assignment.tourGuide_ID as guide_ID FROM assignment WHERE tourGuide_travelLocation = :assignment_IDInput;
--
-- SELECT query that gets bookingID that has not been assigned yet
--
SELECT bookings.booking_ID FROM bookings WHERE bookings.booking_ID
NOT IN (SELECT assignment.booking_ID FROM assignment)
ORDER BY bookings.booking_ID;
--
-- INSERT query for assignment
--
INSERT INTO assignment (booking_ID, travelLocation_ID, tourGuide_ID)
VALUES(:booking_IDInput, (SELECT bookings.travelLocation_ID FROM bookings WHERE booking_ID=:booking_IDInput),:tour_guideID_input);
--
-- DELETE query for assignment
--
DELETE FROM assignment WHERE tourGuide_travelLocation = :assignment_IDInput;
--
-- UPDATE query for assignment
--
UPDATE assignment
SET booking_ID=:booking_IDInput, tourGuide_ID=IF(:tour_guideID_input='NULL', NULL,:tour_guideID_input),
travelLocation_ID=(SELECT bookings.travelLocation_ID FROM bookings WHERE booking_ID=:booking_IDInput)
WHERE tourGuide_travelLocation=:assignment_IDInput
----------------------------------------
--------- Queries for Payment ----------
-----------------------------------------
--
-- SELECT to display payment table
--
SELECT payment.payment_ID, payment.booking_ID, payment.payment_amount,
DATE_FORMAT(payment.payment_date, '%m/%d/%Y') as payment_date,
payment.payment_description
FROM payment
LEFT JOIN bookings ON payment.booking_ID = bookings.booking_ID
GROUP BY payment.payment_ID;
--
-- SELECT to display booking ID on dropdown
--
SELECT payment.booking_ID AS booking_ID
FROM payment
ORDER BY payment.booking_ID;
--
-- SELECT to display the payment in the table on filter based on booking
--
SELECT payment.payment_ID, payment.booking_ID, payment.payment_amount,
DATE_FORMAT(payment.payment_date, '%m/%d/%Y') as payment_date,
payment.payment_description
FROM payment
LEFT JOIN bookings ON payment.booking_ID = bookings.booking_ID
WHERE payment.booking_ID = :booking_IDInput
GROUP BY payment.payment_ID ORDER BY payment.payment_ID;
--
-- SELECT to get booking ID that has not been paid yet on the dropdown
--
SELECT bookings.booking_ID FROM bookings WHERE bookings.booking_ID
NOT IN (SELECT payment.booking_ID FROM payment)
ORDER BY bookings.booking_ID;
--
-- DELETE query for payment
--
DELETE FROM payment WHERE payment_ID = :payment_IDInput;
--
-- INSERT query for payment
--
INSERT INTO payment(booking_ID, payment_amount, payment_date,payment_description)
VALUES(:booking_IDInput, (SELECT (((t.amount_perAdult*b.number_adults)+ (t.amount_perChild*b.number_children)) *
(DATEDIFF(b.arrival_date, b.departure_date))) AS payment_amount FROM bookings b
INNER JOIN travel_location t ON b.travelLocation_ID = t.travelLocation_ID
WHERE booking_ID = :booking_IDInput), :payment_dateInput,:payment_descriptionInput);
---------------------------------------
--------- Queries for Rating ----------
---------------------------------------
--
-- SELECT query for `ratings` display
--
SELECT ratings.rating_ID, ratings.travelLocation_ID,
travel_location.city,
ratings.customer_ID,
CONCAT(customers.first_name, ' ', customers.last_name) AS customer_name,
ratings.rating, ratings.review
FROM ratings
LEFT JOIN travel_location ON ratings.travelLocation_ID = travel_location.travelLocation_ID
LEFT JOIN customers ON ratings.customer_ID = customers.customer_ID
GROUP BY ratings.rating_ID
ORDER BY ratings.rating_ID;
--
-- SELECT query to filter ratings table using rating
--
SELECT ratings.rating_ID, ratings.travelLocation_ID,
travel_location.city,
ratings.customer_ID,
CONCAT(customers.first_name, ' ', customers.last_name) AS customer_name,
ratings.rating, ratings.review
FROM ratings
LEFT JOIN travel_location ON ratings.travelLocation_ID = travel_location.travelLocation_ID
LEFT JOIN customers ON ratings.customer_ID = customers.customer_ID
WHERE ratings.rating = :ratingInput
GROUP BY ratings.rating_ID
ORDER BY ratings.rating_ID;
--
-- SELECT query to get customer name in dropdown
--
SELECT customer_ID, CONCAT(first_name, ' ', last_name) AS customer_name
FROM customers ORDER BY customer_ID;
--
-- SELECT query to get city name in dropdown
--
SELECT travelLocation_ID, city FROM travel_location ORDER BY travelLocation_ID;
--
-- Add new Rating
--
INSERT INTO ratings(customer_ID, travelLocation_ID, rating, review)
VALUES(:customer_IDInput, :travel_locationInput,
:ratingInput, :reviewInput);
| true |
2c1460243f26dfc9353cafeca894fbced2ac467e | SQL | Easy-Dojo/Java-Backend-Template | /src/main/resources/db/migration/V1__product.sql | UTF-8 | 408 | 2.890625 | 3 | [] | no_license | CREATE TABLE PRODUCT
(
ID VARCHAR(32) NOT NULL,
NAME VARCHAR(50) NOT NULL,
PRICE DECIMAL NOT NULL,
DESCRIPTION VARCHAR(100) DEFAULT NULL,
CREATED_AT TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
UPDATE_AT TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (ID)
) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
| true |
9229107ed13cb52f785fca629540e49e67d36576 | SQL | mikerodionov/ps-scripts | /SQL/SQL/DmvConnectionSessionInfo.sql | UTF-8 | 770 | 3.609375 | 4 | [
"MIT"
] | permissive | -- More details: http://buildingbettersoftware.blogspot.ru/2016/04/using-dmvs-to-find-sql-server.html
-- Requires SQL Server 2012 or newer
SELECT
database_id,
session_id,
status,
login_time,
cpu_time,
memory_usage,
reads,
writes,
logical_reads,
host_name,
program_name,
host_process_id,
client_interface_name,
login_name as database_login_name,
last_request_start_time
FROM sys.dm_exec_sessions
WHERE is_user_process = 1
ORDER BY cpu_time DESC;
-- Query below groups information by login and cleint process
SELECT
login_name,
host_name,
host_process_id,
COUNT(1) As LoginCount
FROM sys.dm_exec_sessions
WHERE is_user_process = 1
GROUP BY
login_name,
host_name,
host_process_id;
| true |
5242ae49258aaaba9ed5855624e11da7aa331eef | SQL | chaksaray/rdb | /asvawat.sql | UTF-8 | 26,879 | 3.109375 | 3 | [
"MIT"
] | permissive | -- --------------------------------------------------------
-- Host: 127.0.0.1
-- Server version: 5.6.38 - MySQL Community Server (GPL)
-- Server OS: Linux
-- HeidiSQL Version: 10.3.0.5771
-- --------------------------------------------------------
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET NAMES utf8 */;
/*!50503 SET NAMES utf8mb4 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
-- Dumping database structure for asvawat
DROP DATABASE IF EXISTS `asvawat`;
CREATE DATABASE IF NOT EXISTS `asvawat` /*!40100 DEFAULT CHARACTER SET utf8 */;
USE `asvawat`;
-- Dumping structure for table asvawat.account_types
DROP TABLE IF EXISTS `account_types`;
CREATE TABLE IF NOT EXISTS `account_types` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`status_id` bigint(20) unsigned NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `account_types_status_id_foreign` (`status_id`),
CONSTRAINT `account_types_status_id_foreign` FOREIGN KEY (`status_id`) REFERENCES `statuses` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- Data exporting was unselected.
-- Dumping structure for table asvawat.articles
DROP TABLE IF EXISTS `articles`;
CREATE TABLE IF NOT EXISTS `articles` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`user_id` bigint(20) unsigned NOT NULL,
`status_id` bigint(20) unsigned NOT NULL,
`category_id` bigint(20) unsigned NOT NULL,
`article_status_id` bigint(20) unsigned NOT NULL,
`report_article_type_id` bigint(20) unsigned NOT NULL,
`title` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`body` text COLLATE utf8mb4_unicode_ci NOT NULL,
`feature_image` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`page_id` int(11) DEFAULT NULL,
`tags` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`read_time` int(11) NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- Data exporting was unselected.
-- Dumping structure for table asvawat.article_statuses
DROP TABLE IF EXISTS `article_statuses`;
CREATE TABLE IF NOT EXISTS `article_statuses` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`status_id` bigint(20) unsigned NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `article_statuses_status_id_foreign` (`status_id`),
CONSTRAINT `article_statuses_status_id_foreign` FOREIGN KEY (`status_id`) REFERENCES `statuses` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- Data exporting was unselected.
-- Dumping structure for table asvawat.back_users
DROP TABLE IF EXISTS `back_users`;
CREATE TABLE IF NOT EXISTS `back_users` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`back_user_role_id` bigint(20) unsigned NOT NULL,
`status_id` bigint(20) unsigned NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `back_users_back_user_role_id_foreign` (`back_user_role_id`),
KEY `back_users_status_id_foreign` (`status_id`),
CONSTRAINT `back_users_back_user_role_id_foreign` FOREIGN KEY (`back_user_role_id`) REFERENCES `back_user_roles` (`id`),
CONSTRAINT `back_users_status_id_foreign` FOREIGN KEY (`status_id`) REFERENCES `statuses` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- Data exporting was unselected.
-- Dumping structure for table asvawat.back_user_roles
DROP TABLE IF EXISTS `back_user_roles`;
CREATE TABLE IF NOT EXISTS `back_user_roles` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`status_id` bigint(20) unsigned NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `back_user_roles_status_id_foreign` (`status_id`),
CONSTRAINT `back_user_roles_status_id_foreign` FOREIGN KEY (`status_id`) REFERENCES `statuses` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- Data exporting was unselected.
-- Dumping structure for table asvawat.categories
DROP TABLE IF EXISTS `categories`;
CREATE TABLE IF NOT EXISTS `categories` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`status_id` bigint(20) unsigned NOT NULL,
`title` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`description` text COLLATE utf8mb4_unicode_ci NOT NULL,
`image` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`icon` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- Data exporting was unselected.
-- Dumping structure for table asvawat.comments
DROP TABLE IF EXISTS `comments`;
CREATE TABLE IF NOT EXISTS `comments` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`article_id` bigint(20) unsigned NOT NULL,
`user_id` bigint(20) unsigned NOT NULL,
`text` text COLLATE utf8mb4_unicode_ci NOT NULL,
`parent_id` int(11) DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `comments_article_id_foreign` (`article_id`),
KEY `comments_user_id_foreign` (`user_id`),
CONSTRAINT `comments_article_id_foreign` FOREIGN KEY (`article_id`) REFERENCES `articles` (`id`),
CONSTRAINT `comments_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- Data exporting was unselected.
-- Dumping structure for table asvawat.companies
DROP TABLE IF EXISTS `companies`;
CREATE TABLE IF NOT EXISTS `companies` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- Data exporting was unselected.
-- Dumping structure for table asvawat.failed_jobs
DROP TABLE IF EXISTS `failed_jobs`;
CREATE TABLE IF NOT EXISTS `failed_jobs` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`uuid` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`connection` text COLLATE utf8mb4_unicode_ci NOT NULL,
`queue` text COLLATE utf8mb4_unicode_ci NOT NULL,
`payload` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
`exception` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
`failed_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `failed_jobs_uuid_unique` (`uuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- Data exporting was unselected.
-- Dumping structure for table asvawat.feature_posts
DROP TABLE IF EXISTS `feature_posts`;
CREATE TABLE IF NOT EXISTS `feature_posts` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`artilce_id` int(11) NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- Data exporting was unselected.
-- Dumping structure for table asvawat.follow_authors
DROP TABLE IF EXISTS `follow_authors`;
CREATE TABLE IF NOT EXISTS `follow_authors` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`follower_id` bigint(20) unsigned NOT NULL,
`author_id` bigint(20) unsigned NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `follow_authors_follower_id_foreign` (`follower_id`),
KEY `follow_authors_author_id_foreign` (`author_id`),
CONSTRAINT `follow_authors_author_id_foreign` FOREIGN KEY (`author_id`) REFERENCES `users` (`id`),
CONSTRAINT `follow_authors_follower_id_foreign` FOREIGN KEY (`follower_id`) REFERENCES `users` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- Data exporting was unselected.
-- Dumping structure for table asvawat.follow_topics
DROP TABLE IF EXISTS `follow_topics`;
CREATE TABLE IF NOT EXISTS `follow_topics` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`user_id` bigint(20) unsigned NOT NULL,
`toptic_id` bigint(20) unsigned NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- Data exporting was unselected.
-- Dumping structure for table asvawat.forgot_passwords
DROP TABLE IF EXISTS `forgot_passwords`;
CREATE TABLE IF NOT EXISTS `forgot_passwords` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- Data exporting was unselected.
-- Dumping structure for table asvawat.freq_ask_questions
DROP TABLE IF EXISTS `freq_ask_questions`;
CREATE TABLE IF NOT EXISTS `freq_ask_questions` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`question` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`answer` text COLLATE utf8mb4_unicode_ci NOT NULL,
`status_id` bigint(20) unsigned NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- Data exporting was unselected.
-- Dumping structure for table asvawat.genders
DROP TABLE IF EXISTS `genders`;
CREATE TABLE IF NOT EXISTS `genders` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`title` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`description` text COLLATE utf8mb4_unicode_ci NOT NULL,
`status_id` bigint(20) unsigned NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- Data exporting was unselected.
-- Dumping structure for table asvawat.likes
DROP TABLE IF EXISTS `likes`;
CREATE TABLE IF NOT EXISTS `likes` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`article_id` bigint(20) unsigned NOT NULL,
`user_id` bigint(20) unsigned NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `likes_article_id_foreign` (`article_id`),
KEY `likes_user_id_foreign` (`user_id`),
CONSTRAINT `likes_article_id_foreign` FOREIGN KEY (`article_id`) REFERENCES `articles` (`id`),
CONSTRAINT `likes_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- Data exporting was unselected.
-- Dumping structure for table asvawat.login_histories
DROP TABLE IF EXISTS `login_histories`;
CREATE TABLE IF NOT EXISTS `login_histories` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`user_id` bigint(20) unsigned NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- Data exporting was unselected.
-- Dumping structure for table asvawat.logout_histories
DROP TABLE IF EXISTS `logout_histories`;
CREATE TABLE IF NOT EXISTS `logout_histories` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`user_id` bigint(20) unsigned NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- Data exporting was unselected.
-- Dumping structure for table asvawat.migrations
DROP TABLE IF EXISTS `migrations`;
CREATE TABLE IF NOT EXISTS `migrations` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`migration` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`batch` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=53 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- Data exporting was unselected.
-- Dumping structure for table asvawat.news_letter_types
DROP TABLE IF EXISTS `news_letter_types`;
CREATE TABLE IF NOT EXISTS `news_letter_types` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`description` text COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- Data exporting was unselected.
-- Dumping structure for table asvawat.news_letter_type_user
DROP TABLE IF EXISTS `news_letter_type_user`;
CREATE TABLE IF NOT EXISTS `news_letter_type_user` (
`user_id` bigint(20) unsigned NOT NULL,
`news_letter_type_id` bigint(20) unsigned NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- Data exporting was unselected.
-- Dumping structure for table asvawat.notification_types
DROP TABLE IF EXISTS `notification_types`;
CREATE TABLE IF NOT EXISTS `notification_types` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`follower_id` int(11) NOT NULL,
`status_id` bigint(20) unsigned NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- Data exporting was unselected.
-- Dumping structure for table asvawat.notification_type_user
DROP TABLE IF EXISTS `notification_type_user`;
CREATE TABLE IF NOT EXISTS `notification_type_user` (
`user_id` bigint(20) unsigned NOT NULL,
`notification_type_id` bigint(20) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- Data exporting was unselected.
-- Dumping structure for table asvawat.pages
DROP TABLE IF EXISTS `pages`;
CREATE TABLE IF NOT EXISTS `pages` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`description` text COLLATE utf8mb4_unicode_ci,
`website` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`profile` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`cover` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`user_name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_by` int(11) NOT NULL,
`category_id` bigint(20) unsigned NOT NULL,
`status_id` int(11) NOT NULL,
`custom_url` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`phone` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`email` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `pages_category_id_foreign` (`category_id`),
CONSTRAINT `pages_category_id_foreign` FOREIGN KEY (`category_id`) REFERENCES `categories` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- Data exporting was unselected.
-- Dumping structure for table asvawat.page_roles
DROP TABLE IF EXISTS `page_roles`;
CREATE TABLE IF NOT EXISTS `page_roles` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`title` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`description` text COLLATE utf8mb4_unicode_ci NOT NULL,
`status_id` bigint(20) unsigned NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- Data exporting was unselected.
-- Dumping structure for table asvawat.page_users
DROP TABLE IF EXISTS `page_users`;
CREATE TABLE IF NOT EXISTS `page_users` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`user_id` bigint(20) unsigned NOT NULL,
`page_id` bigint(20) unsigned NOT NULL,
`page_role_id` bigint(20) unsigned NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `page_users_user_id_foreign` (`user_id`),
KEY `page_users_page_id_foreign` (`page_id`),
KEY `page_users_page_role_id_foreign` (`page_role_id`),
CONSTRAINT `page_users_page_id_foreign` FOREIGN KEY (`page_id`) REFERENCES `pages` (`id`),
CONSTRAINT `page_users_page_role_id_foreign` FOREIGN KEY (`page_role_id`) REFERENCES `page_roles` (`id`),
CONSTRAINT `page_users_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- Data exporting was unselected.
-- Dumping structure for table asvawat.password_resets
DROP TABLE IF EXISTS `password_resets`;
CREATE TABLE IF NOT EXISTS `password_resets` (
`email` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`token` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
KEY `password_resets_email_index` (`email`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- Data exporting was unselected.
-- Dumping structure for table asvawat.payment_methods
DROP TABLE IF EXISTS `payment_methods`;
CREATE TABLE IF NOT EXISTS `payment_methods` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`icon` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`description` text COLLATE utf8mb4_unicode_ci NOT NULL,
`status_id` bigint(20) unsigned NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- Data exporting was unselected.
-- Dumping structure for table asvawat.payment_method_user
DROP TABLE IF EXISTS `payment_method_user`;
CREATE TABLE IF NOT EXISTS `payment_method_user` (
`user_id` bigint(20) unsigned NOT NULL,
`payment_method_id` bigint(20) unsigned NOT NULL,
KEY `payment_method_user_user_id_foreign` (`user_id`),
KEY `payment_method_user_payment_method_id_foreign` (`payment_method_id`),
CONSTRAINT `payment_method_user_payment_method_id_foreign` FOREIGN KEY (`payment_method_id`) REFERENCES `payment_methods` (`id`),
CONSTRAINT `payment_method_user_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- Data exporting was unselected.
-- Dumping structure for table asvawat.register_users
DROP TABLE IF EXISTS `register_users`;
CREATE TABLE IF NOT EXISTS `register_users` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- Data exporting was unselected.
-- Dumping structure for table asvawat.report_article_types
DROP TABLE IF EXISTS `report_article_types`;
CREATE TABLE IF NOT EXISTS `report_article_types` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`status_id` bigint(20) unsigned NOT NULL,
`title` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`description` text COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- Data exporting was unselected.
-- Dumping structure for table asvawat.report_user_types
DROP TABLE IF EXISTS `report_user_types`;
CREATE TABLE IF NOT EXISTS `report_user_types` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`status_id` bigint(20) unsigned NOT NULL,
`title` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`description` text COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- Data exporting was unselected.
-- Dumping structure for table asvawat.saves
DROP TABLE IF EXISTS `saves`;
CREATE TABLE IF NOT EXISTS `saves` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`article_id` bigint(20) unsigned NOT NULL,
`user_id` bigint(20) unsigned NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- Data exporting was unselected.
-- Dumping structure for table asvawat.searches
DROP TABLE IF EXISTS `searches`;
CREATE TABLE IF NOT EXISTS `searches` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`keyword` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`is_found` tinyint(1) NOT NULL,
`user_id` int(11) DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- Data exporting was unselected.
-- Dumping structure for table asvawat.shares
DROP TABLE IF EXISTS `shares`;
CREATE TABLE IF NOT EXISTS `shares` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`article_id` bigint(20) unsigned NOT NULL,
`user_id` bigint(20) unsigned NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `shares_article_id_foreign` (`article_id`),
KEY `shares_user_id_foreign` (`user_id`),
CONSTRAINT `shares_article_id_foreign` FOREIGN KEY (`article_id`) REFERENCES `articles` (`id`),
CONSTRAINT `shares_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- Data exporting was unselected.
-- Dumping structure for table asvawat.statuses
DROP TABLE IF EXISTS `statuses`;
CREATE TABLE IF NOT EXISTS `statuses` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`description` text COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- Data exporting was unselected.
-- Dumping structure for table asvawat.tags
DROP TABLE IF EXISTS `tags`;
CREATE TABLE IF NOT EXISTS `tags` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`toptic_id` bigint(20) unsigned NOT NULL,
`title` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`description` text COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- Data exporting was unselected.
-- Dumping structure for table asvawat.toptics
DROP TABLE IF EXISTS `toptics`;
CREATE TABLE IF NOT EXISTS `toptics` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`category_id` bigint(20) unsigned NOT NULL,
`title` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`description` text COLLATE utf8mb4_unicode_ci NOT NULL,
`status_id` bigint(20) unsigned NOT NULL,
`image` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`icon` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `toptics_category_id_foreign` (`category_id`),
KEY `toptics_status_id_foreign` (`status_id`),
CONSTRAINT `toptics_category_id_foreign` FOREIGN KEY (`category_id`) REFERENCES `categories` (`id`),
CONSTRAINT `toptics_status_id_foreign` FOREIGN KEY (`status_id`) REFERENCES `statuses` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- Data exporting was unselected.
-- Dumping structure for table asvawat.trending_posts
DROP TABLE IF EXISTS `trending_posts`;
CREATE TABLE IF NOT EXISTS `trending_posts` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`article_id` int(11) NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- Data exporting was unselected.
-- Dumping structure for table asvawat.users
DROP TABLE IF EXISTS `users`;
CREATE TABLE IF NOT EXISTS `users` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`email` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`phone` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`email_verified_at` timestamp NULL DEFAULT NULL,
`password` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`remember_token` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`account_type_id` bigint(20) unsigned NOT NULL,
`gender_id` bigint(20) unsigned NOT NULL,
`report_user_type_id` bigint(20) unsigned NOT NULL,
`avatar` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`bio` text COLLATE utf8mb4_unicode_ci NOT NULL,
`is_recieve_new_letter` tinyint(1) NOT NULL,
`is_social_notification` tinyint(1) NOT NULL,
`is_recieve_email_from_followed_author` tinyint(1) NOT NULL,
`is_metion_notification` tinyint(1) NOT NULL,
`is_promotion` tinyint(1) NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- Data exporting was unselected.
-- Dumping structure for table asvawat.user_save_articles
DROP TABLE IF EXISTS `user_save_articles`;
CREATE TABLE IF NOT EXISTS `user_save_articles` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`user_id` bigint(20) unsigned NOT NULL,
`article_id` bigint(20) unsigned NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- Data exporting was unselected.
-- Dumping structure for table asvawat.views
DROP TABLE IF EXISTS `views`;
CREATE TABLE IF NOT EXISTS `views` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`article_id` bigint(20) unsigned NOT NULL,
`user_id` bigint(20) unsigned NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- Data exporting was unselected.
/*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */;
/*!40014 SET FOREIGN_KEY_CHECKS=IF(@OLD_FOREIGN_KEY_CHECKS IS NULL, 1, @OLD_FOREIGN_KEY_CHECKS) */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
| true |
0db02a5cb556635f1f1fd61e4ba30bef004eec63 | SQL | utagaiby/bigsoft-store | /migrations/003_cart.sql | UTF-8 | 621 | 4.15625 | 4 | [
"MIT"
] | permissive | CREATE TABLE `carts` (
`id` INT NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`id`));
CREATE TABLE `cart_items` (
`id` INT NOT NULL AUTO_INCREMENT,
`cart_id` INT NOT NULL,
`product_id` INT NOT NULL,
PRIMARY KEY (`id`),
INDEX `fk_cart_items_carts_idx` (`cart_id` ASC),
INDEX `fk_cart_items_products_idx` (`product_id` ASC),
CONSTRAINT `fk_cart_items_carts`
FOREIGN KEY (`cart_id`)
REFERENCES `carts` (`id`)
ON DELETE CASCADE
ON UPDATE CASCADE,
CONSTRAINT `fk_cart_items_products`
FOREIGN KEY (`product_id`)
REFERENCES `products` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION); | true |
61d569d85dd330b78f85b9e243ecbda7bc3f60d1 | SQL | sarziv/php_environment | /sites/html/Php_mysql/MySql_joints/UNION/Database_joints.sql | UTF-8 | 2,226 | 3.09375 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 4.0.10deb1
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Aug 10, 2017 at 07:25 AM
-- Server version: 5.5.57-0ubuntu0.14.04.1
-- PHP Version: 5.5.9-1ubuntu4.21
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: `Database_joints`
--
-- --------------------------------------------------------
--
-- Table structure for table `Customer`
--
CREATE TABLE IF NOT EXISTS `Customer` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`firstname` text NOT NULL,
`lastname` text NOT NULL,
`city` text NOT NULL,
`country` text NOT NULL,
`phone` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ;
--
-- Dumping data for table `Customer`
--
INSERT INTO `Customer` (`id`, `firstname`, `lastname`, `city`, `country`, `phone`) VALUES
(1, 'Michel', 'Goben', 'Japan', 'NS', 877447),
(2, 'Komi', 'Otami', 'Busen', 'JK', 944444),
(3, 'Bob', 'Garden', 'Canada', 'TY', 111447),
(4, 'Komi', 'Bori', 'Kini', 'NK', 988871);
-- --------------------------------------------------------
--
-- Table structure for table `Supplier`
--
CREATE TABLE IF NOT EXISTS `Supplier` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`companyname` text NOT NULL,
`contactname` text NOT NULL,
`city` text NOT NULL,
`country` text NOT NULL,
`phone` int(11) NOT NULL,
`fax` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;
--
-- Dumping data for table `Supplier`
--
INSERT INTO `Supplier` (`id`, `companyname`, `contactname`, `city`, `country`, `phone`, `fax`) VALUES
(1, 'Apple', 'Ringo', 'Japan', 'Kimi', 89999994, 89999994),
(2, 'Samsung', 'Bunski', 'Canada', 'LS', 113531, 1583),
(3, 'Samsung', 'Rumski', 'Canada', 'VS', 877877, 122574);
/*!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 */;
| true |
cdd0450fbfdfb6c85a4d0ad5a9fce86f399079fb | SQL | Rthompson2548/postgres-final-assignment | /src/grants-total.sql | UTF-8 | 225 | 3.234375 | 3 | [] | no_license | -- INSTRUCTIONS:
-- write the SQL to query the grants table
-- for the total dollar amount of all grants in the table
-- BASIC SYNTAX:
-- SELECT SUM(column_name)
-- FROM table_name
SELECT sum(amount)
FROM grants | true |
81ab237deb355172ef882b06659fe4ef733b6447 | SQL | djccarew/get-started-java-icp | /docker/derby/init.sql | UTF-8 | 263 | 2.625 | 3 | [
"Apache-2.0"
] | permissive | connect 'jdbc:derby:demo;create=true';
create schema derbyuser;
CREATE TABLE DERBYUSER.VISIT (VISITID SMALLINT GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1) NOT NULL,FIRSTNAME VARCHAR(64) NOT NULL, VISITED TIMESTAMP NOT NULL,PRIMARY KEY(VISITID));
| true |
075b57648906dd4b2d33ac9c7601e848266f6d66 | SQL | Fury26/DBLAB2 | /queris.sql | UTF-8 | 669 | 3.1875 | 3 | [] | no_license | -- deleting club example
DELETE FROM club_stadium WHERE club_id = 6;
DELETE FROM clubs_tournaments WHERE club_id = 6;
DELETE FROM match WHERE home_club_id = 6 OR away_club_id = 6;
UPDATE player SET club_id = NULL WHERE club_id = 6;
DELETE FROM club WHERE id = 6;
SELECT * FROM club;
-- deleting from stadiun
DELETE FROM club_stadium WHERE stadium_id = id;
DELETE FROM stadiun WHERE id = id;
-- inset into match
INSERT INTO match(tournament_id, home_club_id, away_club_id, datetime, result, ticket_cost)
values(2, 7, 5, '10/11/2020'::timestamp, '1:0', '30'::money);
SELECT * FROM match;
-- genearation of random values
select chr(trunc(65+random(25)*)::int);
| true |
10e687c2222e5b18118f32dc68c1b315ed12c758 | SQL | hi-noikiy/project | /91ns/schemas/web/20151103/pre_lucky_gift_configs幸运礼物配置表修改.sql | UTF-8 | 984 | 2.984375 | 3 | [] | no_license | /*
Navicat MySQL Data Transfer
Source Server : localhost_3306
Source Server Version : 50621
Source Host : localhost:3306
Source Database : 91ns
Target Server Type : MYSQL
Target Server Version : 50621
File Encoding : 65001
Date: 2015-11-03 16:32:11
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for `pre_lucky_gift_odds`
-- ----------------------------
DROP TABLE IF EXISTS `pre_lucky_gift_odds`;
CREATE TABLE `pre_lucky_gift_odds` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`giftId` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '礼物id',
`sequence` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '中奖序号',
`multiple` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '中奖倍数',
PRIMARY KEY (`id`),
KEY `giftId` (`giftId`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='幸运礼物概率表';
-- ----------------------------
-- Records of pre_lucky_gift_odds
-- ----------------------------
| true |
230c71dc5249e878bb0a30e3f03b894df796122b | SQL | s20151/jaz-java | /app/src/main/resources/db.changelog/20210124_allezon_final_4.sql | UTF-8 | 1,475 | 3.609375 | 4 | [] | no_license | DROP TABLE users CASCADE;
DROP TABLE category CASCADE;
DROP TABLE section CASCADE;
DROP TABLE auction CASCADE;
DROP TABLE auction_photo CASCADE;
DROP TABLE parameter CASCADE;
DROP TABLE auction_parameter CASCADE;
CREATE TABLE users
(
id BIGSERIAL NOT NULL PRIMARY KEY,
username varchar(40) not null,
password char(60) not null,
authorities varchar(200)
);
CREATE TABLE section
(
id BIGSERIAL NOT NULL PRIMARY KEY,
name varchar(40) not null
);
CREATE TABLE category
(
id BIGSERIAL NOT NULL PRIMARY KEY,
section_id BIGINT not null,
name varchar(40) not null,
FOREIGN KEY (section_id) REFERENCES section(id)
);
CREATE TABLE auction
(
id BIGSERIAL NOT NULL PRIMARY KEY,
creator_id BIGINT not null,
category_id BIGINT not null,
title varchar(100) not null,
description varchar(100) not null,
price int not null,
FOREIGN KEY (category_id) REFERENCES category(id),
FOREIGN KEY (creator_id) REFERENCES users(id)
);
CREATE TABLE auction_photo
(
auction_id BIGINT not null,
position int not null,
link varchar(100) not null,
FOREIGN KEY (auction_id) REFERENCES auction(id)
);
CREATE TABLE parameter
(
id BIGSERIAL NOT NULL PRIMARY KEY,
name varchar(100) not null
);
CREATE TABLE auction_parameter
(
auction_id BIGINT not null,
parameter_id BIGINT not null,
value varchar(100) not null,
FOREIGN KEY (auction_id) REFERENCES auction(id),
FOREIGN KEY (parameter_id) REFERENCES parameter(id)
); | true |
ecbd3c424f9331d51b144fdf0ce0a2a2b02a1753 | SQL | sambacha/OsmBigQueryLoader | /sql-etl/dml/relations1_iterate.sql | UTF-8 | 2,109 | 3.953125 | 4 | [] | no_license | WITH relbox AS (
SELECT relboxpoint.id,
MIN(edge_left) AS edge_left,
MIN(edge_bottom) AS edge_bottom,
MAX(edge_right) AS edge_right,
MAX(edge_top) AS edge_top
FROM
(
SELECT
rel.id,
members.id AS m_id,
ST_X(COALESCE(rel.bounding_box.top_left, way.bounding_box.top_left, node.geometry)) AS edge_left,
ST_Y(COALESCE(rel.bounding_box.bottom_left, way.bounding_box.bottom_left, node.geometry)) AS edge_bottom,
ST_X(COALESCE(rel.bounding_box.bottom_right, way.bounding_box.bottom_right, node.geometry)) AS edge_right,
ST_Y(COALESCE(rel.bounding_box.top_right, way.bounding_box.top_right, node.geometry)) AS edge_top
FROM
`openstreetmap-public-data-dev.osmbigqueryloader_dev.planet_relations1` AS rel JOIN UNNEST(members) AS members
LEFT JOIN `openstreetmap-public-data-dev.osmbigqueryloader_dev.planet_nodes1` AS node ON (members.id = node.id)
LEFT JOIN `openstreetmap-public-data-dev.osmbigqueryloader_dev.planet_ways1` AS way ON (members.id = way.id)
) AS relboxpoint
GROUP BY relboxpoint.id
)
SELECT
rel0.id,
rel0.version,
rel0.username,
rel0.changeset,
rel0.visible,
TIMESTAMP_SECONDS(CAST(rel0.osm_timestamp/1000 AS INT64)) AS osm_timestamp,
NULL AS geometry,
STRUCT(
SAFE.ST_MAKEPOLYGON(SAFE.ST_MAKELINE([
ST_GEOGPOINT(edge_left,edge_top),
ST_GEOGPOINT(edge_left,edge_bottom),
ST_GEOGPOINT(edge_right,edge_bottom),
ST_GEOGPOINT(edge_right,edge_top)
])) AS bounding_box,
ST_GEOGPOINT(edge_left,edge_top) AS top_left,
ST_GEOGPOINT(edge_left,edge_bottom) AS bottom_left,
ST_GEOGPOINT(edge_right,edge_bottom) AS bottom_right,
ST_GEOGPOINT(edge_right,edge_top) AS top_right
) AS bounding_box,
rel0.members,
rel0.all_tags
FROM
relbox,
`openstreetmap-public-data-dev.osmbigqueryloader_dev.planet_relations0` AS rel0 JOIN UNNEST(members) as rel0members
WHERE
rel0.id != relbox.id
AND rel0.id NOT IN (SELECT id FROM `openstreetmap-public-data-dev.osmbigqueryloader_dev.planet_relations1` AS rel)
AND rel0members.id = relbox.id
LIMIT 1000
| true |
78488a878ed252e27c798949eb0939c09dfc265d | SQL | KristinaJelyazkova/Databases | /seminar6-mixed.sql | UTF-8 | 3,066 | 4.34375 | 4 | [] | no_license | -- 1. За всеки актьор/актриса изведете броя на различните студиа,
-- с които са записвали филми, включително и за тези, за които
-- нямаме информация в кои филми са играли.
use movies;
select NAME, count(distinct v.STUDIONAME) as count_studios
from MOVIESTAR m left join starsin s on m.NAME = s.STARNAME
left join movie v on s.MOVIEYEAR = v.YEAR
and s.MOVIETITLE = v.TITLE
group by NAME
-- 2. За производителите на поне 2 лазерни принтера, намерете броя на
-- произвежданите от тях PC-та (конфигурации в таблиците printer и pc).
-- Ако такива производители нямат pc-та, в резултата да има 0.
use pc
select p1.maker, count(p2.code) as count_pc
from product p1 left join pc p2 on p1.model = p2.model
where p1.maker in (select r.maker
from printer p join product r on p.model = r.model
where p.type = 'Laser'
group by r.maker
having count(*) >= 2)
group by p1.maker
-- 3. За всяка година, в която е проведена битка, да се изведе броят на
-- корабите, пуснати на вода през тази година
use ships
select year(b.date) as year, count(distinct s.name) as count_ships
from battles b left join ships s on year(b.date) = s.launched
group by year(b.date)
-- 4. Изведете броя на потъналите американски кораби за всяка проведена
-- битка с поне един потънал американски кораб.
use ships
select battle, count(*) as count_usa_sunk_ships
from outcomes o join ships s on o.SHIP = s.NAME
join classes c on s.CLASS = c.CLASS
where c.COUNTRY = 'USA' and o.RESULT = 'sunk'
group by battle
-- 5. За всяка държава да се изведе броят на повредените кораби и броят
-- на потъналите кораби. Всяка от бройките може да бъде и нула.
use ships
select c.country, sum(case o.result
when 'damaged' then 1
else 0
end) as count_damaged,
sum(case o.result
when 'sunk' then 1
else 0
end) as count_sunk
from classes c left join ships s on c.CLASS = s.CLASS
left join outcomes o on s.NAME = o.SHIP
group by c.country
-- 6. Намерете имената на битките, в които са участвали поне 3 кораба с
-- под 10 оръдия и от тях поне два са с резултат ‘ok’
use ships
select o.battle
from outcomes o join ships s on o.SHIP = s.NAME
join classes c on s.CLASS = c.CLASS
where c.numguns < 10
group by o.battle
having count(*) >= 3 and sum(case o.result
when 'ok' then 1
else 0
end) >=2 | true |
6366fff5727571bdcf96185660c9fe666d0b813a | SQL | Niicksan/SoftwareUniversity | /Professional Modules/C# DB Fundamentals/Databases Basics - MS SQL Server/Exercises/05. Table Relations - Exercise/01. One-To-One Relationship.sql | UTF-8 | 730 | 3.640625 | 4 | [] | no_license | CREATE TABLE Persons (
PersonID INT NOT NULL,
FirstName VARCHAR(50),
Salary MONEY,
PassportID INT
);
CREATE TABLE Passports(
PassportID INT NOT NULL,
PassportNumber VARCHAR(50)
);
INSERT INTO Persons (PersonID, FirstName, Salary, PassportID) VALUES
(1, 'Roberto', 43300.00, 102),
(2, 'Tom', 56100.00, 103),
(3, 'Yana', 60200.00, 101);
INSERT INTO Passports (PassportID, PassportNumber) VALUES
(101, 'N34FG21B'),
(102, 'K65LO4R7'),
(103, 'ZE657QP2');
ALTER TABLE Persons
ADD CONSTRAINT PK_PersonID
PRIMARY KEY (PersonId)
ALTER TABLE Passports
ADD CONSTRAINT PK_PassportsId
PRIMARY KEY (PassportId)
ALTER TABLE Persons
ADD CONSTRAINT FK_PersonsPasspord
FOREIGN KEY (PassportID) REFERENCES Passports(PassportId); | true |
872263cd22f48fad7ac8390790434d85cd75c7b1 | SQL | Nishtha003/JD-Extensions | /jd_tourshowcase - pro/packages/com_jdtoursshowcase/administrator/sql/install.mysql.utf8.sql | UTF-8 | 2,224 | 2.75 | 3 | [] | no_license | CREATE TABLE IF NOT EXISTS `#__jdtoursshowcase_tours` (
`id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`title` VARCHAR(255) NOT NULL ,
`tour_type` VARCHAR(255) NOT NULL ,
`alias` VARCHAR(255) NOT NULL ,
`ordering` INT(11) NOT NULL ,
`state` TINYINT(1) NOT NULL ,
`checked_out` INT(11) NOT NULL ,
`checked_out_time` DATETIME NOT NULL ,
`created_by` INT(11) NOT NULL ,
`modified_by` INT(11) NOT NULL ,
`tour_image` VARCHAR(255) NOT NULL ,
`price` VARCHAR(255) NOT NULL ,
`price_postfix` TEXT NOT NULL ,
`feature` TEXT NOT NULL ,
`created_on` TEXT NOT NULL ,
`percentage` DOUBLE,
`fixed_amount` DOUBLE,
`discount_type` VARCHAR(255) NOT NULL ,
`show_discount` VARCHAR(255) NOT NULL ,
`duration` VARCHAR(255) NOT NULL ,
`destination` VARCHAR(255) NOT NULL ,
`gallery` VARCHAR(255) NOT NULL ,
`tour_description` VARCHAR(25500) NOT NULL,
`facilities_description` TEXT NOT NULL ,
`facilities_features` VARCHAR(2550) NOT NULL ,
`tour_schedule` VARCHAR(255) NOT NULL ,
`schedule_description` TEXT NOT NULL ,
`module_position` VARCHAR(255) NOT NULL ,
`enable_sidebar` VARCHAR(255) NOT NULL ,
`hits` DOUBLE,
PRIMARY KEY (`id`)
) DEFAULT COLLATE=utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS `#__jdtoursshowcase_tour_type` (
`id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`ordering` INT(11) NOT NULL ,
`state` TINYINT(1) NOT NULL ,
`checked_out` INT(11) NOT NULL ,
`checked_out_time` DATETIME NOT NULL ,
`created_by` INT(11) NOT NULL ,
`modified_by` INT(11) NOT NULL ,
`title` VARCHAR(255) NOT NULL ,
PRIMARY KEY (`id`)
) DEFAULT COLLATE=utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS `#__jdtoursshowcase_reviews` (
`id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`asset_id` INT(10) UNSIGNED NOT NULL DEFAULT '0',
`ordering` INT(11) NOT NULL ,
`name` VARCHAR(255) NOT NULL ,
`state` TINYINT(1) NOT NULL ,
`reivew` TEXT NOT NULL ,
`email` VARCHAR(255) NOT NULL ,
`stars` VARCHAR(255) NOT NULL ,
`packagename` VARCHAR(255) NOT NULL ,
`tour_id`TINYINT(2) NOT NULL ,
`tour_date` VARCHAR(255) NOT NULL ,
`checked_out` INT(11) NOT NULL ,
`checked_out_time` DATETIME NOT NULL ,
`created_by` INT(11) NOT NULL ,
`modified_by` INT(11) NOT NULL ,
PRIMARY KEY (`id`)
) DEFAULT COLLATE=utf8mb4_unicode_ci;
| true |
fddcd0d915556a59265ba4ace1a128f5a73f37c3 | SQL | ferow2k/yii-i18n-columns | /tests/db/test.sql | UTF-8 | 1,044 | 3.625 | 4 | [] | no_license |
CREATE TABLE `image` (
`id` BIGINT(20) NOT NULL ,
`path` VARCHAR(255) NULL DEFAULT NULL ,
`created` DATETIME NULL DEFAULT NULL ,
`modified` DATETIME NULL DEFAULT NULL ,
PRIMARY KEY (`id`) );
CREATE TABLE `book` (
`id` BIGINT(20) NOT NULL ,
`title` VARCHAR(255) NULL DEFAULT NULL ,
`slug` VARCHAR(255) NULL DEFAULT NULL ,
`image_id` BIGINT(20) NOT NULL ,
`created` DATETIME NULL DEFAULT NULL ,
`modified` DATETIME NULL DEFAULT NULL ,
PRIMARY KEY (`id`) ,
CONSTRAINT `fk_book_image1`
FOREIGN KEY (`image_id` )
REFERENCES `image` (`id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION);
CREATE TABLE `chapter` (
`id` BIGINT(20) NOT NULL ,
`title` VARCHAR(255) NULL DEFAULT NULL ,
`slug` VARCHAR(255) NULL DEFAULT NULL ,
`book_id` BIGINT(20) NOT NULL ,
`created` DATETIME NULL DEFAULT NULL ,
`modified` DATETIME NULL DEFAULT NULL ,
PRIMARY KEY (`id`) ,
CONSTRAINT `fk_chapter_book`
FOREIGN KEY (`book_id` )
REFERENCES `book` (`id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION);
| true |
ecb93b63ed0af0c57da5fc4b27b32de7281bfbfe | SQL | bowema/sql | /leetcode/550.sql | UTF-8 | 351 | 3.828125 | 4 | [] | no_license | SELECT ROUND(COUNT(DISTINCT CASE WHEN b.event_date IS NOT NULL THEN a.player_id ELSE null END)::numeric
/
COUNT(DISTINCT a.player_id), 2)
FROM lc.activity_550 a
LEFT JOIN lc.activity_550 b
ON a.player_id = b.player_id AND
a.event_date = b.event_date - 1;
-- https://zqt0.gitbook.io/leetcode/sql/550.-game-play-analysis-iv-zhong-deng | true |
618f0c523a8ea3fc8a649265873b8b8712243368 | SQL | nocaway/yugabyte-db | /src/postgres/src/test/regress/sql/yb_pg_namespace.sql | UTF-8 | 1,839 | 3.984375 | 4 | [
"PostgreSQL",
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0",
"OpenSSL"
] | permissive | --
-- Regression tests for schemas (namespaces)
--
CREATE SCHEMA test_ns_schema_1
CREATE UNIQUE INDEX abc_a_idx ON abc (a)
CREATE VIEW abc_view AS
SELECT a+1 AS a, b+1 AS b FROM abc
CREATE TABLE abc (
a serial,
b int UNIQUE
);
-- TODO(dmitry): Remove separate statements for creation each element in schema after
-- `schema creation with elements` command will be supported.
CREATE SCHEMA test_ns_schema_1;
CREATE TABLE test_ns_schema_1.abc (a serial, b int UNIQUE);
CREATE UNIQUE INDEX abc_a_idx ON test_ns_schema_1.abc (a);
CREATE VIEW test_ns_schema_1.abc_view AS SELECT a+1 AS a, b+1 AS b FROM test_ns_schema_1.abc;
-- verify that the objects were created
SELECT COUNT(*) FROM pg_class WHERE relnamespace =
(SELECT oid FROM pg_namespace WHERE nspname = 'test_ns_schema_1');
INSERT INTO test_ns_schema_1.abc DEFAULT VALUES;
INSERT INTO test_ns_schema_1.abc DEFAULT VALUES;
INSERT INTO test_ns_schema_1.abc DEFAULT VALUES;
SELECT * FROM test_ns_schema_1.abc ORDER BY a;
SELECT * FROM test_ns_schema_1.abc_view ORDER BY a;
ALTER SCHEMA test_ns_schema_1 RENAME TO test_ns_schema_renamed;
SELECT COUNT(*) FROM pg_class WHERE relnamespace =
(SELECT oid FROM pg_namespace WHERE nspname = 'test_ns_schema_1');
-- test IF NOT EXISTS cases
CREATE SCHEMA test_ns_schema_renamed; -- fail, already exists
CREATE SCHEMA IF NOT EXISTS test_ns_schema_renamed; -- ok with notice
CREATE SCHEMA IF NOT EXISTS test_ns_schema_renamed -- fail, disallowed
CREATE TABLE abc (
a serial,
b int UNIQUE
);
DROP SCHEMA test_ns_schema_renamed CASCADE;
-- verify that the objects were dropped
SELECT COUNT(*) FROM pg_class WHERE relnamespace =
(SELECT oid FROM pg_namespace WHERE nspname = 'test_ns_schema_renamed');
| true |
1bf6ce4bdd154c3c481b5c7f6bdd787f99998cd4 | SQL | zzfengxia/spring-demo | /springboot-demo/src/main/resources/import.sql | UTF-8 | 1,310 | 2.984375 | 3 | [] | no_license |
CREATE TABLE `tm_user` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`username` varchar(128) NOT NULL COMMENT '用户名',
`realname` varchar(128) DEFAULT NULL COMMENT '姓名',
`password` varchar(255) DEFAULT NULL,
`salt` varchar(64) DEFAULT NULL,
`email` varchar(255) DEFAULT NULL COMMENT 'email',
`jobuuid` varchar(64) DEFAULT NULL,
`department_id` int(11) DEFAULT NULL COMMENT '部门',
`create_time` datetime DEFAULT NULL,
`update_time` datetime DEFAULT NULL,
`last_time` datetime DEFAULT NULL COMMENT '最后登录时间',
`status` varchar(32) DEFAULT NULL COMMENT '状态 1:正常;0:删除',
`phone` varchar(25) DEFAULT NULL COMMENT '联系方式',
`home_page` varchar(128) DEFAULT NULL COMMENT '首页显示',
`jobnumber` varchar(40) DEFAULT NULL,
`group_id` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `unique_username` (`username`)
) ENGINE=InnoDB AUTO_INCREMENT=109 DEFAULT CHARSET=utf8
insert into `tm_user` (
`username`, `realname`, `password`, `salt`, `email`, `jobuuid`, `department_id`, `create_time`, `update_time`, `last_time`,
`status`, `phone`, `home_page`, `jobnumber`, `group_id`
)
values
('admin','admin','C1EE6E27D5D99E84487768FD33D9B3ED','1144F9E30644621D','admin@admin.com','d959b2a5cc5c402aabfc85931a3d8ad4',NULL,
'2017-07-27 11:45:14','2017-08-07 10:37:38',NULL,'1','','',NULL,'1');
| true |
158e0602b79917d78c5da94299f8b4d76814ebee | SQL | IM4rk/SQLT | /run/my_query.sql | UTF-8 | 6,354 | 3.296875 | 3 | [] | no_license | alter session set nls_date_format = 'yyyy-mm-dd/hh24:mi:ss'
/
INSERT INTO casemgr.search_results (case_id, target_date, drafter_target_date, drafter_target_days, case_number,case_year, case_ref, cases_count, total, number_string
, oe_list, forename, surname, am_forename, am_surname, pm_forename, pm_surname, stage_id, template_name, td_id, case_status_desc, case_officer, external_loader_count, sent_to_minister_flag
, contribution_details, text_relevance_score, free_text_snippet, free_text_section, free_text_match_count, text_relevance_score_doc, free_text_snippet_doc, free_text_category,
free_text_match_count_doc, free_text_file_id)
WITH
case_privs AS (
--
-- Case ids that exist and this user can see
--
SELECT
xcd.cd_id
FROM
casemgr.xview_case_details xcd
JOIN casemgr.vw_case_access vc ON vc.case_id = xcd.case_id AND vc.wua_id = 42 AND vc.system_area = xcd.system_area AND casemgr.ca_access.check_priv(vc.access_level, 'SEARCH') = 'true'
WHERE
xcd.status_control = 'C'
AND xcd.case_status != 'DRAFT'
AND xcd.system_area = 'BIS_CU'
)
,
t1 AS (
--
-- Main search filter
--
SELECT DISTINCT
xcd.case_id
, ct.target_date
, ct.drafter_target_date
, NVL2(ct.drafter_days_text, ct.drafter_days_text || ' (Paused)', NULL) drafter_target_days
, ct.drafter_target_when_known drafter_target_disp
, st.to_number_safe(substr(c.case_number,0, INSTR(c.case_number,'/')-1)) case_year
, NULL text_relevance_score
, NULL snippet
, NULL section
, NULL matched_count
, NULL text_relevance_score_doc
, NULL snippet_doc
, NULL document_category
, NULL matched_count_doc
, NULL fox_file_id
FROM case_privs cp
JOIN casemgr.xview_case_details xcd ON xcd.cd_id = cp.cd_id
JOIN casemgr.case_type_attributes cta ON cta.case_type = xcd.case_type AND cta.system_area = xcd.system_area
JOIN casemgr.cases c ON xcd.case_id = c.id
JOIN casemgr.case_timeliness ct ON ct.case_uref = c.uref_value
JOIN casemgr.case_stage_tip_initial_reopen cstio ON cstio.cd_id = xcd.cd_id AND cstio.status_control = 'C'
LEFT OUTER JOIN casemgr.foi_case_details fcd ON fcd.cd_id = xcd.cd_id
LEFT JOIN casemgr.xview_case_contacts xcc ON xcc.cd_id = xcd.cd_id
WHERE xcd.status_control = 'C'
AND xcd.case_status = 'OPEN'
)
,
t2 AS (
SELECT
t1.case_id
, t1.target_date
, t1.drafter_target_disp
, t1.drafter_target_days
, t1.text_relevance_score
, t1.snippet
, t1.section
, t1.matched_count
, t1.text_relevance_score_doc
, t1.snippet_doc
, t1.document_category
, t1.matched_count_doc
, t1.fox_file_id
, c.case_number
, t1.case_year
, c.case_ref
, xcd.create_method
, count(1) OVER (PARTITION BY 1) cases_count
FROM t1
JOIN casemgr.cases c ON c.id = t1.case_id
JOIN casemgr.xview_case_details xcd ON xcd.case_id = c.id
WHERE (xcd.status_control = 'C'
AND t1.target_date >= '2018-03-01/00:00:00'
AND t1.target_date <= '2018-03-31/23:59:59'
)
ORDER BY t1.case_year DESC NULLS LAST, c.case_number DESC
)
,
t3 AS (
SELECT
t2.case_id
, t2.target_date
, t2.drafter_target_disp
, t2.drafter_target_days
, t2.case_number
, t2.case_year
, t2.case_ref
, t2.cases_count
, t2.text_relevance_score
, t2.snippet
, t2.section
, t2.matched_count
, t2.text_relevance_score_doc
, t2.snippet_doc
, t2.document_category
, t2.matched_count_doc
, t2.fox_file_id
, NULL external_loader_count
FROM t2
WHERE rownum <= 2500
)
SELECT
search_matches.case_id
, search_matches.target_date
, search_matches.drafter_target_disp
, search_matches.drafter_target_days
, search_matches.case_number
, search_matches.case_year
, search_matches.case_ref
, search_matches.cases_count
, nvl(rc.total, 0)
, rc.number_string
, rc.oe_list
, rm.forename
, rm.surname
, rm2.forename am_forename
, rm2.surname am_surname
, rm3.forename pm_forename
, rm3.surname pm_surname
, cstio.stage_id
, xtd.template_name
, xtd.td_id
, casemgr.ca_utils.get_status_description(search_matches.case_id) case_status_desc
, casemgr.ca_utils.get_case_officer(search_matches.case_id) case_officer
, search_matches.external_loader_count
, CASE WHEN xcd.sent_to_minister_flag = 'true' OR xcd.sent_to_second_minister_flag = 'true' THEN 'true' ELSE 'false' END sent_to_minister_flag
, rc.contribution_details
, search_matches.text_relevance_score
, search_matches.snippet
, search_matches.section
, search_matches.matched_count
, search_matches.text_relevance_score_doc
, search_matches.snippet_doc
, search_matches.document_category
, search_matches.matched_count_doc
, search_matches.fox_file_id
FROM t3 search_matches
JOIN casemgr.xview_case_details xcd ON search_matches.case_id = xcd.case_id
JOIN casemgr.case_stage_tip_initial_reopen cstio ON cstio.cd_id = xcd.cd_id AND cstio.status_control = 'C'
LEFT JOIN casemgr.xview_template_documents xtd ON xcd.campaign_id = xtd.td_id AND xtd.status_control = 'C'
LEFT JOIN decmgr.xview_resource_people_history rm ON rm.rp_id = xcd.responding_minister_rp_id AND rm.status_control = 'C'
LEFT JOIN decmgr.xview_resource_people_history rm2 ON rm2.rp_id = xcd.addressee_minister_rp_id AND rm2.status_control = 'C'
LEFT JOIN decmgr.xview_resource_people_history rm3 ON rm3.rp_id = xcd.policy_minister_rp_id AND rm3.status_control = 'C'
LEFT JOIN (
SELECT
t.case_id
, t.total
, CASE WHEN t.open_count > 0 THEN '(' || open_count || ' Open)' END number_string
, t.oe_list
, NULL contribution_details
FROM casemgr.referral_counts t
WHERE t.referral_type = 'CONTRIBUTION'
AND t.case_id IN ( SELECT case_id FROM t3)
)
rc ON xcd.case_id = rc.case_id
WHERE xcd.status_control = 'C'
UNION ALL
SELECT
NULL case_id
, NULL target_date
, NULL drafter_target_date
, NULL
, NULL case_number
, NULL case_year
, 'EXTERNAL_LOADER_DUMMY_ROW' case_ref
, NULL cases_count
, NULL
, NULL
, NULL
, NULL
, NULL
, NULL
, NULL
, NULL
, NULL external_loader_count
, NULL
, NULL
, NULL
, NULL
, NULL
, NULL
, NULL
, NULL
, NULL
, NULL
, NULL
, NULL
, NULL
, NULL
, NULL
, NULL
, NULL
FROM dual;
| true |
f19753e4ee1c78bb267d74265e6496b7327f8e33 | SQL | maqianqiandegithup/project1 | /sql文件/shop_car.sql | UTF-8 | 2,075 | 3.078125 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 4.0.4
-- http://www.phpmyadmin.net
--
-- 主机: localhost
-- 生成日期: 2018 年 09 月 21 日 14:34
-- 服务器版本: 5.6.12-log
-- PHP 版本: 5.4.12
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
--
-- 数据库: `shopjd`
--
-- --------------------------------------------------------
--
-- 表的结构 `shop_car`
--
CREATE TABLE IF NOT EXISTS `shop_car` (
`carid` int(10) unsigned NOT NULL AUTO_INCREMENT,
`uid` int(10) unsigned NOT NULL,
`pid` int(10) unsigned NOT NULL,
`bnum` int(10) NOT NULL,
`pcolor` varchar(20) DEFAULT NULL,
`psize` varchar(20) DEFAULT NULL,
`totalfee` bigint(50) DEFAULT NULL,
PRIMARY KEY (`carid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 AUTO_INCREMENT=18 ;
--
-- 转存表中的数据 `shop_car`
--
INSERT INTO `shop_car` (`carid`, `uid`, `pid`, `bnum`, `pcolor`, `psize`, `totalfee`) VALUES
(1, 1, 0, 2, '乳白', '均码', 32),
(2, 1, 0, 1, '毛衣均码+ 衬衫均码+ 短裙均码', '均码', 32),
(4, 1, 22, 2, '驼色预定15天', '均码', 32),
(6, 1, 21, 2, '毛衣均码+ 衬衫均码+ 短裙均码', '均码', 32),
(8, 1, 22, 0, '黑色预定15天', '均码', 32),
(9, 1, 22, 0, '驼色预定15天', '均码', 32),
(10, 1, 22, 0, '黑色预定15天', '均码', 32),
(11, 1, 21, 2, '毛衣均码+ 衬衫均码+ 短裙均码', '均码', 32),
(12, 0, 34, 1, '现货 预定10天', '均码', 32),
(13, 1, 34, 1, '现货 预定10天', '均码', 32),
(14, 1, 27, 1, '自然色', '均码', 32),
(15, 0, 25, 2, '限量暗红', '均码', 32),
(16, 2, 25, 2, '限量暗红', '均码', 32),
(17, 2, 23, 2, '乳白', '均码', 32);
/*!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 */;
| true |
78d344027ae241c69a6f20af3b657ad61a8bc805 | SQL | VariousImpressCMSModulesBox/formulaire | /formulaire/sql/mysql.sql | UTF-8 | 4,860 | 2.796875 | 3 | [] | no_license | CREATE TABLE form_id (
id_form smallint(5) NOT NULL auto_increment,
desc_form varchar(60) NOT NULL default '',
admin varchar(5) default NULL,
groupe varchar(255) default NULL,
email varchar(255) default NULL,
expe varchar(5) default NULL,
url varchar(255) default NULL,
help text default NULL,
send varchar(255) default NULL,
msend varchar(5) default NULL,
msub varchar(5) default NULL,
mip varchar(5) default NULL,
mnav varchar(5) default NULL,
cod varchar(255) default NULL,
save varchar(5) default NULL,
onlyone varchar(5) default NULL,
image varchar(255) default NULL,
nbjours int(10) default NULL,
afftit varchar(5) default NULL,
affimg varchar(5) default NULL,
ordre varchar(50) default NULL,
qcm varchar(5) NOT NULL default '',
affres varchar(5) default NULL,
affrep varchar(5) default NULL,
PRIMARY KEY (`id_form`)
) TYPE=MyISAM;
INSERT INTO form_id VALUES (1,'Beispielformular','', '0','meine-email@domain.de','','http://localhost/modules/formulaire/formulaire.php?id=1','Demo Formular', 'Senden', '', '', '', '', 'UTF-8','1','0','',0,'1','1','tit','','','');
CREATE TABLE form (
id_form int(5) NOT NULL default '0',
ele_id smallint(5) unsigned NOT NULL auto_increment,
ele_type varchar(10) NOT NULL default '',
ele_caption varchar(255) NOT NULL default '',
ele_order smallint(2) NOT NULL default '0',
ele_req tinyint(1) NOT NULL default '1',
ele_value text NOT NULL,
ele_display tinyint(1) NOT NULL default '1',
PRIMARY KEY (`ele_id`),
KEY `ele_display` (`ele_display`),
KEY `ele_order` (`ele_order`)
) TYPE=MyISAM;
INSERT INTO form VALUES (1,1,'sep','{null}',0,0,'a:3:{i:0;s:72:\"<font color=#e00000><h5><center>Titel des Formulars</center></h5></font>\";i:1;i:5;i:2;i:35;}',1);
INSERT INTO form VALUES (1,2,'textarea','Textbereich',1,0,'a:3:{i:0;s:28:"Hier ist ein beliebiger Text";i:1;i:5;i:2;i:35;}',1);
INSERT INTO form VALUES (1,3,'date','Erstellungsdatum',2,0,'a:1:{i:0;s:10:\"2008-10-22\";}',1);
INSERT INTO form VALUES (1,4,'text','Textfeld : Name des Benutzers',3,0,'a:3:{i:0;i:30;i:1;i:255;i:2;s:7:\"{UNAME}\";}',1);
INSERT INTO form VALUES (1,5,'text','Textfeld : E-Mail des Benutzers',4,0,'a:3:{i:0;i:30;i:1;i:255;i:2;s:8:\"{EMAIL} \";}',1);
INSERT INTO form VALUES (1,6,'sep','{null}',5,0,'a:3:{i:0;s:84:\"<font color=#4A766E><h5><center>Die Informationen beginnen hier</center></h5></font>\";i:1;i:5;i:2;i:35;}',1);
INSERT INTO form VALUES (1,7,'radio','Optionsschalter : Auswahl einer Option',6,0,'a:2:{s:8:"Option 1";i:1;s:8:"Option 2";i:0;}',1);
INSERT INTO form VALUES (1,8,'checkbox','Kontrollkästchen',8,0,'a:5:{s:14:"Möglichkeit 1";i:1;s:14:"Möglichkeit 2";i:0;s:14:"Möglichkeit 3";i:0;s:14:"Möglichkeit 4";i:0;s:14:"Möglichkeit 5";i:0;}}',1);
INSERT INTO form VALUES (1,9,'areamodif','Textbereich nicht bearbeitbar',7,0,'a:3:{i:0;s:9:"Mein Text";i:1;i:5;i:2;i:35;}',1);
INSERT INTO form VALUES (1,10,'upload','Datei hochladen',9,0,'a:3:{i:0;N;i:1;d:204800;i:2;a:6:{i:0;a:4:{i:1;s:3:"pdf";s:5:"value";s:3:"pdf";i:0;i:0;s:3:"key";i:0;}i:1;a:4:{i:1;s:3:"doc";s:5:"value";s:3:"doc";i:0;i:1;s:3:"key";i:1;}i:2;a:4:{i:1;s:3:"txt";s:5:"value";s:3:"txt";i:0;i:2;s:3:"key";i:2;}i:3;a:4:{i:1;s:3:"gif";s:5:"value";s:3:"gif";i:0;i:3;s:3:"key";i:3;}i:4;a:4:{i:1;s:4:"mpeg";s:5:"value";s:4:"mpeg";i:0;i:4;s:3:"key";i:4;}i:5;a:4:{i:1;s:3:"jpg";s:5:"value";s:3:"jpg";i:0;i:5;s:3:"key";i:5;}}}',1);
INSERT INTO form VALUES (1,11,'select','Auswahlbox',10,0,'a:3:{i:0;i:1;i:1;i:0;i:2;a:3:{s:8:\"Option 1\";i:1;s:8:\"Option 2\";i:0;s:8:\"Option 3\";i:0;}}',1);
INSERT INTO form VALUES (1,12,'yn','Einfache ja/nein Auswahl',11,0,'a:2:{s:4:"_YES";i:1;s:3:"_NO";i:0;}',1);
CREATE TABLE form_menu (
menuid int(4) unsigned NOT NULL auto_increment,
position int(4) unsigned NOT NULL,
indent int(2) unsigned NOT NULL default '0',
itemname varchar(60) NOT NULL default '',
margintop varchar(12) NOT NULL default '0',
marginbottom varchar(12) NOT NULL default '0',
itemurl varchar(255) NOT NULL default '',
bold tinyint(1) NOT NULL default '0',
status tinyint(1) NOT NULL default '1',
PRIMARY KEY (menuid),
KEY idxmymenustatus (status)
) TYPE=MyISAM;
INSERT INTO form_menu VALUES (1,0,0,'Beispiel und Verwendung eines Formulares','0','0','http://localhost/modules/formulaire/formulaire.php?id=1',0,1);
CREATE TABLE form_form (
id_form int(5) NOT NULL default '0',
id_req smallint(5) ,
ele_id smallint(5) unsigned NOT NULL auto_increment,
ele_type varchar(10) NOT NULL default '',
ele_caption varchar(255) NOT NULL default '',
ele_value text NOT NULL,
date Date NOT NULL default '2008-10-22',
uid int(10) default '0',
ip varchar(50) default NULL,
time timestamp(8) NOT NULL,
rep text,
nbrep int(5) default NULL,
nbtot int(5) default NULL,
pos int(10) default NULL,
PRIMARY KEY (`ele_id`),
KEY `ele_id` (`ele_id`)
) TYPE=MyISAM; | true |
7513032cbe1dc7b155fc48de785542734effed34 | SQL | parkseoeun5322/Class_Example | /Oracle/수업자료/연습문제2-1-문제.sql | UHC | 3,737 | 4.5625 | 5 | [] | no_license | -----------------------------------------------------------------------------------------------
--ǽ
--01. μڵ 30, 40, 60 μ
--, , μڵ, ȸϿ Ѵ.
SELECT employee_id, first_name || ' ' || last_name name, department_id, salary
FROM employees
WHERE department_id IN(30, 40, 60)
ORDER BY name;
--02. Ŀ̼ , , , Ŀ̼ǿ ȸϿ
--Ŀ̼ǿ Ѵ.
SELECT employee_id,first_name || ' ' || last_name name, salary, commission_pct
FROM employees
ORDER BY commission_pct DESC NULLS LAST;
--03. /ҹ ϰ z ִ
--, ȸϿ Ѵ.
SELECT employee_id, first_name || ' ' || last_name name
FROM employees
WHERE first_name || ' ' || last_name LIKE '%z%'
OR first_name || ' ' || last_name LIKE '%Z%';
-----------------------------------------------------------------------------------------------
--[ 2-1]
--01. 200 μڵ带 ȸϴ ۼѴ.
SELECT employee_id, first_name || ' ' || last_name name, department_id
FROM employees
WHERE employee_id = 200;
--02. 3000 15000 ̿ Ե ʴ , , ȸϴ ۼѴ.
--(, ̸ ̸ 鹮ڸ ξ ļ ȸѴ.
-- ̸ John ̰ Seo ̸ John Seo ȸǵ Ѵ.)
SELECT employee_id, first_name || ' ' || last_name name, salary
FROM employees
WHERE salary NOT BETWEEN 3000 AND 15000;
--03. μڵ 30 60 Ҽӵ , , μڵ, ȸϴµ,
-- ĺ Ͽ ȸϴ ۼѴ.
SELECT employee_id, first_name || ' ' || last_name name, department_id, salary
FROM employees
ORDER BY name;
--04. 3000 15000 ̸鼭, μڵ 30 Ǵ 60 Ҽӵ
--, , ȸϴ ۼѴ.
--(, ȸǴ ÷ ̸ ̸ 鹮ڸ ξ name ,
-- Monthly Salary ȸǵ Ѵ.)
SELECT employee_id, first_name || ' ' || last_name name, salary, department_id
FROM employees
WHERE salary BETWEEN 3000 AND 15000
--NULL ϴ ǽ ϸ տ ۼϴ
AND department_id IS NOT NULL
OR department_id = 30
OR department_id = 60;
--05. Ҽӵ μڵ尡 , , ڵ带 ȸϴ ۼѴ.
SELECT employee_id, first_name || ' ' || last_name name, job_id, department_id
FROM employees
WHERE department_id IS NULL;
--06. Ŀ̼ , , , Ŀ̼ ȸϴµ,
--Ŀ̼ Ͽ ȸϴ ۼѴ.
SELECT employee_id, first_name || ' ' || last_name name, salary, commission_pct
FROM employees
WHERE commission_pct IS NOT NULL
ORDER BY commission_pct DESC;
--07. ҹ о z Ǵ Z Ե (name) ȸϴ ۼѴ.
SELECT employee_id, first_name || ' ' || last_name name
FROM employees
WHERE first_name || ' ' || last_name LIKE '%z%'
OR first_name || ' ' || last_name LIKE '%Z%';
-----------------------------------------------------------------------------------------------
| true |
f6ae2e328f22d6ca332f6951987474d2e5a2ca1f | SQL | ngweihow/info20003_proj2 | /828472.sql | UTF-8 | 4,827 | 4.375 | 4 | [] | no_license | /*SQL Queries Database Systems Project 2
*Code written by Wei How Ng (828472)
*/
/*Q1*/
SELECT name, COUNT(Student.firstname) AS NumberOfStudents
FROM Course INNER JOIN Student ON Course.id = Student.course
GROUP BY name
ORDER BY name, NumberOfStudents;
/*Q2*/
SELECT code, COUNT(Student.firstname) AS NumberOfStudents
FROM Student INNER JOIN StudentTakesSubject ON StudentTakesSubject.student = Student.id
WHERE result <= 50 AND result IS NOT NULL
GROUP BY code
HAVING COUNT(Student.firstname) > 1
ORDER BY code, NumberOfStudents;
/*Q3*/
SELECT Student.id, 300 -SUM(Subject.creditpoints) AS CreditRemaining
FROM StudentTakesSubject NATURAL JOIN Subject
INNER JOIN Student ON StudentTakesSubject.student = Student.id
WHERE Subject.yearlevel != 9
AND StudentTakesSubject.result >= 50
AND StudentTakesSubject.result IS NOT NULL
GROUP BY Student.id;
/*Q4*/
SELECT Student.id, lastname, Course.name,
SUM(StudentTakesSubject.result * Subject.creditpoints)/
SUM(Subject.creditpoints) AS GPA
FROM StudentTakesSubject NATURAL JOIN Subject
INNER JOIN Student ON StudentTakesSubject.student = Student.id
INNER JOIN Course ON Student.course = Course.id
WHERE Subject.yearlevel != 9
AND StudentTakesSubject.result IS NOT NULL
GROUP BY Student.id
HAVING COUNT(StudentTakesSubject.code) > 4;
/*Q5*/
SELECT CONCAT(Lecturer.firstname," " ,Lecturer.lastname),
StudentTakesSubject.result,
CONCAT(Subject.area,Subject.yearlevel,Subject.code)
FROM StudentTakesSubject NATURAL JOIN Subject
INNER JOIN Lecturer ON Subject.lecturer = Lecturer.id
ORDER BY StudentTakesSubject.result DESC
LIMIT 1;
/*Q6*/
SELECT CONCAT(Student.firstname," ", Student.lastname) AS StudentName,
StudentTakesSubject.result,
CASE
WHEN StudentTakesSubject.result < 50 THEN 'N'
WHEN StudentTakesSubject.result >= 50
AND StudentTakesSubject.result < 65 THEN 'P'
WHEN StudentTakesSubject.result >= 65
AND StudentTakesSubject.result < 70 THEN 'H3'
WHEN StudentTakesSubject.result >= 70
AND StudentTakesSubject.result < 75 THEN 'H2B'
WHEN StudentTakesSubject.result >= 75
AND StudentTakesSubject.result < 80 THEN 'H2A'
WHEN StudentTakesSubject.result >= 80 THEN 'H1'
END AS 'Grade'
FROM Student INNER JOIN StudentTakesSubject
ON Student.id = StudentTakesSubject.student
INNER JOIN
(SELECT *
FROM Student INNER JOIN StudentTakesSubject
ON Student.id = StudentTakesSubject.student
WHERE CONCAT(StudentTakesSubject.area,
StudentTakesSubject.yearlevel,
StudentTakesSubject.code) = 'COMP10001'
AND StudentTakesSubject.result >= 50
AND StudentTakesSubject.result IS NOT NULL) AS T
ON Student.id = T.id
WHERE StudentTakesSubject.result IS NOT NULL;
/*Q7*/
SELECT DISTINCT CONCAT(Lecturer.firstname," " ,Lecturer.lastname) AS Lecturers
FROM Lecturer INNER JOIN Subject
ON Lecturer.id = Subject.lecturer
GROUP BY Lecturer.id
HAVING SUM(CASE WHEN Subject.yearlevel < 4 THEN 1 ELSE 0 END) > 0
AND SUM(CASE WHEN Subject.yearlevel = 9 THEN 1 ELSE 0 END) > 0;
/*Q8*/
SELECT CONCAT(Lecturer.firstname," " ,Lecturer.lastname) AS Lecturer
FROM Lecturer INNER JOIN Subject
ON Subject.lecturer = Lecturer.id
GROUP BY Lecturer.id
HAVING (SELECT COUNT(DISTINCT StudyArea.id)
FROM StudyArea) = COUNT(DISTINCT Subject.area);
/*Q9*/
SELECT CONCAT(Student.firstname, " ", Student.lastname) AS Students
FROM Student INNER JOIN Suburb ON Suburb.postcode = Student.postcode
INNER JOIN Course ON Course.id = Student.course
INNER JOIN StudentTakesSubject ON StudentTakesSubject.student = Student.id
WHERE Suburb.name = "Gilberton" AND Course.id = "B-SCI"
GROUP BY Student.id,
StudentTakesSubject.area,
StudentTakesSubject.yearlevel,
StudentTakesSubject.code
HAVING COUNT(*) > 1;
/*Q10*/
DROP TABLE IF EXISTS `StudentEvaluations`;
CREATE TABLE `StudentEvaluations` (
`lecturer` mediumint(8) unsigned NOT NULL,
`student` mediumint(8) unsigned NOT NULL,
`area` char(4) NOT NULL,
`yearlevel` tinyint(3) unsigned NOT NULL,
`code` char(4) NOT NULL,
`year` year(4) NOT NULL,
`sem` enum('1','2') NOT NULL,
`score` tinyint(3) unsigned DEFAULT NULL,
PRIMARY KEY (`lecturer`, `student`,`area`,`yearlevel`,`code`,`year`,`sem`),
KEY `StudentEvaluations` (`area`,`yearlevel`,`code`),
CONSTRAINT `fk_StudentEvaluations_Lecturer`
FOREIGN KEY (`lecturer`)
REFERENCES `Lecturer` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_StudentEvaluations_Student1`
FOREIGN KEY (`student`)
REFERENCES `Student` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_StudentEvaluations_Subject1`
FOREIGN KEY (`area`, `yearlevel`, `code`)
REFERENCES `Subject` (`area`, `yearlevel`, `code`)
ON DELETE NO ACTION
ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8; | true |
c6ce68c8e1a1219f61fcc5bed4432a65a7139730 | SQL | angenalZZZ/database | /Database_Files/MySQL/基本语句.sql | UTF-8 | 1,167 | 3.140625 | 3 | [] | no_license | -- DB数据库列表
show databases;
-- 1.DB连接池中保持的最大空闲连接 Command='Sleep';
-- 2.DB查询Query正常连接 Command='Query';
show processlist;
-- 连接缺省值
show variables like '%packet%'; --包大小限制:默认max_allowed_packet=4M,建议16×1024×1024;前后端管道建立的时候用作参数使用;
-- 修改密码
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('HGJ766GR767FKJU0');
SET PASSWORD FOR 'root'@'%' = PASSWORD('HGJ766GR767FKJU0');
FLUSH PRIVILEGES;
-- 表的字段
SET @tablename='PartyCreditRuleLog';
SELECT GROUP_CONCAT(COLUMN_NAME SEPARATOR ",") COLUMNS FROM information_schema.COLUMNS WHERE TABLE_NAME=@tablename
UNION SELECT COLUMN_NAME FROM information_schema.COLUMNS WHERE TABLE_NAME=@tablename; -- AND TABLE_SCHEMA='db_name'
-- 事件
SELECT @@event_scheduler;
SET GLOBAL event_scheduler=1;
show events;
select * from information_schema.events;
-- 创建事件
CREATE EVENT IF NOT EXISTS e_userloginattemptsStatistics
ON SCHEDULE EVERY 1 DAY
STARTS '2019-08-30 01:00:00.000' --STARTS DATE_ADD(DATE_ADD(CURDATE(), INTERVAL 1 DAY), INTERVAL 1 HOUR)
ON COMPLETION PRESERVE ENABLE
DO CALL dbstatistics.statistics();
| true |
f7d93682b530e2ae7b83d3164c77c0fb4fc8a9c3 | SQL | illuminocracy/illuminocracy | /queries2.sql | UTF-8 | 14,176 | 3.40625 | 3 | [] | no_license | INSERT INTO ads_daily (ad_id,
delivery_day,
funding_entity,
affiliation_party,
affiliation_brexit,
page_id,
page_name,
spend_gbp_lower,
spend_gbp_upper,
spend_gbp_mid,
impressions_lower,
impressions_upper,
impressions_mid,
age,
gender,
added_date_time,
uploaded)
SELECT
A.id, D.day, A.funding_entity, F.affiliation_party, F.affiliation_brexit,
A.page_id, A.page_name,
((A.spend_lower / R.gbp_value) * DM.percentage) / DD.days_running,
((A.spend_upper / R.gbp_value) * DM.percentage) / DD.days_running,
(((((A.spend_upper - A.spend_lower) / 2) + A.spend_lower) / R.gbp_value) * DM.percentage) / DD.days_running,
(A.impressions_lower * DM.percentage) / DD.days_running,
(A.impressions_upper * DM.percentage) / DD.days_running,
((((A.impressions_upper - A.impressions_lower) / 2) + A.impressions_lower) * DM.percentage) / DD.days_running,
DM.age,
DM.gender,
'2019-11-25', 0
from
ads A
INNER JOIN ads_delivery DD ON A.id = DD.ad_id
INNER JOIN days D ON D.day >= DD.delivery_start AND D.day <= DD.delivery_end
LEFT OUTER JOIN funding_entity_affiliations F ON A.funding_entity = F.funding_entity
INNER JOIN exchange_rates R ON R.currency = A.currency
INNER JOIN ads_distribution_demographics DM ON A.id = DM.ad_id
m njmn,
SELECT A.id, D.day, DD.days_running, DD.delivery_start, DD.delivery_end, R.currency, R.gbp_value, A.spend_lower,
A.impressions_lower, A.spend_lower / R.gbp_value / DD.days_running, A.impressions_lower / DD.days_running
FROM illuminocracy.ads A
INNER JOIN illuminocracy.ads_delivery DD ON A.id = DD.ad_id
INNER JOIN illuminocracy.days D ON D.day >= DD.delivery_start AND D.day <= DD.delivery_end
INNER JOIN illuminocracy.exchange_rates R ON R.currency = A.currency AND R.rate_date = D.day
WHERE DD.delivery_start > '2019-11-01'
LIMIT 10;
SELECT A.id, D.day, DD.days_running, DD.delivery_start, DD.delivery_end, R.currency, R.gbp_value, A.spend_lower,
A.impressions_lower, A.spend_lower / R.gbp_value / DD.days_running, A.impressions_lower / DD.days_running, A.funding_entity, F.affiliation_party, F.affiliation_brexit
FROM illuminocracy.ads A
INNER JOIN illuminocracy.ads_delivery DD ON A.id = DD.ad_id
INNER JOIN illuminocracy.days D ON D.day >= DD.delivery_start AND D.day <= DD.delivery_end
INNER JOIN illuminocracy.exchange_rates R ON R.currency = A.currency AND R.rate_date = D.day
LEFT OUTER JOIN illuminocracy.funding_entity_affiliations F ON A.funding_entity = F.funding_entity
WHERE DD.delivery_start > '2019-06-01'
AND A.spend_lower > 0 --AND A.currency != 'GBP'
AND A.funding_entity is not null
LIMIT 10;
SELECT A.id, D.day, DD.days_running, DD.delivery_start, DD.delivery_end, R.currency, R.gbp_value, DM.age, DM.gender, A.spend_lower,
A.impressions_lower, (A.spend_lower / R.gbp_value / DD.days_running) * DM.percentage,
(A.impressions_lower / DD.days_running) * DM.percentage, A.funding_entity, F.affiliation_party, F.affiliation_brexit
FROM illuminocracy.ads A
INNER JOIN illuminocracy.ads_delivery DD ON A.id = DD.ad_id
INNER JOIN illuminocracy.days D ON D.day >= DD.delivery_start AND D.day <= DD.delivery_end
INNER JOIN illuminocracy.exchange_rates R ON R.currency = A.currency AND R.rate_date = D.day
INNER JOIN illuminocracy.ads_distribution_demographics DM ON A.id = DM.ad_id
LEFT OUTER JOIN illuminocracy.funding_entity_affiliations F ON A.funding_entity = F.funding_entity
WHERE DD.delivery_start > '2019-06-01'
AND A.spend_lower > 0 AND A.currency = 'GBP'
AND A.funding_entity is not null
LIMIT 10;
------------------- POPULATE ads_daily_with_demographics ---- not used anymore
----- ADS IN OTHER CURRENCIES
INSERT INTO illuminocracy.ads_daily_with_demographics (ad_id,
delivery_day,
funding_entity,
affiliation_party,
affiliation_brexit,
page_id,
page_name,
spend_gbp_lower,
spend_gbp_upper,
spend_gbp_mid,
impressions_lower,
impressions_upper,
impressions_mid,
age,
gender,
added_date_time)
SELECT
A.id, D.day, A.funding_entity, F.affiliation_party, F.affiliation_brexit,
A.page_id, A.page_name,
((A.spend_lower / R.gbp_value) * DM.percentage) / DD.days_running,
((A.spend_upper / R.gbp_value) * DM.percentage) / DD.days_running,
(((((A.spend_upper - A.spend_lower) / 2) + A.spend_lower) / R.gbp_value) * DM.percentage) / DD.days_running,
(A.impressions_lower * DM.percentage) / DD.days_running,
(A.impressions_upper * DM.percentage) / DD.days_running,
((((A.impressions_upper - A.impressions_lower) / 2) + A.impressions_lower) * DM.percentage) / DD.days_running,
DM.age,
DM.gender,
CURRENT_TIMESTAMP()
FROM
illuminocracy.ads A
INNER JOIN illuminocracy.ads_delivery DD ON A.id = DD.ad_id
INNER JOIN illuminocracy.days D ON D.day >= DD.delivery_start AND D.day <= DD.delivery_end
LEFT OUTER JOIN illuminocracy.funding_entity_affiliations F ON A.funding_entity = F.funding_entity
INNER JOIN illuminocracy.exchange_rates R ON R.currency = A.currency AND R.rate_date = D.day
INNER JOIN illuminocracy.ads_distribution_demographics DM ON A.id = DM.ad_id
WHERE A.currency != 'GBP'
AND DD.delivery_end > '2019-08-24'
AND D.day > '2019-08-24'
AND A.capture_date_time > ?
------ ADS IN GBP
INSERT INTO illuminocracy.ads_daily_with_demographics (ad_id,
delivery_day,
funding_entity,
affiliation_party,
affiliation_brexit,
page_id,
page_name,
spend_gbp_lower,
spend_gbp_upper,
spend_gbp_mid,
impressions_lower,
impressions_upper,
impressions_mid,
age,
gender,
added_date_time)
SELECT
A.id, D.day, A.funding_entity, F.affiliation_party, F.affiliation_brexit,
A.page_id, A.page_name,
(A.spend_lower * DM.percentage) / DD.days_running,
(A.spend_upper * DM.percentage) / DD.days_running,
((((A.spend_upper - A.spend_lower) / 2) + A.spend_lower) * DM.percentage) / DD.days_running,
(A.impressions_lower * DM.percentage) / DD.days_running,
(A.impressions_upper * DM.percentage) / DD.days_running,
((((A.impressions_upper - A.impressions_lower) / 2) + A.impressions_lower) * DM.percentage) / DD.days_running,
DM.age,
DM.gender,
CURRENT_TIMESTAMP()
FROM
illuminocracy.ads A
INNER JOIN illuminocracy.ads_delivery DD ON A.id = DD.ad_id
INNER JOIN illuminocracy.days D ON D.day >= DD.delivery_start AND D.day <= DD.delivery_end
LEFT OUTER JOIN illuminocracy.funding_entity_affiliations F ON A.funding_entity = F.funding_entity
INNER JOIN illuminocracy.ads_distribution_demographics DM ON A.id = DM.ad_id
WHERE A.currency = 'GBP'
AND DD.delivery_end > '2019-08-24'
AND D.day > '2019-08-24'
AND A.capture_date_time > ?
-- queries to find large funding entities
select count(*) from (
SELECT A.funding_entity
FROM ads A
LEFT OUTER JOIN funding_entity_affiliations B ON A.funding_entity = B.funding_entity
GROUP BY A.funding_entity
HAVING sum(A.spend_upper) > 10000)
-- query to find large funding entities that have at least one affiliation recorded
select count(*) from (
SELECT A.funding_entity
FROM ads A
LEFT OUTER JOIN funding_entity_affiliations B ON A.funding_entity = B.funding_entity AND (B.affiliation_party IS NOT NULL OR B.affiliation_brexit IS NOT NULL)
GROUP BY A.funding_entity
HAVING sum(A.spend_upper) > 10000)
----------------------- POPULATE BIGQUERY TABLES ---------------------------
------------------- POPULATE ads_daily -
-- this excludes funding entities with less than 10k overall spend
-- and funding entities with no affilation of any kind and less than 100k overall spend
DELETE FROM illuminocracy.ads_daily WHERE 1=1
----- ADS IN OTHER CURRENCIES
INSERT INTO illuminocracy.ads_daily (ad_id,
delivery_day,
funding_entity,
affiliation_party,
affiliation_brexit,
page_id,
page_name,
spend_gbp_lower,
spend_gbp_upper,
spend_gbp_mid,
impressions_lower,
impressions_upper,
impressions_mid,
added_date_time)
WITH large_funding_entities AS (
SELECT funding_entity FROM illuminocracy.ads GROUP BY funding_entity
HAVING SUM(spend_upper) > 10000),
affiliations AS (SELECT funding_entity, affiliation_party, affiliation_brexit
FROM illuminocracy.funding_entity_affiliations GROUP BY funding_entity, affiliation_party, affiliation_brexit)
SELECT
A.id, D.day, A.funding_entity, F.affiliation_party, F.affiliation_brexit,
A.page_id, A.page_name,
(A.spend_lower / R.gbp_value) / DD.days_running,
(A.spend_upper / R.gbp_value) / DD.days_running,
((((A.spend_upper - A.spend_lower) / 2) + A.spend_lower) / R.gbp_value) / DD.days_running,
A.impressions_lower / DD.days_running,
A.impressions_upper / DD.days_running,
(((A.impressions_upper - A.impressions_lower) / 2) + A.impressions_lower) / DD.days_running,
CURRENT_TIMESTAMP()
FROM
illuminocracy.ads A
INNER JOIN large_funding_entities ON A.funding_entity = large_funding_entities.funding_entity
INNER JOIN illuminocracy.ads_delivery DD ON A.id = DD.ad_id
INNER JOIN illuminocracy.days D ON D.day >= DD.delivery_start AND D.day <= DD.delivery_end
LEFT OUTER JOIN affiliations F ON A.funding_entity = F.funding_entity
INNER JOIN illuminocracy.exchange_rates R ON R.currency = A.currency AND R.rate_date = D.day
WHERE A.currency != 'GBP'
AND DD.delivery_end > '2019-08-24'
AND D.day > '2019-08-24'
AND A.capture_date_time > ?
------ ADS IN GBP
INSERT INTO illuminocracy.ads_daily (ad_id,
delivery_day,
funding_entity,
affiliation_party,
affiliation_brexit,
page_id,
page_name,
spend_gbp_lower,
spend_gbp_upper,
spend_gbp_mid,
impressions_lower,
impressions_upper,
impressions_mid,
added_date_time)
WITH large_funding_entities AS (
SELECT funding_entity FROM illuminocracy.ads GROUP BY funding_entity
HAVING SUM(spend_upper) > 10000),
affiliations AS (SELECT funding_entity, affiliation_party, affiliation_brexit
FROM illuminocracy.funding_entity_affiliations GROUP BY funding_entity, affiliation_party, affiliation_brexit)
SELECT
A.id, D.day, A.funding_entity, F.affiliation_party, F.affiliation_brexit,
A.page_id, A.page_name,
A.spend_lower / DD.days_running,
A.spend_upper / DD.days_running,
(((A.spend_upper - A.spend_lower) / 2) + A.spend_lower) / DD.days_running,
A.impressions_lower / DD.days_running,
A.impressions_upper / DD.days_running,
(((A.impressions_upper - A.impressions_lower) / 2) + A.impressions_lower) / DD.days_running,
CURRENT_TIMESTAMP()
FROM
illuminocracy.ads A
INNER JOIN large_funding_entities ON A.funding_entity = large_funding_entities.funding_entity
INNER JOIN illuminocracy.ads_delivery DD ON A.id = DD.ad_id
INNER JOIN illuminocracy.days D ON D.day >= DD.delivery_start AND D.day <= DD.delivery_end
LEFT OUTER JOIN affiliations F ON A.funding_entity = F.funding_entity
WHERE A.currency = 'GBP'
AND DD.delivery_end > '2019-08-24'
AND D.day > '2019-08-24'
AND A.capture_date_time > ?
-- ADS with null funding entity
INSERT INTO illuminocracy.ads_daily (ad_id,
delivery_day,
funding_entity,
affiliation_party,
affiliation_brexit,
page_id,
page_name,
spend_gbp_lower,
spend_gbp_upper,
spend_gbp_mid,
impressions_lower,
impressions_upper,
impressions_mid,
added_date_time)
SELECT
A.id, D.day, A.funding_entity, NULL, NULL,
A.page_id, A.page_name,
A.spend_lower / DD.days_running,
A.spend_upper / DD.days_running,
(((A.spend_upper - A.spend_lower) / 2) + A.spend_lower) / DD.days_running,
A.impressions_lower / DD.days_running,
A.impressions_upper / DD.days_running,
(((A.impressions_upper - A.impressions_lower) / 2) + A.impressions_lower) / DD.days_running,
CURRENT_TIMESTAMP()
FROM
illuminocracy.ads A
INNER JOIN illuminocracy.ads_delivery DD ON A.id = DD.ad_id
INNER JOIN illuminocracy.days D ON D.day >= DD.delivery_start AND D.day <= DD.delivery_end
WHERE A.funding_entity IS NULL
AND A.currency = 'GBP'
AND DD.delivery_end > '2019-08-24'
AND D.day > '2019-08-24'
AND A.capture_date_time > ?
-- populate ads_daily_agg
DELETE FROM illuminocracy.ads_daily_agg WHERE 1=1
INSERT INTO illuminocracy.ads_daily_agg (
delivery_day,
funding_entity,
affiliation_party,
affiliation_brexit,
spend_gbp_lower,
spend_gbp_upper,
spend_gbp_mid,
impressions_lower,
impressions_upper,
impressions_mid)
SELECT delivery_day, funding_entity, affiliation_party, affiliation_brexit,
SUM(spend_gbp_lower), SUM(spend_gbp_upper), SUM(spend_gbp_mid),
SUM(impressions_lower), SUM(impressions_upper), SUM(impressions_mid)
FROM illuminocracy.ads_daily
GROUP BY delivery_day, funding_entity, affiliation_party, affiliation_brexit
-- populate top_ads
DELETE FROM illuminocracy.top_ads WHERE 1=1
INSERT INTO illuminocracy.top_ads (
delivery_day,
funding_entity,
affiliation_party,
affiliation_brexit,
spend_gbp_lower,
spend_gbp_upper,
spend_gbp_mid,
impressions_lower,
impressions_upper,
impressions_mid,
creative_body,
creative_link_caption,
creative_link_description,
creative_link_title,
snapshot_url,
page_id,
page_name,
instances)
SELECT AD.delivery_day, AD.funding_entity, AD.affiliation_party, AD.affiliation_brexit,
SUM(AD.spend_gbp_lower), SUM(AD.spend_gbp_upper), SUM(AD.spend_gbp_mid),
SUM(AD.impressions_lower), SUM(AD.impressions_upper), SUM(AD.impressions_mid),
A.creative_body, A.creative_link_caption, A.creative_link_description, A.creative_link_title,
MIN(A.snapshot_url),MIN(A.page_id),MIN(A.page_name), count(distinct A.id)
FROM illuminocracy.ads_daily AD INNER JOIN illuminocracy.ads A ON AD.ad_id = A.id
GROUP BY AD.delivery_day, AD.funding_entity, AD.affiliation_party, AD.affiliation_brexit,
A.creative_body, A.creative_link_caption, A.creative_link_description, A.creative_link_title
HAVING SUM(AD.spend_gbp_mid) > 100
| true |
632a1b2238e0719651e79e68c34c20b82c5c90fe | SQL | kolamor/aiohttp_site | /init.sql | UTF-8 | 2,108 | 3.578125 | 4 | [] | no_license | create table post (
id serial,
title varchar(255) not null,
body text
);
create table user_d (
id serial primary key,
login varchar(40) not null unique,
password text not null,
email text not null unique ,
admin_privilege boolean default false
);
insert into user_d (login, password, email, admin_privilege) values ('admin', '1234', 'admin@t.py', 'true');
create table session (
id serial primary key,
user_ses varchar(40) ,
session_num text
);
create table category (
id serial primary key,
title varchar(250) not null,
slug varchar(250) not null unique
);
create table tag (
id serial primary key,
title varchar(250) not null,
slug varchar(250) not null unique
);
create table news(
id serial primary key,
title varchar(250) not null,
slug varchar(250) not null unique,
user_id integer, foreign key (user_id) references user_d (id) on delete set null,
category_id integer, foreign key (category_id) references category (id) on delete set null,
text text,
text_min text,
date_created timestamptz ,
date_change timestamptz,
description varchar(250),
likes integer default 0,
image varchar(250),
moderation boolean default false
);
create table news_tag (
id serial primary key,
news_id integer, foreign key (news_id) references news (id) on delete set null,
tag_id integer, foreign key (tag_id) references tag (id) on delete set null
);
insert into category (title, slug) values ('cat_test1', 'cat_test1');
insert into tag (title, slug) values ('tag_test1', 'tag_test1');
insert into news(title, slug, user_id, category_id, text, text_min, description)
values('news1', 'news1', '1', '1', 'bla bla bla', 'bla', 'hz');
insert into category (title, slug) values ('cat_test2', 'cat_test2');
insert into tag (title, slug) values ('tag_test2', 'tag_test2');
insert into news(title, slug, user_id, category_id, text, text_min, description)
values('news2', 'news2', '2', '2', 'bla rt', 'bl', 'hzkl');
create table news_image (
id serial primary key,
news_id integer, foreign key (news_id) references news (id) on delete set null,
image varchar(250)
);
| true |
132dfe116bc4990cf6e4ad700781cda098d39057 | SQL | blackbeltandre/qibla_swarm | /server/db/migrations/20201114181842-create_table_user_tour_purchases.sql | UTF-8 | 1,199 | 2.71875 | 3 | [] | no_license | -- +migrate Up
CREATE TABLE IF NOT EXISTS "user_tour_purchases"
(
"id" char(36) PRIMARY KEY NOT NULL DEFAULT (uuid_generate_v4()),
"tour_package_id" char(36) NOT NULL,
"customer_name" varchar(50) NOT NULL,
"customer_identity_type" char(3),
"identity_number" varchar(20),
"full_name" varchar(50),
"sex" sex_enum,
"birth_date" date,
"birth_place" varchar(100),
"phone_number" varchar(20),
"city_id" char(36),
"marital_status" marital_status_enum,
"customer_address" text,
"user_id" char(36) NOT NULL,
"contact_id" char(36) NOT NULL,
"old_user_tour_purchase_id" char(36),
"cancelation_fee" float4,
"total" float4,
"status" char(36) NOT NULL,
"created_at" timestamp NOT NULL,
"updated_at" timestamp NOT NULL,
"deleted_at" timestamp
);
-- +migrate Down
DROP TABLE IF EXISTS "user_tour_purchases"; | true |
4539ea59dae14402c3a3d44a31abe543cdf7d928 | SQL | matmic/gerenciador-financeiro | /protected/data/ihc.sql | UTF-8 | 7,363 | 3.375 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 4.5.1
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: 29-Jun-2016 às 21:55
-- Versão do servidor: 10.1.13-MariaDB
-- PHP Version: 5.6.21
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: `ihc`
--
-- --------------------------------------------------------
--
-- Estrutura da tabela `categoria`
--
CREATE TABLE `categoria` (
`CodCategoria` int(2) NOT NULL,
`CodPessoa` int(2) NOT NULL,
`NomeCategoria` varchar(50) NOT NULL,
`IndicadorExclusao` varchar(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Estrutura da tabela `endereco`
--
CREATE TABLE `endereco` (
`CodEndereco` int(2) NOT NULL,
`Logradouro` varchar(50) NOT NULL,
`Numero` int(5) DEFAULT NULL,
`Complemento` varchar(20) DEFAULT NULL,
`Bairro` varchar(30) NOT NULL,
`CEP` varchar(9) NOT NULL,
`Cidade` varchar(30) NOT NULL,
`CodEstado` int(2) NOT NULL,
`IndicadorExclusao` varchar(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Estrutura da tabela `escolaridade`
--
CREATE TABLE `escolaridade` (
`CodEscolaridade` int(2) NOT NULL,
`NomeEscolaridade` varchar(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Extraindo dados da tabela `escolaridade`
--
INSERT INTO `escolaridade` (`CodEscolaridade`, `NomeEscolaridade`) VALUES
(1, 'Analfabeto'),
(2, 'Ensino Fundamental Incompleto'),
(3, 'Ensino Fundamental Completo'),
(4, 'Ensino Médio Incompleto'),
(5, 'Ensino Médio Completo'),
(6, 'Ensino Superior Incompleto'),
(7, 'Graduação'),
(8, 'Mestrado'),
(9, 'Doutorado'),
(10, 'Especialização'),
(11, 'Pós-Doutorado'),
(12, 'Ensino Técnico');
-- --------------------------------------------------------
--
-- Estrutura da tabela `estabelecimento`
--
CREATE TABLE `estabelecimento` (
`CodEstabelecimento` int(2) NOT NULL,
`CodPessoa` int(2) NOT NULL,
`NomeEstabelecimento` varchar(50) NOT NULL,
`IndicadorExclusao` varchar(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Estrutura da tabela `estado`
--
CREATE TABLE `estado` (
`CodEstado` int(2) NOT NULL,
`NomeEstado` varchar(50) NOT NULL,
`UF` varchar(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Extraindo dados da tabela `estado`
--
INSERT INTO `estado` (`CodEstado`, `NomeEstado`, `UF`) VALUES
(1, 'Acre', 'AC'),
(2, 'Alagoas', 'AL'),
(3, 'Amapá', 'AP'),
(4, 'Amazonas', 'AM'),
(5, 'Bahia', 'BA'),
(6, 'Ceará', 'CE'),
(7, 'Distrito Federal', 'DF'),
(8, 'Espírito Santo', 'ES'),
(9, 'Goiás', 'GO'),
(10, 'Maranhão', 'MA'),
(11, 'Mato Grosso', 'MT'),
(12, 'Mato Grosso do Sul', 'MS'),
(13, 'Minas Gerais', 'MG'),
(14, 'Pará', 'PA'),
(15, 'Paraíba', 'PB'),
(16, 'Paraná', 'PR'),
(17, 'Pernambuco', 'PE'),
(18, 'Piauí', 'PI'),
(19, 'Rio de Janeiro', 'RJ'),
(20, 'Rio Grande do Norte', 'RN'),
(21, 'Rio Grande do Sul', 'RS'),
(22, 'Rondônia', 'RO'),
(23, 'Roraima', 'RR'),
(24, 'Santa Catarina', 'SC'),
(25, 'São Paulo', 'SP'),
(26, 'Sergipe', 'SE'),
(27, 'Tocantins', 'TO');
-- --------------------------------------------------------
--
-- Estrutura da tabela `orcamento`
--
CREATE TABLE `orcamento` (
`CodOrcamento` int(2) NOT NULL,
`CodPessoa` int(2) NOT NULL,
`CodTipoOrcamento` int(1) NOT NULL,
`DescricaoOrcamento` varchar(50) DEFAULT NULL,
`CodCategoria` int(2) DEFAULT NULL,
`CodEstabelecimento` int(2) DEFAULT NULL,
`ValorOrcamento` decimal(6,2) NOT NULL,
`DataOrcamento` date NOT NULL,
`IndicadorPago` varchar(1) NOT NULL,
`IndicadorExclusao` varchar(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Estrutura da tabela `pessoa`
--
CREATE TABLE `pessoa` (
`CodPessoa` int(2) NOT NULL,
`NomePessoa` varchar(20) NOT NULL,
`CPFPessoa` varchar(11) NOT NULL,
`EmailPessoa` varchar(20) NOT NULL,
`GeneroPessoa` varchar(1) NOT NULL,
`CodEndereco` int(2) NOT NULL,
`CodEscolaridade` int(2) NOT NULL,
`TelefonePessoa` varchar(13) NOT NULL,
`DataNascimentoPessoa` date NOT NULL,
`SenhaPessoa` varchar(32) NOT NULL,
`SaldoPessoa` decimal(10,2) NOT NULL,
`IndicadorExclusao` varchar(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Estrutura da tabela `tipoorcamento`
--
CREATE TABLE `tipoorcamento` (
`CodTipoOrcamento` int(1) NOT NULL,
`NomeTipoOrcamento` varchar(7) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Extraindo dados da tabela `tipoorcamento`
--
INSERT INTO `tipoorcamento` (`CodTipoOrcamento`, `NomeTipoOrcamento`) VALUES
(1, 'Receita'),
(2, 'Despesa');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `categoria`
--
ALTER TABLE `categoria`
ADD PRIMARY KEY (`CodCategoria`);
--
-- Indexes for table `endereco`
--
ALTER TABLE `endereco`
ADD PRIMARY KEY (`CodEndereco`),
ADD UNIQUE KEY `CodEndereco` (`CodEndereco`);
--
-- Indexes for table `escolaridade`
--
ALTER TABLE `escolaridade`
ADD PRIMARY KEY (`CodEscolaridade`);
--
-- Indexes for table `estabelecimento`
--
ALTER TABLE `estabelecimento`
ADD PRIMARY KEY (`CodEstabelecimento`);
--
-- Indexes for table `estado`
--
ALTER TABLE `estado`
ADD PRIMARY KEY (`CodEstado`),
ADD UNIQUE KEY `CodEstado` (`CodEstado`);
--
-- Indexes for table `orcamento`
--
ALTER TABLE `orcamento`
ADD PRIMARY KEY (`CodOrcamento`);
--
-- Indexes for table `pessoa`
--
ALTER TABLE `pessoa`
ADD PRIMARY KEY (`CodPessoa`),
ADD UNIQUE KEY `CPFPessoa` (`CPFPessoa`),
ADD UNIQUE KEY `EmailPessoa` (`EmailPessoa`);
--
-- Indexes for table `tipoorcamento`
--
ALTER TABLE `tipoorcamento`
ADD PRIMARY KEY (`CodTipoOrcamento`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `categoria`
--
ALTER TABLE `categoria`
MODIFY `CodCategoria` int(2) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `endereco`
--
ALTER TABLE `endereco`
MODIFY `CodEndereco` int(2) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `escolaridade`
--
ALTER TABLE `escolaridade`
MODIFY `CodEscolaridade` int(2) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=13;
--
-- AUTO_INCREMENT for table `estabelecimento`
--
ALTER TABLE `estabelecimento`
MODIFY `CodEstabelecimento` int(2) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `estado`
--
ALTER TABLE `estado`
MODIFY `CodEstado` int(2) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=28;
--
-- AUTO_INCREMENT for table `orcamento`
--
ALTER TABLE `orcamento`
MODIFY `CodOrcamento` int(2) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `pessoa`
--
ALTER TABLE `pessoa`
MODIFY `CodPessoa` int(2) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `tipoorcamento`
--
ALTER TABLE `tipoorcamento`
MODIFY `CodTipoOrcamento` int(1) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true |
bdd2c39bc473f22eee5b279a221ac00691560fe2 | SQL | spiralout/Tracks | /schema/event_store-mysql.sql | UTF-8 | 748 | 3.15625 | 3 | [] | no_license | --
-- MySQL schema for event store
--
-- @author Sean Crystal <sean.crystal@gmail.com>
-- @copyright 2011 Sean Crystal
-- @license http://www.opensource.org/licenses/BSD-3-Clause
-- @link https://github.com/spiralout/Tracks
--
CREATE TABLE IF NOT EXISTS entity (
id int(10) unsigned NOT NULL AUTO_INCREMENT,
guid char(36) NOT NULL,
`type` varchar(255) NOT NULL,
version int(10) unsigned NOT NULL DEFAULT '0',
date_created timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (id),
UNIQUE KEY guid (guid)
) ENGINE=InnoDB;
CREATE TABLE IF NOT EXISTS `event` (
id int(10) unsigned NOT NULL AUTO_INCREMENT,
guid char(36) NOT NULL,
`data` text NOT NULL,
date_created timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (id)
) ENGINE=InnoDB;
| true |
4a88a8a328959a038f185cfc2bf4ba574ce13b3b | SQL | xbackupx/peqXdb | /Development/Player_Tables/hackers.sql | UTF-8 | 518 | 2.6875 | 3 | [] | no_license |
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for hackers
-- ----------------------------
CREATE TABLE `hackers` (
`id` int(4) NOT NULL auto_increment,
`account` text NOT NULL,
`name` text NOT NULL,
`hacked` text NOT NULL,
`zone` text,
`date` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=latin1;
-- ----------------------------
-- Records
-- ----------------------------
| true |
cea20cb2c143618f825316cd04946681bbb1efde | SQL | phukeiei/dev | /swm_table/swm_cost_pool.sql | UTF-8 | 2,288 | 3.28125 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 4.9.0.1
-- https://www.phpmyadmin.net/
--
-- Host: localhost
-- Generation Time: Aug 15, 2019 at 02:38 PM
-- Server version: 8.0.17
-- PHP Version: 7.3.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: `tsp60_swmdb`
--
-- --------------------------------------------------------
--
-- Table structure for table `swm_cost_pool`
--
CREATE TABLE `swm_cost_pool` (
`scp_id` int(11) NOT NULL,
`scp_age_min` int(11) DEFAULT '0',
`scp_age_max` int(11) DEFAULT '99',
`scp_cost` int(11) DEFAULT NULL,
`scp_sug_id` int(11) NOT NULL,
`scp_reference` int(11) NOT NULL COMMENT 'รหัสอ้างอิงของการตั้งค่าราคาเข้าใช้',
`scp_is_active` varchar(5) NOT NULL DEFAULT 'N' COMMENT 'Y = เปิดใช้งาย , N = ปิดใช้งาน',
`scp_create_date` datetime DEFAULT CURRENT_TIMESTAMP,
`scp_update_date` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `swm_cost_pool`
--
INSERT INTO `swm_cost_pool` (`scp_id`, `scp_age_min`, `scp_age_max`, `scp_cost`, `scp_sug_id`, `scp_reference`, `scp_is_active`) VALUES
(1, 0, 17, 300, 2, 1, 'N'),
(2, 18, 99, 500, 2, 1, 'N'),
(3, 0, 17, 350, 1, 2, 'Y'),
(4, 18, 99, 550, 1, 2, 'Y'),
(6, 0, 17, 100, 2, 3, 'Y'),
(7, 18, 99, 250, 2, 3, 'Y'),
(8, 0, 17, 400, 1, 4, 'N'),
(9, 18, 99, 600, 1, 4, 'N');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `swm_cost_pool`
--
ALTER TABLE `swm_cost_pool`
ADD PRIMARY KEY (`scp_id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `swm_cost_pool`
--
ALTER TABLE `swm_cost_pool`
MODIFY `scp_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 */;
| true |
aeb2e5a5f2cd6f88742d609d73c651fc4011842f | SQL | theatheistboi/COMP-228_Assignments | /RodrigoJanuarioDaSilva_COMP228_003_W18_V4/database/Version_4.sql | UTF-8 | 429 | 2.9375 | 3 | [] | no_license | DROP TABLE Tools;
CREATE TABLE Tools (
toolID INT NOT NULL GENERATED ALWAYS AS IDENTITY,
price INT NOT NULL,
category VARCHAR (20) NOT NULL,
toolType VARCHAR (20) NOT NULL,
brand VARCHAR (20) NOT NULL,
PRIMARY KEY (toolID)
);
INSERT INTO Tools (price, category, toolType, brand)
values
(50, 'garden', 'Shovel', 'Botanica'),
(35, 'construction', 'Hammer', 'Estwing'),
(15, 'sawing', 'Needle', 'Schments');
| true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.