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
3f20d8bb8c859f0ab2eed22639e6c8c6f36a5044
SQL
stedisan/App
/JobService/jobservice.sql
UTF-8
6,301
3.125
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 4.7.0 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Creato il: Lug 21, 2017 alle 11:55 -- Versione del server: 10.1.22-MariaDB -- Versione PHP: 7.1.4 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: `jobservice` -- -- -------------------------------------------------------- -- -- Struttura della tabella `categorie` -- CREATE TABLE `categorie` ( `id_cat` int(10) UNSIGNED NOT NULL, `nomec` varchar(255) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Struttura della tabella `preferiti` -- CREATE TABLE `preferiti` ( `id_pref` int(10) UNSIGNED NOT NULL, `id_utente` int(10) UNSIGNED NOT NULL, `id_prof` int(10) UNSIGNED NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Struttura della tabella `prenotazioni` -- CREATE TABLE `prenotazioni` ( `id_prenot` int(10) UNSIGNED NOT NULL, `giorno` varchar(10) NOT NULL, `ora` varchar(5) NOT NULL, `id_utente` int(10) UNSIGNED NOT NULL, `id_prof` int(10) UNSIGNED NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Struttura della tabella `professionisti` -- CREATE TABLE `professionisti` ( `id_prof` int(10) UNSIGNED NOT NULL, `nome` varchar(255) NOT NULL, `cognome` varchar(255) NOT NULL, `email` varchar(255) NOT NULL, `città` varchar(255) NOT NULL, `telefono` varchar(10) NOT NULL, `id_cat` int(10) UNSIGNED NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Struttura della tabella `sessions` -- CREATE TABLE `sessions` ( `session_id` int(10) UNSIGNED NOT NULL, `token` varchar(255) NOT NULL, `id_utente` int(10) UNSIGNED NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Struttura della tabella `tasks` -- CREATE TABLE `tasks` ( `task_id` int(10) UNSIGNED NOT NULL, `position` int(255) NOT NULL, `completed` tinyint(10) NOT NULL, `text` varchar(4000) NOT NULL, `id_utente` int(10) UNSIGNED NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Struttura della tabella `utenti` -- CREATE TABLE `utenti` ( `id_utente` int(10) NOT NULL, `nome` varchar(255) NOT NULL, `cognome` varchar(255) NOT NULL, `età` int(3) NOT NULL, `telefono` varchar(10) NOT NULL, `città` varchar(255) NOT NULL, `email` varchar(255) NOT NULL, `datadinascita` varchar(10) NOT NULL, `password` varchar(255) NOT NULL, `username` varchar(255) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Indici per le tabelle scaricate -- -- -- Indici per le tabelle `categorie` -- ALTER TABLE `categorie` ADD PRIMARY KEY (`id_cat`); -- -- Indici per le tabelle `preferiti` -- ALTER TABLE `preferiti` ADD PRIMARY KEY (`id_pref`), ADD KEY `fk3_id_utente` (`id_utente`), ADD KEY `fk1_id_prof` (`id_prof`); -- -- Indici per le tabelle `prenotazioni` -- ALTER TABLE `prenotazioni` ADD PRIMARY KEY (`id_prenot`), ADD KEY `fk_id_prof` (`id_prof`), ADD KEY `fk1_id_utente` (`id_utente`); -- -- Indici per le tabelle `professionisti` -- ALTER TABLE `professionisti` ADD PRIMARY KEY (`id_prof`), ADD KEY `fk_id_cat` (`id_cat`); -- -- Indici per le tabelle `sessions` -- ALTER TABLE `sessions` ADD PRIMARY KEY (`session_id`), ADD KEY `fk_id_utente` (`id_utente`); -- -- Indici per le tabelle `tasks` -- ALTER TABLE `tasks` ADD PRIMARY KEY (`task_id`), ADD KEY `fk2_id_utente` (`id_utente`); -- -- Indici per le tabelle `utenti` -- ALTER TABLE `utenti` ADD PRIMARY KEY (`id_utente`); -- -- AUTO_INCREMENT per le tabelle scaricate -- -- -- AUTO_INCREMENT per la tabella `categorie` -- ALTER TABLE `categorie` MODIFY `id_cat` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT per la tabella `preferiti` -- ALTER TABLE `preferiti` MODIFY `id_pref` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT per la tabella `prenotazioni` -- ALTER TABLE `prenotazioni` MODIFY `id_prenot` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT per la tabella `professionisti` -- ALTER TABLE `professionisti` MODIFY `id_prof` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT per la tabella `sessions` -- ALTER TABLE `sessions` MODIFY `session_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT per la tabella `tasks` -- ALTER TABLE `tasks` MODIFY `task_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT per la tabella `utenti` -- ALTER TABLE `utenti` MODIFY `id_utente` int(10) NOT NULL AUTO_INCREMENT; -- -- Limiti per le tabelle scaricate -- -- -- Limiti per la tabella `preferiti` -- ALTER TABLE `preferiti` ADD CONSTRAINT `fk1_id_prof` FOREIGN KEY (`id_prof`) REFERENCES `preferiti` (`id_pref`), ADD CONSTRAINT `fk3_id_utente` FOREIGN KEY (`id_utente`) REFERENCES `preferiti` (`id_pref`); -- -- Limiti per la tabella `prenotazioni` -- ALTER TABLE `prenotazioni` ADD CONSTRAINT `fk1_id_utente` FOREIGN KEY (`id_utente`) REFERENCES `prenotazioni` (`id_prenot`), ADD CONSTRAINT `fk_id_prof` FOREIGN KEY (`id_prof`) REFERENCES `prenotazioni` (`id_prenot`); -- -- Limiti per la tabella `professionisti` -- ALTER TABLE `professionisti` ADD CONSTRAINT `fk_id_cat` FOREIGN KEY (`id_cat`) REFERENCES `professionisti` (`id_prof`); -- -- Limiti per la tabella `sessions` -- ALTER TABLE `sessions` ADD CONSTRAINT `fk_id_utente` FOREIGN KEY (`id_utente`) REFERENCES `sessions` (`session_id`); -- -- Limiti per la tabella `tasks` -- ALTER TABLE `tasks` ADD CONSTRAINT `fk2_id_utente` FOREIGN KEY (`id_utente`) REFERENCES `tasks` (`task_id`); COMMIT; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
true
d493935504f6d39e302031cfb7acffc220c24b7f
SQL
prakharrathi25/Sports-Management-System
/data/users (1).sql
UTF-8
1,696
3.046875
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 4.4.15.9 -- https://www.phpmyadmin.net -- -- Host: localhost -- Generation Time: May 08, 2020 at 08:48 PM -- Server version: 5.6.47-log -- PHP Version: 5.6.31 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8mb4 */; -- -- Database: `sports-database` -- -- -------------------------------------------------------- -- -- Table structure for table `users` -- CREATE TABLE IF NOT EXISTS `users` ( `id` int(3) NOT NULL, `username` varchar(100) NOT NULL, `password` varchar(100) NOT NULL, `user_type` varchar(20) NOT NULL, `team` varchar(10) DEFAULT NULL ) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1; -- -- Dumping data for table `users` -- INSERT INTO `users` (`id`, `username`, `password`, `user_type`, `team`) VALUES (1, 'panthers', 'panthers', 'manager', 'Panthers'), (2, 'bulls', 'bulls', 'manager', 'Bulls'), (3, 'phoenix', 'phoenix', 'manager', 'Phoenix'), (4, 'falcons', 'falcons', 'manager', 'Falcons'); -- -- Indexes for dumped tables -- -- -- Indexes for table `users` -- ALTER TABLE `users` ADD PRIMARY KEY (`id`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `users` -- ALTER TABLE `users` MODIFY `id` int(3) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=7; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
true
2ec4773352ac48fd0917107c125d4a0d017807fc
SQL
dev-dmadan/stripo-plugin-creatio
/app/database/db.sql
UTF-8
2,851
3.515625
4
[ "MIT" ]
permissive
# Local Development Only -- Remove commentary if you want build database from zero # DROP DATABASE IF EXISTS `dev-stripo`; # CREATE DATABASE `dev-stripo`; # USE `dev-stripo`; # End Local Development Only -- Table Email DROP TABLE IF EXISTS email; CREATE TABLE IF NOT EXISTS email ( id VARCHAR(255) NOT NULL UNIQUE, id_bpm VARCHAR(255) NOT NULL, name VARCHAR(255) DEFAULT NULL, html TEXT DEFAULT NULL, css TEXT DEFAULT NULL, html_css TEXT DEFAULT NULL, isTemplate TINYINT UNSIGNED NOT NULL DEFAULT 0, created_on DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, modified_on DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, CONSTRAINT pk_email_id PRIMARY KEY(id) )ENGINE=InnoDb; -- Table Increment Email DROP TABLE IF EXISTS increment_email_id; CREATE TABLE IF NOT EXISTS increment_email_id ( id INT UNSIGNED NOT NULL AUTO_INCREMENT, last_increment INT UNSIGNED NOT NULL DEFAULT 0, CONSTRAINT pk_increment_email_id_id PRIMARY KEY(id) )ENGINE=InnoDb; -- Tabel Config Stripo DROP TABLE IF EXISTS config_stripo; CREATE TABLE IF NOT EXISTS config_stripo ( id INT UNSIGNED NOT NULL AUTO_INCREMENT, project_name VARCHAR(255), website VARCHAR(255), subscription_plan VARCHAR(255), creation_date DATE DEFAULT NULL, subscription_price DOUBLE(12,2) UNSIGNED DEFAULT NULL, pluginId VARCHAR(255), secretKey VARCHAR(255), CONSTRAINT pk_config_stripo_id PRIMARY KEY(id) )ENGINE=InnoDb; -- Tabel Token Akses DROP TABLE IF EXISTS access_token; CREATE TABLE IF NOT EXISTS access_token ( id INT UNSIGNED NOT NULL AUTO_INCREMENT, token TEXT, CONSTRAINT pk_access_token_id PRIMARY KEY(id) )ENGINE=InnoDb; -- Tabel Merge Tags -- Tabel Detail Merge Tags -- Function get last increment DROP FUNCTION IF EXISTS f_get_increment; delimiter // CREATE FUNCTION f_get_increment() RETURNS int DETERMINISTIC BEGIN DECLARE last_increment_param int; SELECT last_increment INTO last_increment_param FROM increment_email_id LIMIT 1; UPDATE increment_email_id SET last_increment = (last_increment_param + 1); RETURN (last_increment_param + 1); END // delimiter ; -- Seeder Config Stripo INSERT INTO config_stripo (project_name, website, subscription_plan, creation_date, subscription_price, pluginId, secretKey) VALUES -- plugin untuk dev ("PT. Inter Sistem Asia", "https://demo.lordraze.com/dev-stripo/", "FREE", "2018-08-29", 0, "8b2383303661484292deaa9bba011f7b", "34ce9da390fc49bfbd236930a29d233f"), -- plugin untuk production ("bpmonline", "http://bpmonline.asia/", "STARTUP", "2018-09-18", 100, "18f2ef44142243efa50045d535486cd6", "201eafe108614367848c4f6dcb566287"); -- Seeder Access Token INSERT INTO access_token (token) VALUES ('$2y$10$EFgwO03XRKtRd1Ca/3A02OWliR8FPCgIktNoYhkiT3VveqfBgrFa2'); -- Seeder Increment Email Id INSERT INTO increment_email_id (last_increment) VALUES (0);
true
7dc27daa4dc84c5743a1f3404235089722d5a3f3
SQL
pr-intellisolutions/motorcycle-insurance
/db/prmi.sql
UTF-8
19,769
2.9375
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 4.2.11 -- http://www.phpmyadmin.net -- -- Host: 127.0.0.1 -- Generation Time: Oct 04, 2015 at 06:46 AM -- Server version: 5.6.21 -- PHP Version: 5.6.3 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8 */; -- -- Database: `prmi` -- -- -------------------------------------------------------- -- -- Table structure for table `activations` -- CREATE TABLE IF NOT EXISTS `activations` ( `id` int(11) unsigned NOT NULL, `userid` int(11) unsigned NOT NULL, `token` varchar(256) NOT NULL, `request` date NOT NULL, `expiration` int(11) NOT NULL ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Table structure for table `config` -- CREATE TABLE IF NOT EXISTS `config` ( `id` int(11) NOT NULL, `site_name` varchar(64) NOT NULL, `site_desc` varchar(128) NOT NULL, `site_host` varchar(64) NOT NULL, `site_module` varchar(64) NOT NULL, `user_minlen` int(11) NOT NULL, `user_maxlen` int(11) NOT NULL, `user_complexity` enum('alphanumeric','alphanumeric with spacers','','') NOT NULL, `pass_minlen` int(11) NOT NULL, `pass_maxlen` int(11) NOT NULL, `pass_complexity` enum('simple','normal','strong','') NOT NULL, `pass_expiration` int(11) NOT NULL, `max_login_attempts` int(11) NOT NULL, `activation_req` tinyint(1) NOT NULL ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1; -- -- Dumping data for table `config` -- INSERT INTO `config` (`id`, `site_name`, `site_desc`, `site_host`, `site_module`, `user_minlen`, `user_maxlen`, `user_complexity`, `pass_minlen`, `pass_maxlen`, `pass_complexity`, `pass_expiration`, `max_login_attempts`, `activation_req`) VALUES (1, 'Puerto Rico Motorcycle Road Assistance Services', '', '127.0.0.1', '/motorcycle-insurance/', 5, 24, 'alphanumeric with spacers', 4, 32, 'normal', 60, 4, 0); -- -------------------------------------------------------- -- -- Table structure for table `login` -- CREATE TABLE IF NOT EXISTS `login` ( `id` int(11) unsigned NOT NULL DEFAULT '0', `user` varchar(32) NOT NULL, `pass` varchar(256) NOT NULL, `email` varchar(128) NOT NULL, `role` enum('admin','provider','user') DEFAULT 'user', `regdate` datetime NOT NULL, `lastvisit` datetime NOT NULL, `lastip` varchar(32) NOT NULL, `lastbrowser` varchar(128) NOT NULL, `ip` varchar(32) NOT NULL, `browser` varchar(128) NOT NULL, `session` varchar(256) NOT NULL, `token` varchar(256) NOT NULL, `expired` tinyint(1) NOT NULL DEFAULT '0', `disabled` tinyint(1) NOT NULL DEFAULT '0', `active` tinyint(4) NOT NULL, `passchg` tinyint(1) NOT NULL DEFAULT '0', `passdate` datetime NOT NULL, `login_attempts` int(11) NOT NULL DEFAULT '0', `permissions` varchar(128) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `login` -- INSERT INTO `login` (`id`, `user`, `pass`, `email`, `role`, `regdate`, `lastvisit`, `lastip`, `lastbrowser`, `ip`, `browser`, `session`, `token`, `expired`, `disabled`, `active`, `passchg`, `passdate`, `login_attempts`, `permissions`) VALUES (7816, 'qwerty', '$2y$11$rImxCU0KbEq.cuM0Qgd2N.5osl4.feKg9Mk5pRp9SyUTTqhC8l20i', 'qwerty', 'user', '2015-09-22 20:43:17', '2015-09-22 20:43:18', '::1', 'Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; Touch; rv:11.0) like Gecko', '::1', 'Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; Touch; rv:11.0) like Gecko', 'jp7fll4ef897884abvpfjaoaj4', '', 0, 0, 1, 0, '2015-11-21 20:43:17', 0, 'none'), (12854, 'admin', '$2y$11$dFeJ1Fu3kLdCU0pd.0kVP.j0y2UhKO/P8rGZClyPqzJpMdZ1MWscy', 'dennis.borrerotorres@gmail.com', 'admin', '2015-02-02 23:37:12', '2015-10-03 23:40:26', '127.0.0.1', 'Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; Touch; rv:11.0) like Gecko', '127.0.0.1', 'Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; Touch; rv:11.0) like Gecko', 'qmkebed37192dtuomaea2hd1j6', 'd4c41c9df9297866756b42514a4806c224c93541', 0, 0, 1, 0, '2015-11-12 15:32:04', 0, 'all'), (39824, 'test', '$2y$11$jcWj3x8AxQdATeO4Gj4oYuLG0vybEbAllN/FSonjFNk6JiTBaVYYG', 'test@gmail.com', 'user', '2015-08-09 19:56:07', '2015-09-29 19:28:27', '127.0.0.1', 'Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; Touch; rv:11.0) like Gecko', '127.0.0.1', 'Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; Touch; rv:11.0) like Gecko', 'pcmc15b6a7u5sjj4gh48e5m8p1', '27dd2f6dc6b3d94c36e33e86c1a12947b97982dc', 0, 0, 1, 0, '2015-10-08 19:56:07', 0, 'none'), (40910, 'test1', '$2y$11$nugNWYRQ.HMnJ764NOi4Euqp8uzngPhIDJ5Aa..fUYOSBllRv4o7O', 'test', 'user', '2015-09-22 20:49:31', '2015-09-22 20:49:31', '::1', 'Mozilla/5.0 (Windows NT 6.3; WOW64; rv:38.0) Gecko/20100101 Firefox/38.0', '::1', 'Mozilla/5.0 (Windows NT 6.3; WOW64; rv:38.0) Gecko/20100101 Firefox/38.0', 'kohtv0n82olbljivhj7a99rq32', '', 0, 0, 1, 0, '2015-11-21 20:49:31', 0, 'none'), (48752, 'dborrero', '$2y$11$7NI64MwCZf6doF4H/qAiJO9gN6kIHZaRx5hC4fgTfLmHBVEvbumi2', 'my@email.com', 'admin', '2015-08-08 09:37:50', '2015-08-08 13:12:50', '::1', 'Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0) like Gecko', '::1', 'Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; Touch; rv:11.0) like Gecko', 'j8t3dkvvraku0722e7p0kbvhs4', '', 0, 0, 1, 0, '2015-10-07 19:14:23', 3, 'all'), (50807, 'provider', '$2y$11$8Bp/psg/cyA25Chr87pkju.VPWwYzzMcryNqwHrLAu5TUdj/UAKdu', 'provider', 'provider', '2015-08-08 18:00:45', '0000-00-00 00:00:00', '', '', '::1', 'Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; Touch; rv:11.0) like Gecko', 'j8t3dkvvraku0722e7p0kbvhs4', '', 0, 0, 1, 0, '2015-10-07 18:00:45', 0, 'none'); -- -------------------------------------------------------- -- -- Table structure for table `orders` -- CREATE TABLE IF NOT EXISTS `orders` ( `id` int(11) unsigned NOT NULL, `customer_id` int(11) unsigned NOT NULL, `provider_id` int(11) unsigned NOT NULL, `vehicle_id` int(11) unsigned NOT NULL, `description` varchar(128) NOT NULL, `area` varchar(64) NOT NULL, `city` varchar(64) NOT NULL, `order_date` datetime NOT NULL, `dest_area` varchar(64) NOT NULL, `dest_city` varchar(64) NOT NULL, `estimated_miles` int(11) NOT NULL ) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=latin1; -- -- Dumping data for table `orders` -- INSERT INTO `orders` (`id`, `customer_id`, `provider_id`, `vehicle_id`, `description`, `area`, `city`, `order_date`, `dest_area`, `dest_city`, `estimated_miles`) VALUES (10, 39824, 11, 3, 'Se quedo sin gasolina.', '', '', '2015-10-04 00:15:24', '', '', 0); -- -------------------------------------------------------- -- -- Table structure for table `plans` -- CREATE TABLE IF NOT EXISTS `plans` ( `id` int(11) unsigned NOT NULL, `name` varchar(64) NOT NULL, `title` varchar(64) NOT NULL, `description` varchar(128) NOT NULL, `num_occurrences` int(11) NOT NULL, `num_miles` int(11) NOT NULL, `num_vehicles` int(11) NOT NULL, `plan_price` decimal(5,2) NOT NULL, `mile_price` decimal(5,2) NOT NULL, `extend_price` decimal(5,2) NOT NULL, `term` int(11) NOT NULL, `active` tinyint(1) NOT NULL, `date_entered` datetime NOT NULL, `last_modify` datetime NOT NULL ) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=latin1; -- -- Dumping data for table `plans` -- INSERT INTO `plans` (`id`, `name`, `title`, `description`, `num_occurrences`, `num_miles`, `num_vehicles`, `plan_price`, `mile_price`, `extend_price`, `term`, `active`, `date_entered`, `last_modify`) VALUES (14, 'basico', 'Servicio Básico', 'Incluye 4 ocurrencias en adición 50 millas de remolque', 4, 50, 3, '60.00', '3.00', '30.00', 12, 1, '2015-07-28 21:37:01', '2015-09-30 18:18:18'), (15, 'extendido', 'Servicio Extendido', 'Incluye 4 ocurrencias en adición 100 millas de remolque', 4, 100, 3, '90.00', '3.00', '45.00', 12, 1, '2015-07-28 21:45:00', '2015-09-30 18:18:32'); -- -------------------------------------------------------- -- -- Table structure for table `profile` -- CREATE TABLE IF NOT EXISTS `profile` ( `id` int(11) unsigned NOT NULL, `userid` int(11) unsigned NOT NULL, `first` varchar(32) NOT NULL, `middle` varchar(32) NOT NULL, `last` varchar(32) NOT NULL, `maiden` varchar(32) NOT NULL, `phone` varchar(18) NOT NULL, `address1` varchar(64) NOT NULL, `address2` varchar(64) NOT NULL, `city` varchar(64) NOT NULL, `state` varchar(64) NOT NULL, `zip` varchar(18) NOT NULL, `country` varchar(64) NOT NULL ) ENGINE=InnoDB AUTO_INCREMENT=1039 DEFAULT CHARSET=latin1; -- -- Dumping data for table `profile` -- INSERT INTO `profile` (`id`, `userid`, `first`, `middle`, `last`, `maiden`, `phone`, `address1`, `address2`, `city`, `state`, `zip`, `country`) VALUES (1016, 12854, 'Dennis', 'J.', 'Borrero', 'Torres', '(224) 321-7628', 'Urb. Santa Teresita', '6109 Calle San Claudio', 'Ponce', 'PR', '00731', 'Puerto Rico'), (1020, 48752, 'Dennis', 'J', 'Borrero', 'Torres', '', '', '', '', '', '', ''), (1030, 50807, 'Rubeli', '', 'Ortiz', '', '', '', '', '', '', '', ''), (1031, 39824, 'cuenta', 'de', 'prueba', '', '', '', '', '', '', '', ''), (1037, 7816, '', '', '', '', '', '', '', '', '', '', ''), (1038, 40910, 'test', '', 'test', '', 'test', '', '', '', '', '', ''); -- -------------------------------------------------------- -- -- Table structure for table `providers` -- CREATE TABLE IF NOT EXISTS `providers` ( `id` int(11) unsigned NOT NULL, `userid` int(11) unsigned NOT NULL, `profile_id` int(11) unsigned NOT NULL, `companyName` varchar(64) NOT NULL, `companyPhone` varchar(18) NOT NULL, `companyEmail` varchar(128) NOT NULL, `area` enum('central','este','norte','noreste','noroeste','oeste','sur','sureste','suroeste') NOT NULL, `companyAddress1` varchar(64) NOT NULL, `companyAddress2` varchar(64) NOT NULL, `city` varchar(64) NOT NULL, `zip` varchar(18) NOT NULL, `country` varchar(64) NOT NULL ) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=latin1; -- -- Dumping data for table `providers` -- INSERT INTO `providers` (`id`, `userid`, `profile_id`, `companyName`, `companyPhone`, `companyEmail`, `area`, `companyAddress1`, `companyAddress2`, `city`, `zip`, `country`) VALUES (11, 50807, 1030, 'Transporte Rubeli Ortiz', '787 698 4545', 'rubeli.ortiz@gmail.com', 'norte', 'Urb. Lomas Verdes', 'Pepe', 'Bayamon', '009322', 'Puerto Rico'); -- -------------------------------------------------------- -- -- Table structure for table `reset` -- CREATE TABLE IF NOT EXISTS `reset` ( `id` int(11) unsigned NOT NULL, `userid` int(11) unsigned NOT NULL, `token` varchar(256) NOT NULL ) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Table structure for table `sales` -- CREATE TABLE IF NOT EXISTS `sales` ( `id` int(11) unsigned NOT NULL, `userid` int(11) unsigned NOT NULL, `plan_id` int(11) unsigned NOT NULL, `transaction` varchar(128) NOT NULL, `method` enum('PayPal','Visa','Mastercard','Check') NOT NULL, `amount` decimal(5,2) NOT NULL, `date` datetime NOT NULL ) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=latin1; -- -- Dumping data for table `sales` -- INSERT INTO `sales` (`id`, `userid`, `plan_id`, `transaction`, `method`, `amount`, `date`) VALUES (1, 12854, 14, '0BR99752Y1905570X', 'PayPal', '60.00', '2015-09-24 16:07:18'), (11, 39824, 14, '5D130364R19716613', 'PayPal', '60.00', '2015-09-27 14:56:30'), (12, 39824, 14, '94J89708662348150', 'PayPal', '60.00', '2015-09-28 16:45:11'), (16, 39824, 15, '1L5517513K5927159', 'PayPal', '135.00', '2015-09-29 20:08:45'), (17, 39824, 14, '1Y762571TK691962F', 'PayPal', '60.00', '2015-09-29 20:09:39'), (18, 39824, 15, '2EC795260R249471F', 'PayPal', '135.00', '2015-09-29 20:11:17'), (19, 39824, 15, '8RK98484LS281323X', 'PayPal', '90.00', '2015-09-29 20:12:19'), (20, 39824, 15, '8MJ81644DH987081G', 'PayPal', '135.00', '2015-09-29 20:23:38'), (21, 39824, 15, '9GC263306A4615315', 'PayPal', '90.00', '2015-09-29 20:24:28'), (22, 12854, 15, '5G904858NU9923321', 'PayPal', '180.00', '2015-09-30 18:19:24'); -- -------------------------------------------------------- -- -- Table structure for table `services` -- CREATE TABLE IF NOT EXISTS `services` ( `id` int(11) unsigned NOT NULL, `userid` int(11) unsigned NOT NULL, `plan_id` int(11) unsigned NOT NULL, `occurrence_counter` int(11) NOT NULL, `miles_counter` int(11) NOT NULL, `vehicle_counter` int(11) NOT NULL, `max_vehicles` int(11) NOT NULL, `renewal` tinyint(1) NOT NULL, `reg_date` date NOT NULL, `exp_date` date NOT NULL ) ENGINE=InnoDB AUTO_INCREMENT=38 DEFAULT CHARSET=latin1; -- -- Dumping data for table `services` -- INSERT INTO `services` (`id`, `userid`, `plan_id`, `occurrence_counter`, `miles_counter`, `vehicle_counter`, `max_vehicles`, `renewal`, `reg_date`, `exp_date`) VALUES (26, 39824, 14, 3, 0, 2, 2, 0, '0000-00-00', '2016-09-26'), (33, 39824, 14, 0, 0, 1, 1, 0, '2015-09-28', '2016-09-28'), (34, 39824, 15, 0, 0, 0, 2, 0, '2015-09-29', '2016-09-29'), (35, 39824, 15, 0, 0, 0, 2, 0, '2015-09-29', '2016-09-29'), (36, 39824, 15, 0, 0, 0, 1, 0, '2015-09-29', '2016-09-29'), (37, 12854, 15, 0, 0, 1, 3, 0, '2015-09-30', '2016-09-30'); -- -------------------------------------------------------- -- -- Table structure for table `vehicles` -- CREATE TABLE IF NOT EXISTS `vehicles` ( `id` int(11) unsigned NOT NULL, `userid` int(11) unsigned NOT NULL, `service_id` int(11) unsigned NOT NULL, `type` enum('carro','motora','lancha','bote') NOT NULL, `model` varchar(64) NOT NULL, `brand` varchar(64) NOT NULL, `year` int(11) NOT NULL, `plate` varchar(8) NOT NULL, `serial` varchar(128) NOT NULL ) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1; -- -- Dumping data for table `vehicles` -- INSERT INTO `vehicles` (`id`, `userid`, `service_id`, `type`, `model`, `brand`, `year`, `plate`, `serial`) VALUES (3, 39824, 26, 'motora', 'Yokohama', 'SD-232', 2014, '123-DFD', 'qwertyu6543wsdfg'), (4, 39824, 26, 'motora', 'Yokohama', 'WQWE-21', 1998, '643-121', 'BNM53jklsdfJK'), (5, 39824, 33, 'motora', 'Ducatti', 'Italia-21', 2015, '453-3232', 'wqaefsgjkfs123'), (6, 12854, 37, 'motora', 'Ducatti', 'Italia-4452', 2015, '123-DFR', 'QWERXFVB567'); -- -- Indexes for dumped tables -- -- -- Indexes for table `activations` -- ALTER TABLE `activations` ADD PRIMARY KEY (`id`), ADD KEY `userid` (`userid`); -- -- Indexes for table `config` -- ALTER TABLE `config` ADD PRIMARY KEY (`id`); -- -- Indexes for table `login` -- ALTER TABLE `login` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `user` (`user`), ADD UNIQUE KEY `id` (`id`); -- -- Indexes for table `orders` -- ALTER TABLE `orders` ADD PRIMARY KEY (`id`), ADD KEY `customer_id` (`customer_id`,`provider_id`), ADD KEY `provider_id` (`provider_id`), ADD KEY `vehicle_id` (`vehicle_id`); -- -- Indexes for table `plans` -- ALTER TABLE `plans` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `name` (`name`); -- -- Indexes for table `profile` -- ALTER TABLE `profile` ADD PRIMARY KEY (`id`), ADD KEY `profile_ibfk_1` (`userid`); -- -- Indexes for table `providers` -- ALTER TABLE `providers` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `profile_id` (`profile_id`), ADD UNIQUE KEY `userid` (`userid`); -- -- Indexes for table `reset` -- ALTER TABLE `reset` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `userid_2` (`userid`), ADD KEY `userid` (`userid`); -- -- Indexes for table `sales` -- ALTER TABLE `sales` ADD PRIMARY KEY (`id`), ADD KEY `userid` (`userid`,`plan_id`), ADD KEY `plan_id` (`plan_id`); -- -- Indexes for table `services` -- ALTER TABLE `services` ADD PRIMARY KEY (`id`), ADD KEY `userid` (`userid`), ADD KEY `plan_id` (`plan_id`); -- -- Indexes for table `vehicles` -- ALTER TABLE `vehicles` ADD PRIMARY KEY (`id`), ADD KEY `vehicles_ibfk_1` (`userid`), ADD KEY `service_id` (`service_id`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `activations` -- ALTER TABLE `activations` MODIFY `id` int(11) unsigned NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=2; -- -- AUTO_INCREMENT for table `config` -- ALTER TABLE `config` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=2; -- -- AUTO_INCREMENT for table `orders` -- ALTER TABLE `orders` MODIFY `id` int(11) unsigned NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=11; -- -- AUTO_INCREMENT for table `plans` -- ALTER TABLE `plans` MODIFY `id` int(11) unsigned NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=16; -- -- AUTO_INCREMENT for table `profile` -- ALTER TABLE `profile` MODIFY `id` int(11) unsigned NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=1039; -- -- AUTO_INCREMENT for table `providers` -- ALTER TABLE `providers` MODIFY `id` int(11) unsigned NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=12; -- -- AUTO_INCREMENT for table `reset` -- ALTER TABLE `reset` MODIFY `id` int(11) unsigned NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=23; -- -- AUTO_INCREMENT for table `sales` -- ALTER TABLE `sales` MODIFY `id` int(11) unsigned NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=23; -- -- AUTO_INCREMENT for table `services` -- ALTER TABLE `services` MODIFY `id` int(11) unsigned NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=38; -- -- AUTO_INCREMENT for table `vehicles` -- ALTER TABLE `vehicles` MODIFY `id` int(11) unsigned NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=7; -- -- Constraints for dumped tables -- -- -- Constraints for table `activations` -- ALTER TABLE `activations` ADD CONSTRAINT `activations_ibfk_1` FOREIGN KEY (`userid`) REFERENCES `login` (`id`) ON DELETE CASCADE ON UPDATE CASCADE; -- -- Constraints for table `orders` -- ALTER TABLE `orders` ADD CONSTRAINT `orders_ibfk_1` FOREIGN KEY (`customer_id`) REFERENCES `login` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, ADD CONSTRAINT `orders_ibfk_2` FOREIGN KEY (`provider_id`) REFERENCES `providers` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, ADD CONSTRAINT `orders_ibfk_3` FOREIGN KEY (`vehicle_id`) REFERENCES `vehicles` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION; -- -- Constraints for table `profile` -- ALTER TABLE `profile` ADD CONSTRAINT `profile_ibfk_1` FOREIGN KEY (`userid`) REFERENCES `login` (`id`) ON DELETE CASCADE ON UPDATE CASCADE; -- -- Constraints for table `providers` -- ALTER TABLE `providers` ADD CONSTRAINT `providers_ibfk_1` FOREIGN KEY (`profile_id`) REFERENCES `profile` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, ADD CONSTRAINT `providers_ibfk_2` FOREIGN KEY (`userid`) REFERENCES `login` (`id`) ON DELETE CASCADE ON UPDATE CASCADE; -- -- Constraints for table `reset` -- ALTER TABLE `reset` ADD CONSTRAINT `reset_ibfk_1` FOREIGN KEY (`userid`) REFERENCES `login` (`id`) ON DELETE CASCADE ON UPDATE CASCADE; -- -- Constraints for table `sales` -- ALTER TABLE `sales` ADD CONSTRAINT `sales_ibfk_1` FOREIGN KEY (`userid`) REFERENCES `login` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, ADD CONSTRAINT `sales_ibfk_2` FOREIGN KEY (`plan_id`) REFERENCES `plans` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION; -- -- Constraints for table `services` -- ALTER TABLE `services` ADD CONSTRAINT `services_ibfk_1` FOREIGN KEY (`userid`) REFERENCES `login` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, ADD CONSTRAINT `services_ibfk_2` FOREIGN KEY (`plan_id`) REFERENCES `plans` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION; -- -- Constraints for table `vehicles` -- ALTER TABLE `vehicles` ADD CONSTRAINT `vehicles_ibfk_1` FOREIGN KEY (`userid`) REFERENCES `login` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, ADD CONSTRAINT `vehicles_ibfk_2` FOREIGN KEY (`service_id`) REFERENCES `services` (`id`) ON DELETE CASCADE ON UPDATE CASCADE; /*!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
004517f1962b3d5de54199394019dcb1d83d11f6
SQL
hupling/datenbankII
/blatt3/MainArbeiter.sql
UTF-8
1,550
3.265625
3
[]
no_license
SET SERVEROUTPUT ON FORMAT WRAPPED; DECLARE arbeiter_ arbeiter_t; bcode NUMBER; gcode NUMBER; ID NUMBER; arbeiternr varchar2(100); jahre number; BEGIN FOR arbeiter_ IN ( SELECT name, vorname, geburtsmonat,(stundenlohn * 40 * 4 * 12) AS jahresgehalt FROM arbeiter ) LOOP bcode := berufscode_bestimmen('Arbeiter'); gcode := geschlecht_bestimmen(0, arbeiter_.vorname); arbeiternr := arbeiter_.vorname || arbeiter_.geburtsmonat; jahre := 100 + to_char(sysdate, 'YY') - TRIM(SUBSTR(arbeiter_.geburtsmonat, 4, 5)); BEGIN SELECT personalnr INTO ID FROM zuordnungstab WHERE arbeiter_angestelltennr = arbeiternr; update personal set name = arbeiter_.name, vorname = arbeiter_.vorname, "alter" = jahre, geschlecht = gcode, berufscode = bcode, jahreseinkommen = arbeiter_.jahresgehalt where personalnr = ID; EXCEPTION WHEN no_data_found THEN insert into zuordnungstab (system, arbeiter_angestelltennr) values (2, arbeiternr); SELECT personalnr INTO ID FROM zuordnungstab WHERE arbeiter_angestelltennr = arbeiternr; insert into personal values (ID, arbeiter_.name, arbeiter_.vorname, jahre, gcode, bcode, arbeiter_.jahresgehalt); END; delete from arbeiter arbeiter_; END LOOP; END;
true
ba97cb0a5f871e1556432fae6cc5551f5a29aa85
SQL
52YvesMahama/MyDataBAses
/angular.sql
UTF-8
1,755
3.015625
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 4.7.4 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Generation Time: May 10, 2018 at 08:42 PM -- Server version: 10.1.30-MariaDB -- PHP Version: 7.2.1 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: `angular` -- -- -------------------------------------------------------- -- -- Table structure for table `members` -- CREATE TABLE `members` ( `memid` int(11) NOT NULL, `firstname` varchar(30) NOT NULL, `lastname` varchar(30) NOT NULL, `address` text NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `members` -- INSERT INTO `members` (`memid`, `firstname`, `lastname`, `address`) VALUES (1, 'Yves', 'Mahama', 'Kinshasa, DRC'), (2, 'Janvier', 'Pastore', 'Goma, DRC'), (3, 'Noble', 'Noblemaestro', 'Kinshasa, DRC'), (4, 'ngongo', 'estiombo', 'congo'), (5, 'Julian', 'Draxler', 'Nairobi'), (6, 'Adrien', 'Rabiot', 'Congo'), (7, 'Thiago', 'Silver', 'Kenya'); -- -- Indexes for dumped tables -- -- -- Indexes for table `members` -- ALTER TABLE `members` ADD PRIMARY KEY (`memid`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `members` -- ALTER TABLE `members` MODIFY `memid` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8; 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
1751c1a68a0d24f315b95cec2378039148c200a7
SQL
roysouravv30/INFO7370
/AdventureWorks & AdventureWorksDW/DDL Scripts/Inventory_MYSQL.sql
UTF-8
5,569
3.421875
3
[]
no_license
-- -- ER/Studio Data Architect SQL Code Generation -- Project : Adventure Work DW DM1.DM1 -- -- Date Created : Wednesday, September 30, 2020 16:02:46 -- Target DBMS : MySQL 5.x -- -- -- TABLE: DimDate -- CREATE TABLE DimDate( DateKey INT NOT NULL, FullDateAlternateKey DATE NOT NULL, DayNumberOfWeek TINYINT NOT NULL, EnglishDayNameOfWeek NATIONAL VARCHAR(10) NOT NULL, SpanishDayNameOfWeek NATIONAL VARCHAR(10) NOT NULL, FrenchDayNameOfWeek NATIONAL VARCHAR(10) NOT NULL, DayNumberOfMonth TINYINT NOT NULL, DayNumberOfYear SMALLINT NOT NULL, WeekNumberOfYear TINYINT NOT NULL, EnglishMonthName NATIONAL VARCHAR(10) NOT NULL, SpanishMonthName NATIONAL VARCHAR(10) NOT NULL, FrenchMonthName NATIONAL VARCHAR(10) NOT NULL, MonthNumberOfYear TINYINT NOT NULL, CalendarQuarter TINYINT NOT NULL, CalendarYear SMALLINT NOT NULL, CalendarSemester TINYINT NOT NULL, FiscalQuarter TINYINT NOT NULL, FiscalYear SMALLINT NOT NULL, FiscalSemester TINYINT NOT NULL, PRIMARY KEY (DateKey) )ENGINE=MYISAM ; -- -- TABLE: DimProduct -- CREATE TABLE DimProduct( ProductKey INT AUTO_INCREMENT, ProductAlternateKey NATIONAL VARCHAR(25), ProductSubcategoryKey INT, WeightUnitMeasureCode NATIONAL CHAR(3), SizeUnitMeasureCode NATIONAL CHAR(3), EnglishProductName NATIONAL VARCHAR(50) NOT NULL, SpanishProductName NATIONAL VARCHAR(50) NOT NULL, FrenchProductName NATIONAL VARCHAR(50) NOT NULL, StandardCost DECIMAL(19, 4), FinishedGoodsFlag BIT(1) NOT NULL, Color NATIONAL VARCHAR(15) NOT NULL, SafetyStockLevel SMALLINT, ReorderPoint SMALLINT, ListPrice DECIMAL(19, 4), Size NATIONAL VARCHAR(50), SizeRange NATIONAL VARCHAR(50), Weight FLOAT(8, 0), DaysToManufacture INT, ProductLine NATIONAL CHAR(2), DealerPrice DECIMAL(19, 4), Class NATIONAL CHAR(2), Style NATIONAL CHAR(2), ModelName NATIONAL VARCHAR(50), LargePhoto VARBINARY(4000), EnglishDescription NATIONAL VARCHAR(400), FrenchDescription NATIONAL VARCHAR(400), ChineseDescription NATIONAL VARCHAR(400), ArabicDescription NATIONAL VARCHAR(400), HebrewDescription NATIONAL VARCHAR(400), ThaiDescription NATIONAL VARCHAR(400), GermanDescription NATIONAL VARCHAR(400), JapaneseDescription NATIONAL VARCHAR(400), TurkishDescription NATIONAL VARCHAR(400), StartDate DATETIME, EndDate DATETIME, Status NATIONAL VARCHAR(7), PRIMARY KEY (ProductKey) )ENGINE=MYISAM ; -- -- TABLE: DimProductCategory -- CREATE TABLE DimProductCategory( ProductCategoryKey INT AUTO_INCREMENT, ProductCategoryAlternateKey INT, EnglishProductCategoryName NATIONAL VARCHAR(50) NOT NULL, SpanishProductCategoryName NATIONAL VARCHAR(50) NOT NULL, FrenchProductCategoryName NATIONAL VARCHAR(50) NOT NULL, PRIMARY KEY (ProductCategoryKey) )ENGINE=MYISAM ; -- -- TABLE: DimProductSubcategory -- CREATE TABLE DimProductSubcategory( ProductSubcategoryKey INT AUTO_INCREMENT, ProductSubcategoryAlternateKey INT, EnglishProductSubcategoryName NATIONAL VARCHAR(50) NOT NULL, SpanishProductSubcategoryName NATIONAL VARCHAR(50) NOT NULL, FrenchProductSubcategoryName NATIONAL VARCHAR(50) NOT NULL, ProductCategoryKey INT, PRIMARY KEY (ProductSubcategoryKey) )ENGINE=MYISAM ; -- -- TABLE: FactProductInventory -- CREATE TABLE FactProductInventory( ProductKey INT NOT NULL, DateKey INT NOT NULL, MovementDate DATE NOT NULL, UnitCost DECIMAL(19, 4) NOT NULL, UnitsIn INT NOT NULL, UnitsOut INT NOT NULL, UnitsBalance INT NOT NULL, PRIMARY KEY (ProductKey, DateKey) )ENGINE=MYISAM ; -- -- TABLE: DimProduct -- ALTER TABLE DimProduct ADD CONSTRAINT FK_DimProduct_DimProductSubcategory FOREIGN KEY (ProductSubcategoryKey) REFERENCES DimProductSubcategory(ProductSubcategoryKey) ; -- -- TABLE: DimProductSubcategory -- ALTER TABLE DimProductSubcategory ADD CONSTRAINT FK_DimProductSubcategory_DimProductCategory FOREIGN KEY (ProductCategoryKey) REFERENCES DimProductCategory(ProductCategoryKey) ; -- -- TABLE: FactProductInventory -- ALTER TABLE FactProductInventory ADD CONSTRAINT FK_FactProductInventory_DimDate FOREIGN KEY (DateKey) REFERENCES DimDate(DateKey) ; ALTER TABLE FactProductInventory ADD CONSTRAINT FK_FactProductInventory_DimProduct FOREIGN KEY (ProductKey) REFERENCES DimProduct(ProductKey) ;
true
62ad7eed1cafe259d1e34f82d0d7bb6a895d5c50
SQL
APPTeam2/Website
/assets/sql/script-creation-base_Version2 (version phpMyAdmin).sql
UTF-8
5,245
3.34375
3
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
-- phpMyAdmin SQL Dump -- version 4.5.2 -- http://www.phpmyadmin.net -- -- Client : 127.0.0.1 -- Généré le : Jeu 09 Juin 2016 à 14:35 -- Version du serveur : 5.7.9 -- Version de PHP : 5.6.16 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8mb4 */; -- -- Base de données : `festesaip` -- -- -------------------------------------------------------- -- -- Structure de la table `accueillir` -- DROP TABLE IF EXISTS `accueillir`; CREATE TABLE IF NOT EXISTS `accueillir` ( `idArtiste` int(11) NOT NULL, `idFestival` int(11) NOT NULL, PRIMARY KEY (`idArtiste`,`idFestival`), KEY `FK_Accueillir_idFestival` (`idFestival`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -------------------------------------------------------- -- -- Structure de la table `artiste` -- DROP TABLE IF EXISTS `artiste`; CREATE TABLE IF NOT EXISTS `artiste` ( `idArtiste` int(11) NOT NULL AUTO_INCREMENT, `nomArtiste` varchar(25) NOT NULL, PRIMARY KEY (`idArtiste`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -------------------------------------------------------- -- -- Structure de la table `billet` -- DROP TABLE IF EXISTS `billet`; CREATE TABLE IF NOT EXISTS `billet` ( `idBillet` int(11) NOT NULL AUTO_INCREMENT, `nomTitulaire` varchar(25) NOT NULL, `prenomTitulaire` varchar(25) NOT NULL, `idFestival` int(11) NOT NULL, `idUser` int(11) NOT NULL, PRIMARY KEY (`idBillet`), KEY `FK_BILLET_idFestival` (`idFestival`), KEY `FK_BILLET_idUser` (`idUser`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -------------------------------------------------------- -- -- Structure de la table `concert` -- DROP TABLE IF EXISTS `concert`; CREATE TABLE IF NOT EXISTS `concert` ( `idConcert` int(11) NOT NULL AUTO_INCREMENT, `dateConcert` date NOT NULL, `heureDebut` time NOT NULL, `idFestival` int(11) NOT NULL, PRIMARY KEY (`idConcert`), KEY `FK_CONCERT_idFestival` (`idFestival`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -------------------------------------------------------- -- -- Structure de la table `festival` -- DROP TABLE IF EXISTS `festival`; CREATE TABLE IF NOT EXISTS `festival` ( `idFestival` int(11) NOT NULL AUTO_INCREMENT, `theme` varchar(255) DEFAULT NULL, `dateDebut` date NOT NULL, `dateFin` date NOT NULL, PRIMARY KEY (`idFestival`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -------------------------------------------------------- -- -- Structure de la table `jouer` -- DROP TABLE IF EXISTS `jouer`; CREATE TABLE IF NOT EXISTS `jouer` ( `idConcert` int(11) NOT NULL, `idArtiste` int(11) NOT NULL, PRIMARY KEY (`idConcert`,`idArtiste`), KEY `FK_Jouer_idArtiste` (`idArtiste`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -------------------------------------------------------- -- -- Structure de la table `utilisateur` -- DROP TABLE IF EXISTS `utilisateur`; CREATE TABLE IF NOT EXISTS `utilisateur` ( `idUser` int(11) NOT NULL AUTO_INCREMENT, `login` varchar(25) NOT NULL, `password` varchar(255) NOT NULL, `nomUser` varchar(25) NOT NULL, `prenomUser` varchar(25) NOT NULL, `civilite` varchar(25) NOT NULL, `mail` varchar(255) NOT NULL, `actif` tinyint(1) NOT NULL, PRIMARY KEY (`idUser`), UNIQUE KEY `login` (`login`), UNIQUE KEY `mail` (`mail`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -------------------------------------------------------- -- ---------------------------- -- Table structure for contact -- ---------------------------- DROP TABLE IF EXISTS `contact`; CREATE TABLE `contact` ( `pseudo_contact` varchar(255) DEFAULT NULL, `mail_contact` varchar(255) DEFAULT NULL, `titre_contact` varchar(255) DEFAULT NULL, `texte_contact` varchar(255) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Contraintes pour les tables exportées -- -- -- Contraintes pour la table `accueillir` -- ALTER TABLE `accueillir` ADD CONSTRAINT `FK_Accueillir_idArtiste` FOREIGN KEY (`idArtiste`) REFERENCES `artiste` (`idArtiste`), ADD CONSTRAINT `FK_Accueillir_idFestival` FOREIGN KEY (`idFestival`) REFERENCES `festival` (`idFestival`); -- -- Contraintes pour la table `billet` -- ALTER TABLE `billet` ADD CONSTRAINT `FK_BILLET_idFestival` FOREIGN KEY (`idFestival`) REFERENCES `festival` (`idFestival`), ADD CONSTRAINT `FK_BILLET_idUser` FOREIGN KEY (`idUser`) REFERENCES `utilisateur` (`idUser`); -- -- Contraintes pour la table `concert` -- ALTER TABLE `concert` ADD CONSTRAINT `FK_CONCERT_idFestival` FOREIGN KEY (`idFestival`) REFERENCES `festival` (`idFestival`); -- -- Contraintes pour la table `jouer` -- ALTER TABLE `jouer` ADD CONSTRAINT `FK_Jouer_idArtiste` FOREIGN KEY (`idArtiste`) REFERENCES `artiste` (`idArtiste`), ADD CONSTRAINT `FK_Jouer_idConcert` FOREIGN KEY (`idConcert`) REFERENCES `concert` (`idConcert`); /*!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
5a0755780377eac7ee3c03e5875e8a7a0a4b75d4
SQL
RodMal52/proyecto-seguridad
/foro.sql
UTF-8
436
2.59375
3
[]
no_license
-- Crear tablas create table usuarios ( usuario varchar(10) primary key not null, passwd varchar(10) ); create table entradas ( usuario varchar(10), texto varchar(500) ); -- Crear algunos usuarios insert into usuarios values ('jperez', '123456'); insert into usuarios values ('clopez', 'password'); insert into usuarios values ('bjuarez', 'qwerty'); insert into usuarios values ('amartinez', 'abc123');
true
e6b92a00bd1415137c9a8a038fcc8ab46648dfa3
SQL
maclochlainn/adv-plsql-code
/chapter-08/compare_me.sql
UTF-8
1,866
3.453125
3
[]
no_license
/* **************************************************************************** -------------------------------------------------------------------------------- FILENAME: ch_08_utl_sec.sql AUTHOR(S): John M Harper, Michael McLaughlin, Brandon Hawkes, Tyler Hawkes COPYRIGHT: (c) 2014 McLaughlin Software Development LLC. McGraw-Hill use is granted for educational purposes. Commercial use is granted by written consent. Please remit requests to: + john.maurice.harper@mclaughlinsoftware.com + michael.mclaughlin@mclaughlinsoftware.com + tyler.hawkes@mclaughlinsoftware.com + brandon.hawkes@mclaughlinsoftware.com -------------------------------------------------------------------------------- CHANGE_RECORD ================================================================================ DATE INITIALS REASON -------------------------------------------------------------------------------- 05/22/2014 JMH To show users how the jarow_winkler function works. **************************************************************************** */ -- place the englishWordList.dat in your data_pump_dir "or" create a new -- directory. CREATE TABLE EW (COLUMN1 VARCHAR2(20)) ORGANIZATION EXTERNAL ( TYPE ORACLE_LOADER DEFAULT DIRECTORY DATA_PUMP_DIR LOCATION ( DATA_PUMP_DIR: 'englishWordList.dat' ) ) REJECT LIMIT unlimited; CREATE OR REPLACE FUNCTION compare_me ( thing_1 IN VARCHAR2, thing_2 IN VARCHAR2 ) RETURN NUMBER PARALLEL_ENABLE DETERMINISTIC AS BEGIN RETURN utl_match.jaro_winkler_similarity ( NVL ( thing_1, ' ' ), NVL ( thing_2, ' ' )); END; / WITH litmus AS ( SELECT ew1.column1 stuff1 , ew2.column1 stuff2 , compare_me ( ew1.column1, ew2.column1 ) cm FROM ew ew1 cross join ew ew2 WHERE SUBSTR ( ew1.column1, 1, 1 ) IN ( 'a', 'A' ) and SUBSTR ( ew2.column1, 1, 1 ) IN ( 'a', 'A' ) ) SELECT * FROM litmus WHERE cm > 95 ;
true
6bc10a9bacea41ba1e95e3cb22b3a5c008c7306d
SQL
jrlawyer/Querying-with-Transact-SQL
/Examples/5-17_set operators_union, intersect, except.sql
UTF-8
473
3.234375
3
[]
no_license
--Mod 4: --UNION Demo SELECT FirstName, LastName, 'Employee' AS Type FROM SalesLT.Employees UNION ALL SELECT FirstName, LastName, 'Customer' FROM SalesLT.Customer ORDER BY LastName; --INTERSECT Demo SELECT FirstName, LastName FROM SalesLT.Employees INTERSECT SELECT FirstName, LastName FROM SalesLT.Customer ORDER BY LastName; --EXCEPT Demo SELECT FirstName, LastName FROM SalesLT.Employees EXCEPT SELECT FirstName, LastName FROM SalesLT.Customer ORDER BY LastName;
true
80891123ac4c2a3621a87318de5f8c575331423c
SQL
vishnuys/miniattendancetracker
/Attendance/attendance.sql
UTF-8
3,845
3.34375
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 4.2.11 -- http://www.phpmyadmin.net -- -- Host: 127.0.0.1 -- Generation Time: Jul 08, 2015 at 09:05 AM -- Server version: 5.6.21 -- PHP Version: 5.6.3 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8 */; -- -- Database: `attendance` -- -- -------------------------------------------------------- -- -- Table structure for table `attending` -- CREATE TABLE IF NOT EXISTS `attending` ( `cid` int(11) NOT NULL, `sid` varchar(10) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `attending` -- INSERT INTO `attending` (`cid`, `sid`) VALUES (4, '123'), (1, '777'); -- -------------------------------------------------------- -- -- Table structure for table `class` -- CREATE TABLE IF NOT EXISTS `class` ( `name` varchar(15) NOT NULL, `time` time NOT NULL, `id` int(11) NOT NULL ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1; -- -- Dumping data for table `class` -- INSERT INTO `class` (`name`, `time`, `id`) VALUES ('Maths', '10:30:00', 1), ('electronics', '10:30:00', 2), ('biology', '10:30:00', 3), ('Economics', '12:30:00', 4); -- -------------------------------------------------------- -- -- Table structure for table `student` -- CREATE TABLE IF NOT EXISTS `student` ( `name` varchar(20) NOT NULL, `id` varchar(10) NOT NULL, `uname` varchar(20) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `student` -- INSERT INTO `student` (`name`, `id`, `uname`) VALUES ('ABC', '123', 'abc'), ('Dips', '143', 'dips'), ('YSV', '777', '10153339012944718'); -- -------------------------------------------------------- -- -- Table structure for table `user` -- CREATE TABLE IF NOT EXISTS `user` ( `username` varchar(20) NOT NULL, `password` varchar(30) NOT NULL, `usertype` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `user` -- INSERT INTO `user` (`username`, `password`, `usertype`) VALUES ('10153339012944718', 'Sreedhara Murthy', 2), ('716312645179047', 'Deepika Poovaiah', 2), ('988373914546697', 'ವಿಷ್ಣು ವೈ ಎà', 1), ('abc', 'abc', 2), ('dips', 'dips', 2), ('tea', 'tea', 1), ('ysv', 'ysv', 5); -- -- Indexes for dumped tables -- -- -- Indexes for table `attending` -- ALTER TABLE `attending` ADD PRIMARY KEY (`cid`,`sid`), ADD KEY `sid` (`sid`); -- -- Indexes for table `class` -- ALTER TABLE `class` ADD PRIMARY KEY (`id`); -- -- Indexes for table `student` -- ALTER TABLE `student` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `uname_2` (`uname`), ADD KEY `uname` (`uname`); -- -- Indexes for table `user` -- ALTER TABLE `user` ADD PRIMARY KEY (`username`), ADD UNIQUE KEY `username` (`username`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `class` -- ALTER TABLE `class` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=6; -- -- Constraints for dumped tables -- -- -- Constraints for table `attending` -- ALTER TABLE `attending` ADD CONSTRAINT `attending_ibfk_1` FOREIGN KEY (`cid`) REFERENCES `class` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, ADD CONSTRAINT `attending_ibfk_2` FOREIGN KEY (`sid`) REFERENCES `student` (`id`) ON DELETE CASCADE ON UPDATE CASCADE; -- -- Constraints for table `student` -- ALTER TABLE `student` ADD CONSTRAINT `student_ibfk_1` FOREIGN KEY (`uname`) REFERENCES `user` (`username`) ON DELETE CASCADE ON UPDATE CASCADE; /*!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
6de30da55addadb76d96ce0f6993438bbb37a1d9
SQL
john-emry/CSE135_Project
/sql/PrecomputedSalesView.sql
UTF-8
1,518
4.4375
4
[]
no_license
with overall_table as (select pc."ProductID",c."State",sum(CAST(pc."Price" as bigint)*pc."Quantity") as amount from order_history_products pc inner join order_history sc on (sc."OrderHistoryID" = pc."OrderHistoryID") inner join products p on (pc."ProductID" = p."ProductID") -- add category filter if any inner join accounts c on (sc."AccountID" = c."AccountID") group by pc."ProductID",c."State" ), top_state as (select "State", sum(amount) as dollar from ( select "State", amount from overall_table UNION ALL select name as "State", 0.0 as amount from states ) as state_union group by "State" order by dollar desc limit 50 ), top_n_state as (select row_number() over(order by dollar desc) as state_order, "State", dollar from top_state ), top_prod as (select "ProductID", sum(amount) as dollar from ( select "ProductID", amount from overall_table UNION ALL select "ProductID", 0.0 as amount from products ) as product_union group by "ProductID" order by dollar desc limit 50 ), top_n_prod as (select row_number() over(order by dollar desc) as product_order, "ProductID", dollar from top_prod ) select ts."State" as header, tp."ProductID", pr."Name", COALESCE(ot.amount, 0.0) as cell_sum, ts.dollar as totalprice, tp.dollar as productprice from top_n_prod tp CROSS JOIN top_n_state ts LEFT OUTER JOIN overall_table ot ON ( tp."ProductID" = ot."ProductID" and ts."State" = ot."State") inner join products pr ON tp."ProductID" = pr."ProductID" order by ts.state_order, tp.product_order
true
8249b68a24f8aad9caba5f73c15d564815e032a7
SQL
Hiroaki-Inomata/ORCA-5-1
/jma-receipt.r_5_1_branch/sql/4.6/orcadbup_receden_4.6.0-1.sql
UTF-8
563
2.875
3
[]
no_license
-- tbl_receden -- \set ON_ERROR_STOP ALTER TABLE tbl_receden DROP CONSTRAINT tbl_receden_primary_key; alter table tbl_receden add column kohid_key bigint default 0; alter table tbl_receden add column crehms char(6); update tbl_receden set kohid_key = 0; update tbl_receden set crehms = ''; alter table tbl_receden alter column kohid_key set not null; ALTER TABLE ONLY tbl_receden ADD CONSTRAINT tbl_receden_primary_key PRIMARY KEY (hospnum, sryym, nyugaikbn, ptid, receka, teisyutusaki, recesyubetu, hknjanum, hojokbn_key, kohid_key, tekstymd, reckbn, rennum);
true
d9ea37222b111fb5f4bbff5e746af28924d6c311
SQL
baruchoz/hw-week4-day2-sql-mock_theater
/amazon_mock_create.sql
UTF-8
1,276
4.03125
4
[]
no_license
-- Primary Keys can't be empty of duplicated CREATE TABLE customer( customer_id SERIAL PRIMARY KEY, first_name VARCHAR(100), last_name VARCHAR(100), address VARCHAR(150), billing_info VARCHAR(150) ); -- Brand Table Creation CREATE TABLE brand( seller_id SERIAL PRIMARY KEY, brand_name VARCHAR(150), contact_number VARCHAR(15), address VARCHAR(150) ); -- Inventory Table Creation CREATE TABLE inventory( upc SERIAL PRIMARY KEY, product_amount INTEGER ); -- Order Table Creation CREATE TABLE order_( order_id SERIAL PRIMARY KEY, order_date DATE DEFAULT CURRENT_DATE, sub_total NUMERIC(8,2), total_cost NUMERIC(10,2), upc INTEGER NOT NULL, -- NOT NULL CONSTRAINT meaning this can't be empty FOREIGN KEY(upc) REFERENCES inventory(upc) ); -- Product Table Creation CREATE TABLE product( item_id SERIAL PRIMARY KEY, amount NUMERIC(5,2), prod_name VARCHAR(100), seller_id INTEGER NOT NULL, upc INTEGER NOT NULL, FOREIGN KEY(seller_id) REFERENCES brand(seller_id), FOREIGN KEY(upc) REFERENCES inventory(upc) ); -- Cart Table Creation CREATE TABLE cart( cart_id SERIAL PRIMARY KEY, customer_id INTEGER NOT NULL, order_id INTEGER NOT NULL, FOREIGN KEY(customer_id) REFERENCES customer(customer_id), FOREIGN KEY(order_id) REFERENCES order_(order_id) );
true
05eea22ca16330b5f6b8c38fd462b78da2f5519c
SQL
VasilSlavchev/reservation-salles
/reservationsalles.sql
UTF-8
3,366
3.15625
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 4.8.5 -- https://www.phpmyadmin.net/ -- -- Hôte : 127.0.0.1:3306 -- Généré le : ven. 13 déc. 2019 à 20:36 -- Version du serveur : 5.7.26 -- Version de PHP : 7.2.18 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET AUTOCOMMIT = 0; START TRANSACTION; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8mb4 */; -- -- Base de données : `reservationsalles` -- CREATE DATABASE IF NOT EXISTS `reservationsalles` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci; USE `reservationsalles`; -- -------------------------------------------------------- -- -- Structure de la table `reservations` -- DROP TABLE IF EXISTS `reservations`; CREATE TABLE IF NOT EXISTS `reservations` ( `id` int(11) NOT NULL AUTO_INCREMENT, `titre` varchar(255) NOT NULL, `description` text NOT NULL, `debut` datetime NOT NULL, `fin` datetime NOT NULL, `id_utilisateur` int(11) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=17 DEFAULT CHARSET=latin1; -- -- Déchargement des données de la table `reservations` -- INSERT INTO `reservations` (`id`, `titre`, `description`, `debut`, `fin`, `id_utilisateur`) VALUES (1, 'Test', 'Coucou le test', '2019-12-04 10:00:00', '2019-12-05 12:00:00', 1), (2, 'coucou', 'coucou c\'est le test', '2019-12-04 08:00:00', '2019-12-04 09:00:00', 1), (4, 'Test', 'test lol c\'est moi', '2019-12-11 17:00:00', '2019-12-11 18:00:00', 1), (5, 'Test', 'test2 c\'est moi', '2019-12-12 10:00:00', '2019-12-12 12:00:00', 1), (6, 'nico', 'test salut je suis ici !', '2019-12-10 10:00:00', '2019-12-10 12:00:00', 1), (7, 'salut', 'aaaaaaaaaaaa', '2019-12-09 10:00:00', '2019-12-09 12:00:00', 1), (8, 'ezmofjzeofjzmm', 'fzemlfje,ùmf,ef,ùe,', '2019-12-12 09:00:00', '2019-12-12 10:00:00', 1), (10, 'kmfjzesl', 'lmjc,msl', '2019-12-12 11:00:00', '2019-12-12 12:00:00', 1), (11, 'aze', 'azeazeazeaze', '2019-12-13 09:00:00', '2019-12-13 10:00:00', 1), (12, 'test nico', 'aqwzsxaqwzsxaqwzsxaqwzsxaqwzsxaqwzsxaqwzsxaqwzsxaqwzsxaqwzsxaqwzsxaqwzsxaqwzsxaqwzsxaqwzsxaqwzsxaqwzsxaqwzsxaqwzsxaqwzsxaqwzsxaqwzsxaqwzsxaqwzsxaqwzsxaqwzsxaqwzsxaqwzsxaqwzsxaqwzsxaqwzsxaqwzsxaqwzsxaqwzsxaqwzsxaqwzsxaqwzsxaqwzsxaqwzsxaqwzsxaqwzsxaqwzsxaqwzsxaqwzsxaqwzsxaqwzsxaqwzsxaqwzsxaqwzsxaqwzsxaqwzsxaqwzsxaqwzsxaqwzsxaqwzsxaqwzsxaqwzsxaqwzsxaqwzsxaqwzsxaqwzsxaqwzsxaqwzsxaqwzsxaqwzsxaqwzsxaqwzsxaqwzsxaqwzsxaqwzsxaqwzsxaqwzsx', '2019-12-12 18:00:00', '2019-12-12 19:00:00', 3), (14, 'daztafdtya', 'saztdszdfcgs', '2019-12-13 16:00:00', '2019-12-13 19:00:00', 3), (15, 'elsdmk', 'dkmjlz,qc;:', '2019-12-11 09:00:00', '2019-12-11 16:00:00', 1), (16, 'ezkfmleks', 'eyzadguzydyzgdyfyq', '2019-12-16 10:00:00', '2019-12-16 14:00:00', 3); -- -------------------------------------------------------- -- -- Structure de la table `utilisateurs` -- DROP TABLE IF EXISTS `utilisateurs`; CREATE TABLE IF NOT EXISTS `utilisateurs` ( `id` int(11) NOT NULL AUTO_INCREMENT, `login` varchar(255) NOT NULL, `password` varchar(255) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=latin1; -- -- Déchargement des données de la table `utilisateurs` -- INSERT INTO `utilisateurs` (`id`, `login`, `password`) VALUES (1, 'admin', '$2y$12$YhKvC5.Iiga75VqyPmx1bOy0wWOmiiAv/iDUo/.MtUtlrpxUnMEvW'), (2, 'deku', '$2y$12$NfpJ.ld9sBsvcXdd8WGkauDiE8C9lI2RoHzxQOl1aUhqDnbZEkvC.'), (3, 'nico', '$2y$12$ZO7cHh2BdRR.f/rGMf11t.hiJWOwnv2.8F0sTNSLW3ZDSpVV4opxa'), (4, 'pol', '$2y$12$p9oL1TuRMh94MCfMpIi5beeR2X50EgkTSxdfuVH03iB.ZqSg.AkeC'); 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
63d46487077c0b49094c2b84188c194c4d1c863d
SQL
Fernando540/Badass-House
/2-Procedures.sql
UTF-8
18,222
3.03125
3
[]
no_license
use prograbatiz_BadAssHouse; drop procedure if exists valida; drop procedure if exists altaTipo; drop procedure if exists validaSerie; drop procedure if exists registraCasa; drop procedure if exists altadespensuki; drop procedure if exists UsoProducto; drop procedure if exists actualiza; drop procedure if exists BajaProducto; drop procedure if exists dimeTipo; drop procedure if exists relacionaDespensa; drop procedure if exists dimePaquete; drop procedure if exists inventario; drop procedure if exists enchufeState; drop procedure if exists simulaCorriente; drop procedure if exists ingresaProteccion; drop procedure if exists dimeNKA; drop procedure if exists ingresaAltura; drop procedure if exists dimeAltura; drop procedure if exists dimeCuenta; drop procedure if exists altaUsu; drop procedure if exists altaPrivi; drop procedure if exists dimeHab; drop procedure if exists dimeNoti; drop procedure if exists altaNoti; drop procedure if exists activaNoti; drop procedure if exists dimeEstado; drop procedure if exists habiNames; drop procedure if exists changeHabName; drop procedure if exists dimePermiso; drop procedure if exists dimePuertas; drop procedure if exists dimeAbierto; drop procedure if exists abreCierra; drop procedure if exists statusGas; drop procedure if exists flujoGas; delimiter // create procedure valida(in usr nvarchar(45), in pass blob) begin declare msg nvarchar(100); declare nombr nvarchar(30); declare existe int; declare valido int; set existe = (select count(*) from usuarios where correo = usr and contrasenia = pass); if existe = 0 then set msg = '**El usuario NO EXISTE o la CONTRASEÑA es INCORRECTA**'; set valido = 0; else set msg = 'Bienvenido'; set nombr = (select nombre from usuarios where correo = usr); set valido = 1; end if; select valido as Estatus, msg as Respuesta, nombr as nName; end; // create procedure validaSerie(in numeroSerie nvarchar(6)) begin declare estado nvarchar(6); declare mensaje nvarchar(100); set estado=(select idCasa from casa where idCasa=numeroSerie); if estado is not null then set mensaje='Eres cabron'; else set mensaje='ira men no existe ese numero de serie'; end if; select mensaje as resultado ,estado as estaduki; end;// create procedure registraCasa(in adress nvarchar(30),in correito nvarchar(35),in seriuki nvarchar(6)) begin declare noDespensas int; declare coinDesp int; set coinDesp = (select count(*)from relCasaDespensa where idCasa= seriuki); if adress!='' then update casa set direccion = adress where idCasa=seriuki; end if; set noDespensas = (select count(*) from despensa); if noDespensas = 0 then set noDespensas = 1; insert into despensa(idDespensa,estatus) values(noDespensas,'activo'); insert into relCasaDespensa(idCasa,idDespensa) values(seriuki,noDespensas); else set noDespensas = (noDespensas+1); if (coinDesp = 0) then insert into despensa(idDespensa,estatus) values(noDespensas,'activo'); insert into relCasaDespensa(idCasa,idDespensa) values(seriuki,noDespensas); end if; end if; insert into relUsrCasa(Correo,idCasa) values(correito,seriuki); end;// create procedure altadespensuki(in correin nvarchar(35), in barcode nvarchar(35),in nombre nvarchar(35),in alert nvarchar(100)) begin declare iDesp int; declare homeID nvarchar(6); declare total int; declare coincidencia int; declare coinCat int; declare idUnique nvarchar(100); set homeID = (select idCasa from relUsrCasa where Correo = correin); set iDesp = (select idDespensa from relCasaDespensa where idCasa = homeID); set idUnique=CONCAT(homeId,'',barcode); set coinCat = (select count(idUnico) from catalogoProductos where idUnico=idUnique); if (coinCat=0) then insert into catalogoProductos (idUnico,idProducto) values (idUnique,barcode); end if; set coincidencia = (select count(idUnico) from relDespensaProductos where idDespensa=iDesp and idUnico=idUnique); if (coincidencia = 1) then set total = (select cantidad from relDespensaProductos where idDespensa=iDesp and idUnico=idUnique); update relDespensaProductos set cantidad=(total+1) where idDespensa=iDesp and idUnico=idUnique; else if alert='' then insert into relDespensaProductos(idDespensa,idUnico,producto,cantidad) values (iDesp,idUnique,nombre,1); else insert into relDespensaProductos(idDespensa,idUnico,producto,cantidad,aviso) values (iDesp,idUnique,nombre,1,alert); end if; end if; insert into relCasaUsrEvento(idCasa,correo,tipoEvento,evento) values(homeID,correin,1,'Modifico Despensa'); end;// create procedure UsoProducto(in mail nvarchar(35), in codigo nvarchar(35),in canti int) begin declare total int; declare ntotal int; declare iDesp int; declare homeID nvarchar(6); set homeID = (select idCasa from relUsrCasa where Correo = mail); set iDesp = (select idDespensa from relCasaDespensa where idCasa = homeID); set total = (select cantidad from relDespensaProductos where idUnico=codigo and idDespensa=iDesp); if total!=0 then set ntotal = (total-canti); end if; update relDespensaProductos set cantidad=(ntotal) where idUnico=codigo and idDespensa=iDesp; insert into relCasaUsrEvento(idCasa,correo,tipoEvento,evento) values(homeID,mail,1,'Modifico Despensa'); end;// create procedure actualiza(in mail nvarchar(45), in usr nvarchar(45), in ap nvarchar(45), in am nvarchar(45), in opass blob, in npass blob) begin declare existe int; declare msj nvarchar(100); set existe = (select count(*) from usuarios where correo=mail and contrasenia=opass); if existe=1 then set msj='1'; if npass =' ' then update usuarios set nombre = usr, aPaterno = ap, aMaterno = am where Correo = mail and contrasenia = opass; else update usuarios set nombre = usr, aPaterno = ap, aMaterno = am, contrasenia= npass where Correo = mail and contrasenia = opass; end if; else set msj='0'; end if; select msj as mensaje; end; // create procedure altaTipo(in mail nvarchar(35), in tipo nvarchar(20)) begin declare privilegio int(2); if tipo='Premium' then set privilegio=1; insert into relUsrTipo(Correo,idTipo) values(mail,privilegio); else set Privilegio=2; insert into relUsrTipo(Correo,idTipo) values(mail,privilegio); end if; end;// create procedure BajaProducto(in mail nvarchar(35), in codigo nvarchar(35)) begin declare iDesp int; declare homeID nvarchar(6); set homeID = (select idCasa from relUsrCasa where Correo = mail); set iDesp = (select idDespensa from relCasaDespensa where idCasa = homeID); DELETE FROM relDespensaProductos WHERE idDespensa=iDesp and idUnico=codigo; DELETE FROM catalogoproductos WHERE idUnico=codigo; insert into relCasaUsrEvento(idCasa,correo,tipoEvento,evento) values(homeID,mail,1,'Elimino un elemento de la Despensa'); end;// create procedure dimeTipo(in mail nvarchar(35)) begin declare tipo nvarchar(10); set tipo=(select idTipo from relUsrTipo where correo=mail); select tipo as privilegio; end;// create procedure relacionaDespensa(in correo nvarchar(35),in numeroSerie nvarchar(6)) begin declare idRelacion int; declare coincidencia int; declare estado nvarchar(6); set estado=(select serie from numSerie where serie=numeroSerie); set coincidencia=0; if estado is not null then set coincidencia=(select count(*) from relCasaDespensa where idCasa=numeroSerie); if coincidencia<=0 then insert into relCasaDespensa(idRel,idCasa,idDespensa) values(1,numeroSerie,1); else insert into relUsrCasa(correo,idCasa) values(correo,numeroSerie); end if; end if; end;// create procedure dimePaquete(in serie nvarchar(35),in mail nvarchar(35)) begin declare numSerie nvarchar(40); if serie='' then set numSerie=(select idCasa from relUsrCasa where correo=mail); select paquete as pkte from casa where idCasa=numSerie; else select paquete as pkte from casa where idCasa=serie; end if; end;// create procedure inventario(in mail nvarchar(35)) begin declare idCasi nvarchar(6); declare idDespi int(2); set idCasi=(select idCasa from relUsrCasa where correo=mail); set idDespi=(select idDespensa from relCasaDespensa where idCasa=idCasi); select cantidad as numero, idUnico as barcode, producto as produ, aviso as alertuki from relDespensaProductos where idDespensa = idDespi; end;// create procedure enchufeState(in mail nvarchar(35),habiName nvarchar(35)) begin declare idCasi nvarchar(6); declare idHabi int; set idCasi=(select idCasa from relUsrCasa where correo=mail); set idHabi = (select habitaciones.idHabitacion from habitaciones inner join relCasaHab on habitaciones.idHabitacion = relCasaHab.idHabitacion where idCasa=idCasi and habitaciones.nombre=habiName); select enchufes.uso as estatus, enchufes.Nombre as switchName from enchufes inner join relEnchuHab on enchufes.idEnchufe = relEnchuHab.idEnchufe where relEnchuHab.idHabitacion=idHabi; end;// create procedure simulaCorriente(in mailuki nvarchar(35),in corriente int, in contacto nvarchar(30),in habName nvarchar(35)) begin declare homeID nvarchar(6); declare idHabi int; declare idContact int; set homeID = (select idCasa from relUsrCasa where Correo = mailuki); set idHabi = (select habitaciones.idHabitacion from habitaciones inner join relCasaHab on habitaciones.idHabitacion = relCasaHab.idHabitacion where relCasaHab.idCasa=homeID and habitaciones.nombre=habName); set idContact = (select enchufes.idEnchufe from enchufes inner join relEnchuHab on enchufes.idEnchufe = relEnchuHab.idEnchufe where relEnchuHab.idHabitacion=idHabi and enchufes.Nombre=contacto); update enchufes set uso=corriente where idEnchufe=idContact; end;// create procedure statusGas (in correo0 nvarchar(35)) begin declare idHome nvarchar(6); set idHome = (select idCasa from relUsrCasa where Correo = correo0); select llavesGas.usoPpm as estatus, llavesGas.nombre as llaveNombre from llavesGas inner join relLlaves on llavesGas.idLlave = relLlaves.idLlave where relLlaves.idCasa=idHome; end; // create procedure flujoGas (in mail nvarchar(35),in flujoPpm int, in nombreLlave nvarchar(30)) begin declare homeID nvarchar(6); declare idContact int; set homeID = (select idCasa from relUsrCasa where Correo = mail); set idContact = (select llavesGas.idLlave from llavesGas inner join relLlaves on llavesGas.idLlave = relLlaves.idLlave where relLlaves.idCasa=homeID and llavesGas.nombre=nombreLlave); update llavesGas set usoPpm=flujoPpm where idLlave=idContact; end;// create procedure ingresaProteccion(in mail nvarchar(35),in estadots nvarchar(30)) begin declare idCasuki nvarchar(6); declare coin int(2); set idCasuki=(select idCasa from relUsrCasa where correo=mail); set coin=(select count(*) from relCasaNka where idCasa=idCasuki); if coin=0 then if estadots='SI' then insert into relCasaNka(idCasa,estado) values(idCasuki,estadots); else insert into relCasaNka(idCasa,estado) values(idCasuki,'no hay chavots'); end if; end if; end;// create procedure ingresaAltura(in mail nvarchar(35), in heightM nvarchar(3), in heightMin nvarchar(3)) begin declare idCasuki nvarchar(6); set idCasuki=(select idCasa from relUsrCasa where correo=mail); update relCasaNka set alturaMax=heightM where idCasa=idCasuki; update relCasaNka set alturaMin=heightMin where idCasa=idCasuki; end;// create procedure dimeAltura(in mail nvarchar(35)) begin declare idCasuki nvarchar(6); set idCasuki=(select idCasa from relUsrCasa where correo=mail); select alturaMax as alto, alturaMin as bajo from relCasaNka where idCasa=idCasuki; end;// create procedure dimeCuenta(in serie nvarchar(35)) begin declare dir nvarchar(35); declare mensaje nvarchar(100); set dir=(select direccion from casa where idCasa=serie); if dir!='' then set mensaje='Ya hay usuario principal'; else set mensaje='adelante'; end if; select mensaje as msj; end;// create procedure altaUsu(in serie nvarchar(6), in mail nvarchar(35),in pass blob,in nom nvarchar(30), in aPat nvarchar(30), in aMat nvarchar(30), in tipoUsu nvarchar(20),in uldMail nvarchar(35), in passOrig blob) begin declare usuCoin int; declare mensaje nvarchar(100); set usuCoin=(select count(*) from usuarios where correo=uldMail and contrasenia=passOrig); if usuCoin=0 then set mensaje='contra invalida'; else insert into usuarios(Correo,contrasenia,nombre,aPaterno,aMaterno) values(mail,pass,nom,aPat,aMat); call registraCasa('',mail,serie); call altaTipo(mail,tipoUsu); set mensaje='alta'; end if; select mensaje as msj; end;// create procedure altaPrivi(in mail nvarchar(35),in habName nvarchar(35), in permixo nvarchar(10)) begin declare contador int; declare homeID nvarchar(6); declare roomID int; set homeID=(select idCasa from relUsrCasa where correo=mail); set roomID = (select habitaciones.idHabitacion from habitaciones inner join relCasaHab on habitaciones.idHabitacion = relCasaHab.idHabitacion where idCasa=homeID and habitaciones.nombre=habName); set contador=(select count(*) from privilegios where idHabitacion=roomID and correoJunior=mail); if contador=0 then insert into privilegios(idHabitacion,correoJunior, permiso) values(roomID,mail,permixo); else if permixo!='' then update privilegios set permiso=permixo where idHabitacion=roomID; end if; end if; end;// create procedure dimeHab(in mail nvarchar(35)) begin declare idCasuki nvarchar(6); set idCasuki=(select idCasa from relUsrCasa where correo=mail); select idHabitacion as habi from relCasaHab where idCasa=idCasuki; end;// create procedure dimeNoti(in mail nvarchar(35),in tipo nvarchar(20), in idTipo int(2)) begin declare activate nvarchar(100); declare idCasuki nvarchar(6); set idCasuki=(select idCasa from relUsrCasa where correo=mail); set activate=(select estado from notificaciones where idCasa=idCasuki and evento=tipo); if activate='activado'then select correo as correin, evento as que, fecha as prueba from relCasaUsrEvento where idCasa=idCasuki and tipoEvento=idTipo; else select '' as correin, '' as que, '' as prueba; end if; end;// create procedure activaNoti(in mail nvarchar(35),tipo nvarchar(20)) begin declare idCasuki nvarchar(6); declare estaduki nvarchar(100); set idCasuki=(select idCasa from relUsrCasa where correo=mail); if tipo='Despensa' then set estaduki=(select estado from notificaciones where idCasa=idCasuki and evento=tipo); if estaduki='activado' then update notificaciones set estado='desactivado' where idCasa=idCasuki and evento=tipo; else update notificaciones set estado='activado' where idCasa=idCasuki and evento=tipo; end if; else set estaduki=(select estado from notificaciones where idCasa=idCasuki and evento=tipo); if estaduki='activado' then update notificaciones set estado='desactivado' where idCasa=idCasuki and evento=tipo; else update notificaciones set estado='activado' where idCasa=idCasuki and evento=tipo; end if; end if; end;// create procedure altaNoti(in idCasuki nvarchar(6)) begin declare cuenta int; set cuenta=(select count(*) from notificaciones where idCasuki=idCasa and evento='Despensa'); if cuenta=0 then insert into notificaciones(idCasa,evento,estado) values(idCasuki,'Despensa','activado'); insert into notificaciones(idCasa,evento,estado) values(idCasuki,'ForceClose','activado'); end if; end;// create procedure dimeEstado(in mail nvarchar(35), tipo nvarchar(20)) begin declare idCasuki nvarchar(6); set idCasuki=(select idCasa from relUsrCasa where correo=mail); select estado as estaduki from notificaciones where idCasa=idCasuki and evento=tipo; end;// create procedure habiNames(in mail nvarchar(35)) begin declare idCasi nvarchar(6); set idCasi=(select idCasa from relUsrCasa where correo=mail); select habitaciones.nombre as habiName from habitaciones inner join relCasaHab on habitaciones.idHabitacion = relCasaHab.idHabitacion where relCasaHab.idCasa=idCasi; end;// create procedure changeHabName(in mail nvarchar(35), in oldName nvarchar(35),in newName nvarchar(35)) begin declare homeID nvarchar(6); declare roomID int; set homeID = (select idCasa from relUsrCasa where Correo = mail); set roomID = (select habitaciones.idHabitacion from habitaciones inner join relCasaHab on habitaciones.idHabitacion = relCasaHab.idHabitacion where idCasa=homeID and habitaciones.nombre=oldName); update habitaciones set nombre=newName where idHabitacion=roomID; end;// create procedure dimePermiso(in mail nvarchar(35)) begin select habitaciones.nombre as roomName from privilegios inner join habitaciones on habitaciones.idHabitacion = privilegios.idHabitacion where privilegios.correoJunior=mail and privilegios.permiso='SI'; end;// create procedure dimePuertas(in mail nvarchar(35)) begin declare homeID nvarchar(6); set homeID = (select idCasa from relUsrCasa where Correo = mail); select idPuerta as codigo from relCasaPuertas where idCasa=homeID; end;// create procedure abreCierra(in mail nvarchar(35), id nvarchar(10)) begin declare homeID nvarchar(6); declare state nvarchar(100); set homeID = (select idCasa from relUsrCasa where Correo = mail); set state=(select estado from relCasaPuertas where idCasa=homeID and idPuerta=id); if state='Cerrada' then update relCasaPuertas set estado='Abierta' where idCasa=homeID and idPuerta=id; ##insert into relCasaUsrEvento(idCasa,correo,tipoEvento,evento) values(homeID,correin,2,'Abrio Puerta'); else update relCasaPuertas set estado='Cerrada' where idCasa=homeID and idPuerta=id; ##insert into relCasaUsrEvento(idCasa,correo,tipoEvento,evento) values(homeID,correin,2,'Cerro Puerta'); end if; end;// create procedure dimeAbierto(in mail nvarchar(35), id nvarchar(10)) begin declare homeID nvarchar(6); declare state nvarchar(100); set homeID = (select idCasa from relUsrCasa where Correo = mail); set state=(select estado from relCasaPuertas where idCasa=homeID and idPuerta=id); select state; end;// delimiter ;
true
3c82adf991c167b82eef36ae718f02b8b4a473df
SQL
zuzu-ai/Prototipo1P
/Script.sql
UTF-8
2,862
3.453125
3
[]
no_license
drop database pp; create database pp; use pp; create table cliente( nit_cliente varchar(128) primary key, nombre varchar(128) not null, direccion varchar(128) not null, telefono varchar(128) not null, correo varchar(128) not null )engine=Innodb; create table usuario( id_usuario varchar(128) primary key, nombre_usuario varchar(128) not null, contraseña varchar(128) not null )engine=innodb; create table proveedor( nit_proveedor varchar(128) primary key, nombre_proveedor varchar(128) not null, direccion varchar(128) not null )engine=Innodb; create table inventarios( id_inventario varchar(80) primary key, nombre varchar(80) not null )engine=Innodb; create table producto( id_producto varchar(128) primary key, nombre varchar(128) not null, id_inventario varchar(80) not null, id_proveedor varchar(128) not null, existencias int not null, precio double not null, foreign key (id_proveedor) references proveedor(nit_proveedor), foreign key (id_inventario) references inventarios(id_inventario) )engine=innodb; create table compra_e( id_compra varchar(80) primary key, id_proveedor varchar(128) not null, fecha date not null, foreign key (id_proveedor) references proveedor(nit_proveedor) )engine=innodb; create table compra_d( id_compra varchar(80) primary key, cantidad int not null, producto varchar(80) not null, total double not null, foreign key (id_compra) references compra_e(id_compra) )engine=innodb; create table venta_e( id_venta varchar(80) primary key, id_cliente varchar(128) not null, fecha date not null, foreign key (id_cliente) references cliente(nit_cliente) )engine=innodb; create table venta_d( id_venta varchar(80) primary key, cantidad int not null, producto varchar(80) not null, total double not null, foreign key (id_venta) references venta_e(id_venta) )engine=innodb; create table cuentas( id_cuenta varchar(80) primary key, id_compra varchar(80), id_venta varchar(80), estado_cuenta double, saldo_cuenta double, foreign key (id_compra) references compra_e(id_compra), foreign key (id_venta) references venta_e(id_venta) )engine=innodb; create table informe( id_informe varchar(80) primary key, nombre varchar(80) not null, fecha date not null, compras int not null, id_cuenta varchar(80) not null, saldo double not null, usuario varchar(128) not null, foreign key (id_cuenta) references cuentas(id_cuenta), foreign key (usuario) references usuario(id_usuario) )engine=innodb; /*INSERTS*/ insert into usuario VALUES("1", "admin", "123"); insert into proveedor VALUES("1", "proveedor1", "zona 5"); insert into inventarios VALUES("1", "inventario 1"); insert into producto VALUES("1", "incaparina", "1", "1", 300, 7); insert into producto VALUES("2", "crema dental", "1", "1", 1000, 10); insert into producto VALUES("3", "arroz", "1", "1", 5000, 12); insert into producto VALUES("4", "azucar", "1", "1", 200, 5);
true
a12739bbf53f88f874d3ca7d3b3be0251fb1da0a
SQL
lutece-platform/lutece-auth-module-mylutece-notification
/src/sql/plugins/mylutece/modules/notification/plugin/create_db_mylutece_notification.sql
UTF-8
1,230
2.84375
3
[]
no_license
-- -- Structure for table mylutece_notification -- DROP TABLE IF EXISTS mylutece_notification; CREATE TABLE mylutece_notification ( id_notification INT(11) DEFAULT 0 NOT NULL, id_folder INT(11) DEFAULT 0 NOT NULL, is_read SMALLINT DEFAULT 0 NOT NULL, sender VARCHAR(255) DEFAULT '' NOT NULL, user_guid_receiver VARCHAR(255) DEFAULT '' NOT NULL, object VARCHAR(100) DEFAULT '' NOT NULL, message LONG VARCHAR, date_creation TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL, PRIMARY KEY (id_notification) ); -- -- Structure for table mylutece_notification_folder -- DROP TABLE IF EXISTS mylutece_notification_folder; CREATE TABLE mylutece_notification_folder ( id_folder INT(11) DEFAULT 0 NOT NULL, type_class_name VARCHAR(255) DEFAULT '' NOT NULL, folder_label VARCHAR(100) DEFAULT '' NOT NULL, url_icon VARCHAR(255) DEFAULT '' NOT NULL, user_guid VARCHAR(255) DEFAULT '' NOT NULL, PRIMARY KEY (id_folder) ); -- -- Structure for table mylutece_notification_parameter -- DROP TABLE IF EXISTS mylutece_notification_parameter; CREATE TABLE mylutece_notification_parameter ( parameter_key varchar(100) NOT NULL, parameter_value varchar(100) NOT NULL, PRIMARY KEY (parameter_key) );
true
eeacdba48c929ef795eee5dcdd2e1f601fed3e4a
SQL
closetothe/detdb
/scraper/detonations/data_seed_1.sql
UTF-8
4,572
3.078125
3
[]
no_license
INSERT INTO categories(name) VALUES ('cell size'); -- 1 INSERT INTO details(property_id, value) VALUES (5, '"N2"'), -- 1 (3, '"H2"'), -- 2 (4, '"N2O"'), -- 3 (1, '100.0'), -- 4 (2, '293.0'), -- 5 (6, '1.0'); -- 6 INSERT INTO detonations(name, category_id, file_name, added_by, citation_id, legacy, pressure_id, temperature_id, fuel_id, oxidizer_id, diluent_id, er_id) VALUES ('ja5d', 1, 'ja5d', 'Joe Shepherd', 3, 1, 4, 5, 2, 3, 1, 6); -- 1 INSERT INTO detonation_details(detonation_id, detail_id) VALUES (1, 1), -- 1 (1, 2), -- 2 (1, 3), -- 3 (1, 4), -- 4 (1, 5), -- 5 (1, 6); -- 6 INSERT INTO subcategories(name, category_id) VALUES ('width', 1); -- 1 INSERT INTO detonation_subcategories(detonation_id, subcategory_id) VALUES (1, 1); -- 1 INSERT INTO properties(name, units) VALUES ('percent n2', '%'); -- 8 INSERT INTO properties(name, units) VALUES ('cell width', 'mm'); -- 9 INSERT INTO data_points(column_data, property_id, detonation_id) VALUES ('[50.0, 60.0, 62.0, 70.0]', 8, 1), -- 1 ('[14.0, 31.5, 36.0, 217.5]', 9, 1); -- 2 -- -------------------- -- INSERT INTO details(property_id, value) VALUES (5, '"Air"'), -- 7 (1, '[70.0, 100.0]'), -- 8 (6, '[0.07, 0.39]'); -- 9 INSERT INTO detonations(name, category_id, file_name, added_by, citation_id, legacy, issues, pressure_id, temperature_id, fuel_id, oxidizer_id, diluent_id, er_id) VALUES ('ja5e', 1, 'ja5e', 'Joe Shepherd', 3, 1, 'Assumed units of \'mm\' for \'cell width\'. ', 8, 5, 2, 3, 7, 9); -- 2 INSERT INTO detonation_details(detonation_id, detail_id) VALUES (2, 7), -- 7 (2, 2), -- 8 (2, 3), -- 9 (2, 8), -- 10 (2, 5), -- 11 (2, 9); -- 12 INSERT INTO detonation_subcategories(detonation_id, subcategory_id) VALUES (2, 1); -- 2 INSERT INTO properties(name, units) VALUES ('percent air', '%'); -- 10 INSERT INTO data_points(column_data, property_id, detonation_id) VALUES ('[10.0, 15.0, 20.0, 50.0, 54.0, 60.0, 65.0, 70.0, 72.0, 74.0, 76.0]', 10, 2), -- 3 ('[2.5, 4.0, 3.5, 8.0, 10.0, 14.5, 26.0, 57.0, 89.5, 143.5, 107.0]', 9, 2); -- 4 -- -------------------- -- INSERT INTO details(property_id, value) VALUES (5, '"Ar"'), -- 10 (4, '"O2"'), -- 11 (1, '[26.3, 56.7]'); -- 12 INSERT INTO detonations(name, category_id, file_name, added_by, citation_id, legacy, issues, pressure_id, temperature_id, fuel_id, oxidizer_id, diluent_id, er_id) VALUES ('at33a', 1, 'at33a', 'Joe Shepherd', 5, 1, 'Assumed units of \'mm\' for \'cell width\'. ', 12, 5, 2, 11, 10, 6); -- 3 INSERT INTO detonation_details(detonation_id, detail_id) VALUES (3, 10), -- 13 (3, 2), -- 14 (3, 11), -- 15 (3, 12), -- 16 (3, 5), -- 17 (3, 6); -- 18 INSERT INTO detonation_subcategories(detonation_id, subcategory_id) VALUES (3, 1); -- 3 INSERT INTO properties(name, units) VALUES ('initial pressure', 'atm'); -- 11 INSERT INTO data_points(column_data, property_id, detonation_id) VALUES ('[0.2684, 0.3714, 0.4697, 0.5765]', 11, 3), -- 5 ('[27.18892, 37.62282, 47.58061, 58.39945]', 1, 3), -- 6 ('[6.4531, 4.3233, 3.1982, 2.4519]', 9, 3); -- 7 -- -------------------- -- INSERT INTO detonations(name, category_id, file_name, added_by, citation_id, legacy, issues, pressure_id, temperature_id, fuel_id, oxidizer_id, diluent_id, er_id) VALUES ('at33b', 1, 'at33b', 'Joe Shepherd', 5, 1, 'Assumed units of \'mm\' for \'cell width\'. ', 12, 5, 2, 11, 10, 6); -- 4 INSERT INTO detonation_details(detonation_id, detail_id) VALUES (4, 10), -- 19 (4, 2), -- 20 (4, 11), -- 21 (4, 12), -- 22 (4, 5), -- 23 (4, 6); -- 24 INSERT INTO detonation_subcategories(detonation_id, subcategory_id) VALUES (4, 1); -- 4 INSERT INTO data_points(column_data, property_id, detonation_id) VALUES ('[0.5541, 0.7183, 0.8216]', 11, 4), -- 8 ('[56.13033, 72.76379, 83.22808]', 1, 4), -- 9 ('[2.4516, 1.8428, 1.73]', 9, 4); -- 10 -- -------------------- -- INSERT INTO details(property_id, value) VALUES (6, '0.75'); -- 13 INSERT INTO detonations(name, category_id, file_name, added_by, citation_id, legacy, issues, pressure_id, temperature_id, fuel_id, oxidizer_id, diluent_id, er_id) VALUES ('at33c', 1, 'at33c', 'Joe Shepherd', 5, 1, 'Assumed units of \'mm\' for \'cell width\'. ', 12, 5, 2, 11, 10, 13); -- 5 INSERT INTO detonation_details(detonation_id, detail_id) VALUES (5, 10), -- 25 (5, 2), -- 26 (5, 11), -- 27 (5, 12), -- 28 (5, 5), -- 29 (5, 13); -- 30 INSERT INTO detonation_subcategories(detonation_id, subcategory_id) VALUES (5, 1); -- 5 INSERT INTO data_points(column_data, property_id, detonation_id) VALUES ('[0.6529]', 11, 5), -- 11 ('[66.155]', 1, 5), -- 12 ('[2.3294]', 9, 5); -- 13 -- -------------------- --
true
7f340815d8a87a16d236b5073217b6b8f4b8d57c
SQL
15amitbhagat/farm
/farm.sql
UTF-8
4,671
2.90625
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 5.0.2 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Generation Time: Jan 04, 2021 at 10:20 AM -- Server version: 10.4.14-MariaDB -- PHP Version: 7.4.9 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: `farm` -- -- -------------------------------------------------------- -- -- Table structure for table `customer` -- CREATE TABLE `customer` ( `id` int(11) NOT NULL, `name` varchar(100) NOT NULL, `email` varchar(100) NOT NULL, `password` varchar(250) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `customer` -- INSERT INTO `customer` (`id`, `name`, `email`, `password`) VALUES (1, 'amit kumar', '15amitbhagat@gmail.com', '[object Promise]'), (2, 'amit kumar', 'kumar@gmail.com', '$2a$08$DNolH9DfuN0hITvSyyDsi.e4g6YjzKHvtGZOa6bePHyBm.Eg4W6ia'), (3, 'amit kumar', 'itsshahamit@gmail.com', '$2a$08$nKtS1/cTXnzLUlcOQuBqP.3nXRmtDRCYwt.WiGAf1G.5z4Z8lhdOW'), (4, 'amit kumar', '90amit25@gmail.com', '$2a$08$cX45o2gD9YVqPbIOB51FwuTwBXkFvlQqobImIvnXEE3toZqYSWKUy'), (5, 'shreya', 'tiwari@gmail.com', '$2a$08$tCFvLlEJvhQBJU71lwRSUOiqWge7XqW.Y/xYdaASScnDgX0Xmd16m'), (6, 'amit kumar', 'amit@gmail.com', '$2a$08$jIVBUQIsOhpvFreymlzeUegm8kp3X/j/2vW1ZKH4nvkhibKuawBgC'); -- -------------------------------------------------------- -- -- Table structure for table `farmer` -- CREATE TABLE `farmer` ( `id` int(11) NOT NULL, `name` varchar(100) NOT NULL, `email` varchar(100) NOT NULL, `password` varchar(100) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `farmer` -- INSERT INTO `farmer` (`id`, `name`, `email`, `password`) VALUES (1, 'amit kumar', '2512bhagatamit@gmail.com', '[object Promise]'), (2, 'amit kumar', 'amit@gmail.com', '$2a$08$gXoHItJaCK59wX5ZNwfusuKro6JhNFOt2iEEgPObxA9ByjdazRLVm'), (3, 'amit kumar', '', '$2a$08$iz2VwCkuyMvcGNXb9I9ON./iVo4SOIDs/rXdS1lYJ5fgiaCDUDDKW'), (4, 'amit kumar', 'itsshahamit@gmail.com', '$2a$08$vXtq1di1Xp7y15Q0T2kFjOWTuSeqEisxElO0d2iQQzh9YFHG8R62u'), (5, 'shreya', 'sha@gmail.com', '$2a$08$6ZbxfPyUMTaSdd5ZEwgKMOK.wyw5Ukm8g3LtcXbcrY3l28xTTurUu'), (6, 'sh', 'as@gmail.com', '$2a$08$xKuwTrQ75sFLO/xUlOoglujrlkHWLyxRCeB2QhRwc4jfnD4TDuNGe'); -- -------------------------------------------------------- -- -- Table structure for table `labour` -- CREATE TABLE `labour` ( `id` int(11) NOT NULL, `name` varchar(100) NOT NULL, `email` varchar(100) NOT NULL, `password` varchar(250) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `labour` -- INSERT INTO `labour` (`id`, `name`, `email`, `password`) VALUES (1, 'amit kumar', 'itsshahamit@gmail.com', '[object Promise]'), (2, 'amit kumar', 'sh@gmail.com', '$2a$08$HZ6yQOBJMevDgOxltZ2.D.NOBfYYrYyJdi9y7yYF9GqsR3DIxklMW'), (3, 'amit kumar', '90amit25@gmail.com', '$2a$08$AJEFWJSjj.9HpgX0L.TeIO9rkOdSvQ8oAtyhfGFuzcydmCbPU3mJ6'), (4, 'amit kumar', '18it012amit@ug.cusat.ac.in', '$2a$08$dHgxJYOCVgumIO24ls40r.nwy/jyVQxeuntErxCHmZxpQEg5Y4qXi'), (5, 'shreya', 'tiwari@gmail.com', '$2a$08$g52G4qOUgC4GYI/vNP2K8uXf1lNFnUTGxgdrrReDENr/6FaAcMGEW'); -- -------------------------------------------------------- -- -- Table structure for table `seller` -- CREATE TABLE `seller` ( `id` int(11) NOT NULL, `name` varchar(100) NOT NULL, `email` varchar(100) NOT NULL, `password` varchar(250) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `seller` -- INSERT INTO `seller` (`id`, `name`, `email`, `password`) VALUES (1, 'amit kumar', '18it012amit@ug.cusat.ac.in', '[object Promise]'), (2, 'amit kumar', 'bhagat@gmail.com', '$2a$08$nrekOiMSQRh/FLcvx74Maeoiv.//y4uDkkVpY.IJpxAMjl4gK20l6'), (3, 'amit kumar', 'itsshahamit@gmail.com', '$2a$08$L3YktkBSVEXbg78KnfPJFedeWjyPHkQ0lGq3iDGBBXrjdbPx2cS02'), (4, 'shreya', 'tiwari@gmail.com', '$2a$08$.JMdmIAUSeTtjJPqbrCA2uj7RMFfcWIWfSo4PNSVfehUGVE6r9uDK'); -- -- Indexes for dumped tables -- -- -- Indexes for table `customer` -- ALTER TABLE `customer` ADD PRIMARY KEY (`id`); -- -- Indexes for table `farmer` -- ALTER TABLE `farmer` ADD PRIMARY KEY (`id`); -- -- Indexes for table `labour` -- ALTER TABLE `labour` ADD PRIMARY KEY (`id`); -- -- Indexes for table `seller` -- ALTER TABLE `seller` ADD PRIMARY KEY (`id`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `customer` -- ALTER TABLE `customer` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7; -- -- AUTO_INCREMENT for table `farmer` -- ALTER TABLE `farmer` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7; -- -- AUTO_INCREMENT for table `labour` -- ALTER TABLE `labour` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6; -- -- AUTO_INCREMENT for table `seller` -- ALTER TABLE `seller` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5; COMMIT; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
true
dc519119b9617da97a47fd013db68386dcfeb66f
SQL
Felipeb1003/sql-crowdfunding-lab-onl01-seng-ft-050420
/lib/insert.sql
UTF-8
1,905
2.75
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
INSERT INTO users (id, name, age) VALUES (1, 'Amanda', 7), (2, 'Beto', 9), (3, 'Ilda', 16), (4, 'Alexia', 34), (5, 'Harry', 21), (6, 'Madam', 50), (7, 'Roxy', 18), (8, 'Vixen', 46), (9, 'Detox', 100), (10, 'Mike', 18), (11, 'Gigi', 67), (12, 'Ru', 98), (13, 'Sammy', 10), (14, 'Soraya', 35), (15, 'Diana', 22), (16, 'Jane', 29), (17, 'Dominic', 48), (18, 'Pachamama', 5), (19, 'Leena', 80), (20, 'Katie', 15); INSERT INTO projects (id, title, category, funding_goal, start_date, end_date) VALUES (1, 'How to be successful without really trying', 'theatre', 1000.00, '2020-01-01', '2020-02-01'), (2, 'Autobiography', 'books', 4000.00, '1995-10-03', 'present'), (3, 'The next Hunger Games', 'books', 20000.00, '2018-05-20', '2019-05-20'), (4, 'LGBT Center', 'charity', 10000.00, '2013-12-25', '2020-12-25'), (5, 'Music Scholarship', 'charity', 6000.00, '2016-03-20', '2016-09-20'), (6, 'Download on itunes', 'music', 20.00, '2018-12-30', '2019-12-30'), (7, 'Dogs shelter', 'charity', 2000.00, '2017-10-02', '2018-10-30'), (8, 'At risk youth', 'charity', 8000.00, '2014-06-30', '2016-06-31'), (9, 'I want to travel the world', 'charity', 3000.00, '2015-06-30', '2020-09-30'), (10, 'Young Talents Foundation', 'charity', 50000.00, '2012-03-20', '2020-06-30'); INSERT INTO pledges (id, amount, user_id, project_id) VALUES (1, 10.00, 1, 2), (2, 20.00, 1, 3), (3, 40.00, 1, 4), (4, 50.00, 2, 3), (5, 10.00, 3, 2), (6, 20.00, 4, 4), (7, 40.00, 5, 10), (8, 60.00, 6, 10), (9, 50.00, 7, 9), (10, 700.00, 8, 8), (11, 1000.00, 8, 7), (12, 40.00, 9, 6), (13, 50.00, 9, 3), (14, 50.00, 10, 4), (15, 24.00, 12, 1), (16, 34.00, 11, 1), (17, 12.00, 13, 6), (18, 19.00, 14, 5), (19, 20.00, 15, 5), (20, 40.00, 16, 6), (21, 35.50, 17, 7), (22, 40.00, 18, 8), (23, 60.00, 19, 9), (24, 70.00, 20, 10), (25, 100.00, 20, 4), (26, 40.00, 19, 1), (27, 20.00, 18, 6), (28, 90.00, 17, 9), (29, 230.00, 16, 6), (30, 450.00, 15, 5);
true
76e32c78a98ca2cb15fe98dc5e3a8074d5b6e2b8
SQL
LuyeT/Fantasy_Taverns-mysql
/tables/roles.sql
UTF-8
266
2.671875
3
[]
no_license
CREATE TABLE IF NOT EXISTS `Roles` ( RoleID INT NOT NULL PRIMARY KEY AUTO_INCREMENT, roleName VARCHAR(32), roleDescription VARCHAR(512) ); INSERT INTO Roles (roleName) VALUES ('Admin'), ('Bartender'), ('Chef'), ('Maid'), ('Receptionist'), ('Horse massager');
true
470eb045d031bb799c830056aa883988d187e881
SQL
jdaniel14/GRPIAA-LOAD-OSM
/otros/BD_interna/db_modificacion.sql
UTF-8
3,407
3.84375
4
[]
no_license
--QUERY PARA VER QUE GEOM DE LA RED VIAL ESTAN DENTRO DE UN DISTRITO DO $$DECLARE r record; BEGIN FOR r IN SELECT iddistrito, nombre, geom FROM distrito LOOP BEGIN UPDATE redvial SET idzona = r.iddistrito WHERE ST_Intersects(r.geom, geom); EXCEPTION WHEN OTHERS THEN RAISE WARNING 'Loading of record % failed: %', r.ogc_fid, SQLERRM; END; END LOOP; END$$; --QUERY PARA VER QUE GEOM DE LAS ARISTAS ESTAN DENTRO DE UN DISTRITO DO $$DECLARE r record; BEGIN FOR r IN SELECT iddistrito, nombre, geom FROM distrito LOOP BEGIN UPDATE arista SET iddistrito = r.iddistrito WHERE ST_Intersects(r.geom, geom); EXCEPTION WHEN OTHERS THEN RAISE WARNING 'Loading of record % failed: %', r.ogc_fid, SQLERRM; END; END LOOP; END$$; DO $$DECLARE r record; BEGIN FOR r IN SELECT iddistrito, nombre, geom FROM distrito LOOP BEGIN UPDATE redvial SET idzona = r.iddistrito WHERE ST_Intersects(r.geom, geom); EXCEPTION WHEN OTHERS THEN RAISE WARNING 'Loading of record % failed: %', r.ogc_fid, SQLERRM; END; END LOOP; END$$; DO $$DECLARE r record; BEGIN FOR r IN SELECT iddistrito, nombre, geom FROM distrito LOOP BEGIN UPDATE arista SET iddistrito = r.iddistrito WHERE ST_Intersects(r.geom, geom); EXCEPTION WHEN OTHERS THEN RAISE WARNING 'Loading of record % failed: %', r.ogc_fid, SQLERRM; END; END LOOP; END$$; UPDATE minizona SET longitud = ST_X(ST_CENTROID(geom)), latitud = ST_Y(ST_CENTROID(geom)); INSERT INTO ARISTA_MINIZONA ( IDMINIZONAORIGEN, IDMINIZONADESTINO, DISTANCIA ) SELECT a.idminizona, b.idminizona , ST_DISTANCE(ST_Transform(ST_CENTROID(a.geom), 26986), ST_Transform(ST_CENTROID(b.geom),26986))/1000.0 FROM minizona as a JOIN minizona as b ON ST_TOUCHES(a.geom,b.geom); INSERT INTO GRAFOXDISTRITO ( IDDISTRITO, IDGRAFO) SELECT r.iddistrito, A.grafo FROM distrito D, arista A WHERE D.iddistrito = r.iddistrito AND ST_Intersects(D.geom, A.geom) GROUP BY A.grafo; DO $$DECLARE r record; BEGIN FOR r IN SELECT iddistrito, nombre, geom FROM distrito LOOP BEGIN SELECT r.iddistrito, A.grafo FROM distrito D, arista A WHERE D.iddistrito = r.iddistrito AND ST_Intersects(D.geom, A.geom) GROUP BY A.grafo EXCEPTION WHEN OTHERS THEN RAISE WARNING 'Loading of record % failed: %', r.ogc_fid, SQLERRM; END; END LOOP; END$$; DO $$DECLARE r record; BEGIN FOR r IN SELECT iddistrito FROM distrito LOOP BEGIN INSERT INTO GRAFOXDISTRITO ( IDDISTRITO, IDGRAFO) SELECT r.iddistrito, A.grafo FROM distrito D, arista A WHERE D.iddistrito = r.iddistrito AND ST_Intersects(D.geom, A.geom) GROUP BY A.grafo; EXCEPTION WHEN OTHERS THEN RAISE WARNING 'Loading of record % failed: %', r.iddistrito, SQLERRM; END; END LOOP; END$$; SELECT A.idarista as idarista, N1.latitud as x1, N1.longitud as y1, N2.latitud as x2, N2.longitud as y2 FROM GRAFOXDISTRITO GD, arista A, nodo N1, nodo N2 WHERE GD.iddistrito = 1 AND A.grafo = GD.idgrafo AND A.grafo > 0 AND A.idnodoorigen = N1.idnodo AND A.idnododestino = N2.idnodo; "SELECT A.idarista as idarista, N1.latitud as x1, N1.longitud as y1, N2.latitud as x2, N2.longitud as y2 FROM GRAFOXDISTRITO GD, arista A, nodo N1, nodo N2 WHERE GD.iddistrito = ".$json["id"]." AND A.grafo = GD.idgrafo AND A.grafo > 0 AND A.idnodoorigen = N1.idnodo AND A.idnododestino = N2.idnodo;"
true
3e49c7ed5b6a67177525c14367b24d9e3104d581
SQL
jaffarjawed/demo-dbt
/target/run/demo_dbt/models/staging/my_second_dbt_model.sql
UTF-8
199
2.515625
3
[]
no_license
create or replace view ECOM_DATA.staging.my_second_dbt_model as ( -- Use the `ref` function to select from other models select * from ECOM_DATA.staging.my_first_dbt_model where id = 1 );
true
a39a07159f2422f830cdc0bb49efa11e40092c4d
SQL
DanielJKelly/crfc
/server/src/sql/tables/tables.sql
UTF-8
3,011
3.59375
4
[]
no_license
drop table if exists Lists; create table Lists ( id int not null auto_increment primary key, userid int not null, name varchar(48) not null, isOrdered boolean not null, _created datetime default current_timestamp, _updated datetime default current_timestamp on update current_timestamp ); drop table if exists Movies; create table Movies ( id int not null auto_increment primary key, mdbid int not null unique, title varchar(256) not null, director varchar(128) not null, poster varchar(256), _created datetime default current_timestamp, _updated datetime default current_timestamp on update current_timestamp ); drop table if exists Users; create table Users ( id int not null auto_increment primary key, firstname varchar(48) not null, lastname varchar(48) not null, email varchar(128) not null, username varchar(48) not null, _created datetime default current_timestamp, _updated datetime default current_timestamp on update current_timestamp ); drop table if exists Recommendations; create table Recommendations ( id int not null auto_increment primary key, recommenderid int not null, recipientid int not null, movieid int not null, isSeen boolean default 0, _created datetime default current_timestamp, _updated datetime default current_timestamp on update current_timestamp ); drop table if exists Ratings; create table Ratings ( userid int not null, movieid int not null, rating int not null, _created datetime default current_timestamp, _updated datetime default current_timestamp on update current_timestamp ); alter table Ratings add constraint pk_ratings primary key(userid, movieid); drop table if exists UsersMoviesXref; create table UsersMoviesXref ( userid int not null, movieid int not null, _created datetime default current_timestamp, _updated datetime default current_timestamp on update current_timestamp ); alter table UsersMoviesXref add constraint pk_usersmovies primary key(userid, movieid); drop table if exists Passwords; drop table if exists Passwords; create table Passwords ( id int not null auto_increment primary key, userid char(36) not null, hash varchar(256) not null, _created datetime default current_timestamp, _updated datetime default current_timestamp on update current_timestamp ); drop table if exists ListsMoviesXref; create table ListsMoviesXref ( listid int not null, movieid int not null, ranking int, _created datetime default current_timestamp, _updated datetime default current_timestamp on update current_timestamp ); alter table ListsMoviesXref add constraint pk_listsmovies primary key(listid, movieid); drop table if exists Recrequests; create table Recrequests ( id int not null auto_increment primary key, requesterid int not null, recommenderid int not null, isFulfilled boolean default 0, _created datetime default current_timestamp, _updated datetime default current_timestamp on update current_timestamp );
true
ce63e14b84c7b63acc4cd076fe775dacad494207
SQL
sainathjonnala/Employee_Management_System
/SQL_Dump/employee_management_departments.sql
UTF-8
2,150
2.875
3
[]
no_license
-- MySQL dump 10.13 Distrib 8.0.16, for Win64 (x86_64) -- -- Host: localhost Database: employee_management -- ------------------------------------------------------ -- Server version 8.0.16 /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; SET NAMES utf8 ; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -- -- Table structure for table `departments` -- DROP TABLE IF EXISTS `departments`; /*!40101 SET @saved_cs_client = @@character_set_client */; SET character_set_client = utf8mb4 ; CREATE TABLE `departments` ( `department_id` varchar(8) NOT NULL, `department_name` varchar(15) NOT NULL, PRIMARY KEY (`department_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `departments` -- LOCK TABLES `departments` WRITE; /*!40000 ALTER TABLE `departments` DISABLE KEYS */; INSERT INTO `departments` VALUES ('CMI-01','PGB'),('CMI-02','Facilities'),('CMI-03','ICT'),('CMI-04','HR'),('CMI-05','Finance'),('CMI-06','Management'),('CMI-07','Admin'),('CMI-08','Technical'); /*!40000 ALTER TABLE `departments` 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 2019-07-22 17:40:03
true
9eb1b19eeeb30200b0fe2d0578ea3933bf2b416d
SQL
deyvy10/PlataformaBusqueda
/publikate.sql
UTF-8
10,649
2.984375
3
[ "MIT" ]
permissive
-- phpMyAdmin SQL Dump -- version 4.8.0.1 -- https://www.phpmyadmin.net/ -- -- Servidor: 127.0.0.1 -- Tiempo de generación: 25-09-2018 a las 17:46:53 -- Versión del servidor: 10.1.32-MariaDB -- Versión de PHP: 7.0.30 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET AUTOCOMMIT = 0; START TRANSACTION; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8mb4 */; -- -- Base de datos: `publikate` -- -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `tbl_categoria` -- CREATE TABLE `tbl_categoria` ( `categoria_codigo` int(11) NOT NULL, `categoria_nombre` text ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Volcado de datos para la tabla `tbl_categoria` -- INSERT INTO `tbl_categoria` (`categoria_codigo`, `categoria_nombre`) VALUES (1, 'INFORMATICA'), (2, 'INTERNET'), (3, 'MERCADEO'), (4, 'VENTAS'), (5, 'SERVICIOS FINANCIEROS'), (6, 'RECURSOS HUMANOS'), (7, 'PRODUCCION'), (8, 'INGENIERIA'), (9, 'MANTENIMIENTO'), (10, 'CALL CENTER'), (11, 'SALUD'), (12, 'RESTAURANTES'), (13, 'TELECOMUNICACIONES'), (14, 'ALMACENAMIENTO'), (15, 'LOGISTICA'), (16, 'COMPRAS'), (17, 'CONTABILIDAD'), (18, 'JARDINERIA'), (19, 'ELECTRICIDAD'), (20, 'MECANICA AUTOMOTRIZ'); -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `tbl_ciudad` -- CREATE TABLE `tbl_ciudad` ( `ciudad_codigo` int(11) NOT NULL, `ciudad_nombre` text ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Volcado de datos para la tabla `tbl_ciudad` -- INSERT INTO `tbl_ciudad` (`ciudad_codigo`, `ciudad_nombre`) VALUES (1, 'LA CEIBA'), (2, 'SAN PEDRO SULA'), (3, 'TEGUCIGALPA'); -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `tbl_empresa` -- CREATE TABLE `tbl_empresa` ( `empresa_codigo` int(11) NOT NULL, `empresa_nombre` text, `empresa_rtn` varchar(45) DEFAULT NULL, `ciudad_codigo` int(11) DEFAULT NULL, `categoria_codigo` int(11) DEFAULT NULL, `empresa_descripcion` text, `empresa_direccion` text, `empresa_correo` text, `empresa_horario` text ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Volcado de datos para la tabla `tbl_empresa` -- INSERT INTO `tbl_empresa` (`empresa_codigo`, `empresa_nombre`, `empresa_rtn`, `ciudad_codigo`, `categoria_codigo`, `empresa_descripcion`, `empresa_direccion`, `empresa_correo`, `empresa_horario`) VALUES (1, 'Nintendo', '10230450440', 2, 2, 'en la primera versión de la novela aparecen dilatadas descripciones acerca de la mala vida de la ciudad; el sistema más utilizado en las descripciones de personas es el que pasa de la descripción de la cabeza, al cuello, tronco, piernas y pies, o en sentido inverso', 'Colonia La Aurora', 'nintendo@gmail.com', ' 7:00am a 10:00pm de Lunes a Viernes'), (2, 'From Sofware', '5644505050', 1, 7, 'en la primera versión de la novela aparecen dilatadas descripciones acerca de la mala vida de la ciudad; el sistema más utilizado en las descripciones de personas es el que pasa de la descripción de la cabeza, al cuello, tronco, piernas y pies, o en sentido inverso', 'Colonia La Aurora', 'fromsoftware@gmail.com', ' 7:00am a 10:00pm de Lunes a Viernes'), (3, 'Quantic Dream', '2034240234050', 3, 8, 'en la primera versión de la novela aparecen dilatadas descripciones acerca de la mala vida de la ciudad; el sistema más utilizado en las descripciones de personas es el que pasa de la descripción de la cabeza, al cuello, tronco, piernas y pies, o en sentido inverso', 'Colonia La Aurora', 'qd@gmail.com', ' 7:00am a 10:00pm de Lunes a Viernes'); -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `tbl_empresaimagenes` -- CREATE TABLE `tbl_empresaimagenes` ( `imagenes_codigo` int(11) NOT NULL, `empresa_codigo` int(11) DEFAULT NULL, `imagenes_nombre` text ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Volcado de datos para la tabla `tbl_empresaimagenes` -- INSERT INTO `tbl_empresaimagenes` (`imagenes_codigo`, `empresa_codigo`, `imagenes_nombre`) VALUES (1, 1, 'Imagenes/Nintendo/FB_IMG_15053506315295260.jpg'), (2, 1, 'Imagenes/Nintendo/FB_IMG_15054405669114854.jpg'), (3, 1, 'Imagenes/Nintendo/FB_IMG_15060002134698888.jpg'), (4, 2, 'Imagenes/From Sofware/FB_IMG_15072349340241018.jpg'), (5, 2, 'Imagenes/From Sofware/FB_IMG_15072441915006890.jpg'), (6, 2, 'Imagenes/From Sofware/FB_IMG_15073224122626222.jpg'), (7, 3, 'Imagenes/Quantic Dream/FB_IMG_15295165642383538.jpg'), (8, 3, 'Imagenes/Quantic Dream/FB_IMG_15295245926440637.jpg'), (9, 3, 'Imagenes/Quantic Dream/FB_IMG_15296013752260857.jpg'), (10, 3, 'Imagenes/Quantic Dream/FB_IMG_15299569578738271.jpg'), (11, 3, 'Imagenes/Quantic Dream/FB_IMG_15300343536153481.jpg'), (12, 3, 'Imagenes/Quantic Dream/FB_IMG_15300429987500980.jpg'); -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `tbl_empresalogo` -- CREATE TABLE `tbl_empresalogo` ( `logo_codigo` int(11) NOT NULL, `empresa_codigo` int(11) DEFAULT NULL, `logo_nombre` text ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Volcado de datos para la tabla `tbl_empresalogo` -- INSERT INTO `tbl_empresalogo` (`logo_codigo`, `empresa_codigo`, `logo_nombre`) VALUES (1, 1, 'Logos/Nintendo/FB_IMG_15065261066033634.jpg'), (2, 2, 'Logos/From Sofware/FB_IMG_15064421762924258.jpg'), (3, 3, 'Logos/Quantic Dream/FB_IMG_15101207109692173.jpg'); -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `tbl_empresatelefono` -- CREATE TABLE `tbl_empresatelefono` ( `telefono_codigo` int(11) NOT NULL, `empresa_codigo` int(11) DEFAULT NULL, `telefono_telefono` text ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Volcado de datos para la tabla `tbl_empresatelefono` -- INSERT INTO `tbl_empresatelefono` (`telefono_codigo`, `empresa_codigo`, `telefono_telefono`) VALUES (1, 1, '(504) 9867-3456'), (2, 1, '(454) 4657-7688'), (3, 2, '(477) 6690-5940'), (4, 2, '(349) 3594-0460'), (5, 3, '(477) 6690-5940'), (6, 3, '(349) 3594-0460'); -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `tbl_genero` -- CREATE TABLE `tbl_genero` ( `genero_codigo` int(11) NOT NULL, `genero_nombre` text ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Volcado de datos para la tabla `tbl_genero` -- INSERT INTO `tbl_genero` (`genero_codigo`, `genero_nombre`) VALUES (1, 'MASCULINO'), (2, 'FEMENINO'); -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `tbl_usuario` -- CREATE TABLE `tbl_usuario` ( `usuario_codigo` int(11) NOT NULL, `usuario_identidad` text, `usuario_nombre` text, `usuario_correo` text, `ciudad_codigo` int(11) DEFAULT NULL, `genero_codigo` int(11) DEFAULT NULL, `usuario_fechanacimiento` date DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Índices para tablas volcadas -- -- -- Indices de la tabla `tbl_categoria` -- ALTER TABLE `tbl_categoria` ADD PRIMARY KEY (`categoria_codigo`); -- -- Indices de la tabla `tbl_ciudad` -- ALTER TABLE `tbl_ciudad` ADD PRIMARY KEY (`ciudad_codigo`); -- -- Indices de la tabla `tbl_empresa` -- ALTER TABLE `tbl_empresa` ADD PRIMARY KEY (`empresa_codigo`); -- -- Indices de la tabla `tbl_empresaimagenes` -- ALTER TABLE `tbl_empresaimagenes` ADD PRIMARY KEY (`imagenes_codigo`), ADD KEY `empresa_codigo_fk2_idx` (`empresa_codigo`); -- -- Indices de la tabla `tbl_empresalogo` -- ALTER TABLE `tbl_empresalogo` ADD PRIMARY KEY (`logo_codigo`), ADD KEY `empresa_codigo_fk_idx` (`empresa_codigo`); -- -- Indices de la tabla `tbl_empresatelefono` -- ALTER TABLE `tbl_empresatelefono` ADD PRIMARY KEY (`telefono_codigo`), ADD KEY `empresa_codigo_fk3_idx` (`empresa_codigo`); -- -- Indices de la tabla `tbl_genero` -- ALTER TABLE `tbl_genero` ADD PRIMARY KEY (`genero_codigo`); -- -- Indices de la tabla `tbl_usuario` -- ALTER TABLE `tbl_usuario` ADD PRIMARY KEY (`usuario_codigo`), ADD KEY `ciudad_codigo_fk_idx` (`ciudad_codigo`); -- -- AUTO_INCREMENT de las tablas volcadas -- -- -- AUTO_INCREMENT de la tabla `tbl_categoria` -- ALTER TABLE `tbl_categoria` MODIFY `categoria_codigo` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=21; -- -- AUTO_INCREMENT de la tabla `tbl_ciudad` -- ALTER TABLE `tbl_ciudad` MODIFY `ciudad_codigo` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; -- -- AUTO_INCREMENT de la tabla `tbl_empresa` -- ALTER TABLE `tbl_empresa` MODIFY `empresa_codigo` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; -- -- AUTO_INCREMENT de la tabla `tbl_empresaimagenes` -- ALTER TABLE `tbl_empresaimagenes` MODIFY `imagenes_codigo` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=13; -- -- AUTO_INCREMENT de la tabla `tbl_empresalogo` -- ALTER TABLE `tbl_empresalogo` MODIFY `logo_codigo` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; -- -- AUTO_INCREMENT de la tabla `tbl_empresatelefono` -- ALTER TABLE `tbl_empresatelefono` MODIFY `telefono_codigo` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7; -- -- AUTO_INCREMENT de la tabla `tbl_genero` -- ALTER TABLE `tbl_genero` MODIFY `genero_codigo` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3; -- -- AUTO_INCREMENT de la tabla `tbl_usuario` -- ALTER TABLE `tbl_usuario` MODIFY `usuario_codigo` int(11) NOT NULL AUTO_INCREMENT; -- -- Restricciones para tablas volcadas -- -- -- Filtros para la tabla `tbl_empresaimagenes` -- ALTER TABLE `tbl_empresaimagenes` ADD CONSTRAINT `empresa_codigo_fk2` FOREIGN KEY (`empresa_codigo`) REFERENCES `tbl_empresa` (`empresa_codigo`) ON DELETE NO ACTION ON UPDATE NO ACTION; -- -- Filtros para la tabla `tbl_empresalogo` -- ALTER TABLE `tbl_empresalogo` ADD CONSTRAINT `empresa_codigo_fk` FOREIGN KEY (`empresa_codigo`) REFERENCES `tbl_empresa` (`empresa_codigo`) ON DELETE NO ACTION ON UPDATE NO ACTION; -- -- Filtros para la tabla `tbl_empresatelefono` -- ALTER TABLE `tbl_empresatelefono` ADD CONSTRAINT `empresa_codigo_fk3` FOREIGN KEY (`empresa_codigo`) REFERENCES `tbl_empresa` (`empresa_codigo`) ON DELETE NO ACTION ON UPDATE NO ACTION; -- -- Filtros para la tabla `tbl_usuario` -- ALTER TABLE `tbl_usuario` ADD CONSTRAINT `ciudad_codigo_fk` FOREIGN KEY (`ciudad_codigo`) REFERENCES `tbl_ciudad` (`ciudad_codigo`) ON DELETE NO ACTION ON UPDATE NO ACTION; 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
fdfecabdbb193f67a68d4f6e0e257e77a7f24768
SQL
jimmyalf/temp
/Spinit.Wpc.Synologen.Database/dbo/Stored Procedures/spCommerceSearchMailAddress.sql
UTF-8
1,164
3.28125
3
[]
no_license
CREATE PROCEDURE spCommerceSearchMailAddress @type INT, @id INT, @mlId INT, @status INT OUTPUT AS BEGIN IF @type = 0 BEGIN SELECT cId, cMlId, cEmail, cIsActive, cCreatedBy, cCreatedDate, cChangedBy, cChangedDate FROM tblCommerceMailAddress ORDER BY cEmail ASC END IF @type = 1 BEGIN SELECT cId, cMlId, cEmail, cIsActive, cCreatedBy, cCreatedDate, cChangedBy, cChangedDate FROM tblCommerceMailAddress WHERE cMlId = @mlId ORDER BY cEmail ASC END IF @type = 2 BEGIN SELECT cId, cMlId, cEmail, cIsActive, cCreatedBy, cCreatedDate, cChangedBy, cChangedDate FROM tblCommerceMailAddress WHERE cMlId = @mlId AND cIsActive = 1 ORDER BY cEmail ASC END IF @type = 3 BEGIN SELECT cId, cMlId, cEmail, cIsActive, cCreatedBy, cCreatedDate, cChangedBy, cChangedDate FROM tblCommerceMailAddress WHERE cId = @id ORDER BY cEmail ASC END SET @status = @@ERROR END
true
e9b4b8a87a59f55b36c42180d1b42f63d3ce0c55
SQL
rgwood/dockerized-postgres
/database/data.sql
UTF-8
2,737
2.546875
3
[ "MIT" ]
permissive
-- -- PostgreSQL database dump -- -- Dumped from database version 11.2 (Debian 11.2-1.pgdg90+1) -- Dumped by pg_dump version 11.2 (Debian 11.2-1.pgdg90+1) 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; -- -- Data for Name: article; Type: TABLE DATA; Schema: public; Owner: postgres -- COPY public.article (id, name, date, url) FROM stdin; 1 Ode to the ENIAC 1946-02-18 https://www.newspapers.com/clip/29267883/ode_to_the_eniac/ 8 Monster-house solution offered 1987-09-23 https://www.newspapers.com/clip/28044188/monster_house_solution/ 7 Swanson opposes ARP 1977-06-03 https://www.newspapers.com/clip/28121753/swanson_opposes_arp/ 2 Land grab attempt charged by owners 1965-06-15 https://www.newspapers.com/clip/28123130/mount_pleasant_downzoning/ 5 BC ARP ad 1976-06-05 https://www.newspapers.com/clip/28122536/arp_ad/ 6 COPE fights Assisted Rental Program 1977-04-18 https://www.newspapers.com/clip/28122335/cope_fights_assisted_rental_program/ 4 Fraser Institute opposes ARP 1978-05-26 https://www.newspapers.com/clip/28122639/fraser_institute_opposing_arp/ 3 The housing crisis: There are no simple answers 1980-03-26 https://www.newspapers.com/clip/28122734/ann_mcafee_column/ \. -- -- Data for Name: article_text; Type: TABLE DATA; Schema: public; Owner: postgres -- COPY public.article_text (article_id, text) FROM stdin; 1 Cute poem about the ENIAC, found in Janet Abbate's "Recoding Gender". Not exactly fine poetry, but a fun time capsule. 4 Qui delectus fuga minima molestiae. Voluptate non fugit amet ut facere ut aut. Qui voluptatibus velit maxime. Nostrum dolor voluptas qui illum perspiciatis voluptate.\nIste rerum assumenda optio ut itaque. Laboriosam sit quibusdam deleniti nesciunt quia commodi culpa. Sed at blanditiis temporibus facilis omnis error sit.\nExcepturi facilis nihil eligendi. Omnis amet ducimus similique fuga quasi id atque exercitationem. Rem libero distinctio explicabo.\nQuis non saepe cum ut nihil suscipit. Voluptas at consequuntur deleniti deleniti consequatur natus inventore. Distinctio eum excepturi illo doloremque temporibus. Nulla nostrum sequi ut perferendis et et.
\nSit est corrupti laborum commodi molestiae. Dicta ullam et eaque praesentium aliquid corrupti. Qui eaque ut veniam. Nihil nihil blanditiis corporis. \. -- -- Name: Article_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres -- SELECT pg_catalog.setval('public."Article_id_seq"', 8, true); -- -- PostgreSQL database dump complete --
true
3912bebe5a5f0cc0f90f538a1746d6728839cac4
SQL
hysmun/WebJavaAirport
/creaBD.sql
UTF-8
8,255
2.953125
3
[]
no_license
-- MySQL dump 10.13 Distrib 5.7.17, for Win64 (x86_64) -- -- Host: localhost Database: bd_airport -- ------------------------------------------------------ -- Server version 5.7.19-log /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -- -- Table structure for table `agents` -- DROP TABLE IF EXISTS `agents`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `agents` ( `idAgents` int(11) NOT NULL, `nom` varchar(45) DEFAULT NULL, `prenom` varchar(45) DEFAULT NULL, `role` varchar(100) DEFAULT NULL, PRIMARY KEY (`idAgents`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `agents` -- LOCK TABLES `agents` WRITE; /*!40000 ALTER TABLE `agents` DISABLE KEYS */; INSERT INTO `agents` VALUES (100,'Brajkovic','Antoine','admin'),(404,'Mauhin','Remy','cuisinier'),(1337,'root','toor','superadmin'); /*!40000 ALTER TABLE `agents` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `bagages` -- DROP TABLE IF EXISTS `bagages`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `bagages` ( `idBagages` varchar(100) NOT NULL, `valise` char(1) DEFAULT NULL, `poids` double DEFAULT NULL, `receptionne` varchar(1) DEFAULT NULL, `chargeSoute` varchar(1) DEFAULT NULL, `verifDouane` varchar(1) DEFAULT NULL, `remarques` varchar(100) DEFAULT NULL, `idTicket` int(11) DEFAULT NULL, PRIMARY KEY (`idBagages`), KEY `idTicketFK_idx` (`idTicket`), CONSTRAINT `idTicketFK` FOREIGN KEY (`idTicket`) REFERENCES `ticket` (`idTicket`) 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 `bagages` -- LOCK TABLES `bagages` WRITE; /*!40000 ALTER TABLE `bagages` DISABLE KEYS */; INSERT INTO `bagages` VALUES ('111','N',14,'N','N','N','NEANT',NULL),('111-111-11-1111-111','Y',25,'N','N','N','NEANT',NULL),('159-489-26-1430-000','N',10,'N','N','N','NEANT',NULL),('222','Y',25.6,'O','R','O','NEANT',NULL),('222-222-22-2222-222','N',19,'N','N','N','NEANT',NULL),('333','Y',10,'O','O','O','NEANT',NULL),('444','N',15,'O','N','N','NEANT',NULL),('555','Y',13,'N','N','N','NEANT',NULL),('666','Y',10,'O','N','N','NEANT',NULL),('777','N',12,'N','N','N','NEANT',NULL),('888','N',11,'N','N','N','NEANT',NULL),('999','N',2,'O','N','N','NEANT',NULL); /*!40000 ALTER TABLE `bagages` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `billets` -- DROP TABLE IF EXISTS `billets`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `billets` ( `idBillets` int(11) NOT NULL, `nom` varchar(45) DEFAULT NULL, `prenom` varchar(45) DEFAULT NULL, `numCarteID` varchar(45) DEFAULT NULL, `idVols` int(11) DEFAULT NULL, `idBagages` varchar(100) DEFAULT NULL, PRIMARY KEY (`idBillets`), KEY `idVols_idx` (`idVols`), KEY `idBagages_idx` (`idBagages`), CONSTRAINT `idBagages` FOREIGN KEY (`idBagages`) REFERENCES `bagages` (`idBagages`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `idVols` FOREIGN KEY (`idVols`) REFERENCES `vols` (`idVols`) 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 `billets` -- LOCK TABLES `billets` WRITE; /*!40000 ALTER TABLE `billets` DISABLE KEYS */; INSERT INTO `billets` VALUES (684,'Dieu',NULL,'666',333,'111'),(1111,'Truc','Bidule','6842846',222,'222'),(2222,'Machin','Chouette','6824',111,NULL),(3333,'Marie','Marie','3',222,'333'),(4444,'Bernard','Bernard','12531',999,'222-222-22-2222-222'),(5555,'Truc','Much','231235',111,'444'),(6666,'Seb','Seb','5312',111,'999'),(7777,'Phil','Phil','31231',NULL,'555'),(8888,'sophie','sophie','21312',NULL,'888'),(9999,'Maud','Maud','3155',111,'666'),(13215,'Brajkovic','Antoine','342834',444,'111-111-11-1111-111'),(22135,'Mauhin','Remy','6842',444,'777'); /*!40000 ALTER TABLE `billets` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `client` -- DROP TABLE IF EXISTS `client`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `client` ( `idClient` int(11) NOT NULL, `identifiant` varchar(45) NOT NULL, `password` varchar(45) NOT NULL, PRIMARY KEY (`idClient`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `client` -- LOCK TABLES `client` WRITE; /*!40000 ALTER TABLE `client` DISABLE KEYS */; INSERT INTO `client` VALUES (111,'ggbrogg','ggbrogg'),(222,'user','user'),(333,'test','test'),(444,'client','client'),(555,'antoine','antoine'),(666,'remy','remy'),(777,'patate','patate'),(888,'aaa','aaa'),(999,'bbb','bbb'); /*!40000 ALTER TABLE `client` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `ticket` -- DROP TABLE IF EXISTS `ticket`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `ticket` ( `idTicket` int(11) NOT NULL, `idVols` int(11) NOT NULL, `idClient` int(11) NOT NULL, PRIMARY KEY (`idTicket`), KEY `idVols_idx` (`idVols`), KEY `idClient_idx` (`idClient`), CONSTRAINT `idClient` FOREIGN KEY (`idClient`) REFERENCES `client` (`idClient`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `idVolsFK` FOREIGN KEY (`idVols`) REFERENCES `vols` (`idVols`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `ticket` -- LOCK TABLES `ticket` WRITE; /*!40000 ALTER TABLE `ticket` DISABLE KEYS */; INSERT INTO `ticket` VALUES (111,222,111),(222,444,111),(333,222,111),(444,444,333),(555,333,444),(666,222,555),(777,444,666),(888,555,777),(999,222,222); /*!40000 ALTER TABLE `ticket` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `vols` -- DROP TABLE IF EXISTS `vols`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `vols` ( `idVols` int(11) NOT NULL, `destination` varchar(45) NOT NULL, `heureArriver` datetime DEFAULT NULL, `heureDepart` datetime DEFAULT NULL, `nbrBillet` int(11) DEFAULT NULL, `nbrDispo` int(11) DEFAULT NULL, PRIMARY KEY (`idVols`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `vols` -- LOCK TABLES `vols` WRITE; /*!40000 ALTER TABLE `vols` DISABLE KEYS */; INSERT INTO `vols` VALUES (111,'Rio',NULL,NULL,200,200),(222,'New-york',NULL,NULL,150,146),(333,'Ici',NULL,NULL,300,299),(444,'La',NULL,NULL,104,101),(555,'Ailleur',NULL,NULL,205,204),(666,'Enfer',NULL,NULL,102,102),(777,'DTC',NULL,NULL,1054,1054),(888,'Europe',NULL,NULL,25,25),(999,'Moon',NULL,NULL,356,356); /*!40000 ALTER TABLE `vols` 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 2017-11-22 11:09:58
true
ae45f01e4e08751f868403a02d95978f9d301adb
SQL
yanweiling/windsound
/sql/groupMenu.sql
UTF-8
1,528
2.515625
3
[]
no_license
-- 菜单 SQL insert into sys_menu (menu_name, parent_id, order_num, url,menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark) values('词组', '3', '1', '/module/group', 'C', '0', 'module:group:view', '#', 'admin', '2018-03-01', 'ry', '2018-03-01', '词组菜单'); -- 按钮父菜单ID SELECT @parentId := LAST_INSERT_ID(); -- 按钮 SQL insert into sys_menu (menu_name, parent_id, order_num, url,menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark) values('词组查询', @parentId, '1', '#', 'F', '0', 'module:group:list', '#', 'admin', '2018-03-01', 'ry', '2018-03-01', ''); insert into sys_menu (menu_name, parent_id, order_num, url,menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark) values('词组新增', @parentId, '2', '#', 'F', '0', 'module:group:add', '#', 'admin', '2018-03-01', 'ry', '2018-03-01', ''); insert into sys_menu (menu_name, parent_id, order_num, url,menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark) values('词组修改', @parentId, '3', '#', 'F', '0', 'module:group:edit', '#', 'admin', '2018-03-01', 'ry', '2018-03-01', ''); insert into sys_menu (menu_name, parent_id, order_num, url,menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark) values('词组删除', @parentId, '4', '#', 'F', '0', 'module:group:remove', '#', 'admin', '2018-03-01', 'ry', '2018-03-01', '');
true
4189b90a8fe7c732da5c8a984e47b5c7df711252
SQL
Adrinachong1997/Software-Engineering-
/oldBG/beergame.sql
UTF-8
7,095
3.1875
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 4.8.3 -- https://www.phpmyadmin.net/ -- -- 主機: 127.0.0.1 -- 產生時間: 2019 年 01 月 03 日 13:07 -- 伺服器版本: 10.1.36-MariaDB -- PHP 版本: 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 */; -- -- 資料庫: `beergame` -- -- -------------------------------------------------------- -- -- 資料表結構 `gamecycle` -- CREATE TABLE `gamecycle` ( `week` int(11) NOT NULL, `demand` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- 資料表的匯出資料 `gamecycle` -- INSERT INTO `gamecycle` (`week`, `demand`) VALUES (1, 44), (2, 23), (3, 43), (4, 32), (5, 9), (6, 41), (7, 37), (8, 1), (9, 11), (10, 12), (11, 31), (12, 40), (13, 19), (14, 40), (15, 24), (16, 20), (17, 36), (18, 34), (19, 33), (20, 33), (21, 27), (22, 24), (23, 27), (24, 3), (25, 24), (26, 10), (27, 17), (28, 3), (29, 25), (30, 18), (31, 9), (32, 25), (33, 4), (34, 24), (35, 4), (36, 18), (37, 37), (38, 9), (39, 5), (40, 30), (41, 25), (42, 48), (43, 16), (44, 1), (45, 35), (46, 18), (47, 47), (48, 15), (49, 44), (50, 3); -- -------------------------------------------------------- -- -- 資料表結構 `period` -- CREATE TABLE `period` ( `id` int(20) NOT NULL, `week` int(20) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -- 資料表的匯出資料 `period` -- INSERT INTO `period` (`id`, `week`) VALUES (1, 4); -- -------------------------------------------------------- -- -- 資料表結構 `player` -- CREATE TABLE `player` ( `pid` int(20) NOT NULL, `player_n` varchar(20) COLLATE utf8_unicode_ci NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -- 資料表的匯出資料 `player` -- INSERT INTO `player` (`pid`, `player_n`) VALUES (1, 'factory'), (2, 'distributor'), (3, 'wholesaler'), (4, 'retailer'); -- -------------------------------------------------------- -- -- 資料表結構 `player_record` -- CREATE TABLE `player_record` ( `id` int(20) NOT NULL, `tname` varchar(30) COLLATE utf8_unicode_ci NOT NULL, `pid` int(20) NOT NULL, `week` int(20) NOT NULL, `original_stock` int(20) NOT NULL, `expected_arrival` int(50) NOT NULL, `actual_arrival` int(50) NOT NULL, `orders` int(50) NOT NULL, `cost` int(50) NOT NULL, `acc_cost` int(50) NOT NULL, `demand` int(50) DEFAULT NULL, `actual_shipment` int(50) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -- 資料表的匯出資料 `player_record` -- INSERT INTO `player_record` (`id`, `tname`, `pid`, `week`, `original_stock`, `expected_arrival`, `actual_arrival`, `orders`, `cost`, `acc_cost`, `demand`, `actual_shipment`) VALUES (5, 'TEST1', 1, 50, 0, 0, 0, 0, 0, 11, NULL, 0), (6, 'TEST1', 2, 50, 0, 0, 0, 0, 0, 39, NULL, 0), (7, 'TEST1', 3, 50, 0, 0, 0, 0, 0, 8, NULL, 0), (8, 'TEST1', 4, 50, 0, 0, 0, 0, 0, 7, NULL, 0), (9, '4', 1, 50, 0, 0, 0, 0, 0, 2, NULL, 0), (10, '4', 2, 50, 0, 0, 0, 0, 0, 23, NULL, 0), (11, '4', 3, 50, 0, 0, 0, 0, 0, 10, NULL, 0), (12, '4', 4, 50, 0, 0, 0, 0, 0, 3, NULL, 0); -- -------------------------------------------------------- -- -- 資料表結構 `stu_tel` -- CREATE TABLE `stu_tel` ( `no` int(11) NOT NULL, `uid` char(20) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL, `sid` char(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL, `email` char(30) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL, `tel` int(15) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- 資料表的匯出資料 `stu_tel` -- INSERT INTO `stu_tel` (`no`, `uid`, `sid`, `email`, `tel`) VALUES (5, '陳浩鋐', '105213060', 's105213060@mail1.ncnu.edu.tw', 912345342), (6, '蕭泓恩', '105213014', 's105213014@mail1.ncnu.edu.tw', 912345365), (7, '宋晨', '105213057', 's105123057@mail1.ncnu.edu.tw', 982734534), (8, '香荏彬', '105213069', 's105213069@mail1.ncnu.edu.tw', 912342342), (9, '許中昱', '105213002', 's105213002@mail1.ncnu.edu.tw', 988745342), (10, '何宏歷', '105213075', 's105213075@mail1.ncnu.edu.tw', 912342341), (11, 'asd', '123', 'asd@ad', 123); -- -------------------------------------------------------- -- -- 資料表結構 `tgame` -- CREATE TABLE `tgame` ( `serno` int(11) NOT NULL, `tname` varchar(30) COLLATE utf8_unicode_ci NOT NULL, `r1` varchar(11) CHARACTER SET latin1 DEFAULT NULL, `r2` varchar(11) CHARACTER SET latin1 DEFAULT NULL, `r3` varchar(11) CHARACTER SET latin1 DEFAULT NULL, `r4` varchar(11) CHARACTER SET latin1 DEFAULT NULL, `totalcost` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -- 資料表的匯出資料 `tgame` -- INSERT INTO `tgame` (`serno`, `tname`, `r1`, `r2`, `r3`, `r4`, `totalcost`) VALUES (20, 'TEST1', 'admin1', NULL, 'admin1', NULL, 65), (21, '4', 'admin1', '1', '1', NULL, 38); -- -------------------------------------------------------- -- -- 資料表結構 `user` -- CREATE TABLE `user` ( `id` varchar(30) NOT NULL, `password` varchar(30) NOT NULL, `mail` varchar(30) NOT NULL, `sort` int(10) NOT NULL DEFAULT '1' ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- 資料表的匯出資料 `user` -- INSERT INTO `user` (`id`, `password`, `mail`, `sort`) VALUES ('1', '1', '', 1), ('a', '1', '', 1), ('b', 'a', '', 0), ('test', 'test', '', 1), ('test2', 'test2', '', 1), ('test3', 'test3', '', 1); -- -- 已匯出資料表的索引 -- -- -- 資料表索引 `gamecycle` -- ALTER TABLE `gamecycle` ADD PRIMARY KEY (`week`); -- -- 資料表索引 `period` -- ALTER TABLE `period` ADD PRIMARY KEY (`id`); -- -- 資料表索引 `player` -- ALTER TABLE `player` ADD PRIMARY KEY (`pid`); -- -- 資料表索引 `player_record` -- ALTER TABLE `player_record` ADD PRIMARY KEY (`id`); -- -- 資料表索引 `stu_tel` -- ALTER TABLE `stu_tel` ADD PRIMARY KEY (`no`); -- -- 資料表索引 `tgame` -- ALTER TABLE `tgame` ADD PRIMARY KEY (`serno`); -- -- 資料表索引 `user` -- ALTER TABLE `user` ADD PRIMARY KEY (`id`); -- -- 在匯出的資料表使用 AUTO_INCREMENT -- -- -- 使用資料表 AUTO_INCREMENT `gamecycle` -- ALTER TABLE `gamecycle` MODIFY `week` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=51; -- -- 使用資料表 AUTO_INCREMENT `period` -- ALTER TABLE `period` MODIFY `id` int(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; -- -- 使用資料表 AUTO_INCREMENT `player_record` -- ALTER TABLE `player_record` MODIFY `id` int(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=13; -- -- 使用資料表 AUTO_INCREMENT `stu_tel` -- ALTER TABLE `stu_tel` MODIFY `no` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12; -- -- 使用資料表 AUTO_INCREMENT `tgame` -- ALTER TABLE `tgame` MODIFY `serno` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=22; 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
dbb46790ac8ee5c28076f2f3e61d3ff38b64ddcb
SQL
NCIP/tcga-sandbox-v1
/trunk/qclive-test-data-generator/src/main/resources/sql/DeleteQcliveTestData.sql
UTF-8
4,191
2.515625
3
[]
no_license
declare myuser varchar2(50); begin select user into myuser from dual; if NOT (myuser like '%TEST%') then goto theEnd; end if; DELETE FROM CLINICAL_CONTROL_ARCHIVE; DELETE FROM CLINICAL_CONTROL_ELEMENT; DELETE FROM CLINICAL_CONTROL; DELETE FROM FOLLOW_UP_ARCHIVE; DELETE FROM FOLLOW_UP_ELEMENT; DELETE FROM FOLLOW_UP; DELETE FROM TUMOR_SAMPLE_ARCHIVE; DELETE FROM TUMOR_SAMPLE_ELEMENT; DELETE FROM TUMOR_SAMPLE; DELETE FROM NORMAL_CONTROL_ARCHIVE; DELETE FROM NORMAL_CONTROL_ELEMENT; DELETE FROM NORMAL_CONTROL; DELETE FROM CLINICAL_CQCF_ARCHIVE; DELETE FROM CLINICAL_CQCF_ELEMENT; DELETE FROM CLINICAL_CQCF; DELETE FROM BIOSPECIMEN_CQCF_ARCHIVE; DELETE FROM BIOSPECIMEN_CQCF_ELEMENT; DELETE FROM BIOSPECIMEN_CQCF; DELETE FROM FILE_TO_ARCHIVE; DELETE FROM MAF_INFO; DELETE FROM BCR_BIOSPECIMEN_TO_ARCHIVE; DELETE FROM BIOSPECIMEN_TO_FILE; DELETE FROM CENTER_TO_BCR_CENTER; DELETE FROM EXPGENE_VALUE; DELETE FROM CNA_VALUE; DELETE FROM METHYLATION_VALUE; DELETE FROM DATA_SET_FILE; DELETE FROM HYBRID_REF_DATA_SET; DELETE FROM DATA_TYPE_TO_PLATFORM; DELETE FROM PATHWAY; DELETE FROM GENE_DRUG; DELETE FROM GENE; DELETE FROM L4_ANOMALY_VALUE; DELETE FROM L4_DATA_SET_GENETIC_ELEMENT; DELETE FROM L4_CORRELATION_TYPE; DELETE FROM L4_TARGET; DELETE FROM L4_GENETIC_ELEMENT; DELETE FROM L4_DATA_SET_SAMPLE; DELETE FROM L4_SAMPLE; DELETE FROM L4_GENETIC_ELEMENT_TYPE; DELETE FROM L4_ANOMALY_DATA_SET_VERSION; DELETE FROM L4_ANOMALY_DATA_VERSION; DELETE FROM L4_ANOMALY_TYPE; DELETE FROM L4_PATIENT; DELETE FROM L4_ANOMALY_DATA_SET; DELETE FROM CLINICAL_XSD_ENUM_VALUE; DELETE FROM CLINICAL_FILE_ELEMENT; DELETE FROM CLINICAL_FILE_TO_TABLE; DELETE FROM CLINICAL_FILE; DELETE FROM CLINICAL_TABLE; DELETE FROM PORTAL_ACTION_TYPE; DELETE FROM PORTAL_SESSION_ACTION; DELETE FROM PORTAL_SESSION; DELETE FROM shipped_portion_element; DELETE FROM shipped_portion_archive; DELETE FROM shipped_portion; DELETE FROM EXAMINATION_ELEMENT; DELETE FROM PATIENT_ELEMENT; DELETE FROM ALIQUOT_ELEMENT; DELETE FROM PORTION_ELEMENT; DELETE FROM SLIDE_ELEMENT; DELETE FROM SURGERY_ELEMENT; DELETE FROM RNA_ELEMENT; DELETE FROM ANALYTE_ELEMENT; DELETE FROM PROTOCOL_ELEMENT; DELETE FROM SAMPLE_ELEMENT; DELETE FROM DNA_ELEMENT; DELETE FROM RADIATION_ELEMENT; DELETE FROM DRUG_INTGEN_ELEMENT; DELETE FROM TUMORPATHOLOGY_ELEMENT; DELETE FROM TUMORPATHOLOGY_ARCHIVE; DELETE FROM TUMORPATHOLOGY; DELETE FROM RADIATION_ARCHIVE; DELETE FROM SURGERY_ARCHIVE; DELETE FROM EXAMINATION_ARCHIVE; DELETE FROM DRUG_INTGEN_ARCHIVE; DELETE FROM ALIQUOT_ARCHIVE; DELETE FROM DNA_ARCHIVE; DELETE FROM SLIDE_ARCHIVE; DELETE FROM PORTION_ARCHIVE; DELETE FROM PROTOCOL_ARCHIVE; DELETE FROM ANALYTE_ARCHIVE; DELETE FROM RNA_ARCHIVE; DELETE FROM PATIENT_ARCHIVE; DELETE FROM SAMPLE_ARCHIVE; DELETE FROM SURGERY; DELETE FROM SUMMARY_BY_GENE; DELETE FROM SLIDE; DELETE FROM RNA; DELETE FROM RADIATION; DELETE FROM PROTOCOL; DELETE FROM EXAMINATION; DELETE FROM DRUG_INTGEN; DELETE FROM DRUG_CONCEPT_CODE; DELETE FROM DRUG; DELETE FROM DNA; DELETE FROM DISEASE; DELETE FROM RNASEQ_VALUE; DELETE FROM DATA_SET; DELETE FROM HYBRIDIZATION_REF; DELETE FROM EXPERIMENT; DELETE FROM DATA_VISIBILITY; DELETE FROM BIOCARTA_GENE_PATHWAY; DELETE FROM BIOCARTA_GENE; DELETE FROM ANOMALY_TYPE; DELETE FROM ALIQUOT; DELETE FROM ANALYTE; DELETE FROM PORTION; DELETE FROM SAMPLE; DELETE FROM CLINICAL_XSD_ELEMENT; DELETE FROM shipped_biospecimen_element; DELETE FROM shipped_biospecimen_file; DELETE FROM shipped_biospec_bcr_archive; DELETE FROM shipped_biospecimen; DELETE FROM ARCHIVE_INFO; DELETE FROM PLATFORM; DELETE FROM DATA_TYPE; DELETE FROM CENTER_TYPE; DELETE FROM DATA_LEVEL; DELETE FROM FILE_INFO; DELETE FROM VISIBILITY; DELETE FROM ARCHIVE_TYPE; DELETE FROM BIOSPECIMEN_BARCODE; DELETE FROM CENTER; DELETE FROM PATIENT; DELETE FROM PARTICIPANT_UUID_FILE; COMMIT; goto normalEnd; <<normalEnd>> DBMS_OUTPUT.PUT_LINE('deletes completed.'); goto theExit; <<theEnd>> DBMS_OUTPUT.PUT_LINE('not in a test schema.'); goto theExit; <<theExit>> DBMS_OUTPUT.PUT_LINE('exiting.'); end; / purge recyclebin;
true
1b64f8a17b5520889278d171f1d2c0b5a42a6c1f
SQL
INL/COBALT
/LexiconTool/sql/addIndexes.sql
UTF-8
1,497
2.6875
3
[]
no_license
ALTER TABLE analyzed_wordforms ADD INDEX multipleLemmataAnalysisId (multiple_lemmata_analysis_id); ALTER TABLE analyzed_wordforms ADD INDEX awfId (analyzed_wordform_id ASC); ALTER TABLE corpusId_x_documentId ADD INDEX documentIdIndex (document_id); ALTER TABLE corpusId_x_documentId ADD INDEX corpusIdIndex (corpus_id); ALTER TABLE documents ADD INDEX documentIdIndex (document_id ASC); ALTER TABLE lemmata ADD INDEX glossIndex (gloss ASC); ALTER TABLE lemmata ADD INDEX modernLemmaIndex (modern_lemma ASC); ALTER TABLE lemmata ADD INDEX lemmaPartOfSpeechIndex (lemma_part_of_speech ASC); ALTER TABLE multiple_lemmata_analyses ADD INDEX multipleLemmataAnalysisPartNumberIndex (part_number ASC); ALTER TABLE multiple_lemmata_analysis_parts ADD INDEX multipleLemmataAnalysisPartIdIndex (multiple_lemmata_analysis_part_id ASC); ALTER TABLE token_attestations ADD INDEX analyzedWordformIdIndex (analyzed_wordform_id); ALTER TABLE token_attestations ADD INDEX documentIdIndex (document_id); ALTER TABLE token_attestations ADD INDEX startPosIndex (start_pos); ALTER TABLE token_attestations ADD INDEX endPosIndex (end_pos); ALTER TABLE token_attestation_verifications ADD INDEX verifiedByIndex (verified_by ASC); ALTER TABLE type_frequencies ADD INDEX wordformIdIndex (wordform_id); ALTER TABLE type_frequencies ADD INDEX documentIdIndex (document_id); ALTER TABLE wordforms ADD INDEX wordformIdIndex (wordform_id ASC); ALTER TABLE wordform_groups ADD INDEX wordformGroupIdIndex (wordform_group_id ASC);
true
31df55d0792a03ef88fc9cd5a3e505cdd1e327eb
SQL
rexxmagtar/Ds3
/Polyclinik/PolyclinicService/CreateScript.sql
UTF-8
1,069
2.71875
3
[]
no_license
-- MySQL Script generated by MySQL Workbench -- Wed Oct 21 16:53:31 2020 -- Model: New Model Version: 1.0 -- MySQL Workbench Forward Engineering -- ----------------------------------------------------- -- Schema mydb -- ----------------------------------------------------- -- ----------------------------------------------------- -- Schema mydb -- ----------------------------------------------------- DROP SCHEMA IF EXISTS `polyclinic`; CREATE SCHEMA `polyclinic` DEFAULT CHARACTER SET utf8; USE `polyclinic`; -- ----------------------------------------------------- -- Table `mydb`.`visits` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `visits` ( `id` INT NOT NULL AUTO_INCREMENT, `token` VARCHAR(255) NOT NULL, `doctor_fio` VARCHAR(45) NOT NULL, `patient_fio` VARCHAR(45) NOT NULL, `date` DATE NOT NULL, `speciality` VARCHAR(45) NOT NULL, PRIMARY KEY (`id`)) ENGINE = InnoDB; INSERT INTO visits(token, doctor_fio, patient_fio, date, speciality) VALUES("token","Ivanov Ivan Ivanivich","Petrov Petr Petrovich", "2020-1-1","TERAPEUT");
true
311486668661d41765525167d766a9561fa8ba80
SQL
derekhuangxd/CISC-332-Database-Management-Systems
/Deliverable 2/Database Scripts/RelationalSchema.sql
UTF-8
2,634
3.578125
4
[]
no_license
CREATE DATABASE animal; USE animal; CREATE TABLE SPCABranches( NAME VARCHAR(50) NOT NULL, phoneNumber CHAR(10), street VARCHAR(100), city VARCHAR(100), province VARCHAR(100), postalCode CHAR(6), PRIMARY KEY(NAME) ); CREATE TABLE RescueOrganization( NAME VARCHAR(50) NOT NULL, phoneNumber CHAR(10), street VARCHAR(100), city VARCHAR(100), province VARCHAR(100), postalCode CHAR(6), PRIMARY KEY(NAME) ); CREATE TABLE Shelters( NAME VARCHAR(50) NOT NULL, phoneNumber CHAR(10), street VARCHAR(100), city VARCHAR(100), province VARCHAR(100), postalCode CHAR(6), URL VARCHAR(8000), animalType VARCHAR(50), animalMax INTEGER, PRIMARY KEY(NAME) ); CREATE TABLE Donations( donateTo VARCHAR(50) NOT NULL, personDonated VARCHAR(50), DATE DATE, amount INTEGER ); CREATE TABLE Employee( fname VARCHAR(50) NOT NULL, lname VARCHAR(50) NOT NULL, phoneNumber CHAR(10), street VARCHAR(100), city VARCHAR(100), province VARCHAR(100), postalCode CHAR(6), workLocation VARCHAR(50) NOT NULL, PRIMARY KEY(fname, lname) ); CREATE TABLE Animals( animalID CHAR(8) NOT NULL, animalType VARCHAR(50) NOT NULL, beginSPCABranch VARCHAR(50) NOT NULL, arrivedShelterDate DATE, leftShelterDate DATE, animalGoes VARCHAR(50), moneyChangesHands INTEGER, PRIMARY KEY(animalID, animalType), FOREIGN KEY(beginSPCABranch) REFERENCES SPCABranches(NAME), FOREIGN KEY(animalGoes) REFERENCES Shelters(NAME) ); CREATE TABLE adoptingAnimals( lname VARCHAR(50) NOT NULL, phoneNumber CHAR(10), street VARCHAR(100), city VARCHAR(100), province VARCHAR(100), postalCode CHAR(6), amount INTEGER, animalID CHAR(8) NOT NULL, payTo VARCHAR(50) NOT NULL, FOREIGN KEY(payTo) REFERENCES Shelters(NAME), FOREIGN KEY(animalID) REFERENCES Animals(animalID) ); CREATE TABLE driversAndVolunteers( fname VARCHAR(50) NOT NULL, lname VARCHAR(50) NOT NULL, emergencyPhoneNumber CHAR(10), licencePlate VARCHAR(10), animalId CHAR(8) NOT NULL, animalFrom VARCHAR(50) NOT NULL, workLocation VARCHAR(50) NOT NULL, PRIMARY KEY(fname, lname), FOREIGN KEY(animalFrom) REFERENCES SPCABranches(NAME), FOREIGN KEY(animalID) REFERENCES Animals(animalID) ); CREATE TABLE VetsVisiting( animalID CHAR(8) NOT NULL, vetName VARCHAR(50) NOT NULL, animalCondition VARCHAR(20) NOT NULL, weight VARCHAR(10) NOT NULL, dateOfVisiting DATE NOT NULL, FOREIGN KEY(animalID) REFERENCES Animals(animalID) ON DELETE CASCADE );
true
d3602785a7778acb5e8bdbb6d20ed5a108b0b601
SQL
laufendentdecken/trainingstool
/src/main/resources/sql/create-db.sql
UTF-8
517
3.21875
3
[ "Apache-2.0" ]
permissive
drop table training if exists; create table training ( id integer primary key GENERATED BY DEFAULT AS IDENTITY(START WITH 1), user_id integer, schedule_date date, description varchar(4000), training_type varchar(200) ); drop table user if exists; create table user ( id integer primary key GENERATED BY DEFAULT AS IDENTITY(START WITH 100), username varchar(50) not null, email varchar(50) not null, pw varchar(255) not null ); ALTER TABLE training ADD FOREIGN KEY (user_id) REFERENCES user(id);
true
9a87c5c648b24f8bd6fb4064c48a68e672e980b9
SQL
tamboer/scrum
/docs/scrum_2012-11-14.sql
UTF-8
14,356
2.96875
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 3.4.10.1deb1 -- http://www.phpmyadmin.net -- -- Host: localhost -- Generation Time: Nov 14, 2012 at 01:27 PM -- Server version: 5.5.28 -- PHP Version: 5.3.10-1ubuntu3.4 SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8 */; -- -- Database: `bewan_scrum` -- -- -------------------------------------------------------- -- -- Table structure for table `category` -- CREATE TABLE IF NOT EXISTS `category` ( `id_category` int(11) NOT NULL AUTO_INCREMENT, `label` varchar(255) CHARACTER SET latin1 NOT NULL, PRIMARY KEY (`id_category`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=36 ; -- -- Dumping data for table `category` -- INSERT INTO `category` (`id_category`, `label`) VALUES (3, 'Analysis'), (4, 'Translations'), (5, 'Code Cleanup'), (15, 'Database'), (16, 'App Config'), (18, 'module address'), (19, 'module administration'), (20, 'module balance'), (21, 'module company'), (22, 'module configuration'), (23, 'module department'), (24, 'module legal'), (25, 'module login'), (26, 'module printing'), (27, 'module rotation'), (28, 'module staff'), (29, 'module task'), (30, 'module timeclock'), (31, 'App Design CSS JS Layout'), (32, 'App Service Layer'), (33, 'App Translation'), (34, 'App Navigation'), (35, 'General'); -- -------------------------------------------------------- -- -- Table structure for table `play` -- CREATE TABLE IF NOT EXISTS `play` ( `id_play` int(11) NOT NULL AUTO_INCREMENT, `fk_id_scrum_item` int(11) NOT NULL, `label` varchar(255) CHARACTER SET latin1 NOT NULL, `started_on` datetime DEFAULT NULL, `stopped_on` datetime DEFAULT NULL, `stop_reason` text CHARACTER SET latin1 NOT NULL, `estimate_duration` float NOT NULL, `estimate_finish` datetime DEFAULT NULL, `deadline` datetime DEFAULT NULL, `finished_on` datetime DEFAULT NULL, `result` tinyint(1) NOT NULL, `result_comment` text CHARACTER SET latin1 NOT NULL, `fk_id_category` int(11) NOT NULL, `fk_id_player` int(11) NOT NULL, `fk_id_team` int(11) NOT NULL, PRIMARY KEY (`id_play`), KEY `fk_id_category` (`fk_id_category`), KEY `fk_id_player` (`fk_id_player`), KEY `fk_id_team` (`fk_id_team`), KEY `fk_id_scrum_item` (`fk_id_scrum_item`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=25 ; -- -- Dumping data for table `play` -- INSERT INTO `play` (`id_play`, `fk_id_scrum_item`, `label`, `started_on`, `stopped_on`, `stop_reason`, `estimate_duration`, `estimate_finish`, `deadline`, `finished_on`, `result`, `result_comment`, `fk_id_category`, `fk_id_player`, `fk_id_team`) VALUES (1, 1, 'csv translations2', NULL, NULL, '', 0, NULL, NULL, NULL, 0, '', 3, 1, 1), (2, 3, 'New DB', '2012-10-08 00:00:00', NULL, '', 0, NULL, NULL, NULL, 0, '', 3, 4, 2), (3, 4, 'Analysis', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '', 3, 1, 1), (4, 4, 'Story', '2012-10-09 00:00:00', '2012-10-24 00:00:00', '', 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '', 3, 6, 4), (5, 7, 'Expand analysis', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '', 3, 1, 1), (6, 6, 'new design', '2012-10-08 00:00:00', '0000-00-00 00:00:00', 'Why did progress stop?', 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '2012-10-09 00:00:00', 1, 'no comments', 3, 2, 1), (7, 3, 'Not much to do yet', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 'Answer this: Why did progress stop? eg. Further analysis required? Pending a decision? ', 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 1, 'What is the result/Why is there no result?', 3, 1, 1), (8, 1, 'remove task types tabs + show selector', '2012-10-15 00:00:00', '0000-00-00 00:00:00', 'Answer this: Why did progress stop? eg. Further analysis required? Pending a decision? ', 4, '2012-10-16 00:00:00', '2012-10-16 00:00:00', '0000-00-00 00:00:00', 0, 'What is the result/Why is there no result?', 3, 2, 1), (9, 1, 'delete button not working. (delete == update/delete contract?)', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 'Answer this: Why did progress stop? eg. Further analysis required? Pending a decision? ', 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 1, 'What is the result/Why is there no result?', 3, 1, 1), (10, 1, 'remove the remove button in staff list', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 'Answer this: Why did progress stop? eg. Further analysis required? Pending a decision? ', 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 1, 'What is the result/Why is there no result?', 3, 1, 1), (11, 1, 'badge entry needs validation', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 'Answer this: Why did progress stop? eg. Further analysis required? Pending a decision? ', 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 1, 'What is the result/Why is there no result?', 3, 2, 1), (12, 1, 'forms -> translation', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 'Answer this: Why did progress stop? eg. Further analysis required? Pending a decision? ', 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 1, 'What is the result/Why is there no result?', 3, 1, 1), (13, 1, 'time picker default values', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 1, '', 3, 2, 1), (14, 1, '''add team'' code is commented.', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 1, '', 3, 1, 1), (15, 1, 'Language choice', '2012-10-15 00:00:00', '2012-10-15 00:00:00', 'What about configuration/user/list?', 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '', 3, 1, 1), (16, 1, 'grid(segments) not linked to JS tasks', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '', 3, 2, 1), (17, 1, 'lock planning text needs review', '2012-10-15 00:00:00', '0000-00-00 00:00:00', '', 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '2012-10-15 00:00:00', 1, 'Done', 3, 1, 1), (18, 1, 'firstname - lastname don''t always show ->contract issue', '2012-10-15 00:00:00', '0000-00-00 00:00:00', '', 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '2012-10-15 00:00:00', 1, 'Done', 3, 1, 1), (19, 1, 'Html>pdf button', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '', 3, 2, 1), (20, 1, 'Visuals for template editing', '0000-00-00 00:00:00', '2012-10-15 00:00:00', 'No template editing exist anymore. Normal tasks added to normal tasks planning week is copied.', 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '', 3, 1, 1), (21, 1, 'Reportings (like bewantime-old-version)', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '', 3, 2, 1), (22, 1, 'right click task, doesn’t change color', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '', 3, 3, 2), (23, 1, 'User Permissions', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '', 3, 1, 1), (24, 1, 'User Permissions2', NULL, '0000-00-00 00:00:00', '', 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '', 3, 1, 1); -- -------------------------------------------------------- -- -- Table structure for table `player` -- CREATE TABLE IF NOT EXISTS `player` ( `id_player` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(255) CHARACTER SET latin1 NOT NULL, PRIMARY KEY (`id_player`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=8 ; -- -- Dumping data for table `player` -- INSERT INTO `player` (`id_player`, `name`) VALUES (1, 'Willem'), (2, 'Jasper'), (3, 'Quentin'), (4, 'Olivier'), (5, 'Thomas'), (6, 'Franky'), (7, 'nobody'); -- -------------------------------------------------------- -- -- Table structure for table `scrum_item` -- CREATE TABLE IF NOT EXISTS `scrum_item` ( `id_scrum_item` int(11) NOT NULL AUTO_INCREMENT, `label` varchar(255) CHARACTER SET latin1 NOT NULL, `description` text CHARACTER SET latin1 NOT NULL, `created_on` datetime NOT NULL, `removed_on` datetime DEFAULT NULL, PRIMARY KEY (`id_scrum_item`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=8 ; -- -- Dumping data for table `scrum_item` -- INSERT INTO `scrum_item` (`id_scrum_item`, `label`, `description`, `created_on`, `removed_on`) VALUES (1, 'BewanTime VDB', 'BewanTime VandenBogaerden', '2012-10-13 18:43:40', '0000-00-00 00:00:00'), (3, 'BewanTime Quick', 'BewanTime Quick', '2012-10-13 18:43:40', '0000-00-00 00:00:00'), (4, 'BewanTime Oostende', 'BewanTime Oostende', '2012-10-13 18:43:40', '0000-00-00 00:00:00'), (5, 'RetailServices Web', 'RetailServices Webshop', '2012-10-13 17:30:00', '0000-00-00 00:00:00'), (6, 'Daikin', 'Daikin DataCapture ', '2012-10-13 17:30:00', '0000-00-00 00:00:00'), (7, 'ScrumDev', 'Development of the Scrum', '2012-10-13 18:43:40', '0000-00-00 00:00:00'); -- -------------------------------------------------------- -- -- Table structure for table `shortplay` -- CREATE TABLE IF NOT EXISTS `shortplay` ( `id_shortplay` int(11) NOT NULL AUTO_INCREMENT, `fk_id_scrum_item` int(11) NOT NULL, `fk_id_category` int(11) NOT NULL, `fk_id_player` int(11) NOT NULL, `label` varchar(255) CHARACTER SET latin1 NOT NULL, `description` varchar(255) NOT NULL, `not_started` tinyint(1) NOT NULL, `started_on` tinyint(1) NOT NULL, `done` tinyint(1) NOT NULL, `impediment` tinyint(1) NOT NULL, `comment` varchar(255) NOT NULL, `estimate_time` float NOT NULL, `updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id_shortplay`), KEY `fk_id_category` (`fk_id_category`), KEY `fk_id_player` (`fk_id_player`), KEY `fk_id_scrum_item` (`fk_id_scrum_item`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=34 ; -- -- Dumping data for table `shortplay` -- INSERT INTO `shortplay` (`id_shortplay`, `fk_id_scrum_item`, `fk_id_category`, `fk_id_player`, `label`, `description`, `not_started`, `started_on`, `done`, `impediment`, `comment`, `estimate_time`, `updated`) VALUES (25, 1, 15, 7, 'Db preparation', 'Create databases', 0, 0, 0, 0, 'Will be done later - phase 3', 0, '2012-11-14 11:37:00'), (26, 1, 15, 7, 'Db preparation', 'Create normal users', 0, 0, 0, 0, '', 0, '2012-11-14 11:26:00'), (27, 1, 15, 7, 'Db preparation', 'create administrators', 0, 0, 0, 0, '', 0, '2012-11-14 11:26:00'), (28, 1, 26, 2, '', 'Miss encoding/budget', 0, 0, 0, 0, '', 0, '2012-11-14 11:28:00'), (29, 1, 26, 2, '', 'Miss Print/budget time/time', 0, 0, 0, 1, '', 0, '2012-11-14 12:05:00'), (30, 1, 26, 7, '', 'Reportings (like bewantime-old-version)', 0, 0, 1, 0, '', 0, '2012-11-14 12:05:00'), (31, 1, 26, 2, '', 'set "bewantime title" on the same place in every pdf', 0, 1, 0, 0, '', 0, '2012-11-14 11:30:00'), (32, 1, 28, 7, '', 'In staff member personal information, miss number of staff', 0, 0, 0, 0, '', 0, '2012-11-14 11:31:00'), (33, 1, 29, 4, '', 'Frame left with tasks should not show horizontal overflow', 0, 0, 0, 0, '', 0, '2012-11-14 11:32:00'); -- -------------------------------------------------------- -- -- Table structure for table `team` -- CREATE TABLE IF NOT EXISTS `team` ( `id_team` int(11) NOT NULL AUTO_INCREMENT, `label` varchar(255) CHARACTER SET latin1 NOT NULL, PRIMARY KEY (`id_team`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=5 ; -- -- Dumping data for table `team` -- INSERT INTO `team` (`id_team`, `label`) VALUES (1, 'Wevelgem'), (2, 'Waterloo'), (3, 'Sales'), (4, 'Bewan Planning and Analysis'); -- -------------------------------------------------------- -- -- Table structure for table `team_has_player` -- CREATE TABLE IF NOT EXISTS `team_has_player` ( `fk_id_team` int(11) NOT NULL, `fk_id_player` int(11) NOT NULL, KEY `fk_id_team` (`fk_id_team`), KEY `fk_id_player` (`fk_id_player`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `team_has_player` -- INSERT INTO `team_has_player` (`fk_id_team`, `fk_id_player`) VALUES (1, 1), (1, 2), (2, 3), (2, 4); -- -- Constraints for dumped tables -- -- -- Constraints for table `play` -- ALTER TABLE `play` ADD CONSTRAINT `play_ibfk_1` FOREIGN KEY (`fk_id_scrum_item`) REFERENCES `scrum_item` (`id_scrum_item`) ON DELETE NO ACTION ON UPDATE NO ACTION, ADD CONSTRAINT `play_ibfk_2` FOREIGN KEY (`fk_id_category`) REFERENCES `category` (`id_category`) ON DELETE NO ACTION ON UPDATE NO ACTION, ADD CONSTRAINT `play_ibfk_3` FOREIGN KEY (`fk_id_player`) REFERENCES `player` (`id_player`) ON DELETE NO ACTION ON UPDATE NO ACTION, ADD CONSTRAINT `play_ibfk_4` FOREIGN KEY (`fk_id_team`) REFERENCES `team` (`id_team`) ON DELETE NO ACTION ON UPDATE NO ACTION; -- -- Constraints for table `shortplay` -- ALTER TABLE `shortplay` ADD CONSTRAINT `shortplay_ibfk_1` FOREIGN KEY (`fk_id_scrum_item`) REFERENCES `scrum_item` (`id_scrum_item`) ON DELETE NO ACTION ON UPDATE NO ACTION, ADD CONSTRAINT `shortplay_ibfk_2` FOREIGN KEY (`fk_id_category`) REFERENCES `category` (`id_category`) ON DELETE NO ACTION ON UPDATE NO ACTION, ADD CONSTRAINT `shortplay_ibfk_3` FOREIGN KEY (`fk_id_player`) REFERENCES `player` (`id_player`) ON DELETE NO ACTION ON UPDATE NO ACTION; -- -- Constraints for table `team_has_player` -- ALTER TABLE `team_has_player` ADD CONSTRAINT `team_has_player_ibfk_1` FOREIGN KEY (`fk_id_team`) REFERENCES `team` (`id_team`) ON DELETE NO ACTION ON UPDATE NO ACTION, ADD CONSTRAINT `team_has_player_ibfk_2` FOREIGN KEY (`fk_id_player`) REFERENCES `player` (`id_player`) ON DELETE NO ACTION ON UPDATE NO ACTION; /*!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
3641ce5be09f4938d0bc30693f698134a59f9b7b
SQL
KarmaScripter/BudgetExecution
/Data/Database/Access/DataModels/INSERT/InsertBackUpAllocationUpdates.sql
UTF-8
381
2.515625
3
[ "MIT" ]
permissive
INSERT INTO ApplicationTables SELECT name AS TableName, REFERENCE AS Model FROM [Reference.accdb].MSysObjects WHERE name NOT LIKE _#% AND name NOT LIKE #% AND name NOT LIKE f_#% AND name NOT LIKE f_% AND name NOT LIKE tbl_% AND name NOT LIKE USys% AND name NOT LIKE MSys% AND name NOT LIKE ReferenceTables AND name NOT LIKE %TMP% AND type = 1;
true
8ec74e861d50a18a5c3a9ccbdf0b812fae1e7fc0
SQL
matrixorigin/matrixone
/test/distributed/cases/distinct/distinct.sql
UTF-8
5,179
3.78125
4
[ "Apache-2.0" ]
permissive
-- test keyword distinct drop table if exists t1; create table t1( a int, b varchar(10) ); insert into t1 values (111, 'a'),(110, 'a'),(100, 'a'),(000, 'b'),(001, 'b'),(011,'b'); select distinct b from t1; select distinct b, a from t1; select count(distinct a) from t1; select sum(distinct a) from t1; select avg(distinct a) from t1; select min(distinct a) from t1; select max(distinct a) from t1; drop table t1; -- test values is NULL or empty drop table if exists t2; create table t2(a int, b varchar(10)); insert into t2 values (1, 'a'); insert into t2 values (2, NULL); insert into t2 values (NULL, 'b'); insert into t2 values (NULL, ''); insert into t2 values (3, ''); insert into t2 values (NULL, NULL); select distinct a from t2; select distinct b from t2; select distinct a, b from t2; drop table t2; drop table if exists t3; create table t3 (i int, j int); insert into t3 values (1,1), (1,2), (2,3), (2,4); select i, count(distinct j) from t3 group by i; -- @bvt:issue#4797 select i+0.0 as i2, count(distinct j) from t3 group by i2; -- @bvt:issue select i+0.0 as i2, count(distinct j) from t3 group by i; drop table t3; drop table if exists t4; CREATE TABLE t4 (a INT, b INT); INSERT INTO t4 VALUES (1,1),(1,2),(2,3); -- echo error SELECT (SELECT COUNT(DISTINCT t4.b)) FROM t4 GROUP BY t4.a; SELECT (SELECT COUNT(DISTINCT 12)) FROM t4 GROUP BY t4.a; drop table t4; drop table if exists t5; create table t5 (ff double); insert into t5 values (2.2); select cast(sum(distinct ff) as decimal(5,2)) from t5; select cast(sum(distinct ff) as signed) from t5; select cast(variance(ff) as decimal(10,3)) from t5; select cast(min(ff) as decimal(5,2)) from t5; drop table t5; drop table if exists t6; create table t6 (df decimal(5,1)); insert into t6 values(1.1); insert into t6 values(2.2); select cast(sum(distinct df) as signed) from t6; select cast(min(df) as signed) from t6; select 1e8 * sum(distinct df) from t6; select 1e8 * min(df) from t6; drop table t6; -- test space key drop table if exists t7; CREATE TABLE t7 (a VARCHAR(400)); INSERT INTO t7 (a) VALUES ("A"), ("a"), ("a "), ("a "), ("B"), ("b"), ("b "), ("b "); select * from t7; SELECT COUNT(DISTINCT a) FROM t7; DROP TABLE t7; drop table if exists t8; CREATE TABLE t8 (a INT, b INT); INSERT INTO t8 VALUES (1,1),(1,2),(1,3),(1,4),(1,5),(1,6),(1,7),(1,8); INSERT INTO t8 SELECT a, b+8 FROM t8; INSERT INTO t8 SELECT a, b+16 FROM t8; INSERT INTO t8 SELECT a, b+32 FROM t8; INSERT INTO t8 SELECT a, b+64 FROM t8; INSERT INTO t8 SELECT a, b+128 FROM t8; INSERT INTO t8 SELECT a, b+256 FROM t8; INSERT INTO t8 SELECT a, b+512 FROM t8; INSERT INTO t8 SELECT a, b+1024 FROM t8; INSERT INTO t8 SELECT a, b+2048 FROM t8; INSERT INTO t8 SELECT a, b+4096 FROM t8; INSERT INTO t8 SELECT a, b+8192 FROM t8; INSERT INTO t8 SELECT a, b+16384 FROM t8; INSERT INTO t8 SELECT a, b+32768 FROM t8; -- echo error mag SELECT a,COUNT(DISTINCT b) AS cnt FROM t8 GROUP BY a HAVING cnt > 50; SELECT a,SUM(DISTINCT b) AS sumation FROM t8 GROUP BY a HAVING sumation > 50; SELECT a,AVG(DISTINCT b) AS average FROM t8 GROUP BY a HAVING average > 50; DROP TABLE t8; drop table if exists t9; CREATE TABLE t9 (a INT); INSERT INTO t9 values (),(),(); select distinct * from t9; drop table t9; drop table if exists t10; CREATE TABLE t10 (col_int_nokey int(11)); INSERT INTO t10 VALUES (7),(8),(NULL); SELECT AVG(DISTINCT col_int_nokey) FROM t10; SELECT AVG(DISTINCT outr.col_int_nokey) FROM t10 AS outr LEFT JOIN t10 AS outr2 ON outr.col_int_nokey = outr2.col_int_nokey; DROP TABLE t10; drop table if exists t11; CREATE TABLE t11(c1 CHAR(30)); INSERT INTO t11 VALUES('111'),('222'); SELECT DISTINCT substr(c1, 1, 2147483647) FROM t11; SELECT DISTINCT substr(c1, 1, 2147483648) FROM t11; SELECT DISTINCT substr(c1, -1, 2147483648) FROM t11; SELECT DISTINCT substr(c1, -2147483647, 2147483648) FROM t11; SELECT DISTINCT substr(c1, 9223372036854775807, 23) FROM t11; DROP TABLE t11; drop table if exists t12; drop view if exists v1; create table t12(pk int primary key); create view v1 as select pk from t12 where pk < 20; insert into t12 values (1), (2), (3), (4); select distinct pk from v1; insert into t12 values (5), (6), (7); select distinct pk from v1; drop view v1; drop table t12; SELECT AVG(2), BIT_AND(2), BIT_OR(2), BIT_XOR(2); select count(*); select COUNT(12), COUNT(DISTINCT 12), MIN(2),MAX(2),STD(2), VARIANCE(2),SUM(2); drop table if exists t13; CREATE TABLE t13(product VARCHAR(32),country_id INTEGER NOT NULL,year INTEGER,profit INTEGER); INSERT INTO t13 VALUES ( 'Computer', 2,2000, 1200), ( 'TV', 1, 1999, 150), ( 'Calculator', 1, 1999,50), ( 'Computer', 1, 1999,1500), ( 'Computer', 1, 2000,1500), ( 'TV', 1, 2000, 150), ( 'TV', 2, 2000, 100), ( 'TV', 2, 2000, 100), ( 'Calculator', 1, 2000,75), ( 'Calculator', 2, 2000,75), ( 'TV', 1, 1999, 100), ( 'Computer', 1, 1999,1200), ( 'Computer', 2, 2000,1500), ( 'Calculator', 2, 2000,75), ( 'Phone', 3, 2003,10); SELECT product, country_id, COUNT(*), COUNT(distinct year) FROM t13 GROUP BY product, country_id order by product; drop table t13;
true
233350096642b25f390f2fcaa696628b6e84146e
SQL
kinjal2110/Food-Ordering-System
/food-order.sql
UTF-8
6,869
2.9375
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 5.1.1 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Generation Time: Aug 17, 2021 at 02:42 PM -- Server version: 10.4.20-MariaDB -- PHP Version: 7.3.29 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: `food-order` -- -- -------------------------------------------------------- -- -- Table structure for table `tbl_admin` -- CREATE TABLE `tbl_admin` ( `id` int(10) UNSIGNED NOT NULL, `full_name` varchar(100) NOT NULL, `username` varchar(100) NOT NULL, `password` varchar(255) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `tbl_admin` -- INSERT INTO `tbl_admin` (`id`, `full_name`, `username`, `password`) VALUES (10, 'jay Thapa', 'vijaythapa', 'f3ed11bbdb94fd9ebdefbaf646ab94d3'), (12, 'Administrator', 'admin', '21232f297a57a5a743894a0e4a801fc3'), (13, 'kinjal', 'kinjal.suryavanshi', '202cb962ac59075b964b07152d234b70'), (14, 'kinjal suryavanshi', 'kinjal.suryavanshi', '202cb962ac59075b964b07152d234b70'), (19, 'kinjal suryavanshi', 'sfdg@sd', 'd10906c3dac1172d4f60bd41f224ae75'), (22, 'kinjal', 'sfdg@sd', 'adcaec3805aa912c0d0b14a81bedb6ff'), (23, 'upasana jani', 'upa45', 'd10906c3dac1172d4f60bd41f224ae75'), (25, 'hetanshi puraniya', 'hetanshi.puraniya', '3f0e62adc3b7399bcbafe9675564972b'), (26, 'sakshi', 'sakshi.bachharya', 'e10adc3949ba59abbe56e057f20f883e'), (27, 'tiru', 'tiru1', '202cb962ac59075b964b07152d234b70'), (28, 'kinjal suryavanshi', 'kinjal.suryavanshi', '202cb962ac59075b964b07152d234b70'), (29, 'khyati jani', 'khyati21', '827ccb0eea8a706c4c34a16891f84e7b'), (30, 'khyati jani', 'khyati21', '1234'), (31, 'admin', 'admin', '21232f297a57a5a743894a0e4a801fc3'), (32, 'kinjal', 'kinjal.suryavanshi', '827ccb0eea8a706c4c34a16891f84e7b'); -- -------------------------------------------------------- -- -- Table structure for table `tbl_category` -- CREATE TABLE `tbl_category` ( `id` int(10) UNSIGNED NOT NULL, `title` varchar(100) NOT NULL, `image_name` varchar(255) NOT NULL, `featured` varchar(10) NOT NULL, `active` varchar(10) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `tbl_category` -- INSERT INTO `tbl_category` (`id`, `title`, `image_name`, `featured`, `active`) VALUES (18, 'golgappaa\'', 'food_category_194.jpg', 'yes', 'yes'), (19, 'cake pie', 'food_category_240.jpg', 'no', 'yes'), (21, 'Snakes', 'food_category_103.jpg', 'no', 'yes'), (22, 'Punjabi', 'food_category_339.jpg', 'no', 'yes'), (23, 'South Indian', 'food_category_151.jpg', 'yes', 'yes'), (24, 'cake', 'food_category_221.jpg', 'no', 'yes'), (25, 'Kathiyawadi', 'food_category_671.jpg', 'yes', 'yes'), (26, 'cake', 'food_category_473.jpg', 'no', 'yes'); -- -------------------------------------------------------- -- -- Table structure for table `tbl_food` -- CREATE TABLE `tbl_food` ( `id` int(10) UNSIGNED NOT NULL, `title` varchar(100) NOT NULL, `description` text NOT NULL, `price` decimal(10,2) NOT NULL, `image_name` varchar(255) NOT NULL, `category_id` int(10) UNSIGNED NOT NULL, `featured` varchar(10) NOT NULL, `active` varchar(10) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `tbl_food` -- INSERT INTO `tbl_food` (`id`, `title`, `description`, `price`, `image_name`, `category_id`, `featured`, `active`) VALUES (3, 'Dumplings Specials', 'Chicken Dumpling with herbs from Mountains', '5.00', 'food_name_886.jpg', 6, 'yes', 'yes'), (4, 'Best Burger', 'Burger with Ham, Pineapple and lots of Cheese.', '4.00', 'food_name_527.jpg', 5, 'yes', 'no'), (11, 'pie', 'too tasty', '30.00', 'food_name_446.jpg', 19, 'yes', 'yes'), (12, 'noodles', 'yum', '30.00', 'food_name_69.jpg', 17, 'yes', 'no'), (13, 'fruit salad', 'this is cold', '80.00', 'food_name_445.jpg', 21, 'no', 'yes'), (14, 'fruit salad', 'this is cold', '80.00', 'food_name_796.jpg', 24, 'yes', 'yes'); -- -------------------------------------------------------- -- -- Table structure for table `tbl_order` -- CREATE TABLE `tbl_order` ( `id` int(10) UNSIGNED NOT NULL, `food` varchar(150) NOT NULL, `price` decimal(10,2) NOT NULL, `qty` int(11) NOT NULL, `total` decimal(10,2) NOT NULL, `order_date` datetime NOT NULL, `status` varchar(50) NOT NULL, `customer_name` varchar(150) NOT NULL, `customer_contact` varchar(20) NOT NULL, `customer_email` varchar(150) NOT NULL, `customer_address` varchar(255) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `tbl_order` -- INSERT INTO `tbl_order` (`id`, `food`, `price`, `qty`, `total`, `order_date`, `status`, `customer_name`, `customer_contact`, `customer_email`, `customer_address`) VALUES (1, 'Sadeko Momo', '6.00', 3, '18.00', '2020-11-30 03:49:48', 'Delivered', 'Bradley Farrel', '+1 (576) 504-4657', 'zuhafiq@mailinator.com', 'Duis aliqua Qui lor'), (2, 'Best Burger', '4.00', 4, '16.00', '2020-11-30 03:52:43', 'Delivered', 'Kelly Dillard', '+1 (908) 914-3106', 'fexekihor@mailinator.com', 'Incidunt ipsum ad d'), (3, 'Mixed Pizza', '10.00', 2, '20.00', '2020-11-30 04:07:17', 'Delivered', 'Jana Bush', '+1 (562) 101-2028', 'tydujy@mailinator.com', 'Minima iure ducimus'), (4, 'noodles', '30.00', 1, '30.00', '2021-08-17 12:22:38', 'Ordered', 'kinjal suryavanshi', '8866622758', 'kinjal.suryavanshi@theonetechnologies.co.in', 'vastrapur'), (5, 'fruit salad', '80.00', 3, '240.00', '2021-08-17 12:23:18', 'Ordered', 'kinjal suryavanshi\'\'', '8866622758', 'chips@dfgg.com', 'vastrapur'), (6, 'fruit salad', '80.00', 1, '80.00', '2021-08-17 12:24:30', 'Ordered', 'ritu jani', '8976345672', 'rutvika@123.com', 'puna'); -- -- Indexes for dumped tables -- -- -- Indexes for table `tbl_admin` -- ALTER TABLE `tbl_admin` ADD PRIMARY KEY (`id`); -- -- Indexes for table `tbl_category` -- ALTER TABLE `tbl_category` ADD PRIMARY KEY (`id`); -- -- Indexes for table `tbl_food` -- ALTER TABLE `tbl_food` ADD PRIMARY KEY (`id`); -- -- Indexes for table `tbl_order` -- ALTER TABLE `tbl_order` ADD PRIMARY KEY (`id`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `tbl_admin` -- ALTER TABLE `tbl_admin` MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=33; -- -- AUTO_INCREMENT for table `tbl_category` -- ALTER TABLE `tbl_category` MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=27; -- -- AUTO_INCREMENT for table `tbl_food` -- ALTER TABLE `tbl_food` MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=15; -- -- AUTO_INCREMENT for table `tbl_order` -- ALTER TABLE `tbl_order` MODIFY `id` int(10) UNSIGNED 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
a0fae65bf79800165b3801927866ecfe8c8182e9
SQL
gyk/sql-query-fu
/windowfunctions/ranking.sql
UTF-8
613
3.953125
4
[]
no_license
# Q.0 select row_number() over (order by color, name) as unique_number, name, color from cats order by unique_number # Q.1 # # Pitfall: Do not put `order by name` inside the `over` clause. select rank() over (order by weight desc) as ranking, weight, name from cats order by ranking, name # Q.2 select dense_rank() over (order by age desc) as r, name, age from cats order by r, name # Q.3 select name, weight, 100 * percent_rank() over (order by weight) as percent from cats order by weight # Q.4 select name, weight, cast(100 * cume_dist() over (order by weight) as int) as percent from cats order by weight
true
71b75a67b2278da98a7455f4625100f65676e84b
SQL
BucknellSustainability/Flower
/backend/sql/events.sql
UTF-8
1,006
3.953125
4
[ "MIT" ]
permissive
# Show existing events SHOW EVENTS; # Look at any specific event SHOW CREATE EVENT DataAggregationEvent; # Delete any specific event DROP EVENT DataAggregationEvent; # Create an event that aggregates data CREATE DEFINER=`energyhill`@`%` EVENT `DataAggregationEvent` ON SCHEDULE EVERY 10 MINUTE STARTS '2017-12-03 14:10:00' ON COMPLETION PRESERVE ENABLE DO INSERT INTO datahourly(sensorId, averageValue, sampleRate, dateTime) (select sensorId, AVG(value) as value, COUNT(VALUE) as samplePerHour, DATE_FORMAT(SEC_TO_TIME(FLOOR((TIME_TO_SEC(CURTIME())+300)/600)*600), "%Y-%m-%d %H:%i:00") from data WHERE data.dateTime > CURRENT_TIMESTAMP - INTERVAL 10 MINUTE GROUP BY sensorId) # retroactively aggregate data (shouldn't be used often) INSERT INTO datahourly (sensorId, averageValue, sampleRate, dateTime) SELECT sensorId, AVG(value) as averageValue, 1 as sampleRate, FROM_UNIXTIME(FLOOR(UNIX_TIMESTAMP(dateTime) DIV 600) * 600) as t FROM data GROUP BY t, sensorId
true
63276a219e10b4e43eec891916403de8dc5afbe5
SQL
sergioncio/SQL
/c46.sql
UTF-8
221
3.671875
4
[]
no_license
select isbn, titulo, nombre from libro, editorial where nombre IN (select nombre from editorial where editorial_id=id) AND not (isbn IN (select libro_id from existencias GROUP BY existencias)) ;
true
a3aa115b50feb68b7ee7cae8f197e417d68bda42
SQL
Tsingtuan/tsingtuan-database
/setup.sql
UTF-8
793
3.53125
4
[]
no_license
CREATE TABLE university ( id INT PRIMARY KEY AUTO_INCREMENT, name VARCHAR(255), university_code CHAR(5) ); CREATE TABLE organization ( id INT PRIMARY KEY AUTO_INCREMENT, name VARCHAR(255), university_code CHAR(5) REFERENCES university(university_code), organization_id VARCHAR(255), image VARCHAR(255) ); CREATE TABLE student ( id INT PRIMARY KEY AUTO_INCREMENT, name VARCHAR(255), wechat_id VARCHAR(255), wechat_name VARCHAR(255), university_code CHAR(5) REFERENCES university(university_code), avatar_image VARCHAR(255) ); CREATE TABLE position ( id INT PRIMARY KEY AUTO_INCREMENT, organization_id VARCHAR(255) REFERENCES organization(organization_id), division VARCHAR(255), name VARCHAR(255), wechat_id VARCHAR(255) REFERENCES student(wechat_id) )
true
47800bfa7ba1a704e2c29090c56e0635c2811bdd
SQL
cardenizen/mnroad
/sql/views.sql
UTF-8
19,766
4.46875
4
[]
no_license
SELECT VIEW_NAME,TEXT FROM all_views WHERE owner = 'MNR' and VIEW_NAME in ('CELL_ON_CELL','CELL_DATES','CELLS') ORDER BY VIEW_NAME; -- CREATE OR REPLACE VIEW CELL_ON_CELL AS SELECT CC.CELL_ID ID_UNDER ,(SELECT CELL_NUMBER FROM CELL WHERE ID = CC.CELL_ID) CELL_UNDER ,(SELECT CLASS FROM CELL WHERE ID = CC.CELL_ID) CLASS_UNDER ,(SELECT START_STATION FROM CELL WHERE ID = CC.CELL_ID) FROM_STATION_UNDER ,(SELECT END_STATION FROM CELL WHERE ID = CC.CELL_ID) TO_STATION_UNDER ,(SELECT CONSTRUCTION_ENDED_DATE FROM CELL WHERE ID = CC.CELL_ID) FROM_DATE_UNDER ,(SELECT DEMOLISHED_DATE FROM CELL WHERE ID = CC.CELL_ID) TO_DATE_UNDER ,C.ID ID_OVER ,C.CELL_NUMBER CELL_OVER ,C.CLASS CLASS_OVER ,C.START_STATION FROM_STATION_OVER ,C.END_STATION TO_STATION_OVER ,C.CONSTRUCTION_ENDED_DATE FROM_DATE_OVER ,C.DEMOLISHED_DATE TO_DATE_OVER FROM CELL C JOIN CELL_CELL CC ON CC.CELL_COVERS_ID=C.ID -- CREATE OR REPLACE VIEW CELL_DATES AS SELECT UNIQUE ID, TYPE, FROM_STATION, TO_STATION, CELL, FROM_DATE, TO_DATE, ID_UNDER, TYPE_UNDER, CELL_UNDER, CELL_UNDER_FROM_DATE, CELL_UNDER_TO_DATE FROM ( SELECT C.ID ID, SUBSTR(C.CLASS,24) TYPE, CASE WHEN (C.START_STATION) > (SELECT START_STATION FROM CELL WHERE ID=CC.CELL_ID) THEN (C.START_STATION) ELSE (SELECT START_STATION FROM CELL WHERE ID=CC.CELL_ID) END FROM_STATION, CASE WHEN (C.END_STATION) < (SELECT END_STATION FROM CELL WHERE ID=CC.CELL_ID) THEN (C.END_STATION) ELSE (SELECT END_STATION FROM CELL WHERE ID=CC.CELL_ID) END TO_STATION, C.CELL_NUMBER CELL, CONSTRUCTION_ENDED_DATE FROM_DATE, C.DEMOLISHED_DATE TO_DATE, CC.CELL_ID ID_UNDER, (SELECT SUBSTR(CLASS,24) FROM CELL WHERE ID=CC.CELL_ID) TYPE_UNDER, (SELECT CELL_NUMBER FROM CELL WHERE ID=CC.CELL_ID) CELL_UNDER, (SELECT CONSTRUCTION_ENDED_DATE FROM CELL WHERE ID=CC.CELL_ID) CELL_UNDER_FROM_DATE, (SELECT DEMOLISHED_DATE FROM CELL WHERE ID=CC.CELL_ID) CELL_UNDER_TO_DATE FROM CELL C JOIN CELL_CELL CC ON CC.CELL_COVERS_ID = C.ID UNION ALL SELECT CC.CELL_ID ID, (SELECT SUBSTR(CLASS,24) FROM CELL WHERE ID=CC.CELL_ID) TYPE, CASE WHEN (C.START_STATION) > (SELECT START_STATION FROM CELL WHERE ID=CC.CELL_ID) THEN (C.START_STATION) ELSE (SELECT START_STATION FROM CELL WHERE ID=CC.CELL_ID) END FROM_STATION, CASE WHEN (C.END_STATION) < (SELECT END_STATION FROM CELL WHERE ID=CC.CELL_ID) THEN (C.END_STATION) ELSE (SELECT END_STATION FROM CELL WHERE ID=CC.CELL_ID) END TO_STATION, (SELECT CELL_NUMBER FROM CELL WHERE ID=CC.CELL_ID) CELL, (SELECT CONSTRUCTION_ENDED_DATE FROM CELL WHERE ID=CC.CELL_ID) FROM_DATE, (SELECT DEMOLISHED_DATE FROM CELL WHERE ID=CC.CELL_ID) TO_DATE, C.ID ID_UNDER, SUBSTR(C.CLASS,24) TYPE_UNDER, C.CELL_NUMBER CELL_UNDER, CONSTRUCTION_ENDED_DATE CELL_UNDER_FROM_DATE, C.DEMOLISHED_DATE CELL_UNDER_TO_DATE FROM CELL C JOIN CELL_CELL CC ON CC.CELL_COVERED_BY_ID = C.ID UNION ALL SELECT C.ID, SUBSTR(C.CLASS,24) TYPE, START_STATION FROM_STATION, END_STATION TO_STATION, CELL_NUMBER, CONSTRUCTION_ENDED_DATE FROM_DATE, DEMOLISHED_DATE TO_DATE, null ID_UNDER, null TYPE_UNDER, null CELL_UNDER, null CELL_UNDER_FROM_DATE, null CELL_UNDER_TO_DATE FROM CELL C WHERE DEMOLISHED_DATE IS NOT NULL UNION ALL SELECT C.ID, SUBSTR(C.CLASS,24) TYPE, START_STATION FROM_STATION, END_STATION TO_STATION, CELL_NUMBER, CONSTRUCTION_ENDED_DATE FROM_DATE, DEMOLISHED_DATE TO_DATE, null ID_UNDER, null TYPE_UNDER, null CELL_UNDER, null CELL_UNDER_FROM_DATE, null CELL_UNDER_TO_DATE FROM CELL C WHERE DEMOLISHED_DATE IS NULL AND ID NOT IN (SELECT CELL_ID FROM CELL_CELL) ) --ORDER BY FROM_STATION,FROM_DATE CREATE OR REPLACE VIEW CELLS AS SELECT CELL, ID, FROM_DATE, TO_DATE, TYPE FROM CELL_DATES union all SELECT UNIQUE CELL_UNDER, ID_UNDER, CELL_UNDER_FROM_DATE FROM_DATE, FROM_DATE TO_DATE, TYPE FROM CELL_DATES WHERE CELL_UNDER IS NOT NULL --ORDER BY CELL,FROM_DATE -- CREATE OR REPLACE VIEW CELL_DEAD_DATES AS SELECT CELL ,ID ID_OLD_CELL ,TOID ID_NEW_CELL ,TO_DATE OLD_CELL_REMOVAL_DATE ,TOD NEW_CELL_BUILT_DATE FROM ( SELECT C.* , LEAD(FROM_DATE,1,NULL) OVER (PARTITION BY CELL ORDER BY CELL,FROM_DATE) TOD , LEAD(ID,1,NULL) OVER (PARTITION BY CELL ORDER BY CELL,FROM_DATE) TOID FROM CELLS C ) WHERE TOD <> TO_DATE --ORDER BY CELL,FROM_DATE -- CREATE OR REPLACE VIEW CELL_SENSORS AS SELECT S.ID, SM.MODEL, S.SEQ, S.STATION_FT STATION, S.OFFSET_FT OFFSET, S.SENSOR_DEPTH_IN DEPTH, TO_CHAR(S.DATE_INSTALLED,'YYYY-MM-DD') INSTALLED, TO_CHAR(S.DATE_REMOVED,'YYYY-MM-DD') REMOVED, UC.CELL_UNDER CELL, SUBSTR(UC.CLASS_UNDER,24) TYPE, LN.NAME LANE, M.BASIC_MATERIAL, UC.FROM_STATION_UNDER FR_STATION, UC.TO_STATION_UNDER TO_STATION, TO_CHAR(UC.FROM_DATE_UNDER,'YYYY-MM-DD') FR_DATE, TO_CHAR(UC.TO_DATE_UNDER,'YYYY-MM-DD') TO_DATE, 'Under' POSITION, UC.CELL_OVER CELL_O, SUBSTR(UC.CLASS_OVER,24) TYPE_O, UC.FROM_STATION_OVER FR_STATION_O, UC.TO_STATION_OVER TO_STATION_O, TO_CHAR(UC.FROM_DATE_OVER,'YYYY-MM-DD') FR_DATE_O, TO_CHAR(UC.TO_DATE_OVER,'YYYY-MM-DD') TO_DATE_O, LN.ID LANE_ID, L.ID LAYER_ID, M.ID MATERIAL_ID FROM ( SELECT * FROM CELL_ON_CELL C WHERE C.CELL_OVER IN ( SELECT (SELECT CELL_NUMBER FROM CELL WHERE ID=CELL_ID) FROM CELL_CELL CC JOIN CELL C ON C.ID=CC.CELL_COVERED_BY_ID ) ) UC JOIN LANE LN ON LN.CELL_ID=UC.ID_UNDER JOIN LAYER L ON L.LANE_ID=LN.ID JOIN SENSOR S ON S.LAYER_ID = L.ID JOIN SENSOR_MODEL SM ON S.SENSOR_MODEL_ID = SM.ID JOIN MATERIAL M ON L.MATERIAL_ID=M.ID -- Show those within the longitudinal bounds of the cell WHERE S.STATION_FT BETWEEN UC.FROM_STATION_OVER AND UC.TO_STATION_OVER UNION ALL -- Sensors embedded in layers built on top of Cell SELECT S.ID, SM.MODEL, S.SEQ, S.STATION_FT STATION, S.OFFSET_FT OFFSET, S.SENSOR_DEPTH_IN DEPTH, TO_CHAR(S.DATE_INSTALLED,'YYYY-MM-DD') INSTALLED, TO_CHAR(S.DATE_REMOVED,'YYYY-MM-DD') REMOVED, UC.CELL_OVER CELL, SUBSTR(UC.CLASS_OVER,24) TYPE, LN.NAME LANE, M.BASIC_MATERIAL, UC.FROM_STATION_OVER FR_STATION, UC.TO_STATION_OVER TO_STATION, TO_CHAR(UC.FROM_DATE_OVER,'YYYY-MM-DD') FR_DATE, TO_CHAR(UC.TO_DATE_OVER,'YYYY-MM-DD') TO_DATE, 'Over' POSITION, UC.CELL_UNDER CELL_O, SUBSTR(UC.CLASS_UNDER,24) TYPE_O, UC.FROM_STATION_UNDER FR_STATION_O, UC.TO_STATION_UNDER TO_STATION_O, TO_CHAR(UC.FROM_DATE_UNDER,'YYYY-MM-DD') FR_DATE_O, TO_CHAR(UC.TO_DATE_UNDER,'YYYY-MM-DD') TO_DATE_O, LN.ID LANE_ID, L.ID LAYER_ID, M.ID MATERIAL_ID FROM CELL_ON_CELL UC JOIN LANE LN ON LN.CELL_ID=UC.ID_OVER JOIN LAYER L ON L.LANE_ID=LN.ID JOIN SENSOR S ON S.LAYER_ID = L.ID JOIN SENSOR_MODEL SM ON S.SENSOR_MODEL_ID = SM.ID JOIN MATERIAL M ON L.MATERIAL_ID=M.ID -- CREATE OR REPLACE VIEW CELL_STATIONS AS SELECT C.CELL,C.ID,CD.TYPE,C.FROM_DATE,C.TO_DATE,CD.FROM_STATION,CD.TO_STATION FROM CELLS C JOIN CELL_DATES CD ON CD.ID = C.ID UNION ALL SELECT C.CELL,C.ID,CD.TYPE,C.FROM_DATE,C.TO_DATE,CD.FROM_STATION,CD.TO_STATION FROM CELLS C JOIN CELL_DATES CD ON CD.ID_UNDER = C.ID CREATE OR REPLACE VIEW SENSOR_LOCATION AS SELECT C.CELL_NUMBER CELL, SUBSTR (C.CLASS, 24) CLASS, SM.MODEL, S.STATION_FT STATION, S.OFFSET_FT OFFSET, S.SEQ, M.BASIC_MATERIAL, S.SENSOR_DEPTH_IN DEPTH, S.DATE_REMOVED, S.ORIENTATION FROM SENSOR S JOIN SENSOR_MODEL SM ON S.SENSOR_MODEL_ID = SM.ID JOIN LAYER L ON S.LAYER_ID = L.ID JOIN LANE LN ON L.LANE_ID = LN.ID JOIN CELL C ON LN.CELL_ID = C.ID JOIN MATERIAL M ON M.ID = L.MATERIAL_ID ORDER BY CELL, MODEL, SEQ CREATE OR REPLACE VIEW WEATHER_ENGLISH AS SELECT DAY, HOUR, qhr, ROUND (air_temp * 9 / 5 + 32, 3) air_temp_deg_f, ROUND (atmos_pres * .00529, 2) atmos_pres_psi, precip precip_inches, rel_humidity rel_humidity_pct, ROUND (solar_rad_in * .00529, 4) sol_rad_in_btu_per_ft_sq_min, ROUND (solar_rad_out * .00529, 4) sol_rad_out_btu_per_ft_sq_min, wind_direction wind_degrees_from_north, ROUND (wind_gust * 2.237, 4) max_wind_gust_mph, ROUND (wind_speed * 2.237, 4) avg_wind_speed_mph, gust_direction FROM weather_composite CREATE OR REPLACE VIEW WEATHER_METRIC AS SELECT DAY, HOUR, qhr, air_temp air_temp_deg_c, atmos_pres atmos_pres_mbars, precip / 2.54 precip_cm, rel_humidity rel_humidity_pct, solar_rad_in solar_rad_in_w_per_m_squared, solar_rad_out solar_rad_out_w_per_m_squared, wind_direction wind_degrees_from_north, wind_gust max_wind_gust_m_per_sec, wind_speed avg_wind_speed_m_per_sec, gust_direction FROM weather_composite CREATE OR REPLACE VIEW TC_VALUES_ALL AS SELECT DAY, cell, seq, HOUR, qhr, MINUTE, VALUE FROM tc_values_1993 UNION ALL SELECT DAY, cell, seq, HOUR, qhr, MINUTE, VALUE FROM tc_values_1994 UNION ALL SELECT DAY, cell, seq, HOUR, qhr, MINUTE, VALUE FROM tc_values_1995 UNION ALL SELECT DAY, cell, seq, HOUR, qhr, MINUTE, VALUE FROM tc_values_1996 UNION ALL SELECT DAY, cell, seq, HOUR, qhr, MINUTE, VALUE FROM tc_values_1997 UNION ALL SELECT DAY, cell, seq, HOUR, qhr, MINUTE, VALUE FROM tc_values_1998 UNION ALL SELECT DAY, cell, seq, HOUR, qhr, MINUTE, VALUE FROM tc_values_1999 UNION ALL SELECT DAY, cell, seq, HOUR, qhr, MINUTE, VALUE FROM tc_values_2000 UNION ALL SELECT DAY, cell, seq, HOUR, qhr, MINUTE, VALUE FROM tc_values_2001 UNION ALL SELECT DAY, cell, seq, HOUR, qhr, MINUTE, VALUE FROM tc_values_2002 UNION ALL SELECT DAY, cell, seq, HOUR, qhr, MINUTE, VALUE FROM tc_values_2003 UNION ALL SELECT DAY, cell, seq, HOUR, qhr, MINUTE, VALUE FROM tc_values_2004 UNION ALL SELECT DAY, cell, seq, HOUR, qhr, MINUTE, VALUE FROM tc_values_2005 UNION ALL SELECT DAY, cell, seq, HOUR, qhr, MINUTE, VALUE FROM tc_values_2006 UNION ALL SELECT DAY, cell, seq, HOUR, qhr, MINUTE, VALUE FROM tc_values_2007 UNION ALL SELECT DAY, cell, seq, HOUR, qhr, MINUTE, VALUE FROM tc_values_2008 UNION ALL SELECT DAY, cell, seq, HOUR, qhr, MINUTE, VALUE FROM tc_values_2009 UNION ALL SELECT DAY, cell, seq, HOUR, qhr, MINUTE, VALUE FROM tc_values ; CREATE OR REPLACE VIEW VW_VALUES_ALL AS SELECT DAY, cell, seq, HOUR, qhr, MINUTE, VALUE FROM vw_values_1993 UNION ALL SELECT DAY, cell, seq, HOUR, qhr, MINUTE, VALUE FROM vw_values_1994 UNION ALL SELECT DAY, cell, seq, HOUR, qhr, MINUTE, VALUE FROM vw_values_1995 UNION ALL SELECT DAY, cell, seq, HOUR, qhr, MINUTE, VALUE FROM vw_values_1996 UNION ALL SELECT DAY, cell, seq, HOUR, qhr, MINUTE, VALUE FROM vw_values_1997 UNION ALL SELECT DAY, cell, seq, HOUR, qhr, MINUTE, VALUE FROM vw_values_1998 UNION ALL SELECT DAY, cell, seq, HOUR, qhr, MINUTE, VALUE FROM vw_values_1999 UNION ALL SELECT DAY, cell, seq, HOUR, qhr, MINUTE, VALUE FROM vw_values_2000 UNION ALL SELECT DAY, cell, seq, HOUR, qhr, MINUTE, VALUE FROM vw_values_2001 UNION ALL SELECT DAY, cell, seq, HOUR, qhr, MINUTE, VALUE FROM vw_values_2002 UNION ALL SELECT DAY, cell, seq, HOUR, qhr, MINUTE, VALUE FROM vw_values_2003 UNION ALL SELECT DAY, cell, seq, HOUR, qhr, MINUTE, VALUE FROM vw_values_2004 UNION ALL SELECT DAY, cell, seq, HOUR, qhr, MINUTE, VALUE FROM vw_values_2005 UNION ALL SELECT DAY, cell, seq, HOUR, qhr, MINUTE, VALUE FROM vw_values_2006 UNION ALL SELECT DAY, cell, seq, HOUR, qhr, MINUTE, VALUE FROM vw_values_2007 UNION ALL SELECT DAY, cell, seq, HOUR, qhr, MINUTE, VALUE FROM vw_values_2008 UNION ALL SELECT DAY, cell, seq, HOUR, qhr, MINUTE, VALUE FROM vw_values_2009 UNION ALL SELECT DAY, cell, seq, HOUR, qhr, MINUTE, VALUE FROM vw_values ; CREATE OR REPLACE VIEW WM_VALUES_ALL AS SELECT DAY, cell, seq, HOUR, qhr, MINUTE, VALUE FROM wm_values_1993 UNION ALL SELECT DAY, cell, seq, HOUR, qhr, MINUTE, VALUE FROM wm_values_1994 UNION ALL SELECT DAY, cell, seq, HOUR, qhr, MINUTE, VALUE FROM wm_values_1995 UNION ALL SELECT DAY, cell, seq, HOUR, qhr, MINUTE, VALUE FROM wm_values_1996 UNION ALL SELECT DAY, cell, seq, HOUR, qhr, MINUTE, VALUE FROM wm_values_1997 UNION ALL SELECT DAY, cell, seq, HOUR, qhr, MINUTE, VALUE FROM wm_values_1998 UNION ALL SELECT DAY, cell, seq, HOUR, qhr, MINUTE, VALUE FROM wm_values_1999 UNION ALL SELECT DAY, cell, seq, HOUR, qhr, MINUTE, VALUE FROM wm_values_2000 UNION ALL SELECT DAY, cell, seq, HOUR, qhr, MINUTE, VALUE FROM wm_values_2001 UNION ALL SELECT DAY, cell, seq, HOUR, qhr, MINUTE, VALUE FROM wm_values_2002 UNION ALL SELECT DAY, cell, seq, HOUR, qhr, MINUTE, VALUE FROM wm_values_2003 UNION ALL SELECT DAY, cell, seq, HOUR, qhr, MINUTE, VALUE FROM wm_values_2004 UNION ALL SELECT DAY, cell, seq, HOUR, qhr, MINUTE, VALUE FROM wm_values_2005 UNION ALL SELECT DAY, cell, seq, HOUR, qhr, MINUTE, VALUE FROM wm_values_2006 UNION ALL SELECT DAY, cell, seq, HOUR, qhr, MINUTE, VALUE FROM wm_values_2007 UNION ALL SELECT DAY, cell, seq, HOUR, qhr, MINUTE, VALUE FROM wm_values_2008 UNION ALL SELECT DAY, cell, seq, HOUR, qhr, MINUTE, VALUE FROM wm_values_2009 UNION ALL SELECT DAY, cell, seq, HOUR, qhr, MINUTE, VALUE FROM wm_values ; CREATE OR REPLACE VIEW XV_VALUES_ALL AS SELECT DAY, cell, seq, HOUR, qhr, MINUTE, VALUE FROM xv_values_1993 UNION ALL SELECT DAY, cell, seq, HOUR, qhr, MINUTE, VALUE FROM xv_values_1994 UNION ALL SELECT DAY, cell, seq, HOUR, qhr, MINUTE, VALUE FROM xv_values_1995 UNION ALL SELECT DAY, cell, seq, HOUR, qhr, MINUTE, VALUE FROM xv_values_1996 UNION ALL SELECT DAY, cell, seq, HOUR, qhr, MINUTE, VALUE FROM xv_values_1997 UNION ALL SELECT DAY, cell, seq, HOUR, qhr, MINUTE, VALUE FROM xv_values_1998 UNION ALL SELECT DAY, cell, seq, HOUR, qhr, MINUTE, VALUE FROM xv_values_1999 UNION ALL SELECT DAY, cell, seq, HOUR, qhr, MINUTE, VALUE FROM xv_values_2000 UNION ALL SELECT DAY, cell, seq, HOUR, qhr, MINUTE, VALUE FROM xv_values_2001 UNION ALL SELECT DAY, cell, seq, HOUR, qhr, MINUTE, VALUE FROM xv_values_2002 UNION ALL SELECT DAY, cell, seq, HOUR, qhr, MINUTE, VALUE FROM xv_values_2003 UNION ALL SELECT DAY, cell, seq, HOUR, qhr, MINUTE, VALUE FROM xv_values_2004 UNION ALL SELECT DAY, cell, seq, HOUR, qhr, MINUTE, VALUE FROM xv_values_2005 UNION ALL SELECT DAY, cell, seq, HOUR, qhr, MINUTE, VALUE FROM xv_values_2006 UNION ALL SELECT DAY, cell, seq, HOUR, qhr, MINUTE, VALUE FROM xv_values_2007 UNION ALL SELECT DAY, cell, seq, HOUR, qhr, MINUTE, VALUE FROM xv_values_2008 UNION ALL SELECT DAY, cell, seq, HOUR, qhr, MINUTE, VALUE FROM xv_values_2009 UNION ALL SELECT DAY, cell, seq, HOUR, qhr, MINUTE, VALUE FROM xv_values ; SELECT CELL ,CELL_FROM_DATE ,CELL_TO_DATE ,TYPE ,TABLE_NAME DATA_TABLE ,FROM_DATE ,TO_DATE FROM ( SELECT CD.CELL, CT.FROM_DATE CELL_FROM_DATE, CD.FROM_DATE, CD.TO_DATE, CT.TO_DATE CELL_TO_DATE, TYPE, CD.TABLE_NAME FROM ( SELECT UNIQUE CELL, TO_CHAR(MIN(DAY),'yyyy-mm-dd') FROM_DATE, TO_CHAR(MAX(DAY),'yyyy-mm-dd') TO_DATE,'DISTRESS_AC' TABLE_NAME FROM MNR.DISTRESS_AC GROUP BY CELL UNION ALL SELECT UNIQUE CELL, TO_CHAR(MIN(DAY),'yyyy-mm-dd') FROM_DATE, TO_CHAR(MAX(DAY),'yyyy-mm-dd') TO_DATE,'DISTRESS_AGG_SURVEY_SEMI' TABLE_NAME FROM MNR.DISTRESS_AGG_SURVEY_SEMI GROUP BY CELL UNION ALL SELECT UNIQUE CELL, TO_CHAR(MIN(DAY),'yyyy-mm-dd') FROM_DATE, TO_CHAR(MAX(DAY),'yyyy-mm-dd') TO_DATE,'DISTRESS_ALPS_RESULTS_RUT' TABLE_NAME FROM MNR.DISTRESS_ALPS_RESULTS_RUT GROUP BY CELL UNION ALL SELECT UNIQUE CELL, TO_CHAR(MIN(DAY),'yyyy-mm-dd') FROM_DATE, TO_CHAR(MAX(DAY),'yyyy-mm-dd') TO_DATE,'DISTRESS_CIRCULR_TEXTR_METER' TABLE_NAME FROM MNR.DISTRESS_CIRCULR_TEXTR_METER GROUP BY CELL UNION ALL SELECT UNIQUE CELL, TO_CHAR(MIN(DAY),'yyyy-mm-dd') FROM_DATE, TO_CHAR(MAX(DAY),'yyyy-mm-dd') TO_DATE,'DISTRESS_CUPPING' TABLE_NAME FROM MNR.DISTRESS_CUPPING GROUP BY CELL UNION ALL SELECT UNIQUE CELL, TO_CHAR(MIN(DAY),'yyyy-mm-dd') FROM_DATE, TO_CHAR(MAX(DAY),'yyyy-mm-dd') TO_DATE,'DISTRESS_FRICTION_DFT' TABLE_NAME FROM MNR.DISTRESS_FRICTION_DFT GROUP BY CELL UNION ALL SELECT UNIQUE CELL, TO_CHAR(MIN(DAY),'yyyy-mm-dd') FROM_DATE, TO_CHAR(MAX(DAY),'yyyy-mm-dd') TO_DATE,'DISTRESS_FRICTION_TRAILER' TABLE_NAME FROM MNR.DISTRESS_FRICTION_TRAILER GROUP BY CELL UNION ALL SELECT UNIQUE CELL, TO_CHAR(MIN(DAY),'yyyy-mm-dd') FROM_DATE, TO_CHAR(MAX(DAY),'yyyy-mm-dd') TO_DATE,'DISTRESS_JPCC' TABLE_NAME FROM MNR.DISTRESS_JPCC GROUP BY CELL UNION ALL SELECT UNIQUE CELL, TO_CHAR(MIN(DAY),'yyyy-mm-dd') FROM_DATE, TO_CHAR(MAX(DAY),'yyyy-mm-dd') TO_DATE,'DISTRESS_LANE_SHOULDER_DROPOFF' TABLE_NAME FROM MNR.DISTRESS_LANE_SHOULDER_DROPOFF GROUP BY CELL UNION ALL SELECT UNIQUE CELL, TO_CHAR(MIN(DAY),'yyyy-mm-dd') FROM_DATE, TO_CHAR(MAX(DAY),'yyyy-mm-dd') TO_DATE,'DISTRESS_LIGHTWEIGHT_DEFLECT' TABLE_NAME FROM MNR.DISTRESS_LIGHTWEIGHT_DEFLECT GROUP BY CELL UNION ALL SELECT UNIQUE CELL, TO_CHAR(MIN(DAY),'yyyy-mm-dd') FROM_DATE, TO_CHAR(MAX(DAY),'yyyy-mm-dd') TO_DATE,'DISTRESS_NUCLEAR_DENSITY' TABLE_NAME FROM MNR.DISTRESS_NUCLEAR_DENSITY GROUP BY CELL UNION ALL SELECT UNIQUE CELL, TO_CHAR(MIN(DAY),'yyyy-mm-dd') FROM_DATE, TO_CHAR(MAX(DAY),'yyyy-mm-dd') TO_DATE,'DISTRESS_OBSI_DATA' TABLE_NAME FROM MNR.DISTRESS_OBSI_DATA GROUP BY CELL UNION ALL SELECT UNIQUE CELL, TO_CHAR(MIN(DAY),'yyyy-mm-dd') FROM_DATE, TO_CHAR(MAX(DAY),'yyyy-mm-dd') TO_DATE,'DISTRESS_OBSI_SUMMARY' TABLE_NAME FROM MNR.DISTRESS_OBSI_SUMMARY GROUP BY CELL UNION ALL SELECT UNIQUE CELL, TO_CHAR(MIN(DAY),'yyyy-mm-dd') FROM_DATE, TO_CHAR(MAX(DAY),'yyyy-mm-dd') TO_DATE,'DISTRESS_PCC_FAULTS' TABLE_NAME FROM MNR.DISTRESS_PCC_FAULTS GROUP BY CELL UNION ALL SELECT UNIQUE CELL, TO_CHAR(MIN(DAY),'yyyy-mm-dd') FROM_DATE, TO_CHAR(MAX(DAY),'yyyy-mm-dd') TO_DATE,'DISTRESS_PERMEABILITY_DIRECT' TABLE_NAME FROM MNR.DISTRESS_PERMEABILITY_DIRECT GROUP BY CELL UNION ALL SELECT UNIQUE CELL, TO_CHAR(MIN(DAY),'yyyy-mm-dd') FROM_DATE, TO_CHAR(MAX(DAY),'yyyy-mm-dd') TO_DATE,'DISTRESS_RIDE_LISA' TABLE_NAME FROM MNR.DISTRESS_RIDE_LISA GROUP BY CELL UNION ALL SELECT UNIQUE CELL, TO_CHAR(MIN(DAY),'yyyy-mm-dd') FROM_DATE, TO_CHAR(MAX(DAY),'yyyy-mm-dd') TO_DATE,'DISTRESS_RIDE_PATHWAYS' TABLE_NAME FROM MNR.DISTRESS_RIDE_PATHWAYS GROUP BY CELL UNION ALL SELECT UNIQUE CELL, TO_CHAR(MIN(DAY),'yyyy-mm-dd') FROM_DATE, TO_CHAR(MAX(DAY),'yyyy-mm-dd') TO_DATE,'DISTRESS_RIDE_PAVETECH' TABLE_NAME FROM MNR.DISTRESS_RIDE_PAVETECH GROUP BY CELL UNION ALL SELECT UNIQUE CELL, TO_CHAR(MIN(DAY),'yyyy-mm-dd') FROM_DATE, TO_CHAR(MAX(DAY),'yyyy-mm-dd') TO_DATE,'DISTRESS_RUTTING_DIPSTICK' TABLE_NAME FROM MNR.DISTRESS_RUTTING_DIPSTICK GROUP BY CELL UNION ALL SELECT UNIQUE CELL, TO_CHAR(MIN(DAY),'yyyy-mm-dd') FROM_DATE, TO_CHAR(MAX(DAY),'yyyy-mm-dd') TO_DATE,'DISTRESS_RUTTING_STRAIGHT_EDGE' TABLE_NAME FROM MNR.DISTRESS_RUTTING_STRAIGHT_EDGE GROUP BY CELL UNION ALL SELECT UNIQUE CELL, TO_CHAR(MIN(DAY),'yyyy-mm-dd') FROM_DATE, TO_CHAR(MAX(DAY),'yyyy-mm-dd') TO_DATE,'DISTRESS_SAND_PATCH' TABLE_NAME FROM MNR.DISTRESS_SAND_PATCH GROUP BY CELL UNION ALL SELECT UNIQUE CELL, TO_CHAR(MIN(DAY),'yyyy-mm-dd') FROM_DATE, TO_CHAR(MAX(DAY),'yyyy-mm-dd') TO_DATE,'DISTRESS_SCHMIDT_HAMMER' TABLE_NAME FROM MNR.DISTRESS_SCHMIDT_HAMMER GROUP BY CELL UNION ALL SELECT UNIQUE CELL, TO_CHAR(MIN(DAY),'yyyy-mm-dd') FROM_DATE, TO_CHAR(MAX(DAY),'yyyy-mm-dd') TO_DATE,'DISTRESS_SOUND_ABSORPTION' TABLE_NAME FROM MNR.DISTRESS_SOUND_ABSORPTION GROUP BY CELL UNION ALL SELECT UNIQUE CELL, TO_CHAR(MIN(DAY),'yyyy-mm-dd') FROM_DATE, TO_CHAR(MAX(DAY),'yyyy-mm-dd') TO_DATE,'DISTRESS_WATER_PERMEABILITY' TABLE_NAME FROM MNR.DISTRESS_WATER_PERMEABILITY GROUP BY CELL --ORDER BY CELL,FROM_DATE ) CD JOIN ( SELECT CELL, TO_CHAR(FROM_DATE,'yyyy-mm-dd') FROM_DATE, TO_CHAR(TO_DATE,'yyyy-mm-dd') TO_DATE, null TABLE_NAME, TYPE FROM (SELECT CELL, TYPE, MIN(FROM_DATE)-60 FROM_DATE, MAX(NVL(TO_DATE,SYSDATE)) TO_DATE FROM MNR.CELLS GROUP BY CELL, TYPE) --ORDER BY CELL,FROM_DATE ) CT ON CD.CELL=CT.CELL AND ( (CD.FROM_DATE BETWEEN CT.FROM_DATE AND CT.TO_DATE) OR (CD.TO_DATE BETWEEN CT.FROM_DATE AND CT.TO_DATE) ) --ORDER BY CELL,CELL_FROM_DATE,TABLE_NAME ) ORDER BY TYPE , DATA_TABLE ,CELL ,CELL_FROM_DATE
true
65382be19f8ee6a563001756a2fa81ffa8d20849
SQL
esmith80/bootcampx
/1_queries/4_no_gmail_or_phone.sql
UTF-8
211
3.390625
3
[]
no_license
--Get all of the students without a gmail.com or phone number. --Get their name, email, id, and cohort_id. SELECT name, id, cohort_id, email FROM students WHERE email NOT LIKE '%gmail.com' AND phone IS null;
true
02ed99d6fb040a48638afb749f3d419a6df317f0
SQL
zx19980210/-
/戒毒中心 网页开发/database/ee5.sql
UTF-8
23,575
3.328125
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 5.0.1 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Generation Time: May 24, 2020 at 09:51 PM -- Server version: 10.4.11-MariaDB -- PHP Version: 7.4.3 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: `ee5` -- -- -------------------------------------------------------- -- -- Table structure for table `appointment` -- CREATE TABLE `appointment` ( `id` int(11) NOT NULL, `patient` varchar(15) CHARACTER SET ascii COLLATE ascii_bin NOT NULL, `doctor` varchar(15) CHARACTER SET ascii COLLATE ascii_bin NOT NULL, `appointmentDate` date NOT NULL, `confirm` tinyint(1) NOT NULL, `reject` tinyint(1) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `appointment` -- INSERT INTO `appointment` (`id`, `patient`, `doctor`, `appointmentDate`, `confirm`, `reject`) VALUES (2, 'r0001', 's0002', '2020-05-30', 1, 0), (8, 'r0001', 's0003', '2020-05-27', 0, 0), (23, 'r0001', 's0001', '2020-05-25', 0, 0), (24, 'r0001', 's0001', '2020-05-25', 0, 1); -- -------------------------------------------------------- -- -- Table structure for table `changed_login_info` -- CREATE TABLE `changed_login_info` ( `id` int(11) NOT NULL, `username` varchar(15) CHARACTER SET ascii COLLATE ascii_bin NOT NULL, `password` varchar(64) CHARACTER SET ascii COLLATE ascii_bin NOT NULL, `changed_date` datetime NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -------------------------------------------------------- -- -- Table structure for table `diary` -- CREATE TABLE `diary` ( `id` int(11) NOT NULL, `username` varchar(15) CHARACTER SET ascii COLLATE ascii_bin NOT NULL, `content` text NOT NULL, `writeDate` date NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `diary` -- INSERT INTO `diary` (`id`, `username`, `content`, `writeDate`) VALUES (1, 'r0001', 'It\'s Sunday today, my little friends Fiona and I went to the center bookstore for picking some books. We arrived at the store early morning by subway. In the beginning, there are a few persons, we both came to the comic bookshelf, and chose our best-liked comic book to read sitting on the floor. As time passed, more people came, and we found that we became roadblock, so we got up and picked several comics, encyclopedia and exercises book, paid for them, and then went home for reading.', '2020-05-03'), (3, 'r0001', 'Today is my birthday and I\'m so excited about it.In the morning I put a note on the table for my mum and it said,\"Today is my birthday,don\'t forget it!\"At school,I got many gifts and cards for my classmates and had a lot of fun.But I was still expecting the birthday party after school.', '2020-05-05'), (4, 'r0001', 'One Sunday morning, my mother and I are in a fruit shop . I like fruit very much , so I want to buy some fruit. There are a lot of fruits in the shop. Look, the watermelons are green and big , the bananas are yellow and nice , the apples are red and sweet. I like pears very much , so my mother buys three kilos of pears for me. And my father likes bananas, so my mother buys two kilos of bananas for him.', '2020-05-22'), (5, 'r0001', 'One Sunday morning, my mother and I are in a fruit shop . I like fruit very much , so I want to buy some fruit. There are a lot of fruits in the shop. Look, the watermelons are green and big , the bananas are yellow and nice , the apples are red and sweet. I like pears very much , so my mother buys three kilos of pears for me. And my father likes bananas, so my mother buys two kilos of bananas for him.', '2020-05-22'), (6, 'r0001', 'One Sunday morning, my mother and I are in a fruit shop . I like fruit very much , so I want to buy some fruit. There are a lot of fruits in the shop. Look, the watermelons are green and big , the bananas are yellow and nice , the apples are red and sweet. I like pears very much , so my mother buys three kilos of pears for me. And my father likes bananas, so my mother buys two kilos of bananas for him.', '2020-05-22'), (7, 'r0001', 'One Sunday morning, my mother and I are in a fruit shop . I like fruit very much , so I want to buy some fruit. There are a lot of fruits in the shop. Look, the watermelons are green and big , the bananas are yellow and nice , the apples are red and sweet. I like pears very much , so my mother buys three kilos of pears for me. And my father likes bananas, so my mother buys two kilos of bananas for him.', '2020-05-22'), (8, 'r0001', 'One Sunday morning, my mother and I are in a fruit shop . I like fruit very much , so I want to buy some fruit. There are a lot of fruits in the shop. Look, the watermelons are green and big , the bananas are yellow and nice , the apples are red and sweet. I like pears very much , so my mother buys three kilos of pears for me. And my father likes bananas, so my mother buys two kilos of bananas for him.', '2020-05-22'), (9, 'r0001', 'One Sunday morning, my mother and I are in a fruit shop . I like fruit very much , so I want to buy some fruit. There are a lot of fruits in the shop. Look, the watermelons are green and big , the bananas are yellow and nice , the apples are red and sweet. I like pears very much , so my mother buys three kilos of pears for me. And my father likes bananas, so my mother buys two kilos of bananas for him.', '2020-05-22'), (10, 'r0001', 'One Sunday morning, my mother and I are in a fruit shop . I like fruit very much , so I want to buy some fruit. There are a lot of fruits in the shop. Look, the watermelons are green and big , the bananas are yellow and nice , the apples are red and sweet. I like pears very much , so my mother buys three kilos of pears for me. And my father likes bananas, so my mother buys two kilos of bananas for him.', '2020-05-22'), (11, 'r0001', 'One Sunday morning, my mother and I are in a fruit shop . I like fruit very much , so I want to buy some fruit. There are a lot of fruits in the shop. Look, the watermelons are green and big , the bananas are yellow and nice , the apples are red and sweet. I like pears very much , so my mother buys three kilos of pears for me. And my father likes bananas, so my mother buys two kilos of bananas for him.', '2020-05-22'), (12, 'r0001', 'One Sunday morning, my mother and I are in a fruit shop . I like fruit very much , so I want to buy some fruit. There are a lot of fruits in the shop. Look, the watermelons are green and big , the bananas are yellow and nice , the apples are red and sweet. I like pears very much , so my mother buys three kilos of pears for me. And my father likes bananas, so my mother buys two kilos of bananas for him.', '2020-05-22'), (13, 'r0001', 'One Sunday morning, my mother and I are in a fruit shop . I like fruit very much , so I want to buy some fruit. There are a lot of fruits in the shop. Look, the watermelons are green and big , the bananas are yellow and nice , the apples are red and sweet. I like pears very much , so my mother buys three kilos of pears for me. And my father likes bananas, so my mother buys two kilos of bananas for him.', '2020-05-22'), (14, 'r0001', 'One Sunday morning, my mother and I are in a fruit shop . I like fruit very much , so I want to buy some fruit. There are a lot of fruits in the shop. Look, the watermelons are green and big , the bananas are yellow and nice , the apples are red and sweet. I like pears very much , so my mother buys three kilos of pears for me. And my father likes bananas, so my mother buys two kilos of bananas for him.', '2020-05-22'), (15, 'r0001', 'One Sunday morning, my mother and I are in a fruit shop . I like fruit very much , so I want to buy some fruit. There are a lot of fruits in the shop. Look, the watermelons are green and big , the bananas are yellow and nice , the apples are red and sweet. I like pears very much , so my mother buys three kilos of pears for me. And my father likes bananas, so my mother buys two kilos of bananas for him.', '2020-05-22'), (16, 'r0001', 'One Sunday morning, my mother and I are in a fruit shop . I like fruit very much , so I want to buy some fruit. There are a lot of fruits in the shop. Look, the watermelons are green and big , the bananas are yellow and nice , the apples are red and sweet. I like pears very much , so my mother buys three kilos of pears for me. And my father likes bananas, so my mother buys two kilos of bananas for him.', '2020-05-22'), (17, 'r0001', 'One Sunday morning, my mother and I are in a fruit shop . I like fruit very much , so I want to buy some fruit. There are a lot of fruits in the shop. Look, the watermelons are green and big , the bananas are yellow and nice , the apples are red and sweet. I like pears very much , so my mother buys three kilos of pears for me. And my father likes bananas, so my mother buys two kilos of bananas for him.', '2020-05-22'), (18, 'r0001', 'One Sunday morning, my mother and I are in a fruit shop . I like fruit very much , so I want to buy some fruit. There are a lot of fruits in the shop. Look, the watermelons are green and big , the bananas are yellow and nice , the apples are red and sweet. I like pears very much , so my mother buys three kilos of pears for me. And my father likes bananas, so my mother buys two kilos of bananas for him.', '2020-05-22'), (19, 'r0001', 'One Sunday morning, my mother and I are in a fruit shop . I like fruit very much , so I want to buy some fruit. There are a lot of fruits in the shop. Look, the watermelons are green and big , the bananas are yellow and nice , the apples are red and sweet. I like pears very much , so my mother buys three kilos of pears for me. And my father likes bananas, so my mother buys two kilos of bananas for him.', '2020-05-22'), (20, 'r0001', 'One Sunday morning, my mother and I are in a fruit shop . I like fruit very much , so I want to buy some fruit. There are a lot of fruits in the shop. Look, the watermelons are green and big , the bananas are yellow and nice , the apples are red and sweet. I like pears very much , so my mother buys three kilos of pears for me. And my father likes bananas, so my mother buys two kilos of bananas for him.', '2020-05-22'), (21, 'r0001', 'One Sunday morning, my mother and I are in a fruit shop . I like fruit very much , so I want to buy some fruit. There are a lot of fruits in the shop. Look, the watermelons are green and big , the bananas are yellow and nice , the apples are red and sweet. I like pears very much , so my mother buys three kilos of pears for me. And my father likes bananas, so my mother buys two kilos of bananas for him.', '2020-05-22'), (22, 'r0001', 'One Sunday morning, my mother and I are in a fruit shop . I like fruit very much , so I want to buy some fruit. There are a lot of fruits in the shop. Look, the watermelons are green and big , the bananas are yellow and nice , the apples are red and sweet. I like pears very much , so my mother buys three kilos of pears for me. And my father likes bananas, so my mother buys two kilos of bananas for him.', '2020-05-22'), (23, 'r0001', 'happy day', '2020-05-24'), (24, 'r0001', 'Happy day', '2020-05-24'), (25, 'r0001', '666', '2020-05-24'), (26, 'r0001', '666', '2020-05-24'), (27, 'r0001', '666', '2020-05-24'), (28, 'r0001', '6666', '2020-05-24'), (29, 'r0001', '666', '2020-05-24'); -- -------------------------------------------------------- -- -- Table structure for table `group_info` -- CREATE TABLE `group_info` ( `group_id` tinyint(1) NOT NULL, `motto` text NOT NULL DEFAULT 'Move on' ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `group_info` -- INSERT INTO `group_info` (`group_id`, `motto`) VALUES (1, 'Everything will be fine'), (2, 'Move on'), (3, 'Smile'); -- -------------------------------------------------------- -- -- Table structure for table `login_info` -- CREATE TABLE `login_info` ( `username` varchar(15) CHARACTER SET ascii COLLATE ascii_bin NOT NULL, `password` varchar(64) CHARACTER SET ascii COLLATE ascii_bin NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `login_info` -- INSERT INTO `login_info` (`username`, `password`) VALUES ('r0001', '$2y$10$RLDa2CfEiC2RygS4gelp5.Hx2jn6C5QKqYNwnpo/YFNB8nKc3LxQa'), ('r0002', '$2y$10$RLDa2CfEiC2RygS4gelp5.Hx2jn6C5QKqYNwnpo/YFNB8nKc3LxQa'), ('r0003', '$2y$10$RLDa2CfEiC2RygS4gelp5.Hx2jn6C5QKqYNwnpo/YFNB8nKc3LxQa'), ('r0004', '$2y$10$RLDa2CfEiC2RygS4gelp5.Hx2jn6C5QKqYNwnpo/YFNB8nKc3LxQa'), ('r0005', '$2y$10$RLDa2CfEiC2RygS4gelp5.Hx2jn6C5QKqYNwnpo/YFNB8nKc3LxQa'), ('r0006', '$2y$10$RLDa2CfEiC2RygS4gelp5.Hx2jn6C5QKqYNwnpo/YFNB8nKc3LxQa'), ('r0007', '$2y$10$RLDa2CfEiC2RygS4gelp5.Hx2jn6C5QKqYNwnpo/YFNB8nKc3LxQa'), ('r0008', '$2y$10$RLDa2CfEiC2RygS4gelp5.Hx2jn6C5QKqYNwnpo/YFNB8nKc3LxQa'), ('r0009', '$2y$10$RLDa2CfEiC2RygS4gelp5.Hx2jn6C5QKqYNwnpo/YFNB8nKc3LxQa'), ('s0001', '$2y$10$RLDa2CfEiC2RygS4gelp5.Hx2jn6C5QKqYNwnpo/YFNB8nKc3LxQa'), ('s0002', '$2y$10$RLDa2CfEiC2RygS4gelp5.Hx2jn6C5QKqYNwnpo/YFNB8nKc3LxQa'), ('s0003', '$2y$10$RLDa2CfEiC2RygS4gelp5.Hx2jn6C5QKqYNwnpo/YFNB8nKc3LxQa'), ('s0004', '$2y$10$RLDa2CfEiC2RygS4gelp5.Hx2jn6C5QKqYNwnpo/YFNB8nKc3LxQa'), ('s0005', '$2y$10$RLDa2CfEiC2RygS4gelp5.Hx2jn6C5QKqYNwnpo/YFNB8nKc3LxQa'), ('123456', '$2y$10$sHSYWLthP19Ju.itJqQIYeubokVUJ1hcT/mqazCgIgDTnC0Hpt6dm'); -- -- Triggers `login_info` -- DELIMITER $$ CREATE TRIGGER `save_old_login_info` BEFORE UPDATE ON `login_info` FOR EACH ROW insert into changed_login_info(username,password,changed_date) values(old.username,old.password,now()) $$ DELIMITER ; -- -------------------------------------------------------- -- -- Table structure for table `r_profile` -- CREATE TABLE `r_profile` ( `id` int(11) NOT NULL, `username` varchar(15) CHARACTER SET ascii COLLATE ascii_bin NOT NULL, `firstname` varchar(15) CHARACTER SET ascii NOT NULL, `lastname` varchar(15) CHARACTER SET ascii NOT NULL, `birthday` date NOT NULL, `groups` tinyint(1) NOT NULL, `godFather` varchar(15) CHARACTER SET ascii COLLATE ascii_bin NOT NULL, `joinDate` date NOT NULL, `avatar` tinyint(1) NOT NULL, `deleted` tinyint(1) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `r_profile` -- INSERT INTO `r_profile` (`id`, `username`, `firstname`, `lastname`, `birthday`, `groups`, `godFather`, `joinDate`, `avatar`, `deleted`) VALUES (1, 'r0001', 'Alex', 'Smith', '1998-02-10', 1, 'r0003', '2020-04-01', 4, 0), (2, 'r0002', 'Diana', 'Steven', '1988-09-20', 2, 'r0001', '2020-03-10', 7, 0), (3, 'r0003', 'Jeff', 'Drump', '1988-09-10', 1, 'r0002', '2020-05-11', 5, 0), (4, 'r0004', 'Mary', 'Drump', '1988-09-22', 1, 'r0003', '2020-04-02', 6, 0), (5, 'r0005', 'Zoe', 'Miller', '1989-10-13', 1, 'r0002', '2020-04-02', 9, 0); -- -------------------------------------------------------- -- -- Table structure for table `staff_profile` -- CREATE TABLE `staff_profile` ( `id` int(11) NOT NULL, `username` varchar(15) CHARACTER SET ascii COLLATE ascii_bin NOT NULL, `firstname` varchar(15) NOT NULL, `lastname` varchar(15) NOT NULL, `position` varchar(15) NOT NULL, `description` text NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `staff_profile` -- INSERT INTO `staff_profile` (`id`, `username`, `firstname`, `lastname`, `position`, `description`) VALUES (1, 's0001', 'Jeff', 'Smith', 'doctor', 'Responsible for adjusting therapy'), (2, 's0002', 'Mike', 'Davis', 'doctor', 'Responsible for psychological counseling'), (3, 's0003', 'Zac', 'Wilson', 'doctor', 'Responsible for psychological counseling'), (4, 'r0004', 'Mary', 'Miller', 'doctor', 'Responsible for front desk'); -- -------------------------------------------------------- -- -- Table structure for table `tasks_description` -- CREATE TABLE `tasks_description` ( `step` tinyint(1) NOT NULL, `task` tinyint(1) NOT NULL, `description` varchar(100) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `tasks_description` -- INSERT INTO `tasks_description` (`step`, `task`, `description`) VALUES (1, 1, 'task1.1'), (1, 2, 'task1.2'), (1, 3, 'task1.3'), (1, 4, 'task1.4'), (2, 1, 'task2.1'), (2, 2, 'task2.2'), (2, 3, 'task2.3'), (2, 4, 'task2.4'), (3, 1, 'task3.1'), (3, 2, 'task3.2'), (3, 3, 'task3.3'), (3, 4, 'task3.4'); -- -------------------------------------------------------- -- -- Table structure for table `task_info` -- CREATE TABLE `task_info` ( `id` tinyint(1) NOT NULL, `username` varchar(15) CHARACTER SET ascii COLLATE ascii_bin NOT NULL, `step` tinyint(1) NOT NULL, `task` tinyint(1) NOT NULL, `deleted` tinyint(1) NOT NULL DEFAULT 0 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `task_info` -- INSERT INTO `task_info` (`id`, `username`, `step`, `task`, `deleted`) VALUES (1, 'r0001', 1, 1, 0), (2, 'r0001', 1, 2, 0), (3, 'r0001', 1, 3, 0), (4, 'r0001', 1, 4, 0), (5, 'r0001', 2, 1, 0), (6, 'r0001', 2, 2, 0), (7, 'r0001', 2, 3, 0), (8, 'r0001', 2, 4, 0), (9, 'r0001', 3, 1, 0), (10, 'r0001', 3, 2, 0), (11, 'r0001', 3, 3, 0), (12, 'r0002', 1, 1, 0), (13, 'r0002', 1, 2, 0), (14, 'r0002', 1, 3, 0), (15, 'r0002', 2, 1, 0), (16, 'r0002', 2, 2, 0), (17, 'r0003', 1, 2, 0), (19, 'r0003', 1, 3, 0); -- -------------------------------------------------------- -- -- Table structure for table `therapy` -- CREATE TABLE `therapy` ( `id` int(11) NOT NULL, `username` varchar(15) CHARACTER SET ascii COLLATE ascii_bin NOT NULL, `therapy` varchar(50) NOT NULL, `start` date NOT NULL, `end` date NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `therapy` -- INSERT INTO `therapy` (`id`, `username`, `therapy`, `start`, `end`) VALUES (1, 'r0001', 'Medicine', '2020-05-01', '2020-06-19'), (2, 'r0001', 'Psychological counseling', '2020-05-21', '2020-06-19'); -- -------------------------------------------------------- -- -- Table structure for table `yellow_card` -- CREATE TABLE `yellow_card` ( `id` int(11) NOT NULL, `username` varchar(15) CHARACTER SET ascii COLLATE ascii_bin NOT NULL, `description` text NOT NULL, `time` date NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `yellow_card` -- INSERT INTO `yellow_card` (`id`, `username`, `description`, `time`) VALUES (1, 'r0001', 'Eat too much', '2020-05-25'), (2, 'r0001', 'Smoke in public area', '2020-05-05'), (3, 'r0001', 'Absent in yoga course', '2020-05-30'); -- -- Indexes for dumped tables -- -- -- Indexes for table `appointment` -- ALTER TABLE `appointment` ADD PRIMARY KEY (`id`), ADD KEY `appointment_patient` (`patient`), ADD KEY `appointment_doctor` (`doctor`); -- -- Indexes for table `changed_login_info` -- ALTER TABLE `changed_login_info` ADD PRIMARY KEY (`id`), ADD KEY `username_old_info` (`username`); -- -- Indexes for table `diary` -- ALTER TABLE `diary` ADD PRIMARY KEY (`id`), ADD KEY `username_diary_fk` (`username`); -- -- Indexes for table `group_info` -- ALTER TABLE `group_info` ADD PRIMARY KEY (`group_id`); -- -- Indexes for table `login_info` -- ALTER TABLE `login_info` ADD PRIMARY KEY (`username`), ADD KEY `login_info_password` (`password`); -- -- Indexes for table `r_profile` -- ALTER TABLE `r_profile` ADD PRIMARY KEY (`id`), ADD KEY `username` (`username`), ADD KEY `group_fk` (`groups`), ADD KEY `godfather_fk` (`godFather`); -- -- Indexes for table `staff_profile` -- ALTER TABLE `staff_profile` ADD PRIMARY KEY (`id`), ADD KEY `username_staff_fk` (`username`); -- -- Indexes for table `tasks_description` -- ALTER TABLE `tasks_description` ADD PRIMARY KEY (`step`,`task`); -- -- Indexes for table `task_info` -- ALTER TABLE `task_info` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `username_step_task` (`step`,`task`,`username`) USING BTREE, ADD KEY `task_info_step` (`step`), ADD KEY `task_info_deleted` (`deleted`), ADD KEY `task_username_fk` (`username`); -- -- Indexes for table `therapy` -- ALTER TABLE `therapy` ADD PRIMARY KEY (`id`), ADD KEY `therapy_username` (`username`); -- -- Indexes for table `yellow_card` -- ALTER TABLE `yellow_card` ADD PRIMARY KEY (`id`), ADD KEY `yellow_card_username` (`username`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `appointment` -- ALTER TABLE `appointment` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=25; -- -- AUTO_INCREMENT for table `changed_login_info` -- ALTER TABLE `changed_login_info` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `diary` -- ALTER TABLE `diary` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=30; -- -- AUTO_INCREMENT for table `r_profile` -- ALTER TABLE `r_profile` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6; -- -- AUTO_INCREMENT for table `staff_profile` -- ALTER TABLE `staff_profile` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6; -- -- AUTO_INCREMENT for table `task_info` -- ALTER TABLE `task_info` MODIFY `id` tinyint(1) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=20; -- -- AUTO_INCREMENT for table `therapy` -- ALTER TABLE `therapy` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3; -- -- AUTO_INCREMENT for table `yellow_card` -- ALTER TABLE `yellow_card` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; -- -- Constraints for dumped tables -- -- -- Constraints for table `appointment` -- ALTER TABLE `appointment` ADD CONSTRAINT `appointment_doctor` FOREIGN KEY (`doctor`) REFERENCES `login_info` (`username`), ADD CONSTRAINT `appointment_patient` FOREIGN KEY (`patient`) REFERENCES `login_info` (`username`); -- -- Constraints for table `changed_login_info` -- ALTER TABLE `changed_login_info` ADD CONSTRAINT `old_password_username_fk` FOREIGN KEY (`username`) REFERENCES `login_info` (`username`); -- -- Constraints for table `diary` -- ALTER TABLE `diary` ADD CONSTRAINT `username_diary_fk` FOREIGN KEY (`username`) REFERENCES `login_info` (`username`); -- -- Constraints for table `r_profile` -- ALTER TABLE `r_profile` ADD CONSTRAINT `godfather_fk` FOREIGN KEY (`godFather`) REFERENCES `login_info` (`username`), ADD CONSTRAINT `group_fk` FOREIGN KEY (`groups`) REFERENCES `group_info` (`group_id`), ADD CONSTRAINT `username_fk` FOREIGN KEY (`username`) REFERENCES `login_info` (`username`); -- -- Constraints for table `staff_profile` -- ALTER TABLE `staff_profile` ADD CONSTRAINT `username_staff_fk` FOREIGN KEY (`username`) REFERENCES `login_info` (`username`); -- -- Constraints for table `task_info` -- ALTER TABLE `task_info` ADD CONSTRAINT `step_task` FOREIGN KEY (`step`,`task`) REFERENCES `tasks_description` (`step`, `task`), ADD CONSTRAINT `task_username_fk` FOREIGN KEY (`username`) REFERENCES `login_info` (`username`); -- -- Constraints for table `therapy` -- ALTER TABLE `therapy` ADD CONSTRAINT `therapy_username` FOREIGN KEY (`username`) REFERENCES `login_info` (`username`); -- -- Constraints for table `yellow_card` -- ALTER TABLE `yellow_card` ADD CONSTRAINT `yellow_card_username` FOREIGN KEY (`username`) REFERENCES `login_info` (`username`); 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
0237b8d9bc0620c785a98a469cb99c689bb40906
SQL
julialj95/langrec-api
/migrations/003.do.create_saved_resources_table.sql
UTF-8
197
2.984375
3
[]
no_license
CREATE TABLE saved_resources ( id INTEGER PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY, user_id INTEGER REFERENCES users(id) NOT NULL, resource_id INTEGER REFERENCES resources(id) NOT NULL );
true
fe79b8b378e09ba8c7a004e52d6cb259eaf6470f
SQL
andrewlaery/Project77Code-GitHub
/_2 Query - RECORDS_PROJECTS detail view.sql
UTF-8
1,029
3.859375
4
[]
no_license
-- RECORDS_PROJECTS view with detail. SELECT -- RECORDS_PROJECTS.membersID AS MembersID , CONCAT(RECORDS_MEMBERS.NameFirst , ' ' , RECORDS_MEMBERS.NameLast) AS NameFull , -- RECORDS_MEMBERS.ClubsID AS ClubsID , -- RECORDS_PROJECTS.QualificationsID AS QualificationsID, TMI_QUALIFICATIONS.qualification AS Qualification , -- RECORDS_PROJECTS.ProjectsID , TMI_PROJECTS.project AS Project , -- RECORDS_PROJECTS.RolesID AS RolesID, TMI_ROLES.role AS Role, DATE_FORMAT(RECORDS_PROJECTS.MeetingDate , "%d-%b-%y") , RECORDS_PROJECTS.itemstatus , RECORDS_PROJECTS.Comments FROM RECORDS_PROJECTS LEFT JOIN RECORDS_MEMBERS ON RECORDS_MEMBERS.id = RECORDS_PROJECTS.membersID LEFT JOIN TMI_QUALIFICATIONS ON TMI_QUALIFICATIONS.id = RECORDS_PROJECTS.qualificationsID LEFT JOIN TMI_PROJECTS ON TMI_PROJECTS.id = RECORDS_PROJECTS.projectsID LEFT JOIN TMI_ROLES ON TMI_ROLES.id = RECORDS_PROJECTS.rolesID /* WHERE RECORDS_PROJECTS.RolesID = '1' AND RECORDS_MEMBERS.ClubsID = '1' */ ORDER BY RECORDS_PROJECTS.MeetingDate DESC;
true
b999b5ac5ab447a1ebe9a3790ca4e39958b8c969
SQL
jinxTelesis/BCS260Database
/project-AndreLussier-part4.sql
UTF-8
4,329
2.96875
3
[]
no_license
-- id last first advisor enrolled dormname roomnum phone date degree INSERT INTO STUDENT VALUES(40000011,'Reznor','Trent','Dr Thomas','Matericulated','bacon hall','108','603-487-9812','1999-08-21','Computer Science', 'Trent.Reznor@yahoo.com'); INSERT INTO STUDENT VALUES(40000012,'Keenan','Maynord','Dr Aydin','Matericulated','Ribbon hall','109','607-687-9812','1998-07-10','Biology', 'Maynord.Keenan@yahoo.com'); INSERT INTO STUDENT VALUES(40000013,'Moreno','Chino','Bruce Walden','Matericulated','Grey hall','210','603-487-9812','2002-03-25','Computer Science', 'Chino.Moreno@yahoo.com'); -- worked -- -- -- id last first email phone INSERT INTO ALUMNI(ALUID, LastName, FirstName, Email, PhoneNumber, HomeAddress, HomeCity, HomeState, HomeZip) Values (40000202,'Smith', 'John','John.Smith@students.hu.edu','777-483-2232', '117 Franklin Street','Worchester', 'MA', '18071'); -- address -- INSERT INTO ALUMNI(ALUID, LastName, FirstName, Email, PhoneNumber, HomeAddress, HomeCity, HomeState, HomeZip) Values (40000203, 'Waters', 'Emily', 'Emily.Waters@students.hu.edu','607-555-1717', '1800 Rainbow Road', 'San francisco', 'CA', '17713'); INSERT INTO ALUMNI(ALUID, LastName, FirstName, Email, PhoneNumber, HomeAddress, HomeCity, HomeState, HomeZip) Values (400000204, 'Gears', 'Taylor','Taylor.Gears@students.hu.edu','508-243-1891', '99 Gecko Drive', 'Hubardston', 'CA', '19010'); -- worked -- -- INSERT INTO FACULTY(FACID, LastName,FirstName,Department,EmailUID,OfficeBuildingName, OfficePhone, OfficeBuildingRoom) Values (80000201, 'Cromwell','Fredrick','Computer Science','Fredrick.Cromwell@hu.edu','Brown Hall','877-567-8888','2008'); INSERT INTO FACULTY(FACID, LastName,FirstName,Department,EmailUID,OfficeBuildingName, OfficePhone, OfficeBuildingRoom) Values (80000202, 'Ulf','Nero','Astrophysics','Nero.Ulf@hu.edu','Brown Hall','877-567-9881','Observitory'); INSERT INTO FACULTY(FACID, LastName,FirstName,Department,EmailUID,OfficeBuildingName, OfficePhone, OfficeBuildingRoom) Values (80000203, 'Chesterfield','Rengar','Nuclear Engineering','Rengar.Chesterfield@hu.edu','Whitman','977-517-9001','Janitor Closet'); -- worked -- -- INSERT INTO COMPANY(CompanyName, CompanyPhone, CompanyAddress, CompanyCity, CompanyState) values ('Dunder N Mifflin', '431-877-5608','1080 Bruce Street','NeitherHereNoreThere','NC'); INSERT INTO COMPANY(CompanyName, CompanyPhone, CompanyAddress, CompanyCity, CompanyState) values ('Hammermill Company', '438-171-4008','9991 Maryville Lane','Center View','CA'); INSERT INTO COMPANY(CompanyName, CompanyPhone, CompanyAddress, CompanyCity, CompanyState) values ('Microsoft', '999-777-5555','Buying Out Google Drive','High Castle','CA'); -- worked -- could be from alumni or could be seperate email INSERT INTO MENTORS(MentorEmail,LastName, FirstName, CompanyName,CompanyState,AlumniEmail) VALUES('John.Smith@students.hu.edu', 'Smith','John', 'Dunder N Mifflin', 'NC', 'John.Smith@students.hu.edu'); INSERT INTO MENTORS(MentorEmail,LastName, FirstName, CompanyName,CompanyState,AlumniEmail) VALUES('Emily.Waters@students.hu.edu','Waters','Emily', 'HammerMill Company','CA','Emily.Waters@students.hu.edu'); INSERT INTO MENTORS(MentorEmail,LastName, FirstName, CompanyName,CompanyState,AlumniEmail) VALUES( 'Taylor.Gears@students.hu.edu', 'Gears','Taylor','Microsoft','CA','Taylor.Gears@students.hu.edu'); -- -- INSERT INTO STUFACAS(STUIDAS, FACIDAS, StartDate, EndDate) VALUES (40000011,80000201,'2020-06-25','2022-06-24'); INSERT INTO STUFACAS(STUIDAS, FACIDAS, StartDate, EndDate) VALUES (40000012,80000202,'2020-06-25','2022-06-24'); INSERT INTO STUFACAS(STUIDAS, FACIDAS, StartDate, EndDate) VALUES (40000013,80000203,'2020-06-25','2022-06-24'); -- -- INSERT INTO STU_MENTOR_AS(STUIDMENT,MentorEmail,StartDate, EndDate) VALUES (40000011,'John.Smith@students.hu.edu', '2020-06-25','2022-06-24'); INSERT INTO STU_MENTOR_AS(STUIDMENT,MentorEmail,StartDate, EndDate) VALUES (40000012,'Emily.Waters@students.hu.edu', '2020-06-25','2022-06-24'); INSERT INTO STU_MENTOR_AS(STUIDMENT,MentorEmail,StartDate, EndDate) VALUES (40000013,'Taylor.Gears@students.hu.edu', '2020-06-25','2022-06-24'); -- -- INSERT INTO ment_assignment(FACIDAS,MentorEmail,StartDate,EndDate) VALUES (80000201,'John.Smith@students.hu.edu','2020-06-25','2022-06-24'); INSERT INTO ment_assignment(FACIDAS,MentorEmail,StartDate,EndDate) VALUES (80000202,'Emily.Waters@students.hu.edu','2020-06-25','2022-06-24'); INSERT INTO ment_assignment(FACIDAS,MentorEmail,StartDate,EndDate) VALUES (80000203,'Taylor.Gears@students.hu.edu','2020-06-25','2022-06-24');
true
de23afcfdeed2a7da701303e5b0efc57f75f3622
SQL
Wim4rk/BTH-databas
/skolan/insert.sql
UTF-8
1,927
3.59375
4
[]
no_license
-- RESET data to TABLES USE skolan; SET NAMES 'utf8'; -- Add teacher staff -- DELETE FROM larare; -- INSERT INTO larare VALUES ('sna', 'DIPT', 'Severus', 'Snape', 'M', 40000, '1951-05-01', 1); -- INSERT INTO larare VALUES ('dum', 'ADM', 'Albus', 'Dumbledore', 'M', 80000, '1941-04-01', 1); -- INSERT INTO larare VALUES ('min', 'DIDD', 'Minerva', 'McGonagall', 'K', 40000, '1955-05-05', 1); -- Another way to do this -- INSERT INTO larare (akronym, avdelning, fornamn, efternamn, kon, lon, fodd) VALUES ('sna', 'DIPT', 'Severus', 'Snape', 'M', 40000, '1951-05-01'), ('dum', 'ADM', 'Albus', 'Dumbledore', 'M', 80000, '1941-04-01'), ('min', 'DIDD', 'Minerva', 'McGonagall', 'K', 40000, '1955-05-05'), ('hag', 'ADM', 'Hagrid', 'Rubeus', 'M', 25000, '1956-05-06'), ('fil', 'ADM', 'Argus', 'Filch', 'M', 25000, '1946-04-06'), ('hoc', 'DIDD', 'Madam', 'Hooch', 'K', 35000, '1948-04-08') ; -- Incomplete list, no salary (lon): -- INSERT INTO larare (akronym, avdelning, fornamn, efternamn, kon, fodd) VALUES ('gyl', 'DIPT', 'Gyllenroy', 'Lockman', 'M', '1952-05-02'), ('ala', 'DIPT', 'Alastor', 'Moody', 'M', '1943-04-03') ; -- -- Update a column value -- UPDATE larare SET lon = 30000 WHERE akronym = 'gyl'; UPDATE larare SET lon = 30000 WHERE lon IS NULL ; -- -- Make copy of table -- DROP TABLE IF EXISTS larare_pre; CREATE TABLE larare_pre LIKE larare; INSERT INTO larare_pre SELECT * FROM larare; -- -- Check the content of the tables, for sanity checking -- SELECT SUM(lon) AS 'Lönesumma', SUM(kompetens) AS Kompetens FROM larare; -- SELECT SUM(lon) AS 'Lönesumma', SUM(kompetens) AS Kompetens FROM larare_pre; -- CHECK RESULTS SELECT TABLE_NAME, ENGINE, TABLE_COLLATION FROM information_schema.TABLES WHERE TABLE_SCHEMA = 'skolan' AND ENGINE IS NOT NULL; SELECT akronym, avdelning, fornamn, kon, lon, kompetens FROM larare ORDER BY lon DESC;
true
5e9052ab5e66398ad5c65ccba7dc072efc65e232
SQL
176660/SQL_aegread
/Iga aegrea kohta üks tabel/create_btree_index.sql
UTF-8
91
2.78125
3
[]
no_license
CREATE INDEX stock_amzn_date_idx ON stock_amzn USING btree (date DESC NULLS LAST);
true
28e552ea769699aab2caecb80f1f04f8dad7b9d1
SQL
jack-sherman/capstone-mockup
/sql-scripts/create_tables.sql
UTF-8
2,496
4.03125
4
[]
no_license
-- Create Customers table ----Note that this will have to have a prefilled row for anonymous create table customers ( id serial, custName varchar(255) not null, email varchar(100), phone varchar(15), custAddress varchar(255), newsletter boolean default false, donorBadge varchar(100), seatingAccom varchar(100), vip boolean default false, primary key(id) ); -- Create Donations table create type freq as enum('one-time', 'weekly', 'monthly', 'yearly'); create table donations ( donationId serial, donorId integer, isAnonymous boolean default false, amount money, donoName varchar(255), frequency freq, comments varchar(255), donoDate date, primary key(donationId), foreign key(donorId) references customers(id) ); -- Create Discounts create table discounts ( id serial, code varchar(255), amount money, primary key(id) ); -- Create Reservation table create table reservation ( transNo serial, custId integer, eventId integer, eventName varchar(255), eventDate date, showTime time, numTickets integer, primary key(transNo), foreign key(custId) references customers(id) ); -- Create Seasons table create table seasons ( id serial, name varchar(100), startDate timestamp, endDate timestamp, primary key(id) ); -- Create TicketType create table ticketType ( id integer, name varchar(100), isSeason boolean, seasonId integer, price money, concessions money, primary key(id), foreign key(seasonId) references seasons(id) ); -- Create Plays table create table plays ( id serial, seasonId integer, playName varchar(255) not null, playDescription varchar(255), active boolean, primary key(id), foreign key(seasonId) references seasons(id) ); -- Create Showtime table create table showtimes ( id serial, playId integer, eventDate date, startTime time, saleStatus boolean, totalSeats integer, availableSeats integer, purchaseURI varchar(255), primary key(id), foreign key(playId) references plays(id) ); -- Create Tickets table create table tickets ( ticketNo serial, type integer, eventId integer, custId integer, paid boolean, active boolean, primary key(ticketNo), foreign key(type) references ticketType(id), foreign key(eventId) references showtimes(id), foreign key(custId) references customers(id) );
true
fa2d0b997b81305e1f71e5df8102118ffcc88f94
SQL
IMZIEE/PPID-Banjar
/database/db_rweb20.sql
UTF-8
3,644
2.875
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
-- phpMyAdmin SQL Dump -- version 4.8.0.1 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Generation Time: Jun 24, 2020 at 04:04 PM -- Server version: 10.1.32-MariaDB -- PHP Version: 7.2.5 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET AUTOCOMMIT = 0; START TRANSACTION; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8mb4 */; -- -- Database: `db_rweb20` -- -- -------------------------------------------------------- -- -- Table structure for table `tb_admin` -- CREATE TABLE `tb_admin` ( `id` int(11) NOT NULL, `email` varchar(150) NOT NULL, `password` varchar(150) NOT NULL, `nama` varchar(150) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `tb_admin` -- INSERT INTO `tb_admin` (`id`, `email`, `password`, `nama`) VALUES (1, 'admin_satu@gmail.com', '123456', 'Admin satu nih'), (2, 'admin_dua@gmail.com', '123456', 'admin dua nih'); -- -------------------------------------------------------- -- -- Table structure for table `tb_dosen` -- CREATE TABLE `tb_dosen` ( `id` int(11) NOT NULL, `nama` varchar(150) NOT NULL, `niy` char(50) NOT NULL, `keahlian` varchar(150) NOT NULL, `email` varchar(150) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `tb_dosen` -- INSERT INTO `tb_dosen` (`id`, `nama`, `niy`, `keahlian`, `email`) VALUES (1, 'Adhi Prahara, S.Si., M.Cs.', '060150841', 'Softcomputing and Multimedia', 'adhi.prahara@tif.uad.ac.id'), (2, 'Supriyanto, S.T., M.T.', '60160952', 'Media Digital dan Game', 'supriyanto@tif.uad.ac.id'), (3, 'Dinan Yulianto, S.T., M.Eng.', '601609524', 'Multimedia, Interaksi Manusia dan Komputer, dan IT in Education', 'dinan.yulianto@tif.uad.ac.id'), (4, 'Fiftin Noviyanto, S.T., M. Cs', '198011152005011002', 'Web Programming, Multimedia', 'fiftin.noviyanto@tif.uad.ac.id'), (5, 'Herman Yuliansyah, S.T., M. Eng', '60110648', 'Basis Data, Pemrograman Web, Jaringan Komputer', 'herman.yuliansyah@gmail.com'); -- -------------------------------------------------------- -- -- Table structure for table `tb_mahasiswa` -- CREATE TABLE `tb_mahasiswa` ( `id` int(11) NOT NULL, `nama` varchar(150) NOT NULL, `nim` char(50) NOT NULL, `semester` int(11) NOT NULL, `email` varchar(150) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `tb_mahasiswa` -- INSERT INTO `tb_mahasiswa` (`id`, `nama`, `nim`, `semester`, `email`) VALUES (1, 'Aslamadin Alvian Haz', '1600018001', 8, 'alvinsukamtis@gmail.com'), (2, 'Muhammad N.W Lutfiantoro', '1600018002', 8, 'Lutfiantoro@gmail.com'), (3, 'kholis ', '1600018003', 8, 'kholis @gmail.com'), (4, 'gema antika hariadi', '1600018004', 8, 'gema@gmail.com'), (5, 'Brian P.', '1600018005', 8, 'brian@gmail.com'); -- -- Indexes for dumped tables -- -- -- Indexes for table `tb_admin` -- ALTER TABLE `tb_admin` ADD PRIMARY KEY (`id`); -- -- Indexes for table `tb_dosen` -- ALTER TABLE `tb_dosen` ADD PRIMARY KEY (`id`); -- -- Indexes for table `tb_mahasiswa` -- ALTER TABLE `tb_mahasiswa` ADD PRIMARY KEY (`id`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `tb_admin` -- ALTER TABLE `tb_admin` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3; -- -- AUTO_INCREMENT for table `tb_dosen` -- ALTER TABLE `tb_dosen` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6; -- -- AUTO_INCREMENT for table `tb_mahasiswa` -- ALTER TABLE `tb_mahasiswa` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6; COMMIT; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
true
6218bbae02cbc3fa985d2d50bcc03c4b5bb054d1
SQL
Bonseong/KOPO_TIL
/DB/PLSQL/Day01 210701/3_NESTED_BLOCK_EXCEPT_2.SQL
UHC
969
2.625
3
[ "MIT" ]
permissive
BEGIN INSERT INTO DEPT VALUES(66, 'OUTER_BLK_PARK', 'MAIN_BLK'); <<NESTED_BLOCK_1>> BEGIN INSERT INTO DEPT VALUES(76, 'LOCAL_PART_1', 'NESTED_BLK1'); INSERT INTO DEPT VALUES(777, 'LOCAL_PART_1', 'NESTED_BLK1'); -- Ÿӿ ߻ -- INSERT INTO DEPT VALUES(77, 'LOCAL_PART_1', 'NESTED_BLK1'); INSERT INTO DEPT VALUES(78, 'LOCAL_PART_1', 'NESTED_BLK1'); COMMIT; END NESTED_BLOCK_1; <<NESTED_BLOCK_2>> BEGIN INSERT INTO DEPT VALUES(88, 'LOCAL_PART_2', 'NESTED_BLK2'); COMMIT; END BESTED_BLOCK2; INSERT INTO DEPT VALUES(99, 'OUTER_BLK_PART', 'MAIN_BLK'); END; / -- Exception ߻ϰ Ǹ ߻ ġ ۾ ʰ Block ó ó帧(Control Flow) Ѿ SELECT * FROM DEPT WHERE DEPTNO IN (66,76,77,78,88,99); DELETE FROM DEPT WHERE DEPTNO IN (66,76,77,78,88,99);
true
a58cbc4780dd7de1e1cfcf09c7ffe5a7ac17bb1c
SQL
gaku3601/scala-play-transaction
/conf/evolutions/default/1.sql
UTF-8
274
2.734375
3
[]
no_license
--- !Ups create table users ( id bigserial PRIMARY KEY, name varchar(255), age integer, updated_at timestamp not null default current_timestamp, created_at timestamp not null default current_timestamp ); --- !Downs drop table users;
true
ea0a4f0bf3df9c38f18c61e7b0dcceecf4dd05b5
SQL
ProgrammnieInzheneri/VSTU
/use_training_db.sql
UTF-8
4,979
3.15625
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 4.8.5 -- https://www.phpmyadmin.net/ -- -- Хост: 127.0.0.1 -- Время создания: Сен 15 2019 г., 22:32 -- Версия сервера: 10.1.40-MariaDB -- Версия PHP: 7.3.5 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 */; -- -- База данных: `use_training_db` -- -- -------------------------------------------------------- -- -- Структура таблицы `admin` -- CREATE TABLE `admin` ( `id` int(11) NOT NULL, `login` varchar(64) NOT NULL, `password` varchar(128) NOT NULL, `name` varchar(128) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Дамп данных таблицы `admin` -- INSERT INTO `admin` (`id`, `login`, `password`, `name`) VALUES (2, 'admin', 'ca05ab5a595ca0b36ea5c403bfc6779e33a8f6be8f8376294d7d71436a987d5b', 'admin'); -- -------------------------------------------------------- -- -- Структура таблицы `exercises` -- CREATE TABLE `exercises` ( `id` int(11) NOT NULL, `topicId` int(11) NOT NULL, `description` text NOT NULL, `img` text NOT NULL, `rightAnswer` int(11) NOT NULL, `version` int(11) NOT NULL, `status` tinyint(1) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Дамп данных таблицы `exercises` -- INSERT INTO `exercises` (`id`, `topicId`, `description`, `img`, `rightAnswer`, `version`, `status`) VALUES (1, 1, 'На графике изображена зависимость крутящего момента двигателя от числа его оборотов в минуту. На оси абсцисс откладывается число оборотов в минуту, на оси ординат — крутящий момент в Н м. Скорость автомобиля (в км/ч) приближенно выражается формулой v = 0,036n, где n — число оборотов двигателя в минуту. С какой наименьшей скоростью должен двигаться автомобиль, чтобы крутящий момент был не меньше 120 Н м? Ответ дайте в километрах в час.', 'https://mathb-ege.sdamgia.ru/get_file?id=51', 72, 0, 1); -- -------------------------------------------------------- -- -- Структура таблицы `subjects` -- CREATE TABLE `subjects` ( `id` int(11) NOT NULL, `name` varchar(128) NOT NULL, `img` text NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Дамп данных таблицы `subjects` -- INSERT INTO `subjects` (`id`, `name`, `img`) VALUES (1, 'Математика (профильная)', ''), (2, '123', ''); -- -------------------------------------------------------- -- -- Структура таблицы `topics` -- CREATE TABLE `topics` ( `id` int(11) NOT NULL, `number` int(11) NOT NULL, `title` varchar(256) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Дамп данных таблицы `topics` -- INSERT INTO `topics` (`id`, `number`, `title`) VALUES (1, 11, 'Текстовые задачи'); -- -- Индексы сохранённых таблиц -- -- -- Индексы таблицы `admin` -- ALTER TABLE `admin` ADD PRIMARY KEY (`id`); -- -- Индексы таблицы `exercises` -- ALTER TABLE `exercises` ADD PRIMARY KEY (`id`); -- -- Индексы таблицы `subjects` -- ALTER TABLE `subjects` ADD PRIMARY KEY (`id`); -- -- Индексы таблицы `topics` -- ALTER TABLE `topics` ADD PRIMARY KEY (`id`); -- -- AUTO_INCREMENT для сохранённых таблиц -- -- -- AUTO_INCREMENT для таблицы `admin` -- ALTER TABLE `admin` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3; -- -- AUTO_INCREMENT для таблицы `exercises` -- ALTER TABLE `exercises` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; -- -- AUTO_INCREMENT для таблицы `subjects` -- ALTER TABLE `subjects` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3; -- -- AUTO_INCREMENT для таблицы `topics` -- ALTER TABLE `topics` 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
06d1913da8ee50a550700f2db354a8d4dc209330
SQL
awsid9/CatalogueExport
/inst/sql/sql_server/analyses/901.sql
UTF-8
548
3.71875
4
[ "Apache-2.0" ]
permissive
-- 901 Number of drug occurrence records, by drug_concept_id --HINT DISTRIBUTE_ON_KEY(stratum_1) select 901 as analysis_id, CAST(de1.drug_CONCEPT_ID AS VARCHAR(255)) as stratum_1, cast(null as varchar(255)) as stratum_2, cast(null as varchar(255)) as stratum_3, cast(null as varchar(255)) as stratum_4, cast(null as varchar(255)) as stratum_5, floor((count_big(drug_concept_id)+99)/100)*100 as count_value into @scratchDatabaseSchema@schemaDelim@tempAchillesPrefix_901 from @cdmDatabaseSchema.drug_era de1 group by de1.drug_CONCEPT_ID ;
true
be76d74f82be7e428a023084c9774e0b13797910
SQL
tienthanh7992/thcstto
/src/main/resources/data/ches.sql
UTF-8
8,066
2.9375
3
[]
no_license
-- -- PostgreSQL database dump -- -- Dumped from database version 10.5 -- Dumped by pg_dump version 10.5 -- Started on 2018-10-29 00:45:04 +07 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; SET default_tablespace = ''; SET default_with_oids = false; -- -- TOC entry 203 (class 1259 OID 16483) -- Name: che_submit; Type: TABLE; Schema: public; Owner: postgres -- CREATE TABLE public.che_submit ( id bigserial NOT NULL, user_id bigint, question_id bigint, issue text, self_point double precision, principal_point double precision, final_point double precision, month integer, updated_at timestamp without time zone, leader_point double precision, year integer ); ALTER TABLE public.che_submit OWNER TO postgres; -- -- TOC entry 202 (class 1259 OID 16481) -- Name: che_submit_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres -- CREATE SEQUENCE public.che_submit_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; ALTER TABLE public.che_submit_id_seq OWNER TO postgres; -- -- TOC entry 3142 (class 0 OID 0) -- Dependencies: 202 -- Name: che_submit_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres -- ALTER SEQUENCE public.che_submit_id_seq OWNED BY public.che_submit.id; -- -- TOC entry 3011 (class 2604 OID 16486) -- Name: che_submit id; Type: DEFAULT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.che_submit ALTER COLUMN id SET DEFAULT nextval('public.che_submit_id_seq'::regclass); -- -- TOC entry 3136 (class 0 OID 16483) -- Dependencies: 203 -- Data for Name: che_submit; Type: TABLE DATA; Schema: public; Owner: postgres -- INSERT INTO public.che_submit (id, user_id, question_id, issue, self_point, principal_point, final_point, month, updated_at, leader_point, year) VALUES (148, 3, 12, '', NULL, NULL, NULL, 10, '2018-10-28 23:14:06.441134', NULL, 2018); INSERT INTO public.che_submit (id, user_id, question_id, issue, self_point, principal_point, final_point, month, updated_at, leader_point, year) VALUES (158, 3, 25, '', NULL, NULL, NULL, 10, '2018-10-28 23:14:06.441134', NULL, 2018); INSERT INTO public.che_submit (id, user_id, question_id, issue, self_point, principal_point, final_point, month, updated_at, leader_point, year) VALUES (160, 3, 30, '', NULL, NULL, NULL, 10, '2018-10-28 23:14:06.441134', NULL, 2018); INSERT INTO public.che_submit (id, user_id, question_id, issue, self_point, principal_point, final_point, month, updated_at, leader_point, year) VALUES (140, 3, 4, '', 0, NULL, NULL, 10, '2018-10-28 23:29:26.106585', 0, 2018); INSERT INTO public.che_submit (id, user_id, question_id, issue, self_point, principal_point, final_point, month, updated_at, leader_point, year) VALUES (141, 3, 3, '', 0, NULL, NULL, 10, '2018-10-28 23:29:26.106585', 0, 2018); INSERT INTO public.che_submit (id, user_id, question_id, issue, self_point, principal_point, final_point, month, updated_at, leader_point, year) VALUES (142, 3, 7, '', 0, NULL, NULL, 10, '2018-10-28 23:29:26.106585', 0, 2018); INSERT INTO public.che_submit (id, user_id, question_id, issue, self_point, principal_point, final_point, month, updated_at, leader_point, year) VALUES (143, 3, 9, '', 0, NULL, NULL, 10, '2018-10-28 23:29:26.106585', 0, 2018); INSERT INTO public.che_submit (id, user_id, question_id, issue, self_point, principal_point, final_point, month, updated_at, leader_point, year) VALUES (144, 3, 8, '', 0, NULL, NULL, 10, '2018-10-28 23:29:26.106585', 0, 2018); INSERT INTO public.che_submit (id, user_id, question_id, issue, self_point, principal_point, final_point, month, updated_at, leader_point, year) VALUES (145, 3, 11, '', 0, NULL, NULL, 10, '2018-10-28 23:29:26.106585', 0, 2018); INSERT INTO public.che_submit (id, user_id, question_id, issue, self_point, principal_point, final_point, month, updated_at, leader_point, year) VALUES (146, 3, 10, '', 0, NULL, NULL, 10, '2018-10-28 23:29:26.106585', 0, 2018); INSERT INTO public.che_submit (id, user_id, question_id, issue, self_point, principal_point, final_point, month, updated_at, leader_point, year) VALUES (147, 3, 5, '', 0, NULL, NULL, 10, '2018-10-28 23:29:26.106585', 0, 2018); INSERT INTO public.che_submit (id, user_id, question_id, issue, self_point, principal_point, final_point, month, updated_at, leader_point, year) VALUES (149, 3, 16, '', 0, NULL, NULL, 10, '2018-10-28 23:29:26.106585', 0, 2018); INSERT INTO public.che_submit (id, user_id, question_id, issue, self_point, principal_point, final_point, month, updated_at, leader_point, year) VALUES (150, 3, 15, '', 0, NULL, NULL, 10, '2018-10-28 23:29:26.106585', 0, 2018); INSERT INTO public.che_submit (id, user_id, question_id, issue, self_point, principal_point, final_point, month, updated_at, leader_point, year) VALUES (151, 3, 17, '', 0, NULL, NULL, 10, '2018-10-28 23:29:26.106585', 0, 2018); INSERT INTO public.che_submit (id, user_id, question_id, issue, self_point, principal_point, final_point, month, updated_at, leader_point, year) VALUES (152, 3, 22, '', 0, NULL, NULL, 10, '2018-10-28 23:29:26.106585', 0, 2018); INSERT INTO public.che_submit (id, user_id, question_id, issue, self_point, principal_point, final_point, month, updated_at, leader_point, year) VALUES (153, 3, 19, '', 0, NULL, NULL, 10, '2018-10-28 23:29:26.106585', 0, 2018); INSERT INTO public.che_submit (id, user_id, question_id, issue, self_point, principal_point, final_point, month, updated_at, leader_point, year) VALUES (154, 3, 18, '', 0, NULL, NULL, 10, '2018-10-28 23:29:26.106585', 0, 2018); INSERT INTO public.che_submit (id, user_id, question_id, issue, self_point, principal_point, final_point, month, updated_at, leader_point, year) VALUES (155, 3, 20, '', 0, NULL, NULL, 10, '2018-10-28 23:29:26.106585', 0, 2018); INSERT INTO public.che_submit (id, user_id, question_id, issue, self_point, principal_point, final_point, month, updated_at, leader_point, year) VALUES (156, 3, 21, '', 0, NULL, NULL, 10, '2018-10-28 23:29:26.106585', 0, 2018); INSERT INTO public.che_submit (id, user_id, question_id, issue, self_point, principal_point, final_point, month, updated_at, leader_point, year) VALUES (157, 3, 24, '', 0, NULL, NULL, 10, '2018-10-28 23:29:26.106585', 0, 2018); INSERT INTO public.che_submit (id, user_id, question_id, issue, self_point, principal_point, final_point, month, updated_at, leader_point, year) VALUES (159, 3, 26, '', 0, NULL, NULL, 10, '2018-10-28 23:29:26.106585', 0, 2018); INSERT INTO public.che_submit (id, user_id, question_id, issue, self_point, principal_point, final_point, month, updated_at, leader_point, year) VALUES (161, 3, 32, '', 0, NULL, NULL, 10, '2018-10-28 23:29:26.106585', 0, 2018); INSERT INTO public.che_submit (id, user_id, question_id, issue, self_point, principal_point, final_point, month, updated_at, leader_point, year) VALUES (162, 3, 33, '', 0, NULL, NULL, 10, '2018-10-28 23:29:26.106585', 0, 2018); INSERT INTO public.che_submit (id, user_id, question_id, issue, self_point, principal_point, final_point, month, updated_at, leader_point, year) VALUES (163, 3, 34, '', 0, NULL, NULL, 10, '2018-10-28 23:29:26.106585', 0, 2018); -- -- TOC entry 3143 (class 0 OID 0) -- Dependencies: 202 -- Name: che_submit_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres -- SELECT pg_catalog.setval('public.che_submit_id_seq', 163, true); -- -- TOC entry 3013 (class 2606 OID 16491) -- Name: che_submit che_submit_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY public.che_submit ADD CONSTRAINT che_submit_pkey PRIMARY KEY (id); ALTER TABLE ONLY public.che_result ADD CONSTRAINT che_submit_user_id_fkey FOREIGN KEY (user_id) REFERENCES public."user"(id); -- Completed on 2018-10-29 00:45:05 +07 -- -- PostgreSQL database dump complete --
true
adf9fc8def9fa2c4ae5d6f90872f0d28060b1053
SQL
BackupTheBerlios/liman-svn
/trunk/db/liman_struktur.sql
UTF-8
2,775
3.546875
4
[]
no_license
-- -- Tabellenstruktur für Tabelle `liman_Autoren` -- DROP TABLE IF EXISTS `liman_Autoren`; CREATE TABLE IF NOT EXISTS `liman_Autoren` ( `Autor_Nr` int(11) NOT NULL auto_increment, `Autorname` varchar(40) NOT NULL, PRIMARY KEY (`Autor_Nr`), UNIQUE KEY `Autorname` (`Autorname`), FULLTEXT KEY `Autorname_2` (`Autorname`) ); -- -------------------------------------------------------- -- -- Tabellenstruktur für Tabelle `liman_Bibliothek` -- DROP TABLE IF EXISTS `liman_Bibliothek`; CREATE TABLE IF NOT EXISTS `liman_Bibliothek` ( `Literatur_Nr` int(11) NOT NULL auto_increment, `Art` enum('Buch','Artikel','Broschüre','Protokoll','Anleitung','Diplomarbeit','Dissertation','Techn. Bericht','Unveröffentlicht','Sonstiges') NOT NULL, `Titel` varchar(40) NOT NULL, `Jahr` int(11) NOT NULL, `Verlag` varchar(40) NOT NULL, `ISBN` varchar(20) NOT NULL, `Beschreibung` text NOT NULL, `Ort` varchar(40) NOT NULL, `Stichworte` varchar(100) NOT NULL, PRIMARY KEY (`Literatur_Nr`), FULLTEXT KEY `Titel` (`Titel`,`Verlag`,`ISBN`,`Beschreibung`,`Ort`,`Stichworte`) ); -- -------------------------------------------------------- -- -- Tabellenstruktur für Tabelle `liman_Kommentare` -- DROP TABLE IF EXISTS `liman_Kommentare`; CREATE TABLE IF NOT EXISTS `liman_Kommentare` ( `Kommentar_Nr` int(11) NOT NULL auto_increment, `Kommentartext` text NOT NULL, `Literatur_Nr` int(11) NOT NULL, `Mitglieds_Nr` int(11) NOT NULL, PRIMARY KEY (`Kommentar_Nr`), KEY `Literatur_Nr` (`Literatur_Nr`,`Mitglieds_Nr`), FULLTEXT KEY `Kommentartext` (`Kommentartext`) ); -- -------------------------------------------------------- -- -- Tabellenstruktur für Tabelle `liman_Literatur_Autor` -- DROP TABLE IF EXISTS `liman_Literatur_Autor`; CREATE TABLE IF NOT EXISTS `liman_Literatur_Autor` ( `Autor_Nr` int(11) NOT NULL, `Literatur_Nr` int(11) NOT NULL, KEY `Autor_Nr` (`Autor_Nr`,`Literatur_Nr`) ) COMMENT='n-m-Relationstabelle Literatur-Autor'; -- -------------------------------------------------------- -- -- Tabellenstruktur für Tabelle `liman_Mitglieder` -- DROP TABLE IF EXISTS `liman_Mitglieder`; CREATE TABLE IF NOT EXISTS `liman_Mitglieder` ( `Mitglieds_Nr` int(11) NOT NULL auto_increment, `Name` varchar(20) NOT NULL, `Vorname` varchar(20) NOT NULL, `Email` text NOT NULL, `Login` varchar(12) NOT NULL, `Passwort` varchar(40) NOT NULL, `Rechte` enum('Benutzer','Administrator') NOT NULL, PRIMARY KEY (`Mitglieds_Nr`), UNIQUE KEY `Login` (`Login`) ); -- -- Daten für Tabelle `liman_Mitglieder` -- INSERT INTO `liman_Mitglieder` (`Mitglieds_Nr`, `Name`, `Vorname`, `Email`, `Login`, `Passwort`, `Rechte`) VALUES (NULL, 'Istrator', 'Admin', 'foo@bar.de', 'admin', 'c47c25460079d8a87d44175b732f73af2e92b6d2', 'Administrator');
true
745c965ecb6924bec716109bd82962d6e35b8843
SQL
axreldable/data-engineer-test-task-python-sql
/sql/happiest_user_tweets.sql
UTF-8
791
3.5
4
[]
no_license
select u.name, t.text from tweets t inner join users u on t.user_id = u.id where u.name = (select name from (select u.name, sum(t.sentiment) as total_sentiment from tweets t inner join users u on t.user_id = u.id group by u.name order by total_sentiment desc limit 1)); -- result: -- BIRTHDAY GIRL ✨|Hi @ShawnMendes 😘 -- Today is my birthday🎈 -- Can you follow me? This would be the best a birthday gift ever. 🎁 -- I love you soo much! 💕 -- x12,098 -- BIRTHDAY GIRL ✨|Hi @ShawnMendes 😘 -- Today is my birthday🎈 -- Can you follow me? This would be the best a birthday gift ever. 🎁 -- I love you soo much! 💕 -- x12,134
true
667c4cec8efcf8f382bcd9f205451268d964f01a
SQL
qwezertino/frozen-test
/mysql/6task.sql
UTF-8
323
3.546875
4
[]
no_license
SELECT user.email, user.wallet_balance, user.wallet_total_refilled, user.like_total_balance, pack.id as PACK, SUM(pack.price) as SUM_PACK_PRICE, SUM(upl.likes) as SUM_LIKES FROM `user_pack_log` as upl LEFT JOIN user on upl.user_id = user.id LEFT JOIN boosterpack as pack on upl.pack_id = pack.id GROUP BY user.id, pack.id;
true
837636ee134b725ed3a69883454366a3b5c1b175
SQL
galadREAL/school_projects
/MySQL-Challenge-master/SQL_ALL_Clean.sql
UTF-8
17,738
4.375
4
[]
no_license
-- 1a. Display the first and last names of all actors from the table actor. SELECT first_name AS 'Actor First Name', last_name AS 'Actor Last Name' FROM sakila.actor; -- 1b. Display the first and last name of each actor in a single column in upper case letters. Name the column Actor Name. SELECT CONCAT(UPPER(first_name), ' ', UPPER(last_name)) AS 'Full Actor Name in Upper Case' FROM sakila.actor; -- 2a. You need to find the ID number, first name, and last name of an actor, of whom you know only the first name, "Joe." What is one query would you use to -- obtain this information? SELECT actor_id AS 'Actor ID Number', first_name AS 'Actor First Name', last_name AS 'Actor Last Name' FROM sakila.actor WHERE first_name = 'Joe'; -- 2b. Find all actors whose last name contain the letters GEN: SELECT * FROM sakila.actor WHERE last_name LIKE '%GEN%'; -- 2c. Find all actors whose last names contain the letters LI. This time, order the rows by last name and first name, in that order: SELECT actor_id AS 'Actor ID Number', first_name AS 'Actor First Name', last_name AS 'Actor Last Name' FROM sakila.actor WHERE last_name LIKE '%LI%' ORDER BY last_name , first_name; -- 2d. Using IN, display the country_id and country columns of the following countries: Afghanistan, Bangladesh, and China: SELECT country_id AS 'Country ID Number', country AS 'Country Name' FROM sakila.country WHERE country IN ('Afghanistan' , 'Bangladesh', 'China'); -- 3a. You want to keep a description of each actor. You don't think you will be performing queries on a description, so create a column in the table actor -- named description and use the data type BLOB (Make sure to research the type BLOB, as the difference between it and VARCHAR are significant). ALTER TABLE sakila.actor ADD description blob; -- 3b. Very quickly you realize that entering descriptions for each actor is too much effort. Delete the description column. ALTER TABLE sakila.actor DROP COLUMN description; -- 4a. List the last names of actors, as well as how many actors have that last name. SELECT last_name AS 'Actor Last Name', COUNT(last_name) AS 'Count of Actors with Same Last Name' FROM sakila.actor GROUP BY last_name; -- 4b. List last names of actors and the number of actors who have that last name, but only for names that are shared by at least two actors. SELECT last_name AS 'Actor Last Name', COUNT(last_name) AS 'Count of Actors with Same Last Name (Minimum 2)' FROM sakila.actor GROUP BY last_name HAVING COUNT(last_name) >= 2; -- 4c. The actor HARPO WILLIAMS was accidentally entered in the actor table as GROUCHO WILLIAMS. Write a query to fix the record. UPDATE sakila.actor SET first_name = 'HARPO', last_name = 'WILLIAMS' WHERE first_name = 'GROUCHO' AND last_name = 'WILLIAMS'; -- 4d. Perhaps we were too hasty in changing GROUCHO to HARPO. It turns out that GROUCHO was the correct name after all! In a single query, if the first name -- of the actor is currently HARPO, change it to GROUCHO. UPDATE sakila.actor SET first_name = 'GROUCHO' WHERE first_name = 'HARPO'; -- ! is this right? -- 5a. You cannot locate the schema of the address table. Which query would you use to re-create it? SELECT * FROM information_schema.tables WHERE table_name = 'address'; -- ! -- ! maybe add the country also -- 6a. Use JOIN to display the first and last names, as well as the address, of each staff member. Use the tables staff and address: SELECT s.first_name AS 'Manager First Name', s.last_name AS 'Manager Last Name', CONCAT(a.address, ', ', a.district) AS 'Manager Home Address' FROM sakila.staff s LEFT JOIN sakila.address a ON (s.address_id = a.address_id); -- ! should I add sales' revenue also? -- ! maybe add a USD baseline here also -- 6b. Use JOIN to display the total amount rung up by each staff member in August of 2005. Use tables staff and payment. SELECT first_name AS 'Manager First Nae', last_name AS 'Manager Last Name', SUM(amount) AS 'Total Amount Rung Up in Rentals ($)' FROM sakila.staff s LEFT JOIN sakila.payment p ON (s.staff_id = p.staff_id) WHERE payment_date BETWEEN '2005-08-01%' AND '2005-08-31%' GROUP BY s.last_name , s.first_name; -- 6c. List each film and the number of actors who are listed for that film. Use tables film_actor and film. Use inner join. SELECT title AS 'Film Title', COUNT(actor_id) AS 'Number of Actors Listed' FROM sakila.film f INNER JOIN sakila.film_actor fa ON (f.film_id = fa.film_id) GROUP BY f.title; -- 6d. How many copies of the film Hunchback Impossible exist in the inventory system? SELECT COUNT(film_id) AS 'Copies of Hunchback Impossible in Inventory System' FROM inventory WHERE film_id IN (SELECT film_id FROM sakila.film WHERE title = 'Hunchback Impossible'); -- ! maybe add USD baseline here -- 6e. Using the tables payment and customer and the JOIN command, list the total paid by each customer. List the customers alphabetically by last name: SELECT last_name AS 'Customer Last Name', first_name AS 'Customer First Name', SUM(amount) AS 'Amount Spent ($)' FROM sakila.customer c JOIN sakila.payment p ON (c.customer_id = p.customer_id) GROUP BY c.customer_id ORDER BY c.last_name; -- 7a. The music of Queen and Kris Kristofferson have seen an unlikely resurgence. As an unintended consequence, films starting with the letters K and Q -- have also soared in popularity. Use subqueries to display the titles of movies starting with the letters K and Q whose language is English. SELECT title AS 'English Language Movies Starting with K or Q' FROM sakila.film WHERE language_id = (SELECT language_id FROM sakila.language WHERE name = 'English') AND title LIKE 'K%' OR title LIKE 'Q%'; -- 7b. Use subqueries to display all actors who appear in the film Alone Trip. SELECT last_name AS 'Actor Last Name', first_name AS 'Actor First Name' FROM sakila.actor WHERE actor_id IN (SELECT actor_id FROM sakila.film_actor WHERE film_id = (SELECT film_id FROM sakila.film WHERE title = 'Alone Trip')); -- 7c. You want to run an email marketing campaign in Canada, for which you will need the names and email addresses of all Canadian customers. Use joins to -- retrieve this information. SELECT last_name AS 'Canadian Customer Last Name', first_name AS 'Canadian Customer First Name', email AS 'Canadian Customer Email' FROM sakila.customer c JOIN sakila.customer_list cl ON (c.customer_id = cl.ID) WHERE cl.country = 'Canada'; -- 7d. Sales have been lagging among young families, and you wish to target all family movies for a promotion. Identify all movies categorized as family films. SELECT film_id AS 'Family Film ID Number', title AS 'Family Film Title', description AS 'Family Film Description', release_year AS 'Family Film Release Year', rental_duration AS 'Family Film Rental Duration', rental_rate AS 'Family Film Rental Rate', length AS 'Family Film Length (Minutes)', rating AS 'Family Film Rating', special_features AS 'Family Film Special Features' FROM sakila.film WHERE film_id IN (SELECT film_id FROM sakila.film_category WHERE category_id = (SELECT category_id FROM sakila.category WHERE name = 'Family')); -- 7e. Display the most frequently rented movies in descending order. SELECT COUNT(i.film_id) AS 'Number of Rentals (DSC)', f.film_id AS 'Film ID Number', f.title AS 'Film Title', f.description AS 'Film Description', f.release_year AS 'Film Release Year', f.rental_duration AS 'Film Rental Duration', f.rental_rate AS 'Film Rental Rate', f.length AS 'Film Length (Minutes)', f.rating AS 'Film Rating', f.special_features AS 'Film Special Features' FROM sakila.rental r LEFT JOIN sakila.inventory i ON (r.inventory_id = i.inventory_id) LEFT JOIN sakila.film f ON (i.film_id = f.film_id) GROUP BY i.film_id ORDER BY COUNT(i.film_id) DESC; -- 7f. Write a query to display how much business, in dollars, each store brought in. -- This works but an easier way prob is exist: CREATE VIEW store_aus AS SELECT store AS 'Store Location', (total_sales * .72) + (SELECT (SUM(amount) * .72) FROM sakila.payment WHERE staff_id = (SELECT ID FROM sakila.staff_list WHERE name = 'Jon Stephens')) AS 'Total Business ($USD)' FROM sakila.sales_by_store WHERE manager = 'Jon Stephens';CREATE VIEW store_can AS SELECT store AS 'Store Location', (total_sales * .75) + (SELECT (SUM(amount) * .75) FROM sakila.payment WHERE staff_id = (SELECT ID FROM sakila.staff_list WHERE name = 'Mike Hillyer')) AS 'Total Business ($USD)' FROM sakila.sales_by_store WHERE manager = 'Mike Hillyer';SELECT * FROM store_aus UNION SELECT * FROM store_can; -- ! maybe add:: case when address.city_id = city.city_id then address.city_id else '' end as locale) :: and country -- This works and did not end up being easier (way more dynamic and informative though!): SELECT s.store_id AS 'Store ID Number', (SELECT CASE WHEN s.store_id = '1' THEN (SELECT CONCAT(address, ', ', district) FROM sakila.address WHERE address_id = '1') WHEN s.store_id = '2' THEN (SELECT CONCAT(address, ', ', district) FROM sakila.address WHERE address_id = '2') ELSE 'Error (Unknown Locale)' END AS locale ) AS 'Store Address', s.staff_id AS 'Manager ID Number', CONCAT(s.first_name, ' ', s.last_name) AS 'Manager Full Name', SUM(amount) AS 'Rentals Revenue ($)', (SELECT total_sales FROM sakila.sales_by_store WHERE manager = CONCAT(s.first_name, ' ', s.last_name)) AS 'Sales Revenue ($)', (SUM(amount) + (SELECT total_sales FROM sakila.sales_by_store WHERE manager = CONCAT(s.first_name, ' ', s.last_name))) AS 'Total Business ($)', (SELECT CASE WHEN s.store_id = '1' THEN '$1 CAD = $0.75 USD' WHEN s.store_id = '2' THEN '$1 AUD = $0.72 USD' ELSE 'Error (Unknown Locale Currency >> USD Exchange Rate)' END AS locale ) AS 'Exchange Rate', ROUND(((SUM(amount) + (SELECT total_sales FROM sakila.sales_by_store WHERE manager = CONCAT(s.first_name, ' ', s.last_name))) * (SELECT CASE WHEN s.store_id = '1' THEN '.75' WHEN s.store_id = '2' THEN '.72' ELSE 'Error (Unknown Country)' END AS locale )), 2) AS 'Total Business ($USD)' FROM sakila.customer c JOIN sakila.payment p ON (c.customer_id = p.customer_id) JOIN sakila.staff s ON (p.staff_id = s.staff_id) GROUP BY s.staff_id; -- ! maybe add:: case when address.city_id = city.city_id then address.city_id else '' end as locale) :: and country -- 7g. Write a query to display for each store its store ID, city, and country. -- -- -- -- -- using code from above -- -- -- -- -- SELECT store_id AS 'Store ID Number', (SELECT CASE WHEN store_id = '1' THEN (SELECT CONCAT(address, ', ', district) FROM sakila.address WHERE address_id = '1') WHEN store_id = '2' THEN (SELECT CONCAT(address, ', ', district) FROM sakila.address WHERE address_id = '2') ELSE 'Error (Unknown Locale)' END AS locale ) AS 'Store Address' FROM sakila.staff GROUP BY staff_id; -- 7h. List the top five genres in gross revenue in descending order. (Hint: you may need to use the following tables: category, film_category, inventory, -- payment, and rental.) CREATE VIEW genres_aus AS SELECT c.name, r.staff_id, SUM(p.amount) AS 'Gross_Rev_Raw', ROUND(SUM(p.amount) * (SELECT CASE WHEN r.staff_id = '1' THEN '.75' END AS locale ), 2) AS 'Gross_Rev_USD' FROM sakila.rental r JOIN sakila.payment p ON (r.rental_id = p.rental_id) JOIN sakila.inventory i ON (r.inventory_id = i.inventory_id) JOIN sakila.film_category fc ON (i.film_id = fc.film_id) JOIN category c ON (fc.category_id = c.category_id) GROUP BY c.name , r.staff_id HAVING Gross_Rev_USD >= 1 ORDER BY ROUND(SUM(p.amount) * (SELECT CASE WHEN r.staff_id = '1' THEN '.75' ELSE 'Error (Unknown Country)' END AS locale ), 2) DESC;CREATE VIEW genres_can AS SELECT c.name, r.staff_id, SUM(p.amount) AS 'Gross_Rev_Raw', ROUND(SUM(p.amount) * (SELECT CASE WHEN r.staff_id = '2' THEN '.72' END AS locale ), 2) AS 'Gross_Rev_USD' FROM sakila.rental r JOIN sakila.payment p ON (r.rental_id = p.rental_id) JOIN sakila.inventory i ON (r.inventory_id = i.inventory_id) JOIN sakila.film_category fc ON (i.film_id = fc.film_id) JOIN category c ON (fc.category_id = c.category_id) GROUP BY c.name , r.staff_id HAVING Gross_Rev_USD >= 1 ORDER BY ROUND(SUM(p.amount) * (SELECT CASE WHEN r.staff_id = '2' THEN '.72' ELSE 'Error (Unknown Country)' END AS locale ), 2) DESC;SELECT (SELECT CASE WHEN ga.name = gc.name THEN ga.name ELSE '' END AS locale ) AS 'Validated_Genre', (ga.Gross_Rev_USD + gc.Gross_Rev_USD) AS 'Total_Gross_Rev_USD' FROM genres_aus ga JOIN genres_can gc ON (ga.name = gc.name) WHERE (SELECT CASE WHEN ga.name = gc.name THEN ga.name ELSE '' END AS locale ) IS NOT NULL ORDER BY Total_Gross_Rev_USD DESC LIMIT 5; -- 8a. In your new role as an executive, you would like to have an easy way of viewing the Top five genres by gross revenue. Use the solution from the problem -- above to create a view. If you haven't solved 7h, you can substitute another query to create a view. -- -- -- -- -- using code from above -- -- -- -- -- CREATE VIEW Top_5_Earners AS SELECT (SELECT CASE WHEN ga.name = gc.name THEN ga.name ELSE '' END AS locale ) AS 'Validated_Genre', (ga.Gross_Rev_USD + gc.Gross_Rev_USD) AS 'Total_Gross_Rev_USD' FROM genres_aus ga JOIN genres_can gc ON (ga.name = gc.name) WHERE (SELECT CASE WHEN ga.name = gc.name THEN ga.name ELSE '' END AS locale ) IS NOT NULL ORDER BY Total_Gross_Rev_USD DESC LIMIT 5; SELECT * FROM Top_5_Earners; -- 8b. How would you display the view that you created in 8a? -- -- -- -- -- using code from above -- -- -- -- -- SELECT * FROM Top_5_Earners; -- 8c. You find that you no longer need the view top_five_genres. Write a query to delete it. DROP VIEW Top_5_Earners;
true
13ee85968d1500ed83f7d91b5249be9aea94b9d3
SQL
Dogemist/butTest
/user-manager/user-manager-rest-api/src/modules/projects/sql/update.sql
UTF-8
212
2.53125
3
[ "MIT" ]
permissive
/** * Updates the project with the given name and returns the updated record */ UPDATE ${schema~}.project SET project_url = (project_url || ${projectURL}::jsonb) WHERE project_name = ${projectName} RETURNING *
true
358c820823529c9a5c1e6cdf485e5b7641a617ec
SQL
gurunaua/simple_jwt_api
/src/main/resources/run.sql
UTF-8
886
3.15625
3
[]
no_license
CREATE DATABASE 'aan'; CREATE TABLE `users` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `email` varchar(50) DEFAULT NULL, `name` varchar(50) DEFAULT NULL, `password` varchar(100) DEFAULT NULL, `username` varchar(50) DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `UKr43af9ap4edm43mmtq01oddj6` (`username`), UNIQUE KEY `UK6dotkott2kjsp8vw4d0m25fb7` (`email`) ) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4; CREATE TABLE `roles` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `name` varchar(60) DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `UK_nb4h0p6txrmfc0xbrd1kglp9t` (`name`) ) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4; CREATE TABLE `user_roles` ( `user_id` bigint(20) NOT NULL, `role_id` bigint(20) NOT NULL, PRIMARY KEY (`user_id`,`role_id`), KEY `FKh8ciramu9cc9q3qcqiv4ue8a6` (`role_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4;
true
78048ace5cae4be13d78035eae80729d9a1e4a21
SQL
PeteThePirate/data-science-on-gcp
/03_sqlstudio/contingency2.sql
UTF-8
432
3.296875
3
[ "Apache-2.0" ]
permissive
DECLARE THRESH INT64; SET THRESH = 15; SELECT COUNTIF(dep_delay < THRESH AND arr_delay < 15) AS true_positives, COUNTIF(dep_delay < THRESH AND arr_delay >= 15) AS false_positives, COUNTIF(dep_delay >= THRESH AND arr_delay < 15) AS false_negatives, COUNTIF(dep_delay >= THRESH AND arr_delay >= 15) AS true_negatives, COUNT(*) AS total FROM dsongcp.flights WHERE arr_delay IS NOT NULL AND dep_delay IS NOT NULL
true
e764483dca7e3b245054fa8b17e573b94021082f
SQL
zinmyoswe/AGD-Bank-Report
/FIN_LEDGER_STATEMENT_DOMESTIC.sql
UTF-8
13,910
3.15625
3
[]
no_license
CREATE OR REPLACE PACKAGE FIN_LEDGER_STATEMENT_DOMESTIC AS PROCEDURE FIN_LEDGER_STATEMENT_DOMESTIC( inp_str IN VARCHAR2, out_retCode OUT NUMBER, out_rec OUT VARCHAR2 ); END FIN_LEDGER_STATEMENT_DOMESTIC; / CREATE OR REPLACE PACKAGE BODY FIN_LEDGER_STATEMENT_DOMESTIC AS ------------------------------------------------------------------------------------- -- Cursor declaration -- This cursor will fetch all the data based on the main query ------------------------------------------------------------------------------------- --3021210106578 outArr tbaadm.basp0099.ArrayType; -- Input Parse Array vi_startDate Varchar2(10); -- Input to procedure vi_endDate Varchar2(10); -- Input to procedure vi_AccountNo Varchar2(25); -- Input to procedure vi_currency Varchar2(3); -- Input to procedure vi_branchcode Varchar2(5); -- Input to procedure v_cur Varchar2(20); --v_sol_id Varchar2(20); v_rate decimal(18,2); num number; dobal custom.CUSTOM_CTD_DTD_ACLI_VIEW.tran_amt%type := 0; result_rec Varchar2(30000); OpeningAmount custom.CUSTOM_CTD_DTD_ACLI_VIEW.TRAN_AMT%type; limitsize INTEGER := 500; OpenDate Varchar2(10); rate decimal(18,2); ----------------------------------------------------------------------------- -- CURSOR declaration FIN_DRAWING_SPBX CURSOR ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- -- CURSOR ExtractData ----------------------------------------------------------------------------- CURSOR ExtractData_WithHO (ci_startDate VARCHAR2, ci_endDate VARCHAR2, ci_AccountNo VARCHAR2,ci_currency VARCHAR2,ci_SOL_ID varchar2) IS select q.tran_id ,q.tran_date ,sum(q.CR_amt)as cr_amt,sum(q.DR_amt) as dr_amt,q.tran_particular,q.entry_user_id , q.part_tran_type,q.abbr_br_name from (select cdav.tran_id , cdav.tran_date , case cdav.part_tran_type when 'C' then cdav.tran_amt else 0 end as CR_amt, case cdav.part_tran_type when 'D' then cdav.tran_amt else 0 end as DR_amt, cdav.tran_particular, cdav.entry_user_id , cdav.part_tran_type, (select sol.abbr_br_name from tbaadm.upr,tbaadm.sol where sol.sol_id = upr.sol_id and upr.user_id = cdav.entry_user_id) as abbr_br_name from tbaadm.general_acct_mast_table gam,custom.CUSTOM_CTD_DTD_ACLI_VIEW cdav,tbaadm.sol sol where gam.acid = cdav.acid and gam.sol_id = sol.sol_id and cdav.sol_id = sol.sol_id and gam.gl_sub_head_code = trim(ci_AccountNo) and gam.gl_sub_head_code = cdav.gl_sub_head_code and cdav.tran_date between TO_DATE( CAST ( ci_startDate AS VARCHAR(10) ) , 'dd-MM-yyyy' ) and TO_DATE( CAST ( ci_endDate AS VARCHAR(10) ) , 'dd-MM-yyyy' ) and cdav.TRAN_CRNCY_CODE= Upper(ci_currency ) and gam.acct_crncy_code = upper(ci_currency) and gam.del_flg != 'Y' and cdav.del_flg = 'N' and gam.sol_id like '%' || ci_SOL_ID || '%' and cdav.sol_id like '%' || ci_SOL_ID || '%' --and gam.acct_cls_flg != 'Y' and gam.bank_id ='01' and gam.sol_id = cdav.sol_id and trim (cdav.tran_id) NOT IN (select trim(CONT_TRAN_ID) from TBAADM.ATD atd where atd.cont_tran_date >= TO_DATE( CAST ( ci_startDate AS VARCHAR(10) ) , 'dd-MM-yyyy' ) and atd.cont_tran_date <= TO_DATE( CAST ( ci_endDate AS VARCHAR(10) ) , 'dd-MM-yyyy' ) ) ) q group by q.tran_id, q.tran_particular, q.entry_user_id, q.tran_date, q.part_tran_type,q.abbr_br_name order by q.tran_date,q.abbr_br_name; --------------------------------------------------------------------------------------------- CURSOR ExtractDataForResult IS select trim(tran_id),tran_date,dobal,tran_amt,tran_particular,teller_no,tran_amt_dr,rate ,sol_id from TEMP_TABLE order by ID; TYPE mainretailtableWithHO IS TABLE OF ExtractData_WithHO%ROWTYPE INDEX BY BINARY_INTEGER; ptmainretailtableWithHO mainretailtableWithHO; --------------------------------------------------------------------------------------------------------- PROCEDURE FIN_LEDGER_STATEMENT_DOMESTIC( inp_str IN VARCHAR2, out_retCode OUT NUMBER, out_rec OUT VARCHAR2 ) AS v_tran_id TBAADM.CTD_DTD_ACLI_VIEW.tran_id%type; v_tran_date TBAADM.CTD_DTD_ACLI_VIEW.tran_date%type; v_tran_amt TBAADM.CTD_DTD_ACLI_VIEW.tran_amt%type; v_tran_amt_mmk TBAADM.CTD_DTD_ACLI_VIEW.tran_amt%type; v_teller_no TBAADM.CTD_DTD_ACLI_VIEW.entry_user_id%type; v_part_tran_type TBAADM.CTD_DTD_ACLI_VIEW.part_tran_type%type; v_tran_amt_dr TBAADM.CTD_DTD_ACLI_VIEW.tran_amt%type; v_tran_particular TBAADM.CTD_DTD_ACLI_VIEW.tran_particular%type; v_AccountNumber TBAADM.GENERAL_ACCT_MAST_TABLE.FORACID%type; v_AccountName TBAADM.GENERAL_ACCT_MAST_TABLE.ACCT_NAME%type; v_Cur TBAADM.GENERAL_ACCT_MAST_TABLE.ACCT_crncy_code%type; v_Address varchar2(200); v_Nrc CRMUSER.ACCOUNTS.UNIQUEID%type; v_Bal TBAADM.GENERAL_ACCT_MAST_TABLE.clr_bal_amt%type; v_PhoneNumber varchar2(50); v_FaxNumber varchar2(50); v_BranchName TBAADM.BRANCH_CODE_TABLE.BR_SHORT_NAME%type; v_BankAddress TBAADM.BRANCH_CODE_TABLE.BR_ADDR_1%type; v_BankPhone TBAADM.BRANCH_CODE_TABLE.PHONE_NUM%type; v_BankFax TBAADM.BRANCH_CODE_TABLE.FAX_NUM%type; v_sol_id TBAADM.sol.sol_id%type; v_gl_desc TBAADM.gsh.gl_sub_head_desc %type; BEGIN ------------------------------------------------------------- -- Out Ret code is the code which controls -- the while loop,it can have values 0,1 -- 0 - The while loop is being executed -- 1 - Exit ------------------------------------------------------------- out_retCode := 0; out_rec := NULL; tbaadm.basp0099.formInputArr(inp_str, outArr); -------------------------------------- -- Parsing the i/ps from the string -------------------------------------- vi_startDate := outArr(0); vi_endDate := outArr(1); vi_AccountNo := outArr(2); vi_currency := outArr(3); vi_branchcode := outArr(4); IF vi_branchcode IS NULL or vi_branchcode = '' THEN vi_branchcode := ''; END IF; -------------------------------------------------------------------- IF vi_branchcode IS NULL or vi_branchcode = '' THEN v_gl_desc := ''; END IF; ----------------------------------------------------------------------------------- IF NOT ExtractData_WithHO%ISOPEN THEN --{ BEGIN --{ OPEN ExtractData_WithHO (vi_startDate , vi_endDate, vi_AccountNo,vi_currency,vi_branchcode); --} END; --} END IF; IF ExtractData_WithHO%ISOPEN Then --{ Begin select sum(gstt.tot_cr_bal - gstt.tot_dr_bal) as cashinhand,BAL_DATE INTO OpeningAmount,OpenDate from TBAADM.GL_SUB_HEAD_TRAN_TABLE gstt where gstt.BAL_DATE = ( select max(BAL_DATE) from( select BAL_DATE from tbaadm.gstt where tbaadm.gstt.BAL_DATE < TO_DATE( CAST ( vi_startDate AS VARCHAR(10) ) , 'dd-MM-yyyy' ) and gstt.SOL_ID like '%' || vi_branchcode || '%' and gstt.crncy_code = upper(vi_currency) and gstt.gl_sub_head_code = vi_AccountNo order by BAL_DATE desc) where rownum =1 ) and gstt.SOL_ID like '%' || vi_branchcode || '%' and (gstt.tot_cr_bal > 0 or gstt.tot_dr_bal > 0) and gstt.DEL_FLG = 'N' and gstt.BANK_ID = '01' and gstt.gl_sub_head_code = vi_AccountNo and gstt.crncy_code = upper(vi_currency) group by BAL_DATE; EXCEPTION WHEN NO_DATA_FOUND THEN OpeningAmount := 0.00; OpenDate := ''; end; delete from custom.TEMP_TABLE ; commit; dobal := OpeningAmount; insert into custom.TEMP_TABLE(Tran_Date,dobal,TRAN_AMT,TRAN_TYPE,TRAN_PARTICULAR,PART_TRAN_TYPE,ID) values(TO_DATE( CAST ( vi_startDate AS VARCHAR(10) ) , 'dd-MM-yyyy' ),OpeningAmount,v_tran_amt,'','Opening Balance',v_part_tran_type,0); commit; FETCH ExtractData_WithHO BULK COLLECT INTO ptmainretailtableWithHO; --outer Cursor -- select acct_crncy_code into v_cur from tbaadm.gam where gam.gl_sub_head_code = vi_AccountNo and rownum = 1 order by sol_id ; FOR outindx IN 1 .. ptmainretailtableWithHO.COUNT --outer For loop LOOP if ptmainretailtableWithHO (outindx).part_tran_type = 'C' then dobal := dobal + ptmainretailtableWithHO (outindx).cr_amt; else if ptmainretailtableWithHO (outindx).part_tran_type = 'D' then dobal := dobal - ptmainretailtableWithHO (outindx).dr_amt; end if; end if; v_tran_date := ptmainretailtableWithHO (outindx).tran_date; ----------------to get daily rate of account begin if vi_currency = 'MMK' THEN v_rate := 1 ; ELSE select VAR_CRNCY_UNITS into v_rate from tbaadm.rth where ratecode = 'NOR' and rtlist_date = v_tran_date and TRIM(FXD_CRNCY_CODE)= upper(vi_currency) and TRIM(VAR_CRNCY_CODE) = 'MMK' and rownum=1 order by rtlist_num desc; end if; EXCEPTION WHEN NO_DATA_FOUND THEN v_rate := 1; end; ----------------to get daily rate of account v_tran_id := ptmainretailtableWithHO (outindx).tran_id; v_tran_amt := ptmainretailtableWithHO (outindx).cr_amt; v_tran_amt_dr := ptmainretailtableWithHO (outindx).dr_amt; --v_tran_type := ptmainretailtableWithHO (outindx).tran_type; --v_part_tran_type := ptmainretailtableWithHO (outindx).part_tran_type; v_tran_particular := ptmainretailtableWithHO (outindx).tran_particular; v_teller_no := ptmainretailtableWithHO (outindx).entry_user_id; v_sol_id := ptmainretailtableWithHO (outindx).abbr_br_name; insert into custom.TEMP_TABLE(Tran_Date,dobal,TRAN_AMT,TRAN_TYPE,TRAN_PARTICULAR,PART_TRAN_TYPE,ID,tran_id,teller_no,tran_amt_dr,rate,sol_id) values(v_tran_date,dobal,v_tran_amt,'',v_tran_particular,'',outindx,v_tran_id,v_teller_no,v_tran_amt_dr,v_rate,v_sol_id); commit; END LOOP; ------------------------------------------------------------------ -- Here it is checked whether the cursor has fetched -- something or not if not the cursor is closed -- and the out ret code is made equal to 1 ------------------------------------------------------------------ IF ExtractData_WithHO%NOTFOUND THEN --{ CLOSE ExtractData_WithHO; --out_retCode:= 1; --RETURN; --} END IF; --} END IF; IF NOT ExtractDataForResult%ISOPEN THEN --{ BEGIN --{ OPEN ExtractDataForResult ; --} END; --} END IF; IF ExtractDataForResult%ISOPEN Then FETCH ExtractDataForResult INTO v_tran_id,v_tran_date,dobal,v_tran_amt,v_tran_particular,v_teller_no,v_tran_amt_dr,v_rate,v_sol_id; ------------------------------------------------------------------ -- Here it is checked whether the cursor has fetched -- something or not if not the cursor is closed -- and the out ret code is made equal to 1 ------------------------------------------------------------------ IF ExtractDataForResult%NOTFOUND THEN --{ CLOSE ExtractDataForResult; out_retCode:= 1; RETURN; --} END IF; --} END IF; ------------------------------------------------------------------- begin --if vi_branchcode is not null then select gl_sub_head_desc into v_gl_desc from tbaadm.gsh where gl_sub_head_code = vi_AccountNo and gsh.crncy_code = vi_currency and gsh.sol_id like '%' || vi_branchcode || '%' and rownum =1 ; --end if; end ; -------------------------------------------------------------------- BEGIN ------------------------------------------------------------------------------- -- GET BANK INFORMATION ------------------------------------------------------------------------------- if vi_branchcode is not null then select BRANCH_CODE_TABLE.BR_SHORT_NAME as "BranchName", BRANCH_CODE_TABLE.BR_ADDR_1 as "Bank_Address", BRANCH_CODE_TABLE.PHONE_NUM as "Bank_Phone", BRANCH_CODE_TABLE.FAX_NUM as "Bank_Fax" INTO v_BranchName, v_BankAddress, v_BankPhone, v_BankFax from TBAADM.SERVICE_OUTLET_TABLE SERVICE_OUTLET_TABLE , TBAADM.BRANCH_CODE_TABLE BRANCH_CODE_TABLE where SERVICE_OUTLET_TABLE.SOL_ID = vi_branchcode and SERVICE_OUTLET_TABLE.BR_CODE = BRANCH_CODE_TABLE.BR_CODE and SERVICE_OUTLET_TABLE.DEL_FLG = 'N' and SERVICE_OUTLET_TABLE.BANK_ID = '01'; end if; END; ----------------------------------------------------------------------------------- -- out_rec variable retrieves the data to be sent to LST file with pipe seperation ------------------------------------------------------------------------------------ out_rec:= (to_char(to_date(v_tran_date,'dd/Mon/yy'), 'dd/MM/yyyy')||'|' || v_tran_id || '|' || v_tran_particular || '|' || v_tran_amt || '|' || v_tran_amt_dr || '|' || dobal || '|' || v_rate || '|' || v_teller_no || '|' || v_BranchName || '|' || v_BankAddress || '|' || v_BankPhone || '|' || v_BankFax || '|' || v_cur ||'|'|| v_sol_id ||'|'|| v_gl_desc); --dbms_output.put_line(out_rec); END FIN_LEDGER_STATEMENT_DOMESTIC; END FIN_LEDGER_STATEMENT_DOMESTIC; /
true
bb2411601b4b2905e594292c035c613331c2b1f8
SQL
lenyueocy/lenyueCms
/application/weixin/weixin_scores.sql
UTF-8
573
2.984375
3
[]
no_license
SET FOREIGN_KEY_CHECKS=0; DROP TABLE IF EXISTS `lenyue_weixin_scores`; CREATE TABLE `lenyue_weixin_scores` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `user_id` int(50) NOT NULL DEFAULT 0 COMMENT '用户id', `openid` varchar(100) NOT NULL DEFAULT '' COMMENT 'openid', `scores` int(100) NOT NULL COMMENT '历史最高分', `money` int(100) NOT NULL COMMENT '抽奖累计金额', `updatetime` int(100) NOT NULL COMMENT '更新时间', `ip` VARCHAR(100) NOT NULL COMMENT 'ip', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
true
418bf50d42c4a2e8bbcf13d213b1e285de06c5c9
SQL
hxmn/WIM
/WIM/Loaders/IHS/Post Load Checks/Sub_300IPL.sql
UTF-8
853
2.921875
3
[]
no_license
-- SCRIPT: Sub_300IPL.sql -- -- PURPOSE: -- This is a sub-script of Load_check_*.sql scripts. It performs 300IPL specific checks -- It is NOT INTENDED TO BE RUN DIRECTLY as it assumes a number of -- variables and settings have already been defined by the master script. -- -- HISTORY: -- 8-Sep-09 R. Masterman Factored out of the main scripts to make maintenance easier -- -- ... From main script -- List a breakdown of Canadian wells by province to verify coverage select rps.province_state, count(uwi) as Wells from r_province_state rps left outer join &&load_schema..well_version&&load_link wv on rps.province_state = wv.province_state and wv.source = '&&source' where rps.country = '7CN' and rps.active_ind = 'Y' group by rps.province_state order by rps.province_state; -- Return to main script ...
true
ca0166f4a73496a1dd6e17bb9568df35ec25bdf6
SQL
thangduong3010/PL-SQL
/Script/rdbms_admin/odmpatch.sql
UTF-8
2,779
2.8125
3
[]
no_license
Rem Rem $Header: rdbms/admin/odmpatch.sql /st_rdbms_11.2.0/1 2011/05/03 09:34:10 xbarr Exp $ odmpatch.sql Rem Rem ########################################################################## Rem Rem Copyright (c) 2001, 2011, Oracle and/or its affiliates. Rem All rights reserved. Rem Rem NAME Rem odmpatch.sql Rem Rem DESCRIPTION Rem Script for Data Mining patch loading Rem Rem RETURNS Rem Rem NOTES Rem This script must be run while connected as SYS. After running the script, Rem ODM should be at 11.2.0.X patch release level Rem Rem MODIFIED (MM/DD/YY) Rem xbarr 04/29/11 - update ODM in dba registry Rem xbarr 01/12/05 - remove version info for odm registry Rem xbarr 02/03/05 - updated banner in registry Rem xbarr 01/27/05 - updated for 10.2 patchset Rem xbarr 10/29/04 - move validation proc to SYS Rem xbarr 06/25/04 - xbarr_dm_rdbms_migration Rem amozes 06/23/04 - remove hard tabs Rem xbarr 03/25/04 - updated for 10.1.0.3 ODM patch release Rem xbarr 12/22/03 - remove dbms_java.set_output Rem fcay 06/23/03 - Update copyright notice Rem xbarr 05/30/03 - updated for ODM 9204 patch release Rem xbarr 02/14/03 - xbarr_txn106309 Rem xbarr 02/12/03 - Creation Rem Rem ######################################################################### Rem ===================================================================================== Rem In 11g, ODM component has been migrated from DMSYS to SYS. ODM is no longer a component. Rem Once a user decides there is no need to perform a rdbms downgrade, DMSYS schema can be Rem dropped from the upgraded database. ODM entry will be removed from dba registry once Rem DMSYS is dropped. Rem Rem If DMSYS was not dropped in 11.2.0.1 after being upgraded from 10.2, and the database Rem is upgrading to 11.2.0.X patchset, then the registry will be updated by this script Rem for ODM. Rem ===================================================================================== ALTER SESSION SET CURRENT_SCHEMA = "SYS"; BEGIN SYS.DBMS_REGISTRY.UPGRADED('ODM'); EXCEPTION WHEN OTHERS THEN IF SQLCODE IN ( -39705 ) THEN NULL; ELSE RAISE; END IF; END; / BEGIN EXECUTE IMMEDIATE 'UPDATE SYS.REGISTRY$ SET VPROC=NULL WHERE CID = ''ODM'' AND CNAME = ''Oracle Data Mining'''; EXCEPTION WHEN OTHERS THEN IF SQLCODE IN ( -39705 ) THEN NULL; ELSE RAISE; END IF; END; / BEGIN SYS.DBMS_REGISTRY.VALID('ODM'); EXCEPTION WHEN OTHERS THEN IF SQLCODE IN ( -39705 ) THEN NULL; ELSE RAISE; END IF; END; / COMMIT;
true
a18d1253ac3312bc61c8c1be3ba8d900f863faff
SQL
WesleySiNeves/Scripts_SQL_Server
/2.Conteudo de otimizacao/2.Indices/9.BuscaIndicesIdenticos.sql
UTF-8
3,651
4.1875
4
[]
no_license
;WITH CTE_INDEX_DATA AS (SELECT SCHEMA_DATA.name AS schema_name, TABLE_DATA.name AS table_name, INDEX_DATA.name AS index_name, STUFF( ( SELECT ', ' + COLUMN_DATA_KEY_COLS.name + ' ' + CASE WHEN INDEX_COLUMN_DATA_KEY_COLS.is_descending_key = 1 THEN 'DESC' ELSE 'ASC' END -- Include column order (ASC / DESC) FROM sys.tables AS T INNER JOIN sys.indexes INDEX_DATA_KEY_COLS ON T.object_id = INDEX_DATA_KEY_COLS.object_id INNER JOIN sys.index_columns INDEX_COLUMN_DATA_KEY_COLS ON INDEX_DATA_KEY_COLS.object_id = INDEX_COLUMN_DATA_KEY_COLS.object_id AND INDEX_DATA_KEY_COLS.index_id = INDEX_COLUMN_DATA_KEY_COLS.index_id INNER JOIN sys.columns COLUMN_DATA_KEY_COLS ON T.object_id = COLUMN_DATA_KEY_COLS.object_id AND INDEX_COLUMN_DATA_KEY_COLS.column_id = COLUMN_DATA_KEY_COLS.column_id WHERE INDEX_DATA.object_id = INDEX_DATA_KEY_COLS.object_id AND INDEX_DATA.index_id = INDEX_DATA_KEY_COLS.index_id AND INDEX_COLUMN_DATA_KEY_COLS.is_included_column = 0 ORDER BY INDEX_COLUMN_DATA_KEY_COLS.key_ordinal FOR XML PATH('') ), 1, 2, '' ) AS key_column_list, STUFF( ( SELECT ', ' + COLUMN_DATA_INC_COLS.name FROM sys.tables AS T INNER JOIN sys.indexes INDEX_DATA_INC_COLS ON T.object_id = INDEX_DATA_INC_COLS.object_id INNER JOIN sys.index_columns INDEX_COLUMN_DATA_INC_COLS ON INDEX_DATA_INC_COLS.object_id = INDEX_COLUMN_DATA_INC_COLS.object_id AND INDEX_DATA_INC_COLS.index_id = INDEX_COLUMN_DATA_INC_COLS.index_id INNER JOIN sys.columns COLUMN_DATA_INC_COLS ON T.object_id = COLUMN_DATA_INC_COLS.object_id AND INDEX_COLUMN_DATA_INC_COLS.column_id = COLUMN_DATA_INC_COLS.column_id WHERE INDEX_DATA.object_id = INDEX_DATA_INC_COLS.object_id AND INDEX_DATA.index_id = INDEX_DATA_INC_COLS.index_id AND INDEX_COLUMN_DATA_INC_COLS.is_included_column = 1 ORDER BY INDEX_COLUMN_DATA_INC_COLS.key_ordinal FOR XML PATH('') ), 1, 2, '' ) AS include_column_list, INDEX_DATA.is_disabled -- Check if index is disabled before determining which dupe to drop (if applicable) FROM sys.indexes INDEX_DATA INNER JOIN sys.tables TABLE_DATA ON TABLE_DATA.object_id = INDEX_DATA.object_id INNER JOIN sys.schemas SCHEMA_DATA ON SCHEMA_DATA.schema_id = TABLE_DATA.schema_id WHERE TABLE_DATA.is_ms_shipped = 0 AND INDEX_DATA.type_desc IN ( 'NONCLUSTERED', 'CLUSTERED' ) ) SELECT * FROM CTE_INDEX_DATA DUPE1 WHERE EXISTS ( SELECT * FROM CTE_INDEX_DATA DUPE2 WHERE DUPE1.schema_name = DUPE2.schema_name AND DUPE1.table_name = DUPE2.table_name AND DUPE1.key_column_list = DUPE2.key_column_list AND ISNULL(DUPE1.include_column_list, '') = ISNULL(DUPE2.include_column_list, '') AND DUPE1.index_name <> DUPE2.index_name );
true
b270fffb2584af3bd7d53a54972b252c418befeb
SQL
dinghao1230110/learn
/sql/learn.sql
UTF-8
5,516
3.34375
3
[]
no_license
-- -------------------------------------------------------- -- 主机: localhost -- 服务器版本: 10.1.16-MariaDB - mariadb.org binary distribution -- 服务器操作系统: Win64 -- HeidiSQL 版本: 9.3.0.4984 -- -------------------------------------------------------- /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET NAMES utf8mb4 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; -- 导出 hao.learn 的数据库结构 CREATE DATABASE IF NOT EXISTS `hao.learn` /*!40100 DEFAULT CHARACTER SET utf8 */; USE `hao.learn`; -- 导出 表 hao.learn.function_info 结构 CREATE TABLE IF NOT EXISTS `function_info` ( `id` bigint(20) NOT NULL, `name` varchar(32) NOT NULL, `is_menu` tinyint(1) NOT NULL DEFAULT '0', `parent_id` bigint(20) DEFAULT NULL, `remark` varchar(64) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- 正在导出表 hao.learn.function_info 的数据:~6 rows (大约) /*!40000 ALTER TABLE `function_info` DISABLE KEYS */; INSERT INTO `function_info` (`id`, `name`, `is_menu`, `parent_id`, `remark`) VALUES (6317038017294897152, '根据登录名查询用户', 0, NULL, NULL), (6317038017294901248, '新增单个用户', 0, NULL, NULL), (6317038017294905344, '批量新增用户', 0, NULL, NULL), (6317038017299103744, '更新用户', 0, NULL, NULL), (6317038017299107840, '删除单个用户', 0, NULL, NULL), (6317038017299111936, '批量删除用户', 0, NULL, NULL); /*!40000 ALTER TABLE `function_info` ENABLE KEYS */; -- 导出 表 hao.learn.log_info 结构 CREATE TABLE IF NOT EXISTS `log_info` ( `id` bigint(20) DEFAULT NULL, `key` varchar(50) DEFAULT NULL, `success` bit(1) DEFAULT NULL, `primary_parameter` longtext, `remark` text ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- 正在导出表 hao.learn.log_info 的数据:~3 rows (大约) /*!40000 ALTER TABLE `log_info` DISABLE KEYS */; INSERT INTO `log_info` (`id`, `key`, `success`, `primary_parameter`, `remark`) VALUES (6318830268685750272, '无权限', b'0', NULL, '您没有访问 根据登录名查询用户 的权限'), (6318830311576707072, '调用功能', b'1', '["hao",1]', '根据登录名查询用户'), (6318830335123533824, '无权限', b'0', NULL, '您没有访问 新增单个用户 的权限'); /*!40000 ALTER TABLE `log_info` ENABLE KEYS */; -- 导出 表 hao.learn.role_function 结构 CREATE TABLE IF NOT EXISTS `role_function` ( `role_id` bigint(20) DEFAULT NULL, `function_id` bigint(20) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- 正在导出表 hao.learn.role_function 的数据:~1 rows (大约) /*!40000 ALTER TABLE `role_function` DISABLE KEYS */; INSERT INTO `role_function` (`role_id`, `function_id`) VALUES (6317038017299095552, 6317038017294897152); /*!40000 ALTER TABLE `role_function` ENABLE KEYS */; -- 导出 表 hao.learn.role_info 结构 CREATE TABLE IF NOT EXISTS `role_info` ( `id` bigint(20) NOT NULL, `name` varchar(32) NOT NULL, `remark` varchar(64) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- 正在导出表 hao.learn.role_info 的数据:~2 rows (大约) /*!40000 ALTER TABLE `role_info` DISABLE KEYS */; INSERT INTO `role_info` (`id`, `name`, `remark`) VALUES (6317038017299091456, '普通用户', NULL), (6317038017299095552, '系统管理员', NULL); /*!40000 ALTER TABLE `role_info` ENABLE KEYS */; -- 导出 表 hao.learn.user_info 结构 CREATE TABLE IF NOT EXISTS `user_info` ( `ID` bigint(20) NOT NULL, `FIRST_NAME` varchar(255) DEFAULT NULL, `LAST_NAME` varchar(255) DEFAULT NULL, `EMAIL` varchar(255) DEFAULT NULL, `PHONE` varchar(255) DEFAULT NULL, `LOGIN_NAME` varchar(255) NOT NULL, `LOGIN_PASSWORD` varchar(255) DEFAULT NULL, `LAST_LOGIN_DATE` datetime DEFAULT NULL, `LAST_LOGIN_IP` varchar(255) DEFAULT NULL, `STATUS` tinyint(4) DEFAULT NULL, PRIMARY KEY (`ID`), UNIQUE KEY `UK_LOGIN_NAME` (`LOGIN_NAME`) USING BTREE, UNIQUE KEY `UK_EMAIL` (`EMAIL`) USING BTREE, UNIQUE KEY `UK_PHONE` (`PHONE`) USING BTREE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- 正在导出表 hao.learn.user_info 的数据:~2 rows (大约) /*!40000 ALTER TABLE `user_info` DISABLE KEYS */; INSERT INTO `user_info` (`ID`, `FIRST_NAME`, `LAST_NAME`, `EMAIL`, `PHONE`, `LOGIN_NAME`, `LOGIN_PASSWORD`, `LAST_LOGIN_DATE`, `LAST_LOGIN_IP`, `STATUS`) VALUES (6308316580291813376, 'Ding', 'Hao', 'dinghao@163.com', '13000000000', 'Hao', NULL, '2017-09-04 23:56:21', '192.168.1.1', 1), (6308947494508171264, 'Tian', 'Xize', 'mt@hotmail.com', '13100000001', 'maintk', NULL, NULL, '192.168.2.1', 5); /*!40000 ALTER TABLE `user_info` ENABLE KEYS */; -- 导出 表 hao.learn.user_role 结构 CREATE TABLE IF NOT EXISTS `user_role` ( `user_id` bigint(20) DEFAULT NULL, `role_id` bigint(20) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- 正在导出表 hao.learn.user_role 的数据:~1 rows (大约) /*!40000 ALTER TABLE `user_role` DISABLE KEYS */; INSERT INTO `user_role` (`user_id`, `role_id`) VALUES (6308316580291813376, 6317038017299095552); /*!40000 ALTER TABLE `user_role` ENABLE KEYS */; /*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */; /*!40014 SET FOREIGN_KEY_CHECKS=IF(@OLD_FOREIGN_KEY_CHECKS IS NULL, 1, @OLD_FOREIGN_KEY_CHECKS) */; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
true
2181e6845727c22f9e267c09d7d5562fc7c0cbb5
SQL
FUUK/fuuk
/fuuk/people/models/sql/updates/update-0.11-department.mysql.sql
UTF-8
652
3.4375
3
[]
no_license
ALTER TABLE people_department ADD COLUMN name varchar(200); ALTER TABLE people_department ADD COLUMN name_en varchar(200); ALTER TABLE people_department ADD COLUMN name_cs varchar(200); UPDATE people_department AS t1 INNER JOIN people_departmenttranslation AS t2 ON t2.id = t2.master_id SET t1.name_en = t2.name WHERE t2.language_code='en'; UPDATE people_department AS t1 INNER JOIN people_departmenttranslation AS t2 ON t2.id = t2.master_id SET t1.name_cs = t2.name WHERE t2.language_code='cs'; UPDATE people_department SET name=coalesce(name_en, ''); ALTER TABLE people_department MODIFY name varchar(200) NOT NULL;
true
c31210f10993dee8f1d76137735cba8b65356c75
SQL
gizmostudios/gray-unicorn
/database_dumps/separated_tables/django_web_auth_user_groups.sql
UTF-8
2,728
2.765625
3
[]
no_license
-- MySQL dump 10.13 Distrib 8.0.13, for macos10.14 (x86_64) -- -- Host: localhost Database: django_web -- ------------------------------------------------------ -- Server version 8.0.12 /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; SET NAMES utf8 ; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -- -- Table structure for table `auth_user_groups` -- DROP TABLE IF EXISTS `auth_user_groups`; /*!40101 SET @saved_cs_client = @@character_set_client */; SET character_set_client = utf8mb4 ; CREATE TABLE `auth_user_groups` ( `id` int(11) NOT NULL AUTO_INCREMENT, `user_id` int(11) NOT NULL, `group_id` int(11) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `user_id` (`user_id`,`group_id`), KEY `auth_user_groups_fbfc09f1` (`user_id`), KEY `auth_user_groups_bda51c3c` (`group_id`) ) ENGINE=MyISAM AUTO_INCREMENT=154 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `auth_user_groups` -- LOCK TABLES `auth_user_groups` WRITE; /*!40000 ALTER TABLE `auth_user_groups` DISABLE KEYS */; INSERT INTO `auth_user_groups` VALUES (125,2,1),(129,8,3),(119,5,1),(115,6,3),(139,12,3),(128,10,4),(127,9,3),(74,11,1),(28,7,1),(113,13,1),(114,16,3),(123,22,1),(40,30,1),(41,27,1),(58,28,3),(126,29,1),(60,26,3),(121,31,1),(117,33,3),(92,38,1),(54,19,3),(118,20,3),(56,32,3),(147,35,3),(116,18,3),(124,36,3),(70,34,3),(138,37,3),(132,41,4),(80,39,1),(81,40,1),(82,42,1),(83,43,1),(84,44,4),(90,46,1),(93,38,3),(94,38,4),(133,47,1),(97,48,1),(99,49,1),(100,50,1),(140,51,1),(120,52,1),(122,53,1),(105,54,1),(106,55,1),(110,56,1),(109,57,1),(153,58,4),(148,59,1),(130,60,1),(131,61,1),(134,47,3),(135,47,4),(136,62,1),(137,63,1),(145,65,3),(146,66,1); /*!40000 ALTER TABLE `auth_user_groups` 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 2019-03-04 21:56:09
true
5818944bb4107f971b3e2011ca15511e5d0cca0c
SQL
MathieuChailloux/JO2024-equipements
/requests/createTopo.sql
UTF-8
3,061
4.0625
4
[]
no_license
create extension pgrouting \set reseau_table_name 'reseau_route' \set reseau_vertices_table_name 'reseau_route_vertices_pgr' create table reseau_route_pc ( id integer, geom geometry(MultiLineString,4326), source integer, target integer, cost float, reverse_cost float, constraint reseau_route_pc_pkey primary key(id)); --drop table :reseau_table_name truncate reseau_route_pc select gid,geom from route_pc where gid = 407857 select * from reseau_route_pc select gid, ST_Force2D(geom), st_length(ST_Force2D(geom)::geography), st_length(ST_Force2D(geom)::geography) from route_pc select count(*) from route_pc select count (distinct gid) from route_pc select gid, count(*) as cpt from route_pc group by gid order by cpt desc /* Force to 2D to compare geographies. Cast to ::geography to retrieve length in meters (values were very small otherwise). */ insert into reseau_route_pc (id, geom, cost, reverse_cost) select gid, ST_Force2D(geom), st_length(ST_Force2D(geom)::geography), st_length(ST_Force2D(geom)::geography) from route_pc; -- Exploration requests /*select distinct cost from :reseau_table_name order by cost desc select distinct st_length(geom) from :reseau_table_name select * from :reseau_table_name*/ --drop table :reseau_vertices_table_name /* Tolerance value (0.0001) needed to be small on some launches but not always. Analyze graph not necessary. */ select pgr_createTopology('reseau_route_pc',0.001,the_geom:='geom',id:='id',source:='source',target:='target'); select pgr_analyzeGraph('reseau_route_pc',0.001,the_geom:='geom'); create index source_idx on reseau_route_pc("source"); create index target_idx on reseau_route_pc("target"); -- Exploration requests /*select * from :reseau_vertices_table_name select *, st_length(geom) from :reseau_table_name limit 10*/ /*select * from pgr_drivingdistance('select id, source, target, cost from :reseau_table_name',10,400,false,false) create table tmp_table as (select * from equipements) alter table tmp_table add column closestVertexID integer select * from tmp_table update tmp_table set closestVertexID = (select v.id from :reseau_vertices_table_name v where st_distance(v.the_geom,tmp_table.geom) < 1000 order by st_distance(v.the_geom,tmp_table.geom) limit 1) select * from createDrivingDistanceTable() select * from points_atteignables create table zone_atteignable as (select eqtId, closestId, pgr_pointsAsPolygon('select id, st_x(geom) as w, st_y(geom) from ' || :reseau_vertices_table_name || ' tmp where pa.reachedId') from points_atteignables pa group by eqtId, closestId)*/ /*create table pointsMoins5mn as (select tt.id, dd.id, dd.cost from tmp_table tt, (select * from pgr_drivingdistance('select id, source, target, cost from :reseau_table_name',tt.id,400,false,false) where a = 3) as dd) alter table tmp_table add column bufferGeom geometry update tmp_table set bufferGeom = (select )*/
true
b39cec61d7587e3a4823042b604033808f18f828
SQL
StaciAF/holbertonschool-higher_level_programming
/0x0D-SQL_introduction/15-groups.sql
UTF-8
239
3.078125
3
[]
no_license
-- script lits the number of records with same score in second_table of database hbtn_0c_0 -- using MySQL server, database name to be passed SELECT `score`, COUNT(*) AS `number` FROM `second_table` GROUP BY `score` ORDER BY `number` DESC;
true
baa23ccc2aba93c763d62a6c160bea37597d91b3
SQL
soarescbm/e-cidade
/e-cidade/db/v2.3.26/down/pre_v2.3.26.sql
ISO-8859-1
9,014
2.828125
3
[]
no_license
/** * Arquivo pre que desfaz as alteracoes do pre (up) */ /** * TIME B */ delete from db_itensfilho where id_item = 9952; delete from db_menu where id_item = 9952; delete from db_itensmenu where id_item = 9952; delete from db_sysarqmod where codarq = 3718; delete from db_sysarqcamp where codarq = 3718; delete from db_sysprikey where codarq = 3718; delete from db_sysforkey where codarq = 3718; delete from db_sysindices where codind in(4086, 4087); delete from db_syscadind where codind in(4086, 4087); delete from db_syssequencia where codsequencia = 1000378; delete from db_acount where codarq = 3718; delete from db_sysarquivo where codarq = 3718; delete from db_syscampo where codcam in(20640, 20641, 20642); /* 93465 { */ update db_itensmenu set libcliente = w_menus_93465.libcliente from w_menus_93465 where id_item = w_menus_93465.id_menu; insert into db_permissao select * from w_permissao_93465; delete from db_itensmenu where id_item = 9954; delete from db_menu where id_item_filho = 9954; update db_menu set id_item = 29 where id_item_filho in(select w_menus_93465.id_menu from w_menus_93465); drop table w_menus_93465; drop table w_permissao_93465; delete from conhistdoc where c53_coddoc in(212, 213); delete from vinculoeventoscontabeis where c115_sequencial = 108; delete from conhistdoc where c53_coddoc in(39, 40); delete from vinculoeventoscontabeis where c115_sequencial = 109; /* } */ /** * FIM TIME B */ /** * Time C */ -- Tarefa 92375 delete from db_modeloimpressao where db66_sequencial in (2, 3); delete from db_impressora where db64_sequencial in (14, 15); -- Tarefa 94961 delete from db_menu where id_item_filho = 1101027 and id_item != 1000004; -- 94091 update db_itensmenu set funcao = 'lab4_entregaresult001.php' where id_item = 8350; update db_itensmenu set descricao = 'Emisso de Resultado', help = 'Emisso de Resultado', desctec = 'Emisso de Resultado' where id_item = 8349; -- 94950 delete from db_menu where id_item_filho in( 8451, 8452, 8453, 8454 ) and modulo <> 604; --93766 update db_itensmenu set id_item = 1537148 , descricao = 'Incluso' , help = 'Incluso de Sau_procedimento' , funcao = 'sau1_sau_procedimento001.php' , itemativo = '1' , manutencao = '1' , desctec = 'Incluso de Sau_procedimento' , libcliente = 'true' where id_item = 1537148; update db_itensmenu set id_item = 1548421 , descricao = 'Excluso' , help = 'Excluso de Procedimento' , funcao = 'sau1_sau_procedimento003.php' , itemativo = '1' , manutencao = '1' , desctec = 'Excluso de Procedimento' , libcliente = 'true' where id_item = 1548421; -- 95325 update db_syscampo set nomecam = 'z01_v_mae', conteudo = 'varchar(40)', descricao = 'Me', valorinicial = '', rotulo = 'Me', nulo = 't', tamanho = 40, maiusculo = 't', autocompl = 'f', aceitatipo = 0, tipoobj = 'text', rotulorel = 'Me' where codcam = 11248; update db_syscampo set nomecam = 'z01_d_nasc', conteudo = 'date', descricao = 'Nascimento', valorinicial = 'null', rotulo = 'Nascimento', nulo = 't', tamanho = 10, maiusculo = 'f', autocompl = 'f', aceitatipo = 1, tipoobj = 'text', rotulorel = 'Nascimento' where codcam = 1008859; -- 64998 -- Aterar o valor default de: P = Horas - Aula update db_syscampo set nomecam = 'ed31_c_medfreq', conteudo = 'char(1)', descricao = 'D = Freqencia por Dias Letivos P = Frequncia por Perodos', valorinicial = '', rotulo = 'Frequncia', nulo = 'f', tamanho = 1, maiusculo = 't', autocompl = 'f', aceitatipo = 0, tipoobj = 'select', rotulorel = 'Frequncia' where codcam = 1008363; delete from db_syscampodep where codcam = 1008363; delete from db_syscampodef where codcam = 1008363; insert into db_syscampodef values(1008363,'D','DIAS LETIVOS'); insert into db_syscampodef values(1008363,'P','PERODOS'); -- Adicionar campos na basemps delete from db_sysarqcamp where codarq = 1010061; delete from db_syscampo where codcam = 20657; delete from db_syscampo where codcam = 20659; delete from db_syscampo where codcam = 20660; update db_syscampo set nomecam = 'ed34_i_qtdperiodo', conteudo = 'int4', descricao = 'Quantidade de Perodos', valorinicial = '0', rotulo = 'Quantidade de Perodos', nulo = 'f', tamanho = 10, maiusculo = 'f', autocompl = 'f', aceitatipo = 1, tipoobj = 'text', rotulorel = 'Quantidade de Perodos' where codcam = 1008372; -- Adicionar campos na regencia delete from db_sysarqcamp where codarq = 1010084; delete from db_syscampo where codcam = 20661; delete from db_syscampo where codcam = 20662; update db_syscampo set nomecam = 'ed59_i_qtdperiodo', conteudo = 'int4', descricao = 'Quantidade de Perodos', valorinicial = '0', rotulo = 'Perodos', nulo = 'f', tamanho = 10, maiusculo = 'f', autocompl = 'f', aceitatipo = 1, tipoobj = 'text', rotulorel = 'Perodos' where codcam = 1008501; -- Adicionar campo na histmpsdisc delete from db_sysarqcamp where codarq = 1010133; delete from db_syscampo where codcam = 20663; -- Adicionar campo na histmpsdiscfora delete from db_sysarqcamp where codarq = 1010159; delete from db_syscampo where codcam = 20664; -- 94022 - BPA MAGNTICO delete from db_sysarqcamp where codarq = 3182; delete from db_syscampo where codcam = 20670; delete from db_menu where id_item_filho = 9955 AND modulo = 8167; delete from db_itensmenu where id_item= 9955; update db_itensmenu set id_item = 8457 , descricao = 'Gerar Arquivo' , help = 'Gerar Arquivo' , funcao = 'lab4_bpamagnetico001.php' , itemativo = '1' , manutencao = '1' , desctec = 'bpa magnetico' , libcliente = 'true' where id_item = 8457; update db_itensmenu set libcliente = true where id_item = 6976; update db_itensmenu set descricao = 'Gerar Arquivo Layout 2013' where id_item = 9825; /** * FIM Time C */ /** * Time Tributrio */ -- Cadastro de Usurios delete from db_sysarqcamp where codcam = 20639; delete from db_syscampo where codcam = 20639; update db_syscampo set nomecam = 'usuarioativo', conteudo = 'char(1)', descricao = 'se usuario ativo ou nao', valorinicial = '', rotulo = 'se usuario ativo ou nao', nulo = 'f', tamanho = 10, maiusculo = 'f', autocompl = 'f', aceitatipo = 0, tipoobj = 'text', rotulorel = 'se usuario ativo ou nao' where codcam = 573; -- Skin Default delete from db_itensfilho where id_item = 9953; delete from db_menu where id_item_filho = 9953; delete from db_itensmenu where id_item = 9953; --94091 - Entrega Resultado delete from db_sysarqcamp where codarq = 2892 and codcam = 20643; delete from db_syscampo where codcam = 20643; /** * Fim Time Tributrio */ /** * Time Folha */ delete from db_sysarquivo where codarq in (3719,3721); delete from db_sysarqmod where codarq in (3719,3721); delete from db_syscampo where codcam in (20644,20645,20646,20647,20671,20672,20673,20675,20676,20677); delete from db_sysarqcamp where codarq in (3719,3721); delete from db_sysprikey where codarq in (3719,3721); delete from db_sysforkey where codarq in (3719,3721); delete from db_syssequencia where codsequencia = 1000379 and nomesequencia = 'rhpessoalmovcontabancaria_rh138_sequencial_seq'; delete from db_syssequencia where codsequencia = 1000381 and nomesequencia = 'pensaocontabancaria_rh139_sequencial_seq'; delete from db_sysindices where codind in (4088,4089,4090,4093,4094,4095,4096); delete from db_syscadind where codind in (4088,4089,4090,4093,4094,4095,4096); /** * Fim Time Folha */ /** * Time Tributrio */ /** * Inicio Tarefa 83872 */ delete from db_sysarqcamp where codcam = 20656; delete from db_syscampo where codcam = 20656; delete from db_sysarqcamp where codcam = 20658; delete from db_syscampo where codcam = 20658; update db_syscampo set conteudo = 'float4' where codcam = 13541; update db_syscampo set conteudo = 'float4' where codcam = 13542; /** * Fim Tarefa 83872 */ /** * Inicio Tarefa 52990 */ delete from db_sysarqcamp where codcam = 20668; delete from db_sysarqcamp where codcam = 20669; delete from db_syscampo where codcam = 20668; delete from db_syscampo where codcam = 20669; delete from db_documentotemplatepadrao where db81_sequencial = 50; delete from db_documentotemplatetipo where db80_sequencial = 47; /** * Fim Tarefa 52990 */ /** * Inicio Tarefa 92906 */ delete from db_sysarqcamp where codcam = 20666; delete from db_syscampo where codcam = 20666; delete from db_sysforkey where codarq = 906 and referen = 109; delete from db_syscadind where codind = 4091 and codcam = 20666; delete from db_sysindices where codind = 4091; /** * Fim Tarefa 92906 */ /** * Fim Time Tributrio */
true
93b01738b2484c732a6c0f26ac76b57a10426ca6
SQL
durvallucas/octoevents-kotlin
/src/main/resources/db/migration/V01__create_issue_event.sql
UTF-8
672
3.84375
4
[]
no_license
CREATE SEQUENCE octo.sq_issue START WITH 1 INCREMENT by 1 NO CYCLE; CREATE TABLE octo.issue( id NUMERIC(8) NOT NULL, number NUMERIC(8) NOT NULL, created_at TIMESTAMP NOT NULL, CONSTRAINT pk_issu PRIMARY KEY (id) ); CREATE SEQUENCE octo.sq_issue_event START WITH 1 INCREMENT by 1 NO CYCLE; CREATE TABLE octo.issue_event( id NUMERIC(8) NOT NULL, action VARCHAR(15) NOT NULL, created_at TIMESTAMP NOT NULL, issue_id NUMERIC(8) NOT NULL, CONSTRAINT pk_isev PRIMARY KEY (id), CONSTRAINT fk_issu FOREIGN KEY (issue_id) REFERENCES octo.issue(id) );
true
27f88c2273ecff841ad301efce01b2fc44b391e1
SQL
vingelklang/fd-server
/resources/sql/queries.sql
UTF-8
781
4
4
[]
no_license
-- :name insert-day! :! :n -- :doc adds the predictions for this day INSERT INTO predictions (day, m01, m02, m03, m04) VALUES (:day, :m01, :m02, :m03, :m04) on conflict (day) do update set m01 = :m01, m02 = :m02, m03 = :m03, m04 = :m04; -- :name update-day! :! :n -- :doc updates predictions for this day UPDATE predictions set m01 = :m01, m02 = :m02, m03 = :m03, m04 = :m04 where day = :day; -- :name get-by-saved-on :? :1 -- :doc retrieves the predictions by the saved on date SELECT * FROM predictions WHERE day = :day; -- :name get-latest :? :1 -- :doc Latest recorded row by date SELECT * FROM predictions ORDER BY day DESC LIMIT 1; -- :name get-all-predictions :? :* -- :doc Returns all values from the predictions table SELECT * FROM predictions ORDER BY day DESC;
true
00e0f3ae62aa8663237831518e6ad4437d91482e
SQL
festralm/11-904_DataBase_2_course
/marketplace/sql/V10__good_storage_create.sql
UTF-8
231
2.515625
3
[]
no_license
CREATE TABLE `good_storage` ( `id` int NOT NULL, `good_id` int DEFAULT NULL, `storage_id` int DEFAULT NULL, `count` int DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
true
25516424ab5c59b1526cb470aa588f991735977d
SQL
termlex/Vocabulary-v5.0
/MeSH/load_stage.sql
UTF-8
7,216
3.765625
4
[ "Unlicense" ]
permissive
/************************************************************************** * Copyright 2016 Observational Health Data Sciences and Informatics (OHDSI) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * Authors: Timur Vakhitov, Christian Reich * Date: 2017 **************************************************************************/ --1. Update latest_update field to new date DO $_$ BEGIN PERFORM VOCABULARY_PACK.SetLatestUpdate( pVocabularyName => 'MeSH', pVocabularyDate => (SELECT vocabulary_date FROM sources.mrsmap LIMIT 1), pVocabularyVersion => (SELECT EXTRACT (YEAR FROM vocabulary_date)||' Release' FROM sources.mrsmap LIMIT 1), pVocabularyDevSchema => 'DEV_MESH' ); END $_$; --2. Truncate all working tables TRUNCATE TABLE concept_stage; TRUNCATE TABLE concept_relationship_stage; TRUNCATE TABLE concept_synonym_stage; TRUNCATE TABLE pack_content_stage; TRUNCATE TABLE drug_strength_stage; --3. Load into concept_stage. -- Build Main Heading (Descriptors) INSERT INTO CONCEPT_STAGE ( concept_name, domain_id, vocabulary_id, concept_class_id, standard_concept, concept_code, valid_start_date, valid_end_date, invalid_reason ) SELECT DISTINCT mh.str AS concept_name, -- Pick the domain from existing mapping in UMLS with the following order of predence: first_value(c.domain_id) OVER ( PARTITION BY mh.code ORDER BY CASE c.vocabulary_id WHEN 'RxNorm' THEN 1 WHEN 'SNOMED' THEN 2 WHEN 'LOINC' THEN 3 WHEN 'CPT4' THEN 4 ELSE 9 END ) AS domain_id, 'MeSH' AS vocabulary_id, 'Main Heading' AS concept_class_id, NULL AS standard_concept, mh.code AS concept_code, ( SELECT latest_update FROM vocabulary WHERE vocabulary_id = 'MeSH' ) AS valid_start_date, TO_DATE('20991231', 'yyyymmdd') AS valid_end_date, NULL AS invalid_reason FROM SOURCES.mrconso mh -- join to umls cpt4, hcpcs and rxnorm concepts JOIN SOURCES.mrconso m ON mh.cui = m.cui AND m.sab IN ( 'CPT', 'HCPCS', 'HCPT', 'RXNORM', 'SNOMEDCT_US' ) AND m.suppress = 'N' AND m.tty <> 'SY' JOIN concept c ON c.concept_code = m.code AND c.standard_concept = 'S' AND c.vocabulary_id = CASE m.sab WHEN 'CPT' THEN 'CPT4' WHEN 'HCPT' THEN 'CPT4' WHEN 'RXNORM' THEN 'RxNorm' WHEN 'SNOMEDCT_US' THEN 'SNOMED' WHEN 'LNC' THEN 'LOINC' ELSE m.sab END AND domain_id IN ( 'Condition', 'Procedure', 'Drug', 'Measurement' ) WHERE mh.suppress = 'N' AND mh.sab = 'MSH' AND mh.lat = 'ENG' AND mh.tty = 'MH'; -- Build Supplementary Concepts INSERT INTO CONCEPT_STAGE ( concept_name, domain_id, vocabulary_id, concept_class_id, standard_concept, concept_code, valid_start_date, valid_end_date, invalid_reason ) SELECT DISTINCT mh.str AS concept_name, -- Pick the domain from existing mapping in UMLS with the following order of predence: first_value(c.domain_id) OVER ( PARTITION BY mh.code ORDER BY CASE c.vocabulary_id WHEN 'RxNorm' THEN 1 WHEN 'SNOMED' THEN 2 WHEN 'LOINC' THEN 3 WHEN 'CPT4' THEN 4 ELSE 9 END ) AS domain_id, 'MeSH' AS vocabulary_id, 'Suppl Concept' AS concept_class_id, NULL AS standard_concept, mh.code AS concept_code, ( SELECT latest_update FROM vocabulary WHERE vocabulary_id = 'MeSH' ) AS valid_start_date, TO_DATE('20991231', 'yyyymmdd') AS valid_end_date, NULL AS invalid_reason FROM SOURCES.mrconso mh -- join to umls cpt4, hcpcs and rxnorm concepts JOIN SOURCES.mrconso m ON mh.cui = m.cui AND m.sab IN ( 'CPT', 'HCPCS', 'HCPT', 'RXNORM', 'SNOMEDCT_US' ) AND m.suppress = 'N' AND m.tty <> 'SY' JOIN concept c ON c.concept_code = m.code AND c.standard_concept = 'S' AND c.vocabulary_id = CASE m.sab WHEN 'CPT' THEN 'CPT4' WHEN 'HCPT' THEN 'CPT4' WHEN 'RXNORM' THEN 'RxNorm' WHEN 'SNOMEDCT_US' THEN 'SNOMED' WHEN 'LNC' THEN 'LOINC' ELSE m.sab END AND domain_id IN ( 'Condition', 'Procedure', 'Drug', 'Measurement' ) WHERE mh.suppress = 'N' AND mh.sab = 'MSH' AND mh.lat = 'ENG' AND mh.tty = 'NM'; --4. Create concept_relationship_stage INSERT INTO concept_relationship_stage ( concept_code_1, concept_code_2, vocabulary_id_1, vocabulary_id_2, relationship_id, valid_start_date, valid_end_date, invalid_reason ) SELECT DISTINCT mh.code AS concept_code_1, -- Pick existing mapping from UMLS with the following order of predence: first_value(c.concept_code) OVER ( PARTITION BY mh.code ORDER BY CASE c.vocabulary_id WHEN 'RxNorm' THEN 1 WHEN 'SNOMED' THEN 2 WHEN 'LOINC' THEN 3 WHEN 'CPT4' THEN 4 ELSE 9 END ) AS concept_code_2, 'MeSH' AS vocabulary_id_1, first_value(c.vocabulary_id) OVER ( PARTITION BY mh.code ORDER BY CASE c.vocabulary_id WHEN 'RxNorm' THEN 1 WHEN 'SNOMED' THEN 2 WHEN 'LOINC' THEN 3 WHEN 'CPT4' THEN 4 ELSE 9 END ) AS vocabulary_id_2, 'Maps to' AS relationship_id, TO_DATE('19700101', 'yyyymmdd') AS valid_start_date, TO_DATE('20991231', 'yyyymmdd') AS valid_end_date, NULL AS invalid_reason FROM SOURCES.mrconso mh -- join to umls cpt4, hcpcs and rxnorm concepts JOIN SOURCES.mrconso m ON mh.cui = m.cui AND m.sab IN ( 'CPT', 'HCPCS', 'HCPT', 'RXNORM', 'SNOMEDCT_US' ) AND m.suppress = 'N' AND m.tty <> 'SY' JOIN concept c ON c.concept_code = m.code AND c.standard_concept = 'S' AND c.vocabulary_id = CASE m.sab WHEN 'CPT' THEN 'CPT4' WHEN 'HCPT' THEN 'CPT4' WHEN 'RXNORM' THEN 'RxNorm' WHEN 'SNOMEDCT_US' THEN 'SNOMED' WHEN 'LNC' THEN 'LOINC' ELSE m.sab END AND domain_id IN ( 'Condition', 'Procedure', 'Drug', 'Measurement' ) WHERE mh.suppress = 'N' AND mh.sab = 'MSH' AND mh.lat = 'ENG' AND mh.tty IN ( 'NM', 'MH' ); --5. Add synonyms INSERT INTO concept_synonym_stage ( synonym_concept_code, synonym_vocabulary_id, synonym_name, language_concept_id ) SELECT DISTINCT c.concept_code AS synonym_concept_code, 'MeSH' AS synonym_vocabulary_id, u.str AS synonym_name, 4180186 AS language_concept_id -- English FROM concept_stage c JOIN SOURCES.mrconso u ON u.code = c.concept_code AND u.sab = 'MSH' AND u.suppress = 'N' AND u.lat = 'ENG'; --6. Add mapping from deprecated to fresh concepts DO $_$ BEGIN PERFORM VOCABULARY_PACK.AddFreshMAPSTO(); END $_$; --7. Deprecate 'Maps to' mappings to deprecated and upgraded concepts DO $_$ BEGIN PERFORM VOCABULARY_PACK.DeprecateWrongMAPSTO(); END $_$; --8. Delete ambiguous 'Maps to' mappings DO $_$ BEGIN PERFORM VOCABULARY_PACK.DeleteAmbiguousMAPSTO(); END $_$; -- At the end, the three tables concept_stage, concept_relationship_stage and concept_synonym_stage should be ready to be fed into the generic_update.sql script
true
9e0c77cd3157c25cb7059ba0a28bf5e869de6c0f
SQL
v-stamenova/Database-Exercises
/Subqueries-and-Joins/11. Min Average Salary.sql
UTF-8
203
3.953125
4
[]
no_license
SELECT TOP(1) AVG(Employees.Salary) AS MinAverageSalary FROM Employees INNER JOIN Departments ON Departments.DepartmentID = Employees.DepartmentID GROUP BY Departments.Name ORDER BY MinAverageSalary ASC;
true
ebc7dc385fc913e4f85a7bed6ca5c4d72834e516
SQL
ethArek/paste-code
/specs/db/003_seed-languages.sql
UTF-8
240
2.640625
3
[]
no_license
-- Migrate up INSERT INTO languages (id, name, short_name, created_at) VALUES (1, 'JavaScript', 'JS', now()), (2, 'Go', 'Go', now()), (3, 'Pascal', 'Pas', now()); -- Migrate down DELETE FROM languages WHERE id IN (1, 2, 3);
true
0d9d825a84f35168faaad94925c67b1fc4168c4e
SQL
Litox-x/DB
/lab3/task5.sql
WINDOWS-1251
256
2.546875
3
[]
no_license
Use Ostapuk_UNIVER SELECT _, FROM STUDENT; SELECT COUNT(*) From STUDENT; SELECT * FROM STUDENT WHERE = '' SELECT DISTINCT TOP(2) * FROM STUDENT ORDER BY _ Desc;
true
136c7a1727d09c62b23551519b8acf2f7df38c05
SQL
ezsimple/sql
/mariaDB/VW_STATS.sql
UTF-8
1,896
3.5625
4
[]
no_license
CREATE VIEW vw_stats_leaders_point AS select cast(a.pp_rank as signed) AS pp_rank, a.pp_index AS pp_index, a.pp_tcode AS pp_tcode, b.mm_name_display AS mm_name_display, concat(b.mm_mname,' ',b.mm_lname,' ',b.mm_fname) AS e_mm_name_display, a.pp_year AS pp_year, b.mm_code AS mm_code, cast(round(a.pp_point,0) as signed) AS point, a.pp_season AS pp_season, cast(c.pc_gmcnt as signed) AS pc_gmcnt from ( (cg_pltr_point a join cs_memb_mst b on(a.pp_pcode = b.mm_code)) left join cg_priz_rank_gmcnt c on(a.pp_pcode = c.pc_pcode and a.pp_year = c.pc_year and a.pp_tcode = c.pc_tcode) ) order by cast(a.pp_rank as signed),c.pc_gmcnt,b.mm_name_display; CREATE VIEW vw_stats_leaders_prize AS select cast(a.pr_rank as signed) AS pr_rank, b.mm_code AS mm_code, b.mm_name_display AS mm_name_display, concat(b.mm_mname,' ',b.mm_lname,' ',b.mm_fname) AS e_mm_name_display, a.pr_prize AS pr_prize, cast(c.pc_gmcnt as signed) AS pc_gmcnt, a.pr_year AS pr_year, a.pr_tcode AS pr_tcode, b.mm_div AS mm_div from ( (cg_priz_rank a join cs_memb_mst b on(a.pr_pcode = b.mm_code)) left join cg_priz_rank_gmcnt c on(a.pr_pcode = c.pc_pcode and a.pr_year = c.pc_year and a.pr_tcode = c.pc_tcode) ) order by cast(a.pr_rank as signed),cast(c.pc_gmcnt as signed),b.mm_name_display; CREATE VIEW vw_stats_leaders_common AS select cast(a.ry_rank as signed) AS ry_rank, b.mm_code AS mm_code, b.mm_name_display AS mm_name_display, concat(b.mm_mname,' ',b.mm_lname,' ',b.mm_fname) AS e_mm_name_display, a.ry_point AS ry_point, cast(c.pc_gmcnt as signed) AS pc_gmcnt, a.ry_year AS ry_year, a.ry_tcode AS ry_tcode, a.ry_div AS ry_div, a.ry_pcode AS ry_pcode from ( (dr_rcod_year a join cs_memb_mst b on(a.ry_pcode = b.mm_code)) left join cg_priz_rank_gmcnt c on(a.ry_pcode = c.pc_pcode and a.ry_year = c.pc_year and a.ry_tcode = c.pc_tcode) ) where a.ry_rank > 0 order by a.ry_rank,a.ry_hole,b.mm_name_display;
true
dcf55602889a3b0a6b3a2cb0da6ac43647d3e692
SQL
PanasyukDan/op-test-api
/src/main/resources/db/V001__create_database.sql
UTF-8
623
3.578125
4
[]
no_license
CREATE TABLE beer ( id bigint NOT NULL, name character varying(255), description character varying, image_url character varying(255), abv float, ibu float, volume int, volume_unit character varying(255), UNIQUE(name), CONSTRAINT beer_pkey PRIMARY KEY (id) ); CREATE TABLE user ( id uuid NOT NULL, CONSTRAINT user_pkey PRIMARY KEY (id) ); CREATE TABLE user_beer ( user_id uuid, beer_id bigint, CONSTRAINT user_fkey FOREIGN KEY (user_id) REFERENCES user (id), CONSTRAINT beer_fkey FOREIGN KEY (beer_id) REFERENCES beer (id) );
true
9d14887912de1ea30b92c533e342286b37cafa3c
SQL
JackFay/clubtennisapi
/src/database.sql
UTF-8
739
3.578125
4
[]
no_license
DROP TABLE IF EXISTS events CASCADE; create table events ( id integer auto_increment, `date` datetime not null, title varchar(250) not null, `desc` varchar(250) null, PRIMARY KEY (id) ); CREATE TABLE users ( user_id INTEGER AUTO_INCREMENT, first_name VARCHAR(30) NOT NULL, last_name VARCHAR(40) NOT NULL, username VARCHAR(20) NOT NULL UNIQUE, hash VARCHAR(50) NOT NULL, PRIMARY KEY (user_id) ); create table players ( id integer auto_increment, first_name varchar(50) not null, last_name varchar(50) not null, year varchar(10) not null, hometown varchar(30) null, high_school varchar(60) null, PRIMARY KEY (id) ) INSERT INTO users VALUES (1, 'Jack', 'Fay', 'jack', 'test');
true
1f5bb1c5d6ec5464b9d922ed4361444b2fd2a531
SQL
ope-dev-group/oep-project
/qloudbiz-api-product/src/main/resources/db/migration/V1_0_4__init_productline_table.sql
UTF-8
1,197
3.0625
3
[]
no_license
/* Navicat MySQL Data Transfer Source Server : mariadb Source Server Version : 50505 Source Host : 192.168.11.130:3306 Source Database : productdb Target Server Type : MYSQL Target Server Version : 50505 File Encoding : 65001 Date: 2018-12-04 16:05:02 */ -- ---------------------------- -- Table structure for productLine -- ---------------------------- DROP TABLE IF EXISTS `productLine`; CREATE TABLE `productLine` ( `lineId` varchar(50) NOT NULL, `lineCode` varchar(50) NOT NULL, `lineName` varchar(100) NOT NULL, `parentId` varchar(50) DEFAULT NULL, `sort` int(4) NOT NULL, `status` varchar(16) NOT NULL, `createdTime` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `creatorId` varchar(50) NOT NULL, `creatorName` varchar(50) NOT NULL, `modifyTime` timestamp NULL DEFAULT NULL, `modifierId` varchar(50) DEFAULT NULL, `modifierName` varchar(50) DEFAULT NULL, `lastModifyTime` timestamp NULL DEFAULT NULL, `ownerCompanyCode` varchar(50) DEFAULT NULL, `tenantId` varchar(50) NOT NULL DEFAULT '1', PRIMARY KEY (`lineId`) USING BTREE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC;
true
b123ee8de153ac1d14e694ce1d03308cc3bc1de6
SQL
epiii/sister
/shared/db/@tables/level.sql
UTF-8
608
2.90625
3
[]
no_license
# Host: localhost (Version: 5.6.20) # Date: 2015-01-28 15:33:28 # Generator: MySQL-Front 5.3 (Build 4.187) /*!40101 SET NAMES latin1 */; # # Structure for table "level" # DROP TABLE IF EXISTS `level`; CREATE TABLE `level` ( `id_level` int(11) NOT NULL AUTO_INCREMENT, `level` varchar(20) NOT NULL, `action` varchar(255) NOT NULL, `keterangan` text NOT NULL, PRIMARY KEY (`id_level`) ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1; # # Data for table "level" # INSERT INTO `level` VALUES (1,'SA','MTR','superadmin'),(2,'A','MTR','admin'),(3,'O','TR','operator'),(4,'G','R','guest');
true
8370d79a401b7fbdb8cc4c5b7406454bf01a9d48
SQL
TonryR/acme_medical
/ACME_Medical.sql
UTF-8
2,290
3.65625
4
[]
no_license
DROP DATABASE IF EXISTS ACME_Medical; CREATE DATABASE ACME_Medical; USE ACME_Medical; -- creates database CREATE TABLE IF NOT EXISTS `Patients` ( `patientID` int(11) NOT NULL AUTO_INCREMENT, `fName` varchar(50) NOT NULL, `lName` varchar(250) NOT NULL, `gender` varchar(7) NOT NULL, `birthdate` varchar(250) NOT NULL, `genetics` varchar(250) NOT NULL, `diabetic` varchar(3) NOT NULL, `other_conditions` varchar(100) NOT NULL, PRIMARY KEY (`patientID`) ) --creates patients table -- CREATE USER 'kermit'@'localhost' IDENTIFIED BY 'sesame'; GRANT SELECT, INSERT, UPDATE ON Patients TO 'kermit'@'localhost'; -- CREATE TABLE IF NOT EXISTS `Medications` ( `medicationID` int(11) NOT NULL AUTO_INCREMENT, `patientID` int(11) NOT NULL, `vest` varchar(3) NOT NULL, `acapella` varchar(3) NOT NULL, `plumozyme` varchar(100) NOT NULL, `inhaledTobi` varchar(3) NOT NULL, `inhaledColistin` varchar(3) NOT NULL, `hypertonicSaline` varchar(6) NOT NULL, `azithromycin` varchar(3) NOT NULL, `clarithromycin` varchar(3) NOT NULL, `inhaledGentamicin` varchar(3) NOT NULL, `enzymes` varchar(100) NOT NULL, PRIMARY KEY (`medicationID`), CONSTRAINT FOREIGN KEY (`patientID`) REFERENCES `Patients`(`patientID`) ) GRANT SELECT, INSERT, UPDATE ON Medications TO 'kermit'@'localhost'; -- CREATE TABLE IF NOT EXISTS `DoctorVisits` ( `visitID` int(11) NOT NULL AUTO_INCREMENT, `patientID` int(11) NOT NULL, `date` date NOT NULL, `doctorSeen` varchar(25) NOT NULL, `FEV1` int(11) NOT NULL, PRIMARY KEY(`visitID`), CONSTRAINT FOREIGN KEY (`patientID`) REFERENCES `Patients`(`patientID`) ) GRANT SELECT, INSERT, UPDATE ON DoctorVisits TO 'kermit'@'localhost'; -- CREATE TABLE IF NOT EXISTS `LungExams` ( `examID` int(11) NOT NULL AUTO_INCREMENT, `visitID` int(11) NOT NULL, `FEV1` int(11) NOT NULL, PRIMARY KEY(`examID`), CONSTRAINT FOREIGN KEY (`visitID`) REFERENCES `DoctorVisits`(`visitID`) ) GRANT SELECT, INSERT, UPDATE ON DoctorVisits TO 'kermit'@'localhost'; -- CREATE TABLE IF NOT EXISTS `MedDosage` ( `dosageID` int(11) NOT NULL AUTO_INCREMENT, `medicationID` int(11) NOT NULL, `dosageAmount(mg)` int(11) NOT NULL, PRIMARY KEY(`dosageID`), CONSTRAINT FOREIGN KEY (`medicationID`) REFERENCES `Medications`(`medicationID`) )
true
5f7bd763297e7e8114707fa596eb0047549bae58
SQL
muten84/spring-security-oauth2
/others/sdoordinari-aaa/target/generated-resources/sql/ddl/auto/oracle10g.sql
UTF-8
30,374
3.109375
3
[]
no_license
create sequence hibernate_sequence start with 1 increment by 1; create table CP_APPLICATION ( id varchar2(255 char) not null, createdBy varchar2(255 char), createdDate timestamp, lastModifiedBy varchar2(255 char), lastModifiedDate timestamp, DESCRIPTION varchar2(255 char), ENABLED number(1,0), URL varchar2(255 char), primary key (id) ); create table CP_APPLICATION_AUD ( id varchar2(255 char) not null, REV number(10,0) not null, REVTYPE number(3,0), DESCRIPTION varchar2(255 char), ENABLED number(1,0), URL varchar2(255 char), primary key (id, REV) ); create table cp_application_permiss ( APPLICATION_ID varchar2(255 char) not null, PERMISSION_ID varchar2(255 char) not null, primary key (APPLICATION_ID, PERMISSION_ID) ); create table cp_application_permiss_AUD ( REV number(10,0) not null, APPLICATION_ID varchar2(255 char) not null, PERMISSION_ID varchar2(255 char) not null, REVTYPE number(3,0), primary key (REV, APPLICATION_ID, PERMISSION_ID) ); create table cp_application_resource ( APPLICATION_ID varchar2(255 char) not null, RESOURCE_ID varchar2(255 char) not null, primary key (APPLICATION_ID, RESOURCE_ID) ); create table cp_application_resource_AUD ( REV number(10,0) not null, APPLICATION_ID varchar2(255 char) not null, RESOURCE_ID varchar2(255 char) not null, REVTYPE number(3,0), primary key (REV, APPLICATION_ID, RESOURCE_ID) ); create table cp_application_role ( APPLICATION_ID varchar2(255 char) not null, ROLE_ID varchar2(255 char) not null, primary key (APPLICATION_ID, ROLE_ID) ); create table cp_application_role_AUD ( REV number(10,0) not null, APPLICATION_ID varchar2(255 char) not null, ROLE_ID varchar2(255 char) not null, REVTYPE number(3,0), primary key (REV, APPLICATION_ID, ROLE_ID) ); create table CP_CONTACT ( id varchar2(255 char) not null, createdBy varchar2(255 char), createdDate timestamp, lastModifiedBy varchar2(255 char), lastModifiedDate timestamp, EMAIL varchar2(255 char), INTERNATIONAL_AREA_CODE varchar2(255 char), NAME varchar2(255 char), PHONE_NUMBER varchar2(255 char), PHONE_PREFIX varchar2(255 char), SURNAME varchar2(255 char), LOCATION_ID varchar2(255 char), primary key (id) ); create table CP_CONTACT_AUD ( id varchar2(255 char) not null, REV number(10,0) not null, REVTYPE number(3,0), EMAIL varchar2(255 char), INTERNATIONAL_AREA_CODE varchar2(255 char), NAME varchar2(255 char), PHONE_NUMBER varchar2(255 char), PHONE_PREFIX varchar2(255 char), SURNAME varchar2(255 char), LOCATION_ID varchar2(255 char), primary key (id, REV) ); create table CP_LOCATION ( id varchar2(255 char) not null, createdBy varchar2(255 char), createdDate timestamp, lastModifiedBy varchar2(255 char), lastModifiedDate timestamp, ADDRESS varchar2(255 char), CITY varchar2(255 char), COUNTRY varchar2(255 char), HOUSE_NUMBER varchar2(255 char), LATITUDE float, LONGITUDE float, ZIP_CODE varchar2(255 char), USER_ID varchar2(255 char), primary key (id) ); create table CP_LOCATION_AUD ( id varchar2(255 char) not null, REV number(10,0) not null, REVTYPE number(3,0), ADDRESS varchar2(255 char), CITY varchar2(255 char), COUNTRY varchar2(255 char), HOUSE_NUMBER varchar2(255 char), LATITUDE float, LONGITUDE float, ZIP_CODE varchar2(255 char), USER_ID varchar2(255 char), primary key (id, REV) ); create table CP_OPERATION ( id varchar2(255 char) not null, createdBy varchar2(255 char), createdDate timestamp, lastModifiedBy varchar2(255 char), lastModifiedDate timestamp, OPERATION_TYPE varchar2(255 char), RESOURCE_ID varchar2(255 char), primary key (id) ); create table CP_OPERATION_AUD ( id varchar2(255 char) not null, REV number(10,0) not null, REVTYPE number(3,0), OPERATION_TYPE varchar2(255 char), RESOURCE_ID varchar2(255 char), primary key (id, REV) ); create table CP_ORGANIZATION ( id varchar2(255 char) not null, createdBy varchar2(255 char), createdDate timestamp, lastModifiedBy varchar2(255 char), lastModifiedDate timestamp, CODE varchar2(255 char), NAME varchar2(255 char), CONTACT_ID varchar2(255 char), LOCATION_ID varchar2(255 char), primary key (id) ); create table CP_ORGANIZATION_AUD ( id varchar2(255 char) not null, REV number(10,0) not null, REVTYPE number(3,0), CODE varchar2(255 char), NAME varchar2(255 char), CONTACT_ID varchar2(255 char), LOCATION_ID varchar2(255 char), primary key (id, REV) ); create table CP_PERMISSION ( id varchar2(255 char) not null, createdBy varchar2(255 char), createdDate timestamp, lastModifiedBy varchar2(255 char), lastModifiedDate timestamp, endDate timestamp, startDate timestamp, DESCRIPTION varchar2(255 char), APPLICATION_ID varchar2(255 char), ORGANIZATION_ID varchar2(255 char), RESOURCE_ID varchar2(255 char), ROLE_ID varchar2(255 char), SITE_ID varchar2(255 char), PERMISSION_TYPE_ID varchar2(255 char), primary key (id) ); create table CP_PERMISSION_AUD ( id varchar2(255 char) not null, REV number(10,0) not null, REVTYPE number(3,0), DESCRIPTION varchar2(255 char), APPLICATION_ID varchar2(255 char), ORGANIZATION_ID varchar2(255 char), RESOURCE_ID varchar2(255 char), ROLE_ID varchar2(255 char), SITE_ID varchar2(255 char), PERMISSION_TYPE_ID varchar2(255 char), primary key (id, REV) ); create table CP_PERMISSION_TYPE ( id varchar2(255 char) not null, createdBy varchar2(255 char), createdDate timestamp, lastModifiedBy varchar2(255 char), lastModifiedDate timestamp, DESCRIPTION varchar2(255 char), primary key (id) ); create table CP_PERMISSION_TYPE_AUD ( id varchar2(255 char) not null, REV number(10,0) not null, REVTYPE number(3,0), DESCRIPTION varchar2(255 char), primary key (id, REV) ); create table CP_RESOURCE ( id varchar2(255 char) not null, createdBy varchar2(255 char), createdDate timestamp, lastModifiedBy varchar2(255 char), lastModifiedDate timestamp, RESOURCE_ID varchar2(255 char), RESOURCE_QNAME varchar2(255 char), RESOURCE_TYPE_ID varchar2(255 char), primary key (id) ); create table CP_RESOURCE_AUD ( id varchar2(255 char) not null, REV number(10,0) not null, REVTYPE number(3,0), RESOURCE_ID varchar2(255 char), RESOURCE_QNAME varchar2(255 char), RESOURCE_TYPE_ID varchar2(255 char), primary key (id, REV) ); create table CP_RESOURCE_TYPE ( id varchar2(255 char) not null, createdBy varchar2(255 char), createdDate timestamp, lastModifiedBy varchar2(255 char), lastModifiedDate timestamp, DESCRIPTION varchar2(255 char), primary key (id) ); create table CP_RESOURCE_TYPE_AUD ( id varchar2(255 char) not null, REV number(10,0) not null, REVTYPE number(3,0), DESCRIPTION varchar2(255 char), primary key (id, REV) ); create table CP_ROLE ( id varchar2(255 char) not null, createdBy varchar2(255 char), createdDate timestamp, lastModifiedBy varchar2(255 char), lastModifiedDate timestamp, endDate timestamp, startDate timestamp, DESCRIPTION varchar2(255 char), SESSION_ID varchar2(255 char), primary key (id) ); create table CP_ROLE_AUD ( id varchar2(255 char) not null, REV number(10,0) not null, REVTYPE number(3,0), DESCRIPTION varchar2(255 char), primary key (id, REV) ); create table CP_ROLE_GROUP ( id varchar2(255 char) not null, createdBy varchar2(255 char), createdDate timestamp, lastModifiedBy varchar2(255 char), lastModifiedDate timestamp, DESCRIPTION varchar2(255 char), primary key (id) ); create table CP_ROLE_GROUP_AUD ( id varchar2(255 char) not null, REV number(10,0) not null, REVTYPE number(3,0), DESCRIPTION varchar2(255 char), primary key (id, REV) ); create table cp_role_group_role ( ROLE_GROUP_ID varchar2(255 char) not null, ROLE_ID varchar2(255 char) not null, primary key (ROLE_GROUP_ID, ROLE_ID) ); create table cp_role_group_role_AUD ( REV number(10,0) not null, ROLE_GROUP_ID varchar2(255 char) not null, ROLE_ID varchar2(255 char) not null, REVTYPE number(3,0), primary key (REV, ROLE_GROUP_ID, ROLE_ID) ); create table CP_SESSION ( id varchar2(255 char) not null, SESSION_DETAILS varchar2(255 char), SESSION_END timestamp, SESSION_IP_ADDRESS varchar2(255 char), SESSION_RENEWED timestamp, SESSION_START timestamp, ORGANIZATION_ID varchar2(255 char), ROLE_ID varchar2(255 char), SITE_ID varchar2(255 char), USER_ID varchar2(255 char), primary key (id) ); create table CP_SITE ( id varchar2(255 char) not null, createdBy varchar2(255 char), createdDate timestamp, lastModifiedBy varchar2(255 char), lastModifiedDate timestamp, DESCRIPTION varchar2(255 char), CONTACT_ID varchar2(255 char), LOCATION_ID varchar2(255 char), ORGANIZATION_ID varchar2(255 char), FATHER_SITE_ID varchar2(255 char), RESOURCE_ID varchar2(255 char), SESSION_ID varchar2(255 char), primary key (id) ); create table CP_SITE_AUD ( id varchar2(255 char) not null, REV number(10,0) not null, REVTYPE number(3,0), DESCRIPTION varchar2(255 char), CONTACT_ID varchar2(255 char), LOCATION_ID varchar2(255 char), ORGANIZATION_ID varchar2(255 char), FATHER_SITE_ID varchar2(255 char), RESOURCE_ID varchar2(255 char), primary key (id, REV) ); create table CP_SITE_DETAIL ( id varchar2(255 char) not null, createdBy varchar2(255 char), createdDate timestamp, lastModifiedBy varchar2(255 char), lastModifiedDate timestamp, DETAIL varchar2(255 char), SITE_ID varchar2(255 char), SITE_DETAIL_TYPE_ID varchar2(255 char), primary key (id) ); create table CP_SITE_DETAIL_AUD ( id varchar2(255 char) not null, REV number(10,0) not null, REVTYPE number(3,0), DETAIL varchar2(255 char), SITE_ID varchar2(255 char), SITE_DETAIL_TYPE_ID varchar2(255 char), primary key (id, REV) ); create table CP_SITE_DETAIL_TYPE ( id varchar2(255 char) not null, createdBy varchar2(255 char), createdDate timestamp, lastModifiedBy varchar2(255 char), lastModifiedDate timestamp, DESCRIPTION varchar2(255 char), primary key (id) ); create table CP_SITE_DETAIL_TYPE_AUD ( id varchar2(255 char) not null, REV number(10,0) not null, REVTYPE number(3,0), DESCRIPTION varchar2(255 char), primary key (id, REV) ); create table cp_site_role ( SITE_ID varchar2(255 char) not null, ROLE_ID varchar2(255 char) not null, primary key (SITE_ID, ROLE_ID) ); create table cp_site_role_AUD ( REV number(10,0) not null, SITE_ID varchar2(255 char) not null, ROLE_ID varchar2(255 char) not null, REVTYPE number(3,0), primary key (REV, SITE_ID, ROLE_ID) ); create table cp_site_user ( SITE_ID varchar2(255 char) not null, USER_ID varchar2(255 char) not null, primary key (SITE_ID, USER_ID) ); create table cp_site_user_AUD ( REV number(10,0) not null, SITE_ID varchar2(255 char) not null, USER_ID varchar2(255 char) not null, REVTYPE number(3,0), primary key (REV, SITE_ID, USER_ID) ); create table CP_USER ( id varchar2(255 char) not null, createdBy varchar2(255 char), createdDate timestamp, lastModifiedBy varchar2(255 char), lastModifiedDate timestamp, ENABLED number(1,0), NAME varchar2(255 char), PASSWORD varchar2(255 char), PASSWORD_CHANGE_TIMESTAMP timestamp, SURNAME varchar2(255 char), USERNAME varchar2(255 char), USER_PICTURE_ID varchar2(255 char), primary key (id) ); create table CP_USER_AUD ( id varchar2(255 char) not null, REV number(10,0) not null, REVTYPE number(3,0), ENABLED number(1,0), NAME varchar2(255 char), PASSWORD varchar2(255 char), PASSWORD_CHANGE_TIMESTAMP timestamp, SURNAME varchar2(255 char), USERNAME varchar2(255 char), USER_PICTURE_ID varchar2(255 char), primary key (id, REV) ); create table CP_USER_DETAIL ( id varchar2(255 char) not null, createdBy varchar2(255 char), createdDate timestamp, lastModifiedBy varchar2(255 char), lastModifiedDate timestamp, DETAIL varchar2(255 char), USER_DETAIL_TYPE_ID varchar2(255 char), USER_ID varchar2(255 char), primary key (id) ); create table CP_USER_DETAIL_AUD ( id varchar2(255 char) not null, REV number(10,0) not null, REVTYPE number(3,0), DETAIL varchar2(255 char), USER_DETAIL_TYPE_ID varchar2(255 char), USER_ID varchar2(255 char), primary key (id, REV) ); create table CP_USER_DETAIL_TYPE ( id varchar2(255 char) not null, createdBy varchar2(255 char), createdDate timestamp, lastModifiedBy varchar2(255 char), lastModifiedDate timestamp, CLAIM_URI varchar2(255 char), TYPE varchar2(255 char), primary key (id) ); create table CP_USER_DETAIL_TYPE_AUD ( id varchar2(255 char) not null, REV number(10,0) not null, REVTYPE number(3,0), CLAIM_URI varchar2(255 char), TYPE varchar2(255 char), primary key (id, REV) ); create table cp_user_organization ( USER_ID varchar2(255 char) not null, ORGANIZATION_ID varchar2(255 char) not null, primary key (USER_ID, ORGANIZATION_ID) ); create table cp_user_organization_AUD ( REV number(10,0) not null, USER_ID varchar2(255 char) not null, ORGANIZATION_ID varchar2(255 char) not null, REVTYPE number(3,0), primary key (REV, USER_ID, ORGANIZATION_ID) ); create table CP_USER_PICTURE ( id varchar2(255 char) not null, createdBy varchar2(255 char), createdDate timestamp, lastModifiedBy varchar2(255 char), lastModifiedDate timestamp, IMAGE_B64 varchar2(255 char), IMG_HEIGHT number(10,0), IMG_WIDTH number(10,0), USER_ID varchar2(255 char), primary key (id) ); create table CP_USER_PICTURE_AUD ( id varchar2(255 char) not null, REV number(10,0) not null, REVTYPE number(3,0), IMAGE_B64 varchar2(255 char), IMG_HEIGHT number(10,0), IMG_WIDTH number(10,0), USER_ID varchar2(255 char), primary key (id, REV) ); create table cp_user_role ( USER_ID varchar2(255 char) not null, ROLE_ID varchar2(255 char) not null, primary key (USER_ID, ROLE_ID) ); create table cp_user_role_AUD ( REV number(10,0) not null, USER_ID varchar2(255 char) not null, ROLE_ID varchar2(255 char) not null, REVTYPE number(3,0), primary key (REV, USER_ID, ROLE_ID) ); create table cp_user_role_group ( USER_ID varchar2(255 char) not null, ROLE_GROUP_ID varchar2(255 char) not null, primary key (USER_ID, ROLE_GROUP_ID) ); create table cp_user_role_group_AUD ( REV number(10,0) not null, USER_ID varchar2(255 char) not null, ROLE_GROUP_ID varchar2(255 char) not null, REVTYPE number(3,0), primary key (REV, USER_ID, ROLE_GROUP_ID) ); create table REVINFO ( REV number(10,0) not null, REVTSTMP number(19,0), primary key (REV) ); create index CP_CONTACT_IDX on CP_CONTACT (INTERNATIONAL_AREA_CODE); create index CP_LOCATION_IDX on CP_LOCATION (HOUSE_NUMBER); create index CP_LOCATION_2_IDX on CP_LOCATION (ZIP_CODE); create index CP_LOCATION_3_IDX on CP_LOCATION (USER_ID); create index CP_ORGANIZATION_IDX on CP_ORGANIZATION (CODE); create index CP_ORGANIZATION_2_IDX on CP_ORGANIZATION (CONTACT_ID); create index CP_ORGANIZATION_3_IDX on CP_ORGANIZATION (LOCATION_ID); create index CP_PERMISSION_IDX on CP_PERMISSION (PERMISSION_TYPE_ID); create index CP_PERMISSION_2_IDX on CP_PERMISSION (ROLE_ID); create index CP_PERMISSION_3_IDX on CP_PERMISSION (RESOURCE_ID); create index CP_PERMISSION_4_IDX on CP_PERMISSION (APPLICATION_ID); create index CP_PERMISSION_5_IDX on CP_PERMISSION (SITE_ID); create index CP_PERMISSION_6_IDX on CP_PERMISSION (ORGANIZATION_ID); alter table CP_PERMISSION_TYPE add constraint UK_stvk1sbp4bfkwtn7yeohm2e3x unique (DESCRIPTION); create index CP_RESOURCE_IDX on CP_RESOURCE (RESOURCE_TYPE_ID); alter table CP_RESOURCE_TYPE add constraint UK_r0wa1n67wawxypf6rxqc4ka07 unique (DESCRIPTION); create index CP_SESSION_IDX on CP_SESSION (USER_ID); create index CP_SESSION_2_IDX on CP_SESSION (ORGANIZATION_ID); create index CP_SITE_IDX on CP_SITE (RESOURCE_ID); create index CP_SITE_2_IDX on CP_SITE (LOCATION_ID); create index CP_SITE_3_IDX on CP_SITE (CONTACT_ID); create index CP_SITE_DETAIL_IDX on CP_SITE_DETAIL (SITE_ID); create index CP_SITE_DETAIL_2_IDX on CP_SITE_DETAIL (SITE_DETAIL_TYPE_ID); alter table CP_SITE_DETAIL_TYPE add constraint UK_mhsyfw8p321eehub434iai1lg unique (DESCRIPTION); create index CP_USER_DETAIL_IDX on CP_USER_DETAIL (USER_ID); create index CP_USER_DETAIL_2_IDX on CP_USER_DETAIL (USER_DETAIL_TYPE_ID); alter table CP_USER_DETAIL_TYPE add constraint UK_qa0a4hv6owoqkeja3hnkk850h unique (TYPE); alter table CP_APPLICATION_AUD add constraint FKpfdf284yjsgctf37y6uxrhgpa foreign key (REV) references REVINFO; alter table cp_application_permiss add constraint FKsbf4uc3rvn4cjbm3uqowg1pup foreign key (PERMISSION_ID) references CP_PERMISSION; alter table cp_application_permiss add constraint FK6m7861bdjsgan6n7m91isur3v foreign key (APPLICATION_ID) references CP_APPLICATION; alter table cp_application_permiss_AUD add constraint FKy7xquda7ko8o7twa9nfut2t0 foreign key (REV) references REVINFO; alter table cp_application_resource add constraint FK6ncnb488a1ixdj8povfm78gr6 foreign key (RESOURCE_ID) references CP_RESOURCE; alter table cp_application_resource add constraint FK9mpr65jy9mfxyc3ckipd5uybx foreign key (APPLICATION_ID) references CP_APPLICATION; alter table cp_application_resource_AUD add constraint FK3oiq5chjik49etohu083a6bit foreign key (REV) references REVINFO; alter table cp_application_role add constraint FKk6vk8bi39wldkddrw45phv2iv foreign key (ROLE_ID) references CP_ROLE; alter table cp_application_role add constraint FK70sv0b31ysbnm1y5sg164k380 foreign key (APPLICATION_ID) references CP_APPLICATION; alter table cp_application_role_AUD add constraint FK97h4gs3p57069wx0byqei3vqc foreign key (REV) references REVINFO; alter table CP_CONTACT add constraint FKgiphwaujy95xcbjywthtok3j1 foreign key (LOCATION_ID) references CP_LOCATION; alter table CP_CONTACT_AUD add constraint FKtgcuakl6fc5wynai8d9cxwja5 foreign key (REV) references REVINFO; alter table CP_LOCATION add constraint FKa055s2b4ijn9wh295e0nh91hi foreign key (USER_ID) references CP_USER; alter table CP_LOCATION_AUD add constraint FKrp15np9hv6dlx3ceh1to5t6ih foreign key (REV) references REVINFO; alter table CP_OPERATION add constraint FKchvid98tgbybd82xq33idccql foreign key (RESOURCE_ID) references CP_RESOURCE; alter table CP_OPERATION_AUD add constraint FK1627g6m5sjgwxmr4c292nomct foreign key (REV) references REVINFO; alter table CP_ORGANIZATION add constraint FKmvymfv9p2eadxdq1a5god53dt foreign key (CONTACT_ID) references CP_CONTACT; alter table CP_ORGANIZATION add constraint FKe82w2dr1w7ie36l9k9m3i02hg foreign key (LOCATION_ID) references CP_LOCATION; alter table CP_ORGANIZATION_AUD add constraint FKfoqocyne1fof18326ckivcw6v foreign key (REV) references REVINFO; alter table CP_PERMISSION add constraint FKam2vyi02baq9at94d6b6osuh5 foreign key (APPLICATION_ID) references CP_APPLICATION; alter table CP_PERMISSION add constraint FKte3fm5f0706pfemo0e9vjmvgn foreign key (ORGANIZATION_ID) references CP_ORGANIZATION; alter table CP_PERMISSION add constraint FK4uwpqjy3cgh9rl37s4i1xbgsm foreign key (RESOURCE_ID) references CP_RESOURCE; alter table CP_PERMISSION add constraint FKoawdnjj9qk6rc1qch4frxo77i foreign key (ROLE_ID) references CP_ROLE; alter table CP_PERMISSION add constraint FKcakk40um0mm6xho8v3r2vhrr foreign key (SITE_ID) references CP_SITE; alter table CP_PERMISSION add constraint FK44igvkyq4jl874g8xyvx6nyvb foreign key (PERMISSION_TYPE_ID) references CP_PERMISSION_TYPE; alter table CP_PERMISSION_AUD add constraint FKsmf8o4sdipa8699af13m91b3l foreign key (REV) references REVINFO; alter table CP_PERMISSION_TYPE_AUD add constraint FKlklnbcoeg3plgbf23t5bmjo77 foreign key (REV) references REVINFO; alter table CP_RESOURCE add constraint FKk4n57l3hnqmhfcx0btyibyipi foreign key (RESOURCE_TYPE_ID) references CP_RESOURCE_TYPE; alter table CP_RESOURCE_AUD add constraint FK1h9mvae16damn523aijvnutlv foreign key (REV) references REVINFO; alter table CP_RESOURCE_TYPE_AUD add constraint FKlctlt96s1ipmp0ul1g3q8raro foreign key (REV) references REVINFO; alter table CP_ROLE add constraint FKlu35383my6yc8667m0eq68b1m foreign key (SESSION_ID) references CP_SESSION; alter table CP_ROLE_AUD add constraint FK91gh0osboubkjyx63ok6wf9g6 foreign key (REV) references REVINFO; alter table CP_ROLE_GROUP_AUD add constraint FK75x7fl19c7f74uh18oh08bpxe foreign key (REV) references REVINFO; alter table cp_role_group_role add constraint FK6mulanvbaptdn7c9qqm43k8dt foreign key (ROLE_ID) references CP_ROLE; alter table cp_role_group_role add constraint FKb94iiiaybni15he3hvykovcvy foreign key (ROLE_GROUP_ID) references CP_ROLE_GROUP; alter table cp_role_group_role_AUD add constraint FK3xw6i4kht57yrvkhn1ga0tbwf foreign key (REV) references REVINFO; alter table CP_SESSION add constraint FKbr2gs705d4pqmc2nw353ubyhh foreign key (ORGANIZATION_ID) references CP_ORGANIZATION; alter table CP_SESSION add constraint FKlsv8n507odv5umvbpgq7hdv0n foreign key (ROLE_ID) references CP_ROLE; alter table CP_SESSION add constraint FK6w1fpxqf158sbhq21dqmholo0 foreign key (SITE_ID) references CP_SITE; alter table CP_SESSION add constraint FK14ubhk80ocn2oo1g1ciy5upw6 foreign key (USER_ID) references CP_USER; alter table CP_SITE add constraint FKpw5kujfm8qbtgxbwgxyxgoelq foreign key (CONTACT_ID) references CP_CONTACT; alter table CP_SITE add constraint FKkv7qebhhg6u4vusefvv631n23 foreign key (LOCATION_ID) references CP_LOCATION; alter table CP_SITE add constraint FKs3offc8s9nc54quym8w6f90fb foreign key (ORGANIZATION_ID) references CP_ORGANIZATION; alter table CP_SITE add constraint FKgkw0j9wmsijpy3k300n8dj6hg foreign key (FATHER_SITE_ID) references CP_SITE; alter table CP_SITE add constraint FK52cx8gg0ahumgcsqn1mq5y2mf foreign key (RESOURCE_ID) references CP_RESOURCE; alter table CP_SITE add constraint FKguvj0r7njq4dlqb0jj4tive3l foreign key (SESSION_ID) references CP_SESSION; alter table CP_SITE_AUD add constraint FKg42pq0k1n9tkdvfy95rtriiyh foreign key (REV) references REVINFO; alter table CP_SITE_DETAIL add constraint FKghba9h3qep9b1440idib0apqq foreign key (SITE_ID) references CP_SITE; alter table CP_SITE_DETAIL add constraint FK66otn5an4m2yjk7nf4961wt0y foreign key (SITE_DETAIL_TYPE_ID) references CP_SITE_DETAIL_TYPE; alter table CP_SITE_DETAIL_AUD add constraint FK3obo6x1u0kbp78gskwq61ihrx foreign key (REV) references REVINFO; alter table CP_SITE_DETAIL_TYPE_AUD add constraint FK5sfwowvvy7ot3oq12oixo2qyu foreign key (REV) references REVINFO; alter table cp_site_role add constraint FK71u134x2aa1lrq2t48jsfbgfm foreign key (ROLE_ID) references CP_ROLE; alter table cp_site_role add constraint FKmyfiawpjsv1fs0lmpfdkpo8bu foreign key (SITE_ID) references CP_SITE; alter table cp_site_role_AUD add constraint FKdpfv1poadtusvlm4ld1m3y7yc foreign key (REV) references REVINFO; alter table cp_site_user add constraint FKq3l7n3w5gfmxcnfu1plyf2tvc foreign key (USER_ID) references CP_USER; alter table cp_site_user add constraint FKoqgme78y0wgnhto4nop3kpswh foreign key (SITE_ID) references CP_SITE; alter table cp_site_user_AUD add constraint FK1btkir8qhpp8tc6e6hlldedqe foreign key (REV) references REVINFO; alter table CP_USER add constraint FK58fkjsp37yej40kpnw6b3gmqx foreign key (USER_PICTURE_ID) references CP_USER_PICTURE; alter table CP_USER_AUD add constraint FKox69ab4kf5w11t3msbayth3qm foreign key (REV) references REVINFO; alter table CP_USER_DETAIL add constraint FKau3l61jd70ucto7efusanbakh foreign key (USER_DETAIL_TYPE_ID) references CP_USER_DETAIL_TYPE; alter table CP_USER_DETAIL add constraint FK25vke8o3a0ipcj6lymf6qftje foreign key (USER_ID) references CP_USER; alter table CP_USER_DETAIL_AUD add constraint FK8cihjqvgtml44h333voxhskjb foreign key (REV) references REVINFO; alter table CP_USER_DETAIL_TYPE_AUD add constraint FK2uxof9ei18nmspj926j8lqhji foreign key (REV) references REVINFO; alter table cp_user_organization add constraint FKe3gd4pbtpoi94ecdrgh48gk3p foreign key (ORGANIZATION_ID) references CP_ORGANIZATION; alter table cp_user_organization add constraint FK4iaxyeql0kp0bc9gqf95tuit2 foreign key (USER_ID) references CP_USER; alter table cp_user_organization_AUD add constraint FKrk03qji14c7gbwa074wee64i8 foreign key (REV) references REVINFO; alter table CP_USER_PICTURE add constraint FKsj4vr0tkklb52c1gp095knyaw foreign key (USER_ID) references CP_USER; alter table CP_USER_PICTURE_AUD add constraint FKpemv2qmh4roym29m1mdfwbi47 foreign key (REV) references REVINFO; alter table cp_user_role add constraint FKlxg85jhvvp8qu8hmsasxkqffv foreign key (ROLE_ID) references CP_ROLE; alter table cp_user_role add constraint FKbs1ay3w7evp96riuxfsas7ahy foreign key (USER_ID) references CP_USER; alter table cp_user_role_AUD add constraint FKctwno4wfp7qs3l81mxv1hjbv8 foreign key (REV) references REVINFO; alter table cp_user_role_group add constraint FK2wrb8j1ctvv8ymkiue4jdx0fn foreign key (ROLE_GROUP_ID) references CP_ROLE_GROUP; alter table cp_user_role_group add constraint FK86heuseahmmmkh6rf6p8g48fo foreign key (USER_ID) references CP_USER; alter table cp_user_role_group_AUD add constraint FK1noshng358drk6hcrstsyyae7 foreign key (REV) references REVINFO;
true
659856bbd70d0041bd2e1bec4ade9b706938fa45
SQL
jademy-12/WebMediaStoreRox
/src/main/resources/db/mysql/V2016.10.06_0054__mysql_create_shoppingcarts_table.sql
UTF-8
144
2.578125
3
[ "Apache-2.0" ]
permissive
CREATE TABLE shopping_carts ( id int(11) NOT NULL AUTO_INCREMENT, user_id int(11) NOT NULL, shopping_cart_date DATE, PRIMARY KEY (id) );
true
54cd77fa7ce08647086237da423e920959db257a
SQL
Roberto12586/Practicas-SQL
/ejercicio1.sql
UTF-8
4,574
3.5625
4
[]
no_license
CREATE DATABASE IF NOT EXISTS concesionario; USE concesionario; CREATE TABLE coches( id int(10) AUTO_INCREMENT NOT NULL, modelo varchar (255), marca varchar (50), precio int (20)not null, stock int(255)not null, CONSTRAINT pk_coches PRIMARY KEY(id) )ENGINE = INNODB; CREATE TABLE grupos( id int(10) AUTO_INCREMENT NOT NULL, nombre varchar(100) not null, ciudad varchar(100), CONSTRAINT pk_grupos PRIMARY KEY(id) )ENGINE = INNODB; CREATE TABLE vendedores( id int(10) AUTO_INCREMENT NOT NULL, grupo_id int(10)NOT NULL, jefe int(10), nombre varchar(100) not null, apellidos varchar(150), cargo varchar(150), fecha date, sueldo float(20,2), comision float(10,2), CONSTRAINT pk_vendedores PRIMARY KEY(id), CONSTRAINT fl_vendedor_grupo FOREIGN KEY(grupo_id) REFERENCES grupos(id), CONSTRAINT fk_vendedor_jefe FOREIGN KEY(jefe)REFERENCES vendedores(id) )ENGINE = INNODB; CREATE TABLE clientes( id int(10) AUTO_INCREMENT NOT null, vendedor_id int(10), nombre varchar(150) NOT null, ciudad varchar(100), gastado float(50,2), fecha date, CONSTRAINT pk_clientes PRIMARY KEY(id), CONSTRAINT fk_cliente_vendedor FOREIGN KEY(vendedor_id) REFERENCES vendedores(id) )ENGINE = INNODB; CREATE TABLE encargos( id int(10) AUTO_INCREMENT NOT null, cliente_id int(10) not null, coche_id int(10) not null, cantidad int(100), fecha date, CONSTRAINT pk_encargos PRIMARY KEY(id), CONSTRAINT fk_encargo_cliente FOREIGN KEY(cliente_id) REFERENCES clientes(id), CONSTRAINT fk_encargo_coche FOREIGN KEY(coche_id) REFERENCES coches(id) )ENGINE = INNODB; # RELLENAR DATOS CON INSERTS # COCHES INSERT INTO coches VALUES(NULL, 'clio', 'Renault', 12000, 13); INSERT INTO coches VALUES(NULL, 'panda', 'Seat', 10000, 10); INSERT INTO coches VALUES(NULL, 'Ranchera', 'Mercedes', 32000, 24); INSERT INTO coches VALUES(NULL, 'cayene', 'Porsche', 65000, 5); INSERT INTO coches VALUES(NULL, 'Aventador', 'Lamborghini', 170000, 2); INSERT INTO coches VALUES(NULL, 'Spider', 'Ferrari', 245000, 80); # GRUPOS INSERT INTO grupos VALUES(NULL, 'Vendedores A', 'Madrid'); INSERT INTO grupos VALUES(NULL, 'Vendedores B', 'Madrid'); INSERT INTO grupos VALUES(NULL, 'Directores mecánicos', 'Madrid'); INSERT INTO grupos VALUES(NULL, 'Vendedores A', 'Barcelona'); INSERT INTO grupos VALUES(NULL, 'Vendedores B', 'Barcelona'); INSERT INTO grupos VALUES(NULL, 'Vendedores C', 'Valencia'); INSERT INTO grupos VALUES(NULL, 'Vendedores A', 'Bilbao'); INSERT INTO grupos VALUES(NULL, 'Vendedores B', 'Pamplona'); INSERT INTO grupos VALUES(NULL, 'Vendedores C', 'Santiago de Compostela'); # VENDEDORES INSERT INTO vendedores VALUES(NULL, 1, null, 'David', 'Lopez', 'Responsable de tienda', CURDATE(), 30000, 4); INSERT INTO vendedores VALUES(NULL, 1, 1, 'Fran', 'Martinez', 'Ayudante en tienda', CURDATE(), 23000, 2); INSERT INTO vendedores VALUES(NULL, 2, null, 'Nelson', 'Sanchez', 'Responsable de tienda', CURDATE(), 38000, 5); INSERT INTO vendedores VALUES(NULL, 2, 3, 'Jesus', 'Lopez', 'Ayudante en tienda', CURDATE(), 12000, 6); INSERT INTO vendedores VALUES(NULL, 3, null, 'Victor', 'Lopez', 'Mecanico jefe', CURDATE(), 50000, 2); INSERT INTO vendedores VALUES(NULL, 4, null, 'Antonio', 'Lopez', 'Vendedor de recambios', CURDATE(), 13000, 8); INSERT INTO vendedores VALUES(NULL, 5, null, 'Salvador', 'Lopez', 'Vendedor experto', CURDATE(), 60000, 2); INSERT INTO vendedores VALUES(NULL, 6, null, 'Joaquin', 'Lopez', 'Ejecutivo de cuentas', CURDATE(), 80000, 1); INSERT INTO vendedores VALUES(NULL, 6, 8, 'Luis', 'Lopez', 'Ayudante en tienda', CURDATE(), 10000, 10); # CLIENTES INSERT INTO clientes VALUES(NULL, 1, 'Construcciones Diaz Inc', 'Alcobendas', 24000, CURDATE()); INSERT INTO clientes VALUES(NULL, 1, 'Fruteria Antonia', 'Fuenlabrada', 40000, CURDATE()); INSERT INTO clientes VALUES(NULL, 1, 'Imprenta Martinez', 'Barcelona', 32000, CURDATE()); INSERT INTO clientes VALUES(NULL, 1, 'Jesus Colchones', 'El Prat', 96000, CURDATE()); INSERT INTO clientes VALUES(NULL, 1, 'Bar Pepe Inc', 'Valencia', 170000, CURDATE()); INSERT INTO clientes VALUES(NULL, 1, 'Tienda PC Inc', 'Murcia', 245000, CURDATE()); # ENCARGOS INSERT INTO encargos VALUES(NULL, 1, 1, 2, CURDATE()); INSERT INTO encargos VALUES(NULL, 2, 2, 4, CURDATE()); INSERT INTO encargos VALUES(NULL, 3, 3, 1, CURDATE()); INSERT INTO encargos VALUES(NULL, 4, 3, 3, CURDATE()); INSERT INTO encargos VALUES(NULL, 5, 5, 1, CURDATE()); INSERT INTO encargos VALUES(NULL, 6, 6, 1, CURDATE());
true
01a5d7b2622201dff4caf457424a9b33bd3eadf6
SQL
Nivek-/USM-SQL
/SQL Server/Script final v2.sql
UTF-8
3,909
3.46875
3
[]
no_license
CREATE TABLE Alumno ( cod_alumno NVARCHAR(11) NOT NULL, nombre NVARCHAR(20) NOT NULL, apellido NVARCHAR(20) NOT NULL, pass VARCHAR(10) NOT NULL, CONSTRAINT Alumno_pk PRIMARY KEY (cod_alumno) ) CREATE TABLE Asignatura ( cod_asig VARCHAR(6) NOT NULL, cod_curso VARCHAR(5) NOT NULL, nom_asig NVARCHAR(20) NOT NULL, CONSTRAINT Asignatura_pk PRIMARY KEY (cod_asig, cod_curso) ) CREATE TABLE alumno_asignatura ( cod_alumno NVARCHAR(11) NOT NULL, cod_asig VARCHAR(6) NOT NULL, cod_curso VARCHAR(5) NOT NULL, CONSTRAINT alumno_asignatura_pk PRIMARY KEY (cod_alumno, cod_asig, cod_curso) ) CREATE TABLE horario_asignatura ( cod_asig VARCHAR(6) NOT NULL, cod_curso VARCHAR(5) NOT NULL, cod_dia INT NOT NULL, cod_bloque INT NOT NULL, edificio CHAR NOT NULL, sala INT NOT NULL, CONSTRAINT horario_asignatura_pk PRIMARY KEY (cod_asig, cod_curso, cod_dia, cod_bloque) ) CREATE TABLE Profesor ( cod_profesor NVARCHAR(10) NOT NULL, nombre NVARCHAR(20) NOT NULL, apellido NVARCHAR(20) NOT NULL, pass VARCHAR(10) NOT NULL, CONSTRAINT Profesor_pk PRIMARY KEY (cod_profesor) ) CREATE TABLE profesor_asignatura ( cod_profesor NVARCHAR(10) NOT NULL, cod_asig VARCHAR(6) NOT NULL, cod_curso VARCHAR(5) NOT NULL, CONSTRAINT profesor_asignatura_pk PRIMARY KEY (cod_profesor, cod_asig, cod_curso) ) CREATE TABLE Noticia ( cod_profesor NVARCHAR(10) NOT NULL, cod_curso VARCHAR(5) NOT NULL, cod_fecha DATETIME NOT NULL, cod_asig VARCHAR(6) NOT NULL, cod_noticia INT IDENTITY NOT NULL, noticia NVARCHAR(80) NOT NULL, CONSTRAINT Noticia_pk PRIMARY KEY (cod_profesor, cod_curso, cod_fecha, cod_asig) ) CREATE TABLE horario_profesor ( cod_profesor NVARCHAR(10) NOT NULL, cod_dia INT NOT NULL, cod_bloque INT NOT NULL, estado CHAR NOT NULL, CONSTRAINT horario_profesor_pk PRIMARY KEY (cod_profesor, cod_dia, cod_bloque) ) ALTER TABLE alumno_asignatura ADD CONSTRAINT Alumno_alumno_asignatura_fk FOREIGN KEY (cod_alumno) REFERENCES Alumno (cod_alumno) ON DELETE NO ACTION ON UPDATE NO ACTION ALTER TABLE Noticia ADD CONSTRAINT Asignatura_Noticia_fk FOREIGN KEY (cod_asig, cod_curso) REFERENCES Asignatura (cod_asig, cod_curso) ON DELETE NO ACTION ON UPDATE NO ACTION ALTER TABLE horario_asignatura ADD CONSTRAINT Asignatura_horario_asignatura_fk FOREIGN KEY (cod_asig, cod_curso) REFERENCES Asignatura (cod_asig, cod_curso) ON DELETE NO ACTION ON UPDATE NO ACTION ALTER TABLE profesor_asignatura ADD CONSTRAINT Asignatura_profesor_asignatura_fk FOREIGN KEY (cod_asig, cod_curso) REFERENCES Asignatura (cod_asig, cod_curso) ON DELETE NO ACTION ON UPDATE NO ACTION ALTER TABLE alumno_asignatura ADD CONSTRAINT Asignatura_alumno_asignatura_fk FOREIGN KEY (cod_asig, cod_curso) REFERENCES Asignatura (cod_asig, cod_curso) ON DELETE NO ACTION ON UPDATE NO ACTION ALTER TABLE horario_profesor ADD CONSTRAINT Profesor_horario_profesor_fk FOREIGN KEY (cod_profesor) REFERENCES Profesor (cod_profesor) ON DELETE NO ACTION ON UPDATE NO ACTION ALTER TABLE Noticia ADD CONSTRAINT Profesor_Noticia_fk FOREIGN KEY (cod_profesor) REFERENCES Profesor (cod_profesor) ON DELETE NO ACTION ON UPDATE NO ACTION ALTER TABLE profesor_asignatura ADD CONSTRAINT Profesor_profesor_asignatura_fk FOREIGN KEY (cod_profesor) REFERENCES Profesor (cod_profesor) ON DELETE NO ACTION ON UPDATE NO ACTION
true
2d2b55c6e631ca9aa2d90442972eba7027f853eb
SQL
yamfood/yamfood
/resources/migrations/basket/20191128083344-baskets.up.sql
UTF-8
123
2.90625
3
[]
no_license
create table "baskets" ( id serial, client_id int not null unique references clients (id), primary key (id) );
true
a7afa36843712ded0e41ddee589525072d84051f
SQL
lucassfreed/ListaSQL
/Listas.sql
UTF-8
25,180
3.296875
3
[]
no_license
#Lista 01 #Exercício 01 1: DROP DATABASE IF EXISTS ex01; CREATE DATABASE ex01; 2: USE ex01; CREATE TABLE pessoas( nome VARCHAR(100), cpf VARCHAR(14), rg VARCHAR(12), data_de_nascimento Date, idade TINYINT ); 3: INSERT INTO pessoas (nome, cpf, rg, data_de_nascimento, idade) VALUES ('Erick Bryan Enrico Vieira', '699.734.958-70', '90.745.276-0', '1989-05-28', 29), ('Samuel Ruan Dias', '802.790.194-40', '55.318.691-7', '1988-02-08', 30), ('Fábio Benjamin Souza', '522.445.349-60', '54.715.232-2', '1970-03-22', 48), ('Elias Miguel Aparicio', '293.928.821-65', '12.680.444-8', '1986-06-07', 32), ('Alexandre Gustavo Cardoso', '617.408.878-24', '8.888.574-4', '2003-04-15', 15), ('Kauê Lucca Duarte', '943.163.990-47', '46.977.509-9', '1989-05-28', 29), ('Marcos Bryan Guilherme Mendes', '955.129.235-95', '84.050.077-4', '2015-02-06', 3), ('Benedito Pedro Carlos da Mota', '510.505.472-50', '43.588.124-3', '1981-04-19', 37), ('Luís Igor Barbosa', '370.570.311-06', '40.651.407-0', '2013-05-06', 5), ('José Heitor Ramos', '675.624.925-81', '83.962.258-2', '1965-04-11', 53), ('Lucca Tiago Galvão', '788.124.508-57', '3.293.335-6', '1977-06-17', 41), ('Tiago Edson Oliveira', '389.969.352-39', '8.198.446-9', '1977-06-09', 41), ('Enrico Julio Fábio Martins', '529.078.166-83', '99.886.242-3', '2017-03-11', 53), ('Oliver Victor Benjamin da Mota', '798.556.805-02', '5.103.578-9', '1985-03-27', 33), ('Bryan Caio Lopes', '213.217.201-30', '12.949.454-9', '1970-06-18', 48) 4: SELECT * FROM pessoas; #Lista 01 #Exercício 02 1: CREATE TABLE endereços( estado CHAR(2), cidade VARCHAR(140), bairro VARCHAR(120), cep CHAR(10), logradouro VARCHAR(250), numero SMALLINT, complemento TEXT ); 2: INSERT INTO endereços(estado, cidade, bairro, cep, logradouro, numero, complemento) VALUES ('AC', 'Rio Branco', 'Ayrton Senna', '69.911-866', 'Estrada Deputado José Rui da Silveira Lino', 282, 'Casa'), ('SC', 'Biguaçu', 'Fundos', '88.161-400', '', 995, ''), ('MG', 'Santa Luzia', 'Padre Miguel', '33.082-050', 'Rua Buenos Aires', 371, 'Apartamento'), ('BA', '', 'São Tomé de Paripe', '40.800-361', 'Travessa Luís Hage', 685, ''), ('MG', 'Ipatinga', 'Vila Celeste', '', 'Rua Antônio Boaventura Batista', 645, ''), ('RS', 'Passo Fundo', 'Nenê Graeff', '99.030-250', '', 154, ''), ('AM', 'Manaus', 'Petrópolis', '69.079-300', 'Rua Coronel Ferreira Sobrinho', 264, 'Fundos'), ('TO', 'Gurupi', 'Muniz Santana', '77.402-130', 'Rua Adelmo Aires Negri', 794, ''), ('AC', '', 'Preventório', '', 'Beco da Ligação II', 212, 'Bloco B'), ('AP', 'Santana', 'Comercial', '68.925-073', 'Rua Calçoene', 648, ''), ('PB', 'Cabedelo', 'Camalaú', '58.103-052', 'Rua Siqueira Campos', 249, '') #Lista 01 #Exercício 03 1: CREATE TABLE champions( nome VARCHAR(100), descricao VARCHAR(1000), habilidade1 VARCHAR(100), habilidade2 VARCHAR(100), habilidade3 VARCHAR(100), habilidade4 VARCHAR(100), habilidade5 VARCHAR(100) ); 2: INSERT INTO champions(nome, descricao, habilidade1, habilidade2, habilidade3, habilidade4, habilidade5) VALUES ('Katarina', 'a Lâmina Sinistra', 'Voracidade', 'Lâmina Saltitante', 'Preparação', 'Shunpo', 'Lótus da Morte'), ('Yasuo', '', 'Estilo do Errante', 'Tempestade de Aço', 'Parede de Vento', 'Espada Ágil', 'Último Suspiro'), ('Master Yi', 'o Espadachim Wuju', 'Ataque Duplo', '', '', '', ''), ('Vayne', 'a Caçadora Noturna', 'Caçadora Noturna', 'Rolamento', 'Dardos de Prata', 'Condenar', 'Hora Final'), ('Lee Sin', 'o Monge Cego', 'Agitação', 'Onda Sônica/Ataque Ressonante', 'Proteger/Vontade de Ferro', 'Tempestade/Mutilar', ''), ('Vi', 'a Defensora de Piltover', 'Blindagem', '', 'Pancada Certeira', 'Força Excessiva', 'Saque e Enterrada'), ('Diana', 'o Escárnio da Lua', 'Espada de Prata Lunar', 'Golpe Crescente', 'Cascata Lívida', 'Colapso Minguante', 'Zênite Lunar'), ('Annie', 'a Criança Sombria', 'Piromania', 'Desintegrar', 'Incinerar', 'Escudo Fundido', 'Invocar: Tibbers'), ('Aatrox', '', 'Poço de Sangue', 'Voo Sombrio', 'Sede de Sangue/Preço em Sangue', 'Lâminas da Aflição', 'Massacre') #Lista 02 #Exercício 01 1: SELECT id, nome, codigo, categoria, altura, peso, hp, ataque, defesa, especial_ataque, especial_defesa, velocidade, descricao FROM pokemons; 2: SELECT ataque, especial_ataque, defesa, especial_defesa FROM pokemons; 3: SELECT nome 'Nome', categoria 'Categoria', ataque 'Ataque' FROM pokemons ORDER BY nome ASC, categoria ASC, ataque ASC; 4: SELECT altura 'Altura', peso 'Peso', (peso / (altura * altura)) 'IMC' FROM pokemons; 5: SELECT altura 'Altura', peso 'Peso', (peso / (altura * altura)) 'IMC' FROM pokemons ORDER BY (peso / (altura * altura)) DESC; 6: SELECT nome 'Nome', LENGTH(nome) 'Tamanho do nome' FROM pokemons ORDER BY LENGTH(nome); 7: SELECT nome, descricao FROM pokemons WHERE LENGTH(nome) > 10; 8: SELECT nome 'Nome', categoria 'Categoria', ataque 'Ataque' FROM pokemons WHERE ataque = (SELECT MIN(ataque) FROM pokemons); 9: SELECT ataque, especial_ataque, nome, defesa, especial_defesa FROM pokemons ORDER BY ataque ASC; 10: SELECT AVG(ataque) 'Média dos ataques' FROM pokemons; 11: SELECT AVG(especial_ataque) 'Média dos ataques' FROM pokemons WHERE nome LIKE 'P%'; #Lista 02 #Exercício 02 1: SELECT estado 'Estado', cidade 'Cidade' FROM cidades; 2: SELECT cidade FROM cidades WHERE cidade LIKE 'A%'; 3: SELECT cidade 'Cidade' FROM cidades WHERE cidade LIKE '%apar%'; 4: SELECT cidade 'Cidade' FROM cidades WHERE cidade LIKE 'W%'; 5: SELECT estado 'Estado', cidade 'Cidade' FROM cidades WHERE cidade LIKE '%tuba' ORDER BY estado DESC; 6: SELECT cidade 'Cidade' FROM cidades WHERE LENGTH(cidade) > 15 ORDER BY LENGTH(cidade) ASC; 7: SELECT COUNT(estado) 'Quantidade de cidades no estado de SC' FROM cidades WHERE estado = 'SC'; 8: SELECT COUNT(estado) 'Quantidade de cidades no estado de SP' FROM cidades WHERE estado = 'SP'; 9: SELECT cidade 'Cidade', LENGTH(cidade) 'Quantidade de caracteres' FROM cidades WHERE LENGTH(cidade) = 10; #Lista 02 #Exercício 03 1: SELECT nome 'Nome', cpf 'CPF', nick 'Nick', signo 'Signo', numero_favorito 'Número favorito', cor_preferida 'Cor Preferida', nota_1 'Nota 1', nota_2 'Nota 2', nota_3 'Nota 3', nota_4 'Nota 4', data_nascimento 'Data de nascimento' FROM alunos; 2: SELECT nome 'Nome' FROM alunos WHERE nota_1 > 9.0; 3: SELECT nome 'Nome', nota_1 'Nota 1', nota_2 'Nota 2', nota_3 'Nota 3', nota_4 'Nota 4', (nota_1 + nota_2 + nota_3 + nota_4) /4 'Média' FROM alunos; 4: SELECT COUNT(nome) 'Quantidade de alunos com o signo \'Peixes\'' FROM alunos WHERE signo = 'Peixes'; 5: SELECT SUM(nota_1) 'Soma da nota 1' FROM alunos; 6: SELECT SUM(nota_2) 'Soma da nota 2' FROM alunos; 7: SELECT nome 'Nome', MIN(nota_1) 'Menor nota 1' FROM alunos; 8: SELECT nome 'Nome', nota_1 'Nota 1', nota_2 'Nota 2', nota_3 'Nota 3', nota_4 'Nota 4' FROM alunos WHERE nome = (SELECT MAX(nome) FROM alunos); 9: SELECT cor_preferida 'Cor', COUNT(cor_preferida) 'Quantidade de cores com a cor Gelo' FROM alunos WHERE cor_preferida LIKE '%Gelo%'; 10: SELECT COUNT(nome) 'Quantidade de nomes' FROM alunos WHERE nome LIKE 'Francisco%'; 11: SELECT COUNT(nome) 'Quantidade de nomes' FROM alunos WHERE nome LIKE '%Luc%'; 12: SELECT nome 'Nome', signo 'Signo', data_nascimento 'Data de nascimento' FROM alunos WHERE signo = 'Áries'; 13: SELECT nome 'Nome do aluno com maior média', nota_1 'Nota 1 dele', nota_2 'Nota 2 dele', nota_3 'Nota 3 dele', nota_4 'Nota 4 dele' FROM alunos WHERE ((nota_1 + nota_2 + nota_3 + nota_4) / 4) = ( (SELECT MAX(((nota_1 + nota_2 + nota_3 + nota_4) / 4)) FROM alunos)); 14: SELECT nome 'Nome', (nota_1 + nota_2 + nota_3 + nota_4) / 4 'Média', IF ((nota_1 + nota_2 + nota_3 + nota_4) / 4 < 5, 'Reprovado', IF((nota_1 + nota_2 + nota_3 + nota_4) / 4 < 7, 'Em exame', 'Aprovado')) AS Estado FROM alunos; 15: SELECT nome 'Nome do aluno com maior média', nota_1 'Nota 1 dele', nota_2 'Nota 2 dele', nota_3 'Nota 3 dele', nota_4 'Nota 4 dele' FROM alunos WHERE ((nota_1 + nota_2 + nota_3 + nota_4) / 4) = ( (SELECT MIN(((nota_1 + nota_2 + nota_3 + nota_4) / 4)) FROM alunos)); 16: SELECT COUNT(nome) 'Quantidade de alunos' FROM alunos WHERE (nota_1 + nota_2 + nota_3 + nota_4) / 4 > 7; 17: SELECT nome 'Nome', nick 'Nick' FROM alunos WHERE LENGTH(nick) = 5; 18: SELECT nome 'Nome do aluno', cor_preferida 'Cor preferida' FROM alunos WHERE cor_preferida = 'Ouro' OR cor_preferida = 'Amarelo-torrado'; 19: SELECT nome 'Nome', EXTRACT(YEAR FROM data_nascimento) 'Ano de nascimento' FROM alunos; 20: SELECT nome 'Nome', EXTRACT(MONTH FROM data_nascimento) 'Mês de nascimento' FROM alunos WHERE EXTRACT(MONTH FROM data_nascimento) > 6; 21: SELECT COUNT(nome) 'Quantidade de pessoas que nasceram em 1996' FROM alunos WHERE EXTRACT(YEAR FROM data_nascimento) = 1996; 22: SELECT COUNT(nome) 'Quantidade de pessoas que nasceram em 02/02/1964' FROM alunos WHERE EXTRACT(DAY FROM data_nascimento) = 02 AND EXTRACT(MONTH FROM data_nascimento) = 02 AND EXTRACT(YEAR FROM data_nascimento) = 1964; 23: SELECT nick 'Nick', nota_4 'Nota 4' FROM alunos WHERE nota_2 >= 5.0 AND nota_2 <= 5.99; 24: SELECT (nota_1 + nota_2 + nota_3 + nota_4) / 4 'Média da aluna Josefina' FROM alunos WHERE nome LIKE '%Josefina%'; 25: SELECT nome 'Nick', nota_1 'Nota 1', nota_2 'Nota 2', nota_3 'Nota 3', nota_4 'Nota 4' FROM alunos WHERE nome LIKE '%Justino%' AND signo LIKE 'A%'; 26: SELECT (SUM(nota_1) + SUM(nota_2) + SUM(nota_3) + SUM(nota_4)) / COUNT(nome) 'Média das médias' FROM alunos; #Lista 03 #Exercício 01 1: UPDATE pokemons SET categoria = 'Seed' WHERE codigo > 50 AND codigo < 100; 2: UPDATE pokemons SET ataque = '29' WHERE nome LIKE '%inj%'; 3: UPDATE pokemons SET velocidade = 2 WHERE velocidade = 5; 4: UPDATE pokemons SET categoria = 'Manipulate' WHERE codigo = 100; 5: UPDATE pokemons SET nome = REPLACE(nome, 'R', 'C') WHERE nome LIKE 'R%'; 6: UPDATE pokemons SET altura = 0.51, peso = 0.70 WHERE altura = 0.5; 7: UPDATE pokemons SET codigo = 1, defesa = 1, ataque = 1, especial_ataque = 3, especial_defesa = 4 WHERE especial_defesa = 3 AND especial_ataque = 4; 8: UPDATE pokemons SET nome = SUBSTRING(0, 11) WHERE LENGTH(nome) > 10; 9: UPDATE pokemons SET categoria = 'water' WHERE descricao LIKE '%flames%'; 10: UPDATE pokemons SET codigo = 151 WHERE codigo = 155; 11: UPDATE pokemons SET nome = 'Naruto', ataque = 1 WHERE nome = 'Kabuto'; 12: UPDATE pokemons SET nome = 'Sasuke', especial_ataque = 8002, ataque = 8001 WHERE nome = 'Mewtwo' OR nome = 'Mew'; 13: UPDATE pokemons SET descricao = 'Lorem ipsum', nome = 'Tyranitar', categoria = 'Wood Gecko' WHERE MOD(codigo, 2) = 0; #Lista 03 #Exercício 02 1: UPDATE cidades SET estado = 'SS' WHERE estado = 'sc'; 2: UPDATE cidades SET cidade = 'Brumenau', estado = 'SC' WHERE cidade = 'Blumenau'; 3: UPDATE cidades SET cidade = 'Batata' WHERE cidade LIKE 'Bata%'; 4: UPDATE cidades SET cidade = REPLACE(cidade, 'Belo', 'Lindo') WHERE cidade LIKE '%Belo%'; 5: UPDATE cidades SET estado = 'SC' WHERE cidade LIKE 'Indaia%'; 6: UPDATE cidades SET estado = 'SC' WHERE cidade LIKE '%Timbó%'; 7: UPDATE cidades SET cidade = REPLACE(cidade, 'José', 'josué') WHERE cidade LIKE '%José%'; 8: UPDATE cidades SET estado = 'PS' WHERE estado LIKE '%SP%'; 9: UPDATE cidades SET cidade = 'qualquer texto' WHERE LENGTH(cidade) = 10; 10: UPDATE cidades SET cidade = 'It' WHERE cidade LIKE 'It%'; 11: UPDATE cidades SET estado = 'TO' WHERE cidade LIKE '%ã'; #Lista 03 #Exercício 03 1: UPDATE alunos SET nota_1 = 9.9 WHERE EXTRACT(YEAR FROM data_nascimento) = 1996; 2: UPDATE alunos SET nota_2 = 1.3 WHERE nome LIKE 'Urbano%'; 3: UPDATE alunos SET numero_favorito = (SELECT FLOOR(RAND()*10)) WHERE MOD(numero_favorito, 2) <> 0; 4: UPDATE alunos SET signo = 'Áries', numero_favorito = 100, cor_preferida = 'Preto', nome = 'Marcela' WHERE signo = 'Peixes'; 5: UPDATE alunos SET cor_preferida = 'azul', nota_2 = 9.3 WHERE cor_preferida = 'cáqui'; 6: UPDATE alunos SET cpf = '101.947.311-89' WHERE cpf = '10194731189'; 7: UPDATE alunos SET cor_preferida = 'amarelo queimado' WHERE nome = '%Goes'; 8: UPDATE alunos SET nota_1 = 1, nota_2 = 1, nota_3 = 1, nota_4 = 1 WHERE (nota_1 + nota_2 + nota_3 + nota_4) /4 < 4; 9: UPDATE alunos SET nick = 'Ninjutsu' WHERE nick = 'Fueusn'; 10: UPDATE alunos SET nick = 'Dobermann', cor_preferida = 'rosa' WHERE nick = 'Saxiol'; 11: UPDATE alunos SET data_nascimento = EXTRACT(DAY FROM data_nascimento) = 30 WHERE EXTRACT(DAY FROM data_nascimento) = 31; 12: UPDATE alunos SET cor_preferida = 'roxo', nick = 'Roxolandia' WHERE cor_preferida = 'roxo' OR cor_preferida = 'coral'; 13: UPDATE alunos SET data_nascimento = EXTRACT(MONTH FROM data_nascimento) = 05, data_nascimento = EXTRACT(YEAR FROM data_nascimento) = 2018 WHERE EXTRACT(MONTH FROM data_nascimento) = 06; #Lista 04 #Exercício 01 1: DELETE FROM pokemons WHERE categoria = 'Seed'; 2: DELETE FROM pokemons WHERE nome LIKE 'Nid%'; 3: DELETE FROM pokemons WHERE categoria LIKE 'Snow%'; 4: DELETE FROM pokemons WHERE ataque = 2 OR defesa = 1; 5: DELETE FROM pokemons WHERE especial_ataque = MOD(especial_ataque, 2) = 0; 6: DELETE FROM pokemons WHERE LENGTH(nome) >= 10; 7: DELETE FROM pokemons WHERE LENGTH(categoria) < 4; 8: DELETE FROM pokemons WHERE MOD(velocidade, 2) <> 0; 9: DELETE FROM pokemons WHERE nome LIKE 'Uno%' OR nome LIKE 'Charm%'; 10: DELETE FROM pokemons WHERE categoria LIKE '%Flower%' AND codigo > 45 AND codigo < 200; 11: DELETE FROM pokemons WHERE descricao LIKE '%shell%'; 12: DELETE FROM pokemons WHERE peso >= 100; 13: DELETE FROM pokemons WHERE altura < 1; 14: DELETE FROM pokemons WHERE especial_defesa > 3; 15: DELETE FROM pokemons WHERE LENGTH(descricao) > 150; 16: DELETE FROM pokemons WHERE descricao LIKE '%good%'; 17: DELETE FROM pokemons WHERE MOD(codigo, 2) = 0; 18: DELETE FROM pokemons WHERE nome = 'Lileep'; 19: DELETE FROM pokemons WHERE especial_ataque = 5; 20: DELETE FROM pokemons WHERE codigo < 100; #Lista 04 #Exercício 02 1: DELETE FROM cidades WHERE estado = 'RS'; 2: DELETE FROM cidades WHERE estado = 'AC' AND cidade LIKE 'R%'; 3: DELETE FROM cidades WHERE cidade LIKE '%goas'; 4: DELETE FROM cidades WHERE cidade LIKE '%irmãos%'; 5: DELETE FROM cidades WHERE estado = 'MG'; 6: DELETE FROM cidades WHERE cidade = 'Douradina'; #Lista 04 #Exercício 03 1: DELETE FROM alunos WHERE nome LIKE '%Francisco%'; 2: DELETE FROM alunos WHERE EXTRACT(YEAR FROM data_nascimento) = 1994; 3: DELETE FROM alunos WHERE signo = 'Gêmeos'; 4: DELETE FROM alunos WHERE nome LIKE '%Reinaldo%'; 5: DELETE FROM alunos WHERE nome LIKE '%Carvalho'; 6: DELETE FROM alunos WHERE EXTRACT(MONTH FROM data_nascimento) = 07; 7: DELETE FROM alunos WHERE nota_1 > nota_2 AND nota_4 < nota_3; 8: DELETE FROM alunos WHERE cpf LIKE '145.%'; 9: DELETE FROM alunos WHERE cor_preferida = 'Bordo' AND signo = 'Capricórnio' OR cor_preferida = 'Cinza-claro' AND signo = 'Aquários'; 10: DELETE FROM alunos WHERE ((nota_1 + nota_2 + nota_3 + nota_4) / 4) < 4; 11: DELETE FROM alunos WHERE EXTRACT(DAY FROM data_nascimento) = 28; #Lista 05 #Exercício 01 1: DROP DATABASE IF EXISTS ex01; CREATE DATABASE IF NOT EXISTS ex01; USE ex01; DROP TABLE IF EXISTS alunos; CREATE TABLE alunos ( id INT AUTO_INCREMENT PRIMARY KEY, nome VARCHAR(200), idade INT ); DROP TABLE IF EXISTS caracteristicas; CREATE TABLE caracteristicas ( id INT AUTO_INCREMENT PRIMARY KEY, id_aluno INT, caracteristica VARCHAR(150) NOT NULL, FOREIGN KEY(id_aluno) REFERENCES alunos(id) ); INSERT INTO alunos (nome, idade) VALUES ('Alice', 18), ('Sophia', 40), ('Miguel', 9), ('Heitor', 23), ('Valentina', 15), ('Joaquim', 49) ; INSERT INTO caracteristicas (id_aluno, caracteristica) VALUES ((SELECT id FROM alunos WHERE nome = 'Heitor'), 'Egoísta'), ((SELECT id FROM alunos WHERE nome = 'Alice'), 'Organizado(a)'), ((SELECT id FROM alunos WHERE nome = 'Sophia'), 'Pontual'), ((SELECT id FROM alunos WHERE nome = 'Miguel'), 'Criativo(a)'), ((SELECT id FROM alunos WHERE nome = 'Heitor'), 'Proativo(a)'), ((SELECT id FROM alunos WHERE nome = 'Alice'), 'Altruísta'), ((SELECT id FROM alunos WHERE nome = 'Valentina'), 'Pessimista'), ((SELECT id FROM alunos WHERE nome = 'Joaquim'), 'Flexível modelo'), ((SELECT id FROM alunos WHERE nome = 'Sophia'), 'Observadora'), ((SELECT id FROM alunos WHERE nome = 'Joaquim'), 'Paciente'), ((SELECT id FROM alunos WHERE nome = 'Heitor'), 'Indelicado(a)'), ((SELECT id FROM alunos WHERE nome = 'Sophia'), 'Desobediente'), ((SELECT id FROM alunos WHERE nome = 'Miguel'), 'Intolerante'), ((SELECT id FROM alunos WHERE nome = 'Joaquim'), 'Empático(a)'), ((SELECT id FROM alunos WHERE nome = 'Sophia'), 'Egoísta'), ((SELECT id FROM alunos WHERE nome = 'Heitor'), 'Egoísta'), ((SELECT id FROM alunos WHERE nome = 'Joaquim'), 'Altruísta'), ((SELECT id FROM alunos WHERE nome = 'Sophia'), 'Sensível') ; /* SELECT alunos.nome 'Nome do aluno', caracteristicas.caracteristica 'Característica' FROM alunos JOIN caracteristicas ON(alunos.id = caracteristicas.id_aluno); */ /* SELECT COUNT(alunos.nome) 'Quantidade de alunos' FROM alunos JOIN caracteristicas ON(alunos.id = caracteristicas.id_aluno AND caracteristicas.caracteristica = 'Altruísta'); */ /* SELECT caracteristicas.caracteristica 'Característica', COUNT(id_aluno) 'Quantidade de alunos' FROM alunos JOIN caracteristicas ON(alunos.id = caracteristicas.id_aluno) GROUP BY caracteristicas.caracteristica ORDER BY caracteristicas.caracteristica; */ /* SELECT caracteristicas.caracteristica 'Característica' FROM alunos JOIN caracteristicas ON(alunos.id = caracteristicas.id_aluno AND alunos.nome = 'Sophia'); */ 2: DROP DATABASE IF EXISTS ex02; CREATE DATABASE IF NOT EXISTS ex02; USE ex02; DROP TABLE IF EXISTS pessoas; CREATE TABLE pessoas( id INT AUTO_INCREMENT PRIMARY KEY, nome VARCHAR(200), cpf VARCHAR(11) ); INSERT INTO pessoas (nome, cpf) VALUES ('Abraão Nobre', '95232829483'), ('Severino Braga', '87677033300'), ('Samuel Faria', '98927203429'), ('Florêncio Robalo', '36263517425') ; DROP TABLE IF EXISTS carros; CREATE TABLE carros( id INT AUTO_INCREMENT PRIMARY KEY, id_pessoa INT, marca VARCHAR(150) NOT NULL, modelo VARCHAR(150) NOT NULL, ano_lancamento INT NOT NULL, ano_fabricacao INT NOT NULL, motor VARCHAR(150), cor VARCHAR(100), preco DOUBLE ); INSERT INTO carros (id_pessoa, marca, modelo, ano_lancamento, ano_fabricacao, motor, cor, preco) VALUES ((SELECT id FROM pessoas WHERE nome = 'Abraão Nobre'), 'Volkswagen', 'Gol', '2010', '2009', 'Bv Power Flex', 'Vermelho', 18000), ((SELECT id FROM pessoas WHERE nome = 'Severino Braga'), 'Fiat', 'Brava', '2000', '1999', 'SX 1.6 16V', 'Cinza', 9000), ((SELECT id FROM pessoas WHERE nome = 'Samuel Faria'), 'Renault', 'Clio', '1997', '1996', '1.0 8v', 'Verde', 5500), ((SELECT id FROM pessoas WHERE nome = 'Florêncio Robalo'), 'Volkswagen', 'Golf', '1994', '1994', '2.0 120cv', 'Azul', 17000) ; SELECT pessoas.nome 'Dono', carros.marca 'Marca', carros.modelo 'Modelo' FROM pessoas JOIN carros ON(pessoas.id = carros.id); SELECT carros.marca 'Marca', carros.modelo 'Modelo' FROM carros JOIN pessoas ON(carros.id = pessoas.id AND (SELECT id FROM pessoas WHERE pessoas.nome = 'Samuel Faria') = carros.id); 3: DROP DATABASE IF EXISTS ex02; CREATE DATABASE IF NOT EXISTS ex02; USE ex02; DROP TABLE IF EXISTS Clientes; CREATE TABLE Clientes( id INT AUTO_INCREMENT PRIMARY KEY, nome TEXT NOT NULL, sexo CHAR(1) NOT NULL ); DROP TABLE IF EXISTS Celulares; CREATE TABLE Celulares( id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, id_cliente INT NOT NULL, valor TEXT NOT NULL, ativo boolean DEFAULT TRUE, FOREIGN KEY(id_cliente) REFERENCES Clientes(id) ); DROP TABLE IF EXISTS Emails; CREATE TABLE Emails( id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, id_cliente INT NOT NULL, valor TEXT NOT NULL, ativo boolean, FOREIGN KEY(id_cliente) REFERENCES Clientes(id) ); DROP TABLE IF EXISTS Contas_a_Pagar; CREATE TABLE Contas_a_Pagar( id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, id_cliente INT NOT NULL, valor double UNSIGNED NOT NULL, data_vencimento DATE NOT NULL, valor_pago double DEFAULT 0, stats TEXT, ativo boolean, FOREIGN KEY(id_cliente) REFERENCES Clientes(id) ); DROP TABLE IF EXISTS Contas_a_Receber; CREATE TABLE Contas_a_Receber( id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, id_cliente INT NOT NULL, valor_a_receber DOUBLE, data_para_pagamento DATE, valor_recebido DOUBLE DEFAULT 0, data_recebimento DATE, stats TEXT, ativo boolean, FOREIGN KEY(id_cliente) REFERENCES Clientes(id) ); INSERT INTO Clientes (nome, sexo) VALUES ('Germana', 'F'), ('Salvador', 'M '), ('Úrsula', 'F'), ('Aluísio', 'M') ; INSERT INTO Celulares (id_cliente, valor) VALUES (1, '(79) 99973-5114'), (2, '(27) 98390-6475'), (1, '(27) 98390-6475'), (4, '(14) 98387-5333'), (3, '(92) 98983-2809'), (4, '(55) 98616-2303') ; INSERT INTO Emails (id_cliente, valor) VALUES (2, 'bernardodiegoalves-77@vianetfone.com.br'), (1, 'a68341ef3b@emailna.life'), (3, 'zpgkmkem@boximail.com'), (1, 'ger@bol.com'), (2, 'gabrieldiegofernandodarocha_@uoul.com'), (3, 'iancauearaujo_@10clic.com.br'), (1, 'germana@gmail.com'), (2, 'salvador@hotmail.com') ; INSERT INTO Contas_a_Pagar (id_cliente, data_vencimento, valor) VALUES (1, '2018-06-15', 500.00), (2, '2018-06-29', 320.50), (3, '2018-06-07', 450.00), (4, '2018-08-27', 1300.00), (4, '2018-10-10', 777.00), (2, '2018-10-14', 8001.00), (3, '2018-11-25', 232.12), (3, '2018-09-13', 104.23), (1, '2018-07-17', 65.00), (4, '2018-10-06', 98.83), (2, '2018-12-12', 12.17), (2, '2018-12-23', 6.25) ; INSERT INTO Contas_a_Receber (id_cliente, data_para_pagamento, valor_a_receber) VALUES (3, '2018-12-08', 78.97), (2, '2018-11-24', 700.00), (1, '2018-10-09', 45.87), (1, '2019-01-04', 39.50), (4, '2018-11-30', 123.45), (3, '2018-09-07', 987.65), (2, '2018-07-06', 456.00) ; --Emails SELECT Clientes.nome 'Nome do cliente', Emails.valor 'Email' FROM Clientes JOIN Emails ON(Clientes.id = Emails.id); SELECT Clientes.nome 'Nome do cliente', Emails.valor 'Email' FROM Clientes JOIN Emails ON(Clientes.id = Emails.id) ORDER BY Clientes.nome ASC, Emails.valor ASC; SELECT Clientes.nome 'Nome do cliente', Emails.valor 'Email' FROM Clientes JOIN Emails ON(Clientes.id = Emails.id) ORDER BY LENGTH(Emails.valor) DESC; --Celulares SELECT Clientes.nome 'Nome do cliente', Celulares.valor 'Celular' FROM Clientes JOIN Celulares ON(Clientes.id = Celulares.id); SELECT Clientes.nome 'Nome do cliente', Celulares.valor 'Celular' FROM Clientes JOIN Celulares ON(Clientes.id = Celulares.id) WHERE Celulares.ativo = true; --Contas a Pagar UPDATE Contas_a_Pagar SET Contas_a_Pagar.valor_pago = 100.00, Contas_a_Pagar.data_vencimento = (SELECT NOW()), Contas_a_Pagar.stats = 'pago' WHERE Contas_a_Pagar.id_cliente = 2; UPDATE Contas_a_Pagar SET Contas_a_Pagar.valor_pago = 700.00, Contas_a_Pagar.data_vencimento = DATE_SUB((SELECT NOW()), INTERVAL 1 DAY), Contas_a_Pagar.stats = 'pago' WHERE Contas_a_Pagar.id_cliente = 2 AND valor = 700.00; SELECT Clientes.nome 'Nome do cliente', Contas_a_Pagar.valor 'Valor da conta à pagar', Contas_a_Pagar.data_vencimento 'Data de vencimento', Contas_a_Pagar.valor_pago 'Valor pago' FROM Clientes JOIN Contas_a_Pagar ON(Clientes.id = Contas_a_Pagar.id); SELECT Clientes.nome 'Nome do cliente', Contas_a_Pagar.valor 'Valor da conta à pagar', EXTRACT(MONTH FROM Contas_a_Pagar.data_vencimento) 'Mês de vencimento' FROM Clientes JOIN Contas_a_Pagar ON(Clientes.id = Contas_a_Pagar.id); SELECT Clientes.nome 'Nome do cliente', SUM((SELECT Contas_a_Pagar.valor FROM Contas_a_Pagar WHERE Contas_a_Pagar.id = Clientes.id)) 'Total à pagar' FROM Clientes JOIN Contas_a_Pagar ON(Clientes.id = Contas_a_Pagar.id) GROUP BY Clientes.nome ORDER BY Clientes.nome; --Contas a Receber UPDATE Contas_a_Receber JOIN Clientes ON(Clientes.id = Contas_a_Receber.id_cliente) SET Contas_a_Receber.valor_recebido = 1000 WHERE Clientes.sexo = 'F'; UPDATE Contas_a_Receber JOIN Clientes ON(Clientes.id = Contas_a_Receber.id_cliente) SET Contas_a_Receber.data_recebimento = (SELECT CURDATE() +1) WHERE Clientes.nome LIKE 'A%' OR Clientes.nome LIKE 'S%'; SELECT Clientes.nome 'Nome do cliente', SUM((SELECT Contas_a_Receber.valor_a_receber FROM Contas_a_Receber WHERE Contas_a_Receber.id = Clientes.id)) 'Total das contas à receber' FROM Clientes JOIN Contas_a_Receber ON(Clientes.id = Contas_a_Receber.id_cliente) GROUP BY Clientes.nome; SELECT Clientes.nome 'Nome do cliente', COUNT((SELECT Contas_a_Receber.valor_a_receber FROM Contas_a_Receber WHERE Contas_a_Receber.id = Clientes.id)) 'Quantidade de contas à receber' FROM Clientes JOIN Contas_a_Receber ON(Clientes.id = Contas_a_Receber.id_cliente) GROUP BY Clientes.nome;
true
929e94f0e49586077f5eaa2e1e4465319d95161e
SQL
AlexusBlack/alexusEngine
/siteEngine2.sql
UTF-8
8,026
2.90625
3
[ "Apache-2.0" ]
permissive
-- phpMyAdmin SQL Dump -- version 3.3.2 -- http://www.phpmyadmin.net -- -- Хост: localhost -- Время создания: Мар 03 2013 г., 15:08 -- Версия сервера: 5.1.49 -- Версия PHP: 5.3.3-1ubuntu9.6 SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8 */; -- -- База данных: `siteEngine2` -- -- -------------------------------------------------------- -- -- Структура таблицы `category` -- CREATE TABLE IF NOT EXISTS `category` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` text COLLATE utf8_unicode_ci NOT NULL, `category` int(11) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=7 ; -- -- Дамп данных таблицы `category` -- INSERT INTO `category` (`id`, `name`, `category`) VALUES (1, 'main', -1), (4, 'blog', -1), (5, 'soft', -1), (6, 'news', -1); -- -------------------------------------------------------- -- -- Структура таблицы `menus` -- CREATE TABLE IF NOT EXISTS `menus` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` text NOT NULL, `content` text NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=7 ; -- -- Дамп данных таблицы `menus` -- INSERT INTO `menus` (`id`, `name`, `content`) VALUES (1, 'main', '[{"sort":1,"text":"Главная","src":"/siteEngine2/"},{"sort":2,"text":"Блог","src":"/siteEngine2/blog"},{"sort":3,"text":"Софт","src":"/siteEngine2/soft"},{"sort":4,"text":"Контакты","src":"/siteEngine2/contacts"}]'); -- -------------------------------------------------------- -- -- Структура таблицы `pages` -- CREATE TABLE IF NOT EXISTS `pages` ( `id` int(11) NOT NULL AUTO_INCREMENT, `path` text COLLATE utf8_unicode_ci NOT NULL, `category` int(11) NOT NULL, `title` text COLLATE utf8_unicode_ci NOT NULL, `keywords` text COLLATE utf8_unicode_ci NOT NULL, `description` text COLLATE utf8_unicode_ci NOT NULL, `small_content` text COLLATE utf8_unicode_ci NOT NULL, `big_content` text COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=12 ; -- -- Дамп данных таблицы `pages` -- INSERT INTO `pages` (`id`, `path`, `category`, `title`, `keywords`, `description`, `small_content`, `big_content`) VALUES (1, 'main', 1, '%D0%93%D0%BB%D0%B0%D0%B2%D0%BD%D0%B0%D1%8F', '%D0%B2%D1%81%D1%8F%D0%BA%D0%B8%D0%B5+%D0%BA%D0%BB%D1%8E%D1%87%D0%B5%D0%B2%D0%B8%D0%BA%D0%B8', '%D0%BF%D1%80%D0%BE%D0%B1%D0%BD%D0%BE%D0%B5+%D0%BE%D0%BF%D0%B8%D1%81%D0%B0%D0%BD%D0%B8%D0%B5', '', '%3Cdiv%3E%0A%3Ch3%3E%D0%97%D0%B0%D0%B3%D0%BE%D0%BB%D0%BE%D0%B2%D0%BE%D0%BA%3C%2Fh3%3E%0A%D0%A2%D0%B5%D0%BA%D1%81%D1%82+%D0%B4%D0%BB%D1%8F+%D0%B3%D0%BB%D0%B0%D0%B2%D0%BD%D0%BE%D0%B9+%D1%81%D1%82%D1%80%D0%B0%D0%BD%D0%B8%D1%86%D1%8B%0A%3C%2Fdiv%3E%0A%5BCOMPONENT%3ApageList%7Cdefault%7C%7B%22category%22%3A%22news%22%2C%22sort%22%3A%22DESC%22%2C%22parseImage%22%3A%22true%22%7D%5D%3Cbr%3E%3Cbr%3E%0A%5BCOMPONENT%3Aform%7Cdefault%7C%7B%22handler%22%3A%22Mail%22%2C%22handler_params%22%3A%7B%22to%22%3A%22alexusblack%40gmail.com%22%2C%22mailTemplate%22%3A%22default%22%7D%7D%5D'), (6, 'blog', 1, '%D0%91%D0%BB%D0%BE%D0%B3', '%D0%9D%D0%BE%D0%B2%D1%8B%D0%B5+%D0%BA%D0%BB%D1%8E%D1%87%D0%B5%D0%B2%D1%8B%D0%B5+%D1%81%D0%BB%D0%BE%D0%B2%D0%B0', '%D0%9D%D0%BE%D0%B2%D0%BE%D0%B5+%D0%BE%D0%BF%D0%B8%D1%81%D0%B0%D0%BD%D0%B8%D0%B5', '%D0%9A%D1%80%D0%B0%D1%82%D0%BA%D0%B8%D0%B9+%D1%82%D0%B5%D0%BA%D1%81%D1%82+%D0%BD%D0%BE%D0%B2%D0%BE%D0%B9+%D1%81%D1%82%D1%80%D0%B0%D0%BD%D0%B8%D1%86%D1%8B', '%D0%A2%D1%83%D1%82+%D1%82%D0%B5%D0%BA%D1%81%D1%82+%D0%B8+%D0%B2%D1%8B%D0%B2%D0%BE%D0%B4+%D1%81%D1%82%D1%80%D0%B0%D0%BD%D0%B8%D1%86+%D0%B8%D0%B7+%D0%BA%D0%B0%D1%82%D0%B5%D0%B3%D0%BE%D1%80%D0%B8%D0%B8+%D0%B1%D0%BB%D0%BE%D0%B3%3Cbr%3E'), (7, 'soft', 1, '%D0%A1%D0%BE%D1%84%D1%82', '%D0%9D%D0%BE%D0%B2%D1%8B%D0%B5+%D0%BA%D0%BB%D1%8E%D1%87%D0%B5%D0%B2%D1%8B%D0%B5+%D1%81%D0%BB%D0%BE%D0%B2%D0%B0', '%D0%9D%D0%BE%D0%B2%D0%BE%D0%B5+%D0%BE%D0%BF%D0%B8%D1%81%D0%B0%D0%BD%D0%B8%D0%B5', '%D0%9A%D1%80%D0%B0%D1%82%D0%BA%D0%B8%D0%B9+%D1%82%D0%B5%D0%BA%D1%81%D1%82+%D0%BD%D0%BE%D0%B2%D0%BE%D0%B9+%D1%81%D1%82%D1%80%D0%B0%D0%BD%D0%B8%D1%86%D1%8B', '%D1%82%D1%83%D1%82+%D1%82%D0%B5%D0%BA%D1%81%D1%82+%D0%B8+%D0%B2%D1%8B%D0%B2%D0%BE%D0%B4+%D1%81%D1%82%D1%80%D0%B0%D0%BD%D0%B8%D1%86+%D0%B8%D0%B7+%D0%BA%D0%B0%D1%82%D0%B5%D0%B3%D0%BE%D1%80%D0%B8%D0%B8+%D1%81%D0%BE%D1%84%D1%82%3Cbr%3E'), (8, 'contacts', 1, '%D0%9A%D0%BE%D0%BD%D1%82%D0%B0%D0%BA%D1%82%D1%8B', '%D0%9D%D0%BE%D0%B2%D1%8B%D0%B5+%D0%BA%D0%BB%D1%8E%D1%87%D0%B5%D0%B2%D1%8B%D0%B5+%D1%81%D0%BB%D0%BE%D0%B2%D0%B0', '%D0%9D%D0%BE%D0%B2%D0%BE%D0%B5+%D0%BE%D0%BF%D0%B8%D1%81%D0%B0%D0%BD%D0%B8%D0%B5', '%D0%9A%D1%80%D0%B0%D1%82%D0%BA%D0%B8%D0%B9+%D1%82%D0%B5%D0%BA%D1%81%D1%82+%D0%BD%D0%BE%D0%B2%D0%BE%D0%B9+%D1%81%D1%82%D1%80%D0%B0%D0%BD%D0%B8%D1%86%D1%8B%3Cbr%3E%3Cimg+src%3D%22http%3A%2F%2Fa-l-e-x-u-s.ru%2Fimg%2Flogo.jpg%22%3E', '%D0%A2%D1%83%D1%82+%D0%BA%D0%BE%D0%BD%D1%82%D0%BA%D1%82%D0%BD%D0%B0%D1%8F+%D0%B8%D0%BD%D1%84%D0%BE%D1%80%D0%BC%D0%B0%D1%86%D0%B8%D1%8F+%D0%B8+%D1%84%D0%BE%D1%80%D0%BC%D0%B0+%D1%81%D0%B2%D1%8F%D0%B7%D0%B8%3Cbr%3E'), (9, 'new_site', 6, '%D0%9E%D0%B1%D0%BD%D0%BE%D0%B2%D0%BB%D0%B5%D0%BD%D0%B8%D0%B5+%D1%81%D0%B0%D0%B9%D1%82%D0%B0', '%D0%9D%D0%BE%D0%B2%D1%8B%D0%B5+%D0%BA%D0%BB%D1%8E%D1%87%D0%B5%D0%B2%D1%8B%D0%B5+%D1%81%D0%BB%D0%BE%D0%B2%D0%B0', '%D0%9D%D0%BE%D0%B2%D0%BE%D0%B5+%D0%BE%D0%BF%D0%B8%D1%81%D0%B0%D0%BD%D0%B8%D0%B5', '%D0%9A%D1%80%D0%B0%D1%82%D0%BA%D0%B8%D0%B9+%D1%82%D0%B5%D0%BA%D1%81%D1%82+%D0%BD%D0%BE%D0%B2%D0%BE%D0%B9+%D1%81%D1%82%D1%80%D0%B0%D0%BD%D0%B8%D1%86%D1%8B%3Cbr%3E%3Cimg+src%3D%22http%3A%2F%2Fa-l-e-x-u-s.ru%2FsiteEngine2%2Fupload%2FThe_Yes_Guy.png%22%3E', '%D0%9F%D0%BE%D0%B4%D1%80%D0%BE%D0%B1%D0%BD%D0%B0%D1%8F+%D0%B8%D0%BD%D1%84%D0%BE%D1%80%D0%BC%D0%B0%D1%86%D0%B8%D1%8F+%D0%BE%D0%B1+%D0%BE%D0%B1%D0%BD%D0%BE%D0%B2%D0%BB%D0%B5%D0%BD%D0%B8%D0%B8+%D1%81%D0%B0%D0%B9%D1%82%D0%B0'), (10, 'test_news', 6, '%D0%97%D0%B0%D0%B3%D0%BE%D0%BB%D0%BE%D0%B2%D0%BE%D0%BA+%D0%BD%D0%BE%D0%B2%D0%BE%D0%B9+%D1%81%D1%82%D1%80%D0%B0%D0%BD%D0%B8%D1%86%D1%8B', '%D0%9D%D0%BE%D0%B2%D1%8B%D0%B5+%D0%BA%D0%BB%D1%8E%D1%87%D0%B5%D0%B2%D1%8B%D0%B5+%D1%81%D0%BB%D0%BE%D0%B2%D0%B0', '%D0%9D%D0%BE%D0%B2%D0%BE%D0%B5+%D0%BE%D0%BF%D0%B8%D1%81%D0%B0%D0%BD%D0%B8%D0%B5', '%D0%9A%D1%80%D0%B0%D1%82%D0%BA%D0%B8%D0%B9+%D1%82%D0%B5%D0%BA%D1%81%D1%82+%D0%BD%D0%BE%D0%B2%D0%BE%D0%B9+%D1%81%D1%82%D1%80%D0%B0%D0%BD%D0%B8%D1%86%D1%8B', '%D0%91%D0%BE%D0%BB%D1%8C%D1%88%D0%BE%D0%B9+%D1%82%D0%B5%D0%BA%D1%81%D1%82+%D0%BD%D0%BE%D0%B2%D0%BE%D0%B9+%D1%81%D1%82%D1%80%D0%B0%D0%BD%D0%B8%D1%86%D1%8B'), (11, '404', 1, '404+-+%D0%A1%D1%82%D1%80%D0%B0%D0%BD%D0%B8%D1%86%D0%B0+%D0%BD%D0%B5+%D0%BD%D0%B0%D0%B9%D0%B4%D0%B5%D0%BD%D0%B0', '%D0%9D%D0%BE%D0%B2%D1%8B%D0%B5+%D0%BA%D0%BB%D1%8E%D1%87%D0%B5%D0%B2%D1%8B%D0%B5+%D1%81%D0%BB%D0%BE%D0%B2%D0%B0', '%D0%9D%D0%BE%D0%B2%D0%BE%D0%B5+%D0%BE%D0%BF%D0%B8%D1%81%D0%B0%D0%BD%D0%B8%D0%B5', '%D0%9A%D1%80%D0%B0%D1%82%D0%BA%D0%B8%D0%B9+%D1%82%D0%B5%D0%BA%D1%81%D1%82+%D0%BD%D0%BE%D0%B2%D0%BE%D0%B9+%D1%81%D1%82%D1%80%D0%B0%D0%BD%D0%B8%D1%86%D1%8B', '%D0%A1%D1%82%D1%80%D0%B0%D0%BD%D0%B8%D1%86%D0%B0+%D0%BD%D0%B5+%D0%BD%D0%B0%D0%B9%D0%B4%D0%B5%D0%BD%D0%B0%3Cbr%3E'); -- -------------------------------------------------------- -- -- Структура таблицы `settings` -- CREATE TABLE IF NOT EXISTS `settings` ( `name` text COLLATE utf8_unicode_ci NOT NULL, `value` text COLLATE utf8_unicode_ci NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -- Дамп данных таблицы `settings` -- INSERT INTO `settings` (`name`, `value`) VALUES ('template', 'alexus'), ('defaultPage', 'main'), ('postfix', '');
true
5454228386336eb793e2d9abfe5b802b6ed5ecc0
SQL
Corondo1/POOP_Large_Project
/yeet_setup.sql
UTF-8
910
3.734375
4
[]
no_license
CREATE TABLE IF NOT EXISTS Users ( id INT(11) NOT NULL AUTO_INCREMENT, name VARCHAR(255) NOT NULL, password VARCHAR(255) NOT NULL, PRIMARY KEY (id), UNIQUE KEY (name) ); CREATE TABLE IF NOT EXISTS Pages ( id INT(11) NOT NULL AUTO_INCREMENT, title VARCHAR(255) NOT NULL, editor_id INT(11) NOT NULL, last_edit DATETIME NOT NULL, access INT(11) NOT NULL, PRIMARY KEY (id), FOREIGN KEY (editor_id) REFERENCES Users (id) ON DELETE CASCADE ON UPDATE CASCADE ); CREATE TABLE IF NOT EXISTS Sections ( id INT(11) NOT NULL AUTO_INCREMENT, page_id INT(11) NOT NULL, rank INT(11) NOT NULL, heading VARCHAR(255) NOT NULL, link VARCHAR(255), content TEXT, pic_loc VARCHAR(255), caption VARCHAR(255), PRIMARY KEY (id), FOREIGN KEY (page_id) REFERENCES Pages (id) ON DELETE CASCADE ON UPDATE CASCADE );
true