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
b150abcadfe8a3a18b171f1285dd78015e6bd1c7
SQL
RiazHossainFahad/admin_panel
/Backup/test.sql
UTF-8
13,572
2.953125
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 4.8.3 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Generation Time: Aug 16, 2019 at 11:16 AM -- Server version: 10.1.36-MariaDB -- PHP Version: 7.2.10 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET AUTOCOMMIT = 0; START TRANSACTION; SET time_zone = "+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: `test` -- -- -------------------------------------------------------- -- -- Table structure for table `migrations` -- CREATE TABLE `migrations` ( `id` int(10) UNSIGNED NOT NULL, `migration` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, `batch` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `migrations` -- INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (1, '2014_10_12_000000_create_users_table', 1), (2, '2014_10_12_100000_create_password_resets_table', 1), (3, '2016_06_01_000001_create_oauth_auth_codes_table', 1), (4, '2016_06_01_000002_create_oauth_access_tokens_table', 1), (5, '2016_06_01_000003_create_oauth_refresh_tokens_table', 1), (6, '2016_06_01_000004_create_oauth_clients_table', 1), (7, '2016_06_01_000005_create_oauth_personal_access_clients_table', 1), (8, '2019_08_10_195213_create_roles_table', 1), (9, '2019_08_11_022509_create_role_user_table', 1); -- -------------------------------------------------------- -- -- Table structure for table `oauth_access_tokens` -- CREATE TABLE `oauth_access_tokens` ( `id` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL, `user_id` bigint(20) DEFAULT NULL, `client_id` int(10) UNSIGNED NOT NULL, `name` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `scopes` text COLLATE utf8mb4_unicode_ci, `revoked` tinyint(1) NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL, `expires_at` datetime DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `oauth_access_tokens` -- INSERT INTO `oauth_access_tokens` (`id`, `user_id`, `client_id`, `name`, `scopes`, `revoked`, `created_at`, `updated_at`, `expires_at`) VALUES ('115707c93fa9b80f3228ba7a69f16f4b5749f6c29b978bb610c8cbd440fbeaa44916e8af7611218e', 23, 1, 'MyApp', '[]', 0, '2019-08-14 12:07:10', '2019-08-14 12:07:10', '2020-08-14 18:07:10'), ('2b7a85b3eeb35413395c9760b8edaba69f2b373e656a64c3666567b20e209c3ec8ac02a1683e1333', 67, 1, 'MyApp', '[]', 0, '2019-08-14 12:45:15', '2019-08-14 12:45:15', '2020-08-14 18:45:15'), ('2fc46f5988bbb2b63b6288c7af91ac8f20749e1549145487382c554913ed75996fdf5736fec9c682', 1, 3, 'MyApp', '[]', 0, '2019-08-16 03:03:47', '2019-08-16 03:03:47', '2020-08-16 09:03:47'), ('305ee96955a8816717ff7e29094cee7e40dbc32255e273bcdf9c82ab481d0592a6e95723f45ff2b1', 15, 1, 'MyApp', '[]', 0, '2019-08-14 11:25:08', '2019-08-14 11:25:08', '2020-08-14 17:25:08'), ('3c4546e04daf211aee3e0ed74526a9c7e2f02f9405ad22b071584fa413de6f00614244f60d2e057f', 1, 1, 'MyApp', '[]', 0, '2019-08-15 01:28:52', '2019-08-15 01:28:52', '2020-08-15 07:28:52'), ('67171d70a7d6f78890f2f79398c12b8a9a6324b377091cb2e73ccd5a544c3b68df488915ecfe3f81', 21, 1, 'MyApp', '[]', 0, '2019-08-14 11:52:39', '2019-08-14 11:52:39', '2020-08-14 17:52:39'), ('721667a90c70ff3f4acce6903f7e8196156e61eef7422ac1c71fbfe1d300f964eefc21f44d85cc11', 29, 1, 'MyApp', '[]', 0, '2019-08-14 12:38:15', '2019-08-14 12:38:15', '2020-08-14 18:38:15'), ('775186a06c0a01cd9f612fc73cb26a7e95a4f156f6ec25439c4350513f2ed097c20a463c90c2cd1b', 4, 1, 'MyApp', '[]', 0, '2019-08-11 01:10:42', '2019-08-11 01:10:42', '2020-08-11 07:10:42'), ('960e06681a4f114e1133e9478cdf8bf844630645380f79f4244836edc1a3aa368d78ace61bb2d8a6', 1, 1, 'MyApp', '[]', 0, '2019-08-15 10:57:00', '2019-08-15 10:57:00', '2020-08-15 16:57:00'), ('c4dfdd0da3893927883ff933535f2faf4f2484fc0374048e9f0ec7c26e2390dfcbebf0bad8c0bb2f', 28, 1, 'MyApp', '[]', 0, '2019-08-14 12:35:41', '2019-08-14 12:35:41', '2020-08-14 18:35:41'), ('d14a3a4f5b8f87e2fa5a284113fa72bf8b5dd46c5364604bc87e153a123767248ddcd09ad6f9b64d', 27, 1, 'MyApp', '[]', 0, '2019-08-14 12:34:20', '2019-08-14 12:34:20', '2020-08-14 18:34:20'), ('d1cd1ea497acfdf545539c4405d3ef2f361a77118502fb3da097567b3cf3ae64720e7285dcba7fb3', 25, 1, 'MyApp', '[]', 0, '2019-08-14 12:11:09', '2019-08-14 12:11:09', '2020-08-14 18:11:09'), ('e1d2da1332f1e7a6deabba939b9f040550480c15f63bbd7b31d4b71ae8b4f52815a0761d896d0fb6', 26, 1, 'MyApp', '[]', 0, '2019-08-14 12:32:41', '2019-08-14 12:32:41', '2020-08-14 18:32:41'); -- -------------------------------------------------------- -- -- Table structure for table `oauth_auth_codes` -- CREATE TABLE `oauth_auth_codes` ( `id` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL, `user_id` bigint(20) NOT NULL, `client_id` int(10) UNSIGNED NOT NULL, `scopes` text COLLATE utf8mb4_unicode_ci, `revoked` tinyint(1) NOT NULL, `expires_at` datetime DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -------------------------------------------------------- -- -- Table structure for table `oauth_clients` -- CREATE TABLE `oauth_clients` ( `id` int(10) UNSIGNED NOT NULL, `user_id` bigint(20) DEFAULT NULL, `name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, `secret` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL, `redirect` text COLLATE utf8mb4_unicode_ci NOT NULL, `personal_access_client` tinyint(1) NOT NULL, `password_client` tinyint(1) NOT NULL, `revoked` tinyint(1) NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `oauth_clients` -- INSERT INTO `oauth_clients` (`id`, `user_id`, `name`, `secret`, `redirect`, `personal_access_client`, `password_client`, `revoked`, `created_at`, `updated_at`) VALUES (1, NULL, 'Laravel Personal Access Client', '8PenAJKEzJIdnJQQJX8I6UxUWnpOrpLsg7HN8Cux', 'http://localhost', 1, 0, 0, '2019-08-10 20:31:11', '2019-08-10 20:31:11'), (2, NULL, 'Laravel Password Grant Client', 'xjd9FwjzlH3V8wra46ctVYE3povJ7Pp1gebcCLEG', 'http://localhost', 0, 1, 0, '2019-08-10 20:31:11', '2019-08-10 20:31:11'), (3, NULL, 'Laravel Personal Access Client', 'CV5dV9U9XppxFPNCKcFGnI2NAIKQyY8hDYbCnL0A', 'http://localhost', 1, 0, 0, '2019-08-16 03:03:21', '2019-08-16 03:03:21'), (4, NULL, 'Laravel Password Grant Client', '1DxRbG04IajzMWG1SUb8GoHrINHu4DU1O2WvZHcr', 'http://localhost', 0, 1, 0, '2019-08-16 03:03:21', '2019-08-16 03:03:21'); -- -------------------------------------------------------- -- -- Table structure for table `oauth_personal_access_clients` -- CREATE TABLE `oauth_personal_access_clients` ( `id` int(10) UNSIGNED NOT NULL, `client_id` int(10) UNSIGNED NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `oauth_personal_access_clients` -- INSERT INTO `oauth_personal_access_clients` (`id`, `client_id`, `created_at`, `updated_at`) VALUES (1, 1, '2019-08-10 20:31:11', '2019-08-10 20:31:11'), (2, 3, '2019-08-16 03:03:21', '2019-08-16 03:03:21'); -- -------------------------------------------------------- -- -- Table structure for table `oauth_refresh_tokens` -- CREATE TABLE `oauth_refresh_tokens` ( `id` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL, `access_token_id` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL, `revoked` tinyint(1) NOT NULL, `expires_at` datetime DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -------------------------------------------------------- -- -- Table structure for table `password_resets` -- CREATE TABLE `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 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -------------------------------------------------------- -- -- Table structure for table `roles` -- CREATE TABLE `roles` ( `id` bigint(20) UNSIGNED NOT NULL, `name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `roles` -- INSERT INTO `roles` (`id`, `name`, `created_at`, `updated_at`) VALUES (1, 'Admin', '2019-08-10 20:37:19', '2019-08-10 20:37:19'), (2, 'User', '2019-08-10 20:37:33', '2019-08-10 20:37:33'), (3, 'Super Admin', '2019-08-10 20:37:49', '2019-08-10 20:37:49'); -- -------------------------------------------------------- -- -- Table structure for table `role_user` -- CREATE TABLE `role_user` ( `user_id` bigint(20) UNSIGNED NOT NULL, `role_id` bigint(20) UNSIGNED NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `role_user` -- INSERT INTO `role_user` (`user_id`, `role_id`) VALUES (1, 1), (1, 2), (1, 3), (2, 1), (2, 2), (15, 2), (23, 2), (25, 2), (27, 1), (29, 2); -- -------------------------------------------------------- -- -- Table structure for table `users` -- CREATE TABLE `users` ( `id` bigint(20) UNSIGNED NOT NULL, `name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, `email` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, `password` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `users` -- INSERT INTO `users` (`id`, `name`, `email`, `password`, `created_at`, `updated_at`) VALUES (1, 'Fahad', 'fahad@gmail.com', '$2y$10$pNYLD1iR9QihPrAAnfSIguu5qqOXCVJtMFzIiIk5g318NULbds7Tm', '2019-08-10 20:33:42', '2019-08-10 20:33:42'), (2, 'Nihal', 'nihal@gmail.com', '$2y$10$mMhsdgMMKuw13q0gyJ.lMOMrFcYVXo33itu4mGBzoz7JhxpTAuRnO', '2019-08-10 20:34:03', '2019-08-16 03:10:23'), (15, 'new 10', 'new10@test.com', '$2y$10$wCcDoeI/M0OJrDZJ/mTQP.2XeINnT7HEtJax1k/ygjztJ3WPiidJK', '2019-08-14 11:25:07', '2019-08-14 12:47:10'), (23, 'test', 'test@test.com', '$2y$10$.KrEWjQ.YwNEMJBRziJgH.EPF.eDQRZGwGdb5Ar26qFgbfFT0shZi', '2019-08-14 12:07:10', '2019-08-14 12:07:10'), (25, 'test1', 'test1@test.com', '$2y$10$5GnXOJZM/Ghm2svvcMN9zeUyIgI2rjw1siri9.cdxH2Du1t2.NW5K', '2019-08-14 12:11:08', '2019-08-14 12:11:08'), (27, 'new', 'new1@test.com', '$2y$10$erYIN9Tcc./ZgDgGBXFESuraTMbjlFrDr6afG1jsrZfKy94fT4jtq', '2019-08-14 12:34:20', '2019-08-14 12:34:20'), (29, 'new test', 'new@test.com', '$2y$10$RvgDFZHzhwsNEMf8I.qN6usgs8Xp9qRJbnpM7TFShpN0N6NI4ba7m', '2019-08-14 12:38:15', '2019-08-14 12:38:15'); -- -- Indexes for dumped tables -- -- -- Indexes for table `migrations` -- ALTER TABLE `migrations` ADD PRIMARY KEY (`id`); -- -- Indexes for table `oauth_access_tokens` -- ALTER TABLE `oauth_access_tokens` ADD PRIMARY KEY (`id`), ADD KEY `oauth_access_tokens_user_id_index` (`user_id`); -- -- Indexes for table `oauth_auth_codes` -- ALTER TABLE `oauth_auth_codes` ADD PRIMARY KEY (`id`); -- -- Indexes for table `oauth_clients` -- ALTER TABLE `oauth_clients` ADD PRIMARY KEY (`id`), ADD KEY `oauth_clients_user_id_index` (`user_id`); -- -- Indexes for table `oauth_personal_access_clients` -- ALTER TABLE `oauth_personal_access_clients` ADD PRIMARY KEY (`id`), ADD KEY `oauth_personal_access_clients_client_id_index` (`client_id`); -- -- Indexes for table `oauth_refresh_tokens` -- ALTER TABLE `oauth_refresh_tokens` ADD PRIMARY KEY (`id`), ADD KEY `oauth_refresh_tokens_access_token_id_index` (`access_token_id`); -- -- Indexes for table `password_resets` -- ALTER TABLE `password_resets` ADD KEY `password_resets_email_index` (`email`); -- -- Indexes for table `roles` -- ALTER TABLE `roles` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `roles_name_unique` (`name`); -- -- Indexes for table `role_user` -- ALTER TABLE `role_user` ADD KEY `role_user_user_id_foreign` (`user_id`), ADD KEY `role_user_role_id_foreign` (`role_id`); -- -- Indexes for table `users` -- ALTER TABLE `users` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `users_email_unique` (`email`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `migrations` -- ALTER TABLE `migrations` MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10; -- -- AUTO_INCREMENT for table `oauth_clients` -- ALTER TABLE `oauth_clients` MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5; -- -- AUTO_INCREMENT for table `oauth_personal_access_clients` -- ALTER TABLE `oauth_personal_access_clients` MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3; -- -- AUTO_INCREMENT for table `roles` -- ALTER TABLE `roles` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; -- -- AUTO_INCREMENT for table `users` -- ALTER TABLE `users` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=32; -- -- Constraints for dumped tables -- -- -- Constraints for table `role_user` -- ALTER TABLE `role_user` ADD CONSTRAINT `role_user_role_id_foreign` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`) ON DELETE CASCADE, ADD CONSTRAINT `role_user_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE; 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
edd8a4551ec186964a25336c9e8dda560147dfc1
SQL
bdmlai/analytics_engineering_marts
/models/Redshift/fds_nplus/aggregate_intermediate/ppv_forecast/intm_ppv_current_ppv.sql
UTF-8
840
2.75
3
[]
no_license
{{ config({ "materialized": 'ephemeral' }) }} SELECT as_on_date, event_name, event_date, event_timestamp AS event_dttm, event_reporting_type, event_type, update_date FROM {{source('udl_nplus', 'raw_da_weekly_ppv_hourly_comps_new')}} WHERE update_date = ( SELECT max(update_date) FROM {{source('udl_nplus', 'raw_da_weekly_ppv_hourly_comps_new')}} ) AND as_on_date = ( SELECT max(as_on_date) FROM {{source('udl_nplus', 'raw_da_weekly_ppv_hourly_comps_new')}} ) AND EXISTS ( SELECT 1 FROM {{source('udl_nplus', 'raw_da_weekly_ppv_hourly_comps_new')}} WHERE event_date BETWEEN trunc(convert_timezone('AMERICA/NEW_YORK', sysdate -1)) AND trunc(convert_timezone('AMERICA/NEW_YORK', sysdate + 7)) AND event_type = 'current_ppv' )
true
ebcc8d8b74123c9dfff68a92776c2b16a4b356aa
SQL
chenwenbiao/Note
/JAVA/EE/Servlet/ServletDBLog4jExample/src/main/webapp/MySql_Setup.sql
UTF-8
925
3.34375
3
[]
no_license
/* 1. mysql -u root –p */ /* 2. mysql> source D:\java\Note\JAVA\EE\ServletDBLog4jExample\MySql_Setup.sql */ /* 用--注释报错 */ /* login with root to create user, DB and table and provide grants */ /* The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement ,通过FLUSH PRIVILEGES解决这个问题*/ FLUSH PRIVILEGES; create user 'xuzhijiang'@'localhost' identified by 'password'; grant all on *.* to 'xuzhijiang'@'localhost' identified by 'password'; FLUSH PRIVILEGES; drop database if exists UserDB; create database UserDB; use UserDB; CREATE TABLE `Users` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(20) NOT NULL DEFAULT '', `email` varchar(20) NOT NULL DEFAULT '', `country` varchar(20) DEFAULT 'CHINA', `password` varchar(20) NOT NULL DEFAULT '', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4;
true
841c6a70ca49ae5105186867bfa0dd88390b0450
SQL
dc-rubiano-rojas/TS-MySQL
/consultas.sql
UTF-8
598
2.90625
3
[]
no_license
CREATE TABLE heroes( id INT(11) NOT NULL, nombre VARCHAR(50) NOT NULL, poder VARCHAR(50) NOT NULL ); ALTER TABLE heroes ADD PRIMARY KEY (id); ALTER TABLE heroes MODIFY id INT(11) NOT NULL AUTO_INCREMENT; INSERT INTO heroes VALUES(default, 'Ironman', 'Dinero e Ingenieria'); INSERT INTO heroes VALUES(default,'Hulk', 'Rayos gama'); INSERT INTO heroes VALUES(default,'Warmachine', 'Ser amigo de Tony'); INSERT INTO heroes VALUES(default,'Spiderman', 'Poderes de araña'); update mysql.user set authentication_string=password(''), plugin='mysql_native_password' where user='root';
true
4286207a4600597f0c9a8079772fa6f63014bc64
SQL
kemar1997/CST_171
/GoldingCST171SP18Exam3/GoldingCST171SP18Exam3.sql
UTF-8
1,266
3.015625
3
[]
no_license
-- MySQL Workbench Forward Engineering SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0; SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0; SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES'; -- ----------------------------------------------------- -- Schema mydb -- ----------------------------------------------------- -- ----------------------------------------------------- -- Schema GoldingCST171SP18Exam3 -- ----------------------------------------------------- -- ----------------------------------------------------- -- Schema GoldingCST171SP18Exam3 -- ----------------------------------------------------- CREATE SCHEMA IF NOT EXISTS `GoldingCST171SP18Exam3` ; USE `GoldingCST171SP18Exam3` ; -- ----------------------------------------------------- -- Table `GoldingCST171SP18Exam3`.`Vocabulary` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `GoldingCST171SP18Exam3`.`Vocabulary` ( `QuestionNumberKey` INT NOT NULL, `Term` VARCHAR(50) NOT NULL, `MatchingDefinition` VARCHAR(255) NOT NULL, PRIMARY KEY (`QuestionNumberKey`)) ENGINE = InnoDB; SET SQL_MODE=@OLD_SQL_MODE; SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
true
250159b277f24b2b61a29d4c74915fae95c1a10a
SQL
prableen14/SQL-Queries-Practice
/The Report.sql
UTF-8
1,633
4.53125
5
[]
no_license
/* You are given two tables: Students and Grades. Students contains three columns ID, Name and Marks. +-------------+----------+ | Column | Type | +-------------+----------+ | ID | Integer | | Name | String | | Marks | Integer | +-------------+----------+ Grades contains the following data: +-------------+----------+------- | Grade | Min_Marks | Max_Marks | +-------------+----------+-------- | 1 | 0 | 9 | | 2 | 10 | 19 | | 3 | 20 | 29 | | 4 | 30 | 39 | | 5 | 40 | 49 | | 6 | 50 | 59 | | 7 | 60 | 69 | | 8 | 70 | 79 | | 9 | 80 | 89 | | 10 | 90 | 100 | +-------------+----------+-------+ Ketty gives Eve a task to generate a report containing three columns: Name, Grade and Mark. Ketty doesn't want the NAMES of those students who received a grade lower than 8. The report must be in descending order by grade -- i.e. higher grades are entered first. If there is more than one student with the same grade (8-10) assigned to them, order those particular students by their name alphabetically. Finally, if the grade is lower than 8, use "NULL" as their name and list them by their grades in descending order. If there is more than one student with the same grade (1-7) assigned to them, order those particular students by their marks in ascending order. */ SELECT IF(GRADE < 8, NULL, NAME), GRADE, MARKS FROM STUDENTS JOIN GRADES WHERE MARKS BETWEEN MIN_MARK AND MAX_MARK ORDER BY GRADE DESC, NAME
true
da4a7790972df867c3f9a114e5ddb1348a00ec98
SQL
AnasAzzouzi/_Oracle
/RequeteEx1.sql
UTF-8
3,062
4.25
4
[]
no_license
--CREATION --1 create table dept( deptno number(3), dname nvarchar2(50) , loc nvarchar2(50), constraint pk1 primary key(deptno), constraint ck check (dname in('ACCOUNTING','RESEARCH','SALES','OPERATIONS')) ) --2 INSERT INTO DEPT VALUES (10,'ACCOUNTING','NEW-YORK') INSERT INTO DEPT VALUES (20,'RESEARCH','DALLAS') INSERT INTO DEPT VALUES (30,'SALES','CHICAGO') INSERT INTO DEPT VALUES (40,'OPERATIONS','BOSTON') --3 CREATE TABLE EMP AS SELECT * FROM SCOTT.EMP savepoint sp_q3 --4 INSERT INTO EMP VALUES(7369,'Bidon',NULL,NULL,NULL,NULL,NULL,NULL) CET LIGNE S 'INSERE MEME S'IL N DOIT PAS PARSQUE L ID DOIT ETRE UNIQUE --5 rollback to sp_q3 --6 alter table emp add constraint ck1 primary key (empno) alter table emp add constraint fk1 foreign key (deptno) references dept(deptno) --7 insert into emp values (7369, 'WILSON', 'MANAGER', 7839, '17-NOV-91', 3500.00, 600.00, 10) ; --ne s'ajoute pas parsqu'il existe deja un employe avec cet id insert into emp values(7657, 'WILSON','MANAGER', 7839, '17-NOV-91', 3500.00, 600.00, 50); --ne s'ajoute pas parsqu'il n'existe aucun dept avec cet id insert into emp values (7657, 'WILSON', 'MANAGER', 7000,'17-NOV-91', 3500.00, 600.00, 10) ; --s'ajoute insert into emp values(7657, 'WILSON', 'MANAGER', 7839, '17-NOV-91', 3500.00,600.00, 10); --ne s'ajoute pas parsqu'il existe deja un employe avec cet id --8 savepoint sp_q8 COMMIT --Mise à jour --1 update dept set loc='PITTSBURGH' WHERE DNAME ='SALES' --2 UPDATE EMP SET SAL=SAL*1.1 where JOB='SALESMAN' AND comm>0.50*SAL --3 UPDATE EMP SET COMM= (select AVG(COMM) FROM EMP) WHERE HIREDATE<'01-JAN-82' AND COMM=NULL --4 rollback to sp_q8 --5 delete from dept where deptno=20 donne une erreur parsqu'il existe une reference de ce dept dans la table emp --Interrogation --1 select ename , sal, comm , sal+comm from emp where job='SALESMAN' --2 select ename from emp where job ='SALESMAN' ORDER BY COMM/SAL DESC --3 select ename from emp where job='SALESMAN' AND COMM<0.25*SAL --4 select COUNT(*) from emp where DEPTNO=10 --5 select COUNT(*) from emp where not(comm=null) --6 select count(distinct job) from emp --7 select job, avg(sal) from emp group by job --8 select sum(sal) from emp e, dept d where d.deptno=e.deptno and dname='SALES' --9 select ename, dname from emp e, dept d where d.deptno=e.deptno --10 select ename, dname ,sal from emp e, dept d where d.deptno=e.deptno and rownum<=2 order by sal desc --11 select ename from emp where sal >(select sal from emp where ename='JONES') --12 select ename from emp where job =(select job from emp where ename='JONES') --13 select ename from emp where mgr =(select mgr from emp where ename='CLARK') --14 select ename ,job from emp where mgr =(select mgr from emp where ename='TURNER') and job =(select job from emp where ename='TURNER') --15 select ename from emp where hiredate > all (select hiredate from emp where deptno=10) --16 select e.ename ,m.ename from emp e,emp m where e.mgr=m.empno --17 select e.ename from emp e where e.mgr not in( select empno from emp where deptno=e.deptno)
true
ce7f8639493624fa78be5eb08d0bde8d3ec7ec37
SQL
rjimenezpy/dvdrental_dwh
/Scripts/Scripobscargado.sql
UTF-8
14,774
2.71875
3
[]
no_license
-- -- PostgreSQL database dump -- -- Dumped from database version 10.6 (Ubuntu 10.6-0ubuntu0.18.04.1) -- Dumped by pg_dump version 10.6 (Ubuntu 10.6-0ubuntu0.18.04.1) -- Started on 2019-07-23 17:09:58 -04 SET statement_timeout = 0; SET lock_timeout = 0; SET idle_in_transaction_session_timeout = 0; SET client_encoding = 'UTF8'; SET standard_conforming_strings = on; SELECT pg_catalog.set_config('search_path', '', false); SET check_function_bodies = false; SET client_min_messages = warning; SET row_security = off; -- -- TOC entry 4 (class 2615 OID 17991) -- Name: ods; Type: SCHEMA; Schema: -; Owner: postgres -- CREATE SCHEMA ods; ALTER SCHEMA ods OWNER TO postgres; SET default_tablespace = ''; SET default_with_oids = false; -- -- TOC entry 251 (class 1259 OID 18757) -- Name: actor; Type: TABLE; Schema: ods; Owner: postgres -- CREATE TABLE ods.actor ( actor_id integer DEFAULT nextval('public.actor_actor_id_seq'::regclass) NOT NULL, first_name character varying(45) NOT NULL, last_name character varying(45) NOT NULL, last_update timestamp without time zone DEFAULT now() NOT NULL ); ALTER TABLE ods.actor OWNER TO postgres; -- -- TOC entry 252 (class 1259 OID 18764) -- Name: address; Type: TABLE; Schema: ods; Owner: postgres -- CREATE TABLE ods.address ( address_id integer DEFAULT nextval('public.address_address_id_seq'::regclass) NOT NULL, address character varying(50) NOT NULL, address2 character varying(50), district character varying(20) NOT NULL, city_id smallint NOT NULL, postal_code character varying(10), phone character varying(20) NOT NULL, last_update timestamp without time zone DEFAULT now() NOT NULL ); ALTER TABLE ods.address OWNER TO postgres; -- -- TOC entry 253 (class 1259 OID 18771) -- Name: category; Type: TABLE; Schema: ods; Owner: postgres -- CREATE TABLE ods.category ( category_id integer DEFAULT nextval('public.category_category_id_seq'::regclass) NOT NULL, name character varying(25) NOT NULL, last_update timestamp without time zone DEFAULT now() NOT NULL ); ALTER TABLE ods.category OWNER TO postgres; -- -- TOC entry 254 (class 1259 OID 18778) -- Name: city; Type: TABLE; Schema: ods; Owner: postgres -- CREATE TABLE ods.city ( city_id integer DEFAULT nextval('public.city_city_id_seq'::regclass) NOT NULL, city character varying(50) NOT NULL, country_id smallint NOT NULL, last_update timestamp without time zone DEFAULT now() NOT NULL ); ALTER TABLE ods.city OWNER TO postgres; -- -- TOC entry 255 (class 1259 OID 18785) -- Name: country; Type: TABLE; Schema: ods; Owner: postgres -- CREATE TABLE ods.country ( country_id integer DEFAULT nextval('public.country_country_id_seq'::regclass) NOT NULL, country character varying(50) NOT NULL, last_update timestamp without time zone DEFAULT now() NOT NULL ); ALTER TABLE ods.country OWNER TO postgres; -- -- TOC entry 256 (class 1259 OID 18792) -- Name: customer; Type: TABLE; Schema: ods; Owner: postgres -- CREATE TABLE ods.customer ( customer_id integer DEFAULT nextval('public.customer_customer_id_seq'::regclass) NOT NULL, store_id smallint NOT NULL, first_name character varying(45) NOT NULL, last_name character varying(45) NOT NULL, email character varying(50), address_id smallint NOT NULL, activebool boolean DEFAULT true NOT NULL, create_date date DEFAULT ('now'::text)::date NOT NULL, last_update timestamp without time zone DEFAULT now(), active integer ); ALTER TABLE ods.customer OWNER TO postgres; -- -- TOC entry 265 (class 1259 OID 18870) -- Name: film; Type: TABLE; Schema: ods; Owner: postgres -- CREATE TABLE ods.film ( film_id integer DEFAULT nextval('public.film_film_id_seq'::regclass) NOT NULL, title character varying(255) NOT NULL, description text, release_year public.year, language_id smallint NOT NULL, rental_duration smallint DEFAULT 3 NOT NULL, rental_rate numeric(4,2) DEFAULT 4.99 NOT NULL, length smallint, replacement_cost numeric(5,2) DEFAULT 19.99 NOT NULL, rating public.mpaa_rating DEFAULT 'G'::public.mpaa_rating, last_update timestamp without time zone DEFAULT now() NOT NULL, special_features text[], fulltext tsvector NOT NULL ); ALTER TABLE ods.film OWNER TO postgres; -- -- TOC entry 257 (class 1259 OID 18801) -- Name: film_actor; Type: TABLE; Schema: ods; Owner: postgres -- CREATE TABLE ods.film_actor ( actor_id smallint NOT NULL, film_id smallint NOT NULL, last_update timestamp without time zone DEFAULT now() NOT NULL ); ALTER TABLE ods.film_actor OWNER TO postgres; -- -- TOC entry 258 (class 1259 OID 18807) -- Name: film_category; Type: TABLE; Schema: ods; Owner: postgres -- CREATE TABLE ods.film_category ( film_id smallint NOT NULL, category_id smallint NOT NULL, last_update timestamp without time zone DEFAULT now() NOT NULL ); ALTER TABLE ods.film_category OWNER TO postgres; -- -- TOC entry 259 (class 1259 OID 18813) -- Name: inventory; Type: TABLE; Schema: ods; Owner: postgres -- CREATE TABLE ods.inventory ( inventory_id integer DEFAULT nextval('public.inventory_inventory_id_seq'::regclass) NOT NULL, film_id smallint NOT NULL, store_id smallint NOT NULL, last_update timestamp without time zone DEFAULT now() NOT NULL ); ALTER TABLE ods.inventory OWNER TO postgres; -- -- TOC entry 260 (class 1259 OID 18820) -- Name: language; Type: TABLE; Schema: ods; Owner: postgres -- CREATE TABLE ods.language ( language_id integer DEFAULT nextval('public.language_language_id_seq'::regclass) NOT NULL, name character(20) NOT NULL, last_update timestamp without time zone DEFAULT now() NOT NULL ); ALTER TABLE ods.language OWNER TO postgres; -- -- TOC entry 261 (class 1259 OID 18827) -- Name: payment; Type: TABLE; Schema: ods; Owner: postgres -- CREATE TABLE ods.payment ( payment_id integer DEFAULT nextval('public.payment_payment_id_seq'::regclass) NOT NULL, customer_id smallint NOT NULL, staff_id smallint NOT NULL, rental_id integer NOT NULL, amount numeric(5,2) NOT NULL, payment_date timestamp without time zone NOT NULL ); ALTER TABLE ods.payment OWNER TO postgres; -- -- TOC entry 262 (class 1259 OID 18833) -- Name: rental; Type: TABLE; Schema: ods; Owner: postgres -- CREATE TABLE ods.rental ( rental_id integer DEFAULT nextval('public.rental_rental_id_seq'::regclass) NOT NULL, rental_date timestamp without time zone NOT NULL, inventory_id integer NOT NULL, customer_id smallint NOT NULL, return_date timestamp without time zone, staff_id smallint NOT NULL, last_update timestamp without time zone DEFAULT now() NOT NULL ); ALTER TABLE ods.rental OWNER TO postgres; -- -- TOC entry 263 (class 1259 OID 18840) -- Name: staff; Type: TABLE; Schema: ods; Owner: postgres -- CREATE TABLE ods.staff ( staff_id integer DEFAULT nextval('public.staff_staff_id_seq'::regclass) NOT NULL, first_name character varying(45) NOT NULL, last_name character varying(45) NOT NULL, address_id smallint NOT NULL, email character varying(50), store_id smallint NOT NULL, active boolean DEFAULT true NOT NULL, username character varying(16) NOT NULL, password character varying(40), last_update timestamp without time zone DEFAULT now() NOT NULL, picture bytea ); ALTER TABLE ods.staff OWNER TO postgres; -- -- TOC entry 264 (class 1259 OID 18851) -- Name: store; Type: TABLE; Schema: ods; Owner: postgres -- CREATE TABLE ods.store ( store_id integer DEFAULT nextval('public.store_store_id_seq'::regclass) NOT NULL, manager_staff_id smallint NOT NULL, address_id smallint NOT NULL, last_update timestamp without time zone DEFAULT now() NOT NULL ); ALTER TABLE ods.store OWNER TO postgres; -- -- TOC entry 3187 (class 0 OID 18757) -- Dependencies: 251 -- Data for Name: actor; Type: TABLE DATA; Schema: ods; Owner: postgres -- COPY ods.actor (actor_id, first_name, last_name, last_update) FROM stdin; \. -- -- TOC entry 3188 (class 0 OID 18764) -- Dependencies: 252 -- Data for Name: address; Type: TABLE DATA; Schema: ods; Owner: postgres -- COPY ods.address (address_id, address, address2, district, city_id, postal_code, phone, last_update) FROM stdin; \. -- -- TOC entry 3189 (class 0 OID 18771) -- Dependencies: 253 -- Data for Name: category; Type: TABLE DATA; Schema: ods; Owner: postgres -- COPY ods.category (category_id, name, last_update) FROM stdin; \. -- -- TOC entry 3190 (class 0 OID 18778) -- Dependencies: 254 -- Data for Name: city; Type: TABLE DATA; Schema: ods; Owner: postgres -- COPY ods.city (city_id, city, country_id, last_update) FROM stdin; \. -- -- TOC entry 3191 (class 0 OID 18785) -- Dependencies: 255 -- Data for Name: country; Type: TABLE DATA; Schema: ods; Owner: postgres -- COPY ods.country (country_id, country, last_update) FROM stdin; \. -- -- TOC entry 3192 (class 0 OID 18792) -- Dependencies: 256 -- Data for Name: customer; Type: TABLE DATA; Schema: ods; Owner: postgres -- COPY ods.customer (customer_id, store_id, first_name, last_name, email, address_id, activebool, create_date, last_update, active) FROM stdin; \. -- -- TOC entry 3201 (class 0 OID 18870) -- Dependencies: 265 -- Data for Name: film; Type: TABLE DATA; Schema: ods; Owner: postgres -- COPY ods.film (film_id, title, description, release_year, language_id, rental_duration, rental_rate, length, replacement_cost, rating, last_update, special_features, fulltext) FROM stdin; \. -- -- TOC entry 3193 (class 0 OID 18801) -- Dependencies: 257 -- Data for Name: film_actor; Type: TABLE DATA; Schema: ods; Owner: postgres -- COPY ods.film_actor (actor_id, film_id, last_update) FROM stdin; \. -- -- TOC entry 3194 (class 0 OID 18807) -- Dependencies: 258 -- Data for Name: film_category; Type: TABLE DATA; Schema: ods; Owner: postgres -- COPY ods.film_category (film_id, category_id, last_update) FROM stdin; \. -- -- TOC entry 3195 (class 0 OID 18813) -- Dependencies: 259 -- Data for Name: inventory; Type: TABLE DATA; Schema: ods; Owner: postgres -- COPY ods.inventory (inventory_id, film_id, store_id, last_update) FROM stdin; \. -- -- TOC entry 3196 (class 0 OID 18820) -- Dependencies: 260 -- Data for Name: language; Type: TABLE DATA; Schema: ods; Owner: postgres -- COPY ods.language (language_id, name, last_update) FROM stdin; \. -- -- TOC entry 3197 (class 0 OID 18827) -- Dependencies: 261 -- Data for Name: payment; Type: TABLE DATA; Schema: ods; Owner: postgres -- COPY ods.payment (payment_id, customer_id, staff_id, rental_id, amount, payment_date) FROM stdin; \. -- -- TOC entry 3198 (class 0 OID 18833) -- Dependencies: 262 -- Data for Name: rental; Type: TABLE DATA; Schema: ods; Owner: postgres -- COPY ods.rental (rental_id, rental_date, inventory_id, customer_id, return_date, staff_id, last_update) FROM stdin; \. -- -- TOC entry 3199 (class 0 OID 18840) -- Dependencies: 263 -- Data for Name: staff; Type: TABLE DATA; Schema: ods; Owner: postgres -- COPY ods.staff (staff_id, first_name, last_name, address_id, email, store_id, active, username, password, last_update, picture) FROM stdin; \. -- -- TOC entry 3200 (class 0 OID 18851) -- Dependencies: 264 -- Data for Name: store; Type: TABLE DATA; Schema: ods; Owner: postgres -- COPY ods.store (store_id, manager_staff_id, address_id, last_update) FROM stdin; \. -- -- TOC entry 3030 (class 2606 OID 18763) -- Name: actor actor_pkey; Type: CONSTRAINT; Schema: ods; Owner: postgres -- ALTER TABLE ONLY ods.actor ADD CONSTRAINT actor_pkey PRIMARY KEY (actor_id); -- -- TOC entry 3032 (class 2606 OID 18770) -- Name: address address_pkey; Type: CONSTRAINT; Schema: ods; Owner: postgres -- ALTER TABLE ONLY ods.address ADD CONSTRAINT address_pkey PRIMARY KEY (address_id); -- -- TOC entry 3034 (class 2606 OID 18777) -- Name: category category_pkey; Type: CONSTRAINT; Schema: ods; Owner: postgres -- ALTER TABLE ONLY ods.category ADD CONSTRAINT category_pkey PRIMARY KEY (category_id); -- -- TOC entry 3036 (class 2606 OID 18784) -- Name: city city_pkey; Type: CONSTRAINT; Schema: ods; Owner: postgres -- ALTER TABLE ONLY ods.city ADD CONSTRAINT city_pkey PRIMARY KEY (city_id); -- -- TOC entry 3038 (class 2606 OID 18791) -- Name: country country_pkey; Type: CONSTRAINT; Schema: ods; Owner: postgres -- ALTER TABLE ONLY ods.country ADD CONSTRAINT country_pkey PRIMARY KEY (country_id); -- -- TOC entry 3040 (class 2606 OID 18800) -- Name: customer customer_pkey; Type: CONSTRAINT; Schema: ods; Owner: postgres -- ALTER TABLE ONLY ods.customer ADD CONSTRAINT customer_pkey PRIMARY KEY (customer_id); -- -- TOC entry 3042 (class 2606 OID 18806) -- Name: film_actor film_actor_pkey; Type: CONSTRAINT; Schema: ods; Owner: postgres -- ALTER TABLE ONLY ods.film_actor ADD CONSTRAINT film_actor_pkey PRIMARY KEY (actor_id, film_id); -- -- TOC entry 3044 (class 2606 OID 18812) -- Name: film_category film_category_pkey; Type: CONSTRAINT; Schema: ods; Owner: postgres -- ALTER TABLE ONLY ods.film_category ADD CONSTRAINT film_category_pkey PRIMARY KEY (film_id, category_id); -- -- TOC entry 3058 (class 2606 OID 18883) -- Name: film film_pkey; Type: CONSTRAINT; Schema: ods; Owner: postgres -- ALTER TABLE ONLY ods.film ADD CONSTRAINT film_pkey PRIMARY KEY (film_id); -- -- TOC entry 3046 (class 2606 OID 18819) -- Name: inventory inventory_pkey; Type: CONSTRAINT; Schema: ods; Owner: postgres -- ALTER TABLE ONLY ods.inventory ADD CONSTRAINT inventory_pkey PRIMARY KEY (inventory_id); -- -- TOC entry 3048 (class 2606 OID 18826) -- Name: language language_pkey; Type: CONSTRAINT; Schema: ods; Owner: postgres -- ALTER TABLE ONLY ods.language ADD CONSTRAINT language_pkey PRIMARY KEY (language_id); -- -- TOC entry 3050 (class 2606 OID 18832) -- Name: payment payment_pkey; Type: CONSTRAINT; Schema: ods; Owner: postgres -- ALTER TABLE ONLY ods.payment ADD CONSTRAINT payment_pkey PRIMARY KEY (payment_id); -- -- TOC entry 3052 (class 2606 OID 18839) -- Name: rental rental_pkey; Type: CONSTRAINT; Schema: ods; Owner: postgres -- ALTER TABLE ONLY ods.rental ADD CONSTRAINT rental_pkey PRIMARY KEY (rental_id); -- -- TOC entry 3054 (class 2606 OID 18850) -- Name: staff staff_pkey; Type: CONSTRAINT; Schema: ods; Owner: postgres -- ALTER TABLE ONLY ods.staff ADD CONSTRAINT staff_pkey PRIMARY KEY (staff_id); -- -- TOC entry 3056 (class 2606 OID 18857) -- Name: store store_pkey; Type: CONSTRAINT; Schema: ods; Owner: postgres -- ALTER TABLE ONLY ods.store ADD CONSTRAINT store_pkey PRIMARY KEY (store_id); -- Completed on 2019-07-23 17:09:58 -04 -- -- PostgreSQL database dump complete --
true
e67a858c1ab621ca42b13e33e84e769f5220d147
SQL
vonguyenquan/NMCNPM
/QLSTK.sql
UTF-8
1,598
3.734375
4
[]
no_license
create database QLSTK use QLSTK create table Customers ( CustomerID char(5) primary key not null, FullName varchar(30), Addr varchar(50), IdNumber char(13) ) create table Books ( BookID char(5) primary key not null, CustomerID char(5), ServiceType smallint, StartedDay smalldatetime, Amount money ) create table Transactions ( TransactionID char(10) primary key not null, CustomerID char(5), BookID char(5), Deposite money, Withdraw money ) create table ServiceTypes ( ServiceType smallint primary key not null, InterestRate real, Period smallint, ) insert into ServiceTypes(ServiceType, InterestRate, Period) values (0, 0.15, 1); insert into ServiceTypes(ServiceType, InterestRate, Period) values (1, 0.5, 3); insert into ServiceTypes(ServiceType, InterestRate, Period) values (2, 0.55, 6); create table Accounts ( AccName varchar(16) primary key not null, Pass varchar(16), AccType char(1) ) insert into Accounts(AccName, Pass, AccType) values ('admin', 'admin', 'f'); insert into Accounts(AccName, Pass, AccType) values ('user', 'user', 'n'); alter table Books add constraint FK_CustID_Cus_Books foreign key (CustomerID) references Customers(CustomerID); alter table Books add constraint FK_ServType_ServTypes_Books foreign key (ServiceType) references ServiceTypes(ServiceType); alter table Transactions add constraint FK_CustID_Cus_Transac foreign key (CustomerID) references Customers(CustomerID); alter table Transactions add constraint FK_BookID_Books_Transac foreign key (BookID) references Books(BookID);
true
e996656428ef0d5c5e1da22c3836853215e065fe
SQL
seojinkim/bank
/bank/src/main/resources/com/bank/web/sql/member.sql
UTF-8
548
2.609375
3
[]
no_license
select * from test; -- 실행 단축키 : ALT + X SELECT * FROM member; drop table member; CREATE TABLE member( userid VARCHAR2(30) PRIMARY KEY, name VARCHAR2(30), password VARCHAR2(30), addr VARCHAR2(30), birth NUMBER ); INSERT INTO member(userid,name,password,addr,birth) VALUES ('kim','김유신','1','서울',2000); INSERT INTO member(userid,name,password,addr,birth) VALUES ('lee','이순신','1','안양',1995); INSERT INTO member(userid,name,password,addr,birth) VALUES ('kang','강감찬','1','인천',2005);
true
30bdeeba4fc96801d145abcab804211fb4db558f
SQL
lulzzz/tellma
/Tellma.Database.Application/rpt/Stored Procedures/rpt.BankAccounts__Unreconciled.sql
UTF-8
2,462
4.375
4
[ "Apache-2.0" ]
permissive
CREATE PROCEDURE [rpt].[BankAccounts__Unreconciled] @AsOfDate DATE = NULL AS SET @AsOfDate = ISNULL(@AsOfDate, CAST(GETDATE() AS DATE)); WITH BankAccounts AS ( SELECT [Id] FROM dbo.Accounts WHERE AccountTypeId IN ( SELECT [Id] FROM dbo.AccountTypes WHERE [Concept] = N'BalancesWithBanks' ) ), LastExternalEntriesPostingDate AS ( SELECT EE.[AgentId], AG.[ExternalReference], MAX(EE.[PostingDate]) AS BankLastDate FROM dbo.ExternalEntries EE JOIN dbo.[Agents] AG ON AG.[Id] = EE.[AgentId] JOIN dbo.[AgentDefinitions] AGD ON AGD.[Id] = AG.[DefinitionId] WHERE AGD.[Code] = N'BankAccount' GROUP BY EE.[AgentId], AG.[ExternalReference] ) SELECT COALESCE(TE.[Name], TEE.[Name]) AS BankAccount, TE.UnreconciledEntriesCount, FORMAT(TE.MaxEntriesAmount, 'N0', 'en-us') AS MaxBookAmount, TEE.UnreconciledExternalEntriesCount, FORMAT(TEE.MaxExternalEntriesAmount, 'N0', 'en-us') AS MaxBankAmount, LEPD.[ExternalReference] AS [Account Number], LEPD.BankLastDate FROM ( SELECT E.[AgentId], AG.[Name], UnreconciledEntriesCount = COUNT(*), MaxEntriesAmount = MAX(E.[MonetaryValue]) FROM dbo.Entries E JOIN dbo.[Agents] AG ON E.[AgentId] = AG.[Id] JOIN dbo.Lines L ON E.[LineId] = L.[Id] LEFT JOIN ( SELECT DISTINCT RE.[EntryId] FROM dbo.ReconciliationEntries RE JOIN dbo.Reconciliations R ON RE.ReconciliationId = R.Id JOIN dbo.ReconciliationExternalEntries REE ON REE.ReconciliationId = R.Id JOIN dbo.ExternalEntries EE ON REE.ExternalEntryId = EE.Id WHERE EE.PostingDate <= @AsOfDate ) T ON T.[EntryId] = E.[Id] WHERE T.[EntryId] IS NULL AND E.AccountId IN (SELECT [Id] FROM BankAccounts) AND L.[State] = 4 AND L.[PostingDate] <= @AsOfDate GROUP BY E.[AgentId], AG.[Name] ) TE FULL OUTER JOIN ( SELECT E.[AgentId], AG.[Name], UnreconciledExternalEntriesCount = COUNT(*), MaxExternalEntriesAmount = MAX(E.[MonetaryValue]) FROM dbo.ExternalEntries E JOIN dbo.[Agents] AG ON E.[AgentId] = AG.[Id] WHERE E.[Id] NOT IN (SELECT [ExternalEntryId] FROM dbo.ReconciliationExternalEntries) AND E.AccountId IN (SELECT [Id] FROM BankAccounts) AND E.[PostingDate] <= @AsOfDate GROUP BY E.[AgentId], AG.[Name] ) TEE ON TE.[AgentId] = TEE.[AgentId] JOIN LastExternalEntriesPostingDate LEPD ON LEPD.[AgentId] = COALESCE(TE.[AgentId], TEE.[AgentId]) ORDER BY ISNULL([UnreconciledExternalEntriesCount], 0) + ISNULL([UnreconciledEntriesCount], 0) DESC;
true
54f6b386fa82bfad14a75ab0bebb0813a9164961
SQL
biddingLV/BiddingBaltic
/BiddingDatabase/Stored Procedures/BID_GetSubCategoriesWithCount.sql
UTF-8
462
4.09375
4
[]
no_license
CREATE PROCEDURE BID_GetSubCategoriesWithCount AS BEGIN SELECT typ.AuctionCategoryId AS CategoryId, typ.TypeId, typ.Name AS TypeName, SUM( CASE WHEN auct.AuctionTypeId = typ.TypeId AND (auct.EndDate >= CONVERT(date, GETDATE())) THEN 1 ELSE 0 END) AS TypeTotalCount FROM Types typ LEFT JOIN Auctions auct ON typ.TypeId = auct.AuctionTypeId GROUP BY typ.TypeId, typ.Name, typ.AuctionCategoryId; END;
true
84d337cea99d13d23ac0f4c4984d9e86802121b6
SQL
hedg-r52/job4j
/chapter_009/db/scripts/update_001.sql
UTF-8
1,654
3.4375
3
[ "Apache-2.0" ]
permissive
create table countries( id serial primary key, title varchar(50) ); create table cities( id serial primary key, title varchar(50), countries_id integer references countries(id) ); insert into countries (title) values ('Russia'), ('Germany'), ('United Kingdom'), ('Italy'); insert into cities(title, countries_id) values ('Moscow', 1), ('Saint-Petersburg', 1), ('Nižnij Novgorod', 1), ('Kazan', 1), ('Berlin', 2), ('Hamburg', 2), ('London', 3), ('Liverpool', 3), ('Rome', 4), ('Milan', 4); create table users ( id serial primary key, name varchar(50), login varchar(50) unique not null, email varchar(50), password varchar(50), role varchar(20), created timestamp, country integer references countries(id), city integer references cities(id) ); insert into users (name, login, email, password, role, created, country, city) values ('root', 'root', 'root@nomail.ru', 'root', 'administrator', now(), 1, 1); insert into users (name, login, email, password, role, created, country, city) values ('bob', 'bob', 'bob@nomail.ru', 'bob', 'user', now(), 1, 1); insert into users (name, login, email, password, role, created, country, city) values ('silvia', 'silvia', 'silvia@nomail.ru', 'silvia', 'user', now(), 1, 1); insert into users (name, login, email, password, role, created, country, city) values ('covax', 'covax', 'covax@nomail.ru', 'covax', 'user', now(), 1, 1);
true
1a0085aad48ed3f88e32cbbfaa8095f68dbcca8f
SQL
valerienierenberg/holbertonschool-higher_level_programming
/0x0E-SQL_more_queries/101-not_a_comedy.sql
UTF-8
162
2.859375
3
[]
no_license
--script that lists all Comedy shows in the database hbtn_0d_tvshows. SELECT tv_genres.name AS genre; FROM tv_show_genres; ORDER BY tv_show_genres.tv_genres ASC;
true
b6e5866637344fe35413b5d06727498899af6794
SQL
IsFilimonov/Interviews
/CodeWars/PostgreSQL/011-Is_n_divisible_by_x_and_y?.sql
UTF-8
209
2.953125
3
[ "MIT" ]
permissive
SELECT id, CASE WHEN mod(n, x) = 0 AND mod(n, y) = 0 THEN TRUE ELSE FALSE END AS res FROM kata; --BEST PRACTICE --SELECT id, n % x = 0 AND n % y = 0 AS res --FROM kata;
true
2d1228cce370898c457317d4a8e1d437959df98c
SQL
hanbinggary/TestCaseNet
/flask/flaskr/db/schema.sql
UTF-8
1,116
3.09375
3
[]
no_license
DROP TABLE IF EXISTS TestCase CREATE TABLE TestCase ( caseId INT PRIMARY KEY AUTO_INCREMENT, peoType INT NOT NULL, name CHAR(50) NOT NULL, level INT NOT NULL, entry CHAR(50) NOT NULL, conditionInfo CHAR(50) NOT NULL, executeInfo CHAR(50) NOT NULL, ps CHAR(50) NOT NULL, changeDate DATETIME NOT NULL, changePeo INT NOT NULL, actionPeo INT NOT NULL, actionedPeo INT NOT NULL, actionDate DATETIME NOT NULL, definedType INT NOT NULL, tag CHAR(20) NOT NULL, caseType INT NOT NULL, fatherFile CHAR(50) NOT NULL, state INT NOT NULL ); DROP TABLE IF EXISTS user; DROP TABLE IF EXISTS post; CREATE TABLE user ( id INTEGER PRIMARY KEY AUTOINCREMENT, username TEXT UNIQUE NOT NULL, password TEXT NOT NULL ); CREATE TABLE post ( id INTEGER PRIMARY KEY AUTOINCREMENT, author_id INTEGER NOT NULL, created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, title TEXT NOT NULL, body TEXT NOT NULL, FOREIGN KEY (author_id) REFERENCES user (id) );
true
5cf3cbb5f3630377c2d85da05df066c5ceb84f72
SQL
rahmat141/eprint
/db/dprint (5).sql
UTF-8
12,431
2.953125
3
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
-- phpMyAdmin SQL Dump -- version 5.1.0 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Generation Time: May 02, 2021 at 10:42 AM -- Server version: 10.4.18-MariaDB -- PHP Version: 7.3.27 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: `dprint` -- -- -------------------------------------------------------- -- -- Table structure for table `barang` -- CREATE TABLE `barang` ( `idbarang` int(11) NOT NULL, `nama` text NOT NULL, `keterangan` text NOT NULL, `harga` int(11) NOT NULL, `stok` int(11) NOT NULL, `kategori` text NOT NULL, `foto` text NOT NULL, `owner` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `barang` -- INSERT INTO `barang` (`idbarang`, `nama`, `keterangan`, `harga`, `stok`, `kategori`, `foto`, `owner`) VALUES (27, 'Baju kaos', 'Baju lengan pendek polos', 55000, 500, 'Baju', 'OIP.jpg', 19), (28, 'Celana ', 'Celana pendek polos', 30000, 2000, 'Celana', 'OIPLC4BMRRP.jpg', 19), (29, 'Portofolio Sidu', 'Kertas fortofolio 1 rim', 65000, 200, 'Kertas', 'kertas.jpg', 27), (30, 'Pin', 'Pin bundar, sesuai gambar', 3000, 5000, 'Pin', 'pin.jpg', 27), (31, 'Stiker ', 'Gambar stiker dapat di rikwes ukuran 15x15cm ', 2000, 500, 'Sticker', 'stiker.jpg', 27), (32, 'Topi', 'Topi berwarna hitam polos', 15000, 200, 'Topi', 'topihitam.jpg', 19), (33, 'Topi Putih', 'Topi berwarna putih polos polos', 18000, 350, 'Topi', 'topi_putih.jpg', 20), (34, 'Pin', 'Pin perangkat desa', 55000, 100, 'Pin', 'download11.jpg', 20), (35, 'Stiker Desain', 'Stiker berbahan tebal dan lem tidak mudah hilang', 17000, 370, 'Sticker', 'download_(1)1.jpg', 20), (36, 'Kertas binder', 'Kertas berukuran A5, di jual dalam 1 pak isi 200 lembar', 35000, 400, 'Kertas', 'download_(2)1.jpg', 21), (37, 'Celana training wanita', 'Celana panjang dewasa wanita', 65000, 600, 'Celana', 'images.jpg', 21), (38, 'Baju berkera', 'Baju ukuran dewasa', 80000, 5000, 'Baju', 'download_(3).jpg', 21), (39, 'Spanduk', 'Spanduk ini terbuat dari kertas yang tahan air, ukuran 3x6m', 50000, 200, 'Kertas', '5777883_370c3753-8f0d-405b-a420-89ecdc8b6f19_2048_0.jpg', 25), (40, 'Baju olahraga muslim', 'Baju ini memiliki panjang hingga di atas lutut, kami menjualnya 1 pasang dengan celanan', 155000, 500, 'Baju', 'download_(4).jpg', 25), (41, 'Pin berbentuk', 'Pin anggota DPRD', 30000, 5000, 'Pin', 'images_(1).jpg', 25), (42, 'Kaos Kaki', 'Ukuran dewasa batas mata kaki', 3000, 7000, 'Baju', 'WhatsApp_Image_2020-05-03_at_22_13_14.jpeg', 19); -- -------------------------------------------------------- -- -- Table structure for table `feedback` -- CREATE TABLE `feedback` ( `id_feedback` int(11) NOT NULL, `nama_pemesan` varchar(250) NOT NULL, `bintang` int(11) DEFAULT 5, `keterangan` varchar(250) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `feedback` -- INSERT INTO `feedback` (`id_feedback`, `nama_pemesan`, `bintang`, `keterangan`) VALUES (1, 'Vera', 5, 'WOW hasilnya bagus banget deh'), (2, 'Fau', 4, 'Bagus !'); -- -------------------------------------------------------- -- -- Table structure for table `kategori` -- CREATE TABLE `kategori` ( `id_kategori` int(11) NOT NULL, `nama_kategori` varchar(250) NOT NULL, `gambar_kategori` varchar(250) NOT NULL, `list_paket` varchar(250) NOT NULL, `mulai_harga` varchar(250) DEFAULT '0' ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `kategori` -- INSERT INTO `kategori` (`id_kategori`, `nama_kategori`, `gambar_kategori`, `list_paket`, `mulai_harga`) VALUES (1, 'TShirt', 'tshirt.jpeg', 'tshirt.png', '125.000 - 175.000'), (2, 'Almamater', 'almet.jpeg', 'almamater.png', ''), (3, 'Jaket', 'jaket.jpeg', 'jaket.png', ''), (4, 'Polo', 'polo.jpeg', 'polo.png', ''), (5, 'Hoodie', 'hoodie.jpeg', 'hoodie.png', ''), (6, 'Kaos Lapangan', 'kaoslapangan.jpeg', 'rompi.png', ''), (7, 'Jersey', 'jersey.jpeg', 'jersey.png', ''), (8, 'Jas', 'jaz.jpeg', 'jas.png', ''); -- -------------------------------------------------------- -- -- Table structure for table `pakaiian` -- CREATE TABLE `pakaiian` ( `id_pakaiian` int(11) NOT NULL, `id_kategori` int(250) NOT NULL, `paket` varchar(250) NOT NULL, `kelas` varchar(250) NOT NULL, `jenis_bahan` varchar(250) NOT NULL, `jenis_bordir` varchar(250) NOT NULL, `kategori_jersey` varchar(250) NOT NULL, `jenis_sablon` varchar(250) NOT NULL, `ketebalan` varchar(250) NOT NULL, `harga` int(250) NOT NULL, `keterangan` varchar(250) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `pakaiian` -- INSERT INTO `pakaiian` (`id_pakaiian`, `id_kategori`, `paket`, `kelas`, `jenis_bahan`, `jenis_bordir`, `kategori_jersey`, `jenis_sablon`, `ketebalan`, `harga`, `keterangan`) VALUES (1, 2, 'Paket 1 ', 'Sultan', 'Toyobo + Cotton', 'Bordir Computer', '', '', '', 175000, 'Free Design'), (2, 1, 'Paket 2 ', 'Medium', 'Cotton Toto', '', '', 'Rubber', '20s', 68000, 'Free Design KK'), (3, 1, 'Paket 3 ', 'Medium', 'Cotton', 'Bordir HP', '', 'rubber', '20s', 60000, 'free design'), (4, 2, 'Paket 2', 'Reguler', 'Cotton', 'Bordir', '', 'rubber', '20s', 52000, 'free design'); -- -------------------------------------------------------- -- -- Table structure for table `pembayaran` -- CREATE TABLE `pembayaran` ( `id_bayar` int(11) NOT NULL, `id_user` int(11) NOT NULL, `tanggal_bayar` varchar(250) NOT NULL, `total_bayar` int(250) NOT NULL, `nama_pemesan` varchar(250) NOT NULL, `email` varchar(250) NOT NULL, `phone` varchar(250) NOT NULL, `alamat_rumah` varchar(250) NOT NULL, `jenis_bayar` int(11) NOT NULL, `bukti_bayar` varchar(250) NOT NULL, `bukti_dp` varchar(250) DEFAULT NULL, `notes` varchar(250) NOT NULL, `penilaiian` int(12) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -------------------------------------------------------- -- -- Table structure for table `pemesanan` -- CREATE TABLE `pemesanan` ( `id_pesanan` int(11) NOT NULL, `id_barang` int(11) NOT NULL, `id_kategori` int(11) NOT NULL, `ukuran_s` int(11) NOT NULL, `ukuran_m` int(11) NOT NULL, `ukuran_l` int(11) NOT NULL, `ukuran_xl` int(11) NOT NULL, `ukuran_xxl` int(11) NOT NULL, `ukuran_3xl` int(11) NOT NULL, `jumlah_barang` int(11) NOT NULL, `harga_paket` int(11) NOT NULL, `total_harga` int(250) NOT NULL, `status_pesanan` varchar(250) NOT NULL, `tanggal_checkout` date DEFAULT NULL, `desain_produk` varchar(250) NOT NULL, `id_user` int(11) NOT NULL, `id_bayar` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -------------------------------------------------------- -- -- Table structure for table `postingan` -- CREATE TABLE `postingan` ( `id_posting` int(11) NOT NULL, `gambar` varchar(250) NOT NULL, `gambar2` varchar(250) NOT NULL, `id_kategori` int(11) NOT NULL, `jenis` varchar(250) NOT NULL, `caption` varchar(250) NOT NULL, `tanggal_upload` date NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `postingan` -- INSERT INTO `postingan` (`id_posting`, `gambar`, `gambar2`, `id_kategori`, `jenis`, `caption`, `tanggal_upload`) VALUES (1, '60153a45c4584.jpg', 'ts1.png', 1, 'T-Shrit Impos', 'Ketika kamu jadi impostor tapi kamu bukan jadi suspect be like? mungkin among us sedang booming boomingnya bulan bulan kemarin, tapi ternyata hingga saat ini masih banyak juga loh yang main among us...', '2020-11-05'), (2, '60154b623f832.jpg', '60154b95300d9.jpg', 2, 'Almamater keren cuy', 'Ketika kamu jadi impostor tapi kamu bukan jadi suspect be like? mungkin among us sedang booming boomingnya bulan bulan kemarin, tapi ternyata hingga saat ini masih banyak juga loh yang main among us...', '2020-11-05'), (5, '601cf59eefcdb.jpg', '', 1, 'T Shirt wow keren banget', 'OK', '0000-00-00'); -- -------------------------------------------------------- -- -- Table structure for table `role` -- CREATE TABLE `role` ( `role_id` int(11) NOT NULL, `jenis_pengguna` varchar(250) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `role` -- INSERT INTO `role` (`role_id`, `jenis_pengguna`) VALUES (1, 'Siswa'), (2, 'Mahasiswa'), (3, 'Pekerja'), (4, 'Masyarakat Biasa'); -- -------------------------------------------------------- -- -- Table structure for table `user` -- CREATE TABLE `user` ( `id_user` int(11) NOT NULL, `role_id` int(11) NOT NULL, `username` varchar(255) NOT NULL, `email` varchar(255) NOT NULL, `password` varchar(255) NOT NULL, `alamat` varchar(255) NOT NULL, `created_at` varchar(255) NOT NULL, `status` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `user` -- INSERT INTO `user` (`id_user`, `role_id`, `username`, `email`, `password`, `alamat`, `created_at`, `status`) VALUES (2, 1, 'Farhan', 'farhando1123@gmail.com', '$2y$10$J3l2QCYtuxKJPJ3QzMW70ebsZV1UT1Q93WNP.J6z8cTurkpL8pJUy', '', '15-11-2020, 06:44:04', 1), (3, 5, 'desy', 'desyRahmat@gmail.com', '$2y$10$J3l2QCYtuxKJPJ3QzMW70ebsZV1UT1Q93WNP.J6z8cTurkpL8pJUy', 'Bandung Barat', '15-11-2020, 09:01:55', 1), (4, 2, 'vera', 'veraardianipertiwi@gmail.com', '$2y$10$Nl/u4RBc.Hfsi7KalkCs2u/Ocd9.f6plwM3QkPqCQhkvcdYH95R16', 'Bandung', '08-12-2020, 12:28:46', 1), (13, 2, 'ikko', 'm.abizard1123@gmail.com', '$2y$10$uv08QQNurfwpmKUm6E1jTeQ6DNJEFlrVYtIabTiLM3caA51u1QRuy', '', '11-02-2021, 06:19:18', 1); -- -------------------------------------------------------- -- -- Table structure for table `user_token` -- CREATE TABLE `user_token` ( `id` int(11) NOT NULL, `email` varchar(128) NOT NULL, `token` varchar(128) NOT NULL, `date_created` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `user_token` -- INSERT INTO `user_token` (`id`, `email`, `token`, `date_created`) VALUES (1, 'm.abizard1123@gmail.com', 'OtxQM5uyFDW2Yx8WIofzq37CilvYkRkOuX+N1B0bCVM=', 1619500159); -- -- Indexes for dumped tables -- -- -- Indexes for table `barang` -- ALTER TABLE `barang` ADD PRIMARY KEY (`idbarang`); -- -- Indexes for table `feedback` -- ALTER TABLE `feedback` ADD PRIMARY KEY (`id_feedback`); -- -- Indexes for table `kategori` -- ALTER TABLE `kategori` ADD PRIMARY KEY (`id_kategori`); -- -- Indexes for table `pakaiian` -- ALTER TABLE `pakaiian` ADD PRIMARY KEY (`id_pakaiian`); -- -- Indexes for table `pembayaran` -- ALTER TABLE `pembayaran` ADD PRIMARY KEY (`id_bayar`); -- -- Indexes for table `pemesanan` -- ALTER TABLE `pemesanan` ADD PRIMARY KEY (`id_pesanan`); -- -- Indexes for table `postingan` -- ALTER TABLE `postingan` ADD PRIMARY KEY (`id_posting`); -- -- Indexes for table `role` -- ALTER TABLE `role` ADD PRIMARY KEY (`role_id`); -- -- Indexes for table `user` -- ALTER TABLE `user` ADD PRIMARY KEY (`id_user`); -- -- Indexes for table `user_token` -- ALTER TABLE `user_token` ADD PRIMARY KEY (`id`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `barang` -- ALTER TABLE `barang` MODIFY `idbarang` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=43; -- -- AUTO_INCREMENT for table `feedback` -- ALTER TABLE `feedback` MODIFY `id_feedback` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; -- -- AUTO_INCREMENT for table `kategori` -- ALTER TABLE `kategori` MODIFY `id_kategori` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=65; -- -- AUTO_INCREMENT for table `pakaiian` -- ALTER TABLE `pakaiian` MODIFY `id_pakaiian` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6; -- -- AUTO_INCREMENT for table `pembayaran` -- ALTER TABLE `pembayaran` MODIFY `id_bayar` int(11) NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `pemesanan` -- ALTER TABLE `pemesanan` MODIFY `id_pesanan` int(11) NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `postingan` -- ALTER TABLE `postingan` MODIFY `id_posting` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6; -- -- AUTO_INCREMENT for table `role` -- ALTER TABLE `role` MODIFY `role_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5; -- -- AUTO_INCREMENT for table `user` -- ALTER TABLE `user` MODIFY `id_user` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=14; -- -- AUTO_INCREMENT for table `user_token` -- ALTER TABLE `user_token` 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
3e87200cfa5b940592b666fe80b1870eaa97574d
SQL
katiepdx/sql-aggs
/exercise-1/exercise-1.sql
UTF-8
371
4.28125
4
[]
no_license
-- find the title and count of the top 10 most rented films -- use COUNT to count each row -- GROUP BY the film_id -- ORDER in descending order -- LIMIT 10 SELECT title, count(*) FROM film INNER JOIN inventory ON film.film_id = inventory.film_id INNER JOIN rental ON inventory.inventory_id = rental.inventory_id GROUP BY film.film_id ORDER BY count DESC LIMIT 10
true
7b27fda7af7d206deb25bb0a57b16f419881e209
SQL
Gau-Gas/gaugas
/gaugas_db.sql
UTF-8
7,638
2.953125
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 4.5.1 -- http://www.phpmyadmin.net -- -- Host: 127.0.0.1 -- Generation Time: Jan 24, 2017 at 07:35 AM -- Server version: 10.1.13-MariaDB -- PHP Version: 7.0.8 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: `gaugas_db` -- -- -------------------------------------------------------- -- -- Table structure for table `admin` -- CREATE TABLE `admin` ( `user_name` varchar(16) NOT NULL, `pwd` varchar(16) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `admin` -- INSERT INTO `admin` (`user_name`, `pwd`) VALUES ('admin', 'admin'); -- -------------------------------------------------------- -- -- Table structure for table `plant` -- CREATE TABLE `plant` ( `plant_id` int(10) UNSIGNED NOT NULL, `plant_loc` varchar(32) NOT NULL, `plant_no_of_conn` int(16) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `plant` -- INSERT INTO `plant` (`plant_id`, `plant_loc`, `plant_no_of_conn`) VALUES (111, '1a', 2), (222, '2a', 2); -- -------------------------------------------------------- -- -- Table structure for table `staging_table` -- CREATE TABLE `staging_table` ( `user_id` int(10) UNSIGNED NOT NULL, `usage_units` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Table structure for table `usage_logs` -- CREATE TABLE `usage_logs` ( `user_id` int(10) UNSIGNED NOT NULL, `date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, `usage_units` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `usage_logs` -- INSERT INTO `usage_logs` (`user_id`, `date`, `usage_units`) VALUES (1, '2017-01-24 00:59:57', 12), (2, '2017-01-24 00:59:57', 0), (3, '2017-01-24 00:59:57', 0), (4, '2017-01-24 00:59:57', 0), (1, '2017-01-24 01:02:19', 12), (2, '2017-01-24 01:02:19', 0), (3, '2017-01-24 01:02:19', 0), (4, '2017-01-24 01:02:19', 0), (1, '2017-01-24 01:03:28', 12), (2, '2017-01-24 01:03:28', 0), (3, '2017-01-24 01:03:28', 0), (4, '2017-01-24 01:03:28', 0), (1, '2017-01-24 01:07:04', 0), (2, '2017-01-24 01:07:04', 0), (3, '2017-01-24 01:07:04', 0), (4, '2017-01-24 01:07:04', 0), (1, '2017-01-24 01:07:09', 0), (2, '2017-01-24 01:07:09', 0), (3, '2017-01-24 01:07:09', 0), (4, '2017-01-24 01:07:09', 0), (1, '2017-01-24 01:07:14', 0), (2, '2017-01-24 01:07:14', 0), (3, '2017-01-24 01:07:14', 0), (4, '2017-01-24 01:07:14', 0), (1, '2017-01-24 01:07:19', 0), (2, '2017-01-24 01:07:19', 0), (3, '2017-01-24 01:07:19', 0), (4, '2017-01-24 01:07:19', 0), (1, '2017-01-24 01:07:24', 0), (2, '2017-01-24 01:07:24', 0), (3, '2017-01-24 01:07:24', 0), (4, '2017-01-24 01:07:24', 0), (1, '2017-01-24 01:07:29', 0), (2, '2017-01-24 01:07:29', 0), (3, '2017-01-24 01:07:29', 0), (4, '2017-01-24 01:07:29', 0), (1, '2017-01-24 01:07:34', 0), (2, '2017-01-24 01:07:34', 0), (3, '2017-01-24 01:07:34', 0), (4, '2017-01-24 01:07:34', 0), (1, '2017-01-24 01:07:39', 0), (2, '2017-01-24 01:07:39', 0), (3, '2017-01-24 01:07:39', 0), (4, '2017-01-24 01:07:39', 0), (1, '2017-01-24 01:07:44', 0), (2, '2017-01-24 01:07:44', 0), (3, '2017-01-24 01:07:44', 0), (4, '2017-01-24 01:07:44', 0), (1, '2017-01-24 01:07:49', 0), (2, '2017-01-24 01:07:49', 0), (3, '2017-01-24 01:07:49', 0), (4, '2017-01-24 01:07:49', 0), (1, '2017-01-24 01:07:54', 0), (2, '2017-01-24 01:07:54', 0), (3, '2017-01-24 01:07:54', 0), (4, '2017-01-24 01:07:54', 0), (1, '2017-01-24 01:07:59', 0), (2, '2017-01-24 01:07:59', 0), (3, '2017-01-24 01:07:59', 0), (4, '2017-01-24 01:07:59', 0), (1, '2017-01-24 01:08:04', 0), (2, '2017-01-24 01:08:04', 0), (3, '2017-01-24 01:08:04', 0), (4, '2017-01-24 01:08:04', 0), (1, '2017-01-24 01:08:09', 0), (2, '2017-01-24 01:08:09', 0), (3, '2017-01-24 01:08:09', 0), (4, '2017-01-24 01:08:09', 0); -- -------------------------------------------------------- -- -- Table structure for table `usage_regular` -- CREATE TABLE `usage_regular` ( `user_id` int(11) UNSIGNED NOT NULL, `usage_units` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `usage_regular` -- INSERT INTO `usage_regular` (`user_id`, `usage_units`) VALUES (1, 0), (2, 0), (3, 0), (4, 0); -- -------------------------------------------------------- -- -- Table structure for table `user` -- CREATE TABLE `user` ( `user_id` int(10) UNSIGNED NOT NULL, `user_name` varchar(16) NOT NULL, `user_mob` varchar(32) NOT NULL, `user_join` datetime NOT NULL, `user_addr` varchar(64) NOT NULL, `plant_id` int(8) UNSIGNED NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `user` -- INSERT INTO `user` (`user_id`, `user_name`, `user_mob`, `user_join`, `user_addr`, `plant_id`) VALUES (1, 'perumal', '9036892264', '2017-01-23 00:00:00', 'uttarahalli', 111), (2, 'vinaykiran', '9945151419', '2017-01-23 00:00:00', 'kslayout', 111), (3, 'vinaybhat', '9900188301', '2017-01-23 00:00:00', 'kkcross', 222), (4, 'tilak', '7411077968', '2017-01-23 00:00:00', 'uttarahalli', 222); -- -- Indexes for dumped tables -- -- -- Indexes for table `plant` -- ALTER TABLE `plant` ADD PRIMARY KEY (`plant_id`), ADD UNIQUE KEY `plant_id` (`plant_id`); -- -- Indexes for table `staging_table` -- ALTER TABLE `staging_table` ADD KEY `user_id` (`user_id`); -- -- Indexes for table `usage_logs` -- ALTER TABLE `usage_logs` ADD KEY `user_id` (`user_id`); -- -- Indexes for table `usage_regular` -- ALTER TABLE `usage_regular` ADD KEY `user_id` (`user_id`); -- -- Indexes for table `user` -- ALTER TABLE `user` ADD PRIMARY KEY (`user_id`), ADD UNIQUE KEY `user_id` (`user_id`), ADD KEY `plant_id` (`plant_id`); -- -- Constraints for dumped tables -- -- -- Constraints for table `staging_table` -- ALTER TABLE `staging_table` ADD CONSTRAINT `staging_table_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `user` (`user_id`), ADD CONSTRAINT `staging_table_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `user` (`user_id`); -- -- Constraints for table `usage_logs` -- ALTER TABLE `usage_logs` ADD CONSTRAINT `usage_logs_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `user` (`user_id`); -- -- Constraints for table `usage_regular` -- ALTER TABLE `usage_regular` ADD CONSTRAINT `usage_regular_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `user` (`user_id`); -- -- Constraints for table `user` -- ALTER TABLE `user` ADD CONSTRAINT `user_ibfk_1` FOREIGN KEY (`plant_id`) REFERENCES `plant` (`plant_id`); DELIMITER $$ -- -- Events -- CREATE DEFINER=`root`@`localhost` EVENT `first_event` ON SCHEDULE EVERY 3 SECOND STARTS '2017-01-24 00:08:20' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN Update usage_regular as u inner join ( select user_id, sum(usage_units) as usage_units from staging_table group by user_id ) as A on u.user_id = A.user_id set u.usage_units = u.usage_units + A.usage_units; delete FROM staging_table; END$$ CREATE DEFINER=`root`@`localhost` EVENT `usage_logs_insert` ON SCHEDULE EVERY 1 DAY STARTS '2017-01-24 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO insert into usage_logs(user_id,perday_usage) select user_id,usage_units from usage_regular$$ DELIMITER ; /*!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
083c3053d3f52b624d4c195d625c02ab2aff91b0
SQL
kikitux-act/WindowsDynamicMasking
/dynamicmasking.sql
UTF-8
202
2.640625
3
[ "MIT" ]
permissive
use masksmalldb ALTER TABLE dbo.Customer ALTER COLUMN LastName ADD MASKED WITH (FUNCTION = 'partial(2,"XXX",0)'); CREATE USER [devlogin] FOR LOGIN [devlogin] GRANT SELECT ON dbo.customer TO devlogin;
true
746b5cb8d0d0fc9ddca397996e39dec800d65d46
SQL
ksaseendran/Synthea-OMOP-on-Synapse
/ETL Scripts/Load/120. Load drug_exposure.sql
UTF-8
4,537
3.5
4
[ "Apache-2.0" ]
permissive
INSERT INTO [omop].DRUG_EXPOSURE ( DRUG_EXPOSURE_ID, PERSON_ID, DRUG_CONCEPT_ID, DRUG_EXPOSURE_START_DATE, DRUG_EXPOSURE_START_DATETIME, DRUG_EXPOSURE_END_DATE, DRUG_EXPOSURE_END_DATETIME, VERBATIM_END_DATE, DRUG_TYPE_CONCEPT_ID, STOP_REASON, REFILLS, QUANTITY, DAYS_SUPPLY, SIG, ROUTE_CONCEPT_ID, LOT_NUMBER, PROVIDER_ID, VISIT_OCCURRENCE_ID, VISIT_DETAIL_ID, DRUG_SOURCE_VALUE, DRUG_SOURCE_CONCEPT_ID, ROUTE_SOURCE_VALUE, DOSE_UNIT_SOURCE_VALUE ) SELECT ROW_NUMBER() OVER (ORDER BY person_id) drug_exposure_id, person_id, drug_concept_id, drug_exposure_start_date, drug_exposure_start_datetime, drug_exposure_end_date, drug_exposure_end_datetime, verbatim_end_date, drug_type_concept_id, stop_reason, refills, quantity, days_supply, sig, route_concept_id, lot_number, provider_id, visit_occurrence_id, visit_detail_id, drug_source_value, drug_source_concept_id, route_source_value, dose_unit_source_value FROM ( SELECT p.PERSON_ID person_id, srctostdvm.TARGET_CONCEPT_ID drug_concept_id, m.start drug_exposure_start_date, m.start drug_exposure_start_datetime, COALESCE(m.stop, m.start) drug_exposure_end_date, COALESCE(m.stop, m.start) drug_exposure_end_datetime, m.stop verbatim_end_date, 38000175 drug_type_concept_id, CAST(NULL AS VARCHAR) stop_reason, 0 refills, 0 quantity, COALESCE(DATEDIFF(DAY, m.start, m.stop), 0) days_supply, CAST(NULL AS VARCHAR) sig, 0 route_concept_id, 0 lot_number, 0 provider_id, fv.VISIT_OCCURRENCE_ID_NEW visit_occurrence_id, fv.VISIT_OCCURRENCE_ID_NEW + 1000000 visit_detail_id, m.code drug_source_value, srctosrcvm.SOURCE_CONCEPT_ID drug_source_concept_id, CAST(NULL AS VARCHAR) route_source_value, CAST(NULL AS VARCHAR) dose_unit_source_value FROM [synthea].medications m JOIN [helper].source_to_standard_vocab_map srctostdvm ON srctostdvm.SOURCE_CODE = m.code AND srctostdvm.TARGET_DOMAIN_ID = 'Drug' AND srctostdvm.TARGET_VOCABULARY_ID = 'RxNorm' AND srctostdvm.TARGET_STANDARD_CONCEPT = 'S' AND srctostdvm.TARGET_INVALID_REASON IS NULL JOIN [helper].source_to_source_vocab_map srctosrcvm ON srctosrcvm.SOURCE_CODE = m.code AND srctosrcvm.SOURCE_VOCABULARY_ID = 'RxNorm' LEFT JOIN [helper].FINAL_VISIT_IDS fv ON fv.encounter_id = m.encounter JOIN [omop].PERSON p ON p.PERSON_SOURCE_VALUE = m.patient UNION ALL SELECT p.PERSON_ID person_id, srctostdvm.TARGET_CONCEPT_ID drug_concept_id, i.date drug_exposure_start_date, i.date drug_exposure_start_datetime, i.date drug_exposure_end_date, i.date drug_exposure_end_datetime, i.date verbatim_end_date, 38000175 drug_type_concept_id, CAST(NULL AS VARCHAR) stop_reason, 0 refills, 0 quantity, 0 days_supply, CAST(NULL AS VARCHAR) sig, 0 route_concept_id, 0 lot_number, 0 provider_id, fv.VISIT_OCCURRENCE_ID_NEW visit_occurrence_id, fv.VISIT_OCCURRENCE_ID_NEW + 1000000 visit_detail_id, i.code drug_source_value, srctosrcvm.SOURCE_CONCEPT_ID drug_source_concept_id, CAST(NULL AS VARCHAR) route_source_value, CAST(NULL AS VARCHAR) dose_unit_source_value FROM [synthea].immunizations i JOIN [helper].source_to_standard_vocab_map srctostdvm ON srctostdvm.SOURCE_CODE = i.code AND srctostdvm.TARGET_DOMAIN_ID = 'Drug' AND srctostdvm.TARGET_VOCABULARY_ID = 'CVX' AND srctostdvm.TARGET_STANDARD_CONCEPT = 'S' AND srctostdvm.TARGET_INVALID_REASON IS NULL JOIN [helper].source_to_source_vocab_map srctosrcvm ON srctosrcvm.SOURCE_CODE = i.code AND srctosrcvm.SOURCE_VOCABULARY_ID = 'CVX' LEFT JOIN [helper].FINAL_VISIT_IDS fv ON fv.encounter_id = i.encounter JOIN [omop].PERSON p ON p.PERSON_SOURCE_VALUE = i.patient ) tmp;
true
db3cc44c6ba161a9166740d021deb8ec6e416b30
SQL
VasylStep/june-2020
/MySQL/lection1,sql
UTF-8
1,580
3.546875
4
[]
no_license
INSERT INTO doctors (age) VALUES (34); SELECT * FROM students; SELECT name, age FROM students; SELECT * FROM students WHERE age = 15; SELECT * FROM students WHERE name = 'romAn' SELECT * FROM students WHERE name LIKE '%n' SELECT * FROM students WHERE name LIKE '%n%'; SELECT * FROM students WHERE name LIKE '___a%'; SELECT * FROM students WHERE LENGTH(name) = 4; SELECT * FROM students WHERE name LIKE 'o%' ORDER BY age DESC; SELECT * FROM students WHERE gender = 'female' ORDER BY name; SELECT * FROM students ORDER BY age LIMIT 3; SELECT * FROM students ORDER BY age LIMIT 3 OFFSET 6; SELECT * FROM students WHERE age <> 18; SELECT * FROM students WHERE age != 18; SELECT * FROM students WHERE age <= 18; SELECT * FROM students WHERE age > 18 AND name LIKE 'o%'; SELECT * FROM students WHERE age = 18 OR name LIKE 'o%' AND gender = 'female'; SELECT * FROM students WHERE age > 20 AND age < 30; SELECT * FROM students WHERE age BETWEEN 20 AND 30; SELECT * FROM students WHERE age BETWEEN 20 AND 30 OR name LIKE 'o%'; # AGGREGATE FUNCTIONS SELECT MAX(age) FROM students; SELECT MIN(age) FROM students; SELECT AVG(age) FROM students; SELECT COUNT(id) FROM ratings WHERE rating > 4; SELECT COUNT(id) FROM students WHERE age < 20; SELECT SUM(age) FROM students; SELECT AVG (rating) AS avgRat, COUNT(rating) AS gradeCount FROM ratings WHERE student_id = 5; UPDATE students SET name = 'VALENTIN', gender = 'chubaka' WHERE age = 55; UPDATE students SET age = 20 WHERE age > 40; DELETE FROM students WHERE gender LIKE 'c%';
true
307791aa6a1e7f563f662733d100fae144b21fc1
SQL
cuevas097/BD_SQL_Proyecto
/s-13-p_tabla_temporal.sql
UTF-8
2,265
3.5625
4
[]
no_license
--Procedimiento que ingresa valores en una tabla temporal --y regresa el numero de registros agregados create or replace procedure p_tabla_temporal( p_num_registros out number ) is v_empleado_temp_id empleado_temp.empleado_temp_id%type; v_nombre empleado_temp.nombre%type; v_ap_paterno empleado_temp.ap_paterno%type; v_ap_materno empleado_temp.ap_materno%type; v_email empleado_temp.email%type; v_fecha_ingreso empleado_temp.fecha_ingreso%type; v_es_revisor empleado_temp.es_revisor%type; v_es_editor empleado_temp.es_editor%type; v_numero_contrato empleado_temp.numero_contrato%type; v_fecha_fin_contrato empleado_temp.fecha_fin_contrato%type; v_numero_cedula empleado_temp.numero_cedula%type; v_maestria empleado_temp.maestria%type; cur_resultado sys_refcursor; cursor cur_obtener_datos is select e.empleado_id, e.nombre, e.ap_paterno, e.ap_materno, e.email, e.fecha_ingreso, e.es_revisor, e.es_editor, r.numero_contrato, r.fecha_fin_contrato, ed.numero_cedula, ed.maestria from empleado e, revisor r, editor ed where e.empleado_id=r.empleado_id(+) and e.empleado_id = ed.empleado_id(+); begin open cur_obtener_datos; loop fetch cur_obtener_datos into v_empleado_temp_id, v_nombre,v_ap_paterno, v_ap_materno, v_email,v_fecha_ingreso, v_es_revisor, v_es_editor, v_numero_contrato, v_fecha_fin_contrato, v_numero_cedula, v_maestria; exit when cur_obtener_datos%notfound; execute immediate 'insert into empleado_temp(empleado_temp_id, nombre, ap_paterno, ap_materno, email, fecha_ingreso, es_revisor, es_editor, numero_contrato, fecha_fin_contrato, numero_cedula, maestria) values(:ph_empleado_temp_id, :ph_nombre, :ph_ap_paterno, :ph_ap_materno, :ph_email, :ph_fecha_ingreso, :ph_es_revisor, :ph_es_editor, :ph_numero_contrato, :ph_fecha_fin_contrato, :ph_numero_cedula, :ph_maestria)' using v_empleado_temp_id, v_nombre,v_ap_paterno, v_ap_materno, v_email,v_fecha_ingreso, v_es_revisor, v_es_editor, v_numero_contrato, v_fecha_fin_contrato, v_numero_cedula, v_maestria; end loop; open cur_resultado for 'select * from resultado_reporte'; p_num_registros := cur_obtener_datos%rowcount; end; / show errors
true
0142c55205a7dfdcdd6c7ff55f1d45cd521e790b
SQL
radomirkovacevic/php-registration_system
/sql/users.sql
UTF-8
606
3.140625
3
[]
no_license
CREATE TABLE `users` ( `id` int NOT NULL AUTO_INCREMENT, `first_name` varchar(50) NOT NULL, `last_name` varchar(50) NOT NULL, `user_mail` varchar(100) NOT NULL, `user_password` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL, `user_validated` int NOT NULL DEFAULT '0', `date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `user_key` varchar(255) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `user_key_UNIQUE` (`user_key`), KEY `first_name` (`first_name`), KEY `last_name` (`last_name`) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
true
e2d896d47ee54f5b52789abfd583cf0abb975ae5
SQL
ITISummer/DreamTreeSharer
/MySQL/dream_tree_sharer.sql
UTF-8
14,131
3.203125
3
[]
no_license
/* Navicat Premium Data Transfer Source Server : localhost Source Server Type : MySQL Source Server Version : 80012 Source Host : localhost:3306 Source Schema : dream_tree_sharer Target Server Type : MySQL Target Server Version : 80012 File Encoding : 65001 Date: 11/05/2021 20:35:43 */ SET NAMES utf8mb4; SET FOREIGN_KEY_CHECKS = 0; -- ---------------------------- -- Table structure for admins -- ---------------------------- DROP TABLE IF EXISTS `admins`; CREATE TABLE `admins` ( `admin_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '管理员id', `admin_name` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '管理员名', `admin_password` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '管理员登录密码', `admin_create_time` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建管理员时间', `admin_login_time` timestamp(0) NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '管理员最新登录时间', `admin_enabled` tinyint(1) NULL DEFAULT NULL COMMENT '管理员是否被启用', PRIMARY KEY (`admin_id`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '管理员表' ROW_FORMAT = Dynamic; -- ---------------------------- -- Table structure for pinboards -- ---------------------------- DROP TABLE IF EXISTS `pinboards`; CREATE TABLE `pinboards` ( `pinboard_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '愿望板id', `pinboard_title` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '愿望板名', `pinboard_content` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '愿望板内容', `pinboard_create_time` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建愿望板时间', `pinboard_bgimg_url` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '愿望板背景图地址', `pinboard_type` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '愿望板类型', `pinboard_sharable` tinyint(1) NOT NULL DEFAULT 1 COMMENT '是否分享愿望板', `like_num` int(11) NULL DEFAULT NULL COMMENT '愿望板点赞量', PRIMARY KEY (`pinboard_id`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '愿望板表' ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of pinboards -- ---------------------------- INSERT INTO `pinboards` VALUES ('1f0979e8-59fa-4b21-8350-f37a697746c3', 'what?', 'why?', '2021-05-08 21:27:42', 'http://qrne6et6u.hn-bkt.clouddn.com/IMG_20200606_231803.jpg', NULL, 1, NULL); INSERT INTO `pinboards` VALUES ('5984ed53-3510-49d3-b899-03895a4e6bfa', 'heyhey', 'heyhey', '2021-05-09 10:56:06', 'http://qrne6et6u.hn-bkt.clouddn.com/问微信.jpg', NULL, 1, NULL); INSERT INTO `pinboards` VALUES ('6d367175-2613-4eb2-a5c8-bf9bfca6570d', 'what?', 'why?', '2021-05-08 21:27:42', 'http://qrne6et6u.hn-bkt.clouddn.com/My Dream.jpg', NULL, 1, NULL); INSERT INTO `pinboards` VALUES ('87445213-adc9-48bf-9d7e-dd44add1fedb', 'What is your dream?', 'My dream is to be a good programmer!', '2021-05-08 20:35:13', 'http://qrne6et6u.hn-bkt.clouddn.com/WeChat Image_20200607175036.jpg', NULL, 1, NULL); -- ---------------------------- -- Table structure for users -- ---------------------------- DROP TABLE IF EXISTS `users`; CREATE TABLE `users` ( `user_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '0' COMMENT '用户id', `user_username` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '用户名', `user_password` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '用户登录密码', `user_sex` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '用户性别', `user_birthday` date NULL DEFAULT NULL COMMENT '用户生日', `user_description` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '用户自定义描述', `user_avatar_url` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT 'https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png' COMMENT '用户头像地址', `user_phone` varchar(11) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '用户手机号', `user_email` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '用户邮箱', `user_create_time` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建用户时间', `user_login_time` timestamp(0) NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '用户最新登录时间', `user_enabled` tinyint(1) NULL DEFAULT 1 COMMENT '用户是否被禁用 1-表示没禁用 0-表示被禁用', PRIMARY KEY (`user_id`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '用户表' ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of users -- ---------------------------- INSERT INTO `users` VALUES ('02abc87a-34a3-49b0-85b1-2bd9b0c818e5', 'summer', '11ce4cf157aeb5665b770c670dc6e219', NULL, NULL, NULL, 'WeChat Image_20200607175036.jpg', '15244812873', 'lv.summer@qq.com', '2021-04-24 19:47:32', '2021-04-24 19:47:32', 1); INSERT INTO `users` VALUES ('0560e615-4d16-45b6-9b8f-29ceaa0841d2', 'SummerLyu', '11ce4cf157aeb5665b770c670dc6e219', NULL, NULL, NULL, 'https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png', '15244812873', NULL, '2021-05-02 21:03:01', '2021-05-02 21:03:01', 1); INSERT INTO `users` VALUES ('70a23a89-adc4-4738-a15a-a89ce50dff7f', 'summerlvlv', '11ce4cf157aeb5665b770c670dc6e219', NULL, NULL, NULL, 'https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png', '15244812873', NULL, '2021-04-25 18:14:41', '2021-04-25 18:14:41', 1); INSERT INTO `users` VALUES ('f31a1b69-c3ac-448a-aca8-e546f56072bb', 'summerlv', '605212848ed0bb0d5cfbd1df7987080f', NULL, NULL, NULL, 'IMG_20200606_231803.jpg', '15244812873', NULL, '2021-04-24 11:04:10', '2021-04-24 11:04:10', 1); -- ---------------------------- -- Table structure for users_pinboards -- ---------------------------- DROP TABLE IF EXISTS `users_pinboards`; CREATE TABLE `users_pinboards` ( `up_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '用户-愿望板id', `user_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '用户id', `pinboard_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '愿望板id', `up_create_time` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建愿望板时间', PRIMARY KEY (`up_id`) USING BTREE, INDEX `user_id`(`user_id`) USING BTREE, INDEX `pinboard_id`(`pinboard_id`) USING BTREE, CONSTRAINT `users_pinboards_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`user_id`) ON DELETE RESTRICT ON UPDATE RESTRICT, CONSTRAINT `users_pinboards_ibfk_2` FOREIGN KEY (`pinboard_id`) REFERENCES `pinboards` (`pinboard_id`) ON DELETE RESTRICT ON UPDATE RESTRICT ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '用户对愿望板的操作记录表' ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of users_pinboards -- ---------------------------- INSERT INTO `users_pinboards` VALUES ('5fd4d14b-7412-4868-81cb-69cf62cd607d', 'f31a1b69-c3ac-448a-aca8-e546f56072bb', '5984ed53-3510-49d3-b899-03895a4e6bfa', '2021-05-09 10:56:06'); INSERT INTO `users_pinboards` VALUES ('966bd6e3-76ce-4c52-87d6-c562ca745606', '02abc87a-34a3-49b0-85b1-2bd9b0c818e5', '87445213-adc9-48bf-9d7e-dd44add1fedb', '2021-05-08 20:35:13'); INSERT INTO `users_pinboards` VALUES ('ca92814b-2a07-4d6b-9eb1-f1c4597b8bd5', '02abc87a-34a3-49b0-85b1-2bd9b0c818e5', '6d367175-2613-4eb2-a5c8-bf9bfca6570d', '2021-05-11 09:55:09'); INSERT INTO `users_pinboards` VALUES ('ee534b4d-c098-40f0-beb2-41023eadb013', '02abc87a-34a3-49b0-85b1-2bd9b0c818e5', '1f0979e8-59fa-4b21-8350-f37a697746c3', '2021-05-08 21:27:42'); -- ---------------------------- -- Table structure for users_pinboards_comments -- ---------------------------- DROP TABLE IF EXISTS `users_pinboards_comments`; CREATE TABLE `users_pinboards_comments` ( `upc_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '用户-愿望板-评论id', `user_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '用户id', `pinboard_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '愿望板id', `comment` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '评论内容', `up_create_time` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '创建愿望板时间', `like_num` int(10) NULL DEFAULT NULL COMMENT '评论所收到的点赞数量', PRIMARY KEY (`upc_id`) USING BTREE, INDEX `user_id`(`user_id`) USING BTREE, INDEX `pinboard_id`(`pinboard_id`) USING BTREE, CONSTRAINT `users_pinboards_comments_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`user_id`) ON DELETE RESTRICT ON UPDATE RESTRICT, CONSTRAINT `users_pinboards_comments_ibfk_2` FOREIGN KEY (`pinboard_id`) REFERENCES `pinboards` (`pinboard_id`) ON DELETE RESTRICT ON UPDATE RESTRICT ) ENGINE = InnoDB AUTO_INCREMENT = 13 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '用户对愿望板的评论记录表' ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of users_pinboards_comments -- ---------------------------- INSERT INTO `users_pinboards_comments` VALUES (2, '02abc87a-34a3-49b0-85b1-2bd9b0c818e5', '87445213-adc9-48bf-9d7e-dd44add1fedb', 'hao ge ge', '2021-05-10 13:14:49', 0); INSERT INTO `users_pinboards_comments` VALUES (3, '02abc87a-34a3-49b0-85b1-2bd9b0c818e5', '87445213-adc9-48bf-9d7e-dd44add1fedb', '帆帆帆帆帆帆帆帆', '2021-05-10 13:17:52', 2); INSERT INTO `users_pinboards_comments` VALUES (4, '02abc87a-34a3-49b0-85b1-2bd9b0c818e5', '87445213-adc9-48bf-9d7e-dd44add1fedb', '反反复复发方法', '2021-05-10 13:18:10', 0); INSERT INTO `users_pinboards_comments` VALUES (5, '02abc87a-34a3-49b0-85b1-2bd9b0c818e5', '87445213-adc9-48bf-9d7e-dd44add1fedb', '反反复复', '2021-05-10 13:22:54', 1); INSERT INTO `users_pinboards_comments` VALUES (6, '02abc87a-34a3-49b0-85b1-2bd9b0c818e5', '87445213-adc9-48bf-9d7e-dd44add1fedb', 'what is your dream?', '2021-05-10 15:10:37', 0); INSERT INTO `users_pinboards_comments` VALUES (7, '02abc87a-34a3-49b0-85b1-2bd9b0c818e5', '87445213-adc9-48bf-9d7e-dd44add1fedb', '一个梦想,两个梦想,三个梦想,千万亿个梦想,中国梦,梦之蓝', '2021-05-10 15:27:11', 1); INSERT INTO `users_pinboards_comments` VALUES (8, '02abc87a-34a3-49b0-85b1-2bd9b0c818e5', '87445213-adc9-48bf-9d7e-dd44add1fedb', 'what?', '2021-05-10 15:36:25', 0); INSERT INTO `users_pinboards_comments` VALUES (9, '02abc87a-34a3-49b0-85b1-2bd9b0c818e5', '1f0979e8-59fa-4b21-8350-f37a697746c3', '吕长旭,你真棒', '2021-05-10 17:05:15', 0); INSERT INTO `users_pinboards_comments` VALUES (10, '02abc87a-34a3-49b0-85b1-2bd9b0c818e5', '87445213-adc9-48bf-9d7e-dd44add1fedb', 'why is it so happy?', '2021-05-10 19:15:45', 0); INSERT INTO `users_pinboards_comments` VALUES (11, '02abc87a-34a3-49b0-85b1-2bd9b0c818e5', '1f0979e8-59fa-4b21-8350-f37a697746c3', 'heyhey', '2021-05-10 19:16:19', 0); INSERT INTO `users_pinboards_comments` VALUES (12, 'f31a1b69-c3ac-448a-aca8-e546f56072bb', '87445213-adc9-48bf-9d7e-dd44add1fedb', 'summerlv 的评论', '2021-05-11 10:44:42', 1); -- ---------------------------- -- Table structure for users_pinboards_favorites -- ---------------------------- DROP TABLE IF EXISTS `users_pinboards_favorites`; CREATE TABLE `users_pinboards_favorites` ( `upf_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '用户-愿望板-收藏id', `user_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '用户id', `pinboard_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '愿望板id', `up_create_time` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建愿望板时间', PRIMARY KEY (`upf_id`) USING BTREE, INDEX `user_id`(`user_id`) USING BTREE, INDEX `pinboard_id`(`pinboard_id`) USING BTREE, CONSTRAINT `users_pinboards_favorites_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`user_id`) ON DELETE RESTRICT ON UPDATE RESTRICT, CONSTRAINT `users_pinboards_favorites_ibfk_2` FOREIGN KEY (`pinboard_id`) REFERENCES `pinboards` (`pinboard_id`) ON DELETE RESTRICT ON UPDATE RESTRICT ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '用户对愿望板的收藏记录表' ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of users_pinboards_favorites -- ---------------------------- INSERT INTO `users_pinboards_favorites` VALUES (1, 'f31a1b69-c3ac-448a-aca8-e546f56072bb', '87445213-adc9-48bf-9d7e-dd44add1fedb', '2021-05-11 18:45:14'); -- ---------------------------- -- Table structure for users_pinboards_likes -- ---------------------------- DROP TABLE IF EXISTS `users_pinboards_likes`; CREATE TABLE `users_pinboards_likes` ( `upl_id` int(11) NOT NULL COMMENT '用户-愿望板-点赞id', `user_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '用户id', `pinboard_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '愿望板id', `up_create_time` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间', PRIMARY KEY (`upl_id`) USING BTREE, INDEX `user_id`(`user_id`) USING BTREE, INDEX `pinboard_id`(`pinboard_id`) USING BTREE, CONSTRAINT `users_pinboards_likes_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`user_id`) ON DELETE RESTRICT ON UPDATE RESTRICT, CONSTRAINT `users_pinboards_likes_ibfk_2` FOREIGN KEY (`pinboard_id`) REFERENCES `pinboards` (`pinboard_id`) ON DELETE RESTRICT ON UPDATE RESTRICT ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '用户对愿望板的点赞记录表' ROW_FORMAT = Dynamic; SET FOREIGN_KEY_CHECKS = 1;
true
bce6ad66cc67da9d5c24eb3388b867a9c411a189
SQL
pozys/PHP2
/db.sql
UTF-8
8,447
3.046875
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 4.9.0.1 -- https://www.phpmyadmin.net/ -- -- Хост: 127.0.0.1:3308 -- Время создания: Мар 21 2020 г., 09:34 -- Версия сервера: 10.3.13-MariaDB-log -- Версия PHP: 7.2.22 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 */; -- -- База данных: `db` -- -- -------------------------------------------------------- -- -- Структура таблицы `feedbacks` -- CREATE TABLE `feedbacks` ( `id` int(16) NOT NULL, `image_id` int(16) NOT NULL, `feedback` varchar(2000) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Дамп данных таблицы `feedbacks` -- INSERT INTO `feedbacks` (`id`, `image_id`, `feedback`) VALUES (1, 1, 'Первый отзыв'), (2, 1, 'Второй отзыв'), (3, 3, 'Первый'), (4, 4, 'Первый отзыв'), (5, 1, 'Еще один\r\nОчень Важный \r\nотзыв'), (6, 8, 'Первый'), (7, 8, 'Первый'), (8, 8, 'Второй'), (9, 5, 'Отзыв'), (10, 5, 'Отзыв 2'), (11, 5, 'Отзыв 3'), (12, 1, 'Отзыв'), (13, 4, 'Второй'), (14, 4, 'Второй'), (15, 7, 'Новый отзыв'), (16, 8, 'Третий'), (17, 3, 'Отзыв два'), (18, 5, 'Отзыв 4'), (19, 5, 'Отзыв 5'), (20, 5, 'Jnps'), (21, 1, 'Отзыв 4'), (22, 1, ''), (23, 5, 'Jnnndd'); -- -------------------------------------------------------- -- -- Структура таблицы `goods` -- CREATE TABLE `goods` ( `id` int(16) NOT NULL, `path` varchar(250) NOT NULL, `name` varchar(250) NOT NULL, `size` double NOT NULL DEFAULT 0, `viewings` int(15) NOT NULL DEFAULT 0, `price` float NOT NULL DEFAULT 0, `good_name` varchar(255) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Дамп данных таблицы `goods` -- INSERT INTO `goods` (`id`, `path`, `name`, `size`, `viewings`, `price`, `good_name`) VALUES (1, 'img', 'product_1.jpg', 45, 75, 678.34, 'Товар 1'), (2, 'img', 'product_2.jpg', 69.4, 9, 4333, 'Товар 2'), (3, 'img', 'product_3.jpg', 62.2, 6, 2144.55, 'Товар 3'), (4, 'img', 'product_4.jpg', 58.1, 70, 998.09, 'Товар 4'), (5, 'img2', 'product_5.jpg', 70.3, 43, 3414.55, 'Товар 5'), (6, 'img2', 'product_6.jpg', 63.3, 8, 339.93, 'Товар 6'), (7, 'img2', 'product_7.jpg', 45.5, 7, 4111, 'Товар 7'), (8, 'img2', 'product_8.jpg', 44.3, 13, 2342.44, 'Товар 8'), (36, '', '', 0, 0, 444, 'sdfvsdfv'), (37, '', '', 0, 0, 3344, 'Новый 55'); -- -------------------------------------------------------- -- -- Структура таблицы `orders` -- CREATE TABLE `orders` ( `tel` varchar(25) NOT NULL, `id` int(25) NOT NULL, `user_id` int(16) DEFAULT NULL, `sum` float DEFAULT NULL, `orders_data` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL, `user_name` varchar(255) NOT NULL, `adress` varchar(255) NOT NULL, `status` varchar(100) DEFAULT 'Принят' ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Дамп данных таблицы `orders` -- INSERT INTO `orders` (`tel`, `id`, `user_id`, `sum`, `orders_data`, `user_name`, `adress`, `status`) VALUES ('+79998334974', 10, 3, 1676.43, '{\"1\":{\"count\":1,\"good_name\":\"Товар 1\",\"price\":\"678.34\"},\"4\":{\"count\":1,\"good_name\":\"Товар 4\",\"price\":\"998.09\"}}', 'Культяпов Константин Вячеславович', 'Осановский проезд, дом 27, кв. 120', 'Обрабатывается'), ('+79998334974', 11, 3, 5449.02, '{\"6\":{\"count\":1,\"good_name\":\"Товар 6\",\"price\":\"339.93\"},\"7\":{\"count\":1,\"good_name\":\"Товар 7\",\"price\":\"4111\"},\"4\":{\"count\":1,\"good_name\":\"Товар 4\",\"price\":\"998.09\"}}', 'Культяпов Константин Вячеславович', 'Осановский проезд, дом 27, кв. 120', 'Доставлен'), ('test', 12, 4, 6829.1, '{\"5\":{\"count\":2,\"good_name\":\"Товар 5\",\"price\":\"3414.55\"}}', 'test', 'test', 'Обрабатывается'), ('+79998334974', 13, 3, 2035.02, '{\"1\":{\"count\":3,\"good_name\":\"Товар 1\",\"price\":\"678.34\"}}', 'Культяпов Константин Вячеславович', 'Осановский проезд, дом 27, кв. 120', 'Обрабатывается'), ('+79998334974', 47, 7, 678, '{\"1\":{\"count\":1,\"good_name\":\"Товар 1\",\"price\":678}}', 'Константин Вячеславович Культяпов', 'Осановский проезд, дом 27, кв. 120', 'Принят'), ('+79998334974', 48, 7, 678, '{\"1\":{\"count\":1,\"good_name\":\"Товар 1\",\"price\":678}}', 'Константин Вячеславович Культяпов', 'Осановский проезд, дом 27, кв. 120', 'Собран'), ('+79998334974', 49, 7, 678, '{\"1\":{\"count\":1,\"good_name\":\"Товар 1\",\"price\":678}}', 'Константин Вячеславович Культяпов', 'Осановский проезд, дом 27, кв. 120', 'Принят'), ('test', 50, 4, 1356, '{\"1\":{\"count\":2,\"good_name\":\"Товар 1\",\"price\":678}}', 'test', 'test', 'Принят'), ('+79998334974', 51, 8, 9344, '{\"1\":{\"count\":1,\"good_name\":\"Товар 1\",\"price\":678},\"2\":{\"count\":2,\"good_name\":\"Товар 2\",\"price\":4333}}', 'Константин Вячеславович Культяпов', 'Осановский проезд, дом 27, кв. 120', 'Принят'); -- -------------------------------------------------------- -- -- Структура таблицы `users` -- CREATE TABLE `users` ( `id` int(16) NOT NULL, `login` varchar(128) DEFAULT NULL, `password` varchar(255) DEFAULT NULL, `name` varchar(255) NOT NULL, `is_admin` tinyint(1) DEFAULT 0, `adress` varchar(255) NOT NULL, `tel` varchar(25) NOT NULL, `blocked` tinyint(1) NOT NULL DEFAULT 0 ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Дамп данных таблицы `users` -- INSERT INTO `users` (`id`, `login`, `password`, `name`, `is_admin`, `adress`, `tel`, `blocked`) VALUES (1, 'ivan', '$2y$10$XiouMCH0qdlyFBza4IamM.N6Gsr2DnB9ltJCAfA./ZQwe7lbdKa1S', 'Ваня', 1, '', '', 0), (2, 'john', '$2y$10$LtCiljttZsXwPTK6WwbyDODplutcNqeNzEAqbdggKMMhBkRvLP.pi', 'John', 0, '', '', 0), (3, 'pozys', '$2y$10$j3fowjtCTZ1eLow6/EGxku62dKZDkLNaC0GeutjwfUYbGSdYvzfrW', 'Культяпов Константин Вячеславович', 0, 'Осановский проезд, дом 27, кв. 120', '+79998334974', 0), (4, 'test', '$2y$10$cTU8uUZA7Jnlg9gZekcasOJ6L.C9lxGQ3lSL9/gzCOZPkDGoWlhVu', 'test', 0, 'test', 'test', 0), (5, 'admin', '$2y$10$K/5.tUsjfu/vzAthYvVi.uSqj6If.3AU9phO08Ok9I.lZrnXyT3Ay', 'Администратор', 1, 'Москва', '+79998334974', 0), (6, 'ssss', '$2y$10$LVSHPHPZ6AYkAQmDouwvCO3IW/gm3PFERZv92fPMI901mGRc5yY7O', 'Константин Вячеславович Культяпов', 0, 'Осановский проезд, дом 27, кв. 120', '+79998334974', 0), (7, 'rewer', '$2y$10$E6aGzInxii8qlU5VrWayLuuRO51KT8BQoRws5UohCNz6NkwaVB9Fe', 'Константин Вячеславович Культяпов', 0, 'Осановский проезд, дом 27, кв. 120', '+79998334974', 0), (8, 'pozys2', '$2y$10$qh1Kf.RbwxVbwJxkEsuGSu6F8HUl/PiYRqvDrZ7CkhNKmzQHBmf2u', 'Константин Вячеславович Культяпов', 0, 'Осановский проезд, дом 27, кв. 120', '+79998334974', 0); -- -- Индексы сохранённых таблиц -- -- -- Индексы таблицы `feedbacks` -- ALTER TABLE `feedbacks` ADD PRIMARY KEY (`id`); -- -- Индексы таблицы `goods` -- ALTER TABLE `goods` ADD PRIMARY KEY (`id`); -- -- Индексы таблицы `orders` -- ALTER TABLE `orders` ADD PRIMARY KEY (`id`), ADD KEY `user_id` (`user_id`); -- -- Индексы таблицы `users` -- ALTER TABLE `users` ADD PRIMARY KEY (`id`); -- -- AUTO_INCREMENT для сохранённых таблиц -- -- -- AUTO_INCREMENT для таблицы `feedbacks` -- ALTER TABLE `feedbacks` MODIFY `id` int(16) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=24; -- -- AUTO_INCREMENT для таблицы `goods` -- ALTER TABLE `goods` MODIFY `id` int(16) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=38; -- -- AUTO_INCREMENT для таблицы `orders` -- ALTER TABLE `orders` MODIFY `id` int(25) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=52; -- -- AUTO_INCREMENT для таблицы `users` -- ALTER TABLE `users` MODIFY `id` int(16) 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
bc7f7105cc827b02ba1733ea89adca2de7c61d95
SQL
anderson-81/my-studies
/oracle/sql/27_group_by.sql
UTF-8
389
3.25
3
[]
no_license
-- adicionando uma coluna UF: -- alter table person add uf char(2); -- Atualizar os registros com a inclusão de UF. -- Quantidade de pessoas separados por UF: select uf as "Unidade Federativa", count(*) as "Quantidade de pessoas" from person group by uf order by uf ASC; select gender as "Sexo", count(*) as "Quantidade de pessoas" from person group by gender order by gender ASC;
true
5a593d99788635b73a7a003d97375277796d449a
SQL
swarm64/tpc-toolkit
/benchmarks/tpch/schemas/sdb_fact_part/foreign-keys.sql
UTF-8
600
2.84375
3
[ "MIT" ]
permissive
ALTER TABLE ONLY customer ADD CONSTRAINT customer_nation_fk FOREIGN KEY (c_nationkey) REFERENCES nation(n_nationkey); ALTER TABLE ONLY nation ADD CONSTRAINT nation_region_fk FOREIGN KEY (n_regionkey) REFERENCES region(r_regionkey); ALTER TABLE ONLY partsupp ADD CONSTRAINT partsupp_part_fk FOREIGN KEY (ps_partkey) REFERENCES part(p_partkey); ALTER TABLE ONLY partsupp ADD CONSTRAINT partsupp_supplier_fk FOREIGN KEY (ps_suppkey) REFERENCES supplier(s_suppkey); ALTER TABLE ONLY supplier ADD CONSTRAINT supplier_nation_fk FOREIGN KEY (s_nationkey) REFERENCES nation(n_nationkey);
true
b754e5428f07c2b7b6fd7fae1d4d7a17c8bbcd05
SQL
2374142287/game_enchcity_javascript
/Archive/Proc_GuestGenerate.sql
UTF-8
3,775
3.546875
4
[]
no_license
DROP procedure IF EXISTS `Proc_GuestGenerate`; DELIMITER $$ CREATE DEFINER=`root`@`localhost` PROCEDURE `Proc_GuestGenerate`(IN p_userid INT) BEGIN /* 1. 只有用户有食品或用户在线时,才进行客人生成及消费计算 2. 在生成客人时,未进店的客人将被删除。 3. 客人出店后将删除记录 4. 客人进店间隔 = 3600 / 每小时的客流量 5. 客人进店的最小间隔为3秒,因此以3秒为间隔计算进店、消费、出店。 6. 进店顺序随机 7. 在购买的时候生成购买哪两个食品(流浪汉只有酒水) */ declare v_magic int; # 用户魔幻值 declare v_gsttotal int; # 客人总数 declare v_gstcnta int; # A类客人数 declare v_gstcntb int; # B类客人数 declare v_gstcntc int; # C类客人数 declare v_gstcntd int; # D类客人数 declare v_counter int; # 计数器 declare v_gstidmax int; # 客人ID最大值 declare v_gstidbase int; # 客人ID基准值 declare v_interval int; # 客人进店间隔 declare v_entertimemax int; # 客人进店时间最大值 # 删除未进店的或已经出店的客人 delete from userguest where entertime > CURRENT_TIMESTAMP or exittime < CURRENT_TIMESTAMP; select curmagic into @v_magic from users where userid = p_userid; set @v_gsttotal = Func_GetGuestCount(@v_magic); set @v_gstcnta = floor(Func_GetGuestPercent(@v_magic, 'A') * @v_gsttotal / 100); set @v_gstcntb = floor(Func_GetGuestPercent(@v_magic, 'B') * @v_gsttotal / 100); set @v_gstcntc = floor(Func_GetGuestPercent(@v_magic, 'C') * @v_gsttotal / 100); set @v_gstcntd = floor(Func_GetGuestPercent(@v_magic, 'D') * @v_gsttotal / 100); set @v_interval = floor(3600 / @v_gsttotal); #select @v_gsttotal, @v_gstcnta; # 设置客人进店最后时间 select max(entertime) into @v_entertimemax from userguest where userid = p_userid; if @v_entertimemax is null then set @v_entertimemax = CURRENT_TIMESTAMP; end if; # 获取客人ID基准值 if @v_gstidmax is null or @v_gstidmax > 10000 then set @v_gstidbase = 0; else set @v_gstidbase = @v_gstidmax; end if; # 流浪汉 set @v_counter = 0; while (@v_counter := @v_counter + 1) <= @v_gstcnta do insert into userguest(userid, guestid, typecode, hastip) values(p_userid, (@v_gstidbase := @v_gstidbase + 1), 'A', 0); end while; # 上班族 set @v_counter = 0; while (@v_counter := @v_counter + 1) <= @v_gstcntb do insert into userguest(userid, guestid, typecode, hastip) values(p_userid, (@v_gstidbase := @v_gstidbase + 1), 'B', 1); end while; # 唏哈族 set @v_counter = 0; while (@v_counter := @v_counter + 1) <= @v_gstcntc do insert into userguest(userid, guestid, typecode, hastip) values(p_userid, (@v_gstidbase := @v_gstidbase + 1), 'C', 1); end while; # 富豪 set @v_counter = 0; while (@v_counter := @v_counter + 1) <= @v_gstcntD do insert into userguest(userid, guestid, typecode, hastip) values(p_userid, (@v_gstidbase := @v_gstidbase + 1), 'D', 1); end while; select max(guestid) into @v_gstidmax from userguest where userid = p_userid; # 设置客人进店时间 update userguest as a left join (select userid, guestid, (@v_gstorder := @v_gstorder + 1) as rownum from userguest where userid = p_userid and entertime is null order by rand()) as b on a.userid = b.userid and a.guestid = b.guestid set enterorder = rownum where a.userid = p_userid and a.entertime is null; # 设置客人进店、消费及出店时间 update userguest set entertime = (@v_entertimemax := date_add(@v_entertimemax, INTERVAL @v_interval SECOND)), consumetime = date_add(@v_entertimemax , INTERVAL 10 SECOND), exittime = date_add(@v_entertimemax , INTERVAL 1 MINUTE) where userid = p_userid and entertime is null order by enterorder; #*/ END$$ DELIMITER ;
true
9f221ec70d4c5549a38d7c0116783368fa7f5470
SQL
RLflash/showMe
/show_me.sql
UTF-8
2,168
3.21875
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 4.5.1 -- http://www.phpmyadmin.net -- -- Host: 127.0.0.1 -- Generation Time: 2018-11-12 10:55:01 -- 服务器版本: 10.1.19-MariaDB -- PHP Version: 5.6.28 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8mb4 */; -- -- Database: `show_me` -- -- -------------------------------------------------------- -- -- 表的结构 `posts` -- CREATE TABLE `posts` ( `id` int(11) NOT NULL, `title` varchar(200) DEFAULT NULL COMMENT '帖子title', `content` text COMMENT '帖子内容', `autor` varchar(33) DEFAULT NULL COMMENT '帖子发布者', `sendtime` varchar(33) DEFAULT NULL COMMENT '帖子发布时间', `top` tinyint(1) NOT NULL DEFAULT '0' COMMENT '1为置顶;0为正常贴', `user_id` int(11) DEFAULT NULL COMMENT '关联发帖人' ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -------------------------------------------------------- -- -- 表的结构 `users` -- CREATE TABLE `users` ( `id` int(11) NOT NULL, `names` varchar(10) DEFAULT NULL COMMENT '用户名', `passwords` varchar(32) NOT NULL COMMENT '用户密码' ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- 转存表中的数据 `users` -- INSERT INTO `users` (`id`, `names`, `passwords`) VALUES (2, '1', '1'); -- -- Indexes for dumped tables -- -- -- Indexes for table `posts` -- ALTER TABLE `posts` ADD PRIMARY KEY (`id`); -- -- Indexes for table `users` -- ALTER TABLE `users` ADD PRIMARY KEY (`id`); -- -- 在导出的表使用AUTO_INCREMENT -- -- -- 使用表AUTO_INCREMENT `posts` -- ALTER TABLE `posts` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=184; -- -- 使用表AUTO_INCREMENT `users` -- ALTER TABLE `users` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5; /*!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
6f26a93c906c3cafbb364813f37aba8a1e2d6b10
SQL
Qasmi2/HAPV2-Completed-
/protalv2.sql
UTF-8
12,740
3.078125
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 4.5.1 -- http://www.phpmyadmin.net -- -- Host: 127.0.0.1 -- Generation Time: May 03, 2017 at 07:20 AM -- Server version: 10.1.19-MariaDB -- PHP Version: 7.0.13 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8mb4 */; -- -- Database: `protalv2` -- -- -------------------------------------------------------- -- -- Table structure for table `bloodappeal` -- CREATE TABLE `bloodappeal` ( `appealID` int(11) NOT NULL, `bloodGroup` varchar(11) NOT NULL, `bloodQuantity` varchar(100) NOT NULL, `hospitalAddress` varchar(100) NOT NULL, `city` varchar(100) NOT NULL, `country` varchar(100) NOT NULL, `appealDetail` varchar(1000) DEFAULT NULL, `tokenCode` varchar(100) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `bloodappeal` -- INSERT INTO `bloodappeal` (`appealID`, `bloodGroup`, `bloodQuantity`, `hospitalAddress`, `city`, `country`, `appealDetail`, `tokenCode`) VALUES (3, 'B+', '500ml', 'PIMS', 'Islamabad', 'PK', 'Need B+ Blood', '4fb0d7bb83293182399cdd86c062f658'), (4, 'A-', '400ml', 'Islamabad Pakistan', 'Islamabad', 'PK', 'detail about blood appeal', '4fc77ad1f437550daa6042a186113e08'), (5, 'AB+', '800ml', 'Islamic International Hospital ', 'Islamabad', 'PK', 'Need AB+Blood as soon as possible ', '117c4ec1c0df0a4a824cf7901020d198'); -- -------------------------------------------------------- -- -- Table structure for table `otherappeal` -- CREATE TABLE `otherappeal` ( `appealID` int(11) NOT NULL, `appealName` varchar(11) NOT NULL, `appealAddress` varchar(11) NOT NULL, `appealCity` varchar(11) NOT NULL, `appealResources` varchar(100) NOT NULL, `appealQuantity` varchar(100) NOT NULL, `appealDetail` varchar(1000) DEFAULT NULL, `tokenCode` varchar(100) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `otherappeal` -- INSERT INTO `otherappeal` (`appealID`, `appealName`, `appealAddress`, `appealCity`, `appealResources`, `appealQuantity`, `appealDetail`, `tokenCode`) VALUES (2, 'Need Food', 'collage Roa', 'RawalPindi', '["Food items"]', '["33"]', 'Need Food Items ', '0ad475d1e149a844b2864637ca91735e'), (3, 'Need Medici', 'Street no.2', 'RawalPindi', '["Medicine"]', '["33"]', 'Need medicine Items ', '87f3574bc9bf6825186e14b587fa68b9'), (4, 'otherappeal', 'otherappeal', 'cityrequire', '["notingre"]', '["notingrequire"]', 'descriptionaboutEvent', '60c1817d8d325a78995dbe346e088ff9'), (5, 'Need Water ', 'Iqbal town', 'Islamabad', '["water "]', '["5 "]', 'Need water here as soon as possible ', '85fd589f3f88a02debf22f28d537cc45'); -- -------------------------------------------------------- -- -- Table structure for table `task` -- CREATE TABLE `task` ( `taskID` int(11) NOT NULL, `taskName` varchar(100) NOT NULL, `taskAddress` varchar(100) DEFAULT NULL, `taskCity` varchar(100) DEFAULT NULL, `taskDetail` varchar(1000) NOT NULL, `taskProgreess` varchar(100) DEFAULT NULL, `eventID` int(11) DEFAULT NULL, `volunteerID` int(11) DEFAULT NULL, `managerID` int(11) DEFAULT NULL, `taskStatus` enum('Y','N') NOT NULL DEFAULT 'N', `taskVarify` enum('Y','N') NOT NULL DEFAULT 'N' ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `task` -- INSERT INTO `task` (`taskID`, `taskName`, `taskAddress`, `taskCity`, `taskDetail`, `taskProgreess`, `eventID`, `volunteerID`, `managerID`, `taskStatus`, `taskVarify`) VALUES (1, 'testing', 'testingAddress', 'cityTesting', 'testingdetail', 'incomplete', 1, 3, 5, 'Y', 'N'), (2, 'Food ', 'address require', 'city require', 'detaile require', 'incomplete', 1, 4, 5, 'Y', 'N'), (4, 'arrange Ambulances ', 'H-8/2 street no.2', 'Islamabad', 'Arrange Ambulances and go to accident place ', 'initiate', 9, NULL, NULL, 'Y', 'N'); -- -------------------------------------------------------- -- -- Table structure for table `tbl_admin` -- CREATE TABLE `tbl_admin` ( `adminEmail` varchar(100) NOT NULL, `adminPass` varchar(100) NOT NULL, `tokenCode` varchar(100) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `tbl_admin` -- INSERT INTO `tbl_admin` (`adminEmail`, `adminPass`, `tokenCode`) VALUES ('gul@yahoo.com', 'gul', 'tokenCodegul'); -- -------------------------------------------------------- -- -- Table structure for table `tbl_event` -- CREATE TABLE `tbl_event` ( `eventID` int(11) NOT NULL, `eventName` varchar(11) NOT NULL, `eventAddress` varchar(100) NOT NULL, `eventCity` varchar(100) NOT NULL, `eventState` varchar(100) NOT NULL, `eventResources` varchar(100) NOT NULL, `eventQuantities` varchar(100) NOT NULL, `eventDetail` varchar(1000) NOT NULL, `managerID` int(11) DEFAULT NULL, `tokenCode` varchar(100) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `tbl_event` -- INSERT INTO `tbl_event` (`eventID`, `eventName`, `eventAddress`, `eventCity`, `eventState`, `eventResources`, `eventQuantities`, `eventDetail`, `managerID`, `tokenCode`) VALUES (1, 'earthQuick', 'Iqbal town', 'Islamabad', 'PK', '["Rescue Equipments","noting"]', '["2","nothing"]', 'eath quick', 5, '2930aaf5c6f998cbea4b2206181346ad'), (2, 'FireOnBuild', 'E11 islamabad', 'Islamabad', 'PK', '["Rescue Equipments","volunteers"]', '["5","3"]', 'Need volunteers to overcome the fire ,', 5, 'd01592c2d3d42c5ebf8c3c9d91da5570'), (4, 'Accident', 'Islamabad Expressway ', 'Islamabad', 'PK', 'null', 'null', 'Need Ambulances ', 5, '6d4d2fbfadcd99dcfda96e416bd18cf8'), (5, 'Fire on Bui', 'G-6 Sector ', 'Islamabad', 'PK', '["Fist Aid","nothing"]', '["2","nothing"]', 'Need equipment that help to save people', 5, '787d08487bc1fe0573496b37171ae473'), (6, 'foodAppeal', 'f8 markaz', 'Islamabad', 'PK', '["Food","floor"]', '["5","10"]', 'urgent need ', 5, 'fcb690ed8f081ca4327fe037670894d5'), (9, 'foodAppeal', 'Iqbal town', 'Islamabad', 'PK', '["Food","Volunteers"]', '["5","2"]', 'need 5 volunteers to help and server the food', 5, 'ee9d7d320abfe80ef999eaaad2922cfa'), (10, 'Accident', 'H-8/2 street no.2', 'Islamabad', 'PK', '["nothing","ambulance"]', '["nothing","3"]', 'need 4 Ambulances ', 5, '20f3ecb9e763a32f8b694353409ee7cc'); -- -------------------------------------------------------- -- -- Table structure for table `tbl_manager` -- CREATE TABLE `tbl_manager` ( `managerID` int(11) NOT NULL, `userID` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `tbl_manager` -- INSERT INTO `tbl_manager` (`managerID`, `userID`) VALUES (5, 14), (6, 18); -- -------------------------------------------------------- -- -- Table structure for table `tbl_users` -- CREATE TABLE `tbl_users` ( `userID` int(11) NOT NULL, `userName` varchar(100) NOT NULL, `userEmail` varchar(100) NOT NULL, `userPass` varchar(100) NOT NULL, `userAge` varchar(100) DEFAULT NULL, `userGender` varchar(100) DEFAULT NULL, `userEducation` varchar(100) DEFAULT NULL, `userPhone` varchar(100) DEFAULT NULL, `userAbout` varchar(1000) DEFAULT NULL, `userAddress` varchar(500) DEFAULT NULL, `userCity` varchar(100) DEFAULT NULL, `userCountry` varchar(100) DEFAULT NULL, `userRole` varchar(100) NOT NULL, `userStatus` enum('Y','N') NOT NULL DEFAULT 'N', `userVarify` enum('Y','N') NOT NULL DEFAULT 'N', `tokenCode` varchar(100) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `tbl_users` -- INSERT INTO `tbl_users` (`userID`, `userName`, `userEmail`, `userPass`, `userAge`, `userGender`, `userEducation`, `userPhone`, `userAbout`, `userAddress`, `userCity`, `userCountry`, `userRole`, `userStatus`, `userVarify`, `tokenCode`) VALUES (14, 'Nadeem Qasmi', 'nadeemqasmi40@yahoo.com', '2fbf11ed2e4c9f0e5bb7e66320076f7e', '23', 'male', 'bse', '03364526002', 'I worked as a manager ', 'Iqbal town', 'Islamabad', 'PK', 'manager', 'Y', 'Y', 'de8296f973182ee030ac62bdfbac01e2'), (15, 'qasmi', 'qasmi40@yahoo.com', '2fbf11ed2e4c9f0e5bb7e66320076f7e', '23', 'male', 'bse', '03344218955', 'volunteers work as ', 'Iqbal town', 'Islamabad', 'PK', 'volunteer', 'Y', 'Y', 'a2f3daea14f6bed9572266a9064bc997'), (16, 'syed mudassar', 'akhtarmudassar@yahoo.com', '81dc9bdb52d04dc20036dbd8313ed055', '21', 'male', 'bachlors', '+923331111111', 'i ere', 'islamad e11 1', 'Isb', 'PK', 'volunteer', 'Y', 'Y', '150502da3771861b44a21d9ee382a019'), (17, 'Nabeel Yaseen ', 'nabeelyaseen94@outlook.com', '6127c94780277fa64acb99d9e97e0f87', '22', 'male', 'bse', '+923331111111', 'hello wanna join you as volunteere', 'abc-khannapul', 'Islamabad', 'PK', 'volunteer', 'Y', 'Y', '27aca1b36a168354b15549e979b49791'), (18, 'fedo', 'nadeemqasmi40@hotmail.com', '62cdf75b97d222b6396b84ea003de42f', '23', 'male', 'bse', '00303202020', 'I can able to manager ......', 'G/6-3', 'Islamabad', 'PK', 'manager', 'Y', 'Y', 'a43b914aac2c324f83b90966962bab7e'); -- -------------------------------------------------------- -- -- Table structure for table `tbl_volunteer` -- CREATE TABLE `tbl_volunteer` ( `volunteerID` int(11) NOT NULL, `userID` int(11) DEFAULT NULL, `eventID` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `tbl_volunteer` -- INSERT INTO `tbl_volunteer` (`volunteerID`, `userID`, `eventID`) VALUES (3, 15, 6), (4, 16, 1), (5, 17, 1); -- -- Indexes for dumped tables -- -- -- Indexes for table `bloodappeal` -- ALTER TABLE `bloodappeal` ADD PRIMARY KEY (`appealID`); -- -- Indexes for table `otherappeal` -- ALTER TABLE `otherappeal` ADD PRIMARY KEY (`appealID`); -- -- Indexes for table `task` -- ALTER TABLE `task` ADD PRIMARY KEY (`taskID`), ADD UNIQUE KEY `taskID` (`taskID`), ADD KEY `eventID` (`eventID`), ADD KEY `volunteerID` (`volunteerID`), ADD KEY `managerID` (`managerID`); -- -- Indexes for table `tbl_admin` -- ALTER TABLE `tbl_admin` ADD PRIMARY KEY (`adminEmail`); -- -- Indexes for table `tbl_event` -- ALTER TABLE `tbl_event` ADD PRIMARY KEY (`eventID`), ADD UNIQUE KEY `eventID` (`eventID`), ADD KEY `managerID` (`managerID`); -- -- Indexes for table `tbl_manager` -- ALTER TABLE `tbl_manager` ADD PRIMARY KEY (`managerID`), ADD KEY `userID` (`userID`); -- -- Indexes for table `tbl_users` -- ALTER TABLE `tbl_users` ADD PRIMARY KEY (`userID`), ADD UNIQUE KEY `userEmail` (`userEmail`); -- -- Indexes for table `tbl_volunteer` -- ALTER TABLE `tbl_volunteer` ADD PRIMARY KEY (`volunteerID`), ADD KEY `eventID` (`eventID`), ADD KEY `userID` (`userID`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `bloodappeal` -- ALTER TABLE `bloodappeal` MODIFY `appealID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6; -- -- AUTO_INCREMENT for table `otherappeal` -- ALTER TABLE `otherappeal` MODIFY `appealID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6; -- -- AUTO_INCREMENT for table `task` -- ALTER TABLE `task` MODIFY `taskID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5; -- -- AUTO_INCREMENT for table `tbl_event` -- ALTER TABLE `tbl_event` MODIFY `eventID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11; -- -- AUTO_INCREMENT for table `tbl_manager` -- ALTER TABLE `tbl_manager` MODIFY `managerID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7; -- -- AUTO_INCREMENT for table `tbl_users` -- ALTER TABLE `tbl_users` MODIFY `userID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=19; -- -- AUTO_INCREMENT for table `tbl_volunteer` -- ALTER TABLE `tbl_volunteer` MODIFY `volunteerID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6; -- -- Constraints for dumped tables -- -- -- Constraints for table `task` -- ALTER TABLE `task` ADD CONSTRAINT `task_ibfk_1` FOREIGN KEY (`eventID`) REFERENCES `tbl_event` (`eventID`), ADD CONSTRAINT `task_ibfk_2` FOREIGN KEY (`volunteerID`) REFERENCES `tbl_volunteer` (`volunteerID`), ADD CONSTRAINT `task_ibfk_3` FOREIGN KEY (`managerID`) REFERENCES `tbl_manager` (`managerID`); -- -- Constraints for table `tbl_event` -- ALTER TABLE `tbl_event` ADD CONSTRAINT `tbl_event_ibfk_1` FOREIGN KEY (`managerID`) REFERENCES `tbl_manager` (`managerID`); -- -- Constraints for table `tbl_manager` -- ALTER TABLE `tbl_manager` ADD CONSTRAINT `tbl_manager_ibfk_1` FOREIGN KEY (`userID`) REFERENCES `tbl_users` (`userID`); -- -- Constraints for table `tbl_volunteer` -- ALTER TABLE `tbl_volunteer` ADD CONSTRAINT `tbl_volunteer_ibfk_1` FOREIGN KEY (`eventID`) REFERENCES `tbl_event` (`eventID`), ADD CONSTRAINT `tbl_volunteer_ibfk_2` FOREIGN KEY (`userID`) REFERENCES `tbl_users` (`userID`); /*!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
2e1b11383691a725cab5eb8eed976484af26cc11
SQL
muntaza/Open_Persediaan
/sql1_persediaan/daftar_pengeluaran_barang_sql/daftar_pengeluaran_bpbd.sql
UTF-8
321
2.59375
3
[ "BSD-2-Clause", "BSD-3-Clause" ]
permissive
DROP VIEW IF EXISTS view_daftar_pengeluaran_bpbd; CREATE VIEW view_daftar_pengeluaran_bpbd AS SELECT * FROM view_daftar_pengeluaran_kabupaten WHERE 1 = 1 AND id_skpd = 39; GRANT ALL PRIVILEGES ON view_daftar_pengeluaran_bpbd TO lap_bpbd; REVOKE INSERT, UPDATE, DELETE ON view_daftar_pengeluaran_bpbd FROM lap_bpbd;
true
6bb2fad6b17166b3e8ddebdfd30e82bdff9b7008
SQL
DragonicK/SimpleLogin
/laravel.sql
UTF-8
2,664
3.203125
3
[]
no_license
/* Navicat Premium Data Transfer Source Server : Connection Source Server Type : MySQL Source Server Version : 80025 Source Host : localhost:3306 Source Schema : laravel Target Server Type : MySQL Target Server Version : 80025 File Encoding : 65001 Date: 20/08/2021 20:24:30 */ SET NAMES utf8mb4; SET FOREIGN_KEY_CHECKS = 0; -- ---------------------------- -- Table structure for news -- ---------------------------- DROP TABLE IF EXISTS `news`; CREATE TABLE `news` ( `id` int(0) NOT NULL, `title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL, PRIMARY KEY (`id`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Table structure for settings -- ---------------------------- DROP TABLE IF EXISTS `settings`; CREATE TABLE `settings` ( `id` int(0) NOT NULL AUTO_INCREMENT, `user_id` int(0) NULL DEFAULT NULL, PRIMARY KEY (`id`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Table structure for users -- ---------------------------- DROP TABLE IF EXISTS `users`; CREATE TABLE `users` ( `id` int(0) NOT NULL AUTO_INCREMENT, `username` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL, `passphrase` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL, `accessLevel` int(0) NOT NULL DEFAULT 0, `email` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL, `name` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL, `language` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT 'English', PRIMARY KEY (`id`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 5 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of users -- ---------------------------- INSERT INTO `users` VALUES (1, 'akaruz', '39046213b04423ced40ff162cefd811ffd4a4f939083b1bf151ca47f7f864705', 1, 'juliosperandio@hotmail.com', 'Julio Sperandio', 'English'); INSERT INTO `users` VALUES (2, 'nadaila', '39046213b04423ced40ff162cefd811ffd4a4f939083b1bf151ca47f7f864705', 1, 'juliosperandio@hotmail.com', 'No Name', 'English'); INSERT INTO `users` VALUES (3, 'caronne', '39046213b04423ced40ff162cefd811ffd4a4f939083b1bf151ca47f7f864705', 1, 'caronne@live.com', '無名', 'English'); INSERT INTO `users` VALUES (4, 'sereste', '39046213b04423ced40ff162cefd811ffd4a4f939083b1bf151ca47f7f864705', 1, 'juliosperandio@hotmail.com', '無名', 'English'); SET FOREIGN_KEY_CHECKS = 1;
true
a5d54a0318c327ca24fe2d01d741b63c89391214
SQL
omega/easycms2
/db/upgrade/EasyCMS2-Schema-Base-0.16-0.17-PostgreSQL.sql
UTF-8
1,116
3.03125
3
[]
no_license
-- Convert schema '/Users/andremar/Projects/easycms2/db/upgrade/EasyCMS2-Schema::Base-0.16-PostgreSQL.sql' to '/Users/andremar/Projects/easycms2/db/upgrade/EasyCMS2-Schema::Base-0.17-PostgreSQL.sql': -- Target database PostgreSQL is untested/unsupported!!! -- -- Table: snippet02 -- -- Comments: -- Table: snippet -- DROP TABLE snippet CASCADE; --CREATE TABLE "snippet02" ( "id" serial NOT NULL, "category" integer NOT NULL, "text" text NOT NULL, PRIMARY KEY ("id") ); -- -- Table: comment02 -- -- Comments: -- Table: comment -- DROP TABLE comment CASCADE; --CREATE TABLE "comment02" ( "id" serial NOT NULL, "title" text NOT NULL, "url_title" text NOT NULL, "body" text NOT NULL, "commenter" text NOT NULL, "page" integer NOT NULL, "created" timestamp(0) DEFAULT now() NOT NULL, "updated" timestamp(0) DEFAULT now() NOT NULL, PRIMARY KEY ("id") ); -- -- Foreign Key Definitions -- ALTER TABLE "snippet02" ADD FOREIGN KEY ("category") REFERENCES "category" ("id") ON DELETE cascade ON UPDATE cascade; ALTER TABLE "comment02" ADD FOREIGN KEY ("page") REFERENCES "page" ("id");
true
b926af0c4086384422f4b0fa4e7a6f84e0ad96e8
SQL
NedHerrera/Cassandra-DEMO
/DML/queryx.cql
UTF-8
1,447
3.890625
4
[]
no_license
use Cassandra_LaLiga; -- 1 -- Partidos de X Temporada donde Y equipo ha jugado como local -- Respuesta: -- select * from match_local where season = 'XXXX-YYYY' and local_team = 'ZZZZ'; select * from match_local where season = '1979-1980' and local_team = 'Betis' ; -- 2 -- Partidos de X Temporada donde Y equipo ha jugado como visitante -- Respuesta: -- select * from match_visiting where season = 'XXXX-YYYY' and visiting_team = 'ZZZZ'; select * from match_visiting where season = '1979-1980' and visiting_team = 'Betis' ; -- 3 -- Marcadores finales para los partidos de X temporada donde han participado los equipos Y y Z -- Marcadores tanto de la primera vuelta como de la segunda -- Respuesta: -- select * from score where local_team in ('Y','Z') and visiting_team in ('Y','Z') and season = 'XXX1-XXX2'; select * from score where local_team in ('Zaragoza','Betis') and visiting_team in ('Zaragoza','Betis') and season = '1979-1980' ; -- 4 -- Partido donde se registre la victoria más abultada de X temporada -- Respuesta -- select * from big_victory where season = '1979-1980' order by local_team_score DESC limit 1 ; -- 5 -- Rival de X equipo para Y jornada de Z temporada select local_team as "Equipo seleccionado", visiting_team as "Rival de jornada", game_date_number as "Jornada", match_date as "Dia de partido", season from rival where local_team in ('Zaragoza') and season = '1979-1980' and game_date_number = 3 ;
true
e3055acfed8d6623bb42d9ea566fa312a4c8765c
SQL
LabKey/wnprc-modules
/WNPRC_EHR/resources/queries/study/demographicsMHC.sql
UTF-8
757
3.53125
4
[ "Apache-2.0" ]
permissive
/* * Copyright (c) 2010-2014 LabKey Corporation * * Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0 */ SELECT * FROM ( SELECT MAX(A01) AS A01, MAX(A02) AS A02, MAX(A11) AS A11, MAX(B08) AS B08, MAX(B17) AS B17, COUNT(*) AS totalAllelesTyped, Id FROM ( SELECT CASE WHEN ShortName = 'A01' THEN Status ELSE NULL END AS A01, CASE WHEN ShortName = 'A02' THEN Status ELSE NULL END AS A02, CASE WHEN ShortName = 'A11' THEN Status ELSE NULL END AS A11, CASE WHEN ShortName = 'B08' THEN Status ELSE NULL END AS B08, CASE WHEN ShortName = 'B17' THEN Status ELSE NULL END AS B17, Id FROM study.MHC_SSP_Summary ) X GROUP BY Id ) Y WHERE totalAllelesTyped > 0
true
8e71d5fd55345525c5b7fb944d1d7995c7a8653d
SQL
data2health/COVID_19TagLib
/src/non-packaged-resources/gkg.sql
UTF-8
5,810
3.78125
4
[]
no_license
CREATE TABLE gkg.raw ( date integer, numarts integer, counts text, themes text, locations text, persons text, organizations text, tone text, cameoeventids text, sources text, sourceurls text ); create index raw_date_int on raw(date); create table gkg_staging ( id serial primary key, date date, date_int int, numarts int, counts text, themes text, locations text, persons text, organizations text, tone text, cameo_event_ids text, sources text, source_urls text ); create index gkg_date on gkg_staging(date); create index gkg_date_int on gkg_staging(date_int); insert into gkg_staging( date, date_int, numarts, counts, themes, locations, persons, organizations, tone, cameo_event_ids, sources, source_urls ) select to_date(date::text,'yyyymmdd'), date, numarts, counts, themes, locations, persons, organizations, tone, cameoeventids, sources, sourceurls from raw; create materialized view gkg as select id, date, date_int, element[1]::float as tone, element[2]::float as positivity, element[3]::float as negativity, element[4]::float as polarity, element[5]::float as activity_reference_density, element[6]::float as self_group_reference_density from (select id,date,date_int,string_to_array(tone,',') as element from gkg_staging) as foo ; create index gkg2_id on gkg(id); create index gkg2_date on gkg(date); create index gkg2_date_int on gkg(date_int); create materialized view theme as select id,seqnum,theme from gkg_staging cross join lateral unnest(string_to_array(themes,';')) with ordinality as s(theme, seqnum) ; create index theme_id on theme(id); create index theme_theme on theme(theme); create materialized view location_staging as select id,seqnum,location from gkg_staging cross join lateral unnest(string_to_array(locations,';')) with ordinality as s(location, seqnum) ; create materialized view location as select id, seqnum, element[1] as geo_type, element[2] as geo_full_name, element[3] as geo_country_code, element[4] as geo_adm1_code, case when length(element[5]) = 0 then null else element[5]::float end as latitute, case when length(element[6]) = 0 then null else element[6]::float end as longitude, element[7] as geo_feature_id from (select id,seqnum,string_to_array(location,'#') as element from location_staging) as foo ; create index location_id on location(id); create index location_country_code on location(geo_country_code); create index location_adm1_code on location(geo_adm1_code); create materialized view person as select id,seqnum,person from gkg_staging cross join lateral unnest(string_to_array(persons,';')) with ordinality as s(person, seqnum) ; create index person_id on person(id); create index person_person on person(person); create materialized view organization as select id,seqnum,organization from gkg_staging cross join lateral unnest(string_to_array(organizations,';')) with ordinality as s(organization, seqnum) ; create index organization_id on organization(id); create index organization_organization on organization(organization); create materialized view cameo_event_id as select id,seqnum,cameo_event_id from gkg_staging cross join lateral unnest(string_to_array(cameo_event_ids,',')) with ordinality as s(cameo_event_id, seqnum) ; create index cameo_id on cameo_event_id(id); create index cameo_cameo on cameo_event_id(cameo_event_id); create materialized view source as select id,seqnum,source from gkg_staging cross join lateral unnest(string_to_array(sources,';')) with ordinality as s(source, seqnum) ; create index source_id on source(id); create index source_source on source(source); create materialized view source_url as select id,seqnum,source_url from gkg_staging cross join lateral unnest(string_to_array(source_urls,'<UDIV>')) with ordinality as s(source_url, seqnum) ; create index source_url_id on source_url(id); create materialized view umls_local.hierarchy as select mrhier.cui, mrhier.aui, mrconso.str, ancestor.cui as ancestor_cui, ancestor_aui, ancestor.str as ancestor_str, seqnum + 1 as depth, ( select max(seqnum) from umls.mrhier as x cross join lateral unnest(string_to_array(ptr,'.')) with ordinality as s(ancestor_aui, seqnum) where mrhier.cui = x.cui and mrhier.ptr = x.ptr and mrhier.ptr ~ '^A0434168' ) - seqnum + 1 as distance from umls.mrhier cross join lateral unnest(string_to_array(ptr,'.')) with ordinality as s(ancestor_aui, seqnum), umls.mrconso, umls.mrconso as ancestor where mrhier.aui=mrconso.aui and ancestor_aui = ancestor.aui and mrhier.ptr ~ '^A0434168' ; create materialized view umls_local.hierarchy_full as select mrhier.cui, mrhier.aui, mrconso.str, ancestor.cui as ancestor_cui, ancestor_aui, ancestor.str as ancestor_str, seqnum + 1 as depth, ( select max(seqnum) from umls.mrhier as x cross join lateral unnest(string_to_array(ptr,'.')) with ordinality as s(ancestor_aui, seqnum) where mrhier.cui = x.cui and mrhier.ptr = x.ptr ) - seqnum + 1 as distance from umls.mrhier cross join lateral unnest(string_to_array(ptr,'.')) with ordinality as s(ancestor_aui, seqnum), umls.mrconso, umls.mrconso as ancestor where mrhier.aui=mrconso.aui and ancestor_aui = ancestor.aui ; ------------------------------ create materialized view gkg_covid as select distinct gkg.* from gkg.gkg natural join gkg.theme natural join gkg.theme_count where theme_count.theme~'CORONAVIRUS' or theme_count.theme~'COVID'; create index gkg_id on gkg_covid(id); create materialized view source_url_covid as select source_url.* from gkg_covid natural join gkg.source_url; create index source_id on source_url_covid(id); create index source_url on source_url_covid(source_url); create table document( source_url text primary key, visited timestamp, html text );
true
594f63bd16f430912099a4018f8062cd36062995
SQL
OPERANDOH2020/op-core
/op-core-bigdataanalytics/eu.operando.core.bda.server/src/main/sql/creation.sql
UTF-8
3,866
3.0625
3
[ "Apache-2.0" ]
permissive
-- MySQL dump 10.13 Distrib 5.6.17, for Win32 (x86) -- -- Host: localhost Database: operando_bigdataanalyticsdb -- ------------------------------------------------------ -- Server version 5.6.17 /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -- -- Table structure for table `jobs` -- DROP TABLE IF EXISTS `jobs`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `jobs` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(50) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `jobs` -- LOCK TABLES `jobs` WRITE; /*!40000 ALTER TABLE `jobs` DISABLE KEYS */; INSERT INTO `jobs` VALUES (1,'job 01'),(2,'job 02'),(3,'job 03'),(4,'job 04'),(5,'job 05'),(6,'job 06'),(7,'job 07'); /*!40000 ALTER TABLE `jobs` 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, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!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),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13),(14),(15),(16),(17); /*!40000 ALTER TABLE `users` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `usersjobs` -- DROP TABLE IF EXISTS `usersjobs`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `usersjobs` ( `user_id` int(10) NOT NULL DEFAULT '0', `job_id` int(10) NOT NULL DEFAULT '0', `subscribed` tinyint(1) DEFAULT '0', `frequency` varchar(50) DEFAULT NULL, `downloadLink` varchar(50) DEFAULT NULL, PRIMARY KEY (`user_id`,`job_id`), KEY `fk_user_id` (`user_id`), KEY `fk_job_id` (`job_id`), CONSTRAINT `fk_user_id` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_job_id` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `usersjobs` -- LOCK TABLES `usersjobs` WRITE; /*!40000 ALTER TABLE `usersjobs` DISABLE KEYS */; INSERT INTO `usersjobs` VALUES (3,2,1,'monthly','http://operando.eu/'),(3,5,0,NULL,NULL),(3,6,1,'dayly',NULL),(3,7,1,'hourly',NULL); /*!40000 ALTER TABLE `usersjobs` ENABLE KEYS */; UNLOCK TABLES; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; -- Dump completed on 2016-07-04 23:48:23
true
1fd900128d2d3836a591ff4f374e92c5b8f67659
SQL
ashre1/MovieTicketingSystem
/movie.sql
UTF-8
15,508
3.046875
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 4.2.7.1 -- http://www.phpmyadmin.net -- -- Host: 127.0.0.1 -- Generation Time: Aug 10, 2017 at 08:39 AM -- Server version: 5.6.20 -- PHP Version: 5.5.15 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: `movie` -- -- -------------------------------------------------------- -- -- Table structure for table `booking` -- CREATE TABLE IF NOT EXISTS `booking` ( `Cus_ID` varchar(5) NOT NULL, `Ticket_No` varchar(5) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Table structure for table `booking1` -- CREATE TABLE IF NOT EXISTS `booking1` ( `Cus_ID` varchar(20) NOT NULL, `Ticket_No` varchar(20) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Table structure for table `booking2` -- CREATE TABLE IF NOT EXISTS `booking2` ( `Cus_ID` varchar(20) NOT NULL, `Ticket_No` varchar(20) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Table structure for table `booking3` -- CREATE TABLE IF NOT EXISTS `booking3` ( `Cus_ID` varchar(20) NOT NULL, `Ticket_No` varchar(20) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Table structure for table `customer` -- CREATE TABLE IF NOT EXISTS `customer` ( `Cus_ID` varchar(20) NOT NULL, `Name` varchar(50) NOT NULL, `Gender` varchar(20) NOT NULL, `Address` varchar(50) NOT NULL, `Contact` varchar(20) NOT NULL, `Email` varchar(50) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `customer` -- INSERT INTO `customer` (`Cus_ID`, `Name`, `Gender`, `Address`, `Contact`, `Email`) VALUES ('C001', 'qqqqqq', 'Male', 'zzzzzz', 'zn', 'znck'), ('C002', 'yyyyyyyy', 'Male', 'asdhfk', 'jasdk', 'asdjkfak'), ('C003', 'bbbbbbb', 'Female', 'asfd,hf', 'ajksdhjkf', 'sjdhfajk'), ('C004', 'zzzz', 'Male', 'asdkjhlfjk', 'asdfk', 'asjdkj'), ('C005', 'rabina', 'Female', 'samakhusi', '0987654321', 'rabina.maharjan@gmail.com'), ('C006', 'askjd', 'Male', 'asjkdhka', 'askdja', 'asioda'); -- -------------------------------------------------------- -- -- Table structure for table `details` -- CREATE TABLE IF NOT EXISTS `details` ( `ID` varchar(10) NOT NULL, `Mov_Name` varchar(100) NOT NULL, `Title` varchar(100) NOT NULL, `Review` varchar(2000) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `details` -- INSERT INTO `details` (`ID`, `Mov_Name`, `Title`, `Review`) VALUES ('001', 'holiday', 'A soldier is never off duty', 'A Soldier Is Never Off Duty is a 2014 Bollywood action thriller film written and directed by A.R. Murugadoss, and produced by Vipul Shah. It features Akshay Kumar and Sonakshi Sinha in the lead roles, along with Govinda in a supporting role. It is a remake of the 2012 Tamil film Thuppakki which was also directed by A. R. Murugadoss. The film released on 6 June 2014'); -- -------------------------------------------------------- -- -- Table structure for table `employee` -- CREATE TABLE IF NOT EXISTS `employee` ( `Emp_ID` varchar(20) NOT NULL, `Name` varchar(100) NOT NULL, `UserName` varchar(50) NOT NULL, `Password` varchar(20) NOT NULL, `Gender` varchar(20) NOT NULL, `Category` varchar(20) NOT NULL, `Address` varchar(100) NOT NULL, `Contact` varchar(100) NOT NULL, `Email` varchar(50) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `employee` -- INSERT INTO `employee` (`Emp_ID`, `Name`, `UserName`, `Password`, `Gender`, `Category`, `Address`, `Contact`, `Email`) VALUES ('E001', 'bishal', 'bishal', 'bishal', 'Male', 'Frontdesk officer', 'khusibu', '9876543210', 'bishal.baula@yahoo.com'), ('E002', 'ashish', 'ashish', 'ashish', 'Male', 'Admin', 'DhokaTole', '9841523955', 'shresthaashish1@hotmail.com'), ('E003', 'pandey', 'sabita', 'pandey', 'Female', 'Frontdesk Officer', 'samakhusi', '9843320069', 'purbi.pandey@yahoo.com'), ('E004', 'yograj', 'yograj', 'yograj', 'Male', 'Frontdesk Officer', 'jhapa', '0987656789', 'goks.gotiya@yahoo.com'); -- -------------------------------------------------------- -- -- Table structure for table `image` -- CREATE TABLE IF NOT EXISTS `image` ( `ID` varchar(20) NOT NULL, `Image` varchar(200) NOT NULL, `Image1` varchar(200) NOT NULL, `Img1` varchar(200) NOT NULL, `Img2` varchar(200) NOT NULL, `Img3` varchar(200) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `image` -- INSERT INTO `image` (`ID`, `Image`, `Image1`, `Img1`, `Img2`, `Img3`) VALUES ('001', 'E:\\Project\\MovieTicketingSystem\\src\\com\\MTS\\ui\\pic\\hold070414_2c.jpg', 'E:\\Project\\MovieTicketingSystem\\src\\com\\MTS\\ui\\pic\\main1.jpg', 'E:\\Project\\MovieTicketingSystem\\src\\com\\MTS\\ui\\pic\\N1.jpg', 'E:\\Project\\MovieTicketingSystem\\src\\com\\MTS\\ui\\pic\\N2.jpg', 'E:\\Project\\MovieTicketingSystem\\src\\com\\MTS\\ui\\pic\\N1.jpg'); -- -------------------------------------------------------- -- -- Table structure for table `login` -- CREATE TABLE IF NOT EXISTS `login` ( `ID` varchar(20) NOT NULL, `Name` varchar(100) NOT NULL, `Password` varchar(20) NOT NULL, `Category` varchar(20) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `login` -- INSERT INTO `login` (`ID`, `Name`, `Password`, `Category`) VALUES ('E001', 'bishal', 'bishal', 'frontdesk officer'), ('E002', 'ashish', 'ashish', 'Admin'), ('E003', 'sabita', 'pandey', 'Frontdesk Officer'), ('E004', 'yograj', 'yograj', 'Frontdesk Officer'); -- -------------------------------------------------------- -- -- Table structure for table `movie` -- CREATE TABLE IF NOT EXISTS `movie` ( `Mov_Name` varchar(100) NOT NULL, `Genre` varchar(20) NOT NULL, `Director` varchar(20) NOT NULL, `Release_Date` varchar(20) NOT NULL, `Length` varchar(20) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `movie` -- INSERT INTO `movie` (`Mov_Name`, `Genre`, `Director`, `Release_Date`, `Length`) VALUES ('Hate Story', 'Love strory', 'zzz', '2071/04/03', '2hrs 15min'), ('Holiday', 'Action', 'Marc Webb', '01 May 2014', '2 Hrs 22 Min'), ('Kick', 'Action', 'asjdaks', '2071/04/010', '2hrs 30min'); -- -------------------------------------------------------- -- -- Table structure for table `ticket` -- CREATE TABLE IF NOT EXISTS `ticket` ( `Number` varchar(20) NOT NULL, `Ticket` varchar(20) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `ticket` -- INSERT INTO `ticket` (`Number`, `Ticket`) VALUES ('A1', 'green'), ('A2', 'green'), ('A3', 'green'), ('A4', 'green'), ('A5', 'green'), ('A6', 'green'), ('A7', 'green'), ('A8', 'green'), ('A9', 'green'), ('A10', 'green'), ('B1', 'green'), ('B2', 'green'), ('B3', 'green'), ('B4', 'green'), ('B5', 'green'), ('B6', 'green'), ('B7', 'green'), ('B8', 'green'), ('B9', 'green'), ('B10', 'green'), ('C1', 'green'), ('C2', 'green'), ('C3', 'green'), ('C4', 'green'), ('C5', 'green'), ('C6', 'green'), ('C7', 'green'), ('C8', 'green'), ('C9', 'green'), ('C10', 'green'), ('D1', 'green'), ('D2', 'green'), ('D3', 'green'), ('D4', 'green'), ('D5', 'green'), ('D6', 'green'), ('D7', 'green'), ('D8', 'green'), ('D9', 'green'), ('D10', 'green'), ('E1', 'green'), ('E2', 'green'), ('E3', 'green'), ('E4', 'green'), ('E5', 'green'), ('E6', 'green'), ('E7', 'green'), ('E8', 'green'), ('E9', 'green'), ('E10', 'green'), ('F1', 'green'), ('F2', 'green'), ('F3', 'green'), ('F4', 'green'), ('F5', 'green'), ('F6', 'green'), ('F7', 'green'), ('F8', 'green'), ('F9', 'green'), ('F10', 'green'), ('G1', 'green'), ('G2', 'green'), ('G3', 'green'), ('G4', 'green'), ('G5', 'green'), ('G6', 'green'), ('G7', 'green'), ('G8', 'green'), ('G9', 'green'), ('G10', 'green'), ('H1', 'green'), ('H2', 'green'), ('H3', 'green'), ('H4', 'green'), ('H5', 'green'), ('H6', 'green'), ('H7', 'green'), ('H8', 'green'), ('H9', 'green'), ('H10', 'green'), ('I1', 'green'), ('I2', 'green'), ('I3', 'green'), ('I4', 'green'), ('I5', 'green'), ('I6', 'green'), ('I7', 'green'), ('I8', 'green'), ('I9', 'green'), ('I10', 'green'), ('J1', 'green'), ('J2', 'green'), ('J3', 'green'), ('J4', 'green'), ('J5', 'green'), ('J6', 'green'), ('J7', 'green'), ('J8', 'green'), ('J9', 'green'), ('J10', 'green'); -- -------------------------------------------------------- -- -- Table structure for table `ticket1` -- CREATE TABLE IF NOT EXISTS `ticket1` ( `Number` varchar(25) NOT NULL, `Ticket` varchar(25) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `ticket1` -- INSERT INTO `ticket1` (`Number`, `Ticket`) VALUES ('A1', 'green'), ('A2', 'green'), ('A3', 'green'), ('A4', 'green'), ('A5', 'green'), ('A6', 'green'), ('A7', 'green'), ('A8', 'green'), ('A9', 'green'), ('A10', 'green'), ('B1', 'green'), ('B2', 'green'), ('B1', 'green'), ('B2', 'green'), ('B3', 'green'), ('B4', 'green'), ('B5', 'green'), ('B6', 'green'), ('B7', 'green'), ('B8', 'green'), ('B9', 'green'), ('B10', 'green'), ('C1', 'green'), ('C2', 'green'), ('C3', 'green'), ('C4', 'green'), ('C5', 'green'), ('C6', 'green'), ('C7', 'green'), ('C8', 'green'), ('C9', 'green'), ('C10', 'green'), ('D1', 'green'), ('D2', 'green'), ('D3', 'green'), ('D4', 'green'), ('D5', 'green'), ('D6', 'green'), ('D7', 'green'), ('D8', 'green'), ('D9', 'green'), ('D10', 'green'), ('E1', 'green'), ('E2', 'green'), ('E3', 'green'), ('E4', 'green'), ('E5', 'green'), ('E6', 'green'), ('E7', 'green'), ('E8', 'green'), ('E9', 'green'), ('E10', 'green'), ('F1', 'green'), ('F2', 'green'), ('F3', 'green'), ('F4', 'green'), ('F5', 'green'), ('F6', 'green'), ('F7', 'green'), ('F8', 'green'), ('F9', 'green'), ('F10', 'green'), ('G1', 'green'), ('G2', 'green'), ('G3', 'green'), ('G4', 'green'), ('G5', 'green'), ('G6', 'green'), ('G7', 'green'), ('G8', 'green'), ('G9', 'green'), ('G10', 'green'), ('H1', 'green'), ('H2', 'green'), ('H3', 'green'), ('H4', 'green'), ('H5', 'green'), ('H6', 'green'), ('H7', 'green'), ('H8', 'green'), ('H9', 'green'), ('H10', 'green'), ('I1', 'green'), ('I2', 'green'), ('I3', 'green'), ('I4', 'green'), ('I5', 'green'), ('I6', 'green'), ('I7', 'green'), ('I8', 'green'), ('I9', 'green'), ('I10', 'green'), ('J1', 'green'), ('J2', 'green'), ('J3', 'green'), ('J4', 'green'), ('J5', 'green'), ('J6', 'green'), ('J7', 'green'), ('J8', 'green'), ('J9', 'green'), ('J10', 'green'); -- -------------------------------------------------------- -- -- Table structure for table `ticket2` -- CREATE TABLE IF NOT EXISTS `ticket2` ( `Number` varchar(25) NOT NULL, `Ticket` varchar(25) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `ticket2` -- INSERT INTO `ticket2` (`Number`, `Ticket`) VALUES ('A1', 'green'), ('A2', 'green'), ('A3', 'green'), ('A4', 'green'), ('A5', 'green'), ('A5', 'green'), ('A6', 'green'), ('A7', 'green'), ('A8', 'green'), ('A9', 'green'), ('A10', 'green'), ('B1', 'green'), ('B2', 'green'), ('B3', 'green'), ('B4', 'green'), ('B5', 'green'), ('B6', 'green'), ('B7', 'green'), ('B8', 'green'), ('B9', 'green'), ('B10', 'green'), ('C1', 'green'), ('C2', 'green'), ('C3', 'green'), ('C4', 'green'), ('C5', 'green'), ('C6', 'green'), ('C7', 'green'), ('C8', 'green'), ('C9', 'green'), ('C10', 'green'), ('D1', 'green'), ('D2', 'green'), ('D3', 'green'), ('D4', 'green'), ('D5', 'green'), ('D6', 'green'), ('D7', 'green'), ('D8', 'green'), ('D9', 'green'), ('D10', 'green'), ('E1', 'green'), ('E2', 'green'), ('E3', 'green'), ('E4', 'green'), ('E5', 'green'), ('E6', 'green'), ('E7', 'green'), ('E8', 'green'), ('E9', 'green'), ('E10', 'green'), ('F1', 'green'), ('F2', 'green'), ('F3', 'green'), ('F4', 'green'), ('F5', 'green'), ('F6', 'green'), ('F7', 'green'), ('F8', 'green'), ('F9', 'green'), ('F10', 'green'), ('G1', 'green'), ('G2', 'green'), ('G3', 'green'), ('G4', 'green'), ('G5', 'green'), ('G6', 'green'), ('G7', 'green'), ('G8', 'green'), ('G9', 'green'), ('G10', 'green'), ('H1', 'green'), ('H2', 'green'), ('H3', 'green'), ('H4', 'green'), ('H5', 'green'), ('H6', 'green'), ('H7', 'green'), ('H8', 'green'), ('H9', 'green'), ('H10', 'green'), ('I1', 'green'), ('I2', 'green'), ('I3', 'green'), ('I4', 'green'), ('I5', 'green'), ('I6', 'green'), ('I7', 'green'), ('I8', 'green'), ('I9', 'green'), ('I10', 'green'), ('J1', 'green'), ('J2', 'green'), ('J3', 'green'), ('J4', 'green'), ('J5', 'green'), ('J6', 'green'), ('J7', 'green'), ('J8', 'green'), ('J9', 'green'), ('J10', 'green'); -- -------------------------------------------------------- -- -- Table structure for table `ticket3` -- CREATE TABLE IF NOT EXISTS `ticket3` ( `Number` varchar(25) NOT NULL, `Ticket` varchar(25) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `ticket3` -- INSERT INTO `ticket3` (`Number`, `Ticket`) VALUES ('A1', 'green'), ('A2', 'green'), ('A3', 'green'), ('A4', 'green'), ('A4', 'green'), ('A5', 'green'), ('A6', 'green'), ('A7', 'green'), ('A8', 'green'), ('A9', 'green'), ('A10', 'green'), ('B1', 'green'), ('B2', 'green'), ('B3', 'green'), ('B4', 'green'), ('B5', 'green'), ('B6', 'green'), ('B7', 'green'), ('B8', 'green'), ('B9', 'green'), ('B10', 'green'), ('C1', 'green'), ('C2', 'green'), ('C3', 'green'), ('C4', 'green'), ('C5', 'green'), ('C6', 'green'), ('C7', 'green'), ('C8', 'green'), ('C9', 'green'), ('C10', 'green'), ('D1', 'green'), ('D2', 'green'), ('D3', 'green'), ('D4', 'green'), ('D5', 'green'), ('D6', 'green'), ('D7', 'green'), ('D8', 'green'), ('D9', 'green'), ('D10', 'green'), ('E1', 'green'), ('E2', 'green'), ('E3', 'green'), ('E4', 'green'), ('E5', 'green'), ('E6', 'green'), ('E7', 'green'), ('E8', 'green'), ('E9', 'green'), ('E10', 'green'), ('F1', 'green'), ('F2', 'green'), ('F3', 'green'), ('F4', 'green'), ('F5', 'green'), ('F6', 'green'), ('F7', 'green'), ('F8', 'green'), ('F9', 'green'), ('F10', 'green'), ('G1', 'green'), ('G2', 'green'), ('G3', 'green'), ('G4', 'green'), ('G5', 'green'), ('G6', 'green'), ('G7', 'green'), ('G8', 'green'), ('G9', 'green'), ('G10', 'green'), ('H1', 'green'), ('H2', 'green'), ('H3', 'green'), ('H4', 'green'), ('H5', 'green'), ('H6', 'green'), ('H7', 'green'), ('H8', 'green'), ('H9', 'green'), ('H10', 'green'), ('I1', 'green'), ('I2', 'green'), ('I3', 'green'), ('I4', 'green'), ('I5', 'green'), ('I6', 'green'), ('I7', 'green'), ('I8', 'green'), ('I9', 'green'), ('I10', 'green'), ('J1', 'green'), ('J2', 'green'), ('J3', 'green'), ('J4', 'green'), ('J5', 'green'), ('J6', 'green'), ('J7', 'green'), ('J8', 'green'), ('J9', 'green'), ('J10', 'green'); -- -- Indexes for dumped tables -- -- -- Indexes for table `customer` -- ALTER TABLE `customer` ADD PRIMARY KEY (`Cus_ID`); -- -- Indexes for table `details` -- ALTER TABLE `details` ADD PRIMARY KEY (`Mov_Name`); -- -- Indexes for table `employee` -- ALTER TABLE `employee` ADD PRIMARY KEY (`Emp_ID`); -- -- Indexes for table `image` -- ALTER TABLE `image` ADD PRIMARY KEY (`ID`); -- -- Indexes for table `login` -- ALTER TABLE `login` ADD PRIMARY KEY (`ID`); -- -- Indexes for table `movie` -- ALTER TABLE `movie` ADD PRIMARY KEY (`Mov_Name`); /*!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
53ef69e056e4bbdeba24625145c3b05326bdbf7c
SQL
WindhoverLabs/airliner
/apps/hs/test_and_ground/asist/prc/template/template_hs_emt3.prc
UTF-8
3,635
2.8125
3
[ "NASA-1.3" ]
permissive
PROC $sc_$cpu_hs_emt3 ;******************************************************************************* ; Test Name: hs_emt3 ; Test Level: Build Verification ; Test Type: Functional ; ; Test Description ; The purpose of this procedure is to generate an Event Monitoring Table ; that contains an entry for the HS_NOOP event with an action to cause a ; cFE Processor Reset ; ; Requirements Tested ; None ; ; Prerequisite Conditions ; None ; ; Assumptions and Constraints ; None. ; ; Change History ; ; Date Name Description ; 06/24/09 W. Moleski Initial release ; 01/13/11 W. Moleski Added variables for app and table names ; and dynamically created the endmnemonic ; ; Arguments ; None. ; ; Procedures Called ; Name Description ; create_tbl_file_from_cvt Procedure that creates a load file from ; the specified arguments and cvt ; ; Expected Test Results and Analysis ; ;********************************************************************** local logging = %liv (log_procedure) %liv (log_procedure) = FALSE #include "hs_platform_cfg.h" #include "hs_tbldefs.h" write ";*********************************************************************" write "; define local variables " write ";*********************************************************************" ;; CPU1 is the default local apid = 0xf73 local HSAppName = "HS" local emtTblName = HSAppName & "." & HS_EMT_TABLENAME if ("$CPU" = "CPU2") then apid = 0xf81 elseif ("$CPU" = "CPU3") then apid = 0xf92 endif write ";*********************************************************************" write "; Define the Application Monitoring Table " write ";*********************************************************************" ; Entry 1 $SC_$CPU_HS_EMT[1].AppName = "CFE_ES" $SC_$CPU_HS_EMT[1].NullTerm = 0 $SC_$CPU_HS_EMT[1].EventID = 10 $SC_$CPU_HS_EMT[1].ActionType = HS_EMT_ACT_NOACT ;; Entry 2 $SC_$CPU_HS_EMT[2].AppName = "CFE_EVS" $SC_$CPU_HS_EMT[2].NullTerm = 0 $SC_$CPU_HS_EMT[2].EventID = 10 $SC_$CPU_HS_EMT[2].ActionType = HS_EMT_ACT_NOACT ;; Entry 3 $SC_$CPU_HS_EMT[3].AppName = "CFE_TIME" $SC_$CPU_HS_EMT[3].NullTerm = 0 $SC_$CPU_HS_EMT[3].EventID = 10 $SC_$CPU_HS_EMT[3].ActionType = HS_EMT_ACT_NOACT ;; Entry 4 $SC_$CPU_HS_EMT[4].AppName = "CFE_TBL" $SC_$CPU_HS_EMT[4].NullTerm = 0 $SC_$CPU_HS_EMT[4].EventID = 10 $SC_$CPU_HS_EMT[4].ActionType = HS_EMT_ACT_NOACT ;; Entry 5 $SC_$CPU_HS_EMT[5].AppName = "CFE_SB" $SC_$CPU_HS_EMT[5].NullTerm = 0 $SC_$CPU_HS_EMT[5].EventID = 10 $SC_$CPU_HS_EMT[5].ActionType = HS_EMT_ACT_NOACT ;; Entry 6 $SC_$CPU_HS_EMT[6].AppName = "HS" $SC_$CPU_HS_EMT[6].NullTerm = 0 $SC_$CPU_HS_EMT[6].EventID = 23 $SC_$CPU_HS_EMT[6].ActionType = HS_EMT_ACT_PROC_RESET for index = 7 to HS_MAX_MONITORED_EVENTS do $SC_$CPU_HS_EMT[index].AppName = "" $SC_$CPU_HS_EMT[index].NullTerm = 0 $SC_$CPU_HS_EMT[index].EventID = 0 $SC_$CPU_HS_EMT[index].ActionType = HS_EMT_ACT_NOACT enddo ;; Restore procedure logging %liv (log_procedure) = logging local endmnemonic = "$SC_$CPU_HS_EMT[" & HS_MAX_MONITORED_EVENTS & "].ActionType" ;; Create the Table Load file s create_tbl_file_from_cvt ("$CPU",apid,"Event Monitoring Table Load 3","hs_def_emt3",emtTblName,"$SC_$CPU_HS_EMT[1].AppName",endmnemonic) write ";*********************************************************************" write "; End procedure $SC_$CPU_hs_emt3 " write ";*********************************************************************" ENDPROC
true
dae96e7af4a69fb73fe13d97f37dcc8e5b18d3e8
SQL
ceccs18c62/CS333
/lab3_20_11_2020.sql
UTF-8
1,020
4.15625
4
[]
no_license
-- create a table Employee CREATE TABLE Employee ( empID int PRIMARY KEY NOT NULL, name varchar(20) NOT NULL, dop date ); INSERT INTO Employee VALUES(1,"raj","20\11\1995"); INSERT INTO Employee VALUES(2,"sam","25\01\1990"); INSERT INTO Employee VALUES(3,"ram","10\08\1995"); -- 1 create a table Employeedetails CREATE TABLE Employeedetails ( detailsID char PRIMARY KEY NOT NULL, gender varchar(10) NOT NULL, dept varchar(20) NOT NULL, salary float NOT NULL, empid int, FOREIGN KEY (empid) REFERENCES Employee(empid) ); INSERT INTO Employeedetails VALUES("a","M","CS",45000,1); -- 2 Display the details of employee table where empid in employedetails table SELECT * FROM Employee WHERE empID in(SELECT empID FROM Employeedetails); -- output-> 1|raj|20\11\1995 -- 3 Display the details of employee table where emp id notin employedetails table SELECT * FROM Employee WHERE empID NOT IN(SELECT empID FROM Employeedetails); -- output-> 2|sam|25\01\1990 -- 3|ram|10\08\1995
true
7049906f5332c7b666dd6a2bcd9778036621ae9e
SQL
FranciscoMan/TestDB2
/PRD/Tables/K_WORK_ORDER_CARTON.sql
UTF-8
1,934
2.921875
3
[]
no_license
CREATE TABLE [PRD].[K_WORK_ORDER_CARTON] ( [ID_WO_CARTON] INT IDENTITY (1, 1) NOT NULL, [ID_CARTON] INT NOT NULL, [KY_CARTON] NVARCHAR (50) NOT NULL, [NM_CARTON] NVARCHAR (100) NULL, [DS_CARTON] NVARCHAR (1000) NULL, [NO_USAGE] INT NULL, [NO_SCRAP] INT NULL, [ID_WORK_ORDER] INT NOT NULL, [ID_PRODUCTION_LINE] INT NOT NULL, [ID_QA27] INT NOT NULL, [ID_SHIFT] INT NOT NULL, [ID_ITEM] INT NOT NULL, [KY_AUTHORIZER_USER] NVARCHAR (50) NULL, [DS_AUTHORIZE] NVARCHAR (500) NULL, [DT_CREATION] DATETIME NOT NULL, [DT_UPDATE] DATETIME NULL, [KY_USER_APP_CREATION] NVARCHAR (50) NOT NULL, [KY_USER_APP_UPDATE] NVARCHAR (50) NULL, [NM_PROGAM_CREATE] NVARCHAR (50) NOT NULL, [NM_PROGRAM_UPDATE] NVARCHAR (50) NULL, CONSTRAINT [PK_K_WORK_ORDER_CARTON] PRIMARY KEY CLUSTERED ([ID_WO_CARTON] ASC), CONSTRAINT [FK_K_WORK_ORDER_CARTON_C_ITEM] FOREIGN KEY ([ID_ITEM]) REFERENCES [PRD].[C_ITEM] ([ID_ITEM]), CONSTRAINT [FK_K_WORK_ORDER_CARTON_C_PRODUCTION_LINE] FOREIGN KEY ([ID_PRODUCTION_LINE]) REFERENCES [PRD].[C_PRODUCTION_LINE] ([ID_PRODUCTION_LINE]), CONSTRAINT [FK_K_WORK_ORDER_CARTON_C_VALUE_CATALOG] FOREIGN KEY ([ID_CARTON]) REFERENCES [ADM].[C_VALUE_CATALOG] ([ID_VALUE_CATALOG]), CONSTRAINT [FK_K_WORK_ORDER_CARTON_K_QA27] FOREIGN KEY ([ID_QA27]) REFERENCES [PRD].[K_QA27] ([ID_QA27]), CONSTRAINT [FK_K_WORK_ORDER_CARTON_K_SHIFT] FOREIGN KEY ([ID_SHIFT]) REFERENCES [PRD].[K_SHIFT] ([ID_SHIFT]), CONSTRAINT [FK_K_WORK_ORDER_CARTON_K_WORK_ORDER] FOREIGN KEY ([ID_WORK_ORDER]) REFERENCES [PRD].[K_WORK_ORDER] ([ID_WORK_ORDER]) );
true
7c2b8003d79868baad54d24c10215106aef30be0
SQL
METS-Programme/ugandaemr-openmrs-server
/sql.sql
UTF-8
16,853
3.21875
3
[]
no_license
DROP TABLE IF EXISTS facility; CREATE TABLE `facility` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `uuid` CHAR(38) NOT NULL, `name` TEXT, PRIMARY KEY (`id`) )ENGINE = InnoDB DEFAULT CHARSET = utf8; DROP TABLE IF EXISTS encounter; CREATE TABLE `encounter` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `encounter_type` CHAR(38) NOT NULL, `patient` CHAR(38) NOT NULL, `location` CHAR(38) DEFAULT NULL, `form` CHAR(38) DEFAULT NULL, `encounter_datetime` DATETIME NOT NULL, `creator` CHAR(38) NOT NULL, `date_created` DATETIME NOT NULL, `voided` TINYINT(1) NOT NULL DEFAULT '0', `voided_by` CHAR(38) DEFAULT NULL, `date_voided` DATETIME DEFAULT NULL, `void_reason` VARCHAR(255) DEFAULT NULL, `changed_by` CHAR(38) DEFAULT NULL, `date_changed` DATETIME DEFAULT NULL, `visit` CHAR(38) DEFAULT NULL, `uuid` CHAR(38) NOT NULL, `facility` CHAR(38), `state` CHAR(12), PRIMARY KEY (`id`) )ENGINE = InnoDB DEFAULT CHARSET = utf8; DROP TABLE IF EXISTS obs; CREATE TABLE `obs` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `person` CHAR(38) NOT NULL, `concept` CHAR(38) NOT NULL, `encounter` CHAR(38) DEFAULT NULL, `order` CHAR(38) DEFAULT NULL, `obs_datetime` DATETIME NOT NULL, `location` CHAR(38) DEFAULT NULL, `obs_group` CHAR(38) DEFAULT NULL, `accession_number` VARCHAR(255) DEFAULT NULL, `value_group` CHAR(38) DEFAULT NULL, `value_boolean` TINYINT(1) DEFAULT NULL, `value_coded` CHAR(38) DEFAULT NULL, `value_coded_name` CHAR(38) DEFAULT NULL, `value_drug` CHAR(38) DEFAULT NULL, `value_datetime` DATETIME DEFAULT NULL, `value_numeric` DOUBLE DEFAULT NULL, `value_modifier` VARCHAR(2) DEFAULT NULL, `value_text` TEXT, `value_complex` VARCHAR(255) DEFAULT NULL, `comments` VARCHAR(255) DEFAULT NULL, `creator` CHAR(38) NOT NULL DEFAULT '0', `date_created` DATETIME NOT NULL, `voided` TINYINT(1) NOT NULL DEFAULT '0', `voided_by` CHAR(38) DEFAULT NULL, `date_voided` DATETIME DEFAULT NULL, `void_reason` VARCHAR(255) DEFAULT NULL, `uuid` CHAR(38) NOT NULL, `facility` CHAR(38), `state` CHAR(12), `previous_version` INT(11) DEFAULT NULL, `form_namespace_and_path` varchar(255), PRIMARY KEY (`id`) )ENGINE = InnoDB DEFAULT CHARSET = utf8; DROP TABLE IF EXISTS patient; CREATE TABLE `patient` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `gender` VARCHAR(50) DEFAULT '', `birthdate` DATE DEFAULT NULL, `birthdate_estimated` TINYINT(1) NOT NULL DEFAULT '0', `dead` TINYINT(1) NOT NULL DEFAULT '0', `death_date` DATETIME DEFAULT NULL, `cause_of_death` CHAR(38) DEFAULT NULL, `creator` CHAR(38) DEFAULT NULL, `date_created` DATETIME NOT NULL, `changed_by` CHAR(38) DEFAULT NULL, `date_changed` DATETIME DEFAULT NULL, `voided` TINYINT(1) NOT NULL DEFAULT '0', `voided_by` CHAR(38) DEFAULT NULL, `date_voided` DATETIME DEFAULT NULL, `void_reason` VARCHAR(255) DEFAULT NULL, `uuid` CHAR(38) NOT NULL, `facility` CHAR(38), `state` CHAR(12), `deathdate_estimated` TINYINT(1) NOT NULL DEFAULT '0', `birthtime` TIME DEFAULT NULL, `allergy_status` VARCHAR(50) DEFAULT 'Unknown', PRIMARY KEY (`id`) )ENGINE = InnoDB DEFAULT CHARSET = utf8; DROP TABLE IF EXISTS patient_identifier; CREATE TABLE `patient_identifier` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `patient` CHAR(38) NOT NULL, `identifier` VARCHAR(50) NOT NULL DEFAULT '', `identifier_type` CHAR(38) NOT NULL , `preferred` TINYINT(1) NOT NULL DEFAULT '0', `location` CHAR(38) , `creator` CHAR(38) NOT NULL, `date_created` DATETIME NOT NULL, `date_changed` DATETIME DEFAULT NULL, `changed_by` CHAR(38) DEFAULT NULL, `voided` TINYINT(1) NOT NULL DEFAULT '0', `voided_by` CHAR(38) DEFAULT NULL, `date_voided` DATETIME DEFAULT NULL, `void_reason` VARCHAR(255) DEFAULT NULL, `uuid` CHAR(38) NOT NULL, `facility` CHAR(38), `state` CHAR(12), PRIMARY KEY (`id`) )ENGINE = InnoDB DEFAULT CHARSET = utf8; DROP TABLE IF EXISTS patient_program; CREATE TABLE `patient_program` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `patient` CHAR(38) NOT NULL, `program` CHAR(38) NOT NULL, `date_enrolled` DATETIME DEFAULT NULL, `date_completed` DATETIME DEFAULT NULL, `location` CHAR(38) DEFAULT NULL, `outcome_concept` CHAR(38) DEFAULT NULL, `creator` CHAR(38) NOT NULL, `date_created` DATETIME NOT NULL, `changed_by` CHAR(38) DEFAULT NULL, `date_changed` DATETIME DEFAULT NULL, `voided` TINYINT(1) NOT NULL DEFAULT '0', `voided_by` CHAR(38) DEFAULT NULL, `date_voided` DATETIME DEFAULT NULL, `void_reason` VARCHAR(255) DEFAULT NULL, `uuid` CHAR(38) NOT NULL, `facility` CHAR(38), `state` CHAR(12), PRIMARY KEY (`id`) )ENGINE = InnoDB DEFAULT CHARSET = utf8; DROP TABLE IF EXISTS patient_state; CREATE TABLE `patient_state` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `patient_state` CHAR(38) NOT NULL, `patient_program` CHAR(38) NOT NULL, `start_date` DATE DEFAULT NULL, `end_date` DATE DEFAULT NULL, `creator` CHAR(38) NOT NULL DEFAULT '0', `date_created` DATETIME NOT NULL, `changed_by` CHAR(38) DEFAULT NULL, `date_changed` DATETIME DEFAULT NULL, `voided` TINYINT(1) NOT NULL DEFAULT '0', `voided_by` CHAR(38) DEFAULT NULL, `date_voided` DATETIME DEFAULT NULL, `void_reason` VARCHAR(255) DEFAULT NULL, `uuid` CHAR(38) NOT NULL, `facility` CHAR(38), `state` CHAR(12), PRIMARY KEY (`id`) )ENGINE = InnoDB DEFAULT CHARSET = utf8; DROP TABLE IF EXISTS person; CREATE TABLE `person` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `gender` VARCHAR(50) DEFAULT '', `birthdate` DATE DEFAULT NULL, `birthdate_estimated` TINYINT(1) NOT NULL DEFAULT '0', `dead` TINYINT(1) NOT NULL DEFAULT '0', `death_date` DATETIME DEFAULT NULL, `cause_of_death` CHAR(38) DEFAULT NULL, `creator` CHAR(38) DEFAULT NULL, `date_created` DATETIME NOT NULL, `changed_by` CHAR(38) DEFAULT NULL, `date_changed` DATETIME DEFAULT NULL, `voided` TINYINT(1) NOT NULL DEFAULT '0', `voided_by` CHAR(38) DEFAULT NULL, `date_voided` DATETIME DEFAULT NULL, `void_reason` VARCHAR(255) DEFAULT NULL, `uuid` CHAR(38) NOT NULL, `facility` CHAR(38), `state` CHAR(12), `deathdate_estimated` TINYINT(1) NOT NULL DEFAULT '0', `birthtime` TIME DEFAULT NULL, PRIMARY KEY (`id`) )ENGINE = InnoDB DEFAULT CHARSET = utf8; DROP TABLE IF EXISTS person_address; CREATE TABLE `person_address` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `person` CHAR(38) DEFAULT NULL, `preferred` TINYINT(1) NOT NULL DEFAULT '0', `address1` VARCHAR(255) DEFAULT NULL, `address2` VARCHAR(255) DEFAULT NULL, `city_village` VARCHAR(255) DEFAULT NULL, `state_province` VARCHAR(255) DEFAULT NULL, `postal_code` VARCHAR(50) DEFAULT NULL, `country` VARCHAR(50) DEFAULT NULL, `latitude` VARCHAR(50) DEFAULT NULL, `longitude` VARCHAR(50) DEFAULT NULL, `start_date` DATETIME DEFAULT NULL, `end_date` DATETIME DEFAULT NULL, `creator` CHAR(38) NOT NULL, `date_created` DATETIME NOT NULL, `voided` TINYINT(1) NOT NULL DEFAULT '0', `voided_by` CHAR(38) DEFAULT NULL, `date_voided` DATETIME DEFAULT NULL, `void_reason` VARCHAR(255) DEFAULT NULL, `county_district` VARCHAR(255) DEFAULT NULL, `address3` VARCHAR(255) DEFAULT NULL, `address4` VARCHAR(255) DEFAULT NULL, `address5` VARCHAR(255) DEFAULT NULL, `address6` VARCHAR(255) DEFAULT NULL, `date_changed` DATETIME DEFAULT NULL, `changed_by` CHAR(38) DEFAULT NULL, `uuid` CHAR(38) NOT NULL, `facility` CHAR(38), `state` CHAR(12), PRIMARY KEY (`id`) )ENGINE = InnoDB DEFAULT CHARSET = utf8; DROP TABLE IF EXISTS person_attribute; CREATE TABLE `person_attribute` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `person` CHAR(38) NOT NULL, `value` VARCHAR(2500) NOT NULL DEFAULT '', `person_attribute_type` CHAR(38) NOT NULL, `creator` CHAR(38) NOT NULL, `date_created` DATETIME NOT NULL, `changed_by` CHAR(38) DEFAULT NULL, `date_changed` DATETIME DEFAULT NULL, `voided` TINYINT(1) NOT NULL DEFAULT '0', `voided_by` CHAR(38) DEFAULT NULL, `date_voided` DATETIME DEFAULT NULL, `void_reason` VARCHAR(255) DEFAULT NULL, `uuid` CHAR(38) NOT NULL, `facility` CHAR(38), `state` CHAR(12), PRIMARY KEY (`id`) )ENGINE = InnoDB DEFAULT CHARSET = utf8; DROP TABLE IF EXISTS person_name; CREATE TABLE `person_name` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `preferred` TINYINT(1) NOT NULL DEFAULT '0', `person` CHAR(38) NOT NULL, `prefix` VARCHAR(50) DEFAULT NULL, `given_name` VARCHAR(50) DEFAULT NULL, `middle_name` VARCHAR(50) DEFAULT NULL, `family_name_prefix` VARCHAR(50) DEFAULT NULL, `family_name` VARCHAR(50) DEFAULT NULL, `family_name2` VARCHAR(50) DEFAULT NULL, `family_name_suffix` VARCHAR(50) DEFAULT NULL, `degree` VARCHAR(50) DEFAULT NULL, `creator` CHAR(38) NOT NULL, `date_created` DATETIME NOT NULL, `voided` TINYINT(1) NOT NULL DEFAULT '0', `voided_by` CHAR(38) DEFAULT NULL, `date_voided` DATETIME DEFAULT NULL, `void_reason` VARCHAR(255) DEFAULT NULL, `changed_by` CHAR(38) DEFAULT NULL, `date_changed` DATETIME DEFAULT NULL, `uuid` CHAR(38) NOT NULL, `facility` CHAR(38), `state` CHAR(12), PRIMARY KEY (`id`) )ENGINE = InnoDB DEFAULT CHARSET = utf8; DROP TABLE IF EXISTS relationship; CREATE TABLE `relationship` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `person_a` CHAR(38) NOT NULL, `relationship` CHAR(38) NOT NULL, `person_b` CHAR(38) NOT NULL, `start_date` DATETIME DEFAULT NULL, `end_date` DATETIME DEFAULT NULL, `creator` CHAR(38) NOT NULL, `date_created` DATETIME NOT NULL, `date_changed` DATETIME DEFAULT NULL, `changed_by` CHAR(38) DEFAULT NULL, `voided` TINYINT(1) NOT NULL DEFAULT '0', `voided_by` CHAR(38) DEFAULT NULL, `date_voided` DATETIME DEFAULT NULL, `void_reason` VARCHAR(255) DEFAULT NULL, `uuid` CHAR(38) NOT NULL, `facility` CHAR(38), `state` CHAR(12), PRIMARY KEY (`id`) )ENGINE = InnoDB DEFAULT CHARSET = utf8; DROP TABLE IF EXISTS visit; CREATE TABLE `visit` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `patient` CHAR(38) NOT NULL, `visit_type` CHAR(38) NOT NULL, `start_datetime` DATETIME NOT NULL, `stop_datetime` DATETIME DEFAULT NULL, `indication_concept` CHAR(38) DEFAULT NULL, `location` CHAR(38) DEFAULT NULL, `creator` CHAR(38) NOT NULL, `date_created` DATETIME NOT NULL, `changed_by` CHAR(38) DEFAULT NULL, `date_changed` DATETIME DEFAULT NULL, `voided` TINYINT(1) NOT NULL DEFAULT '0', `voided_by` CHAR(38) DEFAULT NULL, `date_voided` DATETIME DEFAULT NULL, `void_reason` VARCHAR(255) DEFAULT NULL, `uuid` CHAR(38) NOT NULL, `facility` CHAR(38), `state` CHAR(12), PRIMARY KEY (`id`) )ENGINE = InnoDB DEFAULT CHARSET = utf8; DROP TABLE IF EXISTS encounter_provider; CREATE TABLE `encounter_provider` ( `id` int(11) NOT NULL AUTO_INCREMENT, `encounter` CHAR(38) NOT NULL, `provider` CHAR(38) NOT NULL, `encounter_role` CHAR(38) NOT NULL, `creator` CHAR(38), `date_created` datetime NOT NULL, `changed_by` CHAR(38) DEFAULT NULL, `date_changed` datetime DEFAULT NULL, `voided` tinyint(1) DEFAULT '0', `date_voided` datetime DEFAULT NULL, `voided_by` CHAR(38) DEFAULT NULL, `void_reason` varchar(255) DEFAULT NULL, `uuid` char(38) NOT NULL, `facility` CHAR(38), `state` CHAR(12), PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; DROP TABLE IF EXISTS provider; CREATE TABLE `provider` ( `id` int(11) NOT NULL AUTO_INCREMENT, `person` CHAR(38) DEFAULT NULL, `name` varchar(255) DEFAULT NULL, `identifier` varchar(255) DEFAULT NULL, `creator` CHAR(38) NOT NULL, `date_created` datetime NOT NULL, `changed_by` CHAR(38) DEFAULT NULL, `date_changed` datetime DEFAULT NULL, `retired` tinyint(1) NOT NULL DEFAULT '0', `retired_by` CHAR(38) DEFAULT NULL, `date_retired` datetime DEFAULT NULL, `retire_reason` varchar(255) DEFAULT NULL, `uuid` char(38) NOT NULL, `provider_role` CHAR(38) DEFAULT NULL, `facility` CHAR(38), `state` CHAR(12), PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; DROP TABLE IF EXISTS encounter_role; CREATE TABLE `encounter_role` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(255) NOT NULL, `description` varchar(1024) DEFAULT NULL, `creator` char(38) NOT NULL, `date_created` datetime NOT NULL, `changed_by` char(38) DEFAULT NULL, `date_changed` datetime DEFAULT NULL, `retired` tinyint(1) NOT NULL DEFAULT '0', `retired_by` char(38) DEFAULT NULL, `date_retired` datetime DEFAULT NULL, `retire_reason` varchar(255) DEFAULT NULL, `uuid` char(38) NOT NULL, `facility` CHAR(38), `state` CHAR(12), PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; DROP TABLE IF EXISTS fingerprint; CREATE TABLE `fingerprint` ( `id` int(11) NOT NULL AUTO_INCREMENT, `patient` varchar(38) NOT NULL, `finger` int(1) DEFAULT NULL, `fingerprint` TEXT NOT NULL, `uploaded` int DEFAULT 0, `facility` CHAR(38), `state` CHAR(12), PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
true
a680ebe7d59550605b674f7307a6a5abb876136c
SQL
eamaralp/SQL-Matera
/funcGolJogador.sql
UTF-8
356
2.890625
3
[]
no_license
CREATE OR REPLACE FUNCTION golsPorJogador ( pnIdJogador IN NUMBER ) RETURN NUMBER AS pnNumeroGols NUMBER; BEGIN SELECT COUNT(*) INTO pnNumeroGols FROM gol, jogo_jogador JJG WHERE gol.id_jogo_jogador = JJG.id_jogo_jogador AND JJG.id_jogador = pnIdJogador; RETURN pnNumeroGols; END;
true
028d5db319e28413e696dd14f15127b8ba04d7d9
SQL
sebaspala02/taller1ElectivaII
/resource/db/script.sql
UTF-8
10,169
3
3
[ "MIT" ]
permissive
-- MySQL Script generated by MySQL Workbench -- Tue Oct 22 09:19:34 2019 -- Model: New Model Version: 1.0 -- MySQL Workbench Forward Engineering SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0; SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0; SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES'; -- ----------------------------------------------------- -- Schema registroFinca -- ----------------------------------------------------- -- ----------------------------------------------------- -- Schema registroFinca -- ----------------------------------------------------- CREATE SCHEMA IF NOT EXISTS `registroFinca` DEFAULT CHARACTER SET utf8 ; USE `registroFinca` ; -- ----------------------------------------------------- -- Table `registroFinca`.`Departamento` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `registroFinca`.`Departamento` ( `idDepartamento` INT NOT NULL AUTO_INCREMENT, `nombreDepto` VARCHAR(45) NOT NULL, PRIMARY KEY (`idDepartamento`)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `registroFinca`.`Municipio` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `registroFinca`.`Municipio` ( `idMunicipio` INT NOT NULL AUTO_INCREMENT, `nombreMpio` VARCHAR(45) NOT NULL, `Departamento_idDepartamento` INT NOT NULL, PRIMARY KEY (`idMunicipio`, `Departamento_idDepartamento`), INDEX `fk_Municipio_Departamento1_idx` (`Departamento_idDepartamento` ASC), CONSTRAINT `fk_Municipio_Departamento1` FOREIGN KEY (`Departamento_idDepartamento`) REFERENCES `registroFinca`.`Departamento` (`idDepartamento`) ) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `registroFinca`.`Finca` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `registroFinca`.`Finca` ( `idFinca` INT NOT NULL AUTO_INCREMENT, `nombreFinca` VARCHAR(45) NOT NULL, `tamanio` INT NOT NULL, `Municipio_idMunicipio` INT NOT NULL, `cantidad` VARCHAR(45) NOT NULL, `piscina` VARCHAR(3) NOT NULL, `descripcion` VARCHAR(200) NOT NULL, PRIMARY KEY (`idFinca`, `Municipio_idMunicipio`), INDEX `fk_Finca_Municipio1_idx` (`Municipio_idMunicipio` ASC), CONSTRAINT `fk_Finca_Municipio1` FOREIGN KEY (`Municipio_idMunicipio`) REFERENCES `registroFinca`.`Municipio` (`idMunicipio`) ) ENGINE = InnoDB; -- ----------------------------------------------------- -- Insert Tabla Departamento -- ----------------------------------------------------- INSERT INTO `registroFinca`.`Departamento` (`idDepartamento`, `nombreDepto`) VALUES ('1', 'QUINDIO'); INSERT INTO `registroFinca`.`Departamento` (`idDepartamento`, `nombreDepto`) VALUES ('2', 'RISARALDA'); INSERT INTO `registroFinca`.`Departamento` (`idDepartamento`, `nombreDepto`) VALUES ('3', 'VALLE'); INSERT INTO `registroFinca`.`Departamento` (`idDepartamento`, `nombreDepto`) VALUES ('4', 'ANTIOQUIA'); INSERT INTO `registroFinca`.`Departamento` (`idDepartamento`, `nombreDepto`) VALUES ('5', 'CALDAS'); -- ----------------------------------------------------- -- Insert Tabla Municipio -- ----------------------------------------------------- INSERT INTO `registroFinca`.`Municipio` (`idMunicipio`, `nombreMpio`, `Departamento_idDepartamento`) VALUES ('1', 'ARMENIA', '1'); INSERT INTO `registroFinca`.`Municipio` (`idMunicipio`, `nombreMpio`, `Departamento_idDepartamento`) VALUES ('2', 'BUENAVISTA', '1'); INSERT INTO `registroFinca`.`Municipio` (`idMunicipio`, `nombreMpio`, `Departamento_idDepartamento`) VALUES ('3', 'CALARCA', '1'); INSERT INTO `registroFinca`.`Municipio` (`idMunicipio`, `nombreMpio`, `Departamento_idDepartamento`) VALUES ('4', 'CIRCASIA', '1'); INSERT INTO `registroFinca`.`Municipio` (`idMunicipio`, `nombreMpio`, `Departamento_idDepartamento`) VALUES ('5', 'CORDOBA', '1'); INSERT INTO `registroFinca`.`Municipio` (`idMunicipio`, `nombreMpio`, `Departamento_idDepartamento`) VALUES ('6', 'FILANDIA', '1'); INSERT INTO `registroFinca`.`Municipio` (`idMunicipio`, `nombreMpio`, `Departamento_idDepartamento`) VALUES ('7', 'GENOVA', '1'); INSERT INTO `registroFinca`.`Municipio` (`idMunicipio`, `nombreMpio`, `Departamento_idDepartamento`) VALUES ('8', 'TEBAIDA', '1'); INSERT INTO `registroFinca`.`Municipio` (`idMunicipio`, `nombreMpio`, `Departamento_idDepartamento`) VALUES ('9', 'MONTENEGRO', '1'); INSERT INTO `registroFinca`.`Municipio` (`idMunicipio`, `nombreMpio`, `Departamento_idDepartamento`) VALUES ('10', 'PIJAO', '1'); INSERT INTO `registroFinca`.`Municipio` (`idMunicipio`, `nombreMpio`, `Departamento_idDepartamento`) VALUES ('11', 'QUIMBAYA', '1'); INSERT INTO `registroFinca`.`Municipio` (`idMunicipio`, `nombreMpio`, `Departamento_idDepartamento`) VALUES ('12', 'SALENTO', '1'); INSERT INTO `registroFinca`.`Municipio` (`idMunicipio`, `nombreMpio`, `Departamento_idDepartamento`) VALUES ('13', 'PEREIRA', '2'); INSERT INTO `registroFinca`.`Municipio` (`idMunicipio`, `nombreMpio`, `Departamento_idDepartamento`) VALUES ('14', 'DOSQUEBRADAS', '2'); INSERT INTO `registroFinca`.`Municipio` (`idMunicipio`, `nombreMpio`, `Departamento_idDepartamento`) VALUES ('15', 'SANTA ROSA', '2'); INSERT INTO `registroFinca`.`Municipio` (`idMunicipio`, `nombreMpio`, `Departamento_idDepartamento`) VALUES ('16', 'MARSELLA', '2'); INSERT INTO `registroFinca`.`Municipio` (`idMunicipio`, `nombreMpio`, `Departamento_idDepartamento`) VALUES ('17', 'BALBOA', '2'); INSERT INTO `registroFinca`.`Municipio` (`idMunicipio`, `nombreMpio`, `Departamento_idDepartamento`) VALUES ('18', 'LA CELIA', '2'); INSERT INTO `registroFinca`.`Municipio` (`idMunicipio`, `nombreMpio`, `Departamento_idDepartamento`) VALUES ('19', 'SANTUARIO', '2'); INSERT INTO `registroFinca`.`Municipio` (`idMunicipio`, `nombreMpio`, `Departamento_idDepartamento`) VALUES ('20', 'APIA', '2'); INSERT INTO `registroFinca`.`Municipio` (`idMunicipio`, `nombreMpio`, `Departamento_idDepartamento`) VALUES ('21', 'CALI', '3'); INSERT INTO `registroFinca`.`Municipio` (`idMunicipio`, `nombreMpio`, `Departamento_idDepartamento`) VALUES ('22', 'CARTAGO', '3'); INSERT INTO `registroFinca`.`Municipio` (`idMunicipio`, `nombreMpio`, `Departamento_idDepartamento`) VALUES ('23', 'ALCALA', '3'); INSERT INTO `registroFinca`.`Municipio` (`idMunicipio`, `nombreMpio`, `Departamento_idDepartamento`) VALUES ('24', 'ULLOA', '3'); INSERT INTO `registroFinca`.`Municipio` (`idMunicipio`, `nombreMpio`, `Departamento_idDepartamento`) VALUES ('25', 'ANSERMA', '3'); INSERT INTO `registroFinca`.`Municipio` (`idMunicipio`, `nombreMpio`, `Departamento_idDepartamento`) VALUES ('26', 'OBANDO', '3'); INSERT INTO `registroFinca`.`Municipio` (`idMunicipio`, `nombreMpio`, `Departamento_idDepartamento`) VALUES ('27', 'ROLDANILLO', '3'); INSERT INTO `registroFinca`.`Municipio` (`idMunicipio`, `nombreMpio`, `Departamento_idDepartamento`) VALUES ('28', 'TULUA', '3'); INSERT INTO `registroFinca`.`Municipio` (`idMunicipio`, `nombreMpio`, `Departamento_idDepartamento`) VALUES ('29', 'BUGA', '3'); INSERT INTO `registroFinca`.`Municipio` (`idMunicipio`, `nombreMpio`, `Departamento_idDepartamento`) VALUES ('30', 'PALMIRA', '3'); INSERT INTO `registroFinca`.`Municipio` (`idMunicipio`, `nombreMpio`, `Departamento_idDepartamento`) VALUES ('31', 'MEDELLIN', '4'); INSERT INTO `registroFinca`.`Municipio` (`idMunicipio`, `nombreMpio`, `Departamento_idDepartamento`) VALUES ('32', 'ENVIGADO', '4'); INSERT INTO `registroFinca`.`Municipio` (`idMunicipio`, `nombreMpio`, `Departamento_idDepartamento`) VALUES ('33', 'SABANETA', '4'); INSERT INTO `registroFinca`.`Municipio` (`idMunicipio`, `nombreMpio`, `Departamento_idDepartamento`) VALUES ('34', 'RIO NEGRO', '4'); INSERT INTO `registroFinca`.`Municipio` (`idMunicipio`, `nombreMpio`, `Departamento_idDepartamento`) VALUES ('35', 'COPACABANA', '4'); INSERT INTO `registroFinca`.`Municipio` (`idMunicipio`, `nombreMpio`, `Departamento_idDepartamento`) VALUES ('36', 'GUATAPE', '4'); INSERT INTO `registroFinca`.`Municipio` (`idMunicipio`, `nombreMpio`, `Departamento_idDepartamento`) VALUES ('37', 'PEÑOL', '4'); INSERT INTO `registroFinca`.`Municipio` (`idMunicipio`, `nombreMpio`, `Departamento_idDepartamento`) VALUES ('38', 'MARINILLA', '4'); INSERT INTO `registroFinca`.`Municipio` (`idMunicipio`, `nombreMpio`, `Departamento_idDepartamento`) VALUES ('39', 'SAN ANTONIO', '4'); INSERT INTO `registroFinca`.`Municipio` (`idMunicipio`, `nombreMpio`, `Departamento_idDepartamento`) VALUES ('40', 'JARDIN', '4'); INSERT INTO `registroFinca`.`Municipio` (`idMunicipio`, `nombreMpio`, `Departamento_idDepartamento`) VALUES ('41', 'MANIZALES', '5'); INSERT INTO `registroFinca`.`Municipio` (`idMunicipio`, `nombreMpio`, `Departamento_idDepartamento`) VALUES ('42', 'RIOSUCIO', '5'); INSERT INTO `registroFinca`.`Municipio` (`idMunicipio`, `nombreMpio`, `Departamento_idDepartamento`) VALUES ('43', 'PENSILVANIA', '5'); INSERT INTO `registroFinca`.`Municipio` (`idMunicipio`, `nombreMpio`, `Departamento_idDepartamento`) VALUES ('44', 'LA DORADA', '5'); INSERT INTO `registroFinca`.`Municipio` (`idMunicipio`, `nombreMpio`, `Departamento_idDepartamento`) VALUES ('45', 'CHINCHINA', '5'); INSERT INTO `registroFinca`.`Municipio` (`idMunicipio`, `nombreMpio`, `Departamento_idDepartamento`) VALUES ('46', 'SALAMINA', '5'); INSERT INTO `registroFinca`.`Municipio` (`idMunicipio`, `nombreMpio`, `Departamento_idDepartamento`) VALUES ('47', 'ANSERMA', '5'); INSERT INTO `registroFinca`.`Municipio` (`idMunicipio`, `nombreMpio`, `Departamento_idDepartamento`) VALUES ('48', 'AGUADAS', '5'); INSERT INTO `registroFinca`.`Municipio` (`idMunicipio`, `nombreMpio`, `Departamento_idDepartamento`) VALUES ('49', 'PALESTINA', '5'); INSERT INTO `registroFinca`.`Municipio` (`idMunicipio`, `nombreMpio`, `Departamento_idDepartamento`) VALUES ('50', 'NEIRA', '5'); SELECT M.nombreMpio AS Municipio, D.nombreDepto AS Departamento FROM Municipio M JOIN Departamento D ON M.Departamento_idDepartamento = D.idDepartamento; SELECT nombreDepto from Municipio M join Departamento D on M.Departamento_idDepartamento = D.idDepartamento where M.idMunicipio = 34;
true
b0bb4524e4785f9a05e2759c2aa1d8d90765d35c
SQL
radtek/abs3
/sql/mmfo/bars/View/ra_kwt_2924.sql
UTF-8
1,233
3.359375
3
[]
no_license
PROMPT ===================================================================================== PROMPT *** Run *** ========== Scripts /Sql/BARS/View/RA_KWT_2924.sql =========*** Run *** == PROMPT ===================================================================================== PROMPT *** Create view RA_KWT_2924 *** CREATE OR REPLACE FORCE VIEW BARS.RA_KWT_2924 ("DAT31", "ACC", "KV", "NLS", "OST31", "NMS", "OSTC", "DATVZ") AS select "DAT31","ACC","KV","NLS","OST31","NMS","OSTC","DATVZ" from ( select to_date('01-03-2017','dd-mm-yyyy') -1 dat31, acc, kv, nls, fost(acc, to_date('01-03-2017','dd-mm-yyyy') -1 )/100 ost31 , nms , ostc/100 ostc, (select max(fdat) from saldoa where ostf=0 and dos<>kos and acc=aa.ACC ) datvz from accounts aa where nbs = '2924' and ob22 in ( '01', '14', '15', '16', '17', '18', '23', '25', '26', '27', '28' ) ) where datvz <to_date('01-03-2017','dd-mm-yyyy') and ost31 <>0; PROMPT ===================================================================================== PROMPT *** End *** ========== Scripts /Sql/BARS/View/RA_KWT_2924.sql =========*** End *** == PROMPT =====================================================================================
true
01c69376ca6512883329d05885ac4a78d47d53df
SQL
pavgra/WebPlatform
/auth-svr/src/main/resources/db/migration/V20190217213411__initial.sql
UTF-8
360
3.84375
4
[]
no_license
CREATE TABLE "user" ( id SERIAL PRIMARY KEY, username VARCHAR(255) UNIQUE, created_at TIMESTAMP DEFAULT now() NOT NULL ); CREATE TABLE role ( id SERIAL PRIMARY KEY, name VARCHAR(255) UNIQUE, created_at TIMESTAMP DEFAULT now() NOT NULL ); CREATE TABLE user_role ( user_id INTEGER REFERENCES "user" (id), role_id INTEGER REFERENCES role (id) );
true
5588c639f14f070b49f6fd392338567dbce58e5a
SQL
OlhaZSholohon/LV468
/Tables/dbo.FactDeliveries.sql
UTF-8
266
2.578125
3
[]
no_license
IF OBJECT_ID('dbo.FactDeliveries') IS NOT NULL DROP TABLE dbo.FactDeliveries CREATE TABLE FactDeliveries( DateKey INT NOT NULL , DeliveryDetailID INT NOT NULL , ProductID INT NOT NULL , LocationID INT NOT NULL , ClientID INT NOT NULL , SumWeight DECIMAL )
true
81bc5f4d0c443562a90c05d20cf67045a53fff14
SQL
sharonshlee/BootcampX
/1_queries/total_students_in_cohort.sql
UTF-8
133
3.25
3
[]
no_license
SELECT count(id) FROM students WHERE cohort_id IN (1, 2, 3); -- SELECT COUNT(*) -- FROM students -- WHERE cohort_id BETWEEN 1 AND 3;
true
ad3180fa0308a8510e183dc4337b5262c25824f0
SQL
Miamiohlibs/sql
/gobi-batch-cat-from-brief-bib.sql
UTF-8
682
3.671875
4
[]
no_license
--towards a query that might allow automated batch Connexion query --based on the brief bib ISBN for ebooks (work with Jennifer) --primarily looks for uncataloged ebooks in the past week SELECT --count(*) * FROM sierra_view.record_metadata AS m JOIN sierra_view.bib_record AS b --need to check bib rec for more info ON m.id = b.id JOIN sierra_view.bib_record_location AS l --need another table with location ON m.id = l.bib_record_id WHERE m.record_type_code = 'b' AND m.creation_date_gmt::date > current_date-7 AND m.deletion_date_gmt IS NULL AND m.campus_code = '' AND b.cataloging_date_gmt IS NULL AND l.location_code = 'onl' ORDER BY m.creation_date_gmt DESC LIMIT 100;
true
b91531a384c4cc99657864d39063390dae66a3ff
SQL
caoyunhao/spring-boot-petshop-admin
/sql/commodity_store.sql
UTF-8
777
2.6875
3
[]
no_license
/* Navicat Premium Data Transfer Source Server : localhost Source Server Type : MySQL Source Server Version : 50719 Source Host : localhost Source Database : petshop Target Server Type : MySQL Target Server Version : 50719 File Encoding : utf-8 Date: 04/15/2018 13:46:12 PM */ SET FOREIGN_KEY_CHECKS = 0; -- ---------------------------- -- Table structure for `commodity_store` -- ---------------------------- DROP TABLE IF EXISTS `commodity_store`; CREATE TABLE `commodity_store` ( `commodity_id` bigint(20) NOT NULL, `commodity_sold` bigint(20) NOT NULL DEFAULT '0', `commodity_last` bigint(20) NOT NULL DEFAULT '0', PRIMARY KEY (`commodity_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; SET FOREIGN_KEY_CHECKS = 1;
true
245b65132f2d83ddcfb100b2553219e3f6b939d1
SQL
5362396/Bazy-Danych
/sql6.sql
UTF-8
2,179
3.59375
4
[]
no_license
Lekcja 6 - NIE BĘDZIE NA KOLOSIE SHOW triggers; SHOW CREATE trigger nazwa; SHOW PROCEDURE STATUS WHERE db = 'nazwa_bazy'; SHOW FUNCTION STATUS WHERE db = 'nazwa_bazy'; DROP FUNCTION nazwa; # wyjaśnienie pojęcia [NOT] DETERMINISTIC Funkcja deterministyczna to taka, która dla tych samych danych wejściowych zwraca zawsze taki sam wynik. Funkcja nie deterministyczna może zwrócić różne wyniki dla tego samego parametru wejściowego, np. poprzez jakąś losowość, np. rzut kostką, losowanie wartości z przedziału itp). Zadanie 1 DELIMITER // CREATE TRIGGER kreatura_before_insert BEFORE INSERT ON kreatura FOR EACH ROW BEGIN IF NEW.waga <= 0 THEN SET NEW.waga = 1; END IF; END // DELIMITER ; Zadanie 2??? CREATE TABLE archiwum_wypraw ( id_wyprawy int PRIMARY KEY auto_increment, nazwa varchar(40), data_rozpoczecia date, data_zakonczenia date, kierownik varchar(40)); DELIMITER $$ CREATE TRIGGER archiwum_wypraw_update BEFORE DELETE ON wyprawa FOR EACH ROW BEGIN INSERT INTO archiwum_wypraw(id_wyprawy,nazwa,data_rozpoczecia, data_zakonczenia, kierownik) VALUES(id_wyprawy, nazwa, data_rozpoczecia, data_zakonczenia, kreatura.nazwa????????????); END $$ DELIMITER ; Zadanie 3 a) DELIMITER $$ CREATE PROCEDURE eliksir_sily(IN id int) UPDATE kreatura set udzwig = 1.2 * udzwig where idKreatury = id $$ DELIMITER ; Wywołanie procedury CALL eliksir_sily(1); b) DELIMITER $$ CREATE FUNCTION to_upper(tekst text) RETURNS text DETERMINISTIC BEGIN RETURN upper(tekst); END $$ DELIMITER ; Wywołanie funkcji SELECT to_upper("ala ma kota"); Zadanie 4 a) CREATE TABLE system_alarmowy ( id_alarmu int PRIMARY KEY auto_increment, wiadomosc varchar(200)); b)????????? DELIMITER $$ CREATE TRIGGER system_alarmowy_tesciowa AFTER INSERT ON wyprawa FOR EACH ROW BEGIN IF EXISTS (SELECT wyprawa.id_wyprawy FROM wyprawa WHERE id_uczestnika=3 AND etapy_wyprawy.sektor=7) THEN INSERT INTO system_alarmowy(wiadomosc) VALUES("Teściowa nadchodzi !!!"); END IF; END $$ DELIMITER ; id_uczestnika=3 id_sektora=7
true
d0d97d5f001039fc523c5b96d6bb0771afbc64ab
SQL
deydrums/master-php
/aprendiendo-sql/09-ejercicios/ejercicio16.sql
UTF-8
219
3.53125
4
[]
no_license
/* 16. Obtener listado de clientes atendidos por el vendedor "David Lopez" */ SELECT c.nombre, CONCAT(v.nombre, ' ', v.apellidos) AS 'Vendedor' FROM clientes c INNER JOIN vendedores v ON c.vendedor_id = v.id WHERE v.id = 1;
true
44560f4d8e2d56ea7bca423b4b01349a9909b5fe
SQL
jcarrizalez/events-sockert
/database_query.sql
UTF-8
515
3.65625
4
[]
no_license
--Muestra los Eventos registrados SELECT d.name as date, o.name as origin, c.name as country, ad.name as address, s.name as session, et.name as event, a.name as agent,e.data FROM events e, origins o, events_type et, dates d, countries c, agents as a, address ad, sessions s WHERE e.origin_id=o.id AND e.event_type_id=et.id AND e.date_id=d.id AND e.country_id=c.id AND e.agent_id=a.id AND e.address_id=ad.id AND e.session_id=s.id AND d.name BETWEEN '2020-10-12 00:00:00' AND '2021-12-20 00:00:00' ORDER BY e.id DESC;
true
88c867565dc2a8264dd88807297cad92854aaf3b
SQL
lanciamo/Databases
/Lesson07/fulldb-02-09-2019-18-07-beta.sql
UTF-8
69,431
2.828125
3
[]
no_license
-- Generation time: Mon, 02 Sep 2019 18:07:53 +0000 -- Host: mysql.hostinger.ro -- DB name: u574849695_25 /*!40030 SET NAMES UTF8 */; /*!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 */; /*!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 */; DROP TABLE IF EXISTS `communities`; CREATE TABLE `communities` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(150) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`) ) ENGINE=InnoDB AUTO_INCREMENT=101 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; INSERT INTO `communities` VALUES ('89','a'), ('62','ab'), ('12','accusamus'), ('42','accusantium'), ('17','alias'), ('69','aliquam'), ('38','aliquid'), ('31','amet'), ('99','asperiores'), ('9','aspernatur'), ('43','assumenda'), ('57','atque'), ('13','aut'), ('75','commodi'), ('27','consequatur'), ('68','corporis'), ('44','culpa'), ('94','cumque'), ('64','cupiditate'), ('32','dignissimos'), ('33','dolorem'), ('23','doloremque'), ('77','dolores'), ('87','doloribus'), ('82','dolorum'), ('76','ducimus'), ('36','ea'), ('35','eaque'), ('85','enim'), ('3','eos'), ('16','est'), ('5','et'), ('1','eum'), ('93','eveniet'), ('70','excepturi'), ('49','exercitationem'), ('65','harum'), ('96','hic'), ('53','impedit'), ('78','inventore'), ('86','ipsam'), ('97','ipsum'), ('54','iste'), ('11','itaque'), ('58','iure'), ('90','labore'), ('81','laboriosam'), ('61','laborum'), ('71','laudantium'), ('47','magnam'), ('10','magni'), ('20','minima'), ('63','minus'), ('39','modi'), ('45','molestiae'), ('88','molestias'), ('46','nam'), ('84','nemo'), ('8','nihil'), ('29','nostrum'), ('73','nulla'), ('14','numquam'), ('100','occaecati'), ('37','odit'), ('48','officia'), ('52','omnis'), ('40','perferendis'), ('41','placeat'), ('74','porro'), ('18','possimus'), ('30','quae'), ('19','quam'), ('28','qui'), ('59','quia'), ('95','quidem'), ('6','quis'), ('26','quisquam'), ('80','quo'), ('91','quod'), ('92','rem'), ('24','repudiandae'), ('98','rerum'), ('51','sed'), ('60','similique'), ('34','sint'), ('2','sit'), ('72','soluta'), ('15','tempore'), ('79','temporibus'), ('83','tenetur'), ('67','totam'), ('22','unde'), ('7','ut'), ('55','vel'), ('66','velit'), ('56','veritatis'), ('4','vitae'), ('25','voluptas'), ('21','voluptatem'), ('50','voluptates'); DROP TABLE IF EXISTS `communities_users`; CREATE TABLE `communities_users` ( `community_id` int(10) unsigned NOT NULL, `user_id` int(10) unsigned NOT NULL, PRIMARY KEY (`community_id`,`user_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; INSERT INTO `communities_users` VALUES ('1','39'), ('2','10'), ('3','16'), ('4','86'), ('5','40'), ('6','27'), ('7','89'), ('8','22'), ('9','24'), ('10','33'), ('11','54'), ('12','96'), ('13','58'), ('14','90'), ('15','58'), ('16','31'), ('17','93'), ('18','13'), ('19','10'), ('20','26'), ('21','67'), ('22','74'), ('23','2'), ('24','99'), ('25','64'), ('26','73'), ('27','100'), ('28','61'), ('29','8'), ('30','26'), ('31','13'), ('32','61'), ('33','14'), ('34','74'), ('35','52'), ('36','46'), ('37','98'), ('38','99'), ('39','25'), ('40','30'), ('41','18'), ('42','43'), ('43','3'), ('44','55'), ('45','68'), ('46','96'), ('47','80'), ('48','3'), ('49','100'), ('50','2'), ('51','72'), ('52','32'), ('53','17'), ('54','25'), ('55','88'), ('56','64'), ('57','48'), ('58','64'), ('59','62'), ('60','54'), ('61','40'), ('62','69'), ('63','9'), ('64','63'), ('65','17'), ('66','59'), ('67','44'), ('68','98'), ('69','32'), ('70','18'), ('71','33'), ('72','36'), ('73','58'), ('74','73'), ('75','59'), ('76','62'), ('77','56'), ('78','29'), ('79','53'), ('80','45'), ('81','41'), ('82','58'), ('83','7'), ('84','8'), ('85','60'), ('86','12'), ('87','45'), ('88','45'), ('89','15'), ('90','27'), ('91','85'), ('92','50'), ('93','97'), ('94','1'), ('95','75'), ('96','80'), ('97','43'), ('98','15'), ('99','80'), ('100','26'); DROP TABLE IF EXISTS `friendship`; CREATE TABLE `friendship` ( `user_id` int(10) unsigned NOT NULL, `friend_id` int(10) unsigned NOT NULL, `status` varchar(20) COLLATE utf8_unicode_ci NOT NULL, `requested_at` datetime DEFAULT current_timestamp(), `confirmed_at` datetime DEFAULT NULL, PRIMARY KEY (`user_id`,`friend_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; INSERT INTO `friendship` VALUES ('1','84','','2003-01-07 05:53:12','2011-10-31 12:05:42'), ('2','92','','1977-08-13 07:26:33','2013-03-12 03:10:12'), ('3','9','1','1978-07-30 23:27:42','2008-10-09 04:47:26'), ('4','89','1','2001-07-19 22:23:08','2011-05-28 08:34:09'), ('5','4','','2012-03-21 12:51:45','1972-06-25 20:46:14'), ('6','44','','1987-12-11 07:05:19','2014-10-02 15:35:44'), ('7','6','1','1972-08-12 09:45:14','1972-05-21 16:01:27'), ('8','95','','2006-01-17 01:30:24','2002-10-23 19:20:29'), ('9','83','1','1999-08-26 04:54:46','1978-02-24 00:59:11'), ('10','99','1','1999-11-10 12:13:57','1999-07-25 13:48:51'), ('11','74','1','2007-08-11 07:48:16','2011-04-27 18:41:36'), ('12','48','','1971-01-23 09:58:56','2015-12-22 19:57:57'), ('13','74','1','2017-05-20 23:39:34','1988-05-19 17:35:33'), ('14','72','1','1994-03-20 10:26:47','2009-07-20 08:24:47'), ('15','34','','1984-06-10 13:35:33','1974-10-05 07:28:26'), ('16','25','','1977-03-20 22:39:31','2009-05-27 20:21:13'), ('17','95','','1994-01-25 07:20:41','2017-04-11 20:02:43'), ('18','39','','2019-05-03 14:59:20','2013-08-11 02:56:58'), ('19','57','','1988-03-31 16:23:01','1991-04-19 01:01:20'), ('20','40','','1979-03-05 10:51:52','1973-10-24 07:03:13'), ('21','29','1','1986-02-11 11:35:41','2002-05-15 21:26:06'), ('22','51','1','1998-01-29 10:07:42','2017-01-15 15:21:16'), ('23','64','1','1987-07-16 02:55:29','2003-04-08 14:46:53'), ('24','45','','1996-12-04 07:47:16','1971-12-16 07:29:07'), ('25','80','','1979-12-09 13:55:55','1999-12-04 16:33:04'), ('26','66','1','1992-08-19 23:53:40','1974-10-13 02:18:47'), ('27','78','1','2013-07-12 23:18:39','1992-06-09 00:52:10'), ('28','28','1','1987-07-22 12:59:02','1982-03-27 19:27:19'), ('29','54','1','1987-10-07 04:33:55','2002-10-12 02:37:00'), ('30','32','1','2017-06-16 21:39:20','1992-07-10 01:11:24'), ('31','33','1','2015-01-10 12:36:50','2006-12-23 14:39:46'), ('32','87','1','1982-07-24 01:54:21','2017-06-13 08:37:42'), ('33','36','1','1995-03-01 21:00:26','1997-03-30 10:31:15'), ('34','52','1','2000-03-05 00:39:29','2002-12-09 22:23:26'), ('35','43','1','2004-05-11 14:54:50','1997-12-16 12:55:28'), ('36','51','1','1970-06-10 09:51:26','1986-04-25 04:27:51'), ('37','15','1','2001-01-04 21:27:16','2011-10-04 01:29:39'), ('38','98','1','2007-05-02 15:37:17','2014-12-05 16:43:47'), ('39','43','','1982-07-29 10:23:44','1982-06-07 01:10:42'), ('40','23','','1987-06-06 12:42:29','1985-10-05 19:46:21'), ('41','67','1','2008-04-24 19:35:37','1989-02-01 06:17:50'), ('42','21','','1983-08-02 02:49:21','1997-01-15 10:13:57'), ('43','75','1','2014-08-02 19:48:53','2008-04-13 13:50:15'), ('44','2','','1992-11-05 13:02:25','2011-05-19 00:23:17'), ('45','31','','1974-01-06 09:42:21','2013-10-22 06:53:03'), ('46','97','','2001-05-23 15:49:23','1984-01-09 02:02:29'), ('47','34','','1974-08-20 08:34:22','1994-01-17 22:34:26'), ('48','4','','1992-07-12 08:02:44','1989-05-11 23:16:15'), ('49','68','','2003-05-03 06:30:27','1989-10-16 21:45:46'), ('50','73','','2006-06-06 00:58:42','2003-01-31 02:11:11'), ('51','28','','1994-02-10 23:00:00','1984-11-21 00:13:47'), ('52','37','','2015-11-09 10:26:56','2006-06-27 19:26:56'), ('53','16','','2002-09-18 20:31:38','1986-04-10 05:19:56'), ('54','54','1','1975-02-12 16:41:39','1970-10-10 23:32:55'), ('55','19','1','1991-10-26 20:35:18','1999-08-24 03:21:19'), ('56','39','','2005-01-07 18:59:32','1985-06-06 00:42:00'), ('57','31','','2014-01-26 03:07:47','2004-10-15 05:50:43'), ('58','18','','2006-04-08 10:23:32','1977-11-21 11:15:33'), ('59','5','1','1974-06-26 05:19:51','1996-01-12 02:41:37'), ('60','69','1','2012-06-03 06:30:32','1972-02-04 00:31:18'), ('61','29','','1991-01-03 19:19:24','2013-03-26 02:58:26'), ('62','66','','2016-08-03 14:05:32','2016-08-13 00:32:32'), ('63','30','','1973-08-11 09:04:42','1994-01-04 04:22:49'), ('64','36','1','2000-06-06 09:55:13','1976-11-26 05:39:35'), ('65','62','','2017-07-21 15:30:30','2006-05-27 12:33:13'), ('66','57','1','1996-03-03 16:41:33','1983-09-20 05:41:36'), ('67','36','','1993-01-27 01:17:32','1999-01-09 18:33:17'), ('68','48','1','1999-05-31 22:35:21','2003-07-03 11:15:38'), ('69','33','','1988-12-23 06:36:42','2018-09-20 02:06:20'), ('70','4','1','1983-02-11 05:17:46','2012-09-27 18:35:44'), ('71','64','','1973-10-08 17:23:33','2016-08-01 23:30:11'), ('72','52','1','2010-03-16 11:00:55','1979-05-17 03:51:46'), ('73','30','','2017-04-25 09:32:11','1997-05-11 10:29:35'), ('74','64','','2013-01-01 20:02:07','2000-04-02 07:54:43'), ('75','6','1','2002-10-09 08:21:23','1991-04-25 07:04:10'), ('76','71','1','1973-08-06 16:42:23','1990-11-25 03:05:24'), ('77','46','','1973-03-19 15:40:14','2001-05-21 21:15:23'), ('78','94','','2012-04-21 13:32:26','1973-10-18 18:22:38'), ('79','19','','2010-07-31 17:20:10','1982-10-27 12:53:34'), ('80','94','','2018-02-25 11:09:57','1976-07-05 03:52:47'), ('81','30','','1999-11-09 17:04:16','2016-08-25 07:45:01'), ('82','57','','1998-05-05 17:53:49','1972-01-20 21:03:25'), ('83','14','1','1978-10-13 13:14:43','2012-11-18 01:29:24'), ('84','40','1','1971-06-08 06:27:37','1992-07-28 23:20:40'), ('85','36','','2018-05-28 06:33:12','1987-07-08 22:32:47'), ('86','8','','1985-12-30 23:35:43','2005-12-28 08:17:55'), ('87','96','1','2018-12-18 04:00:23','1976-12-25 23:27:37'), ('88','88','','2001-11-27 07:24:26','2000-06-22 21:46:57'), ('89','23','1','2010-03-03 13:27:43','2006-06-16 09:01:54'), ('90','78','1','2017-10-19 06:41:08','2016-07-27 13:04:39'), ('91','64','1','1976-05-15 22:12:58','1994-04-23 22:33:33'), ('92','26','1','1971-02-27 14:48:43','1986-10-26 06:29:04'), ('93','38','1','1981-01-17 04:22:30','2017-07-26 12:10:36'), ('94','95','','1990-08-28 15:03:15','2012-07-20 06:02:00'), ('95','24','1','2014-06-07 23:30:20','1994-06-04 16:45:58'), ('96','99','1','2009-09-16 01:07:41','2012-11-21 09:45:24'), ('97','3','','2011-07-30 20:21:15','1985-09-20 20:59:50'), ('98','55','','1986-10-24 08:35:26','1981-06-20 16:02:50'), ('99','46','1','2018-12-19 09:53:43','1992-07-26 07:57:30'), ('100','86','1','1990-09-24 10:12:45','1984-01-12 18:45:12'); DROP TABLE IF EXISTS `like_types`; CREATE TABLE `like_types` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`) ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; INSERT INTO `like_types` VALUES ('4',' audio'), ('3',' message'), ('5',' user'), ('2',' video'), ('1','photo'); DROP TABLE IF EXISTS `likes`; CREATE TABLE `likes` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `item_id` int(10) unsigned NOT NULL, `like_type_id` int(10) unsigned NOT NULL, `user_id` int(10) unsigned NOT NULL, `created_at` datetime DEFAULT current_timestamp(), `updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=101 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; INSERT INTO `likes` VALUES ('1','53','1','1','1993-04-05 06:33:51','2000-12-11 19:33:11'), ('2','41','2','2','1973-04-03 18:03:29','2015-05-04 06:07:49'), ('3','59','3','3','1980-09-15 23:15:14','1981-09-20 10:36:33'), ('4','40','4','4','1971-01-08 14:26:09','2007-05-04 06:36:10'), ('5','50','5','5','1998-06-24 13:29:04','1971-06-01 19:50:38'), ('6','29','1','6','1992-12-11 00:15:25','1989-12-30 02:06:18'), ('7','87','2','7','2007-12-20 05:17:52','2009-06-11 01:19:54'), ('8','23','3','8','2007-07-01 20:52:50','2005-10-29 05:21:49'), ('9','8','4','9','1980-11-21 02:28:35','1987-02-27 22:15:16'), ('10','10','5','10','2010-12-10 09:14:45','1981-11-07 23:36:05'), ('11','91','1','11','2019-06-26 21:36:08','1998-08-19 14:58:37'), ('12','2','2','12','1986-03-11 10:39:00','1983-02-26 18:54:10'), ('13','57','3','13','1977-12-08 16:12:43','2019-04-20 14:09:52'), ('14','75','4','14','1997-02-04 16:41:43','1986-12-07 06:47:30'), ('15','71','5','15','2009-04-08 15:15:09','1986-11-01 05:17:28'), ('16','85','1','16','2005-10-28 10:37:01','2001-05-20 12:17:39'), ('17','88','2','17','2010-10-20 14:07:34','1988-02-01 08:00:31'), ('18','18','3','18','1995-03-12 14:46:01','2002-02-07 05:03:05'), ('19','13','4','19','1974-04-21 08:03:01','2005-02-14 02:19:09'), ('20','26','5','20','2016-02-07 15:40:05','2007-09-24 13:50:14'), ('21','44','1','21','1997-12-23 13:44:12','1985-06-08 21:43:13'), ('22','58','2','22','1985-03-03 07:01:31','1972-09-23 11:03:48'), ('23','54','3','23','1981-12-16 23:22:37','1993-12-02 17:56:52'), ('24','64','4','24','2015-05-29 23:06:18','2008-11-12 12:22:43'), ('25','88','5','25','2007-05-08 05:20:52','1991-04-10 10:38:38'), ('26','70','1','26','2002-11-13 04:04:44','1976-01-03 07:40:25'), ('27','91','2','27','2009-07-17 05:11:08','1976-09-08 16:33:21'), ('28','23','3','28','2000-12-02 04:05:53','1976-03-11 12:09:59'), ('29','24','4','29','2001-12-29 09:08:24','2000-04-18 09:37:25'), ('30','4','5','30','1997-10-06 10:31:29','2008-02-27 02:37:00'), ('31','25','1','31','1983-03-20 06:04:42','2016-01-03 15:07:30'), ('32','13','2','32','1991-12-02 20:39:14','1987-06-04 00:32:04'), ('33','22','3','33','2002-04-30 00:51:27','1997-06-25 01:11:14'), ('34','14','4','34','1987-11-17 01:06:23','2013-07-30 10:22:39'), ('35','30','5','35','1988-03-03 22:57:57','2000-05-18 08:53:15'), ('36','95','1','36','1973-12-10 19:32:10','2014-07-11 09:20:12'), ('37','11','2','37','1984-07-31 17:42:31','2009-04-23 19:26:09'), ('38','12','3','38','1986-08-02 14:38:41','2008-06-08 03:00:25'), ('39','33','4','39','1995-10-28 01:05:35','2004-03-20 17:32:55'), ('40','64','5','40','1978-03-11 02:37:50','1990-04-24 19:52:43'), ('41','3','1','41','1983-02-23 10:18:29','2011-07-03 03:51:44'), ('42','37','2','42','1982-04-16 12:15:05','1985-08-04 17:37:33'), ('43','2','3','43','2003-04-11 18:42:50','1992-04-26 10:21:41'), ('44','38','4','44','1971-07-04 05:45:19','2004-05-11 20:06:04'), ('45','50','5','45','1988-10-21 19:49:06','1979-07-07 03:46:06'), ('46','18','1','46','1996-07-03 12:08:50','1974-03-01 21:02:09'), ('47','90','2','47','1991-06-13 22:19:16','1984-11-13 13:29:42'), ('48','30','3','48','1975-03-01 12:33:22','2015-04-30 16:48:09'), ('49','91','4','49','1989-09-29 19:03:58','1984-08-04 07:40:13'), ('50','25','5','50','2008-09-14 06:33:23','2004-05-18 23:59:27'), ('51','99','1','51','1973-02-04 09:06:37','1987-01-26 19:12:43'), ('52','11','2','52','2002-11-10 17:38:34','2019-01-24 23:46:15'), ('53','65','3','53','1979-03-20 14:35:15','2006-02-11 20:19:51'), ('54','28','4','54','1991-05-23 15:40:16','1998-09-14 12:59:06'), ('55','60','5','55','1981-09-10 09:06:03','2019-01-15 02:08:53'), ('56','88','1','56','2015-04-26 04:05:10','1992-04-23 12:11:35'), ('57','87','2','57','1990-12-09 12:13:54','2017-02-22 06:07:02'), ('58','28','3','58','2004-05-14 07:40:00','1971-07-31 10:55:10'), ('59','83','4','59','1977-05-13 21:03:57','2009-04-02 07:52:07'), ('60','79','5','60','1978-04-20 00:11:55','1996-01-13 17:19:36'), ('61','54','1','61','1999-03-15 18:25:38','1991-02-16 18:20:47'), ('62','84','2','62','2016-10-06 08:57:38','1993-07-31 19:35:22'), ('63','14','3','63','2016-05-16 09:31:57','1991-12-02 00:12:42'), ('64','65','4','64','1971-01-28 14:26:25','2003-05-08 22:33:41'), ('65','92','5','65','2002-10-19 02:37:13','1994-08-16 06:36:35'), ('66','69','1','66','1983-09-14 20:56:48','1995-02-05 07:19:52'), ('67','50','2','67','1985-07-14 09:31:59','2000-11-12 20:40:29'), ('68','3','3','68','1998-01-10 07:03:11','2008-06-11 11:18:47'), ('69','7','4','69','1972-11-28 19:57:18','1981-06-09 00:34:10'), ('70','67','5','70','2005-05-11 08:59:10','1979-03-23 23:20:10'), ('71','52','1','71','1989-10-25 01:24:08','1981-03-10 01:11:47'), ('72','14','2','72','2011-12-09 10:29:14','1982-04-18 04:17:57'), ('73','47','3','73','1993-01-21 16:05:46','1992-01-20 03:28:29'), ('74','33','4','74','2013-12-12 14:22:07','1979-01-02 04:27:05'), ('75','57','5','75','2015-05-01 06:57:44','1975-06-20 22:45:50'), ('76','40','1','76','1975-03-22 07:10:08','2009-10-11 02:38:48'), ('77','96','2','77','1973-09-26 00:29:26','1992-08-20 15:43:48'), ('78','93','3','78','2011-01-14 05:14:56','2000-08-25 16:45:41'), ('79','65','4','79','2010-12-12 14:24:02','1985-08-17 09:08:34'), ('80','23','5','80','1989-05-10 21:19:50','1997-05-30 18:13:00'), ('81','64','1','81','1972-10-22 09:32:21','1999-02-27 11:10:31'), ('82','97','2','82','1979-08-15 00:12:26','2001-11-16 13:40:45'), ('83','84','3','83','1977-04-14 13:02:17','1998-01-12 10:42:27'), ('84','98','4','84','1976-10-19 15:42:51','1987-05-27 15:49:51'), ('85','74','5','85','2011-01-12 15:09:35','2009-05-29 20:11:42'), ('86','55','1','86','2017-11-08 02:04:54','2005-09-07 10:35:48'), ('87','96','2','87','2004-05-29 20:26:42','1995-05-21 00:06:40'), ('88','30','3','88','1982-04-07 15:05:33','2004-09-30 19:51:57'), ('89','11','4','89','1987-06-23 06:01:02','1982-01-11 23:24:39'), ('90','45','5','90','1994-11-20 15:20:37','2016-01-31 23:52:47'), ('91','14','1','91','1984-12-14 00:13:50','2006-10-02 19:05:24'), ('92','50','2','92','1973-05-15 00:07:38','1972-09-05 07:25:20'), ('93','44','3','93','1998-04-30 06:08:40','1982-06-28 22:36:49'), ('94','53','4','94','1997-05-19 13:51:07','1991-04-14 01:35:03'), ('95','98','5','95','1996-06-13 18:41:50','2016-10-25 17:53:41'), ('96','59','1','96','2010-05-11 05:41:40','2007-04-30 15:06:49'), ('97','71','2','97','1973-10-25 19:19:13','1977-12-01 04:41:16'), ('98','57','3','98','1984-03-20 21:54:53','1970-09-07 14:08:45'), ('99','11','4','99','2009-09-20 20:43:44','2015-07-19 07:09:47'), ('100','34','5','100','1991-05-18 01:58:57','2013-06-27 18:31:12'); DROP TABLE IF EXISTS `media`; CREATE TABLE `media` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `media_type_id` int(10) unsigned NOT NULL, `user_id` int(10) unsigned NOT NULL, `filename` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `size` int(11) NOT NULL, `metadata` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL, `created_at` datetime DEFAULT current_timestamp(), `updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=101 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; INSERT INTO `media` VALUES ('1','2','1','obdnxncveccyiz','559630','584d4313c2a5a0abfd90322aa6912a01237b6b55','2018-05-14 04:47:37','2017-04-16 12:49:25'), ('2','1','2','tfttvuobefqdfz','448938','2fdbbb691109c4701aeab76aae4bf269025e2eaf','2013-12-27 04:29:54','2010-06-29 12:19:16'), ('3','2','3','sjtsxbtamglzlq','695481','9e699bb896b3d2551ffd3981b4a0113c88eed27f','2002-03-10 22:42:57','1985-12-08 00:02:58'), ('4','1','4','nljijdovnlmaor','849283','3e19b2867d556df9321069d6e5f560e99585b905','2001-10-04 10:24:10','2014-05-31 17:00:17'), ('5','3','5','hddoaxacujkvoy','693115','43ebdc4cbbbe2822de5a0545ba4d65d2a543335e','1991-06-08 06:51:49','1972-01-24 02:14:39'), ('6','2','6','wpjieobrxksgsx','558328','5e0658c37814b33d7fc68841c94d15a10c5a6942','2009-07-24 03:14:46','1995-09-15 14:42:23'), ('7','1','7','sxqrsjqidwobnt','565238','9759974bbf43241218c0677a5cf8e52380fc9812','2005-12-01 15:16:06','1993-01-11 21:36:03'), ('8','1','8','havcpfvggnvgwg','802714','935f960057bcb371a4bac4380442f3c331010a1f','1972-06-20 22:20:35','2014-02-19 09:47:15'), ('9','2','9','tqwgqykjagnofk','722361','4a43f35c84fcb68d50685d7ba2085d4d02ae30f7','2015-08-20 16:48:27','1999-10-30 22:09:15'), ('10','1','10','alsockbaqkckmm','221653','d3bf96ec55ebb5ff734c641b13d1be2e32fbd690','1970-09-21 14:21:33','1971-09-02 21:12:30'), ('11','2','11','yekbeyonshlord','206827','6e0bdb0c6f4d9b1d30733db0ade0fed32dc38b21','1985-04-03 10:31:59','1975-03-20 01:07:06'), ('12','2','12','zdtabpsfozlpbx','764721','50c1ebf4b10f864a509fa7cea50afc373eaf00e1','1991-05-18 21:11:07','1997-11-26 10:24:14'), ('13','1','13','recojuhbsglrsh','492341','c681df3440ccff0ee1a7ed5fe334f4b2b62fa7c6','1971-11-18 04:18:22','2002-01-17 11:39:31'), ('14','3','14','winbcqhpbatzjm','858882','1b83638647b4ac8d764c98b8267a6c9a45d242d0','2007-06-18 23:05:40','2012-10-07 12:41:14'), ('15','2','15','lxucunclckeyoi','872168','f2837b65dc03638dc98d105967f3ec92a01f33ca','2018-07-20 04:24:29','1980-05-27 06:01:07'), ('16','2','16','btreoaevadhayq','328273','11ec7f14f442e2fcdb6f101df9799f7ee1da7d4f','2005-10-06 08:19:49','2017-07-07 15:55:33'), ('17','2','17','qsxktwmztonsvh','704546','abbb1e38fd3f4fb43ad9b8f3b5eb5aceea9a454b','2014-01-02 06:38:27','2010-08-23 20:05:34'), ('18','3','18','shcgnrenldfukl','756849','fec7923fc6b89c82c216366dc6b2be9621c2db10','2008-06-19 19:43:34','1995-05-22 05:27:23'), ('19','2','19','gxooccqghltewh','331998','b739a0a3b2c02e5fbd5e701696daeb7e6d7f4c07','1971-09-12 03:52:13','1972-08-25 04:09:05'), ('20','2','20','tjduaicefbfazy','833099','e28f4c647514f7ddba903ac69f87f6ff191f53b0','2011-12-04 17:54:48','1975-05-09 14:29:56'), ('21','2','21','iusxfzuiqzumwq','450526','8399d2630d721d24bfb02ec7c3decdf9e91bb814','1978-05-19 18:59:33','1971-06-06 11:22:38'), ('22','2','22','qhaanumosrwret','367301','e78f8aa61495474f5a0e905f324483829b4eec5f','2007-07-12 17:25:00','1982-05-21 20:38:13'), ('23','1','23','iivaniahypemvt','855239','1d5116a3b64f7ecb08693145f94cae8364986d73','1976-02-13 05:54:39','1995-08-01 11:15:02'), ('24','2','24','ypiimvdvyibzii','343645','2a798bd3772de1fd13188ca34aecae222cb53032','2002-09-14 13:29:08','1999-05-30 09:21:05'), ('25','2','25','nmsoqrdtayxmhh','602968','dda72ef6d5129e1d49a04d35230fdc0939dfa4fd','1996-09-12 11:00:17','2011-08-07 05:11:06'), ('26','2','26','kxoapwslgmciwr','341327','b6e3ab5278fe5887d3bd6e636589f44f3a821a71','1984-07-20 12:09:55','1993-11-05 12:01:41'), ('27','2','27','aviyqhckhktuka','628632','86bdca8470eb5ab052780ad5a65c24b047d0a0b2','1990-12-14 10:25:28','2001-04-07 00:44:54'), ('28','3','28','mvphgnuxpkvvnf','754580','e5c32fa9f9d6faa7925c2597ac9f4159c6db1968','2002-05-04 05:58:55','1976-06-04 01:30:54'), ('29','2','29','yaihtypcltbnfv','549827','1cc4112c09e68c843954feb9f5cccd43f79633ab','1986-12-13 04:10:30','2002-04-25 08:17:00'), ('30','1','30','vlyehbpnsmtdqy','254341','6a95c3cd189b0363e4ac061626518736a79e00e8','1983-04-23 08:53:36','2019-06-06 11:34:18'), ('31','1','31','yszkqwoysihgam','794252','6241e2b1725ee77fbd9bec8577434987ac9b60f8','1981-11-03 22:58:18','1997-08-10 09:10:51'), ('32','3','32','nbldunlnrqhzal','403850','d328ed94b0d0fec19370daa982f54e1d2fe7fa20','1996-05-25 21:16:43','2015-08-11 13:09:39'), ('33','1','33','dgaxwoembdxlfv','804607','8490eb552aebc09b57e3d9872813482934161f61','1988-09-30 00:44:03','1970-04-04 06:34:56'), ('34','1','34','gajdfnauopjfyl','246680','19b6ec8ca0b82b51eb4390472923e9e60c7cf4ed','2015-04-07 10:23:51','1997-09-09 15:04:56'), ('35','2','35','jgadgrzkqsyhlx','861449','9fd28018aad7b37ad3ae4999afb127e906e0b9d6','1980-02-15 07:56:23','2006-08-30 05:30:07'), ('36','2','36','onbhdkatzjduwj','584198','3b20b1dca4ee25165a1bf506f1bbd057eeed86d7','2014-06-26 22:28:30','1997-11-27 20:44:51'), ('37','1','37','bdljtwlleafpcf','200903','04c4ddf63bf519edf522fe43f6614bf85ce054da','2003-11-07 01:30:47','1979-01-19 20:39:30'), ('38','1','38','ahsyepgcmzdeuz','288217','f9db275401c39f1033823c0419c8ce08175b8c23','1988-05-22 09:37:54','2001-06-12 03:23:16'), ('39','3','39','gcbnhlwioaeesy','675929','da5e41325d82f6ba93bf6858934001cc4908d7c2','1971-02-25 09:06:18','1988-02-16 20:00:59'), ('40','1','40','txmgoyodfztvzo','491581','96034f8dbaaa2672fce6f8eeacbadea698d49adf','1999-04-01 12:57:14','1992-09-16 22:26:09'), ('41','1','41','yepqrzkserhdai','438521','d002f28a376386d89da9e9a878bea812b27b8a34','2002-06-17 22:46:11','1982-03-06 20:50:32'), ('42','2','42','osrextxwnthzth','587892','6e6ac6c8c350719c4e8a84bcae59ff6e1afd8acf','2013-05-31 14:42:51','1971-05-24 18:38:04'), ('43','1','43','svgfeanecvmgdf','257946','153eeedabdc5abf344f581a6257c2cae0a6c7709','1999-05-28 05:16:48','1974-08-17 20:24:01'), ('44','2','44','inbjeincrtgatt','477373','50e4f0cf3a228d30a6d54ad40135b2a64d9965a2','2016-03-10 11:52:13','1979-09-14 02:39:18'), ('45','3','45','gxvgzgyrsbywpa','496716','89ffc4384cebb6248a42f0a1271996509e6acda9','1993-02-02 12:54:52','1982-09-05 01:01:37'), ('46','2','46','xlvqjkozmjpzui','584322','f4834b24215e7a682716591410487558712b355b','1990-08-03 23:14:59','2018-05-28 13:56:18'), ('47','1','47','aqonxmmojcrvoj','332464','f4fdede30982ad7570f3fc9e40003925a0969830','2009-06-04 19:41:45','1976-02-10 06:47:49'), ('48','2','48','jltwyepdvweruy','665376','01291d3948ebfa9b295c8cf26ed2370904fedda9','1972-07-08 21:40:04','1970-03-26 02:19:22'), ('49','2','49','efeogjqohzpfnf','291662','95e15138ca73cd5c0a14f95c6ad1092d656a1f9f','2009-10-07 00:49:17','1982-04-14 18:11:49'), ('50','2','50','dougpgxgmfkqgb','416268','f9d32adbb75fefeaf4a522ce71d5cb6f70fde9e2','2018-02-03 18:40:38','1979-02-10 20:54:49'), ('51','2','51','alqupdxcgzfgwn','719626','992497e3fcb87d38f38c1424ff0e3809e2b76ca0','1983-10-07 17:51:29','2017-12-03 07:26:24'), ('52','2','52','rgnoulhnejwjcb','351310','69fcd73a3b50184c707b4c06395780dc2ec6a64b','1992-11-07 18:04:01','2015-10-23 03:36:41'), ('53','3','53','lmbnpyxrwhvidx','279545','89828931571fd3c5aa5ed9d6380ac7e37e2709d4','1992-10-11 17:29:56','1972-04-01 03:17:43'), ('54','3','54','gnhakdhsteuqan','434108','1581649690f92954ec5ad1915e0e6606c042e001','1991-07-17 07:58:23','2004-01-29 19:22:39'), ('55','2','55','ekhjmbvcjxgnhf','599844','e5fed189d758e2a15e81d6eb0f1c1b3161c68d6f','1979-12-01 06:52:42','1979-10-29 01:49:14'), ('56','1','56','alxivefathztyc','658227','8ace52039fae1d61fc420e1de1e8c3e0f051a437','1983-09-15 02:30:16','2017-01-14 02:06:57'), ('57','2','57','gomdpbskiaubjf','288696','f52ff524f1c34562a3a12a46fa633fdffc1b633d','2012-10-09 07:12:51','2014-08-09 14:05:49'), ('58','2','58','avcycraewdckyi','396321','b3ddfd64ec1242ba67316cb78940250312bf351e','2015-08-20 22:45:13','2008-07-31 22:26:01'), ('59','3','59','djbnbgfelnsxfw','423131','bf32a933aabcfa58b638de783a79cbb489c86853','2003-10-02 11:11:49','1973-01-23 21:52:40'), ('60','1','60','pnfzgymlceedjs','472318','1e5f0c3d063aa86b766789032e131c80a3edb2a1','2013-01-06 08:39:25','1987-05-23 23:03:38'), ('61','2','61','pawotuuvozduff','679438','c250e7945652275344114df4a8aac8ab12c0b0ee','2017-11-14 12:15:44','1996-08-28 04:05:44'), ('62','2','62','kzhuuocuxahtgx','317747','b35966317408e1cdd0db1be131094eebb8ac6950','1975-12-16 14:00:16','1998-10-10 18:01:24'), ('63','1','63','rwksrvjrcrzuyo','224544','fab62435f7badca84022e3ac6502068a98584d01','1988-01-31 04:59:39','2001-03-19 04:01:10'), ('64','3','64','idrtlxlakefnct','449544','ed7d9d5c1fff788bf5f94e45134ac33ee2c34e8a','1992-03-24 06:06:06','1982-10-09 17:23:28'), ('65','2','65','rypmwtoupltvbw','575218','d2ff4fc9e49d83933c7a501e5f07bbec5c58907a','2013-01-17 00:25:24','1974-12-05 03:35:32'), ('66','2','66','pzklmfqqbcoikl','784796','b2133ba2d57a94531daacb7a2e388e66ceaee742','2004-08-03 22:52:36','1973-01-01 19:32:47'), ('67','3','67','kzevzywpjvqmah','594654','0e21891b678e2bcd373330cd8522b62598858d2d','2010-08-16 22:15:53','1990-01-11 16:33:36'), ('68','3','68','hjlzsrkaloulmf','846207','2cf9ac06d375073e21a81ae9ce64fb0f8df17389','1993-09-19 21:47:33','1970-09-03 20:38:06'), ('69','1','69','cgdpulzxotzvip','417213','68584cf160a670d4862101f8be6cccb9adf0631f','1983-08-24 08:10:42','2019-08-04 10:41:11'), ('70','1','70','eeygtazlhzuxiw','654025','83722485667427dc9e118af7109a85e272e61153','1981-11-04 15:36:28','2006-11-15 16:13:14'), ('71','3','71','xbqnmbnmqokaih','385089','2b02da77f7fc3914d29b3ac320b65b2afff0b083','1984-02-04 22:52:04','1972-04-18 17:42:34'), ('72','1','72','ksnexjaaciewbh','787217','cc080167291d4f0b9cbc6e633f708d1dd349fcce','1993-07-21 20:38:40','1984-08-31 22:10:44'), ('73','3','73','jxizocytukoyqt','498098','d6dcda121486d33ab3aba0b88673c1b6eb79c419','2005-01-03 21:39:27','1999-12-04 04:34:29'), ('74','2','74','yegtugbumoqpsf','786066','9f5d4f4722818a7ba4bbe5a6396e084fe92b10c6','2015-04-14 23:25:26','2004-11-25 11:54:42'), ('75','2','75','fxtrqjfooiooez','761377','165b1fe57a936d198a6e075cb70d2faf056a7fee','1970-04-07 08:40:37','1987-07-10 12:41:19'), ('76','3','76','ouepjazigfrovr','200717','a3d83329b044527d510d12d825d9646d28ed545c','2009-12-25 06:31:10','2005-11-01 18:07:44'), ('77','2','77','nxvlkvbvvotgig','399754','c46f5e4b20b18b7c79cf74836b7cfe45992fd40b','1988-10-28 14:32:34','1993-12-30 14:04:59'), ('78','1','78','vnuzpzjdnjbkgw','384844','72e471ce85f47fd334c1bc6ff41c48f59b4cff2a','1970-07-03 16:53:49','1996-02-13 19:06:44'), ('79','1','79','gbzthcqgwiiclr','714089','84807d0211d9e7bab9a889467c487e0df06e8474','2017-05-06 05:13:39','2006-12-07 16:47:30'), ('80','1','80','xgqnxvhzzbskjc','390249','9e581c8b287e4ce37dffb037c148d8a2c05465e4','2001-11-18 00:54:23','2012-07-29 20:30:15'), ('81','3','81','tjjasoeblbpzwq','552680','53e2591e36762cf0f11bb5a729c8b9f6670b3616','1991-11-01 15:19:27','2006-12-24 00:20:22'), ('82','2','82','lsqokqsbejkddr','483854','1ce3fc96cc8ba4a3d33c3e915e2c3d5840033b05','1984-01-23 12:09:15','1985-01-31 01:30:12'), ('83','2','83','fauamqxxjfaged','463723','9c38df13b2311d138de5cd5bee77abb3a4d3e09e','1989-05-18 15:04:09','1991-02-11 06:51:58'), ('84','3','84','mnyyqukgrqfjxo','857530','efad1dc3c7926bd7a77e2caa6c0b456e006b715b','1975-03-04 12:21:27','2008-11-15 15:23:31'), ('85','1','85','okeizgyfclykty','472715','150867b7b9a594d13fc1d3bd9d9999ee917209fa','1999-12-03 08:43:16','1975-03-02 03:14:03'), ('86','3','86','ebkacspegvpecn','219016','daa678cdc8ccb560a3d82b461a05ce88b471487c','2002-03-29 20:36:03','2009-02-22 23:09:29'), ('87','3','87','xojavztwnmltxa','363727','eddf6bc49ee52e82961d7211069eb454dfaedb4b','1983-07-31 00:37:42','1989-07-26 18:25:18'), ('88','3','88','rxrqxvyopmogat','339625','621c05e3534b961ae1714c393b081503d6f4f5b1','1977-05-18 03:32:09','2000-05-26 10:31:50'), ('89','1','89','lzjvtawlpsmmaq','631379','df7e1cd350f3c5d15756a2a1805e66f2e21dffb1','1996-10-15 15:22:22','1997-06-19 17:49:36'), ('90','2','90','icvucwqepkqfwu','467616','45e027fd5ea93a512b17b6a25f832b9b98955bc8','2009-03-14 05:46:44','1976-02-04 04:45:37'), ('91','1','91','jnukrmzqraasji','242140','54643622a892f3a2fa25c252f538868aa88e7866','2015-04-14 20:49:39','2015-07-08 18:11:04'), ('92','2','92','wilyamrqejjysk','734047','184f10d2de94b9e04289f6b6402b70533a49ac7c','1988-02-29 03:48:02','1986-08-20 15:27:30'), ('93','1','93','yzvfrnlefmainn','615785','92b5fba4c575462ec35224d1e88f7094543d6b47','1970-02-26 11:54:20','2007-06-21 03:37:46'), ('94','2','94','sszpgmnmfgamko','234918','22f87f94fe6fa7650692b955d3e4bfdee6d2a8a4','2004-02-08 03:57:55','1978-04-30 08:51:00'), ('95','2','95','cvkhaaqmwogxms','840906','06f3138add525e5d7e7767fdf73c150377227abd','2005-06-27 08:07:55','1993-01-17 05:45:25'), ('96','1','96','mswoqcuenyniic','250176','8a794b210d7850a7f4be210a0aed01df85b89182','1997-08-06 07:20:23','2011-08-29 12:42:34'), ('97','1','97','bzsegioduthodb','777916','b651945ba21e35e17d0eb0bd3022c4c2db6674e2','1987-10-22 05:43:59','2013-02-20 14:36:13'), ('98','1','98','fkmwpgspzmjofg','836195','870048dece58c5f015fb4abfedcc86c22cdbdf32','2013-04-15 01:56:14','2010-09-05 20:37:59'), ('99','1','99','hsvssnwcjwrkuy','645996','2ab34e04c911896653b4c8e865ac32e6b2f11513','1975-09-21 09:42:03','2005-05-24 12:16:01'), ('100','3','100','pnecofydjilijn','322815','5200c8cf38de46876e7df8259ff3d4923e3eb2cd','1999-06-02 22:59:28','1996-03-11 10:05:08'); DROP TABLE IF EXISTS `media_types`; CREATE TABLE `media_types` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`) ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; INSERT INTO `media_types` VALUES ('1',' audio'), ('3',' video'), ('2','photo'); DROP TABLE IF EXISTS `messages`; CREATE TABLE `messages` ( `from_user_id` int(10) unsigned NOT NULL, `to_user_id` int(10) unsigned NOT NULL, `body` text COLLATE utf8_unicode_ci NOT NULL, `important` tinyint(1) DEFAULT NULL, `delivered` tinyint(1) DEFAULT NULL, `created_at` datetime NOT NULL DEFAULT current_timestamp(), PRIMARY KEY (`from_user_id`,`created_at`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; INSERT INTO `messages` VALUES ('1','48','Tempora delectus id repellat eum molestiae dolor. Minima aspernatur a amet est optio. In fuga et eos qui est velit sit. Provident saepe illo aut ut cupiditate dolor explicabo. Ipsa assumenda iste rerum dolor atque fuga.','1','8','1996-11-22 03:45:52'), ('2','92','Et veritatis ipsam consequuntur. Quos vel enim quaerat est et veniam et. Ad aut sunt et iusto eius est. In minima ipsam est ad rerum. Maiores id minima accusantium ut.','0','7','2005-03-11 05:24:41'), ('3','2','Illum nisi qui rerum rem dolorem. Dolores dolores rerum aut. Aliquid alias aut iure dignissimos consequatur rem sint. Recusandae quas voluptates corrupti recusandae id maxime voluptatem. Porro molestiae magni et dignissimos id corrupti maiores facilis.','0','6','1999-05-14 22:08:34'), ('4','62','Neque in eius itaque rerum cupiditate. Asperiores est quod quas dolores doloribus ut. Dolor aliquid ipsam doloribus autem sunt repellendus.','1','3','1988-08-07 10:04:46'), ('5','9','Error sit minus enim deleniti aut. Consequatur totam deleniti repellendus adipisci aliquid consequatur expedita. Voluptatem dolores magnam omnis laborum et rerum. Molestias vel doloremque quo eaque fugiat velit. Cum enim ea eos iure sapiente laborum itaque.','1','4','1979-02-28 02:05:46'), ('6','99','Aut asperiores quia cumque ipsam sit. At labore temporibus repudiandae veniam et.','0','7','1979-03-27 06:37:52'), ('7','69','Recusandae qui sit recusandae hic unde qui. Ipsam rerum omnis delectus dolorem sit enim. Ea est eius aperiam qui error earum.','0','3','2018-04-01 21:12:08'), ('8','26','Distinctio qui voluptatem neque nulla ad aut. Fugit et fuga doloribus possimus magni et. Corrupti odio et deserunt distinctio impedit. Reprehenderit ex deleniti veniam id ipsa quia facere.','0','2','1996-11-23 01:03:40'), ('9','56','Ut magnam deleniti eos suscipit neque non dolor. Atque libero excepturi temporibus tempore laboriosam. Reprehenderit molestiae dolor corrupti quam. Et accusantium commodi accusantium nihil quo totam explicabo. Nobis consequatur dolorum inventore suscipit.','1','1','2011-05-24 16:16:57'), ('10','89','Amet ducimus iste nulla voluptas. Perspiciatis molestias voluptas quisquam quis rerum in. Incidunt tenetur eos excepturi maiores. Quas repellat veritatis deserunt est.','1','4','2005-02-13 10:53:03'), ('11','79','Deserunt nihil sit et ut neque sed ea. Sequi quos ut nihil ad fugiat. Mollitia soluta eius qui in in eos.','0','4','1970-09-30 13:46:23'), ('12','21','Quia totam doloribus labore ea. Id autem et deserunt distinctio. Pariatur non earum odio odit. Natus iure cumque voluptas non maxime accusantium.','0','5','1973-02-16 05:15:55'), ('13','65','Exercitationem officiis facilis molestiae fuga quisquam debitis ad qui. Possimus et eligendi et recusandae. Consectetur facilis veniam ut. Voluptatem dolores consequatur qui.','0','6','1981-05-17 12:22:28'), ('14','90','Libero natus sit officiis distinctio. Ut consequatur non rerum quo quis dicta. Non qui alias consequatur molestias voluptate eveniet fugit. Aut exercitationem molestias vel ut perspiciatis.','0','2','2019-06-26 03:05:47'), ('15','5','Sit rerum rem et et ipsa. Aut sit totam labore repudiandae. Architecto reiciendis excepturi fugiat perferendis aut fuga tempora. Id hic eligendi nemo qui recusandae. Accusamus quibusdam mollitia explicabo architecto at amet et nihil.','1','4','1988-03-25 07:03:19'), ('16','31','Magni id sed aut vero ducimus. Autem ducimus neque perspiciatis eveniet quis. Eos sed laborum rerum sed sed quod. Libero sapiente quo adipisci veritatis sunt error. Et iure aut ea fugiat dicta architecto.','1','1','2002-03-02 19:16:01'), ('17','52','Molestias atque ipsa veritatis dolorum quo. Beatae libero et alias veniam. Aperiam ut ea velit in ut. Et nulla facilis neque quaerat est quidem assumenda.','0','2','1980-08-15 01:51:47'), ('18','8','Sit non aut aliquam. Commodi at aperiam nihil est enim et odio. Vel magnam quisquam dolorem iste inventore non suscipit. Libero nemo sed rerum necessitatibus velit at et consequatur.','0','2','1975-09-06 03:54:16'), ('19','65','Quia dolorem qui vero in cumque alias. Explicabo architecto sunt omnis molestias. Qui unde a quia pariatur ipsam sint ducimus. Ea quia distinctio dolorem recusandae porro harum explicabo. Quos quam voluptatem accusamus qui voluptatem.','1','7','1987-12-21 01:15:54'), ('20','14','Earum in tempore error qui sit suscipit asperiores. Consequatur expedita qui fugit repellat nesciunt. Molestiae dolor non doloremque sequi vel eaque dolorum.','1','7','1980-07-31 09:07:37'), ('21','61','Dolorem velit repudiandae facilis et qui id. Illum eos quibusdam libero ut id similique optio necessitatibus. Aut laudantium voluptas quod vel. Sint quisquam et nisi velit accusantium est.','1','0','2016-07-17 00:11:20'), ('22','3','Nesciunt magnam nesciunt perspiciatis ut quia. Quaerat ratione mollitia et quo nihil itaque. Ut ipsam consequatur nam qui. Cupiditate fuga laborum beatae sit consectetur sed dolores.','0','5','2009-10-17 01:53:32'), ('23','76','Maxime debitis aspernatur libero beatae qui debitis libero. Laborum tempore in ex quia accusantium quasi. Non non excepturi recusandae ut nihil labore. Aperiam harum error ut amet eveniet aut asperiores.','0','8','1989-05-03 16:10:27'), ('24','92','Placeat ad voluptas assumenda animi. Pariatur non velit quia hic. Vero eligendi a officiis quo.','1','1','1984-05-13 08:19:46'), ('25','28','Ab nisi cumque non delectus. Molestias labore delectus quas perspiciatis et pariatur. Quae voluptate autem quos sit in. Facere ipsum exercitationem provident voluptatem.','0','2','1989-08-04 00:01:37'), ('26','79','Assumenda blanditiis consequuntur aut tenetur. Laudantium dolorem voluptatem atque. Ea velit est repudiandae provident pariatur ipsa. Libero enim possimus voluptas dolor aut amet occaecati.','0','0','1994-05-23 01:57:20'), ('27','13','Tempora reprehenderit omnis modi veritatis est accusantium recusandae blanditiis. Rerum voluptas nam natus vero blanditiis. Reiciendis sequi est earum delectus earum. Expedita recusandae velit et in velit.','0','2','1987-04-19 07:35:27'), ('28','3','Assumenda ut corporis unde eveniet et quam. Sequi incidunt fugiat nobis ab quaerat. Soluta quis magni et nobis aliquid.','0','1','1999-05-13 14:12:24'), ('29','13','Culpa deserunt impedit autem rerum nam et minus. Illum dolorem cum rerum velit. Corrupti iure et aut in inventore voluptas pariatur.','1','2','1991-03-11 14:04:14'), ('30','88','Iure rerum id et dolorem sint perferendis dolorum. Rem rerum numquam voluptatem corporis et. Tempora ut fugit molestiae blanditiis. Assumenda et maiores velit aut ratione omnis maxime.','0','7','1998-12-11 04:57:52'), ('31','14','Dolorem illum ab quas qui. Natus et cumque culpa quos soluta occaecati neque aliquid. Quis et perspiciatis nulla ut consectetur. Quod autem voluptates expedita.','0','8','2018-04-07 08:37:43'), ('32','99','Minus aliquid dicta veniam maiores sit. Enim sed eveniet cumque dolorum sunt exercitationem. Autem incidunt accusantium cum molestiae est. Iure est ad velit quibusdam possimus pariatur aspernatur.','0','5','2001-07-17 02:01:39'), ('33','68','Dolor iste qui eos accusantium est. Voluptatem aut laborum voluptates distinctio qui. Eos maiores autem labore cumque omnis possimus. Minus architecto optio maiores veniam.','1','8','1975-10-10 14:01:21'), ('34','72','Quidem sequi vitae qui atque sit atque. Vero aliquam ea a in omnis. Similique voluptates consequatur provident expedita animi quam aut.','1','8','2010-05-28 18:20:17'), ('35','34','Rerum autem cupiditate accusamus non quod ducimus. Fugiat et molestiae accusamus ut perferendis voluptatem. Est quia tempora hic ad eum veniam explicabo non. Quaerat mollitia esse ullam culpa ipsa.','1','8','1998-04-21 15:01:29'), ('36','64','Sit quia in aut velit saepe velit perferendis. Sit corrupti non id qui doloribus assumenda officiis.','0','7','2000-05-01 01:08:57'), ('37','41','Voluptas ex laborum repudiandae molestiae iure. Et in natus quasi. Quisquam magni repellat inventore sunt quis. Sapiente voluptatem dolorem nam quis odio. Rem labore odio dolores sunt blanditiis fugit.','1','4','2014-04-28 23:41:11'), ('38','42','Eum temporibus rerum quis voluptas esse non rerum. Suscipit sint nobis id reiciendis est placeat. Quibusdam tempore dolorem repellat ex voluptas ullam sit. Suscipit ut odio odio odit illo ut porro.','0','9','1992-11-02 13:20:49'), ('39','35','Voluptates impedit autem accusantium qui suscipit aut maxime natus. Ut et ea culpa ut odio consequatur.','1','5','1988-08-23 14:47:18'), ('40','26','Est corrupti quos velit ut voluptas nostrum. Ut sit voluptas quam et. Sit amet qui possimus et.','0','8','1982-12-13 07:25:51'), ('41','28','Necessitatibus incidunt pariatur voluptate natus. Inventore sit molestias officia exercitationem cumque voluptatibus ipsam sed. Quia veritatis ad molestiae expedita est reiciendis molestiae.','1','7','2011-04-08 05:05:33'), ('42','70','Adipisci et quia aut exercitationem aut unde ut. Qui soluta cupiditate asperiores et cupiditate aspernatur. Quis quibusdam quasi quibusdam debitis autem consequuntur. Qui repellendus facere delectus omnis.','0','4','2012-12-19 22:48:53'), ('43','62','In repudiandae ea vel eum expedita beatae. Aliquam unde dolore architecto. Aperiam illum dolores et. Illum et asperiores voluptate alias. Ipsa aut ipsam nisi enim aut vel.','0','3','2007-07-29 12:59:11'), ('44','67','Velit est sint rerum non similique et eveniet. Neque amet voluptatem ut ipsa optio qui aperiam amet. Vel nisi voluptas aut iusto qui quasi aut.','0','3','1984-05-31 07:56:32'), ('45','84','Nostrum sed sit est. Nisi et sequi non et quo.','1','0','2014-08-31 02:02:28'), ('46','5','Repellendus eos aperiam dolorum id veniam. Sint voluptas esse molestiae impedit beatae. Dolores tenetur nihil sequi ea voluptatem accusamus.','1','9','2001-03-23 05:37:52'), ('47','22','Aut quam recusandae accusantium veniam eveniet molestiae officia. Quasi dolores autem aut dolor odio dolores itaque impedit. Modi voluptas modi quia dolorem fuga eum est quia.','1','2','2008-03-24 01:53:09'), ('48','98','Aut unde eius dolorem et beatae. Ea sint magni voluptatem id id pariatur est. Natus dolorem temporibus nemo et nam.','0','0','1999-08-21 02:06:34'), ('49','39','Ut distinctio architecto praesentium dignissimos accusamus perferendis. Eaque odit voluptatem aliquid ea sunt perferendis. Et in unde est ut nihil quam voluptas sapiente. Corporis minus quidem qui vel voluptatem sed dolore.','1','9','1986-06-16 23:15:01'), ('50','61','Quos ratione ipsam nisi alias consectetur quis. Hic ut eius aliquam itaque non hic necessitatibus. Vel suscipit officia beatae animi consectetur eos culpa.','0','8','2003-07-30 09:55:00'), ('51','99','Qui eius similique delectus omnis et aperiam fugiat. Consequuntur quia incidunt eum esse. Repellendus est corporis ipsam natus ducimus. Libero beatae porro cumque dolores error.','0','5','1999-02-15 18:21:58'), ('52','55','Eligendi vitae voluptate quia labore sint rerum tenetur aut. Voluptatem voluptate delectus natus mollitia vero. Dolor amet voluptas enim minus dolore. Sed laudantium dolores est voluptate enim ut iste.','0','2','1996-02-16 11:22:50'), ('53','15','Provident et repudiandae alias in. Sed ex corrupti totam impedit. Molestias est quisquam pariatur nam aspernatur quaerat corporis. Nisi consequatur quia id non.','0','0','2000-06-27 14:32:36'), ('54','89','Non similique et necessitatibus autem. Minima fugiat suscipit nemo deserunt libero fuga. Est eligendi soluta illum dolorum tempore officiis. Vero numquam architecto recusandae fugiat et rerum suscipit.','0','1','2004-02-27 17:45:17'), ('55','84','Qui adipisci veniam et ut. Voluptatem hic aperiam corrupti. Eos aut voluptas necessitatibus officiis.','0','3','1987-12-16 09:51:42'), ('56','83','Quia consequatur necessitatibus eum et laboriosam et. Non vero corporis mollitia explicabo. Neque exercitationem vero excepturi laudantium quis vero. Nihil accusantium aperiam quia vel sed.','1','2','1977-03-13 10:38:59'), ('57','35','Sit consectetur placeat eum dolores quo sequi et. Et et sunt ex suscipit numquam qui adipisci ea. Et animi dolores officia sint est. Beatae dolores ab amet sit ratione repellat enim dolores. Odio dolorem laboriosam reprehenderit nesciunt quis nostrum esse.','1','0','2003-04-05 05:26:40'), ('58','35','Est itaque hic ab molestiae. Sapiente necessitatibus voluptates eos quo voluptatibus. Cum quam recusandae harum nihil provident libero.','0','8','1999-08-13 23:53:44'), ('59','19','Debitis eligendi voluptas pariatur alias modi quasi sunt. Perferendis exercitationem voluptates vel voluptas. Autem quos non aspernatur dicta aut aperiam ea.','0','8','1986-03-20 16:05:40'), ('60','8','Molestiae dolorum et ullam dolor suscipit dignissimos vel. Dicta incidunt iusto totam aliquam. Similique fuga non voluptas et beatae.','1','2','1974-05-11 11:41:43'), ('61','85','Perferendis qui cumque ipsum et magnam. Sunt aliquam dignissimos sunt id. Pariatur rerum saepe eligendi voluptas rerum. Harum est at rerum porro commodi.','0','1','2008-04-04 22:42:26'), ('62','67','Est incidunt tempore tempore error omnis. Ut cupiditate et distinctio architecto omnis. Ad et ad ut impedit aspernatur.','1','2','1997-07-13 19:48:41'), ('63','23','Possimus officia est ducimus sequi. Dolorum earum natus velit odit. Vel ut quas sit modi voluptatum nemo. Enim maiores sit quae repudiandae dicta quis.','0','2','1992-07-03 05:51:50'), ('64','58','Sit eveniet provident est perferendis aut ut ipsam. Illo quae ipsum ad omnis voluptatem fugit vitae ab.','1','1','2019-02-01 21:12:46'), ('65','72','Eligendi ut explicabo rerum facilis vitae sint et. Non consequatur non veniam est iusto et. Eum incidunt nobis rerum itaque quia eaque modi. Aliquam beatae enim explicabo aut.','0','0','2004-05-31 11:15:47'), ('66','7','Inventore aut voluptas quisquam quae voluptatem commodi. Sit eligendi tempora dolores nam harum nihil. Sunt officiis aut omnis quo ratione et.','1','1','1981-07-25 05:15:55'), ('67','11','Neque et animi architecto blanditiis provident. Quae voluptatem ad corporis animi qui quia ad. Fugiat aperiam eos nihil consectetur facere occaecati. Soluta sint exercitationem officia dignissimos sapiente nostrum.','0','7','1975-12-09 23:48:09'), ('68','17','Aut consectetur neque autem accusamus tempore reiciendis. Quos suscipit id nihil earum illum quis. Vel neque aliquam possimus.','1','5','2014-10-22 22:14:28'), ('69','69','Sit pariatur perferendis nihil et provident sit aut. Consectetur tenetur minima sed laborum. Animi totam ut quod. Sit nam dolorum accusamus voluptatem et.','0','3','1989-06-27 13:30:15'), ('70','97','Commodi ad et magnam. Nam quia repellat illum et voluptatibus est consequatur.','1','3','1978-01-05 06:34:41'), ('71','54','Eum placeat eum in reprehenderit alias facilis veritatis. Commodi quos dolores rerum est. Repellendus doloribus ipsum non distinctio placeat maxime tempore.','1','9','2008-06-13 05:46:30'), ('72','94','Aut eum similique officia non vel vel enim. Rerum aliquid id sed exercitationem ex mollitia. Quam odio porro vitae aut et aut id.','1','4','1984-08-18 19:25:16'), ('73','31','Voluptates illo expedita ea ut. Maiores praesentium quia enim voluptatem non sed ut molestiae. Facere et quis veniam dolor aut perferendis. Blanditiis est et error quis velit voluptatem.','1','0','1978-03-03 11:48:57'), ('74','50','Rerum sequi aut et suscipit. Nam nostrum molestiae voluptatem odio minus laudantium. Similique dicta odio pariatur velit. Nisi sunt quia aut minus error. Sit saepe ad quod explicabo asperiores assumenda aut.','0','3','1998-04-10 22:56:04'), ('75','66','Quia et molestiae officiis dolor quas quod. Ut eos fugiat assumenda est accusantium nesciunt. Vitae doloremque voluptas eius similique ab voluptatem atque. Rem non dolorem molestias unde voluptate necessitatibus.','0','7','1990-06-01 08:02:43'), ('76','69','Velit illum velit expedita omnis eligendi adipisci. Minima voluptatibus cumque vel sit eveniet quia. Pariatur fuga ea ab quia nostrum aspernatur enim.','1','9','2018-11-02 12:37:26'), ('77','5','Sint qui nulla sed error rerum ipsa. Incidunt sit velit sunt at et. Laborum ex blanditiis labore provident voluptatem delectus maxime.','0','3','1971-06-18 05:46:11'), ('78','6','Dignissimos unde ut quia non qui. Vel quo maxime tempora et. Modi enim fugiat est tempora fuga nihil nemo. Consequuntur voluptas delectus necessitatibus molestiae quia hic aliquid. Exercitationem cum commodi sit consequatur quis fuga.','0','6','2005-07-07 12:07:21'), ('79','59','Eligendi sint sed aut qui sint vel. Eos nulla ipsa eius voluptatibus libero. Maxime dolor quia deserunt inventore delectus tempore.','0','3','1983-03-10 21:45:59'), ('80','94','Qui eos deserunt numquam dolore quia occaecati nobis. Sequi laudantium cupiditate dolore vel reprehenderit atque dolores eius. Deleniti consequatur occaecati soluta cumque dolorem. Quia eius et aperiam.','0','8','1976-09-04 10:51:59'), ('81','100','Error illum et dignissimos earum qui. In voluptatem at velit minus possimus. Eligendi impedit rerum harum ipsum dolores nobis sequi.','1','1','1995-04-17 03:44:56'), ('82','27','Illum voluptatibus molestiae nihil officia. Earum natus ut voluptatem porro. Quae quod voluptas animi possimus officia possimus.','1','0','1998-10-19 15:02:13'), ('83','75','Et aut voluptatem iste cupiditate. Dolorem atque harum sunt aspernatur. Voluptate facilis ipsa sit.','0','6','1997-10-01 16:37:36'), ('84','91','Laborum necessitatibus in qui voluptatem debitis necessitatibus consequuntur. Voluptas sunt quaerat dolores dolores blanditiis possimus. Eos aut aut sit numquam exercitationem labore qui. Eius minus qui omnis enim assumenda quis ut. Sed iste doloribus numquam sit.','0','8','1988-07-25 20:55:42'), ('85','97','Accusamus maiores illo voluptas quos esse quos est. Accusamus dicta omnis explicabo ratione.','0','8','2004-04-26 08:54:08'), ('86','89','Cumque voluptatem est nobis fugiat labore iste. Tempora eum sit qui corporis aut. Dolore mollitia quia non nihil quae vel nobis. Dolor ex sed cumque dolorem.','1','1','2019-02-19 04:13:10'), ('87','69','Et nisi eum aut qui unde et ipsum. Voluptatem aut reiciendis aut maiores ex. Vel quo placeat debitis est. Optio qui enim voluptatibus.','1','0','1974-03-24 17:46:38'), ('88','28','Pariatur qui suscipit consequatur non vero eos placeat labore. Doloribus et temporibus voluptatibus iure sed officia. Quod dignissimos adipisci et iste enim amet. Quidem necessitatibus rerum consequatur nostrum reiciendis est quas.','1','9','1997-03-21 03:12:04'), ('89','80','Rerum omnis quaerat perferendis ipsum est consequuntur reiciendis. Voluptas quidem ea quia rerum error autem quam. Nihil doloribus laudantium sunt quia. Et maiores ipsam molestiae tenetur in illo iusto quam.','0','1','2002-05-18 09:48:15'), ('90','7','Aut quia voluptatem repellat accusamus et voluptas aut. Dolor tempore architecto consequatur. Eos aut eum accusamus rerum.','1','2','1990-04-24 08:14:02'), ('91','96','At voluptas omnis voluptatum est nisi. In in rerum suscipit provident voluptates odio veniam nam. Accusantium fugiat aut qui ut. Dolorem est ipsum quidem fugiat.','0','7','2015-11-16 06:39:40'), ('92','67','Excepturi aut rerum laborum autem quaerat. Sunt consectetur unde a rem. Sit eos ut ratione ducimus et inventore.','0','2','2005-01-07 05:57:20'), ('93','2','Incidunt odio qui eveniet facilis quia voluptas. Animi quia nobis blanditiis quisquam modi cupiditate cumque. Rerum veniam voluptas ut cum hic enim assumenda. Voluptas voluptas iusto commodi qui doloribus.','1','1','1971-04-28 14:49:37'), ('94','10','Asperiores voluptatibus sit natus beatae doloremque cupiditate temporibus. Dicta magni qui eum nulla expedita. Ut expedita cumque aliquam sit et voluptatem.','1','9','2019-07-05 20:27:23'), ('95','20','Cupiditate ullam consectetur aut omnis unde. Dolorum atque in assumenda.','1','4','1972-12-30 01:53:46'), ('96','10','Natus cumque sint culpa quod sequi quaerat voluptatem. Dolores ut fugit est omnis illum. Enim placeat autem id et. Eos doloremque dicta impedit illo.','1','4','1985-10-05 17:05:42'), ('97','66','Ipsam pariatur sequi nisi porro at neque. Quia culpa ratione sed mollitia esse enim fugiat. Repudiandae sed doloribus labore deserunt quae et assumenda omnis. Cumque accusantium ad porro et.','0','3','1981-01-11 10:10:48'), ('98','36','Iusto iste eum adipisci. Maiores voluptates tenetur veniam ipsam. Ut voluptatem quod temporibus. Nostrum cumque enim et inventore maxime veritatis nemo accusantium.','1','9','2001-03-20 15:51:20'), ('99','38','Ut est enim libero dignissimos. Adipisci impedit vel magnam amet. Dicta porro accusantium fugit cupiditate. Consectetur veniam natus quos ut.','0','9','2009-12-16 10:20:45'), ('100','51','Laudantium enim in et ut nobis qui impedit. Et dicta tenetur debitis temporibus et. Dolorum debitis non aspernatur suscipit ab sed delectus laudantium.','1','5','1991-11-12 17:40:21'); DROP TABLE IF EXISTS `profiles`; CREATE TABLE `profiles` ( `user_id` int(10) unsigned NOT NULL, `sex` char(1) COLLATE utf8_unicode_ci NOT NULL, `birthday` date DEFAULT NULL, `hometown` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, `photo_id` int(10) unsigned NOT NULL, PRIMARY KEY (`user_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; INSERT INTO `profiles` VALUES ('1','m','2015-10-26','New Nicola','1'), ('2','m','2005-12-01','Leratown','2'), ('3','m','1993-03-16','East Pasqualeside','3'), ('4','m','1988-02-07','West Murray','4'), ('5','m','1988-10-15','West Travonmouth','5'), ('6','','1982-11-19','West Stanleyview','6'), ('7','m','1987-06-27','Emmettburgh','7'), ('8','m','1982-08-11','East Vickyfurt','8'), ('9','','2007-08-09','Hackettmouth','9'), ('10','','1991-09-11','Preciousville','10'), ('11','','1974-12-09','Gerholdburgh','11'), ('12','m','1979-02-14','Antoniaburgh','12'), ('13','','1995-08-27','Ziemannchester','13'), ('14','m','1978-12-26','East Opalfort','14'), ('15','m','1986-04-29','McCluremouth','15'), ('16','','1970-03-22','Mosheton','16'), ('17','m','2018-08-09','Lake Willardland','17'), ('18','','1998-10-18','VonRuedenchester','18'), ('19','m','1976-07-22','Lake Myriam','19'), ('20','','2003-07-21','O\'Reillyberg','20'), ('21','m','2004-01-04','South Tyrelton','21'), ('22','m','1971-10-24','New Malinda','22'), ('23','m','1996-12-19','Rociochester','23'), ('24','','1993-10-07','Sanfordport','24'), ('25','m','1974-06-08','Altenwerthton','25'), ('26','','2018-02-06','East Laron','26'), ('27','m','2005-12-26','New Ottiliefort','27'), ('28','m','1997-08-15','Runolfssonfort','28'), ('29','m','1999-09-23','Luettgenton','29'), ('30','','2007-05-13','West Ethelynmouth','30'), ('31','m','2017-06-02','Port Lilliana','31'), ('32','m','2004-11-15','New Jacinthemouth','32'), ('33','m','1988-01-01','Bartolettifort','33'), ('34','m','1997-10-02','Bogisichshire','34'), ('35','m','1989-10-10','South Anneview','35'), ('36','m','2005-03-02','Port Buckside','36'), ('37','m','2013-06-12','New Verdie','37'), ('38','','2013-07-27','Jolieville','38'), ('39','m','2013-04-24','North Roxanne','39'), ('40','m','1979-09-29','Gislasonfort','40'), ('41','','2005-11-15','South Andre','41'), ('42','m','2004-12-10','Deionshire','42'), ('43','m','2014-07-16','Cruickshankhaven','43'), ('44','m','2003-09-26','Bergstrommouth','44'), ('45','m','2006-10-13','Zemlakbury','45'), ('46','','2012-11-27','East Milanmouth','46'), ('47','m','1990-02-01','New June','47'), ('48','','2010-11-08','Emmettport','48'), ('49','','1996-06-21','Wiegandhaven','49'), ('50','m','2001-10-19','Bessiehaven','50'), ('51','','1990-07-12','Schneiderbury','51'), ('52','','1980-05-31','Hickleside','52'), ('53','','1980-08-08','Arloborough','53'), ('54','m','1996-12-04','Jonesshire','54'), ('55','m','2014-10-25','Damarismouth','55'), ('56','m','2010-10-18','South Mckenzietown','56'), ('57','m','1991-04-28','Rosamondport','57'), ('58','m','1981-09-18','Waelchiville','58'), ('59','','2017-09-02','Lavinaberg','59'), ('60','','1997-09-30','Kertzmannton','60'), ('61','','1987-05-15','Charlottehaven','61'), ('62','','2008-09-21','Jacobsonfort','62'), ('63','m','2013-05-01','Kautzerfurt','63'), ('64','','1991-12-27','Gleasonberg','64'), ('65','m','2006-08-05','Port Adrianville','65'), ('66','','1986-05-19','Myrltown','66'), ('67','m','1999-01-29','Alfshire','67'), ('68','m','1981-09-13','Alexannetown','68'), ('69','','2011-11-27','Purdyborough','69'), ('70','','1972-12-16','Macejkovicland','70'), ('71','m','1987-07-16','Frankborough','71'), ('72','m','1996-05-08','New Wilson','72'), ('73','m','2006-01-05','New Kayaborough','73'), ('74','m','2001-07-16','Lake Tyrellberg','74'), ('75','','1999-09-10','Morarfort','75'), ('76','','1995-10-08','Shaniaside','76'), ('77','m','1994-05-25','Karinafort','77'), ('78','','2006-07-17','North Frieda','78'), ('79','','2001-04-30','New Willastad','79'), ('80','m','2003-06-21','New Valentinaborough','80'), ('81','m','1980-07-23','Georgianaberg','81'), ('82','m','2016-06-27','Heidenreichshire','82'), ('83','m','2000-10-30','South Leda','83'), ('84','m','2002-06-07','Stiedemannside','84'), ('85','','1999-11-23','Kuvalisview','85'), ('86','','2016-08-22','Uptonland','86'), ('87','m','1979-05-17','North Shany','87'), ('88','','2006-03-16','South Leonel','88'), ('89','','2018-07-24','New Aimee','89'), ('90','','2004-01-27','Port Crystal','90'), ('91','','1998-02-04','Rosemarieborough','91'), ('92','m','1973-07-30','Westland','92'), ('93','','1991-02-27','South Lowell','93'), ('94','m','1982-01-18','Brendahaven','94'), ('95','m','2003-01-08','North Shawna','95'), ('96','m','1998-05-12','Port Giovanny','96'), ('97','','1976-05-14','East Florencioview','97'), ('98','m','1977-11-28','Emardchester','98'), ('99','','1999-09-14','South Westonview','99'), ('100','m','2008-07-26','Okunevatown','100'); DROP TABLE IF EXISTS `users`; CREATE TABLE `users` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `firstname` varchar(100) COLLATE utf8_unicode_ci NOT NULL, `lastname` varchar(100) COLLATE utf8_unicode_ci NOT NULL, `email` varchar(120) COLLATE utf8_unicode_ci NOT NULL, `phone` varchar(120) COLLATE utf8_unicode_ci NOT NULL, `created_at` datetime DEFAULT current_timestamp(), `updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`id`), UNIQUE KEY `email` (`email`), UNIQUE KEY `phone` (`phone`) ) ENGINE=InnoDB AUTO_INCREMENT=101 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; INSERT INTO `users` VALUES ('1','Alexa','Hansen','mitchell.schowalter@example.net','09358455131','1995-09-29 03:37:45','1998-04-06 22:05:08'), ('2','Pamela','Schamberger','streich.kira@example.org','(120)017-1591','2001-06-13 14:27:34','1974-10-09 12:33:04'), ('3','Isaac','Jast','spencer.giovanna@example.net','1-189-174-4075x759','1984-12-23 00:14:52','1981-04-13 17:56:34'), ('4','Zechariah','Kihn','reichert.leonora@example.com','383.753.1474','2012-08-01 22:20:29','1985-04-01 05:34:10'), ('5','Elwin','DuBuque','kdooley@example.com','(820)767-6709','1982-08-26 01:13:59','1981-12-25 12:56:58'), ('6','Barry','Stokes','parker.alexandro@example.org','178-912-9930x405','1987-09-24 14:03:06','1997-07-19 11:08:16'), ('7','Hiram','Lesch','everardo13@example.net','666-419-0209','2019-05-05 07:26:09','2009-03-21 00:15:39'), ('8','Melody','Shields','wquigley@example.com','799.510.1129','1997-05-02 02:57:34','1975-07-30 14:30:38'), ('9','Zion','Pfeffer','zwunsch@example.net','683-637-8934x1932','1977-07-13 22:51:38','2011-05-07 19:44:32'), ('10','Lera','McCullough','twaelchi@example.net','442-127-4727','1998-12-07 12:35:41','2006-04-07 22:51:53'), ('11','Jaida','Ziemann','dewayne.reichel@example.org','1-401-843-6426x16357','1980-05-03 02:20:58','2017-07-25 15:31:13'), ('12','Jennings','Mayert','kip.dubuque@example.com','344.290.1527','2007-05-03 14:03:42','2007-09-02 05:06:09'), ('13','Jamey','Huels','jace36@example.com','388-211-4420x573','1998-02-06 21:31:00','2015-02-04 00:10:10'), ('14','Johathan','Shields','jazlyn19@example.com','1-229-443-2608','1995-12-04 13:43:07','2015-12-03 09:51:54'), ('15','Romaine','Schinner','wyman.kling@example.org','458.977.0161x1481','1986-09-29 12:28:21','2006-03-19 14:06:42'), ('16','Mazie','Luettgen','gglover@example.org','(137)308-8262','1987-09-27 08:45:39','1970-08-22 12:07:46'), ('17','Carolyne','Becker','daugherty.osborne@example.net','504.697.0192','2011-07-03 12:13:48','1996-12-22 10:04:45'), ('18','Jerod','Emard','folson@example.org','(114)472-4525x933','1983-10-15 06:14:16','2017-06-14 09:00:14'), ('19','Vaughn','Morissette','scarlett30@example.org','390-831-3423x42572','2016-04-10 10:50:50','1983-07-06 23:02:18'), ('20','Orland','Ziemann','lynch.carmella@example.com','(806)717-6902','2001-04-25 12:12:13','1988-11-15 13:49:28'), ('21','Amara','Kuhic','brice.mcdermott@example.org','602-243-0432','1994-02-09 08:47:54','1970-07-28 22:56:27'), ('22','Rossie','Little','selmer21@example.org','435-541-9885x295','1992-03-14 11:55:07','1985-01-08 08:25:49'), ('23','Antonina','Mayer','witting.devonte@example.org','360-757-6450x1913','2008-11-21 05:40:46','2018-05-14 18:01:38'), ('24','Emery','Hintz','skoepp@example.com','009.902.8094','1975-03-04 04:03:29','1999-11-18 19:28:01'), ('25','Christian','McGlynn','shanon.nikolaus@example.net','852-515-0013','1996-04-07 10:51:32','2001-10-07 13:45:08'), ('26','Noemie','Nienow','hauck.jaron@example.net','(318)694-9876x5271','1979-07-29 05:16:42','2005-10-09 22:11:47'), ('27','Wilbert','Mosciski','schmeler.cristian@example.org','1-697-136-7754x115','1973-11-30 18:26:08','1982-09-07 05:50:43'), ('28','Osborne','Mraz','moen.dejah@example.com','344.940.2376x45881','1994-07-04 10:40:27','2011-04-01 14:38:49'), ('29','Antonetta','Jacobi','raquel16@example.org','(055)184-0288','2002-06-15 22:36:29','1991-12-01 18:07:24'), ('30','Otis','Kuhic','yabshire@example.net','(214)007-8690','1989-01-14 10:25:52','2008-11-12 08:03:25'), ('31','Madison','Waters','ihermann@example.net','00100803887','2016-06-01 08:33:33','2002-10-24 21:41:36'), ('32','Marquis','Kulas','cordelia58@example.com','261-265-9754x52100','1982-02-14 03:45:53','2019-03-28 13:58:17'), ('33','Cassie','Gorczany','cynthia.jenkins@example.com','633-176-5285','1995-06-19 22:49:08','1982-02-16 20:27:13'), ('34','Hank','Glover','brooks.kreiger@example.net','(824)035-5963x0902','1974-09-07 10:10:49','2003-01-21 16:12:41'), ('35','Laurianne','McDermott','graham.stephon@example.com','877-996-3323','2002-01-06 17:25:57','2000-05-28 11:50:24'), ('36','Everett','Block','jmosciski@example.net','(533)914-6148x131','1995-06-08 09:00:41','1983-06-02 19:09:23'), ('37','Ahmad','Deckow','dickens.valentina@example.org','(976)869-6313x0499','1988-06-12 09:57:22','1990-01-08 04:47:27'), ('38','Karlie','Kohler','ludie.quitzon@example.org','1-594-631-5384x623','1978-05-14 02:17:33','2011-09-20 19:31:07'), ('39','Hertha','Miller','heaven97@example.org','472-618-6580x55198','1977-09-16 21:17:39','2006-11-16 22:30:19'), ('40','Brooke','Ebert','schulist.dino@example.net','438-040-2647','2013-12-31 19:53:16','1989-04-18 10:39:34'), ('41','Cydney','Rice','estrella.lehner@example.net','440.889.5749','2019-06-16 20:21:20','1986-08-25 17:10:47'), ('42','Lucile','Rolfson','harris.kennedy@example.com','739-786-4971','2005-02-28 13:29:05','1977-04-14 10:24:45'), ('43','Brandi','Lesch','sparker@example.org','492-224-8547x491','1985-07-23 22:17:03','1988-02-02 07:05:01'), ('44','Sylvan','Reinger','lorenza42@example.com','1-228-210-9327','2002-08-11 17:35:28','2014-06-06 22:01:55'), ('45','Trycia','Upton','stamm.dallas@example.com','1-321-246-1496','1980-02-03 21:16:38','1987-05-24 05:08:13'), ('46','Hortense','Daniel','reynolds.lindsey@example.org','552.525.7472x5513','1978-10-21 19:24:50','1979-09-07 03:25:30'), ('47','Earline','Wolff','hoppe.santina@example.org','1-874-183-6681x0257','1982-08-25 17:00:13','2019-01-22 06:35:52'), ('48','Nikolas','Kling','susana.ziemann@example.com','(335)260-2652','1970-11-26 00:07:57','2013-10-29 21:50:22'), ('49','Reyna','Klocko','ellie.walter@example.org','07767993379','2007-07-14 17:06:08','1975-07-12 14:35:56'), ('50','Leann','Padberg','ondricka.roosevelt@example.org','+88(4)7088103291','1972-08-16 03:28:10','1991-04-15 02:20:02'), ('51','Ramon','Deckow','dkoss@example.net','584-891-0126x494','1986-01-19 01:34:53','2007-06-07 10:51:58'), ('52','Cristian','Wehner','carmelo97@example.net','985.543.5130x8451','2007-06-01 08:23:43','2011-04-03 08:33:13'), ('53','Juliana','Larkin','darius.hand@example.com','(513)511-3129','2012-06-10 17:45:57','2000-09-19 08:10:02'), ('54','Benton','Reichert','king.penelope@example.net','04778162678','1992-01-23 02:35:24','1981-06-02 02:08:57'), ('55','Clark','Ritchie','walker14@example.com','877-458-5454','1995-12-10 03:54:08','2010-09-12 20:43:53'), ('56','Domingo','Mraz','feeney.kirsten@example.net','1-047-639-1656x6975','1976-02-02 02:10:37','1992-07-25 19:58:43'), ('57','Arnaldo','O\'Reilly','doyle.cade@example.com','1-329-068-2063x023','1976-11-22 00:27:26','2019-08-27 18:04:46'), ('58','Augusta','Doyle','reed21@example.net','611-456-9717x4278','1979-02-07 10:08:20','1976-09-17 13:21:38'), ('59','Loren','Schultz','corrine.schoen@example.org','1-878-968-7642x7986','2006-07-15 01:39:16','2015-12-26 06:56:54'), ('60','Mia','Dach','shuel@example.com','(599)753-6269','1985-02-12 22:44:02','1987-04-18 11:04:01'), ('61','Nella','Boehm','beier.amparo@example.com','521.139.4944x00877','2015-01-14 21:00:48','1989-09-26 02:20:31'), ('62','Arlie','Keebler','kiehn.adolf@example.org','+30(0)3355206810','1973-10-01 02:40:38','1986-03-29 18:57:53'), ('63','Jensen','Rice','granville36@example.org','331-252-8667','2006-01-25 19:13:41','1997-05-12 05:45:40'), ('64','Hellen','Hessel','ojohns@example.org','241.657.9068','1986-10-17 02:22:32','2014-12-28 11:50:34'), ('65','Ola','Johns','efrain.mertz@example.com','(868)886-2693x218','1974-05-22 09:19:02','1997-11-22 16:22:28'), ('66','Antwon','Berge','polly.bartell@example.com','02713620241','1987-11-13 07:27:21','2004-05-25 10:45:03'), ('67','Annabelle','Lesch','dave.connelly@example.org','(669)414-1034','2011-05-24 19:42:45','1978-01-10 14:40:27'), ('68','Kayla','Rau','osmith@example.org','337-344-4323x8086','1973-10-19 15:21:56','1999-07-30 08:42:05'), ('69','Kris','Hermann','janelle64@example.org','979.693.3657','1995-04-30 15:15:52','1987-04-22 01:19:54'), ('70','Joana','Mertz','skiles.green@example.net','175.681.4929x1073','2012-04-30 10:17:08','1971-09-15 00:36:25'), ('71','Ike','Renner','maya.crona@example.net','(684)482-8507','1985-05-02 05:48:15','2007-05-01 13:33:51'), ('72','Garrison','Renner','xgutkowski@example.net','243-868-3921x3379','2016-12-12 03:07:15','1989-02-28 18:33:37'), ('73','King','Hills','mkunde@example.com','(526)585-3827','1971-05-21 18:25:04','1995-05-20 19:45:50'), ('74','Justina','Sipes','ebert.jarred@example.org','(041)915-7278x95627','1986-03-25 03:58:47','1984-12-01 21:45:10'), ('75','Alexa','Bednar','terrence.ruecker@example.org','718.957.2882x19152','1986-12-11 06:11:10','2010-05-30 13:41:46'), ('76','Dorian','Lebsack','osinski.maud@example.net','1-810-923-8262','1985-06-18 18:39:24','2004-02-02 04:03:14'), ('77','Loren','Koss','eileen29@example.net','343.745.4847x9174','2016-08-19 12:33:53','1977-02-03 07:28:25'), ('78','Keith','O\'Reilly','schulist.dennis@example.com','1-129-447-4368x277','1992-04-27 01:41:41','2001-07-04 15:06:16'), ('79','Randal','Swift','ggreenfelder@example.net','434-834-3159x582','2015-01-21 18:13:43','1985-07-09 06:06:17'), ('80','Dallas','Senger','oblanda@example.com','1-958-643-5275x2149','1988-03-20 13:58:34','2005-11-16 02:36:08'), ('81','Erick','Altenwerth','lucius.ritchie@example.org','486-510-2468x4312','1973-05-02 05:19:12','1996-07-12 03:33:55'), ('82','Jazmin','Will','noble.frami@example.com','607.055.3808x817','2017-07-04 19:50:08','1977-12-27 23:50:52'), ('83','Leonardo','Boyer','vern98@example.com','378.241.1502','1982-11-04 04:37:29','1995-01-02 12:22:30'), ('84','Opal','Barrows','herbert.sawayn@example.net','(121)199-0347','1996-10-06 00:27:04','1972-06-07 01:33:03'), ('85','Meredith','Smitham','brooklyn.erdman@example.net','738-773-3296x1131','2006-11-10 16:14:13','2009-04-12 13:54:47'), ('86','Ceasar','Ernser','domingo63@example.com','1-830-112-3660','1991-05-20 12:49:22','1985-05-10 00:21:40'), ('87','Ofelia','Dickinson','rippin.dovie@example.com','03536248725','1983-04-16 11:30:22','1980-03-06 05:28:42'), ('88','Robin','Anderson','heathcote.jarod@example.com','1-019-086-7989','1988-06-29 04:26:57','1972-06-14 17:47:58'), ('89','Lauren','Stokes','fernando70@example.net','467-258-2144','2007-11-14 22:28:23','2006-03-02 18:46:59'), ('90','Tate','Wunsch','marc.kirlin@example.com','(390)979-9873x20183','1999-11-22 05:34:30','2012-09-26 12:05:14'), ('91','Verla','Streich','johnson.blaise@example.org','1-035-553-3753','1972-03-18 15:36:14','2007-07-28 01:56:17'), ('92','Morton','Nader','borer.marta@example.org','(286)368-3396','1973-06-03 08:26:42','2005-12-11 07:58:50'), ('93','Dexter','Mayert','crohan@example.com','(873)986-9492x14260','1976-09-17 16:22:32','2013-06-03 11:17:20'), ('94','Leon','Turner','miguel.paucek@example.com','150-827-8159x967','1986-09-29 20:39:48','2011-12-24 21:50:38'), ('95','Daren','Bergstrom','heaney.yesenia@example.net','1-187-369-4105x774','1985-04-25 11:46:11','2006-11-21 08:15:13'), ('96','Nickolas','Baumbach','elta64@example.org','(271)571-0636x240','1980-12-18 12:53:31','1981-05-30 13:25:52'), ('97','Irma','Wiegand','portiz@example.net','+29(2)4874061707','2008-08-12 22:35:49','1986-11-05 11:01:38'), ('98','Berenice','Schinner','monahan.zoe@example.net','041.369.1248x9645','2008-11-10 02:02:14','2009-04-24 01:57:47'), ('99','Hillard','McClure','abelardo34@example.org','664-123-3839x1083','2000-06-09 09:40:29','2011-07-19 22:40:04'), ('100','Joshuah','Bergnaum','pmraz@example.net','1-883-436-9718x11757','1991-10-11 01:16:35','1997-03-14 00:59:31'); /*!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 */;
true
1ea1c8ad80065c9243a6a4a78b3f23b9eefa7f1b
SQL
dutinfo-projets3/basededonnee
/testsSite.sql
ISO-8859-1
1,767
4.15625
4
[]
no_license
--Selectionner la liste des lve dans un groupe (idGroupe= 1) SELECT * FROM ETUDIANT WHERE idPersonne IN (SELECT idPersonne FROM APPARTIENT WHERE idGroupe = 1) ORDER BY nom, prenom ; --Lister les notes d'un lve (idPersonne = 2) pour une anne (anneeCourante), --classes par matire SELECT n.valeur, n.coeff FROM NOTES n, ETUDIANT e, SUIVRE_SEMESTRE s WHERE n.idPersonne = 2 AND s.idPersonne = 2 AND s.anneeCourante = '2017' ; /* ???? ON NE PEUT PAS TROUVER UNE NOTE EN FONCTION DE L'ANNEE OU DU SEMESTRE */ --Lister les absences d'un lve (idPersonne =2) SELECT * FROM SEANCE WHERE idSeance IN (SELECT idSeance FROM ABSENCE WHERE idPersonne = 2) ; --Lister les lves absents a un cours (idSance = 5) SELECT * FROM ETUDIANT WHERE idPersonne IN (SELECT idPersonne FROM ABSENCE WHERE idSeance = 5) ; --Lister les formations SELECT * FROM FORMATION ; --Lister les matires par formation SELECT mat.nomMatiere, fmt.numero FROM MATIERE mat, FORMATION fmt WHERE fmt.idFormation = mat.idFormation ORDER BY 1,2 ; --Lister les cours auxquels appartient un tudiant (idPersonne= 2) SELECT * FROM SEANCE WHERE idGroupe IN (SELECT idGroupe FROM GROUPE WHERE idGroupe IN (SELECT idGroupe FROM APPARTENIR WHERE idPersonne = 2)) ; --Lister les sances d'un groupe (idGroupe 1) SELECT * FROM SEANCE WHERE idGroupe IN (SELECT idGroupe FROM GROUPE WHERE idGroupe = 1) ; --Lister les venements du jour (ici datePub = 25/10/2017 mais utiliser --plutt : DATE_FORMAT(SYSDATE, 'DD-MM-YYYY') ) SELECT * FROM EVENEMENT WHERE datePub = TO_DATE('25-10-2017', 'DD-MM-YYYY') ;
true
eb99e30d81e3f61b35ac3cf28d2814f4c8cbe845
SQL
ahiaplee/REST_API
/schema.sql
UTF-8
370
2.8125
3
[]
no_license
CREATE SCHEMA IF NOT EXISTS rest_api; CREATE TABLE IF NOT EXISTS rest_api.files ( id SERIAL, filename text NOT NULL, filesize integer NOT NULL, filepath text NOT NULL, sensitivity_score integer, last_updated timestamp without time zone, PRIMARY KEY(id) ); CREATE TABLE IF NOT EXISTS rest_api.users ( username text, password text );
true
818dc5a1514937803cd4fb3f85c7ae40a55aa907
SQL
JRHattan/Pewlett-Hackard-Analysis
/Data/Employee_Database_challenge.sql
UTF-8
2,730
4.34375
4
[]
no_license
-- Creating tables for PH-EmployeeDB CREATE TABLE departments ( dept_no VARCHAR(4) NOT NULL, dept_name VARCHAR(40) NOT NULL, PRIMARY KEY (dept_no), UNIQUE (dept_name) ); CREATE TABLE employees ( emp_no INT NOT NULL, birth_date DATE NOT NULL, first_name VARCHAR NOT NULL, last_name VARCHAR NOT NULL, gender VARCHAR NOT NULL, hire_date DATE NOT NULL, PRIMARY KEY (emp_no) ); CREATE TABLE dept_manager ( dept_no VARCHAR(4) NOT NULL, emp_no INT NOT NULL, from_date DATE NOT NULL, to_date DATE NOT NULL, FOREIGN KEY (emp_no) REFERENCES employees (emp_no), FOREIGN KEY (dept_no) REFERENCES departments (dept_no), PRIMARY KEY (emp_no, dept_no) ); CREATE TABLE salaries ( emp_no INT NOT NULL, salary INT NOT NULL, from_date DATE NOT NULL, to_date DATE NOT NULL, FOREIGN KEY (emp_no) REFERENCES employees (emp_no), PRIMARY KEY (emp_no) ); CREATE TABLE department_employees ( emp_no INT NOT NULL, dept_no VARCHAR(4) NOT NULL, from_date DATE NOT NULL, to_date DATE NOT NULL, FOREIGN KEY (emp_no) REFERENCES employees (emp_no), FOREIGN KEY (dept_no) REFERENCES departments (dept_no), PRIMARY KEY (emp_no, dept_no) ); CREATE TABLE Titles ( emp_no INT NOT NULL, Title Varchar NOT NULL, from_date DATE NOT NULL, to_date DATE NOT NULL, foreign Key (emp_no) References Employees (emp_no), Primary key ( emp_no, Title, from_date) ); SELECT * FROM departments; SELECT * FROM dept_manager; SELECT * FROM employees; SELECT * FROM Titles; SELECT * FROM department_employees; SELECT * FROM salaries; SELECT e.first_name, e.last_name, e.emp_no, t.title, t.from_date, t.to_date INTO Retirement_titles FROM employees as e INNER JOIN Titles as t ON (e.emp_no = t.emp_no) WHERE (birth_date BETWEEN '1952-01-01' AND '1955-12-31') ORDER BY e.emp_no SELECT * FROM Retirement_titles; --DROP TABLE Retirement_titles; SELECT DISTINCT ON (r.emp_no) r.emp_no, r.first_name, r.last_name, r.title INTO Unique_titles FROM retirement_titles as r ORDER BY r.emp_no, r.to_date DESC; SELECT * FROM Unique_titles; SELECT count(u.title), u.title INTO retiring_titles FROM Unique_titles as u GROUP BY u.title order by count(u.title) desc; SELECT * FROM retiring_titles; --drop Table retiring_titles; SELECT DISTINCT ON(e.emp_no) e.emp_no, e.first_name, e.last_name, e.birth_date, de.from_date, de.to_date, t.title INTO Mentorship FROM employees as e INNER JOIN department_employees as de ON (de.emp_no = e.emp_no) INNER JOIN Titles as t ON (t.emp_no = e.emp_no) WHERE (e.birth_date BETWEEN '1965-01-01' AND '1965-12-31') AND (de.to_date = '9999-01-01') ORDER BY e.emp_no, de.to_date DESC; SELECT * FROM Mentorship; drop Table Mentorship;
true
4ba6ca988c6428484fe84858c65defce574f4b12
SQL
simca114/ontracdrivers
/mysql_tables/stops.sql
UTF-8
2,217
2.921875
3
[]
no_license
-- MySQL dump 10.13 Distrib 5.5.35, for debian-linux-gnu (x86_64) -- -- Host: localhost Database: ontrac_db -- ------------------------------------------------------ -- Server version 5.5.35-1ubuntu1 /*!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 `stops` -- DROP TABLE IF EXISTS `stops`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `stops` ( `driver_num` smallint(5) unsigned DEFAULT NULL, `date_del` date DEFAULT NULL, `num_stops` smallint(5) unsigned DEFAULT '0', `sun_stops` tinyint(3) unsigned DEFAULT '0', `pu_stops` tinyint(3) unsigned DEFAULT '0', `hw_stops` tinyint(3) unsigned DEFAULT '0' ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `stops` -- LOCK TABLES `stops` WRITE; /*!40000 ALTER TABLE `stops` DISABLE KEYS */; INSERT INTO `stops` VALUES (153,'2014-04-23',135,1,0,0),(153,'0000-00-00',123,0,0,0),(907,'2014-04-23',135,0,0,0),(153,'2014-04-26',231,3,0,0),(907,'2014-04-28',112,2,0,0),(907,'2014-05-29',12,3,0,0); /*!40000 ALTER TABLE `stops` 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 2014-06-04 16:08:35
true
317a63c74bc8f62f1fb4306f5b241a1c4c462798
SQL
htmlacademy-nodejs/58484-buy-and-sell-3
/queries.sql
UTF-8
4,775
4.34375
4
[]
no_license
-- Получить список всех категорий (идентификатор, наименование категории); SELECT id, name FROM categories; -- Получить список категорий для которых создано минимум одно объявление (идентификатор, наименование категории); SELECT id, name FROM categories JOIN offer_categories ON categories.id = offer_categories.category_id GROUP BY categories.id; -- Получить список категорий с количеством объявлений (идентификатор, наименование категории, количество -- объявлений в категории); SELECT categories.id, categories.name, count(offer_categories.offer_id) FROM categories LEFT JOIN offer_categories ON categories.id = offer_categories.category_id GROUP BY categories.id; -- Получить список объявлений (идентификатор объявления, заголовок объявления, стоимость, тип объявления, -- текст объявления, дата публикации, имя и фамилия автора, контактный email, -- количество комментариев, наименование категорий). Сначала свежие объявления; SELECT offers.id, offers.title AS offer_title, offers.sum, types.title as type, offers.description, offers.created_at, users.first_name, users.last_name, users.email, count(comments.id) AS comments_count, STRING_AGG(DISTINCT categories.name, ', ') AS categories_list FROM offers LEFT JOIN types ON offers.type_id = types.id LEFT JOIN users ON users.id = offers.user_id LEFT JOIN comments ON offers.id = comments.offer_id JOIN offer_categories ON offers.id = offer_categories.offer_id JOIN categories on categories.id = offer_categories.category_id GROUP BY offers.id, users.id, types.id, offers.created_at ORDER BY offers.created_at DESC; -- Получить полную информацию определённого объявления (идентификатор объявления, заголовок объявления, -- стоимость, тип объявления, текст объявления, дата публикации, имя и фамилия автора, контактный email, -- количество комментариев, наименование категорий); SELECT offers.id, offers.title AS offer_title, offers.sum, types.title as type, offers.description, offers.created_at, users.first_name, users.last_name, users.email, count(comments.id) AS comments_count, STRING_AGG(DISTINCT categories.name, ', ') AS categories_list FROM offers LEFT JOIN types ON offers.type_id = types.id LEFT JOIN users ON users.id = offers.user_id LEFT JOIN comments ON offers.id = comments.offer_id JOIN offer_categories ON offers.id = offer_categories.offer_id JOIN categories on categories.id = offer_categories.category_id WHERE offers.id = 1 GROUP BY offers.id, users.id, types.id, offers.created_at; -- Получить список из 5 свежих комментариев (идентификатор комментария, идентификатор -- объявления, имя и фамилия автора, текст комментария); SELECT comments.id, comments.offer_id, users.first_name, users.last_name, comments.text FROM comments LEFT JOIN users on users.id = comments.user_id ORDER BY comments.created_at DESC LIMIT 5; -- Получить список комментариев для определённого объявления (идентификатор комментария, идентификатор объявления, -- имя и фамилия автора, текст комментария). Сначала новые комментарии; SELECT comments.id, comments.offer_id, users.first_name, users.last_name, comments.text FROM comments LEFT JOIN users on users.id = comments.user_id WHERE comments.offer_id = 1 ORDER BY comments.created_at DESC; -- Выбрать 2 объявления, соответствующих типу «куплю»; SELECT offers.* FROM offers WHERE offers.type_id = ( SELECT types.id FROM types WHERE title = 'sale' ) LIMIT 2; -- Обновить заголовок определённого объявления на «Уникальное предложение!»; UPDATE offers SET title = 'Уникальное предложение!' WHERE id = 1;
true
5398ae51faa4c3e9733b5f9632f4cf9aec4e1c53
SQL
MariVasil/Coursework_Database
/Курсовая_БД/Group_by.sql
UTF-8
864
3.703125
4
[]
no_license
/* Данная группировка отображает какое количество входящих транзакций было осуществлено по каждому платежному методу за конкретный период (в данном случае - прошлый год). Это полезно, например, для аналитики, сбора метрик и составления оценки. Можно, например, передать результаты этой выборки в какую-нибудь аналитическую систему для 'красивого' отображения*/ SELECT COUNT(*) as number_of_transactions, im.name as method_name FROM input_transactions it LEFT JOIN input_methods im ON it.method = im.id WHERE YEAR(it.created_at) = (YEAR(NOW()) - 1) GROUP BY im.name
true
48bcc9cd29e53930619290e8d1d6ebd25745b430
SQL
ZEEstranger/HackerRank
/SQL/Advanced Select/Binary Tree Nodes.sql
UTF-8
196
3.453125
3
[]
no_license
SELECT DISTINCT A.N, CASE WHEN B.N IS NULL THEN 'Leaf' WHEN A.P IS NULL THEN 'Root' ELSE 'Inner' END AS TES FROM BST AS A LEFT JOIN BST AS B ON B.P = A.N
true
0ff38e1b0f37d5d97e941605862c6f5da0027d2f
SQL
Huangshihaoo/specialColumn
/server/sql/article.sql
UTF-8
1,249
3.28125
3
[]
no_license
/* Navicat Premium Data Transfer Source Server : 我的数据库 Source Server Type : MySQL Source Server Version : 50553 Source Host : localhost:3306 Source Schema : essayserver Target Server Type : MySQL Target Server Version : 50553 File Encoding : 65001 Date: 05/05/2021 20:42:17 */ SET NAMES utf8mb4; SET FOREIGN_KEY_CHECKS = 0; -- ---------------------------- -- Table structure for article -- ---------------------------- DROP TABLE IF EXISTS `article`; /* 下面这段创建表 */ CREATE TABLE `article` ( `title` text CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `_id` bigint(100) NOT NULL AUTO_INCREMENT, `content` text CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `image` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `createTime` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `author` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `columnid` bigint(100) NULL DEFAULT NULL, PRIMARY KEY (`_id`) USING BTREE ) ENGINE = MyISAM AUTO_INCREMENT = 10051 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; /* 上面这段创建表 */ SET FOREIGN_KEY_CHECKS = 1;
true
da688200a70db601b3e5f760dbf8f09a013e6d73
SQL
derricknoutais/pizolub
/inserts2.sql
UTF-8
1,640
2.78125
3
[]
no_license
INSERT INTO fournisseurs (id,nom) VALUES (1, 'ENGEN S.A.'), (2, 'INDEPENDANT/ORONITE'), (3, 'LIBYA OIL '), (4, 'MOBIL'), (5, 'PETRO GABON'), (6, 'SHELL'), (7, 'TOTAL'), (8, 'TOTAL LUBS'); INSERT INTO clients (id,nom) VALUES (1, 'ENGEN'), (2, 'OILIBYA'), (3, 'PETRO GABON'), (4, 'TOTAL'), (5, 'PIZO'); INSERT INTO `produit_bases` (`id`,`nom`, `type`, `fournisseur_id`, `cump`, `quantité`, `valeur`) VALUES(1, '150 NS', 'Huile Base', NULL, NULL, 0, NULL), (2, '600 NS', 'Huile Base', NULL, NULL, 0, NULL), (3, '500 NS', 'Huile Base', NULL, NULL, 0, NULL), (4, 'BS 150 HVI ', 'Huile Base', NULL, NULL, 0, NULL), (5, 'CHEVRON NEUTRAL 100R', 'Huile Base', NULL, NULL, 0, NULL), (6, 'CHEVRON NEUTRAL 220R', 'Huile Base', NULL, NULL, 0, NULL), (7, 'CHEVRON NEUTRAL 600R', 'Huile Base', NULL, NULL, 0, NULL), (8, 'YUBASE 4', 'Huile Base', NULL, NULL, 0, NULL), (9, 'POWER OIL TO 1020', 'Huile Base', NULL, NULL, 0, NULL); INSERT INTO produit_bases (id,nom, type, fournisseur_id, cump, quantité, valeur) VALUES (3,'STOCK 1007(BLUE DYE)','Additif',1,NULL,NULL,NULL), (4,'STOCK 12156','Additif',1,NULL,NULL,NULL); INSERT INTO produit_finis (nom,conditionnement,poids_emballage,client_id) VALUES ('ENGEN DIESEL 600 SUPER 15W40', 'C24X1L', '21.6', '1'); INSERT INTO produit_finis (nom,conditionnement,poids_emballage,client_id) VALUES ('ENGEN DIESEL 600 SUPER 15W40', 'C4X5L', '18', '1'); INSERT INTO `users` (`id`,`name`, `email`, `password`, `remember_token`, `created_at`, `updated_at`) VALUES (1, 'Derrick Noutais', 'derricknoutais@gmail.com', '$2y$10$T/IWuUhbzcj2schYM6.e0u.FnEuY9Fbs.cuGIBucDVbKpE1weHe96', NULL, '2018-09-21 23:18:53', '2018-09-21 23:18:53');
true
5ede8b289a94d17566d0c13f7f7674a21a4aa884
SQL
sqlfluff/sqlfluff
/test/fixtures/dialects/ansi/select_nested_join.sql
UTF-8
1,898
3.984375
4
[ "MIT" ]
permissive
-- query with no brackets select orders.order_id AS order_id, customers.email AS email from orders join customers on( ( customers.customer_id = orders.customer_id ) ) where (customers.email = 'sample@gmail.com') group by orders.order_id, customers.email order by orders.order_id; -- nested bracketed up to 1 levels select orders.order_id AS order_id, customers.email AS email from ( orders join customers on( ( customers.customer_id = orders.customer_id ) ) ) where (customers.email = 'sample@gmail.com') group by orders.order_id, customers.email order by orders.order_id; -- nested bracketed up to 2 levels select orders.order_id AS order_id, customers.email AS email from ( ( orders join customers on( ( customers.customer_id = orders.customer_id ) ) ) join products on( (products.product_id = orders.product_id) ) ) where (customers.email = 'sample@gmail.com') group by orders.order_id, customers.email order by orders.order_id; -- nested bracketed up to 3 levels select orders.order_id AS order_id, customers.email AS email from ( ( ( orders join customers on( ( customers.customer_id = orders.customer_id ) ) ) join products on( (products.product_id = orders.product_id) ) ) join random on( (random.product_id = products.product_id) ) ) where (customers.email = 'sample@gmail.com') group by orders.order_id, customers.email order by orders.order_id;
true
60484a715dfbcd3657ecf89c592fb7c2ada12ac7
SQL
biancaannoscia/javaspring
/spring-mvc_1/target/classes/META-INF/sql/schema.sql
UTF-8
321
2.953125
3
[]
no_license
CREATE TABLE BOOK ( ID INT(11) NOT NULL AUTO_INCREMENT , CATEGORY_NAME VARCHAR(100) NOT NULL , ISBN VARCHAR(10) NOT NULL , TITLE VARCHAR(200) NOT NULL , PUBLISHER VARCHAR(100) NOT NULL , PRICE DECIMAL(4,2) NOT NULL , UNIQUE UQ_BOOK (CATEGORY_NAME, TITLE) , PRIMARY KEY (ID) );
true
9427faf24cfbc19689a42f55c83a1aba2f11185f
SQL
jimmychang851129/Database_Final
/mysql/sql-scripts/InsertTable.sql
UTF-8
23,173
2.546875
3
[]
no_license
-- Studio Insert into Studio(SdName,FoundDate,Location,President) Values('ufotable','2000','杉並区本天沼','近藤光'); Insert into Studio(SdName,FoundDate,Location,President) Values('TROYCA','2013','東京都練馬区石神井町','長野敏之'); Insert into Studio(SdName,FoundDate,President) Values('TYPE-MOON','2003','奈須蘑菇'); Insert into Studio(SdName,Location,President) Values('Nitro+','日本東京都千代田區','でじたろう'); Insert into Studio(SdName,FoundDate,Location,President) Values('MAGES.','2005','東京都渋谷區猿楽町','志倉千代丸'); Insert into Studio(SdName,FoundDate,Location,President) Values('WHITE FOX','2007','東京都杉並区天沼','岩佐岳'); Insert into Studio(SdName,FoundDate,Location,President) Values('A-1 Pictures','2005','東京都杉並區成田東4丁目','柏田真一郎'); Insert into Studio(SdName,FoundDate,Location) Values('三次元','2006','東京都杉並區上荻一丁目'); Insert into Studio(SdName,FoundDate,Location,President) Values('J.C.STAFF','1986','日本東京都武藏野市境二丁目','阿部倫久'); Insert into Studio(SdName,FoundDate,Location,President) Values('ISSEN','1990','日本東京都世田谷區若林一丁目','奧野敏聰'); -- Anime Insert into Animation(AnimeID,AName,Episode,Season,Rating,AnimeDate,sdName,image) VALUES(1,'Fate/Zero',25,1,10,'2011','ufotable','fz.jpeg'); Insert into Animation(AnimeID,AName,Episode,Season,Rating,AnimeDate,sdName,image) VALUES(2,'Steins;Gate',25,1,9,'2011','WHITE FOX','steingate.jpeg'); Insert into Animation(AnimeID,AName,Episode,Season,Rating,AnimeDate,sdName,image) VALUES(3,'Re:CREATORS',22,1,9,'2017','TROYCA','recreate.jpeg'); Insert into Animation(AnimeID,AName,Episode,Season,Rating,AnimeDate,sdName,image) VALUES(4,'Re:ゼロから始める異世界生活',25,1,9,'2016','WHITE FOX','rezero.jpeg'); Insert into Animation(AnimeID,AName,Episode,Season,Rating,AnimeDate,sdName,image) VALUES(5,'とある魔術の禁書目録',24,1,8,'2008','J.C.STAFF','index.jpg'); Insert into Animation(AnimeID,AName,Episode,Season,Rating,AnimeDate,sdName,image) VALUES(6,'四月是你的謊言',22,1,8,'2014','A-1 Pictures','april.jpg'); Insert into Animation(AnimeID,AName,Episode,Season,Rating,AnimeDate,sdName,image) VALUES(7,'刀劍神域',25,1,9,'2012','A-1 Pictures','sao_s1.jpg'); Insert into Animation(AnimeID,AName,Episode,Season,Rating,AnimeDate,sdName,image) VALUES(8,'刀劍神域',24,2,7,'2014','A-1 Pictures','sao_s2.jpg'); Insert into Animation(AnimeID,AName,Episode,Season,Rating,AnimeDate,sdName,image) VALUES(9,'bang dream',13,2,10,'2019','三次元','bgd_s2.jpeg'); -- genreName Insert into GenreName(Genre,Gtype) VALUES(1,'動作'); Insert into GenreName(Genre,Gtype) VALUES(2,'魔法'); Insert into GenreName(Genre,Gtype) VALUES(3,'奇幻'); Insert into GenreName(Genre,Gtype) VALUES(4,'懸疑'); Insert into GenreName(Genre,Gtype) VALUES(5,'冒險'); Insert into GenreName(Genre,Gtype) VALUES(6,'校園'); Insert into GenreName(Genre,Gtype) VALUES(7,'戀愛'); Insert into GenreName(Genre,Gtype) VALUES(8,'青春'); Insert into GenreName(Genre,Gtype) VALUES(9,'音樂'); -- genre Insert into Genre(AnimeID,Genre) VALUES(1,1); Insert into Genre(AnimeID,Genre) VALUES(1,2); Insert into Genre(AnimeID,Genre) VALUES(1,3); Insert into Genre(AnimeID,Genre) VALUES(2,4); Insert into Genre(AnimeID,Genre) VALUES(2,3); Insert into Genre(AnimeID,Genre) VALUES(3,1); Insert into Genre(AnimeID,Genre) VALUES(3,3); Insert into Genre(AnimeID,Genre) VALUES(4,3); Insert into Genre(AnimeID,Genre) VALUES(4,5); Insert into Genre(AnimeID,Genre) VALUES(4,1); Insert into Genre(AnimeID,Genre) VALUES(5,1); Insert into Genre(AnimeID,Genre) VALUES(5,2); Insert into Genre(AnimeID,Genre) VALUES(6,6); Insert into Genre(AnimeID,Genre) VALUES(6,7); Insert into Genre(AnimeID,Genre) VALUES(6,8); Insert into Genre(AnimeID,Genre) VALUES(7,1); Insert into Genre(AnimeID,Genre) VALUES(7,3); Insert into Genre(AnimeID,Genre) VALUES(7,5); Insert into Genre(AnimeID,Genre) VALUES(8,1); Insert into Genre(AnimeID,Genre) VALUES(8,3); Insert into Genre(AnimeID,Genre) VALUES(8,5); Insert into Genre(AnimeID,Genre) VALUES(9,8); Insert into Genre(AnimeID,Genre) VALUES(9,9); -- staff Insert into Staff(SName,SdName) VALUES('青木英','TROYCA'); Insert into Staff(SName,SdName) VALUES('武內崇','TYPE-MOON'); Insert into Staff(SName,SdName) VALUES('虛淵玄','Nitro+'); Insert into Staff(SName) VALUES('佐藤卓哉'); Insert into Staff(SName) VALUES('花田十輝'); Insert into Staff(SName) VALUES('廣江禮威'); Insert into Staff(SName) VALUES('長月達平'); Insert into Staff(SName) VALUES('渡邊政治'); Insert into Staff(SName) VALUES('鎌池和馬'); Insert into Staff(SName) VALUES('錦織博'); Insert into Staff(SName) VALUES('新川直司'); Insert into Staff(SName) VALUES('石黑恭平'); Insert into Staff(SName) VALUES('川原礫'); Insert into Staff(SName,SdName) VALUES('伊藤智彥','A-1 Pictures'); Insert into Staff(SName,SdName) VALUES('ISSEN','ISSEN'); Insert into Staff(SName) VALUES('大槻敦史'); -- incharge Insert into Incharge(AnimeID,Job,SName) VALUES(1,'監督','青木英'); Insert into Incharge(AnimeID,Job,SName) VALUES(1,'人設原案','武內崇'); Insert into Incharge(AnimeID,Job,SName) VALUES(1,'作者','虛淵玄'); Insert into Incharge(AnimeID,Job,SName) VALUES(2,'監督','佐藤卓哉'); Insert into Incharge(AnimeID,Job,SName) VALUES(2,'系列構成','花田十輝'); Insert into Incharge(AnimeID,Job,SName) VALUES(3,'作者','廣江禮威'); Insert into Incharge(AnimeID,Job,SName) VALUES(3,'監督','青木英'); Insert into Incharge(AnimeID,Job,SName) VALUES(4,'作者','長月達平'); Insert into Incharge(AnimeID,Job,SName) VALUES(4,'監督','渡邊政治'); Insert into Incharge(AnimeID,Job,SName) VALUES(5,'作者','鎌池和馬'); Insert into Incharge(AnimeID,Job,SName) VALUES(5,'監督','錦織博'); Insert into Incharge(AnimeID,Job,SName) VALUES(6,'作者','新川直司'); Insert into Incharge(AnimeID,Job,SName) VALUES(6,'監督','石黑恭平'); Insert into Incharge(AnimeID,Job,SName) VALUES(7,'作者','川原礫'); Insert into Incharge(AnimeID,Job,SName) VALUES(7,'監督','伊藤智彥'); Insert into Incharge(AnimeID,Job,SName) VALUES(8,'作者','川原礫'); Insert into Incharge(AnimeID,Job,SName) VALUES(8,'監督','伊藤智彥'); Insert into Incharge(AnimeID,Job,SName) VALUES(9,'作者','ISSEN'); Insert into Incharge(AnimeID,Job,SName) VALUES(9,'劇本統籌','大槻敦史'); -- Agent Insert into Agent(AgName,Location,FoundDate,President) VALUES('SACRA MUSIC','東京都千代田區六番町','2017','水野道訓'); Insert into Agent(AgName,Location,FoundDate,President) VALUES('VV-ALKLINE','東京都文京区本郷','2017','澤野弘之'); Insert into Agent(AgName,Location,FoundDate,President) VALUES('Music Ray\'n','東京都千代田區六番町','2005','高橋章'); Insert into Agent(AgName,Location,FoundDate,President) VALUES('MAGES.','東京都港区三田三丁目','2006','志倉千代丸'); Insert into Agent(AgName,Location,FoundDate,President) VALUES('TaWaRa','東京都新宿区西新宿','2016','大嶋文博'); Insert into Agent(AgName,Location,FoundDate,President) VALUES('gr8!records','東京都千代田区六番町','2003','高橋章'); Insert into Agent(AgName,Location,FoundDate,President) VALUES('81 produce','東京都澀谷區富谷1丁目','1981','南澤道義'); Insert into Agent(AgName,Location,FoundDate,President) VALUES('響','東京都中野區中央一丁目','2009','木谷高明'); Insert into Agent(AgName,Location,FoundDate,President) VALUES('大澤事務所','東京都港區赤坂4丁目','1984','大澤田鶴子'); Insert into Agent(AgName,Location,FoundDate,President) VALUES('I\'m Enterprise','東京都澀谷區代代木','1993','江崎加子男'); Insert into Agent(AgName,Location,FoundDate,President) VALUES('Across Entertainment','東京都澀谷區富谷','2008','藤崎淳'); Insert into Agent(AgName,Location,FoundDate,President) VALUES('EARLY WING','東京都港區元赤坂一丁目','2009','佐藤龍乙'); Insert into Agent(AgName,Location,FoundDate,President) VALUES('劇団俳優座','東京都港区六本木四丁目','1944','宮崎健'); Insert into Agent(AgName,Location,FoundDate,President) VALUES('東京俳優生活協同組合','東京都渋谷區千駄ヶ谷','1960','朝田孝二'); Insert into Agent(AgName,Location,FoundDate,President) VALUES('株式会社劇団ひまわり','東京都涉谷區惠比壽西2丁目','1952','砂岡不二夫'); Insert into Agent(AgName,Location,FoundDate,President) VALUES('Atomic Monkey','日本東京都港區東麻布','2007','田村司'); Insert into Agent(AgName,Location,FoundDate,President) VALUES('ARTSVISION','東京都澀谷區代代木','1984','江崎加子男'); Insert into Agent(AgName,Location,FoundDate,President) VALUES('Hirata Office','東京都港区赤坂','1979','桜井良樹'); Insert into Agent(AgName,Location,FoundDate,President) VALUES('武士道','東京都中野區','2002','木谷高明'); Insert into Agent(AgName,Location,FoundDate,President) VALUES('AXL ONE','東京都新宿區西新宿','2011','森川智之'); -- VoiceACtor Insert into VoiceActor(VName,Gender,Birthday,Debut,Agent,image) VALUES('小山力也',FALSE,'1218','1987','劇団俳優座','shaoshan.jpeg'); Insert into VoiceActor(VName,Gender,Birthday,Debut,Agent,image) VALUES('大原沙耶香',TRUE,'1206','1998','東京俳優生活協同組合','dauan.jpeg'); Insert into VoiceActor(VName,Gender,Birthday,Debut,Agent,image) VALUES('川澄綾子',TRUE,'0330','1997','大澤事務所','chanchen.jpeg'); Insert into VoiceActor(VName,Gender,Birthday,Debut,Agent,image) VALUES('中田讓治',FALSE,'0422','1985','大澤事務所','Nakata_George.jpg'); Insert into VoiceActor(VName,Gender,Birthday,Debut,Agent,image) VALUES('宮野真守',FALSE,'0608','2001','株式会社劇団ひまわり','miyano.jpeg'); Insert into VoiceActor(VName,Gender,Birthday,Debut,Agent,image) VALUES('花澤香菜',TRUE,'0225','2003','大澤事務所','hanazawa.jpg'); Insert into VoiceActor(VName,Gender,Birthday,Debut,Agent,image) VALUES('關智一',FALSE,'0908','1993','Atomic Monkey','kanzi.jpg'); Insert into VoiceActor(VName,Gender,Birthday,Debut,Agent,image) VALUES('今井麻美',TRUE,'0516','1999','EARLY WING','imai.jpeg'); Insert into VoiceActor(VName,Gender,Birthday,Debut,Agent,image) VALUES('山下大輝',FALSE,'0907','2012','ARTSVISION','yamasita.jpeg'); Insert into VoiceActor(VName,Gender,Birthday,Debut,Agent,image) VALUES('豐崎愛生',TRUE,'1028','2006','Music Ray\'n','fungchi.jpeg'); Insert into VoiceActor(VName,Gender,Birthday,Debut,Agent,image) VALUES('小松未可子',TRUE,'1111','2010','Hirata Office','siaosung.jpeg'); Insert into VoiceActor(VName,Gender,Birthday,Debut,Agent,image) VALUES('水瀨祈',TRUE,'1202','2010','AXL ONE','mizu.jpeg'); Insert into VoiceActor(VName,Gender,Birthday,Debut,image) VALUES('小林裕介',FALSE,'0325','2009','shaolin.jpeg'); Insert into VoiceActor(VName,Gender,Birthday,Debut,Agent,image) VALUES('高橋李依',TRUE,'0227','2013','81 produce','kaochao.jpg'); Insert into VoiceActor(VName,Gender,Birthday,Debut,Agent,image) VALUES('內山夕實',TRUE,'1030','2005','大澤事務所','neshan.jpeg'); Insert into VoiceActor(VName,Gender,Birthday,Debut,image) VALUES('阿部敦',FALSE,'0325','2006','Abe_atsushi.jpg'); Insert into VoiceActor(VName,Gender,Birthday,Debut,Agent,image) VALUES('井口裕香',TRUE,'0711','2002','大澤事務所','ikuchi.jpg'); Insert into VoiceActor(VName,Gender,Birthday,Debut,Agent,image) VALUES('佐藤利奈',TRUE,'0502','2001','東京俳優生活協同組合','satou.jpg'); Insert into VoiceActor(VName,Gender,Birthday,Debut,image) VALUES('岡本信彥',FALSE,'1024','2006','Okamoto.jpg'); Insert into VoiceActor(VName,Gender,Birthday,Debut,Agent,image) VALUES('種田梨沙',TRUE,'0712','2010','大澤事務所','tameda.jpg'); Insert into VoiceActor(VName,Gender,Birthday,Debut,Agent,image) VALUES('佐倉綾音',TRUE,'0129','2010','I\'m Enterprise','sakura.jpeg'); Insert into VoiceActor(VName,Gender,Birthday,Debut,Agent,image) VALUES('花江夏樹',FALSE,'0626','2011','Across Entertainment','komica.jpeg'); Insert into VoiceActor(VName,Gender,Birthday,Debut,Agent,image) VALUES('逢坂良太',FALSE,'0802','2011','EARLY WING','ryota.jpeg'); Insert into VoiceActor(VName,Gender,Birthday,Debut,Agent,image) VALUES('松岡禎丞',FALSE,'0917','2009','I\'m Enterprise','kito.jpeg'); Insert into VoiceActor(VName,Gender,Birthday,Debut,Agent,image) VALUES('戶松遙',TRUE,'0204','2004','Music Ray\'n','haruka.jpeg'); Insert into VoiceActor(VName,Gender,Birthday,Debut,Agent,image) VALUES('愛美',TRUE,'1225','2010','響','aimi.jpeg'); Insert into VoiceActor(VName,Gender,Birthday,Debut,Agent,image) VALUES('相羽あいな',TRUE,'1017','2016','響','aiba.jpeg'); -- Casting Insert into Casting(AnimeID,VName,CharacterName,ChGender,image) VALUES(1,'小山力也','衛宮切嗣',0,'emiya.jpg'); Insert into Casting(AnimeID,VName,CharacterName,ChGender,image) VALUES(1,'大原沙耶香','アイリスフィール・フォン・アインツベルン',1,'Ailisifeier.jpg'); Insert into Casting(AnimeID,VName,CharacterName,ChGender,image) VALUES(1,'川澄綾子','Saber',1,'saber.jpg'); Insert into Casting(AnimeID,VName,CharacterName,ChGender,image) VALUES(1,'中田讓治','言峰綺禮',0,'kirei_smirk.jpg'); Insert into Casting(AnimeID,VName,CharacterName,ChGender,image) VALUES(2,'宮野真守','岡部倫太郎',0,'taro.jpg'); Insert into Casting(AnimeID,VName,CharacterName,ChGender,image) VALUES(2,'花澤香菜','椎名まゆり',1,'duduru.jpg'); Insert into Casting(AnimeID,VName,CharacterName,ChGender,image) VALUES(2,'關智一','橋田至',0,'hashi.jpg'); Insert into Casting(AnimeID,VName,CharacterName,ChGender,image) VALUES(2,'今井麻美','牧瀨紅莉栖',1,'red.jpg'); Insert into Casting(AnimeID,VName,CharacterName,ChGender,image) VALUES(3,'山下大輝','水篠颯太',0,'satai.jpg'); Insert into Casting(AnimeID,VName,CharacterName,ChGender,image) VALUES(3,'豐崎愛生','アルタイル',1,'arutairu.jpg'); Insert into Casting(AnimeID,VName,CharacterName,ChGender,image) VALUES(3,'小松未可子','セレジア・ユピティリア',1,'selesia.jpg'); Insert into Casting(AnimeID,VName,CharacterName,ChGender,image) VALUES(3,'水瀨祈','メテオラ・エスターライヒ',1,'Meteora_anime.jpg'); Insert into Casting(AnimeID,VName,CharacterName,ChGender,image) VALUES(4,'小林裕介','菜月昴',0,'Natsuki_Subaru_1.jpg'); Insert into Casting(AnimeID,VName,CharacterName,ChGender,image) VALUES(4,'高橋李依','エミリア',1,'emiriya.png'); Insert into Casting(AnimeID,VName,CharacterName,ChGender,image) VALUES(4,'水瀨祈','レム',1,'Rem_Anime.png'); Insert into Casting(AnimeID,VName,CharacterName,ChGender,image) VALUES(4,'內山夕實','パック',1,'paku.jpg'); Insert into Casting(AnimeID,VName,CharacterName,ChGender,image) VALUES(5,'阿部敦','上条當麻',0,'touma1.jpg'); Insert into Casting(AnimeID,VName,CharacterName,ChGender,image) VALUES(5,'井口裕香','INDEX',1,'index.png'); Insert into Casting(AnimeID,VName,CharacterName,ChGender,image) VALUES(5,'佐藤利奈','御坂美琴',1,'misakamikoto.jpg'); Insert into Casting(AnimeID,VName,CharacterName,ChGender,image) VALUES(5,'岡本信彥','一方通行',0,'accelerator.jpg'); Insert into Casting(AnimeID,VName,CharacterName,ChGender,image) VALUES(6,'種田梨沙','宮園薰',1,'kaoru.jpg'); Insert into Casting(AnimeID,VName,CharacterName,ChGender,image) VALUES(6,'佐倉綾音','澤部椿',1,'saki.jpg'); Insert into Casting(AnimeID,VName,CharacterName,ChGender,image) VALUES(6,'花江夏樹','有馬公生',0,'arima.jpg'); Insert into Casting(AnimeID,VName,CharacterName,ChGender,image) VALUES(6,'逢坂良太','渡亮太',0,'ta.jpg'); Insert into Casting(AnimeID,VName,CharacterName,ChGender,image) VALUES(7,'松岡禎丞','桐谷和人',0,'kirito.png'); Insert into Casting(AnimeID,VName,CharacterName,ChGender,image) VALUES(8,'松岡禎丞','桐谷和人',0,'kirito.png'); Insert into Casting(AnimeID,VName,CharacterName,ChGender,image) VALUES(7,'戶松遙','亞絲娜',1,'asuna.jpg'); Insert into Casting(AnimeID,VName,CharacterName,ChGender,image) VALUES(8,'戶松遙','亞絲娜',1,'asuna.jpg'); Insert into Casting(AnimeID,VName,CharacterName,ChGender,image) VALUES(9,'愛美','戶山香澄',1,'kasumi.jpg'); Insert into Casting(AnimeID,VName,CharacterName,ChGender,image) VALUES(9,'相羽あいな','湊友希那',1,'minato.jpg'); -- Singer Insert into Singer(VName,Gender,Birthday,Debut,Agent,image) VALUES('LiSA',1,'0624','2010','SACRA MUSIC','lisa.png'); Insert into Singer(VName,Gender,Birthday,Debut,Agent,image) VALUES('藍井艾露',1,'1130','2011','SACRA MUSIC','eir.jpg'); Insert into Singer(VName,Gender,Debut,Agent,image) VALUES('Kalafina',1,'2007','SACRA MUSIC','kalafina.jpg'); Insert into Singer(VName,Gender,Birthday,Debut,Agent,image) VALUES('春奈露娜',1,'1011','2011','SACRA MUSIC','luna.jpg'); Insert into Singer(VName,Gender,Birthday,Debut,image) VALUES('榊原由依',1,'1013','1999','yui.jpg'); Insert into Singer(VName,Gender,Birthday,Debut,image) VALUES('伊藤香奈子',1,'0328','2002','kanako.jpg'); Insert into Singer(VName,Gender,Debut,Agent,image) VALUES('Tielle & Gemie',1,'2017','VV-ALKLINE','tandg.jpg'); Insert into Singer(VName,Gender,Birthday,Debut,Agent,image) VALUES('綾野真白',1,'0423','2014','SACRA MUSIC','mashiro.jpg'); Insert into Singer(VName,Gender,Birthday,Debut,Agent,image) VALUES('豐崎愛生',1,'1023','2006','Music Ray\'n','aisei.jpg'); Insert into Singer(VName,Gender,Debut,Agent,image) VALUES('三月のパンタシア',1,'2015','SACRA MUSIC','Phantasia.png'); Insert into Singer(VName,Gender,Birthday,Debut,Agent,image) VALUES('鈴木木乃美',1,'1105','2011','MAGES.','suzuki.jpg'); Insert into Singer(VName,Gender,Debut,Agent,image) VALUES('MYTH & ROID',1,'2015','TaWaRa','mythroid.png'); Insert into Singer(VName,Gender,Birthday,Debut,Agent,image) VALUES('高橋李依',1,'0227','2013','81 produce','kaochao.jpg'); Insert into Singer(VName,Gender,Birthday,Debut,image) VALUES('川田真美',1,'0213','2001','mami.jpg'); Insert into Singer(VName,Gender,Birthday,Debut,image) VALUES('IKU',1,'0122','2006','iku.jpg'); Insert into Singer(VName,Gender,Debut,Agent,image) VALUES('Goose house',0,'2011','gr8!records','goosehouse.jpg'); Insert into Singer(VName,Gender,Birthday,Debut,Agent,image) VALUES('戶松遙',1,'0204','2004','Music Ray\'n','haruka.jpg'); Insert into Singer(VName,Gender,Debut,Agent,image) VALUES('Roselia',1,'2017','武士道','roselia.jpg'); Insert into Singer(VName,Gender,Debut,Agent,image) VALUES('Poppin‘Party',1,'2015','武士道','popping.jpg'); -- ThemeSong Insert into ThemeSong(SgName,Author,Composer,Singer,Type,AnimeID) VALUES('oath Sign','渡邊翔','渡邊翔','LiSA',0,1); Insert into ThemeSong(SgName,Author,Composer,Singer,Type,AnimeID) VALUES('MEMORIA','藍井艾露、安田史生','安田史生','藍井艾露',1,1); Insert into ThemeSong(SgName,Author,Composer,Singer,Type,AnimeID) VALUES('to the beginning','梶浦由記','梶浦由記','Kalafina',0,1); Insert into ThemeSong(SgName,Author,Composer,Singer,Type,AnimeID) VALUES('空は高く風は歌う','梶浦由記','梶浦由記','春奈露娜',1,1); Insert into ThemeSong(SgName,Author,Composer,Singer,Type,AnimeID) VALUES('満天','梶浦由記','梶浦由記','Kalafina',1,1); Insert into ThemeSong(SgName,Author,Composer,Singer,Type,AnimeID) VALUES('Hacking to the Gate','志倉千代丸','志倉千代丸','伊藤香奈子',0,2); Insert into ThemeSong(SgName,Author,Composer,Singer,Type,AnimeID) VALUES('刻司ル十二ノ盟約','志倉千代丸','林達志','榊原由依',1,2); Insert into ThemeSong(SgName,Author,Composer,Singer,Type,AnimeID) VALUES('スカイクラッドの観測者','志倉千代丸','志倉千代丸','伊藤香奈子',1,2); Insert into ThemeSong(SgName,Author,Composer,Singer,Type,AnimeID) VALUES('Another Heaven','漆野淳哉','須田悅弘','伊藤香奈子',1,2); Insert into ThemeSong(SgName,Author,Composer,Singer,Type,AnimeID) VALUES('gravityWall','澤野弘之、Tielle','澤野弘之','Tielle & Gemie',0,3); Insert into ThemeSong(SgName,Author,Composer,Singer,Type,AnimeID) VALUES('shØut','澤野弘之、Tielle','澤野弘之','Tielle & Gemie',0,3); Insert into ThemeSong(SgName,Author,Composer,Singer,Type,AnimeID) VALUES('NEWLOOK','中野領太','中野領太','綾野真白',1,3); Insert into ThemeSong(SgName,Author,Composer,Singer,Type,AnimeID) VALUES('world Étude','柊','柊','豐崎愛生',1,3); Insert into ThemeSong(SgName,Author,Composer,Singer,Type,AnimeID) VALUES('ルビコン','aokado','aokado','三月のパンタシア',1,3); Insert into ThemeSong(SgName,Author,Composer,Singer,Type,AnimeID) VALUES('Redo','ミズノゲンキ','宮崎誠','鈴木木乃美',0,4); Insert into ThemeSong(SgName,Author,Composer,Singer,Type,AnimeID) VALUES('Paradisus-Paradoxum','MYTH & ROID','MYTH & ROID','MYTH & ROID',0,4); Insert into ThemeSong(SgName,Author,Composer,Singer,Type,AnimeID) VALUES('STYX HELIX','MYTH & ROID','MYTH & ROID','MYTH & ROID',1,4); Insert into ThemeSong(SgName,Author,Composer,Singer,Type,AnimeID) VALUES('Stay Alive','Heart\'s Cry','Heart\'s Cry','高橋李依',1,4); Insert into ThemeSong(SgName,Author,Composer,Singer,Type,AnimeID) VALUES('PSI-missing','川田真美','中澤伴行','川田真美',0,5); Insert into ThemeSong(SgName,Author,Composer,Singer,Type,AnimeID) VALUES('masterpiece','川田真美','井內舞子','川田真美',0,5); Insert into ThemeSong(SgName,Author,Composer,Singer,Type,AnimeID) VALUES('Rimless~無邊的世界~','IKU','IKU','IKU',1,5); Insert into ThemeSong(SgName,Author,Composer,Singer,Type,AnimeID) VALUES('誓い言〜スコシだけもう一度〜','IKU','IKU','IKU',1,5); Insert into ThemeSong(SgName,Author,Composer,Singer,Type,AnimeID) VALUES('光るなら','Goose house','Goose house','Goose house',0,6); Insert into ThemeSong(SgName,Author,Composer,Singer,Type,AnimeID) VALUES('crossing field','渡邊翔','渡邊翔','LiSA',0,7); Insert into ThemeSong(SgName,Author,Composer,Singer,Type,AnimeID) VALUES('INNOCENCE','藍井艾露','重永亮介','藍井艾露',0,7); Insert into ThemeSong(SgName,Author,Composer,Singer,Type,AnimeID) VALUES('IGNITE','小川智之','藍井艾露','藍井艾露',0,8); Insert into ThemeSong(SgName,Author,Composer,Singer,Type,AnimeID) VALUES('courage','Nori','古川貴浩','戶松遙',0,8); Insert into ThemeSong(SgName,Author,Composer,Singer,Type,AnimeID) VALUES('ユメセカイ','古屋真','古川貴浩','戶松遙',1,7); Insert into ThemeSong(SgName,Author,Composer,Singer,Type,AnimeID) VALUES('Startear','春奈露娜','Saku','春奈露娜',1,8); Insert into ThemeSong(SgName,Author,Composer,Singer,Type,AnimeID) VALUES('Overfly','Saku','Saku','春奈露娜',1,7); Insert into ThemeSong(SgName,Author,Composer,Singer,Type,AnimeID) VALUES('キズナミュージック','中村航','藤永龍太郎','Poppin‘Party',0,9); Insert into ThemeSong(SgName,Author,Composer,Singer,Type,AnimeID) VALUES('BRAVE JEWEL','織田あすか','上松範康','Roselia',0,9);
true
37400805f69d24b8b3f9250f3d3481550ec0313b
SQL
jobchoi/study_dbms
/Test_0826.sql
UHC
4,571
4.53125
5
[]
no_license
1. ְ()޿, ޿Ѿ, ձ޿ ȸ. ձ޿ ݿøϿ ǥ select MAX(salary), min(salary), round(avg(salary),0) from employees; 2. ְ޿, ޿ ޿ 󸶳 Ǵ ľϰ Ѵ. ְ޿ ޿ ȸϽÿ 3. ľϰ Ѵ. ȸϽÿ. select distinct m.manager_id, e.employee_id from employees e, employees m where m.manager_id = e.employee_id(+); 4. μڵ 20,40,50 μ ϴ  ִ ľϰ Ѵ. μڵ 20,40,50 μ鿡 ڵ ȸ select distinct job_id from employees where department_id in (20,40,50); 5. ڵ, ȸ select job_id, count(employee_id) mem from employees group by job_id order by -1; 6. μ ձ޿ ȸ μڵ, μձ޿ ȸϵ μձ׺ μ Ͻÿ μձ޿ ݿøϿ ҼѤڸ ǥϽÿ select department_id,round(avg(salary),2)as avg_sal from employees group by department_id order by round(avg(salary),2) asc; 7. μ, , ޿Ѿ ȸϽÿ. select distinct department_id, job_id, sum(salary) from employees group by department_id, job_id order by 1; 8.μڵ 50 select count(employee_id )cnt from employees where department_id=50; 9. μ޿ 10000̻ μڵ, μձ޿ ȸ μձ޿ ݿøϿ Ҽ °ڸ ǥϽÿ. select round(avg(salary),2) as avg_sal, department_id from employees group by department_id having round(avg(salary),2) >= 10000 ; 10. μ ִ޿ 10000λ μ ľϰ Ѵ. μ ִ޿ 10000 ̻ μڵ, μִ޿ ȸϽÿ. select max(salary) as max_sal, department_id from employees group by department_id having max(salary) >= 10000; -- =================== join =================== 1. , μڵ, μ ȸϽÿ. select e.last_name||' '||first_name name, e.department_id, d.department_name from employees e inner join departments d on e.department_id=d.department_id(+); 2. king , μڵ, μ ȸϽÿ select last_name||' '||first_name, employee_id, e.department_id, department_name from departments d,employees e where e.department_id=d.department_id(+) and lower(last_name)='king'; 3. 149 , , μڵ, μ ȸ -- ?? select manager_id, e.employee_id, last_name, e.department_id, department_name from employees e left outer join departments d where e.manager_id=149; 4. , , ȸ select e.employee_id, e.last_name, e.manager_id, m.employee_id, m.last_name manager_name from employees e , employees m where e.employee_id=m.employee_id(+) order by 1; 5. ġڵ 1400 ÿ  μ ִ ľϰ Ѵ. ġڵ 1400 ø, μ ȸϽÿ 6. ġڵ 1800 ٹϴ , ڵ,޿, μ, ġڵ带 ȸϽÿ 7. ҹ ϰ a Ե , , μ ȸϽÿ 8. ں Ի , Ի, , Իڸ ȸϽÿ 9. Ŀ̼ ޴ , μ, ġڵ, ø ȸϽÿ 10. toronto ٹϴ , μ, ڵ, μڵ, μ ȸϽÿ 11. ٹϴ μ ش μ ٹϴ ľϰ Ѵ ٹϴ μ μڵ,μ, ġڵ, ȸϽÿ 12. 3 ̸ μ ľϰѴ. 3 ̸ μڵ, μ, ȸϽÿ 13. Administration, Excutiveμ  ְ ش ϴ ľϰ Ѵ. Administration, Excutiveμ ڵ, ȸϿ Ͻÿ
true
0d7d49b6302e2832a4a9ca9b670ae778f5345e05
SQL
alifahfathonah/Bimbingan-Belajar-Online
/database/app_users.sql
UTF-8
1,847
3.0625
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
-- phpMyAdmin SQL Dump -- version 4.8.5 -- https://www.phpmyadmin.net/ -- -- Host: localhost:3306 -- Generation Time: Oct 16, 2019 at 09:43 PM -- Server version: 5.7.27-log -- PHP Version: 7.2.7 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: `appsbili_igni473` -- -- -------------------------------------------------------- -- -- Table structure for table `app_users` -- CREATE TABLE `app_users` ( `userid` varchar(10) NOT NULL, `username` varchar(30) NOT NULL, `password` varchar(250) NOT NULL, `tb_pengguna_penggunaid` varchar(7) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `app_users` -- INSERT INTO `app_users` (`userid`, `username`, `password`, `tb_pengguna_penggunaid`) VALUES ('u1', 'Rian', 'cb2b28afc2cc836b33eb7ed86f99e65a', '002'), ('u2', 'Andi', 'ce0e5bf55e4f71749eade7a8b95c4e46', '001'), ('u3', 'suadmin', '02764b025f2d7f90b8d7bc51c6904d2a', '005'), ('u4', 'Winda', 'aed2aec41bfd7ddb55b21f3ce206c66b', '003'); -- -- Indexes for dumped tables -- -- -- Indexes for table `app_users` -- ALTER TABLE `app_users` ADD PRIMARY KEY (`userid`), ADD KEY `IDCABANG` (`tb_pengguna_penggunaid`); -- -- Constraints for dumped tables -- -- -- Constraints for table `app_users` -- ALTER TABLE `app_users` ADD CONSTRAINT `app_users_ibfk_1` FOREIGN KEY (`tb_pengguna_penggunaid`) REFERENCES `tb_pengguna` (`penggunaId`); 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
959a6433f84ee0938bfee3192ee241482fb40a5f
SQL
mvm-sp/API_Scallo
/rest/sql/procedimentos_WhatsOUT.sql
UTF-8
361
3.265625
3
[]
no_license
SELECT row_to_json(x) AS procedimentos FROM (SELECT PRD."IdProcedimento" AS Id, PRD."NmApelido" AS Nome, CFG."VlConfiguracao" AS orientacoes_e_preparo FROM "T0000_Configuracao" CFG INNER JOIN "T0199_Procedimento" PRD ON CFG."IdRegistro" = PRD."IdProcedimento" AND PRD."IdProcedimento" = '__procedimento' AND cfg."IdEntidadeNegocio" = '0199019') x
true
09c592391bf96d6b06818b48196ac8ed0fddfdb8
SQL
rbrandon87/DBST663_GroupProject
/Deliverable Folders/DB/DB_2_Data.sql
WINDOWS-1250
964
2.671875
3
[]
no_license
---Enter the following DML statement on Hospital_DB_1 to insert data into Hospital_DB_2. INSERT INTO Patients@Linker_1_2 (Patient_ID,First_Name,Last_Name,DOB,Phone_Num,Gender,Address,Zip_Code,Database_Name) VALUES ('5', 'Bob', 'Lee', '2001-8-12', '698399', 'M', 'Street 14', '42','hospital_db_2'); INSERT INTO Patients@Linker_1_2 (Patient_ID,First_Name,Last_Name,DOB,Phone_Num,Gender,Address,Zip_Code,Database_Name) VALUES ('6', 'Dawane', 'Bravo', '1990-9-16', '359086', 'M', '19 A city', '65','hospital_db_2'); INSERT INTO Patients@Linker_1_2 (Patient_ID,First_Name,Last_Name,DOB,Phone_Num,Gender,Address,Zip_Code,Database_Name) VALUES ('7', 'Andrew, Stall', '1998-12-5', '342508', 'M', '52 belon', '776','hospital_db_2'); INSERT INTO Patients@Linker_1_2 (Patient_ID,First_Name,Last_Name,DOB,Phone_Num,Gender,Address,Zip_Code,Database_Name) VALUES ('8', 'Stella', 'Queen', '1992-7-14', '566376', 'F', 'Wagha 4', '645','hospital_db_2');
true
7a7bc30a8f17d0f1c19b3c55cece856442026e33
SQL
haruu19/DBStudy
/day01/select문 예제.sql
UTF-8
3,673
4.6875
5
[]
no_license
-- 1) emp 테이블 정보를 확인하세요. desc emp; -- 2-1) 이름이 K로 시작하는 사원의 사원번호, 이름, 입사일, 급여를 검색 select empno, ename, hiredate, sal from emp where ename like "K%"; -- 2-2) 이름이 K로 시작하는 사원 중 이름이 3자인 사원의 사원번호, 이름, 입사일, 급여를 검색 select empno, ename, hiredate, sal from emp where ename like "K__"; -- 2-3) 이름의 두번 째 글자가 M select empno, ename, hiredate, sal from emp where ename like "_M_"; -- 3) 입사일이 1981년도인 사람의 모든 정보 검색 select empno, ename, HIREDATE, year(HIREDATE), extract(year from hiredate), date_format(hiredate,'%Y') from emp where year(HIREDATE) = 1981; -- 3-2) 입사월 5월 정보검색 select * from emp where month(HIREDATE) = 5 or extract(month from HIREDATE) =5 or date_format(HIREDATE,'%M') = 5; -- 4) 커미션이 NULL이 아닌 사람의 모든 정보를 검색하세요 select * from emp where comm is not null; -- 타이핑 규칙 select * from emp where comm is not null; -- null 의 의미 -- null 과의 비교 연산은 무조건 false 반환 -- null 과의 산술 연산은 무조건 null -- null + 100 -> null -- null * 100 -> null -- where null > 100; false; -- where null > null; false; -- where null = null; false; -- 5) 부서가 30번 부서이고 급여가 $1,500 이상인 사람의 이름, 부서, 월급 검색 select ename, deptno, sal from emp where deptno=30 and sal>=1500; -- 6) 부서번호가 30인 사람 중 사원번호 sort하라 select * from emp where deptno=30 order by empno; select * from emp where deptno in (20,30) order by deptno asc, sal desc; -- 1 2 3 4 select empno, ename, sal, deptno from emp where deptno in (20,30) order by 4 asc, 3 desc, 2; -- 거의 사용 x -- 10) emp Table 에서 이름, 급여, 커미션 금액, 총액(급여+커미션금액) 구하여 -- 총액 많은 순서로 검색. 단, 커미션 null 인 사람 제외(커미션금액: sal*comm/100) select ename, sal, sal*comm / 100 as comm, (sal + sal*comm/100) as total from emp where comm is not null order by total desc; -- 11) 10번 부서의 모든 사람들에게 급여의 13%를 보너스로 지불하기로 하였다. -- 이름, 급여, 보너스 금액, 부서번호 검색 select ename, sal, sal * 0.13 as bonus, deptno from emp where deptno = 10; -- 12) 부서번호 20인 사원의 시간당 임금을 계산하여 검색 단, 1달의 근무일수는 12일이고, 1일 근무시간은 5시간이다. 출력양식은 이름, 급여, 시간당 임금을 검색하세요. select ename, sal, (sal/60) as timesal from emp where deptno=20; -- 13) 급여가 $1,500 부터 $3,000 사이의 사람은 급여의 15%를 회비로 지불하기로 하였다. -- 이를 이름, 급여, 회비(소수점 두자리아래에서 반올림) 를 검색하세요. -- 반올림 : round(), round ( , ) -- 뒤 인자에 양수 주면 소수점, 음수는 정수부분 select ename, sal, round(sal*0.15 , 2) as pay from emp where sal between 1500 and 3000; -- 14) 입사일로부터 오늘까지의 일수를 구하여 이름, 입사일, 근무일수를 검색 -- datediff(날짜1, 날짜2) : 두 날짜간의 일수 구하는 함수 select curdate(), curtime(), now(), datediff('2001-01-01','2000-01-01'); select ename, hiredate, datediff(curdate(),hiredate) as'근무일수', timestampdiff(day, hiredate, curdate()) as 근무일수2, timestampdiff(month, hiredate, curdate()) as 근무월수, timestampdiff(year, hiredate, curdate()) as 근무년수 from emp;
true
3748595ef159357bf3bcda92bf95b4f60e39cac2
SQL
dengyouquan/JavaTest4
/docker/mysql/privileges.sql
UTF-8
400
2.875
3
[]
no_license
use mysql; select host, user from user; -- 因为mysql版本是5.7,因此新建用户为如下命令: create user admin identified by '123456'; -- 将docker_mysql数据库的权限授权给创建的docker用户,密码为123456: grant all on *.* to admin@'localhost' identified by '123456' with grant option; -- 这一条命令一定要有: flush privileges; select host, user from user;
true
ee248ca5c21093b1975336a3ec96de55dc9807cf
SQL
nikki4944/Hewlett_Packard_Analysis
/Queries/Employee_Database_challenge.sql
UTF-8
1,104
4.34375
4
[]
no_license
Select e.emp_no, e.first_name, e.last_name, t.title, t.from_date, t.to_date into retirement_titles from employees as e left join titles as t on e.emp_no=t.emp_no where (e.birth_date between '1952-01-01' AND '1955-12-31') order by e.emp_no; select * from retirement_titles; -- Use Dictinct with Orderby to remove duplicate rows SELECT DISTINCT ON (emp_no) emp_no, first_name, last_name, title INTO unique_titles FROM retirement_titles ORDER BY emp_no, to_date DESC; select* from unique_titles; --Create a table with count of retiring employees by title Select count(ut.emp_no), ut.title into retiring_titles from unique_titles as ut group by ut.title order by count(ut.emp_no) desc; --Create a table for mentorship Select distinct on (e.emp_no) e.emp_no, e.first_name, e.last_name, e.birth_date, de.from_date, de.to_date, t.title into mentorship_eligibilty from employees as e left join dept_employees as de on (e.emp_no=de.emp_no) left join titles as t on (e.emp_no=t.emp_no) where (de.to_date= '9999-01-01') and (e.birth_date between '1965-01-01' AND '1965-12-31') order by e.emp_no;
true
d32ad13db29103755806ef6b2c754f20cc85ad0f
SQL
steven-maasch/bachelor-thesis-code
/docs/db/query.sql
UTF-8
2,906
3.34375
3
[]
no_license
# Erstellung der View released_beacon CREATE VIEW p5809_5648.released_beacon AS SELECT b.fs_id, b.beacon_id, b.uuid, b.major, b.minor FROM p5809_5648.beacon b WHERE b.fs_release_to = 9223372036854775807; # Erstellung der View released_facility CREATE VIEW p2761_2742.released_facility AS SELECT facility.fs_id, facility.firm_name, facility.firm_name2, facility.street, facility.postal_code, facility.city FROM p2761_2742.facility WHERE facility.fs_release_to = 9223372036854775807; # Erstellung der View released_beacon_position CREATE VIEW p5809_5648.released_beacon_position AS SELECT p.fs_id, p.name ,p.beac_fs_id3, p.faci_fs_id1 FROM p5809_5648.beacon_position p WHERE p.fs_release_to = 9223372036854775807; # Erstellung der View released_content CREATE VIEW p2761_2742.released_content AS SELECT content.fs_id, content.page_reference, content.app_message, content.show_after_visits FROM p2761_2742.content WHERE content.fs_release_to = 9223372036854775807; # Erstellung der View released_keywords CREATE VIEW p5809_5648.released_keyword AS SELECT kw.fs_id, kw.name FROM p5809_5648.keyword kw WHERE kw.fs_release_to = 9223372036854775807; # Erstellung der View released_rt_beacon_position_content_beacon_positionlist CREATE VIEW p2761_2742.released_rt_beacon_position_content_beacon_positionlist AS SELECT b.beac_fs_id, b.cont_fs_id FROM p2761_2742.rt_beacon_position_content_beacon_positionlist b WHERE b.fs_release_to = 9223372036854775807; # Erstellung der View released_rt_content_keyword_keywordlist CREATE VIEW p2761_2742.released_rt_content_keyword_keywordlist AS SELECT rt.cont_fs_id, rt.keyw_fs_id FROM p2761_2742.rt_content_keyword_keywordlist rt WHERE rt.fs_release_to = 9223372036854775807; # Erstellung der View released_config CREATE VIEW p2761_2742.released_config AS SELECT conf.property, conf.value_ FROM p5809_5648.config conf WHERE conf.fs_release_to = 9223372036854775807; # ------------------------------------------------------ # ------------ Abfragen der Schnittstelle -------------- # ------------------------------------------------------ # Abfrage einer BeaconPosition über UUID, Major und Minor SELECT bp.fs_id FROM p5809_5648.released_beacon_position bp WHERE bp.beac_fs_id3 = ( SELECT b.fs_id FROM p5809_5648.released_beacon b WHERE b.uuid = 'f7826da6-4fa2-4e98-8024-bc5b71e0893e' AND b.major = 9530 AND b.minor = 26824 ); # Abfrage von Content über id SELECT c.fs_id, c.relative_url, c.last_modification, c.show_after_visits FROM p5809_5648.released_content c JOIN p5809_5648.released_rt_beacon_position_content_beacon_positionlist bpl ON c.fs_id = bpl.cont_fs_id WHERE bpl.beac_fs_id = 257; # JOIN-Abfrage der Tabellen released_content und released_keyword SELECT kw.name, kwl.cont_fs_id FROM p5809_5648.released_keyword kw JOIN p5809_5648.released_rt_content_keyword_keywordlist kwl ON kw.fs_id = kwl.keyw_fs_id;
true
b0538e5ab34da5524e091c0c536a8160fa6a5356
SQL
geiner/TiendAndreeDS
/src/main/resources/scripts/compras.sql
UTF-8
812
3.078125
3
[]
no_license
CREATE TABLE proveedor ( codigo INTEGER NOT NULL , nombre VARCHAR2 (100) , direccion VARCHAR2 (100) , telefono INTEGER , email varchar2(100), descripcion varchar2(100), CONSTRAINT proveedor_pk PRIMARY KEY (codigo) ); CREATE SEQUENCE proveedor_seq MINVALUE 400 MAXVALUE 999999999999999999999999999 START WITH 400 INCREMENT BY 1 CACHE 20; CREATE TABLE registro_compra ( codigo INTEGER NOT NULL , cod_producto INTEGER, cod_nombre_proveedor INTEGER , ruc INTEGER , cantidad INTEGER , fecha VARCHAR2 (10) , monto NUMBER, CONSTRAINT registro_compra_pk PRIMARY KEY (codigo) ); CREATE SEQUENCE registro_compra_seq MINVALUE 10000 MAXVALUE 999999999999999999999999999 START WITH 10000 INCREMENT BY 1 CACHE 20;
true
0e6969c4fae4da8672d2327063c3430f6b958841
SQL
Kismawati07/Input1
/input/formulir1.sql
UTF-8
1,195
2.546875
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 2.10.1 -- http://www.phpmyadmin.net -- -- Host: localhost -- Waktu pembuatan: 12. Juli 2017 jam 15:54 -- Versi Server: 5.0.41 -- Versi PHP: 5.2.3 SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; -- -- Database: `db_input1` -- -- -------------------------------------------------------- -- -- Struktur dari tabel `formulir1` -- CREATE TABLE `formulir1` ( `Nama` varchar(25) NOT NULL, `Alamat` varchar(40) NOT NULL, `Kota` varchar(20) NOT NULL, `Provinsi` varchar(25) NOT NULL, `Email` varchar(25) NOT NULL, `Komentar` longtext NOT NULL, `IMG` varchar(25) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data untuk tabel `formulir1` -- INSERT INTO `formulir1` (`Nama`, `Alamat`, `Kota`, `Provinsi`, `Email`, `Komentar`, `IMG`) VALUES ('KISMAWATI', 'MAGELUNG', '', '', 'kismawati07@gmail.com', ' good', 'umbul.jpg'), ('NINA YULISTIA KARINA', 'DS. JENARSARI RT 02 RW 04', '', '', 'ninayulistiakarina20@gmai', ' dilligent', ''), ('SITI FADHILAH', 'brangsong', '', '', 'dedhexs@yahoo.com', ' baik', 'umbul...11.jpg'), ('NINA YULISTIA KARINA', 'DS. JENARSARI RT 02 RW 04', '', '', 'Ninayulistiakarina20@gmai', ' pretty', ''), ('NINA YULISTIA KARINA', 'DS. JENARSARI RT 02 RW 04', '', '', 'agninsanlistia20@gmail.co', ' pretty', '');
true
dcf4d7d43035e51dace921fae0caf2f2ee2ce17e
SQL
OITDatabaseGithub/LabQueries
/Lab1/Scripts/Question1.sql
UTF-8
213
3.15625
3
[]
no_license
select year, month, round( avg( arrdelayminutes )::numeric, 2 ) as avg_arrive_delay from airline.on_time_performance where year = 2005 OR year = 2006 group by year, month order by avg_arrive_delay desc limit 5
true
10e89a2f325cd1a0cb71fcdc037d20718c0a82e7
SQL
m000/hotcrp
/Code/updateschema.sql
UTF-8
3,781
3.484375
3
[ "LicenseRef-scancode-warranty-disclaimer", "MIT", "BSD-3-Clause" ]
permissive
-- This file contains the SQL statements required to update from one version -- of HotCRP to the next. -- -- HotCRP updates are designed so that new code can run transparently with an -- old database. This lets you easily fix bugs in old features. However, if -- you want to enable a new feature, you will need to update your current -- database schema. This file tells you how. -- -- Updates are cumulative, so apply them in order. -- -- If you're not sure which update to apply, run the following query: select value from Settings where name='allowPaperOption'; -- UPDATE FROM VERSION 2.3 TO VERSION 2.4 -- Apply if `allowPaperOption <= 3`. alter table ContactInfo add `creationTime` int(11) NOT NULL default '0'; update Settings set value=4 where name='allowPaperOption'; -- UPDATE FROM VERSION 2.4 TO VERSION 2.5 -- Apply if `allowPaperOption <= 4`. CREATE TABLE `ContactAddress` ( `contactId` int(11) NOT NULL, `addressLine1` varchar(2048) NOT NULL, `addressLine2` varchar(2048) NOT NULL, `city` varchar(2048) NOT NULL, `state` varchar(2048) NOT NULL, `zipCode` varchar(2048) NOT NULL, `country` varchar(2048) NOT NULL, UNIQUE KEY `contactId` (`contactId`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; update Settings set value=5 where name='allowPaperOption'; -- UPDATE FROM VERSION 2.5 TO VERSION 2.6 -- No update necessary. -- UPDATE FROM VERSION 2.6 TO VERSION 2.7 -- Apply if `allowPaperOption <= 5`. alter table ContactInfo add `defaultWatch` tinyint(1) NOT NULL default '2'; alter table ContactInfo add `roles` tinyint(1) NOT NULL default '0'; update ContactInfo, PCMember set roles=roles+1 where ContactInfo.contactId=PCMember.contactId; update ContactInfo, ChairAssistant set roles=roles+2 where ContactInfo.contactId=ChairAssistant.contactId; update ContactInfo, Chair set roles=roles+4 where ContactInfo.contactId=Chair.contactId; alter table ContactInfo add unique key `contactIdRoles` (`contactId`,`roles`); alter table PaperComment add key `contactPaper` (`contactId`,`paperId`); create table `PaperWatch` ( `paperId` int(11) NOT NULL, `contactId` int(11) NOT NULL, `watch` tinyint(1) NOT NULL default '0', UNIQUE KEY `contactPaper` (`contactId`,`paperId`), UNIQUE KEY `contactPaperWatch` (`contactId`,`paperId`,`watch`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; update Settings set value=6 where name='allowPaperOption'; -- UPDATE FROM VERSIONS 2.7-2.11 TO VERSION 2.12 -- Apply if `allowPaperOption <= 6`. alter table ReviewRequest add `reason` text; update Settings set value=7 where name='allowPaperOption'; -- UPDATE FROM VERSION 2.12 TO VERSION 2.13 -- Apply if `allowPaperOption <= 7`. alter table PaperReview add `textField7` mediumtext NOT NULL; alter table PaperReview add `textField8` mediumtext NOT NULL; insert into ReviewFormField set fieldName='textField7', shortName='Additional text field'; insert into ReviewFormField set fieldName='textField8', shortName='Additional text field'; update Settings set value=8 where name='allowPaperOption'; -- UPDATE FROM VERSION 2.13 -- Apply if `allowPaperOption <= 8`. alter table ReviewFormField add `levelChar` tinyint(1) NOT NULL default '0'; alter table PaperReviewArchive add `textField7` mediumtext NOT NULL; alter table PaperReviewArchive add `textField8` mediumtext NOT NULL; alter table Paper add `sha1` varbinary(20) NOT NULL default ''; update Settings set value=10 where name='allowPaperOption'; insert into Settings (name, value) values ('sub_sha1', 1); alter table PaperReview add `reviewRound` tinyint(1) NOT NULL default '0'; alter table PaperReview add key `reviewRound` (`reviewRound`); update Settings set value=11 where name='allowPaperOption'; -- VERSION 2.17 AND LATER -- These versions upgrade the schema automatically. See updateschema.inc.
true
daf9c5b091f6bf7cfa0508cc7bbaccc6e0d9690b
SQL
CUBRID/cubrid-testcases
/sql/_12_mysql_compatibility/_11_code_coverage/_01_operators/_04_other_operators/cases/_001_nullsafe_op.sql
UTF-8
1,082
3.359375
3
[ "BSD-3-Clause" ]
permissive
CREATE TABLE tbl (c_int int, c_str varchar(10)); INSERT INTO tbl VALUES (1, NULL); INSERT INTO tbl VALUES (NULL, '1'); SELECT * from tbl where c_int <=> 1; SELECT * from tbl where c_int <=> '1'; SELECT * from tbl where c_int <=> NULL; SELECT * from tbl where 1 <=> c_int; SELECT * from tbl where '1' <=> c_int; SELECT * from tbl where NULL <=> c_int; SELECT * from tbl where c_str <=> 1; SELECT * from tbl where c_str <=> '1'; SELECT * from tbl where c_str <=> NULL; SELECT * from tbl where 1 <=> c_str; SELECT * from tbl where '1' <=> c_str; SELECT * from tbl where NULL <=> c_str; SELECT * from tbl where c_int = 1; SELECT * from tbl where c_int = '1'; SELECT * from tbl where c_int = NULL; SELECT * from tbl where 1 = c_int; SELECT * from tbl where '1' = c_int; SELECT * from tbl where NULL = c_int; SELECT * from tbl where c_str = 1; SELECT * from tbl where c_str = '1'; SELECT * from tbl where c_str = NULL; SELECT * from tbl where 1 = c_str; SELECT * from tbl where '1' = c_str; SELECT * from tbl where NULL = c_str; SELECT * from tbl where NULL <=> 1; DROP TABLE tbl;
true
61f48ffb72a4ad72e8b5267c3244233329b7e76a
SQL
tomsi113/chrenka-maturita
/complete-blog-php (1).sql
UTF-8
6,014
3.125
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 4.8.3 -- https://www.phpmyadmin.net/ -- -- Hostiteľ: 127.0.0.1 -- Čas generovania: Ne 16.Dec 2018, 17:55 -- Verzia serveru: 10.1.36-MariaDB -- Verzia PHP: 7.2.11 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET AUTOCOMMIT = 0; START TRANSACTION; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8mb4 */; -- -- Databáza: `complete-blog-php` -- -- -------------------------------------------------------- -- -- Štruktúra tabuľky pre tabuľku `posts` -- CREATE TABLE `posts` ( `id` int(11) NOT NULL, `user_id` int(11) DEFAULT NULL, `title` varchar(255) NOT NULL, `slug` varchar(255) NOT NULL, `views` int(11) NOT NULL DEFAULT '0', `image` varchar(255) NOT NULL, `body` text NOT NULL, `published` tinyint(1) NOT NULL, `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Sťahujem dáta pre tabuľku `posts` -- INSERT INTO `posts` (`id`, `user_id`, `title`, `slug`, `views`, `image`, `body`, `published`, `created_at`, `updated_at`) VALUES (12, 1, 'ddddd', 'ddddd', 0, 'sushobhan-badhai-372964-unsplash.jpg', '&lt;p&gt;dsdsdsds&lt;/p&gt;\r\n', 0, '2018-12-16 13:20:44', '2018-12-16 13:20:44'), (13, 1, 'dsdsdsdsdsd', 'dsdsdsdsdsd', 0, 'sushobhan-badhai-372964-unsplash.jpg', '&lt;p&gt;dsdsdsdsd&lt;/p&gt;\r\n', 0, '2018-12-16 13:26:49', '2018-12-16 13:26:49'), (14, 1, 'ahoj', 'ahoj', 0, 'sushobhan-badhai-372964-unsplash.jpg', '&lt;p&gt;dd&lt;/p&gt;\r\n\r\n&lt;p&gt;&amp;nbsp;&lt;/p&gt;\r\n', 0, '2018-12-16 13:27:15', '2018-12-16 13:27:15'), (17, 1, 'd', 'd', 0, 'sushobhan-badhai-372964-unsplash.jpg', '&lt;p&gt;d&lt;/p&gt;\r\n', 1, '2018-12-16 13:46:59', '2018-12-16 13:46:59'); -- -------------------------------------------------------- -- -- Štruktúra tabuľky pre tabuľku `post_topic` -- CREATE TABLE `post_topic` ( `id` int(11) NOT NULL, `post_id` int(11) NOT NULL, `topic_id` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Sťahujem dáta pre tabuľku `post_topic` -- INSERT INTO `post_topic` (`id`, `post_id`, `topic_id`) VALUES (10, 12, 2), (11, 13, 2), (12, 14, 2), (15, 17, 2); -- -------------------------------------------------------- -- -- Štruktúra tabuľky pre tabuľku `topics` -- CREATE TABLE `topics` ( `id` int(11) NOT NULL, `name` varchar(255) NOT NULL, `slug` varchar(255) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Sťahujem dáta pre tabuľku `topics` -- INSERT INTO `topics` (`id`, `name`, `slug`) VALUES (2, 'hmmm', 'hmmm'), (3, 'hodina', 'hodina'), (4, 'jjjj', 'jjjj'); -- -------------------------------------------------------- -- -- Štruktúra tabuľky pre tabuľku `users` -- CREATE TABLE `users` ( `id` int(11) NOT NULL, `username` varchar(255) NOT NULL, `email` varchar(255) NOT NULL, `role` enum('Author','Admin') DEFAULT NULL, `password` varchar(255) NOT NULL, `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Sťahujem dáta pre tabuľku `users` -- INSERT INTO `users` (`id`, `username`, `email`, `role`, `password`, `created_at`, `updated_at`) VALUES (1, 'pilsner123', 'pilsner369@gmail.com', 'Admin', 'b00f9345fa45578581d5ad3066d8871c', '2018-11-26 20:36:32', '2018-11-26 20:36:32'), (2, 'chrenka', 'pilsner@gmail.com', NULL, 'b00f9345fa45578581d5ad3066d8871c', '2018-11-27 07:52:00', '2018-11-27 07:52:00'), (3, 'pilsner369', 'pilsner555@gmail.com', NULL, 'b00f9345fa45578581d5ad3066d8871c', '2018-11-28 16:59:49', '2018-11-28 16:59:49'), (4, 'pilsner555', 'pilsner444@gmail.com', 'Author', 'b00f9345fa45578581d5ad3066d8871c', '2018-11-28 17:00:53', '2018-11-28 17:00:53'), (5, 'stevo', 'sdsds@gmail.com', NULL, 'b00f9345fa45578581d5ad3066d8871c', '2018-12-09 12:53:32', '2018-12-09 12:53:32'), (6, 'pilsner', 'petra.skola@centrum.sk', 'Admin', 'b00f9345fa45578581d5ad3066d8871c', '2018-12-16 13:37:55', '2018-12-16 13:37:55'); -- -- Kľúče pre exportované tabuľky -- -- -- Indexy pre tabuľku `posts` -- ALTER TABLE `posts` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `slug` (`slug`), ADD KEY `user_id` (`user_id`); -- -- Indexy pre tabuľku `post_topic` -- ALTER TABLE `post_topic` ADD PRIMARY KEY (`id`), ADD KEY `post_id` (`post_id`), ADD KEY `topic_id` (`topic_id`); -- -- Indexy pre tabuľku `topics` -- ALTER TABLE `topics` ADD PRIMARY KEY (`id`); -- -- Indexy pre tabuľku `users` -- ALTER TABLE `users` ADD PRIMARY KEY (`id`); -- -- AUTO_INCREMENT pre exportované tabuľky -- -- -- AUTO_INCREMENT pre tabuľku `posts` -- ALTER TABLE `posts` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=18; -- -- AUTO_INCREMENT pre tabuľku `post_topic` -- ALTER TABLE `post_topic` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=16; -- -- AUTO_INCREMENT pre tabuľku `topics` -- ALTER TABLE `topics` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5; -- -- AUTO_INCREMENT pre tabuľku `users` -- ALTER TABLE `users` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7; -- -- Obmedzenie pre exportované tabuľky -- -- -- Obmedzenie pre tabuľku `posts` -- ALTER TABLE `posts` ADD CONSTRAINT `posts_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION; -- -- Obmedzenie pre tabuľku `post_topic` -- ALTER TABLE `post_topic` ADD CONSTRAINT `post_topic_ibfk_1` FOREIGN KEY (`post_id`) REFERENCES `posts` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, ADD CONSTRAINT `post_topic_ibfk_2` FOREIGN KEY (`topic_id`) REFERENCES `topics` (`id`) ON DELETE CASCADE ON UPDATE CASCADE; 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
cb329160460deb3f46837579a5fdf9f10e84aa1d
SQL
IlayG01/CS50_Solutions
/7.SQL/movies/9.sql
UTF-8
148
3.28125
3
[]
no_license
SELECT name FROM movies JOIN stars ON movies.id = stars.movie_id JOIN people ON stars.person_id = people.id WHERE movies.year = 2004 ORDER BY birth;
true
711ec6f7ef12fae383fbda11bfbd279bd78a0abb
SQL
tkmarsten/team8-tcss450-app
/SetupTestMessages.sql
UTF-8
9,027
3.28125
3
[]
no_license
--Remove all members from all chats DELETE FROM ChatMembers; --Remove all messages from all chats DELETE FROM Messages; --Remove all chats DELETE FROM Chats; --Remove the user test1 DELETE FROM Members WHERE Email='test1@test.edu'; --Add the User test1 (password is: Testtest1!) INSERT INTO Members(FirstName, LastName, Nickname, Email, Password, Salt) VALUES ('test1First', 'test1Last', 'test1', 'test1@test.edu', 'eedb7c6a84e9ab0f900d2a04681a97b129059e6b171031ce077e2cbf5febfdb8', '2603b3d7e3bf7b6c069b9e8d3bd4eee6d79a23c72f6142fd7ab54dc11a61fa88'); --Remove the user test2 DELETE FROM Members WHERE Email='test2@test.edu'; --Add the User test2 (password is: Testtest1!) INSERT INTO Members(FirstName, LastName, Nickname, Email, Password, Salt) VALUES ('test2First', 'test2Last', 'test2', 'test2@test.edu', 'eedb7c6a84e9ab0f900d2a04681a97b129059e6b171031ce077e2cbf5febfdb8', '2603b3d7e3bf7b6c069b9e8d3bd4eee6d79a23c72f6142fd7ab54dc11a61fa88'); --Remove the user test3 DELETE FROM Members WHERE Email='test3@test.edu'; --Add the User test3 (password is: Testtest1!) INSERT INTO Members(FirstName, LastName, Nickname, Email, Password, Salt) VALUES ('test3First', 'test3Last', 'test3', 'test3@test.edu', 'eedb7c6a84e9ab0f900d2a04681a97b129059e6b171031ce077e2cbf5febfdb8', '2603b3d7e3bf7b6c069b9e8d3bd4eee6d79a23c72f6142fd7ab54dc11a61fa88'); --Create Global Chat room, ChatId 1 INSERT INTO chats(chatid, name) VALUES (1, 'test2@test.edu and test3@test.edu private chat room') RETURNING *; --Add the three test users to Global Chat INSERT INTO ChatMembers(ChatId, MemberId) SELECT 1, Members.MemberId FROM Members WHERE Members.Email='test2@test.edu' OR Members.Email='test3@test.edu' -- WHERE Members.Email='test1@test.edu' -- OR Members.Email='test2@test.edu' -- OR Members.Email='test3@test.edu' RETURNING *; -- New stuff--------------------------------------------- --Create Global Chat room, ChatId 2 INSERT INTO chats(chatid, name) VALUES (2, 'test1@test.edu and test2@test.edu chat room') RETURNING *; --Add the users to chat INSERT INTO ChatMembers(ChatId, MemberId) SELECT 2, Members.MemberId FROM Members WHERE Members.Email='test1@test.edu' OR Members.Email='test2@test.edu' RETURNING *; --Create Global Chat room, ChatId 3 INSERT INTO chats(chatid, name) VALUES (3, 'test1@test.edu and test3@test.edu chat room') RETURNING *; --Add the users to chat INSERT INTO ChatMembers(ChatId, MemberId) SELECT 3, Members.MemberId FROM Members WHERE Members.Email='test1@test.edu' OR Members.Email='test3@test.edu' RETURNING *; -- --Create Global Chat room, ChatId 4 -- INSERT INTO -- chats(chatid, name) -- VALUES -- (4, 'test2@test.edu and test3@test.edu chat room') -- RETURNING *; -- --Add the users to chat -- INSERT INTO -- ChatMembers(ChatId, MemberId) -- SELECT 4, Members.MemberId -- FROM Members -- WHERE Members.Email='test2@test.edu' -- OR Members.Email='test3@test.edu' -- RETURNING *; --Add Multiple messages to create a conversation INSERT INTO Messages(ChatId, Message, MemberId) SELECT 2, 'Hello!', Members.MemberId FROM Members WHERE Members.Email='test2@test.edu' RETURNING *; --Add Multiple messages to create a conversation INSERT INTO Messages(ChatId, Message, MemberId) SELECT 3, 'Howdy!', Members.MemberId FROM Members WHERE Members.Email='test2@test.edu' RETURNING *; -- --Add Multiple messages to create a conversation -- INSERT INTO -- Messages(ChatId, Message, MemberId) -- SELECT -- 4, -- 'Whats up!', -- Members.MemberId -- FROM Members -- WHERE Members.Email='test3@test.edu' -- RETURNING *; -- ------------------------------------------------------- --Add Multiple messages to create a conversation INSERT INTO Messages(ChatId, Message, MemberId) SELECT 1, 'Hello Everyone!', Members.MemberId FROM Members WHERE Members.Email='test3@test.edu' RETURNING *; INSERT INTO Messages(ChatId, Message, MemberId) SELECT 1, 'hi', Members.MemberId FROM Members WHERE Members.Email='test2@test.edu' RETURNING *; INSERT INTO Messages(ChatId, Message, MemberId) SELECT 1, 'Hey Test1, how is it going?', Members.MemberId FROM Members WHERE Members.Email='test3@test.edu' RETURNING *; INSERT INTO Messages(ChatId, Message, MemberId) SELECT 1, 'Great, thanks for asking t3', Members.MemberId FROM Members WHERE Members.Email='test2@test.edu' RETURNING *; INSERT INTO Messages(ChatId, Message, MemberId) SELECT 1, 'Enough with the pleasantries', Members.MemberId FROM Members WHERE Members.Email='test3@test.edu' RETURNING *; INSERT INTO Messages(ChatId, Message, MemberId) SELECT 1, 'Lets get down to business', Members.MemberId FROM Members WHERE Members.Email='test2@test.edu' RETURNING *; INSERT INTO Messages(ChatId, Message, MemberId) SELECT 1, 'CHILL out t3 lol', Members.MemberId FROM Members WHERE Members.Email='test3@test.edu' RETURNING *; INSERT INTO Messages(ChatId, Message, MemberId) SELECT 1, 'OK ok. T2, what did you do since the last meeting?', Members.MemberId FROM Members WHERE Members.Email='test2@test.edu' RETURNING *; INSERT INTO Messages(ChatId, Message, MemberId) SELECT 1, 'Nothing.', Members.MemberId FROM Members WHERE Members.Email='test3@test.edu' RETURNING *; INSERT INTO Messages(ChatId, Message, MemberId) SELECT 1, 'Im completly blocked by t3', Members.MemberId FROM Members WHERE Members.Email='test2@test.edu' RETURNING *; INSERT INTO Messages(ChatId, Message, MemberId) SELECT 1, 'Get your act together and finish the messaging end points', Members.MemberId FROM Members WHERE Members.Email='test3@test.edu' RETURNING *; INSERT INTO Messages(ChatId, Message, MemberId) SELECT 1, 'Woah now. Im waiting on t1...', Members.MemberId FROM Members WHERE Members.Email='test2@test.edu' RETURNING *; INSERT INTO Messages(ChatId, Message, MemberId) SELECT 1, 'I had a mid-term. :-(', Members.MemberId FROM Members WHERE Members.Email='test3@test.edu' RETURNING *; INSERT INTO Messages(ChatId, Message, MemberId) SELECT 1, 'But lets keep this cordial please', Members.MemberId FROM Members WHERE Members.Email='test2@test.edu' RETURNING *; INSERT INTO Messages(ChatId, Message, MemberId) SELECT 1, 'So, t2, t3 is blocking you', Members.MemberId FROM Members WHERE Members.Email='test3@test.edu' RETURNING *; INSERT INTO Messages(ChatId, Message, MemberId) SELECT 1, '...and Im blocking t3', Members.MemberId FROM Members WHERE Members.Email='test2@test.edu' RETURNING *; INSERT INTO Messages(ChatId, Message, MemberId) SELECT 1, 'sounds like you get another day off.', Members.MemberId FROM Members WHERE Members.Email='test3@test.edu' RETURNING *; INSERT INTO Messages(ChatId, Message, MemberId) SELECT 1, 'Nope. Im just going to do all the work myself', Members.MemberId FROM Members WHERE Members.Email='test2@test.edu' RETURNING *; INSERT INTO Messages(ChatId, Message, MemberId) SELECT 1, 'No way am I going to fail because fo you two. ', Members.MemberId FROM Members WHERE Members.Email='test2@test.edu' RETURNING *; INSERT INTO Messages(ChatId, Message, MemberId) SELECT 1, 'Ok ok. No. Charles wont be happy with that.', Members.MemberId FROM Members WHERE Members.Email='test3@test.edu' RETURNING *; INSERT INTO Messages(ChatId, Message, MemberId) SELECT 1, 'My exam is over now. Ill get cracking on this thing', Members.MemberId FROM Members WHERE Members.Email='test2@test.edu' RETURNING *; INSERT INTO Messages(ChatId, Message, MemberId) SELECT 1, 'I can knoock it out tonight', Members.MemberId FROM Members WHERE Members.Email='test3@test.edu' RETURNING *; INSERT INTO Messages(ChatId, Message, MemberId) SELECT 1, 'If I get it by tmorrow AM', Members.MemberId FROM Members WHERE Members.Email='test2@test.edu' RETURNING *; INSERT INTO Messages(ChatId, Message, MemberId) SELECT 1, 'i can finish by the aftershock', Members.MemberId FROM Members WHERE Members.Email='test3@test.edu' RETURNING *; INSERT INTO Messages(ChatId, Message, MemberId) SELECT 1, 'aftershock', Members.MemberId FROM Members WHERE Members.Email='test2@test.edu' RETURNING *; INSERT INTO Messages(ChatId, Message, MemberId) SELECT 1, 'afternoon!!! stupid autocorrect', Members.MemberId FROM Members WHERE Members.Email='test3@test.edu' RETURNING *; INSERT INTO Messages(ChatId, Message, MemberId) SELECT 1, 'Sounds like a plan', Members.MemberId FROM Members WHERE Members.Email='test3@test.edu' RETURNING *; INSERT INTO Messages(ChatId, Message, MemberId) SELECT 1, 'lets do it', Members.MemberId FROM Members WHERE Members.Email='test2@test.edu' RETURNING *; INSERT INTO Messages(ChatId, Message, MemberId) SELECT 1, 'lets dooooooo it', Members.MemberId FROM Members WHERE Members.Email='test2@test.edu' RETURNING *; INSERT INTO Messages(ChatId, Message, MemberId) SELECT 1, '3 2 1 Break', Members.MemberId FROM Members WHERE Members.Email='test3@test.edu' RETURNING *; INSERT INTO Messages(ChatId, Message, MemberId) SELECT 1, 'l8r', Members.MemberId FROM Members WHERE Members.Email='test2@test.edu' RETURNING *;
true
839e6418ba7a3ef0aea8cb130e620be5072ec40a
SQL
fendaq/open-capacity-platform
/open-db-core/src/main/resources/db.sql
UTF-8
4,060
3.484375
3
[ "MIT" ]
permissive
create table sys_dept( dept_id VARCHAR2 (255) NOT NULL primary key, dept_name VARCHAR2 (255) NOT NULL, parent_dept_id VARCHAR2 (255), parent_dept_ids VARCHAR2 (255), sortstring VARCHAR2 (255), if_valid CHAR (1) , remark VARCHAR2 (255), operator varchar2(255), operator_time date , operator_id varchar2(255) ) ; --添加表备注 COMMENT ON TABLE sys_dept IS '部门表'; --添加列注释 COMMENT ON COLUMN sys_dept.dept_id IS '部门ID'; --添加列注释 COMMENT ON COLUMN sys_dept.dept_name IS '部门名称'; --添加列注释 COMMENT ON COLUMN sys_dept.parent_dept_id IS '父部门ID'; --添加列注释 COMMENT ON COLUMN sys_dept.parent_dept_ids IS '父部门IDS'; --添加列注释 COMMENT ON COLUMN sys_dept.sortstring IS '排序'; CREATE TABLE sys_user ( user_id VARCHAR (255) primary key, username VARCHAR2 (255), usercode varchar2(255) , password VARCHAR2 (255), salt VARCHAR2 (64), telephone varchar2(255), mail varchar2(255), dept_id varchar2(255) , status char(1) , remark varchar2(255) , operator varchar2(255) , operator_time date , operator_ip varchar2(255) ); --添加表备注 COMMENT ON TABLE sys_user IS '用户表'; --添加列注释 COMMENT ON COLUMN sys_user.usercode IS '账号'; --添加列注释 COMMENT ON COLUMN sys_user.username IS '姓名'; --添加列注释 COMMENT ON COLUMN sys_user.password IS '密码'; --添加列注释 COMMENT ON COLUMN sys_user.salt IS '盐'; CREATE TABLE sys_menu ( menu_id VARCHAR2 (255) NOT NULL primary key, menu_name VARCHAR2 (255) NOT NULL, resource_TYPE VARCHAR2 (32) NOT NULL, resource_url VARCHAR (128) NOT NULL, percode VARCHAR2 (128), parent_menu_id VARCHAR2 (255), parent_menu_ids VARCHAR2 (255), sortstring VARCHAR2 (255), status CHAR (1) ); --添加表备注 COMMENT ON TABLE sys_menu IS '权限表'; --添加列注释 COMMENT ON COLUMN sys_menu.menu_id IS '主键'; --添加列注释 COMMENT ON COLUMN sys_menu.menu_name IS '资源名称'; --添加列注释 COMMENT ON COLUMN sys_menu.resource_TYPE IS '资源类型:menu,button,'; --添加列注释 COMMENT ON COLUMN sys_menu.resource_url IS '访问url地址'; --添加列注释 COMMENT ON COLUMN sys_menu.percode IS '权限代码字符串'; --添加列注释 COMMENT ON COLUMN sys_menu.parent_menu_id IS '父结点id'; --添加列注释 COMMENT ON COLUMN sys_menu.sortstring IS '排序号'; --添加列注释 COMMENT ON COLUMN sys_menu.status IS '是否可用,1:可用,0不可用'; CREATE TABLE sys_role ( role_id VARCHAR2 (255) primary key, role_name VARCHAR2 (255), status CHAR (1) ); --添加表备注 COMMENT ON TABLE sys_role IS '角色表'; --添加列注释 COMMENT ON COLUMN sys_role.role_id IS '主键'; --添加列注释 COMMENT ON COLUMN sys_role.role_name IS '角色名称'; --添加列注释 COMMENT ON COLUMN sys_role.status IS '是否可用,1:可用,0不可用'; CREATE TABLE sys_role_permission ( id varchar(255) NOT NULL primary key , sys_role_id varchar(255) NOT NULL , sys_permission_id varchar(255) NOT NULL ) ; --添加表备注 COMMENT ON TABLE sys_role_permission IS '角色权限关系表'; --添加列注释 COMMENT ON COLUMN sys_role_permission.sys_role_id IS '角色id'; --添加列注释 COMMENT ON COLUMN sys_role_permission.sys_permission_id IS '权限id'; CREATE TABLE sys_user_role ( id varchar(255) NOT NULL primary key , sys_user_id varchar(255) NOT NULL, sys_role_id varchar(255) NOT NULL ) ; --添加表备注 COMMENT ON TABLE sys_user_role IS '用户角色关系表'; --添加列注释 COMMENT ON COLUMN sys_user_role.id IS '主键'; --添加列注释 COMMENT ON COLUMN sys_user_role.sys_user_id IS '用户id'; --添加列注释 COMMENT ON COLUMN sys_user_role.sys_role_id IS '角色id';
true
7932756681aa09e2768db9244dd08ad72e07502b
SQL
rnama22/amzorbit
/sqldm/dm_amzuser.sql
UTF-8
7,485
3.703125
4
[]
no_license
-- MySQL Workbench Forward Engineering SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS , UNIQUE_CHECKS=0; SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS , FOREIGN_KEY_CHECKS=0; SET @OLD_SQL_MODE=@@SQL_MODE , SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES'; -- ----------------------------------------------------- -- Schema amzorbit -- ----------------------------------------------------- -- ----------------------------------------------------- -- Schema amzorbit -- ----------------------------------------------------- CREATE SCHEMA IF NOT EXISTS `amzorbit` DEFAULT CHARACTER SET utf8 ; USE `amzorbit` ; -- ----------------------------------------------------- -- Table `amzorbit`.`subscription` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `amzorbit`.`subscription` ( `id` INT NOT NULL AUTO_INCREMENT, `plan_id` VARCHAR (45) NOT NULL, `plan_name` VARCHAR (45) NOT NULL, `tenant_id` VARCHAR (45) NOT NULL, `created_by` INT NULL, `create_dt` DATETIME NULL, `updated_by` INT NULL, `updated_dt` DATETIME NULL, PRIMARY KEY (`id`), UNIQUE INDEX `id_UNIQUE` (`id` ASC), UNIQUE INDEX `plan_id_UNIQUE` (`plan_id` ASC), UNIQUE INDEX `plan_name_UNIQUE` (`plan_name` ASC), UNIQUE INDEX `tenant_id_UNIQUE` (`tenant_id` ASC)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `amzorbit`.`user` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `amzorbit`.`user` ( `user_id` INT NOT NULL AUTO_INCREMENT, `first_name` VARCHAR (45) NOT NULL, `last_name` VARCHAR (45) NOT NULL, `email_id` VARCHAR (45) NOT NULL, `mobile_num` BIGINT (20) NULL, `tenant_id` INT NOT NULL, `create_dt` DATETIME NULL, `update_dt` DATETIME NULL, `created_by` INT NULL, `updated_by` INT NULL, `email_alert` TINYINT NULL, `sms_alert` TINYINT NULL, `alert_preference` VARCHAR (250) NULL, `email_validation` TINYINT NULL, `email_daily_digest` TINYINT NULL, `subscription_id` INT NOT NULL, PRIMARY KEY (`user_id`), UNIQUE INDEX `user_id_UNIQUE` (`user_id` ASC), INDEX `fk_user_subscription1_idx` (`subscription_id` ASC), CONSTRAINT `fk_user_subscription1` FOREIGN KEY (`subscription_id`) REFERENCES `amzorbit`.`subscription` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `amzorbit`.`tenant` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `amzorbit`.`tenant` ( `tenant_id` INT NOT NULL AUTO_INCREMENT, `tenant_name` VARCHAR (45) NULL, `create_dt` DATETIME NULL, `update_dt` DATETIME NULL, `created_by` INT NULL, `updated_by` INT NULL, PRIMARY KEY (`tenant_id`), UNIQUE INDEX `tenant_id_UNIQUE` (`tenant_id` ASC)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `amzorbit`.`account` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `amzorbit`.`account` ( `account_id` INT NOT NULL AUTO_INCREMENT, `user_name` VARCHAR (45) NOT NULL, `password` VARCHAR (500) NOT NULL, `create_dt` DATETIME NULL, `update_dt` DATETIME NULL, `created_by` INT NULL, `updated_by` INT NULL, `user_id` INT NOT NULL, `tenant_id` INT NOT NULL, PRIMARY KEY (`account_id`), UNIQUE INDEX `account_id_UNIQUE` (`account_id` ASC), UNIQUE INDEX `user_name_UNIQUE` (`user_name` ASC), INDEX `fk_account_user_idx` (`user_id` ASC), INDEX `fk_account_tenant1_idx` (`tenant_id` ASC), CONSTRAINT `fk_account_user` FOREIGN KEY (`user_id`) REFERENCES `amzorbit`.`user` (`user_id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_account_tenant1` FOREIGN KEY (`tenant_id`) REFERENCES `amzorbit`.`tenant` (`tenant_id`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `amzorbit`.`role` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `amzorbit`.`role` ( `role_id` INT NOT NULL AUTO_INCREMENT, `role` VARCHAR (45) NULL, `name` VARCHAR (45) NULL, `description` VARCHAR (100) NULL, `configurable` VARCHAR (45) NULL, `create_dt` DATETIME NULL, `update_dt` DATETIME NULL, `created_by` INT NULL, `updated_by` INT NULL, `tenant_id` INT NULL, PRIMARY KEY (`role_id`)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `amzorbit`.`account_role` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `amzorbit`.`account_role` ( `account_id` INT NOT NULL, `role_id` INT NOT NULL, PRIMARY KEY (`account_id`, `role_id`), INDEX `fk_account_has_role_role1_idx` (`role_id` ASC), INDEX `fk_account_has_role_account1_idx` (`account_id` ASC), CONSTRAINT `fk_account_has_role_account1` FOREIGN KEY (`account_id`) REFERENCES `amzorbit`.`account` (`account_id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_account_has_role_role1` FOREIGN KEY (`role_id`) REFERENCES `amzorbit`.`role` (`role_id`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `amzorbit`.`privilege` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `amzorbit`.`privilege` ( `privilege_id` INT NOT NULL AUTO_INCREMENT, `type` VARCHAR (45) NOT NULL, `description` VARCHAR (200) NULL, `tenant_id` INT NULL, `create_dt` DATETIME NULL, `update_dt` DATETIME NULL, `created_by` INT NULL, `updated_by` INT NULL, PRIMARY KEY (`privilege_id`), UNIQUE INDEX `privilege_id_UNIQUE` (`privilege_id` ASC)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `amzorbit`.`role_privilege` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `amzorbit`.`role_privilege` ( `role_id` INT NOT NULL, `privilege_id` INT NOT NULL, PRIMARY KEY (`role_id`, `privilege_id`), INDEX `fk_role_has_privilege_privilege1_idx` (`privilege_id` ASC), INDEX `fk_role_has_privilege_role1_idx` (`role_id` ASC), CONSTRAINT `fk_role_has_privilege_role1` FOREIGN KEY (`role_id`) REFERENCES `amzorbit`.`role` (`role_id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_role_has_privilege_privilege1` FOREIGN KEY (`privilege_id`) REFERENCES `amzorbit`.`privilege` (`privilege_id`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `amzorbit`.`payment` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `amzorbit`.`payment` ( `id` INT NOT NULL AUTO_INCREMENT, `last4` VARCHAR (45) NOT NULL, `brand` VARCHAR (45) NOT NULL, `exp_month` INT NOT NULL, `exp_year` INT NOT NULL, `name` VARCHAR (45) NOT NULL, `stripe_token` VARCHAR (500) NOT NULL, `user_id` INT NOT NULL, `create_dt` DATETIME NULL, `update_dt` DATETIME NULL, `created_by` INT NULL, `updated_by` INT NULL, PRIMARY KEY (`id`), UNIQUE INDEX `id_UNIQUE` (`id` ASC), INDEX `fk_payment_user1_idx` (`user_id` ASC), CONSTRAINT `fk_payment_user1` FOREIGN KEY (`user_id`) REFERENCES `amzorbit`.`user` (`user_id`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; SET SQL_MODE =@OLD_SQL_MODE; SET FOREIGN_KEY_CHECKS =@OLD_FOREIGN_KEY_CHECKS; SET UNIQUE_CHECKS =@OLD_UNIQUE_CHECKS;
true
393307a4edf5ef8f7ea2b7f6ec4c80f5cf7eda46
SQL
carlos-plata/projects
/java/reviews/src/main/resources/db/migration/V1__Create_products_table.sql
UTF-8
165
2.625
3
[]
no_license
create table if not exists products( product_id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, name VARCHAR(40) NOT NULL, description VARCHAR(100) NOT NULL );
true
6891f3312483adb8ba22b73a08c7d252b2b4dd5c
SQL
osvaldov518/identificacion
/identificacion/database/generar_tendencia.sql
UTF-8
2,022
3.640625
4
[]
no_license
CREATE DEFINER=`root`@`localhost` PROCEDURE `generar_tendencia`(IN p_nombre_columna VARCHAR(50)) BEGIN DECLARE vlr_m DECIMAL(15,2); DECLARE vlr_b DECIMAL(15,2); DECLARE numreg INT; DECLARE i INT; DECLARE nom_tend VARCHAR(50); SET i = 1; SET @str = ' CREATE TEMPORARY TABLE temporal1 AS SELECT id as `x`, ?parametro_columna as `y`, (id*?parametro_columna) as `xy`, (id*id) as `x^2`, (select count(*) from identificacion.datosrandom) as conteo from identificacion.datosrandom'; SET @str2=' CREATE TEMPORARY TABLE temporal2 AS select sum(x) as sum_x, sum(y) sum_y, sum(xy) sum_xy, sum(`x^2`) `sum_x^2`, conteo from temporal1 group by conteo '; SET @str = REPLACE(@str, '?parametro_columna', p_nombre_columna); PREPARE stmt FROM @str; EXECUTE stmt; PREPARE stmt2 FROM @str2; EXECUTE stmt2; SET vlr_m = (select ((sum_xy)-((sum_x*sum_y)/conteo))/((`sum_x^2`)-((sum_x*sum_x)/conteo)) as m from temporal2); SET vlr_b = (select (sum_y/conteo) - (((sum_xy)-((sum_x*sum_y)/conteo))/((`sum_x^2`)-((sum_x*sum_x)/conteo))) * (sum_x/conteo) from temporal2); SET numreg = (SELECT COUNT(*) FROM datosrandom); SET nom_tend = (SELECT tendencias FROM t_control_columnas WHERE columna = p_nombre_columna); actualiza_tendencia: LOOP IF i > numreg THEN LEAVE actualiza_tendencia; END IF; SET @str3 = 'UPDATE datosrandom SET ?tendencia = ( ?vlr_m * id + ?vlr_b ) WHERE id = ?i '; SET @str3 = REPLACE(@str3,'?tendencia',nom_tend); SET @str3 = REPLACE(@str3,'?vlr_m',vlr_m); SET @str3 = REPLACE(@str3,'?vlr_b',vlr_b); SET @str3 = REPLACE(@str3,'?i',i); INSERT INTO log_update VALUES (@str3); PREPARE stmt3 FROM @str3; EXECUTE stmt3; SET i = i + 1; ITERATE actualiza_tendencia; END LOOP; END
true
137a5e7922471b24115ab637ad574ddbdfaef34a
SQL
everthis/leetcode-js
/613-shortest-distance-in-a-line.sql
UTF-8
131
3.265625
3
[ "MIT" ]
permissive
# Write your MySQL query statement below select min(abs(t1.x-t2.x)) as shortest from point as t1 join point as t2 on t1.x != t2.x;
true
7b3d0c0bd51b48f8c41a2c5b950f913a49071df1
SQL
Zotova2008/1079951-yeticave-11
/queries.sql
UTF-8
3,973
3.078125
3
[]
no_license
/* Добавляем список категорий; */ INSERT INTO category (category_name, symbol_cat) VALUES ('Доски и лыжи', 'boards'), ('Крепления', 'attachment'), ('Ботинки', 'boots'), ('Одежда', 'clothing'), ('Инструменты', 'tools'), ('Разное', 'other'); /* Добавляем список пользователей */ INSERT INTO user_data (user_name, user_password, user_email, user_contact, date_registr) VALUES ('Иван', '11vany12', 'vany@yandex.ru', 'Москва, +79111112244', '2019-11-01 10:15:45'), ('Петр', '11122255', 'petrysha@gmail.com', 'Вологда, +79215554785', '2019-10-15 12:05:10'), ('Наталья', '2019', 'natalya@rambler.ru', 'Сочи, +79212583669', '2019-09-28 20:12:58'); /* Добавляем список объявлений */ INSERT INTO lot (lot_title, lot_descript, lot_img, lot_price, lot_step, date_creation, data_final, id_category, id_user) VALUES ('2014 Rossignol District Snowboard', 'Сноуборд Rossignol District 2019 года выпуска', 'img/lot-1.jpg', 10999, 1000, '2019-10-05 16:00:55', '2019-11-30 12:00:55', 1, 1), ('DC Ply Mens 2016/2017 Snowboard', 'Сноуборд DC Ply Mens победа на соревнованиях 2016/2017 вам обеспечена', 'img/lot-2.jpg', 159999, 10000, '2019-10-10 10:00:00', '2019-11-29 12:00:55', 1, 1), ('Крепления Union Contact Pro 2015 года размер L/XL', 'Крепления фирмы Union Contact Pro 2015 года, есть только размер L/XL', 'img/lot-3.jpg', 8000, 1000, '2019-11-01 12:00:00', '2019-11-25 12:00:55', 2, 2), ('Ботинки для сноуборда DC Mutiny Charocal', 'К сноуборду нужно преобрести ботинки фирмы DC Mutiny Charocal', 'img/lot-4.jpg', 10999, 1000, '2019-11-05 13:00:00', '2019-11-27 12:00:55', 3, 2), ('Куртка для сноуборда DC Mutiny Charocal', 'В куртке Charocal вы не замерзнете даже при +30', 'img/lot-5.jpg', 7500, 500, '2019-10-30 10:00:00', '2019-11-28 12:00:55', 4, 3), ('Маска Oakley Canopy', 'Маска защитит вас от комаров, мух и всяких летающих и ползающих паразитов', 'img/lot-6.jpg', 5400, 200, '2019-11-07 15:00:00', '2019-11-26 12:00:55', 6, 3); /* Добавляем ставки для существующих объявлений */ INSERT INTO bet (id_user, id_lot, bet_sum) VALUES (1, 3, 9000), (3, 3, 10000), (2, 6, 5600); /* получить все категории; */ SELECT * FROM category; /* получить самые новые, открытые лоты. Каждый лот должен включать название, стартовую цену, ссылку на изображение, текущую цену, название категории */ SELECT lot.lot_title, lot.lot_price, lot.lot_img, bet.bet_sum, cat.category_name FROM lot INNER JOIN category cat ON lot.id_category = cat.id LEFT JOIN bet ON lot.id = bet.id_lot WHERE lot.date_final > CURRENT_TIMESTAMP; /* показать лот по его id. Получите также название категории, к которой принадлежит лот; */ SELECT lot.id, lot.lot_title, lot.lot_descript, lot.lot_img, lot.lot_price, lot.lot_step, lot.date_creation, lot.date_final, lot.id_category, lot.id_user, lot.id_user_winner FROM lot INNER JOIN category cat ON lot.id_category = cat.id WHERE lot.id = 3; /* обновить название лота по его идентификатору; */ UPDATE lot SET lot_title = '2019 Rossignol District Snowboard' WHERE id = 1; /* получить список ставок для лота по его идентификатору с сортировкой по дате. */ SELECT * FROM bet INNER JOIN lot ON bet.id_lot = lot.id WHERE lot.id = 3 ORDER BY bet.bet_time DESC;
true
daf13b19e12ac89727ed3cbdb636ebca167548a2
SQL
turnkey-commerce/gendal
/examples/booktest/cockroachdb/custom-query.xo.sql
UTF-8
300
3.25
3
[ "MIT" ]
permissive
SELECT a.author_id::integer AS author_id, a.name::text AS author_name, b.book_id::integer AS book_id, b.isbn::text AS book_isbn, b.title::text AS book_title, b.tags::text AS book_tags FROM books b JOIN authors a ON a.author_id = b.author_id WHERE b.tags LIKE '%' || %%tags string%% || '%'
true
6d17b367b197ed4c4ec322a0f9ba510dadcd3bbf
SQL
shsm01/bkc_add.com
/bitrix/modules/security/install/db/mysql/install.sql
UTF-8
3,677
3.28125
3
[]
no_license
CREATE TABLE b_sec_filter_mask ( ID INT(11) NOT NULL auto_increment, SORT INT(11) NOT NULL DEFAULT 10, SITE_ID CHAR(2), FILTER_MASK VARCHAR(250), LIKE_MASK VARCHAR(250), PREG_MASK VARCHAR(250), PRIMARY KEY(ID) ); CREATE TABLE b_sec_iprule ( ID INT(11) NOT NULL auto_increment, RULE_TYPE CHAR(1) NOT NULL DEFAULT 'M', ACTIVE CHAR(1) NOT NULL default 'Y', ADMIN_SECTION CHAR(1) NOT NULL DEFAULT 'Y', SITE_ID CHAR(2), SORT INT(11) NOT NULL DEFAULT 500, ACTIVE_FROM datetime, ACTIVE_FROM_TIMESTAMP INT(11), ACTIVE_TO datetime, ACTIVE_TO_TIMESTAMP INT(11), NAME VARCHAR(250), PRIMARY KEY(ID) ); CREATE INDEX ix_b_sec_iprule_active_to on b_sec_iprule(ACTIVE_TO); CREATE TABLE b_sec_iprule_incl_mask ( IPRULE_ID INT(11) NOT NULL REFERENCES b_sec_iprule(ID), RULE_MASK VARCHAR(250), SORT INT(11) NOT NULL DEFAULT 500, LIKE_MASK VARCHAR(250), PREG_MASK VARCHAR(250), PRIMARY KEY(IPRULE_ID, RULE_MASK) ); CREATE TABLE b_sec_iprule_excl_mask ( IPRULE_ID INT(11) NOT NULL REFERENCES b_sec_iprule(ID), RULE_MASK VARCHAR(250), SORT INT(11) NOT NULL DEFAULT 500, LIKE_MASK VARCHAR(250), PREG_MASK VARCHAR(250), PRIMARY KEY(IPRULE_ID, RULE_MASK) ); CREATE TABLE b_sec_iprule_incl_ip ( IPRULE_ID INT(11) NOT NULL REFERENCES b_sec_iprule(ID), RULE_IP VARCHAR(50) NOT NULL, SORT INT(11) NOT NULL DEFAULT 500, IP_START bigint(18), IP_END bigint(18), PRIMARY KEY(IPRULE_ID, RULE_IP) ); CREATE TABLE b_sec_iprule_excl_ip ( IPRULE_ID INT(11) NOT NULL REFERENCES b_sec_iprule(ID), RULE_IP VARCHAR(50) NOT NULL, SORT INT(11) NOT NULL DEFAULT 500, IP_START bigint(18), IP_END bigint(18), PRIMARY KEY(IPRULE_ID, RULE_IP) ); CREATE TABLE b_sec_session ( SESSION_ID VARCHAR(250) NOT NULL, TIMESTAMP_X TIMESTAMP NOT NULL, SESSION_DATA LONGTEXT, PRIMARY KEY(SESSION_ID) ); CREATE INDEX ix_b_sec_session_time on b_sec_session(TIMESTAMP_X); CREATE TABLE b_sec_user ( USER_ID INT(11) NOT NULL REFERENCES b_user(ID), ACTIVE CHAR(1) NOT NULL DEFAULT 'N', SECRET VARCHAR(64), TYPE VARCHAR(16) NOT NULL, PARAMS text, ATTEMPTS int(18), INITIAL_DATE datetime, SKIP_MANDATORY CHAR(1) NOT NULL DEFAULT 'N', DEACTIVATE_UNTIL datetime, PRIMARY KEY (USER_ID) ); CREATE TABLE b_sec_redirect_url ( IS_SYSTEM CHAR(1) NOT NULL DEFAULT 'Y', SORT INT(11) NOT NULL DEFAULT 500, URL VARCHAR(250) NOT NULL, PARAMETER_NAME VARCHAR(250) NOT NULL ); insert into b_sec_redirect_url values ('Y', 10, '/bitrix/redirect.php', 'goto'); insert into b_sec_redirect_url values ('Y', 20, '/bitrix/rk.php', 'goto'); insert into b_sec_redirect_url values ('Y', 30, '/bitrix/click.php', 'goto'); CREATE TABLE b_sec_white_list ( ID INT(11) NOT NULL, WHITE_SUBSTR VARCHAR(250) NOT NULL, PRIMARY KEY(ID) ); CREATE TABLE b_sec_virus ( ID VARCHAR(32) NOT NULL, TIMESTAMP_X DATETIME NOT NULL, SITE_ID CHAR(2), SENT CHAR(1) NOT NULL DEFAULT 'N', INFO LONGTEXT NOT NULL, PRIMARY KEY(ID) ); CREATE TABLE b_sec_frame_mask ( ID INT(11) NOT NULL auto_increment, SORT INT(11) NOT NULL DEFAULT 10, SITE_ID CHAR(2), FRAME_MASK VARCHAR(250), LIKE_MASK VARCHAR(250), PREG_MASK VARCHAR(250), PRIMARY KEY(ID) ); CREATE TABLE b_security_sitecheck ( ID INT NOT NULL AUTO_INCREMENT, TEST_DATE datetime, RESULTS LONGTEXT, PRIMARY KEY (ID) ); CREATE TABLE b_sec_recovery_codes ( ID int NOT NULL AUTO_INCREMENT, USER_ID int NOT NULL, CODE varchar(255) NOT NULL, USED varchar(1) NOT NULL DEFAULT 'N', USING_DATE DATETIME NULL, USING_IP VARCHAR(255) NULL, PRIMARY KEY(ID), INDEX ix_b_sec_recovery_codes_user_id (USER_ID) );
true
9b53cb58a602bef1af11255cfdb04f3ab324149b
SQL
socar-jace/kotlin_practice
/docker/init/1_create_db.sql
UTF-8
299
2.671875
3
[]
no_license
CREATE TABLE `member` ( `id` int NOT NULL AUTO_INCREMENT, `name` varchar(32) NOT NULL, `nickname` varchar(32) NOT NULL, PRIMARY KEY (`id`) ); INSERT INTO `member` (name, nickname) VALUES ('김도형', 'Dorma'), ('윤형중', 'Trevi'), ('조현근', 'Jace'), ('박주홍', 'Derek');
true
de59a720ea9f7ba7855912375b75d79fa58ce215
SQL
brocaar/chirpstack-network-server
/internal/storage/migrations/0017_gateway_mac_to_id.up.sql
UTF-8
201
2.53125
3
[ "MIT" ]
permissive
alter table gateway rename column mac to gateway_id; alter table gateway_stats rename column mac to gateway_id; alter index idx_gateway_stats_mac rename to idx_gateway_stats_gateway_id;
true
4ee235ad2c470a8a1e15bb5211ece7709ce6fff8
SQL
JellyBest/git
/spider/sql/mmtj.sql
UTF-8
1,244
2.9375
3
[]
no_license
/* Navicat MySQL Data Transfer Source Server : 127.0.0.1 Source Server Version : 50710 Source Host : localhost:3306 Source Database : dadan Target Server Type : MYSQL Target Server Version : 50710 File Encoding : 65001 Date: 2018-07-10 22:34:38 */ SET FOREIGN_KEY_CHECKS=0; -- ---------------------------- -- Table structure for mmtj -- ---------------------------- DROP TABLE IF EXISTS `mmtj`; CREATE TABLE `mmtj` ( `SalesCode` varchar(255) NOT NULL COMMENT '营业部代码', `TDate` date NOT NULL COMMENT '日期', `SCode` char(6) NOT NULL COMMENT '股票代码', `BMoney` decimal(20,2) DEFAULT '0.00' COMMENT '买入额', `SMoney` decimal(20,2) DEFAULT '0.00' COMMENT '卖出总额', `PBuy` decimal(20,2) DEFAULT '0.00' COMMENT '买卖净额', `CPrice` decimal(10,2) DEFAULT '0.00' COMMENT '收盘价', `Chgradio` decimal(10,2) DEFAULT '0.00' COMMENT '收盘涨跌幅%', `SalesName` varchar(255) DEFAULT NULL COMMENT '营业部名称', `SName` varchar(255) DEFAULT NULL COMMENT '股票名称', `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '数据存入数据库的日期', PRIMARY KEY (`SalesCode`,`TDate`,`SCode`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
true
344db60e8f43403c96c3bf3174671811db4e342e
SQL
iaks23/Marketing-Analytics-Case-Study
/Problem Solutions Folder/Actor_Recs.sql
UTF-8
2,992
4.4375
4
[]
no_license
/* -------------------------- ############################# ### Actor Recommendations ### ############################# -----------------------------*/ /* --------------------------------------------------- 1. Generate total actor rental counts to use for film popularity ranking in later steps * `actor_film_counts` ---------------------------------------------------- */ DROP TABLE IF EXISTS actor_film_counts; CREATE TEMP TABLE actor_film_counts AS WITH film_counts AS ( SELECT film_id, COUNT(DISTINCT rental_id) AS rental_count FROM actor_joint_dataset GROUP BY film_id ) SELECT DISTINCT actor_joint_dataset.film_id, actor_joint_dataset.actor_id, -- keep title in dataset as we need it for final recommendation text actor_joint_dataset.title, film_counts.rental_count FROM actor_joint_dataset LEFT JOIN film_counts ON actor_joint_dataset.film_id = film_counts.film_id; /* ------------------------------------------------- 2. Create an updated film exclusions table which includes the previously watched films like we had for the category recommendations - but this time we need to also add in the films which were previously recommended * `actor_film_exclusions` ---------------------------------------------------- */ DROP TABLE IF EXISTS actor_film_exclusions; CREATE TEMP TABLE actor_film_exclusions AS -- repeat the first steps as per the category exclusions ( SELECT DISTINCT customer_id, film_id FROM complete_joint_dataset ) -- we use a UNION to combine the previously watched and the recommended films! UNION ( SELECT DISTINCT customer_id, film_id FROM category_recommendations ); /* ------------------------------------------------- 3. Apply the same `ANTI JOIN` technique and use a window function to identify the 3 valid film recommendations for our customers * `actor_recommendations` ---------------------------------------------------- */ DROP TABLE IF EXISTS actor_recommendations; CREATE TEMP TABLE actor_recommendations AS WITH ranked_actor_films_cte AS ( SELECT top_actor_counts.customer_id, top_actor_counts.first_name, top_actor_counts.last_name, top_actor_counts.rental_count, actor_film_counts.title, actor_film_counts.film_id, actor_film_counts.actor_id, DENSE_RANK() OVER ( PARTITION BY top_actor_counts.customer_id ORDER BY actor_film_counts.rental_count DESC, actor_film_counts.title ) AS reco_rank FROM top_actor_counts INNER JOIN actor_film_counts -- join on actor_id instead of category_name! ON top_actor_counts.actor_id = actor_film_counts.actor_id -- This is a tricky anti-join where we need to "join" on 2 different tables! WHERE NOT EXISTS ( SELECT 1 FROM actor_film_exclusions WHERE actor_film_exclusions.customer_id = top_actor_counts.customer_id AND actor_film_exclusions.film_id = actor_film_counts.film_id ) ) SELECT * FROM ranked_actor_films_cte WHERE reco_rank <= 3;
true
c7951176c0369b94aa50ca782a776bb9d94c7823
SQL
Madhu-0211/Notifier
/Notifier/WebContent/Documents/table1.sql
UTF-8
3,336
3.203125
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 5.0.4 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Generation Time: May 02, 2021 at 09:38 AM -- Server version: 10.4.17-MariaDB -- PHP Version: 8.0.0 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: `table1` -- -- -------------------------------------------------------- -- -- Table structure for table `addnote` -- CREATE TABLE `addnote` ( `id` int(11) NOT NULL, `nbid` int(11) NOT NULL, `email` varchar(100) NOT NULL, `nname` varchar(100) NOT NULL, `notename` varchar(100) NOT NULL, `start` date NOT NULL, `end` date NOT NULL, `Remainder` date NOT NULL, `Status` varchar(100) NOT NULL, `Tag` varchar(100) NOT NULL, `des` varchar(100) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `addnote` -- INSERT INTO `addnote` (`id`, `nbid`, `email`, `nname`, `notename`, `start`, `end`, `Remainder`, `Status`, `Tag`, `des`) VALUES (7, 3, 'madhumitha.e.2017.ece@rajalakshmi.edu.in', 'Virtusa', 'Assessment', '2021-05-01', '2021-05-01', '2021-05-01', 'Started', 'Private', 'Complete the test '), (19, 3, 'madhumitha.e.2017.ece@rajalakshmi.edu.in', 'Virtusa', 'Test-1', '2021-05-01', '2021-05-02', '2021-05-02', 'Started', 'Private', 'Finish '), (20, 6, 'madhumitha.e.2017.ece@rajalakshmi.edu.in', 'Project', 'Presentation', '2021-05-02', '2021-05-03', '2021-05-03', 'Not started', 'Public', 'PowerPoint'); -- -------------------------------------------------------- -- -- Table structure for table `newnotebook` -- CREATE TABLE `newnotebook` ( `id` int(11) NOT NULL, `email` varchar(100) NOT NULL, `nname` varchar(100) NOT NULL, `count` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `newnotebook` -- INSERT INTO `newnotebook` (`id`, `email`, `nname`, `count`) VALUES (3, 'madhumitha.e.2017.ece@rajalakshmi.edu.in', 'Virtusa', 2), (6, 'madhumitha.e.2017.ece@rajalakshmi.edu.in', 'Project', 1); -- -------------------------------------------------------- -- -- Table structure for table `signup` -- CREATE TABLE `signup` ( `username` varchar(100) NOT NULL, `number` varchar(10) NOT NULL, `email` varchar(100) NOT NULL, `password` varchar(100) NOT NULL, `conform` varchar(100) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `signup` -- INSERT INTO `signup` (`username`, `number`, `email`, `password`, `conform`) VALUES ('madhu_02', '9551859474', 'madhumitha.e.2017.ece@rajalakshmi.edu.in', 'madhu02', 'madhu02'); -- -- Indexes for dumped tables -- -- -- Indexes for table `addnote` -- ALTER TABLE `addnote` ADD PRIMARY KEY (`id`); -- -- Indexes for table `newnotebook` -- ALTER TABLE `newnotebook` ADD PRIMARY KEY (`id`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `addnote` -- ALTER TABLE `addnote` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=21; -- -- AUTO_INCREMENT for table `newnotebook` -- ALTER TABLE `newnotebook` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7; 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
d204e659badaba75c2b7670c5c51a6a942a39868
SQL
andri000me/bap_imtek
/bap_imtek.sql
UTF-8
5,560
2.84375
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 2.11.4 -- http://www.phpmyadmin.net -- -- Host: localhost -- Generation Time: Jan 29, 2011 at 05:21 PM -- Server version: 5.0.91 -- PHP Version: 5.2.13 SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; -- -- Database: `bap_imtek` -- -- -------------------------------------------------------- -- -- Table structure for table `tblpeserta` -- CREATE TABLE `tblpeserta` ( `kodepes` int(11) NOT NULL, `nama` varchar(45) NOT NULL, `kodesek` int(11) NOT NULL, `notelp` varchar(15) NOT NULL, `komentar` text NOT NULL, PRIMARY KEY (`kodepes`), KEY `fk_sekolah` (`kodesek`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; -- -- Dumping data for table `tblpeserta` -- INSERT INTO `tblpeserta` (`kodepes`, `nama`, `kodesek`, `notelp`, `komentar`) VALUES(11111111, 'sakti dwi cahyono', 1, '081914947566', 'hehe \npertamax'); INSERT INTO `tblpeserta` (`kodepes`, `nama`, `kodesek`, `notelp`, `komentar`) VALUES(22222222, 'sakti dc', 1, '122312321', 'test komentar'); INSERT INTO `tblpeserta` (`kodepes`, `nama`, `kodesek`, `notelp`, `komentar`) VALUES(21213121, 'detasemen', 4, '2123423', '2131231'); INSERT INTO `tblpeserta` (`kodepes`, `nama`, `kodesek`, `notelp`, `komentar`) VALUES(35431368, 'Rudy Setyawan', 5, '085695984354', 'Aq gor nyobo tok lho yo!!!!!!!!!\n\nbtw kok harus diisi semua sih'); INSERT INTO `tblpeserta` (`kodepes`, `nama`, `kodesek`, `notelp`, `komentar`) VALUES(10000000, 'lulhhkhklhklj', 1, '02154878', 'jhjhkjhkjh'); INSERT INTO `tblpeserta` (`kodepes`, `nama`, `kodesek`, `notelp`, `komentar`) VALUES(23234444, 'abu mundzir', 1, '0899333', 'njajal'); INSERT INTO `tblpeserta` (`kodepes`, `nama`, `kodesek`, `notelp`, `komentar`) VALUES(12345678, 'fauzan Riyadi malik', 1, '085624121477', 'ngetes'); INSERT INTO `tblpeserta` (`kodepes`, `nama`, `kodesek`, `notelp`, `komentar`) VALUES(2463589, 'ex kepala suku', 9, '085272789090', 'siiiiiiiippppppppp'); INSERT INTO `tblpeserta` (`kodepes`, `nama`, `kodesek`, `notelp`, `komentar`) VALUES(34224342, 'xxxxx', 1, '43243243123', 'sad'); INSERT INTO `tblpeserta` (`kodepes`, `nama`, `kodesek`, `notelp`, `komentar`) VALUES(23553455, 'sadsdas ', 1, '43243243123', 'sad'); INSERT INTO `tblpeserta` (`kodepes`, `nama`, `kodesek`, `notelp`, `komentar`) VALUES(13333333, 'imathosan', 1, '081544637565', 'test'); INSERT INTO `tblpeserta` (`kodepes`, `nama`, `kodesek`, `notelp`, `komentar`) VALUES(12145678, 'si x', 1, '3213131', 'hoammm..ngantuk'); INSERT INTO `tblpeserta` (`kodepes`, `nama`, `kodesek`, `notelp`, `komentar`) VALUES(11307019, '123456', 8, '123456416', '123456'); INSERT INTO `tblpeserta` (`kodepes`, `nama`, `kodesek`, `notelp`, `komentar`) VALUES(78678687, 'asdfa', 1, '979879', 'fdadf'); INSERT INTO `tblpeserta` (`kodepes`, `nama`, `kodesek`, `notelp`, `komentar`) VALUES(90779890, '\\''', 1, '879879', '\\''jk;j'); INSERT INTO `tblpeserta` (`kodepes`, `nama`, `kodesek`, `notelp`, `komentar`) VALUES(45363476, '123', 1, '123', 'asfdsadf'); INSERT INTO `tblpeserta` (`kodepes`, `nama`, `kodesek`, `notelp`, `komentar`) VALUES(90990900, '121212343', 1, '34323', '23432'); INSERT INTO `tblpeserta` (`kodepes`, `nama`, `kodesek`, `notelp`, `komentar`) VALUES(11111112, ' 1', 10, '2', 'dddddd'); INSERT INTO `tblpeserta` (`kodepes`, `nama`, `kodesek`, `notelp`, `komentar`) VALUES(0, 'bagas', 8, '000000000000000', 'ajax,, nais...'); INSERT INTO `tblpeserta` (`kodepes`, `nama`, `kodesek`, `notelp`, `komentar`) VALUES(1, 'bagas', 8, '111111111111111', 'jQuery (write less, do more) tapi rung mudeng...'); INSERT INTO `tblpeserta` (`kodepes`, `nama`, `kodesek`, `notelp`, `komentar`) VALUES(99990909, '99090', 1, '909090', '99099 masuk'); INSERT INTO `tblpeserta` (`kodepes`, `nama`, `kodesek`, `notelp`, `komentar`) VALUES(12312768, '12123', 1, '123', 'keren euy pake ajax'); INSERT INTO `tblpeserta` (`kodepes`, `nama`, `kodesek`, `notelp`, `komentar`) VALUES(98767896, 'testing lagi', 7, '09237162376123', 'la la li li sdfasdfs asdfas'); INSERT INTO `tblpeserta` (`kodepes`, `nama`, `kodesek`, `notelp`, `komentar`) VALUES(14575899, 'rudy setyawan', 1, '08628061357', 'Hehehe coba masukin lgi ah!!'); INSERT INTO `tblpeserta` (`kodepes`, `nama`, `kodesek`, `notelp`, `komentar`) VALUES(45678123, 'coba ah', 1, '085762456134', 'hahahaha aq cba lgi yah,,\n'); -- -------------------------------------------------------- -- -- Table structure for table `tblsekolah` -- CREATE TABLE `tblsekolah` ( `kodesek` int(11) NOT NULL auto_increment, `nama` varchar(40) NOT NULL, PRIMARY KEY (`kodesek`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=14 ; -- -- Dumping data for table `tblsekolah` -- INSERT INTO `tblsekolah` (`kodesek`, `nama`) VALUES(1, 'SMA N 1 Kebumen'); INSERT INTO `tblsekolah` (`kodesek`, `nama`) VALUES(2, 'SMA N 2 Kebumen'); INSERT INTO `tblsekolah` (`kodesek`, `nama`) VALUES(3, 'SMA N 1 Pejagoan'); INSERT INTO `tblsekolah` (`kodesek`, `nama`) VALUES(4, 'SMA N 1 Gombong'); INSERT INTO `tblsekolah` (`kodesek`, `nama`) VALUES(5, 'SMA N 1 Karanganyar'); INSERT INTO `tblsekolah` (`kodesek`, `nama`) VALUES(6, 'SMA N 1 Kutowinangun'); INSERT INTO `tblsekolah` (`kodesek`, `nama`) VALUES(7, 'SMA N 1 Prembun'); INSERT INTO `tblsekolah` (`kodesek`, `nama`) VALUES(8, 'SMA N 1 Klirong'); INSERT INTO `tblsekolah` (`kodesek`, `nama`) VALUES(9, 'MAN 1 Kebumen'); INSERT INTO `tblsekolah` (`kodesek`, `nama`) VALUES(10, 'MAN 2 Kebumen'); INSERT INTO `tblsekolah` (`kodesek`, `nama`) VALUES(11, 'SMK Komputer'); INSERT INTO `tblsekolah` (`kodesek`, `nama`) VALUES(12, 'SMK N 2 Kebumen'); INSERT INTO `tblsekolah` (`kodesek`, `nama`) VALUES(13, 'SMA PGRI Kebumen');
true
226f7575b54e7b65de99705a961d95e05c5698e5
SQL
MINHTECH2511/Railway22_vti_LuMinhTri
/MySQL/TESTING_4/Testing_System_Assignment_4.sql
UTF-8
8,305
4
4
[]
no_license
-- EXERCISE1 -- -- Question 1: Viết lệnh để lấy ra danh sách nhân viên và thông tin phòng ban của họ SELECT a.fullname, d.department_name FROM `accounts` a LEFT JOIN departments d ON d.department_id=a.department_id; -- Question 2: Viết lệnh để lấy ra thông tin các account được tạo sau ngày 20/12/2010 SELECT * FROM `accounts` WHERE create_date >'2010-12-20'; -- Question 3: Viết lệnh để lấy ra tất cả các developer SELECT a.fullname,p.position_name FROM `accounts` a LEFT JOIN positions p ON p.position_id=a.position_id WHERE p.position_name="Dev"; -- Question 4: Viết lệnh để lấy ra danh sách các phòng ban có >3 nhân viên SELECT d.* FROM departments d RIGHT JOIN accounts a ON a.department_id=d.department_id GROUP BY a.department_id HAVING COUNT(a.department_id)>=3; SELECT p.department_name FROM departments p LEFT JOIN `accounts` a ON p.department_id=a.department_id GROUP BY p.department_id HAVING COUNT(p.department_id)>=3; -- Question 5: Viết lệnh để lấy ra danh sách câu hỏi được sử dụng trong đề thi nhiều -- nhất SELECT q.content, e.question_id FROM exam_questions e LEFT JOIN questions q ON q.question_id=e.question_id GROUP BY e.question_id ORDER BY COUNT(e.question_id) DESC LIMIT 1; SELECT q.content, e.question_id, COUNT(e.question_id) FROM exam_questions e LEFT JOIN questions q ON q.question_id=e.question_id GROUP BY e.question_id HAVING COUNT(e.question_id)=( SELECT COUNT(e.question_id) FROM exam_questions e INNER JOIN questions q ON e.question_id=q.question_id GROUP BY q.question_id ORDER BY COUNT(q.question_id) DESC LIMIT 1 ); -- Question 6: Thông kê mỗi category Question được sử dụng trong bao nhiêu Question SET sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY','')); SELECT q.content, COUNT(q.category_id)so_lan_sd FROM questions q RIGHT JOIN category_questions c ON q.category_id=c.category_id GROUP BY q.category_id; -- Question 7: Thông kê mỗi Question được sử dụng trong bao nhiêu Exam SELECT q.question_id, q.content, COUNT(e.question_id)sl_exam FROM exam_questions e RIGHT JOIN questions q ON e.question_id=q.question_id GROUP BY e.question_id; -- Question 8: Lấy ra Question có nhiều câu trả lời nhất SELECT q.question_id, q.content, COUNT(a.question_id)so_cau_tl FROM questions q RIGHT JOIN answers a ON q.question_id=a.question_id GROUP BY a.question_id HAVING COUNT(a.question_id)= ( SELECT COUNT(question_id) FROM answers GROUP BY question_id ORDER BY COUNT(question_id) DESC LIMIT 1 ); -- Question 9: Thống kê số lượng account trong mỗi group SELECT COUNT(a.account_id), gr.group_id, g.group_name FROM group_accounts gr RIGHT JOIN accounts a ON a.account_id= gr.account_id RIGHT JOIN `groups`g ON g.group_id=gr.group_id GROUP BY g.group_id; SELECT gr.*,COUNT(ga.account_id) number_1 FROM `groups` gr LEFT JOIN group_accounts ga ON gr.group_id=ga.group_id GROUP BY gr.group_id ORDER BY COUNT(ga.account_id); SELECT gr.group_name, COUNT(g.group_id)SL_account FROM group_accounts g RIGHT JOIN accounts a ON a.account_id=g.account_id RIGHT JOIN `groups` gr ON g.group_id=gr.group_id GROUP BY g.group_id; -- Question 10: Tìm chức vụ có ít người nhất SELECT q.*, COUNT(q.position_id) FROM accounts a RIGHT JOIN positions q ON a.position_id=q.position_id GROUP BY a.position_id HAVING COUNT(q.position_id) =( SELECT COUNT(position_id) FROM accounts GROUP BY position_id ORDER BY COUNT(position_id) LIMIT 1 ); -- Question 11: Thống kê mỗi phòng ban có bao nhiêu dev, test, scrum master, PM SELECT p.position_name, COUNT(a.department_id)so_phong_ban FROM accounts a LEFT JOIN positions p ON a.position_id=p.position_id WHERE p.position_name IN ("Dev","Test","Scrum Master", "PM") GROUP BY p.position_id ORDER BY COUNT(a.department_id); SELECT d.department_name, COUNT(a.department_id)SL_PHONG_BAN, GROUP_CONCAT(p.position_name) FROM accounts a INNER JOIN departments d ON a.department_id=d.department_id INNER JOIN positions p ON a.position_id=p.position_id GROUP BY a.department_id; CREATE VIEW cross_dept_posi AS SELECT d.department_id, p.position_id FROM departments d CROSS JOIN `positions` p WHERE p.position_name IN ("Dev","Test","Scrum Master", "PM") ORDER BY d.department_id , p.position_id; SELECT * FROM cross_dept_posi; CREATE VIEW T2 AS SELECT d.department_id, p.position_id, COUNT(a.account_id) AS number_of_account FROM positions p LEFT JOIN `accounts` a ON p.position_id = a.position_id RIGHT JOIN departments d ON a.department_id = d.department_id WHERE p.position_name IN ("Dev","Test","Scrum Master", "PM") GROUP BY d.department_id , p.position_id; SELECT * FROM T2; SELECT t1.department_id, t1.position_id, IF((t2.number_of_account IS NULL),0,t2.number_of_account) AS number_of_account FROM (SELECT * FROM cross_dept_posi) AS t1 LEFT JOIN (SELECT * FROM T2) AS t2 ON t1.department_id = t2.department_id AND t1.position_id = t2.position_id GROUP BY t1.department_id , t1.position_id ORDER BY t1.department_id , t1.position_id; -- Question 12: Lấy thông tin chi tiết của câu hỏi bao gồm: thông tin cơ bản của -- question, loại câu hỏi, ai là người tạo ra câu hỏi, câu trả lời là gì, ... -- Question 13: Lấy ra số lượng câu hỏi của mỗi loại tự luận hay trắc nghiệm SELECT t.type_name, COUNT(q.content)so_cau FROM questions q LEFT JOIN type_questions t ON q.type_id=t.type_id GROUP BY q.type_id ORDER BY COUNT(q.content); -- Question 14:Lấy ra group không có account nào SELECT g.group_name, g.group_id FROM `groups` g LEFT JOIN `group_accounts` a ON a.group_id=g.group_id WHERE a.account_id IS NULL; -- Question 15: Lấy ra group không có account nào -- ủa khác chi câu 14 ???? -- Question 16: Lấy ra question không có answer nào SELECT q.question_id, q.content FROM answers a RIGHT JOIN questions q ON a.question_id = q.question_id WHERE a.answer_id IS NULL; -- EXERCISE2 -- -- Question 17: -- a) Lấy các account thuộc nhóm thứ 1 SELECT a.fullname FROM accounts a INNER JOIN group_accounts g ON a.account_id=g.account_id WHERE g.account_id=1; -- b) Lấy các account thuộc nhóm thứ 2 SELECT a.fullname FROM accounts a INNER JOIN group_accounts g ON a.account_id=g.account_id WHERE g.account_id=2; -- c) Ghép 2 kết quả từ câu a) và câu b) sao cho không có record nào trùng nhau-- UINON SELECT a.fullname FROM accounts a INNER JOIN group_accounts g ON a.account_id=g.account_id WHERE g.account_id=1 UNION SELECT a.fullname FROM accounts a INNER JOIN group_accounts g ON a.account_id=g.account_id WHERE g.account_id=2; -- Question 18: -- a) Lấy các group có lớn hơn 5 thành viên SELECT COUNT(g.account_id) FROM accounts a INNER JOIN group_accounts g ON a.account_id=g.account_id GROUP BY g.account_id HAVING COUNT(g.account_id)>=5; -- b) Lấy các group có nhỏ hơn 7 thành viên SELECT COUNT(g.account_id) FROM accounts a INNER JOIN group_accounts g ON a.account_id=g.account_id GROUP BY g.account_id HAVING COUNT(g.account_id)<=7; -- c) Ghép 2 kết quả từ câu a) và câu b) SELECT COUNT(g.account_id) FROM accounts a INNER JOIN group_accounts g ON a.account_id=g.account_id GROUP BY g.account_id HAVING COUNT(g.account_id)>=5 UNION ALL SELECT COUNT(g.account_id) FROM accounts a INNER JOIN group_accounts g ON a.account_id=g.account_id GROUP BY g.account_id HAVING COUNT(g.account_id)<=7;
true
6832204f27dbbb0d95152580ce3a84cbc5997a63
SQL
Jaky-Maiky/Base-de-datos
/Etc/reporte_ingreso_usuarios_view.sql
UTF-8
194
2.71875
3
[]
no_license
create view reporte_ingreso_usuarios_view as select fechaRegistro, nombreUsuario, cantRegistros from Registro, Usuario where Registro.idRegistro = Usuario.idUsuario order by cantRegistros desc;
true
8c36e9109f7edaea58dab1d497da9cf5da30da06
SQL
LewisErick/ProyObjRel
/student_trigger.sql
UTF-8
2,094
3.6875
4
[]
no_license
/* ------------------------------------------------------------------------- ** BEFORE INSERT ROW TRIGGER ** Initializing MemberOf. ** -------------------------------------------------------------------------*/ CREATE OR REPLACE TRIGGER student_insert BEFORE INSERT ON student FOR EACH ROW BEGIN :NEW.memberOf := campusclub_array(); END; / /* --------------------------------------------------------------------------- ** To add or remove a student as a member of a campus club, use the procedures ** addMembersAssociation or removeMembersAssociation, respectively. ** -------------------------------------------------------------------------*/ /* ------------------------------------------------------------------------- ** BEFORE DELETE ROW TRIGGER ** Remove the person object the student inherits (maintain mandatory ** inheritance property). ** -------------------------------------------------------------------------*/ CREATE OR REPLACE TRIGGER student_rowdelete BEFORE DELETE ON student FOR EACH ROW DECLARE c_obj campusclub_t; clubID NUMBER; BEGIN FOR i IN 1..:OLD.memberOf.COUNT LOOP SELECT DEREF(:OLD.memberOf(i)) INTO c_obj FROM DUAL; SELECT c_obj.cid INTO clubID FROM DUAL; INSERT INTO CLUB_TEMP VALUES(clubID); END LOOP; --Remove person DELETE person p WHERE REF(p) = :OLD.super; END student_rowdelete; / SHOW ERRORS; /* ------------------------------------------------------------------------- ** AFTER DELETE STATEMENT TRIGGER ** Remove the student from all club memberships. ** -------------------------------------------------------------------------*/ CREATE OR REPLACE TRIGGER student_delete AFTER DELETE ON student BEGIN --Remove invalid REFs from campusclub.members FOR rec IN (SELECT cid FROM club_temp) LOOP DELETE FROM TABLE(SELECT c.members FROM campusclub c WHERE c.cid = rec.cid ) t WHERE t.COLUMN_VALUE IS DANGLING; END LOOP; DELETE club_temp; END student_delete; / SHOW ERRORS;
true