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
f08299b83ce4a389daa2a269b1b2cb9fb3411258
SQL
Math-Fatec/Exercicios6
/Ex_SQL_Aula2.sql
ISO-8859-1
629
3.265625
3
[]
no_license
CREATE DATABASE ExAula02 USE ExAula02 CREATE TABLE Produto( Codigo INT PRIMARY KEY NOT NULL, Descriao VARCHAR(50), Fornecedor_prod FOREIGN KEY NOT NULL, Preo DECIMAL(7,2) ) CREATE TABLE Venda( Codigo INT PRIMARY KEY NOT NULL, Codigo_venda FOREIGN KEY NOT NULL, Cliente_venda FOREIGN KEY NOT NULL, Qtd INT, Data_venda DATETIME ) CREATE TABLE Fornecedor( ID INT PRIMARY KEY NOT NULL, Nome VARCHAR(50), Logradouro VARCHAR(100), Numero INT NOT NULL, Complemento VARCHAR(30), Cidade VARCHAR(70) ) CREATE TABLE Cliente( CPF CHAR(11) PRIMARY KEY NOT NULL, Nome VARCHAR(50), Telefone VARCHAR(9) )
true
07ab3197a84e5f85aa9a2b3bfcb5973836e29b40
SQL
swayok/vk-test-task
/src/configs/sql/vktask2.db.structure.sql
UTF-8
1,786
3.34375
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 4.0.10.6 -- http://www.phpmyadmin.net -- -- Хост: 127.0.0.1:3306 -- Время создания: Май 11 2015 г., 23:50 -- Версия сервера: 5.5.41-log -- Версия PHP: 5.5.19 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET time_zone = "+00:00"; -- -- База данных: `vktask2` -- CREATE DATABASE IF NOT EXISTS `vktask2` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; USE `vktask2`; -- -------------------------------------------------------- -- -- Структура таблицы `tasks` -- CREATE TABLE IF NOT EXISTS `tasks` ( `id` int(11) NOT NULL AUTO_INCREMENT, `title` varchar(500) NOT NULL, `description` text NOT NULL, `payment` float(8,2) NOT NULL DEFAULT '0.00', `client_id` int(11) DEFAULT NULL, `executor_id` int(11) DEFAULT NULL, `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `executed_at` timestamp NULL DEFAULT NULL, `is_active` TINYINT( 1 ) NOT NULL DEFAULT '1', `paid_to_executor` FLOAT( 10, 2 ) NOT NULL DEFAULT '0', `paid_to_system` FLOAT( 10, 2 ) NOT NULL DEFAULT '0', PRIMARY KEY (`id`), KEY `client_id` (`client_id`), KEY `executor_id` (`executor_id`), KEY `is_active` (`is_active`), KEY `created_at` (`created_at`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -- Ограничения внешнего ключа сохраненных таблиц -- -- -- Ограничения внешнего ключа таблицы `tasks` -- ALTER TABLE `tasks` ADD CONSTRAINT `tasks_ibfk_2` FOREIGN KEY (`executor_id`) REFERENCES `vktask1`.`executors` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, ADD CONSTRAINT `tasks_ibfk_1` FOREIGN KEY (`client_id`) REFERENCES `vktask1`.`clients` (`id`) ON DELETE SET NULL ON UPDATE CASCADE;
true
619fc210542d0d2e81becf126ecfcef02fb56f5a
SQL
fabricioifc/PROGII_ProjetoFinal
/ProjetoBanco/target/classes/util/dump.sql
UTF-8
686
3.625
4
[]
no_license
create table produtos ( id bigserial not null primary key, nome varchar(255) not null, valor double precision not null ); CREATE TABLE categorias ( id bigserial not null primary key, nome varchar(45) not null, ativo boolean default true ); ALTER TABLE produtos ADD column categoria_id bigint ALTER TABLE produtos ADD FOREIGN KEY (categoria_id) REFERENCES categorias(id); create table usuarios ( id bigserial not null primary key, usuario varchar(255) not null UNIQUE, senha varchar(255) not null, nome varchar(255) not null, status boolean default true ); insert into usuarios (usuario, senha, nome) values ('admin', '21232F297A57A5A743894A0E4A801FC3', 'Admin');
true
bee23da1412c09ce38d4231f8282f839a98f3aaa
SQL
FirebirdSQL/x-cvs-vulcanj
/VulcanJ/ddl/nist/cdr001.sql
UTF-8
1,285
3.140625
3
[]
no_license
SET NAMES ASCII; CREATE DATABASE 'test.fdb' DEFAULT CHARACTER SET ISO8859_1; CREATE TABLE STAFF4 (EMPNUM CHAR(3) NOT NULL, EMPNAME CHAR(20) DEFAULT NULL, GRADE DECIMAL(4) DEFAULT 0, CITY CHAR(15) DEFAULT ' '); INSERT INTO STAFF4 (EMPNUM,GRADE) VALUES ('E1',40); INSERT INTO STAFF4 (EMPNUM,EMPNAME) VALUES ('E2','HUFFMAN'); SELECT EMPNAME FROM STAFF4 WHERE GRADE=0 ; SELECT GRADE FROM STAFF4 WHERE (EMPNAME IS NULL) AND CITY = ' '; CREATE TABLE STAFF14 (EMPNUM CHAR(3) NOT NULL, EMPNAME CHAR(20) DEFAULT USER, GRADE DECIMAL(4), CITY CHAR(15)); INSERT INTO STAFF14 (EMPNUM,GRADE) VALUES ('E1',40); SELECT EMPNAME FROM STAFF14 WHERE EMPNAME = 'SYSDBA'; CREATE TABLE STAFF16 (EMPNUM CHAR(3) NOT NULL, EMPNAME CHAR(20) DEFAULT NULL, GRADE DECIMAL(4) NOT NULL CHECK (GRADE IN (100,150,200)), CITY CHAR(15), PRIMARY KEY (GRADE,EMPNUM)); INSERT INTO STAFF16 (EMPNUM,GRADE) VALUES ('E1',150); INSERT INTO STAFF16 (EMPNUM,GRADE) VALUES ('E1',150); SELECT COUNT(*) as rowCount FROM STAFF16 WHERE EMPNAME IS NULL; INSERT INTO STAFF16 (EMPNUM,EMPNAME,GRADE) VALUES ('E2','Tom',100); SELECT EMPNAME FROM STAFF16 WHERE EMPNUM = 'E2'; INSERT INTO STAFF16 (EMPNUM,EMPNAME,GRADE) VALUES ('E3','Bill',151); SELECT GRADE FROM STAFF16 WHERE EMPNUM = 'E3'; DROP DATABASE;
true
f4cda05a25724bc2c24e9a15e9f23a8508a6f654
SQL
bcgov/mds
/migrations/sql/V2022.04.26.11.50__alter_project_summary_nulls.sql
UTF-8
341
2.609375
3
[ "Apache-2.0" ]
permissive
-- The project summary factories have been updated in the code base to not include mine_guid anymore but the schema still has a NOT NULL FKEY. -- We need to disable this and change the column to NULLABLE to move forward. ALTER TABLE project_summary ALTER COLUMN mine_guid DROP NOT NULL, ALTER COLUMN project_summary_title DROP NOT NULL;
true
f481879dd8f8a0ad0a777fea2d58e309257b783f
SQL
jm355206/competitionTrackingApp
/sql.sql
UTF-8
1,765
3.421875
3
[]
no_license
INSERT INTO competition INSERT INTO competitor (user_name, first_name, last_name) VALUES (?, ?, ?); ALTER TABLE competitor DROP COLUMN competitor_name; ALTER TABLE competitor DROP COLUMN username; ALTER TABLE competitor ADD COLUMN first_name varchar(20); ALTER TABLE competitor ADD COLUMN last_name varchar(20); ALTER TABLE competition ADD COLUMN time_stamp timestamp; ALTER TABLE competition ADD COLUMN winner varchar(20); ALTER TABLE competition ADD COLUMN loser varchar(20); ALTER TABLE competition DROP COLUMN loser; ALTER TABLE competition ADD COLUMN competitor_id int; ALTER TABLE competition ADD COLUMN player_one int; ALTER TABLE competition ADD COLUMN player_two int; ALTER TABLE competition DROP COLUMN competitor_id; ALTER TABLE competition DROP COLUMN player_two; ALTER TABLE competition DROP COLUMN player_one; ALTER TABLE competition ADD COLUMN player_one_score int; ALTER TABLE competition ADD COLUMN player_two_score int; select * from competitor; INSERT INTO competition (game_id, time_stamp, player_one, player_one_score, player_two, player_two_score) VALUES (1, now(), 1, 21, 2, 18); INSERT INTO competition (game_id, time_stamp, player_one, player_one_score, player_two, player_two_score) VALUES (1, now(), 3, 21, 1, 15); INSERT INTO competition (game_id, time_stamp, player_one, player_one_score, player_two, player_two_score) VALUES (1, now(), 5, 21, 3, 12); INSERT INTO competition (game_id, time_stamp, player_one, player_one_score, player_two, player_two_score) VALUES (1, now(), 4, 21, 2, 18); INSERT INTO competition (game_id, time_stamp, player_one, player_one_score, player_two, player_two_score) VALUES (1, now(), 4, 21, 2, 18); SELECT ("first_name" || ' ' || "last_name") as name DELETE FROM COMPETITION;
true
1e3e72b6b1418a59fb2cd7582aca31d58205ed61
SQL
thuc97/Rocket17
/MySQL/SQL lession3/Testing system3.sql
UTF-8
2,579
4.125
4
[]
no_license
USE Testing_System_Assignment ; ------------ Question 2: lấy ra tất cả các phòng ban SELECT DepartmentName FROM Department; ----------- Question 3: lấy ra id của phòng ban "Sale" SELECT DepartmentID ,DepartmentName FROM Department WHERE DepartmentName='sale' ; ---------- Question 4: lấy ra thông tin account có full name dài nhất SELECT * FROM `Account` WHERE length(UserFullName )=(SELECT max(length(UserFullName )) FROM `Account` ); --------- Question 5: Lấy ra thông tin account có full name dài nhất và thuộc phòng ban có id =3 SELECT * FROM `Account` WHERE length(UserFullName )=(SELECT max(length(UserFullName )) FROM `Account` )AND DepartmentID =3; ----- Question 6: Lấy ra tên group đã tham gia trước ngày 20/12/2019 SELECT GroupName FROM `Group` WHERE CreateDate < '2019-12-20' ; ------- Question 7: Lấy ra ID của question có >= 4 câu trả lời SELECT QuestionID , Content ,count(QuestionID )as SL FROM Answer GROUP BY QuestionID HAVING QuestionID >=4; ----- Question 8: Lấy ra các mã đề thi có thời gian thi >= 60 phút và được tạo trước ngày 20/12/2019 SELECT `Code` FROM Exam WHERE Duration >=60 AND CreateDate < '2019-12-20' ; ------- Question 9: Lấy ra 5 group được tạo gần đây nhất SELECT GroupName , CreateDate FROM `Group` ORDER BY GroupName DESC LIMIT 5; ----- Question 10: Đếm số nhân viên thuộc department có id = 2 SELECT count(UserFullName),DepartmentID FROM `Account` WHERE DepartmentID=2; ------ Question 11: Lấy ra nhân viên có tên bắt đầu bằng chữ "D" và kết thúc bằng chữ "o" SELECT UserFullName FROM `Account` WHERE UserFullName LIKE 'D%g'; ------- Question 12: Xóa tất cả các exam được tạo trước ngày 20/12/2019 DELETE FROM ExamQuestion WHERE ExamID IN(SELECT ExamID FROM Exam WHERE CreateDate < '2019-12-20' ); DELETE FROM Exam WHERE CreateDate < '2019-12-20' ; SELECT * FROM Exam ; ---- Question 13: Xóa tất cả các question có nội dung bắt đầu bằng từ "câu hỏi" DELETE FROM Question WHERE Content LIKE '%cau hoi' ; ---- --- Question 14: Update thông tin của account có id = 5 thành tên "Nguyễn Bá Lộc" và ------- email thành loc.nguyenba@vti.com.vn UPDATE `Account` SET UserFullName ='Nguyễn Bá Lộc' , Email ='thanh loc.nguyenba@vti.com.vn' WHERE AccountID =5; ----- Question 15: update account có id = 5 sẽ thuộc group có id = 4 UPDATE `Group Account` SET AccountID =5 WHERE GroupID =4;
true
71e706cf9015306d96b1b6a5027276007e9ff6b8
SQL
lukakan/home-budget
/src/main/resources/Transactions.sql
UTF-8
770
3.53125
4
[]
no_license
CREATE DATABASE home_budget CHAR SET = 'utf8mb4' COLLATE ='utf8mb4_polish_ci'; USE home_budget; CREATE TABLE home_budget.transaction( id BIGINT NOT NULL AUTO_INCREMENT, type ENUM('INCOME','EXPENSE') DEFAULT 'INCOME' NOT NULL, description VARCHAR(1000) NOT NULL, amount DECIMAL(10,2) NOT NULL, transaction_date DATE, PRIMARY KEY(id)); INSERT INTO transaction (type, description, amount, transaction_date) VALUES ('INCOME', 'Salary from UX industired', 5500.50, '2021-04-01'), ('INCOME', 'Fee for extrahours', 100.50, '2021-04-01'), ('EXPENSE', 'Food shopping', 300.50, '2021-04-05'), ('EXPENSE', 'Food shopping', 400.50, '2021-04-12'), ('EXPENSE', 'cold water bill', 30.44, '2021-04-05'), ('EXPENSE', 'energy bill', 75.66, '2021-04-05'); SELECT * FROM transaction;
true
3c0044497bd5ed59041bf0d2cdccc6766d4c623d
SQL
dKluev/Site
/MigrationUtils/Scripts/exportNews.sql
UTF-8
750
3.109375
3
[]
no_license
--use Specialist -- -- -- --set identity_insert SpecialistWeb..news on -- --insert into SpecialistWeb..News (newsid, -- Title, -- Description, -- ShortDescription, -- PublishDate, -- [Type], -- IsActive --) --select newsid, -- Header, -- convert(varchar(5000), News), -- convert(varchar(2000), isnull(shortnews, news)), -- NewsDate, -- [Type], -- 1 --from news --where Header is not null and NewsDate is not null -- ----select * from dbo.News ----where newsdate is null -- --set identity_insert SpecialistWeb..News off use SpecialistWeb select newsid, ',' + RelCourses from Specialist..News where RelCourses is not null and RelCourses <> '' select * from dbo.tSiteObjectRelations as TSOR where ObjectType = 'News' or RelationObjectType = 'News'
true
7a63ef626236b8976b6f19869c9ba4ab02982884
SQL
Lintu91/Tsoha-Bootstrap
/sql/create_tables.sql
UTF-8
589
3.328125
3
[]
no_license
-- Lisää CREATE TABLE lauseet tähän tiedostoon CREATE TABLE Pokemontype( id SERIAL PRIMARY KEY, -- SERIAL tyyppinen pääavain pitää huolen, että tauluun lisätyllä rivillä on aina uniikki pääavain. Kätevää! name varchar(50) NOT NULL -- Muista erottaa sarakkeiden määrittelyt pilkulla! ); CREATE TABLE Pokemon( id SERIAL PRIMARY KEY, pokemontype1_id INTEGER REFERENCES Pokemontype(id), pokemontype2_id INTEGER REFERENCES Pokemontype(id), name varchar(50) NOT NULL, team boolean DEFAULT FALSE, description varchar(400), generation INTEGER, added DATE );
true
3dca976a80a79ebf7fa3b557627f2c95d0a1904b
SQL
Prabhat1811/Bank-Management-System
/database queries/account.sql
UTF-8
543
2.75
3
[]
no_license
CREATE TABLE `bms`.`account`( `accno` INT AUTO_INCREMENT, `accamt` FLOAT DEFAULT 0, `acctype` VARCHAR(10), `status` VARCHAR(10) DEFAULT 'active', `password` VARCHAR(50), `custid` INT UNIQUE, PRIMARY KEY (`accno`), FOREIGN KEY (`custid`) REFERENCES `bms`.`customer`(`custid`) ); INSERT INTO `bms`.`account`(`accamt`,`acctype`,`status`,`password`,`custid`) VALUES ('1000','savings','active','qwerty12345','1'), ('1200','current','active','qwetry12345','2'), ('1500','savings','inactive','qwerty12345','3');
true
f18565c38afbe6a69eefd2546e4db7492230a42b
SQL
cbazalar/PROYECTOS_PROPIOS
/nssicc/database/ssicc_pe_es/procedures/imp_pr_proce_nota_credi.prc
UTF-8
1,410
2.90625
3
[]
no_license
CREATE OR REPLACE PROCEDURE "IMP_PR_PROCE_NOTA_CREDI" (p_fechaInicio VARCHAR2, p_fechaFin VARCHAR2, p_num_docu_inic NUMBER, p_num_docu_fina NUMBER, p_codigoTipoDocumento VARCHAR2, p_nombreArchivo IN VARCHAR2, p_directorio IN VARCHAR2) AS BEGIN -- Truncamos las tablas que contienen la infomacion EXECUTE IMMEDIATE 'TRUNCATE TABLE IMP_TMP_NOTA_CREDI'; EXECUTE IMMEDIATE 'TRUNCATE TABLE IMP_TMP_NUME_BOLET_DESPA'; -- Insertamos los numeros de boleta de despacho INSERT INTO IMP_TMP_NUME_BOLET_DESPA SELECT B.VAL_NUME_SOLI, A.NUM_DOCU_CONT_INTE FROM FAC_DOCUM_CONTA_CABEC A, PED_SOLIC_CABEC B, FAC_TIPO_DOCUM C WHERE A.SOCA_OID_SOLI_CABE = B.OID_SOLI_CABE AND A.FEC_EMIS >= DECODE(p_fechaInicio, NULL, A.FEC_FACT, TO_DATE(p_fechaInicio,'dd/MM/yyyy')) AND A.FEC_EMIS <= DECODE(p_fechaFin, NULL, A.FEC_FACT, TO_DATE(p_fechaFin,'dd/MM/yyyy') + 1) AND A.TIDO_OID_TIPO_DOCU = C.OID_TIPO_DOCU AND A.NUM_DOCU_CONT_INTE IS NOT NULL AND C.COD_TIPO_DOCU = p_codigoTipoDocumento AND A.NUM_DOCU_CONT_INTE >= DECODE(p_num_docu_inic, NULL, A.NUM_DOCU_CONT_INTE, p_num_docu_inic) AND A.NUM_DOCU_CONT_INTE <= DECODE(p_num_docu_fina, NULL, A.NUM_DOCU_CONT_INTE, p_num_docu_fina) AND ((A.IND_IMPR = 1) OR (A.IND_IMPR = 0 AND A.VAL_PREC_CATA_TOTA_LOCA < 0)); IMP_PR_GENER_NOTA_CREDI_MASIV; IMP_PR_NOTA_CREDI_TO_FILE(p_nombreArchivo, p_directorio); END IMP_PR_PROCE_NOTA_CREDI; /
true
ec8e42c1da5f1e858373a06e170ea037f9cfd088
SQL
kuakling/react-fullstack
/reactql_db.sql
UTF-8
17,084
2.703125
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 4.5.2 -- http://www.phpmyadmin.net -- -- Host: localhost -- Generation Time: Nov 21, 2017 at 10:24 AM -- Server version: 10.1.16-MariaDB -- PHP Version: 5.6.24 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: `reactql_db` -- -- -------------------------------------------------------- -- -- Table structure for table `desktop_setting` -- CREATE TABLE `desktop_setting` ( `id` int(11) NOT NULL, `user_id` int(11) NOT NULL, `settings` text NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `desktop_setting` -- INSERT INTO `desktop_setting` (`id`, `user_id`, `settings`) VALUES (1, 5, '{"wallpaper":{"color":"#00ff00","picture":"http://www.comm-sci.pn.psu.ac.th/media/parallax/img/bg.png"}}'); -- -------------------------------------------------------- -- -- Table structure for table `session` -- CREATE TABLE `session` ( `id` int(11) NOT NULL, `user_id` int(11) NOT NULL, `expires_at` datetime NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -------------------------------------------------------- -- -- Table structure for table `user` -- CREATE TABLE `user` ( `id` int(11) NOT NULL, `username` varchar(255) NOT NULL, `auth_key` varchar(32) NOT NULL, `password_hash` varchar(255) NOT NULL, `password_reset_token` varchar(255) DEFAULT NULL, `email` varchar(255) NOT NULL, `status` smallint(6) NOT NULL DEFAULT '10', `created_at` int(11) NOT NULL, `updated_at` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `user` -- INSERT INTO `user` (`id`, `username`, `auth_key`, `password_hash`, `password_reset_token`, `email`, `status`, `created_at`, `updated_at`) VALUES (1, 'pimchanok.p', 'C6ysWQ68Kp9R-peIOZKjyi5A8HH0nitw', '', NULL, 'pimchanok.p@psu.ac.th', 10, 1441252947, 1441252947), (2, 'wanida.bo', 'C6ysWQ68Kp9R-peIOZKjyi5A8HH0nitw', '', NULL, 'wanida.bo@psu.ac.th', 10, 1441252948, 1441252948), (3, 'yupadee.u', 'C6ysWQ68Kp9R-peIOZKjyi5A8HH0nitw', '', NULL, 'yupadee.u@psu.ac.th', 10, 1441252949, 1441252949), (4, 'ittidate.r', 'C6ysWQ68Kp9R-peIOZKjyi5A8HH0nitw', '', NULL, 'ittidate.r@psu.ac.th', 10, 1441252950, 1441252950), (5, 'surakit.c', 'C6ysWQ68Kp9R-peIOZKjyi5A8HH0nitw', '$2y$10$ay4FZG2LyYPDnQdDWg7S/Ovb3AY1XV8oNQWyEfPAjY9WmsIvdYqzu', NULL, 'surakit.c@psu.ac.th', 10, 1441252951, 2017), (6, 'kanchan.m', 'C6ysWQ68Kp9R-peIOZKjyi5A8HH0nitw', '', NULL, 'kanchan.m@psu.ac.th', 10, 1441252952, 1467241710), (7, 'taweesak.h', 'C6ysWQ68Kp9R-peIOZKjyi5A8HH0nitw', '', NULL, 'taweesak.h@psu.ac.th', 10, 1441252953, 1467241525), (8, 'oratai.c', 'C6ysWQ68Kp9R-peIOZKjyi5A8HH0nitw', '', NULL, 'oratai.c@psu.ac.th', 10, 1441252954, 1467241573), (9, 'saman.c', 'C6ysWQ68Kp9R-peIOZKjyi5A8HH0nitw', '', NULL, 'saman.c@psu.ac.th', 10, 1441252955, 1441252955), (10, 'navika.p', 'C6ysWQ68Kp9R-peIOZKjyi5A8HH0nitw', '$2y$10$ay4FZG2LyYPDnQdDWg7S/Ovb3AY1XV8oNQWyEfPAjY9WmsIvdYqzu', NULL, 'navika.p@psu.ac.th', 10, 1441252956, 1441252956), (11, 'kittisak.p', 'C6ysWQ68Kp9R-peIOZKjyi5A8HH0nitw', '', NULL, 'kittisak.p@psu.ac.th', 10, 1441252957, 1467241665), (12, 'phatcharakan.y', 'C6ysWQ68Kp9R-peIOZKjyi5A8HH0nitw', '', NULL, 'phatcharakan.y@psu.ac.th', 10, 1441252958, 1441252958), (13, 'chavanit.t', 'C6ysWQ68Kp9R-peIOZKjyi5A8HH0nitw', '', NULL, 'chavanit.t@psu.ac.th', 10, 1441252959, 1441252959), (14, 'ausmarn.t', 'C6ysWQ68Kp9R-peIOZKjyi5A8HH0nitw', '', NULL, 'ausmarn.t@psu.ac.th', 10, 1441252960, 1441252960), (15, 'thidakan.k', 'C6ysWQ68Kp9R-peIOZKjyi5A8HH0nitw', '', NULL, 'thidakan.k@psu.ac.th', 10, 1441252961, 1441252961), (16, 'sunisa.ma', 'C6ysWQ68Kp9R-peIOZKjyi5A8HH0nitw', '', NULL, 'sunisa.ma@psu.ac.th', 10, 1441252962, 1467241759), (17, 'wasinee.c', 'C6ysWQ68Kp9R-peIOZKjyi5A8HH0nitw', '', NULL, 'wasinee.c@psu.ac.th', 10, 1441252963, 1441252963), (18, 'buppha.c', 'C6ysWQ68Kp9R-peIOZKjyi5A8HH0nitw', '', NULL, 'buppha.c@psu.ac.th', 10, 1441252964, 1441252964), (19, 'abdul-aziz.d', 'C6ysWQ68Kp9R-peIOZKjyi5A8HH0nitw', '', NULL, 'abdul-aziz.d@psu.ac.th', 10, 1441252965, 1441252965), (20, 'veeraphong.r', 'C6ysWQ68Kp9R-peIOZKjyi5A8HH0nitw', '', NULL, 'veeraphong.r@psu.ac.th', 10, 1441252966, 1441252966), (21, 'rusaman.y', 'C6ysWQ68Kp9R-peIOZKjyi5A8HH0nitw', '', NULL, 'rusaman.y@psu.ac.th', 10, 1441252967, 1441252967), (22, 'jareeya.a', 'C6ysWQ68Kp9R-peIOZKjyi5A8HH0nitw', '', NULL, 'jareeya.a@psu.ac.th', 10, 1441252968, 1441252968), (23, 'walakkamol.c', 'C6ysWQ68Kp9R-peIOZKjyi5A8HH0nitw', '', NULL, 'walakkamol.c@psu.ac.th', 10, 1441252969, 1441252969), (24, 'kusuma.k', 'C6ysWQ68Kp9R-peIOZKjyi5A8HH0nitw', '', NULL, 'kusuma.k@psu.ac.th', 10, 1441252970, 1441252970), (25, 'nuwan.t', 'C6ysWQ68Kp9R-peIOZKjyi5A8HH0nitw', '', NULL, 'nuwan.t@psu.ac.th', 10, 1441252971, 1441252971), (26, 'sakiroh.y', 'C6ysWQ68Kp9R-peIOZKjyi5A8HH0nitw', '', NULL, 'sakiroh.y@psu.ac.th', 10, 1441252972, 1441252972), (27, 'arunee.n', 'C6ysWQ68Kp9R-peIOZKjyi5A8HH0nitw', '', NULL, 'arunee.n@psu.ac.th', 10, 1441252973, 1441252973), (28, 'phirakan.k', 'C6ysWQ68Kp9R-peIOZKjyi5A8HH0nitw', '', NULL, 'phirakan.k@psu.ac.th', 10, 1441252974, 1441252974), (29, 'samatcha.n', 'C6ysWQ68Kp9R-peIOZKjyi5A8HH0nitw', '', NULL, 'samatcha.n@psu.ac.th', 10, 1441252975, 1441252975), (30, 'suwanat.t', 'C6ysWQ68Kp9R-peIOZKjyi5A8HH0nitw', '', NULL, 'suwanat.t@psu.ac.th', 10, 1441252976, 1441252976), (31, 'charinrat.s', 'C6ysWQ68Kp9R-peIOZKjyi5A8HH0nitw', '', NULL, 'charinrat.s@psu.ac.th', 10, 1441252977, 1441252977), (32, 'bantika.j', 'C6ysWQ68Kp9R-peIOZKjyi5A8HH0nitw', '', NULL, 'bantika.j@psu.ac.th', 10, 1441252978, 1441252978), (33, 'amornrat.c', 'C6ysWQ68Kp9R-peIOZKjyi5A8HH0nitw', '', NULL, 'amornrat.c@psu.ac.th', 10, 1441252979, 1441252979), (34, 'kritsadee.p', 'C6ysWQ68Kp9R-peIOZKjyi5A8HH0nitw', '', NULL, 'kritsadee.p@psu.ac.th', 10, 1441252980, 1441252980), (35, 'hamdia.c', 'C6ysWQ68Kp9R-peIOZKjyi5A8HH0nitw', '', NULL, 'hamdia.c@psu.ac.th', 10, 1441252981, 1441252981), (36, 'laila.b', 'C6ysWQ68Kp9R-peIOZKjyi5A8HH0nitw', '', NULL, 'laila.b@psu.ac.th', 10, 1441252982, 1441252982), (37, 'kanuengkwan.n', 'C6ysWQ68Kp9R-peIOZKjyi5A8HH0nitw', '', NULL, 'kanuengkwan.n@psu.ac.th', 10, 1441252983, 1441252983), (38, 'ahmarn.m', 'C6ysWQ68Kp9R-peIOZKjyi5A8HH0nitw', '', NULL, 'ahmarn.m@psu.ac.th', 10, 1441252984, 1441252984), (39, 'sariya.b', 'C6ysWQ68Kp9R-peIOZKjyi5A8HH0nitw', '', NULL, 'sariya.b@psu.ac.th', 10, 1441252985, 1441252985), (40, 'muazzan.b', 'C6ysWQ68Kp9R-peIOZKjyi5A8HH0nitw', '', NULL, 'muazzan.b@psu.ac.th', 10, 1441252986, 1441252986), (41, 'jarungwit.b', 'C6ysWQ68Kp9R-peIOZKjyi5A8HH0nitw', '', NULL, 'jarungwit.b@psu.ac.th', 10, 1441252987, 1441252987), (42, 'sumpunt.k', 'C6ysWQ68Kp9R-peIOZKjyi5A8HH0nitw', '', NULL, 'sumpunt.k@psu.ac.th', 10, 1441252988, 1441252988), (43, 'ihitima.t', 'C6ysWQ68Kp9R-peIOZKjyi5A8HH0nitw', '', NULL, 'thitima.t@psu.ac.th', 10, 1441252989, 1441252989), (44, 'muhammadsuhaimi.y', 'C6ysWQ68Kp9R-peIOZKjyi5A8HH0nitw', '', NULL, 'muhammadsuhaimi.y@psu.ac.th', 10, 1441252990, 1441252990), (45, 'chanakit.t', 'C6ysWQ68Kp9R-peIOZKjyi5A8HH0nitw', '', NULL, 'chanakit.t@psu.ac.th', 10, 1441252991, 1441252991), (46, 'kamtorn.k', 'C6ysWQ68Kp9R-peIOZKjyi5A8HH0nitw', '', NULL, 'kamtorn.k@psu.ac.th', 10, 1441252992, 1441252992), (47, 'suparaporn.t', 'C6ysWQ68Kp9R-peIOZKjyi5A8HH0nitw', '', NULL, 'suparaporn.t@psu.ac.th', 10, 1441252993, 1441252993), (48, 'dusadee.p', 'C6ysWQ68Kp9R-peIOZKjyi5A8HH0nitw', '', NULL, 'dusadee.p@psu.ac.th', 10, 1441252994, 1441252994), (49, 'phakdee.tu', 'C6ysWQ68Kp9R-peIOZKjyi5A8HH0nitw', '', NULL, 'phakdee.tu@psu.ac.th', 10, 1441252995, 1441252995), (50, 'sittikorn.t', 'C6ysWQ68Kp9R-peIOZKjyi5A8HH0nitw', '', NULL, 'sittikorn.t@psu.ac.th', 10, 1441252996, 1441252996); -- -------------------------------------------------------- -- -- Table structure for table `user_profile` -- CREATE TABLE `user_profile` ( `user_id` int(11) NOT NULL, `firstname` varchar(255) DEFAULT NULL, `lastname` varchar(255) DEFAULT NULL, `avatar_offset` varchar(255) NOT NULL, `avatar_cropped` varchar(255) NOT NULL, `avatar` varchar(255) NOT NULL, `cover_offset` varchar(255) NOT NULL, `cover_cropped` varchar(255) NOT NULL, `cover` varchar(255) NOT NULL, `bio` varchar(255) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `user_profile` -- INSERT INTO `user_profile` (`user_id`, `firstname`, `lastname`, `avatar_offset`, `avatar_cropped`, `avatar`, `cover_offset`, `cover_cropped`, `cover`, `bio`) VALUES (1, 'พิมพ์ชนก', 'พลวรรณ', '11.88-8-89.38-70', '5836f22a0fe1d_5836f22a0ef8e.jpg', '5836f22a0ef8e.jpg', '', '', '', ''), (2, 'วนิดา ', 'บุญพร้อม', '11.88-9.5-88.13-70.5', '5836f26737ca1_5836f26736587.jpg', '5836f26736587.jpg', '', '', '', ''), (3, 'ยุพดี', 'อุดมพงษ์', '0-0-100-100', '5836f280686e7_5836f28066f1d.jpg', '5836f28066f1d.jpg', '', '', '', ''), (4, 'อิทธิเดช', 'รัตนะ', '11.25-5.5-88.75-67.5', '5836f29c47360_5836f29c46458.jpg', '5836f29c46458.jpg', '', '', '', ''), (5, 'สุรกิจ', 'ชูเดช', '33.33-11-86.66-91', '0.22093761373120158_cropped.png', '0.19640678737925032_584f9125d0bc2.jpg', '18.72-39.83-98.72-93.16', '0.38687151430751854_cropped.png', '0.7781386710115898_apple_ios_mountains_and_galaxy-wallpaper-1920x1080.jpg', 'ไม่หล่อเว้ย'), (6, 'แก่นจันทร์', 'มูสิกธรรม', '10.63-8.5-85-68', '5836f2ba97689_5836f2ba96af2.jpg', '5836f2ba96af2.jpg', '', '', '', ''), (7, 'ทวีศักดิ์', 'หมานเม๊าะ', '11.88-9.5-88.13-70.5', '5836f2d2a74ea_5836f2d2a6832.jpg', '5836f2d2a6832.jpg', '', '', '', ''), (8, 'อรทัย', 'จารุวิเศษ', '13.13-10.5-87.5-70', '5836f2e98adb9_5836f2e9894fb.jpg', '5836f2e9894fb.jpg', '', '', '', ''), (9, 'สมาน', 'เจะมะ', '10-0-90-80', '0.8057856602833968_cropped.png', '0.2452218526475729_photo.jpg', '2.5-6.02-82.5-53.98', '0.5352828646201822_cropped.png', '0.7734644862220585_kjyvq6i.jpg', ''), (10, 'นาวิกา', 'เพ็งจันทร์', '0.49-6-100-72.3', '0.5439306553679277_cropped.png', '0.5794111589644755_Navika-Kotia-at-Murugatrupadai-Audio-Launch-14.jpg', '0-0-100-87.5', '0.769044863565681_cropped.png', '0.585013859333618_2600.jpg', 'ดีจ้า'), (11, 'กิตติศักดิ์', 'ประชุมทอง', '10-4.8-87-66.4', '5836f3354e9e4_5836f3354d1de.jpg', '5836f3354d1de.jpg', '', '', '', ''), (12, 'พัชรกัญญ์', 'ยังปากน้ำ', '0-0-100-100', '5836f34cd1bbe_5836f34cd0d47.jpg', '5836f34cd0d47.jpg', '', '', '', ''), (13, 'ชวนิทธิ์', 'ธนะสุข', '30.95-7.75-67.95-32.25', '584fa1de34daf_584fa1de338d0.jpg', '584fa1de338d0.jpg', '', '', '', ''), (14, 'อุสมาน', 'ตาเละ', '0-0-100-100', '5836f37eba0b4_5836f37eb96ba.jpg', '5836f37eb96ba.jpg', '', '', '', ''), (15, 'ธิดากาญจน์', 'คงมาก', '11.88-9.5-88.75-71', '5836f39901794_5836f39900766.jpg', '5836f39900766.jpg', '', '', '', ''), (16, 'สุนิสา', 'หมัดเน', '11.25-9.5-88.13-71', '5836f3b2743ca_5836f3b272eaa.jpg', '5836f3b272eaa.jpg', '0-14.38-100-46.73', '584f9f0910249_584f98635ed72.jpg', '584f98635ed72.jpg', ''), (17, 'วาสิณี', 'จันทอง', '13.13-5.5-86.25-64', '5836f3cc26ff4_5836f3cc25d8b.jpg', '5836f3cc25d8b.jpg', '', '', '', ''), (18, 'บุปผา', 'ไชยแสง', '', '', '', '', '', '', NULL), (19, 'อับดุลอาซิส', 'ดือราแม', '11.88-9.5-88.75-71', '5836f3e78d9e4_5836f3e78c0d3.jpg', '5836f3e78c0d3.jpg', '', '', '', ''), (20, 'วีระพงศ์', 'เรืองสกุล', '0-0-100-100', '5836f402dd6d3_5836f402dcc6d.jpg', '5836f402dcc6d.jpg', '', '', '', ''), (21, 'รุสมาน', 'ยูโซะ', '0-0-99.8-100', '5836f41b7d2bc_5836f41b7bfc2.jpg', '5836f41b7bfc2.jpg', '0-25.28-100-60.84', '5836f42954510_5836f42953402.jpg', '5836f42953402.jpg', ''), (22, 'จารียา', 'อรรถอนุชิต', '0-0-100-100', '5836c7338ce1f_5836c7338a566.jpg', '5836c7338a566.jpg', '', '', '', ''), (23, 'วลักษณ์กมล', 'จ่างกมล', '0-3.1-100-91.09', '5836c89803f1b_5836c898033e7.jpg', '5836c898033e7.jpg', '', '', '', ''), (24, 'กุสุมา', 'กูใหญ่ ', '0-0-100-100', '5836c83626101_5836c83624b89.jpg', '5836c83624b89.jpg', '', '', '', ''), (25, 'นุวรรณ', 'ทับเที่ยง', '', '', '', '', '', '', NULL), (26, 'สากีเราะ แยนา', 'เบ็ญฮารูน', '14.77-1.5-84.53-48.75', '59bea5c17bed0_59bea5c17ac49.jpg', '59bea5c17ac49.jpg', '0-1.98-100-37.53', '59bdf28a4a086_59bdf28a48eca.jpg', '59bdf28a48eca.jpg', ''), (27, 'อรุณีวรรณ', 'บัวเนี่ยว', '0-0-100-100', '5836c9b51016b_5836c9b50f447.jpg', '5836c9b50f447.jpg', '', '', '', ''), (28, 'ภีรกาญจน์', 'ไค่นุ่นนา', '0-0-100-100', '5836c86f51045_5836c86f4f894.jpg', '5836c86f4f894.jpg', '', '', '', ''), (29, 'สมัชชา', 'นิลปัทม์', '0-0-100-100', '5836c8c51ee3f_5836c8c51daa9.jpg', '5836c8c51daa9.jpg', '', '', '', ''), (30, 'สุวนาถ', 'ทองสองยอด', '0-0-100-100', '5836c93512bfb_5836c93512111.jpg', '5836c93512111.jpg', '', '', '', ''), (31, 'อาทิตยา', 'สมโลก', '0-0-100-100', '5836c9cd4c16c_5836c9cd4b627.jpg', '5836c9cd4b627.jpg', '', '', '', ''), (32, 'บัณฑิกา', 'จารุมา', '', '', '', '', '', '', NULL), (33, 'อมรรัตน์', 'ชนะการณ์', '0-0-100-67.36', '5836c94963fe7_5836c94963251.jpg', '5836c94963251.jpg', '', '', '', ''), (34, 'กฤษดี', 'พ่วงรอด', '0-0-100-100', '5836c80882e7b_5836c80881ae0.jpg', '5836c80881ae0.jpg', '', '', '', ''), (35, 'ฮัมเดีย', 'มูดอ', '0-0-100-100', '5836c9e6188b8_5836c9e6179da.jpg', '5836c9e6179da.jpg', '', '', '', ''), (36, 'ไลลา', 'บุญพิศ', '', '', '', '', '', '', NULL), (37, 'คนึงขวัญ', 'นุ่นแก้ว', '', '', '', '', '', '', NULL), (38, 'อาหมาน', 'หมัดเจริญ', '0-0-100-100', '5836ca61799a5_5836ca61781ca.jpg', '5836ca61781ca.jpg', '', '', '', ''), (39, 'ศริยา', 'บิลแสละ', '0-0-99.68-66', '5960ba1a16d79_5960ba1a11959.jpg', '5960ba1a11959.jpg', '0-29.86-100-76.2', '5960bb9393c89_5960bb9392a00.jpg', '5960bb9392a00.jpg', ''), (40, 'มูอัสซัล', 'บิลแสละ', '0-0-100-100', '5836ca8df1823_5836ca8df0963.jpg', '5836ca8df0963.jpg', '', '', '', ''), (41, 'จรุงวิทย์', 'บุญเพิ่ม', '0-0-100-75', '5836caa50989a_5836caa508e29.jpg', '5836caa508e29.jpg', '', '', '', ''), (42, 'สัมพันธ์', 'คงมาก', '0-0-100-75', '5836caba3fea0_5836caba3f068.jpg', '5836caba3f068.jpg', '', '', '', ''), (43, 'ฐิติมา', 'เทพญา', '0-0-100-74.24', '586b3ff408ddb_586b3eed6122b.jpg', '586b3eed6122b.jpg', '', '', '', ''), (44, 'มูฮำหมัดสูใฮมี', 'ยานยา', '0-0-100-100', '5836cadc94b79_5836cadc93b34.jpg', '5836cadc93b34.jpg', '', '', '', ''), (45, 'ชนกิตติ์', 'ธนะสุข', '0-0-100-100', '5836cb3023929_5836cb3022f5d.jpg', '5836cb3022f5d.jpg', '', '', '', ''), (46, 'กำธร', 'เกิดทิพย์', '0-0-100-100', '5836cb46d960c_5836cb46d8451.jpg', '5836cb46d8451.jpg', '', '', '', ''), (47, 'ศุภราภรณ์', 'ทวนน้อย', '0-0-100-100', '5836cb59145a9_5836cb5913a8b.jpg', '5836cb5913a8b.jpg', '', '', '', ''), (48, 'ดุษฎี', 'เพ็ชรมงคล', '0-0-100-100', '5836cb6add1ca_5836cb6adc424.jpg', '5836cb6adc424.jpg', '', '', '', ''), (49, 'ภักดี', 'ต่วนศิริ', '0-0-100-100', '5836cb7eea857_5836cb7ee9659.jpg', '5836cb7ee9659.jpg', '', '', '', ''), (50, 'สิทธิกร', 'เทพสุวรรณ', '0-0-100-100', '5836cb8ea2d45_5836cb8ea22d1.jpg', '5836cb8ea22d1.jpg', '', '', '', ''), -- -- Indexes for dumped tables -- -- -- Indexes for table `desktop_setting` -- ALTER TABLE `desktop_setting` ADD PRIMARY KEY (`id`); -- -- Indexes for table `session` -- ALTER TABLE `session` ADD PRIMARY KEY (`id`); -- -- Indexes for table `user` -- ALTER TABLE `user` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `username` (`username`), ADD UNIQUE KEY `email` (`email`), ADD UNIQUE KEY `password_reset_token` (`password_reset_token`); -- -- Indexes for table `user_profile` -- ALTER TABLE `user_profile` ADD PRIMARY KEY (`user_id`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `desktop_setting` -- ALTER TABLE `desktop_setting` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; -- -- AUTO_INCREMENT for table `session` -- ALTER TABLE `session` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `user` -- ALTER TABLE `user` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=51; -- -- AUTO_INCREMENT for table `user_profile` -- ALTER TABLE `user_profile` MODIFY `user_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=52; /*!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
b332079594975ef26c4738f8798c14f3e0268890
SQL
ccjensen931/CJcs313
/db/teamActivity07/teamActivity07.sql
UTF-8
396
3.140625
3
[]
no_license
CREATE TABLE team07_users ( user_id INTEGER, username VARCHAR(50) CONSTRAINT nn_users_1 NOT NULL, user_password VARCHAR(255) CONSTRAINT nn_users_2 NOT NULL, CONSTRAINT pk_team07_users PRIMARY KEY(user_id) ); CREATE SEQUENCE team07_users_s1 START WITH 1; CREATE UNIQUE INDEX team07_users_idx1 ON users(username);
true
d152b2bf5d278bcffc7488023eca5e2d66705808
SQL
Sachin9549/City-Bus-Management-System--DBMS
/DDL.sql
UTF-8
2,227
3.53125
4
[ "MIT" ]
permissive
create table customer (name varchar(100), NIC varchar(10), address varchar(200), occupation varchar(20), email varchar(100), username varchar(32), // md5 hashed password varchar(32), primary key (username), // md5 hashed ); create table login (role_id varchar(10), username varchar(32), password varchar(32), role varchar(3), INDEX (username, password) ); CREATE TABLE bus ( `registration_no` VARCHAR(9) NOT NULL , `owner` VARCHAR(100) NOT NULL , `route_no` VARCHAR(10) NOT NULL , PRIMARY KEY (`registration_no`)) ; INSERT INTO bus (`registration_no`, `owner`, `route_no`) VALUES ('WPNB-1522', 'T.S. Wijenayaka', '255'); INSERT INTO bus (`registration_no`, `owner`, `route_no`) VALUES ('WPNA-8201', 'T.D. Muthuhettigama', '383/2'); INSERT INTO bus (`registration_no`, `owner`, `route_no`) VALUES ('SPME-6739', 'L. Bandara', '02'); CREATE TABLE route ( `route_no` VARCHAR(10) NOT NULL , `first_station` VARCHAR(50) NOT NULL , `second_station` VARCHAR(50) NOT NULL , `price` INT(6) NOT NULL , PRIMARY KEY (`route_no`)) ; INSERT INTO route (`route_no`, `first_station`, `second_station`, `price`) VALUES ('255', 'Colombo', 'Kandy', '250'); INSERT INTO route (`route_no`, `first_station`, `second_station`, `price`) VALUES ('383/2', 'Jaffna', 'Galle', '530'); INSERT INTO route (`route_no`, `first_station`, `second_station`, `price`) VALUES ('02', 'Galle', 'Colombo', '180'); INSERT INTO route (`route_no`, `first_station`, `second_station`, `price`) VALUES ('92', 'Colombo', 'Kuliyapitiya', '220'); create table owner (name varchar(100), NIC varchar(10), address varchar(200), email varchar(100), username varchar(32), password varchar(32), primary key (NIC) ); create table active_busses ( bus_id varchar(9), route_no varchar(6), start_loc varchar(20), end_loc varchar(20), date varchar(10), time varchar(8), seats_available int ); INSERT INTO active_busses(`bus_id`, `route_no`, `start_loc`, `end_loc`, `date`, `time`, `seats_available`) VALUES ('WPNA-8201','383/2','Jaffna','Galle','2016/12/20','8.00 AM',54);
true
667beacfc9569b4979572b65445e2375dd915e29
SQL
medy13/dbshell
/normal_shell/EMS_CLR_TMP.sql
UTF-8
685
2.734375
3
[]
no_license
\echo ------------------EMS_CLR_TMP---------------- select now(); \timing insert into EMS_CLR_TMP_GPTMP (CMD_TYPE,EMS_NO, G_TYPE, G_NO) select CMD_TYPE,EMS_NO, G_TYPE, G_NO from EMS_CLR_TMP_INC_EXT; delete from EMS_CLR_TMP using EMS_CLR_TMP_GPTMP where EMS_CLR_TMP_GPTMP.EMS_NO=EMS_CLR_TMP.EMS_NO AND EMS_CLR_TMP_GPTMP.G_TYPE=EMS_CLR_TMP.G_TYPE AND EMS_CLR_TMP_GPTMP.G_NO=EMS_CLR_TMP.G_NO ; insert into EMS_CLR_TMP(EMS_NO,G_TYPE,G_NO,CM_QTY,CM_AMOUNT,CLR_INC_QTY,CLR_CUT_QTY,USD_PRICE,OTHER_PRICE,NOTE) select EMS_NO,G_TYPE,G_NO,CM_QTY,CM_AMOUNT,CLR_INC_QTY,CLR_CUT_QTY,USD_PRICE,OTHER_PRICE,NOTE from EMS_CLR_TMP_INC_EXT where CMD_TYPE='I'; delete from EMS_CLR_TMP_GPTMP; \timing
true
23d7274cb1bd80f986876290df7688046d27913c
SQL
wen1now/iptmp2
/scripts.sql
UTF-8
2,420
3.359375
3
[]
no_license
--i hope this works create database CriticalMiss; create table Users ( userid integer unsigned auto_increment not null, hash varchar(255) not null, username varchar(31) not null, pointer varchar(6) not null, picture varchar(255) not null, primary key(userid) ); create table Rooms ( roomid integer unsigned auto_increment not null, roomname varchar(31) not null, owner integer unsigned not null, keyphrase varchar(31) not null, capacity smallint not null, primary key(roomid), foreign key(owner) references Users(userid) ); create table Characters ( userid integer unsigned not null, roomid integer unsigned not null, ypoint integer not null, xpoint integer not null, picture varchar(255) not null, primary key(userid, roomid), foreign key(userid) references Users(userid), foreign key(roomid) references Rooms(roomid) ); create table Boardimages ( imageid integer unsigned auto_increment not null, roomid integer unsigned not null, owner integer unsigned not null, stack_order integer not null, x integer not null, y integer not null, ground bit not null, picture varchar(255) not null, primary key(imageid), foreign key(owner) references Users(userid), foreign key(roomid) references Rooms(roomid) ); create table Messages ( messageid integer unsigned auto_increment not null, roomid integer unsigned not null, userid integer unsigned not null, alias varchar(31) not null, send_date datetime not null, blurb text not null, primary key(messageid), foreign key(userid) references Users(userid), foreign key(roomid) references Rooms(roomid) ); create table Aliases ( aliasid integer unsigned auto_increment not null, displayname varchar(31) not null, textcolour varchar(6) not null, roomid integer unsigned not null, owner integer unsigned not null, primary key(aliasid), foreign key(owner) references Users(userid), foreign key(roomid) references Rooms(roomid) ); create table Notes ( noteid integer unsigned auto_increment not null, title varchar(31) not null, private bit not null, blurb text not null, roomid integer unsigned not null, owner integer unsigned not null, primary key(noteid), foreign key(owner) references Users(userid), foreign key(roomid) references Rooms(roomid) ); create table Images ( userid integer unsigned not null, image varchar(255) not null, primary key(userid, image), foreign key(userid) references Users(userid) )
true
f14304c4bd482429a68950cc4b56e87bf2a67121
SQL
kh918/dynaop
/dynaop/src/main/resources/sql/dynaop.sql
UTF-8
23,569
2.9375
3
[]
no_license
/* Navicat MySQL Data Transfer Source Server : localhost Source Server Version : 50519 Source Host : localhost:3306 Source Database : taskrole Target Server Type : MYSQL Target Server Version : 50519 File Encoding : 65001 Date: 2014-04-01 13:20:31 */ SET FOREIGN_KEY_CHECKS=0; -- ---------------------------- -- Table structure for `t_info` -- ---------------------------- DROP TABLE IF EXISTS `t_info`; CREATE TABLE `t_info` ( `id` varchar(64) NOT NULL, `info` tinytext NOT NULL, `createtime` datetime NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of t_info -- ---------------------------- -- ---------------------------- -- Table structure for `t_login` -- ---------------------------- DROP TABLE IF EXISTS `t_login`; CREATE TABLE `t_login` ( `ID` varchar(64) NOT NULL DEFAULT '' COMMENT 'key', `USERNAME` varchar(80) NOT NULL COMMENT '用户名', `PASSWORD` varchar(50) NOT NULL COMMENT '登陆密码', PRIMARY KEY (`ID`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of t_login -- ---------------------------- INSERT INTO `t_login` VALUES ('1', 'ivan', '1'); -- ---------------------------- -- Table structure for `t_menu` -- ---------------------------- DROP TABLE IF EXISTS `t_menu`; CREATE TABLE `t_menu` ( `ID` varchar(64) NOT NULL COMMENT 'logic id', `MENU_ID` varchar(64) NOT NULL COMMENT 'menu''s id', `PARENT_ID` varchar(64) DEFAULT NULL COMMENT 'menu''s parent id', `MENU_NAME` varchar(40) DEFAULT NULL COMMENT 'menu''s name', `MENU_NAME_ZH` varchar(20) DEFAULT NULL COMMENT 'menu''s chinese name', `MENU_URI` varchar(200) DEFAULT NULL, PRIMARY KEY (`ID`,`MENU_ID`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='system''s menu'; -- ---------------------------- -- Records of t_menu -- ---------------------------- INSERT INTO `t_menu` VALUES ('1', '01000', null, 'Task Management', '任务管理', null); INSERT INTO `t_menu` VALUES ('10', '03001', '03000', 'User List', '用户列表', '/userinfo/turn2userlist.action'); INSERT INTO `t_menu` VALUES ('11', '03002', '03000', 'Common Set', '通用设置', 'http://www.baidu.com'); INSERT INTO `t_menu` VALUES ('12', '03003', '03000', 'Task Set', '任务设置', 'http://www.baidu.com'); INSERT INTO `t_menu` VALUES ('13', '03004', '03000', 'Role Set', '角色设置', 'http://www.baidu.com'); INSERT INTO `t_menu` VALUES ('14', '03005', '03000', 'Team Set', '团队设置', 'http://www.baidu.com'); INSERT INTO `t_menu` VALUES ('15', '04000', null, 'RoleSet', '角色设置', null); INSERT INTO `t_menu` VALUES ('16', '04001', '04000', 'Create Role', '创建角色', '/role/turn2role.action'); INSERT INTO `t_menu` VALUES ('17', '04002', '04000', 'Role List', '角色列表', '/role/rolelist.action'); INSERT INTO `t_menu` VALUES ('18', '04003', '04000', 'Role Store', '角色库', '/role/trun2stroe.action'); INSERT INTO `t_menu` VALUES ('19', '05000', null, 'Organization', '组织机构管理', null); INSERT INTO `t_menu` VALUES ('2', '01001', '01000', 'Task List', '任务列表', '/mission/mislist.action'); INSERT INTO `t_menu` VALUES ('20', '05001', '05000', 'Create Organization', '创建组织架构', '/organize/turn2org.action'); INSERT INTO `t_menu` VALUES ('21', '05002', '05000', 'Organization List', '组织机构列表', '/organize/orglist.action'); INSERT INTO `t_menu` VALUES ('22', '04004', '04000', 'set default role', '设置默认角色', '/role/turn2roleset.action'); INSERT INTO `t_menu` VALUES ('23', '06000', null, 'Permission Manage', '权限管理', null); INSERT INTO `t_menu` VALUES ('24', '06001', '06000', 'Create Permission', '创建权限', '/permission/turn2per.action'); INSERT INTO `t_menu` VALUES ('25', '06002', '06000', 'Permission List', '权限列表', '/permission/perlist.action'); INSERT INTO `t_menu` VALUES ('26', '01004', '01000', 'priority set', '任务优先级设置', '/mission/turn2priority.action'); INSERT INTO `t_menu` VALUES ('27', '01005', '01000', 'priority list', '任务优先级列表', '/mission/prilist.action'); INSERT INTO `t_menu` VALUES ('3', '01002', '01000', 'Create Task', '创建任务', '/mission/turn2mission.action'); INSERT INTO `t_menu` VALUES ('4', '01003', '01000', 'Task Template', '任务模板', 'http://www.baidu.com'); INSERT INTO `t_menu` VALUES ('5', '02000', null, 'Team Management', '团队管理', null); INSERT INTO `t_menu` VALUES ('6', '02001', '02000', 'Current Team List', '当前团队列表', 'http://www.baidu.com'); INSERT INTO `t_menu` VALUES ('7', '02002', '02000', 'All Team List', '所有团队列表', 'http://www.baidu.com'); INSERT INTO `t_menu` VALUES ('8', '02003', '02000', 'Team Management', '团队管理', 'http://www.baidu.com'); INSERT INTO `t_menu` VALUES ('9', '03000', null, 'User Center', '用户设置', null); -- ---------------------------- -- Table structure for `t_mission_current` -- ---------------------------- DROP TABLE IF EXISTS `t_mission_current`; CREATE TABLE `t_mission_current` ( `ID` varchar(64) NOT NULL COMMENT '自动配置', `MISSION_ID` varchar(64) NOT NULL COMMENT '任务ID', `CURR_STATE` tinyint(30) NOT NULL COMMENT '当前任务的状态', `CURR_EXECUTOR` varchar(64) NOT NULL COMMENT '当前任务执行者的ID', `CURR_TIME` datetime NOT NULL COMMENT '执行到当前处理状态的时间点', `CREATOR` varchar(64) NOT NULL COMMENT '创建者的ID', PRIMARY KEY (`ID`), KEY `miscur_1` (`MISSION_ID`) USING BTREE, CONSTRAINT `misinfo_ibfk_1` FOREIGN KEY (`MISSION_ID`) REFERENCES `t_mission_info` (`ID`) ON DELETE CASCADE ON UPDATE NO ACTION ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='任务当前的执行状态'; -- ---------------------------- -- Records of t_mission_current -- ---------------------------- INSERT INTO `t_mission_current` VALUES ('03371ee5-31bc-4e6f-9e74-6f80f6aac3f2', '4613613b-47da-4199-8309-81eb083ba34d', '1', '(瀹屾垚鐢ㄦ埛鐨勮鑹蹭互鍙婃潈闄愬悗琛ュ厖瀹屾暣)', '2014-02-23 22:30:34', ''); INSERT INTO `t_mission_current` VALUES ('07de50f1-e699-40ae-8e22-a075ade0361d', '42bc3a87-4665-427f-b2b8-43c10fd839c8', '1', 'aa85622b-1ebb-4ec3-ba9d-93eaa7b35cf0', '2014-04-01 12:58:42', 'ivan'); INSERT INTO `t_mission_current` VALUES ('20c4af47-15a4-4a53-a89b-620cf1b9a269', '52bd77ee-5737-435c-8bf9-f6752805b584', '1', 'ivan', '2014-02-23 17:38:49', ''); INSERT INTO `t_mission_current` VALUES ('64fa6783-bfb2-4c3d-9bbb-ad7e68f9268f', 'd12f0695-699c-45b2-8863-08413b4af74d', '1', '(完成用户的角色以及权限后补充完整)', '2014-03-06 11:05:14', ''); INSERT INTO `t_mission_current` VALUES ('77129ecb-4886-45c3-a796-ae63922d70a1', '55952efa-2b6f-433c-9f8a-c5039ca52a92', '1', '(完成用户的角色以及权限后补充完整)', '2014-02-23 22:27:39', ''); INSERT INTO `t_mission_current` VALUES ('8c9216f6-5768-4aa6-a131-5fa7793570be', '30b7a405-5bc8-4892-aea5-607a9397098c', '1', '1', '2014-03-31 19:59:49', 'ivan'); INSERT INTO `t_mission_current` VALUES ('955a9d7b-fd7c-4129-b2af-2da8b88d0006', '7831331b-06bc-4095-b9a5-484aa5ef3044', '1', 'aliceliu', '2014-02-23 17:58:52', ''); INSERT INTO `t_mission_current` VALUES ('9f310bc8-1985-4ff3-b19d-4adbf4d71659', '8e772236-2822-4557-bce8-7fc476905dea', '1', 'ivan', '2014-02-23 17:56:36', ''); INSERT INTO `t_mission_current` VALUES ('a6529bea-79f5-4158-a632-4c02a7fe6ee8', '1aad59ae-cf77-4a9c-87d2-c66f41b4bbae', '1', '(完成用户的角色以及权限后补充完整)', '2014-02-23 22:22:20', ''); INSERT INTO `t_mission_current` VALUES ('aa118406-1476-4e65-8f81-e08ad829694f', '1bd2c123-2a8c-4976-8fb3-8cfd22498ad9', '1', '(完成用户的角色以及权限后补充完整)', '2014-02-23 22:42:23', ''); INSERT INTO `t_mission_current` VALUES ('aad38569-46a1-40ed-8837-9971ebe380dd', '03ff8a1f-c9ef-4a6b-87f9-dbcf9c1b1f7f', '1', '(完成用户的角色以及权限后补充完整)', '2014-02-23 22:26:44', ''); INSERT INTO `t_mission_current` VALUES ('bbb7d89b-30b4-457d-8598-ee8a83e17f78', '277004a5-19c1-43a2-bc28-8beb1b9453a7', '1', '', '2014-03-03 22:31:50', ''); INSERT INTO `t_mission_current` VALUES ('d136a780-efb6-476d-8fb6-df2c92010794', 'a1d339e4-bb58-4754-9839-bcd727b6164e', '1', '(完成用户的角色以及权限后补充完整)', '2014-02-23 22:33:16', ''); INSERT INTO `t_mission_current` VALUES ('e712b466-78a6-41e7-9b9f-2708afd3616d', '71bdc82f-3f07-4356-b044-26f9bdf76ee4', '1', '(瀹屾垚鐢ㄦ埛鐨勮鑹蹭互鍙婃潈闄愬悗琛ュ厖瀹屾暣)', '2014-02-23 22:31:28', ''); INSERT INTO `t_mission_current` VALUES ('e95ec115-0c80-4d28-8cf3-487b30e47c5b', '1e75a55b-9223-47cc-bf2c-a2527f2ed114', '1', 'ivan', '2014-02-23 17:55:34', ''); -- ---------------------------- -- Table structure for `t_mission_grade` -- ---------------------------- DROP TABLE IF EXISTS `t_mission_grade`; CREATE TABLE `t_mission_grade` ( `ID` varchar(64) NOT NULL COMMENT '自动配置', `MISSION_ID` varchar(64) NOT NULL COMMENT '任务ID', `FATHER_ID` varchar(64) NOT NULL COMMENT '任务的父ID' ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='任务的父子等级表'; -- ---------------------------- -- Records of t_mission_grade -- ---------------------------- -- ---------------------------- -- Table structure for `t_mission_history` -- ---------------------------- DROP TABLE IF EXISTS `t_mission_history`; CREATE TABLE `t_mission_history` ( `ID` varchar(64) NOT NULL COMMENT '自动ID,完全拷贝t_mission_current的ID', `MISSION_ID` varchar(64) NOT NULL COMMENT '任务ID', `MISSION_STATE` tinyint(30) NOT NULL COMMENT '当时的任务状态', `EXECUTOR` varchar(64) NOT NULL COMMENT '当时的任务执行人', `EXEC_TIME` datetime NOT NULL COMMENT '但是任务的执行更新时间', PRIMARY KEY (`ID`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='记录任务的执行过程表历史表'; -- ---------------------------- -- Records of t_mission_history -- ---------------------------- -- ---------------------------- -- Table structure for `t_mission_info` -- ---------------------------- DROP TABLE IF EXISTS `t_mission_info`; CREATE TABLE `t_mission_info` ( `ID` varchar(100) NOT NULL DEFAULT 'null' COMMENT 'Mission''s id', `MISSION_NAME` varchar(100) NOT NULL COMMENT 'Mission''s name', `DESCR` varchar(500) DEFAULT NULL COMMENT 'Describe the misson', `PLAN_TIME` int(20) DEFAULT NULL COMMENT 'How long the mission task according to plan', `TIME_UNIT` tinyint(1) DEFAULT NULL COMMENT 'man day or man hour', `START_TIME` datetime NOT NULL COMMENT 'Misson start time', `END_TIME` datetime DEFAULT NULL COMMENT 'Mission end time', `MISSION_PRIORITY` varchar(64) NOT NULL COMMENT 'Misson Priority', `CREATOR` varchar(64) NOT NULL COMMENT 'Which user''s id create this mission.', `PRE_MISSION` varchar(64) DEFAULT NULL COMMENT '前置任务', `REAL_START_TIME` datetime NOT NULL, `REAL_PLAN_TIME` int(20) DEFAULT NULL, `EST_COM_PER` varchar(10) DEFAULT NULL COMMENT 'Estimated completion percentage 估计完成比例', PRIMARY KEY (`ID`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Recording mission''s information'; -- ---------------------------- -- Records of t_mission_info -- ---------------------------- INSERT INTO `t_mission_info` VALUES ('03ff8a1f-c9ef-4a6b-87f9-dbcf9c1b1f7f', 'aa12', null, '4', '1', '2013-08-10 00:00:00', '2014-07-06 00:00:00', '1', 'ivan', null, '0000-00-00 00:00:00', null, null); INSERT INTO `t_mission_info` VALUES ('1aad59ae-cf77-4a9c-87d2-c66f41b4bbae', 'aa1', null, '4', '1', '2014-07-02 00:00:00', '2014-07-06 00:00:00', '1', 'ivan', null, '0000-00-00 00:00:00', null, null); INSERT INTO `t_mission_info` VALUES ('1bd2c123-2a8c-4976-8fb3-8cfd22498ad9', 'aa24', null, '4', '1', '2014-07-02 00:00:00', '2013-09-10 00:00:00', '1', 'ivan', null, '0000-00-00 00:00:00', null, null); INSERT INTO `t_mission_info` VALUES ('1e75a55b-9223-47cc-bf2c-a2527f2ed114', 'aa', null, '3', '1', '2013-08-10 00:00:00', '2013-09-10 00:00:00', '1', 'ivan', null, '0000-00-00 00:00:00', null, null); INSERT INTO `t_mission_info` VALUES ('277004a5-19c1-43a2-bc28-8beb1b9453a7', '韩国人凤飞飞v', '是否过几天', '3', '2', '2014-03-04 00:00:00', '2014-03-04 00:00:00', '2', 'ivan', null, '0000-00-00 00:00:00', null, null); INSERT INTO `t_mission_info` VALUES ('30b7a405-5bc8-4892-aea5-607a9397098c', '收到122', 'ASDF', '3', '1', '2014-03-01 00:00:00', null, '8f50d276-1127-4126-b277-e7988f508318', 'ivan', null, '0000-00-00 00:00:00', null, null); INSERT INTO `t_mission_info` VALUES ('42bc3a87-4665-427f-b2b8-43c10fd839c8', '收到3', '收到3', '20', '2', '2014-04-03 00:00:00', null, 'd9151ef6-2ad6-4f27-9379-30bf2430c3b8', 'ivan', null, '2014-04-03 00:00:00', null, null); INSERT INTO `t_mission_info` VALUES ('4613613b-47da-4199-8309-81eb083ba34d', 'aa13', null, '4', '1', '2013-08-12 00:00:00', '2013-09-10 00:00:00', '1', 'ivan', null, '0000-00-00 00:00:00', null, null); INSERT INTO `t_mission_info` VALUES ('52bd77ee-5737-435c-8bf9-f6752805b584', 'aa', null, '3', '1', '2013-08-10 00:00:00', '2013-09-10 00:00:00', '1', 'ivan', null, '0000-00-00 00:00:00', null, null); INSERT INTO `t_mission_info` VALUES ('55952efa-2b6f-433c-9f8a-c5039ca52a92', 'aa2', null, '4', '1', '2013-08-10 00:00:00', '2014-07-06 00:00:00', '1', 'ivan', null, '0000-00-00 00:00:00', null, null); INSERT INTO `t_mission_info` VALUES ('6df32655-8436-4443-b5d3-457b845b6bdd', '任务1', '吃t1', '3', '1', '2014-02-26 00:00:00', null, '8f50d276-1127-4126-b277-e7988f508318', 'ivan', null, '0000-00-00 00:00:00', null, null); INSERT INTO `t_mission_info` VALUES ('71bdc82f-3f07-4356-b044-26f9bdf76ee4', 'aa21', null, '3', '1', '2013-08-10 00:00:00', '2014-07-06 00:00:00', '1', 'ivan', null, '0000-00-00 00:00:00', null, null); INSERT INTO `t_mission_info` VALUES ('7831331b-06bc-4095-b9a5-484aa5ef3044', 'aa', null, '3', '1', '2013-08-11 00:00:00', '2013-09-10 00:00:00', '1', 'ivan', null, '0000-00-00 00:00:00', null, null); INSERT INTO `t_mission_info` VALUES ('8e772236-2822-4557-bce8-7fc476905dea', 'aa', null, '3', '1', '2013-08-10 00:00:00', '2013-09-10 00:00:00', '1', 'ivan', null, '0000-00-00 00:00:00', null, null); INSERT INTO `t_mission_info` VALUES ('a1d339e4-bb58-4754-9839-bcd727b6164e', 'aa22', null, '4', '1', '2014-07-02 00:00:00', '2014-07-06 00:00:00', '1', 'ivan', null, '0000-00-00 00:00:00', null, null); INSERT INTO `t_mission_info` VALUES ('d12f0695-699c-45b2-8863-08413b4af74d', '收到1', '', '3', '1', '2014-03-04 00:00:00', '2014-03-06 00:00:00', '1', 'ivan', null, '0000-00-00 00:00:00', null, null); -- ---------------------------- -- Table structure for `t_miss_priority` -- ---------------------------- DROP TABLE IF EXISTS `t_miss_priority`; CREATE TABLE `t_miss_priority` ( `ID` varchar(64) NOT NULL, `MIS_PRIORITY_NAME` varchar(100) NOT NULL COMMENT '任务优先级名称', `MIS_PRIORITY_DESC` varchar(200) DEFAULT NULL COMMENT '描述', `CREATE_TIME` datetime NOT NULL COMMENT '创建时间,系统自动记录', PRIMARY KEY (`ID`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of t_miss_priority -- ---------------------------- INSERT INTO `t_miss_priority` VALUES ('5517132a-6599-496f-bd12-58e4385fd286', '优先级2', '优先级2·2', '2014-03-31 16:44:37'); INSERT INTO `t_miss_priority` VALUES ('8f50d276-1127-4126-b277-e7988f508318', '优先级4', '优先级4·42', '2014-04-01 13:07:09'); INSERT INTO `t_miss_priority` VALUES ('a4b3a966-c262-43a0-be70-ed44c87b4f43', '优先级5', '重要优先级', '2014-04-01 13:06:48'); INSERT INTO `t_miss_priority` VALUES ('d9151ef6-2ad6-4f27-9379-30bf2430c3b8', '优先级1', '优先级1··1', '2014-03-31 16:43:19'); INSERT INTO `t_miss_priority` VALUES ('eeeb88c3-2d0b-4cd0-a55c-d1677cb117eb', '优先级3', '优先级3·3', '2014-03-31 17:43:08'); -- ---------------------------- -- Table structure for `t_org_info` -- ---------------------------- DROP TABLE IF EXISTS `t_org_info`; CREATE TABLE `t_org_info` ( `ORG_ID` varchar(64) NOT NULL COMMENT '组织架构ID', `ORG_FULL_NAME` varchar(100) DEFAULT NULL COMMENT '组织架构的中文全称', `ORG_PARENT_ID` varchar(64) DEFAULT NULL COMMENT '组织架构中文简称', `ORG_CODE` varchar(20) DEFAULT NULL COMMENT '组织架构的英文简称', `ORG_DESC` varchar(500) DEFAULT NULL COMMENT '组织架构的描述', PRIMARY KEY (`ORG_ID`), KEY `ORG_ID` (`ORG_ID`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='组织架构信息表'; -- ---------------------------- -- Records of t_org_info -- ---------------------------- INSERT INTO `t_org_info` VALUES ('o1', '1', null, null, null); INSERT INTO `t_org_info` VALUES ('o2', '2', 'o1', null, null); INSERT INTO `t_org_info` VALUES ('o3', '3', 'o1', null, null); INSERT INTO `t_org_info` VALUES ('o4', '4', 'o3', null, null); -- ---------------------------- -- Table structure for `t_per_info` -- ---------------------------- DROP TABLE IF EXISTS `t_per_info`; CREATE TABLE `t_per_info` ( `PER_ID` varchar(64) NOT NULL COMMENT '权限ID', `PER_NAME` varchar(100) NOT NULL COMMENT '权限名称', `PER_DESC` varchar(256) DEFAULT NULL COMMENT '权限描述', `MENU_IDS` varchar(256) NOT NULL COMMENT '菜单IDs 以英文逗号分隔', PRIMARY KEY (`PER_ID`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of t_per_info -- ---------------------------- INSERT INTO `t_per_info` VALUES ('1', '2123', '1342123', '01001, 01002'); INSERT INTO `t_per_info` VALUES ('a0cb2e3f-f1c2-4fbe-abb0-a9a26e8555bb', 'qwerty发阿斯顿111', 'asdfsae1', '01001, 01003, 02001, 02002'); INSERT INTO `t_per_info` VALUES ('d1c123ff-80d9-49f7-987b-6cc2df4ae851', '权限1', '权限描述1', '02001'); -- ---------------------------- -- Table structure for `t_property` -- ---------------------------- DROP TABLE IF EXISTS `t_property`; CREATE TABLE `t_property` ( `NAME_EN` varchar(30) NOT NULL, `STATES` varchar(30) NOT NULL, `NAME_ZH` varchar(30) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='初始化系统内部状态标识等属性'; -- ---------------------------- -- Records of t_property -- ---------------------------- INSERT INTO `t_property` VALUES ('default_role', '', '默认角色'); -- ---------------------------- -- Table structure for `t_rel_org_role` -- ---------------------------- DROP TABLE IF EXISTS `t_rel_org_role`; CREATE TABLE `t_rel_org_role` ( `ID` varchar(64) NOT NULL COMMENT '关系表ID', `ORG_ID` varchar(64) NOT NULL COMMENT '组织架构ID', `ROLE_ID` varchar(64) NOT NULL COMMENT '角色的ID', PRIMARY KEY (`ID`), KEY `org_role_rel_ind1` (`ORG_ID`) USING BTREE, KEY `org_role_rel_ind2` (`ROLE_ID`) USING HASH, CONSTRAINT `org_fk` FOREIGN KEY (`ORG_ID`) REFERENCES `t_org_info` (`ORG_ID`) ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT `role_fk` FOREIGN KEY (`ROLE_ID`) REFERENCES `t_role_info` (`ROLE_ID`) ON DELETE CASCADE ON UPDATE NO ACTION ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='组织架构与角色的关系表'; -- ---------------------------- -- Records of t_rel_org_role -- ---------------------------- INSERT INTO `t_rel_org_role` VALUES ('r1', 'o2', '2'); INSERT INTO `t_rel_org_role` VALUES ('r2', 'o4', '3'); -- ---------------------------- -- Table structure for `t_rel_per_role` -- ---------------------------- DROP TABLE IF EXISTS `t_rel_per_role`; CREATE TABLE `t_rel_per_role` ( `REL_ID` varchar(64) NOT NULL, `ROLE_ID` varchar(64) NOT NULL COMMENT '角色ID', `PER_ID` varchar(64) NOT NULL COMMENT '权限IDS,以英文逗号分隔', PRIMARY KEY (`REL_ID`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of t_rel_per_role -- ---------------------------- INSERT INTO `t_rel_per_role` VALUES ('1c211877-b52b-40d2-8f09-e4c59c4cb7c2', '9', 'd1c123ff-80d9-49f7-987b-6cc2df4ae851'); INSERT INTO `t_rel_per_role` VALUES ('2d0fd53c-fbf1-432c-9853-b42018fd228a', '9', 'a0cb2e3f-f1c2-4fbe-abb0-a9a26e8555bb'); INSERT INTO `t_rel_per_role` VALUES ('35250aea-20ad-41ca-a1f2-d627a90ca64f', 'aa85622b-1ebb-4ec3-ba9d-93eaa7b35cf0', ' a0cb2e3f-f1c2-4fbe-abb0-a9a26e8555bb'); INSERT INTO `t_rel_per_role` VALUES ('af146816-10bd-4b99-9f08-057680f0321b', 'aa85622b-1ebb-4ec3-ba9d-93eaa7b35cf0', '1'); INSERT INTO `t_rel_per_role` VALUES ('d2223f81-d715-43f3-9a76-c71d20f41739', 'aa85622b-1ebb-4ec3-ba9d-93eaa7b35cf0', ' d1c123ff-80d9-49f7-987b-6cc2df4ae851'); INSERT INTO `t_rel_per_role` VALUES ('e7917956-bd72-49ee-b000-39dfc5a6b44c', '9', '1'); -- ---------------------------- -- Table structure for `t_rel_user_role` -- ---------------------------- DROP TABLE IF EXISTS `t_rel_user_role`; CREATE TABLE `t_rel_user_role` ( `ID` varchar(64) NOT NULL COMMENT '表ID', `USER_ID` varchar(64) NOT NULL COMMENT '用户ID', `ROLE_ID` varchar(64) NOT NULL COMMENT '角色ID', PRIMARY KEY (`ID`), KEY `role_user_fk` (`ROLE_ID`), KEY `user_ind` (`USER_ID`) USING HASH, CONSTRAINT `role_user_fk` FOREIGN KEY (`ROLE_ID`) REFERENCES `t_role_info` (`ROLE_ID`) ON DELETE CASCADE ON UPDATE NO ACTION ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='用户角色关系表'; -- ---------------------------- -- Records of t_rel_user_role -- ---------------------------- -- ---------------------------- -- Table structure for `t_role_info` -- ---------------------------- DROP TABLE IF EXISTS `t_role_info`; CREATE TABLE `t_role_info` ( `ROLE_ID` varchar(64) NOT NULL COMMENT '角色ID', `ROLE_NAME` varchar(50) NOT NULL COMMENT '角色中文名', `ROLE_DESC` varchar(100) DEFAULT NULL COMMENT '角色备注描述', `ROLE_VAL` varchar(1) NOT NULL DEFAULT '1' COMMENT '角色是否有效标志位,默认1为有效,0无效', PRIMARY KEY (`ROLE_ID`), KEY `ROLE_ID` (`ROLE_ID`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='角色基本信息表'; -- ---------------------------- -- Records of t_role_info -- ---------------------------- INSERT INTO `t_role_info` VALUES ('0', '新进员工1', '员工默认角色1', '0'); INSERT INTO `t_role_info` VALUES ('1', '1', null, '1'); INSERT INTO `t_role_info` VALUES ('10', '10', null, '1'); INSERT INTO `t_role_info` VALUES ('11', '11', null, '1'); INSERT INTO `t_role_info` VALUES ('12', '12', null, '1'); INSERT INTO `t_role_info` VALUES ('13', '13', '13', '1'); INSERT INTO `t_role_info` VALUES ('14', '14', '14', '1'); INSERT INTO `t_role_info` VALUES ('15', '15', null, '1'); INSERT INTO `t_role_info` VALUES ('2', '2', '2', '1'); INSERT INTO `t_role_info` VALUES ('3', '3', null, '1'); INSERT INTO `t_role_info` VALUES ('4', '4', '4', '1'); INSERT INTO `t_role_info` VALUES ('5', '5-3', '5-1', '1'); INSERT INTO `t_role_info` VALUES ('6', '6', null, '1'); INSERT INTO `t_role_info` VALUES ('7', '7', null, '1'); INSERT INTO `t_role_info` VALUES ('8', '8', null, '1'); INSERT INTO `t_role_info` VALUES ('9', '9', null, '1'); INSERT INTO `t_role_info` VALUES ('aa85622b-1ebb-4ec3-ba9d-93eaa7b35cf0', '角色11', '角色12', '1'); -- ---------------------------- -- Table structure for `t_userinfo` -- ---------------------------- DROP TABLE IF EXISTS `t_userinfo`; CREATE TABLE `t_userinfo` ( `ID` varchar(64) NOT NULL DEFAULT '' COMMENT 'key', `LONGIN_ID` varchar(64) NOT NULL, `USERNAME` varchar(80) NOT NULL COMMENT 'user name', `EMAIL` varchar(100) DEFAULT '' COMMENT 'Email address', `QQ` varchar(40) DEFAULT '' COMMENT 'QQ', `DEPT_ID` varchar(20) DEFAULT '', PRIMARY KEY (`ID`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of t_userinfo -- ---------------------------- INSERT INTO `t_userinfo` VALUES ('1', '1', 'ivan', '11huangjianghua81@163.com', '111', '');
true
972297c15a59832cb1cacee7c6198c2c97c0c1f1
SQL
greenplum-db/gpdb
/src/test/modules/test_ddl_deparse/sql/opfamily.sql
UTF-8
1,695
3.46875
3
[ "Apache-2.0", "LicenseRef-scancode-generic-cla", "PostgreSQL", "OpenSSL", "LicenseRef-scancode-stream-benchmark", "ISC", "LicenseRef-scancode-openssl", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-ssleay-windows", "BSD-2-Clause", "Python-2.0" ]
permissive
-- copied from equivclass.sql create type int8alias1; create function int8alias1in(cstring) returns int8alias1 strict immutable language internal as 'int8in'; create function int8alias1out(int8alias1) returns cstring strict immutable language internal as 'int8out'; create type int8alias1 ( input = int8alias1in, output = int8alias1out, like = int8 ); create type int8alias2; create function int8alias2in(cstring) returns int8alias2 strict immutable language internal as 'int8in'; create function int8alias2out(int8alias2) returns cstring strict immutable language internal as 'int8out'; create type int8alias2 ( input = int8alias2in, output = int8alias2out, like = int8 ); create cast (int8 as int8alias1) without function; create cast (int8 as int8alias2) without function; create cast (int8alias1 as int8) without function; create cast (int8alias2 as int8) without function; create function int8alias1eq(int8alias1, int8alias1) returns bool strict immutable language internal as 'int8eq'; create operator = ( procedure = int8alias1eq, leftarg = int8alias1, rightarg = int8alias1, commutator = =, restrict = eqsel, join = eqjoinsel, merges ); alter operator family integer_ops using btree add operator 3 = (int8alias1, int8alias1); -- copied from alter_table.sql create type ctype as (f1 int, f2 text); create function same(ctype, ctype) returns boolean language sql as 'select $1.f1 is not distinct from $2.f1 and $1.f2 is not distinct from $2.f2'; create operator =(procedure = same, leftarg = ctype, rightarg = ctype); create operator class ctype_hash_ops default for type ctype using hash as operator 1 =(ctype, ctype);
true
bc0785569c7c07c2c412314cb66d432779d57448
SQL
CUBRID/cubrid-testcases
/sql/_19_apricot/_04_multi-table_update/cases/inheritance_02.sql
UTF-8
938
3.140625
3
[ "BSD-3-Clause" ]
permissive
--CLIENT create class t_tr(i int); create class t(i int); create trigger tr before delete on t execute insert into t_tr values(obj.i); insert into t values (1), (2), (3), (4), (5); create class t1 under t (j int); insert into t1 values (4, 4), (5,5), (6, 6), (7, 7), (8, 8); create class t11 under t1 (k int); insert into t11 values (4, 4, 4), (5, 5, 5), (6, 6, 6), (10, 10, 10), (11, 11, 11); create class t2 under t (l int); insert into t2 values (-4, -4), (-5,-5), (-6, -6), (-7, -7), (-8, -8); create class t21 under t2 (m int); insert into t21 values (-4, -4, -4), (-5, -5, -5), (-6, -6, -6), (-10, -10, -10), (-11, -11, -11); update all t set t.i=t.i + 1; select * from t order by 1; select * from t1 order by 1; select * from t2 order by 1; select * from t11 order by 1; select * from t21 order by 1; select * from t_tr order by 1; drop table t11; drop table t21; drop table t1; drop table t2; drop table t; drop table t_tr;
true
2e8f299fad9d62eaddc84eaf28d8d83fcd920a62
SQL
darkfiremoon/Database-Assignment
/P_REPORT/P_CURR_REPORT.sql
UTF-8
360
3.40625
3
[]
no_license
CREATE OR REPLACE PROCEDURE P_CURR_REPORT ( CUR_REPORT OUT SYS_REFCURSOR ) IS FIRST_DATE DATE; BEGIN FIRST_DATE := TRUNC(SYSDATE, 'MONTH'); OPEN CUR_REPORT FOR SELECT VW.EMP_CD, VW.EMP_NAME, SUM(VW.TOTAL_PAYMENT) AS TOTAL_PROFIT FROM VW_SALES VW WHERE VW.DATE_COMMENCE BETWEEN FIRST_DATE AND SYSDATE GROUP BY VW.EMP_CD, VW.EMP_NAME ORDER BY VW.EMP_CD; END;
true
86f78396d37f40bf2e90ee17b2cf8bfeaefac399
SQL
Priyanshi200014/To-Do-Management-System
/todo-list/sql_scripts/create_tables.sql
UTF-8
1,024
3.5
4
[]
no_license
CREATE DATABASE IF NOT EXISTS `todo_management_directory`; USE `todo_management_directory`; -- -- Table structure for table `users` -- DROP TABLE IF EXISTS `users`; CREATE TABLE `users` ( `id` int(11) NOT NULL AUTO_INCREMENT, `username` varchar(45) DEFAULT NULL, `password` varchar(45) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=latin1; INSERT INTO `users` VALUES (1,'admin','admin'); -- -- Table structure for table `tasks` -- DROP TABLE IF EXISTS `tasks`; CREATE TABLE `tasks` ( `userid` int(11) NOT NULL, `taskid` int(11) NOT NULL AUTO_INCREMENT, `task_name` varchar(45) DEFAULT NULL, `status` varchar(45) DEFAULT 'Pending', PRIMARY KEY (`taskid`), CONSTRAINT `task_fk` FOREIGN KEY (`userid`) REFERENCES `users` (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=latin1; -- -- Data for table `employee` -- INSERT INTO `tasks` VALUES (1,1,'Go for shopping','Pending'), (1,2,'Do workout','Pending'), (1,3,'Have Dinner at 9 PM','Pending');
true
87d0703dc4439c8ac9f518cdeee1eceddcbeaa58
SQL
lulzzz/tellma
/Tellma.Database.Application/dal/Functions/dal.fn_Center__Node.sql
UTF-8
166
2.9375
3
[ "Apache-2.0" ]
permissive
CREATE FUNCTION [dal].[fn_Center__Node] ( @CenterId INT ) RETURNS HIERARCHYID AS BEGIN RETURN ( SELECT [Node] FROM dbo.Centers WHERE [Id] = @CenterId ) END;
true
e0c832856e446d5a739394572aac2126dd31bc15
SQL
durabilliam/BootcampX
/4_queries/2_total_assistance_request_for_student.sql
UTF-8
449
4.15625
4
[]
no_license
SELECT COUNT(assistance_requests.id) AS total_assistances, students.name AS name FROM assistance_requests JOIN students ON students.id = student_id WHERE students.name LIKE 'Elliot Dickinson' GROUP BY students.name; -- Get the total number of assistance_requests for a student. -- Select the student's name and the total assistance requests. -- Since this query needs to work with any specific student name, use 'Elliot Dickinson' for the student's name here.
true
504eb9c3f9f6316a0dc1f041f799b8a602e64c30
SQL
Cado21/simple-springboot
/src/main/resources/db/migration/V1_0_0__init.sql
UTF-8
1,934
3.3125
3
[]
no_license
create table if not exists item_table ( id bigserial not null constraint item_table_pkey primary key, created_at timestamp, updated_at timestamp, description varchar(255) not null, name varchar(255) not null, quantity integer not null, thumbnail varchar(255) not null ); create table if not exists permission_table ( id bigserial not null constraint permission_table_pkey primary key, created_at timestamp, updated_at timestamp, http_method varchar(255), path_uri varchar(255) ); create table if not exists role_table ( id bigserial not null constraint role_table_pkey primary key, created_at timestamp, updated_at timestamp, name varchar(255) ); create table if not exists role_permission_table ( id bigserial not null constraint role_permission_table_pkey primary key, created_at timestamp, updated_at timestamp, permission_id bigint constraint fkgf59mj95pjwxsdfexq30cl9cf references permission_table, role_id bigint constraint fksk9o3j7044ppjafxofn06eqm9 references role_table ); create table if not exists user_table ( id bigserial not null constraint user_table_pkey primary key, created_at timestamp, updated_at timestamp, name varchar(255) not null, password varchar(255) not null, username varchar(255) not null constraint uk_en3wad7p8qfu8pcmh62gvef6v unique ); create table if not exists user_role_table ( id bigserial not null constraint user_role_table_pkey primary key, created_at timestamp, updated_at timestamp, role_id bigint constraint fkl8ioo1wxmieriir8betxwagg3 references role_table, user_id bigint constraint fkbdp7o20pgggxrxs498xb9x2lg references user_table );
true
b715525a9faf9cb61355ea744c6c2f3787536797
SQL
yvathrey/dbt-spark
/dbt/include/spark/macros/materializations/incremental/incremental.sql
UTF-8
1,959
3.125
3
[ "Apache-2.0" ]
permissive
{% materialization incremental, adapter='spark' -%} {#-- Validate early so we don't run SQL if the file_format + strategy combo is invalid --#} {%- set raw_file_format = config.get('file_format', default='parquet') -%} {%- set raw_strategy = config.get('incremental_strategy', default='append') -%} {%- set file_format = dbt_spark_validate_get_file_format(raw_file_format) -%} {%- set strategy = dbt_spark_validate_get_incremental_strategy(raw_strategy, file_format) -%} {%- set unique_key = config.get('unique_key', none) -%} {%- set partition_by = config.get('partition_by', none) -%} {%- set full_refresh_mode = (flags.FULL_REFRESH == True) -%} {% set on_schema_change = incremental_validate_on_schema_change(config.get('on_schema_change'), default='ignore') %} {% set target_relation = this %} {% set existing_relation = load_relation(this) %} {% set tmp_relation = make_temp_relation(this) %} {% if strategy == 'insert_overwrite' and partition_by %} {% call statement() %} set spark.sql.sources.partitionOverwriteMode = DYNAMIC {% endcall %} {% endif %} {{ run_hooks(pre_hooks) }} {% if existing_relation is none %} {% set build_sql = create_table_as(False, target_relation, sql) %} {% elif existing_relation.is_view or full_refresh_mode %} {% do adapter.drop_relation(existing_relation) %} {% set build_sql = create_table_as(False, target_relation, sql) %} {% else %} {% do run_query(create_table_as(True, tmp_relation, sql)) %} {% do process_schema_changes(on_schema_change, tmp_relation, existing_relation) %} {% set build_sql = dbt_spark_get_incremental_sql(strategy, tmp_relation, target_relation, unique_key) %} {% endif %} {%- call statement('main') -%} {{ build_sql }} {%- endcall -%} {% do persist_docs(target_relation, model) %} {{ run_hooks(post_hooks) }} {{ return({'relations': [target_relation]}) }} {%- endmaterialization %}
true
d039f9495739fd92245bc934a54ae57bc2ffd60f
SQL
NathanNeff/hadoop-examples
/hbase/null_safe_joins/create_and_query.sql
UTF-8
2,163
3.828125
4
[]
no_license
-- HBase table and data inserts -- create 'hbase_a', 'cf1' -- create 'hbase_b', 'cf1' -- put 'hbase_a', '1', 'cf1:record_id', '1' -- put 'hbase_a', '1', 'cf1:record_name', 'bob' -- put 'hbase_b', '1', 'cf1:record_id', '1' -- put 'hbase_b', '1', 'cf1:record_name', 'B robert' -- # record_id for bob in both tables where record_id is NULL -- put 'hbase_a', '2', 'cf1:record_name', 'steve' -- put 'hbase_b', '2', 'cf1:record_name', 'steves record' -- These create statement will map to the underlying -- hbase_a and hbase_b tables. the_key, record_id, and -- record_name fields are mapped correctly. -- drop table if exists hbase_a; create external table hbase_a (the_key string, record_id string, record_name string) STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' WITH SERDEPROPERTIES ("hbase.columns.mapping" = ":key, cf1:record_id, cf1:record_name") TBLPROPERTIES ("hbase.table.name" = "hbase_a"); -- drop table if exists hbase_b; create external table hbase_b (the_key string, record_id string, record_name string) STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' WITH SERDEPROPERTIES ("hbase.columns.mapping" = ":key, cf1:record_id, cf1:record_name") TBLPROPERTIES ("hbase.table.name" = "hbase_b"); select * from hbase_a join hbase_b on hbase_a.record_id <=> hbase_b.record_id; -- Yields two rows (expected behavior) select hbase_a.record_id, hbase_b.record_id, hbase_a.record_name, hbase_b.record_name from hbase_a join hbase_b on hbase_a.record_id <=> hbase_b.record_id; -- Yields two rows (expected behavior) select hbase_a.record_id, hbase_b.record_id from hbase_a join hbase_b on hbase_a.record_id <=> hbase_b.record_id; -- Yields only ONE row (NOT expected behavior) select hbase_a.record_id, hbase_b.record_id, hbase_a.record_name from hbase_a join hbase_b on hbase_a.record_id <=> hbase_b.record_id; -- Yields only one row (NOT expected behavior) select hbase_a.record_id, hbase_b.record_id, hbase_b.record_name from hbase_a join hbase_b on hbase_a.record_id <=> hbase_b.record_id; -- Yields only one row (NOT expected behavior)
true
c9d328bf28edba2867462fed2545724e88dd87c4
SQL
WillianSi/projetoFinal
/bancoSupermercado/banco_supermercado_cliente.sql
UTF-8
2,549
2.921875
3
[]
no_license
-- MySQL dump 10.13 Distrib 8.0.22, for Win64 (x86_64) -- -- Host: 127.0.0.1 Database: banco_supermercado -- ------------------------------------------------------ -- Server version 8.0.22 /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!50503 SET NAMES 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 `cliente` -- DROP TABLE IF EXISTS `cliente`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `cliente` ( `cpfCliente` varchar(14) NOT NULL, `nomeCliente` varchar(200) NOT NULL, `telCliente` varchar(19) NOT NULL, `ufCliente` varchar(2) NOT NULL, `cepCliente` varchar(10) NOT NULL, `cidadeCliente` varchar(100) NOT NULL, `bairroCliente` varchar(100) NOT NULL, `enderecoCliente` varchar(100) NOT NULL, `idCliente` int NOT NULL AUTO_INCREMENT, PRIMARY KEY (`idCliente`) ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `cliente` -- LOCK TABLES `cliente` WRITE; /*!40000 ALTER TABLE `cliente` DISABLE KEYS */; INSERT INTO `cliente` VALUES ('060.999.123-01','Lorena Alcântara de Farias','+55 (35) 98224-4559','MG','30110-009','Belo Horizonte','Floresta','Av. Contorno, 1827',1),('101.555.246-29','Cristiano Rodrigues Alexandre da Silva','+55 (35) 99855-0011','MG','31741-565','Belo Horizonte','Heliópolis','Rua Ademar Dias Duarte, 0022',2),('066.939.223-21','Ana','+55 (35) 99909-0910','RJ','30770-130','Rio de Janeiro','Caiçaras','Rua Adolfo Monteiro de Castro,0001',4); /*!40000 ALTER TABLE `cliente` 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 2021-03-03 21:24:45
true
bf44b00e098e45609dafbbb94ffc181149fc39b8
SQL
bbenarbia/tassyir-new
/src/main/resources/db/mysql/initDB.sql
UTF-8
4,306
4
4
[]
no_license
drop database IF EXISTS petclinic; CREATE DATABASE IF NOT EXISTS petclinic; GRANT ALL PRIVILEGES ON petclinic.* TO pc@localhost IDENTIFIED BY 'pc'; USE petclinic; CREATE TABLE IF NOT EXISTS vets ( id INT(4) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, first_name VARCHAR(30), last_name VARCHAR(30), INDEX(last_name) ) engine=InnoDB; CREATE TABLE IF NOT EXISTS specialties ( id INT(4) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, name VARCHAR(80), INDEX(name) ) engine=InnoDB; CREATE TABLE IF NOT EXISTS vet_specialties ( vet_id INT(4) UNSIGNED NOT NULL, specialty_id INT(4) UNSIGNED NOT NULL, FOREIGN KEY (vet_id) REFERENCES vets(id), FOREIGN KEY (specialty_id) REFERENCES specialties(id), UNIQUE (vet_id,specialty_id) ) engine=InnoDB; CREATE TABLE IF NOT EXISTS types ( id INT(4) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, name VARCHAR(80), INDEX(name) ) engine=InnoDB; CREATE TABLE IF NOT EXISTS owners ( id INT(4) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, first_name VARCHAR(30), last_name VARCHAR(30), address VARCHAR(255), city VARCHAR(80), telephone VARCHAR(20), INDEX(last_name) ) engine=InnoDB; CREATE TABLE IF NOT EXISTS fonction ( id INT(4) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, name VARCHAR(30), fonction_type INT(4), -- fk_categorieutilisateur_fonction INT(4), INDEX(name) -- FOREIGN KEY (fk_categorieutilisateur_fonction) REFERENCES user_categories(id) )engine=InnoDB; CREATE TABLE IF NOT EXISTS pets ( id INT(4) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, name VARCHAR(30), birth_date DATE, type_id INT(4) UNSIGNED NOT NULL, owner_id INT(4) UNSIGNED NOT NULL, INDEX(name), FOREIGN KEY (owner_id) REFERENCES owners(id), FOREIGN KEY (type_id) REFERENCES types(id) ) engine=InnoDB; CREATE TABLE IF NOT EXISTS visits ( id INT(4) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, pet_id INT(4) UNSIGNED NOT NULL, visit_date DATE, description VARCHAR(255), FOREIGN KEY (pet_id) REFERENCES pets(id) ) engine=InnoDB; CREATE TABLE IF NOT EXISTS parameters ( id INT(4) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, name VARCHAR(30), parameter_value VARCHAR(80), parameter_description VARCHAR(255), INDEX(name) ) engine=InnoDB; CREATE TABLE IF NOT EXISTS user_categories ( id INT(4) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, name VARCHAR(30), INDEX(name) ) engine=InnoDB; CREATE TABLE IF NOT EXISTS contact ( id INT(4) UNSIGNED NOT NULL AUTO_INCREMENT, typecontact INT(4) DEFAULT 0, name VARCHAR(30), nomsocietecontact VARCHAR(30), titrecontact VARCHAR(30), adressecontact1 VARCHAR(255), adressecontact2 VARCHAR(255), alertesurtelephone1 tinyint (1), alertesurtelephone2 tinyint (1), codepostalcontact INT(5) UNSIGNED NOT NULL, estcontactprincipal tinyint (1), villecontact VARCHAR(80), adressemailcontact VARCHAR(80), faxcontact VARCHAR(80), sitewebcontact VARCHAR(80), telephonecontact1 VARCHAR(80), telephonecontact2 VARCHAR(80), PRIMARY KEY (id), INDEX(name) )engine=InnoDB; CREATE TABLE IF NOT EXISTS roles ( id INT(4) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, name VARCHAR(255), description VARCHAR(255), index(name) ) engine=InnoDB; CREATE TABLE IF NOT EXISTS user_categories_roles ( id_catgory INT(4) UNSIGNED NOT NULL, id_role INT(4) UNSIGNED NOT NULL, FOREIGN KEY (id_catgory) REFERENCES user_categories(id), FOREIGN KEY (id_role) REFERENCES roles(id), UNIQUE(id_catgory, id_role) ) engine=InnoDB; CREATE TABLE IF NOT EXISTS users ( id INT(4) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, first_name VARCHAR(30), last_name VARCHAR(30), login VARCHAR(30), password VARCHAR(30), connected tinyint(1), locked tinyint (1), is_admin tinyint (1), fk_contact INT(4) UNSIGNED NOT NULL, fk_categorieutilisateur INT(4) UNSIGNED NOT NULL, FOREIGN KEY (fk_contact) REFERENCES contact(id), FOREIGN KEY (fk_categorieutilisateur) REFERENCES user_categories(id), INDEX(last_name) ) engine=InnoDB; CREATE TABLE IF NOT EXISTS user_role ( id_user INT(4) UNSIGNED NOT NULL , id_role INT(4) UNSIGNED NOT NULL , FOREIGN KEY (id_user) REFERENCES users(id), FOREIGN KEY (id_role) REFERENCES roles(id), UNIQUE(id_user, id_role) ) engine=InnoDB;
true
36927081e0b2bc5fb4f8d45e06393f1d0b58bd32
SQL
Reynald0/Real
/sql/catalogo_estado_solicitud.sql
UTF-8
963
2.75
3
[]
no_license
/* Navicat SQLite Data Transfer Source Server : REAL Source Server Version : 30714 Source Host : :0 Target Server Type : SQLite Target Server Version : 30714 File Encoding : 65001 Date: 2017-05-17 10:15:09 */ PRAGMA foreign_keys = OFF; -- ---------------------------- -- Table structure for cuentas_estado_solicitud -- ---------------------------- DROP TABLE IF EXISTS "main"."cuentas_estado_solicitud"; CREATE TABLE "cuentas_estado_solicitud" ("id" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "tipo_solicitud" varchar(30) NOT NULL); -- ---------------------------- -- Records of cuentas_estado_solicitud -- ---------------------------- INSERT INTO "main"."cuentas_estado_solicitud" VALUES (1, 'en proceso'); INSERT INTO "main"."cuentas_estado_solicitud" VALUES (2, 'en evaluación'); INSERT INTO "main"."cuentas_estado_solicitud" VALUES (3, 'aprobada'); INSERT INTO "main"."cuentas_estado_solicitud" VALUES (4, 'no aprobada');
true
b7c87bf693888f4c71c867fd6f1279b4d8c05df9
SQL
kkkterry/kkkterry
/mynote/02_DBMS/DBMS_src/05_SUBQUERY.sql
UHC
11,263
4.53125
5
[]
no_license
-- --1. ̺ Ի ̸, ޿, Ի SELECT ENAME, SAL, HIREDATE FROM EMP WHERE HIREDATE=(SELECT MIN(HIREDATE) FROM EMP); -- 2. ȸ翡 ޿ ̸, ޿ SELECT ENAME, SAL FROM EMP WHERE SAL=(SELECT MIN(SAL) FROM EMP); -- 3. ȸ պ ޿ ޴ ̸, ޿, μڵ SELECT ENAME, SAL, DEPTNO FROM EMP WHERE SAL>(SELECT AVG(SAL) FROM EMP); --4. ȸ ޿ ޴ ̸, ޿, μ SELECT ENAME, SAL, DNAME FROM EMP E, DEPT D WHERE E.DEPTNO=D.DEPTNO AND SAL<=(SELECT AVG(SAL) FROM EMP); --5. SCOTT Ի ̸, ޿, Ի, ޿ SELECT ENAME, SAL, HIREDATE, GRADE FROM EMP, SALGRADE WHERE SAL BETWEEN LOSAL AND HISAL AND HIREDATE<(SELECT HIREDATE FROM EMP WHERE ENAME='SCOTT'); --6. 5(SCOTT Ի ̸, ޿, Ի, ޿ ) μ ߰ϰ --޿ ū SELECT ENAME, SAL, HIREDATE, GRADE, DNAME FROM EMP E, SALGRADE, DEPT D WHERE SAL BETWEEN LOSAL AND HISAL AND D.DEPTNO=E.DEPTNO AND HIREDATE<(SELECT HIREDATE FROM EMP WHERE ENAME='SCOTT') ORDER BY SAL DESC; --7. BLAKE ޿ , ̸, ޿ SELECT EMPNO, ENAME, SAL FROM EMP WHERE SAL>(SELECT SAL FROM EMP WHERE ENAME='BLAKE'); --8. MILLER ʰ Ի , ̸, Ի SELECT EMPNO, ENAME, HIREDATE FROM EMP WHERE HIREDATE > (SELECT HIREDATE FROM EMP WHERE ENAME='MILLER'); --9. ü ޿ ޿ , ̸, ޿ SELECT EMPNO, ENAME, SAL FROM EMP WHERE SAL > (SELECT AVG(SAL) FROM EMP); --10. CLARK μȣ̸, 7698 ޿ ޿ ޴ -- , ̸, ޿ SELECT DEPTNO FROM EMP WHERE ENAME='CLARK'; -- (CLARK μȣ) SELECT SAL FROM EMP WHERE EMPNO=7698; -- (7698 ޿) SELECT EMPNO, ENAME, SAL FROM EMP WHERE DEPTNO=(SELECT DEPTNO FROM EMP WHERE ENAME='CLARK') AND SAL > (SELECT SAL FROM EMP WHERE EMPNO=7698); --11. ȭ. CLARK μ̸, 7698 ޿ ޿ -- ޴ , ̸, ޿ SELECT DNAME FROM EMP E, DEPT D WHERE E.DEPTNO=D.DEPTNO AND ENAME='CLARK';-- 1 SELECT SAL FROM EMP WHERE EMPNO=7698; -- 2 SELECT EMPNO, ENAME, SAL FROM EMP E, DEPT D WHERE E.DEPTNO=D.DEPTNO AND DNAME=(SELECT DNAME FROM EMP E, DEPT D WHERE E.DEPTNO=D.DEPTNO AND ENAME='CLARK') AND SAL > (SELECT SAL FROM EMP WHERE EMPNO=7698); --12. BLAKE μ ִ ̸ Ի SELECT ENAME, HIREDATE FROM EMP WHERE DEPTNO=(SELECT DEPTNO FROM EMP WHERE ENAME='BLAKE'); --13. ޿ ̻ ޴ ؼ ȣ ̸ ޿ ) SELECT EMPNO, ENAME FROM EMP WHERE SAL>=(SELECT AVG(SAL) FROM EMP) ORDER BY SAL DESC; -- 3. ; IN, ALL, ANY=SOME, EXISTS --(1) IN ; ϳ ġϸ -- μ Ի ̸, Ի, μȣ SELECT DEPTNO, MAX(HIREDATE) FROM EMP GROUP BY DEPTNO; -- SELECT ENAME, HIREDATE, DEPTNO FROM EMP WHERE (DEPTNO,HIREDATE) IN (SELECT DEPTNO, MAX(HIREDATE) FROM EMP GROUP BY DEPTNO); -- ޿ 3000̻ ޴ Ҽӵ μ ٹϴ ʵ SELECT DEPTNO FROM EMP WHERE SAL>=3000; -- SELECT * FROM EMP WHERE DEPTNO IN (SELECT DEPTNO FROM EMP WHERE SAL>=3000); --(2)ALL ; ϸ SELECT SAL FROM EMP WHERE DEPTNO=30; -- 30 μ ޿ κ ū = 30 μ ִ ޿ ū SELECT * FROM EMP WHERE SAL > ALL (SELECT SAL FROM EMP WHERE DEPTNO=30); -- SELECT * FROM EMP WHERE SAL > (SELECT MAX(SAL) FROM EMP WHERE DEPTNO=30); -- --(3)ANY=SOME ; ϳ ϸ -- 30 μ ޿ ϳ̶ ū = 30 μ ּ ޿ ū SELECT * FROM EMP WHERE SAL > ANY (SELECT SAL FROM EMP WHERE DEPTNO=30); -- SELECT * FROM EMP WHERE SAL > (SELECT MIN(SAL) FROM EMP WHERE DETPTNO=30); -- --(4)EXISTS ; ϸ -- Ӻϰ ִ , ̸, ޿ SELECT EMPNO, ENAME, SAL FROM EMP MANAGER WHERE EXISTS (SELECT * FROM EMP WHERE MANAGER.EMPNO=MGR); -- SELECT DISTINCT M.EMPNO, M.ENAME, M.SAL FROM EMP W, EMP M WHERE W.MGR=M.EMPNO; -- SELF JOIN -- ܻ ʵ SELECT * FROM EMP MANAGER WHERE NOT EXISTS (SELECT * FROM EMP WHERE MANAGER.EMPNO=MGR); -- SELECT M.* FROM EMP W, EMP M WHERE W.MGR(+)=M.EMPNO AND W.ENAME IS NULL; -- SELF JOIN -- ex1. (job) MANAGER μ μȣ SELECT DEPTNO FROM EMP WHERE JOB='MANAGER'; -- SELECT DEPTNO, LOC FROM DEPT WHERE DEPTNO IN (SELECT DEPTNO FROM EMP WHERE JOB='MANAGER'); -- -- ex2. 3000̻ ޺ ְ ޴ -- , ̸, , Ի, ޿, ޿(4,5 ְSAL ) SELECT GRADE, MAX(SAL) FROM EMP, SALGRADE WHERE SAL BETWEEN LOSAL AND HISAL AND SAL >= 3000 GROUP BY GRADE; -- SELECT EMPNO, ENAME, JOB, HIREDATE, SAL, GRADE FROM EMP, SALGRADE WHERE SAL BETWEEN LOSAL AND HISAL AND (GRADE, SAL) IN (SELECT GRADE, MAX(SAL) FROM EMP, SALGRADE WHERE SAL BETWEEN LOSAL AND HISAL AND SAL >= 3000 GROUP BY GRADE); -- -- ex3. Իб⺰ ְ ޴ -- б, , ̸, job, , Ի, ޿, SELECT HIREDATE, CEIL(TO_CHAR(HIREDATE, 'MM')/3) "б" FROM EMP; -- б ϴ SELECT CEIL(EXTRACT(MONTH FROM HIREDATE)/3) "QUARTER", MAX(SAL) FROM EMP GROUP BY CEIL(EXTRACT(MONTH FROM HIREDATE)/3); -- SELECT CEIL(EXTRACT(MONTH FROM HIREDATE)/3) "QUARTER", EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, COMM FROM EMP WHERE (CEIL(EXTRACT(MONTH FROM HIREDATE)/3), SAL) IN (SELECT CEIL(EXTRACT(MONTH FROM HIREDATE)/3), MAX(SAL) FROM EMP GROUP BY CEIL(EXTRACT(MONTH FROM HIREDATE)/3)) ORDER BY QUARTER; -- ex4. SALESMAN 麸 ޿ ޴ ̸, ޿(ALL) SELECT ENAME, SAL FROM EMP WHERE SAL > ALL (SELECT SAL FROM EMP WHERE JOB='SALESMAN'); SELECT ENAME, SAL FROM EMP WHERE SAL > (SELECT MAX(SAL) FROM EMP WHERE JOB='SALESMAN'); -- ex5. ޿ 3000̸ ֱ Ի , ̸, , Ի SELECT MAX(HIREDATE) FROM EMP WHERE SAL<3000; -- SELECT EMPNO, ENAME, SAL*12+NVL(COMM,0) ANNUAL_SAL, HIREDATE FROM EMP WHERE HIREDATE = (SELECT MAX(HIREDATE) FROM EMP WHERE SAL<3000); -- -- -- 14. ̸ T ִ ٹϴ μ ٹϴ ȣ,̸,޿( ) SELECT EMPNO, ENAME, SAL FROM emp WHERE DEPTNO IN (SELECT DEPTNO FROM EMP WHERE ENAME LIKE '%T%') ORDER BY EMPNO; -- 15. μ ġ Dallas ̸,,޿ SELECT ENAME, JOB, SAL FROM EMP WHERE DEPTNO = (SELECT DEPTNO FROM DEPT WHERE INITCAP(LOC)='Dallas'); SELECT ENAME, JOB, SAL FROM EMP E, DEPT D WHERE E.DEPTNO=D.DEPTNO AND INITCAP(LOC)='Dallas'; -- 16. EMP ̺ King ϴ ̸ ޿ SELECT ENAME, SAL FROM EMP WHERE MGR=(SELECT EMPNO FROM EMP WHERE INITCAP(ENAME)='King'); SELECT ENAME, SAL FROM EMP W WHERE EXISTS (SELECT * FROM EMP WHERE EMPNO=W.MGR AND INITCAP(ENAME)='King'); -- 17. SALESμ ̸, SELECT ENAME, JOB FROM EMP WHERE DEPTNO = (SELECT DEPTNO FROM DEPT WHERE DNAME='SALES'); -- ̿ SELECT ENAME, JOB FROM EMP E, DEPT D WHERE E.DEPTNO=D.DEPTNO AND DNAME='SALES'; -- EQUI JOIN ̿ -- 18. μ 30 ޺ ʵ SELECT * FROM EMP WHERE SAL>(SELECT MIN(SAL) FROM EMP WHERE DEPTNO=30); -- ༭ SELECT * FROM EMP WHERE SAL > ANY (SELECT sal FROM EMP WHERE DEPTNO=30); -- ༭ -- 19. μ 10 μ 30 ð ִ ̸ SELECT ENAME, JOB FROM EMP WHERE DEPTNO=10 AND JOB IN (SELECT JOB FROM EMP WHERE DEPTNO=30); -- 20. FORD ޵ ʵ SELECT * FROM EMP WHERE (JOB, SAL) = (SELECT JOB, SAL FROM EMP WHERE ENAME='FORD') AND ENAME != 'FORD'; -- 21. ̸ JONES JOB ų FORD SAL ̻ ޴ --̸, , μȣ, ޿ -- , ĺ , SELECT JOB FROM EMP WHERE ENAME='JONES';-- SELECT SAL FROM EMP WHERE ENAME='FORD'; -- SELECT ENAME, JOB, DEPTNO, SAL FROM EMP WHERE JOB = (SELECT JOB FROM EMP WHERE ENAME='JONES') OR SAL>=(SELECT SAL FROM EMP WHERE ENAME='FORD') ORDER BY JOB, SAL DESC; -- 22. SCOTT Ǵ WARD ̸,,޿ SELECT ENAME, JOB, SAL FROM EMP WHERE SAL IN (SELECT SAL FROM EMP WHERE ENAME='SCOTT' OR ENAME='WARD') AND ENAME NOT IN ('SCOTT', 'WARD'); SELECT ENAME, JOB, SAL FROM EMP WHERE SAL IN (SELECT SAL FROM EMP WHERE ENAME IN ('SCOTT','WARD')) AND ENAME NOT IN ('SCOTT','WARD'); -- 23. CHICAGO ٹϴ ϴ ̸, SELECT ENAME, JOB FROM EMP WHERE JOB IN (SELECT JOB FROM EMP E, DEPT D WHERE E.DEPTNO=D.DEPTNO AND LOC='CHICAGO'); -- 24. μ ޺ , ̸, ޿ SELECT EMPNO, ENAME, SAL FROM EMP E WHERE SAL > (SELECT AVG(SAL) FROM EMP WHERE DEPTNO=E.DEPTNO); -- μȣ μ ߰ SELECT EMPNO, ENAME, SAL, DEPTNO, (SELECT AVG(SAL) FROM EMP WHERE DEPTNO=E.DEPTNO) FROM EMP E WHERE SAL > (SELECT AVG(SAL) FROM EMP WHERE DEPTNO=E.DEPTNO); -- 25. ޺ ޴ μȣ, ̸, ޿ -- 26.  ̻κ ִ , ̸, , μȣ (, μȣ ) -- 27. , ̸, , μȣ
true
c3f36cca34e86e05c5aeea1707d255d5ff0976d5
SQL
ashroberts121/majorprojectapp
/majorprojectapp.sql
UTF-8
14,782
3.421875
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 4.8.0.1 -- https://www.phpmyadmin.net/ -- -- Host: localhost:3306 -- Generation Time: Aug 02, 2019 at 08:40 AM -- Server version: 5.7.22 -- PHP Version: 7.1.17 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: `majorprojectapp` -- -- -------------------------------------------------------- -- -- Table structure for table `challenges` -- CREATE TABLE `challenges` ( `id` int(11) NOT NULL, `author_id` int(11) NOT NULL, `name` varchar(255) NOT NULL, `cover_image` varchar(255) NOT NULL, `description` varchar(1024) NOT NULL, `members` int(11) NOT NULL, `distance` decimal(7,2) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `challenges` -- INSERT INTO `challenges` (`id`, `author_id`, `name`, `cover_image`, `description`, `members`, `distance`) VALUES (1, 4, 'Three Peaks Challenge', 'mountain.jpeg', 'This challenge involves climbing three of the largest mountains in the UK in a 24hour period.\r\n These are Ben Nevis (Scotland), Scafell Pike (England) & Snowdon (Wales).', 3, '37.01'), (6, 4, 'Inca Trail - Machu Picchu', 'machupicchu.jpeg', 'The Inca Trail to Machu Picchu is a hiking trail in Peru that terminates at Machu Picchu. It consists of three overlapping trails: Mollepata, Classic, and One Day.', 1, '88.51'); -- -------------------------------------------------------- -- -- Table structure for table `challenge_leaderboard` -- CREATE TABLE `challenge_leaderboard` ( `id` int(11) NOT NULL, `challenge_id` int(11) NOT NULL, `user_id` int(11) NOT NULL, `user_email` varchar(255) NOT NULL, `username` varchar(255) NOT NULL, `challenge_time` time(6) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `challenge_leaderboard` -- INSERT INTO `challenge_leaderboard` (`id`, `challenge_id`, `user_id`, `user_email`, `username`, `challenge_time`) VALUES (15, 1, 7, 'steve@davies.com', 'SDavies', '36:45:32.000000'), (21, 1, 4, 'ash.roberts121@gmail.com', 'ARoberts123', '01:01:01.000000'), (23, 6, 4, 'ash.roberts121@gmail.com', 'ARoberts123', '01:01:01.000000'), (24, 1, 13, 'jamieheath1996@icloud.com', 'Jamie Beef bro', '42:11:45.000000'); -- -------------------------------------------------------- -- -- Table structure for table `challenge_members` -- CREATE TABLE `challenge_members` ( `id` int(11) NOT NULL, `challenge_id` int(11) NOT NULL, `user_id` int(11) NOT NULL, `user_email` varchar(255) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `challenge_members` -- INSERT INTO `challenge_members` (`id`, `challenge_id`, `user_id`, `user_email`) VALUES (12, 1, 7, 'steve@davies.com'), (18, 1, 4, 'ash.roberts121@gmail.com'), (20, 6, 4, 'ash.roberts121@gmail.com'), (21, 1, 13, 'jamieheath1996@icloud.com'); -- -------------------------------------------------------- -- -- Table structure for table `challenge_posts` -- CREATE TABLE `challenge_posts` ( `id` int(11) NOT NULL, `challenge_id` int(11) NOT NULL, `author_id` int(11) NOT NULL, `title` varchar(255) NOT NULL, `message` varchar(1024) NOT NULL, `post_image` varchar(255) NOT NULL, `username` varchar(255) NOT NULL, `post_time` varchar(255) NOT NULL, `display_picture` varchar(255) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `challenge_posts` -- INSERT INTO `challenge_posts` (`id`, `challenge_id`, `author_id`, `title`, `message`, `post_image`, `username`, `post_time`, `display_picture`) VALUES (1, 1, 4, 'New personal best!', 'Can\'t believe we beat our record!', 'threepeaks.jpeg', 'ARoberts123', '15/07/2019 @ 14:15', 'ashpic.jpeg'), (5, 6, 4, 'Amazing time!', 'Great trail to do and in record time!!', 'hike_girl.jpeg', 'ARoberts123', '17/07/19 @ 01:18', 'ashpic.jpeg'); -- -------------------------------------------------------- -- -- Table structure for table `groups` -- CREATE TABLE `groups` ( `id` int(11) NOT NULL, `author_id` int(11) NOT NULL, `name` varchar(255) NOT NULL, `cover_image` varchar(255) NOT NULL, `description` varchar(1024) NOT NULL, `members` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `groups` -- INSERT INTO `groups` (`id`, `author_id`, `name`, `cover_image`, `description`, `members`) VALUES (1, 4, 'Running', 'runner_woman.jpeg', 'Post Content here. Lorem ipsum dolor sit amet consectetur adipisicing elit. Quo recusandae nulla rem eos ipsa praesentium esse magnam nemo dolor sequi fuga quia quaerat cum, obcaecati hic.', 3), (2, 4, 'Yoga', 'yoga_woman.jpeg', 'A group for all yoga lovers!', 1); -- -------------------------------------------------------- -- -- Table structure for table `group_members` -- CREATE TABLE `group_members` ( `id` int(11) NOT NULL, `group_id` int(11) NOT NULL, `user_id` int(11) NOT NULL, `user_email` varchar(255) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `group_members` -- INSERT INTO `group_members` (`id`, `group_id`, `user_id`, `user_email`) VALUES (29, 1, 7, 'steve@davies.com'), (32, 2, 4, 'ash.roberts121@gmail.com'), (37, 1, 10, 'john@smith.com'), (44, 1, 4, 'ash.roberts121@gmail.com'); -- -------------------------------------------------------- -- -- Table structure for table `group_posts` -- CREATE TABLE `group_posts` ( `id` int(11) NOT NULL, `group_id` int(11) NOT NULL, `author_id` int(11) NOT NULL, `title` varchar(255) NOT NULL, `message` varchar(1024) NOT NULL, `post_image` varchar(255) NOT NULL, `username` varchar(255) NOT NULL, `post_time` varchar(255) NOT NULL, `display_picture` varchar(255) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `group_posts` -- INSERT INTO `group_posts` (`id`, `group_id`, `author_id`, `title`, `message`, `post_image`, `username`, `post_time`, `display_picture`) VALUES (1, 1, 4, 'Ran 5 miles today!', 'Post Content here. Lorem ipsum dolor sit amet consectetur adipisicing elit. Quo recusandae nulla rem eos ipsa praesentium esse magnam nemo dolor sequi fuga quia quaerat cum, obcaecati hic.', 'running.jpeg', 'ARoberts121', '10/07/19 @ 13:04', 'ashpic.jpeg'), (2, 1, 7, 'Loving the group', 'Post Content here. Lorem ipsum dolor sit amet consectetur adipisicing elit. Quo recusandae nulla rem eos ipsa praesentium esse magnam nemo dolor sequi fuga quia quaerat cum, obcaecati hic.', 'man_runner.jpeg', 'SDavies', '10/07/19 @ 13:28', 'steve.jpeg'); -- -------------------------------------------------------- -- -- Table structure for table `posts` -- CREATE TABLE `posts` ( `id` int(11) NOT NULL, `title` varchar(255) NOT NULL, `message` varchar(1024) NOT NULL, `tags` varchar(255) NOT NULL, `image` varchar(255) NOT NULL, `email` varchar(255) NOT NULL, `username` varchar(255) NOT NULL, `display_picture` varchar(255) NOT NULL, `post_time` varchar(255) NOT NULL, `likes` int(11) NOT NULL, `comments` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `posts` -- INSERT INTO `posts` (`id`, `title`, `message`, `tags`, `image`, `email`, `username`, `display_picture`, `post_time`, `likes`, `comments`) VALUES (14, 'Leg Day Done!', 'Post Content here. Lorem ipsum dolor sit amet consectetur adipisicing elit. Quo recusandae nulla rem eos ipsa praesentium esse magnam nemo dolor sequi fuga quia quaerat cum, obcaecati hic.', 'Health, Gains, Lifting, LegDay', 'gym.jpeg', 'steve@davies.com', 'SDavies', 'steve.jpeg', '03/07/19 @ 12:40', 0, 2), (19, 'Summer 2019', 'Post Content here. Lorem ipsum dolor sit amet consectetur adipisicing elit. Quo recusandae nulla rem eos ipsa praesentium esse magnam nemo dolor sequi fuga quia quaerat cum, obcaecati hic.', 'Summer,Fitness,Gains,2019,Healthy', 'summer.jpeg', 'ash.roberts121@gmail.com', 'ARoberts123', 'ashpic.jpeg', '05/07/19 @ 05:38', 0, 2); -- -------------------------------------------------------- -- -- Table structure for table `post_comments` -- CREATE TABLE `post_comments` ( `id` int(11) NOT NULL, `post_id` int(11) NOT NULL, `user_id` int(11) NOT NULL, `username` varchar(255) NOT NULL, `comment_time` varchar(255) NOT NULL, `comment` varchar(1024) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `post_comments` -- INSERT INTO `post_comments` (`id`, `post_id`, `user_id`, `username`, `comment_time`, `comment`) VALUES (11, 21, 4, 'ARoberts123', '09/07/19 @ 15:16', 'Brilliant!! :)'), (13, 21, 7, 'SDavies', '09/07/19 @ 15:17', 'Well done!'), (15, 21, 7, 'SDavies', '09/07/19 @ 16:25', 'Fantastic!'), (21, 19, 7, 'SDavies', '09/07/19 @ 16:55', 'So excited!!'), (22, 21, 4, 'ARoberts123', '10/07/19 @ 15:26', 'Good going!'), (23, 0, 0, '', '', 'No comments yet :('), (24, 14, 13, 'Jamie Beef bro', '22/07/19 @ 15:12', 'well done'), (25, 14, 4, 'ARoberts123', '23/07/19 @ 13:42', 'Nice one!'); -- -------------------------------------------------------- -- -- Table structure for table `post_likes` -- CREATE TABLE `post_likes` ( `id` int(11) NOT NULL, `post_id` int(11) NOT NULL, `user_id` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `post_likes` -- INSERT INTO `post_likes` (`id`, `post_id`, `user_id`) VALUES (10, 14, 7), (11, 15, 7), (12, 14, 4), (13, 16, 4), (14, 15, 4), (15, 19, 4), (16, 14, 8), (17, 19, 8), (18, 19, 13); -- -------------------------------------------------------- -- -- Table structure for table `profile` -- CREATE TABLE `profile` ( `id` int(255) NOT NULL, `email` varchar(255) NOT NULL, `firstname` varchar(255) NOT NULL, `surname` varchar(255) NOT NULL, `username` varchar(255) NOT NULL, `gender` varchar(255) NOT NULL, `location` varchar(255) NOT NULL, `job_title` varchar(255) NOT NULL, `display_picture` varchar(1024) NOT NULL, `background_picture` varchar(1024) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `profile` -- INSERT INTO `profile` (`id`, `email`, `firstname`, `surname`, `username`, `gender`, `location`, `job_title`, `display_picture`, `background_picture`) VALUES (1, 'ash.roberts121@gmail.com', 'Ashley', 'Roberts', 'ARoberts123', 'Male', 'Tamworth, UK', 'Student', 'ashpic.jpeg', 'ashbg.jpeg'), (5, 'steve@davies.com', 'Steve', 'Davies', 'SDavies', 'Male', 'London, UK', 'Teacher', 'steve.jpeg', 'ashbg.jpeg'), (10, 'john@smith.com', 'John', 'Smith', 'JSmith', '(Gender)', '(Location)', '(Job Title)', 'defaultdp.jpg', 'defaultbgp.jpeg'), (11, 'jamieheath1996@icloud.com', 'Jamie', 'Heath', 'Jamie Beef bro', 'Male', 'Tamworth, UK', 'Teacher', '23416841_1581779185248785_302645420268453888_n.jpg', '674d72be2435498906f2bba0335be4ca.png'); -- -------------------------------------------------------- -- -- Table structure for table `users` -- CREATE TABLE `users` ( `id` int(255) NOT NULL, `firstname` varchar(255) NOT NULL, `surname` varchar(255) NOT NULL, `username` varchar(14) NOT NULL, `email` varchar(255) NOT NULL, `password` text NOT NULL, `token` varchar(255) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `users` -- INSERT INTO `users` (`id`, `firstname`, `surname`, `username`, `email`, `password`, `token`) VALUES (4, 'Ashley', 'Roberts', 'ARoberts123', 'ash.roberts121@gmail.com', '$2y$10$Y743DdF9gxWDLmDUzlzgdejtxHJyzKhWkvT9itQpXsyYrfEOeT5DO', 'xcad9w3k4h'), (7, 'Steve', 'Davies', 'SDavies', 'steve@davies.com', '$2y$10$ZLRujkwThj/SG/0ktVjf.O9.2EmLqggCs2vRcpXsYGpGV/In8NkZm', ''), (12, 'John', 'Smith', 'JSmith', 'john@smith.com', '$2y$10$Tm5pFIVaKlPlo3E5VqkvZu4mLsbVVJzHWev/Zmd3WViZAet2TZvUq', ''), (13, 'Jamie', 'Heath', 'Jamie Beef bro', 'jamieheath1996@icloud.com', '$2y$10$dVff7pTCeEADXMKd9MmtCOJ5wE.lCvMPRi9sUTf2BxkPfwZa5FNP.', 'lyzap7d052'); -- -- Indexes for dumped tables -- -- -- Indexes for table `challenges` -- ALTER TABLE `challenges` ADD PRIMARY KEY (`id`); -- -- Indexes for table `challenge_leaderboard` -- ALTER TABLE `challenge_leaderboard` ADD PRIMARY KEY (`id`); -- -- Indexes for table `challenge_members` -- ALTER TABLE `challenge_members` ADD PRIMARY KEY (`id`); -- -- Indexes for table `challenge_posts` -- ALTER TABLE `challenge_posts` ADD PRIMARY KEY (`id`); -- -- Indexes for table `groups` -- ALTER TABLE `groups` ADD PRIMARY KEY (`id`); -- -- Indexes for table `group_members` -- ALTER TABLE `group_members` ADD PRIMARY KEY (`id`); -- -- Indexes for table `group_posts` -- ALTER TABLE `group_posts` ADD PRIMARY KEY (`id`); -- -- Indexes for table `posts` -- ALTER TABLE `posts` ADD PRIMARY KEY (`id`); -- -- Indexes for table `post_comments` -- ALTER TABLE `post_comments` ADD PRIMARY KEY (`id`); -- -- Indexes for table `post_likes` -- ALTER TABLE `post_likes` ADD PRIMARY KEY (`id`); -- -- Indexes for table `profile` -- ALTER TABLE `profile` ADD PRIMARY KEY (`id`); -- -- Indexes for table `users` -- ALTER TABLE `users` ADD PRIMARY KEY (`id`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `challenges` -- ALTER TABLE `challenges` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8; -- -- AUTO_INCREMENT for table `challenge_leaderboard` -- ALTER TABLE `challenge_leaderboard` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=27; -- -- AUTO_INCREMENT for table `challenge_members` -- ALTER TABLE `challenge_members` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=24; -- -- AUTO_INCREMENT for table `challenge_posts` -- ALTER TABLE `challenge_posts` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8; -- -- AUTO_INCREMENT for table `groups` -- ALTER TABLE `groups` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; -- -- AUTO_INCREMENT for table `group_members` -- ALTER TABLE `group_members` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=47; -- -- AUTO_INCREMENT for table `group_posts` -- ALTER TABLE `group_posts` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; -- -- AUTO_INCREMENT for table `posts` -- ALTER TABLE `posts` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=21; -- -- AUTO_INCREMENT for table `post_comments` -- ALTER TABLE `post_comments` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=26; -- -- AUTO_INCREMENT for table `post_likes` -- ALTER TABLE `post_likes` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=19; -- -- AUTO_INCREMENT for table `profile` -- ALTER TABLE `profile` MODIFY `id` int(255) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12; -- -- AUTO_INCREMENT for table `users` -- ALTER TABLE `users` MODIFY `id` int(255) 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
ef54c7ddd94e9356899beb636bf4f797c93f65bb
SQL
atymkiv/DB
/lab5/selects.sql
UTF-8
1,747
3.828125
4
[]
no_license
CREATE TABLE real_estate.user1 AS SELECT userID, login, created FROM user WHERE created < '2019-03-15'; CREATE TABLE real_estate.user2 AS SELECT userID, login, created FROM user WHERE created < '2019-05-03'; #Union SELECT * FROM user1 UNION SELECT * FROM user2; #Перетин user1 i user2 SELECT * FROM user1 WHERE userID IN (SELECT userID FROM user2); #Різниця user 2 i user1 SELECT * FROM user2 WHERE userID NOT IN (SELECT userID FROM user1); #Декартовий добуток SELECT * FROM user1, user2; select userID from real_estate.user_role where roleID = 3; select userID, real_estate.estate.estateID, type from real_estate.user_operation, real_estate.estate where real_estate.estate.estateID = real_estate.user_operation.estateID in ( select estateID from real_estate.user_operation where userID in(select userID from real_estate.user_role where roleID = 3)); select * from real_estate.user_operation where real_estate.user_operation.estateID in ( select estateID from real_estate.user_operation where userID in(select userID from real_estate.user_role where roleID = 3)); select real_estate.estate.estateID, type, owner_id from real_estate.estate where real_estate.estate.estateID in ( select estateID from real_estate.user_operation where userID in(select userID from real_estate.user_role where roleID = 3)); select type from real_estate.estate, real_estate.user_operation, real_estate.user, real_estate.user_role where real_estate.estate.estateID = real_estate.user_operation.estateID and real_estate.user_operation.userID=real_estate.user.userID and real_estate.user.userID=real_estate.user_role.userID and real_estate.user_role.roleID in(select roleID from real_estate.role where role_name = 'User');
true
ba5f9b4c9b33ba5c7aa84b55cbc38f35566b72a6
SQL
herbion/immunology
/db/evolutions/13.sql
UTF-8
496
2.625
3
[]
no_license
# --- !Ups --Added one more analysis norm -- -- Data for analysis_norm table -- INSERT INTO analysis_norm(analysis_norm_id, description, update_date, analysis_analysis_id, value) VALUES (26, 'Норма', '2012-10-23 00:00:00', 7, 0); -- -- Data for sequence analysis_sequence -- SELECT setval('analysis_norm_sequence', 26, true); # --- !Downs --Drop alergic syndrome data from tables analysis, analysis_norm DELETE FROM analysis_norm WHERE analysis_norm_id = 26;
true
00f3ce652a5f1215b12a1a383573e28534aeb308
SQL
vectormars/Hackerrank
/SQL/Advanced Select/New Companies.sql
UTF-8
325
3.703125
4
[]
no_license
SELECT c.Company_Code, c.founder, count(Distinct e.Lead_Manager_Code), count(distinct e.Senior_Manager_Code), count(distinct e.Manager_Code), count(distinct e.employee_Code) FROM Company c JOIN Employee e ON c.Company_Code = e.Company_Code GROUP BY c.Company_Code, c.Founder ORDER BY c.Company_Code;
true
b7742d332c80bc5b6d7bc47fc90cd726f06643ff
SQL
broesler/endgame-research
/data/last_funding_round.sql
UTF-8
330
3.890625
4
[]
no_license
SELECT o.id, o.name, o.last_funding_at, f.funding_round_code, f.funded_at, f.raised_amount_usd FROM cb_objects AS o JOIN cb_funding_rounds AS f ON o.id = f.object_id -- WHERE f.raised_amount_usd IS NOT NULL WHERE o.founded_at IS NOT NULL AND o.last_funding_at = f.funded_at LIMIT 60
true
869412bd9c4d295b2b91e0e95c90862873fde3f6
SQL
jaw0/talmud
/sql/ipdb-dm.sql
UTF-8
2,309
3.65625
4
[]
no_license
-- Copyright (c) 2003 by Jeff Weisberg -- Author: Jeff Weisberg <jaw @ tcp4me.com> -- Date: 2003-Oct-15 15:08 (EDT) -- Function: ip address block allocation tracking -- -- $Id: ipdb-dm.sql,v 1.8 2010/01/16 05:35:16 jaw Exp $ create table mi_ipdb_config ( param varchar(32) primary key, descr varchar(128), value varchar(1024) ); create table mi_ipdb_swip ( swip_id varchar primary key, label varchar(32), index integer, unique(label, index) ); create table mi_ipdb_pool ( name varchar(32) primary key ); create table mi_ipdb_registry ( registry_id isa_object, name varchar(32) unique, email varchar(32), -- email addr for swip requests handle varchar(32), -- handle to use on swip requests maintainer varchar(32) -- maintainer to use on sqip requests ); -- blocks allocated to us create table mi_ipdb_meta ( meta_id isa_object, netblock varchar(64) not null, size integer not null, netname varchar(32) not null unique, registry_id refs(mi_ipdb_registry) on delete set null, swipprefix varchar(8), unique( netblock, size ) ); create index mi_ipdb_meta_block_idx on mi_ipdb_meta(netblock); create index mi_ipdb_meta_name_idx on mi_ipdb_meta(netname); create index mi_ipdb_meta_regy_idx on mi_ipdb_meta(registry_id); create table mi_ipdb_block ( block_id isa_object, meta_id refs(mi_ipdb_meta) on delete cascade, netblock varchar(64) not null, size integer not null, sort_low numeric, sort_high numeric, status varchar(16) not null check (status in ('available', 'allocated', 'reserved')), usage varchar(16) check (usage in ('internal', 'customer', 'employee')), descr varchar(200), pool varchar(32) references mi_ipdb_pool on delete set null on update cascade, swip_id varchar(64) unique, justified_p bool not null default false, -- cust_id bigint references g_object on delete set null on update cascade, -- cust data... unique( netblock, size ) ); create index mi_ipdb_block_sortlow_idx on mi_ipdb_block(sort_low); create index mi_ipdb_block_meta_idx on mi_ipdb_block(meta_id);
true
485b47e09f9a84529e572193d784d098a4d02203
SQL
eanieto/SeguridadMining
/modelo_dimensional.sql
UTF-8
1,451
3.3125
3
[]
no_license
create table bodega.DIM_DIVIPOLA_T1 ( SK_DIVIPOLA serial not null constraint dim_divipola_t1_pk primary key, VAR_NOMBRE_PAIS varchar(50) not null, VAR_NOMBRE_DEPARTAMENTO varchar(50), VAR_NOMBRE_MUNICIPIO varchar(50) ); create table bodega.DIM_TIEMPO_T1 ( SK_TIEMPO integer not null constraint dim_tiempo_pk primary key, NUM_ANIO numeric(4) not null, NUM_MES numeric(2) not null, VAR_NOMBRE_MES varchar(20) not null ); create table bodega.DIM_METRICAS_T2 ( SK_METRICA serial not null constraint dim_metricas_t2_pk primary key, SK_ETIQUETA integer, VAR_NOMBRE_METRICA varchar(50) not null, FEC_INICIO DATE, FEC_FIN DATE, VAR_VERSION numeric(2), VAR_VERSION_ACTUAL bool not null ); --drop table bodega.DIM_METRICAS_T2 create table bodega.DIM_ETIQUETAS_T1 ( SK_ETIQUETA serial not null, VAR_NOMBRE_ETIQUETA VARCHAR(50) not null, VAR_NOMBRE_DETALLE varchar(50) ); INSERT INTO bodega.dim_etiquetas_t1(var_nombre_etiqueta, var_nombre_detalle) VALUES ('Indeterminado','Indeterminado'); create table bodega.DIM_FUENTE_T1 ( SK_FUENTE serial not null, VAR_NOMBRE_FUENTE VARCHAR(50) not null ); create table bodega.FACT_ANALISIS_METRICAS ( SK_TIEMPO int not null, SK_DIVIPOLA int not null, SK_METRICA int not null, SK_FUENTE integer, NUM_VALOR_METRICA NUMERIC(10,2) not null, NUM_FACTOR_INCIDENCIA NUMERIC(10,2), constraint fact_analisis_metricas_pk primary key (SK_TIEMPO, SK_DIVIPOLA, SK_METRICA,SK_FUENTE) );
true
a37e18c73a4ac1e343328ffdce06f14d2b779eb6
SQL
gayendeye/Application-Web-gestion-projet
/gestiondeprojet_collaborateur.sql
UTF-8
2,622
3
3
[]
no_license
-- MySQL dump 10.13 Distrib 5.7.17, for Win64 (x86_64) -- -- Host: localhost Database: gestiondeprojet -- ------------------------------------------------------ -- Server version 5.7.14 /*!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 `collaborateur` -- DROP TABLE IF EXISTS `collaborateur`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `collaborateur` ( `id_Collaborateur` int(11) NOT NULL AUTO_INCREMENT, `NomPrenom` varchar(45) DEFAULT NULL, `Email` varchar(45) DEFAULT NULL, `MotDePasse` varchar(45) DEFAULT NULL, `Disponibilite` varchar(45) DEFAULT NULL, `Telephone` varchar(45) DEFAULT NULL, `DateNaissance` varchar(45) DEFAULT NULL, `Diplome` varchar(100) DEFAULT NULL, `AnneeObtention` varchar(45) DEFAULT NULL, `Etablissement` varchar(100) DEFAULT NULL, `Competences` varchar(100) DEFAULT NULL, `Adresse` varchar(100) DEFAULT NULL, `Fonction` varchar(45) DEFAULT NULL, PRIMARY KEY (`id_Collaborateur`) ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `collaborateur` -- LOCK TABLES `collaborateur` WRITE; /*!40000 ALTER TABLE `collaborateur` DISABLE KEYS */; INSERT INTO `collaborateur` VALUES (1,'Kassoumi Mehdi','mehdi@gmail.fr','motdepass','Occupee','0645893654','09-11-1993','Technicien','2011','ENSA Casablanca','Assiduite, Organisation, ','Residence Chifa Bloc A Rue Mokawama Fes','Collaborateur'); /*!40000 ALTER TABLE `collaborateur` ENABLE KEYS */; UNLOCK TABLES; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; -- Dump completed on 2019-01-25 11:22:59
true
99acbdd5cfa411c87560988131ba587f4209382d
SQL
balena/sqlp
/tests/v6_pc_isql/xts736.sql
UTF-8
2,357
3.390625
3
[ "BSD-3-Clause" ]
permissive
-- MODULE XTS736 -- SQL Test Suite, V6.0, Interactive SQL, xts736.sql -- 59-byte ID -- TEd Version # -- AUTHORIZATION CTS1 SELECT USER FROM HU.ECCO; -- RERUN if USER value does not match preceding AUTHORIZATION comment ROLLBACK WORK; -- date_time print -- TEST:7036 Update NCHAR Varying column with value from NCHAR domain! CREATE DOMAIN DOM1 AS NATIONAL CHARACTER VARYING(10) DEFAULT _VANGELIS 'KILLER'; -- PASS:7036 If domain created successfully? COMMIT WORK; CREATE DOMAIN DOM2 AS NATIONAL CHAR VARYING(12) DEFAULT _VANGELIS 'HELLAS'; -- PASS:7036 If domain created successfully? COMMIT WORK; CREATE DOMAIN DOM3 AS NCHAR VARYING(16) CHECK (VALUE IN (_VANGELIS 'NEW YORK', _VANGELIS 'ATHENS', _VANGELIS 'ZANTE')); -- PASS:7036 If domain created successfully? COMMIT WORK; CREATE TABLE TAB736 (COLK DECIMAL(4) PRIMARY KEY, COL1 DOM1, COL2 DOM2, COL3 DOM3); -- PASS:7036 If table created successfully? COMMIT WORK; INSERT INTO TAB736 VALUES(1,DEFAULT,DEFAULT,N'ATHENS'); -- PASS:7036 If 1 row inserted successfully? INSERT INTO TAB736 VALUES(2,DEFAULT,DEFAULT,N'ZANTE'); -- PASS:7036 If 1 row inserted successfully? COMMIT WORK; UPDATE TAB736 SET COL1 = DEFAULT, COL2 = DEFAULT, COL3 = N'NEW YORK' WHERE COLK = 2; -- PASS:7036 If 1 row updated successfully? SELECT COLK,COL1,COL2,COL3 FROM TAB736 ORDER BY COLK DESC; -- PASS:7036 If 2 rows selected in the following order? -- colk col1 col2 col3 -- ==== ==== ==== ==== -- PASS:7036 If 2 KILLER HELLAS NEW YORK? -- PASS:7036 If 1 KILLER HELLAS ATHENS ? ROLLBACK WORK; DROP TABLE TAB736 CASCADE; -- PASS:7036 If table dropped successfully? COMMIT WORK; DROP DOMAIN DOM1 CASCADE; -- PASS:7036 If domain dropped successfully? COMMIT WORK; DROP DOMAIN DOM2 CASCADE; -- PASS:7036 If domain dropped successfully? COMMIT WORK; DROP DOMAIN DOM3 CASCADE; -- PASS:7036 If domain dropped successfully? COMMIT WORK; -- END TEST >>> 7036 <<< END TEST -- ********************************************* -- *************************************************////END-OF-MODULE
true
671d1c243ec03940a9f111bf06b248036f967d03
SQL
matheuslbarros/projeto-java-turma-2014
/Script.sql
UTF-8
4,522
3.5
4
[]
no_license
--<ScriptOptions statementTerminator=";"/> CREATE TABLE ITEM_RESOURCE ( ITEM_RESOURCE_ID INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1), RESOURCE_NAME VARCHAR(100) NOT NULL, ITEM_ID INTEGER NOT NULL, EXTENSION VARCHAR(10) NOT NULL, CONTENT_TYPE VARCHAR(30) NOT NULL, RES_PATH VARCHAR(200) NOT NULL ); CREATE TABLE LOCATION ( LOCATION_ID INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1), NAME VARCHAR(50) NOT NULL, USER_ID INTEGER NOT NULL, COUNTRY_ID INTEGER, ADDRESS VARCHAR(150), ZIPCODE VARCHAR(15), REGION_ID INTEGER, CITY_ID INTEGER, CITY_AREA_ID INTEGER ); CREATE TABLE CITY ( CITY_ID INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1), CITY_NAME VARCHAR(100) NOT NULL, REGION_ID INTEGER, COUNTRY_ID INTEGER ); CREATE TABLE COUNTRY ( COUNTRY_ID INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1), COUNTRY_NAME VARCHAR(100) NOT NULL ); CREATE TABLE CITY_AREA ( CITY_AREA_ID INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1), CITY_ID INTEGER NOT NULL, CITY_AREA_NAME VARCHAR(100) NOT NULL ); CREATE TABLE APPUSER ( USER_ID INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1), NAME VARCHAR(50) NOT NULL, USER_NAME VARCHAR(50) NOT NULL, PASSWORD VARCHAR(150) NOT NULL, SECRET VARCHAR(15), EMAIL VARCHAR(100) NOT NULL, REGISTERED DATE NOT NULL, MODIFIED DATE ); CREATE TABLE ITEM ( ITEM_ID INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1), ITEM_NAME VARCHAR(100) NOT NULL, ANNOUNCER_ID INTEGER NOT NULL, CATEGORY_ID INTEGER NOT NULL, PUBLISHED DATE NOT NULL, MODIFIED DATE NOT NULL, PRICE DECIMAL(10 , 2) NOT NULL, CONTACT_NAME VARCHAR(100) NOT NULL, CONTACT_EMAIL VARCHAR(100) NOT NULL, ITEM_ACTIVE SMALLINT DEFAULT 1 NOT NULL, EXPIRATION DATE NOT NULL, DESCRIPTION VARCHAR(4000) NOT NULL, LOCATION_ID INTEGER NOT NULL ); CREATE TABLE REGION ( REGION_ID INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1), COUNTRY_ID INTEGER NOT NULL, REGION_NAME VARCHAR(100) NOT NULL ); CREATE TABLE CATEGORY ( CATEGORY_ID INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1), PARENT_CATEGORY_ID INTEGER, CATEGORY_NAME VARCHAR(100) NOT NULL, POSITION INTEGER NOT NULL, CAT_ENABLED SMALLINT NOT NULL ); CREATE TABLE ITEM_COMMENT ( ITEM_COMMENT_ID INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1), ITEM_ID INTEGER NOT NULL, PUBLISHED DATE NOT NULL, TITLE VARCHAR(100) NOT NULL, AUTHOR_NAME VARCHAR(100) NOT NULL, AUTHOR_EMAIL VARCHAR(100) NOT NULL, BODY VARCHAR(4000) NOT NULL, USER_ID INTEGER ); CREATE TABLE ITEM_LOCATION ( ITEM_ID INTEGER NOT NULL, LOCATION_ID INTEGER NOT NULL ); CREATE UNIQUE INDEX SQL150422230409370 ON ITEM (ITEM_ID ASC); CREATE UNIQUE INDEX SQL150422223535410 ON REGION (REGION_ID ASC); CREATE UNIQUE INDEX SQL150422224940710 ON CATEGORY (CATEGORY_ID ASC); CREATE UNIQUE INDEX SQL150423000430890 ON ITEM_RESOURCE (ITEM_RESOURCE_ID ASC); CREATE UNIQUE INDEX SQL150422212339610 ON CITY (CITY_ID ASC); CREATE UNIQUE INDEX SQL150422224230330 ON COUNTRY (COUNTRY_ID ASC); CREATE UNIQUE INDEX SQL150422224412560 ON CITY_AREA (CITY_AREA_ID ASC); CREATE UNIQUE INDEX SQL150423001615740 ON ITEM_COMMENT (ITEM_COMMENT_ID ASC); CREATE UNIQUE INDEX SQL150423002352120 ON LOCATION (LOCATION_ID ASC); CREATE UNIQUE INDEX SQL150423003006650 ON APPUSER (USER_ID ASC); CREATE UNIQUE INDEX SQL150424142442640 ON ITEM_LOCATION (ITEM_ID ASC, LOCATION_ID ASC); ALTER TABLE APPUSER ADD CONSTRAINT USER_PK PRIMARY KEY (USER_ID); ALTER TABLE ITEM_COMMENT ADD CONSTRAINT ITEM_COMMENT_PK PRIMARY KEY (ITEM_COMMENT_ID); ALTER TABLE ITEM ADD CONSTRAINT ITEM_PK PRIMARY KEY (ITEM_ID); ALTER TABLE REGION ADD CONSTRAINT REGION_PK PRIMARY KEY (REGION_ID); ALTER TABLE CITY_AREA ADD CONSTRAINT CITY_AREA_PK PRIMARY KEY (CITY_AREA_ID); ALTER TABLE CATEGORY ADD CONSTRAINT CATEGORY_PK PRIMARY KEY (CATEGORY_ID); ALTER TABLE LOCATION ADD CONSTRAINT LOCATION_PK PRIMARY KEY (LOCATION_ID); ALTER TABLE ITEM_RESOURCE ADD CONSTRAINT ITEM_RESOURCE_PK PRIMARY KEY (ITEM_RESOURCE_ID); ALTER TABLE COUNTRY ADD CONSTRAINT COUNTRY_PK PRIMARY KEY (COUNTRY_ID); ALTER TABLE CITY ADD CONSTRAINT CITY_PK PRIMARY KEY (CITY_ID); ALTER TABLE ITEM_LOCATION ADD CONSTRAINT ITEM_LOCATION_PK PRIMARY KEY (ITEM_ID, LOCATION_ID);
true
48c9fd42ee876d963ebfd4ca8b2b3835107bbc6a
SQL
SinfulPhantom/Nanavut_Site
/create_db.sql
UTF-8
1,784
3.3125
3
[]
no_license
drop table Orders; drop table Product; drop table Customer; drop table Registration; CREATE TABLE Customer ( cc_no numeric(16), exp_mo numeric(2) NOT NULL, exp_yr numeric(4) NOT NULL, name_first varchar(20) NOT NULL, name_last varchar(20) NOT NULL, email varchar(20) NOT NULL, address1 varchar(50) NOT NULL, address2 varchar(50), city varchar(20) NOT NULL, state varchar(2) NOT NULL, zip numeric(5) NOT NULL, country varchar(20), phone varchar(15) NOT NULL, fax varchar(15) NOT NULL, mail_list numeric(1), PRIMARY KEY (cc_no)); CREATE TABLE Product ( item_no numeric(4) NOT NULL, item_name varchar(30) NOT NULL, price numeric(9,2) NOT NULL, inventory int(11) NOT NULL, PRIMARY KEY (item_no)); CREATE TABLE Orders ( quantity numeric NOT NULL, date_sold DATETIME NOT NULL, item_no numeric(4), cc_no numeric(16), FOREIGN KEY (cc_no) REFERENCES Customer(cc_no), FOREIGN KEY (item_no) REFERENCES Product(item_no)); CREATE TABLE Registration ( username varchar(16), password varchar(16) NOT NULL, email varchar(50) NOT NULL, PRIMARY KEY (username)); INSERT INTO Product VALUES (0, 'Moose Boots', 250, 100); INSERT INTO Product VALUES (1, 'Caribou Skin Boots', 300, 100); INSERT INTO Product VALUES (2, 'Brown Rabbit Slippters', 150, 100); INSERT INTO Product VALUES (3, 'Snow Rabbit Slippers', 150, 100); INSERT INTO Product VALUES (4, 'Earring', 1000, 100); INSERT INTO Product VALUES (5, 'Necklace', 500, 100); INSERT INTO Product VALUES (6, 'Hair Clip', 75, 100); INSERT INTO Product VALUES (7, 'Pendant', 400, 100); INSERT INTO Product VALUES (8, 'Dog Sled', 1000, 100); INSERT INTO Product VALUES (9, 'Wood Carving', 500, 100); INSERT INTO Product VALUES (10, 'Wood Carving', 1500, 100); INSERT INTO Product VALUES (11, 'Ivory Carvings', 2500, 100);
true
d7263ef0beb3f2a86ca46d61ca2a95c74b63bb3f
SQL
ZFGCCP/ZFGC3
/src/main/database/tables/SYSTEM_DIRECTORIES.sql
UTF-8
1,214
2.703125
3
[ "MIT" ]
permissive
-- -------------------------------------------------------- -- Host: zfgc.com -- Server version: 5.5.61-0ubuntu0.14.04.1 - (Ubuntu) -- Server OS: debian-linux-gnu -- HeidiSQL Version: 9.3.0.4984 -- -------------------------------------------------------- /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET NAMES utf8mb4 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; -- Dumping structure for table zfgc3_dev.SYSTEM_DIRECTORIES CREATE TABLE IF NOT EXISTS `SYSTEM_DIRECTORIES` ( `SYSTEM_DIRECTORY_ID` int(11) NOT NULL AUTO_INCREMENT, `SYSTEM_DIRECTORY_CODE` varchar(10) NOT NULL, `SYSTEM_DIRECTORY_DESC` varchar(50) NOT NULL, `SYSTEM_PATH` varchar(260) NOT NULL, PRIMARY KEY (`SYSTEM_DIRECTORY_ID`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- Data exporting was unselected. /*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */; /*!40014 SET FOREIGN_KEY_CHECKS=IF(@OLD_FOREIGN_KEY_CHECKS IS NULL, 1, @OLD_FOREIGN_KEY_CHECKS) */; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
true
3c932358779c61f6941db8badf41ebee97dff57a
SQL
omegazip/dba_scripts
/custom/Script_OracleBase/External Scripts/PerfSheet4_v3.5/sqlplus_scripts/Perfsheet4_query_AWR_ioevent_histogram.sql
UTF-8
2,319
3.8125
4
[]
no_license
-- -- Perfsheet4 query to extract AWR data -- Perfsheet4_query_AWR_ioevent_histogram.sql -> Extracts data from dba_hist_event_histogram for io related events, computes delta values between snapshots and rates (i.e. delta values divided over delta time) -- output is in csv format -- Luca Canali, Oct 2012 -- -- Usage: -- Run the script from sql*plus connected as a priviledged user (need to be able to read AWR tables) -- Can run it over sql*net from client machine or locally on db server -- Customize the file perfsheet4_definitions.sql before running this, in particular define there the interval of analysis @@Perfsheet4_definitions.sql set termout on prompt prompt Dumping AWR data to file Perfsheet4_AWR_ioevent_histogram_&myfilesuffix..csv, please wait prompt set termout off spool Perfsheet4_AWR_ioevent_histogram_&myfilesuffix..csv select cast(min(sn.begin_interval_time) over (partition by sn.dbid,sn.snap_id) as date) snap_time, --workaround to uniform snap_time over all instances in RAC --eh.dbid, --uncomment if you have multiple dbid in your AWR sn.instance_number, eh.event_name, eh.wait_time_milli, --eh.wait_count, eh.wait_count - lag(eh.wait_count) over (partition by eh.dbid,eh.instance_number,eh.event_id,eh.wait_time_milli order by sn.snap_id nulls first) Delta_wait_count, round((eh.wait_count - lag(eh.wait_count) over (partition by eh.dbid,eh.instance_number,eh.event_id,eh.wait_time_milli order by sn.snap_id nulls first)) / (extract(hour from END_INTERVAL_TIME-begin_interval_time)*3600 -extract(hour from sn.snap_timezone - lag(sn.snap_timezone) over (partition by eh.dbid,eh.instance_number,eh.event_id,eh.wait_time_milli order by sn.snap_id nulls first) )*3600 --deals with daylight savings time change + extract(minute from END_INTERVAL_TIME-begin_interval_time)* 60 + extract(second from END_INTERVAL_TIME-begin_interval_time)),2 ) Rate_wait_count_per_bin from dba_hist_event_histogram eh, dba_hist_snapshot sn where sn.snap_id = eh.snap_id and sn.dbid = eh.dbid and sn.instance_number = eh.instance_number and sn.begin_interval_time &delta_time_where_clause and eh.wait_class in ('User I/O','System I/O','Commit') -- need to limit search or dump file can grow too big order by sn.snap_id; spool off
true
674f20c5f969d2cfa4c957407da17f02bc194d27
SQL
vykanton/songscape
/extract_rfpt.sql
UTF-8
2,005
4.0625
4
[]
no_license
DROP table if exists rftp_scores; CREATE temporary table rftp_scores AS select s.id, a.analysis_id, selection_method, date_part('year', r.datetime) as year, date_part('month', r.datetime) as month, date_part('day', r.datetime) as day, site.code as site, recorder.code as recorder, slow.score as low, speak.score as peak, shigh.score as high, skiwi.score as kiwi, a.male_kiwi, a.female_kiwi, a.uncertain from recordings_snippet s left join (select an.id as analysis_id, snippet_id, selection_method, coalesce(male_kiwi, 0) as male_kiwi, coalesce(female_kiwi, 0) as female_kiwi, coalesce(uncertain, 0) as uncertain from recordings_analysisset an left join (select analysisset_id, sum((tag_id=1)::INTEGER) as male_kiwi, sum((tag_id=2)::INTEGER) as female_kiwi, sum((tag_id=3)::INTEGER) as uncertain from recordings_calllabel c group by analysisset_id ) as calls on calls.analysisset_id = an.id and an.analysis_id = 1 ) as a on s.id = a.snippet_id left join recordings_recording r on s.recording_id = r.id left join recordings_deployment d on r.deployment_id = d.id left join recordings_site site on d.site_id = site.id left join recordings_recorder recorder on d.recorder_id = recorder.id left join recordings_score skiwi on skiwi.snippet_id = s.id and skiwi.detector_id = 4 left join recordings_score slow on slow.snippet_id = s.id and slow.detector_id = 5 left join recordings_score shigh on shigh.snippet_id = s.id and slow.detector_id = 6 left join recordings_score speak on speak.snippet_id = s.id and speak.detector_id = 7 where d.owner_id = 1 --and selection_method is not null ; \copy rftp_scores to 'rftp_scores.csv' with csv header
true
29ebe92ec8cad97fe040747a458a3a5e31b56bf6
SQL
ksacha23/Skylightv2.0
/minecraftComments.sql
UTF-8
1,695
3.078125
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 5.1.0 -- https://www.phpmyadmin.net/ -- -- Host: localhost -- Generation Time: Apr 30, 2021 at 04:50 PM -- Server version: 10.4.18-MariaDB -- PHP Version: 8.0.3 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: `skylight_db` -- -- -------------------------------------------------------- -- -- Table structure for table `minecraftComments` -- CREATE TABLE `minecraftComments` ( `cid` int(11) NOT NULL, `uid` varchar(128) NOT NULL, `date` datetime NOT NULL, `message` text NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `minecraftComments` -- INSERT INTO `minecraftComments` (`cid`, `uid`, `date`, `message`) VALUES (1, '2', '2021-04-30 09:15:36', 'I can spend hours and hours building on Minecraft'), (2, '3', '2021-04-30 09:20:17', 'The possibilities are truly endless with this game'); -- -- Indexes for dumped tables -- -- -- Indexes for table `minecraftComments` -- ALTER TABLE `minecraftComments` ADD PRIMARY KEY (`cid`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `minecraftComments` -- ALTER TABLE `minecraftComments` MODIFY `cid` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3; COMMIT; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
true
7b7d61b8d2cf4eefd8a98ad623f145885ee95edf
SQL
StanislavRybonka/Guest-Book
/db/guest_book_info.sql
UTF-8
3,695
2.640625
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 4.0.10deb1 -- http://www.phpmyadmin.net -- -- Host: localhost -- Generation Time: Jun 02, 2016 at 10:12 PM -- Server version: 5.5.49-0ubuntu0.14.04.1 -- PHP Version: 5.5.9-1ubuntu4.17 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: `guest.book.info` -- -- -------------------------------------------------------- -- -- Table structure for table `users_comment` -- CREATE TABLE IF NOT EXISTS `users_comment` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(255) NOT NULL, `email` varchar(255) NOT NULL, `message` text NOT NULL, `users_id` varchar(255) NOT NULL, `browser_info` varchar(255) NOT NULL, `comment_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=16 ; -- -- Dumping data for table `users_comment` -- INSERT INTO `users_comment` (`id`, `name`, `email`, `message`, `users_id`, `browser_info`, `comment_date`) VALUES (1, 'Ben', 'stanislav1991r@gmail.com', 'Hello', '1270', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:46.0) Gecko/20100101 Firefox/46.0', '2016-05-13 14:22:31'), (2, 'Ben', 'stanislav1991r@gmail.com', 'Hello', '1270', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:46.0) Gecko/20100101 Firefox/46.0', '2016-05-13 14:22:38'), (3, 'Ben', 'stanislav1991r@gmail.com', 'Hello', '127', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:46.0) Gecko/20100101 Firefox/46.0', '2016-05-13 14:24:07'), (4, 'fddfdf', 'fgfgdfg@fgfgfggfg.com', 'dfdfgdggg', '127', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:46.0) Gecko/20100101 Firefox/46.0', '2016-05-13 14:26:11'), (5, 'fddfdf', 'stanislav1991r@gmail.com', 'dfdfgdggg', '127', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:46.0) Gecko/20100101 Firefox/46.0', '2016-05-13 14:26:19'), (6, 'fddfdf', 'stanislav1991r@gmail.com', 'dfdfgdggg', '127.0.0.1', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:46.0) Gecko/20100101 Firefox/46.0', '2016-05-13 14:27:14'), (7, 'Ben', 'fgfgdfg@fgfgfggfg.com', 'Hello', '127.0.0.1', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:46.0) Gecko/20100101 Firefox/46.0', '2016-05-13 14:27:21'), (8, 'Stanislav', 'stanislav1991r@gmail.com', 'Hello Stanislav', '127.0.0.1', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:46.0) Gecko/20100101 Firefox/46.0', '2016-05-13 14:28:05'), (9, 'Ben', 'stanislav1991r@gmail.com', 'Hello', '127.0.0.1', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:46.0) Gecko/20100101 Firefox/46.0', '2016-05-13 14:30:06'), (10, 'Ben', 'stanislav1991r@gmail.com', 'Hello', '127.0.0.1', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:46.0) Gecko/20100101 Firefox/46.0', '2016-05-13 14:41:38'), (11, 'Ben', 'stanislav1991r@gmail.com', 'Hello', '127.0.0.1', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:46.0) Gecko/20100101 Firefox/46.0', '2016-05-16 20:31:37'), (12, 'Petro', 'petro@gmail.com', 'Poka poka', '127.0.0.1', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:46.0) Gecko/20100101 Firefox/46.0', '2016-05-18 15:44:54'), (13, 'ddd', 'petro@gmail.com', 'Hello', '127.0.0.1', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:46.0) Gecko/20100101 Firefox/46.0', '2016-05-18 16:34:13'), (14, 'Den', 'den@gmail.com', 'Buy', '127.0.0.1', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:46.0) Gecko/20100101 Firefox/46.0', '2016-05-18 17:09:30'), (15, 'Vlad', 'vlad@gmail.com', 'I am vlad', '127.0.0.1', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:46.0) Gecko/20100101 Firefox/46.0', '2016-05-18 18:18:50'); /*!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
e66f004198e35c7201f68817db934810d88fb2f9
SQL
Jell/advent2020
/in_postgres/day_09_part_1.sql
UTF-8
1,246
4.03125
4
[]
no_license
DROP SCHEMA IF EXISTS day09 CASCADE; CREATE SCHEMA IF NOT EXISTS day09; CREATE UNLOGGED TABLE day09.inputs ( line_number bigint NOT NULL GENERATED ALWAYS AS IDENTITY, line_value bigint NOT NULL ); \COPY day09.inputs (line_value) FROM PROGRAM 'cat ../inputs/day09.txt'; VACUUM ANALYZE day09.inputs; \timing on with checksums as ( select i.line_number, i.line_value, array_agg(ARRAY[previous.number, other_previous.number]) filter (where previous.number + other_previous.number = i.line_value) as matches from day09.inputs i, lateral (select previous.line_number, previous.line_value from day09.inputs previous where previous.line_number between (i.line_number - 25) and (i.line_number - 1)) as previous(line_number,number), lateral (select other_previous.line_value from day09.inputs other_previous where other_previous.line_number between i.line_number - 25 and i.line_number - 1 and other_previous.line_number > previous.line_number) as other_previous(number) where i.line_number > 25 group by i.line_number, i.line_value ) select concat('Day 09 - Part 1: ', line_value) from checksums where matches is null order by line_number ASC limit 1 ;
true
8b8a0f850bb51a936c035445bc40fc50de12e7c0
SQL
jghernandez35/WebAdminVirtualBox
/BD Diseño/crebasMySqlWebVirtualBox01.sql
UTF-8
1,530
3.375
3
[]
no_license
/*==============================================================*/ /* DBMS name: MySQL 5.0 */ /* Created on: 24/10/2017 12:51:48 p. m. */ /*==============================================================*/ drop table if exists MAQUINA_VIRTUAL; drop table if exists USUARIOS_SISTEMA; /*==============================================================*/ /* Table: MAQUINA_VIRTUAL */ /*==============================================================*/ create table MAQUINA_VIRTUAL ( ID int not null, USU_ID int not null, USO_MEMORIA float(30), USO_CPU float(30), USO_PROCESAMIENTO float(30), primary key (ID) ); /*==============================================================*/ /* Table: USUARIOS_SISTEMA */ /*==============================================================*/ create table USUARIOS_SISTEMA ( ID int not null auto_increment, IDENTIFICACION int, NOMBRES varchar(60), APELLIDOS varchar(60), EMAIL varchar(30), CELULAR int, TELEFONO int, TIPOUSUARIO varchar(20), CONTRASENA varchar(240), primary key (ID) ); alter table MAQUINA_VIRTUAL add constraint FK_RELATIONSHIP_5 foreign key (USU_ID) references USUARIOS_SISTEMA (ID) on delete restrict on update restrict;
true
f884b0ed57ba1b1a7aa714bd66906612ccd69273
SQL
ankur04/QuizApp
/src/resources/scripts/init.sql
UTF-8
3,819
3.34375
3
[]
no_license
DROP TABLE quiz_users PURGE; CREATE TABLE quiz_users ( email_id VARCHAR2(50) PRIMARY KEY, password VARCHAR2(500) NOT NULL, username VARCHAR2(20) NOT NULL UNIQUE, phone_number VARCHAR2(20) NOT NULL, gender VARCHAR2(25), date_of_birth DATE, last_logged_in DATE, image_url VARCHAR2(50), image BLOB, pro_version CHAR(1), salt VARCHAR2(500) ); INSERT INTO quiz_users VALUES ( 'ankur.patel@humber.ca', 'Ankur@123', 'Dark_Knight', '+1-612-7788', 'Male', '20-Dec-1994', '19-Jan-2019', 'abc', bfilename('GIF_FILES', 'Ankur.JPG'), 'Y', '' ); SELECT * FROM quiz_users; alter table quiz_users modify last_logged_in timestamp; COMMIT; DROP TABLE quiz_category; CREATE TABLE quiz_category ( category_no NUMBER GENERATED BY DEFAULT AS IDENTITY START WITH 1 PRIMARY KEY, category_name VARCHAR2(20) ); CREATE TABLE quiz_questions ( question_no NUMBER(2), question VARCHAR2(255), option1 VARCHAR2(255), option2 VARCHAR2(255), option3 VARCHAR2(255), option4 VARCHAR2(255), correct_ans NUMBER(2), points NUMBER, category_no NUMBER NOT NULL REFERENCES quiz_category ( category_no ) ); CREATE TABLE quiz_result ( quiz_no NUMBER GENERATED BY DEFAULT AS IDENTITY START WITH 1 PRIMARY KEY, score_obtained NUMBER, percentage_score NUMBER, time_used NUMBER, username VARCHAR2(20) NOT NULL REFERENCES quiz_users ( username ) ); INSERT INTO quiz_category ( category_name ) VALUES ( 'Java' ); INSERT INTO quiz_category ( category_name ) VALUES ( 'Oracle' ); INSERT INTO quiz_category ( category_name ) VALUES ( 'TV Show' ); INSERT INTO quiz_category ( category_name ) VALUES ( 'Movies' ); INSERT INTO quiz_category ( category_name ) VALUES ( 'Fun' ); SELECT * FROM quiz_category; COMMIT; insert into quiz_questions values(1, 'The Plaka is the oldest quarter of which city?', 'Athens','Prague','Rome','Vienna',1,3,5); insert into quiz_questions values(2, 'Apart from Mad George, which kinder nickname did George III have?','Big George','Farmer Giles','Farmer George','Happy George',3,3,5); insert into quiz_questions values(3, 'The House of Lancaster kings were all called what?','Charles','Edward','George','Henry',4,3,5); insert into quiz_questions values(4, 'Who was the last viceroy of India?','Clive','George VI','Prince Louis of Battenburg','Lord Louis Mountbatten',4,3,5); insert into quiz_questions values(5, 'Who was the lead actor in the film ''12 Angry Men''?', 'Cary Grant','Marlon Brando','Henry Fonda','Jimmy Stewart',3,3,5); insert into quiz_questions values(6, 'What is the longest river in France?', 'Loire','Seine','Rhone','Gironde',1,3,5); insert into quiz_questions values(7, 'Who become the first batsman to smash 500 or more sixes in international cricket?', 'David Warner','Kane Williamson','Virat Kohli','Chris Gayle',4,3,5); insert into quiz_questions values(8, 'Which country topped in the ISSF World Cup 2019?', 'Singapore','India','Brazil','Spain',2,3,5); insert into quiz_questions values(9, 'The Opium war id held between which two countries?', 'England and France','China and Russia','Russia and England','China and England',4,3,5); insert into quiz_questions values(10, 'The oldest dynasty still ruling in which country?', 'India','Iran','Japan','England',3,3,5);
true
2ee2f79ae3c0853658f953614265623c2de7bc76
SQL
Venkateshan-Fullstackdeveloper/SQL-Basics
/01basics/datetime.sql
UTF-8
580
3.296875
3
[]
no_license
-- TODO: CREATE DATE TIME TABLE -- CREATE TABLE user( -- name VARCHAR(10), -- col1 DATE, -- col2 TIME, -- col3 DATETIME -- ); -- desc user; -- INSERT INTO user VALUES('Venky','2020-08-14','10:14:22','2021-08-18 11:08:33'); -- INSERT INTO user VALUES('Thor','2020-08-14','10:14:22',NOW()); -- INSERT INTO user VALUES('Groot','2020-08-14','10:14:22',NOW()); -- TODO: DATE_FORMAT(colname,'string format') -- SELECT name,DATE_FORMAT(col3,'%d/%m/%y') from user; -- MANY FUNCTIONS DAY(),DATE(),MONTH(),HOUR() etc..
true
7668467d958bb54f9396dddadbbfbb615461978c
SQL
paul-rogers/drill-test-framework
/framework/resources/Advanced/tpcds/tpcds_sf1/original/not_supported/query23.sql
UTF-8
2,550
3.953125
4
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
-- start query 23 in stream 0 using template query23.tpl WITH frequent_ss_items AS (SELECT Substr(i_item_desc, 1, 30) itemdesc, i_item_sk item_sk, d_date solddate, Count(*) cnt FROM store_sales, date_dim, item WHERE ss_sold_date_sk = d_date_sk AND ss_item_sk = i_item_sk AND d_year IN ( 1998, 1998 + 1, 1998 + 2, 1998 + 3 ) GROUP BY Substr(i_item_desc, 1, 30), i_item_sk, d_date HAVING Count(*) > 4), max_store_sales AS (SELECT Max(csales) tpcds_cmax FROM (SELECT c_customer_sk, Sum(ss_quantity * ss_sales_price) csales FROM store_sales, customer, date_dim WHERE ss_customer_sk = c_customer_sk AND ss_sold_date_sk = d_date_sk AND d_year IN ( 1998, 1998 + 1, 1998 + 2, 1998 + 3 ) GROUP BY c_customer_sk)), best_ss_customer AS (SELECT c_customer_sk, Sum(ss_quantity * ss_sales_price) ssales FROM store_sales, customer WHERE ss_customer_sk = c_customer_sk GROUP BY c_customer_sk HAVING Sum(ss_quantity * ss_sales_price) > ( 95 / 100.0 ) * (SELECT * FROM max_store_sales)) SELECT Sum(sales) FROM (SELECT cs_quantity * cs_list_price sales FROM catalog_sales, date_dim WHERE d_year = 1998 AND d_moy = 6 AND cs_sold_date_sk = d_date_sk AND cs_item_sk IN (SELECT item_sk FROM frequent_ss_items) AND cs_bill_customer_sk IN (SELECT c_customer_sk FROM best_ss_customer) UNION ALL SELECT ws_quantity * ws_list_price sales FROM web_sales, date_dim WHERE d_year = 1998 AND d_moy = 6 AND ws_sold_date_sk = d_date_sk AND ws_item_sk IN (SELECT item_sk FROM frequent_ss_items) AND ws_bill_customer_sk IN (SELECT c_customer_sk FROM best_ss_customer)) LIMIT 100;
true
eb0bb82fc80898b58fad910e55cd830aec3d2147
SQL
murshidazher/foysonis-abc
/server/postgres/tables/bank_account.sql
UTF-8
225
2.828125
3
[ "MIT" ]
permissive
BEGIN TRANSACTION; CREATE TABLE bank_account ( id serial PRIMARY KEY, balance DECIMAL DEFAULT 0, opened TIMESTAMP NOT NULL DEFAULT NOW(), user_id INTEGER NOT NULL, last_transaction_id INTEGER ); COMMIT;
true
03264c261a8b9519b62c9c62e5566500f61eda79
SQL
Civerneitor/UD22
/ej3.sql
UTF-8
618
3.453125
3
[]
no_license
create database Laboratorio; use Laboratorio; drop table if exists Cientificos; create table Cientificos ( DNI varchar(9) NOT NULL, nomApels varchar(255), PRIMARY KEY (DNI) ); drop table if exists Proyectos; create table Proyectos ( id char(4) NOT NULL, nombre varchar(255), horas int, PRIMARY KEY (id) ); drop table if exists Cientificos_Proyectos; create table Cientificos_Proyectos ( dniC_fk varchar(8) NOT NULL, idP_fk char(4) NOT NULL, foreign key (dniC_fk) references Cientificos(DNI) on update CASCADE on delete no action, foreign key (idP_fk) references Proyectos(id) on update CASCADE on delete no action );
true
9eae32b3a0c01059669282fe45724714cc2a4349
SQL
andresapodaca/ejemplo2
/productos.sql
UTF-8
5,271
2.890625
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 4.1.14 -- http://www.phpmyadmin.net -- -- Servidor: 127.0.0.1 -- Tiempo de generación: 07-10-2015 a las 23:01:21 -- Versión del servidor: 5.6.17 -- Versión de PHP: 5.5.12 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8 */; -- -- Base de datos: `productos` -- -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `cargadores` -- CREATE TABLE IF NOT EXISTS `cargadores` ( `pkCargador` int(11) NOT NULL AUTO_INCREMENT, `existencia` int(11) NOT NULL, `modelo` varchar(45) NOT NULL, `tipo` varchar(45) NOT NULL, `precio` int(11) NOT NULL, PRIMARY KEY (`pkCargador`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=12 ; -- -- Volcado de datos para la tabla `cargadores` -- INSERT INTO `cargadores` (`pkCargador`, `existencia`, `modelo`, `tipo`, `precio`) VALUES (2, 1, 'SONY VAIO', 'LAPTOP', 350), (3, 5, 'HP PUNTA AZUL', 'LAPTOP', 450), (4, 1, 'HP PIN CENTRAL S. NUEVO', 'LAPTOP', 350), (5, 6, 'ACCER / GATEWAY', 'LAPTOP', 350), (6, 1, 'LENOVO S. NUEVO ORIG.', 'LAPTOP', 450), (7, 1, '?..', 'C.TABLET', 90), (8, 3, 'ELUX', 'C.P/ CEL BLANCO', 100), (9, 2, 'MT LIDER', 'C. AZUL', 60), (10, 4, '.COM', 'C. ROJO', 80), (11, 4, 'MTLIDER', 'C. P / CARRO', 80); -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `mercancia` -- CREATE TABLE IF NOT EXISTS `mercancia` ( `pkMerca` int(11) NOT NULL AUTO_INCREMENT, `merca` varchar(40) NOT NULL, `precio` varchar(15) NOT NULL, PRIMARY KEY (`pkMerca`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=102 ; -- -- Volcado de datos para la tabla `mercancia` -- INSERT INTO `mercancia` (`pkMerca`, `merca`, `precio`) VALUES (39, 'AUDIFONOS', '$55.00'), (40, 'USB 8 GB', '$100.00'), (41, 'GLOBOS', '$2.00 C/U'), (42, 'PERFORADORA', '$ 26.00'), (43, 'REGLAS', '$ 5.00'), (44, 'TIJERAS', '$ 7.00'), (45, 'BRILLANTINA', '$ 4.00'), (46, 'CUTER', '$ 5.00'), (47, 'MARCADORES ACEITE', '$ 12.00 C/U'), (48, 'MARCADORES DE AGUA', '$ 7.00 C/U'), (49, 'LIBRETAS', '$ 17.00'), (50, 'PAQ. DE HOJAS P/CARPETAS', '$35.00'), (51, 'HOJAS DE LIBRETAS SUELTAS', '3 X $ 1.00'), (52, 'FOMI', '$ 2.00'), (53, 'PAPEL CHINA', '$ 2.50'), (54, 'PAPEL CREPE', '$ 5.00'), (55, 'HOJAS DE COLOR', '$ 0.50'), (56, 'MAPA', '$ 1.00'), (57, 'SOLICITUDES', '$ 2.00'), (58, 'HOJAS T/ OFICIO', '3 X $1.00'), (59, 'HOJAS T/ CARTA', '4 X $1.00'), (60, 'FOLDERS DE PLASTICO', '$ 12.00'), (61, 'FICHAS DE TRABAJO', '$ 1.00'), (62, 'PLASTILINAS', '$ 5.50'), (63, 'RESISTOL', '$ 8.00'), (64, 'PINTURAS DE AGUA Y ACEITE', '$ 6.00'), (65, 'CLINEX', '$ 5.00'), (66, 'PLUMONES DE AGUA', '$ 10.00'), (67, 'PLUMAS AZUL,NEGRA Y ROJA', '$ 5.00'), (68, 'PLUMAS COLORES', '$ 8.00'), (69, 'PUNTILLAS 0.5 Y 0.7', '$ 10.00'), (70, 'LAPIZ', '$ 3.00'), (71, 'CILICON', '$ 2.00'), (72, 'COLORES', '$ 4.00'), (73, 'SACAPUNTAS', '$ 2.00'), (74, 'PINCELES', '$ 4.00'), (75, 'CORRECTOR', '$ 17.00'), (76, 'CD DVD SOLO', '$ 15.00'), (77, 'CD DVD CON CAJA', '$ 20.00'), (78, 'CD SOLO', '$ 10.00'), (79, 'CD CON CAJA', '$ 15.00'), (80, 'CAJA P/CD', '$ 7.00'), (81, 'ROTAFOLIO', '$ 5.00'), (82, 'CARTULINA BLANCA', '$ 5.00'), (83, 'CARTULINA COLOR', '$ 7.00'), (84, 'PAPEL CASCARON GRANDE', '$ 12.00'), (85, 'PAPEL CASCARON MEDIANO', '$ 8.00'), (86, 'PAPEL CASCARON CHICO', '$ 5.00'), (87, 'PAPEL LUSTRE', '$ 4.00'), (88, 'ENMICADO GRANDE', '$ 10.00'), (89, 'ENMICADO MEDIANO', '$ 8.00'), (90, 'ENMICADO CHICO', '$ 7.00'), (91, 'PAQ. LIGAS', '$ 5.00'), (92, 'PALITOS DE MADERA', '$ 9.00'), (93, 'CARPETA COLORES', '$ 5.00'), (94, 'CARPETAS T/ CARTA', '$ 3.00'), (95, 'CARPETAS T/ OFICIO', '$ 4.00'), (96, 'CINTA SCORCH', '$ 5.00'), (97, 'CARTERITA DE ESTRELLAS', '$ 6.00'), (98, 'LAPICEROS', '$ 10.00'), (99, 'IMPRECIONES B/N', '$ 1.00'), (100, 'IMPRECIONES COLOR', '$ 3.00'), (101, 'PAQ. HOJAS BLANCAS T/ CARTA', '$ 50.00'); -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `protectores` -- CREATE TABLE IF NOT EXISTS `protectores` ( `pkProtector` int(11) NOT NULL AUTO_INCREMENT, `existencia` int(11) NOT NULL, `modelo` varchar(40) NOT NULL, `tipo` varchar(40) NOT NULL, `precio` int(11) NOT NULL, PRIMARY KEY (`pkProtector`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=12 ; -- -- Volcado de datos para la tabla `protectores` -- INSERT INTO `protectores` (`pkProtector`, `existencia`, `modelo`, `tipo`, `precio`) VALUES (1, 1, 'NOTE 3', 'CARTERAS', 130), (2, 1, 'NOTE II / 7100', 'CARTERAS', 130), (3, 1, 'NOTE 3 / N7200/N9000/N900A/N9002/N9005', 'P / CILICON', 80), (4, 1, 'SAMSUNG E500', 'CARTERAS', 130), (5, 1, 'SAMSUNG G530 GRAND PRIME', 'CARTERAS', 130), (6, 1, 'SAMSUNG S5', 'CARTERAS', 130), (7, 1, 'IPHONE 5', 'CARTERAS', 130), (8, 1, 'OPTIMUS GPRO / E980', 'P / CILICON', 80), (9, 1, 'L70', 'P / CILICON / CLIP $100', 80), (10, 3, 'G PRO LITE / D680', 'P / CILICON', 80), (11, 2, 'SAMSUNG CORE 2', 'P / CILICON', 80); /*!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
75d8ab8c95dc774ff6058996507587aab758213a
SQL
zz0733/op-gbsql
/history/v2015/companies/V1.0.1.0570__I_sys_dict.sql
UTF-8
2,079
2.6875
3
[]
no_license
-- auto gen by linsen 2018-03-12 09:16:37 -- BC转账类型 by zain INSERT INTO sys_dict (module, dict_type, dict_code, order_num, remark, parent_code, active) SELECT 'api', 'transaction_type', 'BETPLACED', '1', '下注', NULL, 't' WHERE NOT EXISTS (SELECT id FROM sys_dict WHERE module='api' and dict_type='transaction_type' and dict_code='BETPLACED') ; INSERT INTO sys_dict (module, dict_type, dict_code, order_num, remark, parent_code, active) SELECT 'api', 'transaction_type', 'ACCEPTED', '2', '接收', NULL, 't' WHERE NOT EXISTS (SELECT id FROM sys_dict WHERE module='api' and dict_type='transaction_type' and dict_code='ACCEPTED') ; INSERT INTO sys_dict (module, dict_type, dict_code, order_num, remark, parent_code, active) SELECT 'api', 'transaction_type', 'RETURNED', '3', '退回', NULL, 't' WHERE NOT EXISTS (SELECT id FROM sys_dict WHERE module='api' and dict_type='transaction_type' and dict_code='RETURNED') ; INSERT INTO sys_dict (module, dict_type, dict_code, order_num, remark, parent_code, active) SELECT 'api', 'transaction_type', 'WIN', '4', '赢', NULL, 't' WHERE NOT EXISTS (SELECT id FROM sys_dict WHERE module='api' and dict_type='transaction_type' and dict_code='WIN') ; INSERT INTO sys_dict (module, dict_type, dict_code, order_num, remark, parent_code, active) SELECT 'api', 'transaction_type', 'LOST', '5', '输', NULL, 't' WHERE NOT EXISTS (SELECT id FROM sys_dict WHERE module='api' and dict_type='transaction_type' and dict_code='LOST') ; INSERT INTO sys_dict (module, dict_type, dict_code, order_num, remark, parent_code, active) SELECT 'api', 'transaction_type', 'CASHEDOUT', '6', '兑现', NULL, 't' WHERE NOT EXISTS (SELECT id FROM sys_dict WHERE module='api' and dict_type='transaction_type' and dict_code='CASHEDOUT') ; INSERT INTO sys_dict (module, dict_type, dict_code, order_num, remark, parent_code, active) SELECT 'api', 'transaction_type', 'ROLLBACK', '7', '撤销', NULL, 't' WHERE NOT EXISTS (SELECT id FROM sys_dict WHERE module='api' and dict_type='transaction_type' and dict_code='ROLLBACK') ;
true
1772dd0c607c751f1a08ee8fe39d8d877a7c1929
SQL
douxiaotian/cpic-data
/src/main/resources/db/migration/V36__update_allele_view.sql
UTF-8
950
4.125
4
[ "CC0-1.0", "LicenseRef-scancode-public-domain" ]
permissive
-- This view is being created mainly for use on the CPIC website. It is meant to show a list of alleles with -- clinical functional status assigned and that are associated, through a gene, with a guideline. create view allele_guideline as select a.genesymbol, a.name as allelename, ( select jsonb_agg(distinct jsonb_build_object('name', g.name, 'url', g.url)) from pair p join guideline g on (g.id=p.guidelineid) where a.genesymbol=p.genesymbol ) guidelines from allele a where a.clinicalfunctionalstatus is not null group by a.genesymbol, a.name; comment on view allele_guideline is 'A list of all alleles and the guidelines they are associated with'; comment on column allele_guideline.genesymbol is 'The gene the allele is part of'; comment on column allele_guideline.allelename is 'The name of the allele'; comment on column allele_guideline.guidelines is 'Guidelines that the gene are associated with';
true
4e98dfbf1f14f599697cc8f7d2de45a7ae1b4aa9
SQL
mimogollon1/Tranmiweb
/transmiweb.sql
UTF-8
7,442
2.953125
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 4.6.5.2 -- https://www.phpmyadmin.net/ -- -- Servidor: 127.0.0.1 -- Tiempo de generación: 01-10-2017 a las 19:00:51 -- Versión del servidor: 10.1.21-MariaDB -- Versión de PHP: 7.1.1 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8mb4 */; -- -- Base de datos: `transmiweb` -- -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `movimientos` -- CREATE TABLE `movimientos` ( `ID_Movimiento` int(30) NOT NULL, `Tipo_Movimiento` int(30) NOT NULL, `Monto` int(30) NOT NULL, `ID_Tarjeta` int(30) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Volcado de datos para la tabla `movimientos` -- INSERT INTO `movimientos` (`ID_Movimiento`, `Tipo_Movimiento`, `Monto`, `ID_Tarjeta`) VALUES (100, 100, 2200, 100); -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `perfil` -- CREATE TABLE `perfil` ( `ID_perfil` int(11) NOT NULL, `Nombre` varchar(20) NOT NULL, `Descripcion` varchar(30) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Volcado de datos para la tabla `perfil` -- INSERT INTO `perfil` (`ID_perfil`, `Nombre`, `Descripcion`) VALUES (1, 'Usuario', 'Usuaro general'); -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `repo_perdida` -- CREATE TABLE `repo_perdida` ( `ID_repo_perdida` int(30) NOT NULL, `fecha` date NOT NULL, `ID_Tarjeta` int(30) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Volcado de datos para la tabla `repo_perdida` -- INSERT INTO `repo_perdida` (`ID_repo_perdida`, `fecha`, `ID_Tarjeta`) VALUES (100, '2017-09-01', 100); -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `tarjeta` -- CREATE TABLE `tarjeta` ( `ID_Tarjeta` int(30) NOT NULL, `Saldo` int(30) NOT NULL, `ID_Usuario` int(30) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Volcado de datos para la tabla `tarjeta` -- INSERT INTO `tarjeta` (`ID_Tarjeta`, `Saldo`, `ID_Usuario`) VALUES (100, 0, 100); -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `tipo_documento` -- CREATE TABLE `tipo_documento` ( `ID_Tipo_Documento` int(30) NOT NULL, `Descripcion` varchar(30) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Volcado de datos para la tabla `tipo_documento` -- INSERT INTO `tipo_documento` (`ID_Tipo_Documento`, `Descripcion`) VALUES (100, 'Cedula'); -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `tipo_movimiento` -- CREATE TABLE `tipo_movimiento` ( `ID_Tipo_Movimiento` int(30) NOT NULL, `Descripcion` varchar(30) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Volcado de datos para la tabla `tipo_movimiento` -- INSERT INTO `tipo_movimiento` (`ID_Tipo_Movimiento`, `Descripcion`) VALUES (100, 'Recarga'); -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `usuario` -- CREATE TABLE `usuario` ( `ID_Usuario` int(30) NOT NULL, `Nombre` varchar(30) NOT NULL, `Apellido` varchar(30) NOT NULL, `Clave` varchar(30) NOT NULL, `Fecha:Nacimiento` date NOT NULL, `ID_Tipo_Documento` int(30) NOT NULL, `Documento` varchar(12) NOT NULL, `ID_perfil` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Volcado de datos para la tabla `usuario` -- INSERT INTO `usuario` (`ID_Usuario`, `Nombre`, `Apellido`, `Clave`, `Fecha:Nacimiento`, `ID_Tipo_Documento`, `Documento`, `ID_perfil`) VALUES (100, 'Lorena', 'Gonzalez', 'logonzales', '1991-09-01', 100, '103056666', 1); -- -- Índices para tablas volcadas -- -- -- Indices de la tabla `movimientos` -- ALTER TABLE `movimientos` ADD PRIMARY KEY (`ID_Movimiento`), ADD KEY `Tipo_Movimiento` (`Tipo_Movimiento`), ADD KEY `ID_Tarjeta` (`ID_Tarjeta`); -- -- Indices de la tabla `perfil` -- ALTER TABLE `perfil` ADD PRIMARY KEY (`ID_perfil`); -- -- Indices de la tabla `repo_perdida` -- ALTER TABLE `repo_perdida` ADD PRIMARY KEY (`ID_repo_perdida`), ADD KEY `ID_Tarjeta` (`ID_Tarjeta`); -- -- Indices de la tabla `tarjeta` -- ALTER TABLE `tarjeta` ADD PRIMARY KEY (`ID_Tarjeta`), ADD KEY `ID_Usuario` (`ID_Usuario`); -- -- Indices de la tabla `tipo_documento` -- ALTER TABLE `tipo_documento` ADD PRIMARY KEY (`ID_Tipo_Documento`); -- -- Indices de la tabla `tipo_movimiento` -- ALTER TABLE `tipo_movimiento` ADD PRIMARY KEY (`ID_Tipo_Movimiento`); -- -- Indices de la tabla `usuario` -- ALTER TABLE `usuario` ADD PRIMARY KEY (`ID_Usuario`), ADD KEY `fkpersonas` (`ID_Tipo_Documento`), ADD KEY `ID_perfil` (`ID_perfil`); -- -- AUTO_INCREMENT de las tablas volcadas -- -- -- AUTO_INCREMENT de la tabla `movimientos` -- ALTER TABLE `movimientos` MODIFY `ID_Movimiento` int(30) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=101; -- -- AUTO_INCREMENT de la tabla `perfil` -- ALTER TABLE `perfil` MODIFY `ID_perfil` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; -- -- AUTO_INCREMENT de la tabla `repo_perdida` -- ALTER TABLE `repo_perdida` MODIFY `ID_repo_perdida` int(30) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=101; -- -- AUTO_INCREMENT de la tabla `tarjeta` -- ALTER TABLE `tarjeta` MODIFY `ID_Tarjeta` int(30) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=101; -- -- AUTO_INCREMENT de la tabla `tipo_documento` -- ALTER TABLE `tipo_documento` MODIFY `ID_Tipo_Documento` int(30) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=101; -- -- AUTO_INCREMENT de la tabla `tipo_movimiento` -- ALTER TABLE `tipo_movimiento` MODIFY `ID_Tipo_Movimiento` int(30) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=101; -- -- AUTO_INCREMENT de la tabla `usuario` -- ALTER TABLE `usuario` MODIFY `ID_Usuario` int(30) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=101; -- -- Restricciones para tablas volcadas -- -- -- Filtros para la tabla `movimientos` -- ALTER TABLE `movimientos` ADD CONSTRAINT `movimientos_ibfk_1` FOREIGN KEY (`Tipo_Movimiento`) REFERENCES `tipo_movimiento` (`ID_Tipo_Movimiento`) ON DELETE CASCADE ON UPDATE CASCADE, ADD CONSTRAINT `movimientos_ibfk_2` FOREIGN KEY (`ID_Tarjeta`) REFERENCES `tarjeta` (`ID_Tarjeta`); -- -- Filtros para la tabla `repo_perdida` -- ALTER TABLE `repo_perdida` ADD CONSTRAINT `repo_perdida_ibfk_1` FOREIGN KEY (`ID_Tarjeta`) REFERENCES `tarjeta` (`ID_Tarjeta`); -- -- Filtros para la tabla `tarjeta` -- ALTER TABLE `tarjeta` ADD CONSTRAINT `tarjeta_ibfk_1` FOREIGN KEY (`ID_Usuario`) REFERENCES `usuario` (`ID_Usuario`) ON DELETE CASCADE ON UPDATE CASCADE; -- -- Filtros para la tabla `usuario` -- ALTER TABLE `usuario` ADD CONSTRAINT `usuario_ibfk_1` FOREIGN KEY (`ID_Tipo_Documento`) REFERENCES `tipo_documento` (`ID_Tipo_Documento`), ADD CONSTRAINT `usuario_ibfk_2` FOREIGN KEY (`ID_Tipo_Documento`) REFERENCES `tipo_documento` (`ID_Tipo_Documento`), ADD CONSTRAINT `usuario_ibfk_3` FOREIGN KEY (`ID_perfil`) REFERENCES `perfil` (`ID_perfil`) 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
a112f3982d7e4cc43c545dd756b06aeff5cebcd4
SQL
chris-ramon/CS2
/Parcial/EP-CS2/CS2-B207/C1B207-14/C1B207_CUE013671/databaseimpuestos.sql
WINDOWS-1250
1,205
3.234375
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 3.2.0.1 -- http://www.phpmyadmin.net -- -- Servidor: localhost -- Tiempo de generacin: 06-10-2011 a las 13:48:31 -- Versin del servidor: 5.1.37 -- Versin de PHP: 5.3.0 SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; -- -- Base de datos: `impuestos` -- CREATE DATABASE `impuestos` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci; USE `impuestos`; -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `imps` -- CREATE TABLE IF NOT EXISTS `imps` ( `id` int(11) NOT NULL AUTO_INCREMENT, `mes` varchar(30) NOT NULL, `ingreso` double NOT NULL, `imes` double NOT NULL, `iacum` double NOT NULL, `iext` double NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=11 ; -- -- Volcar la base de datos para la tabla `imps` -- INSERT INTO `imps` (`id`, `mes`, `ingreso`, `imes`, `iacum`, `iext`) VALUES (1, 'enero', 2000, 120, 100, 450), (2, 'febrero', 2005, 200, 100, 300), (3, 'marzo', 2000, 300, 100, 230), (6, 'abril', 2000, 600, 100, 200), (7, 'mayo', 2000, 2800, 300, 600), (8, 'Junio', 3000, 200, 300, 100), (9, 'julio', 2000, 300, 20, 100), (10, 'setiembre', 2000, 0, 0, 0);
true
8871f9b414f95bcf287288fb55c78d470633881d
SQL
omar0928/sistemaElectoral
/elecciones.sql
UTF-8
5,936
3.078125
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 5.0.2 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Generation Time: Apr 29, 2021 at 05:02 AM -- Server version: 10.4.11-MariaDB -- PHP Version: 7.4.5 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; START TRANSACTION; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8mb4 */; -- -- Database: `elecciones` -- CREATE DATABASE IF NOT EXISTS `elecciones` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci; USE `elecciones`; -- -------------------------------------------------------- -- -- Table structure for table `candidatos` -- CREATE TABLE `candidatos` ( `id` int(11) NOT NULL, `nombre` varchar(150) NOT NULL, `estado` tinyint(1) NOT NULL, `apellido` varchar(150) NOT NULL, `puesto` varchar(100) NOT NULL, `partido` varchar(100) NOT NULL, `foto` blob NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `candidatos` -- INSERT INTO `candidatos` (`id`, `nombre`, `estado`, `apellido`, `puesto`, `partido`, `foto`) VALUES (1, 'Roger ', 0, 'Rosario', '5', '4', 0x4172726179), (3, 'Roger ', 0, 'as', '1', '4', 0x332e706e67), (4, 'Roger ', 0, 'sdaasa', '1', '4', 0x342e706e67); -- -------------------------------------------------------- -- -- Table structure for table `ciudadanos` -- CREATE TABLE `ciudadanos` ( `id` int(11) NOT NULL, `documento` varchar(150) NOT NULL, `nombre` varchar(150) NOT NULL, `estado` tinyint(1) NOT NULL, `apellido` varchar(150) NOT NULL, `email` varchar(100) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `ciudadanos` -- INSERT INTO `ciudadanos` (`id`, `documento`, `nombre`, `estado`, `apellido`, `email`) VALUES (1, '40200685598', 'Roger ', 0, 'Rosario', 'roger_asn01@hotmail.com'), (3, '12345', 'Manuel', 0, 'Rodriguez', 'manuielr@gmail.com'); -- -------------------------------------------------------- -- -- Table structure for table `elecciones` -- CREATE TABLE `elecciones` ( `id` int(11) NOT NULL, `nombre` varchar(150) NOT NULL, `fecha` date NOT NULL, `estado` tinyint(1) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `elecciones` -- INSERT INTO `elecciones` (`id`, `nombre`, `fecha`, `estado`) VALUES (1, 'Elecion1', '2021-04-28', 0), (2, 'Elecion1', '2021-04-28', 0), (3, 'Elecion1', '2021-04-28', 0), (4, 'Elecion1', '2021-04-28', 0), (5, 'Elecion1', '2021-04-29', 0); -- -------------------------------------------------------- -- -- Table structure for table `partidos` -- CREATE TABLE `partidos` ( `id` int(11) NOT NULL, `nombre` varchar(150) NOT NULL, `descripcion` varchar(200) NOT NULL, `estado` tinyint(1) NOT NULL, `logo` blob NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `partidos` -- INSERT INTO `partidos` (`id`, `nombre`, `descripcion`, `estado`, `logo`) VALUES (4, 'PLD', 'PLD', 0, 0x4172726179), (5, 'PRD', 'PRD', 0, 0x4172726179), (19, 'PRSC', 'PRCS', 0, 0x4172726179), (24, 'VERDE', 'VERDE', 0, 0x4172726179), (34, 'AZUL', 'AZUL', 0, 0x4172726179), (35, 'Rojo', 'Rojo', 0, 0x4172726179); -- -------------------------------------------------------- -- -- Table structure for table `puestos` -- CREATE TABLE `puestos` ( `id` int(11) NOT NULL, `nombre` varchar(150) NOT NULL, `descripcion` varchar(200) NOT NULL, `estado` tinyint(1) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `puestos` -- INSERT INTO `puestos` (`id`, `nombre`, `descripcion`, `estado`) VALUES (1, 'Diputado', 'Diputado', 0), (3, 'Alcalde', 'Alcalde', 0), (4, 'Regidor', 'Regidor', 0), (5, 'Senador', 'Senador', 0), (7, 'Presidente', 'Presidente', 0), (8, 'Presi1', 'Presi1', 0); -- -------------------------------------------------------- -- -- Table structure for table `usuarios` -- CREATE TABLE `usuarios` ( `id` int(11) NOT NULL, `nombre` varchar(150) NOT NULL, `contraseña` varchar(150) NOT NULL, `estado` tinyint(1) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `usuarios` -- INSERT INTO `usuarios` (`id`, `nombre`, `contraseña`, `estado`) VALUES (1, 'Roger', '123', 0); -- -- Indexes for dumped tables -- -- -- Indexes for table `candidatos` -- ALTER TABLE `candidatos` ADD PRIMARY KEY (`id`); -- -- Indexes for table `ciudadanos` -- ALTER TABLE `ciudadanos` ADD PRIMARY KEY (`id`); -- -- Indexes for table `elecciones` -- ALTER TABLE `elecciones` ADD PRIMARY KEY (`id`); -- -- Indexes for table `partidos` -- ALTER TABLE `partidos` ADD PRIMARY KEY (`id`); -- -- Indexes for table `puestos` -- ALTER TABLE `puestos` ADD PRIMARY KEY (`id`); -- -- Indexes for table `usuarios` -- ALTER TABLE `usuarios` ADD PRIMARY KEY (`id`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `candidatos` -- ALTER TABLE `candidatos` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7; -- -- AUTO_INCREMENT for table `ciudadanos` -- ALTER TABLE `ciudadanos` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; -- -- AUTO_INCREMENT for table `elecciones` -- ALTER TABLE `elecciones` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6; -- -- AUTO_INCREMENT for table `partidos` -- ALTER TABLE `partidos` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=37; -- -- AUTO_INCREMENT for table `puestos` -- ALTER TABLE `puestos` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9; -- -- AUTO_INCREMENT for table `usuarios` -- ALTER TABLE `usuarios` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; COMMIT; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
true
3bde050535578ba098ff960d871f1c680c651d33
SQL
xRockBoyx/PersonalProject
/Untitled.sql
UTF-8
6,911
3.03125
3
[]
no_license
-- MySQL dump 10.13 Distrib 8.0.12, for macos10.13 (x86_64) -- -- Host: 127.0.0.1 Database: firstproject -- ------------------------------------------------------ -- Server version 8.0.12 /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; SET NAMES utf8 ; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -- -- Table structure for table `migrations` -- DROP TABLE IF EXISTS `migrations`; /*!40101 SET @saved_cs_client = @@character_set_client */; SET character_set_client = utf8mb4 ; CREATE TABLE `migrations` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `migration` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `batch` int(11) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `migrations` -- LOCK TABLES `migrations` WRITE; /*!40000 ALTER TABLE `migrations` DISABLE KEYS */; INSERT INTO `migrations` VALUES (1,'2014_10_12_000000_create_users_table',1),(2,'2014_10_12_100000_create_password_resets_table',1),(3,'2019_08_17_001205_create_news_table',1); /*!40000 ALTER TABLE `migrations` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `news` -- DROP TABLE IF EXISTS `news`; /*!40101 SET @saved_cs_client = @@character_set_client */; SET character_set_client = utf8mb4 ; CREATE TABLE `news` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `title` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `description` text COLLATE utf8mb4_unicode_ci NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `news` -- LOCK TABLES `news` WRITE; /*!40000 ALTER TABLE `news` DISABLE KEYS */; INSERT INTO `news` VALUES (1,'最新消息','這是一則勁爆的消息',NULL,NULL),(2,'最新消息','這是一則勁爆的消息',NULL,NULL),(3,'最新消息asdfasdf','這是一則勁爆的消息asdfasdfsadf',NULL,'2019-08-23 07:10:54'),(4,'Test','description','2019-08-18 15:40:59','2019-08-18 15:40:59'); /*!40000 ALTER TABLE `news` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `password_resets` -- DROP TABLE IF EXISTS `password_resets`; /*!40101 SET @saved_cs_client = @@character_set_client */; SET character_set_client = utf8mb4 ; CREATE TABLE `password_resets` ( `email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `token` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `created_at` timestamp NULL DEFAULT NULL, KEY `password_resets_email_index` (`email`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `password_resets` -- LOCK TABLES `password_resets` WRITE; /*!40000 ALTER TABLE `password_resets` DISABLE KEYS */; /*!40000 ALTER TABLE `password_resets` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `records` -- DROP TABLE IF EXISTS `records`; /*!40101 SET @saved_cs_client = @@character_set_client */; SET character_set_client = utf8mb4 ; CREATE TABLE `records` ( `id` int(11) NOT NULL AUTO_INCREMENT, `rstu_id` char(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `time_stamp` char(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`), KEY `rstu_id` (`rstu_id`), CONSTRAINT `records_ibfk_1` FOREIGN KEY (`rstu_id`) REFERENCES `users` (`stu_id`) ) ENGINE=InnoDB AUTO_INCREMENT=18 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `records` -- LOCK TABLES `records` WRITE; /*!40000 ALTER TABLE `records` DISABLE KEYS */; INSERT INTO `records` VALUES (1,'D0683215','8,28'),(2,'D0683215','8,28'),(3,'D0683215','8,28'),(4,'D0683215','8,28'),(13,'D0711111','19,09,02'),(14,'D0711111','19,09,02'),(15,'D0711111','19,09,02'),(16,'D0711111','19,09,02'),(17,'D0711111','19,09,02'); /*!40000 ALTER TABLE `records` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `users` -- DROP TABLE IF EXISTS `users`; /*!40101 SET @saved_cs_client = @@character_set_client */; SET character_set_client = utf8mb4 ; CREATE TABLE `users` ( `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `email_verified_at` timestamp NULL DEFAULT NULL, `password` varchar(255) 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, `priority` int(11) DEFAULT NULL, `stu_class` char(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `stu_id` char(255) COLLATE utf8mb4_unicode_ci NOT NULL, `stu_name` char(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, PRIMARY KEY (`stu_id`), UNIQUE KEY `users_email_unique` (`email`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `users` -- LOCK TABLES `users` WRITE; /*!40000 ALTER TABLE `users` DISABLE KEYS */; INSERT INTO `users` VALUES ('xRockBoyx','kp3344567@gmail.com',NULL,'$2y$10$eOaN/T84G.hSpRZKEfU0teCvAJq5Q.9F6qRiFXnGCeKw4Rtf49Bxy','fUMrQAkjA0iBwIy2Pwjqj5aw3gy2XAMeNc5sOHNuiIITaYuiAUL1DHE29ZBO','2019-08-18 10:25:27','2019-08-18 10:25:27',1,'資訊三乙','D0683215','黃威愷'),('Student','123@123123',NULL,'$2y$10$japwedW.7iK8sHtyRqh3Dul/zMSz0wjBuLnXl6wswo9.3MKgYnwte',NULL,'2019-09-01 12:04:37','2019-09-01 12:04:37',2,'資訊一乙','D0711111','黃曉明'),('qwewefwef','432@123123',NULL,'$2y$10$qPtFKQ8eix95At78e65jaOHvQWW8nnDJebEd0hPjYE1Yb9jfl/bkO',NULL,'2019-09-01 12:15:45','2019-09-01 12:15:45',2,'sferf','efvwe','黃阿明'); /*!40000 ALTER TABLE `users` ENABLE KEYS */; UNLOCK TABLES; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; -- Dump completed on 2019-09-09 11:15:12
true
09c9e08b82abb82849a4ec3f799c7af489f75b16
SQL
kozakjefferson/bigquery-etl
/bigquery_etl/glam/templates/clients_histogram_aggregates_v1.udf.sql
UTF-8
734
2.796875
3
[]
no_license
{# Accepts: metric_attributes #} CREATE TEMP FUNCTION udf_merged_user_data(aggs ANY TYPE) RETURNS ARRAY< STRUCT< latest_version INT64, metric STRING, metric_type STRING, key STRING, agg_type STRING, value ARRAY<STRUCT<key STRING, value INT64>> > > AS ( ( WITH unnested AS ( SELECT * FROM UNNEST(aggs) ), aggregated_data AS ( SELECT AS STRUCT {{ metric_attributes }}, `moz-fx-data-shared-prod`.udf.map_sum(ARRAY_CONCAT_AGG(value)) AS value FROM unnested GROUP BY latest_version, {{ metric_attributes }} ) SELECT ARRAY_AGG(({{ metric_attributes }}, value)) FROM aggregated_data ) );
true
abcb4a09bfdc37c515ff0a23063b3fb97d6d3ba7
SQL
faierbol/syncano-platform
/apps/data/sql/class.sql
UTF-8
302
2.703125
3
[]
no_license
CREATE INDEX class_name_like ON data_klass USING BTREE (name varchar_pattern_ops); CREATE INDEX klass_acl_users ON data_klass USING GIN (_users); CREATE INDEX klass_acl_groups ON data_klass USING GIN (_groups); CREATE INDEX klass_acl_public ON data_klass USING BTREE (_public) WHERE _public = true;
true
c82f2ffa31200671381f2fafd13714459875652c
SQL
hoangphand/dana-weed-stocks
/alter_db.sql
UTF-8
2,444
3.78125
4
[]
no_license
CREATE TABLE symbol_prices.`Earliest_latest` ( `earliest_5start` int(11) DEFAULT NULL, `latest_5start` int(11) DEFAULT NULL, `latest_5start_as_string` datetime DEFAULT NULL, `earliest_5start_as_string` datetime DEFAULT NULL ); CREATE TABLE symbol_prices.`Five_mins` ( `id` int(11) NOT NULL AUTO_INCREMENT, `five_min_start` int(11) DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `five_min_start` (`five_min_start`) ); CREATE TABLE symbol_prices.`Symbol` ( `id` int(11) NOT NULL AUTO_INCREMENT, `symbol` varchar(50) DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `symbol` (`symbol`) ); CREATE TABLE symbol_prices.`Symbol_five_mins` ( `symbol_id` int(11) NOT NULL, `five_min_start_id` int(11) NOT NULL, `open` double DEFAULT NULL, `high` double DEFAULT NULL, `low` double DEFAULT NULL, `close` double DEFAULT NULL, `volume` int(11) DEFAULT NULL, PRIMARY KEY (`symbol_id`,`five_min_start_id`) ); LOAD DATA INFILE '/var/lib/mysql-files/earliest_latest.csv' INTO TABLE symbol_prices.Earliest_latest FIELDS TERMINATED BY ';' ENCLOSED BY '"' LINES TERMINATED BY '\n' IGNORE 1 ROWS; LOAD DATA INFILE '/var/lib/mysql-files/five_mins.csv' INTO TABLE symbol_prices.Five_mins FIELDS TERMINATED BY ';' ENCLOSED BY '"' LINES TERMINATED BY '\n' IGNORE 1 ROWS; LOAD DATA INFILE '/var/lib/mysql-files/symbol.csv' INTO TABLE symbol_prices.Symbol FIELDS TERMINATED BY ';' ENCLOSED BY '"' LINES TERMINATED BY '\n' IGNORE 1 ROWS; LOAD DATA INFILE '/var/lib/mysql-files/symbol_five_mins.csv' INTO TABLE symbol_prices.Symbol_five_mins FIELDS TERMINATED BY ';' ENCLOSED BY '"' LINES TERMINATED BY '\n' IGNORE 1 ROWS; -- ADD NEW COLUMN TO STORE TIMESTAMP alter table symbol_prices.Symbol_five_mins add column time_stamp int after symbol_id; -- INSERT VALUES INTO TIMESTAMP COLUMN update symbol_prices.Symbol_five_mins join symbol_prices.Five_mins on symbol_prices.Symbol_five_mins.five_min_start_id = symbol_prices.Five_mins.id set symbol_prices.Symbol_five_mins.time_stamp=symbol_prices.Five_mins.five_min_start where symbol_prices.Symbol_five_mins.five_min_start_id = symbol_prices.Five_mins.id; alter table symbol_prices.Symbol_five_mins drop primary key, add primary key(symbol_id, time_stamp); alter table symbol_prices.Symbol_five_mins drop column five_min_start_id; update symbol_prices.Symbol_five_mins set symbol_prices.Symbol_five_mins.symbol_id = 9 where symbol_prices.Symbol_five_mins.symbol_id = 1403;
true
7202165f9b82287073923025b9b55e54abe6c1c9
SQL
zoomczc/MySQL
/exercise/exer2.sql
UTF-8
1,606
4.65625
5
[]
no_license
-- 查询和zlotkey相同部门id的员工姓名和工资 SELECT last_name, salary FROM employees WHERE department_id = ( SELECT department_id FROM employees WHERE last_name = 'zlotkey' ); -- 查询工资比平均工资高的员工的员工号,姓名和工资 SELECT last_name, employee_id, salary FROM employees WHERE salary > ( SELECT avg(salary) FROM employees ); -- 查询各部门中工资比本部门平均工资高的员工的员工号,姓名和工资 SELECT employee_id, last_name, salary FROM employees e JOIN ( SELECT avg(salary) avg_salary, department_id FROM employees GROUP BY department_id ) d ON e.department_id = d.department_id WHERE e.salary > d.avg_salary; -- 查询姓名中包含字母u的员工在相同部门的员工的员工号和姓名 SELECT employee_id, last_name FROM employees WHERE department_id IN( SELECT DISTINCT department_id FROM employees WHERE last_name LIKE '%u%' ); -- 查询在部门的location_id为1700的部门工作的员工和员工号 SELECT last_name, employee_id FROM employees e WHERE department_id = ANY( SELECT DISTINCT department_id FROM departments WHERE location_id = 1700 ); -- 查询管理者是king的员工姓名和工资 SELECT last_name, salary FROM employees WHERE manager_id IN( SELECT employee_id FROM employees WHERE last_name = 'k_ing' ); -- 查询工资最高的员工姓名,要求first_name和last_name显示为一列, 列名为姓 名 SELECT concat(first_name, ' ', last_name) from employees where salary = ( select max(salary) from employees );
true
69848ba497c75de72a838d4923fd0f139dd09f0a
SQL
Sunn-git/practice
/CodeSignal/src/Arcade_Databases_MySQL/D_10_mischievousNephews.sql
UTF-8
1,134
4.3125
4
[]
no_license
/* 날짜, 이름, 제목이 MISCHIEF 테이블에 주어진다. 요일(월요일 0 부터 일요일 6 까지), 날짜, 이름, 제목을 출력하되 이름 (Huey, Dewey, Louie 순), 날짜, 제목 사전순으로 정렬하기. */ SELECT WEEKDAY(MISCHIEF_DATE) AS WEEKDAY, MISCHIEF_DATE, AUTHOR, TITLE FROM MISCHIEF ORDER BY WEEKDAY, FIELD(AUTHOR, 'Huey', 'Dewey', 'Louie'), MISCHIEF_DATE, TITLE; -- ================================================================== -- kitcat's solution SELECT WEEKDAY(mischief.`mischief_date`) AS `weekday`, mischief.* FROM mischief ORDER BY `weekday` ASC, FIELD(mischief.`author`, 'Huey', 'Dewey', 'Louie'), mischief.`mischief_date`, mischief.`title` ASC; -- ================================================================== /* MySQL에서 date타입 요일 확인하기 : DAYOFWEEK('2021-02-11'), 정수(일 1 ~ 토 7) WEEKDAY(date), 정수 (월 0 ~ 일 6) DAYNAME(date), 영어 요일 My SQL 날짜 관련 함수 참고 : https://jang8584.tistory.com/7 */ -- ==================================================================
true
0d1bb49659a51d13e47882e032fdacf7ec919e6d
SQL
plamen911/softuni-db-fundamentals
/DatabasesBasics/_02DataDefinitionAndDataTypesLab/_02CreateTables.sql
UTF-8
393
2.6875
3
[]
no_license
create table if not exists categories ( id int auto_increment primary key, name varchar(50) not null ) ; create table if not exists employees ( id int auto_increment primary key, first_name varchar(50) null, last_name varchar(50) null ) ; create table if not exists products ( id int auto_increment primary key, name varchar(50) not null, category_id int null ) ;
true
6d4530356e4cf35df0da0ee3ae3994237ce3335f
SQL
ChrisMusson/Problem-Solving
/HackerRank/SQL/0-Easy/37-african-cities.sql
UTF-8
194
3.84375
4
[]
no_license
-- https://www.hackerrank.com/challenges/african-cities/problem SELECT city.name FROM city LEFT JOIN country ON country.code = city.countrycode WHERE country.continent = 'Africa'
true
b90ad6115941c3368d80fe4ffac3c08475cd298a
SQL
KEY60228/tatsujin_sql
/3-2.sql
UTF-8
576
4.03125
4
[]
no_license
-- 問題 -- 3-2に同じ -- 回答 WITH selected AS ( SELECT *, RANK() OVER (ORDER BY price DESC) AS rank ) DELETE FROM Products P1 WHERE P1.name = P2.name AND P1.price = P2.price AND -- ... give up -- 解答 CREATE TABLE Products_NoRedundant AS SELECT ROW_NUMBER() OVER(PARTITION BY name, price ORDER BY name) AS row_num, name, price FROM Products; DELETE FROM Products_NoRedundant WHERE row_num > 1; -- 以下はRDBMS依存 DELETE FROM ( SELECT ROW_NUMBER() OVER(PARTITION BY name, price ORDER BY name) AS row_num FROM Products ) WHERE row_num > 1;
true
04bf06b71ff640f2c29a81913779fcdc43c761a6
SQL
altamira/visualstudio
/Sistema de Informação Altamira/EGISSQL.Database/dbo/Stored Procedures/Procs2/pr_manutencao_nota_entrada.sql
UTF-8
3,632
2.953125
3
[]
no_license
 CREATE PROCEDURE pr_manutencao_nota_entrada @dt_inicial datetime, @dt_final datetime as SELECT ne.cd_nota_entrada, ne.dt_receb_nota_entrada, f.nm_fantasia_fornecedor, ne.cd_rem, dp.nm_destinacao_produto, opf.cd_mascara_operacao, ner.cd_tributacao, opf.cd_lancamento_padrao, ne.vl_total_nota_entrada, ne.vl_icms_nota_entrada, ne.vl_ipi_nota_entrada, nei.cd_item_nota_entrada, nei.cd_classificacao_fiscal, nei.nm_produto_nota_entrada, (SELECT TOP 1 pc.cd_mascara_plano_compra FROM Plano_Compra pc WHERE nei.cd_plano_compra = pc.cd_plano_compra) as cd_mascara_plano_compra, isnull((select sum(x.vl_bicms_reg_nota_entrada) from Nota_Entrada_Item_Registro x where x.cd_nota_entrada = ne.cd_nota_entrada), 0) as 'BaseCalculoICM', isnull((select sum(x.vl_bipi_reg_nota_entrada) from Nota_Entrada_Item_Registro x where x.cd_nota_entrada = ne.cd_nota_entrada), 0) as 'BaseCalculoIPI', isnull((select sum(x.pc_icms_reg_nota_entrada) from Nota_Entrada_Item_Registro x where x.cd_nota_entrada = ne.cd_nota_entrada), 0) as 'AliquotaICM', isnull((select sum(x.pc_ipi_reg_nota_entrada) from Nota_Entrada_Item_Registro x where x.cd_nota_entrada = ne.cd_nota_entrada), 0) as 'AliquotaIPI', isnull((select sum(x.vl_icms_reg_nota_entrada) from Nota_Entrada_Item_Registro x where x.cd_nota_entrada = ne.cd_nota_entrada), 0) as 'ImpostoDevidoICM', isnull((select sum(x.vl_ipi_reg_nota_entrada) from Nota_Entrada_Item_Registro x where x.cd_nota_entrada = ne.cd_nota_entrada), 0) as 'ImpostoDevidoIPI', isnull((select sum(x.vl_icmsisen_reg_nota_entr) from Nota_Entrada_Item_Registro x where x.cd_nota_entrada = ne.cd_nota_entrada), 0) as 'IsentasICM', isnull((select sum(x.vl_ipiisen_reg_nota_entr) from Nota_Entrada_Item_Registro x where x.cd_nota_entrada = ne.cd_nota_entrada), 0) as 'IsentasIPI', isnull((select sum(x.vl_icmsoutr_reg_nota_entr) from Nota_Entrada_Item_Registro x where x.cd_nota_entrada = ne.cd_nota_entrada), 0) as 'OutrasICM', isnull((select sum(x.vl_ipioutr_reg_nota_entr) from Nota_Entrada_Item_Registro x where x.cd_nota_entrada = ne.cd_nota_entrada), 0) as 'OutrasIPI', isnull((select sum(x.vl_icmsobs_reg_nota_entr) from Nota_Entrada_Item_Registro x where x.cd_nota_entrada = ne.cd_nota_entrada), 0) as 'ObservacaoICM', isnull((select sum(x.vl_ipiobs_reg_nota_entr) from Nota_Entrada_Item_Registro x where x.cd_nota_entrada = ne.cd_nota_entrada), 0) as 'ObservacaoIPI' FROM Nota_Entrada ne LEFT OUTER JOIN Fornecedor f ON ne.cd_fornecedor = f.cd_fornecedor LEFT OUTER JOIN Destinacao_Produto dp ON ne.cd_destinacao_produto = dp.cd_destinacao_produto LEFT OUTER JOIN Nota_Entrada_Item nei ON ne.cd_nota_entrada = nei.cd_nota_entrada LEFT OUTER JOIN Operacao_Fiscal opf ON ne.cd_operacao_fiscal = opf.cd_operacao_fiscal LEFT OUTER JOIN Nota_Entrada_Registro ner ON ne.cd_nota_entrada = ner.cd_nota_entrada WHERE nei.cd_classificacao_fiscal IS NULL AND ne.dt_receb_nota_entrada BETWEEN @dt_inicial AND @dt_final GROUP BY ne.cd_nota_entrada, ne.dt_receb_nota_entrada, f.nm_fantasia_fornecedor, ne.cd_rem, dp.nm_destinacao_produto, opf.cd_mascara_operacao, ner.cd_tributacao, opf.cd_lancamento_padrao, ne.vl_total_nota_entrada, ne.vl_icms_nota_entrada, ne.vl_ipi_nota_entrada, nei.cd_item_nota_entrada, nei.cd_classificacao_fiscal, nei.nm_produto_nota_entrada, nei.cd_plano_compra ORDER BY ne.cd_nota_entrada, nei.cd_item_nota_entrada
true
1ef8d6cde88ddf6d8d7f3762717147f7c2de5034
SQL
saurabhdjha/Spring-Boot-Web-App-With-Thymeleaf
/SpringBootThymleafCRUD/src/main/resources/transcript.sql
UTF-8
848
2.65625
3
[]
no_license
drop database if exists demospringthymleaf; create database demospringthymleaf; use demospringthymleaf; create table employee( employee_id int AUTO_INCREMENT PRIMARY KEY, first_name varchar(20), last_name varchar(20), email varchar(30) ); insert into employee(employee_id,first_name,last_name,email) values (1,'Saurabh','Jha','sdj131998@gmail.com'); insert into employee(employee_id,first_name,last_name,email) values (2,'Ankit','Kumar','aKumar@yahoo.com'); insert into employee(employee_id,first_name,last_name,email) values (3,'Rishu','Pal','rishuLion@gmail.com'); insert into employee(employee_id,first_name,last_name,email) values (4,'Gouresh','Chauhan','gourseh@outlook.com'); insert into employee(employee_id,first_name,last_name,email) values (5,'Bikramjeet','Singh','biki@gmail.com'); insert into employee(employee_id,first_name,last_name,email) values (6,'Rohan','Agarwal','agarwal@yahoo.com');
true
441b4aa528d34345d4dd8a08859bda4efa72f780
SQL
ariel68/aplicacao_ADS102
/geral/bd_uniasselvi.sql
UTF-8
7,038
2.96875
3
[ "MIT" ]
permissive
-- phpMyAdmin SQL Dump -- version 4.8.3 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1:3306 -- Generation Time: 13-Jan-2020 às 03:18 -- Versão do servidor: 5.7.23 -- versão do PHP: 7.2.10 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET AUTOCOMMIT = 0; START TRANSACTION; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8mb4 */; -- -- Database: `bd_uniasselvi` -- -- -------------------------------------------------------- -- -- Estrutura da tabela `clientes` -- DROP TABLE IF EXISTS `clientes`; CREATE TABLE IF NOT EXISTS `clientes` ( `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, `NomeCliente` varchar(100) COLLATE utf8_unicode_ci NOT NULL, `CPF` char(11) COLLATE utf8_unicode_ci NOT NULL, `Email` char(10) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=10 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -- Extraindo dados da tabela `clientes` -- INSERT INTO `clientes` (`id`, `NomeCliente`, `CPF`, `Email`) VALUES (4, 'Anderson Pires', '02114558595', 'aa@aa'), (2, 'Isadora Sehnem da Costa', '11412144545', 'isa@isa'), (3, 'João da Silva', '25545878885', NULL), (5, 'Jean Carlos', '21225223658', NULL), (6, 'Bianca Souza', '24558778547', 'bia@123'), (7, 'Zeus', '32325665458', NULL), (8, 'Ana', '02125445636', 'aa@asas'), (9, 'aaaa', '09036565858', NULL); -- -------------------------------------------------------- -- -- Estrutura da tabela `failed_jobs` -- DROP TABLE IF EXISTS `failed_jobs`; CREATE TABLE IF NOT EXISTS `failed_jobs` ( `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, `connection` text COLLATE utf8_unicode_ci NOT NULL, `queue` text COLLATE utf8_unicode_ci NOT NULL, `payload` longtext COLLATE utf8_unicode_ci NOT NULL, `exception` longtext COLLATE utf8_unicode_ci NOT NULL, `failed_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -------------------------------------------------------- -- -- Estrutura da tabela `migrations` -- DROP TABLE IF EXISTS `migrations`; CREATE TABLE IF NOT EXISTS `migrations` ( `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, `migration` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `batch` int(11) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=20 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -- Extraindo dados da tabela `migrations` -- INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (1, '2014_10_12_000000_create_users_table', 1), (2, '2014_10_12_100000_create_password_resets_table', 1), (3, '2019_08_19_000000_create_failed_jobs_table', 1), (16, '2020_01_10_141523_create_clientes_table', 2), (17, '2020_01_10_152114_create_produtos_table', 2), (18, '2020_01_10_153007_create_pedidos_table', 2), (19, '2020_01_10_154102_pedidos_produtos_table', 2); -- -------------------------------------------------------- -- -- Estrutura da tabela `password_resets` -- DROP TABLE IF EXISTS `password_resets`; CREATE TABLE IF NOT EXISTS `password_resets` ( `email` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `token` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `created_at` timestamp NULL DEFAULT NULL, KEY `password_resets_email_index` (`email`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -------------------------------------------------------- -- -- Estrutura da tabela `pedidos` -- DROP TABLE IF EXISTS `pedidos`; CREATE TABLE IF NOT EXISTS `pedidos` ( `NumeroPedido` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, `DtPedido` datetime NOT NULL, `cliente_id` int(11) NOT NULL, `status` enum('ABERTO','PAGO','CANCELADO','') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'ABERTO', PRIMARY KEY (`NumeroPedido`), KEY `pedidos_clienteid_foreign` (`cliente_id`) ) ENGINE=MyISAM AUTO_INCREMENT=39 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -- Extraindo dados da tabela `pedidos` -- INSERT INTO `pedidos` (`NumeroPedido`, `DtPedido`, `cliente_id`, `status`) VALUES (38, '2020-01-13 02:58:55', 6, 'ABERTO'), (36, '2020-01-13 01:09:28', 4, 'ABERTO'); -- -------------------------------------------------------- -- -- Estrutura da tabela `pedido_produto` -- DROP TABLE IF EXISTS `pedido_produto`; CREATE TABLE IF NOT EXISTS `pedido_produto` ( `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, `Quantidade` int(11) NOT NULL, `pedido_NumeroPedido` int(11) NOT NULL, `produto_id` int(11) NOT NULL, PRIMARY KEY (`id`), KEY `pedidos_produtos_pedidoid_foreign` (`pedido_NumeroPedido`), KEY `pedidos_produtos_produtoid_foreign` (`produto_id`) ) ENGINE=MyISAM AUTO_INCREMENT=78 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -- Extraindo dados da tabela `pedido_produto` -- INSERT INTO `pedido_produto` (`id`, `Quantidade`, `pedido_NumeroPedido`, `produto_id`) VALUES (77, 5, 38, 6), (75, 4, 36, 6), (74, 5, 36, 5); -- -------------------------------------------------------- -- -- Estrutura da tabela `produtos` -- DROP TABLE IF EXISTS `produtos`; CREATE TABLE IF NOT EXISTS `produtos` ( `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, `NomeProduto` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, `CodBarras` varchar(20) COLLATE utf8_unicode_ci NOT NULL, `ValorUnitario` decimal(15,4) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=8 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -- Extraindo dados da tabela `produtos` -- INSERT INTO `produtos` (`id`, `NomeProduto`, `CodBarras`, `ValorUnitario`) VALUES (6, 'Coca-Cola', '121215121', '8.0000'), (5, 'Água mineral', '1245414', '2.5000'), (7, 'Chocolate Barra', '54548745487845', '4.3000'); -- -------------------------------------------------------- -- -- Estrutura da tabela `users` -- DROP TABLE IF EXISTS `users`; CREATE TABLE IF NOT EXISTS `users` ( `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `email` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `email_verified_at` timestamp NULL DEFAULT NULL, `password` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `remember_token` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `users_email_unique` (`email`) ) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -- Extraindo dados da tabela `users` -- INSERT INTO `users` (`id`, `name`, `email`, `email_verified_at`, `password`, `remember_token`, `created_at`, `updated_at`) VALUES (1, 'Admin', 'admin@admin', NULL, '$2y$10$QHKOXPDlCDZ4K3BuNgkDv.aB17.M0Gf/rdFCmM6kKWkmAdbrxFbmq', NULL, '2020-01-10 15:51:14', '2020-01-10 15:51: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
47875885b1c45b4e25e862b0dab0b9057c557d0f
SQL
mrisyad15/project_test
/db_project_test.sql
UTF-8
1,697
2.96875
3
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
-- phpMyAdmin SQL Dump -- version 4.9.2 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Generation Time: Apr 27, 2020 at 05:45 AM -- Server version: 10.4.11-MariaDB -- PHP Version: 7.2.26 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET AUTOCOMMIT = 0; START TRANSACTION; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8mb4 */; -- -- Database: `db_project_test` -- -- -------------------------------------------------------- -- -- Table structure for table `tb_test` -- CREATE TABLE `tb_test` ( `id_test` int(11) NOT NULL, `kode_additional` varchar(100) NOT NULL, `nama_produk` varchar(100) NOT NULL, `harga_pokok` varchar(50) NOT NULL, `harga_jual` varchar(50) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `tb_test` -- INSERT INTO `tb_test` (`id_test`, `kode_additional`, `nama_produk`, `harga_pokok`, `harga_jual`) VALUES (12, 'TB_212343', 'Boneka Berbie', 'Rp.50.000', 'Rp.75.000'), (13, 'TB_212343', 'Pita', 'Rp.2000', 'Rp.5.000'); -- -- Indexes for dumped tables -- -- -- Indexes for table `tb_test` -- ALTER TABLE `tb_test` ADD PRIMARY KEY (`id_test`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `tb_test` -- ALTER TABLE `tb_test` MODIFY `id_test` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=15; 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
07976a14f953a557cd79b4ae3998abf507160f26
SQL
nessieee/SQL-----advanced-sql-mysql-for-analytics-business-intelligence
/Final project_ex4.sql
UTF-8
1,577
3.984375
4
[]
no_license
USE mavenfuzzyfactory; SELECT Year(website_sessions.created_at) AS year, quarter(website_sessions.created_at) AS quarter, COUNT(DISTINCT CASE WHEN utm_source = 'gsearch' AND utm_campaign = 'nonbrand' THEN orders.order_id ELSE NULL END) / COUNT(DISTINCT CASE WHEN utm_source = 'gsearch' AND utm_campaign = 'nonbrand' THEN website_sessions.website_session_id ELSE NULL END) AS gsearch_nonbrand_CONV_rate, COUNT(DISTINCT CASE WHEN utm_source = 'bsearch' AND utm_campaign = 'nonbrand' THEN orders.order_id ELSE NULL END) / COUNT(DISTINCT CASE WHEN utm_source = 'bsearch' AND utm_campaign = 'nonbrand' THEN website_sessions.website_session_id ELSE NULL END)AS bsearch_nonbrand_CONV_rate, COUNT(DISTINCT CASE WHEN utm_source = 'brand' THEN orders.order_id ELSE NULL END) / COUNT(DISTINCT CASE WHEN utm_source = 'brand' THEN website_sessions.website_session_id ELSE NULL END) AS brand_CONV_rate, COUNT(DISTINCT CASE WHEN utm_source IS NULL AND utm_campaign IS NOT NULL THEN orders.order_id ELSE NULL END) / COUNT(DISTINCT CASE WHEN utm_source IS NULL AND utm_campaign IS NOT NULL THEN website_sessions.website_session_id ELSE NULL END) AS organic_search_CONV_rate, COUNT(DISTINCT CASE WHEN utm_source IS NULL AND utm_campaign IS NULL THEN orders.order_id ELSE NULL END) / COUNT(DISTINCT CASE WHEN utm_source IS NULL AND utm_campaign IS NULL THEN website_sessions.website_session_id ELSE NULL END)AS direct_type_in_CONV_rate FROM website_sessions LEFT JOIN orders ON website_sessions.website_session_id = orders.website_session_id GROUP BY 1,2 ;
true
e1cf55273dd125b7c0a7877620427e02d455dca6
SQL
Ana-Camelia/Librarie
/librarie.sql
UTF-8
21,655
2.640625
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 5.0.4 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Generation Time: Dec 15, 2020 at 12:33 PM -- 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: `librarie` -- -- -------------------------------------------------------- -- -- Table structure for table `achizitie` -- CREATE TABLE `achizitie` ( `nrf` int(11) NOT NULL, `CUI` int(10) NOT NULL DEFAULT 0, `idp` int(11) NOT NULL, `data` date DEFAULT NULL, `ora` time DEFAULT NULL, `cantitate` int(11) NOT NULL, `cost` float DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `achizitie` -- INSERT INTO `achizitie` (`nrf`, `CUI`, `idp`, `data`, `ora`, `cantitate`, `cost`) VALUES (1307241, 10, 18, '1979-02-23', '09:09:28', 5, 1577.24), (1134788, 11, 18, '2007-11-11', '09:12:38', 7, 1820.02), (7340213, 8, 6, '1972-12-10', '13:33:22', 3, 508.32), (9467404, 7, 3, '2008-08-12', '00:03:06', 7, 1837.87), (7691499, 4, 1, '2016-06-30', '03:42:37', 3, 1088.36), (1064473, 13, 2, '1986-02-20', '02:37:34', 6, 1950.49), (5374355, 3, 7, '1974-02-25', '21:06:59', 5, 1387.48), (1981203, 11, 12, '1974-10-02', '09:28:35', 4, 1084.88), (4943059, 11, 9, '1999-07-16', '14:25:34', 5, 365.52), (8454256, 7, 20, '1995-06-14', '22:17:45', 9, 1729.45), (4254039, 20, 6, '2013-04-11', '07:35:54', 6, 919.5), (2998381, 2, 10, '2000-11-22', '03:31:40', 5, 1343.5), (1623367, 9, 4, '2018-03-31', '12:48:01', 8, 1290.08), (3194929, 1, 19, '1986-06-23', '16:40:31', 5, 1203.81), (9660891, 1, 9, '1999-01-07', '10:24:13', 1, 123.8), (5341209, 4, 8, '2016-12-14', '19:39:55', 6, 844.24), (3557335, 11, 8, '2000-12-29', '13:50:00', 4, 904.02), (4035926, 8, 4, '1972-12-01', '17:16:47', 9, 1027.29), (3272251, 10, 2, '2003-02-10', '12:26:47', 2, 1766.7), (8266049, 19, 4, '2001-03-24', '15:39:05', 1, 1708.16), (7921969, 10, 1, '2017-12-10', '23:28:01', 8, 1542.29), (8604087, 11, 20, '2006-06-17', '15:12:11', 8, 1040.7), (9935925, 13, 1, '1978-09-04', '00:29:39', 7, 123.37), (2132385, 8, 19, '1985-10-21', '08:26:52', 3, 534.03), (2863811, 1, 8, '2002-07-01', '13:22:12', 4, 1559.82), (4993306, 5, 2, '1996-05-20', '01:11:05', 9, 909.3), (7309095, 17, 19, '1986-05-04', '18:51:06', 9, 190.38), (4024117, 6, 6, '2003-02-21', '14:10:40', 8, 1449.47), (8983101, 3, 6, '1990-02-03', '17:53:49', 7, 841.86), (2925304, 4, 3, '2013-10-20', '16:32:54', 4, 227.67), (8131466, 10, 5, '1977-01-24', '07:39:36', 4, 1545.67), (8948944, 8, 4, '2020-05-26', '10:13:42', 5, 570.1), (7027150, 20, 6, '1994-07-13', '15:59:01', 3, 1658.15), (1229801, 8, 9, '2011-06-26', '12:57:56', 9, 448.3), (8816305, 7, 18, '1995-04-28', '22:32:57', 7, 473.18), (7645111, 8, 19, '1971-07-08', '08:11:02', 6, 1365.2), (3478981, 19, 16, '1991-10-05', '13:26:41', 8, 1911.62), (3012188, 18, 20, '1986-09-20', '20:54:54', 8, 571.08), (7295219, 3, 3, '1979-04-22', '08:45:24', 5, 305.72), (3270868, 2, 20, '2005-08-06', '02:05:31', 6, 652.98), (1021697, 1, 7, '1971-11-22', '20:36:01', 6, 1917.5), (2351890, 5, 4, '1984-07-23', '09:59:33', 5, 1830.23), (5120671, 13, 8, '2005-06-14', '16:47:29', 4, 1522.08), (1620293, 6, 7, '1993-03-10', '06:21:29', 4, 840.35), (1307241, 10, 18, '1979-02-23', '09:09:28', 5, 1577.24), (1134788, 11, 18, '2007-11-11', '09:12:38', 7, 1820.02), (7340213, 8, 6, '1972-12-10', '13:33:22', 3, 508.32), (9467404, 7, 3, '2008-08-12', '00:03:06', 7, 1837.87), (7691499, 4, 1, '2016-06-30', '03:42:37', 3, 1088.36), (1064473, 13, 2, '1986-02-20', '02:37:34', 6, 1950.49), (5374355, 3, 7, '1974-02-25', '21:06:59', 5, 1387.48), (1981203, 11, 12, '1974-10-02', '09:28:35', 4, 1084.88), (4943059, 11, 9, '1999-07-16', '14:25:34', 5, 365.52), (8454256, 7, 20, '1995-06-14', '22:17:45', 9, 1729.45), (4254039, 20, 6, '2013-04-11', '07:35:54', 6, 919.5), (2998381, 2, 10, '2000-11-22', '03:31:40', 5, 1343.5), (1623367, 9, 4, '2018-03-31', '12:48:01', 8, 1290.08), (3194929, 1, 19, '1986-06-23', '16:40:31', 5, 1203.81), (9660891, 1, 9, '1999-01-07', '10:24:13', 1, 123.8), (5341209, 4, 8, '2016-12-14', '19:39:55', 6, 844.24), (3557335, 11, 8, '2000-12-29', '13:50:00', 4, 904.02), (4035926, 8, 4, '1972-12-01', '17:16:47', 9, 1027.29), (3272251, 10, 2, '2003-02-10', '12:26:47', 2, 1766.7), (8266049, 19, 4, '2001-03-24', '15:39:05', 1, 1708.16), (7921969, 10, 1, '2017-12-10', '23:28:01', 8, 1542.29), (8604087, 11, 20, '2006-06-17', '15:12:11', 8, 1040.7), (9935925, 13, 1, '1978-09-04', '00:29:39', 7, 123.37), (2132385, 8, 19, '1985-10-21', '08:26:52', 3, 534.03), (2863811, 1, 8, '2002-07-01', '13:22:12', 4, 1559.82), (4993306, 5, 2, '1996-05-20', '01:11:05', 9, 909.3), (7309095, 17, 19, '1986-05-04', '18:51:06', 9, 190.38), (4024117, 6, 6, '2003-02-21', '14:10:40', 8, 1449.47), (8983101, 3, 6, '1990-02-03', '17:53:49', 7, 841.86), (2925304, 4, 3, '2013-10-20', '16:32:54', 4, 227.67), (8131466, 10, 5, '1977-01-24', '07:39:36', 4, 1545.67), (8948944, 8, 4, '2020-05-26', '10:13:42', 5, 570.1), (7027150, 20, 6, '1994-07-13', '15:59:01', 3, 1658.15), (1229801, 8, 9, '2011-06-26', '12:57:56', 9, 448.3), (8816305, 7, 18, '1995-04-28', '22:32:57', 7, 473.18), (7645111, 8, 19, '1971-07-08', '08:11:02', 6, 1365.2), (3478981, 19, 16, '1991-10-05', '13:26:41', 8, 1911.62), (3012188, 18, 20, '1986-09-20', '20:54:54', 8, 571.08), (7295219, 3, 3, '1979-04-22', '08:45:24', 5, 305.72), (3270868, 2, 20, '2005-08-06', '02:05:31', 6, 652.98), (1021697, 1, 7, '1971-11-22', '20:36:01', 6, 1917.5), (2351890, 5, 4, '1984-07-23', '09:59:33', 5, 1830.23), (5120671, 13, 8, '2005-06-14', '16:47:29', 4, 1522.08), (1620293, 6, 7, '1993-03-10', '06:21:29', 4, 840.35), (555, 1, 1, '2020-07-14', '21:08:42', 0, 0), (454354, 1, 4, '2020-07-15', '18:10:50', 11, 130), (747, 17, 6, '2020-10-03', '13:00:25', 15, 6000), (747, 17, 6, '2020-10-03', '13:00:25', 15, 6000), (43443, 1, 4, '2020-10-03', '14:29:35', 100, 2500), (43443, 1, 4, '2020-10-03', '14:29:52', 100, 2500), (434437, 1, 4, '2020-10-03', '14:32:57', 10, 500), (434437, 5, 20, '2020-10-03', '14:33:27', 10, 500), (7678, 24, 1, '0000-00-00', NULL, 0, NULL), (1000, 24, 1, '2020-06-15', NULL, 0, NULL), (1111111, 4, 1, '1979-02-23', '10:00:00', 10, 12.34), (2222222, 7, 2, '2020-05-15', '10:00:00', 3, 100), (3333333, 11, 1, '2020-03-15', '10:00:00', 5, 250), (1111112, 4, 1, '1979-02-23', '10:00:00', 10, 12.34), (2222223, 7, 2, '2020-05-15', '10:00:00', 3, 100), (3333334, 11, 1, '2020-03-15', '10:00:00', 5, 250), (1111112, 4, 1, '1979-02-23', '10:35:00', 10, 12.34), (2222223, 7, 2, '2020-05-15', '10:20:00', 3, 100), (3333334, 11, 1, '2020-03-15', '13:30:55', 5, 250); -- -------------------------------------------------------- -- -- Table structure for table `angajat` -- CREATE TABLE `angajat` ( `ida` int(11) NOT NULL, `nume` varchar(20) DEFAULT '0', `prenume` varchar(30) DEFAULT '0', `cnp` char(13) DEFAULT NULL, `admin` char(2) NOT NULL, `Telefon` char(10) DEFAULT NULL, `parola` char(20) NOT NULL, `activ` char(2) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `angajat` -- INSERT INTO `angajat` (`ida`, `nume`, `prenume`, `cnp`, `admin`, `Telefon`, `parola`, `activ`) VALUES (1, 'BejanAna', 'Ana Camelia', '0357465149628', 'Da', '0751515151', 'bac12', 'Da'), (2, 'Pouros', 'Stefanie', '6154185899810', 'Nu', NULL, 'lfn25', 'Da'), (3, 'Macejkovic', 'Adelbert', '5716142479249', 'Nu', NULL, 'dxf34', 'Da'), (4, 'Ondricka', 'Lexie', '7517439828933', 'Nu', NULL, 'kyt58', 'Da'), (5, 'Pacocha', 'Esta', '8400331054409', 'Nu', NULL, 'kwl20', 'Da'), (6, 'Bailey', 'Vada', '0583559520702', 'Nu', NULL, 'krv27', 'Da'), (8, 'Boyer', 'Hyman', '6665680853231', 'Nu', NULL, 'loa35', 'Da'), (9, 'Barrows', 'Tatum', '6793786803744', 'Nu', NULL, 'zhx99', 'Nu'), (10, 'Hansen', 'Maynard', '7905485568322', 'Nu', NULL, 'cxu49', 'Da'), (11, 'Homenick', 'Shanelle', '7866520347657', 'Nu', NULL, 'asb65', 'Da'), (12, 'Brekke', 'Lionel', '4697362899645', 'Nu', NULL, 'phw24', 'Da'), (13, 'Steuber', 'Lura', '6461304324181', 'Da', NULL, 'yah22', 'Nu'), (14, 'Kling', 'Tate', '1020339844398', 'Nu', NULL, 'rli85', 'Da'), (15, 'Koelpin', 'Archibald', '8305387511459', 'Nu', NULL, 'gio08', 'Da'), (16, 'Moore', 'Darron', '7716800414523', 'Nu', NULL, 'gfw97', 'Da'), (17, 'Feest', 'Roger', '8232312008816', 'Nu', NULL, 'kny24', 'Da'), (18, 'Nitzsche', 'Candace', '4707460467689', 'Nu', NULL, 'poa48', 'Da'), (19, 'Nitzsche', 'Isabell', '4749894035368', 'Nu', NULL, 'krx77', 'Da'), (20, 'Hoppe', 'Osbaldo', '8387326677796', 'Nu', NULL, 'len73', 'Da'), (21, 'Ana', 'Camelia', '1234567890123', 'Nu', '1234567890', 'aaa11', 'Da'), (30, 'aaa', 'bbb', '1231231231234', 'Da', '0767277347', 'erge4', 'Nu'), (31, 'aaa', 'bbb', '1231231231235', 'Nu', '0767277348', '34gr', 'Nu'), (32, 'aaa', 'bbb', '1231231231236', 'Nu', '0767277349', 'gre44g', 'Da'), (100, 'Ilie', 'Stefan', '8900998080989', 'Da', '0789898908', 'bloomi', 'Da'), (232, 'Gica', 'Mitica', '1313131313131', 'Nu', '5655665566', 'gicuta', 'Da'), (2233, 'Bejan', 'Teodora', '2032179123321', 'Da', '023698989', 'costache', 'Da'), (4354, 'Georgel', 'Mitel', '3637328327288', 'Da', '1234234434', 'aaabbb', 'Da'), (13242, 'grg', 'reger', '3423', 'Nu', '3244', '433trg', 'Da'), (53534, 'ewfeew', 'wfwefwe', '23131123', 'Nu', '233213131', 'eee22', 'Da'); -- -------------------------------------------------------- -- -- Table structure for table `bon_fiscal` -- CREATE TABLE `bon_fiscal` ( `idb` int(11) NOT NULL, `terminal` char(20) DEFAULT NULL, `ida` int(11) NOT NULL, `data` date DEFAULT NULL, `ora` time DEFAULT NULL, `nr_de_prod` smallint(6) DEFAULT NULL, `pret_total` float DEFAULT NULL, `tip_plata` char(10) DEFAULT NULL, `numerar` float DEFAULT NULL, `rest` float DEFAULT NULL, `card` varchar(20) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `bon_fiscal` -- INSERT INTO `bon_fiscal` (`idb`, `terminal`, `ida`, `data`, `ora`, `nr_de_prod`, `pret_total`, `tip_plata`, `numerar`, `rest`, `card`) VALUES (464, 'term124', 100, '2020-11-26', '03:05:00', 5, 2499.9, 'card', 0, 0, 'REVOLUT'), (465, 'term125', 100, '2020-11-27', '04:05:00', 5, 2499.9, 'card', 0, 0, 'BT'), (35154, 'term123', 100, '2020-11-25', '02:05:00', 5, 2499.9, 'numerar', 2500, 0.1, 'none'), (1123352, '11', 5, '1973-11-26', '12:55:41', 1, NULL, 'numerar', NULL, NULL, NULL), (1297116, '13', 2, '2002-01-11', '14:48:35', 9, NULL, 'numerar', NULL, NULL, NULL), (1386364, '12', 16, '2013-10-04', '13:52:22', 6, NULL, 'card', NULL, NULL, NULL), (1640922, '13', 17, '1980-11-11', '14:24:31', 9, NULL, 'numerar', NULL, NULL, NULL), (1842546, '17', 2, '2013-11-26', '22:59:44', 5, NULL, 'numerar', NULL, NULL, NULL), (1893317, '10', 17, '2015-04-03', '02:15:26', 5, NULL, 'card', NULL, NULL, NULL), (1986967, '16', 2, '1970-10-11', '06:50:43', 5, NULL, 'card', NULL, NULL, NULL), (2014726, '20', 10, '1999-11-07', '02:02:16', 8, NULL, 'numerar', NULL, NULL, NULL), (2039755, '16', 20, '1972-05-03', '17:26:09', 5, NULL, 'card', NULL, NULL, NULL), (2540656, '20', 3, '2006-02-08', '23:26:02', 4, NULL, 'card', NULL, NULL, NULL), (2622144, '15', 4, '2010-08-01', '12:39:14', 8, NULL, 'card', NULL, NULL, NULL), (2673095, '13', 18, '2019-01-23', '20:21:29', 4, NULL, 'numerar', NULL, NULL, NULL), (2694476, '20', 2, '1999-07-12', '15:59:09', 2, NULL, 'numerar', NULL, NULL, NULL), (2807031, '16', 20, '1999-04-26', '02:19:46', 7, NULL, 'numerar', NULL, NULL, NULL), (2836446, '19', 1, '1987-09-12', '11:13:16', 4, NULL, 'card', NULL, NULL, NULL), (3088110, '19', 9, '2017-12-16', '02:52:21', 8, NULL, 'card', NULL, NULL, NULL), (3168147, '12', 2, '2016-03-14', '03:01:02', 5, NULL, 'numerar', NULL, NULL, NULL), (3177866, '14', 13, '1982-09-03', '22:16:04', 0, NULL, 'numerar', NULL, NULL, NULL), (3351838, '13', 15, '2011-10-28', '10:03:03', 2, NULL, 'numerar', NULL, NULL, NULL), (3370638, '20', 6, '2015-03-25', '16:56:56', 5, NULL, 'numerar', NULL, NULL, NULL), (3499177, '11', 20, '2010-02-02', '05:09:02', 5, NULL, 'card', NULL, NULL, NULL), (3540827, '11', 11, '1971-07-21', '10:09:26', 8, NULL, 'card', NULL, NULL, NULL), (3542886, '11', 19, '2000-12-17', '13:25:11', 8, NULL, 'card', NULL, NULL, NULL), (3588964, '11', 11, '2011-05-28', '16:47:06', 1, NULL, 'card', NULL, NULL, NULL), (3694182, '12', 9, '2001-12-22', '14:52:31', 5, NULL, 'card', NULL, NULL, NULL), (3698457, '15', 14, '2019-11-05', '18:43:56', 0, NULL, 'numerar', NULL, NULL, NULL), (3814014, '13', 15, '1992-05-06', '13:42:30', 4, NULL, 'card', NULL, NULL, NULL), (3854419, '15', 1, '1985-09-19', '03:02:46', 1, NULL, 'card', NULL, NULL, NULL), (3926319, '12', 15, '1976-08-08', '12:08:19', 4, NULL, 'numerar', NULL, NULL, NULL), (4187434, '17', 20, '1971-12-17', '04:20:52', 3, NULL, 'numerar', NULL, NULL, NULL), (4203381, '11', 2, '2013-06-29', '03:43:57', 3, NULL, 'numerar', NULL, NULL, NULL); -- -------------------------------------------------------- -- -- Table structure for table `distribuitor` -- CREATE TABLE `distribuitor` ( `CUI` int(10) NOT NULL, `Nume` varchar(50) NOT NULL DEFAULT '0', `Adresa` varchar(50) DEFAULT NULL, `Telefon` char(10) DEFAULT '0', `Col_activa` char(2) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `distribuitor` -- INSERT INTO `distribuitor` (`CUI`, `Nume`, `Adresa`, `Telefon`, `Col_activa`) VALUES (1, 'BiC', '38901 Treutel Brooks Apt. 618\nSouth Earnestine, OR', '0563907097', 'Da'), (2, 'Blue Office', '6819 Grayson Isle\nNorth Jovanshire, NH 14538-2131', '(963)633-5', 'Da'), (3, 'AIHAO', '824 Oberbrunner Road\nReichelberg, SC 02188-1849', '614.762.53', 'Da'), (4, 'Herlitz', '178 Madie Center\nRahulchester, WA 37444-6607', '1-670-535-', 'Da'), (5, 'NOKI', '9408 Hagenes Fort Gorczanyport, NH 05677', '1-344-716-', 'Nu'), (6, 'Asia Pulp & Paper', '56893 Simonis Squares\nQuitzonfurt, MS 58662', '312-479-82', 'Da'), (7, 'PRODCOM', '3000 Wolf Ports South Myah, PA 17845-4064', '(895)491-6', 'Da'), (8, 'JinXin', '601 Buck Corner Suite 927\nPort Lilliehaven, OK 891', '916.142.57', 'Da'), (9, 'Paladin', '49868 Hermann Rest Apt. 592\nBeckerville, CO 58732-', '677.313.21', 'Da'), (10, 'Litera', '10984 Lind Parks\nWest Macy, ME 56990-2840', '(262)694-6', 'Nu'), (11, 'Art', '483 Branson Islands Apt. 916\nNew Eryn, AL 23808', '599.769.00', 'Da'), (12, 'Koh-I-Noor', '44583 Hermann Ford\nLuramouth, OH 25628-8001', '1-180-315-', 'Da'), (13, 'Uzina de cartegregrg', '16511 Gusikowski Mountain New Maybellemouth, ME 63', '0590289310', 'Nu'), (16, 'eMAG', '2286 Lennie Forks\nWest Paulaside, NJ 78860', '1-054-107-', 'Da'), (17, 'HUMANITAS', '902 Reba Well Suite 676\nHollyton, IN 28285', '809.283.77', 'Nu'), (18, 'Paralela 45', 'hdhtfh', '0636462557', 'Da'), (19, 'Booklet', '401 Ilene Shoals Apt. 562\nKelsiehaven, WA 51099-79', '(020)483-4', 'Da'), (20, 'Pigna România Impex SRL', '0931 Little Mills Suite 086\nEast Brian, AR 45090-5', '+05(2)7384', 'Da'), (21, 'aaa', 'rge', '8278267468', 'Da'), (22, 'bbb', 'gere', '8278267468', 'Nu'), (23, 'ccc', 'rgege', '8278267468', 'Da'), (24, 'aaa', 'rge', '8278267468', 'Da'), (25, 'bbb', 'gere', '8278267468', 'Nu'), (26, 'ccc', 'rgege', '8278267468', 'Da'); -- -------------------------------------------------------- -- -- Table structure for table `tip_produs` -- CREATE TABLE `tip_produs` ( `idp` int(11) NOT NULL, `denumire` varchar(50) DEFAULT '0', `categorie` varchar(50) DEFAULT '0', `subcategorie` varchar(50) DEFAULT '0', `in_stoc` int(11) DEFAULT NULL, `pret_init` float DEFAULT NULL, `um` varchar(10) DEFAULT NULL, `reducere` tinyint(4) DEFAULT NULL, `tva` tinyint(4) DEFAULT NULL, `taxa_eco` tinyint(4) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `tip_produs` -- INSERT INTO `tip_produs` (`idp`, `denumire`, `categorie`, `subcategorie`, `in_stoc`, `pret_init`, `um`, `reducere`, `tva`, `taxa_eco`) VALUES (1, '\"Ucenicul Vrăjitorului”, de Tahir Shah', 'Carte', 'Fantasy', 165, 420.996, 'bucata', 23, 15, 1), (2, '”Crimă și pedeapsă”, de Dostoievski', 'Carte', 'Crimă', 76, 208.542, 'bucata', 11, 12, 2), (3, '”Maestrul și Margareta”, de Bulgakov', 'Carte', 'Fantasy', 53, 42.787, 'bucata', 7, 10, 5), (4, '”Istoria românilor”, de wfehwhhje', 'Carte', 'Istorie', 137, 317.155, 'bucata', 10, 17, 4), (5, '”Atlas geografic al României”, de wefew', 'Carte', 'Geografie', 19, 419.038, 'bucata', 18, 11, 4), (6, 'Creioane Koh-I-Noor negre 4G', 'Rechizite', 'creioane', 98, 165.162, 'pachet 10', 13, 13, 2), (7, 'aaaaaaa', '0', '0', 64, 475.686, 'pachet 12', 21, 10, 5), (8, 'bbbbbbbbbbbbb', '0', '0', 71, 170.398, 'metru', 5, 16, 3), (9, 'ccccccccccccc', '0', '0', 100, 30.2, 'metru', 9, 15, 1), (10, 'ddddddddddddd', '0', '0', 89, 387.517, NULL, 14, 14, 3), (11, 'eeeeeeeeeeeeeeeeeee', '0', '0', 57, 310.797, NULL, 11, 13, 4), (12, 'ffffffffff', '0', '0', 11, 221.237, NULL, 27, 12, 5), (13, 'gggggggggggg', '0', '0', 90, 102.558, NULL, 30, 18, 4), (14, 'hhhhhhhhhhhhh', '0', '0', 12, 402.506, NULL, 9, 13, 0), (15, 'iiiiiiiiiiiiiiii', '0', '0', 25, 265.997, NULL, 16, 15, 5), (16, 'jjjjjjjjjjjjjjjjjj', '0', '0', 30, 61.25, NULL, 16, 17, 4), (17, 'kkkkkkkkkkkkk', '0', '0', 82, 371.057, NULL, 13, 16, 3), (18, 'lllllllllllllllll', '0', '0', 73, 304.361, NULL, 19, 10, 1), (19, 'mmmmmmmmmmmm', '0', '0', 6, 313.261, NULL, 5, 13, 4), (20, 'nnnnnnnnnnnnnnnnnnnnnnnnnnnnnn', '0', '0', 95, 54.037, NULL, 14, 12, 4), (1212, 'nume1', 'Carte', 'Aventura', 10, 10.1, 'bucata', 5, 19, 5), (1313, 'nume2', 'Filme', 'Actiune', 20, 20, 'bucata', 7, 19, 5), (32432, 'hartie quiling', 'Papetărie', 'deco', 100, 12, 'set 100', 0, 19, 0), (67567, 'KungFu Panda', 'Filme', 'Actiune', 10, 15, 'bucata', 0, 25, 0), (89787, 'hartie quiling', 'Papetărie', 'deco', 100, 12, 'set 100', 0, 19, 0); -- -------------------------------------------------------- -- -- Table structure for table `vandut` -- CREATE TABLE `vandut` ( `idp` int(11) NOT NULL, `idb` int(11) NOT NULL, `cantitate` smallint(6) NOT NULL DEFAULT 0, `pret_final` float NOT NULL DEFAULT 0 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `vandut` -- INSERT INTO `vandut` (`idp`, `idb`, `cantitate`, `pret_final`) VALUES (20, 2039755, 70, 56.0484), (7, 3177866, 41, 418.371), (6, 3854419, 15, 164.371), (9, 1893317, 68, 335.159), (20, 3370638, 47, 56.0484), (5, 1640922, 83, 385.408), (2, 2836446, 37, 209.875), (4, 1986967, 92, 337.964), (15, 2014726, 48, 261.953), (15, 3351838, 9, 261.953), (19, 2807031, 38, 340.286), (8, 3177866, 17, 190.779), (16, 2673095, 58, 64.1965), (9, 3370638, 62, 335.159), (16, 2694476, 14, 64.1965), (1, 1893317, 57, 373.792), (19, 2807031, 17, 340.286), (9, 4187434, 77, 335.159), (2, 3540827, 1, 209.875), (2, 1842546, 43, 209.875), (4, 2014726, 0, 337.964), (11, 2807031, 90, 316.569), (5, 2014726, 71, 385.408), (1, 1386364, 21, 373.792), (15, 2694476, 95, 261.953), (14, 3088110, 79, 413.897), (17, 1386364, 60, 377.471), (4, 3177866, 57, 337.964), (14, 3351838, 79, 413.897), (7, 3351838, 59, 418.371), (1, 3588964, 78, 373.792), (11, 1386364, 96, 316.569), (9, 3177866, 87, 335.159), (6, 3177866, 74, 164.371), (17, 3540827, 66, 377.471), (9, 2622144, 84, 335.159), (4, 3499177, 68, 337.964), (13, 1893317, 65, 88.7129), (16, 2622144, 82, 64.1965), (13, 2807031, 55, 88.7129), (19, 2694476, 91, 340.286), (12, 1297116, 61, 185.883), (20, 1386364, 26, 56.0484), (4, 3499177, 26, 337.964), (15, 2807031, 23, 261.953), (5, 3694182, 77, 385.408); -- -- Indexes for dumped tables -- -- -- Indexes for table `achizitie` -- ALTER TABLE `achizitie` ADD KEY `FK_achizitie_distribuitor` (`CUI`), ADD KEY `FK_achizitie_tip_produs` (`idp`); -- -- Indexes for table `angajat` -- ALTER TABLE `angajat` ADD PRIMARY KEY (`ida`); -- -- Indexes for table `bon_fiscal` -- ALTER TABLE `bon_fiscal` ADD PRIMARY KEY (`idb`), ADD KEY `FK_bon_fiscal_angajat` (`ida`); -- -- Indexes for table `distribuitor` -- ALTER TABLE `distribuitor` ADD PRIMARY KEY (`CUI`); -- -- Indexes for table `tip_produs` -- ALTER TABLE `tip_produs` ADD PRIMARY KEY (`idp`); -- -- Indexes for table `vandut` -- ALTER TABLE `vandut` ADD KEY `FK_vandut_tip_produs` (`idp`), ADD KEY `FK_vandut_bon_fiscal` (`idb`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `angajat` -- ALTER TABLE `angajat` MODIFY `ida` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=53535; -- -- AUTO_INCREMENT for table `tip_produs` -- ALTER TABLE `tip_produs` MODIFY `idp` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=89788; -- -- Constraints for dumped tables -- -- -- Constraints for table `achizitie` -- ALTER TABLE `achizitie` ADD CONSTRAINT `FK_achizitie_distribuitor` FOREIGN KEY (`CUI`) REFERENCES `distribuitor` (`CUI`), ADD CONSTRAINT `FK_achizitie_tip_produs` FOREIGN KEY (`idp`) REFERENCES `tip_produs` (`idp`); -- -- Constraints for table `bon_fiscal` -- ALTER TABLE `bon_fiscal` ADD CONSTRAINT `FK_bon_fiscal_angajat` FOREIGN KEY (`ida`) REFERENCES `angajat` (`ida`); -- -- Constraints for table `vandut` -- ALTER TABLE `vandut` ADD CONSTRAINT `FK_vandut_bon_fiscal` FOREIGN KEY (`idb`) REFERENCES `bon_fiscal` (`idb`), ADD CONSTRAINT `FK_vandut_tip_produs` FOREIGN KEY (`idp`) REFERENCES `tip_produs` (`idp`); 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
09c9bc3de9319836d5a27985b8dbc4d2f3a41dc6
SQL
liyanageisu/Sales-Management-System
/salesmanagement.sql
UTF-8
4,288
3.3125
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 4.8.5 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Generation Time: Jul 02, 2019 at 03:52 PM -- Server version: 10.1.38-MariaDB -- PHP Version: 7.3.4 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET AUTOCOMMIT = 0; START TRANSACTION; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8mb4 */; -- -- Database: `salesmanagement` -- -- -------------------------------------------------------- -- -- Table structure for table `itemprice` -- CREATE TABLE `itemprice` ( `item_id` int(10) NOT NULL, `item` varchar(20) NOT NULL, `buying_price` float(10,0) NOT NULL, `price` float NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `itemprice` -- INSERT INTO `itemprice` (`item_id`, `item`, `buying_price`, `price`) VALUES (7, 'apple', 20, 25), (8, 'banana', 23, 25), (9, 'mango', 35, 40), (10, 'pen', 8, 12), (11, 'book', 50, 55), (12, 'pencil', 14, 15), (13, 'earser', 5, 7), (14, 'bag', 120, 150), (15, 'bottle', 200, 220); -- -------------------------------------------------------- -- -- Table structure for table `login` -- CREATE TABLE `login` ( `uname` varchar(20) NOT NULL, `password` varchar(20) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `login` -- INSERT INTO `login` (`uname`, `password`) VALUES ('admin', 'admin'); -- -------------------------------------------------------- -- -- Table structure for table `sales` -- CREATE TABLE `sales` ( `id` int(20) NOT NULL, `date` date NOT NULL, `time` time(4) NOT NULL, `item` text NOT NULL, `quantity` int(10) NOT NULL, `price` float NOT NULL, `total` float NOT NULL, `total_with_discount` float NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `sales` -- INSERT INTO `sales` (`id`, `date`, `time`, `item`, `quantity`, `price`, `total`, `total_with_discount`) VALUES (9058, '2019-07-02', '06:25:43.0000', 'pencil', 4, 15, 60, 56.4), (90581, '2019-07-02', '06:25:42.0000', 'banana', 2, 25, 50, 50), (90582, '2019-07-02', '06:25:44.0000', 'pencil', 6, 15, 90, 90), (90583, '2019-07-02', '06:25:44.0000', 'earser', 4, 7, 28, 28), (90584, '2019-07-02', '06:25:45.0000', 'apple', 5, 25, 125, 125), (90585, '2019-07-02', '06:25:45.0000', 'mango', 2, 40, 80, 80); -- -------------------------------------------------------- -- -- Table structure for table `salesperson` -- CREATE TABLE `salesperson` ( `Username` text NOT NULL, `password` text NOT NULL, `Name` text NOT NULL, `ContactNumber` int(10) NOT NULL, `NIC` text NOT NULL, `Address` text NOT NULL, `target` float NOT NULL, `soltbill` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `salesperson` -- INSERT INTO `salesperson` (`Username`, `password`, `Name`, `ContactNumber`, `NIC`, `Address`, `target`, `soltbill`) VALUES ('user1', '123', 'USER111', 111111, '11111111v', 'colombo', 50000, 20429), ('user2', '123', 'USER', 22222, '22222v', 'galle', 20000, 0), ('user3', '123', 'USER33333', 33333, '33333v', 'nugegoda', 10000, 0), ('user4', '123', 'USER444', 4444, '4444v', 'kandy', 15000, 0); -- -- Indexes for dumped tables -- -- -- Indexes for table `itemprice` -- ALTER TABLE `itemprice` ADD PRIMARY KEY (`item_id`); -- -- Indexes for table `login` -- ALTER TABLE `login` ADD PRIMARY KEY (`uname`); -- -- Indexes for table `sales` -- ALTER TABLE `sales` ADD PRIMARY KEY (`id`); -- -- Indexes for table `salesperson` -- ALTER TABLE `salesperson` ADD PRIMARY KEY (`Username`(20)); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `itemprice` -- ALTER TABLE `itemprice` MODIFY `item_id` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=17; COMMIT; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
true
d2b7a80e2f4fdc9fa22c89c5a87e3d680186cebf
SQL
161250092/MoblieBusinessTransactionDBM
/src/main/resources/table.sql
UTF-8
11,970
3.3125
3
[]
no_license
create database mobilebussinessDB; use mobilebussinessDB; -- 用户表 create table if not exists `users` ( -- `userId` int primary key auto_increment, `phoneNumber` varchar(20), `balance` double(16,2), PRIMARY KEY (`phoneNumber`) )ENGINE = InnoDB DEFAULT CHARSET =utf8; -- 用户月数据 create table if not exists `userDataPerMonth` ( `phoneNumber` varchar(20), `d_date` date, `callDuration` double(16,2), `calledDuration` double(16,2), `mailsNumber` int, `localDataFlow` double(16,2), `inlandData` double(16,2), primary key(`phoneNumber`,`d_date`) )ENGINE = InnoDB DEFAULT CHARSET =utf8; create table if not exists `userCombos` ( `phoneNumber` varchar(20), `c_date` date, `comboId` int )ENGINE = InnoDB DEFAULT CHARSET =utf8; create table if not exists `comboKinds` ( `comboId` int primary key auto_increment, `comboName` varchar(20), `free_phoneTime` int, `phone_excessCost` double(16,2), `free_mails` int, `mail_excessCost` double(16,2), `free_localDataFlow` int, `localDataFlow_excessCost` double(16,2), `free_inlandDataFlow` int, `inlandDataFlow_excessCost` double(16,2), `cost` double(16,2) )ENGINE = InnoDB DEFAULT CHARSET =utf8; create table if not exists `callRecords`( `recordId` int primary key auto_increment, `phoneNumber` varchar(20), `lastTime` double(16,2), `call_date` date, `money` double(16,2) )ENGINE = InnoDB DEFAULT CHARSET =utf8; create table if not exists `inLandFlowRecords`( `recordId` int primary key auto_increment, `phoneNumber` varchar(20), `flow` double(16,2), `flow_date` date, `money` double(16,2) )ENGINE = InnoDB DEFAULT CHARSET =utf8; create table if not exists `LocalFlowRecords`( `recordId` int primary key auto_increment, `phoneNumber` varchar(20), `flow` double(16,2), `flow_date` date, `money` double(16,2) )ENGINE = InnoDB DEFAULT CHARSET =utf8; use mobilebussinessDB; -- 插入基准资费 insert into combokinds(comboName,free_phoneTime,phone_excessCost,free_mails,mail_excessCost,free_localDataFlow,localDataFlow_excessCost, free_inlandDataFlow,inlandDataFlow_excessCost,cost)values('standard',0,0.5,0,0.1,0,2,0,5,0.00); -- 四种基础套餐 insert into combokinds(comboName,free_phoneTime,phone_excessCost,free_mails,mail_excessCost,free_localDataFlow,localDataFlow_excessCost, free_inlandDataFlow,inlandDataFlow_excessCost,cost)values('p1',100,0.5,0,0.1,0,2,0,5,20.00); insert into combokinds(comboName,free_phoneTime,phone_excessCost,free_mails,mail_excessCost,free_localDataFlow,localDataFlow_excessCost, free_inlandDataFlow,inlandDataFlow_excessCost,cost)values('m1',0,0.5,200,0.1,0,2,0,5,10); insert into combokinds(comboName,free_phoneTime,phone_excessCost,free_mails,mail_excessCost,free_localDataFlow,localDataFlow_excessCost, free_inlandDataFlow,inlandDataFlow_excessCost,cost)values('l1',0,0.5,0,0.1,2048,3,0,5,20); insert into combokinds(comboName,free_phoneTime,phone_excessCost,free_mails,mail_excessCost,free_localDataFlow,localDataFlow_excessCost, free_inlandDataFlow,inlandDataFlow_excessCost,cost)values('i1',0,0.5,0,0.1,0,2,2048,3,30); use mobilebussinessDB; insert into users(phoneNumber,balance)values('18805199030',100.00); insert into users(phoneNumber,balance)values('18805199031',100.00); insert into users(phoneNumber,balance)values('18805199032',100.00); insert into users(phoneNumber,balance)values('18805199033',100.00); insert into users(phoneNumber,balance)values('18805199034',100.00); insert into users(phoneNumber,balance)values('18805199035',100.00); insert into users(phoneNumber,balance)values('18805199036',100.00); insert into users(phoneNumber,balance)values('18805199037',100.00); insert into users(phoneNumber,balance)values('18805199038',100.00); insert into users(phoneNumber,balance)values('18805199039',100.00); insert into users(phoneNumber,balance)values('18805199040',100.00); insert into users(phoneNumber,balance)values('18805199041',100.00); insert into users(phoneNumber,balance)values('18805199042',100.00); insert into users(phoneNumber,balance)values('18805199043',100.00); insert into users(phoneNumber,balance)values('18805199044',100.00); use mobilebussinessDB; insert into userDataPerMonth(phoneNumber,d_date,callDuration,calledDuration,mailsNumber,localDataFlow,inlandData) values('18805199030',date('2018-10-01'),0,0,0,0,0); insert into userDataPerMonth(phoneNumber,d_date,callDuration,calledDuration,mailsNumber,localDataFlow,inlandData) values('18805199031',date('2018-10-01'),0,0,0,0,0); insert into userDataPerMonth(phoneNumber,d_date,callDuration,calledDuration,mailsNumber,localDataFlow,inlandData) values('18805199032',date('2018-10-01'),0,0,0,0,0); insert into userDataPerMonth(phoneNumber,d_date,callDuration,calledDuration,mailsNumber,localDataFlow,inlandData) values('18805199033',date('2018-10-01'),0,0,0,0,0); insert into userDataPerMonth(phoneNumber,d_date,callDuration,calledDuration,mailsNumber,localDataFlow,inlandData) values('18805199034',date('2018-10-01'),0,0,0,0,0); insert into userDataPerMonth(phoneNumber,d_date,callDuration,calledDuration,mailsNumber,localDataFlow,inlandData) values('18805199035',date('2018-10-01'),0,0,0,0,0); insert into userDataPerMonth(phoneNumber,d_date,callDuration,calledDuration,mailsNumber,localDataFlow,inlandData) values('18805199036',date('2018-10-01'),0,0,0,0,0); insert into userDataPerMonth(phoneNumber,d_date,callDuration,calledDuration,mailsNumber,localDataFlow,inlandData) values('18805199037',date('2018-10-01'),0,0,0,0,0); insert into userDataPerMonth(phoneNumber,d_date,callDuration,calledDuration,mailsNumber,localDataFlow,inlandData) values('18805199038',date('2018-10-01'),0,0,0,0,0); insert into userDataPerMonth(phoneNumber,d_date,callDuration,calledDuration,mailsNumber,localDataFlow,inlandData) values('18805199039',date('2018-10-01'),0,0,0,0,0); insert into userDataPerMonth(phoneNumber,d_date,callDuration,calledDuration,mailsNumber,localDataFlow,inlandData) values('18805199040',date('2018-10-01'),0,0,0,0,0); insert into userDataPerMonth(phoneNumber,d_date,callDuration,calledDuration,mailsNumber,localDataFlow,inlandData) values('18805199041',date('2018-10-01'),0,0,0,0,0); insert into userDataPerMonth(phoneNumber,d_date,callDuration,calledDuration,mailsNumber,localDataFlow,inlandData) values('18805199042',date('2018-10-01'),0,0,0,0,0); insert into userDataPerMonth(phoneNumber,d_date,callDuration,calledDuration,mailsNumber,localDataFlow,inlandData) values('18805199043',date('2018-10-01'),0,0,0,0,0); insert into userDataPerMonth(phoneNumber,d_date,callDuration,calledDuration,mailsNumber,localDataFlow,inlandData) values('18805199044',date('2018-10-01'),0,0,0,0,0); insert into userDataPerMonth(phoneNumber,d_date,callDuration,calledDuration,mailsNumber,localDataFlow,inlandData) values('18805199030',date('2018-11-01'),0,0,0,0,0); insert into userDataPerMonth(phoneNumber,d_date,callDuration,calledDuration,mailsNumber,localDataFlow,inlandData) values('18805199031',date('2018-11-01'),0,0,0,0,0); insert into userDataPerMonth(phoneNumber,d_date,callDuration,calledDuration,mailsNumber,localDataFlow,inlandData) values('18805199032',date('2018-11-01'),0,0,0,0,0); insert into userDataPerMonth(phoneNumber,d_date,callDuration,calledDuration,mailsNumber,localDataFlow,inlandData) values('18805199033',date('2018-11-01'),0,0,0,0,0); insert into userDataPerMonth(phoneNumber,d_date,callDuration,calledDuration,mailsNumber,localDataFlow,inlandData) values('18805199034',date('2018-11-01'),0,0,0,0,0); insert into userDataPerMonth(phoneNumber,d_date,callDuration,calledDuration,mailsNumber,localDataFlow,inlandData) values('18805199035',date('2018-11-01'),0,0,0,0,0); insert into userDataPerMonth(phoneNumber,d_date,callDuration,calledDuration,mailsNumber,localDataFlow,inlandData) values('18805199036',date('2018-11-01'),0,0,0,0,0); insert into userDataPerMonth(phoneNumber,d_date,callDuration,calledDuration,mailsNumber,localDataFlow,inlandData) values('18805199037',date('2018-11-01'),0,0,0,0,0); insert into userDataPerMonth(phoneNumber,d_date,callDuration,calledDuration,mailsNumber,localDataFlow,inlandData) values('18805199038',date('2018-11-01'),0,0,0,0,0); insert into userDataPerMonth(phoneNumber,d_date,callDuration,calledDuration,mailsNumber,localDataFlow,inlandData) values('18805199039',date('2018-11-01'),0,0,0,0,0); insert into userDataPerMonth(phoneNumber,d_date,callDuration,calledDuration,mailsNumber,localDataFlow,inlandData) values('18805199040',date('2018-11-01'),0,0,0,0,0); insert into userDataPerMonth(phoneNumber,d_date,callDuration,calledDuration,mailsNumber,localDataFlow,inlandData) values('18805199041',date('2018-11-01'),0,0,0,0,0); insert into userDataPerMonth(phoneNumber,d_date,callDuration,calledDuration,mailsNumber,localDataFlow,inlandData) values('18805199042',date('2018-11-01'),0,0,0,0,0); insert into userDataPerMonth(phoneNumber,d_date,callDuration,calledDuration,mailsNumber,localDataFlow,inlandData) values('18805199043',date('2018-11-01'),0,0,0,0,0); insert into userDataPerMonth(phoneNumber,d_date,callDuration,calledDuration,mailsNumber,localDataFlow,inlandData) values('18805199044',date('2018-11-01'),0,0,0,0,0); use mobilebussinessDB; insert into userCombos(phoneNumber,c_date,comboId)values('18805199030',date('2018-10-01'),1); insert into userCombos(phoneNumber,c_date,comboId)values('18805199031',date('2018-10-01'),1); insert into userCombos(phoneNumber,c_date,comboId)values('18805199032',date('2018-10-01'),1); insert into userCombos(phoneNumber,c_date,comboId)values('18805199033',date('2018-10-01'),1); insert into userCombos(phoneNumber,c_date,comboId)values('18805199034',date('2018-10-01'),1); insert into userCombos(phoneNumber,c_date,comboId)values('18805199035',date('2018-10-01'),1); insert into userCombos(phoneNumber,c_date,comboId)values('18805199036',date('2018-10-01'),1); insert into userCombos(phoneNumber,c_date,comboId)values('18805199037',date('2018-10-01'),1); insert into userCombos(phoneNumber,c_date,comboId)values('18805199038',date('2018-10-01'),1); insert into userCombos(phoneNumber,c_date,comboId)values('18805199039',date('2018-10-01'),1); insert into userCombos(phoneNumber,c_date,comboId)values('18805199040',date('2018-10-01'),1); insert into userCombos(phoneNumber,c_date,comboId)values('18805199041',date('2018-10-01'),1); insert into userCombos(phoneNumber,c_date,comboId)values('18805199042',date('2018-10-01'),1); insert into userCombos(phoneNumber,c_date,comboId)values('18805199043',date('2018-10-01'),1); insert into userCombos(phoneNumber,c_date,comboId)values('18805199044',date('2018-10-01'),1); insert into userCombos(phoneNumber,c_date,comboId)values('18805199030',date('2018-11-01'),1); insert into userCombos(phoneNumber,c_date,comboId)values('18805199031',date('2018-11-01'),1); insert into userCombos(phoneNumber,c_date,comboId)values('18805199032',date('2018-11-01'),1); insert into userCombos(phoneNumber,c_date,comboId)values('18805199033',date('2018-11-01'),1); insert into userCombos(phoneNumber,c_date,comboId)values('18805199034',date('2018-11-01'),1); insert into userCombos(phoneNumber,c_date,comboId)values('18805199035',date('2018-11-01'),1); insert into userCombos(phoneNumber,c_date,comboId)values('18805199036',date('2018-11-01'),1); insert into userCombos(phoneNumber,c_date,comboId)values('18805199037',date('2018-11-01'),1); insert into userCombos(phoneNumber,c_date,comboId)values('18805199038',date('2018-11-01'),1); insert into userCombos(phoneNumber,c_date,comboId)values('18805199039',date('2018-11-01'),1); insert into userCombos(phoneNumber,c_date,comboId)values('18805199040',date('2018-11-01'),1); insert into userCombos(phoneNumber,c_date,comboId)values('18805199041',date('2018-11-01'),1); insert into userCombos(phoneNumber,c_date,comboId)values('18805199042',date('2018-11-01'),1); insert into userCombos(phoneNumber,c_date,comboId)values('18805199043',date('2018-11-01'),1); insert into userCombos(phoneNumber,c_date,comboId)values('18805199044',date('2018-11-01'),1);
true
fcb7ff1dbea6a4e25af7c2e43c43f55587a82bb0
SQL
Blackbaud-BharatYadav/fenxt-npi-dev
/DDL/views/dm_GLBatches_vw.sql
UTF-8
446
2.515625
3
[]
no_license
create or replace view dm_GLBatches as select _sys_transform_id, TenantId, DateAdded, DateChanged, DateDeleted, DateApproved, BatchId, BatchNumber, StatusTranslation, AddedByUserName, AddedByUserNameLabel, ChangedByUserNameLabel, DeletedByNameLabel, ApprovedByUserNameLabel, BatchDateId, BatchHyperlink from out_GLBatches where _sys_transform_id = (select max(id) from _sys_transform_id where ts_end is not null and entity = 'dm_GLBatches');
true
b44f434fa551e9484660b67111907cdc848cd6b0
SQL
MHXXX/quarkus-learning
/quarkus-start-panache/src/main/resources/db/V1.0.1__init.sql
UTF-8
424
2.671875
3
[]
no_license
create table person ( id serial8 primary key, name varchar(64), gender int2 default -1, birth date ); insert into person(name, birth, gender) values ('peter', '1996-01-01', 0); insert into person(name, birth, gender) values ('lisa', '1998-05-01', 1); insert into person(name, birth, gender) values ('jack', '1990-12-05', 0); insert into person(name, birth, gender) values ('chelsea', '2000-07-15', 1);
true
832b7be2781d6bf5a70fe6662e1d97214caad7be
SQL
rockneu/misc
/sql_tip/dead.lock.sql
UTF-8
1,697
3.953125
4
[]
no_license
/* select b.owner, b.object_name, a.session_id, a.locked_mode from v$locked_object a, dba_objects b where b.object_id = a.object_id order by a.session_id; --select * from v$session where sid in (select session_id from v$locked_object) ; select b.username, b.sid, b.serial#, logon_time, b.CLIENT_IDENTIFIER from v$locked_object a, v$session b where a.session_id = b.sid --order by b.logon_time order by b.SID; select b.owner, b.object_name, a.session_id, c.SERIAL#, a.locked_mode, c.CLIENT_IDENTIFIER from v$locked_object a, dba_objects b, v$session c where b.object_id = a.object_id and a.SESSION_ID = c.SID and b.OBJECT_NAME LIKE 'MTL_SYSTEM_ITEMS%' -- order by c.sid, b.OBJECT_NAME; order by b.OBJECT_NAME; */ --alter system kill session 'sid,serial#' --alter system kill session '2071,13244' SELECT CONCAT('ALTER SYSTEM KILL SESSION ''', CONCAT(CONCAT(CONCAT(T.session_id, ','), T.SERIAL#), ''';')) FROM ( select b.owner, b.object_name, a.session_id, c.SERIAL#, a.locked_mode, c.CLIENT_IDENTIFIER from v$locked_object a, dba_objects b, v$session c where b.object_id = a.object_id and a.SESSION_ID = c.SID and b.OBJECT_NAME LIKE 'MTL_SYSTEM_ITEMS%' -- order by c.sid, b.OBJECT_NAME; order by b.OBJECT_NAME ) T -- WHERE T.CLIENT_IDENTIFIER = 'CHENJINGXIA' ; --select * from v$session where USERNAME = 'CHENJINGXIA' /* SELECT CONCAT('ALTER SYSTEM KILL SESSION ''', CONCAT(CONCAT(CONCAT(SID, ','), SERIAL#), ''';')) FROM V$SESSION WHERE USERNAME = 'CHENJINGXIA'
true
44623ed77920b2f5863a48a0844848fe1c7a3d26
SQL
hoaingo/new-project
/pms-sp-configuration/src/main/resources/list-sp/up_pms_get_list_invoice.sql
UTF-8
508
2.5625
3
[]
no_license
DELIMITER // DROP PROCEDURE IF EXISTS up_pms_get_list_invoice// CREATE PROCEDURE `up_pms_get_list_invoice`() BEGIN SELECT `invoice_id`, `status`, `created_date`, `created_by`, `updated_date`, `updated_by`, `invoice_number`, `invoice_received_date`, `invoice_due_date`, `payment_terms`, `invoice_amount`, `invoice_currency` FROM `pms_invoice`; END//
true
acb6fc0f31659389bcf1cec12dc3629210d5f4da
SQL
Smit36/CS-561-Database-Management-System-Stevens
/Assignment 1/query3.sql
UTF-8
585
3.75
4
[]
no_license
with months as (select generate_series as month from generate_series(1, 12)), aggsale as (select month, prod, sum(quant) from months left join sales using (month) group by month, prod), mostpop as (select distinct on (month) month, prod, sum from aggsale order by month, sum desc), leastpop as (select distinct on (month) month, prod, sum from aggsale order by month, sum asc) select mostpop.month, mostpop.prod as most_popular_prod, mostpop.sum as most_pop_total_q, leastpop.prod as least_popular_prod, leastpop.sum as least_pop_total_q from mostpop join leastpop using (month)
true
47273c12d5ee9f9b42f4aa98e3c1a516cadf3ddd
SQL
hashgraph/hedera-mirror-node
/hedera-mirror-importer/src/main/resources/db/migration/v1/V1.46.0__entity_timestamp.sql
UTF-8
1,051
4.15625
4
[ "Apache-2.0" ]
permissive
------------------- -- Fill missing entity created_timestamp and modified_timestamp ------------------- -- update entity rows based on successful entity create/update/delete transaction types with entity_timestamp as ( select entity_id, min(consensus_ns) created_timestamp, max(consensus_ns) modified_timestamp from transaction where result = 22 and entity_id is not null and type in (8, 9, 11, 12, 15, 17, 18, 19, 20, 21, 22, 24, 25, 26, 29, 35, 36, 42, 43) group by entity_id ) update entity set created_timestamp = coalesce(entity.created_timestamp, entity_timestamp.created_timestamp), modified_timestamp = entity_timestamp.modified_timestamp from entity_timestamp where entity.id = entity_timestamp.entity_id; -- mark schedule entity as deleted and set modified timestamp to the consensus_ns of the schedule delete transaction update entity set deleted = true, modified_timestamp = consensus_ns from transaction where result = 22 and transaction.type = 43 and entity_id is not null and id = entity_id;
true
c6e5519a9a5dfc69a74a9abf265b85fed6a76110
SQL
dlefebvre79/brewery-finder
/final-capstone/java/database/04_insert_seed_data.sql
UTF-8
21,599
3.046875
3
[]
no_license
-- ******************************************** -- this script inserts seed data for all tables -- ******************************************** BEGIN TRANSACTION; -- users -- the default password for both users is password INSERT INTO users (user_id, username, password_hash, role, first_name, last_name, date_of_birth, email, is_subscribed, zip_code) VALUES (1, 'user','$2a$08$UkVvwpULis18S19S5pZFn.YHPZt3oaqHZnDwqbCW9pft6uFtkXKDC','ROLE_USER', 'Janet', 'Marino', '1980-06-23', 'dolphins@yahoo.com', 'true', '44192') , (2, 'admin','$2a$08$UkVvwpULis18S19S5pZFn.YHPZt3oaqHZnDwqbCW9pft6uFtkXKDC','ROLE_ADMIN', 'Admin', 'Admin', '1969-03-17', 'admin@gmail.com', 'true', '44109'), (3, 'brewer', '$2a$08$UkVvwpULis18S19S5pZFn.YHPZt3oaqHZnDwqbCW9pft6uFtkXKDC','ROLE_BREWER', 'Beery', 'Brewer', '1999-12-12','brewer@aol.com', 'true', '44687' ); --Breweries INSERT INTO breweries (brewery_id, name, address, city, zipcode, phone_number, days_of_operation, business_hours, history_desc, atmosphere, is_family_friendly, is_patio, is_food, is_active, website_url, google_maps_url, user_id) VALUES (1, 'Great Lakes Brewing' , '2516 Market Avenue' , 'Cleveland' , '44113' , '(216) 771-4404' , 'Monday,Tuesday,Wednesday,Thursday,Friday,Saturday' , '12:00-18:00,12:00-18:00,12:00-18:00,12:00-18:00,12:00-18:00,12:00-18:00' , 'Two Irish brothers with limited brewing experience. A city that shuttered its last production brewery in the early 80s. A neighborhood in serious need of a facelift. In 1986 when Patrick and Daniel Conway opened their fledgling operation in Cleveland`s Ohio City neighborhood the odds were stacked against them. Fortunately they surrounded themselves with a staff of passionate knowledgeable people and from the start committed themselves to bringing a sophisticated diverse selection of craft beer to their home state. Two decades multiple awards and a whole lot of stories later Pat and Dan Conway celebrate over two decades of brewing exceptional beer for their adventurous and discerning customers.', 'Iconic microbrewery with house suds, an updated American menu, free tours & a patio.','true', 'true', 'true', 'true','https://www.greatlakesbrewing.com', 'https://www.google.com/maps/place/Great+Lakes+Brewing+Company/@41.4843847,-81.7067074,17z/data=!3m1!4b1!4m5!3m4!1s0x8830f06dbb76e503:0xe4f2621c30edaa7b!8m2!3d41.4843807!4d-81.7045187', 2); INSERT INTO breweries (brewery_id, name, address, city, zipcode, phone_number, days_of_operation, business_hours, history_desc, atmosphere, is_family_friendly, is_patio, is_food, is_active, website_url, google_maps_url, user_id) VALUES (2, 'Saucy Brew Works' , '2885 Detroit Rd' , 'Cleveland' , 44113 ,'(216) 666-2568' , 'Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday' , '11:00-22:00,11:00-22:00,11:00-22:00,11:00-22:00,11:00-22:00,11:00-22:00,11:00-22:00' , 'The story starts with our Brew Master Eric Anderson and Entrepreneur Brent Zimmerman. Beer fanatics. Always up for adventure. They decided to transform the Steelman Building into the kind of place that delivers nothing less than crazy good beer and legendary good times.' , 'Two-tiered brewery offering housemade European-style beer & customizable thin-crust pizzas.' , 'true' , 'true' , 'true' , 'true' , 'https://www.saucybrewworks.com/' , 'https://www.google.com/maps/place/Saucy+Brew+Works/@41.489633,-81.7128136,17z/data=!3m1!4b1!4m5!3m4!1s0x8830f06856cfcaf7:0xb7cc96529c4594ea!8m2!3d41.489629!4d-81.7106249' , 2); --insert John INSERT INTO breweries (brewery_id, name, address, city, zipcode, phone_number, days_of_operation, business_hours, history_desc, atmosphere, is_family_friendly, is_patio, is_food, is_active, website_url, google_maps_url, user_id) VALUES (3, 'Rocky River Brewing Company' , '21290 Center Ridge Road' , 'Rocky River' , '44116' , '(440) 895-2739' , 'Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday' , '11:30-22:00,11:30-22:00,11:30-22:00,11:30-22:00,11:30-22:00,11:30-23:00,11:30-23:00' , 'Pleasing Palettes Since 1998 - AWARD-WINNING HANDCRAFTED FOOD & BEER - BrewPub & Restaurant.' , 'Classic Bar and Restaurant' , 'true' , 'true' , 'true' , 'true' , 'https://www.rockyriverbrewco.com/' , 'https://www.google.com/maps/place/21290+Center+Ridge+Rd,+Rocky+River,+OH+44116/@41.4610007,-81.8583192,17z/data=!3m1!4b1!4m5!3m4!1s0x8830ed4f8cc1d2c9:0xa3b50ec4ba97919a!8m2!3d41.4610007!4d-81.8561305' , 2 ); INSERT INTO breweries (brewery_id, name, address, city, zipcode, phone_number, days_of_operation, business_hours, history_desc, atmosphere, is_family_friendly, is_patio, is_food, is_active, website_url, google_maps_url, user_id) VALUES (4, 'Sibling Revelry Brewing' , '29305 Clemens Rd' , 'Westlake' , '44145' , '(440) 471-8589' , 'Thursday,Friday,Saturday' , '16:00-21:00,16:00-21:00,12:00-21:00' , 'Sibling Revelry Brewing was founded by a family of brothers and cousins from Cleveland who wanted to share their passion for great beer with others. Noticing a lack of breweries in the west side suburbs - the relatives set out to create a unique taproom and drinking experience rooted right in their own backyards. Sibling Revelry''s sophisticated taproom offers a full selection of craft beers including year-round brews - seasonal varieties - limited releases and taproom exclusives. Our outdoor patio provides additional space to enjoy our brews with friends and dogs.' , 'Warehouse Brewery' , 'true' , 'true' , 'true' , 'true' , 'https://www.siblingrevelrybrewing.com/' , 'https://www.google.com/maps/dir//sibling+revelry+brewing/data=!4m6!4m5!1m1!4e2!1m2!1m1!1s0x88309204eae51f31:0x2652f1d2afc72563?sa=X&ved=2ahUKEwjjnv2XtaHvAhWTGs0KHVtYDvwQ9RcwE3oECCkQBQ' , 2 ); --Beer INSERT INTO beer (beer_id, name, abv, ibu, type, info, brewery_id, is_active) VALUES (1, 'Christmas Ale', 7.5, 30, 'Ale', 'Ale with spices and honey and a Yuletide`s worth of holiday spices and sweet honey to keep you a-wassailing all season long' , 1, 'true'); INSERT INTO beer (beer_id, name, abv, ibu, type, info, brewery_id, is_active) VALUES (2, 'Eliot Ness', 6.1, 27, 'Amber Lager', 'Almost untouchably smooth--armed with lightly toasted malts and noble hops.' , 1, 'true'); INSERT INTO beer (beer_id, name, abv, ibu, type, info, brewery_id, is_active) VALUES (3, 'Burning river', 6.0, 35, 'Pale Ale', 'Crisp and bright, with refreshing flickers of citrus and pine that ignite the senses (not our local waterways).' , 1, 'true'); INSERT INTO beer (beer_id, name, abv,ibu, type, info, brewery_id, is_active) VALUES (4, 'Habituale', 5.3, 21, 'Kolsch', 'This crisp, clean Kolsch is a true German classic. Its the perfect tribute to our fair-minded friend: sweet balanced with faint bitterness. Appeals to crossover mainstream drinkers and beer connoisseurs alike.' , 2, 'true'); INSERT INTO beer (beer_id, name, abv,ibu, type, info, brewery_id, is_active) VALUES (5, 'B.F.Hefe', 5.5, 11, 'Wheat', 'This Bavarian classic offers that kind of balance. Its not overly bitter or sweet. The original gangster of cloudy beers is thirst quenching and effervescent.' , 2, 'true'); INSERT INTO beer (beer_id, name, abv,ibu, type, info, brewery_id, is_active) VALUES (6, 'Punchline', 5.7, 12, 'Wheat', 'Our fruit beer is a tribute to fruit punch. Tons of fruit flavors come together in a haymaker that hits you right in the red rubber nose.' , 2, 'true'); --John's inserts INSERT INTO beer (beer_id, name, abv, ibu, type, info, brewery_id, is_active) VALUES (7, 'Rocky River Pirate Light' , 4.8 , 16 , 'Blonde Ale' , 'This American blonde ale will grow on you. This brew is smooth, golden, and has fewer calories.' , 3 , 'true'); INSERT INTO beer (beer_id, name, abv, ibu, type, info, brewery_id, is_active) VALUES (8, 'Hop Goblin IPA' , 7.6 , 67 , 'IPA' , 'This West Coast-style IPA is our new flagship IPA. It has a high level of hop bitterness, flavor and aroma, and just enough malt to balance it.' , 3 , 'true'); INSERT INTO beer (beer_id, name, abv, ibu, type, info, brewery_id, is_active) VALUES (9, 'Blarney Rubble Irish Red' , 5.4 , 20 , 'Irish Red' , 'This is what happened when Bam Bam went to Ireland and had a few too many irish reds and went to visit the Blarney Stone.' , 3 , 'true'); INSERT INTO beer (beer_id, name, abv, ibu, type, info, brewery_id, is_active) VALUES (10, 'Cooper''s Gold Kolsch' , 6.0 , 28 , 'German Ale' , 'This German ale (alt-style) utilizes a unique blend of seven different German malts and two different German hops to produce a golden color.' , 3 , 'true'); INSERT INTO beer (beer_id, name, abv, ibu, type, info, brewery_id, is_active) VALUES (11, 'Punchin The Nuts' , 5.3 , 20 , 'Amber Ale' , 'Our amber ale brewed with peanut butter. Which brings out a nice peanut butter aroma and a light peanut butter taste. It''s everyone''s favorite...everyone loves a good Punchin the Nuts!!!!!!' , 3 , 'true'); INSERT INTO beer (beer_id, name, abv, ibu, type, info, brewery_id, is_active) VALUES (12, 'Tropic Funk IPA' , 10.2 , 70 , 'IPA' , 'Citrus is what you smell and taste with a little ipa bitterness. The alcohol is what you will feel.' , 3 , 'true'); INSERT INTO beer (beer_id, name, abv, ibu, type, info, brewery_id, is_active) VALUES (13, 'IPA' , 6.5 , 60 , 'India Pale Ale' , 'Our India Pale Ale has big pine, citrus and stone fruit aromas with a clean, dry finish. It is like Grandpa Bert - not that bitter once you get to know him.' , 4 , 'true'); INSERT INTO beer (beer_id, name, abv, ibu, type, info, brewery_id, is_active) VALUES (14, 'Red' , 5.5 , 35 , 'American Red Ale' , 'An American red ale brewed in the Irish tradition with UK malts providing a light, toasted caramel profile and finished with a healthy amount of American hops for a fresh, moderatly citrus aroma.' , 4 , 'true'); INSERT INTO beer (beer_id, name, abv, ibu, type, info, brewery_id, is_active) VALUES (15, 'Swing State' , 4.5 , 40 , 'Dry Hopped Pale Ale' , 'A dry-hopped, light bodied American Pale Ale. A light malt body with a citrusy hop character leads to a dry hoppy finish.' , 4 , 'true'); INSERT INTO beer (beer_id, name, abv, ibu, type, info, brewery_id, is_active) VALUES (16, 'Coffee Red' , 5.5 , 25 , 'Coffee Red Ale' , 'We took a few barrels of our Flagship red ale and conditioned it with freshly roasted Rwandan coffee from our friends at Duck-rabbit Coffee. Using whole beans for a softer rounder flavor.' , 4 , 'true'); INSERT INTO beer (beer_id, name, abv, ibu, type, info, brewery_id, is_active) VALUES (17, 'Siblime' , 5.0 , 20 , 'Lager brewed with Lime' , 'Light and refreshing, this summer seasonal lager is brewed with just enough lime and spice to remind you that the Cleveland winter is almost over.' , 4 , 'true'); INSERT INTO beer (beer_id, name, abv, ibu, type, info, brewery_id, is_active) VALUES (18, 'Mocha Oatmeal Stout' , 6.5 , 25 , 'Oatmeal Stout' , 'This special batch of our Oatmeal Stout was conditioned with cacao nibs and coffee sourced from Clevelands own Duck-rabbit coffee roasters.' , 4 , 'true'); --Reviews INSERT INTO reviews (beer_id, beer_name, user_id, subject_title, review, rating, create_date) VALUES (1,'Christmas Ale', 1, 'Best Christmas present ever!','Who needs a bunch of presents when you only need a six pack of Christmas Ale!', 5,now()); INSERT INTO reviews (beer_id, beer_name, user_id, subject_title, review, rating, create_date) VALUES (2,'Eliot Ness', 1, 'One of the greatest I have tasted.','Greeat taste, better balance, best to drink before drunk!', 5,now()); INSERT INTO reviews (beer_id, beer_name, user_id, subject_title, review, rating, create_date) VALUES (3,'Burning River', 1, 'It is the piney taste for me', 'I think this is the perfect beer for my taste buds!', 5,now()); INSERT INTO reviews (beer_id, beer_name, user_id, subject_title, review, rating, create_date) VALUES (4, 'Habituale', 1, 'I see why they call it Habituale', 'It is becoming a habit drinking these, everyday!', 4,now()); INSERT INTO reviews (beer_id, beer_name, user_id, subject_title, review, rating, create_date) VALUES (5, 'B.F. Hefe', 1, 'This wheat beer is better than wheat bread!', 'I think I will just slap my lunchmeat in between two bottles of these from now on, now that is a sandwich!', 4,now()); INSERT INTO reviews (beer_id, beer_name, user_id, subject_title, review, rating, create_date) VALUES (6, 'Punchline', 1, 'Good for when you can not come up with the right words', 'Punchline is a great balance of taste, full body, and dancing without having to be nervous, lol!', 5,now()); INSERT INTO reviews (beer_id, beer_name, user_id, subject_title, review, rating, create_date) VALUES (7, 'Rocky River Pirate Light', 1, 'Pirate Light is a true gardeners brew!','Smooth, golden and low enough avb to pound all day and still ride the mower!', 4,now()); INSERT INTO reviews (beer_id, beer_name, user_id, subject_title, review, rating, create_date) VALUES (8, 'Hop Goblin IPA', 1, 'A spooky brew','The perfect partner for that Halloween party treat!', 5,now()); INSERT INTO reviews (beer_id, beer_name, user_id, subject_title, review, rating, create_date) VALUES (9, 'Blarney Rubble Irish Red', 1, 'Barney would be proud', 'You will be singing the Flintstones song after a couple of these!', 5,now()); INSERT INTO reviews (beer_id, beer_name, user_id, subject_title, review, rating, create_date) VALUES (10,'Cooper''s Gold Kolsch', 1, 'Its a gold rush', 'Different malts and hops are combined to give this nugget its golden hue!', 4,now()); INSERT INTO reviews (beer_id, beer_name, user_id, subject_title, review, rating, create_date) VALUES (11, 'Punchin The Nuts', 1, 'Punchin the Nuts','The perfect partner for that jelly toast for breakfast!', 5,now()); INSERT INTO reviews (beer_id, beer_name, user_id, subject_title, review, rating, create_date) VALUES (12,'Tropic Funk IPA', 1, 'Grow a little Funk of your own', 'You will be singing along with EJ after two of these bad boys!', 5,now()); -- images INSERT INTO images (image_id, url, description, alt_text, beer_id, brewery_id) VALUES(1, 'https://www.greatlakesbrewing.com/sites/default/files/styles/beer_page/public/christmas_ale_bottle_glass_can_0.png?itok=gsAGIklG', 'Ale with spices and honey and a Yuletide`s worth of holiday spices and sweet honey to keep you a-wassailing all season long', 'Christmas Ale', 1, 1); INSERT INTO images (image_id, url, description, alt_text, beer_id, brewery_id) VALUES(2, 'https://www.greatlakesbrewing.com/sites/default/files/styles/beer_page/public/eliot-ness-2021_0.jpg?itok=tb8D-ZHX', 'Almost untouchably smooth--armed with lightly toasted malts and noble hops.', 'Elliot Ness', 2, 1); INSERT INTO images (image_id, url, description, alt_text, beer_id, brewery_id) VALUES(3, 'https://www.greatlakesbrewing.com/sites/default/files/styles/beer_page/public/burning-river-cans-fixed-580x960_0.jpg?itok=AOcghGqh', 'Crisp and bright, with refreshing flickers of citrus and pine that ignite the senses (not our local waterways).', 'Burning River', 3, 1); INSERT INTO images (image_id, url, description, alt_text, beer_id, brewery_id) VALUES(4, 'https://www.saucybrewworks.com/media/images/Beer-Page_Core-Cans_Habituale.width-400.png', 'This crisp, clean Kolsch is a true German classic. Its the perfect tribute to our fair-minded friend: sweet balanced with faint bitterness. Appeals to crossover mainstream drinkers and beer connoisseurs alike.', 'Habituale', 4, 2); INSERT INTO images (image_id, url, description, alt_text, beer_id, brewery_id) VALUES(5, 'https://www.saucybrewworks.com/media/images/Beer-Page_Core-Cans_BfHefe.width-400.png', 'Light to medium bodied with a wheaty, fruity flavor', 'B.F. Hefe', 5, 2); INSERT INTO images (image_id, url, description, alt_text, beer_id, brewery_id) VALUES(6, 'https://www.saucybrewworks.com/media/images/Beer-Page_Core-Cans_IPA.width-400.png', 'Our fruit beer is a tribute to fruit punch. Tons of fruit flavors come together in a haymaker that hits you right in the red rubber nose.', 'Punchline', 6, 2); INSERT INTO images (image_id, url, description, alt_text, beer_id, brewery_id) VALUES(7, 'https://www.instagram.com/p/Bvrq6NYBrh1/', 'This American blonde ale will grow on you. This brew is smooth, golden, and has fewer calories.', 'Rocky River Pirate Light', 7, 3); INSERT INTO images (image_id, url, description, alt_text, beer_id, brewery_id) VALUES(8, 'https://www.instagram.com/p/BrdNw5OH4O9/', 'This West Coast-style IPA is our new flagship IPA. It has a high level of hop bitterness, flavor and aroma, and just enough malt to balance it', 'Hop Goblin IPA', 8, 3); INSERT INTO images (image_id, url, description, alt_text, beer_id, brewery_id) VALUES(9, 'https://untappd.akamaized.net/photos/2021_03_01/30a2a70ffeaecf3cfc76cd9b58492b00_raw.jpg', 'This is what happened when Bam Bam went to Ireland and had a few too many irish reds and went to visit the Blarney Stone. ', 'Blarney Rubble Irish Red', 9, 3); INSERT INTO images (image_id, url, description, alt_text, beer_id, brewery_id) VALUES(10, 'https://www.instagram.com/p/CEpo541pmYi/', 'This German ale alt-style utilizes a unique blend of seven different German malts and two different German hops to produce a golden color.', 'Coopers Gold Kolsch', 10, 3); INSERT INTO images (image_id, url, description, alt_text, beer_id, brewery_id) VALUES(11, 'https://untappd.akamaized.net/photos/2021_02_18/46a89ba18acc3492680c7cfc3a6cd0c0_raw.jpg', 'Our amber ale brewed with peanut butter. Which brings out a nice peanut butter aroma and a light peanut butter taste. It’s everyone’s favorite….everyone love a good “Punchin the Nuts!!!!!!', 'Punchin The Nuts', 11, 3); INSERT INTO images (image_id, url, description, alt_text, beer_id, brewery_id) VALUES(12, 'https://untappd.akamaized.net/photos/2021_02_27/2cfae0d8e3c986197082715e684500b9_raw.jpg', 'Our fruit beer is a tribute to fruit punch. Tons of fruit flavors come together in a haymaker that hits you right in the red rubber nose.', 'Tropic Funk IPA', 12, 3); INSERT INTO images (image_id, url, description, alt_text, beer_id, brewery_id) VALUES(13, 'http://www.siblingrevelrybrewing.com/SiblingRevelryBrewing/media/SiblingRevelryMedia/2017%20Beer%20Images%201228x1590/2017%20Beer%20Images%20220x500/ipa-small.png?ext=.png', 'It is like Grandpa Bert, not that bitter once you get to know him', 'IPA', 13, 4); INSERT INTO images (image_id, url, description, alt_text, beer_id, brewery_id) VALUES(14, 'http://www.siblingrevelrybrewing.com/SiblingRevelryBrewing/media/SiblingRevelryMedia/2017%20Beer%20Images%201228x1590/2017%20Beer%20Images%20220x500/red-small.png?ext=.png', 'Keep this one handy for the rowdiest family reunions and sports parties', 'RED', 14, 4); INSERT INTO images (image_id, url, description, alt_text, beer_id, brewery_id) VALUES(15, 'http://www.siblingrevelrybrewing.com/SiblingRevelryBrewing/media/SiblingRevelryMedia/2017%20Beer%20Images%201228x1590/2017%20Beer%20Images%20220x500/swing-state-small.png?ext=.png', 'A dry hopped, light bodied American Pale Ale', 'SWING STATE', 15, 4); INSERT INTO images (image_id, url, description, alt_text, beer_id, brewery_id) VALUES(16, 'http://www.siblingrevelrybrewing.com/SiblingRevelryBrewing/media/SiblingRevelryMedia/2017%20Beer%20Images%201228x1590/2017%20Beer%20Images%20220x500/coffee-red-small.png?ext=.png', 'Drinks like our red ale lightly roasted and sweetened coffee finish', 'COFFEE RED', 16, 4); INSERT INTO images (image_id, url, description, alt_text, beer_id, brewery_id) VALUES(17, 'http://www.siblingrevelrybrewing.com/SiblingRevelryBrewing/media/SiblingRevelryMedia/2017%20Beer%20Images%201228x1590/2017%20Beer%20Images%20220x500/siblime-can-combo-small-final.png?ext=.png', 'Cheers to the other season in Cleveland - Not-Winter', 'SUBLIME', 17, 4); INSERT INTO images (image_id, url, description, alt_text, beer_id, brewery_id) VALUES(18, 'http://www.siblingrevelrybrewing.com/getmedia/c77ea620-cb85-4193-b46c-a96a7fe7be1a/mocha-can-render?width=390&height=500&ext=.png', 'Our favorite pick-me-up with the best evening companion', 'MOCHA OATMEAL STOUT', 18, 4); -- reset the sequence numbering for the users table ALTER SEQUENCE seq_user_id RESTART WITH 4; ALTER SEQUENCE breweries_brewery_id_seq RESTART WITH 5; ALTER SEQUENCE images_image_id_seq RESTART WITH 19; ALTER SEQUENCE reviews_review_id_seq RESTART WITH 13; ALTER SEQUENCE beer_beer_id_seq RESTART WITH 19; COMMIT TRANSACTION; --ROLLBACK TRANSACTION;
true
6dec01d24b653615aaa41cd0d9cc145dbe42c6ec
SQL
Feliciano07/Alie_Store
/database/producto.sql
UTF-8
1,153
3.828125
4
[]
no_license
-- consulta para poder traer los productos de un cliente especifico SELECT pr.imagen,pr.descripcion,pr.precio_producto,pr.cantidad_disponible, ct.nombre_categoria as padre FROM PRODUCTO pr, PRODUCTO_CATEGORIA pc, CATEGORIA ct WHERE pr.usuario=15 AND pr.id_producto=pc.producto AND pc.categoria=ct.id_categoria ; -- -- BUSQUEDA DE PRODUTOS DADA UNA PALABRA ESPECIFICA ESCRITA POR EL USUARIO SELECT pr.imagen,pr.descripcion,pr.precio_producto,pr.fecha_publicacion,pr.cantidad_disponible FROM PRODUCTO pr,CATEGORIA ct WHERE UPPER (pr.descripcion) LIKE UPPER('%compu%') UNION SELECT pr.imagen,pr.descripcion,pr.precio_producto,pr.fecha_publicacion,pr.cantidad_disponible FROM PRODUCTO pr, PRODUCTO_CATEGORIA pc, CATEGORIA ct WHERE pr.id_producto=pc.producto AND pc.categoria=ct.id_categoria and UPPER(ct.nombre_categoria) LIKE UPPER('%elec%') UNION SELECT pr.imagen,pr.descripcion,pr.precio_producto,pr.fecha_publicacion,pr.cantidad_disponible FROM PRODUCTO pr, COLOR cr, PRODUCTO_COLOR pl WHERE pr.id_producto=pl.producto AND pl.color=cr.id_color AND UPPER(cr.nombre_color) LIKE UPPER('%amarillo%');
true
9a6938b2de3bda35aba8371068108a4f440de508
SQL
nilakshgupta/Bamazon
/bamazon.sql
UTF-8
310
3.03125
3
[]
no_license
CREATE DATABASE bamazon; USE bamazon; CREATE TABLE products( item_id INTEGER(10) AUTO_INCREMENT, product_name VARCHAR(50), department_name VARCHAR(50), price INTEGER (50), stock_quantity INTEGER(50), primary key (item_id) ); show tables from bamazon; select * from products;
true
5c0424a74c29107d5036a758be30cc8c88c906f5
SQL
AsciiShell/hse_db_project
/Text/code/tab_block.sql
UTF-8
268
2.984375
3
[]
no_license
CREATE TABLE Block ( B_ID SERIAL PRIMARY KEY, B_THEME VARCHAR(100) NOT NULL, B_VISIBILITY BOOLEAN NOT NULL DEFAULT FALSE, B_COURSE INTEGER NOT NULL REFERENCES Course (C_ID), B_LAST_ID INTEGER REFERENCES Block (B_ID) );
true
4b4fc40d238d48e063f5be04f342c012a2ad56e5
SQL
noracurcio/mySQL-Employee-Tracker
/develop/schema.sql
UTF-8
561
3.34375
3
[]
no_license
DROP DATABASE IF EXISTS employeeDB; CREATE DATABASE employeeDB; USE employeeDB; CREATE TABLE department ( id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY, name VARCHAR(45) UNIQUE NOT NULL ); CREATE TABLE role ( id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY, title VARCHAR(45) , salary DECIMAL(10,2) NOT NULL, department_id INT NOT NULL ); CREATE TABLE employee ( id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY, first_name VARCHAR(45) UNIQUE NOT NULL, last_name VARCHAR(30) UNIQUE NOT NULL, role_id INT NOT NULL, manager_id INT );
true
7691968e2f6961bcd211dc2caf82ae86af3b9126
SQL
tjakopec/FormatiDatumVrijeme
/API/skripta.sql
UTF-8
1,802
3.734375
4
[]
no_license
drop database if exists fz2017; create database fz2017 character set utf8 collate utf8_general_ci; use fz2017; #https://dev.mysql.com/doc/refman/5.7/en/datetime.html create table podatak( sifra int not null primary key auto_increment, opis varchar(255) not null, samodatum date, #The DATE type is used for values with a date part but no time part. MySQL retrieves and displays DATE values in 'YYYY-MM-DD' format. The supported range is '1000-01-01' to '9999-12-31'. vrijeme time, #MySQL retrieves and displays TIME values in 'HH:MM:SS' format (or 'HHH:MM:SS' format for large hours values). TIME values may range from '-838:59:59' to '838:59:59' datumvrijeme datetime, #The DATETIME type is used for values that contain both date and time parts. MySQL retrieves and displays DATETIME values in 'YYYY-MM-DD HH:MM:SS' format. The supported range is '1000-01-01 00:00:00' to '9999-12-31 23:59:59'. datumvrijemetimezone timestamp #MySQL converts TIMESTAMP values from the current time zone to UTC for storage, and back from UTC to the current time zone for retrieval. )engine=innodb CHARACTER SET utf8 COLLATE utf8_general_ci; #na ofset vremenske zone utječe ljetno računanje vremena #primjeri SET time_zone='Europe/London'; SELECT datumvrijeme, UNIX_TIMESTAMP(datumvrijemetimezone), datumvrijemetimezone FROM podatak; SET time_zone='Europe/Zagreb'; SELECT datumvrijeme, UNIX_TIMESTAMP(datumvrijemetimezone), datumvrijemetimezone FROM podatak; #koliko ste dana stari # select datediff("1980-12-07",now()); #Dosadašnji broj otkucaja Vašeg srca select TIMESTAMPDIFF(MINUTE, '1980-12-07', now())*80; # ako je 80 prosječan broj #pojedini djelovi datuma i vremena select year(now()), month(now()), day(now()), hour(now()), minute(now()), second(now());
true
385230c87d42fc39bf838907573f086a338b1b99
SQL
polavarapup2/CTRP_4x_PA
/pa/dbscripts/db-upgrade/postgresql/4.3/PO-9270.sql
UTF-8
1,268
2.703125
3
[]
no_license
UPDATE pa_properties set value='<hr> <p><b>Title: </b>${trialTitle}</p> <table border="0"> <tr> <td><b>Lead Organization Trial ID:</b></td> <td>${leadOrgTrialIdentifier}</td> </tr> <tr> <td><b>Lead Organization:</b></td> <td>${leadOrgName}</td> </tr> <tr> <td><b>Submission Date:</b></td> <td>${submissionDate}</td> </tr> </table> <hr> <p>Date: ${CurrentDate}</p> <p>Dear ${SubmitterName},</p> <p>You have saved a draft of the trial identified above for submission to the NCI Clinical Trials Reporting Program (CTRP).</p> <p>The CTRP has assigned your draft a unique temporary identifier for tracking purposes.</p> <p><b>NEXT STEPS:</b><br> To retrieve and complete your submission, use the "Search Saved Drafts" feature on the "Search Trials" page in the CTRP Registration application. </p> <p>Clinical Trials Reporting Office (CTRO) staff will not access or process your trial until you have completed the submission.</p> <p><b>Important!</b> You can save your draft for a maximum of 30 days.</p> <p>If you have questions about this or other CTRP topics, please contact us at ncictro@mail.nih.gov.</p> <p>Thank you for submitting your trial for registration in the Clinical Trials Reporting Program.</p>' where name='trial.partial.register.body';
true
761ea44827e4b41160b9434c1a20ee5aac165ca6
SQL
chrko/db12013
/sheet5/2.3.sql
UTF-8
192
3.78125
4
[]
no_license
SELECT country.name, COUNT(concert.*) AS concert_count FROM country, concert WHERE country.id = concert.country GROUP BY country.name HAVING COUNT(concert.*) >= 5000 ORDER BY country.name
true
6052ec023709f61e30777d1bce00bc666701717b
SQL
pp0001/Acl-Demo
/acl-demo/src/main/resources/data.sql
UTF-8
1,844
3.0625
3
[]
no_license
INSERT INTO User (id, email, password, role_id) VALUES (1, 'user1@mail.com', 'user1', 'procedure_owner'), (2, 'user2@mail.com', 'user2', 'procedure_owner'), (3, 'user3@mail.com', 'user3', 'admin'), (4, 'user4@mail.com', 'user4', 'employee'); INSERT INTO Ropa (id, name) VALUES (1, 'Ropa1'), (2, 'Ropa2'), (3, 'Ropa3'); INSERT INTO ropa_owner (id, owner_id, ropa_id) VALUES (1, 1, 1), (2, 2, 2), (3, 3, 3); INSERT INTO acl_sid (id, principal, sid) VALUES (1, 1, 'user1@mail.com'), (2, 1, 'user2@mail.com'), (3, 1, 'user3@mail.com'), (4, 1, 'user4@mail.com'); INSERT INTO acl_class (id, class) VALUES (1, 'com.process.demo.model.Ropa'); INSERT INTO acl_object_identity (id, object_id_class, object_id_identity, parent_object, owner_sid, entries_inheriting) VALUES (1, 1, 1, NULL, 1, 1), -- Ropa1 object identity (2, 1, 2, NULL, 2, 1), -- Ropa2 object identity (3, 1, 3, NULL, 3, 1); -- Ropa3 object identity INSERT INTO acl_entry (id, acl_object_identity, ace_order, sid, mask, granting, audit_success, audit_failure) VALUES (1, 1, 0, 3, 16, 1, 0, 0), -- user3@mail.com has Admin permission for Ropa1 (2, 2, 0, 3, 16, 1, 0, 0), -- user3@mail.com has Admin permission for Ropa2 (3, 3, 0, 3, 16, 1, 0, 0), -- user3@mail.com has Admin permission for Ropa3 (4, 1, 1, 4, 1, 1, 0, 0), -- user4@mail.com has Read permission for Ropa1 (5, 2, 1, 4, 1, 1, 0, 0), -- user4@mail.com has Read permission for Ropa2 (6, 3, 1, 4, 1, 1, 0, 0), -- user4@mail.com has Read permission for Ropa3 (7, 1, 2, 1, 32, 1, 0, 0), -- user1@mail.com has OWNER_CRU permission for Ropa1 (8, 2, 2, 1, 1, 1, 0, 0), -- user1@mail.com has Read permission for Ropa2 (9, 3, 2, 1, 1, 1, 0, 0), -- user1@mail.com has Read permission for Ropa3 (10, 1, 3, 2, 1, 1, 0, 0), -- user2@mail.com has Read permission for Ropa2 (11, 2, 3, 2, 32, 1, 0, 0), -- user2@mail.com has OWNER_CRU permission for Ropa2 (12, 3, 3, 2, 1, 1, 0, 0); -- user2@mail.com has Read permission for Ropa3
true
fbbcec616d458fc344d4ba554bdb50889beb5693
SQL
ewisuru/spingboot-auth
/src/main/resources/schema.sql
UTF-8
361
2.953125
3
[]
no_license
CREATE SCHEMA springsecurity AUTHORIZATION postgres; COMMENT ON SCHEMA springsecurity IS 'this schema is to keep user details required for spring authentication'; create table springsecurity.user_info ( id serial PRIMARY KEY, user_name varchar (50) unique not null, password varchar (50) not null, active boolean not null, roles varchar (100) );
true
00ce4ad81164449abe80ffc63a7a80725753a5a0
SQL
radtek/abs3
/sql/mmfo/bars/Table/grt_vehicle_types.sql
WINDOWS-1251
3,477
3.234375
3
[]
no_license
PROMPT ===================================================================================== PROMPT *** Run *** ========== Scripts /Sql/BARS/Table/GRT_VEHICLE_TYPES.sql =========*** Run PROMPT ===================================================================================== PROMPT *** ALTER_POLICY_INFO to GRT_VEHICLE_TYPES *** BEGIN execute immediate 'begin bpa.alter_policy_info(''GRT_VEHICLE_TYPES'', ''CENTER'' , null, null, null, null); bpa.alter_policy_info(''GRT_VEHICLE_TYPES'', ''FILIAL'' , null, null, null, null); bpa.alter_policy_info(''GRT_VEHICLE_TYPES'', ''WHOLE'' , null, null, null, null); null; end; '; END; / PROMPT *** Create table GRT_VEHICLE_TYPES *** begin execute immediate ' CREATE TABLE BARS.GRT_VEHICLE_TYPES ( TYPE_ID NUMBER(5,0), TYPE_NAME VARCHAR2(32) ) SEGMENT CREATION IMMEDIATE PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING TABLESPACE BRSSMLD '; exception when others then if sqlcode=-955 then null; else raise; end if; end; / PROMPT *** ALTER_POLICIES to GRT_VEHICLE_TYPES *** exec bpa.alter_policies('GRT_VEHICLE_TYPES'); COMMENT ON TABLE BARS.GRT_VEHICLE_TYPES IS ' '; COMMENT ON COLUMN BARS.GRT_VEHICLE_TYPES.TYPE_ID IS ' '; COMMENT ON COLUMN BARS.GRT_VEHICLE_TYPES.TYPE_NAME IS ' '; PROMPT *** Create constraint PK_GRTVEHTYPES *** begin execute immediate ' ALTER TABLE BARS.GRT_VEHICLE_TYPES ADD CONSTRAINT PK_GRTVEHTYPES PRIMARY KEY (TYPE_ID) USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE BRSSMLD ENABLE'; exception when others then if sqlcode=-2260 or sqlcode=-2261 or sqlcode=-2264 or sqlcode=-2275 or sqlcode=-1442 then null; else raise; end if; end; / PROMPT *** Create constraint CC_GRTVEHTYPES_NAME_NN *** begin execute immediate ' ALTER TABLE BARS.GRT_VEHICLE_TYPES MODIFY (TYPE_NAME CONSTRAINT CC_GRTVEHTYPES_NAME_NN NOT NULL ENABLE)'; exception when others then if sqlcode=-2260 or sqlcode=-2261 or sqlcode=-2264 or sqlcode=-2275 or sqlcode=-1442 then null; else raise; end if; end; / PROMPT *** Create index PK_GRTVEHTYPES *** begin execute immediate ' CREATE UNIQUE INDEX BARS.PK_GRTVEHTYPES ON BARS.GRT_VEHICLE_TYPES (TYPE_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE BRSSMLD '; exception when others then if sqlcode=-955 then null; else raise; end if; end; / PROMPT *** Create grants GRT_VEHICLE_TYPES *** grant SELECT on GRT_VEHICLE_TYPES to BARSREADER_ROLE; grant DELETE,INSERT,SELECT,UPDATE on GRT_VEHICLE_TYPES to BARS_ACCESS_DEFROLE; grant SELECT on GRT_VEHICLE_TYPES to BARS_DM; grant SELECT on GRT_VEHICLE_TYPES to UPLD; PROMPT ===================================================================================== PROMPT *** End *** ========== Scripts /Sql/BARS/Table/GRT_VEHICLE_TYPES.sql =========*** End PROMPT =====================================================================================
true
007c6ee31780cc59e9e3255817f79fa487ad82b1
SQL
timbiles/Convoke
/convoke/db/schema.sql
UTF-8
716
3.59375
4
[]
no_license
-- users table CREATE TABLE users ( users_id SERIAL PRIMARY KEY, name character varying(100), bio character varying(500), auth_id text, home_town character varying(100), img text, email character varying(200) ); -- events table CREATE TABLE events ( events_id SERIAL PRIMARY KEY, title character varying(100), host character varying(100), date date, time text, description character varying(500), img text, location text, users_id integer REFERENCES users(users_id) ); -- user_events table CREATE TABLE user_events ( id SERIAL PRIMARY KEY, users_id integer REFERENCES users(users_id), events_id integer REFERENCES events(events_id) );
true
6824c08e9e34c4bfdcbc4d93cb9ce6c3a63997d2
SQL
kevintoro/mysql
/training.sql
UTF-8
3,111
3.265625
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 4.9.2 -- https://www.phpmyadmin.net/ -- -- Servidor: 127.0.0.1:3308 -- Tiempo de generación: 17-04-2020 a las 16:21:53 -- Versión del servidor: 8.0.18 -- Versión de PHP: 7.3.12 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: `training` -- -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `municipio` -- DROP TABLE IF EXISTS `municipio`; CREATE TABLE IF NOT EXISTS `municipio` ( `id_municipio` int(5) NOT NULL AUTO_INCREMENT, `nombre_municipio` varchar(40) NOT NULL, PRIMARY KEY (`id_municipio`) ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; -- -- Volcado de datos para la tabla `municipio` -- INSERT INTO `municipio` (`id_municipio`, `nombre_municipio`) VALUES (1, 'Chitaga'), (2, 'Cucuta'), (3, 'Pamplona'); -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `tipodocumento` -- DROP TABLE IF EXISTS `tipodocumento`; CREATE TABLE IF NOT EXISTS `tipodocumento` ( `id_tipo` int(11) NOT NULL AUTO_INCREMENT, `nombre_tipo` varchar(40) NOT NULL, PRIMARY KEY (`id_tipo`) ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; -- -- Volcado de datos para la tabla `tipodocumento` -- INSERT INTO `tipodocumento` (`id_tipo`, `nombre_tipo`) VALUES (1, 'Cedula de Ciudadania'), (2, 'Tarjeta de Identidad'); -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `usuario` -- DROP TABLE IF EXISTS `usuario`; CREATE TABLE IF NOT EXISTS `usuario` ( `id_usuario` varchar(15) NOT NULL, `fullname` varchar(80) NOT NULL, `tipo_doc` int(11) DEFAULT NULL, `direccion` varchar(80) DEFAULT NULL, `id_municipio` int(5) NOT NULL, `email` varchar(50) DEFAULT NULL, PRIMARY KEY (`id_usuario`), KEY `id_municipio` (`id_municipio`), KEY `tipo_doc` (`tipo_doc`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; -- -- Volcado de datos para la tabla `usuario` -- INSERT INTO `usuario` (`id_usuario`, `fullname`, `tipo_doc`, `direccion`, `id_municipio`, `email`) VALUES ('1090528922', 'Kevin Andres Toro Galvan', 1, 'Cl 9 Lt 9', 1, 'kevinandrestg7@gmail.com'); -- -- Restricciones para tablas volcadas -- -- -- Filtros para la tabla `usuario` -- ALTER TABLE `usuario` ADD CONSTRAINT `usuario_ibfk_1` FOREIGN KEY (`id_municipio`) REFERENCES `municipio` (`id_municipio`) ON DELETE RESTRICT ON UPDATE CASCADE, ADD CONSTRAINT `usuario_ibfk_2` FOREIGN KEY (`tipo_doc`) REFERENCES `tipodocumento` (`id_tipo`) ON DELETE RESTRICT ON UPDATE CASCADE; COMMIT; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
true
e2c5e6bf2fd2f93fc233f4195ef064b0a9ab67e5
SQL
karlrank/os-blog-aggregator
/db/blogaggre.sql
UTF-8
1,378
3.78125
4
[]
no_license
#Listid Kasutajalt select listName from bloglist where email='test@gmail.com'; #Blogs by Bloglist select title,xmlUrl from blog where id IN (select BLOG_ID from blog_bloglist where BLOGLIST_ID IN (select id from bloglist where listName='Esimene List')); #Tags by Blog select name from tag where id IN (select TAG_ID from blog_tag where BLOG_ID IN (select id from blog where id = 0)); #Blogs by tags select title,xmlUrl from blog where id IN (select BLOG_ID from blog_tag where TAG_ID IN (select id from tag where name='tag1')); #Kasutaja blogid kindlas listis select title,xmlUrl from blog where id IN (select BLOG_ID from blog_bloglist where BLOGLIST_ID IN (select id from bloglist where email='test@gmail.com')); #Add user to database insert ignore into user (email) value('something@gmail.com'); #Bloglist with user insert into bloglist(listName,email) values ('Esimene List','test@gmail.com'); #Create blog INSERT INTO blog (title , xmlUrl) VALUES ('Blog1', 'https://xmlUrl1.com'); #Create Tag insert into tag (name) values ('tag1'); #Add blog to list insert into blog_bloglist values (blog_id,bloglist_id); #Add tag to user insert into user_tag values (user_id,tag_id); #Add tag to blog insert into blog_tag values (blog_id,tag_id); #Update selectedList Update user set selectedList=2 where email='test1@gmail.com'; #Get selectedList select listName from bloglist where email='test@gmail.com';
true
fdc487dec0c159e356bc8c2c5e05b61b7f6aa499
SQL
tabokie/benchmarksql
/run/sql.oracle/indexCreates.sql
UTF-8
1,249
3.125
3
[]
no_license
-- configured for 96c setup create unique index bmsql_warehouse_pkey on bmsql_warehouse (w_id) parallel 32 pctfree 1 initrans 3 compute statistics; create unique index bmsql_district_pkey on bmsql_district (d_w_id, d_id) pctfree 5 initrans 3 parallel 1 compute statistics; create unique index bmsql_customer_pkey on bmsql_customer (c_w_id, c_d_id, c_id) -- reverse parallel 32 pctfree 1 initrans 3 compute statistics; create unique index bmsql_customer_idx on bmsql_customer (c_w_id, c_last, c_d_id, c_first, c_id) parallel 32 pctfree 1 initrans 3 compute statistics; create unique index bmsql_oorder_pkey on bmsql_oorder (o_w_id, o_d_id, o_c_id, o_id) -- reverse parallel 32 pctfree 25 initrans 4 compute statistics; create unique index bmsql_new_order_pkey on bmsql_new_order (no_w_id, no_d_id, no_o_id) compute statistics; create unique index bmsql_order_line_pkey on bmsql_order_line (ol_w_id, ol_d_id, ol_o_id, ol_number) compute statistics; create unique index bmsql_stock_pkey on bmsql_stock (s_i_id, s_w_id) -- reverse parallel 32 pctfree 1 initrans 3 compute statistics; create unique index bmsql_item_pkey on bmsql_item (i_id) pctfree 5 initrans 4 compute statistics;
true
b61caead8ad96deb968fb173d858bc0aa6bc7c0c
SQL
Nanask/Biz_403_2021_04_DBMS
/하나마트/하나마트(2021-05-31-MySQL).sql
UTF-8
4,102
4.28125
4
[]
no_license
-- 하나마트 -- 데이터베이스 생성 CREATE DATABASE nhDB; -- 데이터베이스를 사용하기 위한 연결, 사용할 Database에 연결하기 USE nhDB; DROP table tbl_iolist; -- table 생성 CREATE TABLE tbl_iolist ( io_seq BIGINT AUTO_INCREMENT PRIMARY KEY, io_date VARCHAR(10) NOT NULL, io_time VARCHAR(10) NOT NULL, io_pname VARCHAR(50) NOT NULL, io_bname VARCHAR(50) NOT NULL, io_dceo VARCHAR(20) NOT NULL, io_inout VARCHAR(5) NOT NULL, io_qty INT NOT NULL, io_price INT NOT NULL ); -- 테이블 확인 DESC tbl_iolist; -- 테이블 데이터 확인 SELECT COUNT(*) tbl_iolist; -- 매입과 매출의 합계 -- io_inout 칼럼 1이면 매입, 2이면 매출 -- 수량*단계를 곱하여 합계계산 SELECT (io_qty * io_price) 합계 FROM tbl_iolist; -- 통계함수와 GROUP을 이용하여 매입합계, 매출합계 SELECT SUM(io_qty * io_price) 합계 FROM tbl_iolist GROUP BY io_inout; -- 값이 나왔으나 1,2 번으로만 나와서 구분하기 어려움 SELECT io_inout,SUM(io_qty * io_price) 합계 FROM tbl_iolist GROUP BY io_inout; -- case, end 를 사용 -- Oracle DECODE(조건, true, false) SELECT CASE WHEN io_inout = '1' THEN '매입' WHEN io_inout = '2' THEN '매출' END AS '구분', SUM(io_qty * io_price) AS '합계' FROM tbl_iolist GROUP BY io_inout; -- if(조건, true, false) : MySQL 전용함수 SELECT IF(io_inout = '1','매입','매출') AS 구분, SUM(io_qty * io_price) AS 합계 FROM tbl_iolist GROUP BY io_inout; -- 매입합계와 매출합계를 PIVOT 형식으로 조회 SELECT SUM(if(io_inout = '1', io_qty * io_price , 0)) AS 매입, SUM(if(io_inout = '2', io_qty * io_price , 0)) AS 매출 FROM tbl_iolist; -- 일자별로 보여주기 SELECT io_date AS 일자, SUM(if(io_inout = '1', io_qty * io_price , 0)) AS 매입, SUM(if(io_inout = '2', io_qty * io_price , 0)) AS 매출 FROM tbl_iolist GROUP BY io_date ORDER BY io_date; -- 거래처별로 매입, 매출합계 -- 거래처는 무조건 GROUP BY를 사용해줘야 한다. -- PiVOT 방식으로 조회하기, IF 사용 SELECT io_bname AS 거래처, SUM(if(io_inout = '1', io_qty * io_price, 0)) AS 매입, SUM(if(io_inout = '2', io_qty * io_price, 0)) AS 매출 FROM tbl_iolist GROUP BY io_bname ORDER BY io_bname; -- if문을 사용하지 않고 조회하기, CASE WHEN 사용 -- 표준 SQL을 사용하여 거래처별로 매입 매출 합계 SELECT io_bname, SUM(CASE WHEN io_inout = '1' THEN io_qty * io_price ELSE 0 END) AS 매입, SUM(CASE WHEN io_inout = '2' THEN io_qty * io_price ELSE 0 END) AS 매출 FROM tbl_iolist GROUP BY io_bname; -- 2020년 4월의 매입매출 전체리스트 조회 SELECT * FROM tbl_iolist WHERE io_date BETWEEN '2020-04-01' AND '2020-04-31'; -- 2020년 4월의 거래처별로 매입매출 합계 SELECT io_bname AS 거래처, io_date AS 날짜, SUM(CASE WHEN io_inout = '1' THEN io_qty * io_price ELSE 0 END) AS 매입, SUM(CASE WHEN io_inout = '2' THEN io_qty * io_price ELSE 0 END) AS 매출 FROM tbl_iolist WHERE io_date BETWEEN '2020-04-01' AND '2020-04-31' GROUP BY io_bname, io_date ORDER BY io_bname; -- LEFT, MID, RIGHT -- 문자열 칼럼의 데이터를 일부만 추출할때 -- LEFT(칼럼, 개수) : 왼쪽부터 문자열 추출 -- MID(칼럼, 위치, 개수) : 중간문자열 추출 -- Oracle SUBSTR(칼럼, 의지, 개수) -- RIGHT(칼럼, 개수) : 오른쪽부터 문자열 추출 SELECT * FROM tbl_iolist WHERE left(io_date,7) = '2020-04'; SELECT LEFT('대한민국',2); SELECT LEFT('Republic of','2'); -- MySQL은 언어와 관계없이 글자수로 인식 SELECT LEFT('대한민국',2), LEFT('Korea',2); SELECT MID('대한민국',2,2), MID('Korea',2,2); SELECT right('대한민국',2), right('korea',2); CREATE TABLE tbl_dept ( dp_code CHAR(5) PRIMARY KEY, dp_name VARCHAR(50) NOT NULL, dp_ceo VARCHAR(50) NOT NULL, dp_tel VARCHAR(20) , dp_addr VARCHAR(125) ); CREATE TABLE tbl_product ( p_code CHAR(6) PRIMARY KEY, p_name VARCHAR(50) NOT NULL, p_iprice INT NOT NULL, p_oprice INT NOT NULL, p_vat VARCHAR(1) DEFAULT '' );
true
d858cd6c00a073be7f515ac4db87f3aec2191b42
SQL
maflorvega/Redash_queries
/queries_versioned/178_Amount of views for Baidu2.sql
UTF-8
582
2.78125
3
[]
no_license
/* Name: Amount of views for Baidu2 Data source: 4 Created By: Admin Last Update At: 2016-02-10T20:31:22.023402+00:00 */ SELECT count(*) AS value FROM (TABLE_QUERY(djomniture:cipomniture_djmansionglobal,'CONCAT(REPLACE(table_id,"_","-"),"-01") BETWEEN STRFTIME_UTC_USEC("{{startdate}}", "%Y-%m-01") and STRFTIME_UTC_USEC("{{enddate}}", "%Y-%m-31")')) WHERE LOWER(post_prop19)='home' AND post_prop10 LIKE '%djcm_pdadcn_baidu%' AND DATE(date_time) >= DATE('{{startdate}}') AND DATE(date_time) <= DATE('{{enddate}}') AND post_page_event = "0" /*Page View Calls*/
true