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
2c25e0f73f86ed03c617f70681969b592a3133ca
SQL
skdsh/Beleg_Gruppe8
/kundenkartei.sql
UTF-8
3,582
3.1875
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 4.9.2 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Erstellungszeit: 06. Jan 2020 um 20:49 -- Server-Version: 10.4.10-MariaDB -- PHP-Version: 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 */; -- -- Datenbank: `kundenkartei` -- -- -------------------------------------------------------- -- -- Tabellenstruktur für Tabelle `kunde` -- CREATE TABLE `kunde` ( `id` varchar(12) NOT NULL, `zaehlerNr` int(8) NOT NULL, `knachname` varchar(100) NOT NULL, `vorname` varchar(100) NOT NULL, `email` varchar(50) NOT NULL, `telNr` varchar(20) NOT NULL, `Bem` text DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Daten für Tabelle `kunde` -- INSERT INTO `kunde` (`id`, `zaehlerNr`, `knachname`, `vorname`, `email`, `telNr`, `Bem`) VALUES ('base77852214', 77852214, 'Base', 'Karl', 'kb@g.de', '47114887', NULL), ('eber11111111', 11111111, 'ebert', 'jack', 'ja@g.de', '1232312', 'AAAAAA'), ('kusc45456262', 45456262, 'Kuschel', 'Emma', 'ke@g.de', '47112271', NULL), ('meie12321232', 12321232, 'Meierhofer', 'Anton', 'ma@g.de', '47114856', NULL), ('sonn11223344', 11223344, 'Sonnenschein', 'Susi', 'sose@g.de', '47115623', NULL), ('Arnd09090909', 9090909, 'Arndt', 'Marco', 'am@g.de', '987654', 'alle i.o.'), ('Hose78945612', 78945612, 'Hose', 'Justus', 'fgh@g.de', '745122', 'k.A.'); -- -------------------------------------------------------- -- -- Tabellenstruktur für Tabelle `mitarbeiter` -- CREATE TABLE `mitarbeiter` ( `mitarbeiterID` varchar(50) NOT NULL, `mNachname` varchar(50) NOT NULL, `mVorname` varchar(50) NOT NULL, `email` varchar(50) NOT NULL, `telNr` varchar(20) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -------------------------------------------------------- -- -- Tabellenstruktur für Tabelle `zaehler` -- CREATE TABLE `zaehler` ( `zaehlerNr` int(8) NOT NULL, `ort` varchar(50) NOT NULL, `plz` varchar(15) NOT NULL, `str` varchar(50) NOT NULL, `hNr` int(10) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Daten für Tabelle `zaehler` -- INSERT INTO `zaehler` (`zaehlerNr`, `ort`, `plz`, `str`, `hNr`) VALUES (11111111, 'Berlin', '12689', 'Barnimstreet', 12); -- -------------------------------------------------------- -- -- Tabellenstruktur für Tabelle `zaehlerstaende` -- CREATE TABLE `zaehlerstaende` ( `zaehlerNr` int(8) NOT NULL, `zaehlerstand` int(255) DEFAULT NULL, `aeDatum` varchar(20) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Daten für Tabelle `zaehlerstaende` -- INSERT INTO `zaehlerstaende` (`zaehlerNr`, `zaehlerstand`, `aeDatum`) VALUES (9090909, 1000, '2019-12-23 11:42:37'), (11111111, 1000, '2019-12-23 11:51:58'), (11111111, 1000, '2019-12-30 11:13:52'), (11111111, 456, '2019-12-30 12:11:59'); -- -- Indizes der exportierten Tabellen -- -- -- Indizes für die Tabelle `mitarbeiter` -- ALTER TABLE `mitarbeiter` ADD PRIMARY KEY (`mitarbeiterID`), ADD UNIQUE KEY `mitarbeiterID` (`mitarbeiterID`); -- -- Indizes für die Tabelle `zaehler` -- ALTER TABLE `zaehler` ADD PRIMARY KEY (`zaehlerNr`) USING BTREE; 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
f1fc1038803fe8a0d9630f5b26539a1b6fd77e8d
SQL
roylanceMichael/is_6480_datawarehousing_utah
/populate_facts/6_AggregatePopulate.sql
UTF-8
957
4.25
4
[]
no_license
-- select distinct MemberClass from Country where MemberClass is not null -- select * from Country where MemberClass in ('G8', 'BRIC') insert into GDP_Debt_AggregateFact(GDP, DebtTotal, NationalSavingsTotal, GDP_Debt_Ratio, MemberClass_Key, Time_Key) select -- sum(log(GDP)) as LogGDP, -- sum(ifnull(log(DebtTotal), 0)) as LogDebt, -- sum(ifnull(log(NationalSavingsTotal), 0)) as LogNationalSavings, -- sum(ifnull(log(GDP) / log(DebtTotal), 0)) as LogRatio, sum(GDP) as GDP, sum(DebtTotal) as Debt, sum(NationalSavingsTotal) as NationalSavings, sum(DebtTotal / GDP) as Ratio, case b.MemberClass when 'G8' then 2 when 'BRIC' then 1 else 3 end as MemberClass, c.Time_Key -- date(concat(cast(c.Year as char(4)), '-1-1')) as Year from GDP_To_Debt_Fact a join Country b on a.Country_Key = b.Country_Key join Time c on a.Time_Key = c.Time_Key where c.Year > 1979 group by b.MemberClass, c.Year order by b.MemberClass
true
65636f7b50992dae54f0a71ec3ea7e484e5195f2
SQL
CUBRID/cubrid-testcases
/sql/_13_issues/_15_1h/cases/bug_bts_16039.sql
UTF-8
1,643
3.296875
3
[ "BSD-3-Clause" ]
permissive
drop table if exists t; create table t (a int, b int); insert into t values(1,1),(2,2),(3,3); select percentile_cont(0.2) within group (order by a) over(partition by b, a) p_cont from t order by percentile_cont(0.5) within group (order by a) over(); select percentile_cont(0.2) within group (order by a) over(partition by b, a) p_cont1, percentile_cont(0.5) within group (order by a) over() p_cont2 from t order by 1, 2; select percentile_cont(0.2) within group (order by a) over(partition by b, a) p_cont1, percentile_cont(0.5) within group (order by a) over(partition by b, a) p_cont2 from t order by 1, 2; select percentile_cont(0.2) within group (order by a) over(partition by b, a) p_cont1, percentile_cont(0.5) within group (order by a) over(partition by b) p_cont2 from t order by 1, 2; drop table if exists t; create table t (a varchar, b varchar); insert into t values('1', '1'),('2', '2'),('3', '3'); select percentile_cont(0.2) within group (order by a) over(partition by b, a) p_cont from t order by percentile_cont(0.5) within group (order by a) over(); select percentile_cont(0.2) within group (order by a) over(partition by b, a) p_cont1, percentile_cont(0.5) within group (order by a) over() p_cont2 from t order by 1, 2; select percentile_cont(0.2) within group (order by a) over(partition by b, a) p_cont1, percentile_cont(0.5) within group (order by a) over(partition by b, a) p_cont2 from t order by 1, 2; select percentile_cont(0.2) within group (order by a) over(partition by b, a) p_cont1, percentile_cont(0.5) within group (order by a) over(partition by b) p_cont2 from t order by 1, 2; drop table if exists t;
true
81ec435519ba88fec38f91649ccf88ec4e796b21
SQL
GloryXu/spring-boot
/doc/dbdemo/createSql.sql
UTF-8
1,187
3.125
3
[]
no_license
drop table `department`; CREATE TABLE `department` ( `id` int NOT NULL AUTO_INCREMENT COMMENT '主键', `name` VARCHAR(255) NOT NULL COMMENT '部门名称', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT= 1 DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='部门表'; drop table `user`; CREATE TABLE `user` ( `id` int NOT NULL AUTO_INCREMENT COMMENT '主键', `name` VARCHAR(255) NOT NULL COMMENT '用户名称', `createdate` timestamp COMMENT '创建时间', `did` int NOT NULL COMMENT '部门ID', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT= 1 DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='用户表'; drop table `role`; CREATE TABLE `role` ( `id` int NOT NULL AUTO_INCREMENT COMMENT '主键', `name` VARCHAR(255) NOT NULL COMMENT '角色名称', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT= 1 DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='角色表'; drop table `user_role`; CREATE TABLE `user_role` ( `id` int NOT NULL AUTO_INCREMENT COMMENT '主键', `roles_id` int NOT NULL COMMENT '角色ID', `user_id` int NOT NULL COMMENT '用户ID', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT= 1 DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='用户角色关联表';
true
37d66db5e04fa1d6f5bdad981503125e7a723ade
SQL
ShamimsJava/plsql
/class/exam4/exam.sql
UTF-8
1,098
3.65625
4
[]
no_license
create table employees( eId number primary key, eName varchar2(20), salary number, hireDate date, address varchar2(20) ); desc employees; alter table employees add( phone number, jobTitle varchar2(20) ); desc employees; insert into employees values(101, 'Harry', 25000, '25-JAN-16', 'Mirpur', 52462, 'Programmer'); insert into employees values(102, 'Bill', 26000, '25-FEB-16', 'Agargaon', 547842, 'Developer'); insert into employees values(103, 'Mark', 27000, '25-MAR-16', 'Kalsi', 65894, 'Coder'); insert into employees values(104, 'Steve', 28000, '25-JUN-16', 'Taltola', 85479, 'Manager'); insert into employees values(105, 'Jack', 29000, '25-JUL-16', 'Dhanmondi', 36952, 'Marketing'); select * from employees; select eName, jobTitle, salary, salary+(salary*(30/100)) withBonus from employees; select eName, salary from employees where salary = ( select min(salary) from employees ); update employees set jobTitle = 'Manager'; select * from employees; update employees set salary = 3000, jobTitle = 'Programmer' where eId = 101; select * from employees; drop table employees;
true
b2d4600cab1b9c983755d6e13e7fbdd7c6743537
SQL
erisdinh/work-sher
/Database/create posting & order table.sql
UTF-8
925
3.25
3
[]
no_license
USE `worksher_db`; create table posting( posting_id int(10) unsigned not null auto_increment, user_id int(10) unsigned not null, jobCategory varchar(30) not null, description varchar(100), compensation varchar(30), status varchar(10), portfolio varchar(100), dateCreated date not null, primary key(posting_id), foreign key(user_id) references usertest(user_id) ); create table orders( order_id int(10) unsigned auto_increment not null, requestOrderUser_id int(10) unsigned not null, postOrderUser_id int(10) unsigned not null, posting_id int(10) unsigned not null, description varchar(100), dateRequested timestamp not null default current_timestamp, dateResponsed Date, dateCompleted Date, status varchar(30) not null, primary key(order_id), foreign key(requestOrderUser_id) references usertest(user_id), foreign key(postOrderUser_id) references usertest(user_id), foreign key(posting_id) references posting(posting_id) );
true
e000a612c8cc8ee0b58bd4d139259e79a2916ce0
SQL
Ruk33/AresLands
/sql/tables/items.sql
UTF-8
2,407
3.015625
3
[ "MIT", "LicenseRef-scancode-dco-1.1" ]
permissive
-- -------------------------------------------------------- -- Host: 127.0.0.1 -- Versión del servidor: 5.6.17 - MySQL Community Server (GPL) -- SO del servidor: Win64 -- HeidiSQL Versión: 9.1.0.4867 -- -------------------------------------------------------- /*!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' */; -- Volcando estructura para tabla ironfist_areslands.items CREATE TABLE IF NOT EXISTS `items` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(80) COLLATE utf8_bin NOT NULL, `description` text COLLATE utf8_bin NOT NULL, `level` int(11) NOT NULL, `quality` tinyint(4) NOT NULL DEFAULT '1', `attack_speed` enum('very-slow','slow','normal','fast','very-fast') COLLATE utf8_bin NOT NULL, `body_part` enum('chest','legs','feet','head','hands','lhand','rhand','lrhand','mercenary','none') COLLATE utf8_bin NOT NULL, `type` enum('blunt','bigblunt','sword','bigsword','bow','dagger','staff','bigstaff','hammer','bighammer','ring','axe','shield','potion','arrow','etc','mercenary','none') COLLATE utf8_bin NOT NULL, `class` enum('armor','weapon','mercenary','consumible','none') COLLATE utf8_bin NOT NULL, `price` int(11) NOT NULL, `stat_strength` mediumint(9) NOT NULL, `stat_dexterity` mediumint(9) NOT NULL, `stat_resistance` mediumint(9) NOT NULL, `stat_magic` mediumint(9) NOT NULL, `stat_magic_skill` mediumint(9) NOT NULL, `stat_magic_resistance` mediumint(9) NOT NULL, `selleable` tinyint(1) NOT NULL, `destroyable` tinyint(1) NOT NULL, `tradeable` tinyint(1) NOT NULL, `stackable` tinyint(1) NOT NULL, `skill` varchar(70) COLLATE utf8_bin NOT NULL DEFAULT '0-0', `time_to_appear` int(11) DEFAULT NULL COMMENT 'Tiempo para aparecer/destrabar en minutos', `zone_to_explore` int(11) DEFAULT NULL, `image` text COLLATE utf8_bin NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -- La exportación de datos fue deseleccionada. /*!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
c33cf1b2fb7a3d8b4a950877b37c61a9e330f03f
SQL
sergeymong/SQL
/MySQL/sql-ex.ru/96.sql
UTF-8
855
3.765625
4
[]
no_license
# При условии, что баллончики с красной краской использовались # более одного раза, выбрать из них такие, которыми окрашены квадраты, имеющие голубую компоненту. # Вывести название баллончика USE paint; WITH more_one_ballons AS (SELECT B_V_ID FROM utB WHERE B_V_ID IN (SELECT V_ID FROM utV WHERE V_COLOR = 'R') GROUP BY B_V_ID HAVING COUNT(*) > 1) SELECT V_NAME FROM utV WHERE V_ID IN (SELECT B_V_ID FROM utB WHERE B_Q_ID IN (SELECT B_Q_ID FROM utB LEFT JOIN utV uV on utB.B_V_ID = uV.V_ID GROUP BY B_Q_ID HAVING MIN(uV.V_COLOR) = 'B')) AND V_ID IN (SELECT * FROM more_one_ballons); SELECT SUM()
true
4025b282bb5cb7765083d069cf6ddde9df98188c
SQL
m-linardos/sql
/SchoolDataModel/school_data_model_QUERY.sql
UTF-8
424
3.109375
3
[]
no_license
Select FirstName, LastName from Instructor Where FirstName = 'Mary'; -- Select s.FirstName, s.LastName, c.Subject, c.Number -- from Student s -- INNER JOIN Course c -- ON S.id = C.; Select i.FirstName, i.LastName, c.Subject, c.Number, c.Name From Instructor i Inner Join Course c On i.CourseID = c.ID; Update Instructor Where
true
9d7041e7fd188395cd05e847726e288668f904ff
SQL
PowerDG/DgBook.architect-awesome
/DesignPattern设计模式/Oriented面向对象/入职培训/SQL分享/SQLServer/示例七:结果集筛选位置不妥.sql
GB18030
1,314
3.265625
3
[]
no_license
/**************************************************************************************** 㣺SQLóִУִмƻһġǷŵ洢ͻֲ졣ԭǴ洢̵Ԥ+εִмƻѡ쳣ڲ̽һ ŻС ԭSQL SELECT UserName,SmsContent,SendTime FROM ( select u.UserName,u.PKCompany,sr.SmsContent,SR.SendTime,ROW_NUMBER() OVER(PARTITION BY u.PKCompany ORDER BY u.ClientLastLoginTime desc) AS CNT from SmsRecords sr join Users u on u.Cellphone=sr.CellphoneList and u.PKCompany=sr.PKCompany where u.UserName<>'վί' ) A WHERE PKCompany=@PKCompany AND A.CNT=1 Ķ֮ SELECT UserName,SmsContent,SendTime FROM ( select u.UserName,u.PKCompany,sr.SmsContent,SR.SendTime,ROW_NUMBER() OVER(PARTITION BY u.PKCompany ORDER BY u.ClientLastLoginTime desc) AS CNT from SmsRecords sr join Users u on u.Cellphone=sr.CellphoneList and u.PKCompany=sr.PKCompany where u.UserName<>'վί' and u.PKCompany=@PKCompany ) A WHERE A.CNT=1 ****************************************************************************************/ exec Expert_OA_GetCompanyTackingByType @Type=3,@PKCompany='44F61AE9-BCC5-4FD3-9520-0026A061C06E'
true
c0f543b9acec975e9f250429d840821f384f6a1f
SQL
demetriosmiguel/DOCUMENTOS
/Psd_ClientesInserir.sql
UTF-8
496
2.65625
3
[]
no_license
create PROCEDURE Psd_ClientesInserir @Cli_Nome varchar(255), @Cli_Endereco varchar(255), @Cli_Telefone varchar(100), @Cli_Email varchar(100), @Cli_DataNascimento datetime AS BEGIN INSERT INTO Produtos ( Cli_Nome, Cli_Endereco, Cli_Telefone, Cli_Email, Cli_DataNascimento ) VALUES ( @Cli_Nome, @Cli_Endereco, @Cli_Telefone, @Cli_Email, @Cli_DataNascimento ) select @@IDENTITY AS Retorno END
true
6cf6bdb56d1974a1c95af3c16a10ebc7c12eae3a
SQL
ggboomi/filmSource
/src/main/resources/ziyuan.sql
UTF-8
1,834
3.5625
4
[]
no_license
--用户表 --uid --uname --pwd --power --pic --themenum 发布主题数 --score 积分 create table mUserInfo( muid number(10) primary key, uname varchar2(20) not null, pwd varchar2(20) not null, pow number(1), pic varchar2(100), -- themenum number(10), --论坛里面 score number(10) ); create sequence seq_ziyuan_muserinfo_aid start with 1000; --电影类型表 --tid --mtype --tname 逗号拼接 --数据字典 根据type判断是地区还是类型 create table mFilmType( tid number(10) primary key, mtype number(1) not null, tname varchar2(1000) not null ) create sequence seq_ziyuan_mFilmType_tid start with 1000; -----搜索关键词 地区 类型 年 --文件表 --fid --tids --fname --fpic --grade 评分 --country 地区引用type表 --othername 别名 --year --uptime 上传日期 --dname 导演 --sname 编剧 --aname 主演 --imdb --downname --downlink --beizhu 版本 --intro 简介 clob图文混编 --intropic 逗号分隔的字符串存 drop table mfile create table mfile( fid number(10) primary key, --编号 tids varchar2(200), --逗号拼接tid 类型 fname varchar2(100), --电影名 fpic varchar2(100), --电影海报 grade number(10,2), --评分 country varchar2(20), --国家 myear number(10), --电影年份 uptime Date, --上传时间 othername varchar2(20), --又名 dname varchar2(20), --导演 sname varchar2(20), --编剧 aname varchar2(20), --主演 imdb varchar2(20), downlink varchar2(200), --下载链接 beizhu varchar2(100), --备注 intro clob --简介 ) create sequence seq_ziyuan_mfile_fid start with 1000;
true
53ffc57a281875e07408f4ac2dac005ebf7fbd24
SQL
aracta/VueThink
/php/oa_admin_rule.sql
UTF-8
6,299
3.125
3
[ "Apache-2.0" ]
permissive
/* Navicat MySQL Data Transfer Source Server : root Source Server Version : 50547 Source Host : localhost:3306 Source Database : vuethink Target Server Type : MYSQL Target Server Version : 50547 File Encoding : 65001 Date: 2020-07-21 09:09:06 */ SET FOREIGN_KEY_CHECKS=0; -- ---------------------------- -- Table structure for oa_admin_rule -- ---------------------------- DROP TABLE IF EXISTS `oa_admin_rule`; CREATE TABLE `oa_admin_rule` ( `id` int(11) NOT NULL AUTO_INCREMENT, `title` varchar(100) DEFAULT '' COMMENT '名称', `name` varchar(100) DEFAULT '' COMMENT '定义', `level` tinyint(5) DEFAULT NULL COMMENT '级别。1模块,2控制器,3操作', `pid` int(11) DEFAULT '0' COMMENT '父id,默认0', `status` tinyint(3) DEFAULT '1' COMMENT '状态,1启用,0禁用', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=74 DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of oa_admin_rule -- ---------------------------- INSERT INTO `oa_admin_rule` VALUES ('10', '系统基础功能', 'admin', '1', '0', '1'); INSERT INTO `oa_admin_rule` VALUES ('11', '权限规则', 'rules', '2', '10', '1'); INSERT INTO `oa_admin_rule` VALUES ('13', '规则列表', 'index', '3', '11', '1'); INSERT INTO `oa_admin_rule` VALUES ('14', '权限详情', 'read', '3', '11', '1'); INSERT INTO `oa_admin_rule` VALUES ('15', '编辑权限', 'update', '3', '11', '1'); INSERT INTO `oa_admin_rule` VALUES ('16', '删除权限', 'delete', '3', '11', '1'); INSERT INTO `oa_admin_rule` VALUES ('17', '添加权限', 'save', '3', '11', '1'); INSERT INTO `oa_admin_rule` VALUES ('18', '批量删除权限', 'deletes', '3', '11', '1'); INSERT INTO `oa_admin_rule` VALUES ('19', '批量启用/禁用权限', 'enables', '3', '11', '1'); INSERT INTO `oa_admin_rule` VALUES ('20', '菜单管理', 'menus', '2', '10', '1'); INSERT INTO `oa_admin_rule` VALUES ('21', '菜单列表', 'index', '3', '20', '1'); INSERT INTO `oa_admin_rule` VALUES ('22', '添加菜单', 'save', '3', '20', '1'); INSERT INTO `oa_admin_rule` VALUES ('23', '菜单详情', 'read', '3', '20', '1'); INSERT INTO `oa_admin_rule` VALUES ('24', '编辑菜单', 'update', '3', '20', '1'); INSERT INTO `oa_admin_rule` VALUES ('25', '删除菜单', 'delete', '3', '20', '1'); INSERT INTO `oa_admin_rule` VALUES ('26', '批量删除菜单', 'deletes', '3', '20', '1'); INSERT INTO `oa_admin_rule` VALUES ('27', '批量启用/禁用菜单', 'enables', '3', '20', '1'); INSERT INTO `oa_admin_rule` VALUES ('28', '系统管理', 'systemConfigs', '2', '10', '1'); INSERT INTO `oa_admin_rule` VALUES ('29', '修改系统配置', 'save', '3', '28', '1'); INSERT INTO `oa_admin_rule` VALUES ('30', '岗位管理', 'posts', '2', '10', '1'); INSERT INTO `oa_admin_rule` VALUES ('31', '岗位列表', 'index', '3', '30', '1'); INSERT INTO `oa_admin_rule` VALUES ('32', '岗位详情', 'read', '3', '30', '1'); INSERT INTO `oa_admin_rule` VALUES ('33', '编辑岗位', 'update', '3', '30', '1'); INSERT INTO `oa_admin_rule` VALUES ('34', '删除岗位', 'delete', '3', '30', '1'); INSERT INTO `oa_admin_rule` VALUES ('35', '添加岗位', 'save', '3', '30', '1'); INSERT INTO `oa_admin_rule` VALUES ('36', '批量删除岗位', 'deletes', '3', '30', '1'); INSERT INTO `oa_admin_rule` VALUES ('37', '批量启用/禁用岗位', 'enables', '3', '30', '1'); INSERT INTO `oa_admin_rule` VALUES ('38', '部门管理', 'structures', '2', '10', '1'); INSERT INTO `oa_admin_rule` VALUES ('39', '部门列表', 'index', '3', '38', '1'); INSERT INTO `oa_admin_rule` VALUES ('40', '部门详情', 'read', '3', '38', '1'); INSERT INTO `oa_admin_rule` VALUES ('41', '编辑部门', 'update', '3', '38', '1'); INSERT INTO `oa_admin_rule` VALUES ('42', '删除部门', 'delete', '3', '38', '1'); INSERT INTO `oa_admin_rule` VALUES ('43', '添加部门', 'save', '3', '38', '1'); INSERT INTO `oa_admin_rule` VALUES ('44', '批量删除部门', 'deletes', '3', '38', '1'); INSERT INTO `oa_admin_rule` VALUES ('45', '批量启用/禁用部门', 'enables', '3', '38', '1'); INSERT INTO `oa_admin_rule` VALUES ('46', '用户组管理', 'groups', '2', '10', '1'); INSERT INTO `oa_admin_rule` VALUES ('47', '用户组列表', 'index', '3', '46', '1'); INSERT INTO `oa_admin_rule` VALUES ('48', '用户组详情', 'read', '3', '46', '1'); INSERT INTO `oa_admin_rule` VALUES ('49', '编辑用户组', 'update', '3', '46', '1'); INSERT INTO `oa_admin_rule` VALUES ('50', '删除用户组', 'delete', '3', '46', '1'); INSERT INTO `oa_admin_rule` VALUES ('51', '添加用户组', 'save', '3', '46', '1'); INSERT INTO `oa_admin_rule` VALUES ('52', '批量删除用户组', 'deletes', '3', '46', '1'); INSERT INTO `oa_admin_rule` VALUES ('53', '批量启用/禁用用户组', 'enables', '3', '46', '1'); INSERT INTO `oa_admin_rule` VALUES ('54', '成员管理', 'users', '2', '10', '1'); INSERT INTO `oa_admin_rule` VALUES ('55', '成员列表', 'index', '3', '54', '1'); INSERT INTO `oa_admin_rule` VALUES ('56', '成员详情', 'read', '3', '54', '1'); INSERT INTO `oa_admin_rule` VALUES ('57', '删除成员', 'delete', '3', '54', '1'); INSERT INTO `oa_admin_rule` VALUES ('59', '管理菜单', 'Adminstrative', '2', '10', '1'); INSERT INTO `oa_admin_rule` VALUES ('61', '系统管理二级菜单', 'systemConfig', '1', '59', '1'); INSERT INTO `oa_admin_rule` VALUES ('62', '账户管理二级菜单', 'personnel', '3', '59', '1'); INSERT INTO `oa_admin_rule` VALUES ('63', '组织架构二级菜单', 'structures', '3', '59', '1'); INSERT INTO `oa_admin_rule` VALUES ('65', '项目管理', 'projects', '2', '10', '1'); INSERT INTO `oa_admin_rule` VALUES ('66', '项目列表', 'index', '3', '65', '1'); INSERT INTO `oa_admin_rule` VALUES ('67', '编辑项目', 'update', '3', '65', '1'); INSERT INTO `oa_admin_rule` VALUES ('68', '项目难度评分', 'projectDfcltrcd', '1', '10', '1'); INSERT INTO `oa_admin_rule` VALUES ('69', '编辑和保存', 'update', '3', '68', '1'); INSERT INTO `oa_admin_rule` VALUES ('70', '添加项目', 'save', '3', '65', '1'); INSERT INTO `oa_admin_rule` VALUES ('71', '项目得分', 'projectRcd', '2', '10', '1'); INSERT INTO `oa_admin_rule` VALUES ('72', '编辑和保存', 'update', '3', '71', '1'); INSERT INTO `oa_admin_rule` VALUES ('73', '删除项目', 'delete', '3', '65', '1');
true
4dcd9872350f44837aa6048239eb7286b49a7a7a
SQL
DenisVasenin/Labs
/BD/Lab5/filler.sql
UTF-8
6,121
3.015625
3
[]
no_license
-- SCRIPT CREATED BY I.EGOSHIN -- FILL COMPANY TABLE PROCEDURE DROP PROCEDURE IF EXISTS fillCompany; DELIMITER // CREATE PROCEDURE fillCompany() BEGIN SET @counter = 0; WHILE (@counter < 100) DO INSERT INTO company VALUES (NULL, concat(substring('ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789', rand(@seed:=round(rand()*4294967296))*36+1, 1), substring('ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789', rand(@seed:=round(rand(@seed)*4294967296))*36+1, 1), substring('ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789', rand(@seed:=round(rand(@seed)*4294967296))*36+1, 1), substring('ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789', rand(@seed:=round(rand(@seed)*4294967296))*36+1, 1), substring('ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789', rand(@seed:=round(rand(@seed)*4294967296))*36+1, 1), substring('ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789', rand(@seed:=round(rand(@seed)*4294967296))*36+1, 1), substring('ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789', rand(@seed:=round(rand(@seed)*4294967296))*36+1, 1),substring('ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789', rand(@seed)*36+1, 1)), FLOOR(1980 + RAND()*37)); SET @counter = @counter + 1; END WHILE; END// DELIMITER ; -- FILL DEALER TABLE PROCEDURE DROP PROCEDURE IF EXISTS fillDealer; DELIMITER // CREATE PROCEDURE fillDealer() BEGIN SET @counter = 0; WHILE (@counter < 100) DO INSERT INTO dealer VALUES (NULL, FLOOR(1 + RAND()*99), concat(substring('ABCDEFGHIJKLMNOPQRSTUVWXYZ', FLOOR(1 + RAND()*26), 1), substring('abcdefghijklmnopqestuvwxyz', FLOOR(1 + RAND()*26), 1), substring('abcdefghijklmnopqestuvwxyz', FLOOR(1 + RAND()*26), 1), substring('abcdefghijklmnopqestuvwxyz', FLOOR(1 + RAND()*26), 1), substring('abcdefghijklmnopqestuvwxyz', FLOOR(1 + RAND()*26), 1), substring('abcdefghijklmnopqestuvwxyz', FLOOR(1 + RAND()*26), 1), substring('abcdefghijklmnopqestuvwxyz', FLOOR(1 + RAND()*26), 1), substring('abcdefghijklmnopqestuvwxyz', FLOOR(1 + RAND()*26), 1)), concat('79', substring('0123456789', FLOOR(1 + RAND()*10), 1), substring('0123456789', FLOOR(1 + RAND()*10), 1), substring('0123456789', FLOOR(1 + RAND()*10), 1), substring('0123456789', FLOOR(1 + RAND()*10), 1), substring('0123456789', FLOOR(1 + RAND()*10), 1), substring('0123456789', FLOOR(1 + RAND()*10), 1), substring('0123456789', FLOOR(1 + RAND()*10), 1), substring('0123456789', FLOOR(1 + RAND()*10), 1), substring('0123456789', FLOOR(1 + RAND()*10), 1))); SET @counter = @counter + 1; END WHILE; END// DELIMITER ; -- FILL DRUG TABLE PROCEDURE DROP PROCEDURE IF EXISTS fillDrug; DELIMITER // CREATE PROCEDURE fillDrug() BEGIN SET @counter = 0; WHILE (@counter < 100) DO INSERT INTO drug VALUES (NULL, concat(substring('ABCDEFGHIJKLMNOPQRSTUVWXYZ', FLOOR(1 + RAND()*26), 1), substring('abcdefghijklmnopqestuvwxyz', FLOOR(1 + RAND()*26), 1), substring('abcdefghijklmnopqestuvwxyz', FLOOR(1 + RAND()*26), 1), substring('abcdefghijklmnopqestuvwxyz', FLOOR(1 + RAND()*26), 1), substring('abcdefghijklmnopqestuvwxyz', FLOOR(1 + RAND()*26), 1), substring('abcdefghijklmnopqestuvwxyz', FLOOR(1 + RAND()*26), 1), substring('abcdefghijklmnopqestuvwxyz', FLOOR(1 + RAND()*26), 1), substring('abcdefghijklmnopqestuvwxyz', FLOOR(1 + RAND()*26), 1)), FLOOR(1 + RAND()*70)); SET @counter = @counter + 1; END WHILE; END// DELIMITER ; -- FILL PHARMACY TABLE PROCEDURE DROP PROCEDURE IF EXISTS fillPharmacy; DELIMITER // CREATE PROCEDURE fillPharmacy() BEGIN SET @counter = 0; WHILE (@counter < 100) DO INSERT INTO pharmacy VALUES (NULL, concat(substring('ABCDEFGHIJKLMNOPQRSTUVWXYZ', FLOOR(1 + RAND()*26), 1), substring('abcdefghijklmnopqestuvwxyz', FLOOR(1 + RAND()*26), 1), substring('abcdefghijklmnopqestuvwxyz', FLOOR(1 + RAND()*26), 1), substring('abcdefghijklmnopqestuvwxyz', FLOOR(1 + RAND()*26), 1), substring('abcdefghijklmnopqestuvwxyz', FLOOR(1 + RAND()*26), 1), substring('abcdefghijklmnopqestuvwxyz', FLOOR(1 + RAND()*26), 1), substring('abcdefghijklmnopqestuvwxyz', FLOOR(1 + RAND()*26), 1), substring('abcdefghijklmnopqestuvwxyz', FLOOR(1 + RAND()*26), 1)), concat(substring('ABCDEFGHIJKLMNOPQRSTUVWXYZ', FLOOR(1 + RAND()*26), 1), substring('abcdefghijklmnopqestuvwxyz', FLOOR(1 + RAND()*26), 1), substring('abcdefghijklmnopqestuvwxyz', FLOOR(1 + RAND()*26), 1), substring('abcdefghijklmnopqestuvwxyz', FLOOR(1 + RAND()*26), 1), substring('abcdefghijklmnopqestuvwxyz', FLOOR(1 + RAND()*26), 1), substring('abcdefghijklmnopqestuvwxyz', FLOOR(1 + RAND()*26), 1), substring('abcdefghijklmnopqestuvwxyz', FLOOR(1 + RAND()*26), 1), substring('abcdefghijklmnopqestuvwxyz', FLOOR(1 + RAND()*26), 1))); SET @counter = @counter + 1; END WHILE; END// DELIMITER ; -- FILL CONSIGNMENT TABLE PROCEDURE DROP PROCEDURE IF EXISTS fillConsignment; DELIMITER // CREATE PROCEDURE fillConsignment() BEGIN SET @counter = 0; WHILE (@counter < 100) DO INSERT INTO consignment VALUES (NULL, FLOOR(1 + RAND()*99), FLOOR(1 + RAND()*99), FLOOR(1 + RAND()*8000), FLOOR(1 + RAND()*200)); SET @counter = @counter + 1; END WHILE; END// DELIMITER ; -- FILL DRUG_ORDER TABLE PROCEDURE DROP PROCEDURE IF EXISTS fillDrugOrder; DELIMITER // CREATE PROCEDURE fillDrugOrder() BEGIN SET @counter = 0; WHILE (@counter < 100) DO INSERT INTO drug_order VALUES (NULL, FLOOR(1 + RAND()*99), FLOOR(1 + RAND()*99), FLOOR(1 + RAND()*99), FLOOR(1 + RAND()*6000), NOW() - INTERVAL FLOOR(RAND() * 10) YEAR - INTERVAL FLOOR(RAND() * 3) MONTH - INTERVAL FLOOR(RAND() * 14) DAY); SET @counter = @counter + 1; END WHILE; END// DELIMITER ; -- DELETE FROM company; ALTER TABLE company AUTO_INCREMENT = 1; CALL fillCompany(); DELETE FROM dealer; ALTER TABLE dealer AUTO_INCREMENT = 1; CALL fillDealer(); DELETE FROM drug; ALTER TABLE drug AUTO_INCREMENT = 1; CALL fillDrug(); DELETE FROM pharmacy; ALTER TABLE pharmacy AUTO_INCREMENT = 1; CALL fillPharmacy(); DELETE FROM consignment; ALTER TABLE consignment AUTO_INCREMENT = 1; CALL fillConsignment(); DELETE FROM drug_order; ALTER TABLE drug_order AUTO_INCREMENT = 1; CALL fillDrugOrder();
true
ed423de276d2040e83798d15bf5b0f111b680696
SQL
Tepozyolca/Evaluation-semaine-48
/Gescom Q24.sql
UTF-8
197
3.09375
3
[]
no_license
SELECT @Valeur := SELECT cat_id FROM categories WHERE = "Tondeuses électriques" DELETE FROM products WHERE pro_cat_id = @Valeur AND pro_id NOT IN (SELECT ode_pro_id FROM orders_details WHERE 1)
true
bfe1bca476395bb41d363df34077b7e30a10af85
SQL
Muzaffardjan/qashstat
/module/Media/data/tables/videos.sql
UTF-8
859
2.703125
3
[]
no_license
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 */; -- -- База данных: `sohibqiron` -- -- -------------------------------------------------------- -- -- Структура таблицы `videos` -- CREATE TABLE IF NOT EXISTS `videos` ( `id` int(11) NOT NULL AUTO_INCREMENT, `src` text NOT NULL, `time` int(11) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; /*!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
6135beef7ca41f79545cf1edac087f90d37f35e0
SQL
karolis1314/Delivery-System
/Sql/TriggerSQL.sql
UTF-8
268
2.75
3
[]
no_license
use newsagent2021; DROP TRIGGER IF EXISTS orders_after_insert; DELIMITER // CREATE TRIGGER orders_after_insert BEFORE INSERT on DELIVERY_DOCKETS FOR EACH ROW BEGIN update publication set stock = stock - 1 where stock > 0 and id = new.publicationID; END//
true
58f972a2908b1c3af5a1e13360c8e75a61dbac9a
SQL
laleman-eng/apiassa
/Querys/Lista de Polizas para crear Tarjeta equipo y entrega.sql
UTF-8
1,115
2.90625
3
[]
no_license
Select T1.idstrNoPoliza ,T2.strIdAseguradora ,T2.strNomAse ,T1.strNoReciboInt ,T2.CardCode ,LEFT(T2.CardName,30) AS CardName ,T6.strRFC AS strRFC ,LEN(T6.strRFC) AS LargoRFC ,T6.bintIdCteOperacion ,T6.bintIdCliente ,T2.intIva ,T5.strCveSap AS Asociado ,T3.strCveSap AS Ejecutivo ,T5.intMTipoContacto as intMTipoContacto1 ,T3.intMTipoContacto AS intMTipoContacto ,T1.dteAplicacion ,T2.strIdProd AS ItemCode ,T2.strNomProd AS ItemName ,T1.dcmPrimaR + T1.dcmDP + T1.dcmRPF AS PrecioNet ,T4.strObservaciones ,T2.intComR FROM appOrdenTrabajo T0 INNER JOIN appEmisionPolizaRecibosS T1 INNER JOIN appEmisionPolizas T2 ON T1.bintIdPoliza = T2.bintIdPoliza ON T0.strIdPoliza = T2.idstrNoPoliza INNER JOIN appMtrContactoAPIASSA T3 INNER JOIN appOPVenta T4 ON T3.SlpCode = T4.SlpCode ON T0.strNOp = T4.strNOp LEFT OUTER JOIN appMtrContactoAPIASSA T5 ON T4.ChnCrdCode = T5.SlpCode JOIN appMtrClientes T6 ON T6.CardCode = T4.CardCode WHERE T1.bintIdStatusRe = 7 AND T1.BitSap = 0 ORDER BY T1.idstrNoPoliza
true
03faf54b904869850df4d93decdf1ec54e8144be
SQL
RyanLiu256/pet_hosting
/sql/pethosting.sql
UTF-8
28,404
3.078125
3
[]
no_license
/* Navicat MySQL Data Transfer Source Server : localhost_3306 Source Server Version : 50721 Source Host : localhost:3306 Source Database : pethosting Target Server Type : MYSQL Target Server Version : 50721 File Encoding : 65001 Date: 2020-06-18 19:22:09 */ SET FOREIGN_KEY_CHECKS=0; -- ---------------------------- -- Table structure for tb_breeds -- ---------------------------- DROP TABLE IF EXISTS `tb_breeds`; CREATE TABLE `tb_breeds` ( `bid` int(11) NOT NULL AUTO_INCREMENT, `species` varchar(20) DEFAULT NULL, `breedPrice` decimal(10,2) DEFAULT NULL, `picture` varchar(255) DEFAULT NULL, PRIMARY KEY (`bid`), UNIQUE KEY `species` (`species`) ) ENGINE=InnoDB AUTO_INCREMENT=42 DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of tb_breeds -- ---------------------------- INSERT INTO `tb_breeds` VALUES ('1', '中华田园犬', '13.00', 'zhonghua.png'); INSERT INTO `tb_breeds` VALUES ('2', '萨摩', '18.00', 'samo.png'); INSERT INTO `tb_breeds` VALUES ('3', '阿富汗猎犬', '25.00', 'afuhan.png'); INSERT INTO `tb_breeds` VALUES ('4', '边境牧羊犬', '34.00', 'bianjing.png'); INSERT INTO `tb_breeds` VALUES ('5', '柴犬', '22.00', 'chaiquan.png'); INSERT INTO `tb_breeds` VALUES ('6', '哈士奇', '18.00', 'hashiqi.png'); INSERT INTO `tb_breeds` VALUES ('7', '金毛', '25.00', 'jinmao.png'); INSERT INTO `tb_breeds` VALUES ('8', '波斯猫', '21.00', 'bosimao.png'); INSERT INTO `tb_breeds` VALUES ('9', '美国短毛猫', '31.00', 'meiguoduanmao.png'); INSERT INTO `tb_breeds` VALUES ('30', '阿拉斯加', '13.00', 'alasijia.png'); INSERT INTO `tb_breeds` VALUES ('38', '贵宾犬', '22.00', 'guibinquan.png'); INSERT INTO `tb_breeds` VALUES ('39', '泰迪', '20.00', 'taidi.png'); INSERT INTO `tb_breeds` VALUES ('40', '吉娃娃', '13.00', 'jiwawa.png'); INSERT INTO `tb_breeds` VALUES ('41', '博美犬', '12.00', 'bomei.png'); -- ---------------------------- -- Table structure for tb_comment -- ---------------------------- DROP TABLE IF EXISTS `tb_comment`; CREATE TABLE `tb_comment` ( `cid` int(11) NOT NULL AUTO_INCREMENT, `day` datetime DEFAULT CURRENT_TIMESTAMP, `comment` varchar(255) DEFAULT NULL, `reply` varchar(255) DEFAULT NULL, PRIMARY KEY (`cid`) ) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of tb_comment -- ---------------------------- INSERT INTO `tb_comment` VALUES ('1', '2020-06-05 16:48:30', '很好很好', null); INSERT INTO `tb_comment` VALUES ('2', '2020-06-05 16:48:30', '很好很好', null); INSERT INTO `tb_comment` VALUES ('3', '2020-06-05 16:48:30', 'heiheihei', null); INSERT INTO `tb_comment` VALUES ('4', '2020-06-05 16:48:30', 'heiheihei', null); INSERT INTO `tb_comment` VALUES ('5', '2020-06-05 16:48:30', 'heiheihei', null); INSERT INTO `tb_comment` VALUES ('6', '2020-06-05 16:48:30', '感觉害行吧,可以接受', '谢谢'); INSERT INTO `tb_comment` VALUES ('7', '2020-06-05 16:48:30', '非常好的服务', '谢谢支持'); INSERT INTO `tb_comment` VALUES ('8', '2020-06-05 16:48:30', '服务很好', '谢谢您的支持'); INSERT INTO `tb_comment` VALUES ('9', '2020-06-05 16:48:30', '服务不错,下次还来', null); INSERT INTO `tb_comment` VALUES ('10', '2020-06-05 16:48:30', '服务态度很好,赞一个', null); INSERT INTO `tb_comment` VALUES ('11', '2020-06-05 16:48:30', '服务很到位', '感谢支持'); INSERT INTO `tb_comment` VALUES ('12', '2020-06-05 16:48:30', '服务不错,下次还来', null); INSERT INTO `tb_comment` VALUES ('13', '2020-06-05 16:48:30', '托管负责人服务很周到', null); INSERT INTO `tb_comment` VALUES ('14', '2020-06-05 18:15:34', '一般般吧', null); INSERT INTO `tb_comment` VALUES ('15', '2020-06-06 05:25:09', '不错不错,服务很好。', '您的肯定是我们的动力!'); -- ---------------------------- -- Table structure for tb_deposit -- ---------------------------- DROP TABLE IF EXISTS `tb_deposit`; CREATE TABLE `tb_deposit` ( `id` int(11) NOT NULL AUTO_INCREMENT, `userid` int(11) DEFAULT NULL, `username` varchar(20) NOT NULL, `petname` varchar(20) NOT NULL, `age` decimal(10,2) DEFAULT NULL, `weight` decimal(10,2) DEFAULT NULL, `startTime` date NOT NULL, `endTime` date NOT NULL, `day_count` int(11) NOT NULL, `total_price` decimal(10,2) NOT NULL, `species_id` int(11) NOT NULL, `food_id` int(11) NOT NULL, `keeper_id` int(11) NOT NULL, `state` int(11) DEFAULT '4', `ispay` int(11) DEFAULT '2', `isprove` int(11) DEFAULT NULL, `reason` varchar(255) DEFAULT NULL, `comment_id` int(11) DEFAULT NULL, PRIMARY KEY (`id`), KEY `tb_deposit_ibfk_3` (`keeper_id`), KEY `tb_deposit_food` (`food_id`), KEY `tb_deposit_ibfk_1` (`species_id`), KEY `userid` (`userid`), KEY `username` (`username`), CONSTRAINT `tb_deposit_food` FOREIGN KEY (`food_id`) REFERENCES `tb_petfood` (`pid`) ON UPDATE CASCADE, CONSTRAINT `tb_deposit_ibfk_1` FOREIGN KEY (`species_id`) REFERENCES `tb_breeds` (`bid`) ON UPDATE CASCADE, CONSTRAINT `tb_deposit_ibfk_3` FOREIGN KEY (`keeper_id`) REFERENCES `tb_keeper` (`kid`) ON UPDATE CASCADE, CONSTRAINT `tb_deposit_ibfk_4` FOREIGN KEY (`userid`) REFERENCES `tb_user` (`id`) ON UPDATE CASCADE, CONSTRAINT `tb_deposit_ibfk_5` FOREIGN KEY (`username`) REFERENCES `tb_user` (`username`) ON UPDATE CASCADE ) ENGINE=InnoDB AUTO_INCREMENT=113 DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of tb_deposit -- ---------------------------- INSERT INTO `tb_deposit` VALUES ('28', '29', '张三', '旺财', '1.00', '2.00', '2020-05-01', '2020-05-07', '6', '570.00', '7', '3', '1', '3', '1', '1', null, '7'); INSERT INTO `tb_deposit` VALUES ('29', '29', '张三', 'vv', '1.00', '1.00', '2020-05-01', '2020-05-02', '1', '57.00', '1', '1', '1', '3', '1', '1', '太胖', null); INSERT INTO `tb_deposit` VALUES ('31', '29', '张三', 'meimei', '1.00', '1.00', '2020-05-01', '2020-05-09', '8', '216.00', '2', '2', '1', '3', '1', '1', null, '8'); INSERT INTO `tb_deposit` VALUES ('32', '29', '张三', '小四', '1.00', '1.00', '2020-05-08', '2020-05-09', '1', '28.00', '1', '3', '1', '3', '1', '1', null, '6'); INSERT INTO `tb_deposit` VALUES ('39', '29', '张三', 'a', '1.00', '1.00', '2020-01-01', '2020-01-03', '2', '142.00', '2', '1', '1', '3', '1', '0', null, null); INSERT INTO `tb_deposit` VALUES ('40', '29', '张三', 'b', '1.00', '2.00', '2020-02-01', '2020-02-06', '5', '350.00', '3', '2', '1', '3', '1', '1', null, null); INSERT INTO `tb_deposit` VALUES ('41', '29', '张三', 'c', '2.00', '3.00', '2020-03-01', '2020-03-05', '4', '404.00', '4', '8', '2', '3', '1', '1', null, '13'); INSERT INTO `tb_deposit` VALUES ('42', '29', '张三', 'd', '2.00', '2.00', '2020-06-01', '2020-06-05', '4', '260.00', '6', '6', '2', '1', '1', '1', null, null); INSERT INTO `tb_deposit` VALUES ('43', '29', '张三', 'e', '2.00', '4.00', '2020-07-02', '2020-07-05', '3', '183.00', '30', '14', '1', '1', '1', '1', null, null); INSERT INTO `tb_deposit` VALUES ('44', '29', '张三', 'f', '2.00', '2.00', '2020-08-01', '2020-08-05', '4', '292.00', '2', '3', '1', '1', '1', '1', null, null); INSERT INTO `tb_deposit` VALUES ('45', '29', '张三', 'g', '2.00', '3.00', '2020-09-01', '2020-09-03', '2', '204.00', '4', '4', '1', '1', '1', '1', null, null); INSERT INTO `tb_deposit` VALUES ('46', '29', '张三', 'h', '2.00', '1.00', '2020-10-01', '2020-10-04', '3', '141.00', '2', '2', '1', '3', '1', '1', null, null); INSERT INTO `tb_deposit` VALUES ('48', '29', '张三', 'j', '2.00', '2.00', '2020-12-02', '2020-12-03', '1', '95.00', '3', '3', '1', '3', '1', '1', null, null); INSERT INTO `tb_deposit` VALUES ('49', '29', '张三', '旺财', '2.00', '3.00', '2020-01-01', '2020-01-04', '3', '192.00', '2', '1', '4', '3', '1', '1', null, null); INSERT INTO `tb_deposit` VALUES ('50', '40', '李四', 'tom', '2.00', '2.00', '2020-01-01', '2020-01-03', '2', '128.00', '2', '3', '3', '3', '1', '1', null, null); INSERT INTO `tb_deposit` VALUES ('51', '40', '李四', 'lulu', '2.00', '1.00', '2020-01-01', '2020-01-09', '8', '424.00', '5', '5', '5', '3', '1', '1', null, null); INSERT INTO `tb_deposit` VALUES ('52', '40', '李四', 'momo', '2.00', '2.00', '2020-02-01', '2020-02-05', '4', '272.00', '8', '8', '1', '3', '1', '1', null, null); INSERT INTO `tb_deposit` VALUES ('53', '23', '赵六', 'nini', '2.00', '3.00', '2020-02-01', '2020-02-05', '4', '300.00', '39', '2', '2', '3', '1', '1', null, '10'); INSERT INTO `tb_deposit` VALUES ('54', '23', '赵六', 'bibi', '2.00', '2.00', '2020-03-01', '2020-03-05', '4', '192.00', '40', '7', '2', '3', '1', '1', null, null); INSERT INTO `tb_deposit` VALUES ('55', '28', '王五', 'qiqi', '2.00', '1.00', '2020-03-06', '2020-03-11', '5', '355.00', '3', '5', '2', '3', '1', '1', null, '12'); INSERT INTO `tb_deposit` VALUES ('56', '28', '王五', 'vivi', '2.00', '2.00', '2020-03-07', '2020-03-11', '4', '228.00', '1', '4', '5', '3', '1', '1', null, '11'); INSERT INTO `tb_deposit` VALUES ('57', '29', '张三', 'qwe', '2.00', '3.00', '2019-12-01', '2019-12-03', '2', '118.00', '1', '1', '1', '3', '1', '1', null, '14'); INSERT INTO `tb_deposit` VALUES ('59', '40', '李四', 'nn', '2.00', '4.00', '2019-01-01', '2019-01-03', '2', '146.00', '2', '3', '2', '3', '1', '1', null, '9'); INSERT INTO `tb_deposit` VALUES ('60', '40', '李四', 'qq', '3.00', '2.00', '2019-01-04', '2019-01-08', '4', '300.00', '5', '3', '1', '3', '1', '1', null, null); INSERT INTO `tb_deposit` VALUES ('61', '40', '李四', 'ee', '3.00', '1.00', '2019-01-03', '2019-01-05', '2', '82.00', '6', '4', '4', '3', '1', '1', null, null); INSERT INTO `tb_deposit` VALUES ('62', '40', '李四', 'a', '3.00', '2.00', '2019-02-01', '2019-02-06', '5', '260.00', '7', '8', '5', '3', '1', '1', null, null); INSERT INTO `tb_deposit` VALUES ('63', '40', '李四', 'b', '3.00', '1.00', '2019-02-08', '2019-02-10', '2', '98.00', '8', '10', '5', '3', '1', '1', null, null); INSERT INTO `tb_deposit` VALUES ('64', '40', '李四', 'xx', '3.00', '3.00', '2019-02-07', '2019-02-10', '3', '150.00', '38', '11', '3', '3', '1', '1', '不行', null); INSERT INTO `tb_deposit` VALUES ('65', '40', '李四', 'z', '3.00', '1.00', '2019-03-01', '2019-03-03', '2', '146.00', '39', '16', '4', '3', '1', '1', null, null); INSERT INTO `tb_deposit` VALUES ('66', '40', '李四', 'aaa', '3.00', '2.00', '2019-03-02', '2019-03-03', '1', '76.00', '9', '3', '4', '3', '1', '1', null, null); INSERT INTO `tb_deposit` VALUES ('69', '40', '李四', 'mm', '3.00', '1.00', '2019-05-03', '2019-05-08', '5', '410.00', '3', '6', '1', '3', '1', '1', null, null); INSERT INTO `tb_deposit` VALUES ('70', '40', '李四', 'dd', '3.00', '2.00', '2019-05-03', '2019-05-08', '5', '385.00', '5', '16', '2', '3', '1', '1', null, null); INSERT INTO `tb_deposit` VALUES ('71', '23', '赵六', 'ff', '3.00', '3.00', '2019-06-01', '2019-06-02', '1', '76.00', '5', '2', '3', '3', '1', '1', null, null); INSERT INTO `tb_deposit` VALUES ('72', '23', '赵六', 'gg', '3.00', '1.00', '2019-06-07', '2019-06-08', '1', '65.00', '1', '2', '1', '3', '1', '1', null, null); INSERT INTO `tb_deposit` VALUES ('73', '23', '赵六', 'hh', '3.00', '2.00', '2019-07-02', '2019-07-05', '3', '186.00', '6', '4', '4', '3', '1', '1', null, null); INSERT INTO `tb_deposit` VALUES ('74', '23', '赵六', 'jj', '3.00', '1.00', '2019-07-04', '2019-07-06', '2', '144.00', '7', '3', '1', '3', '1', '1', null, null); INSERT INTO `tb_deposit` VALUES ('75', '23', '赵六', 'kk', '3.00', '1.00', '2019-07-05', '2019-07-10', '5', '380.00', '38', '16', '5', '3', '1', '1', null, null); INSERT INTO `tb_deposit` VALUES ('76', '23', '赵六', 'll', '3.00', '2.00', '2019-08-07', '2019-08-10', '3', '240.00', '9', '4', '2', '3', '1', '1', null, null); INSERT INTO `tb_deposit` VALUES ('77', '23', '赵六', 'pp', '3.00', '3.00', '2019-08-03', '2019-08-07', '4', '248.00', '39', '11', '5', '3', '1', '1', null, null); INSERT INTO `tb_deposit` VALUES ('78', '30', 'lisa', 'sasa', '3.00', '1.00', '2019-09-06', '2019-09-07', '1', '64.00', '1', '1', '1', '3', '1', '1', null, '15'); INSERT INTO `tb_deposit` VALUES ('79', '30', 'lisa', 'lili', '3.00', '2.00', '2019-09-03', '2019-09-05', '2', '156.00', '3', '3', '2', '3', '1', '1', null, null); INSERT INTO `tb_deposit` VALUES ('80', '30', 'lisa', 'momo', '3.00', '3.00', '2019-10-03', '2019-10-04', '1', '55.00', '5', '5', '3', '3', '1', '1', null, null); INSERT INTO `tb_deposit` VALUES ('81', '30', 'lisa', 'nini', '3.00', '2.00', '2019-10-05', '2019-10-08', '3', '159.00', '8', '6', '1', '3', '1', '1', null, null); INSERT INTO `tb_deposit` VALUES ('82', '30', 'lisa', 'kiki', '2.00', '1.00', '2019-11-01', '2019-11-03', '2', '82.00', '30', '4', '3', '3', '1', '1', null, null); INSERT INTO `tb_deposit` VALUES ('83', '30', 'lisa', 'aiai', '2.00', '1.00', '2019-11-02', '2019-11-03', '1', '52.00', '39', '5', '2', '3', '1', '1', null, null); INSERT INTO `tb_deposit` VALUES ('84', '30', 'lisa', 'qiqi', '2.00', '1.00', '2019-12-06', '2019-12-08', '2', '84.00', '6', '2', '1', '3', '1', '1', null, null); INSERT INTO `tb_deposit` VALUES ('85', '30', 'lisa', 'yiyi', '1.00', '1.00', '2019-12-13', '2019-12-15', '2', '118.00', '7', '7', '4', '3', '1', '0', '无免疫证明', null); INSERT INTO `tb_deposit` VALUES ('86', '29', '张三', '小四', '1.00', '1.00', '2020-05-22', '2020-05-23', '1', '73.00', '5', '4', '2', '3', '1', '1', null, null); INSERT INTO `tb_deposit` VALUES ('88', '29', '张三', 'xiaoni', '1.00', '1.00', '2020-05-23', '2020-05-24', '1', '74.00', '7', '4', '1', '3', '1', '1', null, null); INSERT INTO `tb_deposit` VALUES ('89', '29', '张三', '丁丁', '1.50', '3.00', '2020-05-30', '2020-05-31', '1', '73.00', '2', '7', '3', '3', '1', '1', null, null); INSERT INTO `tb_deposit` VALUES ('90', '29', '张三', 'asdf', '2.50', '3.00', '2020-05-23', '2020-05-24', '1', '53.00', '1', '4', '2', '4', '2', '0', null, null); INSERT INTO `tb_deposit` VALUES ('91', '28', '王五', 'lili', '1.00', '2.00', '2020-04-03', '2020-04-07', '4', '228.00', '2', '11', '2', '3', '1', '1', null, null); INSERT INTO `tb_deposit` VALUES ('92', '28', '王五', 'nunu', '2.00', '3.00', '2020-04-03', '2020-04-05', '2', '132.00', '5', '5', '5', '3', '1', '1', null, null); INSERT INTO `tb_deposit` VALUES ('93', '28', '王五', 'ruirui', '2.50', '3.20', '2020-04-08', '2020-04-10', '2', '106.00', '7', '4', '4', '3', '1', '1', null, null); INSERT INTO `tb_deposit` VALUES ('94', '31', 'lucy', 'cici', '2.30', '1.30', '2019-04-04', '2019-04-07', '3', '150.00', '9', '10', '2', '3', '1', '1', null, null); INSERT INTO `tb_deposit` VALUES ('95', '31', 'lucy', '小白', '2.00', '3.00', '2019-04-13', '2019-04-16', '3', '225.00', '8', '5', '2', '3', '1', '1', null, null); INSERT INTO `tb_deposit` VALUES ('96', '31', 'lucy', '大白', '3.00', '4.00', '2019-04-20', '2019-04-23', '3', '174.00', '6', '2', '3', '3', '1', '1', null, null); INSERT INTO `tb_deposit` VALUES ('97', '28', '王五', '妮妮', '3.00', '5.00', '2020-11-06', '2020-11-08', '2', '130.00', '8', '6', '3', '4', '2', '1', null, null); INSERT INTO `tb_deposit` VALUES ('98', '28', '王五', '胖胖', '3.00', '5.00', '2020-11-06', '2020-11-08', '2', '146.00', '5', '10', '3', '1', '1', '1', null, null); INSERT INTO `tb_deposit` VALUES ('99', '29', '张三', 'sss', '2.30', '2.30', '2020-05-24', '2020-05-24', '1', '68.00', '3', '3', '1', '4', '2', '1', null, null); INSERT INTO `tb_deposit` VALUES ('100', '29', '张三', 'aaaa', '2.00', '3.00', '2021-01-01', '2021-01-03', '2', '174.00', '4', '3', '3', '1', '1', '1', null, null); INSERT INTO `tb_deposit` VALUES ('101', '31', 'lucy', '小胖', '2.20', '2.30', '2020-05-27', '2020-05-29', '2', '118.00', '6', '4', '2', '4', '2', '1', null, null); INSERT INTO `tb_deposit` VALUES ('102', '29', '张三', 'aaa', '2.00', '2.00', '2020-05-28', '2020-05-31', '3', '234.00', '4', '3', '3', '4', '2', '1', null, null); INSERT INTO `tb_deposit` VALUES ('103', '29', '张三', 'aqwew', '3.00', '2.00', '2020-05-28', '2020-05-30', '2', '156.00', '3', '3', '3', '4', '2', '1', null, null); INSERT INTO `tb_deposit` VALUES ('104', '46', '张三', '奈奈', '1.20', '2.00', '2020-05-28', '2020-05-30', '2', '132.00', '3', '2', '2', '4', '2', '1', null, null); INSERT INTO `tb_deposit` VALUES ('105', '46', '张三', 'rr', '2.00', '3.00', '2020-05-28', '2020-05-30', '2', '74.00', '2', '4', '2', '4', '2', '0', null, null); INSERT INTO `tb_deposit` VALUES ('106', '31', 'lucy', 'cycy', '2.10', '2.30', '2020-05-29', '2020-05-31', '2', '142.00', '5', '4', '4', '1', '1', '0', 'ninini', null); INSERT INTO `tb_deposit` VALUES ('108', '30', 'lisa', '瘦瘦', '2.00', '4.00', '2020-06-05', '2020-06-07', '2', '114.00', '40', '5', '4', '1', '2', '1', null, null); INSERT INTO `tb_deposit` VALUES ('109', '30', 'lisa', '胖胖', '3.00', '30.00', '2020-06-06', '2020-06-07', '1', '64.00', '6', '6', '5', '2', '2', '1', '太胖了', null); INSERT INTO `tb_deposit` VALUES ('110', '30', 'lisa', '大大', '3.00', '4.00', '2020-06-07', '2020-06-09', '2', '114.00', '1', '1', '1', '4', '2', '1', null, null); INSERT INTO `tb_deposit` VALUES ('112', '29', '张三', '小胖', '3.00', '3.00', '2020-06-06', '2020-06-06', '1', '53.00', '5', '4', '2', '4', '2', '1', null, null); -- ---------------------------- -- Table structure for tb_deposit_service -- ---------------------------- DROP TABLE IF EXISTS `tb_deposit_service`; CREATE TABLE `tb_deposit_service` ( `deposit_id` int(11) NOT NULL, `service_id` int(11) NOT NULL, PRIMARY KEY (`deposit_id`,`service_id`), KEY `tb_deposit_service_ibfk_2` (`service_id`), CONSTRAINT `tb_deposit_service_ibfk_1` FOREIGN KEY (`deposit_id`) REFERENCES `tb_deposit` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `tb_deposit_service_ibfk_2` FOREIGN KEY (`service_id`) REFERENCES `tb_service` (`id`) ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of tb_deposit_service -- ---------------------------- INSERT INTO `tb_deposit_service` VALUES ('39', '4'); INSERT INTO `tb_deposit_service` VALUES ('41', '4'); INSERT INTO `tb_deposit_service` VALUES ('43', '4'); INSERT INTO `tb_deposit_service` VALUES ('45', '4'); INSERT INTO `tb_deposit_service` VALUES ('46', '4'); INSERT INTO `tb_deposit_service` VALUES ('48', '4'); INSERT INTO `tb_deposit_service` VALUES ('49', '4'); INSERT INTO `tb_deposit_service` VALUES ('51', '4'); INSERT INTO `tb_deposit_service` VALUES ('55', '4'); INSERT INTO `tb_deposit_service` VALUES ('59', '4'); INSERT INTO `tb_deposit_service` VALUES ('63', '4'); INSERT INTO `tb_deposit_service` VALUES ('65', '4'); INSERT INTO `tb_deposit_service` VALUES ('66', '4'); INSERT INTO `tb_deposit_service` VALUES ('69', '4'); INSERT INTO `tb_deposit_service` VALUES ('71', '4'); INSERT INTO `tb_deposit_service` VALUES ('75', '4'); INSERT INTO `tb_deposit_service` VALUES ('77', '4'); INSERT INTO `tb_deposit_service` VALUES ('78', '4'); INSERT INTO `tb_deposit_service` VALUES ('81', '4'); INSERT INTO `tb_deposit_service` VALUES ('88', '4'); INSERT INTO `tb_deposit_service` VALUES ('89', '4'); INSERT INTO `tb_deposit_service` VALUES ('93', '4'); INSERT INTO `tb_deposit_service` VALUES ('96', '4'); INSERT INTO `tb_deposit_service` VALUES ('106', '4'); INSERT INTO `tb_deposit_service` VALUES ('40', '8'); INSERT INTO `tb_deposit_service` VALUES ('50', '8'); INSERT INTO `tb_deposit_service` VALUES ('53', '8'); INSERT INTO `tb_deposit_service` VALUES ('56', '8'); INSERT INTO `tb_deposit_service` VALUES ('60', '8'); INSERT INTO `tb_deposit_service` VALUES ('64', '8'); INSERT INTO `tb_deposit_service` VALUES ('65', '8'); INSERT INTO `tb_deposit_service` VALUES ('70', '8'); INSERT INTO `tb_deposit_service` VALUES ('72', '8'); INSERT INTO `tb_deposit_service` VALUES ('73', '8'); INSERT INTO `tb_deposit_service` VALUES ('76', '8'); INSERT INTO `tb_deposit_service` VALUES ('79', '8'); INSERT INTO `tb_deposit_service` VALUES ('83', '8'); INSERT INTO `tb_deposit_service` VALUES ('85', '8'); INSERT INTO `tb_deposit_service` VALUES ('86', '8'); INSERT INTO `tb_deposit_service` VALUES ('88', '8'); INSERT INTO `tb_deposit_service` VALUES ('90', '8'); INSERT INTO `tb_deposit_service` VALUES ('91', '8'); INSERT INTO `tb_deposit_service` VALUES ('95', '8'); INSERT INTO `tb_deposit_service` VALUES ('97', '8'); INSERT INTO `tb_deposit_service` VALUES ('98', '8'); INSERT INTO `tb_deposit_service` VALUES ('100', '8'); INSERT INTO `tb_deposit_service` VALUES ('103', '8'); INSERT INTO `tb_deposit_service` VALUES ('104', '8'); INSERT INTO `tb_deposit_service` VALUES ('106', '8'); INSERT INTO `tb_deposit_service` VALUES ('29', '9'); INSERT INTO `tb_deposit_service` VALUES ('39', '9'); INSERT INTO `tb_deposit_service` VALUES ('54', '9'); INSERT INTO `tb_deposit_service` VALUES ('60', '9'); INSERT INTO `tb_deposit_service` VALUES ('70', '9'); INSERT INTO `tb_deposit_service` VALUES ('72', '9'); INSERT INTO `tb_deposit_service` VALUES ('74', '9'); INSERT INTO `tb_deposit_service` VALUES ('75', '9'); INSERT INTO `tb_deposit_service` VALUES ('79', '9'); INSERT INTO `tb_deposit_service` VALUES ('80', '9'); INSERT INTO `tb_deposit_service` VALUES ('86', '9'); INSERT INTO `tb_deposit_service` VALUES ('89', '9'); INSERT INTO `tb_deposit_service` VALUES ('92', '9'); INSERT INTO `tb_deposit_service` VALUES ('95', '9'); INSERT INTO `tb_deposit_service` VALUES ('98', '9'); INSERT INTO `tb_deposit_service` VALUES ('99', '9'); INSERT INTO `tb_deposit_service` VALUES ('100', '9'); INSERT INTO `tb_deposit_service` VALUES ('101', '9'); INSERT INTO `tb_deposit_service` VALUES ('102', '9'); INSERT INTO `tb_deposit_service` VALUES ('103', '9'); INSERT INTO `tb_deposit_service` VALUES ('108', '9'); INSERT INTO `tb_deposit_service` VALUES ('109', '9'); INSERT INTO `tb_deposit_service` VALUES ('110', '9'); INSERT INTO `tb_deposit_service` VALUES ('29', '10'); INSERT INTO `tb_deposit_service` VALUES ('90', '10'); INSERT INTO `tb_deposit_service` VALUES ('91', '10'); INSERT INTO `tb_deposit_service` VALUES ('92', '10'); INSERT INTO `tb_deposit_service` VALUES ('94', '10'); INSERT INTO `tb_deposit_service` VALUES ('96', '10'); INSERT INTO `tb_deposit_service` VALUES ('97', '10'); INSERT INTO `tb_deposit_service` VALUES ('99', '10'); INSERT INTO `tb_deposit_service` VALUES ('101', '10'); INSERT INTO `tb_deposit_service` VALUES ('104', '10'); INSERT INTO `tb_deposit_service` VALUES ('105', '10'); INSERT INTO `tb_deposit_service` VALUES ('108', '10'); INSERT INTO `tb_deposit_service` VALUES ('110', '10'); INSERT INTO `tb_deposit_service` VALUES ('112', '10'); INSERT INTO `tb_deposit_service` VALUES ('102', '14'); INSERT INTO `tb_deposit_service` VALUES ('109', '14'); INSERT INTO `tb_deposit_service` VALUES ('112', '14'); -- ---------------------------- -- Table structure for tb_keeper -- ---------------------------- DROP TABLE IF EXISTS `tb_keeper`; CREATE TABLE `tb_keeper` ( `kid` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(10) NOT NULL, `sex` tinyint(4) NOT NULL, `phone` varchar(11) NOT NULL, `description` varchar(255) DEFAULT '暂无', `picture` varchar(50) DEFAULT NULL, PRIMARY KEY (`kid`) ) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of tb_keeper -- ---------------------------- INSERT INTO `tb_keeper` VALUES ('1', '何小石', '1', '18593273424', '资深宠物饲养员', 'k10.png'); INSERT INTO `tb_keeper` VALUES ('2', '黄大明', '1', '17482956271', '暂无', 'k2.png'); INSERT INTO `tb_keeper` VALUES ('3', '刘欣欣', '0', '18748242231', '暂无', 'k6.png'); INSERT INTO `tb_keeper` VALUES ('4', '蒋小欣', '0', '18593271111', '暂无', 'k7.png'); INSERT INTO `tb_keeper` VALUES ('5', '李晓明', '1', '18593272222', '暂无', 'k5.png'); INSERT INTO `tb_keeper` VALUES ('9', '张小红', '0', '18593272321', '', 'k8.png'); INSERT INTO `tb_keeper` VALUES ('14', '杨菲菲', '1', '18593271232', '', 'k9.png'); -- ---------------------------- -- Table structure for tb_petfood -- ---------------------------- DROP TABLE IF EXISTS `tb_petfood`; CREATE TABLE `tb_petfood` ( `pid` int(11) NOT NULL AUTO_INCREMENT, `brand` varchar(20) DEFAULT NULL, `price` decimal(10,2) NOT NULL, PRIMARY KEY (`pid`), UNIQUE KEY `brand` (`brand`) ) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of tb_petfood -- ---------------------------- INSERT INTO `tb_petfood` VALUES ('1', '冠能', '11.00'); INSERT INTO `tb_petfood` VALUES ('2', '好主人', '9.00'); INSERT INTO `tb_petfood` VALUES ('3', '伯纳天纯', '10.00'); INSERT INTO `tb_petfood` VALUES ('4', '皇家', '8.00'); INSERT INTO `tb_petfood` VALUES ('5', '麦富迪', '11.00'); INSERT INTO `tb_petfood` VALUES ('6', '比瑞吉', '12.00'); INSERT INTO `tb_petfood` VALUES ('7', '海洋之星', '13.00'); INSERT INTO `tb_petfood` VALUES ('8', '耐威克', '7.00'); INSERT INTO `tb_petfood` VALUES ('10', '宝路', '8.00'); INSERT INTO `tb_petfood` VALUES ('11', '疯狂的小狗', '7.00'); INSERT INTO `tb_petfood` VALUES ('13', '渴望', '7.00'); INSERT INTO `tb_petfood` VALUES ('14', '爱肯拿', '13.00'); INSERT INTO `tb_petfood` VALUES ('16', '力狼', '12.00'); -- ---------------------------- -- Table structure for tb_service -- ---------------------------- DROP TABLE IF EXISTS `tb_service`; CREATE TABLE `tb_service` ( `id` int(11) NOT NULL AUTO_INCREMENT, `service_name` varchar(20) DEFAULT NULL, `price` decimal(10,2) NOT NULL, `description` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `service_name` (`service_name`) ) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of tb_service -- ---------------------------- INSERT INTO `tb_service` VALUES ('4', '玩耍', '20.00', '每天玩耍30分钟...'); INSERT INTO `tb_service` VALUES ('8', '按摩', '21.00', '每天按摩30分钟'); INSERT INTO `tb_service` VALUES ('9', '除虫', '22.00', '每天按时为宠物除虫'); INSERT INTO `tb_service` VALUES ('10', '洗澡', '11.00', '全方位无死角清洗宠物'); INSERT INTO `tb_service` VALUES ('14', '遛玩', '12.00', '暂无'); -- ---------------------------- -- Table structure for tb_user -- ---------------------------- DROP TABLE IF EXISTS `tb_user`; CREATE TABLE `tb_user` ( `id` int(11) NOT NULL AUTO_INCREMENT, `username` varchar(10) DEFAULT NULL, `account` varchar(10) NOT NULL, `password` varchar(60) NOT NULL, `gender` int(11) NOT NULL, `phone` varchar(11) NOT NULL, `address` varchar(50) NOT NULL, `email` varchar(20) NOT NULL, `status` int(11) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `account` (`account`), KEY `username` (`username`) ) ENGINE=InnoDB AUTO_INCREMENT=47 DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of tb_user -- ---------------------------- INSERT INTO `tb_user` VALUES ('1', '管理员', 'admin', '$2a$10$2CSZr.I1xgoEFXuP6cZdJuWr7ZZK/GcmUvhdoGdcAbCxPxC7jq7Xu', '1', '18593271111', '广西桂林七星区金鸡路', 'lkp0210@163.com', '1'); INSERT INTO `tb_user` VALUES ('23', '赵六', 'zhaoliu', '$2a$10$tZ01t.Mjk/ygnJcwVYNMkeM57N63mbmqykqZEdp5nAnMcX2UzfKU.', '1', '18593271111', '广西桂林七星区', 'lkp0210@163.com', '0'); INSERT INTO `tb_user` VALUES ('28', '王五', 'wangwu', '$2a$10$lZBCKFsLlKl.9bMBfQt/Gu5T8/5ZoArya3jKicADIgSeJdhNuHPUm', '1', '18593274444', '广西桂林七星区', 'wangwu@163.com', '0'); INSERT INTO `tb_user` VALUES ('29', '张三', 'zhangsan', '$2a$10$HpLFRqukrPmtj5Ep2xQLfOSXM9OXByh9XzWefDwvtV3SokAdwqyzq', '1', '18593273424', '广西桂林临桂区', 'lkp0210@163.com', '0'); INSERT INTO `tb_user` VALUES ('30', 'lisa', 'lisa', '$2a$10$jEot2pn4zDzkAZ43tILr4.EJmmPt8z1d0rF4S/pjfTJqQki6QOWom', '0', '18593273424', '广西桂林七星区', 'lisa@163.com', '0'); INSERT INTO `tb_user` VALUES ('31', 'lucy', 'lucy', '$2a$10$GIt/Olq9.IvuExfROmDCGOrXAPFQsBfHVMUWolgOxkSgeeO62sxUS', '0', '18593270000', '广西桂林雁山区', 'lucy@163.com', '0'); INSERT INTO `tb_user` VALUES ('40', '李四', 'lisi', '$2a$10$pY0xYOInuCs/OeBB26ilIOSDt.JsO3ewoT4J4vkOt.3qqaC3uswVu', '1', '18593273424', '广西桂林象山', 'lkp@163.comm', '0'); INSERT INTO `tb_user` VALUES ('44', '曾六', 'zengdada', '$2a$10$jwbD9IPLUUL8YJ7eO8PpielTjm1xtrTWtjvX7OvAe48bvUZiKC0S.', '1', '18593271234', '广西桂林灵川', 'zeng@163.com', '0'); INSERT INTO `tb_user` VALUES ('46', '张三', 'zhangsan1', '$2a$10$HpLFRqukrPmtj5Ep2xQLfOSXM9OXByh9XzWefDwvtV3SokAdwqyzq', '1', '18593273424', '广东东莞', 'zhangsan1@163.com', '0');
true
6a4077cdeea5a52b01a50a8f86fdd3d4556539f6
SQL
mikejesus/database-assignment
/AssignmentByMichael.sql
UTF-8
259
2.78125
3
[]
no_license
-- Assignment submitted on 31st March, 2020 by Michael S. Olawuni select *, (unit_price * quantity) as total_price from sql_store.order_items where order_id = 6 and (unit_price * quantity) > 30; select * from sql_store.products where quantity_in_stock in (49,38,72);
true
b96ca5a5e1749a06200639a7a74c50ca29a7b128
SQL
shashankshovit/video-library
/111/vlibrary.sql
UTF-8
2,111
2.53125
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 3.2.4 -- http://www.phpmyadmin.net -- -- Host: localhost -- Generation Time: Nov 02, 2011 at 03:29 PM -- Server version: 5.1.41 -- PHP Version: 5.3.1 SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8 */; -- -- Database: `vlibrary` -- -- -------------------------------------------------------- -- -- Table structure for table `customer` -- CREATE TABLE IF NOT EXISTS `customer` ( `cid` text NOT NULL, `name` text NOT NULL, `address` text NOT NULL, `phone` text NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; -- -- Dumping data for table `customer` -- -- -------------------------------------------------------- -- -- Table structure for table `movies` -- CREATE TABLE IF NOT EXISTS `movies` ( `mid` text NOT NULL, `name` text NOT NULL, `studio` text NOT NULL, `year` int(4) NOT NULL, `genre` text NOT NULL, `language` text NOT NULL, `type` text NOT NULL, `cast` text NOT NULL, `director` text NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; -- -- Dumping data for table `movies` -- -- -------------------------------------------------------- -- -- Table structure for table `register` -- CREATE TABLE IF NOT EXISTS `register` ( `mid` text NOT NULL, `cid` text NOT NULL, `doi` text NOT NULL, `dod` text NOT NULL, `fine` text NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; -- -- Dumping data for table `register` -- -- -------------------------------------------------------- -- -- Table structure for table `stock` -- CREATE TABLE IF NOT EXISTS `stock` ( `mid` text NOT NULL, `pack` text NOT NULL, `value` text NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; -- -- Dumping data for table `stock` -- /*!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
633c8e09b0fb2e2477865eb6c6c725abc74a4a10
SQL
LiarZhang/dingcan
/file/database/shiro_dingcan.sql
UTF-8
9,539
2.96875
3
[]
no_license
/* Navicat MySQL Data Transfer Source Server : 本地Localhost Source Server Version : 50553 Source Host : localhost:3306 Source Database : shiro_dingcan Target Server Type : MYSQL Target Server Version : 50553 File Encoding : 65001 Date: 2018-07-25 09:32:31 */ SET FOREIGN_KEY_CHECKS=0; -- ---------------------------- -- Table structure for manager -- ---------------------------- DROP TABLE IF EXISTS `manager`; CREATE TABLE `manager` ( `id` varchar(11) NOT NULL, `name` varchar(255) DEFAULT NULL, `password` varchar(255) DEFAULT NULL, `email` varchar(255) DEFAULT NULL, `age` int(11) DEFAULT NULL, `sex` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of manager -- ---------------------------- INSERT INTO `manager` VALUES ('1', '1111', '111', '111@333.com', '1111', '女'); INSERT INTO `manager` VALUES ('2', '1111', '111', '111@333.com', '1111', '女'); INSERT INTO `manager` VALUES ('3', '1111', '111', '111@333.com', '1111', '女'); -- ---------------------------- -- Table structure for test -- ---------------------------- DROP TABLE IF EXISTS `test`; CREATE TABLE `test` ( `id` int(11) NOT NULL AUTO_INCREMENT, `username` varchar(255) DEFAULT NULL, `password` varchar(255) DEFAULT NULL, `sex` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of test -- ---------------------------- INSERT INTO `test` VALUES ('3', 'name0', null, null); INSERT INTO `test` VALUES ('4', 'name1', null, null); INSERT INTO `test` VALUES ('5', 'name2', null, null); INSERT INTO `test` VALUES ('6', 'name3', null, null); INSERT INTO `test` VALUES ('7', 'name4', null, null); INSERT INTO `test` VALUES ('8', 'name5', null, null); INSERT INTO `test` VALUES ('9', 'name6', null, null); INSERT INTO `test` VALUES ('10', 'name7', null, null); INSERT INTO `test` VALUES ('11', 'name8', null, null); INSERT INTO `test` VALUES ('12', '张销峰1', '1111', '男1'); -- ---------------------------- -- Table structure for test_user -- ---------------------------- DROP TABLE IF EXISTS `test_user`; CREATE TABLE `test_user` ( `id` int(11) NOT NULL, `user_name` varchar(255) DEFAULT NULL, `user_password` varchar(255) DEFAULT NULL, `user_sex` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of test_user -- ---------------------------- INSERT INTO `test_user` VALUES ('1', '11', '11', '11'); -- ---------------------------- -- Table structure for u_permission -- ---------------------------- DROP TABLE IF EXISTS `u_permission`; CREATE TABLE `u_permission` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `url` varchar(256) DEFAULT NULL COMMENT 'url地址', `name` varchar(64) DEFAULT NULL COMMENT 'url描述', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of u_permission -- ---------------------------- INSERT INTO `u_permission` VALUES ('4', '/permission/index.shtml', '权限列表'); INSERT INTO `u_permission` VALUES ('6', '/permission/addPermission.shtml', '权限添加'); INSERT INTO `u_permission` VALUES ('7', '/permission/deletePermissionById.shtml', '权限删除'); INSERT INTO `u_permission` VALUES ('8', '/member/list.shtml', '用户列表'); INSERT INTO `u_permission` VALUES ('9', '/member/online.shtml', '在线用户'); INSERT INTO `u_permission` VALUES ('10', '/member/changeSessionStatus.shtml', '用户Session踢出'); INSERT INTO `u_permission` VALUES ('11', '/member/forbidUserById.shtml', '用户激活&禁止'); INSERT INTO `u_permission` VALUES ('12', '/member/deleteUserById.shtml', '用户删除'); INSERT INTO `u_permission` VALUES ('13', '/permission/addPermission2Role.shtml', '权限分配'); INSERT INTO `u_permission` VALUES ('14', '/role/clearRoleByUserIds.shtml', '用户角色分配清空'); INSERT INTO `u_permission` VALUES ('15', '/role/addRole2User.shtml', '角色分配保存'); INSERT INTO `u_permission` VALUES ('16', '/role/deleteRoleById.shtml', '角色列表删除'); INSERT INTO `u_permission` VALUES ('17', '/role/addRole.shtml', '角色列表添加'); INSERT INTO `u_permission` VALUES ('18', '/role/index.shtml', '角色列表'); INSERT INTO `u_permission` VALUES ('19', '/permission/allocation.shtml', '权限分配'); INSERT INTO `u_permission` VALUES ('20', '/role/allocation.shtml', '角色分配'); -- ---------------------------- -- Table structure for u_role -- ---------------------------- DROP TABLE IF EXISTS `u_role`; CREATE TABLE `u_role` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `rolename` varchar(32) DEFAULT NULL COMMENT '角色名称', `type` varchar(10) DEFAULT NULL COMMENT '角色类型', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of u_role -- ---------------------------- INSERT INTO `u_role` VALUES ('1', '系统管理员', '888888'); INSERT INTO `u_role` VALUES ('3', '权限角色', '100003'); INSERT INTO `u_role` VALUES ('4', '用户中心', '100002'); -- ---------------------------- -- Table structure for u_role_permission -- ---------------------------- DROP TABLE IF EXISTS `u_role_permission`; CREATE TABLE `u_role_permission` ( `rid` bigint(20) DEFAULT NULL COMMENT '角色ID', `pid` bigint(20) DEFAULT NULL COMMENT '权限ID' ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of u_role_permission -- ---------------------------- INSERT INTO `u_role_permission` VALUES ('4', '8'); INSERT INTO `u_role_permission` VALUES ('4', '9'); INSERT INTO `u_role_permission` VALUES ('4', '10'); INSERT INTO `u_role_permission` VALUES ('4', '11'); INSERT INTO `u_role_permission` VALUES ('4', '12'); INSERT INTO `u_role_permission` VALUES ('3', '4'); INSERT INTO `u_role_permission` VALUES ('3', '6'); INSERT INTO `u_role_permission` VALUES ('3', '7'); INSERT INTO `u_role_permission` VALUES ('3', '13'); INSERT INTO `u_role_permission` VALUES ('3', '14'); INSERT INTO `u_role_permission` VALUES ('3', '15'); INSERT INTO `u_role_permission` VALUES ('3', '16'); INSERT INTO `u_role_permission` VALUES ('3', '17'); INSERT INTO `u_role_permission` VALUES ('3', '18'); INSERT INTO `u_role_permission` VALUES ('3', '19'); INSERT INTO `u_role_permission` VALUES ('3', '20'); INSERT INTO `u_role_permission` VALUES ('1', '4'); INSERT INTO `u_role_permission` VALUES ('1', '6'); INSERT INTO `u_role_permission` VALUES ('1', '7'); INSERT INTO `u_role_permission` VALUES ('1', '8'); INSERT INTO `u_role_permission` VALUES ('1', '9'); INSERT INTO `u_role_permission` VALUES ('1', '10'); INSERT INTO `u_role_permission` VALUES ('1', '11'); INSERT INTO `u_role_permission` VALUES ('1', '12'); INSERT INTO `u_role_permission` VALUES ('1', '13'); INSERT INTO `u_role_permission` VALUES ('1', '14'); INSERT INTO `u_role_permission` VALUES ('1', '15'); INSERT INTO `u_role_permission` VALUES ('1', '16'); INSERT INTO `u_role_permission` VALUES ('1', '17'); INSERT INTO `u_role_permission` VALUES ('1', '18'); INSERT INTO `u_role_permission` VALUES ('1', '19'); INSERT INTO `u_role_permission` VALUES ('1', '20'); -- ---------------------------- -- Table structure for u_user -- ---------------------------- DROP TABLE IF EXISTS `u_user`; CREATE TABLE `u_user` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `nickname` varchar(20) DEFAULT NULL COMMENT '用户昵称', `email` varchar(128) DEFAULT NULL COMMENT '邮箱|登录帐号', `password` varchar(64) DEFAULT NULL COMMENT '密码', `create_time` datetime DEFAULT NULL COMMENT '创建时间', `last_login_time` datetime DEFAULT NULL COMMENT '最后登录时间', `status` bigint(1) DEFAULT '1' COMMENT '1:有效,0:禁止登录', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of u_user -- ---------------------------- INSERT INTO `u_user` VALUES ('1', '管理员', 'admin', '57eb72e6b78a87a12d46a7f5e9315138', '2016-06-16 11:15:33', '2018-03-29 17:34:30', '1'); INSERT INTO `u_user` VALUES ('11', 'soso', '8446666@qq.com', 'E10ADC3949BA59ABBE56E057F20F883E', '2016-05-26 20:50:54', '2016-06-16 11:24:35', '1'); INSERT INTO `u_user` VALUES ('12', '8446666', '8446666', '4afdc875a67a55528c224ce088be2ab8', '2016-05-27 22:34:19', '2016-06-15 17:03:16', '1'); INSERT INTO `u_user` VALUES ('14', '管理员1111', 'admin', '57eb72e6b78a87a12d46a7f5e9315138', '2016-06-16 11:15:33', '2018-03-29 17:34:30', '1'); INSERT INTO `u_user` VALUES ('15', '管理员', 'admin', '57eb72e6b78a87a12d46a7f5e9315138', '2016-06-16 11:15:33', '2018-03-29 17:34:30', '1'); -- ---------------------------- -- Table structure for u_user_role -- ---------------------------- DROP TABLE IF EXISTS `u_user_role`; CREATE TABLE `u_user_role` ( `uid` bigint(20) DEFAULT NULL COMMENT '用户ID', `rid` bigint(20) DEFAULT NULL COMMENT '角色ID' ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of u_user_role -- ---------------------------- INSERT INTO `u_user_role` VALUES ('12', '4'); INSERT INTO `u_user_role` VALUES ('11', '3'); INSERT INTO `u_user_role` VALUES ('11', '4'); INSERT INTO `u_user_role` VALUES ('1', '1');
true
bd467a9825989c1c1d67b5e40f85218742857e39
SQL
Everybyte-Digital-Products-Blueberry-Pi/Dalhousie-TA-Management-System
/sql/status.sql
UTF-8
1,467
3.0625
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 4.9.5 -- https://www.phpmyadmin.net/ -- -- Host: localhost:3306 -- Generation Time: Aug 02, 2020 at 01:37 PM -- Server version: 5.7.24 -- PHP Version: 7.4.1 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET AUTOCOMMIT = 0; START TRANSACTION; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8mb4 */; -- -- Database: `nhat` -- -- -------------------------------------------------------- -- -- Table structure for table `status` -- CREATE TABLE `status` ( `id` int(5) NOT NULL, `status` varchar(10) NOT NULL, `pId` int(15) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `status` -- INSERT INTO `status` (`id`, `status`, `pId`) VALUES (38, 'declined', 9), (39, 'approved', 10), (42, 'declined', 11); -- -- Indexes for dumped tables -- -- -- Indexes for table `status` -- ALTER TABLE `status` ADD PRIMARY KEY (`pId`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `status` -- ALTER TABLE `status` MODIFY `pId` int(15) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12; 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
05535f584fc2ae421651bf78836a367dc52c20cf
SQL
BoyangDong/Quant
/sumopinrisk/test.sql
UTF-8
245
2.8125
3
[]
no_license
select pf.portfolioName, i.instrumentName, p.position, p.positionId from position as p, instrumentName as i, portfolioName as pf where i.instrumentId = p.instrumentId and p.portfolioId = pf.portfolioId and 1=2;
true
0cb338c9f1873e70a8a343d32f282c47956527ea
SQL
kaito-27/github
/sql/sql42.sql
SHIFT_JIS
143
3.515625
4
[]
no_license
SELECT c.name , MAX(order_date) ŋ߂̒ FROM sales s LEFT JOIN customers c ON s.customer_id = c.id GROUP BY s.customer_id
true
0782de9346459fd243b99d2fb60d18179eee6450
SQL
pns-soa-h/uberoo
/uberoo-meals/src/main/resources/data.sql
UTF-8
513
2.515625
3
[]
no_license
INSERT INTO TAG (id, label) VALUES (1, 'asian'), (2, 'french'); INSERT INTO RESTAURANT (id, name) VALUES (5, 'LE Resto'), (6, 'Asian Resto'); INSERT INTO MEAL (id, label, price, description, restaurant_id, tag_id, category) VALUES (3, 'Jambon-Beurre', 4.99, 'Un sandwich, avec du jambon, et du beurre.', 5, 2, 'plat'), (4, 'Soupe miso', 4.99, 'Une bonne soupe', 6, 1, 'entree'), (5, 'Ramen', 8.99, 'Un bon ramen', 6, 1, 'plat'), (6, 'Glace coco', 3.99, 'Une bonne glace coco', 6, 1, 'dessert');
true
e73530fd043eaf52028ee46f8ce860fe5302ff61
SQL
brimahoney/Gun-Inventory
/Gun Inventory/SQL Scripts/firearms-inventory.sql
UTF-8
711
3.640625
4
[]
no_license
CREATE DATABASE IF NOT EXISTS `firearms_inventory`; USE `firearms_inventory`; DROP TABLE IF EXISTS `firearms`; CREATE TABLE `firearms` ( `serial_number` varchar(30) NOT NULL, `model` varchar(45) DEFAULT NULL, `make` varchar(45) DEFAULT NULL, `type` varchar(15) DEFAULT NULL, `caliber` varchar(10) DEFAULT NULL, `date_purchased` date DEFAULT NULL, `notes` text DEFAULT NULL, PRIMARY KEY(`serial_number`)); DROP TABLE IF EXISTS `firearm_images`; CREATE TABLE `firearm_images` ( `id` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, `serial_number` varchar(30) NOT NULL, `image` blob DEFAULT NULL, FOREIGN KEY fk_fir(serial_number) REFERENCES firearms(serial_number) ON DELETE CASCADE );
true
dc631faa3233f86baa99f52421168b59f4d2e274
SQL
Juchnowski/FunctionalProgramming-LINQ
/Tutorial.Shared/GettingStarted/Overview.Linq.LinqToNoSql.sql
UTF-8
421
2.921875
3
[ "MIT" ]
permissive
SELECT CAST(BusinessEntityID AS varchar) AS [Id], Name AS [Name], AddressType AS [Address.AddressType], AddressLine1 AS [Address.AddressLine1], City AS [Address.Location.City], StateProvinceName AS [Address.Location.StateProvinceName], PostalCode AS [Address.PostalCode], CountryRegionName AS [Address.CountryRegionName] FROM Sales.vStoreWithAddresses WHERE AddressType = N'Main Office'
true
e8dfbb5b37597ae8fd5de962707acf6ea289738d
SQL
CoderLittleChen/hello-word
/sql/sql常用语句/iSE/53.保存执行sql..sql
UTF-8
2,139
2.796875
3
[]
no_license
select * from specms_SpecBlEntryRel a inner join specms_TabRefBaseLine b on a.blId=b.blId inner join specms_SpecBaseLine c on b.blId=c.blId where b.listId=8349 and a.refId=105206 and b.status=2 and c.status<>1; -- update specms_SpecEntry set verStatus=0,optType=0 -- from -- ( -- select a.entryId from specms_SpecEntry a -- inner join specms_SpecBlEntryRel b on a.EntryId=b.EntryId -- inner join specms_TabRefBaseLine c on b.BlId=c.BlId -- inner join specms_SpecBaseLine d on c.BlId=d.BlId -- where c.listId=8349 and b.refId=105206 and c.Status=2 -- and d.Status<>1 and verStatus=-1 -- union all -- select a.entryId from specms_SpecEntry a -- inner join specms_SpecBlEntryRel b on a.EntryId=b.EntryId -- inner join specms_TabRefBaseLine c on b.BlId=c.BlId -- inner join specms_SpecBaseLine d on c.BlId=d.BlId -- where c.listId=8349 and b.refId=105206 and c.Status=2 and d.Status<>1 and verStatus=0 -- ) temp where temp.entryId=specms_SpecEntry.entryId; --update specms_StandardSupport set status=0 --from -- ( -- select a.entryId from specms_SpecEntry a -- inner join specms_SpecBlEntryRel b on a.EntryId=b.EntryId -- inner join specms_TabRefBaseLine c on b.BlId=c.BlId -- inner join specms_SpecBaseLine d on c.BlId=d.BlId -- where c.listId=8349 and b.refId=105206 and c.Status=2 and d.Status<>1 and verStatus=0 -- ) temp where temp.entryId=specms_StandardSupport.entryId and specms_StandardSupport.flag=0; --update specms_EntryParam set status=0 from -- ( -- select a.entryId from specms_SpecEntry a -- inner join specms_SpecBlEntryRel b on a.EntryId=b.EntryId -- inner join specms_TabRefBaseLine c on b.BlId=c.BlId -- inner join specms_SpecBaseLine d on c.BlId=d.BlId -- where c.listId=8349 and b.refId=105206 and c.Status=2 and d.Status<>1 and verStatus=0 -- ) temp where temp.entryId=specms_EntryParam.entryId and specms_EntryParam.type=0;
true
3235cf85017ba830a02c1356ae5029b95f76a516
SQL
MrXGJ/DatabaseTraining_ClothingWebsiteDesign
/database_SQL/createTable.sql
UTF-8
4,030
3.5625
4
[]
no_license
 hello drop table if exists pictures_items_relation; drop table if exists users; drop table if exists monthlysales; drop table if exists annualsales; drop table if exists stocks; drop table if exists sales; drop table if exists attrTable; drop table if exists items; drop table if exists attrValue; drop table if exists attrName; drop table if exists catagory; drop table if exists pictures; drop table if exists project; create table project( pro_id int auto_increment not null, pro_name varchar(50) not null, pro_status ENUM('undo', 'done') not null, primary key(pro_id) )ENGINE=InnoDB DEFAULT CHARSET=utf8; create table pictures( pic_id int auto_increment not null, pic_path varchar(50) not null, pic_status ENUM('undo', 'done', 'useless') not null, pro_id int null null, primary key (pic_id), foreign key (pro_id) references project(pro_id) )ENGINE=InnoDB DEFAULT CHARSET=utf8; create table catagory( cata_id int auto_increment not null, cata_name varchar(20) unique, #设置了类名不重复 parent_id int default null, primary key (cata_id) )ENGINE=InnoDB DEFAULT CHARSET=utf8; create table attrName( attrn_id int auto_increment not null, attrName varchar(20) not null, cata_id int not null, multi bool not null, primary key (attrn_id), foreign key (cata_id) references catagory(cata_id) )ENGINE=InnoDB DEFAULT CHARSET=utf8; create table attrValue( attrv_id int auto_increment not null, attrValue varchar(20) not null, attrn_id int not null, primary key(attrv_id), foreign key(attrn_id) references attrName(attrn_id) )ENGINE=InnoDB DEFAULT CHARSET=utf8; create table items( ID varchar(7) not null, item_name varchar(50) not null, cata_id int(11) not null, createTime Date, primary key (ID), foreign key (cata_id) references catagory(cata_id) )ENGINE=InnoDB DEFAULT CHARSET=utf8; create table attrTable( attrTable_id int auto_increment not null, ID varchar(7) not null, attrn_id int not null, attrv_id int not null, primary key (attrTable_id), foreign key (ID) references items(ID), foreign key (attrn_id) references attrName(attrn_id), foreign key (attrv_id) references attrValue(attrv_id) )ENGINE=InnoDB DEFAULT CHARSET=utf8; create table sales( ID varchar(7) not null, region_id int, channel varchar(20), agegroup varchar(20), primary key(ID), foreign key(ID) references items(ID) )ENGINE=InnoDB DEFAULT CHARSET=utf8; create table stocks( stocks_id int auto_increment not null, ID varchar(7) not null, size ENUM('80', '90', '100', '110', '120', '130', '140', '150', '155', '160', '165', '170', '175', '180') not null, stocks_num int not null, primary key(stocks_id), foreign key (ID) references items(ID) )ENGINE=InnoDB DEFAULT CHARSET=utf8; create table monthlysales( month_id int auto_increment not null, ID varchar(7) not null, month ENUM('1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12') not null, amount int not null, primary key(month_id), foreign key (ID) references items(ID) )ENGINE=InnoDB DEFAULT CHARSET=utf8; create table annualsales( annual_id int auto_increment not null, ID varchar(7) not null, year varchar(4) not null, amount int not null, primary key(annual_id), foreign key (ID) references items(ID) )ENGINE=InnoDB DEFAULT CHARSET=utf8; create table users( ID int(11) auto_increment not null, user_type enum('系统管理员','服装设计师','销售管理员') not null, name varchar(20) not null, password varchar(20) not null, createdAt datetime, updatedAt datetime, primary key(ID) )ENGINE=InnoDB DEFAULT CHARSET=utf8; create table pictures_items_relation( ID varchar(7) not null, pic_id int not null, primary key(ID,pic_id), foreign key (ID) references items(ID), foreign key (pic_id) references pictures(pic_id) )ENGINE=InnoDB DEFAULT CHARSET=utf8;
true
669d2714245c64c14eb6ad2c143093adf6b898f7
SQL
zinnun/mysql
/SQL5.sql
UTF-8
323
2.71875
3
[]
no_license
# BETWEEN & NOT BETWEEN OPERATOR # BETWEEN & NOT BETWEEN OPERATOR USE WORLD; SELECT * FROM COUNTRY; SELECT * FROM COUNTRY WHERE POPULATION >= 15000000 AND POPULATION <=18000000; SELECT * FROM COUNTRY WHERE POPULATION BETWEEN 15000000 AND 18000000; SELECT * FROM COUNTRY WHERE POPULATION NOT BETWEEN 15000000 AND 18000000;
true
30155c5ff98a2fe4f91b6f4dd9f49c1147de1b8f
SQL
leandroairzone/senaiProjetoInicial-3T
/senaiMateriais_DML.sql
ISO-8859-1
932
2.515625
3
[]
no_license
USE SenaiMateriais; INSERT INTO Usuario (nome,email,senha) VALUES ('Vando silva','vando@gmail.com','van123') , ('Helena souza','helena@gmail.com','hen123'); INSERT INTO TipoEquipamento (nomeTipo) VALUES ('informatica') ,('moblia') ,('eletroeletronica'); INSERT INTO sala (nome,andar,metragem) VALUES ('informatica','1','1004') , ('laboratorio','1','1004') ; INSERT INTO Equipamento (idEquipamento, idSala,TipoEquipamento,statu,marca,numeroSerie,numeroPatrimonio,descrio) VALUES (1,1,'informatica',1,'samsung','JKE000001',15,'notebook Samasung Duo core 4GB 500GB tela full HD 15.6 windows 10') ,(2,1, 'informatica',1,'positivo','TMR000002',16'notebook positivo Duo core 4GB 1TB windos 10'); ;
true
eea8189a49a94920cd5c733c309c49ce8edb82b2
SQL
Missheart/ssm-miner
/doc/ddl.sql
UTF-8
19,986
3.859375
4
[]
no_license
DROP TABLE IF EXISTS contract; CREATE TABLE contract /*矿机租赁合约表*/ ( id BIGINT AUTO_INCREMENT PRIMARY KEY, /*自增主键*/ user_id BIGINT NOT NULL, /*矿机租赁合约用户 ID */ order_id BIGINT NOT NULL, /*矿机租赁合约订单 ID */ machine_id BIGINT NOT NULL, /*矿机租赁合约订单 ID */ quantity Integer NOT NULL, /*矿机租赁合约订单 ID */ start_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL, /*矿机租赁合约开始执行时间 */ end_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL, /*矿机租赁合约结束执行时间 */ deposit DECIMAL(36,10) NULL, /*矿机租赁合约押金 */ contract_state INT NULL, /*矿机租赁合约状态 OTHER(0, "OTHER"),WAITING(1, "WAITING"),RUNNING(2, "RUNNING"),EXPIRE(3, "EXPIRE"),DELETE(4, "DELETE"); */ created TIMESTAMP DEFAULT CURRENT_TIMESTAMP NULL, /*记录创建时间*/ updated TIMESTAMP DEFAULT CURRENT_TIMESTAMP NULL, /*记录修改时间*/ CONSTRAINT uniq_id UNIQUE (id) ) ENGINE = InnoDB DEFAULT CHARSET 'utf8'; ALTER TABLE contract ADD INDEX idx_user_id(user_id); ALTER TABLE contract ADD INDEX idx_order_id(order_id); ALTER TABLE contract ADD INDEX idx_machine_id(machine_id); DROP TABLE IF EXISTS goods_category; CREATE TABLE goods_category /*商品分类表*/ ( id BIGINT AUTO_INCREMENT PRIMARY KEY, /*自增主键*/ category_name VARCHAR(128) NOT NULL, /*商品分类名称*/ parent BIGINT DEFAULT '0' NOT NULL, /*父级商品分类*/ idx INT DEFAULT '0' NULL, /*商品分类显示排序,值大优先*/ created TIMESTAMP DEFAULT CURRENT_TIMESTAMP NULL, /*记录创建时间*/ updated TIMESTAMP DEFAULT CURRENT_TIMESTAMP NULL, /*记录修改时间*/ CONSTRAINT uniq_id UNIQUE (id) ) ENGINE = InnoDB DEFAULT CHARSET 'utf8'; DROP TABLE IF EXISTS machine; CREATE TABLE machine /*共享矿机(商品)信息表,注意,同一个ID的共享矿机的数量可能有很多,可以理解为一类共享矿机(商品)*/ ( id BIGINT AUTO_INCREMENT PRIMARY KEY, /*自增主键*/ machine_name VARCHAR(256) NOT NULL, /*共享矿机(商品)名称*/ category_id BIGINT NULL, /*共享矿机(商品)分类*/ original_price DECIMAL(36,10) NULL, /*共享矿机(商品)原价*/ current_price DECIMAL(36,10) NULL, /*共享矿机(商品)现价*/ currency_type INT NULL, /*共享矿机挖矿币种 OTHER(0, "OTHER"),BTC(1, "BTC"),ETH(2, "ETH"),RMB(3, "RMB");*/ icon VARCHAR(20) NULL, /*共享矿机(商品)icon */ pic_uri TEXT NULL, /*共享矿机(商品)展示图片,逗号分隔的uri */ machine_state INT NULL, /*共享矿机(商品)状态 OTHER(0, "OTHER"),OPEN(1, "OPEN"),CLOSED(2, "CLOSED"); */ description TEXT NULL, /*共享矿机(商品)描述信息(商品详情)*/ loan_limit INT NULL, /*共享矿机(商品)最大台数限制 */ compute_share FLOAT NULL, /*共享矿机(商品)算力 */ contract_span INT NULL, /*共享矿机(商品)最小租期限制 */ miner_id BIGINT NOT NULL, /*共享矿机(商品)所属的物理矿机 */ created TIMESTAMP DEFAULT CURRENT_TIMESTAMP NULL, /*记录创建时间*/ updated TIMESTAMP DEFAULT CURRENT_TIMESTAMP NULL, /*记录修改时间*/ CONSTRAINT uniq_id UNIQUE (id) ) ENGINE = InnoDB DEFAULT CHARSET 'utf8'; ALTER TABLE machine ADD INDEX idx_miner_id(miner_id); DROP TABLE IF EXISTS miner; CREATE TABLE miner /*物理矿机信息表(B 端资产)*/ ( id BIGINT AUTO_INCREMENT PRIMARY KEY, /*自增主键*/ miner_name VARCHAR(256) NULL, /*物理矿机名称*/ total_compute INT NULL, /*物理矿机总算力*/ description TEXT NULL, /*物理矿机描述信息*/ created TIMESTAMP DEFAULT CURRENT_TIMESTAMP NULL, /*记录创建时间*/ updated TIMESTAMP DEFAULT CURRENT_TIMESTAMP NULL, /*记录修改时间*/ CONSTRAINT uniq_id UNIQUE (id) ) ENGINE = InnoDB DEFAULT CHARSET 'utf8'; DROP TABLE IF EXISTS miner_log; CREATE TABLE miner_log /*物理矿机挖矿日志*/ ( id BIGINT AUTO_INCREMENT PRIMARY KEY, /*自增主键*/ machine_id BIGINT NULL, /*共享矿机 ID*/ contract_id BIGINT NULL, /*共享矿机租赁合约 ID*/ miner_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL, /*挖矿日期*/ profit DECIMAL NULL, /*物理矿机总利润*/ created TIMESTAMP DEFAULT CURRENT_TIMESTAMP NULL, /*记录创建时间*/ updated TIMESTAMP DEFAULT CURRENT_TIMESTAMP NULL, /*记录修改时间*/ CONSTRAINT uniq_id UNIQUE (id) ) ENGINE = InnoDB DEFAULT CHARSET 'utf8'; ALTER TABLE miner_log ADD INDEX idx_machine_id(machine_id); ALTER TABLE miner_log ADD INDEX idx_contract_id(contract_id); DROP TABLE IF EXISTS orders; CREATE TABLE orders /*共享矿机租赁订单*/ ( id BIGINT AUTO_INCREMENT PRIMARY KEY, /*自增主键*/ total_price DECIMAL(36,10) NOT NULL, /*订单总价格*/ order_state INT DEFAULT '0' NULL, /*订单状态 OTHER(0, "OTHER"), INIT(1, "INIT"), PLACED(2, "PLACED"), WAITING_PAY(3, "WAITING_PAY"), TIME_OUT(9, "TIME_OUT"), PAYED(10, "PAYED"), DELIVERING(11, "DELIVERING"), DEAL(20, "DEAL"), RETURN_INIT(30, "RETURN_INIT"), RETURN_WAITING_APPROVED(31, "RETURN_WAITING_APPROVED"), RETURN_APPROVED(32, "RETURN_APPROVED"), RETURN_COMPLETE(33, "RETURN_COMPLETE"), CLOSED(40, "CLOSED"), DELETE(41, "DELETE"); */ user_id BIGINT NOT NULL, /*订单下单人ID*/ description VARCHAR(512) NULL, /*订单备注*/ created TIMESTAMP DEFAULT CURRENT_TIMESTAMP NULL, /*记录创建时间*/ updated TIMESTAMP DEFAULT CURRENT_TIMESTAMP NULL, /*记录修改时间*/ CONSTRAINT uniq_id UNIQUE (id) ) ENGINE = InnoDB DEFAULT CHARSET 'utf8'; ALTER TABLE orders ADD INDEX idx_order_state(order_state); ALTER TABLE orders ADD INDEX idx_user_id(user_id); DROP TABLE IF EXISTS order_item; CREATE TABLE order_item /*订单项(行),目前默认单行订单,保留扩展能力*/ ( id BIGINT AUTO_INCREMENT PRIMARY KEY, /*自增主键*/ order_id BIGINT NOT NULL, /*所属订单ID*/ machine_id BIGINT NOT NULL, /*共享矿机ID*/ quantity INT DEFAULT '1' NULL, /*订单行数量*/ price DECIMAL(36,10) DEFAULT '0' NULL, /*订单行单价*/ total_price DECIMAL(36,10) DEFAULT '0' NULL, /*订单行合计价格*/ lease_days INT DEFAULT '1' NULL, /*租期*/ created TIMESTAMP DEFAULT CURRENT_TIMESTAMP NULL, /*记录创建时间*/ updated TIMESTAMP DEFAULT CURRENT_TIMESTAMP NULL, /*记录修改时间*/ CONSTRAINT uniq_id UNIQUE (id) ) ENGINE = InnoDB DEFAULT CHARSET 'utf8'; ALTER TABLE order_item ADD INDEX idx_order_id(order_id); ALTER TABLE order_item ADD INDEX idx_machine_id(machine_id); DROP TABLE IF EXISTS payment; CREATE TABLE payment /*支付表*/ ( id BIGINT AUTO_INCREMENT PRIMARY KEY, /*自增主键*/ external_id VARCHAR(128) NULL, /*展示ID,不暴露内部支付ID*/ method INT DEFAULT '0' NULL, /*支付方式*/ amount DECIMAL(36,10) NULL, /*支付金额*/ direction INT DEFAULT '0' NULL, /*支付方向 OTHER(0, "OTHER"),IN(1, "IN"),OUT(2, "OUT");*/ transaction_id BIGINT NULL, /*所属交易ID*/ third_party_id VARCHAR(1024) NULL, /*第三方支付流水ID*/ state INT NULL, /*支付状态 OTHER(0, "OTHER"),WAITING_PAY(1, "WAITING_PAY"),PAYED(2, "PAYED"),CLOSED(3, "CLOSED"),DELETE(4, "DELETE");*/ result VARCHAR(1024) NULL, /*支付结果*/ order_id BIGINT NULL, /*支付的订单ID*/ created TIMESTAMP DEFAULT CURRENT_TIMESTAMP NULL, /*记录创建时间*/ updated TIMESTAMP DEFAULT CURRENT_TIMESTAMP NULL, /*记录修改时间*/ CONSTRAINT uniq_id UNIQUE (id) ) ENGINE = InnoDB DEFAULT CHARSET 'utf8'; DROP TABLE IF EXISTS stock_record; CREATE TABLE stock_record /*共享矿机库存表*/ ( id BIGINT AUTO_INCREMENT PRIMARY KEY, /*自增主键*/ machine_id BIGINT NOT NULL, /*共享矿机ID*/ quantity INT NULL, /*总数量*/ locked_in_order INT NULL, /*订单中锁定的数量*/ locked_by_system INT NULL, /*系统锁定的数量,保留,未使用*/ sold INT NULL, /*已经售卖(租赁)的数量*/ available INT NULL, /*可用数量*/ created TIMESTAMP DEFAULT CURRENT_TIMESTAMP NULL, /*记录创建时间*/ updated TIMESTAMP DEFAULT CURRENT_TIMESTAMP NULL, /*记录修改时间*/ version INT DEFAULT 0 NOT NULL, /*数据库乐观锁版本号*/ CONSTRAINT uniq_id UNIQUE (id) ) ENGINE = InnoDB DEFAULT CHARSET 'utf8'; ALTER TABLE stock_record ADD INDEX idx_machine_id(machine_id); DROP TABLE IF EXISTS transactions; CREATE TABLE transactions ( id BIGINT AUTO_INCREMENT PRIMARY KEY, /*自增主键*/ external_id VARCHAR(128) NULL, /*自增主键*/ from_id BIGINT NOT NULL, /*源地址*/ to_id BIGINT NOT NULL, /*目的地址*/ value DECIMAL(36,10) NULL, /*转账金额*/ state INT NULL, /*转账状态 OTHER(0, "OTHER"),INIT(1, "INIT"),LOCKED(2, "LOCKED"),COMPLETE(3, "COMPLETE"),FAIL_BY_SOURCE(4, "FAIL_BY_SOURCE"),FAIL_BY_DEST(5, "FAIL_BY_DEST");*/ created TIMESTAMP DEFAULT CURRENT_TIMESTAMP NULL, /*记录创建时间*/ updated TIMESTAMP DEFAULT CURRENT_TIMESTAMP NULL, /*记录修改时间*/ CONSTRAINT uniq_id UNIQUE (id) ) ENGINE = InnoDB DEFAULT CHARSET 'utf8'; ALTER TABLE transactions ADD INDEX idx_from_id(from_id); ALTER TABLE transactions ADD INDEX idx_to_id(to_id); DROP TABLE IF EXISTS users; CREATE TABLE users /*资产账户表*/ ( id BIGINT AUTO_INCREMENT PRIMARY KEY, /*自增主键*/ nick_name VARCHAR(64) NULL, /*昵称*/ openid VARCHAR(256) NULL, /*微信OpenID*/ session_key VARCHAR(256) NULL, /*微信SessionKey,保留,未使用*/ new_user TINYINT(1) NULL, /*是否新用户,营销专用*/ phone VARCHAR(64) NULL, /*手机号*/ pwd VARCHAR(512) NULL, /*密码sha256*/ kyc_info TEXT NULL, /*KYC信息,保留,未使用*/ avatar_url TEXT NULL, /*头像url*/ city VARCHAR(32) NULL, /*微信城市*/ province VARCHAR(32) NULL, /*微信省份*/ country VARCHAR(64) NULL, /*微信国家*/ lang VARCHAR(32) NULL, /*微信语言*/ gender INT NULL, /*微信性别*/ token VARCHAR(256) NULL, /*微信Token*/ wallet_id BIGINT NULL, /*用户钱包 ID*/ created TIMESTAMP DEFAULT CURRENT_TIMESTAMP NULL, /*记录创建时间*/ updated TIMESTAMP DEFAULT CURRENT_TIMESTAMP NULL, /*记录修改时间*/ bank_account varchar(50) DEFAULT NULL, /*记录用户银行账号*/ CONSTRAINT uniq_id UNIQUE (id) ) ENGINE = InnoDB DEFAULT CHARSET 'utf8'; ALTER TABLE users ADD INDEX idx_phone(phone); DROP TABLE IF EXISTS user_account; CREATE TABLE user_account /*资产账户表*/ ( id BIGINT AUTO_INCREMENT PRIMARY KEY, /*自增主键*/ currency_type INT NULL, /*资产账户币种*/ balance DECIMAL(36,10) NULL, /*资产账户余额*/ address VARCHAR(256) NULL, /*资产账户数字货币提币地址*/ wallet_id BIGINT NOT NULL, /*资产账户所属账户 ID*/ created TIMESTAMP DEFAULT CURRENT_TIMESTAMP NULL, /*记录创建时间*/ updated TIMESTAMP DEFAULT CURRENT_TIMESTAMP NULL, /*记录修改时间*/ CONSTRAINT uniq_id UNIQUE (id) ) ENGINE = InnoDB DEFAULT CHARSET 'utf8'; ALTER TABLE user_account ADD INDEX idx_wallet_id(wallet_id); DROP TABLE IF EXISTS wallet; CREATE TABLE wallet /*钱包表*/ ( id BIGINT AUTO_INCREMENT PRIMARY KEY, /*自增主键*/ owner_id BIGINT NOT NULL, /*主人User ID*/ created TIMESTAMP DEFAULT CURRENT_TIMESTAMP NULL, /*记录创建时间*/ updated TIMESTAMP DEFAULT CURRENT_TIMESTAMP NULL, /*记录修改时间*/ CONSTRAINT uniq_id UNIQUE (id) ) ENGINE = InnoDB DEFAULT CHARSET 'utf8'; ALTER TABLE wallet ADD INDEX idx_owner_id(owner_id); DROP TABLE IF EXISTS notice; CREATE TABLE notice /*公告表*/ ( id BIGINT AUTO_INCREMENT PRIMARY KEY, /*自增主键*/ title VARCHAR(128) NOT NULL, /*公告标题*/ content TEXT NOT NULL, /*公告内容*/ post_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL, /*公告发布时间*/ contentStateValue INT DEFAULT '0' NULL, /*公告状态 OTHER(0, "OTHER"),RECOMMENDED(1, "RECOMMENDED"),NORMAL(2, "NORMAL"),DELETED(3, "DELETED");*/ created TIMESTAMP DEFAULT CURRENT_TIMESTAMP NULL, /*记录创建时间*/ updated TIMESTAMP DEFAULT CURRENT_TIMESTAMP NULL, /*记录修改时间*/ CONSTRAINT uniq_id UNIQUE (id) ) ENGINE = InnoDB DEFAULT CHARSET 'utf8'; DROP TABLE IF EXISTS banner; CREATE TABLE banner /*Banner表*/ ( id BIGINT AUTO_INCREMENT PRIMARY KEY, /*自增主键*/ title VARCHAR(128) NOT NULL, /*Banner标题*/ image VARCHAR(1024) NOT NULL, /*Banner图片 URI*/ link VARCHAR(1024) NOT NULL, /*Banner外链 URI*/ post_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL, /*Banner发布时间*/ content_state_value INT DEFAULT '0' NULL, /*公告状态 OTHER(0, "OTHER"),RECOMMENDED(1, "RECOMMENDED"),NORMAL(2, "NORMAL"),DELETED(3, "DELETED");*/ created TIMESTAMP DEFAULT CURRENT_TIMESTAMP NULL, /*记录创建时间*/ updated TIMESTAMP DEFAULT CURRENT_TIMESTAMP NULL, /*记录修改时间*/ CONSTRAINT uniq_id UNIQUE (id) ) ENGINE = InnoDB DEFAULT CHARSET 'utf8'; DROP TABLE IF EXISTS config; CREATE TABLE config ( id BIGINT AUTO_INCREMENT PRIMARY KEY, /*自增主键*/ k VARCHAR(128) NOT NULL, /* key */ v TEXT NOT NULL, /* value */ created TIMESTAMP DEFAULT CURRENT_TIMESTAMP NULL, /*记录创建时间*/ updated TIMESTAMP DEFAULT CURRENT_TIMESTAMP NULL, /*记录修改时间*/ CONSTRAINT uniq_id UNIQUE (id) ) ENGINE = InnoDB DEFAULT CHARSET 'utf8'; DROP TABLE IF EXISTS contract_profit; CREATE TABLE contract_profit /*合约收益记录*/ ( id BIGINT AUTO_INCREMENT PRIMARY KEY, /*自增主键*/ contract_id BIGINT NULL, /*共享矿机租赁合约 ID*/ machine_id BIGINT NOT NULL, /*共享矿机ID*/ quantity INT NULL, /*本合约订单中租赁的machine_id这类共享矿机的总数量*/ miner_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL, /*挖矿日期*/ profit DECIMAL(36,10) NULL, /*物理矿机总利润*/ created TIMESTAMP DEFAULT CURRENT_TIMESTAMP NULL, /*记录创建时间*/ updated TIMESTAMP DEFAULT CURRENT_TIMESTAMP NULL, /*记录修改时间*/ CONSTRAINT uniq_id UNIQUE (id) ) ENGINE = InnoDB DEFAULT CHARSET 'utf8'; ALTER TABLE contract_profit ADD INDEX idx_contract_id(contract_id); -- 2018-06-04 -- 管理员表 DROP TABLE IF EXISTS `manager`; CREATE TABLE `manager` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `role_id` int(10) NOT NULL DEFAULT '0' COMMENT '角色ID', `nickname` varchar(64) NOT NULL DEFAULT '' COMMENT '昵称', `username` varchar(64) NOT NULL DEFAULT '' COMMENT '用户名', `password` varchar(64) NOT NULL DEFAULT '' COMMENT '密码', `salt` varchar(10) NOT NULL DEFAULT '' COMMENT '盐', `phone` varchar(11) NOT NULL DEFAULT '' COMMENT '手机号', `supper_master` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否为超级管理员:0-否,1-是', `enable` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否可用:0-不可用,1-可用', `create_time` int(10) NOT NULL DEFAULT '0' COMMENT '创建时间', `last_login_time` int(10) NOT NULL DEFAULT '0' COMMENT '上次登陆时间', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COMMENT='管理员'; -- ---------------------------- -- Records of manager -- ---------------------------- INSERT INTO `manager` VALUES ('1', '0', '慢慢', 'mine', '11fa0081096f48bf8c9e2fc6fc10b0d0', '6609', '15928803350', '1', '1', '0', '1527730771'); -- 管理员角色表 DROP TABLE IF EXISTS `manager_role`; CREATE TABLE `manager_role` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `role` varchar(64) NOT NULL DEFAULT '' COMMENT '角色', `description` varchar(255) NOT NULL DEFAULT '' COMMENT '角色描述', `auth_access` text NOT NULL COMMENT '权限', `create_time` int(10) NOT NULL, `update_time` int(10) NOT NULL DEFAULT '0', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='管理员角色'; -- 优惠券表(运营需求,待java使用确定) DROP TABLE IF EXISTS `coupon`; CREATE TABLE `coupon` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `user_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '用户ID', `discount` decimal(5,2) NOT NULL DEFAULT '0.00' COMMENT '折扣力度', `order_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '订单ID', `state` int(10) NOT NULL DEFAULT '0' COMMENT '优惠券状态(0-未使用,1-订单锁定,2-已使用,3-已过期)', `user_time` timestamp NULL DEFAULT NULL, `created` timestamp NULL DEFAULT CURRENT_TIMESTAMP, `updated` timestamp NULL DEFAULT CURRENT_TIMESTAMP, `isremove` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否删除(0-未删除, 1-已删除)', PRIMARY KEY (`id`), KEY `idx_user_id` (`user_id`) USING BTREE, KEY `idx_order_id` (`order_id`) USING BTREE ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
true
80ec1e4ec25a1f9344bc891d7f545ee145ce917c
SQL
commercekitchen/cpldl
/db/structure.sql
UTF-8
46,722
3.171875
3
[]
no_license
SET statement_timeout = 0; SET lock_timeout = 0; SET idle_in_transaction_session_timeout = 0; SET client_encoding = 'UTF8'; SET standard_conforming_strings = on; SELECT pg_catalog.set_config('search_path', '', false); SET check_function_bodies = false; SET xmloption = content; SET client_min_messages = warning; SET row_security = off; -- -- Name: citext; Type: EXTENSION; Schema: -; Owner: - -- CREATE EXTENSION IF NOT EXISTS citext WITH SCHEMA public; -- -- Name: EXTENSION citext; Type: COMMENT; Schema: -; Owner: - -- COMMENT ON EXTENSION citext IS 'data type for case-insensitive character strings'; -- -- Name: fuzzystrmatch; Type: EXTENSION; Schema: -; Owner: - -- CREATE EXTENSION IF NOT EXISTS fuzzystrmatch WITH SCHEMA public; -- -- Name: EXTENSION fuzzystrmatch; Type: COMMENT; Schema: -; Owner: - -- COMMENT ON EXTENSION fuzzystrmatch IS 'determine similarities and distance between strings'; -- -- Name: pg_trgm; Type: EXTENSION; Schema: -; Owner: - -- CREATE EXTENSION IF NOT EXISTS pg_trgm WITH SCHEMA public; -- -- Name: EXTENSION pg_trgm; Type: COMMENT; Schema: -; Owner: - -- COMMENT ON EXTENSION pg_trgm IS 'text similarity measurement and index searching based on trigrams'; -- -- Name: pg_search_dmetaphone(text); Type: FUNCTION; Schema: public; Owner: - -- CREATE FUNCTION public.pg_search_dmetaphone(text) RETURNS text LANGUAGE sql IMMUTABLE STRICT AS $_$ SELECT array_to_string(ARRAY(SELECT dmetaphone(unnest(regexp_split_to_array($1, E'\\s+')))), ' ') $_$; SET default_tablespace = ''; -- -- Name: ar_internal_metadata; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.ar_internal_metadata ( key character varying NOT NULL, value character varying, created_at timestamp without time zone NOT NULL, updated_at timestamp without time zone NOT NULL ); -- -- Name: attachments; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.attachments ( id integer NOT NULL, course_id integer, title character varying, created_at timestamp without time zone NOT NULL, updated_at timestamp without time zone NOT NULL, document_file_name character varying, document_content_type character varying, document_file_size bigint, document_updated_at timestamp without time zone, doc_type character varying, file_description character varying, attachment_order integer DEFAULT 0 ); -- -- Name: attachments_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- CREATE SEQUENCE public.attachments_id_seq AS integer START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; -- -- Name: attachments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- ALTER SEQUENCE public.attachments_id_seq OWNED BY public.attachments.id; -- -- Name: categories; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.categories ( id integer NOT NULL, name character varying, category_order integer, organization_id integer, enabled boolean DEFAULT true, created_at timestamp without time zone NOT NULL, updated_at timestamp without time zone NOT NULL ); -- -- Name: categories_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- CREATE SEQUENCE public.categories_id_seq AS integer START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; -- -- Name: categories_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- ALTER SEQUENCE public.categories_id_seq OWNED BY public.categories.id; -- -- Name: ckeditor_assets; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.ckeditor_assets ( id integer NOT NULL, data_file_name character varying NOT NULL, data_content_type character varying, data_file_size integer, assetable_id integer, assetable_type character varying(30), type character varying(30), width integer, height integer, created_at timestamp without time zone NOT NULL, updated_at timestamp without time zone NOT NULL ); -- -- Name: ckeditor_assets_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- CREATE SEQUENCE public.ckeditor_assets_id_seq AS integer START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; -- -- Name: ckeditor_assets_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- ALTER SEQUENCE public.ckeditor_assets_id_seq OWNED BY public.ckeditor_assets.id; -- -- Name: cms_pages; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.cms_pages ( id integer NOT NULL, title character varying(90), author character varying, audience character varying, pub_status character varying DEFAULT 'D'::character varying, pub_date timestamp without time zone, seo_page_title character varying(90), meta_desc character varying(156), created_at timestamp without time zone NOT NULL, updated_at timestamp without time zone NOT NULL, slug character varying, cms_page_order integer, language_id integer, body text, organization_id integer ); -- -- Name: cms_pages_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- CREATE SEQUENCE public.cms_pages_id_seq AS integer START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; -- -- Name: cms_pages_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- ALTER SEQUENCE public.cms_pages_id_seq OWNED BY public.cms_pages.id; -- -- Name: contacts; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.contacts ( id integer NOT NULL, first_name character varying(30) NOT NULL, last_name character varying(30) NOT NULL, organization character varying(50) NOT NULL, city character varying(30) NOT NULL, state character varying(2) NOT NULL, email character varying(30) NOT NULL, phone character varying(20), comments text NOT NULL, created_at timestamp without time zone NOT NULL, updated_at timestamp without time zone NOT NULL ); -- -- Name: contacts_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- CREATE SEQUENCE public.contacts_id_seq AS integer START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; -- -- Name: contacts_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- ALTER SEQUENCE public.contacts_id_seq OWNED BY public.contacts.id; -- -- Name: course_progresses; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.course_progresses ( id integer NOT NULL, user_id integer, course_id integer, started_at timestamp without time zone, completed_at timestamp without time zone, created_at timestamp without time zone NOT NULL, updated_at timestamp without time zone NOT NULL, tracked boolean DEFAULT false ); -- -- Name: course_progresses_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- CREATE SEQUENCE public.course_progresses_id_seq AS integer START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; -- -- Name: course_progresses_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- ALTER SEQUENCE public.course_progresses_id_seq OWNED BY public.course_progresses.id; -- -- Name: course_topics; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.course_topics ( id integer NOT NULL, topic_id integer, course_id integer, created_at timestamp without time zone NOT NULL, updated_at timestamp without time zone NOT NULL ); -- -- Name: course_topics_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- CREATE SEQUENCE public.course_topics_id_seq AS integer START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; -- -- Name: course_topics_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- ALTER SEQUENCE public.course_topics_id_seq OWNED BY public.course_topics.id; -- -- Name: courses; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.courses ( id integer NOT NULL, title public.citext, seo_page_title character varying(90), meta_desc character varying(156), summary character varying(156), description text, contributor character varying, pub_status character varying DEFAULT 'D'::character varying, created_at timestamp without time zone NOT NULL, updated_at timestamp without time zone NOT NULL, language_id integer, level character varying, notes text, slug character varying, course_order integer, pub_date timestamp without time zone, format character varying, parent_id integer, category_id integer, organization_id integer, access_level integer DEFAULT 0 NOT NULL, survey_url character varying ); -- -- Name: courses_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- CREATE SEQUENCE public.courses_id_seq AS integer START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; -- -- Name: courses_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- ALTER SEQUENCE public.courses_id_seq OWNED BY public.courses.id; -- -- Name: data_migrations; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.data_migrations ( version character varying NOT NULL ); -- -- Name: footer_links; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.footer_links ( id bigint NOT NULL, organization_id bigint, label character varying NOT NULL, url character varying NOT NULL, created_at timestamp without time zone NOT NULL, updated_at timestamp without time zone NOT NULL, language_id bigint ); -- -- Name: footer_links_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- CREATE SEQUENCE public.footer_links_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; -- -- Name: footer_links_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- ALTER SEQUENCE public.footer_links_id_seq OWNED BY public.footer_links.id; -- -- Name: friendly_id_slugs; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.friendly_id_slugs ( id integer NOT NULL, slug character varying NOT NULL, sluggable_id integer NOT NULL, sluggable_type character varying(50), scope character varying, created_at timestamp without time zone ); -- -- Name: friendly_id_slugs_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- CREATE SEQUENCE public.friendly_id_slugs_id_seq AS integer START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; -- -- Name: friendly_id_slugs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- ALTER SEQUENCE public.friendly_id_slugs_id_seq OWNED BY public.friendly_id_slugs.id; -- -- Name: languages; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.languages ( id integer NOT NULL, name character varying, created_at timestamp without time zone NOT NULL, updated_at timestamp without time zone NOT NULL ); -- -- Name: languages_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- CREATE SEQUENCE public.languages_id_seq AS integer START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; -- -- Name: languages_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- ALTER SEQUENCE public.languages_id_seq OWNED BY public.languages.id; -- -- Name: lesson_completions; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.lesson_completions ( id integer NOT NULL, course_progress_id integer, lesson_id integer, created_at timestamp without time zone NOT NULL, updated_at timestamp without time zone NOT NULL ); -- -- Name: lesson_completions_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- CREATE SEQUENCE public.lesson_completions_id_seq AS integer START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; -- -- Name: lesson_completions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- ALTER SEQUENCE public.lesson_completions_id_seq OWNED BY public.lesson_completions.id; -- -- Name: lessons; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.lessons ( id integer NOT NULL, lesson_order integer, title character varying, duration integer, course_id integer, created_at timestamp without time zone NOT NULL, updated_at timestamp without time zone NOT NULL, slug character varying, summary character varying, story_line character varying(156), seo_page_title character varying(90), meta_desc character varying(156), is_assessment boolean, story_line_file_name character varying, story_line_content_type character varying, story_line_file_size bigint, story_line_updated_at timestamp without time zone, parent_id integer ); -- -- Name: lessons_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- CREATE SEQUENCE public.lessons_id_seq AS integer START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; -- -- Name: lessons_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- ALTER SEQUENCE public.lessons_id_seq OWNED BY public.lessons.id; -- -- Name: library_locations; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.library_locations ( id integer NOT NULL, name character varying, zipcode integer, created_at timestamp without time zone NOT NULL, updated_at timestamp without time zone NOT NULL, organization_id integer, sort_order integer DEFAULT 0, custom boolean DEFAULT false ); -- -- Name: library_locations_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- CREATE SEQUENCE public.library_locations_id_seq AS integer START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; -- -- Name: library_locations_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- ALTER SEQUENCE public.library_locations_id_seq OWNED BY public.library_locations.id; -- -- Name: organizations; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.organizations ( id integer NOT NULL, name character varying, subdomain character varying, created_at timestamp without time zone NOT NULL, updated_at timestamp without time zone NOT NULL, branches boolean, accepts_programs boolean, library_card_login boolean DEFAULT false, accepts_custom_branches boolean DEFAULT false, login_required boolean DEFAULT true, preferences jsonb DEFAULT '{}'::jsonb NOT NULL, accepts_partners boolean DEFAULT false, use_subdomain_for_training_site boolean DEFAULT false NOT NULL ); -- -- Name: organizations_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- CREATE SEQUENCE public.organizations_id_seq AS integer START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; -- -- Name: organizations_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- ALTER SEQUENCE public.organizations_id_seq OWNED BY public.organizations.id; -- -- Name: partners; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.partners ( id bigint NOT NULL, organization_id bigint, name character varying DEFAULT ''::character varying NOT NULL, created_at timestamp without time zone NOT NULL, updated_at timestamp without time zone NOT NULL ); -- -- Name: partners_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- CREATE SEQUENCE public.partners_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; -- -- Name: partners_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- ALTER SEQUENCE public.partners_id_seq OWNED BY public.partners.id; -- -- Name: pg_search_documents; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.pg_search_documents ( id integer NOT NULL, content text, searchable_type character varying, searchable_id integer, created_at timestamp without time zone NOT NULL, updated_at timestamp without time zone NOT NULL ); -- -- Name: pg_search_documents_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- CREATE SEQUENCE public.pg_search_documents_id_seq AS integer START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; -- -- Name: pg_search_documents_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- ALTER SEQUENCE public.pg_search_documents_id_seq OWNED BY public.pg_search_documents.id; -- -- Name: profiles; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.profiles ( id integer NOT NULL, first_name character varying, zip_code character varying, user_id integer, created_at timestamp without time zone NOT NULL, updated_at timestamp without time zone NOT NULL, language_id integer, library_location_id integer, last_name character varying, phone character varying, street_address character varying, city character varying, state character varying, opt_out_of_recommendations boolean DEFAULT false ); -- -- Name: profiles_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- CREATE SEQUENCE public.profiles_id_seq AS integer START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; -- -- Name: profiles_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- ALTER SEQUENCE public.profiles_id_seq OWNED BY public.profiles.id; -- -- Name: program_locations; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.program_locations ( id integer NOT NULL, location_name character varying, created_at timestamp without time zone NOT NULL, updated_at timestamp without time zone NOT NULL, enabled boolean DEFAULT true, program_id integer ); -- -- Name: program_locations_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- CREATE SEQUENCE public.program_locations_id_seq AS integer START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; -- -- Name: program_locations_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- ALTER SEQUENCE public.program_locations_id_seq OWNED BY public.program_locations.id; -- -- Name: programs; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.programs ( id integer NOT NULL, program_name character varying, location_required boolean DEFAULT false, organization_id integer, created_at timestamp without time zone NOT NULL, updated_at timestamp without time zone NOT NULL, parent_type integer, active boolean DEFAULT true NOT NULL ); -- -- Name: programs_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- CREATE SEQUENCE public.programs_id_seq AS integer START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; -- -- Name: programs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- ALTER SEQUENCE public.programs_id_seq OWNED BY public.programs.id; -- -- Name: resource_links; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.resource_links ( id bigint NOT NULL, course_id bigint, label character varying NOT NULL, url character varying NOT NULL, created_at timestamp without time zone NOT NULL, updated_at timestamp without time zone NOT NULL ); -- -- Name: resource_links_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- CREATE SEQUENCE public.resource_links_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; -- -- Name: resource_links_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- ALTER SEQUENCE public.resource_links_id_seq OWNED BY public.resource_links.id; -- -- Name: roles; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.roles ( id integer NOT NULL, name character varying, resource_type character varying, resource_id integer, created_at timestamp without time zone, updated_at timestamp without time zone ); -- -- Name: roles_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- CREATE SEQUENCE public.roles_id_seq AS integer START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; -- -- Name: roles_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- ALTER SEQUENCE public.roles_id_seq OWNED BY public.roles.id; -- -- Name: schema_migrations; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.schema_migrations ( version character varying NOT NULL ); -- -- Name: schools; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.schools ( id integer NOT NULL, school_name character varying, enabled boolean DEFAULT true, organization_id integer, created_at timestamp without time zone NOT NULL, updated_at timestamp without time zone NOT NULL, school_type integer ); -- -- Name: schools_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- CREATE SEQUENCE public.schools_id_seq AS integer START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; -- -- Name: schools_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- ALTER SEQUENCE public.schools_id_seq OWNED BY public.schools.id; -- -- Name: topics; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.topics ( id integer NOT NULL, title character varying, created_at timestamp without time zone NOT NULL, updated_at timestamp without time zone NOT NULL ); -- -- Name: topics_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- CREATE SEQUENCE public.topics_id_seq AS integer START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; -- -- Name: topics_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- ALTER SEQUENCE public.topics_id_seq OWNED BY public.topics.id; -- -- Name: translations; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.translations ( id integer NOT NULL, locale character varying, key character varying, value text, interpolations text, is_proc boolean, created_at timestamp without time zone NOT NULL, updated_at timestamp without time zone NOT NULL ); -- -- Name: translations_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- CREATE SEQUENCE public.translations_id_seq AS integer START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; -- -- Name: translations_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- ALTER SEQUENCE public.translations_id_seq OWNED BY public.translations.id; -- -- Name: users; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.users ( id integer NOT NULL, email character varying DEFAULT ''::character varying, encrypted_password character varying DEFAULT ''::character varying NOT NULL, reset_password_token character varying, reset_password_sent_at timestamp without time zone, remember_created_at timestamp without time zone, sign_in_count integer DEFAULT 0 NOT NULL, current_sign_in_at timestamp without time zone, last_sign_in_at timestamp without time zone, current_sign_in_ip character varying, last_sign_in_ip character varying, created_at timestamp without time zone NOT NULL, updated_at timestamp without time zone NOT NULL, profile_id integer, quiz_modal_complete boolean DEFAULT false, invitation_token character varying, invitation_created_at timestamp without time zone, invitation_sent_at timestamp without time zone, invitation_accepted_at timestamp without time zone, invitation_limit integer, invited_by_type character varying, invited_by_id integer, invitations_count integer DEFAULT 0, token character varying, organization_id integer, school_id integer, program_location_id integer, acting_as character varying, library_card_number character varying, student_id character varying, date_of_birth timestamp without time zone, grade integer, quiz_responses_object text, program_id integer, encrypted_library_card_pin character varying, encrypted_library_card_pin_iv character varying, partner_id bigint, phone_number character varying ); -- -- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- CREATE SEQUENCE public.users_id_seq AS integer START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; -- -- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- ALTER SEQUENCE public.users_id_seq OWNED BY public.users.id; -- -- Name: users_roles; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.users_roles ( user_id integer, role_id integer ); -- -- Name: attachments id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.attachments ALTER COLUMN id SET DEFAULT nextval('public.attachments_id_seq'::regclass); -- -- Name: categories id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.categories ALTER COLUMN id SET DEFAULT nextval('public.categories_id_seq'::regclass); -- -- Name: ckeditor_assets id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.ckeditor_assets ALTER COLUMN id SET DEFAULT nextval('public.ckeditor_assets_id_seq'::regclass); -- -- Name: cms_pages id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.cms_pages ALTER COLUMN id SET DEFAULT nextval('public.cms_pages_id_seq'::regclass); -- -- Name: contacts id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.contacts ALTER COLUMN id SET DEFAULT nextval('public.contacts_id_seq'::regclass); -- -- Name: course_progresses id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.course_progresses ALTER COLUMN id SET DEFAULT nextval('public.course_progresses_id_seq'::regclass); -- -- Name: course_topics id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.course_topics ALTER COLUMN id SET DEFAULT nextval('public.course_topics_id_seq'::regclass); -- -- Name: courses id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.courses ALTER COLUMN id SET DEFAULT nextval('public.courses_id_seq'::regclass); -- -- Name: footer_links id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.footer_links ALTER COLUMN id SET DEFAULT nextval('public.footer_links_id_seq'::regclass); -- -- Name: friendly_id_slugs id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.friendly_id_slugs ALTER COLUMN id SET DEFAULT nextval('public.friendly_id_slugs_id_seq'::regclass); -- -- Name: languages id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.languages ALTER COLUMN id SET DEFAULT nextval('public.languages_id_seq'::regclass); -- -- Name: lesson_completions id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.lesson_completions ALTER COLUMN id SET DEFAULT nextval('public.lesson_completions_id_seq'::regclass); -- -- Name: lessons id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.lessons ALTER COLUMN id SET DEFAULT nextval('public.lessons_id_seq'::regclass); -- -- Name: library_locations id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.library_locations ALTER COLUMN id SET DEFAULT nextval('public.library_locations_id_seq'::regclass); -- -- Name: organizations id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.organizations ALTER COLUMN id SET DEFAULT nextval('public.organizations_id_seq'::regclass); -- -- Name: partners id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.partners ALTER COLUMN id SET DEFAULT nextval('public.partners_id_seq'::regclass); -- -- Name: pg_search_documents id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.pg_search_documents ALTER COLUMN id SET DEFAULT nextval('public.pg_search_documents_id_seq'::regclass); -- -- Name: profiles id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.profiles ALTER COLUMN id SET DEFAULT nextval('public.profiles_id_seq'::regclass); -- -- Name: program_locations id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.program_locations ALTER COLUMN id SET DEFAULT nextval('public.program_locations_id_seq'::regclass); -- -- Name: programs id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.programs ALTER COLUMN id SET DEFAULT nextval('public.programs_id_seq'::regclass); -- -- Name: resource_links id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.resource_links ALTER COLUMN id SET DEFAULT nextval('public.resource_links_id_seq'::regclass); -- -- Name: roles id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.roles ALTER COLUMN id SET DEFAULT nextval('public.roles_id_seq'::regclass); -- -- Name: schools id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.schools ALTER COLUMN id SET DEFAULT nextval('public.schools_id_seq'::regclass); -- -- Name: topics id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.topics ALTER COLUMN id SET DEFAULT nextval('public.topics_id_seq'::regclass); -- -- Name: translations id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.translations ALTER COLUMN id SET DEFAULT nextval('public.translations_id_seq'::regclass); -- -- Name: users id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.users ALTER COLUMN id SET DEFAULT nextval('public.users_id_seq'::regclass); -- -- Name: ar_internal_metadata ar_internal_metadata_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.ar_internal_metadata ADD CONSTRAINT ar_internal_metadata_pkey PRIMARY KEY (key); -- -- Name: attachments attachments_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.attachments ADD CONSTRAINT attachments_pkey PRIMARY KEY (id); -- -- Name: categories categories_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.categories ADD CONSTRAINT categories_pkey PRIMARY KEY (id); -- -- Name: ckeditor_assets ckeditor_assets_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.ckeditor_assets ADD CONSTRAINT ckeditor_assets_pkey PRIMARY KEY (id); -- -- Name: cms_pages cms_pages_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.cms_pages ADD CONSTRAINT cms_pages_pkey PRIMARY KEY (id); -- -- Name: contacts contacts_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.contacts ADD CONSTRAINT contacts_pkey PRIMARY KEY (id); -- -- Name: course_progresses course_progresses_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.course_progresses ADD CONSTRAINT course_progresses_pkey PRIMARY KEY (id); -- -- Name: course_topics course_topics_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.course_topics ADD CONSTRAINT course_topics_pkey PRIMARY KEY (id); -- -- Name: courses courses_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.courses ADD CONSTRAINT courses_pkey PRIMARY KEY (id); -- -- Name: data_migrations data_migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.data_migrations ADD CONSTRAINT data_migrations_pkey PRIMARY KEY (version); -- -- Name: footer_links footer_links_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.footer_links ADD CONSTRAINT footer_links_pkey PRIMARY KEY (id); -- -- Name: friendly_id_slugs friendly_id_slugs_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.friendly_id_slugs ADD CONSTRAINT friendly_id_slugs_pkey PRIMARY KEY (id); -- -- Name: languages languages_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.languages ADD CONSTRAINT languages_pkey PRIMARY KEY (id); -- -- Name: lesson_completions lesson_completions_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.lesson_completions ADD CONSTRAINT lesson_completions_pkey PRIMARY KEY (id); -- -- Name: lessons lessons_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.lessons ADD CONSTRAINT lessons_pkey PRIMARY KEY (id); -- -- Name: library_locations library_locations_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.library_locations ADD CONSTRAINT library_locations_pkey PRIMARY KEY (id); -- -- Name: organizations organizations_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.organizations ADD CONSTRAINT organizations_pkey PRIMARY KEY (id); -- -- Name: partners partners_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.partners ADD CONSTRAINT partners_pkey PRIMARY KEY (id); -- -- Name: pg_search_documents pg_search_documents_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.pg_search_documents ADD CONSTRAINT pg_search_documents_pkey PRIMARY KEY (id); -- -- Name: profiles profiles_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.profiles ADD CONSTRAINT profiles_pkey PRIMARY KEY (id); -- -- Name: program_locations program_locations_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.program_locations ADD CONSTRAINT program_locations_pkey PRIMARY KEY (id); -- -- Name: programs programs_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.programs ADD CONSTRAINT programs_pkey PRIMARY KEY (id); -- -- Name: resource_links resource_links_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.resource_links ADD CONSTRAINT resource_links_pkey PRIMARY KEY (id); -- -- Name: roles roles_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.roles ADD CONSTRAINT roles_pkey PRIMARY KEY (id); -- -- Name: schema_migrations schema_migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.schema_migrations ADD CONSTRAINT schema_migrations_pkey PRIMARY KEY (version); -- -- Name: schools schools_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.schools ADD CONSTRAINT schools_pkey PRIMARY KEY (id); -- -- Name: topics topics_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.topics ADD CONSTRAINT topics_pkey PRIMARY KEY (id); -- -- Name: translations translations_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.translations ADD CONSTRAINT translations_pkey PRIMARY KEY (id); -- -- Name: users users_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.users ADD CONSTRAINT users_pkey PRIMARY KEY (id); -- -- Name: idx_ckeditor_assetable; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX idx_ckeditor_assetable ON public.ckeditor_assets USING btree (assetable_type, assetable_id); -- -- Name: idx_ckeditor_assetable_type; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX idx_ckeditor_assetable_type ON public.ckeditor_assets USING btree (assetable_type, type, assetable_id); -- -- Name: index_cms_pages_on_slug; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_cms_pages_on_slug ON public.cms_pages USING btree (slug); -- -- Name: index_cms_pages_on_title_and_organization_id; Type: INDEX; Schema: public; Owner: - -- CREATE UNIQUE INDEX index_cms_pages_on_title_and_organization_id ON public.cms_pages USING btree (title, organization_id); -- -- Name: index_courses_on_category_id; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_courses_on_category_id ON public.courses USING btree (category_id); -- -- Name: index_courses_on_organization_id; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_courses_on_organization_id ON public.courses USING btree (organization_id); -- -- Name: index_courses_on_slug; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_courses_on_slug ON public.courses USING btree (slug); -- -- Name: index_courses_on_title; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_courses_on_title ON public.courses USING btree (title); -- -- Name: index_footer_links_on_language_id; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_footer_links_on_language_id ON public.footer_links USING btree (language_id); -- -- Name: index_footer_links_on_organization_id; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_footer_links_on_organization_id ON public.footer_links USING btree (organization_id); -- -- Name: index_friendly_id_slugs_on_slug_and_sluggable_type; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_friendly_id_slugs_on_slug_and_sluggable_type ON public.friendly_id_slugs USING btree (slug, sluggable_type); -- -- Name: index_friendly_id_slugs_on_slug_and_sluggable_type_and_scope; Type: INDEX; Schema: public; Owner: - -- CREATE UNIQUE INDEX index_friendly_id_slugs_on_slug_and_sluggable_type_and_scope ON public.friendly_id_slugs USING btree (slug, sluggable_type, scope); -- -- Name: index_friendly_id_slugs_on_sluggable_id; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_friendly_id_slugs_on_sluggable_id ON public.friendly_id_slugs USING btree (sluggable_id); -- -- Name: index_friendly_id_slugs_on_sluggable_type; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_friendly_id_slugs_on_sluggable_type ON public.friendly_id_slugs USING btree (sluggable_type); -- -- Name: index_lesson_completions_on_lesson_id; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_lesson_completions_on_lesson_id ON public.lesson_completions USING btree (lesson_id); -- -- Name: index_lessons_on_parent_id; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_lessons_on_parent_id ON public.lessons USING btree (parent_id); -- -- Name: index_lessons_on_slug; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_lessons_on_slug ON public.lessons USING btree (slug); -- -- Name: index_library_locations_on_organization_id; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_library_locations_on_organization_id ON public.library_locations USING btree (organization_id); -- -- Name: index_organizations_on_preferences; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_organizations_on_preferences ON public.organizations USING gin (preferences); -- -- Name: index_partners_on_organization_id; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_partners_on_organization_id ON public.partners USING btree (organization_id); -- -- Name: index_pg_search_documents_on_searchable_type_and_searchable_id; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_pg_search_documents_on_searchable_type_and_searchable_id ON public.pg_search_documents USING btree (searchable_type, searchable_id); -- -- Name: index_program_locations_on_program_id; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_program_locations_on_program_id ON public.program_locations USING btree (program_id); -- -- Name: index_programs_on_organization_id; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_programs_on_organization_id ON public.programs USING btree (organization_id); -- -- Name: index_resource_links_on_course_id; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_resource_links_on_course_id ON public.resource_links USING btree (course_id); -- -- Name: index_roles_on_name; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_roles_on_name ON public.roles USING btree (name); -- -- Name: index_roles_on_name_and_resource_type_and_resource_id; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_roles_on_name_and_resource_type_and_resource_id ON public.roles USING btree (name, resource_type, resource_id); -- -- Name: index_schools_on_organization_id; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_schools_on_organization_id ON public.schools USING btree (organization_id); -- -- Name: index_schools_on_school_type; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_schools_on_school_type ON public.schools USING btree (school_type); -- -- Name: index_users_on_email; Type: INDEX; Schema: public; Owner: - -- CREATE UNIQUE INDEX index_users_on_email ON public.users USING btree (email); -- -- Name: index_users_on_invitation_token; Type: INDEX; Schema: public; Owner: - -- CREATE UNIQUE INDEX index_users_on_invitation_token ON public.users USING btree (invitation_token); -- -- Name: index_users_on_invitations_count; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_users_on_invitations_count ON public.users USING btree (invitations_count); -- -- Name: index_users_on_invited_by_id; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_users_on_invited_by_id ON public.users USING btree (invited_by_id); -- -- Name: index_users_on_organization_id; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_users_on_organization_id ON public.users USING btree (organization_id); -- -- Name: index_users_on_partner_id; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_users_on_partner_id ON public.users USING btree (partner_id); -- -- Name: index_users_on_program_location_id; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_users_on_program_location_id ON public.users USING btree (program_location_id); -- -- Name: index_users_on_reset_password_token; Type: INDEX; Schema: public; Owner: - -- CREATE UNIQUE INDEX index_users_on_reset_password_token ON public.users USING btree (reset_password_token); -- -- Name: index_users_roles_on_user_id_and_role_id; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_users_roles_on_user_id_and_role_id ON public.users_roles USING btree (user_id, role_id); -- -- Name: programs fk_rails_0586629141; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.programs ADD CONSTRAINT fk_rails_0586629141 FOREIGN KEY (organization_id) REFERENCES public.organizations(id); -- -- Name: schools fk_rails_099ab22c67; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.schools ADD CONSTRAINT fk_rails_099ab22c67 FOREIGN KEY (organization_id) REFERENCES public.organizations(id); -- -- Name: users fk_rails_4dce22cfb5; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.users ADD CONSTRAINT fk_rails_4dce22cfb5 FOREIGN KEY (program_location_id) REFERENCES public.program_locations(id); -- -- Name: program_locations fk_rails_684ed17f10; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.program_locations ADD CONSTRAINT fk_rails_684ed17f10 FOREIGN KEY (program_id) REFERENCES public.programs(id); -- -- Name: users fk_rails_b517ecf66a; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.users ADD CONSTRAINT fk_rails_b517ecf66a FOREIGN KEY (partner_id) REFERENCES public.partners(id); -- -- Name: footer_links fk_rails_bd7708fd9c; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.footer_links ADD CONSTRAINT fk_rails_bd7708fd9c FOREIGN KEY (language_id) REFERENCES public.languages(id); -- -- Name: lesson_completions fk_rails_d03dba97f9; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.lesson_completions ADD CONSTRAINT fk_rails_d03dba97f9 FOREIGN KEY (lesson_id) REFERENCES public.lessons(id); -- -- Name: users fk_rails_d7b9ff90af; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.users ADD CONSTRAINT fk_rails_d7b9ff90af FOREIGN KEY (organization_id) REFERENCES public.organizations(id); -- -- Name: library_locations fk_rails_fe22bb8133; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.library_locations ADD CONSTRAINT fk_rails_fe22bb8133 FOREIGN KEY (organization_id) REFERENCES public.organizations(id); -- -- PostgreSQL database dump complete -- SET search_path TO "$user", public; INSERT INTO "schema_migrations" (version) VALUES ('20151006221749'), ('20151006223043'), ('20151006223358'), ('20151007231646'), ('20151008191410'), ('20151008191502'), ('20151008194245'), ('20151008200711'), ('20151012205414'), ('20151012212235'), ('20151012212330'), ('20151013152406'), ('20151013153234'), ('20151013190948'), ('20151013213922'), ('20151014161239'), ('20151014162217'), ('20151014201805'), ('20151014214757'), ('20151015192124'), ('20151015192553'), ('20151020051806'), ('20151020222324'), ('20151022192231'), ('20151027171059'), ('20151027193006'), ('20151027213418'), ('20151028151936'), ('20151028205201'), ('20151101001943'), ('20151101002423'), ('20151103175556'), ('20151103175815'), ('20151103175901'), ('20151103215214'), ('20151104003304'), ('20151105154753'), ('20151109220449'), ('20151110194610'), ('20151111165405'), ('20151111210450'), ('20151111211038'), ('20151111214208'), ('20151118174539'), ('20151118192418'), ('20151119191647'), ('20151119191906'), ('20151119192048'), ('20151119202029'), ('20151124211721'), ('20151201005018'), ('20151203004228'), ('20160112013224'), ('20160113033555'), ('20160114060850'), ('20160114061700'), ('20160114085838'), ('20160118182316'), ('20160209173722'), ('20160218191705'), ('20160307180329'), ('20160309170154'), ('20160310210749'), ('20160310210918'), ('20160310212508'), ('20160315204732'), ('20160412193744'), ('20160421153406'), ('20160726200925'), ('20161004043125'), ('20161013231902'), ('20161014040703'), ('20161018030748'), ('20161107203204'), ('20161107205206'), ('20161110193750'), ('20161110224949'), ('20161110224954'), ('20161111163954'), ('20161111165026'), ('20161116175916'), ('20170104190831'), ('20170104212615'), ('20170104220648'), ('20170105201500'), ('20170314175120'), ('20170331200655'), ('20170920031218'), ('20171219194830'), ('20171220180542'), ('20180510205122'), ('20181115233025'), ('20181119174344'), ('20181119193248'), ('20181119194721'), ('20181120180332'), ('20181120182048'), ('20181211172626'), ('20190506035357'), ('20190508155003'), ('20190509143205'), ('20190509152342'), ('20190509152902'), ('20190530133959'), ('20190617025929'), ('20190617034333'), ('20191023160710'), ('20191107234014'), ('20191119184844'), ('20191119185434'), ('20191119190714'), ('20191211193827'), ('20200120023743'), ('20200220181809'), ('20200220184942'), ('20200327172506'), ('20200327214039'), ('20200618155234'), ('20200707133604'), ('20210726182520'), ('20210812220205'), ('20210823165603'), ('20220215191047'), ('20220215194253'), ('20220319171829'), ('20220803035909'), ('20220819184026'), ('20221017042846'), ('20221205023629'), ('20230116033009');
true
e7ff9a760b8f53bc211169083c58c3fb0100015d
SQL
Leocardoso94/cursophp7-udemy
/backup.sql
UTF-8
2,013
3.515625
4
[]
no_license
/* SQLyog Ultimate v12.09 (32 bit) MySQL - 5.5.16 : Database - php7 ********************************************************************* */ /*!40101 SET NAMES utf8 */; /*!40101 SET SQL_MODE=''*/; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; CREATE DATABASE /*!32312 IF NOT EXISTS*/`php7` /*!40100 DEFAULT CHARACTER SET utf8 */; USE `php7`; /*Table structure for table `tb_usuarios` */ DROP TABLE IF EXISTS `tb_usuarios`; CREATE TABLE `tb_usuarios` ( `idusuario` int(11) NOT NULL AUTO_INCREMENT, `deslogin` varchar(64) NOT NULL, `dessenha` varchar(256) NOT NULL, `dtcadastro` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`idusuario`) ) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8; /*Data for the table `tb_usuarios` */ insert into `tb_usuarios`(`idusuario`,`deslogin`,`dessenha`,`dtcadastro`) values (3,'root','!@#$%','2017-05-08 14:17:52'),(4,'jose','123','2017-05-08 14:36:47'),(5,'aluno','@luno','2017-05-10 10:48:17'),(7,'professor','123456','2017-05-10 10:59:25'); /* Procedure structure for procedure `sp_usuarios_insert` */ /*!50003 DROP PROCEDURE IF EXISTS `sp_usuarios_insert` */; DELIMITER $$ /*!50003 CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_usuarios_insert`( pdeslogin VARCHAR (64), pdessenha varchar (255) ) BEGIN insert into `tb_usuarios` (`deslogin`, `dessenha`) values (pdeslogin, pdessenha) ; SELECT * FROM tb_usuarios WHERE `idusuario` = last_insert_id() ; END */$$ DELIMITER ; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
true
ee6c2cc5d5be3fb6733f370abfa6f9a3fbc6d1f9
SQL
Squibs/freeCodeCamp
/Relational Database/Learn Relational Databases by Building a Mario Database/mario.sql
UTF-8
12,106
3.15625
3
[]
no_license
SELECT pg_terminate_backend(pg_stat_activity.pid) FROM pg_stat_activity WHERE usename = 'freecodecamp'; -- -- PostgreSQL database dump -- -- Dumped from database version 12.3 (Debian 12.3-1.pgdg90+1) -- Dumped by pg_dump version 12.3 (Debian 12.3-1.pgdg90+1) SET statement_timeout = 0; SET lock_timeout = 0; SET idle_in_transaction_session_timeout = 0; SET client_encoding = 'UTF8'; SET standard_conforming_strings = on; SELECT pg_catalog.set_config('search_path', '', false); SET check_function_bodies = false; SET xmloption = content; SET client_min_messages = warning; SET row_security = off; DROP DATABASE IF EXISTS mario_database; -- -- Name: mario_database; Type: DATABASE; Schema: -; Owner: freecodecamp -- CREATE DATABASE mario_database WITH TEMPLATE = template0 ENCODING = 'UTF8' LC_COLLATE = 'C.UTF-8' LC_CTYPE = 'C.UTF-8'; ALTER DATABASE mario_database OWNER TO freecodecamp; \connect mario_database SET statement_timeout = 0; SET lock_timeout = 0; SET idle_in_transaction_session_timeout = 0; SET client_encoding = 'UTF8'; SET standard_conforming_strings = on; SELECT pg_catalog.set_config('search_path', '', false); SET check_function_bodies = false; SET xmloption = content; SET client_min_messages = warning; SET row_security = off; SET default_tablespace = ''; SET default_table_access_method = heap; -- -- Name: actions; Type: TABLE; Schema: public; Owner: freecodecamp -- CREATE TABLE public.actions ( action_id integer NOT NULL, action character varying(20) NOT NULL ); ALTER TABLE public.actions OWNER TO freecodecamp; -- -- Name: actions_action_id_seq; Type: SEQUENCE; Schema: public; Owner: freecodecamp -- CREATE SEQUENCE public.actions_action_id_seq AS integer START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; ALTER TABLE public.actions_action_id_seq OWNER TO freecodecamp; -- -- Name: actions_action_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: freecodecamp -- ALTER SEQUENCE public.actions_action_id_seq OWNED BY public.actions.action_id; -- -- Name: character_actions; Type: TABLE; Schema: public; Owner: freecodecamp -- CREATE TABLE public.character_actions ( character_id integer NOT NULL, action_id integer NOT NULL ); ALTER TABLE public.character_actions OWNER TO freecodecamp; -- -- Name: characters; Type: TABLE; Schema: public; Owner: freecodecamp -- CREATE TABLE public.characters ( character_id integer NOT NULL, name character varying(30) NOT NULL, homeland character varying(60), favorite_color character varying(30) ); ALTER TABLE public.characters OWNER TO freecodecamp; -- -- Name: characters_character_id_seq; Type: SEQUENCE; Schema: public; Owner: freecodecamp -- CREATE SEQUENCE public.characters_character_id_seq AS integer START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; ALTER TABLE public.characters_character_id_seq OWNER TO freecodecamp; -- -- Name: characters_character_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: freecodecamp -- ALTER SEQUENCE public.characters_character_id_seq OWNED BY public.characters.character_id; -- -- Name: more_info; Type: TABLE; Schema: public; Owner: freecodecamp -- CREATE TABLE public.more_info ( more_info_id integer NOT NULL, birthday date, height_in_cm integer, weight_in_kg numeric(4,1), character_id integer NOT NULL ); ALTER TABLE public.more_info OWNER TO freecodecamp; -- -- Name: more_info_more_info_id_seq; Type: SEQUENCE; Schema: public; Owner: freecodecamp -- CREATE SEQUENCE public.more_info_more_info_id_seq AS integer START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; ALTER TABLE public.more_info_more_info_id_seq OWNER TO freecodecamp; -- -- Name: more_info_more_info_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: freecodecamp -- ALTER SEQUENCE public.more_info_more_info_id_seq OWNED BY public.more_info.more_info_id; -- -- Name: sounds; Type: TABLE; Schema: public; Owner: freecodecamp -- CREATE TABLE public.sounds ( sound_id integer NOT NULL, filename character varying(40) NOT NULL, character_id integer NOT NULL ); ALTER TABLE public.sounds OWNER TO freecodecamp; -- -- Name: sounds_sound_id_seq; Type: SEQUENCE; Schema: public; Owner: freecodecamp -- CREATE SEQUENCE public.sounds_sound_id_seq AS integer START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; ALTER TABLE public.sounds_sound_id_seq OWNER TO freecodecamp; -- -- Name: sounds_sound_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: freecodecamp -- ALTER SEQUENCE public.sounds_sound_id_seq OWNED BY public.sounds.sound_id; -- -- Name: actions action_id; Type: DEFAULT; Schema: public; Owner: freecodecamp -- ALTER TABLE ONLY public.actions ALTER COLUMN action_id SET DEFAULT nextval('public.actions_action_id_seq'::regclass); -- -- Name: characters character_id; Type: DEFAULT; Schema: public; Owner: freecodecamp -- ALTER TABLE ONLY public.characters ALTER COLUMN character_id SET DEFAULT nextval('public.characters_character_id_seq'::regclass); -- -- Name: more_info more_info_id; Type: DEFAULT; Schema: public; Owner: freecodecamp -- ALTER TABLE ONLY public.more_info ALTER COLUMN more_info_id SET DEFAULT nextval('public.more_info_more_info_id_seq'::regclass); -- -- Name: sounds sound_id; Type: DEFAULT; Schema: public; Owner: freecodecamp -- ALTER TABLE ONLY public.sounds ALTER COLUMN sound_id SET DEFAULT nextval('public.sounds_sound_id_seq'::regclass); -- -- Data for Name: actions; Type: TABLE DATA; Schema: public; Owner: freecodecamp -- INSERT INTO public.actions VALUES (1, 'run'); INSERT INTO public.actions VALUES (2, 'jump'); INSERT INTO public.actions VALUES (3, 'duck'); -- -- Data for Name: character_actions; Type: TABLE DATA; Schema: public; Owner: freecodecamp -- INSERT INTO public.character_actions VALUES (7, 1); INSERT INTO public.character_actions VALUES (7, 2); INSERT INTO public.character_actions VALUES (7, 3); INSERT INTO public.character_actions VALUES (6, 1); INSERT INTO public.character_actions VALUES (6, 2); INSERT INTO public.character_actions VALUES (6, 3); INSERT INTO public.character_actions VALUES (5, 1); INSERT INTO public.character_actions VALUES (5, 2); INSERT INTO public.character_actions VALUES (5, 3); INSERT INTO public.character_actions VALUES (4, 1); INSERT INTO public.character_actions VALUES (4, 2); INSERT INTO public.character_actions VALUES (4, 3); INSERT INTO public.character_actions VALUES (3, 1); INSERT INTO public.character_actions VALUES (3, 2); INSERT INTO public.character_actions VALUES (3, 3); INSERT INTO public.character_actions VALUES (2, 1); INSERT INTO public.character_actions VALUES (2, 2); INSERT INTO public.character_actions VALUES (2, 3); INSERT INTO public.character_actions VALUES (1, 1); INSERT INTO public.character_actions VALUES (1, 2); INSERT INTO public.character_actions VALUES (1, 3); -- -- Data for Name: characters; Type: TABLE DATA; Schema: public; Owner: freecodecamp -- INSERT INTO public.characters VALUES (2, 'Luigi', 'Mushroom Kingdom', 'Green'); INSERT INTO public.characters VALUES (3, 'Peach', 'Mushroom Kingdom', 'Pink'); INSERT INTO public.characters VALUES (7, 'Yoshi', 'Dinosaur Land', 'Green'); INSERT INTO public.characters VALUES (6, 'Daisy', 'Sarasaland', 'Orange'); INSERT INTO public.characters VALUES (1, 'Mario', 'Mushroom Kingdom', 'Red'); INSERT INTO public.characters VALUES (4, 'Toad', 'Mushroom Kingdom', 'Blue'); INSERT INTO public.characters VALUES (5, 'Bowser', 'Koopa Kingdom', 'Yellow'); -- -- Data for Name: more_info; Type: TABLE DATA; Schema: public; Owner: freecodecamp -- INSERT INTO public.more_info VALUES (1, '1981-07-09', 155, 64.5, 1); INSERT INTO public.more_info VALUES (2, '1983-07-14', 175, 48.8, 2); INSERT INTO public.more_info VALUES (3, '1985-10-18', 173, 52.2, 3); INSERT INTO public.more_info VALUES (4, '1950-01-10', 66, 35.6, 4); INSERT INTO public.more_info VALUES (5, '1990-10-29', 258, 300.0, 5); INSERT INTO public.more_info VALUES (6, '1989-07-31', NULL, NULL, 6); INSERT INTO public.more_info VALUES (7, '1990-04-13', 162, 59.1, 7); -- -- Data for Name: sounds; Type: TABLE DATA; Schema: public; Owner: freecodecamp -- INSERT INTO public.sounds VALUES (1, 'its-a-me.wav', 1); INSERT INTO public.sounds VALUES (2, 'yippee.wav', 1); INSERT INTO public.sounds VALUES (3, 'ha-ha.wav', 2); INSERT INTO public.sounds VALUES (4, 'oh-yeah.wav', 2); INSERT INTO public.sounds VALUES (5, 'yay.wav', 3); INSERT INTO public.sounds VALUES (6, 'woo-hoo.wav', 3); INSERT INTO public.sounds VALUES (7, 'mm-hmm.wav', 3); INSERT INTO public.sounds VALUES (8, 'yahoo.wav', 1); -- -- Name: actions_action_id_seq; Type: SEQUENCE SET; Schema: public; Owner: freecodecamp -- SELECT pg_catalog.setval('public.actions_action_id_seq', 3, true); -- -- Name: characters_character_id_seq; Type: SEQUENCE SET; Schema: public; Owner: freecodecamp -- SELECT pg_catalog.setval('public.characters_character_id_seq', 7, true); -- -- Name: more_info_more_info_id_seq; Type: SEQUENCE SET; Schema: public; Owner: freecodecamp -- SELECT pg_catalog.setval('public.more_info_more_info_id_seq', 7, true); -- -- Name: sounds_sound_id_seq; Type: SEQUENCE SET; Schema: public; Owner: freecodecamp -- SELECT pg_catalog.setval('public.sounds_sound_id_seq', 8, true); -- -- Name: actions actions_action_key; Type: CONSTRAINT; Schema: public; Owner: freecodecamp -- ALTER TABLE ONLY public.actions ADD CONSTRAINT actions_action_key UNIQUE (action); -- -- Name: actions actions_pkey; Type: CONSTRAINT; Schema: public; Owner: freecodecamp -- ALTER TABLE ONLY public.actions ADD CONSTRAINT actions_pkey PRIMARY KEY (action_id); -- -- Name: character_actions character_actions_pkey; Type: CONSTRAINT; Schema: public; Owner: freecodecamp -- ALTER TABLE ONLY public.character_actions ADD CONSTRAINT character_actions_pkey PRIMARY KEY (character_id, action_id); -- -- Name: characters characters_pkey; Type: CONSTRAINT; Schema: public; Owner: freecodecamp -- ALTER TABLE ONLY public.characters ADD CONSTRAINT characters_pkey PRIMARY KEY (character_id); -- -- Name: more_info more_info_character_id_key; Type: CONSTRAINT; Schema: public; Owner: freecodecamp -- ALTER TABLE ONLY public.more_info ADD CONSTRAINT more_info_character_id_key UNIQUE (character_id); -- -- Name: more_info more_info_pkey; Type: CONSTRAINT; Schema: public; Owner: freecodecamp -- ALTER TABLE ONLY public.more_info ADD CONSTRAINT more_info_pkey PRIMARY KEY (more_info_id); -- -- Name: sounds sounds_filename_key; Type: CONSTRAINT; Schema: public; Owner: freecodecamp -- ALTER TABLE ONLY public.sounds ADD CONSTRAINT sounds_filename_key UNIQUE (filename); -- -- Name: sounds sounds_pkey; Type: CONSTRAINT; Schema: public; Owner: freecodecamp -- ALTER TABLE ONLY public.sounds ADD CONSTRAINT sounds_pkey PRIMARY KEY (sound_id); -- -- Name: character_actions character_actions_action_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: freecodecamp -- ALTER TABLE ONLY public.character_actions ADD CONSTRAINT character_actions_action_id_fkey FOREIGN KEY (action_id) REFERENCES public.actions(action_id); -- -- Name: character_actions character_actions_character_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: freecodecamp -- ALTER TABLE ONLY public.character_actions ADD CONSTRAINT character_actions_character_id_fkey FOREIGN KEY (character_id) REFERENCES public.characters(character_id); -- -- Name: more_info more_info_character_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: freecodecamp -- ALTER TABLE ONLY public.more_info ADD CONSTRAINT more_info_character_id_fkey FOREIGN KEY (character_id) REFERENCES public.characters(character_id); -- -- Name: sounds sounds_character_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: freecodecamp -- ALTER TABLE ONLY public.sounds ADD CONSTRAINT sounds_character_id_fkey FOREIGN KEY (character_id) REFERENCES public.characters(character_id); -- -- PostgreSQL database dump complete --
true
4a0a28fe704739d06f2dbcc6bf023aa17d2f101c
SQL
Andtit4/monstage
/monstage.sql
UTF-8
4,059
3.21875
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 5.0.3 -- https://www.phpmyadmin.net/ -- -- Hôte : 127.0.0.1 -- Généré le : ven. 04 juin 2021 à 21:16 -- Version du serveur : 10.4.14-MariaDB -- Version de PHP : 7.2.34 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; START TRANSACTION; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8mb4 */; -- -- Base de données : `monstage` -- -- -------------------------------------------------------- -- -- Structure de la table `administrateur` -- CREATE TABLE `administrateur` ( `id_admin` int(3) NOT NULL, `nom_admin` varchar(8) NOT NULL, `mdp_admin` varchar(8) NOT NULL, `mail_admin` varchar(35) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Déchargement des données de la table `administrateur` -- INSERT INTO `administrateur` (`id_admin`, `nom_admin`, `mdp_admin`, `mail_admin`) VALUES (1, 'admin', 'admin', 'andtit4@gmail.com'), (24, 'root', 'root', 'lirsitogo2021@gmail.com'); -- -------------------------------------------------------- -- -- Structure de la table `inscription` -- CREATE TABLE `inscription` ( `id` int(7) NOT NULL, `nom` varchar(10) NOT NULL, `premon` varchar(35) NOT NULL, `mail` varchar(36) NOT NULL, `mdp` varchar(8) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Déchargement des données de la table `inscription` -- INSERT INTO `inscription` (`id`, `nom`, `premon`, `mail`, `mdp`) VALUES (1, 'tito', 'and', 'tut@gmail.com', 'mdp'), (2, 'sudo', 'su', 'andtit@gmail.com', 'mdp'), (3, 'andele', 'tito', 'lirsitogo2021@gmail.com', 'mdp'); -- -------------------------------------------------------- -- -- Structure de la table `publications` -- CREATE TABLE `publications` ( `id_pub` int(8) NOT NULL, `titre_pub` varchar(35) NOT NULL, `contenu_pub` text NOT NULL, `date_pub` datetime DEFAULT NULL, `id_admn` int(8) NOT NULL, `mail` varchar(20) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Déchargement des données de la table `publications` -- INSERT INTO `publications` (`id_pub`, `titre_pub`, `contenu_pub`, `date_pub`, `id_admn`, `mail`) VALUES (1, 'titre', 'contenu', '2021-05-08 10:45:29', 1, NULL), (2, 'stage', 'contenu', '2021-05-08 10:47:19', 1, NULL), (3, 'stage', 'contenu', '2021-05-08 10:50:45', 1, 'andtit4@gmail.com'), (4, 'telecom', 'contenu', '2021-05-08 10:58:11', 1, 'andtit4@gmail.com'), (5, 'telecom2', 'contenu', '2021-05-08 10:59:35', 1, 'andtit4@gmail.com'), (6, 'telecom3', 'contenu', '2021-05-08 11:00:09', 1, 'andtit4@gmail.com'), (7, 'telecom3', 'contenu', '2021-05-08 11:05:39', 1, 'andtit4@gmail.com'), (19, 'exo', 'conte', '2021-06-03 11:44:16', 24, 'lirsitogo2021@gmail.'); -- -- Index pour les tables déchargées -- -- -- Index pour la table `administrateur` -- ALTER TABLE `administrateur` ADD PRIMARY KEY (`id_admin`); -- -- Index pour la table `inscription` -- ALTER TABLE `inscription` ADD PRIMARY KEY (`id`); -- -- Index pour la table `publications` -- ALTER TABLE `publications` ADD PRIMARY KEY (`id_pub`), ADD KEY `id_admn` (`id_admn`); -- -- AUTO_INCREMENT pour les tables déchargées -- -- -- AUTO_INCREMENT pour la table `administrateur` -- ALTER TABLE `administrateur` MODIFY `id_admin` int(3) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=25; -- -- AUTO_INCREMENT pour la table `inscription` -- ALTER TABLE `inscription` MODIFY `id` int(7) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; -- -- AUTO_INCREMENT pour la table `publications` -- ALTER TABLE `publications` MODIFY `id_pub` int(8) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=20; -- -- Contraintes pour les tables déchargées -- -- -- Contraintes pour la table `publications` -- ALTER TABLE `publications` ADD CONSTRAINT `publications_ibfk_1` FOREIGN KEY (`id_admn`) REFERENCES `administrateur` (`id_admin`); 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
8ec8d7431e70012a5265ef943afdbc59ec6b8a29
SQL
JoshuaMines/SQL
/order.sql
UTF-8
646
3.921875
4
[]
no_license
CREATE TABLE orders ( order_id SERIAL PRIMARY KEY, person_id SERIAL, prodcuct_name VARCHAR(23), product_price DECIMAL (10,2), quantity INTEGER ); INSERT INTO orders (prodcuct_name, product_price, quantity) VALUES ('BALL', 6.00, 5), ('CHAIR', 25.33, 4), ('CALENDAR', 20.29, 12), ('POSTER', 12.22, 13), ('CUP', 12.33, 14) SELECT * FROM orders -- Calculate the total number of products ordered. SELECT SUM(quantity) FROM orders; -- Calculate the total order price. SELECT SUM(quantity*product_price) FROM orders; -- Calculate the total order price by a single person_id. SELECT SUM(quantity*product_price) FROM orders WHERE order_id=2;
true
c064e8f2833bc74ce2ffca14591d21e42ad4195e
SQL
wonhyukc/mySQL
/206-04 연습01.sql
UTF-8
3,048
4.4375
4
[]
no_license
use hr; select * from employees ; -- 1 모든 직원의 평균 연봉 -- 2. 2000년 이후 입사자 평균 연봉 -- 3. 부서별 평균연봉 -- 4. 부서별 평균 연봉 이 전체 평균연봉 보다 낮은 부서 -- 5. 2000년 이후 입사자 만 대상으로 -- 부서별 평균 연봉 이 전체 평균연봉 보다 낮은 부서 -- 2000년 이후 입사자만 출력 select * from employees where hire_date >= '2000-01-01' ; -- manager_id가 null이면 0으로 입력 null 이 아니면 manager_id값으로 입력 select *, if( isnull(manager_id), 0, manager_id) as '매니저' from employees where commission_pct is null ; -- salary나 commission 중 NULL이 아닌 값을 “급여액” 이라는 제목으로 출력하 select if( isnull(salary) , commission_pct , salary ) as 급여액, salary, commission_pct from employees; -- locations -- 어떤 나라들이 있을까? select distinct country_id from locations ; -- 나라 + 주 + 도시 를 합친 새 컬럼 “지역” 을 출력하자 -- select concat( 'a', 'b') -- select concat( 'a', null) select concat( 'a', if( isnull(null), '', null)) ; select country_id, if( isnull(state_province), '',state_province ), city from locations ; select concat( country_id,', ', if( isnull(state_province), '',state_province ), ', ' ,city ) from locations ; -- jobs -- 최저임금 5000 이상 그리고, 최대임금 9000 이하 인 job 만 보고 싶다 select * from jobs where min_salary >=5000 and max_salary <=9000 ; -- job title이 manager 를 포함한 것들을 보고 싶다 select * from jobs where job_title like '%manager%' -- where job_title like '%manager' ; -- job title이 stock으로 시작하는 것들을 보고 싶다 select * from jobs where job_title like 'stock%' ; -- job title이 stock으로 시작하는 것들의 최저임금을 NULL로 바꾸어 출력하고 싶다 select *, nullif( nullif( min_salary, 2000) , 5500) as '최저임금' from jobs where job_title like 'stock%' ; select *, NULL as '최저임금' from jobs where job_title like 'stock%' use hr; select * from employees ; -- 1 모든 직원의 평균 연봉 select avg(salary) from employees ; -- 5839.40 -- 2. 2000년 이후 입사자 평균 연봉 select avg(salary) as 평균연봉 from employees where hire_date >= "2000-01-01" ; -- 3. 부서별 평균연봉 select department_id, avg(salary) as 평균연봉 from employees group by department_id ; -- 4. 부서별 평균 연봉 이 전체 평균연봉 보다 낮은 부서 select department_id, avg(salary) as 평균연봉 from employees group by department_id having avg(salary) < (select avg(salary) from employees) ; -- 5. 2000년 이후 입사자 만 대상으로 -- 부서별 평균 연봉 이 전체 평균연봉 보다 낮은 부서 select department_id, sum(salary)/count(salary) as 평균연봉 from employees where hire_date >= "2000-01-01" group by department_id having sum(salary)/count(salary) < (select sum(salary)/count(salary) from employees) ;
true
26734786709ca97bad84e13db5c72782d743c23a
SQL
jast92/ironhack-lab-solution
/W2D2/lab-sql-4.sql
UTF-8
1,028
4.125
4
[]
no_license
use sakila; #1. Get film ratings. select distinct rating from film; #2. Get release years. select distinct release_year from film; #3. Get all films with ARMAGEDDON in the title. select title from film where title LIKE '%ARMAGEDDON%'; #4. Get all films with APOLLO in the title select title from film where title LIKE '%APOLLO%'; #5. Get all films which title ends with APOLLO. select title from film where title LIKE '%APOLLO'; #6. Get all films with word DATE in the title. select title from film where title LIKE '% DATE%' or title like '%DATE %'; #7. Get 10 films with the longest title. select title from film order by length(title) desc limit 10; #8. Get 10 the longest films. select title, length from film order by length desc limit 10; #9. How many films include Behind the Scenes content? select count(film_id) from film where special_features like '%Behind the Scenes%'; #10. List films ordered by release year and title in alphabetical order. select * from film order by release_year, title ASC;
true
b458e3957ef1b3fed4b842f787ab29ea31ad58a5
SQL
Bobbypip/master-php
/aprendiendo-sql/04-DML/update.sql
UTF-8
212
2.671875
3
[]
no_license
# MODIFICAR FILAS / ACTUALIZAR DATOS # # SE ACTULIZA TODA LA COLUMNA DE fecha A LA VEZ # UPDATE usuarios SET fecha=CURDATE(); # SE ACTUALIZA SOLO EL id 4 # UPDATE usuarios SET fecha='2019-07-09' WHERE id = 4;
true
5fdcad6d9e6738378bb5dc5454acc3ee3d6b6329
SQL
lelgenio/fsg-db-trabalho1
/ex2.sql
UTF-8
598
3.46875
3
[]
no_license
-- Selecionar todas os EMPREGADOS que respondem para o GERENTE FINANCEIRO. Listar primeiro e último nome, e nome do gerente, e cargo de ambos. SELECT EMPREGADO.PRIMEIRO_NOME, EMPREGADO.ULTIMO_NOME, DEPARTAMENTOS.DEPARTAMENTO_NOME, GERENTE.PRIMEIRO_NOME AS 'GERENTE' FROM EMPREGADOS AS EMPREGADO, DEPARTAMENTOS, EMPREGADOS AS GERENTE WHERE EMPREGADO.DEPARTAMENTO_ID = DEPARTAMENTOS.DEPARTAMENTO_ID AND DEPARTAMENTOS.DEPARTAMENTO_NOME LIKE '%Financeiro%' AND GERENTE.DEPARTAMENTO_ID = DEPARTAMENTOS.DEPARTAMENTO_ID AND EMPREGADO.GERENTE_ID = GERENTE.EMPREGADO_ID ;
true
8300f0efcadc7c5fe6f9fdd34d462079f36a69b9
SQL
RTI-Soluctions/kemal-rest
/kemal-rest.sql
UTF-8
2,309
3.28125
3
[ "MIT" ]
permissive
-- phpMyAdmin SQL Dump -- version 4.7.8 -- https://www.phpmyadmin.net/ -- -- Host: localhost -- Generation Time: Apr 17, 2018 at 05:00 AM -- Server version: 5.7.21 -- PHP Version: 7.1.14 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: `kemal-rest` -- -- -------------------------------------------------------- -- -- Table structure for table `author` -- CREATE TABLE `author` ( `id` bigint(11) NOT NULL, `name` varchar(255) NOT NULL, `nationality` varchar(255) NOT NULL, `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Table structure for table `book` -- CREATE TABLE `book` ( `id` bigint(11) NOT NULL, `author_id` bigint(11) NOT NULL, `title` varchar(255) NOT NULL, `year` year(4) NOT NULL, `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Indexes for dumped tables -- -- -- Indexes for table `author` -- ALTER TABLE `author` ADD PRIMARY KEY (`id`); -- -- Indexes for table `book` -- ALTER TABLE `book` ADD PRIMARY KEY (`id`), ADD KEY `author_id` (`author_id`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `author` -- ALTER TABLE `author` MODIFY `id` bigint(11) NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `book` -- ALTER TABLE `book` MODIFY `id` bigint(11) NOT NULL AUTO_INCREMENT; -- -- Constraints for dumped tables -- -- -- Constraints for table `book` -- ALTER TABLE `book` ADD CONSTRAINT `book_ibfk_1` FOREIGN KEY (`author_id`) REFERENCES `author` (`id`); COMMIT; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
true
a277f005f33ef3b0e133f08fdd2cc455ff0650a2
SQL
PlainSightAnalytics/WCG
/WCG_DW/model/Views/Violation Charge.sql
UTF-8
966
2.734375
3
[]
no_license
 CREATE VIEW [model].[Violation Charge] AS ------------------------------------------------------------------------------------------ -- Author : Generated from Model -- Date Created : 06 May 2018 1:44:35 PM -- Reason : Semantic View for dbo.DimViolationCharge -- Modified By : -- Modified On : -- Reason : ------------------------------------------------------------------------------------------ SELECT [ViolationChargeKey] AS [ViolationChargeKey] ,[ChargeAmount] AS [Charge Amount] ,[ChargeCategory] AS [Charge Category] ,[ChargeCategoryOrder] AS [Charge Category Order] ,[ChargeCode] AS [Charge Code] ,[ChargeDescription] AS [Charge Description] ,[ChargeGUID] AS [Charge GUID] ,[ChargeSubCategory] AS [Charge Sub Category] ,[ChargeSubCategoryOrder] AS [Charge Sub Category Order] ,[RegulationNumber] AS [Regulation Number] FROM WCG_DW.dbo.DimViolationCharge WITH (NOLOCK)
true
6c6f6e07c64a36ec378e8952206647fc2072086f
SQL
Denabramov054/servicelogs
/migrate/000002_likes.up.sql
UTF-8
186
3.078125
3
[]
no_license
CREATE TABLE likes ( id serial primary key, user_id integer REFERENCES users (id), video_id int not null, created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP );
true
1644d3de587363f46a0d9214642454653603f270
SQL
TheHammerGuy94/MOBAPDE-MP
/Shuffle/DB Shuffle.sql
UTF-8
926
3.78125
4
[]
no_license
CREATE SCHEMA db_shuffle; USE db_shuffle; CREATE TABLE sh_playlist( _id INT PRIMARY KEY AUTO_INCREMENT, name VARCHAR(45) NOT NULL, status INT DEFAULT 1, dateAdded DATETIME DEFAULT CURRENT_TIMESTAMP ) engine = innoDB; CREATE TABLE sh_playlist_songs ( _playlistId INT, song VARCHAR(45), status INT DEFAULT 1, dateAdded DATETIME DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY(_playlistId,song), CONSTRAINT playlistfk_1 FOREIGN KEY (_playlistId) REFERENCES sh_playlist(_id) ON UPDATE CASCADE ON DELETE CASCADE ) engine = innoDB; CREATE TABLE sh_score ( _id INT PRIMARY KEY, artist VARCHAR(45), playlistId INT, score INT NOT NULL, status INT DEFAULT 1, dateAdded DATETIME DEFAULT CURRENT_TIMESTAMP, CONSTRAINT scorefk_1 FOREIGN KEY(playlistId) REFERENCES sh_playlist(_id) ON UPDATE CASCADE ON DELETE CASCADE ) engine = innoDB;
true
8aed95fab92c419e58e7a2df968a7291f9e24b9d
SQL
nconforti93/cheatsheets
/Import Demo Data/flights.sql
UTF-8
19,027
2.953125
3
[]
no_license
-- BASED ON FLIGHTS schema in demodb CREATE OR REPLACE CONNECTION EXASOL_DEMO_DATA TO '' --Need to fill in where this data resides USER '' -- hope it's not needed IDENTIFIED BY '' -- hope it's not needed CREATE SCHEMA FLIGHTS; CREATE TABLE "AIRLINE" ( "AIRLINE_ID" INTEGER, "AIRLINE_NAME" VARCHAR(255) ); CREATE TABLE "AIRPORT" ( "AIRPORT_ID" INTEGER, "AIRPORT_NAME" VARCHAR(255) ); CREATE TABLE "DESCRIPTION" ( "FIELD" VARCHAR(1000), "DESCRIPTION" VARCHAR(10000) ); CREATE TABLE "FIELDS" ( "FIELD_NAME" VARCHAR(2000), "FIELD_DESC" VARCHAR(2000) ); CREATE TABLE "FLIGHTS" ( "YEAR" INTEGER, "QUARTER" INTEGER, "MONTH" INTEGER, "DAY_OF_MONTH" INTEGER, "DAY_OF_WEEK" DECIMAL(1,0), "FLIGHT_DATE" DATE, "OP_UNIQUE_CARRIER" VARCHAR(10), "AIRLINE_ID" INTEGER, "OP_CARRIER" VARCHAR(10), "TAIL_NUM" VARCHAR(10), "FLIGHT_NUM" INTEGER, "ORIGIN_AIRPORT_ID" INTEGER, "ORIGIN_AIRPORT_SEQ_ID" INTEGER, "ORIGIN_CITY_MARKET_ID" INTEGER, "ORIGIN" CHAR(3), "ORIGIN_CITY_NAME" VARCHAR(255), "ORIGIN_STATE_ABR" CHAR(2), "ORIGIN_STATE_FIPS" INTEGER, "ORIGIN_STATE_NM" VARCHAR(255), "ORIGIN_WAC" INTEGER, "DEST_AIRPORT_ID" INTEGER, "DEST_AIRPORT_SEQ_ID" INTEGER, "DEST_CITY_MARKET_ID" INTEGER, "DEST" CHAR(3), "DEST_CITY_NAME" VARCHAR(255), "DEST_STATE_ABR" CHAR(2), "DEST_STATE_FIPS" INTEGER, "DEST_STATE_NM" VARCHAR(255), "DEST_WAC" INTEGER, "CRS_DEP_TIME" VARCHAR(10), "DEP_TIME" VARCHAR(10), "DEP_DELAY" DOUBLE, "DEP_DELAY_NEW" DOUBLE, "DEP_DEL15" DOUBLE, "DEP_DELAY_GROUP" INTEGER, "DEP_TIME_BLK" VARCHAR(10), "TAXI_OUT" DOUBLE, "WHEELS_OFF" VARCHAR(10), "WHEELS_ON" VARCHAR(10), "TAXI_IN" DOUBLE, "CRS_ARR_TIME" VARCHAR(10), "ARR_TIME" VARCHAR(10), "ARR_DELAY" DOUBLE, "ARR_DELAY_NEW" DOUBLE, "ARR_DEL15" DOUBLE, "ARR_DELAY_GROUP" INTEGER, "ARR_TIME_BLK" VARCHAR(10), "CANCELLED" DOUBLE, "CANCELLATION_CODE" VARCHAR(255), "DIVERTED" DOUBLE, "CRS_ELAPSED_TIME" DOUBLE, "ACTUAL_ELAPSED_TIME" DOUBLE, "AIR_TIME" DOUBLE, "FLIGHTS" DOUBLE, "DISTANCE" DOUBLE, "DISTANCE_GROUP" INTEGER, "CARRIER_DELAY" DOUBLE, "WEATHER_DELAY" DOUBLE, "NAS_DELAY" DOUBLE, "SECURITY_DELAY" DOUBLE, "LATE_AIRCRAFT_DELAY" DOUBLE, "FIRST_DEP_TIME" VARCHAR(10), "TOTAL_ADD_GTIME" DOUBLE, "LONGEST_ADD_GTIME" DOUBLE, "DIV_AIRPORT_LANDINGS" INTEGER, "DIV_REACHED_DEST" INTEGER, "DIV_ACTUAL_ELAPSED_TIME" DOUBLE, "DIV_ARR_DELAY" DOUBLE, "DIV_DISTANCE" DOUBLE, "DIV1_AIRPORT" CHAR(3), "DIV1_AIRPORT_ID" INTEGER, "DIV1_AIRPORT_SEQ_ID" INTEGER, "DIV1_WHEELS_ON" VARCHAR(10), "DIV1_TOTAL_GTIME" DOUBLE, "DIV1_LONGEST_GTIME" DOUBLE, "DIV1_WHEELS_OFF" VARCHAR(10), "DIV1_TAIL_NUM" VARCHAR(10), "DIV2_AIRPORT" CHAR(3), "DIV2_AIRPORT_ID" INTEGER, "DIV2_AIRPORT_SEQ_ID" INTEGER, "DIV2_WHEELS_ON" VARCHAR(10), "DIV2_TOTAL_GTIME" DOUBLE, "DIV2_LONGEST_GTIME" DOUBLE, "DIV2_WHEELS_OFF" VARCHAR(10), "DIV2_TAIL_NUM" VARCHAR(10), "DIV3_AIRPORT" CHAR(3), "DIV3_AIRPORT_ID" INTEGER, "DIV3_AIRPORT_SEQ_ID" INTEGER, "DIV3_WHEELS_ON" VARCHAR(10), "DIV3_TOTAL_GTIME" DOUBLE, "DIV3_LONGEST_GTIME" DOUBLE, "DIV3_WHEELS_OFF" VARCHAR(10), "DIV3_TAIL_NUM" VARCHAR(10), "DIV4_AIRPORT" CHAR(3), "DIV4_AIRPORT_ID" INTEGER, "DIV4_AIRPORT_SEQ_ID" INTEGER, "DIV4_WHEELS_ON" VARCHAR(10), "DIV4_TOTAL_GTIME" DOUBLE, "DIV4_LONGEST_GTIME" DOUBLE, "DIV4_WHEELS_OFF" VARCHAR(10), "DIV4_TAIL_NUM" VARCHAR(10), "DIV5_AIRPORT" CHAR(3), "DIV5_AIRPORT_ID" INTEGER, "DIV5_AIRPORT_SEQ_ID" INTEGER, "DIV5_WHEELS_ON" VARCHAR(10), "DIV5_TOTAL_GTIME" DOUBLE, "DIV5_LONGEST_GTIME" DOUBLE, "DIV5_WHEELS_OFF" VARCHAR(10), "DIV5_TAIL_NUM" VARCHAR(10), "DUMMY" VARCHAR(255), PARTITION BY "FLIGHT_DATE" ); COMMENT ON COLUMN "FLIGHTS"."YEAR" IS 'Year'; COMMENT ON COLUMN "FLIGHTS"."QUARTER" IS 'Quarter (1-4)'; COMMENT ON COLUMN "FLIGHTS"."MONTH" IS 'Month'; COMMENT ON COLUMN "FLIGHTS"."DAY_OF_MONTH" IS 'Day of Month'; COMMENT ON COLUMN "FLIGHTS"."DAY_OF_WEEK" IS 'Day of Week'; COMMENT ON COLUMN "FLIGHTS"."FLIGHT_DATE" IS 'Flight Date (yyyymmdd)'; COMMENT ON COLUMN "FLIGHTS"."OP_UNIQUE_CARRIER" IS 'Unique Carrier Code. When the same code has been used by multiple carriers, a numeric suffix is used for earlier users, for example, PA, PA(1), PA(2). Use this field for analysis across a range of years.'; COMMENT ON COLUMN "FLIGHTS"."AIRLINE_ID" IS 'An identification number assigned by US DOT to identify a unique airline (carrier). A unique airline (carrier) is defined as one holding and reporting under the same DOT certificate regardless of its Code, Name, or holding company/corporation.'; COMMENT ON COLUMN "FLIGHTS"."OP_CARRIER" IS 'Code assigned by IATA and commonly used to identify a carrier. As the same code may have been assigned to different carriers over time, the code is not always unique. For analysis, use the Unique Carrier Code.'; COMMENT ON COLUMN "FLIGHTS"."TAIL_NUM" IS 'Tail Number'; COMMENT ON COLUMN "FLIGHTS"."FLIGHT_NUM" IS 'Flight Number'; COMMENT ON COLUMN "FLIGHTS"."ORIGIN_AIRPORT_ID" IS 'Origin Airport, Airport ID. An identification number assigned by US DOT to identify a unique airport. Use this field for airport analysis across a range of years because an airport can change its airport code and airport codes can be reused.'; COMMENT ON COLUMN "FLIGHTS"."ORIGIN_AIRPORT_SEQ_ID" IS 'Origin Airport, Airport Sequence ID. An identification number assigned by US DOT to identify a unique airport at a given point of time. Airport attributes, such as airport name or coordinates, may change over time.'; COMMENT ON COLUMN "FLIGHTS"."ORIGIN_CITY_MARKET_ID" IS 'Origin Airport, City Market ID. City Market ID is an identification number assigned by US DOT to identify a city market. Use this field to consolidate airports serving the same city market.'; COMMENT ON COLUMN "FLIGHTS"."ORIGIN" IS 'Origin Airport'; COMMENT ON COLUMN "FLIGHTS"."ORIGIN_CITY_NAME" IS 'Origin Airport, City Name'; COMMENT ON COLUMN "FLIGHTS"."ORIGIN_STATE_ABR" IS 'Origin Airport, State Code'; COMMENT ON COLUMN "FLIGHTS"."ORIGIN_STATE_FIPS" IS 'Origin Airport, State Fips'; COMMENT ON COLUMN "FLIGHTS"."ORIGIN_STATE_NM" IS 'Origin Airport, State Name'; COMMENT ON COLUMN "FLIGHTS"."ORIGIN_WAC" IS 'Origin Airport, World Area Code'; COMMENT ON COLUMN "FLIGHTS"."DEST_AIRPORT_ID" IS 'Destination Airport, Airport ID. An identification number assigned by US DOT to identify a unique airport. Use this field for airport analysis across a range of years because an airport can change its airport code and airport codes can be reused.'; COMMENT ON COLUMN "FLIGHTS"."DEST_AIRPORT_SEQ_ID" IS 'Destination Airport, Airport Sequence ID. An identification number assigned by US DOT to identify a unique airport at a given point of time. Airport attributes, such as airport name or coordinates, may change over time.'; COMMENT ON COLUMN "FLIGHTS"."DEST_CITY_MARKET_ID" IS 'Destination Airport, City Market ID. City Market ID is an identification number assigned by US DOT to identify a city market. Use this field to consolidate airports serving the same city market.'; COMMENT ON COLUMN "FLIGHTS"."DEST" IS 'Destination Airport'; COMMENT ON COLUMN "FLIGHTS"."DEST_CITY_NAME" IS 'Destination Airport, City Name'; COMMENT ON COLUMN "FLIGHTS"."DEST_STATE_ABR" IS 'Destination Airport, State Code'; COMMENT ON COLUMN "FLIGHTS"."DEST_STATE_FIPS" IS 'Destination Airport, State Fips'; COMMENT ON COLUMN "FLIGHTS"."DEST_STATE_NM" IS 'Destination Airport, State Name'; COMMENT ON COLUMN "FLIGHTS"."DEST_WAC" IS 'Destination Airport, World Area Code'; COMMENT ON COLUMN "FLIGHTS"."CRS_DEP_TIME" IS 'CRS Departure Time (local time: hhmm)'; COMMENT ON COLUMN "FLIGHTS"."DEP_TIME" IS 'Actual Departure Time (local time: hhmm)'; COMMENT ON COLUMN "FLIGHTS"."DEP_DELAY" IS 'Difference in minutes between scheduled and actual departure time. Early departures show negative numbers.'; COMMENT ON COLUMN "FLIGHTS"."DEP_DELAY_NEW" IS 'Difference in minutes between scheduled and actual departure time. Early departures set to 0.'; COMMENT ON COLUMN "FLIGHTS"."DEP_DEL15" IS 'Departure Delay Indicator, 15 Minutes or More (1=Yes)'; COMMENT ON COLUMN "FLIGHTS"."DEP_DELAY_GROUP" IS 'Departure Delay intervals, every (15 minutes from <-15 to >180)'; COMMENT ON COLUMN "FLIGHTS"."DEP_TIME_BLK" IS 'CRS Departure Time Block, Hourly Intervals'; COMMENT ON COLUMN "FLIGHTS"."TAXI_OUT" IS 'Taxi Out Time, in Minutes'; COMMENT ON COLUMN "FLIGHTS"."WHEELS_OFF" IS 'Wheels Off Time (local time: hhmm)'; COMMENT ON COLUMN "FLIGHTS"."WHEELS_ON" IS 'Wheels On Time (local time: hhmm)'; COMMENT ON COLUMN "FLIGHTS"."TAXI_IN" IS 'Taxi In Time, in Minutes'; COMMENT ON COLUMN "FLIGHTS"."CRS_ARR_TIME" IS 'CRS Arrival Time (local time: hhmm)'; COMMENT ON COLUMN "FLIGHTS"."ARR_TIME" IS 'Actual Arrival Time (local time: hhmm)'; COMMENT ON COLUMN "FLIGHTS"."ARR_DELAY" IS 'Difference in minutes between scheduled and actual arrival time. Early arrivals show negative numbers.'; COMMENT ON COLUMN "FLIGHTS"."ARR_DELAY_NEW" IS 'Difference in minutes between scheduled and actual arrival time. Early arrivals set to 0.'; COMMENT ON COLUMN "FLIGHTS"."ARR_DEL15" IS 'Arrival Delay Indicator, 15 Minutes or More (1=Yes)'; COMMENT ON COLUMN "FLIGHTS"."ARR_DELAY_GROUP" IS 'Arrival Delay intervals, every (15-minutes from <-15 to >180)'; COMMENT ON COLUMN "FLIGHTS"."ARR_TIME_BLK" IS 'CRS Arrival Time Block, Hourly Intervals'; COMMENT ON COLUMN "FLIGHTS"."CANCELLED" IS 'Cancelled Flight Indicator (1=Yes)'; COMMENT ON COLUMN "FLIGHTS"."CANCELLATION_CODE" IS 'Specifies The Reason For Cancellation'; COMMENT ON COLUMN "FLIGHTS"."DIVERTED" IS 'Diverted Flight Indicator (1=Yes)'; COMMENT ON COLUMN "FLIGHTS"."CRS_ELAPSED_TIME" IS 'CRS Elapsed Time of Flight, in Minutes'; COMMENT ON COLUMN "FLIGHTS"."ACTUAL_ELAPSED_TIME" IS 'Elapsed Time of Flight, in Minutes'; COMMENT ON COLUMN "FLIGHTS"."AIR_TIME" IS 'Flight Time, in Minutes'; COMMENT ON COLUMN "FLIGHTS"."FLIGHTS" IS 'Number of Flights'; COMMENT ON COLUMN "FLIGHTS"."DISTANCE" IS 'Distance between airports (miles)'; COMMENT ON COLUMN "FLIGHTS"."DISTANCE_GROUP" IS 'Distance Intervals, every 250 Miles, for Flight Segment'; COMMENT ON COLUMN "FLIGHTS"."CARRIER_DELAY" IS 'Carrier Delay, in Minutes'; COMMENT ON COLUMN "FLIGHTS"."WEATHER_DELAY" IS 'Weather Delay, in Minutes'; COMMENT ON COLUMN "FLIGHTS"."NAS_DELAY" IS 'National Air System Delay, in Minutes'; COMMENT ON COLUMN "FLIGHTS"."SECURITY_DELAY" IS 'Security Delay, in Minutes'; COMMENT ON COLUMN "FLIGHTS"."LATE_AIRCRAFT_DELAY" IS 'Late Aircraft Delay, in Minutes'; COMMENT ON COLUMN "FLIGHTS"."FIRST_DEP_TIME" IS 'First Gate Departure Time at Origin Airport'; COMMENT ON COLUMN "FLIGHTS"."TOTAL_ADD_GTIME" IS 'Total Ground Time Away from Gate for Gate Return or Cancelled Flight'; COMMENT ON COLUMN "FLIGHTS"."LONGEST_ADD_GTIME" IS 'Longest Time Away from Gate for Gate Return or Cancelled Flight'; COMMENT ON COLUMN "FLIGHTS"."DIV_AIRPORT_LANDINGS" IS 'Number of Diverted Airport Landings'; COMMENT ON COLUMN "FLIGHTS"."DIV_REACHED_DEST" IS 'Diverted Flight Reaching Scheduled Destination Indicator (1=Yes)'; COMMENT ON COLUMN "FLIGHTS"."DIV_ACTUAL_ELAPSED_TIME" IS 'Elapsed Time of Diverted Flight Reaching Scheduled Destination, in Minutes. The ActualElapsedTime column remains NULL for all diverted flights.'; COMMENT ON COLUMN "FLIGHTS"."DIV_ARR_DELAY" IS 'Difference in minutes between scheduled and actual arrival time for a diverted flight reaching scheduled destination. The ArrDelay column remains NULL for all diverted flights.'; COMMENT ON COLUMN "FLIGHTS"."DIV_DISTANCE" IS 'Distance between scheduled destination and final diverted airport (miles). Value will be 0 for diverted flight reaching scheduled destination.'; COMMENT ON COLUMN "FLIGHTS"."DIV1_AIRPORT" IS 'Diverted Airport Code1'; COMMENT ON COLUMN "FLIGHTS"."DIV1_AIRPORT_ID" IS 'Airport ID of Diverted Airport 1. Airport ID is a Unique Key for an Airport'; COMMENT ON COLUMN "FLIGHTS"."DIV1_AIRPORT_SEQ_ID" IS 'Airport Sequence ID of Diverted Airport 1. Unique Key for Time Specific Information for an Airport'; COMMENT ON COLUMN "FLIGHTS"."DIV1_WHEELS_ON" IS 'Wheels On Time (local time: hhmm) at Diverted Airport Code1'; COMMENT ON COLUMN "FLIGHTS"."DIV1_TOTAL_GTIME" IS 'Total Ground Time Away from Gate at Diverted Airport Code1'; COMMENT ON COLUMN "FLIGHTS"."DIV1_LONGEST_GTIME" IS 'Longest Ground Time Away from Gate at Diverted Airport Code1'; COMMENT ON COLUMN "FLIGHTS"."DIV1_WHEELS_OFF" IS 'Wheels Off Time (local time: hhmm) at Diverted Airport Code1'; COMMENT ON COLUMN "FLIGHTS"."DIV1_TAIL_NUM" IS 'Aircraft Tail Number for Diverted Airport Code1'; COMMENT ON COLUMN "FLIGHTS"."DIV2_AIRPORT" IS 'Diverted Airport Code2'; COMMENT ON COLUMN "FLIGHTS"."DIV2_AIRPORT_ID" IS 'Airport ID of Diverted Airport 2. Airport ID is a Unique Key for an Airport'; COMMENT ON COLUMN "FLIGHTS"."DIV2_AIRPORT_SEQ_ID" IS 'Airport Sequence ID of Diverted Airport 2. Unique Key for Time Specific Information for an Airport'; COMMENT ON COLUMN "FLIGHTS"."DIV2_WHEELS_ON" IS 'Wheels On Time (local time: hhmm) at Diverted Airport Code2'; COMMENT ON COLUMN "FLIGHTS"."DIV2_TOTAL_GTIME" IS 'Total Ground Time Away from Gate at Diverted Airport Code2'; COMMENT ON COLUMN "FLIGHTS"."DIV2_LONGEST_GTIME" IS 'Longest Ground Time Away from Gate at Diverted Airport Code2'; COMMENT ON COLUMN "FLIGHTS"."DIV2_WHEELS_OFF" IS 'Wheels Off Time (local time: hhmm) at Diverted Airport Code2'; COMMENT ON COLUMN "FLIGHTS"."DIV2_TAIL_NUM" IS 'Aircraft Tail Number for Diverted Airport Code2'; COMMENT ON COLUMN "FLIGHTS"."DIV3_AIRPORT" IS 'Diverted Airport Code3'; COMMENT ON COLUMN "FLIGHTS"."DIV3_AIRPORT_ID" IS 'Airport ID of Diverted Airport 3. Airport ID is a Unique Key for an Airport'; COMMENT ON COLUMN "FLIGHTS"."DIV3_AIRPORT_SEQ_ID" IS 'Airport Sequence ID of Diverted Airport 3. Unique Key for Time Specific Information for an Airport'; COMMENT ON COLUMN "FLIGHTS"."DIV3_WHEELS_ON" IS 'Wheels On Time (local time: hhmm) at Diverted Airport Code3'; COMMENT ON COLUMN "FLIGHTS"."DIV3_TOTAL_GTIME" IS 'Total Ground Time Away from Gate at Diverted Airport Code3'; COMMENT ON COLUMN "FLIGHTS"."DIV3_LONGEST_GTIME" IS 'Longest Ground Time Away from Gate at Diverted Airport Code3'; COMMENT ON COLUMN "FLIGHTS"."DIV3_WHEELS_OFF" IS 'Wheels Off Time (local time: hhmm) at Diverted Airport Code3'; COMMENT ON COLUMN "FLIGHTS"."DIV3_TAIL_NUM" IS 'Aircraft Tail Number for Diverted Airport Code3'; COMMENT ON COLUMN "FLIGHTS"."DIV4_AIRPORT" IS 'Diverted Airport Code4'; COMMENT ON COLUMN "FLIGHTS"."DIV4_AIRPORT_ID" IS 'Airport ID of Diverted Airport 4. Airport ID is a Unique Key for an Airport'; COMMENT ON COLUMN "FLIGHTS"."DIV4_AIRPORT_SEQ_ID" IS 'Airport Sequence ID of Diverted Airport 4. Unique Key for Time Specific Information for an Airport'; COMMENT ON COLUMN "FLIGHTS"."DIV4_WHEELS_ON" IS 'Wheels On Time (local time: hhmm) at Diverted Airport Code4'; COMMENT ON COLUMN "FLIGHTS"."DIV4_TOTAL_GTIME" IS 'Total Ground Time Away from Gate at Diverted Airport Code4'; COMMENT ON COLUMN "FLIGHTS"."DIV4_LONGEST_GTIME" IS 'Longest Ground Time Away from Gate at Diverted Airport Code4'; COMMENT ON COLUMN "FLIGHTS"."DIV4_WHEELS_OFF" IS 'Wheels Off Time (local time: hhmm) at Diverted Airport Code4'; COMMENT ON COLUMN "FLIGHTS"."DIV4_TAIL_NUM" IS 'Aircraft Tail Number for Diverted Airport Code4'; COMMENT ON COLUMN "FLIGHTS"."DIV5_AIRPORT" IS 'Diverted Airport Code5'; COMMENT ON COLUMN "FLIGHTS"."DIV5_AIRPORT_ID" IS 'Airport ID of Diverted Airport 5. Airport ID is a Unique Key for an Airport'; COMMENT ON COLUMN "FLIGHTS"."DIV5_AIRPORT_SEQ_ID" IS 'Airport Sequence ID of Diverted Airport 5. Unique Key for Time Specific Information for an Airport'; COMMENT ON COLUMN "FLIGHTS"."DIV5_WHEELS_ON" IS 'Wheels On Time (local time: hhmm) at Diverted Airport Code5'; COMMENT ON COLUMN "FLIGHTS"."DIV5_TOTAL_GTIME" IS 'Total Ground Time Away from Gate at Diverted Airport Code5'; COMMENT ON COLUMN "FLIGHTS"."DIV5_LONGEST_GTIME" IS 'Longest Ground Time Away from Gate at Diverted Airport Code5'; COMMENT ON COLUMN "FLIGHTS"."DIV5_WHEELS_OFF" IS 'Wheels Off Time (local time: hhmm) at Diverted Airport Code5'; COMMENT ON COLUMN "FLIGHTS"."DIV5_TAIL_NUM" IS 'Aircraft Tail Number for Diverted Airport Code5'; CREATE TABLE "WEEKDAYS" ( "DAY_OF_WEEK" DECIMAL(1,0) NOT NULL, "WEEKDAY_NAME" VARCHAR(100) ); ALTER TABLE "AIRLINE" ADD CONSTRAINT "PK_AIRLINE_ID" PRIMARY KEY ("AIRLINE_ID"); ALTER TABLE "AIRPORT" ADD CONSTRAINT "PK_AIRPORT_ID" PRIMARY KEY ("AIRPORT_ID"); ALTER TABLE "FLIGHTS" ADD CONSTRAINT "PK_OTP" PRIMARY KEY ("ORIGIN_AIRPORT_ID", "FLIGHT_NUM", "AIRLINE_ID", "DEST_AIRPORT_ID", "FLIGHT_DATE"); ALTER TABLE "FLIGHTS" ADD CONSTRAINT "FLIGHTS_FK_WEEKDAY" FOREIGN KEY ("DAY_OF_WEEK") REFERENCES "WEEKDAYS" ("DAY_OF_WEEK"); ALTER TABLE "WEEKDAYS" ADD CONSTRAINT "PK_WEEKDAYS" PRIMARY KEY ("DAY_OF_WEEK"); IMPORT INTO FLIGHTS.AIRLINE FROM CSV AT EXASOL_DEMO_DATA FILE 'flights/airline.csv'; IMPORT INTO FLIGHTS.AIRPORT FROM CSV AT EXASOL_DEMO_DATA FILE 'flights/airport.csv'; IMPORT INTO FLIGHTS.DESCRIPTION FROM CSV AT EXASOL_DEMO_DATA FILE 'flights/description.csv'; IMPORT INTO FLIGHTS.FIELDS FROM CSV AT EXASOL_DEMO_DATA FILE 'flights/fields.csv'; IMPORT INTO FLIGHTS.WEEKDAYS FROM CSV AT EXASOL_DEMO_DATA FILE 'flights/weekdays.csv'; -- Use multiple files to improve performance and have all nodes import in parallel IMPORT INTO FLIGHTS.FLIGHTS FROM CSV AT EXASOL_DEMO_DATA FILE 'flights/flights_pt1.csv' FILE 'flights/flights_pt2.csv' FILE 'flights/flights_pt3.csv' FILE 'flights/flights_pt4.csv'; SELECT 'All data imported! Enjoy exploring the Flights dataset!';
true
20126987d241e21a5a2e38e8ca42d623dcab7d45
SQL
SotirisKavv/Cloud-TUC
/Initial/mysql/init.sql
UTF-8
502
3.359375
3
[]
no_license
CREATE DATABASE IF NOT EXISTS mydb; USE mydb; CREATE TABLE IF NOT EXISTS Teachers ( ID varchar(255) NOT NULL, NAME varchar(255), SURNAME varchar(255), USERNAME varchar(255) NOT NULL UNIQUE, PASSWORD varchar(255) NOT NULL, EMAIL varchar(255), PRIMARY KEY (ID) ); CREATE TABLE IF NOT EXISTS Students ( ID varchar(255) NOT NULL, NAME varchar(255), SURNAME varchar(255), FATHERNAME varchar(255), GRADE real, MOBILENUMBER varchar(255), Birthday date, PRIMARY KEY (ID) )
true
77bcca28ea576e2a1b124f037f36f9713483b9f5
SQL
humantom88/geekbrains-databases
/homework5/task2.sql
UTF-8
2,299
3.71875
4
[]
no_license
# 2. Таблица users была неудачно спроектирована. # Записи created_at и updated_at были заданы типом VARCHAR # и в них долгое время помещались значения в формате "20.10.2017 8:10". # Необходимо преобразовать поля к типу DATETIME, сохранив введеные ранее значения. DESC users; ###### Подготовка # В исходной базе столбцы уже в формате DATETIME, поэтому сначала перевожу в VARCHAR ALTER TABLE users MODIFY COLUMN created_at VARCHAR(255); ALTER TABLE users MODIFY COLUMN updated_at VARCHAR(255); # Заполняю таблицу значениями в нужном формате UPDATE users SET created_at = DATE_FORMAT(NOW(), '%d.%m.%Y %h:%i'); UPDATE users SET updated_at = DATE_FORMAT(NOW(), '%d.%m.%Y %h:%i'); ################# ###### Начало миграции # Добавляем вспомогательный столбец ALTER TABLE users ADD COLUMN temp_date VARCHAR(255); # Копируем туда данные created_at UPDATE users SET temp_date = created_at; # Заполняем created_at данными из temp_date # UPDATE users SET created_at = CONVERT UPDATE users SET created_at = FROM_UNIXTIME(UNIX_TIMESTAMP(CONCAT( substring(temp_date, 7, 4), '-', substring(temp_date, 1, 2), '-', substring(temp_date, 4, 2), ' ', substring(temp_date, 12, 5) ))); # Переводим created_at в DATETIME ALTER TABLE users MODIFY COLUMN created_at DATETIME; # Теперь повторяем шаги для updated_at # Копируем в temp_date данные updated_at UPDATE users SET temp_date = updated_at; # Заполняем updated_at данными из temp_date # UPDATE users SET created_at = CONVERT UPDATE users SET updated_at = FROM_UNIXTIME(UNIX_TIMESTAMP(CONCAT( substring(temp_date, 7, 4), '-', substring(temp_date, 1, 2), '-', substring(temp_date, 4, 2), ' ', substring(temp_date, 12, 5) ))); # Переводим updated_at в DATETIME ALTER TABLE users MODIFY COLUMN updated_at DATETIME; # Удаляем вспомогательную колонку ALTER TABLE users DROP COLUMN temp_date; #################
true
2f71b61a5b693d82cc1e8e4bd30786ab6311df1b
SQL
djwood95/Blog
/blog.sql
UTF-8
2,213
3.265625
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 4.6.6deb5 -- https://www.phpmyadmin.net/ -- -- Host: localhost:3306 -- Generation Time: Oct 16, 2019 at 11:47 AM -- Server version: 5.7.27-0ubuntu0.19.04.1 -- PHP Version: 7.3.7-1+ubuntu18.10.1+deb.sury.org+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 */; -- -- Database: `blog` -- -- -------------------------------------------------------- -- -- Table structure for table `comments` -- CREATE TABLE `comments` ( `id` int(11) NOT NULL, `postId` int(11) NOT NULL, `created_by` tinytext NOT NULL, `created_at` datetime NOT NULL, `comment` text NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Table structure for table `posts` -- CREATE TABLE `posts` ( `id` int(11) NOT NULL, `created_at` datetime NOT NULL, `created_by` tinytext NOT NULL, `title` tinytext NOT NULL, `content` text NOT NULL, `deleted` tinyint(1) NOT NULL DEFAULT '0' ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Indexes for dumped tables -- -- -- Indexes for table `comments` -- ALTER TABLE `comments` ADD PRIMARY KEY (`id`), ADD KEY `postIdFK` (`postId`); -- -- Indexes for table `posts` -- ALTER TABLE `posts` ADD PRIMARY KEY (`id`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `comments` -- ALTER TABLE `comments` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8; -- -- AUTO_INCREMENT for table `posts` -- ALTER TABLE `posts` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=16; -- -- Constraints for dumped tables -- -- -- Constraints for table `comments` -- ALTER TABLE `comments` ADD CONSTRAINT `postIdFK` FOREIGN KEY (`postId`) REFERENCES `posts` (`id`) ON DELETE CASCADE ON UPDATE CASCADE; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
true
03963f37bb3d17bde9744b79f8dd82c76720f4d5
SQL
derari/quid-accidit
/mysql/old/createschema.sql
UTF-8
15,145
3.5625
4
[]
no_license
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0; SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0; SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES'; DROP SCHEMA IF EXISTS `accidit` ; CREATE SCHEMA IF NOT EXISTS `accidit` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci ; USE `accidit` ; -- ----------------------------------------------------- -- Table `accidit`.`TestTrace` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `accidit`.`TestTrace` ( `id` INT NOT NULL , `name` VARCHAR(255) NOT NULL , PRIMARY KEY (`id`) ) ENGINE = InnoDB; CREATE UNIQUE INDEX `id_UNIQUE` ON `accidit`.`TestTrace` (`id` ASC) ; -- ----------------------------------------------------- -- Table `accidit`.`Type` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `accidit`.`Type` ( `id` INT NOT NULL , `name` VARCHAR(255) NOT NULL , `file` VARCHAR(255) NULL , PRIMARY KEY (`id`) ) ENGINE = InnoDB; CREATE INDEX `Type_name_idx` ON `accidit`.`Type` (`name` ASC) ; -- ----------------------------------------------------- -- Table `accidit`.`Method` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `accidit`.`Method` ( `id` INT NOT NULL , `declaringTypeId` INT NOT NULL , `name` VARCHAR(255) NOT NULL , `signature` VARCHAR(2048) NOT NULL , PRIMARY KEY (`id`) , CONSTRAINT `fk_Method_Type` FOREIGN KEY (`declaringTypeId` ) REFERENCES `accidit`.`Type` (`id` ) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; CREATE INDEX `fk_Method_Type_idx` ON `accidit`.`Method` (`declaringTypeId` ASC) ; CREATE INDEX `Method_declType_name_sig_idx` ON `accidit`.`Method` (`declaringTypeId` ASC, `name` ASC, `signature` ASC) ; -- ----------------------------------------------------- -- Table `accidit`.`ObjectTrace` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `accidit`.`ObjectTrace` ( `testId` INT NOT NULL , `id` BIGINT NOT NULL , `typeId` INT NOT NULL , PRIMARY KEY (`testId`, `id`) , CONSTRAINT `fk_ObjectTrace_TestTrace` FOREIGN KEY (`testId` ) REFERENCES `accidit`.`TestTrace` (`id` ) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_ObjectTrace_Type` FOREIGN KEY (`typeId` ) REFERENCES `accidit`.`Type` (`id` ) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; CREATE INDEX `fk_ObjectTrace_Type_idx` ON `accidit`.`ObjectTrace` (`typeId` ASC) ; -- ----------------------------------------------------- -- Table `accidit`.`InvocationTrace` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `accidit`.`InvocationTrace` ( `testId` INT NOT NULL , `entry` BIGINT NOT NULL , `exit` BIGINT NOT NULL , `depth` INT NOT NULL , `callLine` INT NOT NULL , `methodId` INT NOT NULL , `thisId` BIGINT NULL , `returned` TINYINT(1) NOT NULL , `retPrimType` INT NOT NULL , `retValue` BIGINT NOT NULL , `retLine` INT NOT NULL , PRIMARY KEY (`testId`, `entry`) , CONSTRAINT `fk_InvocationTrace_TestTrace` FOREIGN KEY (`testId` ) REFERENCES `accidit`.`TestTrace` (`id` ) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_InvocationTrace_Method` FOREIGN KEY (`methodId` ) REFERENCES `accidit`.`Method` (`id` ) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_InvocationTrace_ObjectTrace` FOREIGN KEY (`testId` , `thisId` ) REFERENCES `accidit`.`ObjectTrace` (`testId` , `id` ) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; CREATE INDEX `fk_InvocationTrace_TestTrace_idx` ON `accidit`.`InvocationTrace` (`testId` ASC) ; CREATE INDEX `fk_InvocationTrace_Method_idx` ON `accidit`.`InvocationTrace` (`methodId` ASC) ; CREATE INDEX `fk_InvocationTrace_ObjectTrace_idx` ON `accidit`.`InvocationTrace` (`testId` ASC, `thisId` ASC) ; -- ----------------------------------------------------- -- Table `accidit`.`Extends` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `accidit`.`Extends` ( `subId` INT NOT NULL , `superId` INT NOT NULL , PRIMARY KEY (`subId`, `superId`) , CONSTRAINT `fk_Extends_Type_sub` FOREIGN KEY (`subId` ) REFERENCES `accidit`.`Type` (`id` ) ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT `fk_Extends_Type_super` FOREIGN KEY (`superId` ) REFERENCES `accidit`.`Type` (`id` ) ON DELETE CASCADE ON UPDATE NO ACTION) ENGINE = InnoDB; CREATE INDEX `fk_Extends_Type_super_idx` ON `accidit`.`Extends` (`superId` ASC) ; CREATE INDEX `fk_Extends_Type_sub_idx` ON `accidit`.`Extends` (`subId` ASC) ; -- ----------------------------------------------------- -- Table `accidit`.`Field` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `accidit`.`Field` ( `id` INT NOT NULL , `declaringTypeId` INT NOT NULL , `name` VARCHAR(255) NOT NULL , PRIMARY KEY (`id`) , CONSTRAINT `fk_Field_Type` FOREIGN KEY (`declaringTypeId` ) REFERENCES `accidit`.`Type` (`id` ) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; CREATE INDEX `fk_Field_Type_idx` ON `accidit`.`Field` (`declaringTypeId` ASC) ; CREATE INDEX `Field_declType_name_idx` ON `accidit`.`Field` (`declaringTypeId` ASC, `name` ASC) ; -- ----------------------------------------------------- -- Table `accidit`.`Local` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `accidit`.`Local` ( `methodId` INT NOT NULL , `id` INT NOT NULL , `name` VARCHAR(255) NOT NULL , `arg` TINYINT(1) NOT NULL , PRIMARY KEY (`methodId`, `id`) , CONSTRAINT `fk_Local_Method` FOREIGN KEY (`methodId` ) REFERENCES `accidit`.`Method` (`id` ) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; CREATE INDEX `Local_method_name_idx` ON `accidit`.`Local` (`methodId` ASC, `name` ASC) ; -- ----------------------------------------------------- -- Table `accidit`.`LocalTrace` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `accidit`.`LocalTrace` ( `testId` INT NOT NULL , `invEntry` BIGINT NOT NULL , `step` INT NOT NULL , `methodId` INT NOT NULL , `localId` INT NOT NULL , `primType` INT NOT NULL , `value` BIGINT NOT NULL , `line` INT NULL , PRIMARY KEY (`testId`, `invEntry`, `step`) , CONSTRAINT `fk_LocalTrace_InvocationTrace` FOREIGN KEY (`testId` , `invEntry` ) REFERENCES `accidit`.`InvocationTrace` (`testId` , `entry` ) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_LocalTrace_Local` FOREIGN KEY (`methodId` , `localId` ) REFERENCES `accidit`.`Local` (`methodId` , `id` ) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; CREATE INDEX `fk_LocalTrace_Local_idx` ON `accidit`.`LocalTrace` (`methodId` ASC, `localId` ASC) ; CREATE INDEX `fk_LocalTrace_InvocationTrace_idx` ON `accidit`.`LocalTrace` (`testId` ASC, `invEntry` ASC) ; -- ----------------------------------------------------- -- Table `accidit`.`FieldTrace` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `accidit`.`FieldTrace` ( `testId` INT NULL , `invEntry` BIGINT NOT NULL , `step` BIGINT NOT NULL , `thisId` BIGINT NULL , `fieldId` INT NOT NULL , `primType` INT NOT NULL , `value` BIGINT NOT NULL , `line` INT NULL , PRIMARY KEY (`testId`, `invEntry`, `step`) , CONSTRAINT `fk_FieldTrace_ObjectTrace` FOREIGN KEY (`testId` , `thisId` ) REFERENCES `accidit`.`ObjectTrace` (`testId` , `id` ) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_FieldTrace_Field` FOREIGN KEY (`fieldId` ) REFERENCES `accidit`.`Field` (`id` ) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_FieldTrace_InvocationTrace` FOREIGN KEY (`testId` , `invEntry` ) REFERENCES `accidit`.`InvocationTrace` (`testId` , `entry` ) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; CREATE INDEX `fk_FieldTrace_Field_idx` ON `accidit`.`FieldTrace` (`fieldId` ASC) ; CREATE INDEX `fk_FieldTrace_InvocationTrace_idx` ON `accidit`.`FieldTrace` (`testId` ASC, `invEntry` ASC) ; CREATE INDEX `fk_FieldTrace_ObjectTrace_idx` ON `accidit`.`FieldTrace` (`testId` ASC, `thisId` ASC) ; -- ----------------------------------------------------- -- Table `accidit`.`AccessTrace` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `accidit`.`AccessTrace` ( `testId` INT NULL , `invEntry` BIGINT NOT NULL , `step` BIGINT NOT NULL , `thisId` BIGINT NULL , `fieldId` INT NOT NULL , `line` INT NULL , PRIMARY KEY (`testId`, `invEntry`, `step`) , CONSTRAINT `fk_AccessTrace_ObjectTrace` FOREIGN KEY (`testId` , `thisId` ) REFERENCES `accidit`.`ObjectTrace` (`testId` , `id` ) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_AccessTrace_Field` FOREIGN KEY (`fieldId` ) REFERENCES `accidit`.`Field` (`id` ) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_AccessTrace_InvocationTrace` FOREIGN KEY (`testId` , `invEntry` ) REFERENCES `accidit`.`InvocationTrace` (`testId` , `entry` ) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; CREATE INDEX `fk_AccessTrace_Field_idx` ON `accidit`.`AccessTrace` (`fieldId` ASC) ; CREATE INDEX `fk_AccessTrace_InvocationTrace_idx` ON `accidit`.`AccessTrace` (`testId` ASC, `invEntry` ASC) ; CREATE INDEX `fk_AccessTrace_ObjectTrace_idx` ON `accidit`.`AccessTrace` (`testId` ASC, `thisId` ASC) ; -- ----------------------------------------------------- -- Table `accidit`.`ThrowTrace` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `accidit`.`ThrowTrace` ( `testId` INT NOT NULL , `invEntry` BIGINT NOT NULL , `step` BIGINT NOT NULL , `exceptionId` BIGINT NOT NULL , `line` INT NULL , PRIMARY KEY (`testId`, `invEntry`, `step`) , CONSTRAINT `fk_ThrowTrace_InvocationTrace` FOREIGN KEY (`testId` , `invEntry` ) REFERENCES `accidit`.`InvocationTrace` (`testId` , `entry` ) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_ThrowTrace_ObjectTrace` FOREIGN KEY (`testId` , `exceptionId` ) REFERENCES `accidit`.`ObjectTrace` (`testId` , `id` ) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; CREATE INDEX `fk_ThrowTrace_ObjectTrace_idx` ON `accidit`.`ThrowTrace` (`testId` ASC, `exceptionId` ASC) ; CREATE INDEX `fk_ThrowTrace_InvocationTrace_idx` ON `accidit`.`ThrowTrace` (`testId` ASC, `invEntry` ASC) ; -- ----------------------------------------------------- -- Table `accidit`.`CatchTrace` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `accidit`.`CatchTrace` ( `testId` INT NOT NULL , `invEntry` BIGINT NOT NULL , `step` BIGINT NOT NULL , `exceptionId` BIGINT NOT NULL , `line` INT NULL , PRIMARY KEY (`testId`, `invEntry`, `step`) , CONSTRAINT `fk_CatchTrace_InvocationTrace` FOREIGN KEY (`testId` , `invEntry` ) REFERENCES `accidit`.`InvocationTrace` (`testId` , `entry` ) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_CatchTrace_ObjectTrace` FOREIGN KEY (`testId` , `exceptionId` ) REFERENCES `accidit`.`ObjectTrace` (`testId` , `id` ) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; CREATE INDEX `fk_CatchTrace_ObjectTrace_idx` ON `accidit`.`CatchTrace` (`testId` ASC, `exceptionId` ASC) ; CREATE INDEX `fk_CatchTrace_InvocationTrace_idx` ON `accidit`.`CatchTrace` (`testId` ASC, `invEntry` ASC) ; -- ----------------------------------------------------- -- Placeholder table for view `accidit`.`vInvocationTrace` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `accidit`.`vInvocationTrace` (`testId` INT, `entry` INT, `exit` INT, `depth` INT, `callLine` INT, `methodId` INT, `type` INT, `method` INT, `thisId` INT, `returned` INT, `retPrimType` INT, `retValue` INT, `retLine` INT); -- ----------------------------------------------------- -- Placeholder table for view `accidit`.`vLocalTrace` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `accidit`.`vLocalTrace` (`testId` INT, `invEntry` INT, `step` INT, `methodId` INT, `localId` INT, `type` INT, `method` INT, `variable` INT, `arg` INT, `primType` INT, `value` INT, `line` INT); -- ----------------------------------------------------- -- Placeholder table for view `accidit`.`vFieldTrace` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `accidit`.`vFieldTrace` (`testId` INT, `invEntry` INT, `step` INT, `thisId` INT, `fieldId` INT, `type` INT, `field` INT, `primType` INT, `value` INT, `line` INT); -- ----------------------------------------------------- -- Placeholder table for view `accidit`.`vObjectTrace` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `accidit`.`vObjectTrace` (`testId` INT, `id` INT, `typeId` INT, `type` INT); -- ----------------------------------------------------- -- View `accidit`.`vInvocationTrace` -- ----------------------------------------------------- DROP TABLE IF EXISTS `accidit`.`vInvocationTrace`; USE `accidit`; CREATE OR REPLACE VIEW `accidit`.`vInvocationTrace` AS SELECT i.testId, i.entry, i.exit, i.depth, i.callLine, i.methodId, t.name AS type, m.name AS method, i.thisId, i.returned, i.retPrimType, i.retValue, i.retLine FROM InvocationTrace i JOIN Method m ON i.methodId = m.id JOIN Type t ON m.declaringTypeId = t.id; -- ----------------------------------------------------- -- View `accidit`.`vLocalTrace` -- ----------------------------------------------------- DROP TABLE IF EXISTS `accidit`.`vLocalTrace`; USE `accidit`; CREATE OR REPLACE VIEW `accidit`.`vLocalTrace` AS SELECT lt.testId, lt.invEntry, lt.step, lt.methodId, lt.localId, t.name as type, m.name as method, l.name as variable, l.arg as arg, lt.primType, lt.value, lt.line FROM LocalTrace lt JOIN Local l ON lt.methodId = l.methodId AND lt.localId = l.id JOIN Method m ON l.methodId = m.id JOIN Type t ON m.declaringTypeId = t.id; -- ----------------------------------------------------- -- View `accidit`.`vFieldTrace` -- ----------------------------------------------------- DROP TABLE IF EXISTS `accidit`.`vFieldTrace`; USE `accidit`; CREATE OR REPLACE VIEW `accidit`.`vFieldTrace` AS SELECT ft.testId, ft.invEntry, ft.step, ft.thisId, ft.fieldId, t.name as type, f.name as field, ft.primType, ft.value, ft.line FROM FieldTrace ft JOIN Field f ON ft.fieldId = f.id JOIN Type t ON f.declaringTypeId = t.id; -- ----------------------------------------------------- -- View `accidit`.`vObjectTrace` -- ----------------------------------------------------- DROP TABLE IF EXISTS `accidit`.`vObjectTrace`; USE `accidit`; CREATE OR REPLACE VIEW `accidit`.`vObjectTrace` AS SELECT o.testId, o.id, o.typeId, t.name as type FROM ObjectTrace o JOIN Type t WHERE o.typeId = t.id; SET SQL_MODE=@OLD_SQL_MODE; SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
true
8ea94bfe6c9bfa5fde6bf345c20dd2cac3f971f3
SQL
smilefengxiaoyan/smile
/Self-project/db/personnel_man.sql
UTF-8
3,768
2.9375
3
[]
no_license
/* Navicat MySQL Data Transfer Source Server : localhost_3306 Source Server Type : MySQL Source Server Version : 50721 Source Host : localhost:3306 Source Schema : personnel_man Target Server Type : MySQL Target Server Version : 50721 File Encoding : 65001 Date: 17/09/2018 12:05:11 */ SET NAMES utf8mb4; SET FOREIGN_KEY_CHECKS = 0; -- ---------------------------- -- Table structure for admin_table -- ---------------------------- DROP TABLE IF EXISTS `admin_table`; CREATE TABLE `admin_table` ( `s_no` char(6) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `pwd` char(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, PRIMARY KEY (`s_no`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of admin_table -- ---------------------------- INSERT INTO `admin_table` VALUES ('000001', '1234'); -- ---------------------------- -- Table structure for staff -- ---------------------------- DROP TABLE IF EXISTS `staff`; CREATE TABLE `staff` ( `s_no` char(6) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `s_name` char(8) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `s_firstname` char(8) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `s_sex` char(2) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `s_birth` date NOT NULL, `s_email` char(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `s_company` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `s_quote` char(5) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `s_password` char(6) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, PRIMARY KEY (`s_no`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of staff -- ---------------------------- INSERT INTO `staff` VALUES ('000001', 'Schwarz','Lukas', 'M', '1987-09-10', 'wang@163.com', 'BioTech','5', '1234'); INSERT INTO `staff` VALUES ('000002', 'Schwarz','Lean', 'F', '1987-09-10', 'Leon@163.com', 'BioTech','5', '1234'); INSERT INTO `staff` VALUES ('000003', 'Müller','Lukas', 'M', '1987-09-10', 'wan@163.com', 'BioTech','5', '1234'); INSERT INTO `staff` VALUES ('000004', 'Grun','Lukas', 'M', '1987-09-10', 'wng@163.com', 'BioTech','5', '1234'); INSERT INTO `staff` VALUES ('000005', 'Black','Lukas', 'M', '1987-09-10', 'wag@163.com', 'BioTech','5', '1234'); INSERT INTO `staff` VALUES ('000006', 'Li','Lukas', 'M', '1987-09-10', 'lang@163.com', 'BioTech','5', '1234'); INSERT INTO `staff` VALUES ('000007', 'Schwarz','Jan', 'F', '1987-09-10', 'kang@163.com', 'BioTech','5', '1234'); INSERT INTO `staff` VALUES ('000008', 'Schwarz','Jan', 'F', '1987-09-10', 'kang@163.com', 'BioTech','5', '1234'); -- ---------------------------- -- Table structure for inva -- ---------------------------- DROP TABLE IF EXISTS `inva`; CREATE TABLE `inva` ( `s_vo` char(6) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `s_from` char(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `s_to` char(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `s_subject` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `s_message` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `s_name` char(8) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, PRIMARY KEY (`s_vo`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of staff -- ---------------------------- INSERT INTO `inva` VALUES ('000001', 'wang@163.com', 'Leon@163.com', 'thankyou', 'welcome ', 'maria'); SET FOREIGN_KEY_CHECKS = 1;
true
1592b704075c2e48f73f93c92acc14cab315e31f
SQL
christian-gardner/LA-Tables
/la_assign_detail.sql
UTF-8
958
3.03125
3
[]
no_license
ALTER TABLE LA_ASSIGN_DETAIL DROP PRIMARY KEY CASCADE; DROP TABLE LA_ASSIGN_DETAIL CASCADE CONSTRAINTS; CREATE TABLE LA_ASSIGN_DETAIL ( BILLING_CODE VARCHAR2(20 BYTE), WRITE_OFF_AMOUNT VARCHAR2(30 BYTE), WRITE_OFF_REASON_CODE VARCHAR2(10 BYTE), WRITE_OFF_REASON VARCHAR2(1000 BYTE), DISPUTE_ID NUMBER, DETAIL_ID NUMBER, WRITE_OFF VARCHAR2(5 BYTE) ) LOGGING NOCOMPRESS NOCACHE NOPARALLEL MONITORING; CREATE UNIQUE INDEX LA_ASSIGN_DETAIL_BILL_CODE ON LA_ASSIGN_DETAIL (DISPUTE_ID, BILLING_CODE) LOGGING NOPARALLEL; CREATE UNIQUE INDEX LA_ASSIGN_DETAIL_PK01 ON LA_ASSIGN_DETAIL (DETAIL_ID) LOGGING NOPARALLEL; ALTER TABLE LA_ASSIGN_DETAIL ADD ( CONSTRAINT LA_ASSIGN_DETAIL_PK01 PRIMARY KEY (DETAIL_ID) USING INDEX LA_ASSIGN_DETAIL_PK01 ENABLE VALIDATE); GRANT DELETE, INSERT, SELECT, UPDATE ON LA_ASSIGN_DETAIL TO RDM_RW;
true
aad512b575dc6de10d0f36db7e2b2aeb46d1b21e
SQL
pedrooaugusto/curso-tecnico-projects
/LP2/docs/SQL.sql
UTF-8
16,567
3.21875
3
[ "Apache-2.0" ]
permissive
-- MySQL Administrator dump 1.4 -- -- ------------------------------------------------------ -- Server version 5.6.17 /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8 */; /*!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' */; -- -- Create schema august -- CREATE DATABASE IF NOT EXISTS august; USE august; -- -- Definition of table `entregador` -- DROP TABLE IF EXISTS `entregador`; CREATE TABLE `entregador` ( `ID_ent` int(11) NOT NULL, `Nome_ent` varchar(50) NOT NULL, `Veiculo_ent` varchar(20) NOT NULL, `CPF_ent` varchar(20) NOT NULL, `Salario_ent` float NOT NULL, `DataNasc_ent` varchar(10) NOT NULL, `FotoURL_ent` varchar(200) NOT NULL, PRIMARY KEY (`ID_ent`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `entregador` -- /*!40000 ALTER TABLE `entregador` DISABLE KEYS */; INSERT INTO `entregador` (`ID_ent`,`Nome_ent`,`Veiculo_ent`,`CPF_ent`,`Salario_ent`,`DataNasc_ent`,`FotoURL_ent`) VALUES (1,'Tom Baker','Bike','123.456.789-00',1500,'12/06/1970','H:/ENTIMG/4th.jpg'), (2,'David Tennant','Carro','121.233.232-32',1200,'09/06/2013','H:/ENTIMG/10th.jpg'), (3,'Strax','Bike','120.212.232-32',800,'06/12/1994','H:/ENTIMG/strax.jpg'), (4,'Adipose','Carro','120.965.557-57',4000,'12/03/1950','H:/ENTIMG/adp.jpg'), (5,'Matt Smith','Bike','000.000.000-00',1200,'05/05/2000','H:/ENTIMG/11th.jpg'), (6,'Silence','Moto','000.000.000-00',3000,'01/01/1970','H:/ENTIMG/Silent.jpg'), (7,'Leela','Bike','120.666.123-33',760,'12/04/2001','H:/ENTIMG/Leela.jpg'); /*!40000 ALTER TABLE `entregador` ENABLE KEYS */; -- -- Definition of table `ingrediente` -- DROP TABLE IF EXISTS `ingrediente`; CREATE TABLE `ingrediente` ( `ID_ing` int(10) unsigned NOT NULL, `Nome_ing` varchar(45) NOT NULL, `Unidade_ing` varchar(3) NOT NULL, `Categoria_ing` varchar(45) NOT NULL, `PrecoUnitario_ing` float NOT NULL, `EstoqueAtual_ing` float NOT NULL DEFAULT '0', `EstoqueMinimo_ing` int(10) unsigned NOT NULL, `EstoqueMaximo_ing` int(10) unsigned NOT NULL, PRIMARY KEY (`ID_ing`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='Tabela que guarda os ingredintes dos pratos'; -- -- Dumping data for table `ingrediente` -- /*!40000 ALTER TABLE `ingrediente` DISABLE KEYS */; INSERT INTO `ingrediente` (`ID_ing`,`Nome_ing`,`Unidade_ing`,`Categoria_ing`,`PrecoUnitario_ing`,`EstoqueAtual_ing`,`EstoqueMinimo_ing`,`EstoqueMaximo_ing`) VALUES (1,'Carne de Porco','KG','Carne',25,10.2,5,40), (2,'Limão','UNI','Tempero',0.75,5,15,40), (3,'Oléo','L','Molho',7.8,2.8,20,70), (4,'Cebola','KG','Tempero',19.6,11.5,12,32), (5,'Acem','KG','Carne',17,12,5,25), (6,'Massa','KG','Massa',23,8,6,16), (7,'Asa de galinha','KG','Carne',21,6,5,25), (8,'Tomate','KG','Tempero',6.7,11.6,5,20), (9,'Caldo Kinnor','UNI','Tempero',0.95,72,20,100), (10,'Fígado','KG','Carne',12.6,18,5,9), (11,'Alface','KG','Outros',1.2,8.4,12,21), (12,'Arroz','KG','Outros',7.65,48,10,25), (13,'Feijão','KG','Outros',8.5,35.2,10,15), (14,'Farinha de Trigo','KG','Molho',4.6,16.61,10,20), (15,'Farinha de Rosca','KG','Outros',3.5,29.3,7,15), (16,'Peixe','KG','Carne',20,14,7,20), (17,'Queijo','KG','Tempero',12,25,20,50), (18,'Batata','KG','Outros',5.7,17,6,25), (19,'Leite','L','Outros',4.5,6.4,15,30); /*!40000 ALTER TABLE `ingrediente` ENABLE KEYS */; -- -- Definition of table `lote` -- DROP TABLE IF EXISTS `lote`; CREATE TABLE `lote` ( `Numero_lot` int(10) unsigned NOT NULL, `QuantidadeInicial_lot` float NOT NULL DEFAULT '0', `QuantidadeAtual_lot` float NOT NULL DEFAULT '0', `Validade_lot` varchar(10) NOT NULL, `Produto_lot` int(10) unsigned NOT NULL, PRIMARY KEY (`Numero_lot`), KEY `FK_Lote_1` (`Produto_lot`), CONSTRAINT `FK_Lote_1` FOREIGN KEY (`Produto_lot`) REFERENCES `ingrediente` (`ID_ing`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='Tabela que guarda os lotes dos ing'; -- -- Dumping data for table `lote` -- /*!40000 ALTER TABLE `lote` DISABLE KEYS */; INSERT INTO `lote` (`Numero_lot`,`QuantidadeInicial_lot`,`QuantidadeAtual_lot`,`Validade_lot`,`Produto_lot`) VALUES (11,10,2.2,'2015-11-23',1), (12,8,8,'2016-06-06',1), (23,50,5,'2016-02-12',2), (31,5,2.8,'2016-06-06',3), (41,6,1.5,'2015-12-21',4), (42,10,10,'2015-11-21',4), (51,10,10,'2015-05-12',5), (52,9,2,'2016-01-06',5), (61,11,8,'2016-06-19',6), (71,12,6,'2015-12-05',7), (81,5,5,'2015-03-12',8), (82,10,6.6,'2015-12-25',8), (91,100,72,'2015-11-28',9), (101,8,8,'2015-06-07',10), (102,12,10,'2016-03-03',10), (111,9,8.4,'2015-12-21',11), (121,50,45,'2016-01-04',12), (122,3,3,'2015-09-08',12), (131,20,15.2,'2015-11-30',13), (132,20,20,'2016-01-04',13), (141,20,10.61,'2016-06-21',14), (142,6,6,'2015-12-02',14), (151,9.7,8.3,'2015-11-25',15), (152,21,21,'2016-12-21',15), (161,9,9,'2015-06-13',16), (162,20,5,'2015-12-20',16), (171,32,25,'2016-01-07',17), (181,21,17,'2015-12-05',18), (191,10,6.4,'2015-12-08',19); /*!40000 ALTER TABLE `lote` ENABLE KEYS */; -- -- Definition of table `pedido` -- DROP TABLE IF EXISTS `pedido`; CREATE TABLE `pedido` ( `ID_ped` int(11) NOT NULL DEFAULT '0', `NomeCliente_ped` varchar(45) NOT NULL, `FormaPagamento_ped` varchar(45) NOT NULL, `Data_ped` varchar(20) NOT NULL DEFAULT '0', `Telefone_ped` varchar(9) NOT NULL, `Senha_ped` varchar(45) NOT NULL, `ValorTotal_ped` float NOT NULL, `Entregador_ped` int(11) NOT NULL DEFAULT '0', `TempoEntrega_ped` varchar(10) NOT NULL DEFAULT '0', `E_Municipio_ped` varchar(45) NOT NULL, `E_Bairro_ped` varchar(45) NOT NULL, `E_Rua_ped` varchar(45) NOT NULL, `E_CasaNumero_ped` int(10) unsigned NOT NULL, `Status_ped` varchar(45) NOT NULL, PRIMARY KEY (`ID_ped`), KEY `FK_pedido_1` (`Entregador_ped`), CONSTRAINT `FK_pedido_1` FOREIGN KEY (`Entregador_ped`) REFERENCES `entregador` (`ID_ent`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='pedido dos cara'; -- -- Dumping data for table `pedido` -- /*!40000 ALTER TABLE `pedido` DISABLE KEYS */; INSERT INTO `pedido` (`ID_ped`,`NomeCliente_ped`,`FormaPagamento_ped`,`Data_ped`,`Telefone_ped`,`Senha_ped`,`ValorTotal_ped`,`Entregador_ped`,`TempoEntrega_ped`,`E_Municipio_ped`,`E_Bairro_ped`,`E_Rua_ped`,`E_CasaNumero_ped`,`Status_ped`) VALUES (1,'The Doctor','Allons-y!','08/11/2015 07:29:41','4221-1052','628279',69.5,2,'0','Zona Norte','Valloran','Rua das Moscas',34,'Em andamento'), (2,'Lalla Ward','Dinheiro','08/11/2015 07:39:07','9876-5434','6420843',65.7,5,'0','Belford Roxo','Gallifrey','Alto Comando de Gallifrey',56,'Em andamento'), (3,'John Lennon','Dinheiro','08/11/2015 07:42:20','4242-3535','473755',110.89,1,'0','Nova Iguaçu','Strawberry Fields','Forever',21,'Em andamento'), (4,'Paul McCartney','Allons-y!','08/11/2015 07:54:37','1213-9548','2800620',154.95,5,'0','São João','Penny Lane','Martha',56,'Em andamento'), (5,'Ringo Starr','Cartão','08/11/2015 08:01:24','2121-2122','8608218',91.78,4,'0','Belford Roxo','Blue Jay Way','Good Day Sunshine',54,'Em andamento'), (6,'George Harrison','Dinheiro','08/11/2015 08:03:30','1205-4345','3511841',44.56,7,'0','Queimados','Revolver','Tomorrow Never Knows',23,'Em andamento'), (7,'Yoko Ono','Allons-y!','08/11/2015 08:08:23','1223-2232','21650',120.06,6,'0','Belford Roxo','Bungalow Bill','What did you kill?',56,'Em andamento'); INSERT INTO `pedido` (`ID_ped`,`NomeCliente_ped`,`FormaPagamento_ped`,`Data_ped`,`Telefone_ped`,`Senha_ped`,`ValorTotal_ped`,`Entregador_ped`,`TempoEntrega_ped`,`E_Municipio_ped`,`E_Bairro_ped`,`E_Rua_ped`,`E_CasaNumero_ped`,`Status_ped`) VALUES (8,'Harry Potter','Ticket','08/11/2015 08:09:02','2435-4445','1848719',83.22,4,'0','São João','Hogwarts','Câmara Secreta',57,'Em andamento'), (9,'Hermione Granger','Allons-y!','08/11/2015 08:11:38','2323-2444','4626776',45.89,3,'02:43:27','Belford Roxo','Londres','Sangue Ruim',34,'Concluído'), (10,'Ronald Weasley','Ticket','08/11/2015 08:14:13','2323-1444','9623062',55.5,6,'0','Zona Norte','Acre','Lugar Nenhum',0,'Em andamento'), (11,'Henry VIII','Cartão','08/11/2015 09:54:25','1212-2332','3760709',98.8,1,'0','Zona Norte','Inglaterra 1500','Tudor',21,'Em andamento'), (12,'Edward I','Allons-y!','08/11/2015 09:56:30','1223-2323','274425',51.5,1,'01:00:53','Belford Roxo','Alga Azul','Coral',900,'Concluído'), (13,'Mary I','Dinheiro','08/11/2015 10:00:10','1237-5999','7334070',30.7,3,'0','Belford Roxo','Plutão','Terra',76,'Em andamento'), (14,'Elizabeth I','Ticket','08/11/2015 10:06:42','4545-5444','8623245',47.8,6,'0','Belford Roxo','Gallifrey Falls','No More',5,'Em andamento'); INSERT INTO `pedido` (`ID_ped`,`NomeCliente_ped`,`FormaPagamento_ped`,`Data_ped`,`Telefone_ped`,`Senha_ped`,`ValorTotal_ped`,`Entregador_ped`,`TempoEntrega_ped`,`E_Municipio_ped`,`E_Bairro_ped`,`E_Rua_ped`,`E_CasaNumero_ped`,`Status_ped`) VALUES (15,'Romana','Ticket','08/11/2015 10:09:44','2324-2555','4184428',79.66,7,'0','Zona Norte','O verso do inverso','Triens ben assemble',12,'Em andamento'), (16,'Sandro','Dinheiro','08/11/2015 10:11:12','8680-3777','6745569',172.19,5,'0','Zona Norte','Méier','Capitão Rezende',408,'Em andamento'), (17,'George Harrison','Dinheiro','08/11/2015 10:29:48','2122-1212','3184943',67.68,2,'0','Belford Roxo','Savoy Truflle','Cream Tangerine',43,'Em andamento'); /*!40000 ALTER TABLE `pedido` ENABLE KEYS */; -- -- Definition of table `pedido_prato` -- DROP TABLE IF EXISTS `pedido_prato`; CREATE TABLE `pedido_prato` ( `ID_ppr` int(10) unsigned NOT NULL AUTO_INCREMENT, `Pedido_ppr` int(11) NOT NULL DEFAULT '0', `Prato_ppr` int(10) unsigned NOT NULL, PRIMARY KEY (`ID_ppr`), KEY `FK_pedido_pratos_1` (`Pedido_ppr`), KEY `FK_pedido_pratos_2` (`Prato_ppr`), CONSTRAINT `FK_pedido_pratos_2` FOREIGN KEY (`Prato_ppr`) REFERENCES `prato` (`ID_pra`), CONSTRAINT `FK_pedido_pratos_1` FOREIGN KEY (`Pedido_ppr`) REFERENCES `pedido` (`ID_ped`) ) ENGINE=InnoDB AUTO_INCREMENT=59 DEFAULT CHARSET=latin1; -- -- Dumping data for table `pedido_prato` -- /*!40000 ALTER TABLE `pedido_prato` DISABLE KEYS */; INSERT INTO `pedido_prato` (`ID_ppr`,`Pedido_ppr`,`Prato_ppr`) VALUES (16,1,11), (17,1,5), (18,2,5), (19,2,3), (20,2,12), (21,3,4), (22,3,7), (23,4,1), (24,4,3), (25,4,11), (26,4,7), (27,5,7), (28,5,7), (29,6,5), (30,6,8), (31,7,10), (32,7,3), (33,7,1), (34,8,8), (35,8,2), (36,8,1), (37,9,7), (38,10,9), (39,10,11), (40,11,12), (41,11,9), (42,11,4), (43,12,11), (44,12,2), (45,13,3), (46,13,12), (47,14,12), (48,14,5), (49,15,6), (50,15,1), (51,16,5), (52,16,11), (53,16,9), (54,16,6), (55,16,7), (56,16,12), (57,17,7), (58,17,13); /*!40000 ALTER TABLE `pedido_prato` ENABLE KEYS */; -- -- Definition of table `prato` -- DROP TABLE IF EXISTS `prato`; CREATE TABLE `prato` ( `ID_pra` int(10) unsigned NOT NULL, `Nome_pra` varchar(60) NOT NULL, `FotoURL_pra` varchar(150) NOT NULL DEFAULT '0', `Preco_pra` float NOT NULL, `ModoPreparo_pra` varchar(300) NOT NULL, `Secao_pra` varchar(45) NOT NULL, `Calorias_pra` float NOT NULL DEFAULT '0', PRIMARY KEY (`ID_pra`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `prato` -- /*!40000 ALTER TABLE `prato` DISABLE KEYS */; INSERT INTO `prato` (`ID_pra`,`Nome_pra`,`FotoURL_pra`,`Preco_pra`,`ModoPreparo_pra`,`Secao_pra`,`Calorias_pra`) VALUES (1,'Carré','0',56.66,'Coloque a carne de porco na frigideira e espera ela ficar frita.','Carne',0), (2,'Frango Frito','0',17,'Fritar as asas de frango.','Entrada',0), (3,'Espaguete','0',17.9,'Pega o macarrão coloca em uma panela com água fervendo e em teroria vira uma macarronada deliciosa.','Massa',0), (4,'Carne Assada','0',65,'Assar a carne no forno com os tempero.','Carne',0), (5,'Peixe Frito','0',35,'Pega o peixe e frita.','Carne',0), (6,'Figado Assado','0',23,'Pega o figado e coloca ele no forno espera um tempo que ele fica comestivel.','Entrada',0), (7,'Bolo de Limão','0',45.89,'Pega a farinha de trigo e joga ela junto com o limão no forno caso tudo dê certo vc tera bolo de limão;','Sobremesa',0), (8,'Aneis de Cebola','0',9.56,'Corte a cebola em partes, então frite-as.','Sobremesa',0), (9,'Feijão','0',21,'Um feijão com coisas sortidas dentro.','Entrada',0), (10,'Pizza de Frango','0',45.5,'Coloque a pizza dentro do forno com o frango, depois de alguns minituos ela deve virar uma pizza.','Massa',0); INSERT INTO `prato` (`ID_pra`,`Nome_pra`,`FotoURL_pra`,`Preco_pra`,`ModoPreparo_pra`,`Secao_pra`,`Calorias_pra`) VALUES (11,'Arroz Premium','0',34.5,'Coloque todo o arroz em uma panela folhada a ouro e diga que é premium.','Entrada',0), (12,'Batata Frita','0',12.8,'Fritar batata -','Entrada',0), (13,'Sorvete de Limão','0',21.79,'Pega o leite e o limão coloca no congelador e observa se vira sorvete.','Sobremesa',0); /*!40000 ALTER TABLE `prato` ENABLE KEYS */; -- -- Definition of table `prato_ingrediente` -- DROP TABLE IF EXISTS `prato_ingrediente`; CREATE TABLE `prato_ingrediente` ( `Prato_pin` int(10) unsigned NOT NULL, `Ingrediente_pin` int(10) unsigned NOT NULL, `Quantidade_pin` float NOT NULL DEFAULT '0', PRIMARY KEY (`Prato_pin`,`Ingrediente_pin`), KEY `FK_Prato_Ingrediente_2` (`Ingrediente_pin`), CONSTRAINT `FK_Prato_Ingrediente_1` FOREIGN KEY (`Prato_pin`) REFERENCES `prato` (`ID_pra`), CONSTRAINT `FK_Prato_Ingrediente_2` FOREIGN KEY (`Ingrediente_pin`) REFERENCES `ingrediente` (`ID_ing`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `prato_ingrediente` -- /*!40000 ALTER TABLE `prato_ingrediente` DISABLE KEYS */; INSERT INTO `prato_ingrediente` (`Prato_pin`,`Ingrediente_pin`,`Quantidade_pin`) VALUES (1,1,1.2), (1,2,5), (1,3,0.4), (2,2,4), (2,3,0.5), (2,7,3), (3,6,3), (3,8,0.7), (3,9,2), (4,4,0.3), (4,5,2), (4,9,2), (5,3,0.3), (5,11,0.12), (5,16,3), (6,8,0.3), (6,9,3), (6,10,1), (7,2,4), (7,14,1.2), (8,3,0.4), (8,4,0.7), (8,15,0.7), (9,1,1), (9,5,1), (9,13,1.6), (10,4,1), (10,6,1), (10,14,0.99), (10,17,3), (11,4,0.3), (11,9,2), (11,12,1), (11,17,0.8), (12,3,0.4), (12,18,0.8), (13,2,10), (13,19,3.6); /*!40000 ALTER TABLE `prato_ingrediente` ENABLE KEYS */; -- -- Definition of table `venda` -- DROP TABLE IF EXISTS `venda`; CREATE TABLE `venda` ( `Numero_ven` int(5) NOT NULL AUTO_INCREMENT, `Data_ven` varchar(20) DEFAULT NULL, `Preco_ven` float DEFAULT NULL, `Entregador_ven` int(11) DEFAULT NULL, PRIMARY KEY (`Numero_ven`), KEY `Entregador_ven` (`Entregador_ven`), CONSTRAINT `venda_ibfk_1` FOREIGN KEY (`Entregador_ven`) REFERENCES `entregador` (`ID_ent`) ) ENGINE=InnoDB AUTO_INCREMENT=44 DEFAULT CHARSET=latin1; -- -- Dumping data for table `venda` -- /*!40000 ALTER TABLE `venda` DISABLE KEYS */; INSERT INTO `venda` (`Numero_ven`,`Data_ven`,`Preco_ven`,`Entregador_ven`) VALUES (13,'08/11/2015 10:55:05',45.89,3), (14,'08/11/2015 10:57:23',51.5,1), (15,'08/11/2015 12:58:30',122.75,2), (16,'08/12/2015 09:23:21',23.59,2), (17,'08/04/2015 13:00:42',56,5), (18,'08/02/2015 18:30:12',56,1), (19,'12/03/2015 20:45:31',76.89,6), (20,'21/04/2015 07:43:23',120.89,4), (21,'27/03/2015 10:12:32',79.9,5), (22,'07/05/2015 15:45:34',64.7,2), (23,'07/07/2015 10:45:34',30.7,3), (24,'07/08/2015 11:45:34',66.7,2), (25,'17/11/2015 07:25:37',70.7,5), (26,'07/05/2015 17:54:45',90,3), (27,'08/01/2015 22:05:34',40.7,1), (28,'21/08/2015 08:00:34',166.7,5), (29,'19/06/2015 18:31:04',90.5,6), (30,'21/05/2015 12:55:34',89,3), (31,'31/07/2015 19:25:25',56.7,4), (32,'11/04/2015 12:53:53',78,6), (33,'17/01/2015 11:55:14',53,3), (34,'02/09/2015 18:23:43',78,5), (35,'28/10/2015 08:25:37',23.7,6), (36,'23/10/2015 13:54:45',98,4), (37,'12/10/2015 23:05:34',76,2), (38,'06/04/2015 21:06:23',73.8,5), (39,'16/12/2015 12:09:12',98,1); INSERT INTO `venda` (`Numero_ven`,`Data_ven`,`Preco_ven`,`Entregador_ven`) VALUES (40,'01/01/2015 15:12:34',66.8,2), (41,'06/03/2015 09:12:21 ',104.5,3), (42,'21/04/2015 10:11:23',65,4), (43,'30/03/2015 11:23:11',37.7,5); /*!40000 ALTER TABLE `venda` ENABLE KEYS */; /*!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 */; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
true
739a8c27f1e152e79ce201a70c77ddc6cc0f0a22
SQL
danielrpg/POS
/db/pos.sql
UTF-8
23,895
3.0625
3
[]
no_license
/* Navicat MySQL Data Transfer Source Server : localhost Source Server Version : 50508 Source Host : localhost:3306 Source Database : pos Target Server Type : MYSQL Target Server Version : 50508 File Encoding : 65001 Date: 2013-09-09 16:44:45 */ SET FOREIGN_KEY_CHECKS=0; -- ---------------------------- -- Table structure for `ospos_app_config` -- ---------------------------- DROP TABLE IF EXISTS `ospos_app_config`; CREATE TABLE `ospos_app_config` ( `key` varchar(255) NOT NULL, `value` varchar(255) NOT NULL, PRIMARY KEY (`key`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- ---------------------------- -- Records of ospos_app_config -- ---------------------------- INSERT INTO `ospos_app_config` VALUES ('address', 'Calle valenzuela'); INSERT INTO `ospos_app_config` VALUES ('company', 'Point of Sale'); INSERT INTO `ospos_app_config` VALUES ('currency_symbol', 'Bs.'); INSERT INTO `ospos_app_config` VALUES ('default_tax_1_name', 'Entrega'); INSERT INTO `ospos_app_config` VALUES ('default_tax_1_rate', '2'); INSERT INTO `ospos_app_config` VALUES ('default_tax_2_name', 'Impuesto de Ventas 2'); INSERT INTO `ospos_app_config` VALUES ('default_tax_2_rate', ''); INSERT INTO `ospos_app_config` VALUES ('default_tax_rate', '8'); INSERT INTO `ospos_app_config` VALUES ('email', 'admin@pappastech.com'); INSERT INTO `ospos_app_config` VALUES ('fax', ''); INSERT INTO `ospos_app_config` VALUES ('language', 'spanish'); INSERT INTO `ospos_app_config` VALUES ('phone', '591 65755850'); INSERT INTO `ospos_app_config` VALUES ('print_after_sale', 'print_after_sale'); INSERT INTO `ospos_app_config` VALUES ('return_policy', 'Codigo de Seguridad'); INSERT INTO `ospos_app_config` VALUES ('timezone', 'America/La_Paz'); INSERT INTO `ospos_app_config` VALUES ('website', ''); -- ---------------------------- -- Table structure for `ospos_customers` -- ---------------------------- DROP TABLE IF EXISTS `ospos_customers`; CREATE TABLE `ospos_customers` ( `person_id` int(10) NOT NULL, `account_number` varchar(255) DEFAULT NULL, `taxable` int(1) NOT NULL DEFAULT '1', `deleted` int(1) NOT NULL DEFAULT '0', UNIQUE KEY `account_number` (`account_number`), KEY `person_id` (`person_id`), CONSTRAINT `ospos_customers_ibfk_1` FOREIGN KEY (`person_id`) REFERENCES `ospos_people` (`person_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- ---------------------------- -- Records of ospos_customers -- ---------------------------- -- ---------------------------- -- Table structure for `ospos_employees` -- ---------------------------- DROP TABLE IF EXISTS `ospos_employees`; CREATE TABLE `ospos_employees` ( `username` varchar(255) NOT NULL, `password` varchar(255) NOT NULL, `person_id` int(10) NOT NULL, `deleted` int(1) NOT NULL DEFAULT '0', UNIQUE KEY `username` (`username`), KEY `person_id` (`person_id`), CONSTRAINT `ospos_employees_ibfk_1` FOREIGN KEY (`person_id`) REFERENCES `ospos_people` (`person_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- ---------------------------- -- Records of ospos_employees -- ---------------------------- INSERT INTO `ospos_employees` VALUES ('admin', '439a6de57d475c1a0ba9bcb1c39f0af6', '1', '0'); -- ---------------------------- -- Table structure for `ospos_giftcards` -- ---------------------------- DROP TABLE IF EXISTS `ospos_giftcards`; CREATE TABLE `ospos_giftcards` ( `giftcard_id` int(11) NOT NULL AUTO_INCREMENT, `giftcard_number` varchar(25) COLLATE utf8_unicode_ci NOT NULL, `value` double(15,2) NOT NULL, `deleted` int(1) NOT NULL DEFAULT '0', PRIMARY KEY (`giftcard_id`), UNIQUE KEY `giftcard_number` (`giftcard_number`) ) ENGINE=InnoDB AUTO_INCREMENT=49 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- ---------------------------- -- Records of ospos_giftcards -- ---------------------------- INSERT INTO `ospos_giftcards` VALUES ('48', '566466122', '50.00', '0'); -- ---------------------------- -- Table structure for `ospos_inventory` -- ---------------------------- DROP TABLE IF EXISTS `ospos_inventory`; CREATE TABLE `ospos_inventory` ( `trans_id` int(11) NOT NULL AUTO_INCREMENT, `trans_items` int(11) NOT NULL DEFAULT '0', `trans_user` int(11) NOT NULL DEFAULT '0', `trans_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `trans_comment` text NOT NULL, `trans_inventory` int(11) NOT NULL DEFAULT '0', PRIMARY KEY (`trans_id`), KEY `ospos_inventory_ibfk_1` (`trans_items`), KEY `ospos_inventory_ibfk_2` (`trans_user`), CONSTRAINT `ospos_inventory_ibfk_1` FOREIGN KEY (`trans_items`) REFERENCES `ospos_items` (`item_id`), CONSTRAINT `ospos_inventory_ibfk_2` FOREIGN KEY (`trans_user`) REFERENCES `ospos_employees` (`person_id`) ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1; -- ---------------------------- -- Records of ospos_inventory -- ---------------------------- INSERT INTO `ospos_inventory` VALUES ('1', '1', '1', '2013-08-22 09:45:22', 'Edición Manual de Cantidad', '50'); INSERT INTO `ospos_inventory` VALUES ('2', '1', '1', '2013-08-22 09:46:50', 'Cajas en invetarios', '50'); INSERT INTO `ospos_inventory` VALUES ('3', '1', '1', '2013-08-22 09:51:57', 'POS 1', '-5'); INSERT INTO `ospos_inventory` VALUES ('4', '2', '1', '2013-08-22 09:56:06', 'Edición Manual de Cantidad', '1000'); -- ---------------------------- -- Table structure for `ospos_items` -- ---------------------------- DROP TABLE IF EXISTS `ospos_items`; CREATE TABLE `ospos_items` ( `name` varchar(255) NOT NULL, `category` varchar(255) NOT NULL, `supplier_id` int(11) DEFAULT NULL, `item_number` varchar(255) DEFAULT NULL, `description` varchar(255) NOT NULL, `cost_price` double(15,2) NOT NULL, `unit_price` double(15,2) NOT NULL, `quantity` double(15,2) NOT NULL DEFAULT '0.00', `reorder_level` double(15,2) NOT NULL DEFAULT '0.00', `location` varchar(255) NOT NULL, `item_id` int(10) NOT NULL AUTO_INCREMENT, `allow_alt_description` tinyint(1) NOT NULL, `is_serialized` tinyint(1) NOT NULL, `deleted` int(1) NOT NULL DEFAULT '0', PRIMARY KEY (`item_id`), UNIQUE KEY `item_number` (`item_number`), KEY `ospos_items_ibfk_1` (`supplier_id`), CONSTRAINT `ospos_items_ibfk_1` FOREIGN KEY (`supplier_id`) REFERENCES `ospos_suppliers` (`person_id`) ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1; -- ---------------------------- -- Records of ospos_items -- ---------------------------- INSERT INTO `ospos_items` VALUES ('Cuna Termica', 'CUNA', '2', '78989', 'Cuna termica', '200.00', '250.00', '95.00', '1.00', '78-LKJ', '1', '1', '1', '0'); INSERT INTO `ospos_items` VALUES ('cuna', 'CUNA', '2', '788897', 'lk-542315', '400.00', '350.00', '1000.00', '454.00', 'lk-9521', '2', '1', '1', '0'); -- ---------------------------- -- Table structure for `ospos_items_taxes` -- ---------------------------- DROP TABLE IF EXISTS `ospos_items_taxes`; CREATE TABLE `ospos_items_taxes` ( `item_id` int(10) NOT NULL, `name` varchar(255) NOT NULL, `percent` double(15,2) NOT NULL, PRIMARY KEY (`item_id`,`name`,`percent`), CONSTRAINT `ospos_items_taxes_ibfk_1` FOREIGN KEY (`item_id`) REFERENCES `ospos_items` (`item_id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- ---------------------------- -- Records of ospos_items_taxes -- ---------------------------- INSERT INTO `ospos_items_taxes` VALUES ('1', 'Entrega', '2.00'); INSERT INTO `ospos_items_taxes` VALUES ('2', 'Entrega', '2.00'); -- ---------------------------- -- Table structure for `ospos_item_kits` -- ---------------------------- DROP TABLE IF EXISTS `ospos_item_kits`; CREATE TABLE `ospos_item_kits` ( `item_kit_id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(255) NOT NULL, `description` varchar(255) NOT NULL, PRIMARY KEY (`item_kit_id`) ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1; -- ---------------------------- -- Records of ospos_item_kits -- ---------------------------- INSERT INTO `ospos_item_kits` VALUES ('1', 'CUNA TERMICA', 'cuna termica'); -- ---------------------------- -- Table structure for `ospos_item_kit_items` -- ---------------------------- DROP TABLE IF EXISTS `ospos_item_kit_items`; CREATE TABLE `ospos_item_kit_items` ( `item_kit_id` int(11) NOT NULL, `item_id` int(11) NOT NULL, `quantity` double(15,2) NOT NULL, PRIMARY KEY (`item_kit_id`,`item_id`,`quantity`), KEY `ospos_item_kit_items_ibfk_2` (`item_id`), CONSTRAINT `ospos_item_kit_items_ibfk_1` FOREIGN KEY (`item_kit_id`) REFERENCES `ospos_item_kits` (`item_kit_id`) ON DELETE CASCADE, CONSTRAINT `ospos_item_kit_items_ibfk_2` FOREIGN KEY (`item_id`) REFERENCES `ospos_items` (`item_id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- ---------------------------- -- Records of ospos_item_kit_items -- ---------------------------- INSERT INTO `ospos_item_kit_items` VALUES ('1', '1', '5.00'); -- ---------------------------- -- Table structure for `ospos_modules` -- ---------------------------- DROP TABLE IF EXISTS `ospos_modules`; CREATE TABLE `ospos_modules` ( `name_lang_key` varchar(255) NOT NULL, `desc_lang_key` varchar(255) NOT NULL, `sort` int(10) NOT NULL, `module_id` varchar(255) NOT NULL, PRIMARY KEY (`module_id`), UNIQUE KEY `desc_lang_key` (`desc_lang_key`), UNIQUE KEY `name_lang_key` (`name_lang_key`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- ---------------------------- -- Records of ospos_modules -- ---------------------------- INSERT INTO `ospos_modules` VALUES ('module_config', 'module_config_desc', '100', 'config'); INSERT INTO `ospos_modules` VALUES ('module_customers', 'module_customers_desc', '10', 'customers'); INSERT INTO `ospos_modules` VALUES ('module_employees', 'module_employees_desc', '80', 'employees'); INSERT INTO `ospos_modules` VALUES ('module_giftcards', 'module_giftcards_desc', '90', 'giftcards'); INSERT INTO `ospos_modules` VALUES ('module_items', 'module_items_desc', '20', 'items'); INSERT INTO `ospos_modules` VALUES ('module_item_kits', 'module_item_kits_desc', '30', 'item_kits'); INSERT INTO `ospos_modules` VALUES ('module_receivings', 'module_receivings_desc', '60', 'receivings'); INSERT INTO `ospos_modules` VALUES ('module_reports', 'module_reports_desc', '50', 'reports'); INSERT INTO `ospos_modules` VALUES ('module_sales', 'module_sales_desc', '70', 'sales'); INSERT INTO `ospos_modules` VALUES ('module_suppliers', 'module_suppliers_desc', '40', 'suppliers'); -- ---------------------------- -- Table structure for `ospos_people` -- ---------------------------- DROP TABLE IF EXISTS `ospos_people`; CREATE TABLE `ospos_people` ( `first_name` varchar(255) NOT NULL, `last_name` varchar(255) NOT NULL, `phone_number` varchar(255) NOT NULL, `email` varchar(255) NOT NULL, `address_1` varchar(255) NOT NULL, `address_2` varchar(255) NOT NULL, `city` varchar(255) NOT NULL, `state` varchar(255) NOT NULL, `zip` varchar(255) NOT NULL, `country` varchar(255) NOT NULL, `comments` text NOT NULL, `person_id` int(10) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`person_id`) ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1; -- ---------------------------- -- Records of ospos_people -- ---------------------------- INSERT INTO `ospos_people` VALUES ('John', 'Doe', '555-555-5555', 'admin@pappastech.com', 'Address 1', '', '', '', '', '', '', '1'); INSERT INTO `ospos_people` VALUES ('GIMA', 'GIMA SRL', '5613321551', 'gima@gmail.com', 'Calle garcialzao de la vega # 445556', '', 'Cochabamba', 'Cercado', '51002', 'Bolivia', 'Gima SRL', '2'); -- ---------------------------- -- Table structure for `ospos_permissions` -- ---------------------------- DROP TABLE IF EXISTS `ospos_permissions`; CREATE TABLE `ospos_permissions` ( `module_id` varchar(255) NOT NULL, `person_id` int(10) NOT NULL, PRIMARY KEY (`module_id`,`person_id`), KEY `person_id` (`person_id`), CONSTRAINT `ospos_permissions_ibfk_1` FOREIGN KEY (`person_id`) REFERENCES `ospos_employees` (`person_id`), CONSTRAINT `ospos_permissions_ibfk_2` FOREIGN KEY (`module_id`) REFERENCES `ospos_modules` (`module_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- ---------------------------- -- Records of ospos_permissions -- ---------------------------- INSERT INTO `ospos_permissions` VALUES ('config', '1'); INSERT INTO `ospos_permissions` VALUES ('customers', '1'); INSERT INTO `ospos_permissions` VALUES ('employees', '1'); INSERT INTO `ospos_permissions` VALUES ('giftcards', '1'); INSERT INTO `ospos_permissions` VALUES ('items', '1'); INSERT INTO `ospos_permissions` VALUES ('item_kits', '1'); INSERT INTO `ospos_permissions` VALUES ('receivings', '1'); INSERT INTO `ospos_permissions` VALUES ('reports', '1'); INSERT INTO `ospos_permissions` VALUES ('sales', '1'); INSERT INTO `ospos_permissions` VALUES ('suppliers', '1'); -- ---------------------------- -- Table structure for `ospos_receivings` -- ---------------------------- DROP TABLE IF EXISTS `ospos_receivings`; CREATE TABLE `ospos_receivings` ( `receiving_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `supplier_id` int(10) DEFAULT NULL, `employee_id` int(10) NOT NULL DEFAULT '0', `comment` text NOT NULL, `receiving_id` int(10) NOT NULL AUTO_INCREMENT, `payment_type` varchar(20) DEFAULT NULL, PRIMARY KEY (`receiving_id`), KEY `supplier_id` (`supplier_id`), KEY `employee_id` (`employee_id`), CONSTRAINT `ospos_receivings_ibfk_1` FOREIGN KEY (`employee_id`) REFERENCES `ospos_employees` (`person_id`), CONSTRAINT `ospos_receivings_ibfk_2` FOREIGN KEY (`supplier_id`) REFERENCES `ospos_suppliers` (`person_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- ---------------------------- -- Records of ospos_receivings -- ---------------------------- -- ---------------------------- -- Table structure for `ospos_receivings_items` -- ---------------------------- DROP TABLE IF EXISTS `ospos_receivings_items`; CREATE TABLE `ospos_receivings_items` ( `receiving_id` int(10) NOT NULL DEFAULT '0', `item_id` int(10) NOT NULL DEFAULT '0', `description` varchar(30) DEFAULT NULL, `serialnumber` varchar(30) DEFAULT NULL, `line` int(3) NOT NULL, `quantity_purchased` int(10) NOT NULL DEFAULT '0', `item_cost_price` decimal(15,2) NOT NULL, `item_unit_price` double(15,2) NOT NULL, `discount_percent` int(11) NOT NULL DEFAULT '0', PRIMARY KEY (`receiving_id`,`item_id`,`line`), KEY `item_id` (`item_id`), CONSTRAINT `ospos_receivings_items_ibfk_1` FOREIGN KEY (`item_id`) REFERENCES `ospos_items` (`item_id`), CONSTRAINT `ospos_receivings_items_ibfk_2` FOREIGN KEY (`receiving_id`) REFERENCES `ospos_receivings` (`receiving_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- ---------------------------- -- Records of ospos_receivings_items -- ---------------------------- -- ---------------------------- -- Table structure for `ospos_sales` -- ---------------------------- DROP TABLE IF EXISTS `ospos_sales`; CREATE TABLE `ospos_sales` ( `sale_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `customer_id` int(10) DEFAULT NULL, `employee_id` int(10) NOT NULL DEFAULT '0', `comment` text NOT NULL, `sale_id` int(10) NOT NULL AUTO_INCREMENT, `payment_type` varchar(512) DEFAULT NULL, PRIMARY KEY (`sale_id`), KEY `customer_id` (`customer_id`), KEY `employee_id` (`employee_id`), CONSTRAINT `ospos_sales_ibfk_1` FOREIGN KEY (`employee_id`) REFERENCES `ospos_employees` (`person_id`), CONSTRAINT `ospos_sales_ibfk_2` FOREIGN KEY (`customer_id`) REFERENCES `ospos_customers` (`person_id`) ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1; -- ---------------------------- -- Records of ospos_sales -- ---------------------------- INSERT INTO `ospos_sales` VALUES ('2013-08-22 09:51:56', null, '1', '0', '1', 'Efectivo: Bs.-1249.50<br />'); -- ---------------------------- -- Table structure for `ospos_sales_items` -- ---------------------------- DROP TABLE IF EXISTS `ospos_sales_items`; CREATE TABLE `ospos_sales_items` ( `sale_id` int(10) NOT NULL DEFAULT '0', `item_id` int(10) NOT NULL DEFAULT '0', `description` varchar(30) DEFAULT NULL, `serialnumber` varchar(30) DEFAULT NULL, `line` int(3) NOT NULL DEFAULT '0', `quantity_purchased` double(15,2) NOT NULL DEFAULT '0.00', `item_cost_price` decimal(15,2) NOT NULL, `item_unit_price` double(15,2) NOT NULL, `discount_percent` int(11) NOT NULL DEFAULT '0', PRIMARY KEY (`sale_id`,`item_id`,`line`), KEY `item_id` (`item_id`), CONSTRAINT `ospos_sales_items_ibfk_1` FOREIGN KEY (`item_id`) REFERENCES `ospos_items` (`item_id`), CONSTRAINT `ospos_sales_items_ibfk_2` FOREIGN KEY (`sale_id`) REFERENCES `ospos_sales` (`sale_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- ---------------------------- -- Records of ospos_sales_items -- ---------------------------- INSERT INTO `ospos_sales_items` VALUES ('1', '1', 'Cuna termica', '', '1', '5.00', '200.00', '250.00', '2'); -- ---------------------------- -- Table structure for `ospos_sales_items_taxes` -- ---------------------------- DROP TABLE IF EXISTS `ospos_sales_items_taxes`; CREATE TABLE `ospos_sales_items_taxes` ( `sale_id` int(10) NOT NULL, `item_id` int(10) NOT NULL, `line` int(3) NOT NULL DEFAULT '0', `name` varchar(255) NOT NULL, `percent` double(15,2) NOT NULL, PRIMARY KEY (`sale_id`,`item_id`,`line`,`name`,`percent`), KEY `item_id` (`item_id`), CONSTRAINT `ospos_sales_items_taxes_ibfk_1` FOREIGN KEY (`sale_id`) REFERENCES `ospos_sales_items` (`sale_id`), CONSTRAINT `ospos_sales_items_taxes_ibfk_2` FOREIGN KEY (`item_id`) REFERENCES `ospos_items` (`item_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- ---------------------------- -- Records of ospos_sales_items_taxes -- ---------------------------- INSERT INTO `ospos_sales_items_taxes` VALUES ('1', '1', '1', 'Entrega', '2.00'); -- ---------------------------- -- Table structure for `ospos_sales_payments` -- ---------------------------- DROP TABLE IF EXISTS `ospos_sales_payments`; CREATE TABLE `ospos_sales_payments` ( `sale_id` int(10) NOT NULL, `payment_type` varchar(40) NOT NULL, `payment_amount` decimal(15,2) NOT NULL, PRIMARY KEY (`sale_id`,`payment_type`), CONSTRAINT `ospos_sales_payments_ibfk_1` FOREIGN KEY (`sale_id`) REFERENCES `ospos_sales` (`sale_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- ---------------------------- -- Records of ospos_sales_payments -- ---------------------------- INSERT INTO `ospos_sales_payments` VALUES ('1', 'Efectivo', '1249.50'); -- ---------------------------- -- Table structure for `ospos_sales_suspended` -- ---------------------------- DROP TABLE IF EXISTS `ospos_sales_suspended`; CREATE TABLE `ospos_sales_suspended` ( `sale_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `customer_id` int(10) DEFAULT NULL, `employee_id` int(10) NOT NULL DEFAULT '0', `comment` text NOT NULL, `sale_id` int(10) NOT NULL AUTO_INCREMENT, `payment_type` varchar(512) DEFAULT NULL, PRIMARY KEY (`sale_id`), KEY `customer_id` (`customer_id`), KEY `employee_id` (`employee_id`), CONSTRAINT `ospos_sales_suspended_ibfk_1` FOREIGN KEY (`employee_id`) REFERENCES `ospos_employees` (`person_id`), CONSTRAINT `ospos_sales_suspended_ibfk_2` FOREIGN KEY (`customer_id`) REFERENCES `ospos_customers` (`person_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- ---------------------------- -- Records of ospos_sales_suspended -- ---------------------------- -- ---------------------------- -- Table structure for `ospos_sales_suspended_items` -- ---------------------------- DROP TABLE IF EXISTS `ospos_sales_suspended_items`; CREATE TABLE `ospos_sales_suspended_items` ( `sale_id` int(10) NOT NULL DEFAULT '0', `item_id` int(10) NOT NULL DEFAULT '0', `description` varchar(30) DEFAULT NULL, `serialnumber` varchar(30) DEFAULT NULL, `line` int(3) NOT NULL DEFAULT '0', `quantity_purchased` double(15,2) NOT NULL DEFAULT '0.00', `item_cost_price` decimal(15,2) NOT NULL, `item_unit_price` double(15,2) NOT NULL, `discount_percent` int(11) NOT NULL DEFAULT '0', PRIMARY KEY (`sale_id`,`item_id`,`line`), KEY `item_id` (`item_id`), CONSTRAINT `ospos_sales_suspended_items_ibfk_1` FOREIGN KEY (`item_id`) REFERENCES `ospos_items` (`item_id`), CONSTRAINT `ospos_sales_suspended_items_ibfk_2` FOREIGN KEY (`sale_id`) REFERENCES `ospos_sales_suspended` (`sale_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- ---------------------------- -- Records of ospos_sales_suspended_items -- ---------------------------- -- ---------------------------- -- Table structure for `ospos_sales_suspended_items_taxes` -- ---------------------------- DROP TABLE IF EXISTS `ospos_sales_suspended_items_taxes`; CREATE TABLE `ospos_sales_suspended_items_taxes` ( `sale_id` int(10) NOT NULL, `item_id` int(10) NOT NULL, `line` int(3) NOT NULL DEFAULT '0', `name` varchar(255) NOT NULL, `percent` double(15,2) NOT NULL, PRIMARY KEY (`sale_id`,`item_id`,`line`,`name`,`percent`), KEY `item_id` (`item_id`), CONSTRAINT `ospos_sales_suspended_items_taxes_ibfk_1` FOREIGN KEY (`sale_id`) REFERENCES `ospos_sales_suspended_items` (`sale_id`), CONSTRAINT `ospos_sales_suspended_items_taxes_ibfk_2` FOREIGN KEY (`item_id`) REFERENCES `ospos_items` (`item_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- ---------------------------- -- Records of ospos_sales_suspended_items_taxes -- ---------------------------- -- ---------------------------- -- Table structure for `ospos_sales_suspended_payments` -- ---------------------------- DROP TABLE IF EXISTS `ospos_sales_suspended_payments`; CREATE TABLE `ospos_sales_suspended_payments` ( `sale_id` int(10) NOT NULL, `payment_type` varchar(40) NOT NULL, `payment_amount` decimal(15,2) NOT NULL, PRIMARY KEY (`sale_id`,`payment_type`), CONSTRAINT `ospos_sales_suspended_payments_ibfk_1` FOREIGN KEY (`sale_id`) REFERENCES `ospos_sales_suspended` (`sale_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- ---------------------------- -- Records of ospos_sales_suspended_payments -- ---------------------------- -- ---------------------------- -- Table structure for `ospos_sessions` -- ---------------------------- DROP TABLE IF EXISTS `ospos_sessions`; CREATE TABLE `ospos_sessions` ( `session_id` varchar(40) NOT NULL DEFAULT '0', `ip_address` varchar(16) NOT NULL DEFAULT '0', `user_agent` varchar(50) NOT NULL, `last_activity` int(10) unsigned NOT NULL DEFAULT '0', `user_data` text, PRIMARY KEY (`session_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- ---------------------------- -- Records of ospos_sessions -- ---------------------------- INSERT INTO `ospos_sessions` VALUES ('123cd2c1634e4a0a08bc89ba45c5a654', '127.0.0.1', 'Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/53', '1378756232', 'a:8:{s:9:\"person_id\";s:1:\"1\";s:8:\"cartRecv\";a:0:{}s:9:\"recv_mode\";s:7:\"receive\";s:8:\"supplier\";s:2:\"-1\";s:4:\"cart\";a:0:{}s:9:\"sale_mode\";s:4:\"sale\";s:8:\"customer\";s:2:\"-1\";s:8:\"payments\";a:0:{}}'); INSERT INTO `ospos_sessions` VALUES ('88bc5b1f25e5065b66c2941203bad0e4', '127.0.0.1', 'Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/53', '1377181972', 'a:8:{s:9:\"person_id\";s:1:\"1\";s:4:\"cart\";a:0:{}s:9:\"sale_mode\";s:4:\"sale\";s:8:\"customer\";s:2:\"-1\";s:8:\"payments\";a:0:{}s:8:\"cartRecv\";a:0:{}s:9:\"recv_mode\";s:7:\"receive\";s:8:\"supplier\";s:2:\"-1\";}'); -- ---------------------------- -- Table structure for `ospos_suppliers` -- ---------------------------- DROP TABLE IF EXISTS `ospos_suppliers`; CREATE TABLE `ospos_suppliers` ( `person_id` int(10) NOT NULL, `company_name` varchar(255) NOT NULL, `account_number` varchar(255) DEFAULT NULL, `deleted` int(1) NOT NULL DEFAULT '0', UNIQUE KEY `account_number` (`account_number`), KEY `person_id` (`person_id`), CONSTRAINT `ospos_suppliers_ibfk_1` FOREIGN KEY (`person_id`) REFERENCES `ospos_people` (`person_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- ---------------------------- -- Records of ospos_suppliers -- ---------------------------- INSERT INTO `ospos_suppliers` VALUES ('2', 'GIMA', '4566541233', '0');
true
f26eec6b6ecfc50b081d43fa83650acb4a7acda1
SQL
BgeeDB/bgee_pipeline
/pipeline/download_files/insert_download_file_info.sql
UTF-8
5,930
3.171875
3
[ "CC0-1.0" ]
permissive
-- TODO enable multispecies groups when necessary -- TODO fix insertion of download files -- query to get the single species data groups for easier generation of this file: SELECT speciesDisplayOrder, IF(speciesCommonName IS NOT NULL AND speciesCommonName != '', speciesCommonName, CONCAT(genus, ' ', species)), speciesDisplayOrder FROM species ORDER BY speciesDisplayOrder; -- query to get member of a given taxon, to help build the multi-species groups SELECT t3.* from taxon as t1 inner join taxon as t2 ON t2.taxonLeftBound >= t1.taxonLeftBound AND t2.taxonRightBound <= t1.taxonRightBound INNER JOIN species AS t3 on t3.taxonId = t2.taxonId WHERE t1.taxonId = 1437010; DELETE FROM downloadFile; DELETE from speciesDataGroup; INSERT INTO speciesDataGroup (speciesDataGroupId, speciesDataGroupName, speciesDataGroupDescription, speciesDataGroupOrder) VALUES -- single-species data groups (1, 'human', NULL, 1), (2, 'mouse', NULL, 2), (3, 'zebrafish', NULL, 3), (4, 'fruit fly', NULL, 4), (5, 'nematode', NULL, 5), (6, 'dog', NULL, 6), (7, 'cat', NULL, 7), (8, 'horse', NULL, 8), (9, 'pig', NULL, 9), (10, 'cattle', NULL, 10), (11, 'Goat', NULL, 11), (12, 'Sheep', NULL, 12), (13, 'rabbit', NULL, 13), (14, 'guinea pig', NULL, 14), (15, 'chicken', NULL, 15), (16, 'Wild turkey', NULL, 16), (17, 'platypus', NULL, 17), (18, 'White-tufted-ear marmoset', NULL, 18), (19, 'Sooty mangabey', NULL, 19), (20, 'Crab-eating macaque', NULL, 20), (21, 'macaque', NULL, 21), (22, 'Pig-tailed macaque', NULL, 22), (23, 'Olive baboon', NULL, 23), (24, 'gorilla', NULL, 24), (25, 'bonobo', NULL, 25), (26, 'chimpanzee', NULL, 26), (27, 'Gray mouse lemur', NULL, 27), (28, 'Green monkey', NULL, 28), (29, 'Malayan pangolin', NULL, 29), (30, 'rat', NULL, 30), (31, 'Naked mole rat', NULL, 31), (32, 'opossum', NULL, 32), (33, 'African clawed frog', NULL, 33), (34, 'western clawed frog', NULL, 34), (35, 'green anole', NULL, 35), (36, 'Spotted gar', NULL, 36), (37, 'European freshwater eel', NULL, 37), (38, 'Blind cave fish', NULL, 38), (39, 'Northern pike', NULL, 39), (40, 'Atlantic salmon', NULL, 40), (41, 'Atlantic cod', NULL, 41), (42, 'Guppy', NULL, 42), (43, 'Japanese rice fish', NULL, 43), (44, 'Eastern happy', NULL, 44), (45, 'Fairy cichlid', NULL, 45), (46, 'Turbot', NULL, 46), (47, 'Three-spined stickleback', NULL, 47), (48, 'Turquoise killifish', NULL, 48), (49, 'Common lancelet', NULL, 49), (50, 'Coelacanth', NULL, 50), (51, 'Drosophila pseudoobscura', NULL, 51), (52, 'Drosophila simulans', NULL, 52); -- , -- multi-species data group -- (30, 'human/mouse', NULL, 30), -- (31, 'Primates', NULL, 31), -- (32, 'Rodentia', NULL, 32), -- (33, 'Theria', NULL, 33), -- (34, 'Mammalia', NULL, 34), -- (35, 'Amniota', NULL, 35), -- (36, 'Tetrapoda', NULL, 36), -- (37, 'Teleostomi', NULL, 37), -- -- (39, 'Drosophila (genus)', NULL, 38), -- worm + drosophila -- (40, 'Ecdysozoa', NULL, 39), -- -- hedgehog, dog, cat, horse, pig, cattle -- (38, 'Laurasiatheria', NULL, 40), -- (41, 'Livestock', NULL, 41), -- (42, 'Domestic animals', NULL, 42) ; INSERT INTO speciesToDataGroup (speciesDataGroupId, speciesId) VALUES -- single-species data groups (1, 9606), (2, 10090), (3, 7955), (4, 7227), (5, 6239), (6, 9615), (7, 9685), (8, 9796), (9, 9823), (10, 9913), (11, 9925), (12, 9940), (13, 9986), (14, 10141), (15, 9031), (16, 9103), (17, 9258), (18, 9483), (19, 9531), (20, 9541), (21, 9544), (22, 9545), (23, 9555), (24, 9593), (25, 9597), (26, 9598), (27, 30608), (28, 60711), (29, 9974), (30, 10116), (31, 10181), (32, 13616), (33, 8355), (34, 8364), (35, 28377), (36, 7918), (37, 7936), (38, 7994), (39, 8010), (40, 8030), (41, 8049), (42, 8081), (43, 8090), (44, 8154), (45, 32507), (46, 52904), (47, 69293), (48, 105023), (49, 7740), (50, 7897), (51, 7237), (52, 7240); -- , -- multi-species data groups -- (30, 9606), -- (30, 10090), -- -- (31, 9606), -- (31, 9598), -- (31, 9597), -- (31, 9593), -- (31, 9544), -- -- (32, 10090), -- (32, 10116), -- (32, 10141), -- -- (33, 9606), -- (33, 10090), -- (33, 9598), -- (33, 9597), -- (33, 9593), -- (33, 9544), -- (33, 10116), -- (33, 9913), -- (33, 9823), -- (33, 9796), -- (33, 9986), -- (33, 9615), -- (33, 9685), -- (33, 10141), -- (33, 9365), -- (33, 13616), -- -- (34, 9606), -- (34, 10090), -- (34, 9598), -- (34, 9597), -- (34, 9593), -- (34, 9544), -- (34, 10116), -- (34, 9913), -- (34, 9823), -- (34, 9796), -- (34, 9986), -- (34, 9615), -- (34, 9685), -- (34, 10141), -- (34, 9365), -- (34, 13616), -- (34, 9258), -- -- (35, 9606), -- (35, 10090), -- (35, 9598), -- (35, 9597), -- (35, 9593), -- (35, 9544), -- (35, 10116), -- (35, 9913), -- (35, 9823), -- (35, 9796), -- (35, 9986), -- (35, 9615), -- (35, 9685), -- (35, 10141), -- (35, 9365), -- (35, 13616), -- (35, 9258), -- (35, 9031), -- (35, 28377), -- -- (36, 9606), -- (36, 10090), -- (36, 9598), -- (36, 9597), -- (36, 9593), -- (36, 9544), -- (36, 10116), -- (36, 9913), -- (36, 9823), -- (36, 9796), -- (36, 9986), -- (36, 9615), -- (36, 9685), -- (36, 10141), -- (36, 9365), -- (36, 13616), -- (36, 9258), -- (36, 9031), -- (36, 28377), -- (36, 8364), -- -- (37, 9606), -- (37, 10090), -- (37, 9598), -- (37, 9597), -- (37, 9593), -- (37, 9544), -- (37, 10116), -- (37, 9913), -- (37, 9823), -- (37, 9796), -- (37, 9986), -- (37, 9615), -- (37, 9685), -- (37, 10141), -- (37, 9365), -- (37, 13616), -- (37, 9258), -- (37, 9031), -- (37, 28377), -- (37, 8364), -- (37, 7955), -- -- (38, 9913), -- (38, 9823), -- (38, 9796), -- (38, 9615), -- (38, 9685), -- (38, 9365), -- -- (39, 7227), -- (39, 7217), -- (39, 7230), -- (39, 7237), -- (39, 7240), -- (39, 7244), -- (39, 7245), -- -- (40, 7227), -- (40, 7217), -- (40, 7230), -- (40, 7237), -- (40, 7240), -- (40, 7244), -- (40, 7245), -- (40, 6239), -- -- (41, 9823), -- (41, 9913), -- -- (42, 9031), -- (42, 9615), -- (42, 9685), -- (42, 9796), -- (42, 9823), -- (42, 9913), -- (42, 9986), -- (42, 10141) ;
true
0ee88da3700cc3a5493d7bde13bd455aea228b21
SQL
ronniejoshua/seeking-alpha-sql-home-assignment
/5_time_series_dru_paying_subscription.sql
UTF-8
2,524
4.28125
4
[]
no_license
/* QUESTION 5: Create a time series of DRU that are also paying for a subscription, the results should be a table with ts_Date column and 3 DRU columns (one for all paying, one for paying for pro, one for paying for mp) You can use the subscription table to determine who is a paying subscriber. Dialect: POSTGRESQL Result: |ts_date |all_paying_users|paying_for_pro|paying_for_mp| |----------|----------------|--------------|-------------| |2018-07-10| 2| 1| 1| |2018-07-09| 1| 1| 0| */ -- This is for code just for replication and testing the query -- It may be different than what is provided in the assignment with subscription( UserId, SubscriptionId, ProductId, SubscriptionStartDate, SubscriptionEndDate ) as ( values (8943,'7h49f9s','pro','2018-03-04',NUll), (583689,'4h98f7v','mp','2017-12-27','2018-07-28'), (684,'5j43g2u','pro','2018-05-13',NULL), (8943,'2j12d5k','mp','2018-01-20','2018-03-01'), (12345,'2j13d5k','mp','2018-01-20',NULL) ) , mone(ts_date, UserId, MachineCookie, Platform) as ( values ('2018-07-10', 8943, 759827895732, 'desktop'), ('2018-07-10', 8943, 430928402308, 'tablet'), ('2018-07-10', 583689, 748927589287, 'desktop'), ('2018-07-09', 43984, 985420580298, 'mobile'), ('2018-07-09', 8943, 759827895732, 'desktop'), ('2018-07-09', NULL, 473878094774, 'mobile') ) -- Solution Start's Here ... , asu_data as ( SELECT userid, productid, SubscriptionStartDate, SubscriptionEndDate FROM subscription ), dru_data as ( SELECT DISTINCT ts_date, userid FROM mone WHERE userid IS NOT NULL ) , data_ref as ( SELECT d.ts_date, d.userid, a.productid FROM dru_data as d CROSS JOIN asu_data as a WHERE d.userid = a.userid AND ( ( d.ts_date >= a.SubscriptionStartDate AND a.SubscriptionEndDate IS NULL ) OR ( d.ts_date BETWEEN a.SubscriptionStartDate AND a.SubscriptionEndDate ) ) ), SELECT ts_date, COUNT(userid) AS all_paying_users, SUM( CASE WHEN productid = 'pro' THEN 1 ELSE 0 END ) AS paying_for_pro, SUM( CASE WHEN productid = 'mp' THEN 1 ELSE 0 END ) AS paying_for_mp FROM data_ref GROUP BY ts_date;
true
861b4a49f0763ff959741d3ea672e109cf29b986
SQL
citusdata/pg_cron
/pg_cron--1.2--1.3.sql
UTF-8
1,428
3.75
4
[]
permissive
/* pg_cron--1.2--1.3.sql */ CREATE SEQUENCE cron.runid_seq; CREATE TABLE cron.job_run_details ( jobid bigint, runid bigint primary key default nextval('cron.runid_seq'), job_pid integer, database text, username text, command text, status text, return_message text, start_time timestamptz, end_time timestamptz ); GRANT SELECT ON cron.job_run_details TO public; GRANT DELETE ON cron.job_run_details TO public; ALTER TABLE cron.job_run_details ENABLE ROW LEVEL SECURITY; CREATE POLICY cron_job_run_details_policy ON cron.job_run_details USING (username OPERATOR(pg_catalog.=) current_user); SELECT pg_catalog.pg_extension_config_dump('cron.job_run_details', ''); SELECT pg_catalog.pg_extension_config_dump('cron.runid_seq', ''); ALTER TABLE cron.job ADD COLUMN jobname name; CREATE UNIQUE INDEX jobname_username_idx ON cron.job (jobname, username); ALTER TABLE cron.job ADD CONSTRAINT jobname_username_uniq UNIQUE USING INDEX jobname_username_idx; CREATE FUNCTION cron.schedule(job_name name, schedule text, command text) RETURNS bigint LANGUAGE C STRICT AS 'MODULE_PATHNAME', $$cron_schedule_named$$; COMMENT ON FUNCTION cron.schedule(name,text,text) IS 'schedule a pg_cron job'; CREATE FUNCTION cron.unschedule(job_name name) RETURNS bool LANGUAGE C STRICT AS 'MODULE_PATHNAME', $$cron_unschedule_named$$; COMMENT ON FUNCTION cron.unschedule(name) IS 'unschedule a pg_cron job';
true
df0e9562e2c98c8a6131a3b41780d60e7a1d4678
SQL
cquzxy/remote-testbed
/remote-db/remote_core/tables/tbl_site.sql
UTF-8
346
3.078125
3
[]
no_license
drop table if exists site; CREATE TABLE site ( `id` int(11) unsigned NOT NULL auto_increment, `sitename` varchar(50) NOT NULL, `position_id` int(11) unsigned default NULL, PRIMARY KEY (`id`), CONSTRAINT `fk_site_pos` FOREIGN KEY (`position_id`) REFERENCES `position` (`id`) ) ENGINE = InnoDB; insert into site(sitename) values ('?SITE');
true
c0b0f840c6c7be634d6faa7013d5e64c13582782
SQL
duke326/SWE-241
/SWE-243/Answer/Exercise4_2.sql
UTF-8
1,555
4.1875
4
[]
no_license
select distinct vendor_name from vendors where vendor_id in (select vendor_id from invoices) order by vendor_name; -- exericse 2 select invoice_number, invoice_total from invoices where payment_total >(select avg(payment_total) from invoices where payment_total>0); -- exercise 3 select account_number,account_description from general_ledger_accounts gl where not exists(select * from invoice_line_items where gl.account_number=account_number) order by account_number; -- exercise 4 select vendor_name, i.invoice_id,invoice_sequence, line_item_amount from invoices i join vendors v on v.vendor_id=i.vendor_id join invoice_line_items li on li.invoice_id=i.invoice_id where i.invoice_id in (select distinct invoice_id from invoice_line_items where invoice_sequence>1) ORDER BY vendor_name, i.invoice_id, invoice_sequence; -- exercise 5 select sum(invoice_max) as sum_of_max from ( -- first query select vendor_id, max(invoice_total) as invoice_max from invoices where invoice_total-credit_total-payment_total>0 group by vendor_id) t; -- exercise 6 select vendor_name, vendor_city, vendor_state from vendors where concat(vendor_state, vendor_city) not in ( select concat(vendor_state, vendor_city) as vendor_city_state from vendors group by vendor_city_state having count(*)>1 ) order by vendor_state, vendor_city; -- exercise 7 select vendor_name, invoice_number, invoice_date, invoice_total from vendors v join invoices i on i.vendor_id=v.vendor_id where (select min(invoice_date) from invoices where vendor_id=i.vendor_id) group by vendor_name;
true
5bc54b5e75402c17de762c8f0fd8905b357c8771
SQL
mavn2/employee-database
/db/seeds.sql
UTF-8
595
3.140625
3
[ "MIT" ]
permissive
USE employee_db; -- Test department data INSERT INTO departments (name) VALUES ('Marketing'),('Development'); -- Test role data INSERT INTO roles (title, salary, department_id) VALUES ('Manager', 60000, 1),('Associate', 40000, 1),('Intern', 0, 1), ('Lead', 60000, 2), ('Engineer', 45000, 2); -- Test employee data INSERT INTO employees (first_name, last_name, role_id) VALUES ('John', 'Doe', 1), ('Susan', 'Susan', 4); INSERT INTO employees (first_name, last_name, role_id, manager_id) VALUES ('Jack', 'Doe', 3, 1), ('Jane', 'Doe', 2, 1), ('Bill', 'Hicock', 5, 2), ('John', 'Wayne', 3, 2);
true
daf2ee82c09595092f5015716ee673276421bed5
SQL
gfis/dbat
/etc/sql/sample_worddb_create.sql
UTF-8
494
2.65625
3
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
-- @(#) $Id$ -- Sample for the creation of a test database -- Caution: modify the password! -- 2017-04-19, GEorg Fischer: -- to be run with: -- mysql -u root -p -- source <this file> -- quit -- DROP DATABASE IF EXISTS worddb; CREATE DATABASE worddb DEFAULT CHARACTER SET utf8 COLLATE utf8_bin; USE worddb; DROP USER IF EXISTS 'worduser'@'localhost'; CREATE USER 'worduser'@'localhost' IDENTIFIED BY '????'; GRANT ALL ON worddb.* TO 'worduser'@'localhost'; COMMIT;
true
25403f93001d9427b11424ee13e6972f0639de1f
SQL
fandashtic/arc_chennai
/Sivabalan-SQL/VIEW/V_Customer_Master.sql
UTF-8
1,557
3.203125
3
[]
no_license
Create VIEW [V_Customer_Master] ([Customer_ID],[Customer_Name],[Channel_Type],[Customer_Category],[Sub_Channel],[Phone_Number],[Email], [Default_Payment_Mode],[Contact_Person], [Billing_Address],[Shipping_Address],[DefaultBeat],[Area],[CG_CreditLimit_YN],[Credit_Term], [Credit_Limit],[No_of_Open_Invoices],[Creation_Date],[Modified_Date],[Active],[TrackPoints],[BalancePoints], [MobileNo], [SMSAlert], [Latitude], [Longitude],[Channel_Type_Desc],[Outlet_Type_Desc],[Loyalty_Program_Desc] ) AS SELECT distinct cus.CustomerID, Company_Name, ChannelType, CustomerCategory, SubChannelID, Phone, Email, Payment_Mode, ContactPerson, BillingAddress, ShippingAddress, DefaultBeatID, AreaID, "CG_CreditLimit_YN"= case when (Select count(*) from CustomerCreditLimit where CustomerID=cus.CustomerID and CreditLimit > 0 ) = 0 Then 2 else 1 End, CreditTerm, cus.CreditLimit, NoOFBillsOutstanding, cus.CreationDate, cus.Modifieddate, cus.Active, TrackPoints, CollectedPoints, MobileNumber, Case When IsNull(SMSAlert, 0) = 0 Then 'No' Else 'Yes' End, geo.Latitude, geo.Longitude, olc.Channel_Type_desc, olc.Outlet_Type_Desc, olc.SubOutlet_type_desc as Loyalty_Program_Desc FROM Customer cus Left Outer Join OutletGeo geo on geo.CustomerID = cus.CustomerID Left Outer Join CustomerCreditLimit On cus.Customerid = CustomerCreditLimit.CustomerID left outer join tbl_mERP_OLClassMapping map on map.CustomerID = cus.CustomerID and map.active=1 left outer join tbl_mERP_OLClass olc on olc.id=map.OLClassID
true
249ca2e829ca87c8000d9f24b75a3e8adddc6b28
SQL
kooyeun/mysql-practice
/sql-practices/practice02/practice02.sql
UTF-8
1,709
4.4375
4
[]
no_license
-- 집계함수 -- 예제1 -- salaries 테이블에서 현재 전체 직원의 평균급여 출력 select avg(salary),max(salary) from salaries where to_date = '9999-01-01'; -- 왜 null 로 나오지?? -- 예제2 -- salaries 테이블에서 사번이 10060인 직원의 급여 평균과 총합ㄱalterㅖ를 출력 select avg(salary),sum(salary) from salaries where emp_no=10060; -- 예제3 -- 이 예제 직원의 최저 임금을 받은 시기와 최대 임금을 "받은 시기"를 각 각 출력해보세요 -- select 절에 집계함수가 있으면 다른 컬럼은 올 수 없다 -- 따라서 "받은 시기"는 조인이나 서브쿼리를 통해서 구해야 한다 select max(salary),min(salary) from salaries where emp_no=10060; -- 예제4 -- dept_emp 테이블에서 d008에 근무하는 인원수는 select count(*) from dept_emp where dept_no='d008' and to_date='9999-01-01'; -- 예제5 -- 각 사원별로 평균연봉 출력 select emp_no,avg(salary) as avg_salary from salaries group by emp_no order by avg_salary desc; -- 예제6 -- salaries 테이블에서 현재 전체 직원별로 평균급여가 35000 이상인 직원의 평균 급여를 -- 큰 순서로 출력 select emp_no,avg(salary) from salaries where to_date='9999-01-01' group by emp_no having avg(salary) >= 35000 order by avg(salary) desc; -- 예제7 -- 사원별로 몇 번의 직책 변경이 있었는지 조회해보세요 select emp_no,count(*) from titles group by emp_no; -- 예제8 -- 현재 직책별로 직원수를 구하되 직원수가 100명 이상인 직책만 출력하세요 select title, count(*) as cnt from titles where to_date='9999-01-01' group by title having cnt >= 100 order by cnt desc;
true
c6c1af85633fb201442283530fc2375eebd2b7e5
SQL
sanzidul-islam/OBJECT-ORIENTED-PROGRAMMING-2-C-_PROJECT
/Customer-details/SQLQuery1.sql
UTF-8
931
3.671875
4
[]
no_license
CREATE DATABASE CUSTOMER_DB; CREATE TABLE CUSTOMER_DETAILS ( NAME VARCHAR(50), MOBILE INT PRIMARY KEY, ADDRESS_ VARCHAR(50), AMOUNT INT, DATE_ VARCHAR(50), USER__NAME VARCHAR(50), PASS VARCHAR(50), PICTURE IMAGE ); DELETE FROM CUSTOMER_DETAILS WHERE MOBILE='1765532849'; CREATE TABLE CUSTOMER_COMMENTS ( COMMENT VARCHAR(50) ); SELECT * FROM CUSTOMER_DETAILS; SELECT * FROM CUSTOMER_COMMENTS; SELECT NAME, AMOUNT FROM CUSTOMER_DETAILS; SELECT SUM(AMOUNT) AS TOTAL_AMOUNT FROM CUSTOMER_DETAILS; CREATE TABLE ADD_SLOT ( S_NUMBER INT PRIMARY KEY, S_SIZE VARCHAR(50), COW_CAPACITY VARCHAR(50), SLOT_PRICE INT, SLOT_LOCATION VARCHAR(50), PICTURE IMAGE ); SELECT * FROM ADD_SLOT; CREATE TABLE CARD_SLOT ( S_NUMBER INT PRIMARY KEY, S_SIZE VARCHAR(50), COW_CAPACITY VARCHAR(50), SLOT_PRICE INT, SLOT_LOCATION VARCHAR(50), PICTURE IMAGE, SELL_NAME VARCHAR(50) ); SELECT * FROM CARD_SLOT; DELETE FROM CARD_SLOT WHERE S_NUMBER='1';
true
25c2e54836c157f5abc0b6a152e84f58eae7fc07
SQL
lucasgomescosta/shhopping-api
/src/main/resources/db/migration/V1__create_shop_table.sql
UTF-8
336
3.1875
3
[]
no_license
create schema if not exists shoppings; create table shoppings.shop ( id bigserial primary key, user_identifier varchar(100) not null, date timestamp not null, total float not null ); create table shoppings.item ( shop_id bigserial REFERENCES shoppings.shop(id), product_identifier varchar(100) not null, price float not null );
true
f161850bd46b0df27a16909ebd6336860ff7dfba
SQL
Pandailo/MiniProjetGl
/init_sql.sql
UTF-8
738
3.140625
3
[]
no_license
DROP TABLE PGL_Musique; CREATE TABLE PGL_Musique(id INTEGER,titre VARCHAR2(25),duree INTEGER,artiste VARCHAR2(50)); CREATE OR REPLACE TRIGGER trigger_PGL_id BEFORE INSERT ON PGL_Musique FOR EACH ROW DECLARE idm INTEGER; BEGIN SELECT max(id) INTO idm FROM PGL_Musique; IF idm IS NOT NULL THEN idm:=idm+1; :new.id := idm; ELSE :new.id :=0; END IF; END; / INSERT INTO PGL_Musique VALUES(0,'Down with the sickness',216,'Disturbed'); INSERT INTO PGL_Musique VALUES(0,'Prayer of the refugee',217,'Rise Against'); INSERT INTO PGL_Musique VALUES(0,'Superstition',267,'Stevie Wonder'); INSERT INTO PGL_Musique VALUES(0,'Sweet Child O"Mine',299,'Guns N" Roses'); INSERT INTO PGL_Musique VALUES(0,'Short Change Hero',237,'The Heavy');
true
993770f67bb802534064e8d0b3aae86e4cb849b3
SQL
sbilly/lanmap2
/data/gen-db.sql
UTF-8
13,523
3.125
3
[]
no_license
-- ex: set ff=dos ts=2 et: -- SQL for sqlite3 -- a few aspects we see repeated: -- earliest/latest -- our database is meant to store data over a long period of time, -- but due to the very high level of repeated data in a network we -- cannot store one record per instance. therefore, for each piece -- of data we store a range of time between which it was seen; this -- allows us to store a fixed number of records and yet correctly -- reconstruct the state of the network at any point in time. -- --DROP TABLE IF EXISTS prottype; --DROP TABLE IF EXISTS addrtype; --DROP TABLE IF EXISTS addrtype; --DROP TABLE IF EXISTS addr; --DROP TABLE IF EXISTS traffic; --DROP TABLE IF EXISTS hint; -- map IEEE Organizationally Unique Identifier to vendor name CREATE TABLE oui ( oui TEXT NOT NULL, org TEXT NOT NULL, UNIQUE (oui) ); -- one record per unique protocol CREATE TABLE prottype ( prot TEXT NOT NULL, longname TEXT NOT NULL, descr TEXT NOT NULL, UNIQUE (prot) ); INSERT INTO prottype VALUES ('ARP', '', ''); INSERT INTO prottype VALUES ('BitTorrent','', ''); INSERT INTO prottype VALUES ('BOOTP', '', ''); INSERT INTO prottype VALUES ('BROWSE', '', ''); INSERT INTO prottype VALUES ('CDP', '', ''); INSERT INTO prottype VALUES ('CUPS', '', ''); INSERT INTO prottype VALUES ('DCHPv6', '', ''); INSERT INTO prottype VALUES ('DNS', '', ''); INSERT INTO prottype VALUES ('Gnutella', '', ''); INSERT INTO prottype VALUES ('HTTP', '', ''); INSERT INTO prottype VALUES ('ICMP', '', ''); INSERT INTO prottype VALUES ('IEEE802.3', '', ''); INSERT INTO prottype VALUES ('IGMPv2', '', ''); INSERT INTO prottype VALUES ('IPv4', '', ''); INSERT INTO prottype VALUES ('IPv6', '', ''); INSERT INTO prottype VALUES ('IPX', '', ''); INSERT INTO prottype VALUES ('LinuxSLL', '', ''); INSERT INTO prottype VALUES ('LLC', '', ''); INSERT INTO prottype VALUES ('LLDP', '', ''); INSERT INTO prottype VALUES ('Logical', '', ''); INSERT INTO prottype VALUES ('McAfeeRumor','', ''); INSERT INTO prottype VALUES ('MSSQLM', '', ''); INSERT INTO prottype VALUES ('NB-Dgm', '', ''); INSERT INTO prottype VALUES ('NBNS', '', ''); INSERT INTO prottype VALUES ('NetBIOS', '', ''); INSERT INTO prottype VALUES ('NTP', '', ''); INSERT INTO prottype VALUES ('RADIUS', '', ''); INSERT INTO prottype VALUES ('RASADV', '', ''); INSERT INTO prottype VALUES ('RTSP', '', ''); INSERT INTO prottype VALUES ('SMB', '', ''); INSERT INTO prottype VALUES ('SNMP', '', ''); INSERT INTO prottype VALUES ('SSDP', '', ''); INSERT INTO prottype VALUES ('StormBotnet','', ''); INSERT INTO prottype VALUES ('STP', '', ''); INSERT INTO prottype VALUES ('Symbol8781','', ''); INSERT INTO prottype VALUES ('TCP', '', ''); INSERT INTO prottype VALUES ('TivoConn', '', ''); INSERT INTO prottype VALUES ('UDP', '', ''); -- types of addresses and the protocols from which they come CREATE TABLE addrtype ( type_ TEXT NOT NULL, prottype TEXT NOT NULL, shortname TEXT NOT NULL, longname TEXT NOT NULL, UNIQUE (type_), FOREIGN KEY (prottype) REFERENCES prottype (prot) ); INSERT INTO addrtype VALUES ('BH', 'BOOTP', 'BOOTP Hostname', ''); INSERT INTO addrtype VALUES ('BR', 'BROWSE', 'BROWSE Hostname', ''); INSERT INTO addrtype VALUES ('CUPS','CUPS', 'CUPS.Location', ''); INSERT INTO addrtype VALUES ('D', 'DNS', 'DNS name', ''); INSERT INTO addrtype VALUES ('M', 'MAC', 'IEEE802.3', ''); INSERT INTO addrtype VALUES ('N', 'NetBIOS', 'NetBIOS', ''); INSERT INTO addrtype VALUES ('4', 'IPv4', 'IPv4', ''); INSERT INTO addrtype VALUES ('6', 'IPv6', 'IPv6', ''); INSERT INTO addrtype VALUES ('RAS', 'RASADV', 'rasadv hostname', ''); INSERT INTO addrtype VALUES ('Storm','StormBotnet','Infected w/ Storm Worm',''); INSERT INTO addrtype VALUES ('TH', 'TivoConn', 'TivoConn Hostname',''); -- classifications of hints CREATE TABLE hintsrc ( src TEXT NOT NULL, prottype TEXT NOT NULL, descr TEXT NOT NULL, UNIQUE (src), FOREIGN KEY (prottype) REFERENCES prottype (prot) ); INSERT INTO hintsrc VALUES ('BOOTP.VendorClass', 'BOOTP', ''); INSERT INTO hintsrc VALUES ('BOOTP.Fingerprint', 'BOOTP', ''); INSERT INTO hintsrc VALUES ('BOOTP.Offer', 'BOOTP', ''); INSERT INTO hintsrc VALUES ('BOOTP.Router', 'BOOTP', ''); INSERT INTO hintsrc VALUES ('BOOTP.DHCPD', 'BOOTP', ''); INSERT INTO hintsrc VALUES ('BROWSE.OS', 'BROWSE', ''); INSERT INTO hintsrc VALUES ('BROWSE.Browser', 'BROWSE', ''); INSERT INTO hintsrc VALUES ('BROWSE.Comment', 'BROWSE', ''); INSERT INTO hintsrc VALUES ('CDP.Platform', 'CDP', ''); INSERT INTO hintsrc VALUES ('CDP.SoftVer', 'CDP', ''); INSERT INTO hintsrc VALUES ('CUPS.Location', 'CUPS', ''); INSERT INTO hintsrc VALUES ('DNS.TXT', 'DNS', ''); INSERT INTO hintsrc VALUES ('DNS.LOCAL', 'DNS', ''); INSERT INTO hintsrc VALUES ('Gnutella.User-Agent', 'Gnutella', ''); INSERT INTO hintsrc VALUES ('HTTP.Server', 'HTTP', ''); INSERT INTO hintsrc VALUES ('HTTP.User-Agent', 'HTTP', ''); INSERT INTO hintsrc VALUES ('HTTP.X-Powered-By', 'HTTP', ''); INSERT INTO hintsrc VALUES ('ICMP.ECHO.Fingerprint','ICMP', ''); INSERT INTO hintsrc VALUES ('LLDP.PortDescr', 'LLDP', ''); INSERT INTO hintsrc VALUES ('LLDP.PortId', 'LLDP', ''); INSERT INTO hintsrc VALUES ('LLDP.SysDescr', 'LLDP', ''); INSERT INTO hintsrc VALUES ('LLDP.SysName', 'LLDP', ''); INSERT INTO hintsrc VALUES ('MAC.Vendor', 'IEEE802.3',''); INSERT INTO hintsrc VALUES ('MSSQLM.ServerName', 'MSSQLM', ''); INSERT INTO hintsrc VALUES ('MSSQLM.InstanceName', 'MSSQLM', ''); INSERT INTO hintsrc VALUES ('MSSQLM.Version', 'MSSQLM', ''); INSERT INTO hintsrc VALUES ('MSSQLM.TCPPort', 'MSSQLM', ''); INSERT INTO hintsrc VALUES ('MSSQLM.UDPPort', 'MSSQLM', ''); INSERT INTO hintsrc VALUES ('MSSQLM.NamedPipe', 'MSSQLM', ''); INSERT INTO hintsrc VALUES ('RAS.Domain', 'RASADV', ''); INSERT INTO hintsrc VALUES ('RTSP.Server', 'RTSP', ''); INSERT INTO hintsrc VALUES ('RTSP.User-Agent', 'RTSP', ''); INSERT INTO hintsrc VALUES ('RTSP.URL', 'RTSP', ''); INSERT INTO hintsrc VALUES ('SSDP.Server', 'SSDP', ''); INSERT INTO hintsrc VALUES ('SSDP.Location', 'SSDP', ''); INSERT INTO hintsrc VALUES ('SSDP.NT', 'SSDP', ''); INSERT INTO hintsrc VALUES ('SSDP.USN', 'SSDP', ''); INSERT INTO hintsrc VALUES ('STP.Bridge', 'STP', ''); INSERT INTO hintsrc VALUES ('TCP.Fingerprint', 'TCP', ''); INSERT INTO hintsrc VALUES ('TivoConn.Platform', 'TivoConn', ''); -- translate between network addresses -- from ARP and BOOTP i guess CREATE TABLE addr ( id INTEGER PRIMARY KEY AUTOINCREMENT, fromtype TEXT NOT NULL, from_ TEXT NOT NULL, totype TEXT NOT NULL, to_ TEXT NOT NULL, reason TEXT NOT NULL, -- why do we think this? include a human-readable description of the rule that provides this weight -- TODO: drop 'weight' field here weight INTEGER NOT NULL, -- total weight reported for this mac:target earliest INTEGER NOT NULL, -- earliest UNIX timestamp for this hint latest INTEGER NOT NULL, -- latest UNIX timestamp for this hint UNIQUE (fromtype, from_, totype, to_, reason), FOREIGN KEY (fromtype) REFERENCES addrtype (type_), FOREIGN KEY (totype) REFERENCES addrtype (type_) ); -- TODO: rename to 'attr'(ibute) -- each record represents a single attribute, tied to a network address, that -- was gleaned from that machine's traffic; most of these are intended to be -- used in identifying the host; though others can be URLs or comments or other -- potentially interesting pieces of data CREATE TABLE hint ( id INTEGER PRIMARY KEY AUTOINCREMENT, addrtype TEXT NOT NULL, addr TEXT NOT NULL, -- address hint is associated with hintsrc TEXT NOT NULL, contents TEXT NOT NULL, earliest INTEGER NOT NULL, -- earliest UNIX timestamp for this hint latest INTEGER NOT NULL, -- latest UNIX timestamp for this hint UNIQUE (addrtype, addr, hintsrc, contents), FOREIGN KEY (addrtype) REFERENCES addrtype (type_), FOREIGN KEY (hintsrc) REFERENCES hintsrc (src) ); -- track traffic in a single direction 'from_' -> 'to_' -- this is pretty straight-forward CREATE TABLE traffic ( id INTEGER PRIMARY KEY AUTOINCREMENT, fromtype TEXT NOT NULL, from_ TEXT NOT NULL, totype TEXT NOT NULL, to_ TEXT NOT NULL, protocol TEXT NOT NULL, -- name of the protocol bytes INTEGER NOT NULL, -- number of actual protocol bytes bytes_encap INTEGER NOT NULL, -- number of bytes encapsulated by protocol including -- other protocols counter INTEGER NOT NULL, -- number of times updated; useful for calculating -- mean metrics earliest INTEGER NOT NULL, -- earliest UNIX timestamp for this hint latest INTEGER NOT NULL, -- latest UNIX timestamp for this hint UNIQUE (fromtype, from_, totype, to_, protocol), FOREIGN KEY (fromtype) REFERENCES addrtype (type_), FOREIGN KEY (totype) REFERENCES addrtype (type_), FOREIGN KEY (protocol) REFERENCES prottype (prot) ); CREATE TABLE maptype ( type_ TEXT NOT NULL, descr TEXT NOT NULL, UNIQUE (type_) ); INSERT INTO maptype (type_,descr) VALUES ('APP', 'Application'); INSERT INTO maptype (type_,descr) VALUES ('OS', 'Operating System'); INSERT INTO maptype (type_,descr) VALUES ('HW', 'Hardware'); INSERT INTO maptype (type_,descr) VALUES ('Role', 'Role in the network'); INSERT INTO maptype (type_,descr) VALUES ('Dev', 'A full device... I need to get a multi-level mapping system working for this to really work...'); -- map hint.contents to a hardware platform, an operating system or application CREATE TABLE map ( enable INTEGER NOT NULL DEFAULT 1, maptype TEXT NOT NULL, map TEXT NOT NULL, weight INTEGER NOT NULL DEFAULT 1, -- src TEXT NOT NULL, val TEXT NOT NULL, UNIQUE (maptype, map, src, val), FOREIGN KEY (maptype) REFERENCES maptype (type_), FOREIGN KEY (src) REFERENCES hintsrc (src) ); CREATE INDEX idx_map_maptype ON map (maptype); -- we may have more than one client simultaneously -- looking at a different set of hosts from different timespans; -- we'll key off the timespans CREATE TABLE host_perspective ( id INTEGER PRIMARY KEY AUTOINCREMENT, earliest INTEGER NOT NULL, latest INTEGER NOT NULL, UNIQUE (earliest, latest) ); -- defines a unique "host"; a collection of one or more addresses -- that relate to one another CREATE TABLE host ( hp_id INTEGER NOT NULL, id INTEGER PRIMARY KEY AUTOINCREMENT, addr TEXT NOT NULL, -- main address at this host FOREIGN KEY (hp_id) REFERENCES host_perspective (id) ); CREATE INDEX index_host_addr ON host (addr); -- this table is derived from the 'addr' table data by our -- own 'conglomerate' algorithm in php CREATE TABLE host_addr ( id INTEGER PRIMARY KEY AUTOINCREMENT, host_id INTEGER NOT NULL, addr TEXT NOT NULL, -- a subordinate address to the main host address FOREIGN KEY (host_id) REFERENCES host (id) ); CREATE INDEX index_host_addr_hid ON host_addr (host_id); CREATE INDEX index_host_addr_addr ON host_addr (addr); -- an instance of hint->map applied to a particular host address -- that is, one or more hints have been gathered from a particular address and -- they match a 'map' entry; these are combined into a single record denoting the -- "weight" of this evidence for a particular property (i.e. that address A is Operating System O) -- this is the "final" outcome of hint and map CREATE TABLE host_map ( host_addr_id INTEGER NOT NULL, maptype TEXT NOT NULL, map TEXT NOT NULL, weight INTEGER NOT NULL DEFAULT 0, FOREIGN KEY (host_addr_id) REFERENCES host_addr (id), FOREIGN KEY (maptype) REFERENCES maptype (type_) FOREIGN KEY (map) REFERENCES map (map) ); -- --CREATE TABLE icon ( -- maptype TEXT NOT NULL, -- map TEXT NOT NULL, -- image TEXT NOT NULL, -- UNIQUE (maptype, map) --);
true
ddb66541bf2894594d19ee927617d3d33cfa7bd1
SQL
anirbanbagchi1979/SummitOrders
/SummitOrders_Code/EBS_Codebase/1.5_xx_cr_db_orderDetailsRec.sql
UTF-8
1,366
2.625
3
[]
no_license
/*drop TYPE xx_mdx_order_tab; / drop TYPE xx_mdx_order_rec; / drop type xx_mdx_orderline_tab; / drop type xx_mdx_orderline_rec; / */ CREATE TYPE xx_mdx_order_rec as object ( header_id number, Order_Number number, order_Status varchar2(50), Order_Date date, Order_Amount number, order_Currency varchar2(5), check_number varchar2(50), credit_card_code varchar2(50), credit_card_number varchar2(50), Payment_Type varchar2(25), payment_account_num varchar2(50), Sales_Rep varchar2(150), Customer_ID number, customer_number varchar2(25), customer_name varchar2(240), order_line_count number, -- customer_address varchar2(1000), credit_rating varchar2(50), customer_comments varchar2(240) ); / CREATE TYPE xx_mdx_order_tab AS TABLE OF xx_mdx_order_rec; / CREATE TYPE xx_mdx_orderline_rec as object (header_id number, line_id number, item_id number, line_status varchar2(50), line_number number, shipment_number number, Ship_Date date, Product_Name varchar2(25), product_desc varchar2(240), unit_selling_Price number, order_Quantity number, Total_line_Amount number ); / CREATE TYPE xx_mdx_orderline_tab AS TABLE OF xx_mdx_orderline_rec; / -- 3/12 -- will be used as an input array for APIs CREATE TYPE xx_mdx_om_input_rec as object (order_number number, order_status varchar2(50) ); / CREATE TYPE xx_mdx_om_input_tab AS TABLE OF xx_mdx_om_input_rec; / -- --
true
d5c616e1d75e45f876c5d4f6c11454a6b7c257cc
SQL
chamb-ferly/sql_challenge
/schema.sql
UTF-8
610
3.296875
3
[]
no_license
--build tables and import csv create table departments ( dept_no text, dept_name varchar); create table dept_emp ( emp_no int, dept_no text, from_date date, to_date date); create table dept_manager ( dept_no text, emp_no int, from_date date, to_date date); create table employees ( emp_no int, birth_date date, first_name varchar, last_name varchar, gender varchar, hire_date date); create table salaries ( emp_no int, salary int, from_date date, to_date date); create table titles ( emp_no int, title varchar, from_date date, to_date date); -- view tables select * from departments; select * from employees;
true
44c7a5553f02fe15836aceee363f639e012769ec
SQL
ShahakBH/jazzino-master
/bi/bi-dbdw/src/main/resources/deltas/140.sql
UTF-8
1,436
3.625
4
[]
no_license
CREATE TABLE IF NOT EXISTS `APP_REQUEST` ( `ID` int(11) NOT NULL AUTO_INCREMENT, `TARGET_CLIENT` varchar(50) NOT NULL, `TITLE` varchar(256) NOT NULL DEFAULT '', `DESCRIPTION` varchar(256) NOT NULL DEFAULT '', `MESSAGE` varchar(100) NOT NULL DEFAULT '', `TRACKING` varchar(2048) DEFAULT NULL, `TARGET_COUNT` int(11) NOT NULL DEFAULT '0', `STATUS` tinyint(1) NOT NULL DEFAULT '0', `CREATED` datetime NOT NULL, `SENT` datetime DEFAULT NULL, PRIMARY KEY (`ID`), KEY `IDX_CREATED` (`CREATED`) ) ENGINE=InnoDB AUTO_INCREMENT=18 DEFAULT CHARSET=utf8# CREATE TABLE IF NOT EXISTS `APP_REQUEST_TARGET` ( `ID` int(11) NOT NULL AUTO_INCREMENT, `APP_REQUEST_ID` int(11) NOT NULL, `PLAYER_ID` bigint(20) NOT NULL, `EXTERNAL_ID` varchar(255) DEFAULT NULL, `GAME_TYPE` varchar(255) NOT NULL, PRIMARY KEY (`ID`), UNIQUE KEY `IDX_TARGET` (`APP_REQUEST_ID`,`GAME_TYPE`,`PLAYER_ID`), KEY `IDX_NOTIFICATION_PLAYER` (`APP_REQUEST_ID`,`GAME_TYPE`,`PLAYER_ID`) ) ENGINE=InnoDB AUTO_INCREMENT=663471 DEFAULT CHARSET=utf8# insert ignore into APP_REQUEST (ID, TARGET_CLIENT, TITLE, DESCRIPTION, MESSAGE, TARGET_COUNT, STATUS, CREATED, SENT) select ID, 'IOS', TITLE, DESCRIPTION, MESSAGE, TARGET_COUNT, STATUS, CREATED, SENT from IOS_PUSH_NOTIFICATION# insert ignore into APP_REQUEST_TARGET (ID, APP_REQUEST_ID, PLAYER_ID, GAME_TYPE) select ID, NOTIFICATION_ID, PLAYER_ID, GAME_TYPE from IOS_PUSH_NOTIFICATION_TARGET#
true
ab2fa48ea9c7a35d1bca05864d3ae22c5de8c764
SQL
LeoMartinsBDS/SQL
/view.sql
UTF-8
465
3.40625
3
[]
no_license
CREATE VIEW V_RELATORIO AS SELECT C.NOME, C.SEXO, IFNULL(C.EMAIL,'SEM EMAIL') AS "E-MAIL", T.TIPO, T.NUMERO, E.BAIRRO, E.CIDADE, E.ESTADO, FROM CLIENTE C INNER JOIN TELEFONE T ON C.IDCLIENTE = T.ID_CLIENTE INNER JOIN ENDERECO E ON C.IDCLIENTE = E.ID_CLIENTE --APOS CRIAR A VIEW --N É RECOMENDADO POR CAUSA DE PERFORMANCE --É POSSÍVEL REALIZAR UMA QUERY NA VIEW SELECT * FROM V_RELATORIO WHERE SEXO = 'F'; --APAGANDO UMA VIEW DROP VIEW V_RELATORIO
true
6a2052fe808f3166e1b482444e283653376d3adf
SQL
wajahata99/myrepo
/SQLScript/Bridge schmea DWH/Queries/pivoting_myquery.sql
UTF-8
17,428
3.765625
4
[]
no_license
--Simple use case of UK, i.e. one date and one process segment --All conditions and aggregates inside --Results mactch select x.date_actual, x.process_segment_name, (x.availability), (y.effectiveness), (z.oee) from ( Select d.date_actual, p.process_segment_name, k.id, round(avg(F.value_mean),2) as availability From dim_date d, dim_process_segment p, dim_kpi k, second_fact F Where d.date_actual=F.date_id AND d.date_actual in ('2020-06-25') And F.process_segment_id = p.id AND p.process_segment_name in ('Soap Line 1') AND k.id = F.kpi_id AND k.id = (13) group by d.date_actual, p.process_segment_name, k.id ) as x, ( Select d.date_actual, p.process_segment_name, k.id, round(avg(F.value_mean),2) as effectiveness From dim_date d, dim_process_segment p, dim_kpi k, second_fact F Where d.date_actual=F.date_id AND d.date_actual in ('2020-06-25') And F.process_segment_id = p.id AND p.process_segment_name in ('Soap Line 1') AND k.id = F.kpi_id AND k.id = (14) group by d.date_actual, p.process_segment_name, k.id ) as y, ( Select d.date_actual, p.process_segment_name, k.id,round(avg(F.value_mean),2) as oee From dim_date d, dim_process_segment p, dim_kpi k, second_fact F Where d.date_actual=F.date_id AND d.date_actual in ('2020-06-25') And F.process_segment_id = p.id AND p.process_segment_name in ('Soap Line 1') AND k.id = F.kpi_id AND k.id = (16) group by d.date_actual, p.process_segment_name,k.id ) as z -------------------------------------------------------------------- --2 Simple use case of UK, i.e. one date and one process segment --All conditions and aggregates inside --One non-aggregated and rest are aggregated select x.date_actual, x.process_segment_name, (x.availability), (y.effectiveness), (z.oee) from ( Select d.date_actual, p.process_segment_name, k.id, round((F.value_mean),2) as availability From dim_date d, dim_process_segment p, dim_kpi k, second_fact F Where d.date_actual=F.date_id AND d.date_actual in ('2020-06-25') And F.process_segment_id = p.id AND p.process_segment_name in ('Soap Line 1') AND k.id = F.kpi_id AND k.id = (13) --group by d.date_actual, p.process_segment_name, k.id ) as x, ( Select d.date_actual, p.process_segment_name, k.id, round(avg(F.value_mean),2) as effectiveness From dim_date d, dim_process_segment p, dim_kpi k, second_fact F Where d.date_actual=F.date_id AND d.date_actual in ('2020-06-25') And F.process_segment_id = p.id AND p.process_segment_name in ('Soap Line 1') AND k.id = F.kpi_id AND k.id = (14) group by d.date_actual, p.process_segment_name, k.id ) as y, ( Select d.date_actual, p.process_segment_name, k.id,round(avg(F.value_mean),2) as oee From dim_date d, dim_process_segment p, dim_kpi k, second_fact F Where d.date_actual=F.date_id AND d.date_actual in ('2020-06-25') And F.process_segment_id = p.id AND p.process_segment_name in ('Soap Line 1') AND k.id = F.kpi_id AND k.id = (16) group by d.date_actual, p.process_segment_name,k.id ) as z --------------------------------------------------------------------- --Use case 1 --All conditions and aggregates inside -- Returns some extra rows select y.date_actual ,y.process_segment_name, (x.availability), (y.effectiveness), (z.oee) from ( Select d.date_actual, p.process_segment_name, round(avg(F.value_mean),2) as availability From dim_date d, dim_process_segment p, dim_kpi k, second_fact F Where d.date_actual=F.date_id AND d.date_actual in ('2020-09-01','2020-09-02','2020-09-03','2020-09-04','2020-09-05','2020-09-06','2020-09-07') And F.process_segment_id = p.id AND p.process_segment_name in ('soap_line 2','soap_line 3','soap_line 4', 'soap_line 5', 'soap_line 6','soap_line 7') AND k.id = F.kpi_id AND k.id = (13) group by p.process_segment_name, d.date_actual ) as x, ( Select d.date_actual,p.process_segment_name, round(avg(F.value_mean),2) as effectiveness From dim_date d, dim_process_segment p, dim_kpi k, second_fact F Where d.date_actual=F.date_id AND d.date_actual in ('2020-09-01','2020-09-02','2020-09-03','2020-09-04','2020-09-05','2020-09-06','2020-09-07') And F.process_segment_id = p.id AND p.process_segment_name in ('soap_line 2','soap_line 3','soap_line 4', 'soap_line 5', 'soap_line 6','soap_line 7') AND k.id = F.kpi_id AND k.id = (14) group by p.process_segment_name,d.date_actual ) as y, ( Select d.date_actual,p.process_segment_name, round(avg(F.value_mean),2) as oee From dim_date d, dim_process_segment p, dim_kpi k, second_fact F Where d.date_actual=F.date_id AND d.date_actual in ('2020-09-01','2020-09-02','2020-09-03','2020-09-04','2020-09-05','2020-09-06','2020-09-07') And F.process_segment_id = p.id AND p.process_segment_name in ('soap_line 2','soap_line 3','soap_line 4', 'soap_line 5', 'soap_line 6','soap_line 7') AND k.id = F.kpi_id AND k.id = (16) group by p.process_segment_name,d.date_actual ) as z ------------------------ -- Use case 2 -- All conditions and aggregates inside -- Returns some extra rows-->group by is not working properly as usual select x.date_actual,x.full_time ,x.process_segment_name, (x.availability), (y.effectiveness), (z.oee) from ( Select d.date_actual, t.full_time, p.process_segment_name, round(avg(F.value_mean),2) as availability From dim_date d, dim_time_sec t, dim_process_segment p, dim_kpi k, second_fact F Where d.date_actual=F.date_id --AND d.date_actual in ('2020-09-01','2020-09-02','2020-09-03','2020-09-04','2020-09-05','2020-09-06','2020-09-07') AND d.date_actual in ('2020-09-01') And F.process_segment_id = p.id --AND p.process_segment_name in ('soap_line 2','soap_line 3','soap_line 4', 'soap_line 5', 'soap_line 6','soap_line 7') AND p.process_segment_name in ('soap_line 2') AND t.full_time = F.time_id AND t.shift_end = true AND k.id = F.kpi_id AND k.id = (13) group by d.date_actual, t.full_time, p.process_segment_name ) as x, ( Select d.date_actual,t.full_time,p.process_segment_name, round(avg(F.value_mean),2) as effectiveness From dim_date d, dim_time_sec t, dim_process_segment p, dim_kpi k, second_fact F Where d.date_actual=F.date_id --AND d.date_actual in ('2020-09-01','2020-09-02','2020-09-03','2020-09-04','2020-09-05','2020-09-06','2020-09-07') AND d.date_actual in ('2020-09-01') And F.process_segment_id = p.id --AND p.process_segment_name in ('soap_line 2','soap_line 3','soap_line 4', 'soap_line 5', 'soap_line 6','soap_line 7') AND p.process_segment_name in ('soap_line 2') AND t.full_time = F.time_id AND t.shift_end = true AND k.id = F.kpi_id AND k.id = (14) group by d.date_actual, t.full_time, p.process_segment_name ) as y, ( Select d.date_actual, t.full_time, p.process_segment_name, round(avg(F.value_mean),2) as oee From dim_date d, dim_time_sec t, dim_process_segment p, dim_kpi k, second_fact F Where d.date_actual=F.date_id --AND d.date_actual in ('2020-09-01','2020-09-02','2020-09-03','2020-09-04','2020-09-05','2020-09-06','2020-09-07') AND d.date_actual in ('2020-09-01') And F.process_segment_id = p.id --AND p.process_segment_name in ('soap_line 2','soap_line 3','soap_line 4', 'soap_line 5', 'soap_line 6','soap_line 7') AND p.process_segment_name in ('soap_line 2') AND t.full_time = F.time_id AND t.shift_end = true AND k.id = F.kpi_id AND k.id = (16) group by d.date_actual, t.full_time, p.process_segment_name ) as z -------------------------------------------------------------- -- Moving aggregations out and keeping conditions inside and providing a manual join -- Use case 2 -- Only works correct for single values otherwise provides the problems in the group by select x.process_segment_name, avg(x.availability), avg(y.effectiveness), avg(z.oee) --x.date_actual,x.full_time , from ( Select d.date_actual, t.full_time, p.process_segment_name, round((F.value_mean),2) as availability From dim_date d, dim_time_sec t, dim_process_segment p, dim_kpi k, second_fact F Where d.date_actual=F.date_id --AND d.date_actual in ('2020-09-01','2020-09-02','2020-09-03','2020-09-04','2020-09-05','2020-09-06','2020-09-07') AND d.date_actual in ('2020-09-01') And F.process_segment_id = p.id --AND p.process_segment_name in ('soap_line 2','soap_line 3','soap_line 4', 'soap_line 5', 'soap_line 6','soap_line 7') AND p.process_segment_name in ('soap_line 2') AND t.full_time = F.time_id AND t.shift_end = true AND k.id = F.kpi_id AND k.id = (13) --group by d.date_actual, t.full_time, p.process_segment_name ) as x join ( Select d.date_actual,t.full_time,p.process_segment_name, round((F.value_mean),2) as effectiveness From dim_date d, dim_time_sec t, dim_process_segment p, dim_kpi k, second_fact F Where d.date_actual=F.date_id --AND d.date_actual in ('2020-09-01','2020-09-02','2020-09-03','2020-09-04','2020-09-05','2020-09-06','2020-09-07') AND d.date_actual in ('2020-09-01') And F.process_segment_id = p.id --AND p.process_segment_name in ('soap_line 2','soap_line 3','soap_line 4', 'soap_line 5', 'soap_line 6','soap_line 7') AND p.process_segment_name in ('soap_line 2') AND t.full_time = F.time_id AND t.shift_end = true AND k.id = F.kpi_id AND k.id = (14) --group by d.date_actual, t.full_time, p.process_segment_name ) as y on x.date_actual = y.date_actual join ( Select d.date_actual, t.full_time, p.process_segment_name, round((F.value_mean),2) as oee From dim_date d, dim_time_sec t, dim_process_segment p, dim_kpi k, second_fact F Where d.date_actual=F.date_id --AND d.date_actual in ('2020-09-01','2020-09-02','2020-09-03','2020-09-04','2020-09-05','2020-09-06','2020-09-07') AND d.date_actual in ('2020-09-01') And F.process_segment_id = p.id --AND p.process_segment_name in ('soap_line 2','soap_line 3','soap_line 4', 'soap_line 5', 'soap_line 6','soap_line 7') AND p.process_segment_name in ('soap_line 2') AND t.full_time = F.time_id AND t.shift_end = true AND k.id = F.kpi_id AND k.id = (16) --group by d.date_actual, t.full_time, p.process_segment_name ) as z on y.date_actual=z.date_actual --where x.date_actual = y.date_actual --and y.date_actual = z.date_actual --and x.process_segment_name = y.process_segment_name --and y.process_segment_name = z.process_segment_name --and x.full_time = y.full_time --and z.full_time = z.full_time group by x.process_segment_name --x.date_actual,x.full_time , --group by y.date_actual ,y.process_segment_name -------------------------------------------------------------------- --Simple use case of UK, i.e. one date and one process segment --All conditions inside and aggregations outside select x.date_actual, x.process_segment_name, avg(x.availability), avg(y.effectiveness), avg(z.oee) from ( Select d.date_actual, p.process_segment_name, k.id, round((F.value_mean),2) as availability From dim_date d, dim_process_segment p, dim_kpi k, second_fact F Where d.date_actual=F.date_id AND d.date_actual in ('2020-06-25') And F.process_segment_id = p.id AND p.process_segment_name in ('Soap Line 1') AND k.id = F.kpi_id AND k.id = (13) --group by d.date_actual, p.process_segment_name, k.id ) as x, ( Select d.date_actual, p.process_segment_name, k.id, round((F.value_mean),2) as effectiveness From dim_date d, dim_process_segment p, dim_kpi k, second_fact F Where d.date_actual=F.date_id AND d.date_actual in ('2020-06-25') And F.process_segment_id = p.id AND p.process_segment_name in ('Soap Line 1') AND k.id = F.kpi_id AND k.id = (14) --group by d.date_actual, p.process_segment_name, k.id ) as y, ( Select d.date_actual, p.process_segment_name, k.id,round((F.value_mean),2) as oee From dim_date d, dim_process_segment p, dim_kpi k, second_fact F Where d.date_actual=F.date_id AND d.date_actual in ('2020-06-25') And F.process_segment_id = p.id AND p.process_segment_name in ('Soap Line 1') AND k.id = F.kpi_id AND k.id = (16) --group by d.date_actual, p.process_segment_name,k.id ) as z group by x.date_actual, x.process_segment_name -------------------------------------------------------------------- --All conditions inside and aggregations outside --use case one -- Takes too much time select x.date_actual, x.process_segment_name, avg(x.availability), avg(y.effectiveness), avg(z.oee) from ( Select d.date_actual, p.process_segment_name, k.id, round((F.value_mean),2) as availability From dim_date d, dim_process_segment p, dim_kpi k, second_fact F Where d.date_actual=F.date_id AND d.date_actual in ('2020-09-01','2020-09-02','2020-09-03','2020-09-04','2020-09-05','2020-09-06','2020-09-07') And F.process_segment_id = p.id AND p.process_segment_name in ('soap_line 2','soap_line 3','soap_line 4', 'soap_line 5', 'soap_line 6','soap_line 7') AND k.id = F.kpi_id AND k.id = (13) --group by d.date_actual, p.process_segment_name, k.id ) as x, ( Select d.date_actual, p.process_segment_name, k.id, round((F.value_mean),2) as effectiveness From dim_date d, dim_process_segment p, dim_kpi k, second_fact F Where d.date_actual=F.date_id AND d.date_actual in ('2020-09-01','2020-09-02','2020-09-03','2020-09-04','2020-09-05','2020-09-06','2020-09-07') And F.process_segment_id = p.id AND p.process_segment_name in ('soap_line 2','soap_line 3','soap_line 4', 'soap_line 5', 'soap_line 6','soap_line 7') AND k.id = F.kpi_id AND k.id = (14) --group by d.date_actual, p.process_segment_name, k.id ) as y, ( Select d.date_actual, p.process_segment_name, k.id,round((F.value_mean),2) as oee From dim_date d, dim_process_segment p, dim_kpi k, second_fact F Where d.date_actual=F.date_id AND d.date_actual in ('2020-09-01','2020-09-02','2020-09-03','2020-09-04','2020-09-05','2020-09-06','2020-09-07') And F.process_segment_id = p.id AND p.process_segment_name in ('soap_line 2','soap_line 3','soap_line 4', 'soap_line 5', 'soap_line 6','soap_line 7') AND k.id = F.kpi_id AND k.id = (16) --group by d.date_actual, p.process_segment_name,k.id ) as z group by x.date_actual, x.process_segment_name ---------------------------------------------- --Conditions outside and aggregations inside-->possibility of wrong results because aggreagations don't have enough and conditions. --However, rest of the conditions are provided outside. The only problem is aggregating on the process etc which are outside. select d.date_actual, p.process_segment_name, x.availability, y.effectiveness, z.oee from ( Select k.id, round(avg(F.value_mean),2) as availability From dim_kpi k, second_fact F Where k.id = F.kpi_id AND k.id = 13 group by k.id ) x, ( Select k.id, round(avg(F.value_mean),2) as effectiveness From dim_kpi k, second_fact F Where k.id = F.kpi_id AND k.id = 14 group by k.id ) y, ( Select k.id, round(avg(F.value_mean),2) as oee From dim_kpi k, second_fact F Where k.id = F.kpi_id AND k.id = 16 group by k.id ) z, dim_date d, dim_process_segment p, second_fact F Where d.date_actual=F.date_id AND d.date_actual in ('2020-06-25') --AND d.date_actual in ('2020-09-01','2020-09-02','2020-09-03','2020-09-04','2020-09-05','2020-09-06','2020-09-07') --AND t.full_time = F.time_id And F.process_segment_id = p.id AND p.process_segment_name in ('Soap Line 1') --AND p.process_segment_name in ('soap_line 2','soap_line 3','soap_line 4', 'soap_line 5', 'soap_line 6','soap_line 7') ------------------ --Conditions outside and aggregations outside as well -->group by at sub query level will be removed and applied at higher level--> possible problem is slow performance because -- of large data at the sub-query level --> takess too much time select p.process_segment_name, avg(x.availability), avg(y.effectiveness), avg(z.oee) from ( Select k.id, round((F.value_mean),2) as availability From dim_kpi k, second_fact F Where k.id = F.kpi_id AND k.id = 13 --group by k.id ) x, ( Select k.id, round((F.value_mean),2) as effectiveness From dim_kpi k, second_fact F Where k.id = F.kpi_id AND k.id = 14 --group by k.id ) y, ( Select k.id, round((F.value_mean),2) as oee From dim_kpi k, second_fact F Where k.id = F.kpi_id AND k.id = 16 --group by k.id ) z, dim_date d, dim_process_segment p, second_fact F Where d.date_actual=F.date_id AND d.date_actual in ('2020-06-25') --AND d.date_actual in ('2020-09-01','2020-09-02','2020-09-03','2020-09-04','2020-09-05','2020-09-06','2020-09-07') --AND t.full_time = F.time_id And F.process_segment_id = p.id AND p.process_segment_name in ('Soap Line 1') --AND p.process_segment_name in ('soap_line 2','soap_line 3','soap_line 4', 'soap_line 5', 'soap_line 6','soap_line 7') group by p.process_segment_name -------------------------------- --Removing fact table and kpi dim id join from the subqueries as well --> takes too much time create index index_complete_facttable on second_fact (kpi_id) select F.date_id, p.process_segment_name, avg(x.availability), avg(y.effectiveness), avg(z.oee) from ( Select (F.value_mean) as availability From second_fact F Where F.kpi_id = 13 ) x, ( Select (F.value_mean) as effectiveness From second_fact F Where F.kpi_id = 14 ) y, ( Select F.value_mean as oee From second_fact F Where F.kpi_id = 16 ) z, dim_date d, dim_process_segment p, second_fact F Where F.date_id in ('2020-06-25') --AND d.date_actual in ('2020-09-01','2020-09-02','2020-09-03','2020-09-04','2020-09-05','2020-09-06','2020-09-07') --AND t.full_time = F.time_id AND F.kpi_id in (13,14,16) And F.process_segment_id = p.id AND p.process_segment_name in ('Soap Line 1') --AND p.process_segment_name in ('soap_line 2','soap_line 3','soap_line 4', 'soap_line 5', 'soap_line 6','soap_line 7') group by F.date_id,p.process_segment_name
true
e13b8cbd0d4bcea05ca77dbc50d87b91ff6bf5cb
SQL
Frimish/rent_house
/source/create.sql
UTF-8
14,278
4
4
[]
no_license
drop database if exists renting; create database renting default charset=utf8; use renting; -- 用户信息表 create table t_user( id int primary key auto_increment comment '用户主键', loginname varchar(32) comment '用户登录名', nickname varchar(50) comment '昵称', password varchar(32) not null comment '密码', phone varchar(32) comment '手机号码', role varchar(32) comment '角色', email varchar(50) comment '邮箱', imageUrl varchar(256) comment '头像', loginDate datetime comment '登录日期', createDate datetime comment '创建日期', status int(1) default 1 comment '状态:1启用,-1禁用' )engine=innodb default charset=utf8 comment '用户信息表'; -- 地区表 create table t_area( id int primary key auto_increment comment '地区主键', name varchar(150) comment '地区名称', parentId int comment '所属地区的id', foreign key(parentId) references t_area(id) )engine=innodb default charset=utf8 comment '地区表'; -- 房源信息表 create table t_house_info( id int primary key auto_increment comment '房源信息主键', communityName varchar(256) comment '小区名称', areaId int comment '所在地区的id', roomNo text comment '门牌号,几幢几单元几室等等', rentType varchar(32) comment '租赁方式:整租,合租', houseType varchar(64) comment '户型:几室几厅', acreage double default 0 comment '面积m2', rent int default 0 comment '租金:元/月(不含小数)', payType varchar(32) comment '付款方式:月付,半年付,一年付...', floorInfo varchar(128) comment '楼层信息:几层-几层,共几层;例:2-3,2', houseState varchar(128) comment '房屋状态:毛坯,简装,精装,豪华装;方向:南,西南,东,东南,北,东北,西,西北,南北,东西', equips varchar(256) comment '房屋配套的设备等:床,冰箱,电视,空调,洗衣机,热水器,家具,宽带,可做饭,独立卫生间...全无', title varchar(256) comment '标题', detail longtext comment '详细介绍', linkman varchar(32) comment '联系人', phone varchar(32) comment '手机号码', userId int comment '用户表id', status int(1) default 1 comment '状态:1启用,-1禁用', createTime datetime comment '创建时间', updateTime datetime comment '更新时间', sign varchar(128) comment '品牌', metroDistance int comment '距离地铁的距离,单位米', lookAtAnyTime int(1) default 1 comment '可随时看房1,不可-1', balcony int(1) default 1 comment '1是独立阳台,-1不是', toilet int(1) default 1 comment '1是独卫,-1不是', count int default 0 comment '浏览房源信息人员数量', foreign key(userId) references t_user(id), foreign key(areaId) references t_area(id) )engine=innodb default charset=utf8 comment '房源信息表'; -- 附件表 create table t_enclosure( id int primary key auto_increment comment '附件主键', path varchar(256) comment '附件的相对路径', houseInfoId int comment '附件所属的房源信息的id', status int(1) default 1 comment '状态:1启用,-1禁用', foreign key(houseInfoId) references t_house_info(id) )engine=innodb default charset=utf8 comment '附件表'; create table t_view_house_info ( id int primary key auto_increment comment '附件主键', houseInfoId int comment '附件所属的房源信息的id', userId int comment '用户表id', foreign key(userId) references t_user(id), foreign key(houseInfoId) references t_house_info(id) )engine=innodb default charset=utf8 comment '浏览房源信息人员表'; insert into t_user (id,loginname,nickname,password,phone,role,email,imageUrl,loginDate,createDate,status) values (1, 'admin', '管理员', '3C3642386047237E0D3450666F757C65', '12345678901', 'admin', 'admin@itany.com', 'imageUrl', null, now(), 1); -- 地区表初始数据 insert into t_area (id,name,parentId) values (1,'江苏',null); insert into t_area (id,name,parentId) values (2,'南京',1); insert into t_area (id,name,parentId) values (3,'玄武',2); insert into t_area (id,name,parentId) values (4,'鼓楼',2); insert into t_area (id,name,parentId) values (5,'建邺',2); insert into t_area (id,name,parentId) values (6,'秦淮',2); insert into t_area (id,name,parentId) values (7,'雨花台',2); insert into t_area (id,name,parentId) values (8,'栖霞',2); insert into t_area (id,name,parentId) values (9,'江宁',2); insert into t_area (id,name,parentId) values (10,'浦口',2); insert into t_area (id,name,parentId) values (11,'六合',2); insert into t_area (id,name,parentId) values (12,'溧水',2); insert into t_area (id,name,parentId) values (13,'高淳',2); insert into t_area (id,name,parentId) values (null,'北京东路',3); insert into t_area (id,name,parentId) values (null,'丹凤街',3); insert into t_area (id,name,parentId) values (null,'后宰门',3); insert into t_area (id,name,parentId) values (null,'锁金村',3); insert into t_area (id,name,parentId) values (null,'卫岗',3); insert into t_area (id,name,parentId) values (null,'玄武门',3); insert into t_area (id,name,parentId) values (null,'樱驼花园',3); insert into t_area (id,name,parentId) values (null,'月苑',3); insert into t_area (id,name,parentId) values (null,'珠江路',3); insert into t_area (id,name,parentId) values (null,'孝陵卫',3); insert into t_area (id,name,parentId) values (null,'红山',3); insert into t_area (id,name,parentId) values (null,'长江路',3); insert into t_area (id,name,parentId) values (null,'福建路',4); insert into t_area (id,name,parentId) values (null,'江东',4); insert into t_area (id,name,parentId) values (null,'水佐岗',4); insert into t_area (id,name,parentId) values (null,'湖南路',4); insert into t_area (id,name,parentId) values (null,'华侨路',4); insert into t_area (id,name,parentId) values (null,'龙江',4); insert into t_area (id,name,parentId) values (null,'凤凰西街',4); insert into t_area (id,name,parentId) values (null,'三牌楼',4); insert into t_area (id,name,parentId) values (null,'宁海路',4); insert into t_area (id,name,parentId) values (null,'许府巷',4); insert into t_area (id,name,parentId) values (null,'大桥南路',4); insert into t_area (id,name,parentId) values (null,'建宁路',4); insert into t_area (id,name,parentId) values (null,'金陵小区',4); insert into t_area (id,name,parentId) values (null,'热河南路',4); insert into t_area (id,name,parentId) values (null,'五塘广场',4); insert into t_area (id,name,parentId) values (null,'小市',4); insert into t_area (id,name,parentId) values (null,'定淮门',4); insert into t_area (id,name,parentId) values (null,'万达广场',5); insert into t_area (id,name,parentId) values (null,'水西门',5); insert into t_area (id,name,parentId) values (null,'茶南',5); insert into t_area (id,name,parentId) values (null,'奥体',5); insert into t_area (id,name,parentId) values (null,'南湖',5); insert into t_area (id,name,parentId) values (null,'南苑',5); insert into t_area (id,name,parentId) values (null,'兴隆',5); insert into t_area (id,name,parentId) values (null,'应天西路',5); insert into t_area (id,name,parentId) values (null,'江心洲',5); insert into t_area (id,name,parentId) values (null,'奥南',5); insert into t_area (id,name,parentId) values (null,'常府街',6); insert into t_area (id,name,parentId) values (null,'朝天宫',6); insert into t_area (id,name,parentId) values (null,'大光路',6); insert into t_area (id,name,parentId) values (null,'瑞金路',6); insert into t_area (id,name,parentId) values (null,'五老村',6); insert into t_area (id,name,parentId) values (null,'新街口',6); insert into t_area (id,name,parentId) values (null,'苜蓿园',6); insert into t_area (id,name,parentId) values (null,'长乐路',6); insert into t_area (id,name,parentId) values (null,'夫子庙',6); insert into t_area (id,name,parentId) values (null,'洪家园',6); insert into t_area (id,name,parentId) values (null,'集庆路',6); insert into t_area (id,name,parentId) values (null,'秦虹',6); insert into t_area (id,name,parentId) values (null,'来凤',6); insert into t_area (id,name,parentId) values (null,'大明路',6); insert into t_area (id,name,parentId) values (null,'海福巷',6); insert into t_area (id,name,parentId) values (null,'中华门',6); insert into t_area (id,name,parentId) values (null,'升州路',6); insert into t_area (id,name,parentId) values (null,'光华门',6); insert into t_area (id,name,parentId) values (null,'安德门',7); insert into t_area (id,name,parentId) values (null,'小行',7); insert into t_area (id,name,parentId) values (null,'能仁里',7); insert into t_area (id,name,parentId) values (null,'宁南',7); insert into t_area (id,name,parentId) values (null,'西善桥',7); insert into t_area (id,name,parentId) values (null,'雨花新村',7); insert into t_area (id,name,parentId) values (null,'铁心桥',7); insert into t_area (id,name,parentId) values (null,'板桥街道',7); insert into t_area (id,name,parentId) values (null,'梅山',7); insert into t_area (id,name,parentId) values (null,'南京南站',7); insert into t_area (id,name,parentId) values (null,'迈皋桥t',8); insert into t_area (id,name,parentId) values (null,'马群',8); insert into t_area (id,name,parentId) values (null,'炼油厂',8); insert into t_area (id,name,parentId) values (null,'仙林',8); insert into t_area (id,name,parentId) values (null,'晓庄',8); insert into t_area (id,name,parentId) values (null,'仙林湖',8); insert into t_area (id,name,parentId) values (null,'燕子矶',8); insert into t_area (id,name,parentId) values (null,'龙潭街道',8); insert into t_area (id,name,parentId) values (null,'尧化门',8); insert into t_area (id,name,parentId) values (null,'万寿',8); insert into t_area (id,name,parentId) values (null,'八卦洲',8); insert into t_area (id,name,parentId) values (null,'将军大道',9); insert into t_area (id,name,parentId) values (null,'岔路口',9); insert into t_area (id,name,parentId) values (null,'百家湖',9); insert into t_area (id,name,parentId) values (null,'东山街道',9); insert into t_area (id,name,parentId) values (null,'江宁大学城',9); insert into t_area (id,name,parentId) values (null,'上坊',9); insert into t_area (id,name,parentId) values (null,'麒麟',9); insert into t_area (id,name,parentId) values (null,'汤山',9); insert into t_area (id,name,parentId) values (null,'禄口',9); insert into t_area (id,name,parentId) values (null,'科学园',9); insert into t_area (id,name,parentId) values (null,'横溪街道',9); insert into t_area (id,name,parentId) values (null,'滨江开发区',9); insert into t_area (id,name,parentId) values (null,'湖熟街道',9); insert into t_area (id,name,parentId) values (null,'秣陵街道',9); insert into t_area (id,name,parentId) values (null,'淳化街道',9); insert into t_area (id,name,parentId) values (null,'谷里',9); insert into t_area (id,name,parentId) values (null,'陶吴镇',9); insert into t_area (id,name,parentId) values (null,'九龙湖',9); insert into t_area (id,name,parentId) values (null,'南京南站',9); insert into t_area (id,name,parentId) values (null,'桥北',10); insert into t_area (id,name,parentId) values (null,'高新',10); insert into t_area (id,name,parentId) values (null,'泰山',10); insert into t_area (id,name,parentId) values (null,'沿江街道',10); insert into t_area (id,name,parentId) values (null,'江浦街道',10); insert into t_area (id,name,parentId) values (null,'顶山街道',10); insert into t_area (id,name,parentId) values (null,'汤泉街道',10); insert into t_area (id,name,parentId) values (null,'盘城街道',10); insert into t_area (id,name,parentId) values (null,'桥林街道',10); insert into t_area (id,name,parentId) values (null,'石桥镇',10); insert into t_area (id,name,parentId) values (null,'乌江镇',10); insert into t_area (id,name,parentId) values (null,'星甸街道',10); insert into t_area (id,name,parentId) values (null,'永宁街道',10); insert into t_area (id,name,parentId) values (null,'雄州街道',11); insert into t_area (id,name,parentId) values (null,'山潘街道',11); insert into t_area (id,name,parentId) values (null,'西厂门街道',11); insert into t_area (id,name,parentId) values (null,'卸甲甸街道',11); insert into t_area (id,name,parentId) values (null,'葛塘街道',11); insert into t_area (id,name,parentId) values (null,'长芦街道',11); insert into t_area (id,name,parentId) values (null,'龙池街道',11); insert into t_area (id,name,parentId) values (null,'金牛湖街道',11); insert into t_area (id,name,parentId) values (null,'四合街道',11); insert into t_area (id,name,parentId) values (null,'横梁街道',11); insert into t_area (id,name,parentId) values (null,'永阳街道',12); insert into t_area (id,name,parentId) values (null,'白马镇',12); insert into t_area (id,name,parentId) values (null,'溧水开发区',12); insert into t_area (id,name,parentId) values (null,'高淳区',13); insert into t_house_info (communityName,areaId,roomNo,rentType,houseType,acreage,rent,payType,floorInfo,houseState,equips,title,detail,linkman,phone,userId,status,createTime,updateTime,sign,metroDistance,lookAtAnyTime,balcony,toilet) values ('小区aa','14','1幢,1单元,107室','合租','3,2','89','2000','月付','2,12','简装,东南','床,冰箱,电视,空调,洗衣机,热水器,家具,宽带','简装 拎包入住 设施齐全', '细节描述...','联系人a','12345678901','1','1',now(),now(),'链家','230','1','1','1'); insert into t_house_info (communityName,areaId,roomNo,rentType,houseType,acreage,rent,payType,floorInfo,houseState,equips,title,detail,linkman,phone,userId,status,createTime,updateTime,sign,metroDistance,lookAtAnyTime,balcony,toilet) values ('小区xxx','15','4幢,2单元,107室','整租','2,1','72','1000','月付','6,11','简装,东南','床,冰箱,电视,空调,洗衣机,热水器,家具,宽带','简装 拎包入住 设施齐全', '细节描述...','联系人ccc','12345678902','1','1',now(),now(),'链家','235','1','1','1');
true
d873fc3a948f6ec0b06776102228c700ca8bc6c3
SQL
WPI-SGA-Financials/Financial-Database-SQL
/Stored Procedure/Budget Allocation Stored Procedure.sql
UTF-8
244
3.0625
3
[]
no_license
Drop PROCEDURE if exists dashBudgetAlloc; Create PROCEDURE dashBudgetAlloc(IN FY integer(2)) SELECT concat('$', format(sum(`Amount Proposed` + `Approved Appeal`), 2)) as 'Total Budget' FROM Budgets WHERE `Fiscal Year` like concat('%', FY, '%');
true
d42b9dbdd39a0d887f134bad99cf888781a205a1
SQL
kevinthesiya242/quick
/quick.sql
UTF-8
10,647
2.78125
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 4.8.1 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Generation Time: Jun 23, 2019 at 09:38 AM -- Server version: 10.1.33-MariaDB -- PHP Version: 7.2.6 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET AUTOCOMMIT = 0; START TRANSACTION; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8mb4 */; -- -- Database: `quick` -- -- -------------------------------------------------------- -- -- Table structure for table `migrations` -- CREATE TABLE `migrations` ( `id` int(10) UNSIGNED NOT NULL, `migration` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, `batch` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `migrations` -- INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (1, '2014_10_12_000000_create_users_table', 1), (2, '2014_10_12_100000_create_password_resets_table', 1), (3, '2019_06_18_160249_create_1560862969_roles_table', 1), (4, '2019_06_18_160255_create_1560862974_users_table', 1), (5, '2019_06_18_160256_add_5d08e108842fe_relationships_to_user_table', 1), (6, '2019_06_18_160305_create_1560862985_product_categories_table', 1), (7, '2019_06_18_160309_create_1560862989_product_tags_table', 1), (8, '2019_06_18_160314_create_1560862994_products_table', 1), (9, '2019_06_18_160318_create_5d08e12058c36_product_product_category_table', 1), (10, '2019_06_18_160319_create_5d08e1205c9c7_product_product_tag_table', 1), (11, '2019_06_18_160455_update_1560863095_products_table', 1); -- -------------------------------------------------------- -- -- Table structure for table `password_resets` -- CREATE TABLE `password_resets` ( `email` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, `token` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, `created_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `password_resets` -- INSERT INTO `password_resets` (`email`, `token`, `created_at`) VALUES ('kevin.thesiya242@gmail.com', '$2y$10$yl3ltTxbpj8y4t2jU9nwGuzrGfIYSAFkamVaVCip1Vjwr9K2KBi9S', '2019-06-21 02:20:04'); -- -------------------------------------------------------- -- -- Table structure for table `products` -- CREATE TABLE `products` ( `id` int(10) UNSIGNED NOT NULL, `name` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `description` text COLLATE utf8mb4_unicode_ci, `price` decimal(15,2) DEFAULT NULL, `photo1` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `products` -- INSERT INTO `products` (`id`, `name`, `description`, `price`, `photo1`, `created_at`, `updated_at`) VALUES (1, 'adminpanel', 'framework', '1200.00', '1560916805-py.jpg', '2019-06-18 22:30:06', '2019-06-18 22:30:06'); -- -------------------------------------------------------- -- -- Table structure for table `product_categories` -- CREATE TABLE `product_categories` ( `id` int(10) UNSIGNED NOT NULL, `name` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `description` text COLLATE utf8mb4_unicode_ci, `photo` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `product_categories` -- INSERT INTO `product_categories` (`id`, `name`, `description`, `photo`, `created_at`, `updated_at`) VALUES (1, 'laravel', 'ddwdw', '1560916718-java.png', '2019-06-18 22:28:38', '2019-06-18 22:28:38'); -- -------------------------------------------------------- -- -- Table structure for table `product_product_category` -- CREATE TABLE `product_product_category` ( `product_id` int(10) UNSIGNED DEFAULT NULL, `product_category_id` int(10) UNSIGNED DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `product_product_category` -- INSERT INTO `product_product_category` (`product_id`, `product_category_id`) VALUES (1, 1); -- -------------------------------------------------------- -- -- Table structure for table `product_product_tag` -- CREATE TABLE `product_product_tag` ( `product_id` int(10) UNSIGNED DEFAULT NULL, `product_tag_id` int(10) UNSIGNED DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `product_product_tag` -- INSERT INTO `product_product_tag` (`product_id`, `product_tag_id`) VALUES (1, 1); -- -------------------------------------------------------- -- -- Table structure for table `product_tags` -- CREATE TABLE `product_tags` ( `id` int(10) UNSIGNED NOT NULL, `name` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `product_tags` -- INSERT INTO `product_tags` (`id`, `name`, `created_at`, `updated_at`) VALUES (1, 'laravel 5.8.*', '2019-06-18 22:29:08', '2019-06-18 22:29:08'); -- -------------------------------------------------------- -- -- Table structure for table `roles` -- CREATE TABLE `roles` ( `id` int(10) UNSIGNED NOT NULL, `title` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `roles` -- INSERT INTO `roles` (`id`, `title`, `created_at`, `updated_at`) VALUES (1, 'Administrator (can create other users)', '2019-06-18 22:20:57', '2019-06-18 22:20:57'), (2, 'Simple user', '2019-06-18 22:20:57', '2019-06-18 22:20:57'); -- -------------------------------------------------------- -- -- Table structure for table `users` -- CREATE TABLE `users` ( `id` int(10) UNSIGNED NOT NULL, `name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, `email` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, `email_verified_at` timestamp NULL DEFAULT NULL, `password` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, `remember_token` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL, `role_id` int(10) UNSIGNED DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `users` -- INSERT INTO `users` (`id`, `name`, `email`, `email_verified_at`, `password`, `remember_token`, `created_at`, `updated_at`, `role_id`) VALUES (1, 'Admin', 'admin@admin.com', NULL, '$2y$10$mFM/VuijrrhgQFvZ4fOAsO/ruLT0JoHB23XnaC.mXlK/B2ezqzNpq', '5AM7svlMPkz1b3SsRMoL1HgafG3NxKHloYQQScwFmMCsYYtcQJqS5fw7H9Vv', '2019-06-18 22:20:57', '2019-06-18 22:20:57', 1), (2, 'kevin thesiya', 'kevin.thesiya242@gmail.com', NULL, '$2y$10$/rLO5p0iEiOZBmq1OjGLveRNgJQUAySAcKjeHLFb65PUFyrEkSie.', NULL, '2019-06-18 22:26:21', '2019-06-21 02:24:08', 2); -- -- Indexes for dumped tables -- -- -- Indexes for table `migrations` -- ALTER TABLE `migrations` ADD PRIMARY KEY (`id`); -- -- Indexes for table `password_resets` -- ALTER TABLE `password_resets` ADD KEY `password_resets_email_index` (`email`); -- -- Indexes for table `products` -- ALTER TABLE `products` ADD PRIMARY KEY (`id`); -- -- Indexes for table `product_categories` -- ALTER TABLE `product_categories` ADD PRIMARY KEY (`id`); -- -- Indexes for table `product_product_category` -- ALTER TABLE `product_product_category` ADD KEY `fk_p_315748_315746_produc_5d08e12058dec` (`product_id`), ADD KEY `fk_p_315746_315748_produc_5d08e12058f2c` (`product_category_id`); -- -- Indexes for table `product_product_tag` -- ALTER TABLE `product_product_tag` ADD KEY `fk_p_315748_315747_produc_5d08e1205cb7f` (`product_id`), ADD KEY `fk_p_315747_315748_produc_5d08e1205cc6c` (`product_tag_id`); -- -- Indexes for table `product_tags` -- ALTER TABLE `product_tags` ADD PRIMARY KEY (`id`); -- -- Indexes for table `roles` -- ALTER TABLE `roles` ADD PRIMARY KEY (`id`); -- -- Indexes for table `users` -- ALTER TABLE `users` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `users_email_unique` (`email`), ADD KEY `315744_5d08e10328a0f` (`role_id`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `migrations` -- ALTER TABLE `migrations` MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12; -- -- AUTO_INCREMENT for table `products` -- ALTER TABLE `products` MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; -- -- AUTO_INCREMENT for table `product_categories` -- ALTER TABLE `product_categories` MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; -- -- AUTO_INCREMENT for table `product_tags` -- ALTER TABLE `product_tags` MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; -- -- AUTO_INCREMENT for table `roles` -- ALTER TABLE `roles` MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3; -- -- AUTO_INCREMENT for table `users` -- ALTER TABLE `users` MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3; -- -- Constraints for dumped tables -- -- -- Constraints for table `product_product_category` -- ALTER TABLE `product_product_category` ADD CONSTRAINT `fk_p_315746_315748_produc_5d08e12058f2c` FOREIGN KEY (`product_category_id`) REFERENCES `product_categories` (`id`) ON DELETE CASCADE, ADD CONSTRAINT `fk_p_315748_315746_produc_5d08e12058dec` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE CASCADE; -- -- Constraints for table `product_product_tag` -- ALTER TABLE `product_product_tag` ADD CONSTRAINT `fk_p_315747_315748_produc_5d08e1205cc6c` FOREIGN KEY (`product_tag_id`) REFERENCES `product_tags` (`id`) ON DELETE CASCADE, ADD CONSTRAINT `fk_p_315748_315747_produc_5d08e1205cb7f` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE CASCADE; -- -- Constraints for table `users` -- ALTER TABLE `users` ADD CONSTRAINT `315744_5d08e10328a0f` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`) ON DELETE CASCADE; COMMIT; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
true
87b34312a4816b4a41be30dd54510d5b8ccb2af7
SQL
xiaosatufu/emos_online
/source/tool/emos.sql
UTF-8
23,528
3.3125
3
[]
no_license
/* Navicat Premium Data Transfer Source Server : localmysql Source Server Type : MySQL Source Server Version : 80023 Source Host : localhost:3306 Source Schema : emos Target Server Type : MySQL Target Server Version : 80023 File Encoding : 65001 Date: 16/04/2021 09:50:59 */ SET NAMES utf8mb4; SET FOREIGN_KEY_CHECKS = 0; -- ---------------------------- -- Table structure for qrtz_blob_triggers -- ---------------------------- DROP TABLE IF EXISTS `qrtz_blob_triggers`; CREATE TABLE `qrtz_blob_triggers` ( `SCHED_NAME` varchar(120) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `TRIGGER_NAME` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `TRIGGER_GROUP` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `BLOB_DATA` blob, PRIMARY KEY (`SCHED_NAME`,`TRIGGER_NAME`,`TRIGGER_GROUP`) USING BTREE, KEY `SCHED_NAME` (`SCHED_NAME`,`TRIGGER_NAME`,`TRIGGER_GROUP`) USING BTREE, CONSTRAINT `qrtz_blob_triggers_ibfk_1` FOREIGN KEY (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) REFERENCES `qrtz_triggers` (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) ON DELETE RESTRICT ON UPDATE RESTRICT ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; -- ---------------------------- -- Table structure for qrtz_calendars -- ---------------------------- DROP TABLE IF EXISTS `qrtz_calendars`; CREATE TABLE `qrtz_calendars` ( `SCHED_NAME` varchar(120) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `CALENDAR_NAME` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `CALENDAR` blob NOT NULL, PRIMARY KEY (`SCHED_NAME`,`CALENDAR_NAME`) USING BTREE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; -- ---------------------------- -- Table structure for qrtz_cron_triggers -- ---------------------------- DROP TABLE IF EXISTS `qrtz_cron_triggers`; CREATE TABLE `qrtz_cron_triggers` ( `SCHED_NAME` varchar(120) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `TRIGGER_NAME` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `TRIGGER_GROUP` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `CRON_EXPRESSION` varchar(120) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `TIME_ZONE_ID` varchar(80) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL, PRIMARY KEY (`SCHED_NAME`,`TRIGGER_NAME`,`TRIGGER_GROUP`) USING BTREE, CONSTRAINT `qrtz_cron_triggers_ibfk_1` FOREIGN KEY (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) REFERENCES `qrtz_triggers` (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) ON DELETE RESTRICT ON UPDATE RESTRICT ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; -- ---------------------------- -- Table structure for qrtz_fired_triggers -- ---------------------------- DROP TABLE IF EXISTS `qrtz_fired_triggers`; CREATE TABLE `qrtz_fired_triggers` ( `SCHED_NAME` varchar(120) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `ENTRY_ID` varchar(95) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `TRIGGER_NAME` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `TRIGGER_GROUP` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `INSTANCE_NAME` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `FIRED_TIME` bigint NOT NULL, `SCHED_TIME` bigint NOT NULL, `PRIORITY` int NOT NULL, `STATE` varchar(16) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `JOB_NAME` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL, `JOB_GROUP` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL, `IS_NONCONCURRENT` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL, `REQUESTS_RECOVERY` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL, PRIMARY KEY (`SCHED_NAME`,`ENTRY_ID`) USING BTREE, KEY `IDX_QRTZ_FT_TRIG_INST_NAME` (`SCHED_NAME`,`INSTANCE_NAME`) USING BTREE, KEY `IDX_QRTZ_FT_INST_JOB_REQ_RCVRY` (`SCHED_NAME`,`INSTANCE_NAME`,`REQUESTS_RECOVERY`) USING BTREE, KEY `IDX_QRTZ_FT_J_G` (`SCHED_NAME`,`JOB_NAME`,`JOB_GROUP`) USING BTREE, KEY `IDX_QRTZ_FT_JG` (`SCHED_NAME`,`JOB_GROUP`) USING BTREE, KEY `IDX_QRTZ_FT_T_G` (`SCHED_NAME`,`TRIGGER_NAME`,`TRIGGER_GROUP`) USING BTREE, KEY `IDX_QRTZ_FT_TG` (`SCHED_NAME`,`TRIGGER_GROUP`) USING BTREE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; -- ---------------------------- -- Table structure for qrtz_job_details -- ---------------------------- DROP TABLE IF EXISTS `qrtz_job_details`; CREATE TABLE `qrtz_job_details` ( `SCHED_NAME` varchar(120) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `JOB_NAME` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `JOB_GROUP` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `DESCRIPTION` varchar(250) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL, `JOB_CLASS_NAME` varchar(250) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `IS_DURABLE` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `IS_NONCONCURRENT` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `IS_UPDATE_DATA` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `REQUESTS_RECOVERY` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `JOB_DATA` blob, PRIMARY KEY (`SCHED_NAME`,`JOB_NAME`,`JOB_GROUP`) USING BTREE, KEY `IDX_QRTZ_J_REQ_RECOVERY` (`SCHED_NAME`,`REQUESTS_RECOVERY`) USING BTREE, KEY `IDX_QRTZ_J_GRP` (`SCHED_NAME`,`JOB_GROUP`) USING BTREE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; -- ---------------------------- -- Table structure for qrtz_locks -- ---------------------------- DROP TABLE IF EXISTS `qrtz_locks`; CREATE TABLE `qrtz_locks` ( `SCHED_NAME` varchar(120) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `LOCK_NAME` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, PRIMARY KEY (`SCHED_NAME`,`LOCK_NAME`) USING BTREE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; -- ---------------------------- -- Table structure for qrtz_paused_trigger_grps -- ---------------------------- DROP TABLE IF EXISTS `qrtz_paused_trigger_grps`; CREATE TABLE `qrtz_paused_trigger_grps` ( `SCHED_NAME` varchar(120) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `TRIGGER_GROUP` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, PRIMARY KEY (`SCHED_NAME`,`TRIGGER_GROUP`) USING BTREE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; -- ---------------------------- -- Table structure for qrtz_scheduler_state -- ---------------------------- DROP TABLE IF EXISTS `qrtz_scheduler_state`; CREATE TABLE `qrtz_scheduler_state` ( `SCHED_NAME` varchar(120) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `INSTANCE_NAME` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `LAST_CHECKIN_TIME` bigint NOT NULL, `CHECKIN_INTERVAL` bigint NOT NULL, PRIMARY KEY (`SCHED_NAME`,`INSTANCE_NAME`) USING BTREE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; -- ---------------------------- -- Table structure for qrtz_simple_triggers -- ---------------------------- DROP TABLE IF EXISTS `qrtz_simple_triggers`; CREATE TABLE `qrtz_simple_triggers` ( `SCHED_NAME` varchar(120) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `TRIGGER_NAME` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `TRIGGER_GROUP` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `REPEAT_COUNT` bigint NOT NULL, `REPEAT_INTERVAL` bigint NOT NULL, `TIMES_TRIGGERED` bigint NOT NULL, PRIMARY KEY (`SCHED_NAME`,`TRIGGER_NAME`,`TRIGGER_GROUP`) USING BTREE, CONSTRAINT `qrtz_simple_triggers_ibfk_1` FOREIGN KEY (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) REFERENCES `qrtz_triggers` (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) ON DELETE RESTRICT ON UPDATE RESTRICT ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; -- ---------------------------- -- Table structure for qrtz_simprop_triggers -- ---------------------------- DROP TABLE IF EXISTS `qrtz_simprop_triggers`; CREATE TABLE `qrtz_simprop_triggers` ( `SCHED_NAME` varchar(120) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `TRIGGER_NAME` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `TRIGGER_GROUP` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `STR_PROP_1` varchar(512) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL, `STR_PROP_2` varchar(512) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL, `STR_PROP_3` varchar(512) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL, `INT_PROP_1` int DEFAULT NULL, `INT_PROP_2` int DEFAULT NULL, `LONG_PROP_1` bigint DEFAULT NULL, `LONG_PROP_2` bigint DEFAULT NULL, `DEC_PROP_1` decimal(13,4) DEFAULT NULL, `DEC_PROP_2` decimal(13,4) DEFAULT NULL, `BOOL_PROP_1` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL, `BOOL_PROP_2` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL, PRIMARY KEY (`SCHED_NAME`,`TRIGGER_NAME`,`TRIGGER_GROUP`) USING BTREE, CONSTRAINT `qrtz_simprop_triggers_ibfk_1` FOREIGN KEY (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) REFERENCES `qrtz_triggers` (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) ON DELETE RESTRICT ON UPDATE RESTRICT ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; -- ---------------------------- -- Table structure for qrtz_triggers -- ---------------------------- DROP TABLE IF EXISTS `qrtz_triggers`; CREATE TABLE `qrtz_triggers` ( `SCHED_NAME` varchar(120) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `TRIGGER_NAME` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `TRIGGER_GROUP` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `JOB_NAME` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `JOB_GROUP` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `DESCRIPTION` varchar(250) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL, `NEXT_FIRE_TIME` bigint DEFAULT NULL, `PREV_FIRE_TIME` bigint DEFAULT NULL, `PRIORITY` int DEFAULT NULL, `TRIGGER_STATE` varchar(16) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `TRIGGER_TYPE` varchar(8) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `START_TIME` bigint NOT NULL, `END_TIME` bigint DEFAULT NULL, `CALENDAR_NAME` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL, `MISFIRE_INSTR` smallint DEFAULT NULL, `JOB_DATA` blob, PRIMARY KEY (`SCHED_NAME`,`TRIGGER_NAME`,`TRIGGER_GROUP`) USING BTREE, KEY `IDX_QRTZ_T_J` (`SCHED_NAME`,`JOB_NAME`,`JOB_GROUP`) USING BTREE, KEY `IDX_QRTZ_T_JG` (`SCHED_NAME`,`JOB_GROUP`) USING BTREE, KEY `IDX_QRTZ_T_C` (`SCHED_NAME`,`CALENDAR_NAME`) USING BTREE, KEY `IDX_QRTZ_T_G` (`SCHED_NAME`,`TRIGGER_GROUP`) USING BTREE, KEY `IDX_QRTZ_T_STATE` (`SCHED_NAME`,`TRIGGER_STATE`) USING BTREE, KEY `IDX_QRTZ_T_N_STATE` (`SCHED_NAME`,`TRIGGER_NAME`,`TRIGGER_GROUP`,`TRIGGER_STATE`) USING BTREE, KEY `IDX_QRTZ_T_N_G_STATE` (`SCHED_NAME`,`TRIGGER_GROUP`,`TRIGGER_STATE`) USING BTREE, KEY `IDX_QRTZ_T_NEXT_FIRE_TIME` (`SCHED_NAME`,`NEXT_FIRE_TIME`) USING BTREE, KEY `IDX_QRTZ_T_NFT_ST` (`SCHED_NAME`,`TRIGGER_STATE`,`NEXT_FIRE_TIME`) USING BTREE, KEY `IDX_QRTZ_T_NFT_MISFIRE` (`SCHED_NAME`,`MISFIRE_INSTR`,`NEXT_FIRE_TIME`) USING BTREE, KEY `IDX_QRTZ_T_NFT_ST_MISFIRE` (`SCHED_NAME`,`MISFIRE_INSTR`,`NEXT_FIRE_TIME`,`TRIGGER_STATE`) USING BTREE, KEY `IDX_QRTZ_T_NFT_ST_MISFIRE_GRP` (`SCHED_NAME`,`MISFIRE_INSTR`,`NEXT_FIRE_TIME`,`TRIGGER_GROUP`,`TRIGGER_STATE`) USING BTREE, CONSTRAINT `qrtz_triggers_ibfk_1` FOREIGN KEY (`SCHED_NAME`, `JOB_NAME`, `JOB_GROUP`) REFERENCES `qrtz_job_details` (`SCHED_NAME`, `JOB_NAME`, `JOB_GROUP`) ON DELETE RESTRICT ON UPDATE RESTRICT ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; -- ---------------------------- -- Table structure for sys_config -- ---------------------------- DROP TABLE IF EXISTS `sys_config`; CREATE TABLE `sys_config` ( `id` int unsigned NOT NULL AUTO_INCREMENT COMMENT '主键', `param_key` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '参数名', `param_value` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '参数值', `status` tinyint unsigned NOT NULL COMMENT '状态', `remark` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '备注', PRIMARY KEY (`id`) USING BTREE, UNIQUE KEY `unq_param_key` (`param_key`) USING BTREE, KEY `idx_status` (`status`) USING BTREE ) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; -- ---------------------------- -- Table structure for tb_action -- ---------------------------- DROP TABLE IF EXISTS `tb_action`; CREATE TABLE `tb_action` ( `id` int unsigned NOT NULL AUTO_INCREMENT COMMENT '主键', `action_code` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '行为编号', `action_name` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '行为名称', PRIMARY KEY (`id`) USING BTREE, UNIQUE KEY `unq_action_name` (`action_name`) USING BTREE ) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='行为表'; -- ---------------------------- -- Table structure for tb_checkin -- ---------------------------- DROP TABLE IF EXISTS `tb_checkin`; CREATE TABLE `tb_checkin` ( `id` int unsigned NOT NULL AUTO_INCREMENT COMMENT '主键', `user_id` int unsigned NOT NULL COMMENT '用户ID', `address` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '签到地址', `country` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '国家', `province` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '省份', `city` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '城市', `district` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '区划', `status` tinyint unsigned NOT NULL COMMENT '考勤结果', `risk` int unsigned DEFAULT '0' COMMENT '风险等级', `date` date NOT NULL COMMENT '签到日期', `create_time` datetime NOT NULL COMMENT '签到时间', PRIMARY KEY (`id`) USING BTREE, UNIQUE KEY `unq_user_id` (`user_id`,`date`) USING BTREE, KEY `idx_date` (`date`) USING BTREE, KEY `idx_status` (`status`) USING BTREE ) ENGINE=InnoDB AUTO_INCREMENT=50 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='签到表'; -- ---------------------------- -- Table structure for tb_city -- ---------------------------- DROP TABLE IF EXISTS `tb_city`; CREATE TABLE `tb_city` ( `id` int unsigned NOT NULL AUTO_INCREMENT COMMENT '主键', `city` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '城市名称', `code` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '拼音简称', PRIMARY KEY (`id`) USING BTREE, KEY `idx_city` (`city`) USING BTREE ) ENGINE=InnoDB AUTO_INCREMENT=330 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='疫情城市列表'; -- ---------------------------- -- Table structure for tb_dept -- ---------------------------- DROP TABLE IF EXISTS `tb_dept`; CREATE TABLE `tb_dept` ( `id` int unsigned NOT NULL AUTO_INCREMENT COMMENT '主键', `dept_name` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '部门名称', PRIMARY KEY (`id`) USING BTREE, UNIQUE KEY `unq_dept_name` (`dept_name`) USING BTREE ) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; -- ---------------------------- -- Table structure for tb_employee -- ---------------------------- DROP TABLE IF EXISTS `tb_employee`; CREATE TABLE `tb_employee` ( `code` int unsigned NOT NULL AUTO_INCREMENT COMMENT '注册码', `name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '姓名', `tel` char(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '电话', `email` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '邮箱', `hiredate` date NOT NULL COMMENT '入职日期', `role` json NOT NULL COMMENT '角色', `dept_id` int NOT NULL COMMENT '部门id', `sex` enum('男','女') CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT '男' COMMENT '性别', `state` tinyint NOT NULL DEFAULT '0' COMMENT '状态', PRIMARY KEY (`code`) ) ENGINE=InnoDB AUTO_INCREMENT=1011 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; -- ---------------------------- -- Table structure for tb_face_model -- ---------------------------- DROP TABLE IF EXISTS `tb_face_model`; CREATE TABLE `tb_face_model` ( `id` int unsigned NOT NULL AUTO_INCREMENT COMMENT '主键值', `user_id` int unsigned NOT NULL COMMENT '用户ID', `face_model` text CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '用户人脸模型', PRIMARY KEY (`id`) USING BTREE, UNIQUE KEY `unq_user_id` (`user_id`) USING BTREE ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; -- ---------------------------- -- Table structure for tb_holidays -- ---------------------------- DROP TABLE IF EXISTS `tb_holidays`; CREATE TABLE `tb_holidays` ( `id` int unsigned NOT NULL AUTO_INCREMENT COMMENT '主键', `date` date NOT NULL COMMENT '日期', PRIMARY KEY (`id`) USING BTREE, UNIQUE KEY `unq_date` (`date`) USING BTREE ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='节假日表'; -- ---------------------------- -- Table structure for tb_meeting -- ---------------------------- DROP TABLE IF EXISTS `tb_meeting`; CREATE TABLE `tb_meeting` ( `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT '主键', `uuid` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT 'UUID', `title` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '会议题目', `creator_id` bigint NOT NULL COMMENT '创建人ID', `date` date NOT NULL COMMENT '日期', `place` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '开会地点', `start` time NOT NULL COMMENT '开始时间', `end` time NOT NULL COMMENT '结束时间', `type` smallint NOT NULL COMMENT '会议类型(1在线会议,2线下会议)', `members` json NOT NULL COMMENT '参与者', `desc` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '会议内容', `instance_id` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '工作流实例ID', `status` smallint NOT NULL COMMENT '状态(1未开始,2进行中,3已结束)', `create_time` datetime NOT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '创建时间', PRIMARY KEY (`id`) USING BTREE, KEY `idx_creator_id` (`creator_id`) USING BTREE, KEY `idx_date` (`date`) USING BTREE, KEY `idx_type` (`type`) USING BTREE, KEY `idx_status` (`status`) USING BTREE ) ENGINE=InnoDB AUTO_INCREMENT=1372 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='会议表'; -- ---------------------------- -- Table structure for tb_meeting_approval -- ---------------------------- DROP TABLE IF EXISTS `tb_meeting_approval`; CREATE TABLE `tb_meeting_approval` ( `id` bigint unsigned NOT NULL AUTO_INCREMENT, `uuid` varchar(200) NOT NULL COMMENT 'uuid', `last_user` bigint DEFAULT NULL COMMENT '最后审批人', `members` json NOT NULL COMMENT '需要审批的人元列表', `approvals` json DEFAULT NULL COMMENT '已经审批的人员列表', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; -- ---------------------------- -- Table structure for tb_module -- ---------------------------- DROP TABLE IF EXISTS `tb_module`; CREATE TABLE `tb_module` ( `id` int unsigned NOT NULL AUTO_INCREMENT COMMENT '主键', `module_code` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '模块编号', `module_name` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '模块名称', PRIMARY KEY (`id`) USING BTREE, UNIQUE KEY `unq_module_id` (`module_code`) USING BTREE ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='模块资源表'; -- ---------------------------- -- Table structure for tb_permission -- ---------------------------- DROP TABLE IF EXISTS `tb_permission`; CREATE TABLE `tb_permission` ( `id` int unsigned NOT NULL AUTO_INCREMENT COMMENT '主键', `permission_name` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '权限', `module_id` int unsigned NOT NULL COMMENT '模块ID', `action_id` int unsigned NOT NULL COMMENT '行为ID', PRIMARY KEY (`id`) USING BTREE, UNIQUE KEY `unq_permission` (`permission_name`) USING BTREE, UNIQUE KEY `unq_complex` (`module_id`,`action_id`) USING BTREE ) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; -- ---------------------------- -- Table structure for tb_role -- ---------------------------- DROP TABLE IF EXISTS `tb_role`; CREATE TABLE `tb_role` ( `id` int unsigned NOT NULL AUTO_INCREMENT COMMENT '主键', `role_name` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '角色名称', `permissions` json NOT NULL COMMENT '权限集合', PRIMARY KEY (`id`) USING BTREE, UNIQUE KEY `unq_role_name` (`role_name`) USING BTREE ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='角色表'; -- ---------------------------- -- Table structure for tb_user -- ---------------------------- DROP TABLE IF EXISTS `tb_user`; CREATE TABLE `tb_user` ( `id` int unsigned NOT NULL AUTO_INCREMENT COMMENT '主键', `open_id` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '长期授权字符串', `nickname` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '昵称', `photo` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '头像网址', `name` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '姓名', `sex` enum('男','女') CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '性别', `tel` char(11) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '手机号码', `email` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '邮箱', `hiredate` date DEFAULT NULL COMMENT '入职日期', `role` json NOT NULL COMMENT '角色', `root` tinyint(1) NOT NULL COMMENT '是否是超级管理员', `dept_id` int unsigned DEFAULT NULL COMMENT '部门编号', `status` tinyint NOT NULL COMMENT '状态', `create_time` datetime NOT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '创建时间', PRIMARY KEY (`id`) USING BTREE, UNIQUE KEY `unq_open_id` (`open_id`) USING BTREE, KEY `unq_email` (`email`) USING BTREE, KEY `idx_dept_id` (`dept_id`) USING BTREE, KEY `idx_status` (`status`) USING BTREE ) ENGINE=InnoDB AUTO_INCREMENT=83 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='用户表'; -- ---------------------------- -- Table structure for tb_workday -- ---------------------------- DROP TABLE IF EXISTS `tb_workday`; CREATE TABLE `tb_workday` ( `id` int NOT NULL COMMENT '主键', `date` date DEFAULT NULL COMMENT '日期', PRIMARY KEY (`id`) USING BTREE, UNIQUE KEY `unq_date` (`date`) USING BTREE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; SET FOREIGN_KEY_CHECKS = 1;
true
21c216eb9c6d285f864d3d95d3e8faa8a4218ee7
SQL
MiroX3600/El-Pica-LapisLazuli
/PIA/ProyectoFinal (P6).sql
ISO-8859-1
24,804
3.53125
4
[]
no_license
Create database ProyectoFin use ProyectoFin Create table PtoDeVenta ( Pto_ID int not null primary key, Calle varchar (50) not null, Colonia varchar (50) not null, Ciudad varchar (50) not null, Estado varchar (50) not null, Pais varchar (50) not null, Ubicacion as (Calle + ', ' + Colonia + ', ' + Ciudad + ', ' + Estado + ', ' + Pais), CodPostal bigint not null, HoraApertura time not null, HoraCerrado time not null ) Create table Empleado ( Empleado_ID int not null primary key, Nombre1 varchar (20) not null, Nombre2 varchar (20), Apellido1 varchar (20), Apellido2 varchar (20), NomCompleto as (Nombre1 + ' ' + Apellido1 + ' ' + Apellido2), Edad int not null, Correo varchar (30) not null, Calle varchar (30) not null, Colonia varchar (30) not null, Ciudad varchar (30) not null, Estado varchar (30) not null, Pais varchar (30) not null, Vivienda as (Calle + ', ' + Colonia + ', ' + Ciudad + ', ' + Estado + ', ' + Pais), SegSocial bigint not null, Puesto_ID int not null, Pto_ID int not null, Turno_ID int not null ) Alter table Empleado add Constraint FK_Puesto Foreign key (Puesto_ID) references Puesto (Puesto_ID) Alter table Empleado add Constraint FK_Pto Foreign key (Pto_ID) references PtoDeVenta (Pto_ID) Alter table Empleado add Constraint FK_Turno Foreign key (Turno_ID) references Turno (Turno_ID) Create table Puesto ( Puesto_ID int not null primary key, NombrePuesto varchar (30) not null, HoraEntrada time not null, HoraSalida time not null, --Horario PagoXHora int not null, HorasTrabajo int not null, Sueldo as (PagoXHora * HorasTrabajo) ) Create table Producto ( Producto_ID int not null primary key, Nombre varchar (20) not null, Marca_ID int not null, CantidadProducto int not null, Medida_ID int not null, Precio int not null, MesCadu int not null,--Mes_ID AoCadu int not null, FechaCadu as (MesCadu + '/' + AoCadu), Tamao_ID int not null, Categoria_ID int not null ) Alter table Producto add Constraint FK_Marca Foreign key (Marca_ID) references Marca (Marca_ID) Alter table Producto add Constraint FK_Medida Foreign key (Medida_ID) references Medida (Medida_ID) Alter table Producto add Constraint FK_Tamao Foreign key (Tamao_ID) references Tamao (Tamao_ID) Alter table Producto add Constraint FK_Categoria Foreign key (Categoria_ID) references Categoria (Categoria_ID) Alter table Producto add Constraint FK_Mes Foreign key (MesCadu) references Meses (Mes_ID) Alter table Producto drop column FechaCadu Create table Proovedor ( Proovedor_ID int not null primary key, NombreProo varchar (30) not null, TelProo bigint not null, CorreoProo varchar (30) ) Create table Almacen ( Almacen_ID int not null primary key, Calle varchar not null, Colonia varchar not null, Ciudad varchar not null, Estado varchar not null, Pais varchar not null, Ubicacion as (Calle + ', ' + Colonia + ', ' + Ciudad + ', ' + Estado + ', ' + Pais) ) alter table Almacen drop column Ubicacion alter table Almacen alter column Calle varchar (40) alter table Almacen alter column Colonia varchar (40) alter table Almacen alter column Ciudad varchar (40) alter table Almacen alter column Estado varchar (40) alter table Almacen alter column Pais varchar (40) alter table Almacen add Ubicacion as (Calle + ', ' + Colonia + ', ' + Ciudad + ', ' + Estado + ', ' + Pais) Create table Medida ( Medida_ID int not null primary key, Medida varchar (20) not null ) Create table Ticket ( TicketNum int not null primary key, Pto_ID int not null, Empleado_ID int not null, Producto_ID int not null, Precio int not null, Cantidad int not null, Total as (Precio * Cantidad), TotalPagado int not null, TipoPago_ID int not null, CantPago int not null,--eliminado Fecha datetime not null, Tarjeta_ID int ) Alter table Ticket add Constraint FK_PtoTicket Foreign key (Pto_ID) references PtoDeVenta (Pto_ID) Alter table Ticket add Constraint FK_Empleado Foreign key (Empleado_ID) references Empleado (Empleado_ID) Alter table Ticket add Constraint FK_Producto Foreign key (Producto_ID) references Producto (Producto_ID) Alter table Ticket add Constraint FK_TipPago Foreign key (TipoPago_ID) references TipoPago (TipoPago_ID) Alter table Ticket add Constraint FK_Tarjeta Foreign key (Tarjeta_ID) references Tarjeta (Tarjeta_ID) Alter table Ticket drop column CantPago Create table TipoPago ( TipoPago_ID int not null primary key, TipoPago varchar not null ) alter table TipoPago alter column TipoPago varchar (20) Create table Tarjeta ( Tarjeta_ID int not null primary key, NombreTarj varchar (20) not null, TipoTarj varchar (20) not null ) Create table Tamao ( Tamao_ID int not null primary key, Tamao varchar (20) not null ) Create table Reabasto ( ReabastoNum bigint not null primary key, Almacen_ID int not null, Proovedor_ID int not null, Producto_ID int not null, CostoXCanti int not null, Canti int not null, Total as (CostoXCanti * Canti), Pago int not null, Fecha datetime not null, Medida_ID int not null, Marca_ID int not null ) Alter table Reabasto add Constraint FK_Almacen Foreign key (Almacen_ID) references Almacen (Almacen_ID) Alter table Reabasto add Constraint FK_Proo Foreign key (Proovedor_ID) references Proovedor (Proovedor_ID) Alter table Reabasto add Constraint FK_Prod Foreign key (Producto_ID) references Producto (Producto_ID) Alter table Reabasto add Constraint FK_Medid Foreign key (Medida_ID) references Medida (Medida_ID) Alter table Reabasto add Constraint FK_Marc Foreign Key (Marca_ID) references Marca (Marca_ID) Create table Turno ( Turno_ID int not null primary key, Turno varchar (20) not null ) Create table Meses ( Mes_ID int not null primary key, Mes varchar (30) ) Create table Categoria ( Categoria_ID int not null primary key, Categoria varchar not null ) alter table Categoria alter column Categoria varchar (20) Create table Marca ( Marca_ID int not null primary key, Nombre varchar (30) not null, Proovedor_ID int not null ) Alter table Marca add Constraint FK_Proovedor Foreign key (Proovedor_ID) references Proovedor (Proovedor_ID) Create table Inventario ( Producto_ID int not null, Almacen_ID int not null, Cantidad int not null, Medida_ID int not null ) Alter table Inventario add Constraint FK_ProInv Foreign key (Producto_ID) references Producto (Producto_ID) Alter table Inventario add Constraint FK_AlmInv Foreign key (Almacen_ID) references Almacen (Almacen_ID) Alter table Inventario add Constraint FK_MedInv Foreign key (Medida_ID) references Medida (Medida_ID) ------------Valores PtoVenta---------- Insert into PtoDeVenta (Pto_ID, Calle, Colonia, Ciudad, Estado, Pais, CodPostal, HoraApertura, HoraCerrado) values (1, 'Sonora', 'San Miguel', 'Monterrey', 'Nuevo Leon', 'Mxico', 158475, '7:30:00', '20:00:00') Insert into PtoDeVenta (Pto_ID, Calle, Colonia, Ciudad, Estado, Pais, CodPostal, HoraApertura, HoraCerrado) values (2, 'Sino', 'Torres', 'San Nicolas', 'Nuevo Leon', 'Mxico', 521472, '7:30:00', '20:00:00') Insert into PtoDeVenta (Pto_ID, Calle, Colonia, Ciudad, Estado, Pais, CodPostal, HoraApertura, HoraCerrado) values (3, 'Cerro', 'Corona', 'San Pedro', 'Nuevo Leon', 'Mxico', 514879, '7:00:00', '22:00:00') Insert into PtoDeVenta (Pto_ID, Calle, Colonia, Ciudad, Estado, Pais, CodPostal, HoraApertura, HoraCerrado) values (4, 'Campana', 'Frida', 'San Nicolas', 'Nuevo Leon', 'Mxico', 548961, '7:30:00', '20:00:00') Insert into PtoDeVenta (Pto_ID, Calle, Colonia, Ciudad, Estado, Pais, CodPostal, HoraApertura, HoraCerrado) values (5, 'Trino', 'Trono', 'San Nicolas', 'Nuevo Leon', 'Mxico', 256987, '7:15:00', '20:00:00') Insert into PtoDeVenta (Pto_ID, Calle, Colonia, Ciudad, Estado, Pais, CodPostal, HoraApertura, HoraCerrado) values (6, 'Topo', 'Trago', 'Apodaca', 'Nuevo Leon', 'Mxico', 215487, '8:15:00', '21:00:00') Insert into PtoDeVenta (Pto_ID, Calle, Colonia, Ciudad, Estado, Pais, CodPostal, HoraApertura, HoraCerrado) values (7, 'Tinmio', 'Zocalo', 'San Nicolas', 'Nuevo Leon', 'Mxico', 215698, '6:45:00', '20:00:00') Insert into PtoDeVenta (Pto_ID, Calle, Colonia, Ciudad, Estado, Pais, CodPostal, HoraApertura, HoraCerrado) values (8, 'Tronami', 'ABCDEF', 'Monterrey', 'Nuevo Leon', 'Mxcio', 215965, '8:30:00', '20:00:00') Insert into PtoDeVenta (Pto_ID, Calle, Colonia, Ciudad, Estado, Pais, CodPostal, HoraApertura, HoraCerrado) values (9, 'Tonito', 'logiano', 'Saltillo', 'Coahuila', 'Mxico', 215987, '9:30:00', '21:00:00') Insert into PtoDeVenta (Pto_ID, Calle, Colonia, Ciudad, Estado, Pais, CodPostal, HoraApertura, HoraCerrado) values (10, 'so live', 'a life', 'you will', 'remember', 'Estados Unidos', 125987, '10:00:00', '21:00:00') ------Valores Empleado----- Insert into Empleado (Empleado_ID, Nombre1, Nombre2, Apellido1, Apellido2, Edad, Correo, Calle, Colonia, Ciudad, Estado, Pais, SegSocial, Puesto_ID, Pto_ID, Turno_ID) values (1, 'Fernando', 'Alberto', 'Fernandez', 'Gonzales', 21, 'Fer@hotmail.com', 'Gonzalitos', 'Truncas', 'Monterrey', 'Nuevo Leon', 'Mxico', 152684, 1, 2, 1) Insert into Empleado (Empleado_ID, Nombre1, Nombre2, Apellido1, Apellido2, Edad, Correo, Calle, Colonia, Ciudad, Estado, Pais, SegSocial, Puesto_ID, Pto_ID, Turno_ID) values (2, 'Francisco', 'Gino', 'Boca', 'Valdez', 25, 'boca@hotmail.com', 'sho', 'the', 'San Nicolas', 'Nuevo Leon', 'Mxico', 215698, 3, 4, 1) Insert into Empleado (Empleado_ID, Nombre1, Nombre2, Apellido1, Apellido2, Edad, Correo, Calle, Colonia, Ciudad, Estado, Pais, SegSocial, Puesto_ID, Pto_ID, Turno_ID) values (3, 'Francis', 'Gio', 'Boca', 'Valdez', 30, 'boca@hotmail.com', 'sho', 'the', 'Monterrey', 'Nuevo Leon', 'Mxico', 215678, 3, 9, 1) Insert into Empleado (Empleado_ID, Nombre1, Nombre2, Apellido1, Apellido2, Edad, Correo, Calle, Colonia, Ciudad, Estado, Pais, SegSocial, Puesto_ID, Pto_ID, Turno_ID) values (4, 'Fracis', 'Gio', 'Boca', 'Valdez', 24, 'boca@hotmail.com', 'sho', 'the', 'Monterrey', 'Nuevo Leon', 'Mxico', 285678, 8, 7, 2) Insert into Empleado (Empleado_ID, Nombre1, Nombre2, Apellido1, Apellido2, Edad, Correo, Calle, Colonia, Ciudad, Estado, Pais, SegSocial, Puesto_ID, Pto_ID, Turno_ID) values (5, 'Francis', 'Gio', 'Boca', 'Valdez', 29, 'boca@hotmail.com', 'sho', 'Santiago', 'Apodaca', 'Nuevo Leon', 'Mxico', 215478, 3, 10, 1) Insert into Empleado (Empleado_ID, Nombre1, Nombre2, Apellido1, Apellido2, Edad, Correo, Calle, Colonia, Ciudad, Estado, Pais, SegSocial, Puesto_ID, Pto_ID, Turno_ID) values (6, 'Frida', 'Alejandra', 'Tita', 'Americia', 45, 'shi@hotmail.com', 'sho', 'the', 'Saltillo', 'Coahuila', 'Mxico', 214878, 10, 4, 2) Insert into Empleado (Empleado_ID, Nombre1, Nombre2, Apellido1, Apellido2, Edad, Correo, Calle, Colonia, Ciudad, Estado, Pais, SegSocial, Puesto_ID, Pto_ID, Turno_ID) values (7, 'Alexis', 'Cara', 'Cora', 'Carason', 22, 'AleCo@hotmail.com', 'djjkd', 'poliddf', 'San Pedro', 'Nuevo Leon', 'Mxico', 226578, 2, 5, 2) Insert into Empleado (Empleado_ID, Nombre1, Nombre2, Apellido1, Apellido2, Edad, Correo, Calle, Colonia, Ciudad, Estado, Pais, SegSocial, Puesto_ID, Pto_ID, Turno_ID) values (8, 'Coral', 'Alejandri', 'Cabo', 'Ortiz', 30, 'OrtCabo@hotmail.com', 'svjhsjo', 'ksieydbf', 'Virginia beach', 'Virginia','Estados Unidos', 598642, 6, 8, 2) Insert into Empleado (Empleado_ID, Nombre1, Nombre2, Apellido1, Apellido2, Edad, Correo, Calle, Colonia, Ciudad, Estado, Pais, SegSocial, Puesto_ID, Pto_ID, Turno_ID) values (9, 'Francisqui', 'Goma', 'Lorenzo', 'Glorietto', 26, 'Lore@hotmail.com', 'losdkhgit', 'abnsfhir', 'gical', 'Brizia', 'Italia', 548963, 10, 10, 2) Insert into Empleado (Empleado_ID, Nombre1, Nombre2, Apellido1, Apellido2, Edad, Correo, Calle, Colonia, Ciudad, Estado, Pais, SegSocial, Puesto_ID, Pto_ID, Turno_ID) values (10, 'Sirra', 'Magdalena', 'Hernandez', 'Vol', 36, 'Magda@hotmail.com', 'fjgiout', 'lodjkye', 'Monterrey', 'kolsiski', 'Austria', 548896, 3, 6, 1) select * from Empleado -------Valores Puesto---- Insert into Puesto (Puesto_ID, NombrePuesto, HoraEntrada, HoraSalida, PagoXHora, HorasTrabajo) values (1, 'Cajero', '7:30:00', '15:30:00', 300, 8) Insert into Puesto (Puesto_ID, NombrePuesto, HoraEntrada, HoraSalida, PagoXHora, HorasTrabajo) values (2, 'Cajero', '15:30:00', '23:00:00', 300, 8) Insert into Puesto (Puesto_ID, NombrePuesto, HoraEntrada, HoraSalida, PagoXHora, HorasTrabajo) values (3, 'Conserje', '7:30:00', '15:30:00', 150, 8) Insert into Puesto (Puesto_ID, NombrePuesto, HoraEntrada, HoraSalida, PagoXHora, HorasTrabajo) values (4, 'Conserje', '15:30:00', '23:00:00', 150, 8) Insert into Puesto (Puesto_ID, NombrePuesto, HoraEntrada, HoraSalida, PagoXHora, HorasTrabajo) values (5, 'Guardia', '7:30:00', '15:30:00', 350, 8) Insert into Puesto (Puesto_ID, NombrePuesto, HoraEntrada, HoraSalida, PagoXHora, HorasTrabajo) values (6, 'Guardia', '15:30:00', '23:00:00', 350, 8) Insert into Puesto (Puesto_ID, NombrePuesto, HoraEntrada, HoraSalida, PagoXHora, HorasTrabajo) values (7, 'Acomodador', '7:30:00', '15:30:00', 300, 8) Insert into Puesto (Puesto_ID, NombrePuesto, HoraEntrada, HoraSalida, PagoXHora, HorasTrabajo) values (8, 'Acomodador', '15:30:00', '23:00:00', 300, 8) Insert into Puesto (Puesto_ID, NombrePuesto, HoraEntrada, HoraSalida, PagoXHora, HorasTrabajo) values (9, 'Cajero 2', '7:30:00', '15:30:00', 300, 8) Insert into Puesto (Puesto_ID, NombrePuesto, HoraEntrada, HoraSalida, PagoXHora, HorasTrabajo) values (10, 'Cajero 2', '15:30:00', '23:00:00', 300, 8) Select * from Puesto ------valores Producto--- Insert into Producto (Producto_ID, Nombre, Marca_ID, CantidadProducto, Medida_ID, Precio, MesCadu, AoCadu, Tamao_ID, Categoria_ID) values (1, 'Takis Fuego', 1, 350, 4, 15, 6, 2020, 1, 1) Insert into Producto (Producto_ID, Nombre, Marca_ID, CantidadProducto, Medida_ID, Precio, MesCadu, AoCadu, Tamao_ID, Categoria_ID) values (2, 'MyMs', 5, 200, 4, 15, 7, 2020, 1, 4) Insert into Producto (Producto_ID, Nombre, Marca_ID, CantidadProducto, Medida_ID, Precio, MesCadu, AoCadu, Tamao_ID, Categoria_ID) values (3, 'Pepsi', 11, 500, 2, 14, 9, 2020, 2, 2) Insert into Producto (Producto_ID, Nombre, Marca_ID, CantidadProducto, Medida_ID, Precio, MesCadu, AoCadu, Tamao_ID, Categoria_ID) values (4, 'Galletas Emperador', 4, 100, 4, 14, 12, 2020, 2, 4) Insert into Producto (Producto_ID, Nombre, Marca_ID, CantidadProducto, Medida_ID, Precio, MesCadu, AoCadu, Tamao_ID, Categoria_ID) values (5, 'Nerds', 2, 50, 4, 10, 11, 2021, 1, 3) Insert into Producto (Producto_ID, Nombre, Marca_ID, CantidadProducto, Medida_ID, Precio, MesCadu, AoCadu, Tamao_ID, Categoria_ID) values (6, 'Runners', 1, 400, 4, 12, 10, 2021, 2, 1) Insert into Producto (Producto_ID, Nombre, Marca_ID, CantidadProducto, Medida_ID, Precio, MesCadu, AoCadu, Tamao_ID, Categoria_ID) values (7, 'Gamesa clasicas', 4, 100, 4, 15, 4, 2020, 2, 3) Insert into Producto (Producto_ID, Nombre, Marca_ID, CantidadProducto, Medida_ID, Precio, MesCadu, AoCadu, Tamao_ID, Categoria_ID) values (8, 'Caja Emperador', 4, 8, 6, 20, 12, 2022, 3, 4) select * from Producto -----Valores Proovedor----- Insert into Proovedor (Proovedor_ID, NombreProo, TelProo, CorreoProo) values (1, 'Bimbo', 8156321456, 'Bimbo@hotmail.com') Insert into Proovedor (Proovedor_ID, NombreProo, TelProo, CorreoProo) values (2, 'Coca Cola', 8145987452, 'CocaSupport@hotmail.com') Insert into Proovedor (Proovedor_ID, NombreProo, TelProo, CorreoProo) values (3, 'Pepsi Co', 8154796584, 'PepsiSup@hotmail.com') Insert into Proovedor (Proovedor_ID, NombreProo, TelProo, CorreoProo) values (4, 'Nestl', 8152364789, 'NestSup@hotmail.com') Insert into Proovedor (Proovedor_ID, NombreProo, TelProo, CorreoProo) values (5, 'Danone', 8156324875, 'DanoSupport@gmail.com') Insert into Proovedor (Proovedor_ID, NombreProo, TelProo, CorreoProo) values (6, 'Kellogs', 8156320125, 'KellogSup@live.com') Insert into Proovedor (Proovedor_ID, NombreProo, TelProo, CorreoProo) values (7, 'Mars', 81256321478, 'Mars@hotmail.support.com') Insert into Proovedor (Proovedor_ID, NombreProo, TelProo, CorreoProo) values (8, 'Mondelez', 8156321478, 'Mondelez@Support.com') select * from Proovedor ------Valores Almacen---- Insert into Almacen (Almacen_ID, Calle, Colonia, Ciudad, Estado, Pais) values (1, 'Filadelfia', 'Callespo', 'Monterrey', 'Nuevo Leon', 'Mxico') Insert into Almacen (Almacen_ID, Calle, Colonia, Ciudad, Estado, Pais) values (2, 'Coutinho', 'Contry', 'San Nicolas', 'Nuevo Leon', 'Mxico') Insert into Almacen (Almacen_ID, Calle, Colonia, Ciudad, Estado, Pais) values (3, 'Gitana', 'Ceveda', 'Apodaca', 'Nuevo Leon', 'Mxico') Insert into Almacen (Almacen_ID, Calle, Colonia, Ciudad, Estado, Pais) values (4, 'Lenin', 'Comunista', 'San Pedro', 'Nuevo Leon', 'Mxico') Insert into Almacen (Almacen_ID, Calle, Colonia, Ciudad, Estado, Pais) values (5, 'Karl', 'Levington', 'San Nicolas', 'Nuevo Leon', 'Mxico') Insert into Almacen (Almacen_ID, Calle, Colonia, Ciudad, Estado, Pais) values (6, 'Maximato', 'Independencia', 'Monterrey', 'Nuevo Leon', 'Mxico') Insert into Almacen (Almacen_ID, Calle, Colonia, Ciudad, Estado, Pais) values (7, 'cerro', 'Alpes', 'Saltillo', 'Coahuila', 'Mxico') Insert into Almacen (Almacen_ID, Calle, Colonia, Ciudad, Estado, Pais) values (8, 'Comandante', 'licenciado', 'Rosales', 'Tabasco', 'Mxico') Insert into Almacen (Almacen_ID, Calle, Colonia, Ciudad, Estado, Pais) values (9, 'Hercules', 'Simion', 'Apodaca', 'Nuevo Leon', 'Mxico') Insert into Almacen (Almacen_ID, Calle, Colonia, Ciudad, Estado, Pais) values (10, 'Atlaton', 'polo', 'San Nicolas', 'Nuevo Leon', 'Mxico') select * from Almacen -----Valores Medida---- Insert into Medida (Medida_ID, Medida) values (1, 'litros') Insert into Medida (Medida_ID, Medida) values (2, 'mililitros') Insert into Medida (Medida_ID, Medida) values (3, 'Kilogramos') Insert into Medida (Medida_ID, Medida) values (4, 'gramos') Insert into Medida (Medida_ID, Medida) values (5, 'cajas') Insert into Medida (Medida_ID, Medida) values (6, 'Paquetes') Insert into Medida (Medida_ID, Medida) values (7, 'latas') Insert into Medida (Medida_ID, Medida) values (8, 'bolsas') Insert into Medida (Medida_ID, Medida) values (9, 'botellas') ------Valores Ticket Insert into Ticket (TicketNum, Pto_ID, Empleado_ID, Producto_ID, Precio, Cantidad, TotalPagado, TipoPago_ID, Fecha, Tarjeta_ID) values (1, 2, 1, 7, 15, 2, 50, 2, 19/05/19, null) Insert into Ticket (TicketNum, Pto_ID, Empleado_ID, Producto_ID, Precio, Cantidad, TotalPagado, TipoPago_ID, Fecha, Tarjeta_ID) values (2, 5, 2, 5, 10, 2, 20, 1, 15/06/20, 2) select * from Ticket -------Valores TipoPago ------- Insert into TipoPago (TipoPago_ID, TipoPago) values (1, 'Tarjeta') Insert into TipoPago (TipoPago_ID, TipoPago) values (2, 'Efectivo') ---Valores tarjetas---- Insert into Tarjeta (Tarjeta_ID, NombreTarj, TipoTarj) values (1, 'Citibanamex', 'credito') Insert into Tarjeta (Tarjeta_ID, NombreTarj, TipoTarj) values (2, 'BanRegio', 'debito') Insert into Tarjeta (Tarjeta_ID, NombreTarj, TipoTarj) values (3, 'AmericanExpress', 'Credito') Insert into Tarjeta (Tarjeta_ID, NombreTarj, TipoTarj) values (4, 'Santander', 'debito') Insert into Tarjeta (Tarjeta_ID, NombreTarj, TipoTarj) values (5, 'visa', 'credito') Insert into Tarjeta (Tarjeta_ID, NombreTarj, TipoTarj) values (6, 'HSBC', 'debito') Insert into Tarjeta (Tarjeta_ID, NombreTarj, TipoTarj) values (7, 'Banco Azteca', 'debito') Insert into Tarjeta (Tarjeta_ID, NombreTarj, TipoTarj) values (8, 'Libreton', 'Debito') ------Valores Tamao ----- Insert into Tamao (Tamao_ID, Tamao) values (1, 'Pequeo') Insert into Tamao (Tamao_ID, Tamao) values (2, 'Mediano') Insert into Tamao (Tamao_ID, Tamao) values (3, 'Grande') ------Valores Reabasto----- Insert into Reabasto (ReabastoNum, Almacen_ID, Proovedor_ID, Producto_ID, CostoXCanti, Canti, Pago, Fecha, Medida_ID, Marca_ID) values (1, 5, 3, 3, 500, 15, 8000, 18/02/20, 5, 9) select * from Reabasto ------ valores Turno------ Insert into Turno (Turno_ID, Turno) values (1, 'Matutino') Insert into Turno (Turno_ID, Turno) values (2, 'Vespertino') ------Valores Meses------ Insert into Meses (Mes_ID, Mes) values (1, 'Enero') Insert into Meses (Mes_ID, Mes) values (2, 'Febrero') Insert into Meses (Mes_ID, Mes) values (3, 'Marzo') Insert into Meses (Mes_ID, Mes) values (4, 'Abril') Insert into Meses (Mes_ID, Mes) values (5, 'Mayo') Insert into Meses (Mes_ID, Mes) values (6, 'Junio') Insert into Meses (Mes_ID, Mes) values (7, 'Julio') Insert into Meses (Mes_ID, Mes) values (8, 'Agosto') Insert into Meses (Mes_ID, Mes) values (9, 'Septiembre') Insert into Meses (Mes_ID, Mes) values (10, 'Octubre') Insert into Meses (Mes_ID, Mes) values (11, 'Noviembre') Insert into Meses (Mes_ID, Mes) values (12, 'Diciembre') ------Valores Categoria----- Insert into Categoria (Categoria_ID, Categoria) values (1, 'Picante') Insert into Categoria (Categoria_ID, Categoria) values (2, 'Gaseosa') Insert into Categoria (Categoria_ID, Categoria) values (3, 'Dulce') Insert into Categoria (Categoria_ID, Categoria) values (4, 'Chocolate') Insert into Categoria (Categoria_ID, Categoria) values (5, 'Salado') ------Valores Marca----- Insert into Marca (Marca_ID, Nombre, Proovedor_ID) values (1, 'Barcel', 1) Insert into Marca (Marca_ID, Nombre, Proovedor_ID) values (2, 'Wonka', 4) Insert into Marca (Marca_ID, Nombre, Proovedor_ID) values (3, 'Marinela', 1) Insert into Marca (Marca_ID, Nombre, Proovedor_ID) values (4, 'Gamesa', 3) Insert into Marca (Marca_ID, Nombre, Proovedor_ID) values (5, 'MyMs', 7) Insert into Marca (Marca_ID, Nombre, Proovedor_ID) values (6, 'Snickers', 7) Insert into Marca (Marca_ID, Nombre, Proovedor_ID) values (7, 'Milky-way', 7) Insert into Marca (Marca_ID, Nombre, Proovedor_ID) values (8, 'Skittles', 7) Insert into Marca (Marca_ID, Nombre, Proovedor_ID) values (9, 'Tridents', 8) Insert into Marca (Marca_ID, Nombre, Proovedor_ID) values (10, 'halls', 8) Insert into Marca (Marca_ID, Nombre, Proovedor_ID) values (11, 'Pepsi', 3) ------Valores Inventario------ Insert into Inventario (Producto_ID, Almacen_ID, Cantidad, Medida_ID) values(2, 9, 100, 5) select * from Inventario ----Updates----- Update Empleado set edad = 21 where Nombre1 = 'Francisco' Update Empleado set edad = 32 where Nombre2 = 'Gio' Update Empleado set edad = 44 where Empleado_ID = 1 Update Empleado set Nombre2 = 'Javier' where Empleado_ID = 5 Update Empleado set Nombre2 = 'Jorge' where Empleado_ID = 7 select * from Empleado Insert into Empleado (Empleado_ID, Nombre1, Nombre2, Apellido1, Apellido2, Edad, Correo, Calle, Colonia, Ciudad, Estado, Pais, SegSocial, Puesto_ID, Pto_ID, Turno_ID) values (11, 'Rodrigo', 'Emilio', 'Perez', 'Fernandez', 30, 'RoPe@hotmail.com', 'sho', 'the', 'Monterrey', 'Nuevo Leon', 'Mxico', 256987, 1, 6, 1) Insert into Empleado (Empleado_ID, Nombre1, Nombre2, Apellido1, Apellido2, Edad, Correo, Calle, Colonia, Ciudad, Estado, Pais, SegSocial, Puesto_ID, Pto_ID, Turno_ID) values (12, 'Festin', 'Rodri', 'Coba', 'Lore', 30, 'Fes@hotmail.com', 'sho', 'the', 'Monterrey', 'Nuevo Leon', 'Mxico', 256987, 2, 8, 2) Insert into Empleado (Empleado_ID, Nombre1, Nombre2, Apellido1, Apellido2, Edad, Correo, Calle, Colonia, Ciudad, Estado, Pais, SegSocial, Puesto_ID, Pto_ID, Turno_ID) values (13, 'Emilio', 'Emilio', 'Emilioson', 'Wainas', 30, 'EmiEmi@hotmail.com', 'sho', 'the', 'Monterrey', 'Nuevo Leon', 'Mxico', 256987, 3, 7, 1) Insert into Empleado (Empleado_ID, Nombre1, Nombre2, Apellido1, Apellido2, Edad, Correo, Calle, Colonia, Ciudad, Estado, Pais, SegSocial, Puesto_ID, Pto_ID, Turno_ID) values (14, 'Daniel', 'Sancho', 'Perez', 'Fernandez', 30, 'Ripo@hotmail.com', 'sho', 'the', 'Monterrey', 'Nuevo Leon', 'Mxico', 256987, 6, 7, 2) Insert into Empleado (Empleado_ID, Nombre1, Nombre2, Apellido1, Apellido2, Edad, Correo, Calle, Colonia, Ciudad, Estado, Pais, SegSocial, Puesto_ID, Pto_ID, Turno_ID) values (15, 'Rafael', 'James', 'Rafelson', 'Jameson', 30, 'SonJame@hotmail.com', 'sho', 'the', 'Monterrey', 'Nuevo Leon', 'Mxico', 256987, 10, 6, 2) Delete from Empleado where Empleado_ID = 11 Delete from Empleado where Empleado_ID = 12 Delete from Empleado where Empleado_ID = 13 Delete from Empleado where Empleado_ID = 14 Delete from Empleado where Empleado_ID = 15 select * from Empleado
true
2837d282d44800d208d61abe2a9d5ca3c1b9247b
SQL
LetsDoIt-n/Web-Application
/expense.sql
UTF-8
570
3.484375
3
[]
no_license
create database expense_record_db; use expense_record_db; create table expenseCategory( category_id int primary key auto_increment, category_name varchar(100) not null )Engine=InnoDB; create table expense( expense_id int primary key auto_increment, expense_date datetime not null, expense_category_id int, expense_description text, expense_amount decimal(15, 2) not null, expense_paidby varchar(100), expense_attachement text, foreign key (expense_category_id) references expenseCategory(category_id) ) Engine = InnoDB;
true
5ae3d001690f2afab35989cb1b6a07e4983aa166
SQL
alex-c4/PruebaUniversidadLaboratorio1
/scripts SQL/tables/stadiums.sql
UTF-8
3,311
2.78125
3
[ "MIT" ]
permissive
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET AUTOCOMMIT = 0; START TRANSACTION; SET time_zone = "+00:00"; CREATE TABLE `stadiums` ( `id` int(11) NOT NULL, `name` varchar(150) COLLATE utf8_spanish_ci NOT NULL, `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, `updated_by` int(11) NOT NULL, `updated_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci; -- -- Volcado de datos para la tabla `stadiums` -- INSERT INTO `stadiums` (`id`, `name`, `created_at`, `updated_by`, `updated_at`) VALUES (1, 'Estadio Santiago Bernabéu', '2021-01-08 15:48:04', 64, '2021-01-08 15:48:04'), (2, 'Camp Nou', '2021-01-08 15:48:04', 54, '2021-01-08 15:48:04'), (3, 'Estadio Universitario de Caracas', '2021-01-08 22:47:26', 64, '2021-01-08 22:47:26'), (4, 'Estadio Giuseppe Meazza (San Siro) de Milán', '2021-01-08 23:05:10', 64, '2021-01-08 23:05:10'), (5, 'La Bombonera', '2021-01-08 23:06:42', 64, '2021-01-08 23:06:42'), (6, 'Juventus Stadium', '2021-01-08 23:12:41', 64, '2021-01-08 23:12:41'), (7, 'Estadio de Mestalla', '2021-01-08 23:14:15', 64, '2021-01-08 23:14:15'), (8, 'Allianz Arena', '2021-01-08 23:17:23', 64, '2021-01-08 23:17:23'), (9, 'Estadio Antonio Vespucio Liberti', '2021-01-08 23:25:18', 64, '2021-01-08 23:25:18'), (10, 'Wanda Metropolitano', '2021-01-08 23:26:50', 64, '2021-01-08 23:26:50'), (11, 'Estadio Municipal de Anoeta', '2021-01-08 23:28:22', 64, '2021-01-08 23:28:22'), (12, 'Estadio El Campín', '2021-01-10 23:07:32', 64, '2021-01-10 23:07:32'), (13, 'Estadio Centenario', '2021-01-10 23:16:53', 64, '2021-01-10 23:16:53'), (14, 'Estadio José Zorrilla', '2021-01-14 15:23:11', 64, '2021-01-14 15:23:11'), (15, 'Estadio Ramón de Carranza', '2021-01-14 23:55:28', 64, '2021-01-14 23:55:28'), (16, 'Estadio de Mendizorroza', '2021-01-15 00:19:18', 64, '2021-01-15 00:19:18'), (17, 'Coliseum Alfonso Pérez', '2021-01-15 00:24:17', 64, '2021-01-15 00:24:17'), (18, 'Estadio Benito Villamarín', '2021-01-15 00:27:57', 64, '2021-01-15 00:27:57'), (19, 'Estadio de la Cerámica', '2021-01-15 00:29:52', 64, '2021-01-15 00:29:52'), (20, 'Estadio Municipal de Ipurúa', '2021-01-19 22:45:21', 64, '2021-01-19 22:45:21'), (21, 'Estadio Ciudad de Valencia', '2021-01-20 15:34:10', 64, '2021-01-20 15:34:10'), (22, 'Estadio El Alcoraz', '2021-01-20 15:48:00', 64, '2021-01-20 15:48:00'), (23, 'Estadio Ramón Sánchez-Pizjuán', '2021-01-20 16:22:57', 64, '2021-01-20 16:22:57'), (25, 'Estadio El Sadar', '2021-01-20 19:05:37', 64, '2021-01-20 19:05:37'), (26, 'Estadio Manuel Martínez Valero', '2021-01-20 19:07:38', 64, '2021-01-20 19:07:38'), (27, 'Estadio de Balaídos', '2021-01-20 19:12:44', 64, '2021-01-20 19:12:44'), (28, 'Estadio de San Mamés', '2021-01-20 19:16:46', 64, '2021-01-20 19:16:46'), (29, 'Estadio Olímpico de la Universidad Central de Venezuela', '2021-02-02 20:05:06', 64, '2021-02-02 20:05:06'), (30, 'Estadio Olímpico de Tokio', '2021-02-16 16:24:44', 64, '2021-02-16 16:24:44'); -- -- Índices para tablas volcadas -- -- -- Indices de la tabla `stadiums` -- ALTER TABLE `stadiums` ADD PRIMARY KEY (`id`); -- -- AUTO_INCREMENT de las tablas volcadas -- -- -- AUTO_INCREMENT de la tabla `stadiums` -- ALTER TABLE `stadiums` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=31; 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
61d2bb230e5a1571d2525e475ab83c0c3476fc2d
SQL
danhnguyen-agilityio/spring-boot
/courses/spring-jdbc/ride-tracker/src/main/resources/data.sql
UTF-8
303
2.734375
3
[]
no_license
create table `ride` ( `id` int not null auto_increment, `name` varchar(100) not null, `duration` int not null, primary key (`id`)); alter table `ride` add ride_date DATETIME AFTER duration; insert into ride (name, duration) values ('Bike',45); insert into ride (name, duration) values ('Motobike',60);
true
a404bb847a4506fda4ce8c3a8b1bb07d3a9e0b3f
SQL
haririjal/Online-Examination-System
/database/cee_db.sql
UTF-8
10,547
3.15625
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 4.8.2 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Generation Time: Sep 02, 2021 at 07:39 AM -- Server version: 10.1.34-MariaDB -- PHP Version: 7.2.7 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET AUTOCOMMIT = 0; START TRANSACTION; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8mb4 */; -- -- Database: `cee_db` -- -- -------------------------------------------------------- -- -- Table structure for table `admin_acc` -- CREATE TABLE `admin_acc` ( `admin_id` int(11) NOT NULL, `admin_user` varchar(1000) NOT NULL, `admin_pass` varchar(1000) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `admin_acc` -- INSERT INTO `admin_acc` (`admin_id`, `admin_user`, `admin_pass`) VALUES (1, 'admin@username', 'admin@password'); -- -------------------------------------------------------- -- -- Table structure for table `course_tbl` -- CREATE TABLE `course_tbl` ( `cou_id` int(11) NOT NULL, `cou_name` varchar(1000) NOT NULL, `cou_created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `course_tbl` -- INSERT INTO `course_tbl` (`cou_id`, `cou_name`, `cou_created`) VALUES (66, '(BIM/BBM) CMAT', '2021-08-28 08:47:20'), (67, 'BCA ENTRANCE', '2021-08-28 08:44:10'), (68, 'BSCCSIT ENTRANCE', '2021-08-28 08:44:32'); -- -------------------------------------------------------- -- -- Table structure for table `examinee_tbl` -- CREATE TABLE `examinee_tbl` ( `exmne_id` int(11) NOT NULL, `exmne_fullname` varchar(1000) NOT NULL, `exmne_course` varchar(1000) NOT NULL, `exmne_gender` varchar(1000) NOT NULL, `exmne_birthdate` varchar(1000) NOT NULL, `exmne_year_level` varchar(1000) NOT NULL, `exmne_email` varchar(1000) NOT NULL, `exmne_password` varchar(1000) NOT NULL, `exmne_status` varchar(1000) NOT NULL DEFAULT 'active' ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `examinee_tbl` -- INSERT INTO `examinee_tbl` (`exmne_id`, `exmne_fullname`, `exmne_course`, `exmne_gender`, `exmne_birthdate`, `exmne_year_level`, `exmne_email`, `exmne_password`, `exmne_status`) VALUES (10, 'Hari Rijal', '66', 'male', '2021-08-25', 'Bachelor ', 'reezalharee2015@gmail.com', 'haririjal', 'active'), (11, 'Karan Bhandari', '66', 'male', '2001-03-15', 'first year', 'kripkaran123@gmail.com', 'karan', 'active'), (12, 'Nirajan Khadka', '66', 'male', '2000-01-01', 'first year', 'nirajankhadka@gmail.com', 'nirajan', 'active'), (13, 'Deebas Lg', '66', 'male', '2000-01-01', 'first year', 'deebas@gmail.com', 'deebas', 'active'); -- -------------------------------------------------------- -- -- Table structure for table `exam_answers` -- CREATE TABLE `exam_answers` ( `exans_id` int(11) NOT NULL, `axmne_id` int(11) NOT NULL, `exam_id` int(11) NOT NULL, `quest_id` int(11) NOT NULL, `exans_answer` varchar(1000) NOT NULL, `exans_status` varchar(1000) NOT NULL DEFAULT 'new', `exans_created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `exam_answers` -- INSERT INTO `exam_answers` (`exans_id`, `axmne_id`, `exam_id`, `quest_id`, `exans_answer`, `exans_status`, `exans_created`) VALUES (328, 10, 27, 40, 'one time password', 'new', '2021-08-28 04:20:57'), (329, 10, 27, 39, 'Software Engineer', 'new', '2021-08-28 04:20:57'), (330, 11, 27, 39, 'Software Engineering', 'new', '2021-08-28 13:37:29'), (331, 11, 27, 42, '10', 'new', '2021-08-28 13:37:29'), (332, 11, 27, 43, '1', 'new', '2021-08-28 13:37:29'), (333, 11, 27, 41, '6', 'new', '2021-08-28 13:37:29'), (334, 11, 27, 44, '24', 'new', '2021-08-28 13:37:29'), (335, 12, 27, 42, '10', 'new', '2021-08-28 13:38:59'), (336, 12, 27, 41, '6', 'new', '2021-08-28 13:38:59'), (337, 12, 27, 39, 'Software Engineering', 'new', '2021-08-28 13:39:00'), (338, 12, 27, 40, 'one time password', 'new', '2021-08-28 13:39:00'), (339, 12, 27, 43, '2', 'new', '2021-08-28 13:39:00'), (340, 12, 28, 49, '20', 'new', '2021-08-29 13:29:06'), (341, 12, 28, 48, '-1', 'new', '2021-08-29 13:29:06'), (342, 12, 28, 46, 'Z', 'new', '2021-08-29 13:29:06'), (343, 12, 28, 47, '5', 'new', '2021-08-29 13:29:06'), (344, 12, 28, 45, '8', 'new', '2021-08-29 13:29:06'), (345, 11, 28, 47, '7', 'new', '2021-08-30 01:35:21'), (346, 11, 28, 45, '3', 'new', '2021-08-30 01:35:21'), (347, 11, 28, 49, '20', 'new', '2021-08-30 01:35:21'), (348, 11, 28, 46, 'C', 'new', '2021-08-30 01:35:21'), (349, 11, 28, 48, '-1', 'new', '2021-08-30 01:35:21'); -- -------------------------------------------------------- -- -- Table structure for table `exam_attempt` -- CREATE TABLE `exam_attempt` ( `examat_id` int(11) NOT NULL, `exmne_id` int(11) NOT NULL, `exam_id` int(11) NOT NULL, `examat_status` varchar(1000) NOT NULL DEFAULT 'used' ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `exam_attempt` -- INSERT INTO `exam_attempt` (`examat_id`, `exmne_id`, `exam_id`, `examat_status`) VALUES (58, 10, 27, 'used'), (59, 11, 27, 'used'), (60, 12, 27, 'used'), (61, 12, 28, 'used'), (62, 11, 28, 'used'); -- -------------------------------------------------------- -- -- Table structure for table `exam_question_tbl` -- CREATE TABLE `exam_question_tbl` ( `eqt_id` int(11) NOT NULL, `exam_id` int(11) NOT NULL, `exam_question` varchar(1000) NOT NULL, `exam_ch1` varchar(1000) NOT NULL, `exam_ch2` varchar(1000) NOT NULL, `exam_ch3` varchar(1000) NOT NULL, `exam_ch4` varchar(1000) NOT NULL, `exam_answer` varchar(1000) NOT NULL, `exam_status` varchar(1000) NOT NULL DEFAULT 'active' ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `exam_question_tbl` -- INSERT INTO `exam_question_tbl` (`eqt_id`, `exam_id`, `exam_question`, `exam_ch1`, `exam_ch2`, `exam_ch3`, `exam_ch4`, `exam_answer`, `exam_status`) VALUES (39, 27, 'What is the full form of SE?', 'Software Engineering', 'Software Engineer', 'Soft Earning', 'Some Earning', 'Software Engineering', 'active'), (40, 27, 'What is the full form of OTP', 'one time password', 'one term person', 'one time pass', 'only time passed', 'one time password', 'active'), (41, 27, '3+3=?', '6', '4', '7', '5', '6', 'active'), (42, 27, '2*5=?', '23', '11', '10', '8', '10', 'active'), (43, 27, '9-8', '3', '2', '1', '0', '1', 'active'), (44, 27, '12+12=?', '34', '25', '12', '24', '24', 'active'), (45, 28, '1+2=?', '5', '6', '8', '3', '3', 'active'), (46, 28, 'A+B=?', '0', 'C', 'Z', 'A', '0', 'active'), (47, 28, '1+6=?', '5', '7', '2', '8', '7', 'active'), (48, 28, '8-9', '1', '-1', '8', '5', '-1', 'active'), (49, 28, '5*4=?', '21', '20', '23', '32', '20', 'active'); -- -------------------------------------------------------- -- -- Table structure for table `exam_tbl` -- CREATE TABLE `exam_tbl` ( `ex_id` int(11) NOT NULL, `cou_id` int(11) NOT NULL, `ex_title` varchar(1000) NOT NULL, `ex_time_limit` varchar(1000) NOT NULL, `ex_questlimit_display` int(11) NOT NULL, `ex_description` varchar(1000) NOT NULL, `ex_created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `exam_tbl` -- INSERT INTO `exam_tbl` (`ex_id`, `cou_id`, `ex_title`, `ex_time_limit`, `ex_questlimit_display`, `ex_description`, `ex_created`) VALUES (27, 66, 'Bachelor CMAT', '10', 5, 'Attempt all the questions', '2021-08-28 09:08:48'), (28, 66, 'Another Exam', '10', 5, 'Attempt all questions', '2021-08-30 01:38:24'); -- -------------------------------------------------------- -- -- Table structure for table `feedbacks_tbl` -- CREATE TABLE `feedbacks_tbl` ( `fb_id` int(11) NOT NULL, `exmne_id` int(11) NOT NULL, `fb_exmne_as` varchar(1000) NOT NULL, `fb_feedbacks` varchar(1000) NOT NULL, `fb_date` varchar(1000) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `feedbacks_tbl` -- INSERT INTO `feedbacks_tbl` (`fb_id`, `exmne_id`, `fb_exmne_as`, `fb_feedbacks`, `fb_date`) VALUES (11, 10, 'Hari Rijal', 'Nice app.', 'August 28, 2021'), (12, 12, 'Nirajan Khadka', 'Dami xa yaar', 'August 29, 2021'); -- -- Indexes for dumped tables -- -- -- Indexes for table `admin_acc` -- ALTER TABLE `admin_acc` ADD PRIMARY KEY (`admin_id`); -- -- Indexes for table `course_tbl` -- ALTER TABLE `course_tbl` ADD PRIMARY KEY (`cou_id`); -- -- Indexes for table `examinee_tbl` -- ALTER TABLE `examinee_tbl` ADD PRIMARY KEY (`exmne_id`); -- -- Indexes for table `exam_answers` -- ALTER TABLE `exam_answers` ADD PRIMARY KEY (`exans_id`); -- -- Indexes for table `exam_attempt` -- ALTER TABLE `exam_attempt` ADD PRIMARY KEY (`examat_id`); -- -- Indexes for table `exam_question_tbl` -- ALTER TABLE `exam_question_tbl` ADD PRIMARY KEY (`eqt_id`); -- -- Indexes for table `exam_tbl` -- ALTER TABLE `exam_tbl` ADD PRIMARY KEY (`ex_id`); -- -- Indexes for table `feedbacks_tbl` -- ALTER TABLE `feedbacks_tbl` ADD PRIMARY KEY (`fb_id`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `admin_acc` -- ALTER TABLE `admin_acc` MODIFY `admin_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; -- -- AUTO_INCREMENT for table `course_tbl` -- ALTER TABLE `course_tbl` MODIFY `cou_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=69; -- -- AUTO_INCREMENT for table `examinee_tbl` -- ALTER TABLE `examinee_tbl` MODIFY `exmne_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=14; -- -- AUTO_INCREMENT for table `exam_answers` -- ALTER TABLE `exam_answers` MODIFY `exans_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=350; -- -- AUTO_INCREMENT for table `exam_attempt` -- ALTER TABLE `exam_attempt` MODIFY `examat_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=63; -- -- AUTO_INCREMENT for table `exam_question_tbl` -- ALTER TABLE `exam_question_tbl` MODIFY `eqt_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=50; -- -- AUTO_INCREMENT for table `exam_tbl` -- ALTER TABLE `exam_tbl` MODIFY `ex_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=29; -- -- AUTO_INCREMENT for table `feedbacks_tbl` -- ALTER TABLE `feedbacks_tbl` MODIFY `fb_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=13; 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
ad63b0be1dd5526eccf8a00260ab9f0b4c3c129d
SQL
Biggig/database
/code/test12/q1.sql
GB18030
453
2.796875
3
[]
no_license
--дһǶ޸studentsij¼ڲteachersһ¼ʾڲʧܺ޸IJع BEGIN TRAN UPD_STU UPDATE STUDENTS SET GRADE = 2000 WHERE SID='800001216' BEGIN TRAN UPD_TEA INSERT INTO TEACHERS VALUES('123456780', '', '', '') IF @@ERROR != 0 BEGIN ROLLBACK TRAN UPD_STU PRINT 'FAIL' RETURN END COMMIT TRAN UPD_TEA COMMIT TRAN UPD_STU
true
71f072527eb28693ceccbff010a94524531c7a23
SQL
Code-4-Community/speak-for-the-trees-backend
/persist/src/main/resources/db/migration/V1__AuthTables.sql
UTF-8
809
3.34375
3
[]
no_license
CREATE TABLE IF NOT EXISTS blacklisted_refreshes ( refresh_hash VARCHAR(64) PRIMARY KEY, expires TIMESTAMP NOT NULL ); CREATE TABLE IF NOT EXISTS users ( id SERIAL PRIMARY KEY, first_name VARCHAR(36), last_name VARCHAR(36), username VARCHAR(36), email VARCHAR(36) UNIQUE NOT NULL, pass_hash BYTEA NOT NULL, privilege_level INTEGER NOT NULL DEFAULT 0 ); CREATE TABLE IF NOT EXISTS team ( id SERIAL PRIMARY KEY, name VARCHAR(36) NOT NULL ); CREATE TABLE IF NOT EXISTS user_team ( user_id INTEGER REFERENCES users(id), team_id INTEGER REFERENCES team(id), team_role INTEGER NOT NULL DEFAULT 1 ); CREATE TABLE IF NOT EXISTS block ( fid VARCHAR(36) PRIMARY KEY, status INTEGER NOT NULL DEFAULT 0, assigned_to INTEGER REFERENCES users(id) );
true
d5f4748506ffc53cfceb112d1c65b63803147391
SQL
javaducky/cbtf
/family2family/src/main/resources/data-dev.sql
UTF-8
32,048
2.75
3
[ "Unlicense" ]
permissive
-- noinspection SqlNoDataSourceInspectionForFile --reference data INSERT INTO CATEGORY(CATEGORY_ID, ACTIVE, DESCRIPTION) VALUES (1, TRUE, 'Physical Challenges'), (2, TRUE, 'Treatments'), (3, TRUE, 'Educational Issues'), (4, TRUE, 'Behavioral/Cognative Issues'), (5, TRUE, 'Environment'), (6, TRUE, 'Organizations'); INSERT INTO SUBCATEGORY(SUBCATEGORY_ID, ACTIVE, DESCRIPTION, CATEGORY_ID) VALUES (123, TRUE, 'Ventilator', 2), (124, TRUE, 'Walker', 2), (125, TRUE, 'Wheelchair', 2), (126, TRUE, 'IEP', 3), (127, TRUE, '504 Plan', 3), (128, TRUE, 'Grades', 3), (129, TRUE, 'Home Tutored / Schooled', 3), (130, TRUE, 'Homework Issues', 3), (131, TRUE, 'Mobility Services', 3), (132, TRUE, 'Orientation Services', 3), (133, TRUE, 'Reading Services', 3), (134, TRUE, 'Special Education', 3), (135, TRUE, 'Speech Services/Therapy', 3), (136, TRUE, 'Studying / Concentration', 3), (137, TRUE, 'Visual Services', 3), (138, TRUE, 'Adaptive Behavior', 4), (139, TRUE, 'ADHD', 4), (140, TRUE, 'Anger Issues', 4), (141, TRUE, 'Anxiety', 4), (142, TRUE, 'Auditory Processing', 4), (143, TRUE, 'Behavior - General', 4), (144, TRUE, 'Cognitive Issues', 4), (145, TRUE, 'Counseling', 4), (146, TRUE, 'Delayed Constructional Reasoning', 4), (147, TRUE, 'Delayed Spatial Reasoning', 4), (148, TRUE, 'Depression', 4), (149, TRUE, 'Expressive Aphasia', 4), (150, TRUE, 'Low IQ', 4), (151, TRUE, 'Memory Issues', 4), (152, TRUE, 'Motor Skills', 4), (153, TRUE, 'Poor Judgement', 4), (154, TRUE, 'Poor Reflexes', 4), (155, TRUE, 'Psychologist Visits', 4), (156, TRUE, 'Psychosocial', 4), (157, TRUE, 'Puberty', 4), (158, TRUE, 'Self-Control Issues', 4), (159, TRUE, 'Self-Esteem', 4), (160, TRUE, 'Shyness', 4), (161, TRUE, 'Sleep Issues', 4), (162, TRUE, 'Social Anxiety / Struggles', 4), (163, TRUE, 'Social Worker', 4), (164, TRUE, 'Speech Impairment', 4), (165, TRUE, 'Adopted', 5), (166, TRUE, 'College', 5), (167, TRUE, 'Death in Family', 5), (168, TRUE, 'Depression - Family Member', 5), (169, TRUE, 'Divorce', 5), (170, TRUE, 'Grandparent(s) - Custodial', 5), (171, TRUE, 'Only Child', 5), (172, TRUE, 'Puberty', 5), (173, TRUE, 'School-Aged', 5), (174, TRUE, 'Siblings', 5), (175, TRUE, 'Single Father', 5), (176, TRUE, 'Single Mother', 5), (177, TRUE, 'Teen', 5), (178, TRUE, 'AI Dupont Delaware', 6), (179, TRUE, 'Boston Children''s Hospital - BCH', 6), (180, TRUE, 'Camp Sunshine', 6), (181, TRUE, 'CBTF', 6), (182, TRUE, 'Children''s Hospital Central California', 6), (183, TRUE, 'Children''s Hospital Los Angeles - CHLA', 6), (184, TRUE, 'Children''s Hospital Madera', 6), (185, TRUE, 'Children''s Hospital of Philadelphia - CHOP', 6), (186, TRUE, 'Commission for Blind', 6), (187, TRUE, 'Emanuel Cancer Center New Jersey', 6), (188, TRUE, 'Huntington Hospital', 6), (189, TRUE, 'Make A Wish Foundation', 6), (190, TRUE, 'Memorial Sloan Kettering Cancer Center - MSKCC', 6), (191, TRUE, 'Memphis Legal Aspects', 6), (192, TRUE, 'Seattle Children''s Hospital - SCH', 6), (193, TRUE, 'St. Louis Children''s Hospital - SLCH', 6); INSERT INTO SUBCATEGORY(SUBCATEGORY_ID, ACTIVE, DESCRIPTION, CATEGORY_ID) VALUES (1, TRUE, 'Allergic Reaction - Medication', 1), (2, TRUE, 'Allergic Reaction - Chemo', 1), (3, TRUE, 'Anaplastic Ependymoma', 1), (4, TRUE, 'Aneurysm', 1), (5, TRUE, 'Anorexia', 1), (6, TRUE, 'Astrocytoma', 1), (7, TRUE, 'Ataxia', 1), (8, TRUE, 'Balance Issues', 1), (9, TRUE, 'Blindness', 1), (10, TRUE, 'Brain Hemorrhage', 1), (11, TRUE, 'Cataract', 1), (12, TRUE, 'Cavernoma', 1), (13, TRUE, 'Constipation', 1), (14, TRUE, 'Cramps', 1), (15, TRUE, 'Death', 1), (16, TRUE, 'Dehydration', 1), (17, TRUE, 'Diabetes - Insipidus', 1), (18, TRUE, 'Diet - Aversion', 1), (19, TRUE, 'Diet - Modification', 1), (20, TRUE, 'Endocrine Issues', 1), (21, TRUE, 'Epilepsy', 1), (22, TRUE, 'Facial Paralysis', 1), (23, TRUE, 'Falls', 1), (24, TRUE, 'Fatigue', 1), (25, TRUE, 'Femoral Torsion', 1), (26, TRUE, 'Fine Motor Skills Issues', 1), (27, TRUE, 'Foot Drop', 1), (28, TRUE, 'Growth', 1), (29, TRUE, 'Hair Loss', 1), (30, TRUE, 'Hearing Loss', 1), (31, TRUE, 'Hormonal Issues', 1), (32, TRUE, 'Hypoxic Events', 1), (33, TRUE, 'Infections', 1), (34, TRUE, 'Kidney Issues', 1), (35, TRUE, 'Leg Growth Issues', 1), (36, TRUE, 'Long Term Memory Loss', 1), (37, TRUE, 'Loss of Appetite', 1), (38, TRUE, 'Low Energy', 1), (39, TRUE, 'Medulloblastoma', 1), (40, TRUE, 'Meningitis', 1), (41, TRUE, 'Migraines', 1), (42, TRUE, 'Migraines - Stomach', 1), (43, TRUE, 'Moyamoya', 1), (44, TRUE, 'Mucositis', 1), (45, TRUE, 'Muscle Atrophy', 1), (46, TRUE, 'Neck Issues', 1), (47, TRUE, 'Neuralgia', 1), (48, TRUE, 'Neuropathy', 1), (49, TRUE, 'Neuropathy - Peripheral', 1), (50, TRUE, 'Osteopenia', 1), (51, TRUE, 'Osteoporosis', 1), (52, TRUE, 'Paralysis', 1), (53, TRUE, 'Paralysis - Partial', 1), (54, TRUE, 'Physical Disability', 1), (55, TRUE, 'Pituitary - Hypopituitarism', 1), (56, TRUE, 'Pituitary Issues', 1), (57, TRUE, 'Pnemonia', 1), (58, TRUE, 'Peripheral Neuroepithelioma - PNET (Askin Tumor)', 1), (59, TRUE, 'Posteria Fossa', 1), (60, TRUE, 'Remission', 1), (61, TRUE, 'RSV', 1), (62, TRUE, 'Scoliosis', 1), (63, TRUE, 'Seizures', 1), (64, TRUE, 'Sensitivity - Skin', 1), (65, TRUE, 'Shingles', 1), (66, TRUE, 'Short Stature', 1), (67, TRUE, 'Short Term Memory Loss', 1), (68, TRUE, 'Sinus Complications', 1), (69, TRUE, 'Sleep Issues', 1), (70, TRUE, 'Slow Growth', 1), (71, TRUE, 'Somnolence Syndrome', 1), (72, TRUE, 'Speech - Dysarthria', 1), (73, TRUE, 'Speech Issues ', 1), (74, TRUE, 'Strabismus', 1), (75, TRUE, 'Stroke', 1), (76, TRUE, 'Swallowing - Difficulty', 1), (77, TRUE, 'Swelling', 1), (78, TRUE, 'Thyroid Issues', 1), (79, TRUE, 'Tremors - Hand', 1), (80, TRUE, 'UOP', 1), (81, TRUE, 'Vision - Double', 1), (82, TRUE, 'Vision - Nystagmus', 1), (83, TRUE, 'Vision Loss - Full', 1), (84, TRUE, 'Vision Loss - Partial', 1), (85, TRUE, 'Vomiting/Nausea', 1), (86, TRUE, 'Voval Fold Paralysis', 1), (87, TRUE, 'Walking Issues', 1), (88, TRUE, 'Weakness - General', 1), (89, TRUE, 'Weakness/Hemiparesis - Left or Right Side', 1), (90, TRUE, 'Weight Gain', 1), (91, TRUE, 'Weight Loss', 1), (92, TRUE, 'Accutane', 2), (93, TRUE, 'Amputation', 2), (94, TRUE, 'Anesthesia', 2), (95, TRUE, 'Chemotherapy', 2), (96, TRUE, 'Chemotherapy - Cisplatin', 2), (97, TRUE, 'Chemotherapy - Oral', 2), (98, TRUE, 'Chemotherapy - Vincistine', 2), (99, TRUE, 'Cortisol Treatment', 2), (100, TRUE, 'Dental Work', 2), (101, TRUE, 'Feeding Tube', 2), (102, TRUE, 'Gastrostomy Tube / Feeding Tube (G Tube)', 2), (103, TRUE, 'Growth Hormone', 2), (104, TRUE, 'Hearing Aid', 2), (105, TRUE, 'Hemiplegia', 2), (106, TRUE, 'Immunity Issues', 2), (107, TRUE, 'IV', 2), (108, TRUE, 'Leg Braces', 2), (109, TRUE, 'MRI', 2), (110, TRUE, 'Neck Brace', 2), (111, TRUE, 'Nerve Graft', 2), (112, TRUE, 'Occupational Therapy', 2), (113, TRUE, 'Proton Beam Radiation', 2), (114, TRUE, 'Radiation', 2), (115, TRUE, 'Radiation - Gamma Knife', 2), (116, TRUE, 'Radiation - Proton', 2), (117, TRUE, 'Shunt', 2), (118, TRUE, 'Shunt - VP', 2), (119, TRUE, 'Stem Cells', 2), (120, TRUE, 'Surgery', 2), (121, TRUE, 'Tracheostomy', 2), (122, TRUE, 'Trial Study', 2); INSERT INTO DIAGNOSIS(DIAGNOSIS_ID, DESCRIPTION) VALUES (1, 'Anaplastic Astrocytoma'), (2, 'Anaplastic Ependymoma'), (3, 'Anaplastic Medulloblastoma / Large Cell'), (4, 'Astrocytoma'), (5, 'Astrocytoma / Low Grade'), (6, 'ATRT (Atypical Teratoid/Rhabdoid Tumor)'), (7, 'Benign Meningioma (Meningioangiomotosis)'), (8, 'Brain Stem Glioma'), (9, 'Brainstem Tumor'), (10, 'Cerebellar Astrocytoma'), (11, 'CNS Germ Cell Tumor (Nongerminomatous)'), (12, 'Cranialpharingioma / Malignant'), (13, 'Craniopharyngioma / Benign'), (14, 'Desmoplastic Infantile Ganglioma'), (15, 'Diffuse Brain Stem Glioma'), (16, 'Diffuse Pontine Brainstem Glioma'), (17, 'Ependymoblastoma'), (18, 'Ependymoma'), (19, 'Extraventricular Neurocytoma / Grade 2'), (20, 'Ganglioglioma'), (21, 'Glioblastoma'), (22, 'Glioma / Low Grade'), (23, 'Glioma / Malignant'), (24, 'Gliomatosis Cerebri'), (25, 'Glioneuro Astrocytoma'), (26, 'Glioneurocytoma'), (27, 'Hamartoma / Benign'), (28, 'Hypothalamic Astrocytoma'), (29, 'Hypothalamic Optic Chiasm Pilocytic Astrocytoma'), (30, 'Juvenile Pilocytic Astrocytoma (JPA)'), (31, 'Juvenile Pilocytic Astrocytoma (JPA) / Brainstem'), (32, 'Juvenile Pilocytic Astrocytoma (JPA) / Cerebellum)'), (33, 'Juvenile Pilocytic Astrocytoma (JPA) / Right Thalamus'), (34, 'Juvenile Pilocytic Astrocytoma (JPA) /Midbrain'), (35, 'Medullablastoma'), (36, 'Meningioangioendolethialmetosis'), (37, 'Mixed Germ Cell'), (38, 'Neurofibromatosis (NFI)'), (39, 'Oligodendroglioma'), (40, 'Optic Chiasm Glioma'), (41, 'Optic Glioma / Non NF / Non Neurofibromatosis'), (42, 'Osteosarcoma'), (43, 'Pilocytic Astrocytoma'), (44, 'Pilocytic Astrocytoma / Brain Stem'), (45, 'Pilocytic Astrocytoma / Cerebellum'), (46, 'Pilocytic Astrocytoma w/ dissemination'), (47, 'Pituitary Adenoma'), (48, 'Pituitary Tumor'), (49, 'PNET (Primitive Neuroectodermal Tumor)'), (50, 'PNET / Brainstem'), (51, 'Pontine Glioma'), (52, 'Tectal Plate Glioma'), (53, 'Tectalglioma'), (54, 'Third Ventricle Glioma (Astrocytoma)'); --Dummy Data insert into users(id, admin, active, first_name, last_name) values('work@pls', false, false, 'John', 'Smith'); insert into users(id, admin, active, first_name, last_name) values('work@gmail.com', true, true, 'Bob', 'Smith'); insert into users(id, admin, active, first_name, last_name) values('bafz86@mst.edu', false, false, '', ''); insert into users(id, admin, active, first_name, last_name) values('fabirk93@gmail.com',true, true, '', ''); insert into users(id, admin, active, first_name, last_name) values('kylemiller457@gmail.com',false, true, '', ''); insert into users(id, admin, active, first_name, last_name) values('thanlone1995@gmail.com',false, true, '', ''); insert into users(id, admin, active, first_name, last_name) values('theismanj@gmail.com', true, true, '', ''); insert into users(id, admin, active, first_name, last_name) values('toscott1@gmail.com', true, true, 'Tony', 'Scott'); insert into users(id, admin, active, first_Name, last_Name) values('piece@heart', true, true, 'mike', 'schreiber'); insert into users(id, admin, active, first_Name, last_Name) values('javaducky@gmail.com', true, true, 'Paul', 'Balogh'); --Contact #1 insert into contact(contact_Id, first_Name, last_Name, mentor, mentee, do_Not_Contact, primary_Phone_Number, primary_Phone_Number_Visible_To_Match, secondary_Phone_Number, secondary_Phone_Number_Visible_To_Match, city, state, primary_Email, primary_Email_Visible_To_Match, secondary_Email, secondary_Email_Visible_To_Match, contact_Note, admin_Note) values (1, 'John', 'Smith', TRUE, FALSE, FALSE, '8009999999', TRUE, NULL, FALSE, 'St. Louis', 'MO', 'work@pls', TRUE, NULL, FALSE, 'I can be reached by email or SMS.', 'Great feedback from prior matches.'); --Begin Child for Contact 1 insert into child(child_id, bereaved, date_of_birth, date_of_death, first, last, contact_id) values (1, FALSE, 946706400000, NULL, 'Tyler', 'Smith', 1); insert into child_diagnosis(child_id, diagnosis_id, age_of_diagnosis) values (1, 45, 3); insert into child_subcategory(child_id, subcategory_id) values (1, 7), (1, 53), (1, 54), (1, 73), (1, 74), (1, 76), (1, 79), (1, 89), (1, 109), (1, 126), (1, 139), (1, 142), (1, 143), (1, 145), (1, 173), (1, 178), (1, 193); insert into category_note(child_id, category_id, note) values (1, 1, 'Loss of balance.'), (1, 2, 'Surgery was only treatment. 2 resection surgeries.'); --End Child for Contact 1 --Contact #2 insert into contact(contact_Id, first_Name, last_Name, mentor, mentee, do_Not_Contact, primary_Phone_Number, primary_Phone_Number_Visible_To_Match, secondary_Phone_Number, secondary_Phone_Number_Visible_To_Match, city, state, primary_Email, primary_Email_Visible_To_Match, secondary_Email, secondary_Email_Visible_To_Match, contact_Note, admin_Note) values (2, 'Janis', 'Joplin', FALSE, TRUE, FALSE, '8675309', TRUE, NULL, FALSE, 'St. Louis', 'MO', 'piece@heart', TRUE, NULL, FALSE, 'I can be reached by email or SMS.', 'Great feedback from prior matches.'); --Begin Child for Contact 2 insert into child(child_id, bereaved, date_of_birth, date_of_death, first, last, contact_id) values (2, FALSE, 949806400000, NULL, 'John', 'Jones', 2); insert into child_diagnosis(child_id, diagnosis_id, age_of_diagnosis) values (2, 45, 2); insert into child_subcategory(child_id, subcategory_id) values (2, 7), (2, 53), (2, 55), (2, 73), (2, 74), (2, 76), (2, 79), (2, 89), (2, 109), (2, 127), (2, 140), (2, 142), (2, 143), (2, 145), (2, 173), (2, 174), (2, 190); insert into category_note(child_id, category_id, note) values (2, 1, 'Loss of balance and facial paralysis. Smile surgery where tongue nerve was used for smile.'), (2, 2, 'Surgery was only treatment.'); --End Child for Contact 2 --Contact #3 insert into contact(contact_Id, first_Name, last_Name, mentor, mentee, do_Not_Contact, primary_Phone_Number, primary_Phone_Number_Visible_To_Match, secondary_Phone_Number, secondary_Phone_Number_Visible_To_Match, city, state, primary_Email, primary_Email_Visible_To_Match, secondary_Email, secondary_Email_Visible_To_Match, contact_Note, admin_Note) values (3, 'Tom', 'Bombadil', FALSE, TRUE, FALSE, '111222333', TRUE, NULL, FALSE, 'St. Louis', 'MO', 'shire@forest', TRUE, NULL, FALSE, 'I can be reached by butterfly', 'Great feedback from prior matches.'); --Begin Child for Contact 3 insert into child(child_id, bereaved, date_of_birth, date_of_death, first, last, contact_id) values (3, FALSE, 976706400000, NULL, 'Nick', 'Daniels', 3); insert into child_diagnosis(child_id, diagnosis_id, age_of_diagnosis) values (3, 45, 11); insert into child_subcategory(child_id, subcategory_id) values (3, 7), (3, 51), (3, 55), (3, 73), (3, 74), (3, 76), (3, 79), (3, 89), (3, 109), (3, 127), (3, 139), (3, 142), (3, 143), (3, 145), (3, 173), (3, 176), (3, 190); insert into category_note(child_id, category_id, note) values (3, 1, 'Facial paralysis. Smile surgery where tongue nerve was used for smile.'), (3, 2, 'still working on treatment plan'); --End Child for Contact 3 --Contact #4 insert into contact(contact_Id, first_Name, last_Name, mentor, mentee, do_Not_Contact, primary_Phone_Number, primary_Phone_Number_Visible_To_Match, secondary_Phone_Number, secondary_Phone_Number_Visible_To_Match, city, state, primary_Email, primary_Email_Visible_To_Match, secondary_Email, secondary_Email_Visible_To_Match, contact_Note, admin_Note) values (4, 'Tom', 'Jerry', FALSE, TRUE, FALSE, '111222333', TRUE, NULL, FALSE, 'Troy', 'MO', 'test@forest', TRUE, NULL, FALSE, 'I can be reached by butterfly.', ''); --Begin Child for Contact 4 insert into child(child_id, bereaved, date_of_birth, date_of_death, first, last, contact_id) values (4, FALSE, 946706400000, NULL, 'Nick', 'Daniels', 4); insert into child_diagnosis(child_id, diagnosis_id, age_of_diagnosis) values (4, 16, 11); insert into child_subcategory(child_id, subcategory_id) values (4, 8), (4, 12), (4, 55), (4, 70), (4, 74), (4, 76), (4, 86), (4, 89); insert into category_note(child_id, category_id, note) values (4, 1, 'Facial paralysis. Smile surgery where tongue nerve was used for smile.'), (4, 2, 'still working on treatment plan'); --End Child for Contact 4 --Contact #5 insert into contact(contact_Id, first_Name, last_Name, mentor, mentee, do_Not_Contact, primary_Phone_Number, primary_Phone_Number_Visible_To_Match, secondary_Phone_Number, secondary_Phone_Number_Visible_To_Match, city, state, primary_Email, primary_Email_Visible_To_Match, secondary_Email, secondary_Email_Visible_To_Match, contact_Note, admin_Note) values (5, 'larry', 'sams', FALSE, TRUE, FALSE, '111222333', TRUE, NULL, FALSE, 'Kansas City', 'MO', 'royals@forest', TRUE, NULL, FALSE, 'I can be reached by text', ''); --Begin Child for Contact 5 insert into child(child_id, bereaved, date_of_birth, date_of_death, first, last, contact_id) values (5, FALSE, 946706400000, NULL, 'Emma', 'Sams', 5); insert into child_diagnosis(child_id, diagnosis_id, age_of_diagnosis) values (5, 16, 11); insert into child_subcategory(child_id, subcategory_id) values (5, 8), (5, 12), (5, 55), (5, 70), (5, 74), (5, 76), (5, 86), (5, 89); insert into category_note(child_id, category_id, note) values (5, 1, 'Facial paralysis. Smile surgery where tongue nerve was used for smile.'), (5, 2, 'still working on treatment plan'); --End Child for Contact 5 --Contact #6 insert into contact(contact_Id, first_Name, last_Name, mentor, mentee, do_Not_Contact, primary_Phone_Number, primary_Phone_Number_Visible_To_Match, secondary_Phone_Number, secondary_Phone_Number_Visible_To_Match, city, state, primary_Email, primary_Email_Visible_To_Match, secondary_Email, secondary_Email_Visible_To_Match, contact_Note, admin_Note) values (6, 'Deb', 'Ice', FALSE, TRUE, FALSE, '111222333', TRUE, NULL, FALSE, 'Wentzville', 'MO', 'teach@nisc', TRUE, NULL, FALSE, 'I can be reached by facebook.', ''); --Begin Child for Contact 6 insert into child(child_id, bereaved, date_of_birth, date_of_death, first, last, contact_id) values (6, FALSE, 946708400000, NULL, 'Tracy', 'Ice', 6); insert into child_diagnosis(child_id, diagnosis_id, age_of_diagnosis) values (6, 16, 8); insert into child_subcategory(child_id, subcategory_id) values (6, 2), (6, 10), (6, 55), (6, 73), (6, 74), (6, 76), (6, 86), (6, 92), (6, 93), (6, 94); insert into category_note(child_id, category_id, note) values (6, 1, 'Facial paralysis.'); --End Child for Contact 6 --Contact #7 insert into contact(contact_Id, first_Name, last_Name, mentor, mentee, do_Not_Contact, primary_Phone_Number, primary_Phone_Number_Visible_To_Match, secondary_Phone_Number, secondary_Phone_Number_Visible_To_Match, city, state, primary_Email, primary_Email_Visible_To_Match, secondary_Email, secondary_Email_Visible_To_Match, contact_Note, admin_Note) values (7, 'Deb', 'Ice', FALSE, TRUE, FALSE, '111222333', TRUE, NULL, FALSE, 'Wentzville', 'MO', 'teach@nisc', TRUE, NULL, FALSE, 'I can be reached by facebook.', ''); --Begin Child for Contact 7 insert into child(child_id, bereaved, date_of_birth, date_of_death, first, last, contact_id) values (7, FALSE, 946708400000, NULL, 'Tracy', 'Ice', 7); insert into child_diagnosis(child_id, diagnosis_id, age_of_diagnosis) values (7, 16, 8); insert into child_subcategory(child_id, subcategory_id) values (7, 5), (7, 8), (7, 9), (7, 14), (7, 17), (7, 21), (7, 25), (7, 27), (7, 31), (7, 32); insert into category_note(child_id, category_id, note) values (7, 6, 'SSM.'), (7, 2, 'therapy'); --End Child for Contact 7 --Contact #8 insert into contact(contact_Id, first_Name, last_Name, mentor, mentee, do_Not_Contact, primary_Phone_Number, primary_Phone_Number_Visible_To_Match, secondary_Phone_Number, secondary_Phone_Number_Visible_To_Match, city, state, primary_Email, primary_Email_Visible_To_Match, secondary_Email, secondary_Email_Visible_To_Match, contact_Note, admin_Note) values (8, 'Ryan', 'Grape', FALSE, TRUE, FALSE, '111222333', TRUE, NULL, FALSE, 'Wentzville', 'MO', 'student@nisc', TRUE, NULL, FALSE, 'I can be reached by phone.', ''); --Begin Child for Contact 8 insert into child(child_id, bereaved, date_of_birth, date_of_death, first, last, contact_id) values (8, FALSE, 946708400000, NULL, 'Gale', 'Grape', 8); insert into child_diagnosis(child_id, diagnosis_id, age_of_diagnosis) values (8, 13, 7); insert into child_subcategory(child_id, subcategory_id) values (8, 1), (8, 58), (8, 69), (8, 74), (8, 87), (8, 91), (8, 92); insert into category_note(child_id, category_id, note) values (8, 6, 'Childrens hospital.'), (8, 2, 'therapy'); --End Child for Contact 8 --Contact #9 insert into contact(contact_Id, first_Name, last_Name, mentor, mentee, do_Not_Contact, primary_Phone_Number, primary_Phone_Number_Visible_To_Match, secondary_Phone_Number, secondary_Phone_Number_Visible_To_Match, city, state, primary_Email, primary_Email_Visible_To_Match, secondary_Email, secondary_Email_Visible_To_Match, contact_Note, admin_Note) values (9, 'Mike', 'Wazowski', FALSE, TRUE, FALSE, '111222333', TRUE, NULL, FALSE, 'St. Peters', 'MO', 'monstersinc@nisc', TRUE, NULL, FALSE, 'I can be reached by batphone.', ''); --Begin Child for Contact 9 insert into child(child_id, bereaved, date_of_birth, date_of_death, first, last, contact_id) values (9, FALSE, 946703400000, NULL, 'Joe', 'Wazowski', 9); insert into child_diagnosis(child_id, diagnosis_id, age_of_diagnosis) values (9, 13, 7); insert into child_subcategory(child_id, subcategory_id) values (9, 1); insert into category_note(child_id, category_id, note) values (9, 6, 'Childrens hospital.'), (9, 2, 'therapy'); --End Child for Contact 9 --Contact #10 insert into contact(contact_Id, first_Name, last_Name, mentor, mentee, do_Not_Contact, primary_Phone_Number, primary_Phone_Number_Visible_To_Match, secondary_Phone_Number, secondary_Phone_Number_Visible_To_Match, city, state, primary_Email, primary_Email_Visible_To_Match, secondary_Email, secondary_Email_Visible_To_Match, contact_Note, admin_Note) values (10, 'Marie', 'Allsbrook', FALSE, TRUE, FALSE, '111222333', TRUE, NULL, FALSE, 'Denver', 'CO', 'skiresort@nisc', TRUE, NULL, FALSE, 'I can be reached by cell phone.', ''); --Begin Child for Contact 10 insert into child(child_id, bereaved, date_of_birth, date_of_death, first, last, contact_id) values (10, FALSE, 946702900000, NULL, 'Olivia', 'Allsbrook', 10); insert into child_diagnosis(child_id, diagnosis_id, age_of_diagnosis) values (10, 14, 9); insert into child_subcategory(child_id, subcategory_id) values (10, 1), (10, 7), (10, 13), (10, 55), (10, 77), (10, 88), (10, 91); insert into category_note(child_id, category_id, note) values (10, 4, 'Depression and aggression'), (10, 2, 'therapy'); --End Child for Contact 10 --Contact #11 insert into contact(contact_Id, first_Name, last_Name, mentor, mentee, do_Not_Contact, primary_Phone_Number, primary_Phone_Number_Visible_To_Match, secondary_Phone_Number, secondary_Phone_Number_Visible_To_Match, city, state, primary_Email, primary_Email_Visible_To_Match, secondary_Email, secondary_Email_Visible_To_Match, contact_Note, admin_Note) values (11, 'Steven', 'Rogers', FALSE, TRUE, FALSE, '111222333', TRUE, NULL, FALSE, 'New York City', 'NY', 'captian@google', TRUE, NULL, FALSE, 'Dont call me, I will call you.', ''); --Begin Child for Contact 11 insert into child(child_id, bereaved, date_of_birth, date_of_death, first, last, contact_id) values (11, FALSE, 946202900000, NULL, 'Thor', 'Rogers', 11); insert into child_diagnosis(child_id, diagnosis_id, age_of_diagnosis) values (11, 14, 3); insert into child_subcategory(child_id, subcategory_id) values (11, 3), (11, 7), (11, 13), (11, 55), (11, 76), (11, 88), (11, 91); insert into category_note(child_id, category_id, note) values (11, 4, 'Aggression'), (11, 2, 'therapy'); --End Child for Contact 11 --Contact #12 insert into contact(contact_Id, first_Name, last_Name, mentor, mentee, do_Not_Contact, primary_Phone_Number, primary_Phone_Number_Visible_To_Match, secondary_Phone_Number, secondary_Phone_Number_Visible_To_Match, city, state, primary_Email, primary_Email_Visible_To_Match, secondary_Email, secondary_Email_Visible_To_Match, contact_Note, admin_Note) values (12, 'Natasha', 'Romanoff', FALSE, TRUE, FALSE, '111222333', TRUE, NULL, FALSE, 'New York City', 'NY', 'blackwidow@google', TRUE, NULL, FALSE, 'Just text me.', ''); --Begin Child for Contact 12 insert into child(child_id, bereaved, date_of_birth, date_of_death, first, last, contact_id) values (12, FALSE, 946902900000, NULL, 'Steven', 'Romanoff', 12); insert into child_diagnosis(child_id, diagnosis_id, age_of_diagnosis) values (12, 14, 3); insert into child_subcategory(child_id, subcategory_id) values (12, 13), (12, 17), (12, 43), (12, 55), (12, 76), (12, 88), (12, 91); insert into category_note(child_id, category_id, note) values (12, 5, 'has to avoid certain foods'), (12, 2, 'surgery and change in diet'); --End Child for Contact 12 --Contact #13 insert into contact(contact_Id, first_Name, last_Name, mentor, mentee, do_Not_Contact, primary_Phone_Number, primary_Phone_Number_Visible_To_Match, secondary_Phone_Number, secondary_Phone_Number_Visible_To_Match, city, state, primary_Email, primary_Email_Visible_To_Match, secondary_Email, secondary_Email_Visible_To_Match, contact_Note, admin_Note) values (13, 'Natasha', 'Romanoff', FALSE, TRUE, FALSE, '111222333', TRUE, NULL, FALSE, 'New York City', 'NY', 'blackwidow@google', TRUE, NULL, FALSE, 'Just text me.', ''); --Begin Child for Contact 13 insert into child(child_id, bereaved, date_of_birth, date_of_death, first, last, contact_id) values (13, FALSE, 946902900000, NULL, 'Steven', 'Romanoff', 13); insert into child_diagnosis(child_id, diagnosis_id, age_of_diagnosis) values (13, 14, 3); insert into child_subcategory(child_id, subcategory_id) values (13, 13), (13, 17), (13, 43), (13, 55), (13, 76), (13, 88), (13, 91); insert into category_note(child_id, category_id, note) values (13, 2, 'surgery and change in diet'); --End Child for Contact 12 --Contact #14 insert into contact(contact_Id, first_Name, last_Name, mentor, mentee, do_Not_Contact, primary_Phone_Number, primary_Phone_Number_Visible_To_Match, secondary_Phone_Number, secondary_Phone_Number_Visible_To_Match, city, state, primary_Email, primary_Email_Visible_To_Match, secondary_Email, secondary_Email_Visible_To_Match, contact_Note, admin_Note) values (14, 'Natasha', 'Romanoff', FALSE, TRUE, FALSE, '111222333', TRUE, NULL, FALSE, 'New York City', 'NY', 'blackwidow@google', TRUE, NULL, FALSE, 'Just text me.', ''); --Begin Child for Contact 14 insert into child(child_id, bereaved, date_of_birth, date_of_death, first, last, contact_id) values (14, FALSE, 941902900000, NULL, 'Steven', 'Romanoff', 14); insert into child_diagnosis(child_id, diagnosis_id, age_of_diagnosis) values (14, 1, 13); insert into child_subcategory(child_id, subcategory_id) values (14, 13), (14, 17), (14, 43), (14, 55), (14, 79), (14, 88), (14, 91), (14, 92); insert into category_note(child_id, category_id, note) values (14, 5, 'has to avoid certain foods'), (14, 2, 'change in diet'); --End Child for Contact 14 --Contact #15 insert into contact(contact_Id, first_Name, last_Name, mentor, mentee, do_Not_Contact, primary_Phone_Number, primary_Phone_Number_Visible_To_Match, secondary_Phone_Number, secondary_Phone_Number_Visible_To_Match, city, state, primary_Email, primary_Email_Visible_To_Match, secondary_Email, secondary_Email_Visible_To_Match, contact_Note, admin_Note) values (15, 'Roger', 'Stooge', FALSE, TRUE, FALSE, '111222333', TRUE, NULL, FALSE, 'Troy', 'IL', 'nisc@forest', TRUE, NULL, FALSE, 'Great feedback from prior matches.', ''); --Begin Child for Contact 15 insert into child(child_id, bereaved, date_of_birth, date_of_death, first, last, contact_id) values (15, FALSE, 976706400000, NULL, 'Leon', 'Stooge', 15); insert into child_diagnosis(child_id, diagnosis_id, age_of_diagnosis) values (15, 45, 11); insert into child_subcategory(child_id, subcategory_id) values (15, 4), (15, 31), (15, 45), (15, 43), (15, 64), (15, 76), (15, 87), (15, 88), (15, 89), (15, 127), (15, 139), (15, 142), (15, 143), (15, 145), (15, 173), (15, 176), (15, 190); insert into category_note(child_id, category_id, note) values (15, 1, 'Facial paralysis. Smile surgery where tongue nerve was used for smile.'), (15, 2, 'still working on treatment plan'); --End Child for Contact 15 -- The following contacts are used for integration tests. Do not modify ------------------------------------------------------------------------------------------------------------------------ --Contact #16 insert into contact(contact_Id, first_Name, last_Name, mentor, mentee, do_Not_Contact, primary_Phone_Number, primary_Phone_Number_Visible_To_Match, secondary_Phone_Number, secondary_Phone_Number_Visible_To_Match, city, state, primary_Email, primary_Email_Visible_To_Match, secondary_Email, secondary_Email_Visible_To_Match, contact_Note, admin_Note) values (16, 'Anakin', 'Skywalker', FALSE, TRUE, FALSE, '111222333', TRUE, NULL, FALSE, 'Mos Espa', 'Tatooine', 'anakin@nomail.com', TRUE, NULL, FALSE, 'Great feedback from prior matches.', ''); --Begin Child for Contact 16 insert into child(child_id, bereaved, date_of_birth, date_of_death, first, last, contact_id) values (16, FALSE, 976706400000, NULL, 'Luke', 'Skywalker', 16); insert into child_diagnosis(child_id, diagnosis_id, age_of_diagnosis) values (16, 9, 11); insert into child_subcategory(child_id, subcategory_id) values (16, 4), (16, 31), (16, 45), (16, 43), (16, 64), (16, 76), (16, 87), (16, 88), (16, 89), (16, 127), (16, 139), (16, 142), (16, 143), (16, 145), (16, 173), (16, 176), (16, 190); insert into category_note(child_id, category_id, note) values (16, 1, 'Facial paralysis. Smile surgery where tongue nerve was used for smile.'), (16, 2, 'still working on treatment plan'); --End Child for Contact 16 --Contact #17 insert into contact(contact_Id, first_Name, last_Name, mentor, mentee, do_Not_Contact, primary_Phone_Number, primary_Phone_Number_Visible_To_Match, secondary_Phone_Number, secondary_Phone_Number_Visible_To_Match, city, state, primary_Email, primary_Email_Visible_To_Match, secondary_Email, secondary_Email_Visible_To_Match, contact_Note, admin_Note) values (17, 'Padme', 'Amidala', TRUE, FALSE, FALSE, '111222333', TRUE, NULL, FALSE, 'Theed', 'Naboo', 'padme@nomail.com', TRUE, NULL, FALSE, 'Great feedback from prior matches.', ''); --Begin Child for Contact 17 insert into child(child_id, bereaved, date_of_birth, date_of_death, first, last, contact_id) values (17, FALSE, 976706400000, NULL, 'Leia', 'Skywalker', 17); insert into child_diagnosis(child_id, diagnosis_id, age_of_diagnosis) values (17, 9, 11); insert into child_subcategory(child_id, subcategory_id) values (17, 4), (17, 31), (17, 45), (17, 43), (17, 64), (17, 76), (17, 87), (17, 88), (17, 89), (17, 127), (17, 139), (17, 142), (17, 143), (17, 145), (17, 173), (17, 176), (17, 190); insert into category_note(child_id, category_id, note) values (17, 1, 'Facial paralysis. Smile surgery where tongue nerve was used for smile.'), (17, 2, 'still working on treatment plan'); --End Child for Contact 17 --Contact #18 insert into contact(contact_Id, first_Name, last_Name, mentor, mentee, do_Not_Contact, primary_Phone_Number, primary_Phone_Number_Visible_To_Match, secondary_Phone_Number, secondary_Phone_Number_Visible_To_Match, city, state, primary_Email, primary_Email_Visible_To_Match, secondary_Email, secondary_Email_Visible_To_Match, contact_Note, admin_Note) values (18, 'Darth', 'Maul', FALSE, TRUE, FALSE, '111222333', TRUE, NULL, FALSE, 'Underground', 'Dathomir', 'darth@nomail.com', TRUE, NULL, FALSE, 'Great feedback from prior matches.', ''); --Begin Child for Contact 18 insert into child(child_id, bereaved, date_of_birth, date_of_death, first, last, contact_id) values (18, FALSE, 976706400000, NULL, 'Savage', 'Opress', 18); insert into child_diagnosis(child_id, diagnosis_id, age_of_diagnosis) values (18, 10, 11); insert into child_subcategory(child_id, subcategory_id) values (18, 4), (18, 31), (18, 45), (18, 43), (18, 64), (18, 76), (18, 87), (18, 88), (18, 89), (18, 127), (18, 139), (18, 142), (18, 143), (18, 145), (18, 173), (18, 176), (18, 190); insert into category_note(child_id, category_id, note) values (18, 1, 'Facial paralysis. Smile surgery where tongue nerve was used for smile.'), (18, 2, 'still working on treatment plan'); --End Child for Contact 18 ------------------------------------------------------------------------------------------------------------------------ --Mentor_Mentee insert into mentor_mentee(mentor, mentee, time_matched) values (1,3, 1490405554); /* new added dummy data into alert table */ insert into alerts_update(date_time, message) values(1490459787000, 'A generic message'); insert into alerts_update (date_time, message) values (1488040587000, 'Phasellus id sapien in sapien iaculis congue. Vivamus metus arcu, adipiscing molestie, hendrerit at, vulputate vitae, nisl. Aenean lectus.'); insert into alerts_update (date_time, message) values (1456418187000, 'Pellentesque at nulla. Suspendisse potenti. Cras in purus eu magna vulputate luctus.');
true
7243ced8a043d345576eb1ca49dbfbe55e9c3110
SQL
goodsoul1914/DBA
/Scripts/Community/Michael J Swart/CollectWaitStats/WaitStats/DropObjects.sql
UTF-8
325
2.53125
3
[]
no_license
IF EXISTS ( SELECT * FROM msdb.dbo.sysjobs WHERE name = 'CollectWaitStats' ) BEGIN EXEC msdb.dbo.sp_delete_job @job_name = 'CollectWaitStats'; END; DROP PROCEDURE IF EXISTS dbo.s_CollectWaitStats; DROP PROCEDURE IF EXISTS dbo.s_WaitStatsHistogram; DROP VIEW IF EXISTS dbo.ImportantWaits; DROP TABLE IF EXISTS dbo.WaitStats;
true
e45558491c92bb9dea4219c6b6db7a0b7841eb85
SQL
jtcies/comcast-task
/jtc-sql-test.sql
UTF-8
1,964
4.1875
4
[]
no_license
-- using SQL Server syntax -- question 1 SELECT r.ACCT_NUM, r.PRODUCT, CASE WHEN r.PRODUCT = 'VEG' THEN 'Vegetable' WHEN r.PRODUCT = 'HOT DOG' THEN 'Hot Dog' WHEN r.PRODUCT = 'COOKIE' THEN 'Cookie' ELSE 'other' END as PROD2, r.MONTH, r.REVENUE FROM FINANCE.REVENUE as r -- question 2 SELECT r.ACCT_NUM, r.PRODUCT, r.MONTH, r.REVENUE FROM FINANCE.REVENUE WHERE r.ACCT_NUM = 9994523 and r.MONTH = "Feb" -- question 3 SELECT r.ACCT_NUM, r.PRODUCT, ag.GENDER, r.MONTH, r.REVENUE FROM FINANCE.REVENUE as r LEFT OUTER JOIN FINANACE.ACCOUNT_GENDER as ag on r.ACCT_NUM = ag.ACCT_NUM -- question 4 WITH REVENUE_CTE as ( SELECT r1.MONTH, r1.ACCT_NUM, r1.PRODUCT, r1.REVENUE FROM FINANCE.REVENUE as r1 UNION ALL SELECT r2.MONTH, r2.ACCT_NUM, r2.PRODUCT, r2.REVENUE FROM FINANCE.REVENUE as r2 ) SELECT ACCT_NUM, SUM(REVENUE) as REVENUE_TOTAL FROM REVENUE_CTE GROUP BY ACCT_NUM -- question 5 SELECT wl.MONTH, wl.LOCATION, count(distinct ACCT_NUM) as UNIQUE_VIEWERS FROM FINANCE.WIFI-LOGIN GROUP BY wl.MONTH, wl.LOCATION -- question 6 SELECT r.ACCT_NUM, r.PRODUCT, r.Date_local, r.CURRENTDAY, LAG(r.CURRENTDAY, 1, NULL) OVER (ORDER BY Date_local) as PREVIOUSDAY, LEAD(r.CURRENTDAY, 1, NULL) OVER (ORDER BY Date_local) as NEXTDAY FROM FINANCE.REVENUE01 as r -- question 7 SELECT r.ACCT_NUM, EOMONTH(r.DATE) as MONTH_END, r.REVENUE, ROW_NUMBER() OVER (PARTITION BY EOMONTH(r.DATE) ORDER BY r.REVENUE) as Rank FROM FINANCE.REVENUE01 as r WHERE ROW_NUMBER() OVER (PARTITION BY EOMONTH(r.DATE) ORDER BY r.REVENUE) IN (1, 2, 3) -- question 8 SELECT a.ACCT_NUM, a.CALL_DATE, CASE WHEN m.PURCHASE_DATE IS NOT NULL THEN 'Y' ELSE 'N' END as PRIOR_MONTH_PURCHASE FROM SERVICE.CALLS_APR as a LEFT OUTER JOIN FINANCE.PURCHASES_MAR as m on a.ACCT_NUM = m.ACCT_NUM
true
b6ddb665a28276f9a44b828202aa16c289380fab
SQL
thomasbroussard/2015s2f1
/IamCore/sql_scripts/create_table_identities.sql
UTF-8
207
2.546875
3
[]
no_license
CREATE TABLE IDENTITIES ( ID INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1), DISPLAY_NAME VARCHAR(255), EMAIL_ADDRESS VARCHAR(255), BIRTHDATE DATE, UID VARCHAR(25) )
true
ec42f245d7fdba510f806c101af60b473cf88856
SQL
Jai4/SQL
/HackerRank/Basic Join/AfricanCities.sql
UTF-8
199
3.9375
4
[]
no_license
//Given the CITY and COUNTRY tables, query the names of all cities where the CONTINENT is 'Africa'. SELECT C.NAME FROM CITY C INNER JOIN COUNTRY P ON C.COUNTRYCODE=P.CODE WHERE P.CONTINENT='Africa'
true
ddc434cece48294339aa65aa3367183ffb86efa2
SQL
diahrissa/Tugas-Praktikum-SOAP-Web-Service
/wsmusik/dbmusik.sql
UTF-8
1,988
3.203125
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 4.9.1 -- https://www.phpmyadmin.net/ -- -- Host: localhost -- Generation Time: May 19, 2021 at 04:46 PM -- Server version: 8.0.18 -- PHP Version: 5.6.39 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: `dbmusik` -- -- -------------------------------------------------------- -- -- Table structure for table `tbl_musik` -- CREATE TABLE `tbl_musik` ( `id` int(11) NOT NULL, `title` varchar(50) COLLATE utf8mb4_general_ci NOT NULL, `penyanyi` varchar(50) COLLATE utf8mb4_general_ci NOT NULL, `genre` varchar(50) COLLATE utf8mb4_general_ci NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; -- -- Dumping data for table `tbl_musik` -- INSERT INTO `tbl_musik` (`id`, `title`, `penyanyi`, `genre`) VALUES (1, 'DYNAMITE', 'BTS', 'Pop-KPop'), (3, 'Boy With Luv', 'BTS', 'Pop Funk'), (4, 'Sweet Night', 'BTS-V', 'Rock Ballad'), (5, 'Beraksi', 'Kotak', 'Rock'), (15, 'Butter', 'BTS', 'Pop, Funk-Rock'), (16, 'Life Goes On', 'BTS', 'KPOP'), (17, 'To The Bone', 'Pamungkas', 'Pop'), (18, 'Any Song', 'Zico', 'Pop-Kpop'), (19, 'I Love You 3000', 'Stephanie Poetri', 'Pop'), (20, 'Lathi', 'Weird Genius ft.Sara Fajira', 'Pop'); -- -- Indexes for dumped tables -- -- -- Indexes for table `tbl_musik` -- ALTER TABLE `tbl_musik` ADD PRIMARY KEY (`id`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `tbl_musik` -- ALTER TABLE `tbl_musik` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=21; 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
74ab58fd0601820a7d7d4bfe3bf2689f3d18276f
SQL
Mirgiacomo/api_rest_example
/dump.sql
UTF-8
2,328
3.078125
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 5.0.2 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Creato il: Apr 03, 2021 alle 09:45 -- Versione del server: 10.4.14-MariaDB -- Versione PHP: 7.2.33 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: `licenze` -- -- -------------------------------------------------------- -- -- Struttura della tabella `licenze` -- CREATE TABLE `licenze` ( `id` int(11) NOT NULL, `dominio` varchar(255) NOT NULL, `mailchimp_api_key` varchar(128) NOT NULL, `license_key` char(32) NOT NULL, `data_creazione` date NOT NULL DEFAULT current_timestamp() ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -------------------------------------------------------- -- -- Struttura della tabella `users` -- CREATE TABLE `users` ( `id` int(16) NOT NULL, `username` varchar(255) NOT NULL, `mail` varchar(255) NOT NULL, `password` varchar(128) NOT NULL, `is_active` tinyint(1) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dump dei dati per la tabella `users` -- INSERT INTO `users` (`id`, `username`, `mail`, `password`, `is_active`) VALUES (1, 'mirgiacomo', 'mirgiacomo@mail.com', '6bdf315a98facd73da6caf2f12600d5287c2ea35512379978b05be952577e8802a12d1bc0829d9e7f2fd0ebbb5a4b63dc46bee766943dd101a6833cea69b4bb0', 1); -- -- Indici per le tabelle scaricate -- -- -- Indici per le tabelle `licenze` -- ALTER TABLE `licenze` ADD PRIMARY KEY (`id`); -- -- Indici per le tabelle `users` -- ALTER TABLE `users` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `username` (`username`); -- -- AUTO_INCREMENT per le tabelle scaricate -- -- -- AUTO_INCREMENT per la tabella `licenze` -- ALTER TABLE `licenze` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=17; -- -- AUTO_INCREMENT per la tabella `users` -- ALTER TABLE `users` MODIFY `id` int(16) 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
85af9eaf706c1731b32aa8cdbbb9bef3cb916b38
SQL
objectledge/coral
/coral-tools/src/main/java/org/objectledge/coral/tools/refcheck/IntegrityChecker$resourceDomains.sql
UTF-8
487
3.953125
4
[]
no_license
select ad.resource_class_id attribute_class_id, ar.name attribute_class_name, ad.attribute_definition_id, ad.name ad_name, ad.domain, dr.resource_class_id domain_class_id, ar.db_table_name from coral_attribute_class ac join coral_attribute_definition ad using (attribute_class_id) join coral_resource_class ar using (resource_class_id) left outer join coral_resource_class dr on (dr.name = ad.domain) where ac.name = 'resource' and ad.domain is not null
true
c94ed54072795198c5feaa4235b7fa1bdabb5407
SQL
DriasFarouk/Piscine-PHP
/D05/ex08/ex08.sql
UTF-8
130
2.8125
3
[]
no_license
SELECT last_name, first_name, DATE(birthdate) AS birthdate FROM user_card WHERE YEAR(birthdate) = 1989 ORDER BY last_name ASC;
true
860610ee61378b820f5bcb53ebff6d32df5ecaad
SQL
steemcn/sole-server
/db/migrations/20160207192901_CreateTableSessions.sql
UTF-8
698
3.65625
4
[ "MIT" ]
permissive
-- +goose Up -- SQL in section 'Up' is executed when this migration is applied CREATE TABLE `sessions` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `user_id` INT(11) NOT NULL, `token` CHAR(36) NOT NULL COMMENT 'token is v4 uuid', `type` VARCHAR(63) NOT NULL DEFAULT '' COMMENT 'type can be reset-password or verify-email', `updated_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; ALTER TABLE `sessions` ADD UNIQUE INDEX (`token`), ADD UNIQUE INDEX (`user_id`, `type`), ADD INDEX (`updated_at`); -- +goose Down -- SQL section 'Down' is executed when this migration is rolled back DROP TABLE `sessions`;
true
0ea50135037945ec7660c0ec2554906b9a5fd655
SQL
jgoodhcg/chorechart
/resources/sql/add.sql
UTF-8
1,784
4.03125
4
[]
no_license
-- :name add-person! :! :n -- :doc creates a new person record insert into people (user_name, email, pass) values (:user_name, :email, :password) -- :name add-household! :<! :1 -- :doc creates a new household insert into households (house_name) values (:house_name) returning households.id as id -- :name add-roomate! :<! :1 -- :doc creates a new living_situation id given a person's email and the inviting account's living_situation_id returns person's user_name and new living_situation_id with person as (select id as person_id from people where people.email = :roomate_email), household as (select households.id as household_id from households inner join living_situations on living_situations.household_id = households.id where living_situations.id = :living_situation_id group by households.id) insert into living_situations (person_id, household_id) values ((select person_id from person), (select household_id from household)) returning living_situations.id as living_situation_id -- :name add-living-situation! :<! :1 -- :doc creates a living situation record given a household id and person id insert into living_situations (person_id, household_id) values (:person_id, :household_id) returning living_situations.id as living_situation_id -- :name add-chore! :! :n -- :doc creates a chore given a name, description, and household_id insert into chores (chore_name, description, household_id) values (:chore_name, :description, :household_id) returning chores.id, chores.chore_name, chores.description -- :name add-chart-entry! :! :n -- :doc creates a chore chart entry given a living_situation_id , chore_id, and moment in yyyy-mm-dd insert into chart (living_situation_id, chore_id, moment) values (:living_situation_id, :chore_id, :moment::date)
true
27e7c9eaa5784fb5ff817a87bfb42f030230224b
SQL
k0zakinio/arrange-anything
/src/main/resources/db/migration/V1__Create_Events_Table.sql
UTF-8
174
2.578125
3
[]
no_license
CREATE TABLE EVENTS ( id SERIAL PRIMARY KEY, title VARCHAR NOT NULL, owner_name VARCHAR NOT NULL, event_date VARCHAR NOT NULL, created_at TIMESTAMP DEFAULT NOW() );
true
cccb516f7293558dfb4accdaba22b925267a76ff
SQL
juliusskull/aiBsq
/aibsq.sql
UTF-8
3,654
3.1875
3
[]
no_license
-- -------------------------------------------------------- -- Host: 127.0.0.1 -- Versión del servidor: 5.5.25a - MySQL Community Server (GPL) -- SO del servidor: Win32 -- HeidiSQL Versión: 9.4.0.5125 -- -------------------------------------------------------- /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET NAMES utf8 */; /*!50503 SET NAMES utf8mb4 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; -- Volcando estructura para tabla aibsq.autor CREATE TABLE IF NOT EXISTS `autor` ( `id` int(11) NOT NULL AUTO_INCREMENT, `nombre` varchar(1000) NOT NULL DEFAULT '0', `fchalta` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1; -- Volcando datos para la tabla aibsq.autor: ~1 rows (aproximadamente) /*!40000 ALTER TABLE `autor` DISABLE KEYS */; INSERT INTO `autor` (`id`, `nombre`, `fchalta`) VALUES (1, '0', '2021-02-10 11:51:56'), (2, 'x', '2021-02-10 11:53:36'); /*!40000 ALTER TABLE `autor` ENABLE KEYS */; -- Volcando estructura para tabla aibsq.comentario CREATE TABLE IF NOT EXISTS `comentario` ( `id` int(11) NOT NULL AUTO_INCREMENT, `autor_id` int(11) NOT NULL DEFAULT '0', `comentario_id` int(11) NOT NULL DEFAULT '0', `contenido` varchar(1000) NOT NULL DEFAULT '0', `fchalta` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1; -- Volcando datos para la tabla aibsq.comentario: ~0 rows (aproximadamente) /*!40000 ALTER TABLE `comentario` DISABLE KEYS */; INSERT INTO `comentario` (`id`, `autor_id`, `comentario_id`, `contenido`, `fchalta`) VALUES (1, 1, 1, 'prueba', '2021-02-10 11:57:36'); /*!40000 ALTER TABLE `comentario` ENABLE KEYS */; -- Volcando estructura para tabla aibsq.post CREATE TABLE IF NOT EXISTS `post` ( `id` int(11) NOT NULL AUTO_INCREMENT, `red_id` int(11) NOT NULL DEFAULT '0', `autor_id` int(11) NOT NULL DEFAULT '0', `titulo` varchar(500) NOT NULL DEFAULT '0', `contenido` varchar(1000) DEFAULT '0', `fchalta` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1; -- Volcando datos para la tabla aibsq.post: ~0 rows (aproximadamente) /*!40000 ALTER TABLE `post` DISABLE KEYS */; INSERT INTO `post` (`id`, `red_id`, `autor_id`, `titulo`, `contenido`, `fchalta`) VALUES (1, 1, 1, 'prueba 1', 'prueba 1 contenido', '2021-02-10 12:03:52'); /*!40000 ALTER TABLE `post` ENABLE KEYS */; -- Volcando estructura para tabla aibsq.reaccion CREATE TABLE IF NOT EXISTS `reaccion` ( `id` int(11) NOT NULL AUTO_INCREMENT, `autor_id` int(11) NOT NULL DEFAULT '0', `post_id` int(11) NOT NULL DEFAULT '0', `comentario_id` int(11) NOT NULL DEFAULT '0', `tipo_reaccion` int(11) NOT NULL DEFAULT '0', `fchalta` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1; -- Volcando datos para la tabla aibsq.reaccion: ~0 rows (aproximadamente) /*!40000 ALTER TABLE `reaccion` DISABLE KEYS */; INSERT INTO `reaccion` (`id`, `autor_id`, `post_id`, `comentario_id`, `tipo_reaccion`, `fchalta`) VALUES (1, 0, 1, 1, 1, '2021-02-10 12:06:44'); /*!40000 ALTER TABLE `reaccion` ENABLE KEYS */; /*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */; /*!40014 SET FOREIGN_KEY_CHECKS=IF(@OLD_FOREIGN_KEY_CHECKS IS NULL, 1, @OLD_FOREIGN_KEY_CHECKS) */; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
true
f75fa576254f43d4635c4f54863ad45d47aa7751
SQL
mariomt/TopicosBD
/1.productos.sql
UTF-8
4,007
4.15625
4
[]
no_license
/*------------------------------*/ /*---------ESQUEMA_BD ---------*/ /*----------------------------*/ CREATE TABLE PRODUCTOS( ID INT(11) AUTO_INCREMENT, NOMBRE VARCHAR(80), MARCA VARCHAR(50), DESCRIPCION VARCHAR(255), PRECIO DOUBLE NOT NULL, PRIMARY KEY(ID) ); CREATE TABLE ORDEN_DESCRIPCION( ID INT(11), ID_PRODUCTO INT(11), CANTIDAD INT(11), PRIMARY KEY(ID,ID_PRODUCTO), FOREIGN KEY(ID_PRODUCTO) REFERENCES PRODUCTOS(ID) ); CREATE TABLE ORDEN_COMPRA( ID INT(11) AUTO_INCREMENT, FECHA TIMESTAMP, TOTAL DOUBLE NOT NULL, ID_DESCRIPCION INT(11), PRIMARY KEY(ID), FOREIGN KEY(ID_DESCRIPCION) REFERENCES ORDEN_DESCRIPCION(ID) ); CREATE TABLE PRODUCTOS_AUDIT( AUDIT_DATE TIMESTAMP, AUDIT_USER VARCHAR(40) NOT NULL, AUDIT_ACTION ENUM('update','delete','insert'), ID_PRODUCTO INT(11), PRECIO DOUBLE ); /*-----------------------------------*/ /*----DISPARADOR_ORDEN_DE_COMPRA----*/ /*---------------------------------*/ -- Cada que se realice un registro en la taba orden_compra se modificara el precio del producto -- Por cada unidad de producto ordenada se le incrementará en 1% a su precio actual para la siguientes ventas -- En el caso de el producto con menor demanda en esa orden, se le restará el 1% a su precio acutal para la siguiente venta. -- En este caso cuando sea un solo producto en la orden, a este se le restará el 1%. -- En el caso de haber dor productos con menor solo a uno se le restará el 1%, al otro se le sumara. DELIMITER // DROP TRIGGER IF EXISTS tg_ordenCompra_AI; CREATE TRIGGER tg_ordenCompra_AI AFTER INSERT ON ORDEN_COMPRA FOR EACH ROW BEGIN -- Declaración de variables. DECLARE done INT DEFAULT FALSE; DECLARE PAR_IDPRODUCTO INT(11); DECLARE PAR_CANTIDAD INT(11); DECLARE PAR_PRECIO DOUBLE DEFAULT 1; DECLARE CUR_PRODUCTO CURSOR FOR SELECT ID_PRODUCTO,CANTIDAD FROM ORDEN_DESCRIPCION WHERE ID=NEW.ID_DESCRIPCION AND ID_PRODUCTO!=(SELECT @MENOR:=ID_PRODUCTO FROM ORDEN_DESCRIPCION WHERE ID=NEW.ID_DESCRIPCION AND CANTIDAD=(SELECT MIN(CANTIDAD) FROM ORDEN_DESCRIPCION WHERE ID=NEW.ID_DESCRIPCION)) FOR UPDATE; DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; -- Calcular el nuevo precio del producto con menor venta. SET PAR_CANTIDAD :=(SELECT CANTIDAD FROM ORDEN_DESCRIPCION WHERE ID=NEW.ID_DESCRIPCION AND ID_PRODUCTO=@MENOR); SET PAR_PRECIO :=(SELECT PRECIO FROM PRODUCTOS WHERE ID=@MENOR); SET PAR_PRECIO =(PAR_PRECIO-(PAR_CANTIDAD*(0.01*PAR_PRECIO))); -- el precio no puede ser menor que uno por lo cual si es menor que 1 automaticamente se asigna el 1. IF(PAR_PRECIO<1)THEN UPDATE PRODUCTOS SET PRECIO=1 WHERE ID=@MENOR; ELSE UPDATE PRODUCTOS SET PRECIO=PAR_PRECIO WHERE ID=@MENOR; END IF; -- abrimos cursor. OPEN CUR_PRODUCTO; -- iniciamos el ciclo. read_loop: LOOP -- emparejamos las variables. FETCH CUR_PRODUCTO INTO PAR_IDPRODUCTO, PAR_CANTIDAD; -- verificamos si aun había registros en el cursor. -- en caso de no haber salir del ciclo. IF done THEN LEAVE read_loop; END IF; -- calculamos el nuevo precio +1% SET PAR_PRECIO = (SELECT PRECIO FROM PRODUCTOS WHERE ID=PAR_IDPRODUCTO); SET PAR_PRECIO = PAR_PRECIO+(PAR_CANTIDAD*(0.01*PAR_PRECIO)); UPDATE PRODUCTOS SET PRECIO=PAR_PRECIO WHERE ID=PAR_IDPRODUCTO; END LOOP; CLOSE CUR_PRODUCTO; END // DELIMITER ; /*-----------------------------------*/ /*----------TRIGGER_AUDIT-----------*/ /*---------------------------------*/ -- Cada que se modifique un registro de la tabla productos, en especifico del campo precio -- Se almacenará en la tabla productos_audit el precio antiguo y al producto al que pertenece -- entre otra informacion. DELIMITER // DROP TRIGGER IF EXISTS tg_productosAudit_BU; CREATE TRIGGER tg_productosAudit_BU BEFORE UPDATE ON PRODUCTOS FOR EACH ROW BEGIN IF NEW.PRECIO!=OLD.PRECIO THEN INSERT INTO PRODUCTOS_AUDIT(AUDIT_USER,AUDIT_ACTION,ID_PRODUCTO,PRECIO) VALUES (CURRENT_USER(),'update',OLD.ID,OLD.PRECIO); END IF; END // DELIMITER ; /*---------------------------------------*/
true
8521321663729218263b67a8e8db4517ab67b93b
SQL
davidOrtiz09/marketplace_java
/conf/evolutions/default/1.sql
UTF-8
663
3.3125
3
[]
no_license
# Marketplace schema creation # === !Ups create table "usuarios" ("id" SERIAL NOT NULL PRIMARY KEY,"nombre" VARCHAR NOT NULL ,"apellido" VARCHAR NOT NULL); create table "productos" ("id" SERIAL NOT NULL PRIMARY KEY, "descripcion" VARCHAR NOT NULL, "precio" numeric(21,8) NOT NULL); create table "compras" ("id" SERIAL NOT NULL PRIMARY KEY, "id_comprador" INTEGER NOT NULL, "esta_completa" boolean NOT NULL); create table "compras_de_productos" ("id" SERIAL NOT NULL PRIMARY KEY, "id_compra" INTEGER NOT NULL, "id_producto" INTEGER NOT NULL); # === !Downs DROP TABLE "compras_de_productos"; DROP TABLE "compras"; DROP TABLE "productos"; DROP TABLE "usuarios";
true
38abda87d0bbf9b3c83590f4ea98c51ce4bb28dc
SQL
JorgeAlcarazKuv/FashionWoW
/bd.sql
UTF-8
12,277
2.84375
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 4.7.3 -- https://www.phpmyadmin.net/ -- -- Servidor: localhost:8889 -- Tiempo de generación: 24-02-2018 a las 01:09:09 -- Versión del servidor: 5.6.35 -- Versión de PHP: 7.1.8 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET time_zone = "+00:00"; -- -- Base de datos: `fashionwow` -- -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `imagenes` -- CREATE TABLE `imagenes` ( `id_imagen` bigint(20) UNSIGNED NOT NULL, `url` varchar(200) NOT NULL, `id_usuario` bigint(20) UNSIGNED NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Volcado de datos para la tabla `imagenes` -- INSERT INTO `imagenes` (`id_imagen`, `url`, `id_usuario`) VALUES (11, 'https://i.imgur.com/4WGFKht.jpg', 102), (14, 'https://i.imgur.com/7X9cjX4.jpg', 191), (15, 'https://i.imgur.com/FskyCKe.jpg', 191); -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `items` -- CREATE TABLE `items` ( `id_item` int(10) UNSIGNED NOT NULL, `nombre_item` varchar(200) NOT NULL, `url_icono` varchar(300) NOT NULL, `id_casilla` int(10) UNSIGNED NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Volcado de datos para la tabla `items` -- INSERT INTO `items` (`id_item`, `nombre_item`, `url_icono`, `id_casilla`) VALUES (0, 'Casilla vacía', './assets/images/itemError.ico', 100), (7997, 'Máscara de Defias roja', 'http://media.blizzard.com/wow/icons/56/inv_misc_bandana_03.jpg', 1), (12700, 'Diseño: botas de placas imperiales', 'http://media.blizzard.com/wow/icons/56/inv_scroll_03.jpg', 0), (14617, 'Camisa de matasanos', 'http://media.blizzard.com/wow/icons/56/inv_shirt_red_01.jpg', 4), (23323, 'Corona del Festival del Fuego', 'http://media.blizzard.com/wow/icons/56/inv_helmet_96.jpg', 1), (30027, 'Botas de valor sin fin', 'http://media.blizzard.com/wow/icons/56/inv_boots_chain_08.jpg', 8), (30038, 'Cinturón de detonación', 'http://media.blizzard.com/wow/icons/56/inv_belt_13.jpg', 6), (30152, 'Capucha de avatar', 'http://media.blizzard.com/wow/icons/56/inv_helmet_93.jpg', 1), (31038, 'Bastón del redentor', 'http://media.blizzard.com/wow/icons/56/inv_staff_draenei_a_01.jpg', 17), (32271, 'Falda de naturaleza inmortal', 'http://media.blizzard.com/wow/icons/56/inv_pants_leather_23.jpg', 7), (32348, 'Cuchilla del alma', 'http://media.blizzard.com/wow/icons/56/inv_axe_60.jpg', 17), (40254, 'Capa de crisis evitada', 'http://media.blizzard.com/wow/icons/56/inv_misc_cape_naxxramas_03.jpg', 16), (40438, 'Cubrehombros de la Cámara del Consejo', 'http://media.blizzard.com/wow/icons/56/inv_shoulder_80.jpg', 3), (44112, 'Protectores de hombros de concha titilante', 'http://media.blizzard.com/wow/icons/56/inv_shoulder_haremmatron_d_01.jpg', 3), (45318, 'Mantón de enojo humeante', 'http://media.blizzard.com/wow/icons/56/inv_misc_cape_22.jpg', 16), (65943, 'Hombros encogidos del enloquecido', 'http://media.blizzard.com/wow/icons/56/inv_shoulder_136v3.jpg', 3), (96690, 'Mandiletes del médico brujo', 'http://media.blizzard.com/wow/icons/56/inv_glove_mail_raidshaman_m_01.jpg', 10), (114812, 'Guantes de tejido de maleficio', 'http://media.blizzard.com/wow/icons/56/inv_cloth_draenorcrafted_d_01gloves.jpg', 10), (118412, 'Espada magna del infierno', 'http://media.blizzard.com/wow/icons/56/inv_sword_2h_draenorchallenge_d_01.jpg', 17), (124277, 'Cinturón de piel de demonio despellejado', 'http://media.blizzard.com/wow/icons/56/inv_leather_raidrogue_p_01belt.jpg', 6), (124299, 'Falda de reflejo propio', 'http://media.blizzard.com/wow/icons/56/inv_robe_mail_raidshaman_p_01.jpg', 7), (124304, 'Espaldares petraformados bastos', 'http://media.blizzard.com/wow/icons/56/inv_shoulder_mail_raidshaman_p_01.jpg', 3), (124332, 'Yelmo de mirada demoníaca', 'http://media.blizzard.com/wow/icons/56/inv_helm_plate_raiddeathknight_p_01.jpg', 1), (124775, 'Guardarrenes de destreza de Gladiador salvaje', 'http://media.blizzard.com/wow/icons/56/inv_belt_mail_raidshaman_p_01.jpg', 6), (128819, 'Martillo Maldito', 'http://media.blizzard.com/wow/icons/56/inv_mace_1h_doomhammer.jpg', 21), (138344, 'Cadenas para piernas Garra de Águila', 'http://media.blizzard.com/wow/icons/56/inv_pant_mail_raidhunter_q_01.jpg', 7), (139208, 'Pechera con marcas de Colmillo Iracundo', 'http://media.blizzard.com/wow/icons/56/inv_chest_leather_raidmonk_q_01.jpg', 5), (139673, 'Coselete del Señor de la Muerte', 'http://media.blizzard.com/wow/icons/56/inv_plate_deathknightclass_d_01chest.jpg', 5), (139674, 'Grandes botas del Señor de la Muerte', 'http://media.blizzard.com/wow/icons/56/inv_plate_deathknightclass_d_01boot.jpg', 8), (139675, 'Guanteletes del Señor de la Muerte', 'http://media.blizzard.com/wow/icons/56/inv_plate_deathknightclass_d_01glove.jpg', 10), (139676, 'Yelmo del Señor de la Muerte', 'http://media.blizzard.com/wow/icons/56/inv_plate_deathknightclass_d_01helm.jpg', 1), (139678, 'Manto del Señor de la Muerte', 'http://media.blizzard.com/wow/icons/56/inv_plate_deathknightclass_d_01shoulder.jpg', 3), (147121, 'Pechera del guardián de tumbas', 'http://media.blizzard.com/wow/icons/56/inv_chest_plate_raiddeathknight_r_01.jpg', 5), (147146, 'Guantes de la tempestad Arcana', 'http://media.blizzard.com/wow/icons/56/inv_glove_cloth_raidmage_r_01.jpg', 10), (147182, 'Guantes diabólicos', 'http://media.blizzard.com/wow/icons/56/inv_glove_cloth_raidwarlock_r_01.jpg', 10), (147230, 'Coselete Escama Tormentosa galvanizado', 'http://media.blizzard.com/wow/icons/56/inv_chest_leather_draenorlfr_c_01.jpg', 5); -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `posts` -- CREATE TABLE `posts` ( `id_post` bigint(20) UNSIGNED NOT NULL, `id_usuario` bigint(20) UNSIGNED NOT NULL, `titulo` varchar(200) NOT NULL, `descripcion` text, `fecha` datetime NOT NULL, `id_imagen_principal` bigint(20) UNSIGNED NOT NULL, `id_item_cabeza` int(10) UNSIGNED DEFAULT NULL, `id_item_hombros` int(10) UNSIGNED DEFAULT NULL, `id_item_capa` int(10) UNSIGNED DEFAULT NULL, `id_item_pecho` int(10) UNSIGNED DEFAULT NULL, `id_item_camisa` int(10) UNSIGNED DEFAULT NULL, `id_item_tabardo` int(10) UNSIGNED DEFAULT NULL, `id_item_brazales` int(10) UNSIGNED DEFAULT NULL, `id_item_manos` int(10) UNSIGNED DEFAULT NULL, `id_item_cinturon` int(10) UNSIGNED DEFAULT NULL, `id_item_piernas` int(10) UNSIGNED DEFAULT NULL, `id_item_pies` int(10) UNSIGNED DEFAULT NULL, `id_item_arma1` int(10) UNSIGNED DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Volcado de datos para la tabla `posts` -- INSERT INTO `posts` (`id_post`, `id_usuario`, `titulo`, `descripcion`, `fecha`, `id_imagen_principal`, `id_item_cabeza`, `id_item_hombros`, `id_item_capa`, `id_item_pecho`, `id_item_camisa`, `id_item_tabardo`, `id_item_brazales`, `id_item_manos`, `id_item_cinturon`, `id_item_piernas`, `id_item_pies`, `id_item_arma1`) VALUES (11, 102, 'ThunderArmor', 'Armadura inspirada en un set de tormenta de los tótem de piedra.', '2018-02-22 18:47:16', 11, 23323, 124304, 0, 147230, 0, 0, 0, 96690, 124775, 124299, 0, 128819), (14, 191, 'GoldenMonk', 'Aspecto inspirado en los monjes pandaren del Monasterio de la Luz.', '2018-02-23 22:04:00', 14, 7997, 44112, 0, 147121, 14617, 0, 0, 114812, 124277, 138344, 0, 118412), (15, 191, 'LightAngel', 'Priests are devoted to the spiritual, and express their unwavering faith by serving the people. For millennia they have left behind the confines of their temples and the comfort of their shrines so they can support their allies in war-torn lands. In the midst of terrible conflict, no hero questions the value of the priestly orders.', '2018-02-23 22:11:47', 15, 30152, 65943, 40254, 139208, 0, 0, 0, 147146, 0, 32271, 30027, 31038); -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `usuarios` -- CREATE TABLE `usuarios` ( `id_usuario` bigint(20) UNSIGNED NOT NULL, `nombre_usuario` varchar(20) NOT NULL, `password` char(32) NOT NULL, `nivel` enum('usuario','moderador','admin','') NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Volcado de datos para la tabla `usuarios` -- INSERT INTO `usuarios` (`id_usuario`, `nombre_usuario`, `password`, `nivel`) VALUES (102, 'Administrador', 'c893bad68927b457dbed39460e6afd62', 'admin'), (191, 'VagabondSoul', 'c6d0b723d166d42f59d8f7beb9255215', 'usuario'), (193, 'Kuvadis', '81ac1ced3821541e1703e50673ec5273', 'usuario'); -- -- Índices para tablas volcadas -- -- -- Indices de la tabla `imagenes` -- ALTER TABLE `imagenes` ADD PRIMARY KEY (`id_imagen`), ADD KEY `id_usuario` (`id_usuario`); -- -- Indices de la tabla `items` -- ALTER TABLE `items` ADD PRIMARY KEY (`id_item`); -- -- Indices de la tabla `posts` -- ALTER TABLE `posts` ADD PRIMARY KEY (`id_post`), ADD KEY `id_item_hombros` (`id_item_hombros`,`id_item_capa`,`id_item_pecho`,`id_item_camisa`,`id_item_tabardo`,`id_item_brazales`,`id_item_manos`,`id_item_cinturon`,`id_item_piernas`,`id_item_pies`,`id_item_arma1`), ADD KEY `fk-arma1` (`id_item_arma1`), ADD KEY `fk-cabeza` (`id_item_cabeza`), ADD KEY `fk-pecho` (`id_item_pecho`), ADD KEY `fk-guantes` (`id_item_manos`), ADD KEY `fk-brazales` (`id_item_brazales`), ADD KEY `fk-tabardo` (`id_item_camisa`), ADD KEY `fk-cinturon` (`id_item_cinturon`), ADD KEY `fk-piernas` (`id_item_piernas`), ADD KEY `fk-pies` (`id_item_pies`), ADD KEY `fk-capa` (`id_item_capa`), ADD KEY `id_usuario` (`id_usuario`), ADD KEY `id_imagen_principal` (`id_imagen_principal`); -- -- Indices de la tabla `usuarios` -- ALTER TABLE `usuarios` ADD PRIMARY KEY (`id_usuario`), ADD UNIQUE KEY `uniq_nombre_usuario` (`nombre_usuario`); -- -- AUTO_INCREMENT de las tablas volcadas -- -- -- AUTO_INCREMENT de la tabla `imagenes` -- ALTER TABLE `imagenes` MODIFY `id_imagen` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=17; -- -- AUTO_INCREMENT de la tabla `posts` -- ALTER TABLE `posts` MODIFY `id_post` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=17; -- -- AUTO_INCREMENT de la tabla `usuarios` -- ALTER TABLE `usuarios` MODIFY `id_usuario` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=194; -- -- Restricciones para tablas volcadas -- -- -- Filtros para la tabla `imagenes` -- ALTER TABLE `imagenes` ADD CONSTRAINT `imagenes_ibfk_1` FOREIGN KEY (`id_usuario`) REFERENCES `usuarios` (`id_usuario`) ON DELETE CASCADE ON UPDATE CASCADE; -- -- Filtros para la tabla `posts` -- ALTER TABLE `posts` ADD CONSTRAINT `fk-arma1` FOREIGN KEY (`id_item_arma1`) REFERENCES `items` (`id_item`) ON DELETE SET NULL ON UPDATE CASCADE, ADD CONSTRAINT `fk-brazales` FOREIGN KEY (`id_item_brazales`) REFERENCES `items` (`id_item`) ON DELETE SET NULL ON UPDATE CASCADE, ADD CONSTRAINT `fk-cabeza` FOREIGN KEY (`id_item_cabeza`) REFERENCES `items` (`id_item`) ON DELETE SET NULL ON UPDATE CASCADE, ADD CONSTRAINT `fk-camisa` FOREIGN KEY (`id_item_camisa`) REFERENCES `items` (`id_item`) ON DELETE SET NULL ON UPDATE CASCADE, ADD CONSTRAINT `fk-capa` FOREIGN KEY (`id_item_capa`) REFERENCES `items` (`id_item`) ON DELETE SET NULL ON UPDATE CASCADE, ADD CONSTRAINT `fk-cinturon` FOREIGN KEY (`id_item_cinturon`) REFERENCES `items` (`id_item`) ON DELETE SET NULL ON UPDATE CASCADE, ADD CONSTRAINT `fk-guantes` FOREIGN KEY (`id_item_manos`) REFERENCES `items` (`id_item`) ON DELETE SET NULL ON UPDATE CASCADE, ADD CONSTRAINT `fk-hombros` FOREIGN KEY (`id_item_hombros`) REFERENCES `items` (`id_item`) ON DELETE SET NULL ON UPDATE CASCADE, ADD CONSTRAINT `fk-pecho` FOREIGN KEY (`id_item_pecho`) REFERENCES `items` (`id_item`) ON DELETE SET NULL ON UPDATE CASCADE, ADD CONSTRAINT `fk-piernas` FOREIGN KEY (`id_item_piernas`) REFERENCES `items` (`id_item`) ON DELETE SET NULL ON UPDATE CASCADE, ADD CONSTRAINT `fk-pies` FOREIGN KEY (`id_item_pies`) REFERENCES `items` (`id_item`) ON DELETE SET NULL ON UPDATE CASCADE, ADD CONSTRAINT `fk-tabardo` FOREIGN KEY (`id_item_camisa`) REFERENCES `items` (`id_item`) ON DELETE SET NULL ON UPDATE CASCADE, ADD CONSTRAINT `posts_ibfk_1` FOREIGN KEY (`id_usuario`) REFERENCES `usuarios` (`id_usuario`) ON DELETE CASCADE ON UPDATE CASCADE, ADD CONSTRAINT `posts_ibfk_2` FOREIGN KEY (`id_imagen_principal`) REFERENCES `imagenes` (`id_imagen`) ON DELETE CASCADE ON UPDATE CASCADE;
true