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
e544aa4d81491d8bf6483e0384f601e54cd59699
SQL
mmarkou/stemming
/scripts/SQLQuery1.sql
UTF-8
221
2.703125
3
[]
no_license
UPDATE paper SET AbstractWithoutQuotes=LEFT(AbstractWithoutQuotes, CHARINDEX('©',AbstractWithoutQuotes)-2) WHERE AbstractWithoutQuotes LIKE '%©%' update dbo.paper SET StemmedAbstract =LTRIM(RTRIM(StemmedAbstract))
true
186460a7310af30eb6df312413eab8a21e1324b1
SQL
mayoricodevault/riot-core-services
/src/main/resources/cassandra_db_init.cql
UTF-8
2,076
3.609375
4
[ "Apache-2.0" ]
permissive
CREATE TABLE field_value_history ( field_id bigint, at timestamp, value text, x float, y float, PRIMARY KEY(field_id,at) ) WITH gc_grace_seconds = 1; CREATE INDEX ON field_value_history(x); CREATE INDEX ON field_value_history(y); CREATE TABLE field_value_history2 ( field_type_id bigint, //field type id thing_id bigint, //thing id time timestamp, value text, PRIMARY KEY((thing_id,field_type_id),time) ) WITH gc_grace_seconds = 1; /** hold the last value for thing **/ CREATE TABLE field_value ( field_id bigint, //field id thing_id bigint, //thing id value text, //value time timestamp, //field_id value PRIMARY KEY(field_id) ); CREATE INDEX ON field_value( thing_id ); CREATE INDEX ON field_value( value ); /** hold the last value for thing **/ CREATE TABLE field_type ( field_type_id bigint, //field type id thing_id bigint, //thing id value text, //value time timestamp, //field_id value PRIMARY KEY(field_type_id, thing_id) ); CREATE INDEX ON field_type( thing_id ); CREATE INDEX ON field_type( value ); /** hold the mqtt message sequence numbers **/ CREATE TABLE mqtt_sequence_number ( bridge_code text, //bridgeCode value bigint, //value time timestamp, //timestamp PRIMARY KEY(bridge_code,time) ); /** hold the things quantity for each zone **/ CREATE TABLE zone_count ( zone_name text, //zoneName things_quantity counter, //thingsQuantity PRIMARY KEY ((zone_name)) ); /* for sharaf exit_report */ CREATE TABLE exit_report ( thingType_id bigint, group_id bigint, thing_id bigint, time timestamp, zone varchar, value text, PRIMARY KEY(thing_id) ); CREATE INDEX ON exit_report( thingType_id ); CREATE INDEX ON exit_report( group_id ); CREATE INDEX ON exit_report( time ); CREATE INDEX ON exit_report( zone );
true
ec3dd9de95ce63123b74c7b61694ab2d0134f4c1
SQL
mbit-cloud/spring-data-mirage
/src/main/resources/org/springframework/data/mirage/repository/baseSelect.sql
UTF-8
444
3.5625
4
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
SELECT * FROM /*$table*/some_table /*BEGIN*/ WHERE /*IF id != null*/ /*$id_column_name*/id = /*id*/10 /*END*/ /*IF ids != null*/ /*$id_column_name*/id IN /*ids*/(10, 20, 30) /*END*/ /*IF absid != null*/ AND ABS(/*$id_column_name*/id) = /*absid*/10 /*END*/ /*END*/ /*IF orders != null*/ ORDER BY /*$orders*/id /*END*/ /*BEGIN*/ LIMIT /*IF offset != null*/ /*offset*/0, /*END*/ /*IF size != null*/ /*size*/10 /*END*/ /*END*/
true
0aa4a2dad22decedc44d375c7cf84bc76a233d79
SQL
lunaliwen/bamazon
/bamazon.sql
UTF-8
1,428
3.21875
3
[]
no_license
DROP DATABASE IF EXISTS bamazon; CREATE DATABASE bamazon; USE bamazon; CREATE TABLE products( item_id INT NOT NULL AUTO_INCREMENT, product_name VARCHAR(100) NOT NULL, department_name VARCHAR(45) NOT NULL, price INT default 0, stock_quantity INT default 0, PRIMARY KEY (item_id) ); INSERT INTO products (product_name, department_name, price, stock_quantity) VALUES ('cup', 'kitchen', 10, 20); INSERT INTO products (product_name, department_name, price, stock_quantity) VALUES ('spoon', 'kitchen', 3, 30); INSERT INTO products (product_name, department_name, price, stock_quantity) VALUES ('pot', 'kitchen', 26, 25); INSERT INTO products (product_name, department_name, price, stock_quantity) VALUES ('pillow', 'home', 30, 50); INSERT INTO products (product_name, department_name, price, stock_quantity) VALUES ('ipad', 'electronics', 300, 50); INSERT INTO products (product_name, department_name, price, stock_quantity) VALUES ('quilt', 'home', 44, 22); INSERT INTO products (product_name, department_name, price, stock_quantity) VALUES ('lamp', 'home', 15, 33); INSERT INTO products (product_name, department_name, price, stock_quantity) VALUES ('earphone', 'electronics', 100, 40); INSERT INTO products (product_name, department_name, price, stock_quantity) VALUES ('drawer', 'home', 22, 38); INSERT INTO products (product_name, department_name, price, stock_quantity) VALUES ('basket', 'home', 16, 60);
true
ed8229e8b7ebfa59b015565a56448da5e7172a14
SQL
cn-panda/JavaCodeAudit
/【02】SQL 漏洞原理与实际案例介绍/ofcms/ofcms-admin/src/main/resources/conf/sql/system/log.sql
UTF-8
911
3.203125
3
[ "MIT" ]
permissive
#sql("query") select * from of_sys_oper_log where status = '1' #if (oper_date??) and oper_date = #para(oper_date)#end #if (user_name??) and user_name like concat('%', #para(user_name), '%')#end #if (sort?? && field) order by order_field order_sort #else order by logid desc #end #end #sql("detail") select * from of_sys_oper_log where logid = #para(logid) #end #sql("save") INSERT INTO of_sys_oper_log (user_id, user_name, function_name, business_code, oper_date, oper_time, oper_desc, status) VALUES (#para(user_id), #para(user_name),#para(function_name),#para(business_code), now(), now(), #para(function_name), '1') #end #sql("delete") delete from of_sys_oper_log where logid = #para(logid) #end #sql("update") update of_sys_oper_log set role_name = #para(role_name),role_type = #para(role_type),role_desc = #para(role_desc),status = #para(status) where role_id = #para(role_id) #end
true
dea6afe986a6d124c7287f4dd75d661758355730
SQL
ThomasMalfilatre/PlanningBundle
/DBgelot.sql
UTF-8
2,228
3.1875
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 4.1.5 -- http://www.phpmyadmin.net -- -- Client : info2 -- Généré le : Mar 11 Février 2014 à 10:16 -- Version du serveur : 5.5.24-4-log -- Version de PHP : 5.4.9-4ubuntu2.4 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8 */; -- -- Base de données : `DBgelot` -- -- -------------------------------------------------------- -- -- Structure de la table `ACTIVITE` -- CREATE TABLE IF NOT EXISTS `ACTIVITE` ( `id` int(4) NOT NULL, `nom` varchar(30) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Contenu de la table `ACTIVITE` -- INSERT INTO `ACTIVITE` (`id`, `nom`) VALUES (1, 'Java'), (2, 'Python'), (3, 'Anglais'), (4, 'Repos'), (5, 'Café'), (6, 'PHP'); -- -------------------------------------------------------- -- -- Structure de la table `PARTICIPE` -- CREATE TABLE IF NOT EXISTS `PARTICIPE` ( `users` varchar(20) NOT NULL, `activite` int(4) NOT NULL, `Date` date NOT NULL, `Heure` time NOT NULL, PRIMARY KEY (`users`,`activite`,`Date`,`Heure`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Contenu de la table `PARTICIPE` -- INSERT INTO `PARTICIPE` (`users`, `activite`, `Date`, `Heure`) VALUES ('admin', 2, '2014-11-02', '12:00:00'), ('admin', 3, '2014-11-02', '13:00:00'), ('admin', 4, '2014-11-02', '13:00:00'), ('admin', 5, '2014-02-02', '13:00:00'); -- -------------------------------------------------------- -- -- Structure de la table `USERS` -- CREATE TABLE IF NOT EXISTS `USERS` ( `login` varchar(20) NOT NULL, `passwd` varchar(40) NOT NULL, PRIMARY KEY (`login`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Contenu de la table `USERS` -- INSERT INTO `USERS` (`login`, `passwd`) VALUES ('admin', '21232f297a57a5a743894a0e4a801fc3'), ('thomas', 'ef6e65efc188e7dffd7335b646a85a21'), ('toto', 'f71dbe52628a3f83a77ab494817525c6'); /*!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
67edaf234227ba75eb25f432d6fd303a9612ee7f
SQL
not-yet-define/resturent-DF-pipe
/ddl.sql
UTF-8
8,768
3.65625
4
[]
no_license
-- check table definition select * from information_schema.columns where table_schema = 'exposed' and table_name = 'order_line_96586'; -- create tables in azure sql database create table order_line_history ( id bigint, bill_id bigint, store_id bigint, store_name text, area_id text, area_name text, revenue_center_id text, revenue_center_name text, sales_channel text, article_id text, article_name text, article_group_id bigint, order_type text, vat_rate numeric, currency text, timestamp timestamp without time zone, order_id text, quantity numeric, price_subtotal numeric, vat numeric, discount numeric, service_charge numeric, cost numeric, price_including_all numeric, price_excluding_all numeric, order_reference text, order_unique_id bigint ); -- create tables in azure sql database create table order_line_last24h ( id bigint, bill_id bigint, store_id bigint, store_name text, area_id text, area_name text, revenue_center_id text, revenue_center_name text, sales_channel text, article_id text, article_name text, article_group_id bigint, order_type text, vat_rate numeric, currency text, timestamp datetime2, order_id text, quantity numeric, price_subtotal numeric, vat numeric, discount numeric, service_charge numeric, cost numeric, price_including_all numeric, price_excluding_all numeric, order_reference text, order_unique_id bigint ); -- history data by year select distinct extract(year from order_line_96586.timestamp) from exposed.order_line_96586; -- last 24 hours records select min(order_line_96586.timestamp), max(order_line_96586.timestamp) from exposed.order_line_96586 where order_line_96586.timestamp > '2021-09-17 00:00:00.000000 +00:00'::timestamp - interval '24 hours'; select * from exposed.order_line_96586 where order_line_96586.timestamp > current_timestamp - interval '10 minutes'; select * from exposed.order_line_96586 where order_line_96586.timestamp > '2021-09-16 00:00:00.000000 +00:00'; select * from exposed.order_line_96586 where extract(year from order_line_96586.timestamp) = '2021' and order_line_96586.timestamp <= '2021-09-17 00:00:00.000000 +00:00'; SELECT * FROM pg_timezone_names WHERE name = current_setting('TIMEZONE'); SELECT '2021-09-17 00:00:00.000000 +00:00'::timestamp - interval '24 hours'; select count(*) from exposed.order_line_96586 where exposed.order_line_96586.timestamp <= '2021-09-23 17:08:00.000000'; -- 2021-09-23 17:08:00.000000 -- 2021-09-16 15:43:00.000000 -- 2021-09-16 13:51:13.543445 +00:00 select count(*) from exposed.order_line_96586 where order_line_96586.timestamp > '2021-07-31 00:00:00.000000 +00:00' and order_line_96586.timestamp <= '2021-08-31 00:00:00.000000 +00:00'; DELETE FROM exposed.order_line_96586 WHERE current_timestamp - interval '60 days'; select count(*) from exposed.order_line_96586 where exposed.order_line_96586.timestamp >= '2021-09-23 17:08:00.000000' - interval '60 days'; select count(*) from exposed.bill_96586 where exposed.bill_96586.timestamp <= '2021-09-23 17:27:00.000000'; ----------------------------------------------------------------------------- select * from information_schema.columns where table_schema = 'exposed' and table_name = 'bill_96586'; create table bill ( id bigint, store_id bigint, store_name text, area_id text, area_name text, currency text, dining_type text, timestamp datetime, bill_id text, accountable bit, price_subtotal numeric, vat numeric, discount numeric, service_charge numeric, price_including_all numeric, price_excluding_all numeric, tip numeric ); select distinct extract(year from bill_96586.timestamp) from exposed.bill_96586; -- 2018 -- 2019 -- 2020 -- 2021 select count(*) from exposed.bill_96586; -- 924136 select * from information_schema.columns where table_schema = 'exposed' and table_name = 'number_of_guests_96586'; create table number_of_guests ( id bigint, store_id bigint, store_name text, area_id text, area_name text, table_session_id text, table_name text, dining_type text, session_begin_timestamp datetime2, session_end_timestamp datetime2, number_of_guests integer, storage_timestamp datetime2 ); select distinct extract(year from number_of_guests_96586.storage_timestamp) from exposed.number_of_guests_96586; -- 2019 -- 2020 -- 2021 select count(*) from exposed.number_of_guests_96586; -- 916692 select * from information_schema.columns where table_schema = 'exposed' and table_name = 'payment_96586'; create table payment ( id bigint, payment_type_description text, payment_type_name text, card_acquirer text, bill_id bigint, store_id bigint, store_name text, bill_timestamp datetime2, amount numeric, tip numeric, adjustment numeric, storage_timestamp datetime2 ); select distinct extract(year from payment_96586.storage_timestamp) from exposed.payment_96586; -- 2019 -- 2020 -- 2021 select count(*) from exposed.payment_96586; -- 924628 select * from information_schema.columns where table_schema = 'exposed' and table_name = 'line_ingredients_96586'; create table ingredients ( id bigint, order_line_id bigint, store_id bigint, store_name text, ingredient_id bigint, ingredient_name text, ingredient_status text, unit_name text, unit_value numeric, timestamp datetime2, created_at datetime2, updated_at datetime2 ); select distinct extract(year from line_ingredients_96586.timestamp) from exposed.line_ingredients_96586; -- 2021 -- 2020 select count(*) from exposed.line_ingredients_96586; -- 69233 select * from information_schema.columns where table_schema = 'exposed' and table_name = 'consumer_loyalty_points_96586'; create table consumer_loyalty_points ( id bigint, amount numeric, value numeric, creation_type text, reason_type text, store_id bigint, store_name text, loyalty_program_id bigint, loyalty_program_name text, consumer_id bigint, consumer_name text, consumer_email text, order_id bigint, order_reference text, article_id text, article_reference text, article_name text, timestamp datetime2 ); select distinct extract(year from consumer_loyalty_points_96586.timestamp) from exposed.consumer_loyalty_points_96586; -- 2021 select count(*) from exposed.consumer_loyalty_points_96586; -- 24365 select * from information_schema.columns where table_schema = 'exposed' and table_name = 'app_consumer_96586'; create table app_consumer ( consumer_id bigint, platform text, consumer_device_created_at timestamp without time zone, consumer_device_updated_at timestamp without time zone, stored_timestamp timestamp without time zone ); select distinct extract(year from app_consumer_96586.stored_timestamp) from exposed.app_consumer_96586; -- 2021 -- 2020 select count(*) from exposed.app_consumer_96586; -- 205508 ------------------------------------------------------------------------------------------------------------------------ -- 24 hr update select * from exposed.order_line_96586 where order_line_96586.timestamp > current_timestamp + interval '2 hours' - interval '24 hours'; select current_timestamp::date; select * from exposed.order_line_96586 where order_line_96586.timestamp >= current_timestamp - interval '5 days';
true
d74db30aa716ede63a8421b58b77f35715805a94
SQL
xianfengxiong/finance-data
/fund/src/main/script/fund.sql
UTF-8
2,179
3.8125
4
[ "Apache-2.0" ]
permissive
# fund 数据库 CREATE DATABASE IF NOT EXISTS fund DEFAULT CHARACTER SET utf8; USE fund; # 基金基本信息 CREATE TABLE fund_basic_info( `id` BIGINT AUTO_INCREMENT, `code` VARCHAR(10) NOT NULL COMMENT '基金代码', `found_date` DATE COMMENT '成立日期', `short_name` VARCHAR(50) COMMENT '基金简称', `full_name` VARCHAR(100) COMMENT '基金全称', `mmf` BIT COMMENT '是否货币基金', PRIMARY KEY (`id`) ); CREATE UNIQUE INDEX `code_idx` ON fund_basic_info(`code`); # 非货币基金净值 CREATE TABLE IF NOT EXISTS nav_nmf( `id` BIGINT AUTO_INCREMENT, `code` VARCHAR(10) NOT NULL COMMENT '基金代码', `date` DATE NOT NULL COMMENT '净值日期', `source` VARCHAR(50) NOT NULL COMMENT '数据来源', `unit_nav` DECIMAL(10,4) COMMENT '单位净值', `accum_nav` DECIMAL(10,4) COMMENT '累计净值', PRIMARY KEY (`id`) ) COMMENT '非货币基金净值'; # 创建唯一索引 CREATE UNIQUE INDEX `code_date_source_idx` ON nav_nmf (`code`,`date`,`source`); # 货币基金净值 CREATE TABLE IF NOT EXISTS nav_mmf( `id` BIGINT AUTO_INCREMENT, `code` VARCHAR(10) NOT NULL COMMENT '基金代码', `date` DATE NOT NULL COMMENT '净值日期', `source` VARCHAR(50) NOT NULL COMMENT '数据来源', `yield_7days` DECIMAL(10,4) COMMENT '7日年化收益率', `yield_10k` DECIMAL(10,5) COMMENT '每万分收益', PRIMARY KEY (`id`) ) COMMENT '货币基金净值'; # 创建唯一索引 CREATE UNIQUE INDEX `code_date_source_idx` on nav_mmf (`code`,`date`,`source`); # 定时任务 CREATE TABLE IF NOT EXISTS cron_task( `id` BIGINT AUTO_INCREMENT, `name` VARCHAR(30) COMMENT '任务名称', `bean_name` VARCHAR(100) COMMENT 'Bean的名称', `method_name` VARCHAR(100) COMMENT '调用的方法名称', `cron` VARCHAR(100) COMMENT 'cron表达式', PRIMARY KEY (`id`) ); INSERT INTO cron_task(name,bean_name,method_name,cron) VALUES ('网易财经净值','navTask','crawlNavNTES','0 0 18 * * *'), ('新浪财经基金净值','navTask','crawlNavSINA','0 0 19 * * *'), ('东方财富网','navTask','crawlNavEM','0 0 20 * * *'), ('腾讯财经基金净值','navTask','crawlNavTENCENT','0 30 19 * * *');
true
1c149d1ef07d0293057d6fb782a88c26673035e8
SQL
pilot3554/TDC-SQL-Scripts
/Scripts/report - KDM email counts.sql
UTF-8
794
3.625
4
[]
no_license
-- select top 10 * from dbo.tblKeyGenJobs select top 10 * from dbo.KdmDeliveryHistory order by 1 desc select top 10 * from dbo.KdmDeliverySetting select top 10 * from dbo.tblTheatres select top 10 c.country, * from KdmDeliveryHistory a with (nolock) inner join KdmDeliverySetting b with (nolock) on a.kdmdeliverysettingid = b.kdmdeliverysettingid inner join tblTheatres c with (nolock) on a.tcn = c.companycode where b.kdmdeliverytypeid = 1 and year(a.deliverystarted)=2014 select c.country,count(*) as cc from KdmDeliveryHistory a with (nolock) inner join KdmDeliverySetting b with (nolock) on a.kdmdeliverysettingid = b.kdmdeliverysettingid inner join tblTheatres c with (nolock) on a.tcn = c.companycode where b.kdmdeliverytypeid = 1 and year(a.deliverystarted)=2014 group by c.country
true
b8605506e2714d7bbb233105795bdbfa29c5a74e
SQL
santiReynaga97/ViewBiblioteca
/biblioteca.sql
UTF-8
4,269
3.53125
4
[]
no_license
-- phpMyAdmin SQL Dump -- version 4.7.0 -- https://www.phpmyadmin.net/ -- -- Servidor: 127.0.0.1 -- Tiempo de generación: 11-07-2017 a las 17:14:15 -- Versión del servidor: 10.1.24-MariaDB -- Versión de PHP: 7.1.6 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: `biblioteca` -- DELIMITER $$ -- -- Procedimientos -- CREATE DEFINER=`root`@`localhost` PROCEDURE `LibroActualizar` (IN `pId` INT, IN `pNom` VARCHAR(50), IN `pDes` VARCHAR(100), IN `pIdAutor` INT, IN `pIdCat` INT, IN `pAnioP` DATE, IN `pIdTip` INT, IN `pCant` INT) NO SQL BEGIN UPDATE libros SET libros.nombre = pNom, libros.descripcion=pDes, libros.id_autor=pIdAutor, libros.id_categoria =pIdCat, libros.anio_publicacion=pAnioP, libros.id_tipo_libro=pIdTip, libros.cantidad_paginas=pCant WHERE libros.id = pId; END$$ CREATE DEFINER=`root`@`localhost` PROCEDURE `LibroAgregar` (IN `pNom` VARCHAR(50), IN `pDes` VARCHAR(100), IN `pIdAutor` INT UNSIGNED, IN `pIdCat` INT UNSIGNED, IN `pAnioP` DATE, IN `pIdTip` INT UNSIGNED, IN `pCant` INT UNSIGNED) NO SQL COMMENT 'AgregarLIBRO' BEGIN INSERT INTO `Libros`( `nombre`, `descripcion`, `id_autor`, `id_categoria`,`anio_publicacion`, `id_tipo_libro`,`cantidad_paginas`) VALUES (pNom,pDes,pIdAutor,pIdCat,pAnioP,pIdTip,pCant); END$$ CREATE DEFINER=`root`@`localhost` PROCEDURE `LibroEliminar` (IN `pId` INT) NO SQL BEGIN DELETE FROM libros WHERE libros.id = pId; END$$ CREATE DEFINER=`root`@`localhost` PROCEDURE `ListaLibros` () NO SQL BEGIN SELECT libros.id,libros.nombre,libros.descripcion,libros.id_autor, libros.id_categoria,libros.id_tipo_libro,libros.cantidad_paginas FROM libros; END$$ CREATE DEFINER=`root`@`localhost` PROCEDURE `ObtenerLibro` (IN `pId` INT) NO SQL BEGIN SELECT libros.id,libros.nombre,libros.descripcion,libros.id_autor, libros.id_categoria,libros.id_tipo_libro,libros.cantidad_paginas FROM libros WHERE libros.id=pId; END$$ DELIMITER ; -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `libros` -- CREATE TABLE `libros` ( `id` int(11) NOT NULL, `nombre` varchar(50) NOT NULL, `descripcion` varchar(100) NOT NULL, `id_autor` int(11) NOT NULL, `id_categoria` int(11) NOT NULL, `anio_publicacion` date NOT NULL, `id_tipo_libro` int(11) NOT NULL, `cantidad_paginas` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Volcado de datos para la tabla `libros` -- INSERT INTO `libros` (`id`, `nombre`, `descripcion`, `id_autor`, `id_categoria`, `anio_publicacion`, `id_tipo_libro`, `cantidad_paginas`) VALUES (2, 'LOS CERDITOS', 'SE LOS COMEN', 2, 3, '0000-00-00', 2, 12), (3, 'caperrusita roja', 'se comen a caperusita', 3, 2, '0000-00-00', 1, 20), (4, 'caperucita3', 'la niña roja q se lo come ', 2, 1, '0001-01-01', 2, 555), (5, 'caperrusita roja', 'se comen a caperusita', 3, 2, '0000-00-00', 1, 20), (6, 'caperrusita roja', 'se comen a caperusita', 3, 2, '0000-00-00', 1, 20), (8, 'caperrusita roja', 'se comen a caperusita', 3, 2, '2014-06-10', 1, 20), (9, 'Los 3 cerditos', 'cacaaaaa', 0, 0, '0001-01-01', 0, 0), (10, 'Las mil y una noches', 'Este libro habla sobre las aventasdsadas', 1, 2, '2017-05-12', 3, 67), (11, 'popeye el marino', 'un marino que salvaba a la gente', 3, 1, '1995-05-22', 2, 23), (13, 'los minions', 'juguetes', 1, 2, '2017-05-12', 1, 323); -- -- Índices para tablas volcadas -- -- -- Indices de la tabla `libros` -- ALTER TABLE `libros` ADD PRIMARY KEY (`id`); -- -- AUTO_INCREMENT de las tablas volcadas -- -- -- AUTO_INCREMENT de la tabla `libros` -- ALTER TABLE `libros` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=14;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
650dece7b8fc540a80712be83b1de5a7f52060c0
SQL
taufiqsejati/WebDevelopment
/mp3sekolah/db_sekolah.sql
UTF-8
4,907
3.140625
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 4.6.4 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Generation Time: Aug 01, 2019 at 12:28 PM -- Server version: 5.7.14 -- PHP Version: 7.0.10 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: `dbsekolahmp3` -- CREATE DATABASE IF NOT EXISTS `dbsekolahmp3` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci; USE `dbsekolahmp3`; -- -------------------------------------------------------- -- -- Table structure for table `guru` -- CREATE TABLE `guru` ( `nip` int(11) NOT NULL, `nama` char(20) DEFAULT NULL, `kd_mapel` varchar(5) NOT NULL, `tanggal_lahir` date NOT NULL, `jk` varchar(1) NOT NULL, `agama` varchar(15) NOT NULL, `telp` varchar(15) NOT NULL, `tahun_mengajar` int(4) NOT NULL, `alamat` char(50) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `guru` -- INSERT INTO `guru` (`nip`, `nama`, `kd_mapel`, `tanggal_lahir`, `jk`, `agama`, `telp`, `tahun_mengajar`, `alamat`) VALUES (100001, 'Ibnu Maulana', 'IPA', '2019-03-12', 'L', 'Islam', '089558739213', 2000, 'Jl. Lurus'), (100002, 'Reni Mayani', 'MTK', '2001-08-10', 'P', 'Kristen', '08775434545', 2005, 'Jl. Dahlia 5 No. 7'), (100003, 'Indri', 'IPS', '1989-01-02', 'P', 'Budha', '0843534342', 2000, 'Jl. Kamboja Raya No. 1'), (100004, 'Tuti Wibowo', 'MTK', '1990-08-17', 'P', 'Islam', '0878754354324', 2005, 'Jl. Wijaya No.9'), (100005, 'Wahyuni', 'IPS', '1975-05-01', 'P', 'Hindu', '088724324312', 2006, 'Jl. Teratai 4 No.58'), (100006, 'Indri Syahlindri', 'PAI', '2019-07-13', 'P', 'Islam', '078978349535', 2005, 'Jakarta'); -- -------------------------------------------------------- -- -- Table structure for table `mapel` -- CREATE TABLE `mapel` ( `kd_mapel` varchar(3) NOT NULL, `nama_mapel` varchar(50) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `mapel` -- INSERT INTO `mapel` (`kd_mapel`, `nama_mapel`) VALUES ('BHS', 'Bahasa'), ('IPA', 'Ilmu Pengetahuan Alam'), ('IPS', 'Ilmu Pengetahuan Sosial'), ('MTK', 'Matematika'), ('OR', 'Olah Raga'), ('PAI', 'Pendidikan Agama Islam'), ('PLH', 'Pendidikan Lingkungan Hidup'); -- -------------------------------------------------------- -- -- Table structure for table `nilai` -- CREATE TABLE `nilai` ( `id_nilai` int(5) NOT NULL, `nis` int(11) NOT NULL, `kd_mapel` varchar(3) NOT NULL, `nilai_harian` decimal(4,2) NOT NULL, `nilai_uts` decimal(4,2) NOT NULL, `nilai_uas` decimal(4,2) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `nilai` -- INSERT INTO `nilai` (`id_nilai`, `nis`, `kd_mapel`, `nilai_harian`, `nilai_uts`, `nilai_uas`) VALUES (2001, 19001, 'MTK', '90.00', '70.00', '80.00'), (2002, 19002, 'IPS', '67.00', '90.00', '87.00'), (2003, 19004, 'BHS', '60.00', '50.00', '40.00'); -- -------------------------------------------------------- -- -- Table structure for table `siswa` -- CREATE TABLE `siswa` ( `nis` int(11) NOT NULL, `nama` char(20) DEFAULT NULL, `tempat_lahir` varchar(40) NOT NULL, `tanggal_lahir` date NOT NULL, `jk` varchar(1) NOT NULL, `agama` varchar(15) NOT NULL, `alamat` varchar(100) NOT NULL, `telp` varchar(15) NOT NULL, `nip` int(11) DEFAULT NULL, `tahun_masuk` int(4) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `siswa` -- INSERT INTO `siswa` (`nis`, `nama`, `tempat_lahir`, `tanggal_lahir`, `jk`, `agama`, `alamat`, `telp`, `nip`, `tahun_masuk`) VALUES (19001, 'Denis Ahmad', 'Jakarta', '2001-01-01', 'L', 'Katholik', 'Jl. Angin Biru', '088965434', 100001, 2019), (19002, 'Astuti Wulandari', 'Bandung', '2001-07-02', 'P', 'Islam', 'Jl. Laut gelap', '0854434854', 100001, 2019), (19003, 'Manohara Adelia', 'Surabaya', '2001-04-20', 'P', 'Islam', 'Jl. Baju bagus', '08998743543', 100002, 2019), (19004, 'Hasan Sabri', 'Yogyakarta', '2001-07-01', 'L', 'Islam', 'Jl. celana lengan panjang', '08787643254', 100002, 2019), (19005, 'Budi Santoso', 'Semarang', '2001-08-11', 'L', 'Islam', 'Jl. topi miring', '0858753451', 100001, 2019), (19006, 'Ahmad Fansory', 'Bekasi', '2019-07-02', 'L', 'Islam', 'Jakarta', '089214217421', 100006, 2001); -- -- Indexes for dumped tables -- -- -- Indexes for table `guru` -- ALTER TABLE `guru` ADD PRIMARY KEY (`nip`); -- -- Indexes for table `mapel` -- ALTER TABLE `mapel` ADD PRIMARY KEY (`kd_mapel`); -- -- Indexes for table `nilai` -- ALTER TABLE `nilai` ADD PRIMARY KEY (`id_nilai`); -- -- Indexes for table `siswa` -- ALTER TABLE `siswa` ADD PRIMARY KEY (`nis`); /*!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
8d45792e0b1820532502ee7dee907eb71ea23f2e
SQL
openapi-onestore/sample-web-admin
/sample-web/src/main/resources-development/embedded/sql/schema.sql
UTF-8
1,181
2.5625
3
[]
no_license
CREATE TABLE file_payment_table ( `mid` varchar(45) NOT NULL, `billing_token` varchar(45) DEFAULT NULL, `product_id` varchar(45) DEFAULT NULL, `product_name` varchar(45) DEFAULT NULL, `order_no` varchar(45) DEFAULT NULL, `amt_request_purchase` varchar(45) DEFAULT NULL, `amt_carrier` varchar(45) DEFAULT NULL, `amt_credit_card` varchar(45) DEFAULT NULL, `amt_tms` varchar(45) DEFAULT NULL, PRIMARY KEY (`mid`) ); CREATE TABLE file_payment_request ( `mid` bigint NOT NULL, `status` varchar(45) DEFAULT NULL, `result_code` varchar(10) DEFAULT NULL, `result_msg` varchar(45) DEFAULT NULL, `waiting_jobs` varchar(45) DEFAULT NULL, `job_id` varchar(45) NOT NULL, `upload_file` varchar(45) DEFAULT NULL, `upload_date` varchar(45) DEFAULT NULL, `verify_message` varchar(45) DEFAULT NULL, PRIMARY KEY (`mid`) ); CREATE TABLE file_payment_noti_result ( `job_id` varchar(45) NOT NULL, `event` varchar(45) DEFAULT NULL, `status` varchar(20) DEFAULT NULL, `update_date` varchar(45) DEFAULT NULL, `noti_version` varchar(10) DEFAULT NULL, PRIMARY KEY (`job_id`) ); ALTER TABLE file_payment_request ALTER COLUMN mid bigint AUTO_INCREMENT;
true
d734c87fa6fdbc83e99b3108946fb2ee445b7568
SQL
dandockery/csci3410_mysql
/procedure_example.sql
UTF-8
1,447
4
4
[]
no_license
use Chattahoochee; -- temporarily change the delimiter to something else delimiter // -- this procedure will perform 4 statements to process -- items in the shopping cart DROP PROCEDURE IF EXISTS processShoppingCart; CREATE PROCEDURE processShoppingCart ( IN CustomerID INT, IN AddressID INT ) BEGIN -- create the Order record insert into Orders (cust_id, address_id, purchased_on, total_items_sold, total_price_sold) select CustomerID, AddressID, now(), sum(s.quantity), sum(s.quantity * p.price_per_item) from ShoppingCart as s join Products as p on s.product_id = p.product_id where s.cust_id = CustomerID and s.saved_for_later = 0; -- grab the identity of the last insert set @order_id = last_insert_id(); -- create the Order Detail records insert into OrderDetails (order_id, prod_id, quantity_purchased, price_per_item) select @order_id, p.product_id, s.quantity, p.price_per_item from ShoppingCart as s join Products as p on s.product_id = p.product_id where s.cust_id = CustomerID and s.saved_for_later = 0; -- update products to reflect reduction in inventory update Products as p join ShoppingCart as s on p.product_id = s.product_id set p.qty_on_hand = p.qty_on_hand - s.quantity where s.cust_id = CustomerID and s.saved_for_later = 0; -- delete records from shopping cart delete from ShoppingCart where cust_id = CustomerID and saved_for_later = 0; END// -- change the delimiter back to the normal semi-colon delimiter ;
true
cf04bbd0dfb78ac4ca8dddbba8e33c025ecf5d1c
SQL
Tianranxu/wg
/database/138_create_table_of_pay_type_temp.sql
UTF-8
658
3.53125
4
[]
no_license
DROP TABLE IF EXISTS `fx_pay_type_temp`; CREATE TABLE `fx_pay_type_temp` ( `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键ID' , `pay_id` int(11) UNSIGNED NOT NULL COMMENT '支付表ID' , `type` tinyint(2) UNSIGNED NOT NULL DEFAULT 1 COMMENT '付款方式 1-现金 2-刷卡 3-银行转账 99-其他,默认为1' , `remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL COMMENT '备注' , `update_time` datetime NULL COMMENT '更新时间' , PRIMARY KEY (`id`), INDEX `pay_id` (`pay_id`) USING BTREE COMMENT '支付表ID' ) ENGINE=InnoDB DEFAULT CHARACTER SET=utf8 COLLATE=utf8_unicode_ci ROW_FORMAT=COMPACT ;
true
78c10d668bb65515f273f3922d236af08e7a12e8
SQL
bellmit/origin
/family_order/sql/NormalPara/td_m_depart_openagent.sql
UTF-8
365
3.15625
3
[]
no_license
--IS_CACHE=Y select /*+INDEX(a IDX_TD_M_DEPART_RSVALUE2)*/ depart_code PARACODE,depart_name PARANAME from td_m_depart a where rsvalue2=:TRADE_EPARCHY_CODE and validflag='0' and start_date<=sysdate and end_date>=sysdate and exists (select 1 from td_m_departkind b where b.depart_kind_code=a.depart_kind_code and b.code_type_code='0')
true
acd82a65c212956e8757994e30562b7fb4af82cc
SQL
amunhotep/lib-th001
/IDE/ERP/DBO/SQL/OBJECTEDITOR/LINKS_SEL.SQL
UTF-8
1,984
3.515625
4
[]
no_license
EXECUTE BLOCK ( Q_OBJ_ID TYPE OF COLUMN TABL$_TB.ID = ?OBJ_ID ,Q_OBJ_TYPE TYPE OF COLUMN TABL$_TB.BASE_TYPE_ID = ?OBJ_TYPE )RETURNS ( OBJ_ID TYPE OF COLUMN TABL$_TB.ID ,OBJ_TYPE TYPE OF COLUMN TABL$_TB.BASE_TYPE_ID ,TYPE_ID TYPE OF COLUMN TABL$_TB.TYPE_ID ,TYPE_NAME TYPE OF COLUMN TABL$_TB_TYPES.NAME ,TYPE_PATH DOMN$PSTRING_8192 ,BASE_TYPE_ID TYPE OF COLUMN TABL$_TB.BASE_TYPE_ID ,IMG_INDX TYPE OF COLUMN TABL$_TB.BASE_TYPE_ID ,ID TYPE OF COLUMN TABL$_TB.ID ,NAME TYPE OF COLUMN TABL$_TB.NAME ,FLAG_MASTER TYPE OF COLUMN TABL$_TB.FLAG_MASTER ,TC_ID TYPE OF COLUMN TABL$_TB_COLS.ID ,TC_NAME TYPE OF COLUMN TABL$_TB_COLS.NAME ,TC_FLAG TYPE OF COLUMN TABL$_TB_COLS.FLAG_DELETE )AS BEGIN OBJ_ID = :Q_OBJ_ID; OBJ_TYPE = :Q_OBJ_TYPE; FOR SELECT TB.BASE_TYPE_ID, TB.TYPE_ID, T.NAME AS TYPE_NAME, TC.TB_ID, TB.NAME AS TB_NAME, TC.ID, TC.NAME, TC.FLAG_DELETE, TB.FLAG_MASTER FROM TABL$_TB_COLS TC, TABL$_TB TB, TABL$_TB_TYPES T WHERE ( (TRIM(TC.REF_TABLE) = :Q_OBJ_ID) OR (TC.CALC_SQL CONTAINING :Q_OBJ_ID) ) AND (TB.ID = TC.TB_ID) AND (T.ID = TB.TYPE_ID) ORDER BY TB.BASE_TYPE_ID, TB.NAME, TC.NAME INTO :BASE_TYPE_ID, :TYPE_ID, :TYPE_NAME, :ID, :NAME, :TC_ID, :TC_NAME, :TC_FLAG, :FLAG_MASTER DO BEGIN WITH RECURSIVE TTT AS( SELECT FIRST 1 T1.ID, T1.PARENT_ID, '"'||T1.NAME||'"' AS NAME FROM TABL$_TB_TYPES T1 WHERE (T1.ID = :TYPE_ID) UNION ALL SELECT FIRST 1 T2.ID, T2.PARENT_ID, '"'||T2.NAME||'" / '||T3.NAME AS NAME FROM TABL$_TB_TYPES T2, TTT T3 WHERE (T2.ID = T3.PARENT_ID) )SELECT FIRST 1 R.NAME FROM TTT R WHERE (R.ID = :BASE_TYPE_ID) INTO :TYPE_PATH; IMG_INDX = :BASE_TYPE_ID; IF(:BASE_TYPE_ID = 4)THEN BEGIN IF(:FLAG_MASTER = 1)THEN IMG_INDX = :BASE_TYPE_ID + 10; END SUSPEND; END END
true
413e46657278ec70063c4a375767dd163b56ab4c
SQL
spitrola/BookStoreDatabase
/A5.sql
UTF-8
8,581
4.4375
4
[]
no_license
/* File: A5.sql, Winter 2014, Comp2521, A5 Prepared On: April 11, 2014 Prepared By: Sonia Pitrola */ \! rm -f A5.log tee A5.log -- setting foreign key checks to zero SET foreign_key_checks = 0; -- Dropping tables DROP TABLE IF EXISTS User; DROP TABLE IF EXISTS Book; DROP TABLE IF EXISTS Author; DROP TABLE IF EXISTS BookAuthor; DROP TABLE IF EXISTS ReadBook; -- setting foreign key checks to one SET foreign_key_checks = 1; -- creating table User CREATE TABLE User( Email VARCHAR(100) PRIMARY KEY, DateAdded TIMESTAMP NOT NULL, NickName VARCHAR(100) UNIQUE, Profile VARCHAR (300) ); -- creating table Book CREATE TABLE Book( BookID INT PRIMARY KEY AUTO_INCREMENT, Title VARCHAR (200) NOT NULL, Year INTEGER(4) NOT NULL, NumRaters INT DEFAULT 0, Rating DECIMAL(2,1) ); -- creating table Author CREATE TABLE Author( AuthorID INT PRIMARY KEY AUTO_INCREMENT, LastName VARCHAR(100), FirstName VARCHAR(100), MiddleName VARCHAR(100), DOB DATE NOT NULL ); -- creating table BookAuthor CREATE TABLE BookAuthor( AuthorID INT, BookID INT, PRIMARY KEY (AuthorID, BookID) ); -- creating table READBOOK CREATE TABLE ReadBook( BookID INT, Email VARCHAR(100), DateRead DATE NOT NULL, Rating INT, PRIMARY KEY (Email, BookID) ); -- adding foreign key constraints ALTER TABLE BookAuthor ADD CONSTRAINT FOREIGN KEY (AuthorID) REFERENCES Author(AuthorID); ALTER TABLE BookAuthor ADD CONSTRAINT FOREIGN KEY (BookID) REFERENCES Book(BookID); ALTER TABLE ReadBook ADD CONSTRAINT FOREIGN KEY (BookID) REFERENCES Book(BookID); ALTER TABLE ReadBook ADD CONSTRAINT FOREIGN KEY (Email) REFERENCES User(Email); -- It is likely we will want to search by Book title so add a title index. CREATE INDEX book_title ON Book(Title); -- We may want to order/search by book year. So we want to add a year index. CREATE INDEX book_year ON Book(Year); -- We may want to order/search when the user read the book. So we want to add a date index. CREATE INDEX readBook_date ON ReadBook(DateRead); -- We may want to order the books read by the user by the rating. CREATE INDEX readBook_rate ON ReadBook(Rating); -- USER insert trigger. -- This is a before insert row trigger. -- It is created to make sure that when a user is inserted that the email is valid. DELIMITER $$ CREATE TRIGGER user_bir BEFORE INSERT ON User FOR EACH ROW BEGIN -- declaring variables DECLARE ok BOOLEAN; DECLARE msg VARCHAR(200); -- checking if the email is in correct format...example@example1.ca -- storing it in the ok boolean SELECT NEW.Email REGEXP '^[A-Z0-9._%-]+@[A-Z0-9.-]+\\.[A-Z]{2,4}$' INTO ok; -- if check to see if ok is true or not -- if not ok then print msg else continue to insert email IF (NOT ok) THEN SET msg = CONCAT('Email Address: ', NEW.Email, ' Invalid.'); SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = msg; END IF; SET NEW.DateAdded = NOW(); END$$ DELIMITER ; -- USER update trigger. -- this is a before update row trigger -- it is created to make sure the the email cannot be updated -- and dateAdded cannot be updated...if either are update a error msg will appear DELIMITER $$ CREATE TRIGGER user_bur BEFORE UPDATE ON User FOR EACH ROW BEGIN -- delcaring variables DECLARE msg VARCHAR(200); DECLARE ok BOOLEAN; -- if check to see if new email is not equal to the old email -- if it is then an error msg will appear asking the user to delele the account IF(NEW.Email != OLD.Email) THEN SET msg = CONCAT ('Email Address ', OLD.Email, ' cannot be modified, please delete user if you wish'); SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = msg; END IF; -- if check to see if new DateAdded is not equal to the old DateAdded -- if it is then an error msg will appear IF(NEW.DateAdded != OLD.DateAdded) THEN SET msg = 'DateAdded cannnot be modified'; SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = msg; END IF; END$$ DELIMITER ; -- before delete row trigger on user -- delete user but actually deleting the readbook records DELIMITER $$ CREATE TRIGGER user_bdr BEFORE DELETE ON User FOR EACH ROW BEGIN -- delete from ReadBook where the Email equals an old email DELETE FROM ReadBook WHERE Email = OLD.Email; END $$ DELIMITER ; -- BOOK delete trigger -- this is a before delete row trigger -- it is created to make sure that NO books can be deleted DELIMITER $$ CREATE TRIGGER book_bdr BEFORE DELETE ON Book FOR EACH ROW BEGIN -- declaring variables DECLARE msg VARCHAR(200); -- setting msg and displaying it when user tries to delete a book SET msg = 'Book cannot be deleted'; SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = msg; END $$ DELIMITER ; -- before insert row trigger on ReadBook -- inserting ReadBook values DELIMITER $$ CREATE TRIGGER readbook_bir BEFORE INSERT ON ReadBook FOR EACH ROW BEGIN DECLARE msg VARCHAR(200); DECLARE num INT; -- checking to see if Rating is between 1 and 10 -- if not print out a msg IF(new.Rating > 10 OR NEW.Rating < 1) THEN SET msg = 'Rating not valid'; SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = msg; END IF; -- if rating is a valid then set NumRaters plus 1 UPDATE Book SET NumRaters = NumRaters + 1 WHERE Book.BookID = NEW.BookID; END$$ DELIMITER ; -- before delete trigger on ReadBook -- Delete readbook updating book numRaters DELIMITER $$ CREATE TRIGGER readbook_bdr BEFORE DELETE ON ReadBook FOR EACH ROW BEGIN -- update Book with NumRaters minus 1 where BookID equals old BookID UPDATE Book SET NumRaters = NumRaters - 1 WHERE Book.BookID = OLD.BookID; END$$ DELIMITER ; -- after delete trigger on row for ReadBook -- update the Average rating after a book is deleted DELIMITER $$ CREATE TRIGGER readbook_adr AFTER DELETE ON ReadBook FOR EACH ROW BEGIN DECLARE num INT; -- calculating the sum of ratings SELECT SUM(Rating) INTO num FROM ReadBook WHERE OLD.BookID = ReadBook.BookID; -- update Book by taking the num divided by number of raters UPDATE Book SET Rating = num / NumRaters WHERE Book.BookID = OLD.BookID; END$$ DELIMITER ; -- after insert row trigger for readbook -- once a row is inserted calculate the Average Rating DELIMITER $$ CREATE TRIGGER readbook_air AFTER INSERT ON ReadBook FOR EACH ROW BEGIN DECLARE num INT; -- calculating the sum of ratings SELECT SUM(Rating) INTO num FROM ReadBook WHERE NEW.BookID = ReadBook.BookID; -- update Book and set Rating to num divided by numRaters UPDATE Book SET Rating = num / NumRaters WHERE Book.BookID = NEW.BookID; END$$ DELIMITER ; -- before update row trigger for readbook DELIMITER $$ CREATE TRIGGER readbook_bur BEFORE UPDATE ON ReadBook FOR EACH ROW BEGIN DECLARE msg VARCHAR (200); -- check if the rating is between 1 and 10 -- if not then print a msg IF(new.Rating > 10 OR NEW.Rating < 1) THEN SET msg = 'Rating not valid'; SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = msg; END IF; END$$ DELIMITER ; -- after update row trigger for readbook -- calcualte the average rating after the update DELIMITER $$ CREATE TRIGGER readbook_aur AFTER UPDATE ON ReadBook FOR EACH ROW BEGIN DECLARE num INT; -- calculate the sum of the ratings SELECT SUM(Rating) INTO num FROM ReadBook WHERE NEW.BookID = ReadBook.BookID; -- update Book and set Rating to num divided by NumRaters UPDATE Book SET Rating = num/NumRaters WHERE Book.BookID = OLD.BookID; END$$ DELIMITER ; -- inserting Valid emails creating USERS INSERT INTO User (Email, NickName, Profile) VALUES ('spitr692@mtroyal.ca', 'user1', NULL), ('spitrola27@gmail.com', NULL, 'user2'), ('hello@whatwhat.com', NULL, 'user3'); -- inserting Books into BOOK table INSERT INTO Book (Title, Year) VALUES ('Book 1', 2010), ('Book 2', 2013), ('Book 3', 1990), ('Book 4', 1764); -- inserting Author into AUTHOR table INSERT INTO Author (LastName, DOB) VALUES ('Author 1', date('1987-01-01')), ('Author 2', date('1992-02-20')), ('Author 3', date('1764-12-12')), ('Author 4', date('1993-06-06')); -- inserting into BOOKAUTHOR INSERT INTO BookAuthor (AuthorID, BookID) VALUES (1,1), (2,1), (3,1), (4,4), (1,2), (2,3), (2,2), (3,3); -- inserting into ReadBook INSERT INTO ReadBook (BookID, Email, DateRead, Rating) VALUES (1, 'spitr692@mtroyal.ca', date('2014-01-20'), 10), (1, 'spitrola27@gmail.com', date('2014-01-20'), 1), (3, 'hello@whatwhat.com', date('2012-05-30'), 2), (4, 'spitr692@mtroyal.ca', date('2013-05-06'), 5), (1, 'hello@whatwhat.com', date('2002-10-10'),9), (4, 'spitrola27@gmail.com',date('1990-09-09'),1); -- Q2 CREATE OR REPLACE VIEW book_author AS SELECT a.AuthorID, b.BookID, b.Title FROM Author a, Book b, BookAuthor c WHERE a.AuthorID=c.AuthorID AND b.BookID=c.BookID ORDER BY 3; -- Q3 CREATE OR REPLACE VIEW read_stats AS SELECT a.Email, a.Rating, b.BookID, b.NumRaters, b.Rating AS 'averageRating' FROM ReadBook a, Book b WHERE a.BookID=b.BookID; notee
true
c338bfa3af61666ac58042d0e34aef264f2dc069
SQL
ItzGuuh/Musitec
/MusitecOficial 2.1/Banco Musitec 3.0.sql
UTF-8
35,705
3.46875
3
[]
no_license
create database Musitec; use Musitec; create table Cadastro ( idCadastro integer not null auto_increment, Login varchar(30) unique, NomeCompleto varchar(30), Email varchar(30), sexo CHAR(1) CHECK(sexo IN ("M", "F")), DataNasc date, Senha varchar(16), PRIMARY KEY(idCadastro) ); create table Instrumento ( idInstrumento integer not null, NomeInstrumento varchar(10), Descricao longtext, Classificacao mediumtext ); create table Introducao( idIntroducao integer not null auto_increment, Tutorial mediumtext, Saudacao mediumtext, primary key(idIntroducao) ); create table Modulo1( idAula int auto_increment, titulo varchar(40), aula longtext, primary key(idAula) ); create table Modulo2( idAula int auto_increment, titulo varchar(25), aula longtext, primary key(idAula) ); create table Modulo3( idAula int auto_increment, titulo varchar(40), aula longtext, primary key(idAula) ); create table Modulo4( idAula int auto_increment, titulo varchar(40), aula longtext, primary key(idAula) ); create table Modulo5( idAula int auto_increment, titulo varchar(40), aula longtext, primary key(idAula) ); create table Modulo6( idAula int auto_increment, titulo varchar(40), aula longtext, primary key(idAula) ); create table Modulo7( idAula int auto_increment, Aula longtext, titulo varchar(40), primary key(idAula) ); create table Modulo8( idAula int auto_increment, titulo varchar(40), aula longtext, primary key(idAula) ); create table Modulo9( idAula int auto_increment, titulo varchar(40), aula longtext, primary key(idAula) ); -- Modulo 1 Aula 1 insert into Modulo1(titulo,aula) values ('Música','É a arte universal de combinar os sons. É a maneira de se expressar através de melodias. Aliás, a Música é a primeira das sete artes universais. Desde seus primeiros passos, ela se valeu do desejo íntimo dos músicos para exportar as suas faces interiores, como se nela, o homem se revelasse por dentro. Tudo que podemos ouvir são sons; uma buzina, um grito, um trovão, uma madeira sendo arrastada, etc. Quando selecionamos sons de forma harmônica, estamos transformando esses sons em melodia, ou seja, música. Os sons podem ser divididos em duas categorias: - Sons tonantes: são sons com variação de tonalidade entre grave e agudo, como os produzidos por instrumentos musicais. - Sons não tonantes: são sons que não têm essa variação e produzem sons simples como qualquer barulho. ' ); -- Módulo 1 Aula 2 insert into Modulo1(titulo,aula) values ('Como escolher um Violão?',' Aparentemente, todo violão é igual, exceto por pequenos detalhes irrelevantes, como a cor e tamanho, por exemplo. De fato, há alguns aspectos que devem ser considerados para a aquisição de um modelo dele. Um deles é a resistência. Existem diversos tipos de madeira com os quais se confecciona o instrumento. Isto implica na durabilidade e no timbre sonoro também. O tamanho da caixa acústica está diretamente ligado ao volume do som. Quanto maior, mais som. Os trastes devem ser feitos de bom material e bem instalados, do contrário, implicará na afinação. A mesma atenção se dá ao verificar se o braço do violão está bem aprumado, se o cavalete está bem colado e se as tarraxas se movimentam bem. Os violões elétricos têm o formato de uma guitarra. Portanto, sua caixa acústica é mais rasa, seu braço mais alongado e já vem com um mecanismo de captura de som – comumente chamado Cristal -- embutido dentro dele e um plug para conexão com uma mesa de som. Para fins práticos, o que se deve ter por princípio para avaliar um violão é se ele afina precisamente. '); -- Módulo 1 Aula 3 insert into Modulo1(titulo,aula) values ('Notas musicais',' São sons tonantes organizados por uma escala bem conhecida de todos: DÓ, RÉ, MÍ, FÁ, SOL, LÁ e SÍ. Estas são as famosas notas musicais básicas. Executar uma música é, portanto, selecionar estas notas numa melodia. Para simplificar a nomenclatura, representamos estas notas por letras. Veja abaixo: C –> dó D –> ré E –> mi F –> fá G –> sol A –> lá B –> si '); -- Módulo 1 Aula 4 insert into Modulo1(titulo,aula) values ('Sustenido e Bemol','Durante muito tempo essas notas musicais eram soberanas. Entretanto, notava-se que havia variação sonora entre algumas dessas notas, até que mais tarde surgiram os semitons (também chamados de meio-tons) que preenchiam justamente esses espaços, que na verdade, tornar-se-iam notas. Só que, ao contrário de serem nomeados por outros nomes, esses meio-tons foram chamados de acordo com as notas próximas a eles pela relação sustenido e bemol. Saibamos primeiro, entre quais notas existem esses meios-tons (aqui representados pelas lacunas): __ A __ B C __ D __ E F __ G __ Portanto, somente entre SÍ e DÓ e entre MÍ e FÁ não há meio-tom. Cada espaço desses, que é uma nota como qualquer uma, recebe dois nomes pela relação sustenido-bemol: • Sustenido (#) é o nome do meio-tom com relação à nota a que está à sua frente. • Bemol (b) é o meio-tom posicionado um espaço antes da nota. Assim, dizemos que o espaço entre as notas C e D tem um meio-tom, portanto, uma nota que recebe dois nomes pela relação sustenido e bemol. Observe como ficará essa nota: C C# e Db D Esse meio-tom tem dois nomes; Dó sustenido (pois está meio-tom à frente de C) e Ré Bemol (por estar meio-tom antes de D). Assim chamamos esta nota: C# ou Db. O mesmo acontece com todos os meio-tons existentes (A# e Bb, D# e Eb, F# e Gb, G# e Ab).Não são dois meios-tons num espaço só. É um meio-tom em cada espaço e dois nomes para cada meio-tom. A escala das notas é contínua, ou seja, depois da última nota, volta para a primeira, obedecendo à seqüência das notas. Repare: ... E F G A B C D E F G A B C ... Logo, o meio-tom da última nota (G) é vizinho com a primeira (A). Podemos dizer que a escala geral das notas tem então 12 notas. Olhe: '); -- Módulo 1 Aula 5 insert into Modulo1(titulo,aula) values ('Relação grave e agudo',' É a principal relação da música, justamente quem determina a variação de tonalidades das notas. Grave é a tonalidade grossa e baixa, enquanto que Agudo é o tom alto e fino. Veja como se distribuem as notas por esta relação: GRAVE ... A B C D E F G ... AGUDO Isto quer dizer que, por exemplo; B é mais grave que C e mais agudo que A, assim como F é mais agudo que E e mais grave que G, etc. Como a escala é contínua, comparando duas notas iguais, concluiremos que cada nota à frente será sempre mais aguda que a anterior. Compare a nota D1 e D2: ... A B C D1 E F G A B C D2 E ... Fica evidente que o D1 é mais grave que D2 e este é mais agudo que o antecessor. No caso de um possível D3, seria mais agudo que D2 e assim por diante. '); -- Módulo 1 Aula 6 insert into Modulo1(titulo,aula) values ('Tons e Acordes','Acorde é uma base harmônica formada por notas para acompanhamento musical. Unindo no mínimo três notas que tenham relação entre si, obteremos um acorde. Se juntarmos, por exemplo, as notas C, E e G teremos então um acorde que, por ocasião será o acorde de dó maior (C). Para isso, há uma escala de notas para cada acorde onde serão extraídas as notas para os determinados acordes (maiores, menores e dissonantes). Tom ou Tonalidade refere-se a uma escala de valores que selecionam os acordes que tenham relação entre si para formar a seqüência deles nas músicas. Por exemplo, cada acorde tem uma escala onde se encontram as notas que tem relação com ela, essas notas são como seus parentes (notas primas) e a partir dessa escala, formam-se os acordes relativos à sua tonalidade. Trataremos disso a seguir. '); -- Módulo 1 Aula 7 insert into Modulo1(titulo,aula) values ('Diapasão','É o valor original das notas, ou seja, a altura do tom padrão em tudo o mundo para a afinação dos instrumentos, fazendo haver uma unidade musical. Por exemplo, o C do piano deve ter a mesma altura de tom que o C dos demais instrumentos, como o violão, o saxofone, etc. Desta forma, não há conflitos quando dois ou mais instrumentos tocarem juntos. Diapasão é também um pequeno instrumento que reproduz as notas padrão para ajudar a afinar os instrumentos pelas notas originais. '); -- Módulo 2 -- Módulo 2 Aula 1 insert into Modulo2(titulo,aula) values ('Anatomia do Violão','Como funciona o violão: As cordas são presas a partir do cavalete e vão até o cabeçalho, onde são fixadas pelas tarraxas. Através destas, afina-se as cordas, folgando ou apertando. O braço é separado por trastes. Entre um traste e outro se encontra uma casa, que são enumeradas do cabeçalho para o cavalete. A batida nas cordas reproduz o som que é ecoado dentro da caixa acústica e sai pela boca sonora. Usamos o braço para selecionarmos as notas e os acordes apertando-as no meio das casas entre os trastes. PEGAR IMAGEM DA APOSTILA PAGINA 7 Cifragem do violão É um modelo que usamos para ilustrar o braço por uma cifra representando cordas e casas numa moldura (cifra) como no modelo ao lado. Observe que a numeração das casas se dá do cabeçalho para o cavalete. Considere também a ordem das cordas. PEGAR IMAGEM DA APOSTILA PAGINA 7 '); -- Módulo 2 Aula 2 insert into Modulo2(titulo,aula) values ('As cordas do Violão','Enumeramos as cordas de 1 a 6 a partir da mais fina até a mais grossa. As três primeiras cordas são chamadas de cordas base, pois formam a base dos acordes. As três últimas nós chamamos de bordões e são usadas para fazer o baixo dos acordes, semelhante o que faz o instrumento contrabaixo nas bandas musicais. Estudaremos isso mais tarde. OBS. A 4acorda, não raro, é também usada para base em algumas posições. Existem dois tipos de cordas; aço e nylon. As cordas de aço são mais fortes e reproduzem um som mais alto. Ideal para tocar ao ar livre sem amplificador. No entanto, as cordas de nylon são mais confortáveis para iniciantes quando para apertar as cordas. Profissionalmente, usa-se das duas variedades. Recomenda-se não fazer muita distinção e procurar se adaptar aos dois tipos. '); -- Módulo 2 aula 3 insert into Modulo2(titulo,aula) values ('Usando as mãos','MÃO DIREITA: MÃO ESQUERDA: O braço do violão é ostentado pelo polegar esquerdo. Procure não abraçá-lo com toda a mão, para que esta fique flexível liberando um melhor movimento dos dedos sobre as cordas. Pressione as cordas exatamente com a cabeça dos dedos com firmeza, posicionando-os sobre a corda bem no meio da casa entre os trastes e nunca em cima deles. Veja as representações abaixo: Mão direita É usada para vibrar as cordas com batidas e dedilhados. O polegar (x) dedilha os bordões e os demais dedos dedilham as cordas base. Mão esquerda Usamos para selecionar as notas e acordes no braço, apertando as cordas DENTRO das casas, ou seja, entre os trastes e NUNCA em cima deles. Os dedos enumerados cifram que o determinado dedo aperta a devida corda na casa estabelecida pela cifra. O polegar é usado para segurar o braço do violão. '); -- MÓDULO 3 -- Módulo 3 Aula 1 parte 1 insert into Modulo3(titulo,aula) values ('Cifras Gráficas','É a representação gráfica de como devemos tocar as posições no violão. O número dos dedos na cifra indica que aquele determinado dedo pressiona a corda apontada na sua referida casa. Observe a figura abaixo:'); -- Módulo 3 Aula 1 parte 2 insert into Modulo3(titulo,aula) values ('Cifras Gráficas','Há um tipo particular de acorde chamado de pestana em que o dedo 1 (indicador) deita sobre uma casa apertando todas as cordas ao mesmo tempo. Meia-pestana é, então, um derivado deste modelo no qual, apenas algumas cordas são apertadas. Veja a representação desta modalidade na cifra e na figura:'); -- Módulo 3 Aula 1 parte 3 insert into Modulo3(titulo,aula) values ('Cifras Gráficas','A mão direita é posicionada sobre as cordas entre o cavalete e a boca sonora para o dedilhado. Seu braço fica apoiado sobre a caixa sonora. As cifras indicam ainda que cordas devam ser tocadas. Em algumas posições as seis cordas do violão são usadas, enquanto que em outros casos, uma ou mais corda ficam de fora. Assim, a corda representada na cifra com um x sugere que seja tocada com o polegar direito (em caso de dedilhado) e as demais cordas que devem ser tocadas são marcadas com pontos. Observe:'); -- Módulo 3 Aula 2 insert into Modulo3(titulo,aula) values ('Esquema para canhotos','Se você é canhoto, não tem problema! É possível tocar tão bem quanto os destros – há quem diga ainda que os esquerdos sejam até melhores. Há duas opções para sua escolha: você pode optar por inverter as cordas de modo que, mesmo do seu lado, os bordões fiquem em cima e as cordas-base em baixo; ou deixar as cordas na posição comum e aplicar os acordes ao contrário. As duas alternativas são viáveis, cabendo ao usuário descobrir na prática o que lhe convém. '); -- Módulo 3 aula 3 insert into Modulo3(titulo,aula) values ('Escala das notas no violão','Cada corda em cada casa reproduz uma nota. Suponhamos que apertemos a corda 3 na 5ª casa; teremos então uma nota. Uma corda solta seria casa zero; também é uma nota. Notamos então, que em todo o braço do violão, temos muitas casas e, logo, muitas notas. A relação grave-agudo no violão tem dois seguimentos; a) quanto às cordas: de cima para baixo, ou seja, da corda 6 à 1a. Note que as cordas são mais finas (agudas) neste sentido. b) quanto às casas numa mesma corda: quanto maior o número da casa, mais agudo. É extremamente importante reconhecer cada nota em cada casa. Veja a escala das notas considerando o violão devidamente afinado: PEGAR IMAGENS NA APOSTILA PAGINA 10 Eis, portanto, a distribuição das notas no violão. Mentalizar tudo isso parece difícil, mas partindo da lógica da escala vai ficar fácil. Se desejar, por exemplo, saber a nota da casa 11 da 3ª corda sem olhar a escala, basta partir da corda solta (G) e contar as casas. Repare: O |1 | 2| 3 | 4| 5| 6 | 7| 8 | 9 |10| 11 G| G#/Ab| A| A#/Bb |B| C| C#/Db |D |D#/Eb| E |F |F#/Gb Pronto. Já temos a nota (F#/Gb). Então, este é o ponto de partida; a nota das cordas soltas. Corda 1 E, 2ª B, 3ª G, 4ª D, 5ª A e por fim a 6ª E.'); -- Módulo 3 aula 4 insert into Modulo3(titulo,aula) values ('Afinação do Violão',' Há quem toca violão e não sabe afiná-lo ou não tem confiança o bastante para isso. Parece assombroso, mas não é. A primeira coisa que devemos levar em conta é a distribuição das notas no braço. Quantas notas B encontram-se no braço? Várias, não? Podemos citar a 2a corda solta, a casa 4 da corda 3 e a 2a casa da corda 5. Pois, se elas são a mesma nota B não devem elas reproduzir a mesma tonalidade de B? Aqui está o segredo; as cordas devem concordar com o som das notas de uma corda com a outra. Podemos concluir que a afinação do violão é a relação entre as notas de todas as cordas. Processar uma afinação é justamente igualar as notas iguais das cordas. Supondo uma comparação entre as cordas 1 e 3 se estão afinadas uma com a outra; podemos comparar quaisquer notas iguais como G da 3acorda solta e a casa 3 da corda 1. Caso a tonalidade esteja semelhante, as cordas estão afinadas uma com a outra. '); -- Módulo 3 aula 5 insert into Modulo3(titulo,aula) values ('Acessórios','Entre os utensílios para o violonista esta a alça para quem vai tocar em pé e não tem onde encostar o violão. A palheta é usada para bater as cordas – boa para ritmos rápidos e limitada para quem dedilha. Para contrabalançar, pode-se ficar com uma dedeira. Ela é acoplada ao polegar direito, que é justamente a parte dessa mão que mais sente desgaste. Para dar mais garantia ao instrumento há um suporte metálico chamado cordal usado para prender as cordas que passam pelo cavalete. Não é raro que em violões de segunda linha o cavalete descole devido a pressão das cordas. '); -- Módulo 4 -- Módulo 4 Aula 1 parte 1 insert into Modulo4(titulo,aula) values ('Acordes II','Fórmula para acordes Existem muitas formas de desenharmos o mesmo acorde no violão, e também, vários acordes num mesmo modelo em casas diferentes. Uma fórmula para acordes é um modelo de cifra usado nas diversas casas e sendo um acorde diferente em cada uma delas. '); -- Módulo 4 Aula 1 parte 2 insert into Modulo4(titulo,aula) values ('','Observe na figura ao lado com duas cifras com posições diferentes e um mesmo acorde Dm. '); -- Módulo 4 Aula 1 parte 3 insert into Modulo4(titulo,aula) values ('','Nos exemplos à esquerda, temos três cifras com o mesmo molde em casas diferentes. É, portanto, uma fórmula para acordes, sendo que cada um é um acorde diferente, pois estão em casas diferentes. Veja:'); -- Módulo 4 Aula 1 parte 4 insert into Modulo4(titulo,aula) values ('','O molde é o mesmo, mas como estão em casas diferentes, as notas se alteram e, logo, o acorde também passa a ser outro. A primeira cifra é um acorde A (Lá maior) e tem as notas A, C# e E. Na segunda cifra, cada nota aumentou uma casa em relação à A; notas A#, D e F, sendo o acorde A#. Na cifra seguinte, mais uma casa foi adiantada; notas B, D# e F# que formam o acorde de B. Adiantando a fórmula uma casa, teríamos um novo acorde que seria C, depois C#, D, etc. As fórmulas para acordes devem obedecer aos critérios de formação de acordes pela escala de cada um. Como os acordes naturais são as notas 1, 3 e 5 de cada escala maior e menor, as fórmulas para acordes maiores e menores devem constar essas notas. Então vamos consultar as fórmulas para acordes maiores e menores:'); -- Módulo 4 Aula 1 parte 5 insert into Modulo4(titulo,aula) values ('','1a- FÓRMULA Para acordes maiores:'); -- Módulo 4 Aula 1 parte 6 insert into Modulo4(titulo,aula) values ('','Note que o primeiro acorde é E (Mí maior), os demais são a continuação da escala; F, F#, G, G#, etc. Ciframos apenas três casas, mas prossegue nas outras casas até quando for possível. Observe também quais cordas estão sendo usadas.'); -- Módulo 4 Aula 1 parte 7 insert into Modulo4(titulo,aula) values ('','2a- FÓRMULA Para acordes maiores:'); -- Imagem -- Módulo 4 Aula 1 parte 8 insert into Modulo4(titulo,aula) values ('','3A- FÓRMULA; Para acordes maiores:'); -- Imagem -- Módulo 4 Aula 1 parte 9 insert into Modulo4(titulo,aula) values ('','1A- FÓRMULA Para acordes menores:'); -- Imagem -- Módulo 4 Aula 1 parte 10 insert into Modulo4(titulo,aula) values ('','2a- FÓRMULA Para acordes menores:'); -- Imagem -- Módulo 4 Aula 1 parte 11 insert into Modulo4(titulo,aula) values ('','3a- FÓRMULA; Para acordes menores:'); -- Imagem -- Módulo 4 Aula 1 parte 12 insert into Modulo4(titulo,aula) values ('','Com estas fórmulas poderemos cifrar todos os acordes maiores e menores. Uma referência para identificar o acorde é a nota do baixo, ou seja, o último bordão.'); -- Módulo 5 -- Módulo 5 Aula 1 parte 1 insert into Modulo5(titulo,aula) values ('Acordes Dissonantes','Como já mencionamos antes, acordes dissonantes são acordes comuns acrescidos de uma ou mais notas que as notas básicas (1a, 3a e 5a) para alterar sutilmente sua tonalidade. Isto ocorre para dar um efeito de embelezamento e melhor acompanhar a melodia. Quando acrescentamos qualquer outra nota a um acorde que não seja suas notas básicas, estamos transformando-o em um acorde dissonante. Vamos imaginar isso com F:'); -- Imagem -- Módulo 5 Aula 1 parte 2 insert into Modulo5(titulo,aula) values ('','Além das notas básicas de F (Fá maior), podemos reparar que a nota D também foi destacada, formando assim um acorde dissonante. Essa nota D é na escala de F, a 6a nota, por isso o acorde será chamado de F6 (Fá maior com sexta maior). É mais ou menos assim que funciona a formação dos dissonantes; denominamos os acordes com os números das notas que nele foram acrescidas. Neste mesmo acorde de F6 poderíamos colocar mais uma nota e formar outro dissonante. Façamos assim:'); -- Imagem -- Módulo 5 Aula 1 parte 3 insert into Modulo5(titulo,aula) values ('','O acorde ficaria assim; F2/6 (Fá com segunda e sexta). Entretanto, não se enumera 2 aos dissonantes, neste caso, a nota G (2a) é enumerada como nona 9, considerando a escala como contínua:'); -- Imagem -- Módulo 5 Aula 1 parte 4 insert into Modulo5(titulo,aula) values ('','Enumera-se acordes dissonantes até pelo número 13 que é o mesmo que 6. Tanto faz então, F6 (mais usado) como F13 (é possível encontrar em alguns métodos). Também são usados 4 e 11. Não se usa 2 e sim 9 As notas 1, 3 e 5 (notas básicas) tem réplicas em 8, 10 e 12. Usamos exemplos de dissonantes com um acorde maior (F). Mas também temos esses mesmos dissonantes com Fm (Fá menor), onde, a base (notas básicas) é encontrada na escala de Fm e as dissonantes conservam-se os mesmo da escala de F. Há variação na formação de alguns dissonantes como os acordes com 7a maior (7+), 7a menor (7) e outros como 7a diminuta (O), notas aumentada (+) e diminuta (-). Se a nota dissonante for maior (7+), esta se acha na escala dos acordes maiores. Se for uma dissonante menor (7), a encontraremos na escala do acorde menor. Eis como funcionam as notas aumentadas e diminutas; são notas que não estão nas escalas de notas dos acordes suprimidas da escala completa. Compare a escala de F com a escala completa:'); -- Imagem -- Módulo 5 Aula 1 parte 5 insert into Modulo5(titulo,aula) values ('','Uma nota da escala completa que não constar em F, é uma nota diminuta. Ou aumentada. Ex. A nota C# não consta na escala de F. Pela escala completa, ela está entre as notas 5 (C) e 6 (D) da escala de F. Logo, ela será uma 5a aumentada (por está à frente da nota 5) e 6a diminuta (por estar antes da nota 6). Pode parece complicado agora, mas logo ficará claro, pois estudaremos cada acorde dissonante, sua formação e como aplicá-las nas músicas.'); -- Módulo 5 Aula 2 parte 1 insert into Modulo5(titulo,aula) values ('Acordes com sétima menor','Este será o primeiro acorde dissonante que trataremos, por ser o mais freqüente. A primeira coisa que devemos levar em conta é que a nota dissonante 7 é a mesma nota tanto para um acorde maior com 7 como para uma acorde menor com 7. Ex. A nota dissonante 7 é a mesma em F7 e Fm7. A sétima nota menor (7) é uma dissonante menor. Logo, a 7a nota da escala dos acordes menores. Para formar os acordes de F7 e Fm7, basta procurar a sétima nota na escala de Fm, pois a dissonante é menor. Veja como:'); -- Imagem -- Módulo 5 Aula 2 parte 2 insert into Modulo5(titulo,aula) values ('','Desta forma chegamos ao resultado (Eb) que é a nota a ser aplicada tanto em F7 como em Fm7. Note: 7a m = (sétima nota de Fm) Eb F = F, A, C (notas básicas) F7 = F, A, C, Eb Fm = F, Ab, C Fm7 = F Ab C Eb Formar acordes maiores e menores com 7a menor agora já não é segredo; basta seguir qualquer um dos caminhos mostrados no exemplo acima, unir todas as notas numa só cifra e pronto! Repare as demonstrações para F7 e Fm7:'); -- Imagem -- Módulo 5 Aula 3 insert into Modulo5(titulo,aula) values ('Aplicação de acordes com 7m','Na maioria dos casos, usa-se acordes maiores com 7a menor para representar uma passagem para uma tonalidade mais alta, o que chamamos de preparação. A nota 7m realmente dá uma distorção ao acorde natural com tendência de subir o tom. Outras aplicações nós veremos mais tarde. Quanto aos acordes menores com 7m, sua mais comum aplicação é dar uma dissonância sutil para se aproximar ao seu acorde primo que um acorde maior que tem sua escala igual a este menor (veja sobre isso no capítulo 5). Um acorde menor com 7m tem a mesma base que seu acorde primo natural. Essa semelhança provoca um efeito dentro de uma música quando usamos esses acordes. No próximo capítulo estudaremos sobre os valores dos acordes numa seqüência de acordes dentro da música. É uma lição IMPORTANTÍSSIMA para a continuidade do curso e aprenderemos mais sobre acordes com 7m.'); -- Módulo 6 -- Módulo 6 Aula 1 parte 1 insert into Modulo6(titulo,aula) values ('Seqüências Básicas','Quando tocamos uma música, usamos um conjunto de acordes e dizemos que eles formam a seqüência daquela determinada música. Na canção “Caminhando e cantando” que vimos no cap. 5, usamos os acordes D e Em. Eis, portanto, a seqüência desta música. Alguns acordes têm uma relação de proximidade com outros dentro de uma seqüência de acordes, e isto ocorre por causa dos valores de tonalidades que cada um tem. A compreensão desses valores determina a posição de cada acorde dentro da música. Os valores mais comuns --- os mais usados --- são denominados pelos seus valores numa escala de acordes chamada de seqüência básica, que aprenderemos já.'); -- Módulo 6 Aula 1 parte 2 insert into Modulo6(titulo,aula) values ('Tonalidade das músicas','Cada seqüência de acordes obedece a uma tonalidade. Os acordes dessa seqüência terão seus valores comparados com o acorde igual à tonalidade. Digamos que uma música tem a tonalidade de D, onde os acordes dela serão comparados com D entre mais alto, mais baixo, menor alto, menor baixo, etc. A seqüência básica de D é a seguinte:'); -- Imagem -- Módulo 6 Aula 1 parte 3 insert into Modulo6(titulo,aula) values ('','A seqüência básica estabelece os valores de cada acorde de uma seqüência para cada tonalidade. Entenda o valor de cada acorde numa seqüência básica: Tom ou Tonalidade = O acorde que designa os demais por seus valores. 1o. Acorde maior = é igual ao TOM. Ë o acorde neutro em que serão comparados os valores dos outros acordes. 2o. Acorde maior (7) = é o ACORDE BAIXO da seqüência com ou sem a dissonância de 7a menor. Nota-se claramente, que é mais baixo que o tom (1o acorde). 3o Acorde com 7 = chamado de PREPARAÇÃO. Este é acorde igual ao 1o (o próprio tom) com a dissonância de 7m para passar para o acorde alto (assim como vimos na aplicação desse dissonante no capítulo anterior). 4o Acorde = É o ACORDE ALTO em relação ao tom. 1o Acorde menor = É o acorde menor primo do tom, sendo assim o mais semelhante. Tem um valor menor de neutralidade. ACORDE MENOR NEUTRO. 2o Acorde menor = É versão menor do 2o acorde, que, aliás, é o seu acorde primo. ACORDE MENOR BAIXO. 3o- menor = É o ACORDE MENOR ALTO, semelhante ao 4o acorde, seu acorde primo. 4o- menor = Trata-se do acorde maior alto transformado em menor para sobrepor-se em um efeito de supra tonalidade. 5o acorde maior (7) = Com ou sem 7m, usa-se esse ACORDE FECHADO para efeito de distorção da seqüência. Também é uma versão de ACORDE BAIXO nos tons menores. 5o acorde menor (7) = Normalmente usado com uma versão de PREPARAÇÃO, podendo anteceder o 3o acorde maior. Este pode vir ou não com 7m. A seqüência de D segundo seus valores são estes:'); -- Imagem -- Módulo 6 Aula 1 parte 4 insert into Modulo6(titulo,aula) values ('','Toda música que segue a tonalidade de D, provavelmente usará esses acordes. Por isso a chamamos de seqüência básica de D, já que tem os valores mais comuns para uma seqüência de acordes no tom de D. Os acordes que não estão relacionados nessa escala são acordes excepcionais, que dão sutis efeitos a esses mesmos acordes. Seria possível, por exemplo, pegar o 1o acorde menor e dar dissonâncias como 7+, 7/6 ou 7m. Geralmente, a música começa pelo 1o (o tom), variando a tonalidade para alto, baixa ou para um acorde menor. Ai entra o esquema desta escala; se o tom baixar, o acorde será o 2o acorde maior, se subir será o 4o maior, se for para um acorde menor basta comparar se a tonalidade é menor alta, menor baixa, etc. Como saber isso? Exercitando bem as seqüências básicas e comparar os valores dos acordes. Um exemplo dos valores dessa escala; volte à música “Cabecinha no ombro” e compare os valores dos acordes usados:'); -- Imagem -- Módulo 6 Aula 2 parte 1 insert into Modulo6(titulo,aula) values ('Seqüência básica dos acordes','Já vimos a seqüência básica de D, mas cada acorde tem sua escala própria com seus respectivos acordes e sempre com escalas diferentes. Através da escala de D, podemos encontrar as demais pela escala completa, veja:'); -- Imagem -- Módulo 6 Aula 2 parte 2 insert into Modulo6(titulo,aula) values ('','Para encontrar qualquer escala, segue o exemplo acima a começar pelo acorde procurado. Exemplo F# (que o mesmo Gb). A escala completa deve ser iniciada em F#.'); -- Imagem -- Módulo 6 Aula 2 parte 3 insert into Modulo6(titulo,aula) values ('','Desta forma se compõe a seqüência básica de F#:'); -- Imagem -- Módulo 7 Aula 1 parte 1 insert into Modulo7(titulo,aula) values ('Acordes com 7+','Os acordes maiores e menores com sétima maior (7+) são facilmente encontrados nas músicas populares e clássicas. É mais um dissonante que trataremos detalhadamente para um entendimento completo.'); -- Módulo 7 Aula 1 parte 2 insert into Modulo7(titulo,aula) values ('Formação de acordes com 7+','A dissonante sétima maior que forma o acorde com 7+ é a nota sete da escala das notas dos acordes maiores. Essa mesma nota é a mesma 7+ para acordes maiores e menores. Se a dissonante é maior, procura-se na escala maior dos acordes. Acompanha a demonstração para formação dos acordes E7+ (Mi maior com sétima maior) e Em7+ (Mi menor com sétima maior):'); -- Imagem -- Módulo 7 Aula 1 parte 3 insert into Modulo7(titulo,aula) values ('','A nota 7+ para E e Em é D# (igual a Eb) conforma a escala. Unindo essa nota ao acorde E e Em, transformamos os acordes para E7+ e Em7+. Acompanhe:'); -- Imagem -- Módulo 7 Aula 1 parte 4 insert into Modulo7(titulo,aula) values ('','Resta apenas, cifrar os acordes juntando todas essas notas.'); -- Módulo 7 Aula 2 parte 1 insert into Modulo7(titulo,aula) values ('Fórmulas para acordes com 7+','Resta apenas, cifrar os acordes juntando todas essas notas.'); -- Imagens -- Módulo 7 Aula 3 parte 1 insert into Modulo7(titulo,aula) values ('Aplicação de acordes com 7+','A entonação de acordes maiores e menores com 7+ é de suavizar o acorde dando a parecer ficar mais baixo. A base de um acorde maior com 7+ é idêntica ao 2o acorde menor na seqüência básica. Como em E7+ e o acorde G#m que é o 2o acorde menor da seqüência básica de E: E7+ = E G# B D# G#m = G# D# B Aplica-se acordes maiores e menores com 7+ justamente para dar essa suavidade ao acorde. Outras aplicações desses acordes são em efeitos com outros dissonantes como acordes com 7. Ex. E E7+ E7 ... Em Em7+ Em7 ... Uma seqüência de acordes como estas acima tem representação harmônica em que o acorde natural (E e Em) ganha uma suavidade (E7+ e Em7+) e depois se altera para uma tonalidade que o eleva como uma preparação (E7 e Em7) como que prevendo um acorde mais alto.'); -- Módulo 7 Aula 4 parte 1 insert into Modulo7(titulo,aula) values ('Reconhecendo acordes com 7+','Para diferenciar acordes naturais com acordes dissonantes 7+ devemos exercitar o ouvido. Toque um acorde natural e depois o transforme em dissonante 7+ reconhecendo a diferença que é evidente. Ex. E E7+ E E7+ E ... Em Em7+ Em Em7+ Em ... Exercite bastante até que tenha assimilado a tonalidade de cada um.'); -- Módulo 3 Exercícios -- insert into Modulo3(titulo,aula) values ('Exercícios',' -- Chegou a hora de ter o primeiro grande encontro com o violão. Se você é um iniciante e de nada tem noção, não se intimide! Pegue seu violão como se fosse um amigo, olhe bem suas partes, posicione-o e pratique este exercício cuidadosamente, pois, de agora em diante, você vai aprender de verdade e executá-lo com toda a beleza. -- Se até agora você só deu pancadas no seu instrumento, desde já, começará uma intimidade infinita com ele. -- Exercício para agilizar a mão esquerda -- Esse exercício ajuda a dar agilidade aos dedos esquerdos e a apertarem corretamente as cordas. Esse treinamento consiste da seguinte forma; posicione os dedos esquerdos sobre a 1a corda onde o dedo 1 aperta a casa 4 e toque a corda (com a mão direta), mantenha o dedo 1 sobre a casa 4 e com o dedo 2 pressione a casa 5 (toque a corda), em seguida o dedo 3 na 6a casa e da mesma forma, o dedo 4 na casa 7 sem tirar nenhum dedo de suas respectivas casas. Veja as ilustrações abaixo: -- PEGAR IMAGENS NA APOSTILA -- 1) Dedo 1 na casa 4 2) Dedo 2 na casa 5 3) Dedo 3, casa 6 4) Dedo 4, casa 7 -- Cada vez que você põe um dedo numa casa e toca, você está fazendo uma nota. Comece devagar e depois vá acelerando o ritmo até pegar bastante prática. Depois inverta a ordem das casas, ou seja, faça as notas voltando, indo e voltando, tocando nas outras cordas, tocando em outras casas, etc. -- Este exercício é primordial para o aprendizado. Pratique-o com todas as variações por um tempo mínimo de 30 minutos ininterruptos a cada dia. -- Exercício para o ouvido -- O ouvido devidamente treinado compreende bem a relação grave-agudo e reconhece a tonalidade das notas e acordes. É o que se diz; “Tirar uma música de ouvido”. Vamos exercitar essa -- técnica: -- 1) Toque qualquer nota do violão e escute bem sua tonalidade. Agora, toque uma nota igual a essa em outra corda e compare sua semelhança. -- 2) Toque essa mesma nota seguidamente e depois seus vizinhos (nota da casa anterior e posterior), comparando as tonalidades. Descubra quem é mais grave e quem é mais agudo. -- 3) Sem olhar a escala nem fazendo contas, procure em cada corda as notas iguais a essa nota. -- 4) Compare outras notas no mesmo esquema. -- 5) Qual a nota mais grave no violão? E a mais aguda? -- Não se canse de praticar esses exercícios. Eles ajudarão com os próximos e apressarão seu sucesso. -- '); /*insert into Cadastro (Login,Email,Senha,DataNasc,NomeCompleto) values ("luizzluque","Luizz@gmail.com","123456","2016-08-16","Luiz Felipe de Paiva"); insert into Cadastro (Login,Email,Senha,DataNasc,NomeCompleto) values ("l","Luizz@gmail.com","123456","2016-08-16","Luiz Felipe de Paiva"); insert into Cadastro (Login,Email,Senha,DataNasc,NomeCompleto) values ("b","b@gmail.com","123456","2016-08-16","b"); insert into Cadastro (Login,Email,Senha,DataNasc,NomeCompleto) values ("b","b@gmail.com","b","2016-08-16","b"); select * from cadastro; select idCadastro from cadastro where Login="b" and Senha = "123456"; insert into Introducao(Tutorial,Saudacao) values ("Faça isso faça aquilo no caso do Violão","Seja bem vindo ao curso de violão..."); insert into Introducao(Tutorial,Saudacao) values ("Faça isso faça aquilo no caso do Piano","Seja bem vindo ao curso de Teclado..."); select * from Introducao; select * from Instrumento; select nomecompleto,email from cadastro where Login = "b"; select * from modulo1;*/
true
14056f833a0c420a20b61b4cdc579827a06e2563
SQL
LuLStackCoder/mai-sql-course
/13pythonpredict/pythonpredict.sql
UTF-8
1,050
3.703125
4
[]
no_license
def moving_average(d1: str, d2: str, alpha: float=0.2)->pd.DataFrame: SQL = ''' SELECT C.city c, R2.goods g, R.ddate d, sum(R2.price * R2.volume) s FROM recept R JOIN recgoods R2 ON R.id = R2.id JOIN client C ON R.client = C.id WHERE R.ddate >= %(mindate)s AND R.ddate <= %(maxdate)s GROUP BY c, g, d ORDER BY c, g, d; ''' df = pd.read_sql(SQL, engine, params={'mindate': d1, 'maxdate': d2}, parse_dates={'recept.ddate': dict(format='%Y%m%d'),} ) dfs = df.set_index(['c', 'g']) dfs.drop('d', axis=1, inplace=True) dfs = dfs.ewm(alpha=alpha, adjust=False).mean() dfs.reset_index(level=[0,1], inplace=True) dfs.reset_index(drop=True, inplace=True) names = ['city', 'goods', 'date', 'sum'] df.columns = names df['prediction'] = dfs['s'] return df
true
751ac47bdc0aee44db2175e01c15c92cf36c4713
SQL
ejoo1109/TeamCoffeeCup
/TeamProjectCoffee/news.sql
UTF-8
228
2.921875
3
[]
no_license
-- NEWS 테이블 create table news_tbl( newsno number(10), newstitle varchar2(200) not null, newscontent varchar2(2000) not null, newsregdate date default sysdate, newsviewcnt int, CONSTRAINT pk_news_tbl PRIMARY KEY (newsno) );
true
9579e11a5c9a9c9bc45bc8da3cf9d7edaf66975e
SQL
OSGP/open-smart-grid-platform
/osgp/platform/osgp-core/src/main/resources/db/migration/V20170724133131789__Adds_Light_Measurement_Device_table.sql
UTF-8
1,759
3.671875
4
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
DO $$ BEGIN IF NOT EXISTS ( SELECT 1 FROM pg_tables WHERE schemaname = current_schema AND tablename = 'light_measurement_device') THEN -- Create the table for light_measurement_device along with the proper permissions CREATE TABLE light_measurement_device ( id BIGINT NOT NULL, description VARCHAR(255), code VARCHAR(10), color VARCHAR(10), digital_input SMALLINT, last_communication_time TIMESTAMP WITHOUT TIME ZONE ); ALTER TABLE ONLY public.light_measurement_device ADD CONSTRAINT light_measurement_device_pkey PRIMARY KEY (id); ALTER TABLE public.light_measurement_device OWNER TO osp_admin; -- Create grants for osp_admin and osgp_read_only_ws_user GRANT ALL ON TABLE light_measurement_device TO osp_admin; GRANT SELECT ON TABLE light_measurement_device TO osgp_read_only_ws_user; END IF; IF NOT EXISTS ( SELECT 1 FROM information_schema.columns WHERE table_schema = current_schema AND table_name = 'ssld' AND column_name = 'light_measurement_device_id') THEN -- Create new column for foreign key to light_measurement_device ALTER TABLE ONLY ssld ADD COLUMN light_measurement_device_id BIGINT; -- Create constraint for foreign key ALTER TABLE ONLY ssld ADD CONSTRAINT fk_ssld_to_light_measurement_device FOREIGN KEY (light_measurement_device_id) REFERENCES light_measurement_device(id); END IF; IF NOT EXISTS (SELECT 1 FROM device_function_mapping WHERE "function" = 'SET_LIGHT_MEASUREMENT_DEVICE') THEN insert into device_function_mapping (function_group, "function") values ('OWNER', 'SET_LIGHT_MEASUREMENT_DEVICE'); END IF; END; $$
true
9c86acd0191b7b19c042c2ef61013f9c414de722
SQL
altfatterz/data-access
/src/test/resources/schema.sql
UTF-8
1,107
3.8125
4
[]
no_license
DROP TABLE IF EXISTS restaurants; DROP TABLE IF EXISTS addresses; DROP TABLE IF EXISTS reviews; CREATE TABLE addresses ( id IDENTITY, street_name VARCHAR(100) NOT NULL, street_number INT NOT NULL, postcode VARCHAR(10) NOT NULL, city VARCHAR(50) NOT NULL, version INT NOT NULL DEFAULT 0, PRIMARY KEY (id) ); CREATE TABLE restaurants ( id IDENTITY, name VARCHAR(100) NOT NULL, website VARCHAR(100) NOT NULL, address_id INT NOT NULL, version INT NOT NULL DEFAULT 0, PRIMARY KEY (id), CONSTRAINT fk_restaurants_id FOREIGN KEY (address_id) REFERENCES addresses (id) ); CREATE UNIQUE INDEX uq_restaurants_name ON restaurants (name); CREATE TABLE reviews ( id IDENTITY, restaurant_id INT, user VARCHAR(20) NOT NULL, description VARCHAR(200) NOT NULL, rate TINYINT NOT NULL, created DATE NOT NULL, version INT NOT NULL DEFAULT 0, PRIMARY KEY (id), CONSTRAINT fk_reviews_restaurant_id FOREIGN KEY (restaurant_id) REFERENCES restaurants (id) );
true
658004f0e7d768518b750881afe5ca8b221020a8
SQL
mtvbrianking/PSNotify
/php-mysql/psnotfiy.sql
UTF-8
1,541
3
3
[ "MIT" ]
permissive
-- phpMyAdmin SQL Dump -- version 4.2.11 -- http://www.phpmyadmin.net -- -- Host: 127.0.0.1 -- Generation Time: Jun 07, 2015 at 04:57 PM -- Server version: 5.6.21 -- PHP Version: 5.6.3 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8 */; -- -- Database: `psnotify` -- CREATE DATABASE psnotify; use psnotify; -- -------------------------------------------------------- -- -- Table structure for table `message` -- CREATE TABLE IF NOT EXISTS `message` ( `id` int(10) NOT NULL, `msg` varchar(100) NOT NULL, `status` int(1) NOT NULL DEFAULT '0', `when` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ) ENGINE=InnoDB AUTO_INCREMENT=18 DEFAULT CHARSET=latin1; -- -- Dumping data for table `message` -- INSERT INTO `message` (`id`, `msg`, `status`, `when`) VALUES (1, 'hello', 1, '2015-06-07 08:29:07'); -- -- Indexes for dumped tables -- -- -- Indexes for table `message` -- ALTER TABLE `message` ADD PRIMARY KEY (`id`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `message` -- ALTER TABLE `message` MODIFY `id` int(10) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=18; /*!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
b953b072316e2d8e3d751b92e083a38ddbb16b27
SQL
JKempel13/database-exercises
/select_exercises.sql
UTF-8
550
3.359375
3
[]
no_license
USE codeup_test_db; SELECT name AS 'The name of all albums by Pink Floyd.' from albums WHERE artist = 'Pink FLoyd'; SELECT release_date AS 'The year Sgt. Pepper''s Lonely Hearts Club Band was released' from albums WHERE name = 'Sgt. Pepper''s Lonely Hearts Club Band'; SELECT genre AS 'The genre for Nevermind' from albums WHERE name = 'Nevermind'; SELECT name, artist, release_date AS 'Release year' from albums WHERE release_date BETWEEN 1990 AND 1999; SELECT name AS 'Albums with less than 20 million certified sales' from albums WHERE genre LIKE '%Rock';
true
03c1ae039b089a08627603791be0407fd683b352
SQL
nguyenhuuthinhvnpl/INFO_6210
/Project/Jobs_DB_Project/SQL/question6.sql
UTF-8
282
2.890625
3
[ "MIT" ]
permissive
SELECT word , COUNT(*) total FROM ( SELECT DISTINCT id , SUBSTRING_INDEX(SUBSTRING_INDEX(text,' ',i+1),' ',-1) word FROM love1, ints ) x GROUP BY word HAVING COUNT(*) > 1 ORDER BY total DESC , word;
true
1c8d631b0662589c7cf16bb821c64834172890f7
SQL
kgtdbx/OracleScript
/merge_other.sql
WINDOWS-1251
2,452
4.1875
4
[]
no_license
/* - . , , Update, - Insert. Update, . DML! */ -- MERGE INTO TABLE_NAME USING table_reference ON (condition) WHEN MATCHED THEN UPDATE SET column1 = value1 [, column2 = value2 ...] WHEN NOT MATCHED THEN INSERT (column1 [, column2 ...]) VALUES (value1 [, value2 ...) ; -- MERGE create table person(tabn number primary key, name varchar2(10), age number); insert into person values (10 , '', 22); -- , , insert into person values (11 , '', 9 ); insert into person values (12 , '', 30); insert into person values (13 , '', 39); insert into person values (14 , '', 51); insert into person values (15 , '', 55); insert into person values (16 , '', 67); insert into person values (17 , '', 44); insert into person values (18 , '', 12); insert into person values (19 , '', 24); insert into person values (20 , '', 10); insert into person values (21 , '', 42) -- person1 create table Person1 as select * from Person; -- Person -- Person UPDATE person SET age = 55 where tabn in (10,11,12,13,14,15); delete person where tabn in (15,18,20); UPDATE person SET age = 55 where tabn in (10,11,12,13,14,15); -- MERGE MERGE INTO person p USING ( SELECT tabn, name, age FROM person1) p1 ON (p.tabn = p1.tabn) WHEN MATCHED THEN UPDATE SET p.age = p1.age DELETE WHERE (p1.tabn = 18) WHEN NOT MATCHED THEN INSERT (p.tabn, p.name, p.age) VALUES (p1.tabn, p1.name, p1.age) -- Person Person1
true
7b77ee5fb7e8f3957f45eca13c8237242f4cfcbf
SQL
radtek/abs3
/sql/mmfo/bars/Table/tmp_sw102_ref.sql
UTF-8
2,025
2.90625
3
[]
no_license
PROMPT ===================================================================================== PROMPT *** Run *** ========== Scripts /Sql/BARS/Table/TMP_SW102_REF.sql =========*** Run *** PROMPT ===================================================================================== PROMPT *** ALTER_POLICY_INFO to TMP_SW102_REF *** BEGIN execute immediate 'begin bpa.alter_policy_info(''TMP_SW102_REF'', ''CENTER'' , null, null, null, null); bpa.alter_policy_info(''TMP_SW102_REF'', ''FILIAL'' , null, null, null, null); bpa.alter_policy_info(''TMP_SW102_REF'', ''WHOLE'' , null, null, null, null); null; end; '; END; / PROMPT *** Create table TMP_SW102_REF *** begin execute immediate ' CREATE GLOBAL TEMPORARY TABLE BARS.TMP_SW102_REF ( SWREF NUMBER(38,0) ) ON COMMIT DELETE ROWS '; exception when others then if sqlcode=-955 then null; else raise; end if; end; / PROMPT *** ALTER_POLICIES to TMP_SW102_REF *** exec bpa.alter_policies('TMP_SW102_REF'); COMMENT ON TABLE BARS.TMP_SW102_REF IS ''; COMMENT ON COLUMN BARS.TMP_SW102_REF.SWREF IS ''; PROMPT *** Create grants TMP_SW102_REF *** grant SELECT on TMP_SW102_REF to BARSREADER_ROLE; grant DELETE,INSERT,SELECT,UPDATE on TMP_SW102_REF to BARS_ACCESS_DEFROLE; grant DELETE,INSERT,SELECT,UPDATE on TMP_SW102_REF to START1; grant SELECT on TMP_SW102_REF to UPLD; PROMPT ===================================================================================== PROMPT *** End *** ========== Scripts /Sql/BARS/Table/TMP_SW102_REF.sql =========*** End *** PROMPT =====================================================================================
true
4c449ad4a37a64962ab4acb5bf24f1f67ac312c8
SQL
molokovskikh/af_admininterface
/migrations/438_00_check_send_to_minimail.sql
UTF-8
267
3.15625
3
[]
no_license
update Billing.Payers p set p.SendToMinimail = 1 where (select count(*) from Billing.PayerClients pc join Future.Clients c on c.Id = pc.ClientId join Future.Users u on u.ClientId = c.Id where pc.PayerId = p.PayerId and c.Status = 1 and u.Enabled = 1) <= 3;
true
cb0a02729b993dfd6ded7ffd098c2697263cf10b
SQL
zhou122/otherProjects
/tkmybatis/src/main/resources/db/schema-h2.sql
UTF-8
342
2.65625
3
[]
no_license
DROP TABLE IF EXISTS t_user; CREATE TABLE t_user ( id BIGINT(20) NOT NULL COMMENT '主键ID', old_name VARCHAR(30) NULL DEFAULT NULL COMMENT '老姓名', new_name VARCHAR(30) NULL DEFAULT NULL COMMENT '新姓名', age INT(11) NULL DEFAULT NULL COMMENT '年龄', email VARCHAR(50) NULL DEFAULT NULL COMMENT '邮箱', PRIMARY KEY (id) );
true
1646dc8885f5b97d045626daf026f56c2f787723
SQL
narogm/bazyII
/1_oracle/8_trigery.sql
UTF-8
1,508
3.609375
4
[]
no_license
CREATE OR REPLACE TRIGGER dodanie_rezerwacji AFTER INSERT ON REZERWACJE FOR EACH ROW BEGIN INSERT INTO REZERWACJE_LOG (ID_REZERWACJI, DATA, STATUS) VALUES (:NEW.NR_REZERWACJI, CURRENT_DATE, :NEW.STATUS); UPDATE WYCIECZKI w SET LICZBA_WOLNYCH_MIEJSC = LICZBA_WOLNYCH_MIEJSC - 1 WHERE w.ID_WYCIECZKI = :NEW.ID_WYCIECZKI; END; ---- CREATE OR REPLACE TRIGGER zmiana_statusu AFTER UPDATE ON REZERWACJE FOR EACH ROW DECLARE tmp INT; BEGIN INSERT INTO REZERWACJE_LOG (ID_REZERWACJI, DATA, STATUS) VALUES (:NEW.NR_REZERWACJI, CURRENT_DATE, :NEW.STATUS); tmp := 0; IF :OLD.STATUS = 'A' AND :NEW.STATUS <> 'A' THEN tmp := -1; END IF; IF :OLD.STATUS <> 'A' AND :NEW.STATUS = 'A' THEN tmp := 1; END IF; UPDATE WYCIECZKI w SET LICZBA_WOLNYCH_MIEJSC = LICZBA_WOLNYCH_MIEJSC + tmp WHERE w.ID_WYCIECZKI = :NEW.ID_WYCIECZKI; END; ---- CREATE OR REPLACE TRIGGER usuniecie_rezerwacji BEFORE DELETE ON REZERWACJE FOR EACH ROW BEGIN raise_application_error(-20900, 'Nie mozna usuwac rezerwacji'); END; ---- CREATE OR REPLACE TRIGGER zmiana_liczby_miejsc BEFORE UPDATE OF LICZBA_MIEJSC ON WYCIECZKI FOR EACH ROW BEGIN SELECT :OLD.LICZBA_WOLNYCH_MIEJSC + (:NEW.LICZBA_MIEJSC - :OLD.LICZBA_MIEJSC) INTO :NEW.LICZBA_WOLNYCH_MIEJSC FROM Dual; END;
true
fdf363d54e20bb3cb5d63c5d72dc59b48f19e1eb
SQL
HyunupKang/StudySQLServer
/210518/Test4.sql
UTF-8
162
3.25
3
[]
no_license
SELECT m.Names, m.Levels, m.Addr , r.rentalDate FROM membertbl AS m LEFT OUTER JOIN rentaltbl AS r ON m.Idx = r.memberIdx WHERE r.rentalDate IS NULL
true
8e39aab4d020e2b5ba298dd5e9fb768f28ec77a4
SQL
arbiterli/qs
/server/src/main/sql/schema/update/.svn/text-base/20130124_01.sql.svn-base
UTF-8
4,266
3.171875
3
[]
no_license
/* SQLyog Community Edition- MySQL GUI v8.17 MySQL - 5.1.37-community : Database - qualitysystem ********************************************************************* */ /*!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*/`qualitysystem` /*!40100 DEFAULT CHARACTER SET latin1 */; USE `qualitysystem`; /*Table structure for table `hotdeploy_config` */ DROP TABLE IF EXISTS `hotdeploy_config`; CREATE TABLE `hotdeploy_config` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `hotdeploy_svn` varchar(255) DEFAULT NULL, `svn_password` varchar(255) DEFAULT NULL, `svn_user` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*Data for the table `hotdeploy_config` */ /*Table structure for table `issue_track` */ DROP TABLE IF EXISTS `issue_track`; CREATE TABLE `issue_track` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `issue_track_base_url` varchar(255) DEFAULT NULL, `issue_track_password` varchar(255) DEFAULT NULL, `issue_track_product_name` varchar(255) DEFAULT NULL, `issue_track_username` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*Data for the table `issue_track` */ /*Table structure for table `testrail` */ DROP TABLE IF EXISTS `testrail`; CREATE TABLE `testrail` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `testrail_password` varchar(255) DEFAULT NULL, `testrail_product_id` bigint(20) DEFAULT NULL, `testrail_server` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*Data for the table `testrail` */ /*!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 */; INSERT INTO `qualitysystem`.`issue_track` (issue_track_base_url, issue_track_product_name, issue_track_username, issue_track_password) (SELECT issue_track_base_url, issue_track_product_name, issue_track_username, issue_track_password FROM products); INSERT INTO `qualitysystem`.`testrail` (testrail_server,testrail_product_id,testrail_password) (SELECT testrail_server,testrail_product_id,testrail_password FROM products); INSERT INTO `qualitysystem`.`hotdeploy_config` (hotdeploy_svn,svn_user,svn_password) (SELECT hotdeploy_svn,svn_user,svn_password FROM products); alter table `products` drop column `default_version`, drop column `default_configuration`, drop column `issue_track_base_url`, drop column `issue_track_product_name`, drop column `issue_track_username`, drop column `issue_track_password`, drop column `hotdeploy_svn`, drop column `svn_user`, drop column `svn_password`, drop column `testrail_server`, drop column `testrail_product_id`, drop column `testrail_password`; ALTER TABLE `products` ADD COLUMN `hotdeploy_config_id` bigint(20) NOT NULL, ADD COLUMN `issue_track_id` bigint(20) NOT NULL, ADD COLUMN `testrail_id` bigint(20) NOT NULL; DELIMITER $$ CREATE /*[DEFINER = { user | CURRENT_USER }]*/ PROCEDURE `qualitysystem`.`updateProduct`() /*LANGUAGE SQL | [NOT] DETERMINISTIC | { CONTAINS SQL | NO SQL | READS SQL DATA | MODIFIES SQL DATA } | SQL SECURITY { DEFINER | INVOKER } | COMMENT 'string'*/ BEGIN DECLARE i INT DEFAULT 1; DECLARE n INT; SET n=(SELECT COUNT(*) FROM hotdeploy_config); WHILE i <= n DO UPDATE `products` SET hotdeploy_config_id=i, issue_track_id=i, testrail_id=i WHERE id=i; SET i=i+1; END WHILE; END$$ DELIMITER ; call updateProduct(); DROP PROCEDURE `qualitysystem`.`updateProduct`; ALTER TABLE `products` ADD CONSTRAINT `FKC42BD1646583B29D` FOREIGN KEY (`hotdeploy_config_id`) REFERENCES `hotdeploy_config` (`id`), ADD CONSTRAINT `FKC42BD1644DC57A20` FOREIGN KEY (`testrail_id`) REFERENCES `testrail` (`id`), ADD CONSTRAINT `FKC42BD1645C5A5A6D` FOREIGN KEY (`issue_track_id`) REFERENCES `issue_track` (`id`);
true
5a43e6d04a32d4d57714612f4df247960cb43836
SQL
christiandeangelis/meetpad-public
/cdst-business/conferenza/src/main/resources/db/migration/V1.062__vitomario_rubrica_richiedenti_open_fiber.sql
UTF-8
1,827
2.953125
3
[]
no_license
DO $do$ BEGIN if NOT EXISTS(SELECT codice_fiscale FROM cdst.persona WHERE codice_fiscale = 'MGLVMR62D30C283E') THEN INSERT INTO cdst.persona( codice_fiscale, cognome, email, nome) VALUES ('MGLVMR62D30C283E', 'Magliaro', 'vitomario.magliaro@openfiber.it', 'Vito Mario'); END IF; if NOT EXISTS(SELECT * FROM cdst.rubrica_richiedenti WHERE fk_tipologia_conferenza='4' AND fk_persona= (select id_persona from cdst.persona where codice_fiscale='MGLVMR62D30C283E') AND fk_rubrica_imprese= (select id_rubrica_imprese from cdst.rubrica_imprese where fk_impresa=(select id_impresa from cdst.impresa where partita_iva='09320630966') and fk_tipologia_conferenza='4')) THEN INSERT INTO cdst.rubrica_richiedenti( fk_tipologia_conferenza, fk_persona, principale, fk_rubrica_imprese) VALUES ('4', (select id_persona from cdst.persona where codice_fiscale='MGLVMR62D30C283E'), true, (select id_rubrica_imprese from cdst.rubrica_imprese where fk_impresa=(select id_impresa from cdst.impresa where partita_iva='09320630966') and fk_tipologia_conferenza='4')); END IF; if NOT EXISTS(SELECT * FROM cdst.rubrica_richiedenti WHERE fk_tipologia_conferenza='5' AND fk_persona= (select id_persona from cdst.persona where codice_fiscale='MGLVMR62D30C283E') AND fk_rubrica_imprese= (select id_rubrica_imprese from cdst.rubrica_imprese where fk_impresa=(select id_impresa from cdst.impresa where partita_iva='09320630966') and fk_tipologia_conferenza='5')) THEN INSERT INTO cdst.rubrica_richiedenti( fk_tipologia_conferenza, fk_persona, principale, fk_rubrica_imprese) VALUES ('5', (select id_persona from cdst.persona where codice_fiscale='MGLVMR62D30C283E'), true, (select id_rubrica_imprese from cdst.rubrica_imprese where fk_impresa=(select id_impresa from cdst.impresa where partita_iva='09320630966') and fk_tipologia_conferenza='5')); END IF; END $do$;
true
19a1bdca4430b563d3c0c8afa87d5a01a911418f
SQL
goingmywaynet/Obento
/DB/testdata/ObentoTestData.sql
UTF-8
4,783
2.65625
3
[]
no_license
-- 課マスタ INSERT INTO M_SECTION (section_id, section_name) VALUES ('1', 'スマイル課'); INSERT INTO M_SECTION (section_id, section_name) VALUES ('2', 'どきどき課'); INSERT INTO M_SECTION (section_id, section_name) VALUES ('3', 'ハピネス課'); -- 利用者マスタ INSERT INTO M_USER (user_id, section_id, user_name, enable_flag) VALUES ('1', '1', ' 星空 みゆき', '1'); INSERT INTO M_USER (user_id, section_id, user_name, enable_flag) VALUES ('2', '1', ' 日野 あかね', '1'); INSERT INTO M_USER (user_id, section_id, user_name, enable_flag) VALUES ('3', '1', ' 黄瀬 やよい', '1'); INSERT INTO M_USER (user_id, section_id, user_name, enable_flag) VALUES ('4', '1', ' 緑川 なお', '1'); INSERT INTO M_USER (user_id, section_id, user_name, enable_flag) VALUES ('5', '1', ' 青木 れいか', '1'); INSERT INTO M_USER (user_id, section_id, user_name, enable_flag) VALUES ('6', '2', ' 相田 マナ', '1'); INSERT INTO M_USER (user_id, section_id, user_name, enable_flag) VALUES ('7', '2', ' 菱川 六花', '1'); INSERT INTO M_USER (user_id, section_id, user_name, enable_flag) VALUES ('8', '2', ' 四葉 ありす', '1'); INSERT INTO M_USER (user_id, section_id, user_name, enable_flag) VALUES ('9', '2', ' 剣崎 真琴', '1'); INSERT INTO M_USER (user_id, section_id, user_name, enable_flag) VALUES ('10', '2', ' 円 亜久里', '1'); INSERT INTO M_USER (user_id, section_id, user_name, enable_flag) VALUES ('11', '3', ' 愛乃 めぐみ', '1'); INSERT INTO M_USER (user_id, section_id, user_name, enable_flag) VALUES ('12', '3', ' 白雪 ひめ', '1'); -- 店マスタ INSERT INTO M_SHOP (shop_id, shop_name) VALUES ('1', '吉田家'); INSERT INTO M_SHOP (shop_id, shop_name) VALUES ('2', '竹屋'); INSERT INTO M_SHOP (shop_id, shop_name) VALUES ('3', 'きす家'); INSERT INTO M_SHOP (shop_id, shop_name) VALUES ('4', 'なか卵'); -- 弁当マスタ INSERT INTO M_BENTO (bento_id, shop_id, bento_name, price, enable_flag) VALUES ('1', '1', '牛丼 並', '350', '1'); INSERT INTO M_BENTO (bento_id, shop_id, bento_name, price, enable_flag) VALUES ('2', '1', '牛丼 大', '400', '1'); INSERT INTO M_BENTO (bento_id, shop_id, bento_name, price, enable_flag) VALUES ('3', '1', 'ステーキ', '500', '0'); INSERT INTO M_BENTO (bento_id, shop_id, bento_name, price, enable_flag) VALUES ('4', '2', '焼肉定食 小', '300', '1'); INSERT INTO M_BENTO (bento_id, shop_id, bento_name, price, enable_flag) VALUES ('5', '2', '焼肉 定食 中', '350', '1'); INSERT INTO M_BENTO (bento_id, shop_id, bento_name, price, enable_flag) VALUES ('6', '2', '焼肉定食 大', '400', '1'); INSERT INTO M_BENTO (bento_id, shop_id, bento_name, price, enable_flag) VALUES ('7', '3', 'ハーフ&ハーフ 中', '350', '1'); INSERT INTO M_BENTO (bento_id, shop_id, bento_name, price, enable_flag) VALUES ('8', '3', 'ハーフ&ハーフ 大', '450', '1'); INSERT INTO M_BENTO (bento_id, shop_id, bento_name, price, enable_flag) VALUES ('9', '4', '親子丼 小', '300', '1'); INSERT INTO M_BENTO (bento_id, shop_id, bento_name, price, enable_flag) VALUES ('10', '5', '親子丼 大', '400', '1'); -- オプションマスタ INSERT INTO M_OPTION (option_id, option_group, option_name) VALUES ('1', '1', '白米'); INSERT INTO M_OPTION (option_id, option_group, option_name) VALUES ('2', '1', 'じゅーしー'); INSERT INTO M_OPTION (option_id, option_group, option_name) VALUES ('3', '1', 'チャーハン'); INSERT INTO M_OPTION (option_id, option_group, option_name) VALUES ('4', '1', 'カレー'); INSERT INTO M_OPTION (option_id, option_group, option_name) VALUES ('5', '2', 'チャーハン'); INSERT INTO M_OPTION (option_id, option_group, option_name) VALUES ('6', '2', 'カレー'); INSERT INTO M_OPTION (option_id, option_group, option_name) VALUES ('7', '2', '天津飯'); INSERT INTO M_OPTION (option_id, option_group, option_name) VALUES ('8', '2', 'ちゃんぽん'); INSERT INTO M_OPTION (option_id, option_group, option_name) VALUES ('9', '2', 'カツ丼'); INSERT INTO M_OPTION (option_id, option_group, option_name) VALUES ('10', '2', '天丼'); INSERT INTO M_OPTION (option_id, option_group, option_name) VALUES ('11', '2', '牛丼'); INSERT INTO M_OPTION (option_id, option_group, option_name) VALUES ('12', '2', '親子丼'); -- 弁当オプション関連 INSERT INTO M_BENTO_OPT (bento_id, option_group) VALUES ('3', '1'); INSERT INTO M_BENTO_OPT (bento_id, option_group) VALUES ('4', '1'); INSERT INTO M_BENTO_OPT (bento_id, option_group) VALUES ('5', '1'); INSERT INTO M_BENTO_OPT (bento_id, option_group) VALUES ('6', '1'); INSERT INTO M_BENTO_OPT (bento_id, option_group) VALUES ('7', '2'); INSERT INTO M_BENTO_OPT (bento_id, option_group) VALUES ('8', '2');
true
129a977d0c8c56850d8fee1267ba78dab3a4a55c
SQL
filipeoliveirah/php-default-project
/res/sql/tables/tb_placescoordinates.sql
UTF-8
488
2.78125
3
[]
no_license
CREATE TABLE `tb_placescoordinates` ( `idplace` int(11) NOT NULL, `idcoordinate` int(11) NOT NULL, `dtregister` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, KEY `idplace` (`idplace`), KEY `idcoordinate` (`idcoordinate`), CONSTRAINT `tb_placescoordinates_ibfk_1` FOREIGN KEY (`idplace`) REFERENCES `tb_places` (`idplace`), CONSTRAINT `tb_placescoordinates_ibfk_2` FOREIGN KEY (`idcoordinate`) REFERENCES `tb_coordinates` (`idcoordinate`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8
true
7af3b1f2eef07aabc0ac84f2cc724b42c8f417b0
SQL
vijaykiran/hopsworks
/metadata_indexing/Elastic_Rivers_Child.sql
UTF-8
8,025
4.4375
4
[ "Apache-2.0" ]
permissive
-- TAKE A BATCH OF RECORDS BLINDLY INTO THE BUFFER TABLE (deprecated. Use the one below instead) INSERT INTO hopsworks.meta_inodes_ops_children_deleted (inodeid, parentid, processed) (SELECT hops.hdfs_metadata_log.inode_id, hops.hdfs_metadata_log.dataset_id, 0 FROM hops.hdfs_metadata_log LIMIT 100); -- SELECTIVELY DUMP A BATCH OF CHILDREN RECORDS INTO THE BUFFER TABLE - (picks up added and deleted records in one step) INSERT INTO hopsworks.meta_inodes_ops_children_deleted (inodeid, parentid, processed) ( SELECT DISTINCT ml.inode_id as _id, ml.dataset_id, 0 as processed FROM hops.hdfs_metadata_log ml, (SELECT log.inode_id as inodeid, log.dataset_id as parentid FROM hops.hdfs_metadata_log log, (SELECT p.inode_id as id, p.dataset_id as parentt, p.* FROM hops.hdfs_metadata_log p, (SELECT i.inode_id as id FROM hops.hdfs_metadata_log i, (SELECT inn.id FROM hops.hdfs_inodes inn WHERE inn.parent_id = 1 ) AS root WHERE i.dataset_id = root.id ) AS project WHERE p.dataset_id = project.id )as dataset WHERE log.dataset_id = dataset.id )as child WHERE ml.inode_id = child.inodeid LIMIT 100); -- SELECT ALL CHILDREN (no datasets) THAT HAVE BEEN ADDED (OPERATION 0 - returns dataset id as a parent - indexes subdirs under the dataset) SELECT composite.*, "child" as type, metadata.EXTENDED_METADATA FROM ( SELECT DISTINCT hi.id as _id, op._parent, hi.name, op.operation, op.logical_time FROM hops.hdfs_inodes hi, (SELECT log.inode_id as child_id, log.dataset_id as _parent, log.operation, log.logical_time FROM hops.hdfs_metadata_log log, (SELECT c.parent_id FROM hops.hdfs_inodes c, (SELECT d.id FROM hops.hdfs_inodes d, (SELECT p.id FROM hops.hdfs_inodes p, (SELECT r.id FROM hops.hdfs_inodes r WHERE r.parent_id = 1 ) AS root WHERE p.parent_id = root.id ) AS project WHERE d.parent_id = project.id ) AS dataset WHERE c.parent_id = dataset.id ) AS child WHERE log.dataset_id = child.parent_id AND log.operation = 0 ) as op WHERE hi.id = op.child_id AND hi.id IN (SELECT inodeid FROM hopsworks.meta_inodes_ops_children_deleted) LIMIT 100 )as composite LEFT JOIN ( SELECT mtt.inodeid, GROUP_CONCAT( md.data SEPARATOR '|' ) AS EXTENDED_METADATA FROM hopsworks.meta_tuple_to_file mtt, hopsworks.meta_data md WHERE mtt.tupleid = md.tupleid GROUP BY (mtt.inodeid) LIMIT 0 , 30 ) as metadata ON metadata.inodeid = composite._id ORDER BY composite.logical_time ASC; -- SELECT ALL CHILDREN (no datasets) THAT HAVE BEEN ADDED (OPERATION 0 - returns project id as a parent - indexes subdirs under the project) SELECT composite.*, "child" as type, metadata.EXTENDED_METADATA FROM ( SELECT DISTINCT hi.id as _id, op._parent, hi.name, op.operation, op.logical_time FROM hops.hdfs_inodes hi, (SELECT log.inode_id as child_id, child.parent as _parent, log.operation, log.logical_time FROM hops.hdfs_metadata_log log, (SELECT c.parent_id, dataset.parent as parent FROM hops.hdfs_inodes c, (SELECT d.id, project.projectid as parent FROM hops.hdfs_inodes d, (SELECT p.id as projectid FROM hops.hdfs_inodes p, (SELECT r.id FROM hops.hdfs_inodes r WHERE r.parent_id = 1 ) AS root WHERE p.parent_id = root.id ) AS project WHERE d.parent_id = project.projectid ) AS dataset WHERE c.parent_id = dataset.id ) AS child WHERE log.dataset_id = child.parent_id AND log.operation = 0 ) as op WHERE hi.id = op.child_id AND hi.id IN (SELECT inodeid FROM hopsworks.meta_inodes_ops_children_deleted) LIMIT 100 )as composite LEFT JOIN ( SELECT mtt.inodeid, GROUP_CONCAT( md.data SEPARATOR '|' ) AS EXTENDED_METADATA FROM hopsworks.meta_tuple_to_file mtt, hopsworks.meta_data md WHERE mtt.tupleid = md.tupleid GROUP BY (mtt.inodeid) LIMIT 0 , 30 ) as metadata ON metadata.inodeid = composite._id ORDER BY composite.logical_time ASC; -- SELECT ALL CHILDREN THAT HAVE BEEN DELETED/RENAMED (OPERATION 1) AND ARE NOT YET PROCESSED (returns dataset id as a parent) -- THE PARENT IS ASSUMED TO RESIDE IN THE LOGS TABLE. IF THE PARENT IS ALREADY INDEXED (BUT NOT DELETED) THE QUERY WILL NOT FIND THE CORRESPONDING CHILDREN SELECT c.inode_id as _id, c.dataset_id as _parent, c.logical_time, c.operation FROM hops.hdfs_metadata_log c, (SELECT d.dataset_id, d.inode_id FROM hops.hdfs_metadata_log d, (SELECT log.dataset_id, log.inode_id FROM hops.hdfs_metadata_log log, (SELECT inn.id FROM hops.hdfs_inodes inn WHERE inn.parent_id = 1 ) AS root WHERE log.dataset_id = root.id )AS project WHERE d.dataset_id = project.inode_id ) AS dataset WHERE c.dataset_id = dataset.inode_id AND c.operation = 1 AND c.inode_id IN (SELECT inodeid FROM hopsworks.meta_inodes_ops_children_deleted WHERE processed = 0); -- SELECT ALL CHILDREN THAT HAVE BEEN DELETED/RENAMED (OPERATION 1) AND ARE NOT YET PROCESSED (returns project id as a parent) -- THE PARENT IS ASSUMED TO RESIDE IN THE LOGS TABLE. IF THE PARENT IS ALREADY INDEXED (BUT NOT DELETED) THE QUERY WILL NOT FIND THE CORRESPONDING CHILDREN. SELECT c.inode_id as _id, dataset.parent as _parent, c.logical_time, c.operation FROM hops.hdfs_metadata_log c, (SELECT d.dataset_id, d.inode_id, project.projectid as parent FROM hops.hdfs_metadata_log d, (SELECT log.dataset_id, log.inode_id as projectid FROM hops.hdfs_metadata_log log, (SELECT inn.id FROM hops.hdfs_inodes inn WHERE inn.parent_id = 1 ) AS root WHERE log.dataset_id = root.id )AS project WHERE d.dataset_id = project.projectid ) AS dataset WHERE c.dataset_id = dataset.inode_id AND c.operation = 1 AND c.inode_id IN (SELECT inodeid FROM hopsworks.meta_inodes_ops_children_deleted WHERE processed = 0); -- SELECT ALL CHILDREN THAT HAVE BEEN DELETED/RENAMED (OPERATION 1) AND ARE NOT YET PROCESSED (returns dataset id as a parent) -- THE PARENT IS NOT DELETED AND RESIDES IN THE HDFS_INODES TABLE. SELECT c.inode_id as _id, c.dataset_id as _parent, c.logical_time, c.operation FROM hops.hdfs_metadata_log c, (SELECT d.parent_id, d.id, project.projectid as parent FROM hops.hdfs_inodes d, (SELECT p.parent_id, p.id as projectid FROM hops.hdfs_inodes p, (SELECT inn.id FROM hops.hdfs_inodes inn WHERE inn.parent_id = 1 ) AS root WHERE p.parent_id = root.id )AS project WHERE d.parent_id = project.projectid ) AS dataset WHERE c.dataset_id = dataset.id AND c.operation = 1 AND c.inode_id IN (SELECT inodeid FROM hopsworks.meta_inodes_ops_children_deleted WHERE processed = 0); -- SELECT ALL CHILDREN THAT HAVE BEEN DELETED/RENAMED (OPERATION 1) AND ARE NOT YET PROCESSED (returns project id as a parent) -- THE PARENT IS NOT DELETED AND RESIDES IN THE HDFS_INODES TABLE. SELECT c.inode_id as _id, dataset.parent as _parent, c.logical_time, c.operation FROM hops.hdfs_metadata_log c, (SELECT d.parent_id, d.id, project.projectid as parent FROM hops.hdfs_inodes d, (SELECT p.parent_id, p.id as projectid FROM hops.hdfs_inodes p, (SELECT inn.id FROM hops.hdfs_inodes inn WHERE inn.parent_id = 1 ) AS root WHERE p.parent_id = root.id )AS project WHERE d.parent_id = project.projectid ) AS dataset WHERE c.dataset_id = dataset.id AND c.operation = 1 AND c.inode_id IN (SELECT inodeid FROM hopsworks.meta_inodes_ops_children_deleted WHERE processed = 0); -- DELETE ALL PROCESSED CHILDREN FROM THE HDFS_METADATA_LOG TABLE DELETE FROM hops.hdfs_metadata_log WHERE inode_id IN (SELECT inodeid FROM hopsworks.meta_inodes_ops_children_deleted); -- MARK AS PROCESSED ALL CHILDREN THAT HAVE BEEN PROCESSED (PROCESSED = 1 - deprecated) UPDATE hopsworks.meta_inodes_ops_children_deleted m SET m.processed = 1 AND m.inodeid IN (SELECT inode_id FROM hops.hdfs_metadata_log) -- DELETE ALL CHILDREN THAT HAVE BEEN MARKED AS PROCESSED (PROCESSED = 1) DELETE FROM hopsworks.meta_inodes_ops_children_deleted WHERE processed = 1;
true
53f82f4789b96fd209ad15df9645e2703b5aa515
SQL
puwelous/AMEISELangTranslations
/vf_addQuery.sql
UTF-8
26,961
2.8125
3
[]
no_license
/* NEU */ INSERT INTO rule(rlid,zort,basic_op,value_ref_point,text_ref_point) VALUES (2000,'T','!=',null,'1901/01/01/00:00'); INSERT INTO rule(rlid,zort,basic_op,value_ref_point,text_ref_point) VALUES (2001,'T','==',null,'1901/01/01/00:00'); INSERT INTO query(qid,attribute,statement,z_path) VALUES (2000,'Beginn der Entwurfsphase', 'select distinct s_entity.value from zarmstype,z_entity,z_attribute,comprises,s_entity,game,spaid_needs_zt,specific_aid where spaid_needs_zt.spaidid = specific_aid.spaidid AND spaid_needs_zt.zid = zarmstype.zid AND zarmstype.eorr = "E" AND zarmstype.z_type = "PROJEKTLOGBUCH" AND zarmstype.zid = z_entity.zid AND z_entity.description = "Projectlog" AND z_entity.zeid = comprises.zeid AND comprises.zaid = z_attribute.zaid AND z_attribute.name = "ENTWURF_BEGINN" AND comprises.compid = s_entity.compid AND s_entity.gid = game.gid AND game.gid = %game AND LOCATE(s_entity.path, \"%path\")=1 order by s_entity.tnid desc;', "**PROJEKTLOGBUCH*Projectlog*ENTWURF_BEGINN"); INSERT INTO query(qid,attribute,statement,z_path) VALUES (2001,"Beginn der Spezifikationsphase", 'select distinct s_entity.value from zarmstype,z_entity,z_attribute,comprises,s_entity,game,spaid_needs_zt,specific_aid where spaid_needs_zt.spaidid = specific_aid.spaidid AND spaid_needs_zt.zid = zarmstype.zid AND zarmstype.eorr = "E" AND zarmstype.z_type = "PROJEKTLOGBUCH" AND zarmstype.zid = z_entity.zid AND z_entity.description = "Projectlog" AND z_entity.zeid = comprises.zeid AND comprises.zaid = z_attribute.zaid AND z_attribute.name = "SPEZIFIKATION_BEGINN" AND comprises.compid = s_entity.compid AND s_entity.gid = game.gid AND game.gid = %game AND LOCATE(s_entity.path, \"%path\")=1 order by s_entity.tnid desc;', "**PROJEKTLOGBUCH*Projectlog*SPEZIFIKATION_BEGINN"); INSERT INTO query(qid,attribute,statement,z_path) VALUES (2002,"Beginn der Moduldesignsphase", 'select distinct s_entity.value from zarmstype,z_entity,z_attribute,comprises,s_entity,game,spaid_needs_zt,specific_aid where spaid_needs_zt.spaidid = specific_aid.spaidid AND spaid_needs_zt.zid = zarmstype.zid AND zarmstype.eorr = "E" AND zarmstype.z_type = "PROJEKTLOGBUCH" AND zarmstype.zid = z_entity.zid AND z_entity.description = "Projectlog" AND z_entity.zeid = comprises.zeid AND comprises.zaid = z_attribute.zaid AND z_attribute.name = "MODSPEZ_BEGINN" AND comprises.compid = s_entity.compid AND s_entity.gid = game.gid AND game.gid = %game AND LOCATE(s_entity.path, \"%path\")=1 order by s_entity.tnid desc;', "**PROJEKTLOGBUCH*Projectlog*MODSPEZ_BEGINN"); INSERT INTO query(qid,attribute,statement,z_path) VALUES (2003,"Beginn der Codierungsphase", 'select distinct s_entity.value from zarmstype,z_entity,z_attribute,comprises,s_entity,game,spaid_needs_zt,specific_aid where spaid_needs_zt.spaidid = specific_aid.spaidid AND spaid_needs_zt.zid = zarmstype.zid AND zarmstype.eorr = "E" AND zarmstype.z_type = "PROJEKTLOGBUCH" AND zarmstype.zid = z_entity.zid AND z_entity.description = "Projectlog" AND z_entity.zeid = comprises.zeid AND comprises.zaid = z_attribute.zaid AND z_attribute.name = "CODE_BEGINN" AND comprises.compid = s_entity.compid AND s_entity.gid = game.gid AND game.gid = %game AND LOCATE(s_entity.path, \"%path\")=1 order by s_entity.tnid desc;', "**PROJEKTLOGBUCH*Projectlog*CODE_BEGINN"); /****************** INSERT INTO query(qid,attribute,statement,z_path) VALUES (2004,"Ende der Spezifikationsphase", 'select distinct s_entity.value from zarmstype,z_entity,z_attribute,comprises,s_entity,game,spaid_needs_zt,specific_aid where spaid_needs_zt.spaidid = specific_aid.spaidid AND spaid_needs_zt.zid = zarmstype.zid AND zarmstype.eorr = "E" AND zarmstype.z_type = "PROJEKTLOGBUCH" AND zarmstype.zid = z_entity.zid AND z_entity.description = "Projectlog" AND z_entity.zeid = comprises.zeid AND comprises.zaid = z_attribute.zaid AND z_attribute.name = "SPEZIFIKATION_ENDE" AND comprises.compid = s_entity.compid AND s_entity.gid = game.gid AND game.gid = %game AND LOCATE(s_entity.path, \"%path\")=1 order by s_entity.tnid desc;', "**PROJEKTLOGBUCH*Projectlog*SPEZIFIKATION_ENDE"); ***********************/ INSERT INTO query(qid,attribute,statement,z_path) VALUES (2004,"Ende der Spezifikationsphase", 'select distinct greatest("1901/01/01/00:00", (select REPLACE(max(s_relation.completion_date),"-","/") as completion_date from s_relation, zarmstype, game WHERE zarmstype.zid = s_relation.zid AND (zarmstype.z_type="PRODUZIERT" AND (document = "Spezifikation" OR document = "Specification")) AND s_relation.gid= %game AND LOCATE(s_relation.path, \"%path\")=1 ORDER BY s_relation.starting_date)) as completion_date;', "**PROJEKTLOGBUCH*Projectlog*SPEZIFIKATION_ENDE"); /********************************* INSERT INTO query(qid,attribute,statement,z_path) VALUES (2005,"Ende der Systemdesignphase", 'select distinct s_entity.value from zarmstype,z_entity,z_attribute,comprises,s_entity,game,spaid_needs_zt,specific_aid where spaid_needs_zt.spaidid = specific_aid.spaidid AND spaid_needs_zt.zid = zarmstype.zid AND zarmstype.eorr = "E" AND zarmstype.z_type = "PROJEKTLOGBUCH" AND zarmstype.zid = z_entity.zid AND z_entity.description = "Projectlog" AND z_entity.zeid = comprises.zeid AND comprises.zaid = z_attribute.zaid AND z_attribute.name = "ENTWURF_ENDE" AND comprises.compid = s_entity.compid AND s_entity.gid = game.gid AND game.gid = %game AND LOCATE(s_entity.path, \"%path\")=1 order by s_entity.tnid desc;', "**PROJEKTLOGBUCH*Projectlog*ENTWURF_EMDE"); ********************/ INSERT INTO query(qid,attribute,statement,z_path) VALUES (2005,"Ende der Systemdesignphase", 'select distinct greatest("1901/01/01/00:00", (select REPLACE(max(s_relation.completion_date),"-","/") as completion_date from s_relation, zarmstype, game WHERE zarmstype.zid = s_relation.zid AND (zarmstype.z_type="PRODUZIERT" AND (document = "Systemdesign")) AND s_relation.gid=%game AND LOCATE(s_relation.path, \"%path\")=1 ORDER BY s_relation.starting_date)) as completion_date;', "**PROJEKTLOGBUCH*Projectlog*ENTWURF_EMDE"); /********************* INSERT INTO query(qid,attribute,statement,z_path) VALUES (2006,"Ende der Moduldesignphase", 'select distinct s_entity.value from zarmstype,z_entity,z_attribute,comprises,s_entity,game,spaid_needs_zt,specific_aid where spaid_needs_zt.spaidid = specific_aid.spaidid AND spaid_needs_zt.zid = zarmstype.zid AND zarmstype.eorr = "E" AND zarmstype.z_type = "PROJEKTLOGBUCH" AND zarmstype.zid = z_entity.zid AND z_entity.description = "Projectlog" AND z_entity.zeid = comprises.zeid AND comprises.zaid = z_attribute.zaid AND z_attribute.name = "MODSPEZ_ENDE" AND comprises.compid = s_entity.compid AND s_entity.gid = game.gid AND game.gid = %game AND LOCATE(s_entity.path, \"%path\")=1 order by s_entity.tnid desc;', "**PROJEKTLOGBUCH*Projectlog*MODSPEZ_ENDE"); *******************/ INSERT INTO query(qid,attribute,statement,z_path) VALUES (2006,"Ende der Moduldesignphase", 'select distinct greatest("1901/01/01/00:00", (select REPLACE(max(s_relation.completion_date),"-","/") as completion_date from s_relation, zarmstype, game WHERE zarmstype.zid = s_relation.zid AND (zarmstype.z_type="PRODUZIERT" AND (document = "Moduldesign" OR document = "Moduledesign")) AND s_relation.gid=%game AND LOCATE(s_relation.path, \"%path\")=1 ORDER BY s_relation.starting_date)) as completion_date;', "**PROJEKTLOGBUCH*Projectlog*MODSPEZ_ENDE"); /************************ INSERT INTO query(qid,attribute,statement,z_path) VALUES (2007,"Ende der Codierungsphase", 'select distinct s_entity.value from zarmstype,z_entity,z_attribute,comprises,s_entity,game,spaid_needs_zt,specific_aid where spaid_needs_zt.spaidid = specific_aid.spaidid AND spaid_needs_zt.zid = zarmstype.zid AND zarmstype.eorr = "E" AND zarmstype.z_type = "PROJEKTLOGBUCH" AND zarmstype.zid = z_entity.zid AND z_entity.description = "Projectlog" AND z_entity.zeid = comprises.zeid AND comprises.zaid = z_attribute.zaid AND z_attribute.name = "CODE_ENDE" AND comprises.compid = s_entity.compid AND s_entity.gid = game.gid AND game.gid = %game AND LOCATE(s_entity.path, \"%path\")=1 order by s_entity.tnid desc;', "**PROJEKTLOGBUCH*Projectlog*CODE_ENDE"); ************************/ INSERT INTO query(qid,attribute,statement,z_path) VALUES (2007,"Ende der Codierungsphase", 'select distinct greatest("1901/01/01/00:00", (select REPLACE(max(s_relation.completion_date),"-","/") as completion_date from s_relation, zarmstype, game WHERE zarmstype.zid = s_relation.zid AND (zarmstype.z_type="PRODUZIERT" AND (document = "Code")) AND s_relation.gid=%game AND LOCATE(s_relation.path, \"%path\")=1 ORDER BY s_relation.starting_date)) as completion_date;',"**PROJEKTLOGBUCH*Projectlog*CODE_ENDE"); INSERT INTO query(qid,attribute,statement,z_path) VALUES (2008,"Beginn der Modultestsphase", 'select distinct s_entity.value from zarmstype,z_entity,z_attribute,comprises,s_entity,game,spaid_needs_zt,specific_aid where spaid_needs_zt.spaidid = specific_aid.spaidid AND spaid_needs_zt.zid = zarmstype.zid AND zarmstype.eorr = "E" AND zarmstype.z_type = "TESTLOGBUCH" AND zarmstype.zid = z_entity.zid AND z_entity.description = "Testlog" AND z_entity.zeid = comprises.zeid AND comprises.zaid = z_attribute.zaid AND z_attribute.name = "MTEST_BEGINN" AND comprises.compid = s_entity.compid AND s_entity.gid = game.gid AND game.gid = %game AND LOCATE(s_entity.path, \"%path\")=1 order by s_entity.tnid desc;', "**TESTLOGBUCH*Testlog*MTEST_BEGINN"); INSERT INTO query(qid,attribute,statement,z_path) VALUES (2009,"Beginn der Integrationstestsphase", 'select distinct s_entity.value from zarmstype,z_entity,z_attribute,comprises,s_entity,game,spaid_needs_zt,specific_aid where spaid_needs_zt.spaidid = specific_aid.spaidid AND spaid_needs_zt.zid = zarmstype.zid AND zarmstype.eorr = "E" AND zarmstype.z_type = "TESTLOGBUCH" AND zarmstype.zid = z_entity.zid AND z_entity.description = "Testlog" AND z_entity.zeid = comprises.zeid AND comprises.zaid = z_attribute.zaid AND z_attribute.name = "ITEST_BEGINN" AND comprises.compid = s_entity.compid AND s_entity.gid = game.gid AND game.gid = %game AND LOCATE(s_entity.path, \"%path\")=1 order by s_entity.tnid desc;', "**TESTLOGBUCH*Testlog*ITEST_BEGINN"); /***************** INSERT INTO query(qid,attribute,statement,z_path) VALUES (2010,"Ende der Modultestphase", 'select distinct s_entity.value from zarmstype,z_entity,z_attribute,comprises,s_entity,game,spaid_needs_zt,specific_aid where spaid_needs_zt.spaidid = specific_aid.spaidid AND spaid_needs_zt.zid = zarmstype.zid AND zarmstype.eorr = "E" AND zarmstype.z_type = "TESTLOGBUCH" AND zarmstype.zid = z_entity.zid AND z_entity.description = "Testlog" AND z_entity.zeid = comprises.zeid AND comprises.zaid = z_attribute.zaid AND z_attribute.name = "MTEST_ENDE" AND comprises.compid = s_entity.compid AND s_entity.gid = game.gid AND game.gid = %game AND LOCATE(s_entity.path, \"%path\")=1 order by s_entity.tnid desc;', "**TESTLOGBUCH*Testlog*MTEST_ENDE"); ************/ INSERT INTO query(qid,attribute,statement,z_path) VALUES (2010,"Ende der Modultestphase", 'select distinct greatest("1901/01/01/00:00", (select REPLACE(max(s_relation.completion_date),"-","/") as completion_date from s_relation, zarmstype WHERE zarmstype.zid = s_relation.zid AND (zarmstype.z_type="TESTET_MODULE") AND s_relation.gid= %game AND LOCATE(s_relation.path, \"%path\")=1 ORDER BY s_relation.starting_date)) as completion_date;', "**TESTLOGBUCH*Testlog*MTEST_ENDE"); INSERT INTO query(qid,attribute,statement,z_path) VALUES (2011,"Beginn der Systemstestsphase", 'select distinct s_entity.value from zarmstype,z_entity,z_attribute,comprises,s_entity,game,spaid_needs_zt,specific_aid where spaid_needs_zt.spaidid = specific_aid.spaidid AND spaid_needs_zt.zid = zarmstype.zid AND zarmstype.eorr = "E" AND zarmstype.z_type = "TESTLOGBUCH" AND zarmstype.zid = z_entity.zid AND z_entity.description = "Testlog" AND z_entity.zeid = comprises.zeid AND comprises.zaid = z_attribute.zaid AND z_attribute.name = "STEST_BEGINN" AND comprises.compid = s_entity.compid AND s_entity.gid = game.gid AND game.gid = %game AND LOCATE(s_entity.path, \"%path\")=1 order by s_entity.tnid desc;', "**TESTLOGBUCH*Testlog*STEST_BEGINN"); /***************** INSERT INTO query(qid,attribute,statement,z_path) VALUES (2012,"Ende der Integrationstestphase", 'select distinct s_entity.value from zarmstype,z_entity,z_attribute,comprises,s_entity,game,spaid_needs_zt,specific_aid where spaid_needs_zt.spaidid = specific_aid.spaidid AND spaid_needs_zt.zid = zarmstype.zid AND zarmstype.eorr = "E" AND zarmstype.z_type = "TESTLOGBUCH" AND zarmstype.zid = z_entity.zid AND z_entity.description = "Testlog" AND z_entity.zeid = comprises.zeid AND comprises.zaid = z_attribute.zaid AND z_attribute.name = "ITEST_ENDE" AND comprises.compid = s_entity.compid AND s_entity.gid = game.gid AND game.gid = %game AND LOCATE(s_entity.path, \"%path\")=1 order by s_entity.tnid desc;', "**TESTLOGBUCH*Testlog*ITEST_ENDE"); ************/ INSERT INTO query(qid,attribute,statement,z_path) VALUES (2012,"Ende der Integrationstestphase", 'select distinct greatest("1901/01/01/00:00", (select REPLACE(max(s_relation.completion_date),"-","/") as completion_date from s_relation, zarmstype WHERE zarmstype.zid = s_relation.zid AND (zarmstype.z_type="TESTET_INTEGRATION") AND s_relation.gid= %game AND LOCATE(s_relation.path, \"%path\")=1 ORDER BY s_relation.starting_date)) as completion_date;', "**TESTLOGBUCH*Testlog*ITEST_ENDE"); /********************* INSERT INTO query(qid,attribute,statement,z_path) VALUES (2013,"Ende der Systemtestphase", 'select distinct s_entity.value from zarmstype,z_entity,z_attribute,comprises,s_entity,game,spaid_needs_zt,specific_aid where spaid_needs_zt.spaidid = specific_aid.spaidid AND spaid_needs_zt.zid = zarmstype.zid AND zarmstype.eorr = "E" AND zarmstype.z_type = "TESTLOGBUCH" AND zarmstype.zid = z_entity.zid AND z_entity.description = "Testlog" AND z_entity.zeid = comprises.zeid AND comprises.zaid = z_attribute.zaid AND z_attribute.name = "STEST_ENDE" AND comprises.compid = s_entity.compid AND s_entity.gid = game.gid AND game.gid = %game AND LOCATE(s_entity.path, \"%path\")=1 order by s_entity.tnid desc;', "**TESTLOGBUCH*Testlog*STEST_ENDE"); *****************/ INSERT INTO query(qid,attribute,statement,z_path) VALUES (2013,"Ende der Systemtestphase", 'select distinct greatest("1901/01/01/00:00", (Select REPLACE(max(s_relation.completion_date),"-","/") as completion_date from s_relation, zarmstype WHERE zarmstype.zid = s_relation.zid AND (zarmstype.z_type="TESTET_SYSTEM") AND s_relation.gid= %game AND LOCATE(s_relation.path, \"%path\")=1 ORDER BY s_relation.starting_date)) as completion_date;', "**TESTLOGBUCH*Testlog*STEST_ENDE"); INSERT INTO query(qid,attribute,statement,z_path) VALUES (2014,"Beginn der Abnahmetestsphase", 'select distinct s_entity.value from zarmstype,z_entity,z_attribute,comprises,s_entity,game,spaid_needs_zt,specific_aid where spaid_needs_zt.spaidid = specific_aid.spaidid AND spaid_needs_zt.zid = zarmstype.zid AND zarmstype.eorr = "E" AND zarmstype.z_type = "TESTLOGBUCH" AND zarmstype.zid = z_entity.zid AND z_entity.description = "Testlog" AND z_entity.zeid = comprises.zeid AND comprises.zaid = z_attribute.zaid AND z_attribute.name = "ATEST_BEGINN" AND comprises.compid = s_entity.compid AND s_entity.gid = game.gid AND game.gid = %game AND LOCATE(s_entity.path, \"%path\")=1 order by s_entity.tnid desc;', "**TESTLOGBUCH*Testlog*ATEST_BEGINN"); INSERT INTO query(qid,attribute,statement,z_path) VALUES (2015,"Beginn der Spezifikationsreviewphase", 'select distinct s_entity.value from zarmstype,z_entity,z_attribute,comprises,s_entity,game,spaid_needs_zt,specific_aid where spaid_needs_zt.spaidid = specific_aid.spaidid AND spaid_needs_zt.zid = zarmstype.zid AND zarmstype.eorr = "E" AND zarmstype.z_type = "REVIEWLOGBUCH" AND zarmstype.zid = z_entity.zid AND z_entity.description = "Reviewlog" AND z_entity.zeid = comprises.zeid AND comprises.zaid = z_attribute.zaid AND z_attribute.name = "SREVIEW_BEGINN" AND comprises.compid = s_entity.compid AND s_entity.gid = game.gid AND game.gid = %game AND LOCATE(s_entity.path, \"%path\")=1 order by s_entity.tnid desc;', "**REVIEWLOGBUCH*Reviewlog*SREVIEW_BEGINN"); INSERT INTO query(qid,attribute,statement,z_path) VALUES (2016,"Beginn der Systemdesignreviewphase", 'select distinct s_entity.value from zarmstype,z_entity,z_attribute,comprises,s_entity,game,spaid_needs_zt,specific_aid where spaid_needs_zt.spaidid = specific_aid.spaidid AND spaid_needs_zt.zid = zarmstype.zid AND zarmstype.eorr = "E" AND zarmstype.z_type = "REVIEWLOGBUCH" AND zarmstype.zid = z_entity.zid AND z_entity.description = "Reviewlog" AND z_entity.zeid = comprises.zeid AND comprises.zaid = z_attribute.zaid AND z_attribute.name = "EREVIEW_BEGINN" AND comprises.compid = s_entity.compid AND s_entity.gid = game.gid AND game.gid = %game AND LOCATE(s_entity.path, \"%path\")=1 order by s_entity.tnid desc;', "**REVIEWLOGBUCH*Reviewlog*EREVIEW_BEGINN"); INSERT INTO query(qid,attribute,statement,z_path) VALUES (2017,"Beginn der Moduldesignreviewphase", 'select distinct s_entity.value from zarmstype,z_entity,z_attribute,comprises,s_entity,game,spaid_needs_zt,specific_aid where spaid_needs_zt.spaidid = specific_aid.spaidid AND spaid_needs_zt.zid = zarmstype.zid AND zarmstype.eorr = "E" AND zarmstype.z_type = "REVIEWLOGBUCH" AND zarmstype.zid = z_entity.zid AND z_entity.description = "Reviewlog" AND z_entity.zeid = comprises.zeid AND comprises.zaid = z_attribute.zaid AND z_attribute.name = "MREVIEW_BEGINN" AND comprises.compid = s_entity.compid AND s_entity.gid = game.gid AND game.gid = %game AND LOCATE(s_entity.path, \"%path\")=1 order by s_entity.tnid desc;', "**REVIEWLOGBUCH*Reviewlog*MREVIEW_BEGINN"); INSERT INTO query(qid,attribute,statement,z_path) VALUES (2018,"Beginn der Spezifikationskorrekturphase", 'select distinct s_entity.value from zarmstype,z_entity,z_attribute,comprises,s_entity,game,spaid_needs_zt,specific_aid where spaid_needs_zt.spaidid = specific_aid.spaidid AND spaid_needs_zt.zid = zarmstype.zid AND zarmstype.eorr = "E" AND zarmstype.z_type = "REVIEWLOGBUCH" AND zarmstype.zid = z_entity.zid AND z_entity.description = "Reviewlog" AND z_entity.zeid = comprises.zeid AND comprises.zaid = z_attribute.zaid AND z_attribute.name = "SREVIEW_K_BEGINN" AND comprises.compid = s_entity.compid AND s_entity.gid = game.gid AND game.gid = %game AND LOCATE(s_entity.path, \"%path\")=1 order by s_entity.tnid desc;', "**REVIEWLOGBUCH*Reviewlog*SREVIEW_K_BEGINN"); INSERT INTO query(qid,attribute,statement,z_path) VALUES (2019,"Beginn der Systemdesignkorrekturphase", 'select distinct s_entity.value from zarmstype,z_entity,z_attribute,comprises,s_entity,game,spaid_needs_zt,specific_aid where spaid_needs_zt.spaidid = specific_aid.spaidid AND spaid_needs_zt.zid = zarmstype.zid AND zarmstype.eorr = "E" AND zarmstype.z_type = "REVIEWLOGBUCH" AND zarmstype.zid = z_entity.zid AND z_entity.description = "Reviewlog" AND z_entity.zeid = comprises.zeid AND comprises.zaid = z_attribute.zaid AND z_attribute.name = "EREVIEW_K_BEGINN" AND comprises.compid = s_entity.compid AND s_entity.gid = game.gid AND game.gid = %game AND LOCATE(s_entity.path, \"%path\")=1 order by s_entity.tnid desc;', "**REVIEWLOGBUCH*Reviewlog*EREVIEW_K_BEGINN"); INSERT INTO query(qid,attribute,statement,z_path) VALUES (2020,"Beginn der Moduldesignkorrekturphase", 'select distinct s_entity.value from zarmstype,z_entity,z_attribute,comprises,s_entity,game,spaid_needs_zt,specific_aid where spaid_needs_zt.spaidid = specific_aid.spaidid AND spaid_needs_zt.zid = zarmstype.zid AND zarmstype.eorr = "E" AND zarmstype.z_type = "REVIEWLOGBUCH" AND zarmstype.zid = z_entity.zid AND z_entity.description = "Reviewlog" AND z_entity.zeid = comprises.zeid AND comprises.zaid = z_attribute.zaid AND z_attribute.name = "MREVIEW_K_BEGINN" AND comprises.compid = s_entity.compid AND s_entity.gid = game.gid AND game.gid = %game AND LOCATE(s_entity.path, \"%path\")=1 order by s_entity.tnid desc;', "**REVIEWLOGBUCH*Reviewlog*MREVIEW_K_BEGINN"); INSERT INTO query(qid,attribute,statement,z_path) VALUES (2021,"Beginn der Modultestkorrekturphase", 'select distinct s_entity.value from zarmstype,z_entity,z_attribute,comprises,s_entity,game,spaid_needs_zt,specific_aid where spaid_needs_zt.spaidid = specific_aid.spaidid AND spaid_needs_zt.zid = zarmstype.zid AND zarmstype.eorr = "E" AND zarmstype.z_type = "TESTLOGBUCH" AND zarmstype.zid = z_entity.zid AND z_entity.description = "Testlog" AND z_entity.zeid = comprises.zeid AND comprises.zaid = z_attribute.zaid AND z_attribute.name = "MTEST_K_BEGINN" AND comprises.compid = s_entity.compid AND s_entity.gid = game.gid AND game.gid = %game AND LOCATE(s_entity.path, \"%path\")=1 order by s_entity.tnid desc;', "**TESTLOGBUCH*Testlog*MTEST_K_BEGINN"); INSERT INTO query(qid,attribute,statement,z_path) VALUES (2022,"Beginn der Integrationstestkorrekturphase", 'select distinct s_entity.value from zarmstype,z_entity,z_attribute,comprises,s_entity,game,spaid_needs_zt,specific_aid where spaid_needs_zt.spaidid = specific_aid.spaidid AND spaid_needs_zt.zid = zarmstype.zid AND zarmstype.eorr = "E" AND zarmstype.z_type = "TESTLOGBUCH" AND zarmstype.zid = z_entity.zid AND z_entity.description = "Testlog" AND z_entity.zeid = comprises.zeid AND comprises.zaid = z_attribute.zaid AND z_attribute.name = "ITEST_K_BEGINN" AND comprises.compid = s_entity.compid AND s_entity.gid = game.gid AND game.gid = %game AND LOCATE(s_entity.path, \"%path\")=1 order by s_entity.tnid desc;', "**TESTLOGBUCH*Testlog*ITEST_K_BEGINN"); INSERT INTO query(qid,attribute,statement,z_path) VALUES (2023,"Beginn der Systemteskorrekturphase", 'select distinct s_entity.value from zarmstype,z_entity,z_attribute,comprises,s_entity,game,spaid_needs_zt,specific_aid where spaid_needs_zt.spaidid = specific_aid.spaidid AND spaid_needs_zt.zid = zarmstype.zid AND zarmstype.eorr = "E" AND zarmstype.z_type = "TESTLOGBUCH" AND zarmstype.zid = z_entity.zid AND z_entity.description = "Testlog" AND z_entity.zeid = comprises.zeid AND comprises.zaid = z_attribute.zaid AND z_attribute.name = "STEST_K_BEGINN" AND comprises.compid = s_entity.compid AND s_entity.gid = game.gid AND game.gid = %game AND LOCATE(s_entity.path, \"%path\")=1 order by s_entity.tnid desc;', "**TESTLOGBUCH*Testlog*STEST_K_BEGINN"); INSERT INTO query(qid,attribute,statement,z_path) VALUES (93,"Autor der Spezifikation", 'select DISTINCT s_relation.person from zarmstype,s_relation,game,specific_aid,spaid_needs_zt where spaid_needs_zt.spaidid = specific_aid.spaidid AND spaid_needs_zt.zid = zarmstype.zid AND zarmstype.eorr = "R" AND zarmstype.z_type = "PRODUZIERT" AND zarmstype.zid = s_relation.zid AND s_relation.document like "Spe%ifi%ation" AND s_relation.success = 1 AND s_relation.gid = game.gid AND game.gid = %game AND LOCATE(s_relation.path, \"%path\")=1;', "*PRODUZIERT*document=Spezifikation*success=1"); INSERT INTO query(qid,attribute,statement,z_path) VALUES (94,"Autor Systemdesign", 'select DISTINCT s_relation.person from zarmstype,s_relation,game,specific_aid,spaid_needs_zt where spaid_needs_zt.spaidid = specific_aid.spaidid AND spaid_needs_zt.zid = zarmstype.zid AND zarmstype.eorr = "R" AND zarmstype.z_type = "PRODUZIERT" AND zarmstype.zid = s_relation.zid AND s_relation.document = "Systemdesign" AND s_relation.success = 1 AND s_relation.gid = game.gid AND game.gid = %game AND LOCATE(s_relation.path, \"%path\")=1;', "*PRODUZIERT*document=Systemdesign*success=1"); INSERT INTO query(qid,attribute,statement,z_path) VALUES (95,"Autor Moduledesign", 'select DISTINCT s_relation.person from zarmstype,s_relation,game,specific_aid,spaid_needs_zt where spaid_needs_zt.spaidid = specific_aid.spaidid AND spaid_needs_zt.zid = zarmstype.zid AND zarmstype.eorr = "R" AND zarmstype.z_type = "PRODUZIERT" AND zarmstype.zid = s_relation.zid AND s_relation.document like "Modu%design" AND s_relation.success = 1 AND s_relation.gid = game.gid AND game.gid = %game AND LOCATE(s_relation.path, \"%path\")=1;', "*PRODUZIERT*document=Moduledesign*success=1"); INSERT INTO query(qid,attribute,statement,z_path) VALUES (96,"Autor Code", 'select DISTINCT s_relation.person from zarmstype,s_relation,game,specific_aid,spaid_needs_zt where spaid_needs_zt.spaidid = specific_aid.spaidid AND spaid_needs_zt.zid = zarmstype.zid AND zarmstype.eorr = "R" AND zarmstype.z_type = "PRODUZIERT" AND zarmstype.zid = s_relation.zid AND s_relation.document = "Code" AND s_relation.success = 1 AND s_relation.gid = game.gid AND game.gid = %game AND LOCATE(s_relation.path, \"%path\")=1;', "*PRODUZIERT*document=Code*success=1"); INSERT INTO query(qid,attribute,statement,z_path) VALUES (97,"Autor Handbuch", 'select DISTINCT s_relation.person from zarmstype,s_relation,game,specific_aid,spaid_needs_zt where spaid_needs_zt.spaidid = specific_aid.spaidid AND spaid_needs_zt.zid = zarmstype.zid AND zarmstype.eorr = "R" AND zarmstype.z_type = "PRODUZIERT" AND zarmstype.zid = s_relation.zid AND s_relation.document like "Manua%" AND s_relation.success = 1 AND s_relation.gid = game.gid AND game.gid = %game AND LOCATE(s_relation.path, \"%path\")=1;', "*PRODUZIERT*document=Manuals*success=1"); INSERT INTO rule (rlid,zort,basic_op,value_ref_point,text_ref_point) VALUES (12,'T','NOT IN',null,"Richard"); INSERT INTO rule (rlid,zort,basic_op,value_ref_point,text_ref_point) VALUES (14,'T','NOT IN',null,"Richard,Christine"); INSERT INTO rule (rlid,zort,basic_op,value_ref_point,text_ref_point) VALUES (16,'T','NOT IN',null,"Diana"); INSERT INTO rule (rlid,zort,basic_op,value_ref_point,text_ref_point) VALUES (18,'T','NOT IN',null,"Bernd");
true
d6461644b99d83a635eba403405fea43c4ffa0c5
SQL
mjoris/ws-ss-course-materials
/assets/07/examples/status.sql
UTF-8
857
2.875
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 3.2.0.1 -- http://www.phpmyadmin.net -- -- Host: localhost -- Generation Time: Dec 05, 2010 at 05:26 PM -- Server version: 5.1.37 -- PHP Version: 5.2.11 SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; -- -- Database: `status` -- DROP DATABASE IF EXISTS status; CREATE DATABASE status DEFAULT CHARACTER SET utf8mb4 DEFAULT COLLATE utf8mb4_unicode_ci; USE status; -- -------------------------------------------------------- -- -- Table structure for table `statuses` -- DROP TABLE IF EXISTS `statuses`; CREATE TABLE `statuses` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(40) NOT NULL, `status` varchar(160) NOT NULL, `datum` datetime NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARACTER SET utf8mb4 DEFAULT COLLATE utf8mb4_unicode_ci AUTO_INCREMENT=1 ; -- -- Dumping data for table `statuses` --
true
01f73a5ec7cb5788df79a89f35831530c3b4bdca
SQL
dwicahyo-dev/kiosk_pesantren
/kiosk_pesantren.sql
UTF-8
11,257
3
3
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
-- phpMyAdmin SQL Dump -- version 4.8.5 -- https://www.phpmyadmin.net/ -- -- Host: localhost -- Generation Time: Aug 13, 2019 at 01:34 PM -- Server version: 10.3.15-MariaDB -- PHP Version: 7.3.5 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET AUTOCOMMIT = 0; START TRANSACTION; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8mb4 */; -- -- Database: `kiosk_pesantren` -- -- -------------------------------------------------------- -- -- Table structure for table `admin` -- CREATE TABLE `admin` ( `id_admin` int(11) NOT NULL, `nama_admin` varchar(255) NOT NULL, `username` varchar(255) NOT NULL, `password` varchar(255) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `admin` -- INSERT INTO `admin` (`id_admin`, `nama_admin`, `username`, `password`) VALUES (1, 'Admin', 'admin', '21232f297a57a5a743894a0e4a801fc3'), (2, 'indah', 'indah', 'f3385c508ce54d577fd205a1b2ecdfb7'); -- -------------------------------------------------------- -- -- Table structure for table `animasi` -- CREATE TABLE `animasi` ( `id_animasi` int(11) NOT NULL, `id_admin` int(11) NOT NULL, `animasi` varchar(255) NOT NULL, `keterangan` varchar(255) NOT NULL, `tgl_posting` date NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `animasi` -- INSERT INTO `animasi` (`id_animasi`, `id_admin`, `animasi`, `keterangan`, `tgl_posting`) VALUES (1, 2, 'Skripsi_Indah2.swf', 'Cara Pendaftaran', '2019-08-07'); -- -------------------------------------------------------- -- -- Table structure for table `galeri` -- CREATE TABLE `galeri` ( `id_galeri` int(11) NOT NULL, `id_admin` int(11) NOT NULL, `foto_galeri` varchar(255) NOT NULL, `keterangan` text NOT NULL, `tgl_posting` date NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Table structure for table `gedung` -- CREATE TABLE `gedung` ( `id_gedung` int(11) NOT NULL, `id_admin` int(11) NOT NULL, `nama_gedung` varchar(255) NOT NULL, `foto_gedung` varchar(255) NOT NULL, `keterangan` text NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `gedung` -- INSERT INTO `gedung` (`id_gedung`, `id_admin`, `nama_gedung`, `foto_gedung`, `keterangan`) VALUES (9, 2, 'Gerbang Utama Putra', 'Gerbang_Putra.png', 'Gerbang Putra Berada Didepan Masjid Sebelah kiri'), (10, 2, 'gerbang Utama Putri', 'banner10.jpg', 'Gerbang Utama Putri Berada Di Sebelah Kanan Masjid'), (11, 2, 'Masjid', 'masjid.jpg', 'Masjid Terletak Di Belakang Gerbang Putra'), (12, 2, 'Aula Putra', 'aula_pp.jpg', 'aula putra berada di lantai 2'), (13, 2, 'aula putri', 'aula.jpg', 'aula putri berada di lantai 2 sebelah kanan'), (14, 2, 'kantor', 'aula_putra.jpg', 'berada di samping dhalem pa kyai'), (15, 2, 'tempat belajar kitab', 'TempatBelajar_kitab.jpg', 'Tempat belajar al-khitab para santri'), (16, 2, 'koperasi', 'koprasi.jpg', 'berada di belakang masjid'), (17, 2, 'Dhalem Pak Kyai', '20171029_090847.jpg', 'berada di samping masjid'); -- -------------------------------------------------------- -- -- Table structure for table `jabatan_pengurus` -- CREATE TABLE `jabatan_pengurus` ( `id_jabatan_pengurus` int(11) NOT NULL, `nama_jabatan` varchar(255) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `jabatan_pengurus` -- INSERT INTO `jabatan_pengurus` (`id_jabatan_pengurus`, `nama_jabatan`) VALUES (1, 'Guru Ngaji'), (2, 'Guru kitab'), (4, 'Ketua'), (5, 'pengurus administrasi'), (6, 'Guru Fiqih'), (7, 'pengurus putri'), (8, 'pengurus putra'); -- -------------------------------------------------------- -- -- Table structure for table `kegiatan` -- CREATE TABLE `kegiatan` ( `id_kegiatan` int(11) NOT NULL, `id_admin` int(11) NOT NULL, `nama_kegiatan` varchar(255) NOT NULL, `jam` datetime NOT NULL, `tempat` text NOT NULL, `foto_kegiatan` varchar(255) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `kegiatan` -- INSERT INTO `kegiatan` (`id_kegiatan`, `id_admin`, `nama_kegiatan`, `jam`, `tempat`, `foto_kegiatan`) VALUES (1, 2, 'Ngaji Kitab', '2019-08-07 15:41:00', 'masjid', 'asy_syifaa.jpg'); -- -------------------------------------------------------- -- -- Table structure for table `pengurus` -- CREATE TABLE `pengurus` ( `id_pengurus` int(11) NOT NULL, `nama_pengurus` varchar(255) NOT NULL, `foto_pengurus` varchar(255) NOT NULL, `no_telepon` varchar(255) NOT NULL, `jenis_kelamin` enum('L','P') NOT NULL, `id_jabatan_pengurus` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `pengurus` -- INSERT INTO `pengurus` (`id_pengurus`, `nama_pengurus`, `foto_pengurus`, `no_telepon`, `jenis_kelamin`, `id_jabatan_pengurus`) VALUES (1, 'zahro maimunah', 'zahro_mainunah_santri.jpg', 'tidak ada', 'P', 7), (4, 'Ustd kholil Ridwan', 'ketua.jpg', '081326822455', 'L', 4), (5, 'eva khotamis', 'guru_2.png', 'tidak ada', 'P', 1), (6, 'amilya ningsih', 'guru_1.png', 'tidak ada', 'P', 5), (7, 'Nur Shoim', 'guru_6.png', 'tidak ada', 'L', 6), (8, 'zainal abidin', 'guru_7.png', 'tidak ada', 'L', 8), (9, 'saiful anwar', 'guru_5.png', 'tidak ada', 'L', 2); -- -------------------------------------------------------- -- -- Table structure for table `profil` -- CREATE TABLE `profil` ( `id_profil` int(11) NOT NULL, `id_admin` int(11) NOT NULL, `nama` varchar(255) NOT NULL, `logo` varchar(255) NOT NULL, `visi` text NOT NULL, `misi` text NOT NULL, `alamat` text NOT NULL, `email` varchar(255) NOT NULL, `no_telepon` varchar(255) NOT NULL, `kode_pos` varchar(255) NOT NULL, `foto_struktur_organisasi` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `profil` -- INSERT INTO `profil` (`id_profil`, `id_admin`, `nama`, `logo`, `visi`, `misi`, `alamat`, `email`, `no_telepon`, `kode_pos`, `foto_struktur_organisasi`) VALUES (1, 2, 'Pondok Pesantren Asy_Syifaa Kajen', 'logo21.jpg', 'aa', 'bb', 'nyamok', 'ponpes.asysyifakajen@gmail.com', '081326822455', '51161', 'struktur1.jpg'); -- -------------------------------------------------------- -- -- Table structure for table `santri` -- CREATE TABLE `santri` ( `id_santri` int(11) NOT NULL, `foto` varchar(255) NOT NULL, `nama_santri` varchar(255) NOT NULL, `tgl_lahir` date NOT NULL, `jenis_kelamin` enum('L','P') NOT NULL, `alamat` text NOT NULL, `nama_bapak` varchar(255) NOT NULL, `nama_ibu` varchar(255) NOT NULL, `status` varchar(255) NOT NULL, `tgl_masuk` date NOT NULL, `id_admin` int(11) NOT NULL, `id_pengurus_pengajar` int(11) NOT NULL, `nama_gedung` enum('Aula Putra','Aula Putri') NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `santri` -- INSERT INTO `santri` (`id_santri`, `foto`, `nama_santri`, `tgl_lahir`, `jenis_kelamin`, `alamat`, `nama_bapak`, `nama_ibu`, `status`, `tgl_masuk`, `id_admin`, `id_pengurus_pengajar`, `nama_gedung`) VALUES (1, '1.png', 'zainur Rohibah', '2000-07-19', 'P', 'kajen', 'raadi', 'sukarsih', 'belum menikah', '2019-08-14', 1, 1, 'Aula Putri'); -- -- Indexes for dumped tables -- -- -- Indexes for table `admin` -- ALTER TABLE `admin` ADD PRIMARY KEY (`id_admin`); -- -- Indexes for table `animasi` -- ALTER TABLE `animasi` ADD PRIMARY KEY (`id_animasi`), ADD KEY `id_admin` (`id_admin`); -- -- Indexes for table `galeri` -- ALTER TABLE `galeri` ADD PRIMARY KEY (`id_galeri`), ADD KEY `id_admin` (`id_admin`); -- -- Indexes for table `gedung` -- ALTER TABLE `gedung` ADD PRIMARY KEY (`id_gedung`), ADD KEY `id_admin` (`id_admin`); -- -- Indexes for table `jabatan_pengurus` -- ALTER TABLE `jabatan_pengurus` ADD PRIMARY KEY (`id_jabatan_pengurus`); -- -- Indexes for table `kegiatan` -- ALTER TABLE `kegiatan` ADD PRIMARY KEY (`id_kegiatan`), ADD KEY `id_admin` (`id_admin`); -- -- Indexes for table `pengurus` -- ALTER TABLE `pengurus` ADD PRIMARY KEY (`id_pengurus`), ADD KEY `id_jabatan_pengurus` (`id_jabatan_pengurus`); -- -- Indexes for table `profil` -- ALTER TABLE `profil` ADD PRIMARY KEY (`id_profil`), ADD KEY `id_admin` (`id_admin`); -- -- Indexes for table `santri` -- ALTER TABLE `santri` ADD PRIMARY KEY (`id_santri`), ADD KEY `id_admin` (`id_admin`), ADD KEY `id_pengurus_pengajar` (`id_pengurus_pengajar`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `admin` -- ALTER TABLE `admin` MODIFY `id_admin` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3; -- -- AUTO_INCREMENT for table `animasi` -- ALTER TABLE `animasi` MODIFY `id_animasi` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; -- -- AUTO_INCREMENT for table `galeri` -- ALTER TABLE `galeri` MODIFY `id_galeri` int(11) NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `gedung` -- ALTER TABLE `gedung` MODIFY `id_gedung` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=19; -- -- AUTO_INCREMENT for table `jabatan_pengurus` -- ALTER TABLE `jabatan_pengurus` MODIFY `id_jabatan_pengurus` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9; -- -- AUTO_INCREMENT for table `kegiatan` -- ALTER TABLE `kegiatan` MODIFY `id_kegiatan` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; -- -- AUTO_INCREMENT for table `pengurus` -- ALTER TABLE `pengurus` MODIFY `id_pengurus` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10; -- -- AUTO_INCREMENT for table `profil` -- ALTER TABLE `profil` MODIFY `id_profil` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; -- -- AUTO_INCREMENT for table `santri` -- ALTER TABLE `santri` MODIFY `id_santri` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; -- -- Constraints for dumped tables -- -- -- Constraints for table `animasi` -- ALTER TABLE `animasi` ADD CONSTRAINT `animasi_ibfk_1` FOREIGN KEY (`id_admin`) REFERENCES `admin` (`id_admin`); -- -- Constraints for table `galeri` -- ALTER TABLE `galeri` ADD CONSTRAINT `galeri_ibfk_1` FOREIGN KEY (`id_admin`) REFERENCES `admin` (`id_admin`); -- -- Constraints for table `gedung` -- ALTER TABLE `gedung` ADD CONSTRAINT `gedung_ibfk_1` FOREIGN KEY (`id_admin`) REFERENCES `admin` (`id_admin`); -- -- Constraints for table `kegiatan` -- ALTER TABLE `kegiatan` ADD CONSTRAINT `kegiatan_ibfk_1` FOREIGN KEY (`id_admin`) REFERENCES `admin` (`id_admin`); -- -- Constraints for table `pengurus` -- ALTER TABLE `pengurus` ADD CONSTRAINT `pengurus_ibfk_1` FOREIGN KEY (`id_jabatan_pengurus`) REFERENCES `jabatan_pengurus` (`id_jabatan_pengurus`) ON DELETE CASCADE ON UPDATE CASCADE; -- -- Constraints for table `profil` -- ALTER TABLE `profil` ADD CONSTRAINT `profil_ibfk_1` FOREIGN KEY (`id_admin`) REFERENCES `admin` (`id_admin`) ON DELETE CASCADE ON UPDATE CASCADE; -- -- Constraints for table `santri` -- ALTER TABLE `santri` ADD CONSTRAINT `santri_ibfk_1` FOREIGN KEY (`id_admin`) REFERENCES `admin` (`id_admin`), ADD CONSTRAINT `santri_ibfk_2` FOREIGN KEY (`id_pengurus_pengajar`) REFERENCES `pengurus` (`id_pengurus`); 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
c4b4c0d15d61777bce8b83cffc06f16b91f90e81
SQL
stevemendozajr/sql-scripts
/SakilaHomeworkStephen.sql
UTF-8
3,878
4.1875
4
[]
no_license
-- use database USE sakila; -- la SELECT first_name, last_name FROM actor; -- 1b SELECT concat(first_name,' ',last_name) AS Actor FROM actor; -- 2a SELECT * FROM actor WHERE first_name='Joe'; -- 2b SELECT * FROM actor WHERE last_name LIKE '%GEN%'; -- 2c SELECT * FROM actor WHERE last_name LIKE '%LI%' ORDER BY last_name,first_name ASC; -- 2d SELECT country_id,country FROM country WHERE country IN ('Afghanistan', 'Bangladesh', 'China'); -- 3a ALTER TABLE actor ADD description BLOB; -- 3b ALTER TABLE actor DROP COLUMN description; -- 4a SELECT last_name, COUNT(last_name) AS 'num of actors' FROM actor GROUP BY last_name; -- 4b SELECT last_name, COUNT(last_name) AS 'num of actors' FROM actor GROUP BY last_name HAVING COUNT(last_name) > 1; -- 4c SELECT * FROM actor WHERE last_name = 'Williams'; UPDATE actor SET first_name = 'HARPO' WHERE actor_id=172; -- 4d UPDATE actor SET first_name = 'GROUCHO' WHERE actor_id=172; -- 5a SHOW CREATE TABLE address; -- 6a SELECT s.first_name,s.last_name,a.address FROM staff s JOIN address a ON s.address_id=a.address_id; -- 6b SELECT s.first_name,s.staff_id, SUM(p.amount) AS 'total amount rung' FROM staff s JOIN payment p ON s.staff_id=p.staff_id WHERE payment_date LIKE '2005-08%' GROUP BY s.staff_id; -- 6c SELECT f.title,COUNT(fa.actor_id) AS 'number of actors' FROM film_actor fa INNER JOIN film f ON f.film_id=fa.film_id GROUP BY f.title; -- 6d SELECT f.title,COUNT(i.inventory_id) AS 'number of copies' FROM film f INNER JOIN inventory i ON f.film_id=i.film_id WHERE f.title = 'Hunchback Impossible'; -- 6e SELECT c.first_name,c.last_name,SUM(p.amount) AS 'total amount paid' FROM customer c JOIN payment p ON c.customer_id=p.customer_id GROUP BY c.first_name, c.last_name ORDER BY c.last_name ASC; -- 7a SELECT title FROM film WHERE language_id IN ( SELECT language_id FROM language WHERE name = 'English' ); -- 7b SELECT first_name,last_name FROM actor WHERE actor_id IN ( SELECT actor_id FROM film_actor WHERE film_id IN ( SELECT film_id FROM film WHERE title = 'Alone Trip' ) ); -- 7c SELECT first_name,last_name,email FROM customer c INNER JOIN customer_list cl ON c.customer_id=cl.ID WHERE cl.country = 'Canada'; -- 7d SELECT title FROM film WHERE film_id IN ( SELECT film_id FROM film_category WHERE category_id IN ( SELECT category_id FROM category WHERE name = 'Family' ) ); -- 7e SELECT f.title, COUNT(r.rental_id) AS 'Total Times Rented' FROM rental r JOIN inventory i ON (r.inventory_id = i.inventory_id) JOIN film f ON (i.film_id = f.film_id) GROUP BY f.title ORDER BY COUNT(r.rental_id) DESC; -- 7f SELECT s.store_id, SUM(amount) AS Gross FROM payment p JOIN rental r ON (p.rental_id = r.rental_id) JOIN inventory i ON (i.inventory_id = r.inventory_id) JOIN store s ON (s.store_id = i.store_id) GROUP BY s.store_id; -- 7g SELECT s.store_id,c.city,co.country FROM store s JOIN address a ON (s.address_id=a.address_id) JOIN city c ON (c.city_id=a.city_id) JOIN country co ON (co.country_id=c.country_id); -- 7h SELECT ca.name,SUM(p.amount) AS 'Gross Revenue' FROM category ca JOIN film_category fc ON (fc.category_id=ca.category_id) JOIN inventory i ON (i.film_id=fc.film_id) JOIN rental r ON (r.inventory_id=i.inventory_id) JOIN payment p ON (p.rental_id=r.rental_id) GROUP BY ca.name ORDER BY SUM(p.amount) DESC LIMIT 5; -- 8a CREATE VIEW v_top_5_genre_gross_rev AS SELECT ca.name,SUM(p.amount) AS 'Gross Revenue' FROM category ca JOIN film_category fc ON (fc.category_id=ca.category_id) JOIN inventory i ON (i.film_id=fc.film_id) JOIN rental r ON (r.inventory_id=i.inventory_id) JOIN payment p ON (p.rental_id=r.rental_id) GROUP BY ca.name ORDER BY SUM(p.amount) DESC LIMIT 5; -- 8b select * from v_top_5_genre_gross_rev; -- 8c DROP VIEW v_top_5_genre_gross_rev;
true
13d8b5e152508cc92f967a2d75629d3254a65d84
SQL
AbdurRoufBD/Travel-Agency-Web-App
/Travel-Mate-project-database.sql
UTF-8
28,223
3.15625
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 4.8.4 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Generation Time: Sep 26, 2019 at 10:58 AM -- Server version: 10.1.37-MariaDB -- PHP Version: 7.3.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: `travelmatedb` -- -- -------------------------------------------------------- -- -- Table structure for table `attatchment` -- CREATE TABLE `attatchment` ( `aid` int(11) NOT NULL, `attatchment_number` int(11) NOT NULL, `attatchment` varchar(300) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Table structure for table `attatchments` -- CREATE TABLE `attatchments` ( `aid` int(11) NOT NULL, `total_attatchments` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `attatchments` -- INSERT INTO `attatchments` (`aid`, `total_attatchments`) VALUES (1, 5), (2, 10); -- -------------------------------------------------------- -- -- Table structure for table `bookings` -- CREATE TABLE `bookings` ( `booking_id` int(11) NOT NULL, `current_time_stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `prvds_id` int(11) DEFAULT NULL, `quantity` int(11) DEFAULT NULL, `service_date` datetime DEFAULT NULL, `auth_id` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `bookings` -- INSERT INTO `bookings` (`booking_id`, `current_time_stamp`, `prvds_id`, `quantity`, `service_date`, `auth_id`) VALUES (3, '2019-09-18 09:56:33', 12, 4, '2019-09-30 00:00:00', 29), (5, '2019-09-18 12:22:07', 6, 3, '2019-09-25 00:00:00', 55); -- -------------------------------------------------------- -- -- Table structure for table `company` -- CREATE TABLE `company` ( `cmpn_id` int(11) NOT NULL, `cmpn_name` varchar(500) CHARACTER SET utf8 NOT NULL, `description` varchar(1000) CHARACTER SET utf8 NOT NULL, `e_mail` varchar(500) NOT NULL, `address` varchar(300) CHARACTER SET utf8 NOT NULL, `location_id` int(11) NOT NULL, `contact_number` varchar(15) NOT NULL, `aid` int(11) DEFAULT NULL, `file_name` varchar(200) NOT NULL DEFAULT 'defaultplace.jpg', `auth_id` int(11) DEFAULT NULL, `enable_access` tinyint(1) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `company` -- INSERT INTO `company` (`cmpn_id`, `cmpn_name`, `description`, `e_mail`, `address`, `location_id`, `contact_number`, `aid`, `file_name`, `auth_id`, `enable_access`) VALUES (5, 'TravelMate-Chittagong-Bandarban', 'TravelMate-Bandarban-Keokradong', 'travelmate.Chittagong@gmail.com', 'Chittagong', 10, '123456', 1, 'defaultplace.jpg', NULL, NULL), (6, 'TravelMate-Chittagong-Khagrachari', 'TravelMate-Khagrachari-Sajek Valley', 'travelmate.Chittagong@gmail.com', 'Chittagong', 10, '123456', 1, 'defaultplace.jpg', NULL, NULL), (7, 'TravelMate-North Sikkim-Lachung', 'TravelMate-Lachung-Yamthung Valley Zero Point', 'travelmate.North Sikkim@gmail.com', 'North Sikkim', 12, '123456', 1, 'defaultplace.jpg', NULL, NULL), (8, 'TravelMate-Dhaka-Mirpur-1', 'TravelMate-Mirpur-1-National Zoo & Botanical Graden', 'travelmate.Dhaka@gmail.com', 'Dhaka', 13, '123456', 1, 'defaultplace.jpg', NULL, NULL), (10, 'Meghpunji Resort', 'It\'s close to sky', 'megh@gmail.com', 'Ruilui para,106/2', 11, '01515269628', 1, 'defaultplace.jpg', 30, NULL), (11, 'Megh Bala', '5 resort , close to sky', 'meghbala@gmail.com', 'House#05,Keokradong', 10, '01515269682', 1, '1566052180.jpg', 38, NULL), (12, 'Meghalaya resort', 'We provide room,car and guide also', 'meghalaya@gmail.com', 'House#05,Keokradong', 10, '998989', 1, '1563173399.jpg', 41, NULL), (13, 'Hakuna Matata barvo', 'It means no worries', 'hama@gmail.com', 'Homeless', 12, '2121212', 1, '1564391645.jpg', 50, NULL), (14, 'Nation Zoo', '########', 'zoo@gmail.com', 'Mirpur-1', 13, '2121212', 1, '1566757362.jpg', 52, NULL); -- -------------------------------------------------------- -- -- Table structure for table `customers` -- CREATE TABLE `customers` ( `customer_id` int(11) NOT NULL, `name` varchar(32) CHARACTER SET utf8 NOT NULL, `email` varchar(32) NOT NULL, `contact_number` varchar(32) DEFAULT NULL, `auth_id` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `customers` -- INSERT INTO `customers` (`customer_id`, `name`, `email`, `contact_number`, `auth_id`) VALUES (9, 'Aditya', 'abc@gmail.com', '0152365895', 29), (10, 'Somudro', 'abcd@gmail.com', '0123654789', 45), (11, 'Rouf', 'abcde@gmail.com', '01515269628', 46), (12, 'Abu Yousuf Siam', 'ysiam@gmail.com', '01632071134', 51), (13, 'Rouf', 'rouf@gmail.com', '01515269628', 53), (14, 'AbdurRouf', 'arouf@gmail.com', '015XXXXXXXX', 54), (15, 'Swarna Khan', 'swarna@gmail.com', '01778022441', 55); -- -------------------------------------------------------- -- -- Table structure for table `employees` -- CREATE TABLE `employees` ( `employee_id` int(11) NOT NULL, `name` varchar(32) CHARACTER SET utf8 NOT NULL, `email` varchar(32) NOT NULL, `contact_number` varchar(32) NOT NULL, `birth_date` date NOT NULL, `pos_id` int(11) NOT NULL, `address` varchar(300) CHARACTER SET utf8 DEFAULT NULL, `join_date` date NOT NULL, `aid` int(11) DEFAULT NULL, `auth_id` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `employees` -- INSERT INTO `employees` (`employee_id`, `name`, `email`, `contact_number`, `birth_date`, `pos_id`, `address`, `join_date`, `aid`, `auth_id`) VALUES (1, 'Wadud Madhuri', 'wadud@gmail.com', '0123658974', '2019-07-06', 5, 'North,Sikkim', '2019-07-19', 1, 26), (2, 'Mohammad Salah', 'mosalahemployee@gmail.com', '01523568945', '2019-07-16', 5, 'House#3', '2019-07-13', 1, 27), (3, 'Lionel Messi', 'messi@gmail.com', '0125478963', '2019-07-20', 6, 'House#05,Spain', '2019-07-13', 1, 28), (4, 'waqar', 'waqar@gmail.com', '01523658965', '2019-07-25', 5, 'Townhall,Dhaka', '2019-07-11', 1, 31), (5, 'Tameem', 'tameememployee@gmail.com', '01515269632', '2019-07-20', 5, 'House#01', '2019-07-17', 1, 32), (6, 'Imran', 'imranemployee@gmail.com', '01515236589', '2019-07-04', 6, 'House#03', '2019-07-24', 1, 33), (7, 'Saleh Ahmed', 'saleh@gmail.com', '01526968547', '2019-07-20', 5, 'House#01,MG-MARG,Sikkim', '2019-07-24', 1, 39), (8, 'Lui Ie Khan', 'lui@gmail.com', '0214325659', '2019-07-02', 5, 'House#06,Sikkim', '2019-07-26', 1, 47), (9, 'Dopa Khan', 'dopa@gmail.com', '0123654789', '2019-07-12', 4, 'House#0', '2019-08-03', 1, 48), (10, 'Hakuna Matata', 'hm@gmail.com', '01234567890', '2019-07-08', 6, 'ss', '2019-07-17', 1, 49); -- -------------------------------------------------------- -- -- Table structure for table `locations` -- CREATE TABLE `locations` ( `location_id` int(11) NOT NULL, `city` varchar(100) CHARACTER SET utf8 NOT NULL, `district` varchar(100) CHARACTER SET utf8 NOT NULL, `location` varchar(100) CHARACTER SET utf8 NOT NULL, `aid` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `locations` -- INSERT INTO `locations` (`location_id`, `city`, `district`, `location`, `aid`) VALUES (10, 'Chittagong', 'Bandarban', 'Keokradong', 1), (11, 'Chittagong', 'Khagrachari', 'Sajek Valley', 1), (12, 'North Sikkim', 'Lachung', 'Yamthung', 1), (13, 'Dhaka', 'Mirpur-1', 'National Zoo', 1); -- -------------------------------------------------------- -- -- Table structure for table `migrations` -- CREATE TABLE `migrations` ( `id` int(10) UNSIGNED NOT NULL, `migration` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, `batch` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `migrations` -- INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (1, '2014_10_12_000000_create_users_table', 1), (2, '2014_10_12_100000_create_password_resets_table', 1); -- -------------------------------------------------------- -- -- Table structure for table `packages` -- CREATE TABLE `packages` ( `pkg_id` int(11) NOT NULL, `name` varchar(100) CHARACTER SET utf8 NOT NULL, `cost` decimal(5,2) DEFAULT NULL, `tour_plan` varchar(1000) CHARACTER SET utf8 DEFAULT NULL, `location_id` int(11) NOT NULL, `aid` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Table structure for table `password_resets` -- CREATE TABLE `password_resets` ( `email` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, `token` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, `created_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `password_resets` -- INSERT INTO `password_resets` (`email`, `token`, `created_at`) VALUES ('abdurroufsheikh185@gmail.com', '$2y$10$3Xn6jVmdssvSNKHRYwAIRe5LEWz7AJyXE7eNJuWLSvTk5SnOjn7rG', '2019-06-23 22:55:46'); -- -------------------------------------------------------- -- -- Table structure for table `pending_verfication` -- CREATE TABLE `pending_verfication` ( `self_id` int(11) NOT NULL, `reffered_id` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Table structure for table `provided_service` -- CREATE TABLE `provided_service` ( `prvds_id` int(11) NOT NULL, `cmpn_id` int(11) NOT NULL, `name` varchar(100) CHARACTER SET utf8 NOT NULL, `quantity` int(11) DEFAULT '0', `description` varchar(300) CHARACTER SET utf8 DEFAULT NULL, `cost` decimal(5,2) DEFAULT NULL, `file_name` varchar(200) DEFAULT NULL, `discount` double DEFAULT NULL, `location_id` int(11) DEFAULT NULL, `auth_id` int(11) NOT NULL, `service_type` varchar(200) NOT NULL, `service_enable_bit` tinyint(1) DEFAULT '0' ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `provided_service` -- INSERT INTO `provided_service` (`prvds_id`, `cmpn_id`, `name`, `quantity`, `description`, `cost`, `file_name`, `discount`, `location_id`, `auth_id`, `service_type`, `service_enable_bit`) VALUES (3, 10, 'Cottage', 10, 'One balcony', '115.00', '1563172676.jpg', 5, 11, 30, 'Jeep & Guide', 1), (4, 12, 'Open Cottage', 12, '5 resort , close to sky', '20.00', '1563173435.jpg', 25, 10, 41, 'Jeep & Guide', 1), (6, 10, 'Peda tingting', 20, 'Fresh food,belcony', '50.00', '1568809179.jpg', 5, 11, 30, 'All', 1), (7, 10, 'Fibolok', 3, 'It\'s close to sky', '120.00', 'defaultplace.jpg', 30, 11, 30, 'Room Rent', 1), (8, 12, 'Machang Hut', 5, 'Cottage is built on pond.', '20.00', '1563776592.jpg', 10, 10, 41, 'Room Rent', 1), (9, 12, 'Single Cottage', 2, 'In the middle of lake and hill', '20.00', '1563776709.jpg', 25, 10, 41, 'Room Rent', 1), (10, 12, 'DingDong Hut', 3, 'Close to BogaLake', '20.00', '1563776768.jpg', 5, 10, 41, 'Room Rent', 1), (12, 14, 'Jeep Service', 20, 'from anywhere inside dhaka to zoo', '20.00', '1566757411.jpg', 5, 13, 52, 'Jeep Rent', 1); -- -------------------------------------------------------- -- -- Table structure for table `ranks` -- CREATE TABLE `ranks` ( `pos_id` int(11) NOT NULL, `pos_name` varchar(64) DEFAULT NULL, `basic_salary` decimal(7,2) DEFAULT NULL, `role` varchar(100) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `ranks` -- INSERT INTO `ranks` (`pos_id`, `pos_name`, `basic_salary`, `role`) VALUES (1, 'hotel_manager', '50000.00', 'service_provider'), (2, 'tour_guide', '15000.00', 'service_provider'), (3, 'driver', '25000.00', 'service_provider'), (4, 'customer_service_officer', '35000.00', 'employee'), (5, 'marketing_officer', '40000.00', 'employee'), (6, 'adviser', '70000.00', 'employee'); -- -------------------------------------------------------- -- -- Table structure for table `rating` -- CREATE TABLE `rating` ( `rate_id` int(11) NOT NULL, `prvds_id` int(11) DEFAULT NULL, `auth_id` int(11) DEFAULT NULL, `star` double DEFAULT NULL, `comment` varchar(1000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `rating` -- INSERT INTO `rating` (`rate_id`, `prvds_id`, `auth_id`, `star`, `comment`) VALUES (4, 3, 29, 3, '3 Star is much'), (5, 3, 45, 5, 'So far best place and best service I have ever seen. Best wishes for their further success.'), (6, 4, 45, 1, 'Baje'), (8, 7, 29, 2, 'lklklkl'), (9, 8, 29, 4, 'Satisfactory so far.. But their is some side to be improved'), (10, 3, 46, 1, 'It\'s Over rated so far'), (11, 4, 46, 4, 'So far underrated'), (12, 6, 46, 5, 'walla , this is good af'), (13, 6, 29, 4, 'Asen asen ase jan'), (14, 9, 29, 3, 'Muhahahahahhahahahahahahahahhahahahaha'); -- -------------------------------------------------------- -- -- Table structure for table `services` -- CREATE TABLE `services` ( `srvs_id` int(11) NOT NULL, `sp_id` int(11) NOT NULL, `cmpn_id` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Table structure for table `service_providers` -- CREATE TABLE `service_providers` ( `sp_id` int(11) NOT NULL, `name` varchar(32) CHARACTER SET utf8 NOT NULL, `email` varchar(32) NOT NULL, `contact_number` varchar(15) DEFAULT NULL, `birth_date` date DEFAULT NULL, `pos_id` int(11) NOT NULL, `address` varchar(300) CHARACTER SET utf8 NOT NULL, `aid` int(11) DEFAULT NULL, `auth_id` int(11) NOT NULL, `verified` int(11) NOT NULL DEFAULT '0' ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `service_providers` -- INSERT INTO `service_providers` (`sp_id`, `name`, `email`, `contact_number`, `birth_date`, `pos_id`, `address`, `aid`, `auth_id`, `verified`) VALUES (1, 'Naser Anjum', 'naser@gmail.com', '015152369875', '2019-07-10', 2, 'House#05', 1, 25, 0), (2, 'Abdul Alim', 'alim@gmail.com', '01526369845', '2019-08-24', 1, 'House#03', 1, 30, 1), (3, 'Nihad', 'nihadsp@gmail.com', '0123654789', '2019-07-26', 2, 'House#033', 1, 34, 1), (4, 'sadat', 'sadatsp@gmail.com', '01515269682', '2018-06-02', 2, 'House#05', 1, 35, 0), (5, 'Imran', 'imransp@gmail.com', '01515247485', '2019-07-30', 1, 'House#104', 1, 36, 0), (6, 'brinto bota', 'bota@gmail.com', '01515247412', '2019-07-06', 3, 'House#01,Northsikkim', 1, 37, 0), (7, 'Shabuj Sharker', 'ssp@gmail.com', '01758867898', '2017-07-06', 1, 'House#05,Keokradong', 1, 38, 1), (8, 'Siam', 'siam@gmail.com', '0123654789', '2019-07-11', 1, 'House#02,Sikkim', 1, 40, 0), (9, 'Aditya Larma', 'a@gmail.com', '0147896523', '2019-08-15', 1, 'House#05,Keokradong', 1, 41, 0), (10, 'Sobuj sarker', 'ss@gmail.com', '01515235689', '2019-07-06', 3, 'House#01,Block#A,North Sikkim', 1, 42, 0), (11, 'Abu Twasif', 'abu@gmail.com', '012345678945', '1982-06-17', 1, 'Home -1234', 1, 43, 0), (12, 'Ronaldo de caprio', 'ronaldo@gmail.com', '012345678912', '2010-02-22', 2, 'Home sweet home', 1, 44, 0), (13, 'Hakuna Matata', 'hmm@gmail.com', '0123654789', '2019-06-30', 2, 'House#02,Bandarban', 1, 50, 0), (14, 'Nasim Ahmed', 'nasim@gmail.com', '01523665456', '2019-08-24', 1, 'Dhaka', 1, 52, 0); -- -------------------------------------------------------- -- -- Table structure for table `service_types` -- CREATE TABLE `service_types` ( `svtp_id` int(11) NOT NULL, `name` varchar(100) CHARACTER SET utf8 NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Table structure for table `users` -- CREATE TABLE `users` ( `id` bigint(20) UNSIGNED NOT NULL, `name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, `email` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, `email_verified_at` timestamp NULL DEFAULT NULL, `password` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, `remember_token` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL, `role` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT 'customer', `enable_access` tinyint(1) DEFAULT NULL, `file_name` varchar(500) COLLATE utf8mb4_unicode_ci DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `users` -- INSERT INTO `users` (`id`, `name`, `email`, `email_verified_at`, `password`, `remember_token`, `created_at`, `updated_at`, `role`, `enable_access`, `file_name`) VALUES (1, 'Admininstration', 'admin@gmail.com', NULL, '$2y$10$FUIB1Le/DX6En5q4vasvduRPEaSDC963e4V4BNMgQuoHnHRudXj0W', 'jwmNijN0GhczkHb3zuQ26tRMLgMi9GXf1CFZFc07DUhwHbcL5uiw0449layD', '2019-06-23 22:43:02', '2019-06-23 22:43:02', 'admin', 1, NULL), (25, 'Naser Anjum', 'naser@gmail.com', NULL, '$2y$10$zKAVqYtCRGOpbDSiYUjgLeSpUFeR26aV/YbNrVy6ST0g.S2Zd0qRq', NULL, '2019-06-30 08:21:29', '2019-06-30 08:21:29', 'service_provider', 1, NULL), (26, 'Wadud Madhuri', 'wadud@gmail.com', NULL, '$2y$10$jTkqU8k38QBFDyHVI5ujgesC/vra8UmqizpUchrZdiadE5KeKaiFm', NULL, '2019-06-30 13:12:19', '2019-06-30 13:12:19', 'employee', 1, '1563113628.jpg'), (27, 'Mohammad Salah', 'mosalahemployee@gmail.com', NULL, '$2y$10$c2DCcaakT0y1NUEh6UDtPOilnl/YGT6axS5hyMuvcgjObonlTnoMu', NULL, '2019-06-30 15:24:41', '2019-06-30 15:24:41', 'employee', 1, NULL), (28, 'Lionel Messi', 'messi@gmail.com', NULL, '$2y$10$k6tYuwiX4YaVyRRqgt5GR.jS4Vsb4JE2bPbV2iruFZY6CXQ87hgbq', NULL, '2019-06-30 16:07:08', '2019-06-30 16:07:08', 'employee', 1, NULL), (29, 'Aditya', 'abc@gmail.com', NULL, '$2y$10$Wm1Ibxv0SfBkE8yksEWuXum9TudRHqaBD0QGMwMGAa8.mACdsKTCe', NULL, '2019-07-01 00:40:01', '2019-07-01 00:40:01', 'customer', 1, '1563775039.jpg'), (30, 'Abdul Alim', 'alim@gmail.com', NULL, '$2y$10$PD0RaJjjpyW3PTWJApQGcuLO6OwyXPCFY4fk1N2duo5M87iMYFvxu', NULL, '2019-07-01 01:17:22', '2019-07-01 01:17:22', 'service_provider', 1, '1566756908.jpg'), (31, 'waqar', 'waqar@gmail.com', NULL, '$2y$10$oEW0oTUT8Egk0w7X1f23L.skpj9TaqvFAnbOOKU0r/KP9GTBeg0kO', NULL, '2019-07-01 01:22:20', '2019-07-01 01:22:20', 'employee', 1, '1562507741.jpg'), (32, 'Tameem', 'tameememployee@gmail.com', NULL, '$2y$10$.ji6gINExt3OrszAlSLx7.1MsEaIiy.tGWLJF1mJ96bu0TDq1JOTi', NULL, '2019-07-01 02:49:18', '2019-07-01 02:49:18', 'employee', 1, NULL), (33, 'Imran', 'imranemployee@gmail.com', NULL, '$2y$10$XsZEnnUR/LRJM45sTE77/.v7IGEKWJlYwKeSHfQ3.tjl7Y7dcmsRK', NULL, '2019-07-01 02:52:18', '2019-07-01 02:52:18', 'employee', 1, NULL), (34, 'Nihad', 'nihadsp@gmail.com', NULL, '$2y$10$bGomeQcxoOfgG5cWIsSMqu2a072ymN863NULux2cYuDovfYd0cXme', NULL, '2019-07-01 02:53:56', '2019-07-01 02:53:56', 'service_provider', 1, NULL), (35, 'sadat', 'sadatsp@gmail.com', NULL, '$2y$10$VYMT6/ExEqJq4cOBhOdSb.s5BnnAfRKzPanQkP7p4SoCao6QLORnW', NULL, '2019-07-02 22:54:33', '2019-07-02 22:54:33', 'service_provider', 1, NULL), (36, 'Imran', 'imransp@gmail.com', NULL, '$2y$10$omHlrio0nctGMt96FjbPIOfOJdr986CjWkZTSNEKYmfXhAbWjfasK', NULL, '2019-07-06 22:54:17', '2019-07-06 22:54:17', 'service_provider', 1, NULL), (37, 'brinto bota', 'bota@gmail.com', NULL, '$2y$10$1YcvSFTobPRMu89Ro1RDY.uB.9JgAqkzZp4ELFNBNil.2wcoELGKG', NULL, '2019-07-06 23:00:50', '2019-07-06 23:00:50', 'service_provider', 1, NULL), (38, 'Shabuj Sharker', 'ssp@gmail.com', NULL, '$2y$10$/y9kM48ZTi08tNRefqr1H.M55L0qrPDs/0nkMRqnh9JhtkNbJojOi', NULL, '2019-07-08 02:40:19', '2019-07-08 02:40:19', 'service_provider', 1, '1562575362.jpg'), (39, 'Saleh Ahmed', 'saleh@gmail.com', NULL, '$2y$10$pthZptPy3T1b0hs77EpK2eCuNXi37AfDhzsyRupfdMt5Ox7pxNEpG', NULL, '2019-07-14 07:56:35', '2019-07-14 07:56:35', 'employee', 0, '1563112700.jpg'), (40, 'Siam', 'siam@gmail.com', NULL, '$2y$10$fbH2.zVKdY3A92mreaDYCu47zTcxak09LVOqx6paCw/cu8Ll.q9Ta', NULL, '2019-07-14 08:09:54', '2019-07-14 08:09:54', 'service_provider', 0, '1563113425.jpg'), (41, 'Aditya Larma', 'a@gmail.com', NULL, '$2y$10$YBqMvQKgviEu73rdtqrTxuZL4NIdCeYgAK0ImDANZx7AIMW1b0WoC', NULL, '2019-07-15 00:41:02', '2019-07-15 00:41:02', 'service_provider', 1, '1563172920.jpeg'), (42, 'Sobuj sarker', 'ss@gmail.com', NULL, '$2y$10$yFg2gCuMSs3aBazplR5pvOtkxCev6T0qnv9ijxjXMpqI84ZNnmRgG', NULL, '2019-07-15 01:01:54', '2019-07-15 01:01:54', 'service_provider', 1, '1563174190.jpg'), (43, 'Abu Twasif', 'abu@gmail.com', NULL, '$2y$10$Tlg4ZocH63BkrI2hWoveaOX9CdQ55QBSzyl9Pn9PqZJZOZ5yZh5Rq', NULL, '2019-07-15 02:49:26', '2019-07-15 02:49:26', 'service_provider', 0, '1563180654.jpg'), (44, 'Ronaldo de caprio', 'ronaldo@gmail.com', NULL, '$2y$10$nQUWspcRBvFbzBtl6vclLO.4gkIINX9tZYs8nrYxG6arTu6Sk8Pbm', NULL, '2019-07-15 02:52:09', '2019-07-15 02:52:09', 'service_provider', 1, '1563180804.jpg'), (45, 'Somudro', 'abcd@gmail.com', NULL, '$2y$10$7oueNyPhXGCh9gZvPRhhWO5gwbjcOzKAWRfiRaqmjuM5LertSxOGq', NULL, '2019-07-20 11:31:25', '2019-07-20 11:31:25', 'customer', 1, '1563775306.jpg'), (46, 'Rouf', 'abcde@gmail.com', NULL, '$2y$10$8gaKO3ptRyk7C6jyAah2EOe1q2K14OLMZ2tWY6QSrpPBBG/aPoEZy', NULL, '2019-07-22 01:00:15', '2019-07-22 01:00:15', 'customer', 1, '1567415620.jpg'), (47, 'Lui Ie Khan', 'lui@gmail.com', NULL, '$2y$10$2.q3mMT4CJk/1eiDLvcZKO7gAOgbxz.Qaav6jMfpBP1uZoFsiFU1S', NULL, '2019-07-29 03:05:27', '2019-07-29 03:05:27', 'employee', 0, '1564391177.jpg'), (48, 'Dopa Khan', 'dopa@gmail.com', NULL, '$2y$10$IS/TrKWYSJuOGfQHOXEcheDaQznYn5jei3y9zy4dbK6uQNmh6bqk2', NULL, '2019-07-29 03:06:49', '2019-07-29 03:06:49', 'employee', 0, '1564391281.jpg'), (49, 'Hakuna Matata', 'hm@gmail.com', NULL, '$2y$10$ATLxepoR3rrbOJumtW8JeeeQmbZoj4BlSH8qlBOEjlA1o/95jvNcW', NULL, '2019-07-29 03:10:00', '2019-07-29 03:10:00', 'employee', 0, '1564391493.jpg'), (50, 'Hakuna Matata', 'hmm@gmail.com', NULL, '$2y$10$4SR1DEDlEkps7/Tu3kAXUeXjid48wMcWBmvDhiz.kB8ClTKOdNRiu', NULL, '2019-07-29 03:12:07', '2019-07-29 03:12:07', 'service_provider', 0, '1564391815.png'), (51, 'Abu Yousuf Siam', 'ysiam@gmail.com', NULL, '$2y$10$VsHtKFfcnZ0uQ.fdEW/VvOJHAN2lsAAxGMyNZk1mGEVRYYAEPkee6', NULL, '2019-08-17 08:28:26', '2019-08-17 08:28:26', 'customer', 1, '1566052180.jpg'), (52, 'Nasim Ahmed', 'nasim@gmail.com', NULL, '$2y$10$4xL1Q2l9QxcO0xyf37N.EuCZ3OYmtJ0aWlJxJSTGZbu609daaDBb6', NULL, '2019-08-25 12:20:09', '2019-08-25 12:20:09', 'service_provider', 1, '1566757266.jpg'), (53, 'Rouf', 'rouf@gmail.com', NULL, '$2y$10$XsHACEHXOExOrpnbdwx0M.4LdMGa8oJ.05Wt2FB7kPj19LDrjYnYO', NULL, '2019-09-02 03:01:07', '2019-09-02 03:01:07', 'customer', 1, '1567415157.jpg'), (54, 'AbdurRouf', 'arouf@gmail.com', NULL, '$2y$10$aaFkAJk5MNNh60yrFO.HquqyBcq.2hFaxH0tEM976ZnQ5VkG1AS/q', NULL, '2019-09-02 03:11:30', '2019-09-02 03:11:30', 'customer', 1, NULL), (55, 'Swarna Khan', 'swarna@gmail.com', NULL, '$2y$10$DebDJLfj65PbeAI87es9F.AVW7hcdl73GkA4aVaOWnOROj/yOC.Uq', NULL, '2019-09-18 06:13:09', '2019-09-18 06:13:09', 'customer', 1, '1568808929.jpeg'); -- -- Indexes for dumped tables -- -- -- Indexes for table `attatchment` -- ALTER TABLE `attatchment` ADD PRIMARY KEY (`aid`,`attatchment_number`); -- -- Indexes for table `attatchments` -- ALTER TABLE `attatchments` ADD PRIMARY KEY (`aid`); -- -- Indexes for table `bookings` -- ALTER TABLE `bookings` ADD PRIMARY KEY (`booking_id`); -- -- Indexes for table `company` -- ALTER TABLE `company` ADD PRIMARY KEY (`cmpn_id`), ADD KEY `location_id` (`location_id`), ADD KEY `aid` (`aid`); -- -- Indexes for table `customers` -- ALTER TABLE `customers` ADD PRIMARY KEY (`customer_id`); -- -- Indexes for table `employees` -- ALTER TABLE `employees` ADD PRIMARY KEY (`employee_id`), ADD KEY `pos_id` (`pos_id`), ADD KEY `aid` (`aid`); -- -- Indexes for table `locations` -- ALTER TABLE `locations` ADD PRIMARY KEY (`location_id`), ADD KEY `aid` (`aid`); -- -- Indexes for table `migrations` -- ALTER TABLE `migrations` ADD PRIMARY KEY (`id`); -- -- Indexes for table `packages` -- ALTER TABLE `packages` ADD PRIMARY KEY (`pkg_id`), ADD KEY `location_id` (`location_id`), ADD KEY `aid` (`aid`); -- -- Indexes for table `password_resets` -- ALTER TABLE `password_resets` ADD KEY `password_resets_email_index` (`email`); -- -- Indexes for table `provided_service` -- ALTER TABLE `provided_service` ADD PRIMARY KEY (`prvds_id`,`cmpn_id`), ADD KEY `cmpn_id` (`cmpn_id`); -- -- Indexes for table `ranks` -- ALTER TABLE `ranks` ADD PRIMARY KEY (`pos_id`); -- -- Indexes for table `rating` -- ALTER TABLE `rating` ADD PRIMARY KEY (`rate_id`); -- -- Indexes for table `services` -- ALTER TABLE `services` ADD PRIMARY KEY (`srvs_id`,`sp_id`,`cmpn_id`), ADD KEY `sp_id` (`sp_id`), ADD KEY `cmpn_id` (`cmpn_id`); -- -- Indexes for table `service_providers` -- ALTER TABLE `service_providers` ADD PRIMARY KEY (`sp_id`), ADD KEY `pos_id` (`pos_id`), ADD KEY `aid` (`aid`); -- -- Indexes for table `service_types` -- ALTER TABLE `service_types` ADD PRIMARY KEY (`svtp_id`); -- -- Indexes for table `users` -- ALTER TABLE `users` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `users_email_unique` (`email`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `attatchments` -- ALTER TABLE `attatchments` MODIFY `aid` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3; -- -- AUTO_INCREMENT for table `bookings` -- ALTER TABLE `bookings` MODIFY `booking_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6; -- -- AUTO_INCREMENT for table `company` -- ALTER TABLE `company` MODIFY `cmpn_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=15; -- -- AUTO_INCREMENT for table `customers` -- ALTER TABLE `customers` MODIFY `customer_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=16; -- -- AUTO_INCREMENT for table `employees` -- ALTER TABLE `employees` MODIFY `employee_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11; -- -- AUTO_INCREMENT for table `locations` -- ALTER TABLE `locations` MODIFY `location_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=14; -- -- AUTO_INCREMENT for table `migrations` -- ALTER TABLE `migrations` MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3; -- -- AUTO_INCREMENT for table `packages` -- ALTER TABLE `packages` MODIFY `pkg_id` int(11) NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `provided_service` -- ALTER TABLE `provided_service` MODIFY `prvds_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=13; -- -- AUTO_INCREMENT for table `ranks` -- ALTER TABLE `ranks` MODIFY `pos_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7; -- -- AUTO_INCREMENT for table `rating` -- ALTER TABLE `rating` MODIFY `rate_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=15; -- -- AUTO_INCREMENT for table `services` -- ALTER TABLE `services` MODIFY `srvs_id` int(11) NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `service_providers` -- ALTER TABLE `service_providers` MODIFY `sp_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=15; -- -- AUTO_INCREMENT for table `service_types` -- ALTER TABLE `service_types` MODIFY `svtp_id` int(11) NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `users` -- ALTER TABLE `users` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=56; -- -- Constraints for dumped tables -- -- -- Constraints for table `attatchment` -- ALTER TABLE `attatchment` ADD CONSTRAINT `attatchment_ibfk_1` FOREIGN KEY (`aid`) REFERENCES `attatchments` (`aid`); -- -- Constraints for table `company` -- ALTER TABLE `company` ADD CONSTRAINT `company_ibfk_1` FOREIGN KEY (`location_id`) REFERENCES `locations` (`location_id`), ADD CONSTRAINT `company_ibfk_2` FOREIGN KEY (`aid`) REFERENCES `attatchments` (`aid`); -- -- Constraints for table `employees` -- ALTER TABLE `employees` ADD CONSTRAINT `employees_ibfk_1` FOREIGN KEY (`pos_id`) REFERENCES `ranks` (`pos_id`), ADD CONSTRAINT `employees_ibfk_2` FOREIGN KEY (`aid`) REFERENCES `attatchments` (`aid`); -- -- Constraints for table `locations` -- ALTER TABLE `locations` ADD CONSTRAINT `locations_ibfk_1` FOREIGN KEY (`aid`) REFERENCES `attatchments` (`aid`); -- -- Constraints for table `packages` -- ALTER TABLE `packages` ADD CONSTRAINT `packages_ibfk_1` FOREIGN KEY (`location_id`) REFERENCES `locations` (`location_id`), ADD CONSTRAINT `packages_ibfk_2` FOREIGN KEY (`aid`) REFERENCES `attatchments` (`aid`); -- -- Constraints for table `provided_service` -- ALTER TABLE `provided_service` ADD CONSTRAINT `provided_service_ibfk_1` FOREIGN KEY (`cmpn_id`) REFERENCES `company` (`cmpn_id`); -- -- Constraints for table `services` -- ALTER TABLE `services` ADD CONSTRAINT `services_ibfk_1` FOREIGN KEY (`sp_id`) REFERENCES `service_providers` (`sp_id`), ADD CONSTRAINT `services_ibfk_2` FOREIGN KEY (`cmpn_id`) REFERENCES `company` (`cmpn_id`); -- -- Constraints for table `service_providers` -- ALTER TABLE `service_providers` ADD CONSTRAINT `service_providers_ibfk_1` FOREIGN KEY (`pos_id`) REFERENCES `ranks` (`pos_id`), ADD CONSTRAINT `service_providers_ibfk_2` FOREIGN KEY (`aid`) REFERENCES `attatchments` (`aid`); 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
6c0261ecf1fe27a6fcf4716c099461224e9021ae
SQL
juliesof/wdi_2_ruby_sql_lab_hogwarts
/schema.sql
UTF-8
1,544
3.828125
4
[]
no_license
DROP DATABASE IF EXISTS hogwarts; CREATE DATABASE hogwarts; \c houses; -- Schools of magic consist of several `houses`. Houses have these properties: -- * name -- * animal (lion, badger, etc.) -- * points (awarded or subtracted by teachers) CREATE TABLE houses ( id SERIAL PRIMARY KEY, name TEXT, animal TEXT, points INTEGER ); -- Each house consists of many `students`. Students have these properties: -- * name -- * gender -- * year (first year, second year, etc.) -- * birth date -- * admission date -- * alumni status (have they graduated?) CREATE TABLE students ( name TEXT, gender TEXT, year INTEGER, birth_date DATE, admission_date DATE, alumni_status TEXT ); -- Schools also teach many `spells`. Spells have these properties: -- * name -- * incantation -- * category (charms, dark arts, etc.) -- * level (year at which a student may first learn the spell) CREATE TABLE spells ( name TEXT, incantation TEXT, category TEXT, level INTEGER, known_spells TEXT, proficiency NUMERIC(3,2) CHECK ((proficiency >= 0) AND (proficiency <= 100)) ); -- Students can learn spells through the school &ndash; we might call these `known_spells`. Known spells have a "proficiency", which is a percentage between 0 and 100. Students will gain proficiency in spells over time, though they may lose proficiency if they haven't practiced in a while. -- Create a database and tables to store these objects, with appropriate columns and indexes. Store your commands in a `.sql` file so you can re-run them easily.
true
eeb535ea6eb057e120032a7fbc02f56e0b682af5
SQL
xotrs/order-api
/src/main/java/com/cherrypick/order/sql/init.sql
UTF-8
2,629
3.359375
3
[]
no_license
CREATE TABLE `member` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `email` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', `name` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', `nick_name` varchar(30) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', `password` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', `phone` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', `gender` varchar(1) COLLATE utf8mb4_unicode_ci DEFAULT '', `role` enum('USER','ARTIST') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'USER', PRIMARY KEY (`id`), KEY `email` (`email`), KEY `name` (`name`) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; CREATE TABLE `product` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `title` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; CREATE TABLE `product` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `title` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; CREATE TABLE `order` ( `id` varchar(12) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', `product_title` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', `product_id` int(11) NOT NULL, `member_id` int(11) NOT NULL, `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`), UNIQUE KEY `id` (`id`), KEY `member_id` (`member_id`), KEY `product_id` (`product_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; CREATE TABLE `token` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `access_token` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `refresh_token` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `member_id` int(11) NOT NULL, PRIMARY KEY (`id`), KEY `member_id` (`member_id`) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; INSERT INTO `product` (`id`, `title`) VALUES (1, '입점3주년기념할인⭐ 인기짱 다홍에그타르트'), (2, '[프리저브드]기분좋은 블루수국 꽃다발⭐'), (3, '플라워 프린트 화이트 원피스'), (4, '실버 마스크목걸이 마스크스트랩 4종류 목걸이겸용');
true
9c046ac7a8ad43379ed1d8849c1bb408ab9a2fd5
SQL
Jzacha21/secure-account-recovery
/src/main/resources/sql/schema_h2.sql
UTF-8
917
3.625
4
[]
no_license
CREATE TABLE IF NOT EXISTS USERS ( ID BIGINT AUTO_INCREMENT PRIMARY KEY, USERNAME VARCHAR(50) NOT NULL, PASSWORD VARCHAR(60) NOT NULL, ENABLED BOOLEAN NOT NULL, FIRST_NAME VARCHAR(50) NOT NULL, LAST_NAME VARCHAR(50) NOT NULL, EMAIL VARCHAR(50) NOT NULL, UNIQUE KEY USERNAME_UNIQUE (USERNAME), UNIQUE KEY EMAIL_UNIQUE (EMAIL) ); CREATE TABLE IF NOT EXISTS AUTHORITIES ( USER_ID BIGINT NOT NULL, ROLE VARCHAR(10) NOT NULL, FOREIGN KEY(USER_ID) REFERENCES USERS(ID), UNIQUE KEY USER_ROLE_UNIQUE (USER_ID, ROLE) ); CREATE TABLE IF NOT EXISTS PASSWORD_RESET_TOKEN ( ID BIGINT AUTO_INCREMENT PRIMARY KEY, SELECTOR VARCHAR(30) NOT NULL, VERIFIER VARCHAR(40) NOT NULL, EXPIRY_DATE TIMESTAMP NOT NULL, USER_ID BIGINT NOT NULL, FOREIGN KEY(USER_ID) REFERENCES USERS(ID) );
true
5cda3ff34d897be6edb0b7cb412185825534d2f2
SQL
jgarzonext/packages
/function/F_OBJASE.sql
UTF-8
985
2.59375
3
[]
no_license
-------------------------------------------------------- -- DDL for Function F_OBJASE -------------------------------------------------------- CREATE OR REPLACE EDITIONABLE FUNCTION "AXIS"."F_OBJASE" (IP_COBJASEG IN VARCHAR2, IP_CSUBOBJASEG IN VARCHAR2, IP_COBJASE IN OUT NUMBER, IP_TFUNCIO IN OUT VARCHAR2, IP_CCLARIE IN OUT NUMBER) RETURN NUMBER IS BEGIN if IP_CSUBOBJASEG is null then select cobjase, tfuncio, cclarie into ip_cobjase, ip_tfuncio, ip_cclarie from codiobjaseg where cobjaseg = ip_cobjaseg; else select cobjase, tfuncio, cclarie into ip_cobjase, ip_tfuncio, ip_cclarie from codisubobjaseg where csubobjaseg = ip_csubobjaseg; end if; RETURN 0; EXCEPTION WHEN too_many_rows THEN RETURN 1; WHEN others THEN RETURN 1; END; / GRANT EXECUTE ON "AXIS"."F_OBJASE" TO "R_AXIS"; GRANT EXECUTE ON "AXIS"."F_OBJASE" TO "CONF_DWH"; GRANT EXECUTE ON "AXIS"."F_OBJASE" TO "PROGRAMADORESCSI";
true
3226fcd192e5fc49595ab30b8641553958b533d6
SQL
stevenscg/CakePHP-OAuth2-Server-Plugin
/tables.sql
UTF-8
1,093
3.09375
3
[ "WTFPL", "MIT" ]
permissive
DROP TABLE IF EXISTS `o_auth2_server_clients`; CREATE TABLE `o_auth2_server_clients` ( `id` char(20) NOT NULL, `secret` char(20) NOT NULL, `redirect_uri` varchar(200) NOT NULL, `description` text DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 DEFAULT COLLATE=utf8_unicode_ci; DROP TABLE IF EXISTS `o_auth2_server_codes`; CREATE TABLE `o_auth2_server_codes` ( `access_code` varchar(40) NOT NULL, `client_id` char(20) NOT NULL, `redirect_uri` varchar(200) NOT NULL, `expires` int(11) NOT NULL, `scope` varchar(250) DEFAULT NULL, PRIMARY KEY (`access_code`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 DEFAULT COLLATE=utf8_unicode_ci; DROP TABLE IF EXISTS `o_auth2_server_tokens`; CREATE TABLE `o_auth2_server_tokens` ( `token` varchar(40) NOT NULL, `client_id` char(20) NOT NULL, `expires` int(11) NOT NULL, `scope` varchar(250) DEFAULT NULL, `username` varchar(250) DEFAULT NULL, `device_id` varchar(250) DEFAULT NULL, PRIMARY KEY (`token`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 DEFAULT COLLATE=utf8_unicode_ci;
true
514a6bb05b0520d1fba4e1f503a4fbf281e98721
SQL
Grigorii-Ilin/Databases
/lab2/7 SELECT aggregation.sql
WINDOWS-1251
389
3.671875
4
[]
no_license
--7. SELECT, . SELECT AVG(TotalPrice) AS 'Default AVG', SUM(TotalPrice)/COUNT(OrderID) AS 'Calculated AVG' FROM (SELECT OrderID, SUM(o.UnitPrice*o.Quantity*(1-o.Discount)) AS TotalPrice FROM [Northwind].dbo.[Order Details] AS o GROUP BY OrderID ) AS TotOrders
true
af3d6c79098074c0a764193db9ea7ee8bbf24acc
SQL
huaxueyihao/practise-project
/sbs0819/boot-bmodule01/src/main/resources/db/schema.sql
UTF-8
666
3.109375
3
[ "Apache-2.0" ]
permissive
drop table if exists sys_user; -- 用户 create table sys_user ( id bigint(20) primary key auto_increment, user_name varchar(20) not null comment '用户名', password varchar(32) not null comment '密码', sex varchar(1) default '0' comment '0-男,1-女,2-位置', age int(3) comment '年龄' ); -- 菜单 drop table if exists sys_menu; create table sys_menu ( id bigint(20) primary key auto_increment, menu_name varchar(20) not null comment '菜单名', parent_id bigint(20) not null default 0 comment '菜单父id', route_url varchar(20) not null comment '菜单路由', little_icon varchar (20) comment '小图标' );
true
3711bcdbfb7d88539837b20e17982cf355d94ae7
SQL
hw79chopin/MySQL-Codebook
/SQL 스터디/중급/105.sql
UTF-8
274
3.140625
3
[]
no_license
-- 데이터의 품질 높이기 (UNIQUE) -- Q. UNIQUE 제약을 ID 칼럼에 주세요 CREATE TABLE emp (empno INT UNIQUE, ename VARCHAR(20)); -- 기존 테이블에 UNIQUE 제약 추가 ALTER TABLE 테이블명 ADD CONSTRAINT 칼럼이름 UNIQUE (칼럼이름);
true
64ffa2e6f9c433f815ffd2c7923c3bbd2b0c4b3a
SQL
moneymashi/SVN_fr.class
/homework/WebContent/a11_parkyunha/[0321]hw.sql
UHC
3,216
4.4375
4
[]
no_license
/* 1 ο üũϼ. 1000̸ (ְġ, ġ, ġ) ~2000̸ ~3000̸ ~4000̸ ~5000̸ ~6000̸ */ select * from emp; select trunc(sal, -3)+1000||' ̸' , count(*) , max(sal) ְġ, min(sal) ġ, avg(sal) ġ from emp group by trunc(sal, -3) order by trunc(sal, -3); /* 2 μġ Ʒ ϼ. μġ [ ORACLE ] ORA-00979: GROUP BY ǥ ƴմϴ select ˻ϴ column Լ group by ÷ ǥõǾ Ѵ. */ select d.loc μġ, count(e.ename) from emp e, dept d where e.deptno = d.deptno group by d.loc; /* 3 student id, name studentPoint id, subject, score gradeCheck minpoint, maxpoint, grade(A~F) 1) ̵ ؼ(equal join) ̸ 2) ؼ(not equal join) 3) STUDENT10, STUDENTPOINT, gradeCheck Ͽ ̸ */ create table STUDENT10 ( id varchar2(10) primary key, name varchar2(20) ); create table STUDENTPOINT ( id varchar2(10) references studen10(id), subject varchar2(20), score number(3) ); create table GRADECHECK ( minpoint number(3), maxpoint number(3), grade varchar2(1) ); -- 1) select s.name, p.subject, p.score from student10 s, studentpoint p where s.id = p.id; -- 2) select p.subject, p.SCORE, c.GRADE from studentpoint p, gradecheck c where p.score between c.MINPOINT and c.MAXPOINT order by p.score desc; -- 3) select s.NAME, p.SUBJECT, c.GRADE from student10 s, studentpoint p, gradecheck c where s.id = p.id and p.score between c.MINPOINT and c.maxpoint; -- Dummy Data insert into student10 values (1,'park'); insert into student10 values (2,'yun'); insert into student10 values (3,'ha'); insert into student10 values (4,'zzang'); insert into gradecheck values (0, 50, 'F'); insert into gradecheck values (51, 60, 'E'); insert into gradecheck values (61, 70, 'D'); insert into gradecheck values (71, 80, 'C'); insert into gradecheck values (81, 90, 'B'); insert into gradecheck values (91, 100, 'A'); insert into studentpoint values (1, 'math', 100); insert into studentpoint values (1, 'korean', 90); insert into studentpoint values (2, 'math', 80); insert into studentpoint values (2, 'korean', 70); insert into studentpoint values (3, 'math', 60); insert into studentpoint values (3, 'korean', 50); insert into studentpoint values (4, 'math', 40); insert into studentpoint values (4, 'korean', 30); /* 4 outer join, group ȰϿ μ ο ȮϷ Ѵ. ̷ ϼ. ο 0 ǥ μ ο */ select * from emp; select * from dept; select d.DNAME μ, count(e.deptno) ο from emp e, dept d where e.DEPTNO(+) = d.DEPTNO group by d.DNAME;
true
06e363e66de8342dfebe686c65674ed1f60cdedd
SQL
vein2017/MySQL
/szolgaltato.sql
UTF-8
2,796
3.171875
3
[]
no_license
DROP TABLE IF EXISTS szolgaltato ; DROP TABLE IF EXISTS ugyfel ; DROP TABLE IF EXISTS szolgaltato_ugyfel ; CREATE TABLE szolgaltato ( szolgaltato_id INTEGER , szolgaltato_nev VARCHAR(30) , web VARCHAR(30) , ugyfelszolgalat VARCHAR(35) ) ; INSERT INTO szolgaltato VALUES(1,'T-COM' ,"WWW.T-COM.HU" ,'info@t-com.hu' ); INSERT INTO szolgaltato VALUES(2,'UPC' ,"WWW.UPC.HU" ,'ugyfel@upc.hu' ); INSERT INTO szolgaltato VALUES(3,'TELENOR' ,"WWW.TELENOR.HU" ,'info@telenor.hu' ); INSERT INTO szolgaltato VALUES(4,'DIGI MAGYARORSZÁG',"WWW.DIGI.HU" ,'ugyfel@digi.hu' ); INSERT INTO szolgaltato VALUES(5,'VODAFONE' ,"WWW.VODAFONE.HU" ,'info@vodafone.hu' ); CREATE TABLE ugyfel ( ugyfel_id INTEGER , ugyfel_nev VARCHAR(35) , szuletesi_hely VARCHAR(35) , szuletesi_datum DATE ) ; INSERT INTO ugyfel VALUES(1000,'KOVÁCS ENDRE' ,'PÉCS' ,'1992-01-15'); INSERT INTO ugyfel VALUES(1001,'BEDE TIBOR' ,'BUDAPEST' ,'1993-02-12'); INSERT INTO ugyfel VALUES(1002,'ERDŐS MÓNIKA' ,'VESZPRÉM' ,'1994-03-15'); INSERT INTO ugyfel VALUES(1003,'NAGY CSILLA' ,'BUDAPEST' ,'1995-04-16'); INSERT INTO ugyfel VALUES(1004,'MÉREI MÁRK' ,'BAJA' ,'1985-08-20'); INSERT INTO ugyfel VALUES(1005,'CSALA ANNAMÁRIA','MISKOLC' ,'1983-10-20'); INSERT INTO ugyfel VALUES(1006,'CSÁKÁNYI BEA' ,'MISKOLC' ,'1976-12-23'); INSERT INTO ugyfel VALUES(1007,'VAJDA ANITA' ,'BUDAPEST' ,'1971-02-29'); INSERT INTO ugyfel VALUES(1008,'VIDA MÁRK' ,'BUDAPEST' ,'1973-04-10'); INSERT INTO ugyfel VALUES(1009,'ANTAL PÉTER' ,'PÉCS' ,'1975-06-08'); INSERT INTO ugyfel VALUES(1010,'BENCE FERENC' ,'NAGYKANIZSA' ,'1972-08-07'); INSERT INTO ugyfel VALUES(1011,'TATAI ZSÓKA' ,'PÉCS' ,'1969-03-06'); INSERT INTO ugyfel VALUES(1012,'JÓRI ANDRÁS' ,'MISKOLC' ,'1961-02-08'); CREATE TABLE szolgaltato_ugyfel ( szolgaltato_id INTEGER , ugyfel_id INTEGER , szolgaltatas VARCHAR(30) , ar INTEGER , datum DATE ) ; INSERT INTO szolgaltato_ugyfel VALUES (1,1001,'INTERNET' ,2300,'2019.01.01'); INSERT INTO szolgaltato_ugyfel VALUES (2,1001,'TELEFON' ,2700,'2018.02.10'); INSERT INTO szolgaltato_ugyfel VALUES (2,1002,'TV' ,2700,'2017.03.12'); INSERT INTO szolgaltato_ugyfel VALUES (3,1002,'INTERNET' ,1900,'2016.11.01'); INSERT INTO szolgaltato_ugyfel VALUES (4,1003,'TELEFON' ,1950,'2016.10.03'); INSERT INTO szolgaltato_ugyfel VALUES (5,1003,'TELEFON' ,3950,'2018.11.06'); INSERT INTO szolgaltato_ugyfel VALUES (1,1004,'INTERNET' ,2800,'2013.06.20'); INSERT INTO szolgaltato_ugyfel VALUES (2,1005,'TV' ,2700,'2016.07.29'); INSERT INTO szolgaltato_ugyfel VALUES (6,1006,'TELEFON' ,2750,'2015.09.19'); SELECT * FROM szolgaltato , ugyfel, szolgaltato_ugyfel WHERE szolgaltato.szolgaltato_id = szolgaltato_ugyfel.szolgaltato_id AND szolgaltato_ugyfel.ugyfel_id = ugyfel.ugyfel_id ;
true
908cbd43f244e73b15c1bd8a311dfc2275f6b771
SQL
Luddini/Test-Technique-stage-NestJS
/prisma/migrations/20210530115836_init/migration.sql
UTF-8
1,895
3.75
4
[]
no_license
/* Warnings: - You are about to drop the `User` table. If the table is not empty, all the data it contains will be lost. */ -- DropTable DROP TABLE "User"; -- CreateTable CREATE TABLE "user" ( "id" SERIAL NOT NULL, "username" VARCHAR(255) NOT NULL, PRIMARY KEY ("id") ); -- CreateTable CREATE TABLE "editor" ( "id" SERIAL NOT NULL, "username" VARCHAR(255) NOT NULL, PRIMARY KEY ("id") ); -- CreateTable CREATE TABLE "article" ( "id" SERIAL NOT NULL, "title" TEXT NOT NULL, "article" VARCHAR(500) NOT NULL, "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, "updated_at" TIMESTAMP(3) NOT NULL, "editor_id" INTEGER NOT NULL, "user_id" INTEGER NOT NULL, "issue_id" INTEGER NOT NULL, PRIMARY KEY ("id") ); -- CreateTable CREATE TABLE "issue" ( "id" SERIAL NOT NULL, "title" TEXT NOT NULL, "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, "updated_at" TIMESTAMP(3) NOT NULL, "editor_id" INTEGER NOT NULL, "user_id" INTEGER NOT NULL, PRIMARY KEY ("id") ); -- CreateIndex CREATE UNIQUE INDEX "user.username_unique" ON "user"("username"); -- CreateIndex CREATE UNIQUE INDEX "editor.username_unique" ON "editor"("username"); -- AddForeignKey ALTER TABLE "article" ADD FOREIGN KEY ("editor_id") REFERENCES "editor"("id") ON DELETE CASCADE ON UPDATE CASCADE; -- AddForeignKey ALTER TABLE "article" ADD FOREIGN KEY ("user_id") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE CASCADE; -- AddForeignKey ALTER TABLE "article" ADD FOREIGN KEY ("issue_id") REFERENCES "issue"("id") ON DELETE CASCADE ON UPDATE CASCADE; -- AddForeignKey ALTER TABLE "issue" ADD FOREIGN KEY ("editor_id") REFERENCES "editor"("id") ON DELETE CASCADE ON UPDATE CASCADE; -- AddForeignKey ALTER TABLE "issue" ADD FOREIGN KEY ("user_id") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE CASCADE;
true
f53d40b5deb95f04d0645272bf81bcf57c2f3074
SQL
queirozsc/Automation-Scripts
/SQL/Smart/Relatórios Smart/CSI_Exportacao_Fluxo_de_Caixa.sql
UTF-8
4,663
3.5
4
[]
no_license
select cfg.cfg_emp, tmp1.empresa,tmp1.documento,tmp1.data,tmp1.competencia,tmp1.cfo_cod, tmp1.classificacao,tmp1.historico,tmp1.movimento, tmp1.entradas,tmp1.saidas, case when cfo_codigo_conta is null then tmp1.conciliadoem else tmp2.cfo_conciliadoem end as conciliadoem, case when cfo_codigo_conta is null then codigo_conta else cfo_codigo_conta end as codigo_conta, case when cfo_codigo_conta is null then conta else cfo_conta end as conta, baixa,chk.check_entradas,chk.check_saidas from ( select mcc.mcc_doc as documento, UPPER(gcc_descr) as empresa, mcc.mcc_dt as data, convert(varchar,left(mcc.mcc_mmyy,4)) + '/' + convert(varchar,right(mcc.mcc_mmyy,2)) as competencia, cfo.cfo_cod, cfo.cfo_nome as classificacao, mcc.mcc_obs as historico, mcc.mcc_deb - mcc.mcc_cre as movimento, mcc.mcc_deb as entradas,mcc.mcc_cre as saidas, mcc.mcc_dt_compensa as conciliadoem, convert(varchar,mcc.mcc_serie) + '-' + convert(varchar,mcc.mcc_lote) as lote, ccr.ccr_cod as codigo_conta, ccr.ccr_tit as conta, isnull(convert(varchar,mcc.mcc_bcp_serie) + '-' + convert(varchar,mcc.mcc_bcp_num),'') as baixa from mcc,cfo,ccr, gcc where (cfo.cfo_cod = mcc.mcc_cfo_cod) and (ccr.ccr_cod = mcc.mcc_ccr) and ccr_gcc_cod = gcc_cod and ((ccr_tipo = 2) and (mcc.mcc_tipo = 'r') and (mcc.mcc_concilia = 's')) and mcc.mcc_bcp_serie is null and (mcc.mcc_dt_compensa >= '12-1-2019 0:0:0.000' and mcc.mcc_dt_compensa < '12-3-2019 0:0:0.000') union all select mcc.mcc_doc as documento, UPPER(gcc_descr) as empresa, mcc.mcc_dt as data, convert(varchar,left(mcc.mcc_mmyy,4)) + '/' + convert(varchar,right(mcc.mcc_mmyy,2)) as competencia, cfo.cfo_cod,cfo.cfo_nome as classificacao,mcc.mcc_obs as historico, mcc.mcc_cre - mcc.mcc_deb as movimento,0 as entradas, mcc.mcc_deb + ((ipg.ipg_valor_multa + ipg.ipg_desp_ac) * mcc.mcc_deb/ipg.ipg_valor) - (ipg.ipg_valor_complemento * mcc.mcc_deb/ipg.ipg_valor) - ((ipg.ipg_iss + ipg.ipg_irrf + ipg.ipg_inss + ipg.ipg_imp_pis + ipg.ipg_imp_cofins + ipg.ipg_imp_cssl) * mcc.mcc_deb/ipg.ipg_valor) saidas, mcc.mcc_dt_compensa as conciliadoem, convert(varchar,mcc.mcc_serie) + '-' + convert(varchar,mcc.mcc_lote) as lote, ccr.ccr_cod as codigo_conta,ccr.ccr_tit as conta, (convert(varchar,ipg.ipg_bcp_serie) + '-' + convert(varchar,ipg.ipg_bcp_num)) as mcc_baixa from mcc,cfo,ccr,ipg, gcc,tcc,cct where not exists (select tt.tcc_tipo from tcc tt where tt.tcc_tipo = 'W' AND tt.tcc_cod = ccr.ccr_tcc_cod) and (mcc.mcc_obs <> 'Multa/Juros/Desconto' OR mcc.mcc_obs is null) and (tcc.tcc_cod =* ccr.ccr_tcc_cod) and (cct.cct_cod =* mcc.mcc_cct_cod) and (cfo.cfo_cod = mcc.mcc_cfo_cod) and (ccr.ccr_cod = mcc.mcc_ccr) and (ipg.ipg_cpg_serie = mcc.mcc_cpg_serie) and (ipg.ipg_cpg_num = mcc.mcc_cpg_num) and (ipg.ipg_parc = mcc.mcc_ipg_parc) and ipg_gcc_cod_colig = gcc_cod and ((mcc.mcc_tipo = 'P') and (((mcc.mcc_ind_cpg_geracao is null or (mcc.mcc_ind_cpg_geracao = 'N')) and (mcc.mcc_cre = 0)) or (mcc.mcc_ind_cpg_geracao = 'S'))) and (convert(varchar,ipg.ipg_bcp_serie) + '-' + convert(varchar,ipg.ipg_bcp_num)) in (select distinct (convert(varchar,mcc.mcc_bcp_serie) + '-' + convert(varchar,mcc.mcc_bcp_num)) as mcc_baixa from mcc,cfo,ccr where (cfo.cfo_cod = mcc.mcc_cfo_cod) and (ccr.ccr_cod = mcc.mcc_ccr) and ((mcc.mcc_dt_compensa >= '12-1-2019 0:0:0.000') and (mcc.mcc_dt_compensa < '12-3-2019 0:0:0.000') and (mcc.mcc_tipo = 'R') and ccr.ccr_tipo = 2 and (mcc.mcc_concilia = 'S')) and mcc.mcc_bcp_serie <> '') ) as tmp1, (select distinct convert(varchar,mcc.mcc_bcp_serie) + '-' + convert(varchar,mcc.mcc_bcp_num) as cfo_baixa, ccr.ccr_cod as cfo_codigo_conta,ccr.ccr_tit as cfo_conta,mcc.mcc_dt_compensa as cfo_conciliadoem from mcc,ccr where (ccr.ccr_cod = mcc.mcc_ccr) and ((ccr_tipo = 2) and (mcc.mcc_tipo = 'r') and (mcc.mcc_concilia = 's')) and mcc.mcc_bcp_serie is not null and (mcc.mcc_dt_compensa >= '12-1-2019 0:0:0.000' and mcc.mcc_dt_compensa < '12-3-2019 0:0:0.000') ) tmp2, (select sum(mcc.mcc_deb) check_entradas, sum(mcc.mcc_cre) as check_saidas from mcc,ccr where (ccr.ccr_cod = mcc.mcc_ccr) and ((ccr_tipo = 2) and (mcc.mcc_tipo = 'r') and (mcc.mcc_concilia = 's')) and (mcc.mcc_dt_compensa >= '12-1-2019 0:0:0.000' and mcc.mcc_dt_compensa < '12-3-2019 0:0:0.000') ) as chk, cfg where (tmp1.baixa *= tmp2.cfo_baixa) order by codigo_conta desc, conta asc, data asc, conciliadoem asc
true
9dd619c907e6b5322d8b63b4d7951ba743bd98ba
SQL
supermanxkq/projects
/Swing/BookManager/document/db_book.sql
UTF-8
2,629
3.515625
4
[]
no_license
/* Navicat MySQL Data Transfer Source Server : localhost Source Server Version : 50027 Source Host : localhost:3306 Source Database : db_book Target Server Type : MYSQL Target Server Version : 50027 File Encoding : 65001 Date: 2016-01-28 16:07:28 */ SET FOREIGN_KEY_CHECKS=0; -- ---------------------------- -- Table structure for t_book -- ---------------------------- DROP TABLE IF EXISTS `t_book`; CREATE TABLE `t_book` ( `id` int(11) NOT NULL auto_increment, `bookName` varchar(20) default NULL, `author` varchar(20) default NULL, `sex` varchar(10) default NULL, `price` float(10,2) default NULL, `bookTypeId` int(11) default NULL, `bookDesc` varchar(1000) default NULL, PRIMARY KEY (`id`), KEY `FK_ID` (`bookTypeId`), CONSTRAINT `FK_ID` FOREIGN KEY (`bookTypeId`) REFERENCES `t_booktype` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of t_book -- ---------------------------- INSERT INTO `t_book` VALUES ('2', '西游记', '吴承恩', '男', '100.00', '9', '师徒4人不辞辛苦,前往西天拜佛求经的故事。'); INSERT INTO `t_book` VALUES ('3', '红楼梦', '曹雪芹', '男', '200.00', '9', '古典名著,最有价值的艺术作品。'); INSERT INTO `t_book` VALUES ('4', 'java编程思想', '大神', '男', '200.00', '10', 'java编程思想'); INSERT INTO `t_book` VALUES ('5', '谢谢你离开我', '琼瑶', '女', '100.00', '11', '谢谢你离开我'); -- ---------------------------- -- Table structure for t_booktype -- ---------------------------- DROP TABLE IF EXISTS `t_booktype`; CREATE TABLE `t_booktype` ( `id` int(11) NOT NULL auto_increment, `bookTypeName` varchar(20) default NULL, `bookTypeDesc` varchar(1000) default NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of t_booktype -- ---------------------------- INSERT INTO `t_booktype` VALUES ('9', '古典名著', '古典名著书籍'); INSERT INTO `t_booktype` VALUES ('10', '计算机类', '计算机编程类书籍'); INSERT INTO `t_booktype` VALUES ('11', '文学类', '文学类书籍'); -- ---------------------------- -- Table structure for t_user -- ---------------------------- DROP TABLE IF EXISTS `t_user`; CREATE TABLE `t_user` ( `id` int(11) NOT NULL auto_increment, `userName` varchar(20) default NULL, `password` varchar(20) default NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of t_user -- ---------------------------- INSERT INTO `t_user` VALUES ('1', 'java1234', '123456');
true
bd176480ef50e6f4f8e4aa5ea22b8a839b258fa3
SQL
trajan4k6/acv
/models/l20_marts/feedbackify/feedbackify_dimension_region.sql
UTF-8
364
2.5625
3
[]
no_license
{{ config(materialized='table') }} SELECT {{ dbt_utils.surrogate_key( [5,'n.LOCATION'] ) }} AS DIMENSION_REGION_KEY, LOCATION AS REGION_NAME, 5 AS DATASOURCE_ID FROM {{ source('feedbackify', 'net_promoter_score') }} n WHERE LOCATION IS NOT NULL GROUP BY LOCATION
true
8d1bd765f2b9ec4297785c8117ea79bea5c1f93a
SQL
MichaelHarrid/THE-DATABASE
/file/sql_file/sms.sql
UTF-8
10,372
3.0625
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 5.0.4 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Generation Time: Dec 30, 2020 at 05:36 AM -- Server version: 10.4.17-MariaDB -- PHP Version: 8.0.0 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; START TRANSACTION; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8mb4 */; -- -- Database: `sms` -- -- -------------------------------------------------------- -- -- Table structure for table `address` -- CREATE TABLE `address` ( `address_id` int(50) NOT NULL, `S_id` int(50) NOT NULL, `fullAddrs` varchar(100) NOT NULL, `IATF_id` int(50) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `address` -- INSERT INTO `address` (`address_id`, `S_id`, `fullAddrs`, `IATF_id`) VALUES (500, 100, '042 Mcguire Terrace', 700), (501, 101, '68 Dorton Terrace', 701), (502, 102, '58470 Prairieview Park', 702), (503, 103, '73312 Grasskamp Crossing', 703), (504, 104, '00 Heath Hill', 704), (505, 105, '00 Heath Hill Side', 705); -- -------------------------------------------------------- -- -- Table structure for table `autopay` -- CREATE TABLE `autopay` ( `autopay_id` int(50) NOT NULL, `autopay` varchar(50) NOT NULL, `credit_card` int(50) NOT NULL, `debit_card` int(50) NOT NULL, `check_act` int(50) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -------------------------------------------------------- -- -- Table structure for table `bldng` -- CREATE TABLE `bldng` ( `bldng_id` int(50) NOT NULL, `bldng_name` varchar(50) NOT NULL, `day` varchar(50) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `bldng` -- INSERT INTO `bldng` (`bldng_id`, `bldng_name`, `day`) VALUES (8000, 'stMary', 'morning'), (8001, 'Fatima', 'morning'), (8002, 'stMary', 'evening'), (8003, 'Fatima', 'evening'); -- -------------------------------------------------------- -- -- Table structure for table `cashier` -- CREATE TABLE `cashier` ( `financial_id` int(50) NOT NULL, `S_id` int(50) NOT NULL, `balance` int(50) NOT NULL, `due_date` date NOT NULL, `parital_amt` int(50) NOT NULL, `Autopay_id` varchar(50) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `cashier` -- INSERT INTO `cashier` (`financial_id`, `S_id`, `balance`, `due_date`, `parital_amt`, `Autopay_id`) VALUES (400, 100, 15450, '2021-01-14', 3500, '3000'), (401, 102, 10250, '2021-01-14', 2500, '3001'), (402, 102, 0, '0000-00-00', 0, '3002'), (403, 103, 9850, '2021-01-14', 1500, '3003'), (404, 104, 2564, '2021-01-14', 500, '3004'), (405, 105, 13344, '2021-01-14', 3500, '3005'); -- -------------------------------------------------------- -- -- Table structure for table `course` -- CREATE TABLE `course` ( `course_id` int(50) NOT NULL, `courses` varchar(50) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `course` -- INSERT INTO `course` (`course_id`, `courses`) VALUES (9000, 'BSIT'), (9001, 'BSHM'), (9002, 'BSBA'), (9003, 'BSED'), (9004, 'BSSW'), (9005, 'BEED'); -- -------------------------------------------------------- -- -- Table structure for table `details` -- CREATE TABLE `details` ( `details_id` int(50) NOT NULL, `S_id` int(50) NOT NULL, `gender` varchar(50) NOT NULL, `cellphone` int(50) NOT NULL, `telephone` int(50) NOT NULL, `email` varchar(50) NOT NULL, `address_id` int(50) NOT NULL, `registrar_id` int(50) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `details` -- INSERT INTO `details` (`details_id`, `S_id`, `gender`, `cellphone`, `telephone`, `email`, `address_id`, `registrar_id`) VALUES (200, 100, 'Male', 925550179, 2025550179, 'vfarreil0@techcrunch.com', 500, 600), (201, 101, 'Female', 921645781, 2021643567, 'acollins1@unc.edu', 501, 601), (202, 102, 'Male', 975645414, 2024478524, 'dskydall2@marketwatch.com', 502, 602), (203, 103, 'Female', 945456546, 456467776, 'gzupo3@mashable.com', 503, 603), (204, 104, 'Female', 974456456, 2020456456, 'cbotger4@gnu.org', 504, 604), (205, 105, 'Female', 945456456, 2024578914, 'asawdy5@chicagotribune.com', 505, 605); -- -------------------------------------------------------- -- -- Table structure for table `iatf` -- CREATE TABLE `iatf` ( `IATF_id` int(50) NOT NULL, `address_id` int(50) NOT NULL, `is_lockdown` varchar(50) NOT NULL, `is_highRisk` varchar(50) NOT NULL, `investigation` varchar(100) NOT NULL, `quarantine_id` int(50) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `iatf` -- INSERT INTO `iatf` (`IATF_id`, `address_id`, `is_lockdown`, `is_highRisk`, `investigation`, `quarantine_id`) VALUES (700, 500, 'YES', 'YES', 'NO', 800), (701, 501, 'NO', 'NO', 'NO', 801), (702, 502, 'NO', 'NO', 'NO', 802), (703, 503, 'NO', 'NO', 'NO', 803), (704, 504, 'NO', 'NO', 'NO', 804), (705, 505, 'NO', 'NO', 'NO', 805); -- -------------------------------------------------------- -- -- Table structure for table `quarantine` -- CREATE TABLE `quarantine` ( `quarantine_id` int(11) NOT NULL, `quarantine` varchar(50) NOT NULL, `days` int(11) NOT NULL, `IATF_id` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `quarantine` -- INSERT INTO `quarantine` (`quarantine_id`, `quarantine`, `days`, `IATF_id`) VALUES (800, 'YES', 14, 700), (801, 'NO', 0, 701), (802, 'NO', 0, 702), (803, 'NO', 0, 703), (804, 'NO', 0, 704), (805, 'NO', 0, 705); -- -------------------------------------------------------- -- -- Table structure for table `registrar` -- CREATE TABLE `registrar` ( `registrar_id` int(50) NOT NULL, `NSO` varchar(50) NOT NULL, `Form137` varchar(50) NOT NULL, `medical` varchar(50) NOT NULL, `year` varchar(50) NOT NULL, `clearance` varchar(50) NOT NULL, `enrolled_on` date NOT NULL, `subjects_id` int(50) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `registrar` -- INSERT INTO `registrar` (`registrar_id`, `NSO`, `Form137`, `medical`, `year`, `clearance`, `enrolled_on`, `subjects_id`) VALUES (600, 'NO', 'YES', 'YES', '3rd-Year', 'NO', '2020-06-08', 900), (601, 'YES', 'YES', 'NO', '3rd-Year', 'YES', '2020-06-09', 901), (602, 'YES', 'YES', 'YES', '3rd-Year', 'YES', '2020-06-09', 902), (603, 'YES', 'YES', 'NO', 'YES', 'NO', '2020-06-09', 903), (604, 'NO', 'YES', 'YES', '3rd-Year', 'NO', '2020-06-08', 903); -- -------------------------------------------------------- -- -- Table structure for table `sa` -- CREATE TABLE `sa` ( `S.A_id` int(50) NOT NULL, `S_id` int(50) NOT NULL, `applied_on` date NOT NULL, `Faculty` char(20) DEFAULT NULL, `registrar` varchar(50) NOT NULL, `I.T_dept` varchar(50) NOT NULL, `Cashier` varchar(50) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `sa` -- INSERT INTO `sa` (`S.A_id`, `S_id`, `applied_on`, `Faculty`, `registrar`, `I.T_dept`, `Cashier`) VALUES (2000, 100, '2020-06-08', 'NO', 'NO', 'YES', 'NO'), (2001, 101, '2020-06-10', 'NO', 'YES', 'NO', 'NO'), (2002, 102, '2020-06-09', 'YES', 'NO', 'NO', 'NO'), (2003, 103, '2020-06-08', 'NO', 'NO', 'NO', 'YES'), (2004, 104, '0000-00-00', 'NO', 'NO', 'NO', 'NO'), (2005, 105, '2020-06-05', 'NO', 'NO', 'YES', 'NO'); -- -------------------------------------------------------- -- -- Table structure for table `status` -- CREATE TABLE `status` ( `status_id` int(50) NOT NULL, `regular` varchar(50) NOT NULL, `working` varchar(50) NOT NULL, `sa_id` int(50) NOT NULL, `scholarship` varchar(50) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -------------------------------------------------------- -- -- Table structure for table `student` -- CREATE TABLE `student` ( `S_id` int(50) NOT NULL, `Sname` varchar(100) NOT NULL, `SLname` varchar(100) NOT NULL, `details_id` int(50) NOT NULL, `Sstatus_id` int(50) NOT NULL, `Sfinancial_id` int(50) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `student` -- INSERT INTO `student` (`S_id`, `Sname`, `SLname`, `details_id`, `Sstatus_id`, `Sfinancial_id`) VALUES (100, 'Minor', 'Cheake', 200, 300, 400), (101, 'Berky', 'Laborda', 201, 301, 401), (102, 'Adolf', 'Fipp', 202, 302, 402), (103, 'Frederick', 'Stokell', 203, 303, 403), (104, 'Baird', 'Stuckley', 204, 304, 404), (105, 'Buiron', 'Weedall', 205, 305, 405); -- -------------------------------------------------------- -- -- Table structure for table `subject` -- CREATE TABLE `subject` ( `subject_id` char(50) DEFAULT NULL, `S_id` int(50) NOT NULL, `IT301` double NOT NULL, `IT302` double NOT NULL, `IT303` double NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `subject` -- INSERT INTO `subject` (`subject_id`, `S_id`, `IT301`, `IT302`, `IT303`) VALUES ('9000', 100, 85.1, 79.2, 86.7), ('9001', 101, 87.2, 97.4, 98.4), ('9002', 102, 80.3, 78.5, 75.5), ('9003', 103, 90.1, 89.4, 84.5), ('9004', 104, 89.7, 87.8, 98.7), ('9005', 105, 87.5, 86.5, 84.4); -- -------------------------------------------------------- -- -- Table structure for table `total_stu` -- CREATE TABLE `total_stu` ( `total_id` int(50) NOT NULL, `registrar_id` int(50) NOT NULL, `1stYr` int(50) NOT NULL, `2ndYr` int(50) NOT NULL, `3rdYr` int(50) NOT NULL, `4thYr` int(50) NOT NULL, `day` varchar(50) NOT NULL, `schYr` varchar(50) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `total_stu` -- INSERT INTO `total_stu` (`total_id`, `registrar_id`, `1stYr`, `2ndYr`, `3rdYr`, `4thYr`, `day`, `schYr`) VALUES (4000, 600, 456, 546, 123, 564, 'morning', '19-20'), (4001, 601, 486, 564, 456, 264, 'evening', '19-20'), (4002, 602, 456, 457, 345, 214, 'morning', '18-19'), (4003, 603, 341, 241, 345, 734, 'evening', '18-19'); -- -- Indexes for dumped tables -- -- -- Indexes for table `student` -- ALTER TABLE `student` ADD PRIMARY KEY (`S_id`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `student` -- ALTER TABLE `student` MODIFY `S_id` int(50) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=106; 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
e1975066ee5588daa7009dcd67c5bdde8db6913d
SQL
ferasit87/mediaopttest
/Mediaopt.sql
UTF-8
4,946
3.015625
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 4.6.5.2 -- https://www.phpmyadmin.net/ -- -- Host: localhost -- Generation Time: Dec 18, 2016 at 04:07 AM -- Server version: 5.6.31 -- PHP Version: 5.5.38 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: `Mediaopt` -- -- -------------------------------------------------------- -- -- Table structure for table `m_employee` -- CREATE TABLE `m_employee` ( `ID` int(6) UNSIGNED NOT NULL, `name` varchar(100) CHARACTER SET utf8 NOT NULL, `lName` varchar(100) CHARACTER SET utf8 DEFAULT NULL, `email` varchar(100) CHARACTER SET utf8 NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `m_employee` -- INSERT INTO `m_employee` (`ID`, `name`, `lName`, `email`) VALUES (2, 'Feras', 'Daeef', 'test@test.com'), (8, 'akad', 'test', 'daf@one-touch.ru'), (9, 'test2', 'test2', 'test2@test.com'), (10, 'test3', 'test3', 'test3@test.com'), (11, 'test4', 'test4', 'test4@test.com'); -- -------------------------------------------------------- -- -- Table structure for table `m_logs` -- CREATE TABLE `m_logs` ( `ID` int(6) NOT NULL, `id_employee` int(6) NOT NULL, `date` date NOT NULL, `start_time` time NOT NULL, `end_time` time NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `m_logs` -- INSERT INTO `m_logs` (`ID`, `id_employee`, `date`, `start_time`, `end_time`) VALUES (2, 8, '2016-12-16', '10:15:00', '01:15:00'), (4, 9, '2016-12-14', '10:15:00', '10:15:00'), (5, 2, '2016-12-06', '10:30:00', '10:30:00'), (6, 9, '2016-12-14', '10:30:00', '10:30:00'), (7, 9, '2016-12-17', '22:45:00', '22:45:00'), (24, 8, '2016-11-16', '10:15:00', '01:15:00'), (25, 9, '2016-11-14', '10:15:00', '10:15:00'), (26, 2, '2016-11-06', '10:30:00', '10:30:00'), (27, 9, '2016-11-14', '10:30:00', '10:30:00'), (28, 9, '2016-11-17', '22:45:00', '22:45:00'), (29, 8, '2016-11-16', '10:15:00', '01:15:00'), (30, 9, '2016-11-14', '10:15:00', '10:15:00'), (31, 2, '2016-11-06', '10:30:00', '10:30:00'), (32, 9, '2016-11-14', '10:30:00', '10:30:00'), (33, 9, '2016-11-17', '22:45:00', '22:45:00'), (34, 8, '2016-11-16', '10:15:00', '01:15:00'), (35, 9, '2016-11-14', '10:15:00', '10:15:00'), (36, 2, '2016-11-06', '10:30:00', '10:30:00'), (37, 9, '2016-11-14', '10:30:00', '10:30:00'), (38, 9, '2016-11-17', '22:45:00', '22:45:00'); -- -------------------------------------------------------- -- -- Table structure for table `m_project` -- CREATE TABLE `m_project` ( `ID` int(6) NOT NULL, `name` varchar(100) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `m_project` -- INSERT INTO `m_project` (`ID`, `name`) VALUES (1, 'Project0'), (2, 'Project1'), (3, 'Project2'), (4, 'Project3'), (5, 'Project4'); -- -------------------------------------------------------- -- -- Table structure for table `m_task` -- CREATE TABLE `m_task` ( `ID` int(6) NOT NULL, `id_employee` int(6) NOT NULL, `id_project` int(6) NOT NULL, `date` date NOT NULL, `start_time` time NOT NULL, `end_time` time NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `m_task` -- INSERT INTO `m_task` (`ID`, `id_employee`, `id_project`, `date`, `start_time`, `end_time`) VALUES (6, 9, 2, '2016-12-06', '00:15:00', '12:15:00'), (8, 2, 2, '2016-12-06', '13:00:00', '14:00:00'), (9, 2, 2, '2016-12-06', '15:20:00', '16:00:00'), (10, 10, 2, '2016-12-06', '11:00:00', '23:22:00'), (12, 11, 2, '2016-12-06', '13:00:00', '14:00:00'), (14, 10, 2, '2016-12-06', '13:00:00', '14:00:00'), (15, 9, 2, '2016-12-06', '13:15:00', '14:15:00'); -- -- Indexes for dumped tables -- -- -- Indexes for table `m_employee` -- ALTER TABLE `m_employee` ADD PRIMARY KEY (`ID`); -- -- Indexes for table `m_logs` -- ALTER TABLE `m_logs` ADD PRIMARY KEY (`ID`); -- -- Indexes for table `m_project` -- ALTER TABLE `m_project` ADD PRIMARY KEY (`ID`); -- -- Indexes for table `m_task` -- ALTER TABLE `m_task` ADD PRIMARY KEY (`ID`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `m_employee` -- ALTER TABLE `m_employee` MODIFY `ID` int(6) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12; -- -- AUTO_INCREMENT for table `m_logs` -- ALTER TABLE `m_logs` MODIFY `ID` int(6) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=39; -- -- AUTO_INCREMENT for table `m_project` -- ALTER TABLE `m_project` MODIFY `ID` int(6) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6; -- -- AUTO_INCREMENT for table `m_task` -- ALTER TABLE `m_task` MODIFY `ID` int(6) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=16; /*!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
8fd576e88d7552c0cac4341a77d397a0fb7db21d
SQL
SeunAdelekan/inmos-api
/db.sql
UTF-8
2,081
3.90625
4
[ "MIT" ]
permissive
-- Database: inmos -- DROP DATABASE IF EXISTS inmos; -- CREATE DATABASE inmos; -- COMMENT ON DATABASE inmos -- IS 'inmos database'; -- Table: store -- DROP TABLE IF EXISTS store CASCADE; CREATE TABLE IF NOT EXISTS store ( store_id UUID PRIMARY KEY DEFAULT gen_random_uuid(), store_name TEXT NOT NULL UNIQUE, password TEXT NOT NULL, contact JSONB NOT NULL ); -- Table: vendor -- DROP TABLE IF EXISTS vendor CASCADE CREATE TABLE IF NOT EXISTS vendor ( vendor_id UUID PRIMARY KEY DEFAULT gen_random_uuid(), vendor_name TEXT NOT NULL UNIQUE, contact JSONB NOT NULL ); -- Table: stock -- DROP TABLE IF EXISTS stock CASCADE CREATE TABLE IF NOT EXISTS stock ( stock_id UUID PRIMARY KEY DEFAULT gen_random_uuid(), stock_name TEXT NOT NULL, category TEXT NOT NULL ); -- Table: inventory DROP TABLE IF EXISTS inventory CASCADE; CREATE TABLE IF NOT EXISTS inventory ( stock_id UUID NOT NULL REFERENCES stock ON DELETE CASCADE, store_id UUID NOT NULL REFERENCES store ON DELETE CASCADE, quantity INT DEFAULT 0 CHECK (quantity >= 0), cost_price NUMERIC(15,2) DEFAULT 0.00 CHECK (cost_price >= 0.00), selling_price NUMERIC(15,2) DEFAULT 0.00 CHECK (selling_price >= 0.00), PRIMARY KEY (stock_id, store_id) ); -- Table: supplies DROP TABLE IF EXISTS supplies CASCADE; CREATE TABLE IF NOT EXISTS supplies ( store_id UUID NOT NULL REFERENCES store ON DELETE CASCADE, vendor_id UUID NOT NULL REFERENCES vendor ON DELETE RESTRICT, stock_id UUID NOT NULL REFERENCES stock ON DELETE CASCADE, quantity INT DEFAULT 0 CHECK (quantity >= 0), cost_price NUMERIC(15,2) DEFAULT 0.00 CHECK (cost_price >= 0.00), date_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP ); -- Table: sales DROP TABLE IF EXISTS sales CASCADE; CREATE TABLE IF NOT EXISTS sales ( store_id UUID NOT NULL REFERENCES store ON DELETE CASCADE, stock_id UUID NOT NULL REFERENCES stock ON DELETE CASCADE, quantity INT DEFAULT 0 CHECK (quantity >= 0), selling_price NUMERIC(15,2) DEFAULT 0.00 CHECK (selling_price >= 0.00), date_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP );
true
86b86b29c6024b17b870d218d04b206c000eeba0
SQL
xiaozan-dev/relational-query-optimizer
/resources/sql_query/query06.sql
UTF-8
574
3.71875
4
[]
no_license
UPDATE LINEITEM SET shipdate=date('1997-05-14') WHERE shipdate>=date('1997-05-02') AND shipdate<date('1997-05-14'); select lineitem.shipmode, count(distinct orders.orderkey) from orders, lineitem where orders.orderkey = lineitem.orderkey and (lineitem.shipmode='AIR' or lineitem.shipmode='MAIL' or lineitem.shipmode='TRUCK' or lineitem.shipmode='SHIP') and orders.orderpriority <> '1-URGENT' and orders.orderpriority <> '2-HIGH' and lineitem.commitdate < lineitem.receiptdate and lineitem.shipdate = date('1997-05-14') group by lineitem.shipmode order by lineitem.shipmode;
true
190cb985ebb2c4d55bda6e02497ebbb2d6370008
SQL
omarjcm/ssp
/codigo/versiones/v4.7.1.1/procedures/ssp_consultar_total_tipo_registro.sql
UTF-8
509
3.875
4
[]
no_license
DELIMITER $$ DROP PROCEDURE IF EXISTS `ssp`.`ssp_consultar_total_tipo_registro` $$ CREATE DEFINER=`root`@`localhost` PROCEDURE `ssp_consultar_total_tipo_registro`(fecha1 DATE, fecha2 DATE, tipo_ VARCHAR(30)) BEGIN SET AUTOCOMMIT = 0; SELECT SUM(r.valor) FROM registro r, descripcion d, registrodescripcion rd WHERE rd.id_registro = r.id_registro AND rd.id_descripcion = d.id_descripcion AND r.fecha >= fecha1 AND r.fecha < fecha2 AND r.tipo = tipo_ GROUP BY r.tipo; END $$ DELIMITER ;
true
695663effecc1c1be62419e3323d75e9ba15b804
SQL
pavel-voinov/oracle-dba-workspace
/scripts/sysdba/i/create_schema.sql
UTF-8
621
2.546875
3
[ "MIT" ]
permissive
set serveroutput on size 1000000 verify off feedback off timing off termout on echo off ACCEPT p_schema PROMPT 'Enter username: ' column pwd new_value pwd column tbs new_value tbs set termout off SELECT lower('&p_schema') as pwd, substr(upper('&p_schema'), 1, 27) || '_DATA' as tbs FROM dual; set termout on ACCEPT p_password CHAR DEFAULT "&pwd" PROMPT 'Enter password [&pwd]: ' HIDE ACCEPT p_tablespace CHAR DEFAULT "&tbs" PROMPT 'Enter default tablespace for user [&tbs]: ' --ACCEPT jcart_owner PROMPT 'Enter JChem cartridge owner (if required): ' undefine pwd @sysdba/p/create_schema.sql set feedback on timing on
true
3c9fc222bda7c99d4b6d0ab97a18866aafed74de
SQL
bernardkung/greenbig
/GreenBig.Triggers.1.0.0.sql
UTF-8
2,678
3.703125
4
[]
no_license
/*==============================================================*/ /* */ /* INFO 6210 Data Management and Database Design */ /* Group Project */ /* Fall 2016 */ /* */ /* Bernard Kung */ /* Yaqing Wei */ /* Dongqi Li */ /* Behnam Tirandazi */ /* */ /*==============================================================*/ /*==============================================================*/ /* Triggers */ /* Version 0.9.0 */ /*==============================================================*/ use GreenBig; ## INSERTS VALUES DELETED FROM METER UPDATE INTO METERVALUE ## DELIMITER // DROP TRIGGER IF EXISTS ConfirmedMeterUpdate // CREATE TRIGGER ConfirmedMeterUpdate AFTER DELETE ON MeterUpdate FOR EACH ROW BEGIN INSERT INTO metervalue(record, MeterID, MeasureTime, MeterValue) VALUES(old.record, old.MeterID, old.MeasureTime, old.MeterValue); END; // DELIMITER ; ## Adding new weather record ## Checks if new record has an existing weatherstation ## If not, adds a new weatherstation DELIMITER // DROP TRIGGER IF EXISTS updateWeatherstation // CREATE TRIGGER updateWeatherstation BEFORE INSERT ON Weather FOR EACH ROW BEGIN IF NEW.weatherstation NOT IN ## if we're adding a new weatherstation ## (SELECT ID FROM weatherstation) ## then add new weatherstation entry ## THEN INSERT INTO weatherstation(ID, StationName, StationDesc, CityID) SELECT new.weatherstation, 'unknown', 'unknown', '1'; END IF; END ; // DELIMITER ; ## If new weatherstation is added ## Assigns in buildingweather table which buildings are tied to the weatherstation DELIMITER // DROP TRIGGER IF EXISTS insertNewBuildingWeather // CREATE TRIGGER insertNewBuildingWeather AFTER INSERT ON WeatherStation FOR EACH ROW BEGIN ## assign new weatherstation to buildings ## INSERT INTO buildingweather(buildingID, weatherstationID) ## then add new buildingweather entry ## SELECT b.ID, new.ID FROM building AS b JOIN universitysite AS us ON b.siteID = us.ID WHERE us.cityID = NEW.CityID; END ; // DELIMITER ; ## If a weatherstation entry is updated with a new ID ## Buildingweather updates its foreign key to match it to keep old assignments DELIMITER // DROP TRIGGER IF EXISTS updateBuildingWeather // CREATE TRIGGER updateBuildingWeather AFTER UPDATE ON WeatherStation FOR EACH ROW BEGIN UPDATE buildingweather ## then assign new weatherstation to buildings ## SET weatherstationID = NEW.id WHERE weatherstationID = OLD.id; END ; // DELIMITER ;
true
4bdc6976174742572b836804aafb6d90947e8bfe
SQL
RahilKhan/manageexpense
/Database/ME-DBS_1.0.1/full_install/Common/objects/source/dfp/tab_script/dim_webgl_vendor_renderer.sql
UTF-8
1,543
3.25
3
[]
no_license
prompt prompt Creating table DIM_WEBGL_VENDOR_RENDERER prompt ============================ prompt declare lv_tbl exception; pragma exception_init(lv_tbl,-00942); lv_part_name varchar2(100); begin begin execute immediate 'drop table DIM_WEBGL_VENDOR_RENDERER purge'; exception when lv_tbl then null; end; execute immediate 'create table DIM_WEBGL_VENDOR_RENDERER ( WEBGL_VENDOR_RENDERER_ID NUMBER(10), WEBGL_VENDOR_RENDERER VARCHAR2(100 CHAR), EFF_FROM_DT DATE, EFF_TO_DT DATE, UPDATE_DT DATE ) tablespace #TBS_DFP_DATA pctfree 10 initrans 1 maxtrans 255 nologging storage ( initial 64K next 256K minextents 1 maxextents unlimited pctincrease 0 )'; execute immediate 'alter table DIM_WEBGL_VENDOR_RENDERER add constraint DIM_WEBGL_VENDOR_RENDERER_PK primary key (WEBGL_VENDOR_RENDERER_ID) using index tablespace #TBS_DFP_IDX pctfree 10 initrans 2 maxtrans 255 storage ( initial 64K next 256K minextents 1 maxextents unlimited pctincrease 0 )'; execute immediate 'create index DIM_WEBGL_VENDOR_RENDERER_IDX1 on DIM_WEBGL_VENDOR_RENDERER (WEBGL_VENDOR_RENDERER) tablespace #TBS_DFP_IDX pctfree 10 initrans 2 maxtrans 255 storage ( initial 64K next 256K minextents 1 maxextents unlimited pctincrease 0 )'; end; / prompt prompt Done.
true
f9bb84572de61cf28007ad9df65b03d25cfe7c1a
SQL
DaveAlsina/dataBasesManagement
/parciales/parcial1/solucion_DavidAlsina/p1_DavidAlsina.sql
UTF-8
2,341
4
4
[]
no_license
------------------- ------------------- ------------------- CONSULTAS ------------------- ------------------- ------------------- -------- 1) select nombre, apellido from estudiante where genero = 'F'; -------- 2) select nombre from grupo where periodo = 1 and anio = 2019; -------- 3) select avg(calificacion)::real, nombre from ( ( select id_curso, calificacion, nombre from (select calificacion, id_grupo from inscripcion) as ins INNER JOIN (select nombre, id as id_gr, id_curso from grupo) as gr ON ins.id_grupo = gr.id_gr ) as ins_gr INNER JOIN (select id from curso where nombre = 'Manejo de Bases de Datos') as MBD ON MBD.id = ins_gr.id_curso ) as ins_gr_MBD group by (nombre) -------- 4) select * from curso where id not in ( select id_curso from ( select id_est, id_grupo from (select codigo as id_est from estudiante) as est INNER JOIN (select id as id_grupo, codigo_estudiante from inscripcion) as ins ON est.id_est = ins.codigo_estudiante ) as est_ins INNER JOIN (select id_curso, id from grupo) as gr ON gr.id = est_ins.id_grupo ) -------- 5) select nombre, apellido from estudiante where codigo in (select codigo_estudiante from inscripcion where id_grupo in( select id from grupo where (periodo = 2 and anio = 2020) and (periodo = 1 and anio = 2021) ) ) ------------------- ------------------- ------------------- Creación de vistas ------------------- ------------------- ------------------- create view estudiante_grupo_curso_calficacion as select nombre_est, apellido, nombre_gr, nombre_curs, calificacion from ( select nombre_est, apellido, nombre_gr, calificacion, id_curso from ( select nombre as nombre_est, apellido, calificacion, id_grupo from (select nombre, apellido, codigo from estudiante) as est INNER JOIN (select calificacion, codigo_estudiante, id_grupo from inscripcion) as ins ON ins.codigo_estudiante = est.codigo ) as est_ins INNER JOIN (select id, nombre as nombre_gr, id_curso from grupo where anio = 2019) as gr ON est_ins.id_grupo = gr.id ) as est_ins_gr INNER JOIN (select nombre as nombre_curs, id from curso) as curs ON est_ins_gr.id_curso = curs.id select * from estudiante_grupo_curso_calficacion;
true
f632272d7e548a218458c12ef8cbf4811e980b66
SQL
BorjaLL/StackOverflow-Questions
/day 17 part 1.sql
UTF-8
2,554
2.84375
3
[]
no_license
DECLARE v_p NUMBER := 0; v_dvalue NUMBER := 0; v_v5 NUMBER := 0; v_rb NUMBER := 0; --relative base v_go NUMBER := 0; v_debugid NUMBER := 0; v_item VARCHAR2(3200); v_base1 VARCHAR2(3200); v_x NUMBER := 0; v_y NUMBER := 0; PROCEDURE show_hull IS v_base1 VARCHAR2(32000); BEGIN FOR v_count IN 0..99 LOOP IF v_count < 10 THEN SELECT x1 INTO v_base1 FROM hull WHERE id = v_count; dbms_output.put_line(v_count || ' ' || v_base1); ELSE SELECT x1 INTO v_base1 FROM hull WHERE id = v_count; dbms_output.put_line(v_count || ' ' || v_base1); END IF; END LOOP; END; BEGIN DELETE FROM t_debug; DELETE FROM csv WHERE oldvalue IS NULL; UPDATE csv SET value0 = oldvalue; COMMIT; while v_dvalue !=99 LOOP intcode0(v_p, v_v5, v_dvalue, v_rb, v_go, v_debugid); IF v_v5 = 35 THEN v_item := '#'; ELSIF v_v5 = 46 THEN v_item := '.'; ELSIF v_v5 = 10 THEN v_item := '/n'; v_y := v_y + 1; v_x := 0; END IF; /*SELECT x1 INTO v_base1 FROM hull WHERE id = v_y; IF v_v5 != 10 THEN UPDATE hull SET x1 = ( replacepos(v_base1, v_item, v_x) ) WHERE id = v_y; COMMIT; v_x := v_x + 1; END IF;--*/ dbms_output.put_line('config ' || v_p || ' output ' || v_item || ' value ' || v_dvalue); END LOOP;--*/ --dbms_output.put_line('config '||V_p||' output '||V_v5||' value '||V_dvalue); -- UPDATE csv -- SET -- value0 = oldvalue; -- show_hull; COMMIT; END;
true
9bdd4d4ee2942d3e5d7a7f10770131d66d010c89
SQL
mundodron/arduino-bot-aurelio
/Querys/~ebC513.sql
UTF-8
1,273
2.890625
3
[]
no_license
select * from customer_id_acct_map where external_id = '999982657141' select * from bill_invoice_detail where bill_ref_no = 133977579 select * from cmf_balance where bill_ref_no = 133977579 select * from cmf_balance where bill_ref_no in (133977579) select * from VERIPARCELAMENTO select B.BILL_REF_NO from g0023421sql.VERIPARCELAMENTO A, bmf B where A.ACCOUNT_NO = B.ACCOUNT_NO and A.BILL_REF_NO = B.BILL_REF_NO and B.PAY_METHOD = 1 select B.DESCRIPTION_TEXT, A.* from bill_invoice_detail A, descriptions B where bill_ref_no = 146873616 and A.DESCRIPTION_CODE = B.DESCRIPTION_CODE and B.LANGUAGE_CODE = 2 and A.TYPE_CODE = 6 select * from bill_invoice_detail select B.DESCRIPTION_TEXT, A.* from bill_invoice_detail A, descriptions B where bill_ref_no in (select X.BILL_REF_NO from g0023421sql.VERIPARCELAMENTO Z, payment_trans X where Z.ACCOUNT_NO = X.ACCOUNT_NO and Z.BILL_REF_NO = X.BILL_REF_NO --and B.PAY_METHOD = 1 ) and A.DESCRIPTION_CODE = B.DESCRIPTION_CODE and B.LANGUAGE_CODE = 2 and A.TYPE_CODE = 6 and A.COMPONENT_ID = 26347 --and A.AMOUNT > 100 select * from bill_invoice_detail
true
faa35ff600df68403cc6f19b5ca6dc396f521fa3
SQL
VictorT314/turma11mysql
/MySQL/Atividade 3/Exercício 1/Selects.sql
UTF-8
743
3.578125
4
[]
no_license
#SELECTS GERAIS select * from tb_categoria; select * from tb_produto; #PRODUTOS COM VALOR MAIOR DO QUE 50 REAIS select * from tb_produto inner join tb_categoria where tb_categoria.id_categoria = tb_produto.id_categoria and preco_kg > 50; #PRODUTOS COM VALOR ENTRE 3 E 60 REAIS select * from tb_produto inner join tb_categoria where tb_categoria.id_categoria = tb_produto.id_categoria and (preco_kg > 3 and preco_kg < 60); #PRODUTOS COM AS LETRAS "CO" select * from tb_produto inner join tb_categoria where tb_categoria.id_categoria = tb_produto.id_categoria and nome_produto like "CO%"; #PRODUTOS DA CATEGORIA "BOVINOS" select * from tb_produto inner join tb_categoria where tb_produto.id_categoria = 1 and tb_categoria.id_categoria = 1;
true
a2e6df1546a2d9c19ec6292cd5d559ee7df634d1
SQL
Min-Flower/twu-biblioteca-MinWang
/database/q3.sql
UTF-8
304
3.640625
4
[ "Apache-2.0" ]
permissive
-- 3. What books AND movies aren't checked OUT? SELECT b.title FROM book AS b WHERE b.id NOT IN ( SELECT c.book_id FROM checkout_item AS c WHERE c.book_id IS NOT NULL ) UNION SELECT m.title FROM movie AS m WHERE m.id NOT IN ( SELECT c.movie_id FROM checkout_item AS c WHERE c.movie_id IS NOT NULL )
true
8223b11b3cacbaf46cee64a4c0e366f268501f69
SQL
UliksSekiraqa/HackSurreySubmissionUliksDimaTauras
/includes/CreateUserTable.sql
UTF-8
548
2.875
3
[]
no_license
CREATE TABLE `users` ( `UserID` int(11) unsigned NOT NULL AUTO_INCREMENT, `Email` varchar(254) NOT NULL, `Forename` varchar(255) NOT NULL, `Surname` varchar(255) NOT NULL, `Registration_date` date NOT NULL, `Date_of_birth` date DEFAULT NULL, `Password_hash` varchar(255) NOT NULL, `Location` varchar(255) DEFAULT NULL, `Rating` decimal(10,0) DEFAULT NULL, `Telephone` varchar(255) NOT NULL, `Gender` varchar(15) DEFAULT NULL, PRIMARY KEY (`UserID`), UNIQUE KEY `email` (`Email`) ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1
true
4a8649bc2c91d53f520635ddde63f2b11a9b8f14
SQL
raymin/mytime
/db/001_ddl/004_create_link.sql
UTF-8
644
3.171875
3
[]
no_license
DROP TABLE IF EXISTS T_LINK; CREATE TABLE T_LINK ( ID BIGINT(20) UNSIGNED PRIMARY KEY NOT NULL AUTO_INCREMENT, USER_ID BIGINT(20) UNSIGNED, POST_ID BIGINT(20) UNSIGNED, LINK_URL VARCHAR(255), LINK_NAME VARCHAR(255), LINK_IMAGE VARCHAR(255), LINK_TARGET VARCHAR(25), LINK_REMARK VARCHAR(255), LINK_VISIBLE VARCHAR(20), LINK_RATING INT(11), CREATED_AT TIMESTAMP NOT NULL, CREATED_BY VARCHAR(20) NOT NULL, UPDATED_AT TIMESTAMP NOT NULL, UPDATED_BY VARCHAR(20) NOT NULL ) DEFAULT CHARSET =UTF8; CREATE INDEX IDX_LINK ON T_LINK (USER_ID, POST_ID);
true
307c4d73a99ec36b6986aaf52b597b97cacebf0b
SQL
MrIvanPlays/SimpleRegister
/plugin/src/main/resources/com/mrivanplays/simpleregister/sql/schemas/h2.sql
UTF-8
257
2.671875
3
[ "MIT" ]
permissive
CREATE TABLE IF NOT EXISTS simpleregister_passwords( `id` INT AUTO_INCREMENT, `name` VARCHAR(255), `uuid` VARCHAR(36), `ip` VARCHAR(255), `password` VARCHAR(255), PRIMARY KEY (`id`) ); CREATE INDEX ON `simpleregister_passwords` (`uuid`);
true
b1775fc359ccde239be025dfff950a7becfc6b65
SQL
guitar1999/electricity_logging
/schema/create-view-electricity_dow.sql
UTF-8
886
3.953125
4
[]
no_license
CREATE OR REPLACE VIEW electricity_plotting.electricity_dow AS ( WITH u AS ( SELECT ROW_NUMBER() OVER (ORDER BY sum_date DESC), sum_date, SUM(kwh) AS kwh, CASE WHEN 'no' = ANY (array_agg(complete)) THEN 'no' ELSE 'yes' END AS complete FROM electricity_statistics.electricity_sums_hourly_best_available GROUP BY sum_date ORDER BY sum_date DESC LIMIT 7 ) SELECT INITCAP(TO_CHAR(u.sum_date, 'day')) AS label, u.kwh, SUM(s.kwh_avg * s.count) / SUM(s.count) AS kwh_avg, u.complete FROM u INNER JOIN electricity_cmp.cmp_electricity_statistics_dow s ON DATE_PART('dow', u.sum_date)=s.dow GROUP BY u.sum_date, u.kwh, u.complete ORDER BY u.sum_date );
true
3cc1d53cb92f8e5397fd503fe0a5b9e8efe0f0b5
SQL
lesonlhld/CNPMNC
/CNPMNC/Database/Create table.sql
UTF-8
1,142
3.65625
4
[]
no_license
drop database if exists SAP; create database SAP; use SAP; create table accommodation( id int not null auto_increment, address text not null, type_acc varchar(45) not null, cost int not null, description_acc text, contact varchar(45) not null, status_acc varchar(10) not null, image text null, primary key(id) ); insert into accommodation (id, address, type_acc, cost, description_acc, contact, status_acc) values (1, 'linh trung, thu duc', 'Chung cư', '2000000', 'chung cu cao cap', '0987654321', 'empty'), (2, 'linh trung, thu duc', 'Nhà trọ', 1000000, 'nha tro gia re', '093454321', 'empty'), (3, 'ly thuong kiet, quan 10', 'Chung cư', 5000000, 'chung cu trung binh', '0237654321', 'full'), (4, 'ly thuong kiet, quan 10', 'Villa', 10000000, 'villa', 'villa@gmail.com', 'full'), (5, 'Quận 1, Hồ Chí Minh', 'Nhà trọ', 3000000, 'Nhà trọ', '0925919727', 'empty'), (6, 'Quận 3', 'Nhà trọ', 1500000, 'Nhà trọ', 'contact@gmail.com', 'full'); select id, type_acc, address, cost, description_acc, contact, status_acc, image from accommodation where address like "%%" and cost >= "0" and status_acc like "%%"; commit
true
c863f782c46faf4ed8caf06d2f050dec4ef54979
SQL
VijayEluri/all
/xcode/mytodo/Design/create_tables_v2.sql
UTF-8
1,023
3.265625
3
[]
no_license
/* priority: 0: low 1: normal 2: high 3: urgent */ drop table task; create table task ( task_id INTEGER PRIMARY KEY, parent_id INTEGER, category_id INTEGER, content TEXT, note TEXT, priority INTEGER, completed INTEGER, float INTEGER, trash INTEGER, stared INTEGER, due_date TEXT, completion_date TEXT, repeat_pattern TEXT ); drop table category; create table category ( category_id INTEGER PRIMARY KEY, category_name TEXT, icon_name ); delete from task; insert into task values(1, -1, -1, "todo 1", "note of todo1", 1, 0, 0, 0, 0, "", "", ""); insert into task values(2, -1, -1, "todo 2", "note of todo2", 2, 0, 0, 0, 0, "", "", ""); insert into task values(3, 1, -1, "todo 1.1", "note of todo1.1", 1, 0, 0, 0, 0, "", "", ""); insert into task values(4, 1, -1, "todo 1.2", "note of todo1.2", 3, 0, 0, 0, 0, "", "", ""); select * from task; delete from category; insert into category values(1, "Work", ""); insert into category values(2, "Personal", ""); select * from category;
true
3b028793ee2757d5bd0b9584ac01aecd1ef08e34
SQL
kkousounnis/Mysql_Excersises
/MySQL_Excercises/SQL_JOINS/Right.sql
UTF-8
185
3.015625
3
[ "MIT" ]
permissive
SELECT `employees`.`employeeNumber`, `customers`.`customerNumber` FROM `customers` RIGHT JOIN `employees` ON `customers`.`salesRepEmployeeNumber` = `employees`.`employeeNumber`
true
96dbd3783b3cf06c0bf19c94282d7cb741b5964c
SQL
bravesoftdz/sgts
/sql/oracle/uninstall/005_drop_table_converter_passports.sql
WINDOWS-1251
1,118
2.71875
3
[]
no_license
/* */ DROP VIEW S_CONVERTER_PASSPORTS -- /* */ DROP PROCEDURE I_CONVERTER_PASSPORT -- /* */ DROP PROCEDURE U_CONVERTER_PASSPORT -- /* */ DROP PROCEDURE D_CONVERTER_PASSPORT -- /* */ DROP SEQUENCE SEQ_CONVERTER_PASSPORTS -- /* */ DROP FUNCTION GET_CONVERTER_PASSPORT_ID -- /* */ DROP TABLE CONVERTER_PASSPORTS -- /* */ COMMIT
true
a085825dab73560d187bdf69f89a052785eff9f0
SQL
Sergio-DC/Ejercicios-JAVA
/JAVA_SE_PERSISTENCIA_DATOS/mensajes_app/ddl.sql
UTF-8
203
2.578125
3
[]
no_license
CREATE DATABASE mensaje_app; USE mensajes_app; CREATE TABLE mensajes ( id_mensaje INTEGER PRIMARY KEY AUTO_INCREMENT, mensaje VARCHAR(280) , autor_mensaje VARCHAR(50), fecha_mensaje TIMESTAMP );
true
690e767f092e697dcb36cf5c2a80815c80b9f965
SQL
michaelcunningham/oracledba
/projects/drop_unused_schemas/chk_joanna_objects.sql
UTF-8
252
2.734375
3
[]
no_license
column db_name format a30 column username format a10 column segment_name format a30 set linesize 120 select (select name from v$database) db_name, 'JOANNA' username, segment_name, segment_type from dba_segments where owner in( 'JOANNA' );
true
3fb20d8c16be523c1b9cec3097571a154ced1ede
SQL
alstjd0051/SQL
/oracle_workspace/실습문제/시나리오.sql
UTF-8
2,339
4.75
5
[]
no_license
--1select emp_name, job_code,count(bonus) as 보너스를받는사원 from employee --where nonus != '0' group by job_code,emp_name order by job_code asc; . 직원테이블(EMP)이 존재한다. --직원 테이블에서 사원명,직급코드, 보너스를 받는 사원 수를 조회하여 직급코드 순으로 오름차순 정렬하는 구문을 작성하였다. --이 때 발생하는 문제점을 [원인](10점)에 기술하고, 이를 해결하기 위한 모든 방법과 구문을 [조치내용](30점)에 기술하시오. SELECT EMPNAME, JOBCODE, COUNT(*) AS 사원수 FROM EMP WHERE BONUS != 'NULL' GROUP BY JOBCODE ORDER BY JOBCODE; SELECT EMP_NAME 사원명, JOB_CODE 직급코드, COUNT(BONUS) AS 사원수 FROM EMP WHERE BONUS != '0' GROUP BY EMP_NAME, JOB_CODE ORDER BY JOBCODE ASC; select emp_name 직원명, job_code 직급코드,count(bonus) as 사원수 from employee where bonus != '0' group by job_code,emp_name order by job_code asc; --직원 테이블(EMP)에서 부서 코드별 그룹을 지정하여 부서코드, 그룹별 급여의 합계, 그룹별 급여의 평균(정수처리), --인원수를 조회하고 부서코드순으로 나열되어있는 코드 아래와 같이 제시되어있다. --아래의 SQL구문을 평균 월급이 2800000초과하는 부서를 조회하도록 수정하려고한다. --수정해야하는 조건을[원인](30점)에 기술하고, 제시된 코드에 추가하여 [조치내용](30점)에 작성하시오.(60점) SELECT DEPT, SUM(SALARY) 합계, FLOOR(AVG(SALARY)) 평균, COUNT(*) 인원수 FROM EMP GROUP BY DEPT ORDER BY DEPT ASC; select dept_code 부서코드, sum(salary) 합계, floor(avg(salary)) 평균, count(*) 인원수 from employee group by dept_code order by dept_code asc; select nvl(d. dept_title, '인턴') , sum(salary)합계 , trunc(avg(salary))평균급여 ,count(*) 인원수 from employee e join department d on e.dept_code =d.dept_id where 2800000 < (select trunc (avg(salary)) from employee where nvl(dept_code, '인턴') = nvl(E.dept_code, '인턴')) group by nvl(d.dept_title, '인턴'); SELECT DEPT, SUM(SALARY) 합계, FLOOR(AVG(SALARY)) 평균, COUNT(*) 인원수 FROM EMP GROUP BY DEPT HAVING FLOOR(AVG(SALARY)) > 2800000 ORDER BY DEPT ASC;
true
2f152b19791816ecba92156318acf9578e019027
SQL
buhti/esup-covoiturage
/src/main/resources/META-INF/sql/install/Customer.sql
UTF-8
446
3.03125
3
[]
no_license
CREATE TABLE Customer ( customer_id INT NOT NULL AUTO_INCREMENT, login VARCHAR(50) NOT NULL, email VARCHAR(100) NOT NULL, firstname VARCHAR(50) NOT NULL, lastname VARCHAR(50) NOT NULL, chatting BOOLEAN NOT NULL, smoking BOOLEAN NOT NULL, listening_music BOOLEAN NOT NULL, last_connection DATETIME NOT NULL, /* Indexes */ PRIMARY KEY (customer_id), UNIQUE KEY login_unique (login), UNIQUE KEY email_unique (email) ) ENGINE = MYISAM;
true
f29810097fad371dbb4f643160f498e9daafe64a
SQL
KelwinUTFPR/BLY
/bancotcc.sql
UTF-8
16,102
3.3125
3
[]
no_license
-- -------------------------------------------------------- -- Servidor: 127.0.0.1 -- Versão do servidor: 10.1.36-MariaDB - mariadb.org binary distribution -- OS do Servidor: Win32 -- HeidiSQL Versão: 9.5.0.5196 -- -------------------------------------------------------- /*!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' */; -- Copiando estrutura do banco de dados para tcc CREATE DATABASE IF NOT EXISTS `tcc` /*!40100 DEFAULT CHARACTER SET latin1 */; USE `tcc`; -- Copiando estrutura para tabela tcc.corpo CREATE TABLE IF NOT EXISTS `corpo` ( `codigo_corpo` int(11) NOT NULL AUTO_INCREMENT, `titulo_corpo` varchar(50) DEFAULT NULL, `texto_corpo` varchar(1000) DEFAULT NULL, PRIMARY KEY (`codigo_corpo`) ) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=latin1; -- Copiando dados para a tabela tcc.corpo: ~12 rows (aproximadamente) /*!40000 ALTER TABLE `corpo` DISABLE KEYS */; INSERT INTO `corpo` (`codigo_corpo`, `titulo_corpo`, `texto_corpo`) VALUES (2, 'Consulta de horários', 'Consulte horários disponíveis e compre passagens online aqui!'), (3, 'Horários', 'Consulte todos os horários disponiveis.'), (4, 'Monitoramento em tempo real', 'Permite que o usuário acompanhe o trajeto em tempo real de seu transporte, vendo os pontos por quais o onibûs passou. '), (5, 'QRcode', 'O usuário só precisa abrir o aplicativo, ler o código na catraca e o saldo será descontado da conta. Sem o uso do cartão.'), (6, 'Compra de passagens online', 'Permite que o usuário compre sua passsagem sem ter que sair de casa, só escolher o destino, horário e embarcar.'), (7, 'Consulta de itinerários', 'Exibe todos os preços de passagens em relação as rotas, com todos os valores 100% atualizados e confiáveis.'), (8, 'Consulta de horários', 'Exibe todos os horários disponiveis em qualquer outro dia da semana, mostrando as excessões de domingos e feriados. '), (9, 'Recarga online', 'Permite que o usuário insira saldo em sua conta sem precisar sair de casa, através de cartões de crédito ou boleto.'), (10, 'Qual a situação atual dos usuários de onibûs?', 'Uma pesquisa feita na ETEC de Registro (instituição que abrange alunos de vários municípios do Vale do Ribeira), contou com a participação de 216 pessoas resultou nos seguintes percentuais:'), (11, 'Usuários frequentes (135 pessoas)', ' <blockquote>Cerca de 105 (79.3%) dos entrevistados relataram já ter perdido o horário de seu ônibus uma ou mais de uma vez.</blockquote>\r\n<blockquote>Cerca de 118 (87.4%) dos entrevistados já passaram, ou presenciaram alguém com problemas, no cartão ou na hora de passar na catraca.</blockquote>\r\n<blockquote>Cerca de 91 (67.4%) dos entrevistados relataram ter chego no ponto na hora exata e seu ônibus já tinha passado.</blockquote>'), (12, 'Usuários não frequentes (81 pessoas)', '<blockquote>Cerca de 65 (80.2%) dos entrevistados já ouviram algúem dizer que chegou no ponto na hora exata e o ônibus já tinha passado.</blockquote>\r\n<blockquote>Cerca de 55(67.9%) dos entrevistados conhecem pessoas que perdem o horário de ônibus com frequência.</blockquote>\r\n<blockquote>Cerca de 46 (56.8%) dos entrevistados já ouviram algúem reclamando do sistema de pagamento utilizado nos ônibus.</blockquote>'), (13, 'Conheça o Bly ', 'O aplicativo consiste em fazer com que os usuários do transporte viário observem em tempo real o trajeto do ônibus desejado, recarregue sua conta, consulte rotas, horários e preços. Além de permitir ao usuário passar pela catraca utilizando seu smartphone, através de um QRcode.\r\nComo melhorar o transporte público viário através da tecnologia?\r\n A correria da rotina das pessoas diariamente resulta em atrasos, seja por jovens, adultos, idosos etc... Um simples atraso pode resultar na perda de uma prova importante, de uma consulta que demorou meses para ser marcada ou até mesmo em um dia de trabalho. O projeto foi pensado para evitar percas de horários, permitir ao usuário (a distância) e inovar a forma de pagamento nas catracas, que atualmente é via cartão, o projeto sugere um QRcode, que seria mais eficiente, rápido e prático. \r\n'); /*!40000 ALTER TABLE `corpo` ENABLE KEYS */; -- Copiando estrutura para tabela tcc.login CREATE TABLE IF NOT EXISTS `login` ( `Login_Email` varchar(150) NOT NULL, `Login_Senha` varchar(150) DEFAULT NULL, `Saldo_Cod` int(11) NOT NULL AUTO_INCREMENT, `Usu_Cod` int(11) DEFAULT NULL, PRIMARY KEY (`Login_Email`), KEY `FK_login_saldo` (`Saldo_Cod`), KEY `FK_login_usuario` (`Usu_Cod`), CONSTRAINT `FK_login_usuario` FOREIGN KEY (`Usu_Cod`) REFERENCES `usuario` (`Usuario_Codigo`) ) ENGINE=InnoDB AUTO_INCREMENT=27 DEFAULT CHARSET=latin1; -- Copiando dados para a tabela tcc.login: ~15 rows (aproximadamente) /*!40000 ALTER TABLE `login` DISABLE KEYS */; INSERT INTO `login` (`Login_Email`, `Login_Senha`, `Saldo_Cod`, `Usu_Cod`) VALUES ('123', '123', 26, 5), ('@machaves', '12345', 22, 3), ('Admin', 'Admin', 19, 4), ('bly', '123', 1, 5), ('Igo', '123', 23, 2), ('igor.ferraz99@gmail.com', '123@mudar', 17, 5), ('kelwin@gmail.com', '123', 21, 5), ('kw', 'kw', 15, 5), ('kw3', '123', 20, 5), ('lolo', '123', 25, 5), ('matheus@gmail.com', '1234', 18, 1), ('qwe', 'qwe', 14, 5), ('qwee', 'qwee', 13, 5), ('ramon', '123', 16, 5), ('seila', '12354', 24, 5); /*!40000 ALTER TABLE `login` ENABLE KEYS */; -- Copiando estrutura para tabela tcc.rota CREATE TABLE IF NOT EXISTS `rota` ( `codigo_rota` int(11) NOT NULL AUTO_INCREMENT, `local_saida` varchar(50) NOT NULL DEFAULT '0', `local_destino` varchar(50) NOT NULL DEFAULT '0', `horario_saida` varchar(50) NOT NULL, `horario_chegada` varchar(50) NOT NULL, `preco` double NOT NULL DEFAULT '0', `empresa` varchar(50) DEFAULT NULL, PRIMARY KEY (`codigo_rota`) ) ENGINE=InnoDB AUTO_INCREMENT=94 DEFAULT CHARSET=latin1; -- Copiando dados para a tabela tcc.rota: ~93 rows (aproximadamente) /*!40000 ALTER TABLE `rota` DISABLE KEYS */; INSERT INTO `rota` (`codigo_rota`, `local_saida`, `local_destino`, `horario_saida`, `horario_chegada`, `preco`, `empresa`) VALUES (1, 'Pariquera-Açu', 'Jacupiranga', '05:40', '06:10', 6, 'Valle Sul'), (2, 'Pariquera-Açu', 'Jacupiranga', '06:45', '07:15', 6, 'Valle Sul'), (3, 'Pariquera-Açu', 'Jacupiranga', '08:35', '09:45', 6, 'Princesa dos Campos'), (4, 'Pariquera-Açu', 'Jacupiranga', '08:50', '09:20', 6, 'Valle Sul'), (5, 'Pariquera-Açu', 'Jacupiranga', '11:00', '11:20', 6, 'Valle Sul'), (6, 'Pariquera-Açu', 'Jacupiranga', '13:00', '13:30', 6, 'Valle Sul'), (7, 'Pariquera-Açu', 'Jacupiranga', '15:10', '15:40', 6, 'Valle Sul'), (8, 'Pariquera-Açu', 'Jacupiranga', '17:30', '18:00', 6, 'Valle Sul'), (9, 'Jacupiranga', 'Cajati', '06:25', '06:45', 3.1, 'Princesa dos Campos'), (10, 'Jacupiranga', 'Cajati', '07:05', '07:25', 3.3, 'Valle Sul'), (11, 'Jacupiranga', 'Cajati', '09:20', '09:40', 3.3, 'Valle Sul'), (12, 'Jacupiranga', 'Cajati', '11:20', '11:45', 3.3, 'Valle Sul'), (13, 'Jacupiranga', 'Cajati', '13:30', '13:50', 3.3, 'Valle Sul'), (14, 'Jacupiranga', 'Cajati', '13:30', '13:50', 3.1, 'Princesa dos Campos'), (15, 'Jacupiranga', 'Cajati', '17:50', '18:10', 3.3, 'Valle Sul'), (16, 'Jacupiranga', 'Cajati', '22:40', '23:00', 3.3, 'Valle Sul'), (17, 'Cajati', 'Jacupiranga', '05:55', '06:15', 3.3, 'Valle Sul'), (18, 'Cajati', 'Jacupiranga', '07:30', '07:50', 3.3, 'Valle Sul'), (19, 'Cajati', 'Jacupiranga', '09:45', '10:05', 3.3, 'Valle Sul'), (20, 'Cajati', 'Jacupiranga', '10:00', '10:20', 3.1, 'Princesa dos Campos'), (21, 'Cajati', 'Jacupiranga', '12:00', '12:20', 3.3, 'Valle Sul'), (22, 'Cajati', 'Jacupiranga', '15:00', '15:20', 3.1, 'Princesa dos Campos'), (23, 'Cajati', 'Jacupiranga', '15:45', '16:00', 3.3, 'Valle Sul'), (24, 'Cajati', 'Jacupiranga', '20:05', '20:25', 3.1, 'Princesa dos Campos'), (25, 'Cajati', 'Jacupiranga', '21:30', '21:50', 3.1, 'Princesa dos Campos'), (26, 'Cajati', 'Jacupiranga', '10:00', '11:00', 7.1, 'Valle Sul'), (27, 'Cajati', 'Jacupiranga', '15:00', '16:00', 7.1, 'Valle Sul'), (28, 'Registro', 'Pariquera-Açu', '06:00', '06:40', 6, 'Valle Sul'), (29, 'Registro', 'Pariquera-Açu', '14:00', '14:40', 6, 'Valle Sul'), (30, 'Registro', 'Pariquera-Açu', '08:00', '09:00', 6, 'Valle Sul'), (31, 'Registro', 'Registro', '08:20', '09:00', 6, 'Valle Sul'), (32, 'Registro', 'Pariquera-Açu', '08:35', '09:15', 6, 'Princesa dos Campos'), (33, 'Registro', 'Pariquera-Açu', '13:00', '13:30', 6, 'Valle Sul'), (34, 'Registro', 'Pariquera-Açu', '12:00', '12:40', 6, 'Valle Sul'), (35, 'Registro', 'Pariquera-Açu', '20:05', '21:05', 6, 'Valle Sul'), (36, 'Registro', 'Pariquera-Açu', '11:00', '11:40', 6, 'Valle Sul'), (37, 'Registro', 'Pariquera-Açu', '20:05', '21:05', 6, 'Valle Sul'), (38, 'Registro', 'Pariquera-Açu', '09:50', '10:40', 6, 'Valle Sul'), (39, 'Registro', 'Pariquera-Açu', '11:35', '12:15', 6, 'Valle Sul'), (40, 'Registro', 'Pariquera-Açu', '09:30', '10:00', 6, 'Valle Sul'), (41, 'Registro', 'Pariquera-Açu', '09:00', '09:40 ', 6, 'Valle Sul'), (42, 'Registro', 'Pariquera-Açu', '06:30', '07:10', 6, 'Valle Sul'), (43, 'Registro', 'Pariquera-Açu', '08:00', '08:40', 6, 'Valle Sul'), (44, 'Registro', 'Pariquera-Açu', '10:00', '10:40', 6, 'Valle Sul'), (45, 'Registro', 'Eldorado', '07:45', '08:45', 7.2, 'Valle Sul'), (46, 'Registro', 'Eldorado', '08:20', '09:20', 7.2, 'Valle Sul'), (47, 'Registro', 'Eldorado', '11:15', '12:15', 7.2, 'Valle Sul'), (48, 'Registro', 'Eldorado', '12:20', '13:20', 7.2, 'Valle Sul'), (49, 'Registro', 'Eldorado', '14:30', '15:40', 7.2, 'Valle Sul'), (50, 'Registro', 'Eldorado', '16:45', '17:50', 7.2, 'Valle Sul'), (51, 'Registro', 'Eldorado', '18:10', '19:30', 7.2, 'Valle Sul'), (52, 'Registro', 'Eldorado', '19:00', '20:00', 7.2, 'Valle Sul'), (53, 'Registro', 'Eldorado', '20:10', '21:10', 7.2, 'Valle Sul'), (54, 'Registro', 'Juquiá', '05:00', '05:30', 9.65, 'Valle Sul'), (55, 'Registro', 'Juquiá', '05:00', '05:30', 9.65, 'Valle Sul'), (56, 'Registro', 'Juquiá', '07:00', '07:30', 9.65, 'Valle Sul'), (57, 'Registro', 'Juquiá', '07:15', '07:45', 9.65, 'Valle Sul'), (58, 'Registro', 'Juquiá', '08:00', '08:30', 9.65, 'Valle Sul'), (59, 'Registro', 'Juquiá', '09:00', '09:30', 9.65, 'Valle Sul'), (60, 'Registro', 'Juquiá', '10:00', '10:30', 9.65, 'Valle Sul'), (61, 'Registro', 'Juquiá', '11:00', '11:30', 9.65, 'Valle Sul'), (62, 'Registro', 'Juquiá', '13:00', '13:30', 9.65, 'Valle Sul'), (63, 'Registro', 'Juquiá', '13:30', '14:00', 9.65, 'Valle Sul'), (64, 'Registro', 'Juquiá', '15:00', '15:30', 9.65, 'Valle Sul'), (65, 'Registro', 'Juquiá', '15:00', '15:30', 9.65, 'Valle Sul'), (66, 'Registro', 'Juquiá', '17:30', '18:00', 9.65, 'Valle Sul'), (67, 'Registro', 'Juquiá', '18:00', '18:30', 9.65, 'Valle Sul'), (68, 'Juquiá', 'Registro', '09:00', '09:30', 9, 'Valle Sul'), (69, 'Juquiá', 'Registro', '09:00', '09:30', 9, 'Valle Sul'), (70, 'Juquiá', 'Registro', '11:15', '11:45', 9, 'Valle Sul'), (71, 'Juquiá', 'Registro', '14:50', '15:20', 9, 'Valle Sul'), (72, 'Juquiá', 'Registro', '15:30', '16:00', 9, 'Valle Sul'), (73, 'Juquiá', 'Registro', '13:00', '13:30', 9, 'Valle Sul'), (74, 'Juquiá', 'Registro', '12:50', '13:20', 9, 'Valle Sul'), (75, 'Juquiá', 'Registro', '09:05', '09:35', 9, 'Valle Sul'), (76, 'Juquiá', 'Registro', '11:20', '11:50', 9, 'Valle Sul'), (77, 'Juquiá', 'Registro', '18:00', '18:30', 9, 'Valle Sul'), (78, 'Juquiá', 'Registro', '16:30', '17:00', 9, 'Valle Sul'), (79, 'Juquiá', 'Registro', '22:30', '23:00', 9, 'Valle Sul'), (80, 'Juquiá', 'Registro', '19:30', '20:00', 9, 'Valle Sul'), (81, 'Juquiá', 'Registro', '19:40', '20:10', 9, 'Valle Sul'), (82, 'Jacupiranga', 'Registro', '05:50', '06:45', 6, 'Valle Sul'), (83, 'Jacupiranga', 'Registro', '07:00', '07:45', 5.2, 'Princesa dos Campos'), (84, 'Jacupiranga', 'Registro', '07:05', '07:50', 5.2, 'Princesa dos Campos'), (85, 'Jacupiranga', 'Registro', '07:20', '08:05', 6, 'Valle Sul'), (86, 'Jacupiranga', 'Registro', '07:50', '08:35', 5.2, 'Princesa dos Campos'), (87, 'Jacupiranga', 'Registro', '08:30', '09:15', 5.2, 'Valle Sul'), (88, 'Jacupiranga', 'Registro', '10:00', '10:45', 5.2, 'Princesa dos Campos'), (89, 'Jacupiranga', 'Registro', '11:00', '11:45', 5.2, 'Princesa dos Campos'), (90, 'Jacupiranga', 'Registro', '13:30', '14:15', 5.2, 'Princesa dos Campos'), (91, 'Jacupiranga', 'Registro', '14:30', '15:15', 6, 'Valle Sul'), (92, 'Jacupiranga', 'Registro', '16:00', '16:45', 5.2, 'Princesa dos Campos'), (93, 'Cajati', 'Jacupiranga', '08:00', '08:20', 5, 'Valle Sul'); /*!40000 ALTER TABLE `rota` ENABLE KEYS */; -- Copiando estrutura para tabela tcc.saldo CREATE TABLE IF NOT EXISTS `saldo` ( `Saldo_Codigo` int(11) NOT NULL AUTO_INCREMENT, `Saldo_Valor` double DEFAULT NULL, `Saldo_Passar` varchar(50) DEFAULT NULL, PRIMARY KEY (`Saldo_Codigo`) ) ENGINE=InnoDB AUTO_INCREMENT=27 DEFAULT CHARSET=latin1; -- Copiando dados para a tabela tcc.saldo: ~15 rows (aproximadamente) /*!40000 ALTER TABLE `saldo` DISABLE KEYS */; INSERT INTO `saldo` (`Saldo_Codigo`, `Saldo_Valor`, `Saldo_Passar`) VALUES (1, 150, '0'), (13, 10, '0'), (14, 55, '0'), (15, 21, '0'), (16, 50, '0'), (17, 0, '0'), (18, 0, '0'), (19, 10, '0'), (20, 10, '0'), (21, 10, '0'), (22, 0, '0'), (23, 0, '0'), (24, 15, '0'), (25, 0, '0'), (26, 0, '0'); /*!40000 ALTER TABLE `saldo` ENABLE KEYS */; -- Copiando estrutura para tabela tcc.suporte CREATE TABLE IF NOT EXISTS `suporte` ( `Suporte_Codigo` int(11) NOT NULL AUTO_INCREMENT, `Suporte_Nome_Usuario` varchar(50) DEFAULT NULL, `Suporte_Mensagem` varchar(50) DEFAULT NULL, `Suporte_Email` varchar(50) DEFAULT NULL, PRIMARY KEY (`Suporte_Codigo`) ) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1; -- Copiando dados para a tabela tcc.suporte: ~6 rows (aproximadamente) /*!40000 ALTER TABLE `suporte` DISABLE KEYS */; INSERT INTO `suporte` (`Suporte_Codigo`, `Suporte_Nome_Usuario`, `Suporte_Mensagem`, `Suporte_Email`) VALUES (1, 'sad', 'afaags', 'matheus@gmail.com'), (2, 'sad', 'asfhgfsqa', 'matheus@gmail.com'), (3, 'sad', 'afgagfa', 'mazinho.matheus72@gmail.com'), (4, 'sad', 'afbtyju', 'mazinho.matheus72@gmail.com'), (5, 'asddsa', 'hiudhfahiu', 'matheus@gmail.com'), (6, 'sasa', 'asohiufgiueahf', 'matheus72@gmail.com'); /*!40000 ALTER TABLE `suporte` ENABLE KEYS */; -- Copiando estrutura para tabela tcc.usuario CREATE TABLE IF NOT EXISTS `usuario` ( `Usuario_Codigo` int(11) NOT NULL AUTO_INCREMENT, `Usuario_Nome` varchar(50) DEFAULT NULL, `Usuario_Nascimento` date DEFAULT NULL, `Usuario_Tipo` varchar(50) DEFAULT NULL, `Usuario_CPF` varchar(50) DEFAULT NULL, `Usuario_Foto` varchar(50) NOT NULL DEFAULT '0', `Usuario_CodLogin` varchar(50) DEFAULT NULL, PRIMARY KEY (`Usuario_Codigo`), KEY `Usuario_CodLogin` (`Usuario_CodLogin`), CONSTRAINT `CodLogin` FOREIGN KEY (`Usuario_CodLogin`) REFERENCES `login` (`Login_Email`) ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1; -- Copiando dados para a tabela tcc.usuario: ~5 rows (aproximadamente) /*!40000 ALTER TABLE `usuario` DISABLE KEYS */; INSERT INTO `usuario` (`Usuario_Codigo`, `Usuario_Nome`, `Usuario_Nascimento`, `Usuario_Tipo`, `Usuario_CPF`, `Usuario_Foto`, `Usuario_CodLogin`) VALUES (1, 'Matheus Chaves', '2019-06-05', 'Estudante', '415151', 'avatar', 'matheus@gmail.com'), (2, 'Igor Ferraz', '2019-06-05', 'Estudante', '1651621651', 'avatar', 'Igo'), (3, 'Matheus Alves Chaves', '2019-10-06', 'Empresa', '1889498', 'bostahahahahahah', '@machaves'), (4, 'Administrador', '2019-10-06', 'Suporte', 'Admin', 'avatar', 'Admin'), (5, 'bly', '2019-10-09', 'bly', 'bly', 'bly', 'bly'); /*!40000 ALTER TABLE `usuario` ENABLE KEYS */; /*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */; /*!40014 SET FOREIGN_KEY_CHECKS=IF(@OLD_FOREIGN_KEY_CHECKS IS NULL, 1, @OLD_FOREIGN_KEY_CHECKS) */; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
true
417433f173f71f3c616066e6754445147fbd4601
SQL
Al-ta-iR/yandex.praktikum
/09_ data_extraction/03.sql
UTF-8
590
4.21875
4
[]
no_license
SELECT subq.city, avg(subq.num_flights) AS average_flights FROM (SELECT airports.city AS city, count(flights.flight_id) AS num_flights, extract(DAY FROM flights.arrival_time :: date) AS DAY FROM flights JOIN airports ON airports.airport_code = flights.arrival_airport WHERE (flights.arrival_time :: date < '2018-09-01' AND flights.arrival_time :: date >= '2018-08-01') GROUP BY airports.city, extract(DAY FROM flights.arrival_time :: date)) AS subq GROUP BY subq.city
true
dc7d4d5bb85764e96706b79ca757718178b1cff3
SQL
estagumor/Acme-Santiago
/Cosas aparte/Item 7/Create-Acme-Santiago.sql
UTF-8
12,162
3.234375
3
[]
no_license
start transaction; create database `Acme-Santiago`; use `Acme-Santiago`; create user 'acme-user'@'%' identified by password '*4F10007AADA9EE3DBB2CC36575DFC6F4FDE27577'; create user 'acme-manager'@'%' identified by password '*FDB8CD304EB2317D10C95D797A4BD7492560F55F'; grant select, insert, update, delete on `Acme-Santiago`.* to 'acme-user'@'%'; grant select, insert, update, delete, create, drop, references, index, alter, create temporary tables, lock tables, create view, create routine, alter routine, execute, trigger, show view on `Acme-Santiago`.* to 'acme-manager'@'%'; -- MySQL dump 10.13 Distrib 5.5.29, for Win64 (x86) -- -- Host: localhost Database: Acme-Santiago -- ------------------------------------------------------ -- Server version 5.5.29 /*!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 `administrator` -- DROP TABLE IF EXISTS `administrator`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `administrator` ( `id` int(11) NOT NULL, `version` int(11) NOT NULL, `emailAddress` varchar(255) DEFAULT NULL, `name` varchar(255) DEFAULT NULL, `phoneNumber` varchar(255) DEFAULT NULL, `picture` varchar(255) DEFAULT NULL, `postalAddress` varchar(255) DEFAULT NULL, `surname` varchar(255) DEFAULT NULL, `userAccount_id` int(11) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `UK_idt4b4u259p6vs4pyr9lax4eg` (`userAccount_id`), CONSTRAINT `FK_idt4b4u259p6vs4pyr9lax4eg` FOREIGN KEY (`userAccount_id`) REFERENCES `useraccount` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `administrator` -- LOCK TABLES `administrator` WRITE; /*!40000 ALTER TABLE `administrator` DISABLE KEYS */; INSERT INTO `administrator` VALUES (271,0,'admin@gmail.com','administrador','','','calle S/N, 41012, Sevilla, España','admin',272); /*!40000 ALTER TABLE `administrator` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `chirp` -- DROP TABLE IF EXISTS `chirp`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `chirp` ( `id` int(11) NOT NULL, `version` int(11) NOT NULL, `description` varchar(255) DEFAULT NULL, `postMoment` datetime DEFAULT NULL, `title` varchar(255) DEFAULT NULL, `user_id` int(11) NOT NULL, PRIMARY KEY (`id`), KEY `FK_t10lk4j2g8uw7k7et58ytrp70` (`user_id`), CONSTRAINT `FK_t10lk4j2g8uw7k7et58ytrp70` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `chirp` -- LOCK TABLES `chirp` WRITE; /*!40000 ALTER TABLE `chirp` DISABLE KEYS */; /*!40000 ALTER TABLE `chirp` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `comment` -- DROP TABLE IF EXISTS `comment`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `comment` ( `id` int(11) NOT NULL, `version` int(11) NOT NULL, `pictures` varchar(255) DEFAULT NULL, `rate` int(11) DEFAULT NULL, `text` varchar(255) DEFAULT NULL, `title` varchar(255) DEFAULT NULL, `writeMoment` datetime DEFAULT NULL, `hike_id` int(11) DEFAULT NULL, `owner_id` int(11) NOT NULL, `route_id` int(11) DEFAULT NULL, PRIMARY KEY (`id`), KEY `FK_ife7actoer5ky0yno2i6q80sd` (`hike_id`), KEY `FK_gwrw905k51p92f40d8hadue07` (`owner_id`), KEY `FK_nm3gg9g7209rqs070e7tu7vxb` (`route_id`), CONSTRAINT `FK_nm3gg9g7209rqs070e7tu7vxb` FOREIGN KEY (`route_id`) REFERENCES `route` (`id`), CONSTRAINT `FK_gwrw905k51p92f40d8hadue07` FOREIGN KEY (`owner_id`) REFERENCES `user` (`id`), CONSTRAINT `FK_ife7actoer5ky0yno2i6q80sd` FOREIGN KEY (`hike_id`) REFERENCES `hike` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `comment` -- LOCK TABLES `comment` WRITE; /*!40000 ALTER TABLE `comment` DISABLE KEYS */; /*!40000 ALTER TABLE `comment` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `configurationsystem` -- DROP TABLE IF EXISTS `configurationsystem`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `configurationsystem` ( `id` int(11) NOT NULL, `version` int(11) NOT NULL, `tabooWords` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `configurationsystem` -- LOCK TABLES `configurationsystem` WRITE; /*!40000 ALTER TABLE `configurationsystem` DISABLE KEYS */; INSERT INTO `configurationsystem` VALUES (279,0,'sex,viagra,cialis'); /*!40000 ALTER TABLE `configurationsystem` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `hibernate_sequences` -- DROP TABLE IF EXISTS `hibernate_sequences`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `hibernate_sequences` ( `sequence_name` varchar(255) DEFAULT NULL, `sequence_next_hi_value` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `hibernate_sequences` -- LOCK TABLES `hibernate_sequences` WRITE; /*!40000 ALTER TABLE `hibernate_sequences` DISABLE KEYS */; INSERT INTO `hibernate_sequences` VALUES ('DomainEntity',1); /*!40000 ALTER TABLE `hibernate_sequences` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `hike` -- DROP TABLE IF EXISTS `hike`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `hike` ( `id` int(11) NOT NULL, `version` int(11) NOT NULL, `description` varchar(255) DEFAULT NULL, `destinationCity` varchar(255) DEFAULT NULL, `difficultyLevel` varchar(255) DEFAULT NULL, `length` double DEFAULT NULL, `name` varchar(255) DEFAULT NULL, `originCity` varchar(255) DEFAULT NULL, `pictures` varchar(255) DEFAULT NULL, `route_id` int(11) NOT NULL, PRIMARY KEY (`id`), KEY `FK_j44cid4t625b77xbicl6bawiy` (`route_id`), CONSTRAINT `FK_j44cid4t625b77xbicl6bawiy` FOREIGN KEY (`route_id`) REFERENCES `route` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `hike` -- LOCK TABLES `hike` WRITE; /*!40000 ALTER TABLE `hike` DISABLE KEYS */; /*!40000 ALTER TABLE `hike` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `route` -- DROP TABLE IF EXISTS `route`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `route` ( `id` int(11) NOT NULL, `version` int(11) NOT NULL, `description` varchar(255) DEFAULT NULL, `length` double DEFAULT NULL, `name` varchar(255) DEFAULT NULL, `pictures` varchar(255) DEFAULT NULL, `creator_id` int(11) NOT NULL, PRIMARY KEY (`id`), KEY `UK_gc4s6a2tcpvudn574qv8cy2c1` (`creator_id`), KEY `UK_igp8urvptlxd78wrx5tpph359` (`length`), CONSTRAINT `FK_gc4s6a2tcpvudn574qv8cy2c1` FOREIGN KEY (`creator_id`) REFERENCES `user` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `route` -- LOCK TABLES `route` WRITE; /*!40000 ALTER TABLE `route` DISABLE KEYS */; /*!40000 ALTER TABLE `route` 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, `version` int(11) NOT NULL, `emailAddress` varchar(255) DEFAULT NULL, `name` varchar(255) DEFAULT NULL, `phoneNumber` varchar(255) DEFAULT NULL, `picture` varchar(255) DEFAULT NULL, `postalAddress` varchar(255) DEFAULT NULL, `surname` varchar(255) DEFAULT NULL, `userAccount_id` int(11) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `UK_o6s94d43co03sx067ili5760c` (`userAccount_id`), CONSTRAINT `FK_o6s94d43co03sx067ili5760c` FOREIGN KEY (`userAccount_id`) REFERENCES `useraccount` (`id`) ) ENGINE=InnoDB 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 */; /*!40000 ALTER TABLE `user` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `user_user` -- DROP TABLE IF EXISTS `user_user`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `user_user` ( `User_id` int(11) NOT NULL, `followedUsers_id` int(11) NOT NULL, UNIQUE KEY `UK_odmlga3m6pjgpwp05rc4yysbu` (`followedUsers_id`), KEY `FK_nlnx78x3m38aq2r86t1d5eio1` (`User_id`), CONSTRAINT `FK_nlnx78x3m38aq2r86t1d5eio1` FOREIGN KEY (`User_id`) REFERENCES `user` (`id`), CONSTRAINT `FK_odmlga3m6pjgpwp05rc4yysbu` FOREIGN KEY (`followedUsers_id`) REFERENCES `user` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `user_user` -- LOCK TABLES `user_user` WRITE; /*!40000 ALTER TABLE `user_user` DISABLE KEYS */; /*!40000 ALTER TABLE `user_user` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `useraccount` -- DROP TABLE IF EXISTS `useraccount`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `useraccount` ( `id` int(11) NOT NULL, `version` int(11) NOT NULL, `password` varchar(255) DEFAULT NULL, `username` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `UK_csivo9yqa08nrbkog71ycilh5` (`username`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `useraccount` -- LOCK TABLES `useraccount` WRITE; /*!40000 ALTER TABLE `useraccount` DISABLE KEYS */; INSERT INTO `useraccount` VALUES (272,0,'21232f297a57a5a743894a0e4a801fc3','admin'); /*!40000 ALTER TABLE `useraccount` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `useraccount_authorities` -- DROP TABLE IF EXISTS `useraccount_authorities`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `useraccount_authorities` ( `UserAccount_id` int(11) NOT NULL, `authority` varchar(255) DEFAULT NULL, KEY `FK_b63ua47r0u1m7ccc9lte2ui4r` (`UserAccount_id`), CONSTRAINT `FK_b63ua47r0u1m7ccc9lte2ui4r` FOREIGN KEY (`UserAccount_id`) REFERENCES `useraccount` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `useraccount_authorities` -- LOCK TABLES `useraccount_authorities` WRITE; /*!40000 ALTER TABLE `useraccount_authorities` DISABLE KEYS */; INSERT INTO `useraccount_authorities` VALUES (272,'ADMIN'); /*!40000 ALTER TABLE `useraccount_authorities` ENABLE KEYS */; UNLOCK TABLES; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; -- Dump completed on 2018-08-23 15:18:12 commit;
true
32d10981ccb3821008b50b14ede48ea1669cd080
SQL
nss-day-cohort-16/chinook-richievs91
/SQL Answers/invoice_totals.sql
UTF-8
368
3.5
4
[]
no_license
-- Provide a query that shows the Invoice Total, Customer name, Country and Sale Agent name for all invoices and customers. SELECT Invoice.Total, Customer.FirstName, Customer.LastName, Customer.Country, Employee.FirstName, Employee.LastName FROM Customer, Invoice, Employee WHERE Invoice.CustomerId = Customer.CustomerId AND Customer.SupportRepId = Employee.EmployeeId
true
689360373f3216c836f5b947d509dd20c11b7cb2
SQL
mattyschell/geodatabase-toiler
/src/sql_oracle/upsert_open_cursors.sql
UTF-8
960
3.015625
3
[ "CC0-1.0" ]
permissive
-- https://pro.arcgis.com/en/pro-app/help/data/geodatabases/manage-oracle/update-open-cursors.htm -- the sde.gdb_util.update_open_cursors expects SYSDBA access to run dbms_utility.get_parameter_value -- then loops over any user_schema geodatabases to spray the value into all server_config tables -- we are simpletons here, just inserting the sql, gotta have select dictionary privs -- From an older reference - Therefore, an ArcMap application with 10 layers being -- edited in the document can potentially have 231 cursors open merge into server_config dest using (select upper(name) as prop_name ,NULL as char_prop_value ,value as num_prop_value from v$parameter2 where name = 'open_cursors') src on (dest.prop_name=src.prop_name) when not matched then insert values(src.prop_name,src.char_prop_value, src.num_prop_value) when matched then update set dest.num_prop_value=src.num_prop_value
true
8fc47d1747d1ae182cd11e380a614657f34600c1
SQL
daoleili/springboot-jersey-swagger
/src/main/resources/db/migration/V1.0.1__add_person.sql
UTF-8
276
2.78125
3
[ "Apache-2.0" ]
permissive
CREATE TABLE PERSON ( id integer not null, first_name varchar(255) not null, last_name varchar(255) not null, primary key(id) ); insert into PERSON (id, first_name, last_name) values (1, 'Bright', 'Zheng'); -- alter table student add column remarks varchar(200) null;
true
5dae2f91277f32297407fe719dfba1511d784b48
SQL
ltao01/hotel02
/djin_hotel.sql
UTF-8
14,227
3.046875
3
[]
no_license
/* Navicat MySQL Data Transfer Source Server : djin Source Server Version : 50717 Source Host : localhost:3306 Source Database : k8514hotel Target Server Type : MYSQL Target Server Version : 50717 File Encoding : 65001 Date: 2019-06-11 13:22:20 */ SET FOREIGN_KEY_CHECKS=0; -- ---------------------------- -- Table structure for `in_room_info` -- ---------------------------- DROP TABLE IF EXISTS `in_room_info`; CREATE TABLE `in_room_info` ( `id` int(20) NOT NULL AUTO_INCREMENT COMMENT '主键', `customer_name` varchar(40) DEFAULT NULL COMMENT '客人姓名', `gender` varchar(2) DEFAULT '1' COMMENT '性别(1男 0女)', `is_vip` varchar(2) DEFAULT '0' COMMENT '0普通,1vip', `idcard` varchar(20) DEFAULT NULL COMMENT '身份证号', `phone` varchar(20) DEFAULT NULL COMMENT '手机号', `money` float(10,2) DEFAULT NULL COMMENT '押金', `create_date` datetime DEFAULT NULL COMMENT '入住时间', `room_id` int(20) DEFAULT NULL COMMENT '房间表主键', `status` varchar(2) DEFAULT '1' COMMENT '显示状态:1显示,0隐藏', `out_room_status` varchar(2) DEFAULT '0' COMMENT '退房状态:0未退房 1已经退房', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of in_room_info -- ---------------------------- -- ---------------------------- -- Table structure for `orders` -- ---------------------------- DROP TABLE IF EXISTS `orders`; CREATE TABLE `orders` ( `id` int(20) NOT NULL AUTO_INCREMENT COMMENT '主键', `order_num` varchar(50) DEFAULT NULL COMMENT '订单编号', `order_money` float(10,2) DEFAULT NULL COMMENT '订单总价', `remark` varchar(100) DEFAULT NULL COMMENT '订单备注', `order_status` varchar(2) DEFAULT '0' COMMENT '0未结算,1已结算', `iri_id` int(20) DEFAULT NULL COMMENT '入住信息主键', `create_date` datetime DEFAULT NULL COMMENT '下单时间', `flag` varchar(2) DEFAULT '1' COMMENT '1显示,0隐藏', `order_other` varchar(100) DEFAULT NULL COMMENT '退房时的客人信息时间等等', `order_price` varchar(100) DEFAULT NULL COMMENT '退房时的各种金额', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=25 DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of orders -- ---------------------------- -- ---------------------------- -- Table structure for `role_auth` -- ---------------------------- DROP TABLE IF EXISTS `role_auth`; CREATE TABLE `role_auth` ( `id` int(20) NOT NULL AUTO_INCREMENT COMMENT '主键', `role_id` int(20) DEFAULT NULL COMMENT '角色id', `auth_id` int(20) DEFAULT NULL COMMENT '权限id', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=225 DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of role_auth -- ---------------------------- INSERT INTO `role_auth` VALUES ('1', '1', '1'); INSERT INTO `role_auth` VALUES ('2', '1', '2'); INSERT INTO `role_auth` VALUES ('3', '1', '3'); INSERT INTO `role_auth` VALUES ('4', '1', '4'); INSERT INTO `role_auth` VALUES ('5', '1', '5'); INSERT INTO `role_auth` VALUES ('6', '1', '6'); INSERT INTO `role_auth` VALUES ('7', '1', '11'); INSERT INTO `role_auth` VALUES ('8', '1', '12'); INSERT INTO `role_auth` VALUES ('9', '1', '13'); INSERT INTO `role_auth` VALUES ('10', '1', '21'); INSERT INTO `role_auth` VALUES ('11', '1', '31'); INSERT INTO `role_auth` VALUES ('12', '1', '32'); INSERT INTO `role_auth` VALUES ('13', '1', '41'); INSERT INTO `role_auth` VALUES ('14', '1', '42'); INSERT INTO `role_auth` VALUES ('15', '1', '51'); INSERT INTO `role_auth` VALUES ('16', '1', '52'); INSERT INTO `role_auth` VALUES ('17', '1', '53'); INSERT INTO `role_auth` VALUES ('18', '1', '61'); INSERT INTO `role_auth` VALUES ('19', '2', '1'); INSERT INTO `role_auth` VALUES ('20', '2', '2'); INSERT INTO `role_auth` VALUES ('21', '2', '3'); INSERT INTO `role_auth` VALUES ('22', '2', '4'); INSERT INTO `role_auth` VALUES ('23', '2', '6'); INSERT INTO `role_auth` VALUES ('24', '2', '11'); INSERT INTO `role_auth` VALUES ('25', '2', '12'); INSERT INTO `role_auth` VALUES ('26', '2', '13'); INSERT INTO `role_auth` VALUES ('27', '2', '21'); INSERT INTO `role_auth` VALUES ('28', '2', '31'); INSERT INTO `role_auth` VALUES ('29', '2', '32'); INSERT INTO `role_auth` VALUES ('30', '2', '41'); INSERT INTO `role_auth` VALUES ('31', '2', '42'); INSERT INTO `role_auth` VALUES ('32', '2', '61'); INSERT INTO `role_auth` VALUES ('33', '3', '1'); INSERT INTO `role_auth` VALUES ('34', '3', '2'); INSERT INTO `role_auth` VALUES ('35', '3', '3'); INSERT INTO `role_auth` VALUES ('36', '3', '4'); INSERT INTO `role_auth` VALUES ('37', '3', '11'); INSERT INTO `role_auth` VALUES ('38', '3', '12'); INSERT INTO `role_auth` VALUES ('39', '3', '13'); INSERT INTO `role_auth` VALUES ('40', '3', '21'); INSERT INTO `role_auth` VALUES ('41', '3', '31'); INSERT INTO `role_auth` VALUES ('42', '3', '32'); INSERT INTO `role_auth` VALUES ('43', '3', '41'); -- ---------------------------- -- Table structure for `room_type` -- ---------------------------- DROP TABLE IF EXISTS `room_type`; CREATE TABLE `room_type` ( `id` int(20) NOT NULL AUTO_INCREMENT COMMENT '主键', `room_type_name` varchar(20) DEFAULT NULL COMMENT '房间类型名', `room_price` float(10,2) DEFAULT NULL COMMENT '房间的单价', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=25 DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of room_type -- ---------------------------- INSERT INTO `room_type` VALUES ('1', '单人间', '140.00'); INSERT INTO `room_type` VALUES ('2', '双人间', '180.00'); INSERT INTO `room_type` VALUES ('3', '豪华间', '280.00'); INSERT INTO `room_type` VALUES ('5', '总统套房', '500.00'); INSERT INTO `room_type` VALUES ('6', '钟点房', '100.00'); INSERT INTO `room_type` VALUES ('7', '情侣套房', '599.00'); INSERT INTO `room_type` VALUES ('8', '单人间带窗户', '200.00'); INSERT INTO `room_type` VALUES ('9', '双人间(带窗户)', '240.00'); INSERT INTO `room_type` VALUES ('10', '总统房(带窗户)', '1280.00'); INSERT INTO `room_type` VALUES ('11', '棋牌室', '180.00'); -- ---------------------------- -- Table structure for `rooms` -- ---------------------------- DROP TABLE IF EXISTS `rooms`; CREATE TABLE `rooms` ( `id` int(20) NOT NULL AUTO_INCREMENT COMMENT '主键', `room_num` varchar(10) DEFAULT NULL COMMENT '房间编号', `room_status` varchar(2) DEFAULT '0' COMMENT '房间的状态(0空闲,1已入住,2打扫)', `room_type_id` int(20) DEFAULT NULL COMMENT '房间类型主键', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=24 DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of rooms -- ---------------------------- INSERT INTO `rooms` VALUES ('1', '8201', '0', '1'); INSERT INTO `rooms` VALUES ('2', '8202', '0', '1'); INSERT INTO `rooms` VALUES ('3', '8203', '0', '1'); INSERT INTO `rooms` VALUES ('4', '8204', '0', '2'); INSERT INTO `rooms` VALUES ('5', '8205', '0', '3'); INSERT INTO `rooms` VALUES ('6', '8206', '0', '3'); INSERT INTO `rooms` VALUES ('7', '8207', '0', '2'); INSERT INTO `rooms` VALUES ('8', '8208', '0', '5'); INSERT INTO `rooms` VALUES ('9', '8209', '0', '3'); INSERT INTO `rooms` VALUES ('10', '8210', '0', '5'); INSERT INTO `rooms` VALUES ('11', '8211', '0', '1'); INSERT INTO `rooms` VALUES ('12', '8212', '0', '3'); INSERT INTO `rooms` VALUES ('13', '8301', '0', '5'); INSERT INTO `rooms` VALUES ('14', '8302', '0', '2'); INSERT INTO `rooms` VALUES ('15', '8303', '0', '1'); INSERT INTO `rooms` VALUES ('16', '8304', '0', '3'); INSERT INTO `rooms` VALUES ('17', '8305', '0', '3'); INSERT INTO `rooms` VALUES ('18', '8306', '0', '3'); INSERT INTO `rooms` VALUES ('19', '8307', '0', '6'); -- ---------------------------- -- Table structure for `roomsale` -- ---------------------------- DROP TABLE IF EXISTS `roomsale`; CREATE TABLE `roomsale` ( `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '消费id', `room_num` varchar(100) DEFAULT NULL COMMENT '房间号', `customer_name` varchar(100) DEFAULT NULL COMMENT '客人姓名', `start_date` datetime DEFAULT NULL COMMENT '入住时间', `end_date` datetime DEFAULT NULL COMMENT '退房时间', `days` int(4) DEFAULT NULL COMMENT '天数', `room_price` double(22,0) DEFAULT NULL COMMENT '房屋单价', `rent_price` double(22,0) DEFAULT NULL COMMENT '住宿费', `other_price` double(22,0) DEFAULT NULL COMMENT '其它消费', `sale_price` double(22,0) DEFAULT NULL, `discount_price` double(22,0) DEFAULT NULL COMMENT '优惠金额', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=1003 DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of roomsale -- ---------------------------- -- ---------------------------- -- Table structure for `system_authority` -- ---------------------------- DROP TABLE IF EXISTS `system_authority`; CREATE TABLE `system_authority` ( `id` int(20) NOT NULL AUTO_INCREMENT COMMENT '主键', `authority_name` varchar(20) DEFAULT NULL COMMENT '权限名', `authority_url` varchar(200) DEFAULT '#' COMMENT '权限跳转地址', `parent` int(20) DEFAULT '0' COMMENT '记住上级的主键,0为一级节点', `flag` varchar(2) DEFAULT '0' COMMENT '1超级权限,0普通权限', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=24 DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of system_authority -- ---------------------------- INSERT INTO `system_authority` VALUES ('1', '入住管理', '#', '0', '0'); INSERT INTO `system_authority` VALUES ('2', '订单管理', '#', '0', '0'); INSERT INTO `system_authority` VALUES ('3', '会员管理', '#', '0', '0'); INSERT INTO `system_authority` VALUES ('4', '客房管理', '#', '0', '0'); INSERT INTO `system_authority` VALUES ('5', '系统用户管理', '#', '0', '0'); INSERT INTO `system_authority` VALUES ('6', '客人意见', '#', '0', '0'); INSERT INTO `system_authority` VALUES ('11', '入住信息管理', 'model/toShowInRoomInfo', '1', '0'); INSERT INTO `system_authority` VALUES ('12', '入住信息添加', 'model/toSaveInRoomInfo', '1', '0'); INSERT INTO `system_authority` VALUES ('13', '消费记录', 'model/toShowRoomSale', '1', '0'); INSERT INTO `system_authority` VALUES ('21', '订单查询', 'model/toShowOrders', '2', '0'); INSERT INTO `system_authority` VALUES ('31', '会员信息管理', 'model/toShowVip', '3', '0'); INSERT INTO `system_authority` VALUES ('32', '添加会员', 'model/toSaveVip', '3', '0'); INSERT INTO `system_authority` VALUES ('41', '客房信息管理', 'model/toShowRooms', '4', '0'); INSERT INTO `system_authority` VALUES ('42', '房型信息管理', 'model/toShowRoomType', '4', '0'); INSERT INTO `system_authority` VALUES ('51', '角色信息管理', 'model/toShowRole', '5', '0'); INSERT INTO `system_authority` VALUES ('52', '用户信息管理', 'model/toShowUser', '5', '0'); INSERT INTO `system_authority` VALUES ('53', '添加用户', 'model/toSaveUser', '5', '0'); INSERT INTO `system_authority` VALUES ('61', '客人意见', 'model/toShowIdd', '6', '0'); -- ---------------------------- -- Table structure for `system_roles` -- ---------------------------- DROP TABLE IF EXISTS `system_roles`; CREATE TABLE `system_roles` ( `id` int(20) NOT NULL AUTO_INCREMENT COMMENT '主键', `role_name` varchar(40) DEFAULT NULL COMMENT '角色名', `create_date` datetime DEFAULT NULL COMMENT '角色创建时间', `status` varchar(2) DEFAULT '0' COMMENT '角色禁用启用状态,1启用,0禁用', `flag` varchar(2) DEFAULT '0' COMMENT '1超級角色 0普通角色', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of system_roles -- ---------------------------- INSERT INTO `system_roles` VALUES ('1', '超级管理员', '2019-04-29 14:19:59', '1', '1'); INSERT INTO `system_roles` VALUES ('2', '主管', '2019-05-05 15:04:35', '1', '0'); INSERT INTO `system_roles` VALUES ('3', '前台', '2019-04-30 16:56:47', '1', '0'); -- ---------------------------- -- Table structure for `system_user` -- ---------------------------- DROP TABLE IF EXISTS `system_user`; CREATE TABLE `system_user` ( `id` int(20) NOT NULL AUTO_INCREMENT COMMENT '主键', `username` varchar(40) DEFAULT NULL COMMENT '账号', `pwd` varchar(40) DEFAULT NULL COMMENT '密码', `create_date` datetime DEFAULT NULL COMMENT '创建时间', `use_status` varchar(2) DEFAULT '1' COMMENT '启用状态:1启用,0禁用', `is_admin` varchar(2) DEFAULT '0' COMMENT '1超级管理员,0普通管理员', `role_id` int(20) DEFAULT NULL COMMENT '角色id', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of system_user -- ---------------------------- INSERT INTO `system_user` VALUES ('1', 'admin', 'e10adc3949ba59abbe56e057f20f883e', '2018-09-20 14:20:19', '1', '1', '1'); INSERT INTO `system_user` VALUES ('13', 'lisi', '4297f44b13955235245b2497399d7a93', '2019-04-29 14:45:50', '1', '0', '2'); INSERT INTO `system_user` VALUES ('15', 'zhangsan', '4297f44b13955235245b2497399d7a93', '2019-05-05 16:01:31', '1', '0', '3'); -- ---------------------------- -- Table structure for `vip` -- ---------------------------- DROP TABLE IF EXISTS `vip`; CREATE TABLE `vip` ( `id` int(20) NOT NULL AUTO_INCREMENT COMMENT '主键', `vip_num` varchar(50) DEFAULT NULL COMMENT '会员卡编号', `customer_name` varchar(40) DEFAULT NULL COMMENT '会员姓名', `vip_rate` float(2,1) DEFAULT '0.9' COMMENT '1~9折', `idcard` varchar(20) DEFAULT NULL COMMENT '会员身份证', `phone` varchar(20) DEFAULT NULL COMMENT '手机号码', `create_date` datetime DEFAULT NULL COMMENT '会员办理日期', `gender` varchar(2) DEFAULT '1' COMMENT '性别:1男 0女', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of vip -- ---------------------------- INSERT INTO `vip` VALUES ('1', '2019061010230302', '莫容龙城', '0.9', '421123198912120012', '13212321232', '2019-06-10 10:23:03', '1'); INSERT INTO `vip` VALUES ('2', '2019061010244502', '独角大仙', '0.9', '421234199909090099', '13212321232', '2019-06-10 10:24:45', '1');
true
bff4a9f30c027741dbc50c6c168d0afd48d9a85a
SQL
GuUrban/SQL-2013-course-notes-
/exam4 social-network modification.sql
UTF-8
1,818
3.90625
4
[]
no_license
--Exam4 , data link:https://lagunita.stanford.edu/c4x/DB/SQL/asset/socialdata.html --Movie ( mID, title, year, director ) --English: There is a movie with ID number mID, a title, a release year, and a director. --Reviewer ( rID, name ) --English: The reviewer with ID number rID has a certain name. --Rating ( rID, mID, stars, ratingDate ) --English: The reviewer rID gave the movie mID a number of stars rating (1-5) on a certain ratingDate. --Q1: It's time for the seniors to graduate. Remove all 12th graders from Highschooler. --Answer : delete from Highschooler where grade=12; --Q2: If two students A and B are friends, and A likes B but not vice-versa, remove the Likes tuple. --Answer: delete from Likes where ID1 in ( select ID1 from (select Likes.ID1 from Friend, Likes where Friend.ID1=Likes.ID1 and Friend.ID2=Likes.ID2 except select L1.ID1 from Likes L1, Likes L2 Where L2.ID1 =L1.ID2 and L2.ID2=L1.ID1) ); --Q2: If two students A and B are friends, and A likes B but not vice-versa, remove the Likes tuple. --Answer: delete from Likes where ID1 in ( select ID1 from (select Likes.ID1 from Friend, Likes where Friend.ID1=Likes.ID1 and Friend.ID2=Likes.ID2 except select L1.ID1 from Likes L1, Likes L2 Where L2.ID1 =L1.ID2 and L2.ID2=L1.ID1) ); --Q3: For all cases where A is friends with B, and B is friends with C, add a new friendship for the pair A and C. Do not add duplicate friendships, friendships that already exist, or friendships with oneself. (This one is a bit challenging; congratulations if you get it right.) --Answer: insert into Friend select F1.ID1, F2.ID2 from Friend F1, Friend F2 where F1.ID2=F2.ID1 and F1.ID1<>F2.ID2 except --if friendship records exist select * from Friend ;
true
980449deb7824e7817774e064a4446702c4d6e09
SQL
ivaneyvieira/engEstoque
/src/main/resources/sqlSaci/findNotaEntradaInfo.sql
UTF-8
793
3.171875
3
[]
no_license
SELECT N.invno, N.storeno, CAST(nfname AS CHAR) AS numero, invse AS serie, N.date, N.bits & POW(2, 4) != 0 AS cancelado, CASE WHEN invse = '66' THEN 'ACERTO_E' WHEN type = 0 THEN 'COMPRA' WHEN type = 1 THEN 'TRANSFERENCIA_E' WHEN type = 2 THEN 'DEV_CLI' WHEN type = 8 THEN 'RECLASSIFICACAO_E' WHEN type = 10 AND N.remarks LIKE 'DEV%' THEN 'DEV_CLI' ELSE 'NOTA_E' END AS tipo, '' AS area FROM sqldados.inv AS N WHERE N.storeno = :storeno AND N.nfname = :nfno AND N.invse = :nfse ORDER BY date DESC LIMIT 1
true
61e210eb033d9cce63500da1d1cf6ad9ae3d3a49
SQL
NikitaMandlik12/Data-Warehouse-Project
/FIT5195_A2_Aggregation 2_V1.sql
UTF-8
14,290
3.875
4
[]
no_license
---Creating star schema for property with Aggregation level 2 --Creating VisitTime2DIM dimension Drop table visitTime2DIM; Create table VisitTime2DIM as select Distinct to_char(VISIT_DATE, 'DD-MM-YYYY') as VisitDate from visit; select * from visitTime2DIM; --Creating property2DIM dimension Drop table Property2DIM; Create table Property2DIM as select PROPERTY_ID, to_char(PROPERTY_DATE_ADDED, 'MM') as Month, to_char(PROPERTY_DATE_ADDED, 'YYYY') as Year, PROPERTY_TYPE from property; select * from Property2DIM; --Creating Advert2DIM dimension Drop table Advert2DIM; Create table Advert2DIM as select * from advertisement; select * from Advert2DIM; --Creating Advertise_property2DIM Drop table Advertise_property2DIM; Create table Advertise_property2DIM as select ADVERT_ID, PROPERTY_ID From Property_Advert; select * from advertise_property2dim; --Create TempSeasonDIM dimension Drop table TempSeason2DIM; Create table TempSeason2DIM as select to_char(VISIT_DATE, 'MM') as Visit_Month from Visit; Alter table TempSeason2DIM add SeasonID number(2); Alter table TempSeason2DIM add Season_type varchar(20); update TempSeason2DIM set SeasonID = 1, season_type = 'Summer' where visit_month >'01' and visit_month <= '03'; update TempSeason2DIM set SeasonID = 2, season_type = 'Autumn' where visit_month >'03' and visit_month <= '06'; update TempSeason2DIM set SeasonID = 3, season_type = 'Winter' where visit_month > '06' and visit_month <= '09'; update TempSeason2DIM set SeasonID = 4, season_type = 'Spring' where visit_month > '09' and visit_month <= '12'; ---Creating SeasonDIM dimension Drop table SeasonDIM; Create table SeasonDIM as Select Distinct SeasonID, Season_type from TempSeason2DIM; select * from SeasonDIM; ---Create TempPropertyFact fact dimension drop table TempProperty2Fact; Create table TempProperty2Fact as select to_char(a.VISIT_DATE, 'MMDDYYYY') || client_person_id as VisitID, to_char(a.VISIT_DATE, 'MM-DD-YYYY') as VisitDate, to_char(a.VISIT_DATE, 'MM') as Visit_Month, b.property_type, b.property_date_added, c.advert_name, d.advert_id, d.property_id from Visit a, Property b, Advertisement c, Property_advert d where a.property_id = b.property_id and d.property_id = b.property_id and d.advert_id = c.advert_id; Alter table TempProperty2Fact add SeasonID number(2); Alter table TempProperty2Fact add Season_type Varchar(20); update TempProperty2Fact set SeasonID = 1, season_type = 'Summer' where visit_month >'01' and visit_month <= '03'; update TempProperty2Fact set SeasonID = 2, season_type = 'Autumn' where visit_month >'03' and visit_month <= '06'; update TempProperty2Fact set SeasonID = 3, season_type = 'Winter' where visit_month > '06' and visit_month <= '09'; update TempProperty2Fact set SeasonID = 4, season_type = 'Spring' where visit_month > '09' and visit_month <= '12'; --Creating propertyFact fact dimension Drop table Property2Fact; Create table Property2Fact as Select visitdate, seasonID, Property_id, count(property_id) as Total_no_of_property, Sum(visitid) as Total_no_of_visit, Count(Visitid) as No_of_visit from tempproperty2fact group by Visitdate, seasonID, property_id; select * from Property2Fact; -------------------------------------------------------------------------------- --Creating State2DIM dimension Drop table State2DIM; create table state2DIM as select state_code, state_name from state; select * from state2DIM; --Creating Feature2DIM dimension DROP table TempFeature2DIM; DROP table Feature2DIM; create table tempfeature2DIM as select a.property_id, count(a.Feature_code) as count from property_feature a, property b where a.property_id = b.property_id Group by a.property_id; Alter table tempfeature2DIM add feature_id number(3); Alter table tempfeature2DIM add feature_type varchar(20); update tempfeature2DIM set feature_id = 1, feature_type = 'Very Basic' where count < 10; update tempfeature2DIM set feature_id = 2, feature_type = 'Standard' where count >= 10 and count <= 20; update tempfeature2DIM set feature_id = 3, feature_type = 'Luxurious' where count > 20; Create table feature2DIM as select distinct feature_id, feature_type from tempfeature2DIM; select * from Feature2DIM; --Creating Property2DIM dimension Drop Table Property2DIM; create table property2DIM as select property_id,to_char(property_date_added,'mm') as month,to_char(property_date_added,'yyyy')as year,property_type from property; select * from property2DIM; --Creating TempSales2Fact drop table Tempsales2Fact; create table Tempsales2Fact as select p.property_id , st.state_code, count(f.feature_code) as count, to_char(s.sale_date, 'YYYY') as Year, s.price, s.sale_id from property p, state st, property_feature f, sale s, address a, postcode p where p.property_id = f.property_id and f.property_id = s.property_id and p.address_id = a.address_id and a.postcode = p.postcode and p.state_code = st.state_code group by p.property_id , st.state_code,to_char(s.sale_date, 'YYYY'), s.price, s.sale_id; Alter table Tempsales2Fact add feature_id number(3); Alter table Tempsales2Fact add feature_type varchar(20); update Tempsales2Fact set feature_id = 1, feature_type = 'Very Basic' where count < 10; update Tempsales2Fact set feature_id = 2, feature_type = 'Standard' where count >= 10 and count <= 20; update Tempsales2Fact set feature_id = 3, feature_type = 'Luxurious' where count > 20; --Creating Sales2Fact table Drop table Sales2Fact; Create table sales2Fact as select t.property_id, t.state_code, t.feature_id, t.year, count(sale_id) as total_sales_count, sum(price) as total_sales from Tempsales2Fact t group by t.property_id,t.state_code,t.feature_id, t.year; select * from Sales2Fact; --Create Postcode2DIM dimension Drop table Postcode2DIM; create table postcode2DIM as select postcode,state_code from postcode; select * from postcode2dim; --Create Suburb2DIM dimension Drop table Suburb2DIM; create table suburb2DIM as select p.postcode, a.suburb from postcode p , address a where a.postcode= p.postcode; select * from Suburb2DIM; --Create RentHis2Dim Dimension Drop table RentHis2DIM; create table rentHis2DIM as select property_id, rent_id, RENT_START_DATE , RENT_END_DATE , price from rent; select * from RentHis2DIM; --Create Property_scale2DIM dimension; Drop table Property_Scale2DIM; create table property_scale2DIM( scale_id number, scale_desc varchar(20)); insert into property_scale2DIM values ('1','Extra Small'); insert into property_scale2DIM values ('2','Small'); insert into property_scale2DIM values ('3','Medium'); insert into property_scale2DIM values ('4','Large'); insert into property_scale2DIM values ('5','Extra Large'); select * from Property_Scale2DIM; --Creating Rent_year2DIM dimension Drop table Year2DIM; create table Year2DIM as (select distinct to_char(rent_start_date,'yyyy') as year from rent Union select distinct to_char(Sale_date, 'YYYY') as year from sale) ; Select * from Year2DIM; --Creating tempRent2Fact table drop table tempRent2Fact; create table tempRent2Fact as select p.property_id, po.postcode, to_char(rn.rent_start_date,'yyyy') as year, p.property_no_of_bedrooms as rooms, rn.rent_id, rn.price, count(f.feature_code) as count from property p, postcode po, property_feature f, address a, rent rn where p.property_id = f.property_id and f.property_id = rn.property_id and p.address_id = a.address_id and a.postcode = po.postcode group by p.property_id, po.postcode, to_char(rn.rent_start_date,'yyyy'), p.property_no_of_bedrooms, rn.rent_id, rn.price; ----- alter table temprent2Fact add (scale_id numeric); alter table temprent2Fact add (scale_desc varchar(20)); update temprent2Fact set scale_id = '1',scale_desc = 'Extra Small'where rooms <= '1'; update temprent2Fact set scale_id = '2',scale_desc = 'Small' where rooms <= '03' and rooms >= '02'; update temprent2Fact set scale_id = '3',scale_desc = 'Medium' where rooms <= '06' and rooms >= '04'; update temprent2Fact set scale_id = '4',scale_desc = 'Large' where rooms <= '10' and rooms >= '07'; update temprent2Fact set scale_id = '5',scale_desc = 'Extra Large' where rooms > '10'; Alter table temprent2Fact add feature_id number(3); Alter table temprent2Fact add feature_type varchar(20); update temprent2Fact set feature_id = 1, feature_type = 'Very Basic' where count < 10; update temprent2Fact set feature_id = 2, feature_type = 'Standard' where count >= 10 and count <= 20; update temprent2Fact set feature_id = 3, feature_type = 'Luxurious' where count > 20; ---Creating Rent2Fact table Drop table Rent2Fact; create table Rent2Fact as select t.property_id, t.postcode, t.feature_id, t.year, t.scale_id, count(t.rent_id) as total_no_of_rent, sum(t.price) as no_of_price from temprent2Fact t group by t.property_id, t.postcode, t.feature_id, t.year, t.scale_id; select * from Rent2Fact; ----------------------------------------------------------------------------------------- --Creating office2DIM Dimension drop table Office2DIM; create table Office2DIM as select distinct office_id, office_name from office; select * from Office2DIM; --- Creating Agentgender2DIM dimension drop table Agentgender2DIM; create table Agentgender2DIM as select distinct Gender as gender_type from person; alter table Agentgender2DIM add gender_id number(2); update Agentgender2DIM set gender_id = 1 Where gender_type = 'Male' ; update Agentgender2DIM set gender_id = 2 Where gender_type = 'Female' ; select * from agentgender2dim; --- Creating TempOfficeType2DIM drop table TempOfficetype2DIM; create table TempOfficetype2DIM as select Count(person_id) as number_of_employee, office_id from agent_office group by office_id ; alter table TempOfficetype2DIM add office_type varchar(20); alter table TempOfficetype2DIM add office_typeid number(2); update TempOfficetype2DIM set office_typeid = 1 , office_type = 'Small' Where number_of_employee < 4; update TempOfficetype2DIM set office_typeid = 2 , office_type = 'Medium' Where number_of_employee >= 4 and number_of_employee < 12 ; update TempOfficetype2DIM set office_typeid = 3 , office_type = 'Big' Where number_of_employee > 12 ; --Creating office_type2DIM dimension drop table Office_type2DIM; Create Table Office_type2DIM as Select Distinct office_typeid , office_type from TempOfficetype2DIM; select * from Office_type2DIM; --Create TempAgent2fact Drop table TempAgent2fact; Create table TempAgent2fact as select distinct b.person_id as Agent_Id, b.Salary, o.office_id, o.office_name, Count(a.person_id) as number_of_employee, p.Gender as gender_type from office o, person p, agent_office a, agent b where o.office_id = a.office_id and a.person_id = b.person_id and p.person_id = b.person_id group by b.person_id, b.Salary, o.office_id, o.office_name, p.Gender ; alter table TempAgent2fact add gender_id number(2); update TempAgent2fact set gender_id = 1 Where gender_type = 'Male' ; update TempAgent2fact set gender_id = 2 Where gender_type = 'Female' ; -- alter table TempAgent2fact add officetype varchar(20); alter table TempAgent2Fact add officetype_id number(2); update TempAgent2Fact set officetype_id = 1 , officetype = 'Small' Where number_of_employee < 4; update TempAgent2Fact set officetype_id = 2 , officetype = 'Medium' Where number_of_employee >= 4 and number_of_employee < 12 ; update TempAgent2Fact set officetype_id = 3 , officetype = 'Big' Where number_of_employee > 12 ; ---Create final Agent2Fact table Drop table Agent2Fact; Create table Agent2Fact as Select officetype_id, Gender_ID, office_id, Count(Agent_id) as Total_no_Agents, Count(Salary) as Total_salary from TempAgent2Fact group by officetype_id, Gender_ID, office_id; select * from Agent2Fact; --------------------------------------------------------------------------------------------------------- --Creating TempBudget2DIM dimension Drop table TempBudget2DIM; Create table TempBudget2DIM as select min_budget, max_budget from Client; Alter table TempBudget2DIM add BudgetID number (2); Alter table TempBudget2DIM add BudgetType Varchar(20); update TempBudget2DIM set BudgetID = 1 , BudgetType= 'Low' Where Min_budget > 0 and Max_budget <= 1000 ; update TempBudget2DIM set BudgetID = 2 , BudgetType= 'Medium' Where Min_budget >= 1001 and Max_budget <= 100000 ; update TempBudget2DIM set BudgetID = 3 , BudgetType= 'High' Where Min_budget >= 100001 and Max_budget <= 10000000; --Creating Budget2DIM dimension Drop table Budget2DIM; Create table Budget2DIM as Select Distinct BudgetID, BudgetType from TempBudget2DIM; select * from Budget2DIM; Delete from Budget2DIm where BudgetId is null; --Creating TempClientFact table Drop table TempClient2Fact; Create table TempClient2Fact as select C.min_budget, C.max_budget, C.Person_id, A.Year , A.Client From (select distinct to_char(rent_start_date,'YYYY') as Year, Client_person_ID as Client from rent Union Select Distinct to_char(sale_date, 'YYYY') as Year , Client_person_id as Client from sale) A inner join Client C On A.Client = C.person_id; Alter table TempClient2Fact add BudgetID number (2); Alter table TempClient2Fact add BudgetType Varchar(20); update TempClient2Fact set BudgetID = 1 , BudgetType= 'Low' Where Min_budget > 0 and Max_budget <= 1000 ; update TempClient2Fact set BudgetID = 2 , BudgetType= 'Medium' Where Min_budget >= 1001 and Max_budget <= 100000 ; update TempClient2Fact set BudgetID = 3 , BudgetType= 'High' Where Min_budget >= 100001 and Max_budget <= 10000000; select * from TempClient2Fact; --Creating Client2Fact table Drop table Client2Fact; create table Client2fact as select BudgetID, Year, count(client) as Total_no_of_clients from tempclient2fact group by BudgetID, Year; select * from Client2Fact;
true
08bc3abe90d6de6522318c87346d5c7529acef39
SQL
kevharvell/StockLikes
/database/DMQ.sql
UTF-8
4,322
4.28125
4
[]
no_license
/* GAMING STOCK LIKES Description: Gaming Stock Likes is a database centered around gaming companies that hopefully will be utilized one day as a stock market sentiment indicator. A stock market sentiment indicator can be used to see how a group feels about a certain market. In our case, we will be using various gaming companies’ Twitter pages to sum up Likes, Retweets, and Comments in order to create a “buzz” factor. The higher the buzz factor, the more popular and trending a gaming company is. Additionally, we will feature games released by each company along with stock ticker data such as the last closing price of the stock. Authors: Kevin Harvell and Will Darnell Last Update: 10/26/2018 */ --for all the id-related stuff, would that be this.id selection from the JS? in the sample file --all of it is referred to by "from dropdown menu" or something like that. --show all gaming companies SELECT comp_name FROM gaming_company; --show all stocks SELECT companyID, ticker, price_close FROM stock; --show all twitter pages SELECT companyID, buzz, url FROM twitter; --show all games SELECT companyID, game_name FROM game; --show all genres SELECT category FROM genre; <<<<<<< HEAD --this is for the display on Home SELECT gaming_company.comp_name, stock.ticker, stock.price_close, twitter.url, twitter.buzz, game.game_name FROM (((gaming_company INNER JOIN stock ON gaming_company.id = stock.companyID) INNER JOIN twitter ON gaming_company.id = twitter.companyID) INNER JOIN game ON gaming_company.id = game.companyID); --this selects games with a high rating SELECT game_name, rating FROM game WHERE game.rating >= 2; --add a new gaming company INSERT INTO gaming_company (comp_name) values (:comp_name); --add a new stock INSERT INTO stock (ticker, date, price_close, companyID) values (:ticker, :date, :price_close, :id_value); ======= --this is for the displaying Gaming Companies on Home SELECT gaming_company.comp_name, stock.ticker, stock.price_close, twitter.url, twitter.buzz, game.game_name FROM (((gaming_company >>>>>>> master INNER JOIN stock ON gaming_company.id = stock.companyID) INNER JOIN twitter ON gaming_company.id = twitter.companyID) INNER JOIN game ON gaming_company.id = game.companyID); <<<<<<< HEAD --add a new twitter page INSERT INTO twitter (date, url, buzz, companyID) values (:date, :url, :buzz, :id_value); ======= --this selects games with a high rating SELECT game_name, rating FROM game WHERE game.rating >= 2; --add a new gaming company INSERT INTO gaming_company (comp_name) values (:comp_name); >>>>>>> master --add a new stock INSERT INTO stock (ticker, date_recorded, price_close, companyID) values (:ticker, :date, :price_close, :id_value); --add a new twitter page INSERT INTO twitter (date_recorded, url, buzz, companyID) values (:date, :url, :buzz, :id_value); --add a new game INSERT INTO game (game_name, release_date, rating, companyID) values (:gameName, :date, :rating, :companyID_value); <<<<<<< HEAD --add a new genre INSERT INTO genre (category) values (:category); ======= --add a new genre INSERT INTO genre (category) values (:category); >>>>>>> master --edit gaming company UPDATE gaming_company SET comp_name = :comp_name WHERE id = :gaming_company_ID_from_input; --edit stock UPDATE stock SET ticker = :ticker_value, date_recorded = :date, price_close = :price_close, buzz = :buzz, WHERE id = :stock_ID_from_input; --edit twitter page UPDATE twitter SET date_recorded = :date_value, url = :url, buzz = :buzz, WHERE id = :twitter_ID_from_input; --edit game UPDATE game SET game_name = :gameName, release_date = :date, rating = :rating WHERE id = :game_id_input; --delete gaming company DELETE FROM gaming_company WHERE id = :gaming_company_ID_from_selection; --delete stock DELETE FROM stock WHERE id = :stock_ID_from_selection; --delete twitter page DELETE FROM twitter WHERE id = :twitter_ID_from_selection; --delete game DELETE FROM game WHERE id = :game_name_selection; --delete genre DELETE FROM genre WHERE id = :genre_from_selection; --delete entry in game_genre table <<<<<<< HEAD DELETE FROM game_genre WHERE gameID = :game_name_selection and genreID = :genre_from_selection; ======= DELETE FROM game_genre WHERE gameID = :game_name_selection and genreID = :genre_from_selection; >>>>>>> master
true
69aa557f739f970b4789d3d77ec042c15206ff54
SQL
buzgarandrei/booking
/sql/FindRooms.sql
UTF-8
1,882
4.03125
4
[]
no_license
select r.id, /* r.available, r.id_hotel, r.nr_of_adults, r.nr_of_kids, r.id_room_description*/ p.amount, p.start_date, p.end_date, CASE WHEN '2019-12-17' >= p.start_date AND '2020-01-02' >= p.end_date THEN DATEDIFF(p.end_date, '2019-12-17') + 1 WHEN '2019-12-17' <= p.start_date AND '2020-01-02' >= p.end_date THEN DATEDIFF(p.end_date, p.start_date) + 1 WHEN '2019-12-17' <= p.start_date AND '2020-01-02' <= p.end_date THEN DATEDIFF('2020-01-02', p.start_date) + 1 END as no_of_days, ( SELECT CASE WHEN '2019-12-17' >= p.start_date AND '2020-01-02' >= p.end_date THEN DATEDIFF(p.end_date, '2019-12-17') WHEN '2019-12-17' <= p.start_date AND '2020-01-02' >= p.end_date THEN DATEDIFF(p.end_date, p.start_date) WHEN '2019-12-17' <= p.start_date AND '2020-01-02' <= p.end_date THEN DATEDIFF('2020-01-02', p.start_date) END FROM price pp WHERE pp.id = p.id ) * p.amount from rooms r inner join hotels h on r.id_hotel = h.id inner join hotel_facilities hf on h.id = hf.id_hotel inner join facility hfacility on hf.id_facility = hfacility.id inner join room_facility rf on r.id = rf.id_room inner join facility rfacility on rf.id_facility = rfacility.id inner join price p on r.id = p.id_room where r.available = 1 and r.nr_of_adults = 2 and r.nr_of_kids = 2 and h.city = 'Cluj-Napoca' and hfacility.facility_name = 'POOL' and rfacility.facility_name = 'WIFI' and (p.start_date between '2020-06-28' and '2020-07-08' or p.end_date between '2019-06-28' and '2020-07-08') /*group by r.id having () */
true
9ecb59dc8df97df88529787164f53d169e445f41
SQL
macgibbons/SQL_Mastery_Queries-
/book2/Chapter 4/Chapter_4.sql
UTF-8
2,020
4.5625
5
[]
no_license
-- Produce a report that lists every dealership, --the number of purchases done by each, and the number of leases done by each SELECT d.business_name, st.name, COUNT(s.sale_id) as number_of_sales FROM dealerships d JOIN sales s ON s.dealership_id = d.dealership_id JOIN salestypes st ON s.sales_type_id = st.sales_type_id GROUP BY d.dealership_id, st.sales_type_id ORDER BY d.dealership_id; -- What is the most popular vehicle make in terms of number of sales? SELECT ma.name, COUNT(s.sale_id) AS number_of_sales FROM sales s JOIN salestypes st ON st.sales_type_id = s.sales_type_id JOIN vehicles v ON s.vehicle_id = v.vehicle_id JOIN vehicletypes vt ON v.vehicle_type_id = vt.vehicle_type_id JOIN vehiclemakes ma ON vt.make_id = ma.vehicle_make_Id GROUP BY ma.vehicle_make_Id ORDER BY COUNT(s.sale_id) DESC -- Which employee type sold the most of that make? SELECT et.name, COUNT(s.employee_id) FROM sales s JOIN vehicles v ON s.vehicle_id = v.vehicle_id JOIN vehicletypes vt ON v.vehicle_type_id = vt.vehicle_type_id JOIN vehiclemakes ma ON vt.make_id = ma.vehicle_make_Id JOIN employees e ON s.employee_id = e.employee_id JOIN employeetypes et ON et.employee_type_id = e.employee_type_id WHERE ma.vehicle_make_id = ( SELECT ma.vehicle_make_id FROM sales s JOIN salestypes st ON st.sales_type_id = s.sales_type_id JOIN vehicles v ON s.vehicle_id = v.vehicle_id JOIN vehicletypes vt ON v.vehicle_type_id = vt.vehicle_type_id JOIN vehiclemakes ma ON vt.make_id = ma.vehicle_make_Id GROUP BY ma.vehicle_make_Id ORDER BY COUNT(s.sale_id) DESC LIMIT 1 ) GROUP BY et.employee_type_id ORDER BY COUNT(s.employee_id) DESC
true
a6eb8ebc6782c97b3cc39905efe3807de82355f1
SQL
aurreco-uga/service-dataset-access
/src/main/resources/sql/select/studyaccess/providers/by-dataset.sql
UTF-8
611
3.65625
4
[]
no_license
SELECT p.* , a.email , ( SELECT value FROM useraccounts.account_properties WHERE user_id = p.user_id AND key = 'first_name' ) first_name , ( SELECT value FROM useraccounts.account_properties WHERE user_id = p.user_id AND key = 'last_name' ) last_name , ( SELECT value FROM useraccounts.account_properties WHERE user_id = p.user_id AND key = 'organization' ) organization FROM studyaccess.providers p INNER JOIN useraccounts.accounts a ON p.user_id = a.user_id WHERE p.dataset_id = ? ORDER BY p.provider_id OFFSET ? ROWS FETCH NEXT ? ROWS ONLY
true
78bbe52e6a5e63b659dc20c8d3862a7d52bdce64
SQL
isiahmacs/SECURDE
/SECURDE_MP/PokeMerch DB/pokemerch_transactions.sql
UTF-8
2,133
2.96875
3
[]
no_license
-- MySQL dump 10.13 Distrib 5.7.17, for Win64 (x86_64) -- -- Host: localhost Database: pokemerch -- ------------------------------------------------------ -- Server version 5.7.19-log /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -- -- Table structure for table `transactions` -- DROP TABLE IF EXISTS `transactions`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `transactions` ( `transactionid` int(11) NOT NULL AUTO_INCREMENT, `productid` int(11) DEFAULT NULL, `userid` int(11) DEFAULT NULL, `quantity` int(11) DEFAULT NULL, `confirmed` int(2) DEFAULT '0', PRIMARY KEY (`transactionid`) ) ENGINE=InnoDB AUTO_INCREMENT=31 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `transactions` -- LOCK TABLES `transactions` WRITE; /*!40000 ALTER TABLE `transactions` DISABLE KEYS */; INSERT INTO `transactions` VALUES (20,1,38,2,1),(23,3,0,1,1),(24,1,0,1,1),(25,3,38,1,1),(26,1,0,1,1),(28,1,0,1,0); /*!40000 ALTER TABLE `transactions` ENABLE KEYS */; UNLOCK TABLES; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; -- Dump completed on 2018-03-07 0:36:02
true
2276b95e784c74d9bba4bed92509d4d34cbbd674
SQL
kaan3434/gvindelen
/ESTD/script/MetaData/QUERIES.sql
UTF-8
8,154
3
3
[]
no_license
INSERT INTO QUERIES (QUERY_SIGN, QUERY_TEXT) VALUES ('ALL_OBJECTS_BY_DOCUMENT', 'select objects.obj_id, objects.objtype, objects.kei, objects.obj_label, objects.obj_code, objects.obj_name, objects.obj_gost from objects where objects.obj_id = :document_id or objects.obj_id in ( select documents.refdoc_id from documents union select detinset.detail_id from detinset inner join docsets on (detinset.docset_id = docsets.docset_id) where docsets.document_id = :document_id union select operdocs.document_id from operdocs inner join opers on (operdocs.oper_id = opers.oper_id) inner join docopers on (opers.docoper_id = docopers.docoper_id) where docopers.document_id = :document_id union select operdets.detail_id from operdets inner join opers on (operdets.oper_id = opers.oper_id) inner join docopers on (opers.docoper_id = docopers.docoper_id) where docopers.document_id = :document_id union select operhalfs.half_id from operhalfs inner join opers on (operhalfs.oper_id = opers.oper_id) inner join docopers on (opers.docoper_id = docopers.docoper_id) where docopers.document_id = :document_id union select opermats.material_id from opermats inner join opers on (opermats.oper_id = opers.oper_id) inner join docopers on (opers.docoper_id = docopers.docoper_id) where docopers.document_id = :document_id union select operequips.equip_id from operequips inner join opers on (operequips.oper_id = opers.oper_id) inner join docopers on (opers.docoper_id = docopers.docoper_id) where docopers.document_id = :document_id union select operinstrs.instr_id from operinstrs inner join opers on (operinstrs.oper_id = opers.oper_id) inner join docopers on (opers.docoper_id = docopers.docoper_id) where docopers.document_id = :document_id )'); REINSERT ('ALL_DOCUMENTS_BY_DOCUMENT', 'select documents.document_id, documents.refdoc_id from documents where documents.document_id = :document_id or documents.document_id in ( select documents.refdoc_id from documents union select operdocs.document_id from operdocs inner join opers on (operdocs.oper_id = opers.oper_id) inner join docopers on (opers.docoper_id = docopers.docoper_id) where docopers.document_id = :document_id )'); REINSERT ('ALL_DETAILS_BY_DOCUMENT', 'select details.detail_id from details where details.detail_id in ( select detinset.detail_id from detinset inner join docsets on (detinset.docset_id = docsets.docset_id) where docsets.document_id = :document_id union select operdets.detail_id from operdets inner join opers on (operdets.oper_id = opers.oper_id) inner join docopers on (opers.docoper_id = docopers.docoper_id) where docopers.document_id = :document_id )'); REINSERT ('ALL_DOCOPERS_BY_DOCUMENT', 'select docopers.docoper_id, docopers.document_id, docopers.oper_num, docopers.oper_name from docopers where docopers.document_id = :document_id'); REINSERT ('ALL_DOCSETS_BY_DOCUMENT', 'select docsets.docset_id, docsets.document_id, docsets.docset_name from docsets where docsets.document_id = :document_id'); REINSERT ('LITERA_13_BY_DOCUMENT', 'select documents.document_id, docopers.oper_num, docsets.docset_id, opermats.material_id, cast(om1.attr_value as numeric(5)) opp, coalesce(om2.kei, objects.kei) kei, cast(om3.attr_value as numeric(5)) ednor, cast(om2.attr_value as numeric(10, 5)) nrash from documents inner join docopers on (docopers.document_id = documents.document_id) inner join opers on (opers.docoper_id = docopers.docoper_id) inner join docsets on (docsets.docset_id = opers.docset_id) inner join opermats on (opermats.oper_id = opers.oper_id) inner join objects on (objects.obj_id = opermats.material_id) left join opermatattrs om1 on (om1.opermat_id = opermats.opermat_id and om1.attr_code=''STORAGE'') left join opermatattrs om2 on (om2.opermat_id = opermats.opermat_id and om2.attr_code=''CONSUMPTION_RATE'') left join opermatattrs om3 on (om3.opermat_id = opermats.opermat_id and om3.attr_code=''UNITS_RATE'') where documents.document_id = :document_id order by docsets.docset_id, docopers.oper_num, objects.obj_label'); REINSERT ('ALL_MATERIALS_BY_DOCUMENT', 'select materials.material_id from materials where materials.material_id in ( select opermats.material_id from opermats inner join opers on (opermats.oper_id = opers.oper_id) inner join docopers on (opers.docoper_id = docopers.docoper_id) where docopers.document_id = :document_id )'); REINSERT ('ALL_EQUIPMENTS_BY_DOCUMENT', 'select equipments.equip_id, equipments.orgunit_id from equipments where equipments.equip_id in ( select operequips.equip_id from operequips inner join opers on (operequips.oper_id = opers.oper_id) inner join docopers on (opers.docoper_id = docopers.docoper_id) where docopers.document_id = :document_id )'); REINSERT ('ALL_INSTRUMENTS_BY_DOCUMENT', 'select instruments.instr_id from instruments where instruments.instr_id in ( select operinstrs.instr_id from operinstrs inner join opers on (operinstrs.oper_id = opers.oper_id) inner join docopers on (opers.docoper_id = docopers.docoper_id) where docopers.document_id = :document_id )'); REINSERT ('LITERA_11_BY_DOCUMENT', 'select documents.document_id, docopers.oper_num, docsets.docset_id, operdets.detail_id, cast(od1.attr_value as numeric(5)) opp, coalesce(od2.kei, objects.kei) kei, cast(od3.attr_value as numeric(5)) ednor, cast(od2.attr_value as numeric(5)) ki from documents inner join docopers on (docopers.document_id = documents.document_id) inner join opers on (opers.docoper_id = docopers.docoper_id) inner join docsets on (docsets.docset_id = opers.docset_id) inner join operdets on (operdets.oper_id = opers.oper_id) inner join objects on (objects.obj_id = operdets.detail_id) left join operdetattrs od1 on (od1.operdet_id = operdets.operdet_id and od1.attr_code=''STORAGE'') left join operdetattrs od2 on (od2.operdet_id = operdets.operdet_id and od2.attr_code=''COUNT'') left join operdetattrs od3 on (od3.operdet_id = operdets.operdet_id and od3.attr_code=''UNITS_RATE'') where documents.document_id = :document_id order by docsets.docset_id, docopers.oper_num, objects.obj_label'); REINSERT ('LITERA_34_BY_DOCUMENT', 'select documents.document_id, docopers.oper_num, docsets.docset_id, operhalfs.half_id, cast(oh1.attr_value as numeric(5)) opp, coalesce(oh2.kei, objects.kei) kei, cast(oh3.attr_value as numeric(5)) ednor, cast(oh2.attr_value as numeric(5)) ki from documents inner join docopers on (docopers.document_id = documents.document_id) inner join opers on (opers.docoper_id = docopers.docoper_id) inner join docsets on (docsets.docset_id = opers.docset_id) inner join operhalfs on (operhalfs.oper_id = opers.oper_id) inner join objects on (objects.obj_id = operhalfs.half_id) left join operhalfattrs oh1 on (oh1.operhalf_id = operhalfs.operhalf_id and oh1.attr_code=''STORAGE'') left join operhalfattrs oh2 on (oh2.operhalf_id = operhalfs.operhalf_id and oh2.attr_code=''COUNT'') left join operhalfattrs oh3 on (oh3.operhalf_id = operhalfs.operhalf_id and oh3.attr_code=''UNITS_RATE'') where documents.document_id = :document_id order by docsets.docset_id, docopers.oper_num, objects.obj_label'); REINSERT ('ALL_DETINSETS_BY_DOCUMENT', 'select detinset.docset_id, detinset.detail_id from detinset where detinset.docset_id in ( select docsets.docset_id from docsets where docsets.document_id = :document_id )'); COMMIT WORK;
true
c085dbfbffd888e4ca831c963e0003840f5afa79
SQL
coodelearning/data-structure-and-algorithm-exercises
/database/leetcode.sql
UTF-8
1,022
4.53125
5
[]
no_license
# 175. 组合两个表 https://leetcode-cn.com/problems/combine-two-tables/ SELECT `FirstName` ,`LastName` ,`City` ,`State` FROM Person LEFT JOIN Address ON Address.PersonId = Person.PersonId; # 182. 查找重复的电子邮箱 https://leetcode-cn.com/problems/duplicate-emails/ # Function 1: # Step1:获得临时表 SELECT Email ,COUNT(Email) FROM Person GROUP BY Email; # Step2: SELECT Email FROM ( SELECT Email ,COUNT(Email) AS num FROM Person GROUP BY Email ) AS statistic WHERE num >1; # Function 2: SELECT Email FROM Person GROUP BY Email HAVING COUNT(Email)>1; # 595. 大的国家 https://leetcode-cn.com/problems/big-countries/ SELECT name ,population ,area FROM World WHERE area > 3000000 OR population > 25000000 # 596 # Function 1: SELECT class FROM ( SELECT class ,COUNT(student) AS num FROM courses GROUP BY class ) AS statistic WHERE num > 4; # Function 2: SELECT class FROM courses GROUP BY class HAVING COUNT(student) > 4;
true
2a118e535129a61777b875ccc4d80270bebeb95b
SQL
vusal87/07.02.2017
/azturizm.sql
UTF-8
4,766
3.125
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 4.6.5.2 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Generation Time: Feb 08, 2017 at 06:05 AM -- Server version: 10.1.21-MariaDB -- PHP Version: 5.6.30 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: `azturizm` -- -- -------------------------------------------------------- -- -- Table structure for table `connection` -- CREATE TABLE `connection` ( `id` int(50) NOT NULL, `ishci_adi` varchar(100) NOT NULL, `mush.xid.ed.ish` varchar(100) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Table structure for table `ishciler` -- CREATE TABLE `ishciler` ( `id` int(25) NOT NULL, `ishci_adi` varchar(50) DEFAULT NULL, `ishci_soyad` varchar(50) DEFAULT NULL, `ishci_vezifesi` varchar(50) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `ishciler` -- INSERT INTO `ishciler` (`id`, `ishci_adi`, `ishci_soyad`, `ishci_vezifesi`) VALUES (1, 'samir', 'binnetov', 'menecer'), (2, 'fariz', 'ehmedov', 'satish temsilcisi'), (3, 'samire', 'xasiyeva', 'marketolog'); -- -------------------------------------------------------- -- -- Table structure for table `mushteriler` -- CREATE TABLE `mushteriler` ( `id` int(25) NOT NULL COMMENT '1', `mushteriye_xidmet_eden_ishci` varchar(50) DEFAULT NULL, `mushterinin_aldigi_turpaket` varchar(50) DEFAULT NULL, `mushterinin_odediyi_pul` varchar(50) DEFAULT NULL, `mushterinin_melumatlari` varchar(150) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `mushteriler` -- INSERT INTO `mushteriler` (`id`, `mushteriye_xidmet_eden_ishci`, `mushterinin_aldigi_turpaket`, `mushterinin_odediyi_pul`, `mushterinin_melumatlari`) VALUES (1, 'fariz', 'turkiye', '500', 'seyid ehmedov mob:0503333333'); -- -------------------------------------------------------- -- -- Table structure for table `turlar` -- CREATE TABLE `turlar` ( `id` int(25) NOT NULL, `tur_haqqinda_melumat` varchar(150) DEFAULT NULL, `turu_sifariw_edenlerin_sayi` int(25) DEFAULT NULL, `turu_sifariw_eden_mushteriler` varchar(50) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Indexes for dumped tables -- -- -- Indexes for table `connection` -- ALTER TABLE `connection` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `ishci_adi` (`ishci_adi`), ADD UNIQUE KEY `mush.xid.ed.ish` (`mush.xid.ed.ish`); -- -- Indexes for table `ishciler` -- ALTER TABLE `ishciler` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `id` (`id`), ADD UNIQUE KEY `ishci_adi` (`ishci_adi`), ADD KEY `id_2` (`id`), ADD KEY `ishci_adi_2` (`ishci_adi`); -- -- Indexes for table `mushteriler` -- ALTER TABLE `mushteriler` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `id` (`id`), ADD KEY `id_2` (`id`), ADD KEY `mushteriye_xidmet_eden_ishci` (`mushteriye_xidmet_eden_ishci`), ADD KEY `mushterinin_aldigi_turpaket` (`mushterinin_aldigi_turpaket`); -- -- Indexes for table `turlar` -- ALTER TABLE `turlar` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `id` (`id`), ADD KEY `id_2` (`id`), ADD KEY `tur_haqqinda_melumat` (`tur_haqqinda_melumat`), ADD KEY `turu_sifariw_eden_mushteriler` (`turu_sifariw_eden_mushteriler`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `connection` -- ALTER TABLE `connection` MODIFY `id` int(50) NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `ishciler` -- ALTER TABLE `ishciler` MODIFY `id` int(25) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; -- -- AUTO_INCREMENT for table `mushteriler` -- ALTER TABLE `mushteriler` MODIFY `id` int(25) NOT NULL AUTO_INCREMENT COMMENT '1', AUTO_INCREMENT=2; -- -- Constraints for dumped tables -- -- -- Constraints for table `connection` -- ALTER TABLE `connection` ADD CONSTRAINT `connection_ibfk_1` FOREIGN KEY (`mush.xid.ed.ish`) REFERENCES `mushteriler` (`mushteriye_xidmet_eden_ishci`) ON DELETE CASCADE ON UPDATE CASCADE, ADD CONSTRAINT `connection_ibfk_2` FOREIGN KEY (`ishci_adi`) REFERENCES `ishciler` (`ishci_adi`) ON DELETE CASCADE ON UPDATE CASCADE; -- -- Constraints for table `turlar` -- ALTER TABLE `turlar` ADD CONSTRAINT `turlar_ibfk_1` FOREIGN KEY (`tur_haqqinda_melumat`) REFERENCES `mushteriler` (`mushterinin_aldigi_turpaket`) 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
5c9833c932feea74e2d4082fca864b558060529c
SQL
LiliFelsen/sql-library-lab-web-051517
/lib/insert.sql
UTF-8
1,054
2.90625
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
INSERT INTO series (id, title, author_id, subgenre_id) VALUES (1, "GOT", 2, 3), (2, "SCANDAL", 4, 5); INSERT INTO books (id, title, year, series_id) VALUES (1, "GOT", 1987, 3), (2, "SCANDAL", 2016, 5), (3, "GOT", 2016, 3), (4, "SCANDAL", 1999, 5), (5, "GOT", 2005, 3), (6, "SCANDAL", 2010, 5); INSERT INTO characters (id, name, motto, species, author_id, series_id) VALUES (1, "Tim", "Carpe Diem", "human", 2, 4), (2, "Tim", "Carpe Diem", "human", 2, 4), (3, "Tim", "Carpe Diem", "human", 2, 4), (4, "Tim", "Carpe Diem", "human", 2, 4), (5, "Tim", "Carpe Diem", "human", 2, 4), (6, "Tim", "Carpe Diem", "human", 2, 4), (7, "Tim", "Carpe Diem", "human", 2, 4), (8, "Tim", "Carpe Diem", "human", 2, 4); INSERT INTO subgenres (id, name) VALUES (1, 'fiction'), (2, "drama"); INSERT INTO authors (id, name) VALUES (1, 'JK'), (2, "Pagnol"); INSERT INTO character_books (id, character_id, book_id) VALUES (1, 3, 5), (2, 3, 5), (3, 3, 5), (4, 3, 5), (5, 3, 5), (6, 3, 5), (7, 3, 5), (8, 3, 5), (9, 3, 5), (10, 3, 5), (11, 3, 5), (12, 3, 5), (13, 3, 5), (14, 3, 5), (15, 3, 5), (16, 3, 5);
true
dc1e9f012db2f67e770ae491703453ec44d098b3
SQL
TheodoraDimitrova/Database-Basics---MySQL
/2.BASIC CRUD/Basic CRUD - Exercise/22. Biggest Countries by Population.sql
UTF-8
137
2.828125
3
[]
no_license
SELECT country_name, population FROM countries WHERE continent_code = 'EU' ORDER BY population DESC , country_name LIMIT 30;
true