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
cae4d06eb6f22d01bf5e5e587198619543a7b59c
SQL
sfjsss/ExpenseReimbursementSystem
/expenseReimbursementSystem/setup.sql
UTF-8
700
3
3
[]
no_license
create table employee ( employee_id serial constraint pk_employee_id primary key, email varchar, employee_type varchar, first_name varchar, last_name varchar, pass varchar ); create table reimbursement ( reimbursement_id serial constraint pk_reimbursement_id primary key, reimbursement_type varchar, reimbursement_time timestamp, reimbursement_description varchar, receipt_name varchar, receipt_path varchar, reimbursement_status varchar, requester_id integer references employee(employee_id), processor_id integer references employee(employee_id) ); insert into employee (email, employee_type, first_name, last_name, pass) values ('[email protected]', 'employee', 'alan', 'li', 'password');
true
e45cc4e4a34fc0cf7e7a93dbbefb62cba204dd58
SQL
13020180006/UAS-PBO
/UASPBO/laundry.sql
UTF-8
435
2.78125
3
[]
no_license
/* Nama : Paramadina Mulya Majid Stambuk : 13020180006 Hari/Tgl : Jumat, 26 Juni 2020 Waktu : 21.30 WITA */ create database laundry; use laundry; create table pesan(no_pesanan int primary key, nama_pemesan varchar(30), jenis_cuci enum("Cuci Basah", "Cuci Kering","Cuci Setrika"), harga_per_kilo int, berat int, total_harga int, bayar int); desc pesan; drop table pesan; select * from pesan; delete from pesan where no_pesanan="2020";
true
6af9a53e9003695cff3bbadf2b56b07dbe3ad5b0
SQL
rahulnitc3003/RideOut
/rideout_old/id1068737_rideout.sql
UTF-8
8,454
2.796875
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 4.6.6 -- https://www.phpmyadmin.net/ -- -- Host: localhost -- Generation Time: Nov 29, 2017 at 11:42 AM -- Server version: 10.1.20-MariaDB -- PHP Version: 7.0.8 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8mb4 */; -- -- Database: `id1068737_rideout` -- -- -------------------------------------------------------- -- -- Table structure for table `booking` -- CREATE TABLE `booking` ( `book_id` int(11) NOT NULL, `ride_id` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `booking` -- INSERT INTO `booking` (`book_id`, `ride_id`) VALUES (1, 1), (174, 181), (177, 182); -- -------------------------------------------------------- -- -- Table structure for table `carowner` -- CREATE TABLE `carowner` ( `oauth_provider` varchar(255) NOT NULL, `oauth_uid` varchar(255) NOT NULL, `first_name` varchar(100) NOT NULL, `last_name` varchar(100) NOT NULL, `email` varchar(50) NOT NULL, `picture` varchar(255) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `carowner` -- INSERT INTO `carowner` (`oauth_provider`, `oauth_uid`, `first_name`, `last_name`, `email`, `picture`) VALUES ('google', '113896374515202488338', 'Diwakar', 'Prajapati', '[email protected]', 'https://lh3.googleusercontent.com/-XdUIqdMkCWA/AAAAAAAAAAI/AAAAAAAAAAA/4252rscbv5M/photo.jpg'), ('humhai', 'hamariid', 'hum', 'tum', '[email protected]', 'perfect.jpg'), ('google', '112488956762366918887', 'Lakshit', 'Garg', '[email protected]', 'https://lh5.googleusercontent.com/-7ubXDCGFL2s/AAAAAAAAAAI/AAAAAAAAH1s/YY7vZ5dXb9s/photo.jpg'), ('google', '103845691284819729982', 'Pratyush', 'Agarwal', '[email protected]', 'https://lh4.googleusercontent.com/-5iUZD3c7UdY/AAAAAAAAAAI/AAAAAAAAArs/Aqodl9avrJk/photo.jpg'), ('google', '105403090574881316256', 'rahul', 'kumar', '[email protected]', 'https://lh3.googleusercontent.com/-XdUIqdMkCWA/AAAAAAAAAAI/AAAAAAAAAAA/4252rscbv5M/photo.jpg'), ('google', '104177842580817757452', 'rahul', 'kumar', '[email protected]', 'https://lh6.googleusercontent.com/-pi4c3E5bkvI/AAAAAAAAAAI/AAAAAAAATFc/_WU8A9mEKnU/photo.jpg'), ('google', '102007952580788003563', 'rutheerles', 'alves', '[email protected]', 'https://lh3.googleusercontent.com/-XdUIqdMkCWA/AAAAAAAAAAI/AAAAAAAAAAA/4252rscbv5M/photo.jpg'), ('google', '114765125199914707696', 'shivam', 'agarwal', '[email protected]', 'https://lh6.googleusercontent.com/-Upi5T5_Xeco/AAAAAAAAAAI/AAAAAAAACAU/YcSd7w5ltjs/photo.jpg'); -- -------------------------------------------------------- -- -- Table structure for table `copassenger` -- CREATE TABLE `copassenger` ( `first_name` varchar(100) NOT NULL, `last_name` varchar(100) NOT NULL, `email` varchar(60) NOT NULL, `password` varchar(40) NOT NULL, `address` varchar(40) NOT NULL, `uid` bigint(12) NOT NULL, `contact_no` varchar(40) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `copassenger` -- INSERT INTO `copassenger` (`first_name`, `last_name`, `email`, `password`, `address`, `uid`, `contact_no`) VALUES ('1', '1', '[email protected]', '', '', 0, ''), ('rahul', 'raj', '[email protected]', '123456', 'nitc', 123456765434, '9876478645'), ('Pratyush', 'Agarwal', '[email protected]', '123456', 'MBH NITC', 987654543213, '9876478645'), ('rahul', 'kumar', '[email protected]', '999999', 'nitc', 123456789091, '9878765098'), ('brendo', 'rutherles', '[email protected]', 'br1996', 'av 2', 345676543790, '8988553793'), ('shivam', 'agarwal', '[email protected]', '123456', 'ffers', 256352014852, '09455036173'); -- -------------------------------------------------------- -- -- Table structure for table `journey` -- CREATE TABLE `journey` ( `journey_id` int(11) NOT NULL, `email` varchar(255) NOT NULL, `car_no` varchar(255) NOT NULL, `source` varchar(255) NOT NULL, `destination` varchar(255) NOT NULL, `doj` varchar(10) NOT NULL, `seats_avail` varchar(255) NOT NULL, `mobno` bigint(15) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `journey` -- INSERT INTO `journey` (`journey_id`, `email`, `car_no`, `source`, `destination`, `doj`, `seats_avail`, `mobno`) VALUES (1, '[email protected]', '1', '', '', '', '', 0), (113, '[email protected]', 'UP-09xf-3453', 'Kanpur', 'Lucknow', '10/31/2017', '2', 9998877777), (114, '[email protected]', 'jh-99ed-1234', 'kanpur', 'kolkata', '10/31/2017', '1', 9988776655); -- -------------------------------------------------------- -- -- Table structure for table `ride` -- CREATE TABLE `ride` ( `ride_id` int(11) NOT NULL, `email` varchar(255) NOT NULL, `source` varchar(255) DEFAULT NULL, `destination` varchar(255) DEFAULT NULL, `seats_book` int(11) DEFAULT NULL, `doj` varchar(10) DEFAULT NULL, `journey_id` int(11) NOT NULL, `mobno` bigint(15) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `ride` -- INSERT INTO `ride` (`ride_id`, `email`, `source`, `destination`, `seats_book`, `doj`, `journey_id`, `mobno`) VALUES (1, '[email protected]', NULL, NULL, NULL, NULL, 1, 0), (181, '[email protected]', 'Kanpur', 'Lucknow', 1, '10/31/2017', 113, 9998877777), (182, '[email protected]', 'Kanpur', 'Lucknow', 1, '10/31/2017', 113, 9998877777); -- -------------------------------------------------------- -- -- Table structure for table `user` -- CREATE TABLE `user` ( `id` int(11) NOT NULL, `oauth_provider` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `oauth_uid` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `first_name` varchar(100) COLLATE utf8_unicode_ci NOT NULL, `last_name` varchar(100) COLLATE utf8_unicode_ci NOT NULL, `email` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `gender` varchar(10) COLLATE utf8_unicode_ci NOT NULL, `locale` varchar(10) COLLATE utf8_unicode_ci NOT NULL, `picture` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `link` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `created` datetime NOT NULL, `modified` datetime NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -- Indexes for dumped tables -- -- -- Indexes for table `booking` -- ALTER TABLE `booking` ADD PRIMARY KEY (`book_id`), ADD UNIQUE KEY `ride_id` (`ride_id`); -- -- Indexes for table `carowner` -- ALTER TABLE `carowner` ADD PRIMARY KEY (`email`); -- -- Indexes for table `copassenger` -- ALTER TABLE `copassenger` ADD PRIMARY KEY (`email`); -- -- Indexes for table `journey` -- ALTER TABLE `journey` ADD PRIMARY KEY (`journey_id`), ADD KEY `email` (`email`); -- -- Indexes for table `ride` -- ALTER TABLE `ride` ADD PRIMARY KEY (`ride_id`), ADD KEY `email` (`email`), ADD KEY `journey_id` (`journey_id`); -- -- Indexes for table `user` -- ALTER TABLE `user` ADD PRIMARY KEY (`id`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `booking` -- ALTER TABLE `booking` MODIFY `book_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=178; -- -- AUTO_INCREMENT for table `journey` -- ALTER TABLE `journey` MODIFY `journey_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=115; -- -- AUTO_INCREMENT for table `ride` -- ALTER TABLE `ride` MODIFY `ride_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=186; -- -- AUTO_INCREMENT for table `user` -- ALTER TABLE `user` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6; -- -- Constraints for dumped tables -- -- -- Constraints for table `booking` -- ALTER TABLE `booking` ADD CONSTRAINT `booking_ibfk_1` FOREIGN KEY (`ride_id`) REFERENCES `ride` (`ride_id`) ON DELETE CASCADE ON UPDATE CASCADE; -- -- Constraints for table `journey` -- ALTER TABLE `journey` ADD CONSTRAINT `journey_ibfk_1` FOREIGN KEY (`email`) REFERENCES `carowner` (`email`) ON DELETE CASCADE ON UPDATE CASCADE, ADD CONSTRAINT `journey_ibfk_2` FOREIGN KEY (`email`) REFERENCES `carowner` (`email`) ON DELETE CASCADE ON UPDATE CASCADE; -- -- Constraints for table `ride` -- ALTER TABLE `ride` ADD CONSTRAINT `ride_ibfk_1` FOREIGN KEY (`journey_id`) REFERENCES `journey` (`journey_id`) ON DELETE CASCADE ON UPDATE CASCADE, ADD CONSTRAINT `ride_ibfk_2` FOREIGN KEY (`email`) REFERENCES `copassenger` (`email`) 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
4f5d933a36194a9fb751bc6aaa9222513b033ffc
SQL
silence-do-good/stress-test-Postgres-and-MySQL
/dump/high/day22/select0129.sql
UTF-8
177
2.6875
3
[]
no_license
SELECT timeStamp, temperature FROM ThermometerOBSERVATION o WHERE timestamp>'2017-11-21T01:29:00Z' AND timestamp<'2017-11-22T01:29:00Z' AND temperature>=1 AND temperature<=95
true
5227d0fcf98c4e4f057be5379722bfaccc5025e7
SQL
st34m3r/erp
/tables/can_socpeople.sql
UTF-8
2,163
2.8125
3
[]
no_license
-- ============================================================================ -- Copyright (C) 2001-2004 Rodolphe Quiedeville <[email protected]> -- Copyright (C) 2008 Laurent Destailleur <[email protected]> -- Copyright (C) 2005-2009 Regis Houssin <[email protected]> -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- $Id$ -- ============================================================================ create table can_socpeople ( rowid integer AUTO_INCREMENT PRIMARY KEY, datec datetime, tms timestamp, fk_soc integer, -- lien vers la societe entity integer DEFAULT 1 NOT NULL, -- multi company id civilite varchar(6), name varchar(50), firstname varchar(50), address varchar(255), cp varchar(25), ville varchar(255), fk_departement integer, fk_pays integer DEFAULT 0, birthday date, poste varchar(80), phone varchar(30), phone_perso varchar(30), phone_mobile varchar(30), fax varchar(30), email varchar(255), jabberid varchar(255), priv smallint NOT NULL DEFAULT 0, fk_user_creat integer DEFAULT 0, -- user qui a creel'enregistrement fk_user_modif integer, note text, default_lang varchar(6), import_key varchar(14) )Engine=innodb; -- -- List of codes for the field entity -- -- 1 : first company contact -- 2 : second company contact -- 3 : etc... --
true
818e0494b7fcf058b6bbca19c10a483575d934bd
SQL
MarcosViniciusPinho/localidadeAPI
/src/main/resources/db/migration/V03__criando_tabela_municipio.sql
UTF-8
284
3.203125
3
[]
no_license
CREATE TABLE municipio( id INTEGER NOT NULL, id_estado INTEGER NOT NULL, nome VARCHAR(50) NOT NULL ); ALTER TABLE municipio ADD CONSTRAINT pk_id_municipio PRIMARY KEY (id); ALTER TABLE municipio ADD CONSTRAINT fk_muni_id_estado FOREIGN KEY (id_estado) REFERENCES estado (id);
true
5b52680951eda29d81cd78e1dd17d6b532e24a6a
SQL
jonesyeh/SBP_TUTORIAL
/Export_Result/Task9/06.tb_file_ext_set.sql
BIG5
587
2.625
3
[]
no_license
--eyk-- select 'e' e,* from comm.tb_file_ext_set where exec_file_seq=36091 --yk-- delete from comm.tb_file_ext_set where exec_file_seq=36091 INSERT INTO comm.tb_file_ext_set with(tablock) (exec_file_seq,empty_file_check_flag,fail_file_proc_key,is_check,creator,create_time,modifier,last_update_time) select 36091,0,'018|1',1,'ADMIN',cast('2019-06-10 22:51:02.6983367' as datetime2),'ADMIN',cast('2019-07-27 14:39:15.8014937' as datetime2) --yk-- select '' ,* from comm.tb_file_ext_set where exec_file_seq=36091
true
6d236073b063c43838b2ccb56916f78bc4d39a1f
SQL
betancourtl/db-schemas
/pbgear/items/create.sql
UTF-8
553
2.71875
3
[]
no_license
USE pbgear_db; SET @user_id = 11; SET @model = 'M3'; SET @title = 'LNIB Dye M3'; SET @sold = FALSE; SET @description = 'Dye M3 Like New!'; SET @year = 2005; SET @price = 1200.00; SET @brand_id = 1; SET @condition_id = 1; SET @country_id = 1; SET @state_id = 1; SET @category_id = 1; INSERT INTO items (model, title, sold, description, year, price, category_id, brand_id, user_id, condition_id, country_id, state_id) VALUES (@model, @title, @sold, @description, @year, @year, @category_id, @brand_id, @user_id, @condition_id, @condition_id, @state_id)
true
7b84b4f1a755b02e3fd2d23b513987b11ef26748
SQL
silence-do-good/stress-test-Postgres-and-MySQL
/dump/low/day23/select1925.sql
UTF-8
272
2.921875
3
[]
no_license
SELECT sen.name FROM SENSOR sen, SENSOR_TYPE st, COVERAGE_INFRASTRUCTURE ci WHERE sen.SENSOR_TYPE_ID=st.id AND st.name='WiFiAP' AND sen.id=ci.SENSOR_ID AND ci.INFRASTRUCTURE_ID=ANY(array['2100_5','4100_7','5074','3048','1427','4100_4','5100_1','4038','5100_5','6064'])
true
d5c622cd2c03fbabbfa8c2df70a799724f03ab87
SQL
Q-Adorable/TWS
/course-center/backend/src/main/resources/db/migration/V12__create_section_video_address_table.sql
UTF-8
263
2.65625
3
[]
no_license
CREATE TABLE `sectionVideoAddress` ( `id` int(11) NOT NULL AUTO_INCREMENT, `taskId` int(11), `sectionId` int(11), `videoAddress` VARCHAR(1000), `createTime` TIMESTAMP default current_timestamp, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
true
b72baa726d778bbebc31c9ebb92eaa40b67baac2
SQL
tflynn615/Pewlett-Hackard-Analysis
/Queries/queries.sql
UTF-8
629
3.8125
4
[]
no_license
SELECT first_name, last_name FROM employees WHERE birth_date BETWEEN '1952-01-01' AND '1955-12-31'; SELECT first_name, last_name FROM employees WHERE birth_date BETWEEN '1954-01-01' AND '1954-12-31'; -- Retirement eligibility SELECT count(first_name) FROM employees WHERE (birth_date BETWEEN '1952-01-01' AND '1955-12-31') AND (hire_date BETWEEN '1985-01-01' AND '1988-12-31'); -- Create a retirement info table Select first_name, last_name INTO retirement_info FROM employees WHERE (birth_date BETWEEN '1952-01-01' AND '1955-12-31') AND (hire_date BETWEEN '1985-01-01' AND '1988-12-31'); SELECT * FROM retirement_info;
true
eac4d30097667bc57e75ededdbd8f6ac9f1b9fa4
SQL
eformanes/bamazon
/bamazon.sql
UTF-8
836
3.109375
3
[]
no_license
DROP DATABASE IF EXISTS bamazonDB; CREATE DATABASE bamazonDB; USE bamazonDB; CREATE TABLE products( item_id INT NOT NULL AUTO_INCREMENT, product_name VARCHAR(100) NOT NULL, department_name VARCHAR(45) NOT NULL, price INT, stock_quantity INT, PRIMARY KEY (item_id) ); Insert into products (product_name, department_name, price, stock_quantity) Values ("Nintendo Switch", "video games", 300, 20), ("SNES Classic", "video games", 80, 2), ("Nintendo Wii U", "video games", 100, 50), ("NES Classic", "video games", 150, 10), ("PS4", "video games", 200, 20), ("XBox One", "video games", 200, 20), ("Water", "food", 1, 100), ("Cabbage", "food", 1, 100), ("Carrot", "food", 1, 100), ("Banana", "food", 1, 100), ("iPhone", "electronics", 800, 200), ("Android", "electronics", 800, 200), ("MacBook Pro", "electronics", 3000, 100)
true
d62e9f525724df7e37ebeb1f0e647b9451e69aca
SQL
dyancl1024/CodeGenerator
/temp/tempfolder/RH/Training/Add/Temp_BasicData_ClassAdd.sql
UTF-8
1,136
2.78125
3
[]
no_license
/* RH_Temp_BasicData_Class - 新增脚本 */ DROP PROCEDURE IF EXISTS sp_SJ_RH_Temp_BasicData_Class_Add; CREATE PROCEDURE sp_SJ_RH_Temp_BasicData_Class_Add ( IN i_SubTID int, IN i_ClassID int, IN i_YX_HW int, IN i_TJ_HW int, IN i_StudyNum int, IN i_FinishedNum int, IN i_UserNum int, IN i_ClassRate decimal(7,3), IN i_HG_HW int, IN i_No_Num int, OUT o_Result int ) BEGIN INSERT INTO RH_Temp_BasicData_Class ( SubTID, ClassID, YX_HW, TJ_HW, StudyNum, FinishedNum, UserNum, ClassRate, HG_HW, No_Num ) VALUES ( i_SubTID, -- int (SubTID) i_ClassID, -- int (ClassID) i_YX_HW, -- int (优秀作业数量) i_TJ_HW, -- int (提交作业数量) i_StudyNum, -- int (学习人数) i_FinishedNum, -- int (合格的人数) i_UserNum, -- int (班级人数) i_ClassRate, -- decimal(7,3) (班级合格率) i_HG_HW, -- int (合格作业数量(审批状态为合格和优秀)) i_No_Num -- int (未审批作业数) ); SELECT @@IDENTITY INTO o_Result; END;
true
a954f626cd40e18ac748cc04e113a186c5254060
SQL
alexfield55/cs3550
/Mod9/assignment_8_help.sql
UTF-8
1,433
4.0625
4
[]
no_license
select * from Products where Discontinued = 1 select * from Products select * from Orders -- order details for discontinued product 17 select [Order Details].ProductID, [Order Details].OrderID, Products.Discontinued, [Order Details].* from [Order Details] inner join Products on Products.ProductID = [Order Details].ProductID where products.ProductID = 17 -- more details for discontinued product 17 select distinct [Order Details].ProductID, Orders.OrderID, Products.Discontinued, [Order Details].* from [Order Details] inner join Products on Products.ProductID = [Order Details].ProductID inner join Orders on Orders.OrderID = [Order Details].OrderID where products.ProductID = 17 -- all the orders where product id 17 is part of the order select OrderID, count(*) from [Order Details] where OrderID in (select OrderID from [Order Details] where [Order Details].ProductID = 17) and 1 = (select count(*) from [Order Details] where OrderID in (select OrderID from [Order Details] where [Order Details].ProductID = 17) group by OrderID) group by OrderID -- the orders where only product id 17 (discontinued) is part of the order select OrderID, count(*) from [Order Details] where OrderID in (select OrderID from [Order Details] where [Order Details].ProductID = 17) group by OrderID having count(orderid) = 1 select * from [Order Details] where OrderID = 10279 select * from [Order Details] where OrderID = 10265
true
be38f12793b13d08cce87f74a10b2b9c9a873646
SQL
seraf7/BDA
/tema06/ejercicio-practico-05/s-01-crea-tablespaces.sql
UTF-8
1,522
3.234375
3
[]
no_license
-- @Autor: Humberto Serafín Castillo López -- @Fecha: 26/07/2021 -- @Descripción: Creación de tablespaces con distintas configuraciones --Conexión como sys CONNECT sys/system2 AS sysdba --Creación de un tablespace de tamaño fijo, manejo de extensiones local y --tamaño automático, administración de segmentos automática CREATE TABLESPACE store_tbs1 DATAFILE '/u01/app/oracle/oradata/SCLBDA2/store_tbs01.dbf' SIZE 20M EXTENT MANAGEMENT LOCAL AUTOALLOCATE SEGMENT SPACE MANAGEMENT AUTO; --Tablespace con múltiples data files de tamaño fijo CREATE TABLESPACE store_tbs_multiple DATAFILE '/u01/app/oracle/oradata/SCLBDA2/store_tbs_multiple_01.dbf' SIZE 10M, '/u02/app/oracle/oradata/SCLBDA2/store_tbs_multiple_02.dbf' SIZE 10M, '/u03/app/oracle/oradata/SCLBDA2/store_tbs_multiple_03.dbf' SIZE 10M EXTENT MANAGEMENT LOCAL AUTOALLOCATE SEGMENT SPACE MANAGEMENT AUTO; --Tablespace personalizado, un data file que se va a sobreescribir si -- existe, sin generar datos de REDO, crecimiento dinámico, con extensiones de -- tamaño fijo y administración automática de los segmentos CREATE TABLESPACE store_tbs_custom DATAFILE '/u01/app/oracle/oradata/SCLBDA2/store_tbs_custom_01.dbf' SIZE 10M REUSE AUTOEXTEND ON NEXT 1M MAXSIZE 30M NOLOGGING BLOCKSIZE 8K OFFLINE EXTENT MANAGEMENT LOCAL UNIFORM SIZE 64K SEGMENT SPACE MANAGEMENT AUTO; --Usuario con tablespace por default específico y cuota ilimitada CREATE USER store_user IDENTIFIED BY store_user QUOTA UNLIMITED ON store_tbs1 DEFAULT TABLESPACE store_tbs1;
true
305bf758d67400bfee972d05266e36147249d79c
SQL
0wen26/pl-sql
/T1-avanzado/ejercicio2.sql
UTF-8
396
2.6875
3
[]
no_license
create or replace PROCEDURE UPD_JOB ( p_jobId jobs.job_id%type, p_job_title jobs.job_title%type ) IS begin update jobs set job_title=p_job_title where job_id = p_jobId; if SQL%NOTFOUND THEN RAISE_APPLICATION_ERROR(-20202,'error'); end if; end; BEGIN UPD_JOB('IT_DBA','Data Administrator'); end; BEGIN UPD_JOB('IT_WEB','Master'); end; select * from jobs;
true
5bf792eafc85e594f73289dcdf6b207032b1703f
SQL
rhpicaza/toba_apunam
/apunam/metadatos/componentes/toba_datos_tabla/dump_1000725.sql
UTF-8
7,234
2.671875
3
[]
no_license
------------------------------------------------------------ --[1000725]-- proveedores ------------------------------------------------------------ ------------------------------------------------------------ -- apex_objeto ------------------------------------------------------------ --- INICIO Grupo de desarrollo 1 INSERT INTO apex_objeto (proyecto, objeto, anterior, identificador, reflexivo, clase_proyecto, clase, punto_montaje, subclase, subclase_archivo, objeto_categoria_proyecto, objeto_categoria, nombre, titulo, colapsable, descripcion, fuente_datos_proyecto, fuente_datos, solicitud_registrar, solicitud_obj_obs_tipo, solicitud_obj_observacion, parametro_a, parametro_b, parametro_c, parametro_d, parametro_e, parametro_f, usuario, creacion, posicion_botonera) VALUES ( 'apunam', --proyecto '1000725', --objeto NULL, --anterior NULL, --identificador NULL, --reflexivo 'toba', --clase_proyecto 'toba_datos_tabla', --clase '1000004', --punto_montaje 'dt_proveedores', --subclase '/datos/dt_proveedores.php', --subclase_archivo NULL, --objeto_categoria_proyecto NULL, --objeto_categoria 'proveedores', --nombre NULL, --titulo NULL, --colapsable NULL, --descripcion 'apunam', --fuente_datos_proyecto 'apunam', --fuente_datos NULL, --solicitud_registrar NULL, --solicitud_obj_obs_tipo NULL, --solicitud_obj_observacion NULL, --parametro_a NULL, --parametro_b NULL, --parametro_c NULL, --parametro_d NULL, --parametro_e NULL, --parametro_f NULL, --usuario '2014-03-14 11:09:39', --creacion NULL --posicion_botonera ); --- FIN Grupo de desarrollo 1 ------------------------------------------------------------ -- apex_objeto_db_registros ------------------------------------------------------------ INSERT INTO apex_objeto_db_registros (objeto_proyecto, objeto, max_registros, min_registros, punto_montaje, ap, ap_clase, ap_archivo, tabla, tabla_ext, alias, modificar_claves, fuente_datos_proyecto, fuente_datos, permite_actualizacion_automatica, esquema, esquema_ext) VALUES ( 'apunam', --objeto_proyecto '1000725', --objeto NULL, --max_registros NULL, --min_registros NULL, --punto_montaje '1', --ap NULL, --ap_clase NULL, --ap_archivo 'proveedores', --tabla NULL, --tabla_ext NULL, --alias NULL, --modificar_claves 'apunam', --fuente_datos_proyecto 'apunam', --fuente_datos '1', --permite_actualizacion_automatica NULL, --esquema NULL --esquema_ext ); ------------------------------------------------------------ -- apex_objeto_db_registros_col ------------------------------------------------------------ --- INICIO Grupo de desarrollo 1 INSERT INTO apex_objeto_db_registros_col (objeto_proyecto, objeto, col_id, columna, tipo, pk, secuencia, largo, no_nulo, no_nulo_db, externa, tabla) VALUES ( 'apunam', --objeto_proyecto '1000725', --objeto '1000757', --col_id 'id', --columna 'E', --tipo '1', --pk 'proveedor_id_seq', --secuencia NULL, --largo NULL, --no_nulo NULL, --no_nulo_db NULL, --externa NULL --tabla ); INSERT INTO apex_objeto_db_registros_col (objeto_proyecto, objeto, col_id, columna, tipo, pk, secuencia, largo, no_nulo, no_nulo_db, externa, tabla) VALUES ( 'apunam', --objeto_proyecto '1000725', --objeto '1000758', --col_id 'codigo', --columna 'E', --tipo NULL, --pk NULL, --secuencia NULL, --largo NULL, --no_nulo NULL, --no_nulo_db NULL, --externa NULL --tabla ); INSERT INTO apex_objeto_db_registros_col (objeto_proyecto, objeto, col_id, columna, tipo, pk, secuencia, largo, no_nulo, no_nulo_db, externa, tabla) VALUES ( 'apunam', --objeto_proyecto '1000725', --objeto '1000759', --col_id 'razon_social', --columna 'C', --tipo NULL, --pk NULL, --secuencia NULL, --largo NULL, --no_nulo NULL, --no_nulo_db NULL, --externa NULL --tabla ); INSERT INTO apex_objeto_db_registros_col (objeto_proyecto, objeto, col_id, columna, tipo, pk, secuencia, largo, no_nulo, no_nulo_db, externa, tabla) VALUES ( 'apunam', --objeto_proyecto '1000725', --objeto '1000760', --col_id 'domicilio', --columna 'C', --tipo NULL, --pk NULL, --secuencia NULL, --largo NULL, --no_nulo NULL, --no_nulo_db NULL, --externa NULL --tabla ); INSERT INTO apex_objeto_db_registros_col (objeto_proyecto, objeto, col_id, columna, tipo, pk, secuencia, largo, no_nulo, no_nulo_db, externa, tabla) VALUES ( 'apunam', --objeto_proyecto '1000725', --objeto '1000761', --col_id 'localidad', --columna 'E', --tipo NULL, --pk NULL, --secuencia NULL, --largo NULL, --no_nulo NULL, --no_nulo_db NULL, --externa NULL --tabla ); INSERT INTO apex_objeto_db_registros_col (objeto_proyecto, objeto, col_id, columna, tipo, pk, secuencia, largo, no_nulo, no_nulo_db, externa, tabla) VALUES ( 'apunam', --objeto_proyecto '1000725', --objeto '1000762', --col_id 'provincia', --columna 'E', --tipo NULL, --pk NULL, --secuencia NULL, --largo NULL, --no_nulo NULL, --no_nulo_db NULL, --externa NULL --tabla ); INSERT INTO apex_objeto_db_registros_col (objeto_proyecto, objeto, col_id, columna, tipo, pk, secuencia, largo, no_nulo, no_nulo_db, externa, tabla) VALUES ( 'apunam', --objeto_proyecto '1000725', --objeto '1000763', --col_id 'tel_num', --columna 'E', --tipo NULL, --pk NULL, --secuencia NULL, --largo NULL, --no_nulo NULL, --no_nulo_db NULL, --externa NULL --tabla ); INSERT INTO apex_objeto_db_registros_col (objeto_proyecto, objeto, col_id, columna, tipo, pk, secuencia, largo, no_nulo, no_nulo_db, externa, tabla) VALUES ( 'apunam', --objeto_proyecto '1000725', --objeto '1000764', --col_id 'tel_area', --columna 'E', --tipo NULL, --pk NULL, --secuencia NULL, --largo NULL, --no_nulo NULL, --no_nulo_db NULL, --externa NULL --tabla ); INSERT INTO apex_objeto_db_registros_col (objeto_proyecto, objeto, col_id, columna, tipo, pk, secuencia, largo, no_nulo, no_nulo_db, externa, tabla) VALUES ( 'apunam', --objeto_proyecto '1000725', --objeto '1000765', --col_id 'cel_num', --columna 'E', --tipo NULL, --pk NULL, --secuencia NULL, --largo NULL, --no_nulo NULL, --no_nulo_db NULL, --externa NULL --tabla ); INSERT INTO apex_objeto_db_registros_col (objeto_proyecto, objeto, col_id, columna, tipo, pk, secuencia, largo, no_nulo, no_nulo_db, externa, tabla) VALUES ( 'apunam', --objeto_proyecto '1000725', --objeto '1000766', --col_id 'cel_area', --columna 'E', --tipo NULL, --pk NULL, --secuencia NULL, --largo NULL, --no_nulo NULL, --no_nulo_db NULL, --externa NULL --tabla ); INSERT INTO apex_objeto_db_registros_col (objeto_proyecto, objeto, col_id, columna, tipo, pk, secuencia, largo, no_nulo, no_nulo_db, externa, tabla) VALUES ( 'apunam', --objeto_proyecto '1000725', --objeto '1000767', --col_id 'cuit', --columna 'E', --tipo NULL, --pk NULL, --secuencia NULL, --largo NULL, --no_nulo NULL, --no_nulo_db NULL, --externa NULL --tabla ); INSERT INTO apex_objeto_db_registros_col (objeto_proyecto, objeto, col_id, columna, tipo, pk, secuencia, largo, no_nulo, no_nulo_db, externa, tabla) VALUES ( 'apunam', --objeto_proyecto '1000725', --objeto '1000768', --col_id 'estado', --columna 'L', --tipo NULL, --pk NULL, --secuencia NULL, --largo NULL, --no_nulo NULL, --no_nulo_db NULL, --externa NULL --tabla ); --- FIN Grupo de desarrollo 1
true
036bfc500b929a3a8e151ae6cfe029059deb8fcc
SQL
missaouib/repo
/tadaay/data/2018_02_05/updates_2018_02_03.sql
UTF-8
1,032
3.140625
3
[]
no_license
ALTER TABLE `app_users` DROP COLUMN `qualification`, DROP COLUMN `branch`, DROP COLUMN `passoutYr`, DROP COLUMN `percentage`, DROP COLUMN `compName`, DROP COLUMN `designation`, DROP COLUMN `yrsofexp`, DROP COLUMN `skills`, DROP COLUMN `contact_person`, DROP COLUMN `contact_email`, DROP COLUMN `contact_landline`, DROP COLUMN `contact_mobile`; ALTER TABLE `app_users_experience_details` DROP COLUMN `key_skill`, DROP COLUMN `years`; ALTER TABLE `app_users_experience_details` CHANGE COLUMN `partner_id` `appuserId` INT(11) NOT NULL; CREATE TABLE `app_users_skillset_details` ( `id` int(11) NOT NULL, `appuserId` int(11) NOT NULL, `key_skill` varchar(45) DEFAULT NULL, `years` int(4) DEFAULT NULL, `last_insrt_upd_ts` datetime DEFAULT NULL, `last_insrt_upd_usr_id` int(11) DEFAULT NULL, PRIMARY KEY (`id`), KEY `appuserDetails_idx` (`appuserId`), CONSTRAINT `appuserDetails` FOREIGN KEY (`appuserId`) REFERENCES `app_users` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
true
f4256a8cb240129498a02b4f43ce72ee9ff83853
SQL
anyeluperez/-cakephp_adsi_ajpb
/cakephp_adsi_ajpb.sql
UTF-8
6,868
2.90625
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 4.9.1 -- https://www.phpmyadmin.net/ -- -- Servidor: 127.0.0.1 -- Tiempo de generación: 25-09-2020 a las 01:04:55 -- Versión del servidor: 10.4.8-MariaDB -- Versión de PHP: 7.3.11 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET AUTOCOMMIT = 0; START TRANSACTION; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8mb4 */; -- -- Base de datos: `cakephp_adsi_ajpb` -- -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `articles` -- CREATE TABLE `articles` ( `id` int(11) NOT NULL, `user_id` int(11) NOT NULL, `title` varchar(255) NOT NULL, `slug` varchar(191) NOT NULL, `body` text DEFAULT NULL, `published` tinyint(1) DEFAULT 0, `created` datetime DEFAULT NULL, `modified` datetime DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Volcado de datos para la tabla `articles` -- INSERT INTO `articles` (`id`, `user_id`, `title`, `slug`, `body`, `published`, `created`, `modified`) VALUES (1, 1, 'First Post', 'first-post', 'This is the first post.', 1, '2020-09-24 00:55:36', '2020-09-24 00:55:36'), (4, 1, 'Llantas MX MICHELIN ', 'MICHELIN-STARCROSS-5-MEDIUM', 'MICHELIN STARCROSS 5 MEDIUM.\r\nLas llantas de alto desempeño para motocross en terrenos mixtos y duros.\r\nTenemos 20 llantas para para rines delantero de 21 pulg.\r\nTenemos 20 llantas para para rines delantero de 17 pulg.\r\nprecio por unidad de llantas delanteras \"$98.000\" pesos\r\nprecio por unidad de llantas delanteras \"$90.000\" pesos', 0, '2020-09-24 21:29:14', '2020-09-24 21:31:53'), (5, 1, 'Llantas SuperMoto', 'Llantas-SuperMoto', 'POWER SUPERMOTO\r\n\r\nLa línea para supermotos número 1 del mundo, creada con los mejores pilotos de la categoría para un desempeño, maniobrabilidad y adherencia sobresalientes.\r\nNos quedan 10 en bodega y estan en oferta al precio por unidad es de $120.000 pesos', 0, '2020-09-24 21:35:35', '2020-09-24 22:28:01'), (6, 1, 'Llantas Automóvil', 'Llantas-Automovil', 'Obtén el mayor beneficio de tu auto deportivo con la llanta de competencia Michelin Pilot Sport Cup 2, desarrollada en conjunto con los fabricantes de los vehículos: Porsche 918 Spyder, Porsche 911 GT3, Ferrari 458 Speciale y AMG SLS Coupe Black Series.\r\nPrecio 250.000', 0, '2020-09-24 22:11:05', '2020-09-24 22:11:05'), (7, 1, 'MICHELIN PILOT SPORT 4', 'MICHELIN-PILOT-SPORT-4', 'Frena hasta 2m antes en piso mojado y hasta 1m. antes en piso seco*.\r\n\r\nPrueba sobre piso mojado* [%]\r\nFrenado en piso mojado\r\n- Frenos ABS\r\n- Intervalo de velocidad en la prueba: 80 a 20 km/h\r\n- Medición obtenida en base a equipos con tecnología GPS (V-box)\r\n- Pruebas realizadas en superficies con coeficiente de adherencia alto y bajo (dentro del rango permitido por el reglamento ECE R117)\r\nVelocidad de los competidores cuando la llanta MICHELIN Pilot Sport 4 se detuvo: 20 km/h.\r\nprecio 300.000', 0, '2020-09-24 22:13:53', '2020-09-24 22:13:53'); -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `articles_tags` -- CREATE TABLE `articles_tags` ( `article_id` int(11) NOT NULL, `tag_id` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci; -- -- Volcado de datos para la tabla `articles_tags` -- INSERT INTO `articles_tags` (`article_id`, `tag_id`) VALUES (4, 4), (5, 3), (6, 5), (7, 2), (7, 6); -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `tags` -- CREATE TABLE `tags` ( `id` int(11) NOT NULL, `title` varchar(191) DEFAULT NULL, `created` datetime DEFAULT NULL, `modified` datetime DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Volcado de datos para la tabla `tags` -- INSERT INTO `tags` (`id`, `title`, `created`, `modified`) VALUES (2, 'Llantas michelin buen precio', '2020-09-24 22:24:45', '2020-09-24 22:24:45'), (3, 'llantas para carreteras de pavimento ', '2020-09-24 22:25:26', '2020-09-24 22:26:41'), (4, 'llantas de motocroos', '2020-09-24 22:27:07', '2020-09-24 22:27:07'), (5, 'Porsche 918 Spyder, Porsche 911 GT3', '2020-09-24 22:30:07', '2020-09-24 22:30:07'), (6, 'llantas con mejor frenado ', '2020-09-24 22:31:08', '2020-09-24 22:31:08'); -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `users` -- CREATE TABLE `users` ( `id` int(11) NOT NULL, `email` varchar(255) COLLATE utf8_spanish_ci NOT NULL, `password` varchar(255) COLLATE utf8_spanish_ci NOT NULL, `created` datetime DEFAULT NULL, `modified` datetime DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci; -- -- Volcado de datos para la tabla `users` -- INSERT INTO `users` (`id`, `email`, `password`, `created`, `modified`) VALUES (1, '[email protected]', '$2y$10$yE8uFBXTf4KTZjh0IxfhOOJBnmlJYszGmYoTzpqH8A9LNqTATK9.6', '2020-09-24 00:55:35', '2020-09-24 19:32:03'), (2, '[email protected]', '$2y$10$cOsTNFgAHxa.FUBHsSJkquh9SkB0m71UHm3nUs6joB3mXSJKYJ1Am', '2020-09-24 19:25:21', '2020-09-24 19:25:21'), (3, '[email protected]', '$2y$10$qs4QvMGI.RKFnirJa8LN6.I4aZzB6jJH8m3ZKYmBkaf3Mpo2TqMuS', '2020-09-24 20:29:10', '2020-09-24 20:29:10'), (4, '[email protected]', '12345678', NULL, NULL); -- -- Índices para tablas volcadas -- -- -- Indices de la tabla `articles` -- ALTER TABLE `articles` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `slug` (`slug`), ADD KEY `user_key` (`user_id`); -- -- Indices de la tabla `articles_tags` -- ALTER TABLE `articles_tags` ADD PRIMARY KEY (`article_id`,`tag_id`), ADD KEY `tag_key` (`tag_id`); -- -- Indices de la tabla `tags` -- ALTER TABLE `tags` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `title` (`title`); -- -- Indices de la tabla `users` -- ALTER TABLE `users` ADD PRIMARY KEY (`id`); -- -- AUTO_INCREMENT de las tablas volcadas -- -- -- AUTO_INCREMENT de la tabla `articles` -- ALTER TABLE `articles` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8; -- -- AUTO_INCREMENT de la tabla `tags` -- ALTER TABLE `tags` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7; -- -- AUTO_INCREMENT de la tabla `users` -- ALTER TABLE `users` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5; -- -- Restricciones para tablas volcadas -- -- -- Filtros para la tabla `articles` -- ALTER TABLE `articles` ADD CONSTRAINT `user_key` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`); -- -- Filtros para la tabla `articles_tags` -- ALTER TABLE `articles_tags` ADD CONSTRAINT `article_key` FOREIGN KEY (`article_id`) REFERENCES `articles` (`id`), ADD CONSTRAINT `tag_key` FOREIGN KEY (`tag_id`) REFERENCES `tags` (`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
826ad4f42452ff7307fe701ab74be5d2c302a635
SQL
mcpawali/akka-http-rest
/core/src/main/resources/Scripts.sql
UTF-8
628
2.8125
3
[]
no_license
CREATE TABLE employee."User" ( "UserId" bigserial NOT NULL, "UserName" character varying(50) NOT NULL, "Email" character varying(50) NOT NULL, "Password" character varying(50) NOT NULL, "IsDeleted" boolean NOT NULL, "EmployeeId" bigint NOT NULL, CONSTRAINT "User_pkey" PRIMARY KEY ("UserId") ); CREATE TABLE employee."Employee" ( "EmployeeId" bigserial NOT NULL, "FirstName" character varying(50) NOT NULL, "LastName" character varying(50) NOT NULL, "DOB" date NOT NULL, "IsDeleted" boolean NOT NULL, "Gender" character varying(50) NOT NULL, CONSTRAINT "Employee_pkey" PRIMARY KEY ("EmployeeId") );
true
73fae19aa209e2cde2c7bd10a4f761c8b096e247
SQL
eanyanwu/mirthful-rcis
/mirthful_rcis/sql/bootstrap_db.sql
UTF-8
1,486
2.9375
3
[]
no_license
-- Setup any records that need to be present for the application to function PRAGMA foreign_keys = ON; INSERT INTO roles (role, description, permissions) VALUES ('student', 'A college student', 0); INSERT INTO roles (role, description, permissions) VALUES ('res_life_staff', 'Member of Residence Life Staff', 3); INSERT INTO roles (role, description, permissions) VALUES ('admin', 'Residence Life Director', 7); -- Records for testing -- Users INSERT INTO users VALUES ('32151344-dfa6-4e70-89b1-140d756c0079', 'test_student', 'John', 'Riley', 'test', 'test_student', 'student'); INSERT INTO users VALUES ('fcd02d33-ca85-4246-ab66-25cb67188360', 'test_staff', 'Libbie', 'Wamble', 'test', 'test_staff', 'res_life_staff'); INSERT INTO users VALUES ('6a134499-3c0a-4f24-93c6-ac936508a0ff', 'test_admin', 'Clayton', 'Bernos', 'test', 'test_admin', 'admin'); -- Rooms INSERT INTO rooms VALUES ('Nyland', '210'); INSERT INTO rooms VALUES ('Fulton', '211'); INSERT INTO rooms VALUES ('Fulton', '101'); -- Walkthrough Items INSERT INTO room_areas VALUES ('Door(s)/Doorframe/Locks', 'Anything damages around the room entrance'); INSERT INTO room_areas VALUES('Carpet/Floor', 'Stains, scratchs, and other imperfections'); INSERT INTO room_areas VALUES('Walls', 'Discollorations, nail holes, paint chips ... '); INSERT INTO room_areas VALUES('Desks/Chair', 'Any missing furniture, broken drawers etc...');
true
b8acd2e41984631cc38eb888ce8ec189359d418c
SQL
DenysPyshniuk/BootcampX
/4_queries/totalAssignmentsAndDuration.sql
UTF-8
288
3.4375
3
[]
no_license
SELECT day, count(assignments) as number_of_assignments, sum(assignments.duration) as duration FROM assignments GROUP BY assignments.day ORDER BY assignments.day; --SELECT day, count(*) as number_of_assignments, sum(duration) as duration --FROM assignments --GROUP BY day --ORDER BY day;
true
595c7c53873ffa008a8416cfb42d477a1ee76ef6
SQL
chenglezheng/lc
/lc-common/src/main/resources/数据字典/数据字典.sql
UTF-8
2,330
3.640625
4
[]
no_license
DROP TABLE IF EXISTS `USER`; --用户表 CREATE TABLE `USER` ( `USER_ID` bigint(16) unsigned zerofill NOT NULL AUTO_INCREMENT, `USER_NAME` varchar(20) DEFAULT NULL, `USER_PWD` varchar(50) NOT NULL, `USER_PHONE` decimal(11,0) DEFAULT NULL, `USER_QQ` decimal(20,0) DEFAULT NULL, `USER_WECHAT` varchar(50) DEFAULT NULL, `USER_EMAIL` varchar(50) DEFAULT NULL, `USER_SEX` int(11) DEFAULT NULL, `USER_AGE` decimal(3,0) DEFAULT NULL, `USER_ADDRESS` varchar(200) DEFAULT NULL, `USER_ROLE` int(11) NOT NULL, `USER_LEFT_MONEY` decimal(10,2) DEFAULT NULL, `USER_REAL_NAME` varchar(20) DEFAULT NULL, PRIMARY KEY (`USER_ID`), KEY `用户ID` (`USER_ID`) USING HASH ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8; DROP TABLE IF EXISTS `EMPLOYEES`; --员工表 CREATE TABLE `EMPLOYEES` ( `EMPLO_ID` decimal(7,0) NOT NULL, `NAME` varchar(20) DEFAULT NULL, `SEX` char(1) DEFAULT NULL, `AGE` decimal(2,0) DEFAULT NULL, `SENIORITY` decimal(2,0) DEFAULT NULL, `SALARY` decimal(8,2) DEFAULT NULL, `PHONE` varchar(11) DEFAULT NULL, `EMAIL` varchar(50) DEFAULT NULL, `ADDRESS` varchar(80) DEFAULT NULL, `ID_CARD` varchar(25) DEFAULT NULL, `QQ` decimal(12,0) DEFAULT NULL, `WECHAT` varchar(50) DEFAULT NULL, `BIRTHDAY` date DEFAULT NULL, `ENTRY_TIME` date DEFAULT NULL, `QUIT_TIME` date DEFAULT NULL, `DEPARTMENT_ID` decimal(4,0) DEFAULT NULL, `POSITION_ID` decimal(4,0) DEFAULT NULL, `BOSS_ID` decimal(7,0) DEFAULT NULL, PRIMARY KEY (`EMPLO_ID`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; DROP TABLE IF EXISTS `POSITION`; --职位表 CREATE TABLE `POSITION` ( `POSITION_ID` decimal(5,0) NOT NULL, `POSITION_NAME` varchar(10) DEFAULT NULL, PRIMARY KEY (`POSITION_ID`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; DROP TABLE IF EXISTS `DEPARTMENT`; --部门表 CREATE TABLE `DEPARTMENT` ( `DEPARTMENT_ID` decimal(4,0) NOT NULL, `DEPARTMENT_NAME` varchar(6) DEFAULT NULL, PRIMARY KEY (`DEPARTMENT_ID`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; DROP TABLE IF EXISTS `MENU`; --菜单表 CREATE TABLE `MENU` ( `MENU_NAME` varchar(50) NOT NULL, `MENU_NUM` decimal(2,0) NOT NULL, `MENU_VALUE` varchar(20) DEFAULT NULL, `MENU_CONTENT` varchar(20) DEFAULT NULL, `IS_DISPLAY` char(1) DEFAULT NULL, PRIMARY KEY (`MENU_NAME`,`MENU_NUM`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
true
589cf97e4087a8c35ef3fab043ec26bfa50bde47
SQL
fabiomigliorini/MGdb
/SQLs/Totais Cobranca Externa.sql
UTF-8
448
3.546875
4
[]
no_license
select -- * tblcobranca.agendamento , tblpessoa.codpessoa , tblpessoa.pessoa , sum(tblcobranca.creditoacerto) as pagamento , sum(tbltitulo.debito) as valor from tblcobranca left join tbltitulo on (tbltitulo.codtitulo = tblcobranca.codtitulo) left join tblpessoa on (tblpessoa.codpessoa = tbltitulo.codpessoa) group by tblcobranca.agendamento , tblpessoa.codpessoa , tblpessoa.pessoa --limit 100
true
d81c91103d37694aa699a33435c4d596e3ea2fb9
SQL
darrell-ulm/SQL-Queries
/transit snapshot.sql
UTF-8
496
3.765625
4
[ "LicenseRef-scancode-warranty-disclaimer" ]
no_license
-- In transit report -- -- Based on query from Jason Boland -- SELECT u.iii_user_group_code, l.name, COUNT(v.field_content) AS "Count" FROM sierra_view.varfield_view v JOIN sierra_view.item_view i ON v.record_id = i.id JOIN sierra_view.iii_user u ON SPLIT_PART(v.field_content, ' ', 9) = u.name JOIN sierra_view.location_myuser l ON SUBSTRING(SPLIT_PART(v.field_content, ' ', 11) FOR 3) = l.code WHERE field_content LIKE '%TRANSIT%' AND i.item_status_code = 't' GROUP BY 1,2 ORDER BY 1,2;
true
d89c3ad1a00717a080a1d9f2da53d104c07891ef
SQL
izham-azemi/involve_asia_test
/involve_asia.sql
UTF-8
2,246
3.140625
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 5.1.0 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Generation Time: May 09, 2021 at 08:41 AM -- Server version: 10.4.18-MariaDB -- PHP Version: 8.0.5 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: `involve_asia` -- -- -------------------------------------------------------- -- -- Table structure for table `book` -- CREATE TABLE `book` ( `b_id` int(11) NOT NULL, `title` varchar(20) DEFAULT NULL, `year_published` int(11) DEFAULT NULL, `author_name` varchar(20) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `book` -- INSERT INTO `book` (`b_id`, `title`, `year_published`, `author_name`) VALUES (7, 'Covid', 2021, 'Bill Gate'); -- -------------------------------------------------------- -- -- Table structure for table `book_review` -- CREATE TABLE `book_review` ( `br_id` int(11) NOT NULL, `b_id` int(11) NOT NULL, `review` varchar(20) DEFAULT NULL, `posted_by` varchar(20) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `book_review` -- INSERT INTO `book_review` (`br_id`, `b_id`, `review`, `posted_by`) VALUES (14, 7, 'Best Book', 'Izham'), (15, 7, 'Good Information', 'Razi'); -- -- Indexes for dumped tables -- -- -- Indexes for table `book` -- ALTER TABLE `book` ADD PRIMARY KEY (`b_id`); -- -- Indexes for table `book_review` -- ALTER TABLE `book_review` ADD PRIMARY KEY (`br_id`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `book` -- ALTER TABLE `book` MODIFY `b_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8; -- -- AUTO_INCREMENT for table `book_review` -- ALTER TABLE `book_review` MODIFY `br_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=17; 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
03e9585a05b6e588177ed6a9eb0d9e9da888453b
SQL
kayzcrack/projects
/p_vin/Salutation.sql
UTF-8
2,324
2.8125
3
[]
no_license
-- MySQL dump 10.13 Distrib 5.5.37, for debian-linux-gnu (x86_64) -- -- Host: localhost Database: DeltaSAVE -- ------------------------------------------------------ -- Server version 5.5.37-0ubuntu0.13.10.1 /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -- -- Table structure for table `SalutationType` -- DROP TABLE IF EXISTS `SalutationType`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `SalutationType` ( `ID` varchar(5) NOT NULL, `Name` varchar(24) NOT NULL, PRIMARY KEY (`ID`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `SalutationType` -- LOCK TABLES `SalutationType` WRITE; /*!40000 ALTER TABLE `SalutationType` DISABLE KEYS */; INSERT INTO `SalutationType` VALUES ('88','Surveyor'),('9','Igwe'),('92','Inspector'),('Alh','Alhaji'),('Amb','Ambassador'),('Dr','Dr'),('Eld','Elder'),('Eng','Engineer'),('Haj','Hajya'),('Hon','Honourable'),('Mal','Mallam'),('Miss','Miss'),('Mr','Mr'),('Mrs','Mrs'),('Ms','Madamme'),('Prof','Professor'),('Rev','Reverend'),('Sen','Senator'),('Sir','Sir'),('unk','Unknown'); /*!40000 ALTER TABLE `SalutationType` ENABLE KEYS */; UNLOCK TABLES; -- -- Dumping routines for database 'DeltaSAVE' -- /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; -- Dump completed on 2014-07-16 8:41:54
true
3915423c8ebd131acb48f67c3031cc59242b7a57
SQL
jerrenss/AWS-BuildOn-2021-Genesis
/server/migrations/001_generate_schema.sql
UTF-8
1,766
3.53125
4
[]
no_license
SET TIMEZONE = 'Asia/Singapore'; CREATE TABLE IF NOT EXISTS Users ( user_created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(), user_id SERIAL PRIMARY KEY, user_name TEXT NOT NULL, email TEXT UNIQUE NOT NULL, password_hash TEXT NOT NULL ); CREATE TABLE IF NOT EXISTS Clinics ( clinic_created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(), clinic_id SERIAL PRIMARY KEY, clinic_name TEXT NOT NULL ); CREATE TABLE IF NOT EXISTS Doctors ( doctor_id INTEGER PRIMARY KEY REFERENCES Users, clinic_id INTEGER REFERENCES Clinics, qualification TEXT NOT NULL, expertise TEXT NOT NULL, rating NUMERIC NOT NULL ); CREATE TABLE IF NOT EXISTS Patients ( patient_id INTEGER PRIMARY KEY REFERENCES Users, history TEXT ); CREATE TABLE IF NOT EXISTS Consultations ( consultation_created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(), consultation_id SERIAL PRIMARY KEY, doctor_id INTEGER REFERENCES Doctors, patient_id INTEGER REFERENCES Patients, recording_file TEXT, notes_file TEXT, timeslot TIMESTAMPTZ NOT NULL, status SMALLINT NOT NULL ); CREATE TABLE IF NOT EXISTS Deliveries ( delivery_created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(), delivery_id SERIAL PRIMARY KEY, consultation_id INTEGER REFERENCES Consultations, items JSON NOT NULL ); CREATE TABLE IF NOT EXISTS Chats ( chat_created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(), chat_id SERIAL PRIMARY KEY, doctor_id INTEGER NOT NULL REFERENCES Doctors, patient_id INTEGER NOT NULL REFERENCES Patients ); CREATE TABLE IF NOT EXISTS Messages ( message_created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(), chat_id INTEGER PRIMARY KEY REFERENCES Chats, user_id INTEGER REFERENCES Users, text_content TEXT, file_content TEXT );
true
b94f4d4160745d67cb73b296deee706052e5b611
SQL
RuanAlves/dba_scripts_SQLSERVER
/INSERIR PESSOA_COMPLEMENTOS.sql
ISO-8859-1
426
3.15625
3
[]
no_license
/** VERIFICA AS PESSOAS QUE NO POSSUI 'PESSOA_COMPLEMENTOS' */ SELECT P.CODIGO FROM PESSOA P LEFT JOIN PESSOA_COMPLEMENTOS PC ON (P.CODIGO = PC.CODPESSOA) GROUP BY P.CODIGO HAVING COUNT(PC.CODPESSOA) = 0 /** FAZ O INSERT PESSOA_COMPLEMENTO **/ INSERT INTO PESSOA_COMPLEMENTOS (ISADMCARTAOPDV, ISCONTRIBUINTE, CODPESSOA) (SELECT 0,0,CODIGO FROM PESSOA WHERE CODIGO NOT IN (SELECT CODPESSOA FROM PESSOA_COMPLEMENTOS))
true
b44222d47e5324bf0f45b45973493245fbbd89c6
SQL
ToborTheGreat/Repository01
/geo.om_user_remote_layers.sql
UTF-8
2,344
3.125
3
[]
no_license
-- -- PostgreSQL database dump -- SET statement_timeout = 0; SET client_encoding = 'UTF8'; SET standard_conforming_strings = off; SET check_function_bodies = false; SET client_min_messages = warning; SET escape_string_warning = off; SET search_path = geo, pg_catalog; ALTER TABLE ONLY geo.om_user_remote_layers DROP CONSTRAINT user_omlayer_ws_fk; ALTER TABLE ONLY geo.om_user_remote_layers DROP CONSTRAINT om_user_remote_layers_pkey; ALTER TABLE geo.om_user_remote_layers ALTER COLUMN omlayer_id DROP DEFAULT; DROP SEQUENCE geo.om_user_remote_layers_omlayer_id_seq; DROP TABLE geo.om_user_remote_layers; SET search_path = geo, pg_catalog; SET default_tablespace = p2_generaldata; SET default_with_oids = false; -- -- Name: om_user_remote_layers; Type: TABLE; Schema: geo; Owner: -; Tablespace: p2_generaldata -- CREATE TABLE om_user_remote_layers ( omlayer_id integer NOT NULL, user_id integer NOT NULL, om_layer_id integer NOT NULL, status character(1) DEFAULT 'A'::bpchar, sort_order integer DEFAULT 1 NOT NULL, ws_id integer NOT NULL ); -- -- Name: COLUMN om_user_remote_layers.status; Type: COMMENT; Schema: geo; Owner: - -- COMMENT ON COLUMN om_user_remote_layers.status IS 'A - Active, I- In active'; -- -- Name: om_user_remote_layers_omlayer_id_seq; Type: SEQUENCE; Schema: geo; Owner: - -- CREATE SEQUENCE om_user_remote_layers_omlayer_id_seq START WITH 1 INCREMENT BY 1 NO MAXVALUE NO MINVALUE CACHE 1; -- -- Name: om_user_remote_layers_omlayer_id_seq; Type: SEQUENCE OWNED BY; Schema: geo; Owner: - -- ALTER SEQUENCE om_user_remote_layers_omlayer_id_seq OWNED BY om_user_remote_layers.omlayer_id; -- -- Name: omlayer_id; Type: DEFAULT; Schema: geo; Owner: - -- ALTER TABLE om_user_remote_layers ALTER COLUMN omlayer_id SET DEFAULT nextval('om_user_remote_layers_omlayer_id_seq'::regclass); -- -- Name: om_user_remote_layers_pkey; Type: CONSTRAINT; Schema: geo; Owner: -; Tablespace: p2_generaldata -- ALTER TABLE ONLY om_user_remote_layers ADD CONSTRAINT om_user_remote_layers_pkey PRIMARY KEY (omlayer_id); -- -- Name: user_omlayer_ws_fk; Type: FK CONSTRAINT; Schema: geo; Owner: - -- ALTER TABLE ONLY om_user_remote_layers ADD CONSTRAINT user_omlayer_ws_fk FOREIGN KEY (ws_id) REFERENCES user_maps_ws(ws_id); -- -- PostgreSQL database dump complete --
true
b0cc881f65aabfc2da537fdd822eb3bdfa534396
SQL
MurrayCode/Cross-site-Scripting-against-PHP-Applications
/XSSApplication/App/phpapps/brim/framework/sql/create.mysql.brim_users.sql
UTF-8
235
2.53125
3
[]
no_license
create table brim_users ( user_id integer auto_increment not null primary key, loginname char (15) not null, password char (50), name char (50), email char (30), description text, when_created DATETIME, last_login DATETIME )
true
b83e9291eb7642856726964b292e96dfc6e07489
SQL
dimitar-v/DB-Basic
/16. Functions And Procedures - Exercise/BankDB.sql
UTF-8
1,430
4.53125
5
[ "MIT" ]
permissive
-- Part 2. Queries for Bank Database USE Bank -- Problem 9. Find Full Name CREATE PROC usp_GetHoldersFullName AS SELECT FirstName + ' ' + LastName AS [Full Name] FROM AccountHolders -- EXEC usp_GetHoldersFullName -- Problem 10. People with Balance Higher Than CREATE PROC usp_GetHoldersWithBalanceHigherThan @totalMoney DECIMAL(18,4) AS SELECT ah.FirstName, ah.LastName FROM AccountHolders AS ah INNER JOIN Accounts AS a ON ah.Id = a.AccountHolderId GROUP BY a.AccountHolderId, ah.FirstName, ah.LastName HAVING SUM(a.Balance) > @totalMoney ORDER BY ah.FirstName, ah.LastName -- EXEC usp_GetHoldersWithBalanceHigherThan 10000 -- Problem 11. Future Value Function CREATE FUNCTION ufn_CalculateFutureValue(@sum DECIMAL(18,4), @yearlyInterestRate FLOAT, @years INT) RETURNS DECIMAL(18,4) AS BEGIN RETURN @sum * POWER(1 + @yearlyInterestRate, @years) END -- SELECT dbo.ufn_CalculateFutureValue(1000, 0.1, 5) -- SELECT Balance, dbo.ufn_CalculateFutureValue(Balance, 0.1, 5) FROM Accounts -- Problem 12. Calculating Interest CREATE PROC usp_CalculateFutureValueForAccount @accountID INT, @interestReat FLOAT AS SELECT a.Id , ah.FirstName , ah.LastName , a.Balance , dbo.ufn_CalculateFutureValue(a.Balance, @interestReat, 5) AS [Balance in 5 years] FROM AccountHolders AS ah INNER JOIN Accounts AS a ON ah.Id = a.AccountHolderId WHERE a.Id = @accountID -- EXEC usp_CalculateFutureValueForAccount 1 , 0.1
true
87e0387b506fea7b3384f401d545fb709cd1d07d
SQL
naveendissanayake/vigraha
/db-setup/create_tables.sql
UTF-8
433
2.671875
3
[]
no_license
DROP TABLE IF EXISTS `voice_call`; CREATE TABLE IF NOT EXISTS `voice_call` ( `record_id` INT NOT NULL , `number_make_call` VARCHAR(11) NOT NULL , `number_receive_call` VARCHAR (11) NOT NULL , `call_start_time` VARCHAR (100) NOT NULL , `duration` VARCHAR (100) NOT NULL , `number_charged_call` VARCHAR (11) NOT NULL , `call_result` VARCHAR (50) NOT NULL , `call_type` VARCHAR (100) NOT NULL, PRIMARY KEY (record_id) ) ENGINE= InnoDB;
true
28d92caca4bd2ba044fe30b6545b1412e92d6156
SQL
nothai2009/Hospital
/PDrugCount/sql/SQLQuery1.sql
UTF-8
1,088
3.46875
3
[]
no_license
SELECT abbr, hideSelect, RTRIM(gen_name)AS gen_name,RTRIM(dform)AS dform, RTRIM(strgth)AS strgth, RTRIM(strgth_u)AS strgth_u, LTRIM(RTRIM(opd_prc))AS opd_prc, p.ed_group, ed_list, prod_type, AutoStop FROM Med_inv i LEFT JOIN PRODTYPE p WITH (NOLOCK) ON i.prod_type=p.prdTypeCode WHERE abbr +' ' + gen_name LIKE '%%' SELECT * FROM Med_inv --UPDATE Med_inv SET --abbr='', hideSelect='', gen_name='',dform='',strgth='', strgth_u='', opd_prc='', ed_group='', ed_list='', prod_type='', AutoStop='' --WHERE abbr='ABC3T2' SELECT * FROM Ward_dept select s.specCode,s.specDesc from SPEC s SELECT [id],[Des] FROM Med_inv_ed_List SELECT dform_key,dform_des FROM dbo.Dform SELECT code, abbr, hideSelect,LTRIM(RTRIM(gen_name)) AS gen_name, LTRIM(RTRIM(name)) AS name, RTRIM(dform)AS dform, RTRIM(strgth)AS strgth, RTRIM(strgth_u)AS strgth_u,ltrim(opd_prc)AS opd_prc,prdTypeDesc,[Des],ed_group,AutoStop,prdTypeCode FROM Med_inv inv LEFT JOIN[PRODTYPE] pt WITH(NOLOCK) ON inv.prod_type = pt.[prdTypeCode] LEFT JOIN [Med_inv_ed_List] ml WITH(NOLOCK) ON ml.id=inv.ed_list WHERE code ='5FUED '
true
71e11b0b63eb2a2b258f188a77a72a28400372ca
SQL
sgmsgood/query
/1026_SQL/insert_subquery.sql
UHC
1,823
4.4375
4
[]
no_license
-- insert subquery -- ܼ -- cp_emp3 Ʒ ڵ带 ߰϶ -- ȣ: 1111, : ö, μȣ: 10, : -- : emp ̺ ȣ 7566 ߰ insert into cp_emp3 (empno, ename, deptno, job, sal) values (1111, 'ö', 10, '', (select sal from EMP where empno = 7566)); --  ϴ Ǹ error -- insert into cp_emp3(empno, ename, deptno, job, sal) values (1111, 'ö', 10, '', (select sal from EMP where empno = 7566)); -- ÷ ϳ ־ ϴ ÷ ȸǸ -- ʰϴ Ƿ error insert into cp_emp3(empno, ename, deptno, job, sal) values (1111, 'ö', 10, '', (select sal, deptno from emp where empno = 7566)); commit; -- () -- emp ̺ μȣ 30 μ ȣ, , μȣ -- , ȸϿ ep_emp3 ̺ ߰ savepoint a; insert into cp_emp3 (select empno, ename, deptno, job, sal from emp where deptno=30); select *from cp_emp3; create table test(job varchar2(9), sal number(7,2), hiredate date); alter table test add input_date date; alter table test modify hiredate varchar2(7); --̺ 1981-02 Ի , , --Ի-, Է test ̺ ߰ (ùٸ ƴ. ) insert into test (select job, sum(sal), to_char(hiredate,'yyyy-mm') hiredate, sysdate from emp where to_char(hiredate,'yyyy-mm') = '1981-02' group by job, hiredate); select * from test;
true
dad3777cf76c6b2c3d98d2e39b928162d0bd5c03
SQL
pietromosca1994/IBM_Data_Science_Professional_Certificate
/Databases and SQL for Data Science/Week2/Excercise2/Excercise2 Database2 Week2 Queries.sql
UTF-8
875
3.484375
3
[ "MIT" ]
permissive
-- Query A1 -- SELECT SUM(COST) FROM PETRESCUE; -- Query A2 -- SELECT SUM(COST) AS "SUM_OF_COST" FROM PETRESCUE; -- QueryA3 -- SELECT MAX(QUANTITY) FROM PETRESCUE; -- Query A4 -- SELECT AVG(COST) FROM PETRESCUE; -- Query A5 -- SELECT AVG(COST/QUANTITY) FROM PETRESCUE WHERE ANIMAL='Dog'; -- Query B1 -- SELECT ROUND(COST) FROM PETRESCUE; -- Query B2 -- SELECT LENGTH(ANIMAL) FROM PETRESCUE; -- Query B3 -- SELECT UCASE(ANIMAL) FROM PETRESCUE; -- Query B4 -- SELECT DISTINCT(UCASE(ANIMAL)) FROM PETRESCUE; -- Query B5 -- SELECT * FROM PETRESCUE WHERE LCASE(ANIMAL)='cat'; -- Query C1 -- SELECT DAY(RESCUEDATE) FROM PETRESCUE WHERE LCASE(ANIMAL)='cat'; -- Query C2 -- SELECT SUM(QUANTITY) FROM PETRESCUE WHERE DAY(RESCUEDATE)='5'; -- Query C3 -- SELECT (RESCUEDATE + 3 DAYS) FROM PETRESCUE ; -- Query C4 -- SELECT (CURRENT DATE - RESCUEDATE) FROM PETRESCUE;
true
64f6d3f1185d624e09994fb62c974daea5db6737
SQL
Liscp/Tabla
/ingresar_registros.sql
UTF-8
989
3.21875
3
[]
no_license
-- EJECUTAR UNO A LA VEZ!! -- Seleccionar la base de Datos USE TiendaVideojuegos; -- Ingresar registros en la tabla INSERT INTO Clientes (nombre, apellido, tipoVideojuego,celular,descripsion) VALUES ("Lisbeth","Caiza","Acción","0987535255","Balas y puras armas"); INSERT INTO Clientes (nombre, apellido, tipoVideojuego,celular,descripsion) VALUES ("Cristina","Ruiz","Arcade","0995368705","Laberintos"); INSERT INTO Clientes (nombre, apellido, tipoVideojuego,celular,descripsion) VALUES ("Daniela","Cortez","Simulación","0983547892","Aviones"); -- ELIMINAR UN REGISTRO -- REVISAR CON UN SELECT LO QUE DESEAMOS ELIMINAR SELECT * FROM Clientes WHERE id = 2; -- ELIMINAR EL REGISTRO DE LA TABLA DELETE FROM Clientes WHERE id = 2; -- CONSULTAR TODOS LOS DATOS DE LA TABLA SELECT * FROM Clientes ; -- CONSULTAR NOMBRE Y APELLIDO DE LA TABLA EN UNA COLUMNA SELECT CONCAT(nombre," ",apellido)FROM Clientes; -- CONSULTAR REGISTROS POR CONDICIONES SELECT * FROM Clientes WHERE nombre="Lisbeth";
true
b30bf75d01836f7fb19a3e00bab56d21ac880a5e
SQL
luotongluo/spring-boot-dubbot-test
/z-db-files/createdb.sql
UTF-8
752
3.28125
3
[ "Apache-2.0" ]
permissive
drop table if exists test_sql; CREATE TABLE `test_sql` ( `id` bigint(20) unsigned NOT NULL COMMENT '测试表id', `user_name` varchar(100) DEFAULT '' COMMENT 'user_name', `user_age` int(2) DEFAULT null COMMENT 'user_age', `user_birthday` datetime DEFAULT null COMMENT 'user_birthday', `delete_info` int(2) DEFAULT 0 COMMENT '0未删除,1已删除', `create_time` datetime DEFAULT NULL COMMENT '创建时间', `update_time` datetime DEFAULT NULL COMMENT '更新时间', `backup1` varchar(100) DEFAULT '' COMMENT '备用字段1', `backup2` varchar(100) DEFAULT '' COMMENT '备用字段2', PRIMARY KEY (`id`) )ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT '测试表'; create index test_sql_index ON test_sql(create_time,user_name,user_age,user_birthday);
true
2949d25ab7b8aca1b69cab4318ffe82993a9f852
SQL
ajnorthouse/student-retention-webapp
/domain/MySQL/Dummy_Data.sql
UTF-8
3,055
3.203125
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 5.0.1 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Generation Time: Feb 06, 2020 at 11:38 PM -- Server version: 10.4.11-MariaDB -- PHP Version: 7.4.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: `student-engagement-retention-local` -- -- -- Dumping data for table `universities` -- INSERT INTO `universities` (`ID`, `name`) VALUES (1, 'Example University'); -- -- Dumping data for table `users` -- INSERT INTO `users` (`ID`, `uniID`, `username`, `password`, `fname`, `lname`, `isProf`) VALUES (1, 1, 'exampleStudent', '$2y$10$nEfrO5hm60sZYZLvn1DoSuhlGmJDg0.5Cd2TyM7jD/ewVh0ELA03e', 'Millie', 'Brown', 0), (2, 1, 'exampleProfessor', '$2y$10$nEfrO5hm60sZYZLvn1DoSuhlGmJDg0.5Cd2TyM7jD/ewVh0ELA03e', 'Abigail', 'Smith', 1); COMMIT; -- -- Dumping data for table `courses` -- INSERT INTO `courses` (`ID`, `uniID`, `crseID`, `sectNum`, `crseName`) VALUES (1, 1, 'EX101', 1, 'Example Course, Section 1'), (2, 1, 'EX101', 2, 'Example Course, Section 2'), (3, 1, 'EX102', 1, 'Example Course 2, Section 1'), (0, 1, 'asdf', 0, 'asdf'); -- -- Dumping data for table `coursesusersroster` -- INSERT INTO `coursesusersroster` (`crseID`, `userID`) VALUES (1, 1), (1, 2), (2, 1), (2, 2); -- -- Dumping data for table `questions` -- INSERT INTO `questions` (`ID`, `crseID`, `qtext`, `atext`) VALUES (1, 1, 'What\'s the capital of Indiana?', 'The capital of Indiana is Indianaoplis.'), (2, 1, 'What section of EX101 is this?', 'This is section 1 of EX101.'), (3, 2, 'What\'s the capital of Michigan?', 'The capital of Michigan is Grand Rapids.'), (4, 2, 'What section of EX101 is this?', 'This is section 2 of EX101.'), (5, 2, 'asdf', 'asdf'); -- -- Dumping data for table `syllabi` -- INSERT INTO `syllabi` (`ID`, `crseID`, `courseTitle`, `contactInformation`, `officeHoursPolicy`, `courseDescription`, `courseGoals`, `requiredMaterials`, `gradingPolicy`, `attendancePolicy`, `universityPolicy`, `studentResources`) VALUES (1, 1, 'Example title', 'Example contact information', 'Example office hours policy', 'Example course description', 'Example course goals', 'Example required materials', 'Example grading policy', 'Example attendance policy', 'Example university policy', 'Example student resources'), (2, 2, 'Example title 2', 'Example contact information 2', 'Example office hours policy 2', 'Example course description 2', 'Example course goals 2', 'Example required materials 2', 'Example grading policy 2', 'Example attendance policy 2', 'Example university policy 2', 'Example student resources 2'); /*!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
35e77544b056cea542db15845e5b777b76980ffc
SQL
cs-cena/Model
/restaurant/restaurant.sql
UTF-8
2,140
2.875
3
[]
no_license
insert into Dishes values ("zs01", "汉堡包", 9), ("zs02", "吉士汉堡包", 9.5), ("zs03", "麦香鸡", 12), ("zs04", "双层吉士汉堡", 17), ("zs05", "麦香鱼", 17), ("zs06", "经典麦辣鸡腿汉堡", 17), ("zs07", "巨无霸", 21.5), ("zs08", "原味板烧鸡腿堡", 19), ("zs09", "培根蔬萃双层牛堡", 21.5), ("zs10", "不素之霸双层牛堡", 20), ("zs11", "双层深海鳕鱼堡", 20), ("zs12", "川辣双鸡堡", 20), ("zs13", "安格斯厚牛培根堡", 30), ("zs14", "安格斯厚牛芝士堡", 27), ("zs15", "金拱门桶", 51), ("zs16", "小食纷享盒", 29.5), ("zs17", "和风牛肉饭", 25); insert into SetMeal values ("tc0101", "经典麦辣鸡腿汉堡套餐", "中", 26.5), ("tc0102", "经典麦辣鸡腿汉堡套餐", "大", 30.5), ("tc0201", "原味板烧鸡腿堡套餐", "中", 28.5), ("tc0202", "原味板烧鸡腿堡套餐", "大", 32.5), ("tc0301", "巨无霸套餐", "中", 31), ("tc0302", "巨无霸套餐", "大", 34.5), ("tc0401", "培根蔬萃双层牛堡套餐", "中", 31), ("tc0402", "培根蔬萃双层牛堡套餐", "大", 34.5), ("tc0501", "麦香鱼套餐", "中", 21), ("tc0502", "麦香鱼套餐", "大", 25), ("tc0601", "麦香鸡套餐", "中", 19.5), ("tc0602", "麦香鸡套餐", "大", 23.5), ("tc0701", "吉士汉堡包套餐", "中", 19), ("tc0702", "吉士汉堡包套餐", "大", 23), ("tc0801", "双层吉士汉堡套餐", "中", 26.5), ("tc0802", "双层吉士汉堡套餐", "大", 30.5), ("tc0901", "麦辣鸡翅套餐", "中", 30.5), ("tc0902", "麦辣鸡翅套餐", "大", 34.5), ("tc1001", "和风牛肉饭套餐", "中", 35.5), ("tc1002", "和风牛肉饭套餐", "大", 39.5); --单点菜单 CREATE TABLE Dishes ( DId TEXT NOT NULL, Dname TEXT, Dprice INTEGER, PRIMARY KEY (DId) ); --套餐菜单 CREATE TABLE SetMeal ( DId TEXT NOT NULL, Sname TEXT, Sb TEXT, Sprice INTEGER, PRIMARY KEY (DId) ); CREATE TABLE "菜品图片" ( "菜品id" INTEGER NOT NULL, "菜单图片" BLOB, PRIMARY KEY ("菜品id") ); --客户下单 CREATE TABLE Customer ( CId TEXT NOT NULL, Ctime TEXT, Ctable TEXT, DId TEXT, PRIMARY KEY (CId) );
true
fd17a676845f4a1425afac46d72c362c55ba6e90
SQL
msalguer/mantis_email2users
/View view_permisos_proyectos.sql
UTF-8
140
2.578125
3
[ "MIT" ]
permissive
SELECT p.project_id as IdProyecto, p.user_id as IdUsuario, p.access_level from mantis_project_user_list_table as p where p.access_level=55
true
5f8c2102995812d67159c7009d9d4edd89b031b0
SQL
andreypatino/carritoCompras
/prueba.sql
UTF-8
6,554
2.90625
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 5.0.2 -- https://www.phpmyadmin.net/ -- -- Servidor: 127.0.0.1:3606 -- Tiempo de generación: 11-11-2020 a las 17:58:38 -- Versión del servidor: 10.4.11-MariaDB -- Versión de PHP: 7.2.30 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 */; -- -- Base de datos: `prueba` -- -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `cotizacion` -- CREATE TABLE `cotizacion` ( `idcotizacion` int(10) NOT NULL, `fk_idproductos` int(10) NOT NULL, `fcotizacion` int(100) NOT NULL, `cantidad` int(50) NOT NULL, `valorTotal` int(50) NOT NULL, `fechaCreacion` datetime NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Volcado de datos para la tabla `cotizacion` -- INSERT INTO `cotizacion` (`idcotizacion`, `fk_idproductos`, `fcotizacion`, `cantidad`, `valorTotal`, `fechaCreacion`) VALUES (2, 1, 2, 2, 24, '2020-11-11 09:22:44'), (3, 1, 3, 3, 36, '2020-11-11 09:23:36'), (4, 1, 4, 2, 24, '2020-11-11 09:23:58'), (5, 2, 4, 3, 39, '2020-11-11 09:37:11'), (6, 1, 6, 2, 24, '2020-11-11 09:58:22'), (7, 2, 6, 4, 52, '2020-11-11 09:59:00'), (8, 1, 8, 2, 24, '2020-11-11 10:19:23'), (9, 2, 9, 2, 26, '2020-11-11 10:22:07'), (10, 1, 9, 2, 24, '2020-11-11 10:22:22'), (11, 1, 11, 1, 12, '2020-11-11 10:29:34'), (12, 1, 12, 2, 24, '2020-11-11 10:30:36'), (13, 2, 12, 3, 39, '2020-11-11 10:30:47'), (14, 1, 14, 2, 24, '2020-11-11 10:53:51'), (15, 1, 15, 3, 36, '2020-11-11 10:55:18'), (16, 1, 16, 5, 60, '2020-11-11 11:00:05'), (17, 2, 16, 2, 26, '2020-11-11 11:00:37'), (18, 1, 18, 2, 24, '2020-11-11 11:01:31'), (19, 2, 18, 2, 26, '2020-11-11 11:01:38'), (20, 1, 20, 4, 48, '2020-11-11 11:06:09'), (21, 2, 21, 2, 26, '2020-11-11 11:06:52'), (22, 1, 22, 2, 24, '2020-11-11 11:07:26'); -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `facturaelectronica` -- CREATE TABLE `facturaelectronica` ( `idFactura` int(10) NOT NULL, `idCotizacion` int(10) NOT NULL, `NombreComprador` varchar(100) NOT NULL, `ContactoComprador` varchar(50) NOT NULL, `documentoComprador` int(20) NOT NULL, `dirrComprador` varchar(100) NOT NULL, `valortotal` int(30) NOT NULL, `fechaCreacion` datetime NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `productos` -- CREATE TABLE `productos` ( `idproductos` int(10) NOT NULL, `referencia` varchar(50) NOT NULL, `descripción` varchar(500) NOT NULL, `caracteristicas` varchar(1000) NOT NULL, `valor` int(50) NOT NULL, `fechaCreacion` datetime NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Volcado de datos para la tabla `productos` -- INSERT INTO `productos` (`idproductos`, `referencia`, `descripción`, `caracteristicas`, `valor`, `fechaCreacion`) VALUES (1, '1231231', 'Producto 1', 'zxasdasdsadasdsadsaadsadasdds', 12, '2020-11-10 14:51:02'), (2, '12321321', 'Producto 2', 'sadsadasdsadadassadsadsadasdsadasdsa', 13, '2020-11-10 14:51:49'), (4, '213212132121321', 'sdsadsadsasd', 'sadsadsadasdaddasdsa', 123343, '2020-11-10 15:22:11'), (5, '12322112312', 'szdsadasdsadasdasdsad', 'sadsadasdasdsadsadasdasdasdasdddasd', 12343, '2020-11-10 15:23:59'), (6, '21232132121', 'adasdsadasasdsdsdasdsa', 'sadsadsadasdasdsadsadsddddd', 1234, '2020-11-10 15:25:49'), (9, '2321321321123321213', 'sdasdsadsadasddsadasdsa', 'asdsadsadsadsadsasadasds', 123, '2020-11-10 15:34:25'), (10, '3432432423', 'sdsadasdsdasdddddd sas', 'sadasdgvhhhhhhhh', 65, '2020-11-11 07:11:05'), (11, '87', 'ghjhghkjhgkjghgh', 'vcbcvbvcbvbv', 34, '2020-11-11 07:11:45'); -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `usuarios` -- CREATE TABLE `usuarios` ( `id` int(10) UNSIGNED NOT NULL, `name` varchar(200) NOT NULL, `telefono` varchar(45) NOT NULL, `direccion` varchar(45) DEFAULT NULL, `email` varchar(45) NOT NULL, `username` varchar(45) NOT NULL, `password` varchar(45) NOT NULL, `verified` tinyint(1) NOT NULL DEFAULT 0, `root` tinyint(1) NOT NULL DEFAULT 0, `token` varchar(32) DEFAULT NULL, `created_at` datetime NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `updated_at` datetime NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `deleted_at` datetime DEFAULT NULL, `observations` varchar(45) DEFAULT NULL, `fk_estados` int(10) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Volcado de datos para la tabla `usuarios` -- INSERT INTO `usuarios` (`id`, `name`, `telefono`, `direccion`, `email`, `username`, `password`, `verified`, `root`, `token`, `created_at`, `updated_at`, `deleted_at`, `observations`, `fk_estados`) VALUES (1, 'Andrey Sarria', '3183263424', 'cra 42# 13c 25', '[email protected]', 'andreypatino', '202cb962ac59075b964b07152d234b70', 1, 1, NULL, '2020-11-10 11:20:17', '2020-11-10 11:20:17', NULL, NULL, 1); -- -- Índices para tablas volcadas -- -- -- Indices de la tabla `cotizacion` -- ALTER TABLE `cotizacion` ADD PRIMARY KEY (`idcotizacion`); -- -- Indices de la tabla `facturaelectronica` -- ALTER TABLE `facturaelectronica` ADD PRIMARY KEY (`idFactura`); -- -- Indices de la tabla `productos` -- ALTER TABLE `productos` ADD PRIMARY KEY (`idproductos`); -- -- Indices de la tabla `usuarios` -- ALTER TABLE `usuarios` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `username_UNIQUE` (`username`), ADD UNIQUE KEY `email_UNIQUE` (`email`); -- -- AUTO_INCREMENT de las tablas volcadas -- -- -- AUTO_INCREMENT de la tabla `cotizacion` -- ALTER TABLE `cotizacion` MODIFY `idcotizacion` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=23; -- -- AUTO_INCREMENT de la tabla `facturaelectronica` -- ALTER TABLE `facturaelectronica` MODIFY `idFactura` int(10) NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT de la tabla `productos` -- ALTER TABLE `productos` MODIFY `idproductos` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12; -- -- AUTO_INCREMENT de la tabla `usuarios` -- ALTER TABLE `usuarios` MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3; 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
9a5f0ea3c25b45c6680c648ab5a4a229f0f92ecf
SQL
demotivirus/365_Days_Challenge_Five_Classes_Every_Single_Day
/src/main/java/com/demotivirus/Day_024_S2/dbMigration/create-book-table.sql
UTF-8
266
3.546875
4
[]
no_license
DROP TABLE IF EXISTS book CASCADE; create table book ( id serial, title varchar(128) not null, author varchar(256) not null ); create unique index book_id_uindex on book (id); alter table book add constraint book_pk primary key (id);
true
232b83ceaa88c3cd40264ff99f55b2f26965bba0
SQL
UCLALibrary/sql-scripts
/Voyager/Cataloging/JSTOR_Print_ISBNs.sql
UTF-8
1,711
3.875
4
[]
no_license
/* Extract requested data for list of print ISBNs provided in Excel by Roxanne Peck. https://jira.library.ucla.edu/browse/RR-171 Do all work as vger_report, for temporary working table/index. Create table and import data via JDeveloper. Needed to copy/paste column from Excel to text file before import - 5819 rows too big for JDeveloper via Excel? Same number of rows as RR-170 tmp_jstor_eisbn (electronic), but verified no overlap. After import, create index create index ix_tmp_jstor_pisbn on tmp_jstor_pisbn (isbn); */ -- Only include matches with isbns as ( select distinct j.isbn , bi.normal_heading , bi.bib_id from tmp_jstor_pisbn j inner join ucladb.bib_index bi on bi.index_code in ('020N', '020R', 'ISB3') and bi.normal_heading = j.isbn ) select i.isbn , i.bib_id , (select subfield from vger_subfields.ucladb_bib_subfield where record_id = i.bib_id and tag = '264c' and rownum < 2) as f264c , (select subfield from vger_subfields.ucladb_bib_subfield where record_id = i.bib_id and tag = '260c' and rownum < 2) as f260c , l.location_code , (select subfield from vger_subfields.ucladb_mfhd_subfield where record_id = mm.mfhd_id and tag = '852h' and rownum < 2) as f852h from isbns i inner join ucladb.bib_mfhd bm on i.bib_id = bm.bib_id inner join ucladb.mfhd_master mm on bm.mfhd_id = mm.mfhd_id inner join ucladb.location l on mm.location_id = l.location_id order by i.isbn, i.bib_id ; -- 5819 source rows; 4400 (4136 distinct) isbns match voyager; 3839 match one bib, 290 match 2 bibs, 7 match 3 bibs -- 4650 total rows, due to dup isbn -> voyager and bibs with multiple mfhds -- Clean up when done drop table tmp_jstor_pisbn purge;
true
45ba963cebc429f922ba31b3a973e7e701a3e14b
SQL
Alexander33928/BS2
/exercicios-3/Ejercicio 3.sql
UTF-8
4,017
4.09375
4
[]
no_license
use world; select count(Name) from country; /*1*/ select Continent, count(Name)/*2*/ from country group by Continent; select Continent, count(Name)/*3*/ from country GROUP BY Continent ORDER BY Continent ASC; select Continent, count(Name) /*4*/ from country GROUP BY Continent HAVING count(Name) > 50; select SurfaceArea, Name from country /*5*/ where SurfaceArea = (Select MAX(SurfaceArea) from country); select SurfaceArea, Name from country /*6*/ where SurfaceArea = (Select MIN(SurfaceArea) from country); select AVG(SurfaceArea) from country; /*7*/ select AVG(SurfaceArea) from country /*8*/ where Continent = 'Europe'; select Continent, AVG(SurfaceArea)/*9*/ from country group by Continent; select Continent, AVG(SurfaceArea)/*10*/ from country group by Continent order by AVG(SurfaceArea) DESC; select Continent, MAX(SurfaceArea)/*11*/ from country group by Continent; select Continent, MAX(SurfaceArea)/*12*/ from country group by Continent order by MAX(SurfaceArea) desc; SELECT /*13*/ country.Name, count(countrylanguage.Language) FROM country INNER JOIN countrylanguage ON countrylanguage.CountryCode = country.code group by country.Name; SELECT /*14*/ country.Name, count(countrylanguage.Language) as 'countLanguages' FROM country INNER JOIN countrylanguage ON countrylanguage.CountryCode = country.code group by country.Name Having count('countLanguage') > 10; SELECT Name, capital from country; /*15*/ Select Name, AVG(Population) from country /*16*/ group by Name; Select Name, AVG(Population) from country /*17*/ group by Name order by AVG(Population) ASC ; Select Name, AVG(Population) from country /*18*/ group by Name Having AVG(Population) > 70000 order by AVG(Population) ASC; /*---------------------------------------------------------------------------------------------------------*/ use sakila; select SUM(amount) from payment; /*19*/ select AVG(amount) from payment; /*20*/ SELECT /*21*/ customer.customer_id, customer.first_name, customer.last_name, SUM(payment.amount) FROM payment INNER JOIN customer ON payment.customer_id = customer.customer_id group by customer.customer_id; SELECT /*22*/ customer.customer_id, customer.first_name, customer.last_name, SUM(payment.amount) FROM payment INNER JOIN customer ON payment.customer_id = customer.customer_id group by customer.customer_id order by customer.first_name, customer.last_name; SELECT /*23 */ customer.customer_id, customer.first_name, customer.last_name, SUM(payment.amount) FROM payment INNER JOIN customer ON payment.customer_id = customer.customer_id group by customer.customer_id Having SUM(payment.amount) > 100 order by payment.amount; select /*24*/ staff.staff_id, staff.first_name, staff.last_name, count(payment.amount) FROM staff INNER JOIN payment ON staff.staff_id = payment.staff_id group by staff.staff_id; select /*25*/ staff.staff_id, staff.first_name, staff.last_name, count(payment.amount) FROM staff INNER JOIN payment ON staff.staff_id = payment.staff_id WHERE payment.payment_date between '2005-05-25' AND '2005-08-23' group by staff.staff_id; select /*26*/ actor.actor_id, actor.first_name, actor.last_name, Count(film_actor.actor_id) FROM actor INNER JOIN film_actor ON actor.actor_id = film_actor.actor_id group by actor.actor_id; select /*27*/ actor.actor_id, actor.first_name, actor.last_name, Count(film_actor.actor_id) FROM actor INNER JOIN film_actor ON actor.actor_id = film_actor.actor_id group by actor.actor_id order by Count(actor.actor_id) DESC; select /*28*/ actor.actor_id, actor.first_name, actor.last_name, Count(film_actor.actor_id) FROM actor INNER JOIN film_actor ON actor.actor_id = film_actor.actor_id where actor.actor_id = 100; select /*29*/ category.name, count(film_category.category_id) FROM category INNER JOIN film_category ON category.category_id = film_category.category_id group by category.name;
true
9f6bc67b099620ffb734cf7b1237c23bd7c9b790
SQL
adndati/KUMPULAN-PROJEK
/nasi_goreng.sql
UTF-8
2,393
3.109375
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 5.0.3 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Generation Time: Jun 06, 2021 at 05:20 AM -- Server version: 10.4.14-MariaDB -- PHP Version: 7.4.11 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: `nasi_goreng` -- -- -------------------------------------------------------- -- -- Table structure for table `menu` -- CREATE TABLE `menu` ( `id_menu` int(11) NOT NULL, `gambar` varchar(250) NOT NULL, `judul` text NOT NULL, `deskripsi` text NOT NULL, `harga` varchar(10) NOT NULL, `jenis` text NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `menu` -- INSERT INTO `menu` (`id_menu`, `gambar`, `judul`, `deskripsi`, `harga`, `jenis`) VALUES (1, 'fried rice.png', 'Nasi Goreng Mentega', 'Nasi goreng mentega ditambah dengan sayuran', '17000', 'makanan'), (5, 'alexander-mils-aiIANaSK9DQ-unsplash.jpg', 'Cheese cake', 'Dessert manis', '27000', 'makanan'); -- -------------------------------------------------------- -- -- Table structure for table `user` -- CREATE TABLE `user` ( `id_user` int(11) NOT NULL, `username` varchar(20) NOT NULL, `password` varchar(20) NOT NULL, `level` text NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `user` -- INSERT INTO `user` (`id_user`, `username`, `password`, `level`) VALUES (1, 'pakMamatt', 'pakmamat', 'admin'); -- -- Indexes for dumped tables -- -- -- Indexes for table `menu` -- ALTER TABLE `menu` ADD PRIMARY KEY (`id_menu`); -- -- Indexes for table `user` -- ALTER TABLE `user` ADD PRIMARY KEY (`id_user`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `menu` -- ALTER TABLE `menu` MODIFY `id_menu` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6; -- -- AUTO_INCREMENT for table `user` -- ALTER TABLE `user` MODIFY `id_user` 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
bdf6da5c023a21cbe87663dbc0d8526ea9c7e0ff
SQL
wenx999/ytex
/projects/i2b2.2008/data/clean_ce_experiment.sql
UTF-8
360
2.78125
3
[]
no_license
delete e,s,i,z from classifier_eval e inner join classifier_eval_svm s on e.classifier_eval_id = s.classifier_eval_id inner join classifier_eval_ir i on e.classifier_eval_id = i.classifier_eval_id left join classifier_instance_eval z on e.classifier_eval_id = z.classifier_eval_id where e.experiment = '@kernel.experiment@' and e.name = '@kernel.name@' ;
true
33d2dbcbd147d444d1d2949cb67aab9870dbcaf0
SQL
zak-hassan/BusinessIntelligence
/sql/CREATESCRIPT-A1-v3.sql
UTF-8
19,199
3.765625
4
[]
no_license
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0; SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0; SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES'; DROP SCHEMA IF EXISTS `mydb` ; CREATE SCHEMA IF NOT EXISTS `mydb` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci ; USE `mydb` ; -- ----------------------------------------------------- -- Table `mydb`.`Manager` -- ----------------------------------------------------- DROP TABLE IF EXISTS `mydb`.`Manager` ; CREATE TABLE IF NOT EXISTS `mydb`.`Manager` ( `idManager` INT NOT NULL, `name` VARCHAR(45) NULL, PRIMARY KEY (`idManager`)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `mydb`.`City` -- ----------------------------------------------------- DROP TABLE IF EXISTS `mydb`.`City` ; CREATE TABLE IF NOT EXISTS `mydb`.`City` ( `city_id` INT NOT NULL AUTO_INCREMENT, `name` VARCHAR(45) NULL, PRIMARY KEY (`city_id`)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `mydb`.`Province` -- ----------------------------------------------------- DROP TABLE IF EXISTS `mydb`.`Province` ; CREATE TABLE IF NOT EXISTS `mydb`.`Province` ( `province_id` INT NOT NULL AUTO_INCREMENT, `city_id` INT NULL, `name` VARCHAR(45) NULL, PRIMARY KEY (`province_id`), CONSTRAINT `province_to_city` FOREIGN KEY (`city_id`) REFERENCES `mydb`.`City` (`city_id`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `mydb`.`Store` -- ----------------------------------------------------- DROP TABLE IF EXISTS `mydb`.`Store` ; CREATE TABLE IF NOT EXISTS `mydb`.`Store` ( `store_id` INT NOT NULL AUTO_INCREMENT, `manager_id` INT NOT NULL, `province_id` INT NOT NULL, PRIMARY KEY (`store_id`), CONSTRAINT `store_to_manager` FOREIGN KEY (`manager_id`) REFERENCES `mydb`.`Manager` (`idManager`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `store_to_province` FOREIGN KEY (`province_id`) REFERENCES `mydb`.`Province` (`province_id`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `mydb`.`Customer` -- ----------------------------------------------------- DROP TABLE IF EXISTS `mydb`.`Customer` ; CREATE TABLE IF NOT EXISTS `mydb`.`Customer` ( `customer_id` INT NOT NULL AUTO_INCREMENT, `customer_name` VARCHAR(45) NOT NULL, `dob` DATE NOT NULL, `sex` BIT NOT NULL COMMENT '0 for Male or 1 for Female\n', PRIMARY KEY (`customer_id`)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `mydb`.`Product` -- ----------------------------------------------------- DROP TABLE IF EXISTS `mydb`.`Product` ; CREATE TABLE IF NOT EXISTS `mydb`.`Product` ( `product_id` INT NOT NULL AUTO_INCREMENT, `product_name` VARCHAR(45) NULL, `price` FLOAT NULL, `initialcost` FLOAT NULL, PRIMARY KEY (`product_id`)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `mydb`.`ProductGroup` -- ----------------------------------------------------- DROP TABLE IF EXISTS `mydb`.`ProductGroup` ; CREATE TABLE IF NOT EXISTS `mydb`.`ProductGroup` ( `productGroup_id` INT NOT NULL AUTO_INCREMENT, `product_name` VARCHAR(45) NULL, `product_id` INT NULL, PRIMARY KEY (`productGroup_id`), CONSTRAINT `ProductGroup_To_Product` FOREIGN KEY (`product_id`) REFERENCES `mydb`.`Product` (`product_id`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `mydb`.`Sales` -- ----------------------------------------------------- DROP TABLE IF EXISTS `mydb`.`Sales` ; CREATE TABLE IF NOT EXISTS `mydb`.`Sales` ( `sale_id` INT NOT NULL AUTO_INCREMENT, `store_id` INT NOT NULL, `customer_id` INT NOT NULL, `productgroup_id` INT NOT NULL, `qty` INT NOT NULL, `year` INT NOT NULL, PRIMARY KEY (`sale_id`), CONSTRAINT `sales_to_store` FOREIGN KEY (`store_id`) REFERENCES `mydb`.`Store` (`store_id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `sales_to_customer` FOREIGN KEY (`customer_id`) REFERENCES `mydb`.`Customer` (`customer_id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `sales_to_product` FOREIGN KEY (`productgroup_id`) REFERENCES `mydb`.`ProductGroup` (`productGroup_id`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `mydb`.`AgeGroup` -- ----------------------------------------------------- DROP TABLE IF EXISTS `mydb`.`AgeGroup` ; CREATE TABLE IF NOT EXISTS `mydb`.`AgeGroup` ( `ageGroup_id` INT NOT NULL AUTO_INCREMENT, `name` VARCHAR(45) NULL, `begin` INT NULL, `end` INT NULL, PRIMARY KEY (`ageGroup_id`)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `mydb`.`Account` -- ----------------------------------------------------- DROP TABLE IF EXISTS `mydb`.`Account` ; CREATE TABLE IF NOT EXISTS `mydb`.`Account` ( `id` INT NOT NULL AUTO_INCREMENT, `sortOrder` BIT NULL, `typeId` INT NULL, PRIMARY KEY (`id`)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `mydb`.`Payee` -- ----------------------------------------------------- DROP TABLE IF EXISTS `mydb`.`Payee` ; CREATE TABLE IF NOT EXISTS `mydb`.`Payee` ( `id` INT NOT NULL AUTO_INCREMENT, `name` VARCHAR(45) NULL, PRIMARY KEY (`id`), UNIQUE INDEX `name_UNIQUE` (`name` ASC)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `mydb`.`Category` -- ----------------------------------------------------- DROP TABLE IF EXISTS `mydb`.`Category` ; CREATE TABLE IF NOT EXISTS `mydb`.`Category` ( `id` INT NOT NULL, `term` VARCHAR(45) NULL, `descr` VARCHAR(45) NULL, PRIMARY KEY (`id`)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `mydb`.`AccntType` -- ----------------------------------------------------- DROP TABLE IF EXISTS `mydb`.`AccntType` ; CREATE TABLE IF NOT EXISTS `mydb`.`AccntType` ( `id` INT NOT NULL AUTO_INCREMENT, `term` VARCHAR(45) NULL, `descr` VARCHAR(45) NULL, PRIMARY KEY (`id`), UNIQUE INDEX `term_UNIQUE` (`term` ASC)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `mydb`.`Trade` -- ----------------------------------------------------- DROP TABLE IF EXISTS `mydb`.`Trade` ; CREATE TABLE IF NOT EXISTS `mydb`.`Trade` ( `id` INT NOT NULL, `accntid` VARCHAR(45) NULL, `tdate` VARCHAR(45) NULL, `number` VARCHAR(45) NULL, `payeeid` VARCHAR(45) NULL, `payment` VARCHAR(45) NULL, `deposit` VARCHAR(45) NULL, `recon` VARCHAR(45) NULL, `catId` VARCHAR(45) NULL, `memo` VARCHAR(45) NULL, `txtfrId` VARCHAR(45) NULL, PRIMARY KEY (`id`)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `mydb`.`Loan` -- ----------------------------------------------------- DROP TABLE IF EXISTS `mydb`.`Loan` ; CREATE TABLE IF NOT EXISTS `mydb`.`Loan` ( `id` INT NOT NULL, `lenderid` VARCHAR(45) NULL, `principal` VARCHAR(45) NULL, `apr` VARCHAR(45) NULL, `years` VARCHAR(45) NULL, `freqid` VARCHAR(45) NULL, `firstDate` VARCHAR(45) NULL, `escrow` VARCHAR(45) NULL, `extraPrinc` VARCHAR(45) NULL, `payment` VARCHAR(45) NULL, PRIMARY KEY (`id`)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `mydb`.`Recurring` -- ----------------------------------------------------- DROP TABLE IF EXISTS `mydb`.`Recurring` ; CREATE TABLE IF NOT EXISTS `mydb`.`Recurring` ( `id` INT NOT NULL, `accntid` VARCHAR(45) NULL, `freqid` VARCHAR(45) NULL, `nextDate` VARCHAR(45) NULL, `typeid` VARCHAR(45) NULL, `payeeid` VARCHAR(45) NULL, `payment` VARCHAR(45) NULL, `deposit` VARCHAR(45) NULL, `catid` VARCHAR(45) NULL, `memo` VARCHAR(45) NULL, PRIMARY KEY (`id`)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `mydb`.`TransType` -- ----------------------------------------------------- DROP TABLE IF EXISTS `mydb`.`TransType` ; CREATE TABLE IF NOT EXISTS `mydb`.`TransType` ( `id` INT NOT NULL, `term` VARCHAR(45) NULL, `descr` VARCHAR(45) NULL, PRIMARY KEY (`id`)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `mydb`.`Void` -- ----------------------------------------------------- DROP TABLE IF EXISTS `mydb`.`Void` ; CREATE TABLE IF NOT EXISTS `mydb`.`Void` ( `id` INT NOT NULL, `payeeid` VARCHAR(45) NULL, `payment` VARCHAR(45) NULL, `deposit` VARCHAR(45) NULL, PRIMARY KEY (`id`)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `mydb`.`Contact` -- ----------------------------------------------------- DROP TABLE IF EXISTS `mydb`.`Contact` ; CREATE TABLE IF NOT EXISTS `mydb`.`Contact` ( `id` INT NOT NULL, `email` VARCHAR(45) NULL, `phone` VARCHAR(45) NULL, `street1` VARCHAR(45) NULL, `street2` VARCHAR(45) NULL, `city` VARCHAR(45) NULL, `stateid` VARCHAR(45) NULL, `zip` VARCHAR(45) NULL, PRIMARY KEY (`id`)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `mydb`.`Website` -- ----------------------------------------------------- DROP TABLE IF EXISTS `mydb`.`Website` ; CREATE TABLE IF NOT EXISTS `mydb`.`Website` ( `id` INT NOT NULL, `uri` VARCHAR(45) NULL, `username` VARCHAR(45) NULL, `password` VARCHAR(45) NULL, `other` VARCHAR(45) NULL, PRIMARY KEY (`id`)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `mydb`.`State` -- ----------------------------------------------------- DROP TABLE IF EXISTS `mydb`.`State` ; CREATE TABLE IF NOT EXISTS `mydb`.`State` ( `id` INT NOT NULL, `abbrev` VARCHAR(45) NULL, `name` VARCHAR(45) NULL, PRIMARY KEY (`id`)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `mydb`.`Frequency` -- ----------------------------------------------------- DROP TABLE IF EXISTS `mydb`.`Frequency` ; CREATE TABLE IF NOT EXISTS `mydb`.`Frequency` ( `id` INT NOT NULL, `term` VARCHAR(45) NULL, `descr` VARCHAR(45) NULL, `days` VARCHAR(45) NULL, `simpBudgetQuery` VARCHAR(45) NULL, `cplxBudgetQuery` VARCHAR(45) NULL, PRIMARY KEY (`id`)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `mydb`.`PopulationByYearByProvince` -- ----------------------------------------------------- DROP TABLE IF EXISTS `mydb`.`PopulationByYearByProvince` ; CREATE TABLE IF NOT EXISTS `mydb`.`PopulationByYearByProvince` ( `idPopulationByYearByProvince` INT NOT NULL AUTO_INCREMENT, `province` VARCHAR(45) NOT NULL, `year09` FLOAT NOT NULL, `year10` FLOAT NOT NULL, `year11` FLOAT NOT NULL, `year12` FLOAT NOT NULL, `year13` FLOAT NOT NULL, PRIMARY KEY (`idPopulationByYearByProvince`)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `mydb`.`OntarioTopBabyNames` -- ----------------------------------------------------- DROP TABLE IF EXISTS `mydb`.`OntarioTopBabyNames` ; CREATE TABLE IF NOT EXISTS `mydb`.`OntarioTopBabyNames` ( `idOntarioTopBabyNames` INT NOT NULL AUTO_INCREMENT, `year` INT NOT NULL, `name` VARCHAR(45) NOT NULL, `frequency` INT NOT NULL, `gender` BIT NOT NULL, PRIMARY KEY (`idOntarioTopBabyNames`)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `mydb`.`LifeExpectency` -- ----------------------------------------------------- DROP TABLE IF EXISTS `mydb`.`LifeExpectency` ; CREATE TABLE IF NOT EXISTS `mydb`.`LifeExpectency` ( `idLifeExpectency` INT NOT NULL AUTO_INCREMENT, `year_from` INT NOT NULL, `year_to` INT NOT NULL, `province` VARCHAR(45) NOT NULL, `male_count` INT NOT NULL, `female_count` INT NOT NULL, PRIMARY KEY (`idLifeExpectency`)) ENGINE = InnoDB; SET SQL_MODE=@OLD_SQL_MODE; SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS; -- ----------------------------------------------------- -- Data for table `mydb`.`Manager` -- ----------------------------------------------------- START TRANSACTION; USE `mydb`; INSERT INTO `mydb`.`Manager` (`idManager`, `name`) VALUES (1, 'Bob Young'); INSERT INTO `mydb`.`Manager` (`idManager`, `name`) VALUES (2, 'Jim Carey'); INSERT INTO `mydb`.`Manager` (`idManager`, `name`) VALUES (3, 'Mark Ewing'); INSERT INTO `mydb`.`Manager` (`idManager`, `name`) VALUES (4, 'George Freeman'); INSERT INTO `mydb`.`Manager` (`idManager`, `name`) VALUES (5, 'Dorthy Tailer'); COMMIT; -- ----------------------------------------------------- -- Data for table `mydb`.`City` -- ----------------------------------------------------- START TRANSACTION; USE `mydb`; INSERT INTO `mydb`.`City` (`city_id`, `name`) VALUES (1, 'Toronto'); INSERT INTO `mydb`.`City` (`city_id`, `name`) VALUES (2, 'Vancouver'); INSERT INTO `mydb`.`City` (`city_id`, `name`) VALUES (3, 'Ottawa'); INSERT INTO `mydb`.`City` (`city_id`, `name`) VALUES (4, 'Victoria'); INSERT INTO `mydb`.`City` (`city_id`, `name`) VALUES (5, 'Ottawa'); COMMIT; -- ----------------------------------------------------- -- Data for table `mydb`.`Province` -- ----------------------------------------------------- START TRANSACTION; USE `mydb`; INSERT INTO `mydb`.`Province` (`province_id`, `city_id`, `name`) VALUES (1, 1, 'Ontario'); INSERT INTO `mydb`.`Province` (`province_id`, `city_id`, `name`) VALUES (2, 2, 'Ontario'); INSERT INTO `mydb`.`Province` (`province_id`, `city_id`, `name`) VALUES (3, 3, 'Ontario'); INSERT INTO `mydb`.`Province` (`province_id`, `city_id`, `name`) VALUES (4, 4, 'Ontario'); INSERT INTO `mydb`.`Province` (`province_id`, `city_id`, `name`) VALUES (5, 5, 'Ontario'); COMMIT; -- ----------------------------------------------------- -- Data for table `mydb`.`Store` -- ----------------------------------------------------- START TRANSACTION; USE `mydb`; INSERT INTO `mydb`.`Store` (`store_id`, `manager_id`, `province_id`) VALUES (1, 1, 1); INSERT INTO `mydb`.`Store` (`store_id`, `manager_id`, `province_id`) VALUES (2, 2, 1); INSERT INTO `mydb`.`Store` (`store_id`, `manager_id`, `province_id`) VALUES (3, 2, 1); INSERT INTO `mydb`.`Store` (`store_id`, `manager_id`, `province_id`) VALUES (4, 3, 1); INSERT INTO `mydb`.`Store` (`store_id`, `manager_id`, `province_id`) VALUES (5, 1, 1); COMMIT; -- ----------------------------------------------------- -- Data for table `mydb`.`Customer` -- ----------------------------------------------------- START TRANSACTION; USE `mydb`; INSERT INTO `mydb`.`Customer` (`customer_id`, `customer_name`, `dob`, `sex`) VALUES (1, 'Fred Gilton', '01-10-1985', 0); INSERT INTO `mydb`.`Customer` (`customer_id`, `customer_name`, `dob`, `sex`) VALUES (2, 'Jim Carey', '04-21-1988', 0); INSERT INTO `mydb`.`Customer` (`customer_id`, `customer_name`, `dob`, `sex`) VALUES (3, 'Tina Hawks', '07-12-1982', 1); INSERT INTO `mydb`.`Customer` (`customer_id`, `customer_name`, `dob`, `sex`) VALUES (4, 'Sarah Rodrigues', '19-11-1983', 1); INSERT INTO `mydb`.`Customer` (`customer_id`, `customer_name`, `dob`, `sex`) VALUES (5, 'Ivan Penny', '21-09-1984', 0); COMMIT; -- ----------------------------------------------------- -- Data for table `mydb`.`Product` -- ----------------------------------------------------- START TRANSACTION; USE `mydb`; INSERT INTO `mydb`.`Product` (`product_id`, `product_name`, `price`, `initialcost`) VALUES (1, 'Bayers Hockey Puck', 49.99, 23.99); INSERT INTO `mydb`.`Product` (`product_id`, `product_name`, `price`, `initialcost`) VALUES (2, 'York Graduation Plaque', 29.99, 4.89); INSERT INTO `mydb`.`Product` (`product_id`, `product_name`, `price`, `initialcost`) VALUES (3, 'Raptors Jersey', 59.99, 14.99); INSERT INTO `mydb`.`Product` (`product_id`, `product_name`, `price`, `initialcost`) VALUES (4, 'Maple Leaf Jersey', 22.99, 12.99); INSERT INTO `mydb`.`Product` (`product_id`, `product_name`, `price`, `initialcost`) VALUES (5, 'Fridge Magnet', 1.11, 0.05); INSERT INTO `mydb`.`Product` (`product_id`, `product_name`, `price`, `initialcost`) VALUES (6, 'Celtics Jersey', 22.83, 14.69); INSERT INTO `mydb`.`Product` (`product_id`, `product_name`, `price`, `initialcost`) VALUES (7, 'Ontario License', 120.99, 63.99); INSERT INTO `mydb`.`Product` (`product_id`, `product_name`, `price`, `initialcost`) VALUES (8, 'Children Bedroom Signs', 123.99, 52.22); COMMIT; -- ----------------------------------------------------- -- Data for table `mydb`.`ProductGroup` -- ----------------------------------------------------- START TRANSACTION; USE `mydb`; INSERT INTO `mydb`.`ProductGroup` (`productGroup_id`, `product_name`, `product_id`) VALUES (1, 'Personalized Golf Clubs', 1); INSERT INTO `mydb`.`ProductGroup` (`productGroup_id`, `product_name`, `product_id`) VALUES (2, 'Magnets', 2); INSERT INTO `mydb`.`ProductGroup` (`productGroup_id`, `product_name`, `product_id`) VALUES (3, 'Bedroom Door Signs', 3); INSERT INTO `mydb`.`ProductGroup` (`productGroup_id`, `product_name`, `product_id`) VALUES (4, 'Graduation Plaques', 4); INSERT INTO `mydb`.`ProductGroup` (`productGroup_id`, `product_name`, `product_id`) VALUES (5, 'Bedroom Door Signs', 5); INSERT INTO `mydb`.`ProductGroup` (`productGroup_id`, `product_name`, `product_id`) VALUES (6, 'Retirement Plaques', 6); INSERT INTO `mydb`.`ProductGroup` (`productGroup_id`, `product_name`, `product_id`) VALUES (7, 'Sports Jersey', 7); INSERT INTO `mydb`.`ProductGroup` (`productGroup_id`, `product_name`, `product_id`) VALUES (8, 'Custom License Plates', 8); COMMIT; -- ----------------------------------------------------- -- Data for table `mydb`.`Sales` -- ----------------------------------------------------- START TRANSACTION; USE `mydb`; INSERT INTO `mydb`.`Sales` (`sale_id`, `store_id`, `customer_id`, `productgroup_id`, `qty`, `year`) VALUES (1, 1, 5, 3, 7, 2014); INSERT INTO `mydb`.`Sales` (`sale_id`, `store_id`, `customer_id`, `productgroup_id`, `qty`, `year`) VALUES (2, 1, 3, 4, 1, 2014); INSERT INTO `mydb`.`Sales` (`sale_id`, `store_id`, `customer_id`, `productgroup_id`, `qty`, `year`) VALUES (3, 1, 2, 5, 4, 2014); INSERT INTO `mydb`.`Sales` (`sale_id`, `store_id`, `customer_id`, `productgroup_id`, `qty`, `year`) VALUES (4, 1, 1, 1, 4, 2014); INSERT INTO `mydb`.`Sales` (`sale_id`, `store_id`, `customer_id`, `productgroup_id`, `qty`, `year`) VALUES (5, 1, 4, 2, 2, 2014); COMMIT; -- ----------------------------------------------------- -- Data for table `mydb`.`AgeGroup` -- ----------------------------------------------------- START TRANSACTION; USE `mydb`; INSERT INTO `mydb`.`AgeGroup` (`ageGroup_id`, `name`, `begin`, `end`) VALUES (1, 'Infant/ Young Children', 0, 12); INSERT INTO `mydb`.`AgeGroup` (`ageGroup_id`, `name`, `begin`, `end`) VALUES (2, 'Teenagers / Young Adults', 13, 25); INSERT INTO `mydb`.`AgeGroup` (`ageGroup_id`, `name`, `begin`, `end`) VALUES (3, 'Adults', 26, 59); INSERT INTO `mydb`.`AgeGroup` (`ageGroup_id`, `name`, `begin`, `end`) VALUES (4, 'Elderly', 60, 999); COMMIT;
true
77ce8a98c898f005a7d309103a1f1a35388b8efe
SQL
brthiess/Cmput391
/html/php/Test.sql
UTF-8
483
3.8125
4
[]
no_license
--Testing ground for new query. Faster loading. SELECT (p.last_name||', '||p.first_name) AS nme, test_type, week, cnt FROM persons p RIGHT JOIN (SELECT rr.patient_id, rr.test_type, to_char(rr.test_date, 'yyyy') As week, COUNT(*) as cnt FROM radiology_record rr JOIN radiology_image pi ON rr.record_id = pi.record_id GROUP BY CUBE (rr.patient_id, rr.test_type, to_char(rr.test_date, 'yyyy'))) a ON p.person_id = a.patient_id;
true
0a22465f978af0fb2635629c7c63b381b669f4c6
SQL
Soroushb/DBS311
/L05_ID#152499182_Bahrami.sql
UTF-8
7,124
4.21875
4
[]
no_license
-- *********************** -- Name: Soroush Bahrami -- Student ID: 152499182 -- Date: 2020-11-11 -- Purpose: Lab 5 DBS311 -- *********************** SET SERVEROUTPUT ON; /* 1. Write a stored procedure that get an integer number and prints The number is even. If a number is divisible by 2. Otherwise, it prints The number is odd. */ CREATE OR REPLACE PROCEDURE isEven(number IN NUMBER) AS BEGIN IF number MOD 2 = 0 THEN DBMS_OUTPUT.PUT_LINE ('The number is even.'); ELSE DBMS_OUTPUT.PUT_LINE ('The number is odd.'); END IF; EXCEPTION WHEN TOO_MANY_ROWS THEN DBMS_OUTPUT.PUT_LINE ('Too Many Rows Returned!'); WHEN NO_DATA_FOUND THEN DBMS_OUTPUT.PUT_LINE ('No Data Found!'); WHEN OTHERS THEN DBMS_OUTPUT.PUT_LINE ('Error!'); END; / /* 2. Create a stored procedure named find_employee. This procedure gets an employee number and prints the employee information */ CREATE OR REPLACE PROCEDURE find_employee(employee_num IN NUMBER) AS firstName VARCHAR2(255 BYTE); lastName VARCHAR2(255 BYTE); email VARCHAR2(255 BYTE); phone VARCHAR2(255 BYTE); hireDate DATE; jobTitle VARCHAR2(255 BYTE); BEGIN SELECT first_name, last_name, email, phone_number, hire_date,job_id INTO firstName, lastName, email, phone, hireDate, jobTitle FROM EMPLOYEES WHERE employee_id = employee_num; DBMS_OUTPUT.PUT_LINE ('First name: ' || firstName); DBMS_OUTPUT.PUT_LINE ('Last name: ' || lastName ); DBMS_OUTPUT.PUT_LINE ('Email: ' || email || '@example.com' ); DBMS_OUTPUT.PUT_LINE ('Phone: ' || phone ); DBMS_OUTPUT.PUT_LINE ('Hire Date: ' || hireDate ); DBMS_OUTPUT.PUT_LINE ('Job title: ' || jobTitle ); EXCEPTION WHEN TOO_MANY_ROWS THEN DBMS_OUTPUT.PUT_LINE ('Too Many Rows Returned!'); WHEN NO_DATA_FOUND THEN DBMS_OUTPUT.PUT_LINE ('No Data Found!'); WHEN OTHERS THEN DBMS_OUTPUT.PUT_LINE ('Error!'); END; / /* 3. Write a procedure named update_price_tents to update the price of all products in a given type and the given amount to be added to the current selling price if the price is greater than 0. */ CREATE OR REPLACE PROCEDURE update_price_tents(Prod_type# IN VARCHAR2,amount products.prod_sell%type) AS rows_updated INTEGER; BEGIN UPDATE products SET prod_sell = (prod_sell + amount) WHERE prod_type# = PROD_TYPE AND prod_sell > 0; rows_updated := sql%rowcount; DBMS_OUTPUT.PUT_LINE('The number of affected rows is: ' || rows_updated); EXCEPTION WHEN TOO_MANY_ROWS THEN DBMS_OUTPUT.PUT_LINE ('Too Many Rows Returned!'); WHEN NO_DATA_FOUND THEN DBMS_OUTPUT.PUT_LINE ('No Data Found!'); WHEN OTHERS THEN DBMS_OUTPUT.PUT_LINE ('Error!'); END; / /* 4. increases the price of products by 1 or 2% (Example of 2% -- prod_sell * 1.02) based on if the selling price (prod_sell) is less than the average price of all products. */ CREATE OR REPLACE PROCEDURE update_low_prices_152499182 AS average products.prod_sell%type; rows_updated INTEGER; BEGIN SELECT AVG(prod_sell) INTO average FROM products; IF average <= 1000 THEN UPDATE products SET prod_sell = (prod_sell * 1.02) WHERE prod_sell < average; ELSIF average > 1000 THEN UPDATE products SET prod_sell = (prod_sell * 1.01) WHERE prod_sell < average; END IF; rows_updated := sql%rowcount; DBMS_OUTPUT.PUT_LINE('*** OUTPUT update_low_prices_123456789 STARTED ***' || CHR(13) || CHR(10) || 'The number of affected rows is: ' || rows_updated || CHR(13) || CHR(10) || '----ENDED----'); EXCEPTION WHEN TOO_MANY_ROWS THEN DBMS_OUTPUT.PUT_LINE ('Too Many Rows Returned!'); WHEN NO_DATA_FOUND THEN DBMS_OUTPUT.PUT_LINE ('No Data Found!'); WHEN OTHERS THEN DBMS_OUTPUT.PUT_LINE ('Error!'); END; / /* 5. Write a procedure named price_report_123456789 to show the number of products in each price category */ CREATE OR REPLACE PROCEDURE price_report_152499182 AS avg_price products.prod_sell%type; min_price products.prod_sell%type; max_price products.prod_sell%type; low_count INTEGER; fair_count INTEGER; high_count INTEGER; BEGIN low_count := 0; fair_count := 0; high_count := 0; SELECT AVG(prod_sell) INTO avg_price FROM products; SELECT MIN(prod_sell) INTO min_price FROM products; SELECT MAX(prod_sell) INTO max_price FROM products; SELECT COUNT(prod_sell) INTO low_count FROM products where prod_sell < (avg_price - min_price) / 2; SELECT COUNT(prod_sell) INTO high_count FROM products WHERE prod_sell > (max_price - avg_price) / 2; SELECT COUNT(prod_sell) INTO fair_count FROM PRODUCTS WHERE prod_sell BETWEEN (avg_price - min_price) / 2 AND (max_price - avg_price) / 2; DBMS_OUTPUT.PUT_LINE('*** OUTPUT price_report_152499182 STARTED ***' || CHR(13) || CHR(10) || 'Low: ' || low_count || CHR(13) || CHR(10) || 'Fair: ' || fair_count || CHR(13) || CHR(10) || 'High: ' || high_count || CHR(13) || CHR(10) ||'----ENDED----'); EXCEPTION WHEN TOO_MANY_ROWS THEN DBMS_OUTPUT.PUT_LINE ('Too Many Rows Returned!'); WHEN NO_DATA_FOUND THEN DBMS_OUTPUT.PUT_LINE ('No Data Found!'); WHEN OTHERS THEN DBMS_OUTPUT.PUT_LINE ('Error!'); END; / CREATE OR REPLACE PROCEDURE find_customer(customer_id IN NUMBER, found OUT NUMBER) AS isFound NUMBER := 1; BEGIN SELECT isFound INTO found FROM customers WHERE customer_id = cust_no; EXCEPTION WHEN no_data_found THEN found:= 0; END; / CREATE OR REPLACE PROCEDURE find_product(product_id IN NUMBER, price OUT products.prod_sell%TYPE) AS BEGIN SELECT prod_sell INTO price FROM products WHERE product_id = prod_no; EXCEPTION WHEN no_data_found THEN price := 0; END; / CREATE OR REPLACE PROCEDURE add_order(customer_id IN NUMBER, new_order_id OUT NUMBER) AS maxId NUMBER; BEGIN SELECT MAX(order_no) INTO maxId FROM orders; new_order_id := maxId + 1; INSERT INTO orders(order_no, cust_no, status, rep_no, order_dt) VALUES(new_order_id, customer_id, 'C', 36, SYSDATE); END; Declare amount NUMBER; Begin add_order(1000, amount); end; / ROLLBACK; CREATE OR REPLACE PROCEDURE add_orderline(orderId IN orderlines.order_no%type, itemId IN orderlines.line_no%type, productId IN orderlines.prod_no%type, quantity IN orderlines.qty%type, price IN orderlines.price%type) AS BEGIN INSERT INTO orderlines(order_no, line_no, prod_no, qty, price) VALUES(orderId, itemId, productId, quantity, price); END; BEGIN add_orderline(1,1,1,1,1); END; ROLLBACK; CREATE OR REPLACE PROCEDURE increase(price IN OUT NUMBER) AS BEGIN price := price * (1.10); END; declare price NUMBER := 10; BEGIN increase(price); DBMS_OUTPUT.PUT_LINE ('price'); end;
true
50671146f7d5dc2aa0d5584f7e26a427ae193516
SQL
missTam/Library-App
/resources/scripts/sqlite_create_db.sql
UTF-8
857
3.34375
3
[]
no_license
-- Autorin: Tamara T. -- am/um: 2020-05-12 -- Typ: SQLite CREATE TABLE authors ( _id INTEGER PRIMARY KEY , first_name VARCHAR NOT NULL , last_name VARCHAR NOT NULL ); CREATE TABLE genres ( _id INTEGER PRIMARY KEY , name VARCHAR NOT NULL ); CREATE TABLE books ( _id INTEGER PRIMARY KEY , title VARCHAR NOT NULL , publication_year INTEGER , library_card INTEGER , author INTEGER NOT NULL, FOREIGN KEY (library_card) REFERENCES library_cards (_id) , FOREIGN KEY (author) REFERENCES authors (_id) ); CREATE TABLE library_cards ( _id INTEGER PRIMARY KEY , first_name VARCHAR NOT NULL , last_name VARCHAR NOT NULL , valid_until DATE NOT NULL ); CREATE TABLE relation ( book INTEGER NOT NULL , genre INTEGER NOT NULL );
true
e2211a39886c02f7c655a523f78dbec50af9d8bb
SQL
tsengting/CNN-Takehome
/Tests.sql
UTF-8
1,665
4.09375
4
[]
no_license
/* Top 5 pieces of content */ SELECT Content_Id, COUNT(Content_Id) AS counts FROM Content_Metadata GROUP BY Content_Id ORDER BY counts DESC LIMIT 5; /* Aggregations across a rolling 30,60,90 days */ SELECT Content_Id, Content_type, COUNT(CASE WHEN DATE_DIFF(day,Creation_Date,date) <= 30 THEN Content_id END) as Content_30, COUNT(CASE WHEN DATE_DIFF(day,Creation_Date,date) <= 60 THEN Content_id END) as Content_60, COUNT(CASE WHEN DATE_DIFF(day,Creation_Date,date) <= 90 THEN Content_id END) as Content_90 FROM Content_Metadata GROUP BY Content_Id; /* Averate user session duration trends */ SELECT Ads_User_Id, AVG(Dwell_Time) AS Duration FROM Ad_Service_Interaction_Data GROUP BY Ads_User_Id ORDER BY Duration DESC; /* Follow user Journeys for registration conversion */ SELECT * FROM Registered_Users ORDER BY Register_Date, Last_Access_Time; /* Generate user segments based on content */ SELECT P.Ads_Users_Id, P.Content_Id, P.Timestamp, C.Content_Type, C.Creation_Date, C.Related_Media FROM Page_Impression P LEFT JOIN Content_Metadata C ON P.Content_Id = C.Content_Id GROUP BY P.Ads_Users_Id ORDER BY P.Timestamp; /* Generate dashboards to represent registered vs non-registered users */ /* Registered Users */ SELECT A.Ads_User_Id FROM Ad_Service_Interaction_Data A LEFT JOIN OAuth_Id_Service O ON A.Ads_User_Id = O.Ads_User_Id LEFT JOIN Registered_Users R ON O.OAuth_Id = R.OAuth_Id WHERE R.Register_Date IS NOT NULL; /* Non-Registered Users */ SELECT A.Ads_User_Id FROM Ad_Service_Interaction_Data A LEFT JOIN OAuth_Id_Service O ON A.Ads_User_Id = O.Ads_User_Id LEFT JOIN Registered_Users R ON O.OAuth_Id = R.OAuth_Id WHERE R.Register_Date IS NULL;
true
b45a8f057280fedef9b999e8f2ba4d163a9cb529
SQL
downfang888/coffcms
/data/backup/v1.3.0/sql/v1.3.0.sql
UTF-8
3,861
3.46875
3
[]
no_license
UPDATE `ey_arcrank` SET `name` = '开放浏览', `update_time` = 1552376880 WHERE `rank` = '0'; UPDATE `ey_arcrank` SET `name` = '待审核稿件', `update_time` = 1552376880 WHERE `rank` = '-1'; ALTER TABLE `ey_admin_log` MODIFY COLUMN `log_info` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '日志描述' AFTER `admin_id`; ALTER TABLE `ey_admin_log` MODIFY COLUMN `log_ip` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT 'ip地址' AFTER `log_info`; ALTER TABLE `ey_admin_log` MODIFY COLUMN `log_url` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT 'url' AFTER `log_ip`; ALTER TABLE `ey_admin_log` MODIFY COLUMN `log_time` int(11) NULL DEFAULT 0 COMMENT '日志时间' AFTER `log_url`; UPDATE `ey_admin_log` SET `admin_id` = -1 WHERE `admin_id` is NULL OR `admin_id` = '' OR `admin_id` = 0; ALTER TABLE `ey_guestbook` ADD COLUMN `md5data` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '数据序列化之后的MD5加密,提交内容的唯一性' AFTER `channel`; ALTER TABLE `ey_channeltype` ADD COLUMN `is_repeat_title` tinyint(1) NULL DEFAULT 1 COMMENT '文档标题重复,1=允许,0=不允许' AFTER `ifsystem`; ALTER TABLE `ey_weapp` ADD COLUMN `position` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT 'default' COMMENT '插件位置' AFTER `thorough`; ALTER TABLE `ey_admin_log` MODIFY COLUMN `admin_id` int(10) NOT NULL DEFAULT '-1' COMMENT '管理员id' AFTER `log_id`; DROP TABLE IF EXISTS `ey_smtp_record`; CREATE TABLE `ey_smtp_record` ( `record_id` int(10) NOT NULL AUTO_INCREMENT COMMENT '自增ID', `source` tinyint(1) DEFAULT '0' COMMENT '来源,与场景ID对应:0=默认,2=注册,3=绑定邮箱,4=找回密码', `email` varchar(50) DEFAULT '' COMMENT '邮件地址', `users_id` int(10) DEFAULT '0' COMMENT '用户ID', `code` varchar(20) DEFAULT '' COMMENT '发送邮件内容', `status` tinyint(1) DEFAULT '0' COMMENT '是否使用,默认0,0为未使用,1为使用', `lang` varchar(50) DEFAULT 'cn' COMMENT '语言标识', `add_time` int(11) DEFAULT '0' COMMENT '新增时间', `update_time` int(11) DEFAULT '0' COMMENT '更新时间', PRIMARY KEY (`record_id`) ) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='邮件发送记录表'; DROP TABLE IF EXISTS `ey_smtp_tpl`; CREATE TABLE `ey_smtp_tpl` ( `tpl_id` int(10) NOT NULL AUTO_INCREMENT COMMENT '自增ID', `tpl_name` varchar(200) DEFAULT '' COMMENT '模板名称', `tpl_title` varchar(200) DEFAULT '' COMMENT '邮件标题', `tpl_content` text COMMENT '发送邮件内容', `send_scene` tinyint(1) DEFAULT '0' COMMENT '邮件发送场景(1=留言表单)', `is_open` tinyint(1) DEFAULT '0' COMMENT '是否开启使用这个模板,1为是,0为否。', `lang` varchar(50) DEFAULT 'cn' COMMENT '语言标识', `add_time` int(11) DEFAULT '0' COMMENT '添加时间', `update_time` int(11) DEFAULT '0' COMMENT '更新时间', PRIMARY KEY (`tpl_id`) ) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='邮件模板表'; INSERT INTO `ey_smtp_tpl` VALUES ('1', '留言表单', '您有新的留言消息,请查收!', '${content}', '1', '1', 'cn', '1544763495', '1552638302'); INSERT INTO `ey_smtp_tpl` VALUES ('2', '会员注册', '验证码已发送至您的邮箱,请登录邮箱查看验证码!', '${content}', '2', '1', 'cn', '1544763495', '1552667056'); INSERT INTO `ey_smtp_tpl` VALUES ('3', '绑定邮箱', '验证码已发送至您的邮箱,请登录邮箱查看验证码!', '${content}', '3', '1', 'cn', '1544763495', '1552667400'); INSERT INTO `ey_smtp_tpl` VALUES ('4', '找回密码', '验证码已发送至您的邮箱,请登录邮箱查看验证码!', '${content}', '4', '1', 'cn', '1544763495', '1552663577');
true
a1c9acf6cbe5def08fff65533c6b35269ea91f87
SQL
dpk3d/Hive
/EvenScores.sql
UTF-8
428
3.921875
4
[]
no_license
-- Write a query to print the name of the students who scored an even number of marks -- The Names should be listed in upper case alphabatecally ascending. -- This was asked in VISA for DEVELOPER via hackerrank. -- Schema -- NAME STRING -- MARKS INTEGER select upper(e.name), e.marks from (select name , marks, case when mod(marks,2) = 0 then "even" else "odd" end as type from exam) e where e.type = "even" order by e.name;
true
9866ce63c4d8708c050cc012dd1e832cca9d5c78
SQL
FWAJL/FieldWorkManager
/Database/Scripts/Updates/2015-04-27.sql
UTF-8
356
3.09375
3
[]
no_license
-- Update for 2015-04-27 -- > updates to tables to make the email value unique USE baiken_fwm_1; ALTER TABLE `user` ADD COLUMN `user_email` VARCHAR(50) NOT NULL COMMENT 'User email that is unique and must be set'; update `user` set `user_email` = `user_login` where `user_id` > 0; ALTER TABLE `user` ADD UNIQUE INDEX `un_user_email` (`user_email` ASC);
true
655cc07c762f72c6071ba1d6767e46bb802b6d20
SQL
alexrook/vio
/vio-mo/src/scripts/entangling.sql
UTF-8
924
2.8125
3
[]
no_license
/* entangling names in document table */ update document set name='Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus' where id%2=0; update document set name='Curabitur ullamcorper ultricies nisi. Nam eget dui. Etiam rhoncus. Maecenas tempus, tellus eget condimentum rhoncus, sem quam semper libero, sit amet adipiscing sem neque sed ipsum' where id%3=0; update document set name='One morning, when Gregor Samsa woke from troubled dreams, he found himself transformed in his bed into a horrible vermin. He lay on his armour-like back, and if he lifted his head a little he' where id%5=0; update document set name='A wonderful serenity has taken possession of my entire soul, like these sweet mornings of spring which I enjoy with my whole heart' where not (id%2=0 or id%3=0 or id%5=0);
true
764efbfd61e8016726f00c9e0f3f8362487754fe
SQL
kenan2016/SQL
/记录型变量.sql
GB18030
776
2.8125
3
[]
no_license
-- ¼ͱ -- עIJѯֶλ * ᱨ set serveroutput on; declare emp_rec emp%rowtype; begin select EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, COMM, DEPTNO into emp_rec from emp WHERE empno =7839 ; dbms_output.put_line(emp_rec.sal); end; / --//test_table DZѯʱȫд -- ѯֶ -- select tt.column_name from user_col_comments tt where tt.table_name=upper('emp'); -- select tt.column_name from user_col_comments tt where tt.table_name = upper('emp')
true
7e4cff36e3e059ad4ef069835a97d4819d2a1b80
SQL
Borrya/pre-assignment-tasks
/task_1/request_8.sql
UTF-8
464
4.46875
4
[]
no_license
SELECT name, first_name, last_name FROM ( SELECT name, first_name, last_name, rank() OVER( PARTITION BY allNames.name ORDER BY first_name) FROM ( SELECT training_course.name, student.first_name, student.last_name FROM training_course RIGHT JOIN student_result ON training_course.id = student_result.training_course_id RIGHT JOIN student ON student_result.student_id = student.id WHERE student_result.result = 10) AS allNames ) AS rank_filter WHERE RANK <= 5
true
24562a96408b35ee807a5e8354b9552f3a5544a0
SQL
tehaa/restaurant
/restaurant.sql
UTF-8
4,080
3.390625
3
[]
no_license
-- MySQL dump 10.13 Distrib 8.0.19, for Linux (x86_64) -- -- Host: localhost Database: restaurant -- ------------------------------------------------------ -- Server version 8.0.19 /*!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 */; /*!50503 SET NAMES utf8mb4 */; /*!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 `booking` -- DROP TABLE IF EXISTS `booking`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `booking` ( `id` bigint NOT NULL AUTO_INCREMENT, `book_date` bigint DEFAULT NULL, `insert_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `number_of_persons` int DEFAULT NULL, `user_id` bigint DEFAULT NULL, `table_id` bigint DEFAULT NULL, PRIMARY KEY (`id`), KEY `fk_booking_1_idx` (`user_id`), KEY `fk_booking_2_idx` (`table_id`), CONSTRAINT `fk_booking_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`), CONSTRAINT `fk_booking_2` FOREIGN KEY (`table_id`) REFERENCES `tables` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `booking` -- LOCK TABLES `booking` WRITE; /*!40000 ALTER TABLE `booking` DISABLE KEYS */; /*!40000 ALTER TABLE `booking` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `tables` -- DROP TABLE IF EXISTS `tables`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `tables` ( `id` bigint NOT NULL AUTO_INCREMENT, `number` int NOT NULL, `max_number_of_persons` int DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `tables` -- LOCK TABLES `tables` WRITE; /*!40000 ALTER TABLE `tables` DISABLE KEYS */; INSERT INTO `tables` VALUES (1,1,2),(2,2,2),(3,3,2),(4,4,2),(5,5,5),(6,6,5),(7,7,5),(8,8,5),(9,9,5),(10,10,5),(11,11,5),(12,12,10),(13,13,10); /*!40000 ALTER TABLE `tables` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `users` -- DROP TABLE IF EXISTS `users`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `users` ( `id` bigint NOT NULL AUTO_INCREMENT, `name` varchar(100) NOT NULL, `username` varchar(100) NOT NULL, `password` varchar(100) NOT NULL, `mobile_number` varchar(20) DEFAULT NULL, `role` varchar(45) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `users` -- LOCK TABLES `users` WRITE; /*!40000 ALTER TABLE `users` DISABLE KEYS */; INSERT INTO `users` VALUES (1,'ahmed','ahmed','$2a$10$70hh1XmemylBVCcmj/czhu1MJD3dXWq4N6Ki1d6E2GsGpLmJbNlwO','12345','ADMIN'),(2,'mohamed','mohamed','$2a$10$70hh1XmemylBVCcmj/czhu1MJD3dXWq4N6Ki1d6E2GsGpLmJbNlwO','333444','USER'); /*!40000 ALTER TABLE `users` ENABLE KEYS */; UNLOCK TABLES; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; -- Dump completed on 2020-04-19 20:06:50
true
12520a803b62cfa31a72eb54ad1c669f1a7d0bbc
SQL
npv14/Relational-Database-Systems
/marina-script.sql
UTF-8
4,169
3.1875
3
[]
no_license
drop table service; drop table slip; drop table boat_owner; drop table marina; /* Creating tables */ create table marina (id integer not null constraint check_marinaid check (id > 0), name varchar(30) not null, address varchar(50) not null, constraint pk_marina primary key (id)); create table boat_owner (OwnerNo integer not null constraint check_owner check (OwnerNo > 0), Fname varchar(15) not null, Lname varchar(15) not null, Address varchar (50) not null, constraint pk_owner primary key (OwnerNo)); create table Slip (SlipId integer not null constraint check_slip check (SlipId > 0), Marina integer not null constraint slip_fk1 references marina, Length /* length in feet */ integer not null constraint check_length check (length between 5 and 50), Fee number not null, Boat varchar(12), Type varchar(15), Owner integer constraint slip_fk2 references Boat_Owner, constraint slip_pk primary key (SlipId,Marina)); create table Service (type integer not null check (type > 0) primary key, description varchar(30) not null); /* Populating the MARINA table */ insert into marina values(1,'Picton','Port Marlborough PO Box 111 Picton'); insert into marina values(2,'Waikawa','Port Marlborough PO Box 112 Picton'); insert into marina values(3,'Havelock','Port Marlborough PO Box 113 Picton'); insert into marina values(4,'Nelson','Nelson marina PO Box 645 Nelson'); insert into marina values(5,'Tarakohe','Port GOlden Bay 189 Queen Street Richmond'); /* Populating the BOAT_OWNER table */ insert into boat_owner values(1,'Bruce','Adney','208 Citrus Avenue Richmond'); insert into boat_owner values(2,'Bill','Anderson','18 Wilcox Nelson'); insert into boat_owner values(3,'Mary','Blake','263 Commodore Rd Nelson'); insert into boat_owner values(4,'Sandy','Elend','462 Riverside Christchurch'); insert into boat_owner values(5,'Daniel','Feenstra','72 Queen St Dunedin'); insert into boat_owner values(6,'Maria','White','81 Oak Ave Richmond'); insert into boat_owner values(7,'Alyssa','Kelly','12 Waters Cres Nelson'); insert into boat_owner values(8,'Peter','Norton','9 Garland St Picton'); insert into boat_owner values(9,'David','Smeltz','13 Lakewood Rd Picton'); insert into boat_owner values(10,'Ashton','Trent','2 Bay Shore Christchurch'); /* Populating the SLIP table */ insert into slip values(1,1,40,3800,'Anderson II','Sprite 4000',2); insert into slip values(2,1,40,3600,'Mermaid','Dolphin 25',3); insert into slip values(3,1,30,2800,null,null,null); insert into slip values(4,1,25,2200,'Anderson III','Dolphin 25',2); insert into slip values(1,2,30,2800,null,null,null); insert into slip values(2,2,30,2900,'Gypsy','Sprite 3000',4); insert into slip values(3,2,25,2500,'South Sky','Ray 4025',5); insert into slip values(1,3,25,2600,'Mariana','Dolphin 25',6); insert into slip values(2,3,30,3200,'My Pride','Sprite 3000',7); insert into slip values(3,3,40,4200,'Escape','Sprite 4000',1); insert into slip values(4,3,40,4100,null,null,null); insert into slip values(1,4,25,1500,'Axxon II','Dolphin 25',9); insert into slip values(2,4,25,1600,null,null,null); insert into slip values(3,4,25,1450,'Listy','Dolphin 22',8); insert into slip values(4,4,30,2200,'Bravo','Dolphin 28',10); insert into slip values(5,1,40,4000,'Lucky Star','Sprite 4000',1); insert into slip values(5,2,30,2400,null,null,null); insert into slip values(5,3,40,4100,null,null,null); /* Populating the SERVICE table */ insert into service values(1,'routine engine maintenance'); insert into service values(2,'engine repair'); insert into service values(3,'air conditioning'); insert into service values(4,'electrical systems'); insert into service values(5,'fiberglass repair'); insert into service values(6,'canvas installation'); insert into service values(7,'canvas repair'); insert into service values(8,'electronic systems'); select fname, lname, type, count(*) from boat_owner join slip on OwnerNo = Owner group by type, fname, lname having count(*) >= 2;
true
d278a6b9f1ea9aa59916adcdd9ef6da62a7bca95
SQL
ivanred6/cfg_s20rckds1
/Session 4/sql scripts/table_locking_examples.sql
UTF-8
1,222
3.6875
4
[ "MIT" ]
permissive
CREATE DATABASE practice; USE practice; -- a sample table ( can be anything) CREATE TABLE conversation_log ( id INT NOT NULL AUTO_INCREMENT, message VARCHAR(50) NOT NULL, author VARCHAR(25) NOT NULL, PRIMARY KEY (id) ); -- let's add some values to the table INSERT INTO conversation_log (message,author) VALUES('I am tweeting', 'student1'); -- check what we have in the table so far SELECT * FROM conversation_log; -- obtain the READ lock LOCK TABLE conversation_log READ; -- try inserting new values again - it would FAIL, becuase we have obtained READ lock in this session INSERT INTO conversation_log (message,author) VALUES('I want to insert a new log message', 'student2'); -- drop all locks UNLOCK TABLES; -- try inserting messages again INSERT INTO conversation_log (message,author) VALUES('I want to insert a new log message', 'student2'); -- NB: if we would have commented to the DB from a different session and tried to insert a message/values -- it would NOT Error, but it would be 'suspended', i.e. put in the queue, waiting for the LOCK to be dropped. SELECT * FROM conversation_log; -- (optional if you want to get rid of this DB) DROP DATABASE practice;
true
891f928e3d06ab287ad5db7433a32b8305aca18e
SQL
MrD0079/portal
/sql/anketa_lang_form.sql
UTF-8
259
2.609375
3
[]
no_license
/* Formatted on 05/03/2015 11:19:20 (QP5 v5.227.12220.39724) */ SELECT l.id, l.name, al.lang_level FROM lang l, (SELECT * FROM anketa_lang WHERE tn = :tn OR h_eta = :h_eta) al WHERE l.id = al.lang_id(+) ORDER BY l.name
true
af01f41b119804630451a322a46deb731b4f046b
SQL
Moidrh/planetasBack
/src/main/resources/schema.sql
UTF-8
612
3.4375
3
[]
no_license
create table `Planeta` ( `planeta_id` integer not null AUTO_INCREMENT, `name` varchar(255) not null, `contador` integer, `rotacion` integer, `diametro` integer, `clima` varchar(255), `terreno` varchar(255), primary key (planeta_id) ) ; create table `Persona` ( `id` integer not null, `name` varchar(255) not null, `planeta_id` integer not null, `edad` integer not null, `estatura` integer, `peso` integer, `sexo` varchar(1), `contador` integer, `fechaNacimiento` timestamp, primary key (`id`), CONSTRAINT `planeta_persona` FOREIGN KEY (`planeta_id`) REFERENCES `Planeta` (`planeta_id`) );
true
fa1a2143af39bc01bc1672b44c356a9b952fb0c0
SQL
DaveKaito/Aurora
/aurora.sql
UTF-8
2,828
3.234375
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 4.8.5 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Generation Time: Jun 17, 2019 at 12:19 AM -- Server version: 10.1.38-MariaDB -- PHP Version: 7.3.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: `aurora` -- -- -------------------------------------------------------- -- -- Table structure for table `blog` -- CREATE TABLE `blog` ( `id` int(11) NOT NULL, `title` varchar(45) COLLATE latin1_bin NOT NULL, `creator` varchar(45) COLLATE latin1_bin NOT NULL, `date` varchar(45) COLLATE latin1_bin NOT NULL, `bdesc` text COLLATE latin1_bin NOT NULL, `tag` tinytext COLLATE latin1_bin NOT NULL, `imglink` mediumtext COLLATE latin1_bin NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_bin; -- -- Dumping data for table `blog` -- INSERT INTO `blog` (`id`, `title`, `creator`, `date`, `bdesc`, `tag`, `imglink`) VALUES (144, 'About_Me', 'asdf', 'Sun-06-2019 23:10', 'asdf', 'Photography', 'https://horizon-media.s3-eu-west-1.amazonaws.com/s3fs-public/field/image/ecosystem.jpg'); -- -------------------------------------------------------- -- -- Table structure for table `users` -- CREATE TABLE `users` ( `id` int(11) NOT NULL, `username` varchar(50) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL, `email` varchar(100) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL, `password` varchar(255) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL, `is_admin` tinyint(1) NOT NULL, `is_user` tinyint(1) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `users` -- INSERT INTO `users` (`id`, `username`, `email`, `password`, `is_admin`, `is_user`) VALUES (28, 'admin', '[email protected]', '$2y$10$dldxCvGpW3iaCL6oaPwuPeWOD06Ps40UhYI8pG7RpJxfza4wEilNO', 1, 0), (43, 'mruckstuhl', '[email protected]', '$2y$10$fyHKEEJt5J/f9ctXHAnBqu9/zxxRqydTuKO.0rtaldG6IcQ81b2Qe', 0, 1); -- -- Indexes for dumped tables -- -- -- Indexes for table `blog` -- ALTER TABLE `blog` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `title` (`title`); -- -- Indexes for table `users` -- ALTER TABLE `users` ADD PRIMARY KEY (`id`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `blog` -- ALTER TABLE `blog` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=147; -- -- AUTO_INCREMENT for table `users` -- ALTER TABLE `users` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=44; 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
4cd815d6e12e6e0e2020aed3cce91930cc6d3796
SQL
msw822/xjny_dev
/xjny_version/dw_hadoop/table/app/edu_app_ykt_rsxfjl.sql
UTF-8
869
2.765625
3
[]
no_license
--一卡通 use app; drop TABLE IF EXISTS edu_app_ykt_rsxfjl; CREATE EXTERNAL TABLE edu_app_ykt_rsxfjl( sfrzm string comment '身份认证码' ,sflx string comment '身份类型' ,xm string comment '姓名' ,xb string comment '性别' ,rsxfsj string comment '热水消费时间 消费日期.格式2018-03-09 08:13:17 ' ,rsxfdd string comment '热水消费地点' ,ysl double comment '用水量' ,yssc string comment '用水时长' ,xfje string comment '消费金额' )comment '[热水消费记录]本表存储每个师生历史每次热水消费记录' PARTITIONED BY ( dt string) row format delimited fields terminated by '\t' STORED AS orc TBLPROPERTIES('orc.compress'='SNAPPY');
true
bb523121c2e22262dde5444af0b3b83f3ba4841a
SQL
j7ng/CLFY_SA
/SA/Views/TABLE_RC_USER.sql
UTF-8
991
3.359375
3
[]
no_license
CREATE OR REPLACE FORCE VIEW sa.table_rc_user (user_id,rc_name,login_name,s_login_name,first_name,s_first_name,last_name,s_last_name) AS select table_user.objid, table_rc_config.name, table_user.login_name, table_user.S_login_name, table_employee.first_name, table_employee.S_first_name, table_employee.last_name, table_employee.S_last_name from table_user, table_rc_config, table_employee where table_rc_config.objid = table_user.user2rc_config AND table_user.objid = table_employee.employee2user ; COMMENT ON TABLE sa.table_rc_user IS 'Used by form Resource Config <Title> (10043), <Configuration> Membership (10044)'; COMMENT ON COLUMN sa.table_rc_user.user_id IS 'User object ID'; COMMENT ON COLUMN sa.table_rc_user.rc_name IS 'Name of the resource configuration'; COMMENT ON COLUMN sa.table_rc_user.login_name IS 'User login name'; COMMENT ON COLUMN sa.table_rc_user.first_name IS 'Employee first name'; COMMENT ON COLUMN sa.table_rc_user.last_name IS 'Employee last name';
true
485be27f331faae9aa5369217cbe786b70546a68
SQL
rocketeer55/Databases-Lab3
/CARS/CARS-setup.sql
UTF-8
797
3.484375
3
[]
no_license
-- Jackson Goyette, Spencer Schurk -- Lab 2, CSC 365, CARS dataset CREATE TABLE CARMAKERS( ID INTEGER PRIMARY KEY, MAKER CHAR(30), FULLNAME CHAR(30), COUNTRY INTEGER REFERENCES COUNTRIES(COUNTRYID)); CREATE TABLE CARNAMES( MAKEID INTEGER PRIMARY KEY, MODEL CHAR(30) REFERENCES MODELLIST(MODEL), MAKEDESCRIPTION CHAR(60)); CREATE TABLE CARSDATA( ID INT PRIMARY KEY REFERENCES CARNAMES(MAKEID), MPG FLOAT, CYLINDERS INT, EDISPL FLOAT, HORSEPOWER FLOAT, WEIGHT FLOAT, ACCELERATE FLOAT, YEAR INT); CREATE TABLE CONTINENTS( CONTID INT PRIMARY KEY, CONTINENT CHAR(30)); CREATE TABLE COUNTRIES( COUNTRYID INT PRIMARY KEY, COUNTRYNAME CHAR(30), CONTINENT INT REFERENCES CONTINENTS(CONTID)); CREATE TABLE MODELLIST( MODELID INT PRIMARY KEY, MAKER INT REFERENCES CARMAKERS(ID), MODEL CHAR(30));
true
e38dc5ae0c3a1fd313cee129f483cd8e483d717e
SQL
IvanaParrilla/Homework5
/db/init.sql
UTF-8
5,410
2.875
3
[]
no_license
CREATE DATABASE oscarData; use oscarData; CREATE TABLE IF NOT EXISTS OscarAgeFemale ( `Index` INT, `Year` INT, `Age` INT, `Name` VARCHAR(22) CHARACTER SET utf8, `Movie` VARCHAR(35) CHARACTER SET utf8, `Column_6` VARCHAR(48) CHARACTER SET utf8 ); INSERT INTO OscarAgeFemale VALUES ( 1, 1928, 22,' "Janet Gaynor"',' "Seventh Heaven',' Street Angel and Sunrise: A Song of Two Humans"'), ( 2, 1929, 37,' "Mary Pickford"',' "Coquette"',NULL), ( 3, 1930, 28,' "Norma Shearer"',' "The Divorcee" ',NULL), ( 4, 1931, 63,' "Marie Dressler"',' "Min and Bill"',NULL), ( 5, 1932, 32,' "Helen Hayes"',' "The Sin of Madelon Claudet" ',NULL), ( 6, 1933, 26,' "Katharine Hepburn"',' "Morning Glory"',NULL), ( 7, 1934, 31,' "Claudette Colbert"',' "It Happened One Night"',NULL), ( 8, 1935, 27,' "Bette Davis"',' "Dangerous"',NULL), ( 9, 1936, 27,' "Luise Rainer"',' "The Great Ziegfeld"',NULL), (10, 1937, 28,' "Luise Rainer"',' "The Good Earth"',NULL), (11, 1938, 30,' "Bette Davis"',' "Jezebel"',NULL), (12, 1939, 26,' "Vivien Leigh"',' "Gone with the Wind"',NULL), (13, 1940, 29,' "Ginger Rogers"',' "Kitty Foyle"',NULL), (14, 1941, 24,' "Joan Fontaine"',' "Suspicion" ',NULL), (15, 1942, 38,' "Greer Garson"',' "Mrs. Miniver"',NULL), (16, 1943, 25,' "Jennifer Jones"',' "The Song of Bernadette"',NULL), (17, 1944, 29,' "Ingrid Bergman"',' "Gaslight"',NULL), (18, 1945, 40,' "Joan Crawford"',' "Mildred Pierce"',NULL), (19, 1946, 30,' "Olivia de Havilland"',' "To Each His Own"',NULL), (20, 1947, 35,' "Loretta Young"',' "The Farmer''s Daughter"',NULL), (21, 1948, 32,' "Jane Wyman"',' "Johnny Belinda"',NULL), (22, 1949, 33,' "Olivia de Havilland"',' "The Heiress"',NULL), (23, 1950, 29,' "Judy Holliday"',' "Born Yesterday"',NULL), (24, 1951, 38,' "Vivien Leigh"',' "A Streetcar Named Desire"',NULL), (25, 1952, 54,' "Shirley Booth"',' "Come Back',' Little Sheba"'), (26, 1953, 24,' "Audrey Hepburn"',' "Roman Holiday"',NULL), (27, 1954, 25,' "Grace Kelly"',' "The Country Girl"',NULL), (28, 1955, 48,' "Anna Magnani"',' "The Rose Tattoo"',NULL), (29, 1956, 41,' "Ingrid Bergman"',' "Anastasia"',NULL), (30, 1957, 28,' "Joanne Woodward"',' "The Three Faces of Eve"',NULL), (31, 1958, 41,' "Susan Hayward"',' "I Want to Live!"',NULL), (32, 1959, 39,' "Simone Signoret"',' "Room at the Top"',NULL), (33, 1960, 29,' "Elizabeth Taylor"',' "BUtterfield 8"',NULL), (34, 1961, 27,' "Sophia Loren"',' "Two Women"',NULL), (35, 1962, 31,' "Anne Bancroft"',' "The Miracle Worker"',NULL), (36, 1963, 31,' "Patricia Neal"',' "Hud"',NULL), (37, 1964, 29,' "Julie Andrews"',' "Mary Poppins"',NULL), (38, 1965, 25,' "Julie Christie"',' "Darling"',NULL), (39, 1966, 35,' "Elizabeth Taylor"',' "Who''s Afraid of Virginia Woolf?"',NULL), (40, 1967, 60,' "Katharine Hepburn"',' "Guess Who''s Coming to Dinner"',NULL), (41, 1968, 61,' "Katharine Hepburn"',' "The Lion in Winter"',NULL), (42, 1969, 26,' "Barbra Streisand"',' "Funny Girl"',NULL), (43, 1970, 35,' "Maggie Smith"',' "The Prime of Miss Jean Brodie"',NULL), (44, 1971, 34,' "Glenda Jackson"',' "Women in Love"',NULL), (45, 1972, 34,' "Jane Fonda"',' "Klute"',NULL), (46, 1973, 27,' "Liza Minnelli"',' "Cabaret"',NULL), (47, 1974, 37,' "Glenda Jackson"',' "A Touch of Class"',NULL), (48, 1975, 42,' "Ellen Burstyn"',' "Alice Doesn''t Live Here Anymore" ',NULL), (49, 1976, 41,' "Louise Fletcher"',' "One Flew Over the Cuckoo''s Nest"',NULL), (50, 1977, 36,' "Faye Dunaway"',' "Network"',NULL), (51, 1978, 32,' "Diane Keaton"',' "Annie Hall"',NULL), (52, 1979, 41,' "Jane Fonda"',' "Coming Home"',NULL), (53, 1980, 33,' "Sally Field"',' "Norma Rae"',NULL), (54, 1981, 31,' "Sissy Spacek"',' "Coal Miner''s Daughter" ',NULL), (55, 1982, 74,' "Katharine Hepburn"',' "On Golden Pond"',NULL), (56, 1983, 33,' "Meryl Streep"',' "Sophie''s Choice"',NULL), (57, 1984, 49,' "Shirley MacLaine"',' "Terms of Endearment" ',NULL), (58, 1985, 38,' "Sally Field"',' "Places in the Heart"',NULL), (59, 1986, 61,' "Geraldine Page"',' "The Trip to Bountiful" ',NULL), (60, 1987, 21,' "Marlee Matlin"',' "Children of a Lesser God"',NULL), (61, 1988, 41,' "Cher"',' "Moonstruck"',NULL), (62, 1989, 26,' "Jodie Foster"',' "The Accused"',NULL), (63, 1990, 80,' "Jessica Tandy"',' "Driving Miss Daisy"',NULL), (64, 1991, 42,' "Kathy Bates"',' "Misery"',NULL), (65, 1992, 29,' "Jodie Foster"',' "The Silence of the Lambs"',NULL), (66, 1993, 33,' "Emma Thompson"',' "Howards End"',NULL), (67, 1994, 36,' "Holly Hunter"',' "The Piano"',NULL), (68, 1995, 45,' "Jessica Lange"',' "Blue Sky"',NULL), (69, 1996, 49,' "Susan Sarandon"',' "Dead Man Walking"',NULL), (70, 1997, 39,' "Frances McDormand"',' "Fargo"',NULL), (71, 1998, 34,' "Helen Hunt"',' "As Good as It Gets"',NULL), (72, 1999, 26,' "Gwyneth Paltrow"',' "Shakespeare in Love"',NULL), (73, 2000, 25,' "Hilary Swank"',' "Boys Don''t Cry"',NULL), (74, 2001, 33,' "Julia Roberts"',' "Erin Brockovich"',NULL), (75, 2002, 35,' "Halle Berry"',' "Monster''s Ball"',NULL), (76, 2003, 35,' "Nicole Kidman"',' "The Hours"',NULL), (77, 2004, 28,' "Charlize Theron"',' "Monster"',NULL), (78, 2005, 30,' "Hilary Swank"',' "Million Dollar Baby"',NULL), (79, 2006, 29,' "Reese Witherspoon"',' "Walk the Line"',NULL), (80, 2007, 61,' "Helen Mirren"',' "The Queen"',NULL), (81, 2008, 32,' "Marion Cotillard"',' "La Vie en rose"',NULL), (82, 2009, 33,' "Kate Winslet"',' "The Reader"',NULL), (83, 2010, 45,' "Sandra Bullock"',' "The Blind Side"',NULL), (84, 2011, 29,' "Natalie Portman"',' "Black Swan"',NULL), (85, 2012, 62,' "Meryl Streep"',' "The Iron Lady"',NULL), (86, 2013, 22,' "Jennifer Lawrence"',' "Silver Linings Playbook"',NULL), (87, 2014, 44,' "Cate Blanchett"',' "Blue Jasmine"',NULL), (88, 2015, 54,' "Julianne Moore"',' "Still Alice"',NULL), (89, 2016, 26,' "Brie Larson"',' "Room"',NULL);
true
cae95e5d5ff314b70866989a3bd40dffbde293dd
SQL
vineetshukla15/dusharimango
/src/data/sql/X/Temp/Temp3/1.sql
UTF-8
4,618
3.875
4
[]
no_license
DROP TABLE IF EXISTS insights.content_network_show;#content_product_brand_category_station_network_show CREATE TABLE insights.content_network_show ( content_id int(10) unsigned, INDEX(content_id),# FOREIGN KEY(content_id) references insights.contents(content_id), content_title varchar(255), INDEX(content_title), content_duration int(10) unsigned, alphonso_owned boolean, content_group_id int(11) unsigned, INDEX(content_group_id),#content_group_id and content_duration should be used in combination to unique content groups #content_group_title varchar(255), INDEX(content_group_title), product_id int(11) unsigned, INDEX(product_id), product_name varchar(120), INDEX(product_name), productline_id int(11) unsigned, INDEX(productline_id), #productline_name varchar(120), INDEX(productline_name), brand_id int(11) unsigned, INDEX(brand_id), brand_name varchar(120), INDEX(brand_name), brand_group_id int(11) unsigned, INDEX(brand_group_id), #brand_group_name varchar(120), INDEX(brand_group_name), category_id int(10) unsigned DEFAULT NULL, INDEX(category_id), category_name varchar(120), INDEX(category_name), airing_date date, INDEX(airing_date), #daypart varchar(24), INDEX(daypart), airings int(10) unsigned, spend int(10) unsigned, tv_network varchar(100), INDEX(tv_network), show_title varchar(100), INDEX(show_title), show_genres varchar(100), coop_product_id int(11) unsigned, INDEX(coop_product_id), coop_product_name varchar(120), INDEX(coop_product_name), coop_productline_id int(11) unsigned, INDEX(coop_productline_id), #coop_productline_name varchar(120), INDEX(coop_productline_name), coop_brand_id int(11) unsigned, INDEX(coop_brand_id), coop_brand_name varchar(120), INDEX(coop_brand_name), coop_brand_group_id int(11) unsigned, INDEX(coop_brand_group_id), #coop_brand_group_name varchar(120), INDEX(coop_brand_group_name), coop_category_id int(10) unsigned DEFAULT NULL, INDEX(coop_category_id), coop_category_name varchar(120), INDEX(coop_category_name), UNIQUE KEY(content_id, airing_date, #daypart, tv_network, show_title, show_genres) ); REPLACE INTO insights.content_network_show select content_id, content_title, content_duration, alphonso_owned, content_group_id, product_id, product_name, productline_id, brand_id, brand_name, brand_group_id, category_id, category_name, DATE(airing_time) as airing_date, #daypart, count(*) as airings, sum(spend) as spend, tv_network, show_title, show_genres, coop_product_id, coop_product_name, coop_productline_id, coop_brand_id, coop_brand_name, coop_brand_group_id, coop_category_id, coop_category_name from airings as a -- left join -- (select content_id as content_group_id, (case when(content_display_title is null) then content_title else content_display_title end) as content_group_title from contents) as c -- on a.content_group_id = c.content_group_id -- left join -- (select product_id as productline_id, (case when(product_display_name is null) then product_name else product_display_name end) as productline_name from products) as p -- on a.productline_id = p.productline_id group by content_id, airing_date, #daypart, tv_network, show_title, show_genres; drop table if exists tv_airings.ad_airings_all_tmp; CREATE TABLE tv_airings.ad_airings_all_tmp ( airing_time datetime, INDEX(airing_time), content_id int, INDEX(content_id), title varchar(100), brand varchar(100), INDEX(brand), brand_id int, INDEX(brand_id), stations_id int, INDEX(stations_id), network varchar(100), INDEX(network), show_name varchar(100), INDEX(show_name), show_genre varchar(100), show_tmsid varchar(100), INDEX(show_tmsid), ad_cost_est int, brand_cat_id int, brand_cat varchar(100), end_dt datetime, ad_block_id int, seq_no int, product_id int, product varchar(100), content_duration int, ad_airing_start_time_STN datetime, station_tz varchar(100), station_tz_abbr varchar(100), station_tz_offset varchar(100), PRIMARY KEY (airing_time, content_id, brand_id, stations_id, network, show_name, show_tmsid) ); SELECT count(*), sum(ad_cost_est) FROM tv_airings.ad_airings_all where airing_time >= '2016-08-01' and airing_time <= '2016-09-01' and ad_cost_est <= 0; select * from tv_airings.ad_airings_all where airing_time >= '2016-08-01' and airing_time <= '2016-09-01' order by airing_time asc; select * from tv_airings.ad_airings_all where airing_time >= '2016-08-01' and airing_time <= '2016-09-01' order by airing_time desc;
true
37f3f84a18e9fa8524050048597cddc67f261f15
SQL
Flying-sparrow007/MyExercise
/MySQL/条件查询02.sql
UTF-8
6,630
4.21875
4
[]
no_license
# 1.between x and y:在某两个数值之间,包含and两边的数值 # 1.查询员工工资在500-1000的所有员工名字和工资 SELECT ename,sal FROM emp WHERE sal >= 500 AND sal <= 1000; SELECT ename,sal FROM emp WHERE sal BETWEEN 500 AND 1000; # 2.查询员工工资不在在500-1000的所有员工名字和工资 SELECT ename,sal FROM emp WHERE sal NOT BETWEEN 500 AND 1000; # like,模糊查询 _ :代表单个未知的字符 %:代表多个未知的字符 # 1.查询名字以k开头的所有员工名字 SELECT ename FROM emp WHERE ename LIKE "k%"; # 2.查询名字第二个字母是m的所有员工名字 SELECT ename FROM emp WHERE ename LIKE "_m%"; # 3.查询名字第三个字母是l的所有员工名字 SELECT ename FROM emp WHERE ename LIKE "__l%"; # 4.查询名字倒数第二个字母是e的所有员工名字 SELECT ename FROM emp WHERE ename LIKE "%e_"; # 5.查询商品标题包含记事本的商品 SELECT title FROM t_item WHERE title LIKE "%记事本%"; # 6.查询单价低于100的记事本 SELECT title,price FROM t_item WHERE price < 100 AND title LIKE "%记事本%"; # 7.查询有图片的"得力"商品 SELECT title,image FROM t_item WHERE title LIKE "%得力%" AND image IS NOT NULL; # 8.查询单价介于50到200之间的"得力"商品 SELECT title,price FROM t_item WHERE price >= 50 AND price <= 200 AND title LIKE "%得力%"; SELECT title,price FROM t_item WHERE title LIKE "%得力%" AND price BETWEEN 50 AND 200; SELECT title,price FROM t_item WHERE price BETWEEN 50 AND 200 AND title LIKE "%得力%"; # 9.查询有"赠"品的"dell"商品 SELECT title,sell_point FROM t_item WHERE title LIKE "%dell%" AND sell_point LIKE "%赠%"; #查询结果排序,格式 order by字段 默认升序,指定升序 asc 降序 desc # 1.查询员工的名称和工资,按照工资降序排列 SELECT ename,sal FROM emp ORDER BY sal DESC; # 1.查询员工的名称和工资,按照工资降序排列 SELECT ename,sal FROM emp ORDER BY sal ASC; SELECT ename,sal FROM emp ORDER BY sal; # 3.查询单价在100以下的商品名称和价格,按照降序排列 SELECT title,price FROM t_item WHERE price < 100 ORDER BY price DESC; # 4.查询单价在100一下的记事本商品的名称和价格,按照价格的升序排列. SELECT title,price FROM t_item WHERE price < 100 AND title LIKE "%记事本%" ORDER BY price ASC; # 多个字段排序,当第一个字段有相同值时,第二个字段排序开始,字段中间由逗号隔开 # 5.查询所有部门编号,工资,部门编号降序序列,工资升序排列 SELECT deptno,sal FROM emp ORDER BY deptno DESC, sal; # 6.查询记事本商品的名字,价格 价格在100到30之间包含100到30 按照商品的分类降序排列,价格的升序排列 SELECT title,price FROM t_item WHERE title LIKE "%记事本%" AND price BETWEEN 30 AND 100 ORDER BY category_id DESC, price; # limit分页查询 # 跳过条数(大于此条数),查询条数,例如:每一页显示5条,第一页则是limit 0,5 # 1.查询商品表中商品名称和价钱,第1页数据,每一页显示五条 SELECT title,price FROM t_item LIMIT 0,5; # 2.查询商品表中商品名称和价钱,第3页数据,每一页显示五条 SELECT title,price FROM t_item LIMIT 10,5; # 3.查询拿最高工资的员工信息 SELECT * FROM emp ORDER BY sal DESC LIMIT 0,1; # 4.查询第二个字母是l,工资小于等于2000的最高的前两名员工信息 SELECT * FROM emp WHERE ename LIKE "_l%" AND sal <= 2000 ORDER BY sal DESC LIMIT 0,2; # 数值计算+ - * / %(mod) # 1.查询所有商品的单价,库存,总价 SELECT price,num,price * num "总价" FROM t_item; # %和mod都是取余的作用 SELECT 8 % 3; SELECT MOD(8, 3); # day03 # 日期相关函数 # 1.获取当前日期 + 时间 now(); SELECT NOW(); # 2.获取当前日期 curdate(); SELECT CURDATE(); # 3.获取当前时间 curtime() SELECT CURTIME(); # 4.从当前的日期和时间中提取日期 SELECT DATE(NOW()); # 5.从当前的日期和时间中提取时间 SELECT TIME(NOW()); # 6.查询商品创建的年月日 SELECT DATE(created_time) FROM t_item; # 7.查询商品创建的时间 SELECT TIME(created_time) FROM t_item; # extract()函数用于返回日期/时间的单独部分,比如年,月,日,时,分,秒 # 语法:extract(unit from date) # 1.提取年 SELECT EXTRACT(YEAR FROM NOW()); # 2.提取月 SELECT EXTRACT(MONTH FROM NOW()); # 3.提取日 SELECT EXTRACT(DAY FROM NOW()); # 4.提取时 SELECT EXTRACT(HOUR FROM NOW()); # 5.提取分 SELECT EXTRACT(MINUTE FROM NOW()); # 6.提取秒 SELECT EXTRACT(SECOND FROM NOW()); # 7.案例:查询入职的年份 SELECT ename,EXTRACT(YEAR FROM hiredada) "年份" FROM emp; # 日期格式化 data_format(时间, "格式") # %Y:年份 %m:月 %d:天 %H(24小时制) %h(12小时制) %i:分 %s:秒 # 1.查询现在的时间,以2020年10月12日 15时15分15秒 SELECT DATE_FORMAT(NOW(), "%Y年%m月%d日 %H时%i分%s秒") "当前时间"; SELECT DATE_FORMAT(NOW(), "%Y-%m-%d %H-%i-%s") "当前时间"; # 2.查询商品的创建日期年月日(例如:2020年10月12日) SELECT DATE_FORMAT(created_time, "%Y年%m月%d") "创建日期" FROM t_item; # 把不规则的日期格式转换成标准格式,str_to_date("日期字符串", "格式"); SELECT STR_TO_DATE("23号10月2020年", "%d号%m月%Y年") "年-月-日"; # ifnull() 格式:age = ifnull(x, y)判断x是否为null,如果是null则age = y,如果不是null则age = x; # 1.查询员工表没有奖金的显示为0 SELECT ename,IFNULL(comm, 0) "奖金" FROM emp; # 2.把员工没有奖金的这些员工的奖金修改为零 UPDATE emp SET comm = IFNULL(comm, 0); SELECT * FROM emp; # 聚合函数:对多行数据进行合并统计 # sum():sum函数返回数值列的总数(总和) # avg():avg函数返回数值列的平均值,null值不包含在计算内 # count():count(column_name)函数返回指定列的值的数据,null值不计入,如果参数为*,即count(*),会统计包括null # max():max()函数返回一列中的最大值,null值不包含在计算内 # min():min()函数返回一列中的最小值,null值不包含在计算内 # 1.查询员工表的平均工资 SELECT AVG(sal) FROM emp; # 2.查询10号部门的最高工资 SELECT deptno,MAX(sal) "最高工资" FROM emp WHERE deptno = 10; # 3.查询dell商品的库存总和 SELECT SUM(num) "总和" FROM t_item WHERE title LIKE "%dell%"; # 4.查询得力商品的条数 SELECT COUNT(title) FROM t_item WHERE title LIKE "%得力%"; # 5.查询员工姓名包含a的最低工资 SELECT ename,MIN(sal) FROM emp WHERE ename LIKE "%a%";
true
c949d0c2d98639e8ad6a2d056cb867a2bed9de13
SQL
apodoba/mentoring
/Shop/Dump20150628.sql
UTF-8
7,107
3.296875
3
[]
no_license
CREATE DATABASE IF NOT EXISTS `shop` /*!40100 DEFAULT CHARACTER SET latin1 */; USE `shop`; -- MySQL dump 10.13 Distrib 5.5.43, for debian-linux-gnu (x86_64) -- -- Host: 127.0.0.1 Database: shop -- ------------------------------------------------------ -- Server version 5.5.43-0ubuntu0.14.04.1 /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -- -- Table structure for table `Audit` -- DROP TABLE IF EXISTS `Audit`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `Audit` ( `id` int(11) NOT NULL AUTO_INCREMENT, `service_id` int(11) NOT NULL, `user_id` int(11) NOT NULL, `date` datetime NOT NULL, `count` varchar(45) NOT NULL, PRIMARY KEY (`id`), KEY `fk_user_id_idx` (`user_id`), KEY `fk_service_id_idx` (`service_id`), CONSTRAINT `fk_service_id` FOREIGN KEY (`service_id`) REFERENCES `Service` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_user_id` FOREIGN KEY (`user_id`) REFERENCES `User` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `Audit` -- LOCK TABLES `Audit` WRITE; /*!40000 ALTER TABLE `Audit` DISABLE KEYS */; INSERT INTO `Audit` VALUES (1,1,1,'2015-06-28 14:26:14','10'),(2,1,1,'2015-06-28 14:37:04','10'); /*!40000 ALTER TABLE `Audit` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `Service` -- DROP TABLE IF EXISTS `Service`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `Service` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(25) NOT NULL, `description` varchar(45) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `Service` -- LOCK TABLES `Service` WRITE; /*!40000 ALTER TABLE `Service` DISABLE KEYS */; INSERT INTO `Service` VALUES (1,'Phone','Pay for mobile phone'),(2,'TV','Pay for TV'); /*!40000 ALTER TABLE `Service` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `User` -- DROP TABLE IF EXISTS `User`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `User` ( `id` int(11) NOT NULL AUTO_INCREMENT, `password` varchar(45) NOT NULL, `firstname` varchar(45) NOT NULL, `lastname` varchar(45) NOT NULL, `mail` varchar(45) NOT NULL, `role` varchar(45) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `User` -- LOCK TABLES `User` WRITE; /*!40000 ALTER TABLE `User` DISABLE KEYS */; INSERT INTO `User` VALUES (1,'1111','Arina','Podoba','[email protected]','USER'); /*!40000 ALTER TABLE `User` 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 2015-06-28 14:50:04 CREATE DATABASE IF NOT EXISTS `bank` /*!40100 DEFAULT CHARACTER SET latin1 */; USE `bank`; -- MySQL dump 10.13 Distrib 5.5.43, for debian-linux-gnu (x86_64) -- -- Host: 127.0.0.1 Database: bank -- ------------------------------------------------------ -- Server version 5.5.43-0ubuntu0.14.04.1 /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -- -- Table structure for table `Card` -- DROP TABLE IF EXISTS `Card`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `Card` ( `id` int(11) NOT NULL AUTO_INCREMENT, `number` bigint(20) NOT NULL, `cvv` int(3) DEFAULT NULL, `end_year` int(4) NOT NULL, `count` varchar(45) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `Card` -- LOCK TABLES `Card` WRITE; /*!40000 ALTER TABLE `Card` DISABLE KEYS */; INSERT INTO `Card` VALUES (1,2147483647999999,233,2018,'80'); /*!40000 ALTER TABLE `Card` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `Transaction` -- DROP TABLE IF EXISTS `Transaction`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `Transaction` ( `id` int(11) NOT NULL AUTO_INCREMENT, `card_id` int(11) NOT NULL, `date` datetime NOT NULL, `count` varchar(45) NOT NULL, `additional_info` varchar(45) NOT NULL, PRIMARY KEY (`id`), KEY `fk_card_id_idx` (`card_id`), CONSTRAINT `fk_card_id` FOREIGN KEY (`card_id`) REFERENCES `Card` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `Transaction` -- LOCK TABLES `Transaction` WRITE; /*!40000 ALTER TABLE `Transaction` DISABLE KEYS */; INSERT INTO `Transaction` VALUES (1,1,'2015-06-28 14:26:14','10','Pay for mobile phone'),(2,1,'2015-06-28 14:37:04','10','Pay for mobile phone'); /*!40000 ALTER TABLE `Transaction` 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 2015-06-28 14:50:04
true
3ba58131c03c93797f9a195105c8cc4a21813fea
SQL
bpbrianpham/Database-Term-Project
/SQL_Files/Customer_End/Customers.sql
UTF-8
5,325
2.828125
3
[]
no_license
CREATE TABLE Customers ( cID INT NOT NULL, eMail VARCHAR(45) NULL, phoneNumber VARCHAR(10) NULL, cDateRegistered DATE NULL, address VARCHAR(45) NULL, CONSTRAINT customer_pk PRIMARY KEY (cID) ); INSERT INTO Customers (cID, eMail, phoneNumber, cDateRegistered, address) VALUES (01, '[email protected]', 7142223434 , '2017-01-02', '5127 Car Ln, Los Angeles, CA 93219'), (02, '[email protected]', 7142451344 , '2017-11-15', '5342 Boat Str, Los Angeles, CA 42319'), (03, '[email protected]', 7143415321 , '2017-01-12', '6547 Plane Blvd, Los Angeles, CA 99213'), (04, '[email protected]', 7431435324 , '2017-05-26', '7547 Police Way, Los Angeles, CA 32199'), (05, '[email protected]', 7143214324 , '2017-07-07', '2222 Fire Ln, Los Angeles, CA 99431'), (06, '[email protected]', 3212334434 , '2017-09-04', '1111 Star Blvd, Los Angeles, CA 54399'), (07, '[email protected]', 4325432434 , '2017-05-03', '3333 Main Way, Los Angeles, CA 43249'), (08, '[email protected]', 3241354677 , '2017-04-03', '1555 Batman Blvd, Los Angeles, WA 94329'), (09, '[email protected]', 1111111111 , '2017-09-14', '6666 Super Str, Los Angeles, CA 99555'), (10, '[email protected]', 2222222222 , '2017-08-15', '9999 Wonder Blvd, Los Angeles, CA 91119'), (11, '[email protected]', 3333333333 , '2017-05-16', '0101 Luck Way, Los Angeles, CA 32149'), (12, '[email protected]', 4444444444 , '2017-03-18', '3343 Dead Ln, Los Angeles, CA 93213'), (13, '[email protected]', 5555555555 , '2017-01-13', '1211 Rain Str, Los Angeles, CA 43249'), (14, '[email protected]', 6666666666 , '2017-04-20', '1155 Wolf Way, Los Angeles, CA 87539'), (15, '[email protected]', 7777777777 , '2017-08-03', '5557 Cat Str, Los Angeles, CA 43269'), (16, '[email protected]', 8888888888 , '2017-12-05', '1321 Date Ln, Los Angeles, CA 57849'), (17, '[email protected]', 9999999999 , '2017-01-07', '6421 Kick Blvd, Los Angeles, CA 91325'), (18, '[email protected]', 9909090900 , '2017-01-03', '1321 Her Way, Los Angeles, CA 11119'), (19, '[email protected]', 1212121212 , '2017-12-14', '5323 His Str, Los Angeles, CA 22229'), (20, '[email protected]', 2332323232 , '2017-01-06', '3217 Dumb Blvd, Los Angeles, CA 33339'), (21, '[email protected]', 2343443434 , '2017-01-03', '3215 Smart Blvd, Los Angeles, CA 44449'), (22, '[email protected]', 3454345444 , '2017-12-05', '7867 Lame Way, Los Angeles, CA 95559'), (23, '[email protected]', 7676767677 , '2017-01-07', '9766 Win Blvd, Los Angeles, CA 96666'), (24, '[email protected]', 2233344455 , '2017-11-03', '7867 Real Ln, Los Angeles, CA 97779'), (25, '[email protected]', 1235456778 , '2017-05-05', '1357 Reak Blvd, Los Angeles, CA 99777'), (26, '[email protected]', 3431356789 , '2017-08-20', '1653 Pore Str, Los Angeles, CA 98885'), (27, '[email protected]', 1235465311 , '2017-09-24', '1756 Pimple Ln, Los Angeles, CA 99123'), (28, '[email protected]', 8769876678 , '2017-12-08', '3427 What Str, Los Angeles, CA 92229'), (29, '[email protected]', 8769077667 , '2017-09-02', '5437 Who Str, Los Angeles, CA 99439'), (30, '[email protected]', 5567655894 , '2017-08-12', '7654 How Ln, Los Angeles, CA 34249'), (31, '[email protected]', 7658765875 , '2017-07-15', '7647 When Way, Los Angeles, CA 13214'), (32, '[email protected]', 8765432415 , '2017-12-10', '3457 Why Blvd, Los Angeles, CA 43219'), (33, '[email protected]', 5454543532 , '2017-04-04', '1875 Dank Str, Los Angeles, CA 43219'), (34, '[email protected]', 2342342444 , '2017-08-16', '8767 Data Way, Los Angeles, CA 43219'), (35, '[email protected]', 3442223434 , '2017-01-18', '9767 Base Str, Los Angeles, CA 94219'), (36, '[email protected]', 2486248622 , '2017-12-24', '1890 Java Blvd, Los Angeles, CA 43215'), (37, '[email protected]', 1468014680 , '2017-01-08', '8007 Spider Ln, Los Angeles, CA 65399'), (38, '[email protected]', 2144444444 , '2017-09-23', '5677 Thor Str, Los Angeles, CA 13445'), (39, '[email protected]', 1800200030 , '2017-08-07', '7657 Iron Ln, Los Angeles, CA 65429'), (40, '[email protected]', 1888880000 , '2017-11-03', '4743 Cap Way, Los Angeles, CA 91449'), (41, '[email protected]', 7444433333 , '2017-02-07', '1722 Buck Blvd, Los Angeles, CA 14219'), (42, '[email protected]', 8333333333 , '2017-04-03', '1744 Money Way, Los Angeles, CA 91459'), (43, '[email protected]', 9111111111 , '2017-05-12', '1755 Green Ln, Los Angeles, CA 96436'), (44, '[email protected]', 9191919191 , '2017-06-02', '1667 Purple Way, Los Angeles, CA 64539'), (45, '[email protected]', 7142223434 , '2017-01-04', '6776 Blue Blvd, Los Angeles, CA 29999'), (46, '[email protected]', 6464646644 , '2017-12-03', '6756 Black Ln, Los Angeles, CA 63999'), (47, '[email protected]', 7373737373 , '2017-02-20', '8743 Grey Blvd, Los Angeles, CA 99549'), (48, '[email protected]', 7564332756 , '2017-11-03', '1327 Cloud Lane, Los Angeles, CA 79432'), (49, '[email protected]', 8765465778 , '2017-12-22', '2227 Sora Way, Los Angeles, CA 25329'), (50, '[email protected]', 2343254324 , '2017-11-14', '1117 Link Str, Los Angeles, CA 53259'), (51, '[email protected]', 8732134324, '2017-12-01', '9121 New Str, Los Angeles, CA 53259'), (52, '[email protected]', 2321244324, '2017-12-08', '1417 Old Str, Los Angeles, CA 53259'), (53, '[email protected]', 2143254234, '2017-12-10', '4177 Cool Str, Los Angeles, CA 53259'), (54, '[email protected]', 7333274321, '2017-12-11', '7517 Bro Str, Los Angeles, CA 53259'); ALTER TABLE Customers ADD cYearMembership INT NULL; UPDATE Customers SET cYearMembership = 1;
true
d42f1e623786fa70a2c345dd84605cf69987a4b6
SQL
1748995976/Third_year_2
/DataBase/实验源码/Lab1/Sql操作文件/lab2-select.sql
UTF-8
4,552
3.546875
4
[]
no_license
INSERT INTO taketrainrecord VALUES(1001,'130628194909274510',1,1,1,1,1,'F',1); UPDATE taketrainrecord SET SeatNo = 'A' WHERE RID = 1001; DELETE FROM taketrainrecord WHERE RID = 1001; CREATE TABLE test( data1 int, data2 text ); INSERT INTO test VALUES (1, 'hahaha'), (1, 'hahaha'), (1, 'hahaha') DELETE FROM test WHERE data1 = 1; UPDATE test SET data2 = 'hehehe' WHERE data1 = 1; UPDATE diagnoserecord SET DStatus = 1 WHERE PCardID = '110101194701201338'; -- 查询1 SELECT taketrainrecord.RID,taketrainrecord.PCardID,taketrainrecord.TID,taketrainrecord.SStationID,taketrainrecord.AStationID,CarrigeID,SeatRow,SeatNo,SStatus FROM taketrainrecord,diagnoserecord,train,passenger WHERE taketrainrecord.PCardID = diagnoserecord.PCardID AND taketrainrecord.PCardID = passenger.PCardID AND taketrainrecord.TID = train.TID AND passenger.PName = '李玉兰' AND DATEDIFF(train.SDate,diagnoserecord.FDay) <= 14; -- 查询2 SELECT s2.CityName FROM taketrainrecord,station s1,station s2 WHERE s1.SID = taketrainrecord.SStationID AND s2.SID = taketrainrecord.AStationID AND s1.CityName = '武汉' -- 查询3 SELECT DATEDIFF(diagnoserecord.DDay,diagnoserecord.FDay),passenger.PCardID,PName,Age,Sex FROM diagnoserecord,passenger WHERE diagnoserecord.PCardID = passenger.PCardID AND diagnoserecord.DStatus = 1 ORDER BY DATEDIFF(diagnoserecord.DDay,diagnoserecord.FDay) DESC -- 查询4 SELECT * FROM train,station WHERE train.SStationID = station.SID AND station.CityName = '武汉' AND train.SDate = '2020-01-22' -- 查询5 SELECT * FROM train,station,trainpass WHERE train.TID = trainpass.TID AND trainpass.SID = station.SID AND train.SDate = '2020-01-22' AND station.CityName = '武汉' AND trainpass.SNo <> 1 -- 查询6 SELECT PCardID,s2.CityName,SDate FROM taketrainrecord,station s1,station s2,train WHERE s1.SID = taketrainrecord.SStationID AND s2.SID = taketrainrecord.AStationID AND taketrainrecord.TID = train.TID AND s1.CityName = '武汉' AND train.SDate = '2019-10-15' -- 查询7 SELECT s2.CityName,COUNT(*) FROM taketrainrecord,station s1,station s2,train WHERE s1.SID = taketrainrecord.SStationID AND s2.SID = taketrainrecord.AStationID AND taketrainrecord.TID = train.TID AND s1.CityName = '武汉' AND train.SDate = '2019-10-15' GROUP BY s2.CityName -- 查询8 SELECT PCardID FROM taketrainrecord,station,train WHERE taketrainrecord.AStationID = station.SID AND taketrainrecord.TID = train.TID AND station.CityName = '武汉' AND train.SDate >= '2019-01-01' AND train.SDate <= '2019-01-31' -- 查询9 SELECT DISTINCT passenger.PCardID,passenger.PName,passenger.Age,passenger.Sex,train.TName FROM train,station,trainpass,taketrainrecord,passenger WHERE taketrainrecord.TID = train.TID AND taketrainrecord.PCardID = passenger.PCardID AND train.TID = trainpass.TID AND trainpass.SID = station.SID AND train.SDate >= '2020-01-01' AND train.SDate <= '2020-01-31' AND station.CityName = '武汉' AND taketrainrecord.PCardID NOT LIKE '420%' -- 查询10 SELECT taketrainrecord.PCardID,COUNT(*) FROM train,taketrainrecord WHERE train.TID = taketrainrecord.TID AND (taketrainrecord.TID,taketrainrecord.CarrigeID) IN (SELECT DISTINCT sickview.TID,sickview.CarrigeID FROM sickview) AND train.TName = '%G007%' AND train.SDate = '2020-01-22' GROUP BY taketrainrecord.PCardID -- 查询11 SELECT TName,s1.SDate,s1.CarrigeID FROM sickview s1,train WHERE 3<=(SELECT COUNT(*) FROM sickview s2 WHERE s1.TID = s2.TID AND s1.CarrigeID = s2.CarrigeID) AND s1.TID = train.TID -- 查询12 SELECT* FROM sickview WHERE sickview.PCardID NOT IN (SELECT traincontatcor.PCardID FROM traincontatcor WHERE traincontatcor.DStatus = 1) -- 查询13 SELECT train.TName FROM train,station WHERE train.AStationID = station.SID AND station.CityName IN ('北京','上海','广州') -- 查询14 SELECT take_1.PCardID,train_1.TName FROM taketrainrecord take_1,train train_1,station s1,trainpass pass_1 WHERE take_1.TID = pass_1.TID AND pass_1.SID = s1.SID AND s1.SName = '武汉' AND train_1.SDate = '2020-01-22' AND EXISTS( SELECT * FROM taketrainrecord take_2,train train_2,trainpass pass_2 WHERE take_2.TID = train_2.TID AND take_2.SStationID = pass_2.SID AND train_2.SDate = '2020-01-22' AND pass_2.STime > pass_1.STime ) -- 查询15 SELECT sickview.PCardID,sickview.PName,TName,sickview.SDate FROM sickview,train WHERE sickview.TID = train.TID AND sickview.SDate LIKE '2020%' -- 查询16 SELECT d1.FDay,d1.DDay,COUNT(*) FROM diagnoserecord d1 WHERE d1.FDay IN (SELECT d2.FDay FROM diagnoserecord d2 WHERE d1.DDay = d2.DDay) GROUP BY d1.FDay,d1.DDay
true
4786d0385f708d6bf1fcaefb8891c3561949387d
SQL
JACD15/da-academy-sql
/martin exercices/exercice 9.sql
UTF-8
137
2.875
3
[]
no_license
# Write a query to get the number of employees working with the company. SELECT count(employee_ID) AS employees_Working FROM employees;
true
0223caf9b10acc60a571bcb1230db14f28c6e396
SQL
planaspa/Databases
/practica2/src/practica2/consultas/Obligatoria3.sql
UTF-8
2,235
4
4
[]
no_license
create view peliculasJuntos as select a.actor,b.actriz, count(*) as peliculasJuntos from ( select p.id_titulo, p.id_personal as actor from poseer p inner join ( select id_titulo from titulo where annoproduccion >= 1980 and annoproduccion <=2000) t on t.id_titulo = p.id_titulo where p.rol = 'actor') a inner join ( select p.id_titulo, p.id_personal as actriz from poseer p inner join ( select id_titulo from titulo where annoproduccion >= 1980 and annoproduccion <=2000) t on t.id_titulo = p.id_titulo where p.rol = 'actress') b ON b.id_titulo = a.id_titulo group by a.actor,b.actriz; create view peliculasTotalesyJuntos as select pj.actor, pj.actriz, pj.peliculasJuntos,pf.peliculasActriz as totalActriz, pm.peliculasActor as totalActor from peliculasJuntos pj inner join ( select p.id_personal, count(*) as peliculasActor from poseer p where p.rol = 'actor' group by p.id_personal) pm on pm.id_personal=pj.actor inner join( select p.id_personal, count(*) as peliculasActriz from poseer p d where p.rol = 'actress' group by p.id_personal) pf on pf.id_personal=pj.actriz; create view datafinal as select per.nombrePersonal as Actor,n.nacionalidad as nacionalidadActor, per2.nombrePersonal as Actriz, n2.nacionalidad as nacionalidadActriz, p.peliculasJuntos from peliculasTotalesyJuntos p inner join personal per on per.id_personal=p.actor inner join personal per2 on per2.id_personal=p.actriz inner join (select id_personal,substr(lugarnacimiento,instr(lugarnacimiento,',',-1)+1) as nacionalidad from personal where lugarnacimiento is not null) n on n.id_personal=p.actor inner join (select id_personal,substr(lugarnacimiento,instr(lugarnacimiento,',',-1)+1) as nacionalidad from personal where lugarnacimiento is not null) n2 on n2.id_personal=p.actriz where p.totalActor=p.totalActriz and p.totalActriz=p.peliculasJuntos; select actor, nacionalidadActor, actriz, nacionalidadActriz, peliculasJuntos from datafinal where nacionalidadActor <> nacionalidadActriz order by peliculasJuntos desc; drop view datafinal; drop view peliculasTotalesyJuntos; drop view peliculasJuntos;
true
92f0db34f7c8f4cb7f87fb393e2b5032a2b324b6
SQL
HelloSui/answer_system
/answer_system/src/main/resources/sql/answer_system.sql
UTF-8
5,957
3.265625
3
[]
no_license
/* SQLyog Ultimate v8.32 MySQL - 5.7.11-log : Database - answer_system ********************************************************************* */ /*!40101 SET NAMES utf8 */; /*!40101 SET SQL_MODE=''*/; /*!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 */; CREATE DATABASE /*!32312 IF NOT EXISTS*/`answer_system` /*!40100 DEFAULT CHARACTER SET utf8 */; USE `answer_system`; /*Table structure for table `discuss` */ DROP TABLE IF EXISTS `discuss`; CREATE TABLE `discuss` ( `id` varchar(64) NOT NULL COMMENT '主键id', `question_id` varchar(64) NOT NULL COMMENT '讨论的问题id', `speaker_id` varchar(64) NOT NULL COMMENT '该回复的发起者id', `listner_id` varchar(64) NOT NULL COMMENT '该回复的接受者id', `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '该回复的创建时间', `content` varchar(256) NOT NULL COMMENT '该回复的内容', `agree_times` int(11) NOT NULL DEFAULT '0' COMMENT '被点赞的次数', `oppose_times` int(11) NOT NULL DEFAULT '0' COMMENT '被反对的次数', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*Data for the table `discuss` */ insert into `discuss`(`id`,`question_id`,`speaker_id`,`listner_id`,`update_time`,`create_time`,`content`,`agree_times`,`oppose_times`) values ('2','3','1','1','2017-02-21 10:46:31','2017-02-21 10:29:32','试试',0,0),('3','3','3','2','2017-02-21 10:31:03','2017-02-21 10:31:03','试试',0,0); /*Table structure for table `question` */ DROP TABLE IF EXISTS `question`; CREATE TABLE `question` ( `id` varchar(64) NOT NULL COMMENT '主键id', `description` varchar(256) NOT NULL COMMENT '问题的描述,不得多于256字', `title` varchar(64) NOT NULL COMMENT '问题的标题,不得多于64字', `type_id` varchar(64) NOT NULL COMMENT '问题的类型', `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '问题的创建时间', `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '问题的更新时间', `create_user_id` varchar(64) NOT NULL COMMENT '问题创建者的主键id', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*Data for the table `question` */ insert into `question`(`id`,`description`,`title`,`type_id`,`create_time`,`update_time`,`create_user_id`) values ('1','试试','贱贱','1','2017-02-18 00:20:17','2017-02-18 00:20:17','1'),('2','update','suixueya','3,5,7','2017-02-18 18:07:09','2017-02-18 18:07:09','2'),('5','test34','suixueefa','4','2017-02-21 10:23:26','2017-02-21 10:23:26','3'),('6','test34','suixueefa','4','2017-04-08 18:42:48','2017-04-08 18:42:48','3'),('7','test34','suixueefa','4','2017-04-08 18:43:14','2017-04-08 18:43:14','3'); /*Table structure for table `role` */ DROP TABLE IF EXISTS `role`; CREATE TABLE `role` ( `id` varchar(64) NOT NULL COMMENT '主键id', `description` varchar(64) NOT NULL COMMENT '角色描述', `create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `update_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*Data for the table `role` */ insert into `role`(`id`,`description`,`create_time`,`update_time`) values ('1','teacher','2017-02-13 09:43:09','2017-02-13 09:43:09'),('2','student','2017-02-13 09:43:09','2017-02-13 09:43:09'),('3','visitor','2017-02-13 09:43:09','2017-02-13 09:43:09'); /*Table structure for table `type` */ DROP TABLE IF EXISTS `type`; CREATE TABLE `type` ( `id` varchar(64) NOT NULL COMMENT '主键id', `description` varchar(64) NOT NULL COMMENT '类型的描述', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*Data for the table `type` */ insert into `type`(`id`,`description`) values ('1','数学'),('10','计算机'),('2','语文'),('3','英语'),('4','物理'),('5','化学'),('6','生物'),('7','政治'),('8','历史'),('9','其他'); /*Table structure for table `user` */ DROP TABLE IF EXISTS `user`; CREATE TABLE `user` ( `id` varchar(64) NOT NULL COMMENT '主键', `name` varchar(64) NOT NULL COMMENT '登录名', `password` varchar(64) NOT NULL COMMENT '密码', `create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `update_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*Data for the table `user` */ insert into `user`(`id`,`name`,`password`,`create_time`,`update_time`) values ('1','zhangsan','123456',NULL,NULL),('2','suixue','123456',NULL,NULL),('2147483647','suixuer','202cb962ac59075b964b07152d234b70',NULL,NULL),('3','lisi','123456',NULL,NULL),('4','sx','123456',NULL,NULL),('7','zhangsan','123489','2017-02-18 17:51:48','2017-02-18 17:51:48'); /*Table structure for table `user_role` */ DROP TABLE IF EXISTS `user_role`; CREATE TABLE `user_role` ( `id` varchar(64) NOT NULL COMMENT '主键id', `user_id` varchar(64) NOT NULL COMMENT '用户id', `role_id` varchar(64) NOT NULL COMMENT '角色id', `create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `update_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间', PRIMARY KEY (`id`), KEY `FK_user_role` (`user_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*Data for the table `user_role` */ insert into `user_role`(`id`,`user_id`,`role_id`,`create_time`,`update_time`) values ('1','1','1',NULL,NULL),('2','2','2',NULL,NULL),('3','3','3',NULL,NULL),('4','4','2',NULL,NULL); /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
true
927ebf81a1b63f55e96dde93c014d0763b1de00b
SQL
bellmit/SVNrepo
/DBScripts/GoldenSourceMasterScript/3_UIFixing/3_sp_invdb_advisor_currency.sql
UTF-8
601
2.78125
3
[]
no_license
use invdb; drop table if exists advisor_currency; CREATE TABLE advisor_currency ( advisor varchar(20) NOT NULL, supportCurrency varchar(20) NOT NULL, PRIMARY KEY (advisor,supportCurrency) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; INSERT INTO invdb.advisor_currency (advisor, supportCurrency) VALUES ('UOB', 'USD'); INSERT INTO invdb.advisor_currency (advisor, supportCurrency) VALUES ('UOB', 'SGD'); INSERT INTO invdb.advisor_currency (advisor, supportCurrency) VALUES ('CATCHALL', 'USD'); INSERT INTO invdb.advisor_currency (advisor, supportCurrency) VALUES ('CATCHALL', 'SGD');
true
be61475d7e81f730914de0aec5e6a788cbec4f0e
SQL
jaxonjames123/eureka
/Database/stored_procedures/updatePassword.sql
UTF-8
665
3.6875
4
[]
no_license
CREATE DEFINER=`administrator`@`localhost` PROCEDURE `updatePassword`( IN user_id INT(11), IN curr_password VARCHAR(100), IN new_password VARCHAR(100), OUT success SMALLINT(4)) BEGIN /* Procedure that receives user_id, current password hash, and new password hash. If current password hash matches stored password for corresponding user_id then update to new password hash*/ IF(EXISTS(SELECT * FROM users u WHERE u.user_id = user_id AND u.password = curr_password)) THEN UPDATE users u SET u.password = new_password WHERE u.user_id = user_id; SET success := 1; ELSE SET success := 0; END IF; END
true
daebb69679b189cbab5e96e948bf1ea74106f0a9
SQL
SWolfMN78/bamazon
/bamazondb.sql
UTF-8
421
3.203125
3
[]
no_license
SELECT * FROM bamazondb.products; SELECT * from products; SELECT * FROM bamazondb.products INNER JOIN top_songsdb.top_5000 ON products.item_id = top_5000.postion; SELECT COUNT(*), COUNT(*) FROM bamazondb.products WHERE Item_id = 10; SELECT item_id, product_name, stock_quantity FROM bamazondb.products; UPDATE products SET stock_quantity = stock_quantity = 100 WHERE item_id = 1; SELECT * FROM products WHERE item_id = 4;
true
18ae7fa160a0f75feb87490386ab08bc8f4769a1
SQL
Khachatur86/Netology.Python-13.lesson-2.4
/Migrations/171_ELCODATA_Object_updateObjects.sql
UTF-8
1,061
2.96875
3
[]
no_license
/****************************************************************************************** Update objects in T_OBJECT *******************************************************************************************/ -- Update 'Associated Sub FIN CI' to 'Cascade Link: DS with Sub CI' in T_OBJECT IF EXISTS( SELECT * FROM T_OBJECT WHERE attribute_primary_key = 'id_asssubci' AND table_primary_key='V_ASS_SUB_FIN_CI' ) BEGIN UPDATE T_OBJECT SET label ='Cascade Link DS with Sub CI', Description = 'Cascade Link DS with Sub CI' WHERE attribute_primary_key = 'id_asssubci' AND table_primary_key='V_ASS_SUB_FIN_CI' END -- Update 'Associated Top FIN DS' to 'Cascade Link: CI with Upper DS' in T_OBJECT IF EXISTS( SELECT * FROM T_OBJECT WHERE attribute_primary_key = 'id_asstopds' AND table_primary_key='V_ASS_TOP_FIN_DS' ) BEGIN UPDATE T_OBJECT SET label ='Cascade Link CI with Upper DS', Description = 'Cascade Link CI with Upper DS' WHERE attribute_primary_key = 'id_asstopds' AND table_primary_key='V_ASS_TOP_FIN_DS' END
true
7eb30b9e7938e99866242a3c03f7d4593002606c
SQL
theegr8dev/SocialMedia_DATABASE
/BusinessAcct/Business Following.sql
UTF-8
2,497
2.671875
3
[]
no_license
CREATE TABLE [Business].[Following]( [Business_ID] [varchar](50) NOT NULL, [User_ID] [varchar](max) NULL insert into Business.Following values (1, 'PPU1, PPU2, PPU3, PPU9, BU18, PU21, PU7, BU20, PU10, BU18, PU11, PU13, PU12, PU14, PU17') insert into Business.Following values (2, 'BU6, BU5, PU22, BU24, BU3, PU10, PU7, PU3') insert into Business.Following values (3, 'PU5, PU19, PU3') insert into Business.Following values (4, 'PU1, PU31, BU5, BU3, PU12, PU6, PU10, PU4, PU9, BU9, PU11, BU2') insert into Business.Following values (5, 'PU21') insert into Business.Following values (6, 'PU5, BU5, BU24, PU11, BU15, PU6, PU12, PU4, PU19, PU10, PU23, BU25, PU1 ') insert into Business.Following values (7, 'PU3, PU19, BU25, PU4, PU8, PU19, PU2, PU10, PU11') insert into Business.Following values (8, 'PU12, PU25, BU1, PU17, PU19,BU25') insert into Business.Following values (9, 'PU6, PU12, PU19, PU11, BU5, BU14, PU3, PU21, PU18, PU10, PU12,BU9') insert into Business.Following values (10, 'PU20, PU11,BU4, BU15, BU23, BU7, PU19, PU16, PU18, PU10, BU13, PU12, PU13, PU8, BU14, BU16, PU6, PU17, BU3') insert into Business.Following values (11, 'BU5, BU16, BU25 ') insert into Business.Following values (12, 'PU4, PU12, PU3, BU23, BU25, PU2, PU1, BU1, PU9, PU23, PU25, PU24') insert into Business.Following values (13, 'BU5, PU5, BU12, PU5, PU6, PU12, PU3, PU9, PU25, BU12, PU19') insert into Business.Following values (14, 'PU10, PU9, PU8, BU5, BU10, PU21, PU25, BU4, BU15, BU16, PU11, BU7') insert into Business.Following values (15, 'BU7, BU5, PU21, BU24, PU10, BU32') insert into Business.Following values (16, NULL) insert into Business.Following values (17, 'BU10, BU21, BU14, PU23') insert into Business.Following values (18, 'BU16, BU25, PU2, PU8, PU14, PU6, PU25, PU8, BU10, BU14, BU4, BU20, BU22, BU14, PU23, PU11, BU19, PU21') insert into Business.Following values (19, 'BU25, PU1, PU2, PU9, BU11, BU3, PU19, BU22, BU20') insert into Business.Following values (20, 'PU2, PU9, PU4, PU20, BU22, BU12, BU13, PU4, BU5, BU25, BU7, BU2, BU4, BU16, PU7, PU12, PU17 ') insert into Business.Following values (21, 'BU25') insert into Business.Following values (22, 'PU10, PU9, PU19, BU19, BU7, BU8, PU22, BU2, PU21 ') insert into Business.Following values (23, ' PU7, PU20') insert into Business.Following values (24, 'PU5, BU20') insert into Business.Following values (25, 'PU10, BU5, PU5, PU6, PU7, BU4, PU19, BU6, BU12, PU11, BU1, BU11, BU21, PU15, PU20, PU17, PU22')
true
cf849c8daf2c86aed3618239929d1d8db01e6107
SQL
mreysei/WilsonLine
/wilsonline_db/vistas.sql
UTF-8
1,721
3.90625
4
[]
no_license
create view v_generic_flight as select concat(city1.name, ', ', city1.country) origin, concat(city2.name, ', ', city2.country) destiny, gf2.generic_flight_id, cast(substring(gf2.arrive_time,1,2) as unsigned) arrive_hour, cast(substring(gf2.arrive_time,4,2) as unsigned) arrive_minutes, cast(substring(gf2.departure_time,1,2) as unsigned) departure_hour, cast(substring(gf2.departure_time,4,2) as unsigned) departure_minutes, gf2.price, a2.name airline from genericFlight gf2 inner join airline a2 on a2.airline_code = gf2.airline_code inner join airport airport1 on airport1.airport_id=gf2.origin inner join city city1 on city1.city_id=airport1.city_city_id inner join airport airport2 on airport2.airport_id=gf2.destiny inner join city city2 on city2.city_id=airport2.city_city_id; create view v_airline as select name from airline; create view v_flight as select f.flight_number, f.date, f.free_seatings, f.genericFlight_generic_flight_id from flight f; create view v_reservations as select f.flight_number, f.date, gf.price from flight f inner join genericFlight gf on f.genericFlight_generic_flight_id=gf.generic_flight_id; create view v_confirmation as select r.reservation_number, a.name airline, f.flight_number, f.date, (select concat(c.name, ', ', c.country, ', ', a.name) destiny from genericFlight gf inner join airport a on a.airport_id = gf.destiny inner join city c on c.city_id = a.city_city_id) destiny from reservations r inner join flight f on r.flight_flight_number=f.flight_number inner join airline a on a.airline_code = f.airline_airline_code inner join genericFlight gf on f.genericFlight_generic_flight_id= gf.generic_flight_id
true
9e3bd1116f2f7d1712cc99ce20cee2648c08c9ec
SQL
michaelalbinson/332-term-project
/database/mock_data.sql
UTF-8
6,366
3.265625
3
[]
no_license
USE cmpe_332_project; -- ATOMIC TABLES MUST BE INSERTED FIRST -- i.e. room, organizer, sponsor -- Rooms INSERT INTO Room (`id`,`num_beds`) VALUES (1,2), (2,2), (3,2), (4,3), (5,2), (6,2), (7,2), (8,3), (9,3), (10,2); -- Sponsors INSERT INTO Sponsor (`id`,`tier`,`name`) VALUES (1,"platinum","Microsoft"), (2,"platinum","Sibelius"), (3,"platinum","Macromedia"), (4,"silver","Altavista"), (5,"silver","Microsoft"), (6,"platinum","Google"), (7,"gold","Microsoft"), (8,"platinum","C hami"), (9,"bronze","Cakewalk"), (10,"bronze","Yahoo"), (11,"bronze","Adobe"), (12,"bronze","Yahoo"), (13,"bronze","Adobe"), (14,"silver","Lycos"), (15,"gold","Cakewalk"), (16,"silver","Adobe"), (17,"bronze","Borland"), (18,"silver","Microsoft"), (19,"bronze","Yahoo"), (20,"silver","Borland"); -- Student Attendees INSERT INTO Attendee (`id`,`type`,`first_name`,`last_name`,`room_number`) VALUES (65,"student","Patience","Lloyd",1), (66,"student","Dieter","Franco",4), (67,"student","Louis","Aco sta",4), (68,"student","Quin","Bell",3), (69,"student","Rajah","Frost",6), (70,"student","Felicia"," Hawkins",4), (71,"student","Ann","Vinson",3), (72,"student","Daphne","Ortega",3), (73,"student","Sha nnon","Giles",3), (74,"student","Ramona","Chandler",9), (75,"student","Madeline","Holloway",9), (76,"student","Rinah","Burgess",1), (77,"student","Macy","Mccarty",1), (78,"student","Harlan","Wilkerso n",7), (79,"student","Veronica","Welch",8), (80,"student","Basia","Shelton",2); -- Sponsor Attendees INSERT INTO Attendee (`id`,`type`,`first_name`,`last_name`,`sponsor_id`) VALUES (33,"sponsor","Dominique","Long",18), (34,"sponsor","Blair","Burt",19), (35,"sponsor","Brendan","Bu sh",17), (36,"sponsor","Remedios","Peterson",14), (37,"sponsor","Illana","Suarez",8), (38,"sponsor","Janna","Snyder",10), (39,"sponsor","Jolie","Walls",12), (40,"sponsor","Hanna","Vang",17), (41,"sponsor","Tanek","Baxter",9), (42,"sponsor","Quincy","Mcknight",7), (43,"sponsor","Reese","Rodriquez",13), (44,"sponsor","Blossom","Benjamin",4), (45,"sponsor","Brittany","Burnett",16), (46,"sponsor","Iv ana","Grimes",6), (47,"sponsor","Adele","Jacobs",19), (48,"sponsor","Nita","Kinney",11); -- Professional Attendees INSERT INTO Attendee (`id`,`type`,`first_name`,`last_name`) VALUES (49,"professional","Leroy","Kirkland"), (50,"professional","Wallace","Weiss"), (51,"professional","Claire","Roy"), (52,"professional","Demetria","Bishop"), (53,"professional","Georgia","Benson"), (54,"professional","Rudyard","Richards"), (55,"professional","Harper","Cardenas"), (56,"professional","Caleb","Mccullough"), (57,"professional","Leilani","Baird"), (58,"professional","Garrison","Fry"), (59,"professional","Dillon","May"), (60,"professional","Madonna","Barker"), (61,"professional","Joseph","Owen"), (62,"professional","Imogene","Klein"), (63,"professional","Mallory","Thomas"), (64,"professional","Dane","Mcintosh"); -- Organizers INSERT INTO Organizer(`id`, `first_name`, `last_name`) VALUES (1, "Bob", "Jones"), (2, "Lisa", "Turner"), (3, "Jimmy", "Jones"), (4, "Drake", "From Toronto"); INSERT INTO Job (`id`,`sponsor_id`,`title`,`city`,`province`,`pay_rate`) VALUES (1,1,"Mechanical Engineer","Hody","British Columbia",36), (2,2,"civil Engineer","Ripabottoni","Alberta",21), (3,3,"Chemical Engineer","Hamm","British Columbia",32), (4,4,"Computer Engineer","Castlegar","British Columbia",21), (5,5,"Computer Engineer","Chonchi","Manitoba ",22), (6,6,"Chemical Engineer","Chelsea","British Columbia",31), (7,7,"Software Dev","Auburn","Alberta",40), (8,8,"Chemical Engineer","Pietrasanta","Alberta",37), (9,9,"Computer Engineer","Louth","Ontario",29), (10,10,"Domputer Engineer","Montenero Val Cocchiara","Quebec",28), (11,11,"Software Dev","Ponoka","British Columbia",24), (12,12,"Mechanical Engineer","Richmond","Ontario",41), (13,13,"Computer Engineer","Rocky Mountain House","Ontario",34), (14,14,"Mechanical Engineer","Fahler","Quebec",22), (15,15,"Civil Engineer","Vito d'Asio","Alberta",46), (16,16,"Chemical Engineer","Murdochville","Manitoba ",25), (17,17,"Mechanical Engineer","Aguacaliente (San Francisco)","Alberta",37), (18,18,"Chemical Engineer","Chiusa/Klausen","Alberta",24), (19,19,"Mechanical Engineer","Etalle","Alberta",51), (20,20,"Computer Engineer","Minto","Manitoba ",59); INSERT INTO Subcommittee (`id`,`name`,`chair`) VALUES (1,"Techincal Outreach",1), (2,"Snacks",2), (3,"Events",3), (4,"Sponsorship",4), (5,"Website",1), (6,"Delegates",3), (7,"Drake Concert",4); INSERT INTO On_Committee (`organizer_id`,`subcommittee_id`) VALUES (1,5), (2,5), (3,4), (4,4), (1,6), (2,4), (3,7), (4,3), (1,1), (2,2), (3,1), (4,6), (1,6), (2,6), (3,3); -- "2019-04-05" Friday -- "2019-04-06" Saturday INSERT INTO Session (`id`,`start_time`,`end_time`,`conf_room`,`name`) VALUES (1,"2019-04-05 18:00:00","2019-04-05 19:00:00","DUPUIS HALL","Welcoming Ceremonies"), (2,"2019-04-05 19:00:00","2019-04-05 20:00:00","ARC 90","Artificial Intelligence"), (3,"2019-04-05 19:00:00","2019-04-05 20:00:00","DUPUIS HALL","Blockchain"), (4,"2019-04-05 20:00:00","2019-04-05 21:00:00","DUPUIS HALL","Neural Networks"), (5,"2019-04-05 20:00:00","2019-04-05 21:00:00","STIRLING 53","Blockchain"), (6,"2019-04-05 21:00:00","2019-04-05 22:00:00","DUPUIS HALL","Friday Keynote"), (7,"2019-04-06 08:00:00","2019-04-06 10:00:00","ARC 90","Morning Welcome"), (8,"2019-04-06 10:00:00","2019-04-06 12:00:00","DUPUIS HALL","Speaker: How to Make Pasta"), (9,"2019-04-06 12:00:00","2019-04-06 13:00:00","ETHERINGTON 5","Lunch"), (10,"2019-04-06 13:00:00","2019-04-06 15:00:00","ETHERINGTON 5","Machine Learning"), (11,"2019-04-06 13:00:00","2019-04-06 15:00:00","DUNNING 101","Web Development"), (12,"2019-04-06 15:00:00","2019-04-06 16:00:00","DUPUIS HALL","Machine Learning"), (13,"2019-04-06 15:00:00","2019-04-06 16:00:00","STLIRLING 53","Blockchain"), (14,"2019-04-06 16:00:00","2019-04-06 18:00:00","ARC 90","Artificial Intelligence"), (15,"2019-04-06 18:00:00","2019-04-06 20:00:00","DUNNING 101","Dinner + Saturday Keynote"), (16,"2019-04-06 20:00:00","2019-04-06 21:00:00","WALLACE 10","Drake Concert"); INSERT INTO Speaking (`attendee_id`,`session_id`) VALUES (49,1), (59,2), (51,3), (52,4), (55,5), (52,6), (57,7), (56,8), (58,9), (52,10), (63,11), (61,12), (62,13), (54,14), (50,15);
true
79f1ebd452edf1adfd4f85630743e83300903fa8
SQL
Missnamidnight/TaskWer-V7
/taskwer.sql
UTF-8
7,617
3.109375
3
[]
no_license
-- -------------------------------------------------------- -- Host: tvcpw8tpu4jvgnnq.cbetxkdyhwsb.us-east-1.rds.amazonaws.com -- Versión del servidor: 8.0.20 - Source distribution -- SO del servidor: Linux -- HeidiSQL Versión: 11.3.0.6295 -- -------------------------------------------------------- /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET NAMES utf8 */; /*!50503 SET NAMES utf8mb4 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -- Volcando estructura de base de datos para sntiuu8dhc86lamz CREATE DATABASE IF NOT EXISTS `sntiuu8dhc86lamz` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */; USE `sntiuu8dhc86lamz`; -- Volcando estructura para tabla sntiuu8dhc86lamz.compras CREATE TABLE IF NOT EXISTS `compras` ( `id` int NOT NULL AUTO_INCREMENT, `usuario_id` int NOT NULL, `descripcion` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, PRIMARY KEY (`id`), KEY `FK_compras_user` (`usuario_id`), CONSTRAINT `FK_compras_user` FOREIGN KEY (`usuario_id`) REFERENCES `user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB AUTO_INCREMENT=48 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- Volcando datos para la tabla sntiuu8dhc86lamz.compras: ~14 rows (aproximadamente) /*!40000 ALTER TABLE `compras` DISABLE KEYS */; INSERT INTO `compras` (`id`, `usuario_id`, `descripcion`) VALUES (34, 5, 'pan'), (35, 1, 'arroz'), (36, 1, 'zumo'), (38, 2, 'zanahoria'), (39, 2, 'patatas'), (40, 2, 'tomates'), (41, 2, 'tomate frito'), (42, 2, 'agua'), (43, 2, 'sal'), (44, 2, 'harina'), (45, 2, 'leche'), (46, 2, 'huevos'), (47, 2, 'arroz integral'); /*!40000 ALTER TABLE `compras` ENABLE KEYS */; -- Volcando estructura para tabla sntiuu8dhc86lamz.doctrine_migration_versions CREATE TABLE IF NOT EXISTS `doctrine_migration_versions` ( `version` varchar(191) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL, `executed_at` datetime DEFAULT NULL, `execution_time` int DEFAULT NULL, PRIMARY KEY (`version`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- Volcando datos para la tabla sntiuu8dhc86lamz.doctrine_migration_versions: ~1 rows (aproximadamente) /*!40000 ALTER TABLE `doctrine_migration_versions` DISABLE KEYS */; INSERT INTO `doctrine_migration_versions` (`version`, `executed_at`, `execution_time`) VALUES ('DoctrineMigrations\\Version20210406121222', '2021-04-06 14:12:52', 43); /*!40000 ALTER TABLE `doctrine_migration_versions` ENABLE KEYS */; -- Volcando estructura para tabla sntiuu8dhc86lamz.tarea CREATE TABLE IF NOT EXISTS `tarea` ( `id` int NOT NULL AUTO_INCREMENT, `usuario_id` int NOT NULL, `descripcion` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `finalizada` tinyint(1) NOT NULL, `creado_en` datetime NOT NULL, PRIMARY KEY (`id`), KEY `IDX_3CA05366DB38439E` (`usuario_id`), CONSTRAINT `FK_3CA05366DB38439E` FOREIGN KEY (`usuario_id`) REFERENCES `user` (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=52 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- Volcando datos para la tabla sntiuu8dhc86lamz.tarea: ~38 rows (aproximadamente) /*!40000 ALTER TABLE `tarea` DISABLE KEYS */; INSERT INTO `tarea` (`id`, `usuario_id`, `descripcion`, `finalizada`, `creado_en`) VALUES (3, 1, 'Tarea de prueba admin 2', 1, '2021-05-05 10:45:39'), (5, 1, 'Tarea de prueba admin 4', 1, '2021-05-05 10:45:39'), (6, 1, 'Tarea de prueba admin 5', 1, '2021-05-05 10:45:39'), (7, 1, 'Tarea de prueba admin 6', 0, '2021-05-05 10:45:39'), (8, 1, 'Tarea de prueba admin 7', 0, '2021-05-05 10:45:39'), (9, 1, 'Tarea de prueba admin 8', 0, '2021-05-05 10:45:39'), (10, 1, 'Tarea de prueba admin 9', 0, '2021-05-05 10:45:39'), (11, 1, 'Tarea de prueba admin 10', 0, '2021-05-05 10:45:39'), (12, 1, 'Tarea de prueba admin 11', 0, '2021-05-05 10:45:39'), (13, 1, 'Tarea de prueba admin 12', 0, '2021-05-05 10:45:39'), (14, 1, 'Tarea de prueba admin 13', 0, '2021-05-05 10:45:39'), (15, 1, 'Tarea de prueba admin 14', 0, '2021-05-05 10:45:39'), (16, 1, 'Tarea de prueba admin 15', 0, '2021-05-05 10:45:39'), (17, 1, 'Tarea de prueba admin 16', 0, '2021-05-05 10:45:39'), (18, 1, 'Tarea de prueba admin 17', 0, '2021-05-05 10:45:39'), (19, 1, 'Tarea de prueba admin 18', 0, '2021-05-05 10:45:39'), (20, 1, 'Tarea de prueba admin 19', 0, '2021-05-05 10:45:39'), (22, 2, 'Tarea de prueba user 1', 1, '2021-05-05 10:45:39'), (23, 2, 'Tarea de prueba user 2', 1, '2021-05-05 10:45:39'), (24, 2, 'Tarea de prueba user 3', 1, '2021-05-05 10:45:39'), (25, 2, 'Tarea de prueba user 4', 0, '2021-05-05 10:45:39'), (26, 2, 'Tarea de prueba user 5', 0, '2021-05-05 10:45:39'), (27, 2, 'Tarea de prueba user 6', 0, '2021-05-05 10:45:39'), (28, 2, 'Tarea de prueba user 7', 0, '2021-05-05 10:45:39'), (29, 2, 'Tarea de prueba user 8', 0, '2021-05-05 10:45:39'), (30, 2, 'Tarea de prueba user 9', 0, '2021-05-05 10:45:39'), (31, 2, 'Tarea de prueba user 10', 0, '2021-05-05 10:45:39'), (32, 2, 'Tarea de prueba user 11', 0, '2021-05-05 10:45:39'), (33, 2, 'Tarea de prueba user 12', 0, '2021-05-05 10:45:39'), (34, 2, 'Tarea de prueba user 13', 0, '2021-05-05 10:45:39'), (35, 2, 'Tarea de prueba user 14', 0, '2021-05-05 10:45:39'), (36, 2, 'Tarea de prueba user 15', 0, '2021-05-05 10:45:39'), (37, 2, 'Tarea de prueba user 16', 0, '2021-05-05 10:45:39'), (38, 2, 'Tarea de prueba user 17', 0, '2021-05-05 10:45:39'), (39, 2, 'Tarea de prueba user 18', 0, '2021-05-05 10:45:39'), (40, 2, 'Tarea de prueba user 19', 0, '2021-05-05 10:45:39'), (47, 5, 'Tarea prueba', 0, '2021-06-03 18:27:48'), (48, 5, 'Tarea 2', 0, '2021-06-04 09:23:02'); /*!40000 ALTER TABLE `tarea` ENABLE KEYS */; -- Volcando estructura para tabla sntiuu8dhc86lamz.user CREATE TABLE IF NOT EXISTS `user` ( `id` int NOT NULL AUTO_INCREMENT, `email` varchar(180) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `roles` json NOT NULL, `password` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `ultimo_acces` datetime DEFAULT NULL, `is_verified` tinyint(1) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `UNIQ_8D93D649E7927C74` (`email`) ) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- Volcando datos para la tabla sntiuu8dhc86lamz.user: ~3 rows (aproximadamente) /*!40000 ALTER TABLE `user` DISABLE KEYS */; INSERT INTO `user` (`id`, `email`, `roles`, `password`, `ultimo_acces`, `is_verified`) VALUES (1, '[email protected]', '["ROLE_ADMIN"]', '$argon2id$v=19$m=65536,t=4,p=1$XwzhRs9UaWFOMl8JcB30bA$Uw2+50ekyrJlnIe/OowtwSpT43XgYJaLJhu1msttYCc', '2021-06-06 22:42:17', 0), (2, '[email protected]', '["ROLE_USER"]', '$argon2id$v=19$m=65536,t=4,p=1$S63krWF59inrbu1HA8qIAw$RVu6X/jC2hUL9e90+iX5so2ff1BOMb+EV5B3BPEaN8g', '2021-06-06 22:48:18', 0), (5, '[email protected]', '[]', '$argon2id$v=19$m=65536,t=4,p=1$SEZLeE5BaVgvdHFzcTh4QQ$owujRLOl1xSqER6ybMsGxKog93b0omAqLZFudqh02lQ', '2021-06-06 22:16:41', 1), (6, '[email protected]', '[]', '$argon2id$v=19$m=65536,t=4,p=1$aDFjL3M5T3BoenpjTWtZWg$V0jRNDbTBcj6rv8zHynDJh7afDMrvkb9/W7+/R1kobs', '2021-06-02 23:04:04', 1); /*!40000 ALTER TABLE `user` ENABLE KEYS */; /*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */; /*!40014 SET FOREIGN_KEY_CHECKS=IFNULL(@OLD_FOREIGN_KEY_CHECKS, 1) */; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40111 SET SQL_NOTES=IFNULL(@OLD_SQL_NOTES, 1) */;
true
4ca201eeea12e84ece9239b3f06c61f6f09294f7
SQL
transcom/mymove
/migrations/app/schema/20200203200715_mto_shipments_add_rejection_reason.up.sql
UTF-8
201
2.671875
3
[ "MIT", "LicenseRef-scancode-public-domain" ]
permissive
-- Column add ALTER TABLE mto_shipments ADD COLUMN rejection_reason text; -- Column comment COMMENT ON COLUMN mto_shipments.rejection_reason IS 'TOO will provide a reason if they reject the shipment';
true
a06d6394993e13cd77f7a8f594dde54b1c3d141b
SQL
digital-asset/canton
/community/ledger/ledger-api-core/src/main/resources/db/migration/postgres/V21__Stable_offsets.sql
UTF-8
2,496
3.078125
3
[ "Apache-2.0" ]
permissive
-- Copyright (c) 2019 The DAML Authors. All rights reserved. -- SPDX-License-Identifier: Apache-2.0 --------------------------------------------------------------------------------------------------- -- V21: Stable Offsets -- -- Stable offsets are stored as bytea and can be sorted lexicographically. --------------------------------------------------------------------------------------------------- ALTER TABLE parameters ALTER COLUMN ledger_end DROP NOT NULL; ALTER TABLE contract_divulgences DROP CONSTRAINT contract_divulgences_ledger_offset_fkey1; ALTER TABLE contracts DROP CONSTRAINT contracts_create_offset_fkey; ALTER TABLE contracts DROP CONSTRAINT contracts_archive_offset_fkey; ALTER TABLE configuration_entries ALTER COLUMN ledger_offset TYPE bytea using decode(lpad(to_hex(ledger_offset), 16, '0'), 'hex'); ALTER TABLE contract_divulgences ALTER COLUMN ledger_offset TYPE bytea using decode(lpad(to_hex(ledger_offset), 16, '0'), 'hex'); ALTER TABLE contracts ALTER COLUMN create_offset TYPE bytea using decode(lpad(to_hex(create_offset), 16, '0'), 'hex'); ALTER TABLE contracts ALTER COLUMN archive_offset TYPE bytea using decode(lpad(to_hex(archive_offset), 16, '0'), 'hex'); ALTER TABLE ledger_entries ALTER COLUMN ledger_offset TYPE bytea using decode(lpad(to_hex(ledger_offset), 16, '0'), 'hex'); ALTER TABLE packages ALTER COLUMN ledger_offset TYPE bytea using decode(lpad(to_hex(ledger_offset), 16, '0'), 'hex'); ALTER TABLE package_entries ALTER COLUMN ledger_offset TYPE bytea using decode(lpad(to_hex(ledger_offset), 16, '0'), 'hex'); ALTER TABLE parameters ALTER COLUMN ledger_end TYPE bytea using decode(lpad(to_hex(ledger_end), 16, '0'), 'hex'); ALTER TABLE participant_command_completions ALTER COLUMN completion_offset TYPE bytea using decode(lpad(to_hex(completion_offset), 16, '0'), 'hex'); ALTER TABLE participant_events ALTER COLUMN event_offset TYPE bytea using decode(lpad(to_hex(event_offset), 16, '0'), 'hex'); ALTER TABLE parties ALTER COLUMN ledger_offset TYPE bytea using decode(lpad(to_hex(ledger_offset), 16, '0'), 'hex'); ALTER TABLE party_entries ALTER COLUMN ledger_offset TYPE bytea using decode(lpad(to_hex(ledger_offset), 16, '0'), 'hex'); ALTER TABLE contract_divulgences add foreign key (ledger_offset) references ledger_entries (ledger_offset); ALTER TABLE contracts add foreign key (create_offset) references ledger_entries (ledger_offset); ALTER TABLE contracts add foreign key (archive_offset) references ledger_entries (ledger_offset);
true
ac64ab22c040813ab78c9e056a95084e0a932224
SQL
KhuongVuong/CSCI-411
/emm.sql
UTF-8
1,279
3.765625
4
[]
no_license
/*For each observer, count the number of observations they recorded*/ SELECT observers.pid, COUNT(observations.pid) AS Numcount FROM observers, observations WHERE observations.pid = observers.pid GROUP BY observers.pid; /* OUTPUT PID NUMCOUNT ---------- ---------- 11567 6 88331 4 3289 4 JUSTIFICATION: the person id and number of observations is in the output */ /*List of all persons with the city they live in(id, name, city)*/ SELECT person.pid, person.name, livesat.city FROM person, livesat WHERE person.pid = livesat.pid GROUP BY person.pid, person.name, livesat.city; /*OUTPUT PID NAME CITY ---------- -------------------- -------------------- 10234 Able Monticello 17645 Mary Monticello 2557 Bill St.Paul 3289 George Minneapolis 11567 Baker Monticello 88331 Alice Monticello 74591 Jane Duluth 7 rows selected. JUSTIFICATION: the person id and name, the city name and number of person in list who is living in the city are in the output /*
true
89aa440fd10f0930a201bca27fac7126122e9bd7
SQL
schoollabs91/SputnikTech
/SchoolSystem/SchoolSystemUi/S_TIME_TABLE.sql
UTF-8
1,299
3.28125
3
[]
no_license
CREATE TABLE S_TIME_TABLE ( MONDAY VARCHAR2(50 BYTE) , TUESDAY VARCHAR2(50 BYTE) , WEDNESDAY VARCHAR2(50 BYTE) , THURSDAY VARCHAR2(50 BYTE) , FRIDAY VARCHAR2(50 BYTE) , SATURDAY VARCHAR2(50 BYTE) , SUNDAY VARCHAR2(50 BYTE) , T_ID VARCHAR2(20 BYTE) NOT NULL , CLASS_CODE VARCHAR2(20 BYTE) NOT NULL , SECTION_CODE VARCHAR2(20 BYTE) NOT NULL , SESSION_CODE VARCHAR2(20 BYTE) NOT NULL , SUBJECT_CODE VARCHAR2(20 BYTE) NOT NULL , TIME_SLOT VARCHAR2(20 BYTE) , CONSTRAINT S_TIME_TABLE_PK PRIMARY KEY ( CLASS_CODE , SECTION_CODE , SESSION_CODE , SUBJECT_CODE , T_ID ) USING INDEX ( CREATE UNIQUE INDEX S_TIME_TABLE_PK ON S_TIME_TABLE (CLASS_CODE ASC, SECTION_CODE ASC, SESSION_CODE ASC, SUBJECT_CODE ASC, T_ID ASC) LOGGING TABLESPACE SYSTEM PCTFREE 10 INITRANS 2 STORAGE ( INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS UNLIMITED FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT ) NOPARALLEL ) ENABLE ) LOGGING TABLESPACE SYSTEM PCTFREE 10 PCTUSED 40 INITRANS 1 STORAGE ( INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS UNLIMITED FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT ) NOCOMPRESS;
true
15f88cec1dbe3c7d157bda396da3262d7d99653c
SQL
xeonye/Butterfly-1
/Butterfly.Examples/better-chat-db.sql
UTF-8
878
3.703125
4
[ "Apache-2.0" ]
permissive
CREATE TABLE user ( id VARCHAR(40) NOT NULL, name VARCHAR(40) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(id) ); CREATE TABLE chat ( id VARCHAR(40) NOT NULL, name VARCHAR(40) NOT NULL, join_id VARCHAR(8) NOT NULL, owner_id VARCHAR(40) NOT NULL, created_at DATETIME NOT NULL, PRIMARY KEY(id), UNIQUE INDEX joinId (join_id) ); CREATE TABLE chat_participant ( id VARCHAR(40) NOT NULL, chat_id VARCHAR(40) NOT NULL, user_id VARCHAR(40) NOT NULL, created_at DATETIME NOT NULL, PRIMARY KEY(id), UNIQUE INDEX chatIdUserId (chat_id, user_id) ); CREATE TABLE chat_message ( id VARCHAR(40) NOT NULL, chat_id VARCHAR(40) NOT NULL, user_id VARCHAR(40) NOT NULL, text VARCHAR(255) NOT NULL, created_at DATETIME NOT NULL, PRIMARY KEY(id) ); -- TRUNCATE chat; TRUNCATE chat_message; TRUNCATE chat_participant; TRUNCATE user;
true
cbb1d19170248776335bfa18ca6b134f7fe62778
SQL
flaviolyra/wis-framework
/PostGIS/Piabanha/OriginalDatabaseDevelopment/Hidrorreferenciamento/CriaTabelaPtAHidrorref.sql
UTF-8
702
2.828125
3
[]
no_license
CREATE TABLE pt_a_hidrorref ( gid serial NOT NULL, num integer, tipo character varying(254), nome character varying(254), nome_alt character varying(254), nome_rio character varying(254), corio character varying(254), cobacia character varying(254), hr_dir_ind text, lat_pt_infl double precision, long_pt_infl double precision, geomproj geometry(Point,32723), dist_max double precision, CONSTRAINT pt_a_hidrorref_pkey PRIMARY KEY (gid ) ) WITH ( OIDS=FALSE ); CREATE INDEX pt_a_hidrorref_cobacia_btree ON pt_a_hidrorref USING btree (cobacia COLLATE pg_catalog."default" ); CREATE INDEX pt_a_hidrorref_geomproj_gist ON pt_a_hidrorref USING gist (geomproj );
true
9c7fd7d4bc1e8f81be303f5d68644199cb4592a5
SQL
andri000me/Absensi-Mahasiswa-Berbasis-Bot-Telegram
/kelompok4.sql
UTF-8
1,975
3.09375
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 4.9.0.1 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Generation Time: Jun 12, 2020 at 05:48 PM -- Server version: 10.4.6-MariaDB -- PHP Version: 7.3.8 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET AUTOCOMMIT = 0; START TRANSACTION; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8mb4 */; -- -- -- -------------------------------------------------------- -- CREATE TABLE `tb_mhs` ( `no_absen` int(11) NOT NULL, `npm` varchar(200) NOT NULL, `nama_lengkap` varchar(200) NOT NULL, `mk` varchar(200) NOT NULL, `id_user` int(11) NOT NULL, `waktu` varchar(200) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- -------------------------------------------------------- -- -- Table structure for table `tb_datauser` -- CREATE TABLE `tb_datauser` ( `id_user` int(11) NOT NULL, `nama` varchar(50) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- -- Indexes for dumped tables -- -- -- Indexes for table `tb_mhs` -- ALTER TABLE `tb_mhs` ADD PRIMARY KEY (`no_absen`), ADD KEY `tb_mhs_fk1` (`id_user`); -- -- Indexes for table `tb_datauser` -- ALTER TABLE `tb_datauser` ADD PRIMARY KEY (`id_user`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `tb_mhs` -- ALTER TABLE `tb_mhs` MODIFY `no_absen` int(11) NOT NULL AUTO_INCREMENT; -- -- Constraints for dumped tables -- -- -- Constraints for table `tb_catatan_mk` -- ALTER TABLE `tb_mhs` ADD CONSTRAINT `tb_mhs_fk1` FOREIGN KEY (`id_user`) REFERENCES `tb_datauser` (`id_user`) ON DELETE CASCADE ON UPDATE CASCADE; COMMIT; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
true
ce53ffd6ee9eb44c593a6ff58060009bf2ec26a6
SQL
AscenKeeprov/Database-Basics
/XAM24062018/TripService/RomanticGetaways.sql
UTF-8
384
4.15625
4
[ "MIT" ]
permissive
USE TripService SELECT a.Id, a.Email, c.[Name] AS [City], COUNT(t.Id) AS [Trips] FROM Accounts AS a JOIN AccountsTrips AS at ON at.AccountId = a.Id JOIN Trips AS t ON t.Id = at.TripId JOIN Rooms AS r ON r.Id = t.RoomId JOIN Hotels AS h ON h.Id = r.HotelId JOIN Cities AS c ON c.Id = h.CityId WHERE a.CityId = h.CityId GROUP BY a.Id, a.Email, c.[Name] ORDER BY [Trips] DESC, a.Id
true
49587aa3eb8e78f30d423c9cb917c30ce4f6d60f
SQL
AussiePete2015/SQL_statements-
/Oracle/ora_cog_camid_acc.sql
UTF-8
562
3.15625
3
[]
no_license
DROP VIEW VW_CAMID_ACCNAME; CREATE VIEW VW_CM_CAMID_ACCNAME ( CAMID, ACCOUNT_NAME ) AS Select C1021CS.CMOBJNAMES_BASE.Name CAMID, C1021CS.CMOBJPROPS33.Name from C1021CS.CMOBJNAMES_BASE, C1021CS.CMOBJECTS, C1021CS.CMOBJPROPS33, C1021CS.CMOBJPROPS26 Where C1021CS.CMOBJNAMES_BASE.cmid = C1021CS.CMOBJECTS.cmid AND C1021CS.CMOBJECTS.cmid = C1021CS.CMOBJPROPS26.cmid AND C1021CS.CMOBJNAMES_BASE.cmid = C1021CS.CMOBJPROPS33.cmid AND C1021CS.CMOBJNAMES_BASE.ISDEFAULT=1 ORDER BY C1021CS.CMOBJPROPS33.Name ASC
true
1b4e50fd67b92a4e76a8cbfb4b7bbf07ad88361b
SQL
xianfengtuandui/FirstProject
/xianfeng.sql
UTF-8
8,369
2.890625
3
[]
no_license
/* Navicat MySQL Data Transfer Source Server : First Source Server Version : 50641 Source Host : localhost:3306 Source Database : xianfeng Target Server Type : MYSQL Target Server Version : 50641 File Encoding : 65001 Date: 2018-10-19 16:56:50 */ SET FOREIGN_KEY_CHECKS=0; -- ---------------------------- -- Table structure for `t_admin` -- ---------------------------- DROP TABLE IF EXISTS `t_admin`; CREATE TABLE `t_admin` ( `A_ID` int(20) NOT NULL AUTO_INCREMENT, `A_No` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, `A_Pw` varchar(15) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, `A_Name` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, PRIMARY KEY (`A_ID`) ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1; -- ---------------------------- -- Records of t_admin -- ---------------------------- INSERT INTO `t_admin` VALUES ('1', 'admin', 'admin', '小金'); -- ---------------------------- -- Table structure for `t_bingli` -- ---------------------------- DROP TABLE IF EXISTS `t_bingli`; CREATE TABLE `t_bingli` ( `B_ID` int(20) NOT NULL AUTO_INCREMENT, `C_No` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, `D_No` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, `B_Time` datetime DEFAULT NULL, `B_Result` varchar(150) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, `B_Plan` varchar(150) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, `B_Free` decimal(8,2) DEFAULT NULL, `B_Success` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `B_Reason` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, PRIMARY KEY (`B_ID`) ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1; -- ---------------------------- -- Records of t_bingli -- ---------------------------- INSERT INTO `t_bingli` VALUES ('1', 'a2018001', 'a001', '2018-08-01 00:00:00', '眼球发炎', '消炎眼药水', '15.50', '是', null); INSERT INTO `t_bingli` VALUES ('2', 'a2018002', 'a002', '2018-08-01 00:00:00', '手被猫抓伤已过两小时', '狂犬病疫苗', '402.00', '是', null); INSERT INTO `t_bingli` VALUES ('3', 'a2018003', 'a003', '2018-08-01 00:00:00', '感冒', '感冒药', '32.00', '是', null); INSERT INTO `t_bingli` VALUES ('4', 'a2018004', 'a004', '2018-08-05 00:00:00', '头疼', '头疼药', '20.00', '是', null); INSERT INTO `t_bingli` VALUES ('5', 'a2018001', 'a001', '2018-10-10 21:56:06', '感冒病加狂犬病', '感冒药x2,狂犬病疫苗x1', '466.00', '是', 'null'); -- ---------------------------- -- Table structure for `t_customer` -- ---------------------------- DROP TABLE IF EXISTS `t_customer`; CREATE TABLE `t_customer` ( `C_ID` int(20) NOT NULL AUTO_INCREMENT, `C_No` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, `C_Name` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, `C_Age` varchar(3) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, `C_Sex` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, `C_Pcard` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, `C_Tel` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, `C_Both` date DEFAULT NULL, `C_Address` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, `C_RoomID` varchar(10) DEFAULT NULL, PRIMARY KEY (`C_ID`) ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1; -- ---------------------------- -- Records of t_customer -- ---------------------------- INSERT INTO `t_customer` VALUES ('1', 'a2018001', '小明', '20', '男', '441381199711123538', '18229000932', '1997-11-12', '中大新华', null); INSERT INTO `t_customer` VALUES ('2', 'a2018002', '小康', '22', '男', '441381199611115696', '13669518922', '1997-11-11', '中大新华', null); INSERT INTO `t_customer` VALUES ('3', 'a2018003', '小红', '21', '女', '441381199609026633', '15917769006', '1996-09-02', '中大新华', null); -- ---------------------------- -- Table structure for `t_doctor` -- ---------------------------- DROP TABLE IF EXISTS `t_doctor`; CREATE TABLE `t_doctor` ( `D_ID` int(20) NOT NULL AUTO_INCREMENT, `D_No` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, `D_Name` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, `D_Age` int(3) DEFAULT NULL, `D_Sex` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, `D_Tel` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, `D_Pcard` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, `S_Name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, `D_Education` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, `D_Introduce` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, `D_hiredate` date DEFAULT NULL, PRIMARY KEY (`D_ID`) ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1; -- ---------------------------- -- Records of t_doctor -- ---------------------------- INSERT INTO `t_doctor` VALUES ('1', 'a001', '小冰', '22', '女', '13250401688', '441381199709101122', '眼科', '博士', '仙女', '2018-07-31'); INSERT INTO `t_doctor` VALUES ('2', 'a002', '小东', '24', '男', '18029000325', '441381199505015451', '外科', '硕士', null, '2018-07-31'); INSERT INTO `t_doctor` VALUES ('3', 'a003', '小张', '24', '男', '18029890325', '44138119950301223X', '儿科', '本科', null, '2018-07-31'); INSERT INTO `t_doctor` VALUES ('4', 'a004', '小杨', '22', '男', '18200964181', '441381199710003833', '外科', '本科', '', '2018-09-10'); -- ---------------------------- -- Table structure for `t_login` -- ---------------------------- DROP TABLE IF EXISTS `t_login`; CREATE TABLE `t_login` ( `L_ID` int(20) NOT NULL AUTO_INCREMENT, `L_No` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, `L_Pw` varchar(15) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, PRIMARY KEY (`L_ID`) ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1; -- ---------------------------- -- Records of t_login -- ---------------------------- INSERT INTO `t_login` VALUES ('1', 'a001', '123'); INSERT INTO `t_login` VALUES ('2', 'a002', '123'); INSERT INTO `t_login` VALUES ('3', 'a003', '123'); -- ---------------------------- -- Table structure for `t_medicines` -- ---------------------------- DROP TABLE IF EXISTS `t_medicines`; CREATE TABLE `t_medicines` ( `M_ID` int(20) NOT NULL AUTO_INCREMENT, `M_No` varchar(8) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, `M_Name` varchar(25) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, `M_Type` varchar(6) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, `M_FreeName` varchar(6) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, `M_Guige` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, `M_Stock` int(11) DEFAULT NULL, `M_Free` decimal(8,2) DEFAULT NULL, `M_Jixing` varchar(5) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, `M_Way` varchar(5) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, `M_Function` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, PRIMARY KEY (`M_ID`) ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1; -- ---------------------------- -- Records of t_medicines -- ---------------------------- INSERT INTO `t_medicines` VALUES ('1', 'm-001', '消炎眼药水', '西药', '西药费', '一日三次,每次两滴', '195', '15.50', '溶液剂', '外用', '眼球消炎'); INSERT INTO `t_medicines` VALUES ('2', 'm-002', '狂犬病疫苗', '西药', '西药费', '分五针打,一个半月打完', '500', '402.00', '注射液', '外用', '防范于狂犬病毒入侵'); INSERT INTO `t_medicines` VALUES ('3', 'm-003', '感冒药', '西药', '西药费', '一天三次,一次两片', '800', '32.00', '片剂', '口服', '治疗感冒'); INSERT INTO `t_medicines` VALUES ('4', 'm-004', '咳嗽药', '西药', '西药名', '一天三次', '200', '13.00', '片剂', '口服', '治疗咳嗽');
true
f0e829fa063e8234b2c3b39aca62d367bd0ae670
SQL
gsiems/tasker-schema
/schema/01_drop_database.sql
UTF-8
284
2.859375
3
[ "MIT" ]
permissive
\c postgres -- REVOKE CONNECT ON tasker FROM tasker_user ; -- Ensure that there are no other connections to the database SELECT pg_terminate_backend( pid ) FROM pg_stat_activity WHERE pid <> pg_backend_pid( ) AND datname = 'tasker'; DROP DATABASE IF EXISTS tasker;
true
c78e83d47a6ab0ebd68dd8be79e84ef612fe3b9d
SQL
TanDKY/NAIST_codereview
/SQL/select_revision.sql
UTF-8
625
3.90625
4
[]
no_license
SELECT rev.`id` as rev_id_db, rev.`rev_id`, heat.`change_id_db`, rev.`rev_patchSetNum` FROM `change_heat` heat INNER JOIN `t_revision` rev ON heat.`change_id_db` = rev.`rev_changeId` INNER JOIN (SELECT heat.`change_id_db`, COUNT(rev.`rev_patchSetNum`) FROM `change_heat` heat INNER JOIN `t_revision` rev ON heat.`change_id_db` = rev.`rev_changeId` WHERE heat.`last_patch` = rev.`rev_patchSetNum` OR rev.`rev_patchSetNum` = 1 GROUP BY heat.`change_id_db` HAVING COUNT(rev.`rev_patchSetNum`) > 1) h1 ON heat.`change_id_db` = h1.change_id_db WHERE heat.`last_patch` = rev.`rev_patchSetNum` OR rev.`rev_patchSetNum` = 1
true
f9d2b9d88cfd3481d61f8e6eb3669d3518e2dc4d
SQL
Jeong-hae-rim/sql
/exercise03.sql
UHC
1,166
3.46875
3
[]
no_license
select LENGTH('ѱ'), LENGTHB( 'ѱ' ) from dual; select job, substr(job, 1, 2), substr(job, 3, 2), substr(job,5) from emp; select job, length(job) from emp where length(job) >= 6; select concat(empno, ename), concat(empno, concat(', ' , ename)) from emp where ename = 'SMITH'; select sysdate, to_char(sysdate, 'ww') as w from dual; select * from emp; select * from dept; select * from emp, dept; select * from emp, dept where emp.deptno = dept.deptno; select * from emp, dept where emp.deptno = dept.deptno(+); select * from emp, dept where emp.deptno(+) = dept.deptno; select * from emp, dept where emp.deptno(+) = dept.deptno(+) ; select * from emp, dept where emp.deptno = dept.deptno(+) union select * from emp, dept where emp.deptno(+) = dept.deptno; select * from salgrade; select *from emp, salgrade where emp.sal between salgrade.losal and salgrade.hisal; select e1.empno, e1.ename, e1.mgr, e2.empno, e2.ename, e2.mgr from emp e1, emp e2 where e1.mgr = e2.empno; select e.ename, m.ename from emp e, emp m where e.mgr = m.empno; select e.ename, nvl(m.ename, '') from emp e, emp m where e.mgr = m.empno(+);
true
46ef0e01fa3ea4ce25af46574c5215bd7e17d8e0
SQL
Sher-V/InternetProvider
/Internet_Provider_SQLscripts/createDataBase.sql
UTF-8
2,813
3.828125
4
[]
no_license
CREATE database IF NOT EXISTS InternetProvider; USE InternetProvider; create table Client ( Client_Id int primary key auto_increment, Client_FirstName varchar(255) not null, Client_LastName varchar(255) not null, Client_Passport varchar(255) not null unique, Client_Birthday date not null ); create table Mounter ( Mounter_Id int primary key auto_increment, Mounter_FirstName varchar(255) not null, Mounter_LastName varchar(255) not null, Mounter_Passport varchar(255) not null unique, Mounter_Birthday date not null, Mounter_EmploymentDate date not null ); create table Service ( Service_Id int primary key auto_increment, Service_Name varchar(255) not null unique, Service_Price float not null ); create table Equipment ( Equipment_Id int primary key auto_increment, Equipment_Name varchar(255) not null unique, Equipment_Price float not null, Equipment_Count int not null ); create table ServiceOrder ( Order_Id int primary key auto_increment, Order_Date date not null, Order_Price float not null, Order_ClientId int not null, Order_MounterId int not null, Order_Address varchar(255) not null, constraint FK_OrderToClient foreign key(Order_ClientId) references Client(Client_Id), constraint FK_OrderToMounter foreign key(Order_MounterId) references Mounter(Mounter_Id) ); create table ServicesInOrders ( Order_Id int not null, Service_Id int not null, constraint FK_Order_Order_Id___ServicesInOrders_Order_Id foreign key(Order_Id) references ServiceOrder(Order_Id), constraint FK_Service_Service_Id___ServicesInOrders_Service_Id foreign key(Service_Id) references Service(Service_Id) ); create table EquipmentInOrders ( Order_Id int not null, Equipment_Id int not null, Equipment_Amount int not null, constraint FK_Order_Order_Id___EquipmentInOrders_Order_Id foreign key(Order_Id) references ServiceOrder(Order_Id), constraint FK_Equipment_Equipment_Id___EquipmentInOrders_Equipment_Id foreign key(Equipment_Id) references Equipment(Equipment_Id) ); create table Tariff ( Tariff_Id int primary key auto_increment, Tariff_Name varchar(255) not null unique, Tariff_MaxSpeed int not null, Tariff_Price float not null ); create table Contract ( Contract_Id int primary key auto_increment, Contract_ClientId int not null, Contract_ConclusionDate date not null, Contract_TerminationDate date, Contract_TariffId int, constraint FK_ContractToClient foreign key(Contract_ClientId) references Client(Client_Id), constraint FK_ContractToTariff foreign key(Contract_TariffId) references Tariff(Tariff_Id) ON DELETE SET NULL ); create table Users ( User_Id int primary key auto_increment, User_Login varchar(255) not null unique, User_Password varchar(255) not null, User_ClientId int, User_Role varchar(255) not null, constraint FK_UserToClient foreign key(User_ClientId) references Client(Client_Id) );
true
20fc0efbfba94464e79b5662ea634c0deefbaa3f
SQL
ajruckman/ContraCore
/internal/provision/sql/50_clickhousemig.sql
UTF-8
540
2.796875
3
[]
no_license
SELECT * FROM contradb.public.log_details_recent; SELECT array_to_json(answers) FROM log_details_recent; SELECT array_to_string(answers, ',') FROM log_details_recent; SELECT time::DATE AS eventdate, date_trunc('second', time)::TEXT, client, question, question_type, action, '"' || replace(array_to_json(answers)::TEXT, '"', '''') || '"' AS answers, client_hostname, client_mac, client_vendor FROM log;
true
716b846bb94c27403ef080e4f2c94de9332d43e7
SQL
starrail/SQL45
/19-32.sql
UTF-8
3,381
4.875
5
[]
no_license
#第五天: 19-32 # 19. 查询每门课程被选修的学生数 SELECT CId, COUNT(*) 学生数 FROM SC GROUP BY CId; # 20.查询出只选修两门课程的学生学号和姓名 select sid from sc group by sid having count(cid)=2; SELECT sid, sname FROM student WHERE sid IN (SELECT sid FROM sc GROUP BY sid HAVING COUNT(cid) = 2); select a.sid, b.sname from (select sid, count(*) from sc group by sid having count(cid)=2) a left join student b using(sid); # 21. 查询男生、女生人数 SELECT ssex, COUNT(*) FROM student GROUP BY ssex; # 22.查询名字中含有「风」字的学生信息 SELECT * FROM student WHERE sname LIKE '%风%' OR '风%'; # 23.查询同名同性学生名单,并统计同名人数 SELECT a.* FROM student a JOIN student b WHERE a.sname = b.sname and a.ssex=b.ssex AND a.sid != b.sid; select sname, ssex, count(*) from (SELECT a.* FROM student a JOIN student b WHERE a.sname = b.sname and a.ssex=b.ssex AND a.sid != b.sid) a group by sname, ssex; # 24. 查询 1990 年出生的学生名单 SELECT * FROM student WHERE sage LIKE '1990%'; SELECT * FROM student WHERE YEAR(sage) = '1990'; SELECT * FROM student WHERE LEFT(sage, 4) = '1990'; # 25. 查询每门课程的平均成绩,结果按平均成绩降序排列,平均成绩相同时,按课程编号升序排列 SELECT cid, AVG(score) AS avg_score FROM sc GROUP BY cid ORDER BY avg_score desc, cid; # 26. 查询平均成绩大于等于 85 的所有学生的学号、姓名和平均成绩 select sid, avg(score) avg_score from sc group by sid having avg(score) >= 85; SELECT sid, sname, avg_score FROM student LEFT JOIN (SELECT sid, AVG(score) avg_score FROM sc GROUP BY sid HAVING AVG(score) >= 85) a USING (sid); # 27. 查询课程名称为「数学」,且分数低于 60 的学生姓名和分数 SELECT student.sid, sname, sc. cid, score FROM student JOIN sc USING (sid) JOIN course USING (cid) WHERE score < 60 AND cname = '数学'; select cid from course where cname='数学'; select * from sc a left join student b using(sid) where cid = (select cid from course where cname='数学') and score<60; # 28. 查询所有学生的课程及分数情况(存在学生没成绩,没选课的情况) SELECT * FROM student LEFT JOIN sc USING (sid); # 29. 查询任何一门课程成绩在 70 分以上的姓名、课程名称和分数 SELECT c.sname, b.cname, a.score FROM sc a LEFT JOIN course b USING (cid) LEFT JOIN student c USING (sid) WHERE score > 70; # 30.查询不及格的课程 select distinct cid from sc where score<60; SELECT * FROM course WHERE cid IN (SELECT DISTINCT cid FROM sc WHERE score < 60); # 31.查询课程编号为 01 且课程成绩在 80 分以上的学生的学号和姓名 select * from sc; SELECT sid, sname FROM sc left JOIN student USING (sid) WHERE cid = '01' AND score > 80; # 32. 求每门课程的学生人数 SELECT cid, COUNT(sid) FROM sc GROUP BY cid;
true